如何使用twitter API在python上进行精确的短语搜索?

时间:2017-08-12 18:12:24

标签: python python-3.x twitter

我正在python中编写一个程序,用于打印发出“我很高兴”,“我很难过”,“我很生气”等人的用户名。

emotionList = ["happy", "sad", "angry"... (many more)]

for type in emotionList:

    #append the emotion to "I'm feeling"
    query = '\"I feel ' + type + '\"'

    for tweet in tweepy.Cursor(api.search, q=query, lang="en").items():
        print(api.get_user(tweet.user.id).screen_name, tweet.text)

即使我在搜索字符串周围使用双引号(\“)(”我感觉“+列表中的字符串),搜索是相关的,而不是确切的关键字。我如何准确搜索关键字?

0 个答案:

没有答案
相关问题