Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including pr0gramm-api-2 with all npm packages installed. Try it out:

var pr0grammApi2 = require("pr0gramm-api-2")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

pr0gramm-api-2 v2.0.0

Node.js pr0gramm API

pr0gramm-api

A Node.js API for pr0gramm written in TypeScript.

npm install -S pr0gramm-api

Usage

import { Pr0grammAPI, ItemFlags } from "pr0gramm-api";

const api = Pr0grammAPI.createWithCookies();

async function main() {
    let mainItems = await api.items.getItems({
        promoted: true,
        flags: ItemFlags.All
    });
    console.dir(mainItems.items);

    let loginResponse = await api.user.login("cha0s", "stahl0fen80");
    if(!loginResponse.success) {
        console.log("Could not log in :(");
        if(loginResponse.ban !== null) {
            console.log("You are banned. Reason:");
            console.log(loginResponse.ban.reason);
            return;
        }
    }
}
main();

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free