A Python script allowing you to run your own Twitter bot that posts every frame of a TV show.
I run a bot using this code on the Twitter account @breaking_frames, which posts 5 frames from the show "Breaking Bad" every half hour. That account is a good demonstration of what this program does.
I've also created a setup script (setupbot.py
) which will automatically split the show into the frames and create the database necessary for storing info for the bot, so that setting it up is a little faster.
If you make an account running this bot, crediting @pigeonburger somewhere in the bio/pinned tweet would be cool!
- A cool TV show
- Some sort of server/computer that runs 24/7
- Python version >=3.6
tweepy
(install usingpip install -U tweepy
)- A Twitter account with the twitter API consumer key + secret, and access token + secret (with Write permissions).
FFmpeg
(only for initial setup - splitting the show into frames)
-
First, you need a TV series downloaded onto your computer (e.g. as
.mp4
files). Put every single episode from every season all in one single folder all together.If the video files you have are not in the
mp4
format, change line 10 ofsetupbot.py
to the relevant extension (e.g.*.mkv
) -
Download the
setupbot.py
andbot.py
files from here, and place them in the same folder as all the TV show episodes. -
Run the
setupbot.py
file. This program will split all the videos into their individual frames (default1fps
), placing them all inside a folder calledframes
, and enter some details into a database file calledframebot.db
, which is required for the Twitter bot to run.Video processing is very CPU-intensive, so depending on the speed of your computer, this script may take a while to complete. Once it finally does finish running, you can delete the video files if you want.
-
Open the
bot.py
file for editing, and enter in your Twitter account's Consumer Key, Consumer Secret, Access Token, and Access Token Secret. Also enter the name of the show by updating theshow_name
variable a bit further below. -
The bot is now ready to run! You'll need to use a program like
Cron
on Linux orTask Scheduler
on Windows to executebot.py
every however many minutes you want. By default, the bot will post 5 frames from the show every time the script is run.
This code is released under the GNU GPLv3 license.