百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
S

sneakpeek

> 编程语言
开源

Reddit 机器人用于预览和以评论的形式发布超链接

100 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

Reddit 机器人用于预览和以评论的形式发布超链接

sneakpeek

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).

Issues· 10 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Pythonarticle-extractornews-articlespreviewreddit

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言