DEV Community

Cover image for Automatically change your Twitter background every 5 minutes
Matt Kenefick
Matt Kenefick

Posted on

Automatically change your Twitter background every 5 minutes

Why? I couldn't decide on what Twitter banner to use after cleaning up all my angry political tweets.

I eventually started to look at my generic wallpapers and thought, "Which one of these many landscapes represents me as a person?" All of them, obviously.

It seemed like the only logical solution would be to create a script to cycle backgrounds like you can on your desktop.

Github: https://github.com/mattkenefick/twitter-backgrounds

Here are the basic instructions, assuming you're on a server of some type with PHP.

git clone https://github.com/mattkenefick/twitter-backgrounds
cd twitter-backgrounds
composer install

# Follow the instructions for ENV variables and crontab
Enter fullscreen mode Exit fullscreen mode

After you're all setup, you should find your Twitter background changing every X often.

Here are some cron examples for you:

# Every five minutes
*/5 * * * * php /path/to/twitter-backgrounds/index.php

# Every thirty minutes
*/30 * * * * php /path/to/twitter-backgrounds/index.php

# Every day at 8am 
0 8 * * * php /path/to/twitter-backgrounds/index.php
Enter fullscreen mode Exit fullscreen mode

Have fun.

Top comments (0)