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… read them below or add one }

Chris Bateman January 23, 2013 at 12:08 pm

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

Reply

Darius Kazemi January 23, 2013 at 12:14 pm

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

Reply

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. >:)

Reply

Leke Idowu March 23, 2013 at 8:10 pm

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

Reply

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/

Reply

Leave a Comment

Previous post:

Next post: