How to use snoowrap - 3 common examples

To help you get started, we’ve selected a few snoowrap examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github MayorMonty / Snoostorm / example.ts View on Github external
import {
  InboxStream,
  CommentStream,
  SubmissionStream,
  ModMailStream
} from "./src/main";
import Snoowrap from "snoowrap";

const creds = require("./credentials.json");

// Create snoowrap object
const r = new Snoowrap(creds);

// Modmail test
const modmail = new ModMailStream(r, {});
modmail.on("item", console.log);
github ififfy / flipflip / src / renderer / data / actions.ts View on Github external
// Loop until we run out of blogs
        setTimeout(redditImportLoop, 1500);
        state.progressNext = subscriptionListing[subscriptionListing.length - 1].name;
        state.progressCurrent = state.progressCurrent + 1;
        setState({progressNext: state.progressNext, progressCurrent: state.progressCurrent});
      }
    }).catch((err: any) => {
      console.error(err);
      setState({systemMessage: "Error retrieving subscriptions: " + err, progressMode: null, progressNext: null, progressCurrent: 0});
    });
  };

  const state = getState();
  if (!state.progressMode) {
    reddit = new Snoowrap({
      userAgent: state.config.remoteSettings.redditUserAgent,
      clientId: state.config.remoteSettings.redditClientID,
      clientSecret: "",
      refreshToken: state.config.remoteSettings.redditRefreshToken,
    });

    // Show progress bar and kick off loop
    state.progressMode = PR.reddit;
    state.progressCurrent = 0;
    setState({
      systemSnack: "Your Reddit subscriptions are being imported... You will recieve an alert when the import is finished.",
      progressMode: state.progressMode, progressCurrent: state.progressCurrent
    });
    redditImportLoop();
  }
}
github ififfy / flipflip / src / renderer / components / player / SourceScraper.tsx View on Github external
return new CancelablePromise((resolve) => {
      const reddit = new Snoowrap({
        userAgent: config.remoteSettings.redditUserAgent,
        clientId: config.remoteSettings.redditClientID,
        clientSecret: "",
        refreshToken: config.remoteSettings.redditRefreshToken,
      });
      if (url.includes("/r/")) {
        reddit.getSubreddit(getFileGroup(url)).getHot({after: helpers.next})
          .then((submissionListing: any) => {
            if (submissionListing.length > 0) {
              let convertedListing = Array();
              let convertedCount = 0;
              for (let s of submissionListing) {
                convertURL(s.url).then((urls: Array) => {
                  convertedListing = convertedListing.concat(urls);
                  convertedCount++;
                  if (convertedCount == submissionListing.length) {

snoowrap

A JavaScript wrapper for the reddit API

MIT
Latest version published 4 years ago

Package Health Score

47 / 100
Full package analysis

Popular snoowrap functions