如何使用 python 通过 tweet-ID 获取旧推文?
How to get old tweets by tweet-ID using python?
我使用的是 Tweepy,但正如我在 link (Older tweets Tweepy using Python) 中发现的那样,我无法使用 tweppy 获取较旧的推文。
我找到了一些库来获取较旧的推文,但我无法通过它们的 ID 获取它们。
有人知道我怎样才能得到它吗?
我相信您可以使用 tweepy 查找推文,无论它们使用多长时间 get_status()
例子
# import tweepy
import tweepy
# api keys from twitter developers
consumer_key='<your consumer_key here>'
consumer_secret='<your consumer_secret here>'
access_token='<your access_token here>'
acess_token_sectret='<your acess_token_sectret here>'
# login to twitter
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, acess_token_sectret)
auth.secure = True
api = tweepy.API(auth)
# define the id of the tweet you are looking for
id = 1181329749966295041
# get the tweet
tweet = api.get_status(id)
# print the text of the tweet
print(tweet.text)
我使用的是 Tweepy,但正如我在 link (Older tweets Tweepy using Python) 中发现的那样,我无法使用 tweppy 获取较旧的推文。
我找到了一些库来获取较旧的推文,但我无法通过它们的 ID 获取它们。
有人知道我怎样才能得到它吗?
我相信您可以使用 tweepy 查找推文,无论它们使用多长时间 get_status()
例子
# import tweepy
import tweepy
# api keys from twitter developers
consumer_key='<your consumer_key here>'
consumer_secret='<your consumer_secret here>'
access_token='<your access_token here>'
acess_token_sectret='<your acess_token_sectret here>'
# login to twitter
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, acess_token_sectret)
auth.secure = True
api = tweepy.API(auth)
# define the id of the tweet you are looking for
id = 1181329749966295041
# get the tweet
tweet = api.get_status(id)
# print the text of the tweet
print(tweet.text)