tweepy

Twitter streaming by locations

二次信任 提交于 2019-12-08 08:16:42
问题 I use tweepy to stream tweets filtered by location coordinates. Currently I've been streaming tweets from two different neighborhoods in a city and found out that the tweets are the same despite difference in the coordinates (they are non-overlapping areas). Is there a resolution of the coordinates up to which the twitter API can filter the tweets? Here's a sample code for a streamer: (Code with sample locations) import handler from tweepy import Stream from tweepy import OAuthHandler from

Twitter api searching tweets for hashtags

与世无争的帅哥 提交于 2019-12-08 08:03:29
I am new to twitter api and I have spend tremendous amount of time trying to figure this out. I would like to extract a large number (100k - 1m) of tweets for a given search term from most recent tweets. I tried working with tweepy and I was able to setup a stream but I need the data from past as well. I also tried following code but it only gives me 100 at a time and I don't understand how to use since_id and max_id to run through past tweets. Also if someone knows how to extract hashtags from a post. Currently I am splitting the words in posts and finding words with "#" but api.search has an

Return Unique Tweet id with Tweepy Json

天大地大妈咪最大 提交于 2019-12-08 06:45:27
问题 Looking to either return and create myself or capture a unique tweet_id for each tweet that is parsed... class listener(StreamListener): def on_data(self, data): all_date = json.load(data) tweet = all_data["text"] username = all_data["user"]["screen_name"] here I'd like to create a variable called tweet_id and return that from a corresponding value within all_data and or create my own id system 回答1: First of all I think you may have meant json.loads() notice the s . json.load() is use to read

Search twitter feeds with Tweepy

霸气de小男生 提交于 2019-12-08 06:20:28
问题 Thanks to @Nirvana Tikku, he solved my question on how to talk with Tweepy and perform simple search in this Question. The below are a series of code summary on how i authenticate my tweepy on GAE. import tweepy creds = json.loads(open('credential.json').read()) tw_consumer_key = creds['tw_consumer_key'] tw_consumer_secret = creds['tw_consumer_secret'] tw_access_token = creds['tw_access_token'] tw_access_token_secret = creds['tw_access_token_secret'] try: auth = tweepy.OAuthHandler(tw

Parsing Twitter JSON object in Python

梦想与她 提交于 2019-12-08 05:57:15
问题 I am trying to download tweets from twitter. I have used python and Tweepy for this. Though I am new to both Python and Twitter API. My Python script is as follow: #!usr/bin/python #import modules import sys import tweepy import json #global variables consumer_key = '' consumer_secret = '' token_key = '' token_secret = '' #Main function def main(): print sys.argv[0],'starts' auth = tweepy.OAuthHandler(consumer_key, consumer_secret) auth.set_access_token(token_key, token_secret) print

Older tweets Tweepy using Python

孤街醉人 提交于 2019-12-08 04:31:44
问题 I am trying to get older tweet data (approximately 2 months old) using tweepy in Python. I tried since and until parameters but no success. Has anyone got a work around in tweepy or some other API. for id,tweet in enumerate (tweepy.Cursor(api.search, q='SpecificWord', since="2016-04-26", until="2016-04-28", lang="en", include_retweets=False ).items(200)): #Write a row to the csv file CSVW.writerow([tweet.created_at, tweet.retweet_count, tweet.text.encode('utf-8')]) 回答1: This is not possible.

Where to exclude retweets in this tweepy script?

戏子无情 提交于 2019-12-08 03:36:50
问题 I have the following code which allows me to view a stream of 1% of the twitter firehose via python: import sys import tweepy consumer_key="" consumer_secret="" access_key = "" access_secret = "" auth = tweepy.OAuthHandler(consumer_key, consumer_secret) auth.set_access_token(access_key, access_secret) api = tweepy.API(auth) class CustomStreamListener(tweepy.StreamListener): def on_status(self, status): if '' in status.text.lower(): print status.text print status.coordinates def on_error(self,

Passing data between classes in Tweepy and Tornado WebSocket

拜拜、爱过 提交于 2019-12-08 01:56:59
问题 I have two main modules, Tornado WebSocket and Tweepy Streaming, and I'm trying to get them to talk to each other. Under on_status in the StdOutListener Tweepy class below (marked with <-- ), I'd like to call the WSHandler.on_message Tornado class higher up, with data passed from on_status . I'm not able to do so however, as I get error-messages related to undefined instances etc. with the code below. Any help greatly appreciated! (Also, the only non-blocking way I've managed to run both

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

六月ゝ 毕业季﹏ 提交于 2019-12-07 23:17:25
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' csecret = 'xxx' atoken = 'xxx' asecret = 'xxx' # OAuth process, using the keys and tokens auth =

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

不问归期 提交于 2019-12-07 23:16:39
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' csecret = 'xxx' atoken = 'xxx' asecret = 'xxx' # OAuth process, using the keys and tokens auth =