AurieaHarvey About Contact Index Random
Trail: TwitterBots

TwitterBots

ElegantMedia

Learning how-to

Advice from @tinysubversions

This is a good article for the most basic of imagebots: you pre-make as many images as you want, put them in a directory, and the bot picks random images and tweets them: http://joaquinlp.me/blog/simple-twitter-image-bot-in-python/

The important thing here is that you get the flow of (image file → upload to twitter api → tweet), which is a little more tricky than doing a plain text tweet.

Generally speaking, what I would do from there is move towards making images on the fly, so the bot can surprise/delight you the author, which is kind of the whole point. I’m not sure how to do that in Python since it’s not really my language, but maybe the Python Imaging Library is a good place to start (seems kind of old, no idea if it works with python versions higher than 2.6).

I might as well throw in some JS resources here too. JavaScript based twitter bots are made in Node.js, which if you’re unfamiliar with it is just JS that runs on the command line instead of in a browser. I have a very basic “examplebot” here:

https://github.com/dariusk/examplebot

Here’s some code for @autocharts, which is one of my image bots that draws original images. You can see in “index.js” that I’m using a module to draw images as though I were using an HTML5 <canvas> object:

https://github.com/dariusk/intersections
And then here is @museumbot, which tweets images/links from the metropolitan musem of art’s back catalog four times a day:

https://github.com/dariusk/museumbot

It also posts to Tumblr, notably.