The New York Times web site provides a rich set of APIs, as described here: https://developer.nytimes.com/apis
You’ll need to start by signing up for an API key.
Your task is to choose one of the New York Times APIs, construct an interface in R to read in the JSON data, and transform it into an R DataFrame
ApiKey <- "D0emG9Sb3tGbeit5JpJ5iU9t1pYTFhx2" #API key created on NY Post
Api_MoviesNYT <- fromJSON(paste0("https://api.nytimes.com/svc/movies/v2/reviews/search.json?api-key=",ApiKey), flatten = TRUE)
#R_MovieReviewsDF <- tbl_df(as.data.frame(Api_MoviesNYT))
R_MovieReviewsDF <- tibble::as_tibble(as.data.frame(Api_MoviesNYT))
T_MovieReviewsDF <- R_MovieReviewsDF[-c(1:4)] #remove the first 4 columns from the dataframe
#Retrieve a subset of the columns from the dataframe
T_MovieReviewsDF <- select(T_MovieReviewsDF, one_of(c("results.display_title","results.mpaa_rating", "results.critics_pick","results.byline","results.headline","results.summary_short", "results.publication_date","results.opening_date","results.date_updated", "results.link.type", "results.link.suggested_link_text", "results.link.url" )))
#Rename the column names
colnames(T_MovieReviewsDF) <- c("MOVIE TITLE", "MPAA RATING", "CRITICS PICK", "BY LINE", "HEADLINE", "SHORT SUMMARY", "MOVIE PUBLICATION DATE", "MOVIE OPENING DATE", "DATE UPDATED", "link.type", "REVIEW HEADER", "URL FOR REVIEW")
T_MovieReviewsDF %>% kable() %>%
kable_styling(bootstrap_options = "striped", font_size = 12) %>%
scroll_box(height = "500px", width = "100%")
| MOVIE TITLE | MPAA RATING | CRITICS PICK | BY LINE | HEADLINE | SHORT SUMMARY | MOVIE PUBLICATION DATE | MOVIE OPENING DATE | DATE UPDATED | link.type | REVIEW HEADER | URL FOR REVIEW |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Tori and Lokita | 1 | Manohla Dargis | ‘Tori and Lokita’ Review: Precarious Lives in Exile | In the new movie from the Dardenne brothers, two underage African migrants struggle to make a home in an unkind land. | 2023-03-23 | NA | 2023-03-23 17:46:51 | article | Read the New York Times Review of Tori and Lokita | https://www.nytimes.com/2023/03/23/movies/tori-and-lokita-review-dardenne.html | |
| The Worst Ones | 1 | Lisa Kennedy | ‘The Worst Ones’ Review: The Gazes of Children | In their feature, the directors Lisa Akoka and Romane Gueret build a provocative critique of filmmaking practices. | 2023-03-23 | 2023-03-24 | 2023-03-23 16:44:03 | article | Read the New York Times Review of The Worst Ones | https://www.nytimes.com/2023/03/23/movies/the-worst-ones-review.html | |
| Petite Solange | 1 | Natalia Winkelman | ‘Petite Solange’ Review: Coming of Age as Your Parents Divorce | Axelle Ropert’s carefully calibrated film from France follows a girl experiencing the pain of having to accept her parents as people with faults. | 2023-03-23 | NA | 2023-03-23 15:29:03 | article | Read the New York Times Review of Petite Solange | https://www.nytimes.com/2023/03/23/movies/petite-solange-review.html | |
| Reggie | PG-13 | 1 | Glenn Kenny | ‘Reggie’ Review: Reggie Jackson on Himself, Racism and, Yes, Baseball | Jackson, a.k.a. Mr. October, was called a lot of things during his storied career with the Yankees. A new documentary goes beyond the nicknames. | 2023-03-23 | 2023-03-24 | 2023-03-23 11:05:02 | article | Read the New York Times Review of Reggie | https://www.nytimes.com/2023/03/23/movies/reggie-review.html |
| Nam June Paik: Moon Is the Oldest TV | 1 | Nicolas Rapold | ‘Nam June Paik: Moon Is the Oldest TV’ Review: Art Onscreen | A new documentary follows the ceaseless innovations of a man who made art out of television sets and found inspiration in disruption. | 2023-03-23 | 2023-03-24 | 2023-03-23 11:07:02 | article | Read the New York Times Review of Nam June Paik: Moon Is the Oldest TV | https://www.nytimes.com/2023/03/23/movies/nam-june-paik-moon-is-the-oldest-tv-review.html | |
| Walk Up | 1 | Austin Considine | ‘Walk Up’ Review: Good Friends Make Bad Neighbors | Hong Sang-soo’s latest film traces the relationships in a small Seoul apartment building as they evolve and grow heavier with complications. | 2023-03-23 | NA | 2023-03-23 11:06:03 | article | Read the New York Times Review of Walk Up | https://www.nytimes.com/2023/03/23/movies/walk-up-review.html | |
| The Lost King | PG-13 | 1 | Jeannette Catsoulis | ‘The Lost King’ Review: A Royal Obsession | Sally Hawkins lights a fire under this droll dramedy about the search for the final resting place of Richard III. | 2023-03-23 | NA | 2023-03-23 11:02:10 | article | Read the New York Times Review of The Lost King | https://www.nytimes.com/2023/03/23/movies/the-lost-king-review.html |
| The Five Devils | 1 | Beatrice Loayza | ‘The Five Devils’ Review: The Scent of the Past | Part queer love story, part supernatural psychodrama, the uncanny second feature by Léa Mysius follows a young girl with a magical sense of smell. | 2023-03-23 | NA | 2023-03-23 11:01:03 | article | Read the New York Times Review of The Five Devils | https://www.nytimes.com/2023/03/23/movies/the-five-devils-review.html | |
| John Wick: Chapter 4 | R | 0 | Manohla Dargis | ‘John Wick: Chapter 4’ Review: There Will Be Blood, Yeah | In the latest and longest movie set in Wick World, Keanu Reeves’s titular assassin visits Paris and paints the town red. | 2023-03-23 | 2023-03-24 | 2023-03-23 14:23:03 | article | Read the New York Times Review of John Wick: Chapter 4 | https://www.nytimes.com/2023/03/23/movies/john-wick-chapter-4-keanu-reeves.html |
| A Good Person | R | 0 | Brandon Yu | ‘A Good Person’ Review: Zach Braff’s New Chapter | The filmmaker behind “Garden State” has created a fully drawn female character in Florence Pugh’s grieving addict. But this recovery drama often has too heavy a hand. | 2023-03-23 | 2023-03-24 | 2023-03-23 11:03:09 | article | Read the New York Times Review of A Good Person | https://www.nytimes.com/2023/03/23/movies/a-good-person-review-zach-braff.html |
| Ithaka | 0 | Amy Nicholson | ‘Ithaka’ Review: In Julian Assange They Trust | A frustrating new advocacy documentary about the WikiLeaks founder, with appearances by his father and wife, loses its footing on weak assertions and reporting. | 2023-03-23 | NA | 2023-03-23 11:04:02 | article | Read the New York Times Review of Ithaka | https://www.nytimes.com/2023/03/23/movies/ithaka-review.html | |
| What the Hell Happened to Blood, Sweat & Tears? | 0 | Calum Marsh | ‘What the Hell Happened to Blood, Sweat & Tears?’ Review: What Goes Up | The rise and fall of a classic-rock band is chronicled (shakily) in this documentary. | 2023-03-23 | NA | 2023-03-23 15:48:17 | article | Read the New York Times Review of What the Hell Happened to Blood, Sweat & Tears? | https://www.nytimes.com/2023/03/23/movies/what-the-hell-happened-to-blood-sweat-tears-review.html | |
| Kubrick by Kubrick | 0 | Ben Kenigsberg | ‘Kubrick by Kubrick’ Review: Stanley Plays Himself | A primer on the filmmaker’s career and interests won’t offer much that will surprise even mild obsessives, but it does pierce some of the mystique. | 2023-03-21 | NA | 2023-03-21 20:20:03 | article | Read the New York Times Review of Kubrick by Kubrick | https://www.nytimes.com/2023/03/21/movies/kubrick-by-kubrick-review.html | |
| Rimini | 1 | Beatrice Loayza | ‘Rimini’ Review: Just an Austrian Gigolo | The director Ulrich Seidl’s unsettling drama tracks the exploitative behaviors of an aging lounge singer, his fans and family members. | 2023-03-16 | NA | 2023-03-16 18:56:03 | article | Read the New York Times Review of Rimini | https://www.nytimes.com/2023/03/16/movies/rimini-review.html | |
| Drylongso | R | 1 | Lisa Kennedy | ‘Drylongso’ Review: Extraordinary | Cauleen Smith’s 1998 movie, set in Oakland in the mid-90s, remains a vivid and prescient feature debut. | 2023-03-16 | NA | 2023-03-16 14:24:50 | article | Read the New York Times Review of Drylongso | https://www.nytimes.com/2023/03/16/movies/drylongso-review.html |
| The Innocent | 1 | Claire Shaffer | ‘The Innocent’ Review: A Heist With a French Accent | A light, enjoyable confection of a film that is built upon an amusingly absurd premise. | 2023-03-16 | NA | 2023-03-16 11:04:02 | article | Read the New York Times Review of The Innocent | https://www.nytimes.com/2023/03/16/movies/the-innocent-review-a-heist-with-a-french-accent.html | |
| Moving On | R | 0 | A.O. Scott | ‘Moving On’ Review: Cracking Jokes and Settling Scores | Lily Tomlin and Jane Fonda team up in an awkward comedy about two women contemplating the murder of a predatory man. | 2023-03-16 | NA | 2023-03-16 17:33:03 | article | Read the New York Times Review of Moving On | https://www.nytimes.com/2023/03/16/movies/moving-on-review-lily-tomlin-jane-fonda.html |
| Inside | R | 0 | Amy Nicholson | ‘Inside’ Review: Tortured Artist, Meet Tortured Man | Willem Dafoe stars as an art thief who gets trapped in a penthouse in this drama. | 2023-03-16 | 2023-03-17 | 2023-03-16 17:17:03 | article | Read the New York Times Review of Inside | https://www.nytimes.com/2023/03/16/movies/inside-review-willem-dafoe.html |
| The Spirit of ’45 | 0 | Ben Kenigsberg | ‘The Spirit of ’45’ Review: Here Comes Nationalization | A documentary from Ken Loach sees the end of World War II as a brief moment of possibility for socialism in Britain. | 2023-03-16 | NA | 2023-03-16 23:28:29 | article | Read the New York Times Review of The Spirit of ’45 | https://www.nytimes.com/2023/03/16/movies/the-spirit-of-45-review.html | |
| Shazam! Fury of the Gods | PG-13 | 0 | Amy Nicholson | ‘Shazam! Fury of the Gods’ Review: Yells Like Teen Spirit | The problem with this sequel is that the character used up his best ideas in the first movie. | 2023-03-16 | 2023-03-17 | 2023-03-16 15:59:03 | article | Read the New York Times Review of Shazam! Fury of the Gods | https://www.nytimes.com/2023/03/16/movies/shazam-fury-of-the-gods-review.html |