tweepy

Can I use twitter api to search tweets one week before?

人走茶凉 提交于 2019-12-24 04:45:12
问题 I am trying to search keywords in twitter through tweepy. However, I found it seems like that I can not search the tweets one week before, the code below is the main search code. for searched_tweets in tweepy.Cursor( API.search, q = "python", since = 2014-02-03, until = 2014-02-04, lang='en' ).items() I am not sure whether there is any limited or any better way to search by time, thanks for your help!! :) 回答1: Unfortunately, you can't get tweets older than a week with the twitter search API.

Stopping Tweepy stream after a duration parameter (# lines, seconds, #Tweets, etc)

瘦欲@ 提交于 2019-12-24 01:56:23
问题 I am using Tweepy to capture streaming tweets based off of the hashtag #WorldCup, as seen by the code below. It works as expected. class StdOutListener(StreamListener): ''' Handles data received from the stream. ''' def on_status(self, status): # Prints the text of the tweet print('Tweet text: ' + status.text) # There are many options in the status object, # hashtags can be very easily accessed. for hashtag in status.entries['hashtags']: print(hashtag['text']) return true def on_error(self,

Tweepy streaming error

强颜欢笑 提交于 2019-12-24 00:43:31
问题 I'm trying to analyze the sentiment of the tweets using tweepy and textblob. I did pip install tweepy and it was installed successfully, but I get the following error. Error Message: File "C:\Users\joshey\Desktop\sent.py", line 2, in import tweepy File "C:\Users\joshey\AppData\Local\Programs\Python\Python37\lib\site-packages\tweepy__init__.py", line 17, in from tweepy.streaming import Stream, StreamListener File "C:\Users\joshey\AppData\Local\Programs\Python\Python37\lib\site-packages\tweepy

Tweepy filter utf-8 encoding

一世执手 提交于 2019-12-23 04:26:28
问题 I have been working with the Tweepy and when I execute the filter of the tweepy passing non-ascii characters I have an error. For exemple, using the following command, I got the error below: My code: auth = tweepy.OAuthHandler(apikey[0], apikey[1]) auth.set_access_token(apikey[2], apikey[3]) api = tweepy.API(auth) sapi = tweepy.streaming.Stream(auth, CustomStreamListener()) sapi.filter(track=['eleições']) My error: Traceback (most recent call last): File "./TwitterStreamingAPI.py", line 81,

Tweepy API search doesn't have keyword

扶醉桌前 提交于 2019-12-23 03:14:52
问题 I am working with Tweepy (python's REST API client) and I'm trying to find tweets by several keywords and without url included in tweet. But search results are not up to our satisfaction. Looks like query has erros and was stopped. Additionally we had observed that results were returned one-by-one not (as previously) in bulk packs of 100. Could you please tell me why this search does not work properly? We wanted to get all tweets mentioning 'Amazon' without any URL links in the text. We used

Tweepy: tweepy.error.tweeperror 'code' 215 'message' 'bad authentication data.'

末鹿安然 提交于 2019-12-23 02:29:23
问题 I'm unsure what is going wrong in here. The following code was working until 2 days ago. I'm using tweepy version number 3.6.0 on python3 in jupyter notebook . Now, when I execute the code given below, I keep getting the error, TweepError: [{'code': 215, 'message': 'Bad Authentication data.'}] . What am I doing wrong? I've already looked at similar posts 1, 2,3,4,5 and 6 but no solution. Note, I have also regenerated the keys, still the error persists. The code is; import tweepy ckey = 'xxx'

Tweepy: Stream data for X minutes?

吃可爱长大的小学妹 提交于 2019-12-22 09:57:30
问题 I'm using tweepy to datamine the public stream of tweets for keywords. This is pretty straightforward and has been described in multiple places: http://runnable.com/Us9rrMiTWf9bAAW3/how-to-stream-data-from-twitter-with-tweepy-for-python http://adilmoujahid.com/posts/2014/07/twitter-analytics/ Copying code directly from the second link: #Import the necessary methods from tweepy library from tweepy.streaming import StreamListener from tweepy import OAuthHandler from tweepy import Stream

Filter images from tweets

主宰稳场 提交于 2019-12-22 09:29:57
问题 I am fresh to tweepy, and I wandering how is it possible to track down and store the image that a user posts in his/her tweets. I found several ways in tutorials to get user tweets, but I couldnt find a way to filter only the images. I am using the following code in order to get user tweets. How is it possible to get only user images?? EDIT: I edit my code like above: auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET) auth.set_access_token(OAUTH_TOKEN, OAUTH_SECRET) api = tweepy.API

Twitter API - Get number of followers of followers

ε祈祈猫儿з 提交于 2019-12-22 06:50:07
问题 I'm trying to get the number of followers of each follower for a specific account (with the goal of finding the most influencial followers). I'm using Tweepy in Python but I am running into the API rate limits and I can only get the number of followers for 5 followers before I am cut off. The account I'm looking at has about 2000 followers. Is there any way to get around this? my code snippet is ids = api.followers_ids(account_name) for id in ids: more = api.followers_ids(id) print len(more)

Save full text of a tweet with tweepy

梦想与她 提交于 2019-12-21 21:27:02
问题 I am a novice programmer in python. I am having troubles trying to extract the text of a series of tweets with tweepy and saving it to a text file (I ommit the authentication and stuff) search = api.search("hello", count=10) textlist=[] for i in range(0,len(search)): textlist.append( search[i].text.replace('\n', '' ) ) f = open('temp.txt', 'w') for i in range(0,len(idlist)): f.write(textlist[i].encode('utf-8') + '\n') But in some long tweets the text at the end is truncated, and a three dot