Skip to content

Commit c4ce0a8

Browse files
authored
Merge pull request #31 from Axiver/develop
Fix broken scraper module
2 parents 8552c11 + fe523e5 commit c4ce0a8

File tree

4 files changed

+381
-40
lines changed

4 files changed

+381
-40
lines changed

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22

33
Don't you ever want to become the enemy of the people? [reddits-nightmare](https://github.com/Garlicvideos/reddits-nightmare) is a bot that downloads any post from any subreddit, along with the post's title, and reuploads it to Instagram, causing massive havoc and ruins relationships once your close friends or families find out.
44

5-
6-
### The reddit scraping module is currently broken
7-
After reddit's API changes, the `reddit-snooper` package that the bot depends on is currently broken. As that package is no longer maintained by its original author, I will need to fork it and work on a fix, which would take a long time. Until then, you will have to manually download the posts from reddit and place them in `/assets/images/approved`. The bot will then upload the images to Instagram as usual.
8-
95
## Getting started
106

117
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See Installing for notes on how to deploy the project on a live system.

bot/libs/redditSnooper.js

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -197,30 +197,29 @@ async function snoopReddit() {
197197
//Reformat the subreddit list
198198
const subreddits = await stringSubreddits();
199199

200-
// This has been commented out as reddit-snooper was broken by the reddit API changes
201200
//Begins snooping
202-
// snooper.watcher
203-
// .getListingWatcher(subreddits, options)
204-
// .on("item", (item) => {
205-
// //If post is a image and has a supported file format
206-
// if ((item.kind = "t3" && isImage(item.data.url))) {
207-
// //Retrieves information about the post
208-
// const postUrl = item.data.url;
209-
// const postTitle = item.data.title;
210-
// const postID = item.data.id;
211-
// const nsfw = item.data.over_18;
212-
213-
// //Downloads the post
214-
// download(postUrl, postTitle, nsfw);
215-
// }
216-
// })
217-
// .on("error", (err) => {
218-
// logger.error(`Unable to scrape reddit: `, err);
219-
// });
220-
221-
logger.warn(
222-
"The reddit snooper module has been disabled as it has been broken by the Reddit API changes. Please check the README for more information."
223-
);
201+
snooper.watcher
202+
.getListingWatcher(subreddits, options)
203+
.on("item", (item) => {
204+
//If post is a image and has a supported file format
205+
if ((item.kind = "t3" && isImage(item.data.url))) {
206+
//Retrieves information about the post
207+
const postUrl = item.data.url;
208+
const postTitle = item.data.title;
209+
const postID = item.data.id;
210+
const nsfw = item.data.over_18;
211+
212+
//Downloads the post
213+
download(postUrl, postTitle, nsfw);
214+
}
215+
})
216+
.on("error", (err) => {
217+
logger.error(`Unable to scrape reddit: `, err);
218+
});
219+
220+
// logger.warn(
221+
// "The reddit snooper module has been disabled as it has been broken by the Reddit API changes. Please check the README for more information."
222+
// );
224223
}
225224

226225
module.exports = {

0 commit comments

Comments
 (0)