Also, I wanted to give credit to Matt Blodgett (http://www.mattblodgett.com/2009/07/rotten-tomatoes-netflix-...). He had the closest thing to what I was looking for (in that case it was a greasemonkey script that is a bit outdated). I re-used the portion of his code that translates movie names from Netflix, to the corresponding RT URL.
Thank you do much. I have wanted this for years. I know that Netflix is interested in predicting what I will like, but I basically never like movies with a tomato score below 75 or so, so before I always browse netflix with a rotten tomato tab open.
Yah definitely was finding myself doing the exact same thing... I decided to write it when I almost watched a movie that had like 20% on RT, but Netflix said it was 4.5* for me.
Sure. Feel free to ask more questions if I didn't touch on it.
So, using Chrome extensions, you're able to inject a javascript file into pages users browse to. You can limit which pages the javascript file is injected into using the Chrome Extensions' manifest.json files (in my case I limit it to injecting only into netflix.com and it's subdomains).
Here's how the injected javascript works in steps:
1. A user browses to a netflix.com page
2. Retrieve all the elements on the page that correspond to movie names (This is done by looking for all DOM elements with a specific class name that Netflix is using to identify the movies, in this case I found that the movie name is stored in the alt attribute of .boxShotImg elements).
Note: If Netflix changes their html so the elements with the class names I'm searching for no longer have the movie name as their alt tag, the script will no longer work and would need to be updated to match whatever classes Netflix changes to.
Now we know the movies on the page, we need to get the ratings from Rotten Tomatoes.
- I was going to try to use the Rotten Tomatoes API for this, but they have a rate limit of 10 calls per second, and no way to ask for ratings for multiple movies per call, so this doesn't work well when you have +10 movies per page, per user.
- So, given that I couldn't use the Rotten Tomatoes API, and given that Rotten Tomatoes' urls follow a predictable pattern, I did the following:
3. For each movie name, figure out the Rotten Tomatoes URL corresponding to that movie name, e.g.
www.rottentomatoes.com/m/[THE_MOVIE_NAME_WITH_UNDERSCROES_FOR_SPACES]
4. Crawl the URL of the Netflix page with an AJAX GET Request. (means we're doing as many AJAX requests as their are movies appearing on the Netflix page)
5. In the HTML that's returned from the AJAX request, search for the element that holds the movie's RT rating, in this case, and element with id #all-critics-meter ~ the HTML in there is the RT rating for that movie
(Note again here, that I assume RT has this consistent naming convention on its pages, and in its URL pattern, if any of this changes, again the script won't work).
6. Append the RT rating of each of the movie elements we've retrieved to the corresponding element on the Netflix page. (where I append the RT rating depends on what Netflix page the user is currently looking at, e.g. the Genres page, the home suggestions for you page, or the individual movie page .. but there are not that many pages to take care of with Netflix).
Hope that is somewhat clear and systematic.
One last side note is that when I was porting to the Safari extension, I hit a snag because I was unable to directly make AJAX requests to rotten tomatoes from netflix, because of Cross-Origin ajax restrictions. This is overcome in the Safari extension by communicating from the injected script, to another page that the extension itself has (background.html), which IS allowed to make Ajax requests cross-origin. The background page makes the ajax requests, gets the data we want, and sends it back to the injected script (all communication between the background.html and the injected script happening via Safari extensions' provided messaging protocols.
I'll post this to my blog as well: www.nicolaerusan.com
Not sure if it's a bug or not in Chrome. But I do recall having made a more complex Chrome extension before, where we were using the same background page strategy to handle the Cross-Origin behavior.
In either case, Chrome Extension documentation is in much better shape than Safari Extension documentation at this point.
Hey, I just uploaded the source - not very well commented, but hopefully illustrates the ideas (combine it along with the explanation above.) Feel free to extend it - I think it would be worthwhile to add the IMDB scores too (although I don't find them all that reliable personally :) ).
This is a great plugin. And, if someone created this for Grubhub and Foodler with integrated Yelp reviews I would be forever grateful. I can't count the number of times I've had to do the yelp crosscheck on those sites.
can one monetize an extension? i've always thought it would be nearly impossible based on its distribution. in any case.. its a long drawn out process but i think you can monetize through understanding customer taste. preference in movies is valuable because it is an effective consumer targeting mechanism. idk. what do you think? (or worse case, you can put up a ton of amazon dvd affiliate links and pray that someone buys a dvd. :P)
In summary: It's difficult to monetize an extension that mashes up A and B, unless you own A or B. (And usually just B - RottenTomatoes in this case - because Netflix could have done it themselves.)
The main attempts have been by messing with web pages, e.g. injecting affiliate IDs onto Amazon links or switching Google search results. Most of this violates advertising/affiliate agreements (Amazon's not going to pay for links which users were going to click on anyway) and often diminishes user experience.
These are not as cool as nicoslepicos' extension but I created a Chrome and Firefox extension a while back that lets you retrieve the Rotten Tomatoes and IMDB ratings for any movie highlighted (or if it's a link no highlighting is necessary).
25 comments
[ 3.7 ms ] story [ 71.6 ms ] threadAlso, I wanted to give credit to Matt Blodgett (http://www.mattblodgett.com/2009/07/rotten-tomatoes-netflix-...). He had the closest thing to what I was looking for (in that case it was a greasemonkey script that is a bit outdated). I re-used the portion of his code that translates movie names from Netflix, to the corresponding RT URL.
https://chrome.google.com/webstore/detail/ihlkcdpbkkaeijfdaj...
It allows you to sort all movies available on Netflix instant by the rotten tomatoe scores.
So, using Chrome extensions, you're able to inject a javascript file into pages users browse to. You can limit which pages the javascript file is injected into using the Chrome Extensions' manifest.json files (in my case I limit it to injecting only into netflix.com and it's subdomains).
Here's how the injected javascript works in steps:
1. A user browses to a netflix.com page
2. Retrieve all the elements on the page that correspond to movie names (This is done by looking for all DOM elements with a specific class name that Netflix is using to identify the movies, in this case I found that the movie name is stored in the alt attribute of .boxShotImg elements).
Note: If Netflix changes their html so the elements with the class names I'm searching for no longer have the movie name as their alt tag, the script will no longer work and would need to be updated to match whatever classes Netflix changes to.
Now we know the movies on the page, we need to get the ratings from Rotten Tomatoes. - I was going to try to use the Rotten Tomatoes API for this, but they have a rate limit of 10 calls per second, and no way to ask for ratings for multiple movies per call, so this doesn't work well when you have +10 movies per page, per user. - So, given that I couldn't use the Rotten Tomatoes API, and given that Rotten Tomatoes' urls follow a predictable pattern, I did the following:
3. For each movie name, figure out the Rotten Tomatoes URL corresponding to that movie name, e.g. www.rottentomatoes.com/m/[THE_MOVIE_NAME_WITH_UNDERSCROES_FOR_SPACES]
4. Crawl the URL of the Netflix page with an AJAX GET Request. (means we're doing as many AJAX requests as their are movies appearing on the Netflix page)
5. In the HTML that's returned from the AJAX request, search for the element that holds the movie's RT rating, in this case, and element with id #all-critics-meter ~ the HTML in there is the RT rating for that movie (Note again here, that I assume RT has this consistent naming convention on its pages, and in its URL pattern, if any of this changes, again the script won't work).
6. Append the RT rating of each of the movie elements we've retrieved to the corresponding element on the Netflix page. (where I append the RT rating depends on what Netflix page the user is currently looking at, e.g. the Genres page, the home suggestions for you page, or the individual movie page .. but there are not that many pages to take care of with Netflix).
Hope that is somewhat clear and systematic.
One last side note is that when I was porting to the Safari extension, I hit a snag because I was unable to directly make AJAX requests to rotten tomatoes from netflix, because of Cross-Origin ajax restrictions. This is overcome in the Safari extension by communicating from the injected script, to another page that the extension itself has (background.html), which IS allowed to make Ajax requests cross-origin. The background page makes the ajax requests, gets the data we want, and sends it back to the injected script (all communication between the background.html and the injected script happening via Safari extensions' provided messaging protocols.
If you have a blog page, I think its worthy to repost on there.
One question I do have. Is the Cross-Origin behavior on Chrome a bug? Seems like a security issue, but not really sure.
Again, thanks.
Not sure if it's a bug or not in Chrome. But I do recall having made a more complex Chrome extension before, where we were using the same background page strategy to handle the Cross-Origin behavior.
In either case, Chrome Extension documentation is in much better shape than Safari Extension documentation at this point.
Hey, I just uploaded the source - not very well commented, but hopefully illustrates the ideas (combine it along with the explanation above.) Feel free to extend it - I think it would be worthwhile to add the IMDB scores too (although I don't find them all that reliable personally :) ).
https://chrome.google.com/webstore/detail/pfjnpblfpdeldjpfok...
In summary: It's difficult to monetize an extension that mashes up A and B, unless you own A or B. (And usually just B - RottenTomatoes in this case - because Netflix could have done it themselves.)
The main attempts have been by messing with web pages, e.g. injecting affiliate IDs onto Amazon links or switching Google search results. Most of this violates advertising/affiliate agreements (Amazon's not going to pay for links which users were going to click on anyway) and often diminishes user experience.
Chrome: https://chrome.google.com/webstore/detail/pfmcppclannbbilgig...
Firefox: https://addons.mozilla.org/en-US/firefox/addon/movie-ratings...