Skip to content

Daniluvatar/MiningTwitter

Repository files navigation

Mining Twitter

An elegant way to gather tweets from Twitter using the Tweepy API

OOP principles are used to encapsulate the complexity of Tweepy API. In addition, design patterns are taken into action in this prototype to create a robust code which is closed for modification but open for extension.

A concrete implementation of the Singleton and Decorator patterns in Python 3 is shown.

For running the program you will need to configure Twitter Streaming API. A good example to configure this is on the Step 1 of this tutorial. Configure your API key, API secret, Access token and Access token secret in the config_twitter.py script.

The main program is mining_twitter.py, remember to change your working directory in the data_path variable.

For gathering data from Twitter based on a search word:

$python config_twitter.py words

For gathering data from a Twitter account:

$python config_twitter.py accounts

Since this is the first version, if you want to search for other words or accounts, you will need to change it in the code. I hope to make this part of the code more dynamic in the coming version.

About

Gathering tweets from Twitter

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages