From 0c3fed81c9da80b09ffa3414ceacb241f526c599 Mon Sep 17 00:00:00 2001 From: Juan Cuzmar Date: Fri, 29 Nov 2024 16:31:48 -0300 Subject: [PATCH] api/twitter: got rate limit try with cookies --- api/src/processing/services/twitter.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/api/src/processing/services/twitter.js b/api/src/processing/services/twitter.js index b4a1d557..d55af4e1 100644 --- a/api/src/processing/services/twitter.js +++ b/api/src/processing/services/twitter.js @@ -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)) { + tweet = await requestTweet(dispatcher, id, guestToken, cookie); + } + tweet = await tweet.json(); let tweetTypename = tweet?.data?.tweetResult?.result?.__typename;