【发布时间】:2021-05-29 03:33:21
【问题描述】:
我已阅读用于实现高级搜索 API 版本的 Twitter 搜索 API 2.0 新版本的完整文档。目前,我正在使用 python 从 Twitter 获取推文,并且正在使用 searchtweets 库来实现它。我已经在我的开发者门户中设置了免费的高级搜索 API 层。
问题 - 当我尝试获取基于 $CASHTAGS (如 $AMZN)的推文时,它说不允许使用 $CASHTAGS,但根据文档,我可以使用 $CASHTAGS 过滤。
我的代码 -
account_type = 'premium'
endpoint = 'https://api.twitter.com/1.1/tweets/search/fullarchive/development.json'
from searchtweets import gen_rule_payload
from searchtweets import ResultStream
query = '($AMZN)'
rule = gen_rule_payload(query, results_per_call=100, from_date="2021-02-01", to_date="2021-02-10")
rs = ResultStream(rule_payload=rule,
max_results=3000,
**premium_search_args)
for tweet in rs.stream():
print(tweet)
错误 -
HTTP Error code: 422: {"error":{"message":"There were errors processing your request:
Reference to invalid operator 'cashtag'. Operator is not available in current product or product packaging.}}
【问题讨论】:
标签: python api twitter data-science data-mining