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.
The main objective 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.
I chose to retrieve data from the NY Times Books API. This API retrieves NY Times book reviews and obtains data from all best-seller lists.
# Define the API endpoint
base_url <- "https://api.nytimes.com/svc/books/v3/reviews.json"
# Set query parameters
params1 <- list(author = "Rachel DeLoache Williams", "api-key" = api_key)
params2 <- list(author = "Stephen King", "api-key" = api_key)
params3 <- list(author = "Toni Morrison", "api-key" = api_key)# Make GET request to the API
response <- GET(url = base_url, query = params1)
# Check if request was successful
if (status_code(response) == 200) {
# Parse JSON response
json_data <- content(response, as = "text", encoding = "UTF-8")
# Convert JSON to DataFrame
df <- jsonlite::fromJSON(json_data)$results
# Display the DataFrame
print(df)
} else {
# Print error message with status code
print(paste("Error:", status_code(response), "- Unable to retrieve data from the API."))
# Print detailed error message
print(content(response, as = "text"))
}## url
## 1 https://www.nytimes.com/2019/07/23/books/review/my-friend-anna-rachel-deloache-williams.html
## publication_dt byline book_title book_author
## 1 2019-07-23 SADIE STEIN My Friend Anna Rachel DeLoache Williams
## summary
## 1 In “My Friend Anna,” Rachel DeLoache Williams recounts her yearlong deception by the notorious Russian con artist who took New York by storm.
## uuid
## 1 00000000-0000-0000-0000-000000000000
## uri isbn13
## 1 nyt://book/00000000-0000-0000-0000-000000000000 9781982114091
# Make GET request to the API
response <- GET(url = base_url, query = params2)
# Check if request was successful
if (status_code(response) == 200) {
# Parse JSON response
json_data <- content(response, as = "text", encoding = "UTF-8")
# Convert JSON to DataFrame
df <- jsonlite::fromJSON(json_data)$results
# Display the DataFrame
print(df)
} else {
# Print error message with status code
print(paste("Error:", status_code(response), "- Unable to retrieve data from the API."))
# Print detailed error message
print(content(response, as = "text"))
}## 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
## 3 http://www.nytimes.com/2004/01/04/books/the-quest-for-the-north-central-positronics.html
## 4 http://www.nytimes.com/1993/10/24/books/in-short-fiction-284093.html
## 5 http://www.nytimes.com/2001/11/04/books/books-in-brief-fiction-poetry-851302.html
## 6 http://www.nytimes.com/1990/05/13/books/armageddon-complete-and-uncut.html
## 7 http://www.nytimes.com/1990/09/02/books/scared-but-safe.html
## 8 http://www.nytimes.com/1991/10/20/books/l-defending-stephen-king-075091.html
## 9 http://www.nytimes.com/1992/06/29/books/books-of-the-times-to-be-read-in-daylight-away-from-hungry-dogs.html
## 10 http://www.nytimes.com/2002/04/14/books/the-horror-etc.html
## 11 http://www.nytimes.com/1986/08/21/books/books-of-the-times-547486.html
## 12 http://www.nytimes.com/2010/11/28/books/review/Rafferty-t.html
## 13 http://www.nytimes.com/1998/09/27/books/familiar-terrors.html
## 14 http://www.nytimes.com/2002/03/18/books/books-of-the-times-storytelling-mogul-decides-to-sweep-out-odds-and-ends.html
## 15 http://www.nytimes.com/1995/07/02/books/in-short-fiction-077895.html
## 16 http://www.nytimes.com/2013/09/16/books/doctor-sleep-is-stephen-kings-sequel-to-the-shining.html
## 17 http://www.nytimes.com/2013/09/22/books/review/stephen-kings-shining-sequel-doctor-sleep.html
## 18 http://www.nytimes.com/2013/06/23/books/review/joyland-by-stephen-king.html
## 19 http://www.nytimes.com/2009/11/08/books/review/JParker-t.html
## 20 http://www.nytimes.com/2009/11/12/books/12book.html
## 21 http://www.nytimes.com/2014/11/14/books/stephen-kings-revival.html
## 22 http://www.nytimes.com/2014/11/23/books/review/stephen-kings-revival.html
## 23 http://www.nytimes.com/2006/11/12/books/review/Windolf.t.html
## 24 http://www.nytimes.com/2008/11/05/books/05masl.html
## 25 http://www.nytimes.com/2008/11/23/books/review/Taylor-t.html
## 26 http://www.nytimes.com/2008/01/21/books/21maslin.html
## 27 http://www.nytimes.com/2008/03/02/books/review/Campbell-t.html
## 28 http://www.nytimes.com/2006/10/23/books/23masl.html
## 29 http://www.nytimes.com/2014/06/08/books/review/stephen-kings-mr-mercedes.html
## 30 http://www.nytimes.com/1981/05/10/books/scare-tactics.html
## 31 http://www.nytimes.com/1981/08/14/books/books-of-the-times-books-of-the-times.html
## 32 http://www.nytimes.com/1982/08/11/books/books-of-the-times-074639.html
## 33 http://www.nytimes.com/1982/08/29/books/horror-writer-s-holiday.html
## 34 http://www.nytimes.com/1983/04/03/books/the-other-woman-was-a-car.html
## 35 http://www.nytimes.com/1983/04/12/books/books-of-the-times-093019.html
## 36 http://www.nytimes.com/1983/10/21/books/books-of-the-times-243538.html
## 37 http://www.nytimes.com/1985/06/09/books/don-t-turn-your-back-on-this-book.html
## 38 http://www.nytimes.com/1987/02/22/books/what-the-wicked-magician-did.html
## 39 http://www.nytimes.com/1987/05/31/books/summer-reading-sheldon-gets-the-ax.html
## 40 http://www.nytimes.com/1987/06/08/books/books-of-the-times-301987.html
## 41 http://www.nytimes.com/1987/11/05/books/books-of-the-times-950387.html
## 42 http://www.nytimes.com/1987/12/20/books/not-with-a-bang-but-an-eeeooooarrrhmm.html
## 43 http://www.nytimes.com/1989/10/23/books/books-of-the-times-from-stephen-king-a-writer-s-demon.html
## 44 http://www.nytimes.com/1989/10/29/books/his-alter-ego-is-a-killer.html
## 45 http://www.nytimes.com/1991/09/29/books/avaunt-thee-recreant-cyborg.html
## 46 http://www.nytimes.com/1991/10/03/books/books-of-the-times-turning-favors-into-catastrophe.html
## 47 http://www.nytimes.com/1994/10/06/books/books-of-the-times-lack-of-sleep-the-least-of-his-problems.html
## 48 http://www.nytimes.com/1995/06/26/books/book-review-a-punch-in-the-nose-then-a-new-life-begins.html
## 49 http://www.nytimes.com/1998/09/21/books/books-of-the-times-death-terror-and-writer-s-block.html
## 50 http://www.nytimes.com/1999/04/15/books/books-of-the-times-a-modern-fairy-tale-of-the-dark-north-woods.html
## 51 http://www.nytimes.com/1999/05/16/books/books-in-brief-fiction-583618.html
## 52 http://www.nytimes.com/2000/10/05/books/books-of-the-times-how-to-write-if-you-re-stephen-king.html
## 53 http://www.nytimes.com/2000/10/08/books/making-it.html
## 54 http://www.nytimes.com/2001/03/15/books/books-of-the-times-a-fateful-step-off-a-curb-and-into-alien-territory.html
## 55 http://www.nytimes.com/2001/04/15/books/weasel-from-another-planet.html
## 56 http://www.nytimes.com/2002/09/23/books/books-of-the-times-cruising-the-dark-side-forget-about-seat-belts.html
## 57 http://www.nytimes.com/2002/09/29/books/not-your-father-s-roadmaster.html
## 58 http://www.nytimes.com/2004/06/20/books/books-in-brief-fiction-937851.html
## 59 http://www.nytimes.com/2006/01/23/books/23masl.html
## 60 http://www.nytimes.com/2006/02/05/books/review/05itzkoff.html
## 61 http://www.nytimes.com/2015/05/31/books/review/stephen-kings-finders-keepers.html
## 62 http://www.nytimes.com/2016/06/12/books/review/stephen-kings-end-of-watch.html
## 63 https://www.nytimes.com/2018/05/22/books/review/outsider-stephen-king.html
## 64 https://www.nytimes.com/2018/10/26/books/review/stephen-king-elevation.html
## 65 https://www.nytimes.com/2019/09/08/books/review-institute-stephen-king.html
## 66 https://www.nytimes.com/2019/09/10/books/review/stephen-king-the-institute.html
## publication_dt byline
## 1 2011-11-13 ERROL MORRIS
## 2 2011-10-31 JANET MASLIN
## 3 2004-01-04 ANDREW O'HEHIR
## 4 1993-10-24 RICHARD E. NICHOLLS
## 5 2001-11-04 MARY ELIZABETH WILLIAMS
## 6 1990-05-13 ROBERT KIELY
## 7 1990-09-02 ANDY SOLOMON
## 8 1991-10-20
## 9 1992-06-29 CHRISTOPHER LEHMANN-HAUPT
## 10 2002-04-14 WALTER KIRN
## 11 1986-08-21 CHRISTOPHER LEHMANN-HAUPT
## 12 2010-11-28 TERRENCE RAFFERTY
## 13 1998-09-27 DANIEL MENDELSOHN
## 14 2002-03-18 JANET MASLIN
## 15 1995-07-02 RICHARD E. NICHOLLS
## 16 2013-09-16 JANET MASLIN
## 17 2013-09-22 MARGARET ATWOOD
## 18 2013-06-23 WALTER KIRN
## 19 2009-11-08 JAMES PARKER
## 20 2009-11-12 JANET MASLIN
## 21 2014-11-14 JANET MASLIN
## 22 2014-11-23 DANIELLE TRUSSONI
## 23 2006-11-12 JIM WINDOLF
## 24 2008-11-05 JANET MASLIN
## 25 2008-11-23 CHARLES TAYLOR
## 26 2008-01-21 JANET MASLIN
## 27 2008-03-02 JAMES CAMPBELL
## 28 2006-10-23 JANET MASLIN
## 29 2014-06-08 MEGAN ABBOTT
## 30 1981-05-10 MICHELE SLUNG
## 31 1981-08-14
## 32 1982-08-11
## 33 1982-08-29 ALAN CHEUSE
## 34 1983-04-03 PHILLIPE VAN RJNDT
## 35 1983-04-12
## 36 1983-10-21
## 37 1985-06-09 SUSAN BOLOTIN
## 38 1987-02-22 BARBARA TRITEL
## 39 1987-05-31 JOHN KATZENBACH
## 40 1987-06-08
## 41 1987-11-05
## 42 1987-12-20 NINA AUERBACH
## 43 1989-10-23
## 44 1989-10-29 GEORGE STADE
## 45 1991-09-29 RICHARD E. NICHOLLS
## 46 1991-10-03
## 47 1994-10-06
## 48 1995-06-26
## 49 1998-09-21
## 50 1999-04-15
## 51 1999-05-16 ANDREW ESSEX
## 52 2000-10-05 JANET MASLIN
## 53 2000-10-08 FREDERICK BUSCH
## 54 2001-03-15 JANET MASLIN
## 55 2001-04-15 COLIN HARRISON
## 56 2002-09-23 JANET MASLIN
## 57 2002-09-29 LAURA MILLER
## 58 2004-06-20 BEN SISARIO
## 59 2006-01-23 JANET MASLIN
## 60 2006-02-05 DAVE ITZKOFF
## 61 2015-05-31 LAURA LIPPMAN
## 62 2016-06-12 DENISE MINA
## 63 2018-05-22 VICTOR LAVALLE
## 64 2018-10-26 GILBERT CRUZ
## 65 2019-09-08 DWIGHT GARNER
## 66 2019-09-10 LAURA MILLER
## book_title book_author
## 1 11/22/63 Stephen King
## 2 11/22/63 Stephen King
## 3 Wolves of the Calla Stephen King
## 4 Nightmares and Dreamscapes Stephen King
## 5 Black House Stephen King
## 6 The Stand Stephen King
## 7 Four Past Midnight Stephen King
## 8 Needful Things Stephen King
## 9 Gerald's Game Stephen King
## 10 Everything's Eventual : 14 Dark Tales Stephen King
## 11 It Stephen King
## 12 Full Dark, No Stars Stephen King
## 13 Bag of Bones Stephen King
## 14 Everything's Eventual : 14 Dark Tales Stephen King
## 15 Rose Madder Stephen King
## 16 Doctor Sleep Stephen King
## 17 Doctor Sleep Stephen King
## 18 Joyland Stephen King
## 19 Under the Dome Stephen King
## 20 Under the Dome Stephen King
## 21 Revival Stephen King
## 22 Revival Stephen King
## 23 Lisey's Story Stephen King
## 24 Just After Sunset Stephen King
## 25 Just After Sunset Stephen King
## 26 Duma Key Stephen King
## 27 Duma Key Stephen King
## 28 Lisey's Story Stephen King
## 29 Mr. Mercedes Stephen King
## 30 Stephen King's Danse Macabre Stephen King
## 31 Cujo Stephen King
## 32 Different Seasons Stephen King
## 33 Different Seasons Stephen King
## 34 Christine Stephen King
## 35 Christine Stephen King
## 36 Pet Sematary Stephen King
## 37 Skeleton Crew Stephen King
## 38 The Eyes of the Dragon Stephen King
## 39 Misery Stephen King
## 40 Misery Stephen King
## 41 The Tommyknockers Stephen King
## 42 The Tommyknockers Stephen King
## 43 The Dark Half Stephen King
## 44 The Dark Half Stephen King
## 45 The Waste Lands: The Dark Tower Book III Stephen King
## 46 Needful Things: The Last Castle Rock Story Stephen King
## 47 Insomnia,Stephen King Library Ed. Stephen King
## 48 Rose Madder Stephen King
## 49 Bag of Bones Stephen King
## 50 The Girl Who Loved Tom Gordon : A Novel Stephen King
## 51 The Girl Who Loved Tom Gordon : A Novel Stephen King
## 52 On Writing: a Memoir of the Craft Stephen King
## 53 On Writing: a Memoir of the Craft Stephen King
## 54 Dreamcatcher Stephen King
## 55 Dreamcatcher Stephen King
## 56 From a Buick 8 Stephen King
## 57 From a Buick 8 Stephen King
## 58 The Dark Tower VI Stephen King
## 59 Cell Stephen King
## 60 Cell Stephen King
## 61 Finders Keepers Stephen King
## 62 End of Watch Stephen King
## 63 The Outsider Stephen King
## 64 Elevation Stephen King
## 65 The Institute Stephen King
## 66 The Institute 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.
## 3
## 4
## 5
## 6
## 7
## 8
## 9
## 10
## 11
## 12
## 13
## 14
## 15
## 16 In “Doctor Sleep” Stephen King offers a sequel to “The Shining.”
## 17 “Doctor Sleep” picks up the story of Danny, the little boy with psycho-intuitive powers from Stephen King’s 1977 novel “The Shining.”
## 18 Stephen King’s lovelorn narrator takes a summer job at a haunted Southern amusement park.
## 19 When an enormous transparent dome settles over a small town in Maine in Stephen King’s new novel, it’s just fine with Big Jim, the local tyrant-in-waiting, and his pet goon squad.
## 20 “Under the Dome” gravely threatens Stephen King’s status as a mere chart-busting pop cultural phenomenon.
## 21 In Stephen King’s “Revival,” a boy is befriended by a charismatic minister with whom he will reconnect in eerie and unsettling ways as an adult.
## 22 Two men are locked in a battle of wills in Stephen King’s novel of fanaticism and what might exist on the other side of life.
## 23 When Stephen King really wants to put a scare into you, he brings on his most fearsome monster of all, the writer.
## 24 Everyday situations became open portals to fantasy and horror in Stephen King’s succinct, fast-moving new collection.
## 25 A new short-story collection takes Stephen King back to the form that gave him his seat-of-the-pants start.
## 26 Stephen King’s use of horror is not what it used to be. It may still be the impetus for his stories, but it is no longer the foremost reason they’re interesting.
## 27 In Stephen King’s new novel, a man recuperating in the Florida Keys begins to paint, with sinister results.
## 28 In his new book, Stephen King delivers his version of Joycean wordplay, idiosyncrasy, voluptuousness and stubborn, obsessive chronology.
## 29 With one eye on Philip Marlowe, Stephen King takes a crack at the detective novel.
## 30
## 31
## 32
## 33
## 34
## 35
## 36
## 37
## 38
## 39
## 40
## 41
## 42
## 43
## 44
## 45
## 46
## 47
## 48
## 49
## 50
## 51
## 52
## 53
## 54
## 55
## 56
## 57
## 58
## 59
## 60
## 61 Laura Lippman reviews Stephen King’s “Finders Keepers,” the second entry in a planned trilogy that began with “Mr. Mercedes.”
## 62 A retired police detective sees the return of his nemesis in this suspense story with a supernatural twist.
## 63 “The Outsider” starts out as a routine police procedural but before long transforms into something much more sinister.
## 64 King’s slim new novel, “Elevation,” returns us to Castle Rock, where prejudice drives a plot that blends the fantastical with the mundane.
## 65 In his latest, King tells the story of an institution where children with special powers are cultivated — but that’s just where the nightmare begins.
## 66 The terror doesn’t come from ghosts or fiends or clowns — it’s ordinary people, folks just like you and me, who are the evil ones.
## uuid
## 1 00000000-0000-0000-0000-000000000000
## 2 00000000-0000-0000-0000-000000000000
## 3 00000000-0000-0000-0000-000000000000
## 4 00000000-0000-0000-0000-000000000000
## 5 00000000-0000-0000-0000-000000000000
## 6 00000000-0000-0000-0000-000000000000
## 7 00000000-0000-0000-0000-000000000000
## 8 00000000-0000-0000-0000-000000000000
## 9 00000000-0000-0000-0000-000000000000
## 10 00000000-0000-0000-0000-000000000000
## 11 00000000-0000-0000-0000-000000000000
## 12 00000000-0000-0000-0000-000000000000
## 13 00000000-0000-0000-0000-000000000000
## 14 00000000-0000-0000-0000-000000000000
## 15 00000000-0000-0000-0000-000000000000
## 16 00000000-0000-0000-0000-000000000000
## 17 00000000-0000-0000-0000-000000000000
## 18 00000000-0000-0000-0000-000000000000
## 19 00000000-0000-0000-0000-000000000000
## 20 00000000-0000-0000-0000-000000000000
## 21 00000000-0000-0000-0000-000000000000
## 22 00000000-0000-0000-0000-000000000000
## 23 00000000-0000-0000-0000-000000000000
## 24 00000000-0000-0000-0000-000000000000
## 25 00000000-0000-0000-0000-000000000000
## 26 00000000-0000-0000-0000-000000000000
## 27 00000000-0000-0000-0000-000000000000
## 28 00000000-0000-0000-0000-000000000000
## 29 00000000-0000-0000-0000-000000000000
## 30 00000000-0000-0000-0000-000000000000
## 31 00000000-0000-0000-0000-000000000000
## 32 00000000-0000-0000-0000-000000000000
## 33 00000000-0000-0000-0000-000000000000
## 34 00000000-0000-0000-0000-000000000000
## 35 00000000-0000-0000-0000-000000000000
## 36 00000000-0000-0000-0000-000000000000
## 37 00000000-0000-0000-0000-000000000000
## 38 00000000-0000-0000-0000-000000000000
## 39 00000000-0000-0000-0000-000000000000
## 40 00000000-0000-0000-0000-000000000000
## 41 00000000-0000-0000-0000-000000000000
## 42 00000000-0000-0000-0000-000000000000
## 43 00000000-0000-0000-0000-000000000000
## 44 00000000-0000-0000-0000-000000000000
## 45 00000000-0000-0000-0000-000000000000
## 46 00000000-0000-0000-0000-000000000000
## 47 00000000-0000-0000-0000-000000000000
## 48 00000000-0000-0000-0000-000000000000
## 49 00000000-0000-0000-0000-000000000000
## 50 00000000-0000-0000-0000-000000000000
## 51 00000000-0000-0000-0000-000000000000
## 52 00000000-0000-0000-0000-000000000000
## 53 00000000-0000-0000-0000-000000000000
## 54 00000000-0000-0000-0000-000000000000
## 55 00000000-0000-0000-0000-000000000000
## 56 00000000-0000-0000-0000-000000000000
## 57 00000000-0000-0000-0000-000000000000
## 58 00000000-0000-0000-0000-000000000000
## 59 00000000-0000-0000-0000-000000000000
## 60 00000000-0000-0000-0000-000000000000
## 61 00000000-0000-0000-0000-000000000000
## 62 00000000-0000-0000-0000-000000000000
## 63 00000000-0000-0000-0000-000000000000
## 64 00000000-0000-0000-0000-000000000000
## 65 00000000-0000-0000-0000-000000000000
## 66 00000000-0000-0000-0000-000000000000
## uri
## 1 nyt://book/00000000-0000-0000-0000-000000000000
## 2 nyt://book/00000000-0000-0000-0000-000000000000
## 3 nyt://book/00000000-0000-0000-0000-000000000000
## 4 nyt://book/00000000-0000-0000-0000-000000000000
## 5 nyt://book/00000000-0000-0000-0000-000000000000
## 6 nyt://book/00000000-0000-0000-0000-000000000000
## 7 nyt://book/00000000-0000-0000-0000-000000000000
## 8 nyt://book/00000000-0000-0000-0000-000000000000
## 9 nyt://book/00000000-0000-0000-0000-000000000000
## 10 nyt://book/00000000-0000-0000-0000-000000000000
## 11 nyt://book/00000000-0000-0000-0000-000000000000
## 12 nyt://book/00000000-0000-0000-0000-000000000000
## 13 nyt://book/00000000-0000-0000-0000-000000000000
## 14 nyt://book/00000000-0000-0000-0000-000000000000
## 15 nyt://book/00000000-0000-0000-0000-000000000000
## 16 nyt://book/00000000-0000-0000-0000-000000000000
## 17 nyt://book/00000000-0000-0000-0000-000000000000
## 18 nyt://book/00000000-0000-0000-0000-000000000000
## 19 nyt://book/00000000-0000-0000-0000-000000000000
## 20 nyt://book/00000000-0000-0000-0000-000000000000
## 21 nyt://book/00000000-0000-0000-0000-000000000000
## 22 nyt://book/00000000-0000-0000-0000-000000000000
## 23 nyt://book/00000000-0000-0000-0000-000000000000
## 24 nyt://book/00000000-0000-0000-0000-000000000000
## 25 nyt://book/00000000-0000-0000-0000-000000000000
## 26 nyt://book/00000000-0000-0000-0000-000000000000
## 27 nyt://book/00000000-0000-0000-0000-000000000000
## 28 nyt://book/00000000-0000-0000-0000-000000000000
## 29 nyt://book/00000000-0000-0000-0000-000000000000
## 30 nyt://book/00000000-0000-0000-0000-000000000000
## 31 nyt://book/00000000-0000-0000-0000-000000000000
## 32 nyt://book/00000000-0000-0000-0000-000000000000
## 33 nyt://book/00000000-0000-0000-0000-000000000000
## 34 nyt://book/00000000-0000-0000-0000-000000000000
## 35 nyt://book/00000000-0000-0000-0000-000000000000
## 36 nyt://book/00000000-0000-0000-0000-000000000000
## 37 nyt://book/00000000-0000-0000-0000-000000000000
## 38 nyt://book/00000000-0000-0000-0000-000000000000
## 39 nyt://book/00000000-0000-0000-0000-000000000000
## 40 nyt://book/00000000-0000-0000-0000-000000000000
## 41 nyt://book/00000000-0000-0000-0000-000000000000
## 42 nyt://book/00000000-0000-0000-0000-000000000000
## 43 nyt://book/00000000-0000-0000-0000-000000000000
## 44 nyt://book/00000000-0000-0000-0000-000000000000
## 45 nyt://book/00000000-0000-0000-0000-000000000000
## 46 nyt://book/00000000-0000-0000-0000-000000000000
## 47 nyt://book/00000000-0000-0000-0000-000000000000
## 48 nyt://book/00000000-0000-0000-0000-000000000000
## 49 nyt://book/00000000-0000-0000-0000-000000000000
## 50 nyt://book/00000000-0000-0000-0000-000000000000
## 51 nyt://book/00000000-0000-0000-0000-000000000000
## 52 nyt://book/00000000-0000-0000-0000-000000000000
## 53 nyt://book/00000000-0000-0000-0000-000000000000
## 54 nyt://book/00000000-0000-0000-0000-000000000000
## 55 nyt://book/00000000-0000-0000-0000-000000000000
## 56 nyt://book/00000000-0000-0000-0000-000000000000
## 57 nyt://book/00000000-0000-0000-0000-000000000000
## 58 nyt://book/00000000-0000-0000-0000-000000000000
## 59 nyt://book/00000000-0000-0000-0000-000000000000
## 60 nyt://book/00000000-0000-0000-0000-000000000000
## 61 nyt://book/00000000-0000-0000-0000-000000000000
## 62 nyt://book/00000000-0000-0000-0000-000000000000
## 63 nyt://book/00000000-0000-0000-0000-000000000000
## 64 nyt://book/00000000-0000-0000-0000-000000000000
## 65 nyt://book/00000000-0000-0000-0000-000000000000
## 66 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
## 3 9781848941137
## 4 9781441615299
## 5 9780375504396
## 6 9781848940833
## 7 9780816151776
## 8 9781598877427
## 9 9780670846504
## 10 9781439568200
## 11 9780451169518
## 12 9781439192566, 9781439192597, 9781439192603, 9781441677112, 9781442335769, 9781444712582, 9781451650600, 9781602859463
## 13 9780671026073
## 14 9781416537816
## 15 9781568952611
## 16 9781451698855
## 17 9781451698855
## 18 9781781162644
## 19 9781476735474
## 20 9781476735474
## 21 9781410473837, 9781442372764, 9781442372788, 9781476770383, 9781476770390, 9781476770406
## 22 9781410473837, 9781442372764, 9781442372788, 9781476770383, 9781476770390, 9781476770406
## 23 9781416523352
## 24 9781416586654
## 25 9781416586654
## 26 9781416552963
## 27 9781416552963
## 28 9781416523352
## 29 9781410469007, 9781442369788, 9781442371347, 9781442395404, 9781476754451, 9781476754468, 9781476754475, 9781501125607
## 30 9780896960763
## 31 9780670451937
## 32 9780670272662
## 33 9780670272662
## 34 9780670220267
## 35 9780670220267
## 36 9780385182447
## 37 NULL
## 38 NULL
## 39 9780670813643
## 40 9780670813643
## 41 9780399133145
## 42 9780399133145
## 43 NULL
## 44 NULL
## 45 9780452267404
## 46 9780670839537
## 47 9780670855032
## 48 9780670858699
## 49 9780684853505
## 50 9780684867625
## 51 9780684867625
## 52 9780606222549, 9780606231862, 9780671024253, 9780684853529, 9780743204361, 9780743211536, 9780743455961, 9780743563376, 9781416549864, 9781417647019, 9781439156810, 9781439193631, 9781441658869, 9781444723250, 9781848941083, 9781931208048
## 53 9780606222549, 9780606231862, 9780671024253, 9780684853529, 9780743204361, 9780743211536, 9780743455961, 9780743563376, 9781416549864, 9781417647019, 9781439156810, 9781439193631, 9781441658869, 9781444723250, 9781848941083, 9781931208048
## 54 9780743211383
## 55 9780743211383
## 56 9780743211376
## 57 9780743211376
## 58 9781880418598
## 59 9780743292337
## 60 9780743292337
## 61 9781410479501, 9781442384347, 9781501100079, 9781501100123, 9781501100130, 9781594138522
## 62 9781410489906, 9781501129742, 9781501134142, 9781501134159, 9781508211358
## 63 9781501180989
## 64 9781982102319
## 65 9781982110567
## 66 9781982110567
# Make GET request to the API
response <- GET(url = base_url, query = params3)
# Check if request was successful
if (status_code(response) == 200) {
# Parse JSON response
json_data <- content(response, as = "text", encoding = "UTF-8")
# Convert JSON to DataFrame
df <- jsonlite::fromJSON(json_data)$results
# Display the DataFrame
print(df)
} else {
# Print error message with status code
print(paste("Error:", status_code(response), "- Unable to retrieve data from the API."))
# Print detailed error message
print(content(response, as = "text"))
}## url
## 1 http://www.nytimes.com/1998/01/06/books/books-of-the-times-worthy-women-unredeemable-men.html
## 2 http://www.nytimes.com/1992/04/05/books/the-clearest-eye.html
## 3 http://www.nytimes.com/2008/11/30/books/review/Gates-t.html
## 4 http://www.nytimes.com/2012/05/08/books/home-a-novel-by-toni-morrison.html
## 5 http://www.nytimes.com/2012/05/20/books/review/home-a-novel-by-toni-morrison.html
## 6 http://www.nytimes.com/2008/11/04/books/04kaku.html
## 7 http://www.nytimes.com/1981/03/21/books/books-of-the-times-049574.html
## 8 http://www.nytimes.com/1981/03/29/books/morrison-s-black-fable.html
## 9 http://www.nytimes.com/1987/09/02/books/books-of-the-times-788887.html
## 10 http://www.nytimes.com/1987/09/13/books/jaunted-by-their-nightmares.html
## 11 http://www.nytimes.com/1992/04/02/books/books-of-the-times-2-voices-as-far-apart-as-the-novel-and-the-essay.html
## 12 http://www.nytimes.com/1998/01/11/books/the-promised-land.html
## 13 http://www.nytimes.com/2015/04/19/books/review/toni-morrisons-god-help-the-child.html
## 14 https://www.nytimes.com/2019/02/26/books/review/toni-morrison-source-of-self-regard.html
## 15 https://www.nytimes.com/2015/04/19/books/review/toni-morrisons-god-help-the-child.html
## publication_dt byline
## 1 1998-01-06 MICHIKO KAKUTANI
## 2 1992-04-05 WENDY STEINER
## 3 2008-11-30 DAVID GATES
## 4 2012-05-08 MICHIKO KAKUTANI
## 5 2012-05-20 LEAH HAGER COHEN
## 6 2008-11-04 MICHIKO KAKUTANI
## 7 1981-03-21
## 8 1981-03-29 JOHN IRVING
## 9 1987-09-02 MICHIKO KAKUTANI
## 10 1987-09-13 MARGARET ATWOOD
## 11 1992-04-02
## 12 1998-01-11 BROOKE ALLEN
## 13 2015-04-19 KARA WALKER
## 14 2019-02-26 JAMES McBRIDE
## 15 2015-04-13 KARA WALKER
## book_title
## 1 Paradise
## 2 Playing in the Dark : Whiteness and the Literary Imagination
## 3 A Mercy
## 4 Home
## 5 Home
## 6 A Mercy
## 7 Tar Baby
## 8 Tar Baby
## 9 Beloved
## 10 Beloved
## 11 Playing in the Dark : Whiteness and the Literary Imagination
## 12 Paradise
## 13 God Help the Child
## 14 The Source of Self-Regard: Selected Essays, Speeches, and Meditations
## 15 God Help the Child
## book_author
## 1 Toni Morrison
## 2 Toni Morrison
## 3 Toni Morrison
## 4 Toni Morrison
## 5 Toni Morrison
## 6 Toni Morrison
## 7 Toni Morrison
## 8 Toni Morrison
## 9 Toni Morrison
## 10 Toni Morrison
## 11 Toni Morrison
## 12 Toni Morrison
## 13 Toni Morrison
## 14 Toni Morrison
## 15 Toni Morrison
## summary
## 1
## 2
## 3 In this novel of the 17th century, Morrison performs her deepest excavation yet into America’s history and exhumes our twin original sins: the enslavement of Africans and the near extermination of Native Americans.
## 4 Toni Morrison’s new novel encapsulates all the themes that have fueled her fiction: the hold that time past exerts over time present, the hazards of love, the possibility of redemption and transcendence.
## 5 In Toni Morrison’s novel, a traumatized soldier returns from the Korean War to his segregated hometown in Georgia.
## 6 Toni Morrison’s remarkable new novella, “A Mercy,” is, at once, a kind of prelude to “Beloved” and a variation on that earlier book’s exploration of the personal costs of slavery.
## 7
## 8
## 9
## 10
## 11
## 12
## 13 Child abuse cuts a jagged scar through Toni Morrison’s “God Help the Child,” a modern-day fairy tale with shades of the Brothers Grimm.
## 14 “The Source of Self-Regard,” a new collection of essays and lectures spanning four decades of the author’s career, cements her status as an unparalleled literary innovator.
## 15 Child abuse cuts a jagged scar through Toni Morrison’s “God Help the Child,” a modern-day fairy tale with shades of the Brothers Grimm.
## uuid
## 1 00000000-0000-0000-0000-000000000000
## 2 00000000-0000-0000-0000-000000000000
## 3 00000000-0000-0000-0000-000000000000
## 4 00000000-0000-0000-0000-000000000000
## 5 00000000-0000-0000-0000-000000000000
## 6 00000000-0000-0000-0000-000000000000
## 7 00000000-0000-0000-0000-000000000000
## 8 00000000-0000-0000-0000-000000000000
## 9 00000000-0000-0000-0000-000000000000
## 10 00000000-0000-0000-0000-000000000000
## 11 00000000-0000-0000-0000-000000000000
## 12 00000000-0000-0000-0000-000000000000
## 13 00000000-0000-0000-0000-000000000000
## 14 00000000-0000-0000-0000-000000000000
## 15 00000000-0000-0000-0000-000000000000
## uri
## 1 nyt://book/00000000-0000-0000-0000-000000000000
## 2 nyt://book/00000000-0000-0000-0000-000000000000
## 3 nyt://book/00000000-0000-0000-0000-000000000000
## 4 nyt://book/00000000-0000-0000-0000-000000000000
## 5 nyt://book/00000000-0000-0000-0000-000000000000
## 6 nyt://book/00000000-0000-0000-0000-000000000000
## 7 nyt://book/00000000-0000-0000-0000-000000000000
## 8 nyt://book/00000000-0000-0000-0000-000000000000
## 9 nyt://book/00000000-0000-0000-0000-000000000000
## 10 nyt://book/00000000-0000-0000-0000-000000000000
## 11 nyt://book/00000000-0000-0000-0000-000000000000
## 12 nyt://book/00000000-0000-0000-0000-000000000000
## 13 nyt://book/00000000-0000-0000-0000-000000000000
## 14 nyt://book/00000000-0000-0000-0000-000000000000
## 15 nyt://book/00000000-0000-0000-0000-000000000000
## isbn13
## 1 9780783883366
## 2 9780679745426
## 3 9780307276766
## 4 9780307740915
## 5 9780307740915
## 6 9780307276766
## 7 9780394423296
## 8 9780394423296
## 9 9780394535975
## 10 9780394535975
## 11 9780674673779
## 12 9780679433743
## 13 9780307594174, 9780307749086, 9780385353175, 9780804194822
## 14 9780525521037
## 15 9780307594174
…