Skip to content

Instantly share code, notes, and snippets.

@fritzvd
Created September 26, 2011 10:22
Show Gist options
  • Save fritzvd/1241979 to your computer and use it in GitHub Desktop.
Save fritzvd/1241979 to your computer and use it in GitHub Desktop.
Get request from twitter search and parse it into a Python object.
import urllib2, simplejson
# Hier de respons van de website als je de query opent.
response = simplejson.dumps(urllib2.urlopen("http://search.twitter.com/search.json?geocode=51.985263,5.663259,5km&q=forum").readline())
# Format de website zo dat python het kan lezen als python objecten ipv JSON
# de 5 en de 1 slaan op de indexing van de response. Het 5e item zijn de tweets zelf in deze request, kan misschien verschillen per search.
loadaspy = simplejson.loads(simplejson.loads(response)).items()[4][1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment