使用特定用户的#标签过滤推文

问题描述 投票:0回答:1

我想过滤来自具有特定#hashtag的特定用户的推文。我正在使用Tweepy软件包和Python。

这是我的代码:

tt=tweepy.Cursor(api.user_timeline,
      q='#eko_kendimenotlar',
      id=42209639,
      page=1,
      count=10,
      tweet_mode='extended').items()

for i in tt:
    print(i.full_text)

但是我从用户那里获得了所有Tweet,而不是由#标签过滤掉了。

python python-3.x twitter tweepy tweets
1个回答
0
投票

API.user_timeline method / API.user_timeline不接受GET statuses/user_timeline endpoint参数。

您必须自己过滤它们。您可以只检查每个Tweet文本中的主题标签。

[另一种方法是使用qentities属性,这些属性是Tweet objects包含entities objects字段,这些字段是hashtags的数组,表示已从Tweet文本中解析的主题标签。] >

或者,您可以使用hashtag objects / API.searchAPI.search the standard search API

© www.soinside.com 2019 - 2024. All rights reserved.