GithubHelp home page GithubHelp logo

oliviathevampire / reddit.images Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sujalgoel/reddit.images

0.0 0.0 0.0 25 KB

A npm package for fetching images from reddit.

License: GNU General Public License v3.0

JavaScript 100.00%

reddit.images's Introduction

Reddit Image

Reddit Images

Version License: GPL-3.0

What is this package?

A npm package for fetching images and userinfo from reddit.

Install the package πŸ“₯

npm i reddit.images

Example ✏️

FetchRandomMeme example
const { reddit } = require("reddit.images");

reddit.FetchRandomMeme("hot").then((data) => {
  console.log(data);
});

Example Response

{
  "id": "nkbnhb",
  "type": "hot",
  "title": "Invest in Derek Savage",
  "author": "ilovenomar5",
  "postLink": "https://redd.it/nkbnhb",
  "image": "https://www.reddit.com/gallery/nkbnhb",
  "text": "",
  "thumbnail": "https://b.thumbs.redditmedia.com/JmgbVSW4mRAvXyDL6zR4mWsMnvphEweFYm2IsK-1oOQ.jpg",
  "subreddit": "MemeEconomy",
  "NSFW": false,
  "spoiler": false,
  "createdUtc": 1621899556,
  "upvotes": 7,
  "downvotes": 0,
  "upvoteRatio": 0.78
}
FetchSubredditPost example
const { reddit } = require("reddit.images");

reddit.FetchSubredditPost("xkcd", "rising").then((data) => {
  console.log(data);
});

Example Response

{
  "id": "na6f17",
  "type": "rising",
  "title": "Need a help finding xkcd",
  "author": "rtsrp3f",
  "postLink": "https://redd.it/na6f17",
  "image": "https://www.reddit.com/r/xkcd/comments/na6f17/need_a_help_finding_xkcd/",
  "text": "I believe there is an xkcd showing how one guy updating certain program keeps whole internet alive. Is it an xkcd and if it is, can somebody help me find it",
  "thumbnail": "self",
  "subreddit": "xkcd",
  "NSFW": false,
  "spoiler": false,
  "createdUtc": 1620763840,
  "upvotes": 27,
  "downvotes": 0,
  "upvoteRatio": 0.84
}
FetchPostbyID example
const { reddit } = require("reddit.images");

reddit.FetchPostbyID("nwccti").then((data) => {
  console.log(data);
});

Example Response

{
  "id": "nwccti",
  "title": "No mad, I’m quite amazed, actually.",
  "author": "I_Spit_In_Your_Food",
  "postLink": "https://redd.it/nwccti",
  "image": "https://i.redd.it/rm2xzvfuic471.jpg",
  "text": "",
  "thumbnail": "https://b.thumbs.redditmedia.com/6Dlt90LpANPZNnxcmmgp30VEmvxwMuVmODUDXIn7Cro.jpg",
  "subreddit": "memes",
  "NSFW": false,
  "spoiler": false,
  "createdUtc": 1623290595,
  "upvotes": 21771,
  "downvotes": 0,
  "upvoteRatio": 0.93
}
FetchRandomPost example
const { reddit } = require("reddit.images");

reddit.FetchRandomPost("new").then((data) => {
  console.log(data);
});

Example Response

{
  "id": "nwfyhe",
  "type": "new",
  "title": "23[F4M][KIK][emma0y] My very first nudes on Reddit, hope I won't regret, upvt I will 100% send more. Add me on KIK :emma0y",
  "author": "Alternative-Sun5080",
  "postLink": "https://redd.it/nwfyhe",
  "image": "https://www.reddit.com/gallery/nwfyhe",
  "text": "",
  "thumbnail": "nsfw",
  "subreddit": "Ratemypussy",
  "NSFW": true,
  "spoiler": false,
  "createdUtc": 1623303013,
  "upvotes": 1,
  "downvotes": 0,
  "upvoteRatio": 1
}
FetchPost example
const { reddit } = require("reddit.images");

reddit.FetchPost("top").then((data) => {
  console.log(data);
});

Example Response

{
  "id": "nvtw8w",
  "type": "top",
  "title": "Idiot cop flips pregnant woman's car for pulling over too slowly.",
  "author": "Valkie",
  "postLink": "https://redd.it/nvtw8w",
  "image": "https://v.redd.it/8qsrjkpv88471",
  "text": "",
  "thumbnail": "https://b.thumbs.redditmedia.com/FfYFHszBHI1G3-S470CP1BSpELk579uQ1egfquSqsWg.jpg",
  "subreddit": "IdiotsInCars",
  "NSFW": false,
  "spoiler": false,
  "createdUtc": 1623239476,
  "upvotes": 110650,
  "downvotes": 0,
  "upvoteRatio": 0.8
}
FetchRedditUserInfo example
const { reddit } = require("reddit.images");

reddit.FetchRedditUserInfo("reddit", 10).then((data) => {
  console.log(data);
});

Example Response

{
   "id":"1qwk",
   "name":"reddit",
   "title":"",
   "description":"",
   "url":"https://reddit/user/reddit/",
   "karma":6304377,
   "cakeday":"Fri Dec 09 2005 10:30:00 GMT+0530 (India Standard Time)",
   "avatar":"https://styles.redditmedia.com/t5_hv5dz/styles/profileIcon_snoo8658e16c-55fa-486f-b7c7-00726de2e742-headshot.png?width=256&height=256&crop=256:256,smart&s=f61c0e3ac1a1d9357c21086feb78943c31d19d37",
   "snoovatar":"https://i.redd.it/snoovatar/snoovatars/8658e16c-55fa-486f-b7c7-00726de2e742.png",
   "banner":null,
   "NSFW":false,
   "verified":true,
   "golduser":true,
   "moderator":true,
   "quarantine":false,
   "comments":[
      {
         "comment":"oh my gosh, adorable. this is why I love reddit! <3",
         "post":"https://www.reddit.com/r/trendingsubreddits/comments/nvmqad/trending_subreddits_for_20210609_rblop/"
      },
      {
         "comment":"Y'all ready for this? We’re live!",
         "post":"https://www.reddit.com/r/XboxSeriesX/comments/nwdd4e/will_an_automobile_be_brought_on_stage_during_the/"
      },
      {
         "comment":"\r\n""+""Verily, it has come to pass.  The humble server known as one of our servers is now named KronkStonks.\r\n""+""\r\n",
         "post":"https://www.reddit.com/r/nameaserver/comments/nvidvd/mon_20210607/"
      },
      {
         "comment":"I am the walrus",
         "post":"https://www.reddit.com/r/trendingsubreddits/comments/nvmqad/trending_subreddits_for_20210609_rblop/"
      },
      {
         "comment":"Pepperidge Farm remembers",
         "post":"https://www.reddit.com/r/trendingsubreddits/comments/nvmqad/trending_subreddits_for_20210609_rblop/"
      },
      {
         "comment":"thank you, puppies are forever.",
         "post":"https://www.reddit.com/r/trendingsubreddits/comments/nvmqad/trending_subreddits_for_20210609_rblop/"
      },
      {
         "comment":"sploot!",
         "post":"https://www.reddit.com/r/trendingsubreddits/comments/nvmqad/trending_subreddits_for_20210609_rblop/"
      },
      {
         "comment":"Redditors, I think this is the beginning of a beautiful prediction",
         "post":"https://www.reddit.com/r/pennystocks/comments/nw6fei/which_of_these_otcs_will_have_the_highest_gain_by/"
      },
      {
         "comment":"Whoomp! There it is! Play has begun.",
         "post":"https://www.reddit.com/r/pennystocks/comments/nw68ut/which_of_these_otcs_will_have_the_highest_gain/"
      },
      {
         "comment":"Whoomp! There it is! Play has begun.",
         "post":"https://www.reddit.com/r/ufc/comments/nw5zoh/winner_of/"
      }
   ],
   "submitted":[
      {
         "post":"https://reddit.com/r/trendingsubreddits/comments/nweils/trending_subreddits_for_20210610_rspreadytoes/"
      },
      {
         "post":"https://reddit.com/r/nameaserver/comments/nwa19n/tue_20210608/"
      },
      {
         "post":"https://reddit.com/r/trendingsubreddits/comments/nvmqad/trending_subreddits_for_20210609_rblop/"
      },
      {
         "post":"https://reddit.com/r/trendingsubreddits/comments/nuvogj/trending_subreddits_for_20210607_rnotinteresting/"
      },
      {
         "post":"https://reddit.com/r/nameaserver/comments/nvidvd/mon_20210607/"
      },
      {
         "post":"https://reddit.com/r/trendingsubreddits/comments/nu3fsm/trending_subreddits_for_20210607_rlagerfeuer/"
      },
      {
         "post":"https://reddit.com/r/trendingsubreddits/comments/ntd22v/trending_subreddits_for_20210606_rmahlzeitvideos/"
      },
      {
         "post":"https://reddit.com/r/trendingsubreddits/comments/nsn61c/trending_subreddits_for_20210605_rpcbaumeister/"
      },
      {
         "post":"https://reddit.com/r/nameaserver/comments/nsj19n/thu_20210603/"
      },
      {
         "post":"https://reddit.com/r/trendingsubreddits/comments/nrw5hs/trending_subreddits_for_20210604_rfussball/"
      }
   ]
}

Contributing 🀝

  • Contributions, issues and feature requests are welcome!
  • Feel free to check issues page.

Author πŸ’–

Copyright Β© 2021 Sujal Goel πŸ‘€

reddit.images's People

Contributors

sujalgoel avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.