Week 9 - Assignment - Web APIs (NY Times)

The New York Times web site provides a rich set of APIs, as described here.

You’ll need to start by signing up for an API key.

Your task 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.

Since Hallowe’en is in a few days, let’s look for articles on this topic

## [1] "data.frame"
##       [,1]              
##  [1,] "web_url"         
##  [2,] "snippet"         
##  [3,] "lead_paragraph"  
##  [4,] "abstract"        
##  [5,] "print_page"      
##  [6,] "source"          
##  [7,] "multimedia"      
##  [8,] "headline"        
##  [9,] "keywords"        
## [10,] "pub_date"        
## [11,] "document_type"   
## [12,] "news_desk"       
## [13,] "section_name"    
## [14,] "byline"          
## [15,] "type_of_material"
## [16,] "_id"             
## [17,] "word_count"      
## [18,] "uri"             
## [19,] "subsection_name"

There is a lot of data here, not all of it interesting…

pull snippet from NYT_docs

Snippet
1 “You’re in a community that is predominately black, yet you don’t know what the noose symbolizes?” a Brooklyn parent asked.
2 A brief history of wearing the zeitgeist, from the Rubik’s Cube to Minions.
3 The older, the better.
4 Medieval Frankenstein Castle has become a favorite haunt for Germans celebrating Halloween, a tradition that’s grown increasingly popular in continental Europe in recent years.
5 A Minnesota museum has turned its creepiest dolls loose just in time for Halloween.
6 Writers, directors and other creators share recommendations for how to spend the scariest night of the year.
7 Except for South Carolina’s stunning overtime win at Georgia, there haven’t been many results so far this season that figure to shape the College Football Playoffs standings.
8 Here’s what you need to know about the week’s top stories.
9 Hill rose through Hollywood’s ranks, setting an example as a successful Hollywood producer at a time when there were few women in the industry.
10 Jamie Lee Curtis returns for a final showdown in the “Halloween” reboot. And Allison Williams stars in a disturbing thriller on Netflix.

pull lead_paragraph from NYT_docs

Lead Paragraph
1 Depictions of children hanging from nooses were displayed across the street from an elementary school in Brooklyn. An empty noose swung from a home on Long Island. And in Rockland County, N.Y., three black pumpkins with white eyes, noses and mouths sat on the steps of a small law firm.
2 The high heels were on the move. Dozens of New York teachers marched through the streets of Greenwich Village on Oct. 31, 1986, wrapped in fabric stilettos, to cheers and applause. It was a perfectly timely costume: The ladies were dressed as the infamous footwear collection of the freshly ousted first lady of the Philippines, Imelda Marcos.
3 In 2015, there was Pizza Rat. In 2016, David S. Pumpkins. And in 2017? Offred from “The Handmaid’s Tale.” The pop-culture Halloween costume has been especially visible in recent years, but it has been around for much longer.
4 FRANKENSTEIN CASTLE, Germany — Medieval Frankenstein Castle has become a favorite haunt for Germans celebrating Halloween, a tradition that’s grown increasingly popular in continental Europe in recent years.
5 ROCHESTER, Minn. — A Minnesota museum has turned its creepiest dolls loose just in time for Halloween.
6 You’d think that Elvira, Mistress of the Dark, would have plenty of advice on how to spend Halloween. After all, she’s made a career out of highlighting the spooky and macabre.
7 Except for South Carolina’s stunning overtime win at Georgia, there haven’t been many results so far this season that figure to shape the College Football Playoffs standings.
8 (Want to get this briefing by email? Here’s the sign-up.)
9 Overlooked is a series of obituaries about remarkable people whose deaths, beginning in 1851, went unreported in The Times.
10 HALLOWEEN (2018) 8 p.m. on HBO; stream on HBO platforms. Forty years (and nine sequels and remakes) later, John Carpenter’s classic slasher film got yet another update, one that reprised Jamie Lee Curtis’s role as the baby sitter who survived a killing spree on Halloween night. Ignoring the narratives of the franchise’s other films, this reboot by David Gordon Green has our masked villain, Michael Myers (played by James Jude Courtney and the originating actor, Nick Castle), escape from a prison transfer and head straight back to Haddonfield. He’s out for Laurie, of course, who has become a paranoid, rabid grandmother with a fortress for a house. Fans of the original know what to expect, and overall, they should be pleased with the gruesome result. “Green wants us to believe in his Bogeyman, and Curtis is his ace card,” Jeannette Catsoulis wrote in her New York Times review. “Leaving no room for winks or giggles, she makes Laurie’s long-festering terror the glue that holds the movie together.”

pull abstract from NYT_docs

Abstract
1 “You’re in a community that is predominately black, yet you don’t know what the noose symbolizes?” a Brooklyn parent asked.
2 A brief history of wearing the zeitgeist, from the Rubik’s Cube to Minions.
3 The older, the better.
4 Medieval Frankenstein Castle has become a favorite haunt for Germans celebrating Halloween, a tradition that’s grown increasingly popular in continental Europe in recent years.
5 A Minnesota museum has turned its creepiest dolls loose just in time for Halloween.
6 Writers, directors and other creators share recommendations for how to spend the scariest night of the year.
7 Except for South Carolina’s stunning overtime win at Georgia, there haven’t been many results so far this season that figure to shape the College Football Playoffs standings.
8 Here’s what you need to know about the week’s top stories.
9 Hill rose through Hollywood’s ranks, setting an example as a successful Hollywood producer at a time when there were few women in the industry.
10 Jamie Lee Curtis returns for a final showdown in the “Halloween” reboot. And Allison Williams stars in a disturbing thriller on Netflix.

fashion my own data frame

NYT_web_url NYT_snippet NYT_lead NYT_abstract
1 https://www.nytimes.com/2019/10/25/nyregion/nooses-blackface-halloween-decorations.html “You’re in a community that is predominately black, yet you don’t know what the noose symbolizes?” a Brooklyn parent asked. Depictions of children hanging from nooses were displayed across the street from an elementary school in Brooklyn. An empty noose swung from a home on Long Island. And in Rockland County, N.Y., three black pumpkins with white eyes, noses and mouths sat on the steps of a small law firm. “You’re in a community that is predominately black, yet you don’t know what the noose symbolizes?” a Brooklyn parent asked.
2 https://www.nytimes.com/2019/10/24/us/pop-culture-halloween-costumes.html A brief history of wearing the zeitgeist, from the Rubik’s Cube to Minions. The high heels were on the move. Dozens of New York teachers marched through the streets of Greenwich Village on Oct. 31, 1986, wrapped in fabric stilettos, to cheers and applause. It was a perfectly timely costume: The ladies were dressed as the infamous footwear collection of the freshly ousted first lady of the Philippines, Imelda Marcos. A brief history of wearing the zeitgeist, from the Rubik’s Cube to Minions.
3 https://www.nytimes.com/2019/10/11/reader-center/pop-culture-halloween-costume-submissions.html The older, the better. In 2015, there was Pizza Rat. In 2016, David S. Pumpkins. And in 2017? Offred from “The Handmaid’s Tale.” The pop-culture Halloween costume has been especially visible in recent years, but it has been around for much longer. The older, the better.
4 https://www.nytimes.com/aponline/2019/10/27/world/europe/ap-eu-germany-frankenstein-castle.html Medieval Frankenstein Castle has become a favorite haunt for Germans celebrating Halloween, a tradition that’s grown increasingly popular in continental Europe in recent years. FRANKENSTEIN CASTLE, Germany — Medieval Frankenstein Castle has become a favorite haunt for Germans celebrating Halloween, a tradition that’s grown increasingly popular in continental Europe in recent years. Medieval Frankenstein Castle has become a favorite haunt for Germans celebrating Halloween, a tradition that’s grown increasingly popular in continental Europe in recent years.
5 https://www.nytimes.com/aponline/2019/10/24/us/ap-us-creepy-dolls.html A Minnesota museum has turned its creepiest dolls loose just in time for Halloween. ROCHESTER, Minn. — A Minnesota museum has turned its creepiest dolls loose just in time for Halloween. A Minnesota museum has turned its creepiest dolls loose just in time for Halloween.
6 https://www.nytimes.com/2019/10/24/arts/halloween-tips-horror-enthusiasts.html Writers, directors and other creators share recommendations for how to spend the scariest night of the year. You’d think that Elvira, Mistress of the Dark, would have plenty of advice on how to spend Halloween. After all, she’s made a career out of highlighting the spooky and macabre. Writers, directors and other creators share recommendations for how to spend the scariest night of the year.
7 https://www.nytimes.com/aponline/2019/10/17/sports/ncaafootball/ap-fbc-pick-six-key-games.html Except for South Carolina’s stunning overtime win at Georgia, there haven’t been many results so far this season that figure to shape the College Football Playoffs standings. Except for South Carolina’s stunning overtime win at Georgia, there haven’t been many results so far this season that figure to shape the College Football Playoffs standings. Except for South Carolina’s stunning overtime win at Georgia, there haven’t been many results so far this season that figure to shape the College Football Playoffs standings.
8 https://www.nytimes.com/2019/10/27/briefing/impeachment-california-halloween.html Here’s what you need to know about the week’s top stories. (Want to get this briefing by email? Here’s the sign-up.) Here’s what you need to know about the week’s top stories.
9 https://www.nytimes.com/2019/05/22/obituaries/debra-hill-overlooked.html Hill rose through Hollywood’s ranks, setting an example as a successful Hollywood producer at a time when there were few women in the industry. Overlooked is a series of obituaries about remarkable people whose deaths, beginning in 1851, went unreported in The Times. Hill rose through Hollywood’s ranks, setting an example as a successful Hollywood producer at a time when there were few women in the industry.
10 https://www.nytimes.com/2019/05/25/arts/television/whats-on-tv-saturday-halloween-and-the-perfection.html Jamie Lee Curtis returns for a final showdown in the “Halloween” reboot. And Allison Williams stars in a disturbing thriller on Netflix. HALLOWEEN (2018) 8 p.m. on HBO; stream on HBO platforms. Forty years (and nine sequels and remakes) later, John Carpenter’s classic slasher film got yet another update, one that reprised Jamie Lee Curtis’s role as the baby sitter who survived a killing spree on Halloween night. Ignoring the narratives of the franchise’s other films, this reboot by David Gordon Green has our masked villain, Michael Myers (played by James Jude Courtney and the originating actor, Nick Castle), escape from a prison transfer and head straight back to Haddonfield. He’s out for Laurie, of course, who has become a paranoid, rabid grandmother with a fortress for a house. Fans of the original know what to expect, and overall, they should be pleased with the gruesome result. “Green wants us to believe in his Bogeyman, and Curtis is his ace card,” Jeannette Catsoulis wrote in her New York Times review. “Leaving no room for winks or giggles, she makes Laurie’s long-festering terror the glue that holds the movie together.” Jamie Lee Curtis returns for a final showdown in the “Halloween” reboot. And Allison Williams stars in a disturbing thriller on Netflix.