How can I save twurl output to a file?


#1

Hi there,

I established a connection with twurl to the Streaming API and now I have tweets coming in on my terminal window continuously

twurl -t -d track=obama -H stream.twitter.com /1.1/statuses/filter.json

I am wondering
1.) how to stop the connection?
2) and then how to save the output to a file ?

Thank you for your help!


#2

in windows you can create a cmd file (create new text file then save it as twitter_api.cmd ) paste+save this:
twurl -t -d track=obama -H stream.twitter.com /1.1/statuses/filter.json > tweets.json

then you run it and you will have the tweets saved in the same folder as the cmd file


#3

thank you, but for some reason your command works with the Streaming API but NOT with the Search API:

I input:
twurl /1.1/statuses/user_timeline.json?screen_name=MikeRogers0&count=10 > tweets.json expecting to have a json file but when I open it it is empty. I am receiving the expected output but it is not stored in the json file!


#4

Late reply but might be helpful for others who read this.

The ampersand (&) in your query causes misinterpretation. When you put quotes around the URL this will be resolved.