Skip to content

Instantly share code, notes, and snippets.



Created Oct 23, 2017
What would you like to do?
#コンテンツ応用論2017 のTweetを追う
import tweepy
# ここらへん入れてね
auth = tweepy.OAuthHandler('', '')
auth.set_access_token('', '')
api = tweepy.API(auth)
tag = '#コンテンツ応用論2017'
class SearchStreamListener(tweepy.StreamListener):
def on_status(self, status):
text = status.text.replace(tag, '').replace('\n', '').strip()
if len(text) > 1 and not text.isdigit() and not text.startswith('RT @'):
stream = tweepy.Stream(auth=api.auth, listener=SearchStreamListener())
stream.filter(track=[tag], async=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment