在 tweepy 中过滤 [英] Filtering in tweepy

查看:33
本文介绍了在 tweepy 中过滤的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 tweepy 的新手,遇到了一个问题.我想下载带有特殊标签的推文.不过好像

I am new to tweepy and have encountered a problem. I want to download tweets with special hashtags. But it seems

stream.filter(track = ['word1', 'word2', 'word3']) 

在推文中而不是在推文的主题标签中查找这些词.如何过滤主题标签?

looks for these words in tweet and not in hashtags of the tweet. How can I filter on hashtags?

推荐答案

您可以在状态对象中找到标记.在那里你必须与你正在寻找的人进行比较.

You find the tags in the status object. It is there you have to make the comparison with the ones you are looking for.

示例:

for hashtag in status.entities['hashtags']:
    print(hashtag['text'])

示例:http://www.pythoncentral.io/tweepy-twitter-for-python 简介/

这篇关于在 tweepy 中过滤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆