ts-newsapi
Client library (SDK) to quickly and easily get started with News API without worrying about the underlying set up
Fast and easy to use.
Written in TypeScript.
Fully tested with 100% code coverage.
Powered by newsapi
Installation
npm install --save ts-newsapi
Getting Started
import NewsAPI from 'ts-newsapi';
const newsAPI = new NewsAPI('api_key');
const sources = await newsAPI.getSources({
category: 'general',
language: 'en',
country: 'us',
});
const topHeadlines = await newsAPI.getTopHeadlines({
q: 'stocks',
country: 'us',
category: 'business',
pageSize: 20,
page: 1,
});
const headlines = await newsAPI.getEverything({
q: 'stocks',
qInTitle: 'stock',
sources: [ 'bbc-news' ],
language: 'en',
sortBy: 'relevancy',
pageSize: 20,
page: 1,
});
Tests
npm test
License
This project is licensed under the MIT License - see the LICENSE file for details.
Documentation
NewsAPI Documentation