A Node.js wrapper for New York Times' API.
var nyt = require('newyorktimes')(keys);
- Article Search
- Best Sellers
- Campaign Finance
- Community
- Congress
- Districts
- Event Listings
- Geographic
- Most Popular
- Movie Reviews
- Real Estate
- Semantic
- Times Newswire
- Timestags
Search Times articles from 1851 to today, retrieving headlines, abstracts and links to associated multimedia.
Get data from all New York Times best-seller lists, including rank history for specific best sellers.
Get presidential campaign contribution and expenditure data based on United States Federal Election Commission filings.
Get comments by NYTimes.com users.
Get U.S. Congressional vote data, including information about specific House and Senate members.
Get political districts based on a pair of coordinates. Currently, the Districts API is limited to New York City.
Get information about hand-picked events in New York City and the surrounding area.
Use linked data to enhance location concepts used in The New York Times' controlled vocabulary.
Get links and metadata for the blog posts and articles that are most frequently e-mailed, shared and viewed by NYTimes.com readers.
Get links to reviews and NYT Critics' Picks, and search movie reviews by keyword.
Get aggregate data for real estate listings and sales in New York City.
Get access to the people, places, organizations and descriptors that make up the controlled vocabulary used as metadata by The New York Times.
Get links and metadata for Times articles in an up-to-the-minute stream.
Get standardized terms that match your search query, and filter by Times dictionaries.
- Reqest an API key: http://developer.nytimes.com/apps/register
- View your keys at: http://developer.nytimes.com/apps/myapps
- Create a file
.env
and format environment file with keys as intest.js
- Follow the example
Call the API url directly without needing to add the API key.
var keys = {
article_search: 'API_KEY',
best_sellers: 'API_KEY',
campaign_finance: 'API_KEY',
community: 'API_KEY',
congress: 'API_KEY',
districts: 'API_KEY',
event_listings: 'API_KEY',
geo: 'API_KEY',
most_popular: 'API_KEY',
movie_reviews: 'API_KEY',
real_estate: 'API_KEY',
semantic: 'API_KEY',
times_newswire: 'API_KEY',
timestags: 'API_KEY'
};
var nyt = require('newyorktimes')(keys);
nyt.query('http://api.nytimes.com/svc/semantic/v2/geocodes/query.json?country_code=US', function (err, json) {
console.log(json);
});
Note: HTTPS works as well.
Run tests with
npm test