A Node.js wrapper for The New York Times Top Stories API v1.
npm install nyt-top
var nytTop = require('nyt-top');
nytTop.key('api key'); // set your Top Stories API developer key
nytTop.section('home', function (err, data) {
if (err) { console.log(err); } else {
var results = data.results;
for (var i = 0; i < 10; i++) { // top ten most recent stories
console.log(results[i].title);
}
}
});
Sets developer API key.
Type: string
NYT's Top Stories API key.
Get a list of articles
Type: string
NYT's article section.
Type: function
Returns a list of articles in JSON format.
List of section values:
- home
- world
- national
- politics
- nyregion
- business
- opinion
- technology
- science
- health
- sports
- arts
- fashion
- dining
- travel
- magazine
- realestate
- Visit http://developer.nytimes.com/docs/read/top_stories_api for more information about the official API.