library(jsonlite)
library(stringr)
library(httr)
#Pull the key from local file and store in variable
source("NYT_API_key.R")
#The root of the NYT article search API
NYT_API_root <- "http://api.nytimes.com/svc/search/v2/articlesearch.json"
#To the root, add the query for keyword "science" and the api_key
API_request <- stringr::str_c(NYT_API_root,"?q=science&api-key=",NYT_API_key)
#Pull this information to a dataframe
Our_df <- jsonlite::fromJSON(API_request) %>% data.frame()
Display_df <- Our_df[c(3:6,12)]
Display_df
## response.docs.web_url
## 1 https://www.nytimes.com/2019/10/24/science/woodie-flowers-dead.html
## 2 https://www.nytimes.com/2019/06/19/us/julia-serano-gender-science-lgbtq.html
## 3 https://www.nytimes.com/2019/07/20/opinion/sunday/moon-rockets-space-fiction.html
## 4 https://www.nytimes.com/video/science/space/100000006757287/nobel-prize-physics.html
## 5 https://www.nytimes.com/2019/03/29/science/marshmallow-peeps-fungus.html
## 6 https://www.nytimes.com/reuters/2019/10/14/world/europe/14reuters-nobel-prize-physics.html
## 7 https://www.nytimes.com/reuters/2019/10/14/world/europe/14reuters-nobel-prize-economics.html
## 8 https://www.nytimes.com/reuters/2019/10/24/world/africa/24reuters-russia-rwanda-nuclear.html
## 9 https://www.nytimes.com/2019/05/04/science/escape-room-lab-physics.html
## 10 https://www.nytimes.com/2019/05/02/science/national-academy-sciences-sexual-harassment.html
## response.docs.snippet
## 1 His hands-on methods of teaching mechanical engineering at M.I.T. made him a star on campus (and on PBS) and led to student contests on a global scale.
## 2 A biologist and trans woman finds that sexuality and gender are rarely as straightforward
## 3 Neil Armstrong’s first small step owed more than you’d think to the footsteps of Jules Verne, H.G. Wells and Fritz Lang.
## 4 The cosmologist James Peebles split the Nobel Prize in Physics with the astronomers Michel Mayor and Didier Queloz. In accepting the prize, Dr. Peebles offered some guidance for young scientists.
## 5 A mycologist hopes to show how a simple, silly experiment can illuminate fungal biology.
## 6 U.S.-based economists Abhijit Banerjee, Esther Duflo and Michael Kremer won the 2019 Nobel Economics Prize on Monday for work fighting poverty that has helped millions of children by favoring practical steps over theory.
## 7 U.S.-based economists Abhijit Banerjee, Esther Duflo and Michael Kremer won the 2019 Nobel Economics Prize on Monday for work fighting poverty that has helped millions of children by favoring practical steps over theory.
## 8 Russian state atomic company Rosatom has signed a deal with Rwanda to build a center of nuclear science and technologies, the Russian company said on Thursday, as it seeks to expand in Africa.
## 9 A physicist at the University of Illinois devised an immersive game in which teams solve science puzzles to unlock a mystery — before it’s too late.
## 10 A preliminary vote by the National Academy of Sciences was the latest move to address discrimination against women in historically male-dominated science fields.
## response.docs.lead_paragraph
## 1 Woodie Flowers, an innovative and flamboyant mechanical engineering professor at M.I.T. (he liked to roller-blade and ride unicycles through its august halls) who championed a hands-on learning philosophy that reshaped engineering and design education and turned him into something of a celebrity, died on Oct. 11 in Boston. He was 75.
## 2 As part of our coverage of Pride Month, we asked 10 members of the L.G.B.T.Q. community to reflect on their experiences. Here is one of their responses. Scroll down for more.
## 3 Most major achievements, be they personal or collective, arrive after rehearsals. Some unfold as flights of the imagination. The 50th anniversary of the Apollo 11 moon landing provides a great opportunity to examine how an entire branch of speculative fiction — novels, short stories and also feature films — lies behind the first human footprints on another world.
## 4 The cosmologist James Peebles split the Nobel Prize in Physics with the astronomers Michel Mayor and Didier Queloz. In accepting the prize, Dr. Peebles offered some guidance for young scientists.
## 5 It’s science time in Candy Land.
## 6 STOCKHOLM — U.S.-based economists Abhijit Banerjee, Esther Duflo and Michael Kremer won the 2019 Nobel Economics Prize on Monday for work fighting poverty that has helped millions of children by favoring practical steps over theory.
## 7 STOCKHOLM — U.S.-based economists Abhijit Banerjee, Esther Duflo and Michael Kremer won the 2019 Nobel Economics Prize on Monday for work fighting poverty that has helped millions of children by favoring practical steps over theory.
## 8 MOSCOW — Russian state atomic company Rosatom has signed a deal with Rwanda to build a center of nuclear science and technologies, the Russian company said on Thursday, as it seeks to expand in Africa.
## 9 URBANA, Ill. — It was 10 p.m., and we were locked in a room at the mall.
## 10 The National Academy of Sciences moved this week toward a landmark shift in policy that would allow it for the first time to eject members who have violated its code of conduct, including in cases of sexual harassment.
## response.docs.abstract
## 1 His hands-on methods of teaching mechanical engineering at M.I.T. made him a star on campus (and on PBS) and led to student contests on a global scale.
## 2 A biologist and trans woman finds that sexuality and gender are rarely as straightforward
## 3 Neil Armstrong’s first small step owed more than you’d think to the footsteps of Jules Verne, H.G. Wells and Fritz Lang.
## 4 The cosmologist James Peebles split the Nobel Prize in Physics with the astronomers Michel Mayor and Didier Queloz. In accepting the prize, Dr. Peebles offered some guidance for young scientists.
## 5 A mycologist hopes to show how a simple, silly experiment can illuminate fungal biology.
## 6 U.S.-based economists Abhijit Banerjee, Esther Duflo and Michael Kremer won the 2019 Nobel Economics Prize on Monday for work fighting poverty that has helped millions of children by favoring practical steps over theory.
## 7 U.S.-based economists Abhijit Banerjee, Esther Duflo and Michael Kremer won the 2019 Nobel Economics Prize on Monday for work fighting poverty that has helped millions of children by favoring practical steps over theory.
## 8 Russian state atomic company Rosatom has signed a deal with Rwanda to build a center of nuclear science and technologies, the Russian company said on Thursday, as it seeks to expand in Africa.
## 9 A physicist at the University of Illinois devised an immersive game in which teams solve science puzzles to unlock a mystery — before it’s too late.
## 10 A preliminary vote by the National Academy of Sciences was the latest move to address discrimination against women in historically male-dominated science fields.
## response.docs.pub_date
## 1 2019-10-24T21:24:34+0000
## 2 2019-06-19T18:02:36+0000
## 3 2019-07-20T14:21:07+0000
## 4 2019-10-08T14:51:49+0000
## 5 2019-03-29T15:35:37+0000
## 6 2019-10-14T17:57:59+0000
## 7 2019-10-14T21:33:57+0000
## 8 2019-10-24T19:26:51+0000
## 9 2019-05-04T09:00:14+0000
## 10 2019-05-02T20:27:35+0000