Hi Oli. Thank you so much for this script. Using this and the Netflix-style script to make my first steps with the scripts section (I have no background in programming, so this is all very learning by doing).
I was just wondering: can I use this also to call the RottenTomatoes score? I know how to make this work with simple values like Runtime, but does anyone know how to get the script to pick the Rottentomatoes Value from the ‘Ratings’ section of the OMDB API?
"Ratings":g{"Source":"Internet Movie Database","Value":"7.4/10"},{"Source":"Rotten Tomatoes","Value":"98%"},{"Source":"Metacritic","Value":"99/100"}],"Metascore":"99","imdbRating":"7.4","imdbVotes":"253,485","imdbID":"tt4975722",
Sorry if this question is a bit basic… these are my first baby steps working with these kind of scripts
Hi Oli. Thank you so much for this script. Using this and the Netflix-style script to make my first steps with the scripts section (I have no background in programming, so this is all very learning by doing).
I was just wondering: can I use this also to call the RottenTomatoes score? I know how to make this work with simple values like Runtime, but does anyone know how to get the script to pick the Rottentomatoes Value from the ‘Ratings’ section of the OMDB API?
"Ratings":g{"Source":"Internet Movie Database","Value":"7.4/10"},{"Source":"Rotten Tomatoes","Value":"98%"},{"Source":"Metacritic","Value":"99/100"}],"Metascore":"99","imdbRating":"7.4","imdbVotes":"253,485","imdbID":"tt4975722",
Sorry if this question is a bit basic… these are my first baby steps working with these kind of scripts
Sure I have this in a script I can paste later today (2-3hr from now)
Sure I have this in a script I can paste later today (2-3hr from now)
Wow, thank you! That would be amazing!
@MarvinW visit any webpage using Chrome, open DevTools (CtrlShiftC/CmdShiftC), click Console section, then paste in this code (with your own OMDB API key). It should demo the ratings nesting nicely. I used it in a first draft of this site I’m building which uses Airtable API for all its data https://bechdelrecommender.web.app
var myKey = =your OMDB API key];
var myFilm = "tt1285016";
var myRequest = "https://omdbapi.com/" +
"?apikey=" + myKey +
"&i=" + myFilm;
console.log("about to request from " + myRequest);
fetch(myRequest)
.then((myResponse) => myResponse.json())
.then((myJson) => {
document.write("<h1>" + myJsono'Title'] + "</h1>");
var keys = Object.keys(myJsono"Ratings"]);
for (const key of keys) {
// uncomment 2x lines to filter for ONLY Rotten Toms...
// if (myJsono"Ratings"]"key]y"Source"] == "Rotten Tomatoes"){ // this one
console.log("ratings: " + myJsono'Ratings']'key])
document.write(
"<p>" +
myJsono"Ratings"]"key]y"Source"] +
": <strong>" +
myJsono"Ratings"]"key]y"Value"] +
"</strong></p>");
// } // and this one!
}
}
)
@MarvinW I think I misunderstood you, sorry my answer didn’t go in the right direction. I’m actually looking to solve the Same question you’ve posed and wanted to ask: any solution found? I’ve tried a couple different approaches (nesting via await async, and via fetch/promise) and neither is working. Very interested to know how you solved it.