The simplest 9Gag API you've ever met.
node install 9gag.js
yarn add 9gag.js
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"]);
})();
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 theorderKey
of each comment result.simplified = true
returns only necessary values.
MIT - Shaun (2019)