Summary

This chapter only began to scratch the surface of what is possible with Twitter data, focusing primarily on the friend/follower relationships that can be discovered. A sample implementation of a command-line tool that ties all of the functionality from this chapter together is available at http://github.com/ptwobrussell/Mining-the-Social-Web/blob/master/python_code/TwitterSocialGraphUtility.py, and you should be able to adapt it fairly easily for your own purposes. (If you do, please consider forking it on GitHub and making your changes available to everyone.) Some interesting ideas for fun exercises follow:

  • We didn’t tap into geo data in this chapter. Try plotting out a histogram of the locations your followers are from and visualize it on an online map. Chapter 6 is fairly heavy on geo data and provides a reasonable introduction to some mapping technologies you might be able to use.

  • Try doing some basic frequency analysis of words that are in the description field of the user objects of your friends/followers. Chapters 7 and 8 provide tools and techniques that you might find helpful.

  • Try creating a histogram of the numbers of tweets by each of your followers to see who is the chattiest. This data is available as statuses_count in user objects.

  • We didn’t talk about lists—a way of grouping together users, usually because of some common thread they share—in this chapter. Check out the API docs on list, and write some code to try to determine who has listed you (or any Twitterer you admire) and what similarities there are among the folks in the list. A good starting point is to look at the lists a person appears in directly through Twitter’s public web interface.

Get Mining the Social Web now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.