You are here

Sample Source Code: Twitter API Cookbook Python Source Code

This Python source code for Twitter API is based on "Mining the Social Web (Second Edition) and provides sample code for accessing Twitter's API for development and oAuth access for production purposes, discovering trending topics, searching for tweets, constructing convenient function calls, saving and restoring JSON data with flat-text files, using MongoDB, sampling the Twitter firehose with the Streaming API, collecting time-series data, extracting tweet entities, finding the most popular tweet and tweets in a collection of tweets, tabulating frequency analysis, finding users who have retweeted a status, extracting a retweet attribution, making robust Twitter requests, resolving user profile information, extracting tweet entities from arbitrary text, getting friends and followers for a user, analyzing user's friends and followers, harvesting a user's tweet, crawling a friendship graph, analyzing tweet content, summarizing link targets, and analyzing a user's favorite tweet.