This is a Reddit bot creates gfycat mirrors for popular video submissions using Reddit's own v.redd.it service.
v.redd.it links are different from most other content posted on Reddit, since there no direct video URL is exposed. Instead, clicking such a post opens the Reddit comments page. This makes sharing the content (and the content) alone clumsy.
The bot obtains content to mirror from 3 sources:
- Automatically scraping subreddits and checking for v.redd.it content links.
- PMs from users containing links to v.redd.it posts.
- Mentions in the comments of a v.reddd.it post.
In all cases, it automatically creates gfycat mirros of the v.redd.it content. Gfycat content can be viewed on all platforms, and the content is served on a dedicated page, without any discussion threads.
PMs to the bot will be scanned for reddit post links. A mirror will be created for each valid link detected, and a single reply will be sent to the author of the PM containing all the mirror. All other body text, as well as the PM's subject, is ignored.
When mentioned in the comments of a post, the bot will use the post's content to create a mirror, and then it will reply to the comment's author. It will disregard all message text, so you cannot use this way to ask for additinal mirrors. This is done to avoid derailing discussions.
Soon™, the bot will support:
- Mirroring submissions containing audio to Streamable instead of Gfycat.
You can easily run your own copy of the v-to-gfy bot.
- A server connected to the Internet and capable of running Python 3.
- PRAW.
- A Reddit account for the bot. WARNING: Do not use your main Reddit accout for the bot -- you will get banned from subreddits that don't allow bots or don't want this bot in particular.
- A gfycat account to which mirrors will be uploaded.
-
Obtain the code, e.g. by cloning this repository:
git clone https://github.com/andreipoe/v-to-gfy.git
-
Set up your access credentials:
- Copy
config.ini.template
toconfig.ini
. - Open
config.ini
and set your Reddit credentials under thereddit
section according to the PRAW script application authentication docs. - Open
config.ini
and set your gfycat credentials under thegfycat
section using the details received by email after following the access token procedure. Note that you also need your account's username and password, as per the Password Grant docs.
- Copy
-
Set up your bot preferences.
- Choose which features you want to enable (subreddit sraping, PM monitoring, mention monitoring) by setting the corresponding key to
true
. - If using subreddit scraping, set the list of monitored subreddits. Do not include
/r/
in front of the subreddit name, and separate multiple subreddits with spaces. - Set the interval at which the bot will check for new submissions/PMs/mentions.
- Choose which features you want to enable (subreddit sraping, PM monitoring, mention monitoring) by setting the corresponding key to
You only need to run python3 bot.py
. Assuming that you have PRAW installed and that you have set up your config.ini
, this is all you need to do.
Alternatively, you can run the bot in a Docker container:
-
Obtain the Docker image by either:
-
Pulling from Docker Hub:
docker pull andreipoe/v-to-gfy
-
Cloning this repository and building an image locally:
docker build -t andreipoe/v-to-gfy .
-
-
Run the container:
docker run -d --name v-to-gfy-bot --restart unless-stopped -v /path/to/config.ini:/bot/config.ini:ro andreipoe/v-to-gfy
Note: In the run command above, make sure you replace /path/to/config.ini
with the actual path to your completed config.ini
.
This bot would not be possible without the wonderful PRAW, the Reddit API, and the Gfycat API. A big "thank you" to everyone who has contributed to developing these projects an making them freely available.