Need help for a newbie to stream tweets with the Terminal


#1

Hey everyone,

As the title of this discussion suggests, I would like to stream specific tweets for research purposes (I am a PhD student (interested in linguistics, not computing… -.-’)), and I first started learning a few basic things with Python, but I realized that it could (apparently) be possible with just the Terminal (I’m on Mac OS) and a program like Twurl (if I’m not mistaken), so I gave up Python, but thus far I have just been able to connect to Twitter via the command line, by using my API key and secret, but now I’m stuck and I can’t figure out how to make requests to stream specific tweets according to key words, or geo-localization.
I have been spending the last three weeks learning the basics of the command line so that I can better understand how it works, but I still can’t find a relatively recent tutorial which would be clear enough and basic enough for a complete newbie in computing to understand how to do that, so I desperately need help now, since I am working on streaming tweets for a research project, and the deadlines are now becoming more and more pressing… So my questions are:

  1. I can connect to Twitter with the Terminal and Twurl by using my API key and secret, what is the next step?
  2. How to make requests to extract tweets from specific cities and with specific key words?
  3. How to start streaming?

Please try to be clear (at least in newbies’ terms…) since all the topics I found on the Internet apparently assume a certain knowledge of programming basics, which I don’t have, hence my need for clear explanations…

I thank you in advance for any help you may bring! Any advice would be invaluable at this point. Don’t hesitate to tell me if you need any more info.

Best


#2

Hello Michaël,

If you have Twurl up and running on your Terminal, here are two examples that will start streaming Tweets either matching a keyword (“Paris” in the first example below) or posted from a location bounding box (latitude and longitude around Paris in the second example below):

$ twurl -H stream.twitter.com -X POST "/1.1/statuses/filter.json?track=Paris" $ twurl -H stream.twitter.com -X POST "/1.1/statuses/filter.json?locations=2.1632,48.7429,2.5051,48.9679 "

Let us know if we can help any further.


#3

Hello Romain,

Thanks for the help, much appreciated! I got how to make requests in order to stream tweets containing key words, but I was struggling with the location part, so even though I just learnt that one cannot make requests with both key words AND location bounding boxes, this will help a lot, thanks!

Another problem which arose though is the fact that in a perfect world I would need to get the age (or at least the age group) of the users whose tweets I got, but as far as I know there is no direct way to get this info, but I know that there are projects working on it, so would you be aware of some way to at least get an approximate age of the users? I was thinking of creating a new thread concerning this, but it doesn’t hurt to first try here!

Thanks again for the help!