我想过滤来自具有特定#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,而不是由#标签过滤掉了。
API.user_timeline
method / API.user_timeline
不接受GET statuses/user_timeline endpoint参数。
您必须自己过滤它们。您可以只检查每个Tweet文本中的主题标签。
[另一种方法是使用q
的entities
属性,这些属性是Tweet objects包含entities objects字段,这些字段是hashtags
的数组,表示已从Tweet文本中解析的主题标签。] >
或者,您可以使用hashtag objects / API.search
和API.search
the standard search API。