Creating an interface with the NY Times API and read in the json data to extract some information to be stored in a data frame.
Load required libraries
Displaying tables
I use the url and api_key along with a query to request to the NYT API.
url <- "https://api.nytimes.com/svc/search/v2/articlesearch.json?"
key <- str_c("&api-key=", api_key)
get_article_info()
Takeing in parsed responses from the API and extracting the information. There are 10 articles per page. Not all fields have values so we test for that case with the ifelse() function and assign missing values as NA.
get_article_info <- function(parsed_response) {
# initialize dataframe
df <- data.frame(headline=character(),
author=character(),
pubdate=as.Date(character()),
url=character(),
stringsAsFactors=FALSE)
# for each article per page, extract the information
for (i in 1:10) {
# get article
article <- parsed_response$response$docs[[i]]
# extract info
headline <- ifelse(is.null(article$headline$main), "NA", article$headline$main)
author <- ifelse(is.null(article$byline$original), "NA", article$byline$original)
pubdate <- article$pub_date
weburl <- article$web_url
# store in dataframe format
info <- data.frame(headline, author, pubdate, weburl)
names(info) <- names(df)
# append to dataframe
df <- rbind(df, info)
}
return(df)
}
Calling the get_article_info()
function and feeding it the parsed_response
info for each page. I arbitrarily limited the extraction to the first 10 pages of responses. The resulting query will be the newest articles.
# initialize dataframe that will contain the 10 extracted article info for each response page
articles <- data.frame(headline=character(),
author=character(),
pubdate=as.Date(character()),
url=character(),
stringsAsFactors=FALSE)
# iterate
for (i in 1:10) {
# string the query and request together and send a request
query <- str_c("q=","new+york+times&page=", i, "&sort=newest")
request <- str_c(url, query, key)
nyt <- GET(request)
# parse the request
parsed_response <- content(nyt, "parse")
# call get_article_info function
article_info <- get_article_info(parsed_response)
# append to articles data frame
articles <- rbind(articles, article_info)
}
headline | author | pubdate | url |
---|---|---|---|
They Asked Black Artists About Inspiration. Here, They Share Their Own. | NA | 2020-03-29T09:00:12+0000 | https://www.nytimes.com/2020/03/29/reader-center/they-asked-black-artists-about-inspiration-here-they-share-their-own.html |
The Virus Has Transformed the 2020 Elections. Here’s How. | By Jonathan Martin, Reid J. Epstein and Maggie Haberman | 2020-03-29T08:39:35+0000 | https://www.nytimes.com/2020/03/29/us/2020-elections-coronavirus.html |
Rich Europeans Flee Virus for 2nd Homes, Spreading Fear and Fury | By Norimitsu Onishi and Constant Méheut | 2020-03-29T08:16:50+0000 | https://www.nytimes.com/2020/03/29/world/europe/rich-coronavirus-second-homes.html |
The Latest: Connecticut and Oregon Get Disaster Declaration | By The Associated Press | 2020-03-29T05:12:02+0000 | https://www.nytimes.com/aponline/2020/03/29/business/ap-virus-outbreak-the-latest.html |
Counties Without Coronavirus Are Mostly Rural, Poor | By The Associated Press | 2020-03-29T04:12:02+0000 | https://www.nytimes.com/aponline/2020/03/29/us/ap-us-virus-outbreak-virus-free-counties.html |
Coronavirus Live Updates: Trump Retreats on Quarantine Threat; India’s Lockdown Brings Chaos and Hunger | NA | 2020-03-29T04:04:26+0000 | https://www.nytimes.com/2020/03/29/world/coronavirus-news.html |
Tidying and transformations.
Displaying the results of the transformation.
headline | author | pubdate | url |
---|---|---|---|
They Asked Black Artists About Inspiration. Here, They Share Their Own. | NA | 2020-03-29T09:00:12+0000 | https://www.nytimes.com/2020/03/29/reader-center/they-asked-black-artists-about-inspiration-here-they-share-their-own.html |
The Virus Has Transformed the 2020 Elections. Here’s How. | Jonathan Martin, Reid J. Epstein and Maggie Haberman | 2020-03-29T08:39:35+0000 | https://www.nytimes.com/2020/03/29/us/2020-elections-coronavirus.html |
Rich Europeans Flee Virus for 2nd Homes, Spreading Fear and Fury | Norimitsu Onishi and Constant Méheut | 2020-03-29T08:16:50+0000 | https://www.nytimes.com/2020/03/29/world/europe/rich-coronavirus-second-homes.html |
The Latest: Connecticut and Oregon Get Disaster Declaration | The Associated Press | 2020-03-29T05:12:02+0000 | https://www.nytimes.com/aponline/2020/03/29/business/ap-virus-outbreak-the-latest.html |
Counties Without Coronavirus Are Mostly Rural, Poor | The Associated Press | 2020-03-29T04:12:02+0000 | https://www.nytimes.com/aponline/2020/03/29/us/ap-us-virus-outbreak-virus-free-counties.html |
Coronavirus Live Updates: Trump Retreats on Quarantine Threat; India’s Lockdown Brings Chaos and Hunger | NA | 2020-03-29T04:04:26+0000 | https://www.nytimes.com/2020/03/29/world/coronavirus-news.html |
Figuring Out Home Schooling in the Age of Coronavirus | Francesca Donner and Corinne Purtill | 2020-03-28T23:32:38+0000 | https://www.nytimes.com/2020/03/28/us/28IHW-coronavirus-school-families-learning.html |
FEMA Says at Least 7 People at the Disaster Agency Have the Coronavirus | Christopher Flavelle and Zolan Kanno-Youngs | 2020-03-28T22:41:05+0000 | https://www.nytimes.com/2020/03/28/climate/fema-coronavirus.html |
Northern Ireland Brings in Tough Measures to Fight Coronavirus | Reuters | 2020-03-28T22:09:17+0000 | https://www.nytimes.com/reuters/2020/03/28/world/europe/28reuters-health-coronavirus-britain-nireland.html |
Finding Comfort in a Bottle of Familiar Wine | Eric Asimov | 2020-03-28T21:30:29+0000 | https://www.nytimes.com/2020/03/28/dining/drinks/comfort-wine-coronavirus.html |
N.Y.C.’s 911 System Is Overwhelmed. ‘I’m Terrified,’ a Paramedic Says. | Ali Watkins | 2020-03-28T20:44:05+0000 | https://www.nytimes.com/2020/03/28/nyregion/nyc-coronavirus-ems.html |
AP Interview: Roger Penske Talks Postponing Indianapolis 500 | The Associated Press | 2020-03-28T20:39:05+0000 | https://www.nytimes.com/aponline/2020/03/28/sports/ap-car-indycar-penskes-decision-.html |
The Week That Was: Stories From the Coronavirus Saga | The Associated Press | 2020-03-28T19:15:15+0000 | https://www.nytimes.com/aponline/2020/03/28/us/ap-virus-outbreak-the-week-that-was.html |
Germany Has Relatively Few Deaths From Coronavirus. Why? | Anna Sauerbrey | 2020-03-28T19:00:06+0000 | https://www.nytimes.com/2020/03/28/opinion/germany-coronavirus.html |
The Healing Power of ‘Steven Universe’ | Nicole Clark | 2020-03-28T19:00:06+0000 | https://www.nytimes.com/2020/03/28/opinion/sunday/steven-universe-finale.html |
What Shakespeare Teaches Us About Living With Pandemics | Emma Smith | 2020-03-28T19:00:05+0000 | https://www.nytimes.com/2020/03/28/opinion/coronavirus-shakespeare.html |
Rational Panic, but Also Rational Hope | Ross Douthat | 2020-03-28T18:30:06+0000 | https://www.nytimes.com/2020/03/28/opinion/sunday/coronavirus-masks-cities-response.html |
Trump Struggles With Tone in Virus Crisis, Aides Urge More Empathy | Reuters | 2020-03-28T18:24:15+0000 | https://www.nytimes.com/reuters/2020/03/28/us/28reuters-health-coronavirus-trump-tone.html |
The Lost Month: How a Failure to Test Blinded the U.S. to Covid-19 | Michael D. Shear, Abby Goodnough, Sheila Kaplan, Sheri Fink, Katie Thomas and Noah Weiland | 2020-03-28T17:29:20+0000 | https://www.nytimes.com/2020/03/28/us/testing-coronavirus-pandemic.html |
Medical Expert Who Corrects Trump Is Now a Target of the Far Right | Davey Alba and Sheera Frenkel | 2020-03-28T16:31:31+0000 | https://www.nytimes.com/2020/03/28/technology/coronavirus-fauci-trump-conspiracy-target.html |
Alone on the Road, a Trucker’s Long Haul as America Fights the Virus | John Branch, Terry Ratzlaff and Darrell Woolsey | 2020-03-28T16:00:09+0000 | https://www.nytimes.com/2020/03/28/us/coronavirus-truckers.html |
How the Young Deal With the Coronavirus | NA | 2020-03-28T16:00:06+0000 | https://www.nytimes.com/2020/03/28/opinion/letters/us-coronavirus-young.html |
A Unanimous Senate Vote That Nobody Seemed to Agree On | Carl Hulse | 2020-03-28T15:58:26+0000 | https://www.nytimes.com/2020/03/28/us/senate-coronavirus-stimulus-bill.html |
Coronavirus Roils Every Segment of US Child Welfare System | The Associated Press | 2020-03-28T15:42:04+0000 | https://www.nytimes.com/aponline/2020/03/28/us/ap-us-virus-outbreak-child-welfare.html |
Runners Still Finding Release on the Road During Coronavirus | The Associated Press | 2020-03-28T15:12:15+0000 | https://www.nytimes.com/aponline/2020/03/28/sports/ap-us-virus-outbreak-runners-staying-active.html |
In a Town Where Meth Is Eclipsing Opioids, Everyone Feels the Pain | Timothy Williams | 2020-03-28T15:09:10+0000 | https://www.nytimes.com/2020/03/28/us/methamphetamine-kentucky-effects.html |
Tom Coburn, the ‘Dr. No’ of Congress, Is Dead at 72 | Robert D. McFadden | 2020-03-28T15:00:24+0000 | https://www.nytimes.com/2020/03/28/us/tom-coburn-dead.html |
When the Mundane Becomes Heroic | Devi Lockwood and Damon Winter | 2020-03-28T15:00:16+0000 | https://www.nytimes.com/2020/03/28/opinion/sunday/covid-workers-nyc.html |
We Can Safely Restart the Economy in June. Here’s How. | Ezekiel J. Emanuel | 2020-03-28T15:00:07+0000 | https://www.nytimes.com/2020/03/28/opinion/coronavirus-economy.html |
Virus as Metaphor | Ian Buruma | 2020-03-28T15:00:07+0000 | https://www.nytimes.com/2020/03/28/opinion/coronavirus-racism-covid.html |
A World Without Partisan Gerrymanders? Virginia Democrats Show the Way | Jesse Wegman | 2020-03-28T15:00:06+0000 | https://www.nytimes.com/2020/03/28/opinion/virginia-gerrymandering-law.html |
Covid-19 Brings Out All the Usual Zombies | Paul Krugman | 2020-03-28T14:47:41+0000 | https://www.nytimes.com/2020/03/28/opinion/coronavirus-trump-response.html |
‘Officers Are Scared Out There’: Coronavirus Hits US Police | The Associated Press | 2020-03-28T13:48:05+0000 | https://www.nytimes.com/aponline/2020/03/28/us/ap-us-virus-outbreak-policing.html |
Locked Up: No Masks, Sanitizer as Virus Spreads Behind Bars | The Associated Press | 2020-03-28T13:24:07+0000 | https://www.nytimes.com/aponline/2020/03/28/us/ap-virus-outbreak-prisons.html |
AP FACT CHECK: Trump a Rosy Outlier on Science of the Virus | The Associated Press | 2020-03-28T13:21:03+0000 | https://www.nytimes.com/aponline/2020/03/28/us/politics/ap-us-fact-check-week.html |
They Celebrated Basketball and a Birthday. Then Came Coronavirus. | John Branch and Marc Stein | 2020-03-28T13:16:17+0000 | https://www.nytimes.com/2020/03/28/sports/basketball/coronavirus-college-basketball-players-ncaa.html |
The New Rules of Running Now | Jen A. Miller | 2020-03-28T12:00:06+0000 | https://www.nytimes.com/2020/03/28/well/move/the-new-rules-of-running-now.html |
Infinite Visions Were Hiding in the First Black Hole Image’s Rings | Dennis Overbye | 2020-03-28T09:00:29+0000 | https://www.nytimes.com/2020/03/28/science/black-hole-rings.html |
Sabrina Ionescu’s Big Moment Wasn’t the One She Expected | Kurt Streeter | 2020-03-28T09:00:29+0000 | https://www.nytimes.com/2020/03/28/sports/sabrina-ionescu-oregon-wnba.html |
April Bills Loom. The Economy Hangs on How Many Are Left Unpaid. | Conor Dougherty and Ben Casselman | 2020-03-28T09:00:28+0000 | https://www.nytimes.com/2020/03/28/business/economy/coronavirus-bills-rent-payments.html |
A Wall. A Ball. That’s All: Your New Social-Distancing Workout | Alyson Krueger | 2020-03-28T09:00:17+0000 | https://www.nytimes.com/2020/03/28/nyregion/coronavirus-nyc-exercise-outdoors.html |
‘We are Trying to Protect Our Own’: The Towns Keeping Part-Timers Out | Dionne Searcey | 2020-03-28T09:00:16+0000 | https://www.nytimes.com/2020/03/28/us/politics/coronavirus-second-homes.html |
Looking for Hope, Uplift or Just a Distraction From Virus Fears? Read On. | Rick Rojas | 2020-03-28T09:00:16+0000 | https://www.nytimes.com/article/virus-hope-uplift-distraction.html |
Doctor, Refugee. Violinist, Refugee. Model, Refugee. | Nicholas Casey, Megan Janetsky and Andrea Zarate | 2020-03-28T09:00:15+0000 | https://www.nytimes.com/2020/03/28/world/americas/doctor-refugee-violinist-refugee-model-refugee.html |
Parents Work on the Front Lines. Where Do Their Children Go All Day? | Liam Stack and Nate Schweber | 2020-03-28T09:00:15+0000 | https://www.nytimes.com/2020/03/28/nyregion/nyc-enrichment-centers-schools.html |
As Virus Spreads, China and Russia See Openings for Disinformation | Julian E. Barnes, Matthew Rosenberg and Edward Wong | 2020-03-28T09:00:15+0000 | https://www.nytimes.com/2020/03/28/us/politics/china-russia-coronavirus-disinformation.html |
Bring in the Robot Cleaners: Travel Industry Innovations for the Pandemic | Elaine Glusac | 2020-03-28T09:00:14+0000 | https://www.nytimes.com/2020/03/28/travel/coronavirus-hotels-private-jets-virtual-spas.html |
Panic Buying Comes for the Seeds | Kendra Pierre-Louis | 2020-03-28T09:00:12+0000 | https://www.nytimes.com/2020/03/28/style/seed-panic-buying-coronavirus.html |
Rev. Joseph E. Lowery, Civil Rights Leader and King Aide, Dies at 98 | Douglas Martin | 2020-03-28T08:27:49+0000 | https://www.nytimes.com/2020/03/28/us/joseph-lowery-dead.html |
Taiwan Foreign Minister Invites U.S. Reporters Expelled by China | Reuters | 2020-03-28T08:18:18+0000 | https://www.nytimes.com/reuters/2020/03/28/world/asia/28reuters-usa-china-media-taiwan.html |
With Virus, Cherished Mideast Traditions Come to Abrupt Halt | The Associated Press | 2020-03-28T07:12:03+0000 | https://www.nytimes.com/aponline/2020/03/28/world/middleeast/ap-ml-virus-outbreak-curtailed-customs.html |
What’s on TV Saturday: ‘Captain Phillips’ and ‘Fly Away Home’ | Mariel Wamsley | 2020-03-28T05:00:08+0000 | https://www.nytimes.com/2020/03/28/arts/television/whats-on-tv-saturday-captain-phillips-and-fly-away-home.html |
Trump Says a Quarantine ‘Will Not Be Necessary’ | NA | 2020-03-28T04:01:51+0000 | https://www.nytimes.com/2020/03/28/world/coronavirus-live-news-updates.html |
NFL Notebook: Rodgers Escaped Peru Before Airport Shutdown | Reuters | 2020-03-28T03:11:53+0000 | https://www.nytimes.com/reuters/2020/03/27/sports/football/27reuters-football-nfl-notebook.html |
Analyzing the Patterns in Trump’s Falsehoods About Coronavirus | Linda Qiu | 2020-03-28T00:22:15+0000 | https://www.nytimes.com/2020/03/27/us/politics/trump-coronavirus-factcheck.html |
A Silent Spring Is Saying Something | Roger Cohen | 2020-03-28T00:00:48+0000 | https://www.nytimes.com/2020/03/27/opinion/coronavirus-pandemic.html |
One Continent, Two Very Different Political Responses to the Pandemic | Ian Austen | 2020-03-27T23:59:15+0000 | https://www.nytimes.com/2020/03/27/world/canada/Compare-us-response-coronavirus.html |
Coronavirus Briefing: What Happened Today | Lara Takenaga and Jonathan Wolfe | 2020-03-27T23:53:25+0000 | https://www.nytimes.com/2020/03/27/us/coronavirus-today.html |
Locked Out of the Virtual Classroom | The Editorial Board | 2020-03-27T23:53:04+0000 | https://www.nytimes.com/2020/03/27/opinion/coronavirus-internet-schools-learning.html |
In This Emergency, Mom Knows Best | Bret Stephens | 2020-03-27T23:48:36+0000 | https://www.nytimes.com/2020/03/27/opinion/coronavirus-elderly.html |
‘We Have Lost It All’: The Shock Felt by Millions of Unemployed Americans | Sabrina Tavernise, Audra D. S. Burch, Sarah Mervosh and Campbell Robertson | 2020-03-27T23:40:13+0000 | https://www.nytimes.com/2020/03/27/us/coronavirus-unemployed.html |
Airbnb Suspends Marketing to Save $800 Million, Top Executives Take Pay Cut: Source | Reuters | 2020-03-27T23:36:09+0000 | https://www.nytimes.com/reuters/2020/03/27/business/27reuters-airbnb-workforce.html |
Are You Pregnant and Concerned About Coronavirus? Tell Us Your Concerns. | The New York Times | 2020-03-27T23:30:55+0000 | https://www.nytimes.com/2020/03/27/us/are-you-pregnant-and-concerned-about-coronavirus-tell-us-your-concerns.html |
Has Coronavirus Affected Your Fertility Treatments? Tell Us Your Concerns. | The New York Times | 2020-03-27T23:14:30+0000 | https://www.nytimes.com/2020/03/27/us/has-coronavirus-affected-your-fertility-treatments-tell-us-your-concerns.html |
Special Episode: Jody’s Playlist | NA | 2020-03-27T23:08:07+0000 | https://www.nytimes.com/2020/03/27/podcasts/the-daily/coronavirus-music-quarantine.html |
John Sears, Strategist for Nixon and Reagan, Dies at 79 | Katharine Q. Seelye | 2020-03-27T23:01:05+0000 | https://www.nytimes.com/2020/03/27/us/politics/john-sears-dead.html |
Clubs Sell Community. Now Is the Time to Pay It Back. | Rory Smith | 2020-03-27T23:00:15+0000 | https://www.nytimes.com/2020/03/27/sports/soccer/soccer-coronavirus-rory-smith.html |
Trump Chooses Disaster as His Re-Election Strategy | Charlie Warzel | 2020-03-27T23:00:08+0000 | https://www.nytimes.com/2020/03/27/opinion/trump-coronavirus-response.html |
Let’s ‘Kick Coronavirus’s Ass’ | Maureen Dowd | 2020-03-27T22:37:07+0000 | https://www.nytimes.com/2020/03/27/opinion/sunday/cuomo-new-york-coronavirus.html |
Lucia Bosé, Whose Acting Was Interrupted by Marriage, Dies at 89 | Daniel E. Slotnik | 2020-03-27T22:33:21+0000 | https://www.nytimes.com/2020/03/27/movies/lucia-bose-dies.html |
More Americans Should Probably Wear Masks for Protection | Knvul Sheikh | 2020-03-27T22:31:56+0000 | https://www.nytimes.com/2020/03/27/health/us-coronavirus-face-masks.html |
New Rochelle, Once a Coronavirus Hot Spot, May Now Offer Hope | Sharon Otterman and Sarah Maslin Nir | 2020-03-27T22:31:42+0000 | https://www.nytimes.com/2020/03/27/nyregion/new-rochelle-coronavirus.html |
These Dogs Ooze Personal Style | Lovia Gyarkye and Bobby Doherty | 2020-03-27T22:30:10+0000 | https://www.nytimes.com/2020/03/27/magazine/dog-fashion-shoot.html |
Trump Boosts Virus Aid, Warns Governors to Be ‘Appreciative’ | The Associated Press | 2020-03-27T22:26:26+0000 | https://www.nytimes.com/aponline/2020/03/27/us/politics/ap-us-virus-outbreak-trump.html |
Sol Kerzner, South African Casino Tycoon, Is Dead at 84 | Alan Cowell | 2020-03-27T22:18:50+0000 | https://www.nytimes.com/2020/03/27/business/sol-kerzner-dead.html |
Stuart Gordon, Whose Films Reanimated Horror, Dies at 72 | Daniel E. Slotnik | 2020-03-27T22:14:02+0000 | https://www.nytimes.com/2020/03/27/movies/stuart-gordon-dies.html |
Shielding the Fetus From the Coronavirus | Apoorva Mandavilli | 2020-03-27T22:10:22+0000 | https://www.nytimes.com/2020/03/27/health/shielding-the-fetus-from-the-coronavirus.html |
Coronavirus, Stimulus, Yellowstone National Park: Your Friday Evening Briefing | Remy Tumin and Marcus Payadue | 2020-03-27T21:58:23+0000 | https://www.nytimes.com/2020/03/27/briefing/coronavirus-stimulus-yellowstone-national-park.html |
At Two Fashion Resale Warehouses, Workers Fear for Their Safety | Jessica Testa | 2020-03-27T21:38:47+0000 | https://www.nytimes.com/2020/03/27/style/realreal-warehouse-ecommerce-new-jersey.html |
Behind the Cover: Dark Tourism in Chernobyl | NA | 2020-03-27T21:33:24+0000 | https://www.nytimes.com/2020/03/27/magazine/behind-the-cover-dark-tourism-in-chernobyl.html |
NOT REAL NEWS: Debunking Yet More False Coronavirus Content | The Associated Press | 2020-03-27T21:05:27+0000 | https://www.nytimes.com/aponline/2020/03/27/us/ap-not-real-news.html |
It’s Too Late to Avoid Disaster, but There Are Still Things We Can Do | Michael T. Osterholm and Mark Olshaker | 2020-03-27T21:02:02+0000 | https://www.nytimes.com/2020/03/27/opinion/coronavirus-trump-testing-shortages.html |
Share Your Video: Acts of Kindness During the Coronavirus Outbreak | The New York Times | 2020-03-27T21:01:46+0000 | https://www.nytimes.com/2020/03/27/us/share-your-video-kindness-coronavirus-outbreak.html |
Prostitution Camp Provided Women in Human Smuggling Case | The Associated Press | 2020-03-27T20:56:09+0000 | https://www.nytimes.com/aponline/2020/03/27/us/ap-us-ex-official-adoption-fraud.html |
In Time of Quarantine, Zwirner Shares Online Platform With Smaller Galleries | Robin Pogrebin | 2020-03-27T20:55:43+0000 | https://www.nytimes.com/2020/03/27/arts/design/zwirner-online-galleries-covid.html |
Are You a Health Care Worker in the New York Area? Tell Us What You’re Seeing. | The New York Times | 2020-03-27T20:55:31+0000 | https://www.nytimes.com/2020/03/27/nyregion/coronavirus-nyc-health-care-workers.html |
What Is the Role of Criticism in a Crisis? | NA | 2020-03-27T20:44:04+0000 | https://www.nytimes.com/2020/03/27/arts/music/popcast-coronavirus-criticism.html |
A Heart Attack? No, It Was the Coronavirus | Gina Kolata | 2020-03-27T20:41:00+0000 | https://www.nytimes.com/2020/03/27/health/coronavirus-cardiac-heart-attacks.html |
Alan Finder, 72, Unflappable Newspaper Journalist, Dies | Sam Roberts | 2020-03-27T20:30:01+0000 | https://www.nytimes.com/2020/03/27/obituaries/alan-finder-dead-coronavirus.html |
Meadows Toggles Between Legislator, White House Roles | The Associated Press | 2020-03-27T20:23:27+0000 | https://www.nytimes.com/aponline/2020/03/27/us/politics/ap-us-virus-outbreak-chief-of-staff.html |
Dave Edwards, College Basketball Assist Wizard, Dies at 48 | Sam Roberts | 2020-03-27T20:22:53+0000 | https://www.nytimes.com/2020/03/27/obituaries/dave-edwards-dead-coronavirus.html |
Arnold Obey, 73, Educator and Marathoner, Dies | Frances Robles | 2020-03-27T20:21:12+0000 | https://www.nytimes.com/2020/03/27/obituaries/arnold-obey-dead-coronavirus.html |
What the Coronavirus Means for Climate Change | Meehan Crist | 2020-03-27T20:21:04+0000 | https://www.nytimes.com/2020/03/27/opinion/sunday/coronavirus-climate-change.html |
‘Why Can’t We Go to Chuck E. Cheese?’ | Michael Barbaro | 2020-03-27T20:20:33+0000 | https://www.nytimes.com/2020/03/27/podcasts/daily-newsletter-coronavirus-kids-quarantine.html |
A Florida Derby Day Like None Other Looms at Gulfstream Park | The Associated Press | 2020-03-27T19:38:45+0000 | https://www.nytimes.com/aponline/2020/03/27/sports/ap-rac-florida-derby-preview.html |
I Am Hospitalized With the Coronavirus | Jeremy Egner | 2020-03-27T19:34:29+0000 | https://www.nytimes.com/2020/03/27/sunday-review/coronavirus-hospitalized.html |
Desperate for Aid, Ukraine First Has to Fight Corruption | Andrew E. Kramer | 2020-03-27T19:28:42+0000 | https://www.nytimes.com/2020/03/27/world/europe/ukraine-foreign-aid-corruption.html |
It’s Time to Talk About Death | Sunita Puri, M.D | 2020-03-27T19:05:22+0000 | https://www.nytimes.com/2020/03/27/opinion/covid-end-of-life.html |
Housekeeping My Way Through the Pandemic | Jennifer Weiner | 2020-03-27T19:00:09+0000 | https://www.nytimes.com/2020/03/27/opinion/coronavirus-housecleaning.html |
How to Care for Someone With Coronavirus | The New York Times | 2020-03-27T18:49:18+0000 | https://www.nytimes.com/video/well/100000007058773/how-to-care-for-someone-with-coronavirus.html |
As shown in the table above, I was able to make specific requests to the NYT API containing a query for the newest articles. Then, I parsed the JSON responses and extracted my information of interest: headlines, authors, publication date, and web url. I tidyed and transformed the data to clean up the author column and split the publication date into year, month and day for further filtering.