【发布时间】:2019-03-24 21:12:18
【问题描述】:
我正在使用 tweepy 访问大量推文。许多推文被截断,所以我想获取一些推文的全文,我有 id。
我的问题是:tweepy api 实例有一种方法可以一次下载多条推文(api.statuses_lookup),但这会返回截断的推文。 它还有一个包含完整推文文本(api.get_status)的方法,但 afaik 一次只接收一条推文。 有没有办法一次获取多条推文的全文?
import tweepy
consumer_key = "XXX"
secret = "XXX"
auth = tweepy.AppAuthHandler(consumer_key, secret)
auth.secure = True
api = tweepy.API(auth, wait_on_rate_limit=True, wait_on_rate_limit_notify=True)
ids = [1108360183586140161, 1108474125486641153]
# Finds tweets (up to 100 at a time), but doesn't contain extended text
foo = api.statuses_lookup(ids)
# Returns tweet, including extended text, but only for one at a time
bar = api.get_status(1108449077937635328, tweet_mode='extended')
【问题讨论】:
-
你是说api.statuses_lookup也不支持tweet_mode参数吗?
-
正确。尝试给出: statuses_lookup() got an unexpected keyword argument 'tweet_mode'
-
看来您需要 3.7.0 或更高版本 github.com/tweepy/tweepy/issues/840
-
啊,谢谢!如果对其他人有帮助,我会添加答案。