After my first twitterbot I obviously wanted to create a new twitterbot, one a bit more complex, a bit more creative.
The Catalan Elections on the past 27th of September where approaching and thought on doing something about it. There was at the time a big political confrontation between the separatist and the unionist parties, and as usual, the undecided voters would have a huge impact in the final results.
Making a little pun on the situation, my bot tries to provide an (admittedly simple and useless) undecided political discourse by randomly remixing the last tweets of the different candidates and producing new tweets with them.
The list of candidates, with their correspondent twitter handle, whose tweets were considered are (in alphabetical order, although some think this order is the actual outcome of the elections ):
Having the list of twitter handles to fetch tweets for, and again using tweepy, I can easily obtain the last 20 tweets for each of the candidates and split the words so I end up with the list of words composing the 140 tweets:
Once I’ve obtained the list of words, I compose a new tweet randomly appending words from the list and trying to maximise the tweet length, without going over the 140 character limit imposed by Twitter:
Not too bad for an hour of coding !
You can check the full profile of “the undecided bot” on Twitter.
Given there have been some noise about the use of bot accounts to promote and amplify political messages before and specially during the campaign, and there is (big ) room for improvement to my current approach I will try to build a new twitterbot for the Spanish Elections on the next 20th of December, but my bot will not try (at least willingly) to promote or amplify the political position of any contestant party .