[REQ] Rotten tomatoes import script

If you made a script you can offer it to the others here, or ask help to improve it. You can also report here bugs & problems with existing scripts.
Post Reply
daws0n
Posts: 53
Joined: 2005-02-04 13:53:18

[REQ] Rotten tomatoes import script

Post by daws0n »

Could any experienced scripters tell me if it's possible to import rotten tomatoes movie data into AMC?

Long ago, I created a greasemonkey script to convert any imdb links to to rotten tomatoes links by modifying the URL. This ability is now broke on the site, but I have recently changed it to interact with rotten tomatoe's new API:

for (var i = document.links.length - 1; i>=0; --i) {
var link = document.links, href = link.getAttribute("href");
if (href.indexOf("http://www.imdb")==0)
link.href = "http://api.rottentomatoes.com/api/publi ... e=imdb&id=" + href.match(/\d+/)[0];

e.g Robocop IMDB link:

http://www.imdb.com/title/tt0093870

becomes:

http://api.rottentomatoes.com/api/publi ... id=0093870

This new API produces a plain text page with lots of useful info. In particular I would like to add movie score and fresh certifications to my movie database. Using the pre-existing IMDB urls in an ant movie catalog and a regular expression type conversion (as above) to point to the rotten tomatoes API page, would it be possible to pull down this data?

Any suggestions or help would be much appreciated.

Thanks!
daws0n
Posts: 53
Joined: 2005-02-04 13:53:18

Post by daws0n »

With some careful studying I have made something that works!

However, one caveat remains: the way I have coded it means that the script is dependant on manually entering the imdb title code (e.g 0093870) in order to pull down the API page.

Can this value be copied then truncated from the pre-existing data in fieldURL?

e.g Robocop URL is already set to http://imdb.com/title/tt0093870 in my catalog, can the value after the "tt" be automatically parsed and incorporated into my script?
daws0n
Posts: 53
Joined: 2005-02-04 13:53:18

Post by daws0n »

I guess the easiest way to do with would be to take the fieldURL as-is and simply truncate the first 24 characters... This would leave just the title code left.

I will do some digging on this, any help would be greatly appreciated.
daws0n
Posts: 53
Joined: 2005-02-04 13:53:18

Post by daws0n »

Success! :)
Post Reply