这是this question的后续问题。我想获取转发特定推文的用户的 ID。
我尝试使用相同的技术,但出现错误。这是代码:
import tweepy
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_token(ACCESS_KEY, ACCESS_SECRET)
api = tweepy.API(auth)
firstTweet = api.user_timeline("github")[0]
print firstTweet.text
print firstTweet.id
results = api.retweeted_by(firstTweet.id)
print results
这将返回第一条推文以及推文 ID。然后它给了我以下错误:
Traceback (most recent call last):
File "twitter_test.py", line 21, in <module>
results = api.retweeted_by("357237988863913984")
File "/usr/local/lib/python2.7/dist-packages/tweepy-2.1-py2.7.egg/tweepy/binder.py", line 197, in _call
return method.execute()
File "/usr/local/lib/python2.7/dist-packages/tweepy-2.1-py2.7.egg/tweepy/binder.py", line 173, in execute
raise TweepError(error_msg, resp)
tweepy.error.TweepError: [{u'message': u'Sorry, that page does not exist', u'code': 34}]