简体   繁体   中英

How to search more than one word in a single tweet at the tweepy?

I need to search for tweets that have a set of words, but when I enter the search terms, they are searched independently.

For example, if I use this following parameter to search for "WORDS = ['amazon fire', 'rainforest fires']", the results are tweets containing 'amazon' or 'fire' or 'rainforest' or 'fires', not a tweet featuring 'amazon fire' and others containing 'rainforest fires'.

WORDS = ['amazon fire', 'amazon Forest', 'amazon rainforest fires', 'amazon blazes', 'amazon burning']

I hope the result is a tweet that contains more than one independently searched word. Like a tweet that is 'The Amazon in Brazil is on fire' and not a tweet 'I set my keyboard on fire'

The full code can be found here: https://pastebin.com/zSZfhA02

You code is right and is working as espected.

But the WORDS you are looking for are in the quoted_status or the retweeted_status , if exists in the data.

You can read for further informations here :

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