In this assingnment, we are going to use an API on a Movie Database website that allows you to search for movies or TV series. This API allows you to search for a specific movie or TV show.
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.4 ✔ tidyr 1.3.1
✔ purrr 1.0.2
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(httr)library(jsonlite)
Attaching package: 'jsonlite'
The following object is masked from 'package:purrr':
flatten
library(dplyr)
Getting the API URL
To get the API to work, you are going to need the base URL that allows you to access the website.
movie_URL<-"http://www.omdbapi.com/?"
To find a movie or TV show that you specifically want, there is different search criteria that you can use to find your movie or TV show of choice.
title<-"s=Happy+Gilmore"
I chose to do the movie Happy Gilmore and the s is your specific search for a movie or TV show.
Getting your API
You have to get a specific API so that the website knows who is accessing this information and trying to webscrape their website.