Gathering detailed insights and metrics for pr0gramm-api
Gathering detailed insights and metrics for pr0gramm-api
Gathering detailed insights and metrics for pr0gramm-api
Gathering detailed insights and metrics for pr0gramm-api
npm install pr0gramm-api
Typescript
Module System
Min. Node Version
Node Version
NPM Version
66.3
Supply Chain
98.5
Quality
75.9
Maintenance
100
Vulnerability
80.6
License
TypeScript (100%)
Total Downloads
11,589
Last Day
5
Last Week
14
Last Month
138
Last Year
1,348
20 Stars
294 Commits
2 Forks
3 Watching
2 Branches
3 Contributors
Minified
Minified + Gzipped
Latest Version
4.2.1
Package Id
pr0gramm-api@4.2.1
Unpacked Size
84.85 kB
Size
23.82 kB
File Count
25
NPM Version
9.8.0
Node Version
20.5.0
Publised On
22 Jul 2023
Cumulative downloads
Total Downloads
Last day
150%
5
Compared to previous day
Last week
-69.6%
14
Compared to previous week
Last month
58.6%
138
Compared to previous month
Last year
-39.2%
1,348
Compared to previous year
2
3
A Node.js API for pr0gramm written in TypeScript.
1npm install -S pr0gramm-api
Login with username/password:
1import { Pr0grammAPI, NodeRequester, ItemFlags } from "pr0gramm-api"; 2 3main(); 4async function main() { 5 const requester = NodeRequester.create(); 6 // When using this library in the browser, use this requester: 7 // const requester = BrowserRequester.create(); 8 9 const api = Pr0grammAPI.create(requester); 10 11 const mainItems = await api.items.getItems({ 12 promoted: true, 13 flags: ItemFlags.SFW 14 }); 15 16 console.log(mainItems.items); 17 18 const captchaData = await api.user.requestCaptcha(); 19 // captchaData.captcha contains the image as a data URI 20 21 const loginResponse = await api.user.login("cha0s", "stahl0fen80", captchaData.token, "aaaaa"); 22 if(!loginResponse.success) { 23 console.log("Could not log in :("); 24 if(loginResponse.ban !== null) { 25 console.log("You are banned. Reason:"); 26 console.log(loginResponse.ban.reason); 27 return; 28 } 29 } 30}
Login with oAuth:
1import * as readline from "node:readline/promises";
2import { AuthorizationCode } from "simple-oauth2";
3import { Pr0grammAPI, NodeRequester, ItemFlags } from "pr0gramm-api";
4
5const oAuthAccessCodeClient = new AuthorizationCode({
6 client: {
7 // See above
8 id: "<client_id>",
9 secret: "<client_secret>",
10 },
11 auth: {
12 tokenHost: "https://pr0gramm.com/",
13 tokenPath: "/api/oauth/createAccessToken",
14 authorizePath: "/oauth/authorize",
15 }
16});
17
18main();
19async function main() {
20 const authorizationUri = oAuthAccessCodeClient.authorizeURL({
21 redirect_uri: authCallbackUrl,
22 scope: "items.get",
23 state: "<state>",
24 });
25
26 console.log("Go to this URL and enter the auth code from ?code=<auth code> from the callback URL:");
27 console.log(authorizationUri);
28
29 const rl = readline.createInterface({
30 input: process.stdin,
31 output: process.stdin,
32 });
33 const authCode = await rl.question("Auth-Code: ");
34 rl.close();
35
36 const tokenHandler = await oAuthAccessCodeClient.getToken({
37 code: authCode,
38 });
39
40 const requester = NodeRequester.create();
41 requester.setOAuthAccessToken(tokenHandler.token.access_token);
42
43 const api = Pr0grammAPI.create(requester);
44
45 const mainItems = await api.items.getItems({
46 promoted: true,
47 flags: ItemFlags.All
48 });
49
50 console.log(mainItems.items);
51}
The item stream requires you to call the next page of elements. Because it is a common operation to just walk over all items in the stream, there is a stream walker api for convenience:
1import { Pr0grammAPI, NodeRequester, ItemFlags } from "pr0gramm-api"; 2 3main(); 4async function main() { 5 const api = Pr0grammAPI.create(NodeRequester.create()); 6 7 // Create a walker that iterates through the entire stream of elements 8 // starting at item 0, going upwards 9 const itemStream = api.items.walkStreamNewer({ 10 newer: 0, 11 flags: ItemFlags.SFW, 12 promoted: false, 13 }); 14 15 // Asynchronous iteration over all items on pr0gramm 16 // automatically requests next items 17 for await (const item of itemStream) { 18 console.log(item.id + ": " + item.user); 19 } 20}
Important:
--harmony
flag. To use this API, you need to start node with --harmony
."esnext.asynciterable"
and "es6"
in your lib
entry in tsconfig.json
.const { Pr0grammAPI, ItemFlags } = require("pr0gramm-api");
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
5 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 4
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More