I have been interested in using the Twitter API since I learned about it in my ICM class, and am hoping to work further with it to further understand how APIs work. What I am fascinated by is being able to gather real time data with tweets from a huge group of users and manipulate it in my work. What I was very excited about is how easy it is for Python to achieve the goal of manipulating strings: I was interested in allowing me to search for tweets and creating text that I cannot predict in any way, as the source will constantly be changing. I wanted to set some perimeters for the poetic form I am creating: I really like prime numbers, so the idea of 11 jumped at me immediately, and I thought I can try to make the word count for each line a prime number as well. To make it as unpredictable as possible, I also wanted to randomize the results, so I can never be sure what I would get. So, the program I wrote to achieve that is here:
I didn't really know the best way to code the input for the search, so it has to be hard-coded in line 13 in the "q=xxx" section. This current form searches for 25 tweets, splits the words from the results, randomizes them and produces 11 lines of output text: with word counts of 3, 5, 7, 9, 11, 13, 11, 9, 7, 5, 3.
I am quite excited with what I came up with, and while I loved the randomness of it, I also think that I should work on better ways to refining the search, as twitter can be TOO unpredictable while not being very interesting. I think I would like to continue exploring APIs further: hopefully I can work on a program that can give a constant feed of randomized poetry that has a strong source text (that is live and unpredictable!!!)
Here are a few examples of poems generated when I searched "#RIPOculus".
die Could has for die best so happen. future, two an happen. Facebook company to close... Facebook VR us? acquired RT Un want Welcome hate RT has I RT Oculus Facebook Buys Why think hate your Welcome Danggit has Danggit Facebook best Why to to Facebook leach RT we be dommage Oculus Buys huge a future, par a the say we of happen. long. die whole
Could means this Oculus concept racheté company best close... Facebook mort-né, Buys betrayed Buys Facebook Danggit means kills) mort-né, Buys from Oculus future, concept think Danggit don't future, racheté liked data. kills) platform would dommage won’t Buys reaction dommage buying L'Oculus mort-né, close... #RIFT Could gonna #Oculus were Facebook L'Oculus @PhillyD kills) #RIFT were buying Oculus cool... Could Facebook future, leach Oculus, liked video gaming Facebook data. gaming Danggit won’t Facebook @YouTube hate would Oculus #Oculus Oculus hate Facebook reaction would Buys acquired #oculus data. happen. don't data. leach mort-né, company #rift buying Oculus. buying
part were Oculus Could platform Facebook quel Rift? were dommage long. from Facebook Oculus Oculus won’t cool... Facebook acquired won’t dommage this Facebook happen. Facebook bought would gonna were Facebook betrayed (and Facebook concept #oculus mort-né, things: L'Oculus concept quel quel quel were were huge data. gonna leach from gonna data. company L'Oculus won’t quel company don't #RIFT Facebook acquired things: leach Danggit close... #oculus bought Oculus. gonna Buys mort-né, dommage leach liked from Could Facebook racheté concept over liked racheté Oculus would company hate quel data. future, Rift? Danggit huge think close... close... best