Tweet Streamer is a script designed to stream and save tweets for data analysis.
Tweet Streamer is a python script utilizing Twitter's streaming API. It streams live tweets and saves their properties. Tweets are able to be filtered based on desired keywords or languages.
- Please see
requirements.txt
for the necessary dependencies - Requires Python 3+
- Some features might not be supported such as colored text output
-
Clone the repository to the desired location.
-
The setup guide should automatically run the first time. Alternatively you can run
tweetstreamer.py -s
to relaunch the setup. Or you can manually insert your credentials into thesettings.py
file.Note: All values in the
settings.py
act as the default values.
CONSUMER_KEY = 'consumer_key_here'
CONSUMER_SECRET = 'consumer_key_here'
ACCESS_TOKEN = 'access_token_here'
ACCESS_SECRET = 'access_secret_here'
Tweet Streamer utilizes command line arguments. See help for more information tweetstreamer.py -h
optional arguments:
-h, --help show this help message and exit
-o [OUTPUT], --output [OUTPUT]
Saves tweets as specified file name
-t, --terse Disables outputting tweets to console
-c, --color Enables colored text in console
-v VERSION, --version VERSION
Displays current version
-k KEYWORDS [KEYWORDS ...], --keywords KEYWORDS [KEYWORDS ...]
Filter tweets by the specified keywords
-l LANGUAGES [LANGUAGES ...], --language LANGUAGES [LANGUAGES ...]
Filter tweets by the specified language.
-s, --setup Begins the setup process
A KeyboardInterrupt
such as Ctrl + C
will stop the stream and close the database if desired.