videoarchivebot
Prerequisites
A computer running Linux (or Mac OS (untested)), with a recent JDK (recommended: OpenJDK 11) installed. youtube-dl is also recommended for vastly improved video downloading capabilities.
Quickstart Guide
- Start the bot.
Execute
./run.shin the root directory of the project. - After compiling the code, it should wait for user input. Type
listfor a list of commands, and (for some) descriptions of what they do. - Set up login information for Reddit. Set the following variables, replacing the placeholder values with your own:
App ID:
app_id 123456789
App Secret:app_secret ABCDEFABCDEFABCDEFABCDEF
Username:reddit_username botuser
Password:reddit_password botpw
In case the password contains spaces, you can wrap it like this:reddit_password "with spaces". In case the password contains quotes, you need to escape them with a backslash:reddit_password 12345\"67if your password is12345"67.
Also set the bot provider to your main username
bot_provider the_real_farfetchd - Try to log in:
connect.
It should show a message sayinglogin status: true.
If not, check your login data.
(Next time starting, it will log you in automatically.) - Set up downloading. You can set download handlers for specific domains (in the data/dl directory) with the
dl_handlercommand:dl_handler youtube.com youtube-dl.shTo remove a download handler, usedl_handler_remove yourdomain.com. To remove all download handlers, usedl_handler_clear. In case no handler is registered for a domain, it will use the one from thedl_handler_defaultvariable. By default, this is set todefault.shwhich is nonexistent, so it's needed to set this to one of the pre-existing scripts. It's recommended to set it toyoutube-dl.sh, which supports a lot of sites out of the box that serve video, as opposed tocurl.shwhich just downloads the webpage and therefore isn't going to be very useful. Sinceyoutube-dl.shuses youtube-dl to download video, make sure that's installed. - Set up a list of subreddits to watch for new content with the
watchcommand (reverse this withunwatch, orunwatchallto remove all subs from the watch list)
Example:watch videos- Start watching /r/videos for new content
Disable watching for new content by settingwatch_enable 0(enable again withwatch_enable 1) - I guess that's it? Type
saveto save configuration (this will happen automatically on shutdown), andquitto shut down the bot.
Folder structure
Everything that the bot uses is located in the data folder.
data/archive: The archived videos and post data.data/cfg: Configuration files. Most of these are overwritten with thesavecommand or when the bot shuts down, but you can set up custom commands inautoexec.cfgwhich gets loaded after everything else.data/dl: Download handlersdata/log: Log filesdata/ul: Upload handlersdata/work: Temporary files
To do
- Rewrite it in Rust (like originally intended, but dropped because of lack of reddit API support), JVM takes too much memory... ;)