Skip to content

Instantly share code, notes, and snippets.

@j2labs
Created November 25, 2009 03:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save j2labs/242454 to your computer and use it in GitHub Desktop.
Save j2labs/242454 to your computer and use it in GitHub Desktop.
>>> import urllib
>>> import simplejson
>>> url = urllib.urlopen('http://search.twitter.com/search.json?q=j2labs&rpp=1') # limit search to just 1 tweet
>>> json = url.read()
>>> usable_data = simplejson.loads(json)
>>> usable_data
{'next_page': '?page=2&max_id=6038882667&rpp=1&q=j2labs', 'completed_in': 0.039456999999999999, 'refresh_url': '?since_id=6038882667&q=j2labs', 'results': [{'iso_language_code': 'en', 'text': "Marc and Adam Allen's new band, Helen Earth Band, have released their new cd!! http://bit.ly/91HpIq :: Please RT #helenearthband", 'created_at': 'Wed, 25 Nov 2009 03:16:18 +0000', 'profile_image_url': 'http://a1.twimg.com/profile_images/435479248/Picture_1_normal.png', 'source': '<a href="http://twitter.com/">web</a>', 'from_user': 'j2labs', 'from_user_id': 54476112, 'to_user_id': None, 'geo': None, 'id': 6038882667L}], 'since_id': 0, 'results_per_page': 1, 'query': 'j2labs', 'max_id': 6038882667L, 'page': 1}
>>> usable_data['results'][0]['text']
"Marc and Adam Allen's new band, Helen Earth Band, have released their new cd!! http://bit.ly/91HpIq :: Please RT #helenearthband"
>>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment