-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
twitter: /statuses/retweets.json returns 403 Forbidden #688
Comments
error code 200 isn't listed in https://dev.twitter.com/overview/api/response-codes , and https://dev.twitter.com/rest/reference/get/statuses/retweets/%3Aid doesn't mention this error. however, https://twittercommunity.com/t/protected-tweets-with-statuses-retweets-id/12903/4 has lots of other people reporting the same thing: my best guess is this is intentional for protected accounts, so i should catch it and handle it. |
confirmed, same things happens with another protected account, snarfed_org: |
fixed by snarfed/granary@34a7bcb |
happening again, but an odd variant, for ianvellosa. example log below. we fetch his tweets with no matter i guess, fix is probably to just handle HTTP 403 + error code 200.
|
Does anyone have the same problem? I am using Tweepy 3.5.0 and having exactly the same problem... I just wrote the codes to save the forbidden tweet ids... # The dataframe contains the tweet id you are interested in
for index, row in dataframe.iterrows():
tweet_id = int(row['id'])
if tweet_id in processed_tweet_network:
print('The tweet {} has been processed'.format(tweet_id))
pass
else:
print('Coping with the {}th tweet: {}'.format(index+1, tweet_id))
while not tweet_id in processed_tweet_network:
try:
results = api.retweets(tweet_id)
name_list = []
id_list = []
for result in results:
retweeter_name = result.author.name
retweeter_id = result.author.id
name_list.append(retweeter_name)
id_list.append(retweeter_id)
retweeters_id_list.append(id_list)
retweeters_name_list.append(name_list)
processed_tweet_id_list.append(tweet_id)
processed_tweet_network[tweet_id] = 'Done'
# sleep for 5 seconds to reduce the probability of encountering the rate limit issue
time.sleep(5)
except tweepy.error.TweepError as e:
print(e.response.text)
if e.api_code == 88:
print('The rate limit has reached!')
current_time = datetime.today()
print('The current time is: {}'.format(datetime.today()))
future_time = datetime(current_time.year, current_time.month, current_time.day+1, 0, 0, 1)
print('Hence we will sleep for {} seconds'.format((future_time - current_time).seconds))
time.sleep((future_time - current_time).seconds)
print('We could start again!')
elif e.api_code == 200:
print('The access action is forbiddened...')
retweeters_id_list.append(['Forbiddened'])
retweeters_name_list.append(['Forbiddened'])
processed_tweet_id_list.append(tweet_id)
processed_tweet_network[tweet_id] = 'Forbiddened'
time.sleep(5)
else:
print('This tweet could not be accessed!')
print('The api code is: {}'.format(e.api_code))
retweeters_id_list.append(['Not authorized'])
retweeters_name_list.append(['Not authorized'])
processed_tweet_id_list.append(tweet_id)
processed_tweet_network[tweet_id] = 'Not authorized'
time.sleep(5) |
for https://brid.gy/twitter/iwontsignuphere , every poll. other API calls beforehand succeed. not sure why. we're incorrectly (maybe?) interpreting it as rate limiting.
example log:
The text was updated successfully, but these errors were encountered: