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 16, 2023
1 parent bd113de commit 72f1f21
Show file tree
Hide file tree
Showing 2 changed files with 189 additions and 2 deletions.
99 changes: 98 additions & 1 deletion src/userscript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39073,6 +39073,13 @@ var $$IMU_EXPORT$$;
return src.replace(/\/media\/photo-[a-z]\//, "/media/photo-o/");
}

if (domain === "dynamic-media-cdn.tripadvisor.com") {
// thanks to anonymous for reporting:
// https://dynamic-media-cdn.tripadvisor.com/media/photo-o/0a/64/3c/03/tais-weather-rock.jpg?w=700&h=-1&s=1
// https://media-cdn.tripadvisor.com/media/photo-o/0a/64/3c/03/tais-weather-rock.jpg
return src.replace(/:\/\/dynamic-([^?#]*)\?.*$/, "://$1");
}

if (domain_nowww === "traveller.com.au" ||
// https://resources.stuff.co.nz/content/dam/images/1/3/q/g/e/a/image.related.StuffLandscapeSixteenByNine.620x349.1inizt.png/1492742323724.jpg
// https://resources.stuff.co.nz/content/dam/images/1/3/q/g/e/a/image.
Expand Down Expand Up @@ -108922,6 +108929,93 @@ var $$IMU_EXPORT$$;
return src.replace(/(:\/\/[^/]+\/+)[wh][0-9]+\/+(.*?)(?:[?#].*)?$/, "$1full/$2");
}

if (domain_nowww === "openverse.org") {
newsrc = website_query({
website_regex: /^[a-z]+:\/\/[^/]+\/+image\/+([-0-9a-f]{20,})(?:[?#].*)?$/,
query_for_id: {
url: "https://api.openverse.engineering/v1/images/${id}/",
imu_mode: "xhr",
json: true
},
process: function(done, resp, cache_key) {
return done(resp.url, 6*60*60);
}
});
if (newsrc) return newsrc;
}

if (domain === "api.openverse.engineering") {
// https://api.openverse.engineering/v1/images/a3565050-50dc-4a57-8986-dc6bc3d8af48/thumb/
match = src.match(/^[a-z]+:\/\/[^/]+\/+v1\/+images\/+([-0-9a-f]{20,})\/+thumb\/+(?:[?#].*)?$/);
if (match) {
return {
url: "https://openverse.org/image/" + match[1],
is_pagelink: true
};
}
}

if (domain_nowww === "zzup.com") {
// thanks to anonymous for reporting
newsrc = website_query({
website_regex: /^[a-z]+:\/\/[^/]+\/+viewimage\/+(.*?\.html)(?:[?#].*)?$/,
query_for_id: "https://zzup.com/viewimage/${id}",
process: function(done, resp, cache_key) {
let match = resp.responseText.match(/<img src="(\/[^/]+\/+showimage\/+[^"]+)"/);
if (!match) {
console_error(cache_key, "Unable to find img match for", resp);
return done(null, false);
}

return done(urljoin(resp.finalUrl, match[1], true), 6*60*60);
}
});
if (newsrc) return newsrc;
}

if (domain === "thumb.zzup.com") {
// thanks to anonymous for reporting
match = src.match(/:\/\/[^/]+\/+[^/]+\/+image0*([0-9]+)-[0-9]+-([0-9]+)-[0-9]+\/+([^/]+)\/+/);
if (match) {
return {
url: "https://zzup.com/viewimage/a/" + match[3] + "/a/image-" + match[1] + "-pics-1-mirror-" + match[2] + ".html",
is_pagelink: true
};
}
}

if (domain === "shftr.adnxs.net") {
// thanks to anonymous for reporting:
// https://shftr.adnxs.net/r?url=https%3A%2F%2Fimages.mediago.io%2FML%2Fdf2692e41aa5c3344c0603315df24b96__scv1__300x225.png&width=152&height=114&crop=1&bidder=529&buying_member=13368&selling_member=280&creative_id=445018435
// https://images.mediago.io/ML/df2692e41aa5c3344c0603315df24b96__scv1__300x225.png
newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+r\?(?:.*&)?url=([^&]+)(?:[&#].*)?$/, "$1");
if (newsrc !== src)
return decodeuri_ifneeded(newsrc);
}

if (domain === "images.mediago.io") {
// https://images.mediago.io/ML/df2692e41aa5c3344c0603315df24b96__scv1__300x225.png
// https://images.mediago.io/ML/df2692e41aa5c3344c0603315df24b96.png -- 1456x816, upscaled?
// other:
// https://images.mediago.io/ML/982d9e294d9d512ad79b6a4fb3d831ae.png -- 5456x3637
return src.replace(/(\/[0-9a-f]{10,})__[^/.?#]+\./, "$1.");
}

if (domain === "images.wolfgangsvault.com") {
// thanks to anonymous for reporting:
// https://images.wolfgangsvault.com/images/catalog/thumb/FD012-HB.jpg
// https://images.wolfgangsvault.com/images/catalog/detail/FD012-HB.jpg
// https://images.wolfgangsvault.com/m/medium/BG286-TX/moby-grape-vintage-ticket-jun-24-1971-jun-27-1971.webp
// https://images.wolfgangsvault.com/m/xlarge/BG286-TX/moby-grape-vintage-ticket-jun-24-1971-jun-27-1971.webp -- 561x1200
// other:
// https://images.wolfgangsvault.com/images/catalog/thumb/FDD012-PC.jpg -- 338x480
// https://images.wolfgangsvault.com/images/catalog/detail/FDD012-PC.jpg -- 338x480
// https://images.wolfgangsvault.com/images/catalog/FDD012-PC.jpg -- 338x480
return src
.replace(/(\/images\/+catalog\/+)thumb\/+/, "$1detail/")
.replace(/(:\/\/[^/]+\/+m\/+)(?:small|medium|large)\/+/, "$1xlarge/");
}




Expand Down Expand Up @@ -110070,7 +110164,10 @@ var $$IMU_EXPORT$$;
domain === "bkimg.cdn.bcebos.com" ||
// https://image.gcores.com/94817587-8003-4734-82d6-23c1a0b6894e.png?x-oss-process=style/original_hsat2x
// https://image.gcores.com/94817587-8003-4734-82d6-23c1a0b6894e.png -- upscaled though?
src.match(/[?&]x-oss-process=(?:image|style)\//)) {
// thanks to anonymous for reporting:
// https://upload-os-bbs.hoyolab.com/upload/2023/10/26/d94405bf5b3cf2a16827d7c349eb36ed_1317601896308583612.jpeg?x-oss-process=image%2Fresize%2Cs_1000%2Fquality%2Cq_80%2Fauto-orient%2C0%2Finterlace%2C1%2Fformat%2Cwebp
// https://upload-os-bbs.hoyolab.com/upload/2023/10/26/d94405bf5b3cf2a16827d7c349eb36ed_1317601896308583612.jpeg
src.match(/[?&]x-oss-process=(?:image|style)(?:\/|%2F)/)) {
// http://cdn.himalaya.com/4e4dfa0ab9de4312aeebc9b0bcf5adc1.png?x-oss-process=image/resize,w_300,h_300&auth_key=4102416000-1234-0-8214a290aa73676f01e3a4990ddfac32
// http://cdn.himalaya.com/4e4dfa0ab9de4312aeebc9b0bcf5adc1.png?auth_key=4102416000-1234-0-8214a290aa73676f01e3a4990ddfac32
var authkey = src.replace(/.*[?&]auth_key=([-0-9a-f]+).*?$/, "$1");
Expand Down
92 changes: 91 additions & 1 deletion userscript.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -35700,6 +35700,12 @@ var $$IMU_EXPORT$$;
// o, s, f, i, l, t
return src.replace(/\/media\/photo-[a-z]\//, "/media/photo-o/");
}
if (domain === "dynamic-media-cdn.tripadvisor.com") {
// thanks to anonymous for reporting:
// https://dynamic-media-cdn.tripadvisor.com/media/photo-o/0a/64/3c/03/tais-weather-rock.jpg?w=700&h=-1&s=1
// https://media-cdn.tripadvisor.com/media/photo-o/0a/64/3c/03/tais-weather-rock.jpg
return src.replace(/:\/\/dynamic-([^?#]*)\?.*$/, "://$1");
}
if (domain_nowww === "traveller.com.au" ||
// https://resources.stuff.co.nz/content/dam/images/1/3/q/g/e/a/image.related.StuffLandscapeSixteenByNine.620x349.1inizt.png/1492742323724.jpg
// https://resources.stuff.co.nz/content/dam/images/1/3/q/g/e/a/image.
Expand Down Expand Up @@ -97701,6 +97707,87 @@ var $$IMU_EXPORT$$;
// https://media.springernature.com/full/springer-static/image/art%3A10.1038%2Fs41565-019-0561-4/MediaObjects/41565_2019_561_Figa_HTML.jpg
return src.replace(/(:\/\/[^/]+\/+)[wh][0-9]+\/+(.*?)(?:[?#].*)?$/, "$1full/$2");
}
if (domain_nowww === "openverse.org") {
newsrc = website_query({
website_regex: /^[a-z]+:\/\/[^/]+\/+image\/+([-0-9a-f]{20,})(?:[?#].*)?$/,
query_for_id: {
url: "https://api.openverse.engineering/v1/images/${id}/",
imu_mode: "xhr",
json: true
},
process: function(done, resp, cache_key) {
return done(resp.url, 6 * 60 * 60);
}
});
if (newsrc)
return newsrc;
}
if (domain === "api.openverse.engineering") {
// https://api.openverse.engineering/v1/images/a3565050-50dc-4a57-8986-dc6bc3d8af48/thumb/
match = src.match(/^[a-z]+:\/\/[^/]+\/+v1\/+images\/+([-0-9a-f]{20,})\/+thumb\/+(?:[?#].*)?$/);
if (match) {
return {
url: "https://openverse.org/image/" + match[1],
is_pagelink: true
};
}
}
if (domain_nowww === "zzup.com") {
// thanks to anonymous for reporting
newsrc = website_query({
website_regex: /^[a-z]+:\/\/[^/]+\/+viewimage\/+(.*?\.html)(?:[?#].*)?$/,
query_for_id: "https://zzup.com/viewimage/${id}",
process: function(done, resp, cache_key) {
var match = resp.responseText.match(/<img src="(\/[^/]+\/+showimage\/+[^"]+)"/);
if (!match) {
console_error(cache_key, "Unable to find img match for", resp);
return done(null, false);
}
return done(urljoin(resp.finalUrl, match[1], true), 6 * 60 * 60);
}
});
if (newsrc)
return newsrc;
}
if (domain === "thumb.zzup.com") {
// thanks to anonymous for reporting
match = src.match(/:\/\/[^/]+\/+[^/]+\/+image0*([0-9]+)-[0-9]+-([0-9]+)-[0-9]+\/+([^/]+)\/+/);
if (match) {
return {
url: "https://zzup.com/viewimage/a/" + match[3] + "/a/image-" + match[1] + "-pics-1-mirror-" + match[2] + ".html",
is_pagelink: true
};
}
}
if (domain === "shftr.adnxs.net") {
// thanks to anonymous for reporting:
// https://shftr.adnxs.net/r?url=https%3A%2F%2Fimages.mediago.io%2FML%2Fdf2692e41aa5c3344c0603315df24b96__scv1__300x225.png&width=152&height=114&crop=1&bidder=529&buying_member=13368&selling_member=280&creative_id=445018435
// https://images.mediago.io/ML/df2692e41aa5c3344c0603315df24b96__scv1__300x225.png
newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+r\?(?:.*&)?url=([^&]+)(?:[&#].*)?$/, "$1");
if (newsrc !== src)
return decodeuri_ifneeded(newsrc);
}
if (domain === "images.mediago.io") {
// https://images.mediago.io/ML/df2692e41aa5c3344c0603315df24b96__scv1__300x225.png
// https://images.mediago.io/ML/df2692e41aa5c3344c0603315df24b96.png -- 1456x816, upscaled?
// other:
// https://images.mediago.io/ML/982d9e294d9d512ad79b6a4fb3d831ae.png -- 5456x3637
return src.replace(/(\/[0-9a-f]{10,})__[^/.?#]+\./, "$1.");
}
if (domain === "images.wolfgangsvault.com") {
// thanks to anonymous for reporting:
// https://images.wolfgangsvault.com/images/catalog/thumb/FD012-HB.jpg
// https://images.wolfgangsvault.com/images/catalog/detail/FD012-HB.jpg
// https://images.wolfgangsvault.com/m/medium/BG286-TX/moby-grape-vintage-ticket-jun-24-1971-jun-27-1971.webp
// https://images.wolfgangsvault.com/m/xlarge/BG286-TX/moby-grape-vintage-ticket-jun-24-1971-jun-27-1971.webp -- 561x1200
// other:
// https://images.wolfgangsvault.com/images/catalog/thumb/FDD012-PC.jpg -- 338x480
// https://images.wolfgangsvault.com/images/catalog/detail/FDD012-PC.jpg -- 338x480
// https://images.wolfgangsvault.com/images/catalog/FDD012-PC.jpg -- 338x480
return src
.replace(/(\/images\/+catalog\/+)thumb\/+/, "$1detail/")
.replace(/(:\/\/[^/]+\/+m\/+)(?:small|medium|large)\/+/, "$1xlarge/");
}
// -- 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 @@ -98608,7 +98695,10 @@ var $$IMU_EXPORT$$;
domain === "bkimg.cdn.bcebos.com" ||
// https://image.gcores.com/94817587-8003-4734-82d6-23c1a0b6894e.png?x-oss-process=style/original_hsat2x
// https://image.gcores.com/94817587-8003-4734-82d6-23c1a0b6894e.png -- upscaled though?
src.match(/[?&]x-oss-process=(?:image|style)\//)) {
// thanks to anonymous for reporting:
// https://upload-os-bbs.hoyolab.com/upload/2023/10/26/d94405bf5b3cf2a16827d7c349eb36ed_1317601896308583612.jpeg?x-oss-process=image%2Fresize%2Cs_1000%2Fquality%2Cq_80%2Fauto-orient%2C0%2Finterlace%2C1%2Fformat%2Cwebp
// https://upload-os-bbs.hoyolab.com/upload/2023/10/26/d94405bf5b3cf2a16827d7c349eb36ed_1317601896308583612.jpeg
src.match(/[?&]x-oss-process=(?:image|style)(?:\/|%2F)/)) {
// http://cdn.himalaya.com/4e4dfa0ab9de4312aeebc9b0bcf5adc1.png?x-oss-process=image/resize,w_300,h_300&auth_key=4102416000-1234-0-8214a290aa73676f01e3a4990ddfac32
// http://cdn.himalaya.com/4e4dfa0ab9de4312aeebc9b0bcf5adc1.png?auth_key=4102416000-1234-0-8214a290aa73676f01e3a4990ddfac32
var authkey = src.replace(/.*[?&]auth_key=([-0-9a-f]+).*?$/, "$1");
Expand Down

0 comments on commit 72f1f21

Please sign in to comment.