9gag-feed

1.0.0 • Public • Published

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]
}
*/
 

Readme

Keywords

Package Sidebar

Install

npm i 9gag-feed

Weekly Downloads

8

Version

1.0.0

License

ISC

Last publish

Collaborators

  • mquintal