1.0.5 • Published 8 years ago

nyt-top v1.0.5

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

nyt-top (The Top Stories API)

A Node.js wrapper for The New York Times Top Stories API v1.

Installation

npm install nyt-top

Usage Example

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);
    }
  }
});

API

.key(apiKey)

Sets developer API key.

apiKey

Type: string

NYT's Top Stories API key.

.section(sectionName, callback)

Get a list of articles

sectionName

Type: string

NYT's article section.

callback(err, data)

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

Notes:

License

MIT

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

9 years ago

1.0.0

9 years ago