Reddit bot that reuploads Reddit hosted video. Currently running under /u/vredditshare.
Create a file named credentials.ini
in the root directory with the following content
[general]
mode = development|production
operator = username to be pinged on crash/other stuff
[database]
type = sqlite|mysql
# Settings for mysql
host =
username =
password =
database =
[reddit]
client_id = Reddit client id
client_secret = Reddit client secret
username = Reddit username
password = Reddit password
[imgur]
imgur_id = Imgur api id
imgur_secret = Imgur api secret
imgur_cookie = Cookie generated from an Imgur upload
[gfycat]
gfycat_id = gftcat id
gfycat_secret = gfycat secret
[streamable]
email = streamable account email
password = password
[catbox]
hash = your catbox account hash
From there run python main.py
from the root directory to start. vredditshare requires Python 3.6+.
You will also need FFmpeg
, FFprobe
, and gifski
binaries on the path or in the same directory.
Here's some notes on the more interesting parts of the bot.
The bot goes through a couple of steps to determine what the user was asking for. First thing it checks is whether or not the user gave a link in the summon comment themselves. Then it looks through the comment chain to see if there was a gif in the parent comments (it will choose the one last referenced in the chain). Finally, it checks the post for a link.
vredditshare uses two different reversing procedures which it chooses based on a few different circumstances. If it is reversing an mp4 (which is the most common gif type nowadays, go figure), it does the reversal process with FFmpeg. For gifs, it exports each frame with FFmpeg and then reassembles them with gifski. Although gifski produces great gifs, it's very slow and so this process is usually avoided. The bot chooses a reversal method by making an educated guess as to whether the source was originally a gif or an mp4.
v3 of vredditshare introduces the new Gif Host Library, a new implementation of the code used to describe gifs and hosting websites. It aims to share as much code as possible between the sites, reducing implementation efforts as well as surface area for bugs. Hosts define several properties such as how to parse their links, upload capabilities,and limits. Instead of hard coding where the bot should upload gifs for every host, it is now decided dynamically through the properties of a gif, limits of the hosting sites, and other priorities. It's fairly sturdy even though it's new and abstracts away many annoyances, differences, and difficulties managing the gif host sites.