From fca298448d7fdfe3c97a4697bee1820482690549 Mon Sep 17 00:00:00 2001 From: qsniyg Date: Thu, 14 Dec 2023 20:43:15 +0000 Subject: [PATCH] More websites/rules (fixes #1242) --- src/userscript.ts | 33 +++++++++++++++++++++++++++++---- userscript.user.js | 31 +++++++++++++++++++++++++++---- 2 files changed, 56 insertions(+), 8 deletions(-) diff --git a/src/userscript.ts b/src/userscript.ts index 3c0fd561..1ad2c267 100644 --- a/src/userscript.ts +++ b/src/userscript.ts @@ -93094,18 +93094,22 @@ var $$IMU_EXPORT$$; if (domain_nosub === "ftcdn.net") { // https://as2.ftcdn.net/jpg/01/48/39/83/160_F_148398310_NQEzSr9fzbmfo0ZOcQjBhwQCFtSlwiS9.jpg -- no watermark, 107x160 // https://as2.ftcdn.net/jpg/01/48/39/83/240_F_148398310_NQEzSr9fzbmfo0ZOcQjBhwQCFtSlwiS9.jpg -- no watermark, 160x240 + // https://as2.ftcdn.net/jpg/01/48/39/83/360_F_148398310_NQEzSr9fzbmfo0ZOcQjBhwQCFtSlwiS9.jpg -- no watermark, 240x360 // https://as2.ftcdn.net/jpg/01/48/39/83/500_F_148398310_NQEzSr9fzbmfo0ZOcQjBhwQCFtSlwiS9.jpg -- watermark, 334x500 // https://as2.ftcdn.net/jpg/01/48/39/83/1000_F_148398310_NQEzSr9fzbmfo0ZOcQjBhwQCFtSlwiS9.jpg -- watermark, 667x1000 - match = src.match(/:\/\/[^/]+\/+[^/]+\/+(?:[0-9]{2}\/+){4}([0-9]+)_F_([0-9]+)_[^/_.]+\.[^/.]+(?:[?#].*)?$/); + // https://as2.ftcdn.net/v2/jpg/05/68/13/59/500_F_568135900_NtbQJET5LBJ7o2DE0OGjYj1yXct5njRZ.jpg + // https://as2.ftcdn.net/v2/jpg/05/68/13/59/1000_F_568135900_NtbQJET5LBJ7o2DE0OGjYj1yXct5njRZ.jpg + match = src.match(/:\/\/[^/]+\/+(?:v2\/+)?[^/]+\/+(?:[0-9]{2}\/+){4}([0-9]+)_F_([0-9]+)_[^/_.]+\.[^/.]+(?:[?#].*)?$/); if (match) { id = match[2]; - regex = /(:\/\/[^/]+\/+[^/]+\/+(?:[0-9]{2}\/+){4})[0-9]+(_F_[0-9]+_[^/_.]+\.[^/.]+)(?:[?#].*)?$/; + regex = /(:\/\/[^/]+\/+(?:v2\/+)?[^/]+\/+(?:[0-9]{2}\/+){4})[0-9]+(_F_[0-9]+_[^/_.]+\.[^/.]+)(?:[?#].*)?$/; newsrc = src; - if (match[1] === "160") { - newsrc = src.replace(regex, "$1240$2"); + // TODO: support watermark/smaller + if (match[1] === "160" || match[1] === "240") { + newsrc = src.replace(regex, "$1360$2"); } else if (match[1] === "500") { newsrc = src.replace(regex, "$11000$2"); } @@ -109603,6 +109607,18 @@ var $$IMU_EXPORT$$; } } + if (domain === "e.khoahoc.tv") { + // thanks to anonymous for reporting: + // https://e.khoahoc.tv/photos/image/2023/12/11/tau-pha-bang-200-size-80x80-znd.jpg + // https://e.khoahoc.tv/photos/image/2023/12/11/tau-pha-bang-200.jpg + // https://e.khoahoc.tv/photos/image/2023/12/11/tau-pha-bang.jpg + // https://e.khoahoc.tv/photos/image/2023/12/07/sieu-tau-container-KUN-24AP-200.jpg + // https://e.khoahoc.tv/photos/image/2023/12/07/sieu-tau-container-KUN-24AP.jpg + return src + .replace(/(\/photos\/+image\/+[0-9]{4}\/+(?:[0-9]{1,2}\/+){2}[^/]+)-200\./, "$1.") + .replace(/(\/photos\/+image\/+[0-9]{4}\/+(?:[0-9]{1,2}\/+){2}[^/]+)-size-[0-9]+x[0-9]+-[a-z]+\./, "$1."); + } + @@ -111297,6 +111313,15 @@ var $$IMU_EXPORT$$; return src.replace(/(\/uc_server\/+data\/+avatar\/+[0-9]{3}\/+[0-9]{2}\/+[0-9]{2}\/+[0-9]{2}_avatar(?:_[0-9a-f]+)?)_(?:small|middle)\./, "$1_big."); } + if (/\/wp-content\/+uploads\/+[0-9]{4}\/+[0-9]{2}\/+cropped-[^/]+(?:[?#].*)?$/) { + // thanks to ljcool2006 on github: https://github.com/qsniyg/maxurl/issues/1242 + // https://dairypure.com/wp-content/uploads/2022/05/cropped-dairy-pure-site-image.png + // https://dairypure.com/wp-content/uploads/2022/05/dairy-pure-site-image.png + newsrc = src.replace(/\/cropped-([^/]+(?:[?#].*)?)$/, "/$1"); + if (newsrc !== src) + return newsrc; + } + diff --git a/userscript.user.js b/userscript.user.js index dc24e7bc..4e7a8b51 100644 --- a/userscript.user.js +++ b/userscript.user.js @@ -83631,15 +83631,19 @@ var $$IMU_EXPORT$$; if (domain_nosub === "ftcdn.net") { // https://as2.ftcdn.net/jpg/01/48/39/83/160_F_148398310_NQEzSr9fzbmfo0ZOcQjBhwQCFtSlwiS9.jpg -- no watermark, 107x160 // https://as2.ftcdn.net/jpg/01/48/39/83/240_F_148398310_NQEzSr9fzbmfo0ZOcQjBhwQCFtSlwiS9.jpg -- no watermark, 160x240 + // https://as2.ftcdn.net/jpg/01/48/39/83/360_F_148398310_NQEzSr9fzbmfo0ZOcQjBhwQCFtSlwiS9.jpg -- no watermark, 240x360 // https://as2.ftcdn.net/jpg/01/48/39/83/500_F_148398310_NQEzSr9fzbmfo0ZOcQjBhwQCFtSlwiS9.jpg -- watermark, 334x500 // https://as2.ftcdn.net/jpg/01/48/39/83/1000_F_148398310_NQEzSr9fzbmfo0ZOcQjBhwQCFtSlwiS9.jpg -- watermark, 667x1000 - match = src.match(/:\/\/[^/]+\/+[^/]+\/+(?:[0-9]{2}\/+){4}([0-9]+)_F_([0-9]+)_[^/_.]+\.[^/.]+(?:[?#].*)?$/); + // https://as2.ftcdn.net/v2/jpg/05/68/13/59/500_F_568135900_NtbQJET5LBJ7o2DE0OGjYj1yXct5njRZ.jpg + // https://as2.ftcdn.net/v2/jpg/05/68/13/59/1000_F_568135900_NtbQJET5LBJ7o2DE0OGjYj1yXct5njRZ.jpg + match = src.match(/:\/\/[^/]+\/+(?:v2\/+)?[^/]+\/+(?:[0-9]{2}\/+){4}([0-9]+)_F_([0-9]+)_[^/_.]+\.[^/.]+(?:[?#].*)?$/); if (match) { id = match[2]; - regex = /(:\/\/[^/]+\/+[^/]+\/+(?:[0-9]{2}\/+){4})[0-9]+(_F_[0-9]+_[^/_.]+\.[^/.]+)(?:[?#].*)?$/; + regex = /(:\/\/[^/]+\/+(?:v2\/+)?[^/]+\/+(?:[0-9]{2}\/+){4})[0-9]+(_F_[0-9]+_[^/_.]+\.[^/.]+)(?:[?#].*)?$/; newsrc = src; - if (match[1] === "160") { - newsrc = src.replace(regex, "$1240$2"); + // TODO: support watermark/smaller + if (match[1] === "160" || match[1] === "240") { + newsrc = src.replace(regex, "$1360$2"); } else if (match[1] === "500") { newsrc = src.replace(regex, "$11000$2"); } @@ -98341,6 +98345,17 @@ var $$IMU_EXPORT$$; return urljoin(src, "/" + common_functions["get_thumbor_url"](newsrc), true); } } + if (domain === "e.khoahoc.tv") { + // thanks to anonymous for reporting: + // https://e.khoahoc.tv/photos/image/2023/12/11/tau-pha-bang-200-size-80x80-znd.jpg + // https://e.khoahoc.tv/photos/image/2023/12/11/tau-pha-bang-200.jpg + // https://e.khoahoc.tv/photos/image/2023/12/11/tau-pha-bang.jpg + // https://e.khoahoc.tv/photos/image/2023/12/07/sieu-tau-container-KUN-24AP-200.jpg + // https://e.khoahoc.tv/photos/image/2023/12/07/sieu-tau-container-KUN-24AP.jpg + return src + .replace(/(\/photos\/+image\/+[0-9]{4}\/+(?:[0-9]{1,2}\/+){2}[^/]+)-200\./, "$1.") + .replace(/(\/photos\/+image\/+[0-9]{4}\/+(?:[0-9]{1,2}\/+){2}[^/]+)-size-[0-9]+x[0-9]+-[a-z]+\./, "$1."); + } // -- general rules -- if (src.match(/\/ImageGen\.ashx\?/)) { // http://www.lookalikes.info/umbraco/ImageGen.ashx?image=/media/97522/nick%20hewer%20-%20mark%20brown.jpeg&width=250&constrain=true @@ -99760,6 +99775,14 @@ var $$IMU_EXPORT$$; // https://d2hvpft15iz0rl.cloudfront.net/admin-infinix-club/uc_server/data/avatar/202301/07/d37e261c90fb5a9cW26VI8.png return src.replace(/(\/uc_server\/+data\/+avatar\/+[0-9]{3}\/+[0-9]{2}\/+[0-9]{2}\/+[0-9]{2}_avatar(?:_[0-9a-f]+)?)_(?:small|middle)\./, "$1_big."); } + if (/\/wp-content\/+uploads\/+[0-9]{4}\/+[0-9]{2}\/+cropped-[^/]+(?:[?#].*)?$/) { + // thanks to ljcool2006 on github: https://github.com/qsniyg/maxurl/issues/1242 + // https://dairypure.com/wp-content/uploads/2022/05/cropped-dairy-pure-site-image.png + // https://dairypure.com/wp-content/uploads/2022/05/dairy-pure-site-image.png + newsrc = src.replace(/\/cropped-([^/]+(?:[?#].*)?)$/, "/$1"); + if (newsrc !== src) + return newsrc; + } // -- element rules -- if (!src && options.host_url && options.element && options.element.tagName && options.element.tagName.toUpperCase() === "SVG") { var images_1 = options.element.querySelectorAll("image");