Created
September 26, 2011 10:22
-
-
Save fritzvd/1241979 to your computer and use it in GitHub Desktop.
Get request from twitter search and parse it into a Python object.
This file contains hidden or 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
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