Created
January 18, 2010 04:18
-
-
Save criccomini/279778 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# poll a search term every 60 seconds and print tweets out | |
import time | |
import simplejson | |
import re | |
import urllib2 | |
import urllib | |
last_id = False | |
while True: | |
url = 'http://search.twitter.com/search.json?q=just%20bought&rpp=100' | |
if last_id: | |
url = url + '&since_id=' + str(last_id) | |
search = urllib2.urlopen(url) | |
search = simplejson.loads(search.read()) | |
results = search.get('results', []) | |
tweet_count = 0 | |
for tweet in results: | |
print simplejson.dumps(tweet) | |
tweet_count = tweet_count + 1 | |
last_id = search['max_id'] | |
time.sleep(60) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment