Giter Club home page Giter Club logo

nytimes's Introduction

Travis build status AppVeyor build status

nytimes

The goal of nytimes is to integrate all of the New York Times API with R.

Installation

#install.packages("remotes")
remotes::install_github("news-r/nytimes")

APIs

Setup

First, create an account to obtain an API key. Then either specify the aforementioned key using nytimes_key or specify it as environment variable (likely in your .Renviron) as NYTIMES_API_KEY.

library(nytimes)

nytimes_key("xXxxX")

Examples

The archive API.

library(nytimes)

# get all articles from January first 2018
archive <- ny_archive(2018, 1)
#> ℹ 6903 results returned

The article search API.

# get all articles on Obama that have been published in the last 3 days, get three pages of results
obama <- ny_search("Obama", since = Sys.Date() - 3, pages = 3)
#> ℹ 49 results available
#> 
  downloading [=======================================] 100%

The books API

# get data on a random book
books <- ny_book_names()
#> ℹ 55 results returned
list <- ny_book_list(sample(books$list_name_encoded, 1))
#> ℹ 10 results returned

The most popular API

# get most viewed articles in the last 7 days
viewed <- ny_popular_viewed(7)
#> ℹ 1716 results returned

The movie review API

# get 2 pages of movie reviews on war
reviews <- ny_movie_search("war", pages = 2)
#> ⚠ More results available

The semantic API

# get 2 pages of movie reviews on war
concepts <- ny_semantic_search("war")
#> ℹ 500 results available
#> ⚠ More results available

Times tags API

ny_tags("Trump", max = 6)
#> [1] "Trump, Donald J (Per)"    "Trump Organization (Org)"
#> [3] "Trump, Ivanka (Per)"      "Trump, Melania (Per)"    
#> [5] "Trump, Donald J Jr (Per)" "Wallace, George C (Per)"

Top stories API

business <- ny_stories("business")

Times wire API

sections <- ny_wire_section_list()
wires <- ny_wire_source(sample(sections$section, 1))
#> ℹ 3298 results available

nytimes's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.