The Open Movie Database (OMDb) is a collection of data about movies and tv shows. It provides useful information like titles, actors, summaries, and ratings. Someone would want to use the OMDb API because it makes it very easy to gather and analyze movie and tv show data.
Load the packages
Load httr, jsonlite, and tidyverse.
library(httr)library(jsonlite)library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr 1.1.4 ✔ readr 2.1.5
✔ forcats 1.0.0 ✔ stringr 1.5.1
✔ ggplot2 3.5.1 ✔ tibble 3.2.1
✔ lubridate 1.9.3 ✔ tidyr 1.3.1
✔ purrr 1.0.2
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ purrr::flatten() masks jsonlite::flatten()
✖ dplyr::lag() masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
make the api key in r
go to https://www.omdbapi.com/apikey.aspx and make an account for free. After completing completing the steps they tell you, theywill email you a key. Activate the key through the email then paste it into R.
api_key <-"b2ba179c"# Replace with your own key
Connect the endpoint
Use this as the endpoint.
endpoint <-"https://www.omdbapi.com/"
Movie search
I am going to be using Inception as an example, put in your search term in place of that.