Skip to content

Instantly share code, notes, and snippets.

@Yuiki
Created October 23, 2017 07:45
Show Gist options
  • Save Yuiki/4024f705b931f5d04a54e9840b22c784 to your computer and use it in GitHub Desktop.
Save Yuiki/4024f705b931f5d04a54e9840b22c784 to your computer and use it in GitHub Desktop.
#コンテンツ応用論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 @'):
print(text)
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