tweepy

Tweepy Tracking Multiple Terms

那年仲夏 提交于 2019-12-02 02:55:33
I am doing content analysis on tweets. I'm using tweepy to return tweets that match certain terms and then writing N amount of tweets to a CSv file for analysis. Creating the files and getting data is not an issue, but I would like to reduce data collection time. Currently I am iterating through a list of terms from a file. Once the N is reached (eg 500 tweets), it moves to the next filter term. I would like to input all my terms (less than 400) into a single variable and all the results to match. This works too. What I cannot get is a return value from twitter on what term matched in the

Does Tweepy support running multiple Streams to collect data?

倾然丶 夕夏残阳落幕 提交于 2019-12-01 22:14:02
For example, I'd like to collect data related to three keywords: keyword1 keyword2 keyword3 I understand that I could collect them all at one time using: set track=[keyword1,keyword2,keyword3] . Is it possible to run three different Python processes to collect data for those keywords separately? Unfortunately, no . Assuming you're using Tweepy's Stream class (which uses the Twitter Streaming API) you can not make multiple connections with a single account. You should also watch out if you try to circumvent this using multiple accounts: Each account may create only one standing connection to

tweepy get tweets among two dates

北慕城南 提交于 2019-12-01 21:33:46
问题 I have the following code in Python: import tweepy consumer_key = "..." consumer_secret = "..." access_token = "..." access_token_secret = "..." auth = tweepy.OAuthHandler(consumer_key, consumer_secret) auth.set_access_token(access_token, access_token_secret) start_date = datetime.datetime(2018, 1, 19, 12, 00, 00) end_date = datetime.datetime(2018, 1, 19, 13, 00, 00) api = tweepy.API(auth) for tweet in tweepy.Cursor(api.user_timeline, screen_name="@IBM", since=start_date, until=end_date)

tweepy get tweets among two dates

大城市里の小女人 提交于 2019-12-01 19:34:58
I have the following code in Python: import tweepy consumer_key = "..." consumer_secret = "..." access_token = "..." access_token_secret = "..." auth = tweepy.OAuthHandler(consumer_key, consumer_secret) auth.set_access_token(access_token, access_token_secret) start_date = datetime.datetime(2018, 1, 19, 12, 00, 00) end_date = datetime.datetime(2018, 1, 19, 13, 00, 00) api = tweepy.API(auth) for tweet in tweepy.Cursor(api.user_timeline, screen_name="@IBM", since=start_date, until=end_date).items(): print("ID TWEET: " + str(tweet.id)) Is there a way to get tweets between start_date and end_date ,

Unraised exception using Tweepy and MySQL

强颜欢笑 提交于 2019-12-01 13:43:48
I am trying to use Tweepy to store tweets in a MySQL DB. The code works fine, with the exception of once I try to execute the SQL command to insert the data into the database. Code is as follows: #MySQL connection attempt try: cnx = mysql.connector.connect(**config) cursor = cnx.cursor() except mysql.connector.Error as err: if err.errno == errorcode.ER_ACCESS_DENIED_ERROR: print("Something is wrong with your user name or password") elif err.errno == errorcode.ER_BAD_DB_ERROR: print("Database does not exist") else: print(err) class StdOutListener(StreamListener): def on_data(self, data): tweet

tweepy (python): rate limit exceeded code 88

依然范特西╮ 提交于 2019-12-01 08:54:23
I'm writing a Twitter application with tweepy that crawls up the tweets by looking at in_reply_to_status_ID. Everything works fine up to the rate limit, after a few minutes, I have to wait another 15 minutes or so. This is strange because I used nearly identical code until a few months ago before API 1.0 got deprecated, and it didn't have the rate limit problem. Is there a known way I can get rid of, or at least increase the rate limit? Or is there a workaround? Seems like a lot of people are having trouble with this, but can't find a definite solution.. i will greatly appreciate it if you

tweepy (python): rate limit exceeded code 88

一曲冷凌霜 提交于 2019-12-01 05:56:31
问题 I'm writing a Twitter application with tweepy that crawls up the tweets by looking at in_reply_to_status_ID. Everything works fine up to the rate limit, after a few minutes, I have to wait another 15 minutes or so. This is strange because I used nearly identical code until a few months ago before API 1.0 got deprecated, and it didn't have the rate limit problem. Is there a known way I can get rid of, or at least increase the rate limit? Or is there a workaround? Seems like a lot of people are

Scrape User Location from Twitter

人盡茶涼 提交于 2019-12-01 04:21:36
I am trying to scrape latitude and longitude of user from Twitter with respect to user names. The user name list is a csv file with more than 50 names in one input file. The below are two trials that I have made by far. Neither of them seems to be working. Corrections in any one of the program or an entirely new approach is welcome. I have list of User_names and I am trying to lookup user profile and pull the geolocation from the profile or timeline. I could not find much of samples anywhere over Internet. I am looking for a better approach to get geolocations of users from Twitter. I could

Scrape User Location from Twitter

╄→гoц情女王★ 提交于 2019-12-01 01:40:25
问题 I am trying to scrape latitude and longitude of user from Twitter with respect to user names. The user name list is a csv file with more than 50 names in one input file. The below are two trials that I have made by far. Neither of them seems to be working. Corrections in any one of the program or an entirely new approach is welcome. I have list of User_names and I am trying to lookup user profile and pull the geolocation from the profile or timeline. I could not find much of samples anywhere

How to extract only texts in hashtag using tweepy?

大憨熊 提交于 2019-12-01 01:11:47
I want to extract hashtags for my sentiment analysis project, however I'm getting a list of dictionary containing all the hashtags along with their indices in the tweet. I only want the text. My code : data = tweepy.Cursor(api.search, q, since=a[i], until=b[i]).items() tweet_data = [] tweets = pd.DataFrame() tweets['Tweet_ID'] = map(lambda tweet: tweet['id'], tweet_data) tweets['Tweet'] = map(lambda tweet: tweet['text'].encode('utf-8'), tweet_data) tweets['Date'] = map(lambda tweet: time.strftime('%Y-%m-%d %H:%M:%S', time.strptime(tweet['created_at'],'%a %b %d %H:%M:%S +0000 %Y')), tweet_data)