Title: | Retrieve Movies Metadata from OMDb Database |
---|---|
Description: | This package retrieves movies metadata (title, actors, year, genres, etc.) using the OMDb API <http://www.omdbapi.com/> (an API key is required). Cover can also be downloaded from the YTS API <https://yts.mx/api> (no API key required). |
Authors: | Nicolas Casajus [aut, cre], Kevin Cazelles [aut] |
Maintainer: | Nicolas Casajus <[email protected]> |
License: | GPL-3 |
Version: | 0.0.0.9000 |
Built: | 2024-11-14 03:28:44 UTC |
Source: | https://github.com/inSileco/omdbr |
This function counts movies by category: genre, year, actors, director, writer, language or country.
count_movies(count_by = NULL, path = ".")
count_movies(count_by = NULL, path = ".")
count_by |
The field to count movies by. |
path |
The folder containing YAML files (or the root project). |
A 2-columns data frame.
## Not run: count_movies() count_movies(count_by = "genre") count_movies(count_by = "actors") ## End(Not run)
## Not run: count_movies() count_movies(count_by = "genre") count_movies(count_by = "actors") ## End(Not run)
This function tries to retrieve the IMDb identifier of a movie based on a its title and using the OMDb API http://www.omdbapi.com/. User can also specify the release year of the movie. See details below for further informations.
find_imdb_id(search, year = NULL, n_max = 10, sleep = 0.1, verbose = TRUE)
find_imdb_id(search, year = NULL, n_max = 10, sleep = 0.1, verbose = TRUE)
search |
A movie title to search for. |
year |
(optional) The release year of the movie. |
n_max |
Number of matches to returned (default is 10). |
sleep |
Time interval between two API requests. |
verbose |
A boolean. If |
For better results, you should write the complete movie title with its exact spelling. Results are sorted by their similarity with the search terms.
If you don't find the movie you are looking for, you can visit the IMDb website (https://www.imdb.com) and get this ID from the movie URL. It is always in the form: tt9999999 (only numbers are specific to the movie; the prefix 'tt' is a constant).
For instance, in this URL: https://www.imdb.com/title/tt5699154/, the IMDb ID is 'tt5699154'.
For non-English movies, the English name might be different from the original title. For example, the English title of the french movie "Le Sens de la fĂȘte" (2017) is "C'est la vie!" (IMDb ID = tt5699154).
Only movies are currently implemented.
A data frame with:
title: the movie title
year: the year of release
imdbid: the IMDb ID of the movie
## Not run: find_imdb_id(search = "solo a star wars story") find_imdb_id("Star Wars", year = 2018, n_max = 20) ## End(Not run)
## Not run: find_imdb_id(search = "solo a star wars story") find_imdb_id("Star Wars", year = 2018, n_max = 20) ## End(Not run)
This function retrieves movie cover using the YTS API https://yts.mx/api. No API key is required but not all movies listed in the IMDb/OMDb databases are available on YTS https://yts.mx.
get_cover(imdb_id, path = "./covers")
get_cover(imdb_id, path = "./covers")
imdb_id |
The IMDb ID of the movie. |
path |
The folder to save cover. |
## Not run: get_cover(imdb_id = "tt0120863", path = ".") ## End(Not run)
## Not run: get_cover(imdb_id = "tt0120863", path = ".") ## End(Not run)
This function retrieves movie metadata (title, actors, year, genres, etc.) using the OMDb API http://www.omdbapi.com/. Results are exported in a YAML file and returned as a data frame. See details below for further informations.
get_details(imdb_id, path = "./details", print = TRUE)
get_details(imdb_id, path = "./details", print = TRUE)
imdb_id |
The IMDb ID of the movie. |
path |
The folder to store results. |
print |
A boolean. If TRUE (default), movie informations are printed. |
An (free) API key is required to use the OMDb API. You can register on http://www.omdbapi.com/. When using this package for the first time, you'll be asked for setting your own API key (just follow instructions).
The request is performed using the IMDb identifier of the movie. To find this
ID you can use the function find_imdb_id()
.
If you can't retrieve the IMDb ID, visit the IMDb website (https://www.imdb.com) and get this ID from the movie URL. It is always in the form: tt9999999 (only numbers are specific to the movie; the prefix 'tt' is a constant).
For instance, in this URL: https://www.imdb.com/title/tt5699154/, the IMDb ID is 'tt5699154'.
For non-English movies, the English name might be different from the original title. For instance, the English title of the french movie "Le Sens de la fĂȘte" (2017) is "C'est la vie!" (IMDb ID = tt5699154).
Only movies are currently implemented.
A data frame with:
imdbid: the IMDb ID of the movie
type: the category (e.g. movie)
title: the movie title
year: the year of release
runtime: the movie runtime (in minutes)
director: a vector of directors
writer: a vector of writers
actors: a vector of main actors
genre: a vector of genres
plot: a short plot of the movie
language: a vector of spoken languages
country: a vector of the countries
imdbrating: the IMDb rating (in date of the request)
slug: a unique identifier (titre + year)
## Not run: x <- get_details("tt0120863", path = ".", print = TRUE) ## End(Not run)
## Not run: x <- get_details("tt0120863", path = ".", print = TRUE) ## End(Not run)
This function reads YAML files with movie(s) metadata stored by the function
get_details()
read_details(path = ".", imdb_id = NULL, print = TRUE)
read_details(path = ".", imdb_id = NULL, print = TRUE)
path |
The folder containing YAML files (or the root project). |
imdb_id |
(optional) The IMDb ID(s) of the movie(s). |
print |
A boolean. If TRUE (default), movie informations are printed (if one single IMDb ID is required). |
A data frame with:
imdbid: the IMDb ID of the movie
type: the category (e.g. movie)
title: the movie title
year: the year of release
runtime: the movie runtime (in minutes)
director: a vector of directors
writer: a vector of writers
actors: a vector of main actors
genre: a vector of genres
plot: a short plot of the movie
language: a vector of spoken languages
country: a vector of the countries
imdbrating: the IMDb rating (in date of the request)
slug: a unique identifier (titre + year)
## Not run: x <- read_details() x <- read_details(imdb_id = "tt2278388", print = TRUE) x <- read_details(imdb_id = c("tt2278388", "tt0362270")) ## End(Not run)
## Not run: x <- read_details() x <- read_details(imdb_id = "tt2278388", print = TRUE) x <- read_details(imdb_id = c("tt2278388", "tt0362270")) ## End(Not run)
This function searches for movies for which details have been stored. User can search in title, year, etc.
search_movies( title, year, genre, director, writer, actors, country, language, path = "." )
search_movies( title, year, genre, director, writer, actors, country, language, path = "." )
title |
Terms to search for in title field. |
year |
Year(s) to search for in year field. |
genre |
Terms to search for in genres field. |
director |
Name(s) to search for in director field. |
writer |
Name(s) to search for in writer field. |
actors |
Name(s) to search for in actors field. |
country |
Country names to search for in country field. |
language |
Language name(s) to search for in language field. |
path |
The folder containing YAML files (or the root project). |
A data frame.
## Not run: search_movies(title = "Hotel") search_movies(year = 2014:2016) search_movies(actors = "Bill Murray") ## End(Not run)
## Not run: search_movies(title = "Hotel") search_movies(year = 2014:2016) search_movies(actors = "Bill Murray") ## End(Not run)