library(jsonlite)
library(RCurl)
## Loading required package: bitops
library(httr)
URL <- "https://api.nytimes.com/svc/books/v3/lists/best-sellers/history.json"
key <- "a8e5ed6c1d4c43258d73f5a9866739a9"
df <- GET(URL, query = list(api_key = key))
names(df)
## [1] "url" "status_code" "headers" "all_headers" "cookies"
## [6] "content" "date" "times" "request" "handle"
df$url
## [1] "https://api.nytimes.com/svc/books/v3/lists/best-sellers/history.json?api_key=a8e5ed6c1d4c43258d73f5a9866739a9"
df2 <- fromJSON(df$url)
mainDF <- df2$results
head(mainDF)
## title
## 1 "I GIVE YOU MY BODY ..."
## 2 "MOST BLESSED OF THE PATRIARCHS"
## 3 #ASKGARYVEE
## 4 #GIRLBOSS
## 5 $100 STARTUP
## 6 $20 PER GALLON
## description
## 1 The author of the Outlander novels gives tips on writing sex scenes, drawing on examples from the books.
## 2 A character study that attempts to make sense of Jefferson<U+0092>s contradictions.
## 3 The entrepreneur expands on subjects addressed on his Internet show, like marketing, management and social media.
## 4 An online fashion retailer traces her path to success.
## 5 How to build a profitable start up for $100 or less and be your own boss.
## 6
## contributor
## 1 by Diana Gabaldon
## 2 by Annette Gordon-Reed and Peter S. Onuf
## 3 by Gary Vaynerchuk
## 4 by Sophia Amoruso
## 5 by Chris Guillebeau
## 6 by Christopher Steiner
## author contributor_note price age_group
## 1 Diana Gabaldon 0
## 2 Annette Gordon-Reed and Peter S Onuf 0
## 3 Gary Vaynerchuk 0
## 4 Sophia Amoruso 0
## 5 Chris Guillebeau 23
## 6 Christopher Steiner 0
## publisher
## 1 Dell
## 2 Liveright
## 3 HarperCollins
## 4 Portfolio/Penguin/Putnam
## 5 Crown Business
## 6 Grand Central
## isbns
## 1 0399178570, 9780399178573
## 2 0871404427, 9780871404428
## 3 0062273124, 0062273132, 9780062273123, 9780062273130
## 4 039916927X, 1591847931, 9780399169274, 9781591847939
## 5 0307951529, 9780307951526
## 6 NULL
## ranks_history
## 1 0399178570, 9780399178573, 8, Advice How-To and Miscellaneous, Advice, How-To & Miscellaneous, 2016-09-04, 2016-08-20, 1, NA, 0, 0
## 2 0871404427, 9780871404428, 16, Hardcover Nonfiction, Hardcover Nonfiction, 2016-05-01, 2016-04-16, 1, NA, 1, 0
## 3 0062273124, 0062273124, 9780062273123, 9780062273123, 5, 6, Business Books, Advice How-To and Miscellaneous, Business, Advice, How-To & Miscellaneous, 2016-04-10, 2016-03-27, 2016-03-26, 2016-03-12, 0, 1, NA, NA, 0, 0, 1, 1
## 4 1591847931, 1591847931, 1591847931, 1591847931, 039916927X, 039916927X, 039916927X, 9781591847939, 9781591847939, 9781591847939, 9781591847939, 9780399169274, 9780399169274, 9780399169274, 8, 9, 9, 8, 10, 8, 14, Business Books, Business Books, Business Books, Business Books, Business Books, Business Books, Advice How-To and Miscellaneous, Business, Business, Business, Business, Business, Business, Advice, How-To & Miscellaneous, 2016-03-13, 2016-01-17, 2015-12-13, 2015-11-15, 2014-11-09, 2014-10-12, 2014-09-21, 2016-02-27, 2016-01-02, 2015-11-28, 2015-10-31, 2014-10-25, 2014-09-27, 2014-09-06, 0, 0, 0, 0, 0, 0, 0, NA, NA, NA, NA, NA, NA, NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
## 5 NULL
## 6 NULL
## reviews
## 1 , , ,
## 2 , , ,
## 3 , , ,
## 4 , , ,
## 5 , , ,
## 6 , , ,