Skip to content

ShaunLWM/9gag.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

9 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

9GAG.js

npm "Monthly Download" MIT license

The simplest 9Gag API you've ever met.

Installation

node install 9gag.js
yarn add 9gag.js

Usage

Look in example.js for more information

const NineGag = require("9gag.js")
(async () => {
    // Fetch the first page of the hot section
    let hot = await NineGag.getType({ type: "hot" });
    console.log(hot["posts"]);
})();

Methods

getType({ type = "hot", cursor = "", simplified = false })

Returns { posts: [...], cursor: "..." }

  • Returns an object with an array of posts and a cursor. type can be "hot", "trending" or "fresh", cursor value is found in the cursor value of the returned results. simplified = true returns only necessary values.

getComments({ id = "", orderKey = "", simplified = false })

Returns [...]

  • Returns an array of comments. id is the post unique id. orderKey allows pagination where the value can be found in the orderKey of each comment result. simplified = true returns only necessary values.

License

MIT - Shaun (2019)