A look at NYTimes Movies API

install.packages("rmarkdown") # Make cool dynamic documents
install.packages("knitr") # Run R Code Chunks
install.packages("ggplot2") # For plotting
install.packages("DT") # Interactive HTML tables
install.packages("tidyverse") # Tidy Universe

Movie Critics at NY Times

criticsBioDF <- fromJSON("http://api.nytimes.com/svc/movies/v2/critics/all.json?api-key=7953e673412b420c844f697e96e9a57a")
results <- criticsBioDF$results
resultsView <- results %>% select(display_name, status, bio)

resultsView$bio <- substr(resultsView$bio, 1, 120)
resultsView$bio <- lapply(resultsView$bio, function(x) paste(c(x, '...'), collapse=''))
colnames(resultsView) <- c("Name", "Status", "Bio")
datatable(resultsView)

Those who we can see

imageFn <- function(src) {
  if(is.na(src)) {
    return('')
  } else {
    p <- paste(c("![Bio](", src, ")"), collapse='')
    return(p)
  }
}

results$image <- lapply(criticsBioDF$results$multimedia$resource$src, imageFn)
resultsImgView <- results %>% select(display_name, image)
resultsImgView <- resultsImgView %>% filter(image!='')
colnames(resultsImgView) <- c("Name", "Photo")
kable(head(resultsImgView,10))
Name Photo
A. O. Scott Bio
Stephen Holden Bio

Reviews of Recent movies

movieReviewsRecentDF <- fromJSON("http://api.nytimes.com/svc/movies/v2/reviews/search.json?order=by-date&api-key=7953e673412b420c844f697e96e9a57a")
moviesReviews <- movieReviewsRecentDF$results %>% select(-(date_updated:multimedia), -summary_short)
moviesReviews$link <- movieReviewsRecentDF$results$link$url
moviesReviews$image <- lapply(movieReviewsRecentDF$results$multimedia$src, imageFn)
colnames(moviesReviews) <- c("Movie", "MPAA Rating", "Critics", "Name", "Headline", "Review Date", "Movie Date", "Review Link", "Movie Pic")
moviesReviews$Critics <- lapply(moviesReviews$Critics, function(x) {if(x==1) 'Up' else 'Down'})
moviesReviews <- moviesReviews %>% arrange(Movie)
kable(moviesReviews)
Movie MPAA Rating Critics Name Headline Review Date Movie Date Review Link Movie Pic
All This Panic Down JEANNETTE CATSOULIS Review: ‘All This Panic,’ a Cinematic Confidant of Teenage Girls 2017-03-30 2017-03-31 http://www.nytimes.com/2017/03/30/movies/all-this-panic-review.html Bio
American Anarchist Down BEN KENIGSBERG Review: ‘American Anarchist’ Is a Frustrating Study in Denial 2017-03-23 NA http://www.nytimes.com/2017/03/23/movies/american-anarchist-review.html Bio
Carrie Pilby Down BEN KENIGSBERG Review: ‘Carrie Pilby,’ Saved by Bel Powley, Superhero 2017-03-30 NA http://www.nytimes.com/2017/03/30/movies/carrie-pilby-review-bel-powley.html Bio
Cezanne and I R Down STEPHEN HOLDEN Review: In ‘Cézanne et Moi,’ Zola and the Artist Are Pals. However … 2017-03-29 2017-03-31 http://www.nytimes.com/2017/03/29/movies/cezanne-et-moi-review.html Bio
David Lynch - The Art Life Down BEN KENIGSBERG Review: Before ‘Eraserhead’ There Was ‘David Lynch: The Art Life’ 2017-03-30 NA http://www.nytimes.com/2017/03/30/movies/david-lynch-the-art-life-review.html Bio
Five Came Back Up BEN KENIGSBERG Review: ‘Five Came Back,’ and Inspired the Likes of Spielberg 2017-03-30 2017-03-31 http://www.nytimes.com/2017/03/30/movies/five-came-back-review.html Bio
Ghost in the Shell PG-13 Down MANOHLA DARGIS Review: In ‘Ghost in the Shell,’ a Cyborg With Soul 2017-03-30 2017-03-31 http://www.nytimes.com/2017/03/30/movies/ghost-in-the-shell-review-scarlett-johansson.html Bio
God Knows Where I Am Up ANDY WEBSTER Review: A Descent Into Mental Illness in ‘God Knows Where I Am’ 2017-03-30 NA http://www.nytimes.com/2017/03/30/movies/god-knows-where-i-am-review.html Bio
Here Alone Down JEANNETTE CATSOULIS Review: ‘Here Alone’ Will Scare You With Menacing Little Jolts 2017-03-30 NA http://www.nytimes.com/2017/03/30/movies/here-alone-review.html Bio
I Called Him Morgan Down A. O. SCOTT Review: ‘I Called Him Morgan,’ a Jazz Tale of Talent and Tragedy 2017-03-23 2017-03-24 http://www.nytimes.com/2017/03/23/movies/i-called-him-morgan-review.html Bio
Karl Marx City Up A. O. SCOTT Review: ‘Karl Marx City’ Revisits the Everyday Terror of Dictatorship 2017-03-28 2017-03-29 http://www.nytimes.com/2017/03/28/movies/karl-marx-city-review.html Bio
Life R Down BEN KENIGSBERG Review: In ‘Life,’ Extraterrestrial Fun, Until Someone Gets Hurt 2017-03-23 2017-03-24 http://www.nytimes.com/2017/03/23/movies/life-review-jake-gyllenhaal-ryan-reynolds.html Bio
Live Cargo Down ANDY WEBSTER Review: ‘Live Cargo,’ Human Trafficking, and Other Woes, in Paradise 2017-03-30 2017-03-31 http://www.nytimes.com/2017/03/30/movies/live-cargo-review.html Bio
Phillauri Down ANDY WEBSTER Review: ‘Phillauri,’ an Indian Rom-Com With an Epic Sweep 2017-03-26 2017-03-24 http://www.nytimes.com/2017/03/26/movies/phillauri-review.html Bio
The Blackcoat’s Daughter R Up JEANNETTE CATSOULIS Review: ‘The Blackcoat’s Daughter’ Is Bewitching and Bloody 2017-03-30 NA http://www.nytimes.com/2017/03/30/movies/the-blackcoats-daughter-review.html Bio
The Boss Baby PG Down NEIL GENZLINGER Review: ‘The Boss Baby’ Puts Alec Baldwin in Diapers, Sort Of 2017-03-30 2017-03-31 http://www.nytimes.com/2017/03/30/movies/the-boss-baby-review-alec-baldwin.html Bio
The Death of Louis XIV Up GLENN KENNY Review: ‘The Death of Louis XIV’ Has a Riveting Performance at Its Heart 2017-03-30 NA http://www.nytimes.com/2017/03/30/movies/the-death-of-louis-xiv-review.html Bio
The Discovery Down NEIL GENZLINGER Review: ‘The Discovery’ of an Afterlife, Then the Suicides 2017-03-29 NA http://www.nytimes.com/2017/03/29/movies/the-discovery-review-netflix.html Bio
The Zookeeper’s Wife PG-13 Down STEPHEN HOLDEN Review: In ‘The Zookeeper’s Wife,’ the Holocaust Seems Tame 2017-03-29 2017-03-31 http://www.nytimes.com/2017/03/29/movies/the-zookeepers-wife-review-jessica-chastain.html Bio
Tony Conrad: Completely in the Present Down GLENN KENNY Review: Tony Conrad, ‘Completely in the Present’ 2017-03-30 0000-00-00 http://www.nytimes.com/2017/03/30/movies/tony-conrad-completely-in-the-present-review.html Bio