Skip to content
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

api/twitter: got rate limit try with cookies #969

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions api/src/processing/services/twitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ export default async function({ id, index, toGif, dispatcher, alwaysProxy }) {
tweet = await requestTweet(dispatcher, id, guestToken)
}

// if the tweet reached the rate limit, we need to retry with the cookie
if ([404].includes(tweet.status)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

404 is not a rate limit http code, 429 is. does twitter actually return 404 on rate limit response?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, why put it in an array if it's just one http code?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

404 is not a rate limit http code, 429 is. does twitter actually return 404 on rate limit response?

sometimes yeah. it's like a discourage response.

also, why put it in an array if it's just one http code?

was thinking to support another code if is needed. but could be a without it

tweet = await requestTweet(dispatcher, id, guestToken, cookie);
}

tweet = await tweet.json();

let tweetTypename = tweet?.data?.tweetResult?.result?.__typename;
Expand Down