Page 1 of 2

imdb, tomatoes, metacritic ratings and much more info on criticker with userscript

Posted: Mon Feb 15, 2016 6:54 pm
by babaracus
hello,

this is my first post in this forum and I'm pretty sure I'm already botching it (probably wrong section) but I stumbled into something cool and I wanted to share it with the other criticker users.

I was looking for userscripts for criticker but couldn't find much, so I started experimenting with scripts meant for other sites. I mostly wanted to grab the ratings from imdb and rottentomatoes (mostly to check out how wrong they are compared to my taste :D )

I installed this script for greasemonkey in firefox: http://userscripts-mirror.org/scripts/show/167800
then I added this to the included pages: https://www.criticker.com*

and this is the result:

Image

the information is added at the bottom of the page next to the imdb link [imdb rating/number of ratings].

I have no knowledge of javascript whatsoever so I am not capable of making it look prettier, all I know is that this script takes the information from http://www.omdbapi.com. that api also has rottentomatoes and metacritic ratings. it also has a number of other data which for now are not on criticker, so there must be a way to include those too. for example movie lenght and parental rating would be cool to have.

this is the whole thing for "Cobra":
http://www.omdbapi.com/?i=tt0090859&plo ... rue&r=json

I hope this was of some interest to someone.

by the way I love this site, have been here since forever and it never gets a recommendation wrong.

keep up the great work.


------------------------------------ edit 2016.09.22 -------------------------------------------------------

ok I fooled around with it a little and I managed to add much more information. this is what it looks like now:

Image

as I said I have zero knowledge of javascript so I basically just winged it. I mostly just did this for myself and I don't plan to publish this anywhere but if anyone else is interested this is what you do
1. install the original script in firefox with greasemonkey
2. go through the options and open the script editor
3. copy this code:

Code: Select all

// ==UserScript==
// @name           IMDb ratings
// @author         gonzoid
// @description    Adds ratings on IMDb search results and name pages using third party OMDb API.
// @version        2013-05-18
// @namespace      http://userscripts.org/scripts/show/167800
// @grant          GM_xmlhttpRequest
// @downloadURL    http://userscripts.org/scripts/source/167800.user.js
// @updateURL      http://userscripts.org/scripts/source/167800.user.js
// ==/UserScript==
var IMDBpluginlinks = document.links;
var IMDBcontinueelement = document.createElement("button");
IMDBcontinueelement.innerHTML = "Get rating";



function processIMDBLinks(s){
   IMDBcontinueelement.style.display = 'none';
   var r=0;
   for (IMDBi = s; IMDBi < IMDBpluginlinks.length; IMDBi++) {
      if (IMDBpluginlinks[IMDBi].href.indexOf("/title/") != -1 && IMDBpluginlinks[IMDBi].href.indexOf("imdb.") != -1){
         if(r>300){
            IMDBcontinueelement.onclick=function(){ processIMDBLinks(IMDBi); };
            IMDBcontinueelement.style.display='inline';
            IMDBpluginlinks[IMDBi].parentNode.insertBefore(IMDBcontinueelement, IMDBpluginlinks[IMDBi]);
            break;
         }
         r++;
         GM_xmlhttpRequest({
            method: 'get',
            headers: {},
            url: "http://www.omdbapi.com/?i=" + IMDBpluginlinks[IMDBi].href.match(/tt\d+/) + "&plot=short&tomatoes=true&r=json",
            onload: function (IMDBi) {return function (result) {
               var rating = JSON.parse(result.responseText).imdbRating;
               var meta = JSON.parse(result.responseText).Metascore;
               var runtime = JSON.parse(result.responseText).Runtime;
               var tomatoMeter = JSON.parse(result.responseText).tomatoMeter;
               var Rated = JSON.parse(result.responseText).Rated;
               var Released = JSON.parse(result.responseText).Released;
               var Genre = JSON.parse(result.responseText).Genre;
               var Director = JSON.parse(result.responseText).Director;
               var Writer = JSON.parse(result.responseText).Writer;
               var Actors = JSON.parse(result.responseText).Actors;
               var Plot = JSON.parse(result.responseText).Plot;
               var Language = JSON.parse(result.responseText).Language;
               var Country = JSON.parse(result.responseText).Country;
               var Awards = JSON.parse(result.responseText).Awards;
               var tomatoUserMeter = JSON.parse(result.responseText).tomatoUserMeter;
               var BoxOffice = JSON.parse(result.responseText).BoxOffice;
               var Production = JSON.parse(result.responseText).Production;
               IMDBpluginlinks[IMDBi].parentNode.insertBefore(document.createElement("span"), IMDBpluginlinks[IMDBi]).innerHTML = ((rating !== "N/A")  ? "<br><br><b>Parental Rating:</b> " + Rated + "  <br><br><b>Runtime:</b> " + runtime + " <br><br><b>Awards:</b> " + Awards + "  <br><br><b>BoxOffice:</b> " + BoxOffice + "  <br><br><b>IMDb:</b> " + rating + "  <br><b>tomatoAudience:</b> " + tomatoUserMeter + "% <br><b>Metacritic:</b> " + meta + "  <br><b>tomatoMeter:</b> " + tomatoMeter + "% <br><br><b>Produced by:</b> " + Production + "  <br><br><b>Genres:</b> " + Genre + "  <br><br><b>Directed by:</b> " + Director + "  <br><br><b>Written by:</b> " + Writer + "  <br><br><b>Starring:</b> " + Actors + "  <br><br><b>Summary:</b> " + Plot + "  <br><br><b>Language:</b> " + Language + "  <br><br><b>Country:</b> " + Country + "  <br><br><b>Original Release Date:</b> " + Released + "  <br><br>" : "<b style='color: red'>[N/A]</b> ");
            }}(IMDBi)
         });
      }
   }
}
processIMDBLinks(0);

4. paste it in the script editor replacing everything.
5. save the whole thing and you're done.

of course add https://www.criticker.com* in the included pages list. also the info seems to be appearing in other random sites. just add the urls in the excluded sites list.

if anyone with more knowledge and skills wants to edit this and make it better feel free to do it. it wasn't mine to begin with



------------------------------------ edit 2016.09.25 ----------------------------------------------------


great to see it's working for other users too!
just wanted to add that this shouldn't be a firefox only thing. if your browser supports extentions and there's one for userscripts you can install it too. I think the one for google chrome is called tampermonkey. I only tested this on firefox tho, so if you try it with other browsers you're on your own. maybe post your results in the comments for others to follow

Re: imdb, tomatoes, metacritic ratings and much more info on criticker with greasemonkey

Posted: Thu Sep 22, 2016 9:28 pm
by babaracus
I edited the thing and it now shows much more information. details at the bottom of the original post

Re: imdb, tomatoes, metacritic ratings and much more info on criticker with userscript

Posted: Fri Sep 23, 2016 12:52 pm
by td888
Great work. I'll test it when I get home.

Re: imdb, tomatoes, metacritic ratings and much more info on criticker with userscript

Posted: Fri Sep 23, 2016 5:02 pm
by mattorama12
I've never messed around with Greasemonkey before, so this sounds like a good way to get my feet wet

Re: imdb, tomatoes, metacritic ratings and much more info on criticker with userscript

Posted: Sat Sep 24, 2016 11:20 am
by td888
The original script from http://userscripts-mirror.org/scripts/show/167800 works for me. But it only shows the IMDB ratings, not the extra info.

When I replace the user script code with the code in your post above, it doesn't work at all.
I'll try to debug later today to see what's causing it.

Edit:
I got it working. I needed to add http://www.omdbapi.com as an exception to my NoScript and RequestPolicy extensions

Also, exclude www.imdb.com itself from the user script. It screws up the search page from IMDB.

Re: imdb, tomatoes, metacritic ratings and much more info on criticker with userscript

Posted: Sat Sep 24, 2016 11:31 am
by babaracus
great to see it's working for someone else too!

Re: imdb, tomatoes, metacritic ratings and much more info on criticker with userscript

Posted: Tue Dec 06, 2016 6:47 pm
by 90sCoffee
Got this working and it's hugely helpful, don't have to open up imdb all the time now but have a few questions. The imdb number of ratings is gone from the modified script which was in the original, would like to know how to get the number of ratings back. I'm also trying to edit the modified version to slim it down a bit but it keeps screwing up when I edit it. Basically just trying to delete the following lines, would appreciate if someone could give the modified script without these since a lot of them are either there in Criticker by default or not ones I'm interested in:

Parental Rating
Box Office
Produced by
Genres
Directed
Written By
Starring
Summary
Country
Original
Release Date

So basically just trying to keep the rankings from the websites + number of imdb rankings + the running time and language and delete the rest. Would also love if Letterboxd ratings could be added to this since they have an API, I couldn't find anything tangible on the userscripts search for it.

Re: imdb, tomatoes, metacritic ratings and much more info on criticker with userscript

Posted: Thu Dec 15, 2016 4:18 am
by 90sCoffee
Ok so here's an updated script thanks to another person who modified it. It cleaned up the other modified script so now it shows the following info:

Runtime:
IMDb: (it also shows the # of ratings again which were in the original but removed in the modified version)
tomatoAudience:
Metacritic:
tomatoMeter:


script link (just copy and paste it into greasemonkey->options->edit script):

http://pastebin.com/index/ZhdZ0bcS

Re: imdb, tomatoes, metacritic ratings and much more info on criticker with userscript

Posted: Thu Jan 05, 2017 4:17 am
by 90sCoffee
Hey can anyone help me out with the excluded list? It isn't working. I've added imdb.com, www.imdb.com, www.imdb.com*, etc to the exclusion list but the script still shows up on imdb and screws it up unless I turn it off each time (and a few other sites).

Thanks

Re: imdb, tomatoes, metacritic ratings and much more info on criticker with userscript

Posted: Mon Jan 09, 2017 3:08 pm
by babaracus
KalltKaffe wrote:Hey can anyone help me out with the excluded list? It isn't working. I've added imdb.com, http://www.imdb.com, http://www.imdb.com*, etc to the exclusion list but the script still shows up on imdb and screws it up unless I turn it off each time (and a few other sites).

Thanks


hi, I'm sorry you're having trouble with the script.
it will screw up every page an imdb link appears on unless you add those pages to the excluded list.
there are two ways to do so that I know of: you can edit the script and add the URLs you want excluded or you can add those pages to your browser's addon settings for our script.
the first method usually doesn't work for me. so I go to the greasemonkey settings and add the excluded pages there.
if that doesn't work either I don't know what the problem can be. maybe try adding/removing "http://" to the URLs.
I hope you can make it work for you!