New Twitter bot: @LatourSwag

by Darius Kazemi on January 12, 2013

in project,projects

I had a few too many drinks last night, and made a Twitter bot called @LatourSwag as a birthday present for Ben Abraham.

Basically how it works is I get the last 100 Twitter search results for “#swag” that also contain the word “and”. Then I grab the last 100 tweets from @LatourBot. I take every #swag tweet that’s not an RT and push it to an array. I take every @latourbot tweet that has “and” or “,” in it, and push it to an array. Then I say there’s a 50% chance it will be latour-then-swag, and 50% that it will be swag-then-latour. If Latour comes first, I take a random Latour tweet from the array and take all the text up to the “and” or the “,”. Then I take a random swag tweet and take the text after the “and” in it. Then I do latour + ” and ” + swag. There you go.

It’s slightly more complicated than that, but mostly it’s just a few tweaks I did to make sure I had enough Latour quotes to pick from. The results are actually pretty good sometimes!

{ 5 comments }

Chris Bateman January 23, 2013 at 12:08 pm

You have *way* too much time on your hands, my friend… :)

Darius Kazemi January 23, 2013 at 12:14 pm

It took 2 hours!! I just do this instead of playing videogames or reading.

Chris Bateman January 23, 2013 at 1:01 pm

When you put it that way, it makes me think of all the time I waste reading. >:)

Leke Idowu March 23, 2013 at 8:10 pm

Can you email me instructions on how you created this twitter bot?

Darius Kazemi March 24, 2013 at 1:59 pm

Hi, you can find the source code here: https://github.com/dariusk/latourswag

You might also be interested in this other article I wrote on making a different twitter bot (it follows the same general pattern): http://tinysubversions.com/2012/05/how-i-built-metaphor-a-minute/

Comments on this entry are closed.

Previous post:

Next post: