Last active
May 6, 2016 19:50
-
-
Save konrad/d6f0ab643b2e4407d5d6 to your computer and use it in GitHub Desktop.
An example how to get all tweets containing a hashtag (here #BOSC2015) and storing each tweets as JSON string.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from TwitterSearch import * | |
import json | |
try: | |
tso = TwitterSearchOrder() | |
tso.set_keywords(['#BOSC2015']) | |
# Please replace with your credentials | |
ts = TwitterSearch( | |
consumer_key='REPLACE_ME', | |
consumer_secret='REPLACE_ME', | |
access_token='REPLACE_ME', | |
access_token_secret='REPLACE_ME' | |
) | |
for tweet in ts.search_tweets_iterable(tso): | |
print(json.dumps(tweet)) | |
except TwitterSearchException as e: | |
print(e) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment