Skip to content

Instantly share code, notes, and snippets.

@ptwobrussell
Created November 8, 2010 19:52
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save ptwobrussell/668166 to your computer and use it in GitHub Desktop.
Save ptwobrussell/668166 to your computer and use it in GitHub Desktop.
Visualizing Twitter Search Results:
Visualizing Twitter Search Results with Protovis and/or Graphviz is this easy:
$ easy_install twitter # See https://github.com/sixohsix/twitter and http://pypi.python.org/pypi/setuptools
$ git clone https://github.com/ptwobrussell/Mining-the-Social-Web.git
$ cd Mining-the-Social-Web/python_code
$ python introduction__retweet_visualization.py TeaParty # or whatever you want to search for
Your browser should pop open and display the results as a force directed graph, but also check your console for some useful output.
You can create an image file from the DOT language output with a command like the following:
$ circo -Tpng -Otwitter_retweet_graph twitter_retweet_graph.dot
Fork the code and have some fun with it! Also consider picking up a copy of Mining the Social Web if you find this kind of stuff interesting: http://amzn.to/d1Ci8A
@hanleybrand
Copy link

This example has been updated to use Twitter's v1.1 API, which now requires authentication for all requests (amongst other things.)

To run this example, you'll just need to go to http://twitter.com/apps/new to create an app and get authentication credentials that should be inserted into this file's source code. See https://dev.twitter.com/docs/auth/oauth for more information on Twitter's OAuth implementation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment