Skip to content

Commit

Permalink
fix downloads
Browse files Browse the repository at this point in the history
  • Loading branch information
dimdenGD committed Apr 2, 2024
1 parent 3894ea4 commit 84638b2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion scripts/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion scripts/twchallenge.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {};
Expand Down
2 changes: 1 addition & 1 deletion scripts/tweetviewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 84638b2

Please sign in to comment.