By: Andrew Estep
The Open Movie Database (OMDB) API is a web service that provides people with a large database of movie, television show, and actor information. It takes data from various sources, which helps show a broad range of details including titles, release years, genres, directors, actors, plot summaries, and even poster art. The API supports searches by different criteria such as title, year, and IMDb ID. Developers can use the OMDB API for free with a limited number of requests per day, with a simple email request granting the user access to their own key.
library(httr)
library(jsonlite)
After signing up for a request with an email address, you will be emailed your own API key to access the data. You can then use the data for whatever you would like. Within this link pasted below, certain contents will be modified based on the nature of the request. The command can be modified to show things with t (title), y (year), plot for short and full plot, and much more. Within this link, the api key will also be replaced with your own for security.
generic_url_omdb <- "http://www.omdbapi.com/?t&apikey=9d77066d"
We will the the fromJSON command from the jsonlite pack to find details on one of my favorite movies, Oppenheimer.
oppenheimer_stats <- fromJSON("http://www.omdbapi.com/?t=Oppenheimer&apikey=9d77066d")
#We can now use this to create a vector for the Ratings of Oppenheimer
oppenheimer_stats$Ratings
## Source Value
## 1 Internet Movie Database 8.4/10
## 2 Rotten Tomatoes 93%
## 3 Metacritic 88/100
As I make this, my roomate is in the room with me, he wants to compare the ratings of Oppenheimer and Brokeback Mountain
brokeback_stats <- fromJSON("http://www.omdbapi.com/?t=Brokeback+Mountain&apikey=9d77066d")
brokeback_stats$Ratings;oppenheimer_stats$Ratings
## Source Value
## 1 Internet Movie Database 7.7/10
## 2 Rotten Tomatoes 88%
## 3 Metacritic 87/100
## Source Value
## 1 Internet Movie Database 8.4/10
## 2 Rotten Tomatoes 93%
## 3 Metacritic 88/100
Based on these graphs we can see that oppenheimer tends to have higher ratings than Brokeback Mountain