Skip to content

Commit

Permalink
More websites/rules (fixes #1242)
Browse files Browse the repository at this point in the history
  • Loading branch information
qsniyg committed Dec 14, 2023
1 parent 2c16df1 commit fca2984
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 8 deletions.
33 changes: 29 additions & 4 deletions src/userscript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down Expand Up @@ -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.");
}




Expand Down Expand Up @@ -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;
}




Expand Down
31 changes: 27 additions & 4 deletions userscript.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit fca2984

Please sign in to comment.