Last active
March 3, 2020 23:04
-
-
Save katronai/cd58150a859aef719a1c370b3614a173 to your computer and use it in GitHub Desktop.
Search tweets by date from Twitter using tweepy
This file contains hidden or 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
# The following code fetches the most recent 1000 mentions of 'python'. | |
from tweepy import Stream | |
from tweepy import OAuthHandler | |
from tweepy.streaming import StreamListener | |
import tweepy | |
import time | |
ckey ='x' | |
csecret = 'x' | |
atoken = 'x' | |
asecret ='x' | |
auth = tweepy.OAuthHandler(ckey, csecret) | |
auth.set_access_token(atoken, asecret) | |
api = tweepy.API(auth) | |
max_tweets = 1000 | |
for tweet in tweepy.Cursor(api.search,q='test',since='2014-07-01',until='2014-07-31', wait_on_rate_limit=True).items(max_tweets): | |
print tweet.text |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment