Open mlava opened 3 years ago
Here is the JSON output from the API call, for anyone who wants to use other fields that I haven't included:
{
"Title": "The Big Sleep",
"Year": "1946",
"Rated": "Not Rated",
"Released": "31 Aug 1946",
"Runtime": "114 min",
"Genre": "Crime, Film-Noir, Mystery, Thriller",
"Director": "Howard Hawks",
"Writer": "William Faulkner (screen play), Leigh Brackett (screen play), Jules Furthman (screen play), Raymond Chandler (novel)",
"Actors": "Humphrey Bogart, Lauren Bacall, John Ridgely, Martha Vickers",
"Plot": "Private detective Philip Marlowe is hired by a wealthy family. Before the complex case is over, he's seen murder, blackmail, and what might be love.",
"Language": "English",
"Country": "USA",
"Awards": "2 wins.",
"Poster": "https://m.media-amazon.com/images/M/MV5BMjdiM2IyZmQtODJiYy00NDNkLTllYmItMmFjMDNiYTQyOGVkXkEyXkFqcGdeQXVyNDY2MTk1ODk@._V1_SX300.jpg",
"Ratings": [
{
"Source": "Internet Movie Database",
"Value": "7.9/10"
},
{
"Source": "Rotten Tomatoes",
"Value": "97%"
}
],
"Metascore": "N/A",
"imdbRating": "7.9",
"imdbVotes": "78,302",
"imdbID": "tt0038355",
"Type": "movie",
"DVD": "N/A",
"BoxOffice": "N/A",
"Production": "Warner Brothers/Seven Arts",
"Website": "N/A",
"Response": "True"
}
I want to search for the Mulan2020, but it gives me Mulan1998, how to handle the movie share with the same title?
@Daydog I have a 2.0 version that fixes this.
✂️ Copy of your #42SmartBlock from Roam
$.ajax(settings).done(function (response) { console.log(response); var jsonMovies = JSON.stringify(response); var movies = JSON.parse(jsonMovies); document.movies = movies; var directors = movies.Director; var directors1 = directors.replace(new RegExp(', ', 'g'), "]] [["); document.directors = directors1; var writers = movies.Writer; var res = writers.match(/screen|novel|story|characters|based/); // remove 'screen play' and 'novel' if (res !== null) { var writers = writers.replace(new RegExp('(screen play)|(by)|(novel)|(characters)|(story by)|(screenplay by)|(based on characters created by)|(based upon the novel by)', 'g'), ""); var writers = writers.replace(new RegExp('[(.+)]', 'g'), ""); var writers = writers.replace(new RegExp(' , ', 'g'), "]] [["); var writers = writers.replace(new RegExp(', ', 'g'), "]] [["); } else { var writers = writers.replace(new RegExp(', ', 'g'), "]] [["); } document.writers = writers; var actors = movies.Actors; var cast = actors.replace(new RegExp(', ', 'g'), "]] [["); document.cast = cast; var genres = movies.Genre; var genre = genres.replace(new RegExp(', ', 'g'), " #"); document.genre = genre; });``` %>
📋 Describe the SmartBlock
This SmartBlock takes the title of the page as input to retrieve data from the IMDb via the OMDb API.
✅ Describe any prerequisites or dependencies that are required for this SmartBlock
You need to get a free API Key for OMDb at http://www.omdbapi.com/. The free account gives up to 1000 API calls daily, which should be more than enough for most of us!
📷 Screenshot of your #42SmartBlock workflow/template from Roam
Make sure to put the OMDb API key into the apiKey position in line 1 of this image.
Note that I output a rating slider - this doesn't come from IMDb but I use it for my own personal ratings.
💡 Additional Info
https://www.loom.com/share/c3f9f56028f549208d112f64f29867fa https://www.loom.com/share/7d72de721c144c76b0e8904e3545c53f