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.
require(jsonlite)
require(dplyr)
require(kableExtra)
API-Key is Hidden
url<-"https://api.nytimes.com/svc/movies/v2/reviews/search.json?query=godfather&"
Here we put the API key and the link together.
movies<-fromJSON(paste0(url,moviekey))
movies1<-as.data.frame(movies$results)
colnames(movies1)
## [1] "display_title" "mpaa_rating" "critics_pick"
## [4] "byline" "headline" "summary_short"
## [7] "publication_date" "opening_date" "date_updated"
## [10] "link" "multimedia"
movies1
## display_title mpaa_rating critics_pick
## 1 The Black Godfather 0
## 2 Square Grouper: The Godfathers of Ganja R 0
## 3 Tokyo Godfathers PG-13 1
## 4 The Godfather, Part III R 1
## 5 The Godfather, Part II R 1
## 6 The Black Godfather R 0
## 7 The Godfather R 1
## 8 Three Godfathers 0
## 9 Miracle in the Sand 0
## 10 El Compadre Mendoza 0
## byline
## 1 BEN KENIGSBERG
## 2 RACHEL SALTZ
## 3 A. O. Scott
## 4 Janet Maslin
## 5 VINCENT CANBY
## 6 NORA SAYRE
## 7 Vincent Canby
## 8 BOSLEY CROWTHER
## 9 J.T.M.
## 10 Harry T. Smith
## headline
## 1 ‘The Black Godfather’ Review: The Music Executive Who Made It All Happen
## 2 Adventures in the Drug Trades
## 3 Three Down-and-Outs Rescue a Foundling From the Trash
## 4 GODFATHER PART III (MOVIE)
## 5 Godfather: Part II, The (Movie)
## 6 Black Godfather, The (Movie)
## 7 THE GODFATHER (MOVIE)
## 8 Three Godfathers
## 9 Three Godfathers, The
## 10 Compadre Mendoza, El
## summary_short
## 1 Reginald Hudlin’s documentary about Clarence Avant includes many golden anecdotes.
## 2 “Square Grouper” is a documentary about pot smuggling in South Florida in the 1970s and ’80s.
## 3 Another marvel from Satoshi Kon, whose first two films, "Perfect Blue" and "Millennium Actress," have already pushed Japanese feature-length animation toward greater realism and wilder fantasy. Loosely based on "3 Godfathers," John Ford's maudlin 1948 western, this movie, a sweet fable of decency amid the down and out, also has echoes of Chaplin and Capra. Three homeless people — an embittered alcoholic, a middle-aged transvestite and a teenage runaway — find an abandoned baby on Christmas Eve. As they try to reunite the foundling with her parents, they revisit their own unhappy lives, and travel through a city rendered with unbelievable precision and tinted with undeniable love. The potentially sticky sentiments of the story are balanced by a crazily inventive narrative and by Mr. Kon's cool, obsessively detailed visual style. At the end, the skyscrapers of Tokyo wriggle and dance to a Japanese-language techno version of Beethoven's "Ode to Joy," which pretty much sums up this indescribable, unforgettable movie. — A. O. Scott
## 4 Mafia heir trapped by legacy of past. Coppola's director's cut. Deeply moving.
## 5
## 6
## 7 Puzo's Mafioso novel. Scalding and memorable.
## 8 Outlaw trio and abandoned child. Typical, expert Ford western.
## 9 Thieves reluctantly care for orphan. Tragic horse opera.
## 10 Landowner survives Mexican Revolution by supporting both sides. Directed by Fernando de Fuentes.
## publication_date opening_date date_updated link.type
## 1 2019-06-06 2019-06-07 2019-06-14 16:44:01 article
## 2 2011-04-14 2011-04-15 2017-11-02 04:18:13 article
## 3 2004-01-16 <NA> 2017-11-02 04:16:23 article
## 4 1990-12-25 1990-12-25 2017-11-02 04:17:42 article
## 5 1974-12-13 1974-12-20 2017-11-02 04:17:27 article
## 6 1974-09-04 <NA> 2017-11-02 04:16:03 article
## 7 1972-03-16 1972-03-24 2017-11-02 04:17:26 article
## 8 1949-03-04 1948-12-01 2017-11-02 04:17:11 article
## 9 1936-03-09 1936-03-06 2017-11-02 04:16:58 article
## 10 1934-11-19 1934-11-18 2017-11-02 04:16:55 article
## link.url
## 1 http://www.nytimes.com/2019/06/06/movies/the-black-godfather-review.html
## 2 http://www.nytimes.com/2011/04/15/movies/square-grouper-movie-review.html
## 3 http://www.nytimes.com/2004/01/16/movies/film-review-three-down-outs-rescue-foundling-trash-anyone-have-pacifier.html
## 4 http://www.nytimes.com/1990/12/25/movies/review-film-the-corleones-try-to-go-straight-in-the-godfather-part-iii.html
## 5 http://www.nytimes.com/1974/12/13/archives/godfather-part-ii-is-hard-to-define-the-cast.html
## 6 http://www.nytimes.com/1974/09/04/archives/screen-drug-traffickers-vie-in-black-godfather.html
## 7 http://www.nytimes.com/movie/review?res=EE05E7DF1739E464BC4E52DFB5668389669EDE
## 8 http://www.nytimes.com/1949/03/04/archives/the-screen-in-review-john-wayne-harry-carey-jr-in-three-godfathers.html
## 9 http://www.nytimes.com/1936/03/09/archives/at-the-rialto.html
## 10 http://www.nytimes.com/1934/11/19/archives/a-mexican-tragedy.html
## link.suggested_link_text
## 1 Read the New York Times Review of The Black Godfather
## 2 Read the New York Times Review of Square Grouper: The Godfathers of Ganja
## 3 Read the New York Times Review of Tokyo Godfathers
## 4 Read the New York Times Review of The Godfather, Part III
## 5 Read the New York Times Review of The Godfather, Part II
## 6 Read the New York Times Review of The Black Godfather
## 7 Read the New York Times Review of The Godfather
## 8 Read the New York Times Review of Three Godfathers
## 9 Read the New York Times Review of Miracle in the Sand
## 10 Read the New York Times Review of El Compadre Mendoza
## multimedia.type
## 1 mediumThreeByTwo210
## 2 <NA>
## 3 <NA>
## 4 <NA>
## 5 <NA>
## 6 <NA>
## 7 <NA>
## 8 <NA>
## 9 <NA>
## 10 <NA>
## multimedia.src
## 1 https://static01.nyt.com/images/2019/06/05/arts/blackgodfather1/blackgodfather1-mediumThreeByTwo210.jpg
## 2 <NA>
## 3 <NA>
## 4 <NA>
## 5 <NA>
## 6 <NA>
## 7 <NA>
## 8 <NA>
## 9 <NA>
## 10 <NA>
## multimedia.width multimedia.height
## 1 210 140
## 2 NA NA
## 3 NA NA
## 4 NA NA
## 5 NA NA
## 6 NA NA
## 7 NA NA
## 8 NA NA
## 9 NA NA
## 10 NA NA
Remove Columns
movies2 <-movies1[c(1:2,4:7)]
colnames(movies2)<-c("Title", "Rating","Actors","Headline","Summary","Pub_Date")
kable(movies2) %>%
kable_styling(bootstrap_options = "striped", full_width = F)
| Title | Rating | Actors | Headline | Summary | Pub_Date |
|---|---|---|---|---|---|
| The Black Godfather | BEN KENIGSBERG | ‘The Black Godfather’ Review: The Music Executive Who Made It All Happen | Reginald Hudlin’s documentary about Clarence Avant includes many golden anecdotes. | 2019-06-06 | |
| Square Grouper: The Godfathers of Ganja | R | RACHEL SALTZ | Adventures in the Drug Trades | “Square Grouper” is a documentary about pot smuggling in South Florida in the 1970s and ’80s. | 2011-04-14 |
| Tokyo Godfathers | PG-13 | A. O. Scott | Three Down-and-Outs Rescue a Foundling From the Trash | Another marvel from Satoshi Kon, whose first two films, "Perfect Blue" and "Millennium Actress," have already pushed Japanese feature-length animation toward greater realism and wilder fantasy. Loosely based on "3 Godfathers," John Ford’s maudlin 1948 western, this movie, a sweet fable of decency amid the down and out, also has echoes of Chaplin and Capra. Three homeless people — an embittered alcoholic, a middle-aged transvestite and a teenage runaway — find an abandoned baby on Christmas Eve. As they try to reunite the foundling with her parents, they revisit their own unhappy lives, and travel through a city rendered with unbelievable precision and tinted with undeniable love. The potentially sticky sentiments of the story are balanced by a crazily inventive narrative and by Mr. Kon’s cool, obsessively detailed visual style. At the end, the skyscrapers of Tokyo wriggle and dance to a Japanese-language techno version of Beethoven’s "Ode to Joy," which pretty much sums up this indescribable, unforgettable movie. — A. O. Scott | 2004-01-16 |
| The Godfather, Part III | R | Janet Maslin | GODFATHER PART III (MOVIE) | Mafia heir trapped by legacy of past. Coppola’s director’s cut. Deeply moving. | 1990-12-25 |
| The Godfather, Part II | R | VINCENT CANBY | Godfather: Part II, The (Movie) | 1974-12-13 | |
| The Black Godfather | R | NORA SAYRE | Black Godfather, The (Movie) | 1974-09-04 | |
| The Godfather | R | Vincent Canby | THE GODFATHER (MOVIE) | Puzo’s Mafioso novel. Scalding and memorable. | 1972-03-16 |
| Three Godfathers | BOSLEY CROWTHER | Three Godfathers | Outlaw trio and abandoned child. Typical, expert Ford western. | 1949-03-04 | |
| Miracle in the Sand | J.T.M. | Three Godfathers, The | Thieves reluctantly care for orphan. Tragic horse opera. | 1936-03-09 | |
| El Compadre Mendoza | Harry T. Smith | Compadre Mendoza, El | Landowner survives Mexican Revolution by supporting both sides. Directed by Fernando de Fuentes. | 1934-11-19 |