tweepy

Get to stream tweets from users a user is following using tweepy

ぃ、小莉子 提交于 2021-02-20 04:49:49
问题 I'm using Tweepy Streaming methods to try to get all the tweets from a specific user, both the ones the user created and those coming to his timeline from other users the user is following. I've tried several combinations, this one, for instance, using the user ID, only gives me the tweets that the user pushes: l = StreamListener() streamer = tweepy.Stream(auth=auth, listener=l) streamer.filter(follow=['3071126254']) The rest of trials all lead me to constant 406 responses from Twitter: l =

Get to stream tweets from users a user is following using tweepy

為{幸葍}努か 提交于 2021-02-20 04:49:04
问题 I'm using Tweepy Streaming methods to try to get all the tweets from a specific user, both the ones the user created and those coming to his timeline from other users the user is following. I've tried several combinations, this one, for instance, using the user ID, only gives me the tweets that the user pushes: l = StreamListener() streamer = tweepy.Stream(auth=auth, listener=l) streamer.filter(follow=['3071126254']) The rest of trials all lead me to constant 406 responses from Twitter: l =

Append tweet's media, expanded links, quotes to the tweet text using Tweepy

妖精的绣舞 提交于 2021-02-20 04:26:25
问题 For instance, with my current code, this tweet shows as: Stunning ride through the Oxfordshire lanes this morning to get the legs ready for the Fast Test… https:// t.co/W0uFKU9jCr I want to look like as it shown on Twitter's website, e.g.: Stunning ride through the Oxfordshire lanes this morning to get the legs ready for the Fast Test… https://www.instagram.com/p/BSocl5Djf5v/ How can I do this exactly? I mean replacing Twitter's short urls by the urls of media, expanded urls, tweet quotes...

Append tweet's media, expanded links, quotes to the tweet text using Tweepy

◇◆丶佛笑我妖孽 提交于 2021-02-20 04:26:07
问题 For instance, with my current code, this tweet shows as: Stunning ride through the Oxfordshire lanes this morning to get the legs ready for the Fast Test… https:// t.co/W0uFKU9jCr I want to look like as it shown on Twitter's website, e.g.: Stunning ride through the Oxfordshire lanes this morning to get the legs ready for the Fast Test… https://www.instagram.com/p/BSocl5Djf5v/ How can I do this exactly? I mean replacing Twitter's short urls by the urls of media, expanded urls, tweet quotes...

Tweepy search query issues

旧时模样 提交于 2021-02-19 07:01:52
问题 I'm working on a program to analyse data using Twitter's REST API, I looking to use a query with multiple keywords to get the results I'm looking for. However, I'm having issues when using a search query to get specific results. I have followed the documentation to use 'OR' search for multiple words but it's only working to a certain extent. In this code when I use the query: q = ('plane fly OR car drive -filter:retweets AND filter:replies') It returns tweets that either include the words

Using tweepy to stream users' timeline and filtered tweets

怎甘沉沦 提交于 2021-02-18 11:25:06
问题 I started exploring tweepy a couple days ago and was able to stream filtered (with keywords) tweets at real time. Now I want to stream not only filtered tweets but also tweets from several specific twitter users. Is this possible by using tweepy? It seems stream.userstream() only fetches real-time tweets from my twitter account NOT from other specific users, right? I have tried it with another twitter account that I created for testing but it does not fetch any new tweets that I tweeted, at

Tweepy to sqlite3

亡梦爱人 提交于 2021-02-17 06:59:07
问题 I'm trying to use Twitter's Streaming API to save tweets to a database using sqlite3. The problem is my database comes back empty. I'm using DB Browser for SQLIte to check the schema and the table and columns are there but no values for any column. Any thoughts? #create sql table conn = sqlite3.connect('twitter_one5.db') c = conn.cursor() c.execute('''CREATE TABLE tweets (coordinates integer, place text)''') conn.commit() conn.close() # open connection conn = sqlite3.connect('twitter_one5.db'

How to get the full text of a tweet using tweepy?

假如想象 提交于 2021-02-17 05:33:46
问题 I'm using tweepy.Cursor to extract past tweets of a particular topic, however if the tweet is really long it truncates it. I am using the full_text property to be True, but still it doesn't fix it. How to fix this? MY code is here: auth = tweepy.OAuthHandler(consumer_key, consumer_secret) auth.set_access_token(access_token, access_token_secret) API = tweepy.API(auth) csvFile = open('tweets2.csv', 'a') csvWriter = csv.writer(csvFile) for tweet in tweepy.Cursor(API.search,q="$EURUSD",count=1000

How to get the full text of a tweet using tweepy?

雨燕双飞 提交于 2021-02-17 05:33:07
问题 I'm using tweepy.Cursor to extract past tweets of a particular topic, however if the tweet is really long it truncates it. I am using the full_text property to be True, but still it doesn't fix it. How to fix this? MY code is here: auth = tweepy.OAuthHandler(consumer_key, consumer_secret) auth.set_access_token(access_token, access_token_secret) API = tweepy.API(auth) csvFile = open('tweets2.csv', 'a') csvWriter = csv.writer(csvFile) for tweet in tweepy.Cursor(API.search,q="$EURUSD",count=1000

Tweepy returns inconsistent and not complete results for realDonaldTrump

≡放荡痞女 提交于 2021-02-11 14:03:23
问题 import tweepy import csv import json import nltk import re def scrub_text(string): nltk.download('words') words = set(nltk.corpus.words.words()) string=re.sub(r'[^a-zA-Z]+', ' ', string).lower() string=" ".join(w for w in nltk.wordpunct_tokenize(string) if w.lower() in words or not w.isalpha()) return string def get_all_tweets(): with open('twitter_credentials.json') as cred_data: info=json.load(cred_data) consumer_key=info['API_KEY'] consumer_secret=info['API_SECRET'] access_key=info['ACCESS