Skip to content

Commit

Permalink
More websites/rules
Browse files Browse the repository at this point in the history
Fixes #1235
Fixes #1236
  • Loading branch information
qsniyg committed Nov 22, 2023
1 parent 257363d commit 3ea0607
Show file tree
Hide file tree
Showing 3 changed files with 258 additions and 44 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
2023.11.1 (in-dev)

Bugfixes:

* Fix the info object not being filled in some cases (thanks to fireattack on discord for reporting)

Special thanks to jonestly, fireattack, karpuzikov, ljcool2006 for their contributions and reports for this release

---

2023.11.0

New features:
Expand Down
145 changes: 126 additions & 19 deletions src/userscript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,26 @@ var $$IMU_EXPORT$$;
return floor;
};

// https://stackoverflow.com/a/15016605
// unminified version: https://stackoverflow.com/a/3058974
var base64_decode_base = function(s:string, dict?:string):string {
var e={},i,b=0,c,x,l=0,a,r='',w=string_fromcharcode,L=s.length;
if (!dict)
dict = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var A=dict;
for(i=0;i<64;i++){e[string_charat(A, i)]=i;}
for(x=0;x<L;x++){
c=e[string_charat(s, x)];b=(b<<6)+c;l+=6;
while(l>=8){((a=(b>>>(l-=8))&0xff)||(x<(L-2)))&&(r+=w(a));}
}
return r;
};

// RFC 4648 section 5
var base64_decode_urlsafe = function(s:string):string {
return base64_decode_base(s, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_");
};

var base64_decode, base64_encode,
is_array, array_indexof, string_indexof,
// https://www.bing.com/ overrides Blob
Expand Down Expand Up @@ -756,17 +776,8 @@ var $$IMU_EXPORT$$;
return;

// Some websites replace atob, so we have to provide our own implementation in those cases
// https://stackoverflow.com/a/15016605
// unminified version: https://stackoverflow.com/a/3058974
var base64_decode_correct = function(s) {
var e={},i,b=0,c,x,l=0,a,r='',w=string_fromcharcode,L=s.length;
var A="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
for(i=0;i<64;i++){e[string_charat(A, i)]=i;}
for(x=0;x<L;x++){
c=e[string_charat(s, x)];b=(b<<6)+c;l+=6;
while(l>=8){((a=(b>>>(l-=8))&0xff)||(x<(L-2)))&&(r+=w(a));}
}
return r;
return base64_decode_base(s);
};

var base64_decode_test = function(func) {
Expand Down Expand Up @@ -15579,7 +15590,7 @@ var $$IMU_EXPORT$$;
},
enable_stream_download: {
name: "Enable downloading HLS/DASH streams",
description: "Downloads and muxes the contents of the streams rather than the stream information file.\nThis currently does not work under Firefox.",
description: "Downloads and muxes the contents of the streams rather than the stream information file.\nThis currently does not work under modern browsers due to `SharedArrayBuffer` restrictions.",
requires: {
_condition: "action:popup",
mouseover_allow_hlsdash: true
Expand Down Expand Up @@ -31900,6 +31911,12 @@ var $$IMU_EXPORT$$;
// thanks to anonymous for reporting:
// https://www.panasonic.com/content/dam/Panasonic/europe/P-CON-2018/DC-TZ200/TZ200_Getinspired_eu_4-1_01.jpg?downsize=480%3A*&output-quality=10&output-format=jpg
(domain_nowww === "panasonic.com" && /\/content\/+dam\//.test(src)) ||
// thanks to jonestly on discord:
// https://images.komi.io/production/photos/ohROlETY6MeunDUmRhpNi.png?tr=w-1145%2Ch-1440%2Ccm-extract%2Cx-147%2Cy-0&crp={%22x%22%3A0%2C%22y%22%3A0%2C%22zoomVal%22%3A1}
domain === "images.komi.io" ||
// thanks to karpuzikov on github: https://github.com/qsniyg/maxurl/issues/1235
// https://cdn.ksyru0-fusion.fds.api.mi-img.com/b2c-mishop-pms-ru/pms_1669890168.73868564.png?w=200&h=200&thumb=1
(domain_nosub === "mi-img.com" && /\.api\./.test(domain)) ||
// http://us.jimmychoo.com/dw/image/v2/AAWE_PRD/on/demandware.static/-/Sites-jch-master-product-catalog/default/dw70b1ebd2/images/rollover/LIZ100MPY_120004_MODEL.jpg?sw=245&sh=245&sm=fit
// https://www.aritzia.com/on/demandware.static/-/Library-Sites-Aritzia_Shared/default/dw3a7fef87/seasonal/ss18/ss18-springsummercampaign/ss18-springsummercampaign-homepage/hptiles/tile-wilfred-lrg.jpg
src.match(/\/demandware\.static\//) ||
Expand Down Expand Up @@ -62284,6 +62301,10 @@ var $$IMU_EXPORT$$;
// https://d16kd6gzalkogb.cloudfront.net/__sized__/auction_artwork_images/430465149-thumbnail-265x9999-70.jpg
// https://d16kd6gzalkogb.cloudfront.net/auction_artwork_images/430465149.jpg
domain === "d16kd6gzalkogb.cloudfront.net" ||
// thanks to anonymous for reporting:
// https://oye-records.com/media/__sized__/releases/various-bd01_l9LYU59-crop-c0-5__0-5-600x600-70.jpg
// https://oye-records.com/media/releases/various-bd01_l9LYU59.jpg
domain_nowww === "oye-records.com" ||
// https://audio.gafamfree.party/media/__sized__/albums/covers/2019/12/25/c863ff96-e7a1-474e-a1bf-a5774b8591cd-crop-c0-5__0-5-200x200-70.jpgd
// https://audio.gafamfree.party/media/albums/covers/2019/12/25/c863ff96-e7a1-474e-a1bf-a5774b8591cd.jpg
domain === "audio.gafamfree.party") {
Expand Down Expand Up @@ -69538,7 +69559,11 @@ var $$IMU_EXPORT$$;
return src.replace(/\/+archive\/+storage\/+thumb\/+/, "/archive/storage/");
}

if (domain === "img.kaikai.ch") {
if (domain === "img.kaikai.ch" ||
// thanks to anonymous for reporting:
// https://bbs.animanch.com/thumb_m/2645983/1
// https://bbs.animanch.com/img/2645983/1
domain === "bbs.animanch.com") {
// https://img.kaikai.ch/thumb_m/18103/272
// https://img.kaikai.ch/img/18103/272
return src.replace(/\/thumb(?:_[a-z]+)\//, "/img/");
Expand Down Expand Up @@ -72640,6 +72665,15 @@ var $$IMU_EXPORT$$;
return newsrc;
}

if (domain === "helios-i.mashable.com") {
// thanks to ljcool2006 on github: https://github.com/qsniyg/maxurl/issues/1236
// https://helios-i.mashable.com/imagery/archives/00lnkFNXYjcFzERp8dvE0Zo/images-1.fill.size_2000x378.v1647009212.gif
// https://helios-i.mashable.com/imagery/archives/00lnkFNXYjcFzERp8dvE0Zo/images-1.gif
// https://helios-i.mashable.com/imagery/articles/04s12xQoojTtYFzVBOzxf0c/hero-image.fill.size_497x300.v1700238128.png
// https://helios-i.mashable.com/imagery/articles/04s12xQoojTtYFzVBOzxf0c/hero-image.png
return src.replace(/(\/imagery\/+[^/]+\/+[^/]+\/+[^/.]+\.)(?:(?:fill|(?:size_|v)[^/.?#]+)\.)*/, "$1");
}

if (domain === "image.wisetrail.com" ||
// https://s3.amazonaws.com/image.wisetrail.com/bookmark92561918/Carey-Mulligan-new-hairstib_small.jpg
// https://s3.amazonaws.com/image.wisetrail.com/bookmark92561918/Carey-Mulligan-new-hairstib.jpg
Expand Down Expand Up @@ -104047,11 +104081,11 @@ var $$IMU_EXPORT$$;
// https://imgr.search.brave.com/LpJ29gWgcyCH8jAI_v_LValU3vgy77DMTtANenHMMGw/fit/740/1010/no/1/aHR0cHM6Ly9pdjEu/bGlzaW1nLmNvbS9p/bWFnZS8xNzEzMDg4/NS83NDBmdWxsLXNp/Z3JpZC1zb2xiYWtr/LXJhYWJlLmpwZw
// https://iv1.lisimg.com/image/17130885/740full-sigrid-solbakk-raabe.jpg
// https://ilarge.lisimg.com/image/17130885/99999999999full-sigrid-solbakk-raabe.jpg
match = src.match(/.*?\/+(aHR0[^?#.]+)(?:[?#].*)?$/);
match = src.match(/.*?\/+(aHR0[^?#.]+)(?:[.?#].*)?$/);
if (match) {
var splitted = match[1].split("/");
array_foreach(splitted, function(x, i) {
splitted[i] = base64_decode(x);
splitted[i] = base64_decode_urlsafe(x);
});

return splitted.join("");
Expand Down Expand Up @@ -104679,7 +104713,12 @@ var $$IMU_EXPORT$$;
// thanks to anonymous:
// https://ak.picdn.net/offset/photos/5e18c5e3469b183482a29e71/medium/offset_891130.jpg?DFghwDcb?DFghwDcb
// https://ak.picdn.net/offset/photos/5e18c5e3469b183482a29e71/large_w/offset_891130.jpg?DFghwDcb?DFghwDcb
return src.replace(/(\/photos\/+[0-9a-f]{10,}\/+)medium\/+/, "$1large_w/");
// thanks to anonymous for reporting:
// https://ak.picdn.net/contributors/165384192/avatars/thumb.jpg?t=5666596
// https://ak.picdn.net/contributors/165384192/avatars/original.jpg?t=5666596
return src
.replace(/(\/photos\/+[0-9a-f]{10,}\/+)medium\/+/, "$1large_w/")
.replace(/(\/contributors\/+[0-9]+\/+avatars\/+)[a-z]+\./, "$1original.");
}

if (domain === "covers.zlibcdn2.com") {
Expand Down Expand Up @@ -109085,6 +109124,70 @@ var $$IMU_EXPORT$$;
return src.replace(/(\/api\/+upload\/+[a-z]+\/+[0-9a-f]+\/+)images\/+([0-9a-f]{10,})\/+[^/.]+(\.[a-z]+)(?:[?#].*)?$/, "$1$2$3");
}

if (domain === "assets.exploreedmonton.com") {
// thanks to anonymous for reporting:
// https://assets.exploreedmonton.com/images/feature/_1200x630_crop_center-center_none/Edmonton_Skyline_Northern-Lights-AtTheLookout_WEB_211122_162316.jpg?mtime=20211122082317&focal=51.02%25+30.33%25
// https://assets.exploreedmonton.com/images/feature/Edmonton_Skyline_Northern-Lights-AtTheLookout_WEB_211122_162316.jpg?mtime=20211122082317&focal=51.02%25+30.33%25
return src.replace(/(\/images\/+feature\/+)_[0-9]+x[0-9]+_[^/]+\/+/, "$1");
}

if (domain_nowww === "barrisol.com") {
// thanks to anonymous for reporting:
// https://barrisol.com/projets/exception/118/medium/big-plafond-tendu-lumineux-maxxi-06_w.jpg
// https://barrisol.com/projets/exception/118/big-plafond-tendu-lumineux-maxxi-06_w.jpg
return src.replace(/(\/exception\/+[0-9]+\/+)medium\/+/, "$1");
}

if (domain_nowww === "singulart.com") {
// thanks to anonymous for reporting:
// https://www.singulart.com/images-sh/eyJidWNrZXQiOiJzaW5ndWxhcnQtd2Vic2l0ZS1wcm9kIiwia2V5IjoiY29sbGVjdGlvbnNcL3YyXC9waWN0dXJlc1wvY3JvcHBlZFwvY292ZXJcL2Jhc2VcLzY5MDNfY292ZXJfZTE2OTI5MWUwNmY5NzFmM2YwMTI4NDI2MDFlNzBmN2QuanBlZyIsImVkaXRzIjp7InJlc2l6ZSI6eyJ3aWR0aCI6NjIwLCJoZWlnaHQiOjQyMCwiZml0IjoiY292ZXIifSwidG9Gb3JtYXQiOiJqcGVnIn19?signature=8c3cdf797e439cf0554fe2007e77e8af262a24bf74851a136225632ce72fbcc9
// https://singulart-website-prod.s3.amazonaws.com/collections/v2/pictures/cropped/cover/base/6903_cover_e169291e06f971f3f012842601e70f7d.jpeg
match = src.match(/\/images-sh\/+(eyJ[^/?#.]+)/);
if (match) {
let json = JSON_parse(base64_decode(match[1]));
return "https://" + json.bucket + ".s3.amazonaws.com/" + json.key.replace(/\/+/, "/");
}
}

if (domain_nowww === "allinks.me") {
// thanks to anonymous for reporting:
// https://allinks.me/storage/logos/60e78e0d1f8a8_small.jpg?nocache=1
// https://allinks.me/storage/logos/60e78e0d1f8a8.jpg?nocache=1
return src.replace(/(\/storage\/+logos\/+[0-9a-f]+)_small\./, "$1.");
}

if (domain_nowww === "imagedelivery.net") {
// thanks to fireattack on discord for reporting:
// https://imagedelivery.net/QondspN4HIUvB_R16-ddAQ/6539b3a36746820f9903899b/732af15913f220aaff3c.png/fit=cover,w=460,h=460
// https://imagedelivery.net/QondspN4HIUvB_R16-ddAQ/6539b3a36746820f9903899b/732af15913f220aaff3c.png/original
// https://imagedelivery.net/CNHQDfI-aOkA7ffs8mbdmA/item-images/nec481.jpg/w=1000
// https://imagedelivery.net/CNHQDfI-aOkA7ffs8mbdmA/item-images/nec481.jpg/w=9999999 -- 4328x4328
// https://imagedelivery.net/nx-BariuFDW3u41l69hhKg/534e5b59-d91f-47ad-159d-bbe88b514100/header
// https://imagedelivery.net/nx-BariuFDW3u41l69hhKg/534e5b59-d91f-47ad-159d-bbe88b514100/w=9999999 -- 1556x723
// other:
// https://imagedelivery.net/tBWwepYnH_U9dHRAxdyD6g/438f8275-00a2-4af5-6d77-7bfd77c9b700/origin
// https://imagedelivery.net/tBWwepYnH_U9dHRAxdyD6g/438f8275-00a2-4af5-6d77-7bfd77c9b700/w=9999999 -- ERROR 9429: Flexible variants are not enabled for the account
let cf_original_map = {
"QondspN4HIUvB_R16-ddAQ": "original"
};

match = src.match(/^[a-z]+:\/\/[^/]+\/+([^/]+)\/+/);
if (match) {
if (match[1] in cf_original_map) {
return src.replace(/^([a-z]+:\/\/[^/]+\/+[^/]+\/+.*\/)[^/]*(?:[?#].*)?$/, "$1" + cf_original_map[match[1]]);
}
}

return src.replace(/^([a-z]+:\/\/[^/]+\/+[^/]+\/+.*\/)[^/]*(?:[?#].*)?$/, "$1w=9999999");
}

if (domain_nosub === "appmifile.com" && /^i[0-9]*\./.test(domain)) {
// thanks to karpuzikov on github: https://github.com/qsniyg/maxurl/issues/1235
// https://i04.appmifile.com/900_item_ru/09/08/2023/f6638076763903377c6b9f57b372cd0d!600x600!85.png
// https://i04.appmifile.com/900_item_ru/09/08/2023/f6638076763903377c6b9f57b372cd0d.png
return src.replace(/(\/[0-9a-f]{10,})(?:![^/.]+)*\./, "$1.");``
}




Expand Down Expand Up @@ -112515,7 +112618,7 @@ var $$IMU_EXPORT$$;
var cond = !options.fill_object || (newhref[0].waiting === true && !objified[0].waiting);
if (cond) {
newhref = objified;
} else {
} else if (pastobjs.length) {
// TODO: refactor
var _apply = function(newobj) {
array_foreach(basic_fillobj(newobj), function(sobj, i) {
Expand All @@ -112526,15 +112629,15 @@ var $$IMU_EXPORT$$;
sobj.url = currenthref;
}

array_foreach(pastobjs, function(psobj) {
for (let psobj of pastobjs) {
if (psobj.url === sobj.url) {
for (prop in sobj) {
psobj[prop] = sobj[prop];
}

return false;
break;
}
});
}
});
};

Expand All @@ -112544,6 +112647,10 @@ var $$IMU_EXPORT$$;
_apply(newhref1);
// _apply is also needed for bigimage'd album_links

// thanks to fireattack on discord for reporting:
// https://repotama.com/wp-content/uploads/2023/11/am_gakusai2023_01.jpg without audio redirection enabled crashes because the object isn't filled
// pastobjs.length check is needed because pastobjs = [] in this case

newhref = null;
currentobj = pastobjs[0];
}
Expand Down
Loading

0 comments on commit 3ea0607

Please sign in to comment.