简体   繁体   中英

Extracting tweets with tweepy

I have tried using tweepy to extract tweets for a specific keyword.But the count of extracted tweets using tweepy is less compared those tweets for the specific keyword as seen on twitter search. Also I want to know how to effectively extract ALL the tweets for a specific keyword of interest using any twitter data extracting library (tweepy/twython). I also face a problem of irrelevant tweets with same keyword coming up.Is there a way to fine tune search and perform accurate extraction so that I get all the tweets extracted for the specific keyword. Im adding the code snippet as many asked for it.But I don't have a problem with the code as its running.

tweets = api.search('Mexican Food', count=500,tweet_mode = 'extended')
data = pd.DataFrame(data=[tweet.full_text for tweet in tweets], columns 
['Tweets'])
data.head(10)
print(tweets[0].created_at)

My question is that how to get ALL the tweets with a particular keyword.For example when I run the above code ,for each time I am getting different count of tweets.Also I cross checked with doing manual search on twitter and it seems that there are much more tweets than extracted through tweepy for the particular keyword. Also I want to know if there is any way to fine tune the keyword search through python so that all the relevant tweets for my keyword of interest is fetched.

The thing is when you use tweepy It has some limitation. It won't be able to fetch older tweets. So I will suggest you to use https://github.com/Jefferson-Henrique/GetOldTweets-python in place of tweepy to fetch the older tweets.

Since you refuse to help me with your question, I'll do the bare minimum with my answer:

You are probably not doing pagination correctly

ps: Check out the stack overflow guidelines . There is an important point about Helping others reproduce the problem

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM