From 7576b3099311a66c5ae95c49309e1749a74be14e Mon Sep 17 00:00:00 2001
From: qsniyg <qsniyg@mail.com>
Date: Tue, 30 Apr 2024 20:31:08 +0000
Subject: [PATCH] More websites/rules

---
 src/userscript.ts  | 66 ++++++++++++++++++++++++++++++++++++++++++++++
 userscript.user.js | 57 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 123 insertions(+)

diff --git a/src/userscript.ts b/src/userscript.ts
index 05e9482c..16087c09 100644
--- a/src/userscript.ts
+++ b/src/userscript.ts
@@ -113708,6 +113708,72 @@ var $$IMU_EXPORT$$;
 			return src.replace(/\/render\/+w[0-9]+\/+/, "/content/");
 		}
 
+		if (amazon_container === "kb-tenant-data") {
+			// thanks to anonymous for reporting:
+			// https://s3.amazonaws.com/kb-tenant-data/31e8fafc-c06d-4622-af6d-cf67c2132c48/uploads/images/1664vz9kfM45XzSi/thumb/rnnsn37g.jpg -- 350x350
+			//   https://s3.amazonaws.com/kb-tenant-data/31e8fafc-c06d-4622-af6d-cf67c2132c48/uploads/images/1664vz9kfM45XzSi/medium/rnnsn37g.jpg -- 900x900
+			//   https://s3.amazonaws.com/kb-tenant-data/31e8fafc-c06d-4622-af6d-cf67c2132c48/uploads/images/1664vz9kfM45XzSi/large/rnnsn37g.jpg -- 1024x1024
+			return src.replace(/(\/uploads\/+images\/+[^/]+\/+)(?:thumb|medium)\/+/, "$1large/");
+		}
+
+		if (domain === "i.icanvas.com") {
+			// thanks to anonymous for reporting:
+			// https://i.icanvas.com/NRL39?d=3&sh=h&s=xl&p=1&bg=c&t=1708237566
+			//   https://i.icanvas.com/NRL39?sh=h&s=xxl&d=0 -- 1200x800
+			return add_queries(keep_queries(src, ["sh", "s", "d"]), {"d": "0"}).replace(/([?&]s=)(?:[sml]|xl)/, "$1xxl");
+		}
+
+		if (domain_nowww === "thevintageposter.com") {
+			// thanks to anonymous for reporting:
+			// https://www.thevintageposter.com/Art_Images/Small/TN18212.jpg
+			//   https://www.thevintageposter.com/Art_Images/Medium/18212.jpg -- 1500x1156
+			return src.replace(/(\/Art_Images\/+)Small\/+TN/, "$1Medium/");
+		}
+
+		if (domain_nowww === "tenor.com") {
+			// thanks to anonymous for reporting:
+			newsrc = website_query({
+				website_regex: /^[a-z]+:\/\/[^/]+\/+(?:[a-z]+\/+)?view\/+[^/?#]+-([0-9]+)(?:[?#].*)?$/,
+				query_for_id: "https://tenor.com/view/${id}",
+				process: function(done, resp, cache_key, urlmatch) {
+					let match = resp.responseText.match(/<script id="store-cache"[^>]*>({.*?})<\/script>/);
+					if (!match) {
+						console_error(cache_key, "Unable to find store-cache match for", resp);
+						return done(null, false);
+					}
+
+					let json = JSON_parse(match[1]);
+					let id = urlmatch[1];
+					let data = json.gifs.byId[id].results[0];
+
+					let obj = {
+						extra: {
+							page: data.itemurl,
+							created_date: data.created * 1000,
+							caption: data.h1_title,
+							author_username: data.user.username
+						}
+					};
+
+					let urls = [];
+
+					if (data.media_formats.mp4) {
+						urls.push({
+							url: data.media_formats.mp4.url,
+							video: true
+						});
+					}
+
+					if (data.media_formats.gif) {
+						urls.push(data.media_formats.gif.url);
+					}
+
+					return done(fillobj_urls(urls, obj), 6*60*60);
+				}
+			});
+			if (newsrc) return newsrc;
+		}
+
 
 
 
diff --git a/userscript.user.js b/userscript.user.js
index ea949298..05bae2f3 100644
--- a/userscript.user.js
+++ b/userscript.user.js
@@ -102086,6 +102086,63 @@ var $$IMU_EXPORT$$;
 			// https://www.esprit-photo.com/content/09.vie_paroisses/11.paroisse-saint-jean-baptiste-libourne-bordeaux/06.veillees/01.Veillee-Sainte-Marie-Madeleine-a-St-Jean-Baptiste-de-Libourne/__Veillee-Sainte-Marie-Madeleine-a-St-Jean-Baptiste-de-Libourne.jpg -- 2114x3038
 			return src.replace(/\/render\/+w[0-9]+\/+/, "/content/");
 		}
+		if (amazon_container === "kb-tenant-data") {
+			// thanks to anonymous for reporting:
+			// https://s3.amazonaws.com/kb-tenant-data/31e8fafc-c06d-4622-af6d-cf67c2132c48/uploads/images/1664vz9kfM45XzSi/thumb/rnnsn37g.jpg -- 350x350
+			//   https://s3.amazonaws.com/kb-tenant-data/31e8fafc-c06d-4622-af6d-cf67c2132c48/uploads/images/1664vz9kfM45XzSi/medium/rnnsn37g.jpg -- 900x900
+			//   https://s3.amazonaws.com/kb-tenant-data/31e8fafc-c06d-4622-af6d-cf67c2132c48/uploads/images/1664vz9kfM45XzSi/large/rnnsn37g.jpg -- 1024x1024
+			return src.replace(/(\/uploads\/+images\/+[^/]+\/+)(?:thumb|medium)\/+/, "$1large/");
+		}
+		if (domain === "i.icanvas.com") {
+			// thanks to anonymous for reporting:
+			// https://i.icanvas.com/NRL39?d=3&sh=h&s=xl&p=1&bg=c&t=1708237566
+			//   https://i.icanvas.com/NRL39?sh=h&s=xxl&d=0 -- 1200x800
+			return add_queries(keep_queries(src, ["sh", "s", "d"]), { "d": "0" }).replace(/([?&]s=)(?:[sml]|xl)/, "$1xxl");
+		}
+		if (domain_nowww === "thevintageposter.com") {
+			// thanks to anonymous for reporting:
+			// https://www.thevintageposter.com/Art_Images/Small/TN18212.jpg
+			//   https://www.thevintageposter.com/Art_Images/Medium/18212.jpg -- 1500x1156
+			return src.replace(/(\/Art_Images\/+)Small\/+TN/, "$1Medium/");
+		}
+		if (domain_nowww === "tenor.com") {
+			// thanks to anonymous for reporting:
+			newsrc = website_query({
+				website_regex: /^[a-z]+:\/\/[^/]+\/+(?:[a-z]+\/+)?view\/+[^/?#]+-([0-9]+)(?:[?#].*)?$/,
+				query_for_id: "https://tenor.com/view/${id}",
+				process: function(done, resp, cache_key, urlmatch) {
+					var match = resp.responseText.match(/<script id="store-cache"[^>]*>({.*?})<\/script>/);
+					if (!match) {
+						console_error(cache_key, "Unable to find store-cache match for", resp);
+						return done(null, false);
+					}
+					var json = JSON_parse(match[1]);
+					var id = urlmatch[1];
+					var data = json.gifs.byId[id].results[0];
+					var obj = {
+						extra: {
+							page: data.itemurl,
+							created_date: data.created * 1000,
+							caption: data.h1_title,
+							author_username: data.user.username
+						}
+					};
+					var urls = [];
+					if (data.media_formats.mp4) {
+						urls.push({
+							url: data.media_formats.mp4.url,
+							video: true
+						});
+					}
+					if (data.media_formats.gif) {
+						urls.push(data.media_formats.gif.url);
+					}
+					return done(fillobj_urls(urls, obj), 6 * 60 * 60);
+				}
+			});
+			if (newsrc)
+				return newsrc;
+		}
 		// -- 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