best way to save what you love
Svelte collaborationdownloaderinstagramjavascriptmusicredditsocial-mediasoundcloudsveltetiktoktwittertypescriptvideovimeovkwebappyoutubeyoutube-downloader
api/twitter: handle 403 with no cookie in `requestTweet()`
wukko69dd37c5c336
diff --git a/api/src/processing/services/twitter.js b/api/src/processing/services/twitter.jsindex 0f5f15e6..8fd26ee3 100644--- a/api/src/processing/services/twitter.js+++ b/api/src/processing/services/twitter.js@@ -89,13 +89,16 @@ const requestTweet = async(dispatcher, tweetId, token, cookie) => {// we might have been missing the `ct0` cookie, retryif (result.status === 403 && result.headers.get('set-cookie')) {- result = await fetch(graphqlTweetURL, {- headers: {- ...headers,- 'x-csrf-token': cookie.values().ct0- },- dispatcher- });+ const cookieValues = cookie?.values();+ if (cookieValues?.ct0) {+ result = await fetch(graphqlTweetURL, {+ headers: {+ ...headers,+ 'x-csrf-token': cookieValues.ct0+ },+ dispatcher+ });+ }}return result