Netflix-X2

PLUGIN STATUS UPDATE
Dear WordPress users, please note that this Netflix plugin works very differently as of June 2013. Netflix seems to have decommissioned personal RSS feeds for streaming customers. This has complicated the way the plugin works, and at this point I have not been able to find any information on what the roadmap is for RSS and streaming only customers. For DVD subscribers, you are unaffected besides the fact that your streaming feed will produce an error.

Basically, until we see where this ends up, I cannot guarantee or support how the plugin operates for streaming only Netflix subscribers. I welcome anyone to take what I’ve done, which was built on what Albert Banks had done, and do something more with it! The plugin is open source and you may use it/modify it/redistribute it as you see fit as long as it remains open source.

Plugin Information Summary
The WordPress Netflix-X2 plugin allows you to display content from the RSS feeds in your Netflix account into your WordPress Blog.  Netflix-X2 is based on the original Netflix plugin for WordPress by Albert Banks.  Enhancements have been made to allow support for the latest RSS feeds that Netflix offers. Most notably, you can use this plugin to show movies from your Netflix queue, to show your movies currently at home, to show any movie reviews you have written, and more!

Download the stable version: netflix-x2.1.4.1.zip
Official WP Page: Check out the official page on the WordPress plugin repository for Netflix-X2.

Example Page: www.ericvb.com/movies to see some real examples.
I have received a fair amount of email asking for the code I used to create my example movies page, so I’ve made that available via text file download here: http://www.ericvb.com/misc/Misc/netflixpage.txt

As you will see in the documentation below, the functionality of this plugin is fairly versatile.  It can be as simple as setting your options and dropping the widget into your sidebar, but you can also take it much further. The plugin can be used to display cover images, movie titles, and summary text for the movies in your Netflix queue. It can also display your recommendations as well as your movie reviews. It can essentially display content from any of the available Netflix RSS feeds.  (My personal favorite is displaying my movie reviews that I’ve written via Netflix).

Because the plugin is so functional, the more in-depth uses can be a bit difficult at first.  Take a look at some of these examples, and feel free to contact me with any questions.  Please enjoy using this plugin!.

PLEASE NOTE: WordPress by default does not support execution of PHP code within pages/posts. If you’re planning on using Netflix-X2 content in a page or post like I have done here then you’ll have to use a plugin like RunPHP or ExecPHP. However, this is not necessary if you embed the code within header/sidebar/footer php files.

Installation Instructions

  1. Download and unzip the plugin (directory and 3 files)
  2. Upload the folder (netflix-x2) to your WordPress wp-content/plugins directory on your webserver.
  3. Log into your WordPress administrative panel, click on ‘Plugins’ and activate the Netflix-X2 plugin.
  4. Configure the settings by adding your Netflix ID and also the type of content you wish to display. You can get your Netflix RSS ID by logging into your Netflix account, clicking on RSS link at the bottom of the page, and then simply copy and paste your ID from any of the available RSS feeds listed
  5. Add the Netflix-X2 widget to your sidebar! Or, see the General/Advanced usage options below

General Usage
For simplest usage, configure the options from the Netflix-X2 configuration within the WordPress administration panel, and then just put the Netflix-X2 widget into your widget-ready theme. Or, you can call the netflix function from within any of your wordpress files, such as sidebar.php.

Example:

<? netflix() ?>


Advanced Options:
For more advanced usage, there are more variables that can be set in the netflix function.

<? netflix($number_movies, $feed, $display_type, $image_size, $before, $after, $netflix_id); ?>


Options breakdown:

$number_movies – number of feed elements displayed (default is 10)

$feed
– Set which Netflix feed to use
home – displays movies you have at home currently (default)
queue – displays movies in your queue in order
instant – displays movies from your watch instantly queue
recommendations – displays the movies Netflix has recommended for you
recent – displays your recent rental activity
reviews – displays the most recent movie reviews you’ve written

$display_type – what to display.
title – shows only the movies title (default)
raw – displays raw text from rss feed
image – display the movie cover image
text – For the reviews feed, displays your review text. For all other feeds, displays the movie summary description

$image_size – if $type is set to ‘image’ this defines the image size
small – small image (64px X 90px) (default)
large – large image (110px X 154px)

$before – html appearing before each rss item (li, td, br tags for example)

$after – html appearing after each rss item

$netflix_id – your netflix id


Advanced Options Usage:

For example, this code would display large images for the next 10 items in your queue in an unordered list:

<ul>
<? netflix(10, “queue”, “image”, “large”, “<li>”, “</li>”, “P9999999999999999999999999999?); ?>
</ul>

And this code would display the images and titles of the next 20 items in your watch instantly queue:

<ul>
<? netflix(20, “instant”, “both”, “large”, “<li>”, “</li>”, “P9999999999999999999999999999?); ?>
</ul>

Additional Functions:

<? netflix_movies($number_movies, $feed, $netflix_id) ?>

This example code of the netflix_movies function will show the last 8 movie reviews you wrote in a nicely formatted unordered list:

<ul>
<? $movies = netflix_movies(8, “reviews”);
foreach ($movies as $movie) {
echo ‘<li>’;
echo ‘<strong>’,$movie->get_title(),’</strong>’;
echo ‘<br />’;
echo $movie->get_description();
echo ‘</li>’;
} ?>
</ul>

One last example of code, this would selects the next 25 movies from your queue, looping through them to display each cover image in a formatted html table.

<? $movies = netflix_movies(25, “queue”);
echo ‘<table><tr>’;
foreach ($movies as $movie) {
echo ‘<td>’;
echo $movie->get_cover_image();
echo ‘</td>’;
}
echo ‘</tr></table>’; ?>


Movie Functions Breakdown:

get_id()
Displays the Netflix movie ID

get_title()
Get the movie title

get_link()
Get link to movie on the Netflix website

get_description()
Reviews RSS Feed: This function retrieves the review you’ve written.
All other RSS Feeds: This function retrieves the movie summary.

get_cover_image($size)
Displays the movie cover image (linked from Netflix’s site)

get_cover_image_source($size)
Gets the html link address for the cover image.

Version History

Version 1.3.1 – 3/11/2010

  • – No need to include the rss.php any longer since we use SimplePie. Changed the require statments to call wp-includes/feed.php instead.
  • – Added a cache timer to counter the SimplePie 12 hour feed cache. Feeds are cached for 30 minutes now vs the 12 hour default.

Version 1.3 – 2/24/2010

  • – Configured REAL widget functionality instead of the hacky wanna-be widget. Works much nicer with user being able to pick title.
  • – Moved the options page to be loc1ated under “Settings” vs under the plugins page. Seems to be the standard now.
  • – Added a settings link on the plugins page for less clicks to get to configure the plugin.

Version 1.2.2 – 2/23/2010

  • – Switched fetch_rss functions from MagpieRSS to now use SimplePie function fetch_feed. This change done due to Magpie depreciation and non-active product.
  • – Removed ^M characters that had become present through Windows/Linux file editing.

Version 1.2.1 – 2/22/2010

  • – Minor change, updated include statements to call rss.php file from wp-includes instead of rss-functions.php.

Version 1.2 – 6/18/2009

  • – Adding “text only” options for feed display. This can be set in the plugin options screen, and can also be called directly by using the get_textonly() function. * Thanks to David McDonald – http://www.watchingred.com

Version 1.1 – 11/12/2008

  • – Widgetized the netflix-x2 plugin. No configurable options yet though.
  • – Added new display option “text” to the netflix function. This returns the user’s written review if they have picked the reviews feed; and returns the movie description for any other feed selection.

Version 1.0 – 11/7/2008

  • – Started with version 3.1 of Albert Banks’ original Netflix plugin
  • – Added support for the Reviews RSS feed
  • – Added support for the Watch Instantly Queue RSS feed

For any questions, concerns, or suggestions, please feel free to email me: vanberge@gmail.com

39 thoughts on “Netflix-X2

  1. Pingback: Introducing Netflix-X2 at PalmerForPresident.com

  2. Pingback: Nathan’s Thoughts » Site Updates

  3. Russ Turley

    The plugin, which previously worked great, now doesn’t work. I just have the standard tag in my template. Also just upgraded to WP 2.8.2. Anyone else have this break?

  4. Vanberge Post author

    Russ,
    I’m running Worpdress 2.8.2. currently myself and haven’t had any issues.
    What sort of problems are you experiencing?

    Actual PHP errors displayed? or perhaps just a lack of things showing up.

    Sometimes the Netflix feeds go offline or return blank information – I’ve had that happen from time to time on my site with no changes to my code.

    email me if you want with some specifics and I’ll do what I can do help. vanberge@gmail.com

  5. Jason

    I can’t seem to get this plugin to do anything. It looks great and is exactly what I’m looking for.

    I am using WordPress 2.8.6.
    I create a new page called netflix. Go to the page editor and insert (the example code). Nothing renders on the page. I tried all the various example code and it is not working. I’ve checked my RSS feeds to make sure they are work fine.

    In most of the cases it returns portions of the code or my Netflix ID as rendered HTML. I must be doing something wrong. Any ideas?

  6. Vanberge Post author

    Jason – you’re actually not doing anything wrong.
    When you put the php code into a page or post – wordpress wont execute it as php.

    I’m sure this is done for security reasons but it really REALLY sucks.

    i use a plugin called “RunPHP” to then allow the php code to run correctly

    give that a try, and it should work for you.

  7. Jason

    Thanks Eric. You were correct I was unable to execute PHP code insides pages and posts. RunPHP does not work with 2.8.6 so I had to use something called Exec-PHP which seems to work although you have to do some role management to get it to work.

  8. KC Lowlife

    Hi, I’m using your plugin to display movies that are currently checked out to me. When the movies are all returned and netflix hasn’t shipped new ones yet, I get the following error displayed:

    Warning: Invalid argument supplied for foreach() in /home/*OBFUSCATED*/kclowlife.com/wp-content/plugins/netflix-x2/netflix.php on line 59

    Any suggestions on a way to fix this?

  9. Vanberge Post author

    KC Lowlife,
    I’d have to see the php code you’re using.

    Does it happen if you use the “simpler” way of setting the options and just doing

  10. KC Lowlife

    I just installed your plugin and added the RSS feed then dropped the widget in place. Didn’t manipulate any PHP.

    Unfortunately, since this only occurs when I have 0 movies checked out, I can’t reproduce this at the moment. Since I do a fair bit with computers, I thought it would probably just be a test case that you missed. Like, if feed exists but films = 0 don’t error. Appreciate you answering. I’ll try to catch it again when it’s hosed in a few days.

  11. Vanberge

    Hmm… wierd.
    When i have no movies at home, it just outputs nothing. (same thing when netflix’s RSS feeds are down).

    but, i’.l do some looking into it and see what we can find out.

  12. KC Lowlife

    maybe it was one time thing. perhaps they don’t provision rss feeds until they see them being used. or perhaps their db was hosed. anyhow, I’ll let you know next time I see them all checked out. just got 3 more in, so hopefully in 2 more days.

  13. KC Lowlife

    nope, the issue is back. although it’s for a short period. I got the emails notifying me that it got my 3 movies in. Then I saw the error. Now(10 minutes later) it just shows nothing under the netflix tab, no error.

    sorry, but I’m not having any luck inserting that test php snippet into another section of the blog for testing. tried adding it to a raw html widget(you can see it in the left column) and I tried creating a page and inserting it in there but that didn’t work either(http://www.kclowlife.com/netflix-x2-test/). Sorry, I’m good at some computer stuff, but PHP and wordpress are still confusing me a bit.

  14. Paul Richardson

    Hi Vanberge,

    I notice you are now on 2.9 and still running Netflix X2. Did you switch from RunPHP to exec-PHP?

    After I installed Exec-PHP, then starting reading how I had to enable/disable bunches of stuff just to get THAT working, at that point I sort of gave up.

    I like your reviews (movies) page, and can’t find anything else like it.

  15. Paul Richardson

    Ok, I searched and experimented with all kind of other “products” and there is no other pluggin that comes close.

    I need to get your working for me.

    Actions thus far: demo test script here: http://bluesome.net/post/2005/08/18/50/#tests (the bottom one that reads “Handle This!”) works just fine, using Exec-PHP.

    Netflix X2 is printing nothing to the screen at all, using the “reviews” sample code above.

    (note that the other Netflix pluggins did print my Netflix Reviews RSS out fine, but UGLY and via Sidebar only)

  16. Vanberge Post author

    Paul – I actually still use RunPHP and haven’t had any problems.
    If you like, I can email you the code I use to generate my reviews section.

    Another thing to try with the netflix-x2 plugin would be to set all the options just as a test (your RSS id, queue, number of movies, etc. ) and then just call the netflix function in your sidebar to see if it works there.

    Hope that helps…

  17. Paul Richardson

    Hey Vanberge,

    Did you email me the code? I tried it with all options set (both in a standalone page, and via a sidebar widget), using the netflix function, but it still did not work >> it displays nothing at all.

    Again, it seems to work just fine using the ‘simple’ (basic) method of just calling the function alone:

  18. pan

    How can I show the “instant” queue in descending order? Right now the queue picks up the first x number of movies. Can I make it the last x number of movies in the instant list?

    Or is there a way (like one Facebook has) to show the recent “Ratings” (instead of reviews) I give to movies on Netflix?

  19. Vanberge Post author

    Pan,
    Currently there isn’t any way to display the feeds in any other order… They are read in just as they come from Netflix. So, right now the only possible way is ascending order.

    Also, the ratings from Netflix don’t currently exist in a Netflix RSS feed as the queues/reviews do – so unless they start offering an RSS feed for ratings this wont be possible with this plugin.

    Sorry I can’t give you better news!

  20. RS

    Thought I would post a diff for the version of netflix-x2 on the wordpress site (listed as 1.2). It uses the old magpie rss, which seems to not like either WordPress 2.9, or PHP 5.3 (not sure). It makes the plugin throw strpos errors, even though it seems to work. It’s odd.

    Anyway, easy fix is:

    58,59c58,59
    < $rss = fetch_rss($url);
    items as $item) {

    > $rss = fetch_feed($url);
    > foreach ($rss->get_items() as $item) {
    65c65
    $raw_title = $item->get_title();
    68,69c68,69
    < $link = $item['link'];
    $link = $item->get_link();
    > $description = $item->get_description();
    129c129
    $rss = fetch_feed($url);

  21. Vanberge Post author

    Interesting…
    RS, can I ask what led you to believe there are issues?

    I’ve not had any problems since upgrading to wordpress 2.9

  22. Christy

    I am running WordPress 2.9.2, uploaded plugin, went to activate it and received the following message: Plugin could not be activated because it triggered a fatal error.

    Is there any kind of plugin that might interfere with this one, or one maybe I do not have activated that I should? or any ideas at all…I tried installing this on earlier versions of WordPress 2.9 or 8 and it gave me same error.

  23. Vanberge Post author

    christy,

    I have never heard of that – and I’m running the plugin on wordpress 2.9.2.

    as long as you’ve activated the netflix plugin you should be good to go…

    Is there any other error text of any kind? or is that all we get?

    just for testing’s sake you could de-activate all other plugins temporarily and see if that changes anything. Let me know if that produces anything but at this point I don’t have any other ideas besides that.

  24. Vanberge Post author

    Christy and RS,

    Wanted to let you both know that I’ve updated the plugin as follows:

    instead of my include statements calling the depreciated file rss-functions.php, I am having it call the newer rss.php file for those rss parsing functions.

    I am thinking that solves issues on both accounts – but please let me know if there’s anything else I can do.

    RS, I considered putting your changes into the stable version of the plugin but the rss.php file included with wordpress does maintain the magpie rss functionality. So, at this point I think I’ll keep it as is.

    Thanks to you both, I hope you enjoy the plugin.

  25. Chells

    I’m getting this error when I use the widget:

    Fatal error: Call to undefined method WP_Error::get_items() in /home/sansdr2/public_html/journal/wp-content/plugins/netflix-x2/netflix.php on line 62

    I have WP 3.0

  26. Vanberge Post author

    Chells,
    Usually that error comes up when your netflix ID is not set correclty…
    Make sure you’ve got that set in the plugin options. So far the Plugin tests and works fine with the 3.0 release.

  27. Jeremy Meyers

    Hey Eric-

    Great job on the plugin (i’m using it on the footer of my site).

    This isn’t a bug report as much as a feature request. Me and my gf have separate profiles (and therefore different netflix ID #s) on the same account. Is there any way to build out the functionality to be able to provide more than one ID to have it pull data from, for this particular situation?

  28. Vanberge Post author

    Jeremy,
    Thanks for using the plugin! I’m glad you’ve found it useful.

    Your request is a valid one… That’s a great suggestion. That does present a significant code rewrite however – I will keep this in mind as something to work towards.

    Thanks very much for a great suggestion!

  29. Pingback: foist » How the Sidebars Work

  30. Pingback: WordPress Geekery « Lexi's Geekery

  31. Rabah Rahil

    I was wondering if this plug-in updates and how often because I have it installed on my sidebar widget and it doesn’t reflect the changes I have made to my queue. Thanks for the plug-in love it!

  32. Vanberge Post author

    Rabah,
    By default the feed engine will cache the feed data for 30 minutes. If you’re using an older version this could actually be as long as 12 hours.

    So, if you make queue changes, that will be reflected on your site after 30 minutes.
    Glad you like the plugin!

  33. Cheryl Free

    If I try to display more than 3 recent DVDs, it starts showing duplicates at number four . Is it possible to display more than 3?

    Could you give me an example PHP of how to include title and link with the large covers?

    Thank you!

  34. Vanberge Post author

    Cheryl,

    Are you trying to display movies in your queue or your overall rental activity?

    Netflix’s RSS feed for rental activity will also show returns; so my guess is you’re seeing the title of the movie being shipped to you and also it’s return to netflix.

    Try changing the feed to your queue instead of overall rental activity in the netflix options.

    Here’s a link to the text of my most recent movie example page (which is offline because my membership is currently on hold) but it should give you a good place to build from.

    http://www.ericvb.com/misc/Misc/netflixpage.txt

    Also note that you’ll have to have a plugin to allow execution of php (I use RunPHP)

  35. Cheryl Free

    Sorry for not distinguishing between questions. For the first one, it’s overall rental activity. I tried six at first. It listed the one I have a home of course, the two before that, the two before that AGAIN, and one more 🙁

    I didn’t even think of checking Netflix-X2 Configuration because I thought it was just for the widget. I had it set for 1 title from “Movies At Home”. I changed it to Queue, but it made no difference when I tried showing six movies again 🙁

    I used your example for the code:

    I also used them before writing yesterday to publish this page:
    http://theluckyladybug.net/about/movies/

    I’d really like to include title and link with the large covers, but haven’t figured out how to do it in a way that looks nice yet. Was hoping you might be able to help.
    I’m using “Allow PHP in posts and pages” 🙂

  36. Vanberge Post author

    The overall rental activity will always show two entries for movies that you have returned. Because netflix has shipped it to you, and you have also returned it. The netflix RSS feed contains both of those items.

    Looking at your page, it seems that you’ve gotten it looking really nice… Congrats!

    Let me know if you have any more questions.

    But to get large images, just use this call: get_cover_image($size) like i show in my example code.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.