News SDK for Node.js
$ npm install shuwen-news-nodejs-sdk --save
Node.js >= 6.11.3
- accessKey:应用 accessKey;
- secretKey:应用 secretKey;
- endpoint:接口地址,默认为
http://api.xinwen.cn
;
const Client = require('shuwen-news-nodejs-sdk');
const client = new Client({
accessKey: '<accessKey>',
secretKey: '<secretKey>',
endpoint: '<endpoint>',
});
// => returns Promise
// client.getCategory(query, options);
client.getCategory();
// co/yield, async/await
- 参数说明:
-
query
- 请求参数,对象形式 -
options
- urllib 请求选项,详情参考:https://www.npmjs.com/package/urllib
-
获得新闻的分类
获得所有新闻
获得重大新闻
获得热门新闻
搜索新闻