Script that posts a random image from Wikimedia Commons, plus a random sampling of between one and three hashtags to Twitter every 10 minutes. Results can be highly entertaining.
See it in action @Arthur_Morty.
Unlike @_LovedHArt, this script only maintains short term memory. It may post about the same tag more than once, but hopefully not too close together. I was originally targeting Instagram but their API sucks.
To randomize your images, first register an application with Twitter.
The main script for the bot lives in index.js
and uses Node.
$ cd aggregate-decoding
$ npm install
Make sure to set the following environment variables using your fancy new registered Twitter application:
$ export AGG_TWITTER_CONSUMER_KEY="your app key"
$ export AGG_TWITTER_CONSUMER_SECRET="your app secret"
$ export AGG_TWITTER_ACCESS_TOKEN_KEY="your access token key"
$ export AGG_TWITTER_ACCESS_TOKEN_SECRET="your access token secret"
Then just run the script, $ node index.js
. A pseudo-json log file is written to log.txt
recording what has been posted so far.
I recommend running the script in the background using using forever, $ forever start index.js
.