是否可以使用 tweepy 或 twython 为推文 ID 列表流式传输推文? 我正在尝试使用 Twython 推文 = t.lookup_status(id=Id)
'Id' 遍历 tweet-ids 列表
但我猜有速率限制,在 tweepy 的情况下,使用 StreamListener,我只能获取某些特定轨道的推文。在我的例子中,我有一个 tweet_ids 列表,我需要 tweet-text、created_at、source、url 等... 或者这个任务还有其他选择吗? 我对此很陌生。如果问题很幼稚,请原谅!
请您参考如下方法:
我不太清楚你在找什么,但你可以使用以下代码片段找到与特定推文 ID 匹配的推文(前提是你有 consumer_key,consumer_secret 、access_token 和来自 Twitter API 的 access_token_secret:
import tweepy
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
public_tweets = api.home_timeline()
good_tweet_ids = [555175389383774208, 555174725136437248]
for tweet in public_tweets:
if tweet.id in good_tweet_ids:
print "".join(x for x in tweet.text if ord(x) < 128)
