On 14 December 2009, Netflix quietly launched a pair of new widget builders, at http://developer.netflix.com/widgets.
Both builders create single-line JavaScript widgets that inject a big chunk of the Netflix experience onto outside pages with very little effort on the part of the site operator. Here are a couple of example implementations and a tiny peek at how they work.
If you blog lots of movies and/or don't want to give up sidebar space for a static widget, the Bubble Widget is your friend. Here's a sample passage from our friends at Hacking Netflix:
Netflix New Releases for January 5th, 2010
Interesting titles include Cloudy with a Chance of Meatballs, The Final Destination, 50 Dead Men Walking, Big Love (Season 3), Chuck (Season 2), The Philanthropist: The Complete Series, The Good Witch, Trucker, and Adam.
Streaming releases this week include Monsters, Inc., Rocky V, Sling Blade, The Last Picture Show, and World's Greatest Dad (more on StreamingSoon).
The Bubble Widget is a single SCRIPT tag, which should be included at the very bottom of your page like this:
<script src="http://jsapi.netflix.com/us/api/w/b/bu100.js"></script>
To see it in action, mouse over any of the linked titles above.
Spotlight widgets come in many flavors and sizes. To make your own, visit the Spotlight Widget Builder, fill out the form, and collect your inline JavaScript.
The code for the first widget above looks like this:
<a href="http://movi.es/BVdT5" title="The Dark Knight on Netflix">The Dark Knight on Netflix</a> <script src="http://jsapi.netflix.com/us/api/w/s/sp100.js" settings="id=http://movi.es/BVdT5&w=132&h=tfn"></script>
Paste this into any Web page where you want the widget to show up, and you're done.
http://movi.es.movi.es if it renders correctly. If it doesn't come up, the link will still be there, which is critical for RSS readers and other no-JavaScript clients.http://movi.es/BVdT5, you'll be redirected to The Dark Knight's Netflix page.Although I was personally thrilled to play the role of the front-end developer on this project--much of it depends on the techniques detailed in Case-Hardened JavaScript, which is in desperate need of attention--the heavy lifting was done on the back end by the designers, managers, and engineers on the Netflix Developer Network team. They are: Anu Sonvane, Hans Granqvist, John Haren, JR Conlin, Lalitha Shankar, Michael Hart, Mikey Cohen, Navin Prasad, and Priya Poolavari.
Special thanks to: Adam Platti, Andy Baio, Ava Hristova, Barney Mok, Bill Scott, Chad Dickerson, Chanel Wheeler, Christian Heileman, Dan Theurer, Dave Balmer, Douglas Crockford, Dustin Diaz, Ed Ho, Eric Miraglia, Gina Groom, Hedger Wang, Heidi Pollack, Isaac Schleuter, Jason Levitt, Jeremy Gillick, Jeremy Zawodny, Jimmy Byrum, Jonathan Trevor, Kim Trott, Leonard Lin, Matt McAlister, Matt McCarthy, Matt Sweeney, Micah Laaker, Mike Davidson, Mike Lee, Nate Koechley, Pasha Sadri, Paul Bakaus, Peter Michaux, Rasmus Lerdorf, Scott Schiller, Steve Carlson, Taylor McKnight, Thomas Sha, and Vickie Brewster.
There's a lot more lurking backstage; after a few more internal issues settle out, I hope to be able to present a much more in-depth look at how Netflix widgets work, and what else you can do with the technology behind them them.
Full documentation for Netflix API Version Two is on the way; stay tuned to http://developer.netflix.com for further information.