9gag-feed 中文文档教程
9gag-feed
Description
加载 9gag 提要。
Installation
此包在 [npm][npm-url] 上可用:9gag-feed
npm install 9gag-feed --save
Test
npm run test
Usage
语法: list ( [isParsedObject], [
lastItemId
], [isParsedObject
] )
返回包含 10 个帖子的 promise
Arguments
isParsedObject
Boolean (optional) If set, the provied list of posts will be parsed objects. If not, the provied list of post will be Item objects.lastItemId
Sring (optional) Must the last item ID loaded. If not set it load the first ten 9gag posts.
< strong>语法: get ( itemId
, [isParsedObject
] )
返回承诺包含 10 个帖子的提要
Arguments
lastItemId
String Must be the item ID (form 9gag post)isParsedObject
Boolean (optional) If set, the provied the post will be an parsed object. If not, the post will be an Item object.
返回带有帖子数据的承诺
示例:
使用 get 方法
var gagFeed = require('9gag-feed');
gagFeed.get( 'xxxxx' ).then( console.log )
// OUTPUT
/*
{
data: {
getId: [Function: getId],
getCaption: [Function: getCaption],
getImages: [Function: getImages],
getLink: [Function: getLink],
getVotes: [Function: getVotes],
getComments: [Function: getComments],
parse: [Function: parse]
}
}
*/
gagFeed.get( 'xxxxx', true ).then( console.log )
// OUTPUT
/*
{
data: {
getId: [String],
getCaption: [String],
getImages: [Object],
getLink: [String],
getVotes: [Object],
getComments: [Object],
parse: [Object]
}
}
*/
使用 list 方法
var gagFeed = require('9gag-feed');
gagFeed.list( true ).then( console.log )
// OUTPUT
/*
{
data: [
{
getId: [String],
getCaption: [String],
getImages: [Object],
getLink: [String],
getVotes: [Object],
getComments: [Object],
parse: [Object]
}
],
lastId: [String]
}
*/
gagFeed.list( 'xxxxx', true ).then( console.log )
// OUTPUT
/*
{
data: [
{
getId: [String],
getCaption: [String],
getImages: [Object],
getLink: [String],
getVotes: [Object],
getComments: [Object],
parse: [Object]
},
.....
],
lastId: [String]
}
*/
gagFeed.list( 'xxxxx' ).then( console.log )
// OUTPUT
/*
{
data: [
{
getId: [Function: getId],
getCaption: [Function: getCaption],
getImages: [Function: getImages],
getLink: [Function: getLink],
getVotes: [Function: getVotes],
getComments: [Function: getComments],
parse: [Function: parse]
},
...
],
lastId: [String]
}
*/
9gag-feed
Description
Loads 9gag feeds.
Installation
This package is available on [npm][npm-url] as: 9gag-feed
npm install 9gag-feed --save
Test
npm run test
Usage
Syntax: list ( [isParsedObject
], [lastItemId
], [isParsedObject
] )
Return a promise with a feed of ten post
Arguments
isParsedObject
Boolean (optional) If set, the provied list of posts will be parsed objects. If not, the provied list of post will be Item objects.lastItemId
Sring (optional) Must the last item ID loaded. If not set it load the first ten 9gag posts.
Syntax: get ( itemId
, [isParsedObject
] )
Return a promise with a feed of ten posts
Arguments
lastItemId
String Must be the item ID (form 9gag post)isParsedObject
Boolean (optional) If set, the provied the post will be an parsed object. If not, the post will be an Item object.
Return a promise with a post data
Examples:
using get method
var gagFeed = require('9gag-feed');
gagFeed.get( 'xxxxx' ).then( console.log )
// OUTPUT
/*
{
data: {
getId: [Function: getId],
getCaption: [Function: getCaption],
getImages: [Function: getImages],
getLink: [Function: getLink],
getVotes: [Function: getVotes],
getComments: [Function: getComments],
parse: [Function: parse]
}
}
*/
gagFeed.get( 'xxxxx', true ).then( console.log )
// OUTPUT
/*
{
data: {
getId: [String],
getCaption: [String],
getImages: [Object],
getLink: [String],
getVotes: [Object],
getComments: [Object],
parse: [Object]
}
}
*/
using list method
var gagFeed = require('9gag-feed');
gagFeed.list( true ).then( console.log )
// OUTPUT
/*
{
data: [
{
getId: [String],
getCaption: [String],
getImages: [Object],
getLink: [String],
getVotes: [Object],
getComments: [Object],
parse: [Object]
}
],
lastId: [String]
}
*/
gagFeed.list( 'xxxxx', true ).then( console.log )
// OUTPUT
/*
{
data: [
{
getId: [String],
getCaption: [String],
getImages: [Object],
getLink: [String],
getVotes: [Object],
getComments: [Object],
parse: [Object]
},
.....
],
lastId: [String]
}
*/
gagFeed.list( 'xxxxx' ).then( console.log )
// OUTPUT
/*
{
data: [
{
getId: [Function: getId],
getCaption: [Function: getCaption],
getImages: [Function: getImages],
getLink: [Function: getLink],
getVotes: [Function: getVotes],
getComments: [Function: getComments],
parse: [Function: parse]
},
...
],
lastId: [String]
}
*/