I chose the Books API and I have signed up for my API key. Click here to see the different paths to request information from.
For this task, httr is for making requests to the Books API. The jsonlite library will help to convert the responses to data frames. The dplyr will be used for basic data viewing (glimpse()) as well as other functions.
library(httr)
library(jsonlite)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
GET /lists/names.json
url <- "https://api.nytimes.com/svc/books/v3/lists/names.json?api-key=AvbYLVUMBocuH57SRfsCtMkgBp0iP1Kd"
r <- GET(url)
best_sellers.list_names <- fromJSON(content(r, as="text"))
x <- best_sellers.list_names$results
head(x, n=1L)
## list_name display_name
## 1 Combined Print and E-Book Fiction Combined Print & E-Book Fiction
## list_name_encoded oldest_published_date newest_published_date
## 1 combined-print-and-e-book-fiction 2011-02-13 2022-04-10
## updated
## 1 WEEKLY
For the sake of comprehension, read the column names to help understand the type of information that was returned.
colnames(x)
## [1] "list_name" "display_name" "list_name_encoded"
## [4] "oldest_published_date" "newest_published_date" "updated"
GET /lists/{date}/{list}.json
The list name comes from the list_name_encoded column in the /lists/names.json data frame (the one just above this). Here we choose the one named animals.
list_name <- "animals"
my_date <- "current"
url <- paste0("https://api.nytimes.com/svc/books/v3/lists/",my_date,"/",list_name,".json?api-key=AvbYLVUMBocuH57SRfsCtMkgBp0iP1Kd")
r <- GET(url)
x <- fromJSON(content(r, as="text"))$results$books
head(x, n=1L)
## rank rank_last_week weeks_on_list asterisk dagger primary_isbn10
## 1 1 0 0 0 0 1452110581
## primary_isbn13 publisher
## 1 9781452110585 Chronicle
## description
## 1 In this book of tongue-in-cheek poetry, cats get help explaining their behavior.
## price title author contributor
## 1 0.00 I COULD PEE ON THIS Francesco Marciuliano by Francesco Marciuliano
## contributor_note
## 1
## book_image
## 1 https://storage.googleapis.com/du-prd/books/images/9781452110585.jpg
## book_image_width book_image_height
## 1 128 171
## amazon_product_url
## 1 http://www.amazon.com/Could-Pee-This-Other-Poems/dp/1452110581?tag=NYTBSREV-20
## age_group book_review_link first_chapter_link sunday_review_link
## 1
## article_chapter_link isbns
## 1 1452110581, 1452151849, 9781452110585, 9781452151847
## buy_links
## 1 Amazon, Apple Books, Barnes and Noble, Books-A-Million, Bookshop, IndieBound, http://www.amazon.com/Could-Pee-This-Other-Poems/dp/1452110581?tag=NYTBSREV-20, https://goto.applebooks.apple/9781452110585?at=10lIEQ, https://www.anrdoezrs.net/click-7990613-11819508?url=https%3A%2F%2Fwww.barnesandnoble.com%2Fw%2F%3Fean%3D9781452110585, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fwww.anrdoezrs.net%2Fclick-7990613-35140%3Furl%3Dhttps%253A%252F%252Fwww.booksamillion.com%252Fp%252FI%252BCOULD%252BPEE%252BON%252BTHIS%252FFrancesco%252BMarciuliano%252F9781452110585&url2=https%3A%2F%2Fwww.anrdoezrs.net%2Fclick-7990613-35140%3Furl%3Dhttps%253A%252F%252Fwww.booksamillion.com%252Fsearch%253Fquery%253DI%252BCOULD%252BPEE%252BON%252BTHIS%252BFrancesco%252BMarciuliano, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fbookshop.org%2Fa%2F3546%2F9781452110585&url2=https%3A%2F%2Fbookshop.org%2Fbooks%3Faffiliate%3D3546%26keywords%3DI%2BCOULD%2BPEE%2BON%2BTHIS, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fwww.indiebound.org%2Fbook%2F9781452110585%3Faff%3DNYT&url2=https%3A%2F%2Fwww.indiebound.org%2Fsearch%2Fbook%3Fkeys%3DI%2BCOULD%2BPEE%2BON%2BTHIS%2BFrancesco%2BMarciuliano%26aff%3DNYT
## book_uri
## 1 nyt://book/36be148d-8d4d-5ce2-9633-cdc3027e75cb
See column names:
colnames(x)
## [1] "rank" "rank_last_week" "weeks_on_list"
## [4] "asterisk" "dagger" "primary_isbn10"
## [7] "primary_isbn13" "publisher" "description"
## [10] "price" "title" "author"
## [13] "contributor" "contributor_note" "book_image"
## [16] "book_image_width" "book_image_height" "amazon_product_url"
## [19] "age_group" "book_review_link" "first_chapter_link"
## [22] "sunday_review_link" "article_chapter_link" "isbns"
## [25] "buy_links" "book_uri"
GET /lists/best-sellers/history.json
url <- "https://api.nytimes.com/svc/books/v3/lists/best-sellers/history.json?api-key=AvbYLVUMBocuH57SRfsCtMkgBp0iP1Kd"
r <- GET(url)
x <- fromJSON(content(r, as="text"))
x <- x$results
head(x, n=1L)
## title
## 1 "I GIVE YOU MY BODY ..."
## description
## 1 The author of the Outlander novels gives tips on writing sex scenes, drawing on examples from the books.
## contributor author contributor_note price age_group publisher
## 1 by Diana Gabaldon Diana Gabaldon 0.00 Dell
## isbns
## 1 0399178570, 9780399178573
## ranks_history
## 1 0399178570, 9780399178573, 8, Advice How-To and Miscellaneous, Advice, How-To & Miscellaneous, 2016-09-04, 2016-08-20, 1, 0, 0, 0
## reviews
## 1 , , ,
See column names:
colnames(x)
## [1] "title" "description" "contributor" "author"
## [5] "contributor_note" "price" "age_group" "publisher"
## [9] "isbns" "ranks_history" "reviews"
GET /lists/full-overview.json
my_date <- "2021-04-06"
url <- paste0("https://api.nytimes.com/svc/books/v3/lists/full-overview/",my_date, ".json?api-key=AvbYLVUMBocuH57SRfsCtMkgBp0iP1Kd")
r <- GET(url)
x <- fromJSON(content(r, as="text"))
x <- x$results$lists
book.list <- x$books
print(paste0("Number of Best Sellers lists on ", my_date, ": ", length(book.list)))
## [1] "Number of Best Sellers lists on 2021-04-06: 11"
head(x, n=1L)
## list_id list_name list_name_encoded
## 1 704 Combined Print and E-Book Fiction combined-print-and-e-book-fiction
## display_name updated list_image list_image_width
## 1 Combined Print & E-Book Fiction WEEKLY NA NA
## list_image_height
## 1 NA
## books
## 1 , , , , , , , , , , , , , , , https://www.amazon.com/Where-Crawdads-Sing-Delia-Owens/dp/0735219095?tag=NYTBSREV-20, https://www.amazon.com/dp/075955434X?tag=NYTBSREV-20, https://www.amazon.com/dp/1982154918?tag=NYTBSREV-20, http://www.amazon.com/Ends-Us-Novel-Colleen-Hoover-ebook/dp/B0176M3U10?tag=NYTBSREV-20, https://www.amazon.com/dp/1791392792?tag=NYTBSREV-20, https://www.amazon.com/dp/0593331753?tag=NYTBSREV-20, https://www.amazon.com/dp/1501161938?tag=NYTBSREV-20, https://www.amazon.com/dp/0063142260?tag=NYTBSREV-20, https://www.amazon.com/dp/059332109X?tag=NYTBSREV-20, https://www.amazon.com/dp/1538748282?tag=NYTBSREV-20, https://www.amazon.com/dp/0063003058?tag=NYTBSREV-20, http://www.amazon.com/Ugly-Love-Novel-Colleen-Hoover-ebook/dp/B00HB62MC0?tag=NYTBSREV-20, http://www.amazon.com/November-9-Novel-Colleen-Hoover-ebook/dp/B00UDCI1S8?tag=NYTBSREV-20, https://www.amazon.com/dp/0593331265?tag=NYTBSREV-20, https://www.amazon.com/dp/0593336828?tag=NYTBSREV-20, , , , , , , , , , , , , , , , Delia Owens, Dolly Parton and James Patterson, Janet Evanovich, Colleen Hoover, Colleen Hoover, Stuart Woods, Taylor Jenkins Reid, Jacqueline Winspear, Anne Tyler, Harlan Coben, Lucy Foley, Colleen Hoover, Colleen Hoover, C.J. Box, Ali Hazelwood, https://storage.googleapis.com/du-prd/books/images/9780735219090.jpg, https://storage.googleapis.com/du-prd/books/images/9780759554344.jpg, https://storage.googleapis.com/du-prd/books/images/9781982154912.jpg, https://storage.googleapis.com/du-prd/books/images/9781501110375.jpg, https://storage.googleapis.com/du-prd/books/images/9781791392796.jpg, https://storage.googleapis.com/du-prd/books/images/9780593331750.jpg, https://storage.googleapis.com/du-prd/books/images/9781501161933.jpg, https://storage.googleapis.com/du-prd/books/images/9780063142268.jpg, https://storage.googleapis.com/du-prd/books/images/9780593321096.jpg, https://storage.googleapis.com/du-prd/books/images/9781538748282.jpg, https://storage.googleapis.com/du-prd/books/images/9780063003057.jpg, https://storage.googleapis.com/du-prd/books/images/9781476753195.jpg, https://storage.googleapis.com/du-prd/books/images/9781501110351.jpg, https://storage.googleapis.com/du-prd/books/images/9780593331262.jpg, https://storage.googleapis.com/du-prd/books/images/9780593336823.jpg, 328, 322, 329, 319, 324, 331, 315, 341, 336, 331, 331, 128, 318, 331, 333, 495, 500, 500, 495, 500, 500, 500, 500, 500, 500, 500, 198, 495, 500, 500, , , , , , , , , , , , , , , , nyt://book/08a5730d-43e5-586d-8ce6-4b891eb75fe1, nyt://book/de82c2a0-f17b-526c-a326-c2233f0667b3, nyt://book/61be67b1-c8ed-5c39-b610-e0487ecb1b8a, nyt://book/e2a3545e-e9cb-5828-9d97-50a798a0e4f6, nyt://book/013c7729-a1de-5e5c-921a-da43243f9a4a, nyt://book/bba096f9-ddfd-574b-ad2d-149d70fa774c, nyt://book/d9511fac-ee44-5a87-9af7-2cd6a6f8f984, nyt://book/2f77ac10-1816-5b3a-afba-783bc61a8c95, nyt://book/fb3975c7-1b9d-567c-9971-b3208e12c707, nyt://book/b0fbedf5-fa73-5c1f-8e94-3230e12ca680, nyt://book/ef0030b7-5eca-5278-835a-ade95bfbb1f2, nyt://book/08464a1b-cfd4-5d1b-8898-e206fb95deeb, nyt://book/74a835a9-0f52-5060-914b-b390b1e0864d, nyt://book/f9efb067-657a-5426-b057-206dbf368d47, nyt://book/8dcf02f0-c291-571b-ad6b-413b5279252b, by Delia Owens, by Dolly Parton and James Patterson, by Janet Evanovich, by Colleen Hoover, by Colleen Hoover, by Stuart Woods, by Taylor Jenkins Reid, by Jacqueline Winspear, by Anne Tyler, by Harlan Coben, by Lucy Foley, by Colleen Hoover, by Colleen Hoover, by C.J. Box, by Ali Hazelwood, , , , , , , , , , , , , , , , 2022-03-30 22:18:30, 2022-03-30 22:18:30, 2022-03-30 22:18:30, 2022-03-30 22:18:30, 2022-03-30 22:18:30, 2022-03-30 22:18:30, 2022-03-30 22:18:30, 2022-03-30 22:18:30, 2022-03-30 22:18:30, 2022-03-30 22:18:30, 2022-03-30 22:18:30, 2022-03-30 22:18:30, 2022-03-30 22:18:30, 2022-03-30 22:18:30, 2022-03-30 22:18:30, In a quiet town on the North Carolina coast in 1969, a young woman who survived alone in the marsh becomes a murder suspect., A singer-songwriter goes to Nashville seeking stardom but is followed by her dark past., When her family’s home is threatened, Gabriela Rose goes with her ex-husband to seek lost treasure in the jungles of Peru., A battered wife raised in a violent home attempts to halt the cycle of abuse., Lowen Ashleigh is hired by the husband of an injured writer to complete her popular series and uncovers a horrifying truth., The 61st book in the Stone Barrington series. Transporting secret cargo sends Stone on an adventure on both sides of the Atlantic., A movie icon recounts stories of her loves and career to a struggling magazine writer., The 17th book in the Maisie Dobbs series. Dobbs works to uncover a plot that jeopardizes the safety of Eleanor Roosevelt., The ups and downs of a Baltimore family from the 1950s to the pandemic present., The second book in the Wilde series. Questions surface when Wilde connects with family members who have been out of his life., Jess has suspicions about her half-brother’s neighbors when he goes missing., Tate Collins and Miles Archer, an airline pilot, think they can handle a no strings attached arrangement. But they can't., Is Ben using his relationship with Fallon as fodder for his novel?, The 22nd book in the Joe Pickett series. A fishing guide’s murder, stolen falcons and a Nazi official’s photo album heighten the danger., A young professor agrees to pretend to be a third-year Ph.D. candidate’s boyfriend., , , , , , , , , , , , , , , , 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0735219109, 075955434X, 1982154942, 1501110365, 1538724731, 0593331761, 1501161938, 0063142287, 0593321103, 1538748282, 0063003058, 1476753180, 1501110349, 0593331265, 0593336828, 9780735219106, 9780759554344, 9781982154943, 9781501110368, 9781538724736, 9780593331767, 9781501161933, 9780063142282, 9780593321102, 9781538748282, 9780063003057, 9781476753188, 9781501110344, 9780593331262, 9780593336823, Putnam, Little, Brown, Atria, Atria, Grand Central, Putnam, Washington Square/Atria, Harper, Knopf, Grand Central, Morrow, Atria, Atria, Putnam, Berkley, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 13, 2, 0, 3, 4, 0, 5, 0, 0, 1, 7, 0, 11, 6, 14, , , , , , , , , , , , , , , , WHERE THE CRAWDADS SING, RUN, ROSE, RUN, THE RECOVERY AGENT, IT ENDS WITH US, VERITY, A SAFE HOUSE, THE SEVEN HUSBANDS OF EVELYN HUGO, A SUNLIT WEAPON, FRENCH BRAID, THE MATCH, THE PARIS APARTMENT, UGLY LOVE, NOVEMBER 9, SHADOWS REEL, THE LOVE HYPOTHESIS, 2022-03-30 22:23:21, 2022-03-30 22:23:21, 2022-03-30 22:23:21, 2022-03-30 22:23:21, 2022-03-30 22:23:21, 2022-03-30 22:23:21, 2022-03-30 22:23:21, 2022-03-30 22:23:21, 2022-03-30 22:23:21, 2022-03-30 22:23:21, 2022-03-30 22:23:21, 2022-03-30 22:23:21, 2022-03-30 22:23:22, 2022-03-30 22:23:22, 2022-03-30 22:23:22, 153, 3, 1, 41, 16, 1, 39, 1, 1, 2, 5, 11, 4, 3, 19, Amazon, Apple Books, Barnes and Noble, Books-A-Million, Bookshop, IndieBound, https://www.amazon.com/Where-Crawdads-Sing-Delia-Owens/dp/0735219095?tag=NYTBSREV-20, https://goto.applebooks.apple/9780735219106?at=10lIEQ, https://www.anrdoezrs.net/click-7990613-11819508?url=https%3A%2F%2Fwww.barnesandnoble.com%2Fw%2F%3Fean%3D9780735219106, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fwww.anrdoezrs.net%2Fclick-7990613-35140%3Furl%3Dhttps%253A%252F%252Fwww.booksamillion.com%252Fp%252FWHERE%252BTHE%252BCRAWDADS%252BSING%252FDelia%252BOwens%252F9780735219106&url2=https%3A%2F%2Fwww.anrdoezrs.net%2Fclick-7990613-35140%3Furl%3Dhttps%253A%252F%252Fwww.booksamillion.com%252Fsearch%253Fquery%253DWHERE%252BTHE%252BCRAWDADS%252BSING%252BDelia%252BOwens, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fbookshop.org%2Fa%2F3546%2F9780735219106&url2=https%3A%2F%2Fbookshop.org%2Fbooks%3Faffiliate%3D3546%26keywords%3DWHERE%2BTHE%2BCRAWDADS%2BSING, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fwww.indiebound.org%2Fbook%2F9780735219106%3Faff%3DNYT&url2=https%3A%2F%2Fwww.indiebound.org%2Fsearch%2Fbook%3Fkeys%3DWHERE%2BTHE%2BCRAWDADS%2BSING%2BDelia%2BOwens%26aff%3DNYT, Amazon, Apple Books, Barnes and Noble, Books-A-Million, Bookshop, IndieBound, https://www.amazon.com/dp/075955434X?tag=NYTBSREV-20, https://goto.applebooks.apple/9780759554344?at=10lIEQ, https://www.anrdoezrs.net/click-7990613-11819508?url=https%3A%2F%2Fwww.barnesandnoble.com%2Fw%2F%3Fean%3D9780759554344, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fwww.anrdoezrs.net%2Fclick-7990613-35140%3Furl%3Dhttps%253A%252F%252Fwww.booksamillion.com%252Fp%252FRUN%25252C%252BROSE%25252C%252BRUN%252FDolly%252BParton%252Band%252BJames%252BPatterson%252F9780759554344&url2=https%3A%2F%2Fwww.anrdoezrs.net%2Fclick-7990613-35140%3Furl%3Dhttps%253A%252F%252Fwww.booksamillion.com%252Fsearch%253Fquery%253DRUN%25252C%252BROSE%25252C%252BRUN%252BDolly%252BParton%252Band%252BJames%252BPatterson, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fbookshop.org%2Fa%2F3546%2F9780759554344&url2=https%3A%2F%2Fbookshop.org%2Fbooks%3Faffiliate%3D3546%26keywords%3DRUN%252C%2BROSE%252C%2BRUN, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fwww.indiebound.org%2Fbook%2F9780759554344%3Faff%3DNYT&url2=https%3A%2F%2Fwww.indiebound.org%2Fsearch%2Fbook%3Fkeys%3DRUN%252C%2BROSE%252C%2BRUN%2BDolly%2BParton%2Band%2BJames%2BPatterson%26aff%3DNYT, Amazon, Apple Books, Barnes and Noble, Books-A-Million, Bookshop, IndieBound, https://www.amazon.com/dp/1982154918?tag=NYTBSREV-20, https://goto.applebooks.apple/9781982154943?at=10lIEQ, https://www.anrdoezrs.net/click-7990613-11819508?url=https%3A%2F%2Fwww.barnesandnoble.com%2Fw%2F%3Fean%3D9781982154943, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fwww.anrdoezrs.net%2Fclick-7990613-35140%3Furl%3Dhttps%253A%252F%252Fwww.booksamillion.com%252Fp%252FTHE%252BRECOVERY%252BAGENT%252FJanet%252BEvanovich%252F9781982154943&url2=https%3A%2F%2Fwww.anrdoezrs.net%2Fclick-7990613-35140%3Furl%3Dhttps%253A%252F%252Fwww.booksamillion.com%252Fsearch%253Fquery%253DTHE%252BRECOVERY%252BAGENT%252BJanet%252BEvanovich, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fbookshop.org%2Fa%2F3546%2F9781982154943&url2=https%3A%2F%2Fbookshop.org%2Fbooks%3Faffiliate%3D3546%26keywords%3DTHE%2BRECOVERY%2BAGENT, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fwww.indiebound.org%2Fbook%2F9781982154943%3Faff%3DNYT&url2=https%3A%2F%2Fwww.indiebound.org%2Fsearch%2Fbook%3Fkeys%3DTHE%2BRECOVERY%2BAGENT%2BJanet%2BEvanovich%26aff%3DNYT, Amazon, Apple Books, Barnes and Noble, Books-A-Million, Bookshop, IndieBound, http://www.amazon.com/Ends-Us-Novel-Colleen-Hoover-ebook/dp/B0176M3U10?tag=NYTBSREV-20, https://goto.applebooks.apple/9781501110368?at=10lIEQ, https://www.anrdoezrs.net/click-7990613-11819508?url=https%3A%2F%2Fwww.barnesandnoble.com%2Fw%2F%3Fean%3D9781501110368, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fwww.anrdoezrs.net%2Fclick-7990613-35140%3Furl%3Dhttps%253A%252F%252Fwww.booksamillion.com%252Fp%252FIT%252BENDS%252BWITH%252BUS%252FColleen%252BHoover%252F9781501110368&url2=https%3A%2F%2Fwww.anrdoezrs.net%2Fclick-7990613-35140%3Furl%3Dhttps%253A%252F%252Fwww.booksamillion.com%252Fsearch%253Fquery%253DIT%252BENDS%252BWITH%252BUS%252BColleen%252BHoover, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fbookshop.org%2Fa%2F3546%2F9781501110368&url2=https%3A%2F%2Fbookshop.org%2Fbooks%3Faffiliate%3D3546%26keywords%3DIT%2BENDS%2BWITH%2BUS, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fwww.indiebound.org%2Fbook%2F9781501110368%3Faff%3DNYT&url2=https%3A%2F%2Fwww.indiebound.org%2Fsearch%2Fbook%3Fkeys%3DIT%2BENDS%2BWITH%2BUS%2BColleen%2BHoover%26aff%3DNYT, Amazon, Apple Books, Barnes and Noble, Books-A-Million, Bookshop, IndieBound, https://www.amazon.com/dp/1791392792?tag=NYTBSREV-20, https://goto.applebooks.apple/9781538724736?at=10lIEQ, https://www.anrdoezrs.net/click-7990613-11819508?url=https%3A%2F%2Fwww.barnesandnoble.com%2Fw%2F%3Fean%3D9781538724736, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fwww.anrdoezrs.net%2Fclick-7990613-35140%3Furl%3Dhttps%253A%252F%252Fwww.booksamillion.com%252Fp%252FVERITY%252FColleen%252BHoover%252F9781538724736&url2=https%3A%2F%2Fwww.anrdoezrs.net%2Fclick-7990613-35140%3Furl%3Dhttps%253A%252F%252Fwww.booksamillion.com%252Fsearch%253Fquery%253DVERITY%252BColleen%252BHoover, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fbookshop.org%2Fa%2F3546%2F9781538724736&url2=https%3A%2F%2Fbookshop.org%2Fbooks%3Faffiliate%3D3546%26keywords%3DVERITY, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fwww.indiebound.org%2Fbook%2F9781538724736%3Faff%3DNYT&url2=https%3A%2F%2Fwww.indiebound.org%2Fsearch%2Fbook%3Fkeys%3DVERITY%2BColleen%2BHoover%26aff%3DNYT, Amazon, Apple Books, Barnes and Noble, Books-A-Million, Bookshop, IndieBound, https://www.amazon.com/dp/0593331753?tag=NYTBSREV-20, https://goto.applebooks.apple/9780593331767?at=10lIEQ, https://www.anrdoezrs.net/click-7990613-11819508?url=https%3A%2F%2Fwww.barnesandnoble.com%2Fw%2F%3Fean%3D9780593331767, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fwww.anrdoezrs.net%2Fclick-7990613-35140%3Furl%3Dhttps%253A%252F%252Fwww.booksamillion.com%252Fp%252FA%252BSAFE%252BHOUSE%252FStuart%252BWoods%252F9780593331767&url2=https%3A%2F%2Fwww.anrdoezrs.net%2Fclick-7990613-35140%3Furl%3Dhttps%253A%252F%252Fwww.booksamillion.com%252Fsearch%253Fquery%253DA%252BSAFE%252BHOUSE%252BStuart%252BWoods, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fbookshop.org%2Fa%2F3546%2F9780593331767&url2=https%3A%2F%2Fbookshop.org%2Fbooks%3Faffiliate%3D3546%26keywords%3DA%2BSAFE%2BHOUSE, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fwww.indiebound.org%2Fbook%2F9780593331767%3Faff%3DNYT&url2=https%3A%2F%2Fwww.indiebound.org%2Fsearch%2Fbook%3Fkeys%3DA%2BSAFE%2BHOUSE%2BStuart%2BWoods%26aff%3DNYT, Amazon, Apple Books, Barnes and Noble, Books-A-Million, Bookshop, IndieBound, https://www.amazon.com/dp/1501161938?tag=NYTBSREV-20, https://goto.applebooks.apple/9781501161933?at=10lIEQ, https://www.anrdoezrs.net/click-7990613-11819508?url=https%3A%2F%2Fwww.barnesandnoble.com%2Fw%2F%3Fean%3D9781501161933, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fwww.anrdoezrs.net%2Fclick-7990613-35140%3Furl%3Dhttps%253A%252F%252Fwww.booksamillion.com%252Fp%252FTHE%252BSEVEN%252BHUSBANDS%252BOF%252BEVELYN%252BHUGO%252FTaylor%252BJenkins%252BReid%252F9781501161933&url2=https%3A%2F%2Fwww.anrdoezrs.net%2Fclick-7990613-35140%3Furl%3Dhttps%253A%252F%252Fwww.booksamillion.com%252Fsearch%253Fquery%253DTHE%252BSEVEN%252BHUSBANDS%252BOF%252BEVELYN%252BHUGO%252BTaylor%252BJenkins%252BReid, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fbookshop.org%2Fa%2F3546%2F9781501161933&url2=https%3A%2F%2Fbookshop.org%2Fbooks%3Faffiliate%3D3546%26keywords%3DTHE%2BSEVEN%2BHUSBANDS%2BOF%2BEVELYN%2BHUGO, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fwww.indiebound.org%2Fbook%2F9781501161933%3Faff%3DNYT&url2=https%3A%2F%2Fwww.indiebound.org%2Fsearch%2Fbook%3Fkeys%3DTHE%2BSEVEN%2BHUSBANDS%2BOF%2BEVELYN%2BHUGO%2BTaylor%2BJenkins%2BReid%26aff%3DNYT, Amazon, Apple Books, Barnes and Noble, Books-A-Million, Bookshop, IndieBound, https://www.amazon.com/dp/0063142260?tag=NYTBSREV-20, https://goto.applebooks.apple/9780063142282?at=10lIEQ, https://www.anrdoezrs.net/click-7990613-11819508?url=https%3A%2F%2Fwww.barnesandnoble.com%2Fw%2F%3Fean%3D9780063142282, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fwww.anrdoezrs.net%2Fclick-7990613-35140%3Furl%3Dhttps%253A%252F%252Fwww.booksamillion.com%252Fp%252FA%252BSUNLIT%252BWEAPON%252FJacqueline%252BWinspear%252F9780063142282&url2=https%3A%2F%2Fwww.anrdoezrs.net%2Fclick-7990613-35140%3Furl%3Dhttps%253A%252F%252Fwww.booksamillion.com%252Fsearch%253Fquery%253DA%252BSUNLIT%252BWEAPON%252BJacqueline%252BWinspear, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fbookshop.org%2Fa%2F3546%2F9780063142282&url2=https%3A%2F%2Fbookshop.org%2Fbooks%3Faffiliate%3D3546%26keywords%3DA%2BSUNLIT%2BWEAPON, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fwww.indiebound.org%2Fbook%2F9780063142282%3Faff%3DNYT&url2=https%3A%2F%2Fwww.indiebound.org%2Fsearch%2Fbook%3Fkeys%3DA%2BSUNLIT%2BWEAPON%2BJacqueline%2BWinspear%26aff%3DNYT, Amazon, Apple Books, Barnes and Noble, Books-A-Million, Bookshop, IndieBound, https://www.amazon.com/dp/059332109X?tag=NYTBSREV-20, https://goto.applebooks.apple/9780593321102?at=10lIEQ, https://www.anrdoezrs.net/click-7990613-11819508?url=https%3A%2F%2Fwww.barnesandnoble.com%2Fw%2F%3Fean%3D9780593321102, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fwww.anrdoezrs.net%2Fclick-7990613-35140%3Furl%3Dhttps%253A%252F%252Fwww.booksamillion.com%252Fp%252FFRENCH%252BBRAID%252FAnne%252BTyler%252F9780593321102&url2=https%3A%2F%2Fwww.anrdoezrs.net%2Fclick-7990613-35140%3Furl%3Dhttps%253A%252F%252Fwww.booksamillion.com%252Fsearch%253Fquery%253DFRENCH%252BBRAID%252BAnne%252BTyler, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fbookshop.org%2Fa%2F3546%2F9780593321102&url2=https%3A%2F%2Fbookshop.org%2Fbooks%3Faffiliate%3D3546%26keywords%3DFRENCH%2BBRAID, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fwww.indiebound.org%2Fbook%2F9780593321102%3Faff%3DNYT&url2=https%3A%2F%2Fwww.indiebound.org%2Fsearch%2Fbook%3Fkeys%3DFRENCH%2BBRAID%2BAnne%2BTyler%26aff%3DNYT, Amazon, Apple Books, Barnes and Noble, Books-A-Million, Bookshop, IndieBound, https://www.amazon.com/dp/1538748282?tag=NYTBSREV-20, https://goto.applebooks.apple/9781538748282?at=10lIEQ, https://www.anrdoezrs.net/click-7990613-11819508?url=https%3A%2F%2Fwww.barnesandnoble.com%2Fw%2F%3Fean%3D9781538748282, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fwww.anrdoezrs.net%2Fclick-7990613-35140%3Furl%3Dhttps%253A%252F%252Fwww.booksamillion.com%252Fp%252FTHE%252BMATCH%252FHarlan%252BCoben%252F9781538748282&url2=https%3A%2F%2Fwww.anrdoezrs.net%2Fclick-7990613-35140%3Furl%3Dhttps%253A%252F%252Fwww.booksamillion.com%252Fsearch%253Fquery%253DTHE%252BMATCH%252BHarlan%252BCoben, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fbookshop.org%2Fa%2F3546%2F9781538748282&url2=https%3A%2F%2Fbookshop.org%2Fbooks%3Faffiliate%3D3546%26keywords%3DTHE%2BMATCH, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fwww.indiebound.org%2Fbook%2F9781538748282%3Faff%3DNYT&url2=https%3A%2F%2Fwww.indiebound.org%2Fsearch%2Fbook%3Fkeys%3DTHE%2BMATCH%2BHarlan%2BCoben%26aff%3DNYT, Amazon, Apple Books, Barnes and Noble, Books-A-Million, Bookshop, IndieBound, https://www.amazon.com/dp/0063003058?tag=NYTBSREV-20, https://goto.applebooks.apple/9780063003057?at=10lIEQ, https://www.anrdoezrs.net/click-7990613-11819508?url=https%3A%2F%2Fwww.barnesandnoble.com%2Fw%2F%3Fean%3D9780063003057, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fwww.anrdoezrs.net%2Fclick-7990613-35140%3Furl%3Dhttps%253A%252F%252Fwww.booksamillion.com%252Fp%252FTHE%252BPARIS%252BAPARTMENT%252FLucy%252BFoley%252F9780063003057&url2=https%3A%2F%2Fwww.anrdoezrs.net%2Fclick-7990613-35140%3Furl%3Dhttps%253A%252F%252Fwww.booksamillion.com%252Fsearch%253Fquery%253DTHE%252BPARIS%252BAPARTMENT%252BLucy%252BFoley, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fbookshop.org%2Fa%2F3546%2F9780063003057&url2=https%3A%2F%2Fbookshop.org%2Fbooks%3Faffiliate%3D3546%26keywords%3DTHE%2BPARIS%2BAPARTMENT, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fwww.indiebound.org%2Fbook%2F9780063003057%3Faff%3DNYT&url2=https%3A%2F%2Fwww.indiebound.org%2Fsearch%2Fbook%3Fkeys%3DTHE%2BPARIS%2BAPARTMENT%2BLucy%2BFoley%26aff%3DNYT, Amazon, Apple Books, Barnes and Noble, Books-A-Million, Bookshop, IndieBound, http://www.amazon.com/Ugly-Love-Novel-Colleen-Hoover-ebook/dp/B00HB62MC0?tag=NYTBSREV-20, https://goto.applebooks.apple/9781476753188?at=10lIEQ, https://www.anrdoezrs.net/click-7990613-11819508?url=https%3A%2F%2Fwww.barnesandnoble.com%2Fw%2F%3Fean%3D9781476753188, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fwww.anrdoezrs.net%2Fclick-7990613-35140%3Furl%3Dhttps%253A%252F%252Fwww.booksamillion.com%252Fp%252FUGLY%252BLOVE%252FColleen%252BHoover%252F9781476753188&url2=https%3A%2F%2Fwww.anrdoezrs.net%2Fclick-7990613-35140%3Furl%3Dhttps%253A%252F%252Fwww.booksamillion.com%252Fsearch%253Fquery%253DUGLY%252BLOVE%252BColleen%252BHoover, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fbookshop.org%2Fa%2F3546%2F9781476753188&url2=https%3A%2F%2Fbookshop.org%2Fbooks%3Faffiliate%3D3546%26keywords%3DUGLY%2BLOVE, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fwww.indiebound.org%2Fbook%2F9781476753188%3Faff%3DNYT&url2=https%3A%2F%2Fwww.indiebound.org%2Fsearch%2Fbook%3Fkeys%3DUGLY%2BLOVE%2BColleen%2BHoover%26aff%3DNYT, Amazon, Apple Books, Barnes and Noble, Books-A-Million, Bookshop, IndieBound, http://www.amazon.com/November-9-Novel-Colleen-Hoover-ebook/dp/B00UDCI1S8?tag=NYTBSREV-20, https://goto.applebooks.apple/9781501110344?at=10lIEQ, https://www.anrdoezrs.net/click-7990613-11819508?url=https%3A%2F%2Fwww.barnesandnoble.com%2Fw%2F%3Fean%3D9781501110344, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fwww.anrdoezrs.net%2Fclick-7990613-35140%3Furl%3Dhttps%253A%252F%252Fwww.booksamillion.com%252Fp%252FNOVEMBER%252B9%252FColleen%252BHoover%252F9781501110344&url2=https%3A%2F%2Fwww.anrdoezrs.net%2Fclick-7990613-35140%3Furl%3Dhttps%253A%252F%252Fwww.booksamillion.com%252Fsearch%253Fquery%253DNOVEMBER%252B9%252BColleen%252BHoover, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fbookshop.org%2Fa%2F3546%2F9781501110344&url2=https%3A%2F%2Fbookshop.org%2Fbooks%3Faffiliate%3D3546%26keywords%3DNOVEMBER%2B9, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fwww.indiebound.org%2Fbook%2F9781501110344%3Faff%3DNYT&url2=https%3A%2F%2Fwww.indiebound.org%2Fsearch%2Fbook%3Fkeys%3DNOVEMBER%2B9%2BColleen%2BHoover%26aff%3DNYT, Amazon, Apple Books, Barnes and Noble, Books-A-Million, Bookshop, IndieBound, https://www.amazon.com/dp/0593331265?tag=NYTBSREV-20, https://goto.applebooks.apple/9780593331262?at=10lIEQ, https://www.anrdoezrs.net/click-7990613-11819508?url=https%3A%2F%2Fwww.barnesandnoble.com%2Fw%2F%3Fean%3D9780593331262, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fwww.anrdoezrs.net%2Fclick-7990613-35140%3Furl%3Dhttps%253A%252F%252Fwww.booksamillion.com%252Fp%252FSHADOWS%252BREEL%252FC.J.%252BBox%252F9780593331262&url2=https%3A%2F%2Fwww.anrdoezrs.net%2Fclick-7990613-35140%3Furl%3Dhttps%253A%252F%252Fwww.booksamillion.com%252Fsearch%253Fquery%253DSHADOWS%252BREEL%252BC.J.%252BBox, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fbookshop.org%2Fa%2F3546%2F9780593331262&url2=https%3A%2F%2Fbookshop.org%2Fbooks%3Faffiliate%3D3546%26keywords%3DSHADOWS%2BREEL, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fwww.indiebound.org%2Fbook%2F9780593331262%3Faff%3DNYT&url2=https%3A%2F%2Fwww.indiebound.org%2Fsearch%2Fbook%3Fkeys%3DSHADOWS%2BREEL%2BC.J.%2BBox%26aff%3DNYT, Amazon, Apple Books, Barnes and Noble, Books-A-Million, Bookshop, IndieBound, https://www.amazon.com/dp/0593336828?tag=NYTBSREV-20, https://goto.applebooks.apple/9780593336823?at=10lIEQ, https://www.anrdoezrs.net/click-7990613-11819508?url=https%3A%2F%2Fwww.barnesandnoble.com%2Fw%2F%3Fean%3D9780593336823, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fwww.anrdoezrs.net%2Fclick-7990613-35140%3Furl%3Dhttps%253A%252F%252Fwww.booksamillion.com%252Fp%252FTHE%252BLOVE%252BHYPOTHESIS%252FAli%252BHazelwood%252F9780593336823&url2=https%3A%2F%2Fwww.anrdoezrs.net%2Fclick-7990613-35140%3Furl%3Dhttps%253A%252F%252Fwww.booksamillion.com%252Fsearch%253Fquery%253DTHE%252BLOVE%252BHYPOTHESIS%252BAli%252BHazelwood, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fbookshop.org%2Fa%2F3546%2F9780593336823&url2=https%3A%2F%2Fbookshop.org%2Fbooks%3Faffiliate%3D3546%26keywords%3DTHE%2BLOVE%2BHYPOTHESIS, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fwww.indiebound.org%2Fbook%2F9780593336823%3Faff%3DNYT&url2=https%3A%2F%2Fwww.indiebound.org%2Fsearch%2Fbook%3Fkeys%3DTHE%2BLOVE%2BHYPOTHESIS%2BAli%2BHazelwood%26aff%3DNYT
See column names:
colnames(x)
## [1] "list_id" "list_name" "list_name_encoded"
## [4] "display_name" "updated" "list_image"
## [7] "list_image_width" "list_image_height" "books"
GET /lists/overview.json
my_date <- "2021-04-06"
url <- paste0("https://api.nytimes.com/svc/books/v3/lists/overview/", my_date,".json?api-key=AvbYLVUMBocuH57SRfsCtMkgBp0iP1Kd")
r <- GET(url)
x <- fromJSON(content(r, as="text"))
x <- x$results$lists
print(paste0(nrow(x), " rows and ", ncol(x), " columns of meta data. The books are in the last column."))
## [1] "11 rows and 9 columns of meta data. The books are in the last column."
head(x, n=1L)
## list_id list_name list_name_encoded
## 1 704 Combined Print and E-Book Fiction combined-print-and-e-book-fiction
## display_name updated list_image list_image_width
## 1 Combined Print & E-Book Fiction WEEKLY NA NA
## list_image_height
## 1 NA
## books
## 1 , , , , , https://www.amazon.com/Where-Crawdads-Sing-Delia-Owens/dp/0735219095?tag=NYTBSREV-20, https://www.amazon.com/dp/075955434X?tag=NYTBSREV-20, https://www.amazon.com/dp/1982154918?tag=NYTBSREV-20, http://www.amazon.com/Ends-Us-Novel-Colleen-Hoover-ebook/dp/B0176M3U10?tag=NYTBSREV-20, https://www.amazon.com/dp/1791392792?tag=NYTBSREV-20, , , , , , Delia Owens, Dolly Parton and James Patterson, Janet Evanovich, Colleen Hoover, Colleen Hoover, https://storage.googleapis.com/du-prd/books/images/9780735219090.jpg, https://storage.googleapis.com/du-prd/books/images/9780759554344.jpg, https://storage.googleapis.com/du-prd/books/images/9781982154912.jpg, https://storage.googleapis.com/du-prd/books/images/9781501110375.jpg, https://storage.googleapis.com/du-prd/books/images/9781791392796.jpg, 328, 322, 329, 319, 324, 495, 500, 500, 495, 500, , , , , , by Delia Owens, by Dolly Parton and James Patterson, by Janet Evanovich, by Colleen Hoover, by Colleen Hoover, , , , , , 2022-03-30 22:18:30, 2022-03-30 22:18:30, 2022-03-30 22:18:30, 2022-03-30 22:18:30, 2022-03-30 22:18:30, In a quiet town on the North Carolina coast in 1969, a young woman who survived alone in the marsh becomes a murder suspect., A singer-songwriter goes to Nashville seeking stardom but is followed by her dark past., When her family’s home is threatened, Gabriela Rose goes with her ex-husband to seek lost treasure in the jungles of Peru., A battered wife raised in a violent home attempts to halt the cycle of abuse., Lowen Ashleigh is hired by the husband of an injured writer to complete her popular series and uncovers a horrifying truth., , , , , , 0.00, 0.00, 0.00, 0.00, 0.00, 0735219109, 075955434X, 1982154942, 1501110365, 1538724731, 9780735219106, 9780759554344, 9781982154943, 9781501110368, 9781538724736, nyt://book/08a5730d-43e5-586d-8ce6-4b891eb75fe1, nyt://book/de82c2a0-f17b-526c-a326-c2233f0667b3, nyt://book/61be67b1-c8ed-5c39-b610-e0487ecb1b8a, nyt://book/e2a3545e-e9cb-5828-9d97-50a798a0e4f6, nyt://book/013c7729-a1de-5e5c-921a-da43243f9a4a, Putnam, Little, Brown, Atria, Atria, Grand Central, 1, 2, 3, 4, 5, 13, 2, 0, 3, 4, , , , , , WHERE THE CRAWDADS SING, RUN, ROSE, RUN, THE RECOVERY AGENT, IT ENDS WITH US, VERITY, 2022-03-30 22:23:21, 2022-03-30 22:23:21, 2022-03-30 22:23:21, 2022-03-30 22:23:21, 2022-03-30 22:23:21, 153, 3, 1, 41, 16, Amazon, Apple Books, Barnes and Noble, Books-A-Million, Bookshop, IndieBound, https://www.amazon.com/Where-Crawdads-Sing-Delia-Owens/dp/0735219095?tag=NYTBSREV-20, https://goto.applebooks.apple/9780735219106?at=10lIEQ, https://www.anrdoezrs.net/click-7990613-11819508?url=https%3A%2F%2Fwww.barnesandnoble.com%2Fw%2F%3Fean%3D9780735219106, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fwww.anrdoezrs.net%2Fclick-7990613-35140%3Furl%3Dhttps%253A%252F%252Fwww.booksamillion.com%252Fp%252FWHERE%252BTHE%252BCRAWDADS%252BSING%252FDelia%252BOwens%252F9780735219106&url2=https%3A%2F%2Fwww.anrdoezrs.net%2Fclick-7990613-35140%3Furl%3Dhttps%253A%252F%252Fwww.booksamillion.com%252Fsearch%253Fquery%253DWHERE%252BTHE%252BCRAWDADS%252BSING%252BDelia%252BOwens, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fbookshop.org%2Fa%2F3546%2F9780735219106&url2=https%3A%2F%2Fbookshop.org%2Fbooks%3Faffiliate%3D3546%26keywords%3DWHERE%2BTHE%2BCRAWDADS%2BSING, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fwww.indiebound.org%2Fbook%2F9780735219106%3Faff%3DNYT&url2=https%3A%2F%2Fwww.indiebound.org%2Fsearch%2Fbook%3Fkeys%3DWHERE%2BTHE%2BCRAWDADS%2BSING%2BDelia%2BOwens%26aff%3DNYT, Amazon, Apple Books, Barnes and Noble, Books-A-Million, Bookshop, IndieBound, https://www.amazon.com/dp/075955434X?tag=NYTBSREV-20, https://goto.applebooks.apple/9780759554344?at=10lIEQ, https://www.anrdoezrs.net/click-7990613-11819508?url=https%3A%2F%2Fwww.barnesandnoble.com%2Fw%2F%3Fean%3D9780759554344, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fwww.anrdoezrs.net%2Fclick-7990613-35140%3Furl%3Dhttps%253A%252F%252Fwww.booksamillion.com%252Fp%252FRUN%25252C%252BROSE%25252C%252BRUN%252FDolly%252BParton%252Band%252BJames%252BPatterson%252F9780759554344&url2=https%3A%2F%2Fwww.anrdoezrs.net%2Fclick-7990613-35140%3Furl%3Dhttps%253A%252F%252Fwww.booksamillion.com%252Fsearch%253Fquery%253DRUN%25252C%252BROSE%25252C%252BRUN%252BDolly%252BParton%252Band%252BJames%252BPatterson, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fbookshop.org%2Fa%2F3546%2F9780759554344&url2=https%3A%2F%2Fbookshop.org%2Fbooks%3Faffiliate%3D3546%26keywords%3DRUN%252C%2BROSE%252C%2BRUN, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fwww.indiebound.org%2Fbook%2F9780759554344%3Faff%3DNYT&url2=https%3A%2F%2Fwww.indiebound.org%2Fsearch%2Fbook%3Fkeys%3DRUN%252C%2BROSE%252C%2BRUN%2BDolly%2BParton%2Band%2BJames%2BPatterson%26aff%3DNYT, Amazon, Apple Books, Barnes and Noble, Books-A-Million, Bookshop, IndieBound, https://www.amazon.com/dp/1982154918?tag=NYTBSREV-20, https://goto.applebooks.apple/9781982154943?at=10lIEQ, https://www.anrdoezrs.net/click-7990613-11819508?url=https%3A%2F%2Fwww.barnesandnoble.com%2Fw%2F%3Fean%3D9781982154943, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fwww.anrdoezrs.net%2Fclick-7990613-35140%3Furl%3Dhttps%253A%252F%252Fwww.booksamillion.com%252Fp%252FTHE%252BRECOVERY%252BAGENT%252FJanet%252BEvanovich%252F9781982154943&url2=https%3A%2F%2Fwww.anrdoezrs.net%2Fclick-7990613-35140%3Furl%3Dhttps%253A%252F%252Fwww.booksamillion.com%252Fsearch%253Fquery%253DTHE%252BRECOVERY%252BAGENT%252BJanet%252BEvanovich, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fbookshop.org%2Fa%2F3546%2F9781982154943&url2=https%3A%2F%2Fbookshop.org%2Fbooks%3Faffiliate%3D3546%26keywords%3DTHE%2BRECOVERY%2BAGENT, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fwww.indiebound.org%2Fbook%2F9781982154943%3Faff%3DNYT&url2=https%3A%2F%2Fwww.indiebound.org%2Fsearch%2Fbook%3Fkeys%3DTHE%2BRECOVERY%2BAGENT%2BJanet%2BEvanovich%26aff%3DNYT, Amazon, Apple Books, Barnes and Noble, Books-A-Million, Bookshop, IndieBound, http://www.amazon.com/Ends-Us-Novel-Colleen-Hoover-ebook/dp/B0176M3U10?tag=NYTBSREV-20, https://goto.applebooks.apple/9781501110368?at=10lIEQ, https://www.anrdoezrs.net/click-7990613-11819508?url=https%3A%2F%2Fwww.barnesandnoble.com%2Fw%2F%3Fean%3D9781501110368, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fwww.anrdoezrs.net%2Fclick-7990613-35140%3Furl%3Dhttps%253A%252F%252Fwww.booksamillion.com%252Fp%252FIT%252BENDS%252BWITH%252BUS%252FColleen%252BHoover%252F9781501110368&url2=https%3A%2F%2Fwww.anrdoezrs.net%2Fclick-7990613-35140%3Furl%3Dhttps%253A%252F%252Fwww.booksamillion.com%252Fsearch%253Fquery%253DIT%252BENDS%252BWITH%252BUS%252BColleen%252BHoover, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fbookshop.org%2Fa%2F3546%2F9781501110368&url2=https%3A%2F%2Fbookshop.org%2Fbooks%3Faffiliate%3D3546%26keywords%3DIT%2BENDS%2BWITH%2BUS, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fwww.indiebound.org%2Fbook%2F9781501110368%3Faff%3DNYT&url2=https%3A%2F%2Fwww.indiebound.org%2Fsearch%2Fbook%3Fkeys%3DIT%2BENDS%2BWITH%2BUS%2BColleen%2BHoover%26aff%3DNYT, Amazon, Apple Books, Barnes and Noble, Books-A-Million, Bookshop, IndieBound, https://www.amazon.com/dp/1791392792?tag=NYTBSREV-20, https://goto.applebooks.apple/9781538724736?at=10lIEQ, https://www.anrdoezrs.net/click-7990613-11819508?url=https%3A%2F%2Fwww.barnesandnoble.com%2Fw%2F%3Fean%3D9781538724736, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fwww.anrdoezrs.net%2Fclick-7990613-35140%3Furl%3Dhttps%253A%252F%252Fwww.booksamillion.com%252Fp%252FVERITY%252FColleen%252BHoover%252F9781538724736&url2=https%3A%2F%2Fwww.anrdoezrs.net%2Fclick-7990613-35140%3Furl%3Dhttps%253A%252F%252Fwww.booksamillion.com%252Fsearch%253Fquery%253DVERITY%252BColleen%252BHoover, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fbookshop.org%2Fa%2F3546%2F9781538724736&url2=https%3A%2F%2Fbookshop.org%2Fbooks%3Faffiliate%3D3546%26keywords%3DVERITY, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fwww.indiebound.org%2Fbook%2F9781538724736%3Faff%3DNYT&url2=https%3A%2F%2Fwww.indiebound.org%2Fsearch%2Fbook%3Fkeys%3DVERITY%2BColleen%2BHoover%26aff%3DNYT
The above output is the resulting data frame, but let’s have a look at the books in the first Best Seller list.
book1 <- x$books[1][1]
glimpse(book1)
## List of 1
## $ :'data.frame': 5 obs. of 25 variables:
## ..$ age_group : chr [1:5] "" "" "" "" ...
## ..$ amazon_product_url : chr [1:5] "https://www.amazon.com/Where-Crawdads-Sing-Delia-Owens/dp/0735219095?tag=NYTBSREV-20" "https://www.amazon.com/dp/075955434X?tag=NYTBSREV-20" "https://www.amazon.com/dp/1982154918?tag=NYTBSREV-20" "http://www.amazon.com/Ends-Us-Novel-Colleen-Hoover-ebook/dp/B0176M3U10?tag=NYTBSREV-20" ...
## ..$ article_chapter_link: chr [1:5] "" "" "" "" ...
## ..$ author : chr [1:5] "Delia Owens" "Dolly Parton and James Patterson" "Janet Evanovich" "Colleen Hoover" ...
## ..$ book_image : chr [1:5] "https://storage.googleapis.com/du-prd/books/images/9780735219090.jpg" "https://storage.googleapis.com/du-prd/books/images/9780759554344.jpg" "https://storage.googleapis.com/du-prd/books/images/9781982154912.jpg" "https://storage.googleapis.com/du-prd/books/images/9781501110375.jpg" ...
## ..$ book_image_width : int [1:5] 328 322 329 319 324
## ..$ book_image_height : int [1:5] 495 500 500 495 500
## ..$ book_review_link : chr [1:5] "" "" "" "" ...
## ..$ contributor : chr [1:5] "by Delia Owens" "by Dolly Parton and James Patterson" "by Janet Evanovich" "by Colleen Hoover" ...
## ..$ contributor_note : chr [1:5] "" "" "" "" ...
## ..$ created_date : chr [1:5] "2022-03-30 22:18:30" "2022-03-30 22:18:30" "2022-03-30 22:18:30" "2022-03-30 22:18:30" ...
## ..$ description : chr [1:5] "In a quiet town on the North Carolina coast in 1969, a young woman who survived alone in the marsh becomes a murder suspect." "A singer-songwriter goes to Nashville seeking stardom but is followed by her dark past." "When her family’s home is threatened, Gabriela Rose goes with her ex-husband to seek lost treasure in the jungles of Peru." "A battered wife raised in a violent home attempts to halt the cycle of abuse." ...
## ..$ first_chapter_link : chr [1:5] "" "" "" "" ...
## ..$ price : chr [1:5] "0.00" "0.00" "0.00" "0.00" ...
## ..$ primary_isbn10 : chr [1:5] "0735219109" "075955434X" "1982154942" "1501110365" ...
## ..$ primary_isbn13 : chr [1:5] "9780735219106" "9780759554344" "9781982154943" "9781501110368" ...
## ..$ book_uri : chr [1:5] "nyt://book/08a5730d-43e5-586d-8ce6-4b891eb75fe1" "nyt://book/de82c2a0-f17b-526c-a326-c2233f0667b3" "nyt://book/61be67b1-c8ed-5c39-b610-e0487ecb1b8a" "nyt://book/e2a3545e-e9cb-5828-9d97-50a798a0e4f6" ...
## ..$ publisher : chr [1:5] "Putnam" "Little, Brown" "Atria" "Atria" ...
## ..$ rank : int [1:5] 1 2 3 4 5
## ..$ rank_last_week : int [1:5] 13 2 0 3 4
## ..$ sunday_review_link : chr [1:5] "" "" "" "" ...
## ..$ title : chr [1:5] "WHERE THE CRAWDADS SING" "RUN, ROSE, RUN" "THE RECOVERY AGENT" "IT ENDS WITH US" ...
## ..$ updated_date : chr [1:5] "2022-03-30 22:23:21" "2022-03-30 22:23:21" "2022-03-30 22:23:21" "2022-03-30 22:23:21" ...
## ..$ weeks_on_list : int [1:5] 153 3 1 41 16
## ..$ buy_links :List of 5
## .. ..$ :'data.frame': 6 obs. of 2 variables:
## .. ..$ :'data.frame': 6 obs. of 2 variables:
## .. ..$ :'data.frame': 6 obs. of 2 variables:
## .. ..$ :'data.frame': 6 obs. of 2 variables:
## .. ..$ :'data.frame': 6 obs. of 2 variables:
See column names of the data frame:
colnames(x)
## [1] "list_id" "list_name" "list_name_encoded"
## [4] "display_name" "updated" "list_image"
## [7] "list_image_width" "list_image_height" "books"
GET /lists.json
list_name <- "animals"
url <- paste0("https://api.nytimes.com/svc/books/v3/lists/",list_name,".json?api-key=AvbYLVUMBocuH57SRfsCtMkgBp0iP1Kd")
r <- GET(url)
x <- fromJSON(content(r, as="text"))
x <- x$results
The data frame is in the variable x, a list, but the book information is in x$books, which is a data frame.
head(x$books, n=1L)
## rank rank_last_week weeks_on_list asterisk dagger primary_isbn10
## 1 1 0 0 0 0 1452110581
## primary_isbn13 publisher
## 1 9781452110585 Chronicle
## description
## 1 In this book of tongue-in-cheek poetry, cats get help explaining their behavior.
## price title author contributor
## 1 0.00 I COULD PEE ON THIS Francesco Marciuliano by Francesco Marciuliano
## contributor_note
## 1
## book_image
## 1 https://storage.googleapis.com/du-prd/books/images/9781452110585.jpg
## book_image_width book_image_height
## 1 128 171
## amazon_product_url
## 1 http://www.amazon.com/Could-Pee-This-Other-Poems/dp/1452110581?tag=NYTBSREV-20
## age_group book_review_link first_chapter_link sunday_review_link
## 1
## article_chapter_link isbns
## 1 1452110581, 1452151849, 9781452110585, 9781452151847
## buy_links
## 1 Amazon, Apple Books, Barnes and Noble, Books-A-Million, Bookshop, IndieBound, http://www.amazon.com/Could-Pee-This-Other-Poems/dp/1452110581?tag=NYTBSREV-20, https://goto.applebooks.apple/9781452110585?at=10lIEQ, https://www.anrdoezrs.net/click-7990613-11819508?url=https%3A%2F%2Fwww.barnesandnoble.com%2Fw%2F%3Fean%3D9781452110585, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fwww.anrdoezrs.net%2Fclick-7990613-35140%3Furl%3Dhttps%253A%252F%252Fwww.booksamillion.com%252Fp%252FI%252BCOULD%252BPEE%252BON%252BTHIS%252FFrancesco%252BMarciuliano%252F9781452110585&url2=https%3A%2F%2Fwww.anrdoezrs.net%2Fclick-7990613-35140%3Furl%3Dhttps%253A%252F%252Fwww.booksamillion.com%252Fsearch%253Fquery%253DI%252BCOULD%252BPEE%252BON%252BTHIS%252BFrancesco%252BMarciuliano, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fbookshop.org%2Fa%2F3546%2F9781452110585&url2=https%3A%2F%2Fbookshop.org%2Fbooks%3Faffiliate%3D3546%26keywords%3DI%2BCOULD%2BPEE%2BON%2BTHIS, https://du-gae-books-dot-nyt-du-prd.appspot.com/redirect?url1=https%3A%2F%2Fwww.indiebound.org%2Fbook%2F9781452110585%3Faff%3DNYT&url2=https%3A%2F%2Fwww.indiebound.org%2Fsearch%2Fbook%3Fkeys%3DI%2BCOULD%2BPEE%2BON%2BTHIS%2BFrancesco%2BMarciuliano%26aff%3DNYT
## book_uri
## 1 nyt://book/36be148d-8d4d-5ce2-9633-cdc3027e75cb
See column names for x$books:
colnames(x$books)
## [1] "rank" "rank_last_week" "weeks_on_list"
## [4] "asterisk" "dagger" "primary_isbn10"
## [7] "primary_isbn13" "publisher" "description"
## [10] "price" "title" "author"
## [13] "contributor" "contributor_note" "book_image"
## [16] "book_image_width" "book_image_height" "amazon_product_url"
## [19] "age_group" "book_review_link" "first_chapter_link"
## [22] "sunday_review_link" "article_chapter_link" "isbns"
## [25] "buy_links" "book_uri"
GET /reviews.json
author <- "Stephen+King"
url <- paste0("https://api.nytimes.com/svc/books/v3/reviews.json?author=", author,"&api-key=AvbYLVUMBocuH57SRfsCtMkgBp0iP1Kd")
r <- GET(url)
x <- fromJSON(content(r, as="text"))
x <- x$results
See column names:
colnames(x)
## [1] "url" "publication_dt" "byline" "book_title"
## [5] "book_author" "summary" "uuid" "uri"
## [9] "isbn13"
We fetched reviews of Stephen King’s books. View the first 2 that were returned.
head(x, n=2L)
## url
## 1 http://www.nytimes.com/2011/11/13/books/review/11-22-63-by-stephen-king-book-review.html
## 2 http://www.nytimes.com/2011/10/31/books/stephen-kings-11-23-63-review.html
## publication_dt byline book_title book_author
## 1 2011-11-13 ERROL MORRIS 11/22/63 Stephen King
## 2 2011-10-31 JANET MASLIN 11/22/63 Stephen King
## summary
## 1 Stephen King’s time traveler tries to undo some painful history.
## 2 Stephen King’s latest novel, “11/22/63,” tells of a schoolteacher who travels back to 1958 to alter history, and falls in love as well.
## uuid
## 1 00000000-0000-0000-0000-000000000000
## 2 00000000-0000-0000-0000-000000000000
## uri
## 1 nyt://book/00000000-0000-0000-0000-000000000000
## 2 nyt://book/00000000-0000-0000-0000-000000000000
## isbn13
## 1 9780307951434, 9780606351461, 9781442344280, 9781442344303, 9781442391635, 9781444727326, 9781451627282, 9781451627299, 9781451627305, 9781451651645, 9781501120602, 9781594135590
## 2 9780307951434, 9780606351461, 9781442344280, 9781442344303, 9781442391635, 9781444727326, 9781451627282, 9781451627299, 9781451627305, 9781451651645, 9781501120602, 9781594135590
See column names. This way, you can see that the url of the review is located in the first column:
colnames(x)
## [1] "url" "publication_dt" "byline" "book_title"
## [5] "book_author" "summary" "uuid" "uri"
## [9] "isbn13"
By specifying parameters and your API key, you can easily request information from the NYTimes Books API. We need to first build our request string, which may or may not include different query parameters, like an author or title. Then use the httr package to make the request, passing along your string. Use content function and pass the argument as="text" to get the response from the API. In our case, the payload was usually in the results column of the response, and this was what we converted into a data frame that can be utilized later. However, there is so much data it can be difficult to parse with human eyes, so it’s a good idea to print the column names or the first few rows to get a better understanding.