From 84638b2dfd157b8951bb0afab7f8048f616ea1a0 Mon Sep 17 00:00:00 2001 From: dimden <26517362+dimdenGD@users.noreply.github.com> Date: Tue, 2 Apr 2024 16:10:53 +0300 Subject: [PATCH] fix downloads --- scripts/helpers.js | 2 +- scripts/twchallenge.js | 2 +- scripts/tweetviewer.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/helpers.js b/scripts/helpers.js index 08d455e8..9f3a5871 100644 --- a/scripts/helpers.js +++ b/scripts/helpers.js @@ -3502,7 +3502,7 @@ async function appendTweet(t, timelineContainer, options = {}) { if (item.type === 'photo') { url.searchParams.set("name", "orig"); // force original resolution } - fetch(url).then(res => res.blob()).then(blob => { + _fetch(url).then(res => res.blob()).then(blob => { downloading = false; let a = document.createElement('a'); a.href = URL.createObjectURL(blob); diff --git a/scripts/twchallenge.js b/scripts/twchallenge.js index e730a272..100d0bde 100644 --- a/scripts/twchallenge.js +++ b/scripts/twchallenge.js @@ -66,7 +66,7 @@ window.addEventListener('message', e => { } }); -let _fetch = window.fetch; +window._fetch = window.fetch; fetch = async function(url, options) { if(!url.startsWith('https://twitter.com/i/api') && !url.startsWith('https://api.twitter.com')) return _fetch(url, options); if(!options) options = {}; diff --git a/scripts/tweetviewer.js b/scripts/tweetviewer.js index bcaf03bc..aef482a8 100644 --- a/scripts/tweetviewer.js +++ b/scripts/tweetviewer.js @@ -2442,7 +2442,7 @@ class TweetViewer { downloading = true; let media = t.extended_entities.media[0]; let url = media.type === 'photo' ? media.media_url_https : media.video_info.variants[0].url; - fetch(url).then(res => res.blob()).then(blob => { + _fetch(url).then(res => res.blob()).then(blob => { downloading = false; let a = document.createElement('a'); a.href = URL.createObjectURL(blob);