A reddit bot, which appends videos to posts, written in Rust.
A good use-case would be the appending closing credit to the end of the posted video.
You will need cargo.
% cargo build --releaseRun-time dependencies are libsqlite & ffmpeg (binary).
Typically, just schedule the program launch via cron for, say, every 2 minutes and you are good to go.
This version of bot supports these video-hosting platforms:
- Imgur
- Gfycat
- Reddit hosted-videos.
Converted videos are uploaded to Imgur.
Appender is configurable via env-variables. All variables are mandatory.
| Variable | Description | Example |
|---|---|---|
| VIDEO_TO_APPEND | Path to the video to be appended to the posted videos | /usr/home/video.mp4 |
| FFMPEG_BINARY | Path to ffmpeg binary | /usr/bin/ffmpeg |
| IMGUR_CLIENT_ID | Imgur client id, visit https://apidocs.imgur.com/?version=latest#authentication for more details | |
| IMGUR_UPLOAD_URL | https://api.imgur.com/3/upload | |
| REDDIT_AUTH_TOKEN | Reddit auth token (https://github.com/reddit-archive/reddit/wiki/OAuth2) | |
| REDDIT_AUTH_URL | https://www.reddit.com/api/v1/access_token | |
| REDDIT_COMMENT_URL | https://oauth.reddit.com/api/comment | |
| REDDIT_PM_URL | https://oauth.reddit.com/api/compose | |
| REDDIT_USERNAME | Bot username | closing_credits_bot |
| REDDIT_PASSWORD | Bot password | |
| BOT_USER_AGENT | Reddit requires bots to set a uniq user-agent. Try your best! | |
| COMMENT_TEXT | Text that goes before the link. | Here’s your link. |
| PM_TEXT | Sometimes, mods ban bots. Nonetheless, we can PM comment the author. | Here’s your link. |
| PM_SUBJECT | Your gif url. | |
| DATABASE_URL | Path to sqlite DB | |
| UPDATES_URL | https://api.pushshift.io/reddit/search/comment | |
| POSTS_URL | https://api.pushshift.io/reddit/submission/search | |
| TRIGGER_STRING | The comment string, which will trigger the bot. | u/closing_credits_bot |
| DOWNLOADS_DIRECTORY | Where do we store downloads? | /tmp/appender-data |
| GFYCAT_POST_ENDPOINT | https://api.gfycat.com/v1/gfycats/ |
This bot is a simple wrapper around FFMPEG and pushshift.
Pushshift provides both historical & real-time reddit data, queryable with elasticsearch.