Skip to content

Commit

Permalink
More websites/rules
Browse files Browse the repository at this point in the history
  • Loading branch information
qsniyg committed Nov 28, 2024
1 parent a447484 commit 177586e
Show file tree
Hide file tree
Showing 3 changed files with 194 additions and 49 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ Improvements:

* Various improvements/fixes to existing rules (including Pinterest, YouTube)

Special thanks to nimbuz, remlap, Solus, immewnity, Froktime, billkewl, Broly, fyhtma, vscum, acidzab, sn3akyb3ar, ValiumBear, fireattack, NeverForgotten, liamengland1, mantou, siloricity, adz, RAT, DoomTay, byjrg for their contributions and reports for this release
Bugfixes:

* Fix bad images preventing more than one fallback image from being tried

Special thanks to nimbuz, remlap, Solus, immewnity, Froktime, billkewl, Broly, fyhtma, vscum, acidzab, sn3akyb3ar, ValiumBear, fireattack, NeverForgotten, liamengland1, mantou, siloricity, adz, RAT, DoomTay, byjrg, Liz for their contributions and reports for this release

---

Expand Down
114 changes: 95 additions & 19 deletions src/userscript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19615,7 +19615,12 @@ var $$IMU_EXPORT$$;
return result;
};

var add_full_extensions2 = function(url:string, options?) {
type AddFullExtensions2Options = {
extensions?: Array<string>,
prefer_order?: boolean,
add_video?: boolean
};
var add_full_extensions2 = function(url:string, options?:AddFullExtensions2Options) {
if (!options) {
options = {};
}
Expand All @@ -19626,11 +19631,19 @@ var $$IMU_EXPORT$$;
let new_urls = add_full_extensions(url, options.extensions, options.prefer_order);
if (options.add_video) {
for (let i = 0; i < new_urls.length; i++) {
if (/\.(?:mp4|webm)$/.test(new_urls[i])) {
new_urls[i] = {
url: new_urls[i],
video: true
};
let src = new_urls[i];
if (typeof src !== "string")
src = src.url;

if (/\.(?:mp4|webm)(?:[?#].*)?$/i.test(src)) {
if (typeof new_urls[i] === "string") {
new_urls[i] = {
url: src,
video: true
};
} else {
new_urls[i].video = true;
}
}
}
}
Expand Down Expand Up @@ -32587,7 +32600,11 @@ var $$IMU_EXPORT$$;
return decodeURIComponent(newsrc);
}

if (domain_nowww === "gala.fr") {
if (domain_nowww === "gala.fr"
// thanks to anonymous for reporting:
// https://www.capital.fr/imgre//fit/http.3A.2F.2Fprd2-bone-image.2Es3-website-eu-west-1.2Eamazonaws.2Ecom.2Fcap.2F2017.2F05.2F09.2F1c21c36a-b809-4662-bf09-1068218410b9.2Ejpeg/896x504/focus-point/50%2C50/background-color/ffffff/quality/70/picture.jpg
//domain_nowww === "capital.fr"
) {
// thanks to anonymous for reporting:
// http://www.gala.fr/imgre/fit/https.3A.2F.2Fwww.2Egala.2Efr.2Fimgre.2Ffit.2Fhttps.2E3A.2E2F.2E2Fi.2E2Epmdstatic.2E2Enet.2E2Fgal.2E2F2023.2E2F02.2E2F24.2E2F1236eecd-78f3-48e5-9160-1908c9718578.2E2Ejpeg.2F1120x747.2Fquality.2F80.2Fthumbnail.2Ejpg/480x320/quality/80/picture.jpg
// https://i.pmdstatic.net/gal/2023/02/24/1236eecd-78f3-48e5-9160-1908c9718578.jpeg
Expand Down Expand Up @@ -34077,6 +34094,9 @@ var $$IMU_EXPORT$$;
// thanks to Liz on discord:
// https://www.azcentral.com/gcdn/presto/2023/06/05/PPHX/d14cdd74-f08e-4aeb-8698-d8a1d856cba4-20230604161124_-_FFusion.jpg?width=1320&height=880&fit=crop&format=pjpg&auto=webp
(domain_nowww === "azcentral.com" && /\/gcdn\//.test(src)) ||
// thanks to Liz on discord:
// https://www.tennessean.com/gcdn/authoring/authoring-images/2024/09/21/USAT/75316038007-charli-xcx-troye-sivan-2024-tour.jpg?width=1200&disable=upscale&format=pjpg&auto=webp
(domain_nowww === "tennessean.com" && /\/gcdn\//.test(src)) ||
// thanks to James Joint on discord:
// https://images.kerrangcdn.com/images/2023/05/NessaBarrett-JamieLeeTaete-2023-9.jpg?auto=compress&fit=max&w=640
domain === "images.kerrangcdn.com" ||
Expand Down Expand Up @@ -71279,7 +71299,7 @@ var $$IMU_EXPORT$$;
// https://endchan.net/.media/t_2fdd7a2250a106cec0e513dec3b30a83-imagepng
// https://endchan.net/.media/2fdd7a2250a106cec0e513dec3b30a83-imagepng.png
domain_nowww === "endchan.net" ||
/:\/\/[^/]+\/+\.(?:media\/+t_[0-9a-f]{32,64}(?:-image[a-z]+)?|static\/+images\/+404-[0-9]+\.png)(?:[?#].*)?$/) {
/:\/\/[^/]+\/+\.(?:media\/+t_[0-9a-f]{32,64}(?:-image[a-z]+)?|static\/+images\/+404-[0-9]+\.png)(?:[?#].*)?$/.test(src)) {
// https://kohlchan.net/.static/images/404-200.png
if (/\/\.static\/+images\/+404-/.test(src))
return {
Expand All @@ -71295,9 +71315,11 @@ var $$IMU_EXPORT$$;
if (newsrc !== src)
return newsrc;

newsrc = src.replace(/\/\.media\/+t_([0-9a-f]{20,})(?:[?#].*)?$/, "/.media/$1.jpg");
newsrc = src.replace(/\/\.media\/+t_([0-9a-f]{20,})(?:[?#].*)?$/, "/.media/$1");
if (newsrc !== src) {
return add_full_extensions2(newsrc, {extensions: ["jpg", "png", "mp4", "gif"]});
let urls = add_full_extensions2(newsrc + ".jpg", {extensions: ["jpg", "png", "mp4", "webm", "gif"]});
urls.unshift(newsrc);
return urls;
}
}

Expand Down Expand Up @@ -96691,6 +96713,17 @@ var $$IMU_EXPORT$$;
// = {"bucket":"tumblbug-img-assets","key":"story/4dc5d322-d4a3-44f7-b0fb-48ce1b4ed096/322b339d-77ba-4bae-bab5-aa2706191baf.jpg","edits":{"resize":{"width":1240,"withoutEnlargement":true}}}
domain === "img.tumblbug.com" ||
// thanks to anonymous for reporting:
// https://d193frjqb908ar.cloudfront.net/eyJidWNrZXQiOiJtaWxlc3BsaXQiLCJrZXkiOiJwaG90b3NcLzYyODg5XC9ub3JtYWxcLzQwOTQ5ODE1IiwiZWRpdHMiOnsicmVzaXplIjp7IndpZHRoIjozMDAsImZpdCI6ImNvdmVyIiwicG9zaXRpb24iOiJjZW50ZXIiLCJoZWlnaHQiOjE2OX19fQ==?Expires=...
// https://milesplit.s3.amazonaws.com/photos/62889/normal/40949815
// atob:
// = {"bucket":"milesplit","key":"photos\/62889\/normal\/40949815","edits":{"resize":{"width":300,"fit":"cover","position":"center","height":169}}}
// other:
// https://d193frjqb908ar.cloudfront.net/eyJidWNrZXQiOiJmaWxlcy5taWxlc3BsaXQudXMiLCJrZXkiOiJhcnRpY2xlc1wvMzUwMDIzXC9pbWFnZXNcL2NvdmVyLTE3MjM4Mzg2MzMucG5nIiwiZWRpdHMiOnsicmVzaXplIjp7IndpZHRoIjoyMDAsImZpdCI6ImNvdmVyIiwicG9zaXRpb24iOiJjZW50ZXIiLCJoZWlnaHQiOjExM319fQ==?Expires=...
// https://milesplit.s3.amazonaws.com/articles/350023/images/cover-1723838633.png -- 403
// atob:
// = {"bucket":"files.milesplit.us","key":"articles\\/350023\\/images\\/cover-1723838633.png","edits":{"resize":{"width":200,"fit":"cover","position":"center","height":113}}}
domain === "d193frjqb908ar.cloudfront.net" ||
// thanks to anonymous for reporting:
// https://images.ams-prd.blv.cloud/eyJidWNrZXQiOiJpbWFnZXMtcHJkLTFvNHV6OXpieHd6cDF1Ym0iLCJrZXkiOiJkYTkwNjE5Yy0yOGVkLTRjMDYtOTkzNi03Y2EzNGE1NjI1MzQiLCJlZGl0cyI6eyJyZXNpemUiOnsid2lkdGgiOjM2MCwiaGVpZ2h0IjozNjB9fX0=
// https://images.ams-prd.blv.cloud/eyJidWNrZXQiOiJpbWFnZXMtcHJkLTFvNHV6OXpieHd6cDF1Ym0iLCJrZXkiOiJkYTkwNjE5Yy0yOGVkLTRjMDYtOTkzNi03Y2EzNGE1NjI1MzQifQ==
// atob:
Expand All @@ -96703,8 +96736,10 @@ var $$IMU_EXPORT$$;
match = src.match(/^([a-z]+:\/\/[^/]+\/+(?:resize\/+)?)([^-_/.]{20,})(?:[?#].*)?$/);
if (match) {
let orig_map = {
"cdn.gamerch.com": "https://cdn.gamerch.com/contents/",
"img.tumblbug.com": "https://img.tumblbug.com/"
"cdn.gamerch.com/gamerch-img-contents": "https://cdn.gamerch.com/contents/",
"img.tumblbug.com/tumblbug-img-assets": "https://img.tumblbug.com/",
"d193frjqb908ar.cloudfront.net/milesplit": "https://milesplit.s3.amazonaws.com/"
//"d193frjqb908ar.cloudfront.net/files.milesplit.us": ""
};

try {
Expand All @@ -96716,19 +96751,29 @@ var $$IMU_EXPORT$$;

let urls = [];

if (domain in orig_map) {
urls.push(orig_map[domain] + json.key);
let domainbucket = domain + "/" + (json.bucket||"");
if (domainbucket in orig_map) {
urls.push(orig_map[domainbucket] + json.key);
}

urls.push(host + base64_encode(JSON_stringify(json)));
if (!/[?&]Signature=/i.test(src))
urls.push(host + base64_encode(JSON_stringify(json)));

return urls;
if (urls.length > 0)
return urls;
} catch (e) {
console_error(e);
}
}
}

if (amazon_container === "milesplit") {
// thanks to anonymous for reporting:
// https://milesplit.s3.amazonaws.com/photos/62889/normal/40949815
// https://milesplit.s3.amazonaws.com/photos/62889/original/40949815
return src.replace(/(\/photos\/+[0-9]+\/+)normal\/+/, "$1original/");
}

if (domain === "imagery.zoogletools.com" ||
// https://s3.amazonaws.com/content.sitezoogle.com/u/243801/88f8a590bc091005ed1823c00dca5bc173e97c89/photo/rnr-interview.jpg
// https://s3.amazonaws.com/content.sitezoogle.com/u/243801/88f8a590bc091005ed1823c00dca5bc173e97c89/original/rnr-interview.jpg
Expand Down Expand Up @@ -116340,7 +116385,10 @@ var $$IMU_EXPORT$$;
if (domain === "i.daily.jp") {
// https://i.daily.jp/horse/2016/12/14/Images/09750568.jpg -- 447x450
// https://i.daily.jp/horse/2016/12/14/Images/f_09750568.jpg
return src.replace(/(\/Images\/+)([0-9]+\.[a-z]+)(?:[?#].*)?$/, "$1f_$2");
// thanks to nimbuz on discord:
// https://i.daily.jp/gossip/2024/11/09/Images/b_18323608.jpg
// https://i.daily.jp/gossip/2024/11/09/Images/f_18323608.jpg -- 427x960
return src.replace(/(\/Images\/+)(?:b_)?([0-9]+\.[a-z]+)(?:[?#].*)?$/, "$1f_$2");
}

if (domain_nowww === "dr-johanna-budwig.de") {
Expand Down Expand Up @@ -117460,6 +117508,20 @@ var $$IMU_EXPORT$$;
return src.replace(/(\/images\/+thumbs\/+[0-9]+)_[0-9]+\./, "$1.")
}

if (domain === "torontolife.mblycdn.com") {
// thanks to anonymous for reporting:
// https://torontolife.mblycdn.com/tl/resized/2024/11/w2560/image1.jpeg
// https://torontolife.mblycdn.com/uploads/tl/2024/11/image1.jpeg
return src.replace(/(:\/\/[^/]+\/+)([^/]+\/+)resized\/+([0-9]{4}\/+[0-9]{1,2}\/+)w[0-9]+\/+/, "$1uploads/$2$3");
}

if (domain === "img.elele.com.tr") {
// thanks to anonymous:
// https://img.elele.com.tr/rcman/Cw700h886q95gc/storage/files/images/2023/11/28/hazal-subasi4-q3rp.jpg
// https://i.elele.com.tr/storage/files/images/2023/11/28/hazal-subasi4-q3rp.jpg
return src.replace(/^[a-z]+:\/\/[^/]+\/+.*(\/storage\/)/, "https://i.elele.com.tr$1");
}




Expand Down Expand Up @@ -121458,9 +121520,20 @@ var $$IMU_EXPORT$$;
let oldobj = state.oldobj;

let already_tried_url = false;
let already_tried_nonbad_url = false;
for (let tried_url of state.tried_imus) {
if (tried_url === url) {
already_tried_url = true;

for (let t_url of state.tried_urls) {
if (t_url.url !== tried_url)
continue

if (!t_url.redirects_to_bad) {
already_tried_nonbad_url = true;
break;
}
}
}
}
state.tried_imus.push(url);
Expand Down Expand Up @@ -121491,6 +121564,9 @@ var $$IMU_EXPORT$$;
let index = array_indexof(image_urls, orig_url);
tried_urls[j].redirects_to_bad = true;

if (already_tried_nonbad_url && bad_url === url)
already_tried_nonbad_url = false;

if (index >= 0) {
obj.splice(index, 1);
image_urls.splice(index, 1);
Expand Down Expand Up @@ -121597,9 +121673,9 @@ var $$IMU_EXPORT$$;

//if (array_indexof(image_urls, newurl) < 0 && newurl !== url || true) {
var newurl_index = array_indexof(image_urls, newurl);
if (newurl_index < 0 && already_tried_url) {
if (newurl_index < 0 && already_tried_nonbad_url) {
if (_nir_debug_) {
console_log("bigimage_recursive_loop (query): already tried url", deepcopy(state));
console_log("bigimage_recursive_loop (query): already tried url", newurl, image_urls, deepcopy(state));
}
return options.cb(null, data);
}
Expand Down
Loading

0 comments on commit 177586e

Please sign in to comment.