Skip to content

Instantly share code, notes, and snippets.

@mattjj
Created November 5, 2012 22:34
Show Gist options
  • Save mattjj/4020849 to your computer and use it in GitHub Desktop.
Save mattjj/4020849 to your computer and use it in GitHub Desktop.
twitter scraping
#!/bin/bash -e
baseurl='http://search.twitter.com/search.json?q=sandy&rpp=100&since=2012-10-27&until=2012-10-30&callback=?'
touch allresults.json
curl -s $baseurl | jq '.results | .[]' >> allresults.json
maxid=$(<allresults.json jq '.id' | tail -1)
while [ $maxid -gt 0 ]
do
curl -s "${baseurl}&max_id=${maxid}" | jq '.results | .[]' >> allresults.json
maxid=$(<allresults.json jq '.id' | tail -1)
echo -n '.'
sleep 0.1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment