Skip to content

Instantly share code, notes, and snippets.

@ptwobrussell
ptwobrussell / gist:1592859
Created January 11, 2012 03:33
Mining the Social Web, Example 1-3 (works as of Jan 10, 2012 and last tested on 4 April 2012)
# Twitter's Trends API has been in flux since Feburary 2011 when Mining the Social Web was published
# and unfortunately, this is causing some confusion in the earliest examples.
# See also https://dev.twitter.com/docs/api/1/get/trends
# Note that the twitter package that's being imported is from https://github.com/sixohsix/twitter
# If you have first done an "easy_install pip" to get pip, you could easily install the latest
# version directly from GitHub as follows:
# $ pip install -e git+http://github.com/sixohsix/twitter.git#egg=github-pip-install
@ptwobrussell
ptwobrussell / gist:668166
Created November 8, 2010 19:52
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: