Tweety一次查找多条推文的扩展推文?

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

我正在使用tweepy来访问大量的推文。很多推文都被截断了,所以我想得到一些推文的全文,我有这个推文。

我的问题是: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')
python api twitter tweepy
1个回答
1
投票

正如Andy Piper指出的那样,这个问题在最近更新的Tweepy库中得到了解决,因此正在运行

pip install tweepy --upgrade

解决这个问题。

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