All Projects → fterh → sneakpeek

fterh / sneakpeek

Licence: MIT license
Reddit bot to preview and post hyperlinks as comments

Programming Languages

python
139335 projects - #7 most used programming language
Dockerfile
14818 projects

Projects that are alternatives of or similar to sneakpeek

PlayStoreLinks Bot
A Reddit Bot that links to Android Apps when requested.
Stars: ✭ 91 (+51.67%)
Mutual labels:  reddit, reddit-bot
RepostCheckerBot
Bot for checking reposts on reddit
Stars: ✭ 36 (-40%)
Mutual labels:  reddit, reddit-bot
context-mod
an event-based, reddit moderation bot built on top of snoowrap and written in typescript
Stars: ✭ 38 (-36.67%)
Mutual labels:  reddit, reddit-bot
reddit-comment-bot
Reddit bot that auto replies to comments on set subreddits
Stars: ✭ 59 (-1.67%)
Mutual labels:  reddit, reddit-bot
crypto-subreddits-cli
👽 Track Cryptocurrency Subreddits On The Command Line 👽
Stars: ✭ 24 (-60%)
Mutual labels:  reddit, reddit-bot
Reddit-Bot-List
⚡️🤖 A list of Reddit bots
Stars: ✭ 21 (-65%)
Mutual labels:  reddit, reddit-bot
cronnit.com
A free tool for scheduling posts to Reddit.
Stars: ✭ 3 (-95%)
Mutual labels:  reddit, reddit-bot
Mongit
💾 Mongo-esque Reddit-based Database!
Stars: ✭ 20 (-66.67%)
Mutual labels:  reddit
text-mining-corona-articles
Text Mining for Indonesian Online News Articles About Corona
Stars: ✭ 15 (-75%)
Mutual labels:  news-articles
reddit-opinion-mining
Sentiment analysis and opinion mining of Reddit data.
Stars: ✭ 15 (-75%)
Mutual labels:  reddit
redditwatcher
📻 Reddit streaming CLI
Stars: ✭ 17 (-71.67%)
Mutual labels:  reddit
reddit-clone
A reddit clone written using node.js / express.js / mongodb / passport.js. https://seiya-beddit.herokuapp.com/
Stars: ✭ 84 (+40%)
Mutual labels:  reddit
MemeAdviser
A reddit bot that evaluates memes and predicts growth on r/MemeEconomy
Stars: ✭ 14 (-76.67%)
Mutual labels:  reddit-bot
nlpserver
NLP Web Service
Stars: ✭ 76 (+26.67%)
Mutual labels:  article-extractor
safe-search
Sets the built-in adult content filter (most often: safe search) on Google, YouTube, Bing, Yahoo, DuckDuckGo, Startpage, Dogpile, Yandex, Vimeo, Reddit, Ecosia, Dailymotion, Qwant, and Patreon.
Stars: ✭ 16 (-73.33%)
Mutual labels:  reddit
set-top-reddit-wallpaper
PowerShell script to set the wallpaper as the top post of the day/week/month from /r/wallpapers and /r/wallpaper or any other subreddits.
Stars: ✭ 17 (-71.67%)
Mutual labels:  reddit
android-word2html
android word文档预览 基于poi的word(.doc/.docx)转html 实现预览功能
Stars: ✭ 38 (-36.67%)
Mutual labels:  preview
comments-generator
A Reddit bot that generates new context-aware comments using Markov chains trained from a set of given users or subreddits comments history.
Stars: ✭ 63 (+5%)
Mutual labels:  reddit-bot
ARAW
The Android Reddit API Wrapper
Stars: ✭ 75 (+25%)
Mutual labels:  reddit
imgcat
Display images and gifs in your terminal.
Stars: ✭ 67 (+11.67%)
Mutual labels:  preview

sneakpeek

Build Status Codacy Badge

A Reddit bot that previews hyperlinks and posts their contents as a comment. It should never spam or double-post, and will skip a comment if it is too long.

Site support

  • businesstimes.com.sg
  • channelnewsasia.com
  • channelnewsasia.com (CNAlifestyle)
  • mothership.sg
  • ricemedia.co
  • straitstimes.com
  • tnp.sg
  • todayonline.com
  • yahoo.com
  • zula.sg

Contributing

PRs are always welcome.

  1. Write Handlers to support more websites
  2. Improve test coverage
  3. Improve documentation

New version release checklist

  1. Create a release branch (e.g. release-v1.2.3) from the develop branch
  2. Bump version numbers in config.py to the release branch
  3. Update README
  4. Possibly commit minor bug fixes to the release branch
  5. Merge the release branch into master and develop

This project follows this Git branching workflow.

Operation

Before running

The program requires an environmental variable SUBREDDIT to be set. This specifies the subreddit that the bot will monitor. If it's not set, the default subreddit /r/all will be monitored. At the moment, only 1 subreddit may be specified.

Running/Testing

All the commands below assume that the virtual environment has been activated (pipenv shell).

  • Running: SUBREDDIT=name python main.py (or SUBREDDIT=name nohup python main.py &)
  • Testing: invoke test

Docker

This application can be built and run as a Docker image.

General

main.py starts the bot and calls scan(subreddit) (in scan.py), which monitors for new submissions in the provided subreddit.

For each new submission, scan checks if they qualify for preview by calling qualify (in qualify.py).

A submission qualifies for preview if it:

  1. Is a link
  2. Has a Handler for the website

If a submission qualifies, scan calls the handle method of the Handler to generate the raw comment, then format_comment(comment) in the comments module to generate the final comment in Markdown.

If the final comment in Markdown does not exceed a pre-configured comment length (config.COMMENT_LENGTH_LIMIT), the comment is posted, and the action written to the database (through DatabaseManager) to prevent double-posting.

Logging is written to standard output, and logging level can be configured in config.py.

Handlers

handler.py contains a HandlerManager that checks if a website has a Handler.

A Handler is a class with a @classmethod handle(cls, url) that accepts a URL and returns a Comment. All Handlers must inherit from AbstractBaseHandler.

The Handler can be part of a module or package, and have as many supporting sub-modules or sub-packages as necessary.

Comments

The comments module (in comment.py) exports the Comment class, which all Handlers must return. A Comment class requires a title and body, and accepts a byline and attribution (which are optional).

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].