Skip to content

Commit

Permalink
Add support for amplify_video_thumb URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
AlttiRi authored Oct 18, 2024
1 parent 9cdf446 commit 672f570
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions twitter-click-and-save.user.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ==UserScript==
// @name Twitter Click'n'Save
// @version 1.12.2-2024.08.17
// @version 1.13.0-2024.10.18
// @namespace gh.alttiri
// @description Add buttons to download images and videos in Twitter, also does some other enhancements.
// @match https://twitter.com/*
Expand Down Expand Up @@ -540,7 +540,7 @@ function hoistFeatures() {
const isMobileVideo = img.src.includes("ext_tw_video_thumb") || img.src.includes("amplify_video_thumb") || img.closest(`a[aria-label="Embedded video"]`) || img.alt === "Animated Text GIF" || img.alt === "Embedded video"
|| img.src.includes("tweet_video_thumb") /* GIF thumb */;
if (isMobileVideo) {
await Features.mobileVideoHandler(img, isThumb);
await Features.mobileVideoHandler(img, isThumb); // thumbVideoHandler
continue;
}

Expand Down Expand Up @@ -682,7 +682,7 @@ function hoistFeatures() {


// Quick Dirty Fix // todo refactor
static async mobileVideoHandler(imgElem, isThumb) { // + thumbVideoHandler
static async mobileVideoHandler(imgElem, isThumb) { // thumbVideoHandler // todo rename?
verbose && console.log("[ujs][mobileVideoHandler][vid]", imgElem);

const btn = Features.createButton({isVideo: true, url: imgElem.src, isThumb});
Expand Down Expand Up @@ -721,7 +721,7 @@ function hoistFeatures() {
static async multiMediaThumbHandler(imgElem) {
verbose && console.log("[ujs][multiMediaThumbHandler]", imgElem);
let isVideo = false;
if (imgElem.src.includes("/ext_tw_video_thumb/")) {
if (imgElem.src.includes("/ext_tw_video_thumb/") || imgElem.src.includes("/amplify_video_thumb/")) {
isVideo = true;
}

Expand Down

0 comments on commit 672f570

Please sign in to comment.