dvargas92495 / SmartBlocks

Useful examples from developer community for Roam42 SmartBlocks
147 stars 7 forks source link

Pull data from IMDb.com into Roam #121

Open mlava opened 3 years ago

mlava commented 3 years ago

✂️ Copy of your #42SmartBlock from Roam

📋 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

screenshot 1

Make sure to put the OMDb API key into the apiKey position in line 1 of this image.

image 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

mlava commented 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"
}
Daydog commented 3 years ago

image I want to search for the Mulan2020, but it gives me Mulan1998, how to handle the movie share with the same title?

mlava commented 3 years ago

@Daydog I have a 2.0 version that fixes this.

https://github.com/roamhacker/SmartBlocks/issues/122