// @license http://www.apache.org/licenses/LICENSE-2.0 Apache-2.0
// ^ for LibreJS (this has to be the first comment in the file)

// ==UserScript==
// @name              Image Max URL
// @name:en           Image Max URL
// @name:ar           Image Max URL
// @name:cs           Image Max URL
// @name:da           Image Max URL
// @name:de           Image Max URL
// @name:el           Image Max URL
// @name:eo           Image Max URL
// @name:es           Image Max URL
// @name:fi           Image Max URL
// @name:fr           Image Max URL
// @name:fr-CA        Image Max URL
// @name:he           Image Max URL
// @name:hi           Image Max URL
// @name:hu           Image Max URL
// @name:id           Image Max URL
// @name:it           Image Max URL
// @name:ja           Image Max URL
// @name:ko           Image Max URL
// @name:nb           Image Max URL
// @name:nl           Image Max URL
// @name:pl           Image Max URL
// @name:pt-BR        Image Max URL
// @name:ru           Image Max URL
// @name:bg           Image Max URL
// @name:uk           Image Max URL
// @name:th           Image Max URL
// @name:tr           Image Max URL
// @name:vi           Image Max URL
// @name:zh-CN        Image Max URL
// @name:zh-TW        Image Max URL
// @name:zh-HK        Image Max URL
// @description       Finds larger or original versions of images and videos for 9400+ websites, including a powerful media popup and download feature
// @description:en    Finds larger or original versions of images and videos for 9400+ websites, including a powerful media popup and download feature
// @description:ar    البحث عن نسخ أكبر أو أصلية من الصور لأكثر من 9400 موقع ويب
// @description:cs    Vyhledá větší nebo původní verze obrázků a videí pro více než 9400 webů
// @description:da    Finder større eller originale versioner af billeder og videoer til mere end 9400 websteder
// @description:de    Sucht nach größeren oder originalen Versionen von Bildern und Videos für mehr als 9400 Websites
// @description:el    Βρίσκει μεγαλύτερες ή πρωτότυπες εκδόσεις εικόνων και βίντεο για περισσότερους από 9400 ιστότοπους
// @description:eo    Trovas pli grandajn aŭ originalajn versiojn de bildoj kaj filmetoj por pli ol 9400 retejoj
// @description:es    Encuentra imágenes más grandes y originales para más de 9400 sitios
// @description:fi    Etsii suurempia tai alkuperäisiä versioita kuvista ja videoista yli 9400 verkkosivustolle
// @description:fr    Trouve des versions plus grandes ou originales d'images et de vidéos pour plus de 9 400 sites web, y compris une puissante fonction de popup média
// @description:fr-CA Trouve des versions plus grandes ou originales d'images et de vidéos pour plus de 9 400 sites web, y compris une puissante fonction de popup média
// @description:he    מוצא גרסאות גדולות יותר או מקוריות של תמונות וסרטונים עבור יותר מ-9400 אתרים
// @description:hi    9400 से अधिक वेबसाइटों के लिए फ़ोटो और वीडियो के बड़े या मूल संस्करण ढूँढता है
// @description:hu    Több mint 9400 webhely képének és videóinak nagyobb vagy eredeti változatát találja
// @description:id    Menemukan versi gambar dan video yang lebih besar atau orisinal untuk lebih dari 9400 situs web
// @description:it    Trova versioni più grandi o originali di immagini e video per oltre 9400 siti web
// @description:ja    9400以上のウェブサイトで高画質や原本画像を見つけ出します
// @description:ko    9400개 이상의 사이트에 대해 고화질이나 원본 이미지를 찾아드립니다
// @description:nb    Finner større eller originale versjoner av bilder og videoer for mer enn 9400 nettsteder
// @description:nl    Vindt grotere of originele versies van foto's en video's voor meer dan 9400 websites
// @description:pl    Wyszukuje większe lub oryginalne wersje obrazów i filmów dla ponad 9400 stron internetowych
// @description:pt-BR Encontra versões maiores ou originais de imagens e vídeos para mais de 9400 sites
// @description:ru    Находит увеличенные или оригинальные версии изображений и видео для 9400+ сайтов. Имеет мощную функцию всплывающего окна и скачивание медиафайлов.
// @description:bg    Намира увеличени или оригинални версии на изображения за повече от 9400 уеб сайтове
// @description:uk    Знаходить збільшені або оригінальні версії зображень для більш ніж 9400 веб-сайтів
// @description:th    หาที่ใหญ่กว่าหรือเวอร์ชั่นดั้งเดิมของภาพทั้งหมดและวีดีโอสำหรับมากกว่า 9400 งเว็บไซต์
// @description:tr    9400'den fazla web sitesi için resim ve videoların daha büyük veya orijinal sürümlerini bulur
// @description:vi    Tìm phiên bản lớn hơn hoặc phiên bản gốc của hình ảnh và video cho hơn 9400 trang web
// @description:zh-CN 在近万个网站上查找尺寸更大或原版的图像/视频，提供媒体文件小弹窗和下载功能
// @description:zh-TW 為9400多個網站查找更大或原始圖像
// @description:zh-HK 為9400多個網站查找更大或原始圖像
// @namespace         http://tampermonkey.net/
// @version           2024.8.0
// @author            qsniyg
// @homepageURL       https://qsniyg.github.io/maxurl/options.html
// @supportURL        https://github.com/qsniyg/maxurl/issues
// @icon              https://raw.githubusercontent.com/qsniyg/maxurl/b5c5488ec05e6e2398d4e0d6e32f1bbad115f6d2/resources/logo_256.png
// @include           *
// @grant             GM.xmlHttpRequest
// @grant             GM_xmlhttpRequest
// @grant             GM.setValue
// @grant             GM_setValue
// @grant             GM.getValue
// @grant             GM_getValue
// @grant             GM_registerMenuCommand
// @grant             GM_unregisterMenuCommand
// @grant             GM_addValueChangeListener
// @grant             GM_download
// @grant             GM_openInTab
// @grant             GM.openInTab
// @grant             GM_notification
// @grant             GM.notification
// @grant             GM_setClipboard
// @grant             GM.setClipboard
// @connect           *
// api.github.com is used for checking for updates (can be disabled through the "Check Updates" setting)
// @connect           api.github.com
// @run-at            document-start
// @license           Apache-2.0
// non-greasyfork/oujs versions need updateURL and downloadURL to auto-update for certain userscript managers
// @updateURL         https://raw.githubusercontent.com/qsniyg/maxurl/master/userscript.meta.js
// @downloadURL       https://raw.githubusercontent.com/qsniyg/maxurl/master/userscript_smaller.user.js
// imu:require_rules  (this is replaced by the build system for userscript versions that require external rules)
// ==/UserScript==

// If you see "A userscript wants to access a cross-origin resource.", it's used for:
//   * Detecting whether or not the destination URL exists before redirecting
//   * API calls for various websites to find the larger image (e.g. for Flickr)
//     * You can control this with the "Rules using API calls" setting
//   * Downloading the image for the popup
//   * Querying a third-party library
//     * You can control this with the "Allow 3rd-party libraries" setting.
//       3rd-party libraries are disabled by default for security reasons.
// Search for do_request, api_query, and website_query if you want to see what the code does exactly.
//
// Please contact me if you have any questions or concerns regarding the script.
//
// Project links:
//
//   * Github:          https://github.com/qsniyg/maxurl
//   * Discord:         https://discord.gg/fH9Pf54
//   * Reddit:          https://www.reddit.com/r/MaxImage/
//   * Website:         https://qsniyg.github.io/maxurl/
//   * Guide:           https://qsniyg.github.io/maxurl/guide.html
//   * Userscript:
//     * OpenUserJS:    https://openuserjs.org/scripts/qsniyg/Image_Max_URL
//     * Github:        https://raw.githubusercontent.com/qsniyg/maxurl/master/userscript_smaller.user.js
//     * Github (beta): https://raw.githubusercontent.com/qsniyg/maxurl/master/userscript.user.js
//   * Firefox addon:   https://addons.mozilla.org/firefox/addon/image-max-url/
//   * Opera extension: https://addons.opera.com/en/extensions/details/image-max-url/



///<reference path="module.d.ts" />

var $$IMU_EXPORT$$;

// Disable linting because otherwise editing is incredibly slow
// jshint ignore: start
(function() {
	// Don't 'use strict', as it prevents nested functions
	//'use strict';

	var _nir_debug_:(Boolean|Object) = false;

	if (_nir_debug_) {
		_nir_debug_ = {
			no_request: false,
			no_recurse: false,
			no_redirect: true,

			// channels
			map: false,
			cache: false,
			bigimage_recursive: false,
			input: false,
			check_image_get: false,
			find_source: true
		};

		console.log("Loaded");
	}

	var nullfunc = function(){};

	var is_extension = false;
	var is_webextension = false;
	var is_extension_bg = false;
	var is_firefox_webextension = false;
	var extension_send_message = null;
	var extension_error_handler = function(context?){};
	var extension_options_page = null;
	var is_terminated = false;
	var is_extension_options_page = false;
	var is_options_page = false;
	var is_maxurl_website = false;
	var window_location = null;
	var options_page = "https://qsniyg.github.io/maxurl/options.html";
	// todo: update
	var archive_options_page = "https://web.archive.org/web/20210328063940/https://qsniyg.github.io/maxurl/options.html";
	var preferred_options_page = options_page;
	var firefox_addon_page = "https://addons.mozilla.org/en-US/firefox/addon/image-max-url/";
	var userscript_update_url = "https://raw.githubusercontent.com/qsniyg/maxurl/master/userscript_smaller.user.js";
	var greasyfork_update_url = userscript_update_url;
	//var greasyfork_update_url = "https://greasyfork.org/scripts/36662-image-max-url/code/Image%20Max%20URL.user.js";
	var github_issues_page = "https://github.com/qsniyg/maxurl/issues";
	var imu_icon = "https://raw.githubusercontent.com/qsniyg/maxurl/b5c5488ec05e6e2398d4e0d6e32f1bbad115f6d2/resources/logo_256.png";
	var current_version = null;
	var imagetab_ok_override = false;
	var has_ffmpeg_lib = true;

	// -- Currently this is unused, it'll be used in a future release (to workaround the 1MB and 2MB limits for OUJS and Greasyfork respectively) --
	// This is only set for the Greasyfork/OUJS versions if it fails to @require the rules (contents of bigimage).
	// The likely causes would be either a CDN failure, or that the userscript manager doesn't support @require.
	var require_rules_failed = false;

	var get_raw_window = function() {
		if (typeof(unsafeWindow) !== "undefined")
			return unsafeWindow || this.window || window;

		return this.window || window;
	};

	var get_window = function() {
		var raw_window = get_raw_window();
		// https://github.com/qsniyg/maxurl/issues/678#issuecomment-791855176
		// userscript under firefox violentmonkey under twitter's unsafeWindow returns Sandbox, which isn't an EventTarget (breaks "message" handler)
		// .self returns the actual window, which is an EventTarget
		if (raw_window.self)
			return raw_window.self;
		else
			return raw_window;
	};

	var termination_hooks = [];
	var is_suspended = function(full) {
		if (is_terminated || !settings.imu_enabled) {
			return true;
		}

		if (full && is_extension) {
			try {
				chrome.runtime.getURL("manifest.json");
			} catch (e) {
				set_terminated(true);
				return true;
			}
		}

		return false;
	};

	var set_terminated = function(terminated) {
		var was_terminated = is_terminated;
		is_terminated = terminated;

		if (terminated && !was_terminated) {
			array_foreach(termination_hooks, function(hook) {
				hook();
			});
		}
	};

	try {
		window_location = window.location.href;

		(function() {
			var our_url = window_location.replace(/^[a-z]+:\/\/web\.archive\.org\/+web\/+[0-9]+\/+(https?:\/\/)/, "$1");

			if (/^https?:\/\/qsniyg\.github\.io\/+maxurl\/+options\.html/.test(our_url) ||
				/^file:\/\/.*\/maxurl\/site\/options\.html/.test(window_location)) {
				is_options_page = true;
				is_maxurl_website = true;
			} else if (/^https?:\/\/qsniyg\.github\.io\/+maxurl\/+/.test(our_url) ||
				/^file:\/\/.*\/maxurl\/site\/(?:index|about|options)\.html/.test(window_location)) {
				is_maxurl_website = true;
			}
		})();
	} catch(e) {
	}

	var check_if_extension = function() {
		// in sendvid.com, chrome is null, which typeof === "object"
		if (typeof chrome !== "object" || !chrome || typeof chrome.runtime !== "object")
			return;

		try {
			var extension_manifest = chrome.runtime.getManifest();
			is_extension = extension_manifest.name === "Image Max URL";

			if (!is_extension)
				return;

			extension_error_handler = function(context?) {
				try {
					var last_error = chrome.runtime.lastError;
					if (last_error) {
						console.error(last_error.message, context);
					}
				} catch (e) {
					console.error(e);
				}
			};

			is_extension_bg = /^([-a-z]+)extension:\/\/[^/]+\/+_generated_background_page\.html/.test(window_location);

			extension_options_page = chrome.runtime.getURL("extension/options.html");
			is_extension_options_page = window_location.replace(/[?#].*$/, "") === extension_options_page;
			is_options_page = is_options_page || is_extension_options_page;
			//options_page = extension_options_page; // can't load from website
			preferred_options_page = extension_options_page;

			is_webextension = true;
			if (navigator.userAgent.indexOf("Firefox") >= 0)
				is_firefox_webextension = true;

			current_version = extension_manifest.version;

			extension_send_message = function(message, respond?) {
				message = deepcopy(message, {json:true});
				if (!respond)
					respond = nullfunc;

				if (is_extension_bg) {
					return userscript_extension_message_handler(message, respond);
				} else {
					if (!respond || respond === nullfunc) {
						return chrome.runtime.sendMessage(null, message);
					} else {
						return chrome.runtime.sendMessage(null, message, null, function() {
							extension_error_handler(message);
							return respond.apply(this, arguments);
						});
					}
				}
			};

			if (!is_extension_bg) {
				// firefox doesn't load the runtime listener immediately
				setTimeout(function() {
					var runtime_port = chrome.runtime.connect();
					runtime_port.onDisconnect.addListener(function(e) {
						console.error(e);
						extension_error_handler();
						set_terminated(true);
					});
				}, 10);
			}

			extension_error_handler();
		} catch (e) {
			if (is_extension) {
				console.error(e);
				extension_error_handler();
			}
		};
	};

	check_if_extension();

	var is_node = false;
	var is_node_main = false;
	if ((typeof module !== 'undefined' && module.exports) &&
		typeof window === 'undefined' && typeof document === 'undefined') {
		is_node = true;

		try {
			if ((require as any).main === module)
				is_node_main = true;
		} catch (e) {}
	}

	var is_scripttag = false;
	if (typeof imu_variable !== 'undefined' && (typeof(GM_xmlhttpRequest) === 'undefined' &&
												typeof(GM) === 'undefined'))
		is_scripttag = true;

	var is_userscript = false;
	if (!is_node && !is_scripttag && !is_extension)
		is_userscript = true;

	// https://stackoverflow.com/a/326076
	var check_in_iframe = function() {
		try {
			return window.self !== window.top;
		} catch (e) {
			return true;
		}
	};
	var is_in_iframe = check_in_iframe();
	var is_remote_possible = false;

	var is_interactive = (is_extension || is_userscript) && !is_extension_bg;

	var userscript_manager = "unknown";
	var userscript_manager_version = "";
	if (is_userscript) {
		var gm_info = void 0;

		if (typeof GM_info === "function") {
			gm_info = GM_info();
		} else if (typeof GM_info === "object") {
			gm_info = GM_info;
		}

		if (typeof gm_info === "object") {
			if (gm_info.scriptHandler) {
				userscript_manager = gm_info.scriptHandler;
			}

			if (gm_info.version) {
				userscript_manager_version = gm_info.version;
			}
		} else if (typeof GM_fetch === 'function' && gm_info === null) {
			// Unfortunately FireMonkey currently doesn't implement GM_info's scriptHandler:
			//   https://github.com/erosman/support/issues/98#issuecomment-534671229
			// We currently have to rely on this hack
			userscript_manager = "FireMonkey";
			gm_info = {scriptHandler: userscript_manager};
		}

		if (_nir_debug_ && false) {
			console.log("GM_info", gm_info);
		}

		try {
			current_version = gm_info.script.version;
		} catch (e) {
			current_version = null;
		};
	}

	var is_native = function(x) {
		var x_str = x.toString();

		if (x_str.length < 80 && /native code/.test(x_str)) {
			return true;
		} else {
			return false;
		}
	};

	// restore console.log for websites that remove it (twitter)
	// https://gist.github.com/Ivanca/4586071
	//var console_log = function(){ return window.console.__proto__.log.apply(console, arguments) } ;
	//var console_error = function(){ return window.console.__proto__.error.apply(console, arguments) } ;

	// since the userscript is run first, this generally shouldn't be a problem
	var raw_console_log = console.log;
	var console_log = function(...args):void {
		if (settings && !settings.enable_console_logging)
			return;

		return raw_console_log.apply(this, arguments);
	}
	var console_error = console.error;
	var console_warn = console.warn;
	var console_trace = console.trace;

	// twitter overrides console.error to a broken function
	if (!is_native(console_error)) {
		console_error = function(..._args):void {
			var args = ["[ERROR]"];
			for (var i = 0; i < arguments.length; i++) {
				args.push(arguments[i]);
			}

			return console_log.apply(this, args);
		};
	}

	var nir_debug = function(...args) {};
	if (_nir_debug_) {
		// fixme: (channel:string, ...args)
		nir_debug = function(..._args) {
			var channel = arguments[0];
			if (!_nir_debug_[channel])
				return;

			var args = [];
			for (var i = 1; i < arguments.length; i++) {
				args.push(arguments[i]);
			}

			console_log.apply(this, args);
		};
	}

	var JSON_stringify;
	var JSON_parse = JSON.parse;

	// parseInt occasionally crashes for tagesspiegel.de with brave shields and violentmonkey 2.13.0
	// seems to be a race, as it sometimes works, and it always works in the console
	var parse_int = function(x:number|string):number {
		// -0 instead of |0 because 1846699492419 returns -136444861 otherwise (>32bit)
		// -0 works for strings too, but TS doesn't like it
		var asnumber = (x as number)-0;

		var floor = asnumber|0;
		var diff = floor - asnumber;

		// Math.abs
		if (diff < 0)
			diff = -diff;

		if (diff > 1) {
			// todo: use Math.floor if available
			var floored_string = ((x as string)+"").replace(/\..*/, "");
			return (floored_string as any as number)-0;
		}

		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
		// https://www.dpreview.com/ overrides URL
		native_blob, native_URL,
		new_blob,
		our_EventTarget, our_addEventListener, our_removeEventListener,
		string_fromcharcode, string_charat,
		array_reduce, array_reduce_prototype,
		document_createElement;

	if (is_node) {
		base64_decode = function(a) {
			return Buffer.from(a, 'base64').toString('binary');
		};

		base64_encode = function(a) {
			return Buffer.from(a).toString('base64');
		};
	}

	var get_compat_functions = function() {
		var native_functions_to_get = [];

		// ublock prevents JSON.stringify from being used on foxnews.com
		var get_json_stringify = function() {
			try {
				JSON_stringify = JSON.stringify;
			} catch (e) {
				console_warn("Cannot use native JSON.stringify, using slow implementation instead", e);

				var is_json_undefined = function(x) {
					return x === void 0 || typeof x === "function";
				};

				// probably incorrect (especially regarding string handling) and doesn't support formatting
				// does it matter?
				JSON_stringify = function(x) {
					if (is_json_undefined(x))
						return void 0;

					if (typeof x === "string") {
						return '"' + x
							.replace(/\\/g, "\\\\")
							.replace(/"/g, '\\"') + '"';
					}

					if (x === null)
						return "null";

					if (typeof x === "number")
						return x + "";

					if (is_array(x)) {
						var els = [];
						for (var i = 0; i < x.length; i++) {
							var stringified = JSON_stringify(x[i]);
							if (stringified === void 0)
								stringified = "null";

							els.push(stringified);
						}

						return "[" + els.join(",") + "]";
					}

					if (typeof x === "object") {
						var els = [];
						for (var key in x) {
							var stringified = JSON_stringify(x[key]);
							if (stringified === void 0)
								continue;

							els.push('"' + key + '":' + JSON_stringify(x[key]));
						}

						return "{" + els.join(",") + "}";
					}

					// does this happen?
					return void 0;
				};
			}
		};
		get_json_stringify();

		// Nano Defender(?) overrides this on some sites.
		var get_orig_eventtarget = function() {
			// native_functions returns iframe
			var EventTarget_addEventListener, EventTarget_removeEventListener;

			if (is_interactive) {
				our_EventTarget = EventTarget;
				EventTarget_addEventListener = our_EventTarget.prototype.addEventListener;
				EventTarget_removeEventListener = our_EventTarget.prototype.removeEventListener;
			}

			var eventhandler_map = null;

			var init_eventhandler_map = function() {
				if (!eventhandler_map)
					eventhandler_map = new_map();
			};

			our_addEventListener = function(element, event:string, handler:Function, options?:Object) {
				// VM compatibility
				if (element === window && element.unsafeWindow)
					element = element.unsafeWindow;

				// performance
				var suspended_check = function() {return is_suspended(true);};
				if (event === "mousemove") {
					suspended_check = function() {return is_suspended(false);};
				}

				var real_handler = handler;
				handler = function(e) {
					if (suspended_check()) {
						if (is_terminated) our_removeEventListener(element, event, real_handler);
						return;
					}

					return real_handler(e);
				};

				// i??.fastpic.ru: needles are 'click' and 'popMagic'
				var new_handler = function(e) {
					return handler(e);
				};

				init_eventhandler_map();
				map_set(eventhandler_map, real_handler, new_handler);

				EventTarget_addEventListener.call(element, event, new_handler, options);
			};

			our_removeEventListener = function(element, event:string, handler:Function, options?:Object) {
				init_eventhandler_map();
				var new_handler = map_get(eventhandler_map, handler);
				if (!new_handler) {
					console_warn("Modified handler not found, defaulting to specified handler");
					new_handler = handler;
				} else {
					map_remove(eventhandler_map, new_handler);
				}

				EventTarget_removeEventListener.call(element, event, new_handler, options);
			};
		};
		get_orig_eventtarget();

		// i??.fastpic.ru with violentmonkey
		var get_orig_createelement = function() {
			var HTMLDocument_createElement;

			if (is_interactive || is_scripttag || typeof HTMLDocument === "function") {
				HTMLDocument_createElement = HTMLDocument.prototype.createElement;
			}

			document_createElement = function(element) {
				if (!HTMLDocument_createElement) {
					console_error("Unable to create element", element, ", HTMLDocument.prototype.createElement does not exist");
					return;
				}

				return HTMLDocument_createElement.call(document, element);
			};
		};
		get_orig_createelement();

		var sanity_test = function(orig, correct, check, native_func) {
			if (!orig)
				return correct;

			if (check) {
				try {
					if (check(orig))
						return orig;
				} catch (e) {};
			}

			if (native_func) {
				native_functions_to_get.push(native_func);
			}

			return correct;
		};

		var get_is_array = function() {
			var is_array_orig = Array.isArray;
			var is_array_correct = function(x) {
				return x instanceof Array;
			};

			if (is_array_orig) {
				is_array = is_array_orig;
			} else {
				is_array = is_array_correct;
			}

			// FIXME: why is there no check? is this a bug, or was this intentional?
			//is_array = sanity_test(is_array_orig, is_array_correct);
		};
		get_is_array();

		// kickass.com
		var get_compat_string_fromcharcode = function() {
			var string_fromcharcode_orig = null;
			// ublock on clipwatching blocks this entirely
			try {
				string_fromcharcode_orig = String.fromCharCode;
			} catch (e) {}

			var fromcharcode_check = function(func) {
				return func(50) === "2" && func(100) === "d" && func("50", "100") === "2d";
			};

			var fromcharcode_correct = function() {
				var unicode = "";

				for (var i = 0; i < arguments.length; i++) {
					unicode += "\\u" + ("0000" + parseInt(arguments[i]).toString(16)).slice(-4);
				}

				return JSON_parse('"' + unicode + '"');
			};

			string_fromcharcode = sanity_test(string_fromcharcode_orig, fromcharcode_correct, fromcharcode_check);
		};
		get_compat_string_fromcharcode();

		// porn.com (ublock)
		var get_compat_string_charat = function() {
			var string_prototype_charat = String.prototype.charAt;
			var string_charat_orig = function(string, x) {
				return string_prototype_charat.call(string, x);
			};

			var string_charat_correct = function(string, x) {
				var result = string[x];
				if (result === void 0)
					result = "";

				return result;
			};

			var string_charat_check = function(func) {
				var test_string = "abc";
				if (func(test_string, 0) === "a" &&
					func(test_string, 1) === "b" &&
					func(test_string, -1) === "" &&
					func(test_string, 3) === "") {
					return true;
				}

				return false;
			};

			string_charat = sanity_test(string_charat_orig, string_charat_correct, string_charat_check);
		};
		get_compat_string_charat();

		var get_compat_base64 = function() {
			if (is_node)
				return;

			// Some websites replace atob, so we have to provide our own implementation in those cases
			var base64_decode_correct = function(s) {
				return base64_decode_base(s);
			};

			var base64_decode_test = function(func) {
				if (func("dGVzdA==") === "test") {
					return true;
				}

				return false;
			};

			base64_decode = sanity_test(atob, base64_decode_correct, base64_decode_test, "atob");

			var base64_encode_test = function(func) {
				if (func("test") === "dGVzdA==") {
					return true;
				}

				return false;
			};

			var fake_base64_encode = function(s) {
				console_warn("Using fake base64 encoder");
				return s;
			};

			base64_encode = sanity_test(btoa, fake_base64_encode, base64_encode_test, "btoa");
		};
		get_compat_base64();

		var get_compat_array_indexof = function() {
			// https://www.mycomicshop.com/search?minyr=1938&maxyr=1955&TID=29170235
			// this site replaces Array.indexOf
			// cache Array.prototype.indexOf in case it changes while the script is executing
			var array_prototype_indexof = Array.prototype.indexOf;
			var array_indexof_orig = function(array, x) {
				return array_prototype_indexof.call(array, x);
			};

			var array_indexof_correct = function(array, x) {
				if (typeof array === "string") {
					// TODO: make sure Array.from is sane
					array = Array.from(array);
				}

				for (var i = 0; i < array.length; i++) {
					if (array[i] === x) {
						return i;
					}
				}

				return -1;
			};

			var array_indexof_check = function(func) {
				var test_array = ["a", "b"];
				var test_string = "abc";
				if (func(test_array, "not here") === -1 &&
					func(test_array, "b") === 1 &&
					func(test_string, "n") === -1 &&
					func(test_string, "b") === 1 &&
					func(test_string, "bc") === -1) {
					return true;
				}

				return false;
			};

			array_indexof = sanity_test(array_indexof_orig, array_indexof_correct, array_indexof_check);
		};
		get_compat_array_indexof();

		// idol.sankakucomplex.com overrides this with a broken one
		var get_compat_array_reduce = function() {
			var array_prototype_reduce = Array.prototype.reduce;
			var array_reduce_orig = function(array, cb, initial) {
				if (typeof initial !== "undefined")
					return array_prototype_reduce.call(array, cb, initial);
				else
					return array_prototype_reduce.call(array, cb);
			};

			var array_reduce_correct = function(array, cb, initial) {
				var firstindex = 0;

				if (typeof initial === "undefined") {
					if (!array.length) {
						throw new TypeError("Reduce of empty array with no initial value");
					}

					initial = array[0];
					firstindex = 1;
				}

				var acc = initial;
				for (var i = firstindex; i < array.length; i++) {
					acc = cb(acc, array[i], i, array);
				}

				return acc;
			};

			var array_reduce_check = function(func) {
				// should throw 'undefined is not a function'
				try {
					func([]);
					return false;
				} catch (e) {}

				// should throw 'Reduce of empty array with no initial value'
				try {
					func([], function(){});
					return false;
				} catch (e) {}

				var reducer = function(acc, cur, i) {return acc.x + cur.x + i};

				if (isNaN(func([{x:2},{x:2},{x:2}], reducer)) &&
					func([{x:2},{x:6}], reducer) === 9 &&
					func([{x:2}], reducer).x === 2 &&
					func([{x:2}], reducer, {x:6}) === 8) {
					return true;
				}

				return false;
			};

			array_reduce = sanity_test(array_reduce_orig, array_reduce_correct, array_reduce_check);

			array_reduce_prototype = function(cb, initial) {
				return array_reduce(this, cb, initial);
			};
		};
		get_compat_array_reduce();

		var get_compat_string_indexof = function() {
			var string_prototype_indexof = String.prototype.indexOf;
			var string_indexof_orig = function(string, x) {
				return string_prototype_indexof.call(string, x);
			};

			var string_indexof_correct = function(string, x) {
				if (x.length === 0)
					return 0;

				var x_i = 0;
				for (var i = 0; i < string.length; i++) {
					if (string_charat(string, i) === string_charat(x, x_i)) {
						if (x_i + 1 === x.length) {
							return i - x_i;
						} else {
							x_i++;
						}
					} else {
						x_i = 0;
					}
				}

				return -1;
			};

			var string_indexof_check = function(func) {
				var test_string = "abc";
				if (func(test_string, "n") === -1 &&
					func(test_string, "b") === 1 &&
					func(test_string, "bc") === 1 &&
					func(test_string, "bcz") === -1 &&
					func(test_string, "") === 0) {
					return true;
				}

				return false;
			};

			string_indexof = sanity_test(string_indexof_orig, string_indexof_correct, string_indexof_check);
		};
		get_compat_string_indexof();

		var get_compat_url = function() {
			if (is_node)
				return;

			var native_url_check = function(URL) {
				if (typeof URL !== "function" || typeof URL.prototype !== "object")
					return false;

				if (!("searchParams" in URL.prototype))
					return false;

				if (is_interactive) {
					if (!("createObjectURL" in URL) || !("revokeObjectURL" in URL))
						return false;
				}

				return true;
			};

			var orig_URL = URL || webkitURL;
			native_URL = sanity_test(orig_URL, nullfunc, native_url_check, "URL");
		};
		get_compat_url();

		var get_compat_blob = function() {
			if (is_node)
				return;

			var native_blob_check = function(Blob) {
				if (typeof Blob !== "function" || typeof Blob.prototype !== "object")
					return false;

				// doesn't seem to work under Firefox
				// it does exist after a while, but not while checking
				if (false && Blob.name !== "Blob")
					return false;

				if (/*!("arrayBuffer" in Blob.prototype) ||*/ // Not implemented in pale moon
					!("slice" in Blob.prototype) ||
					!("size" in Blob.prototype))
					return false;

				return true;
			};

			var fake_blob = function() {
				console_warn("This is a fake Blob object, you will almost certainly encounter problems.");
			};

			new_blob = function(data, cb, options) {
				cb(new native_blob([data], options));
			};

			native_blob = sanity_test(Blob, fake_blob, native_blob_check, "Blob");

			if (native_blob !== Blob) {
				// todo: sanity check Response and File
				if (typeof Response === "function") {
					new_blob = function(data, cb, options) {
						var response_opt = {};
						if (options && options.type) {
							response_opt.headers = {
								"Content-Type": options.type
							};
						}

						new Response(data, response_opt).blob().then(function(resp) {
							cb(resp);
						});
					};
				} else if (typeof File === "function") {
					new_blob = function(data, cb, options) {
						cb(new File([data], "", options));
					};
				}
			}
		};
		get_compat_blob();

		// this is rather slow (~25ms according to fireattack's profile)
		var native_functions = {};
		var get_native_functions = function(functions) {
			// thanks to tophf here: https://github.com/violentmonkey/violentmonkey/issues/944
			var iframe = document_createElement("iframe");
			iframe.srcdoc = ""; //"javascript:0"
			document.documentElement.appendChild(iframe);
			var frame_window = iframe.contentWindow;

			for (var i = 0; i < functions.length; i++) {
				var func = functions[i];
				native_functions[func] = frame_window[func];
			}

			iframe.parentElement.removeChild(iframe);
		};

		// FIXME: this doesn't work under pale moon: https://github.com/qsniyg/maxurl/issues/349
		if (native_functions_to_get.length > 0) {
			try {
				get_native_functions(native_functions_to_get);
			} catch (e) {
				console_error(e);
			}

			if ("Blob" in native_functions) {
				native_blob = native_functions["Blob"];
			}

			if ("URL" in native_functions) {
				native_URL = native_functions["URL"];
			}

			if ("atob" in native_functions) {
				base64_decode = native_functions["atob"];
			}

			if ("btoa" in native_functions) {
				base64_encode = native_functions["btoa"];
			}
		}
	};
	get_compat_functions();

	var force_array = function<T>(arrayornot:T):Array<T>|T {
		if (!is_array(arrayornot)) {
			return [arrayornot];
		} else {
			return arrayornot;
		}
	}

	var array_extend = function(array:Array<any>, other:Array<any>):void {
		other = force_array(other);
		[].push.apply(array, other);
	};

	var array_foreach = function(array:Array<any>, cb:(value:any, index:number)=>void|false, do_shallow_copy?:boolean):void {
		if (do_shallow_copy) {
			var newarray = [];

			for (var i = 0; i < array.length; i++) {
				newarray.push(array[i]);
			}

			array = newarray;
		}

		for (var i = 0; i < array.length; i++) {
			if (cb(array[i], i) === false)
				return;
		}
	};

	var array_map = function(array:Array<any>, cb:(value:any)=>any):Array<any> {
		var out = [];

		for (var i = 0; i < array.length; i++) {
			out[i] = cb(array[i]);
		}

		return out;
	};

	var array_or_null = function(array:Array<any>):Array<any>|null {
		if (!array || !array.length)
			return null;

		return array;
	};

	var array_upush = function(array:Array<any>, item:any):void {
		if (array_indexof(array, item) < 0)
			array.push(item);
	};

	var string_replaceall = function(str:string, find:string, replace:string):string {
		// TODO: make faster
		return str.split(find).join(replace);
	};

	var match_all = function(str:string, regex:RegExp):Array<RegExpMatchArray>|null {
		var global_regex = new RegExp(regex as any as string, "g");

		var matches = str.match(global_regex);
		if (!matches)
			return null;

		var result = [];
		for (let match of matches) {
			result.push(match.match(regex));
		}

		return result;
	};

	var obj_foreach = function(obj:Object, cb:(key:string, value:any)=>void|false) {
		for (var key in obj) {
			if (cb(key, obj[key]) === false)
				return;
		}
	};

	var obj_extend = function(obj:Object, otherobj:Object):Object {
		for (var key in otherobj) {
			obj[key] = otherobj[key];
		}

		return obj;
	};

	// todo: make type CommonFunctions
	var common_functions:Object = {};

	common_functions["nullfunc"] = function() {};

	common_functions["nullobjfunc"] = function() {
		var x = {
			func: function() {}
		};

		return x;
	};

	common_functions["run_arrayd_string"] = function(str, options) {
		str = str.split("");
		options.cb(str);
		return str.join("");
	};

	common_functions["new_vm"] = function() {
		// si[n] = nth stack item (last = 0)
		var vm_arch = [
			// 0: Push data to the stack
			function(vm) {
				vm.stack.unshift(vm.data);
			},
			// 1: Push arg to the stack
			function(vm) {
				vm.stack.unshift(vm.arg);
			},
			// 2: Pop si[0] .. si[arg]
			function(vm) {
				for (var i = 0; i < vm.arg; i++) {
					vm.stack.shift();
				}
			},
			// 3: Push si[arg] to si[0]
			function(vm) {
				vm.stack.unshift(vm.stack[vm.arg]);
			},
			// 4: Append si[1] to si[0]
			function(vm) {
				vm.stack[0].push(vm.stack[1]);
			},
			// 5: Prepend si[1] to si[0]
			function(vm) {
				vm.stack[0].unshift(vm.stack[1]);
			},
			// 6: Reverse si[0]
			function(vm) {
				vm.stack[0].reverse();
			},
			// 7: Swaps the values at si[1] and si[2] in si[0]
			function(vm) {
				var register = vm.stack[0][vm.stack[2]];
				vm.stack[0][vm.stack[2]] = vm.stack[0][vm.stack[1] % vm.stack[0].length];
				vm.stack[0][vm.stack[1] % vm.stack[0].length] = register;
			},
			// 8: Removes si[1] (id) from si[0]
			function(vm) {
				vm.stack[0].splice(vm.stack[1], 1);
			},
			// 9: Removes everything from the beginning of si[0] to si[1]
			function(vm) {
				vm.stack[0].splice(0, vm.stack[1]);
			},
			// 10: Removes everything from si[1] to the end of si[0]
			function(vm) {
				vm.stack[0].splice(vm.stack[1], vm.stack[0].length);
			},
			// 11: Adds si[2] to the value at si[1] in si[0]
			function(vm) {
				vm.stack[0][vm.stack[1]] += vm.stack[2];
			},
			// 12: Multiplies si[2] with the value at si[1] in si[0]
			function(vm) {
				vm.stack[0][vm.stack[1]] *= vm.stack[2];
			},
			// 13: Negates the value at si[1] in si[0]
			function(vm) {
				vm.stack[0][vm.stack[1]] *= -1;
			},
		];

		var _run_vm = function(ops, data) {
			var vm = {
				stack: [],
				data: data
			};

			for (var i = 0; i < ops.length; i += 2) {
				var inst = ops[i];
				var arg = ops[i + 1];

				vm.arg = arg;
				vm_arch[inst](vm);
			}

			return data;
		};

		var run_vm = function(ops, data) {
			if (typeof data === "string") {
				return common_functions["run_arrayd_string"](data, {
					cb: function(data) {
						return _run_vm(ops, data);
					}
				});
			} else {
				return _run_vm(ops, data);
			}
		};

		return {
			arch: vm_arch,
			op_start: 4, // first 4 are push/pop
			total_instrs: Object.keys(vm_arch).length,
			run: run_vm
		};
	};

	common_functions["create_vm_ops"] = function(instructions) {
		var ops = [];

		// initialize stack
		for (var i = 0; i < 3; i++) {
			ops.push(1, 0);
		}

		array_foreach(instructions, function(inst) {
			var opcode = inst[0];

			// push arguments
			for (var i = 1; i < inst.length; i++) {
				ops.push(1, inst[i]);
			}
			var args_count = inst.length - 1;

			ops.push(
				// push data
				0, null,

				// run operation
				opcode, null,

				// pop data+args
				2, 1 + args_count
			);
		});

		// cleanup
		ops.push(2, 3);

		return ops;
	};

	// ublock blocks accessing Math on sites like gfycat
	var Math_floor, Math_round, Math_random, Math_max, Math_min, Math_abs, Math_pow;
	var get_compat_math = function() {
		if (is_node)
			return;

		try {
			Math_floor = Math.floor;
			Math_round = Math.round;
			Math_random = Math.random;
			Math_max = Math.max;
			Math_min = Math.min;
			Math_abs = Math.abs;
			Math_pow = Math.pow;
		} catch (e) {
			Math_floor = function(x) {
				return x | 0;
			};

			Math_round = function(x) {
				return Math_floor(x + 0.5);
			};

			var math_seed = Date.now();
			var math_vm = null;
			Math_random = function() {
				if (!math_vm) {
					math_vm = common_functions["new_vm"]();
				}

				if (math_vm) {
					var total_instrs = math_vm.total_instrs - math_vm.op_start;
					var bad_instrs = [8, 9, 10, 13];

					var instructions = [];

					var times = math_seed & 0xf;
					if (!times)
						times = 4;
					for (var i = 0; i < times; i++) {
						var instr = (((math_seed >> 4) & 0xf) + ((math_seed >> (i%8)) & 0xf)) % total_instrs + math_vm.op_start;

						if (array_indexof(bad_instrs, instr) >= 0) {
							times++;
							continue;
						}

						instructions.push([
							instr,

							(math_seed & 0xff) + i,
							((math_seed & 0xf) + i) % 5
						]);
					}

					var ops = common_functions["create_vm_ops"](instructions);

					try {
						var new_math_seed = parseFloat(math_vm.run(ops, math_seed + ""));

						if (!isNaN(new_math_seed))
							math_seed += new_math_seed;
					} catch (e) {
						//console_warn(e);
					}
				}

				math_seed += Date.now();
				math_seed %= 1e8;
				return math_seed / 1e8;
			};

			Math_max = function() {
				var max = -Infinity;

				for (var i = 0; i < arguments.length; i++) {
					if (arguments[i] > max)
						max = arguments[i];
				}

				return max;
			};

			Math_min = function() {
				var min = Infinity;

				for (var i = 0; i < arguments.length; i++) {
					if (arguments[i] < min)
						min = arguments[i];
				}

				return min;
			};

			Math_abs = function(x) {
				if (x < 0)
					return -x;

				return x;
			};

			// incorrect but good enough for now
			Math_pow = function(x, y) {
				for (var i = 1; i < y; i++) {
					x *= x;
				}

				return x;
			};
		}
	};
	get_compat_math();

	var get_random_text = function(length:number, num?:boolean) {
		var text = "";

		while (text.length < length) {
			var newnum = Math_floor(Math_random() * 10e8);

			var newtext:string;
			if (!num) {
				newtext = newnum.toString(26);
			} else {
				newtext = newnum.toString(10);
			}

			text += newtext;
		}

		text = text.substr(0, length);
		return text;
	};

	var get_random_id = function() {
		return get_random_text(10) + Date.now();
	};

	var _version_compare_pad_0 = function(array:Array<string>, amount:number) {
		if (amount <= 0)
			return;

		for (var i = 0; i < amount; i++) {
			array.push("0");
		}
	};

	function version_compare(a:string, b:string) {
		// just in case
		if (typeof a !== "string" || typeof b !== "string")
			return null;

		var version_regex = /^[0-9]+(\.[0-9]+){0,}$/;
		if (!version_regex.test(a) ||
			!version_regex.test(b))
			return null;

		var a_split = a.split(".");
		var b_split = b.split(".");

		if (a_split.length !== b_split.length) {
			_version_compare_pad_0(a_split, b_split.length - a_split.length);
			_version_compare_pad_0(b_split, a_split.length - b_split.length);
		}

		for (var i = 0; i < a_split.length; i++) {
			var an = parse_int(a_split[i]);
			var bn = parse_int(b_split[i]);

			if (an < bn)
				return 1;
			if (an > bn)
				return -1;
		}

		return 0;
	}

	var get_options_page = function() {
		if (is_extension)
			return preferred_options_page;

		if (settings && settings.use_webarchive_for_lib) {
			return archive_options_page;
		} else {
			return preferred_options_page
		}
	};

	var id_to_iframe = {};

	// todo: move to do_mouseover
	var get_frame_info = function() {
		return {
			id: current_frame_id,
			//url: window.location.href, // doesn't get updated for the iframe src's attribute?
			url: current_frame_url,
			size: [
				//document.documentElement.scrollWidth,
				//document.documentElement.scrollHeight
				// indavideo.hu has iframes with more height than what is displayed
				window.innerWidth,
				window.innerHeight
			]
		};
	};

	// todo: move to do_mouseover
	var find_iframe_for_info = function(info) {
		if (info.id in id_to_iframe)
			return id_to_iframe[info.id];

		var finish = function(iframe) {
			if (!iframe)
				return iframe;

			id_to_iframe[info.id] = iframe;
			return iframe;
		}

		var iframe_els = document.getElementsByTagName("iframe");
		var newiframes = [];
		for (var i = 0; i < iframe_els.length; i++) {
			if (iframe_els[i].src !== info.url)
				continue;

			newiframes.push(iframe_els[i]);
		}

		// useful for later if we don't have the length <= 1 check
		var ignored_src = false;

		if (newiframes.length === 0) {
			// e.g. indavideo, frame's src != iframe src because it gets redirected (/ at the end is removed)
			//newiframes = iframes as Array<HTMLIFrameElement>; // FIXME: iframes doesn't exist?
			newiframes = [];
			ignored_src = true;
		} else if (newiframes.length <= 1) {
			return finish(newiframes[0]);
		}

		var iframes = newiframes;
		newiframes = [];
		for (var i = 0; i < iframes.length; i++) {
			if (iframes[i].scrollWidth !== info.size[0] ||
				iframes[i].scrollHeight !== info.size[1]) {
				continue;
			}

			newiframes.push(iframes[i]);
		}

		if (newiframes.length <= 1)
			return finish(newiframes[0]);

		// TODO: check cursor too
		return null;
	};

	var iframe_to_id = function(iframe) {
		for (var id in id_to_iframe) {
			if (id_to_iframe[id] === iframe)
				return id;
		}

		return null;
	};

	var id_to_iframe_window = function(id) {
		if (!(id in id_to_iframe))
			return null;

		// no need for contentWindow in top
		if (id !== "top") {
			try {
				if (id_to_iframe[id].contentWindow)
					return id_to_iframe[id].contentWindow;
			} catch (e) {
				// not allowed
				return false;
			}
		}

		return id_to_iframe[id];
	};

	var remote_send_message = null;
	var remote_send_reply = null;
	var remote_reply_ids = {};
	var current_frame_id = null;
	var current_frame_url = null;

	var raw_remote_send_message = null;
	var remote_send_message = common_functions["nullfunc"];
	var remote_send_reply = common_functions["nullfunc"];
	var imu_message_key = "__IMU_MESSAGE__";

	if (is_extension) {
		raw_remote_send_message = function(to, message) {
			extension_send_message(message)
		};

		is_remote_possible = true;
	} else if (is_interactive) {
		if (is_in_iframe && window.parent) {
			id_to_iframe["top"] = window.parent;
		}

		raw_remote_send_message = function(to, message) {
			if (!to && is_in_iframe)
				to = "top"; // fixme?

			var specified_window;
			if (to && to in id_to_iframe) {
				specified_window = id_to_iframe_window(to);
				if (!specified_window) {
					if (_nir_debug_) {
						console_warn("Unable to find window for", to, {is_in_iframe: is_in_iframe, id_to_iframe: id_to_iframe});
					}
					// not allowed
					return;
				}
			}

			message.imu = true;

			var wrapped_message = {};
			wrapped_message[imu_message_key] = serialize_event(message);

			if (!specified_window) {
				for (var i = 0; i < window.frames.length; i++) {
					try {
						window.frames[i].postMessage(wrapped_message, "*");
					} catch (e) {
						if (_nir_debug_) {
							console_warn("Unable to send message to", window.frames[i], e);
						}
						// not allowed
						continue;
					}
				}
			} else {
				specified_window.postMessage(wrapped_message, "*");
			}
		};

		is_remote_possible = true;

		if (window.location.hostname === "cafe.daum.net") {
			// unfortunately they interpret all message events, leading to bugs in their website. thanks to ambler on discord for noticing
			is_remote_possible = false;
		}
	}

	if (is_remote_possible) {
		current_frame_url = window_location;
		current_frame_id = get_random_id() + " " + current_frame_url;

		if (!is_in_iframe)
			current_frame_id = "top";

		remote_send_message = function(to, data, cb) {
			var id = void 0;

			if (cb) {
				id = get_random_id();
				remote_reply_ids[id] = cb;
			}

			var message = {
				type: "remote",
				data: data,
				to: to,
				from: current_frame_id,
				response_id: id
			};

			if (_nir_debug_) {
				console_log("remote_send_message", to, message);
			}

			//console_log("remote", to, data);
			raw_remote_send_message(to, message);
		};

		remote_send_reply = function(to, response_id, data) {
			raw_remote_send_message(to, {
				type: "remote_reply",
				data: data,
				response_id: response_id
			});
		};
	}

	var can_use_remote = function() {
		return is_remote_possible && settings.allow_remote;
	};

	var can_iframe_popout = function() {
		return can_use_remote() && settings.mouseover_use_remote;
	};

	var do_request_browser = function (request) {
		if (_nir_debug_) {
			console_log("do_request_browser", request);
		}

		var method = request.method || "GET";

		var xhr = new XMLHttpRequest();
		xhr.open(method, request.url, true);

		if (request.responseType)
			xhr.responseType = request.responseType;

		if (request.headers) {
			obj_foreach(request.headers, function(header_name, header_value) {
				try {
					xhr.setRequestHeader(header_name, header_value);
				} catch (e) {}
			});
		}

		var do_final = function(override, cb) {
			if (_nir_debug_) {
				console_log("do_request_browser's do_final", xhr, cb);
			}

			var resp = {
				readyState: xhr.readyState,
				finalUrl: xhr.responseURL,
				responseHeaders: xhr.getAllResponseHeaders(),
				responseType: xhr.responseType,
				status: xhr.status, // file:// returns 0, tracking protection also returns 0
				statusText: xhr.statusText,
				timeout: xhr.timeout
			};

			resp.response = xhr.response;

			try {
				resp.responseText = xhr.responseText;
			} catch (e) {}

			cb(resp);
		};

		var add_handler = function(event:string, empty?:boolean) {
			xhr[event] = function() {
				if (empty) {
					return request[event](null);
				}

				do_final({}, function(resp) {
					request[event](resp);
				});
			};
		};

		add_handler("onload");
		add_handler("onerror");
		add_handler("onprogress");
		add_handler("onabort", true);
		add_handler("ontimeout", true);

		try {
			xhr.send(request.data);
		} catch (e) {
			// net::ERR_NETWORK_CHANGED can throw an error
			// thanks to AdClear247 for reporting: https://github.com/qsniyg/maxurl/issues/747

			console_error(e);
			xhr.abort();
		}

		return {
			abort: function() {
				xhr.abort();
			}
		};
	};

	try {
		if (typeof XMLHttpRequest !== "function") {
			do_request_browser = null;
		}
	} catch (e) {
		// adblock on jizzbunker.com, sends an exception with a random magic string if XMLHttpRequest is accessed
		do_request_browser = null;
	}

	var extension_requests = {};

	var do_request_raw = null;
	if (is_extension) {
		do_request_raw = function(data) {
			var reqid;
			var do_abort = false;

			extension_send_message({
				type: "request",
				data: data
			}, function (response) {
				if (response.type !== "id") {
					console_error("Internal error: Wrong response", response);
					return;
				}

				reqid = response.data;

				extension_requests[reqid] = {
					id: reqid,
					data: data
				};

				if (do_abort) {
					extension_send_message({
						type: "abort_request",
						data: reqid
					});

					return;
				}
			});

			return {
				abort: function() {
					if (reqid === void 0) {
						console_warn("abort() was called before the request was initialized");
						do_abort = true;
						return;
					}

					extension_send_message({
						type: "abort_request",
						data: reqid
					});
				}
			};
		};

		// imu:begin_exclude
		// failed experiment to run requests within the browser page
		// the issue is that it will run OPTIONS requests, even when the initial request is redirected
		var bad_do_request_raw = function(data) {
			var req = null;
			var do_abort = false;

			extension_send_message({type: "get_request_nonce"}, function(resp_data) {
				if (do_abort) return;

				var nonce = resp_data.data;

				data = deepcopy(data);

				if (!data.headers) data.headers = {};
				var new_headers = {};

				obj_foreach(data.headers, function(header_name, header_value) {
					if (header_value === null || header_value === "") {
						new_headers["X-IMU-" + nonce + "-D-" + header_name] = "true";
					} else {
						new_headers["X-IMU-" + nonce + "-H-" + header_name] = header_value;
					}
				});

				data.headers = new_headers;
				data.url = "https://" + (window.location.host||"google.com") + "/#IMU-" + nonce + "-" + encodeURIComponent(data.url);

				console_log(data);

				req = do_request_browser(data);
			});

			return {
				abort: function() {
					if (!req) {
						console_warn("abort() was called before the request was initialized");
						do_abort = true;
						return;
					}

					req.abort();
				}
			};
		};
		// imu:end_exclude
	} else if (typeof(GM_xmlhttpRequest) !== "undefined") {
		// idol.sankakucomplex.com overrides array.prototype.reduce
		// not an issue for newer Violentmonkey versions
		if (userscript_manager === "Violentmonkey" && version_compare(userscript_manager_version, "2.12.7") <= 0) {
			do_request_raw = function(data) {
				var orig_cbs = {};

				var is_native = function(x) {
					var x_str = x.toString();

					if (x_str.length < 80 && string_indexof(x_str, "native code") > 0) {
						return true;
					} else {
						return false;
					}
				}

				var revert = [];

				if (Array.prototype.reduce !== array_reduce_prototype && !is_native(Array.prototype.reduce)) {
					var old_reduce = Array.prototype.reduce;

					Array.prototype.reduce = array_reduce_prototype;

					revert.push(function() {
						Array.prototype.reduce = old_reduce;
					});
				}

				var reverted = false;
				var onfinal = function(x, args) {
					if (!reverted) {
						array_foreach(revert, function(revert_func) {
							revert_func();
						});
						reverted = true;
					}

					return orig_cbs[x].apply(this, args);
				};

				if (revert.length) {
					var replace = ["onload", "onabort", "onerror", "ontimeout"];
					array_foreach(replace, function(x) {
						if (x in data) {
							orig_cbs[x] = data[x];
							data[x] = function() {
								return onfinal(x, arguments);
							};
						}
					});
				}

				return GM_xmlhttpRequest(data);
			};
		} else {
			do_request_raw = GM_xmlhttpRequest;
		}
	} else if (typeof(GM) !== "undefined" && typeof(GM.xmlHttpRequest) !== "undefined") {
		do_request_raw = GM.xmlHttpRequest;
	} else if (is_node) {
		do_request_raw = function(request) {
			if (_nir_debug_) {
				console_log("do_request_node", request);
			}

			let http = require("http");
			let https = require("https");

			var method = request.method || "GET";

			let our_http = http;
			if (/^https:/.test(request.url))
				our_http = https;

			let hostinfo = request.url.match(/^[a-z]+:\/\/([^/]+)(?:\/+.*)?$/)[1];
			let port = void 0;
			let hostname = hostinfo;
			let portmatch = hostinfo.match(/^(.*):([0-9]+)$/);
			if (portmatch) {
				hostname = portmatch[1];
				port = portmatch[2]|0;
			}
			let path = request.url.match(/^[a-z]+:\/\/[^/]+(\/.*)?$/)[1] || "/";

			let req = our_http.request({
				hostname: hostname,
				port: port,
				method: method,
				path: path,
				// FIXME: add realistic browser headers, cookie jar
				headers: request.headers
			}, res => {
				let chunks = [];
				res.on("data", chunk => {
					chunks.push(chunk);
				});
				let done_final = false;
				let finalcb = () => {
					if (done_final)
						return;
					done_final = true;

					let rawdata = Buffer.concat(chunks);

					let headersstrs = [];
					for (let i = 0; i < res.rawHeaders.length; i += 2) {
						headersstrs.push([res.rawHeaders[i] + ": " + res.rawHeaders[i+1]].join(""));
					}
					let headersstr = headersstrs.join("\r\n");

					let resp = {
						readyState: 4,
						finalUrl: request.url, // FIXME
						responseHeaders: headersstr,
						responseType: "buffer",
						response: null,
						responseText: null,
						status: res.statusCode,
						statusText: res.statusMessage
					};

					resp.response = rawdata;

					try {
						resp.responseText = rawdata.toString("utf8"); // FIXME
					} catch (e) {}

					if (req.destroyed) {
						request.onabort();
					} else if (!req.complete) {
						request.onerror(resp);
					} else {
						// FIXME: more onerror?
						request.onload(resp);
					}
				};
				// TODO: onprogress
				// TODO: ontimeout
				res.on("close", () => {
					finalcb();
				});
				res.on("end", () => {
					finalcb();
				});
			});

			if (request.data)
				req.write(request.data);

			req.end();

			return {
				abort: function() {
					req.abort();
				}
			};
		};
	}

	if (is_extension && !is_extension_bg) {
		// used for clearing menu items
		extension_send_message({
			type: "init"
		});
	}

	var register_menucommand = common_functions["nullfunc"];
	var unregister_menucommand = common_functions["nullfunc"];
	var num_menucommands = 0;
	var menucommands_map = {};

	var transform_menucommand_func = function(func) {
		if (typeof func === "string") {
			var dest = func;
			func = function() {
				// this gets run for every frame the script is injected in
				if (is_in_iframe)
					return;

				open_in_tab_imu({
					url: dest
				}, false);
			};
		}

		return func;
	};

	if (is_userscript) {
		if (typeof(GM_registerMenuCommand) !== "undefined") {
			register_menucommand = function(name, func) {
				num_menucommands++;

				func = transform_menucommand_func(func);

				var caption = "[" + num_menucommands + "] " + name;
				var id = GM_registerMenuCommand(caption, func);

				if (id === void 0 || id === null)
					id = caption;
				return id;
			};
		}

		if (typeof(GM_unregisterMenuCommand) !== "undefined") {
			unregister_menucommand = function(id) {
				num_menucommands--;

				return GM_unregisterMenuCommand(id);
			};
		}
	} else if (is_extension && !is_extension_bg) {
		register_menucommand = function(name:string, func):string {
			let id = get_random_id();

			func = transform_menucommand_func(func);

			menucommands_map[id] = {
				name,
				func
			};

			extension_send_message({
				type: "register_menucommand",
				data: {
					id: id,
					name: name
				}
			});

			return id;
		};

		unregister_menucommand = function(id:string) {
			extension_send_message({
				type: "unregister_menucommand",
				data: {
					id: id
				}
			});

			delete menucommands_map[id];
		};
	}

	var open_in_tab = common_functions["nullfunc"];

	// todo: move below settings for options page
	if (is_userscript) {
		if (typeof(GM_openInTab) !== "undefined") {
			open_in_tab = GM_openInTab;
		} else if (typeof(GM) !== "undefined" && typeof(GM.openInTab) !== "undefined") {
			open_in_tab = GM.openInTab;
		}

		if (false && open_in_tab !== common_functions["nullfunc"]) {
			register_menucommand("Options", get_options_page());
			register_menucommand("Request support for this page", function() {
				if (is_in_iframe)
					return;

				var location = window.location.href;
				open_in_tab("https://qsniyg.github.io/maxurl/#imu-request-site&url=" + encodeURIComponent(location));
			});
		}
	}

	var open_in_tab_imu = function(imu, bg, cb?:()=>void) {
		if (is_extension) {
			extension_send_message({
				type: "newtab",
				data: {
					imu: imu,
					background: bg || false
				}
			}, cb);
		} else if (is_userscript && open_in_tab) {
			open_in_tab(imu.url, bg);
			if (cb) {
				cb();
			}
		}
	};

	if ((is_userscript && open_in_tab !== common_functions["nullfunc"]) || is_extension) {
		if (is_userscript)
			register_menucommand("Options", get_options_page());

		register_menucommand("Request support for this page", function() {
			if (is_in_iframe)
				return;

			var location = window.location.href;
			open_in_tab_imu({
				url: "https://qsniyg.github.io/maxurl/#imu-request-site&url=" + encodeURIComponent(location)
			}, false);
		});
	}

	var check_tracking_blocked = function(result) {
		// FireMonkey returns null for result if blocked
		// GreaseMonkey returns null for status if blocked
		if (!result || result.status === 0 || result.status === null) {
			if (result && result.finalUrl && /^file:\/\//.test(result.finalUrl))
				return false;

			return true;
		}
		return false;
	};

	type DoRequestData = {
		url:string,
		method?:string,
		withCredentials?:boolean,
		headers?:Record<string, string>,
		imu_mode?:string,
		imu_multipart?:Record<string, string>,
		data?:string,
		onerror?:Function,
		ontimeout?:Function,
		onload?:Function,
		need_blob_response?:boolean,
		trackingprotection_failsafe?:boolean,
		retry_503?:boolean|number,
		retry_503_times?:number,
		responseType?:string,
		imu_responseType?:string,
		cookie_url?:string
	};

	type DoRequestFunction = (data:DoRequestData) => void;

	var do_request:DoRequestFunction|null = null;
	if (do_request_raw) {
		do_request = function(data:DoRequestData) {
			if (_nir_debug_) {
				console_log("do_request", deepcopy(data));
			}

			// For cross-origin cookies
			if (!("withCredentials" in data)) {
				data.withCredentials = true;
			}

			if (!("headers" in data)) {
				data.headers = {};
			}

			if (data.imu_mode) {
				var headers_to_set = {};

				if (data.imu_mode === "document" || data.imu_mode === "iframe") {
					//headers_to_set["accept"] = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9";
					headers_to_set["accept"] = "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8";
					headers_to_set["Sec-Fetch-Dest"] = data.imu_mode === "document" ? "document" : "iframe";
					headers_to_set["Sec-Fetch-Mode"] = "navigate";
					headers_to_set["Sec-Fetch-Site"] = data.imu_mode === "document" ? "same-origin" : "cross-site";
					headers_to_set["Sec-Fetch-User"] = "?1";
				} else if (data.imu_mode === "xhr") {
					headers_to_set["accept"] = "*/*";
					headers_to_set["Sec-Fetch-Dest"] = "empty";
					headers_to_set["Sec-Fetch-Mode"] = "cors";
					headers_to_set["Sec-Fetch-Site"] = "same-origin";

					headers_to_set["origin"] = data.url.replace(/^([a-z]+:\/\/[^/]+)(?:\/+.*)?$/, "$1");
				} else if (data.imu_mode === "image") {
					headers_to_set["accept"] = "image/webp,image/apng,image/*,*/*;q=0.8";
					headers_to_set["Sec-Fetch-Dest"] = "image";
					headers_to_set["Sec-Fetch-Mode"] = "no-cors";
					headers_to_set["Sec-Fetch-Site"] = "same-site";
				} else if (data.imu_mode === "video") {
					headers_to_set["accept"] = "*/*";
					headers_to_set["Sec-Fetch-Dest"] = "video";
					headers_to_set["Sec-Fetch-Mode"] = "no-cors";
					headers_to_set["Sec-Fetch-Site"] = "same-site";
				}

				delete data.imu_mode;

				for (var header in headers_to_set) {
					if (headerobj_get(data.headers, header) === void 0) {
						headerobj_set(data.headers, header, headers_to_set[header]);
					}
				}
			}

			if (data.imu_multipart) {
				//var boundary = "-----------------------------" + get_random_text(20);
				var boundary = "----WebKitFormBoundary" + get_random_text(16);

				// TODO: fix? only tested for one key
				var postdata = "";
				for (var key in data.imu_multipart) {
					var value = data.imu_multipart[key];

					postdata += "--" + boundary + "\r\nContent-Disposition: form-data; name=\"" + key + "\"\r\n\r\n";
					postdata += value + "\r\n";
				}

				postdata += "--" + boundary + "--\r\n";

				headerobj_set(data.headers, "Content-Type", "multipart/form-data; boundary=" + boundary);
				data.data = postdata;

				delete data.imu_multipart;
			}

			var orig_data = deepcopy(data);

			if (typeof data.url === "string")
				data.url = data.url.replace(/#.*/, "");

			if (!data.onerror)
				data.onerror = data.onload;

			if (!data.ontimeout)
				data.ontimeout = data.onerror;

			var raw_request_do = do_request_raw;
			if (is_userscript && settings.allow_browser_request) {
				if (userscript_manager === "Falkon GreaseMonkey" ||
					// USI doesn't properly support blob responses: https://bitbucket.org/usi-dev/usi/issues/13/various-problems-with-gm_xmlhttprequest
					(userscript_manager === "USI" && data.need_blob_response)) {
					raw_request_do = do_request_browser;
					delete data.trackingprotection_failsafe;
				}
			}

			if (data.retry_503) {
				if (data.retry_503 === true || typeof data.retry_503 !== "number")
					data.retry_503 = parse_int(settings.retry_503_times);

				if (data.retry_503 > 0) {
					var real_onload_503 = data.onload;
					var real_onerror_503 = data.onerror;

					var finalcb_503 = function(resp, iserror) {
						if (_nir_debug_) {
							console_log("do_request's finalcb_503:", resp, iserror, deepcopy(data));
						}

						if (resp.status === 503) {
							console_warn("Received status 503, retrying request", resp, orig_data);
							orig_data.retry_503 = data.retry_503 - 1;

							setTimeout(function() {
								do_request(orig_data);
							}, parse_int(settings.retry_503_ms) || 1);
						} else {
							if (iserror) {
								real_onerror_503(resp);
							} else {
								real_onload_503(resp);
							}
						}
					};

					data.onload = function(resp) {
						finalcb_503(resp, false);
					};

					data.onerror = function(resp) {
						finalcb_503(resp, true);
					};
				}
			}

			if (data.trackingprotection_failsafe && settings.allow_browser_request && do_request_browser) {
				var real_onload = data.onload;
				var real_onerror = data.onerror;

				var finalcb = function(resp, iserror) {
					if (_nir_debug_) {
						console_log("do_request's finalcb:", resp, iserror);
					}

					if (check_tracking_blocked(resp)) {
						// Workaround for a bug in FireMonkey where it calls both onload and onerror: https://github.com/erosman/support/issues/134
						data.onload = null;
						data.onerror = null;

						var newdata = shallowcopy(data);
						newdata.onload = real_onload;
						newdata.onerror = real_onerror;

						if (newdata.imu_responseType === "blob") {
							newdata.responseType = "blob";
						}

						return do_request_browser(newdata);
					} else {
						if (iserror) {
							real_onerror(resp);
						} else {
							real_onload(resp);
						}
					}
				};

				data.onload = function(resp) {
					finalcb(resp, false);
				};

				data.onerror = function(resp) {
					finalcb(resp, true);
				};
			}

			if (data.responseType === "blob" && !settings.use_blob_over_arraybuffer) {
				(function(real_onload) {
					data.onload = function(resp) {
						var newresp = resp;

						var final = function() {
							if (_nir_debug_) {
								console_log("do_request's arraybuffer->blob:", deepcopy(resp), newresp);
							}

							real_onload(newresp);
						};

						if (resp.response) {
							var mime = null;
							// hack for extension for performance
							if (is_extension && "_responseEncoded" in resp && resp._responseEncoded.type) {
								mime = resp._responseEncoded.type
							} else if (resp.responseHeaders) {
								var parsed_headers = headers_list_to_dict(parse_headers(resp.responseHeaders));
								if (parsed_headers["content-type"]) {
									mime = parsed_headers["content-type"];
								}
							}

							newresp = shallowcopy(resp);
							var blob_options = void 0;
							if (mime) {
								blob_options = {type: mime};
							}

							new_blob(resp.response, function(blob) {
								newresp.response = blob;
								final();
							}, blob_options);
						} else {
							final();
						}
					};
				})(data.onload);

				data.responseType = "arraybuffer";
				data.imu_responseType = "blob";
			}

			if (_nir_debug_) {
				console_log("do_request (modified data):", deepcopy(data));
			}

			return raw_request_do(data);
		};
	} else if (is_interactive) {
		console.warn("Unable to initialize do_request, most functions will likely fail");
	}

	var fixup_filename = function(filename) {
		var special_regex = /["<>/:?\\*|\^]/g;

		if (settings.filename_replace_special_underscores)
			return filename.replace(special_regex, "_");

		return filename;
	};

	let is_same_origin = function(url1, url2) {
		// https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy
		// FIXME: this returns failure for http://site.com:80/ and http://site.com/
		let norm = url => url.replace(/^([a-z]+:\/\/[^/]+\/+).*/, "$1");

		return norm(url1) === norm(url2);
	};

	var do_browser_download = function(imu, filename, cb?) {
		if (_nir_debug_) {
			console_log("do_browser_download", imu, filename, cb);
		}

		var a = document_createElement("a");

		a.href = imu.url;

		if (filename && filename.length > 0) {
			a.setAttribute("download", fixup_filename(filename));
		} else {
			var attr = document.createAttribute("download");
			a.setAttributeNode(attr);
		}

		// download only works for same-origin urls: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a
		if (!is_same_origin(window_location, a.href)) {
			a.setAttribute("target", "_blank");
		}

		a.style.display = "none";
		a.onclick = function(e) {
			e.stopPropagation();
			e.stopImmediatePropagation();
			return true;
		};

		document.body.appendChild(a);
		a.click();

		setTimeout(function() {
			document.body.removeChild(a);
		}, 500);

		if (cb)
			cb();
	};

	var do_download = function(imu, filename, size, cb) {
		if (true||_nir_debug_) {
			console_log("do_download", imu, filename, size, cb);
		}

		if (false) {
			request_chunked(imu, {
				onload: function(data) {
					console_log("finished", data);

					var blob = new native_blob([data.data], {
						type: data.mime || void 0
					});
					var objurl = create_objecturl(blob);

					do_browser_download({
						url: objurl,
					}, filename, cb);

					setTimeout(function() {
						revoke_objecturl(objurl);
					}, 500);
				},
				onprogress: function(progobj) {
					console_log(progobj.percent, progobj);
				}
			});
			return;
		}

		var use_gm_download = is_userscript && typeof GM_download !== "undefined" && settings.enable_gm_download;
		var gm_download_max = parseFloat(settings.gm_download_max as any as string) || 0;
		if (use_gm_download && size && gm_download_max) {
			if ((gm_download_max * 1024 * 1024) < size) {
				use_gm_download = false;
			}
		}

		var is_data = false;
		if (imu && imu.url) {
			is_data = /^data:/.test(imu.url);
		}

		// hacky but works for now
		if (is_data) {
			return do_browser_download(imu, filename, cb);
		}

		if (is_extension) {
			extension_send_message({
				type: "download",
				data: {
					imu: imu,
					filename: fixup_filename(filename),
					force_saveas: !!settings.enable_webextension_download
				}
			}, function() {
				if (cb)
					cb();
			});
		} else if (use_gm_download) {
			var headers;

			if (imu.headers) {
				if (false) {
					// why? this breaks both tampermonkey and violetmonkey
					headers = headers_dict_to_list(imu.headers);
				} else {
					headers = imu.headers;
				}
			}

			var download_obj = {
				url: imu.url,
				headers: headers,
				saveAs: true,
				onerror: function(error) {
					if (error && error.error && error.error !== "not_succeeded") {
						do_browser_download(imu, filename, cb);
					}
				}
			};

			if (filename) {
				download_obj["name"] = fixup_filename(filename);
			} else {
				download_obj["name"] = "download"; // it can't be blank
			}

			if (_nir_debug_) {
				console_log("GM_download", deepcopy(download_obj));
			}

			GM_download(download_obj);
		} else {
			do_browser_download(imu, filename, cb);
		}
	};

	var do_blob_download = function(blob, filename, cb) {
		var objurl = create_objecturl(blob);

		do_browser_download({
			url: objurl,
		}, filename);

		setTimeout(function() {
			revoke_objecturl(objurl);
			if (cb) cb();
		}, 500);
	};

	var multiqueue = function(options, cb) {
		var running = false;

		var currently_running = 0;

		// todo: support adding new items mid-run
		var run_single = function() {
			if (!options.queue.length) {
				if (currently_running <= 0) {
					return cb();
				}

				return;
			}

			var item = options.queue.shift();

			currently_running++;
			options.runner(item, function() {
				currently_running--;
				run_single();
			});
		};

		var run = function() {
			if (running) return;
			running = true;

			for (var i = options.concurrency; i > 0; i--) {
				run_single();
			}
		};

		return {
			add: function(x) {
				options.queue.push(x);
			},
			start: run
		};
	};

	var ImpreciseProgress = function(options) {
		this.elements_num = options.elements_num || 0;
		this.total_size = options.total_size || 0;
		//this.total_size_known = false;
		this.known_elements = {};
		this.finished = false;

		var last_percent = 0;

		this.calc_completion = function() {
			var known_total = 0;
			var known_num = 0;
			var known_progress = 0;
			var approx = [];
			obj_foreach(this.known_elements, function(id, obj) {
				if (!obj.size && obj.progress_ratio) {
					approx.push(obj);
					return;
				}

				known_total += obj.size;
				known_progress += obj.progress;
				known_num++;
			});

			var total = this.total_size;
			var total_accurate = true;

			if (approx.length) {
				total_accurate = false;

				var average_length = 1;
				if (known_num) {
					average_length = known_total / known_num;
				}

				array_foreach(approx, function(obj) {
					known_total += average_length;
					known_progress += obj.progress_ratio * average_length;
					known_num++;
				});
			}

			if (!total) {
				total = known_total;

				var unknown_count = this.elements_num - known_num;
				if (unknown_count > 0 && known_num > 0) {
					total += (known_total / known_num) * unknown_count;
					total_accurate = false;
				}
			}

			var retobj = {
				percent: known_progress / total,
				total: total,
				total_accurate: total_accurate,
				loaded: known_progress
			};

			if (this.finished) {
				retobj.percent = 1;
				retobj.loaded = retobj.total;
			}

			return retobj;
		};

		this._do_cb = function() {
			var completion = this.calc_completion();

			if (completion.percent === last_percent) return;
			last_percent = completion.percent;

			options.cb(completion);
		};

		this.update = function(id, progress, size) {
			if (!(id in this.known_elements)) {
				this.known_elements[id] = {
					progress: 0,
					size: 0
				};
			}

			if (size || !progress) {
				this.known_elements[id].progress = progress;
				this.known_elements[id].size = size;
			} else if (this.known_elements[id].size) {
				this.known_elements[id].progress = progress * this.known_elements[id].size;
			} else {
				this.known_elements[id].progress_ratio = progress;
			}

			this._do_cb();
		};

		this.update_progobj = function(id, progobj) {
			this.update(id, progobj.loaded, progobj.total);
		};

		this.finish_id = function(id) {
			this.update(id, 1);
		};

		this.finish = function() {
			this.finished = true;

			this._do_cb();
		};
	};

	var request_chunked = function(xhrobj, options) {
		if (!xhrobj.headers) {
			xhrobj.headers = {};
		}

		xhrobj.responseType = "arraybuffer";

		var do_progress = !!options.onprogress;

		var get_contentrange_length = function(headers) {
			if (!("content-range" in headers)) {
				return null;
			} else {
				// todo: improve
				var range = headers["content-range"].split("/");
				return parse_int(range[1]);
			}
		};

		var download_chunk = function(start, end, cb, progresscb) {
			//console_log("downloading", start, end, xhrobj.url);

			var ourobj = deepcopy(xhrobj);
			ourobj.method = "GET";

			var range_value = "bytes=" + start + "-";
			if (end) range_value += (end - 1);

			var id = start;

			headerobj_set(ourobj.headers, "Range", range_value);

			if (progresscb) {
				ourobj.onprogress = function(resp) {
					if (resp.loaded && resp.total) {
						var headers = headers_list_to_dict(parse_headers(resp.responseHeaders));
						var contentlength = get_contentrange_length(headers);

						return progresscb(id, resp.loaded, resp.total, contentlength);
					}
				};

				ourobj.onload = function(resp) {
					var length;

					if (end) length = end - start;
					if (resp.response) length = resp.response.byteLength; // probably the only one that's actually needed?

					if (!length) {
						var headers = headers_list_to_dict(parse_headers(resp.responseHeaders));
						if ("content-length" in headers) {
							length = parse_int(headers["content-length"]);
						}
					}

					progresscb(id, length, length);
					cb(resp);
				};
			} else {
				ourobj.onload = cb;
			}

			do_request(ourobj);
		};

		var ip = null, chunk_progress = null;
		if (do_progress) {
			ip = new ImpreciseProgress({
				cb: options.onprogress,
				elements_num: 1
			});

			chunk_progress = function(id, progress, total, full_total) {
				if (!ip.total_size && full_total) ip.total_size = full_total;

				ip.update(id, progress, total);
			};
		}

		var data = null;
		var mime = null;

		var final_cb = function(resp) {
			if (do_progress) ip.finish();
			options.onload({
				data: data,
				mime: mime
			}, resp);
		};

		var chunk_size = options.chunk_size;
		if (!chunk_size && chunk_size !== 0)
			chunk_size = 512*1024;

		// todo: GET, if Accept-Ranges is present, abort, save the current response, then go with chunked
		// more info: https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests
		// or maybe just check 200/206 instead
		download_chunk(0, chunk_size, function(resp) {
			var headers = headers_list_to_dict(parse_headers(resp.responseHeaders));

			var content_length = 0;
			if (resp.status === 200) {
				content_length = resp.response.byteLength;
			} else if (resp.status === 206) {
				content_length = get_contentrange_length(headers);
				if (content_length === null) {
					console_error("Unable to find length through content-range");
					return options.onload(null, resp);
				}
			} else {
				console_error("Bad status", resp.status, resp);
				return options.onload(null, resp);
			}

			data = new Uint8Array(content_length);
			data.set(new Uint8Array(resp.response), 0);

			if (resp.response.byteLength >= content_length) {
				return final_cb(resp);
			}

			if ("content-type" in headers) {
				mime = headers["content-type"];
			}

			if (do_progress) ip.total_size = content_length;
			//console_log(content_length);

			// todo: instead of this, maybe just keep running until 200/no more data?
			var queue = [];
			for (var start = resp.response.byteLength;; start += chunk_size) {
				var val = [start];

				var do_break = true;
				if (content_length - start > chunk_size) {
					val.push(start + chunk_size);
					do_break = false;
				}

				queue.push(val);

				if (do_break) break;
			}
			if (do_progress) ip.elements_num += queue.length;

			//data.set(new Uint8Array(resp.response), 0);

			var mqueue = multiqueue({
				concurrency: options.chunks || 5,
				queue: queue,
				runner: function(item, cb) {
					download_chunk(item[0], item[1], function(resp) {
						// todo: check errors
						//console_log(item[0], item[1], resp.response.byteLength, content_length);
						data.set(new Uint8Array(resp.response), item[0]);
						cb();
					}, chunk_progress);
				}
			}, function() {
				final_cb(resp);
			});

			mqueue.start();
		}, chunk_progress);
	};

	var native_clipboard_write = null;
	var browser_clipboard_write = null;
	var browser_clipboard_api_write = null;

	if (is_interactive) {
		browser_clipboard_write = function(data, cb) {
			if (_nir_debug_)
				console_log("clipboard_write execcommand", data);

			var input = document.createElement("textarea");

			// display: none and visibility: hidden prevent it from being copied in chrome
			input.style.height = "1px";
			input.style.width = "1px";
			input.style.resize = "none";
			(input.style as any).appearance = "none";
			input.style.border = "0";
			input.style.margin = "0";
			input.style.padding = "0";
			input.style.display = "inline";
			input.style.cursor = "default";

			document.body.appendChild(input);

			input.innerText = data.text;
			input.focus();
			input.select();

			setTimeout(function() {
				document.body.removeChild(input);
			}, 100);

			cb(!!document.execCommand("copy"));
		};

		// firefox (83) doesn't yet support clipboard.write
		if (navigator.clipboard && (navigator.clipboard.write || navigator.clipboard.writeText)) {
			browser_clipboard_api_write = function(data, cb) {
				if (_nir_debug_)
					console_log("clipboard_write clipboard_api", data);

				var promise;

				var can_use_writetext = data.mime === "text/plain" && navigator.clipboard.writeText;

				// though writeText is a wrapper over write, it allows us to avoid creating a blob, which can be an issue on some websites
				// for some reason, chrome doesn't allow creating a ClipboardItem without a blob
				if (!can_use_writetext && navigator.clipboard.write && typeof ClipboardItem === "function") {
					var mimes = {};
					mimes[data.mime] = new native_blob([data.text], {type: data.mime});

					var item = new ClipboardItem(mimes);
					promise = navigator.clipboard.write([item]);
				} else if (can_use_writetext) {
					promise = navigator.clipboard.writeText(data.text);
				} else {
					return cb(false);
				}

				promise.then(
					function() {cb(true);},
					function(e) {
						console.error(e);
						cb(false);
					}
				)
			};
		}
	}

	if (is_userscript) {
		if (typeof GM_setClipboard === "function") {
			native_clipboard_write = function(data, cb) {
				// Violentmonkey doesn't support the info object that Tampermonkey supports, so just use mime by itself
				GM_setClipboard(data.text, data.mime);
				cb(true);
			};
		} else if (typeof GM === "object" && typeof GM.setClipboard === "function") {
			native_clipboard_write = function(data, cb) {
				GM.setClipboard(data.text);
				cb(true);
			};
		}
	}

	var clipboard_write = function(data, cb?) {
		if (!cb) cb = nullfunc;

		if (typeof data === "string") {
			data = {text: data};
		}

		if (!data.mime) data.mime = "text/plain";

		var writers = [
			native_clipboard_write,
			browser_clipboard_api_write,
			browser_clipboard_write
		];

		var do_write = function() {
			var writer;
			for (var i = 0; i < writers.length; i++) {
				if (!writers[i]) {
					writers.shift();
					i--;
					continue;
				}

				writer = writers[i];
				break;
			}

			writer(data, function(success) {
				if (writers.length > 0 && !success) {
					writers.shift();
					return do_write();
				}

				cb(success);
			});
		};

		do_write();
	};

	// this might be different later
	var clipboard_write_link = clipboard_write;

	var get_cookies = null;
	if (is_extension) {
		get_cookies = function(url, cb) {
			if (settings.browser_cookies === false) {
				return cb(null);
			}

			extension_send_message({
				type: "getcookies",
				data: {url: url}
			}, function(message) {
				cb(message.data);
			});
		};
	} else if (is_userscript) {
		// TODO: support GM_cookie
		get_cookies = function(url, cb, options) {
			if (settings.browser_cookies === false) {
				return cb(null);
			}

			if (!options) {
				options = {};
			}

			if (options.need_full) {
				return cb(null);
			}

			var host_domain = get_domain_from_url(window_location);
			var host_domain_nosub = get_domain_nosub(host_domain);

			var url_domain = get_domain_from_url(url);
			var url_domain_nosub = get_domain_nosub(url_domain);

			// this is ugly
			if (host_domain_nosub === url_domain_nosub) {
				cb(cookies_str_to_list(document.cookie));
			} else {
				cb(null);
			}
		};
	}

	var _localstorage_check_origin = function(url) {
		var url_domain = get_domain_from_url(url);
		var host_domain = get_domain_from_url(window_location);

		return url_domain.toLowerCase() === host_domain.toLowerCase();
	};

	// internal helper function to get items from localStorage
	var _localstorage_get_items = function(items, options) {
		if (!options)
			options = {};

		var result = {};

		var storage = localStorage;
		if (options.storage === "session")
			storage = sessionStorage;

		array_foreach(items, function(item) {
			result[item] = storage.getItem(item);
		});

		return result;
	};

	var get_localstorage = null;
	if (is_extension) {
		get_localstorage = function(url:string, keys:Array<string>, cb, options) {
			extension_send_message({
				type: "get_localstorage",
				data: {
					url: url,
					keys: keys,
					options: options
				}
			}, function(data) {
				if (!data)
					return cb(null);

				cb(data.data);
			});
		};
	} else if (is_userscript) {
		get_localstorage = function(url:string, keys:Array<string>, cb, options) {
			if (!_localstorage_check_origin(url))
				return cb(null);

			cb(_localstorage_get_items(keys, options));
		};
	}

	var cookies_str_to_list = function(cookiesstr) {
		var cookies = [];

		var splitted = cookiesstr.split(/;\s*/);
		array_foreach(splitted, function(kv) {
			var match = kv.match(/^\s*([^=\s]+)\s*=\s*(?:"([^"]+)"|([^"]\S*))\s*$/);
			if (!match) {
				console_warn("Unable to parse cookie", kv);
				return;
			}

			cookies.push({name: match[1], value: match[2] || match[3]});
		});

		return cookies;
	};

	var cookies_to_httpheader = function(cookies) {
		// deduplication apparently isn't necessary (browser duplicates them too)

		var strs = [];
		for (var i = 0; i < cookies.length; i++) {
			var str = cookies[i].name + "=" + cookies[i].value;
			strs.push(str);
		}

		return strs.join("; ");
	};

	type BigImageFilter = (url:string) => boolean;

	var bigimage_filter:BigImageFilter = function(url:string):boolean {
		return true;
	};

	let host_filter:BigImageFilter = function(url:string):boolean {
		return true;
	};

	let host_html_filter:BigImageFilter = function(url:string):boolean {
		return true;
	};

	if (is_interactive || is_extension_bg) {
		let blackwhitelist_filter = function(url:string, regexes, option) {
			let result = true;

			for (var i = 0; i < regexes.length; i++) {
				if (regexes[i].test(url)) {
					result = false;
					break;
				}
			}

			if (option === "whitelist") {
				return !result;
			} else {
				return result;
			}
		};

		bigimage_filter = function(url) {
			return blackwhitelist_filter(url, blacklist_regexes, settings.bigimage_blacklist_mode);
		};

		host_filter = function(url) {
			let regexes = host_blacklist_regexes;
			if (settings.apply_blacklist_host)
				regexes = blacklist_regexes;

			return blackwhitelist_filter(url, regexes, settings.host_blacklist_mode);
		};

		host_html_filter = function(url) {
			console.log(host_html_blacklist_regexes);
			return blackwhitelist_filter(url, host_html_blacklist_regexes, settings.host_html_blacklist_mode);
		};
	}

	type BigImageRuleSpecificOptions = {
		deviantart_prefer_size?:boolean,
		deviantart_support_download?:boolean,
		ehentai_full_image?:boolean,
		imgur_source?:boolean,
		imgur_nsfw_headers?:string, // unused?
		instagram_use_app_api?:boolean,
		instagram_dont_use_web?:boolean,
		instagram_prefer_video_quality?:boolean,
		instagram_gallery_postlink?:boolean,
		snapchat_orig_media?:boolean,
		teddit_redirect_reddit?:boolean,
		tiktok_no_watermarks?:boolean,
		tiktok_thirdparty?:string|null,
		tumblr_api_key?:string|null,
		twitter_use_ext?:boolean,
		linked_image?:boolean
	};

	type BigImageOptions = {
		fill_object?:boolean,
		null_if_no_change?:boolean,
		catch_errors?:boolean,
		use_cache?:boolean|"read",
		use_api_cache?:boolean,
		urlcache_time?:number,
		iterations?:number,
		exclude_problems?:Array<string>,
		exclude_videos?:boolean,
		include_pastobjs?:boolean,
		force_page?:boolean,
		allow_thirdparty?:boolean,
		allow_thirdparty_libs?:boolean,
		allow_thirdparty_code?:boolean,
		process_format?:Object,
		filter?:BigImageFilter,
		rule_specific?:BigImageRuleSpecificOptions,
		do_request?:DoRequestFunction,
		get_cookies?:Function,
		host_url?:string,
		document?:Document,
		window?:Window,
		element?:HTMLElement,
		cb?:Function
	};

	var default_options:BigImageOptions = {
		fill_object: true,
		null_if_no_change: false,
		catch_errors: true,
		use_cache: true,
		use_api_cache: true,
		urlcache_time: 60*60,
		iterations: 200,
		exclude_problems: [
			"watermark",
			"smaller",
			"possibly_different",
			"possibly_broken"
		],
		exclude_videos: false,
		include_pastobjs: true,
		force_page: false,
		allow_thirdparty: false,
		allow_thirdparty_libs: true,
		allow_thirdparty_code: false,
		process_format: {},
		filter: bigimage_filter,

		rule_specific: {
			deviantart_prefer_size: false,
			deviantart_support_download: true,
			ehentai_full_image: true,
			imgur_source: true,
			imgur_nsfw_headers: null,
			instagram_use_app_api: false,
			instagram_dont_use_web: false,
			instagram_prefer_video_quality: true,
			instagram_gallery_postlink: false,
			snapchat_orig_media: true,
			teddit_redirect_reddit: true,
			tiktok_no_watermarks: false,
			tiktok_thirdparty: null,
			tumblr_api_key: null,
			twitter_use_ext: false,
			linked_image: false,
		},

		do_request: do_request,
		get_cookies: get_cookies,
		host_url: null,
		document: null,
		window: null,
		element: null,

		cb: null
	};

	type VideoDelivery = null|"hls"|"dash";
	type VideoProp = boolean|"hls"|"dash";

	type InfoMediaInfo = {
		type: "image"|"video",
		delivery?: VideoDelivery,
		is_live?: boolean,
		codec?: string|null
	};

	type InfoExtraObject = {
		page?: string|null,
		caption?: string|null,
		created_date?: number|null,
		updated_date?: number|null,
		author_username?: string|null,
		id?: string|null
	};

	type InfoProblemsObject = {
		watermark?: boolean,
		smaller?: boolean,
		possibly_different?: boolean,
		possibly_broken?: boolean,
		possibly_upscaled?: boolean,
		bruteforce?: boolean
	}

	type SubtitleObject = {
		language_code?: string,
		title?: string,
		url?: string,
		mime?: string
	};

	type BigImageInfoSObject = {
		url?: string|null,
		always_ok?: boolean,
		likely_broken?: boolean,
		can_head?: boolean,
		can_multiple_request?: boolean,
		head_ok_errors?: Array<any>,
		head_wrong_contenttype?: boolean,
		head_wrong_contentlength?: boolean,
		need_blob?: boolean,
		need_data_url?: boolean,
		waiting?: boolean,
		redirects?: boolean,
		forces_download?: boolean,
		is_private?: boolean,
		is_pagelink?: boolean,
		is_original?: boolean,
		norecurse?: boolean,
		forcerecurse?: boolean,
		can_cache?: boolean,
		bad?: boolean,
		bad_if?: Array<any>,
		fake?: boolean,
		media_info?: InfoMediaInfo,
		video?: VideoProp,
		subtitles?: Array<SubtitleObject>,
		album_info?: any, // fixme
		headers?: Record<string, string>,
		cookie_url?: string|null,
		need_credentials?: boolean,
		content_type?: string|null,
		max_chunks?: number,
		referer_ok?: {
			same_domain?: boolean,
			same_domain_nosub?: boolean
		},
		extra?: InfoExtraObject,
		filename?: string,
		problems?: InfoProblemsObject
	};

	type BigImageInfoSingle = BigImageInfoSObject | string;

	type BigImageInfoMObject = Array<BigImageInfoSObject>;
	type BigImageInfoMulti = Array<BigImageInfoSingle>;

	type BigImageInfoObject = BigImageInfoSingle | BigImageInfoMulti | BigImageInfoMObject;

	var default_object:BigImageInfoSObject = {
		url: null,
		always_ok: false,
		likely_broken: false,
		can_head: true,
		can_multiple_request: true,
		head_ok_errors: [],
		head_wrong_contenttype: false,
		head_wrong_contentlength: false,
		need_blob: false,
		need_data_url: false,
		waiting: false,
		redirects: false,
		forces_download: false,
		is_private: false,
		is_pagelink: false,
		is_original: false,
		norecurse: false,
		forcerecurse: false,
		can_cache: true,
		bad: false,
		bad_if: [],
		fake: false,
		media_info: {
			type: "image", // "image" or "video"
			delivery: null, // "hls" or "dash"
			is_live: false
		},
		video: false, // deprecated
		album_info: null,
		headers: {},
		// host url to copy cookies from
		cookie_url: null,
		// whether credentials need to be sent. this is mainly added for rules to specify that credentials are not needed (e.g. when using cdns)
		need_credentials: true,
		// overrides the content type for websites that send the wrong one
		content_type: null,
		// maximum amount of chunks for downloading, 0 means unlimited
		max_chunks: 0,
		referer_ok: {
			same_domain: false,
			same_domain_nosub: false
		},
		extra: {
			page: null,
			caption: null,
			created_date: null,
			updated_date: null,
			author_username: null,
			id: null
		},
		filename: "",
		problems: {
			watermark: false,
			smaller: false,
			possibly_different: false,
			possibly_broken: false,
			possibly_upscaled: false,
			bruteforce: false
		}
	};

	function is_element(x:any):boolean {
		if (!x || typeof x !== "object" || is_array(x))
			return false;

		if (("namespaceURI" in x) && ("nodeType" in x) && ("nodeName" in x) && ("childNodes" in x)) {
			return true;
		}

		// window
		if (typeof x.HTMLElement === "function" && typeof x.navigator === "object") {
			return true;
		}

		// very slow
		if (is_interactive) {
			let objects = [Node, Element, HTMLDocument, Window];

			for (let obj of objects) {
				// some websites override Window
				try {
					if (x instanceof obj)
						return true;
				} catch (e) {
					console_error(e);
				}
			}
		}

		return false;
	}

	function is_iterable_object(x:any):boolean {
		return typeof x === "object" && x !== null && !is_array(x) && !is_element(x);
	}

	var shallowcopy_obj = function(x:Object):Object {
		var result = {};

		for (var key in x) {
			result[key] = x[key];
		}
		return result;
	};

	if ("assign" in Object) {
		// FIXME: should this be kept? it's faster, but it causes issues with object instances, like dom rects. it works fine with plain objects though
		// it's about as good as JSON.parse(JSON.stringify(x)), but shallow
		shallowcopy_obj = function(x) {
			return Object.assign({}, x);
		};
	}

	var shallowcopy_array = function<T>(x:Array<T>):Array<T> {
		var result = [];

		for (var i = 0; i < x.length; i++) {
			result.push(x[i]);
		}

		return result;
	};

	function shallowcopy<T>(x:T):T {
		if (is_iterable_object(x)) {
			if (is_array(x)) {
				return shallowcopy_array(x as unknown as Array<any>) as unknown as T;
			} else if (typeof x === "object") {
				return shallowcopy_obj(x as unknown as Object) as T;
			}
		}

		return x;
	}

	function deepcopy<T>(x:T, options?:Object):T {
		if (!options)
			options = {};
		if (!options["history"])
			options["history"] = [];

		var result;

		if (typeof x === "string" || x === null || typeof x === "undefined") {
			return x;
		} else if (is_element(x) || x instanceof RegExp) {
			if (options["json"]) {
				return void 0;
			} else {
				return x;
			}
		} else if (typeof x === "function") {
			if (options["json"]) {
				return void 0;
			} else {
				return x;
			}
		} else if (typeof x === "object") {
			if (array_indexof(options["history"], x) >= 0)
				return;
			else
				options["history"].push(x);

			if (is_array(x)) {
				result = [];
				for (var i = 0; i < (x as unknown as Array<any>).length; i++) {
					var item = x[i];
					result.push(deepcopy(item, options));
				}
			} else {
				result = {};
				for (var key in x) {
					try {
						result[key] = deepcopy(x[key], options);
					} catch (e) {
						if (options["json"])
							result[key] = void 0;
						else
							result[key] = x[key];
					}
				}
			}

			return result;
		} else {
			return x;
		}
	}

	var serialize_event = function(event) {
		return deepcopy(event, {json: true});
	};

	var get_nonsensitive_settings = function() {
		var new_settings = JSON_parse(JSON_stringify(settings));

		for (var i = 0; i < sensitive_settings.length; i++) {
			delete new_settings[sensitive_settings[i]];
		}

		return new_settings;
	};

	// Note: None of this information is automatically sent anywhere, it's only displayed to the user when something crashes.
	var get_crashlog_info = function() {
		var ua = "";
		try {ua = window.navigator.userAgent;} catch (e) {}

		var imu_version = "(!!!UNKNOWN, PLEASE FILL IN!!!)\n";
		try {imu_version = gm_info.script.version;} catch (e) {}

		var our_settings_text = "(unable to find)";
		try {our_settings_text = JSON_stringify(get_nonsensitive_settings());} catch (e) {}

		var keys = [
			"User agent: " + ua,
			"Is userscript: " + is_userscript,
			"Is addon: " + is_extension,
			"Image Max URL version: " + imu_version,
			"Settings: " + our_settings_text
		];

		if (is_userscript) {
			try {
				keys.push("Userscript manager: " + userscript_manager);
				keys.push("Userscript manager version: " + userscript_manager_version);
			} catch (e) {}
		}

		return keys.join("\n");
	};

	function overlay_object(base, obj) {
		if (typeof base === "function" || is_array(base))
			return obj; // FIXME?

		if (typeof base === "object") {
			if (typeof obj !== "object")
				return obj;

			for (var key in obj) {
				if (key in base) {
					base[key] = overlay_object(base[key], obj[key]);
				} else {
					base[key] = obj[key];
				}
			}

			return base;
		}

		return obj;
	}

	var parse_boolean = function(bool):true|false|undefined {
		if (bool === "true" || bool === true || bool === 1)
			return true;

		if (bool === "false" || bool === false || bool === 0)
			return false;

		return;
	};

	// https://stackoverflow.com/a/25603630
	function get_language() {
		if (typeof navigator === "undefined")
			return "en";

		if (navigator.languages)
			return navigator.languages[0];

		return navigator.language || (navigator as any).userLanguage;
	}

	var supported_languages = [
		"en",
		"es",
		"fr",
		"it",
		"ko",
		"pt-BR",
		"ru",
		"zh-CN"
	];

	var browser_language = "en";
	try {
		browser_language = get_language().toLowerCase();
		if (array_indexof(supported_languages, browser_language) < 0) {
			browser_language = browser_language.replace(/-.*/, "");
			if (array_indexof(supported_languages, browser_language) < 0)
				browser_language = "en";
		}
	} catch (e) {
		console_error(e);

		// just in case
		if (array_indexof(supported_languages, browser_language) < 0)
			browser_language = "en";
	}

	// This section is automatically generated using tools/update_from_po.js.
	// To modify translations, edit the respective .po file under the po subdirectory.
	// Refer to the Translations section in CONTRIBUTING.md for more information.
	var strings = {
		"$language_native$": {
			"_info": {
				"comments": {
					"en": "Native language name (e.g. Fran\u00E7ais for French, \uD55C\uAD6D\uC5B4 for Korean)",
					"ru": "\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 \u0440\u043E\u0434\u043D\u043E\u0433\u043E \u044F\u0437\u044B\u043A\u0430 (\u043D\u0430\u043F\u0440\u0438\u043C\u0435\u0440, Fran\u00E7ais \u0434\u043B\u044F \u0444\u0440\u0430\u043D\u0446\u0443\u0437\u0441\u043A\u043E\u0433\u043E \u044F\u0437\u044B\u043A\u0430, \uD55C\uAD6D\uC5B4 \u0434\u043B\u044F \u043A\u043E\u0440\u0435\u0439\u0441\u043A\u043E\u0433\u043E)"
				}
			},
			"es": "Espa\u00F1ol",
			"fr": "Fran\u00E7ais",
			"it": "Italiano",
			"ko": "\uD55C\uAD6D\uC5B4",
			"pt-BR": "Portugu\u00EAs (Brasil)",
			"ru": "\u0420\u0443\u0441\u0441\u043A\u0438\u0439",
			"zh-CN": "\u7B80\u4F53\u4E2D\u6587"
		},
		"$description$": {
			"en": "Finds larger or original versions of images and videos for 9400+ websites, including a powerful media popup and download feature",
			"ar": "\u0627\u0644\u0628\u062D\u062B \u0639\u0646 \u0646\u0633\u062E \u0623\u0643\u0628\u0631 \u0623\u0648 \u0623\u0635\u0644\u064A\u0629 \u0645\u0646 \u0627\u0644\u0635\u0648\u0631 \u0644\u0623\u0643\u062B\u0631 \u0645\u0646 9400 \u0645\u0648\u0642\u0639 \u0648\u064A\u0628",
			"bg": "\u041D\u0430\u043C\u0438\u0440\u0430 \u0443\u0432\u0435\u043B\u0438\u0447\u0435\u043D\u0438 \u0438\u043B\u0438 \u043E\u0440\u0438\u0433\u0438\u043D\u0430\u043B\u043D\u0438 \u0432\u0435\u0440\u0441\u0438\u0438 \u043D\u0430 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F \u0437\u0430 \u043F\u043E\u0432\u0435\u0447\u0435 \u043E\u0442 9400 \u0443\u0435\u0431 \u0441\u0430\u0439\u0442\u043E\u0432\u0435",
			"cs": "Vyhled\u00E1 v\u011Bt\u0161\u00ED nebo p\u016Fvodn\u00ED verze obr\u00E1zk\u016F a vide\u00ED pro v\u00EDce ne\u017E 9400 web\u016F",
			"da": "Finder st\u00F8rre eller originale versioner af billeder og videoer til mere end 9400 websteder",
			"de": "Sucht nach gr\u00F6\u00DFeren oder originalen Versionen von Bildern und Videos f\u00FCr mehr als 9400 Websites",
			"el": "\u0392\u03C1\u03AF\u03C3\u03BA\u03B5\u03B9 \u03BC\u03B5\u03B3\u03B1\u03BB\u03CD\u03C4\u03B5\u03C1\u03B5\u03C2 \u03AE \u03C0\u03C1\u03C9\u03C4\u03CC\u03C4\u03C5\u03C0\u03B5\u03C2 \u03B5\u03BA\u03B4\u03CC\u03C3\u03B5\u03B9\u03C2 \u03B5\u03B9\u03BA\u03CC\u03BD\u03C9\u03BD \u03BA\u03B1\u03B9 \u03B2\u03AF\u03BD\u03C4\u03B5\u03BF \u03B3\u03B9\u03B1 \u03C0\u03B5\u03C1\u03B9\u03C3\u03C3\u03CC\u03C4\u03B5\u03C1\u03BF\u03C5\u03C2 \u03B1\u03C0\u03CC 9400 \u03B9\u03C3\u03C4\u03CC\u03C4\u03BF\u03C0\u03BF\u03C5\u03C2",
			"eo": "Trovas pli grandajn a\u016D originalajn versiojn de bildoj kaj filmetoj por pli ol 9400 retejoj",
			"es": "Encuentra im\u00E1genes m\u00E1s grandes y originales para m\u00E1s de 9400 sitios",
			"fi": "Etsii suurempia tai alkuper\u00E4isi\u00E4 versioita kuvista ja videoista yli 9400 verkkosivustolle",
			"fr": "Trouve des versions plus grandes ou originales d'images et de vid\u00E9os pour plus de 9 400 sites web, y compris une puissante fonction de popup m\u00E9dia",
			"fr-CA": "Trouve des versions plus grandes ou originales d'images et de vid\u00E9os pour plus de 9 400 sites web, y compris une puissante fonction de popup m\u00E9dia",
			"he": "\u05DE\u05D5\u05E6\u05D0 \u05D2\u05E8\u05E1\u05D0\u05D5\u05EA \u05D2\u05D3\u05D5\u05DC\u05D5\u05EA \u05D9\u05D5\u05EA\u05E8 \u05D0\u05D5 \u05DE\u05E7\u05D5\u05E8\u05D9\u05D5\u05EA \u05E9\u05DC \u05EA\u05DE\u05D5\u05E0\u05D5\u05EA \u05D5\u05E1\u05E8\u05D8\u05D5\u05E0\u05D9\u05DD \u05E2\u05D1\u05D5\u05E8 \u05D9\u05D5\u05EA\u05E8 \u05DE-9400 \u05D0\u05EA\u05E8\u05D9\u05DD",
			"hi": "9400 \u0938\u0947 \u0905\u0927\u093F\u0915 \u0935\u0947\u092C\u0938\u093E\u0907\u091F\u094B\u0902 \u0915\u0947 \u0932\u093F\u090F \u092B\u093C\u094B\u091F\u094B \u0914\u0930 \u0935\u0940\u0921\u093F\u092F\u094B \u0915\u0947 \u092C\u0921\u093C\u0947 \u092F\u093E \u092E\u0942\u0932 \u0938\u0902\u0938\u094D\u0915\u0930\u0923 \u0922\u0942\u0901\u0922\u0924\u093E \u0939\u0948",
			"hu": "T\u00F6bb mint 9400 webhely k\u00E9p\u00E9nek \u00E9s vide\u00F3inak nagyobb vagy eredeti v\u00E1ltozat\u00E1t tal\u00E1lja",
			"id": "Menemukan versi gambar dan video yang lebih besar atau orisinal untuk lebih dari 9400 situs web",
			"it": "Trova versioni pi\u00F9 grandi o originali di immagini e video per oltre 9400 siti web",
			"ja": "9400\u4EE5\u4E0A\u306E\u30A6\u30A7\u30D6\u30B5\u30A4\u30C8\u3067\u9AD8\u753B\u8CEA\u3084\u539F\u672C\u753B\u50CF\u3092\u898B\u3064\u3051\u51FA\u3057\u307E\u3059",
			"ko": "9400\uAC1C \uC774\uC0C1\uC758 \uC0AC\uC774\uD2B8\uC5D0 \uB300\uD574 \uACE0\uD654\uC9C8\uC774\uB098 \uC6D0\uBCF8 \uC774\uBBF8\uC9C0\uB97C \uCC3E\uC544\uB4DC\uB9BD\uB2C8\uB2E4",
			"nb": "Finner st\u00F8rre eller originale versjoner av bilder og videoer for mer enn 9400 nettsteder",
			"nl": "Vindt grotere of originele versies van foto's en video's voor meer dan 9400 websites",
			"pl": "Wyszukuje wi\u0119ksze lub oryginalne wersje obraz\u00F3w i film\u00F3w dla ponad 9400 stron internetowych",
			"pt-BR": "Encontra vers\u00F5es maiores ou originais de imagens e v\u00EDdeos para mais de 9400 sites",
			"ru": "\u041D\u0430\u0445\u043E\u0434\u0438\u0442 \u0443\u0432\u0435\u043B\u0438\u0447\u0435\u043D\u043D\u044B\u0435 \u0438\u043B\u0438 \u043E\u0440\u0438\u0433\u0438\u043D\u0430\u043B\u044C\u043D\u044B\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0439 \u0438 \u0432\u0438\u0434\u0435\u043E \u0434\u043B\u044F 9400+ \u0441\u0430\u0439\u0442\u043E\u0432. \u0418\u043C\u0435\u0435\u0442 \u043C\u043E\u0449\u043D\u0443\u044E \u0444\u0443\u043D\u043A\u0446\u0438\u044E \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430 \u0438 \u0441\u043A\u0430\u0447\u0438\u0432\u0430\u043D\u0438\u0435 \u043C\u0435\u0434\u0438\u0430\u0444\u0430\u0439\u043B\u043E\u0432.",
			"th": "\u0E2B\u0E32\u0E17\u0E35\u0E48\u0E43\u0E2B\u0E0D\u0E48\u0E01\u0E27\u0E48\u0E32\u0E2B\u0E23\u0E37\u0E2D\u0E40\u0E27\u0E2D\u0E23\u0E4C\u0E0A\u0E31\u0E48\u0E19\u0E14\u0E31\u0E49\u0E07\u0E40\u0E14\u0E34\u0E21\u0E02\u0E2D\u0E07\u0E20\u0E32\u0E1E\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14\u0E41\u0E25\u0E30\u0E27\u0E35\u0E14\u0E35\u0E42\u0E2D\u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32 9400 \u0E07\u0E40\u0E27\u0E47\u0E1A\u0E44\u0E0B\u0E15\u0E4C",
			"tr": "9400'den fazla web sitesi i\u00E7in resim ve videolar\u0131n daha b\u00FCy\u00FCk veya orijinal s\u00FCr\u00FCmlerini bulur",
			"uk": "\u0417\u043D\u0430\u0445\u043E\u0434\u0438\u0442\u044C \u0437\u0431\u0456\u043B\u044C\u0448\u0435\u043D\u0456 \u0430\u0431\u043E \u043E\u0440\u0438\u0433\u0456\u043D\u0430\u043B\u044C\u043D\u0456 \u0432\u0435\u0440\u0441\u0456\u0457 \u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u044C \u0434\u043B\u044F \u0431\u0456\u043B\u044C\u0448 \u043D\u0456\u0436 9400 \u0432\u0435\u0431-\u0441\u0430\u0439\u0442\u0456\u0432",
			"vi": "T\u00ECm phi\u00EAn b\u1EA3n l\u1EDBn h\u01A1n ho\u1EB7c phi\u00EAn b\u1EA3n g\u1ED1c c\u1EE7a h\u00ECnh \u1EA3nh v\u00E0 video cho h\u01A1n 9400 trang web",
			"zh-CN": "\u5728\u8FD1\u4E07\u4E2A\u7F51\u7AD9\u4E0A\u67E5\u627E\u5C3A\u5BF8\u66F4\u5927\u6216\u539F\u7248\u7684\u56FE\u50CF/\u89C6\u9891\uFF0C\u63D0\u4F9B\u5A92\u4F53\u6587\u4EF6\u5C0F\u5F39\u7A97\u548C\u4E0B\u8F7D\u529F\u80FD",
			"zh-HK": "\u70BA9400\u591A\u500B\u7DB2\u7AD9\u67E5\u627E\u66F4\u5927\u6216\u539F\u59CB\u5716\u50CF",
			"zh-TW": "\u70BA9400\u591A\u500B\u7DB2\u7AD9\u67E5\u627E\u66F4\u5927\u6216\u539F\u59CB\u5716\u50CF"
		},
		"options_header": {
			"en": "Options",
			"es": "Opciones",
			"it": "Opzioni",
			"ko": "\uC635\uC158",
			"pt-BR": "op\u00E7\u00F5es",
			"ru": "\u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B",
			"zh-CN": "\u9009\u9879"
		},
		"yes": {
			"en": "Yes",
			"es": "S\u00ED",
			"fr": "Oui",
			"it": "S\u00EC",
			"ko": "\uC608",
			"pt-BR": "sim",
			"ru": "\u0414\u0430",
			"zh-CN": "\u662F"
		},
		"no": {
			"en": "No",
			"es": "No",
			"fr": "Non",
			"it": "No",
			"ko": "\uC544\uB2C8\uC624",
			"pt-BR": "n\u00E3o",
			"ru": "\u041D\u0435\u0442",
			"zh-CN": "\u5426"
		},
		"Import": {
			"it": "Importa",
			"ko": "\uAC00\uC838\uC624\uAE30",
			"pt-BR": "Importar",
			"ru": "\u0418\u043C\u043F\u043E\u0440\u0442",
			"zh-CN": "\u5BFC\u5165"
		},
		"Export": {
			"it": "Esporta",
			"ko": "\uB0B4\uBCF4\uB0B4\uAE30",
			"pt-BR": "Exportar",
			"ru": "\u042D\u043A\u0441\u043F\u043E\u0440\u0442",
			"zh-CN": "\u5BFC\u51FA"
		},
		"Requires:": {
			"it": "Richiede",
			"ko": "\uC694\uAD6C\uC0AC\uD56D:",
			"pt-BR": "Requer:",
			"ru": "\u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044F:",
			"zh-CN": "\u9700\u8981:"
		},
		"Or:": {
			"pt-BR": "Ou:",
			"ru": "\u0418\u043B\u0438:",
			"zh-CN": "\u6216\u8005:"
		},
		"Redirection": {
			"es": "Redirecci\u00F3n",
			"ko": "\uB9AC\uB514\uB809\uC158",
			"pt-BR": "Redirecionamento",
			"ru": "\u041F\u0435\u0440\u0435\u043D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435",
			"zh-CN": "\u91CD\u5B9A\u5411"
		},
		"subcategory_update": {
			"en": "Updates",
			"pt-BR": "atualiza\u00E7\u00E3o",
			"ru": "\u041E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0435",
			"zh-CN": "\u66F4\u65B0"
		},
		"subcategory_libraries": {
			"en": "3rd-party libraries",
			"pt-BR": "bibliotecas",
			"ru": "\u0421\u0442\u043E\u0440\u043E\u043D\u043D\u0438\u0435 \u0431\u0438\u0431\u043B\u0438\u043E\u0442\u0435\u043A\u0438",
			"zh-CN": "\u7B2C\u4E09\u65B9\u5E93"
		},
		"subcategory_settings": {
			"en": "Settings",
			"es": "Ajustes",
			"pt-BR": "configura\u00E7\u00F5es",
			"ru": "\u041D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438",
			"zh-CN": "\u8BBE\u7F6E"
		},
		"subcategory_ui": {
			"en": "UI",
			"es": "Interfaz",
			"pt-BR": "interface do usu\u00E1rio",
			"ru": "\u0418\u043D\u0442\u0435\u0440\u0444\u0435\u0439\u0441",
			"zh-CN": "\u754C\u9762"
		},
		"subcategory_trigger": {
			"en": "Trigger",
			"es": "Acciones del popup",
			"fr": "D\u00E9clencheur",
			"ko": "\uD2B8\uB9AC\uAC70",
			"pt-BR": "gatilho",
			"ru": "\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u044F \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430",
			"zh-CN": "\u89E6\u53D1\u5668"
		},
		"subcategory_popup_source": {
			"en": "Source",
			"pt-BR": "popup de origem",
			"ru": "\u0418\u0441\u0442\u043E\u0447\u043D\u0438\u043A \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430",
			"zh-CN": "\u5F39\u7A97\u6E90\u5934"
		},
		"subcategory_open_behavior": {
			"en": "Open Behavior",
			"es": "Comportamiento al Abrir",
			"ko": "\uC5F4\uAE30 \uB3D9\uC791",
			"pt-BR": "comportamento de abertura",
			"ru": "\u041F\u043E\u0432\u0435\u0434\u0435\u043D\u0438\u0435 \u043F\u0440\u0438 \u043E\u0442\u043A\u0440\u044B\u0442\u0438\u0438",
			"zh-CN": "\u6253\u5F00\u65B9\u5F0F"
		},
		"subcategory_close_behavior": {
			"en": "Close Behavior",
			"es": "Comportamiento al Cerrar",
			"ko": "\uB2EB\uAE30 \uB3D9\uC791",
			"pt-BR": "comportamento de fechamento",
			"ru": "\u041F\u043E\u0432\u0435\u0434\u0435\u043D\u0438\u0435 \u043F\u0440\u0438 \u0437\u0430\u043A\u0440\u044B\u0442\u0438\u0438",
			"zh-CN": "\u5173\u95ED\u65B9\u5F0F"
		},
		"subcategory_behavior": {
			"en": "Popup Behavior",
			"es": "Comportamiento del Popup",
			"pt-BR": "comportamento",
			"ru": "\u041F\u043E\u0432\u0435\u0434\u0435\u043D\u0438\u0435 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430",
			"zh-CN": "\u884C\u4E3A"
		},
		"subcategory_video": {
			"en": "Video/Audio",
			"ko": "\uC601\uC0C1/\uC624\uB514\uC624",
			"pt-BR": "v\u00EDdeo",
			"ru": "\u0412\u0438\u0434\u0435\u043E/\u0410\u0443\u0434\u0438\u043E",
			"zh-CN": "\u89C6\u9891/\u97F3\u9891"
		},
		"subcategory_gallery": {
			"en": "Gallery",
			"es": "Galeria",
			"pt-BR": "galeria",
			"ru": "\u0413\u0430\u043B\u0435\u0440\u0435\u044F",
			"zh-CN": "\u56FE\u5E93"
		},
		"subcategory_popup_other": {
			"en": "Other",
			"es": "Otro",
			"fr": "Autre",
			"pt-BR": "outros popups",
			"ru": "\u041F\u0440\u043E\u0447\u0435\u0435",
			"zh-CN": "\u5176\u4ED6"
		},
		"subcategory_cache": {
			"en": "Cache",
			"pt-BR": "cache",
			"ru": "\u041A\u044D\u0448",
			"zh-CN": "\u7F13\u5B58"
		},
		"Shortcuts": {
			"pt-BR": "Atalhos",
			"ru": "\u0413\u043E\u0440\u044F\u0447\u0438\u0435 \u043A\u043B\u0430\u0432\u0438\u0448\u0438",
			"zh-CN": "\u5FEB\u6377\u952E"
		},
		"subcategory_keybinds_popup_actions": {
			"en": "Popup actions",
			"pt-BR": "a\u00E7\u00F5es do pop-up de atalhos",
			"ru": "\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u044F \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430",
			"zh-CN": "\u64CD\u4F5C\u5F39\u7A97"
		},
		"Mouse cursor": {
			"it": "Sposta cursore",
			"ko": "\uB9C8\uC6B0\uC2A4 \uCEE4\uC11C",
			"pt-BR": "Cursor do mouse",
			"ru": "\u041A\u0443\u0440\u0441\u043E\u0440 \u043C\u044B\u0448\u0438",
			"zh-CN": "\u9F20\u6807\u5149\u6807"
		},
		"Rules": {
			"fr": "R\u00E8gles",
			"ko": "\uADDC\uCE59",
			"pt-BR": "Regras",
			"ru": "\u041F\u0440\u0430\u0432\u0438\u043B\u0430",
			"zh-CN": "\u89C4\u5219"
		},
		"subcategory_rule_specific": {
			"en": "Rule-specific",
			"pt-BR": "espec\u00EDfico da regra",
			"ru": "\u0421\u043F\u0435\u0446\u0438\u0444\u0438\u043A\u0430 \u043F\u0440\u0430\u0432\u0438\u043B",
			"zh-CN": "\u4E13\u7528\u89C4\u5219"
		},
		"Website": {
			"fr": "Site",
			"ko": "\uC6F9\uC0AC\uC774\uD2B8",
			"pt-BR": "Site",
			"ru": "\u0421\u0430\u0439\u0442",
			"zh-CN": "\u7F51\u7AD9"
		},
		"Saved! Refresh the target page for changes to take effect": {
			"fr": "Enregistr\u00E9! Actualiser la page que vous visitez pour que les changements prennent effet",
			"ko": "\uC800\uC7A5\uB429\uB2C8\uB2E4. \uBC88\uACBD\uC0AC\uD56D \uC801\uC6A9\uD558\uB824\uBA74 \uB300\uC0C1 \uC6F9\uD398\uC774\uC9C0 \uB2E4\uC2DC \uB85C\uB4DC\uD558\uC2ED\uC2DC\uC624",
			"pt-BR": "Salvo! Atualize a p\u00E1gina de destino para que as altera\u00E7\u00F5es tenham efeito",
			"ru": "\u0421\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u043E! \u041E\u0431\u043D\u043E\u0432\u0438\u0442\u0435 \u0446\u0435\u043B\u0435\u0432\u0443\u044E \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0443, \u0447\u0442\u043E\u0431\u044B \u043F\u0440\u0438\u043C\u0435\u043D\u0438\u0442\u044C \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u044F.",
			"zh-CN": "\u5DF2\u4FDD\u5B58\uFF0C\u5237\u65B0\u76EE\u6807\u9875\u9762\u4F7F\u66F4\u6539\u751F\u6548"
		},
		"Saved!": {
			"fr": "Enregistr\u00E9!",
			"ko": "\uC800\uC7A5\uB429\uB2C8\uB2E4",
			"pt-BR": "Salvo!",
			"ru": "\u0421\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u043E!",
			"zh-CN": "\u5DF2\u4FDD\u5B58"
		},
		"save": {
			"en": "Save",
			"fr": "Enregistrer",
			"ko": "\uC800\uC7A5",
			"pt-BR": "salvar",
			"ru": "\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C",
			"zh-CN": "\u4FDD\u5B58"
		},
		"Record": {
			"_info": {
				"comments": {
					"en": "Button name for recording key combinations"
				}
			},
			"pt-BR": "Gravar",
			"ru": "\u041F\u0435\u0440\u0435\u043D\u0430\u0437\u043D\u0430\u0447\u0438\u0442\u044C",
			"zh-CN": "\u5F55\u5236"
		},
		"Cancel": {
			"fr": "Annuler",
			"ko": "\uCDE8\uC18C",
			"pt-BR": "Cancelar",
			"ru": "\u041E\u0442\u043C\u0435\u043D\u0430",
			"zh-CN": "\u53D6\u6D88"
		},
		"Mouseover popup (%%1) is needed to display the original version": {
			"fr": "Popup (%%1) est n\u00E9cessaire pour trouver la version originale",
			"it": "Il popup del mouse (%%1) serve a mostrare la versione originale",
			"ko": "\uC6D0\uBCF8 \uC774\uBBF8\uC9C0 \uBCF4\uB824\uBA74 \uD31D\uC5C5 (%%1) \uD544\uC694\uD569\uB2C8\uB2E4",
			"pt-BR": "O popup ao passar o mouse (%%1) \u00E9 necess\u00E1rio para exibir a vers\u00E3o original",
			"ru": "\u0412\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u043F\u0440\u0438 \u043D\u0430\u0432\u0435\u0434\u0435\u043D\u0438\u0438 \u043C\u044B\u0448\u0438 (%%1) \u043D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u043E \u0434\u043B\u044F \u043E\u0442\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F \u043E\u0440\u0438\u0433\u0438\u043D\u0430\u043B\u044C\u043D\u043E\u0439 \u0432\u0435\u0440\u0441\u0438\u0438",
			"zh-CN": "\u9700\u8981\u9F20\u6807\u60AC\u505C\u5F39\u7A97\uFF08%%1\uFF09\u6765\u663E\u793A\u539F\u59CB\u7248\u672C"
		},
		"custom headers": {
			"fr": "en-t\u00EAtes sp\u00E9ciales",
			"ko": "\uD2B9\uC815 \uD5E4\uB354",
			"pt-BR": "cabe\u00E7alhos personalizados",
			"ru": "\u041F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u0438\u0435 \u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043A\u0438",
			"zh-CN": "\u81EA\u5B9A\u4E49\u6807\u9898"
		},
		"forces download": {
			"en": "forces download",
			"pt-BR": "for\u00E7ar download",
			"ru": "\u0421\u043A\u0430\u0447\u0430\u0442\u044C \u043F\u0440\u0438\u043D\u0443\u0434\u0438\u0442\u0435\u043B\u044C\u043D\u043E",
			"zh-CN": "\u5F3A\u5236\u4E0B\u8F7D"
		},
		"Close": {
			"fr": "Fermer",
			"it": "Chiudi",
			"ko": "\uB2EB\uAE30",
			"pt-BR": "Fechar",
			"ru": "\u0417\u0430\u043A\u0440\u044B\u0442\u044C",
			"zh-CN": "\u5173\u95ED"
		},
		"Previous": {
			"fr": "Image pr\u00E9c\u00E9dente",
			"it": "Precedente",
			"ko": "\uC774\uC804",
			"pt-BR": "Anterior",
			"ru": "\u041F\u0440\u0435\u0434\u044B\u0434\u0443\u0449\u0435\u0435",
			"zh-CN": "\u4E0A\u4E00\u4E2A"
		},
		"Next": {
			"fr": "Image suivante",
			"it": "Prossimo",
			"ko": "\uB2E4\uC74C",
			"pt-BR": "Pr\u00F3ximo",
			"ru": "\u0421\u043B\u0435\u0434\u0443\u0435\u0449\u0435\u0435",
			"zh-CN": "\u4E0B\u4E00\u4E2A"
		},
		"Left Arrow": {
			"fr": "Fl\u00E8che gauche",
			"it": "Freccia sinistra",
			"ko": "\uC67C\uCABD \uD654\uC0B4\uD45C",
			"pt-BR": "Seta para Esquerda",
			"ru": "\u0421\u0442\u0440\u0435\u043B\u043A\u0430 \u0432\u043B\u0435\u0432\u043E",
			"zh-CN": "\u5DE6\u7BAD\u5934"
		},
		"Right Arrow": {
			"fr": "Fl\u00E8che droite",
			"it": "Freccia destra",
			"ko": "\uC624\uB978\uCABD \uD654\uC0B4\uD45C",
			"pt-BR": "Seta para Direita",
			"ru": "\u0421\u0442\u0440\u0435\u043B\u043A\u0430 \u0432\u043F\u0440\u0430\u0432\u043E",
			"zh-CN": "\u53F3\u7BAD\u5934"
		},
		"subcategory_extension": {
			"en": "Extension",
			"pt-BR": "extens\u00E3o",
			"ru": "\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u0438\u0435",
			"zh-CN": "\u6269\u5C55"
		},
		"Rotate Left": {
			"pt-BR": "Girar para Esquerda",
			"ru": "\u041F\u043E\u0432\u0435\u0440\u043D\u0443\u0442\u044C \u0432\u043B\u0435\u0432\u043E",
			"zh-CN": "\u5411\u5DE6\u65CB\u8F6C"
		},
		"Rotate Right": {
			"pt-BR": "Girar para Direita",
			"ru": "\u041F\u043E\u0432\u0435\u0440\u043D\u0443\u0442\u044C \u0432\u043F\u0440\u0430\u0432\u043E",
			"zh-CN": "\u5411\u53F3\u65CB\u8F6C"
		},
		"Buttons": {
			"_info": {
				"comments": {
					"en": "Settings category name for configuring extra functions, such as \"Replace Images\" and \"Highlight Images\""
				}
			},
			"pt-BR": "Bot\u00F5es",
			"ru": "\u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u043E",
			"zh-CN": "\u5176\u4ED6"
		},
		"subcategory_replaceimages": {
			"en": "Replace Images",
			"pt-BR": "substituir imagens",
			"ru": "\u0417\u0430\u043C\u0435\u043D\u0430 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0439",
			"zh-CN": "\u66FF\u6362\u56FE\u50CF"
		},
		"subcategory_highlightimages": {
			"en": "Highlight Images",
			"pt-BR": "real\u00E7ar imagens",
			"ru": "\u0412\u044B\u0434\u0435\u043B\u0435\u043D\u0438\u0435 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0439",
			"zh-CN": "\u9AD8\u4EAE\u56FE\u50CF"
		},
		"subcategory_customgallery": {
			"en": "Custom Gallery",
			"pt-BR": "galeria personalizada"
		},
		"General": {
			"es": "General",
			"ko": "\uC77C\uBC18",
			"pt-BR": "Geral",
			"ru": "\u041E\u0431\u0449\u0438\u0435",
			"zh-CN": "\u901A\u7528"
		},
		"Enable extension": {
			"_info": {
				"instances": [
					{
						"setting": "imu_enabled",
						"field": "name"
					}
				]
			},
			"it": "Abilita estensione",
			"pt-BR": "Ativar extens\u00E3o",
			"ru": "\u0412\u043A\u043B\u044E\u0447\u0438\u0442\u044C \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u0438\u0435",
			"zh-CN": "\u542F\u7528\u6269\u5C55"
		},
		"Globally enables or disables the extension": {
			"_info": {
				"instances": [
					{
						"setting": "imu_enabled",
						"field": "description"
					}
				]
			},
			"it": "Abilita o disabilita globalmente l'estensione",
			"pt-BR": "Ativa ou desativa a extens\u00E3o globalmente",
			"ru": "\u041F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0430\u0435\u0442 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u0438\u0435 \u0433\u043B\u043E\u0431\u0430\u043B\u044C\u043D\u043E",
			"zh-CN": "\u5168\u5C40\u542F\u7528\u6216\u7981\u7528\u6269\u5C55"
		},
		"Language": {
			"_info": {
				"instances": [
					{
						"setting": "language",
						"field": "name"
					}
				]
			},
			"es": "Lenguaje",
			"it": "Lingua",
			"ko": "\uC5B8\uC5B4",
			"pt-BR": "Idioma",
			"ru": "\u042F\u0437\u044B\u043A",
			"zh-CN": "\u8BED\u8A00"
		},
		"Language for this extension": {
			"_info": {
				"instances": [
					{
						"setting": "language",
						"field": "description"
					}
				]
			},
			"it": "Lingua per questa estensione",
			"pt-BR": "Idioma para esta extens\u00E3o",
			"ru": "\u042F\u0437\u044B\u043A \u044D\u0442\u043E\u0433\u043E \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u0438\u044F",
			"zh-CN": "\u6B64\u6269\u5C55\u7A0B\u5E8F\u7684\u8BED\u8A00"
		},
		"English": {
			"_info": {
				"instances": [
					{
						"setting": "language",
						"field": "options.en.name"
					}
				]
			},
			"pt-BR": "Ingl\u00EAs",
			"ru": "\u0410\u043D\u0433\u043B\u0438\u0439\u0441\u043A\u0438\u0439",
			"zh-CN": "\u82F1\u8BED"
		},
		"Espa\u00F1ol": {
			"_info": {
				"instances": [
					{
						"setting": "language",
						"field": "options.es.name"
					}
				]
			},
			"pt-BR": "Espanhol",
			"ru": "\u0418\u0441\u043F\u0430\u043D\u0441\u043A\u0438\u0439",
			"zh-CN": "\u897F\u73ED\u7259\u8BED"
		},
		"Fran\u00E7ais": {
			"_info": {
				"instances": [
					{
						"setting": "language",
						"field": "options.fr.name"
					}
				]
			},
			"pt-BR": "Franc\u00EAs",
			"ru": "\u0424\u0440\u0430\u043D\u0446\u0443\u0437\u043A\u0438\u0439",
			"zh-CN": "\u6CD5\u8BED"
		},
		"Italiano": {
			"_info": {
				"instances": [
					{
						"setting": "language",
						"field": "options.it.name"
					}
				]
			},
			"pt-BR": "Italiano",
			"ru": "\u0418\u0442\u0430\u043B\u044C\u044F\u043D\u0441\u043A\u0438\u0439",
			"zh-CN": "\u610F\u5927\u5229\u8BED"
		},
		"\uD55C\uAD6D\uC5B4": {
			"_info": {
				"instances": [
					{
						"setting": "language",
						"field": "options.ko.name"
					}
				]
			},
			"pt-BR": "Coreano",
			"ru": "\u041A\u043E\u0440\u0435\u0439\u0441\u043A\u0438\u0439",
			"zh-CN": "\u97E9\u8BED"
		},
		"Portugu\u00EAs (Brasil)": {
			"_info": {
				"instances": [
					{
						"setting": "language",
						"field": "options.pt-BR.name"
					}
				]
			}
		},
		"\u0420\u0443\u0441\u0441\u043A\u0438\u0439": {
			"_info": {
				"instances": [
					{
						"setting": "language",
						"field": "options.ru.name"
					}
				]
			},
			"pt-BR": "Russo",
			"ru": "\u0420\u0443\u0441\u0441\u043A\u0438\u0439",
			"zh-CN": "\u4FC4\u8BED"
		},
		"\u7B80\u4F53\u4E2D\u6587": {
			"_info": {
				"instances": [
					{
						"setting": "language",
						"field": "options.zh-CN.name"
					}
				]
			},
			"pt-BR": "Chin\u00EAs simplificado"
		},
		"Dark mode": {
			"_info": {
				"instances": [
					{
						"setting": "dark_mode",
						"field": "name"
					}
				]
			},
			"it": "Modalit\u00E0 scura",
			"ko": "\uB2E4\uD06C \uBAA8\uB4DC",
			"pt-BR": "Modo escuro",
			"ru": "\u0422\u0451\u043C\u043D\u044B\u0439 \u0440\u0435\u0436\u0438\u043C",
			"zh-CN": "\u6DF1\u8272\u6A21\u5F0F"
		},
		"Changes the colors to have light text on a dark background": {
			"_info": {
				"instances": [
					{
						"setting": "dark_mode",
						"field": "description"
					}
				]
			},
			"it": "Cambia i colori per avere testo chiaro su sfondo scuro",
			"ko": "\uC5B4\uB450\uC6B4 \uBC30\uACBD, \uBC1D\uC740 \uD14D\uC2A4\uD2B8\uAC00 \uD45C\uC2DC\uB418\uB3C4\uB85D \uBCC0\uACBD\uD569\uB2C8\uB2E4.",
			"pt-BR": "Altera as cores para ter texto claro em um fundo escuro",
			"ru": "\u0418\u0437\u043C\u0435\u043D\u044F\u0435\u0442 \u0446\u0432\u0435\u0442\u0430, \u0434\u0435\u043B\u0430\u044F \u0442\u0435\u043A\u0441\u0442 \u043D\u0430 \u0442\u0451\u043C\u043D\u043E\u043C \u0444\u043E\u043D\u0435, \u0441\u0432\u0435\u0442\u043B\u044B\u043C.",
			"zh-CN": "\u5C06\u989C\u8272\u66F4\u6539\u4E3A\u5728\u6DF1\u8272\u80CC\u666F\u4E0A\u663E\u793A\u6D45\u8272\u6587\u672C"
		},
		"Description below options": {
			"_info": {
				"instances": [
					{
						"setting": "settings_visible_description",
						"field": "name"
					}
				]
			},
			"it": "Descrizione sotto le opzioni",
			"ko": "\uC635\uC158 \uC544\uB798\uC5D0 \uC124\uBA85 \uD45C\uC2DC",
			"pt-BR": "Descri\u00E7\u00E3o abaixo das op\u00E7\u00F5es",
			"ru": "\u041E\u043F\u0438\u0441\u0430\u043D\u0438\u0435 \u043F\u043E\u0434 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u0430\u043C\u0438",
			"zh-CN": "\u9009\u9879\u4E0B\u65B9\u663E\u793A\u63CF\u8FF0"
		},
		"Shows the description below the options (otherwise the description is only shown when you hover over the option's name)": {
			"_info": {
				"instances": [
					{
						"setting": "settings_visible_description",
						"field": "description"
					}
				]
			},
			"it": "Mostra la descrizione sotto le opzioni (alternativamente, la descrizione viene mostrata solo quando il mouse si trova sopra il nome dell'opzione)",
			"ko": "\uC635\uC158 \uC544\uB798\uC5D0 \uC124\uBA85 \uD45C\uC2DC (\uBE44\uD65C\uC131\uD654 \uC2DC, \uC635\uC158 \uC774\uB984 \uC704\uC5D0 \uB9C8\uC6B0\uC2A4\uB97C \uC62C\uB824 \uB193\uC744 \uB54C\uB9CC \uC124\uBA85\uC774 \uD45C\uC2DC\uB428)",
			"pt-BR": "Mostra a descri\u00E7\u00E3o abaixo das op\u00E7\u00F5es (caso contr\u00E1rio, a descri\u00E7\u00E3o s\u00F3 \u00E9 exibida ao passar o mouse sobre o nome da op\u00E7\u00E3o)",
			"ru": "\u041F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0435\u0442 \u043E\u043F\u0438\u0441\u0430\u043D\u0438\u0435 \u043F\u043E\u0434 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u0430\u043C\u0438 (\u0432 \u043F\u0440\u043E\u0442\u0438\u0432\u043D\u043E\u043C \u0441\u043B\u0443\u0447\u0430\u0435 \u043E\u043F\u0438\u0441\u0430\u043D\u0438\u0435 \u043E\u0442\u043E\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044F \u0442\u043E\u043B\u044C\u043A\u043E \u043F\u0440\u0438 \u043D\u0430\u0432\u0435\u0434\u0435\u043D\u0438\u0438 \u043A\u0443\u0440\u0441\u043E\u0440\u0430 \u043C\u044B\u0448\u0438 \u043D\u0430 \u0438\u043C\u044F \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u0430)",
			"zh-CN": "\u9009\u9879\u4E0B\u65B9\u663E\u793A\u63CF\u8FF0\uFF08\u7981\u7528\u5219\u4EC5\u5F53\u9F20\u6807\u60AC\u505C\u5728\u9009\u9879\u7684\u540D\u79F0\u4E0A\u65F6\u663E\u793A\u8BF4\u660E\uFF09"
		},
		"Show disabled options": {
			"_info": {
				"instances": [
					{
						"setting": "settings_show_disabled",
						"field": "name"
					}
				]
			},
			"it": "Mostra opzioni inattive",
			"ko": "\uBE44\uD65C\uC131\uD654\uB41C \uC124\uC815 \uD45C\uC2DC",
			"pt-BR": "Exibir op\u00E7\u00F5es desativadas",
			"ru": "\u041F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0442\u044C \u043E\u0442\u043A\u043B\u044E\u0447\u0435\u043D\u043D\u044B\u0435 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B",
			"zh-CN": "\u663E\u793A\u505C\u7528\u7684\u9009\u9879"
		},
		"If disabled, options that are disabled due to their requirements being unmet will not be displayed": {
			"_info": {
				"instances": [
					{
						"setting": "settings_show_disabled",
						"field": "description"
					}
				]
			},
			"it": "Se inattivo, le opzioni che sono inattive a causa dei loro requisiti necessari non raggiunti non verranno mostrate",
			"pt-BR": "Se desativado, as op\u00E7\u00F5es desativadas devido a seus requisitos n\u00E3o serem atendidos n\u00E3o ser\u00E3o exibidas",
			"ru": "\u0415\u0441\u043B\u0438 \u043E\u0442\u043A\u043B\u044E\u0447\u0435\u043D\u043E, \u0442\u043E \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B \u043A\u043E\u0442\u043E\u0440\u044B\u0435 \u043E\u0442\u043A\u043B\u044E\u0447\u0435\u043D\u044B \u0438\u0437-\u0437\u0430 \u043D\u0435\u0432\u044B\u043F\u043E\u043B\u043D\u0435\u043D\u0438\u044F \u0442\u0440\u0435\u0431\u043E\u0432\u0430\u043D\u0438\u0439 \u0431\u0443\u0434\u0443\u0442 \u0441\u043A\u0440\u044B\u0442\u044B",
			"zh-CN": "\u7981\u7528\u540E\u5C06\u4E0D\u663E\u793A\u56E0\u672A\u6EE1\u8DB3\u8981\u6C42\u800C\u88AB\u505C\u7528\u7684\u9009\u9879"
		},
		"Show disabled trigger profiles": {
			"_info": {
				"instances": [
					{
						"setting": "settings_show_disabled_profiles",
						"field": "name"
					}
				]
			},
			"pt-BR": "Exibir perfis de gatilho desativados",
			"ru": "\u041F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0442\u044C \u043E\u0442\u043A\u043B\u044E\u0447\u0435\u043D\u043D\u044B\u0435 \u0446\u0435\u043B\u0435\u0432\u044B\u0435 \u043F\u0440\u043E\u0444\u0438\u043B\u0438",
			"zh-CN": "\u663E\u793A\u505C\u7528\u7684\u89E6\u53D1\u5668\u914D\u7F6E"
		},
		"If disabled, options for alternate trigger profiles (options with `(#2)` after them) will not be shown if the relevant trigger isn't active": {
			"_info": {
				"instances": [
					{
						"setting": "settings_show_disabled_profiles",
						"field": "description"
					}
				]
			},
			"pt-BR": "Se desativado, as op\u00E7\u00F5es para perfis de gatilho alternativos (op\u00E7\u00F5es com `(#2)` ap\u00F3s elas) n\u00E3o ser\u00E3o exibidas se o gatilho relevante n\u00E3o estiver ativo",
			"ru": "\u0415\u0441\u043B\u0438 \u043E\u0442\u043A\u043B\u044E\u0447\u0435\u043D\u043E, \u0442\u043E \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B \u0430\u043B\u044C\u0442\u0435\u0440\u043D\u0430\u0442\u0438\u0432\u043D\u044B\u0445 \u0446\u0435\u043B\u0435\u0432\u044B\u0445 \u043F\u0440\u043E\u0444\u0438\u043B\u0435\u0439 (\u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B \u0441 `(#2)` \u043F\u043E\u0441\u043B\u0435 \u043D\u0438\u0445) \u0431\u0443\u0434\u0443\u0442 \u0441\u043A\u0440\u044B\u0442\u044B, \u0435\u0441\u043B\u0438 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044E\u0449\u0430\u044F \u0446\u0435\u043B\u044C \u043D\u0435 \u0430\u043A\u0442\u0438\u0432\u043D\u0430",
			"zh-CN": "\u5982\u679C\u7981\u7528\uFF0C\u5C06\u4E0D\u663E\u793A\u76F8\u5173\u89E6\u53D1\u5668\u672A\u88AB\u6FC0\u6D3B\u7684\u5907\u7528\u89E6\u53D1\u5668\u7684\u914D\u7F6E\u9009\u9879\uFF08\u5E26\u6709 `(#2)` )"
		},
		"Requirements below disabled options": {
			"_info": {
				"instances": [
					{
						"setting": "settings_show_requirements",
						"field": "name"
					}
				]
			},
			"ko": "\uBE44\uD65C\uC131\uD654\uB41C \uC635\uC158 \uC544\uB798\uC758 \uC694\uAD6C \uC0AC\uD56D",
			"pt-BR": "Requisitos abaixo das op\u00E7\u00F5es desativadas",
			"ru": "\u0422\u0440\u0435\u0431\u043E\u0432\u0430\u043D\u0438\u044F \u043F\u043E\u0434 \u043E\u0442\u043A\u043B\u044E\u0447\u0435\u043D\u043D\u044B\u043C\u0438 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u0430\u043C\u0438",
			"zh-CN": "\u505C\u7528\u9009\u9879\u4E0B\u65B9\u663E\u793A\u9700\u6C42"
		},
		"If an option is disabled, the requirements to enable the option will be displayed below it": {
			"_info": {
				"instances": [
					{
						"setting": "settings_show_requirements",
						"field": "description"
					}
				]
			},
			"ko": "\uC635\uC158\uC774 \uBE44\uD65C\uC131\uD654\uB418\uBA74 \uC635\uC158\uC744 \uD65C\uC131\uD654\uD558\uAE30 \uC704\uD55C \uC694\uAD6C \uC0AC\uD56D\uC774 \uC544\uB798\uC5D0 \uD45C\uC2DC\uB428",
			"pt-BR": "Se uma op\u00E7\u00E3o estiver desativada, os requisitos para ativ\u00E1-la ser\u00E3o exibidos abaixo dela",
			"ru": "\u0415\u0441\u043B\u0438 \u043E\u0442\u043A\u043B\u044E\u0447\u0435\u043D\u043E, \u0442\u043E \u043F\u043E\u0434 \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u043D\u044B\u043C\u0438 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u0430\u043C\u0438 \u0431\u0443\u0434\u0443\u0442 \u043E\u0442\u043E\u0431\u0440\u0430\u0436\u0430\u0442\u044C\u0441\u044F \u0442\u0440\u0435\u0431\u043E\u0432\u0430\u043D\u0438\u044F \u0434\u043B\u044F \u0438\u0445 \u0432\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u044F",
			"zh-CN": "\u5728\u5DF2\u505C\u7528\u9009\u9879\u7684\u4E0B\u65B9\u663E\u793A\u542F\u7528\u8981\u6C42"
		},
		"Check for updates": {
			"_info": {
				"instances": [
					{
						"setting": "check_updates",
						"field": "name"
					}
				]
			},
			"ko": "\uC5C5\uB370\uC774\uD2B8 \uD655\uC778",
			"pt-BR": "Verificar atualiza\u00E7\u00F5es",
			"ru": "\u041F\u0440\u043E\u0432\u0435\u0440\u044F\u0442\u044C \u043D\u0430\u043B\u0438\u0447\u0438\u0435 \u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0439",
			"zh-CN": "\u68C0\u67E5\u66F4\u65B0"
		},
		"Periodically checks for updates. If a new update is available, it will be shown at the top of the options page": {
			"_info": {
				"instances": [
					{
						"setting": "check_updates",
						"field": "description"
					}
				]
			},
			"pt-BR": "Verifica periodicamente se h\u00E1 atualiza\u00E7\u00F5es. Se uma nova atualiza\u00E7\u00E3o estiver dispon\u00EDvel, ela ser\u00E1 exibida na parte superior da p\u00E1gina de op\u00E7\u00F5es",
			"ru": "\u041F\u0435\u0440\u0438\u043E\u0434\u0438\u0447\u0435\u0441\u043A\u0438 \u043F\u0440\u043E\u0432\u0435\u0440\u044F\u0435\u0442 \u043D\u0430\u043B\u0438\u0447\u0438\u0435 \u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0439. \u041D\u043E\u0432\u043E\u0435 \u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u043F\u043E\u043A\u0430\u0437\u0430\u043D\u043E \u0432 \u0432\u0435\u0440\u0445\u043D\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u044B \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u043E\u0432.",
			"zh-CN": "\u5B9A\u671F\u68C0\u67E5\u66F4\u65B0\u3002\u6709\u53EF\u7528\u7684\u66F4\u65B0\u65F6\u5C06\u5728\u9009\u9879\u9875\u9762\u7684\u9876\u90E8\u663E\u793A"
		},
		"Update check interval": {
			"_info": {
				"instances": [
					{
						"setting": "check_update_interval",
						"field": "name"
					}
				]
			},
			"ko": "\uC5C5\uB370\uC774\uD2B8 \uD655\uC778 \uAC04\uACA9",
			"pt-BR": "Intervalo de verifica\u00E7\u00E3o de atualiza\u00E7\u00F5es",
			"ru": "\u0418\u043D\u0442\u0435\u0440\u0432\u0430\u043B \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0438 \u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u044F",
			"zh-CN": "\u66F4\u65B0\u68C0\u67E5\u95F4\u9694"
		},
		"How often to check for updates": {
			"_info": {
				"instances": [
					{
						"setting": "check_update_interval",
						"field": "description"
					}
				]
			},
			"ko": "\uC5C5\uB370\uC774\uD2B8 \uD655\uC778 \uBE48\uB3C4",
			"pt-BR": "Com que frequ\u00EAncia verificar se h\u00E1 atualiza\u00E7\u00F5es",
			"ru": "\u041A\u0430\u043A \u0447\u0430\u0441\u0442\u043E \u0431\u0443\u0434\u0435\u0442 \u043F\u0440\u043E\u0438\u0441\u0445\u043E\u0434\u0438\u0442\u044C \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0430 \u043D\u0430\u043B\u0438\u0447\u0438\u044F \u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0439",
			"zh-CN": "\u591A\u4E45\u68C0\u67E5\u4E00\u6B21\u66F4\u65B0"
		},
		"hours": {
			"_info": {
				"instances": [
					{
						"setting": "check_update_interval",
						"field": "number_unit"
					}
				]
			},
			"ko": "\uC2DC\uAC04",
			"pt-BR": "horas",
			"ru": "\u0447.",
			"zh-CN": "\u5C0F\u65F6"
		},
		"Notify when update is available": {
			"_info": {
				"instances": [
					{
						"setting": "check_update_notify",
						"field": "name"
					}
				]
			},
			"ko": "\uC5C5\uB370\uC774\uD2B8\uAC00 \uC788\uC744 \uB54C \uC54C\uB9BC",
			"pt-BR": "Notificar quando houver atualiza\u00E7\u00E3o",
			"ru": "\u0423\u0432\u0435\u0434\u043E\u043C\u043B\u044F\u0442\u044C \u043E \u043F\u043E\u044F\u0432\u043B\u0435\u043D\u0438\u0438 \u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u044F",
			"zh-CN": "\u6709\u53EF\u7528\u66F4\u65B0\u65F6\u901A\u77E5"
		},
		"Creates a browser notification when an update is available": {
			"_info": {
				"instances": [
					{
						"setting": "check_update_notify",
						"field": "description"
					}
				]
			},
			"ko": "\uC5C5\uB370\uC774\uD2B8\uAC00 \uC788\uC744 \uB54C \uBE0C\uB77C\uC6B0\uC800 \uC54C\uB9BC\uC744 \uBC1B\uC2B5\uB2C8\uB2E4.",
			"pt-BR": "Cria uma notifica\u00E7\u00E3o do navegador quando uma atualiza\u00E7\u00E3o est\u00E1 dispon\u00EDvel",
			"ru": "\u0421\u043E\u0437\u0434\u0430\u0451\u0442 \u0443\u0432\u0435\u0434\u043E\u043C\u043B\u0435\u043D\u0438\u0435 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435, \u043A\u043E\u0433\u0434\u0430 \u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0435 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u043E.",
			"zh-CN": "\u6709\u53EF\u7528\u66F4\u65B0\u65F6\u5F39\u51FA\u6D4F\u89C8\u5668\u901A\u77E5"
		},
		"Show advanced settings": {
			"_info": {
				"instances": [
					{
						"setting": "advanced_options",
						"field": "name"
					}
				]
			},
			"ko": "\uACE0\uAE09 \uC124\uC815 \uD45C\uC2DC",
			"pt-BR": "Exibir configura\u00E7\u00F5es avan\u00E7adas",
			"ru": "\u041F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0442\u044C \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u043D\u044B\u0435 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438",
			"zh-CN": "\u663E\u793A\u9AD8\u7EA7\u8BBE\u7F6E"
		},
		"If disabled, settings that might be harder to understand will be hidden": {
			"_info": {
				"instances": [
					{
						"setting": "advanced_options",
						"field": "description"
					}
				]
			},
			"ko": "\uBE44\uD65C\uC131\uD654 \uC2DC, \uC774\uD574\uD558\uAE30 \uC5B4\uB824\uC6B8 \uC218 \uC788\uB294 \uC124\uC815\uC774 \uC228\uACA8\uC9D0",
			"pt-BR": "Se desativado, as configura\u00E7\u00F5es que podem ser mais dif\u00EDceis de entender ser\u00E3o ocultadas",
			"ru": "\u0415\u0441\u043B\u0438 \u043E\u0442\u043A\u043B\u044E\u0447\u0435\u043D\u043E, \u0442\u043E \u0431\u043E\u043B\u0435\u0435 \u0441\u043B\u043E\u0436\u043D\u044B\u0435 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438, \u0431\u0443\u0434\u0443\u0442 \u0441\u043A\u0440\u044B\u0442\u044B",
			"zh-CN": "\u7981\u7528\u540E\u5C06\u9690\u85CF\u6BD4\u8F83\u96BE\u4EE5\u7406\u89E3\u7684\u8BBE\u7F6E"
		},
		"Use tabs": {
			"_info": {
				"instances": [
					{
						"setting": "settings_tabs",
						"field": "name"
					}
				]
			},
			"ko": "\uD0ED \uC0AC\uC6A9",
			"pt-BR": "Usar abas",
			"ru": "\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u0432\u043A\u043B\u0430\u0434\u043A\u0438",
			"zh-CN": "\u6807\u7B7E\u5F0F\u8BBE\u7F6E"
		},
		"If disabled, all settings will be shown on a single page": {
			"_info": {
				"instances": [
					{
						"setting": "settings_tabs",
						"field": "description"
					}
				]
			},
			"ko": "\uBE44\uD65C\uC131\uD654 \uC2DC, \uBAA8\uB4E0 \uC124\uC815\uC774 \uD55C \uD398\uC774\uC9C0\uC5D0 \uD45C\uC2DC\uB429\uB2C8\uB2E4.",
			"pt-BR": "Se desativado, todas as configura\u00E7\u00F5es ser\u00E3o mostradas em uma \u00FAnica p\u00E1gina",
			"ru": "\u0415\u0441\u043B\u0438 \u043E\u0442\u043A\u043B\u044E\u0447\u0435\u043D\u043E, \u0442\u043E \u0432\u0441\u0435 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 \u0431\u0443\u0434\u0443\u0442 \u043E\u0442\u043E\u0431\u0440\u0430\u0436\u0430\u0442\u044C\u0441\u044F \u043D\u0430 \u043E\u0434\u043D\u043E\u0439 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0435",
			"zh-CN": "\u5982\u679C\u7981\u7528\uFF0C\u5C06\u5728\u540C\u4E00\u9875\u4E0A\u663E\u793A\u5168\u90E8\u8BBE\u7F6E"
		},
		"Alphabetical order": {
			"_info": {
				"instances": [
					{
						"setting": "settings_alphabetical_order",
						"field": "name"
					}
				]
			},
			"pt-BR": "Ordem alfab\u00E9tica",
			"ru": "\u0412 \u0430\u043B\u0444\u0430\u0432\u0438\u0442\u043D\u043E\u043C \u043F\u043E\u0440\u044F\u0434\u043A\u0435",
			"zh-CN": "\u6309\u5B57\u6BCD\u987A\u5E8F"
		},
		"Lists options in alphabetical order": {
			"_info": {
				"instances": [
					{
						"setting": "settings_alphabetical_order",
						"field": "description"
					}
				]
			},
			"pt-BR": "Lista as op\u00E7\u00F5es em ordem alfab\u00E9tica",
			"ru": "\u0421\u043F\u0438\u0441\u043E\u043A \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u043E\u0432 \u0431\u0443\u0434\u0435\u0442 \u043E\u0442\u0441\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u0430\u043D \u0432 \u0430\u043B\u0444\u0430\u0432\u0438\u0442\u043D\u043E\u043C \u043F\u043E\u0440\u044F\u0434\u043A\u0435",
			"zh-CN": "\u4EE5\u5B57\u6BCD\u987A\u5E8F\u6392\u5217\u9009\u9879"
		},
		"Allow using browser XHR": {
			"_info": {
				"instances": [
					{
						"setting": "allow_browser_request",
						"field": "name"
					}
				]
			},
			"pt-BR": "Permitir o uso do XHR do navegador",
			"ru": "\u0420\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044C \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0443 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C XHR",
			"zh-CN": "\u5141\u8BB8\u4F7F\u7528\u6D4F\u89C8\u5668 XHR"
		},
		"This allows XHR requests to be run in the browser's context if they fail in the extension (e.g. when Tracking Protection is set to High)": {
			"_info": {
				"instances": [
					{
						"setting": "allow_browser_request",
						"field": "description"
					}
				]
			},
			"pt-BR": "Isso permite que as solicita\u00E7\u00F5es XHR sejam executadas no contexto do navegador se falharem na extens\u00E3o (por exemplo, quando a Prote\u00E7\u00E3o contra Rastreamento est\u00E1 definida como Alta)",
			"ru": "\u042D\u0442\u043E \u043F\u043E\u0437\u0432\u043E\u043B\u044F\u0435\u0442 \u0437\u0430\u043F\u0443\u0441\u043A\u0430\u0442\u044C \u0437\u0430\u043F\u0440\u043E\u0441\u044B XHR \u0432 \u043A\u043E\u043D\u0442\u0435\u043A\u0441\u0442\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430, \u0435\u0441\u043B\u0438 \u043E\u043D\u0438 \u043D\u0435 \u0440\u0430\u0431\u043E\u0442\u0430\u044E\u0442 \u0432 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u0438\u0438 (\u043D\u0430\u043F\u0440\u0438\u043C\u0435\u0440, \u043A\u043E\u0433\u0434\u0430 \u0437\u0430\u0449\u0438\u0442\u0430 \u043E\u0442\u0441\u043B\u0435\u0436\u0438\u0432\u0430\u043D\u0438\u044F \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u0430 \u043D\u0430 \u0412\u044B\u0441\u043E\u043A\u0438\u0439 \u0443\u0440\u043E\u0432\u0435\u043D\u044C)",
			"zh-CN": "\u5141\u8BB8\u6269\u5C55\u4E2D\u8FD0\u884C XHR \u8BF7\u6C42\u5931\u8D25\u65F6\u5728\u6D4F\u89C8\u5668\u4E0A\u4E0B\u6587\u4E2D\u8FD0\u884C XHR\u3002\u539F\u56E0\u4F8B\u5982\u201C\u8DDF\u8E2A\u4FDD\u62A4\u201D\u88AB\u8BBE\u5B9A\u4E3A\u9AD8\u3002"
		},
		"Retry requests with 503 errors": {
			"_info": {
				"instances": [
					{
						"setting": "retry_503_times",
						"field": "name"
					}
				]
			},
			"pt-BR": "Repetir solicita\u00E7\u00F5es com erros 503",
			"ru": "\u041F\u043E\u0432\u0442\u043E\u0440\u044F\u0442\u044C \u0437\u0430\u043F\u0440\u043E\u0441 \u0441 \u043E\u0448\u0438\u0431\u043A\u043E\u0439 503",
			"zh-CN": "\u91CD\u8BD5\u8FD4\u56DE 503 \u9519\u8BEF\u7684\u8BF7\u6C42"
		},
		"Amount of times to retry a request when 503 (service unavailable) is returned by the server": {
			"_info": {
				"instances": [
					{
						"setting": "retry_503_times",
						"field": "description"
					}
				]
			},
			"pt-BR": "N\u00FAmero de vezes para repetir uma solicita\u00E7\u00E3o quando 503 (servi\u00E7o indispon\u00EDvel) \u00E9 retornado pelo servidor",
			"ru": "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043F\u043E\u0432\u0442\u043E\u0440\u043D\u044B\u0445 \u043F\u043E\u043F\u044B\u0442\u043E\u043A \u0437\u0430\u043F\u0440\u043E\u0441\u0430, \u043A\u043E\u0433\u0434\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0432\u043E\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 503 (\u0441\u043B\u0443\u0436\u0431\u0430 \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0430)",
			"zh-CN": "\u670D\u52A1\u5668\u8FD4\u56DE 503 \u9519\u8BEF\uFF08\u670D\u52A1\u4E0D\u53EF\u7528\uFF09\u65F6\uFF0C\u91CD\u8BD5\u8BF7\u6C42\u6B21\u6570"
		},
		"times": {
			"_info": {
				"instances": [
					{
						"setting": "retry_503_times",
						"field": "number_unit"
					}
				]
			},
			"pt-BR": "vezes",
			"ru": "\u0440\u0430\u0437(\u0430)",
			"zh-CN": "\u6B21"
		},
		"Delay between 503 retries": {
			"_info": {
				"instances": [
					{
						"setting": "retry_503_ms",
						"field": "name"
					}
				]
			},
			"pt-BR": "Atraso entre novas tentativas 503",
			"ru": "\u0417\u0430\u0434\u0435\u0440\u0436\u043A\u0430 \u043C\u0435\u0436\u0434\u0443 \u043F\u043E\u0432\u0442\u043E\u0440\u0430\u043C\u0438 503",
			"zh-CN": "503 \u91CD\u8BD5\u4E4B\u95F4\u5EF6\u8FDF"
		},
		"Time (in milliseconds) to delay between retrying requests that received 503": {
			"_info": {
				"instances": [
					{
						"setting": "retry_503_ms",
						"field": "description"
					}
				]
			},
			"pt-BR": "Tempo (em milissegundos) de atraso entre novas tentativas de solicita\u00E7\u00F5es que receberam 503",
			"ru": "\u0412\u0440\u0435\u043C\u044F (\u0432 \u043C\u0438\u043B\u043B\u0438\u0441\u0435\u043A\u0443\u043D\u0434\u0430\u0445) \u0434\u043B\u044F \u0437\u0430\u0434\u0435\u0440\u0436\u043A\u0438 \u043C\u0435\u0436\u0434\u0443 \u043F\u043E\u0432\u0442\u043E\u0440\u043D\u043E\u0439 \u043F\u043E\u043F\u044B\u0442\u043A\u043E\u0439 \u0437\u0430\u043F\u0440\u043E\u0441\u043E\u0432 \u043F\u0440\u0438 \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u0438\u0438 503",
			"zh-CN": "\u6536\u5230 503 \u9519\u8BEF\u540E\u91CD\u8BD5\u8BF7\u6C42\u4E4B\u95F4\u5EF6\u8FDF\u591A\u4E45\uFF08\u6BEB\u79D2\uFF09"
		},
		"Use `Blob` over `ArrayBuffer`": {
			"_info": {
				"instances": [
					{
						"setting": "use_blob_over_arraybuffer",
						"field": "name"
					}
				]
			},
			"pt-BR": "Usar `Blob` em vez de `ArrayBuffer`",
			"ru": "\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C `Blob` \u043F\u043E\u0432\u0435\u0440\u0445 `ArrayBuffer`",
			"zh-CN": "\u4F7F\u7528 Blob \u4EE3\u66FF ArrayBuffer"
		},
		"Uses `Blob`s for XHRs instead of `ArrayBuffer`s. Keep this enabled unless your userscript manager doesn't support blob requests": {
			"_info": {
				"instances": [
					{
						"setting": "use_blob_over_arraybuffer",
						"field": "description"
					}
				]
			},
			"pt-BR": "Usa `Blob`s para XHRs em vez de `ArrayBuffer`s. Mantenha isso ativado, a menos que seu gerenciador de userscript n\u00E3o suporte solicita\u00E7\u00F5es blob",
			"ru": "\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u0442 `Blob`\u044B \u0434\u043B\u044F XHR, \u0432\u043C\u0435\u0441\u0442\u043E `ArrayBuffer`\u043E\u0432. \u041D\u0435 \u043E\u0442\u043A\u043B\u044E\u0447\u0430\u0439\u0442\u0435, \u0435\u0441\u043B\u0438 \u0432\u0430\u0448 \u043C\u0435\u043D\u0435\u0434\u0436\u0435\u0440 \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u0438\u0445 \u0441\u043A\u0440\u0438\u043F\u0442\u043E\u0432 \u043D\u0435 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0437\u0430\u043F\u0440\u043E\u0441\u044B blob.",
			"zh-CN": "XHR \u4E2D\u4F7F\u7528 Blob \u4EE3\u66FF ArrayBuffer\u3002\u9664\u975E\u60A8\u7684\u7528\u6237\u811A\u672C\u7BA1\u7406\u5668\u4E0D\u652F\u6301 Blob \u8BF7\u6C42\uFF0C\u5426\u5219\u4FDD\u6301\u542F\u7528"
		},
		"Live settings reloading": {
			"_info": {
				"instances": [
					{
						"setting": "allow_live_settings_reload",
						"field": "name"
					}
				]
			},
			"pt-BR": "Recarregamento de configura\u00E7\u00F5es ao vivo",
			"ru": "\u041F\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u043D\u0430\u0441\u0442\u0440\u043E\u0435\u043A \u0432 \u0440\u0435\u0430\u043B\u044C\u043D\u043E\u043C \u0432\u0440\u0435\u043C\u0435\u043D\u0438",
			"zh-CN": "\u8BBE\u7F6E\u5B9E\u65F6\u751F\u6548"
		},
		"Enables/disables live settings reloading. There shouldn't be a reason to disable this unless you're experiencing issues with this feature": {
			"_info": {
				"instances": [
					{
						"setting": "allow_live_settings_reload",
						"field": "description"
					}
				]
			},
			"pt-BR": "Ativa/desativa o recarregamento de configura\u00E7\u00F5es ao vivo. N\u00E3o deve haver motivo para desativar isso, a menos que voc\u00EA esteja tendo problemas com esse recurso",
			"ru": "\u041F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0430\u0435\u0442 \u043F\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0443 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u043E\u0432 \u0432 \u0440\u0435\u0430\u043B\u044C\u043D\u043E\u043C \u0432\u0440\u0435\u043C\u0435\u043D\u0438. \u041D\u0435 \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043F\u0440\u0438\u0447\u0438\u043D \u0434\u043B\u044F \u043E\u0442\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u044F \u044D\u0442\u043E\u0439 \u0444\u0443\u043D\u043A\u0446\u0438\u0438. \u041E\u0442\u043A\u043B\u044E\u0447\u0438\u0442\u044C \u0442\u043E\u043B\u044C\u043A\u043E \u0435\u0441\u043B\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044C \u0441 \u043D\u0435\u0439 \u043F\u0440\u043E\u0431\u043B\u0435\u043C\u044B.",
			"zh-CN": "\u542F\u7528/\u7981\u7528\u8BBE\u7F6E\u5B9E\u65F6\u91CD\u65B0\u52A0\u8F7D\u3002\u9664\u975E\u9047\u5230\u6B64\u529F\u80FD\u76F8\u5173\u7684\u95EE\u9898\uFF0C\u5426\u5219\u5E94\u4FDD\u6301\u6B64\u529F\u80FD\u542F\u7528"
		},
		"Disable keybindings when editing text": {
			"_info": {
				"instances": [
					{
						"setting": "disable_keybind_when_editing",
						"field": "name"
					}
				]
			},
			"pt-BR": "Desativar atalhos de teclado ao editar texto",
			"ru": "\u041E\u0442\u043A\u043B\u044E\u0447\u0438\u0442\u044C \u0433\u043E\u0440\u044F\u0447\u0438\u0435 \u043A\u043B\u0430\u0432\u0438\u0448\u0438 \u043F\u0440\u0438 \u0440\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0438 \u0442\u0435\u043A\u0441\u0442\u0430",
			"zh-CN": "\u7F16\u8F91\u6587\u672C\u6846\u65F6\u7981\u7528\u5FEB\u6377\u952E"
		},
		"Disables shortcuts when key events are sent to an input area on the page": {
			"_info": {
				"instances": [
					{
						"setting": "disable_keybind_when_editing",
						"field": "description"
					}
				]
			},
			"pt-BR": "Desativa os atalhos quando eventos de teclas s\u00E3o enviados para uma \u00E1rea de entrada na p\u00E1gina",
			"ru": "\u041E\u0442\u043A\u043B\u044E\u0447\u0430\u0435\u0442 \u0433\u043E\u0440\u044F\u0447\u0438\u0435 \u043A\u043B\u0430\u0432\u0438\u0448\u0438 \u043F\u0440\u0438 \u043E\u0442\u043F\u0440\u0430\u0432\u043A\u0435 \u0441\u043E\u0431\u044B\u0442\u0438\u0439 \u043A\u043B\u0430\u0432\u0438\u0448 \u0432 \u043E\u0431\u043B\u0430\u0441\u0442\u044C \u0432\u0432\u043E\u0434\u0430 \u043D\u0430 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0435",
			"zh-CN": "\u5C06\u952E\u76D8\u4E8B\u4EF6\u53D1\u9001\u5230\u9875\u9762\u4E0A\u7684\u8F93\u5165\u533A\u57DF\u65F6\uFF0C\u505C\u7528\u5DF2\u8BBE\u7F6E\u7684\u5FEB\u6377\u952E"
		},
		"Use `GM_download` if available": {
			"_info": {
				"instances": [
					{
						"setting": "enable_gm_download",
						"field": "name"
					}
				]
			},
			"pt-BR": "Usar `GM_download` se dispon\u00EDvel",
			"ru": "\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C `GM_download`, \u0435\u0441\u043B\u0438 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u043E",
			"zh-CN": "\u53EF\u7528\u65F6\u4F7F\u7528 GM_download"
		},
		"Prefers using `GM_download` over simple browser-based downloads, if the function is available. Some userscript managers download the entire file before displaying a save dialog, which can be undesirable for large video files": {
			"_info": {
				"instances": [
					{
						"setting": "enable_gm_download",
						"field": "description"
					}
				]
			},
			"pt-BR": "Prefere usar `GM_download` em vez de downloads simples baseados em navegador, se a fun\u00E7\u00E3o estiver dispon\u00EDvel. Alguns gerenciadores de userscript baixam o arquivo inteiro antes de exibir uma caixa de di\u00E1logo de salvamento, o que pode ser indesej\u00E1vel para arquivos de v\u00EDdeo grandes",
			"ru": "\u041F\u0440\u0435\u0434\u043F\u043E\u0447\u0442\u0438\u0442\u0435\u043B\u044C\u043D\u043E \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u0442 `GM_download` \u0432\u043C\u0435\u0441\u0442\u043E \u043F\u0440\u043E\u0441\u0442\u044B\u0445 \u0441\u043A\u0430\u0447\u0438\u0432\u0430\u043D\u0438\u0439 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435, \u0435\u0441\u043B\u0438 \u044D\u0442\u0430 \u0444\u0443\u043D\u043A\u0446\u0438\u044F \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0430. \u041D\u0435\u043A\u043E\u0442\u043E\u0440\u044B\u0435 \u043C\u0435\u043D\u0435\u0434\u0436\u0435\u0440\u044B \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u0438\u0445 \u0441\u043A\u0440\u0438\u043F\u0442\u043E\u0432 \u0441\u043A\u0430\u0447\u0438\u0432\u0430\u0435\u0442 \u0432\u0435\u0441\u044C \u0444\u0430\u0439\u043B \u043F\u0435\u0440\u0435\u0434 \u043E\u0442\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435\u043C \u0434\u0438\u0430\u043B\u043E\u0433\u0430 \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u0438\u044F, \u0447\u0442\u043E \u043C\u043E\u0436\u0435\u0442 \u0431\u044B\u0442\u044C \u043D\u0435\u0436\u0435\u043B\u0430\u0442\u0435\u043B\u044C\u043D\u043E \u0434\u043B\u044F \u0431\u043E\u043B\u044C\u0448\u0438\u0445 \u0432\u0438\u0434\u0435\u043E\u0444\u0430\u0439\u043B\u043E\u0432.",
			"zh-CN": "\u4F18\u5148\u4F7F\u7528 GM_download \u4EE3\u66FF\u6D4F\u89C8\u5668\u7684\u4E0B\u8F7D\u529F\u80FD\u3002\u90E8\u5206\u7528\u6237\u811A\u672C\u7BA1\u7406\u5668\u4F1A\u5728\u663E\u793A\u201C\u4FDD\u5B58\u201D\u5BF9\u8BDD\u6846\u524D\u4E0B\u8F7D\u6574\u4E2A\u6587\u4EF6\uFF0C\u8FD9\u4E0D\u5229\u4E8E\u4E0B\u8F7D\u5927\u4F53\u91CF\u7684\u89C6\u9891\u6587\u4EF6"
		},
		"Maximum size to `GM_download`": {
			"_info": {
				"instances": [
					{
						"setting": "gm_download_max",
						"field": "name"
					}
				]
			},
			"pt-BR": "Tamanho m\u00E1ximo para `GM_download`",
			"ru": "\u041C\u0430\u043A\u0441\u0438\u043C\u0430\u043B\u044C\u043D\u044B\u0439 \u0440\u0430\u0437\u043C\u0435\u0440 \u0434\u043B\u044F `GM_download`",
			"zh-CN": "GM_download \u5927\u5C0F\u4E0A\u9650"
		},
		"If a file is larger than this size, use a simple browser-based download instead. Set to `0` for unlimited.": {
			"_info": {
				"instances": [
					{
						"setting": "gm_download_max",
						"field": "description"
					}
				]
			},
			"pt-BR": "Se um arquivo for maior que este tamanho, use um download simples baseado em navegador. Defina como `0` para ilimitado.",
			"ru": "\u0415\u0441\u043B\u0438 \u0444\u0430\u0439\u043B \u0431\u043E\u043B\u044C\u0448\u0435 \u044D\u0442\u043E\u0433\u043E \u0440\u0430\u0437\u043C\u0435\u0440\u0430, \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u0442\u0441\u044F \u043F\u0440\u043E\u0441\u0442\u043E\u0435 \u0441\u043A\u0430\u0447\u0438\u0432\u0430\u043D\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 \u0431\u0440\u0430\u0443\u0437\u0435\u0440. `0` - \u043D\u0435\u043E\u0433\u0440\u0430\u043D\u0438\u0447\u0435\u043D\u043D\u043E.",
			"zh-CN": "\u6587\u4EF6\u5927\u4E8E\u6B64\u5927\u5C0F\u65F6\u6539\u7528\u57FA\u4E8E\u6D4F\u89C8\u5668\u7684\u4E0B\u8F7D\u529F\u80FD\u3002\u8BBE\u4E3A 0 \u8868\u793A\u65E0\u9650\u5236\u3002"
		},
		"MB": {
			"_info": {
				"instances": [
					{
						"setting": "gm_download_max",
						"field": "number_unit"
					}
				]
			},
			"pt-BR": "MB",
			"ru": "\u041C\u0411",
			"zh-CN": "MB"
		},
		"Force save dialog when downloading": {
			"_info": {
				"instances": [
					{
						"setting": "enable_webextension_download",
						"field": "name"
					}
				]
			},
			"pt-BR": "For\u00E7ar caixa de di\u00E1logo de salvamento ao baixar",
			"ru": "\u041F\u0440\u0438\u043D\u0443\u0434\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0435 \u0434\u0438\u0430\u043B\u043E\u0433\u043E\u0432\u043E\u0435 \u043E\u043A\u043D\u043E \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u0438\u044F \u043F\u0440\u0438 \u0441\u043A\u0430\u0447\u0438\u0432\u0430\u043D\u0438\u0438",
			"zh-CN": "\u4E0B\u8F7D\u65F6\u5F3A\u5236\u6253\u5F00\u201C\u4FDD\u5B58\u201D\u5BF9\u8BDD\u6846"
		},
		"Tries to ensure the 'save as' dialog displays when downloading. This requires the 'downloads' permission to work, and will sometimes not work when custom headers are required.": {
			"_info": {
				"instances": [
					{
						"setting": "enable_webextension_download",
						"field": "description"
					}
				]
			},
			"pt-BR": "Tenta garantir que a caixa de di\u00E1logo 'salvar como' seja exibida ao baixar. Isso requer a permiss\u00E3o de 'downloads' para funcionar e, \u00E0s vezes, n\u00E3o funcionar\u00E1 quando cabe\u00E7alhos personalizados forem necess\u00E1rios.",
			"ru": "\u041F\u043E\u0441\u0442\u043E\u0440\u0430\u0435\u0442\u0441\u044F \u043E\u0431\u0435\u0441\u043F\u0435\u0447\u0438\u0442\u044C \u043E\u0442\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 \u0434\u0438\u0430\u043B\u043E\u0433\u043E\u0432\u043E\u0433\u043E \u043E\u043A\u043D\u0430 '\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C \u043A\u0430\u043A' \u043F\u0440\u0438 \u0441\u043A\u0430\u0447\u0438\u0432\u0430\u043D\u0438\u0438. \u0414\u043B\u044F \u044D\u0442\u043E\u0433\u043E \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044F \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043D\u0438\u0435 \u043D\u0430 '\u0441\u043A\u0430\u0447\u0438\u0432\u0430\u043D\u0438\u0435', \u0438 \u0438\u043D\u043E\u0433\u0434\u0430 \u043D\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043E\u0442\u0430\u0442\u044C, \u043A\u043E\u0433\u0434\u0430 \u0442\u0440\u0435\u0431\u0443\u044E\u0442\u0441\u044F \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u0438\u0435 \u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043A\u0438.",
			"zh-CN": "\u5C1D\u8BD5\u786E\u4FDD\u4E0B\u8F7D\u65F6\u6253\u5F00\u201C\u53E6\u5B58\u4E3A\u201D\u5BF9\u8BDD\u6846\u3002\u6B64\u529F\u80FD\u9700\u8981\u201C\u4E0B\u8F7D\u201D\u6743\u9650\uFF0C\u5E76\u4E14\u642D\u914D\u201C\u81EA\u5B9A\u4E49\u5934\u201D\u65F6\u53EF\u80FD\u65E0\u6548\u3002"
		},
		"Enable logging to console": {
			"_info": {
				"instances": [
					{
						"setting": "enable_console_logging",
						"field": "name"
					}
				]
			},
			"pt-BR": "Ativar registro no console",
			"ru": "\u0417\u0430\u043F\u0438\u0441\u044C \u0436\u0443\u0440\u043D\u0430\u043B\u0430 \u0432 \u043A\u043E\u043D\u0441\u043E\u043B\u0438",
			"zh-CN": "\u542F\u7528\u63A7\u5236\u53F0\u65E5\u5FD7"
		},
		"Allows the script to log messages to the browser console.": {
			"_info": {
				"instances": [
					{
						"setting": "enable_console_logging",
						"field": "description"
					}
				]
			},
			"pt-BR": "Permite que o script registre mensagens no console do navegador.",
			"ru": "\u041F\u043E\u0437\u0432\u043E\u043B\u044F\u0435\u0442 \u0441\u043A\u0440\u0438\u043F\u0442\u0443 \u0437\u0430\u043F\u0438\u0441\u044B\u0432\u0430\u0442\u044C \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u044F \u0432 \u043A\u043E\u043D\u0441\u043E\u043B\u044C \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430.",
			"zh-CN": "\u5141\u8BB8\u8BB0\u5F55\u65E5\u5FD7\u6D88\u606F\u5230\u6D4F\u89C8\u5668\u7684\u63A7\u5236\u53F0\u3002"
		},
		"Enable writing to clipboard": {
			"_info": {
				"instances": [
					{
						"setting": "write_to_clipboard",
						"field": "name"
					}
				]
			},
			"pt-BR": "Ativar escrita na \u00E1rea de transfer\u00EAncia",
			"ru": "\u0417\u0430\u043F\u0438\u0441\u044C \u0432 \u0431\u0443\u0444\u0435\u0440 \u043E\u0431\u043C\u0435\u043D\u0430",
			"zh-CN": "\u542F\u7528\u5199\u5165\u526A\u8D34\u677F"
		},
		"This option does nothing on its own, but enabling it allows other functionality that require writing to the clipboard to work": {
			"_info": {
				"instances": [
					{
						"setting": "write_to_clipboard",
						"field": "description"
					}
				]
			},
			"pt-BR": "Esta op\u00E7\u00E3o n\u00E3o faz nada por si s\u00F3, mas ativ\u00E1-la permite que outras funcionalidades que exigem escrita na \u00E1rea de transfer\u00EAncia funcionem",
			"ru": "\u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440 \u0441\u0430\u043C \u043F\u043E \u0441\u0435\u0431\u0435 \u043D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u0434\u0435\u043B\u0430\u0435\u0442, \u043D\u043E \u0435\u0433\u043E \u0432\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u0435 \u043F\u043E\u0437\u0432\u043E\u043B\u044F\u0435\u0442 \u0440\u0430\u0431\u043E\u0442\u0430\u0442\u044C \u0434\u0440\u0443\u0433\u0438\u043C \u0444\u0443\u043D\u043A\u0446\u0438\u044F\u043C, \u0442\u0440\u0435\u0431\u0443\u044E\u0449\u0438\u043C \u0437\u0430\u043F\u0438\u0441\u0438 \u0432 \u0431\u0443\u0444\u0435\u0440 \u043E\u0431\u043C\u0435\u043D\u0430.",
			"zh-CN": "\u6B64\u9009\u9879\u672C\u8EAB\u65E0\u529F\u80FD\uFF0C\u4F46\u542F\u7528\u5B83\u624D\u80FD\u4F7F\u5176\u4ED6\u9700\u8981\u5199\u5165\u526A\u8D34\u677F\u7684\u529F\u80FD\u8FD0\u4F5C"
		},
		"Enable redirection": {
			"_info": {
				"instances": [
					{
						"setting": "redirect",
						"field": "name"
					}
				]
			},
			"es": "Habilitar redirecci\u00F3n",
			"fr": "Activer la redirection",
			"ko": "\uB9AC\uB514\uB809\uC158 \uC0AC\uC6A9",
			"pt-BR": "Ativar redirecionamento",
			"ru": "\u041F\u0435\u0440\u0435\u043D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435",
			"zh-CN": "\u542F\u7528\u91CD\u5B9A\u5411"
		},
		"Automatically redirect media opened in their own tab to their larger/original versions": {
			"_info": {
				"instances": [
					{
						"setting": "redirect",
						"field": "description"
					}
				]
			},
			"pt-BR": "Redirecionar automaticamente m\u00EDdias abertas em sua pr\u00F3pria aba para suas vers\u00F5es maiores/originais",
			"ru": "\u0410\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0438 \u043F\u0435\u0440\u0435\u043D\u0430\u043F\u0440\u0430\u0432\u043B\u044F\u0435\u0442 \u043E\u0442\u043A\u0440\u044B\u0442\u043E\u0435 \u043C\u0435\u0434\u0438\u0430 \u043D\u0430 \u043D\u043E\u0432\u0443\u044E \u0432\u043A\u043B\u0430\u0434\u043A\u0443 \u043A \u0438\u0445 \u0431\u043E\u043B\u0435\u0435 \u043A\u0440\u0443\u043F\u043D\u043E\u0439/\u043E\u0440\u0438\u0433\u0438\u043D\u0430\u043B\u044C\u043D\u043E\u0439 \u0432\u0435\u0440\u0441\u0438\u0438",
			"zh-CN": "\u5728\u6253\u5F00\u7684\u5A92\u4F53\u6587\u4EF6\u6807\u7B7E\u9875\u4E2D\u81EA\u52A8\u91CD\u5B9A\u5411\u5230\u5176\u66F4\u6E05\u6670\u7684\u7248\u672C"
		},
		"Allow video": {
			"_info": {
				"instances": [
					{
						"setting": "redirect_video",
						"field": "name"
					}
				]
			},
			"pt-BR": "Permitir v\u00EDdeo",
			"ru": "\u0420\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044C \u0432\u0438\u0434\u0435\u043E",
			"zh-CN": "\u5141\u8BB8\u89C6\u9891"
		},
		"Allows redirecting from/to video": {
			"_info": {
				"instances": [
					{
						"setting": "redirect_video",
						"field": "description"
					}
				]
			},
			"pt-BR": "Permite redirecionar de/para v\u00EDdeo",
			"ru": "\u041F\u043E\u0437\u0432\u043E\u043B\u044F\u0435\u0442 \u043F\u0435\u0440\u0435\u043D\u0430\u043F\u0440\u0430\u0432\u043B\u044F\u0442\u044C \u0441/\u043D\u0430 \u0432\u0438\u0434\u0435\u043E",
			"zh-CN": "\u5141\u8BB8\u89C6\u9891\u88AB\u91CD\u5B9A\u5411"
		},
		"Allow audio": {
			"_info": {
				"instances": [
					{
						"setting": "redirect_audio",
						"field": "name"
					}
				]
			},
			"pt-BR": "Permitir \u00E1udio",
			"ru": "\u0420\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044C \u0430\u0443\u0434\u0438\u043E",
			"zh-CN": "\u5141\u8BB8\u97F3\u9891"
		},
		"Allows redirecting from/to audio": {
			"_info": {
				"instances": [
					{
						"setting": "redirect_audio",
						"field": "description"
					}
				]
			},
			"pt-BR": "Permite redirecionar de/para \u00E1udio",
			"ru": "\u041F\u043E\u0437\u0432\u043E\u043B\u044F\u0435\u0442 \u043F\u0435\u0440\u0435\u043D\u0430\u043F\u0440\u0430\u0432\u043B\u044F\u0442\u044C \u0441/\u043D\u0430 \u0430\u0443\u0434\u0438\u043E",
			"zh-CN": "\u5141\u8BB8\u97F3\u9891\u88AB\u91CD\u5B9A\u5411"
		},
		"Add to history": {
			"_info": {
				"instances": [
					{
						"setting": "redirect_history",
						"field": "name"
					}
				]
			},
			"es": "Agregar al historial",
			"fr": "Ajouter \u00E0 l'historique",
			"ko": "\uBE0C\uB77C\uC6B0\uC800 \uAE30\uB85D\uC5D0 \uCD94\uAC00",
			"pt-BR": "Adicionar ao hist\u00F3rico",
			"ru": "\u0414\u043E\u0431\u0430\u0432\u043B\u044F\u0442\u044C \u0432 \u0438\u0441\u0442\u043E\u0440\u0438\u044E",
			"zh-CN": "\u6DFB\u52A0\u5230\u5386\u53F2\u8BB0\u5F55"
		},
		"Redirection will add a new entry to the browser's history": {
			"_info": {
				"instances": [
					{
						"setting": "redirect_history",
						"field": "description"
					}
				]
			},
			"ko": "\uB9AC\uB514\uB809\uC158 \uC2DC, \uBE0C\uB77C\uC6B0\uC800\uC758 \uAE30\uB85D\uC5D0 \uC0C8 \uD56D\uBAA9\uC774 \uCD94\uAC00\uB428",
			"pt-BR": "O redirecionamento adicionar\u00E1 uma nova entrada ao hist\u00F3rico do navegador",
			"ru": "\u041F\u0435\u0440\u0435\u043D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0434\u043E\u0431\u0430\u0432\u043B\u044F\u0442\u044C \u043D\u043E\u0432\u0443\u044E \u0437\u0430\u043F\u0438\u0441\u044C \u0432 \u0438\u0441\u0442\u043E\u0440\u0438\u044E \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430",
			"zh-CN": "\u91CD\u5B9A\u5411\u53D1\u751F\u65F6\u5728\u6D4F\u89C8\u5668\u7684\u5386\u53F2\u8BB0\u5F55\u4E2D\u52A0\u5165\u4E00\u6761\u8BB0\u5F55"
		},
		"Do redirection in extension": {
			"_info": {
				"instances": [
					{
						"setting": "redirect_extension",
						"field": "name"
					}
				]
			},
			"pt-BR": "Fazer redirecionamento na extens\u00E3o",
			"ru": "\u0412\u044B\u043F\u043E\u043B\u043D\u044F\u0442\u044C \u043F\u0435\u0440\u0435\u043D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u0432 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u0438\u0438",
			"zh-CN": "\u5728\u6269\u5C55\u4E2D\u6267\u884C\u91CD\u5B9A\u5411"
		},
		"Performs the redirection in the extension instead of the content script. This is significantly faster and shouldn't cause issues in theory, but this option is kept in case of regressions": {
			"_info": {
				"instances": [
					{
						"setting": "redirect_extension",
						"field": "description"
					}
				]
			},
			"pt-BR": "Realiza o redirecionamento na extens\u00E3o em vez de no script de conte\u00FAdo. Isso \u00E9 significativamente mais r\u00E1pido e n\u00E3o deve causar problemas em teoria, mas esta op\u00E7\u00E3o \u00E9 mantida em caso de regress\u00F5es",
			"ru": "\u0412\u044B\u043F\u043E\u043B\u043D\u044F\u0435\u0442 \u043F\u0435\u0440\u0435\u043D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u0432 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u0438\u0438 \u0432\u043C\u0435\u0441\u0442\u043E \u0441\u043A\u0440\u0438\u043F\u0442\u0430. \u0422\u0435\u043E\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043A\u0438 \u044D\u0442\u043E \u0437\u043D\u0430\u0447\u0438\u0442\u0435\u043B\u044C\u043D\u043E \u0431\u044B\u0441\u0442\u0440\u0435\u0435 \u0438 \u043D\u0435 \u0434\u043E\u043B\u0436\u043D\u043E \u0432\u044B\u0437\u044B\u0432\u0430\u0442\u044C \u043F\u0440\u043E\u0431\u043B\u0435\u043C, \u043D\u043E \u044D\u0442\u043E\u0442 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440 \u0441\u043E\u0445\u0440\u0430\u043D\u044F\u0435\u0442\u0441\u044F \u0432 \u0441\u043B\u0443\u0447\u0430\u0435 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0439.",
			"zh-CN": "\u5728\u6269\u5C55\u5185\u800C\u975E\u5185\u5BB9\u811A\u672C\u4E2D\u6267\u884C\u91CD\u5B9A\u5411\u3002\u8FD9\u6837\u5FEB\u5F97\u591A\u5E76\u4E14\u7406\u8BBA\u4E0A\u4E0D\u5E94\u8BE5\u5F15\u8D77\u95EE\u9898\uFF0C\u4F46\u8BE5\u9009\u9879\u88AB\u4FDD\u7559\u4EE5\u9632\u7279\u6B8A\u95EE\u9898"
		},
		"Use GET if HEAD is unsupported": {
			"_info": {
				"instances": [
					{
						"setting": "canhead_get",
						"field": "name"
					}
				]
			},
			"es": "Utilizar GET si HEAD no es soportado",
			"fr": "Utiliser GET si HEAD n'est pas support\u00E9",
			"ko": "HEAD \uC9C0\uC6D0\uB418\uC9C0 \uC54A\uC73C\uBA74 GET \uC0AC\uC6A9",
			"pt-BR": "Usar GET se HEAD n\u00E3o for suportado",
			"ru": "\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C GET, \u0435\u0441\u043B\u0438 HEAD \u043D\u0435 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044F",
			"zh-CN": "\u4E0D\u652F\u6301 HEAD \u65F6\u6539\u7528 GET"
		},
		"Use a GET request to check an image's availability, if the server does not support HEAD requests": {
			"_info": {
				"instances": [
					{
						"setting": "canhead_get",
						"field": "description"
					}
				]
			},
			"pt-BR": "Usar uma solicita\u00E7\u00E3o GET para verificar a disponibilidade de uma imagem, se o servidor n\u00E3o suportar solicita\u00E7\u00F5es HEAD",
			"ru": "\u0411\u0443\u0434\u0435\u0442 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C\u0441\u044F GET-\u0437\u0430\u043F\u0440\u043E\u0441 \u0434\u043B\u044F \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0438 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u043E\u0441\u0442\u0438 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F, \u0435\u0441\u043B\u0438 \u0441\u0435\u0440\u0432\u0435\u0440 \u043D\u0435 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0437\u0430\u043F\u0440\u043E\u0441\u044B HEAD.",
			"zh-CN": "\u670D\u52A1\u5668\u4E0D\u652F\u6301 HEAD \u8BF7\u6C42\u65F6\u6539\u7528\u4E00\u6761 GET \u8BF7\u6C42\u6765\u68C0\u67E5\u4E00\u4E2A\u56FE\u50CF\u7684\u53EF\u7528\u6027"
		},
		"Try finding extra information": {
			"_info": {
				"instances": [
					{
						"setting": "redirect_force_page",
						"field": "name"
					}
				]
			},
			"pt-BR": "Tentar encontrar informa\u00E7\u00F5es extras",
			"ru": "\u041F\u044B\u0442\u0430\u0442\u044C\u0441\u044F \u043D\u0430\u0439\u0442\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u043D\u0443\u044E \u0438\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044E",
			"zh-CN": "\u5C1D\u8BD5\u67E5\u627E\u989D\u5916\u4FE1\u606F"
		},
		"Enables methods that use API calls for finding extra information, such as the original page, caption, or album information. Note that this option does not affect finding the original media.": {
			"_info": {
				"instances": [
					{
						"setting": "redirect_force_page",
						"field": "description"
					}
				]
			},
			"pt-BR": "Ativa m\u00E9todos que usam chamadas de API para encontrar informa\u00E7\u00F5es extras, como a p\u00E1gina original, legenda ou informa\u00E7\u00F5es do \u00E1lbum. Observe que esta op\u00E7\u00E3o n\u00E3o afeta a localiza\u00E7\u00E3o da m\u00EDdia original.",
			"ru": "\u0412\u043A\u043B\u044E\u0447\u0430\u0435\u0442 \u043C\u0435\u0442\u043E\u0434\u044B, \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u044E\u0449\u0438\u0435 \u0432\u044B\u0437\u043E\u0432\u044B API \u0434\u043B\u044F \u043F\u043E\u0438\u0441\u043A\u0430 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u043D\u043E\u0439 \u0438\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u0438, \u0442\u0430\u043A\u043E\u0439 \u043A\u0430\u043A \u043E\u0440\u0438\u0433\u0438\u043D\u0430\u043B\u044C\u043D\u0430\u044F \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0430, \u043F\u043E\u0434\u043F\u0438\u0441\u044C \u0438\u043B\u0438 \u0441\u0432\u0435\u0434\u0435\u043D\u0438\u044F \u043E\u0431 \u0430\u043B\u044C\u0431\u043E\u043C\u0435. \u041E\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043D\u0438\u043C\u0430\u043D\u0438\u0435, \u0447\u0442\u043E \u044D\u0442\u043E\u0442 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440 \u043D\u0435 \u0432\u043B\u0438\u044F\u0435\u0442 \u043D\u0430 \u043F\u043E\u0438\u0441\u043A \u043E\u0440\u0438\u0433\u0438\u043D\u0430\u043B\u044C\u043D\u043E\u0433\u043E \u043C\u0435\u0434\u0438\u0430.",
			"zh-CN": "\u542F\u7528\u901A\u8FC7 API \u8C03\u7528\u67E5\u627E\u989D\u5916\u4FE1\u606F\u7684\u65B9\u6CD5\uFF0C\u67E5\u627E\u5982\u539F\u59CB\u9875\u9762\u3001\u6807\u9898\u6216\u76F8\u518C\u4FE1\u606F\u3002\u6B64\u9009\u9879\u4E0D\u5F71\u54CD\u67E5\u627E\u539F\u59CB\u7248\u672C\u7684\u5A92\u4F53\u6587\u4EF6\u3002"
		},
		"SmugMug": {
			"_info": {
				"instances": [
					{
						"setting": "redirect_force_page",
						"field": "example_websites[1]"
					}
				]
			},
			"pt-BR": "SmugMug",
			"ru": "SmugMug",
			"zh-CN": "SmugMug"
		},
		"Enable tooltip": {
			"_info": {
				"instances": [
					{
						"setting": "redirect_enable_infobox",
						"field": "name"
					}
				]
			},
			"pt-BR": "Ativar dica de ferramenta",
			"ru": "\u0412\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0430\u044F \u043F\u043E\u0434\u0441\u043A\u0430\u0437\u043A\u0430",
			"zh-CN": "\u542F\u7528\u5DE5\u5177\u63D0\u793A"
		},
		"Enables the 'Mouseover popup is needed to display the original version' tooltip": {
			"_info": {
				"instances": [
					{
						"setting": "redirect_enable_infobox",
						"field": "description"
					}
				]
			},
			"pt-BR": "Ativa a dica de ferramenta '\u00C9 necess\u00E1rio passar o mouse sobre o popup para exibir a vers\u00E3o original'",
			"ru": "\u0412\u043A\u043B\u044E\u0447\u0430\u0435\u0442 \u043F\u043E\u0434\u0441\u043A\u0430\u0437\u043A\u0443 \u00AB\u0414\u043B\u044F \u043E\u0442\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F \u0438\u0441\u0445\u043E\u0434\u043D\u043E\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044F \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u043F\u0440\u0438 \u043D\u0430\u0432\u0435\u0434\u0435\u043D\u0438\u0438 \u043C\u044B\u0448\u0438\u00BB.",
			"zh-CN": "\u542F\u7528\u201C\u9700\u8981\u9F20\u6807\u60AC\u505C\u5F39\u7A97\u6765\u663E\u793A\u539F\u59CB\u7248\u672C\u201D\u7684\u5DE5\u5177\u63D0\u793A"
		},
		"Show image URL in tooltip": {
			"_info": {
				"instances": [
					{
						"setting": "redirect_infobox_url",
						"field": "name"
					}
				]
			},
			"ko": "\uD234\uD301\uC5D0 \uC774\uBBF8\uC9C0 URL \uD45C\uC2DC",
			"pt-BR": "Mostrar URL da imagem na dica de ferramenta",
			"ru": "\u041F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0442\u044C URL \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F \u0432\u043E \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0439 \u043F\u043E\u0434\u0441\u043A\u0430\u0437\u043A\u0435",
			"zh-CN": "\u5728\u5DE5\u5177\u63D0\u793A\u4E2D\u663E\u793A\u56FE\u50CF URL"
		},
		"If the popup is needed to display the larger version of an image, display the image link in the tooltip": {
			"_info": {
				"instances": [
					{
						"setting": "redirect_infobox_url",
						"field": "description"
					}
				]
			},
			"ko": "\uB354 \uD070 \uBC84\uC804\uC758 \uC774\uBBF8\uC9C0\uB97C \uD45C\uC2DC\uD558\uAE30 \uC704\uD574 \uD31D\uC5C5\uC774 \uD544\uC694\uD55C \uACBD\uC6B0 \uC774\uBBF8\uC9C0 \uB9C1\uD06C\uB97C \uD234\uD301\uC5D0 \uD45C\uC2DC\uD568",
			"pt-BR": "Se o popup for necess\u00E1rio para exibir a vers\u00E3o maior de uma imagem, exiba o link da imagem na dica de ferramenta",
			"ru": "\u0415\u0441\u043B\u0438 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u043D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u043E \u0434\u043B\u044F \u043E\u0442\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F \u0443\u0432\u0435\u043B\u0438\u0447\u0435\u043D\u043D\u043E\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F, \u043E\u0442\u043E\u0431\u0440\u0430\u0437\u0438\u0442\u0435 url \u043D\u0430 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 \u0432\u043E \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0439 \u043F\u043E\u0434\u0441\u043A\u0430\u0437\u043A\u0435.",
			"zh-CN": "\u5982\u679C\u9700\u8981\u5F39\u7A97\u6765\u663E\u793A\u56FE\u50CF\u7684\u8F83\u5927\u7248\u672C\uFF0C\u5728\u5DE5\u5177\u63D0\u793A\u4E2D\u663E\u793A\u56FE\u50CF\u94FE\u63A5"
		},
		"Hide tooltip after": {
			"_info": {
				"instances": [
					{
						"setting": "redirect_infobox_timeout",
						"field": "name"
					}
				]
			},
			"ko": "\uD234\uD301 \uC228\uAE30\uAE30",
			"pt-BR": "Ocultar dica de ferramenta ap\u00F3s",
			"ru": "\u0421\u043A\u0440\u044B\u0432\u0430\u0442\u044C \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0443\u044E \u043F\u043E\u0434\u0441\u043A\u0430\u0437\u043A\u0443 \u0447\u0435\u0440\u0435\u0437",
			"zh-CN": "\u9690\u85CF\u5DE5\u5177\u63D0\u793A\u7684\u65F6\u95F4"
		},
		"Hides the tooltip after the specified number of seconds (or when the mouse clicks on it). Set to 0 to never hide automatically": {
			"_info": {
				"instances": [
					{
						"setting": "redirect_infobox_timeout",
						"field": "description"
					}
				]
			},
			"ko": "\uC9C0\uC815\uB41C \uC2DC\uAC04(\uCD08) \uD6C4\uC5D0(\uB610\uB294 \uB9C8\uC6B0\uC2A4\uAC00 \uD234\uD301\uC744 \uD074\uB9AD\uD560 \uB54C) \uD234\uD301\uC744 \uC228\uAE34\uB2E4. \uC790\uB3D9\uC73C\uB85C \uC228\uAE30\uC9C0 \uC54A\uC73C\uB824\uBA74 0\uC73C\uB85C \uC124\uC815",
			"pt-BR": "Oculta a dica de ferramenta ap\u00F3s o n\u00FAmero especificado de segundos (ou quando o mouse clica nela). Defina como 0 para nunca ocultar automaticamente",
			"ru": "\u0421\u043A\u0440\u044B\u0432\u0430\u0435\u0442 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0443\u044E \u043F\u043E\u0434\u0441\u043A\u0430\u0437\u043A\u0443 \u043F\u043E\u0441\u043B\u0435 \u0443\u043A\u0430\u0437\u0430\u043D\u043D\u043E\u0433\u043E \u043A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0441\u0435\u043A\u0443\u043D\u0434 (\u0438\u043B\u0438 \u043A\u043E\u0433\u0434\u0430 \u043C\u044B\u0448\u044C \u0449\u0451\u043B\u043A\u0430\u0435\u0442 \u043F\u043E \u043D\u0435\u0439). 0 - \u043D\u0435 \u0441\u043A\u0440\u044B\u0432\u0430\u0442\u044C \u0430\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0438.",
			"zh-CN": "\u5728\u6307\u5B9A\u79D2\u6570\u540E\u9690\u85CF\u5DE5\u5177\u63D0\u793A\u3002\u9F20\u6807\u5355\u51FB\u540E\u4E5F\u4F1A\u9690\u85CF\u3002\u8BBE\u4E3A 0 \u5219\u7981\u7528\u81EA\u52A8\u9690\u85CF"
		},
		"Log info object to console": {
			"_info": {
				"instances": [
					{
						"setting": "print_imu_obj",
						"field": "name"
					}
				]
			},
			"pt-BR": "Registrar objeto de informa\u00E7\u00F5es no console",
			"ru": "\u0412\u044B\u0432\u043E\u0434\u0438\u0442\u044C \u0438\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044E \u043E\u0431 \u043E\u0431\u044A\u0435\u043A\u0442\u0435 \u0432 \u043A\u043E\u043D\u0441\u043E\u043B\u044C",
			"zh-CN": "\u8BB0\u5F55\u4FE1\u606F\u5BF9\u8C61\u5230\u63A7\u5236\u53F0"
		},
		"Prints the full info object to the console whenever a popup/redirect is found": {
			"_info": {
				"instances": [
					{
						"setting": "print_imu_obj",
						"field": "description"
					}
				]
			},
			"pt-BR": "Imprime o objeto de informa\u00E7\u00F5es completo no console sempre que um popup/redirecionamento for encontrado",
			"ru": "\u0412\u044B\u0432\u043E\u0434\u0438\u0442 \u043F\u043E\u043B\u043D\u0443\u044E \u0438\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044E \u043E\u0431\u044A\u0435\u043A\u0442\u0430 \u0432 \u043A\u043E\u043D\u0441\u043E\u043B\u044C \u0432\u0441\u044F\u043A\u0438\u0439 \u0440\u0430\u0437, \u043A\u043E\u0433\u0434\u0430 \u043E\u0431\u043D\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044F \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E/\u043F\u0435\u0440\u0435\u043D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435",
			"zh-CN": "\u6BCF\u5F53\u53D1\u73B0\u5F39\u51FA/\u91CD\u5B9A\u5411\u65F6\uFF0C\u8BB0\u5F55\u5B8C\u6574\u7684\u4FE1\u606F\u5BF9\u8C61\u5230\u63A7\u5236\u53F0"
		},
		"Disable when response headers need modifying": {
			"_info": {
				"instances": [
					{
						"setting": "redirect_disable_for_responseheader",
						"field": "name"
					}
				]
			},
			"pt-BR": "Desativar quando os cabe\u00E7alhos de resposta precisarem ser modificados",
			"ru": "\u041E\u0442\u043A\u043B\u044E\u0447\u0430\u0442\u044C, \u043A\u043E\u0433\u0434\u0430 \u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043A\u0438 \u043E\u0442\u0432\u0435\u0442\u043E\u0432 \u043D\u0443\u0436\u0434\u0430\u044E\u0442\u0441\u044F \u0432 \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u0438",
			"zh-CN": "\u9700\u8981\u4FEE\u6539\u54CD\u5E94\u5934\u65F6\u7981\u7528"
		},
		"This option works around Chrome's migration to manifest v3, redirecting some images to being force-downloaded": {
			"_info": {
				"instances": [
					{
						"setting": "redirect_disable_for_responseheader",
						"field": "description"
					}
				]
			},
			"pt-BR": "Esta op\u00E7\u00E3o contorna a migra\u00E7\u00E3o do Chrome para o manifesto v3, redirecionando algumas imagens para serem baixadas \u00E0 for\u00E7a",
			"ru": "\u042D\u0442\u043E\u0442 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440 \u0440\u0430\u0431\u043E\u0442\u0430\u0435\u0442 \u0432\u043E\u043A\u0440\u0443\u0433 \u043C\u0438\u0433\u0440\u0430\u0446\u0438\u0438 Chrome \u0432 manifest v3, \u043F\u0435\u0440\u0435\u043D\u0430\u043F\u0440\u0430\u0432\u043B\u044F\u044F \u043D\u0435\u043A\u043E\u0442\u043E\u0440\u044B\u0435 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F \u043A \u043F\u0440\u0438\u043D\u0443\u0434\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u043C\u0443 \u0441\u043A\u0430\u0447\u0438\u0432\u0430\u043D\u0438\u044E",
			"zh-CN": "\u6B64\u9009\u9879\u662F\u4E3A\u914D\u5408 Chrome \u7684\u8FC1\u79FB\u5230 manifest v3\uFF0C\u91CD\u5B9A\u5411\u4E00\u4E9B\u56FE\u50CF\u6765\u5F3A\u5236\u4E0B\u8F7D"
		},
		"Redirect to largest without issues": {
			"_info": {
				"instances": [
					{
						"setting": "redirect_to_no_infobox",
						"field": "name"
					}
				]
			},
			"ko": "\uBB38\uC81C\uC5C6\uC774 \uCD5C\uB300\uB85C \uB9AC\uB514\uB809\uC158",
			"pt-BR": "Redirecionar para a maior sem problemas",
			"ru": "\u0411\u0435\u0437 \u043F\u0440\u043E\u0431\u043B\u0435\u043C \u043F\u0435\u0440\u0435\u043D\u0430\u043F\u0440\u0430\u0432\u043B\u044F\u0442\u044C \u043D\u0430 \u0441\u0430\u043C\u043E\u0435 \u0431\u043E\u043B\u044C\u0448\u043E\u0435",
			"zh-CN": "\u65E0\u9700\u6C42\u4E5F\u91CD\u5B9A\u5411\u5230\u6700\u5927\u7248\u672C"
		},
		"Redirects to the largest image found that doesn't require custom headers or forces download": {
			"_info": {
				"instances": [
					{
						"setting": "redirect_to_no_infobox",
						"field": "description"
					}
				]
			},
			"ko": "\uC0AC\uC6A9\uC790 \uC9C0\uC815 \uD5E4\uB354\uB098 \uAC15\uC81C \uB2E4\uC6B4\uB85C\uB4DC\uAC00 \uD544\uC694 \uC5C6\uB294 \uAC00\uC7A5 \uD070 \uC774\uBBF8\uC9C0\uB85C \uB9AC\uB514\uB809\uC158",
			"pt-BR": "Redireciona para a maior imagem encontrada que n\u00E3o requer cabe\u00E7alhos personalizados ou for\u00E7a o download",
			"ru": "\u041F\u0435\u0440\u0435\u043D\u0430\u043F\u0440\u0430\u0432\u043B\u044F\u0435\u0442 \u043D\u0430 \u0441\u0430\u043C\u043E\u0435 \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043D\u043E\u0435 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435, \u043A\u043E\u0442\u043E\u0440\u043E\u0435 \u043D\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u0438\u0445 \u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043A\u043E\u0432 \u0438\u043B\u0438 \u043F\u0440\u0438\u043D\u0443\u0434\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0433\u043E \u0441\u043A\u0430\u0447\u0438\u0432\u0430\u043D\u0438\u044F.",
			"zh-CN": "\u91CD\u5B9A\u5411\u5230\u627E\u5230\u7684\u6700\u5927\u56FE\u50CF\u7248\u672C\uFF0C\u54EA\u6015\u4E0D\u9700\u8981\u81EA\u5B9A\u4E49\u5934\u6216\u5F3A\u5236\u4E0B\u8F7D"
		},
		"Redirect for HTML pages too": {
			"_info": {
				"instances": [
					{
						"setting": "redirect_host_html",
						"field": "name"
					}
				]
			},
			"pt-BR": "Redirecionar p\u00E1ginas HTML tamb\u00E9m",
			"ru": "\u041F\u0435\u0440\u0435\u043D\u0430\u043F\u0440\u0430\u0432\u043B\u044F\u0442\u044C \u0434\u043B\u044F HTML-\u0441\u0442\u0440\u0430\u043D\u0438\u0446 \u0442\u043E\u0436\u0435",
			"zh-CN": "\u540C\u65F6\u91CD\u5B9A\u5411 HTML \u9875\u9762"
		},
		"Tries redirection even if the host page is HTML. This option might be useful for dead links. However, this will also result in many normal pages being redirected to images/video, so use with caution.": {
			"_info": {
				"instances": [
					{
						"setting": "redirect_host_html",
						"field": "description"
					}
				]
			},
			"pt-BR": "Tenta redirecionar mesmo se a p\u00E1gina de origem for HTML. Esta op\u00E7\u00E3o pode ser \u00FAtil para links inativos. No entanto, isso tamb\u00E9m far\u00E1 com que muitas p\u00E1ginas normais sejam redirecionadas para imagens/v\u00EDdeo, portanto, use com cautela."
		},
		"This will result in many pages being redirected to images/videos.\nI'd recommend only either enabling this for the media you need it for then disabling it after, or using the black/whitelist feature below to only allow it to run for specified websites.": {
			"_info": {
				"instances": [
					{
						"setting": "redirect_host_html",
						"field": "warning.true"
					}
				]
			},
			"pt-BR": "Isso resultar\u00E1 no redirecionamento de v\u00E1rias p\u00E1ginas para imagens/v\u00EDdeos.\nRecomendo habilitar esta op\u00E7\u00E3o apenas para a m\u00EDdia que voc\u00EA precisa e desabilit\u00E1-la em seguida, ou usar o recurso de lista negra/branca abaixo para permitir que ela seja executada apenas em sites espec\u00EDficos."
		},
		"Enable mouseover popup": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover",
						"field": "name"
					}
				]
			},
			"en": "Enable image popup",
			"es": "Activar popup de la imagen",
			"fr": "Activer le popup",
			"ko": "\uC774\uBBF8\uC9C0 \uD31D\uC5C5 \uC0AC\uC6A9",
			"pt-BR": "Ativar pop-up ao passar o mouse",
			"ru": "\u0412\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u043F\u0440\u0438 \u043D\u0430\u0432\u0435\u0434\u0435\u043D\u0438\u0438 \u043C\u044B\u0448\u0438",
			"zh-CN": "\u542F\u7528\u9F20\u6807\u60AC\u505C\u5F39\u7A97"
		},
		"Show a popup with the larger image when you mouseover an image with the trigger key held (if applicable)": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover",
						"field": "description"
					}
				]
			},
			"ko": "\uD2B8\uB9AC\uAC70 \uD0A4\uB97C \uB204\uB978 \uC0C1\uD0DC\uB85C \uC601\uC0C1\uC744 \uB9C8\uC6B0\uC2A4\uB85C \uAC00\uB9AC\uD0AC \uB54C \uB354 \uD070 \uC774\uBBF8\uC9C0\uB85C \uD31D\uC5C5 \uD45C\uC2DC (\uAC00\uB2A5\uD55C \uACBD\uC6B0)",
			"pt-BR": "Exibir um pop-up com a imagem ampliada ao passar o mouse sobre uma imagem com a tecla de gatilho pressionada (se aplic\u00E1vel)",
			"ru": "\u041F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0442\u044C \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u0441 \u0443\u0432\u0435\u043B\u0438\u0447\u0435\u043D\u043D\u044B\u043C \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435\u043C \u043F\u0440\u0438 \u043D\u0430\u0432\u0435\u0434\u0435\u043D\u0438\u0438 \u043A\u0443\u0440\u0441\u043E\u0440\u0430 \u043C\u044B\u0448\u0438 \u043D\u0430 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 \u0441 \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043C\u043E\u0439 \u0446\u0435\u043B\u0435\u0432\u043E\u0439 \u043A\u043B\u0430\u0432\u0438\u0448\u0435\u0439 (\u0435\u0441\u043B\u0438 \u043F\u0440\u0438\u043C\u0435\u043D\u0438\u043C\u043E).",
			"zh-CN": "\u5F53\u9F20\u6807\u60AC\u505C\u5728\u4E00\u4E2A\u56FE\u50CF\u4E0A\u65F6\uFF0C\u7528\u89E6\u53D1\u952E\uFF08\u5982\u679C\u9002\u7528\uFF09\u663E\u793A\u4E00\u4E2A\u5F39\u7A97"
		},
		"Mouseover popup trigger": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_trigger_behavior",
						"field": "name"
					}
				]
			},
			"en": "Popup trigger",
			"es": "Acci\u00F3n del popup al mover el rat\u00F3n encima",
			"fr": "D\u00E9clencheur du popup",
			"ko": "\uD31D\uC5C5 \uD2B8\uB9AC\uAC70",
			"pt-BR": "Gatilho do pop-up ao passar o mouse",
			"ru": "\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430 \u043F\u0440\u0438 \u043D\u0430\u0432\u0435\u0434\u0435\u043D\u0438\u0438 \u043C\u044B\u0448\u0438",
			"zh-CN": "\u9F20\u6807\u60AC\u505C\u5F39\u7A97\u89E6\u53D1\u5668"
		},
		"How the popup will get triggered": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_trigger_behavior",
						"field": "description"
					}
				]
			},
			"ko": "\uD31D\uC5C5 \uC791\uB3D9 \uBC29\uBC95",
			"pt-BR": "Como o pop-up ser\u00E1 acionado",
			"ru": "\u041A\u0430\u043A \u0431\u0443\u0434\u0435\u0442 \u0441\u0440\u0430\u0431\u0430\u0442\u044B\u0432\u0430\u0442\u044C \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E",
			"zh-CN": "\u5F39\u7A97\u89E6\u53D1\u65B9\u5F0F"
		},
		"Mouseover": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_trigger_behavior",
						"field": "options.mouse.name"
					}
				]
			},
			"es": "Mover rat\u00F3n encima",
			"ko": "\uB9C8\uC6B0\uC2A4",
			"pt-BR": "Ao passar o mouse",
			"ru": "\u041F\u0440\u0438 \u043D\u0430\u0432\u0435\u0434\u0435\u043D\u0438\u0435 \u043A\u0443\u0440\u0441\u043E\u0440\u0430 \u043C\u044B\u0448\u0438",
			"zh-CN": "\u9F20\u6807\u60AC\u505C"
		},
		"Triggers when your mouse is over the image": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_trigger_behavior",
						"field": "options.mouse.description"
					}
				]
			},
			"pt-BR": "Aciona quando o mouse est\u00E1 sobre a imagem",
			"ru": "\u0421\u0440\u0430\u0431\u0430\u0442\u044B\u0432\u0430\u0435\u0442 \u043F\u0440\u0438 \u043D\u0430\u0432\u0435\u0434\u0435\u043D\u0438\u0438 \u043A\u0443\u0440\u0441\u043E\u0440\u0430 \u043D\u0430 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0438",
			"zh-CN": "\u9F20\u6807\u5728\u56FE\u50CF\u4E0A\u60AC\u505C\u65F6\u89E6\u53D1"
		},
		"Key trigger": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_trigger_behavior",
						"field": "options.keyboard.name"
					}
				]
			},
			"es": "Tecla de acci\u00F3n",
			"ko": "\uD0A4 \uBC14\uC778\uB529",
			"pt-BR": "Tecla de gatilho",
			"ru": "\u041F\u0440\u0438 \u043D\u0430\u0436\u0430\u0442\u0438\u0438 \u043A\u043B\u0430\u0432\u0438\u0448\u0438",
			"zh-CN": "\u6309\u952E\u89E6\u53D1"
		},
		"Triggers when you press a key sequence when your mouse is over an image": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_trigger_behavior",
						"field": "options.keyboard.description"
					}
				]
			},
			"pt-BR": "Aciona ao pressionar uma sequ\u00EAncia de teclas quando o mouse est\u00E1 sobre uma imagem",
			"ru": "\u0421\u0440\u0430\u0431\u0430\u0442\u044B\u0432\u0430\u0435\u0442 \u043F\u0440\u0438 \u043D\u0430\u0436\u0430\u0442\u0438\u0438 \u043A\u043E\u043C\u0431\u0438\u043D\u0430\u0446\u0438\u0438 \u043A\u043B\u0430\u0432\u0438\u0448, \u043A\u043E\u0433\u0434\u0430 \u043A\u0443\u0440\u0441\u043E\u0440 \u043D\u0430\u0445\u043E\u0434\u0438\u0442\u0441\u044F \u043D\u0430 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0438.",
			"zh-CN": "\u5F53\u9F20\u6807\u5728\u56FE\u50CF\u4E0A\u60AC\u505C\u65F6\u6309\u6307\u5B9A\u952E\u89E6\u53D1"
		},
		"Disables the popup from being triggered (useful if you only want to use the context menu item)": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_trigger_behavior",
						"field": "options.none.description"
					}
				]
			},
			"pt-BR": "Desativa o acionamento do pop-up (\u00FAtil se voc\u00EA deseja usar apenas o item do menu de contexto)",
			"ru": "\u041E\u0442\u043A\u043B\u044E\u0447\u0430\u0435\u0442 \u0441\u0440\u0430\u0431\u0430\u0442\u044B\u0432\u0430\u043D\u0438\u0435 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430 (\u043F\u043E\u043B\u0435\u0437\u043D\u043E, \u0435\u0441\u043B\u0438 \u0432\u044B \u0445\u043E\u0442\u0438\u0442\u0435 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u0442\u043E\u043B\u044C\u043A\u043E \u043F\u0443\u043D\u043A\u0442 \u043A\u043E\u043D\u0442\u0435\u043A\u0441\u0442\u043D\u043E\u0433\u043E \u043C\u0435\u043D\u044E)",
			"zh-CN": "\u7981\u6B62\u89E6\u53D1\u5F39\u7A97\uFF08\u5982\u679C\u60A8\u53EA\u60F3\u4F7F\u7528\u53F3\u952E\u83DC\u5355\u9879\uFF0C\u5219\u6B64\u9009\u9879\u5F88\u5B9E\u7528\uFF09"
		},
		"Popup trigger key": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_trigger_key",
						"field": "name"
					}
				]
			},
			"es": "Tecla de acci\u00F3n del popup",
			"ko": "\uD31D\uC5C5 \uD0A4 \uBC14\uC778\uB529",
			"pt-BR": "Tecla de gatilho do pop-up",
			"ru": "\u041A\u043E\u043C\u0431\u0438\u043D\u0430\u0446\u0438\u044F \u043A\u043B\u0430\u0432\u0438\u0448 \u0437\u0430\u043F\u0443\u0441\u043A\u0430 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430",
			"zh-CN": "\u5F39\u7A97\u89E6\u53D1\u952E"
		},
		"Key sequence to trigger the popup": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_trigger_key",
						"field": "description"
					}
				]
			},
			"ko": "\uD31D\uC5C5\uC774 \uC791\uB3D9\uD558\uB294 \uD0A4",
			"pt-BR": "Sequ\u00EAncia de teclas para acionar o pop-up",
			"ru": "\u041A\u043E\u043C\u0431\u0438\u043D\u0430\u0446\u0438\u044F \u043A\u043B\u0430\u0432\u0438\u0448 \u043F\u0440\u0438 \u043A\u043E\u0442\u043E\u0440\u043E\u0439 \u0437\u0430\u043F\u0443\u0441\u043A\u0430\u0435\u0442\u0441\u044F \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E",
			"zh-CN": "\u89E6\u53D1\u5F39\u7A97\u7684\u6309\u952E\u5E8F\u5217"
		},
		"Popup trigger key (#2)": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_trigger_key_t2",
						"field": "name"
					}
				]
			},
			"pt-BR": "Tecla de gatilho do pop-up (#2)",
			"ru": "\u041A\u043E\u043C\u0431\u0438\u043D\u0430\u0446\u0438\u044F \u043A\u043B\u0430\u0432\u0438\u0448 \u0437\u0430\u043F\u0443\u0441\u043A\u0430 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430 (#2)",
			"zh-CN": "\u5F39\u7A97\u89E6\u53D1\u952E (#2)"
		},
		"Key sequence to trigger the popup with alternate options. Search for `(#2)` to find the relevant options": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_trigger_key_t2",
						"field": "description"
					}
				]
			},
			"pt-BR": "Sequ\u00EAncia de teclas para acionar o pop-up com op\u00E7\u00F5es alternativas. Procure por `(#2)` para encontrar as op\u00E7\u00F5es relevantes",
			"ru": "\u041A\u043E\u043C\u0431\u0438\u043D\u0430\u0446\u0438\u044F \u043A\u043B\u0430\u0432\u0438\u0448 \u043F\u0440\u0438 \u043A\u043E\u0442\u043E\u0440\u043E\u0439 \u0437\u0430\u043F\u0443\u0441\u043A\u0430\u0435\u0442\u0441\u044F \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u0441 \u0430\u043B\u044C\u0442\u0435\u0440\u043D\u0430\u0442\u0438\u0432\u043D\u044B\u043C\u0438 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u0430\u043C\u0438. \u0418\u0449\u0438\u0442\u0435 `(#2)`, \u0447\u0442\u043E\u0431\u044B \u043D\u0430\u0439\u0442\u0438 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044E\u0449\u0438\u0435 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B.",
			"zh-CN": "\u89E6\u53D1\u5F39\u7A97\u7684\u6309\u952E\u5E8F\u5217\uFF0C\u642D\u914D\u5907\u7528\u9009\u9879\u3002\u641C\u7D22\u201C(#2)\u201D\u627E\u5230\u76F8\u5173\u7684\u9009\u9879"
		},
		"Popup trigger key (#3)": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_trigger_key_t3",
						"field": "name"
					}
				]
			},
			"pt-BR": "Tecla de gatilho do pop-up (#3)",
			"ru": "\u041A\u043E\u043C\u0431\u0438\u043D\u0430\u0446\u0438\u044F \u043A\u043B\u0430\u0432\u0438\u0448 \u0437\u0430\u043F\u0443\u0441\u043A\u0430 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430 (#3)",
			"zh-CN": "\u5F39\u7A97\u89E6\u53D1\u952E (#3)"
		},
		"Key sequence to trigger the popup with alternate options. Search for `(#3)` to find the relevant options": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_trigger_key_t3",
						"field": "description"
					}
				]
			},
			"pt-BR": "Sequ\u00EAncia de teclas para acionar o pop-up com op\u00E7\u00F5es alternativas. Procure por `(#3)` para encontrar as op\u00E7\u00F5es relevantes",
			"ru": "\u041A\u043E\u043C\u0431\u0438\u043D\u0430\u0446\u0438\u044F \u043A\u043B\u0430\u0432\u0438\u0448 \u043F\u0440\u0438 \u043A\u043E\u0442\u043E\u0440\u043E\u0439 \u0437\u0430\u043F\u0443\u0441\u043A\u0430\u0435\u0442\u0441\u044F \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u0441 \u0430\u043B\u044C\u0442\u0435\u0440\u043D\u0430\u0442\u0438\u0432\u043D\u044B\u043C\u0438 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u0430\u043C\u0438. \u0418\u0449\u0438\u0442\u0435 `(#3)`, \u0447\u0442\u043E\u0431\u044B \u043D\u0430\u0439\u0442\u0438 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044E\u0449\u0438\u0435 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B.",
			"zh-CN": "\u89E6\u53D1\u5F39\u7A97\u7684\u6309\u952E\u5E8F\u5217\uFF0C\u642D\u914D\u5907\u7528\u9009\u9879\u3002\u641C\u7D22\u201C(#3)\u201D\u627E\u5230\u76F8\u5173\u7684\u9009\u9879"
		},
		"Popup trigger delay": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_trigger_delay",
						"field": "name"
					}
				]
			},
			"es": "Retraso de acci\u00F3n del popup",
			"ko": "\uD31D\uC5C5 \uC791\uC5C5 \uC9C0\uC5F0 \uC2DC\uAC04",
			"pt-BR": "Atraso no acionamento do pop-up",
			"ru": "\u0417\u0430\u0434\u0435\u0440\u0436\u043A\u0430 \u0441\u0440\u0430\u0431\u0430\u0442\u044B\u0432\u0430\u043D\u0438\u044F \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430",
			"zh-CN": "\u5F39\u7A97\u89E6\u53D1\u952E\u5EF6\u8FDF"
		},
		"Delay (in seconds) before the popup shows": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_trigger_delay",
						"field": "description"
					}
				]
			},
			"ko": "\uD31D\uC5C5\uC774 \uD45C\uC2DC\uB420 \uB54C\uAE4C\uC9C0 \uC9C0\uC5F0 (\uCD08)",
			"pt-BR": "Atraso (em segundos) antes da exibi\u00E7\u00E3o do pop-up",
			"ru": "\u0417\u0430\u0434\u0435\u0440\u0436\u043A\u0430 (\u0432 \u0441\u0435\u043A\u0443\u043D\u0434\u0430\u0445) \u0434\u043E \u043F\u043E\u044F\u0432\u043B\u0435\u043D\u0438\u044F \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430",
			"zh-CN": "\u5F39\u7A97\u663E\u793A\u524D\u5EF6\u8FDF\uFF08\u79D2\uFF09"
		},
		"Use mouseover event": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_trigger_mouseover",
						"field": "name"
					}
				]
			},
			"pt-BR": "Usar evento mouseover",
			"ru": "\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u0441\u043E\u0431\u044B\u0442\u0438\u0435 \u043D\u0430\u0432\u0435\u0434\u0435\u043D\u0438\u044F \u043A\u0443\u0440\u0441\u043E\u0440\u0430 \u043C\u044B\u0448\u0438",
			"zh-CN": "\u4F7F\u7528 mouseover \u4E8B\u4EF6"
		},
		"Uses the mouseover event instead of mousemove to figure out where to trigger the popup. This more closely matches the way other image popup addons work, at the cost of configurability": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_trigger_mouseover",
						"field": "description"
					}
				]
			},
			"pt-BR": "Usa o evento 'mouseover' em vez de 'mousemove' para determinar onde acionar o pop-up. Isso se assemelha mais ao funcionamento de outros complementos de pop-up de imagem, em detrimento da configurabilidade",
			"ru": "\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u0442 \u0441\u043E\u0431\u044B\u0442\u0438\u0435 '\u043D\u0430\u0432\u0435\u0434\u0435\u043D\u0438\u044F \u043A\u0443\u0440\u0441\u043E\u0440\u0430 \u043C\u044B\u0448\u0438' \u0432\u043C\u0435\u0441\u0442\u043E '\u0434\u0432\u0438\u0436\u0435\u043D\u0438\u044F \u043A\u0443\u0440\u0441\u043E\u0440\u0430 \u043C\u044B\u0448\u0438', \u0447\u0442\u043E\u0431\u044B \u0432\u044B\u044F\u0441\u043D\u0438\u0442\u044C, \u0433\u0434\u0435 \u0432\u044B\u0437\u0432\u0430\u0442\u044C \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E. \u042D\u0442\u043E \u0431\u043E\u043B\u0435\u0435 \u0442\u043E\u0447\u043D\u043E \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u043E\u043C\u0443, \u043A\u0430\u043A \u0440\u0430\u0431\u043E\u0442\u0430\u044E\u0442 \u0434\u0440\u0443\u0433\u0438\u0435 \u0434\u043E\u043F\u043E\u043B\u043D\u0435\u043D\u0438\u044F \u043A \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0438\u043C \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F\u043C, \u0437\u0430 \u0441\u0447\u0451\u0442 \u043A\u043E\u043D\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u0435\u043C\u043E\u0441\u0442\u0438/",
			"zh-CN": "\u4F7F\u7528 mouseover \u4E8B\u4EF6\u800C\u4E0D\u662F mousemove \u6765\u786E\u5B9A\u5728\u54EA\u91CC\u89E6\u53D1\u5F39\u7A97\u3002\u8FD9\u66F4\u63A5\u8FD1\u4E8E\u5176\u4ED6\u56FE\u50CF\u5F39\u7A97\u6269\u5C55\u7684\u8FD0\u4F5C\u65B9\u5F0F\uFF0C\u4EE3\u4EF7\u662F\u53EF\u914D\u7F6E\u6027"
		},
		"Enable/disable toggle": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_trigger_enabledisable_toggle",
						"field": "name"
					}
				]
			},
			"pt-BR": "Altern\u00E2ncia de ativar/desativar",
			"ru": "\u0412\u043A\u043B\u044E\u0447\u0438\u0442\u044C/\u0412\u044B\u043A\u043B\u044E\u0447\u0438\u0442\u044C",
			"zh-CN": "\u542F\u7528/\u7981\u7528\u5207\u6362\u5F00\u5173"
		},
		"Controls whether the 'Popup enable/disable key' will enable or disable the popup from opening": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_trigger_enabledisable_toggle",
						"field": "description"
					}
				]
			},
			"pt-BR": "Controla se a 'Tecla de ativar/desativar pop-up' ir\u00E1 ativar ou desativar a abertura do pop-up",
			"ru": "\u0423\u043F\u0440\u0430\u0432\u043B\u044F\u0435\u0442 \u0442\u0435\u043C, \u0431\u0443\u0434\u0435\u0442 \u043B\u0438 '\u041A\u043B\u0430\u0432\u0438\u0448\u0430 \u0432\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u044F/\u043E\u0442\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u044F \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430' \u0432\u043A\u043B\u044E\u0447\u0430\u0442\u044C \u0438\u043B\u0438 \u043E\u0442\u043A\u043B\u044E\u0447\u0430\u0442\u044C \u043E\u0442\u043A\u0440\u044B\u0442\u0438\u0435 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430.",
			"zh-CN": "\u63A7\u5236\u201C\u5F39\u7A97\u542F\u7528/\u7981\u7528\u952E\u201D\u662F\u5426\u63A7\u5236\u5F39\u7A97\u7684\u6253\u5F00"
		},
		"Enable": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_trigger_enabledisable_toggle",
						"field": "options.enable.name"
					}
				]
			},
			"pt-BR": "Ativar",
			"ru": "\u0412\u043A\u043B\u044E\u0447\u0438\u0442\u044C",
			"zh-CN": "\u542F\u7528"
		},
		"Disable": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_trigger_enabledisable_toggle",
						"field": "options.disable.name"
					}
				]
			},
			"pt-BR": "Desativar",
			"ru": "\u041E\u0442\u043A\u043B\u044E\u0447\u0438\u0442\u044C",
			"zh-CN": "\u7981\u7528"
		},
		"Popup enable/disable key": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_trigger_prevent_key",
						"field": "name"
					}
				]
			},
			"pt-BR": "Tecla de ativar/desativar pop-up",
			"ru": "\u041A\u043B\u0430\u0432\u0438\u0448\u0430 \u0432\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u044F/\u043E\u0442\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u044F \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430",
			"zh-CN": "\u5F39\u7A97\u542F\u7528/\u7981\u7528\u952E"
		},
		"Holding down this key will enable or disable the popup from being opened, depending on the 'Enable/disable toggle' setting": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_trigger_prevent_key",
						"field": "description"
					}
				]
			},
			"pt-BR": "Manter esta tecla pressionada ativar\u00E1 ou desativar\u00E1 a abertura do pop-up, dependendo da configura\u00E7\u00E3o 'Altern\u00E2ncia de ativar/desativar'",
			"ru": "\u0423\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u043D\u0438\u0435 \u044D\u0442\u043E\u0439 \u043A\u043B\u0430\u0432\u0438\u0448\u0438 \u0432\u043A\u043B\u044E\u0447\u0438\u0442 \u0438\u043B\u0438 \u043E\u0442\u043A\u043B\u044E\u0447\u0438\u0442 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043C\u043E\u0441\u0442\u0438 \u043E\u0442 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 '\u0412\u043A\u043B\u044E\u0447\u0438\u0442\u044C/\u0412\u044B\u043A\u043B\u044E\u0447\u0438\u0442\u044C'.",
			"zh-CN": "\u6309\u4F4F\u8FD9\u4E2A\u952E\u5C06\u542F\u7528/\u7981\u7528\u5F39\u7A97\u6253\u5F00\uFF0C\u5177\u4F53\u53D6\u51B3\u4E8E\u201C\u542F\u7528/\u7981\u7528\u5207\u6362\u5F00\u5173\u201D\u8BBE\u7F6E"
		},
		"Allow showing partially loaded": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_allow_partial",
						"field": "name"
					}
				]
			},
			"ko": "\uBD80\uBD84\uC801\uC73C\uB85C \uB85C\uB4DC\uB41C \uC0C1\uD0DC\uB85C \uD45C\uC2DC \uD5C8\uC6A9",
			"pt-BR": "Permitir exibi\u00E7\u00E3o de carregamento parcial",
			"ru": "\u0420\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044C \u043F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0442\u044C \u0447\u0430\u0441\u0442\u0438\u0447\u043D\u043E \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043D\u043D\u044B\u0435",
			"zh-CN": "\u5141\u8BB8\u663E\u793A\u90E8\u5206\u52A0\u8F7D\u7684\u5185\u5BB9"
		},
		"This will allow the popup to open for partially loaded media.\nPartially loaded media will contain the source URL directly (where possible), whereas fully loaded media will use a blob or data URL.": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_allow_partial",
						"field": "description"
					}
				]
			},
			"pt-BR": "Isso permitir\u00E1 que o popup seja aberto para m\u00EDdia parcialmente carregada.\nM\u00EDdia parcialmente carregada conter\u00E1 a URL de origem diretamente (quando poss\u00EDvel), enquanto m\u00EDdia totalmente carregada usar\u00E1 um blob ou data URL.",
			"ru": "\u042D\u0442\u043E \u043F\u043E\u0437\u0432\u043E\u043B\u0438\u0442 \u043E\u0442\u043A\u0440\u044B\u0442\u044C \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u0434\u043B\u044F \u0447\u0430\u0441\u0442\u0438\u0447\u043D\u043E \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043D\u043D\u044B\u0445 \u043C\u0435\u0434\u0438\u0430.\n\u0427\u0430\u0441\u0442\u0438\u0447\u043D\u043E \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043D\u043D\u044B\u0435 \u043C\u0435\u0434\u0438\u0430 \u0431\u0443\u0434\u0443\u0442 \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C \u0438\u0441\u0445\u043E\u0434\u043D\u044B\u0439 URL \u043D\u0430\u043F\u0440\u044F\u043C\u0443\u044E (\u0433\u0434\u0435 \u044D\u0442\u043E \u0432\u043E\u0437\u043C\u043E\u0436\u043D\u043E), \u0442\u043E\u0433\u0434\u0430 \u043A\u0430\u043A \u043F\u043E\u043B\u043D\u043E\u0441\u0442\u044C\u044E \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043D\u043D\u044B\u0435 \u043C\u0435\u0434\u0438\u0430 \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C BLOB \u0438\u043B\u0438 URL-\u0430\u0434\u0440\u0435\u0441 \u0434\u0430\u043D\u043D\u044B\u0445.",
			"zh-CN": "\u8FD9\u5C06\u5141\u8BB8\u4E3A\u90E8\u5206\u52A0\u8F7D\u7684\u5A92\u4F53\u6253\u5F00\u5F39\u7A97\u3002\n\u90E8\u5206\u52A0\u8F7D\u7684\u5A92\u4F53\u5C06\u76F4\u63A5\u5305\u542B\u6E90 URL\uFF08\u5982\u679C\u53EF\u80FD\uFF09\uFF0C\u800C\u5B8C\u5168\u52A0\u8F7D\u7684\u5A92\u4F53\u4F7F\u7528 blob \u6216\u6570\u636E URL\u3002"
		},
		"This will allow the popup to open for partially loaded media, but this might break images that require custom headers to display properly.\nPartially loaded media will contain the source URL directly (where possible), whereas fully loaded media will use a blob or data URL.": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_allow_partial",
						"field": "description_userscript"
					}
				]
			},
			"pt-BR": "Isso permitir\u00E1 que o popup seja aberto para m\u00EDdia parcialmente carregada, mas pode quebrar imagens que exigem cabe\u00E7alhos personalizados para serem exibidas corretamente.\nM\u00EDdia parcialmente carregada conter\u00E1 a URL de origem diretamente (quando poss\u00EDvel), enquanto m\u00EDdia totalmente carregada usar\u00E1 um blob ou data URL.",
			"ru": "\u042D\u0442\u043E \u043F\u043E\u0437\u0432\u043E\u043B\u0438\u0442 \u043E\u0442\u043A\u0440\u044B\u0442\u044C \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u0434\u043B\u044F \u0447\u0430\u0441\u0442\u0438\u0447\u043D\u043E \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043D\u043D\u044B\u0445 \u043C\u0435\u0434\u0438\u0430, \u043D\u043E \u044D\u0442\u043E \u043C\u043E\u0436\u0435\u0442 \u043F\u043E\u043B\u043E\u043C\u0430\u0442\u044C \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F, \u0434\u043B\u044F \u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u043E\u0433\u043E \u043E\u0442\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F \u043A\u043E\u0442\u043E\u0440\u044B\u0445 \u0442\u0440\u0435\u0431\u0443\u044E\u0442\u0441\u044F \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u0438\u0435 \u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043A\u0438.\n\u0427\u0430\u0441\u0442\u0438\u0447\u043D\u043E \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043D\u043D\u044B\u0435 \u043C\u0435\u0434\u0438\u0430 \u0431\u0443\u0434\u0443\u0442 \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C \u0438\u0441\u0445\u043E\u0434\u043D\u044B\u0439 URL-\u0430\u0434\u0440\u0435\u0441 \u043D\u0430\u043F\u0440\u044F\u043C\u0443\u044E (\u0433\u0434\u0435 \u044D\u0442\u043E \u0432\u043E\u0437\u043C\u043E\u0436\u043D\u043E), \u0442\u043E\u0433\u0434\u0430 \u043A\u0430\u043A \u043F\u043E\u043B\u043D\u043E\u0441\u0442\u044C\u044E \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043D\u043D\u044B\u0435 \u043C\u0435\u0434\u0438\u0430 \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C BLOB \u0438\u043B\u0438 URL-\u0430\u0434\u0440\u0435\u0441 \u0434\u0430\u043D\u043D\u044B\u0445.",
			"zh-CN": "\u8FD9\u5C06\u5141\u8BB8\u4E3A\u90E8\u5206\u52A0\u8F7D\u7684\u5A92\u4F53\u6253\u5F00\u5F39\u7A97\uFF0C\u4F46\u8FD9\u53EF\u80FD\u5BFC\u81F4\u9700\u8981\u81EA\u5B9A\u4E49\u6807\u5934\u624D\u80FD\u6B63\u786E\u663E\u793A\u7684\u56FE\u50CF\u51FA\u9519\u3002\n\u90E8\u5206\u52A0\u8F7D\u7684\u5A92\u4F53\u5C06\u76F4\u63A5\u5305\u542B\u6E90 URL\uFF08\u5982\u679C\u53EF\u80FD\uFF09\uFF0C\u800C\u5B8C\u5168\u52A0\u8F7D\u7684\u5A92\u4F53\u4F7F\u7528 blob \u6216\u6570\u636E URL\u3002"
		},
		"Streams": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_allow_partial",
						"field": "options.video.name"
					}
				]
			},
			"pt-BR": "Transmiss\u00F5es",
			"ru": "\u041F\u043E\u0442\u043E\u043A\u0438",
			"zh-CN": "\u6570\u636E\u6D41"
		},
		"Audio and video": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_allow_partial",
						"field": "options.video.description"
					}
				]
			},
			"pt-BR": "\u00C1udio e v\u00EDdeo",
			"ru": "\u0410\u0443\u0434\u0438\u043E \u0438 \u0432\u0438\u0434\u0435\u043E",
			"zh-CN": "\u97F3\u9891\u548C\u89C6\u9891"
		},
		"Media": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_allow_partial",
						"field": "options.media.name"
					}
				]
			},
			"es": "Medios",
			"ko": "\uBBF8\uB514\uC5B4",
			"pt-BR": "M\u00EDdia",
			"ru": "\u041C\u0435\u0434\u0438\u0430",
			"zh-CN": "\u591A\u5A92\u4F53"
		},
		"Images, audio, and video": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_allow_partial",
						"field": "options.media.description"
					}
				]
			},
			"pt-BR": "Imagens, \u00E1udio e v\u00EDdeo",
			"ru": "\u0418\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F, \u0430\u0443\u0434\u0438\u043E \u0438 \u0432\u0438\u0434\u0435\u043E",
			"zh-CN": "\u56FE\u50CF\u3001\u97F3\u9891\u548C\u89C6\u9891"
		},
		"Avoid HEAD request for partially loaded media": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_partial_avoid_head",
						"field": "name"
					}
				]
			},
			"pt-BR": "Evitar requisi\u00E7\u00E3o HEAD para m\u00EDdia parcialmente carregada",
			"ru": "\u0418\u0437\u0431\u0435\u0433\u0430\u0442\u044C \u0437\u0430\u043F\u0440\u043E\u0441\u044B HEAD \u0434\u043B\u044F \u0447\u0430\u0441\u0442\u0438\u0447\u043D\u043E \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043D\u043D\u044B\u0445 \u043C\u0435\u0434\u0438\u0430",
			"zh-CN": "\u907F\u514D\u5BF9\u5DF2\u90E8\u5206\u52A0\u8F7D\u7684\u5A92\u4F53\u53D1\u51FA HEAD \u8BF7\u6C42"
		},
		"Avoids a possibly unnecessary HEAD request before displaying partially loaded images, which further decreases the delay before opening the popup. This can cause issues if the server returns an error, but still returns an image": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_partial_avoid_head",
						"field": "description"
					}
				]
			},
			"pt-BR": "Evita uma requisi\u00E7\u00E3o HEAD possivelmente desnecess\u00E1ria antes de exibir imagens parcialmente carregadas, o que diminui ainda mais o atraso antes de abrir o pop-up. Isso pode causar problemas se o servidor retornar um erro, mas ainda assim retornar uma imagem",
			"ru": "\u0418\u0437\u0431\u0435\u0433\u0430\u0435\u0442 \u043D\u0435\u043D\u0443\u0436\u043D\u043E\u0433\u043E \u0437\u0430\u043F\u0440\u043E\u0441\u0430 HEAD \u043F\u0435\u0440\u0435\u0434 \u043E\u0442\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435\u043C \u0447\u0430\u0441\u0442\u0438\u0447\u043D\u043E \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043D\u043D\u044B\u0445 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0439, \u0447\u0442\u043E \u0435\u0449\u0435 \u0431\u043E\u043B\u044C\u0448\u0435 \u0443\u043C\u0435\u043D\u044C\u0448\u0430\u0435\u0442 \u0437\u0430\u0434\u0435\u0440\u0436\u043A\u0443 \u043F\u0435\u0440\u0435\u0434 \u043E\u0442\u043A\u0440\u044B\u0442\u0438\u0435\u043C \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430. \u042D\u0442\u043E \u043C\u043E\u0436\u0435\u0442 \u0432\u044B\u0437\u0432\u0430\u0442\u044C \u043F\u0440\u043E\u0431\u043B\u0435\u043C\u044B, \u0435\u0441\u043B\u0438 \u0441\u0435\u0440\u0432\u0435\u0440 \u0432\u0435\u0440\u043D\u0451\u0442 \u043E\u0448\u0438\u0431\u043A\u0443, \u043D\u043E \u0432\u0441\u0435 \u0440\u0430\u0432\u043D\u043E \u0432\u0435\u0440\u043D\u0435\u0442 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435.",
			"zh-CN": "\u663E\u793A\u5DF2\u90E8\u5206\u52A0\u8F7D\u7684\u5A92\u4F53\u65F6\u907F\u514D\u53EF\u80FD\u4E0D\u5FC5\u8981\u7684 HEAD \u8BF7\u6C42\uFF0C\u8FD9\u80FD\u8FDB\u4E00\u6B65\u51CF\u5C11\u6253\u5F00\u5F39\u7A97\u7684\u5EF6\u8FDF\u3002\u4F46\u5982\u679C\u670D\u52A1\u5668\u8FD4\u56DE\u4E00\u4E2A\u9519\u8BEF\u7684\u540C\u65F6\u4E5F\u8FD4\u56DE\u4E86\u4E00\u4E2A\u56FE\u50CF\uFF0C\u8FD9\u53EF\u80FD\u4F1A\u5BFC\u81F4\u95EE\u9898"
		},
		"Use `blob:` over `data:` URLs": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_use_blob_over_data",
						"field": "name"
					}
				]
			},
			"pt-BR": "Use `blob:` em vez de URLs `data:`",
			"ru": "\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C `blob:` \u043F\u043E\u0432\u0435\u0440\u0445 `data:` URL",
			"zh-CN": "\u4F7F\u7528 blob: \u4EE3\u66FF data: URL"
		},
		"Blob URLs are more efficient, but aren't supported by earlier browsers. Some websites also block `blob:` URLs": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_use_blob_over_data",
						"field": "description"
					}
				]
			},
			"pt-BR": "URLs Blob s\u00E3o mais eficientes, mas n\u00E3o s\u00E3o suportadas por navegadores mais antigos. Alguns sites tamb\u00E9m bloqueiam URLs `blob:`",
			"ru": "Blob URL \u0431\u043E\u043B\u0435\u0435 \u044D\u0444\u0444\u0435\u043A\u0442\u0438\u0432\u043D\u044B, \u043D\u043E \u043D\u0435 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044E\u0442\u0441\u044F \u0441\u0442\u0430\u0440\u044B\u043C\u0438 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430\u043C\u0438. \u041D\u0435\u043A\u043E\u0442\u043E\u0440\u044B\u0435 \u0441\u0430\u0439\u0442\u044B \u0442\u0430\u043A\u0436\u0435 \u0431\u043B\u043E\u043A\u0438\u0440\u0443\u044E\u0442 `blob:` URL.",
			"zh-CN": "Blob URL \u6548\u7387\u66F4\u4F73\uFF0C\u4F46\u65E9\u671F\u7248\u672C\u7684\u6D4F\u89C8\u5668\u4E0D\u652F\u6301\u3002\u4E00\u4E9B\u7F51\u7AD9\u4E5F\u5C4F\u853D\u4E86 Blob: URL"
		},
		"Load media anonymously": {
			"_info": {
				"instances": [
					{
						"setting": "popup_use_anonymous_crossorigin",
						"field": "name"
					}
				]
			},
			"pt-BR": "Carregar m\u00EDdia anonimamente",
			"ru": "\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044C \u043C\u0435\u0434\u0438\u0430 \u0430\u043D\u043E\u043D\u0438\u043C\u043D\u043E",
			"zh-CN": "\u533F\u540D\u52A0\u8F7D\u5A92\u4F53"
		},
		"Loads the media without sending any cookies or other forms of credentials. This is required to screenshot videos from other sources": {
			"_info": {
				"instances": [
					{
						"setting": "popup_use_anonymous_crossorigin",
						"field": "description"
					}
				]
			},
			"pt-BR": "Carrega a m\u00EDdia sem enviar cookies ou outras formas de credenciais. Isso \u00E9 necess\u00E1rio para capturar v\u00EDdeos de outras fontes",
			"ru": "\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u043C\u0435\u0434\u0438\u0430 \u0431\u0435\u0437 \u043E\u0442\u043F\u0440\u0430\u0432\u043A\u0438 \u043A\u0443\u043A\u0438-\u0444\u0430\u0439\u043B\u043E\u0432 \u0438\u043B\u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u0444\u043E\u0440\u043C \u0443\u0447\u0451\u0442\u043D\u044B\u0445 \u0434\u0430\u043D\u043D\u044B\u0445. \u042D\u0442\u043E \u043D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u043E \u0434\u043B\u044F \u0441\u043A\u0440\u0438\u043D\u0448\u043E\u0442\u043E\u0432 \u0432\u0438\u0434\u0435\u043E \u0438\u0437 \u0434\u0440\u0443\u0433\u0438\u0445 \u0438\u0441\u0442\u043E\u0447\u043D\u0438\u043A\u043E\u0432.",
			"zh-CN": "\u52A0\u8F7D\u5A92\u4F53\u800C\u4E0D\u53D1\u9001\u4EFB\u4F55 Cookie \u6216\u5176\u4ED6\u5F62\u5F0F\u7684\u51ED\u636E\u3002\u8FD9\u9700\u8981\u6709\u5176\u4ED6\u6765\u6E90\u7684\u89C6\u9891\u622A\u56FE"
		},
		"Use `not-allowed` cursor when unsupported": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_enable_notallowed",
						"field": "name"
					}
				]
			},
			"ko": "\uC9C0\uC6D0\uB418\uC9C0 \uC54A\uC744 \uB54C \uD5C8\uC6A9\uB418\uC9C0 \uC54A\uB294 \uCEE4\uC11C\uB97C \uC0AC\uC6A9",
			"pt-BR": "Usar cursor `not-allowed` quando n\u00E3o for suportado",
			"ru": "\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u043A\u0443\u0440\u0441\u043E\u0440 `\u0437\u0430\u043F\u0440\u0435\u0449\u0435\u043D\u043E`, \u0435\u0441\u043B\u0438 \u043D\u0435 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044F",
			"zh-CN": "\u4E0D\u652F\u6301\u65F6\u7ED9\u51FA\u9F20\u6807\u6307\u9488\u201C\u7981\u6B62\u201D"
		},
		"If the image isn't supported, the mouse cursor will change to a `not-allowed` cursor for a brief duration": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_enable_notallowed",
						"field": "description"
					}
				]
			},
			"ko": "\uC774\uBBF8\uC9C0\uAC00 \uC9C0\uC6D0\uB418\uC9C0 \uC54A\uC73C\uBA74 \uB9C8\uC6B0\uC2A4 \uCEE4\uC11C\uAC00 \uC7A0\uC2DC \uB3D9\uC548 \uD5C8\uC6A9\uB418\uC9C0 \uC54A\uB294 \uCEE4\uC11C\uB85C \uBCC0\uACBD\uB428",
			"pt-BR": "Se a imagem n\u00E3o for suportada, o cursor do mouse mudar\u00E1 para um cursor `not-allowed` por um breve per\u00EDodo",
			"ru": "\u0415\u0441\u043B\u0438 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 \u043D\u0435 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044F, \u043A\u0443\u0440\u0441\u043E\u0440 \u043C\u044B\u0448\u0438 \u043D\u0430 \u043A\u043E\u0440\u043E\u0442\u043A\u043E\u0435 \u0432\u0440\u0435\u043C\u044F \u0438\u0437\u043C\u0435\u043D\u0438\u0442\u0441\u044F \u043D\u0430 `\u0437\u0430\u043F\u0440\u0435\u0449\u0435\u043D\u043E`.",
			"zh-CN": "\u5982\u679C\u9047\u5230\u4E0D\u652F\u6301\u7684\u56FE\u50CF\uFF0C\u9F20\u6807\u6307\u9488\u5C06\u6682\u65F6\u53D8\u4E3A\u201C\u7981\u6B62\u201D\u56FE\u6848"
		},
		"Use `not-allowed` cursor when unable to load": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_enable_notallowed_cant_load",
						"field": "name"
					}
				]
			},
			"pt-BR": "Usar cursor `not-allowed` quando n\u00E3o for poss\u00EDvel carregar",
			"ru": "\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u043A\u0443\u0440\u0441\u043E\u0440 `\u0437\u0430\u043F\u0440\u0435\u0449\u0435\u043D\u043E`, \u0435\u0441\u043B\u0438 \u043D\u0435\u0432\u043E\u0437\u043C\u043E\u0436\u043D\u043E \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C",
			"zh-CN": "\u65E0\u6CD5\u52A0\u8F7D\u65F6\u7ED9\u51FA\u9F20\u6807\u6307\u9488\u201C\u7981\u6B62\u201D"
		},
		"If the image fails to load, the mouse cursor will change to a `not-allowed` cursor for a brief duration": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_enable_notallowed_cant_load",
						"field": "description"
					}
				]
			},
			"ko": "\uC774\uBBF8\uC9C0\uB97C \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC73C\uBA74 \uB9C8\uC6B0\uC2A4 \uCEE4\uC11C\uAC00 \uC7A0\uC2DC \uB3D9\uC548 \uD5C8\uC6A9\uB418\uC9C0 \uC54A\uB294 \uCEE4\uC11C\uB85C \uBCC0\uACBD\uB428",
			"pt-BR": "Se a imagem n\u00E3o carregar, o cursor do mouse mudar\u00E1 para um cursor `not-allowed` por um breve per\u00EDodo",
			"ru": "\u0415\u0441\u043B\u0438 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 \u043D\u0435 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442\u0441\u044F, \u043A\u0443\u0440\u0441\u043E\u0440 \u043C\u044B\u0448\u0438 \u043D\u0430 \u043A\u043E\u0440\u043E\u0442\u043A\u043E\u0435 \u0432\u0440\u0435\u043C\u044F \u0438\u0437\u043C\u0435\u043D\u0438\u0442\u0441\u044F \u043D\u0430 `\u0437\u0430\u043F\u0440\u0435\u0449\u0435\u043D\u043E`.",
			"zh-CN": "\u5982\u679C\u56FE\u50CF\u4E0B\u8F7D\u5931\u8D25\uFF0C\u9F20\u6807\u6307\u9488\u5C06\u6682\u65F6\u53D8\u4E3A\u201C\u7981\u6B62\u201D\u56FE\u6848"
		},
		"`not-allowed` cursor duration": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_notallowed_duration",
						"field": "name"
					}
				]
			},
			"pt-BR": "Dura\u00E7\u00E3o do cursor `not-allowed`",
			"ru": "\u0414\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C \u043A\u0443\u0440\u0441\u043E\u0440\u0430 `\u0437\u0430\u043F\u0440\u0435\u0449\u0435\u043D\u043E`",
			"zh-CN": "\u201C\u7981\u6B62\u201D\u6307\u9488\u6301\u7EED\u65F6\u95F4"
		},
		"How long the `not-allowed` cursor should last": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_notallowed_duration",
						"field": "description"
					}
				]
			},
			"pt-BR": "Tempo de dura\u00E7\u00E3o do cursor `not-allowed`",
			"ru": "\u041A\u0430\u043A \u0434\u043E\u043B\u0433\u043E \u043E\u0442\u043E\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044F \u043A\u0443\u0440\u0441\u043E\u0440 `\u0437\u0430\u043F\u0440\u0435\u0449\u0435\u043D\u043E`",
			"zh-CN": "\u201C\u7981\u6B62\u201D\u6307\u9488\u7684\u663E\u793A\u6301\u7EED\u591A\u4E45"
		},
		"Exclude image tabs": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_exclude_imagetab",
						"field": "name"
					}
				]
			},
			"ko": "\uC774\uBBF8\uC9C0 \uD0ED \uC81C\uC678",
			"pt-BR": "Excluir abas de imagens",
			"ru": "\u0418\u0441\u043A\u043B\u044E\u0447\u0430\u0442\u044C \u0432\u043A\u043B\u0430\u0434\u043A\u0438 \u0441 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F\u043C\u0438",
			"zh-CN": "\u6392\u9664\u56FE\u50CF\u6807\u7B7E\u9875"
		},
		"Excludes images that are opened in their own tabs": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_exclude_imagetab",
						"field": "description"
					}
				]
			},
			"ko": "\uC790\uC2E0\uC758 \uD0ED\uC5D0\uC11C \uC5F4\uB9B0 \uC774\uBBF8\uC9C0 \uC81C\uC678",
			"pt-BR": "Exclui imagens que s\u00E3o abertas em suas pr\u00F3prias abas",
			"ru": "\u0418\u0441\u043A\u043B\u044E\u0447\u0430\u0435\u0442 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F, \u043E\u0442\u043A\u0440\u044B\u0442\u044B\u0435 \u0432 \u0441\u043E\u0431\u0441\u0442\u0432\u0435\u043D\u043D\u044B\u0445 \u0432\u043A\u043B\u0430\u0434\u043A\u0430\u0445.",
			"zh-CN": "\u6392\u9664\u5728\u5355\u72EC\u7684\u6807\u7B7E\u9875\u4E2D\u6253\u5F00\u7684\u56FE\u50CF"
		},
		"Exclude if media URL is unchanged": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_exclude_sameimage",
						"field": "name"
					}
				]
			},
			"pt-BR": "Excluir se a URL da m\u00EDdia n\u00E3o for alterada",
			"ru": "\u0418\u0441\u043A\u043B\u044E\u0447\u0430\u0442\u044C, \u0435\u0441\u043B\u0438 \u0441\u0441\u044B\u043B\u043A\u0430 \u043C\u0435\u0434\u0438\u0430 \u043D\u0435 \u0438\u0437\u043C\u0435\u043D\u0438\u043B\u0430\u0441\u044C",
			"zh-CN": "\u6392\u9664\u65E0\u53D8\u5316\u7684\u5A92\u4F53 URL"
		},
		"Don't pop up if the new URL is the same as the source": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_exclude_sameimage",
						"field": "description"
					}
				]
			},
			"pt-BR": "N\u00E3o exibir pop-up se a nova URL for igual \u00E0 fonte",
			"ru": "\u0412\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u043D\u0435 \u043F\u043E\u044F\u0432\u043B\u044F\u0435\u0442\u0441\u044F, \u0435\u0441\u043B\u0438 \u0441\u0441\u044B\u043B\u043A\u0430 \u043A\u0430\u043A \u0443 \u0438\u0441\u0442\u043E\u0447\u043D\u0438\u043A\u0430.",
			"zh-CN": "\u5982\u679C\u65B0 URL \u4E0E\u6E90 URL \u76F8\u540C\u5219\u4E0D\u5F39\u51FA"
		},
		"Only popup for linked media": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_only_links",
						"field": "name"
					}
				]
			},
			"pt-BR": "Pop-up apenas para m\u00EDdia com link",
			"ru": "\u0412\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u0442\u043E\u043B\u044C\u043A\u043E \u0434\u043B\u044F \u043C\u0435\u0434\u0438\u0430 \u0441 \u0441\u0441\u044B\u043B\u043A\u043E\u0439",
			"zh-CN": "\u4EC5\u5F39\u51FA\u94FE\u63A5\u5F62\u5F0F\u7684\u5A92\u4F53"
		},
		"Don't pop up if the media isn't hyperlinked": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_only_links",
						"field": "description"
					}
				]
			},
			"pt-BR": "N\u00E3o exibir pop-up se a m\u00EDdia n\u00E3o tiver um hiperlink",
			"ru": "\u0412\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u043D\u0435 \u043F\u043E\u044F\u0432\u043B\u044F\u0435\u0442\u0441\u044F, \u0435\u0441\u043B\u0438 \u043C\u0435\u0434\u0438\u0430 \u043D\u0435 \u0438\u043C\u0435\u0435\u0442 \u0433\u0438\u043F\u0435\u0440\u0441\u0441\u044B\u043B\u043A\u0438",
			"zh-CN": "\u4E0D\u5F39\u51FA\u975E\u8D85\u94FE\u63A5\u5F62\u5F0F\u7684\u5A92\u4F53"
		},
		"Popup link for linked media": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_linked_image",
						"field": "name"
					}
				]
			},
			"pt-BR": "Link em pop-up para m\u00EDdia com link",
			"ru": "\u0412\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u0441\u0441\u044B\u043B\u043A\u0438 \u0434\u043B\u044F \u043C\u0435\u0434\u0438\u0430 \u0441 \u0441\u0441\u044B\u043B\u043A\u0430\u043C\u0438",
			"zh-CN": "\u94FE\u63A5\u7684\u5A92\u4F53\u5F39\u7A97\u94FE\u63A5"
		},
		"If the linked media cannot be made larger, pop up for the link instead of the media": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_linked_image",
						"field": "description"
					}
				]
			},
			"pt-BR": "Se a m\u00EDdia com link n\u00E3o puder ser ampliada, exibir o link em um pop-up em vez da m\u00EDdia",
			"ru": "\u0415\u0441\u043B\u0438 \u043C\u0435\u0434\u0438\u0430 \u0441 \u0441\u0441\u044B\u043B\u043A\u043E\u0439 \u043D\u0435 \u043C\u043E\u0436\u0435\u0442 \u0431\u044B\u0442\u044C \u0443\u0432\u0435\u043B\u0438\u0447\u0435\u043D\u043E, \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u0435\u0442 \u0441\u0441\u044B\u043B\u043A\u0430 \u0432\u043C\u0435\u0441\u0442\u043E \u043C\u0435\u0434\u0438\u0430.",
			"zh-CN": "\u5982\u679C\u94FE\u63A5\u7684\u5A92\u4F53\u4E0D\u80FD\u53D8\u5927\uFF0C\u5F39\u51FA\u8BE5\u94FE\u63A5\u800C\u975E\u5A92\u4F53"
		},
		"Exclude image maps": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_exclude_imagemaps",
						"field": "name"
					}
				]
			},
			"ko": "\uC774\uBBF8\uC9C0 \uB9F5 \uC81C\uC678",
			"pt-BR": "Excluir mapas de imagem",
			"ru": "\u0418\u0441\u043A\u043B\u044E\u0447\u0430\u0442\u044C \u043A\u0430\u0440\u0442\u044B \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0439",
			"zh-CN": "\u6392\u9664\u56FE\u50CF\u96C6"
		},
		"Don't pop up if the image is an image map (image with multiple clickable areas)": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_exclude_imagemaps",
						"field": "description"
					}
				]
			},
			"ko": "\uC774\uBBF8\uC9C0\uAC00 \uC774\uBBF8\uC9C0 \uB9F5(\uD074\uB9AD \uAC00\uB2A5\uD55C \uC601\uC5ED\uC774 \uC5EC\uB7EC \uAC1C\uB97C \uAC00\uC9C4 \uC774\uBBF8\uC9C0)\uC778 \uACBD\uC6B0 \uD31D\uC5C5 \uD45C\uC2DC \uC548 \uD568",
			"pt-BR": "N\u00E3o exibir pop-up se a imagem for um mapa de imagem (imagem com v\u00E1rias \u00E1reas clic\u00E1veis)",
			"ru": "\u0412\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u043D\u0435 \u043F\u043E\u044F\u0432\u0438\u0442\u0441\u044F, \u0435\u0441\u043B\u0438 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 \u043F\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043B\u044F\u0435\u0442 \u0441\u043E\u0431\u043E\u0439 \u043A\u0430\u0440\u0442\u0443 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F (\u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 \u0441 \u043D\u0435\u0441\u043A\u043E\u043B\u044C\u043A\u0438\u043C\u0438 \u043A\u043B\u0438\u043A\u0430\u043B\u044C\u043D\u044B\u043C\u0438 \u043E\u0431\u043B\u0430\u0441\u0442\u044F\u043C\u0438).",
			"zh-CN": "\u4E0D\u5F39\u51FA\u6709\u591A\u4E2A\u53EF\u70B9\u51FB\u533A\u57DF\u7684\u56FE\u50CF\u96C6\uFF08image map\uFF09"
		},
		"Autoplay": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_autoplay",
						"field": "name"
					}
				]
			},
			"pt-BR": "Reprodu\u00E7\u00E3o autom\u00E1tica",
			"ru": "\u0410\u0432\u0442\u043E\u0432\u043E\u0441\u043F\u0440\u043E\u0438\u0437\u0432\u0435\u0434\u0435\u043D\u0438\u0435",
			"zh-CN": "\u81EA\u52A8\u64AD\u653E"
		},
		"Play automatically once the popup is opened": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_autoplay",
						"field": "description"
					}
				]
			},
			"pt-BR": "Reproduzir automaticamente quando o pop-up for aberto",
			"ru": "\u0410\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0438 \u0432\u043E\u0441\u043F\u0440\u043E\u0438\u0437\u0432\u043E\u0434\u0438\u0442\u0441\u044F \u043F\u043E\u0441\u043B\u0435 \u043E\u0442\u043A\u0440\u044B\u0442\u0438\u044F \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430.",
			"zh-CN": "\u5F39\u7A97\u6253\u5F00\u540E\u81EA\u52A8\u64AD\u653E"
		},
		"Show video controls": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_controls",
						"field": "name"
					}
				]
			},
			"pt-BR": "Exibir controles de v\u00EDdeo",
			"ru": "\u041F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0442\u044C \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B \u0443\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u044F \u0432\u0438\u0434\u0435\u043E",
			"zh-CN": "\u663E\u793A\u89C6\u9891\u63A7\u4EF6"
		},
		"Shows native video controls. Note that this prevents dragging under Firefox": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_controls",
						"field": "description"
					}
				]
			},
			"pt-BR": "Exibe os controles nativos de v\u00EDdeo. Observe que isso impede o arrastar no Firefox",
			"ru": "\u041F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0435\u0442 \u0432\u0441\u0442\u0440\u043E\u0435\u043D\u043D\u044B\u0435 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u0443\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u044F \u0432\u0438\u0434\u0435\u043E. \u041E\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043D\u0438\u043C\u0430\u043D\u0438\u0435, \u0447\u0442\u043E \u044D\u0442\u043E \u043F\u0440\u0435\u0434\u043E\u0442\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043F\u0435\u0440\u0435\u0442\u0430\u0441\u043A\u0438\u0432\u0430\u043D\u0438\u0435 \u043F\u043E\u0434 Firefox.",
			"zh-CN": "\u663E\u793A\u539F\u751F\u89C6\u9891\u63A7\u4EF6\uFF08\u89C6\u9891\u63A7\u5236\u6309\u94AE\uFF09\u3002\u6CE8\u610F\uFF0C\u8FD9\u4F1A\u963B\u6B62\u5728 Firefox \u4E2D\u62D6\u62FD"
		},
		"Toggle video controls": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_controls_key",
						"field": "name"
					}
				]
			},
			"pt-BR": "Alternar controles de v\u00EDdeo",
			"ru": "\u041F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0430\u0442\u0435\u043B\u044C \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432 \u0443\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u044F \u0432\u0438\u0434\u0435\u043E",
			"zh-CN": "\u5207\u6362\u89C6\u9891\u63A7\u4EF6"
		},
		"Key to toggle whether the video controls are shown": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_controls_key",
						"field": "description"
					}
				]
			},
			"pt-BR": "Tecla para alternar a exibi\u00E7\u00E3o dos controles de v\u00EDdeo",
			"ru": "\u041A\u043B\u0430\u0432\u0438\u0448\u0430 \u0434\u043B\u044F \u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u044F \u043E\u0442\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432 \u0443\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u044F \u0432\u0438\u0434\u0435\u043E",
			"zh-CN": "\u5207\u6362\u662F\u5426\u663E\u793A\u89C6\u9891\u63A7\u4EF6\u7684\u6309\u952E"
		},
		"Loop": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_loop",
						"field": "name"
					}
				]
			},
			"pt-BR": "Repetir",
			"ru": "\u0417\u0430\u0446\u0438\u043A\u043B\u0438\u0442\u044C",
			"zh-CN": "\u5FAA\u73AF"
		},
		"Allows the media to automatically restart to the beginning after finishing playing": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_loop",
						"field": "description"
					}
				]
			},
			"pt-BR": "Permite que a m\u00EDdia seja reiniciada automaticamente ap\u00F3s o t\u00E9rmino da reprodu\u00E7\u00E3o",
			"ru": "\u041F\u043E\u0437\u0432\u043E\u043B\u044F\u0435\u0442 \u043C\u0435\u0434\u0438\u0430 \u0430\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0438 \u043F\u0435\u0440\u0435\u0437\u0430\u043F\u0443\u0441\u043A\u0430\u0442\u044C\u0441\u044F \u0432 \u043D\u0430\u0447\u0430\u043B\u043E \u043F\u043E\u0441\u043B\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043D\u0438\u044F \u0432\u043E\u0441\u043F\u0440\u043E\u0438\u0437\u0432\u0435\u0434\u0435\u043D\u0438\u044F.",
			"zh-CN": "\u662F\u5426\u5141\u8BB8\u5A92\u4F53\u64AD\u653E\u5B8C\u6BD5\u540E\u81EA\u52A8\u91CD\u65B0\u5F00\u59CB\u64AD\u653E"
		},
		"Max duration for looping": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_autoloop_max",
						"field": "name"
					}
				]
			},
			"pt-BR": "Dura\u00E7\u00E3o m\u00E1xima para repeti\u00E7\u00E3o",
			"ru": "\u041C\u0430\u043A\u0441\u0438\u043C\u0430\u043B\u044C\u043D\u0430\u044F \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C \u0437\u0430\u0446\u0438\u043A\u043B\u0438\u0432\u0430\u043D\u0438\u044F",
			"zh-CN": "\u5FAA\u73AF\u6700\u957F\u6301\u7EED\u65F6\u95F4"
		},
		"Media longer than the specified duration will not be automatically looped. Setting this to `0` will always enable looping, regardless of duration.": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_autoloop_max",
						"field": "description"
					}
				]
			},
			"pt-BR": "M\u00EDdias com dura\u00E7\u00E3o maior que a especificada n\u00E3o ser\u00E3o repetidas automaticamente. Definir como `0` sempre habilitar\u00E1 a repeti\u00E7\u00E3o, independentemente da dura\u00E7\u00E3o.",
			"ru": "\u041C\u0435\u0434\u0438\u0430 \u0441 \u0434\u043E\u043B\u044C\u0448\u0435\u0439 \u0443\u043A\u0430\u0437\u0430\u043D\u043D\u043E\u0439 \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C\u044E \u043D\u0435 \u0431\u0443\u0434\u0435\u0442 \u0430\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0438 \u0437\u0430\u0446\u0438\u043A\u043B\u0435\u043D\u044B. \u0423\u0441\u0442\u0430\u043D\u043E\u0432\u043A\u0430 \u044D\u0442\u043E\u0433\u043E \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u044F \u043D\u0430 `0` \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u043A\u043B\u044E\u0447\u0430\u0442\u044C \u0437\u0430\u0446\u0438\u043A\u043B\u0438\u0432\u0430\u043D\u0438\u0435, \u043D\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043C\u043E \u043E\u0442 \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u0438.",
			"zh-CN": "\u8D85\u8FC7\u6307\u5B9A\u65F6\u95F4\u540E\u5A92\u4F53\u4E0D\u518D\u81EA\u52A8\u5FAA\u73AF\u64AD\u653E\u3002\u8BBE\u4E3A 0 \u5219\u59CB\u7EC8\u5FAA\u73AF\uFF0C\u4E0D\u9650\u5236\u6301\u7EED\u65F6\u95F4\u3002"
		},
		"Play/pause key": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_playpause_key",
						"field": "name"
					}
				]
			},
			"pt-BR": "Tecla de reproduzir/pausar",
			"ru": "\u041A\u043D\u043E\u043F\u043A\u0430 \u0432\u043E\u0441\u043F\u0440\u043E\u0438\u0437\u0432\u0435\u0434\u0435\u043D\u0438\u044F/\u043F\u0440\u0438\u043E\u0441\u0442\u0430\u043D\u043E\u0432\u043A\u0438",
			"zh-CN": "\u64AD\u653E/\u6682\u505C\u952E"
		},
		"Key to toggle whether the media is playing or paused": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_playpause_key",
						"field": "description"
					}
				]
			},
			"pt-BR": "Tecla para alternar entre reproduzir e pausar a m\u00EDdia",
			"ru": "\u0421 \u043F\u043E\u043C\u043E\u0449\u044C\u044E \u044D\u0442\u043E\u0439 \u043A\u043D\u043E\u043F\u043A\u0438, \u0432\u044B \u0441\u043C\u043E\u0436\u0435\u0442\u0435 \u0432\u043E\u0441\u043F\u0440\u043E\u0438\u0437\u0432\u043E\u0434\u0438\u0442\u044C \u0438\u043B\u0438 \u043F\u0440\u0438\u043E\u0441\u0442\u0430\u043D\u0430\u0432\u043B\u0438\u0432\u0430\u0442\u044C \u043C\u0435\u0434\u0438\u0430.",
			"zh-CN": "\u5207\u6362\u5A92\u4F53\u7684\u64AD\u653E/\u6682\u505C\u7684\u6309\u952E"
		},
		"Mute": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_muted",
						"field": "name"
					}
				]
			},
			"pt-BR": "Silenciar",
			"ru": "\u041E\u0442\u043A\u043B\u044E\u0447\u0430\u0442\u044C \u0437\u0432\u0443\u043A",
			"zh-CN": "\u9759\u97F3"
		},
		"Mutes the media by default": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_muted",
						"field": "description"
					}
				]
			},
			"pt-BR": "Silenciar a m\u00EDdia por padr\u00E3o",
			"ru": "\u041E\u0442\u043A\u043B\u044E\u0447\u0430\u0435\u0442 \u0437\u0432\u0443\u043A \u043C\u0435\u0434\u0438\u0430 \u043F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E.",
			"zh-CN": "\u9ED8\u8BA4\u5C06\u5A92\u4F53\u9759\u97F3"
		},
		"Toggle mute key": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_mute_key",
						"field": "name"
					}
				]
			},
			"pt-BR": "Tecla de alternar para mudo",
			"ru": "\u041A\u043D\u043E\u043F\u043A\u0430 \u043E\u0442\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u044F \u0437\u0432\u0443\u043A\u0430",
			"zh-CN": "\u5207\u6362\u9759\u97F3\u952E"
		},
		"Key to toggle mute": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_mute_key",
						"field": "description"
					}
				]
			},
			"pt-BR": "Tecla para alternar para mudo",
			"ru": "\u0421 \u043F\u043E\u043C\u043E\u0449\u044C\u044E \u044D\u0442\u043E\u0439 \u043A\u043D\u043E\u043F\u043A\u0438, \u0432\u044B \u0441\u043C\u043E\u0436\u0435\u0442\u0435 \u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0430\u0442\u044C \u0437\u0432\u0443\u043A.",
			"zh-CN": "\u5207\u6362\u9759\u97F3\u7684\u6309\u952E"
		},
		"Default volume": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_volume",
						"field": "name"
					}
				]
			},
			"pt-BR": "Volume padr\u00E3o",
			"ru": "\u0413\u0440\u043E\u043C\u043A\u043E\u0441\u0442\u044C \u043F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E",
			"zh-CN": "\u9ED8\u8BA4\u97F3\u91CF"
		},
		"Default volume for the media": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_volume",
						"field": "description"
					}
				]
			},
			"pt-BR": "Volume padr\u00E3o para a m\u00EDdia",
			"ru": "\u0413\u0440\u043E\u043C\u043A\u043E\u0441\u0442\u044C \u0437\u0432\u0443\u043A\u0430 \u0434\u043B\u044F \u043C\u0435\u0434\u0438\u0430 \u043F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E.",
			"zh-CN": "\u5A92\u4F53\u7684\u9ED8\u8BA4\u97F3\u91CF"
		},
		"Volume up key": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_volume_up_key",
						"field": "name"
					}
				]
			},
			"pt-BR": "Tecla de aumentar o volume",
			"ru": "\u041A\u043D\u043E\u043F\u043A\u0430 \u0443\u0432\u0435\u043B\u0438\u0447\u0435\u043D\u0438\u044F \u0433\u0440\u043E\u043C\u043A\u043E\u0441\u0442\u0438",
			"zh-CN": "\u97F3\u91CF\u8C03\u9AD8\u952E"
		},
		"Key to increase the volume": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_volume_up_key",
						"field": "description"
					}
				]
			},
			"pt-BR": "Tecla para aumentar o volume",
			"ru": "\u0421 \u043F\u043E\u043C\u043E\u0449\u044C\u044E \u044D\u0442\u043E\u0439 \u043A\u043D\u043E\u043F\u043A\u0438, \u0432\u044B \u0441\u043C\u043E\u0436\u0435\u0442\u0435 \u0443\u0432\u0435\u043B\u0438\u0447\u0438\u0442\u044C \u0433\u0440\u043E\u043C\u043A\u043E\u0441\u0442\u044C \u0437\u0432\u0443\u043A\u0430.",
			"zh-CN": "\u589E\u5927\u97F3\u91CF\u7684\u6309\u952E"
		},
		"Volume down key": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_volume_down_key",
						"field": "name"
					}
				]
			},
			"pt-BR": "Tecla de diminuir o volume",
			"ru": "\u041A\u043D\u043E\u043F\u043A\u0430 \u0443\u043C\u0435\u043D\u044C\u0448\u0435\u043D\u0438\u044F \u0433\u0440\u043E\u043C\u043A\u043E\u0441\u0442\u0438",
			"zh-CN": "\u97F3\u91CF\u8C03\u4F4E\u952E"
		},
		"Key to decrease the volume": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_volume_down_key",
						"field": "description"
					}
				]
			},
			"pt-BR": "Tecla para diminuir o volume",
			"ru": "\u0421 \u043F\u043E\u043C\u043E\u0449\u044C\u044E \u044D\u0442\u043E\u0439 \u043A\u043D\u043E\u043F\u043A\u0438, \u0432\u044B \u0441\u043C\u043E\u0436\u0435\u0442\u0435 \u0443\u043C\u0435\u043D\u044C\u0448\u0430\u0442\u044C \u0433\u0440\u043E\u043C\u043A\u043E\u0441\u0442\u044C \u0437\u0432\u0443\u043A\u0430.",
			"zh-CN": "\u51CF\u5C0F\u97F3\u91CF\u7684\u6309\u952E"
		},
		"Volume change amount": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_volume_change_amt",
						"field": "name"
					}
				]
			},
			"pt-BR": "Quantidade de altera\u00E7\u00E3o de volume",
			"ru": "\u0412\u0435\u043B\u0438\u0447\u0438\u043D\u0430 \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u044F \u0433\u0440\u043E\u043C\u043A\u043E\u0441\u0442\u0438",
			"zh-CN": "\u97F3\u91CF\u53D8\u5316\u767E\u5206\u6BD4"
		},
		"Percent for volume to increase/decrease when using the volume up/down keys": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_volume_change_amt",
						"field": "description"
					}
				]
			},
			"pt-BR": "Percentual para aumentar/diminuir o volume ao usar as teclas de aumentar/diminuir volume",
			"ru": "\u041F\u0440\u043E\u0446\u0435\u043D\u0442 \u0434\u043B\u044F \u0443\u0432\u0435\u043B\u0438\u0447\u0435\u043D\u0438\u044F/\u0443\u043C\u0435\u043D\u044C\u0448\u0435\u043D\u0438\u044F \u0433\u0440\u043E\u043C\u043A\u043E\u0441\u0442\u0438 \u043F\u0440\u0438 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u0438\u0438 \u043A\u043D\u043E\u043F\u043E\u043A \u0443\u0432\u0435\u043B\u0438\u0447\u0435\u043D\u0438\u044F/\u0443\u043C\u0435\u043D\u044C\u0448\u0435\u043D\u0438\u044F \u0433\u0440\u043E\u043C\u043A\u043E\u0441\u0442\u0438.",
			"zh-CN": "\u4F7F\u7528\u97F3\u91CF\u8C03\u9AD8/\u8C03\u4F4E\u952E\u65F6\uFF0C\u97F3\u91CF\u589E\u51CF\u7684\u767E\u5206\u6BD4"
		},
		"Resume playback from source": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_resume_from_source",
						"field": "name"
					}
				]
			},
			"pt-BR": "Retomar reprodu\u00E7\u00E3o do v\u00EDdeo original",
			"ru": "\u041F\u0440\u043E\u0434\u043E\u043B\u0436\u0430\u0442\u044C \u0432\u043E\u0441\u043F\u0440\u043E\u0438\u0437\u0432\u0435\u0434\u0435\u043D\u0438\u0435 \u0438\u0437 \u0438\u0441\u0442\u043E\u0447\u043D\u0438\u043A\u0430",
			"zh-CN": "\u4ECE\u6E90\u5730\u5740\u7EE7\u7EED\u64AD\u653E"
		},
		"If enabled, playback will resume from where the source left off": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_resume_from_source",
						"field": "description"
					}
				]
			},
			"pt-BR": "Se ativado, a reprodu\u00E7\u00E3o continuar\u00E1 de onde o v\u00EDdeo original parou",
			"ru": "\u0415\u0441\u043B\u0438 \u0432\u043A\u043B\u044E\u0447\u0435\u043D\u043E, \u0432\u043E\u0441\u043F\u0440\u043E\u0438\u0437\u0432\u0435\u0434\u0435\u043D\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u043E\u0437\u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u043E \u0441 \u0442\u043E\u0433\u043E \u043C\u0435\u0441\u0442\u0430, \u043D\u0430 \u043A\u043E\u0442\u043E\u0440\u043E\u043C \u043E\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u043B\u0441\u044F \u0438\u0441\u0442\u043E\u0447\u043D\u0438\u043A.",
			"zh-CN": "\u542F\u7528\u540E\uFF0C\u64AD\u653E\u5C06\u4ECE\u6E90\u5A92\u4F53\u4E2D\u505C\u6B62\u7684\u8FDB\u5EA6\u7EE7\u7EED"
		},
		"Resume if different length": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_resume_if_different",
						"field": "name"
					}
				]
			},
			"pt-BR": "Retomar se a dura\u00E7\u00E3o for diferente",
			"ru": "\u0412\u043E\u0437\u043E\u0431\u043D\u043E\u0432\u043B\u044F\u0442\u044C, \u0435\u0441\u043B\u0438 \u0440\u0430\u0437\u043D\u0430\u044F \u0434\u043B\u0438\u043D\u0430",
			"zh-CN": "\u957F\u5EA6\u4E0D\u540C\u4E5F\u7EE7\u7EED\u64AD\u653E"
		},
		"If disabled, it will not resume if the source has a different length from the media in the popup (e.g. from a preview video to a full one)": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_resume_if_different",
						"field": "description"
					}
				]
			},
			"pt-BR": "Se desativado, n\u00E3o retomar\u00E1 a reprodu\u00E7\u00E3o se o v\u00EDdeo original tiver uma dura\u00E7\u00E3o diferente da m\u00EDdia no pop-up (por exemplo, de um v\u00EDdeo de visualiza\u00E7\u00E3o para um v\u00EDdeo completo).",
			"ru": "\u0415\u0441\u043B\u0438 \u043E\u0442\u043A\u043B\u044E\u0447\u0435\u043D\u043E, \u0442\u043E \u043D\u0435 \u0432\u043E\u0437\u043E\u0431\u043D\u043E\u0432\u043B\u044F\u0435\u0442, \u0435\u0441\u043B\u0438 \u0434\u043B\u0438\u043D\u0430 \u0438\u0437 \u0438\u0441\u0442\u043E\u0447\u043D\u0438\u043A\u0430 \u043E\u0442\u043B\u0438\u0447\u0430\u0435\u0442\u0441\u044F \u043E\u0442 \u0434\u043B\u0438\u043D\u044B \u043C\u0435\u0434\u0438\u0430 \u0432\u043E \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u043C \u043E\u043A\u043D\u0435 (\u043D\u0430\u043F\u0440\u0438\u043C\u0435\u0440, \u0441 \u043F\u0440\u0435\u0434\u043F\u0440\u043E\u0441\u043C\u043E\u0442\u0440\u0430 \u0432\u0438\u0434\u0435\u043E \u0434\u043E \u043F\u043E\u043B\u043D\u043E\u0433\u043E)",
			"zh-CN": "\u7981\u7528\u540E\uFF0C\u5982\u679C\u6E90\u5A92\u4F53\u4E0E\u5F39\u51FA\u7684\u5A92\u4F53\u7684\u65F6\u957F\u4E0D\u540C\uFF08\u4F8B\u5982\u9884\u89C8\u89C6\u9891\u4E0E\u5B8C\u6574\u89C6\u9891\u7684\u533A\u522B\uFF09\uFF0C\u5219\u4E0D\u7EE7\u7EED\u64AD\u653E"
		},
		"Pause source": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_pause_source",
						"field": "name"
					}
				]
			},
			"pt-BR": "Pausar v\u00EDdeo original",
			"ru": "\u041F\u0440\u0438\u043E\u0441\u0442\u0430\u043D\u0430\u0432\u043B\u0438\u0432\u0430\u0442\u044C \u0438\u0437 \u0438\u0441\u0442\u043E\u0447\u043D\u0438\u043A\u0430",
			"zh-CN": "\u6682\u505C\u6E90\u5A92\u4F53"
		},
		"Pauses the source once the popup has opened": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_pause_source",
						"field": "description"
					}
				]
			},
			"pt-BR": "Pausa o v\u00EDdeo original assim que o pop-up for aberto",
			"ru": "\u041F\u0440\u0438\u043E\u0441\u0442\u0430\u043D\u0430\u0432\u043B\u0438\u0432\u0430\u0435\u0442 \u0438\u0441\u0442\u043E\u0447\u043D\u0438\u043A \u043F\u043E\u0441\u043B\u0435 \u043E\u0442\u043A\u0440\u044B\u0442\u0438\u044F \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430",
			"zh-CN": "\u5F39\u7A97\u6253\u5F00\u540E\u6682\u505C\u6E90\u5A92\u4F53"
		},
		"Seek amount": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_seek_amount",
						"field": "name"
					}
				]
			},
			"pt-BR": "Quantidade de avan\u00E7o/retrocesso",
			"ru": "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0437\u0430\u043F\u0440\u043E\u0441\u043E\u0432",
			"zh-CN": "\u8FDB\u9000\u8DDD\u79BB"
		},
		"Amount of time to seek forward/back when using the seek keys": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_seek_amount",
						"field": "description"
					}
				]
			},
			"pt-BR": "Quantidade de tempo para avan\u00E7ar/retroceder ao usar as teclas de avan\u00E7o/retrocesso",
			"ru": "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0432\u0440\u0435\u043C\u0435\u043D\u0438 \u0434\u043B\u044F \u0437\u0430\u043F\u0440\u043E\u0441\u0430 \u0432\u043F\u0435\u0440\u0435\u0434/\u043D\u0430\u0437\u0430\u0434 \u043F\u0440\u0438 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u0438\u0438 \u043A\u043D\u043E\u043F\u043E\u043A \u0437\u0430\u043F\u0440\u043E\u0441\u0430.",
			"zh-CN": "\u4F7F\u7528\u5FEB\u8FDB/\u5FEB\u9000\u6309\u952E\u65F6\u524D\u8FDB/\u540E\u9000\u7684\u65F6\u95F4\u91CF"
		},
		"Seek left key": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_seek_left_key",
						"field": "name"
					}
				]
			},
			"pt-BR": "Tecla de retrocesso",
			"ru": "\u041A\u043D\u043E\u043F\u043A\u0430 \u0437\u0430\u043F\u0440\u043E\u0441\u0430 \u0432\u043B\u0435\u0432\u043E",
			"zh-CN": "\u5FEB\u9000\u952E"
		},
		"Key to seek backwards by the specified amount": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_seek_left_key",
						"field": "description"
					}
				]
			},
			"pt-BR": "Tecla para retroceder a quantidade especificada",
			"ru": "\u0421 \u043F\u043E\u043C\u043E\u0449\u044C\u044E \u044D\u0442\u043E\u0439 \u043A\u043D\u043E\u043F\u043A\u0438, \u0432\u044B \u0441\u043C\u043E\u0436\u0435\u0442\u0435 \u0441\u0434\u0435\u043B\u0430\u0442\u044C \u0437\u0430\u043F\u0440\u043E\u0441 \u043D\u0430\u0437\u0430\u0434 \u043E\u0442 \u0437\u0430\u0434\u0430\u043D\u043E\u0433\u043E \u043A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u0430.",
			"zh-CN": "\u5411\u5DE6\u4FA7\uFF08\u4E4B\u524D\uFF09\u5FEB\u901F\u79FB\u52A8\u6307\u5B9A\u65F6\u957F\u7684\u6309\u952E"
		},
		"Seek right key": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_seek_right_key",
						"field": "name"
					}
				]
			},
			"pt-BR": "Tecla de avan\u00E7o",
			"ru": "\u041A\u043D\u043E\u043F\u043A\u0430 \u0437\u0430\u043F\u0440\u043E\u0441\u0430 \u0432\u043F\u0440\u0430\u0432\u043E",
			"zh-CN": "\u5FEB\u8FDB\u952E"
		},
		"Key to seek forwards by the specified amount": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_seek_right_key",
						"field": "description"
					}
				]
			},
			"pt-BR": "Tecla para avan\u00E7ar a quantidade especificada",
			"ru": "\u0421 \u043F\u043E\u043C\u043E\u0449\u044C\u044E \u044D\u0442\u043E\u0439 \u043A\u043D\u043E\u043F\u043A\u0438, \u0432\u044B \u0441\u043C\u043E\u0436\u0435\u0442\u0435 \u0441\u0434\u0435\u043B\u0430\u0442\u044C \u0437\u0430\u043F\u0440\u043E\u0441 \u0432\u043F\u0435\u0440\u0451\u0434 \u043E\u0442 \u0437\u0430\u0434\u0430\u043D\u043E\u0433\u043E \u043A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u0430.",
			"zh-CN": "\u5411\u53F3\u4FA7\uFF08\u4E4B\u540E\uFF09\u5FEB\u901F\u79FB\u52A8\u6307\u5B9A\u65F6\u957F\u7684\u6309\u952E"
		},
		"Previous frame key": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_frame_prev_key",
						"field": "name"
					}
				]
			},
			"pt-BR": "Tecla de voltar quadro",
			"ru": "\u041A\u043D\u043E\u043F\u043A\u0430 \u043F\u0440\u0435\u0434\u044B\u0434\u0443\u0449\u0435\u0433\u043E \u043A\u0430\u0434\u0440\u0430",
			"zh-CN": "\u4E0A\u4E00\u5E27\u6309\u952E"
		},
		"Rewinds the video one \"frame\" backward. Due to current limitations, the frame size is static (but configurable), and might not match the video's framerate": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_frame_prev_key",
						"field": "description"
					}
				]
			},
			"pt-BR": "Retrocede o v\u00EDdeo um \"quadro\" para tr\u00E1s. Devido \u00E0s limita\u00E7\u00F5es atuais, o tamanho do quadro \u00E9 est\u00E1tico (mas configur\u00E1vel) e pode n\u00E3o corresponder \u00E0 taxa de quadros do v\u00EDdeo",
			"ru": "\u0421 \u043F\u043E\u043C\u043E\u0449\u044C\u044E \u044D\u0442\u043E\u0439 \u043A\u043D\u043E\u043F\u043A\u0438, \u0432\u044B \u0441\u043C\u043E\u0436\u0435\u0442\u0435 \u043F\u0435\u0440\u0435\u043C\u0430\u0442\u044B\u0432\u0430\u0442\u044C \u0432\u0438\u0434\u0435\u043E \u043D\u0430 \u043E\u0434\u0438\u043D \"\u043A\u0430\u0434\u0440\" \u043D\u0430\u0437\u0430\u0434. \u0412 \u0441\u0432\u044F\u0437\u0438 \u0441 \u0442\u0435\u043A\u0443\u0449\u0438\u043C\u0438 \u043E\u0433\u0440\u0430\u043D\u0438\u0447\u0435\u043D\u0438\u044F\u043C\u0438, \u0440\u0430\u0437\u043C\u0435\u0440 \u043A\u0430\u0434\u0440\u0430 \u044F\u0432\u043B\u044F\u0435\u0442\u0441\u044F \u0441\u0442\u0430\u0442\u0438\u0447\u043D\u044B\u043C (\u043D\u043E \u043D\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043C\u044B\u043C), \u0438 \u043C\u043E\u0436\u0435\u0442 \u043D\u0435 \u0441\u043E\u0432\u043F\u0430\u0434\u0430\u0442\u044C \u0441 \u0447\u0430\u0441\u0442\u043E\u0442\u043E\u0439 \u043A\u0430\u0434\u0440\u043E\u0432 \u0432\u0438\u0434\u0435\u043E.",
			"zh-CN": "\u5C06\u89C6\u9891\u5012\u56DE\u524D\u4E00\u5E27\u3002\u7531\u4E8E\u5F53\u524D\u7684\u9650\u5236\uFF0C\u5E27\u5927\u5C0F\u662F\u9759\u6001\u7684\uFF08\u4F46\u53EF\u914D\u7F6E\uFF09\uFF0C\u53EF\u80FD\u4E0E\u89C6\u9891\u7684\u5E27\u901F\u7387\u4E0D\u5339\u914D"
		},
		"Next frame key": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_frame_next_key",
						"field": "name"
					}
				]
			},
			"pt-BR": "Tecla de avan\u00E7ar quadro",
			"ru": "\u041A\u043D\u043E\u043F\u043A\u0430 \u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u0433\u043E \u043A\u0430\u0434\u0440\u0430",
			"zh-CN": "\u4E0B\u4E00\u5E27\u6309\u952E"
		},
		"Advances the video one \"frame\" forward. Due to current limitations, the frame size is static (but configurable), and might not match the video's framerate": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_frame_next_key",
						"field": "description"
					}
				]
			},
			"pt-BR": "Avan\u00E7a o v\u00EDdeo um \"quadro\" para frente. Devido \u00E0s limita\u00E7\u00F5es atuais, o tamanho do quadro \u00E9 est\u00E1tico (mas configur\u00E1vel) e pode n\u00E3o corresponder \u00E0 taxa de quadros do v\u00EDdeo",
			"ru": "\u0421 \u043F\u043E\u043C\u043E\u0449\u044C\u044E \u044D\u0442\u043E\u0439 \u043A\u043D\u043E\u043F\u043A\u0438, \u0432\u044B \u0441\u043C\u043E\u0436\u0435\u0442\u0435 \u043F\u0435\u0440\u0435\u043C\u0430\u0442\u044B\u0432\u0430\u0442\u044C \u0432\u0438\u0434\u0435\u043E \u043D\u0430 \u043E\u0434\u0438\u043D \"\u043A\u0430\u0434\u0440\" \u0432\u043F\u0435\u0440\u0451\u0434. \u0412 \u0441\u0432\u044F\u0437\u0438 \u0441 \u0442\u0435\u043A\u0443\u0449\u0438\u043C\u0438 \u043E\u0433\u0440\u0430\u043D\u0438\u0447\u0435\u043D\u0438\u044F\u043C\u0438, \u0440\u0430\u0437\u043C\u0435\u0440 \u043A\u0430\u0434\u0440\u0430 \u044F\u0432\u043B\u044F\u0435\u0442\u0441\u044F \u0441\u0442\u0430\u0442\u0438\u0447\u043D\u044B\u043C (\u043D\u043E \u043D\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043C\u044B\u043C), \u0438 \u043C\u043E\u0436\u0435\u0442 \u043D\u0435 \u0441\u043E\u0432\u043F\u0430\u0434\u0430\u0442\u044C \u0441 \u0447\u0430\u0441\u0442\u043E\u0442\u043E\u0439 \u043A\u0430\u0434\u0440\u043E\u0432 \u0432\u0438\u0434\u0435\u043E.",
			"zh-CN": "\u5C06\u89C6\u9891\u79FB\u5165\u4E0B\u4E00\u5E27\u3002\u7531\u4E8E\u5F53\u524D\u7684\u9650\u5236\uFF0C\u5E27\u5927\u5C0F\u662F\u9759\u6001\u7684\uFF08\u4F46\u53EF\u914D\u7F6E\uFF09\uFF0C\u53EF\u80FD\u4E0E\u89C6\u9891\u7684\u5E27\u901F\u7387\u4E0D\u5339\u914D"
		},
		"Frame rate": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_framerate",
						"field": "name"
					}
				]
			},
			"pt-BR": "Taxa de quadros",
			"ru": "\u0427\u0430\u0441\u0442\u043E\u0442\u0430 \u043A\u0430\u0434\u0440\u043E\u0432",
			"zh-CN": "\u5E27\u901F\u7387"
		},
		"Frame rate for videos to seek forward/back with the next/previous frame keys": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_framerate",
						"field": "description"
					}
				]
			},
			"pt-BR": "Taxa de quadros para v\u00EDdeos avan\u00E7arem/retrocederem com as teclas de pr\u00F3ximo/anterior quadro",
			"ru": "\u0427\u0430\u0441\u0442\u043E\u0442\u0430 \u043A\u0430\u0434\u0440\u043E\u0432 \u0432\u0438\u0434\u0435\u043E \u0434\u043B\u044F \u0437\u0430\u043F\u0440\u043E\u0441\u0430 \u0432\u043F\u0435\u0440\u0451\u0434/\u043D\u0430\u0437\u0430\u0434 \u0441 \u043F\u043E\u043C\u043E\u0449\u044C\u044E \u043A\u043D\u043E\u043F\u043E\u043A \u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0438\u0439/\u043F\u0440\u0435\u0434\u044B\u0434\u0443\u0449\u0438\u0439 \u043A\u0430\u0434\u0440",
			"zh-CN": "\u5E27\u901F\u7387\u7528\u4E8E\u89C6\u9891\u7684\u5FEB\u8FDB/\u5FEB\u9000\u6309\u952E"
		},
		"FPS": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_framerate",
						"field": "number_unit"
					}
				]
			},
			"pt-BR": "FPS (Quadros por Segundo)",
			"ru": "\u041A\u0430\u0434\u0440\u043E\u0432 \u0432 \u0441\u0435\u043A\u0443\u043D\u0434\u0443",
			"zh-CN": "\u6BCF\u79D2\u5E27\u6570\uFF08FPS\uFF09"
		},
		"Speed down key": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_speed_down_key",
						"field": "name"
					}
				]
			},
			"pt-BR": "Tecla para diminuir a velocidade",
			"ru": "\u041A\u043D\u043E\u043F\u043A\u0430 \u0443\u043C\u0435\u043D\u044C\u0448\u0435\u043D\u0438\u044F \u0441\u043A\u043E\u0440\u043E\u0441\u0442\u0438",
			"zh-CN": "\u51CF\u901F\u952E"
		},
		"Key to decrease playback rate by a specified amount": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_speed_down_key",
						"field": "description"
					}
				]
			},
			"pt-BR": "Tecla para diminuir a taxa de reprodu\u00E7\u00E3o em uma quantidade especificada",
			"ru": "\u0421 \u043F\u043E\u043C\u043E\u0449\u044C\u044E \u044D\u0442\u043E\u0439 \u043A\u043D\u043E\u043F\u043A\u0438, \u0432\u044B \u0441\u043C\u043E\u0436\u0435\u0442\u0435 \u0443\u043C\u0435\u043D\u044C\u0448\u0438\u0442\u044C \u0441\u043A\u043E\u0440\u043E\u0441\u0442\u044C \u0432\u043E\u0441\u043F\u0440\u043E\u0438\u0437\u0432\u0435\u0434\u0435\u043D\u0438\u044F \u043D\u0430 \u0437\u0430\u0434\u0430\u043D\u043D\u0443\u044E \u0432\u0435\u043B\u0438\u0447\u0438\u043D\u0443.",
			"zh-CN": "\u6B64\u952E\u53EF\u4EE5\u5C06\u64AD\u653E\u901F\u7387\u964D\u4F4E\u6307\u5B9A\u7684\u989D\u5EA6"
		},
		"Speed up key": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_speed_up_key",
						"field": "name"
					}
				]
			},
			"pt-BR": "Tecla para aumentar a velocidade",
			"ru": "\u041A\u043D\u043E\u043F\u043A\u0430 \u0443\u0432\u0435\u043B\u0438\u0447\u0435\u043D\u0438\u044F \u0441\u043A\u043E\u0440\u043E\u0441\u0442\u0438",
			"zh-CN": "\u52A0\u901F\u952E"
		},
		"Key to increase playback rate by a specified amount": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_speed_up_key",
						"field": "description"
					}
				]
			},
			"pt-BR": "Tecla para aumentar a taxa de reprodu\u00E7\u00E3o em uma quantidade especificada",
			"ru": "\u0421 \u043F\u043E\u043C\u043E\u0449\u044C\u044E \u044D\u0442\u043E\u0439 \u043A\u043D\u043E\u043F\u043A\u0438, \u0432\u044B \u0441\u043C\u043E\u0436\u0435\u0442\u0435 \u0443\u0432\u0435\u043B\u0438\u0447\u0438\u0442\u044C \u0441\u043A\u043E\u0440\u043E\u0441\u0442\u044C \u0432\u043E\u0441\u043F\u0440\u043E\u0438\u0437\u0432\u0435\u0434\u0435\u043D\u0438\u044F \u043D\u0430 \u0437\u0430\u0434\u0430\u043D\u043D\u0443\u044E \u0432\u0435\u043B\u0438\u0447\u0438\u043D\u0443.",
			"zh-CN": "\u6B64\u952E\u53EF\u4EE5\u5C06\u64AD\u653E\u901F\u7387\u63D0\u5347\u6307\u5B9A\u7684\u989D\u5EA6"
		},
		"Speed up/down amount": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_speed_amount",
						"field": "name"
					}
				]
			},
			"pt-BR": "Quantidade de aumento/diminui\u00E7\u00E3o de velocidade",
			"ru": "\u0412\u0435\u043B\u0438\u0447\u0438\u043D\u0430 \u0443\u0432\u0435\u043B\u0438\u0447\u0435\u043D\u0438\u044F/\u0443\u043C\u0435\u043D\u044C\u0448\u0435\u043D\u0438\u044F \u0441\u043A\u043E\u0440\u043E\u0441\u0442\u0438",
			"zh-CN": "\u52A0\u901F/\u51CF\u901F\u91CF"
		},
		"How much to increase/decrease the playback rate": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_speed_amount",
						"field": "description"
					}
				]
			},
			"pt-BR": "Quanto aumentar/diminuir a taxa de reprodu\u00E7\u00E3o",
			"ru": "\u041D\u0430\u0441\u043A\u043E\u043B\u044C\u043A\u043E \u0443\u0432\u0435\u043B\u0438\u0447\u0438\u0442\u044C/\u0443\u043C\u0435\u043D\u044C\u0448\u0438\u0442\u044C \u0441\u043A\u043E\u0440\u043E\u0441\u0442\u044C \u0432\u043E\u0441\u043F\u0440\u043E\u0438\u0437\u0432\u0435\u0434\u0435\u043D\u0438\u044F",
			"zh-CN": "\u589E\u52A0/\u51CF\u5C11\u7684\u64AD\u653E\u901F\u7387"
		},
		"Reset speed key": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_reset_speed_key",
						"field": "name"
					}
				]
			},
			"pt-BR": "Tecla para redefinir a velocidade",
			"ru": "\u041A\u043D\u043E\u043F\u043A\u0430 \u0441\u0431\u0440\u043E\u0441\u0430 \u0441\u043A\u043E\u0440\u043E\u0441\u0442\u0438",
			"zh-CN": "\u91CD\u7F6E\u901F\u5EA6\u952E"
		},
		"Resets the playback rate to normal speed": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_reset_speed_key",
						"field": "description"
					}
				]
			},
			"pt-BR": "Redefine a taxa de reprodu\u00E7\u00E3o para a velocidade normal",
			"ru": "\u0421 \u043F\u043E\u043C\u043E\u0449\u044C\u044E \u044D\u0442\u043E\u0439 \u043A\u043D\u043E\u043F\u043A\u0438, \u0432\u044B \u0441\u043C\u043E\u0436\u0435\u0442\u0435 \u0441\u0431\u0440\u043E\u0441\u0438\u0442\u044C \u0441\u043A\u043E\u0440\u043E\u0441\u0442\u044C \u0432\u043E\u0441\u043F\u0440\u043E\u0438\u0437\u0432\u0435\u0434\u0435\u043D\u0438\u044F \u0434\u043E \u043D\u043E\u0440\u043C\u0430\u043B\u044C\u043D\u043E\u0439 \u0441\u043A\u043E\u0440\u043E\u0441\u0442\u0438",
			"zh-CN": "\u5C06\u64AD\u653E\u901F\u5EA6\u91CD\u7F6E\u4E3A\u6B63\u5E38\u901F\u5EA6"
		},
		"Screenshot key": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_screenshot_key",
						"field": "name"
					}
				]
			},
			"pt-BR": "Tecla para captura de tela",
			"ru": "\u041A\u043D\u043E\u043F\u043A\u0430 \u0441\u043D\u0438\u043C\u043A\u0430 \u044D\u043A\u0440\u0430\u043D\u0430",
			"zh-CN": "\u5C4F\u5E55\u622A\u56FE\u952E"
		},
		"Screenshots the current frame in the video": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_screenshot_key",
						"field": "description"
					}
				]
			},
			"pt-BR": "Captura o quadro atual do v\u00EDdeo",
			"ru": "\u0421 \u043F\u043E\u043C\u043E\u0449\u044C\u044E \u044D\u0442\u043E\u0439 \u043A\u043D\u043E\u043F\u043A\u0438, \u0432\u044B \u0441\u043C\u043E\u0436\u0435\u0442\u0435 \u0441\u0434\u0435\u043B\u0430\u0442\u044C \u0441\u043D\u0438\u043C\u043E\u043A \u044D\u043A\u0440\u0430\u043D\u0430 \u0442\u0435\u043A\u0443\u0449\u0435\u0433\u043E \u043A\u0430\u0434\u0440\u0430 \u043D\u0430 \u0432\u0438\u0434\u0435\u043E.",
			"zh-CN": "\u5BF9\u89C6\u9891\u4E2D\u7684\u5F53\u524D\u5E27\u622A\u56FE"
		},
		"Screenshot format": {
			"_info": {
				"instances": [
					{
						"setting": "popup_video_screenshot_format",
						"field": "name"
					}
				]
			},
			"pt-BR": "Formato da captura de tela",
			"ru": "\u0424\u043E\u0440\u043C\u0430\u0442 \u0441\u043D\u0438\u043C\u043A\u0430 \u044D\u043A\u0440\u0430\u043D\u0430",
			"zh-CN": "\u622A\u56FE\u683C\u5F0F"
		},
		"File format to save the screenshot in": {
			"_info": {
				"instances": [
					{
						"setting": "popup_video_screenshot_format",
						"field": "description"
					}
				]
			},
			"pt-BR": "Formato de arquivo para salvar a captura de tela",
			"ru": "\u0424\u043E\u0440\u043C\u0430\u0442 \u0444\u0430\u0439\u043B\u0430 \u0434\u043B\u044F \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u0438\u044F \u0441\u043D\u0438\u043C\u043A\u0430 \u044D\u043A\u0440\u0430\u043D\u0430",
			"zh-CN": "\u4FDD\u5B58\u622A\u56FE\u7684\u6587\u4EF6\u683C\u5F0F"
		},
		"PNG": {
			"_info": {
				"instances": [
					{
						"setting": "popup_video_screenshot_format",
						"field": "options.png.name"
					}
				]
			},
			"pt-BR": "PNG",
			"ru": "PNG",
			"zh-CN": "PNG"
		},
		"JPG": {
			"_info": {
				"instances": [
					{
						"setting": "popup_video_screenshot_format",
						"field": "options.jpg.name"
					}
				]
			},
			"pt-BR": "JPG",
			"ru": "JPG",
			"zh-CN": "JPG"
		},
		"Enable subtitles": {
			"_info": {
				"instances": [
					{
						"setting": "popup_enable_subtitles",
						"field": "name"
					}
				]
			},
			"pt-BR": "Ativar legendas"
		},
		"Enables subtitles to be overlayed on top of the video": {
			"_info": {
				"instances": [
					{
						"setting": "popup_enable_subtitles",
						"field": "description"
					}
				]
			},
			"pt-BR": "Permite que as legendas sejam sobrepostas ao v\u00EDdeo"
		},
		"Popup UI": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_ui",
						"field": "name"
					}
				]
			},
			"es": "Interfaz del Popup",
			"ko": "\uD31D\uC5C5 UI",
			"pt-BR": "Interface de Pop-up",
			"ru": "\u041F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u0438\u0439 \u0438\u043D\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430",
			"zh-CN": "\u5F39\u7A97\u754C\u9762"
		},
		"Enables a UI on top of the popup": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_ui",
						"field": "description"
					}
				]
			},
			"pt-BR": "Habilita uma interface na parte superior do pop-up",
			"ru": "\u0412\u043A\u043B\u044E\u0447\u0430\u0435\u0442 \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u0438\u0439 \u0438\u043D\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0432 \u0432\u0435\u0440\u0445\u043D\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430.",
			"zh-CN": "\u542F\u7528\u5F39\u7A97\u4E0A\u7684\u754C\u9762"
		},
		"UI Toggle key": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_ui_toggle_key",
						"field": "name"
					}
				]
			},
			"pt-BR": "Tecla para alternar a interface",
			"ru": "\u041A\u043D\u043E\u043F\u043A\u0430 \u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u044F \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u043E\u0433\u043E \u0438\u043D\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430",
			"zh-CN": "\u754C\u9762\u5207\u6362\u952E"
		},
		"Toggles the display of the UI": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_ui_toggle_key",
						"field": "description"
					}
				]
			},
			"pt-BR": "Alterna a exibi\u00E7\u00E3o da interface",
			"ru": "\u0421 \u043F\u043E\u043C\u043E\u0449\u044C\u044E \u044D\u0442\u043E\u0439 \u043A\u043D\u043E\u043F\u0438, \u0432\u044B \u0441\u043C\u043E\u0436\u0435\u0442\u0435 \u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0430\u0442\u044C \u043E\u0442\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u043E\u0433\u043E \u0438\u043D\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430.",
			"zh-CN": "\u5207\u6362\u754C\u9762\u7684\u663E\u793A\u65B9\u5F0F"
		},
		"Opacity": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_ui_opacity",
						"field": "name"
					}
				]
			},
			"es": "Opacidad",
			"fr": "Opacit\u00E9",
			"ko": "\uBD88\uD22C\uBA85",
			"pt-BR": "Opacidade",
			"ru": "\u041D\u0435\u043F\u0440\u043E\u0437\u0440\u0430\u0447\u043D\u043E\u0441\u0442\u044C",
			"zh-CN": "\u4E0D\u900F\u660E\u5EA6"
		},
		"Opacity of the UI on top of the popup": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_ui_opacity",
						"field": "description"
					}
				]
			},
			"pt-BR": "Opacidade da interface sobre o pop-up",
			"ru": "\u041D\u0435\u043F\u0440\u043E\u0437\u0440\u0430\u0447\u043D\u043E\u0441\u0442\u044C \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u043E\u0433\u043E \u0438\u043D\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0432 \u0432\u0435\u0440\u0445\u043D\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430.",
			"zh-CN": "\u5F39\u7A97\u4E0A\u754C\u9762\u7684\u4E0D\u900F\u660E\u5EA6"
		},
		"Use safe glyphs": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_ui_use_safe_glyphs",
						"field": "name"
					}
				]
			},
			"pt-BR": "Usar glifos seguros",
			"ru": "\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u0431\u0435\u0437\u043E\u043F\u0430\u0441\u043D\u044B\u0435 \u0433\u043B\u0438\u0444\u044B",
			"zh-CN": "\u4F7F\u7528\u5B89\u5168\u5B57\u5F62"
		},
		"Uses glyphs that are more likely to be available on all fonts. Enable this option if the following characters render as boxes: \uD83E\uDC47 \uD83E\uDC50 \uD83E\uDC52. The 'Noto Sans Symbols2' font contains these characters.": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_ui_use_safe_glyphs",
						"field": "description"
					}
				]
			},
			"pt-BR": "Usa glifos que s\u00E3o mais propensos a estarem dispon\u00EDveis em todas as fontes. Habilite esta op\u00E7\u00E3o se os seguintes caracteres forem exibidos como caixas: \uD83E\uDC47 \uD83E\uDC50 \uD83E\uDC52. A fonte 'Noto Sans Symbols2' cont\u00E9m estes caracteres.",
			"ru": "\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u044E\u0442\u0441\u044F \u0433\u043B\u0438\u0444\u044B, \u043A\u043E\u0442\u043E\u0440\u044B\u0435 \u0441\u043A\u043E\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043E, \u0431\u0443\u0434\u0443\u0442 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u044B \u043D\u0430 \u0432\u0441\u0435\u0445 \u0448\u0440\u0438\u0444\u0442\u0430\u0445. \u0412\u043A\u043B\u044E\u0447\u0438\u0442\u0435 \u044D\u0442\u043E\u0442 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440, \u0435\u0441\u043B\u0438 \u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0438\u0435 \u0441\u0438\u043C\u0432\u043E\u043B\u044B \u043E\u0442\u043E\u0431\u0440\u0430\u0436\u0430\u044E\u0442\u0441\u044F \u0432 \u0432\u0438\u0434\u0435 \u043A\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u043A\u043E\u0432: \uD83E\uDC47 \uD83E\uDC50 \uD83E\uDC52. \u0428\u0440\u0438\u0444\u0442 'Noto Sans Symbols2' \u0441\u043E\u0434\u0435\u0440\u0436\u0438\u0442 \u044D\u0442\u0438 \u0441\u0438\u043C\u0432\u043E\u043B\u044B.",
			"zh-CN": "\u4F7F\u7528\u66F4\u53EF\u80FD\u9002\u7528\u4E8E\u6240\u6709\u5B57\u4F53\u7684\u5B57\u5F62\u3002\u542F\u7528\u6B64\u9009\u9879\uFF0C\u5982\u679C\u4E0B\u5217\u5B57\u7B26\u5448\u73B0\u4E3A\u65B9\u6846\uFF1A\uD83E\uDC47 \uD83E\uDC50 \uD83E\uDC52\u3002\u201CNoto Sans symboss2\u201D\u5B57\u4F53\u5305\u542B\u8FD9\u4E9B\u5B57\u7B26\u3002"
		},
		"Media resolution": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_ui_imagesize",
						"field": "name"
					}
				]
			},
			"pt-BR": "Resolu\u00E7\u00E3o da m\u00EDdia",
			"ru": "\u0420\u0430\u0437\u0440\u0435\u0448\u0435\u043D\u0438\u0435 \u043C\u0435\u0434\u0438\u0430",
			"zh-CN": "\u5A92\u4F53\u5206\u8FA8\u7387"
		},
		"Displays the original media dimensions on top of the UI.\nCSS ID: `#sizeinfo`": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_ui_imagesize",
						"field": "description"
					}
				]
			},
			"pt-BR": "Exibe as dimens\u00F5es originais da m\u00EDdia no topo da UI.\nID CSS: `#sizeinfo`",
			"ru": "\u041E\u0442\u043E\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u043E\u0440\u0438\u0433\u0438\u043D\u0430\u043B\u044C\u043D\u044B\u0435 \u0440\u0430\u0437\u043C\u0435\u0440\u044B \u043C\u0435\u0434\u0438\u0430 \u0432 \u0432\u0435\u0440\u0445\u043D\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u043E\u0433\u043E \u0438\u043D\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430.\nCSS ID: `#sizeinfo`",
			"zh-CN": "\u5728\u754C\u9762\u4E0A\u663E\u793A\u539F\u59CB\u5A92\u4F53\u5C3A\u5BF8\u3002\nCSS ID: `#sizeinfo`"
		},
		"Zoom percent": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_ui_zoomlevel",
						"field": "name"
					}
				]
			},
			"pt-BR": "Percentual de zoom",
			"ru": "\u041C\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0435 \u0432 \u043F\u0440\u043E\u0446\u0435\u043D\u0442\u0430\u0445",
			"zh-CN": "\u7F29\u653E\u767E\u5206\u6BD4"
		},
		"Displays the current zoom level on top of the UI.\nCSS ID: `#sizeinfo`": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_ui_zoomlevel",
						"field": "description"
					}
				]
			},
			"pt-BR": "Exibe o n\u00EDvel de zoom atual no topo da UI.\nID CSS: `#sizeinfo`",
			"ru": "\u041E\u0442\u043E\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u0442\u0435\u043A\u0443\u0449\u0438\u0439 \u0443\u0440\u043E\u0432\u0435\u043D\u044C \u043C\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F \u0432 \u0432\u0435\u0440\u0445\u043D\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u0438\u043D\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430.\nCSS ID: `#sizeinfo`",
			"zh-CN": "\u5728\u754C\u9762\u4E0A\u663E\u793A\u5F53\u524D\u7684\u7F29\u653E\u7EA7\u522B\u3002\nCSS ID: `#sizeinfo`"
		},
		"File size": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_ui_filesize",
						"field": "name"
					}
				]
			},
			"pt-BR": "Tamanho do arquivo",
			"ru": "\u0420\u0430\u0437\u043C\u0435\u0440 \u0444\u0430\u0439\u043B\u0430",
			"zh-CN": "\u6587\u4EF6\u5927\u5C0F"
		},
		"Displays the media's file size on top of the UI. For the moment, this will not work with partially loaded media if 'Avoid HEAD request for partially loaded media' is enabled.\nCSS ID: `#sizeinfo`": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_ui_filesize",
						"field": "description"
					}
				]
			},
			"pt-BR": "Exibe o tamanho do arquivo de m\u00EDdia no topo da UI. No momento, isso n\u00E3o funcionar\u00E1 com m\u00EDdia carregada parcialmente se 'Evitar solicita\u00E7\u00E3o HEAD para m\u00EDdia carregada parcialmente' estiver habilitado.\nID CSS: `#sizeinfo`",
			"ru": "\u041E\u0442\u043E\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u0440\u0430\u0437\u043C\u0435\u0440 \u0444\u0430\u0439\u043B\u0430 \u043C\u0435\u0434\u0438\u0430 \u0432 \u0432\u0435\u0440\u0445\u043D\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u0438\u043D\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430. \u041D\u0430 \u0434\u0430\u043D\u043D\u044B\u0439 \u043C\u043E\u043C\u0435\u043D\u0442 \u044D\u0442\u043E \u043D\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043E\u0442\u0430\u0442\u044C \u0441 \u0447\u0430\u0441\u0442\u0438\u0447\u043D\u043E \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043D\u043D\u044B\u043C\u0438 \u043C\u0435\u0434\u0438\u0430, \u0435\u0441\u043B\u0438 \u0432\u043A\u043B\u044E\u0447\u0451\u043D \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440 '\u0418\u0437\u0431\u0435\u0433\u0430\u0442\u044C \u0437\u0430\u043F\u0440\u043E\u0441\u0430 HEAD \u0434\u043B\u044F \u0447\u0430\u0441\u0442\u0438\u0447\u043D\u043E \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043D\u043D\u044B\u0445 \u043C\u0435\u0434\u0438\u0430'.\nCSS ID: `#sizeinfo`",
			"zh-CN": "\u5728\u754C\u9762\u4E0A\u663E\u793A\u5A92\u4F53\u7684\u6587\u4EF6\u5927\u5C0F\u3002\u76EE\u524D\uFF0C\u5982\u679C\u542F\u7528\u4E86\u201C\u907F\u514D\u5BF9\u90E8\u5206\u52A0\u8F7D\u7684\u5A92\u4F53\u4F7F\u7528 HEAD \u8BF7\u6C42\u201D\uFF0C\u5219\u6B64\u9879\u65E0\u6548\u3002\nCSS ID: `#sizeinfo`"
		},
		"Gallery counter": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_ui_gallerycounter",
						"field": "name"
					}
				]
			},
			"es": "N\u00FAmero de im\u00E1genes a contar en la galer\u00EDa",
			"fr": "Nombre d'images dans la galerie",
			"ko": "\uAC24\uB7EC\uB9AC \uC774\uBBF8\uC9C0 \uC218",
			"pt-BR": "Contador da galeria",
			"ru": "\u0421\u0447\u0451\u0442\u0447\u0438\u043A \u0433\u0430\u043B\u0435\u0440\u0435\u0438",
			"zh-CN": "\u56FE\u5E93\u8BA1\u6570\u5668"
		},
		"Enables a gallery counter on top of the UI.\nCSS ID: `#gallerycounter`": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_ui_gallerycounter",
						"field": "description"
					}
				]
			},
			"pt-BR": "Habilita um contador da galeria no topo da UI.\nID CSS: `#gallerycounter`",
			"ru": "\u041E\u0442\u043E\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u0441\u0447\u0451\u0442\u0447\u0438\u043A \u0433\u0430\u043B\u0435\u0440\u0435\u0438 \u0432 \u0432\u0435\u0440\u0445\u043D\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u043E\u0433\u043E \u0438\u043D\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430.\nCSS ID: `#gallerycounter`",
			"zh-CN": "\u542F\u7528\u754C\u9762\u4E0A\u7684\u56FE\u5E93\u8BA1\u6570\u5668\u3002\nCSS ID: `#gallerycounter`"
		},
		"Gallery counter max": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_ui_gallerymax",
						"field": "name"
					}
				]
			},
			"es": "N\u00FAmero m\u00E1ximo de im\u00E1genes a contar para la galer\u00EDa",
			"fr": "Nombre max d'images a compter pour la galerie",
			"ko": "\uAC24\uB7EC\uB9AC \uC774\uBBF8\uC9C0 \uC218\uC758 \uCD5C\uB300\uAC12",
			"pt-BR": "M\u00E1ximo do contador da galeria",
			"ru": "\u041C\u0430\u043A\u0441\u0438\u043C\u0430\u043B\u044C\u043D\u044B\u0439 \u0441\u0447\u0451\u0442\u0447\u0438\u043A \u0433\u0430\u043B\u0435\u0440\u0435\u0438",
			"zh-CN": "\u56FE\u5E93\u8BA1\u6570\u5668\u4E0A\u9650"
		},
		"Maximum amount of images to check in the counter (this can be slightly CPU-intensive)": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_ui_gallerymax",
						"field": "description"
					}
				]
			},
			"pt-BR": "Quantidade m\u00E1xima de imagens a verificar no contador (isso pode exigir um pouco de CPU)",
			"ru": "\u041C\u0430\u043A\u0441\u0438\u043C\u0430\u043B\u044C\u043D\u043E\u0435 \u043A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0439 \u0434\u043B\u044F \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0438 \u0432 \u0441\u0447\u0451\u0442\u0447\u0438\u043A\u0435 (\u044D\u0442\u043E \u043C\u043E\u0436\u0435\u0442 \u0431\u044B\u0442\u044C \u0441\u043B\u0435\u0433\u043A\u0430 \u0440\u0435\u0441\u0443\u0440\u0441\u043E\u0451\u043C\u043A\u0438\u043C \u0434\u043B\u044F \u043F\u0440\u043E\u0446\u0435\u0441\u0441\u043E\u0440\u0430)",
			"zh-CN": "\u8BE5\u8BA1\u6570\u5668\u663E\u793A\u56FE\u50CF\u6570\u91CF\u4E0A\u9650\uFF08\u53EF\u80FD\u6D88\u8017\u8F83\u591A CPU \u8D44\u6E90\uFF09"
		},
		"Gallery buttons": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_ui_gallerybtns",
						"field": "name"
					}
				]
			},
			"pt-BR": "Bot\u00F5es da galeria",
			"ru": "\u041A\u043D\u043E\u043F\u043A\u0438 \u0433\u0430\u043B\u0435\u0440\u0435\u0438",
			"zh-CN": "\u56FE\u5E93\u6309\u94AE"
		},
		"Enables buttons to go left/right in the gallery.\nCSS IDs: `#galleryprevbtn`, `#gallerynextbtn`": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_ui_gallerybtns",
						"field": "description"
					}
				]
			},
			"pt-BR": "Habilita bot\u00F5es para ir \u00E0 esquerda/direita na galeria.\nIDs CSS: `#galleryprevbtn`, `#gallerynextbtn`",
			"ru": "\u0412\u043A\u043B\u044E\u0447\u0430\u0435\u0442 \u043A\u043D\u043E\u043F\u043A\u0438 \u0432\u043B\u0435\u0432\u043E/\u0432\u043F\u0440\u0430\u0432\u043E \u0432 \u0433\u0430\u043B\u0435\u0440\u0435\u0435.\nCSS ID: `#galleryprevbtn`, `#gallerynextbtn`",
			"zh-CN": "\u542F\u7528\u5728\u56FE\u5E93\u4E2D\u5411\u5DE6/\u53F3\u79FB\u52A8\u7684\u6309\u94AE\u3002\nCSS IDs: `#galleryprevbtn`, `#gallerynextbtn`"
		},
		"Close Button": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_ui_closebtn",
						"field": "name"
					}
				]
			},
			"pt-BR": "Bot\u00E3o Fechar",
			"ru": "\u041A\u043D\u043E\u043F\u043A\u0430 \u0437\u0430\u043A\u0440\u044B\u0442\u0438\u044F",
			"zh-CN": "\u5173\u95ED\u6309\u94AE"
		},
		"Enables a button to close the popup.\nCSS ID: `#closebtn`": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_ui_closebtn",
						"field": "description"
					}
				]
			},
			"pt-BR": "Habilita um bot\u00E3o para fechar o popup.\nID CSS: `#closebtn`",
			"ru": "\u0412\u043A\u043B\u044E\u0447\u0430\u0435\u0442 \u043A\u043D\u043E\u043F\u043A\u0443 \u0434\u043B\u044F \u0437\u0430\u043A\u0440\u044B\u0442\u0438\u044F \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430.\nCSS ID: `#closebtn`",
			"zh-CN": "\u542F\u7528\u5173\u95ED\u5F53\u524D\u5F39\u7A97\u7684\u6309\u94AE\u3002\nCSS ID: `#closebtn`"
		},
		"Options Button": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_ui_optionsbtn",
						"field": "name"
					}
				]
			},
			"es": "Bot\u00F3n de Opciones",
			"ko": "\uC124\uC815 \uB9C1\uD06C",
			"pt-BR": "Bot\u00E3o de Op\u00E7\u00F5es",
			"ru": "\u041A\u043D\u043E\u043F\u043A\u0430 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u043E\u0432",
			"zh-CN": "\u9009\u9879\u6309\u94AE"
		},
		"Enables a button to go to this page.\nCSS ID: `#optionsbtn`": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_ui_optionsbtn",
						"field": "description"
					}
				]
			},
			"pt-BR": "Habilita um bot\u00E3o para ir para esta p\u00E1gina.\nID CSS: `#optionsbtn`",
			"ru": "\u0412\u043A\u043B\u044E\u0447\u0430\u0435\u0442 \u043A\u043D\u043E\u043F\u043A\u0443 \u0434\u043B\u044F \u043F\u0435\u0440\u0435\u0445\u043E\u0434\u0430 \u043D\u0430 \u044D\u0442\u0443 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0443.\nCSS ID: `#optionsbtn`",
			"zh-CN": "\u542F\u7528\u8BBF\u95EE\u9009\u9879\u9875\u9762\uFF08\u672C\u9875\u9762\uFF09\u7684\u6309\u94AE\u3002\nCSS ID: `#optionsbtn`"
		},
		"Download Button": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_ui_downloadbtn",
						"field": "name"
					}
				]
			},
			"pt-BR": "Bot\u00E3o de Download",
			"ru": "\u041A\u043D\u043E\u043F\u043A\u0430 \u0441\u043A\u0430\u0447\u0438\u0432\u0430\u043D\u0438\u044F",
			"zh-CN": "\u4E0B\u8F7D\u6309\u94AE"
		},
		"Enables a button to download the image.\nCSS ID: `#downloadbtn`": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_ui_downloadbtn",
						"field": "description"
					}
				]
			},
			"pt-BR": "Habilita um bot\u00E3o para baixar a imagem.\nID CSS: `#downloadbtn`",
			"ru": "\u0412\u043A\u043B\u044E\u0447\u0430\u0435\u0442 \u043A\u043D\u043E\u043F\u043A\u0443 \u0441\u043A\u0430\u0447\u0438\u0432\u0430\u043D\u0438\u044F \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F.\nCSS ID: `#downloadbtn`",
			"zh-CN": "\u542F\u7528\u4E0B\u8F7D\u8BE5\u56FE\u50CF\u7684\u6309\u94AE\u3002\nCSS ID: `#downloadbtn`"
		},
		"Rotation Buttons": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_ui_rotationbtns",
						"field": "name"
					}
				]
			},
			"pt-BR": "Bot\u00F5es de Rota\u00E7\u00E3o",
			"ru": "\u041A\u043D\u043E\u043F\u043A\u0438 \u0432\u0440\u0430\u0449\u0435\u043D\u0438\u044F",
			"zh-CN": "\u65CB\u8F6C\u6309\u94AE"
		},
		"Enables buttons on the UI to rotate the image by 90 degrees.\nCSS IDs: `#rotleftbtn`, `#rotrightbtn`": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_ui_rotationbtns",
						"field": "description"
					}
				]
			},
			"pt-BR": "Habilita bot\u00F5es na UI para girar a imagem em 90 graus.\nIDs CSS: `#rotleftbtn`, `#rotrightbtn`",
			"ru": "\u0412\u043A\u043B\u044E\u0447\u0430\u0435\u0442 \u043A\u043D\u043E\u043F\u043A\u0438 \u043D\u0430 \u0438\u043D\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435 \u0434\u043B\u044F \u043F\u043E\u0432\u043E\u0440\u043E\u0442\u0430 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F \u043D\u0430 90 \u0433\u0440\u0430\u0434\u0443\u0441\u043E\u0432.\nCSS ID: `#rotleftbtn`, `#rotrightbtn`",
			"zh-CN": "\u542F\u7528\u5728\u754C\u9762\u4E0A\u5C06\u56FE\u50CF\u65CB\u8F6C 90 \u5EA6\u7684\u6309\u94AE\u3002\nCSS IDs: `#rotleftbtn`, `#rotrightbtn`"
		},
		"Caption": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_ui_caption",
						"field": "name"
					}
				]
			},
			"pt-BR": "Legenda",
			"ru": "\u041F\u043E\u0434\u043F\u0438\u0441\u044C",
			"zh-CN": "\u6807\u9898"
		},
		"Shows the image's caption (if available) at the top.\nCSS ID: `#caption`": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_ui_caption",
						"field": "description"
					}
				]
			},
			"pt-BR": "Mostra a legenda da imagem (se dispon\u00EDvel) no topo.\nID CSS: `#caption`",
			"ru": "\u041F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0435\u0442 \u0432\u0432\u0435\u0440\u0445\u0443 \u043F\u043E\u0434\u043F\u0438\u0441\u044C \u043A \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044E (\u0435\u0441\u043B\u0438 \u0435\u0441\u0442\u044C).\nCSS ID: `#caption`",
			"zh-CN": "\u5728\u9876\u7AEF\u663E\u793A\u56FE\u50CF\u7684\u6807\u9898\uFF08\u5982\u679C\u53EF\u7528\uFF09\u3002\nCSS ID: `#caption`"
		},
		"Wrap caption text": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_ui_wrap_caption",
						"field": "name"
					}
				]
			},
			"pt-BR": "Quebrar texto da legenda",
			"ru": "\u041E\u0431\u0435\u0440\u043D\u0443\u0442\u044C \u0442\u0435\u043A\u0441\u0442 \u043F\u043E\u0434\u043F\u0438\u0441\u0438",
			"zh-CN": "\u6807\u9898\u6587\u672C\u6362\u884C"
		},
		"Wraps the caption if it's too long": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_ui_wrap_caption",
						"field": "description"
					}
				]
			},
			"pt-BR": "Quebra a legenda se for muito longa",
			"ru": "\u0421\u043A\u0440\u044B\u0432\u0430\u0435\u0442 \u0447\u0430\u0441\u0442\u044C \u043F\u043E\u0434\u043F\u0438\u0441\u0438, \u0435\u0441\u043B\u0438 \u043E\u043D\u0430 \u0441\u043B\u0438\u0448\u043A\u043E\u043C \u0434\u043B\u0438\u043D\u043D\u0430\u044F.",
			"zh-CN": "\u6807\u9898\u6587\u672C\u592A\u957F\u65F6\u81EA\u52A8\u6362\u884C"
		},
		"Link original page in caption": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_ui_caption_link_page",
						"field": "name"
					}
				]
			},
			"pt-BR": "Vincular p\u00E1gina original na legenda",
			"ru": "\u0421\u0441\u044B\u043B\u043A\u0430 \u043D\u0430 \u043E\u0440\u0438\u0433\u0438\u043D\u0430\u043B\u044C\u043D\u0443\u044E \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0443 \u0432 \u043F\u043E\u0434\u043F\u0438\u0441\u0438",
			"zh-CN": "\u6807\u9898\u94FE\u63A5\u539F\u59CB\u9875\u9762"
		},
		"Links the original page (if it exists) in the caption": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_ui_caption_link_page",
						"field": "description"
					}
				]
			},
			"pt-BR": "Vincula a p\u00E1gina original (se existir) na legenda",
			"ru": "\u0421\u0441\u044B\u043B\u043A\u0430 \u0432 \u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043A\u0435 \u043D\u0430 \u043E\u0440\u0438\u0433\u0438\u043D\u0430\u043B\u044C\u043D\u0443\u044E \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0443 (\u0435\u0441\u043B\u0438 \u043E\u043D\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442).",
			"zh-CN": "\u5C06\u6807\u9898\u94FE\u63A5\u5230\u539F\u59CB\u9875\u9762\uFF08\u5982\u6709\uFF09"
		},
		"Underline links": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_ui_link_underline",
						"field": "name"
					}
				]
			},
			"pt-BR": "Sublinhar links",
			"ru": "\u041F\u043E\u0434\u0447\u0451\u0440\u043A\u0438\u0432\u0430\u043D\u0438\u0435 \u0441\u0441\u044B\u043B\u043E\u043A",
			"zh-CN": "\u94FE\u63A5\u4E0B\u5212\u7EBF"
		},
		"Adds an underline to links (such as the original page)": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_ui_link_underline",
						"field": "description"
					}
				]
			},
			"pt-BR": "Adiciona um sublinhado aos links (como o da p\u00E1gina original)",
			"ru": "\u0414\u043E\u0431\u0430\u0432\u043B\u044F\u0435\u0442 \u043F\u043E\u0434\u0447\u0435\u0440\u043A\u0438\u0432\u0430\u043D\u0438\u0435 \u043A \u0441\u0441\u044B\u043B\u043A\u0430\u043C (\u043D\u0430\u043F\u0440\u0438\u043C\u0435\u0440, \u043E\u0440\u0438\u0433\u0438\u043D\u0430\u043B\u044C\u043D\u0430\u044F \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0430).",
			"zh-CN": "\u5411\u94FE\u63A5\uFF08\u5982\u539F\u59CB\u9875\u9762\uFF09\u6DFB\u52A0\u4E0B\u5212\u7EBF"
		},
		"Keep popup open until": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_close_behavior",
						"field": "name"
					}
				]
			},
			"es": "Mantener popup abierto hasta que",
			"ko": "\uD31D\uC5C5 \uB2EB\uC73C\uB824\uBA74",
			"pt-BR": "Manter pop-up aberto at\u00E9",
			"ru": "\u0412\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u043E\u0442\u043A\u0440\u044B\u0442\u043E \u0434\u043E \u0442\u0435\u0445 \u043F\u043E\u0440, \u043F\u043E\u043A\u0430",
			"zh-CN": "\u4FDD\u6301\u5F39\u7A97\u5F00\u542F\u76F4\u5230"
		},
		"Closes the popup when the selected condition is met": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_close_behavior",
						"field": "description"
					}
				]
			},
			"ko": "\uC120\uD0DD\uD55C \uC870\uAC74\uC774 \uCDA9\uC871\uB418\uBA74 \uD31D\uC5C5 \uB2EB\uAE30",
			"pt-BR": "Fecha o pop-up quando a condi\u00E7\u00E3o selecionada for atendida",
			"ru": "\u0417\u0430\u043A\u0440\u044B\u0432\u0430\u0435\u0442 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u043F\u0440\u0438 \u0432\u044B\u043F\u043E\u043B\u043D\u0435\u043D\u0438\u0438 \u0432\u044B\u0431\u0440\u0430\u043D\u043D\u043E\u0433\u043E \u0443\u0441\u043B\u043E\u0432\u0438\u044F.",
			"zh-CN": "\u6EE1\u8DB3\u9009\u5B9A\u6761\u4EF6\u65F6\u5173\u95ED\u5F39\u7A97"
		},
		"Any trigger is released": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_close_behavior",
						"field": "options.any.name"
					}
				]
			},
			"es": "Cualquier acci\u00F3n se deja ir",
			"ko": "\uC5B4\uB5A4 \uB3D9\uC791\uC5D0\uB3C4 \uB2EB\uD798",
			"pt-BR": "Qualquer gatilho for liberado",
			"ru": "\u041B\u044E\u0431\u0430\u044F \u043A\u043D\u043E\u043F\u043A\u0430 \u0441\u0440\u0430\u0431\u0430\u0442\u044B\u0432\u0430\u043D\u0438\u044F \u043E\u0442\u043F\u0443\u0449\u0435\u043D\u0430",
			"zh-CN": "\u677E\u5F00\u4EFB\u4F55\u89E6\u53D1\u5668"
		},
		"All triggers are released": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_close_behavior",
						"field": "options.all.name"
					}
				]
			},
			"ko": "\uBAA8\uB4E0 \uB3D9\uC791\uC5D0\uC11C \uB2EB\uD798",
			"pt-BR": "Todos os gatilhos forem liberados",
			"ru": "\u0412\u0441\u0435 \u043A\u043D\u043E\u043F\u043A\u0438 \u0441\u0440\u0430\u0431\u0430\u0442\u044B\u0432\u0430\u043D\u0438\u044F \u043E\u0442\u043F\u0443\u0449\u0435\u043D\u044B",
			"zh-CN": "\u677E\u5F00\u5168\u90E8\u89E6\u53D1\u5668"
		},
		"ESC/Close is pressed": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_close_behavior",
						"field": "options.esc.name"
					}
				]
			},
			"ko": "ESC/\uB2EB\uAE30 \uB204\uB974\uAE30",
			"pt-BR": "ESC/Fechar for pressionado",
			"ru": "\u041D\u0430\u0436\u0430\u0442\u043E ESC/\u0417\u0430\u043A\u0440\u044B\u0442\u044C",
			"zh-CN": "\u6309\u4E0B ESC/Close"
		},
		"Don't close until mouse leaves": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_close_need_mouseout",
						"field": "name"
					}
				]
			},
			"ko": "\uB9C8\uC6B0\uC2A4\uAC00 \uB5A0\uB0A0 \uB54C\uAE4C\uC9C0 \uB2EB\uC9C0 \uB9C8\uC2ED\uC2DC\uC624.",
			"pt-BR": "N\u00E3o fechar at\u00E9 o mouse sair",
			"ru": "\u041D\u0435 \u0437\u0430\u043A\u0440\u044B\u0432\u0430\u0442\u044C \u043F\u043E\u043A\u0430 \u043A\u0443\u0440\u0441\u043E\u0440 \u043C\u044B\u0448\u0438 \u043D\u0435 \u0431\u0443\u0434\u0435\u0442 \u0443\u0431\u0440\u0430\u043D",
			"zh-CN": "\u9F20\u6807\u79FB\u5F00\u524D\u4E0D\u5173\u95ED"
		},
		"If true, this keeps the popup open even if all triggers are released if the mouse is still over the image": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_close_need_mouseout",
						"field": "description"
					}
				]
			},
			"ko": "\uD65C\uC131\uD654 \uC2DC, \uB9C8\uC6B0\uC2A4\uAC00 \uC774\uBBF8\uC9C0 \uC704\uC5D0 \uC788\uB294 \uACBD\uC6B0 \uBAA8\uB4E0 \uB3D9\uC791\uC5D0\uC11C \uB2EB\uD798\uC744 \uC120\uD0DD\uD588\uB354\uB77C\uB3C4 \uD31D\uC5C5\uC774 \uACC4\uC18D \uC5F4\uB9B0 \uC0C1\uD0DC\uB85C \uC720\uC9C0\uB428",
			"pt-BR": "Se verdadeiro, mant\u00E9m o pop-up aberto mesmo que todos os gatilhos sejam liberados se o mouse ainda estiver sobre a imagem",
			"ru": "\u0415\u0441\u043B\u0438 true, \u0442\u043E\u0433\u0434\u0430 \u0435\u0441\u043B\u0438 \u043C\u044B\u0448\u044C \u0432\u0441\u0451 \u0435\u0449\u0435 \u043D\u0430\u0445\u043E\u0434\u0438\u0442\u0441\u044F \u043D\u0430 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0438, \u0442\u043E \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u043E\u0441\u0442\u0430\u0451\u0442\u0441\u044F \u043E\u0442\u043A\u0440\u044B\u0442\u044B\u043C, \u0434\u0430\u0436\u0435 \u0435\u0441\u043B\u0438 \u0432\u0441\u0435 \u0441\u0440\u0430\u0431\u0430\u0442\u044B\u0432\u0430\u043D\u0438\u044F \u043E\u0442\u043F\u0443\u0449\u0435\u043D\u044B.",
			"zh-CN": "\u5982\u679C\u542F\u7528\uFF0C\u677E\u5F00\u6240\u6709\u89E6\u53D1\u5668\u540E\uFF0C\u5047\u5982\u9F20\u6807\u4ECD\u60AC\u505C\u5728\u56FE\u50CF\u4E0A\uFF0C\u5F39\u7A97\u4FDD\u6301\u5F00\u542F"
		},
		"Threshold to leave image": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_jitter_threshold",
						"field": "name"
					}
				]
			},
			"ko": "\uC774\uBBF8\uC9C0\uB97C \uB5A0\uB098\uAE30 \uC704\uD55C \uC784\uACC4\uAC12",
			"pt-BR": "Limite para sair da imagem",
			"ru": "\u041F\u043E\u0440\u043E\u0433 \u0434\u043B\u044F \u0432\u044B\u0445\u043E\u0434\u0430 \u0438\u0437 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F",
			"zh-CN": "\u79FB\u5F00\u56FE\u50CF\u7684\u95E8\u9650\u503C"
		},
		"How many pixels outside of the image before the cursor is considered to have left the image": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_jitter_threshold",
						"field": "description"
					}
				]
			},
			"ko": "\uCEE4\uC11C\uAC00 \uC774\uBBF8\uC9C0\uB97C \uB5A0\uB09C \uAC83\uC73C\uB85C \uD30C\uC545\uD560 \uC218 \uC788\uB294 \uC774\uBBF8\uC9C0 \uD53D\uC140 \uC218",
			"pt-BR": "Quantos pixels fora da imagem antes que o cursor seja considerado como tendo deixado a imagem",
			"ru": "\u0421\u043A\u043E\u043B\u044C\u043A\u043E \u043F\u0438\u043A\u0441\u0435\u043B\u0435\u0439 \u0437\u0430 \u043F\u0440\u0435\u0434\u0435\u043B\u0430\u043C\u0438 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F \u043F\u0435\u0440\u0435\u0434 \u043A\u0443\u0440\u0441\u043E\u0440\u043E\u043C \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044F \u043F\u043E\u043A\u0438\u043D\u0443\u0432\u0448\u0438\u043C\u0438 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435.",
			"zh-CN": "\u9F20\u6807\u6307\u9488\u79BB\u5F00\u56FE\u50CF\u5916\u7F18\u591A\u5C11\u50CF\u7D20\u89C6\u4F5C\u79FB\u5F00\u56FE\u50CF"
		},
		"Leaving thumbnail cancels loading": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_cancel_popup_when_elout",
						"field": "name"
					}
				]
			},
			"ko": "\uBBF8\uB9AC\uBCF4\uAE30\uB97C \uB0A8\uAE30\uBA74 \uB85C\uB529\uC774 \uCDE8\uC18C\uB428",
			"pt-BR": "Sair da miniatura cancela o carregamento",
			"ru": "\u041E\u0442\u043C\u0435\u043D\u044F\u0442\u044C \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0443, \u0435\u0441\u043B\u0438 \u043C\u0438\u043D\u0438\u0430\u0442\u044E\u0440\u0430 \u043F\u043E\u043A\u0438\u043D\u0443\u0442\u0430",
			"zh-CN": "\u79BB\u5F00\u7F29\u7565\u56FE\u5219\u53D6\u6D88\u52A0\u8F7D"
		},
		"Cancels the current popup loading when the cursor has left the thumbnail image": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_cancel_popup_when_elout",
						"field": "description"
					}
				]
			},
			"ko": "\uCEE4\uC11C\uAC00 \uCD95\uC18C \uC774\uBBF8\uC9C0\uC5D0\uC11C \uBC97\uC5B4\uB0A0 \uB54C \uD604\uC7AC \uD31D\uC5C5 \uB85C\uB529 \uCDE8\uC18C",
			"pt-BR": "Cancela o carregamento do pop-up atual quando o cursor sai da imagem em miniatura",
			"ru": "\u041E\u0442\u043C\u0435\u043D\u044F\u0435\u0442 \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0443 \u0442\u0435\u043A\u0443\u0449\u0435\u0433\u043E \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430, \u043A\u043E\u0433\u0434\u0430 \u043A\u0443\u0440\u0441\u043E\u0440 \u043F\u043E\u043A\u0438\u043D\u0443\u043B \u043C\u0438\u043D\u0438\u0430\u0442\u044E\u0440\u0443 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F.",
			"zh-CN": "\u9F20\u6807\u6307\u9488\u79BB\u5F00\u7F29\u7565\u56FE\u65F6\u53D6\u6D88\u5F53\u524D\u5F39\u7A97\u7684\u52A0\u8F7D"
		},
		"ESC cancels loading": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_cancel_popup_with_esc",
						"field": "name"
					}
				]
			},
			"ko": "ESC \uB85C\uB529 \uCDE8\uC18C",
			"pt-BR": "ESC cancela carregamento",
			"ru": "ESC \u043E\u0442\u043C\u0435\u043D\u044F\u0435\u0442 \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0443",
			"zh-CN": "ESC \u952E\u53D6\u6D88\u52A0\u8F7D"
		},
		"Cancels the current popup loading if ESC is pressed": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_cancel_popup_with_esc",
						"field": "description"
					}
				]
			},
			"ko": "ESC\uB97C \uB204\uB974\uBA74 \uD604\uC7AC \uD31D\uC5C5 \uB85C\uB529\uC774 \uCDE8\uC18C\uB428",
			"pt-BR": "Cancela o carregamento do pop-up atual se ESC for pressionado",
			"ru": "\u041E\u0442\u043C\u0435\u043D\u044F\u0435\u0442 \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0443 \u0442\u0435\u043A\u0443\u0449\u0435\u0433\u043E \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430 \u043F\u0440\u0438 \u043D\u0430\u0436\u0430\u0442\u0438\u0438 \u043A\u043D\u043E\u043A\u0438 ESC.",
			"zh-CN": "\u6309\u4E0B ESC \u952E\u65F6\u53D6\u6D88\u5F53\u524D\u5F39\u7A97\u7684\u52A0\u8F7D"
		},
		"Releasing triggers cancels loading": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_cancel_popup_when_release",
						"field": "name"
					}
				]
			},
			"ko": "\uD2B8\uB9AC\uAC70\uB97C \uD574\uC81C\uD558\uBA74 \uB85C\uB529\uC774 \uCDE8\uC18C\uB428",
			"pt-BR": "Liberar gatilhos cancela carregamento",
			"ru": "\u041E\u0442\u043C\u0435\u043D\u044F\u0442\u044C \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0443, \u0435\u0441\u043B\u0438 \u043A\u043D\u043E\u043F\u043A\u0438 \u0430\u043A\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u043E\u0442\u043F\u0443\u0449\u0435\u043D\u044B",
			"zh-CN": "\u677E\u5F00\u89E6\u53D1\u5668\u53D6\u6D88\u52A0\u8F7D"
		},
		"Cancels the current popup loading if all/any triggers are released (as set by the \"Keep popup open until\" setting)": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_cancel_popup_when_release",
						"field": "description"
					}
				]
			},
			"ko": "\uC5B4\uB5A4/\uBAA8\uB4E0 \uB3D9\uC791\uC5D0 \uB2EB\uD798\uC744 \uC120\uD0DD\uD55C \uACBD\uC6B0 \uD604\uC7AC \uD31D\uC5C5 \uB85C\uB529 \uCDE8\uC18C (\"\uD31D\uC5C5\uC744 \uB2EB\uC73C\uB824\uBA74\" \uC124\uC815\uC5D0 \uC758\uC874\uD568)",
			"pt-BR": "Cancela o carregamento do popup atual se todos/quaisquer gatilhos forem liberados (conforme definido pela configura\u00E7\u00E3o \"Manter popup aberto at\u00E9\")",
			"ru": "\u041E\u0442\u043C\u0435\u043D\u044F\u0435\u0442 \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0443 \u0442\u0435\u043A\u0443\u0449\u0435\u0433\u043E \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430, \u0435\u0441\u043B\u0438 \u0432\u0441\u0435/\u043B\u044E\u0431\u044B\u0435 \u043A\u043D\u043E\u043F\u043A\u0438 \u0441\u0440\u0430\u0431\u0430\u0442\u044B\u0432\u0430\u043D\u0438\u044F \u043E\u0442\u043F\u0443\u0449\u0435\u043D\u044B (\u0432 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0430\u043C\u0438 '\u041E\u0441\u0442\u0430\u0432\u043B\u044F\u0442\u044C \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u043E\u0442\u043A\u0440\u044B\u0442\u044B\u043C \u0434\u043E \u0442\u0435\u0445 \u043F\u043E\u0440, \u043F\u043E\u043A\u0430'",
			"zh-CN": "\u5982\u679C\u677E\u5F00\u4E86\u6240\u6709/\u4EFB\u4F55\u89E6\u53D1\u5668\uFF0C\u5E76\u4E14\u8BBE\u7F6E\u4E86\u201C\u4FDD\u6301\u5F39\u7A97\u5F00\u542F\u76F4\u5230\u201D\uFF0C\u53D6\u6D88\u5F53\u524D\u7684\u5F39\u7A97\u52A0\u8F7D"
		},
		"Automatically close after timeout": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_auto_close_popup",
						"field": "name"
					}
				]
			},
			"ko": "\uC2DC\uAC04 \uCD08\uACFC \uD6C4 \uC790\uB3D9\uC73C\uB85C \uB2EB\uAE30",
			"pt-BR": "Fechar automaticamente ap\u00F3s tempo limite",
			"ru": "\u0410\u0432\u0442\u043E\u0437\u0430\u043A\u0440\u044B\u0442\u0438\u0435 \u043F\u043E\u0441\u043B\u0435 \u0438\u0441\u0442\u0435\u0447\u0435\u043D\u0438\u044F \u0432\u0440\u0435\u043C\u0435\u043D\u0438",
			"zh-CN": "\u8D85\u65F6\u540E\u81EA\u52A8\u5173\u95ED"
		},
		"Closes the popup automatically after a specified period of time has elapsed": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_auto_close_popup",
						"field": "description"
					}
				]
			},
			"ko": "\uC9C0\uC815\uB41C \uC2DC\uAC04\uC774 \uACBD\uACFC\uD55C \uD6C4 \uD31D\uC5C5 \uC790\uB3D9 \uB2EB\uAE30",
			"pt-BR": "Fecha o pop-up automaticamente ap\u00F3s um per\u00EDodo de tempo especificado",
			"ru": "\u0410\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0438 \u0437\u0430\u043A\u0440\u044B\u0432\u0430\u0435\u0442 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u043F\u043E \u0438\u0441\u0442\u0435\u0447\u0435\u043D\u0438\u0438 \u0437\u0430\u0434\u0430\u043D\u043D\u043E\u0433\u043E \u043F\u0435\u0440\u0438\u043E\u0434\u0430 \u0432\u0440\u0435\u043C\u0435\u043D\u0438.",
			"zh-CN": "\u6307\u5B9A\u65F6\u95F4\u540E\u81EA\u52A8\u5173\u95ED\u5F39\u7A97"
		},
		"Timeout to close popup": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_auto_close_popup_time",
						"field": "name"
					}
				]
			},
			"ko": "\uD31D\uC5C5\uC744 \uB2EB\uAE30 \uC704\uD55C \uC2DC\uAC04 \uCD08\uACFC \uC2DC\uAC04(\uCD08)",
			"pt-BR": "Tempo limite para fechar o pop-up",
			"ru": "\u0412\u0440\u0435\u043C\u0435\u043D\u0438 \u0434\u043E \u0437\u0430\u043A\u0440\u044B\u0442\u0438\u044F \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430",
			"zh-CN": "\u5173\u95ED\u5F39\u7A97\u7684\u8D85\u65F6"
		},
		"Amount of time to elapse before automatically closing the popup": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_auto_close_popup_time",
						"field": "description"
					}
				]
			},
			"ko": "\uD31D\uC5C5\uC744 \uC790\uB3D9\uC73C\uB85C \uB2EB\uAE30 \uC804 \uACBD\uACFC \uC2DC\uAC04",
			"pt-BR": "Tempo para fechar o pop-up automaticamente",
			"ru": "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0432\u0440\u0435\u043C\u0435\u043D\u0438, \u043A\u043E\u0442\u043E\u0440\u043E\u0435 \u0434\u043E\u043B\u0436\u043D\u043E \u043F\u0440\u043E\u0439\u0442\u0438 \u0434\u043E \u0430\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u043E\u0433\u043E \u0437\u0430\u043A\u0440\u044B\u0442\u0438\u044F \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430.",
			"zh-CN": "\u591A\u4E45\u540E\u81EA\u52A8\u5173\u95ED\u5F39\u7A97"
		},
		"Hold key": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_hold_key",
						"field": "name"
					}
				]
			},
			"ko": "\uACE0\uC815 \uD0A4",
			"pt-BR": "Tecla manter pressionado",
			"ru": "\u041A\u043D\u043E\u043F\u043A\u0430 \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u043D\u0438\u044F",
			"zh-CN": "\u4FDD\u6301\u952E"
		},
		"Hold key that, when pressed, will keep the popup open": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_hold_key",
						"field": "description"
					}
				]
			},
			"ko": "\uACE0\uC815 \uD0A4\uB97C \uB204\uB974\uBA74 \uD31D\uC5C5\uC774 \uC5F4\uB9B0 \uC0C1\uD0DC\uB85C \uC720\uC9C0\uB428",
			"pt-BR": "Tecla que, quando pressionada, mant\u00E9m o pop-up aberto",
			"ru": "\u041A\u043D\u043E\u043F\u043A\u0430 \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u043D\u0438\u044F, \u043A\u043E\u0442\u043E\u0440\u0430\u044F \u043F\u0440\u0438 \u043D\u0430\u0436\u0430\u0442\u0438\u0438 \u0431\u0443\u0434\u0435\u0442 \u043E\u0441\u0442\u0430\u0432\u043B\u044F\u0442\u044C \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u043E\u0442\u043A\u0440\u044B\u0442\u044B\u043C.",
			"zh-CN": "\u6309\u4F4F\u6B64\u952E\u65F6\u5C06\u4FDD\u6301\u5F39\u7A97\u5F00\u542F"
		},
		"Center popup on hold": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_hold_position_center",
						"field": "name"
					}
				]
			},
			"ko": "\uC911\uC559 \uD31D\uC5C5 \uACE0\uC815",
			"pt-BR": "Centralizar pop-up ao manter pressionado",
			"ru": "\u0426\u0435\u043D\u0442\u0440\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u043F\u0440\u0438 \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u043D\u0438\u0438",
			"zh-CN": "\u4FDD\u6301\u65F6\u5F39\u7A97\u5C45\u4E2D"
		},
		"Centers the popup to the middle of the page when the popup is held": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_hold_position_center",
						"field": "description"
					}
				]
			},
			"ko": "\uD31D\uC5C5\uC774 \uC5F4\uB9B4 \uB54C \uD31D\uC5C5\uC744 \uD398\uC774\uC9C0 \uC911\uC559\uC5D0 \uBC30\uCE58",
			"pt-BR": "Centraliza o pop-up no meio da p\u00E1gina quando ele for pressionado",
			"ru": "\u0426\u0435\u043D\u0442\u0440\u0438\u0440\u0443\u0435\u0442 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u043D\u0430 \u0441\u0435\u0440\u0435\u0434\u0438\u043D\u0435 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u044B, \u043A\u043E\u0433\u0434\u0430 \u043E\u043D\u043E \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044F.",
			"zh-CN": "\u5F39\u7A97\u4FDD\u6301\u5448\u73B0\u4E8E\u9875\u9762\u6B63\u4E2D\u5FC3"
		},
		"Override zoom on hold": {
			"_info": {
				"instances": [
					{
						"setting": "popup_hold_zoom",
						"field": "name"
					}
				]
			},
			"pt-BR": "Substituir zoom ao pressionar",
			"ru": "\u041F\u0435\u0440\u0435\u043E\u043F\u0440\u0435\u0434\u0435\u043B\u044F\u0442\u044C \u043C\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0435 \u043F\u0440\u0438 \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u043D\u0438\u0438",
			"zh-CN": "\u4FDD\u6301\u65F6\u8986\u76D6\u7F29\u653E"
		},
		"Overrides the zoom when the popup is held": {
			"_info": {
				"instances": [
					{
						"setting": "popup_hold_zoom",
						"field": "description"
					}
				]
			},
			"pt-BR": "Substitui o zoom quando o pop-up \u00E9 mantido pressionado",
			"ru": "\u041F\u0435\u0440\u0435\u043E\u043F\u0440\u0435\u0434\u0435\u043B\u044F\u0435\u0442 \u043C\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0435 \u043F\u0440\u0438 \u0443\u0434\u0435\u0440\u0436\u0430\u043D\u0438\u0438 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430",
			"zh-CN": "\u4FDD\u6301\u5F39\u7A97\u65F6\u8986\u76D6\u7F29\u653E\u7EA7\u522B"
		},
		"Close popup on unhold": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_hold_close_unhold",
						"field": "name"
					}
				]
			},
			"ko": "\uACE0\uC815 \uD574\uC81C \uC2DC, \uD31D\uC5C5 \uB2EB\uAE30",
			"pt-BR": "Fechar pop-up ao liberar",
			"ru": "\u0417\u044B\u043A\u0440\u044B\u0432\u0430\u0442\u044C \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u043F\u043E\u0441\u043B\u0435 \u043E\u0442\u043F\u0443\u0441\u043A\u0430\u043D\u0438\u044F \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u043D\u0438\u044F",
			"zh-CN": "\u53D6\u6D88\u4FDD\u6301\u65F6\u5173\u95ED\u5F39\u7A97"
		},
		"Closes the popup when the hold key is pressed again, after having previously held the popup": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_hold_close_unhold",
						"field": "description"
					}
				]
			},
			"ko": "\uD31D\uC5C5\uC744 \uACE0\uC815\uD55C \uD6C4 \uACE0\uC815 \uD0A4\uB97C \uB2E4\uC2DC \uB204\uB974\uBA74 \uD31D\uC5C5\uC774 \uB2EB\uD798",
			"pt-BR": "Fecha o pop-up quando a tecla de manter pressionado \u00E9 usada novamente, ap\u00F3s ter precionado a tecla de pop-up anteriormente",
			"ru": "\u0417\u0430\u043A\u0440\u044B\u0432\u0430\u0435\u0442 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u043F\u0440\u0438 \u043F\u043E\u0432\u0442\u043E\u0440\u043D\u043E\u043C \u043D\u0430\u0436\u0430\u0442\u0438\u0438 \u043A\u043B\u0430\u0432\u0438\u0448\u0438 \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u043D\u0438\u044F \u043F\u043E\u0441\u043B\u0435 \u043F\u0440\u0435\u0434\u044B\u0434\u0443\u0449\u0435\u0433\u043E \u0443\u0434\u0435\u0440\u0436\u0430\u043D\u0438\u044F \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430.",
			"zh-CN": "\u66FE\u7ECF\u4FDD\u6301\u5F39\u7A97\u540E\uFF0C\u518D\u6B21\u6309\u4E0B\u4FDD\u6301\u952E\u65F6\u5173\u95ED\u5F39\u7A97"
		},
		"Enable pointer events on hold": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_hold_unclickthrough",
						"field": "name"
					}
				]
			},
			"ko": "\uD3EC\uC778\uD130 \uC774\uBCA4\uD2B8 \uACE0\uC815 \uC0AC\uC6A9",
			"pt-BR": "Habilitar eventos do ponteiro ao sustentar",
			"ru": "\u0421\u043E\u0431\u044B\u0442\u0438\u044F \u0443\u043A\u0430\u0437\u0430\u0442\u0435\u043B\u044F \u043F\u0440\u0438 \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u043D\u0438\u0438",
			"zh-CN": "\u4FDD\u6301\u671F\u95F4\u542F\u7528\u6307\u9488\u4E8B\u4EF6"
		},
		"Enables previously disabled pointer events when the popup is held": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_hold_unclickthrough",
						"field": "description"
					}
				]
			},
			"ko": "\uD31D\uC5C5\uC774 \uACE0\uC815\uB420 \uB54C \uC774\uC804\uC5D0 \uBE44\uD65C\uC131\uD654\uB41C \uD3EC\uC778\uD130 \uC774\uBCA4\uD2B8 \uD65C\uC131\uD654",
			"pt-BR": "Habilita eventos do ponteiro do mouse previamente desabilitados quando a tecla de pop-up \u00E9 pressionada",
			"ru": "\u0412\u043A\u043B\u044E\u0447\u0430\u0435\u0442 \u0440\u0430\u043D\u0435\u0435 \u043E\u0442\u043A\u043B\u044E\u0447\u0435\u043D\u043D\u044B\u0435 \u0441\u043E\u0431\u044B\u0442\u0438\u044F \u0443\u043A\u0430\u0437\u0430\u0442\u0435\u043B\u044F \u043F\u0440\u0438 \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u043D\u0438\u0438 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430.",
			"zh-CN": "\u5F39\u7A97\u4FDD\u6301\u671F\u95F4\u542F\u7528\u5148\u524D\u7981\u7528\u7684\u6307\u9488\u4E8B\u4EF6"
		},
		"Clicking outside the popup closes": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_close_click_outside",
						"field": "name"
					}
				]
			},
			"ko": "\uD31D\uC5C5 \uBC14\uAE65\uCABD\uC744 \uD074\uB9AD\uD558\uBA74 \uB2EB\uD798",
			"pt-BR": "Clicar fora do pop-up fecha",
			"ru": "\u0417\u0430\u043A\u0440\u044B\u0432\u0430\u0442\u044C \u043F\u0440\u0438 \u043D\u0430\u0436\u0430\u0442\u0438\u0438 \u0437\u0430 \u043F\u0440\u0435\u0434\u0435\u043B\u0430\u043C\u0438 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430",
			"zh-CN": "\u70B9\u51FB\u5F39\u7A97\u5916\u5173\u95ED"
		},
		"Closes the popup when the mouse clicks outside of it": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_close_click_outside",
						"field": "description"
					}
				]
			},
			"ko": "\uB9C8\uC6B0\uC2A4\uAC00 \uD31D\uC5C5 \uBC14\uAE65\uCABD\uC744 \uD074\uB9AD\uD560 \uB54C \uD31D\uC5C5 \uB2EB\uAE30",
			"pt-BR": "Fecha o pop-up quando o mouse clica fora dele",
			"ru": "\u0417\u0430\u043A\u0440\u044B\u0432\u0430\u0435\u0442 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u043F\u0440\u0438 \u043D\u0430\u0436\u0430\u0442\u0438\u0438 \u043C\u044B\u0448\u0438 \u0437\u0430 \u0435\u0433\u043E \u043F\u0440\u0435\u0434\u0435\u043B\u0430\u043C\u0438.",
			"zh-CN": "\u9F20\u6807\u5728\u5F39\u7A97\u5916\u5355\u51FB\u65F6\u5173\u95ED\u5F39\u7A97"
		},
		"Close when leaving": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_close_el_policy",
						"field": "name"
					}
				]
			},
			"ko": "\uB5A0\uB0A0 \uB54C \uB2EB\uAE30",
			"pt-BR": "Fechar ao sair",
			"ru": "\u0417\u0430\u043A\u0440\u044B\u0432\u0430\u0442\u044C \u043F\u0440\u0438 \u043F\u043E\u043A\u0438\u0434\u0430\u043D\u0438\u0438",
			"zh-CN": "\u79BB\u5F00\u65F6\u5173\u95ED"
		},
		"Closes the popup when the mouse leaves the thumbnail element, the popup, or both": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_close_el_policy",
						"field": "description"
					}
				]
			},
			"pt-BR": "Fecha o pop-up quando o mouse sai do elemento da miniatura, do pop-up ou de ambos",
			"ru": "\u0417\u0430\u043A\u0440\u044B\u0432\u0430\u0435\u0442 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E, \u043A\u043E\u0433\u0434\u0430 \u043C\u044B\u0448\u044C \u043F\u043E\u043A\u0438\u0434\u0430\u0435\u0442 \u044D\u043B\u0435\u043C\u0435\u043D\u0442 \u043C\u0438\u043D\u0438\u0430\u0442\u044E\u0440\u044B, \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u0438\u043B\u0438 \u0438 \u0442\u043E, \u0438 \u0434\u0440\u0443\u0433\u043E\u0435.",
			"zh-CN": "\u9F20\u6807\u79FB\u51FA\u7F29\u7565\u56FE\u5143\u7D20\u3001\u5F39\u7A97\u6216\u4E0A\u8FF0\u4E24\u8005\u65F6\u5173\u95ED\u5F39\u7A97"
		},
		"Thumbnail": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_close_el_policy",
						"field": "options.thumbnail.name"
					}
				]
			},
			"ko": "\uBBF8\uB9AC\uBCF4\uAE30(\uC378\uB124\uC77C)",
			"pt-BR": "Miniatura",
			"ru": "\u041C\u0438\u043D\u0438\u0430\u0442\u044E\u0440\u044B",
			"zh-CN": "\u7F29\u7565\u56FE"
		},
		"Both": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_close_el_policy",
						"field": "options.both.name"
					}
				]
			},
			"ko": "\uB458 \uB2E4",
			"pt-BR": "Ambos",
			"ru": "\u041E\u0431\u043E\u0438\u0445",
			"zh-CN": "\u4E0A\u8FF0\u4E24\u8005"
		},
		"Use invisible element when waiting": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_wait_use_el",
						"field": "name"
					}
				]
			},
			"pt-BR": "Usar elemento invis\u00EDvel ao aguardar",
			"ru": "\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u043D\u0435\u0432\u0438\u0434\u0438\u043C\u044B\u0439 \u044D\u043B\u0435\u043C\u0435\u043D\u0442 \u043F\u0440\u0438 \u043E\u0436\u0438\u0434\u0430\u043D\u0438\u0438",
			"zh-CN": "\u7B49\u5F85\u65F6\u4F7F\u7528\u9690\u5F62\u5143\u7D20"
		},
		"Creates an invisible element under the cursor when waiting for the popup instead of a style element (can improve performance on websites with many elements, but prevents the cursor from clicking anything while loading the popup)": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_wait_use_el",
						"field": "description"
					}
				]
			},
			"pt-BR": "Cria um elemento invis\u00EDvel abaixo do cursor ao aguardar o pop-up em vez de um elemento de estilo (pode melhorar o desempenho em sites com muitos elementos, mas impede que o cursor clique em qualquer coisa durante o carregamento do pop-up)",
			"ru": "\u0421\u043E\u0437\u0434\u0430\u0451\u0442 \u043D\u0435\u0432\u0438\u0434\u0438\u043C\u044B\u0439 \u044D\u043B\u0435\u043C\u0435\u043D\u0442 \u043F\u043E\u0434 \u043A\u0443\u0440\u0441\u043E\u0440\u043E\u043C \u043F\u0440\u0438 \u043E\u0436\u0438\u0434\u0430\u043D\u0438\u0438 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430 \u0432\u043C\u0435\u0441\u0442\u043E \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430 \u0441\u0442\u0438\u043B\u044F (\u043C\u043E\u0436\u0435\u0442 \u0443\u043B\u0443\u0447\u0448\u0438\u0442\u044C \u043F\u0440\u043E\u0438\u0437\u0432\u043E\u0434\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C \u043D\u0430 \u0441\u0430\u0439\u0442\u0430\u0445 \u0441 \u0431\u043E\u043B\u044C\u0448\u0438\u043C \u043A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E\u043C \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432, \u043D\u043E \u043D\u0435 \u043F\u043E\u0437\u0432\u043E\u043B\u044F\u0435\u0442 \u043A\u0443\u0440\u0441\u043E\u0440\u0443 \u043D\u0430\u0436\u0438\u043C\u0430\u0442\u044C \u043D\u0430 \u0447\u0442\u043E-\u043B\u0438\u0431\u043E \u0432\u043E \u0432\u0440\u0435\u043C\u044F \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0438 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430).",
			"zh-CN": "\u5728\u7B49\u5F85\u5F39\u7A97\u65F6\u5728\u9F20\u6807\u6307\u9488\u4E0B\u65B9\u521B\u5EFA\u4E00\u4E2A\u9690\u5F62\u5143\u7D20\uFF08\u800C\u975E\u6837\u5F0F\u5143\u7D20\uFF09\uFF08\u53EF\u4EE5\u6539\u5584\u6709\u5927\u91CF\u5143\u7D20\u7684\u7F51\u7AD9\u6027\u80FD\uFF0C\u4F46\u8FD9\u4F1A\u963B\u6B62\u52A0\u8F7D\u671F\u95F4\u9F20\u6807\u70B9\u51FB\u4EFB\u4F55\u4E1C\u897F\uFF09"
		},
		"Add popup link to history": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_add_to_history",
						"field": "name"
					}
				]
			},
			"pt-BR": "Adicionar link do pop-up ao hist\u00F3rico",
			"ru": "\u0414\u043E\u0431\u0430\u0432\u043B\u044F\u0442\u044C \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0443\u044E \u0441\u0441\u044B\u043B\u043A\u0443 \u0432 \u0438\u0441\u0442\u043E\u0440\u0438\u044E",
			"zh-CN": "\u6DFB\u52A0\u5F39\u51FA\u7684\u94FE\u63A5\u5230\u5386\u53F2\u8BB0\u5F55"
		},
		"Adds the image/video link opened through the popup to the browser's history": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_add_to_history",
						"field": "description"
					}
				]
			},
			"pt-BR": "Adiciona o link da imagem/v\u00EDdeo aberto atrav\u00E9s do pop-up ao hist\u00F3rico do navegador",
			"ru": "\u0414\u043E\u0431\u0430\u0432\u043B\u044F\u0435\u0442 \u0441\u0441\u044B\u043B\u043A\u0443 \u043D\u0430 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435/\u0432\u0438\u0434\u0435\u043E \u0432 \u0438\u0441\u0442\u043E\u0440\u0438\u044E \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430, \u043E\u0442\u043A\u0440\u044B\u0442\u044B\u0435 \u0447\u0435\u0440\u0435\u0437 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E.",
			"zh-CN": "\u5C06\u901A\u8FC7\u5F39\u7A97\u6253\u5F00\u7684\u56FE\u50CF/\u89C6\u9891\u94FE\u63A5\u6DFB\u52A0\u5230\u6D4F\u89C8\u5668\u7684\u5386\u53F2\u8BB0\u5F55"
		},
		"Add thumbnail link to history": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_add_thumbnail_to_history",
						"field": "name"
					}
				]
			},
			"pt-BR": "Adicionar link da miniatura ao hist\u00F3rico"
		},
		"Adds the original media link opened through the popup to the browser's history": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_add_thumbnail_to_history",
						"field": "description"
					}
				]
			},
			"pt-BR": "Adiciona o link original da m\u00EDdia aberto atrav\u00E9s do pop-up ao hist\u00F3rico do navegador"
		},
		"Allow inter-frame communication": {
			"_info": {
				"instances": [
					{
						"setting": "allow_remote",
						"field": "name"
					}
				]
			},
			"ko": "\uD504\uB808\uC784 \uAC04 \uD1B5\uC2E0 \uD5C8\uC6A9",
			"pt-BR": "Permitir comunica\u00E7\u00E3o entre frames",
			"ru": "\u0420\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044C \u043C\u0435\u0436\u0444\u0440\u0435\u0439\u043C\u043E\u0432\u0443\u044E \u0441\u0432\u044F\u0437\u044C",
			"zh-CN": "\u5141\u8BB8\u6846\u67B6\u95F4\u901A\u4FE1"
		},
		"Allows communication between frames in windows, improving support for keybindings": {
			"_info": {
				"instances": [
					{
						"setting": "allow_remote",
						"field": "description"
					}
				]
			},
			"ko": "\uCC3D\uC758 \uD504\uB808\uC784 \uAC04 \uD1B5\uC2E0\uC744 \uD5C8\uC6A9\uD558\uC5EC \uD0A4 \uBC14\uC778\uB529\uC5D0 \uB300\uD55C \uC9C0\uC6D0\uC744 \uAC1C\uC120\uD55C\uB2E4.",
			"pt-BR": "Permite a comunica\u00E7\u00E3o entre frames em janelas, melhorando o suporte para atalhos de teclado",
			"ru": "\u041F\u043E\u0437\u0432\u043E\u043B\u044F\u0435\u0442 \u043E\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043B\u044F\u0442\u044C \u0441\u0432\u044F\u0437\u044C \u043C\u0435\u0436\u0434\u0443 \u0444\u0440\u0435\u0439\u043C\u0430\u043C\u0438 \u0432 Windows, \u0443\u043B\u0443\u0447\u0448\u0430\u044F \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u043A\u0443 \u043F\u0440\u0438\u0432\u044F\u0437\u043A\u0438 \u043A\u043B\u0430\u0432\u0438\u0448.",
			"zh-CN": "\u5141\u8BB8\u7A97\u53E3\u4E2D\u7684\u6846\u67B6\u95F4\u901A\u4FE1\uFF0C\u6539\u5584\u5BF9\u5FEB\u6377\u952E\u7ED1\u5B9A\u7684\u652F\u6301"
		},
		"Allows communication between frames in windows, improving support for keybindings. Can pose a fingerprinting risk when used through the userscript": {
			"_info": {
				"instances": [
					{
						"setting": "allow_remote",
						"field": "description_userscript"
					}
				]
			},
			"ko": "\uCC3D\uC758 \uD504\uB808\uC784 \uAC04 \uD1B5\uC2E0\uC744 \uD5C8\uC6A9\uD558\uC5EC \uD0A4 \uBC14\uC778\uB529\uC5D0 \uB300\uD55C \uC9C0\uC6D0\uC744 \uAC1C\uC120\uD569\uB2C8\uB2E4. \uC720\uC800\uC2A4\uD06C\uB9BD\uD2B8\uB97C \uD1B5\uD574 \uC0AC\uC6A9 \uC2DC, \uBCF4\uC548\uC5D0 \uC704\uD611\uC774 \uC788\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4",
			"pt-BR": "Permite a comunica\u00E7\u00E3o entre frames em janelas, melhorando o suporte para atalhos de teclado. Pode representar um risco de fingerprinting quando usado atrav\u00E9s do userscript",
			"ru": "\u041F\u043E\u0437\u0432\u043E\u043B\u044F\u0435\u0442 \u043E\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043B\u044F\u0442\u044C \u0441\u0432\u044F\u0437\u044C \u043C\u0435\u0436\u0434\u0443 \u0444\u0440\u0435\u0439\u043C\u0430\u043C\u0438 \u0432 Windows, \u0443\u043B\u0443\u0447\u0448\u0430\u044F \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u043A\u0443 \u043F\u0440\u0438\u0432\u044F\u0437\u043A\u0438 \u043A\u043B\u0430\u0432\u0438\u0448. \u041C\u043E\u0436\u0435\u0442 \u043F\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043B\u044F\u0442\u044C \u0440\u0438\u0441\u043A \u0441\u043D\u044F\u0442\u0438\u044F \u043E\u0442\u043F\u0435\u0447\u0430\u0442\u043A\u043E\u0432 \u043F\u0430\u043B\u044C\u0446\u0435\u0432 \u043F\u0440\u0438 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u0438\u0438 \u0447\u0435\u0440\u0435\u0437 \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u0438\u0439 \u0441\u043A\u0440\u0438\u043F\u0442.",
			"zh-CN": "\u5141\u8BB8\u7A97\u53E3\u4E2D\u7684\u6846\u67B6\u95F4\u901A\u4FE1\uFF0C\u6539\u5584\u5BF9\u5FEB\u6377\u952E\u7ED1\u5B9A\u7684\u652F\u6301\u3002\u901A\u8FC7\u7528\u6237\u811A\u672C\u4F7F\u7528\u65F6\uFF0C\u4E5F\u8BB8\u4F1A\u6784\u6210\u6307\u7EB9\u8BC6\u522B\u7684\u98CE\u9669"
		},
		"Pop out of frames": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_use_remote",
						"field": "name"
					}
				]
			},
			"ko": "\uD504\uB808\uC784\uC5D0\uC11C \uD31D\uC5C5",
			"pt-BR": "Sair dos frames",
			"ru": "\u0412\u044B\u0441\u043A\u0430\u043A\u0438\u0432\u0430\u0442\u044C \u0437\u0430 \u0440\u0430\u043C\u043A\u0438",
			"zh-CN": "\u8DF3\u51FA\u6846\u67B6"
		},
		"Opens the popup on the top frame instead of within iframes. This option is still experimental.": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_use_remote",
						"field": "description"
					}
				]
			},
			"pt-BR": "Abre o pop-up no frame superior em vez de dentro de iframes. Esta op\u00E7\u00E3o ainda \u00E9 experimental.",
			"ru": "\u041E\u0442\u043A\u0440\u044B\u0432\u0430\u0435\u0442 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u043F\u043E\u0432\u0435\u0440\u0445 \u0444\u0440\u0435\u0439\u043C\u0430, \u0430 \u043D\u0435 \u0432\u043D\u0443\u0442\u0440\u0438 iframes. \u042D\u0442\u043E\u0442 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440 \u0432\u0441\u0451 \u0435\u0449\u0451 \u044F\u0432\u043B\u044F\u0435\u0442\u0441\u044F \u044D\u043A\u0441\u043F\u0435\u0440\u0438\u043C\u0435\u043D\u0442\u0430\u043B\u044C\u043D\u044B\u043C.",
			"zh-CN": "\u5728\u6846\u67B6\u5916\u800C\u975E\u6846\u67B6\u5185\u6253\u5F00\u5F39\u7A97\u3002\u6B64\u9009\u9879\u4ECD\u5904\u4E8E\u8BD5\u9A8C\u9636\u6BB5\u3002"
		},
		"Popup default zoom": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_zoom_behavior",
						"field": "name"
					}
				]
			},
			"ko": "\uD655\uB300/\uCD95\uC18C \uAE30\uBCF8\uAC12",
			"pt-BR": "Zoom padr\u00E3o do pop-up",
			"ru": "\u041C\u0430\u0441\u0448\u0442\u0430\u0431 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430",
			"zh-CN": "\u5F39\u7A97\u9ED8\u8BA4\u7F29\u653E\u7EA7\u522B"
		},
		"How the popup should be initially sized": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_zoom_behavior",
						"field": "description"
					}
				]
			},
			"ko": "\uD31D\uC5C5\uC758 \uCD08\uAE30 \uD06C\uAE30 \uC870\uC815 \uBC29\uBC95",
			"pt-BR": "Como deve ser o dimensionamento inicial do pop-up",
			"ru": "\u041A\u0430\u043A\u0438\u043C \u0431\u0443\u0434\u0435\u0442 \u0438\u0437\u043D\u0430\u0447\u0430\u043B\u044C\u043D\u044B\u0439 \u0440\u0430\u0437\u043C\u0435\u0440 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430.",
			"zh-CN": "\u5F39\u7A97\u7684\u521D\u59CB\u5C3A\u5BF8"
		},
		"Fit to screen": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_zoom_behavior",
						"field": "options.fit.name"
					},
					{
						"setting": "popup_hold_zoom",
						"field": "options.fit.name"
					}
				]
			},
			"fr": "Adapter a l'ecran",
			"ko": "\uD654\uBA74 \uD06C\uAE30\uC5D0 \uB9DE\uCDA4",
			"pt-BR": "Ajustar \u00E0 tela",
			"ru": "\u041F\u043E \u0440\u0430\u0437\u043C\u0435\u0440\u0443 \u044D\u043A\u0440\u0430\u043D\u0430",
			"zh-CN": "\u9002\u5408\u5C4F\u5E55"
		},
		"Fill screen": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_zoom_behavior",
						"field": "options.fill.name"
					},
					{
						"setting": "popup_hold_zoom",
						"field": "options.fill.name"
					}
				]
			},
			"ko": "\uD654\uBA74 \uCC44\uC6B0\uAE30",
			"pt-BR": "Preencher tela",
			"ru": "\u0417\u0430\u043F\u043E\u043B\u043D\u0438\u0442\u044C \u044D\u043A\u0440\u0430\u043D",
			"zh-CN": "\u586B\u6EE1\u5C4F\u5E55"
		},
		"Full size": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_zoom_behavior",
						"field": "options.full.name"
					},
					{
						"setting": "popup_hold_zoom",
						"field": "options.full.name"
					}
				]
			},
			"fr": "Taille r\u00E9elle",
			"ko": "\uC804\uCCB4 \uD06C\uAE30",
			"pt-BR": "Tamanho original",
			"ru": "\u041F\u043E\u043B\u043D\u044B\u0439 \u0440\u0430\u0437\u043C\u0435\u0440",
			"zh-CN": "\u5168\u5C3A\u5BF8"
		},
		"Custom size": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_zoom_behavior",
						"field": "options.custom.name"
					}
				]
			},
			"ko": "\uB9DE\uCDA4 \uD06C\uAE30",
			"pt-BR": "Tamanho personalizado",
			"ru": "\u041F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u0438\u0439 \u0440\u0430\u0437\u043C\u0435\u0440",
			"zh-CN": "\u81EA\u5B9A\u4E49\u5C3A\u5BF8"
		},
		"Custom zoom percent": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_zoom_custom_percent",
						"field": "name"
					}
				]
			},
			"ko": "\uC0AC\uC6A9\uC790 \uC9C0\uC815 \uD655\uB300/\uCD95\uC18C \uBE44\uC728",
			"pt-BR": "Percentual de zoom personalizado",
			"ru": "\u041F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u0438\u0439 \u043F\u0440\u043E\u0446\u0435\u043D\u0442 \u043C\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F",
			"zh-CN": "\u81EA\u5B9A\u4E49\u7F29\u653E\u767E\u5206\u6BD4"
		},
		"Custom percent to initially size the popup": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_zoom_custom_percent",
						"field": "description"
					}
				]
			},
			"ko": "\uD31D\uC5C5 \uC124\uC815 \uC2DC, \uCD08\uAE30 \uC0AC\uC6A9\uC790 \uC9C0\uC815 \uD655\uB300/\uCD95\uC18C \uBE44\uC728",
			"pt-BR": "Percentual personalizado para dimensionar o pop-up inicialmente",
			"ru": "\u041F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u0438\u0439 \u043F\u0440\u043E\u0446\u0435\u043D\u0442 \u0434\u043B\u044F \u043F\u0435\u0440\u0432\u043E\u043D\u0430\u0447\u0430\u043B\u044C\u043D\u043E\u0433\u043E \u0440\u0430\u0437\u043C\u0435\u0440\u0430 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u04306",
			"zh-CN": "\u81EA\u5B9A\u4E49\u76F8\u5BF9\u4E8E\u521D\u59CB\u5F39\u7A97\u5927\u5C0F\u7684\u767E\u5206\u6BD4"
		},
		"%": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_volume",
						"field": "number_unit"
					},
					{
						"setting": "mouseover_video_volume_change_amt",
						"field": "number_unit"
					},
					{
						"setting": "mouseover_ui_opacity",
						"field": "number_unit"
					},
					{
						"setting": "mouseover_zoom_custom_percent",
						"field": "number_unit"
					}
				]
			},
			"pt-BR": "%",
			"ru": "%",
			"zh-CN": "%"
		},
		"Use last zoom": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_zoom_use_last",
						"field": "name"
					}
				]
			},
			"pt-BR": "Usar \u00FAltimo zoom",
			"ru": "\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0439 \u043C\u0430\u0441\u0448\u0442\u0430\u0431",
			"zh-CN": "\u4F7F\u7528\u6700\u540E\u7684\u7F29\u653E\u8BBE\u7F6E"
		},
		"Use the last popup's zoom. Note that this is per-page.": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_zoom_use_last",
						"field": "description"
					}
				]
			},
			"pt-BR": "Usar o zoom do \u00FAltimo pop-up. Observe que isso \u00E9 por p\u00E1gina.",
			"ru": "\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0439\u0442\u0435 \u043C\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0435 \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0435\u0433\u043E \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430. \u041E\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043D\u0438\u043C\u0430\u043D\u0438\u0435, \u0447\u0442\u043E \u044D\u0442\u043E \u043D\u0430 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0435.",
			"zh-CN": "\u4F7F\u7528\u6700\u540E\u4E00\u4E2A\u5F39\u7A97\u7684\u7F29\u653E\u7EA7\u522B\u3002\u6CE8\u610F\uFF0C\u6B64\u7EA7\u522B\u4E0D\u8DE8\u9875\u5171\u4EAB\u3002"
		},
		"Maximum width": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_zoom_max_width",
						"field": "name"
					}
				]
			},
			"ko": "\uCD5C\uB300 \uAC00\uB85C \uAE38\uC774",
			"pt-BR": "Largura m\u00E1xima",
			"ru": "\u041C\u0430\u043A\u0441\u0438\u043C\u0430\u043B\u044C\u043D\u0430\u044F \u0448\u0438\u0440\u0438\u043D\u0430",
			"zh-CN": "\u6700\u5927\u5BBD\u5EA6"
		},
		"Maximum width for the initial popup size. Set to `0` for unlimited.": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_zoom_max_width",
						"field": "description"
					}
				]
			},
			"ko": "\uCD08\uAE30 \uD31D\uC5C5 \uD06C\uAE30\uC758 \uCD5C\uB300 \uAC00\uB85C \uAE38\uC774. \uBB34\uC81C\uD55C\uC758 \uACBD\uC6B0 0\uC73C\uB85C \uC124\uC815\uD558\uC2ED\uC2DC\uC624.",
			"pt-BR": "Largura m\u00E1xima para o tamanho inicial do pop-up. Defina como `0` para ilimitado.",
			"ru": "\u041C\u0430\u043A\u0441\u0438\u043C\u0430\u043B\u044C\u043D\u0430\u044F \u0448\u0438\u0440\u0438\u043D\u0430 \u0434\u043B\u044F \u043D\u0430\u0447\u0430\u043B\u044C\u043D\u043E\u0433\u043E \u0440\u0430\u0437\u043C\u0435\u0440\u0430 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430. `0` - \u043D\u0435\u043E\u0433\u0440\u0430\u043D\u0438\u0447\u0435\u043D\u043D\u0430\u044F \u0448\u0438\u0440\u0438\u043D\u0430.",
			"zh-CN": "\u521D\u59CB\u5F39\u7A97\u5C3A\u5BF8\u7684\u6700\u5927\u5BBD\u5EA6\u3002\u8BBE\u4E3A 0 \u5219\u65E0\u9650\u5236\u3002"
		},
		"Maximum height": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_zoom_max_height",
						"field": "name"
					}
				]
			},
			"ko": "\uCD5C\uB300 \uC138\uB85C \uAE38\uC774",
			"pt-BR": "Altura m\u00E1xima",
			"ru": "\u041C\u0430\u043A\u0441\u0438\u043C\u0430\u043B\u044C\u043D\u0430\u044F \u0432\u044B\u0441\u043E\u0442\u0430",
			"zh-CN": "\u6700\u5927\u9AD8\u5EA6"
		},
		"Maximum height for the initial popup size. Set to `0` for unlimited.": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_zoom_max_height",
						"field": "description"
					}
				]
			},
			"ko": "\uCD08\uAE30 \uD31D\uC5C5 \uD06C\uAE30\uC758 \uCD5C\uB300 \uC138\uB85C \uAE38\uC774. \uBB34\uC81C\uD55C\uC73C\uB85C '0'\uC73C\uB85C \uC124\uC815\uD55C\uB2E4.",
			"pt-BR": "Altura m\u00E1xima para o tamanho inicial do pop-up. Defina como `0` para ilimitado.",
			"ru": "\u041C\u0430\u043A\u0441\u0438\u043C\u0430\u043B\u044C\u043D\u0430\u044F \u0432\u044B\u0441\u043E\u0442\u0430 \u0434\u043B\u044F \u043D\u0430\u0447\u0430\u043B\u044C\u043D\u043E\u0433\u043E \u0440\u0430\u0437\u043C\u0435\u0440\u0430 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430. `0` - \u043D\u0435\u043E\u0433\u0440\u0430\u043D\u0438\u0447\u0435\u043D\u043D\u0430\u044F \u0432\u044B\u0441\u043E\u0442\u0430.",
			"zh-CN": "\u521D\u59CB\u5F39\u7A97\u5C3A\u5BF8\u7684\u6700\u5927\u9AD8\u5EA6\u3002\u8BBE\u4E3A 0 \u5219\u65E0\u9650\u5236\u3002"
		},
		"Popup panning method": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_pan_behavior",
						"field": "name"
					}
				]
			},
			"ko": "\uC774\uBBF8\uC9C0 \uC774\uB3D9\uD558\uB824\uBA74",
			"pt-BR": "M\u00E9todo de panor\u00E2mica do pop-up",
			"ru": "\u0421\u043F\u043E\u0441\u043E\u0431 \u043F\u0430\u043D\u043E\u0440\u0430\u043C\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430",
			"zh-CN": "\u5F39\u7A97\u5E73\u79FB\u65B9\u6CD5"
		},
		"How the popup should be panned when larger than the screen": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_pan_behavior",
						"field": "description"
					}
				]
			},
			"pt-BR": "Como o pop-up deve ser deslocado quando maior que a tela",
			"ru": "\u041A\u0430\u043A \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043F\u0430\u043D\u043E\u0440\u0430\u043C\u0438\u0440\u043E\u0432\u0430\u043D\u043E, \u043A\u043E\u0433\u0434\u0430 \u043E\u043D\u043E \u0431\u043E\u043B\u044C\u0448\u0435 \u044D\u043A\u0440\u0430\u043D\u0430.",
			"zh-CN": "\u5F39\u7A97\u6BD4\u5C4F\u5E55\u5927\u65F6\u5E94\u5982\u4F55\u5E73\u79FB"
		},
		"Movement": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_pan_behavior",
						"field": "options.movement.name"
					}
				]
			},
			"ko": "\uB9C8\uC6B0\uC2A4 \uC6C0\uC9C1\uC785\uB2C8\uB2E4",
			"pt-BR": "Movimento",
			"ru": "\u041F\u0435\u0440\u0435\u043C\u0435\u0449\u0435\u043D\u0438\u0435",
			"zh-CN": "\u79FB\u52A8"
		},
		"The popup pans as you move your mouse": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_pan_behavior",
						"field": "options.movement.description"
					}
				]
			},
			"pt-BR": "O pop-up se move conforme voc\u00EA move o mouse",
			"ru": "\u0412\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u043F\u0430\u043D\u043E\u0440\u0430\u043C\u0438\u0440\u0443\u0435\u0442\u0441\u044F \u043A\u043E\u0433\u0434\u0430 \u0432\u044B \u043F\u0435\u0440\u0435\u043C\u0435\u0449\u0430\u0435\u0442\u0435 \u043C\u044B\u0448\u044C.",
			"zh-CN": "\u79FB\u52A8\u9F20\u6807\u65F6\u5F39\u7A97\u5E73\u79FB"
		},
		"Drag": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_pan_behavior",
						"field": "options.drag.name"
					}
				]
			},
			"ko": "\uB055\uB2C8\uB2E4",
			"pt-BR": "Arrastar",
			"ru": "\u041F\u0435\u0440\u0435\u0442\u0430\u0441\u043A\u0438\u0432\u0430\u043D\u0438\u0435",
			"zh-CN": "\u62D6\u62FD"
		},
		"Clicking and dragging pans the popup": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_pan_behavior",
						"field": "options.drag.description"
					}
				]
			},
			"pt-BR": "'Clicar e arrastar' move o pop-up",
			"ru": "\u0412\u044B \u043C\u043E\u0436\u0435\u0442\u0435 \u043D\u0430\u0436\u0430\u0442\u044C \u0438 \u043F\u0435\u0440\u0435\u0442\u0430\u0441\u043A\u0438\u0432\u0430\u0442\u044C \u043F\u0430\u043D\u0435\u043B\u044C \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430.",
			"zh-CN": "\u5355\u51FB\u5E76\u62D6\u62FD\u79FB\u52A8\u5F39\u7A97"
		},
		"Invert movement": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_movement_inverted",
						"field": "name"
					}
				]
			},
			"pt-BR": "Inverter movimento",
			"ru": "\u0418\u043D\u0432\u0435\u0440\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u043F\u0435\u0440\u0435\u043C\u0435\u0449\u0435\u043D\u0438\u0435",
			"zh-CN": "\u53CD\u8F6C\u79FB\u52A8"
		},
		"Inverts the movement of the mouse. For example, if the mouse moves left, the popup moves right. If disabled, it feels more like the popup is being invisibly dragged.": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_movement_inverted",
						"field": "description"
					}
				]
			},
			"pt-BR": "Inverte o movimento do mouse. Por exemplo, se o mouse se mover para a esquerda, o pop-up se move para a direita. Se desabilitado, parece que o pop-up est\u00E1 sendo arrastado de forma invis\u00EDvel.",
			"ru": "\u0418\u043D\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u043F\u0435\u0440\u0435\u043C\u0435\u0449\u0435\u043D\u0438\u0435 \u043C\u044B\u0448\u044C\u044E. \u041D\u0430\u043F\u0440\u0438\u043C\u0435\u0440, \u0435\u0441\u043B\u0438 \u043C\u044B\u0448\u044C \u0434\u0432\u0438\u0436\u0435\u0442\u0441\u044F \u0432\u043B\u0435\u0432\u043E, \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u043F\u0435\u0440\u0435\u043C\u0435\u0449\u0430\u0435\u0442\u0441\u044F \u0432\u043F\u0440\u0430\u0432\u043E. \u0415\u0441\u043B\u0438 \u043E\u0442\u043A\u043B\u044E\u0447\u0435\u043D\u043E, \u0442\u043E \u0431\u043E\u043B\u044C\u0448\u0435 \u043F\u043E\u0445\u043E\u0436\u0435 \u043D\u0430 \u0442\u043E, \u0447\u0442\u043E \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u043D\u0435\u0432\u0438\u0434\u0438\u043C\u043E \u043F\u0435\u0440\u0435\u0442\u0430\u0441\u043A\u0438\u0432\u0430\u0435\u0442\u0441\u044F.",
			"zh-CN": "\u53CD\u8F6C\u9F20\u6807\u7684\u79FB\u52A8\u3002\u4F8B\u5982\uFF0C\u5982\u679C\u9F20\u6807\u5411\u5DE6\u79FB\u52A8\uFF0C\u5F39\u7A97\u5411\u53F3\u79FB\u52A8\u3002\u5982\u679C\u7981\u7528\uFF0C\u611F\u89C9\u66F4\u50CF\u662F\u5F39\u51FA\u7A97\u53E3\u5728\u65E0\u5F62\u4E2D\u88AB\u62D6\u52A8\u3002"
		},
		"Minimum drag amount": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_drag_min",
						"field": "name"
					}
				]
			},
			"pt-BR": "Quantidade m\u00EDnima a ser arrastada",
			"ru": "\u041C\u0438\u043D\u0438\u043C\u0430\u043B\u044C\u043D\u043E\u0435 \u043A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0434\u043B\u044F \u043F\u0435\u0440\u0435\u0442\u0430\u0441\u043A\u0438\u0432\u0430\u043D\u0438\u044F",
			"zh-CN": "\u6700\u5C0F\u62D6\u62FD\u8D77\u59CB"
		},
		"How many pixels the mouse should move to start a drag": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_drag_min",
						"field": "description"
					}
				]
			},
			"pt-BR": "Quantos pixels o mouse deve se mover para iniciar um arrasto",
			"ru": "\u041D\u0430 \u0441\u043A\u043E\u043B\u044C\u043A\u043E \u043F\u0438\u043A\u0441\u0435\u043B\u0435\u0439 \u043C\u044B\u0448\u044C \u0434\u043E\u043B\u0436\u043D\u0430 \u043F\u0435\u0440\u0435\u043C\u0435\u0441\u0442\u0438\u0442\u044C\u0441\u044F, \u0447\u0442\u043E\u0431\u044B \u043D\u0430\u0447\u0430\u0442\u044C \u043F\u0435\u0440\u0435\u0442\u0430\u0441\u043A\u0438\u0432\u0430\u043D\u0438\u0435.",
			"zh-CN": "\u9F20\u6807\u79FB\u52A8\u591A\u5C11\u50CF\u7D20\u624D\u5F00\u59CB\u62D6\u62FD"
		},
		"Vertical scroll action": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_scrolly_behavior",
						"field": "name"
					}
				]
			},
			"pt-BR": "A\u00E7\u00E3o de rolagem vertical",
			"ru": "\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0432\u0435\u0440\u0442\u0438\u043A\u0430\u043B\u044C\u043D\u043E\u0439 \u043F\u0440\u043E\u043A\u0440\u0443\u0442\u043A\u0438",
			"zh-CN": "\u5782\u76F4\u6EDA\u52A8\u64CD\u4F5C"
		},
		"How the popup reacts to a vertical scroll/mouse wheel event": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_scrolly_behavior",
						"field": "description"
					}
				]
			},
			"pt-BR": "Como o pop-up reage a um evento de rolagem vertical/roda do mouse",
			"ru": "\u041A\u0430\u043A \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u0440\u0435\u0430\u0433\u0438\u0440\u0443\u0435\u0442 \u043D\u0430 \u0441\u043E\u0431\u044B\u0442\u0438\u0435 \u0432\u0435\u0440\u0442\u0438\u043A\u0430\u043B\u044C\u043D\u043E\u0439 \u043F\u0440\u043E\u043A\u0440\u0443\u0442\u043A\u0438/\u043A\u043E\u043B\u0435\u0441\u0430 \u043C\u044B\u0448\u0438.",
			"zh-CN": "\u5F39\u7A97\u5982\u4F55\u5BF9\u5782\u76F4\u6EDA\u52A8/\u9F20\u6807\u6EDA\u8F6E\u4E8B\u4EF6\u505A\u51FA\u53CD\u5E94"
		},
		"Vertical scroll action (hold)": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_scrolly_hold_behavior",
						"field": "name"
					}
				]
			},
			"pt-BR": "A\u00E7\u00E3o de rolagem vertical (pressionado)",
			"ru": "\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043F\u0440\u0438 \u0432\u0435\u0440\u0442\u0438\u043A\u0430\u043B\u044C\u043D\u043E\u0439 \u043F\u0440\u043E\u043A\u0440\u0443\u0442\u043A\u0435 (\u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u043D\u0438\u0435)",
			"zh-CN": "\u5782\u76F4\u6EDA\u52A8\u52A8\u4F5C(\u4FDD\u6301)"
		},
		"How the popup (when held) reacts to a vertical scroll/mouse wheel event": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_scrolly_hold_behavior",
						"field": "description"
					}
				]
			},
			"pt-BR": "Como o pop-up (quando pressionado) reage a um evento de rolagem vertical/roda do mouse",
			"ru": "\u041A\u0430\u043A \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E (\u043A\u043E\u0433\u0434\u0430 \u043E\u043D\u043E \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044F) \u0440\u0435\u0430\u0433\u0438\u0440\u0443\u0435\u0442 \u043D\u0430 \u0441\u043E\u0431\u044B\u0442\u0438\u0435 \u0432\u0435\u0440\u0442\u0438\u043A\u0430\u043B\u044C\u043D\u043E\u0439 \u043F\u0440\u043E\u043A\u0440\u0443\u0442\u043A\u0438/\u043A\u043E\u043B\u0435\u0441\u0430 \u043C\u044B\u0448\u0438",
			"zh-CN": "\u201C\u4FDD\u6301\u201D\u663E\u793A\u7684\u5F39\u7A97\u5982\u4F55\u5BF9\u5782\u76F4\u6EDA\u52A8/\u9F20\u6807\u6EDA\u8F6E\u4E8B\u4EF6\u505A\u51FA\u53CD\u5E94"
		},
		"Zoom": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_scrolly_behavior",
						"field": "options.zoom.name"
					},
					{
						"setting": "mouseover_scrolly_hold_behavior",
						"field": "options.zoom.name"
					}
				]
			},
			"ko": "\uC90C",
			"pt-BR": "Zoom",
			"ru": "\u041C\u0430\u0441\u0448\u0442\u0430\u0431",
			"zh-CN": "\u7F29\u653E"
		},
		"Horizontal scroll action": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_scrollx_behavior",
						"field": "name"
					}
				]
			},
			"pt-BR": "A\u00E7\u00E3o de rolagem horizontal",
			"ru": "\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0433\u043E\u0440\u0438\u0437\u043E\u043D\u0442\u0430\u043B\u044C\u043D\u043E\u0439 \u043F\u0440\u043E\u043A\u0440\u0443\u0442\u043A\u0438",
			"zh-CN": "\u6C34\u5E73\u6EDA\u52A8\u52A8\u4F5C"
		},
		"How the popup reacts to a horizontal scroll/mouse wheel event": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_scrollx_behavior",
						"field": "description"
					}
				]
			},
			"pt-BR": "Como o pop-up reage a um evento de rolagem horizontal/roda do mouse",
			"ru": "\u041A\u0430\u043A \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u0440\u0435\u0430\u0433\u0438\u0440\u0443\u0435\u0442 \u043D\u0430 \u0441\u043E\u0431\u044B\u0442\u0438\u0435 \u0433\u043E\u0440\u0438\u0437\u043E\u043D\u0442\u0430\u043B\u044C\u043D\u043E\u0439 \u043F\u0440\u043E\u043A\u0440\u0443\u0442\u043A\u0438/\u043A\u043E\u043B\u0435\u0441\u0430 \u043C\u044B\u0448\u0438.",
			"zh-CN": "\u5F39\u7A97\u5982\u4F55\u5BF9\u6C34\u5E73\u6EDA\u52A8/\u9F20\u6807\u6EDA\u8F6E\u4E8B\u4EF6\u505A\u51FA\u53CD\u5E94"
		},
		"Horizontal scroll action (hold)": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_scrollx_hold_behavior",
						"field": "name"
					}
				]
			},
			"pt-BR": "A\u00E7\u00E3o de rolagem horizontal (pressionado)",
			"ru": "\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0433\u043E\u0440\u0438\u0437\u043E\u043D\u0442\u0430\u043B\u044C\u043D\u043E\u0439 \u043F\u0440\u043E\u043A\u0440\u0443\u0442\u043A\u0438 (\u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u043D\u0438\u0435)",
			"zh-CN": "\u6C34\u5E73\u6EDA\u52A8\u52A8\u4F5C(\u4FDD\u6301)"
		},
		"How the popup (when held) reacts to a horizontal scroll/mouse wheel event": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_scrollx_hold_behavior",
						"field": "description"
					}
				]
			},
			"pt-BR": "Como o pop-up (quando pressionado) reage a um evento de rolagem horizontal/roda do mouse",
			"ru": "\u041A\u0430\u043A \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E (\u043A\u043E\u0433\u0434\u0430 \u043E\u043D\u043E \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044F) \u0440\u0435\u0430\u0433\u0438\u0440\u0443\u0435\u0442 \u043D\u0430 \u0441\u043E\u0431\u044B\u0442\u0438\u0435 \u0433\u043E\u0440\u0438\u0437\u043E\u043D\u0442\u0430\u043B\u044C\u043D\u043E\u0439 \u043F\u0440\u043E\u043A\u0440\u0443\u0442\u043A\u0438/\u043A\u043E\u043B\u0435\u0441\u0430 \u043C\u044B\u0448\u0438",
			"zh-CN": "\u201C\u4FDD\u6301\u201D\u663E\u793A\u7684\u5F39\u7A97\u5982\u4F55\u5BF9\u6C34\u5E73\u6EDA\u52A8/\u9F20\u6807\u6EDA\u8F6E\u4E8B\u4EF6\u505A\u51FA\u53CD\u5E94"
		},
		"Pan": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_scrolly_behavior",
						"field": "options.pan.name"
					},
					{
						"setting": "mouseover_scrollx_behavior",
						"field": "options.pan.name"
					},
					{
						"setting": "mouseover_scrolly_hold_behavior",
						"field": "options.pan.name"
					},
					{
						"setting": "mouseover_scrollx_hold_behavior",
						"field": "options.pan.name"
					}
				]
			},
			"ko": "\uC774\uB3D9",
			"pt-BR": "Mover",
			"ru": "\u041F\u0430\u043D\u0435\u043B\u044C",
			"zh-CN": "\u5E73\u79FB"
		},
		"Gallery": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_scrolly_behavior",
						"field": "options.gallery.name"
					},
					{
						"setting": "mouseover_scrollx_behavior",
						"field": "options.gallery.name"
					},
					{
						"setting": "mouseover_zoom_use_last",
						"field": "options.gallery.name"
					},
					{
						"setting": "mouseover_scrolly_hold_behavior",
						"field": "options.gallery.name"
					},
					{
						"setting": "mouseover_scrollx_hold_behavior",
						"field": "options.gallery.name"
					}
				]
			},
			"pt-BR": "Galeria",
			"ru": "\u0413\u0430\u043B\u0435\u0440\u0435\u044F",
			"zh-CN": "\u56FE\u5E93"
		},
		"Vertical video scroll action": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_scrolly_video_behavior",
						"field": "name"
					}
				]
			},
			"pt-BR": "A\u00E7\u00E3o de rolagem vertical do v\u00EDdeo",
			"ru": "\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0432\u0435\u0440\u0442\u0438\u043A\u0430\u043B\u044C\u043D\u043E\u0439 \u043F\u0440\u043E\u043A\u0440\u0443\u0442\u043A\u0438 \u0432\u0438\u0434\u0435\u043E",
			"zh-CN": "\u5782\u76F4\u89C6\u9891\u6EDA\u52A8\u52A8\u4F5C"
		},
		"Overrides the vertical scroll action for videos. Set to `Default` to avoid overriding the behavior.": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_scrolly_video_behavior",
						"field": "description"
					}
				]
			},
			"pt-BR": "Substitui a a\u00E7\u00E3o de rolagem vertical para v\u00EDdeos. Defina como `Padr\u00E3o` para evitar substituir o comportamento.",
			"ru": "\u041F\u0435\u0440\u0435\u043E\u043F\u0440\u0435\u0434\u0435\u043B\u044F\u0435\u0442 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0432\u0435\u0440\u0442\u0438\u043A\u0430\u043B\u044C\u043D\u043E\u0439 \u043F\u0440\u043E\u043A\u0440\u0443\u0442\u043A\u0438 \u0434\u043B\u044F \u0432\u0438\u0434\u0435\u043E. \u0423\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 `\u041F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E`, \u0447\u0442\u043E\u0431\u044B \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044C \u043F\u0435\u0440\u0435\u043E\u043F\u0440\u0435\u0434\u0435\u043B\u0435\u043D\u0438\u044F \u043F\u043E\u0432\u0435\u0434\u0435\u043D\u0438\u044F.",
			"zh-CN": "\u8986\u76D6\u89C6\u9891\u7684\u5782\u76F4\u6EDA\u52A8\u52A8\u4F5C\u3002\u8BBE\u4E3A `\u9ED8\u8BA4` \u6765\u907F\u514D\u8986\u76D6\u8BE5\u884C\u4E3A\u3002"
		},
		"Invert vertical scroll seek": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_scrolly_video_invert",
						"field": "name"
					}
				]
			},
			"pt-BR": "Inverter busca de rolagem vertical",
			"ru": "\u0418\u043D\u0432\u0435\u0440\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0441\u0442\u0440\u0435\u043C\u043B\u0435\u043D\u0438\u0435 \u0432\u0435\u0440\u0442\u0438\u043A\u0430\u043B\u044C\u043D\u043E\u0439 \u043F\u0440\u043E\u043A\u0440\u0443\u0442\u043A\u0438",
			"zh-CN": "\u53CD\u8F6C\u5782\u76F4\u6EDA\u52A8\u7684\u5FEB\u8FDB/\u5FEB\u9000"
		},
		"Inverts the seek direction when scrolling vertically: Scrolling up will seek right, scrolling down will seek left.": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_scrolly_video_invert",
						"field": "description"
					}
				]
			},
			"pt-BR": "Inverte a dire\u00E7\u00E3o da busca ao rolar verticalmente: Rolar para cima buscar\u00E1 para a direita, rolar para baixo buscar\u00E1 para a esquerda.",
			"ru": "\u0418\u043D\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u043D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u0441\u0442\u0440\u0435\u043C\u043B\u0435\u043D\u0438\u044F \u043F\u0440\u0438 \u0432\u0435\u0440\u0442\u0438\u043A\u0430\u043B\u044C\u043D\u043E\u0439 \u043F\u0440\u043E\u043A\u0440\u0443\u0442\u043A\u0435: \u041F\u0440\u043E\u043A\u0440\u0443\u0442\u043A\u0430 \u0432\u0432\u0435\u0440\u0445 \u0431\u0443\u0434\u0435\u0442 \u0441\u0442\u0440\u0435\u043C\u0438\u0442\u044C\u0441\u044F \u0432\u043F\u0440\u0430\u0432\u043E, \u043F\u0440\u043E\u043A\u0440\u0443\u0442\u043A\u0430 \u0432\u043D\u0438\u0437 \u0431\u0443\u0434\u0435\u0442 \u0441\u0442\u0440\u0435\u043C\u0438\u0442\u044C\u0441\u044F \u0432\u043B\u0435\u0432\u043E.",
			"zh-CN": "\u5728\u5782\u76F4\u6EDA\u52A8\u65F6\u53CD\u8F6C\u79FB\u52A8\u65B9\u5411\uFF1A\u5411\u4E0A\u6EDA\u52A8\u5C06\u5411\u53F3\u79FB\u52A8\uFF0C\u5411\u4E0B\u6EDA\u52A8\u5C06\u5411\u5DE6\u79FB\u52A8\u3002"
		},
		"Horizontal video scroll action": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_scrollx_video_behavior",
						"field": "name"
					}
				]
			},
			"pt-BR": "A\u00E7\u00E3o de rolagem horizontal do v\u00EDdeo",
			"ru": "\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0433\u043E\u0440\u0438\u0437\u043E\u043D\u0442\u0430\u043B\u044C\u043D\u043E\u0439 \u043F\u0440\u043E\u043A\u0440\u0443\u0442\u043A\u0438 \u0432\u0438\u0434\u0435\u043E",
			"zh-CN": "\u6C34\u5E73\u89C6\u9891\u6EDA\u52A8\u52A8\u4F5C"
		},
		"Overrides the horizontal scroll action for videos. Set to `Default` to avoid overriding the behavior.": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_scrollx_video_behavior",
						"field": "description"
					}
				]
			},
			"pt-BR": "Substitui a a\u00E7\u00E3o de rolagem horizontal para v\u00EDdeos. Defina como `Padr\u00E3o` para evitar substituir o comportamento.",
			"ru": "\u041F\u0435\u0440\u0435\u043E\u043F\u0440\u0435\u0434\u0435\u043B\u044F\u0435\u0442 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0433\u043E\u0440\u0438\u0437\u043E\u043D\u0442\u0430\u043B\u044C\u043D\u043E\u0439 \u043F\u0440\u043E\u043A\u0440\u0443\u0442\u043A\u0438 \u0434\u043B\u044F \u0432\u0438\u0434\u0435\u043E. \u0423\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 `\u041F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E`, \u0447\u0442\u043E\u0431\u044B \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044C \u043F\u0435\u0440\u0435\u043E\u043F\u0440\u0435\u0434\u0435\u043B\u0435\u043D\u0438\u044F \u043F\u043E\u0432\u0435\u0434\u0435\u043D\u0438\u044F.",
			"zh-CN": "\u8986\u76D6\u89C6\u9891\u7684\u6C34\u5E73\u6EDA\u52A8\u52A8\u4F5C\u3002\u8BBE\u4E3A `\u9ED8\u8BA4` \u6765\u907F\u514D\u8986\u76D6\u8BE5\u884C\u4E3A\u3002"
		},
		"Default": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_scrolly_video_behavior",
						"field": "options.default.name"
					},
					{
						"setting": "mouseover_scrollx_video_behavior",
						"field": "options.default.name"
					},
					{
						"setting": "mouseover_scrolly_hold_behavior",
						"field": "options.default.name"
					},
					{
						"setting": "mouseover_scrollx_hold_behavior",
						"field": "options.default.name"
					}
				]
			},
			"pt-BR": "Padr\u00E3o",
			"ru": "\u041F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E",
			"zh-CN": "\u9ED8\u8BA4"
		},
		"Seek": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_scrolly_video_behavior",
						"field": "options.seek.name"
					},
					{
						"setting": "mouseover_scrollx_video_behavior",
						"field": "options.seek.name"
					}
				]
			},
			"pt-BR": "Buscar",
			"ru": "\u0421\u0442\u0440\u0435\u043C\u043B\u0435\u043D\u0438\u0435",
			"zh-CN": "\u5FEB\u8FDB/\u5FEB\u9000"
		},
		"None": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_trigger_behavior",
						"field": "options.none.name"
					},
					{
						"setting": "mouseover_allow_partial",
						"field": "options.none.name"
					},
					{
						"setting": "mouseover_scrolly_behavior",
						"field": "options.nothing.name"
					},
					{
						"setting": "mouseover_scrollx_behavior",
						"field": "options.nothing.name"
					},
					{
						"setting": "mouseover_scrolly_video_behavior",
						"field": "options.nothing.name"
					},
					{
						"setting": "mouseover_scrollx_video_behavior",
						"field": "options.nothing.name"
					},
					{
						"setting": "popup_hold_zoom",
						"field": "options.none.name"
					},
					{
						"setting": "mouseover_scrolly_hold_behavior",
						"field": "options.nothing.name"
					},
					{
						"setting": "mouseover_scrollx_hold_behavior",
						"field": "options.nothing.name"
					}
				]
			},
			"ko": "\uC5C6\uB2E4",
			"pt-BR": "Nenhum",
			"ru": "\u041D\u0438\u0447\u0435\u0433\u043E",
			"zh-CN": "\u65E0"
		},
		"Override scroll outside of popup": {
			"_info": {
				"instances": [
					{
						"setting": "scroll_override_page",
						"field": "name"
					}
				]
			},
			"pt-BR": "Substituir rolagem fora do pop-up",
			"ru": "\u041F\u0435\u0440\u0435\u043E\u043F\u0440\u0435\u0434\u0435\u043B\u0435\u043D\u0438\u0435 \u043F\u0440\u043E\u043A\u0440\u0443\u0442\u043A\u0438 \u0432\u043D\u0435 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430",
			"zh-CN": "\u8986\u76D6\u5F39\u7A97\u5916\u7684\u6EDA\u52A8"
		},
		"Scrolling outside of the popup will also be overriden by the script": {
			"_info": {
				"instances": [
					{
						"setting": "scroll_override_page",
						"field": "description"
					}
				]
			},
			"pt-BR": "A rolagem fora do pop-up tamb\u00E9m ser\u00E1 substitu\u00EDda pelo script",
			"ru": "\u041F\u0440\u043E\u043A\u0440\u0443\u0442\u043A\u0430 \u0437\u0430 \u043F\u0440\u0435\u0434\u0435\u043B\u0430\u043C\u0438 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430 \u0442\u0430\u043A\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u043F\u0435\u0440\u0435\u043E\u043F\u0440\u0435\u0434\u0435\u043B\u0435\u043D\u0430 \u0441\u043A\u0440\u0438\u043F\u0442\u043E\u043C.",
			"zh-CN": "\u540C\u65F6\u8986\u76D6\u5F39\u7A97\u5916\u7684\u6EDA\u52A8"
		},
		"Zoom origin": {
			"_info": {
				"instances": [
					{
						"setting": "scroll_zoom_origin",
						"field": "name"
					}
				]
			},
			"pt-BR": "Origem do zoom",
			"ru": "\u041D\u0430\u0447\u0430\u043B\u043E \u043C\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F",
			"zh-CN": "\u7F29\u653E\u539F\u70B9"
		},
		"The point on the image it's zoomed in/out from": {
			"_info": {
				"instances": [
					{
						"setting": "scroll_zoom_origin",
						"field": "description"
					}
				]
			},
			"pt-BR": "O ponto da imagem a partir do qual \u00E9 ampliado/reduzido",
			"ru": "\u0422\u043E\u0447\u043A\u0430 \u043D\u0430 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0438, \u043E\u0442 \u043A\u043E\u0442\u043E\u0440\u043E\u0439 \u043E\u043D\u043E \u0443\u0432\u0435\u043B\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044F/\u0443\u043C\u0435\u043D\u044C\u0448\u0430\u0435\u0442\u0441\u044F.",
			"zh-CN": "\u56FE\u50CF\u653E\u5927/\u7F29\u5C0F\u7684\u539F\u70B9"
		},
		"Cursor": {
			"_info": {
				"instances": [
					{
						"setting": "scroll_zoom_origin",
						"field": "options.cursor.name"
					}
				]
			},
			"ko": "\uCEE4\uC11C",
			"pt-BR": "Cursor",
			"ru": "\u041A\u0443\u0440\u0441\u043E\u0440",
			"zh-CN": "\u9F20\u6807\u6307\u9488"
		},
		"Center": {
			"_info": {
				"instances": [
					{
						"setting": "scroll_zoom_origin",
						"field": "options.center.name"
					}
				]
			},
			"pt-BR": "Centro",
			"ru": "\u0426\u0435\u043D\u0442\u0440",
			"zh-CN": "\u4E2D\u5FC3"
		},
		"Zoom out towards page middle": {
			"_info": {
				"instances": [
					{
						"setting": "scroll_zoomout_pagemiddle",
						"field": "name"
					}
				]
			},
			"pt-BR": "Reduzir o zoom em dire\u00E7\u00E3o ao meio da p\u00E1gina",
			"ru": "\u0423\u043C\u0435\u043D\u044C\u0448\u0435\u043D\u0438\u0435 \u043C\u0430\u0441\u0448\u0442\u0430\u0431\u0430 \u043A \u0441\u0435\u0440\u0435\u0434\u0438\u043D\u0435 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u044B",
			"zh-CN": "\u7F29\u5C0F\u5230\u9875\u9762\u4E2D\u95F4"
		},
		"Sets the origin when zooming out to the page middle, overriding the \"Zoom Origin\" option above.": {
			"_info": {
				"instances": [
					{
						"setting": "scroll_zoomout_pagemiddle",
						"field": "description"
					}
				]
			},
			"pt-BR": "Define a origem ao diminuir o zoom para o meio da p\u00E1gina, substituindo a op\u00E7\u00E3o \"Origem do Zoom\" acima.",
			"ru": "\u0423\u0441\u0442\u0430\u043D\u0430\u0432\u043B\u0438\u0432\u0430\u0435\u0442 \u043D\u0430\u0447\u0430\u043B\u043E \u043A\u043E\u043E\u0440\u0434\u0438\u043D\u0430\u0442 \u043F\u0440\u0438 \u0443\u043C\u0435\u043D\u044C\u0448\u0435\u043D\u0438\u0438 \u043C\u0430\u0441\u0448\u0442\u0430\u0431\u0430 \u0434\u043E \u0441\u0435\u0440\u0435\u0434\u0438\u043D\u044B \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u044B, \u043F\u0435\u0440\u0435\u043E\u043F\u0440\u0435\u0434\u0435\u043B\u044F\u044F \"\u041D\u0430\u0447\u0430\u043B\u043E \u043C\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F\" \u0432\u0430\u0440\u0438\u0430\u043D\u0442 \u0432\u044B\u0448\u0435.",
			"zh-CN": "\u8BBE\u7F6E\u7F29\u653E\u5230\u9875\u9762\u4E2D\u95F4\u65F6\u7684\u539F\u70B9\uFF0C\u91CD\u5199\u4E0A\u653E\u7684\u201C\u7F29\u653E\u539F\u70B9\u201D\u9009\u9879\u3002"
		},
		"Within viewport": {
			"_info": {
				"instances": [
					{
						"setting": "scroll_zoomout_pagemiddle",
						"field": "options.viewport.name"
					}
				]
			},
			"pt-BR": "Dentro da \u00E1rea de visualiza\u00E7\u00E3o",
			"ru": "\u0412 \u043F\u0440\u0435\u0434\u0435\u043B\u0430\u0445 \u043E\u0431\u043B\u0430\u0441\u0442\u0438 \u043F\u0440\u043E\u0441\u043C\u043E\u0442\u0440\u0430",
			"zh-CN": "\u5728\u89C6\u91CE\u5185"
		},
		"Zoom behavior": {
			"_info": {
				"instances": [
					{
						"setting": "scroll_zoom_behavior",
						"field": "name"
					}
				]
			},
			"ko": "\uC90C \uB3D9\uC791",
			"pt-BR": "Comportamento do zoom",
			"ru": "\u041F\u043E\u0432\u0435\u0434\u0435\u043D\u0438\u0435 \u043C\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F",
			"zh-CN": "\u7F29\u653E\u884C\u4E3A"
		},
		"How zooming should work": {
			"_info": {
				"instances": [
					{
						"setting": "scroll_zoom_behavior",
						"field": "description"
					}
				]
			},
			"pt-BR": "Como o zoom deve funcionar",
			"ru": "\u041A\u0430\u043A \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043E\u0442\u0430\u0442\u044C \u043C\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0435.",
			"zh-CN": "\u7F29\u653E\u5E94\u5982\u4F55\u5DE5\u4F5C"
		},
		"Fit/Full": {
			"_info": {
				"instances": [
					{
						"setting": "scroll_zoom_behavior",
						"field": "options.fitfull.name"
					}
				]
			},
			"ko": "\uD654\uBA74\uB9DE\uCDA4/\uC804\uCCB4",
			"pt-BR": "Ajustar/Original",
			"ru": "\u041F\u043E \u0440\u0430\u0437\u043C\u0435\u0440\u0443/\u041F\u043E\u043B\u043D\u043E\u0435",
			"zh-CN": "\u9002\u5E94/\u5168\u5C3A\u5BF8"
		},
		"Toggles between the full size, and fit-to-screen": {
			"_info": {
				"instances": [
					{
						"setting": "scroll_zoom_behavior",
						"field": "options.fitfull.description"
					}
				]
			},
			"pt-BR": "Alterna entre o tamanho original e ajustar \u00E0 tela",
			"ru": "\u041F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u0435 \u043C\u0435\u0436\u0434\u0443 \u043F\u043E\u043B\u043D\u044B\u043C \u0440\u0430\u0437\u043C\u0435\u0440\u043E\u043C \u0438 \u043F\u043E \u0440\u0430\u0437\u043C\u0435\u0440\u0443 \u044D\u043A\u0440\u0430\u043D\u0443.",
			"zh-CN": "\u5728\u5168\u5C3A\u5BF8\u548C\u9002\u5408\u5C4F\u5E55\u4E4B\u95F4\u5207\u6362"
		},
		"Incremental": {
			"_info": {
				"instances": [
					{
						"setting": "scroll_zoom_behavior",
						"field": "options.incremental.name"
					}
				]
			},
			"fr": "Incr\u00E9mentale",
			"ko": "\uC99D\uBD84",
			"pt-BR": "Incremental",
			"ru": "\u041F\u043E\u0448\u0430\u0433\u043E\u0432\u043E\u0435",
			"zh-CN": "\u589E\u91CF"
		},
		"Incremental zoom multiplier": {
			"_info": {
				"instances": [
					{
						"setting": "scroll_incremental_mult",
						"field": "name"
					}
				]
			},
			"pt-BR": "Multiplicador de zoom incremental",
			"ru": "\u041C\u043D\u043E\u0436\u0438\u0442\u0435\u043B\u044C \u043F\u043E\u0448\u0430\u0433\u043E\u0432\u043E\u0433\u043E \u043C\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F",
			"zh-CN": "\u589E\u91CF\u7F29\u653E\u7CFB\u6570"
		},
		"How much to zoom in/out by (for incremental zooming)": {
			"_info": {
				"instances": [
					{
						"setting": "scroll_incremental_mult",
						"field": "description"
					}
				]
			},
			"pt-BR": "Quanto aumentar/diminuir o zoom (para zoom incremental)",
			"ru": "\u041D\u0430 \u0441\u043A\u043E\u043B\u044C\u043A\u043E \u0443\u0432\u0435\u043B\u0438\u0447\u0438\u0442\u044C/\u0443\u043C\u0435\u043D\u044C\u0448\u0438\u0442\u044C \u043C\u0430\u0441\u0448\u0442\u0430\u0431 (\u0434\u043B\u044F \u043F\u043E\u0448\u0430\u0433\u043E\u0432\u043E\u0433\u043E \u043C\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F).",
			"zh-CN": "\u589E\u91CF\u7F29\u653E\u65F6\u6BCF\u6B21\u653E\u5927/\u7F29\u5C0F\u591A\u5C11"
		},
		"x": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_video_speed_amount",
						"field": "number_unit"
					},
					{
						"setting": "scroll_incremental_mult",
						"field": "number_unit"
					}
				]
			},
			"pt-BR": "x",
			"ru": "x",
			"zh-CN": "\u500D"
		},
		"Move with cursor": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_move_with_cursor",
						"field": "name"
					}
				]
			},
			"pt-BR": "Mover com o cursor",
			"ru": "\u041F\u0435\u0440\u0435\u043C\u0435\u0449\u0435\u043D\u0438\u0435 \u0441 \u043F\u043E\u043C\u043E\u0449\u044C\u044E \u043A\u0443\u0440\u0441\u043E\u0440\u0430",
			"zh-CN": "\u968F\u9F20\u6807\u6307\u9488\u79FB\u52A8"
		},
		"Moves the popup as the cursor moves": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_move_with_cursor",
						"field": "description"
					}
				]
			},
			"pt-BR": "Move o pop-up conforme o movimento do cursor",
			"ru": "\u041F\u0435\u0440\u0435\u043C\u0435\u0449\u0430\u0435\u0442 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u043F\u043E \u043C\u0435\u0440\u0435 \u043F\u0435\u0440\u0435\u043C\u0435\u0449\u0435\u043D\u0438\u044F \u043A\u0443\u0440\u0441\u043E\u0440\u0430.",
			"zh-CN": "\u9F20\u6807\u79FB\u52A8\u65F6\u79FB\u52A8\u5F39\u7A97"
		},
		"Move within page": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_move_within_page",
						"field": "name"
					}
				]
			},
			"pt-BR": "Mover dentro da p\u00E1gina",
			"ru": "\u041F\u0435\u0440\u0435\u043C\u0435\u0449\u0435\u043D\u0438\u0435 \u0432\u043D\u0443\u0442\u0440\u0438 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u044B",
			"zh-CN": "\u5728\u9875\u9762\u5185\u79FB\u52A8"
		},
		"Ensures the popup doesn't leave the page": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_move_within_page",
						"field": "description"
					}
				]
			},
			"pt-BR": "Garante que o pop-up n\u00E3o saia da p\u00E1gina",
			"ru": "\u0413\u0430\u0440\u0430\u043D\u0442\u0438\u0440\u0443\u0435\u0442, \u0447\u0442\u043E \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u043D\u0435 \u043F\u043E\u043A\u0438\u043D\u0435\u0442 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0443.",
			"zh-CN": "\u786E\u4FDD\u5F39\u7A97\u4E0D\u4F1A\u79BB\u5F00\u9875\u9762"
		},
		"Zoom out fully to close": {
			"_info": {
				"instances": [
					{
						"setting": "zoom_out_to_close",
						"field": "name"
					}
				]
			},
			"ko": "\uB2EB\uAE30 \uC704\uD574 \uC644\uC804\uD788 \uCD95\uC18C",
			"pt-BR": "Reduzir totalmente o zoom para fechar",
			"ru": "\u0417\u0430\u043A\u0440\u044B\u0432\u0430\u0442\u044C \u043F\u0440\u0438 \u043F\u043E\u043B\u043D\u043E\u043C \u0443\u043C\u0435\u043D\u044C\u0448\u0435\u043D\u0438\u0438 \u043C\u0430\u0441\u0448\u0442\u0430\u0431\u0430",
			"zh-CN": "\u5B8C\u5168\u7F29\u5C0F\u81F3\u5173\u95ED"
		},
		"Closes the popup if you zoom out past the minimum zoom": {
			"_info": {
				"instances": [
					{
						"setting": "zoom_out_to_close",
						"field": "description"
					}
				]
			},
			"ko": "\uCD5C\uC18C \uD06C\uAE30\uB85C \uCD95\uC18C\uD560 \uACBD\uC6B0 \uD31D\uC5C5 \uB2EB\uAE30",
			"pt-BR": "Fecha o pop-up se voc\u00EA reduzir o zoom al\u00E9m do m\u00EDnimo",
			"ru": "\u0417\u0430\u043A\u0440\u044B\u0432\u0430\u0435\u0442 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E, \u0435\u0441\u043B\u0438 \u0432\u044B \u0443\u043C\u0435\u043D\u044C\u0448\u0430\u0435\u0442\u0435 \u043C\u0430\u0441\u0448\u0442\u0430\u0431, \u043F\u0440\u0435\u0432\u044B\u0448\u0430\u044E\u0449\u0438\u0439 \u043C\u0438\u043D\u0438\u043C\u0430\u043B\u044C\u043D\u044B\u0439.",
			"zh-CN": "\u7F29\u5C0F\u8D85\u8FC7\u6700\u5C0F\u7EA7\u522B\u65F6\u5173\u95ED\u5F39\u7A97"
		},
		"Scroll past gallery end to close": {
			"_info": {
				"instances": [
					{
						"setting": "scroll_past_gallery_end_to_close",
						"field": "name"
					}
				]
			},
			"pt-BR": "Rolar al\u00E9m do final da galeria para fechar",
			"ru": "\u0417\u0430\u043A\u0440\u044B\u0432\u0430\u0442\u044C \u043F\u0440\u0438 \u043F\u0440\u043E\u043A\u0440\u0443\u0447\u0438\u0432\u0430\u043D\u0438\u0438 \u0434\u043E \u043A\u043E\u043D\u0446\u0430 \u0433\u0430\u043B\u0435\u0440\u0435\u0438",
			"zh-CN": "\u6EDA\u52A8\u5230\u56FE\u5E93\u672B\u5C3E\u65F6\u5173\u95ED"
		},
		"Closes the popup if you scroll past the end of the gallery": {
			"_info": {
				"instances": [
					{
						"setting": "scroll_past_gallery_end_to_close",
						"field": "description"
					}
				]
			},
			"pt-BR": "Fecha o pop-up se voc\u00EA rolar al\u00E9m do final da galeria",
			"ru": "\u0417\u0430\u043A\u0440\u044B\u0432\u0430\u0435\u0442 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E, \u0435\u0441\u043B\u0438 \u0432\u044B \u043F\u0440\u043E\u043A\u0440\u0443\u0447\u0438\u0432\u0430\u0435\u0442\u0435 \u0435\u0433\u043E \u0434\u043E \u043A\u043E\u043D\u0446\u0430 \u0433\u0430\u043B\u0435\u0440\u0435\u0438.",
			"zh-CN": "\u6EDA\u52A8\u5230\u56FE\u5E93\u7684\u7ED3\u5C3E\u65F6\u5173\u95ED\u5F39\u7A97"
		},
		"Popup position": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_position",
						"field": "name"
					}
				]
			},
			"ko": "\uD31D\uC5C5 \uC704\uCE58",
			"pt-BR": "Posi\u00E7\u00E3o do pop-up",
			"ru": "\u041F\u043E\u043B\u043E\u0436\u0435\u043D\u0438\u0435 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430",
			"zh-CN": "\u5F39\u51FA\u4F4D\u7F6E"
		},
		"Where the popup will appear": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_position",
						"field": "description"
					}
				]
			},
			"ko": "\uD31D\uC5C5\uC774 \uD45C\uC2DC\uB418\uB294 \uC704\uCE58",
			"pt-BR": "Onde o pop-up aparecer\u00E1",
			"ru": "\u0413\u0434\u0435 \u043F\u043E\u044F\u0432\u0438\u0442\u0441\u044F \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E.",
			"zh-CN": "\u5F39\u7A97\u51FA\u73B0\u5728\u54EA\u91CC"
		},
		"Cursor middle": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_position",
						"field": "options.cursor.name"
					}
				]
			},
			"ko": "\uCEE4\uC11C \uC911\uAC04",
			"pt-BR": "Meio do cursor",
			"ru": "\u0421\u0435\u0440\u0435\u0434\u0438\u043D\u0430 \u043A\u0443\u0440\u0441\u043E\u0440\u0430",
			"zh-CN": "\u9F20\u6807\u6307\u9488\u4E3A\u4E2D\u5FC3"
		},
		"Underneath the mouse cursor": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_position",
						"field": "options.cursor.description"
					}
				]
			},
			"ko": "\uB9C8\uC6B0\uC2A4 \uCEE4\uC11C \uC544\uB798",
			"pt-BR": "Abaixo do cursor do mouse",
			"ru": "\u041F\u043E\u0434 \u043A\u0443\u0440\u0441\u043E\u0440\u043E\u043C",
			"zh-CN": "\u9F20\u6807\u6307\u9488\u4E0B\u65B9"
		},
		"Beside cursor": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_position",
						"field": "options.beside_cursor.name"
					}
				]
			},
			"ko": "\uCEE4\uC11C \uC606",
			"pt-BR": "Ao lado do cursor",
			"ru": "\u0420\u044F\u0434\u043E\u043C \u0441 \u043A\u0443\u0440\u0441\u043E\u0440\u043E\u043C",
			"zh-CN": "\u9F20\u6807\u6307\u9488\u65C1"
		},
		"Page middle": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_position",
						"field": "options.center.name"
					}
				]
			},
			"ko": "\uD398\uC774\uC9C0 \uC911\uAC04",
			"pt-BR": "Meio da p\u00E1gina",
			"ru": "\u0421\u0435\u0440\u0435\u0434\u0438\u043D\u0430 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u044B",
			"zh-CN": "\u9875\u9762\u4E2D\u95F4"
		},
		"Prevent cursor overlap": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_prevent_cursor_overlap",
						"field": "name"
					}
				]
			},
			"pt-BR": "Evitar sobreposi\u00E7\u00E3o do cursor",
			"ru": "\u041F\u0440\u0435\u0434\u043E\u0442\u0432\u0440\u0430\u0442\u0438\u0442\u044C \u043F\u0435\u0440\u0435\u043A\u0440\u044B\u0442\u0438\u0435 \u043A\u0443\u0440\u0441\u043E\u0440\u0430",
			"zh-CN": "\u907F\u514D\u6307\u9488\u91CD\u53E0"
		},
		"Prevents the image from overlapping with the cursor": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_prevent_cursor_overlap",
						"field": "description"
					}
				]
			},
			"pt-BR": "Impede que a imagem se sobreponha ao cursor",
			"ru": "\u041F\u0440\u0435\u0434\u043E\u0442\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043F\u0435\u0440\u0435\u043A\u0440\u044B\u0442\u0438\u0435 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 \u0441 \u043A\u0443\u0440\u0441\u043E\u0440\u043E\u043C.",
			"zh-CN": "\u907F\u514D\u56FE\u50CF\u4E0E\u9F20\u6807\u6307\u9488\u91CD\u53E0"
		},
		"Center popup on overflow": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_overflow_position_center",
						"field": "name"
					}
				]
			},
			"pt-BR": "Centralizar pop-up em caso de transbordamento",
			"ru": "\u0426\u0435\u043D\u0442\u0440\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u043F\u0440\u0438 \u043F\u0435\u0440\u0435\u043F\u043E\u043B\u043D\u0435\u043D\u0438\u0438",
			"zh-CN": "\u6EA2\u51FA\u65F6\u5C06\u5F39\u7A97\u7F6E\u4E8E\u4E2D\u5FC3"
		},
		"Centers the popup if its initial size overflows": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_overflow_position_center",
						"field": "description"
					}
				]
			},
			"pt-BR": "Centraliza o pop-up se seu tamanho inicial transbordar",
			"ru": "\u0426\u0435\u043D\u0442\u0440\u0438\u0440\u0443\u0435\u0442 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E, \u0435\u0441\u043B\u0438 \u0435\u0433\u043E \u043D\u0430\u0447\u0430\u043B\u044C\u043D\u044B\u0439 \u0440\u0430\u0437\u043C\u0435\u0440 \u043F\u0435\u0440\u0435\u043F\u043E\u043B\u043D\u044F\u0435\u0442\u0441\u044F",
			"zh-CN": "\u5982\u679C\u521D\u59CB\u5927\u5C0F\u6EA2\u51FA\uFF0C\u5C06\u5F39\u7A97\u7F6E\u4E8E\u4E2D\u5FC3\u4F4D\u7F6E"
		},
		"Overflow origin": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_overflow_origin",
						"field": "name"
					}
				]
			},
			"pt-BR": "Origem do transbordamento",
			"ru": "\u041D\u0430\u0447\u0430\u043B\u043E \u043F\u0435\u0440\u0435\u043F\u043E\u043B\u043D\u0435\u043D\u0438\u044F",
			"zh-CN": "\u6EA2\u51FA\u539F\u70B9"
		},
		"Where the popup will appear in the page if its initial size overflows": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_overflow_origin",
						"field": "description"
					}
				]
			},
			"pt-BR": "Onde o pop-up aparecer\u00E1 na p\u00E1gina se seu tamanho inicial transbordar",
			"ru": "\u0413\u0434\u0435 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u043F\u043E\u044F\u0432\u0438\u0442\u0441\u044F \u043D\u0430 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0435, \u0435\u0441\u043B\u0438 \u0435\u0433\u043E \u043D\u0430\u0447\u0430\u043B\u044C\u043D\u044B\u0439 \u0440\u0430\u0437\u043C\u0435\u0440 \u043F\u0435\u0440\u0435\u043F\u043E\u043B\u043D\u044F\u0435\u0442\u0441\u044F",
			"zh-CN": "\u5982\u679C\u521D\u59CB\u5927\u5C0F\u6EA2\u51FA\uFF0C\u5F39\u7A97\u5C06\u51FA\u73B0\u5728\u9875\u9762\u7684\u54EA\u4E2A\u4F4D\u7F6E"
		},
		"Hide cursor over popup": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_hide_cursor",
						"field": "name"
					}
				]
			},
			"pt-BR": "Ocultar cursor sobre o pop-up",
			"ru": "\u0421\u043A\u0440\u044B\u0432\u0430\u0442\u044C \u043A\u0443\u0440\u0441\u043E\u0440 \u043D\u0430 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u043C \u043E\u043A\u043D\u0435",
			"zh-CN": "\u5F39\u7A97\u4E0A\u9690\u85CF\u9F20\u6807\u6307\u9488"
		},
		"Hides the cursor when the mouse is over the popup": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_hide_cursor",
						"field": "description"
					}
				]
			},
			"pt-BR": "Oculta o cursor quando o mouse est\u00E1 sobre o pop-up",
			"ru": "\u0421\u043A\u0440\u044B\u0432\u0430\u0435\u0442 \u043A\u0443\u0440\u0441\u043E\u0440, \u043A\u043E\u0433\u0434\u0430 \u043C\u044B\u0448\u044C \u043D\u0430\u0445\u043E\u0434\u0438\u0442\u0441\u044F \u043D\u0430 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u043C \u043E\u043A\u043D\u0435.",
			"zh-CN": "\u9F20\u6807\u5728\u5F39\u7A97\u4E0A\u60AC\u505C\u65F6\u9690\u85CF\u6307\u9488"
		},
		"Hide cursor after": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_hide_cursor_after",
						"field": "name"
					}
				]
			},
			"pt-BR": "Ocultar cursor ap\u00F3s",
			"ru": "\u0421\u043A\u0440\u044B\u0432\u0430\u0442\u044C \u043A\u0443\u0440\u0441\u043E\u0440 \u043F\u043E\u0441\u043B\u0435",
			"zh-CN": "\u9690\u85CF\u6307\u9488\u5EF6\u8FDF"
		},
		"Hides the cursor over the popup after a specified period of time (in milliseconds), 0 always hides the cursor": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_hide_cursor_after",
						"field": "description"
					}
				]
			},
			"pt-BR": "Oculta o cursor sobre o pop-up ap\u00F3s um per\u00EDodo de tempo especificado (em milissegundos), 0 sempre oculta o cursor",
			"ru": "\u0421\u043A\u0440\u044B\u0432\u0430\u0435\u0442 \u043A\u0443\u0440\u0441\u043E\u0440 \u0432\u043E \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u043C \u043E\u043A\u043D\u0435 \u043F\u043E\u0441\u043B\u0435 \u043E\u043F\u0440\u0435\u0434\u0435\u043B\u0435\u043D\u043D\u043E\u0433\u043E \u043F\u0435\u0440\u0438\u043E\u0434\u0430 \u0432\u0440\u0435\u043C\u0435\u043D\u0438 (\u0432 \u043C\u0438\u043B\u043B\u0438\u0441\u0435\u043A\u0443\u043D\u0434\u0430\u0445). `0` - \u0432\u0441\u0435\u0433\u0434\u0430 \u0441\u043A\u0440\u044B\u0432\u0430\u0442\u044C \u043A\u0443\u0440\u0441\u043E\u0440.",
			"zh-CN": "\u9F20\u6807\u5728\u5F39\u7A97\u4E0A\u505C\u7559\u6307\u5B9A\u65F6\u95F4\uFF08\u6BEB\u79D2\uFF09\u540E\u9690\u85CF\u6307\u9488\uFF0C0 \u4E3A\u7ACB\u5373\u9690\u85CF"
		},
		"Mouse jitter threshold": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_mouse_inactivity_jitter",
						"field": "name"
					}
				]
			},
			"pt-BR": "Limiar de oscila\u00E7\u00E3o do mouse",
			"ru": "\u041F\u043E\u0440\u043E\u0433 \u0434\u0440\u043E\u0436\u0430\u043D\u0438\u044F \u043C\u044B\u0448\u0438",
			"zh-CN": "\u9F20\u6807\u6296\u52A8\u9608\u503C"
		},
		"Threshold for mouse movement before the mouse cursor is shown again, 0 always shows the cursor after any movement": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_mouse_inactivity_jitter",
						"field": "description"
					}
				]
			},
			"pt-BR": "Limiar para movimento do mouse antes que o cursor seja mostrado novamente, 0 sempre mostra o cursor ap\u00F3s qualquer movimento",
			"ru": "\u041F\u043E\u0440\u043E\u0433 \u0434\u043B\u044F \u043F\u0435\u0440\u0435\u043C\u0435\u0449\u0435\u043D\u0438\u044F \u043C\u044B\u0448\u0438 \u0434\u043E \u0442\u043E\u0433\u043E, \u043A\u0430\u043A \u043A\u0443\u0440\u0441\u043E\u0440 \u043C\u044B\u0448\u0438 \u0431\u0443\u0434\u0435\u0442 \u043F\u043E\u043A\u0430\u0437\u0430\u043D \u0441\u043D\u043E\u0432\u0430. `0` - \u0432\u0441\u0435\u0433\u0434\u0430 \u043F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0442\u044C \u043A\u0443\u0440\u0441\u043E\u0440 \u043F\u043E\u0441\u043B\u0435 \u043B\u044E\u0431\u043E\u0433\u043E \u0434\u0432\u0438\u0436\u0435\u043D\u0438\u044F.",
			"zh-CN": "\u9F20\u6807\u6307\u9488\u518D\u6B21\u663E\u793A\u524D\u7684\u79FB\u52A8\u9608\u503C\uFF0C0 \u4E3A\u59CB\u7EC8\u663E\u793A\u79FB\u52A8\u540E\u7684\u6307\u9488"
		},
		"px": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_zoom_max_width",
						"field": "number_unit"
					},
					{
						"setting": "mouseover_zoom_max_height",
						"field": "number_unit"
					},
					{
						"setting": "mouseover_mouse_inactivity_jitter",
						"field": "number_unit"
					}
				]
			},
			"pt-BR": "px",
			"ru": "\u043F\u0438\u043A\u0441.",
			"zh-CN": "\u50CF\u7D20"
		},
		"Disable pointer events": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_clickthrough",
						"field": "name"
					}
				]
			},
			"pt-BR": "Desabilitar eventos do ponteiro",
			"ru": "\u041E\u0442\u043A\u043B\u044E\u0447\u0438\u0442\u044C \u0441\u043E\u0431\u044B\u0442\u0438\u044F \u0443\u043A\u0430\u0437\u0430\u0442\u0435\u043B\u044F",
			"zh-CN": "\u7981\u7528\u6307\u9488\u4E8B\u4EF6"
		},
		"Enabling this option will allow you to click on links underneath the popup": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_clickthrough",
						"field": "description"
					}
				]
			},
			"pt-BR": "Habilitar esta op\u00E7\u00E3o permitir\u00E1 que voc\u00EA clique em links sob o pop-up",
			"ru": "\u0412\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u0435 \u044D\u0442\u043E\u0433\u043E \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u0430 \u043F\u043E\u0437\u0432\u043E\u043B\u0438\u0442 \u0432\u0430\u043C \u043D\u0430\u0436\u0438\u043C\u0430\u0442\u044C \u043D\u0430 \u0441\u0441\u044B\u043B\u043A\u0438 \u043F\u043E\u0434 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0438\u043C \u043E\u043A\u043D\u043E\u043C.",
			"zh-CN": "\u542F\u7528\u6B64\u9009\u9879\u5C06\u5141\u8BB8\u60A8\u5355\u51FB\u5F39\u7A97\u4E0B\u65B9\u7684\u94FE\u63A5"
		},
		"Ignore clicks outside popup": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_mask_ignore_clicks",
						"field": "name"
					}
				]
			},
			"pt-BR": "Ignorar cliques fora do pop-up",
			"ru": "\u0418\u0433\u043D\u043E\u0440\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u043A\u043B\u0438\u043A\u0438 \u0432\u043D\u0435 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430",
			"zh-CN": "\u5FFD\u7565\u5F39\u7A97\u5916\u7684\u70B9\u51FB"
		},
		"Any mouse event outside the popup will be discarded with this option": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_mask_ignore_clicks",
						"field": "description"
					}
				]
			},
			"pt-BR": "Qualquer evento de mouse fora do pop-up ser\u00E1 descartado com esta op\u00E7\u00E3o",
			"ru": "\u041B\u044E\u0431\u043E\u0435 \u0441\u043E\u0431\u044B\u0442\u0438\u0435 \u043C\u044B\u0448\u0438 \u0432\u043D\u0435 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430 \u0431\u0443\u0434\u0435\u0442 \u043E\u0442\u043C\u0435\u043D\u0435\u043D\u043E \u044D\u0442\u0438\u043C \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u043E\u043C.",
			"zh-CN": "\u542F\u7528\u6B64\u9009\u9879\u540E\uFF0C\u4EFB\u4F55\u5F39\u7A97\u5916\u7684\u9F20\u6807\u4E8B\u4EF6\u90FD\u5C06\u4E22\u5F03"
		},
		"Enable downloading HLS/DASH streams": {
			"_info": {
				"instances": [
					{
						"setting": "enable_stream_download",
						"field": "name"
					}
				]
			},
			"pt-BR": "Habilitar download de transmiss\u00F5es HLS/DASH",
			"ru": "\u0412\u043A\u043B\u044E\u0447\u0438\u0442\u044C \u0441\u043A\u0430\u0447\u0438\u0432\u0430\u043D\u0438\u0435 \u043F\u043E\u0442\u043E\u043A\u043E\u0432 HLS/DASH",
			"zh-CN": "\u542F\u7528 HLS/DASH \u6D41\u5A92\u4F53\u7684\u4E0B\u8F7D"
		},
		"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.": {
			"_info": {
				"instances": [
					{
						"setting": "enable_stream_download",
						"field": "description"
					}
				]
			},
			"pt-BR": "Baixa e multiplexa o conte\u00FAdo dos streams em vez do arquivo de informa\u00E7\u00F5es do stream.\nAtualmente, isso n\u00E3o funciona em navegadores modernos devido a restri\u00E7\u00F5es do `SharedArrayBuffer`."
		},
		"Prefer MP4 over MKV": {
			"_info": {
				"instances": [
					{
						"setting": "stream_mux_mp4_over_mkv",
						"field": "name"
					}
				]
			},
			"pt-BR": "Preferir MP4 em vez de MKV",
			"ru": "\u041F\u0440\u0435\u0434\u043F\u043E\u0447\u0438\u0442\u0430\u0442\u044C MP4, \u0430 \u043D\u0435 MKV",
			"zh-CN": "\u504F\u597D MP4 \u4EE3\u66FF MKV"
		},
		"Tries to mux the video into mp4 instead of mkv when required. This may slightly slow down muxing as it currently needs to try muxing both.": {
			"_info": {
				"instances": [
					{
						"setting": "stream_mux_mp4_over_mkv",
						"field": "description"
					}
				]
			},
			"pt-BR": "Tenta multiplexar o v\u00EDdeo em mp4 em vez de mkv quando necess\u00E1rio. Isso pode diminuir um pouco a multiplexa\u00E7\u00E3o, pois atualmente precisa tentar multiplexar ambos.",
			"ru": "\u041F\u044B\u0442\u0430\u0435\u0442\u0441\u044F \u043C\u0443\u043B\u044C\u0442\u0438\u043F\u043B\u0435\u043A\u0441\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0432\u0438\u0434\u0435\u043E \u0432 mp4 \u0432\u043C\u0435\u0441\u0442\u043E mkv, \u043A\u043E\u0433\u0434\u0430 \u044D\u0442\u043E \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044F. \u042D\u0442\u043E \u043C\u043E\u0436\u0435\u0442 \u0441\u043B\u0435\u0433\u043A\u0430 \u0437\u0430\u043C\u0435\u0434\u043B\u0438\u0442\u044C \u043F\u0440\u043E\u0446\u0435\u0441\u0441 \u043C\u0443\u043B\u044C\u0442\u0438\u043F\u043B\u0435\u043A\u0441\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F, \u0442\u0430\u043A \u043A\u0430\u043A \u0432 \u043D\u0430\u0441\u0442\u043E\u044F\u0449\u0435\u0435 \u0432\u0440\u0435\u043C\u044F \u043D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u043E \u043F\u043E\u043F\u0440\u043E\u0431\u043E\u0432\u0430\u0442\u044C \u043C\u0443\u043B\u044C\u0442\u0438\u043F\u043B\u0435\u043A\u0441\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0438 \u0442\u043E, \u0438 \u0434\u0440\u0443\u0433\u043E\u0435.",
			"zh-CN": "\u8BF7\u6C42\u65F6\u5C1D\u8BD5\u7528 mp4 \u4EE3\u66FF mkv\u3002\u8FD9\u53EF\u80FD\u7A0D\u5FAE\u964D\u4F4E\u7EC4\u5408\u5185\u5BB9\u7684\u901F\u5EA6\uFF0C\u56E0\u4E3A\u76EE\u524D\u9700\u8981\u5C1D\u8BD5\u4E24\u7EC4\u64CD\u4F5C\u3002"
		},
		"Link image": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_add_link",
						"field": "name"
					}
				]
			},
			"pt-BR": "Vincular imagem",
			"ru": "\u0421\u0441\u044B\u043B\u043A\u0430 \u043D\u0430 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F",
			"zh-CN": "\u94FE\u63A5\u56FE\u50CF"
		},
		"Adds a link to the image in the popup": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_add_link",
						"field": "description"
					}
				]
			},
			"pt-BR": "Adiciona um link para a imagem no pop-up",
			"ru": "\u0414\u043E\u0431\u0430\u0432\u043B\u044F\u0435\u0442 \u0441\u0441\u044B\u043B\u043A\u0443 \u043D\u0430 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 \u0432\u043E \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u043C \u043E\u043A\u043D\u0435.",
			"zh-CN": "\u5728\u5F39\u7A97\u7684\u56FE\u50CF\u4E2D\u6DFB\u52A0\u94FE\u63A5"
		},
		"Link video": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_add_video_link",
						"field": "name"
					}
				]
			},
			"pt-BR": "Vincular v\u00EDdeo",
			"ru": "\u0421\u0441\u044B\u043B\u043A\u0430 \u043D\u0430 \u0432\u0438\u0434\u0435\u043E",
			"zh-CN": "\u94FE\u63A5\u89C6\u9891"
		},
		"Adds a link to the video in the popup": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_add_video_link",
						"field": "description"
					}
				]
			},
			"pt-BR": "Adiciona um link para o v\u00EDdeo no pop-up",
			"ru": "\u0414\u043E\u0431\u0430\u0432\u043B\u044F\u0435\u0442 \u0441\u0441\u044B\u043B\u043A\u0443 \u043D\u0430 \u0432\u0438\u0434\u0435\u043E \u0432\u043E \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u043C \u043E\u043A\u043D\u0435.",
			"zh-CN": "\u5728\u5F39\u7A97\u7684\u89C6\u9891\u4E2D\u6DFB\u52A0\u94FE\u63A5"
		},
		"Clicking image closes": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_click_image_close",
						"field": "name"
					}
				]
			},
			"pt-BR": "Fecha a imagem ao clicar",
			"ru": "\u0417\u0430\u043A\u0440\u044B\u0432\u0430\u0442\u044C \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 \u043F\u043E \u043D\u0430\u0436\u0430\u0442\u0438\u044E \u043D\u0430 \u043D\u0435\u0433\u043E",
			"zh-CN": "\u70B9\u51FB\u56FE\u7247\u5173\u95ED"
		},
		"Clicking the popup image closes the popup": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_click_image_close",
						"field": "description"
					}
				]
			},
			"pt-BR": "Fecha o pop-up ao clicar na imagem",
			"ru": "\u041D\u0430\u0436\u0430\u0442\u0438\u0435 \u043D\u0430 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 \u0437\u0430\u043A\u0440\u044B\u0432\u0430\u0435\u0442 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E.",
			"zh-CN": "\u5355\u51FB\u5F39\u51FA\u56FE\u50CF\u5C06\u5173\u95ED\u5F39\u7A97"
		},
		"Clicking video closes": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_click_video_close",
						"field": "name"
					}
				]
			},
			"pt-BR": "Fecha o v\u00EDdeo ao clicar",
			"ru": "\u0417\u0430\u043A\u0440\u044B\u0432\u0430\u0442\u044C \u0432\u0438\u0434\u0435\u043E \u043F\u043E \u043D\u0430\u0436\u0430\u0442\u0438\u044E \u043D\u0430 \u043D\u0435\u0433\u043E",
			"zh-CN": "\u70B9\u51FB\u89C6\u9891\u5173\u95ED"
		},
		"Clicking the popup video closes the popup": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_click_video_close",
						"field": "description"
					}
				]
			},
			"pt-BR": "Fecha o pop-up ao clicar no v\u00EDdeo",
			"ru": "\u041D\u0430\u0436\u0430\u0442\u0438\u0435 \u043D\u0430 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u0432\u0438\u0434\u0435\u043E \u0437\u0430\u043A\u0440\u044B\u0432\u0430\u0435\u0442 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E.",
			"zh-CN": "\u70B9\u51FB\u5F39\u51FA\u7684\u89C6\u9891\u65F6\u5173\u95ED\u5F39\u7A97"
		},
		"Clicking link downloads": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_download",
						"field": "name"
					}
				]
			},
			"pt-BR": "Clicar no link faz o download",
			"ru": "\u041D\u0430\u0436\u0430\u0442\u0438\u0435 \u043D\u0430 \u0441\u0441\u044B\u043B\u043A\u0443 \u0441\u043A\u0430\u0447\u0438\u0432\u0430\u043D\u0438\u044F",
			"zh-CN": "\u70B9\u51FB\u94FE\u63A5\u4E0B\u8F7D"
		},
		"Instead of opening the link in a new tab, it will download the image/video instead": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_download",
						"field": "description"
					}
				]
			},
			"pt-BR": "Em vez de abrir o link em uma nova guia, ele far\u00E1 o download da imagem/v\u00EDdeo",
			"ru": "\u0412\u043C\u0435\u0441\u0442\u043E \u0442\u043E\u0433\u043E \u0447\u0442\u043E\u0431\u044B \u043E\u0442\u043A\u0440\u044B\u0432\u0430\u0442\u044C \u0441\u0441\u044B\u043B\u043A\u0443 \u0432 \u043D\u043E\u0432\u043E\u0439 \u0432\u043A\u043B\u0430\u0434\u043A\u0435, \u043E\u043D\u0430 \u0431\u0443\u0434\u0435\u0442 \u0441\u043A\u0430\u0447\u0438\u0432\u0430\u0442\u044C \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435/\u0432\u0438\u0434\u0435\u043E.",
			"zh-CN": "\u4E0B\u8F7D\u56FE\u50CF/\u89C6\u9891\uFF0C\u4EE3\u66FF\u5728\u65B0\u6807\u7B7E\u9875\u4E2D\u6253\u5F00\u94FE\u63A5"
		},
		"Close key": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_close_key",
						"field": "name"
					}
				]
			},
			"pt-BR": "Tecla para fechar",
			"ru": "\u041A\u043B\u0430\u0432\u0438\u0448\u0430 \u0437\u0430\u043A\u0440\u044B\u0442\u0438\u044F",
			"zh-CN": "\u5173\u95ED\u952E"
		},
		"Closes the popup when this key is pressed. Currently, ESC will also close the popup regardless of the value of this setting.": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_close_key",
						"field": "description"
					}
				]
			},
			"pt-BR": "Fecha o pop-up quando esta tecla \u00E9 pressionada. Atualmente, ESC tamb\u00E9m fecha o pop-up independentemente do valor desta configura\u00E7\u00E3o.",
			"ru": "\u041F\u0440\u0438 \u043D\u0430\u0436\u0430\u0442\u0438\u0438 \u044D\u0442\u043E\u0439 \u043A\u043B\u0430\u0432\u0438\u0448\u0438, \u0437\u0430\u043A\u0440\u044B\u0432\u0430\u0435\u0442 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E. \u0412 \u043D\u0430\u0441\u0442\u043E\u044F\u0449\u0435\u0435 \u0432\u0440\u0435\u043C\u044F ESC \u0442\u0430\u043A\u0436\u0435 \u0437\u0430\u043A\u0440\u043E\u0435\u0442 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u043D\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043C\u043E \u043E\u0442 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u044F \u044D\u0442\u0438\u0445 \u043D\u0430\u0441\u0442\u0440\u043E\u0435\u043A.",
			"zh-CN": "\u6309\u4E0B\u6B64\u952E\u65F6\u5173\u95ED\u5F39\u7A97\u3002\u76EE\u524D\uFF0CESC \u4E5F\u5C06\u5173\u95ED\u5F39\u7A97\uFF0C\u5E76\u4E14\u65E0\u89C6\u6B64\u8BBE\u7F6E\u3002"
		},
		"Download key": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_download_key",
						"field": "name"
					}
				]
			},
			"pt-BR": "Tecla para download",
			"ru": "\u041A\u043B\u0430\u0432\u0438\u0448\u0430 \u0441\u043A\u0430\u0447\u0438\u0432\u0430\u043D\u0438\u044F",
			"zh-CN": "\u4E0B\u8F7D\u952E"
		},
		"Downloads the image in the popup when this key is pressed": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_download_key",
						"field": "description"
					}
				]
			},
			"pt-BR": "Baixa a imagem no pop-up quando esta tecla \u00E9 pressionada",
			"ru": "\u041F\u0440\u0438 \u043D\u0430\u0436\u0430\u0442\u0438\u0438 \u044D\u0442\u043E\u0439 \u043A\u043B\u0430\u0432\u0438\u0448\u0438, \u043D\u0430\u0447\u043D\u0451\u0442 \u0441\u043A\u0430\u0447\u0438\u0432\u0430\u0442\u044C \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 \u0432\u043E \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u043C \u043E\u043A\u043D\u0435.",
			"zh-CN": "\u6309\u4E0B\u6B64\u952E\u65F6\u4E0B\u8F7D\u5F39\u7A97\u4E2D\u7684\u56FE\u50CF"
		},
		"Open in new tab key": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_open_new_tab_key",
						"field": "name"
					}
				]
			},
			"pt-BR": "Tecla para abrir em uma nova guia",
			"ru": "\u041A\u043B\u0430\u0432\u0438\u0448\u0430 \u043E\u0442\u043A\u0440\u044B\u0442\u0438\u044F \u0432 \u043D\u043E\u0432\u043E\u0439 \u0432\u043A\u043B\u0430\u0434\u043A\u0435",
			"zh-CN": "\u5728\u65B0\u5EFA\u6807\u7B7E\u9875\u4E2D\u6253\u5F00\u7684\u6309\u952E"
		},
		"Opens the image in the popup in a new tab when this key is pressed": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_open_new_tab_key",
						"field": "description"
					}
				]
			},
			"pt-BR": "Abre a imagem no pop-up em uma nova guia quando esta tecla \u00E9 pressionada",
			"ru": "\u041F\u0440\u0438 \u043D\u0430\u0436\u0430\u0442\u0438\u0438 \u044D\u0442\u043E\u0439 \u043A\u043B\u0430\u0432\u0438\u0448\u0438, \u043E\u0442\u043A\u0440\u044B\u0432\u0430\u0435\u0442 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 \u0432\u043E \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u043C \u043E\u043A\u043D\u0435 \u043D\u0430 \u043D\u043E\u0432\u043E\u0439 \u0432\u043A\u043B\u0430\u0434\u043A\u0435.",
			"zh-CN": "\u6309\u4E0B\u6B64\u952E\u65F6\u5728\u65B0\u5EFA\u7684\u6807\u7B7E\u9875\u4E2D\u5F39\u7A97\u4E2D\u7684\u56FE\u50CF"
		},
		"Open in background tab key": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_open_bg_tab_key",
						"field": "name"
					}
				]
			},
			"pt-BR": "Tecla para abrir em segundo plano",
			"ru": "\u041A\u043B\u0430\u0432\u0438\u0448\u0430 \u043E\u0442\u043A\u0440\u044B\u0442\u0438\u044F \u0432 \u0444\u043E\u043D\u043E\u0432\u043E\u0439 \u0432\u043A\u043B\u0430\u0434\u043A\u0435",
			"zh-CN": "\u5728\u540E\u53F0\u6807\u7B7E\u9875\u6253\u5F00\u7684\u6309\u952E"
		},
		"Opens the image in the popup in a new tab without switching to it when this key is pressed": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_open_bg_tab_key",
						"field": "description"
					}
				]
			},
			"pt-BR": "Abre a imagem no pop-up em uma nova guia sem alternar para ela quando esta tecla \u00E9 pressionada",
			"ru": "\u041F\u0440\u0438 \u043D\u0430\u0436\u0430\u0442\u0438\u0438 \u044D\u0442\u043E\u0439 \u043A\u043B\u0430\u0432\u0438\u0448\u0438, \u043E\u0442\u043A\u0440\u044B\u0432\u0430\u0435\u0442 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 \u0432\u043E \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u043C \u043E\u043A\u043D\u0435 \u043D\u0430 \u043D\u043E\u0432\u043E\u0439 \u0432\u043A\u043B\u0430\u0434\u043A\u0435, \u043D\u0435 \u043F\u0435\u0440\u0435\u0445\u043E\u0434\u044F \u043D\u0430 \u043D\u0435\u0451.",
			"zh-CN": "\u6309\u4E0B\u6B64\u952E\u65F6\u5728\u65B0\u5EFA\u7684\u540E\u53F0\u6807\u7B7E\u9875\u4E2D\u5F39\u7A97\u4E2D\u7684\u56FE\u50CF"
		},
		"Copy link key": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_copy_link_key",
						"field": "name"
					}
				]
			},
			"pt-BR": "Tecla para copiar link",
			"ru": "\u041A\u043B\u0430\u0432\u0438\u0448\u0430 \u043A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F \u0441\u0441\u044B\u043B\u043A\u0438",
			"zh-CN": "\u590D\u5236\u94FE\u63A5\u952E"
		},
		"Copies the link of the media to the clipboard when this key is pressed": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_copy_link_key",
						"field": "description"
					}
				]
			},
			"pt-BR": "Copia o link da m\u00EDdia para a \u00E1rea de transfer\u00EAncia quando esta tecla \u00E9 pressionada",
			"ru": "\u041F\u0440\u0438 \u043D\u0430\u0436\u0430\u0442\u0438\u0438 \u044D\u0442\u043E\u0439 \u043A\u043B\u0430\u0432\u0438\u0448\u0438, \u043A\u043E\u043F\u0438\u0440\u0443\u0435\u0442 \u0441\u0441\u044B\u043B\u043A\u0443 \u043C\u0435\u0434\u0438\u0430 \u0432 \u0431\u0443\u0444\u0435\u0440 \u043E\u0431\u043C\u0435\u043D\u0430.",
			"zh-CN": "\u6309\u4E0B\u6B64\u952E\u65F6\uFF0C\u5C06\u5A92\u4F53\u94FE\u63A5\u590D\u5236\u5230\u526A\u8D34\u677F"
		},
		"Open options key": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_open_options_key",
						"field": "name"
					}
				]
			},
			"pt-BR": "Tecla para abrir as op\u00E7\u00F5es",
			"ru": "\u041A\u043B\u0430\u0432\u0438\u0448\u0430 \u043E\u0442\u043A\u0440\u044B\u0442\u0438\u044F \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u043E\u0432",
			"zh-CN": "\u6253\u5F00\u9009\u9879\u952E"
		},
		"Opens this page in a new tab when this key is pressed": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_open_options_key",
						"field": "description"
					}
				]
			},
			"pt-BR": "Abre esta p\u00E1gina em uma nova guia quando esta tecla \u00E9 pressionada",
			"ru": "\u041F\u0440\u0438 \u043D\u0430\u0436\u0430\u0442\u0438\u0438 \u044D\u0442\u043E\u0439 \u043A\u043B\u0430\u0432\u0438\u0448\u0438, \u043E\u0442\u043A\u0440\u043E\u0435\u0442 \u044D\u0442\u0443 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0443 \u0432 \u043D\u043E\u0432\u043E\u0439 \u0432\u043A\u043B\u0430\u0434\u043A\u0435.",
			"zh-CN": "\u6309\u4E0B\u6B64\u952E\u65F6\u5728\u6807\u7B7E\u9875\u4E2D\u6253\u5F00\u6B64\u9875\u9762"
		},
		"Open original page key": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_open_orig_page_key",
						"field": "name"
					}
				]
			},
			"pt-BR": "Tecla para abrir a p\u00E1gina original",
			"ru": "\u041A\u043B\u0430\u0432\u0438\u0448\u0430 \u043E\u0442\u043A\u0440\u044B\u0442\u0438\u044F \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u044B \u043E\u0440\u0438\u0433\u0438\u043D\u0430\u043B\u0430",
			"zh-CN": "\u6253\u5F00\u539F\u59CB\u9875\u9762\u952E"
		},
		"Opens the original page (if available) when this key is pressed": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_open_orig_page_key",
						"field": "description"
					}
				]
			},
			"pt-BR": "Abre a p\u00E1gina original (se dispon\u00EDvel) quando esta tecla \u00E9 pressionada",
			"ru": "\u041F\u0440\u0438 \u043D\u0430\u0436\u0430\u0442\u0438\u0438 \u044D\u0442\u043E\u0439 \u043A\u043B\u0430\u0432\u0438\u0448\u0438, \u043E\u0442\u043A\u0440\u044B\u0432\u0430\u0435\u0442 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0443 \u043E\u0440\u0438\u0433\u0438\u043D\u0430\u043B\u0430 (\u0435\u0441\u043B\u0438 \u043E\u043D\u0430 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0430).",
			"zh-CN": "\u6309\u4E0B\u6B64\u952E\u65F6\u6253\u5F00\u539F\u59CB\u9875\u9762\uFF08\u5982\u679C\u53EF\u7528\uFF09"
		},
		"Rotate left key": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_rotate_left_key",
						"field": "name"
					}
				]
			},
			"pt-BR": "Tecla para girar para a esquerda",
			"ru": "\u041A\u043B\u0430\u0432\u0438\u0448\u0430 \u043F\u043E\u0432\u043E\u0440\u043E\u0442\u0430 \u0432\u043B\u0435\u0432\u043E",
			"zh-CN": "\u5411\u5DE6\u65CB\u8F6C\u952E"
		},
		"Rotates the popup 90 degrees to the left": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_rotate_left_key",
						"field": "description"
					}
				]
			},
			"pt-BR": "Gira o pop-up 90 graus para a esquerda",
			"ru": "\u041F\u0440\u0438 \u043D\u0430\u0436\u0430\u0442\u0438\u0438 \u044D\u0442\u043E\u0439 \u043A\u043B\u0430\u0432\u0438\u0448\u0438, \u043F\u043E\u0432\u043E\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u0442 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u043D\u0430 90 \u0433\u0440\u0430\u0434\u0443\u0441\u043E\u0432 \u0432\u043B\u0435\u0432\u043E.",
			"zh-CN": "\u5C06\u5F39\u7A97\u5411\u5DE6\u65CB\u8F6C90\u5EA6"
		},
		"Rotate right key": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_rotate_right_key",
						"field": "name"
					}
				]
			},
			"pt-BR": "Tecla para girar para a direita",
			"ru": "\u041A\u043B\u0430\u0432\u0438\u0448\u0430 \u043F\u043E\u0432\u043E\u0440\u043E\u0442\u0430 \u0432\u043F\u0440\u0430\u0432\u043E",
			"zh-CN": "\u5411\u53F3\u65CB\u8F6C\u952E"
		},
		"Rotates the popup 90 degrees to the right": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_rotate_right_key",
						"field": "description"
					}
				]
			},
			"pt-BR": "Gira o pop-up 90 graus para a direita",
			"ru": "\u041F\u0440\u0438 \u043D\u0430\u0436\u0430\u0442\u0438\u0438 \u044D\u0442\u043E\u0439 \u043A\u043B\u0430\u0432\u0438\u0448\u0438, \u043F\u043E\u0432\u043E\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u0442 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u043D\u0430 90 \u0433\u0440\u0430\u0434\u0443\u0441\u043E\u0432 \u0432\u043F\u0440\u0430\u0432\u043E.",
			"zh-CN": "\u5C06\u5F39\u7A97\u5411\u53F3\u65CB\u8F6C90\u5EA6"
		},
		"Horizontal flip key": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_flip_horizontal_key",
						"field": "name"
					}
				]
			},
			"pt-BR": "Tecla para inverter horizontalmente",
			"ru": "\u041A\u043B\u0430\u0432\u0438\u0448\u0430 \u0434\u043B\u044F \u043E\u0442\u0440\u0430\u0436\u0435\u043D\u0438\u044F \u043F\u043E \u0433\u043E\u0440\u0438\u0437\u043E\u043D\u0442\u0430\u043B\u0438",
			"zh-CN": "\u6C34\u5E73\u7FFB\u8F6C\u952E"
		},
		"Flips the image horizontally": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_flip_horizontal_key",
						"field": "description"
					}
				]
			},
			"pt-BR": "Inverte a imagem horizontalmente",
			"ru": "\u041F\u0440\u0438 \u043D\u0430\u0436\u0430\u0442\u0438\u0438 \u044D\u0442\u043E\u0439 \u043A\u043B\u0430\u0432\u0438\u0448\u0438, \u0437\u0435\u0440\u043A\u0430\u043B\u044C\u043D\u043E \u043E\u0442\u0440\u0430\u0436\u0430\u0435\u0442 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 \u043F\u043E \u0433\u043E\u0440\u0438\u0437\u043E\u043D\u0442\u0430\u043B\u0438.",
			"zh-CN": "\u6C34\u5E73\u7FFB\u8F6C\u56FE\u50CF"
		},
		"Vertical flip key": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_flip_vertical_key",
						"field": "name"
					}
				]
			},
			"pt-BR": "Tecla para inverter verticalmente",
			"ru": "\u041A\u043B\u0430\u0432\u0438\u0448\u0430 \u0434\u043B\u044F \u043E\u0442\u0440\u0430\u0436\u0435\u043D\u0438\u044F \u043F\u043E \u0432\u0435\u0440\u0442\u0438\u043A\u0430\u043B\u0438",
			"zh-CN": "\u5782\u76F4\u7FFB\u8F6C\u952E"
		},
		"Flips the image vertically": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_flip_vertical_key",
						"field": "description"
					}
				]
			},
			"pt-BR": "Inverte a imagem verticalmente",
			"ru": "\u041F\u0440\u0438 \u043D\u0430\u0436\u0430\u0442\u0438\u0438 \u044D\u0442\u043E\u0439 \u043A\u043B\u0430\u0432\u0438\u0448\u0438, \u0437\u0435\u0440\u043A\u0430\u043B\u044C\u043D\u043E \u043E\u0442\u0440\u0430\u0436\u0430\u0435\u0442 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 \u043F\u043E \u0432\u0435\u0440\u0442\u0438\u043A\u0430\u043B\u0438.",
			"zh-CN": "\u5782\u76F4\u7FFB\u8F6C\u56FE\u50CF"
		},
		"Zoom in key": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_zoom_in_key",
						"field": "name"
					}
				]
			},
			"pt-BR": "Tecla para ampliar",
			"ru": "\u041A\u043B\u0430\u0432\u0438\u0448\u0430 \u0443\u0432\u0435\u043B\u0438\u0447\u0435\u043D\u0438\u044F \u043C\u0430\u0441\u0448\u0442\u0430\u0431\u0430",
			"zh-CN": "\u653E\u5927\u952E"
		},
		"Incrementally zooms into the image": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_zoom_in_key",
						"field": "description"
					}
				]
			},
			"pt-BR": "Amplia a imagem incrementalmente",
			"ru": "\u041F\u0440\u0438 \u043D\u0430\u0436\u0430\u0442\u0438\u0438 \u044D\u0442\u043E\u0439 \u043A\u043B\u0430\u0432\u0438\u0448\u0438, \u0443\u0432\u0435\u043B\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u043C\u0430\u0441\u0448\u0442\u0430\u0431 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F.",
			"zh-CN": "\u9010\u6B65\u653E\u5927\u56FE\u50CF"
		},
		"Zoom out key": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_zoom_out_key",
						"field": "name"
					}
				]
			},
			"pt-BR": "Tecla para reduzir",
			"ru": "\u041A\u043B\u0430\u0432\u0438\u0448\u0430 \u0443\u043C\u0435\u043D\u044C\u0448\u0435\u043D\u0438\u044F \u043C\u0430\u0441\u0448\u0442\u0430\u0431\u0430",
			"zh-CN": "\u7F29\u5C0F\u952E"
		},
		"Incrementally zooms out of the image": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_zoom_out_key",
						"field": "description"
					}
				]
			},
			"pt-BR": "Reduz a imagem incrementalmente",
			"ru": "\u041F\u0440\u0438 \u043D\u0430\u0436\u0430\u0442\u0438\u0438 \u044D\u0442\u043E\u0439 \u043A\u043B\u0430\u0432\u0438\u0448\u0438, \u0443\u043C\u0435\u043D\u044C\u0448\u0430\u0435\u0442 \u043C\u0430\u0441\u0448\u0442\u0430\u0431 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F.",
			"zh-CN": "\u9010\u6B65\u7F29\u5C0F\u56FE\u50CF"
		},
		"Full zoom key": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_zoom_full_key",
						"field": "name"
					}
				]
			},
			"pt-BR": "Tecla para zoom total",
			"ru": "\u041A\u043B\u0430\u0432\u0438\u0448\u0430 \u043F\u043E\u043B\u043D\u043E\u0433\u043E \u043C\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F",
			"zh-CN": "\u5168\u5C3A\u5BF8\u7F29\u653E\u952E"
		},
		"Sets the image to be at a 100% zoom, even if it overflows the screen": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_zoom_full_key",
						"field": "description"
					}
				]
			},
			"pt-BR": "Define a imagem para ter um zoom de 100%, mesmo que transborde a tela",
			"ru": "\u041F\u0440\u0438 \u043D\u0430\u0436\u0430\u0442\u0438\u0438 \u044D\u0442\u043E\u0439 \u043A\u043B\u0430\u0432\u0438\u0448\u0438, \u0443\u0441\u0442\u0430\u043D\u0430\u0432\u043B\u0438\u0432\u0430\u0435\u0442 100%-\u043D\u043E\u0435 \u043C\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0435 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F, \u0434\u0430\u0436\u0435 \u0435\u0441\u043B\u0438 \u043E\u043D\u043E \u043F\u0435\u0440\u0435\u043F\u043E\u043B\u043D\u044F\u0435\u0442 \u044D\u043A\u0440\u0430\u043D.",
			"zh-CN": "\u5C06\u56FE\u50CF\u8BBE\u7F6E\u4E3A 100% \u7F29\u653E\uFF0C\u5373\u4F7F\u5C06\u6EA2\u51FA\u5C4F\u5E55"
		},
		"Fit screen key": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_zoom_fit_key",
						"field": "name"
					}
				]
			},
			"pt-BR": "Tecla para ajustar \u00E0 tela",
			"ru": "\u041A\u043B\u0430\u0432\u0438\u0448\u0430 \u043F\u043E\u0434\u0433\u043E\u043D\u043A\u0438 \u043F\u043E \u0440\u0430\u0437\u043C\u0435\u0440\u0443 \u044D\u043A\u0440\u0430\u043D\u0430",
			"zh-CN": "\u9002\u5408\u5C4F\u5E55\u952E"
		},
		"Sets the image to either be at a 100% zoom, or to fit the screen, whichever is smaller": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_zoom_fit_key",
						"field": "description"
					}
				]
			},
			"pt-BR": "Define a imagem para ter um zoom de 100% ou para caber na tela, o que for menor",
			"ru": "\u041F\u0440\u0438 \u043D\u0430\u0436\u0430\u0442\u0438\u0438 \u044D\u0442\u043E\u0439 \u043A\u043B\u0430\u0432\u0438\u0448\u0438, \u0443\u0441\u0442\u0430\u043D\u0430\u0432\u043B\u0438\u0432\u0430\u0435\u0442 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 \u043B\u0438\u0431\u043E \u0441\u043E 100%-\u043D\u044B\u043C \u043C\u0430\u0441\u0448\u0442\u0430\u0431\u043E\u043C, \u043B\u0438\u0431\u043E \u0432 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0440\u0430\u0437\u043C\u0435\u0440\u043E\u043C \u044D\u043A\u0440\u0430\u043D\u0430, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043C\u043E\u0441\u0442\u0438 \u043E\u0442 \u0442\u043E\u0433\u043E, \u0447\u0442\u043E \u043C\u0435\u043D\u044C\u0448\u0435.",
			"zh-CN": "\u5C06\u56FE\u50CF\u8BBE\u7F6E\u4E3A 100% \u7F29\u653E\u6216\u9002\u5408\u5C4F\u5E55\uFF0C\u4EE5\u8F83\u5C0F\u8005\u4E3A\u51C6"
		},
		"Toggle fullscreen key": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_fullscreen_key",
						"field": "name"
					}
				]
			},
			"pt-BR": "Tecla para alternar tela cheia",
			"ru": "\u041A\u043B\u0430\u0432\u0438\u0448\u0430 \u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u044F \u043D\u0430 \u0432\u0435\u0441\u044C \u044D\u043A\u0440\u0430\u043D",
			"zh-CN": "\u5207\u6362\u5168\u5C4F\u952E"
		},
		"Toggles fullscreen mode for the image/video in the popup": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_fullscreen_key",
						"field": "description"
					}
				]
			},
			"pt-BR": "Alterna o modo de tela cheia para a imagem/v\u00EDdeo no popup",
			"ru": "\u041F\u0440\u0438 \u043D\u0430\u0436\u0430\u0442\u0438\u0438 \u044D\u0442\u043E\u0439 \u043A\u043B\u0430\u0432\u0438\u0448\u0438, \u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0430\u0435\u0442 \u043F\u043E\u043B\u043D\u043E\u044D\u043A\u0440\u0430\u043D\u043D\u044B\u0439 \u0440\u0435\u0436\u0438\u043C \u0434\u043B\u044F \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F/\u0432\u0438\u0434\u0435\u043E \u0432\u043E \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u043C \u043E\u043A\u043D\u0435.",
			"zh-CN": "\u5207\u6362\u5F39\u7A97\u4E2D\u7684\u56FE\u50CF/\u89C6\u9891\u7684\u5168\u5C4F\u6A21\u5F0F"
		},
		"Popup for plain hyperlinks": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_links",
						"field": "name"
					}
				]
			},
			"ko": "\uC77C\uBC18\uC801\uC778 \uB9C1\uD06C\uC5D0\uB3C4 \uD31D\uC5C5",
			"pt-BR": "Popup para hyperlinks simples",
			"ru": "\u0412\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u0434\u043B\u044F \u043F\u0440\u043E\u0441\u0442\u044B\u0445 \u0433\u0438\u043F\u0435\u0440\u0441\u0441\u044B\u043B\u043E\u043A",
			"zh-CN": "\u4E3A\u7EAF\u8D85\u94FE\u63A5\u5F39\u7A97"
		},
		"Whether or not the popup should also open for plain hyperlinks": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_links",
						"field": "description"
					}
				]
			},
			"ko": "\uC77C\uBC18 \uD558\uC774\uD37C\uB9C1\uD06C\uC758 \uD31D\uC5C5 \uC5F4\uAE30 \uC5EC\uBD80",
			"pt-BR": "Se o popup tamb\u00E9m deve abrir para hyperlinks simples",
			"ru": "\u0414\u043E\u043B\u0436\u043D\u043E \u043B\u0438 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u0442\u0430\u043A\u0436\u0435 \u043E\u0442\u043A\u0440\u044B\u0432\u0430\u0442\u044C\u0441\u044F \u0434\u043B\u044F \u043F\u0440\u043E\u0441\u0442\u044B\u0445 \u0433\u0438\u043F\u0435\u0440\u0441\u0441\u044B\u043B\u043E\u043A.",
			"zh-CN": "\u662F\u5426\u4E3A\u7EAF\u7CB9\u7684\u8D85\u94FE\u63A5\u663E\u793A\u5F39\u7A97"
		},
		"Only for links that look valid": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_only_valid_links",
						"field": "name"
					}
				]
			},
			"ko": "\uC720\uD6A8\uD574 \uBCF4\uC774\uB294 \uB9C1\uD06C\uC5D0\uB9CC \uD574\uB2F9",
			"pt-BR": "Somente para links que parecem v\u00E1lidos",
			"ru": "\u0422\u043E\u043B\u044C\u043A\u043E \u0434\u043B\u044F \u0441\u0441\u044B\u043B\u043E\u043A, \u043A\u043E\u0442\u043E\u0440\u044B\u0435 \u0432\u044B\u0433\u043B\u044F\u0434\u044F\u0442 \u0434\u043E\u043F\u0443\u0441\u0442\u0438\u043C\u043E",
			"zh-CN": "\u53EA\u9488\u5BF9\u770B\u8D77\u6765\u6709\u6548\u7684\u94FE\u63A5"
		},
		"Enabling this option will only allow links to be popped up if they look valid (such as if they have a known image/video extension, or are explicitly supported)": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_only_valid_links",
						"field": "description"
					}
				]
			},
			"ko": "\uC774 \uC635\uC158\uC744 \uD65C\uC131\uD654\uD558\uBA74 \uB9C1\uD06C\uAC00 \uC720\uD6A8\uD55C \uAC83\uC73C\uB85C \uBCF4\uC774\uB294 \uACBD\uC6B0\uC5D0\uB9CC(\uC608: \uC54C\uB824\uC9C4 \uC774\uBBF8\uC9C0/\uBE44\uB514\uC624 \uD655\uC7A5\uBA85\uC774 \uC788\uAC70\uB098 \uBA85\uC2DC\uC801\uC73C\uB85C \uC9C0\uC6D0\uB418\uB294 \uACBD\uC6B0) \uB9C1\uD06C\uAC00 \uD31D\uC5C5\uB420 \uC218 \uC788\uC74C",
			"pt-BR": "Ativar esta op\u00E7\u00E3o permitir\u00E1 que os links sejam exibidos em popup apenas se parecerem v\u00E1lidos (como se tiverem uma extens\u00E3o de imagem/v\u00EDdeo conhecida ou forem explicitamente suportados)",
			"ru": "\u0412\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u0435 \u044D\u0442\u043E\u0433\u043E \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u0430 \u043F\u043E\u0437\u0432\u043E\u043B\u0438\u0442 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u0442\u044C \u0441\u0441\u044B\u043B\u043A\u0430\u043C \u0442\u043E\u043B\u044C\u043A\u043E \u0432 \u0442\u043E\u043C \u0441\u043B\u0443\u0447\u0430\u0435, \u0435\u0441\u043B\u0438 \u043E\u043D\u0438 \u0432\u044B\u0433\u043B\u044F\u0434\u044F\u0442 \u0434\u043E\u043F\u0443\u0441\u0442\u0438\u043C\u044B\u043C\u0438 (\u043D\u0430\u043F\u0440\u0438\u043C\u0435\u0440, \u0435\u0441\u043B\u0438 \u043E\u043D\u0438 \u0438\u043C\u0435\u044E\u0442 \u0438\u0437\u0432\u0435\u0441\u0442\u043D\u043E\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u0438\u0435 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F/\u0432\u0438\u0434\u0435\u043E, \u0438\u043B\u0438 \u0435\u0441\u043B\u0438 \u043E\u043D\u0438 \u044F\u0432\u043D\u043E \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044E\u0442\u0441\u044F).",
			"zh-CN": "\u542F\u7528\u6B64\u9009\u9879\u540E\uFF0C\u5C06\u53EA\u4E3A\u770B\u8D77\u6765\u6709\u6548\u7684\u94FE\u63A5\u663E\u793A\u5F39\u7A97\uFF08\u4F8B\u5982\u6709\u5DF2\u77E5\u7684\u56FE\u50CF/\u89C6\u9891\u6269\u5C55\u540D\uFF0C\u6216\u8005\u660E\u663E\u53D7\u652F\u6301\uFF09"
		},
		"Popup page URL": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_allow_self_pagelink",
						"field": "name"
					}
				]
			},
			"pt-BR": "URL da p\u00E1gina do popup",
			"ru": "\u0412\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u0434\u043B\u044F URL \u0441\u0442\u0440\u0430\u043D\u0438\u0446",
			"zh-CN": "\u4E3A\u9875\u9762\u7F51\u5740\u5F39\u7A97"
		},
		"If no element can be found, try the page URL. Only relevant for pagelink rules, such as image and video hosting websites": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_allow_self_pagelink",
						"field": "description"
					}
				]
			},
			"pt-BR": "Se nenhum elemento for encontrado, tente a URL da p\u00E1gina. Relevante apenas para regras de pagelink, como sites de hospedagem de imagem e v\u00EDdeo",
			"ru": "\u0415\u0441\u043B\u0438 \u043D\u0438 \u043E\u0434\u0438\u043D \u044D\u043B\u0435\u043C\u0435\u043D\u0442 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D, \u043F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C URL-\u0430\u0434\u0440\u0435\u0441 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u044B. F\u043A\u0442\u0443\u0430\u043B\u044C\u043D\u043E n\u043E\u043B\u044C\u043A\u043E \u0434\u043B\u044F \u043F\u0440\u0430\u0432\u0438\u043B \u0441\u0441\u044B\u043B\u043A\u0438 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u044B, \u0442\u0430\u043A\u0438\u0445 \u043A\u0430\u043A \u0441\u0430\u0439\u0442\u044B \u0445\u043E\u0441\u0442\u0438\u043D\u0433\u0430 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0439 \u0438 \u0432\u0438\u0434\u0435\u043E.",
			"zh-CN": "\u5982\u679C\u627E\u4E0D\u5230\u5143\u7D20\uFF0C\u5C1D\u8BD5\u9875\u9762\u7F51\u5740\u3002\u53EA\u4E0E pagelink \u89C4\u5219\u76F8\u5173\uFF0C\u5982\u56FE\u50CF\u6216\u89C6\u9891\u6258\u7BA1\u7F51\u7AD9"
		},
		"Popup for `<iframe>`": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_allow_iframe_el",
						"field": "name"
					}
				]
			},
			"ko": "<iframe>\uC5D0 \uB300\uD55C \uD31D\uC5C5",
			"pt-BR": "Popup para `<iframe>`",
			"ru": "\u0412\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u0434\u043B\u044F `<iframe>`",
			"zh-CN": "\u4E3A <iframe> \u5F39\u7A97"
		},
		"Allows `<iframe>` elements to be popped up as well. Storing images/videos in this way is rather uncommon, but it can allow embeds to be supported": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_allow_iframe_el",
						"field": "description"
					}
				]
			},
			"ko": "<iframe>\uC758 \uC694\uC18C\uB4E4\uB3C4 \uD31D\uC5C5\uC774 \uC791\uB3D9\uD558\uB3C4\uB85D \uD5C8\uC6A9. \uC774\uB7F0 \uC2DD\uC73C\uB85C \uC774\uBBF8\uC9C0/\uBE44\uB514\uC624\uB97C \uC800\uC7A5\uD558\uB294 \uAC83\uC740 \uB2E4\uC18C \uB4DC\uBB38 \uC77C\uC774\uC9C0\uB9CC, embeds\uB97C \uC9C0\uC6D0\uD560 \uC218 \uC788\uC74C",
			"pt-BR": "Permite que elementos `<iframe>` tamb\u00E9m sejam abertos em popup. Armazenar imagens/v\u00EDdeos desta forma \u00E9 incomum, mas pode permitir suporte a embeds",
			"ru": "\u041F\u043E\u0437\u0432\u043E\u043B\u044F\u0435\u0442 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u0442\u044C \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u043C `<iframe>`. \u0425\u0440\u0430\u043D\u0435\u043D\u0438\u0435 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0439/\u0432\u0438\u0434\u0435\u043E \u0442\u0430\u043A\u0438\u043C \u043E\u0431\u0440\u0430\u0437\u043E\u043C \u0434\u043E\u0432\u043E\u043B\u044C\u043D\u043E \u0440\u0435\u0434\u043A\u043E\u0435 \u044F\u0432\u043B\u0435\u043D\u0438\u0435, \u043D\u043E \u043E\u043D\u043E \u043C\u043E\u0436\u0435\u0442 \u043F\u043E\u0437\u0432\u043E\u043B\u0438\u0442\u044C \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044C \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043C\u044B\u0435 \u0444\u0430\u0439\u043B\u044B.",
			"zh-CN": "\u5141\u8BB8\u4E3A `<iframe>` \u5143\u7D20\u663E\u793A\u5F39\u7A97\u3002\u4EE5\u8FD9\u79CD\u65B9\u5F0F\u5B58\u50A8\u56FE\u50CF/\u89C6\u9891\u76F8\u5F53\u7F55\u89C1\uFF0C\u4F46\u603B\u4E4B\u53EF\u4EE5\u652F\u6301"
		},
		"Popup for `<canvas>`": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_allow_canvas_el",
						"field": "name"
					}
				]
			},
			"ko": "<canvas>\uC5D0 \uB300\uD55C \uD31D\uC5C5",
			"pt-BR": "Popup para `<canvas>`",
			"ru": "\u0412\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u0434\u043B\u044F `<canvas>`",
			"zh-CN": "\u4E3A <canvas> \u5F39\u7A97"
		},
		"Allows `<canvas>` elements to be popped up as well. This will likely cause popups with any kind of web-based games, so it's recommended to keep this disabled": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_allow_canvas_el",
						"field": "description"
					}
				]
			},
			"ko": "<canvas>\uC758 \uC694\uC18C\uB4E4\uB3C4 \uD31D\uC5C5\uC774 \uC791\uB3D9\uD558\uB3C4\uB85D \uD5C8\uC6A9. \uC774\uAC83\uC740 \uC5B4\uB5A4 \uC885\uB958\uC758 \uC6F9 \uAE30\uBC18 \uAC8C\uC784\uC774\uB77C\uB3C4 \uD31D\uC5C5\uC744 \uC720\uBC1C\uD560 \uAC00\uB2A5\uC131\uC774 \uB192\uC73C\uBBC0\uB85C, \uC774 \uAE30\uB2A5\uC744 \uC0AC\uC6A9\uD558\uC9C0 \uC54A\uB3C4\uB85D \uC720\uC9C0\uD558\uB294 \uAC83\uC774 \uC88B\uC74C",
			"pt-BR": "Permite que elementos `<canvas>` tamb\u00E9m sejam abertos em popup. Isso provavelmente causar\u00E1 popups com qualquer tipo de jogo baseado na web, portanto, \u00E9 recomend\u00E1vel manter esta op\u00E7\u00E3o desativada",
			"ru": "\u041F\u043E\u0437\u0432\u043E\u043B\u044F\u0435\u0442 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u0442\u044C \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u043C `<canvas>`. \u042D\u0442\u043E, \u0441\u043A\u043E\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043E, \u0431\u0443\u0434\u0435\u0442 \u0432\u044B\u0437\u044B\u0432\u0430\u0442\u044C \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0438\u0435 \u043E\u043A\u043D\u0430 \u0441 \u043B\u044E\u0431\u044B\u043C\u0438 \u0432\u0435\u0431-\u0438\u0433\u0440\u0430\u043C\u0438, \u043F\u043E\u044D\u0442\u043E\u043C\u0443 \u0440\u0435\u043A\u043E\u043C\u0435\u043D\u0434\u0443\u0435\u0442\u0441\u044F \u043E\u0442\u043A\u043B\u044E\u0447\u0438\u0442\u044C \u044D\u0442\u0443 \u0444\u0443\u043D\u043A\u0446\u0438\u044E.",
			"zh-CN": "\u5141\u8BB8\u4E3A `<canvas>` \u5143\u7D20\u663E\u793A\u5F39\u7A97\u3002\u8FD9\u53EF\u80FD\u5BFC\u81F4\u5728\u7F51\u9875\u6E38\u620F\u4E0A\u89E6\u53D1\u5F39\u7A97\uFF0C\u6240\u4EE5\u5EFA\u8BAE\u6B64\u9879\u4FDD\u6301\u7981\u7528"
		},
		"Popup for `<svg>`": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_allow_svg_el",
						"field": "name"
					}
				]
			},
			"ko": "<svg>\uC5D0 \uB300\uD55C \uD31D\uC5C5",
			"pt-BR": "Popup para `<svg>`",
			"ru": "\u0412\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u0434\u043B\u044F `<svg>`",
			"zh-CN": "\u4E3A <svg> \u5F39\u7A97"
		},
		"Allows `<svg>` elements to be popped up as well. These are usually used for icons, and can occasionally cause problems for websites that overlay icons on top of images": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_allow_svg_el",
						"field": "description"
					}
				]
			},
			"ko": "<canvas>\uC758 \uC694\uC18C\uB4E4\uB3C4 \uD31D\uC5C5\uC774 \uC791\uB3D9\uD558\uB3C4\uB85D \uD5C8\uC6A9. \uC774\uAC83\uC740 \uBCF4\uD1B5 \uC544\uC774\uCF58\uC5D0 \uC0AC\uC6A9\uB418\uBA70, \uB54C\uB54C\uB85C \uC774\uBBF8\uC9C0 \uC704\uC5D0 \uC544\uC774\uCF58\uC744 \uC624\uBC84\uB808\uC774\uD558\uB294 \uC6F9 \uC0AC\uC774\uD2B8\uC5D0 \uBB38\uC81C\uB97C \uC77C\uC73C\uD0AC \uC218 \uC788\uC74C",
			"pt-BR": "Permite que elementos `<svg>` tamb\u00E9m sejam abertos em popup. Geralmente s\u00E3o usados para \u00EDcones e ocasionalmente podem causar problemas para sites que sobrep\u00F5em \u00EDcones em cima de imagens",
			"ru": "\u041F\u043E\u0437\u0432\u043E\u043B\u044F\u0435\u0442 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u0442\u044C \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u043C `<svg>`. \u041E\u0431\u044B\u0447\u043D\u043E \u043E\u043D\u0438 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u044E\u0442\u0441\u044F \u0434\u043B\u044F \u0438\u043A\u043E\u043D\u043E\u043A \u0438 \u0438\u043D\u043E\u0433\u0434\u0430 \u043C\u043E\u0433\u0443\u0442 \u0432\u044B\u0437\u044B\u0432\u0430\u0442\u044C \u043F\u0440\u043E\u0431\u043B\u0435\u043C\u044B \u0434\u043B\u044F \u0432\u0435\u0431-\u0441\u0430\u0439\u0442\u043E\u0432, \u043A\u043E\u0442\u043E\u0440\u044B\u0435 \u043D\u0430\u043A\u043B\u0430\u0434\u044B\u0432\u0430\u044E\u0442 \u0438\u043A\u043E\u043D\u043A\u0438 \u043F\u043E\u0432\u0435\u0440\u0445 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0439.",
			"zh-CN": "\u5141\u8BB8\u4E3A `<svg>` \u5143\u7D20\u663E\u793A\u5F39\u7A97\u3002\u8FD9\u901A\u5E38\u7528\u4E8E\u56FE\u6807\uFF0C\u5E76\u4E14\u5076\u5C14\u4F1A\u5728\u7F51\u7AD9\u4E8E\u56FE\u50CF\u4E0A\u53E0\u52A0\u56FE\u6807\u65F6\u51FA\u73B0\u95EE\u9898"
		},
		"Enable gallery": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_enable_gallery",
						"field": "name"
					}
				]
			},
			"pt-BR": "Ativar galeria",
			"ru": "\u0412\u043A\u043B\u044E\u0447\u0438\u0442\u044C \u0433\u0430\u043B\u0435\u0440\u0435\u044E",
			"zh-CN": "\u542F\u7528\u56FE\u5E93"
		},
		"Toggles whether gallery detection support should be enabled": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_enable_gallery",
						"field": "description"
					}
				]
			},
			"pt-BR": "Alterna se o suporte \u00E0 detec\u00E7\u00E3o de galeria deve ser ativado",
			"ru": "\u041F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0430\u0435\u0442, \u0434\u043E\u043B\u0436\u043D\u0430 \u043B\u0438 \u0431\u044B\u0442\u044C \u0432\u043A\u043B\u044E\u0447\u0435\u043D\u0430 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u043A\u0430 \u043E\u0431\u043D\u0430\u0440\u0443\u0436\u0435\u043D\u0438\u044F \u0433\u0430\u043B\u0435\u0440\u0435\u0438.",
			"zh-CN": "\u5207\u6362\u662F\u5426\u542F\u7528\u56FE\u5E93\u68C0\u6D4B\u652F\u6301"
		},
		"Cycle gallery": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_gallery_cycle",
						"field": "name"
					}
				]
			},
			"pt-BR": "Ciclo da galeria",
			"ru": "\u0417\u0430\u0446\u0438\u043A\u043B\u0438\u0442\u044C \u0433\u0430\u043B\u0435\u0440\u0435\u044E",
			"zh-CN": "\u56FE\u5E93\u5FAA\u73AF"
		},
		"Going to the previous image for the first image will lead to the last image and vice-versa": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_gallery_cycle",
						"field": "description"
					}
				]
			},
			"pt-BR": "Ir para a imagem anterior na primeira imagem levar\u00E1 para a \u00FAltima imagem e vice-versa",
			"ru": "\u041F\u0435\u0440\u0435\u0445\u043E\u0434 \u043A \u043F\u0440\u0435\u0434\u044B\u0434\u0443\u0449\u0435\u043C\u0443 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044E \u0441 \u043F\u0435\u0440\u0432\u043E\u0433\u043E \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F \u043F\u0440\u0438\u0432\u0435\u0434\u0435\u0442 \u043A \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0435\u043C\u0443 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044E \u0438 \u043D\u0430\u043E\u0431\u043E\u0440\u043E\u0442.",
			"zh-CN": "\u7B2C\u4E00\u4E2A\u56FE\u50CF\u518D\u5411\u4E0A\u62B5\u8FBE\u6700\u540E\u4E00\u4E2A\u56FE\u50CF\uFF0C\u6700\u540E\u4E00\u4E2A\u56FE\u50CF\u5411\u4E0B\u62B5\u8FBE\u7B2C\u4E00\u4E2A\u56FE\u50CF"
		},
		"Previous gallery item": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_gallery_prev_key",
						"field": "name"
					}
				]
			},
			"pt-BR": "Item anterior da galeria",
			"ru": "\u041F\u0440\u0435\u0434\u044B\u0434\u0443\u0449\u0438\u0439 \u044D\u043B\u0435\u043C\u0435\u043D\u0442 \u0433\u0430\u043B\u0435\u0440\u0435\u0438",
			"zh-CN": "\u524D\u4E00\u4E2A\u56FE\u5E93\u9879"
		},
		"Key to trigger the previous gallery item": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_gallery_prev_key",
						"field": "description"
					}
				]
			},
			"pt-BR": "Tecla para acionar o item anterior da galeria",
			"ru": "\u041A\u043B\u0430\u0432\u0438\u0448\u0430 \u0434\u043B\u044F \u0437\u0430\u043F\u0443\u0441\u043A\u0430 \u043F\u0440\u0435\u0434\u044B\u0434\u0443\u0449\u0435\u0433\u043E \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430 \u0433\u0430\u043B\u0435\u0440\u0435\u0438.",
			"zh-CN": "\u89E6\u53D1\u4E0A\u4E00\u4E2A\u56FE\u5E93\u9879\u7684\u6309\u952E"
		},
		"Next gallery item": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_gallery_next_key",
						"field": "name"
					}
				]
			},
			"pt-BR": "Pr\u00F3ximo item da galeria",
			"ru": "\u0421\u043B\u0435\u0434\u0443\u044E\u0449\u0438\u0439 \u044D\u043B\u0435\u043C\u0435\u043D\u0442 \u0433\u0430\u043B\u0435\u0440\u0435\u0438",
			"zh-CN": "\u4E0B\u4E00\u4E2A\u56FE\u5E93\u9879"
		},
		"Key to trigger the next gallery item": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_gallery_next_key",
						"field": "description"
					}
				]
			},
			"pt-BR": "Tecla para acionar o pr\u00F3ximo item da galeria",
			"ru": "\u041A\u043B\u0430\u0432\u0438\u0448\u0430 \u0434\u043B\u044F \u0437\u0430\u043F\u0443\u0441\u043A\u0430 \u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u0433\u043E \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430 \u0433\u0430\u043B\u0435\u0440\u0435\u0438.",
			"zh-CN": "\u89E6\u53D1\u4E0B\u4E00\u4E2A\u56FE\u5E93\u9879\u7684\u6309\u952E"
		},
		"Gallery download key": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_gallery_download_key",
						"field": "name"
					}
				]
			},
			"pt-BR": "Tecla para baixar a galeria",
			"ru": "\u041A\u043B\u0430\u0432\u0438\u0448\u0430 \u0441\u043A\u0430\u0447\u0438\u0432\u0430\u043D\u0438\u044F \u0433\u0430\u043B\u0435\u0440\u0435\u0438",
			"zh-CN": "\u56FE\u5E93\u4E0B\u8F7D\u952E"
		},
		"Key to download the current gallery": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_gallery_download_key",
						"field": "description"
					}
				]
			},
			"pt-BR": "Tecla para baixar a galeria atual",
			"ru": "\u041A\u043B\u0430\u0432\u0438\u0448\u0430 \u0434\u043B\u044F \u0441\u043A\u0430\u0447\u0438\u0432\u0430\u043D\u0438\u044F \u0442\u0435\u043A\u0443\u0449\u0435\u0439 \u0433\u0430\u043B\u0435\u0440\u0435\u0438.",
			"zh-CN": "\u4E0B\u8F7D\u5F53\u524D\u56FE\u5E93\u7684\u6309\u952E"
		},
		"Download method": {
			"_info": {
				"instances": [
					{
						"setting": "gallery_download_method",
						"field": "name"
					}
				]
			},
			"pt-BR": "M\u00E9todo de download",
			"ru": "\u0421\u043F\u043E\u0441\u043E\u0431 \u0441\u043A\u0430\u0447\u0438\u0432\u0430\u043D\u0438\u044F",
			"zh-CN": "\u4E0B\u8F7D\u65B9\u6CD5"
		},
		"How the gallery should be downloaded": {
			"_info": {
				"instances": [
					{
						"setting": "gallery_download_method",
						"field": "description"
					}
				]
			},
			"pt-BR": "Como a galeria deve ser baixada",
			"ru": "\u041A\u0430\u043A \u043D\u0443\u0436\u043D\u043E \u0441\u043A\u0430\u0447\u0438\u0432\u0430\u0442\u044C \u0433\u0430\u043B\u0435\u0440\u0435\u044E",
			"zh-CN": "\u5E94\u5982\u4F55\u4E0B\u8F7D\u56FE\u5E93"
		},
		"Zip file": {
			"_info": {
				"instances": [
					{
						"setting": "gallery_download_method",
						"field": "options.zip.name"
					}
				]
			},
			"pt-BR": "Arquivo Zip",
			"ru": "\u0410\u0440\u0445\u0438\u0432",
			"zh-CN": "Zip \u6587\u4EF6"
		},
		"JDownloader": {
			"_info": {
				"instances": [
					{
						"setting": "gallery_download_method",
						"field": "options.jdownloader.name"
					}
				]
			},
			"pt-BR": "JDownloader",
			"ru": "JDownloader",
			"zh-CN": "JDownloader"
		},
		"Download unchanged media": {
			"_info": {
				"instances": [
					{
						"setting": "gallery_download_unchanged",
						"field": "name"
					}
				]
			},
			"pt-BR": "Baixar m\u00EDdia inalterada",
			"ru": "\u0421\u043A\u0430\u0447\u0438\u0432\u0430\u0442\u044C \u043C\u0435\u0434\u0438\u0430 \u0431\u0435\u0437 \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u0439",
			"zh-CN": "\u4E0B\u8F7D\u672A\u66F4\u6539\u7684\u5A92\u4F53"
		},
		"Includes gallery items that have not been changed. Useful to potentially avoid downloading thumbnails": {
			"_info": {
				"instances": [
					{
						"setting": "gallery_download_unchanged",
						"field": "description"
					}
				]
			},
			"pt-BR": "Inclui itens da galeria que n\u00E3o foram alterados. \u00DAtil para evitar o download de miniaturas",
			"ru": "\u0412\u043A\u043B\u044E\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044F \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B \u0433\u0430\u043B\u0435\u0440\u0435\u0438, \u043A\u043E\u0442\u043E\u0440\u044B\u0435 \u043D\u0435 \u0431\u044B\u043B\u0438 \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u044B. \u041F\u043E\u043B\u0435\u0437\u043D\u043E, \u0447\u0442\u043E\u0431\u044B \u043F\u043E\u0442\u0435\u043D\u0446\u0438\u0430\u043B\u044C\u043D\u043E \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044C \u0441\u043A\u0430\u0447\u0438\u0432\u0430\u043D\u0438\u044F \u043C\u0438\u043D\u0438\u0430\u0442\u044E\u0440.",
			"zh-CN": "\u5305\u542B\u672A\u66F4\u6539\u7684\u56FE\u5E93\u9879\u76EE\u3002\u6709\u52A9\u4E8E\u6F5C\u5728\u907F\u514D\u4E0B\u8F7D\u7F29\u7565\u56FE"
		},
		"Directory/zip filename format": {
			"_info": {
				"instances": [
					{
						"setting": "gallery_zip_filename_format",
						"field": "name"
					}
				]
			},
			"pt-BR": "Formato do nome do diret\u00F3rio/arquivo zip",
			"ru": "\u0424\u043E\u0440\u043C\u0430\u0442 \u0438\u043C\u0435\u043D\u0438 \u0444\u0430\u0439\u043B\u0430 \u043A\u0430\u0442\u0430\u043B\u043E\u0433\u0430/\u0430\u0440\u0445\u0438\u0432\u0430",
			"zh-CN": "\u76EE\u5F55/zip \u6587\u4EF6\u540D\u683C\u5F0F"
		},
		"Format string(s) for the directory (package name for JDownloader) and zip filename (if applicable).\nRefer to \"Filename format\" under the Rules section for documentation. The variables are set from the first loaded media.\nAn additional `items_amt` format variable is supported, which contains the number of items.\n`.zip` will be automatically suffixed for zip filenames.": {
			"_info": {
				"instances": [
					{
						"setting": "gallery_zip_filename_format",
						"field": "description"
					}
				]
			},
			"pt-BR": "Cadeia(s) de formato para o diret\u00F3rio (nome do pacote para JDownloader) e nome do arquivo zip (se aplic\u00E1vel).\nConsulte \"Formato do nome do arquivo\" na se\u00E7\u00E3o Regras para obter documenta\u00E7\u00E3o. As vari\u00E1veis s\u00E3o definidas a partir da primeira m\u00EDdia carregada.\nUma vari\u00E1vel de formato adicional items_amt \u00E9 suportada, que cont\u00E9m o n\u00FAmero de itens.\n.zip ser\u00E1 automaticamente adicionado como sufixo para nomes de arquivos zip.",
			"ru": "\u0424\u043E\u0440\u043C\u0430\u0442 \u0441\u0442\u0440\u043E\u043A \u043A\u0430\u0442\u0430\u043B\u043E\u0433\u0430 (\u0438\u043C\u044F \u043F\u0430\u043A\u0435\u0442\u0430 \u0434\u043B\u044F JDownloader) \u0438 \u0438\u043C\u044F zip-\u0444\u0430\u0439\u043B\u0430 (\u0435\u0441\u043B\u0438 \u043F\u0440\u0438\u043C\u0435\u043D\u0438\u043C\u043E).\n\u0418\u0437\u0443\u0447\u0438\u0442\u0435 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430\u0446\u0438\u044E \"\u0424\u043E\u0440\u043C\u0430\u0442 \u0438\u043C\u0435\u043D\u0438 \u0444\u0430\u0439\u043B\u0430\" \u0432 \u0440\u0430\u0437\u0434\u0435\u043B\u0435 \"\u041F\u0440\u0430\u0432\u0438\u043B\u0430\". \u041F\u0435\u0440\u0435\u043C\u0435\u043D\u043D\u044B\u0435 \u0443\u0441\u0442\u0430\u043D\u0430\u0432\u043B\u0438\u0432\u0430\u044E\u0442\u0441\u044F \u0441 \u043F\u0435\u0440\u0432\u043E\u0433\u043E \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043D\u043D\u043E\u0433\u043E \u043C\u0435\u0434\u0438\u0430.\n\u041F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044F \u0434\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u0430\u044F \u043F\u0435\u0440\u0435\u043C\u0435\u043D\u043D\u0430\u044F \u0444\u043E\u0440\u043C\u0430\u0442\u0430 `items_amt`, \u043A\u043E\u0442\u043E\u0440\u0430\u044F \u0441\u043E\u0434\u0435\u0440\u0436\u0438\u0442 \u043A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432.\n\u0421\u0443\u0444\u0444\u0438\u043A\u0441 `.zip` \u0431\u0443\u0434\u0435\u0442 \u0430\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0438 \u0434\u043E\u0431\u0430\u0432\u043B\u044F\u0442\u044C\u0441\u044F \u043A \u0438\u043C\u0435\u043D\u0430\u043C zip-\u0444\u0430\u0439\u043B\u043E\u0432.",
			"zh-CN": "\u76EE\u5F55\uFF08JDownloader \u7684\u5305\u540D\uFF09\u548C zip \u6587\u4EF6\u540D\uFF08\u5982\u679C\u9002\u7528\uFF09\u7684\u683C\u5F0F\u5316\u5B57\u7B26\u4E32\u3002\n\u6587\u6863\u53C2\u89C1\u201C\u89C4\u5219\u201D\u90E8\u5206\u4E2D\u7684\u201C\u6587\u4EF6\u540D\u683C\u5F0F\u201D\u3002\u8FD9\u4E9B\u53D8\u91CF\u6765\u81EA\u9996\u4E2A\u5DF2\u52A0\u8F7D\u7684\u5A92\u4F53\u3002\n\u652F\u6301\u4E00\u4E2A\u989D\u5916\u7684 `items_amt` \u683C\u5F0F\u53D8\u91CF\uFF0C\u5176\u4E2D\u5305\u542B\u9879\u76EE\u6570\u91CF\u3002\nzip \u7684\u6587\u4EF6\u540D\u81EA\u52A8\u8FFD\u52A0 `.zip` \u540E\u7F00\u3002"
		},
		"Zip: Store in subdirectory": {
			"_info": {
				"instances": [
					{
						"setting": "gallery_zip_add_tld",
						"field": "name"
					}
				]
			},
			"pt-BR": "Zip: Armazenar em subdiret\u00F3rio",
			"ru": "Zip: \u0425\u0440\u0430\u043D\u0438\u0442\u044C \u0432 \u043F\u043E\u0434\u043A\u0430\u0442\u0430\u043B\u043E\u0433\u0435",
			"zh-CN": "Zip: \u5B58\u50A8\u5728\u5B50\u76EE\u5F55\u4E2D"
		},
		"Stores the files in a subdirectory with the same name as the .zip file (without the .zip extension)": {
			"_info": {
				"instances": [
					{
						"setting": "gallery_zip_add_tld",
						"field": "description"
					}
				]
			},
			"pt-BR": "Armazena os arquivos em um subdiret\u00F3rio com o mesmo nome do arquivo .zip (sem a extens\u00E3o .zip)",
			"ru": "\u0425\u0440\u0430\u043D\u0438\u0442 \u0444\u0430\u0439\u043B\u044B \u0432 \u043F\u043E\u0434\u043A\u0430\u0442\u0430\u043B\u043E\u0433\u0435 \u0441 \u0442\u0435\u043C \u0436\u0435 \u0438\u043C\u0435\u043D\u0435\u043C, \u0447\u0442\u043E \u0438 zip-\u0444\u0430\u0439\u043B (\u0431\u0435\u0437 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u0438\u044F .zip).",
			"zh-CN": "\u5C06\u6587\u4EF6\u5B58\u50A8\u5728\u4E0E .zip \u6587\u4EF6\u540C\u540D\u7684\u5B50\u76EE\u5F55\u4E2D\uFF08\u76EE\u5F55\u4E0D\u5E26 .zip\uFF09"
		},
		"JD: Autostart": {
			"_info": {
				"instances": [
					{
						"setting": "gallery_jd_autostart",
						"field": "name"
					}
				]
			},
			"pt-BR": "JD: Iniciar automaticamente",
			"ru": "JD: \u0410\u0432\u0442\u043E\u0437\u0430\u043F\u0443\u0441\u043A",
			"zh-CN": "JD: \u81EA\u52A8\u542F\u52A8"
		},
		"Autostarts the download when added to JDownloader": {
			"_info": {
				"instances": [
					{
						"setting": "gallery_jd_autostart",
						"field": "description"
					}
				]
			},
			"pt-BR": "Inicia o download automaticamente quando adicionado ao JDownloader",
			"ru": "\u0410\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0438 \u0437\u0430\u043F\u0443\u0441\u043A\u0430\u0435\u0442 \u0441\u043A\u0430\u0447\u0438\u0432\u0430\u043D\u0438\u0435 \u043F\u0440\u0438 \u0434\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u0438\u0438 \u0432 JDownloader",
			"zh-CN": "\u6DFB\u52A0\u5230 JDownloader \u65F6\u81EA\u52A8\u5F00\u59CB\u4E0B\u8F7D"
		},
		"JD: Referer policy": {
			"_info": {
				"instances": [
					{
						"setting": "gallery_jd_referer",
						"field": "name"
					}
				]
			},
			"pt-BR": "JD: Pol\u00EDtica de Refer\u00EAncia",
			"ru": "JD: \u0420\u0435\u0444\u0435\u0440\u0430\u043B\u044C\u043D\u0430\u044F \u043F\u043E\u043B\u0438\u0442\u0438\u043A\u0430",
			"zh-CN": "JD: Referer \u7B56\u7565"
		},
		"Due to a current limitation in JDownloader's API, the `Referer` (sic) header can only be set on a per-package basis. This option allows working around it by submitting multiple packages with the same name using different Referer headers. This can result in JD spamming notifications due to the number of packages created.": {
			"_info": {
				"instances": [
					{
						"setting": "gallery_jd_referer",
						"field": "description"
					}
				]
			},
			"pt-BR": "Devido a uma limita\u00E7\u00E3o atual na API do JDownloader, o cabe\u00E7alho `Referer` (sic) s\u00F3 pode ser definido por pacote. Esta op\u00E7\u00E3o permite contornar isso enviando v\u00E1rios pacotes com o mesmo nome usando diferentes cabe\u00E7alhos Referer. Isso pode resultar em spam de notifica\u00E7\u00F5es do JD devido ao n\u00FAmero de pacotes criados.",
			"ru": "\u0418\u0437-\u0437\u0430 \u0442\u0435\u043A\u0443\u0449\u0435\u0433\u043E \u043E\u0433\u0440\u0430\u043D\u0438\u0447\u0435\u043D\u0438\u044F \u0432 API JDownloader, \u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A `Referer` (sic) \u043C\u043E\u0436\u0435\u0442 \u0431\u044B\u0442\u044C \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D \u0442\u043E\u043B\u044C\u043A\u043E \u0434\u043B\u044F \u043A\u0430\u0436\u0434\u043E\u0433\u043E \u043F\u0430\u043A\u0435\u0442\u0430. \u042D\u0442\u043E\u0442 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440 \u043F\u043E\u0437\u0432\u043E\u043B\u044F\u0435\u0442 \u043E\u0431\u043E\u0439\u0442\u0438 \u044D\u0442\u043E, \u043E\u0442\u043F\u0440\u0430\u0432\u0438\u0432 \u043D\u0435\u0441\u043A\u043E\u043B\u044C\u043A\u043E \u043F\u0430\u043A\u0435\u0442\u043E\u0432 \u0441 \u043E\u0434\u0438\u043D\u0430\u043A\u043E\u0432\u044B\u043C \u0438\u043C\u0435\u043D\u0435\u043C, \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u044F \u0440\u0430\u0437\u043D\u044B\u0435 \u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043A\u0438 Referer. \u042D\u0442\u043E \u043C\u043E\u0436\u0435\u0442 \u043F\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043A \u0441\u043F\u0430\u043C-\u0443\u0432\u0435\u0434\u043E\u043C\u043B\u0435\u043D\u0438\u044F\u043C JD \u0438\u0437-\u0437\u0430 \u043A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0441\u043E\u0437\u0434\u0430\u043D\u043D\u044B\u0445 \u043F\u0430\u043A\u0435\u0442\u043E\u0432.",
			"zh-CN": "\u7531\u4E8E\u76EE\u524D JDownloader API \u7684\u9650\u5236\uFF0C`Referer` (sic) \u5934\u53EA\u80FD\u5728\u6BCF\u4E2A\u5305\u7684\u57FA\u7840\u4E0A\u8BBE\u7F6E\u3002\u6B64\u9009\u9879\u901A\u8FC7\u63D0\u4EA4\u540C\u540D\u4F46\u4E0D\u540C Referer \u5934\u7684\u591A\u4E2A\u5305\u6765\u89C4\u907F\u8BE5\u95EE\u9898\u3002\u8FD9\u53EF\u80FD\u5BFC\u81F4 JD \u7531\u4E8E\u521B\u5EFA\u7684\u5305\u6570\u91CF\u8F83\u591A\u800C\u7ED9\u51FA\u5783\u573E\u6D88\u606F\u901A\u77E5\u3002"
		},
		"Per-domain": {
			"_info": {
				"instances": [
					{
						"setting": "gallery_jd_referer",
						"field": "options.domain.name"
					}
				]
			},
			"pt-BR": "Por dom\u00EDnio",
			"ru": "\u0414\u043B\u044F \u043A\u0430\u0436\u0434\u043E\u0433\u043E \u0434\u043E\u043C\u0435\u043D\u0430",
			"zh-CN": "\u6309\u57DF\u540D"
		},
		"Zip: Store info file": {
			"_info": {
				"instances": [
					{
						"setting": "gallery_zip_add_info_file",
						"field": "name"
					}
				]
			},
			"pt-BR": "Zip: Armazenar arquivo de informa\u00E7\u00F5es",
			"ru": "Zip: \u0425\u0440\u0430\u043D\u0438\u0442\u044C \u0438\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044E \u0444\u0430\u0439\u043B\u0430",
			"zh-CN": "Zip: \u5B58\u50A8\u4FE1\u606F\u6587\u4EF6"
		},
		"Stores a `info.txt` file in the .zip containing information about the downloaded files and host page.": {
			"_info": {
				"instances": [
					{
						"setting": "gallery_zip_add_info_file",
						"field": "description"
					}
				]
			},
			"pt-BR": "Armazena um arquivo `info.txt` no .zip contendo informa\u00E7\u00F5es sobre os arquivos baixados e a p\u00E1gina de origem.",
			"ru": "\u0425\u0440\u0430\u043D\u0438\u0442 \u0444\u0430\u0439\u043B `info.txt` \u0432 .zip, \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0449\u0443\u044E \u0438\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044E \u043E \u0441\u043A\u0430\u0447\u0430\u043D\u044B\u0445 \u0444\u0430\u0439\u043B\u0430\u0445 \u0438 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0435 \u0445\u043E\u0441\u0442\u0430.",
			"zh-CN": "\u5728 .zip \u4E2D\u5B58\u50A8\u4E00\u4E2A\u5305\u542B\u4E0B\u8F7D\u7684\u6587\u4EF6\u548C\u7F51\u9875\u4FE1\u606F\u7684\u201Cinfo.txt\u201D\u6587\u4EF6\u3002"
		},
		"Move to next when video finishes": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_gallery_move_after_video",
						"field": "name"
					}
				]
			},
			"pt-BR": "Mover para o pr\u00F3ximo quando o v\u00EDdeo terminar",
			"ru": "\u041F\u043E\u0441\u043B\u0435 \u0437\u0430\u043A\u0430\u043D\u0447\u0438\u0432\u0430\u043D\u0438\u044F \u0432\u0438\u0434\u0435\u043E, \u043F\u0435\u0440\u0435\u0445\u043E\u0434\u0438\u0442\u044C \u043A \u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u043C\u0443",
			"zh-CN": "\u89C6\u9891\u7ED3\u675F\u65F6\u8F6C\u5230\u4E0B\u4E00\u4E2A"
		},
		"Moves to the next gallery item when a video finishes playing": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_gallery_move_after_video",
						"field": "description"
					}
				]
			},
			"pt-BR": "Move para o pr\u00F3ximo item da galeria quando um v\u00EDdeo terminar de reproduzir",
			"ru": "\u041F\u0435\u0440\u0435\u0445\u043E\u0434 \u043A \u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u043C\u0443 \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0443 \u0433\u0430\u043B\u0435\u0440\u0435\u0438 \u043F\u043E\u0441\u043B\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043D\u0438\u044F \u0432\u043E\u0441\u043F\u0440\u043E\u0438\u0437\u0432\u0435\u0434\u0435\u043D\u0438\u044F \u0432\u0438\u0434\u0435\u043E.",
			"zh-CN": "\u89C6\u9891\u64AD\u653E\u7ED3\u675F\u65F6\u79FB\u52A8\u5230\u4E0B\u4E00\u4E2A\u56FE\u5E93\u9879\u76EE"
		},
		"Popup CSS style": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_styles",
						"field": "name"
					}
				]
			},
			"ko": "\uD31D\uC5C5 CSS",
			"pt-BR": "Estilo CSS do popup",
			"ru": "\u0421\u0442\u0438\u043B\u044C CSS \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430",
			"zh-CN": "\u5F39\u7A97 CSS \u6837\u5F0F"
		},
		"Custom CSS styles for the popup": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_styles",
						"field": "description"
					}
				]
			},
			"pt-BR": "Estilos CSS personalizados para o popup",
			"ru": "\u041F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u0438\u0435 \u0441\u0442\u0438\u043B\u0438 CSS \u0434\u043B\u044F \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430.",
			"zh-CN": "\u81EA\u5B9A\u4E49\u5F39\u7A97\u7684 CSS \u6837\u5F0F"
		},
		"Most valid CSS is supported, with these differences:\n<ul><li>Multiline comments (<code>/* ... */</code>) are currently not supported</li>\n<li>Single comments (<code>// ...</code>) are supported, but only at the beginning of a line</li>\n<li><code>%thumburl%</code> is the URL of the thumbnail image. For example, you could use it like this: <code>background-image: url(%thumburl%)</code><br />\nThe URL is properly encoded, so quotes are not necessary (but not harmful either)</li>\n<li><code>%fullurl%</code> is the URL of the full image. If IMU fails to find a larger image, it will be the same as <code>%thumburl%</code></li>\n<li>Styles are <code>!important</code> by default</li></ul>\n<p>For Button CSS style, you can also customize the CSS for individual buttons through their IDs. For example:</p>\n<pre>\n#closebtn {\n  background-color: red;\n  // -imu-text allows you to set the text inside the button\n  -imu-text: \"Close\";\n  // -imu-title allows you to set the tooltip when hovering\n  -imu-title: \"Close the popup\";\n}\n#galleryprevbtn, #gallerynextbtn {\n  border-radius: 100px;\n}\n</pre>": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_styles",
						"field": "documentation.value"
					}
				]
			},
			"pt-BR": "A maior parte do CSS v\u00E1lido \u00E9 suportada, com as seguintes diferen\u00E7as:\n<ul><li>Coment\u00E1rios multilinha (<code>/ ... */</code>) n\u00E3o s\u00E3o suportados no momento</li>\n<li>Coment\u00E1rios de linha \u00FAnica (<code>// ...</code>) s\u00E3o suportados, mas apenas no in\u00EDcio de uma linha</li>\n<li><code>%thumburl%</code> \u00E9 a URL da imagem em miniatura. Por exemplo, voc\u00EA pode us\u00E1-la assim: <code>background-image: url(%thumburl%)</code><br />\nA URL \u00E9 codificada corretamente, ent\u00E3o aspas n\u00E3o s\u00E3o necess\u00E1rias (mas tamb\u00E9m n\u00E3o s\u00E3o prejudiciais)</li>\n<li><code>%fullurl%</code> \u00E9 a URL da imagem completa. Se o IMU n\u00E3o conseguir encontrar uma imagem maior, ela ser\u00E1 a mesma que <code>%thumburl%</code></li>\n<li>Os estilos s\u00E3o <code>!important</code> por padr\u00E3o</li></ul>\n<p>Para o estilo CSS dos bot\u00F5es, voc\u00EA tamb\u00E9m pode personalizar o CSS para bot\u00F5es individuais atrav\u00E9s de seus IDs. Por exemplo:</p>\n<pre>\n#closebtn {\n  background-color: red;\n  // -imu-text permite definir o texto dentro do bot\u00E3o\n  -imu-text: \"Fechar\";\n  // -imu-title permite definir a dica de ferramenta ao passar o mouse\n  -imu-title: \"Fechar popup\";\n}\n#galleryprevbtn, #gallerynextbtn {\n  border-radius: 100px;\n}\n</pre>",
			"ru": "\u041F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044F \u0431\u043E\u043B\u044C\u0448\u0438\u043D\u0441\u0442\u0432\u043E \u0434\u043E\u043F\u0443\u0441\u0442\u0438\u043C\u043E\u0433\u043E CSS, \u0441 \u044D\u0442\u0438\u043C\u0438 \u043E\u0442\u043B\u0438\u0447\u0438\u044F\u043C\u0438:\n<ul><li>\u041C\u043D\u043E\u0433\u043E\u0441\u0442\u0440\u043E\u0447\u043D\u044B\u0435 \u043A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0438 (<code>/* ... */</code>) \u0432 \u043D\u0430\u0441\u0442\u043E\u044F\u0449\u0435\u0435 \u0432\u0440\u0435\u043C\u044F \u043D\u0435 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044E\u0442\u0441\u044F</li>\n<li>\u041E\u0434\u0438\u043D\u043E\u0447\u043D\u044B\u0435 \u043A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0438 (<code>// ...</code>) \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044E\u0442\u0441\u044F, \u043D\u043E \u0442\u043E\u043B\u044C\u043A\u043E \u0432 \u043D\u0430\u0447\u0430\u043B\u0435 \u0441\u0442\u0440\u043E\u043A\u0438</li>\n<li><code>%thumburl%</code> - \u044D\u0442\u043E URL-\u0430\u0434\u0440\u0435\u0441 \u043C\u0438\u043D\u0438\u0430\u0442\u044E\u0440\u044B \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F. \u041D\u0430\u043F\u0440\u0438\u043C\u0435\u0440, \u0432\u044B \u043C\u043E\u0436\u0435\u0442\u0435 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u0435\u0433\u043E \u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0438\u043C \u043E\u0431\u0440\u0430\u0437\u043E\u043C: <code>background-image: url(%thumburl%)</code><br />\nURL \u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u043E \u0437\u0430\u043A\u043E\u0434\u0438\u0440\u043E\u0432\u0430\u043D, \u043F\u043E\u044D\u0442\u043E\u043C\u0443 \u043A\u0430\u0432\u044B\u0447\u043A\u0438 \u043D\u0435 \u043D\u0443\u0436\u043D\u044B (\u043D\u043E \u0438 \u043D\u0435 \u043D\u0430\u0432\u0440\u0435\u0434\u044F\u0442)</li>\n<li><code>%fullurl%</code> - \u044D\u0442\u043E URL-\u0430\u0434\u0440\u0435\u0441 \u043F\u043E\u043B\u043D\u043E\u0433\u043E \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F. \u0415\u0441\u043B\u0438 IMU \u043D\u0435 \u043C\u043E\u0436\u0435\u0442 \u043D\u0430\u0439\u0442\u0438 \u0443\u0432\u0435\u043B\u0438\u0447\u0435\u043D\u043D\u043E\u0435 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435, \u043E\u043D\u043E \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043A\u0438\u043C \u0436\u0435, \u043A\u0430\u043A <code>%thumburl%</code></li>\n<li>\u0421\u0442\u0438\u043B\u0438 \u043F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E \u043A\u0430\u043A <code>!important</code></li></ul>\n<p>\u0414\u043B\u044F \u0441\u0442\u0438\u043B\u044F CSS \u043A\u043D\u043E\u043F\u043E\u043A, \u0432\u044B \u0442\u0430\u043A\u0436\u0435 \u043C\u043E\u0436\u0435\u0442\u0435 \u043D\u0430\u0441\u0442\u0440\u043E\u0438\u0442\u044C CSS \u0434\u043B\u044F \u043E\u0442\u0434\u0435\u043B\u044C\u043D\u044B\u0445 \u043A\u043D\u043E\u043F\u043E\u043A \u0441 \u043F\u043E\u043C\u043E\u0449\u044C\u044E \u0438\u0445 \u0438\u0434\u0435\u043D\u0442\u0438\u0444\u0438\u043A\u0430\u0442\u043E\u0440\u043E\u0432. \u041D\u0430\u043F\u0440\u0438\u043C\u0435\u0440:</p>\n<pre>\n#closebtn {\n  background-color: red;\n  // -imu-text \u043F\u043E\u0437\u0432\u043E\u043B\u044F\u0435\u0442 \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u0442\u0435\u043A\u0441\u0442 \u0432\u043D\u0443\u0442\u0440\u0438 \u043A\u043D\u043E\u043F\u043A\u0438\n  -imu-text: \"\u0417\u0430\u043A\u0440\u044B\u0442\u044C\";\n  // -imu-title \u043F\u043E\u0437\u0432\u043E\u043B\u044F\u0435\u0442 \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0443\u044E \u043F\u043E\u0434\u0441\u043A\u0430\u0437\u043A\u0443 \u043F\u0440\u0438 \u043D\u0430\u0432\u0435\u0434\u0435\u043D\u0438\u0438 \u043A\u0443\u0440\u0441\u043E\u0440\u0430\n  -imu-title: \"\u0417\u0430\u043A\u0440\u044B\u0442\u044C \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E\";\n}\n#galleryprevbtn, #gallerynextbtn {\n  border-radius: 100px;\n}\n</pre>",
			"zh-CN": "\u652F\u6301\u5927\u591A\u6570\u6709\u6548\u7684 CSS\uFF0C\u4F46\u6709\u4E0B\u5217\u5DEE\u5F02\uFF1A\n<ul><li>\u76EE\u524D\u4E0D\u652F\u6301\u591A\u884C\u6CE8\u91CA\uFF08<code>/* ... */</code>\uFF09</li>\n<li>\u652F\u6301\u5355\u884C\u6CE8\u91CA\uFF08<code>// ...</code>\uFF09\uFF0C\u4F46\u53EA\u80FD\u5728\u884C\u5F00\u5934</li>\n<li><code>%thumburl%</code> \u662F\u7F29\u7565\u56FE\u7684 URL\uFF0C\u4F8B\u5982\u53EF\u4EE5\u8FD9\u6837\u4F7F\u7528\u5B83\uFF1Abackground-image: url(%thumburl%)</code><br />\nURL \u88AB\u6B63\u786E\u7F16\u7801\uFF0C\u6240\u4EE5\u6CA1\u6709\u5FC5\u8981\u4F7F\u7528\u5F15\u53F7\uFF08\u4F46\u4F7F\u7528\u4E5F\u65E0\u5BB3\uFF09</li>\n<li><code>%fullurl%</code> \u662F\u5B8C\u6574\u56FE\u50CF\u7684 URL\u3002\u5982\u679C Image Max URL \u4E0D\u80FD\u627E\u5230\u4E00\u4E2A\u66F4\u5927\u7684\u56FE\u50CF\uFF0C\u5C06\u4E0E <code>%thumburl%</code> \u76F8\u540C</li>\n<li>\u6837\u5F0F\u9ED8\u8BA4 <code>!important</code></li></ul>\n<p>\u5BF9\u4E8E\u6309\u94AE CSS \u6837\u5F0F\uFF0C\u60A8\u4E5F\u53EF\u4EE5\u901A\u8FC7 id \u4E3A\u5355\u4E2A\u6309\u94AE\u5B9A\u5236 CSS\u3002\u4F8B\u5982\uFF1A</p>\n<pre>\n#closebtn {\n  background-color: red;\n  // -imu-text \u5141\u8BB8\u60A8\u8BBE\u7F6E\u6309\u94AE\u5185\u7684\u6587\u672C\n  -imu-text: \"Close\";\n  // -imu-title \u5141\u8BB8\u60A8\u8BBE\u7F6E\u60AC\u505C\u65F6\u7684\u5DE5\u5177\u63D0\u793A\n  -imu-title: \"Close the popup\";\n}\n#galleryprevbtn, #gallerynextbtn {\n  border-radius: 100px;\n}\n</pre>"
		},
		"Enable popup fade": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_enable_fade",
						"field": "name"
					}
				]
			},
			"pt-BR": "Habilitar efeito de fade no popup",
			"ru": "\u0412\u043A\u043B\u044E\u0447\u0438\u0442\u044C \u044D\u0444\u0444\u0435\u043A\u0442 \u0437\u0430\u0442\u0443\u0445\u0430\u043D\u0438\u044F \u0434\u043B\u044F \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430",
			"zh-CN": "\u542F\u7528\u5F39\u7A97\u8FC7\u6E21\u52A8\u753B"
		},
		"Enables a fade in/out effect when the popup is opened/closed": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_enable_fade",
						"field": "description"
					}
				]
			},
			"pt-BR": "Habilita um efeito de fade in/out quando o popup \u00E9 aberto/fechado",
			"ru": "\u0412\u043A\u043B\u044E\u0447\u0430\u0435\u0442 \u044D\u0444\u0444\u0435\u043A\u0442 \u0437\u0430\u0442\u0443\u0445\u0430\u043D\u0438\u044F/\u043F\u043E\u044F\u0432\u043B\u0435\u043D\u0438\u044F \u043F\u0440\u0438 \u043E\u0442\u043A\u0440\u044B\u0442\u0438\u0438/\u0437\u0430\u043A\u0440\u044B\u0442\u0438\u0438 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430.",
			"zh-CN": "\u542F\u7528\u5F39\u7A97\u6253\u5F00/\u5173\u95ED\u65F6\u7684\u6DE1\u5165/\u6DE1\u51FA\u6548\u679C"
		},
		"Enable zoom effect": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_enable_zoom_effect",
						"field": "name"
					}
				]
			},
			"pt-BR": "Habilitar efeito de zoom",
			"ru": "\u0412\u043A\u043B\u044E\u0447\u0438\u0442\u044C \u044D\u0444\u0444\u0435\u043A\u0442 \u043C\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F",
			"zh-CN": "\u542F\u7528\u7F29\u653E\u6548\u679C"
		},
		"Toggles whether the popup should 'zoom' when opened/closed": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_enable_zoom_effect",
						"field": "description"
					}
				]
			},
			"pt-BR": "Alterna se o popup deve aplicar 'zoom' ao abrir/fechar",
			"ru": "\u041F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0430\u0435\u0442, \u0434\u043E\u043B\u0436\u043D\u043E \u043B\u0438 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E '\u043C\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043E\u0432\u0430\u0442\u044C\u0441\u044F' \u043F\u0440\u0438 \u043E\u0442\u043A\u0440\u044B\u0442\u0438\u0438/\u0437\u0430\u043A\u0440\u044B\u0442\u0438\u0438.",
			"zh-CN": "\u5207\u6362\u6253\u5F00/\u5173\u95ED\u5F39\u7A97\u65F6\u662F\u5426\u6709\u7F29\u653E\u6548\u679C"
		},
		"Move from thumbnail when zooming": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_zoom_effect_move",
						"field": "name"
					}
				]
			},
			"pt-BR": "Mover da miniatura ao aplicar zoom",
			"ru": "\u041F\u0435\u0440\u0435\u043C\u0435\u0449\u0435\u043D\u0438\u0435 \u043E\u0442 \u043C\u0438\u043D\u0438\u0430\u0442\u044E\u0440\u044B \u043F\u0440\u0438 \u043C\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0438",
			"zh-CN": "\u4ECE\u7F29\u7565\u56FE\u4E2D\u8DC3\u51FA\u7684\u7F29\u653E\u6548\u679C"
		},
		"Moves the popup from the thumbnail to the final location while zooming. The animation can be a little rough": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_zoom_effect_move",
						"field": "description"
					}
				]
			},
			"pt-BR": "Move o popup da miniatura para o local final enquanto aplica o zoom. A anima\u00E7\u00E3o pode ser um pouco brusca",
			"ru": "\u041F\u0435\u0440\u0435\u043C\u0435\u0449\u0430\u0435\u0442 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u043E\u0442 \u043C\u0438\u043D\u0438\u0430\u0442\u044E\u0440 \u0434\u043E \u043E\u043A\u043E\u043D\u0447\u0430\u0442\u0435\u043B\u044C\u043D\u043E\u0433\u043E \u043C\u0435\u0441\u0442\u043E\u043F\u043E\u043B\u043E\u0436\u0435\u043D\u0438\u044F \u0432\u043E \u0432\u0440\u0435\u043C\u044F \u043C\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F. \u0410\u043D\u0438\u043C\u0430\u0446\u0438\u044F \u043C\u043E\u0436\u0435\u0442 \u0431\u044B\u0442\u044C \u043D\u0435\u043C\u043D\u043E\u0433\u043E \u0433\u0440\u0443\u0431\u043E\u0439.",
			"zh-CN": "\u4ECE\u7F29\u7565\u56FE\u53D8\u4E3A\u5F39\u7A97\u65F6\u7684\u7F29\u653E\u52A8\u753B\u6548\u679C\u3002\u52A8\u753B\u53EF\u80FD\u6709\u70B9\u7C97\u7CD9"
		},
		"Popup animation time": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_fade_time",
						"field": "name"
					}
				]
			},
			"pt-BR": "Tempo de anima\u00E7\u00E3o do popup",
			"ru": "\u0412\u0440\u0435\u043C\u044F \u0430\u043D\u0438\u043C\u0430\u0446\u0438\u0438 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430",
			"zh-CN": "\u5F39\u7A97\u52A8\u753B\u65F6\u957F"
		},
		"Fade/zoom animation duration (in milliseconds) for the popup": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_fade_time",
						"field": "description"
					}
				]
			},
			"pt-BR": "Dura\u00E7\u00E3o da anima\u00E7\u00E3o de fade/zoom (em milissegundos) para o popup",
			"ru": "\u0423\u043C\u0435\u043D\u044C\u0448\u0435\u043D\u0438\u0435/\u0443\u0432\u0435\u043B\u0438\u0447\u0435\u043D\u0438\u0435 \u043F\u0440\u043E\u0434\u043E\u043B\u0436\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u0438 \u0430\u043D\u0438\u043C\u0430\u0446\u0438\u0438 (\u0432 \u043C\u0438\u043B\u043B\u0438\u0441\u0435\u043A\u0443\u043D\u0434\u0430\u0445) \u0434\u043B\u044F \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430.",
			"zh-CN": "\u5F39\u7A97\u7684\u6DE1\u51FA/\u7F29\u653E\u52A8\u753B\u6301\u7EED\u65F6\u95F4\uFF08\u6BEB\u79D2\uFF09"
		},
		"Enable background CSS": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_enable_mask_styles2",
						"field": "name"
					}
				]
			},
			"pt-BR": "Habilitar CSS de fundo",
			"ru": "\u0412\u043A\u043B\u044E\u0447\u0438\u0442\u044C \u0444\u043E\u043D CSS",
			"zh-CN": "\u542F\u7528\u80CC\u666F CSS"
		},
		"Toggles whether CSS styles for the background when the popup is active is enabled": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_enable_mask_styles2",
						"field": "description"
					}
				]
			},
			"pt-BR": "Alterna se os estilos CSS para o fundo quando o popup est\u00E1 ativo est\u00E3o habilitados",
			"ru": "\u041F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0430\u0435\u0442, \u0432\u043A\u043B\u044E\u0447\u0435\u043D\u044B \u043B\u0438 \u0441\u0442\u0438\u043B\u0438 CSS \u0434\u043B\u044F \u0444\u043E\u043D\u0430, \u043A\u043E\u0433\u0434\u0430 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u0430\u043A\u0442\u0438\u0432\u043D\u043E.",
			"zh-CN": "\u5207\u6362\u5F53\u5F39\u51FA\u7A97\u53E3\u5904\u4E8E\u6D3B\u52A8\u72B6\u6001\u65F6\u662F\u5426\u542F\u7528\u80CC\u666F\u7684 CSS \u6837\u5F0F"
		},
		"On hold": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_enable_mask_styles2",
						"field": "options.hold.name"
					}
				]
			},
			"pt-BR": "Em espera",
			"ru": "\u041F\u0440\u0438 \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u043D\u0438\u0438",
			"zh-CN": "\u4FDD\u6301\u73B0\u72B6"
		},
		"No": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_enable_mask_styles2",
						"field": "options.never.name"
					}
				]
			},
			"pt-BR": "N\u00E3o",
			"ru": "\u041D\u0435\u0442",
			"zh-CN": "\u4E0D\u542F\u7528"
		},
		"Background CSS style": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_mask_styles2",
						"field": "name"
					}
				]
			},
			"pt-BR": "Estilo CSS do fundo",
			"ru": "\u0421\u0442\u0438\u043B\u044C CSS \u0434\u043B\u044F \u0444\u043E\u043D\u0430",
			"zh-CN": "\u80CC\u666F CSS \u6837\u5F0F"
		},
		"CSS style for the background when the popup is active. See the documentation for Popup CSS style for more information (the thumb/full URL variables aren't supported here)": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_mask_styles2",
						"field": "description"
					}
				]
			},
			"pt-BR": "Estilo CSS para o fundo quando o popup est\u00E1 ativo. Consulte a documenta\u00E7\u00E3o do Estilo CSS do Popup para mais informa\u00E7\u00F5es (as vari\u00E1veis thumb/full URL n\u00E3o s\u00E3o suportadas aqui)",
			"ru": "\u0421\u0442\u0438\u043B\u044C CSS \u0434\u043B\u044F \u0444\u043E\u043D\u0430, \u043A\u043E\u0433\u0434\u0430 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u0430\u043A\u0442\u0438\u0432\u043D\u043E. \u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0435 \u0441\u0432\u0435\u0434\u0435\u043D\u0438\u044F \u0441\u043C\u043E\u0442\u0440\u0438\u0442\u0435 \u0432 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430\u0446\u0438\u0438 '\u0421\u0442\u0438\u043B\u0438\u0437\u0430\u0446\u0438\u044F CSS \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430' (\u0437\u0434\u0435\u0441\u044C \u043D\u0435 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044E\u0442\u0441\u044F \u043F\u0435\u0440\u0435\u043C\u0435\u043D\u043D\u044B\u0435 URL thumb/full).",
			"zh-CN": "\u5F39\u7A97\u5F00\u542F\u65F6\u7528\u4E8E\u80CC\u666F\u7684 CSS \u6837\u5F0F\u3002\u66F4\u591A\u4FE1\u606F\u8BE6\u89C1\u201C\u5F39\u7A97 CSS \u6837\u5F0F\u201D\u6587\u6863\uFF08\u6B64\u5904\u4E0D\u652F\u6301 thumb/full URL \u53D8\u91CF\uFF09"
		},
		"Background fade": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_mask_fade_time",
						"field": "name"
					}
				]
			},
			"pt-BR": "Fade (esmaecimento) do fundo",
			"ru": "\u0417\u0430\u0442\u0443\u0445\u0430\u043D\u0438\u0435 \u0444\u043E\u043D\u0430",
			"zh-CN": "\u80CC\u666F\u6DE1\u5165/\u6DE1\u51FA"
		},
		"Fade in/out time (in milliseconds) for the page background, set to 0 to disable": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_mask_fade_time",
						"field": "description"
					}
				]
			},
			"pt-BR": "Tempo de fade in/out (em milissegundos) para o fundo da p\u00E1gina, defina como 0 para desativar",
			"ru": "\u0412\u0440\u0435\u043C\u044F \u0437\u0430\u0442\u0443\u0445\u0430\u043D\u0438\u044F/\u043F\u043E\u044F\u0432\u043B\u0435\u043D\u0438\u044F (\u0432 \u043C\u0438\u043B\u043B\u0438\u0441\u0435\u043A\u0443\u043D\u0434\u0430\u0445) \u0434\u043B\u044F \u0444\u043E\u043D\u0430 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u044B. 0 - \u043E\u0442\u043A\u043B\u044E\u0447\u0438\u0442\u044C",
			"zh-CN": "\u9875\u9762\u80CC\u666F\u7684\u6DE1\u5165/\u6DE1\u51FA\u65F6\u95F4\uFF08\u6BEB\u79D2\uFF09 \uFF0C\u8BBE\u4E3A 0 \u5219\u7981\u7528"
		},
		"ms": {
			"_info": {
				"instances": [
					{
						"setting": "retry_503_ms",
						"field": "number_unit"
					},
					{
						"setting": "mouseover_notallowed_duration",
						"field": "number_unit"
					},
					{
						"setting": "mouseover_hide_cursor_after",
						"field": "number_unit"
					},
					{
						"setting": "mouseover_fade_time",
						"field": "number_unit"
					},
					{
						"setting": "mouseover_mask_fade_time",
						"field": "number_unit"
					}
				]
			},
			"pt-BR": "ms",
			"ru": "\u043C\u0441",
			"zh-CN": "\u6BEB\u79D2"
		},
		"Button CSS style": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_ui_styles",
						"field": "name"
					}
				]
			},
			"pt-BR": "Estilo CSS dos bot\u00F5es",
			"ru": "\u0421\u0442\u0438\u043B\u044C CSS \u0434\u043B\u044F \u043A\u043D\u043E\u043F\u043E\u043A",
			"zh-CN": "\u6309\u94AE CSS \u6837\u5F0F"
		},
		"Custom CSS styles for the popup's UI buttons. See the documentation for Popup CSS style for more information (the thumb/full URL variables aren't supported here)": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_ui_styles",
						"field": "description"
					}
				]
			},
			"pt-BR": "Estilos CSS personalizados para os bot\u00F5es da interface do popup. Consulte a documenta\u00E7\u00E3o do Estilo CSS do Popup para obter mais informa\u00E7\u00F5es (as vari\u00E1veis thumb/full URL n\u00E3o s\u00E3o suportadas aqui)",
			"ru": "\u041F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u0438\u0435 \u0441\u0442\u0438\u043B\u0438 CSS \u0434\u043B\u044F \u043A\u043D\u043E\u043F\u043E\u043A \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u043E\u0433\u043E \u0438\u043D\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430. \u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0435 \u0441\u0432\u0435\u0434\u0435\u043D\u0438\u044F \u0441\u043C\u043E\u0442\u0440\u0438\u0442\u0435 \u0432 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430\u0446\u0438\u0438 '\u0421\u0442\u0438\u043B\u0438\u0437\u0430\u0446\u0438\u044F CSS \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430' (\u0437\u0434\u0435\u0441\u044C \u043D\u0435 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044E\u0442\u0441\u044F \u043F\u0435\u0440\u0435\u043C\u0435\u043D\u043D\u044B\u0435 URL thumb/full).",
			"zh-CN": "\u4E3A\u5F39\u7A97\u4E2D\u754C\u9762\u7684\u6309\u94AE\u81EA\u5B9A\u4E49 CSS \u6837\u5F0F\u3002\u66F4\u591A\u4FE1\u606F\u8BE6\u89C1\u201C\u5F39\u7A97 CSS \u6837\u5F0F\u201D\u6587\u6863\uFF08\u6B64\u5904\u4E0D\u652F\u6301 thumb/full URL \u53D8\u91CF\uFF09"
		},
		"Don't popup blacklisted URLs": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_apply_blacklist",
						"field": "name"
					}
				]
			},
			"pt-BR": "N\u00E3o exibir URLs na lista negra em popup",
			"ru": "\u041D\u0435 \u043E\u0442\u043A\u0440\u044B\u0432\u0430\u0442\u044C \u0447\u0451\u0440\u043D\u044B\u0435 \u0441\u043F\u0438\u0441\u043A\u0438 URL-\u0430\u0434\u0440\u0435\u0441\u043E\u0432 \u0432\u043E \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u043C \u043E\u043A\u043D\u0435",
			"zh-CN": "\u5DF2\u5217\u5165\u9ED1\u540D\u5355\u7684\u7F51\u5740\u4E0D\u8981\u5F39\u7A97"
		},
		"This option popping up for source media with blacklisted URLs. If this is disabled, the popup will open if the end URL isn't blacklisted, regardless of whether the source is blacklisted.": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_apply_blacklist",
						"field": "description"
					}
				]
			},
			"pt-BR": "Essa op\u00E7\u00E3o impede a exibi\u00E7\u00E3o em popup de m\u00EDdia de origem com URLs na lista negra. Se desativada, o popup abrir\u00E1 se a URL final n\u00E3o estiver na lista negra, independentemente da origem estar ou n\u00E3o.",
			"ru": "\u042D\u0442\u043E\u0442 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u0435\u0442 \u0434\u043B\u044F \u043E\u0440\u0438\u0433\u0438\u043D\u0430\u043B\u044C\u043D\u044B\u0445 \u043C\u0435\u0434\u0438\u0430 \u0441 URL-\u0430\u0434\u0440\u0435\u0441\u0430\u043C\u0438 \u0432 \u0447\u0451\u0440\u043D\u044B\u0439 \u0441\u043F\u0438\u0441\u043E\u043A. \u0415\u0441\u043B\u0438 \u044D\u0442\u043E\u0442 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440 \u043E\u0442\u043A\u043B\u044E\u0447\u0435\u043D, \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u043E\u0442\u043A\u0440\u043E\u0435\u0442\u0441\u044F, \u0435\u0441\u043B\u0438 \u043A\u043E\u043D\u0435\u0447\u043D\u044B\u0439 URL-\u0430\u0434\u0440\u0435\u0441 \u043D\u0435 \u0432\u043D\u0435\u0441\u0451\u043D \u0432 \u0447\u0451\u0440\u043D\u044B\u0439 \u0441\u043F\u0438\u0441\u043E\u043A, \u043D\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043C\u043E \u043E\u0442 \u0442\u043E\u0433\u043E, \u0432\u043D\u0435\u0441\u0435\u043D \u043B\u0438 \u0438\u0441\u0442\u043E\u0447\u043D\u0438\u043A \u0432 \u0447\u0451\u0440\u043D\u044B\u0439 \u0441\u043F\u0438\u0441\u043E\u043A.",
			"zh-CN": "\u5982\u679C\u7981\u7528\u6B64\u9009\u9879\uFF0C\u5373\u4FBF\u6E90\u5730\u5740\u88AB\u5217\u5165\u9ED1\u540D\u5355\uFF0C\u53EA\u8981\u672B\u7AEF\u7F51\u5740\u6CA1\u6709\u5217\u5165\u9ED1\u540D\u5355\uFF0C\u5C31\u6253\u5F00\u5F39\u7A97\u3002"
		},
		"Use media blacklist for host websites": {
			"_info": {
				"instances": [
					{
						"setting": "apply_blacklist_host",
						"field": "name"
					}
				]
			},
			"pt-BR": "Usar lista negra de m\u00EDdia para sites de hospedagem"
		},
		"Overrides the host blacklist to use the media blacklist (specified under Rules)": {
			"_info": {
				"instances": [
					{
						"setting": "apply_blacklist_host",
						"field": "description"
					}
				]
			},
			"pt-BR": "Substitui a lista negra de hosts para usar a lista negra de m\u00EDdia (especificada em Regras)"
		},
		"Don't popup different media type": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_matching_media_types",
						"field": "name"
					}
				]
			},
			"pt-BR": "N\u00E3o exibir tipo de m\u00EDdia diferente em popup",
			"ru": "\u041D\u0435\u0442 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0438\u0445 \u043E\u043A\u043E\u043D \u0434\u043B\u044F \u0434\u0440\u0443\u0433\u0438\u0445 \u0442\u0438\u043F\u043E\u0432 \u043C\u0435\u0434\u0438\u0430",
			"zh-CN": "\u4E0D\u8981\u5F39\u51FA\u4E0D\u540C\u7684\u5A92\u4F53\u7C7B\u578B"
		},
		"This option prevents the popup from loading a video when the source was an image or vice-versa": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_matching_media_types",
						"field": "description"
					}
				]
			},
			"pt-BR": "Esta op\u00E7\u00E3o impede que o popup carregue um v\u00EDdeo quando a fonte for uma imagem ou vice-versa",
			"ru": "\u042D\u0442\u043E\u0442 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440 \u0437\u0430\u043F\u0440\u0435\u0449\u0430\u0435\u0442 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u043C\u0443 \u043E\u043A\u043D\u0443 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044C \u0432\u0438\u0434\u0435\u043E, \u0435\u0441\u043B\u0438 \u0438\u0441\u0442\u043E\u0447\u043D\u0438\u043A\u043E\u043C \u0431\u044B\u043B\u043E \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435, \u0438\u043B\u0438 \u043D\u0430\u043E\u0431\u043E\u0440\u043E\u0442.",
			"zh-CN": "\u6B64\u9009\u9879\u53EF\u907F\u514D\u6E90\u662F\u56FE\u50CF\u65F6\u5F39\u7A97\u52A0\u8F7D\u89C6\u9891\uFF0C\u53CD\u4E4B\u4EA6\u7136"
		},
		"Allow popup when fullscreen": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_allow_popup_when_fullscreen",
						"field": "name"
					}
				]
			},
			"pt-BR": "Permitir popup em tela cheia",
			"ru": "\u0412\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0438\u0435 \u043E\u043A\u043D\u0430 \u0432 \u043F\u043E\u043B\u043D\u043E\u044D\u043A\u0440\u0430\u043D\u043D\u043E\u043C \u0440\u0435\u0436\u0438\u043C\u0435",
			"zh-CN": "\u5141\u8BB8\u5168\u5C4F\u65F6\u5F39\u7A97"
		},
		"Allows the popup to open if an element (such as a video player) is fullscreen.": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_allow_popup_when_fullscreen",
						"field": "description"
					}
				]
			},
			"pt-BR": "Permite que o popup seja aberto se um elemento (como um player de v\u00EDdeo) estiver em tela cheia.",
			"ru": "\u041F\u043E\u0437\u0432\u043E\u043B\u044F\u0435\u0442 \u043E\u0442\u043A\u0440\u044B\u0432\u0430\u0442\u044C \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E, \u0435\u0441\u043B\u0438 \u044D\u043B\u0435\u043C\u0435\u043D\u0442 (\u043D\u0430\u043F\u0440\u0438\u043C\u0435\u0440, \u0432\u0438\u0434\u0435\u043E\u043F\u043B\u0435\u0435\u0440) \u043D\u0430\u0445\u043E\u0434\u0438\u0442\u0441\u044F \u0432 \u043F\u043E\u043B\u043D\u043E\u044D\u043A\u0440\u0430\u043D\u043D\u043E\u043C \u0440\u0435\u0436\u0438\u043C\u0435.",
			"zh-CN": "\u5141\u8BB8\u5B58\u5728\u5168\u5C4F\u5143\u7D20\uFF08\u5982\u89C6\u9891\u64AD\u653E\u5668\uFF09\u65F6\u6253\u5F00\u5F39\u7A97\u3002"
		},
		"Element finding mode": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_find_els_mode",
						"field": "name"
					}
				]
			},
			"pt-BR": "Modo de localiza\u00E7\u00E3o de elemento",
			"ru": "\u0420\u0435\u0436\u0438\u043C \u043F\u043E\u0438\u0441\u043A\u0430 \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432",
			"zh-CN": "\u5143\u7D20\u67E5\u627E\u6A21\u5F0F"
		},
		"How IMU should find the media element on the page.": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_find_els_mode",
						"field": "description"
					}
				]
			},
			"pt-BR": "Como o maxurl deve encontrar o elemento de m\u00EDdia na p\u00E1gina.",
			"ru": "\u041A\u0430\u043A IMU \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043A\u0430\u0442\u044C \u043C\u0435\u0434\u0438\u0430-\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B \u043D\u0430 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0435.",
			"zh-CN": "Image Max URL \u5E94\u5982\u4F55\u67E5\u627E\u9875\u9762\u4E0A\u7684\u5A92\u4F53\u5143\u7D20\u3002"
		},
		"This will result in a much higher CPU load for websites such as Facebook, and will occasionally return the wrong element.\nUse this option with caution.": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_find_els_mode",
						"field": "warning.full"
					}
				]
			},
			"pt-BR": "Isso resultar\u00E1 em uma carga de CPU muito maior para sites como o Facebook e ocasionalmente retornar\u00E1 o elemento errado.\nUse esta op\u00E7\u00E3o com cautela.",
			"ru": "\u042D\u0442\u043E \u043F\u0440\u0438\u0432\u0435\u0434\u0435\u0442 \u043A \u0433\u043E\u0440\u0430\u0437\u0434\u043E \u0431\u043E\u043B\u0435\u0435 \u0432\u044B\u0441\u043E\u043A\u043E\u0439 \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0435 \u043F\u0440\u043E\u0446\u0435\u0441\u0441\u043E\u0440\u0430 \u0434\u043B\u044F \u0442\u0430\u043A\u0438\u0445 \u0441\u0430\u0439\u0442\u043E\u0432, \u043A\u0430\u043A Facebook, \u0438 \u0438\u043D\u043E\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u043E\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044C \u043D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u044B\u0439 \u044D\u043B\u0435\u043C\u0435\u043D\u0442.\n\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0439\u0442\u0435 \u044D\u0442\u043E\u0442 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440 \u0441 \u043E\u0441\u0442\u043E\u0440\u043E\u0436\u043D\u043E\u0441\u0442\u044C\u044E.",
			"zh-CN": "\u5BF9\u8BF8\u5982 Facebook \u7B49\u7F51\u7AD9\uFF0C\u8FD9\u5C06\u5BFC\u81F4\u5F88\u9AD8\u7684 CPU \u8D1F\u8F7D\uFF0C\u4E14\u5076\u5C14\u4F1A\u8FD4\u56DE\u9519\u8BEF\u7684\u5143\u7D20\u3002\n\u8C28\u614E\u4F7F\u7528\u6B64\u9009\u9879\u3002"
		},
		"Full": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_find_els_mode",
						"field": "options.full.name"
					}
				]
			},
			"pt-BR": "Completo",
			"ru": "\u041F\u043E\u043B\u043D\u044B\u0439",
			"zh-CN": "\u5168\u9762"
		},
		"Manually looks through every element on the page to see if the cursor is above them. This will result in a higher CPU load for websites such as Facebook, and may return the wrong element": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_find_els_mode",
						"field": "options.full.description"
					}
				]
			},
			"pt-BR": "Procura manualmente por cada elemento na p\u00E1gina para ver se o cursor est\u00E1 sobre eles. Isso resultar\u00E1 em uma maior carga de CPU para sites como o Facebook e pode retornar o elemento errado",
			"ru": "\u0412\u0440\u0443\u0447\u043D\u0443\u044E \u043F\u0440\u043E\u0441\u043C\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442 \u043A\u0430\u0436\u0434\u044B\u0439 \u044D\u043B\u0435\u043C\u0435\u043D\u0442 \u043D\u0430 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0435, \u0447\u0442\u043E\u0431\u044B \u0443\u0432\u0438\u0434\u0435\u0442\u044C, \u043D\u0430\u0445\u043E\u0434\u0438\u0442\u0441\u044F \u043B\u0438 \u043A\u0443\u0440\u0441\u043E\u0440 \u043D\u0430\u0434 \u043D\u0438\u043C\u0438. \u042D\u0442\u043E \u043F\u0440\u0438\u0432\u0435\u0434\u0435\u0442 \u043A \u0431\u043E\u043B\u0435\u0435 \u0432\u044B\u0441\u043E\u043A\u043E\u0439 \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0435 \u043F\u0440\u043E\u0446\u0435\u0441\u0441\u043E\u0440\u0430 \u0434\u043B\u044F \u0442\u0430\u043A\u0438\u0445 \u0441\u0430\u0439\u0442\u043E\u0432, \u043A\u0430\u043A Facebook, \u0438 \u043C\u043E\u0436\u0435\u0442 \u0432\u0435\u0440\u043D\u0443\u0442\u044C \u043D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u044B\u0439 \u044D\u043B\u0435\u043C\u0435\u043D\u0442.",
			"zh-CN": "\u9010\u4E00\u68C0\u67E5\u9875\u9762\u4E0A\u7684\u6BCF\u4E2A\u5143\u7D20\uFF0C\u770B\u9F20\u6807\u6307\u9488\u662F\u5426\u5728\u4E0A\u9762\u3002\u8FD9\u5C06\u5BFC\u81F4\u5F88\u9AD8\u7684 CPU \u8D1F\u8F7D\uFF0C\u4E14\u5076\u5C14\u4F1A\u8FD4\u56DE\u9519\u8BEF\u7684\u5143\u7D20"
		},
		"Hybrid": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_find_els_mode",
						"field": "options.hybrid.name"
					}
				]
			},
			"pt-BR": "H\u00EDbrido",
			"ru": "\u0413\u0438\u0431\u0440\u0438\u0434\u043D\u044B\u0439",
			"zh-CN": "\u6DF7\u5408"
		},
		"Looks manually through every child element of the last element found by `getElementsAtPoint`. Use this option if in doubt, it'll work on most sites": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_find_els_mode",
						"field": "options.hybrid.description"
					}
				]
			},
			"pt-BR": "Procura manualmente em cada elemento filho do \u00FAltimo elemento encontrado por `getElementsAtPoint`. Use esta op\u00E7\u00E3o em caso de d\u00FAvida, funcionar\u00E1 na maioria dos sites",
			"ru": "\u041F\u0440\u043E\u0441\u043C\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442 \u0432\u0440\u0443\u0447\u043D\u0443\u044E \u043A\u0430\u0436\u0434\u044B\u0439 \u0434\u043E\u0447\u0435\u0440\u043D\u0438\u0439 \u044D\u043B\u0435\u043C\u0435\u043D\u0442 \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0435\u0433\u043E \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430, \u043D\u0430\u0439\u0434\u0435\u043D\u043D\u043E\u0433\u043E \u0441 \u043F\u043E\u043C\u043E\u0449\u044C\u044E `getElementsAtPoint`. \u0418\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0439\u0442\u0435 \u044D\u0442\u043E\u0442 \u0432\u0430\u0440\u0438\u0430\u043D\u0442, \u0435\u0441\u043B\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044C \u0441\u043E\u043C\u043D\u0435\u043D\u0438\u044F. \u041E\u043D \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043E\u0442\u0430\u0442\u044C \u043D\u0430 \u0431\u043E\u043B\u044C\u0448\u0438\u043D\u0441\u0442\u0432\u0435 \u0441\u0430\u0439\u0442\u043E\u0432.",
			"zh-CN": "\u9010\u4E00\u68C0\u67E5\u7528 `getElementsAtPoint` \u627E\u5230\u7684\u6700\u540E\u4E00\u4E2A\u5143\u7D20\u7684\u6BCF\u4E2A\u5B50\u5143\u7D20\u3002\u5982\u679C\u4E0D\u4E86\u89E3\uFF0C\u4F7F\u7528\u6B64\u9009\u9879\uFF0C\u5B83\u9002\u7528\u4E8E\u7EDD\u5927\u591A\u6570\u7F51\u7AD9"
		},
		"Simple": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_find_els_mode",
						"field": "options.simple.name"
					}
				]
			},
			"pt-BR": "Simples",
			"ru": "\u041F\u0440\u043E\u0441\u0442\u043E\u0439",
			"zh-CN": "\u7B80\u6613"
		},
		"This is the fastest option, which uses the value of `getElementsAtPoint` without modification. Works for sites that don't use pointer-events:none and shadow DOM": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_find_els_mode",
						"field": "options.simple.description"
					}
				]
			},
			"pt-BR": "Esta \u00E9 a op\u00E7\u00E3o mais r\u00E1pida, que usa o valor de `getElementsAtPoint` sem modifica\u00E7\u00E3o. Funciona para sites que n\u00E3o usam pointer-events: none e shadow DOM",
			"ru": "\u042D\u0442\u043E \u0441\u0430\u043C\u044B\u0439 \u0431\u044B\u0441\u0442\u0440\u044B\u0439 \u0432\u0430\u0440\u0438\u0430\u043D\u0442, \u043A\u043E\u0442\u043E\u0440\u044B\u0439 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u0442 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 `getElementsAtPoint` \u0431\u0435\u0437 \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u0439. \u0420\u0430\u0431\u043E\u0442\u0430\u0435\u0442 \u0434\u043B\u044F \u0441\u0430\u0439\u0442\u043E\u0432, \u043A\u043E\u0442\u043E\u0440\u044B\u0435 \u043D\u0435 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u044E\u0442 pointer-events:none \u0438 shadow DOM.",
			"zh-CN": "\u8FD9\u662F\u6700\u5FEB\u7684\u9009\u9879\uFF0C\u5B83\u4F7F\u7528 `getElementsAtPoint` \u7684\u503C\u800C\u4E0D\u505A\u4FEE\u6539\u3002\u9002\u7528\u4E8E\u4E0D\u4F7F\u7528 pointer-events:none \u548C shadow DOM \u7684\u7F51\u7AD9"
		},
		"Use cache": {
			"_info": {
				"instances": [
					{
						"setting": "popup_allow_cache",
						"field": "name"
					}
				]
			},
			"pt-BR": "Usar cache",
			"ru": "\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u043A\u044D\u0448",
			"zh-CN": "\u4F7F\u7528\u7F13\u5B58"
		},
		"Allows use of a media cache for the popup. The cache is currently stored per-page and is not persistent across page reloads.": {
			"_info": {
				"instances": [
					{
						"setting": "popup_allow_cache",
						"field": "description"
					}
				]
			},
			"pt-BR": "Permite o uso de um cache de m\u00EDdia para o popup. O cache \u00E9 armazenado por p\u00E1gina e n\u00E3o \u00E9 persistente entre recarregamentos de p\u00E1gina.",
			"ru": "\u041F\u043E\u0437\u0432\u043E\u043B\u044F\u0435\u0442 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u043C\u0435\u0434\u0438\u0430-\u043A\u0435\u0448 \u0434\u043B\u044F \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430. \u041A\u044D\u0448 \u0432 \u043D\u0430\u0441\u0442\u043E\u044F\u0449\u0435\u0435 \u0432\u0440\u0435\u043C\u044F \u0445\u0440\u0430\u043D\u0438\u0442\u0441\u044F \u0434\u043B\u044F \u043A\u0430\u0436\u0434\u043E\u0439 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u044B \u0438 \u043D\u0435 \u0441\u043E\u0445\u0440\u0430\u043D\u044F\u0435\u0442\u0441\u044F \u043F\u0440\u0438 \u043F\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0435 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u044B.",
			"zh-CN": "\u5141\u8BB8\u5F39\u7A97\u7F13\u5B58\u5A92\u4F53\u3002\u7F13\u5B58\u76EE\u524D\u4E0D\u8DE8\u9875\u5171\u4EAB\uFF0C\u5E76\u4E14\u4E0D\u4F1A\u6301\u4E45\u5316\uFF08\u91CD\u65B0\u52A0\u8F7D\u5373\u5931\u6548\uFF09\u3002"
		},
		"Cache duration": {
			"_info": {
				"instances": [
					{
						"setting": "popup_cache_duration",
						"field": "name"
					}
				]
			},
			"pt-BR": "Dura\u00E7\u00E3o do cache",
			"ru": "\u0414\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C \u043A\u044D\u0448\u0430",
			"zh-CN": "\u7F13\u5B58\u6301\u7EED\u65F6\u95F4"
		},
		"How long for media to remain cached. Set to `0` for unlimited.": {
			"_info": {
				"instances": [
					{
						"setting": "popup_cache_duration",
						"field": "description"
					}
				]
			},
			"pt-BR": "Por quanto tempo a m\u00EDdia permanecer\u00E1 em cache. Defina como `0` para ilimitado.",
			"ru": "\u041A\u0430\u043A \u0434\u043E\u043B\u0433\u043E \u043C\u0435\u0434\u0438\u0430 \u0431\u0443\u0434\u0443\u0442 \u043E\u0441\u0442\u0430\u0432\u0430\u0442\u044C\u0441\u044F \u0432 \u043A\u044D\u0448\u0435. `0` - \u0432\u0441\u0435\u0433\u0434\u0430.",
			"zh-CN": "\u5A92\u4F53\u88AB\u7F13\u5B58\u591A\u4E45\u3002\u8BBE\u4E3A 0 \u5219\u65E0\u9650\u5236\u3002"
		},
		"minutes": {
			"_info": {
				"instances": [
					{
						"setting": "popup_cache_duration",
						"field": "number_unit"
					}
				]
			},
			"pt-BR": "minutos",
			"ru": "\u043C\u0438\u043D.",
			"zh-CN": "\u5206\u949F"
		},
		"Cache item limit": {
			"_info": {
				"instances": [
					{
						"setting": "popup_cache_itemlimit",
						"field": "name"
					}
				]
			},
			"pt-BR": "Limite de itens no cache",
			"ru": "\u041E\u0433\u0440\u0430\u043D\u0438\u0447\u0435\u043D\u0438\u0435 \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432 \u043A\u044D\u0448\u0430",
			"zh-CN": "\u7F13\u5B58\u6570\u91CF\u9650\u5236"
		},
		"Maximum number of individual media to remain cached. Set to `0` for unlimited.": {
			"_info": {
				"instances": [
					{
						"setting": "popup_cache_itemlimit",
						"field": "description"
					}
				]
			},
			"pt-BR": "N\u00FAmero m\u00E1ximo de m\u00EDdias individuais para permanecerem em cache. Defina como `0` para ilimitado.",
			"ru": "\u041C\u0430\u043A\u0441\u0438\u043C\u0430\u043B\u044C\u043D\u043E\u0435 \u043A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043E\u0442\u0434\u0435\u043B\u044C\u043D\u044B\u0445 \u043C\u0435\u0434\u0438\u0430 \u0434\u043B\u044F \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u0438\u044F \u0432 \u043A\u044D\u0448\u0435. `0` - \u0431\u0435\u0437 \u043E\u0433\u0440\u0430\u043D\u0438\u0447\u0435\u043D\u0438\u044F.",
			"zh-CN": "\u6700\u591A\u7F13\u5B58\u591A\u5C11\u4E2A\u5A92\u4F53\u3002\u8BBE\u4E3A 0 \u5219\u65E0\u9650\u5236\u3002"
		},
		"items": {
			"_info": {
				"instances": [
					{
						"setting": "popup_cache_itemlimit",
						"field": "number_unit"
					}
				]
			},
			"pt-BR": "itens",
			"ru": "\u044D\u043B.",
			"zh-CN": "\u9879"
		},
		"Resume videos": {
			"_info": {
				"instances": [
					{
						"setting": "popup_cache_resume_video",
						"field": "name"
					}
				]
			},
			"pt-BR": "Retomar v\u00EDdeos",
			"ru": "\u0412\u043E\u0437\u043E\u0431\u043D\u043E\u0432\u043B\u044F\u0442\u044C \u0432\u0438\u0434\u0435\u043E",
			"zh-CN": "\u7EE7\u7EED\u89C6\u9891"
		},
		"If a video popup was closed then reopened, the video will resume from where it left off": {
			"_info": {
				"instances": [
					{
						"setting": "popup_cache_resume_video",
						"field": "description"
					}
				]
			},
			"pt-BR": "Se um popup de v\u00EDdeo foi fechado e reaberto, o v\u00EDdeo ser\u00E1 retomado de onde parou",
			"ru": "\u0415\u0441\u043B\u0438 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u0432\u0438\u0434\u0435\u043E \u0431\u044B\u043B\u043E \u0437\u0430\u043A\u0440\u044B\u0442\u043E, \u0430 \u0437\u0430\u0442\u0435\u043C \u0441\u043D\u043E\u0432\u0430 \u043E\u0442\u043A\u0440\u044B\u0442\u043E, \u0432\u0438\u0434\u0435\u043E \u0432\u043E\u0437\u043E\u0431\u043D\u043E\u0432\u0438\u0442\u0441\u044F \u0441 \u0442\u043E\u0433\u043E \u043C\u0435\u0441\u0442\u0430, \u0433\u0434\u0435 \u043E\u043D\u043E \u0431\u044B\u043B\u043E \u043E\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u043E.",
			"zh-CN": "\u5982\u679C\u4E00\u4E2A\u89C6\u9891\u5F39\u7A97\u88AB\u5173\u95ED\u7136\u540E\u518D\u6B21\u6253\u5F00\uFF0C\u8BE5\u89C6\u9891\u5C06\u4ECE\u4E0A\u6B21\u79BB\u5F00\u7684\u8FDB\u5EA6\u7EE7\u7EED\u64AD\u653E"
		},
		"Use userscript": {
			"_info": {
				"instances": [
					{
						"setting": "website_inject_imu",
						"field": "name"
					}
				]
			},
			"fr": "Utiliser ce userscript",
			"ko": "\uC720\uC800\uC2A4\uD06C\uB9BD\uD2B8 \uC0AC\uC6A9\uD558\uAE30",
			"pt-BR": "Usar script do usu\u00E1rio",
			"ru": "\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u0438\u0439 \u0441\u043A\u0440\u0438\u043F\u0442",
			"zh-CN": "\u4F7F\u7528\u7528\u6237\u811A\u672C"
		},
		"Replaces the website's IMU instance with the userscript": {
			"_info": {
				"instances": [
					{
						"setting": "website_inject_imu",
						"field": "description"
					}
				]
			},
			"pt-BR": "Substitui a inst\u00E2ncia do maxurl do site pelo script do usu\u00E1rio",
			"ru": "\u0417\u0430\u043C\u0435\u043D\u044F\u0435\u0442 \u0441\u0430\u0439\u0442 \u044D\u043A\u0437\u0435\u043C\u043F\u043B\u044F\u0440\u0430 IMU \u043D\u0430 \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u0438\u0439 \u0441\u043A\u0440\u0438\u043F\u0442.",
			"zh-CN": "\u4F7F\u7528\u7528\u6237\u811A\u672C\u66FF\u6362\u8BE5\u7F51\u7AD9\u7684 Image Max URL \u5B9E\u4F8B"
		},
		"Website image preview": {
			"_info": {
				"instances": [
					{
						"setting": "website_image",
						"field": "name"
					}
				]
			},
			"ko": "\uB9C1\uD06C \uBD99\uC778 \uD6C4 \uC774\uBBF8\uC9C0 \uBBF8\uB9AC\uBCF4\uAE30",
			"pt-BR": "Pr\u00E9via da imagem no site",
			"ru": "\u041F\u0440\u0435\u0434\u043F\u0440\u043E\u0441\u043C\u043E\u0442\u0440 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F \u0441\u0430\u0439\u0442\u0430",
			"zh-CN": "\u7F51\u7AD9\u56FE\u7247\u9884\u89C8"
		},
		"Enables a preview of the image on the Image Max URL website": {
			"_info": {
				"instances": [
					{
						"setting": "website_image",
						"field": "description"
					}
				]
			},
			"pt-BR": "Habilita a pr\u00E9via da imagem no site Image Max URL",
			"ru": "\u0412\u043A\u043B\u044E\u0447\u0430\u0435\u0442 \u043F\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0439 \u043F\u0440\u043E\u0441\u043C\u043E\u0442\u0440 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F \u043D\u0430 \u0441\u0430\u0439\u0442\u0435 Image Max URL",
			"zh-CN": "\u5141\u8BB8\u5728 Image Max URL \u7F51\u7AD9\u4E0A\u9884\u89C8\u56FE\u7247"
		},
		"IMU entry in context menu": {
			"_info": {
				"instances": [
					{
						"setting": "extension_contextmenu",
						"field": "name"
					}
				]
			},
			"pt-BR": "Entrada do maxurl no menu de contexto",
			"ru": "\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C IMU \u0432 \u043A\u043E\u043D\u0442\u0435\u043A\u0441\u0442\u043D\u043E\u0435 \u043C\u0435\u043D\u044E",
			"zh-CN": "\u53F3\u952E\u83DC\u5355\u4E2D\u7684 Image Max URL \u9879"
		},
		"Enables a custom entry for this extension in the right click/context menu": {
			"_info": {
				"instances": [
					{
						"setting": "extension_contextmenu",
						"field": "description"
					}
				]
			},
			"pt-BR": "Habilita uma entrada personalizada para esta extens\u00E3o no menu de contexto/clique com o bot\u00E3o direito",
			"ru": "\u0412\u043A\u043B\u044E\u0447\u0430\u0435\u0442 \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u0443\u044E \u0437\u0430\u043F\u0438\u0441\u044C \u0434\u043B\u044F \u044D\u0442\u043E\u0433\u043E \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u0438\u044F \u0432 \u043A\u043E\u043D\u0442\u0435\u043A\u0441\u0442\u043D\u043E\u043C \u043C\u0435\u043D\u044E (\u043D\u0430\u0436\u0430\u0442\u0438\u0435 \u043F\u0440\u0430\u0432\u043E\u0439 \u043A\u043D\u043E\u043F\u043A\u043E\u0439 \u043C\u044B\u0448\u0438).",
			"zh-CN": "\u53F3\u952E\u83DC\u5355/\u4E0A\u4E0B\u6587\u83DC\u5355\u4E2D\u542F\u7528\u672C\u6269\u5C55\u5B9A\u4E49\u7684\u83DC\u5355"
		},
		"Hot (re)load": {
			"_info": {
				"instances": [
					{
						"setting": "extension_hotreload",
						"field": "name"
					}
				]
			},
			"pt-BR": "(Re)carregamento din\u00E2mico",
			"ru": "\u0413\u043E\u0440\u044F\u0447\u0430\u044F (\u043F\u0435\u0440\u0435)\u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0430",
			"zh-CN": "\u70ED\u91CD\u8F7D"
		},
		"(Re)loads the extension on all existing pages when installing or updating": {
			"_info": {
				"instances": [
					{
						"setting": "extension_hotreload",
						"field": "description"
					}
				]
			},
			"pt-BR": "(Re)carrega a extens\u00E3o em todas as p\u00E1ginas existentes ao instalar ou atualizar",
			"ru": "(\u041F\u0435\u0440\u0435)\u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u0438\u0435 \u043D\u0430 \u0432\u0441\u0435\u0445 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044E\u0449\u0438\u0445 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0430\u0445 \u043F\u0440\u0438 \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043A\u0435 \u0438\u043B\u0438 \u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0438.",
			"zh-CN": "\u5B89\u88C5\u6216\u66F4\u65B0\u540E\uFF0C\u70ED\u91CD\u8F7D\u73B0\u6709\u7684\u5168\u90E8\u9875\u9762\u4E0A\u7684\u672C\u6269\u5C55"
		},
		"Custom XHR for libraries": {
			"_info": {
				"instances": [
					{
						"setting": "custom_xhr_for_lib",
						"field": "name"
					}
				]
			},
			"pt-BR": "XHR personalizado para bibliotecas",
			"ru": "\u041F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u0438\u0439 XHR \u0434\u043B\u044F \u0431\u0438\u0431\u043B\u0438\u043E\u0442\u0435\u043A",
			"zh-CN": "\u81EA\u5B9A\u4E49\u7A0B\u5E8F\u5E93\u7684 XHR"
		},
		"Allows the use of more powerful XHR (network requests) for 3rd-party libraries. This allows for certain DASH streams to work.": {
			"_info": {
				"instances": [
					{
						"setting": "custom_xhr_for_lib",
						"field": "description"
					}
				]
			},
			"pt-BR": "Permite o uso de XHR (solicita\u00E7\u00F5es de rede) mais poderosos para bibliotecas de terceiros. Isso permite que certos fluxos DASH funcionem.",
			"ru": "\u041F\u043E\u0437\u0432\u043E\u043B\u044F\u0435\u0442 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u0431\u043E\u043B\u0435\u0435 \u043C\u043E\u0449\u043D\u044B\u0435 XHR (\u0441\u0435\u0442\u0435\u0432\u044B\u0435 \u0437\u0430\u043F\u0440\u043E\u0441\u044B) \u0434\u043B\u044F \u0441\u0442\u043E\u0440\u043E\u043D\u043D\u0438\u0445 \u0431\u0438\u0431\u043B\u0438\u043E\u0442\u0435\u043A. \u042D\u0442\u043E \u043F\u043E\u0437\u0432\u043E\u043B\u044F\u0435\u0442 \u0440\u0430\u0431\u043E\u0442\u0430\u0442\u044C \u043E\u043F\u0440\u0435\u0434\u0435\u043B\u0435\u043D\u043D\u044B\u043C \u043F\u043E\u0442\u043E\u043A\u0430\u043C DASH.",
			"zh-CN": "\u5141\u8BB8\u7B2C\u4E09\u65B9\u5E93\u4F7F\u7528\u66F4\u5F3A\u5927\u7684 XHR\uFF08\u7F51\u7EDC\u8BF7\u6C42\uFF09\u3002\u67D0\u4E9B DASH \u6D41\u5A92\u4F53\u9700\u8981\u8FD9\u4E2A\u3002"
		},
		"Allows the use of more powerful XHR  (network requests) for 3rd-party libraries. This allows for certain DASH streams to work. Using this with the userscript version currently poses a potential security risk.": {
			"_info": {
				"instances": [
					{
						"setting": "custom_xhr_for_lib",
						"field": "description_userscript"
					}
				]
			},
			"pt-BR": "Permite o uso de XHR (solicita\u00E7\u00F5es de rede) mais poderosos para bibliotecas de terceiros. Isso permite que certos fluxos DASH funcionem. Usar isso com a vers\u00E3o do script do usu\u00E1rio atualmente representa um risco potencial \u00E0 seguran\u00E7a.",
			"ru": "\u041F\u043E\u0437\u0432\u043E\u043B\u044F\u0435\u0442 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u0431\u043E\u043B\u0435\u0435 \u043C\u043E\u0449\u043D\u044B\u0435 XHR (\u0441\u0435\u0442\u0435\u0432\u044B\u0435 \u0437\u0430\u043F\u0440\u043E\u0441\u044B) \u0434\u043B\u044F \u0441\u0442\u043E\u0440\u043E\u043D\u043D\u0438\u0445 \u0431\u0438\u0431\u043B\u0438\u043E\u0442\u0435\u043A. \u042D\u0442\u043E \u043F\u043E\u0437\u0432\u043E\u043B\u044F\u0435\u0442 \u0440\u0430\u0431\u043E\u0442\u0430\u0442\u044C \u043E\u043F\u0440\u0435\u0434\u0435\u043B\u0435\u043D\u043D\u044B\u043C \u043F\u043E\u0442\u043E\u043A\u0430\u043C DASH. \u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u0438\u0435 \u0435\u0433\u043E \u0432 \u0432\u0435\u0440\u0441\u0438\u0438 \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u043E\u0433\u043E \u0441\u043A\u0440\u0438\u043F\u0442\u0430 \u0432 \u043D\u0430\u0441\u0442\u043E\u044F\u0449\u0435\u0435 \u0432\u0440\u0435\u043C\u044F \u043F\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043B\u044F\u0435\u0442 \u0441\u043E\u0431\u043E\u0439 \u043F\u043E\u0442\u0435\u043D\u0446\u0438\u0430\u043B\u044C\u043D\u044B\u0439 \u0440\u0438\u0441\u043A \u0434\u043B\u044F \u0431\u0435\u0437\u043E\u043F\u0430\u0441\u043D\u043E\u0441\u0442\u0438.",
			"zh-CN": "\u5141\u8BB8\u7B2C\u4E09\u65B9\u5E93\u4F7F\u7528\u66F4\u5F3A\u5927\u7684 XHR\uFF08\u7F51\u7EDC\u8BF7\u6C42\uFF09\u3002\u67D0\u4E9B DASH \u6D41\u5A92\u4F53\u9700\u8981\u8FD9\u4E2A\u3002\u5728\u76EE\u524D\u7684\u7528\u6237\u811A\u672C\u7248\u672C\u4E2D\u4F7F\u7528\u8FD9\u79CD\u65B9\u6CD5\u6784\u6210\u6F5C\u5728\u7684\u5B89\u5168\u98CE\u9669\u3002"
		},
		"Kakao": {
			"_info": {
				"instances": [
					{
						"setting": "custom_xhr_for_lib",
						"field": "example_websites[0]"
					}
				]
			},
			"pt-BR": "Kakao",
			"ru": "Kakao",
			"zh-CN": "Kakao"
		},
		"YouTube": {
			"_info": {
				"instances": [
					{
						"setting": "custom_xhr_for_lib",
						"field": "example_websites[1]"
					}
				]
			},
			"pt-BR": "YouTube",
			"ru": "YouTube",
			"zh-CN": "YouTube"
		},
		"Instagram (downloading)": {
			"_info": {
				"instances": [
					{
						"setting": "custom_xhr_for_lib",
						"field": "example_websites[2]"
					}
				]
			},
			"pt-BR": "Instagram (download)",
			"ru": "Instagram (\u0441\u043A\u0430\u0447\u0438\u0432\u0430\u043D\u0438\u0435)",
			"zh-CN": "Instagram (\u4E0B\u8F7D)"
		},
		"Bypass CSP for libraries": {
			"_info": {
				"instances": [
					{
						"setting": "bypass_csp_for_lib",
						"field": "name"
					}
				]
			},
			"pt-BR": "Ignorar CSP para bibliotecas"
		},
		"Tries loading the 3rd-party libraries using a `<script>` tag if a page's CSP prevents it from being loaded normally.\nThis option currently carries an increased security risk when combined with \"Custom XHR for libraries\", and should only be enabled if absolutely necessary.": {
			"_info": {
				"instances": [
					{
						"setting": "bypass_csp_for_lib",
						"field": "description"
					}
				]
			},
			"pt-BR": "Tenta carregar as bibliotecas de terceiros usando uma tag <script> se o CSP de uma p\u00E1gina impedir que seja carregada normalmente.\nAtualmente, esta op\u00E7\u00E3o acarreta um risco de seguran\u00E7a aumentado quando combinada com \"XHR Personalizado para bibliotecas\" e s\u00F3 deve ser ativada se absolutamente necess\u00E1rio."
		},
		"This can potentially be extremely insecure if \"Custom XHR for libraries\" is also enabled.\nA malicious website could gain extension-level permissions and perform arbitrary requests (your online accounts could get hacked).\nIf you need to use this option, please disable it as soon as possible.": {
			"_info": {
				"instances": [
					{
						"setting": "bypass_csp_for_lib",
						"field": "warning.true"
					}
				]
			},
			"pt-BR": "Isso pode ser extremamente inseguro se \"XHR Personalizado para bibliotecas\" tamb\u00E9m estiver ativado.\nUm website malicioso pode obter permiss\u00F5es de n\u00EDvel de extens\u00E3o e realizar solicita\u00E7\u00F5es arbitr\u00E1rias (suas contas online podem ser invadidas).\nSe precisar usar esta op\u00E7\u00E3o, desative-a assim que poss\u00EDvel."
		},
		"Snapchat": {
			"_info": {
				"instances": [
					{
						"setting": "bypass_csp_for_lib",
						"field": "example_websites[0]"
					}
				]
			},
			"pt-BR": "Snapchat"
		},
		"Use Web Archive for libraries": {
			"_info": {
				"instances": [
					{
						"setting": "use_webarchive_for_lib",
						"field": "name"
					}
				]
			},
			"pt-BR": "Usar Web Archive para bibliotecas",
			"ru": "\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u0432\u0435\u0431-\u0430\u0440\u0445\u0438\u0432 \u0434\u043B\u044F \u0431\u0438\u0431\u043B\u0438\u043E\u0442\u0435\u043A",
			"zh-CN": "\u4E3A\u7A0B\u5E8F\u5E93\u4F7F\u7528 Web Archive \u7248\u672C"
		},
		"Uses archive.org's web archive instead of github for libraries and other script internals (such as the options page).\nDon't enable this unless you need to.": {
			"_info": {
				"instances": [
					{
						"setting": "use_webarchive_for_lib",
						"field": "description"
					}
				]
			},
			"pt-BR": "Usa o arquivo web do archive.org em vez do github para bibliotecas e outros componentes internos do script (como a p\u00E1gina de op\u00E7\u00F5es).\nN\u00E3o ative isso a menos que seja necess\u00E1rio.",
			"ru": "\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u0442 \u0432\u0435\u0431-\u0430\u0440\u0445\u0438\u0432 archive.org \u0432\u043C\u0435\u0441\u0442\u043E github \u0434\u043B\u044F \u0431\u0438\u0431\u043B\u0438\u043E\u0442\u0435\u043A \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u0432\u043D\u0443\u0442\u0440\u0435\u043D\u043D\u0438\u0445 \u043A\u043E\u043C\u043F\u043E\u043D\u0435\u043D\u0442\u043E\u0432 \u0441\u043A\u0440\u0438\u043F\u0442\u0430 (\u043D\u0430\u043F\u0440\u0438\u043C\u0435\u0440, \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u044B \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u043E\u0432).\n\u041D\u0435 \u0432\u043A\u043B\u044E\u0447\u0430\u0439\u0442\u0435 \u044D\u0442\u0443 \u0444\u0443\u043D\u043A\u0446\u0438\u044E, \u0435\u0441\u043B\u0438 \u0432 \u044D\u0442\u043E\u043C \u043D\u0435\u0442 \u043D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u043E\u0441\u0442\u0438.",
			"zh-CN": "\u4E3A\u7A0B\u5E8F\u5E93\u548C\u811A\u672C\u5185\u7F6E\u7684\u5176\u4ED6\u6587\u4EF6\uFF08\u5982\u8FD9\u4E2A\u9009\u9879\u9875\u9762\uFF09\u4F7F\u7528 archive.org \u7684\u5B58\u6863\u7248\u672C\u800C\u975E github \u7248\u672C\u3002\n\u9664\u975E\u786E\u5B9E\u9700\u8981\uFF0C\u5426\u5219\u65E0\u9700\u542F\u7528\u3002"
		},
		"Enable integrity checks": {
			"_info": {
				"instances": [
					{
						"setting": "lib_integrity_check",
						"field": "name"
					}
				]
			},
			"pt-BR": "Habilitar verifica\u00E7\u00F5es de integridade",
			"ru": "\u041F\u0440\u043E\u0432\u0435\u0440\u043A\u0430 \u0446\u0435\u043B\u043E\u0441\u0442\u043D\u043E\u0441\u0442\u0438",
			"zh-CN": "\u542F\u7528\u5B8C\u6574\u6027\u68C0\u67E5"
		},
		"Runs integrity checks before loading 3rd-party libraries": {
			"_info": {
				"instances": [
					{
						"setting": "lib_integrity_check",
						"field": "description"
					}
				]
			},
			"pt-BR": "Executa verifica\u00E7\u00F5es de integridade antes de carregar bibliotecas de terceiros",
			"ru": "\u0417\u0430\u043F\u0443\u0441\u043A\u0430\u0435\u0442 \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0443 \u0446\u0435\u043B\u043E\u0441\u0442\u043D\u043E\u0441\u0442\u0438 \u043F\u0435\u0440\u0435\u0434 \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u043E\u0439 \u0441\u0442\u043E\u0440\u043E\u043D\u043D\u0438\u0445 \u0431\u0438\u0431\u043B\u0438\u043E\u0442\u0435\u043A.",
			"zh-CN": "\u52A0\u8F7D\u7B2C\u4E09\u65B9\u5E93\u4E4B\u524D\u8FD0\u884C\u5B8C\u6574\u6027\u68C0\u67E5"
		},
		"HLS/DASH maximum quality": {
			"_info": {
				"instances": [
					{
						"setting": "hls_dash_use_max",
						"field": "name"
					}
				]
			},
			"pt-BR": "Qualidade m\u00E1xima HLS/DASH",
			"ru": "\u041C\u0430\u043A\u0441\u0438\u043C\u0430\u043B\u044C\u043D\u043E\u0435 \u043A\u0430\u0447\u0435\u0441\u0442\u0432\u043E HLS/DASH",
			"zh-CN": "HLS/DASH \u6700\u9AD8\u8D28\u91CF"
		},
		"Uses the maximum quality for HLS/DASH streams": {
			"_info": {
				"instances": [
					{
						"setting": "hls_dash_use_max",
						"field": "description"
					}
				]
			},
			"pt-BR": "Usa a qualidade m\u00E1xima para fluxos HLS/DASH",
			"ru": "\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u0442 \u043C\u0430\u043A\u0441\u0438\u043C\u0430\u043B\u044C\u043D\u043E\u0435 \u043A\u0430\u0447\u0435\u0441\u0442\u0432\u043E \u0434\u043B\u044F \u043F\u043E\u0442\u043E\u043A\u043E\u0432 HLS/DASH.",
			"zh-CN": "\u5BF9 HLS/DASH \u6D41\u5A92\u4F53\u4F7F\u7528\u6700\u9AD8\u8D28\u91CF"
		},
		"Maximum video quality": {
			"_info": {
				"instances": [
					{
						"setting": "max_video_quality",
						"field": "name"
					}
				]
			},
			"pt-BR": "Qualidade m\u00E1xima do v\u00EDdeo",
			"ru": "\u041C\u0430\u043A\u0441\u0438\u043C\u0430\u043B\u044C\u043D\u043E\u0435 \u043A\u0430\u0447\u0435\u0441\u0442\u0432\u043E \u0432\u0438\u0434\u0435\u043E",
			"zh-CN": "\u6700\u9AD8\u89C6\u9891\u8D28\u91CF"
		},
		"Maximum quality for videos": {
			"_info": {
				"instances": [
					{
						"setting": "max_video_quality",
						"field": "description"
					}
				]
			},
			"pt-BR": "Qualidade m\u00E1xima para v\u00EDdeos",
			"ru": "\u041C\u0430\u043A\u0441\u0438\u043C\u0430\u043B\u044C\u043D\u043E\u0435 \u043A\u0430\u0447\u0435\u0441\u0442\u0432\u043E \u0434\u043B\u044F \u0432\u0438\u0434\u0435\u043E.",
			"zh-CN": "\u89C6\u9891\u7684\u6700\u9AD8\u8D28\u91CF"
		},
		"(unlimited)": {
			"_info": {
				"instances": [
					{
						"setting": "max_video_quality",
						"field": "options.unlimited.name"
					}
				]
			},
			"pt-BR": "(ilimitado)",
			"ru": "(\u043D\u0435\u043E\u0433\u0440\u0430\u043D\u0438\u0447\u0435\u043D\u043D\u043E\u0435)",
			"zh-CN": "\uFF08\u65E0\u9650\u5236\uFF09"
		},
		"4K": {
			"_info": {
				"instances": [
					{
						"setting": "max_video_quality",
						"field": "options.h2160.name"
					}
				]
			},
			"pt-BR": "4K",
			"ru": "4K",
			"zh-CN": "4K"
		},
		"1440p": {
			"_info": {
				"instances": [
					{
						"setting": "max_video_quality",
						"field": "options.h1440.name"
					}
				]
			},
			"pt-BR": "1440p",
			"ru": "1440p",
			"zh-CN": "1440p"
		},
		"1080p": {
			"_info": {
				"instances": [
					{
						"setting": "max_video_quality",
						"field": "options.h1080.name"
					}
				]
			},
			"pt-BR": "1080p",
			"ru": "1080p",
			"zh-CN": "1080p"
		},
		"720p": {
			"_info": {
				"instances": [
					{
						"setting": "max_video_quality",
						"field": "options.h720.name"
					}
				]
			},
			"pt-BR": "720p",
			"ru": "720p",
			"zh-CN": "720p"
		},
		"480p": {
			"_info": {
				"instances": [
					{
						"setting": "max_video_quality",
						"field": "options.h480.name"
					}
				]
			},
			"pt-BR": "480p",
			"ru": "480p",
			"zh-CN": "480p"
		},
		"Larger watermarked images": {
			"_info": {
				"instances": [
					{
						"setting": "allow_watermark",
						"field": "name"
					}
				]
			},
			"ko": "\uB354 \uD06C\uC9C0\uB9CC \uC6CC\uD130\uB9C8\uD06C \uC788\uB294 \uC774\uBBF8\uC9C0",
			"pt-BR": "Imagens maiores com marca d'\u00E1gua",
			"ru": "\u0411\u043E\u043B\u044C\u0448\u0438\u0435 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F \u0441 \u0432\u043E\u0434\u044F\u043D\u044B\u043C\u0438 \u0437\u043D\u0430\u043A\u0430\u043C\u0438",
			"zh-CN": "\u8F83\u5927\u7684\u5E26\u6C34\u5370\u56FE\u50CF"
		},
		"Enables rules that return larger images that include watermarks": {
			"_info": {
				"instances": [
					{
						"setting": "allow_watermark",
						"field": "description"
					}
				]
			},
			"pt-BR": "Habilita regras que retornam imagens maiores que incluem marcas d'\u00E1gua",
			"ru": "\u0412\u043A\u043B\u044E\u0447\u0430\u0435\u0442 \u043F\u0440\u0430\u0432\u0438\u043B\u0430, \u0432\u043E\u0437\u0432\u0440\u0430\u0449\u0430\u044E\u0449\u0438\u0435 \u0431\u043E\u043B\u0435\u0435 \u043A\u0440\u0443\u043F\u043D\u044B\u0435 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F \u0441 \u0432\u043E\u0434\u044F\u043D\u044B\u043C\u0438 \u0437\u043D\u0430\u043A\u0430\u043C\u0438.",
			"zh-CN": "\u542F\u7528\u89C4\u5219\uFF1A\u8FD4\u56DE\u5305\u542B\u6C34\u5370\u7684\u8F83\u5927\u56FE\u50CF"
		},
		"Stock photo websites": {
			"_info": {
				"instances": [
					{
						"setting": "allow_watermark",
						"field": "example_websites[0]"
					}
				]
			},
			"pt-BR": "Sites de fotos de banco de imagens",
			"ru": "\u0421\u0430\u0439\u0442\u044B \u0441\u043E \u0441\u0442\u043E\u043A\u043E\u0432\u044B\u043C\u0438 \u0444\u043E\u0442\u043E",
			"zh-CN": "\u201C\u56FE\u5E93\u7167\u7247\u201D\u7F51\u7AD9"
		},
		"Smaller non-watermarked images": {
			"_info": {
				"instances": [
					{
						"setting": "allow_smaller",
						"field": "name"
					}
				]
			},
			"ko": "\uB354 \uC791\uC9C0\uB9CC \uC6CC\uD130\uB9C8\uD06C \uC5C6\uB294 \uC774\uBBF8\uC9C0",
			"pt-BR": "Imagens menores sem marca d'\u00E1gua",
			"ru": "\u041D\u0435\u0431\u043E\u043B\u044C\u0448\u0438\u0435 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F \u0431\u0435\u0437 \u0432\u043E\u0434\u044F\u043D\u044B\u0445 \u0437\u043D\u0430\u043A\u043E\u0432",
			"zh-CN": "\u8F83\u5C0F\u7684\u65E0\u6C34\u5370\u56FE\u50CF"
		},
		"Enables rules that return smaller images without watermarks": {
			"_info": {
				"instances": [
					{
						"setting": "allow_smaller",
						"field": "description"
					}
				]
			},
			"pt-BR": "Habilita regras que retornam imagens menores sem marcas d'\u00E1gua",
			"ru": "\u0412\u043A\u043B\u044E\u0447\u0430\u0435\u0442 \u043F\u0440\u0430\u0432\u0438\u043B\u0430, \u0432\u043E\u0437\u0432\u0440\u0430\u0449\u0430\u044E\u0449\u0438\u0435 \u043C\u0435\u043D\u044C\u0448\u0438\u0435 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F \u0431\u0435\u0437 \u0432\u043E\u0434\u044F\u043D\u044B\u0445 \u0437\u043D\u0430\u043A\u043E\u0432.",
			"zh-CN": "\u542F\u7528\u89C4\u5219\uFF1A\u8FD4\u56DE\u65E0\u6C34\u5370\u7684\u8F83\u5C0F\u56FE\u50CF"
		},
		"Possibly different images": {
			"_info": {
				"instances": [
					{
						"setting": "allow_possibly_different",
						"field": "name"
					}
				]
			},
			"fr": "Images possiblement diff\u00E9rentes",
			"ko": "\uB2E4\uB97C \uC218 \uC788\uB294 \uC774\uBBF8\uC9C0",
			"pt-BR": "Imagens possivelmente diferentes",
			"ru": "\u0412\u043E\u0437\u043C\u043E\u0436\u043D\u043E, \u0440\u0430\u0437\u043D\u044B\u0435 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F",
			"zh-CN": "\u53EF\u80FD\u4E0D\u540C\u7684\u56FE\u50CF"
		},
		"Enables rules that return images that possibly differ, usually due to server-side caching": {
			"_info": {
				"instances": [
					{
						"setting": "allow_possibly_different",
						"field": "description"
					}
				]
			},
			"pt-BR": "Habilita regras que retornam imagens que podem ser diferentes, geralmente devido ao cache do lado do servidor",
			"ru": "\u0412\u043A\u043B\u044E\u0447\u0430\u0435\u0442 \u043F\u0440\u0430\u0432\u0438\u043B\u0430, \u0432\u043E\u0437\u0432\u0440\u0430\u0449\u0430\u044E\u0449\u0438\u0435 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F, \u043A\u043E\u0442\u043E\u0440\u044B\u0435 \u043C\u043E\u0433\u0443\u0442 \u043E\u0442\u043B\u0438\u0447\u0430\u0442\u044C\u0441\u044F, \u043A\u0430\u043A \u043F\u0440\u0430\u0432\u0438\u043B\u043E, \u0438\u0437-\u0437\u0430 \u043A\u044D\u0448\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F \u043D\u0430 \u0441\u0442\u043E\u0440\u043E\u043D\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430.",
			"zh-CN": "\u542F\u7528\u89C4\u5219\uFF1A\u8FD4\u56DE\u53EF\u80FD\u6709\u6240\u4E0D\u540C\u7684\u56FE\u50CF\uFF0C\u4E0D\u540C\u901A\u5E38\u7531\u4E8E\u670D\u52A1\u5668\u4FA7\u7F13\u5B58"
		},
		"Possibly broken images": {
			"_info": {
				"instances": [
					{
						"setting": "allow_possibly_broken",
						"field": "name"
					}
				]
			},
			"fr": "Images possiblement bris\u00E9e",
			"ko": "\uC190\uC0C1\uB420 \uC218 \uC788\uB294 \uC774\uBBF8\uC9C0",
			"pt-BR": "Imagens possivelmente quebradas",
			"ru": "\u0412\u043E\u0437\u043C\u043E\u0436\u043D\u043E, \u0441\u043B\u043E\u043C\u0430\u043D\u043D\u044B\u0435 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F",
			"zh-CN": "\u53EF\u80FD\u7834\u635F\u7684\u56FE\u50CF"
		},
		"Enables rules that return images that are possibly broken": {
			"_info": {
				"instances": [
					{
						"setting": "allow_possibly_broken",
						"field": "description"
					}
				]
			},
			"pt-BR": "Habilita regras que retornam imagens que podem estar quebradas",
			"ru": "\u0412\u043A\u043B\u044E\u0447\u0430\u0435\u0442 \u043F\u0440\u0430\u0432\u0438\u043B\u0430, \u0432\u043E\u0437\u0432\u0440\u0430\u0449\u0430\u044E\u0449\u0438\u0435 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F, \u043A\u043E\u0442\u043E\u0440\u044B\u0435 \u043C\u043E\u0433\u0443\u0442 \u0431\u044B\u0442\u044C \u043F\u043E\u043B\u043E\u043C\u0430\u043D\u044B.",
			"zh-CN": "\u542F\u7528\u89C4\u5219\uFF1A\u8FD4\u56DE\u53EF\u80FD\u5DF2\u635F\u574F\u7684\u56FE\u50CF"
		},
		"Possibly upscaled images": {
			"_info": {
				"instances": [
					{
						"setting": "allow_possibly_upscaled",
						"field": "name"
					}
				]
			},
			"pt-BR": "Imagens possivelmente ampliadas",
			"ru": "\u0412\u043E\u0437\u043C\u043E\u0436\u043D\u043E, \u0443\u0432\u0435\u043B\u0438\u0447\u0435\u043D\u043D\u044B\u0435 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F",
			"zh-CN": "\u53EF\u80FD\u6269\u589E\u5C3A\u5BF8\u7684\u56FE\u50CF"
		},
		"Enables rules that return images that are possibly upscaled": {
			"_info": {
				"instances": [
					{
						"setting": "allow_possibly_upscaled",
						"field": "description"
					}
				]
			},
			"pt-BR": "Habilita regras que retornam imagens que podem ter sido ampliadas",
			"ru": "\u0412\u043A\u043B\u044E\u0447\u0430\u0435\u0442 \u043F\u0440\u0430\u0432\u0438\u043B\u0430, \u0432\u043E\u0437\u0432\u0440\u0430\u0449\u0430\u044E\u0449\u0438\u0435 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F, \u043A\u043E\u0442\u043E\u0440\u044B\u0435 \u043C\u043E\u0433\u0443\u0442 \u0431\u044B\u0442\u044C \u0443\u0432\u0435\u043B\u0438\u0447\u0435\u043D\u044B.",
			"zh-CN": "\u542F\u7528\u89C4\u5219\uFF1A\u8FD4\u56DE\u53EF\u80FD\u5DF2\u6269\u589E\u5C3A\u5BF8\u7684\u56FE\u50CF"
		},
		"Uncropped images": {
			"_info": {
				"instances": [
					{
						"setting": "allow_uncropped",
						"field": "name"
					}
				]
			},
			"pt-BR": "Imagens n\u00E3o cortadas"
		},
		"Enables rules that return possibly undesirable uncropped images": {
			"_info": {
				"instances": [
					{
						"setting": "allow_uncropped",
						"field": "description"
					}
				]
			},
			"pt-BR": "Habilita regras que retornam imagens n\u00E3o cortadas possivelmente indesej\u00E1veis"
		},
		"Mobile wallpaper websites (returns the full version of the wallpaper image)": {
			"_info": {
				"instances": [
					{
						"setting": "allow_uncropped",
						"field": "example_websites[0]"
					}
				]
			},
			"pt-BR": "Sites de pap\u00E9is de parede para celular (retorna a vers\u00E3o completa da imagem do papel de parede)"
		},
		"Rules using 3rd-party websites": {
			"_info": {
				"instances": [
					{
						"setting": "allow_thirdparty",
						"field": "name"
					}
				]
			},
			"fr": "R\u00E8gles utilisant des sites 3rd-party",
			"ko": "\uC11C\uB4DC\uD30C\uD2F0 \uC0AC\uC774\uD2B8\uB97C \uC0AC\uC6A9\uD558\uB294 \uADDC\uCE59",
			"pt-BR": "Regras que utilizam sites de terceiros",
			"ru": "\u041F\u0440\u0430\u0432\u0438\u043B\u0430 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u0438\u044F \u0441\u0442\u043E\u0440\u043E\u043D\u043D\u0438\u0445 \u0441\u0430\u0439\u0442\u043E\u0432",
			"zh-CN": "\u4F7F\u7528\u7B2C\u4E09\u65B9\u7F51\u7AD9\u7684\u89C4\u5219"
		},
		"Enables rules that use 3rd-party websites": {
			"_info": {
				"instances": [
					{
						"setting": "allow_thirdparty",
						"field": "description"
					}
				]
			},
			"pt-BR": "Habilita regras que utilizam sites de terceiros",
			"ru": "\u0412\u043A\u043B\u044E\u0447\u0430\u0435\u0442 \u043F\u0440\u0430\u0432\u0438\u043B\u0430, \u043A\u043E\u0442\u043E\u0440\u044B\u0435 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u044E\u0442 \u0441\u0442\u043E\u0440\u043E\u043D\u043D\u0438\u0435 \u0441\u0430\u0439\u0442\u044B.",
			"zh-CN": "\u542F\u7528\u57FA\u4E8E\u7B2C\u4E09\u65B9\u7F51\u7AD9\u7684\u89C4\u5219"
		},
		"Newsen": {
			"_info": {
				"instances": [
					{
						"setting": "allow_thirdparty",
						"field": "example_websites[0]"
					}
				]
			},
			"ko": "\uB274\uC2A4\uC5D4",
			"pt-BR": "Newsen",
			"ru": "Newsen",
			"zh-CN": "Newsen"
		},
		"Rules using API calls": {
			"_info": {
				"instances": [
					{
						"setting": "allow_apicalls",
						"field": "name"
					}
				]
			},
			"pt-BR": "Regras que utilizam chamadas de API",
			"ru": "\u041F\u0440\u0430\u0432\u0438\u043B\u0430, \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u044E\u0449\u0438\u0435 \u0432\u044B\u0437\u043E\u0432\u044B API",
			"zh-CN": "\u57FA\u4E8E API \u8C03\u7528\u7684\u89C4\u5219"
		},
		"Enables rules that use API calls. Strongly recommended to keep this enabled": {
			"_info": {
				"instances": [
					{
						"setting": "allow_apicalls",
						"field": "description"
					}
				]
			},
			"pt-BR": "Habilita regras que utilizam chamadas de API. \u00C9 altamente recomend\u00E1vel manter esta op\u00E7\u00E3o ativada",
			"ru": "\u0412\u043A\u043B\u044E\u0447\u0430\u0435\u0442 \u043F\u0440\u0430\u0432\u0438\u043B\u0430, \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u044E\u0449\u0438\u0435 \u0432\u044B\u0437\u043E\u0432\u044B API. \u041D\u0430\u0441\u0442\u043E\u044F\u0442\u0435\u043B\u044C\u043D\u043E \u0440\u0435\u043A\u043E\u043C\u0435\u043D\u0434\u0443\u0435\u0442\u0441\u044F \u043E\u0441\u0442\u0430\u0432\u043B\u044F\u0442\u044C \u044D\u0442\u0443 \u0444\u0443\u043D\u043A\u0446\u0438\u044E \u0432\u043A\u043B\u044E\u0447\u0451\u043D\u043D\u043E\u0439.",
			"zh-CN": "\u542F\u7528\u57FA\u4E8E API \u8C03\u7528\u7684\u89C4\u5219\u3002\u5F3A\u70C8\u5EFA\u8BAE\u4FDD\u6301\u6B64\u9879\u542F\u7528"
		},
		"Instagram": {
			"_info": {
				"instances": [
					{
						"setting": "allow_apicalls",
						"field": "example_websites[0]"
					}
				]
			},
			"pt-BR": "Instagram",
			"ru": "Instagram",
			"zh-CN": "Instagram"
		},
		"Flickr": {
			"_info": {
				"instances": [
					{
						"setting": "redirect_force_page",
						"field": "example_websites[0]"
					},
					{
						"setting": "allow_apicalls",
						"field": "example_websites[1]"
					}
				]
			},
			"pt-BR": "Flickr",
			"ru": "Flickr",
			"zh-CN": "Flickr"
		},
		"...": {
			"_info": {
				"instances": [
					{
						"setting": "redirect_force_page",
						"field": "example_websites[2]"
					},
					{
						"setting": "allow_apicalls",
						"field": "example_websites[2]"
					}
				]
			},
			"pt-BR": "...",
			"ru": "...",
			"zh-CN": "..."
		},
		"Allow 3rd-party libraries": {
			"_info": {
				"instances": [
					{
						"setting": "allow_thirdparty_libs",
						"field": "name"
					}
				]
			},
			"pt-BR": "Permitir bibliotecas de terceiros",
			"ru": "\u0421\u0442\u043E\u0440\u043E\u043D\u043D\u0438\u0435 \u0431\u0438\u0431\u043B\u0438\u043E\u0442\u0435\u043A\u0438",
			"zh-CN": "\u5141\u8BB8\u7B2C\u4E09\u65B9\u5E93"
		},
		"Enables using 3rd-party libraries. This is both used in rules and as a prerequisite for certain functionality.": {
			"_info": {
				"instances": [
					{
						"setting": "allow_thirdparty_libs",
						"field": "description"
					}
				]
			},
			"pt-BR": "Habilita o uso de bibliotecas de terceiros. Isso \u00E9 usado tanto em regras quanto como um pr\u00E9-requisito para certas funcionalidades.",
			"ru": "\u041F\u043E\u0437\u0432\u043E\u043B\u044F\u0435\u0442 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u0441\u0442\u043E\u0440\u043E\u043D\u043D\u0438\u0435 \u0431\u0438\u0431\u043B\u0438\u043E\u0442\u0435\u043A\u0438. \u042D\u0442\u043E \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u0442\u0441\u044F \u043A\u0430\u043A \u0432 \u043F\u0440\u0430\u0432\u0438\u043B\u0430\u0445, \u0442\u0430\u043A \u0438 \u0432 \u043A\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043F\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0433\u043E \u0443\u0441\u043B\u043E\u0432\u0438\u044F \u0434\u043B\u044F \u043E\u043F\u0440\u0435\u0434\u0435\u043B\u0451\u043D\u043D\u043E\u0439 \u0444\u0443\u043D\u043A\u0446\u0438\u043E\u043D\u0430\u043B\u044C\u043D\u043E\u0441\u0442\u0438.",
			"zh-CN": "\u542F\u7528\u7B2C\u4E09\u65B9\u5E93\u7684\u8C03\u7528\u3002\u8FD9\u53EF\u80FD\u7528\u4E8E\u89C4\u5219\u548C\u67D0\u4E9B\u529F\u80FD\u7684\u5148\u51B3\u6761\u4EF6\u3002"
		},
		"Enables using 3rd-party libraries. This is both used in rules and as a prerequisite for certain functionality.\nThere is a possible (but unlikely) security risk for the userscript version.": {
			"_info": {
				"instances": [
					{
						"setting": "allow_thirdparty_libs",
						"field": "description_userscript"
					}
				]
			},
			"pt-BR": "Habilita o uso de bibliotecas de terceiros. Isso \u00E9 usado tanto em regras quanto como pr\u00E9-requisito para certas funcionalidades.\nH\u00E1 um risco de seguran\u00E7a poss\u00EDvel (mas improv\u00E1vel) para a vers\u00E3o userscript.",
			"ru": "\u041F\u043E\u0437\u0432\u043E\u043B\u044F\u0435\u0442 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u0441\u0442\u043E\u0440\u043E\u043D\u043D\u0438\u0435 \u0431\u0438\u0431\u043B\u0438\u043E\u0442\u0435\u043A\u0438. \u042D\u0442\u043E \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u0442\u0441\u044F \u043A\u0430\u043A \u0432 \u043F\u0440\u0430\u0432\u0438\u043B\u0430\u0445, \u0442\u0430\u043A \u0438 \u0432 \u043A\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043F\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0433\u043E \u0443\u0441\u043B\u043E\u0432\u0438\u044F \u0434\u043B\u044F \u043E\u043F\u0440\u0435\u0434\u0435\u043B\u0451\u043D\u043D\u043E\u0439 \u0444\u0443\u043D\u043A\u0446\u0438\u043E\u043D\u0430\u043B\u044C\u043D\u043E\u0441\u0442\u0438.\n\u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0432\u043E\u0437\u043C\u043E\u0436\u043D\u044B\u0439 (\u043D\u043E \u043C\u0430\u043B\u043E\u0432\u0435\u0440\u043E\u044F\u0442\u043D\u044B\u0439) \u0440\u0438\u0441\u043A \u0431\u0435\u0437\u043E\u043F\u0430\u0441\u043D\u043E\u0441\u0442\u0438 \u0434\u043B\u044F \u0432\u0435\u0440\u0441\u0438\u0438 \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u043E\u0433\u043E \u0441\u043A\u0440\u0438\u043F\u0442\u0430.",
			"zh-CN": "\u542F\u7528\u7B2C\u4E09\u65B9\u5E93\u7684\u8C03\u7528\u3002\u8FD9\u53EF\u80FD\u7528\u4E8E\u89C4\u5219\u548C\u67D0\u4E9B\u529F\u80FD\u7684\u5148\u51B3\u6761\u4EF6\u3002\n\u8FD9\u5BF9\u4E8E\u7528\u6237\u811A\u672C\u7248\u6765\u8BF4\uFF0C\u6709\u8F83\u4F4E\u7684\u6F5C\u5728\u7684\u5B89\u5168\u98CE\u9669\u3002"
		},
		"Sites using testcookie (slowAES)": {
			"_info": {
				"instances": [
					{
						"setting": "allow_thirdparty_libs",
						"field": "example_websites[0]"
					}
				]
			},
			"pt-BR": "Sites que usam testcookie (slowAES)",
			"ru": "\u0421\u0430\u0439\u0442\u044B, \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u044E\u0449\u0438\u0435 testcookie (slowAES)",
			"zh-CN": "\u4F7F\u7528 testcokie \u7684\u7F51\u7AD9\uFF08\u6162AES\uFF09"
		},
		"Rules executing 3rd-party code": {
			"_info": {
				"instances": [
					{
						"setting": "allow_thirdparty_code",
						"field": "name"
					}
				]
			},
			"pt-BR": "Regras que executam c\u00F3digo de terceiros",
			"ru": "\u041F\u0440\u0430\u0432\u0438\u043B\u0430 \u0432\u044B\u043F\u043E\u043B\u043D\u0435\u043D\u0438\u044F \u0441\u0442\u043E\u0440\u043E\u043D\u043D\u0435\u0433\u043E \u043A\u043E\u0434\u0430",
			"zh-CN": "\u6267\u884C\u7B2C\u4E09\u65B9\u4EE3\u7801\u7684\u89C4\u5219"
		},
		"Enables rules that execute arbitrary 3rd-party code stored on websites.": {
			"_info": {
				"instances": [
					{
						"setting": "allow_thirdparty_code",
						"field": "description"
					}
				]
			},
			"pt-BR": "Habilita regras que executam c\u00F3digo arbitr\u00E1rio de terceiros armazenado em sites.",
			"ru": "\u0412\u043A\u043B\u044E\u0447\u0430\u0435\u0442 \u043F\u0440\u0430\u0432\u0438\u043B\u0430, \u043A\u043E\u0442\u043E\u0440\u044B\u0435 \u0432\u044B\u043F\u043E\u043B\u043D\u044F\u044E\u0442 \u043F\u0440\u043E\u0438\u0437\u0432\u043E\u043B\u044C\u043D\u044B\u0439 \u0441\u0442\u043E\u0440\u043E\u043D\u043D\u0438\u0439 \u043A\u043E\u0434, \u0445\u0440\u0430\u043D\u044F\u0449\u0438\u0439\u0441\u044F \u043D\u0430 \u0441\u0430\u0439\u0442\u0430\u0445.",
			"zh-CN": "\u542F\u7528\u5C06\u6267\u884C\u5B58\u50A8\u5728\u7F51\u7AD9\u4E0A\u7684\u4EFB\u610F\u7B2C\u4E09\u65B9\u4EE3\u7801\u7684\u89C4\u5219\u3002"
		},
		"This could lead to security risks, please be careful when using this option!": {
			"_info": {
				"instances": [
					{
						"setting": "allow_thirdparty_code",
						"field": "warning.true"
					}
				]
			},
			"pt-BR": "Isso pode levar a riscos de seguran\u00E7a, por favor, tenha cuidado ao usar esta op\u00E7\u00E3o!",
			"ru": "\u042D\u0442\u043E \u043C\u043E\u0436\u0435\u0442 \u043F\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043A \u0443\u0433\u0440\u043E\u0437\u0430\u043C \u0431\u0435\u0437\u043E\u043F\u0430\u0441\u043D\u043E\u0441\u0442\u0438, \u0431\u0443\u0434\u044C\u0442\u0435 \u043E\u0441\u0442\u043E\u0440\u043E\u0436\u043D\u044B \u043F\u0440\u0438 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u0438\u0438 \u044D\u0442\u043E\u0433\u043E \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u0430!",
			"zh-CN": "\u8FD9\u53EF\u80FD\u5BFC\u81F4\u5B89\u5168\u98CE\u9669\uFF0C\u614E\u91CD\u4F7F\u7528\u6B64\u9009\u9879\uFF01"
		},
		"Rules using brute-force": {
			"_info": {
				"instances": [
					{
						"setting": "allow_bruteforce",
						"field": "name"
					}
				]
			},
			"pt-BR": "Regras que usam for\u00E7a bruta",
			"ru": "\u041F\u0440\u0430\u0432\u0438\u043B\u0430, \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u044E\u0449\u0438\u0435 \u0433\u0440\u0443\u0431\u0443\u044E \u0441\u0438\u043B\u0443",
			"zh-CN": "\u4F7F\u7528\u66B4\u529B\u7834\u89E3\u7684\u89C4\u5219"
		},
		"Enables rules that require using brute force (through binary search) to find the original image": {
			"_info": {
				"instances": [
					{
						"setting": "allow_bruteforce",
						"field": "description"
					}
				]
			},
			"pt-BR": "Habilita regras que exigem o uso de for\u00E7a bruta (atrav\u00E9s de busca bin\u00E1ria) para encontrar a imagem original",
			"ru": "\u0412\u043A\u043B\u044E\u0447\u0430\u0435\u0442 \u043F\u0440\u0430\u0432\u0438\u043B\u0430, \u0442\u0440\u0435\u0431\u0443\u044E\u0449\u0438\u0435 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u0438\u044F \u0433\u0440\u0443\u0431\u043E\u0439 \u0441\u0438\u043B\u044B (\u0447\u0435\u0440\u0435\u0437 \u0431\u0438\u043D\u0430\u0440\u043D\u044B\u0439 \u043F\u043E\u0438\u0441\u043A) \u0434\u043B\u044F \u043F\u043E\u0438\u0441\u043A\u0430 \u043E\u0440\u0438\u0433\u0438\u043D\u0430\u043B\u044C\u043D\u043E\u0433\u043E \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F.",
			"zh-CN": "\u542F\u7528\u9700\u8981\u51ED\u501F\u86EE\u529B\uFF08\u4E8C\u8FDB\u5236\u641C\u7D22\uFF09\u627E\u5230\u539F\u59CB\u56FE\u50CF\u7684\u89C4\u5219"
		},
		"Deezer": {
			"_info": {
				"instances": [
					{
						"setting": "allow_bruteforce",
						"field": "example_websites[0]"
					}
				]
			},
			"pt-BR": "Deezer",
			"ru": "Deezer",
			"zh-CN": "Deezer"
		},
		"Web Archive support": {
			"_info": {
				"instances": [
					{
						"setting": "allow_webarchive",
						"field": "name"
					}
				]
			},
			"pt-BR": "Suporte ao Web Archive"
		},
		"Allows rules to be run under archive.org's Wayback Machine.": {
			"_info": {
				"instances": [
					{
						"setting": "allow_webarchive",
						"field": "description"
					}
				]
			},
			"pt-BR": "Permite que as regras sejam executadas na Wayback Machine do archive.org."
		},
		"Use browser cookies": {
			"_info": {
				"instances": [
					{
						"setting": "browser_cookies",
						"field": "name"
					}
				]
			},
			"pt-BR": "Usar cookies do navegador",
			"ru": "\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u043A\u0443\u043A\u0438 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430",
			"zh-CN": "\u4F7F\u7528\u6D4F\u89C8\u5668 Cookie"
		},
		"Uses the browser's cookies for API calls in order to access otherwise private data": {
			"_info": {
				"instances": [
					{
						"setting": "browser_cookies",
						"field": "description"
					}
				]
			},
			"pt-BR": "Utiliza os cookies do navegador para chamadas de API a fim de acessar dados que, de outra forma, seriam privados",
			"ru": "\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u0442 \u0444\u0430\u0439\u043B\u044B cookie \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430 \u0434\u043B\u044F \u0432\u044B\u0437\u043E\u0432\u043E\u0432 API, \u0447\u0442\u043E\u0431\u044B \u043F\u043E\u043B\u0443\u0447\u0438\u0442\u044C \u0434\u043E\u0441\u0442\u0443\u043F \u043A \u043A\u043E\u043D\u0444\u0438\u0434\u0435\u043D\u0446\u0438\u0430\u043B\u044C\u043D\u044B\u043C \u0434\u0430\u043D\u043D\u044B\u043C.",
			"zh-CN": "\u5141\u8BB8 API \u8C03\u7528\u4F7F\u7528\u6D4F\u89C8\u5668\u7684 Cookie \u6765\u8BBF\u95EE\u975E\u516C\u5F00\u6570\u636E"
		},
		"Private Flickr images": {
			"_info": {
				"instances": [
					{
						"setting": "browser_cookies",
						"field": "example_websites[0]"
					}
				]
			},
			"pt-BR": "Imagens privadas do Flickr",
			"ru": "\u041F\u0440\u0438\u0432\u0430\u0442\u043D\u044B\u0435 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F Flickr",
			"zh-CN": "\u79C1\u4EBA Flickr \u56FE\u50CF"
		},
		"DeviantART: Prefer size over original": {
			"_info": {
				"instances": [
					{
						"setting": "deviantart_prefer_size",
						"field": "name"
					}
				]
			},
			"pt-BR": "DeviantART: Preferir tamanho em vez de original",
			"ru": "DeviantART: \u041F\u0440\u0435\u0434\u043F\u043E\u0447\u0438\u0442\u0430\u0442\u044C \u0440\u0430\u0437\u043C\u0435\u0440 \u043E\u0440\u0438\u0433\u0438\u043D\u0430\u043B\u0443",
			"zh-CN": "DeviantART: \u5C3A\u5BF8\u6BD4\u539F\u7248\u66F4\u91CD\u8981"
		},
		"Prefers a larger (but not upscaled) thumbnail image over a smaller original animated image": {
			"_info": {
				"instances": [
					{
						"setting": "deviantart_prefer_size",
						"field": "description"
					}
				]
			},
			"pt-BR": "Prefere uma imagem em miniatura maior (mas n\u00E3o ampliada) em vez de uma imagem animada original menor",
			"ru": "\u041F\u0440\u0435\u0434\u043F\u043E\u0447\u0438\u0442\u0430\u0435\u0442 \u0431\u043E\u043B\u044C\u0448\u0435 (\u043D\u043E \u043D\u0435 \u0443\u0432\u0435\u043B\u0438\u0447\u0435\u043D\u043D\u043E\u0435) \u043C\u0438\u043D\u0438\u0430\u0442\u044E\u0440\u043D\u043E\u0435 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 \u043C\u0435\u043D\u044C\u0448\u0435\u043C\u0443 \u043E\u0440\u0438\u0433\u0438\u043D\u0430\u043B\u044C\u043D\u043E\u043C\u0443 \u0430\u043D\u0438\u043C\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u043E\u043C\u0443 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044E.",
			"zh-CN": "\u504F\u597D\u5C3A\u5BF8\u8F83\u5927\uFF08\u4F46\u975E\u6269\u589E\uFF09\u4F46\u975E\u539F\u59CB\u5C3A\u5BF8\u7684\u7F29\u7565\u56FE\u56FE\u50CF\uFF0C\u800C\u4E0D\u662F\u539F\u59CB\u5C3A\u5BF8\u4F46\u5C3A\u5BF8\u8F83\u5C0F\u7684\u52A8\u753B\u56FE\u50CF"
		},
		"DeviantART: Use download links": {
			"_info": {
				"instances": [
					{
						"setting": "deviantart_support_download",
						"field": "name"
					}
				]
			},
			"pt-BR": "DeviantART: Usar links de download",
			"ru": "DeviantART: \u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u0441\u0441\u044B\u043B\u043A\u0438 \u0434\u043B\u044F \u0441\u043A\u0430\u0447\u0438\u0432\u0430\u043D\u0438\u044F",
			"zh-CN": "DeviantART: \u4F7F\u7528\u4E0B\u8F7D\u94FE\u63A5"
		},
		"Prefers using the download link (if available) by default. Note that this only works if you're logged in to DeviantART": {
			"_info": {
				"instances": [
					{
						"setting": "deviantart_support_download",
						"field": "description"
					}
				]
			},
			"pt-BR": "Prefere usar o link de download (se dispon\u00EDvel) por padr\u00E3o. Observe que isso s\u00F3 funciona se voc\u00EA estiver conectado ao DeviantART",
			"ru": "\u041F\u0440\u0435\u0434\u043F\u043E\u0447\u0438\u0442\u0430\u0435\u0442 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u0441\u0441\u044B\u043B\u043A\u0443 \u0434\u043B\u044F \u0441\u043A\u0430\u0447\u0438\u0432\u0430\u043D\u0438\u044F (\u0435\u0441\u043B\u0438 \u043E\u043D\u0430 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0430) \u043F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E. \u041E\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043D\u0438\u043C\u0430\u043D\u0438\u0435, \u0447\u0442\u043E \u044D\u0442\u043E \u0440\u0430\u0431\u043E\u0442\u0430\u0435\u0442, \u0442\u043E\u043B\u044C\u043A\u043E \u0435\u0441\u043B\u0438 \u0432\u044B \u0432\u043E\u0448\u043B\u0438 \u0432 \u0441\u0432\u043E\u044E \u0443\u0447\u0451\u0442\u043D\u0443\u044E \u0437\u0430\u043F\u0438\u0441\u044C DeviantART.",
			"zh-CN": "\u504F\u597D\u9ED8\u8BA4\u4F7F\u7528\u4E0B\u8F7D\u94FE\u63A5\uFF08\u5982\u679C\u53EF\u7528\uFF09\u3002\u6CE8\u610F\uFF0C\u4EC5\u5728\u767B\u5F55 DeviantART \u540E\u6709\u6548"
		},
		"E-Hentai: Use full image": {
			"_info": {
				"instances": [
					{
						"setting": "ehentai_full_image",
						"field": "name"
					}
				]
			},
			"pt-BR": "E-Hentai: Usar imagem completa",
			"ru": "E-Hentai: \u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u043F\u043E\u043B\u043D\u043E\u0435 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435",
			"zh-CN": "E-Hentai: \u4F7F\u7528\u5B8C\u6574\u56FE\u50CF"
		},
		"Prefers using full/original images if available (logged in). This is more likely to get you rate limited": {
			"_info": {
				"instances": [
					{
						"setting": "ehentai_full_image",
						"field": "description"
					}
				]
			},
			"pt-BR": "Prefere usar imagens completas/originais, se dispon\u00EDveis (conectado). Isso tem mais chances de te deixar com limite de taxa",
			"ru": "\u041F\u0440\u0435\u0434\u043F\u043E\u0447\u0438\u0442\u0430\u0435\u0442 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u043F\u043E\u043B\u043D\u044B\u0435/\u043E\u0440\u0438\u0433\u0438\u043D\u0430\u043B\u044C\u043D\u044B\u0435 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F, \u0435\u0441\u043B\u0438 \u0442\u0430\u043A\u043E\u0432\u044B\u0435 \u0438\u043C\u0435\u044E\u0442\u0441\u044F. (\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044F \u0432\u0445\u043E\u0434). \u0421\u043A\u043E\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043E, \u044D\u0442\u043E \u043E\u0433\u0440\u0430\u043D\u0438\u0447\u0438\u0442 \u0432\u0430\u0448\u0443 \u0441\u043A\u043E\u0440\u043E\u0441\u0442\u044C.",
			"zh-CN": "\u504F\u597D\u4F7F\u7528\u5168\u5C3A\u5BF8\u539F\u7248\u56FE\u50CF\u3002\u9700\u8981\u5DF2\u767B\u5F55\u3002\u4F7F\u7528\u5B83\u5C06\u66F4\u5BB9\u6613\u906D\u9047\u901F\u7387\u9650\u5236"
		},
		"Imgur: Use original filename": {
			"_info": {
				"instances": [
					{
						"setting": "imgur_filename",
						"field": "name"
					}
				]
			},
			"pt-BR": "Imgur: Usar nome de arquivo original",
			"ru": "Imgur: \u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u043E\u0440\u0438\u0433\u0438\u043D\u0430\u043B\u044C\u043D\u043E\u0435 \u0438\u043C\u044F \u0444\u0430\u0439\u043B\u0430",
			"zh-CN": "Imgur: \u4F7F\u7528\u539F\u59CB\u6587\u4EF6\u540D"
		},
		"If the original filename (the one used to upload the image) is found, use it instead of the image ID": {
			"_info": {
				"instances": [
					{
						"setting": "imgur_filename",
						"field": "description"
					}
				]
			},
			"pt-BR": "Se o nome de arquivo original (aquele usado para enviar a imagem) for encontrado, use-o em vez do ID da imagem",
			"ru": "\u0415\u0441\u043B\u0438 \u043D\u0430\u0439\u0434\u0435\u043D\u043E \u043E\u0440\u0438\u0433\u0438\u043D\u0430\u043B\u044C\u043D\u043E\u0435 \u0438\u043C\u044F \u0444\u0430\u0439\u043B\u0430 (\u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u043C\u043E\u0435 \u0434\u043B\u044F \u0441\u043A\u0430\u0447\u0438\u0432\u0430\u043D\u0438\u044F \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F), \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0439\u0442\u0435 \u0435\u0433\u043E \u0432\u043C\u0435\u0441\u0442\u043E \u0438\u0434\u0435\u043D\u0442\u0438\u0444\u0438\u043A\u0430\u0442\u043E\u0440\u0430 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F.",
			"zh-CN": "\u5982\u679C\u627E\u5230\u539F\u59CB\u6587\u4EF6\u540D\uFF08\u4E0A\u4F20\u56FE\u50CF\u65F6\u7684\u6587\u4EF6\u540D\uFF09\uFF0C\u4F7F\u7528\u5B83\u4EE3\u66FF\u56FE\u50CF ID"
		},
		"Imgur: Use source image": {
			"_info": {
				"instances": [
					{
						"setting": "imgur_source",
						"field": "name"
					}
				]
			},
			"pt-BR": "Imgur: Usar imagem de origem",
			"ru": "Imgur: \u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 \u0438\u0441\u0442\u043E\u0447\u043D\u0438\u043A\u0430",
			"zh-CN": "Imgur: \u4F7F\u7528\u6E90\u56FE\u50CF"
		},
		"If a source image is found for Imgur, try using it instead. Only works for old-style Imgur webpages (set `postpagebeta=0; postpagebetalogged=0` as cookies)": {
			"_info": {
				"instances": [
					{
						"setting": "imgur_source",
						"field": "description"
					}
				]
			},
			"pt-BR": "Se uma imagem de origem for encontrada para o Imgur, tente us\u00E1-la. Funciona apenas para p\u00E1ginas antigas do Imgur (defina `postpagebeta=0; postpagebetalogged=0` como cookies)",
			"ru": "\u0415\u0441\u043B\u0438 \u0434\u043B\u044F Imgur \u043D\u0430\u0439\u0434\u0435\u043D\u043E \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 \u0438\u0441\u0442\u043E\u0447\u043D\u0438\u043A\u0430, \u043F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u0435\u0433\u043E \u0432\u043C\u0435\u0441\u0442\u043E \u044D\u0442\u043E\u0433\u043E. \u0420\u0430\u0431\u043E\u0442\u0430\u0435\u0442 \u0442\u043E\u043B\u044C\u043A\u043E \u0434\u043B\u044F \u0432\u0435\u0431-\u0441\u0442\u0440\u0430\u043D\u0438\u0446 Imgur \u0441\u0442\u0430\u0440\u043E\u0433\u043E \u0441\u0442\u0438\u043B\u044F (\u0443\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u0435 `postpagebeta=0; postpagebetalogged=0` \u043A\u0430\u043A cookie).",
			"zh-CN": "\u5982\u679C\u627E\u5230 Imgur \u7684\u6E90\u56FE\u50CF\uFF0C\u5C1D\u8BD5\u4F7F\u7528\u5B83\u3002\u4EC5\u9002\u7528\u4E8E\u65E7\u7248 Imgur \u7F51\u9875\uFF08\u8BBE\u7F6E Cookie `postpagebeta=0; postpagebetalogged=0`\uFF09"
		},
		"Instagram: Use native API": {
			"_info": {
				"instances": [
					{
						"setting": "instagram_use_app_api",
						"field": "name"
					}
				]
			},
			"pt-BR": "Instagram: Usar API nativa",
			"ru": "Instagram: \u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u0440\u043E\u0434\u043D\u043E\u0439 API",
			"zh-CN": "Instagram: \u4F7F\u7528\u539F\u751F API"
		},
		"Uses Instagram's native API if possible, requires you to be logged into Instagram. This usually allows for higher resolution images (1440x*) to be returned.": {
			"_info": {
				"instances": [
					{
						"setting": "instagram_use_app_api",
						"field": "description"
					}
				]
			},
			"pt-BR": "Usa a API nativa do Instagram se poss\u00EDvel, requer que voc\u00EA esteja logado no Instagram. Geralmente permite que imagens de resolu\u00E7\u00E3o mais alta (1440x*) sejam retornadas.",
			"ru": "\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u0442 \u0440\u043E\u0434\u043D\u043E\u0439 API Instagram, \u0435\u0441\u043B\u0438 \u044D\u0442\u043E \u0432\u043E\u0437\u043C\u043E\u0436\u043D\u043E, \u0442\u0440\u0435\u0431\u0443\u0435\u0442, \u0447\u0442\u043E\u0431\u044B \u0432\u044B \u0432\u043E\u0448\u043B\u0438 \u0432 Instagram. \u041E\u0431\u044B\u0447\u043D\u043E \u044D\u0442\u043E \u043F\u043E\u0437\u0432\u043E\u043B\u044F\u0435\u0442 \u0432\u043E\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044C \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F \u0441 \u0431\u043E\u043B\u0435\u0435 \u0432\u044B\u0441\u043E\u043A\u0438\u043C \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043D\u0438\u0435\u043C (1440x*).",
			"zh-CN": "\u5C3D\u53EF\u80FD\u4F7F\u7528 Instagram \u7684\u539F\u751F API\uFF0C\u8FD9\u9700\u8981\u60A8\u5DF2\u767B\u5F55 Instagram\u3002\u901A\u5E38\u80FD\u8FD4\u56DE\u66F4\u9AD8\u5206\u8FA8\u7387\u7684\u56FE\u50CF\uFF081440x*\uFF09\u3002"
		},
		"Instagram: Don't use web API": {
			"_info": {
				"instances": [
					{
						"setting": "instagram_dont_use_web",
						"field": "name"
					}
				]
			},
			"pt-BR": "Instagram: N\u00E3o usar API web",
			"ru": "Instagram: \u0411\u0435\u0437 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u0438\u044F \u0432\u0435\u0431-API",
			"zh-CN": "Instagram: \u4E0D\u4F7F\u7528 Web API"
		},
		"Avoids using Instagram's web API if possible, which increases performance, but will occasionally sacrifice quality for videos": {
			"_info": {
				"instances": [
					{
						"setting": "instagram_dont_use_web",
						"field": "description"
					}
				]
			},
			"pt-BR": "Evita usar a API web do Instagram, se poss\u00EDvel, o que aumenta o desempenho, mas ocasionalmente sacrifica a qualidade dos v\u00EDdeos",
			"ru": "\u0418\u0437\u0431\u0435\u0433\u0430\u0435\u0442 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u0438\u044F \u0432\u0435\u0431-API Instagram, \u0435\u0441\u043B\u0438 \u044D\u0442\u043E \u0432\u043E\u0437\u043C\u043E\u0436\u043D\u043E, \u0447\u0442\u043E \u043F\u043E\u0432\u044B\u0448\u0430\u0435\u0442 \u043F\u0440\u043E\u0438\u0437\u0432\u043E\u0434\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C, \u043D\u043E \u0438\u043D\u043E\u0433\u0434\u0430 \u0436\u0435\u0440\u0442\u0432\u0443\u0435\u0442 \u043A\u0430\u0447\u0435\u0441\u0442\u0432\u043E\u043C \u0432\u0438\u0434\u0435\u043E.",
			"zh-CN": "\u5C3D\u53EF\u80FD\u4E0D\u4F7F\u7528 Instagram \u7684 Web API\uFF0C\u8FD9\u53EF\u4EE5\u63D0\u5347\u6027\u80FD\uFF0C\u4F46\u5076\u5C14\u4F1A\u727A\u7272\u89C6\u9891\u54C1\u8D28"
		},
		"Instagram: Prefer quality over resolution": {
			"_info": {
				"instances": [
					{
						"setting": "instagram_prefer_video_quality",
						"field": "name"
					}
				]
			},
			"pt-BR": "Instagram: Preferir qualidade \u00E0 resolu\u00E7\u00E3o",
			"ru": "Instagram: \u041F\u0440\u0435\u0434\u043F\u043E\u0447\u0438\u0442\u0430\u0442\u044C \u043A\u0430\u0447\u0435\u0441\u0442\u0432\u043E \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043D\u0438\u044E",
			"zh-CN": "Instagram: \u504F\u597D\u9AD8\u8D28\u91CF\u800C\u4E0D\u662F\u5206\u8FA8\u7387"
		},
		"Prefers lower resolution videos that use a higher bitrate over higher resolution images. This adds a slight performance cost as it needs to fetch headers for multiple videos": {
			"_info": {
				"instances": [
					{
						"setting": "instagram_prefer_video_quality",
						"field": "description"
					}
				]
			},
			"pt-BR": "Prefere v\u00EDdeos de resolu\u00E7\u00E3o mais baixa que usam uma taxa de bits mais alta em vez de imagens de resolu\u00E7\u00E3o mais alta. Isso adiciona um pequeno custo de desempenho, pois precisa buscar cabe\u00E7alhos para v\u00E1rios v\u00EDdeos",
			"ru": "\u041F\u0440\u0435\u0434\u043F\u043E\u0447\u0438\u0442\u0430\u0435\u0442 \u0432\u0438\u0434\u0435\u043E \u0441 \u0431\u043E\u043B\u0435\u0435 \u043D\u0438\u0437\u043A\u0438\u043C \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043D\u0438\u0435\u043C, \u043A\u043E\u0442\u043E\u0440\u044B\u0435 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u044E\u0442 \u0431\u043E\u043B\u0435\u0435 \u0432\u044B\u0441\u043E\u043A\u0438\u0439 \u0431\u0438\u0442\u0440\u0435\u0439\u0442 \u043F\u043E \u0441\u0440\u0430\u0432\u043D\u0435\u043D\u0438\u044E \u0441 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F\u043C\u0438 \u0441 \u0431\u043E\u043B\u0435\u0435 \u0432\u044B\u0441\u043E\u043A\u0438\u043C \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043D\u0438\u0435\u043C. \u042D\u0442\u043E \u0434\u043E\u0431\u0430\u0432\u043B\u044F\u0435\u0442 \u043D\u0435\u0431\u043E\u043B\u044C\u0448\u0438\u0435 \u0437\u0430\u0442\u0440\u0430\u0442\u044B \u043D\u0430 \u043F\u0440\u043E\u0438\u0437\u0432\u043E\u0434\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C, \u0442\u0430\u043A \u043A\u0430\u043A \u044D\u0442\u043E \u043D\u0443\u0436\u0434\u0430\u0435\u0442\u0441\u044F \u0432 \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u0438\u0438 \u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043A\u043E\u0432 \u0434\u043B\u044F \u043D\u0435\u0441\u043A\u043E\u043B\u044C\u043A\u0438\u0445 \u0432\u0438\u0434\u0435\u043E.",
			"zh-CN": "\u504F\u597D\u9AD8\u6BD4\u7279\u7387\u7684\u4F4E\u5206\u8FA8\u7387\u89C6\u9891\uFF0C\u800C\u4E0D\u662F\u9AD8\u5206\u8FA8\u7387\u56FE\u50CF\u3002\u8FD9\u8F7B\u5FAE\u8D44\u6E90\u6D88\u8017\uFF0C\u56E0\u4E3A\u9700\u8981\u83B7\u53D6\u591A\u4E2A\u89C6\u9891\u7684\u5934\u90E8"
		},
		"Instagram: Use albums for post thumbnails": {
			"_info": {
				"instances": [
					{
						"setting": "instagram_gallery_postlink",
						"field": "name"
					}
				]
			},
			"pt-BR": "Instagram: Usar \u00E1lbuns para miniaturas de posts",
			"ru": "Instagram: \u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u0430\u043B\u044C\u0431\u043E\u043C\u044B \u0434\u043B\u044F \u043C\u0438\u043D\u0438\u0430\u0442\u044E\u0440 \u043F\u043E\u0441\u0442\u043E\u0432",
			"zh-CN": "Instagram: \u4E3A\u5E16\u5B50\u7F29\u7565\u56FE\u4F7F\u7528\u76F8\u518C"
		},
		"Queries Instagram for albums when using the popup on a post thumbnail": {
			"_info": {
				"instances": [
					{
						"setting": "instagram_gallery_postlink",
						"field": "description"
					}
				]
			},
			"pt-BR": "Consulta o Instagram por \u00E1lbuns ao usar o popup em uma miniatura de post",
			"ru": "\u0417\u0430\u043F\u0440\u043E\u0441\u044B \u043A Instagram \u0434\u043B\u044F \u0430\u043B\u044C\u0431\u043E\u043C\u043E\u0432 \u043F\u0440\u0438 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u0438\u0438 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430 \u043D\u0430 \u043C\u0438\u043D\u0438\u0430\u0442\u044E\u0440\u0435 \u043F\u043E\u0441\u0442\u0430.",
			"zh-CN": "\u4E3A\u5E16\u5B50\u7F29\u7565\u56FE\u4F7F\u7528\u5F39\u7A97\u65F6\u67E5\u8BE2 Instagram \u76F8\u518C"
		},
		"Snapchat: Use original media without captions": {
			"_info": {
				"instances": [
					{
						"setting": "snapchat_orig_media",
						"field": "name"
					}
				]
			},
			"pt-BR": "Snapchat: Usar m\u00EDdia original sem legendas",
			"ru": "Snapchat: \u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u043E\u0440\u0438\u0433\u0438\u043D\u0430\u043B\u044C\u043D\u044B\u0435 \u043C\u0435\u0434\u0438\u0430 \u0431\u0435\u0437 \u043F\u043E\u0434\u043F\u0438\u0441\u0435\u0439",
			"zh-CN": "Snapchat: \u4F7F\u7528\u6CA1\u6709\u6807\u9898\u7684\u539F\u59CB\u5A92\u4F53"
		},
		"Prefers using original media instead of media with captions and tags overlayed": {
			"_info": {
				"instances": [
					{
						"setting": "snapchat_orig_media",
						"field": "description"
					}
				]
			},
			"pt-BR": "Prefere usar a m\u00EDdia original em vez de m\u00EDdia com legendas e tags sobrepostas",
			"ru": "\u041F\u0440\u0435\u0434\u043F\u043E\u0447\u0438\u0442\u0430\u0435\u0442 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u043E\u0440\u0438\u0433\u0438\u043D\u0430\u043B\u044C\u043D\u044B\u0435 \u043C\u0435\u0434\u0438\u0430 \u0432\u043C\u0435\u0441\u0442\u043E \u043C\u0435\u0434\u0438\u0430 \u0441 \u043D\u0430\u043B\u043E\u0436\u0435\u043D\u043D\u044B\u043C\u0438 \u043F\u043E\u0434\u043F\u0438\u0441\u044F\u043C\u0438 \u0438 \u0442\u0435\u0433\u0430\u043C\u0438.",
			"zh-CN": "\u503E\u5411\u4E8E\u4F7F\u7528\u539F\u59CB\u5A92\u4F53\uFF0C\u800C\u4E0D\u662F\u6709\u6807\u9898\u548C\u6807\u7B7E\u8986\u76D6\u7684\u5A92\u4F53"
		},
		"Teddit: Use Reddit for media": {
			"_info": {
				"instances": [
					{
						"setting": "teddit_redirect_reddit",
						"field": "name"
					}
				]
			},
			"pt-BR": "Teddit: Usar Reddit para m\u00EDdia"
		},
		"Redirects media stored on Teddit to Reddit's servers. Disabling this may prevent finding original images because Teddit's image servers will only cache images fetched from posts, which are deleted after a few minutes.": {
			"_info": {
				"instances": [
					{
						"setting": "teddit_redirect_reddit",
						"field": "description"
					}
				]
			},
			"pt-BR": "Redireciona m\u00EDdias armazenadas no Teddit para os servidores do Reddit. Desativar isso pode impedir a localiza\u00E7\u00E3o de imagens originais porque os servidores de imagem do Teddit armazenar\u00E3o em cache apenas imagens obtidas de posts, que s\u00E3o exclu\u00EDdas ap\u00F3s alguns minutos."
		},
		"TikTok: Use app API": {
			"_info": {
				"instances": [
					{
						"setting": "tiktok_app_api",
						"field": "name"
					}
				]
			},
			"pt-BR": "TikTok: Usar API do aplicativo"
		},
		"Uses TikTok's app API to find video information.": {
			"_info": {
				"instances": [
					{
						"setting": "tiktok_app_api",
						"field": "description"
					}
				]
			},
			"pt-BR": "Usa a API do aplicativo TikTok para encontrar informa\u00E7\u00F5es de v\u00EDdeo."
		},
		"TikTok: Don't use watermarked videos": {
			"_info": {
				"instances": [
					{
						"setting": "tiktok_no_watermarks",
						"field": "name"
					}
				]
			},
			"pt-BR": "TikTok: N\u00E3o usar v\u00EDdeos com marca d'\u00E1gua",
			"ru": "TikTok: \u041D\u0435 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u0432\u0438\u0434\u0435\u043E \u0441 \u0432\u043E\u0434\u044F\u043D\u044B\u043C\u0438 \u0437\u043D\u0430\u043A\u0430\u043C\u0438",
			"zh-CN": "TikTok: \u4E0D\u4F7F\u7528\u5E26\u6C34\u5370\u7684\u89C6\u9891"
		},
		"Uses non-watermarked videos for TikTok if possible. This will introduce an extra delay when loading the video as two extra requests need to be performed. It will also fail for any videos uploaded after ~late July 2020": {
			"_info": {
				"instances": [
					{
						"setting": "tiktok_no_watermarks",
						"field": "description"
					}
				]
			},
			"pt-BR": "Usa v\u00EDdeos sem marca d'\u00E1gua para o TikTok, se poss\u00EDvel. Isso introduzir\u00E1 um atraso extra ao carregar o v\u00EDdeo, pois duas solicita\u00E7\u00F5es extras precisam ser realizadas. Tamb\u00E9m falhar\u00E1 para qualquer v\u00EDdeo enviado ap\u00F3s o final de julho de 2020",
			"ru": "\u041F\u043E \u0432\u043E\u0437\u043C\u043E\u0436\u043D\u043E\u0441\u0442\u0438 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u0442 \u0432\u0438\u0434\u0435\u043E \u0431\u0435\u0437 \u0432\u043E\u0434\u044F\u043D\u044B\u0445 \u0437\u043D\u0430\u043A\u043E\u0432 \u0434\u043B\u044F TikTok. \u042D\u0442\u043E \u043F\u0440\u0438\u0432\u0435\u0434\u0451\u0442 \u043A \u0434\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0439 \u0437\u0430\u0434\u0435\u0440\u0436\u043A\u0435 \u043F\u0440\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0435 \u0432\u0438\u0434\u0435\u043E, \u0442\u0430\u043A \u043A\u0430\u043A \u043D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u043E \u0432\u044B\u043F\u043E\u043B\u043D\u0438\u0442\u044C \u0434\u0432\u0430 \u0434\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0445 \u0437\u0430\u043F\u0440\u043E\u0441\u0430. \u042D\u0442\u043E \u043D\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043E\u0442\u0430\u0442\u044C \u0434\u043B\u044F \u043B\u044E\u0431\u044B\u0445 \u0432\u0438\u0434\u0435\u043E, \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043D\u043D\u044B\u0445 \u043F\u043E\u0441\u043B\u0435 ~\u043A\u043E\u043D\u0446\u0430 \u0438\u044E\u043B\u044F 2020 \u0433\u043E\u0434\u0430.",
			"zh-CN": "\u5982\u679C\u53EF\u80FD\uFF0C\u4E3A TikTok \u4F7F\u7528\u65E0\u6C34\u5370\u89C6\u9891\u3002\u52A0\u8F7D\u89C6\u9891\u65F6\u9700\u6267\u884C\u4E24\u4E2A\u989D\u5916\u7684\u8BF7\u6C42\uFF0C\u8FD9\u5C06\u589E\u52A0\u5EF6\u8FDF\u3002\u5BF92020\u5E747\u6708\u5DE6\u53F3\u4E4B\u540E\u4E0A\u4F20\u7684\u4EFB\u4F55\u89C6\u9891\u4E0D\u8D77\u4F5C\u7528"
		},
		"TikTok: 3rd-party watermark removal": {
			"_info": {
				"instances": [
					{
						"setting": "tiktok_thirdparty",
						"field": "name"
					}
				]
			},
			"pt-BR": "TikTok: Remo\u00E7\u00E3o de marca d'\u00E1gua por terceiros",
			"ru": "TikTok: \u0423\u0434\u0430\u043B\u0435\u043D\u0438\u0435 \u0432\u043E\u0434\u044F\u043D\u044B\u0445 \u0437\u043D\u0430\u043A\u043E\u0432 \u0442\u0440\u0435\u0442\u044C\u0435\u0439 \u0441\u0442\u043E\u0440\u043E\u043D\u043E\u0439",
			"zh-CN": "TikTok: \u7B2C\u4E09\u65B9\u6C34\u5370\u53BB\u9664"
		},
		"Uses a 3rd-party watermark removal site for TikTok.\nI do not endorse any of the sites supported. They may log your IP address and videos you submit. Use this option with caution.\n`LQ` = Low quality, `PL` = Public log": {
			"_info": {
				"instances": [
					{
						"setting": "tiktok_thirdparty",
						"field": "description"
					}
				]
			},
			"pt-BR": "Usa um site de terceiros para remo\u00E7\u00E3o de marca d'\u00E1gua do TikTok.\nN\u00E3o endosso nenhum dos sites suportados. Eles podem registrar seu endere\u00E7o IP e os v\u00EDdeos que voc\u00EA enviar. Use esta op\u00E7\u00E3o com cautela.\n`LQ` = Baixa qualidade, `PL` = Registro p\u00FAblico",
			"ru": "\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u0442 \u0441\u0442\u043E\u0440\u043E\u043D\u043D\u0438\u0439 \u0441\u0430\u0439\u0442 \u0443\u0434\u0430\u043B\u0435\u043D\u0438\u044F \u0432\u043E\u0434\u044F\u043D\u044B\u0445 \u0437\u043D\u0430\u043A\u043E\u0432 \u0434\u043B\u044F TikTok.\n\u042F \u043D\u0435 \u043E\u0434\u043E\u0431\u0440\u044F\u044E \u043D\u0438 \u043E\u0434\u0438\u043D \u0438\u0437 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043C\u044B\u0445 \u0441\u0430\u0439\u0442\u043E\u0432. \u041E\u043D\u0438 \u043C\u043E\u0433\u0443\u0442 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0432\u0430\u0448 IP-\u0430\u0434\u0440\u0435\u0441 \u0438 \u0432\u0438\u0434\u0435\u043E, \u043A\u043E\u0442\u043E\u0440\u044B\u0435 \u0432\u044B \u043E\u0442\u043F\u0440\u0430\u0432\u043B\u044F\u0435\u0442\u0435. \u0418\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0439\u0442\u0435 \u044D\u0442\u043E\u0442 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440 \u0441 \u043E\u0441\u0442\u043E\u0440\u043E\u0436\u043D\u043E\u0441\u0442\u044C\u044E.\n`\u041D\u041A` = \u041D\u0438\u0437\u043A\u043E\u0435 \u043A\u0430\u0447\u0435\u0441\u0442\u0432\u043E, `\u041F\u041B` = \u041F\u0443\u0431\u043B\u0438\u0447\u043D\u044B\u0439 \u043B\u043E\u0433",
			"zh-CN": "\u4F7F\u7528\u4E00\u4E2A\u9002\u7528\u4E8E TikTok \u7684\u7B2C\u4E09\u65B9\u6C34\u5370\u53BB\u9664\u7F51\u7AD9\u3002\n\u8FD9\u4E0D\u4EE3\u8868\u5BF9\u8BE5\u7F51\u7AD9\u7684\u8BA4\u53EF\u3002\u8BE5\u7F51\u7AD9\u53EF\u80FD\u8BB0\u5F55\u60A8\u7684 IP \u5730\u5740\u548C\u63D0\u4EA4\u7684\u89C6\u9891\u3002\u8C28\u614E\u4F7F\u7528\u3002\n`LQ` = \u4F4E\u54C1\u8D28\uFF0C`PL` = \u516C\u4F17\u65E5\u5FD7"
		},
		"(none)": {
			"_info": {
				"instances": [
					{
						"setting": "tiktok_thirdparty",
						"field": "options.null.name"
					}
				]
			},
			"pt-BR": "(nenhum)",
			"ru": "(\u043D\u0438\u0447\u0435\u0433\u043E)",
			"zh-CN": "(\u65E0)"
		},
		"ttloader.com": {
			"_info": {
				"instances": [
					{
						"setting": "tiktok_thirdparty",
						"field": "options.ttloader.com:ttt.name"
					}
				]
			},
			"pt-BR": "ttloader.com",
			"ru": "ttloader.com",
			"zh-CN": "ttloader.com"
		},
		"onlinetik.com": {
			"_info": {
				"instances": [
					{
						"setting": "tiktok_thirdparty",
						"field": "options.onlinetik.com:ttt.name"
					}
				]
			},
			"pt-BR": "onlinetik.com",
			"ru": "onlinetik.com",
			"zh-CN": "onlinetik.com"
		},
		"tikdowns.com": {
			"_info": {
				"instances": [
					{
						"setting": "tiktok_thirdparty",
						"field": "options.tikdowns.com:ttt.name"
					}
				]
			},
			"pt-BR": "tikdowns.com",
			"ru": "tikdowns.com",
			"zh-CN": "tikdowns.com"
		},
		"ssstiktok.net": {
			"_info": {
				"instances": [
					{
						"setting": "tiktok_thirdparty",
						"field": "options.ssstiktok.net:ttt.name"
					}
				]
			},
			"pt-BR": "ssstiktok.net",
			"ru": "ssstiktok.net",
			"zh-CN": "ssstiktok.net"
		},
		"keeptiktok.com (LQ)": {
			"_info": {
				"instances": [
					{
						"setting": "tiktok_thirdparty",
						"field": "options.keeptiktok.com.name"
					}
				]
			},
			"pt-BR": "keeptiktok.com (BQ)",
			"ru": "keeptiktok.com (\u041D\u041A)",
			"zh-CN": "keeptiktok.com (LQ)"
		},
		"ssstiktok.io (LQ)": {
			"_info": {
				"instances": [
					{
						"setting": "tiktok_thirdparty",
						"field": "options.ssstiktok.io:1.name"
					}
				]
			},
			"pt-BR": "ssstiktok.io (BQ)",
			"ru": "ssstiktok.io (\u041D\u041A)",
			"zh-CN": "ssstiktok.io (LQ)"
		},
		"musicallydown.com (LQ/PL)": {
			"_info": {
				"instances": [
					{
						"setting": "tiktok_thirdparty",
						"field": "options.musicallydown.com:1.name"
					}
				]
			},
			"pt-BR": "musicallydown.com (BQ/PL)",
			"ru": "musicallydown.com (\u041D\u041A/\u041F\u0416)",
			"zh-CN": "musicallydown.com (LQ/PL)"
		},
		"snaptik.app (LQ)": {
			"_info": {
				"instances": [
					{
						"setting": "tiktok_thirdparty",
						"field": "options.snaptik.app.name"
					}
				]
			},
			"pt-BR": "snaptik.app (BQ)",
			"ru": "snaptik.app (\u041D\u041A)",
			"zh-CN": "snaptik.app (LQ)"
		},
		"tikmate.online (LQ)": {
			"_info": {
				"instances": [
					{
						"setting": "tiktok_thirdparty",
						"field": "options.tikmate.online.name"
					}
				]
			},
			"pt-BR": "tikmate.online (BQ)",
			"ru": "tikmate.online (\u041D\u041A)",
			"zh-CN": "tikmate.online (LQ)"
		},
		"Tumblr: API key": {
			"_info": {
				"instances": [
					{
						"setting": "tumblr_api_key",
						"field": "name"
					}
				]
			},
			"pt-BR": "Tumblr: Chave da API",
			"ru": "Tumblr: \u043A\u043B\u044E\u0447 API",
			"zh-CN": "Tumblr: API \u5BC6\u94A5"
		},
		"API key for finding larger images on Tumblr": {
			"_info": {
				"instances": [
					{
						"setting": "tumblr_api_key",
						"field": "description"
					}
				]
			},
			"pt-BR": "Chave da API para encontrar imagens maiores no Tumblr",
			"ru": "\u041A\u043B\u044E\u0447 API \u0434\u043B\u044F \u043F\u043E\u0438\u0441\u043A\u0430 \u0431\u043E\u043B\u044C\u0448\u0438\u0445 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0439 \u043D\u0430 Tumblr",
			"zh-CN": "\u7528\u4E8E\u5728 Tumblr \u4E0A\u67E5\u627E\u66F4\u5927\u56FE\u7247\u7684 API \u5BC6\u94A5"
		},
		"Twitter: Use extension": {
			"_info": {
				"instances": [
					{
						"setting": "twitter_use_ext",
						"field": "name"
					}
				]
			},
			"pt-BR": "Twitter: Usar extens\u00E3o",
			"ru": "Twitter: \u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u0438\u0435",
			"zh-CN": "Twitter: \u4F7F\u7528\u6269\u5C55\u540D"
		},
		"Prefers `.jpg?name=orig` over `?format=jpg&name=orig`. This will possibly incur extra requests before succeeding. Note that there is no difference in image quality.": {
			"_info": {
				"instances": [
					{
						"setting": "twitter_use_ext",
						"field": "description"
					}
				]
			},
			"pt-BR": "Prefere `.jpg?name=orig` em vez de `?format=jpg&name=orig`. Isso possivelmente incorrer\u00E1 em requisi\u00E7\u00F5es extras antes de obter sucesso. Note que n\u00E3o h\u00E1 diferen\u00E7a na qualidade da imagem.",
			"ru": "\u041F\u0440\u0435\u0434\u043F\u043E\u0447\u0438\u0442\u0430\u0442\u044C `.jpg?name=orig` \u043F\u043E\u0432\u0435\u0440\u0445 `?format=jpg&name=orig`. \u042D\u0442\u043E, \u0432\u043E\u0437\u043C\u043E\u0436\u043D\u043E, \u043F\u043E\u0432\u043B\u0435\u0447\u0435\u0442 \u0437\u0430 \u0441\u043E\u0431\u043E\u0439 \u0434\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0435 \u0437\u0430\u043F\u0440\u043E\u0441\u044B, \u043F\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043C \u0434\u043E\u0431\u0438\u0442\u044C\u0441\u044F \u0443\u0441\u043F\u0435\u0445\u0430. \u041E\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043D\u0438\u043C\u0430\u043D\u0438\u0435, \u0447\u0442\u043E \u043D\u0435\u0442 \u043D\u0438\u043A\u0430\u043A\u043E\u0439 \u0440\u0430\u0437\u043D\u0438\u0446\u044B \u0432 \u043A\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F.",
			"zh-CN": "\u9996\u9009 `.jpg?name=orig` \u800C\u4E0D\u662F `?format=jpg&name=orig`\u3002\u8FD9\u53EF\u80FD\u5728\u6210\u529F\u524D\u4EA7\u751F\u989D\u5916\u7684\u8BF7\u6C42\u3002\u6CE8\u610F\uFF0C\u56FE\u50CF\u8D28\u91CF\u4E0A\u6CA1\u6709\u5DEE\u5F02\u3002"
		},
		"YouTube: Enable faster speeds": {
			"_info": {
				"instances": [
					{
						"setting": "youtube_replace_n",
						"field": "name"
					}
				]
			},
			"pt-BR": "YouTube: Habilitar velocidades mais r\u00E1pidas"
		},
		"Increases the download bandwidth for YouTube videos by replacing the `n` parameter. Note that this may execute untrusted Javascript.": {
			"_info": {
				"instances": [
					{
						"setting": "youtube_replace_n",
						"field": "description"
					}
				]
			},
			"pt-BR": "Aumenta a largura de banda de download para v\u00EDdeos do YouTube, substituindo o par\u00E2metro `n`. Observe que isso pode executar Javascript n\u00E3o confi\u00E1vel."
		},
		"Media blacklist": {
			"_info": {
				"instances": [
					{
						"setting": "bigimage_blacklist",
						"field": "name"
					}
				]
			},
			"pt-BR": "Lista negra de m\u00EDdia"
		},
		"A list of URLs (one per line) that are blacklisted from being processed": {
			"_info": {
				"instances": [
					{
						"setting": "bigimage_blacklist",
						"field": "description"
					}
				]
			},
			"pt-BR": "Uma lista de URLs (uma por linha) que est\u00E3o na lista negra e n\u00E3o ser\u00E3o processadas",
			"ru": "\u0421\u043F\u0438\u0441\u043E\u043A URL-\u0430\u0434\u0440\u0435\u0441\u043E\u0432 (\u043F\u043E \u043E\u0434\u043D\u043E\u043C\u0443 \u043D\u0430 \u0441\u0442\u0440\u043E\u043A\u0443), \u043A\u043E\u0442\u043E\u0440\u044B\u0435 \u0437\u0430\u043D\u0435\u0441\u0435\u043D\u044B \u0432 \u0447\u0451\u0440\u043D\u044B\u0439 \u0441\u043F\u0438\u0441\u043E\u043A \u0434\u043B\u044F \u043E\u0431\u0440\u0430\u0431\u043E\u0442\u043A\u0438.",
			"zh-CN": "\u5904\u7406\u8FC7\u7A0B\u7684\u9ED1\u540D\u5355\u7F51\u5740\u5217\u8868\uFF08\u6BCF\u884C\u4E00\u6761\uFF09"
		},
		"Media blacklist mode": {
			"_info": {
				"instances": [
					{
						"setting": "bigimage_blacklist_mode",
						"field": "name"
					}
				]
			},
			"pt-BR": "Modo de lista negra de m\u00EDdia"
		},
		"Whether the media blacklist should act as a blacklist or a whitelist": {
			"_info": {
				"instances": [
					{
						"setting": "bigimage_blacklist_mode",
						"field": "description"
					}
				]
			},
			"pt-BR": "Se a lista negra de m\u00EDdia deve funcionar como uma lista negra ou uma lista branca"
		},
		"Blacklist engine": {
			"_info": {
				"instances": [
					{
						"setting": "bigimage_blacklist_engine",
						"field": "name"
					}
				]
			},
			"ko": "\uBE14\uB799\uB9AC\uC2A4\uD2B8 \uC5D4\uC9C4",
			"pt-BR": "Mecanismo de lista negra",
			"ru": "\u0414\u0432\u0438\u0436\u043E\u043A \u0447\u0451\u0440\u043D\u043E\u0433\u043E \u0441\u043F\u0438\u0441\u043A\u0430",
			"zh-CN": "\u9ED1\u540D\u5355\u5F15\u64CE"
		},
		"How blacklists should be processed": {
			"_info": {
				"instances": [
					{
						"setting": "bigimage_blacklist_engine",
						"field": "description"
					}
				]
			},
			"pt-BR": "Como as listas negras devem ser processadas"
		},
		"Simple (glob)": {
			"_info": {
				"instances": [
					{
						"setting": "bigimage_blacklist_engine",
						"field": "options.glob.name"
					}
				]
			},
			"ko": "\uB2E8\uC21C (glob)",
			"pt-BR": "Simples (glob)",
			"ru": "\u041F\u0440\u043E\u0441\u0442\u043E\u0439 (glob)",
			"zh-CN": "\u7B80\u6613 (glob)"
		},
		"Regex": {
			"_info": {
				"instances": [
					{
						"setting": "bigimage_blacklist_engine",
						"field": "options.regex.name"
					}
				]
			},
			"ko": "\uC815\uADDC\uC2DD",
			"pt-BR": "Regex",
			"ru": "\u0420\u0435\u0433\u0443\u043B\u044F\u0440\u043D\u043E\u0435 \u0432\u044B\u0440\u0430\u0436\u0435\u043D\u0438\u0435",
			"zh-CN": "\u6B63\u5219\u8868\u8FBE\u5F0F"
		},
		"Host blacklist": {
			"_info": {
				"instances": [
					{
						"setting": "host_blacklist",
						"field": "name"
					}
				]
			},
			"pt-BR": "Lista negra de hosts"
		},
		"A list of host URLs (one per line) that the popup is blacklisted from. For example, adding `twitter.com` to this blacklist would prevent any popup from opening on twitter.com.": {
			"_info": {
				"instances": [
					{
						"setting": "host_blacklist",
						"field": "description"
					}
				]
			},
			"pt-BR": "Uma lista de URLs de hosts (uma por linha) para as quais o popup est\u00E1 na lista negra. Por exemplo, adicionar `twitter.com` a esta lista negra impediria que qualquer popup fosse aberto em twitter.com."
		},
		"Host blacklist mode": {
			"_info": {
				"instances": [
					{
						"setting": "host_blacklist_mode",
						"field": "name"
					}
				]
			},
			"pt-BR": "Modo de lista negra de hosts"
		},
		"Whether the host blacklist should act as a blacklist or a whitelist": {
			"_info": {
				"instances": [
					{
						"setting": "host_blacklist_mode",
						"field": "description"
					}
				]
			},
			"pt-BR": "Se a lista negra de hosts deve funcionar como uma lista negra ou uma lista branca"
		},
		"HTML page blacklist": {
			"_info": {
				"instances": [
					{
						"setting": "host_html_blacklist",
						"field": "name"
					}
				]
			},
			"pt-BR": "Lista negra de p\u00E1ginas HTML"
		},
		"A list of URLs (one per line) that are blacklisted from being redirected.": {
			"_info": {
				"instances": [
					{
						"setting": "host_html_blacklist",
						"field": "description"
					}
				]
			},
			"pt-BR": "Uma lista de URLs (uma por linha) que est\u00E3o na lista negra e n\u00E3o ser\u00E3o redirecionadas."
		},
		"The examples below are written for the simple (glob) engine, not the regex engine. The glob engine is generally based on the UNIX glob syntax.<br />\n<ul><br />\n<li><code>google.com</code> will block https://google.com/, https://www.google.com/, https://abcdef.google.com/, https://def.abc.google.com/, etc.</li>\n<li><code>abc.google.com</code> will block https://abc.google.com/, https://def.abc.google.com/, etc.</li>\n<li><code>*.google.com</code> will block https://www.google.com/, https://def.abc.google.com/, etc. but not https://google.com/</li>\n<li><code>google.*/</code> will block https://google.com/, https://www.google.co.uk, etc.</li>\n<li><code>http://google.com</code> will block http://google.com/, but not https://google.com/, http://www.google.com/, etc.</li>\n<li><code>google.com/test</code> will block https://google.com/test, https://www.google.com/test/abcdef, but not https://google.com/, etc.</li>\n<li><code>google.com/*/test</code> will block https://google.com/abc/test, but not https://google.com/test or https://google.com/abc/def/test</li>\n<li><code>google.com/**/test</code> will block https://google.com/abc/test, https://google.com/abc/def/test, https://google.com/abc/def/ghi/test, etc. but not https://google.com/test</li>\n<li><code>g??gle.com</code> will block https://google.com/, https://gaagle.com/, https://goagle.com/, etc.</li>\n<li><code>google.{com,co.uk}</code> will block https://google.com/ and https://google.co.uk/</li>\n<li><code>g[oau]ogle.com</code> will block https://google.com/, https://gaogle.com/, and http://www.guogle.com/</li>\n<li><code>g[0-9]ogle.com</code> will block https://g0ogle.com/, https://g1ogle.com/, etc. (up to https://g9ogle.com/)</li>\n</ul>": {
			"_info": {
				"instances": [
					{
						"setting": "bigimage_blacklist",
						"field": "documentation.value"
					},
					{
						"setting": "host_blacklist",
						"field": "documentation.value"
					},
					{
						"setting": "host_html_blacklist",
						"field": "documentation.value"
					}
				]
			},
			"pt-BR": "Os exemplos abaixo foram escritos para o mecanismo simples (glob), n\u00E3o o mecanismo regex. O mecanismo glob \u00E9 geralmente baseado na sintaxe glob do UNIX.<br />\n<ul><br />\n<li><code>google.com</code> bloquear\u00E1 https://google.com/, https://www.google.com/, https://abcdef.google.com/, https://def.abc.google.com/, etc.</li>\n<li><code>abc.google.com</code> bloquear\u00E1 https://abc.google.com/, https://def.abc.google.com/, etc.</li>\n<li><code>*.google.com</code> bloquear\u00E1 https://www.google.com/, https://def.abc.google.com/, etc. mas n\u00E3o https://google.com/</li>\n<li><code>google.*/</code> bloquear\u00E1 https://google.com/, https://www.google.co.uk, etc.</li>\n<li><code>http://google.com</code> bloquear\u00E1 http://google.com/, mas n\u00E3o https://google.com/, http://www.google.com/, etc.</li>\n<li><code>google.com/test</code> bloquear\u00E1 https://google.com/test, https://www.google.com/test/abcdef, mas n\u00E3o https://google.com/, etc.</li>\n<li><code>google.com/*/test</code> bloquear\u00E1 https://google.com/abc/test, mas n\u00E3o https://google.com/test ou https://google.com/abc/def/test</li>\n<li><code>google.com/**/test</code> bloquear\u00E1 https://google.com/abc/test, https://google.com/abc/def/test, https://google.com/abc/def/ghi/test, etc. mas n\u00E3o https://google.com/test</li>\n<li><code>g??gle.com</code> bloquear\u00E1 https://google.com/, https://gaagle.com/, https://goagle.com/, etc.</li>\n<li><code>google.{com,co.uk}</code> bloquear\u00E1 https://google.com/ e https://google.co.uk/</li>\n<li><code>g[oau]ogle.com</code> bloquear\u00E1 https://google.com/, https://gaogle.com/, e http://www.guogle.com/</li>\n<li><code>g[0-9]ogle.com</code> bloquear\u00E1 https://g0ogle.com/, https://g1ogle.com/, etc. (at\u00E9 https://g9ogle.com/)</li>\n</ul>",
			"ru": "\u041F\u0440\u0438\u0432\u0435\u0434\u0435\u043D\u043D\u044B\u0435 \u043D\u0438\u0436\u0435 \u043F\u0440\u0438\u043C\u0435\u0440\u044B \u043D\u0430\u043F\u0438\u0441\u0430\u043D\u044B \u0434\u043B\u044F \u043F\u0440\u043E\u0441\u0442\u043E\u0433\u043E (glob) \u0434\u0432\u0438\u0436\u043A\u0430, \u0430 \u043D\u0435 \u0434\u043B\u044F \u0434\u0432\u0438\u0436\u043A\u0430 \u0440\u0435\u0433\u0443\u043B\u044F\u0440\u043D\u044B\u0445 \u0432\u044B\u0440\u0430\u0436\u0435\u043D\u0438\u0439. \u041C\u0435\u0445\u0430\u043D\u0438\u0437\u043C glob \u043E\u0431\u044B\u0447\u043D\u043E \u043E\u0441\u043D\u043E\u0432\u0430\u043D \u043D\u0430 \u0441\u0438\u043D\u0442\u0430\u043A\u0441\u0438\u0441\u0435 UNIX glob.<br />\n<ul><br />\n<li><code>google.com</code> \u0431\u0443\u0434\u0435\u0442 \u0431\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u0430\u0442\u044C https://google.com/, https://www.google.com/, https://abcdef.google.com/, https://def.abc.google.com/, \u0438 \u0442.\u0434.</li>\n<li><code>abc.google.com</code> \u0431\u0443\u0434\u0435\u0442 \u0431\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u0430\u0442\u044C https://abc.google.com/, https://def.abc.google.com/, \u0438 \u0442.\u0434.</li>\n<li><code>*.google.com</code> \u0431\u0443\u0434\u0435\u0442 \u0431\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u0430\u0442\u044C https://www.google.com/, https://def.abc.google.com/, \u0438 \u0442.\u0434., \u043D\u043E \u043D\u0435 https://google.com/</li>\n<li><code>google.*/</code> \u0431\u0443\u0434\u0435\u0442 \u0431\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u0430\u0442\u044C https://google.com/, https://www.google.co.uk, \u0438 \u0442.\u0434.</li>\n<li><code>http://google.com</code> \u0431\u0443\u0434\u0435\u0442 \u0431\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u0430\u0442\u044C http://google.com/, \u043D\u043E \u043D\u0435 https://google.com/, http://www.google.com/, \u0438 \u0442.\u0434.</li>\n<li><code>google.com/test</code> \u0431\u0443\u0434\u0435\u0442 \u0431\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u0430\u0442\u044C https://google.com/test, https://www.google.com/test/abcdef, \u043D\u043E \u043D\u0435 https://google.com/, \u0438 \u0442.\u0434.</li>\n<li><code>google.com/*/test</code> \u0431\u0443\u0434\u0435\u0442 \u0431\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u0430\u0442\u044C https://google.com/abc/test, \u043D\u043E \u043D\u0435 https://google.com/test \u0438\u043B\u0438 https://google.com/abc/def/test</li>\n<li><code>google.com/**/test</code> \u0431\u0443\u0434\u0435\u0442 \u0431\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u0430\u0442\u044C https://google.com/abc/test, https://google.com/abc/def/test, https://google.com/abc/def/ghi/test, \u0438 \u0442.\u0434., \u043D\u043E \u043D\u0435 https://google.com/test</li>\n<li><code>g??gle.com</code> \u0431\u0443\u0434\u0435\u0442 \u0431\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u0430\u0442\u044C https://google.com/, https://gaagle.com/, https://goagle.com/, \u0438 \u0442.\u0434.</li>\n<li><code>google.{com,co.uk}</code> \u0431\u0443\u0434\u0435\u0442 \u0431\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u0430\u0442\u044C https://google.com/ \u0438 https://google.co.uk/</li>\n<li><code>g[oau]ogle.com</code> \u0431\u0443\u0434\u0435\u0442 \u0431\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u0430\u0442\u044C https://google.com/, https://gaogle.com/, \u0438 http://www.guogle.com/</li>\n<li><code>g[0-9]ogle.com</code> \u0431\u0443\u0434\u0435\u0442 \u0431\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u0430\u0442\u044C https://g0ogle.com/, https://g1ogle.com/, \u0438 \u0442.\u0434. (\u0432\u043F\u043B\u043E\u0442\u044C \u0434\u043E https://g9ogle.com/)</li>\n</ul>",
			"zh-CN": "\u4E0B\u9762\u7684\u793A\u4F8B\u662F\u4E3A\u5EFA\u8BAE\uFF08glob\uFF09\u5F15\u64CE\u7F16\u5199\uFF0C\u800C\u975E\u6B63\u5219\u8868\u8FBE\u5F0F\u5F15\u64CE\u3002Glob \u5F15\u64CE\u901A\u5E38\u57FA\u4E8E UNIX glob \u8BED\u6CD5\u3002<br />\n<ul><br />\n<li><code>google.com</code> \u5C06\u5C4F\u853D https://google.com/, https://www.google.com/, https://abcdef.google.com/, https://def.abc.google.com/ \u7B49\u3002</li>\n<li><code>abc.google.com</code> \u5C06\u5C4F\u853D https://abc.google.com/, https://def.abc.google.com/ \u7B49\u3002</li>\n<li><code>*.google.com</code> \u5C06\u5C4F\u853D https://www.google.com/, https://def.abc.google.com/ \u7B49\u3002\u4F46\u4E0D\u542B https://google.com/</li>\n<li><code>google.*/</code> \u5C06\u5C4F\u853D https://google.com/, https://www.google.co.uk \u7B49\u3002</li>\n<li><code>http://google.com</code> \u5C06\u5C4F\u853D http://google.com/, but not https://google.com/, http://www.google.com/ \u7B49\u3002</li>\n<li><code>google.com/test</code> \u5C06\u5C4F\u853D https://google.com/test, https://www.google.com/test/abcdef, but not https://google.com/ \u7B49\u3002</li>\n<li><code>google.com/*/test</code> \u5C06\u5C4F\u853D https://google.com/abc/test\uFF0C\u4F46\u4E0D\u542B https://google.com/test \u6216 https://google.com/abc/def/test</li>\n<li><code>google.com/**/test</code> \u5C06\u5C4F\u853D https://google.com/abc/test, https://google.com/abc/def/test, https://google.com/abc/def/ghi/test \u7B49\u3002 but not https://google.com/test</li>\n<li><code>g??gle.com</code> \u5C06\u5C4F\u853D https://google.com/, https://gaagle.com/, https://goagle.com/ \u7B49\u3002</li>\n<li><code>google.{com,co.uk}</code> \u5C06\u5C4F\u853D https://google.com/ \u548Chttps://google.co.uk/</li>\n<li><code>g[oau]ogle.com</code> \u5C06\u5C4F\u853D https://google.com/, https://gaogle.com/, \u548Chttp://www.guogle.com/</li>\n<li><code>g[0-9]ogle.com</code> \u5C06\u5C4F\u853D https://g0ogle.com/, https://g1ogle.com/ \u7B49\u3002 (up to https://g9ogle.com/)</li>\n</ul>"
		},
		"HTML page blacklist mode": {
			"_info": {
				"instances": [
					{
						"setting": "host_html_blacklist_mode",
						"field": "name"
					}
				]
			},
			"pt-BR": "Modo de lista negra de p\u00E1ginas HTML"
		},
		"Whether the HTML page blacklist should act as a blacklist or a whitelist": {
			"_info": {
				"instances": [
					{
						"setting": "host_html_blacklist_mode",
						"field": "description"
					}
				]
			},
			"pt-BR": "Se a lista negra de p\u00E1ginas HTML deve funcionar como uma lista negra ou uma lista branca"
		},
		"Whitelist": {
			"_info": {
				"instances": [
					{
						"setting": "bigimage_blacklist_mode",
						"field": "options.whitelist.name"
					},
					{
						"setting": "host_blacklist_mode",
						"field": "options.whitelist.name"
					},
					{
						"setting": "host_html_blacklist_mode",
						"field": "options.whitelist.name"
					}
				]
			},
			"pt-BR": "Lista branca"
		},
		"Blacklist": {
			"_info": {
				"instances": [
					{
						"setting": "bigimage_blacklist_mode",
						"field": "options.blacklist.name"
					},
					{
						"setting": "host_blacklist_mode",
						"field": "options.blacklist.name"
					},
					{
						"setting": "host_html_blacklist_mode",
						"field": "options.blacklist.name"
					}
				]
			},
			"ko": "\uBE14\uB799\uB9AC\uC2A4\uD2B8",
			"pt-BR": "Lista negra",
			"ru": "\u0427\u0451\u0440\u043D\u044B\u0439 \u0441\u043F\u0438\u0441\u043E\u043A",
			"zh-CN": "\u9ED1\u540D\u5355"
		},
		"Filename format": {
			"_info": {
				"instances": [
					{
						"setting": "filename_format",
						"field": "name"
					}
				]
			},
			"pt-BR": "Formato do nome do arquivo",
			"ru": "\u0424\u043E\u0440\u043C\u0430\u0442 \u0438\u043C\u0435\u043D\u0438 \u0444\u0430\u0439\u043B\u0430",
			"zh-CN": "\u6587\u4EF6\u540D\u683C\u5F0F"
		},
		"Format string(s) for the filename": {
			"_info": {
				"instances": [
					{
						"setting": "filename_format",
						"field": "description"
					}
				]
			},
			"pt-BR": "String(s) de formata\u00E7\u00E3o para o nome do arquivo",
			"ru": "\u0424\u043E\u0440\u043C\u0430\u0442 \u0441\u0442\u0440\u043E\u043A(\u0438) \u0434\u043B\u044F \u0438\u043C\u0435\u043D\u0438 \u0444\u0430\u0439\u043B\u0430.",
			"zh-CN": "\u6587\u4EF6\u540D\u683C\u5F0F\u5316\u8981\u7528\u5230\u7684\u5B57\u7B26\u4E32"
		},
		"Documentation": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_styles",
						"field": "documentation.title"
					},
					{
						"setting": "bigimage_blacklist",
						"field": "documentation.title"
					},
					{
						"setting": "filename_format",
						"field": "documentation.title"
					},
					{
						"setting": "host_blacklist",
						"field": "documentation.title"
					},
					{
						"setting": "host_html_blacklist",
						"field": "documentation.title"
					}
				]
			},
			"pt-BR": "Documenta\u00E7\u00E3o",
			"ru": "\u0414\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430\u0446\u0438\u044F",
			"zh-CN": "\u6587\u6863"
		},
		"<p>Variables are specified between curly brackets (<code>{}</code>).</p>\n<p>Below is a list of valid variables:</p>\n<ul><br />\n<li><code>filename</code> - Original filename (with extension, if applicable)</li>\n<li><code>filename_noext</code> - Original filename (without extension, if applicable)</li>\n<li><code>ext</code> - Extension (with <code>.</code> prefixed)</li>\n<li><code>caption</code> - Popup caption</li>\n<li><code>author_username</code> - Author's username</li>\n<li><code>id</code> - Post ID</li>\n<li><code>host_title</code> - Title of the current tab/window</li>\n<li><code>host_url</code> - URL of the host webpage</li>\n<li><code>host_domain</code> - Domain of the host webpage</li>\n<li><code>host_domain_nosub</code> - Domain (without subdomains) of the host webpage</li>\n<li><code>url</code> - URL of the media</li>\n<li><code>domain</code> - Domain of the media</li>\n<li><code>domain_nosub</code> - Domain (without subdomains) of the media</li>\n<li><code>is_screenshot</code> - Blank, the line will only be processed when screenshotting a video</li>\n<li><code>prefix</code>, <code>suffix</code> - Blank by default, these variables will be automatically prefixed/suffixed to the filename if set using <code>:=</code></li>\n<li><code>created_...</code> - Created date (see note on Date objects below)</li>\n<li><code>updated_...</code> - Updated date, this will use the <code>Last-Modified</code> header if not otherwise specified by the rule (see note on Date objects below)</li>\n<li><code>download_...</code> - Download date (see note on Date objects below)</li>\n<li><code>date_...</code> - Created/updated date (see note on Date objects below)</li>\n</ul><br />\n<p>You can truncate the value of a variable by adding <code>:(number)</code> before the end bracket (<code>}</code>). For example:</p>\n<ul><br />\n<li><code>{caption:10}</code> - Truncates the caption to be at most 10 characters long</li>\n<li><code>{caption:10.}</code> - Same, but will add an ellipsis (\u2026) if the caption was truncated</li>\n</ul><br />\n<p>If a variable doesn't exist, by default it will ignore the current format string and use the one on the next line, unless <code>?</code> is added before the end bracket. For example:</p>\n<ul><br />\n<li><code>{ext?}</code> - Will be replaced with nothing if <code>ext</code> doesn't exist</li>\n<li><code>{caption?no caption}</code> - Will be replaced with <code>no caption</code> if <code>caption</code> doesn't exist</li>\n</ul><br />\n<p>You can check for equality and inequality with <code>==</code> and <code>!=</code> operators respectively. For example:</p>\n<ul><br />\n<li><code>{domain_nosub==cdninstagram.com}{author_username} {id}</code> - Will only run the current format (<code>{author_username} {id}</code> in this case) if the domain is cdninstagram.com</li>\n</ul><br />\n<p>You can check if a variable contains a string with <code>/=</code> (<code>!/=</code> for the opposite). It also supports two flags, <code>r</code> (regex) and <code>c</code> (case-sensitive), if added between <code>/</code> and <code>=</code>. For example:</p>\n<ul><br />\n<li><code>{domain/=instagram}{id}</code> - Will only run the current format (<code>{id}</code>) if the domain contains <code>instagram</code></li>\n<li><code>{domain!/=instagram}{id}</code> - Likewise, but only if the domain does not contain <code>instagram</code></li>\n<li><code>{domain/r=inst.*ram}{id}</code> - Likewise, but only if the domain matches the regex <code>inst.*ram</code></li>\n<li><code>{window_title/c=Instagram}{id}</code> - Likewise, but only if the window's title contains <code>Instagram</code> (case-sensitively)</li>\n<li><code>{window_title!/rc=Inst.*ram}{id}</code> - Likewise, but only if the window's title does not match the case-sensitive regex <code>Inst.*ram</code></li>\n</ul><br />\n<p>You can set a custom variable with <code>:=</code>. For example:</p>\n<ul><br />\n<li><code>{domain_nosub==cdninstagram.com}{foo:=bar}</code> - Sets the variable <code>foo</code> to <code>bar</code> if the domain is <code>cdninstagram.com</code>. The variable can then be accessed with e.g. <code>{foo}</code></li>\n</ul><br />\n<p>Date objects are accessible through a number of properties. Each property can be suffixed with <code>_utc</code> to get the UTC/GMT equivalent.</p>\n<ul><br />\n<li><code>..._iso</code> - Date in ISO format (e.g. <code>2019-12-31T23-30-56</code>). Note that <code>:</code> is replaced with <code>-</code> to avoid issues with paths under NTFS.</li>\n<li><code>..._ago</code> - Human-readable representation of the time elapsed since the date (e.g. <code>1 year and 10 months ago</code>, <code>5 months and 20 days ago</code>)</li>\n<li><code>..._unix</code> - Unix timestamp (e.g. <code>1577912345</code>)</li>\n<li><code>..._unix_ms</code> - Unix timestamp with millisecond accuracy (e.g. <code>1577912345678</code>)</li>\n<li><code>..._yyyymmdd</code> - Date in YYYYMMDD format (e.g. <code>20191230</code>)</li>\n<li><code>..._hhmmss</code> - Time in HHMMSS format (e.g. <code>233056</code>)</li>\n<li><code>..._year</code> - Full year (e.g. <code>2019</code>)</li>\n<li><code>..._month</code> - Zero-padded month (e.g. <code>12</code>)</li>\n<li><code>..._day</code> - Zero-padded day (e.g. <code>31</code>)</li>\n<li><code>..._hours</code> - Zero-padded hours in military/24-hour format (e.g. <code>23</code>)</li>\n<li><code>..._minutes</code> - Zero-padded minutes (e.g. <code>30</code>)</li>\n<li><code>..._seconds</code> - Zero-padded seconds (e.g. <code>56</code>)</li>\n</ul>": {
			"_info": {
				"instances": [
					{
						"setting": "filename_format",
						"field": "documentation.value"
					}
				]
			},
			"pt-BR": "As vari\u00E1veis s\u00E3o especificadas entre chaves (<code>{}</code>).</p>\n<p>Abaixo est\u00E1 uma lista de vari\u00E1veis v\u00E1lidas:</p>\n<ul><br />\n<li><code>filename</code> - Nome do arquivo original (com extens\u00E3o, se aplic\u00E1vel)</li>\n<li><code>filename_noext</code> - Nome do arquivo original (sem extens\u00E3o, se aplic\u00E1vel)</li>\n<li><code>ext</code> - Extens\u00E3o (prefixada com <code>.</code>)</li>\n<li><code>caption</code> - Legenda do popup</li>\n<li><code>author_username</code> - Nome de usu\u00E1rio do autor</li>\n<li><code>id</code> - ID do post</li>\n<li><code>host_title</code> - T\u00EDtulo da aba/janela atual</li>\n<li><code>host_url</code> - URL da p\u00E1gina de hospedagem</li>\n<li><code>host_domain</code> - Dom\u00EDnio da p\u00E1gina de hospedagem</li>\n<li><code>host_domain_nosub</code> - Dom\u00EDnio (sem subdom\u00EDnios) da p\u00E1gina de hospedagem</li>\n<li><code>url</code> - URL da m\u00EDdia</li>\n<li><code>domain</code> - Dom\u00EDnio da m\u00EDdia</li>\n<li><code>domain_nosub</code> - Dom\u00EDnio (sem subdom\u00EDnios) da m\u00EDdia</li>\n<li><code>is_screenshot</code> - Em branco, a linha s\u00F3 ser\u00E1 processada ao fazer uma captura de tela de um v\u00EDdeo</li>\n<li><code>prefix</code>, <code>suffix</code> - Em branco por padr\u00E3o, essas vari\u00E1veis ser\u00E3o automaticamente prefixadas/sufixadas ao nome do arquivo se definidas usando <code>:=</code></li>\n<li><code>created_...</code> - Data de cria\u00E7\u00E3o (veja a nota sobre objetos de data abaixo)</li>\n<li><code>updated_...</code> - Data de atualiza\u00E7\u00E3o, usar\u00E1 o cabe\u00E7alho <code>Last-Modified</code> se n\u00E3o especificado de outra forma pela regra (veja a nota sobre objetos de data abaixo)</li>\n<li><code>download_...</code> - Data de download (veja a nota sobre objetos de data abaixo)</li>\n<li><code>date_...</code> - Data de cria\u00E7\u00E3o/atualiza\u00E7\u00E3o (veja a nota sobre objetos de data abaixo)</li>\n</ul><br />\n<p>Voc\u00EA pode truncar o valor de uma vari\u00E1vel adicionando <code>:(n\u00FAmero)</code> antes da chave de fechamento (<code>}</code>). Por exemplo:</p>\n<ul><br />\n<li><code>{caption:10}</code> - Trunca a legenda para ter no m\u00E1ximo 10 caracteres</li>\n<li><code>{caption:10.}</code> - O mesmo, mas adicionar\u00E1 uma retic\u00EAncia (\u2026) se a legenda for truncada</li>\n</ul><br />\n<p>Se uma vari\u00E1vel n\u00E3o existir, por padr\u00E3o ignorar\u00E1 a string de formato atual e usar\u00E1 a pr\u00F3xima linha, a menos que <code>?</code> seja adicionado antes da chave de fechamento. Por exemplo:</p>\n<ul><br />\n<li><code>{ext?}</code> - Ser\u00E1 substitu\u00EDdo por nada se <code>ext</code> n\u00E3o existir</li>\n<li><code>{caption?sem legenda}</code> - Ser\u00E1 substitu\u00EDdo por <code>sem legenda</code> se <code>caption</code> n\u00E3o existir</li>\n</ul><br />\n<p>Voc\u00EA pode verificar igualdade e desigualdade com os operadores <code>==</code> e <code>!=</code> respectivamente. Por exemplo:</p>\n<ul><br />\n<li><code>{domain_nosub==cdninstagram.com}{author_username} {id}</code> - Executar\u00E1 o formato atual (<code>{author_username} {id}</code> neste caso) apenas se o dom\u00EDnio for cdninstagram.com</li>\n</ul><br />\n<p>Voc\u00EA pode verificar se uma vari\u00E1vel cont\u00E9m uma string com <code>/=</code> (<code>!/=</code> para o oposto). Tamb\u00E9m suporta duas flags, <code>r</code> (regex) e <code>c</code> (case-sensitive), se adicionadas entre <code>/</code> e <code>=</code>. Por exemplo:</p>\n<ul><br />\n<li><code>{domain/=instagram}{id}</code> - Executar\u00E1 o formato atual (<code>{id}</code>) apenas se o dom\u00EDnio contiver <code>instagram</code></li>\n<li><code>{domain!/=instagram}{id}</code> - Da mesma forma, mas apenas se o dom\u00EDnio n\u00E3o contiver <code>instagram</code></li>\n<li><code>{domain/r=inst.*ram}{id}</code> - Da mesma forma, mas apenas se o dom\u00EDnio corresponder ao regex <code>inst.*ram</code></li>\n<li><code>{window_title/c=Instagram}{id}</code> - Da mesma forma, mas apenas se o t\u00EDtulo da janela contiver <code>Instagram</code> (diferencia\u00E7\u00E3o de mai\u00FAsculas e min\u00FAsculas)</li>\n<li><code>{window_title!/rc=Inst.*ram}{id}</code> - Da mesma forma, mas apenas se o t\u00EDtulo da janela n\u00E3o corresponder ao regex case-sensitive <code>Inst.*ram</code></li>\n</ul><br />\n<p>Voc\u00EA pode definir uma vari\u00E1vel personalizada com <code>:=</code>. Por exemplo:</p>\n<ul><br />\n<li><code>{domain_nosub==cdninstagram.com}{foo:=bar}</code> - Define a vari\u00E1vel <code>foo</code> como <code>bar</code> se o dom\u00EDnio for <code>cdninstagram.com</code>. A vari\u00E1vel pode ent\u00E3o ser acessada com, por exemplo, <code>{foo}</code></li>\n</ul><br />\n<p>Objetos de data s\u00E3o acess\u00EDveis atrav\u00E9s de v\u00E1rias propriedades. Cada propriedade pode ser sufixada com <code>_utc</code> para obter o equivalente UTC/GMT.</p>\n<ul><br />\n<li><code>..._iso</code> - Data em formato ISO (ex.: <code>2019-12-31T23-30-56</code>). Observe que <code>:</code> \u00E9 substitu\u00EDdo por <code>-</code> para evitar problemas com caminhos no NTFS.</li>\n<li><code>..._ago</code> - Representa\u00E7\u00E3o leg\u00EDvel do tempo decorrido desde a data (ex.: <code>1 ano e 10 meses atr\u00E1s</code>, <code>5 meses e 20 dias atr\u00E1s</code>)</li>\n<li><code>..._unix</code> - Timestamp Unix (ex.: <code>1577912345</code>)</li>\n<li><code>..._unix_ms</code> - Timestamp Unix com precis\u00E3o de milissegundos (ex.: <code>1577912345678</code>)</li>\n<li><code>..._yyyymmdd</code> - Data em formato YYYYMMDD (ex.: <code>20191230</code>)</li>\n<li><code>..._hhmmss</code> - Hora em formato HHMMSS (ex.: <code>233056</code>)</li>\n<li><code>..._year</code> - Ano completo (ex.: <code>2019</code>)</li>\n<li><code>..._month</code> - M\u00EAs com zero \u00E0 esquerda (ex.: <code>12</code>)</li>\n<li><code>..._day</code> - Dia com zero \u00E0 esquerda (ex.: <code>31</code>)</li>\n<li><code>..._hours</code> - Horas com zero \u00E0 esquerda no formato militar/24 horas (ex.: <code>23</code>)</li>\n<li><code>..._minutes</code> - Minutos com zero \u00E0 esquerda (ex.: <code>30</code>)</li>\n<li><code>..._seconds</code> - Segundos com zero \u00E0 esquerda (ex.: <code>56</code>)</li>\n</ul>",
			"ru": "<p>\u041F\u0435\u0440\u0435\u043C\u0435\u043D\u043D\u044B\u0435 \u0443\u043A\u0430\u0437\u044B\u0432\u0430\u044E\u0442\u0441\u044F \u043C\u0435\u0436\u0434\u0443 \u0444\u0438\u0433\u0443\u0440\u043D\u044B\u043C\u0438 \u0441\u043A\u043E\u0431\u043A\u0430\u043C\u0438 (<code>{}</code>).</p>\n<p>\u041D\u0438\u0436\u0435 \u043F\u0440\u0438\u0432\u0435\u0434\u0435\u043D \u0441\u043F\u0438\u0441\u043E\u043A \u0434\u043E\u043F\u0443\u0441\u0442\u0438\u043C\u044B\u0445 \u043F\u0435\u0440\u0435\u043C\u0435\u043D\u043D\u044B\u0445:</p>\n<ul><br />\n<li><code>filename</code> - \u041E\u0440\u0438\u0433\u0438\u043D\u0430\u043B\u044C\u043D\u043E\u0435 \u0438\u043C\u044F \u0444\u0430\u0439\u043B\u0430 (\u0441 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u0438\u0435\u043C, \u0435\u0441\u043B\u0438 \u043F\u0440\u0438\u043C\u0435\u043D\u0438\u043C\u043E)</li>\n<li><code>filename_noext</code> - \u041E\u0440\u0438\u0433\u0438\u043D\u0430\u043B\u044C\u043D\u043E\u0435 \u0438\u043C\u044F \u0444\u0430\u0439\u043B\u0430 (\u0431\u0435\u0437 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u0438\u044F, \u0435\u0441\u043B\u0438 \u043F\u0440\u0438\u043C\u0435\u043D\u0438\u043C\u043E)</li>\n<li><code>ext</code> - \u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u0438\u0435 (\u0441 \u043F\u0440\u0435\u0444\u0438\u043A\u0441\u043E\u043C <code>.</code>)</li>\n<li><code>caption</code> - \u0417\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430</li>\n<li><code>author_username</code> - \u0418\u043C\u044F \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044F \u0430\u0432\u0442\u043E\u0440\u0430</li>\n<li><code>id</code> - ID \u0437\u0430\u043F\u0438\u0441\u0438</li>\n<li><code>host_title</code> - \u0417\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A \u0442\u0435\u043A\u0443\u0449\u0435\u0439 \u0432\u043A\u043B\u0430\u0434\u043A\u0438/\u043E\u043A\u043D\u0430</li>\n<li><code>host_url</code> - URL-\u0430\u0434\u0440\u0435\u0441 \u0432\u0435\u0431-\u0441\u0442\u0440\u0430\u043D\u0438\u0446\u044B \u0445\u043E\u0441\u0442\u0430</li>\n<li><code>host_domain</code> - \u0414\u043E\u043C\u0435\u043D \u0433\u043B\u0430\u0432\u043D\u043E\u0439 \u0432\u0435\u0431-\u0441\u0442\u0440\u0430\u043D\u0438\u0446\u044B</li>\n<li><code>host_domain_nosub</code> - \u0414\u043E\u043C\u0435\u043D (\u0431\u0435\u0437 \u0441\u0443\u0431\u0434\u043E\u043C\u0435\u043D\u043E\u0432) \u0433\u043B\u0430\u0432\u043D\u043E\u0439 \u0432\u0435\u0431-\u0441\u0442\u0440\u0430\u043D\u0438\u0446\u044B</li>\n<li><code>url</code> - URL-\u0430\u0434\u0440\u0435\u0441 \u043C\u0435\u0434\u0438\u0430</li>\n<li><code>domain</code> - \u0414\u043E\u043C\u0435\u043D \u043C\u0435\u0434\u0438\u0430</li>\n<li><code>domain_nosub</code> - \u0414\u043E\u043C\u0435\u043D (\u0431\u0435\u0437 \u0441\u0443\u0431\u0434\u043E\u043C\u0435\u043D\u043E\u0432) \u043C\u0435\u0434\u0438\u0430</li>\n<li><code>is_screenshot</code> - \u041F\u0443\u0441\u0442\u043E, \u0441\u0442\u0440\u043E\u043A\u0430 \u0431\u0443\u0434\u0435\u0442 \u043E\u0431\u0440\u0430\u0431\u0430\u0442\u044B\u0432\u0430\u0442\u044C\u0441\u044F \u0442\u043E\u043B\u044C\u043A\u043E \u043F\u0440\u0438 \u0441\u043A\u0440\u0438\u043D\u0448\u043E\u0442\u0435 \u0432\u0438\u0434\u0435\u043E.</li>\n<li><code>prefix</code>, <code>suffix</code> - \u041F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E \u043F\u0443\u0441\u0442\u044B\u0435, \u044D\u0442\u0438 \u043F\u0435\u0440\u0435\u043C\u0435\u043D\u043D\u044B\u0435 \u0431\u0443\u0434\u0443\u0442 \u0430\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0438 \u043F\u0440\u0438\u0441\u0442\u0430\u0432\u043B\u044F\u0442\u044C\u0441\u044F \u043A \u0438\u043C\u0435\u043D\u0438 \u0444\u0430\u0439\u043B\u0430, \u0435\u0441\u043B\u0438 \u043E\u043D\u0438 \u0437\u0430\u0434\u0430\u043D\u044B \u0441 \u043F\u043E\u043C\u043E\u0449\u044C\u044E <code>:=</code></li>\n<li><code>created_...</code> - \u0414\u0430\u0442\u0430 \u0441\u043E\u0437\u0434\u0430\u043D\u0438\u044F (\u0441\u043C. \u043F\u0440\u0438\u043C\u0435\u0447\u0430\u043D\u0438\u0435 \u043A \u043E\u0431\u044A\u0435\u043A\u0442\u0430\u043C Date \u043D\u0438\u0436\u0435)</li>\n<li><code>updated_...</code> - \u0414\u0430\u0442\u0430 \u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u044F, \u043F\u0440\u0438 \u044D\u0442\u043E\u043C \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C\u0441\u044F \u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A <code>Last-Modified,</code> \u0435\u0441\u043B\u0438 \u043F\u0440\u0430\u0432\u0438\u043B\u043E \u043D\u0435 \u0443\u043A\u0430\u0437\u0430\u043D\u043E \u0438\u043D\u044B\u043C \u043E\u0431\u0440\u0430\u0437\u043E\u043C (\u0441\u043C. \u043F\u0440\u0438\u043C\u0435\u0447\u0430\u043D\u0438\u0435 \u043A \u043E\u0431\u044A\u0435\u043A\u0442\u0430\u043C Date \u043D\u0438\u0436\u0435)</li>\n<li><code>download_...</code> - \u0414\u0430\u0442\u0430 \u0441\u043A\u0430\u0447\u0438\u0432\u0430\u043D\u0438\u044F (\u0441\u043C. \u043F\u0440\u0438\u043C\u0435\u0447\u0430\u043D\u0438\u0435 \u043E\u0431 \u043E\u0431\u044A\u0435\u043A\u0442\u0430\u0445 Date \u043D\u0438\u0436\u0435)</li>\n<li><code>date_...</code> - \u0414\u0430\u0442\u0430 \u0441\u043E\u0437\u0434\u0430\u043D\u0438\u044F/\u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u044F (\u0441\u043C. \u043F\u0440\u0438\u043C\u0435\u0447\u0430\u043D\u0438\u0435 \u043E\u0431 \u043E\u0431\u044A\u0435\u043A\u0442\u0430\u0445 Date \u043D\u0438\u0436\u0435)</li>\n</ul><br />\n<p>\u0412\u044B \u043C\u043E\u0436\u0435\u0442\u0435 \u0443\u0441\u0435\u0447\u044C \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u043F\u0435\u0440\u0435\u043C\u0435\u043D\u043D\u043E\u0439, \u0434\u043E\u0431\u0430\u0432\u0438\u0432 <code>:(number)</code> \u043F\u0435\u0440\u0435\u0434 \u0437\u0430\u043A\u0440\u044B\u0432\u0430\u044E\u0449\u0435\u0439 \u0441\u043A\u043E\u0431\u043A\u043E\u0439 (<code>}</code>). \u041D\u0430\u043F\u0440\u0438\u043C\u0435\u0440:</p>\n<ul><br />\n<li><code>{caption:10}</code> - \u041E\u0431\u0440\u0435\u0437\u0430\u0435\u0442 \u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A \u0434\u043E 10 \u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432</li>\n<li><code>{caption:10.}</code> - \u0422\u043E \u0436\u0435 \u0441\u0430\u043C\u043E\u0435, \u043D\u043E \u0441 \u0434\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u0438\u0435\u043C \u043C\u043D\u043E\u0433\u043E\u0442\u043E\u0447\u0438\u044F (\u2026), \u0435\u0441\u043B\u0438 \u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A \u0431\u044B\u043B \u043E\u0431\u0440\u0435\u0437\u0430\u043D</li>\n</ul><br />\n<p>\u0415\u0441\u043B\u0438 \u043F\u0435\u0440\u0435\u043C\u0435\u043D\u043D\u0430\u044F \u043D\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442, \u043F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E \u043E\u043D\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u0433\u043D\u043E\u0440\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0442\u0435\u043A\u0443\u0449\u0443\u044E \u0441\u0442\u0440\u043E\u043A\u0443 \u0444\u043E\u0440\u043C\u0430\u0442\u0430 \u0438 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u0442\u0443, \u043A\u043E\u0442\u043E\u0440\u0430\u044F \u043D\u0430\u0445\u043E\u0434\u0438\u0442\u0441\u044F \u0432 \u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u0439 \u0441\u0442\u0440\u043E\u043A\u0435, \u0435\u0441\u043B\u0438 \u0442\u043E\u043B\u044C\u043A\u043E <code>?</code> \u043D\u0435 \u0434\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u0430 \u043F\u0435\u0440\u0435\u0434 \u0437\u0430\u043A\u0440\u044B\u0432\u0430\u044E\u0449\u0435\u0439 \u0441\u043A\u043E\u0431\u043A\u043E\u0439. \u041D\u0430\u043F\u0440\u0438\u043C\u0435\u0440:</p>\n<ul><br />\n<li><code>{ext?}</code> - \u0411\u0443\u0434\u0435\u0442 \u0437\u0430\u043C\u0435\u043D\u0435\u043D \u043D\u0438\u0447\u0435\u043C, \u0435\u0441\u043B\u0438 <code>ext</code> \u043D\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442</li>\n<li><code>{caption?no caption}</code> - \u0411\u0443\u0434\u0435\u0442 \u0437\u0430\u043C\u0435\u043D\u0435\u043D\u043E \u043D\u0430 <code>no caption</code>, \u0435\u0441\u043B\u0438 <code>caption</code> \u043D\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442</li>\n</ul><br />\n<p>\u0412\u044B \u043C\u043E\u0436\u0435\u0442\u0435 \u043F\u0440\u043E\u0432\u0435\u0440\u0438\u0442\u044C \u0440\u0430\u0432\u0435\u043D\u0441\u0442\u0432\u043E \u0438 \u043D\u0435\u0440\u0430\u0432\u0435\u043D\u0441\u0442\u0432\u043E \u0441 \u043F\u043E\u043C\u043E\u0449\u044C\u044E \u043E\u043F\u0435\u0440\u0430\u0442\u043E\u0440\u043E\u0432 <code>==</code> \u0438 <code>!=</code> \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043D\u043D\u043E. \u041D\u0430\u043F\u0440\u0438\u043C\u0435\u0440:</p>\n<ul><br />\n<li><code>{domain_nosub==cdninstagram.com}{author_username} {id}</code> - \u0411\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043E\u0442\u0430\u0442\u044C \u0442\u043E\u043B\u044C\u043A\u043E \u0432 \u0442\u0435\u043A\u0443\u0449\u0435\u043C \u0444\u043E\u0440\u043C\u0430\u0442\u0435 (\u0432 \u0434\u0430\u043D\u043D\u043E\u043C \u0441\u043B\u0443\u0447\u0430\u0435 <code>{author_username} {id}</code>), \u0435\u0441\u043B\u0438 \u0434\u043E\u043C\u0435\u043D cdninstagram.com</li>\n</ul><br />\n<p>\u0412\u044B \u043C\u043E\u0436\u0435\u0442\u0435 \u043F\u0440\u043E\u0432\u0435\u0440\u0438\u0442\u044C, \u0441\u043E\u0434\u0435\u0440\u0436\u0438\u0442 \u043B\u0438 \u043F\u0435\u0440\u0435\u043C\u0435\u043D\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0443 \u0441 <code>/=</code> (<code>!/=</code> \u0434\u043B\u044F \u043F\u0440\u043E\u0442\u0438\u0432\u043E\u043F\u043E\u043B\u043E\u0436\u043D\u043E\u0433\u043E). \u041E\u043D \u0442\u0430\u043A\u0436\u0435 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0434\u0432\u0430 \u0444\u043B\u0430\u0433\u0430, <code>r</code> (regex) \u0438 <code>c</code> (\u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0439 \u043A \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0443), \u0435\u0441\u043B\u0438 \u0434\u043E\u0431\u0430\u0432\u043B\u0435\u043D \u043C\u0435\u0436\u0434\u0443 <code>/</code> \u0438 <code>=</code>. \u041D\u0430\u043F\u0440\u0438\u043C\u0435\u0440:</p>\n<ul><br />\n<li><code>{domain/=instagram}{id}</code> - \u0411\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043E\u0442\u0430\u0442\u044C \u0442\u043E\u043B\u044C\u043A\u043E \u0432 \u0442\u0435\u043A\u0443\u0449\u0435\u043C \u0444\u043E\u0440\u043C\u0430\u0442\u0435 (<code>{id}),</code> \u0435\u0441\u043B\u0438 \u0434\u043E\u043C\u0435\u043D \u0441\u043E\u0434\u0435\u0440\u0436\u0438\u0442 <code>instagram</code></li>\n<li><code>{domain!/=instagram}{id}</code> - \u0410\u043D\u0430\u043B\u043E\u0433\u0438\u0447\u043D\u043E, \u043D\u043E \u0442\u043E\u043B\u044C\u043A\u043E \u0435\u0441\u043B\u0438 \u0434\u043E\u043C\u0435\u043D \u043D\u0435 \u0441\u043E\u0434\u0435\u0440\u0436\u0438\u0442 <code>instagram</code></li>\n<li><code>{domain/r=inst.*ram}{id}</code> - \u0410\u043D\u0430\u043B\u043E\u0433\u0438\u0447\u043D\u043E, \u043D\u043E \u0442\u043E\u043B\u044C\u043A\u043E \u0432 \u0442\u043E\u043C \u0441\u043B\u0443\u0447\u0430\u0435, \u0435\u0441\u043B\u0438 \u0434\u043E\u043C\u0435\u043D \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 regex <code>inst.*ram</code></li>\n<li><code>{window_title/c=Instagram}{id}</code> - \u0410\u043D\u0430\u043B\u043E\u0433\u0438\u0447\u043D\u043E, \u043D\u043E \u0442\u043E\u043B\u044C\u043A\u043E \u0435\u0441\u043B\u0438 \u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A \u043E\u043A\u043D\u0430 \u0441\u043E\u0434\u0435\u0440\u0436\u0438\u0442 <code>Instagram</code> (\u0441 \u0443\u0447\u0451\u0442\u043E\u043C \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430)</li>\n<li><code>{window_title!/rc=Inst.*ram}{id}</code> - \u0410\u043D\u0430\u043B\u043E\u0433\u0438\u0447\u043D\u043E, \u043D\u043E \u0442\u043E\u043B\u044C\u043A\u043E \u0432 \u0442\u043E\u043C \u0441\u043B\u0443\u0447\u0430\u0435, \u0435\u0441\u043B\u0438 \u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A \u043E\u043A\u043D\u0430 \u043D\u0435 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 regex <code>Inst.*ram</code> \u0441 \u0443\u0447\u0451\u0442\u043E\u043C \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430</li>\n</ul><br />\n<p>\u041F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u0443\u044E \u043F\u0435\u0440\u0435\u043C\u0435\u043D\u043D\u0443\u044E \u043C\u043E\u0436\u043D\u043E \u0437\u0430\u0434\u0430\u0442\u044C \u0441 \u043F\u043E\u043C\u043E\u0449\u044C\u044E <code>:=</code>. \u041D\u0430\u043F\u0440\u0438\u043C\u0435\u0440:</p>\n<ul><br />\n<li><code>{domain_nosub==cdninstagram.com}{foo:=bar}</code> - \u0423\u0441\u0442\u0430\u043D\u0430\u0432\u043B\u0438\u0432\u0430\u0435\u0442 \u0434\u043B\u044F \u043F\u0435\u0440\u0435\u043C\u0435\u043D\u043D\u043E\u0439 <code>foo</code> \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 <code>bar</code>, \u0435\u0441\u043B\u0438 \u0434\u043E\u043C\u0435\u043D\u043E\u043C \u044F\u0432\u043B\u044F\u0435\u0442\u0441\u044F <code>cdninstagram.com</code>. \u0417\u0430\u0442\u0435\u043C \u043A \u043F\u0435\u0440\u0435\u043C\u0435\u043D\u043D\u043E\u0439 \u043C\u043E\u0436\u043D\u043E \u043F\u043E\u043B\u0443\u0447\u0438\u0442\u044C \u0434\u043E\u0441\u0442\u0443\u043F, \u043D\u0430\u043F\u0440\u0438\u043C\u0435\u0440 <code>{foo}</code></li>\n</ul><br />\n<p>\u041E\u0431\u044A\u0435\u043A\u0442\u044B Date \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u044B \u0447\u0435\u0440\u0435\u0437 \u0440\u044F\u0434 \u0441\u0432\u043E\u0439\u0441\u0442\u0432. \u041A\u0430\u0436\u0434\u043E\u0435 \u0441\u0432\u043E\u0439\u0441\u0442\u0432\u043E \u043C\u043E\u0436\u0435\u0442 \u0431\u044B\u0442\u044C \u0441\u0443\u0444\u0444\u0438\u043A\u0441\u0438\u0440\u043E\u0432\u0430\u043D\u043E \u0441 <code>_utc</code>, \u0447\u0442\u043E\u0431\u044B \u043F\u043E\u043B\u0443\u0447\u0438\u0442\u044C \u044D\u043A\u0432\u0438\u0432\u0430\u043B\u0435\u043D\u0442 UTC/GMT.</p>\n<ul><br />\n<li><code>..._iso</code> - \u0414\u0430\u0442\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 ISO (\u043D\u0430\u043F\u0440\u0438\u043C\u0435\u0440, <code>2019-12-31T23-30-56</code>). \u041E\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043D\u0438\u043C\u0430\u043D\u0438\u0435, \u0447\u0442\u043E <code>:</code> \u0437\u0430\u043C\u0435\u043D\u044F\u0435\u0442\u0441\u044F \u043D\u0430 <code>-</code> \u0432\u043E \u0438\u0437\u0431\u0435\u0436\u0430\u043D\u0438\u0435 \u043F\u0440\u043E\u0431\u043B\u0435\u043C \u0441 \u043F\u0443\u0442\u044F\u043C\u0438 \u043F\u043E\u0434 NTFS.</li>\n<li><code>..._ago</code> - \u0423\u0434\u043E\u0431\u043E\u0447\u0438\u0442\u0430\u0435\u043C\u043E\u0435 \u043F\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u0432\u0440\u0435\u043C\u0435\u043D\u0438, \u043F\u0440\u043E\u0448\u0435\u0434\u0448\u0435\u0433\u043E \u0441 \u0434\u0430\u0442\u044B (\u043D\u0430\u043F\u0440\u0438\u043C\u0435\u0440, <code>1 \u0433\u043E\u0434 \u0438 10 \u043C\u0435\u0441\u044F\u0446\u0435\u0432 \u043D\u0430\u0437\u0430\u0434</code>, <code>5 \u043C\u0435\u0441\u044F\u0446\u0435\u0432 \u0438 20 \u0434\u043D\u0435\u0439 \u043D\u0430\u0437\u0430\u0434</code>)</li>\n<li><code>..._unix</code> - \u041E\u0442\u043C\u0435\u0442\u043A\u0430 \u0432\u0440\u0435\u043C\u0435\u043D\u0438 Unix (\u043D\u0430\u043F\u0440\u0438\u043C\u0435\u0440 <code>1577912345</code>)</li>\n<li><code>..._unix_ms</code> - \u041E\u0442\u043C\u0435\u0442\u043A\u0430 \u0432\u0440\u0435\u043C\u0435\u043D\u0438 Unix \u0441 \u0442\u043E\u0447\u043D\u043E\u0441\u0442\u044C\u044E \u0434\u043E \u043C\u0438\u043B\u043B\u0438\u0441\u0435\u043A\u0443\u043D\u0434\u044B (\u043D\u0430\u043F\u0440\u0438\u043C\u0435\u0440 <code>1577912345678</code>)</li>\n<li><code>..._yyyymmdd</code> - \u0414\u0430\u0442\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 YYYYMMDD (\u043D\u0430\u043F\u0440\u0438\u043C\u0435\u0440 <code>20191230</code>)</li>\n<li><code>..._hhmmss</code> - \u0412\u0440\u0435\u043C\u044F \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 HHMMSS (\u043D\u0430\u043F\u0440\u0438\u043C\u0435\u0440 <code>233056</code>)</li>\n<li><code>..._year</code> - \u041F\u043E\u043B\u043D\u044B\u0439 \u0433\u043E\u0434 (\u043D\u0430\u043F\u0440\u0438\u043C\u0435\u0440 <code>2019</code>)</li>\n<li><code>..._month</code> - \u041C\u0435\u0441\u044F\u0446 \u0441 \u0434\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u0438\u0435\u043C \u043D\u0443\u043B\u044F (\u043D\u0430\u043F\u0440\u0438\u043C\u0435\u0440 <code>12</code>)</li>\n<li><code>..._day</code> - \u0414\u0435\u043D\u044C \u0441 \u0434\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u043D\u0443\u043B\u044F (\u043D\u0430\u043F\u0440\u0438\u043C\u0435\u0440 <code>31</code>)</li>\n<li><code>..._hours</code> - \u0427\u0430\u0441\u044B \u0441 \u0434\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u0438\u0435\u043C \u043D\u0443\u043B\u044F \u0432 \u0432\u043E\u0435\u043D\u043D\u043E\u043C/24-\u0447\u0430\u0441\u043E\u0432\u043E\u043C \u0444\u043E\u0440\u043C\u0430\u0442\u0435 (\u043D\u0430\u043F\u0440\u0438\u043C\u0435\u0440 <code>23</code>)</li>\n<li><code>..._minutes</code> - \u041C\u0438\u043D\u0443\u0442\u044B \u0441 \u0434\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u0438\u0435\u043C \u043D\u0443\u043B\u044F (\u043D\u0430\u043F\u0440\u0438\u043C\u0435\u0440 <code>30</code>)</li>\n<li><code>..._seconds</code> - \u0421\u0435\u043A\u0443\u043D\u0434\u044B \u0441 \u0434\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u0438\u0435\u043C \u043D\u0443\u043B\u044F (\u043D\u0430\u043F\u0440\u0438\u043C\u0435\u0440 <code>56</code>)</li>\n</ul>",
			"zh-CN": "<p>\u5927\u62EC\u53F7\u95F4\u53EF\u4F7F\u7528\u7684\u53D8\u91CF\uFF08<code>{}</code>\uFF09\u3002</p>\n<p>\u4E0B\u8FF0\u4E3A\u6709\u6548\u53D8\u91CF\u5217\u8868\uFF1A</p>\n<ul><br />\n<li><code>filename</code> - \u539F\u59CB\u6587\u4EF6\u540D\uFF08\u542B\u6269\u5C55\u540D\uFF0C\u5982\u9002\u7528\uFF09</li>\n<li><code>filename_noext</code> - \u539F\u59CB\u6587\u4EF6\u540D\uFF08\u65E0\u6269\u5C55\u540D\uFF0C\u5982\u9002\u7528\uFF09</li>\n<li><code>ext</code> - \u6269\u5C55\u540D\uFF08\u542B <code>.</code> \u524D\u7F00\uFF09</li>\n<li><code>caption</code> - \u5F39\u7A97\u7684\u6807\u9898</li>\n<li><code>author_username</code> - \u4F5C\u8005\u7684\u7528\u6237\u540D</li>\n<li><code>id</code> - \u5E16\u5B50 ID</li>\n<li><code>host_title</code> - \u5F53\u524D\u6807\u7B7E\u9875/\u7A97\u53E3\u7684\u6807\u9898</li>\n<li><code>host_url</code> - \u6258\u7BA1\u7F51\u9875\u7684\u7F51\u5740</li>\n<li><code>host_domain</code> - \u6258\u7BA1\u7F51\u9875\u7684\u57DF\u540D</li>\n<li><code>host_domain_nosub</code> - \u6258\u7BA1\u7F51\u9875\u7684\u57DF\u540D\uFF08\u4E0D\u542B\u5B50\u57DF\u540D\uFF09</li>\n<li><code>url</code> - \u5A92\u4F53\uFF08\u6587\u4EF6\uFF09\u7684\u7F51\u5740</li>\n<li><code>domain</code> - \u5A92\u4F53\uFF08\u6587\u4EF6\uFF09\u7684\u57DF\u540D</li>\n<li><code>domain_nosub</code> - \u5A92\u4F53\u7684\u57DF\u540D\uFF08\u4E0D\u542B\u5B50\u57DF\u540D\uFF09</li>\n<li><code>is_screenshot</code> - \u7A7A\u767D\uFF0C\u6B64\u884C\u4EC5\u5728\u5BF9\u89C6\u9891\u622A\u56FE\u65F6\u5904\u7406</li>\n<li><code>prefix</code>, <code>suffix</code> - \u9ED8\u8BA4\u7A7A\u767D\uFF0C\u8FD9\u4E9B\u53D8\u91CF\u5728\u4F7F\u7528 <code>:=</code> \u65F6\u81EA\u52A8\u4F5C\u4E3A\u6587\u4EF6\u540D\u7684\u524D\u7F00/\u540E\u7F00</li>\n<li><code>created_...</code> - \u521B\u5EFA\u65E5\u671F\uFF08\u8BE6\u89C1\u4E0B\u6587\u201C\u65E5\u671F\u201D\u5BF9\u8C61\uFF09</li>\n<li><code>updated_...</code> - \u66F4\u65B0\u65E5\u671F\uFF0C\u89C4\u5219\u672A\u53E6\u884C\u6307\u5B9A\u65F6\u5C06\u4F7F\u7528 <code>Last-Modified</code> \u5934\uFF08\u8BE6\u89C1\u4E0B\u6587\u201C\u65E5\u671F\u201D\u5BF9\u8C61\uFF09</li>\n<li><code>download_...</code> - \u4E0B\u8F7D\u65E5\u671F\uFF08\u8BE6\u89C1\u4E0B\u6587\u201C\u65E5\u671F\u201D\u5BF9\u8C61\uFF09</li>\n<li><code>date_...</code> - \u521B\u5EFA/\u66F4\u65B0\u65E5\u671F\uFF08\u8BE6\u89C1\u4E0B\u6587\u201C\u65E5\u671F\u201D\u5BF9\u8C61\uFF09</li>\n</ul><br />\n<p>\u60A8\u53EF\u4EE5\u5728\u53D8\u91CF\u7684\u53F3\u62EC\u53F7\uFF08<code>}</code>\uFF09\u524D\u6DFB\u52A0 <code>:(number)</code> \u6765\u622A\u65AD\u503C\u3002\u4F8B\u5982\uFF1A</p>\n<ul><br />\n<li><code>{caption:10}</code> - \u5C06\u6807\u9898\u622A\u65AD\u4E3A\u6700\u591A 10 \u4E2A\u5B57\u7B26</li>\n<li><code>{caption:10.}</code> - \u540C\u4E0A\uFF0C\u4F46\u5F53\u6807\u9898\u88AB\u622A\u65AD\u65F6\u8FFD\u52A0\u4E00\u4E2A\u7701\u7565\u53F7\uFF08\u2026\uFF09</li>\n</ul><br />\n<p>\u5982\u679C\u53D8\u91CF\u4E0D\u5B58\u5728\uFF0C\u9ED8\u8BA4\u5C06\u5FFD\u7565\u5F53\u524D\u7684\u683C\u5F0F\u5316\u5B57\u7B26\u4E32\uFF0C\u5E76\u4F7F\u7528\u4E0B\u4E00\u884C\uFF0C\u9664\u975E\u53F3\u62EC\u53F7\u524D\u6DFB\u52A0\u4E86 <code>?</code>\u3002\u4F8B\u5982\uFF1A</p>\n<ul><br />\n<li><code>{ext?}</code> - \u5728 <code>ext</code> \u4E0D\u5B58\u5728\u65F6\u53D8\u4E3A\u7A7A</li>\n<li><code>{caption?\u65E0\u6807\u9898}</code> - <code>caption</code> \u4E0D\u5B58\u5728\u65F6\u53D8\u4E3A <code>\u65E0\u6807\u9898</code></li>\n</ul><br />\n<p>\u53EF\u4EE5\u5206\u522B\u4F7F\u7528 <code>==</code> \u548C <code>!=</code> \u64CD\u4F5C\u7B26\u68C0\u67E5\u76F8\u7B49\u548C\u4E0D\u7B49\u5F0F\u3002\u4F8B\u5982\uFF1A</p>\n<ul><br />\n<li><code>{domain_nosub==cdninstagram.com}{author_username} {id}</code> - \u4EC5\u5728\u57DF\u540D\u4E3A cdninstagram.com \u65F6\u91C7\u7528\u8FD9\u6761\u683C\u5F0F\uFF08<code>{author_username} {id}</code>\uFF09</li>\n</ul><br />\n<p>\u53EF\u4EE5\u7528 <code>/=</code> \u68C0\u67E5\u53D8\u91CF\u662F\u5426\u5305\u542B\u6307\u5B9A\u5B57\u7B26\u4E32\uFF08<code>!/=</code> \u68C0\u67E5\u662F\u5426\u4E0D\u5305\u542B\uFF09\u3002\u5B83\u8FD8\u652F\u6301\u4E24\u4E2A\u6807\u5FD7\uFF0C<code>r</code>\uFF08\u6B63\u5219\u8868\u8FBE\u5F0F\uFF09\u548C <code>c</code>\uFF08\u533A\u5206\u5927\u5C0F\u5199\uFF09\uFF0C\u52A0\u5728 <code>/</code> \u4E0E <code>=</code> \u4E4B\u95F4\u3002\u4F8B\u5982\uFF1A</p>\n<ul><br />\n<li><code>{domain/=instagram}{id}</code> - \u4EC5\u5728\u57DF\u540D\u5305\u542B <code>instagram</code> \u65F6\u91C7\u7528\u683C\u5F0F\uFF08<code>{id}</code>\uFF09</li>\n<li><code>{domain!/=instagram}{id}</code> - \u4EC5\u5728\u57DF\u540D\u4E0D\u5305\u542B <code>instagram</code> \u65F6</li>\n<li><code>{domain/r=inst.*ram}{id}</code> - \u4EC5\u5728\u57DF\u540D\u5339\u914D\u6B63\u5219\u8868\u8FBE\u5F0F <code>inst.*ram</code> \u65F6</li>\n<li><code>{window_title/c=Instagram}{id}</code> - \u4EC5\u5728\u7A97\u53E3\u6807\u9898\u5305\u542B <code>Instagram</code> \u65F6\uFF08\u533A\u5206\u5927\u5C0F\u5199\uFF09</li>\n<li><code>{window_title!/rc=Inst.*ram}{id}</code> - \u4EC5\u5728\u7A97\u53E3\u6807\u9898\u4E0D\u5339\u914D\u533A\u5206\u5927\u5C0F\u5199\u7684\u6B63\u5219\u8868\u8FBE\u5F0F <code>Inst.*ram</code> \u65F6</li>\n</ul><br />\n<p>\u53EF\u4EE5\u7528 <code>:=</code> \u8BBE\u7F6E\u4E00\u4E2A\u81EA\u5B9A\u4E49\u53D8\u91CF\u3002\u4F8B\u5982\uFF1A</p>\n<ul><br />\n<li><code>{domain_nosub==cdninstagram.com}{foo:=bar}</code> - \u5982\u679C\u57DF\u540D\u662F <code>cdninstagram.com</code>\uFF0C\u8BBE\u7F6E\u53D8\u91CF <code>foo</code> \u4E3A <code>bar</code>\u3002\u53D8\u91CF\u7684\u8BBF\u95EE\u65B9\u5F0F\u5982 <code>{foo}</code></li>\n</ul><br />\n<p>\u65E5\u671F\u5BF9\u8C61\u53EF\u901A\u8FC7\u4F17\u591A\u5C5E\u6027\u8BBF\u95EE\u3002\u6BCF\u4E2A\u5C5E\u6027\u90FD\u53EF\u4EE5\u540E\u7F00 <code>_utc</code> \u6765\u83B7\u53D6\u7B49\u6548\u7684 UTC/GMT \u65F6\u95F4\u3002</p>\n<ul><br />\n<li><code>..._iso</code> - ISO \u683C\u5F0F\u7684\u65E5\u671F\uFF08\u4F8B\u5982 <code>2019-12-31T23-30-56</code>\uFF09\u3002\u6CE8\u610F\uFF0C<code>:</code> \u88AB\u66FF\u6362\u4E3A <code>-</code> \u4EE5\u907F\u514D\u8FDD\u53CD NTFS \u8DEF\u5F84\u7EA6\u675F\u3002</li>\n<li><code>..._ago</code> - \u6613\u4E8E\u9605\u8BFB\u7684\u5DF2\u7ECF\u8FC7\u65F6\u95F4\uFF08\u4F8B\u5982 <code>1 year and 10 months ago</code>\u3001<code>5 months and 20 days ago</code>\uFF09</li>\n<li><code>..._unix</code> - Unix \u65F6\u95F4\u6233\uFF08\u4F8B\u5982 <code>1577912345</code>\uFF09</li>\n<li><code>..._unix_ms</code> - Unix \u65F6\u95F4\u6233\uFF0C\u6BEB\u79D2\u7CBE\u5EA6\uFF08\u4F8B\u5982 <code>1577912345678</code>\uFF09</li>\n<li><code>..._yyyymmdd</code> - YYYYMMDD \u683C\u5F0F\u65E5\u671F\uFF08\u4F8B\u5982 <code>20191230</code>\uFF09</li>\n<li><code>..._hhmmss</code> - HHMMSS \u683C\u5F0F\u65F6\u95F4\uFF08\u4F8B\u5982 <code>233056</code>\uFF09</li>\n<li><code>..._year</code> - \u5B8C\u6574\u5E74\u4EFD\uFF08\u4F8B\u5982 <code>2019</code>\uFF09</li>\n<li><code>..._month</code> - \u8865\u96F6\u6708\u4EFD\uFF08\u4F8B\u5982 <code>12</code>\uFF09</li>\n<li><code>..._day</code> - \u8865\u96F6\u7684\u65E5\uFF08\u4F8B\u5982 <code>31</code>\uFF09</li>\n<li><code>..._hours</code> - \u8865\u96F6\u7684\u5C0F\u65F6\uFF0C24\u5C0F\u65F6\u5236\uFF08\u4F8B\u5982 <code>23</code>\uFF09</li>\n<li><code>..._minutes</code> - \u8865\u96F6\u7684\u5206\u949F\uFF08\u4F8B\u5982 <code>30</code>\uFF09</li>\n<li><code>..._seconds</code> - \u8865\u96F6\u7684\u79D2\uFF08\u4F8B\u5982 <code>56</code>\uFF09</li>\n</ul>"
		},
		"Replace special characters with underscores": {
			"_info": {
				"instances": [
					{
						"setting": "filename_replace_special_underscores",
						"field": "name"
					}
				]
			},
			"pt-BR": "Substituir caracteres especiais por underlines",
			"ru": "\u0417\u0430\u043C\u0435\u043D\u0430 \u0441\u043F\u0435\u0446\u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432 \u043F\u043E\u0434\u0447\u0451\u0440\u043A\u0438\u0432\u0430\u043D\u0438\u0435\u043C",
			"zh-CN": "\u7528\u4E0B\u5212\u7EBF\u66FF\u6362\u7279\u6B8A\u5B57\u7B26"
		},
		"Replaces characters such as `/` or `\"` with `_` when downloading. Note that browsers will usually do this automatically, this is just to ensure consistent behavior.": {
			"_info": {
				"instances": [
					{
						"setting": "filename_replace_special_underscores",
						"field": "description"
					}
				]
			},
			"pt-BR": "Substitui caracteres como `/` ou `\"` por `_` ao baixar. Observe que os navegadores geralmente fazem isso automaticamente, isso \u00E9 apenas para garantir um comportamento consistente.",
			"ru": "\u0417\u0430\u043C\u0435\u043D\u044F\u0435\u0442 \u0442\u0430\u043A\u0438\u0435 \u0441\u0438\u043C\u0432\u043E\u043B\u044B, \u043A\u0430\u043A `/` \u0438\u043B\u0438 `\"` \u043D\u0430 `_` \u043F\u0440\u0438 \u0441\u043A\u0430\u0447\u0438\u0432\u0430\u043D\u0438\u0438. \u041E\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043D\u0438\u043C\u0430\u043D\u0438\u0435, \u0447\u0442\u043E \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u044B \u043E\u0431\u044B\u0447\u043D\u043E \u0434\u0435\u043B\u0430\u044E\u0442 \u044D\u0442\u043E \u0430\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0438, \u044D\u0442\u043E \u043F\u0440\u043E\u0441\u0442\u043E \u0434\u043B\u044F \u043E\u0431\u0435\u0441\u043F\u0435\u0447\u0435\u043D\u0438\u044F \u0441\u043E\u0433\u043B\u0430\u0441\u043E\u0432\u0430\u043D\u043D\u043E\u0433\u043E \u043F\u043E\u0432\u0435\u0434\u0435\u043D\u0438\u044F.",
			"zh-CN": "\u4E0B\u8F7D\u65F6\u5C06\u8BF8\u5982 `/`\u3001`\"` \u7B49\u5B57\u7B26\u66FF\u6362\u4E3A `_` \u3002\u6D4F\u89C8\u5668\u901A\u5E38\u4F1A\u81EA\u52A8\u8FD9\u6837\u505A\uFF0C\u8FD9\u53EA\u662F\u4E3A\u4E86\u786E\u4FDD\u4E00\u81F4\u7684\u884C\u4E3A\u3002"
		},
		"Trigger keybinding that will run the Replace Images function": {
			"_info": {
				"instances": [
					{
						"setting": "replaceimgs_keybinding",
						"field": "description"
					}
				]
			},
			"pt-BR": "Atalho de teclado que executar\u00E1 a fun\u00E7\u00E3o Substituir Imagens",
			"ru": "\u0412\u044B\u0437\u044B\u0432\u0430\u0435\u0442 \u043F\u0440\u0438\u0432\u044F\u0437\u043A\u0443 \u043A\u043B\u0430\u0432\u0438\u0448, \u043A\u043E\u0442\u043E\u0440\u0430\u044F \u0437\u0430\u043F\u0443\u0441\u0442\u0438\u0442 \u0444\u0443\u043D\u043A\u0446\u0438\u044E \u0437\u0430\u043C\u0435\u043D\u044B \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0439.",
			"zh-CN": "\u8FD0\u884C\u201C\u66FF\u6362\u56FE\u50CF\u201D\u529F\u80FD\u7684\u89E6\u53D1\u952E"
		},
		"Automatically replace images": {
			"_info": {
				"instances": [
					{
						"setting": "replaceimgs_auto",
						"field": "name"
					}
				]
			},
			"pt-BR": "Substituir imagens automaticamente",
			"ru": "\u0410\u0432\u0442\u043E\u0437\u0430\u043C\u0435\u043D\u0430 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0439",
			"zh-CN": "\u81EA\u52A8\u66FF\u6362\u56FE\u50CF"
		},
		"Automatically replace images to larger versions on pages you view": {
			"_info": {
				"instances": [
					{
						"setting": "replaceimgs_auto",
						"field": "description"
					}
				]
			},
			"pt-BR": "Substituir automaticamente imagens por vers\u00F5es maiores nas p\u00E1ginas que voc\u00EA visualiza",
			"ru": "\u0410\u0432\u0442\u043E\u0437\u0430\u043C\u0435\u043D\u0430 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0439 \u043D\u0430 \u0431\u043E\u043B\u0435\u0435 \u043A\u0440\u0443\u043F\u043D\u044B\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u043D\u0430 \u043F\u0440\u043E\u0441\u043C\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043C\u044B\u0445 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0430\u0445.",
			"zh-CN": "\u5728\u60A8\u67E5\u770B\u7684\u9875\u9762\u4E0A\u81EA\u52A8\u5C06\u56FE\u50CF\u66FF\u6362\u4E3A\u8F83\u5927\u7248\u672C"
		},
		"This could lead to rate limiting or IP bans": {
			"_info": {
				"instances": [
					{
						"setting": "allow_bruteforce",
						"field": "warning.true"
					},
					{
						"setting": "replaceimgs_auto",
						"field": "warning.true"
					}
				]
			},
			"pt-BR": "Isso pode levar a limita\u00E7\u00E3o de taxa ou banimento de IP",
			"ru": "\u042D\u0442\u043E \u043C\u043E\u0436\u0435\u0442 \u043F\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043A \u043E\u0433\u0440\u0430\u043D\u0438\u0447\u0435\u043D\u0438\u044E \u0441\u043A\u043E\u0440\u043E\u0441\u0442\u0438 \u0438\u043B\u0438 \u0431\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u043A\u0435 IP-\u0430\u0434\u0440\u0435\u0441\u0430.",
			"zh-CN": "\u8FD9\u53EF\u80FD\u5BFC\u81F4\u901F\u7387\u9650\u5236\u548C\u5C01\u7981 IP"
		},
		"Use data URLs": {
			"_info": {
				"instances": [
					{
						"setting": "replaceimgs_usedata",
						"field": "name"
					}
				]
			},
			"pt-BR": "Usar URLs de dados",
			"ru": "\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C data URL",
			"zh-CN": "\u4F7F\u7528 data URL"
		},
		"Uses data:// URLs instead of image links. Disabling this may improve compatibility with some bulk image downloader extensions": {
			"_info": {
				"instances": [
					{
						"setting": "replaceimgs_usedata",
						"field": "description"
					}
				]
			},
			"pt-BR": "Utiliza URLs data:// em vez de links de imagem. Desabilitar isso pode melhorar a compatibilidade com algumas extens\u00F5es de download de imagens em massa",
			"ru": "\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u0442 data:// URL \u0432\u043C\u0435\u0441\u0442\u043E \u0441\u0441\u044B\u043B\u043E\u043A \u043D\u0430 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F. \u041E\u0442\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u0435 \u044D\u0442\u043E\u0433\u043E \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u0430 \u043C\u043E\u0436\u0435\u0442 \u0443\u043B\u0443\u0447\u0448\u0438\u0442\u044C \u0441\u043E\u0432\u043C\u0435\u0441\u0442\u0438\u043C\u043E\u0441\u0442\u044C \u0441 \u043D\u0435\u043A\u043E\u0442\u043E\u0440\u044B\u043C\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u0438\u044F\u043C\u0438 \u043C\u0430\u0441\u0441\u043E\u0432\u043E\u0433\u043E \u0441\u043A\u0430\u0447\u0438\u0432\u0430\u043D\u0438\u044F \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0439.",
			"zh-CN": "\u4F7F\u7528 data:// URL \u4EE3\u66FF\u56FE\u50CF\u94FE\u63A5\u3002\u7981\u7528\u6B64\u529F\u80FD\u53EF\u80FD\u6539\u5584\u4E0E\u6279\u91CF\u4E0B\u8F7D\u56FE\u7247\u7684\u6269\u5C55\u7684\u517C\u5BB9\u6027"
		},
		"Wait until image is fully loaded": {
			"_info": {
				"instances": [
					{
						"setting": "replaceimgs_wait_fullyloaded",
						"field": "name"
					}
				]
			},
			"pt-BR": "Esperar at\u00E9 que a imagem seja totalmente carregada",
			"ru": "\u0416\u0434\u0430\u0442\u044C \u043F\u043E\u043B\u043D\u0443\u044E \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0443 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F",
			"zh-CN": "\u7B49\u5F85\u81F3\u56FE\u50CF\u5B8C\u5168\u52A0\u8F7D"
		},
		"Waits until the image being replaced is fully loaded before moving on to the next image": {
			"_info": {
				"instances": [
					{
						"setting": "replaceimgs_wait_fullyloaded",
						"field": "description"
					}
				]
			},
			"pt-BR": "Aguarda at\u00E9 que a imagem sendo substitu\u00EDda seja totalmente carregada antes de passar para a pr\u00F3xima imagem",
			"ru": "\u0416\u0434\u0451\u0442 \u043F\u043E\u043A\u0430 \u0437\u0430\u043C\u0435\u043D\u044F\u0435\u043C\u043E\u0435 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 \u043D\u0435 \u0431\u0443\u0434\u0435\u0442 \u043F\u043E\u043B\u043D\u043E\u0441\u0442\u044C\u044E \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043D\u043E \u043F\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043C \u043F\u0435\u0440\u0435\u0439\u0442\u0438 \u043A \u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u043C\u0443 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044E.",
			"zh-CN": "\u79FB\u52A8\u5230\u4E0B\u4E00\u4E2A\u56FE\u50CF\u4E4B\u524D\uFF0C\u7B49\u5F85\u88AB\u66FF\u6362\u7684\u56FE\u50CF\u5B8C\u5168\u52A0\u8F7D"
		},
		"Max images to process at once": {
			"_info": {
				"instances": [
					{
						"setting": "replaceimgs_totallimit",
						"field": "name"
					}
				]
			},
			"pt-BR": "M\u00E1ximo de imagens para processar de uma vez",
			"ru": "\u041C\u0430\u043A\u0441\u0438\u043C\u0430\u043B\u044C\u043D\u043E \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0439 \u0434\u043B\u044F \u043E\u0434\u043D\u043E\u0432\u0440\u0435\u043C\u0435\u043D\u043D\u043E\u0439 \u043E\u0431\u0440\u0430\u0431\u043E\u0442\u043A\u0438",
			"zh-CN": "\u4E00\u6B21\u6700\u591A\u5904\u7406\u56FE\u50CF"
		},
		"The maximum amount of images to process at once": {
			"_info": {
				"instances": [
					{
						"setting": "replaceimgs_totallimit",
						"field": "description"
					}
				]
			},
			"pt-BR": "A quantidade m\u00E1xima de imagens para processar de uma vez",
			"ru": "\u041C\u0430\u043A\u0441\u0438\u043C\u0430\u043B\u044C\u043D\u043E\u0435 \u043A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0439 \u0434\u043B\u044F \u043E\u0431\u0440\u0430\u0431\u043E\u0442\u043A\u0438 \u043E\u0434\u043D\u043E\u0432\u0440\u0435\u043C\u0435\u043D\u043D\u043E.",
			"zh-CN": "\u4E00\u6B21\u6700\u591A\u5904\u7406\u591A\u5C11\u4E2A\u56FE\u50CF"
		},
		"Max images per domain at once": {
			"_info": {
				"instances": [
					{
						"setting": "replaceimgs_domainlimit",
						"field": "name"
					}
				]
			},
			"pt-BR": "M\u00E1ximo de imagens por dom\u00EDnio de uma vez",
			"ru": "\u041C\u0430\u043A\u0441\u0438\u043C\u0430\u043B\u044C\u043D\u043E \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0439 \u043D\u0430 \u0434\u043E\u043C\u0435\u043D \u043E\u0434\u043D\u043E\u0432\u0440\u0435\u043C\u0435\u043D\u043D\u043E",
			"zh-CN": "\u6BCF\u4E2A\u57DF\u4E00\u6B21\u6700\u591A\u56FE\u50CF"
		},
		"The maximum amount of images per domain to process at once": {
			"_info": {
				"instances": [
					{
						"setting": "replaceimgs_domainlimit",
						"field": "description"
					}
				]
			},
			"pt-BR": "A quantidade m\u00E1xima de imagens por dom\u00EDnio para processar de uma vez",
			"ru": "\u041C\u0430\u043A\u0441\u0438\u043C\u0430\u043B\u044C\u043D\u043E\u0435 \u043A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0439 \u043D\u0430 \u0434\u043E\u043C\u0435\u043D \u0434\u043B\u044F \u043E\u0434\u043D\u043E\u0432\u0440\u0435\u043C\u0435\u043D\u043D\u043E\u0439 \u043E\u0431\u0440\u0430\u0431\u043E\u0442\u043A\u0438.",
			"zh-CN": "\u6BCF\u4E2A\u57DF\uFF08\u540D\uFF09\u4E00\u6B21\u6700\u591A\u5904\u7406\u591A\u5C11\u4E2A\u56FE\u50CF"
		},
		"images": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_ui_gallerymax",
						"field": "number_unit"
					},
					{
						"setting": "replaceimgs_totallimit",
						"field": "number_unit"
					},
					{
						"setting": "replaceimgs_domainlimit",
						"field": "number_unit"
					}
				]
			},
			"es": "im\u00E1genes",
			"ko": "\uC774\uBBF8\uC9C0",
			"pt-BR": "imagens",
			"ru": "\u0418\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F",
			"zh-CN": "\u4E2A\u56FE\u50CF"
		},
		"Delay between same-domain images": {
			"_info": {
				"instances": [
					{
						"setting": "replaceimgs_delay",
						"field": "name"
					}
				]
			},
			"pt-BR": "Atraso entre imagens do mesmo dom\u00EDnio",
			"ru": "\u0417\u0430\u0434\u0435\u0440\u0436\u043A\u0430 \u043C\u0435\u0436\u0434\u0443 \u043E\u0434\u043D\u043E\u0434\u043E\u043C\u0435\u043D\u043D\u044B\u043C\u0438 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F\u043C\u0438.",
			"zh-CN": "\u540C\u57DF\u56FE\u50CF\u4E4B\u95F4\u5EF6\u8FDF"
		},
		"New requests for images in the same domain will be delayed by this amount of seconds. Useful for avoiding rate limits.": {
			"_info": {
				"instances": [
					{
						"setting": "replaceimgs_delay",
						"field": "description"
					}
				]
			},
			"pt-BR": "Novas requisi\u00E7\u00F5es para imagens no mesmo dom\u00EDnio ser\u00E3o atrasadas por esta quantidade de segundos. \u00DAtil para evitar limites de taxa.",
			"ru": "\u041D\u043E\u0432\u044B\u0435 \u0437\u0430\u043F\u0440\u043E\u0441\u044B \u043D\u0430 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F \u0432 \u0442\u043E\u043C \u0436\u0435 \u0434\u043E\u043C\u0435\u043D\u0435 \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044C\u0441\u044F \u043D\u0430 \u044D\u0442\u043E \u043A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0441\u0435\u043A\u0443\u043D\u0434. \u041F\u043E\u043B\u0435\u0437\u043D\u043E \u0434\u043B\u044F \u0438\u0437\u0431\u0435\u0436\u0430\u043D\u0438\u044F \u043E\u0433\u0440\u0430\u043D\u0438\u0447\u0435\u043D\u0438\u0439 \u0441\u043A\u043E\u0440\u043E\u0441\u0442\u0438.",
			"zh-CN": "\u5BF9\u540C\u57DF\u56FE\u50CF\u7684\u65B0\u8BF7\u6C42\u5C06\u5EF6\u8FDF\u6B64\u79D2\u6570\u3002\u6709\u52A9\u907F\u514D\u89E6\u53D1\u9891\u7387\u9650\u5236\u3002"
		},
		"seconds": {
			"_info": {
				"instances": [
					{
						"setting": "redirect_infobox_timeout",
						"field": "number_unit"
					},
					{
						"setting": "mouseover_trigger_delay",
						"field": "number_unit"
					},
					{
						"setting": "mouseover_video_autoloop_max",
						"field": "number_unit"
					},
					{
						"setting": "mouseover_video_seek_amount",
						"field": "number_unit"
					},
					{
						"setting": "mouseover_auto_close_popup_time",
						"field": "number_unit"
					},
					{
						"setting": "replaceimgs_delay",
						"field": "number_unit"
					}
				]
			},
			"es": "segundos",
			"ko": "\uCD08",
			"pt-BR": "segundos",
			"ru": "\u0441\u0435\u043A.",
			"zh-CN": "\u79D2"
		},
		"Replace images": {
			"_info": {
				"instances": [
					{
						"setting": "replaceimgs_replaceimgs",
						"field": "name"
					}
				]
			},
			"pt-BR": "Substituir imagens",
			"ru": "\u0417\u0430\u043C\u0435\u043D\u044F\u0442\u044C \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F",
			"zh-CN": "\u66FF\u6362\u56FE\u7247"
		},
		"Replaces images to their larger versions when the button is pressed": {
			"_info": {
				"instances": [
					{
						"setting": "replaceimgs_replaceimgs",
						"field": "description"
					}
				]
			},
			"pt-BR": "Substitui as imagens por suas vers\u00F5es maiores quando o bot\u00E3o \u00E9 pressionado",
			"ru": "\u0417\u0430\u043C\u0435\u043D\u044F\u0435\u0442 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F \u043D\u0430 \u0438\u0445 \u0431\u043E\u043B\u0435\u0435 \u043A\u0440\u0443\u043F\u043D\u044B\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u043F\u0440\u0438 \u043D\u0430\u0436\u0430\u0442\u0438\u0438 \u043A\u043D\u043E\u043F\u043A\u0438.",
			"zh-CN": "\u6309\u4E0B\u6309\u94AE\u65F6\uFF0C\u5C06\u56FE\u50CF\u66FF\u6362\u4E3A\u8F83\u5927\u7684\u7248\u672C"
		},
		"Add links": {
			"_info": {
				"instances": [
					{
						"setting": "replaceimgs_addlinks",
						"field": "name"
					}
				]
			},
			"pt-BR": "Adicionar links",
			"ru": "\u0414\u043E\u0431\u0430\u0432\u043B\u044F\u0442\u044C \u0441\u0441\u044B\u043B\u043A\u0438",
			"zh-CN": "\u6DFB\u52A0\u94FE\u63A5"
		},
		"Adds links around replaced media if a link doesn't already exist": {
			"_info": {
				"instances": [
					{
						"setting": "replaceimgs_addlinks",
						"field": "description"
					}
				]
			},
			"pt-BR": "Adiciona links ao redor da m\u00EDdia substitu\u00EDda se um link ainda n\u00E3o existir",
			"ru": "\u0414\u043E\u0431\u0430\u0432\u043B\u044F\u0435\u0442 \u0441\u0441\u044B\u043B\u043A\u0438 \u0432\u043E\u043A\u0440\u0443\u0433 \u0437\u0430\u043C\u0435\u043D\u0451\u043D\u043D\u044B\u0445 \u043C\u0435\u0434\u0438\u0430, \u0435\u0441\u043B\u0438 \u0441\u0441\u044B\u043B\u043A\u0438 \u0435\u0449\u0451 \u043D\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442.",
			"zh-CN": "\u5728\u5DF2\u66FF\u6362\u5A92\u4F53\u65C1\u6DFB\u52A0\u94FE\u63A5\uFF08\u5982\u679C\u5C1A\u65E0\uFF09"
		},
		"Replace links": {
			"_info": {
				"instances": [
					{
						"setting": "replaceimgs_replacelinks",
						"field": "name"
					}
				]
			},
			"pt-BR": "Substituir links",
			"ru": "\u0417\u0430\u043C\u0435\u043D\u044F\u0442\u044C \u0441\u0441\u044B\u043B\u043A\u0438",
			"zh-CN": "\u66FF\u6362\u94FE\u63A5"
		},
		"Replaces links if they already exist": {
			"_info": {
				"instances": [
					{
						"setting": "replaceimgs_replacelinks",
						"field": "description"
					}
				]
			},
			"pt-BR": "Substitui links se eles j\u00E1 existirem",
			"ru": "\u0417\u0430\u043C\u0435\u043D\u044F\u0435\u0442 \u0441\u0441\u044B\u043B\u043A\u0438, \u0435\u0441\u043B\u0438 \u043E\u043D\u0438 \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044E\u0442.",
			"zh-CN": "\u66FF\u6362\u5DF2\u7ECF\u5B58\u5728\u7684\u94FE\u63A5"
		},
		"Plain hyperlinks": {
			"_info": {
				"instances": [
					{
						"setting": "replaceimgs_plainlinks",
						"field": "name"
					}
				]
			},
			"pt-BR": "Hiperlinks simples",
			"ru": "\u041F\u0440\u043E\u0441\u0442\u044B\u0435 \u0433\u0438\u043F\u0435\u0440\u0441\u0441\u044B\u043B\u043A\u0438",
			"zh-CN": "\u7EAF\u7CB9\u8D85\u94FE\u63A5"
		},
		"How to treat plain (non-media) hyperlinks that link to potential media": {
			"_info": {
				"instances": [
					{
						"setting": "replaceimgs_plainlinks",
						"field": "description"
					}
				]
			},
			"pt-BR": "Como tratar hiperlinks simples (n\u00E3o m\u00EDdia) que ligam para m\u00EDdias em potencial",
			"ru": "\u041A\u0430\u043A \u043E\u0431\u0440\u0430\u0449\u0430\u0442\u044C\u0441\u044F \u0441 \u043F\u0440\u043E\u0441\u0442\u044B\u043C\u0438 (\u043D\u0435\u043C\u0435\u0434\u0438\u0439\u043D\u044B\u043C\u0438) \u0433\u0438\u043F\u0435\u0440\u0441\u0441\u044B\u043B\u043A\u0430\u043C\u0438, \u043A\u043E\u0442\u043E\u0440\u044B\u0435 \u0441\u0441\u044B\u043B\u0430\u044E\u0442\u0441\u044F \u043D\u0430 \u043F\u043E\u0442\u0435\u043D\u0446\u0438\u0430\u043B\u044C\u043D\u044B\u0435 \u043C\u0435\u0434\u0438\u0430.",
			"zh-CN": "\u5982\u4F55\u5904\u7406\u94FE\u63A5\u5230\u6F5C\u5728\u5A92\u4F53\u7684\u7EAF\u7CB9\u8D85\u94FE\u63A5"
		},
		"Replace link+text": {
			"_info": {
				"instances": [
					{
						"setting": "replaceimgs_plainlinks",
						"field": "options.replace_link_text.name"
					}
				]
			},
			"pt-BR": "Substituir link+texto",
			"ru": "\u0417\u0430\u043C\u0435\u043D\u044F\u0442\u044C \u0441\u0441\u044B\u043B\u043A\u0443+\u0442\u0435\u043A\u0441\u0442",
			"zh-CN": "\u66FF\u6362\u94FE\u63A5\u548C\u6587\u672C"
		},
		"Replace media": {
			"_info": {
				"instances": [
					{
						"setting": "replaceimgs_plainlinks",
						"field": "options.replace_media.name"
					}
				]
			},
			"pt-BR": "Substituir m\u00EDdia",
			"ru": "\u0417\u0430\u043C\u0435\u043D\u044F\u0442\u044C \u043C\u0435\u0434\u0438\u0430",
			"zh-CN": "\u66FF\u6362\u5A92\u4F53"
		},
		"Links open in new tab": {
			"_info": {
				"instances": [
					{
						"setting": "replaceimgs_links_newtab",
						"field": "name"
					}
				]
			},
			"pt-BR": "Links abrem em nova aba",
			"ru": "\u041E\u0442\u043A\u0440\u044B\u0432\u0430\u0442\u044C \u0441\u0441\u044B\u043B\u043A\u0438 \u0432 \u043D\u043E\u0432\u043E\u0439 \u0432\u043A\u043B\u0430\u0434\u043A\u0435",
			"zh-CN": "\u5728\u65B0\u6807\u7B7E\u9875\u4E2D\u6253\u5F00\u94FE\u63A5"
		},
		"Clicking on a replaced link will open the media in a new tab": {
			"_info": {
				"instances": [
					{
						"setting": "replaceimgs_links_newtab",
						"field": "description"
					}
				]
			},
			"pt-BR": "Clicar em um link substitu\u00EDdo abrir\u00E1 a m\u00EDdia em uma nova aba",
			"ru": "\u041D\u0430\u0436\u0430\u0442\u0438\u0435 \u043D\u0430 \u0437\u0430\u043C\u0435\u043D\u0451\u043D\u043D\u0443\u044E \u0441\u0441\u044B\u043B\u043A\u0443 \u043E\u0442\u043A\u0440\u043E\u0435\u0442 \u043C\u0435\u0434\u0438\u0430 \u0432 \u043D\u043E\u0432\u043E\u0439 \u0432\u043A\u043B\u0430\u0434\u043A\u0435.",
			"zh-CN": "\u5355\u51FB\u5DF2\u66FF\u6362\u7684\u94FE\u63A5\u5C06\u5728\u65B0\u6807\u7B7E\u9875\u4E2D\u6253\u5F00\u5A92\u4F53"
		},
		"Size constraints": {
			"_info": {
				"instances": [
					{
						"setting": "replaceimgs_size_constraints",
						"field": "name"
					}
				]
			},
			"pt-BR": "Restri\u00E7\u00F5es de tamanho",
			"ru": "\u041E\u0433\u0440\u0430\u043D\u0438\u0447\u0435\u043D\u0438\u044F \u043F\u043E \u0440\u0430\u0437\u043C\u0435\u0440\u0443",
			"zh-CN": "\u5927\u5C0F\u9650\u5236"
		},
		"Removes or enforces height/width specifiers for replaced media": {
			"_info": {
				"instances": [
					{
						"setting": "replaceimgs_size_constraints",
						"field": "description"
					}
				]
			},
			"pt-BR": "Remove ou aplica especificadores de altura/largura para m\u00EDdia substitu\u00EDda",
			"ru": "\u0423\u0434\u0430\u043B\u044F\u0435\u0442 \u0438\u043B\u0438 \u043F\u0440\u0438\u043C\u0435\u043D\u044F\u0435\u0442 \u0441\u043F\u0435\u0446\u0438\u0444\u0438\u043A\u0430\u0442\u043E\u0440\u044B \u0432\u044B\u0441\u043E\u0442\u044B/\u0448\u0438\u0440\u0438\u043D\u044B \u0434\u043B\u044F \u0437\u0430\u043C\u0435\u043D\u0435\u043D\u043D\u044B\u0445 \u043C\u0435\u0434\u0438\u0430",
			"zh-CN": "\u79FB\u9664\u6216\u5F3A\u5236\u5E94\u7528\u88AB\u66FF\u6362\u5A92\u4F53\u7684\u9AD8\u5EA6/\u5BBD\u5EA6\u8BF4\u660E\u7B26"
		},
		"Ignore": {
			"_info": {
				"instances": [
					{
						"setting": "replaceimgs_plainlinks",
						"field": "options.none.name"
					},
					{
						"setting": "replaceimgs_size_constraints",
						"field": "options.none.name"
					}
				]
			},
			"pt-BR": "Ignorar",
			"ru": "\u0418\u0433\u043D\u043E\u0440\u0438\u0440\u043E\u0432\u0430\u0442\u044C",
			"zh-CN": "\u5FFD\u7565"
		},
		"Remove": {
			"_info": {
				"instances": [
					{
						"setting": "replaceimgs_size_constraints",
						"field": "options.remove.name"
					}
				]
			},
			"pt-BR": "Remover",
			"ru": "\u0423\u0434\u0430\u043B\u0438\u0442\u044C",
			"zh-CN": "\u79FB\u9664"
		},
		"Force": {
			"_info": {
				"instances": [
					{
						"setting": "replaceimgs_size_constraints",
						"field": "options.force.name"
					}
				]
			},
			"pt-BR": "For\u00E7ar",
			"ru": "\u041F\u0440\u0438\u043D\u0443\u0434\u0438\u0442\u0435\u043B\u044C\u043D\u043E",
			"zh-CN": "\u5F3A\u5236"
		},
		"Replacement CSS": {
			"_info": {
				"instances": [
					{
						"setting": "replaceimgs_css",
						"field": "name"
					}
				]
			},
			"pt-BR": "CSS de Substitui\u00E7\u00E3o",
			"ru": "\u0417\u0430\u043C\u0435\u043D\u0430 CSS",
			"zh-CN": "\u66FF\u6362 CSS"
		},
		"CSS styles to apply to replaced media. See the documentation for Popup CSS style for more information (the thumb/full URL variables aren't yet supported here)": {
			"_info": {
				"instances": [
					{
						"setting": "replaceimgs_css",
						"field": "description"
					}
				]
			},
			"pt-BR": "Estilos CSS para aplicar \u00E0 m\u00EDdia substitu\u00EDda. Consulte a documenta\u00E7\u00E3o para o estilo CSS de Popup para mais informa\u00E7\u00F5es (as vari\u00E1veis thumb/full URL ainda n\u00E3o s\u00E3o suportadas aqui)",
			"ru": "\u0421\u0442\u0438\u043B\u0438 CSS \u0434\u043B\u044F \u043F\u0440\u0438\u043C\u0435\u043D\u0435\u043D\u0438\u044F \u043A \u0437\u0430\u043C\u0435\u043D\u044F\u0435\u043C\u044B\u043C \u043C\u0435\u0434\u0438\u0430. \u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0435 \u0441\u0432\u0435\u0434\u0435\u043D\u0438\u044F \u0441\u043C\u043E\u0442\u0440\u0438\u0442\u0435 \u0432 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430\u0446\u0438\u0438 '\u0421\u0442\u0438\u043B\u0438\u0437\u0430\u0446\u0438\u044F CSS \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430' (\u0437\u0434\u0435\u0441\u044C \u043D\u0435 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044E\u0442\u0441\u044F \u043F\u0435\u0440\u0435\u043C\u0435\u043D\u043D\u044B\u0435 URL thumb/full).",
			"zh-CN": "\u5E94\u7528\u5230\u5DF2\u66FF\u6362\u5A92\u4F53\u7684 CSS \u6837\u5F0F\u3002\u66F4\u591A\u4FE1\u606F\u8BE6\u89C1\u201C\u5F39\u7A97 CSS \u6837\u5F0F\u201D\u6587\u6863\uFF08\u6B64\u5904\u4E0D\u652F\u6301 thumb/full URL \u53D8\u91CF\uFF09"
		},
		"Simple progress": {
			"_info": {
				"instances": [
					{
						"setting": "replaceimgs_simple_progress",
						"field": "name"
					}
				]
			},
			"pt-BR": "Progresso simples",
			"ru": "\u041F\u0440\u043E\u0441\u0442\u043E\u0439 \u043F\u0440\u043E\u0433\u0440\u0435\u0441\u0441",
			"zh-CN": "\u7B80\u5355\u8FDB\u5EA6\u6761"
		},
		"Uses a simpler progress bar that has a fixed size for all media. This is useful to see how many images are replaced, rather than the ETA": {
			"_info": {
				"instances": [
					{
						"setting": "replaceimgs_simple_progress",
						"field": "description"
					}
				]
			},
			"pt-BR": "Utiliza uma barra de progresso mais simples com tamanho fixo para todas as m\u00EDdias. Isso \u00E9 \u00FAtil para ver quantas imagens s\u00E3o substitu\u00EDdas, em vez do tempo estimado de conclus\u00E3o",
			"ru": "\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u0442 \u0431\u043E\u043B\u0435\u0435 \u043F\u0440\u043E\u0441\u0442\u0443\u044E \u0448\u043A\u0430\u043B\u0443 \u043F\u0440\u043E\u0433\u0440\u0435\u0441\u0441\u0430, \u043A\u043E\u0442\u043E\u0440\u0430\u044F \u0438\u043C\u0435\u0435\u0442 \u0444\u0438\u043A\u0441\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0439 \u0440\u0430\u0437\u043C\u0435\u0440 \u0434\u043B\u044F \u0432\u0441\u0435\u0445 \u043C\u0435\u0434\u0438\u0430. \u042D\u0442\u043E \u043F\u043E\u043B\u0435\u0437\u043D\u043E \u0434\u043B\u044F \u0442\u043E\u0433\u043E, \u0447\u0442\u043E\u0431\u044B \u0443\u0432\u0438\u0434\u0435\u0442\u044C, \u0441\u043A\u043E\u043B\u044C\u043A\u043E \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0439 \u0437\u0430\u043C\u0435\u043D\u0435\u043D\u043E, \u0430 \u043D\u0435 \u0436\u0434\u0430\u0442\u044C.",
			"zh-CN": "\u5BF9\u6240\u6709\u5A92\u4F53\u4F7F\u7528\u56FA\u5B9A\u5927\u5C0F\u7684\u7B80\u5355\u8FDB\u5EA6\u6761\u3002\u8FD9\u80FD\u770B\u5230\u6709\u591A\u5C11\u56FE\u50CF\u5DF2\u66FF\u6362\uFF0C\u800C\u4E0D\u662F\u53EA\u6709\u5269\u4F59\u65F6\u95F4"
		},
		"Trigger keybinding that will run the Highlight Images function": {
			"_info": {
				"instances": [
					{
						"setting": "highlightimgs_keybinding",
						"field": "description"
					}
				]
			},
			"pt-BR": "Atalho de teclado que executar\u00E1 a fun\u00E7\u00E3o 'Destacar Imagens'",
			"ru": "\u041F\u0440\u0438\u0432\u044F\u0437\u043A\u0430 \u043A\u043B\u0430\u0432\u0438\u0448\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044F, \u043A\u043E\u0442\u043E\u0440\u043E\u0435 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043F\u0443\u0441\u043A\u0430\u0442\u044C \u0444\u0443\u043D\u043A\u0446\u0438\u044E \u043F\u043E\u0434\u0441\u0432\u0435\u0442\u043A\u0438 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0439.",
			"zh-CN": "\u7528\u6765\u8FD0\u884C\u201C\u9AD8\u4EAE\u56FE\u50CF\u201D\u529F\u80FD\u7684\u89E6\u53D1\u952E"
		},
		"Enables the 'Highlight Images' button": {
			"_info": {
				"instances": [
					{
						"setting": "highlightimgs_enable",
						"field": "description"
					}
				]
			},
			"pt-BR": "Habilita o bot\u00E3o 'Destacar Imagens'",
			"ru": "\u0412\u043A\u043B\u044E\u0447\u0430\u0435\u0442 \u043A\u043D\u043E\u043F\u043A\u0443 '\u041F\u043E\u0434\u0441\u0432\u0435\u0442\u0438\u0442\u044C \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F'.",
			"zh-CN": "\u542F\u7528\u201C\u9AD8\u4EAE\u56FE\u50CF\u201D\u6309\u94AE"
		},
		"Automatically highlight images": {
			"_info": {
				"instances": [
					{
						"setting": "highlightimgs_auto",
						"field": "name"
					}
				]
			},
			"pt-BR": "Destacar imagens automaticamente",
			"ru": "\u0410\u0432\u0442\u043E\u043F\u043E\u0434\u0441\u0432\u0435\u0447\u0438\u0432\u0430\u0442\u044C \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F",
			"zh-CN": "\u81EA\u52A8\u9AD8\u4EAE\u56FE\u7247"
		},
		"Automatically highlights images as you view pages": {
			"_info": {
				"instances": [
					{
						"setting": "highlightimgs_auto",
						"field": "description"
					}
				]
			},
			"pt-BR": "Destaca automaticamente as imagens enquanto voc\u00EA visualiza as p\u00E1ginas",
			"ru": "\u0410\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0438 \u043F\u043E\u0434\u0441\u0432\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F \u043F\u0440\u0438 \u043F\u0440\u043E\u0441\u043C\u043E\u0442\u0440\u0435 \u0441\u0442\u0440\u0430\u043D\u0438\u0446.",
			"zh-CN": "\u67E5\u770B\u9875\u9762\u65F6\u81EA\u52A8\u7A81\u51FA\u56FE\u50CF"
		},
		"Always": {
			"_info": {
				"instances": [
					{
						"setting": "highlightimgs_auto",
						"field": "options.always.name"
					},
					{
						"setting": "mouseover_enable_mask_styles2",
						"field": "options.always.name"
					},
					{
						"setting": "mouseover_zoom_use_last",
						"field": "options.always.name"
					},
					{
						"setting": "scroll_zoomout_pagemiddle",
						"field": "options.always.name"
					},
					{
						"setting": "gallery_jd_referer",
						"field": "options.always.name"
					}
				]
			},
			"pt-BR": "Sempre",
			"ru": "\u041F\u043E\u0441\u0442\u043E\u044F\u043D\u043D\u043E",
			"zh-CN": "\u603B\u662F"
		},
		"Hover": {
			"_info": {
				"instances": [
					{
						"setting": "highlightimgs_auto",
						"field": "options.hover.name"
					}
				]
			},
			"pt-BR": "Ao passar o mouse",
			"ru": "\u041D\u0430\u0432\u0435\u0434\u0435\u043D\u0438\u0435",
			"zh-CN": "\u60AC\u505C"
		},
		"When hovering over an image": {
			"_info": {
				"instances": [
					{
						"setting": "highlightimgs_auto",
						"field": "options.hover.description"
					}
				]
			},
			"pt-BR": "Ao passar o mouse sobre uma imagem",
			"ru": "\u041F\u0440\u0438 \u043D\u0430\u0432\u0435\u0434\u0435\u043D\u0438\u0438 \u043A\u0443\u0440\u0441\u043E\u0440\u0430 \u043D\u0430 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435.",
			"zh-CN": "\u9F20\u6807\u5728\u56FE\u7247\u4E0A\u60AC\u505C\u65F6"
		},
		"Never": {
			"_info": {
				"instances": [
					{
						"setting": "highlightimgs_auto",
						"field": "options.never.name"
					},
					{
						"setting": "mouseover_zoom_use_last",
						"field": "options.never.name"
					},
					{
						"setting": "scroll_zoomout_pagemiddle",
						"field": "options.never.name"
					},
					{
						"setting": "gallery_jd_referer",
						"field": "options.never.name"
					}
				]
			},
			"pt-BR": "Nunca",
			"ru": "\u041D\u0438\u043A\u043E\u0433\u0434\u0430",
			"zh-CN": "\u4ECE\u4E0D"
		},
		"Only explicitly supported images": {
			"_info": {
				"instances": [
					{
						"setting": "highlightimgs_onlysupported",
						"field": "name"
					}
				]
			},
			"pt-BR": "Apenas imagens explicitamente suportadas",
			"ru": "\u0422\u043E\u043B\u044C\u043A\u043E \u044F\u0432\u043D\u043E \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043C\u044B\u0435 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F",
			"zh-CN": "\u4EC5\u9650\u660E\u786E\u652F\u6301\u7684\u56FE\u50CF"
		},
		"Only highlights images that can be made larger or the original version can be found": {
			"_info": {
				"instances": [
					{
						"setting": "highlightimgs_onlysupported",
						"field": "description"
					}
				]
			},
			"pt-BR": "Destaca apenas imagens que podem ser ampliadas ou cuja vers\u00E3o original pode ser encontrada",
			"ru": "\u041F\u043E\u0434\u0441\u0432\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0442\u043E\u043B\u044C\u043A\u043E \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F, \u043A\u043E\u0442\u043E\u0440\u044B\u0435 \u043C\u043E\u0433\u0443\u0442 \u0431\u044B\u0442\u044C \u0443\u0432\u0435\u043B\u0438\u0447\u0435\u043D\u044B \u0438\u043B\u0438 \u043C\u043E\u0436\u043D\u043E \u043D\u0430\u0439\u0442\u0438 \u0438\u0445 \u043E\u0440\u0438\u0433\u0438\u043D\u0430\u043B\u044C\u043D\u0443\u044E \u0432\u0435\u0440\u0441\u0438\u044E.",
			"zh-CN": "\u4EC5\u7A81\u51FA\u53EF\u4EE5\u6362\u6210\u66F4\u5927\u5C3A\u5BF8\u7684\u56FE\u50CF"
		},
		"Highlight CSS": {
			"_info": {
				"instances": [
					{
						"setting": "highlightimgs_css",
						"field": "name"
					}
				]
			},
			"pt-BR": "CSS de Destaque",
			"ru": "CSS \u043F\u043E\u0434\u0441\u0432\u0435\u0442\u043A\u0430",
			"zh-CN": "\u9AD8\u4EAE CSS"
		},
		"CSS style to apply for highlight. See the documentation for Popup CSS style for more information (the thumb/full URL variables aren't supported here)": {
			"_info": {
				"instances": [
					{
						"setting": "highlightimgs_css",
						"field": "description"
					}
				]
			},
			"pt-BR": "Estilo CSS para aplicar ao destaque. Consulte a documenta\u00E7\u00E3o para o estilo CSS de Popup para mais informa\u00E7\u00F5es (as vari\u00E1veis thumb/full URL n\u00E3o s\u00E3o suportadas aqui)",
			"ru": "\u0421\u0442\u0438\u043B\u0438\u0437\u0430\u0446\u0438\u044F CSS, \u0434\u043B\u044F \u043F\u0440\u0438\u043C\u0435\u043D\u0435\u043D\u0438\u044F \u043A \u043F\u043E\u0434\u0441\u0432\u0435\u0442\u043A\u0435. \u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0435 \u0441\u0432\u0435\u0434\u0435\u043D\u0438\u044F \u0441\u043C\u043E\u0442\u0440\u0438\u0442\u0435 \u0432 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430\u0446\u0438\u0438 '\u0421\u0442\u0438\u043B\u0438\u0437\u0430\u0446\u0438\u044F CSS \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430' (\u0437\u0434\u0435\u0441\u044C \u043D\u0435 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044E\u0442\u0441\u044F \u043F\u0435\u0440\u0435\u043C\u0435\u043D\u043D\u044B\u0435 URL thumb/full).",
			"zh-CN": "\u9AD8\u4EAE\u65F6\u4F7F\u7528\u7684 CSS \u6837\u5F0F\u3002\u66F4\u591A\u4FE1\u606F\u8BE6\u89C1\u201C\u5F39\u7A97 CSS \u6837\u5F0F\u201D\u6587\u6863\uFF08\u6B64\u5904\u4E0D\u652F\u6301 thumb/full URL \u53D8\u91CF\uFF09"
		},
		"Enable trigger key": {
			"_info": {
				"instances": [
					{
						"setting": "replaceimgs_enable_keybinding",
						"field": "name"
					},
					{
						"setting": "highlightimgs_enable_keybinding",
						"field": "name"
					},
					{
						"setting": "customgallery_enable_keybinding",
						"field": "name"
					}
				]
			},
			"pt-BR": "Habilitar tecla de disparo",
			"ru": "\u0412\u043A\u043B\u044E\u0447\u0438\u0442\u044C \u043A\u043B\u0430\u0432\u0438\u0448\u0443 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044F",
			"zh-CN": "\u542F\u7528\u89E6\u53D1\u952E"
		},
		"Enables the use of the trigger key to run it without needing to use the menu": {
			"_info": {
				"instances": [
					{
						"setting": "replaceimgs_enable_keybinding",
						"field": "description"
					},
					{
						"setting": "highlightimgs_enable_keybinding",
						"field": "description"
					},
					{
						"setting": "customgallery_enable_keybinding",
						"field": "description"
					}
				]
			},
			"pt-BR": "Habilita o uso da tecla de disparo para executar a fun\u00E7\u00E3o sem precisar usar o menu",
			"ru": "\u041F\u043E\u0437\u0432\u043E\u043B\u044F\u0435\u0442 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u043A\u043B\u0430\u0432\u0438\u0448\u0443 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044F \u0434\u043B\u044F \u0437\u0430\u043F\u0443\u0441\u043A\u0430 \u0431\u0435\u0437 \u043D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u043E\u0441\u0442\u0438 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u0438\u044F \u043C\u0435\u043D\u044E.",
			"zh-CN": "\u5141\u8BB8\u4F7F\u7528\u89E6\u53D1\u952E\u6765\u8FD0\u884C\uFF0C\u65E0\u9700\u4F7F\u7528\u83DC\u5355"
		},
		"Trigger key": {
			"_info": {
				"instances": [
					{
						"setting": "replaceimgs_keybinding",
						"field": "name"
					},
					{
						"setting": "highlightimgs_keybinding",
						"field": "name"
					},
					{
						"setting": "customgallery_keybinding",
						"field": "name"
					}
				]
			},
			"pt-BR": "Tecla de disparo",
			"ru": "\u041A\u043B\u0430\u0432\u0438\u0448\u0430 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044F",
			"zh-CN": "\u89E6\u53D1\u952E"
		},
		"Trigger keybinding that will run the Custom Gallery function": {
			"_info": {
				"instances": [
					{
						"setting": "customgallery_keybinding",
						"field": "description"
					}
				]
			},
			"pt-BR": "Atalho de teclado que executar\u00E1 a fun\u00E7\u00E3o 'Galeria Personalizada'"
		},
		"Enable button": {
			"_info": {
				"instances": [
					{
						"setting": "highlightimgs_enable",
						"field": "name"
					},
					{
						"setting": "customgallery_enable_button",
						"field": "name"
					}
				]
			},
			"pt-BR": "Habilitar bot\u00E3o",
			"ru": "\u0412\u043A\u043B\u044E\u0447\u0438\u0442\u044C \u043A\u043D\u043E\u043F\u043A\u0443",
			"zh-CN": "\u542F\u7528\u6309\u94AE"
		},
		"Enables the 'Custom Gallery' button": {
			"_info": {
				"instances": [
					{
						"setting": "customgallery_enable_button",
						"field": "description"
					}
				]
			},
			"pt-BR": "Habilita o bot\u00E3o 'Galeria Personalizada'"
		},
		"Apply key": {
			"_info": {
				"instances": [
					{
						"setting": "customgallery_apply_key",
						"field": "name"
					}
				]
			},
			"pt-BR": "Tecla de aplica\u00E7\u00E3o"
		},
		"Triggers the gallery when pressed": {
			"_info": {
				"instances": [
					{
						"setting": "customgallery_apply_key",
						"field": "description"
					}
				]
			},
			"pt-BR": "Aciona a galeria quando pressionada"
		},
		"Background CSS": {
			"_info": {
				"instances": [
					{
						"setting": "customgallery_bg_css",
						"field": "name"
					}
				]
			},
			"pt-BR": "CSS de Fundo"
		},
		"CSS style to apply for the background": {
			"_info": {
				"instances": [
					{
						"setting": "customgallery_bg_css",
						"field": "description"
					}
				]
			},
			"pt-BR": "Estilo CSS para aplicar ao fundo"
		},
		"Outline CSS": {
			"_info": {
				"instances": [
					{
						"setting": "customgallery_outline_css",
						"field": "name"
					}
				]
			},
			"pt-BR": "CSS de Contorno"
		},
		"CSS style to apply for element outlines": {
			"_info": {
				"instances": [
					{
						"setting": "customgallery_outline_css",
						"field": "description"
					}
				]
			},
			"pt-BR": "Estilo CSS para aplicar aos contornos dos elementos"
		},
		"Mouseover popup action": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_open_behavior",
						"field": "name"
					},
					{
						"setting": "t2_mouseover_open_behavior",
						"field": "name"
					},
					{
						"setting": "t3_mouseover_open_behavior",
						"field": "name"
					}
				]
			},
			"en": "Popup action",
			"es": "Acci\u00F3n del popup",
			"ko": "\uC774\uBBF8\uC9C0 \uD31D\uC5C5 \uC791\uC5C5",
			"pt-BR": "A\u00E7\u00E3o do popup ao passar o mouse",
			"ru": "\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430 \u043F\u0440\u0438 \u043D\u0430\u0432\u0435\u0434\u0435\u043D\u0438\u0435 \u043A\u0443\u0440\u0441\u043E\u0440\u0430",
			"zh-CN": "\u79FB\u52A8\u65F6\u5F39\u7A97\u7684\u52A8\u4F5C"
		},
		"Determines how the mouseover popup will open": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_open_behavior",
						"field": "description"
					},
					{
						"setting": "t2_mouseover_open_behavior",
						"field": "description"
					},
					{
						"setting": "t3_mouseover_open_behavior",
						"field": "description"
					}
				]
			},
			"ko": "\uB9C8\uC6B0\uC2A4\uC624\uBC84 \uD31D\uC5C5\uC774 \uC5F4\uB9AC\uB294 \uBC29\uC2DD",
			"pt-BR": "Determina como o popup ao passar o mouse ser\u00E1 aberto",
			"ru": "\u041E\u043F\u0440\u0435\u0434\u0435\u043B\u044F\u0435\u0442, \u043A\u0430\u043A \u043E\u0442\u043A\u0440\u043E\u0451\u0442\u0441\u044F \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u043F\u0440\u0438 \u043D\u0430\u0432\u0435\u0434\u0435\u043D\u0438\u0438 \u043A\u0443\u0440\u0441\u043E\u0440\u0430 \u043C\u044B\u0448\u0438.",
			"zh-CN": "\u51B3\u5B9A\u9F20\u6807\u60AC\u505C\u5F39\u7A97\u5C06\u6253\u5F00"
		},
		"Popup": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_open_behavior",
						"field": "options.popup.name"
					},
					{
						"setting": "mouseover_close_el_policy",
						"field": "options.popup.name"
					},
					{
						"setting": "t2_mouseover_open_behavior",
						"field": "options.popup.name"
					},
					{
						"setting": "t3_mouseover_open_behavior",
						"field": "options.popup.name"
					}
				]
			},
			"ko": "\uD31D\uC5C5",
			"pt-BR": "Popup",
			"ru": "\u0412\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E",
			"zh-CN": "\u5F39\u7A97"
		},
		"New tab": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_open_behavior",
						"field": "options.newtab.name"
					},
					{
						"setting": "t2_mouseover_open_behavior",
						"field": "options.newtab.name"
					},
					{
						"setting": "t3_mouseover_open_behavior",
						"field": "options.newtab.name"
					}
				]
			},
			"es": "Nueva pesta\u00F1a",
			"fr": "Nouvel onglet",
			"ko": "\uC0C8 \uD0ED",
			"pt-BR": "Nova aba",
			"ru": "\u041D\u043E\u0432\u0430\u044F \u0432\u043A\u043B\u0430\u0434\u043A\u0430",
			"zh-CN": "\u65B0\u6807\u7B7E\u9875"
		},
		"New background tab": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_open_behavior",
						"field": "options.newtab_bg.name"
					},
					{
						"setting": "t2_mouseover_open_behavior",
						"field": "options.newtab_bg.name"
					},
					{
						"setting": "t3_mouseover_open_behavior",
						"field": "options.newtab_bg.name"
					}
				]
			},
			"pt-BR": "Nova aba em segundo plano",
			"ru": "\u041D\u043E\u0432\u0430\u044F \u0444\u043E\u043D\u043E\u0432\u0430\u044F \u0432\u043A\u043B\u0430\u0434\u043A\u0430",
			"zh-CN": "\u65B0\u540E\u53F0\u6807\u7B7E\u9875"
		},
		"Download": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_open_behavior",
						"field": "options.download.name"
					},
					{
						"setting": "t2_mouseover_open_behavior",
						"field": "options.download.name"
					},
					{
						"setting": "t3_mouseover_open_behavior",
						"field": "options.download.name"
					}
				]
			},
			"pt-BR": "Baixar",
			"ru": "\u0421\u043A\u0430\u0447\u0430\u0442\u044C",
			"zh-CN": "\u4E0B\u8F7D"
		},
		"Copy link": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_open_behavior",
						"field": "options.copylink.name"
					},
					{
						"setting": "t2_mouseover_open_behavior",
						"field": "options.copylink.name"
					},
					{
						"setting": "t3_mouseover_open_behavior",
						"field": "options.copylink.name"
					}
				]
			},
			"pt-BR": "Copiar link",
			"ru": "\u041A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0441\u0441\u044B\u043B\u043A\u0443",
			"zh-CN": "\u590D\u5236\u94FE\u63A5"
		},
		"Replace": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_open_behavior",
						"field": "options.replace.name"
					},
					{
						"setting": "t2_mouseover_open_behavior",
						"field": "options.replace.name"
					},
					{
						"setting": "t3_mouseover_open_behavior",
						"field": "options.replace.name"
					}
				]
			},
			"pt-BR": "Substituir",
			"ru": "\u0417\u0430\u043C\u0435\u043D\u0438\u0442\u044C",
			"zh-CN": "\u66FF\u6362"
		},
		"Exclude page background": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_exclude_page_bg",
						"field": "name"
					},
					{
						"setting": "t2_mouseover_exclude_page_bg",
						"field": "name"
					},
					{
						"setting": "t3_mouseover_exclude_page_bg",
						"field": "name"
					}
				]
			},
			"ko": "\uD398\uC774\uC9C0 \uBC30\uACBD \uC81C\uC678",
			"pt-BR": "Excluir plano de fundo da p\u00E1gina",
			"ru": "\u0418\u0441\u043A\u043B\u044E\u0447\u0430\u0442\u044C \u0444\u043E\u043D \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u044B",
			"zh-CN": "\u6392\u9664\u9875\u9762\u80CC\u666F"
		},
		"Excludes the page background for the popup": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_exclude_page_bg",
						"field": "description"
					},
					{
						"setting": "t2_mouseover_exclude_page_bg",
						"field": "description"
					},
					{
						"setting": "t3_mouseover_exclude_page_bg",
						"field": "description"
					}
				]
			},
			"ko": "\uD31D\uC5C5\uC5D0 \uB300\uD55C \uD398\uC774\uC9C0 \uBC30\uACBD \uC81C\uC678",
			"pt-BR": "Exclui o plano de fundo da p\u00E1gina para o popup",
			"ru": "\u0418\u0441\u043A\u043B\u044E\u0447\u0430\u0435\u0442 \u0444\u043E\u043D \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u044B \u0434\u043B\u044F \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430.",
			"zh-CN": "\u907F\u514D\u4E3A\u9875\u9762\u80CC\u666F\u663E\u793A\u5F39\u7A97"
		},
		"Minimum size": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_minimum_size",
						"field": "name"
					},
					{
						"setting": "t2_mouseover_minimum_size",
						"field": "name"
					},
					{
						"setting": "t3_mouseover_minimum_size",
						"field": "name"
					}
				]
			},
			"pt-BR": "Tamanho m\u00EDnimo",
			"ru": "\u041C\u0438\u043D\u0438\u043C\u0430\u043B\u044C\u043D\u044B\u0439 \u0440\u0430\u0437\u043C\u0435\u0440",
			"zh-CN": "\u6700\u5C0F\u5C3A\u5BF8"
		},
		"Smallest size acceptable for the popup to open (this option is ignored for background images). This refers to the size of the media to be popped up, which may differ from the source media.": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_minimum_size",
						"field": "description"
					},
					{
						"setting": "t2_mouseover_minimum_size",
						"field": "description"
					},
					{
						"setting": "t3_mouseover_minimum_size",
						"field": "description"
					}
				]
			},
			"pt-BR": "Menor tamanho aceit\u00E1vel para o popup abrir (esta op\u00E7\u00E3o \u00E9 ignorada para imagens de fundo). Refere-se ao tamanho da m\u00EDdia a ser exibida no popup, que pode ser diferente da m\u00EDdia de origem.",
			"ru": "\u041D\u0430\u0438\u043C\u0435\u043D\u044C\u0448\u0438\u0439 \u0440\u0430\u0437\u043C\u0435\u0440, \u0434\u043E\u043F\u0443\u0441\u0442\u0438\u043C\u044B\u0439 \u0434\u043B\u044F \u043E\u0442\u043A\u0440\u044B\u0442\u0438\u044F \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430 (\u044D\u0442\u043E\u0442 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440 \u0438\u0433\u043D\u043E\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044F \u0434\u043B\u044F \u0444\u043E\u043D\u043E\u0432\u044B\u0445 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0439). \u042D\u0442\u043E \u043E\u0442\u043D\u043E\u0441\u0438\u0442\u0441\u044F \u043A \u0440\u0430\u0437\u043C\u0435\u0440\u0443 \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043C\u0435\u0434\u0438\u0430, \u043A\u043E\u0442\u043E\u0440\u044B\u0439 \u043C\u043E\u0436\u0435\u0442 \u043E\u0442\u043B\u0438\u0447\u0430\u0442\u044C\u0441\u044F \u043E\u0442 \u043E\u0440\u0438\u0433\u0438\u043D\u0430\u043B\u0430.",
			"zh-CN": "\u5141\u8BB8\u591A\u5C0F\u7684\u56FE\u50CF\u663E\u793A\u5F39\u7A97\u3002\u80CC\u666F\u56FE\u50CF\u4E0D\u88AB\u6B64\u9009\u9879\u6DB5\u76D6\u3002\u8FD9\u6307\u5C06\u8981\u5F39\u7A97\u663E\u793A\u7684\u5A92\u4F53\u5927\u5C0F\uFF0C\u8FD9\u53EF\u80FD\u4E0E\u6E90\u5A92\u4F53\u4E0D\u540C\u3002"
		},
		"Maximum source size": {
			"_info": {
				"instances": [
					{
						"setting": "popup_maximum_source_size",
						"field": "name"
					},
					{
						"setting": "t2_popup_maximum_source_size",
						"field": "name"
					},
					{
						"setting": "t3_popup_maximum_source_size",
						"field": "name"
					}
				]
			},
			"pt-BR": "Tamanho m\u00E1ximo da origem",
			"ru": "\u041C\u0430\u043A\u0441\u0438\u043C\u0430\u043B\u044C\u043D\u044B\u0439 \u0440\u0430\u0437\u043C\u0435\u0440 \u0438\u0441\u0442\u043E\u0447\u043D\u0438\u043A\u0430",
			"zh-CN": "\u6700\u5927\u6E90\u5C3A\u5BF8"
		},
		"Maximum size (width/height) for the source media to allow popping up (this option is ignored for background images). Set to `0` for any size.": {
			"_info": {
				"instances": [
					{
						"setting": "popup_maximum_source_size",
						"field": "description"
					},
					{
						"setting": "t2_popup_maximum_source_size",
						"field": "description"
					},
					{
						"setting": "t3_popup_maximum_source_size",
						"field": "description"
					}
				]
			},
			"pt-BR": "Tamanho m\u00E1ximo (largura/altura) para a m\u00EDdia de origem permitir a exibi\u00E7\u00E3o em popup (esta op\u00E7\u00E3o \u00E9 ignorada para imagens de fundo). Defina como `0` para qualquer tamanho.",
			"ru": "\u041C\u0430\u043A\u0441\u0438\u043C\u0430\u043B\u044C\u043D\u044B\u0439 \u0440\u0430\u0437\u043C\u0435\u0440 (\u0448\u0438\u0440\u0438\u043D\u0430/\u0432\u044B\u0441\u043E\u0442\u0430) \u0438\u0441\u0445\u043E\u0434\u043D\u043E\u0433\u043E \u043C\u0435\u0434\u0438\u0430\u0444\u0430\u0439\u043B\u0430 \u0434\u043B\u044F \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043D\u0438\u044F \u0432\u0441\u043F\u043B\u044B\u0442\u0438\u044F (\u044D\u0442\u043E\u0442 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440 \u0438\u0433\u043D\u043E\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044F \u0434\u043B\u044F \u0444\u043E\u043D\u043E\u0432\u044B\u0445 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0439). `0` - \u043B\u044E\u0431\u043E\u0439 \u0440\u0430\u0437\u043C\u0435\u0440.",
			"zh-CN": "\u4EE5\u6E90\u5A92\u4F53\u663E\u793A\u5F39\u7A97\u7684\u6700\u5927\u5C3A\u5BF8\uFF08\u5BBD\u5EA6/\u9AD8\u5EA6\uFF09\uFF08\u5BF9\u80CC\u666F\u56FE\u50CF\u6765\u8BF4\u6B64\u9009\u9879\u65E0\u6548)\u3002\u8BBE\u4E3A 0 \u8868\u793A\u4EFB\u610F\u5927\u5C0F\u3002"
		},
		"pixels": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_minimum_size",
						"field": "number_unit"
					},
					{
						"setting": "mouseover_jitter_threshold",
						"field": "number_unit"
					},
					{
						"setting": "mouseover_drag_min",
						"field": "number_unit"
					},
					{
						"setting": "popup_maximum_source_size",
						"field": "number_unit"
					},
					{
						"setting": "t2_mouseover_minimum_size",
						"field": "number_unit"
					},
					{
						"setting": "t3_mouseover_minimum_size",
						"field": "number_unit"
					},
					{
						"setting": "t2_popup_maximum_source_size",
						"field": "number_unit"
					},
					{
						"setting": "t3_popup_maximum_source_size",
						"field": "number_unit"
					}
				]
			},
			"pt-BR": "pixels",
			"ru": "\u043F\u0438\u043A\u0441.",
			"zh-CN": "\u50CF\u7D20"
		},
		"Exclude `background-image`s": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_exclude_backgroundimages",
						"field": "name"
					},
					{
						"setting": "t2_mouseover_exclude_backgroundimages",
						"field": "name"
					},
					{
						"setting": "t3_mouseover_exclude_backgroundimages",
						"field": "name"
					}
				]
			},
			"ko": "\uBC30\uACBD \uC774\uBBF8\uC9C0 \uC81C\uC678",
			"pt-BR": "Excluir imagens de fundo",
			"ru": "\u0418\u0441\u043A\u043B\u044E\u0447\u0430\u0442\u044C `background-image`",
			"zh-CN": "\u6392\u9664\u80CC\u666F\u56FE\u50CF"
		},
		"Excludes `background-image`s for the popup. Might prevent the popup from working on many images": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_exclude_backgroundimages",
						"field": "description"
					},
					{
						"setting": "t2_mouseover_exclude_backgroundimages",
						"field": "description"
					},
					{
						"setting": "t3_mouseover_exclude_backgroundimages",
						"field": "description"
					}
				]
			},
			"ko": "\uD31D\uC5C5\uC758 \uBC30\uACBD \uC774\uBBF8\uC9C0 \uC81C\uC678. \uD31D\uC5C5\uC774 \uB9CE\uC740 \uC774\uBBF8\uC9C0\uC5D0\uC11C \uC791\uB3D9\uD558\uC9C0 \uC54A\uC744 \uC218 \uC788\uC74C",
			"pt-BR": "Exclui imagens de fundo (`background-image`) do popup. Pode impedir que o popup funcione em muitas imagens",
			"ru": "\u0418\u0441\u043A\u043B\u044E\u0447\u0430\u0435\u0442 `background-image` \u0434\u043B\u044F \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0433\u043E \u043E\u043A\u043D\u0430. \u042D\u0442\u043E \u043C\u043E\u0436\u0435\u0442 \u043F\u043E\u043C\u0435\u0448\u0430\u0442\u044C \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u043C\u0443 \u043E\u043A\u043D\u0443 \u0440\u0430\u0431\u043E\u0442\u0430\u0442\u044C \u0441\u043E \u043C\u043D\u043E\u0433\u0438\u043C\u0438 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F\u043C\u0438.",
			"zh-CN": "\u4E0D\u4E3A\u80CC\u666F\u56FE\u50CF\u663E\u793A\u5F39\u7A97\u3002\u53EF\u80FD\u4F7F\u5F88\u591A\u56FE\u50CF\u4E0A\u4E0D\u663E\u793A\u5F39\u7A97"
		},
		"Enable videos": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_allow_video",
						"field": "name"
					},
					{
						"setting": "t2_mouseover_allow_video",
						"field": "name"
					},
					{
						"setting": "t3_mouseover_allow_video",
						"field": "name"
					}
				]
			},
			"pt-BR": "Habilitar v\u00EDdeos",
			"ru": "\u0412\u043A\u043B\u044E\u0447\u0438\u0442\u044C \u0432\u0438\u0434\u0435\u043E",
			"zh-CN": "\u652F\u6301\u89C6\u9891"
		},
		"Allows videos to be popped up": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_allow_video",
						"field": "description"
					},
					{
						"setting": "t2_mouseover_allow_video",
						"field": "description"
					},
					{
						"setting": "t3_mouseover_allow_video",
						"field": "description"
					}
				]
			},
			"pt-BR": "Permite que v\u00EDdeos sejam exibidos em popup",
			"ru": "\u041F\u043E\u0437\u0432\u043E\u043B\u044F\u0435\u0442 \u043E\u0442\u043A\u0440\u044B\u0432\u0430\u0442\u044C \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435\u0435 \u043E\u043A\u043D\u043E \u0434\u043B\u044F \u0432\u0438\u0434\u0435\u043E",
			"zh-CN": "\u5141\u8BB8\u89C6\u9891\u5F39\u7A97"
		},
		"Enable audio": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_allow_audio",
						"field": "name"
					},
					{
						"setting": "t2_mouseover_allow_audio",
						"field": "name"
					},
					{
						"setting": "t3_mouseover_allow_audio",
						"field": "name"
					}
				]
			},
			"pt-BR": "Habilitar \u00E1udio",
			"ru": "\u0412\u043A\u043B\u044E\u0447\u0438\u0442\u044C \u0430\u0443\u0434\u0438\u043E",
			"zh-CN": "\u542F\u7528\u97F3\u9891"
		},
		"Allows audio to be popped up. Currently experimental.\nThis only applies to audio files. Videos that contains audio are supported regardless of this setting.": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_allow_audio",
						"field": "description"
					},
					{
						"setting": "t2_mouseover_allow_audio",
						"field": "description"
					},
					{
						"setting": "t3_mouseover_allow_audio",
						"field": "description"
					}
				]
			},
			"pt-BR": "Permite que \u00E1udio seja exibido em popup. Atualmente experimental.\nIsso se aplica apenas a arquivos de \u00E1udio. V\u00EDdeos que cont\u00EAm \u00E1udio s\u00E3o suportados independentemente desta configura\u00E7\u00E3o.",
			"ru": "\u041F\u043E\u0437\u0432\u043E\u043B\u044F\u0435\u0442 \u043E\u0442\u043A\u0440\u044B\u0432\u0430\u0442\u044C \u0432\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E \u0434\u043B\u044F \u0430\u0443\u0434\u0438\u043E. \u0412 \u043D\u0430\u0441\u0442\u043E\u044F\u0449\u0435\u0435 \u0432\u0440\u0435\u043C\u044F \u044D\u043A\u0441\u043F\u0435\u0440\u0438\u043C\u0435\u043D\u0442\u0430\u043B\u044C\u043D\u044B\u0439.\n\u042D\u0442\u043E \u043E\u0442\u043D\u043E\u0441\u0438\u0442\u0441\u044F \u0442\u043E\u043B\u044C\u043A\u043E \u043A \u0430\u0443\u0434\u0438\u043E\u0444\u0430\u0439\u043B\u0430\u043C. \u0412\u0438\u0434\u0435\u043E, \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0435 \u0430\u0443\u0434\u0438\u043E, \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044E\u0442\u0441\u044F \u043D\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043C\u043E \u043E\u0442 \u044D\u0442\u043E\u0439 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438.",
			"zh-CN": "\u5141\u8BB8\u97F3\u9891\u5F39\u7A97\u3002\u76EE\u524D\u5904\u4E8E\u5B9E\u9A8C\u9636\u6BB5\u3002\n\u8FD9\u4EC5\u9002\u7528\u4E8E\u97F3\u9891\u6587\u4EF6\u3002\u5305\u542B\u97F3\u9891\u7684\u89C6\u9891\u65E0\u5173\u6B64\u8BBE\u7F6E\u3002"
		},
		"Allow HLS/DASH streams": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_allow_hlsdash",
						"field": "name"
					},
					{
						"setting": "t2_mouseover_allow_hlsdash",
						"field": "name"
					},
					{
						"setting": "t3_mouseover_allow_hlsdash",
						"field": "name"
					}
				]
			},
			"pt-BR": "Permitir streams HLS/DASH",
			"ru": "\u0420\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044C \u043F\u043E\u0442\u043E\u043A\u0438 HLS/DASH",
			"zh-CN": "\u5141\u8BB8 HLS/DASH \u6D41"
		},
		"Allows playback of HLS/DASH streams": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_allow_hlsdash",
						"field": "description"
					},
					{
						"setting": "t2_mouseover_allow_hlsdash",
						"field": "description"
					},
					{
						"setting": "t3_mouseover_allow_hlsdash",
						"field": "description"
					}
				]
			},
			"pt-BR": "Permite a reprodu\u00E7\u00E3o de streams HLS/DASH",
			"ru": "\u041F\u043E\u0437\u0432\u043E\u043B\u044F\u0435\u0442 \u0432\u043E\u0441\u043F\u0440\u043E\u0438\u0437\u0432\u043E\u0434\u0438\u0442\u044C \u043F\u043E\u0442\u043E\u043A\u0438 HLS/DASH.",
			"zh-CN": "\u5141\u8BB8\u64AD\u653E HLS/DASH \u6D41"
		},
		"Dailymotion": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_allow_hlsdash",
						"field": "example_websites[0]"
					},
					{
						"setting": "t2_mouseover_allow_hlsdash",
						"field": "example_websites[0]"
					},
					{
						"setting": "t3_mouseover_allow_hlsdash",
						"field": "example_websites[0]"
					}
				]
			},
			"pt-BR": "Dailymotion",
			"ru": "\u0415\u0436\u0435\u0434\u043D\u0435\u0432\u043D\u043E\u0435\u0434\u0432\u0438\u0436\u0435\u043D\u0438\u0435",
			"zh-CN": "Dailymotion"
		},
		"Instagram (higher quality)": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_allow_hlsdash",
						"field": "example_websites[1]"
					},
					{
						"setting": "t2_mouseover_allow_hlsdash",
						"field": "example_websites[1]"
					},
					{
						"setting": "t3_mouseover_allow_hlsdash",
						"field": "example_websites[1]"
					}
				]
			},
			"pt-BR": "Instagram (maior qualidade)",
			"ru": "Instagram (\u043A\u0430\u0447\u0435\u0441\u0442\u0432\u043E \u0432\u044B\u0448\u0435)",
			"zh-CN": "Instagram\uFF08\u66F4\u9AD8\u8D28\u91CF\uFF09"
		},
		"Reddit": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_allow_hlsdash",
						"field": "example_websites[2]"
					},
					{
						"setting": "t2_mouseover_allow_hlsdash",
						"field": "example_websites[2]"
					},
					{
						"setting": "t3_mouseover_allow_hlsdash",
						"field": "example_websites[2]"
					}
				]
			},
			"pt-BR": "Reddit",
			"ru": "Reddit",
			"zh-CN": "Reddit"
		},
		"YouTube (higher quality)": {
			"_info": {
				"instances": [
					{
						"setting": "mouseover_allow_hlsdash",
						"field": "example_websites[3]"
					},
					{
						"setting": "t2_mouseover_allow_hlsdash",
						"field": "example_websites[3]"
					},
					{
						"setting": "t3_mouseover_allow_hlsdash",
						"field": "example_websites[3]"
					}
				]
			},
			"pt-BR": "YouTube (maior qualidade)",
			"ru": "YouTube (\u043A\u0430\u0447\u0435\u0441\u0442\u0432\u043E \u0432\u044B\u0448\u0435)",
			"zh-CN": "YouTube\uFF08\u66F4\u9AD8\u8D28\u91CF\uFF09"
		}
	};

	var get_language_aliases = function(language) {
		var aliases = [language];

		var language_nosub = language.replace(/-.*/, "");
		if (language_nosub !== language) aliases.push(language_nosub);

		return aliases;
	};

	function _(str:any, ...args):any {
		if (typeof str !== "string") {
			return str;
		}

		var languages = get_language_aliases(settings.language);

		if (str in strings) {
			var found = false;

			for (var i = 0; i < languages.length; i++) {
				var language = languages[i];
				if (language in strings[str]) {
					str = strings[str][language];
					found = true;
					break;
				}
			}

			if (!found && language !== "en" && "en" in strings[str]) {
				str = strings[str]["en"];
			}
		}

		// most strings don't contain %
		if (string_indexof(str, "%") < 0) {
			return str;
		}

		var parts = [];
		var currentpart = "";
		for (var i = 0; i < str.length; i++) {
			if (str[i] == '%') {
				if ((i + 2) < str.length) {
					if (str[i + 1] == '%') {
						var num = parse_int(str[i + 2]);
						if (!isNaN(num)) {
							parts.push(currentpart);
							currentpart = "";
							parts.push(arguments[num]);
							i += 2;
							continue;
						}
					}
				}
			}

			currentpart += str[i];
		}

		parts.push(currentpart);
		return parts.join("");
	}

	var old_settings_keys = [
		"mouseover_trigger",
		"mouseover_use_fully_loaded_video",
		"mouseover_use_fully_loaded_image",
		"mouseover_close_on_leave_el",
		"mouseover_scroll_behavior",
		"mouseover_mask_styles",
		"mouseover_video_seek_vertical_scroll",
		"mouseover_video_seek_horizontal_scroll",
		"mouseover_support_pointerevents_none",
		"mouseover_enable_mask_styles",
		"allow_video",
		"allow_audio",
		"replaceimgs_remove_size_constraints"
	];

	var settings = {
		// thanks to decembre on github for the idea: https://github.com/qsniyg/maxurl/issues/14#issuecomment-530760246
		imu_enabled: true,
		language: browser_language,
		check_updates: true,
		check_update_interval: 24,
		check_update_notify: false,
		// thanks to forefix on firefox for the idea: https://github.com/qsniyg/maxurl/issues/189
		dark_mode: false,
		settings_tabs: true,
		// thanks to ambler on discord for the idea
		settings_alphabetical_order: false,
		settings_visible_description: true,
		settings_show_disabled: true,
		settings_show_disabled_profiles: false,
		settings_show_requirements: true,
		advanced_options: false,
		allow_browser_request: true,
		retry_503_times: 3,
		retry_503_ms: 2000,
		use_blob_over_arraybuffer: false,
		allow_live_settings_reload: true,
		allow_remote: true,
		disable_keybind_when_editing: true,
		enable_gm_download: true,
		gm_download_max: 15,
		// thanks to pax romana on discord for the idea: https://github.com/qsniyg/maxurl/issues/372
		// this must be false, because it requires a permission
		enable_webextension_download: false,
		// thanks to Michael82548 on github for the idea: https://github.com/qsniyg/maxurl/issues/848
		enable_console_logging: true,
		// this must be false for the extension because it requires a permission
		write_to_clipboard: false,
		redirect: true,
		redirect_video: true,
		redirect_audio: false,
		redirect_history: true,
		redirect_extension: true,
		canhead_get: true,
		redirect_force_page: false,
		// thanks to DevWannabe-dot on github for the idea: https://github.com/qsniyg/maxurl/issues/822
		redirect_enable_infobox: true,
		// thanks to fireattack on discord for the idea: https://github.com/qsniyg/maxurl/issues/324
		redirect_infobox_url: false,
		redirect_infobox_timeout: 7,
		print_imu_obj: false,
		redirect_disable_for_responseheader: false,
		redirect_to_no_infobox: false,
		// thanks to nijaz-lab on github for the idea: https://github.com/qsniyg/maxurl/issues/557
		redirect_host_html: false,
		host_html_blacklist: "",
		host_html_blacklist_mode: "blacklist",
		mouseover: true,
		// thanks to blue-lightning on github for the idea: https://github.com/qsniyg/maxurl/issues/16
		mouseover_open_behavior: "popup",
		//mouseover_trigger: ["ctrl", "shift"],
		mouseover_trigger_behavior: "keyboard",
		// thanks to 894-572 on github for the idea: https://github.com/qsniyg/maxurl/issues/30
		mouseover_trigger_key: ["shift", "alt", "i"],
		mouseover_trigger_key_t2: [],
		mouseover_trigger_key_t3: [],
		mouseover_trigger_delay: 1,
		mouseover_trigger_mouseover: false,
		// thanks to lnp5131 on github for the idea: https://github.com/qsniyg/maxurl/issues/421
		mouseover_trigger_enabledisable_toggle: "disable",
		mouseover_trigger_prevent_key: ["shift"],
		// also thanks to blue-lightning: https://github.com/qsniyg/maxurl/issues/16
		mouseover_close_behavior: "esc",
		// thanks to acid-crash on github for the idea: https://github.com/qsniyg/maxurl/issues/14#issuecomment-436594057
		mouseover_close_need_mouseout: true,
		mouseover_jitter_threshold: 30,
		mouseover_cancel_popup_when_elout: true,
		mouseover_cancel_popup_with_esc: true,
		// thanks to cosuwi on github for the idea: https://github.com/qsniyg/maxurl/issues/367
		mouseover_cancel_popup_when_release: true,
		// thanks to remlap on discord for the idea: https://github.com/qsniyg/maxurl/issues/250
		mouseover_auto_close_popup: false,
		mouseover_auto_close_popup_time: 5,
		// thanks to decembre on github for the idea: https://github.com/qsniyg/maxurl/issues/14#issuecomment-530760246
		//mouseover_use_hold_key: true,
		mouseover_hold_key: ["i"],
		mouseover_hold_position_center: false,
		popup_hold_zoom: "none",
		mouseover_hold_close_unhold: false,
		mouseover_hold_unclickthrough: true,
		// thanks to decembre on github for the idea: https://github.com/qsniyg/maxurl/issues/14#issuecomment-531549043
		//mouseover_close_on_leave_el: true,
		mouseover_close_el_policy: "both",
		// thanks to hosa dokha on greasyfork for the idea: https://greasyfork.org/en/forum/discussion/71894/this-script-is-a-dream-come-true-just-1-thing
		mouseover_close_click_outside: false,
		// thanks to decembre on github for the idea: https://github.com/qsniyg/maxurl/issues/126
		mouseover_allow_partial: is_extension ? "media" : "video",
		mouseover_partial_avoid_head: false,
		mouseover_use_blob_over_data: false,
		// https://github.com/qsniyg/maxurl/issues/667
		popup_use_anonymous_crossorigin: false,
		mouseover_enable_notallowed: true,
		// thanks to Rnksts on discord for the idea
		mouseover_enable_notallowed_cant_load: true,
		mouseover_notallowed_duration: 300,
		//mouseover_use_fully_loaded_image: is_extension ? false : true,
		//mouseover_use_fully_loaded_video: false,
		mouseover_minimum_size: 20,
		// thanks to Raitzu on discord for the idea
		popup_maximum_source_size: 0,
		mouseover_exclude_backgroundimages: false,
		// thanks to decembre on github for the idea: https://github.com/qsniyg/maxurl/issues/14#issuecomment-530760246
		mouseover_exclude_page_bg: true,
		mouseover_exclude_imagemaps: true,
		// thanks to Jin on discord for the idea
		mouseover_only_links: false,
		mouseover_linked_image: false,
		mouseover_exclude_sameimage: false,
		mouseover_exclude_imagetab: true,
		mouseover_allow_video: true,
		mouseover_allow_audio: false,
		mouseover_allow_hlsdash: true,
		enable_stream_download: false,
		stream_mux_mp4_over_mkv: false,
		hls_dash_use_max: true,
		max_video_quality: null,
		// thanks to Noodlers on discord for the idea: https://github.com/qsniyg/maxurl/issues/642
		mouseover_video_autoplay: true,
		mouseover_video_controls: false,
		mouseover_video_controls_key: ["c"],
		mouseover_video_loop: true,
		// thanks to Runakanta on discord for the idea: https://github.com/qsniyg/maxurl/issues/403
		mouseover_video_autoloop_max: 0,
		mouseover_video_playpause_key: ["space"],
		mouseover_video_muted: false,
		mouseover_video_mute_key: ["m"],
		mouseover_video_volume: 100,
		mouseover_video_volume_down_key: ["9"],
		mouseover_video_volume_up_key: ["0"],
		mouseover_video_volume_change_amt: 5,
		mouseover_video_resume_from_source: false,
		mouseover_video_resume_if_different: false,
		mouseover_video_pause_source: true,
		mouseover_video_seek_amount: 10,
		mouseover_video_seek_left_key: ["shift", "left"],
		mouseover_video_seek_right_key: ["shift", "right"],
		//mouseover_video_seek_vertical_scroll: false,
		//mouseover_video_seek_horizontal_scroll: false,
		mouseover_video_frame_prev_key: [","],
		mouseover_video_frame_next_key: ["."],
		mouseover_video_framerate: 25,
		mouseover_video_speed_down_key: ["["],
		mouseover_video_speed_up_key: ["]"],
		mouseover_video_speed_amount: 0.25,
		// thanks to Rnksts on discord for the idea
		mouseover_video_reset_speed_key: ["backspace"],
		mouseover_video_screenshot_key: ["shift", "s"],
		// thanks to remlap for the idea: https://github.com/qsniyg/maxurl/issues/666
		popup_video_screenshot_format: "png",
		popup_enable_subtitles: true,
		mouseover_ui: true,
		// thanks to Runakanta on discord for the idea
		mouseover_ui_toggle_key: ["u"],
		mouseover_ui_opacity: 80,
		mouseover_ui_use_safe_glyphs: false,
		mouseover_ui_imagesize: true,
		mouseover_ui_zoomlevel: true,
		mouseover_ui_filesize: false,
		mouseover_ui_gallerycounter: true,
		mouseover_ui_gallerymax: 50,
		// thanks to pacep94616 on github for the idea: https://github.com/qsniyg/maxurl/issues/225
		mouseover_ui_gallerybtns: true,
		mouseover_ui_closebtn: true,
		mouseover_ui_optionsbtn: is_userscript ? true : false,
		mouseover_ui_downloadbtn: false,
		mouseover_ui_rotationbtns: false,
		mouseover_ui_caption: true,
		mouseover_ui_wrap_caption: true,
		mouseover_ui_caption_link_page: true,
		mouseover_ui_link_underline: true,
		mouseover_use_remote: false,
		mouseover_zoom_behavior: "fit",
		// thanks to decembre on github for the idea: https://github.com/qsniyg/maxurl/issues/14#issuecomment-531080061
		mouseover_zoom_custom_percent: 100,
		// thanks to Michael82548 on github for the idea: https://github.com/qsniyg/maxurl/issues/701
		mouseover_zoom_use_last: "gallery",
		mouseover_zoom_max_width: 0,
		mouseover_zoom_max_height: 0,
		mouseover_pan_behavior: "drag",
		mouseover_movement_inverted: true,
		mouseover_drag_min: 5,
		mouseover_scrolly_behavior: "zoom",
		// thanks to madman06 on greasyfork for the idea: https://greasyfork.org/en/scripts/36662-image-max-url/discussions/90341
		mouseover_scrolly_hold_behavior: "default",
		mouseover_scrollx_behavior: "gallery",
		mouseover_scrollx_hold_behavior: "default",
		// thanks to Runakanta on discord for the idea
		mouseover_scrolly_video_behavior: "default",
		mouseover_scrolly_video_invert: false,
		mouseover_scrollx_video_behavior: "default",
		// thanks to regis on discord for the idea
		scroll_override_page: false,
		// thanks to regis on discord for the idea
		scroll_zoom_origin: "cursor",
		// thanks to Noodlers on discord for the idea
		scroll_zoomout_pagemiddle: "never",
		scroll_zoom_behavior: "fitfull",
		// thanks to regis on discord for the idea
		scroll_incremental_mult: 1.25,
		mouseover_move_with_cursor: false,
		// thanks to regis on discord for the idea
		mouseover_move_within_page: true,
		zoom_out_to_close: false,
		// thanks to Runakanta on discord for the idea: https://github.com/qsniyg/maxurl/issues/471
		scroll_past_gallery_end_to_close: false,
		// thanks to 07416 on github for the idea: https://github.com/qsniyg/maxurl/issues/20#issuecomment-439599984
		mouseover_position: "cursor",
		// thanks to decembre on github for the idea: https://github.com/qsniyg/maxurl/issues/14#issuecomment-531549043
		mouseover_prevent_cursor_overlap: true,
		mouseover_overflow_position_center: false,
		mouseover_overflow_origin: "a11",
		mouseover_add_link: true,
		mouseover_add_video_link: false,
		// thanks to bitst0rm on greasyfork for the idea: https://github.com/qsniyg/maxurl/issues/498
		mouseover_click_image_close: false,
		mouseover_click_video_close: false,
		mouseover_download: false,
		mouseover_hide_cursor: false,
		mouseover_hide_cursor_after: 0,
		mouseover_mouse_inactivity_jitter: 5,
		// thanks to thewhiterabbit- on reddit for the idea: https://github.com/qsniyg/maxurl/issues/331
		mouseover_clickthrough: false,
		mouseover_mask_ignore_clicks: false,
		// also thanks to 07416: https://github.com/qsniyg/maxurl/issues/25
		mouseover_links: true,
		// thanks to LoneFenris: https://github.com/qsniyg/maxurl/issues/25#issuecomment-482880122
		mouseover_only_valid_links: true,
		mouseover_allow_self_pagelink: false,
		mouseover_allow_iframe_el: false,
		mouseover_allow_canvas_el: false,
		mouseover_allow_svg_el: false,
		mouseover_enable_gallery: true,
		mouseover_gallery_cycle: false,
		mouseover_gallery_prev_key: ["left"],
		mouseover_gallery_next_key: ["right"],
		mouseover_gallery_move_after_video: false,
		// https://github.com/qsniyg/maxurl/issues/284
		// thanks to shivsah on github for the inspiration: https://github.com/qsniyg/maxurl/issues/95
		mouseover_gallery_download_key: ["shift", "d"],
		gallery_download_method: "zip",
		gallery_download_unchanged: true,
		gallery_zip_filename_format: "{host_domain_nosub}-{items_amt}-{download_unix}\n{items_amt}-{download_unix}",
		gallery_jd_autostart: false,
		gallery_jd_referer: "domain",
		gallery_zip_add_tld: true,
		gallery_zip_add_info_file: true,
		// thanks to acid-crash on github for the idea: https://github.com/qsniyg/maxurl/issues/20
		mouseover_styles: "",
		mouseover_enable_fade: true,
		mouseover_enable_zoom_effect: false,
		mouseover_zoom_effect_move: false,
		mouseover_fade_time: 100,
		mouseover_enable_mask_styles2: "never",
		mouseover_mask_styles2: "background-color: rgba(0, 0, 0, 0.5)",
		mouseover_mask_fade_time: 100,
		mouseover_ui_styles: "",
		// thanks to decembre on github for the idea: https://github.com/qsniyg/maxurl/issues/14#issuecomment-541065461
		mouseover_wait_use_el: false,
		mouseover_add_to_history: false,
		mouseover_add_thumbnail_to_history: false,
		mouseover_close_key: ["esc"],
		mouseover_download_key: [["s"], ["ctrl", "s"]],
		mouseover_open_new_tab_key: ["o"],
		mouseover_open_bg_tab_key: ["shift", "o"],
		mouseover_copy_link_key: ["shift", "c"],
		mouseover_open_options_key: ["p"],
		// thanks to Иван Хомяков on greasyfork for the idea: https://greasyfork.org/en/forum/discussion/comment/99404/#Comment_99404
		mouseover_open_orig_page_key: ["n"],
		mouseover_rotate_left_key: ["e"],
		mouseover_rotate_right_key: ["r"],
		mouseover_flip_horizontal_key: ["h"],
		mouseover_flip_vertical_key: ["v"],
		mouseover_zoom_in_key: [["+"], ["="], ["shift", "="]],
		mouseover_zoom_out_key: [["-"]],
		mouseover_zoom_full_key: ["1"],
		mouseover_zoom_fit_key: ["2"],
		mouseover_fullscreen_key: ["f"],
		mouseover_apply_blacklist: true,
		host_blacklist: "",
		host_blacklist_mode: "blacklist",
		apply_blacklist_host: false,
		mouseover_matching_media_types: false,
		// thanks to ComedicFox on discord for the idea: https://github.com/qsniyg/maxurl/issues/811
		mouseover_allow_popup_when_fullscreen: false,
		//mouseover_support_pointerevents_none: false,
		mouseover_find_els_mode: "hybrid",
		popup_allow_cache: true,
		popup_cache_duration: 30,
		popup_cache_itemlimit: 20,
		popup_cache_resume_video: true,
		website_inject_imu: true,
		website_image: true,
		extension_contextmenu: true,
		extension_hotreload: true,
		allow_watermark: false,
		allow_smaller: false,
		allow_possibly_different: false,
		allow_possibly_broken: false,
		allow_possibly_upscaled: false,
		allow_uncropped: true,
		allow_thirdparty: false,
		allow_apicalls: true,
		allow_thirdparty_libs: is_userscript ? false : true,
		custom_xhr_for_lib: is_extension ? true : false,
		bypass_csp_for_lib: false,
		use_webarchive_for_lib: false,
		lib_integrity_check: true,
		allow_thirdparty_code: false,
		allow_bruteforce: false,
		allow_webarchive: false,
		process_format: {},
		browser_cookies: true,
		deviantart_prefer_size: false,
		deviantart_support_download: true,
		ehentai_full_image: true,
		imgur_filename: false,
		imgur_source: false,
		instagram_use_app_api: false,
		instagram_dont_use_web: false,
		instagram_prefer_video_quality: true,
		instagram_gallery_postlink: false,
		snapchat_orig_media: true,
		teddit_redirect_reddit: true,
		tiktok_app_api: false,
		tiktok_no_watermarks: false,
		tiktok_thirdparty: null,
		// just a very small protection against github scraping bots :)
		tumblr_api_key: base64_decode("IHhyTXBMTThuMWVDZUwzb1JZU1pHN0NMQUx3NkVIaFlEZFU2V3E1ZUQxUGJNa2xkN1kx").substr(1),
		// thanks to modelfe on github for the idea: https://github.com/qsniyg/maxurl/issues/639
		twitter_use_ext: false,
		youtube_replace_n: false,
		// thanks to LukasThyWalls on github for the idea: https://github.com/qsniyg/maxurl/issues/75
		bigimage_blacklist: "",
		bigimage_blacklist_mode: "blacklist",
		bigimage_blacklist_engine: "glob",
		filename_format: "{author_username} {filename}",
		filename_replace_special_underscores: true,
		replaceimgs_enable_keybinding: false,
		replaceimgs_keybinding: ["shift", "alt", "r"],
		replaceimgs_auto: false,
		replaceimgs_replaceimgs: true,
		replaceimgs_addlinks: false,
		replaceimgs_replacelinks: false,
		// thanks to elvisef on github for the idea: https://github.com/qsniyg/maxurl/issues/617
		replaceimgs_plainlinks: "none",
		// thanks to nijaz-lab on github for the idea: https://github.com/qsniyg/maxurl/issues/550
		replaceimgs_links_newtab: false,
		// thanks to elvisef on github for the idea: https://github.com/qsniyg/maxurl/issues/593#issuecomment-754609502
		//replaceimgs_remove_size_constraints: false,
		// thanks to elvisef on github for the idea to remove size constraints: https://github.com/qsniyg/maxurl/issues/593#issuecomment-754609502
		// thanks to Raitzu on discord for the idea to enforce size constraints
		replaceimgs_size_constraints: "none",
		replaceimgs_usedata: is_userscript ? true : false,
		replaceimgs_wait_fullyloaded: true,
		replaceimgs_totallimit: 8,
		replaceimgs_domainlimit: 2,
		replaceimgs_delay: 0,
		replaceimgs_css: "",
		replaceimgs_simple_progress: true,
		highlightimgs_enable_keybinding: false,
		highlightimgs_keybinding: ["shift", "alt", "h"],
		highlightimgs_enable: false,
		highlightimgs_auto: "never",
		highlightimgs_onlysupported: true,
		highlightimgs_css: "outline: 4px solid yellow",
		customgallery_enable_keybinding: false,
		customgallery_keybinding: ["shift", "alt", "g"],
		customgallery_enable_button: false,
		customgallery_apply_key: ["enter"],
		customgallery_bg_css: "background-color: rgba(0, 0, 0, 0.25)",
		customgallery_outline_css: "background-color: rgba(255, 0, 0, 0.25)\nborder: 2px solid red",
		// cache entries (not settings, but this is the most convenient way to do it)
		last_update_check: 0,
		last_update_version: null,
		last_update_url: null
	};
	//var orig_settings = deepcopy(settings);

	var sensitive_settings = [
		"tumblr_api_key"
	];

	var user_defined_settings = {};

	var num_profiles = 2;

	type SRequiresInfo = Record<string, any>
	type RequiresInfo = SRequiresInfo|Array<SRequiresInfo>|string;

	type SettingMeta = {
		name:string,
		description:string,
		description_userscript?:string,
		documentation?:{title:string,value:string},
		example_websites?:Array<string>,
		category:string,
		subcategory?:string,
		onedit?:(value?:any)=>void,
		onupdate?:()=>void,
		type?:"number"|"keysequence"|"textarea"|"lineedit",
		number_min?:number,
		number_max?:number,
		number_int?:boolean,
		number_unit?:string,
		keyseq_allow_none?:boolean,
		userscript_only?:boolean,
		extension_only?:boolean,
		imu_enabled_exempt?:boolean,
		required_permission?:string,
		options?:Object, // todo: fill in?,
		requires?:RequiresInfo,
		disabled_if?:RequiresInfo,
		profiled?:boolean,
		advanced?:boolean,
		warning?:Record<string, string>,
		hidden?:boolean,
		needrefresh?:boolean
	};

	var settings_meta:Record<string, SettingMeta> = {
		imu_enabled: {
			name: "Enable extension",
			description: "Globally enables or disables the extension",
			category: "general",
			// Userscript users can easily disable it from the userscript menu,
			//   and enabling it again isn't as trivial as it is for the extension
			extension_only: true,
			imu_enabled_exempt: true
		},
		language: {
			name: "Language",
			description: "Language for this extension",
			category: "general",
			options: {
				_type: "combo",
				en: {
					name: "English",
					name_gettext: false
				},
				es: {
					name: "Espa\u00F1ol",
					name_gettext: false
				},
				fr: {
					name: "Fran\u00E7ais",
					name_gettext: false
				},
				it: {
					name: "Italiano",
					name_gettext: false
				},
				ko: {
					name: "\uD55C\uAD6D\uC5B4",
					name_gettext: false
				},
				"pt-BR": {
					name: "Portugu\u00EAs (Brasil)",
					name_gettext: false
				},
				ru: {
					name: "\u0420\u0443\u0441\u0441\u043A\u0438\u0439",
					name_gettext: false
				},
				"zh-CN": {
					name: "\u7B80\u4F53\u4E2D\u6587",
					name_gettext: false
				}
			},
			onedit: function() {
				run_soon(do_options);
			},
			imu_enabled_exempt: true
		},
		dark_mode: {
			name: "Dark mode",
			description: "Changes the colors to have light text on a dark background",
			category: "general",
			onedit: update_dark_mode,
			onupdate: update_dark_mode,
			imu_enabled_exempt: true
		},
		settings_visible_description: {
			name: "Description below options",
			description: "Shows the description below the options (otherwise the description is only shown when you hover over the option's name)",
			category: "general",
			subcategory: "settings",
			onedit: function() {
				run_soon(do_options);
			},
			imu_enabled_exempt: true
		},
		settings_show_disabled: {
			name: "Show disabled options",
			description: "If disabled, options that are disabled due to their requirements being unmet will not be displayed",
			category: "general",
			subcategory: "settings",
			onedit: function() {
				run_soon(do_options);
			},
			imu_enabled_exempt: true
		},
		settings_show_disabled_profiles: {
			name: "Show disabled trigger profiles",
			description: "If disabled, options for alternate trigger profiles (options with `(#2)` after them) will not be shown if the relevant trigger isn't active",
			category: "general",
			subcategory: "settings",
			requires: {
				settings_show_disabled: true
			},
			onedit: function() {
				run_soon(do_options);
			},
			imu_enabled_exempt: true
		},
		settings_show_requirements: {
			name: "Requirements below disabled options",
			description: "If an option is disabled, the requirements to enable the option will be displayed below it",
			category: "general",
			subcategory: "settings",
			onedit: function() {
				run_soon(do_options);
			},
			requires: {
				settings_show_disabled: true
			},
			imu_enabled_exempt: true
		},
		check_updates: {
			name: "Check for updates",
			description: "Periodically checks for updates. If a new update is available, it will be shown at the top of the options page",
			category: "general",
			subcategory: "update"
		},
		check_update_interval: {
			name: "Update check interval",
			description: "How often to check for updates",
			category: "general",
			subcategory: "update",
			requires: {
				check_updates: true
			},
			type: "number",
			number_min: 1,
			number_int: true,
			number_unit: "hours"
		},
		check_update_notify: {
			name: "Notify when update is available",
			description: "Creates a browser notification when an update is available",
			category: "general",
			subcategory: "update",
			requires: {
				check_updates: true
			},
			required_permission: "notifications"
		},
		advanced_options: {
			name: "Show advanced settings",
			description: "If disabled, settings that might be harder to understand will be hidden",
			category: "general",
			subcategory: "settings",
			onedit: function() {
				run_soon(do_options);
			},
			imu_enabled_exempt: true
		},
		settings_tabs: {
			name: "Use tabs",
			description: "If disabled, all settings will be shown on a single page",
			category: "general",
			subcategory: "settings",
			onedit: function() {
				run_soon(do_options);
			},
			imu_enabled_exempt: true
		},
		settings_alphabetical_order: {
			name: "Alphabetical order",
			description: "Lists options in alphabetical order",
			category: "general",
			subcategory: "settings",
			onedit: function() {
				run_soon(do_options);
			},
			imu_enabled_exempt: true
		},
		allow_browser_request: {
			name: "Allow using browser XHR",
			description: "This allows XHR requests to be run in the browser's context if they fail in the extension (e.g. when Tracking Protection is set to High)",
			category: "general",
			imu_enabled_exempt: true,
			advanced: true
		},
		retry_503_times: {
			name: "Retry requests with 503 errors",
			description: "Amount of times to retry a request when 503 (service unavailable) is returned by the server",
			category: "general",
			type: "number",
			number_min: 0,
			number_int: true,
			number_unit: "times",
			imu_enabled_exempt: true,
			advanced: true
		},
		retry_503_ms: {
			name: "Delay between 503 retries",
			description: "Time (in milliseconds) to delay between retrying requests that received 503",
			category: "general",
			type: "number",
			number_min: 0,
			number_int: true,
			number_unit: "ms",
			imu_enabled_exempt: true,
			advanced: true
		},
		use_blob_over_arraybuffer: {
			name: "Use `Blob` over `ArrayBuffer`",
			description: "Uses `Blob`s for XHRs instead of `ArrayBuffer`s. Keep this enabled unless your userscript manager doesn't support blob requests",
			category: "general",
			imu_enabled_exempt: true,
			advanced: true,
			hidden: true
		},
		allow_live_settings_reload: {
			name: "Live settings reloading",
			description: "Enables/disables live settings reloading. There shouldn't be a reason to disable this unless you're experiencing issues with this feature",
			category: "general",
			hidden: is_userscript && typeof GM_addValueChangeListener === "undefined",
			imu_enabled_exempt: true,
			advanced: true
		},
		disable_keybind_when_editing: {
			name: "Disable keybindings when editing text",
			description: "Disables shortcuts when key events are sent to an input area on the page",
			category: "keybinds",
			imu_enabled_exempt: true,
			advanced: true
		},
		enable_gm_download: {
			name: "Use `GM_download` if available",
			description: "Prefers using `GM_download` over simple browser-based downloads, if the function is available. Some userscript managers download the entire file before displaying a save dialog, which can be undesirable for large video files",
			category: "general",
			userscript_only: true,
			imu_enabled_exempt: true,
			advanced: true
		},
		gm_download_max: {
			name: "Maximum size to `GM_download`",
			description: "If a file is larger than this size, use a simple browser-based download instead. Set to `0` for unlimited.",
			category: "general",
			userscript_only: true,
			imu_enabled_exempt: true,
			requires: {
				enable_gm_download: true
			},
			type: "number",
			number_min: 0,
			number_unit: "MB",
			advanced: true
		},
		enable_webextension_download: {
			name: "Force save dialog when downloading",
			description: "Tries to ensure the 'save as' dialog displays when downloading. This requires the 'downloads' permission to work, and will sometimes not work when custom headers are required.",
			category: "general",
			extension_only: true,
			imu_enabled_exempt: true,
			required_permission: "downloads"
		},
		enable_console_logging: {
			name: "Enable logging to console",
			description: "Allows the script to log messages to the browser console.",
			category: "general",
			imu_enabled_exempt: true,
			advanced: true
		},
		write_to_clipboard: {
			name: "Enable writing to clipboard",
			description: "This option does nothing on its own, but enabling it allows other functionality that require writing to the clipboard to work",
			category: "general",
			imu_enabled_exempt: true,
			required_permission: "clipboardWrite"
		},
		redirect: {
			name: "Enable redirection",
			description: "Automatically redirect media opened in their own tab to their larger/original versions",
			category: "redirection"
		},
		redirect_video: {
			name: "Allow video",
			description: "Allows redirecting from/to video",
			requires: {
				redirect: true
			},
			category: "redirection"
		},
		redirect_audio: {
			name: "Allow audio",
			description: "Allows redirecting from/to audio",
			requires: {
				redirect: true
			},
			category: "redirection"
		},
		redirect_history: {
			name: "Add to history",
			description: "Redirection will add a new entry to the browser's history",
			requires: {
				redirect: true
			},
			category: "redirection"
		},
		redirect_extension: {
			name: "Do redirection in extension",
			description: "Performs the redirection in the extension instead of the content script. This is significantly faster and shouldn't cause issues in theory, but this option is kept in case of regressions",
			requires: {
				redirect: true
			},
			extension_only: true,
			advanced: true,
			category: "redirection"
		},
		canhead_get: {
			name: "Use GET if HEAD is unsupported",
			description: "Use a GET request to check an image's availability, if the server does not support HEAD requests",
			requires: {
				redirect: true
			},
			category: "redirection",
			advanced: true
		},
		redirect_force_page: {
			name: "Try finding extra information",
			description: "Enables methods that use API calls for finding extra information, such as the original page, caption, or album information. Note that this option does not affect finding the original media.",
			example_websites: [
				"Flickr",
				"SmugMug",
				"..."
			],
			category: "rules"
		},
		redirect_enable_infobox: {
			name: "Enable tooltip",
			description: "Enables the 'Mouseover popup is needed to display the original version' tooltip",
			category: "redirection",
			requires: {
				redirect: true
			},
			userscript_only: true // tooltip isn't shown in the extension
		},
		redirect_infobox_url: {
			name: "Show image URL in tooltip",
			description: "If the popup is needed to display the larger version of an image, display the image link in the tooltip",
			category: "redirection",
			requires: {
				redirect: true
			},
			userscript_only: true // tooltip isn't shown in the extension
		},
		redirect_infobox_timeout: {
			name: "Hide tooltip after",
			description: "Hides the tooltip after the specified number of seconds (or when the mouse clicks on it). Set to 0 to never hide automatically",
			requires: {
				redirect: true
			},
			type: "number",
			number_min: 0,
			number_unit: "seconds",
			category: "redirection",
			userscript_only: true // tooltip isn't shown in the extension
		},
		print_imu_obj: {
			name: "Log info object to console",
			description: "Prints the full info object to the console whenever a popup/redirect is found",
			category: "rules",
			requires: {
				enable_console_logging: true
			},
			advanced: true
		},
		redirect_disable_for_responseheader: {
			name: "Disable when response headers need modifying",
			description: "This option works around Chrome's migration to manifest v3, redirecting some images to being force-downloaded",
			extension_only: true,
			hidden: true, // Doesn't seem to be needed?
			category: "redirection",
			advanced: true
		},
		redirect_to_no_infobox: {
			name: "Redirect to largest without issues",
			description: "Redirects to the largest image found that doesn't require custom headers or forces download",
			userscript_only: true,
			category: "redirection"
		},
		redirect_host_html: {
			name: "Redirect for HTML pages too",
			description: "Tries redirection even if the host page is HTML. This option might be useful for dead links. However, this will also result in many normal pages being redirected to images/video, so use with caution.",
			warning: {
				"true": "This will result in many pages being redirected to images/videos.\nI'd recommend only either enabling this for the media you need it for then disabling it after, or using the black/whitelist feature below to only allow it to run for specified websites."
			},
			category: "redirection",
			advanced: true
		},
		mouseover: {
			name: "Enable mouseover popup",
			description: "Show a popup with the larger image when you mouseover an image with the trigger key held (if applicable)",
			category: "popup"
		},
		mouseover_open_behavior: {
			name: "Mouseover popup action",
			description: "Determines how the mouseover popup will open",
			profiled: true,
			// While it won't work for some images without the extension, let's not disable it outright either
			//extension_only: true,
			hidden: is_userscript && open_in_tab === common_functions["nullfunc"],
			options: {
				_type: "combo",
				popup: {
					name: "Popup"
				},
				newtab: {
					name: "New tab"
				},
				// thanks to Hlsgs on github for the idea: https://github.com/qsniyg/maxurl/issues/556
				newtab_bg: {
					name: "New background tab",
				},
				download: {
					name: "Download"
				},
				// thanks to lnp5131 on github for the idea: https://github.com/qsniyg/maxurl/issues/435
				copylink: {
					name: "Copy link"
				},
				// thanks to TurretBot on discord for the idea: https://github.com/qsniyg/maxurl/issues/668
				replace: {
					name: "Replace"
				}
			},
			requires: {
				mouseover: true
			},
			category: "popup",
			subcategory: "open_behavior"
		},
		mouseover_trigger: {
			name: "Popup trigger",
			description: "Trigger key that, when held, will show the popup",
			options: {
				_type: "and",
				_group1: {
					_type: "and",
					ctrl: {
						name: "Ctrl"
					},
					shift: {
						name: "Shift"
					},
					alt: {
						name: "Alt"
					}
				},
				_group2: {
					_type: "or",
					delay_1: {
						name: "Delay 1s"
					},
					delay_3: {
						name: "Delay 3s"
					}
				}
			},
			requires: {
				mouseover: true
			},
			category: "popup",
			subcategory: "trigger"
		},
		mouseover_trigger_behavior: {
			name: "Mouseover popup trigger",
			description: "How the popup will get triggered",
			options: {
				_group1: {
					mouse: {
						name: "Mouseover",
						description: "Triggers when your mouse is over the image"
					},
				},
				_group2: {
					keyboard: {
						name: "Key trigger",
						description: "Triggers when you press a key sequence when your mouse is over an image"
					},
				},
				_group3: {
					none: {
						name: "None",
						description: "Disables the popup from being triggered (useful if you only want to use the context menu item)",
						extension_only: true
					}
				}
			},
			requires: {
				mouseover: true
			},
			category: "popup",
			subcategory: "trigger"
		},
		mouseover_trigger_key: {
			name: "Popup trigger key",
			description: "Key sequence to trigger the popup",
			type: "keysequence",
			requires: {
				mouseover: true,
				mouseover_trigger_behavior: "keyboard"
			},
			category: "popup",
			subcategory: "trigger"
		},
		mouseover_trigger_key_t2: {
			name: "Popup trigger key (#2)",
			description: "Key sequence to trigger the popup with alternate options. Search for `(#2)` to find the relevant options",
			type: "keysequence",
			keyseq_allow_none: true,
			requires: {
				mouseover: true,
				mouseover_trigger_behavior: "keyboard"
			},
			category: "popup",
			subcategory: "trigger"
		},
		mouseover_trigger_key_t3: {
			name: "Popup trigger key (#3)",
			description: "Key sequence to trigger the popup with alternate options. Search for `(#3)` to find the relevant options",
			type: "keysequence",
			keyseq_allow_none: true,
			requires: {
				mouseover: true,
				mouseover_trigger_behavior: "keyboard"
			},
			category: "popup",
			subcategory: "trigger"
		},
		mouseover_trigger_delay: {
			name: "Popup trigger delay",
			description: "Delay (in seconds) before the popup shows",
			requires: {
				mouseover: true,
				mouseover_trigger_behavior: "mouse"
			},
			type: "number",
			number_min: 0,
			number_unit: "seconds",
			category: "popup",
			subcategory: "trigger"
		},
		mouseover_trigger_mouseover: {
			name: "Use mouseover event",
			description: "Uses the mouseover event instead of mousemove to figure out where to trigger the popup. This more closely matches the way other image popup addons work, at the cost of configurability",
			requires: {
				mouseover_trigger_behavior: "mouse"
			},
			advanced: true,
			category: "popup",
			subcategory: "trigger"
		},
		mouseover_trigger_enabledisable_toggle: {
			name: "Enable/disable toggle",
			description: "Controls whether the 'Popup enable/disable key' will enable or disable the popup from opening",
			options: {
				enable: {
					name: "Enable"
				},
				disable: {
					name: "Disable"
				}
			},
			requires: {
				mouseover_trigger_behavior: "mouse"
			},
			category: "popup",
			subcategory: "trigger"
		},
		mouseover_trigger_prevent_key: {
			name: "Popup enable/disable key",
			description: "Holding down this key will enable or disable the popup from being opened, depending on the 'Enable/disable toggle' setting",
			requires: {
				mouseover: true,
				mouseover_trigger_behavior: "mouse"
			},
			type: "keysequence",
			category: "popup",
			subcategory: "trigger"
		},
		mouseover_allow_partial: {
			name: "Allow showing partially loaded",
			description: "This will allow the popup to open for partially loaded media.\nPartially loaded media will contain the source URL directly (where possible), whereas fully loaded media will use a blob or data URL.",
			description_userscript: "This will allow the popup to open for partially loaded media, but this might break images that require custom headers to display properly.\nPartially loaded media will contain the source URL directly (where possible), whereas fully loaded media will use a blob or data URL.",
			requires: "action:popup",
			options: {
				_type: "or",
				video: {
					name: "Streams",
					description: "Audio and video"
				},
				media: {
					name: "Media",
					description: "Images, audio, and video"
				},
				none: {
					name: "None"
				}
			},
			category: "popup",
			subcategory: "open_behavior"
		},
		mouseover_partial_avoid_head: {
			name: "Avoid HEAD request for partially loaded media",
			description: "Avoids a possibly unnecessary HEAD request before displaying partially loaded images, which further decreases the delay before opening the popup. This can cause issues if the server returns an error, but still returns an image",
			requires: [
				{mouseover_allow_partial: "video"},
				{mouseover_allow_partial: "media"}
			],
			category: "popup",
			subcategory: "open_behavior",
			advanced: true
		},
		mouseover_use_blob_over_data: {
			name: "Use `blob:` over `data:` URLs",
			description: "Blob URLs are more efficient, but aren't supported by earlier browsers. Some websites also block `blob:` URLs",
			requires: "action:popup",
			category: "popup",
			subcategory: "open_behavior",
			advanced: true
		},
		popup_use_anonymous_crossorigin: {
			name: "Load media anonymously",
			description: "Loads the media without sending any cookies or other forms of credentials. This is required to screenshot videos from other sources",
			requires: "action:popup",
			category: "popup",
			subcategory: "open_behavior",
			advanced: true
		},
		mouseover_use_fully_loaded_image: {
			name: "Wait until image is fully loaded",
			description: "Wait until the image has fully loaded before displaying it",
			requires: "action:popup",
			category: "popup",
			subcategory: "open_behavior"
		},
		mouseover_use_fully_loaded_video: {
			name: "Wait until video is fully loaded",
			description: "Wait until the video has fully loaded before displaying it (this may significantly increase memory usage with larger videos)",
			requires: "action:popup",
			category: "popup",
			subcategory: "open_behavior"
		},
		mouseover_enable_notallowed: {
			name: "Use `not-allowed` cursor when unsupported",
			description: "If the image isn't supported, the mouse cursor will change to a `not-allowed` cursor for a brief duration",
			requires: {
				mouseover_trigger_behavior: "keyboard"
			},
			category: "popup",
			subcategory: "open_behavior"
		},
		mouseover_enable_notallowed_cant_load: {
			name: "Use `not-allowed` cursor when unable to load",
			description: "If the image fails to load, the mouse cursor will change to a `not-allowed` cursor for a brief duration",
			category: "popup",
			subcategory: "open_behavior"
		},
		mouseover_notallowed_duration: {
			name: "`not-allowed` cursor duration",
			description: "How long the `not-allowed` cursor should last",
			requires: [
				{mouseover_enable_notallowed: true},
				{mouseover_enable_notallowed_cant_load: true}
			],
			type: "number",
			number_min: 0,
			number_int: true,
			number_unit: "ms",
			advanced: true,
			category: "popup",
			subcategory: "open_behavior"
		},
		mouseover_exclude_page_bg: {
			name: "Exclude page background",
			description: "Excludes the page background for the popup",
			requires: {
				mouseover: true,
				mouseover_exclude_backgroundimages: false
			},
			profiled: true,
			category: "popup",
			subcategory: "source"
		},
		mouseover_minimum_size: {
			name: "Minimum size",
			description: "Smallest size acceptable for the popup to open (this option is ignored for background images). This refers to the size of the media to be popped up, which may differ from the source media.",
			requires: {
				mouseover: true
			},
			profiled: true,
			type: "number",
			number_min: 0,
			number_unit: "pixels",
			category: "popup",
			subcategory: "source"
		},
		popup_maximum_source_size: {
			name: "Maximum source size",
			description: "Maximum size (width/height) for the source media to allow popping up (this option is ignored for background images). Set to `0` for any size.",
			requires: {
				mouseover: true
			},
			profiled: true,
			type: "number",
			number_min: 0,
			number_unit: "pixels",
			category: "popup",
			subcategory: "source"
		},
		mouseover_exclude_backgroundimages: {
			name: "Exclude `background-image`s",
			description: "Excludes `background-image`s for the popup. Might prevent the popup from working on many images",
			requires: {
				mouseover: true
			},
			profiled: true,
			disabled_if: {
				mouseover_trigger_mouseover: true
			},
			category: "popup",
			subcategory: "source"
		},
		mouseover_exclude_imagetab: {
			name: "Exclude image tabs",
			description: "Excludes images that are opened in their own tabs",
			requires: {
				mouseover: true,
				mouseover_trigger_behavior: "mouse"
			},
			category: "popup",
			subcategory: "source"
		},
		mouseover_exclude_sameimage: {
			name: "Exclude if media URL is unchanged",
			description: "Don't pop up if the new URL is the same as the source",
			requires: {
				mouseover: true
			},
			category: "popup",
			subcategory: "source"
		},
		mouseover_only_links: {
			name: "Only popup for linked media",
			description: "Don't pop up if the media isn't hyperlinked",
			requires: {
				mouseover: true
			},
			category: "popup",
			subcategory: "source"
		},
		mouseover_linked_image: {
			name: "Popup link for linked media",
			description: "If the linked media cannot be made larger, pop up for the link instead of the media",
			requires: {
				mouseover: true
			},
			category: "popup",
			subcategory: "source"
		},
		mouseover_exclude_imagemaps: {
			name: "Exclude image maps",
			description: "Don't pop up if the image is an image map (image with multiple clickable areas)",
			requires: {
				mouseover: true
			},
			category: "popup",
			subcategory: "source"
		},
		mouseover_video_autoplay: {
			name: "Autoplay",
			description: "Play automatically once the popup is opened",
			requires: {
				_condition: "action:popup",
				mouseover_allow_video: true
			},
			category: "popup",
			subcategory: "video"
		},
		mouseover_video_controls: {
			name: "Show video controls",
			description: "Shows native video controls. Note that this prevents dragging under Firefox",
			requires: {
				_condition: "action:popup",
				mouseover_allow_video: true
			},
			category: "popup",
			subcategory: "video"
		},
		mouseover_video_controls_key: {
			name: "Toggle video controls",
			description: "Key to toggle whether the video controls are shown",
			requires: {
				_condition: "action:popup",
				mouseover_allow_video: true
			},
			type: "keysequence",
			category: "keybinds",
			subcategory: "video"
		},
		mouseover_video_loop: {
			name: "Loop",
			description: "Allows the media to automatically restart to the beginning after finishing playing",
			requires: {
				_condition: "action:popup",
				mouseover_allow_video: true
			},
			disabled_if: {
				mouseover_gallery_move_after_video: true
			},
			category: "popup",
			subcategory: "video"
		},
		mouseover_video_autoloop_max: {
			name: "Max duration for looping",
			description: "Media longer than the specified duration will not be automatically looped. Setting this to `0` will always enable looping, regardless of duration.",
			requires: {
				mouseover_video_loop: true
			},
			type: "number",
			number_min: 0,
			number_unit: "seconds",
			category: "popup",
			subcategory: "video"
		},
		mouseover_video_playpause_key: {
			name: "Play/pause key",
			description: "Key to toggle whether the media is playing or paused",
			requires: {
				_condition: "action:popup",
				mouseover_allow_video: true
			},
			type: "keysequence",
			category: "keybinds",
			subcategory: "video"
		},
		mouseover_video_muted: {
			name: "Mute",
			description: "Mutes the media by default",
			requires: {
				_condition: "action:popup",
				mouseover_allow_video: true
			},
			category: "popup",
			subcategory: "video"
		},
		mouseover_video_mute_key: {
			name: "Toggle mute key",
			description: "Key to toggle mute",
			requires: {
				_condition: "action:popup",
				mouseover_allow_video: true
			},
			type: "keysequence",
			category: "keybinds",
			subcategory: "video"
		},
		mouseover_video_volume: {
			name: "Default volume",
			description: "Default volume for the media",
			requires: {
				_condition: "action:popup",
				mouseover_allow_video: true
			},
			type: "number",
			number_min: 0,
			number_max: 100,
			number_int: true,
			number_unit: "%",
			category: "popup",
			subcategory: "video"
		},
		mouseover_video_volume_up_key: {
			name: "Volume up key",
			description: "Key to increase the volume",
			requires: {
				_condition: "action:popup",
				mouseover_allow_video: true
			},
			type: "keysequence",
			category: "keybinds",
			subcategory: "video"
		},
		mouseover_video_volume_down_key: {
			name: "Volume down key",
			description: "Key to decrease the volume",
			requires: {
				_condition: "action:popup",
				mouseover_allow_video: true
			},
			type: "keysequence",
			category: "keybinds",
			subcategory: "video"
		},
		mouseover_video_volume_change_amt: {
			name: "Volume change amount",
			description: "Percent for volume to increase/decrease when using the volume up/down keys",
			requires: {
				_condition: "action:popup",
				mouseover_allow_video: true
			},
			type: "number",
			number_min: 0,
			number_max: 100,
			number_int: true,
			number_unit: "%",
			category: "popup",
			subcategory: "video"
		},
		mouseover_video_resume_from_source: {
			name: "Resume playback from source",
			description: "If enabled, playback will resume from where the source left off",
			requires: {
				_condition: "action:popup",
				mouseover_allow_video: true
			},
			category: "popup",
			subcategory: "video"
		},
		mouseover_video_resume_if_different: {
			name: "Resume if different length",
			description: "If disabled, it will not resume if the source has a different length from the media in the popup (e.g. from a preview video to a full one)",
			requires: {
				mouseover_video_resume_from_source: true
			},
			category: "popup",
			subcategory: "video"
		},
		mouseover_video_pause_source: {
			name: "Pause source",
			description: "Pauses the source once the popup has opened",
			requires: {
				_condition: "action:popup",
				mouseover_allow_video: true
			},
			category: "popup",
			subcategory: "video"
		},
		mouseover_video_seek_amount: {
			name: "Seek amount",
			description: "Amount of time to seek forward/back when using the seek keys",
			requires: {
				_condition: "action:popup",
				mouseover_allow_video: true
			},
			type: "number",
			number_min: 0,
			number_unit: "seconds",
			category: "popup",
			subcategory: "video"
		},
		mouseover_video_seek_left_key: {
			name: "Seek left key",
			description: "Key to seek backwards by the specified amount",
			requires: {
				_condition: "action:popup",
				mouseover_allow_video: true
			},
			type: "keysequence",
			category: "keybinds",
			subcategory: "video"
		},
		mouseover_video_seek_right_key: {
			name: "Seek right key",
			description: "Key to seek forwards by the specified amount",
			requires: {
				_condition: "action:popup",
				mouseover_allow_video: true
			},
			type: "keysequence",
			category: "keybinds",
			subcategory: "video"
		},
		mouseover_video_seek_vertical_scroll: {
			name: "Vertical scroll seeks",
			description: "Scrolling vertically will seek forward/backward",
			requires: {
				_condition: "action:popup",
				mouseover_allow_video: true
			},
			category: "popup",
			subcategory: "video"
		},
		mouseover_video_seek_horizontal_scroll: {
			name: "Horizontal scroll seeks",
			description: "Scrolling horizontally will seek forward/backward",
			requires: {
				_condition: "action:popup",
				mouseover_allow_video: true
			},
			category: "popup",
			subcategory: "video"
		},
		mouseover_video_frame_prev_key: {
			name: "Previous frame key",
			description: "Rewinds the video one \"frame\" backward. Due to current limitations, the frame size is static (but configurable), and might not match the video's framerate",
			requires: {
				_condition: "action:popup",
				mouseover_allow_video: true
			},
			type: "keysequence",
			category: "keybinds",
			subcategory: "video"
		},
		mouseover_video_frame_next_key: {
			name: "Next frame key",
			description: "Advances the video one \"frame\" forward. Due to current limitations, the frame size is static (but configurable), and might not match the video's framerate",
			requires: {
				_condition: "action:popup",
				mouseover_allow_video: true
			},
			type: "keysequence",
			category: "keybinds",
			subcategory: "video"
		},
		mouseover_video_framerate: {
			name: "Frame rate",
			description: "Frame rate for videos to seek forward/back with the next/previous frame keys",
			requires: {
				_condition: "action:popup",
				mouseover_allow_video: true
			},
			type: "number",
			number_min: 0,
			number_unit: "FPS",
			category: "popup",
			subcategory: "video"
		},
		mouseover_video_speed_down_key: {
			name: "Speed down key",
			description: "Key to decrease playback rate by a specified amount",
			requires: {
				_condition: "action:popup",
				mouseover_allow_video: true
			},
			type: "keysequence",
			category: "keybinds",
			subcategory: "video"
		},
		mouseover_video_speed_up_key: {
			name: "Speed up key",
			description: "Key to increase playback rate by a specified amount",
			requires: {
				_condition: "action:popup",
				mouseover_allow_video: true
			},
			type: "keysequence",
			category: "keybinds",
			subcategory: "video"
		},
		mouseover_video_speed_amount: {
			name: "Speed up/down amount",
			description: "How much to increase/decrease the playback rate",
			requires: {
				_condition: "action:popup",
				mouseover_allow_video: true
			},
			type: "number",
			number_min: 0,
			number_unit: "x",
			category: "popup",
			subcategory: "video"
		},
		mouseover_video_reset_speed_key: {
			name: "Reset speed key",
			description: "Resets the playback rate to normal speed",
			requires: {
				_condition: "action:popup",
				mouseover_allow_video: true
			},
			type: "keysequence",
			category: "keybinds",
			subcategory: "video"
		},
		mouseover_video_screenshot_key: {
			name: "Screenshot key",
			description: "Screenshots the current frame in the video",
			requires: {
				_condition: "action:popup",
				mouseover_allow_video: true
			},
			type: "keysequence",
			category: "keybinds",
			subcategory: "video"
		},
		popup_video_screenshot_format: {
			name: "Screenshot format",
			description: "File format to save the screenshot in",
			requires: {
				_condition: "action:popup",
				mouseover_allow_video: true
			},
			options: {
				_type: "or",
				png: {
					name: "PNG"
				},
				jpg: {
					name: "JPG"
				}
			},
			category: "popup",
			subcategory: "video"
		},
		popup_enable_subtitles: {
			name: "Enable subtitles",
			description: "Enables subtitles to be overlayed on top of the video",
			requires: {
				_condition: "action:popup",
				mouseover_allow_video: true
			},
			category: "popup",
			subcategory: "video"
		},
		mouseover_ui: {
			name: "Popup UI",
			description: "Enables a UI on top of the popup",
			requires: "action:popup",
			category: "popup",
			subcategory: "ui"
		},
		mouseover_ui_toggle_key: {
			name: "UI Toggle key",
			description: "Toggles the display of the UI",
			type: "keysequence",
			requires: "action:popup",
			category: "keybinds",
			subcategory: "popup"
		},
		mouseover_ui_opacity: {
			name: "Opacity",
			description: "Opacity of the UI on top of the popup",
			requires: {
				mouseover_ui: true
			},
			type: "number",
			number_unit: "%",
			number_max: 100,
			number_min: 0,
			number_int: true,
			category: "popup",
			subcategory: "ui"
		},
		mouseover_ui_use_safe_glyphs: {
			name: "Use safe glyphs",
			description: "Uses glyphs that are more likely to be available on all fonts. Enable this option if the following characters render as boxes: \uD83E\uDC47 \ud83e\udc50 \ud83e\udc52. The 'Noto Sans Symbols2' font contains these characters.",
			requires: {
				mouseover_ui: true
			},
			category: "popup",
			subcategory: "ui"
		},
		mouseover_ui_imagesize: {
			name: "Media resolution",
			description: "Displays the original media dimensions on top of the UI.\nCSS ID: `#sizeinfo`",
			requires: {
				mouseover_ui: true
			},
			category: "popup",
			subcategory: "ui"
		},
		mouseover_ui_zoomlevel: {
			name: "Zoom percent",
			description: "Displays the current zoom level on top of the UI.\nCSS ID: `#sizeinfo`",
			requires: {
				mouseover_ui: true
			},
			category: "popup",
			subcategory: "ui"
		},
		mouseover_ui_filesize: {
			name: "File size",
			description: "Displays the media's file size on top of the UI. For the moment, this will not work with partially loaded media if 'Avoid HEAD request for partially loaded media' is enabled.\nCSS ID: `#sizeinfo`",
			requires: {
				mouseover_ui: true
			},
			category: "popup",
			subcategory: "ui"
		},
		mouseover_ui_gallerycounter: {
			name: "Gallery counter",
			description: "Enables a gallery counter on top of the UI.\nCSS ID: `#gallerycounter`",
			requires: {
				mouseover_ui: true,
				mouseover_enable_gallery: true
			},
			category: "popup",
			subcategory: "ui"
		},
		mouseover_ui_gallerymax: {
			name: "Gallery counter max",
			description: "Maximum amount of images to check in the counter (this can be slightly CPU-intensive)",
			requires: {
				mouseover_ui_gallerycounter: true,
				mouseover_enable_gallery: true
			},
			type: "number",
			number_min: 0,
			number_unit: "images",
			category: "popup",
			subcategory: "ui"
		},
		mouseover_ui_gallerybtns: {
			name: "Gallery buttons",
			description: "Enables buttons to go left/right in the gallery.\nCSS IDs: `#galleryprevbtn`, `#gallerynextbtn`",
			requires: {
				mouseover_ui: true,
				mouseover_enable_gallery: true
			},
			category: "popup",
			subcategory: "ui"
		},
		mouseover_ui_closebtn: {
			name: "Close Button",
			description: "Enables a button to close the popup.\nCSS ID: `#closebtn`",
			requires: {
				mouseover_ui: true
			},
			category: "popup",
			subcategory: "ui"
		},
		mouseover_ui_optionsbtn: {
			name: "Options Button",
			description: "Enables a button to go to this page.\nCSS ID: `#optionsbtn`",
			requires: {
				mouseover_ui: true
			},
			// While it works for the extension, it's more or less useless
			userscript_only: true,
			category: "popup",
			subcategory: "ui"
		},
		mouseover_ui_downloadbtn: {
			name: "Download Button",
			description: "Enables a button to download the image.\nCSS ID: `#downloadbtn`",
			requires: {
				mouseover_ui: true
			},
			category: "popup",
			subcategory: "ui"
		},
		mouseover_ui_rotationbtns: {
			name: "Rotation Buttons",
			description: "Enables buttons on the UI to rotate the image by 90 degrees.\nCSS IDs: `#rotleftbtn`, `#rotrightbtn`",
			requires: {
				mouseover_ui: true
			},
			category: "popup",
			subcategory: "ui"
		},
		mouseover_ui_caption: {
			name: "Caption",
			description: "Shows the image's caption (if available) at the top.\nCSS ID: `#caption`",
			requires: {
				mouseover_ui: true
			},
			category: "popup",
			subcategory: "ui"
		},
		mouseover_ui_wrap_caption: {
			name: "Wrap caption text",
			description: "Wraps the caption if it's too long",
			requires: {
				mouseover_ui_caption: true
			},
			category: "popup",
			subcategory: "ui"
		},
		mouseover_ui_caption_link_page: {
			name: "Link original page in caption",
			description: "Links the original page (if it exists) in the caption",
			requires: {
				mouseover_ui_caption: true
			},
			category: "popup",
			subcategory: "ui"
		},
		mouseover_ui_link_underline: {
			name: "Underline links",
			description: "Adds an underline to links (such as the original page)",
			requires: {
				mouseover_ui: true
			},
			category: "popup",
			subcategory: "ui"
		},
		mouseover_close_behavior: {
			name: "Keep popup open until",
			description: "Closes the popup when the selected condition is met",
			options: {
				_type: "or",
				_group1: {
					any: {
						name: "Any trigger is released"
					}
				},
				_group2: {
					all: {
						name: "All triggers are released"
					}
				},
				_group3: {
					esc: {
						name: "ESC/Close is pressed"
					}
				}
			},
			requires: {
				_condition: "action:popup",
				mouseover_trigger_behavior: "keyboard"
			},
			category: "popup",
			subcategory: "close_behavior"
		},
		mouseover_close_need_mouseout: {
			name: "Don't close until mouse leaves",
			description: "If true, this keeps the popup open even if all triggers are released if the mouse is still over the image",
			requires: [
				{mouseover_close_behavior: "any"},
				{mouseover_close_behavior: "all"}
			],
			category: "popup",
			subcategory: "close_behavior"
		},
		mouseover_jitter_threshold: {
			name: "Threshold to leave image",
			description: "How many pixels outside of the image before the cursor is considered to have left the image",
			requires: [
				{
					_condition: "action:popup",
					mouseover_close_need_mouseout: true
				},
				{
					_condition: "action:popup",
					mouseover_trigger_behavior: "mouse"
				}
			],
			type: "number",
			number_unit: "pixels",
			category: "popup",
			subcategory: "close_behavior"
		},
		mouseover_cancel_popup_when_elout: {
			name: "Leaving thumbnail cancels loading",
			description: "Cancels the current popup loading when the cursor has left the thumbnail image",
			requires: {
				mouseover: true,
				mouseover_trigger_behavior: "mouse"
			},
			category: "popup",
			subcategory: "close_behavior"
		},
		mouseover_cancel_popup_with_esc: {
			name: "ESC cancels loading",
			description: "Cancels the current popup loading if ESC is pressed",
			requires: {
				mouseover: true
			},
			category: "popup",
			subcategory: "close_behavior"
		},
		mouseover_cancel_popup_when_release: {
			name: "Releasing triggers cancels loading",
			description: "Cancels the current popup loading if all/any triggers are released (as set by the \"Keep popup open until\" setting)",
			requires: [
				{mouseover_close_behavior: "any"},
				{mouseover_close_behavior: "all"}
			],
			category: "popup",
			subcategory: "close_behavior"
		},
		mouseover_auto_close_popup: {
			name: "Automatically close after timeout",
			description: "Closes the popup automatically after a specified period of time has elapsed",
			requires: "action:popup",
			category: "popup",
			subcategory: "close_behavior"
		},
		mouseover_auto_close_popup_time: {
			name: "Timeout to close popup",
			description: "Amount of time to elapse before automatically closing the popup",
			requires: {
				mouseover_auto_close_popup: true
			},
			type: "number",
			number_min: 0,
			number_unit: "seconds",
			category: "popup",
			subcategory: "close_behavior"
		},
		mouseover_use_hold_key: {
			name: "Use hold key",
			description: "Enables the use of a hold key that, when pressed, will keep the popup open",
			requires: [
				{
					_condition: "action:popup",
					mouseover_trigger_behavior: "mouse"
				},
				{
					_condition: "action:popup",
					mouseover_auto_close_popup: true
				},
				{
					_condition: "action:popup",
					mouseover_close_need_mouseout: true
				},
			],
			category: "popup",
			subcategory: "close_behavior"
		},
		mouseover_hold_key: {
			name: "Hold key",
			description: "Hold key that, when pressed, will keep the popup open",
			requires: "action:popup",
			type: "keysequence",
			category: "keybinds",
			subcategory: "popup"
		},
		mouseover_hold_position_center: {
			name: "Center popup on hold",
			description: "Centers the popup to the middle of the page when the popup is held",
			requires: "action:popup",
			category: "popup",
			subcategory: "close_behavior"
		},
		popup_hold_zoom: {
			name: "Override zoom on hold",
			description: "Overrides the zoom when the popup is held",
			options: {
				_type: "combo",
				none: {
					name: "None"
				},
				fit: {
					name: "Fit to screen"
				},
				fill: {
					name: "Fill screen"
				},
				full: {
					name: "Full size"
				}
			},
			requires: "action:popup",
			category: "popup",
			subcategory: "close_behavior"
		},
		mouseover_hold_close_unhold: {
			name: "Close popup on unhold",
			description: "Closes the popup when the hold key is pressed again, after having previously held the popup",
			requires: "action:popup",
			category: "popup",
			subcategory: "close_behavior"
		},
		mouseover_hold_unclickthrough: {
			name: "Enable pointer events on hold",
			description: "Enables previously disabled pointer events when the popup is held",
			requires: {
				_condition: "action:popup",
				mouseover_clickthrough: true
			},
			category: "popup",
			subcategory: "close_behavior"
		},
		mouseover_close_on_leave_el: {
			name: "Close when leaving thumbnail",
			description: "Closes the popup when the mouse leaves the thumbnail element (won't close if the mouse instead moves to the popup)",
			requires: {
				_condition: "action:popup",
				mouseover_trigger_behavior: "mouse",
				mouseover_position: "beside_cursor"
			},
			category: "popup",
			subcategory: "close_behavior"
		},
		mouseover_close_click_outside: {
			name: "Clicking outside the popup closes",
			description: "Closes the popup when the mouse clicks outside of it",
			requires: "action:popup",
			category: "popup",
			subcategory: "close_behavior"
		},
		mouseover_close_el_policy: {
			name: "Close when leaving",
			description: "Closes the popup when the mouse leaves the thumbnail element, the popup, or both",
			requires: [
				{
					_condition: "action:popup",
					mouseover_trigger_behavior: "mouse"
				},
				{
					_condition: "action:popup",
					mouseover_trigger_behavior: "keyboard",
					mouseover_close_need_mouseout: true
				}
			],
			options: {
				_type: "combo",
				thumbnail: {
					name: "Thumbnail"
				},
				popup: {
					name: "Popup"
				},
				both: {
					name: "Both"
				}
			},
			category: "popup",
			subcategory: "close_behavior"
		},
		mouseover_wait_use_el: {
			name: "Use invisible element when waiting",
			description: "Creates an invisible element under the cursor when waiting for the popup instead of a style element (can improve performance on websites with many elements, but prevents the cursor from clicking anything while loading the popup)",
			requires: {
				mouseover: true
			},
			category: "popup",
			subcategory: "popup_other",
			advanced: true
		},
		mouseover_add_to_history: {
			name: "Add popup link to history",
			description: "Adds the image/video link opened through the popup to the browser's history",
			requires: {
				mouseover: true
			},
			category: "popup",
			subcategory: "popup_other",
			required_permission: "history",
			extension_only: true
		},
		mouseover_add_thumbnail_to_history: {
			name: "Add thumbnail link to history",
			description: "Adds the original media link opened through the popup to the browser's history",
			requires: {
				mouseover: true
			},
			category: "popup",
			subcategory: "popup_other",
			required_permission: "history",
			extension_only: true
		},
		allow_remote: {
			name: "Allow inter-frame communication",
			description: "Allows communication between frames in windows, improving support for keybindings",
			description_userscript: "Allows communication between frames in windows, improving support for keybindings. Can pose a fingerprinting risk when used through the userscript",
			requires: {
				mouseover: true
			},
			category: "general",
			advanced: !is_userscript // userscript users may want to disable it for privacy reasons
		},
		mouseover_use_remote: {
			name: "Pop out of frames",
			description: "Opens the popup on the top frame instead of within iframes. This option is still experimental.",
			requires: {
				_condition: "action:popup",
				allow_remote: true
			},
			category: "popup",
			subcategory: "open_behavior"
		},
		mouseover_zoom_behavior: {
			name: "Popup default zoom",
			description: "How the popup should be initially sized",
			options: {
				_type: "combo",
				fit: {
					name: "Fit to screen"
				},
				fill: {
					name: "Fill screen"
				},
				full: {
					name: "Full size"
				},
				custom: {
					name: "Custom size"
				}
			},
			requires: "action:popup",
			category: "popup",
			subcategory: "open_behavior"
		},
		mouseover_zoom_custom_percent: {
			name: "Custom zoom percent",
			description: "Custom percent to initially size the popup",
			type: "number",
			number_min: 0,
			number_unit: "%",
			requires: {
				mouseover_zoom_behavior: "custom"
			},
			category: "popup",
			subcategory: "open_behavior"
		},
		mouseover_zoom_use_last: {
			name: "Use last zoom",
			description: "Use the last popup's zoom. Note that this is per-page.",
			options: {
				_type: "combo",
				always: {
					name: "Always"
				},
				gallery: {
					name: "Gallery"
				},
				never: {
					name: "Never"
				}
			},
			requires: "action:popup",
			category: "popup",
			subcategory: "open_behavior"
		},
		mouseover_zoom_max_width: {
			name: "Maximum width",
			description: "Maximum width for the initial popup size. Set to `0` for unlimited.",
			type: "number",
			number_min: 0,
			number_unit: "px",
			requires: "action:popup",
			category: "popup",
			subcategory: "open_behavior"
		},
		mouseover_zoom_max_height: {
			name: "Maximum height",
			description: "Maximum height for the initial popup size. Set to `0` for unlimited.",
			type: "number",
			number_min: 0,
			number_unit: "px",
			requires: "action:popup",
			category: "popup",
			subcategory: "open_behavior"
		},
		mouseover_pan_behavior: {
			name: "Popup panning method",
			description: "How the popup should be panned when larger than the screen",
			options: {
				_type: "or",
				movement: {
					name: "Movement",
					description: "The popup pans as you move your mouse"
				},
				drag: {
					name: "Drag",
					description: "Clicking and dragging pans the popup"
				}
			},
			requires: "action:popup",
			category: "popup",
			subcategory: "behavior"
		},
		mouseover_movement_inverted: {
			name: "Invert movement",
			description: "Inverts the movement of the mouse. For example, if the mouse moves left, the popup moves right. If disabled, it feels more like the popup is being invisibly dragged.",
			requires: {
				mouseover_pan_behavior: "movement"
			},
			// It's doubtful many users will want this option enabled
			advanced: true,
			category: "popup",
			subcategory: "behavior"
		},
		mouseover_drag_min: {
			name: "Minimum drag amount",
			description: "How many pixels the mouse should move to start a drag",
			type: "number",
			number_min: 0,
			number_int: true,
			number_unit: "pixels",
			requires: {
				mouseover_pan_behavior: "drag"
			},
			category: "popup",
			subcategory: "behavior"
		},
		mouseover_scrolly_behavior: {
			name: "Vertical scroll action",
			description: "How the popup reacts to a vertical scroll/mouse wheel event",
			options: {
				_type: "combo",
				zoom: {
					name: "Zoom"
				},
				pan: {
					name: "Pan"
				},
				gallery: {
					name: "Gallery",
					requires: [{
						mouseover_enable_gallery: true
					}]
				},
				nothing: {
					name: "None"
				}
			},
			requires: "action:popup",
			category: "popup",
			subcategory: "behavior"
		},
		mouseover_scrolly_hold_behavior: {
			name: "Vertical scroll action (hold)",
			description: "How the popup (when held) reacts to a vertical scroll/mouse wheel event",
			options: {
				_type: "combo",
				default: {
					name: "Default"
				},
				zoom: {
					name: "Zoom"
				},
				pan: {
					name: "Pan"
				},
				gallery: {
					name: "Gallery",
					requires: [{
						mouseover_enable_gallery: true
					}]
				},
				nothing: {
					name: "None"
				}
			},
			requires: "action:popup",
			category: "popup",
			subcategory: "behavior"
		},
		mouseover_scrollx_behavior: {
			name: "Horizontal scroll action",
			description: "How the popup reacts to a horizontal scroll/mouse wheel event",
			options: {
				_type: "combo",
				pan: {
					name: "Pan"
				},
				gallery: {
					name: "Gallery",
					requires: [{
						mouseover_enable_gallery: true
					}]
				},
				nothing: {
					name: "None"
				}
			},
			requires: "action:popup",
			category: "popup",
			subcategory: "behavior"
		},
		mouseover_scrollx_hold_behavior: {
			name: "Horizontal scroll action (hold)",
			description: "How the popup (when held) reacts to a horizontal scroll/mouse wheel event",
			options: {
				_type: "combo",
				default: {
					name: "Default"
				},
				pan: {
					name: "Pan"
				},
				gallery: {
					name: "Gallery",
					requires: [{
						mouseover_enable_gallery: true
					}]
				},
				nothing: {
					name: "None"
				}
			},
			requires: "action:popup",
			category: "popup",
			subcategory: "behavior"
		},
		mouseover_scrolly_video_behavior: {
			name: "Vertical video scroll action",
			description: "Overrides the vertical scroll action for videos. Set to `Default` to avoid overriding the behavior.",
			options: {
				_type: "combo",
				default: {
					name: "Default"
				},
				seek: {
					name: "Seek"
				},
				nothing: {
					name: "None"
				}
			},
			requires: "action:popup",
			category: "popup",
			subcategory: "behavior"
		},
		mouseover_scrolly_video_invert: {
			name: "Invert vertical scroll seek",
			description: "Inverts the seek direction when scrolling vertically: Scrolling up will seek right, scrolling down will seek left.",
			requires: {
				mouseover_scrolly_video_behavior: "seek"
			},
			category: "popup",
			subcategory: "behavior"
		},
		mouseover_scrollx_video_behavior: {
			name: "Horizontal video scroll action",
			description: "Overrides the horizontal scroll action for videos. Set to `Default` to avoid overriding the behavior.",
			options: {
				_type: "combo",
				default: {
					name: "Default"
				},
				seek: {
					name: "Seek"
				},
				nothing: {
					name: "None"
				}
			},
			requires: "action:popup",
			category: "popup",
			subcategory: "behavior"
		},
		scroll_override_page: {
			name: "Override scroll outside of popup",
			description: "Scrolling outside of the popup will also be overriden by the script",
			requires: "action:popup",
			category: "popup",
			subcategory: "behavior"
		},
		scroll_zoom_origin: {
			name: "Zoom origin",
			description: "The point on the image it's zoomed in/out from",
			options: {
				_type: "or",
				cursor: {
					name: "Cursor"
				},
				center: {
					name: "Center"
				}
			},
			requires: [
				{mouseover_scrollx_behavior: "zoom"},
				{mouseover_scrollx_hold_behavior: "zoom"},
				{mouseover_scrolly_behavior: "zoom"},
				{mouseover_scrolly_hold_behavior: "zoom"}
			],
			category: "popup",
			subcategory: "behavior"
		},
		scroll_zoomout_pagemiddle: {
			name: "Zoom out towards page middle",
			description: "Sets the origin when zooming out to the page middle, overriding the \"Zoom Origin\" option above.",
			options: {
				_type: "combo",
				always: {
					name: "Always"
				},
				viewport: {
					name: "Within viewport"
				},
				never: {
					name: "Never"
				}
			},
			requires: [
				{mouseover_scrollx_behavior: "zoom"},
				{mouseover_scrollx_hold_behavior: "zoom"},
				{mouseover_scrolly_behavior: "zoom"},
				{mouseover_scrolly_hold_behavior: "zoom"}
			],
			category: "popup",
			subcategory: "behavior"
		},
		scroll_zoom_behavior: {
			name: "Zoom behavior",
			description: "How zooming should work",
			options: {
				_type: "or",
				fitfull: {
					name: "Fit/Full",
					description: "Toggles between the full size, and fit-to-screen"
				},
				incremental: {
					name: "Incremental"
				}
			},
			requires: [
				{mouseover_scrollx_behavior: "zoom"},
				{mouseover_scrollx_hold_behavior: "zoom"},
				{mouseover_scrolly_behavior: "zoom"},
				{mouseover_scrolly_hold_behavior: "zoom"}
			],
			category: "popup",
			subcategory: "behavior"
		},
		scroll_incremental_mult: {
			name: "Incremental zoom multiplier",
			description: "How much to zoom in/out by (for incremental zooming)",
			type: "number",
			number_min: 1,
			number_unit: "x",
			category: "popup",
			subcategory: "behavior"
		},
		mouseover_move_with_cursor: {
			name: "Move with cursor",
			description: "Moves the popup as the cursor moves",
			requires: "action:popup",
			category: "popup",
			subcategory: "behavior"
		},
		mouseover_move_within_page: {
			name: "Move within page",
			description: "Ensures the popup doesn't leave the page",
			requires: {
				mouseover_move_with_cursor: true
			},
			category: "popup",
			subcategory: "behavior"
		},
		zoom_out_to_close: {
			name: "Zoom out fully to close",
			description: "Closes the popup if you zoom out past the minimum zoom",
			requires: [
				{mouseover_scrollx_behavior: "zoom"},
				{mouseover_scrollx_hold_behavior: "zoom"},
				{mouseover_scrolly_behavior: "zoom"},
				{mouseover_scrolly_hold_behavior: "zoom"}
			],
			category: "popup",
			subcategory: "close_behavior"
		},
		scroll_past_gallery_end_to_close: {
			name: "Scroll past gallery end to close",
			description: "Closes the popup if you scroll past the end of the gallery",
			requires: [
				{mouseover_scrollx_behavior: "gallery"},
				{mouseover_scrollx_hold_behavior: "gallery"},
				{mouseover_scrolly_behavior: "gallery"},
				{mouseover_scrolly_hold_behavior: "gallery"}
			],
			category: "popup",
			subcategory: "close_behavior"
		},
		mouseover_position: {
			name: "Popup position",
			description: "Where the popup will appear",
			options: {
				_type: "or",
				_group1: {
					cursor: {
						name: "Cursor middle",
						description: "Underneath the mouse cursor"
					}
				},
				_group2: {
					beside_cursor: {
						name: "Beside cursor"
					}
				},
				_group3: {
					center: {
						name: "Page middle"
					}
				}
			},
			requires: "action:popup",
			category: "popup",
			subcategory: "open_behavior"
		},
		mouseover_prevent_cursor_overlap: {
			name: "Prevent cursor overlap",
			description: "Prevents the image from overlapping with the cursor",
			requires: {
				mouseover_position: "beside_cursor"
			},
			hidden: true, // no longer applicable with new beside_cursor implementation
			category: "popup",
			subcategory: "open_behavior"
		},
		mouseover_overflow_position_center: {
			name: "Center popup on overflow",
			description: "Centers the popup if its initial size overflows",
			requires: "action:popup",
			category: "popup",
			subcategory: "open_behavior"
		},
		mouseover_overflow_origin: {
			name: "Overflow origin",
			description: "Where the popup will appear in the page if its initial size overflows",
			requires: [
				{mouseover_position: "center"},
				{mouseover_overflow_position_center: true},
				{mouseover_hold_position_center: true}
			],
			options: {
				_type: "or",

				// prefixed with a to ensure correct order
				_group1: {
					"a00": {name: ""},
					"a10": {name: ""},
					"a20": {name: ""}
				},
				_group2: {
					"a01": {name: ""},
					"a11": {name: ""},
					"a21": {name: ""}
				},
				_group3: {
					"a02": {name: ""},
					"a12": {name: ""},
					"a22": {name: ""}
				},
			},
			category: "popup",
			subcategory: "open_behavior"
		},
		mouseover_hide_cursor: {
			name: "Hide cursor over popup",
			description: "Hides the cursor when the mouse is over the popup",
			requires: "action:popup",
			category: "popup",
			subcategory: "behavior"
		},
		mouseover_hide_cursor_after: {
			name: "Hide cursor after",
			description: "Hides the cursor over the popup after a specified period of time (in milliseconds), 0 always hides the cursor",
			requires: {
				mouseover_hide_cursor: true
			},
			type: "number",
			number_unit: "ms",
			number_int: true,
			number_min: 0,
			category: "popup",
			subcategory: "behavior"
		},
		mouseover_mouse_inactivity_jitter: {
			name: "Mouse jitter threshold",
			description: "Threshold for mouse movement before the mouse cursor is shown again, 0 always shows the cursor after any movement",
			requires: {
				mouseover_hide_cursor: true
			},
			type: "number",
			number_unit: "px",
			number_int: true,
			number_min: 0,
			category: "popup",
			subcategory: "behavior"
		},
		mouseover_clickthrough: {
			name: "Disable pointer events",
			description: "Enabling this option will allow you to click on links underneath the popup",
			requires: "action:popup",
			category: "popup",
			subcategory: "behavior"
		},
		mouseover_mask_ignore_clicks: {
			name: "Ignore clicks outside popup",
			description: "Any mouse event outside the popup will be discarded with this option",
			requires: "action:popup",
			category: "popup",
			subcategory: "behavior"
		},
		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 modern browsers due to `SharedArrayBuffer` restrictions.",
			requires: {
				_condition: "action:popup",
				mouseover_allow_hlsdash: true
			},
			hidden: !has_ffmpeg_lib,
			category: "popup",
			subcategory: "video"
		},
		stream_mux_mp4_over_mkv: {
			name: "Prefer MP4 over MKV",
			description: "Tries to mux the video into mp4 instead of mkv when required. This may slightly slow down muxing as it currently needs to try muxing both.",
			requires: {
				enable_stream_download: true
			},
			hidden: !has_ffmpeg_lib,
			category: "popup",
			subcategory: "video"
		},
		mouseover_add_link: {
			name: "Link image",
			description: "Adds a link to the image in the popup",
			requires: "action:popup",
			category: "popup",
			subcategory: "behavior"
		},
		mouseover_add_video_link: {
			name: "Link video",
			description: "Adds a link to the video in the popup",
			requires: {
				_condition: "action:popup",
				mouseover_allow_video: true
			},
			category: "popup",
			subcategory: "behavior"
		},
		mouseover_click_image_close: {
			name: "Clicking image closes",
			description: "Clicking the popup image closes the popup",
			requires: "action:popup",
			disabled_if: [
				{mouseover_add_link: true},
				{mouseover_clickthrough: true}
			],
			category: "popup",
			subcategory: "behavior"
		},
		mouseover_click_video_close: {
			name: "Clicking video closes",
			description: "Clicking the popup video closes the popup",
			requires: "action:popup",
			disabled_if: [
				{mouseover_add_video_link: true},
				{mouseover_clickthrough: true}
			],
			category: "popup",
			subcategory: "behavior"
		},
		mouseover_download: {
			name: "Clicking link downloads",
			description: "Instead of opening the link in a new tab, it will download the image/video instead",
			requires: [
				{
					_condition: "action:popup",
					mouseover_add_link: true
				},
				{
					_condition: "action:popup",
					mouseover_add_video_link: true
				},
			],
			category: "popup",
			subcategory: "behavior"
		},
		mouseover_close_key: {
			name: "Close key",
			description: "Closes the popup when this key is pressed. Currently, ESC will also close the popup regardless of the value of this setting.",
			requires: "action:popup",
			type: "keysequence",
			category: "keybinds",
			subcategory: "popup"
		},
		mouseover_download_key: {
			name: "Download key",
			description: "Downloads the image in the popup when this key is pressed",
			requires: "action:popup",
			type: "keysequence",
			category: "keybinds",
			subcategory: "popup"
		},
		mouseover_open_new_tab_key: {
			name: "Open in new tab key",
			description: "Opens the image in the popup in a new tab when this key is pressed",
			hidden: is_userscript && open_in_tab === common_functions["nullfunc"],
			requires: "action:popup",
			type: "keysequence",
			category: "keybinds",
			subcategory: "popup"
		},
		mouseover_open_bg_tab_key: {
			name: "Open in background tab key",
			description: "Opens the image in the popup in a new tab without switching to it when this key is pressed",
			hidden: is_userscript && open_in_tab === common_functions["nullfunc"],
			requires: "action:popup",
			type: "keysequence",
			category: "keybinds",
			subcategory: "popup"
		},
		mouseover_copy_link_key: {
			name: "Copy link key",
			description: "Copies the link of the media to the clipboard when this key is pressed",
			requires: {
				_condition: "action:popup",
				write_to_clipboard: true
			},
			type: "keysequence",
			category: "keybinds",
			subcategory: "popup"
		},
		mouseover_open_options_key: {
			name: "Open options key",
			description: "Opens this page in a new tab when this key is pressed",
			hidden: is_userscript && open_in_tab === common_functions["nullfunc"],
			requires: "action:popup",
			type: "keysequence",
			category: "keybinds",
			subcategory: "popup"
		},
		mouseover_open_orig_page_key: {
			name: "Open original page key",
			description: "Opens the original page (if available) when this key is pressed",
			requires: "action:popup",
			type: "keysequence",
			category: "keybinds",
			subcategory: "popup"
		},
		mouseover_rotate_left_key: {
			name: "Rotate left key",
			description: "Rotates the popup 90 degrees to the left",
			requires: "action:popup",
			type: "keysequence",
			category: "keybinds",
			subcategory: "popup"
		},
		mouseover_rotate_right_key: {
			name: "Rotate right key",
			description: "Rotates the popup 90 degrees to the right",
			requires: "action:popup",
			type: "keysequence",
			category: "keybinds",
			subcategory: "popup"
		},
		mouseover_flip_horizontal_key: {
			name: "Horizontal flip key",
			description: "Flips the image horizontally",
			requires: "action:popup",
			type: "keysequence",
			category: "keybinds",
			subcategory: "popup"
		},
		mouseover_flip_vertical_key: {
			name: "Vertical flip key",
			description: "Flips the image vertically",
			requires: "action:popup",
			type: "keysequence",
			category: "keybinds",
			subcategory: "popup"
		},
		mouseover_zoom_in_key: {
			name: "Zoom in key",
			description: "Incrementally zooms into the image",
			requires: "action:popup",
			type: "keysequence",
			category: "keybinds",
			subcategory: "popup"
		},
		mouseover_zoom_out_key: {
			name: "Zoom out key",
			description: "Incrementally zooms out of the image",
			requires: "action:popup",
			type: "keysequence",
			category: "keybinds",
			subcategory: "popup"
		},
		mouseover_zoom_full_key: {
			name: "Full zoom key",
			description: "Sets the image to be at a 100% zoom, even if it overflows the screen",
			requires: "action:popup",
			type: "keysequence",
			category: "keybinds",
			subcategory: "popup"
		},
		mouseover_zoom_fit_key: {
			name: "Fit screen key",
			description: "Sets the image to either be at a 100% zoom, or to fit the screen, whichever is smaller",
			requires: "action:popup",
			type: "keysequence",
			category: "keybinds",
			subcategory: "popup"
		},
		mouseover_fullscreen_key: {
			name: "Toggle fullscreen key",
			description: "Toggles fullscreen mode for the image/video in the popup",
			requires: "action:popup",
			type: "keysequence",
			category: "keybinds",
			subcategory: "popup"
		},
		mouseover_links: {
			name: "Popup for plain hyperlinks",
			description: "Whether or not the popup should also open for plain hyperlinks",
			requires: {
				mouseover: true
			},
			category: "popup",
			subcategory: "source"
		},
		mouseover_only_valid_links: {
			name: "Only for links that look valid",
			description: "Enabling this option will only allow links to be popped up if they look valid (such as if they have a known image/video extension, or are explicitly supported)",
			requires: {
				mouseover_links: true
			},
			category: "popup",
			subcategory: "source"
		},
		mouseover_allow_video: {
			name: "Enable videos",
			description: "Allows videos to be popped up",
			profiled: true,
			category: "popup",
			subcategory: "video"
		},
		mouseover_allow_audio: {
			name: "Enable audio",
			description: "Allows audio to be popped up. Currently experimental.\nThis only applies to audio files. Videos that contains audio are supported regardless of this setting.",
			profiled: true,
			category: "popup",
			subcategory: "video"
		},
		mouseover_allow_hlsdash: {
			name: "Allow HLS/DASH streams",
			description: "Allows playback of HLS/DASH streams",
			example_websites: [
				"Dailymotion",
				"Instagram (higher quality)",
				"Reddit",
				"YouTube (higher quality)"
			],
			requires: [
				{
					mouseover_allow_audio: true,
					allow_thirdparty_libs: true
				},
				{
					mouseover_allow_video: true,
					allow_thirdparty_libs: true
				}
			],
			// thanks to fedesk on discord for the idea to make this profiled
			profiled: true,
			category: "popup",
			subcategory: "video"
		},
		mouseover_allow_self_pagelink: {
			name: "Popup page URL",
			description: "If no element can be found, try the page URL. Only relevant for pagelink rules, such as image and video hosting websites",
			requires: {
				mouseover: true,
				mouseover_trigger_behavior: "keyboard"
			},
			category: "popup",
			subcategory: "source"
		},
		mouseover_allow_iframe_el: {
			name: "Popup for `<iframe>`",
			description: "Allows `<iframe>` elements to be popped up as well. Storing images/videos in this way is rather uncommon, but it can allow embeds to be supported",
			requires: {
				mouseover_links: true
			},
			category: "popup",
			subcategory: "source"
		},
		mouseover_allow_canvas_el: {
			name: "Popup for `<canvas>`",
			description: "Allows `<canvas>` elements to be popped up as well. This will likely cause popups with any kind of web-based games, so it's recommended to keep this disabled",
			requires: {
				mouseover: true
			},
			category: "popup",
			subcategory: "source"
		},
		mouseover_allow_svg_el: {
			name: "Popup for `<svg>`",
			description: "Allows `<svg>` elements to be popped up as well. These are usually used for icons, and can occasionally cause problems for websites that overlay icons on top of images",
			requires: {
				mouseover: true
			},
			category: "popup",
			subcategory: "source"
		},
		mouseover_enable_gallery: {
			name: "Enable gallery",
			description: "Toggles whether gallery detection support should be enabled",
			requires: "action:popup",
			category: "popup",
			subcategory: "gallery"
		},
		mouseover_gallery_cycle: {
			name: "Cycle gallery",
			description: "Going to the previous image for the first image will lead to the last image and vice-versa",
			requires: {
				_condition: "action:popup",
				mouseover_enable_gallery: true
			},
			category: "popup",
			subcategory: "gallery"
		},
		mouseover_gallery_prev_key: {
			name: "Previous gallery item",
			description: "Key to trigger the previous gallery item",
			requires: {
				_condition: "action:popup",
				mouseover_enable_gallery: true
			},
			type: "keysequence",
			category: "keybinds",
			subcategory: "gallery"
		},
		mouseover_gallery_next_key: {
			name: "Next gallery item",
			description: "Key to trigger the next gallery item",
			requires: {
				_condition: "action:popup",
				mouseover_enable_gallery: true
			},
			type: "keysequence",
			category: "keybinds",
			subcategory: "gallery"
		},
		mouseover_gallery_download_key: {
			name: "Gallery download key",
			description: "Key to download the current gallery",
			requires: {
				_condition: "action:popup",
				mouseover_enable_gallery: true,
				allow_thirdparty_libs: true
			},
			type: "keysequence",
			category: "keybinds",
			subcategory: "gallery"
		},
		gallery_download_method: {
			name: "Download method",
			description: "How the gallery should be downloaded",
			requires: {
				_condition: "action:popup",
				mouseover_enable_gallery: true
			},
			options: {
				_type: "combo",
				"zip": {
					name: "Zip file"
				},
				"jdownloader": {
					// we should probably tell the user to temporarily disable "LinkCollector: Do Link Check" (Advanced Settings)
					// we already check for this, and jdownloader is much slower to check (one at a time)
					name: "JDownloader"
				}
			},
			category: "popup",
			subcategory: "gallery"
		},
		gallery_download_unchanged: {
			name: "Download unchanged media",
			description: "Includes gallery items that have not been changed. Useful to potentially avoid downloading thumbnails",
			requires: {
				_condition: "action:popup",
				mouseover_enable_gallery: true
			},
			category: "popup",
			subcategory: "gallery"
		},
		gallery_zip_filename_format: {
			name: "Directory/zip filename format",
			description: [
				"Format string(s) for the directory (package name for JDownloader) and zip filename (if applicable).",
				"Refer to \"Filename format\" under the Rules section for documentation. The variables are set from the first loaded media.",
				"An additional `items_amt` format variable is supported, which contains the number of items.",
				"`.zip` will be automatically suffixed for zip filenames."
			].join("\n"),
			requires: {
				_condition: "action:popup",
				mouseover_enable_gallery: true
			},
			type: "textarea",
			category: "popup",
			subcategory: "gallery"
		},
		gallery_zip_add_tld: {
			name: "Zip: Store in subdirectory",
			description: "Stores the files in a subdirectory with the same name as the .zip file (without the .zip extension)",
			requires: {
				_condition: "action:popup",
				mouseover_enable_gallery: true,
				gallery_download_method: "zip"
			},
			category: "popup",
			subcategory: "gallery"
		},
		gallery_jd_autostart: {
			name: "JD: Autostart",
			description: "Autostarts the download when added to JDownloader",
			requires: {
				gallery_download_method: "jdownloader"
			},
			category: "popup",
			subcategory: "gallery"
		},
		gallery_jd_referer: {
			name: "JD: Referer policy",
			description: "Due to a current limitation in JDownloader's API, the `Referer` (sic) header can only be set on a per-package basis. This option allows working around it by submitting multiple packages with the same name using different Referer headers. This can result in JD spamming notifications due to the number of packages created.",
			requires: {
				gallery_download_method: "jdownloader"
			},
			options: {
				_type: "combo",
				"never": {
					name: "Never"
				},
				"domain": {
					name: "Per-domain"
				},
				"always": {
					name: "Always"
				}
			},
			category: "popup",
			subcategory: "gallery"
		},
		gallery_zip_add_info_file: {
			name: "Zip: Store info file",
			description: "Stores a `info.txt` file in the .zip containing information about the downloaded files and host page.",
			requires: {
				_condition: "action:popup",
				mouseover_enable_gallery: true,
				gallery_download_method: "zip"
			},
			category: "popup",
			subcategory: "gallery"
		},
		mouseover_gallery_move_after_video: {
			name: "Move to next when video finishes",
			description: "Moves to the next gallery item when a video finishes playing",
			requires: {
				_condition: "action:popup",
				mouseover_allow_video: true,
				mouseover_enable_gallery: true
			},
			category: "popup",
			subcategory: "gallery"
		},
		mouseover_styles: {
			name: "Popup CSS style",
			description: "Custom CSS styles for the popup",
			documentation: {
				title: "Documentation",
				value: [
					"Most valid CSS is supported, with these differences:",
					"<ul><li>Multiline comments (<code>/* ... */</code>) are currently not supported</li>",
					"<li>Single comments (<code>// ...</code>) are supported, but only at the beginning of a line</li>",
					"<li><code>%thumburl%</code> is the URL of the thumbnail image. For example, you could use it like this: <code>background-image: url(%thumburl%)</code><br />",
					"The URL is properly encoded, so quotes are not necessary (but not harmful either)</li>",
					"<li><code>%fullurl%</code> is the URL of the full image. If IMU fails to find a larger image, it will be the same as <code>%thumburl%</code></li>",
					"<li>Styles are <code>!important</code> by default</li></ul>",
					"<p>For Button CSS style, you can also customize the CSS for individual buttons through their IDs. For example:</p>",
					"<pre>",
					"#closebtn {",
					"  background-color: red;",
					"  // -imu-text allows you to set the text inside the button",
					"  -imu-text: \"Close\";",
					"  // -imu-title allows you to set the tooltip when hovering",
					"  -imu-title: \"Close the popup\";",
					"}",
					"#galleryprevbtn, #gallerynextbtn {",
					"  border-radius: 100px;",
					"}",
					"</pre>"
				].join("\n")
			},
			type: "textarea",
			requires: "action:popup",
			category: "popup",
			subcategory: "popup_other"
		},
		mouseover_enable_fade: {
			name: "Enable popup fade",
			description: "Enables a fade in/out effect when the popup is opened/closed",
			requires: "action:popup",
			category: "popup",
			subcategory: "popup_other"
		},
		mouseover_enable_zoom_effect: {
			name: "Enable zoom effect",
			description: "Toggles whether the popup should 'zoom' when opened/closed",
			requires: "action:popup",
			category: "popup",
			subcategory: "popup_other"
		},
		mouseover_zoom_effect_move: {
			name: "Move from thumbnail when zooming",
			description: "Moves the popup from the thumbnail to the final location while zooming. The animation can be a little rough",
			requires: {
				mouseover_enable_zoom_effect: true
			},
			category: "popup",
			subcategory: "popup_other"
		},
		mouseover_fade_time: {
			name: "Popup animation time",
			description: "Fade/zoom animation duration (in milliseconds) for the popup",
			requires: [
				{mouseover_enable_fade: true},
				{mouseover_enable_zoom_effect: true}
			],
			type: "number",
			number_min: 0,
			number_unit: "ms",
			category: "popup",
			subcategory: "popup_other"
		},
		mouseover_enable_mask_styles2: {
			name: "Enable background CSS",
			description: "Toggles whether CSS styles for the background when the popup is active is enabled",
			requires: "action:popup",
			options: {
				"always": {
					name: "Always"
				},
				"hold": {
					name: "On hold"
				},
				"never": {
					name: "No"
				}
			},
			category: "popup",
			subcategory: "popup_other"
		},
		mouseover_mask_styles2: {
			name: "Background CSS style",
			description: "CSS style for the background when the popup is active. See the documentation for Popup CSS style for more information (the thumb/full URL variables aren't supported here)",
			requires: [
				{mouseover_enable_mask_styles2: "always"},
				{mouseover_enable_mask_styles2: "hold"}
			],
			type: "textarea",
			category: "popup",
			subcategory: "popup_other"
		},
		mouseover_mask_fade_time: {
			name: "Background fade",
			description: "Fade in/out time (in milliseconds) for the page background, set to 0 to disable",
			requires: [
				{mouseover_enable_mask_styles2: "always"},
				{mouseover_enable_mask_styles2: "hold"}
			],
			type: "number",
			number_min: 0,
			number_unit: "ms",
			category: "popup",
			subcategory: "popup_other"
		},
		mouseover_ui_styles: {
			name: "Button CSS style",
			description: "Custom CSS styles for the popup's UI buttons. See the documentation for Popup CSS style for more information (the thumb/full URL variables aren't supported here)",
			type: "textarea",
			requires: {
				_condition: "action:popup",
				mouseover_ui: true
			},
			category: "popup",
			subcategory: "ui"
		},
		mouseover_apply_blacklist: {
			name: "Don't popup blacklisted URLs",
			description: "This option popping up for source media with blacklisted URLs. If this is disabled, the popup will open if the end URL isn't blacklisted, regardless of whether the source is blacklisted.",
			requires: {
				mouseover: true
			},
			category: "popup",
			subcategory: "source"
		},
		apply_blacklist_host: {
			name: "Use media blacklist for host websites",
			description: "Overrides the host blacklist to use the media blacklist (specified under Rules)",
			category: "popup",
			subcategory: "source"
		},
		mouseover_matching_media_types: {
			name: "Don't popup different media type",
			description: "This option prevents the popup from loading a video when the source was an image or vice-versa",
			requires: {
				mouseover: true,
				mouseover_allow_video: true
			},
			category: "popup",
			subcategory: "source"
		},
		mouseover_allow_popup_when_fullscreen: {
			name: "Allow popup when fullscreen",
			description: "Allows the popup to open if an element (such as a video player) is fullscreen.",
			requires: {
				mouseover: true
			},
			category: "popup",
			subcategory: "source"
		},
		mouseover_support_pointerevents_none: {
			name: "Support `pointer-events:none`",
			description: "Manually looks through every element on the page to see if the cursor is beneath them. Supports more images, but also results in a higher CPU load for websites such as Facebook.",
			requires: {
				mouseover: true
			},
			//advanced: true, // Commenting this out because the option is important
			category: "popup",
			subcategory: "source"
		},
		mouseover_find_els_mode: {
			name: "Element finding mode",
			description: "How IMU should find the media element on the page.",
			requires: {
				mouseover: true
			},
			options: {
				full: {
					name: "Full",
					description: "Manually looks through every element on the page to see if the cursor is above them. This will result in a higher CPU load for websites such as Facebook, and may return the wrong element"
				},
				hybrid: {
					name: "Hybrid",
					description: "Looks manually through every child element of the last element found by `getElementsAtPoint`. Use this option if in doubt, it'll work on most sites"
				},
				simple: {
					name: "Simple",
					description: "This is the fastest option, which uses the value of `getElementsAtPoint` without modification. Works for sites that don't use pointer-events:none and shadow DOM"
				}
			},
			warning: {
				"full": "This will result in a much higher CPU load for websites such as Facebook, and will occasionally return the wrong element.\nUse this option with caution."
			},
			//advanced: true, // Commenting this out because the option is important
			category: "popup",
			subcategory: "source"
		},
		popup_allow_cache: {
			name: "Use cache",
			description: "Allows use of a media cache for the popup. The cache is currently stored per-page and is not persistent across page reloads.",
			requires: "action:popup",
			category: "popup",
			subcategory: "cache"
		},
		popup_cache_duration: {
			name: "Cache duration",
			description: "How long for media to remain cached. Set to `0` for unlimited.",
			requires: {
				popup_allow_cache: true
			},
			type: "number",
			number_min: 0,
			number_unit: "minutes",
			category: "popup",
			subcategory: "cache"
		},
		popup_cache_itemlimit: {
			name: "Cache item limit",
			description: "Maximum number of individual media to remain cached. Set to `0` for unlimited.",
			requires: {
				popup_allow_cache: true
			},
			type: "number",
			number_min: 0,
			number_unit: "items",
			category: "popup",
			subcategory: "cache"
		},
		popup_cache_resume_video: {
			name: "Resume videos",
			description: "If a video popup was closed then reopened, the video will resume from where it left off",
			requires: {
				popup_allow_cache: true
			},
			category: "popup",
			subcategory: "cache"
		},
		website_inject_imu: {
			name: "Use userscript",
			description: "Replaces the website's IMU instance with the userscript",
			userscript_only: true,
			category: "website"
		},
		website_image: {
			name: "Website image preview",
			description: "Enables a preview of the image on the Image Max URL website",
			userscript_only: true,
			requires: {
				website_inject_imu: true
			},
			category: "website"
		},
		extension_contextmenu: {
			name: "IMU entry in context menu",
			description: "Enables a custom entry for this extension in the right click/context menu",
			extension_only: true,
			category: "general",
			subcategory: "extension",
			imu_enabled_exempt: true
		},
		extension_hotreload: {
			name: "Hot (re)load",
			description: "(Re)loads the extension on all existing pages when installing or updating",
			extension_only: true,
			category: "general",
			subcategory: "extension",
			imu_enabled_exempt: true
		},
		custom_xhr_for_lib: {
			name: "Custom XHR for libraries",
			description: "Allows the use of more powerful XHR (network requests) for 3rd-party libraries. This allows for certain DASH streams to work.",
			description_userscript: "Allows the use of more powerful XHR  (network requests) for 3rd-party libraries. This allows for certain DASH streams to work. Using this with the userscript version currently poses a potential security risk.",
			category: "general",
			subcategory: "libraries",
			example_websites: [
				"Kakao",
				"YouTube",
				"Instagram (downloading)"
			],
			requires: {
				allow_thirdparty_libs: true
			},
			needrefresh: true // todo: clear the library cache (or only for xhr ones)
		},
		bypass_csp_for_lib: {
			name: "Bypass CSP for libraries",
			description: "Tries loading the 3rd-party libraries using a `<script>` tag if a page's CSP prevents it from being loaded normally.\nThis option currently carries an increased security risk when combined with \"Custom XHR for libraries\", and should only be enabled if absolutely necessary.",
			category: "general",
			subcategory: "libraries",
			userscript_only: true,
			requires: {
				allow_thirdparty_libs: true
			},
			example_websites: [
				"Snapchat"
			],
			warning: {
				"true": "This can potentially be extremely insecure if \"Custom XHR for libraries\" is also enabled.\nA malicious website could gain extension-level permissions and perform arbitrary requests (your online accounts could get hacked).\nIf you need to use this option, please disable it as soon as possible."
			},
			needrefresh: true // todo: clear the library cache (or only for xhr ones)
		},
		use_webarchive_for_lib: {
			name: "Use Web Archive for libraries",
			description: "Uses archive.org's web archive instead of github for libraries and other script internals (such as the options page).\nDon't enable this unless you need to.",
			userscript_only: true,
			category: "general",
			subcategory: "libraries"
		},
		lib_integrity_check: {
			name: "Enable integrity checks",
			description: "Runs integrity checks before loading 3rd-party libraries",
			userscript_only: true,
			category: "general",
			subcategory: "libraries"
		},
		hls_dash_use_max: {
			name: "HLS/DASH maximum quality",
			description: "Uses the maximum quality for HLS/DASH streams",
			requires: {
				mouseover_allow_hlsdash: true
			},
			category: "popup",
			subcategory: "video"
		},
		max_video_quality: {
			name: "Maximum video quality",
			description: "Maximum quality for videos",
			requires: {
				mouseover_allow_hlsdash: true // FIXME
			},
			options: {
				_type: "combo",
				"unlimited": {
					name: "(unlimited)",
					is_null: true
				},
				// h prefix is important to keep the order
				"h2160": {
					name: "4K"
				},
				"h1440": {
					name: "1440p"
				},
				"h1080": {
					name: "1080p"
				},
				"h720": {
					name: "720p"
				},
				"h480": {
					name: "480p"
				}
			},
			category: "popup",
			subcategory: "video"
		},
		allow_watermark: {
			name: "Larger watermarked images",
			description: "Enables rules that return larger images that include watermarks",
			category: "rules",
			example_websites: [
				"Stock photo websites"
			],
			onupdate: update_rule_setting
		},
		allow_smaller: {
			name: "Smaller non-watermarked images",
			description: "Enables rules that return smaller images without watermarks",
			category: "rules",
			onupdate: update_rule_setting
		},
		allow_possibly_different: {
			name: "Possibly different images",
			description: "Enables rules that return images that possibly differ, usually due to server-side caching",
			category: "rules",
			onupdate: update_rule_setting
		},
		allow_possibly_broken: {
			name: "Possibly broken images",
			description: "Enables rules that return images that are possibly broken",
			category: "rules",
			hidden: true, // not currently used
			onupdate: update_rule_setting
		},
		allow_possibly_upscaled: {
			name: "Possibly upscaled images",
			description: "Enables rules that return images that are possibly upscaled",
			category: "rules",
			onupdate: update_rule_setting
		},
		allow_uncropped: {
			name: "Uncropped images",
			description: "Enables rules that return possibly undesirable uncropped images",
			example_websites: [
				"Mobile wallpaper websites (returns the full version of the wallpaper image)"
			],
			category: "rules",
			onupdate: update_rule_setting
		},
		allow_thirdparty: {
			name: "Rules using 3rd-party websites",
			description: "Enables rules that use 3rd-party websites",
			category: "rules",
			example_websites: [
				"Newsen"
			],
			onupdate: update_rule_setting
		},
		allow_apicalls: {
			name: "Rules using API calls",
			description: "Enables rules that use API calls. Strongly recommended to keep this enabled",
			category: "rules",
			example_websites: [
				"Instagram",
				"Flickr",
				"..."
			],
			onupdate: update_rule_setting
		},
		allow_thirdparty_libs: {
			name: "Allow 3rd-party libraries",
			description: "Enables using 3rd-party libraries. This is both used in rules and as a prerequisite for certain functionality.",
			description_userscript: "Enables using 3rd-party libraries. This is both used in rules and as a prerequisite for certain functionality.\nThere is a possible (but unlikely) security risk for the userscript version.",
			category: "general",
			subcategory: "libraries",
			example_websites: [
				"Sites using testcookie (slowAES)"
			],
			onupdate: function() {
				update_rule_setting();
				real_api_cache.clear();
			}
		},
		allow_thirdparty_code: {
			name: "Rules executing 3rd-party code",
			description: "Enables rules that execute arbitrary 3rd-party code stored on websites.",
			warning: {
				"true": "This could lead to security risks, please be careful when using this option!"
			},
			category: "rules",
			onupdate: function() {
				update_rule_setting();
				real_api_cache.clear();
			},
			hidden: true // not currently used
		},
		allow_bruteforce: {
			name: "Rules using brute-force",
			description: "Enables rules that require using brute force (through binary search) to find the original image",
			warning: {
				"true": "This could lead to rate limiting or IP bans"
			},
			category: "rules",
			example_websites: [
				"Deezer"
			],
			onupdate: update_rule_setting
		},
		allow_webarchive: {
			name: "Web Archive support",
			description: "Allows rules to be run under archive.org's Wayback Machine.",
			category: "rules"
		},
		browser_cookies: {
			name: "Use browser cookies",
			description: "Uses the browser's cookies for API calls in order to access otherwise private data",
			category: "rules",
			example_websites: [
				"Private Flickr images"
			],
			// Until GM_Cookie is implemented
			extension_only: true,
			hidden: true,
			onupdate: update_rule_setting
		},
		deviantart_prefer_size: {
			name: "DeviantART: Prefer size over original",
			description: "Prefers a larger (but not upscaled) thumbnail image over a smaller original animated image",
			category: "rules",
			subcategory: "rule_specific",
			onupdate: update_rule_setting
		},
		deviantart_support_download: {
			name: "DeviantART: Use download links",
			description: "Prefers using the download link (if available) by default. Note that this only works if you're logged in to DeviantART",
			category: "rules",
			subcategory: "rule_specific",
			onupdate: update_rule_setting
		},
		ehentai_full_image: {
			name: "E-Hentai: Use full image",
			description: "Prefers using full/original images if available (logged in). This is more likely to get you rate limited",
			category: "rules",
			subcategory: "rule_specific",
			onupdate: update_rule_setting
		},
		imgur_filename: {
			name: "Imgur: Use original filename",
			description: "If the original filename (the one used to upload the image) is found, use it instead of the image ID",
			category: "rules",
			subcategory: "rule_specific",
			onupdate: update_rule_setting
		},
		imgur_source: {
			name: "Imgur: Use source image",
			description: "If a source image is found for Imgur, try using it instead. Only works for old-style Imgur webpages (set `postpagebeta=0; postpagebetalogged=0` as cookies)",
			category: "rules",
			subcategory: "rule_specific",
			onupdate: update_rule_setting
		},
		instagram_use_app_api: {
			name: "Instagram: Use native API",
			description: "Uses Instagram's native API if possible, requires you to be logged into Instagram. This usually allows for higher resolution images (1440x*) to be returned.",
			category: "rules",
			subcategory: "rule_specific",
			warning: {
				// no longer currently relevant as this option currently uses the web api, not currently aware of any bans
				// according to a user, this appears to happen if there are more than ~250 requests within 8-12 hours
				//"true": "As of a recent (May 2021) Instagram update, this option may flag your account when requesting too often.\nPlease consider using a backup account if enabling this option."
			},
			onupdate: update_rule_setting
		},
		instagram_dont_use_web: {
			name: "Instagram: Don't use web API",
			description: "Avoids using Instagram's web API if possible, which increases performance, but will occasionally sacrifice quality for videos",
			requires: [{instagram_use_app_api: true}],
			category: "rules",
			subcategory: "rule_specific",
			onupdate: update_rule_setting
		},
		instagram_prefer_video_quality: {
			name: "Instagram: Prefer quality over resolution",
			description: "Prefers lower resolution videos that use a higher bitrate over higher resolution images. This adds a slight performance cost as it needs to fetch headers for multiple videos",
			category: "rules",
			subcategory: "rule_specific",
			onupdate: update_rule_setting
		},
		instagram_gallery_postlink: {
			name: "Instagram: Use albums for post thumbnails",
			description: "Queries Instagram for albums when using the popup on a post thumbnail",
			category: "rules",
			subcategory: "rule_specific"
		},
		snapchat_orig_media: {
			name: "Snapchat: Use original media without captions",
			description: "Prefers using original media instead of media with captions and tags overlayed",
			category: "rules",
			subcategory: "rule_specific"
		},
		teddit_redirect_reddit: {
			name: "Teddit: Use Reddit for media",
			description: "Redirects media stored on Teddit to Reddit's servers. Disabling this may prevent finding original images because Teddit's image servers will only cache images fetched from posts, which are deleted after a few minutes.",
			category: "rules",
			subcategory: "rule_specific",
			onupdate: update_rule_setting
		},
		tiktok_app_api: {
			name: "TikTok: Use app API",
			description: "Uses TikTok's app API to find video information.",
			category: "rules",
			subcategory: "rule_specific",
			onupdate: update_rule_setting
		},
		tiktok_no_watermarks: {
			name: "TikTok: Don't use watermarked videos",
			description: "Uses non-watermarked videos for TikTok if possible. This will introduce an extra delay when loading the video as two extra requests need to be performed. It will also fail for any videos uploaded after ~late July 2020",
			hidden: true,
			category: "rules",
			subcategory: "rule_specific",
			onupdate: update_rule_setting
		},
		tiktok_thirdparty: {
			name: "TikTok: 3rd-party watermark removal",
			description: "Uses a 3rd-party watermark removal site for TikTok.\nI do not endorse any of the sites supported. They may log your IP address and videos you submit. Use this option with caution.\n`LQ` = Low quality, `PL` = Public log",
			requires: [{
				allow_thirdparty: true
			}],
			hidden: true,
			options: {
				_type: "combo",
				_randomize: true,
				"null": {
					name: "(none)",
					is_null: true
				},

				"ttloader.com:ttt": {
					name: "ttloader.com"
				},
				"onlinetik.com:ttt": {
					name: "onlinetik.com"
				},
				"tikdowns.com:ttt": {
					name: "tikdowns.com"
				},
				"ssstiktok.net:ttt": {
					name: "ssstiktok.net"
				},

				// dead
				/*"tiktokdownloader.in:ttt": {
					name: "tiktokdownloader.in"
				},*/
				// dead
				/*"savevideo.ninja:ttt": {
					name: "savevideo.ninja"
				},*/

				// removing watermark doesn't work
				"keeptiktok.com": {
					name: "keeptiktok.com (LQ)"
				},
				"ssstiktok.io:1": {
					name: "ssstiktok.io (LQ)"
				},
				"musicallydown.com:1": {
					name: "musicallydown.com (LQ/PL)"
				},
				"snaptik.app": {
					name: "snaptik.app (LQ)"
				},
				"tikmate.online": {
					name: "tikmate.online (LQ)"
				}
			},
			category: "rules",
			subcategory: "rule_specific",
			onupdate: update_rule_setting
		},
		tumblr_api_key: {
			name: "Tumblr: API key",
			description: "API key for finding larger images on Tumblr",
			category: "rules",
			subcategory: "rule_specific",
			type: "lineedit",
			onupdate: update_rule_setting
		},
		twitter_use_ext: {
			name: "Twitter: Use extension",
			description: "Prefers `.jpg?name=orig` over `?format=jpg&name=orig`. This will possibly incur extra requests before succeeding. Note that there is no difference in image quality.",
			category: "rules",
			subcategory: "rule_specific",
			onupdate: update_rule_setting
		},
		youtube_replace_n: {
			name: "YouTube: Enable faster speeds",
			description: "Increases the download bandwidth for YouTube videos by replacing the `n` parameter. Note that this may execute untrusted Javascript.",
			requires: {
				allow_thirdparty_libs: true
			},
			category: "rules",
			subcategory: "rule_specific",
			onupdate: update_rule_setting
		},
		bigimage_blacklist: {
			name: "Media blacklist",
			description: "A list of URLs (one per line) that are blacklisted from being processed",
			category: "rules",
			type: "textarea"
		},
		bigimage_blacklist_mode: {
			name: "Media blacklist mode",
			description: "Whether the media blacklist should act as a blacklist or a whitelist",
			category: "rules",
			options: {
				whitelist: {
					name: "Whitelist"
				},
				blacklist: {
					name: "Blacklist"
				}
			}
		},
		bigimage_blacklist_engine: {
			name: "Blacklist engine",
			description: "How blacklists should be processed",
			category: "general",
			options: {
				glob: {
					name: "Simple (glob)"
				},
				regex: {
					name: "Regex"
				}
			}
		},
		host_blacklist: {
			name: "Host blacklist",
			description: "A list of host URLs (one per line) that the popup is blacklisted from. For example, adding `twitter.com` to this blacklist would prevent any popup from opening on twitter.com.",
			type: "textarea",
			requires: {
				mouseover: true,
				apply_blacklist_host: false
			},
			category: "popup",
			subcategory: "source"
		},
		host_blacklist_mode: {
			name: "Host blacklist mode",
			description: "Whether the host blacklist should act as a blacklist or a whitelist",
			category: "popup",
			subcategory: "source",
			options: {
				whitelist: {
					name: "Whitelist"
				},
				blacklist: {
					name: "Blacklist"
				}
			}
		},
		host_html_blacklist: {
			name: "HTML page blacklist",
			description: "A list of URLs (one per line) that are blacklisted from being redirected.",
			requires: {
				redirect: true,
				redirect_host_html: true
			},
			category: "redirection",
			type: "textarea",
			advanced: true
		},
		host_html_blacklist_mode: {
			name: "HTML page blacklist mode",
			description: "Whether the HTML page blacklist should act as a blacklist or a whitelist",
			requires: {
				redirect: true,
				redirect_host_html: true
			},
			category: "redirection",
			options: {
				whitelist: {
					name: "Whitelist"
				},
				blacklist: {
					name: "Blacklist"
				}
			},
			advanced: true
		},
		filename_format: {
			name: "Filename format",
			description: "Format string(s) for the filename",
			type: "textarea",
			category: "rules",
			documentation: {
				title: "Documentation",
				value: [
					"<p>Variables are specified between curly brackets (<code>{}</code>).</p>",
					"<p>Below is a list of valid variables:</p>",
					"<ul><br />",
					"<li><code>filename</code> - Original filename (with extension, if applicable)</li>",
					"<li><code>filename_noext</code> - Original filename (without extension, if applicable)</li>",
					"<li><code>ext</code> - Extension (with <code>.</code> prefixed)</li>",
					"<li><code>caption</code> - Popup caption</li>",
					"<li><code>author_username</code> - Author's username</li>",
					"<li><code>id</code> - Post ID</li>",
					"<li><code>host_title</code> - Title of the current tab/window</li>",
					"<li><code>host_url</code> - URL of the host webpage</li>",
					"<li><code>host_domain</code> - Domain of the host webpage</li>",
					"<li><code>host_domain_nosub</code> - Domain (without subdomains) of the host webpage</li>",
					"<li><code>url</code> - URL of the media</li>",
					"<li><code>domain</code> - Domain of the media</li>",
					"<li><code>domain_nosub</code> - Domain (without subdomains) of the media</li>",
					"<li><code>is_screenshot</code> - Blank, the line will only be processed when screenshotting a video</li>",
					"<li><code>prefix</code>, <code>suffix</code> - Blank by default, these variables will be automatically prefixed/suffixed to the filename if set using <code>:=</code></li>",
					"<li><code>created_...</code> - Created date (see note on Date objects below)</li>",
					"<li><code>updated_...</code> - Updated date, this will use the <code>Last-Modified</code> header if not otherwise specified by the rule (see note on Date objects below)</li>",
					"<li><code>download_...</code> - Download date (see note on Date objects below)</li>",
					"<li><code>date_...</code> - Created/updated date (see note on Date objects below)</li>",
					"</ul><br />",
					"<p>You can truncate the value of a variable by adding <code>:(number)</code> before the end bracket (<code>}</code>). For example:</p>",
					"<ul><br />",
					"<li><code>{caption:10}</code> - Truncates the caption to be at most 10 characters long</li>",
					"<li><code>{caption:10.}</code> - Same, but will add an ellipsis (\u2026) if the caption was truncated</li>",
					"</ul><br />",
					"<p>If a variable doesn't exist, by default it will ignore the current format string and use the one on the next line, unless <code>?</code> is added before the end bracket. For example:</p>",
					"<ul><br />",
					"<li><code>{ext?}</code> - Will be replaced with nothing if <code>ext</code> doesn't exist</li>",
					"<li><code>{caption?no caption}</code> - Will be replaced with <code>no caption</code> if <code>caption</code> doesn't exist</li>",
					"</ul><br />",
					"<p>You can check for equality and inequality with <code>==</code> and <code>!=</code> operators respectively. For example:</p>",
					"<ul><br />",
					"<li><code>{domain_nosub==cdninstagram.com}{author_username} {id}</code> - Will only run the current format (<code>{author_username} {id}</code> in this case) if the domain is cdninstagram.com</li>",
					"</ul><br />",
					"<p>You can check if a variable contains a string with <code>/=</code> (<code>!/=</code> for the opposite). It also supports two flags, <code>r</code> (regex) and <code>c</code> (case-sensitive), if added between <code>/</code> and <code>=</code>. For example:</p>",
					"<ul><br />",
					"<li><code>{domain/=instagram}{id}</code> - Will only run the current format (<code>{id}</code>) if the domain contains <code>instagram</code></li>",
					"<li><code>{domain!/=instagram}{id}</code> - Likewise, but only if the domain does not contain <code>instagram</code></li>",
					"<li><code>{domain/r=inst.*ram}{id}</code> - Likewise, but only if the domain matches the regex <code>inst.*ram</code></li>",
					"<li><code>{window_title/c=Instagram}{id}</code> - Likewise, but only if the window's title contains <code>Instagram</code> (case-sensitively)</li>",
					"<li><code>{window_title!/rc=Inst.*ram}{id}</code> - Likewise, but only if the window's title does not match the case-sensitive regex <code>Inst.*ram</code></li>",
					"</ul><br />",
					"<p>You can set a custom variable with <code>:=</code>. For example:</p>",
					"<ul><br />",
					"<li><code>{domain_nosub==cdninstagram.com}{foo:=bar}</code> - Sets the variable <code>foo</code> to <code>bar</code> if the domain is <code>cdninstagram.com</code>. The variable can then be accessed with e.g. <code>{foo}</code></li>",
					"</ul><br />",
					"<p>Date objects are accessible through a number of properties. Each property can be suffixed with <code>_utc</code> to get the UTC/GMT equivalent.</p>",
					"<ul><br />",
					"<li><code>..._iso</code> - Date in ISO format (e.g. <code>2019-12-31T23-30-56</code>). Note that <code>:</code> is replaced with <code>-</code> to avoid issues with paths under NTFS.</li>",
					"<li><code>..._ago</code> - Human-readable representation of the time elapsed since the date (e.g. <code>1 year and 10 months ago</code>, <code>5 months and 20 days ago</code>)</li>",
					"<li><code>..._unix</code> - Unix timestamp (e.g. <code>1577912345</code>)</li>",
					"<li><code>..._unix_ms</code> - Unix timestamp with millisecond accuracy (e.g. <code>1577912345678</code>)</li>",
					"<li><code>..._yyyymmdd</code> - Date in YYYYMMDD format (e.g. <code>20191230</code>)</li>",
					"<li><code>..._hhmmss</code> - Time in HHMMSS format (e.g. <code>233056</code>)</li>",
					"<li><code>..._year</code> - Full year (e.g. <code>2019</code>)</li>",
					"<li><code>..._month</code> - Zero-padded month (e.g. <code>12</code>)</li>",
					"<li><code>..._day</code> - Zero-padded day (e.g. <code>31</code>)</li>",
					"<li><code>..._hours</code> - Zero-padded hours in military/24-hour format (e.g. <code>23</code>)</li>",
					"<li><code>..._minutes</code> - Zero-padded minutes (e.g. <code>30</code>)</li>",
					"<li><code>..._seconds</code> - Zero-padded seconds (e.g. <code>56</code>)</li>",
					"</ul>"
				].join("\n")
			}
		},
		filename_replace_special_underscores: {
			name: "Replace special characters with underscores",
			description: "Replaces characters such as `/` or `\"` with `_` when downloading. Note that browsers will usually do this automatically, this is just to ensure consistent behavior.",
			category: "rules"
		},
		replaceimgs_enable_keybinding: {
			name: "Enable trigger key",
			description: "Enables the use of the trigger key to run it without needing to use the menu",
			category: "extra",
			subcategory: "replaceimages",
		},
		replaceimgs_keybinding: {
			name: "Trigger key",
			description: "Trigger keybinding that will run the Replace Images function",
			requires: {
				replaceimgs_enable_keybinding: true
			},
			type: "keysequence",
			category: "extra",
			subcategory: "replaceimages"
		},
		replaceimgs_auto: {
			name: "Automatically replace images",
			description: "Automatically replace images to larger versions on pages you view",
			warning: {
				"true": "This could lead to rate limiting or IP bans"
			},
			// Auto-updating is disabled due to the warning above
			needrefresh: true,
			category: "extra",
			subcategory: "replaceimages"
		},
		replaceimgs_usedata: {
			name: "Use data URLs",
			description: "Uses data:// URLs instead of image links. Disabling this may improve compatibility with some bulk image downloader extensions",
			category: "extra",
			subcategory: "replaceimages",
			imu_enabled_exempt: true
		},
		replaceimgs_wait_fullyloaded: {
			name: "Wait until image is fully loaded",
			description: "Waits until the image being replaced is fully loaded before moving on to the next image",
			category: "extra",
			subcategory: "replaceimages",
			requires: {
				replaceimgs_usedata: false
			},
			imu_enabled_exempt: true
		},
		replaceimgs_totallimit: {
			name: "Max images to process at once",
			description: "The maximum amount of images to process at once",
			type: "number",
			number_min: 1,
			number_int: true,
			number_unit: "images",
			category: "extra",
			subcategory: "replaceimages",
			imu_enabled_exempt: true
		},
		replaceimgs_domainlimit: {
			name: "Max images per domain at once",
			description: "The maximum amount of images per domain to process at once",
			type: "number",
			number_min: 1,
			number_int: true,
			number_unit: "images",
			category: "extra",
			subcategory: "replaceimages",
			imu_enabled_exempt: true
		},
		replaceimgs_delay: {
			name: "Delay between same-domain images",
			description: "New requests for images in the same domain will be delayed by this amount of seconds. Useful for avoiding rate limits.",
			type: "number",
			number_min: 0,
			number_unit: "seconds",
			category: "extra",
			subcategory: "replaceimages",
			imu_enabled_exempt: true
		},
		replaceimgs_replaceimgs: {
			name: "Replace images",
			description: "Replaces images to their larger versions when the button is pressed",
			category: "extra",
			subcategory: "replaceimages",
			imu_enabled_exempt: true
		},
		replaceimgs_addlinks: {
			name: "Add links",
			description: "Adds links around replaced media if a link doesn't already exist",
			category: "extra",
			subcategory: "replaceimages",
			imu_enabled_exempt: true
		},
		replaceimgs_replacelinks: {
			name: "Replace links",
			description: "Replaces links if they already exist",
			category: "extra",
			subcategory: "replaceimages",
			requires: {
				replaceimgs_addlinks: true
			},
			imu_enabled_exempt: true
		},
		replaceimgs_plainlinks: {
			name: "Plain hyperlinks",
			description: "How to treat plain (non-media) hyperlinks that link to potential media",
			category: "extra",
			subcategory: "replaceimages",
			options: {
				_type: "combo",
				none: {
					name: "Ignore"
				},
				// todo: replace_link?
				replace_link_text: {
					name: "Replace link+text"
				},
				replace_media: {
					name: "Replace media"
				}
				// the lack of replace_link_media is intentional, as replaceimgs_addlinks covers this already
			},
			requires: {
				// is this correct?
				replaceimgs_replaceimgs: true
			},
			imu_enabled_exempt: true
		},
		replaceimgs_links_newtab: {
			name: "Links open in new tab",
			description: "Clicking on a replaced link will open the media in a new tab",
			category: "extra",
			subcategory: "replaceimages",
			requires: {
				replaceimgs_addlinks: true
			},
			imu_enabled_exempt: true
		},
		replaceimgs_remove_size_constraints: {
			name: "Remove size constraints",
			description: "Removes height/width specifiers for replaced media",
			category: "extra",
			subcategory: "replaceimages",
			requires: {
				replaceimgs_replaceimgs: true
			},
			imu_enabled_exempt: true
		},
		replaceimgs_size_constraints: {
			name: "Size constraints",
			description: "Removes or enforces height/width specifiers for replaced media",
			category: "extra",
			subcategory: "replaceimages",
			requires: {
				replaceimgs_replaceimgs: true
			},
			options: {
				_type: "combo",
				none: {
					name: "Ignore"
				},
				remove: {
					name: "Remove"
				},
				force: {
					name: "Force"
				}
			},
			imu_enabled_exempt: true
		},
		replaceimgs_css: {
			name: "Replacement CSS",
			description: "CSS styles to apply to replaced media. See the documentation for Popup CSS style for more information (the thumb/full URL variables aren't yet supported here)",
			type: "textarea",
			category: "extra",
			subcategory: "replaceimages",
			requires: {
				replaceimgs_replaceimgs: true
			},
			imu_enabled_exempt: true
		},
		replaceimgs_simple_progress: {
			name: "Simple progress",
			description: "Uses a simpler progress bar that has a fixed size for all media. This is useful to see how many images are replaced, rather than the ETA",
			category: "extra",
			subcategory: "replaceimages",
			imu_enabled_exempt: true
		},
		highlightimgs_enable_keybinding: {
			name: "Enable trigger key",
			description: "Enables the use of the trigger key to run it without needing to use the menu",
			category: "extra",
			subcategory: "highlightimages",
		},
		highlightimgs_keybinding: {
			name: "Trigger key",
			description: "Trigger keybinding that will run the Highlight Images function",
			requires: {
				highlightimgs_enable_keybinding: true
			},
			type: "keysequence",
			category: "extra",
			subcategory: "highlightimages"
		},
		highlightimgs_enable: {
			name: "Enable button",
			description: "Enables the 'Highlight Images' button",
			category: "extra",
			subcategory: "highlightimages",
			imu_enabled_exempt: true
		},
		highlightimgs_auto: {
			name: "Automatically highlight images",
			description: "Automatically highlights images as you view pages",
			options: {
				_type: "or",
				always: {
					name: "Always"
				},
				hover: {
					name: "Hover",
					description: "When hovering over an image"
				},
				never: {
					name: "Never"
				}
			},
			category: "extra",
			subcategory: "highlightimages"
		},
		highlightimgs_onlysupported: {
			name: "Only explicitly supported images",
			description: "Only highlights images that can be made larger or the original version can be found",
			requires: [
				{highlightimgs_enable: true},
				{highlightimgs_auto: "always"},
				{highlightimgs_auto: "hover"}
			],
			category: "extra",
			subcategory: "highlightimages"
		},
		highlightimgs_css: {
			name: "Highlight CSS",
			description: "CSS style to apply for highlight. See the documentation for Popup CSS style for more information (the thumb/full URL variables aren't supported here)",
			type: "textarea",
			requires: [
				{highlightimgs_enable: true},
				{highlightimgs_auto: "always"},
				{highlightimgs_auto: "hover"}
			],
			category: "extra",
			subcategory: "highlightimages",
			imu_enabled_exempt: true
		},
		customgallery_enable_keybinding: {
			name: "Enable trigger key",
			description: "Enables the use of the trigger key to run it without needing to use the menu",
			category: "extra",
			subcategory: "customgallery",
		},
		customgallery_keybinding: {
			name: "Trigger key",
			description: "Trigger keybinding that will run the Custom Gallery function",
			requires: {
				customgallery_enable_keybinding: true
			},
			type: "keysequence",
			category: "extra",
			subcategory: "customgallery"
		},
		customgallery_enable_button: {
			name: "Enable button",
			description: "Enables the 'Custom Gallery' button",
			category: "extra",
			subcategory: "customgallery",
			imu_enabled_exempt: true
		},
		customgallery_apply_key: {
			name: "Apply key",
			description: "Triggers the gallery when pressed",
			requires: [
				{customgallery_enable_button: true},
				{customgallery_enable_keybinding: true}
			],
			type: "keysequence",
			category: "extra",
			subcategory: "customgallery",
			imu_enabled_exempt: true
		},
		customgallery_bg_css: {
			name: "Background CSS",
			description: "CSS style to apply for the background",
			type: "textarea",
			requires: [
				{customgallery_enable_button: true},
				{customgallery_enable_keybinding: true}
			],
			category: "extra",
			subcategory: "customgallery",
			imu_enabled_exempt: true
		},
		customgallery_outline_css: {
			name: "Outline CSS",
			description: "CSS style to apply for element outlines",
			type: "textarea",
			requires: [
				{customgallery_enable_button: true},
				{customgallery_enable_keybinding: true}
			],
			category: "extra",
			subcategory: "customgallery",
			imu_enabled_exempt: true
		},
	};

	var option_to_problems = {
		allow_watermark: "watermark",
		allow_smaller: "smaller",
		allow_possibly_different: "possibly_different",
		allow_possibly_broken: "possibly_broken",
		allow_possibly_upscaled: "possibly_upscaled",
		allow_bruteforce: "bruteforce",
		allow_uncropped: "uncropped"
	};

	var categories = {
		"general": "General",
		"redirection": "Redirection",
		"popup": "Popup",
		"keybinds": "Shortcuts",
		"rules": "Rules",
		"website": "Website",
		"extra": "Buttons"
	};

	var subcategories = {
		"general": {
			"settings": "subcategory_settings",
			"update": "subcategory_update",
			"libraries": "subcategory_libraries",
			"extension": "subcategory_extension"
		},
		"popup": {
			"trigger": "subcategory_trigger",
			"source": "subcategory_popup_source",
			"open_behavior": "subcategory_open_behavior",
			"close_behavior": "subcategory_close_behavior",
			"behavior": "subcategory_behavior",
			"cache": "subcategory_cache",
			"gallery": "subcategory_gallery",
			"video": "subcategory_video",
			"ui": "subcategory_ui",
			"popup_other": "subcategory_popup_other"
		},
		"keybinds": {
			"popup": "subcategory_keybinds_popup_actions",
			"gallery": "subcategory_gallery",
			"video": "subcategory_video"
		},
		"rules": {
			"rule_specific": "subcategory_rule_specific"
		},
		"extra": {
			"replaceimages": "subcategory_replaceimages",
			"highlightimages": "subcategory_highlightimages",
			"customgallery": "subcategory_customgallery"
		}
	};

	var settings_conditions = {
		"action:popup": {
			"mouseover_open_behavior": "popup"
		}
	};

	// this is horrible, a better solution would be to just have a settings_list object and iterate over that instead
	var obj_insertafter = function(obj, oldkey, newkey, value) {
		var newobj = {};

		for (var key in obj) {
			newobj[key] = obj[key];

			if (key === oldkey) {
				newobj[newkey] = value;
			}
		}

		return newobj;
	};

	// populate profiled settings
	(function() {
		for (var setting in settings_meta) {
			var orig_meta = settings_meta[setting];
			if (!orig_meta.profiled) continue;

			var default_value = settings[setting];

			for (var i = 0; i < num_profiles; i++) {
				var trigger_id = i + 2;
				var profiled_setting_name = "t" + trigger_id + "_" + setting;

				var setting_before = setting;
				if (i > 0) {
					setting_before = "t" + (trigger_id - 1) + "_" + setting;
				}

				settings = obj_insertafter(settings, setting_before, profiled_setting_name, default_value) as (typeof settings);

				var profiled_meta = deepcopy(orig_meta);
				settings_meta[profiled_setting_name] = profiled_meta;

				if (is_interactive) {
					profiled_meta.name = _(profiled_meta.name) + " (#" + trigger_id + ")";
					profiled_meta.description = null;
					profiled_meta.example_websites = null;
				}

				if (profiled_meta.requires) {
					var requires = profiled_meta.requires;
					if (!is_array(requires)) requires = [requires];

					array_foreach(requires as Array<any>, function(srequire) {
						srequire["mouseover_trigger_key_t" + trigger_id] = true;
					});

					profiled_meta.requires = requires;
				}
			}
		}
	})();

	let blacklist_settings = {
		bigimage_blacklist: {
			create_regexes() {return create_blacklist_regexes()}
		},
		host_blacklist: {
			create_regexes() {return create_host_blacklist_regexes()}
		},
		host_html_blacklist: {
			create_regexes() {return create_host_html_blacklist_regexes()}
		}
	};
	for (let bl in blacklist_settings) {
		settings_meta[bl].onupdate = function() {
			update_rule_setting();
			blacklist_settings[bl].create_regexes();
		};

		settings_meta[bl].onedit = function() {
			let errors = blacklist_settings[bl].create_regexes();

			let errordiv = null;

			try {
				errordiv = document.querySelector("#option_" + bl + " .error");
				errordiv.innerText = "";
				errordiv.classList.add("hidden");
			} catch (e) {
			}

			if (errors) {
				for (var i = 0; i < errors.length; i++) {
					if (errordiv) {
						errordiv.innerText += errors[i].message + "\n";
						errordiv.classList.remove("hidden");
					}

					console.error(errors[i]);
				}
			}
		};

		settings_meta[bl].documentation = {
			title: "Documentation",
			value: [
				"The examples below are written for the simple (glob) engine, not the regex engine. The glob engine is generally based on the UNIX glob syntax.<br />",
				"<ul><br />",
				"<li><code>google.com</code> will block https://google.com/, https://www.google.com/, https://abcdef.google.com/, https://def.abc.google.com/, etc.</li>",
				"<li><code>abc.google.com</code> will block https://abc.google.com/, https://def.abc.google.com/, etc.</li>",
				"<li><code>*.google.com</code> will block https://www.google.com/, https://def.abc.google.com/, etc. but not https://google.com/</li>",
				"<li><code>google.*/</code> will block https://google.com/, https://www.google.co.uk, etc.</li>",
				"<li><code>http://google.com</code> will block http://google.com/, but not https://google.com/, http://www.google.com/, etc.</li>",
				"<li><code>google.com/test</code> will block https://google.com/test, https://www.google.com/test/abcdef, but not https://google.com/, etc.</li>",
				"<li><code>google.com/*/test</code> will block https://google.com/abc/test, but not https://google.com/test or https://google.com/abc/def/test</li>",
				"<li><code>google.com/**/test</code> will block https://google.com/abc/test, https://google.com/abc/def/test, https://google.com/abc/def/ghi/test, etc. but not https://google.com/test</li>",
				"<li><code>g??gle.com</code> will block https://google.com/, https://gaagle.com/, https://goagle.com/, etc.</li>",
				"<li><code>google.{com,co.uk}</code> will block https://google.com/ and https://google.co.uk/</li>",
				"<li><code>g[oau]ogle.com</code> will block https://google.com/, https://gaogle.com/, and http://www.guogle.com/</li>",
				"<li><code>g[0-9]ogle.com</code> will block https://g0ogle.com/, https://g1ogle.com/, etc. (up to https://g9ogle.com/)</li>",
				"</ul>"
			].join("\n")
		};
	}

	var orig_settings = deepcopy(settings);

	// imu:begin_exclude
	var do_process_strings = false;
	var process_strings = function() {
		/*for (var string in strings) {
			if (!("en" in strings[string])) {
				strings[string]["en"] = string;
			}
		}*/

		for (var setting in settings_meta) {
			var meta = settings_meta[setting];

			// don't add dead settings to translate
			if (!(setting in settings)) {
				continue;
			}

			var add_info_field = function(setting, fieldname, value) {
				if (!value)
					return;

				if (!(value in strings)) {
					strings[value] = {};
				}

				if (!("_info" in strings[value])) {
					strings[value]._info = {};
				}

				if (!("instances" in strings[value]._info)) {
					strings[value]._info.instances = [];
				}

				var instance = {
					setting: setting,
					field: fieldname
				};

				var instancejson = JSON_stringify(instance);

				var instances = strings[value]._info.instances;
				var found = false;
				for (var i = 0; i < instances.length; i++) {
					if (JSON_stringify(instances[i]) === instancejson) {
						found = true;
						break;
					}
				}

				if (!found)
					instances.push(instance);
			};

			add_info_field(setting, "name", meta.name);
			add_info_field(setting, "description", meta.description);
			add_info_field(setting, "description_userscript", meta.description_userscript);
			add_info_field(setting, "number_unit", meta.number_unit);

			if (meta.warning) {
				for (var key in meta.warning) {
					add_info_field(setting, "warning." + key, meta.warning[key]);
				}
			}

			if (meta.options) {
				var process_options = function(options) {
					for (var key in options) {
						if (/^_group/.test(key)) {
							process_options(options[key]);
						} else if (key[0] !== "_") {
							add_info_field(setting, "options." + key + ".name", options[key].name);
							add_info_field(setting, "options." + key + ".description", options[key].description);
						}
					};
				}

				process_options(meta.options);
			}

			if (meta.documentation) {
				add_info_field(setting, "documentation.title", meta.documentation.title);
				add_info_field(setting, "documentation.value", meta.documentation.value);
			}

			if (meta.example_websites) {
				for (var i = 0; i < meta.example_websites.length; i++) {
					add_info_field(setting, "example_websites[" + i + "]", meta.example_websites[i]);
				}
			}
		}

		var string_order = ["_info", "en"];
		for (var string in strings) {
			var value = strings[string];

			strings[string] = {};
			var keys = Object.keys(value).sort(function(a, b) {
				var a_index = array_indexof(string_order, a);
				var b_index = array_indexof(string_order, b);

				if (a_index < 0) {
					if (b_index >= 0)
						return 1;
					else
						return a.localeCompare(b);
				} else {
					if (b_index < 0)
						return -1;
					else
						return a_index - b_index;
				}
			});

			if (keys[0] !== "_info") {
				console_error("'_info' should be first", string, keys);
			}

			for (var i = 0; i < keys.length; i++) {
				strings[string][keys[i]] = value[keys[i]];
			}
		}

		return strings;
	};

	if (do_process_strings)
		console_log(process_strings());
	// imu:end_exclude

	for (var option in option_to_problems) {
		var problem = option_to_problems[option];
		settings[option] = array_indexof(default_options.exclude_problems, problem) < 0;
	}

	var settings_history = {};

	type IMUMapNative = Map<any, any>;
	type IMUMapKV = { key: string, value: any };
	type IMUMapEmulated = {
		imu_map: true,
		object: Record<string, any>,
		array: Array<IMUMapKV>
	};
	type IMUMap = IMUMapNative | IMUMapEmulated;

	var new_map = function():IMUMap {
		var map:IMUMap;

		let can_use_native_map = false;

		try {
			if (("entries" in Map.prototype) &&
				("set" in Map.prototype) &&
				("values" in Map.prototype)) {
				map = new Map();
				can_use_native_map = true;
			}
		} catch (e) {}

		if (!can_use_native_map) {
			map = {
				imu_map: true,
				object: {},
				array: []
			};
		}

		return map;
	};

	var _map_is_key_primitive = function(key:any):boolean {
		return typeof key === "string" || typeof key === "number";
	};

	var _map_indexof = function(map:IMUMapEmulated, key:any):number {
		for (var i = 0; i < map.array.length; i++) {
			if (map.array[i].key === key) {
				return i;
			}
		}

		return -1;
	};

	var _map_is_emu = function(map:IMUMap):boolean {
		return !!(map as IMUMapEmulated).imu_map;
	}

	var _map_set_native = function(map:IMUMapNative, key:any, value:any):void {
		map.set(key, value);
	};

	var _map_set_emu = function(map:IMUMapEmulated, key:any, value:any):void {
		if (_map_is_key_primitive(key)) {
			map.object[key] = value;
		} else {
			var index = _map_indexof(map, key);
			if (index < 0) {
				map.array.push({key: key, value: value});
			} else {
				map.array[index].value = value;
			}
		}
	};

	var map_set = function<T>(map:IMUMap, key:any, value:T):T {
		nir_debug("map", "map_set", deepcopy(key), deepcopy(value));

		if (!_map_is_emu(map)) {
			_map_set_native(map as IMUMapNative, key, value);
		} else {
			_map_set_emu(map as IMUMapEmulated, key, value);
		}

		return value;
	};

	var _map_get_native = function(map:IMUMapNative, key:any):any {
		return map.get(key);
	};

	var _map_get_emu = function(map:IMUMapEmulated, key:any):any {
		if (_map_is_key_primitive(key)) {
			return map.object[key];
		} else {
			var index = _map_indexof(map, key);
			if (index >= 0) {
				return map.array[index].value;
			} else {
				return void 0;
			}
		}
	};

	var map_get = function(map:IMUMap, key):any {
		if (!_map_is_emu(map)) {
			return _map_get_native(map as IMUMapNative, key);
		} else {
			return _map_get_emu(map as IMUMapEmulated, key);
		}
	};

	var _map_has_native = function(map:IMUMapNative, key:any):boolean {
		return map.has(key);
	};

	var _map_has_emu = function(map:IMUMapEmulated, key:any):boolean {
		if (_map_is_key_primitive(key)) {
			return key in map.object;
		} else {
			return _map_indexof(map, key) >= 0;
		}
	};

	var map_has = function(map:IMUMap, key:any):boolean {
		if (!_map_is_emu(map)) {
			return _map_has_native(map as IMUMapNative, key);
		} else {
			return _map_has_emu(map as IMUMapEmulated, key);
		}
	};

	var _map_remove_native = function(map:IMUMapNative, key:any):void {
		map.delete(key);
	}

	var _map_remove_emu = function(map:IMUMapEmulated, key:any):void {
		if (_map_is_key_primitive(key)) {
			delete map.object[key];
		} else {
			var index = _map_indexof(map, key);
			if (index >= 0) {
				map.array.splice(index, 1);
			}
		}
	}

	var map_remove = function(map:IMUMap, key:any):void {
		if (!_map_is_emu(map)) {
			return _map_remove_native(map as IMUMapNative, key);
		} else {
			return _map_remove_emu(map as IMUMapEmulated, key);
		}
	};

	type IMUMapForeachCb = (key: any, value: any)=>void;
	var _map_foreach_native = function(map:IMUMapNative, cb:IMUMapForeachCb):void {
		var keys = map.keys();
		while (true) {
			var key_it = keys.next();
			if (key_it.done)
				break;

			var key = key_it.value;
			cb(key, map.get(key));
		}
	};

	var _map_foreach_emu = function(map:IMUMapEmulated, cb:IMUMapForeachCb):void {
		for (var key in map.object) {
			cb(key, map.object[key]);
		}

		for (var i = 0; i < map.array.length; i++) {
			cb(map.array[i].key, map.array[i].value);
		}
	};

	var map_foreach = function(map:IMUMap, cb:IMUMapForeachCb):void {
		if (!_map_is_emu(map)) {
			return _map_foreach_native(map as IMUMapNative, cb);
		} else {
			return _map_foreach_emu(map as IMUMapEmulated, cb);
		}
	};

	var _map_size_native = function(map:IMUMapNative):number {
		return map.size;
	};

	var _map_size_emu = function(map:IMUMapEmulated):number {
		return Object.keys(map.object).length + map.array.length;
	};

	var map_size = function(map:IMUMap):number {
		if (!_map_is_emu(map)) {
			return _map_size_native(map as IMUMapNative);
		} else {
			return _map_size_emu(map as IMUMapEmulated);
		}
	};

	type IMUSet = IMUMap;

	var new_set = function():IMUSet {
		return new_map();
	};

	var set_add = function(set:IMUSet, key:any):true {
		return map_set(set, key, true);
	};

	var set_has = function(set:IMUSet, key:any):boolean {
		return map_has(set, key);
	};

	var set_remove = function(set:IMUSet, key:any):void {
		return map_remove(set, key);
	};

	type CacheOptions = {
		max_keys?:number,
		destructor?:(key:string, value:any)=>void
	};

	class IMUCache {
		data = new_map();
		times = new_map();
		fetches = new_map();
		options:CacheOptions = {};

		constructor(options?:CacheOptions) {
			if (options)
				this.options = options;
		}

		set(key:any, value:any, time?:number) {
			nir_debug("cache", "Cache.set key:", key, ", time=" + time + ", value:", deepcopy(value));

			this.remove(key);

			if (this.options.max_keys) {
				var current_size = map_size(this.data);
				if (current_size > this.options.max_keys) {
					var all_keys = [];

					map_foreach(this.times, function(key, value) {
						all_keys.push({key: key, end_time: value.end_time, added_time: value.added_time});
					});

					// we prioritize removing the key closest to expiry before the oldest key
					all_keys.sort(function(a, b) {
						if (a.end_time) {
							if (!b.end_time)
								return -1;

							return a.end_time - b.end_time;
						} else {
							if (b.end_time)
								return 1;

							return a.added_time - b.added_time;
						}
					});

					var keys_to_remove = current_size - this.options.max_keys;
					var key_id = 0;
					while (key_id < all_keys.length && keys_to_remove > 0) {
						this.remove(all_keys[key_id++].key);
						keys_to_remove--;
					}
				}
			}

			map_set(this.data, key, value);

			var added_time = Date.now();
			if (typeof time === "number" && time > 0) {
				var cache = this;
				var timer = setTimeout(function() {
					cache.remove(key);
				}, time * 1000);

				// Ensures the process can exit in node.js
				if (is_node && typeof timer !== "number" && "unref" in timer) {
					(timer as any).unref();
				}

				map_set(this.times, key, {
					timer: timer,
					time: time,
					added_time: added_time,
					end_time: added_time + time
				});
			} else {
				map_set(this.times, key, {
					added_time: added_time
				});
			}
		}

		has(key:any):boolean {
			var has_key = map_has(this.data, key);

			nir_debug("cache", "Cache.has key:", key, has_key);

			return has_key;
		}

		get(key:any):any {
			// TODO: maybe renew timeout per-get?
			var value = map_get(this.data, key);

			nir_debug("cache", "Cache.get key:", key, deepcopy(value));

			return value;
		}

		fetch(key:any, done, fetcher):void {
			var exists = map_has(this.data, key);

			nir_debug("cache", "Cache.fetch key:", key, ", exists=" + exists);

			if (!exists) {
				if (map_has(this.fetches, key)) {
					map_get(this.fetches, key).push(done);
				} else {
					map_set(this.fetches, key, []);

					var _this = this;

					fetcher(function(data, time) {
						if (time !== false)
							_this.set.bind(_this)(key, data, time);

						done(data);

						var our_fetches = map_get(_this.fetches, key);
						for (var i = 0; i < our_fetches.length; i++) {
							our_fetches[i](data);
						}

						map_remove(_this.fetches, key);
					});
				}
			} else {
				done(map_get(this.data, key));
			}
		}

		remove(key:any):void {
			nir_debug("cache", "Cache.remove key:", key);

			if (map_has(this.times, key)) {
				var timeobj = map_get(this.times, key);

				if ("timer" in timeobj)
					clearTimeout(timeobj.timer);
			}

			if (this.options.destructor && map_has(this.data, key)) {
				this.options.destructor(key, map_get(this.data, key));
			}

			map_remove(this.times, key);
			map_remove(this.data, key);
		}

		clear():void {
			nir_debug("cache", "Cache.clear");

			map_foreach(this.times, function(key, value) {
				if ("timer" in value) {
					clearTimeout(value.timer);
				}
			});

			if (this.options.destructor) {
				map_foreach(this.data, function(key, value) {
					this.options.destructor(key, value);
				});
			}

			this.times = new_map();
			this.data = new_map();
		}
	};

	var url_cache = new IMUCache();
	var real_api_cache = new IMUCache();
	var lib_cache = new IMUCache();
	var cookie_cache = new IMUCache();

	type ApiQueryData = DoRequestData & {
		json?: boolean,
		non200_ok?: boolean
	}

	var real_api_query = function(api_cache:IMUCache, do_request, key:string, request:ApiQueryData, cb, process) {
		api_cache.fetch(key, cb, function(done) {
			if (!("method" in request))
				request.method = "GET";

			request.onload = function(resp) {
				if (resp.status !== 200 && !request.non200_ok) {
					if (!request.silent)
						console_error(key, resp);
					return done(null, false);
				}

				try {
					var out_resp = resp;

					var resptext = resp.responseText;
					if (request.jsonp) {
						resptext = resptext.replace(/^[$_a-zA-Z][$_a-zA-Z0-9]+\(({[\s\S]*})\);?$/, "$1");
					}

					if (request.json || request.jsonp) {
						out_resp = JSON_parse(resptext);
					}

					return process(done, out_resp, key);
				} catch (e) {
					console_error(key, e, resp);
					return done(null, false);
				}
			};

			do_request(request);
		});
	};

	var compat_match = function(str, regex) {
		var real_regex = regex;
		if (regex.regex && regex.groups) {
			real_regex = regex.regex;
		}

		var matched = str.match(real_regex);
		if (!matched) return matched;

		if (real_regex !== regex) {
			if (!matched.groups) matched.groups = {};

			array_foreach(regex.groups, function(group, i) {
				matched.groups[group] = matched[i + 1];
			});
		}

		return matched;
	};

	var real_website_query = function(options) {
		if (!is_array(options.website_regex)) {
			options.website_regex = [options.website_regex];
		}

		var website_match = null;

		for (var i = 0; i < options.website_regex.length; i++) {
			website_match = compat_match(options.url, options.website_regex[i]);
			if (website_match)
				break;
		}

		if (!website_match)
			return null;

		var page_nullobj = {
			url: options.url,
			is_pagelink: true
		};

		if (!options.do_request || !options.cb) {
			return page_nullobj;
		}

		var domain = options.url.replace(/^[a-z]+:\/\/([^/]+)\/+.*$/, "$1");
		var domain_nosub = get_domain_nosub(domain);
		if (!options.cache_key) {
			options.cache_key = domain_nosub;
		}

		var cb = function(data) {
			if (!data) {
				return options.cb(page_nullobj);
			} else {
				if (!is_array(data)) {
					data = [data];
				}

				data.push(page_nullobj);

				return options.cb(data);
			}
		};

		if (!options.override_cb) {
			options.override_cb = function(cb, data) {
				cb(data);
			};
		}

		if (!options.run) {
			options.run = function(cb, website_match, options) {
				var id = website_match[1];
				if (website_match.groups && website_match.groups.id) {
					id = website_match.groups.id;
				}

				var fill_string_vars = function(str) {
					return str
						.replace(/\${id}/g, id)
						.replace(/\${([^/]+)}/g, function(_, x) {
							if (/^[0-9]+$/.test(x))
								return website_match[x];
							return website_match.groups[x];
						});
				};

				if (options.id) {
					id = fill_string_vars(options.id);
				}

				var query = options.query_for_id;

				if (typeof options.query_for_id === "string") {
					query = {
						url: query
					};
				}

				if (typeof query === "object" && query.url) {
					query.url = fill_string_vars(query.url);
				} else {
					query = query(id, website_match);
				}

				real_api_query(options.api_cache, options.do_request, options.cache_key + ":" + id, query, cb, function(done, resp, cache_key) {
					return options.process(done, resp, cache_key, website_match, options)
				});
			};
		}

		options.run(function(data) {
			options.override_cb(cb, data);
		}, website_match, options);

		return {
			waiting: true
		};
	};

	// temporary hack for Instagram returning urls with %00
	// thanks to fireattack on discord for reporting
	var is_invalid_url = function(url:string):boolean {
		// yes, a null url is technically invalid, but this check is used to detect if it has invalid characters.
		// it's better to just return false here.
		// thanks to remlap on discord for noticing that this caused issues for regular instagram posts.
		if (!url)
			return false;

		for (var i = 0; i < url.length; i++) {
			if (url.charCodeAt(i) === 0) {
				return true;
			}
		}

		return false;
	};

	// https://stackoverflow.com/a/17323608
	function mod(n:number, m:number):number {
		return ((n % m) + m) % m;
	}

	var string_to_int = function(str, alpha) {
		var base = 0;

		for (var i = 0; i < str.length; i++) {
			var index = string_indexof(alpha, str[i]);
			base *= alpha.length;
			base += index;
		}

		return base;
	};

	// unused, but likely useful
	function urlsplit(a) {
		var protocol_split = a.split("://");
		var protocol = protocol_split[0];
		var splitted = protocol_split[1].split("/");
		var domain = splitted[0];
		var start = protocol + "://" + domain;
		return {
			protocol: protocol,
			domain: domain,
			url: a
		};
	}

	function urlnorm(a:string):string {
		var protocol_split = a.split("://");
		var splitted = protocol_split[1].split("/");
		var newsplitted = [];
		for (var i = 0; i < splitted.length; i++) {
			if (splitted[i] === "..")
				newsplitted.pop();
			else
				newsplitted.push(splitted[i]);
		}

		return protocol_split[0] + "://" + newsplitted.join("/");
	}

	var is_valid_resource_url = function(url:string):boolean {
		var match = url.match(/^([-a-z]+):/);
		if (match) {
			var valid_schemes = ["http", "https", "ftp", "data", "x-raw-image", "blob", "chrome", "file"];
			return array_indexof(valid_schemes, match[1].toLowerCase()) >= 0;
		}

		return true;
	};

	var norm_url = function(url:string):string {
		return url
		// https://www.test.com?test -> https://www.test.com/?test
			.replace(/^([a-z]+:\/\/[^/]+)(\?.*)/, "$1/$2")
		// https://www.test.com./ -> https://www.test.com/
			.replace(/^([a-z]+:\/\/[^/]+\.[^/]+)\.([?#/].*)?$/, "$1$2");
	};

	var get_base = function(document:string|HTMLDocument, url?:string) {
		if (typeof document === "string") {
			let match = document.match(/<base\s+[^>]*href=["']([^'"]+)["']/);
			if (match) {
				return decode_entities(match[1]);
			} else {
				return url;
			}
		} else {
			return document.baseURI || url;
		}
	}

	function urljoin(a:string, b:string, browser?:boolean|"real"):string {
		if (b.length === 0)
			return a;
		if (b.match(/^[-a-z]*:\/\//) || b.match(/^(?:data|x-raw-image|blob|about|javascript):/))
			return b;

		var protocol_split = a.split("://");

		// FIXME? for URLs like about:blank
		if (protocol_split.length < 2) {
			return a;
		}

		var protocol = protocol_split[0];
		var splitted = protocol_split[1].split("/");
		var domain = splitted[0];
		var start = protocol + "://" + domain;

		if (!browser) {
			// simple path join
			// urljoin("http://site.com/index.html", "file.png") = "http://site.com/index.html/file.png"
			return a.replace(/\/*$/, "") + "/" + b.replace(/^\/*/, "");
		} else {
			if (browser === "real") {
				if (is_interactive && !is_extension_bg && typeof document === "object") {
					a = get_base(document, a);
				}
			}

			if (b.length >= 2 && b.slice(0, 2) === "//")
				return protocol + ":" + b;
			if (b.length >= 1 && b.slice(0, 1) === "/")
				return start + b;

			if (b.length >= 2 && b.slice(0, 2) === "./")
				b = b.substring(2);

			// to emulate the browser's behavior instead
			// urljoin("http://site.com/index.html", "file.png") = "http://site.com/file.png"
			if (!a.match(/\/$/))
				a = a.replace(/^([^?]*)\/.*?$/, "$1/");

			return urlnorm(a + b.replace(/^\/*/, ""));
			//return a.replace(/\/[^/]*$/, "/") + b.replace(/^\/*/, "");
			//return urlnorm(a.replace(/^([^?]*)\/.*?$/, "$1/") + b.replace(/^\/*/, ""));
		}
	}

	var fullurl = function(url, x) {
		if (x === void 0 || x === null)
			return x;

		var a = document_createElement(a);
		a.href = x;
		return a.href;
	};

	type UrlBasenameOptions = {
		remove_queryhash?:boolean,
		split_ext?:boolean,
		known_ext?:boolean
	};
	type UrlBasenameResult = string | [string] | [string, string];
	var url_basename = function(url, options?:UrlBasenameOptions):UrlBasenameResult {
		var basename = url.replace(/.*\//, "");

		if (!options) options = {};
		if (!("remove_queryhash" in options)) options.remove_queryhash = true;

		if (!options.remove_queryhash) return basename;

		basename = basename.replace(/[?#].*$/, "");

		if (!options.split_ext) return basename;

		var match;
		if (options.known_ext) {
			// todo: factor out?
			match = basename.match(/(.*?)\.(mp4|mpe?g|jpe?g|jfif|png|tiff|og[agv]|m4[av]|web[pm]|mkv|mov|avi|gif|mpd|m3u8|zip)$/i);
		} else {
			match = basename.match(/(.*)\.([^.]*)$/);
		}

		if (!match) return [basename];

		return [match[1], match[2]];
	}

	var basic_fillobj = function(obj:BigImageInfoObject):BigImageInfoMObject {
		var mobj:BigImageInfoMulti = force_array((obj || {}) as BigImageInfoSingle) as BigImageInfoMulti;

		array_foreach(mobj, function(sobj:BigImageInfoSingle, i) {
			if (typeof sobj === "string") {
				mobj[i] = {url: sobj};
			}
		});

		return mobj as BigImageInfoMObject;
	};

	var fillobj = function(p_obj:BigImageInfoObject, p_baseobj:BigImageInfoObject):BigImageInfoMulti {
		//if (typeof p_obj === "undefined")
		var obj:BigImageInfoMObject = basic_fillobj(p_obj);
		var baseobj:BigImageInfoSObject = basic_fillobj(deepcopy(p_baseobj))[0];

		//var oldobj = deepcopy(obj);

		for (var i = 0; i < obj.length; i++) {
			if (typeof(obj[i]) === "undefined") {
				continue;
			}

			var item;
			// Only copy from baseobj if the urls are the same (or n/a)
			if (!obj[i].url || !baseobj.url || baseobj.url === obj[i].url)  {
				for (item in baseobj) {
					if (!(item in obj[i])) {
						obj[i][item] = baseobj[item];
					}
				}
			}

			for (item in default_object) {
				if (!(item in obj[i])) {
					obj[i][item] = deepcopy(default_object[item]);
				}
			}

			// this is horrible
			if (obj[i].video && obj[i].media_info.type === "image") {
				if (obj[i].video === true) {
					obj[i].media_info = {
						type: "video"
					};
				} else if (typeof obj[i].video === "string") {
					obj[i].media_info = {
						type: "video",
						delivery: obj[i].video as VideoDelivery
					};
				} else {
					obj[i].media_info = deepcopy(obj[i].video) as unknown as InfoMediaInfo;

					// what is this usecase?
					obj[i].media_info.delivery = obj[i].media_info.type as VideoDelivery;
					obj[i].media_info.type = "video";
				}
			}
		}

		//console_log("fillobj", deepcopy(oldobj), deepcopy(obj), deepcopy(baseobj));
		return obj;
	};

	var fillobj_urls = function(urls:BigImageInfoMulti, obj:BigImageInfoSObject, overwrite?:boolean):BigImageInfoMObject {
		var newobj = [];
		for (var i = 0; i < urls.length; i++) {
			var currentobj = deepcopy(obj);

			if (typeof urls[i] === "string") {
				currentobj.url = urls[i] as string;
			} else {
				for (var key in (urls[i] as BigImageInfoSObject)) {
					if (!overwrite || !(key in currentobj))
						currentobj[key] = urls[i][key];
				}
			}

			newobj.push(currentobj);
		}

		return newobj;
	};

	var add_full_extensions = function(obj, extensions?:Array<string>, prefer_order?:boolean) {
		if (!extensions)
			extensions = [
				"jpg", "jpeg", "png", "gif", "webp", "avif",
				"JPG", "JPEG", "PNG", "GIF"
			];

		if (!is_array(obj)) {
			obj = [obj];
		}

		var result = [];

		for (var i = 0; i < obj.length; i++) {
			var currentobj = obj[i];
			var url = currentobj;
			if (typeof currentobj !== "string") {
				url = currentobj.url;
			}

			var regex = /(.*)\.([^/.]*?)([?#].*)?$/;
			if (!url.match(regex)) {
				result.push(currentobj);
				continue;
			}

			var ext = url.replace(regex, "$2");
			var basename = url.replace(regex, "$1");
			var query = url.replace(regex, "$3");

			//var result = [url];
			if (!prefer_order)
				result.push(currentobj);

			for (var i = 0; i < extensions.length; i++) {
				if (!prefer_order && ext === extensions[i])
					continue;

				var currenturl = basename + "." + extensions[i] + query;
				if (typeof currentobj === "string") {
					result.push(currenturl);
				} else {
					var newobj = deepcopy(currentobj);
					newobj.url = currenturl;
					result.push(newobj);
				}
			}

			if (prefer_order && array_indexof(result, currentobj) < 0)
				result.push(currentobj);
		}

		return result;
	};

	type AddFullExtensions2Options = {
		extensions?: Array<string>,
		prefer_order?: boolean,
		add_video?: boolean
	};
	var add_full_extensions2 = function(url:string, options?:AddFullExtensions2Options) {
		if (!options) {
			options = {};
		}

		if (!("add_video" in options))
			options.add_video = true;

		let new_urls = add_full_extensions(url, options.extensions, options.prefer_order);
		if (options.add_video) {
			for (let i = 0; i < new_urls.length; i++) {
				let src = new_urls[i];
				if (typeof src !== "string")
					src = src.url;

				if (/\.(?:mp4|webm)(?:[?#].*)?$/i.test(src)) {
					if (typeof new_urls[i] === "string") {
						new_urls[i] = {
							url: src,
							video: true
						};
					} else {
						new_urls[i].video = true;
					}
				}
			}
		}

		return new_urls;
	};

	var add_extensions = function(url) {
		return add_full_extensions(url, ["jpg", "png"]);
	};

	var add_extensions_jpeg = function(url) {
		return add_full_extensions(url, ["jpeg", "png"]);
	};

	var add_extensions_with_jpeg = function(url) {
		return add_full_extensions(url, ["jpg", "jpeg", "png"]);
	};

	var add_extensions_gif = function(url) {
		return add_full_extensions(url, ["jpg", "png", "gif"]);
	};

	var add_extensions_upper = function(url) {
		return add_full_extensions(url, ["jpg", "png", "JPG", "PNG"]);
	};

	var add_extensions_upper_jpeg = function(url) {
		return add_full_extensions(url, ["jpg", "jpeg", "png", "JPG", "JPEG", "PNG"]);
	};

	var add_extensions_from_webp = function(url) {
		if (/\.webp(?:[?#].*)?$/.test(url)) {
			return add_extensions(url);
		} else {
			return url;
		}
	};

	var add_http = function(url:string):string {
		if (/^\/\/[^/]+\.[a-z]+\//.test(url))
			return "http:" + url;
		if (!url.match(/^[a-z]+:\/\//))
			return "http://" + url;
		return url;
	};

	var force_https = function(url:string):string {
		return url.replace(/^http:\/\//, "https://");
	};

	var decodeuri_ifneeded = function(url:string):string {
		if (url.match(/^https?:\/\//))
			return url;
		if (url.match(/^https?%3[aA]/) || /^[^/]*%2[fF]/.test(url))
			return decodeURIComponent(url);
		if (url.match(/^https?%253[aA]/))
			return decodeURIComponent(decodeURIComponent(url));
		return url;
	};

	var encodeuri_ifneeded = function(url:string):string {
		// TODO: improve
		if (string_indexof(url, "%") < 0) {
			return encodeURI(url);
		}

		return url;
	};

	var replace_sizes = function(src:string, sizes:Array<any>, keep_orig_if_empty?:boolean):Array<any> {
		var current_problems = null;
		var orig_obj = null;
		for (var i = 0; i < sizes.length; i++) {
			var url = sizes[i];
			if (typeof url === "object")
				url = url.url;

			if (url === src) {
				if (typeof sizes[i] === "object" && sizes[i].problems)
					current_problems = sizes[i].problems;

				orig_obj = sizes[i];
				sizes.splice(i, sizes.length);
				break;
			}
		}

		if (current_problems) {
			for (var i = 0; i < sizes.length; i++) {
				if (typeof sizes[i] !== "object")
					continue;

				if (sizes[i].problems) {
					for (var problem in sizes[i].problems) {
						if (sizes[i].problems[problem] === current_problems[problem]) {
							delete sizes[i].problems[problem];
						}
					}
				}
			}
		}

		if (keep_orig_if_empty && !sizes.length) {
			sizes.push(orig_obj);
		}

		return sizes;
	};

	// https://stackoverflow.com/a/10073788
	var zpadnum = function(n:number|string, width:number, z?:string):string {
		z = z || '0';
		n = n + '';
		return n.length >= width ? n : new Array(width - n.length + 1).join(z) + n;
	}

	// https://www.w3resource.com/javascript-exercises/javascript-string-exercise-28.php
	function hex_to_ascii(str1:string):string {
		var hex = str1.toString();
		var str = '';
		for (var n = 0; n < hex.length; n += 2) {
			str += string_fromcharcode(parseInt(hex.substr(n, 2), 16));
		}
		return str;
	}

	function hex_to_numberarray(str:string):Array<number> {
		var result = [];

		for (var i = 0; i < str.length; i += 2) {
			result.push(parseInt(str.substr(i, 2), 16));
		}

		return result;
	}

	function numberarray_to_hex(arr:Array<number>):string {
		var str = "";

		for (var i = 0; i < arr.length; i++) {
			if (arr[i] < 16)
				str += "0";
			str += arr[i].toString(16);
		}

		return str;
	}

	function reverse_str(str:string):string {
		return common_functions["run_arrayd_string"](str, {
			cb: function(arr) {
				return arr.reverse();
			}
		});
	}

	function decode_entities(str) {
		var match = str.match(/^\s*<!\[CDATA\[([\s\S]+)\]\]>\s*$/);
		if (match)
			return match[1];

		return str
			.replace(/&nbsp;/g, " ")
			.replace(/&#([0-9]+);/g, function (full, num) { return string_fromcharcode(num); })
			.replace(/&quot;/g, '"')
			.replace(/&amp;/g, "&");
	}

	function encode_entities(str) {
		return str.replace(/&/g, "&amp;");
	}

	function encode_regex(str) {
		return str.replace(/([\^$])/g, "\\$1");
	}

	type QueryVal = string|true;
	type QueryDict = Record<string, QueryVal>;
	type GetQueriesOptions = {
		decode?:boolean
	};
	function get_queries(url, options?:GetQueriesOptions):QueryDict {
		// TODO: handle things like: ?a=b&c=b#&d=e
		var querystring = url
			.replace(/#.*/, "")
			.replace(/^.*?\?/, "");
		if (!querystring || querystring === url)
			return {};

		if (!options) {
			options = {};
		}

		var queries:QueryDict = {};

		var splitted = querystring.split("&");
		for (var i = 0; i < splitted.length; i++) {
			var name = splitted[i];
			var value:QueryVal = true;

			var match = splitted[i].match(/^(.*?)=(.*)/);
			if (match) {
				name = match[1];
				value = match[2];
			}

			if (name.length === 0)
				continue;

			if (options.decode && typeof value === "string") {
				value = decodeURIComponent(value);
			}

			queries[name] = value;
		}

		return queries;
	}

	function stringify_queries(queries:QueryDict, encode?:boolean):string {
		var queriesstr = [];

		for (var query in queries) {
			if (query.length === 0)
				continue;

			var current_query = query;
			var queryval = queries[query];
			if (encode)
				queryval = encodeURIComponent(queryval);
			if (queries[query] !== true) {
				current_query += "=" + queryval;
			}

			queriesstr.push(current_query);
		}

		return queriesstr.join("&");
	}

	function remove_queries(url:string, queries:Array<string>|string):string {
		if (!is_array(queries)) {
			queries = [queries as string];
		}

		var beforequery = url.replace(/^([^#]*?)\?(.*)$/, "$1");
		var afterquery = url.replace(/^([^#]*?)\?(.*)$/, "$2");

		// TODO: handle things like: ?a=b&c=b#&d=e

		// no query string
		if (beforequery === url)
			return url;

		var splitted = afterquery.split("&");
		var newsplitted = [];
		for (var i = 0; i < splitted.length; i++) {
			var property = splitted[i].replace(/^(.*?)=.*/, "$1");
			if (array_indexof(queries, property) < 0) {
				newsplitted.push(splitted[i]);
			}
		}

		if (newsplitted.length === 0) {
			afterquery = "";
		} else {
			afterquery = "?" + newsplitted.join("&");
		}

		return beforequery + afterquery;
	}

	type KeepQueriesOptions = {
		overwrite?:Record<string, string>,
		required?:boolean|Array<string>
	};
	function keep_queries(url, queries:Array<string>|string, options?:KeepQueriesOptions):string {
		if (!is_array(queries)) {
			queries = [queries as string];
		}

		if (!options) {
			options = {};
		}

		var url_queries = get_queries(url);

		var kept_queries = [];
		var has_queries = new_set();
		array_foreach(queries as Array<string>, function(query) {
			if (query in url_queries) {
				var querystr = query + "=";

				if (options.overwrite && query in options.overwrite) {
					querystr += options.overwrite[query];
				} else {
					querystr += url_queries[query];
				}

				kept_queries.push(querystr);
				set_add(has_queries, query);
			}
		});

		if (options.required) {
			if (options.required === true)
				options.required = queries as Array<string>;

			var required_total = 0;
			array_foreach(options.required, function(query) {
				if (set_has(has_queries, query)) {
					required_total++;
				} else {
					return false;
				}
			});

			if (required_total < options.required.length)
				return url;
		}

		if (options.overwrite) {
			for (var query in options.overwrite) {
				if (!set_has(has_queries, query)) {
					kept_queries.push(query + "=" + options.overwrite[query]);
				}
			}
		}

		var afterquery;
		if (kept_queries.length === 0)
			afterquery = "";
		else
			afterquery = "?" + kept_queries.join("&");

		return url.replace(/\?.*/, "") + afterquery;
	}

	function add_queries(url:string, queries:QueryDict):string {
		var parsed_queries = get_queries(url);

		for (var query in queries) {
			parsed_queries[query] = queries[query];
		}

		var newquerystring = stringify_queries(parsed_queries);
		if (newquerystring) {
			return url.replace(/^([^#]*?)(?:\?.*)?$/, "$1?" + newquerystring);
		} else {
			return url;
		}
	}

	var raw_do_notify = null;
	if (is_userscript) {
		if (typeof GM_notification !== "undefined") {
			raw_do_notify = GM_notification;
		} else if (typeof GM !== "undefined" && GM.notification) {
			raw_do_notify = GM.notification;
		}
	} else if (is_extension) {
		raw_do_notify = function(details, ondone) {
			var jsoned_details = deepcopy(details, {json: true});
			if (details.onclick)
				jsoned_details.onclick = true;

			extension_send_message({
				type: "notification",
				data: jsoned_details
			}, function(response) {
				// if there's no onclick
				if (!response || !response.data)
					return;

				if (response.data.action === "clicked") {
					if (details.onclick) {
						details.onclick();
					}
				} else if (response.data.action === "closed") {
					ondone = details.ondone || ondone;
					if (ondone) {
						ondone();
					}
				}
			});
		};
	}

	var do_notify = function(details) {
		if (!raw_do_notify)
			return;

		if (!details.title) {
			details.title = _("Image Max URL");
		}

		if (!details.image) {
			details.image = imu_icon;
		}

		raw_do_notify(details, details.ondone || null);
	};

	function fuzzify_text(str) {
		return str
			.replace(/(?:[-=_!?$#"'’‘”“]|\[|])/g, " ")
			.replace(/\s+/g, " ")
			.replace(/^\s+|\s+$/g, "");
	}

	var check_updates_firefox = function(cb) {
		do_request({
			url: firefox_addon_page,
			method: "GET",
			onload: function(resp) {
				if (resp.readyState < 4)
					return;

				if (resp.status !== 200)
					return cb(null);

				var match = resp.responseText.match(/<script[^>]*id=["']redux-store-state["']\s*>\s*({.*?})\s*<\/script>/);
				if (!match) {
					return cb(null);
				}

				try {
					var json = JSON_parse(match[1]);
					var addoninfo = json.addons.byID["1003321"];
					var versionid = addoninfo.currentVersionId;
					var versioninfo = json.versions.byId[versionid];
					var version = versioninfo.version;
					var downloadurl = versioninfo.platformFiles.all.url.replace(/\?src=.*/, "?src=external-updatecheck");

					cb({
						version: version,
						downloadurl: downloadurl
					});
				} catch (e) {
					console_error("Unable to parse mozilla addon info", e);
					return cb(null);
				}
			}
		});
	};

	var check_updates_github = function(cb) {
		do_request({
			url: "https://api.github.com/repos/qsniyg/maxurl/tags",
			method: "GET",
			headers: {
				Referer: ""
			},
			onload: function(resp) {
				if (resp.readyState <4 )
					return;

				if (resp.status !== 200)
					return cb(null);

				try {
					var json = JSON_parse(resp.responseText);

					for (var i = 0; i < json.length; i++) {
						var version = json[i].name;

						if (!version.match(/^v[0-9.]+$/)) {
							continue;
						}

						return cb({
							version: version.replace(/^v([0-9])/, "$1")
						});
					}
				} catch (e) {
					console_error("Unable to parse github info", e);
				}

				return cb(null);
			}
		});
	};

	var check_updates = function(cb) {
		// Firefox blocks these requests
		if (false && is_firefox_webextension) {
			check_updates_firefox(function(data) {
				if (!data) {
					check_updates_github(cb);
				} else {
					cb(data);
				}
			});
		} else {
			check_updates_github(cb);
		}
	};

	var get_update_url = function() {
		var link = settings.last_update_url;
		if (!link) {
			if (is_firefox_webextension) {
				link = firefox_addon_page;
			} else if (is_userscript) {
				link = userscript_update_url;
			} else {
				link = null;
			}
		}

		return link;
	};

	var check_updates_if_needed = function() {
		// if last_update_check == 0, it means for some reason it's not able to store values
		if (!settings.imu_enabled || !settings.check_updates || !current_version || !settings.last_update_check) {
			return;
		}

		var update_check_delta = Date.now() - settings.last_update_check;
		if (update_check_delta > (settings.check_update_interval*60*60*1000)) {
			check_updates(function(data) {
				update_setting("last_update_check", Date.now());

				if (!data || !data.version)
					return;

				if (!data.downloadurl) {
					update_setting("last_update_url", null);
				} else {
					update_setting("last_update_url", data.downloadurl);
				}

				update_setting("last_update_version", data.version);

				if (settings.check_update_notify && !is_in_iframe && version_compare(current_version, data.version) === 1) {
					var notify_obj = {
						text: _("Update available (%%1)", data.version)
					};

					var downloadurl = get_update_url();
					// FIXME? if !downloadurl, clicking won't close the popup. this might not be a problem though, as it's expected behavior?
					if (downloadurl) {
						notify_obj.onclick = function() {
							open_in_tab_imu({
								url: downloadurl
							});
						};
					}

					do_notify(notify_obj);
				}
			});
		}
	};

	function _fuzzy_compare_rollover(a, b, lim) {
		if (a === b)
			return true;

		if (a - 1 === b || a + 1 === b)
			return true;

		for (var i = 0; i < lim.length; i++) {
			if (a === lim[i]) {
				if (b === 1)
					return true;
			} else if (b === lim[i]) {
				if (a === 1)
					return true;
			}
		}

		return false;
	}

	function _is_larger_rollover(a, b, end) {
		if (a === 1 && array_indexof(end, b) >= 0)
			return true;

		if (b === 1 && array_indexof(end, a) >= 0)
			return true;

		return false;
	}

	function fuzzy_date_compare(a, b) {
		if (a === b)
			return true;

		if (a.length !== 8 || b.length !== 8)
			return false;

		var a_d = parse_int(a.substr(6, 2));
		var b_d = parse_int(b.substr(6, 2));

		if (!_fuzzy_compare_rollover(a_d, b_d, [28, 29, 30, 31]))
			return false;

		var a_m = parse_int(a.substr(4, 2));
		var b_m = parse_int(b.substr(4, 2));

		var d_rollover = _is_larger_rollover(a_d, b_d, [28, 29, 30, 31]);
		if (a_m !== b_m) {
			if (!d_rollover)
				return false;
			if (!_fuzzy_compare_rollover(a_m, b_m, [12]))
				return false;
		}

		var a_y = parse_int(a.substr(0, 4));
		var b_y = parse_int(b.substr(0, 4));

		if (a_y !== b_y) {
			if (!d_rollover || !_is_larger_rollover(a_m, b_m, [12]))
				return false;
			if (!_fuzzy_compare_rollover(a_y, b_y, []))
				return false;
		}

		return true;
	}

	function run_soon(func) {
		setTimeout(func, 1);
	}

	// bug in chrome, see
	// https://github.com/qsniyg/maxurl/issues/7
	// https://our.umbraco.org/forum/using-umbraco-and-getting-started/91715-js-error-when-aligning-content-left-center-right-justify-in-richtext-editor
	if (is_node || true) {
		fullurl = function(url, x) {
			return urljoin(url, x, true);
		};
	}

	var blacklist_regexes = [];
	var host_blacklist_regexes = [];
	var host_html_blacklist_regexes = [];

	function update_rule_setting() {
		url_cache.clear();
	}

	var glob_to_regexstr = function(current:string):string {
		let newcurrent:string = "";
		let sbracket:number = -1;
		let cbracket:number = -1;
		for (let j = 0; j < current.length; j++) {
			if (sbracket >= 0) {
				if (current[j] === "]") {
					newcurrent += current.substr(sbracket, j - sbracket + 1);
					sbracket = -1;
				}
				continue;
			}

			if (cbracket >= 0) {
				if (current[j] === "}") {
					var options = current.substr(cbracket + 1, j - cbracket - 1).split(",");
					var newoptions = [];
					for (var k = 0; k < options.length; k++) {
						newoptions.push(options[k].replace(/(.)/g, "[$1]"));
					}
					if (newoptions.length > 0 && (newoptions.length > 1 || newoptions[0].length > 0))
						newcurrent += "(?:" + newoptions.join("|") + ")";
					cbracket = -1;
				}

				continue;
			}

			if (current[j] !== "*") {
				if (current[j] === "{") {
					cbracket = j;
				} else if (current[j] === "[") {
					sbracket = j;
				} else if (current[j] === "?") {
					newcurrent += "[^/]";
				} else if (current[j] === ".") {
					newcurrent += "\\.";
				} else {
					newcurrent += current[j];
				}
				continue;
			}

			let doublestar = false;
			if ((j + 1) < current.length) {
				if (current[j+1] === "*") {
					doublestar = true;
					j++;
				}
			}

			if (doublestar)
				newcurrent += ".+";
			else
				newcurrent += "[^/]+";
		}

		current = newcurrent;

		if (current[0] !== "*") {
			newcurrent = current.replace(/^[a-z]*:\/\//, "[a-z]+://");
			if (newcurrent !== current) {
				current = newcurrent;
			} else {
				current = "[a-z]+://[^/]*" + current;
			}
		}

		current = "^" + current;

		return current;
	};

	var parse_blacklist_regexes = function(blacklist:string, engine:string):Array<RegExp> {
		let regexes:Array<RegExp> = [];

		let lines = (blacklist || "").split("\n");

		for (let i = 0; i < lines.length; i++) {
			let current = lines[i].replace(/^\s+|\s+$/, "");
			//console_log(current);
			if (current.length === 0)
				continue;

			let regexstr = current;
			if (engine === "glob") {
				regexstr = glob_to_regexstr(current);
			}

			regexes.push(new RegExp(regexstr));
		}

		return regexes;
	}

	function create_blacklist_regexes() {
		blacklist_regexes = [];
		try {
			blacklist_regexes = parse_blacklist_regexes(settings.bigimage_blacklist, settings.bigimage_blacklist_engine);
		} catch (e) {
			return [e];
		}

		//console_log(blacklist_regexes);
	}

	function create_host_blacklist_regexes() {
		host_blacklist_regexes = [];
		try {
			host_blacklist_regexes = parse_blacklist_regexes(settings.host_blacklist, settings.bigimage_blacklist_engine);
		} catch (e) {
			return [e];
		}
	}

	function create_host_html_blacklist_regexes() {
		host_html_blacklist_regexes = [];
		try {
			host_html_blacklist_regexes = parse_blacklist_regexes(settings.host_html_blacklist, settings.bigimage_blacklist_engine);
		} catch (e) {
			return [e];
		}
	}

	var parse_headers = function(headerstr:string):HeaderList {
		var headers = [];

		var splitstr = "\r\n";
		if (string_indexof(headerstr, "\r") < 0) {
			// tampermonkey beta, thanks to Broly on discord for reporting
			splitstr = "\n";
		}

		var splitted = headerstr.split(splitstr);
		for (var i = 0; i < splitted.length; i++) {
			var header_name = splitted[i].replace(/^\s*([^:]*?)\s*:[\s\S]*/, "$1").toLowerCase();
			var header_value = splitted[i].replace(/^[^:]*?:\s*([\s\S]*?)\s*$/, "$1");

			if (header_name === splitted[i] || header_value === splitted[i])
				continue;

			var value_split = header_value.split("\n");
			for (var j = 0; j < value_split.length; j++) {
				headers.push({name: header_name, value: value_split[j]});
			}
		}

		if (_nir_debug_)
			console_log("parse_headers", headerstr, deepcopy(headers));

		return headers;
	};

	var headers_list_to_dict = function(headers:HeaderList): HeaderDict {
		var dict = {};

		for (var i = 0; i < headers.length; i++) {
			dict[headers[i].name.toLowerCase()] = headers[i].value;
		}

		return dict;
	};

	var headers_dict_to_list = function(headers:HeaderDict):HeaderList {
		var list = [];

		for (var header in headers) {
			list.push({name: header, value: headers[header]});
		}

		return list;
	};

	var parse_cookieheader = function(cookieheader) {
		var cookies = {};

		do {
			var match = cookieheader.match(/^\s*([^=]*?)\s*=\s*([^;]*?)\s*(?:;\s*(.*))?$/);
			if (!match)
				break;

			cookies[match[1]] = match[2];
			cookieheader = match[3];
		} while (cookieheader);

		if (_nir_debug_)
			console_log("parse_cookieheader", cookieheader, deepcopy(cookies));

		return cookies;
	};

	var create_cookieheader_from_headers = function(headers, cookieheader) {
		headers = parse_headers(headers);

		var cookies = {};
		for (var i = 0; i < headers.length; i++) {
			if (headers[i].name !== "set-cookie")
				continue;

			var cookie_match = headers[i].value.match(/^\s*([^=]*?)\s*=\s*([^;]*?)\s*;.*/);
			if (!cookie_match) {
				console_error("Unable to match cookie: ", headers[i]);
				continue;
			}

			cookies[cookie_match[1]] = cookie_match[2];
		}

		if (_nir_debug_)
			console_log("create_cookieheader_from_headers", headers, cookieheader, deepcopy(cookies));

		if (cookieheader) {
			var parsed = parse_cookieheader(cookieheader);

			for (var key in parsed) {
				if (!(key in cookies)) {
					cookies[key] = parsed[key];
				}
			}
		}

		var cookies_array = [];
		for (var key in cookies) {
			cookies_array.push(key + "=" + cookies[key]);
		}

		return cookies_array.join("; ");
	};

	var headerobj_get = function(headerobj, header) {
		for (var key in headerobj) {
			if (key.toLowerCase() === header.toLowerCase()) {
				return headerobj[key];
			}
		}
	};

	var headerobj_set = function(headerobj, header, value) {
		for (var key in headerobj) {
			if (key.toLowerCase() === header.toLowerCase()) {
				return headerobj[key] = value;
			}
		}

		return headerobj[header] = value;
	};

	var get_resp_finalurl = function(resp) {
		var parsed = parse_headers(resp.responseHeaders);
		if (!parsed)
			return resp.finalUrl;

		var dict = headers_list_to_dict(parsed);
		if (!dict || !dict["location"])
			return resp.finalUrl;

		return dict["location"];
	};

	var contenttype_map = {
		"image/jpeg": "jpg",
		"application/dash+xml": "mpd",
		"video/quicktime": "mov"
	};

	var get_ext_from_contenttype = function(contenttype) {
		contenttype = contenttype.replace(/^\s*\[?([^/]+)\/([^/]+?)\]?\s*$/, "$1/$2");
		if (contenttype in contenttype_map)
			return contenttype_map[contenttype];

		var split = contenttype.match(/^([^/]+)\/([^/]+)$/);

		if (!split)
			return null;

		if (split[1] !== "image" && split[1] !== "video")
			return null;

		return split[2];
	};

	// https://stackoverflow.com/a/18639999
	var makeCRCTable = function() {
		var c;
		var crcTable = [];
		for (var n =0; n < 256; n++) {
			c = n;
			for (var k =0; k < 8; k++) {
				c = ((c&1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));
			}
			crcTable[n] = c;
		}
		return crcTable;
	};

	var cached_crc_table = null;
	var crc32 = function(str) {
		var crcTable = cached_crc_table || (cached_crc_table = makeCRCTable());
		var crc = 0 ^ (-1);

		for (var i = 0; i < str.length; i++) {
			crc = (crc >>> 8) ^ crcTable[(crc ^ str.charCodeAt(i)) & 0xFF];
		}

		return (crc ^ (-1)) >>> 0;
	};

	var custom_xhr = function(orig_xhr) {
		this._headers = {};
		this._response_headers = {};
		this._reqobj = null;
		this._last_readyState = null;
		this._realxhr = null;

		this.open = function(method, url, synchronous) {
			this._method = method;
			this._url = url;
		};

		this.setRequestHeader = function(headername, headervalue) {
			headerobj_set(this._headers, headername, headervalue);
		};

		this.getResponseHeader = function(headername) {
			if (this._realxhr)
				return this._realxhr.getResponseHeader(headername);

			return headerobj_get(this._response_headers, headername);
		};

		this.getAllResponseHeaders = function() {
			if (this._realxhr) {
				return this._realxhr.getAllResponseHeaders();
			}

			return this._response_headers_raw;
		};

		var _handle_event = function(_this, name, data) {
			if (data) {
				_this.status = data.status || 0;
				_this.statusText = data.statusText;
				_this.response = data.response;
				_this.readyState = data.readyState;
				_this.responseText = data.responseText;
				_this.responseType = data.responseType;
				_this.responseURL = data.finalUrl;
				this._response_headers_raw = data.responseHeaders;

				// todo: set loaded, total, lengthComputable
			}

			var event = {
				currentTarget: _this,
				target: _this,

				loaded: _this.loaded,
				lengthComputable: _this.lengthComputable,
				total: _this.total
			};

			if (data && data.responseHeaders) {
				this._response_headers = headers_list_to_dict(parse_headers(data.responseHeaders));
			} else if (data) {
				this._response_headers = null;
			}

			if (_this.readyState !== this._last_readyState) {
				if (_this.onreadystatechange) _this.onreadystatechange.bind(_this)(event);
				this._last_readyState = _this.readyState;
			}

			if (name === "load") {
				if (_this.onload) _this.onload.bind(_this)(event);
				if (_this.onloadend) _this.onloadend.bind(_this)(event);
			}

			if (name === "error") {
				if (_this.onerror) _this.onerror.bind(_this)(event);
				if (_this.onloadend) _this.onloadend.bind(_this)(event);
			}

			if (name === "abort") {
				if (_this.onabort) _this.onabort.bind(_this)(event);
				if (_this.onloadend) _this.onloadend.bind(_this)(event);
			}

			if (name === "progress") {
				if (_this.onprogress) _this.onprogress.bind(_this)(event);
			}

			if (name === "timeout") {
				if (_this.ontimeout) _this.ontimeout.bind(_this)(event);
			}
		};

		var _send_orig = function(_this, data) {
			var xhr = new orig_xhr();
			this._realxhr = xhr;
			xhr.open(this._method, this._url, true);

			xhr.responseType = _this.responseType;
			xhr.withCredentials = _this.withCredentials;
			xhr.timeout = _this.timeout;

			for (var headername in this._headers) {
				xhr.setRequestHeader(headername, this._headers[headername]);
			}

			var allevents = ["load", "loadend", "error", "abort", "progress", "timeout", "readystatechange"];
			for (var i = 0; i < allevents.length; i++) {
				var onevent = "on" + allevents[i];
				(function(onevent) {
					if (onevent in _this) {
						xhr[onevent] = function(e) {
							var copyprops = ["status", "statusText", "response", "readyState", "responseText", "responseType", "responseURL"];
							for (var i = 0; i < copyprops.length; i++) {
								var prop = copyprops[i];
								try {
									_this[prop] = xhr[prop];
								} catch (e) {} // this is expected for earlier props
							}

							_this[onevent].bind(_this)(e);
						};
					}
				})(onevent);
			}

			xhr.send(data);
		};

		this.send = function(_this, data, do_request) {
			if (this._url && orig_xhr && /^blob:/.test(this._url)) {
				return _send_orig.bind(this)(_this, data);
			}

			var reqobj = {
				method: this._method,
				url: this._url,
				data: data,
				timeout: _this.timeout || 0,
				withCredentials: _this.withCredentials || true,
				responseType: _this.responseType
			};

			if (Object.keys(this._headers).length > 0)
				reqobj.headers = this._headers;

			var add_listener = function(our_this, event) {
				reqobj["on" + event] = function(resp) {
					_handle_event.bind(our_this)(_this, event, resp);
				};
			};

			var allevents = ["load", "error", "abort", "progress", "timeout"];
			for (var i = 0; i < allevents.length; i++) {
				add_listener(this, allevents[i]);
			}

			this._reqobj = do_request(reqobj);
		};

		this.abort = function() {
			if (!this._reqobj)
				return;

			this._reqobj.abort();
		};
	};

	(custom_xhr as any).do_request = do_request;

	var orig_XMLHttpRequest:any; // hack for typescript, custom_xhr_wrap is not executed in this scope
	var custom_xhr_wrap = function() {
		var real = new imu_xhr.custom_xhr(orig_XMLHttpRequest);

		var copy = ["open", "setRequestHeader", "getResponseHeader", "getAllResponseHeaders", "abort"];
		for (var i = 0; i < copy.length; i++) {
			var item = copy[i];
			(function(item) {
				var real_item = real[item];
				this[item] = function() {
					//console.log("calling", item, arguments);
					return real_item.apply(real, arguments);
				};
			}).bind(this)(item);
		}

		this.send = function(data) {
			//console.log("sending", data);
			return real.send(this, data, XMLHttpRequest.do_request);
		}
	};

	var add_scripttag_function = function(body:string) {
		// https://violentmonkey.github.io/posts/inject-scripts-with-blob-urls/
		if (false) {
			let script = document.createElement("script");
			script.textContent = body;
			document.documentElement.appendChild(script);
			document.documentElement.removeChild(script);
		} else {
			let script = document.createElement("script");

			new_blob([body], function(blob) {
				let url = create_objecturl(blob);
				script.src = url;

				document.documentElement.appendChild(script);
				revoke_objecturl(url); // revoking before removing the script so that websites monitoring elements removed won't be able to inspect the script
				script.src = null;
				document.documentElement.removeChild(script);
			}, {type: 'text/javascript'});
		}
	};

	type InjectedFunctionData = {
		data: any,
		varname: string
	};

	// FIXME: this is potentially insecure.
	// A website could theoretically monitor script tags added, read the blob URL, figure out the password, and run the data function to access sensitive information (namely, custom_xhr)
	// Since the data function can only be run once, this may render an attack harder.
	// This function is gated behind bypass_csp_for_lib, which is disabled by default (with a scary warning to deter users from enabling it).
	var new_scripttag_function = function(body:string, data:InjectedFunctionData, cb) {
		let win = get_window();

		let imu_export_varname = common_functions["gen_jquery_callback"](); // we want this to remain unobvious to deter detection
		let script_preamble = "(function(){window['" + imu_export_varname + "']=(function(){";

		let imu_cb_varname = common_functions["gen_jquery_callback"]();
		// TODO: wrap in try/catch
		let script_postfix = "})();" + imu_cb_varname + "();})();";

		// TODO: minify
		win[imu_cb_varname] = function() {
			delete win[imu_cb_varname];
			let exported = win[imu_export_varname];
			delete win[imu_export_varname];

			if (data) {
				delete win[imu_data_varname];
			}

			cb(exported);
		};

		let imu_data_varname = null;
		if (data) {
			imu_data_varname = common_functions["gen_jquery_callback"]();
			let imu_data_password = get_random_text(50);

			(function() {
				let b = imu_data_password;
				let c = data.data;
				let d = false;

				// function is minified to reduce detection.
				//
				// unminified (pseudocode):
				//
				// function get_data_func(password:string) {
				//   if (password !== imu_data_password || ran) {
				//     return false;
				//   }
				//   ran = true;
				//   return data.data;
				// }
				let get_data_func = function(a:string) {if (a!==b||d)return;d=!0;return c;};
				win[imu_data_varname] = get_data_func;
			})();

			script_preamble += 'var ' + data.varname + '=' + imu_data_varname + "('" + imu_data_password + "');";
		}

		let scriptbody = script_preamble + body + script_postfix;

		add_scripttag_function(scriptbody);
	};

	var new_function = function(scriptbody:string, data:InjectedFunctionData, cb):any {
		try {
			if (!data) {
				let func = new Function(scriptbody)();
				cb(func);
			} else {
				let func = new Function(data.varname, scriptbody)(data.data);
				cb(func);
			}
		} catch (e) {
			// blocked by csp?
			if (is_userscript && settings.bypass_csp_for_lib) {
				console_warn(e);
				return new_scripttag_function(scriptbody, data, cb);
			} else {
				console_error(e);
				return cb(null);
			}
		}
	};

	var run_sandboxed_lib = function(fdata, xhr, cb) {
		if (true) {
			if (!xhr) {
				return new_function(fdata + ";return lib_export;", null, cb);
			} else {
				var overridden_xhr = true;
				if (!settings.custom_xhr_for_lib)
					overridden_xhr = false;

				var endshim = ";return {lib: lib_export, xhr: XMLHttpRequest, overridden_xhr: " + overridden_xhr + "};";
				if (overridden_xhr) {
					// inefficient, but it allows multiple overrides for do_request
					var startshim = "var orig_XMLHttpRequest=null;try{orig_XMLHttpRequest=window.XMLHttpRequest}catch (e){console.error(e);};var XMLHttpRequest=null;(function(imu_xhr){XMLHttpRequest=" + custom_xhr_wrap.toString() + ";XMLHttpRequest.do_request = imu_xhr.do_request;})(imu_xhr);imu_xhr = undefined;";
					return new_function(startshim + fdata + endshim, {
						varname: "imu_xhr",
						data: {
							custom_xhr: custom_xhr,
							do_request: do_request
						}
					}, cb);
				} else {
					return new_function(fdata + endshim, null, cb);
				}
			}
		} else {
			// doesn't work unfortunately
			var frame = document_createElement('iframe');
			frame.srcdoc = ""; //"javascript:0"
			document.body.appendChild(frame);
			var result = frame.contentWindow.Function(fdata + ";return lib_export;")();
			frame.parentElement.removeChild(frame);

			return result;
		}
	};

	var run_sandboxed_lib_safe = function(fdata, xhr, cb) {
		try {
			var result = run_sandboxed_lib(fdata, xhr, cb);
			return result;
		} catch (e) {
			console_error(e);
			return null;
		}
	};

	var lib_urls = {
		"testcookie_slowaes": {
			name: "testcookie_slowaes",
			url: "https://raw.githubusercontent.com/qsniyg/maxurl/e90366f4b6c998614509472717fd18ca8050c1fa/lib/testcookie_slowaes.js",
			archive_time: "20210403210438",
			size: 30462,
			crc32: 1012990654,
			crc32_size: 2369381957
		},
		"shaka": {
			name: "shaka.debug",
			url: "https://raw.githubusercontent.com/qsniyg/maxurl/a4ca480a6cc503792762b4343f2f855cdf9cf48a/lib/shaka.debug.js",
			archive_time: "20210215220612",
			size: 1270454,
			crc32: 2187951259,
			crc32_size: 3680154806,
			xhr: true
		},
		"cryptojs_aes": {
			name: "cryptojs_aes",
			url: "https://raw.githubusercontent.com/qsniyg/maxurl/22df70495741c2f90092f4cc0c504a1a2f6e6259/lib/cryptojs_aes.js",
			archive_time: "20210215220612",
			size: 13453,
			crc32: 4282597182,
			crc32_size: 3521118067
		},
		"stream_parser": {
			name: "stream_parser",
			url: "https://raw.githubusercontent.com/qsniyg/maxurl/0655c317844fb7a652c6ee9f88ab65514c53b482/lib/stream_parser.js",
			archive_time: "20210403204309",
			size: 115544,
			crc32: 270289712,
			crc32_size: 2967398805
		},
		"ffmpeg": {
			name: "ffmpeg",
			url: "https://raw.githubusercontent.com/qsniyg/maxurl/2178819a193656245ce1a2bd885ff12aaaa04ea9/lib/ffmpeg.js",
			archive_time: "20210403204304",
			size: 285642,
			crc32: 2587771391,
			crc32_size: 2632494853,
			xhr: true
		},
		"jszip": {
			name: "jszip",
			url: "https://raw.githubusercontent.com/qsniyg/maxurl/3d8d6b4415b8dd58cb405910647c940ea122b3a0/lib/jszip.js",
			archive_time: "20231116183309",
			size: 99559,
			crc32: 2407465226,
			crc32_size: 689840937
		},
		"BigInteger": {
			name: "BigInteger",
			url: "https://raw.githubusercontent.com/qsniyg/maxurl/b0a4ba6c28f0c0b7c665e76e3767bde59e900ab6/lib/BigInteger.js",
			archive_time: "20231116183440",
			size: 21482,
			crc32: 337445473,
			crc32_size: 2641711624
		},
		"JSInterpreter": {
			name: "acorn_interpreter",
			url: "https://raw.githubusercontent.com/qsniyg/maxurl/b4d3d715e391e2e3f50a699acc5711bc7bdb6f52/lib/acorn_interpreter.js",
			archive_time: "20240311233145",
			size: 79532,
			crc32: 270556316,
			crc32_size: 2713590225
		}
	};

	var get_library = function(name, options, do_request, cb) {
		if (!options.allow_thirdparty_libs) {
			console_warn("Refusing to request library " + name + " due to 3rd-party library support being disabled");
			return cb(null);
		}

		if (!(name in lib_urls)) {
			console_error("Invalid library", name);
			return cb(null);
		}

		var lib_obj = lib_urls[name];

		if (is_scripttag) {
			return cb(null);
		} else if (is_node) {
			try {
				var libname = "./lib/" + lib_obj.name + ".js";
				var lib = require(/* webpackIgnore: true */libname);
				return cb(lib);
			} catch (e) {
				console.error(e);
				return cb(null);
			}
		}

		if (is_extension || is_userscript) {
			// Unfortunately in these cases it's less clean
			// Without building separate version of this for each use case, we have to fall back on "eval"ing (through `new Function`)
			lib_cache.fetch(name, cb, function (done) {
				if (is_extension) {
					// Thankfully in this case can query directly from the extension, removing possibility for XSS
					extension_send_message({
						type: "get_lib",
						data: {
							name: lib_obj.name
						}
					}, function (response) {
						if (!response || !response.data || !response.data.text)
							return done(null, 0); // 0 instead of false because it will never be available

						//done(new Function(response.data.text + ";return lib_export;")(), 0);
						run_sandboxed_lib(response.data.text, lib_obj.xhr, function(exported) {
							done(exported, 0);
						});
					});
				} else {
					// For the userscript, we have no other choice than to query and run arbitrary JS.
					// The commit is specified in lib_urls in order to prevent possible incompatibilities.
					// Unfortunately this still cannot prevent a very dedicated hostile takeover.
					// This is why we use the dual CRC32 check. Not bulletproof, but much better than nothing.
					// On my system it takes 6-30ms to do both CRC32 checks, so performance isn't really an issue.
					// FIXME: Perhaps this is unnecessary? The commit hash should change if the commit changes

					var lib_url = lib_obj.url;
					if (!lib_url) {
						console_error("No URL for library", lib_obj);
						return done(null, 0);
					}

					if (options.use_webarchive_for_lib) {
						if (lib_obj.archive_url) {
							lib_url = lib_obj.archive_url;
						} else {
							var time = lib_obj.archive_time;
							if (!time) {
								// fixme: it'd be better to auto-store the script's date somewhere
								var date = new Date();
								time = "" + date.getFullYear();
								time += zpadnum(date.getMonth() + 1, 2);
								time += zpadnum(date.getDate(), 2);
								time += zpadnum(date.getHours(), 2);
								time += zpadnum(date.getMinutes(), 2);
								time += "00";
							}

							lib_url = "https://web.archive.org/web/" + time + "js_/" + lib_obj.url;
						}
					}

					do_request({
						method: "GET",
						url: lib_url,
						headers: {
							Referer: ""
						},
						onload: function(result) {
							if (result.readyState !== 4)
								return;

							if (result.status !== 200) {
								console_error(result);
								return done(null, false);
							}

							var libcontents = result.responseText;

							if (options.use_webarchive_for_lib) {
								//var oldlib = libcontents;
								libcontents = libcontents
									.replace(/^\s*var _____WB\$wombat\$assign\$function_____[\s\S]*_____WB\$wombat\$assign\$function_____[(].*[)];\n\n/, "")
									.replace(/\n\n}\n\/\*\s*FILE ARCHIVED ON[\s\S]*/, "")
									.replace(/(["'])https:\/\/web.archive.org\/web\/[0-9]+(?:[a-z]+_)?\/+(https?:\/\/)/g, "$1$2")
									.replace(/(["'])\/\/web.archive.org\/web\/[0-9]+(?:[a-z]+_)?\/+https?:(\/\/)/g, "$1$2");

								//console_log(name, {old: oldlib, new: libcontents});
							}

							if (settings.lib_integrity_check) {
								var is_dev = false;
								if (false) {
									// for development (library updates/performance monitoring)
									is_dev = true;
									var start_time = 0;

									if (is_dev) {
										console_log("Size:", libcontents.length);
										console_log("Crc32:", crc32(libcontents));
										console_log("Crc32_2:", crc32(libcontents + (libcontents.length + "")));
										start_time = Date.now();
									}
								}

								if (libcontents.length !== lib_obj.size) {
									console_error("Wrong response length for " + name + ": " + libcontents.length + " (expected " + lib_obj.size + ")");
									return done(null, false);
								}

								var crc = crc32(libcontents);
								if (crc !== lib_obj.crc32) {
									console_error("Wrong crc32 for " + name + ": " + crc + " (expected " + lib_obj.crc32 + ")");
									return done(null, false);
								}

								crc = crc32(libcontents + (lib_obj.size + ""));
								if (crc !== lib_obj.crc32_size) {
									console_error("Wrong crc32 #2 for " + name + ": " + crc + " (expected " + lib_obj.crc32_size + ")");
									return done(null, false);
								}

								if (is_dev) console_log("Check time:", Date.now() - start_time);
							}

							run_sandboxed_lib_safe(libcontents, lib_obj.xhr, function(exported) {
								done(exported, 0);
							});
							//done(run_sandboxed_lib_safe(libcontents, lib_obj.xhr), 0);
							//done(new Function(libcontents + ";return lib_export;")(), 0);
						}
					});
				}
			});
		} else {
			return cb(null);
		}
	};

	// imu:begin_exclude
	// in order to test length/crc32
	if (false) {
		for (var lib_name in lib_urls) {
			(function(lib_name) {
				get_library(lib_name, {
					allow_thirdparty_libs: true,
					use_webarchive_for_lib: true
				}, do_request, function(lib) {
					if (!lib)
						console_error("Unable to load", lib_name);
				});
			})(lib_name);
		}
	}
	// imu:end_exclude

	var normalize_whitespace = function(str) {
		// https://stackoverflow.com/a/11305926
		return str
			.replace(/[\u200B-\u200D\uFEFF]/g, '')
			.replace(/[\u2800]/g, ' ');
	};

	var strip_whitespace_simple = function(str) {
		if (!str || typeof str !== "string") {
			return str;
		}

		return str
			.replace(/^\s+/, "")
			.replace(/\s+$/, "");
	};

	var strip_whitespace = function(str) {
		if (!str || typeof str !== "string") {
			return str;
		}

		return strip_whitespace_simple(normalize_whitespace(str));
	};

	var get_image_size = function(url, cb) {
		var image = new Image();
		var timeout = null;

		var finalcb = function(e) {
			image.onload = null;
			image.onerror = null;
			clearTimeout(timeout);

			var x, y;
			if (!image.naturalHeight || !image.naturalWidth) {
				x = null;
				y = null;
			}

			x = parse_int(image.naturalWidth);
			y = parse_int(image.naturalHeight);

			image.src = ""; // stop loading

			cb(x, y);
		};

		image.onload = image.onerror = finalcb;
		timeout = setInterval(function() {
			if (image.naturalHeight && image.naturalWidth) {
				finalcb();
			}
		}, 10);

		image.src = url;
	};

	if (is_node || typeof "Image" === "undefined") {
		get_image_size = null;
	}

	var sort_by_key = function<T>(array:Array<T>, key:any, indexer?:(key:any)=>any, options?):Array<T> {
		if (!options)
			options = {};

		return array.sort(function(a, b) {
			var a_key = a[key];
			var b_key = b[key];

			if (indexer) {
				a_key = indexer(a_key);
				b_key = indexer(b_key);
			} else {
				a_key = parseFloat(a_key) || 0;
				b_key = parseFloat(b_key) || 0;
			}

			if (options.reverse)
				return b_key - a_key;
			else
				return a_key - b_key;
		});
	};

	var sort_by_array = function<T>(array_to_sort:Array<T>, sortkey_array:Array<any>, indexer?:(key:any)=>any):Array<T> {
		array_to_sort.sort(function(a, b) {
			let a_value = a;
			let b_value = b;

			if (indexer) {
				a_value = indexer(a_value);
				b_value = indexer(b_value);
			}

			var a_index = array_indexof(sortkey_array, a_value);
			var b_index = array_indexof(sortkey_array, b_value);

			if (a_index < 0) {
				if (b_index >= 0)
					return 1;
				else if (typeof a_value === "string" && typeof b_value === "string")
					return (a_value as string).localeCompare((b_value as string));
				else
					return 0;
			} else {
				if (b_index < 0)
					return -1;
				else
					return a_index - b_index;
			}
		});

		return array_to_sort;
	};

	type ParsedTagDef = {
		tagname: string,
		selfclosing: boolean,
		args: Record<string, string>
		args_array: Array<{name: string, value: string}>
	};
	var parse_tag_def = function(tag:string):ParsedTagDef {
		var match = tag.match(/^<([-a-zA-Z0-9]+)((?:\s+[-a-z0-9A-Z]+(?:=(?:"[^"]*"|'[^']*'|[-_a-zA-Z0-9]+))?)*)\s*(\/?)>/);

		if (!match) {
			return null;
		}

		var parsed = {
			tagname: match[1],
			selfclosing: !!match[3],
			args: {},
			args_array: []
		};

		var args_regex = /\s+([-a-z0-9A-Z]+)(?:=("[^"]+"|'[^']+'|[-_a-zA-Z0-9]+))?/;
		var args = match[2];
		match = args.match(new RegExp(args_regex as any as string, "g"));
		if (!match)
			return parsed;

		for (var i = 0; i < match.length; i++) {
			var submatch = match[i].match(args_regex);

			var argname = submatch[1].toLowerCase();
			var argvalue = submatch[2];

			if (!argvalue) {
				argvalue = "";
			} else {
				argvalue = decode_entities(argvalue.replace(/^["'](.*)["']$/, "$1"));
			}

			parsed.args[argname] = argvalue;
			parsed.args_array.push({name: submatch[1], value: argvalue});
		}

		return parsed;
	};

	var get_meta = function(text, property) {
		var regex = new RegExp("<meta\\s+(?:(?:property|name|itemprop)=[\"']?" + property + "[\"']?\\s+(?:content|value|href)=[\"']([^'\"]+)[\"']|(?:content|value|href)=[\"']([^'\"]+)[\"']\\s+(?:property|name|itemprop)=[\"']?" + property + "[\"']?)\\s*\/?>");
		var match = text.match(regex);
		if (!match)
			return null;

		return decode_entities(match[1] || match[2]);
	};

	var fixup_js_obj = function(objtext) {
		return objtext
			.replace(/([{,])\s*([^[{,"'\s:]+)\s*:/g, "$1 \"$2\":")
			.replace(/(\"[^\s:"]+?\":)\s*'([^']*)'(\s*[,}])/g, "$1 \"$2\"$3")
			.replace(/,\s*}$/, "}");
	};

	// note: this is technically incorrect (too loose), as it'll allow things like:
	// {x: {} y: {}}
	// this is intentional, as otherwise it grows with exponential complexity ("kvcw*", "kvw?")
	var js_obj_token_types = {
		whitespace: /\s+/,
		jvarname: /[$_a-zA-Z][$_a-zA-Z0-9]*/,
		jpropname: /[$_a-zA-Z0-9]+/,
		number: /-?(?:[0-9]*\.[0-9]+|[0-9]+|[0-9]+\.)(?:e[0-9]+)?/,
		objstart: /{/,
		objend: /}/,
		object: ["objstart", "whitespace?", "kvcw*", "objend"],
		arrstart: /\[/,
		arrend: /]/,
		array: ["arrstart", "whitespace?", "valuecw*", "arrend"],
		true: /true/,
		false: /false/,
		null: /null/,
		value: [["array"], ["object"], ["sstring"], ["dstring"], ["number"], ["true"], ["false"], ["null"]],
		valuew: ["value", "whitespace?"],
		valuec: ["valuew", "comma?"],
		valuecw: ["valuec", "whitespace?"],
		comma: /,/,
		colon: /:/,
		squote: /'/,
		dquote: /"/,
		sstring: ["squote", "sliteral", "squote"],
		dstring: ["dquote", "dliteral", "dquote"],
		propname: [["jpropname"], ["sstring"], ["dstring"]],
		kv: ["propname", "whitespace?", "colon", "whitespace?", "value"],
		kvw: ["kv", "whitespace?"],
		kvc: ["kvw", "comma?"],
		kvcw: ["kvc", "whitespace?"],
		doc: [["object"], ["array"]]
	};

	var parse_js_obj = function(objtext, js_obj_token_types) {
		// for testing purposes
		/*var is_array = function(x) {
			return Array.isArray(x);
		};

		var array_extend = function(array, other) {
			[].push.apply(array, other);
		};*/

		js_obj_token_types = deepcopy(js_obj_token_types);

		for (var key in js_obj_token_types) {
			var value = js_obj_token_types[key];

			if (value instanceof RegExp) {
				js_obj_token_types[key] = {
					type: "regex",
					value: new RegExp("^" + value.source)
				};
			} else if (is_array(value)) {
				if (is_array(value[0])) {
					js_obj_token_types[key] = {
						type: "or",
						value: value
					};
				} else {
					js_obj_token_types[key] = {
						type: "and",
						value: value
					};
				}
			}
		}

		//console_log(js_obj_token_types);
		var times_ran = 0;
		var token_frequency = {};
		var stack_frequency = {};

		var find_token_regex = function(token_type, tt, i) {
			var text = objtext.substring(i);
			//console.log(text, tt, i);
			var match = text.match(tt);
			if (!match || match.index !== 0) {
				return null;
			} else {
				return [{
					name: token_type,
					i: i,
					ni: i + match[0].length,
					value: match[0],
					length: match[0].length
				}];
			}
		};

		var find_token_sliteral = function(token_type, i) {
			var quote = token_type === "dliteral" ? '"' : "'";
			var text = "";
			var escaping = false;
			var j;
			for (j = i; j < objtext.length; j++) {
				var ch = objtext[j];

				if (escaping) {
					escaping = false;
					if (ch === "x") {
						text += "\\u00" + objtext.substr(j+1, 2);
						j += 2;
					} else if (ch !== '"' && ch !== "'") {
						text += "\\" + ch;
					} else {
						text += ch;
					}

					continue;
				}

				if (ch === quote) {
					break;
				} else if (ch === "\\") {
					escaping = true;
				} else {
					text += ch;
				}
			}

			return [{
				name: token_type,
				i: i,
				ni: j,
				value: text,
				length: j - i
			}];
		}

		var find_token = function(token_type, i, stack) {
			//console_log(token_type, i);
			times_ran++;

			if (!(token_type in token_frequency))
				token_frequency[token_type] = 0;
			token_frequency[token_type]++;

			if (!(stack in stack_frequency))
				stack_frequency[stack] = 0;
			stack_frequency[stack]++;

			if (token_type === "sliteral" || token_type === "dliteral") {
				return find_token_sliteral(token_type, i);
			}

			var tt = js_obj_token_types[token_type];
			//console.log(token_type, tt);

			if (tt.type === "and") {
				return find_token_array_and(tt, i, stack);
			} else if (tt.type === "or") {
				return find_token_array_or(tt, i, stack);
			} else {
				return find_token_regex(token_type, tt.value, i);
			}
		};

		var find_token_array = function(array, i, stack) {
			var tokens = [];

			for (var j = 0; j < array.length; j++) {
				var token_type = array[j];
				var lastchar = token_type[token_type.length - 1];
				var minuslast = token_type.substring(0, token_type.length - 1);

				if (lastchar === "?") {
					//console.log("[START ?]", token_type, i, stack);
					var token = find_token(minuslast, i, stack+1);
					//console.log("[END ?]", token_type, i, stack, token);
					if (!token || token.length === 0)
						continue;

					array_extend(tokens, token);
					i = token[token.length - 1].ni;
				} else if (lastchar === "*") {
					while (true) {
						//console.log("[START *]", token_type, i, stack);
						var token = find_token(minuslast, i, stack+1);
						//console.log("[END *]", token_type, i, stack, token);
						if (!token || token.length === 0)
							break;

						array_extend(tokens, token);
						i = token[token.length - 1].ni;
					}
				} else {
					var token = find_token(token_type, i, stack+1);
					if (!token || token.length === 0) {
						if (tokens.length > 10 && false)
							console.log(tokens, token_type, i);
						return null;
					}

					array_extend(tokens, token);
					i = token[token.length - 1].ni;
				}
			}

			return tokens;
		};

		var find_token_array_and = function(tt, i, stack) {
			return find_token_array(tt.value, i, stack);
		};

		var find_token_array_or = function(tt, i, stack) {
			for (var j = 0; j < tt.value.length; j++) {
				var token = find_token_array(tt.value[j], i, stack);
				if (token && token.length) {
					return token;
				}
			}

			return null;
		};

		var outer_tokens = find_token("doc", 0, 0);
		return outer_tokens;
	};

	var fixup_js_obj_proper = function(objtext) {
		var parsed = parse_js_obj(objtext, js_obj_token_types);
		//console.log(parsed);
		if (!parsed)
			throw "unable to parse";

		var token_types = {
			whitespace: " ",
			jvarname: function(x) { return '"' + x + '"'; },
			jpropname: function(x) { return '"' + x + '"'; },
			squote: "\"",
			sliteral: function(x) { return x.replace(/"/g, "\\\""); },
			dliteral: function(x) { return x.replace(/"/g, "\\\""); },
			comma: function(x, next) {
				if (!next || next.name === "objend" || next.name === "arrend") {
					return "";
				} else {
					return x;
				}
			}
		};

		var stringified = "";
		for (var i = 0; i < parsed.length; i++) {
			var token = parsed[i];

			if (token.name in token_types) {
				var tt = token_types[token.name];

				if (typeof tt === "function") {
					var n = 1;
					var next_token = parsed[i+(n++)];
					while (next_token && next_token.name === "whitespace") {
						next_token = parsed[i+(n++)];
					}

					stringified += tt(token.value, next_token);
				} else {
					stringified += tt;
				}
			} else {
				stringified += token.value;
			}
		}

		return stringified;
	};

	common_functions["get_bigint"] = function(do_request, cb) {
		if (typeof BigInt !== "undefined") {
			var nativebigint = {
				create(num) {
					return BigInt(num);
				},
				add(num, num1) {
					return num + num1;
				},
				sub(num, num1) {
					return num - num1;
				},
				mul(num, num1) {
					return num * num1;
				},
				div(num, num1) {
					return num / num1;
				},
				mod(num, num1) {
					return num % num1;
				},
				stringify(num) {
					return num.toString();
				}
			};

			cb(nativebigint);
		} else {
			get_library("BigInteger", settings, do_request, function(lib) {
				if (!lib) {
					return cb(null);
				}

				var libbigint = {
					create(num) {
						return lib(num);
					},
					add(num, num1) {
						return num.add(num1);
					},
					sub(num, num1) {
						return num.subtract(num1);
					},
					mul(num, num1) {
						return num.multiply(num1);
					},
					div(num, num1) {
						return num.divide(num1);
					},
					mod(num, num1) {
						return num.mod(num1);
					},
					stringify(num) {
						return num.toString();
					}
				}

				cb(libbigint);
			});
		}
	};

	// cookie: postpagebeta=0; postpagebetalogged=0
	common_functions["fetch_imgur_webpage"] = function(do_request, api_cache, headers, url, cb) {
		var cache_key = "imgur_webpage:" + url.replace(/^https?:\/\/(?:www\.)?imgur/, "imgur").replace(/[?#].*/, "");

		var apply_headers = false;

		var real_fetch = function(done) {
			var request_url = url.replace(/^http:/, "https:");

			var request_headers;
			if (apply_headers) {
				request_headers = headers;
			}

			do_request({
				url: request_url,
				method: "GET",
				headers: request_headers,
				onload: function(resp) {
					if (resp.readyState !== 4)
						return;

					if (resp.status !== 200) {
						console_error("Bad status for Imgur: " + resp.status);

						if (resp.status === 404) {
							return done({
								bad: true
							}, false);
						}

						return done(null, false);
					}

					var ogvideo, ogimage;

					var ogmatch = resp.responseText.match(/<meta\s+property=["']og:video["']\s+content=["'](.*?)["']/);
					if (ogmatch) {
						ogvideo = decode_entities(ogmatch[1]).replace(/\?.*/, "");
					}

					ogmatch = resp.responseText.match(/<meta\s+property=["']og:image["']\s+content=["'](.*?)["']/);
					if (ogmatch) {
						ogimage = decode_entities(ogmatch[1]).replace(/\?.*/, "");
					}

					var retobj = {
						ogvideo: ogvideo,
						ogimage: ogimage
					};

					var imageinfo;
					var match = resp.responseText.match(/\.\s*mergeConfig\s*\(\s*["']gallery["']\s*,\s*{[\s\S]+?image\s*:\s*({.*?})\s*,\s*\n/);
					if (!match) {
						retobj.found_match = false;

						var nsfwmatch = resp.responseText.match(/<a.*?btn-wall--yes.*?\.(?:signin|cookie)\(/);
						var msg = "Unable to find match for Imgur page";

						if (nsfwmatch) {
							msg += " (it's probably NSFW and you aren't logged in)";
							retobj.nsfw = true;
						}

						console_warn(msg);

						if (headers && !apply_headers) {
							console_log("Retrying with custom headers");
							apply_headers = true;
							return real_fetch(done);
						}

						// Only cache it for 15 seconds (helpful if the user logs in)
						done(retobj, 15);
					} else {
						retobj.found_match = true;

						imageinfo = match[1];

						try {
							imageinfo = JSON_parse(imageinfo);
							retobj.imageinfo = imageinfo;

							if (imageinfo.source && imageinfo.hash && !imageinfo.is_album) {
								api_cache.set("imgur_imageinfo:" + imageinfo.hash, imageinfo, 6*60*60);
							}
						} catch (e) {
							console_error(e);
							console_log(match);
							imageinfo = void 0;
						}

						done(retobj, 6*60*60);
					};
				}
			});
		};

		api_cache.fetch(cache_key, cb, real_fetch);
	};

	common_functions["imgur_run_api"] = function(do_request, api_cache, endpoint, query, cb) {
		if (!query)
			query = {};

		query.client_id = base64_decode("IDU0NmMyNWE1OWM1OGFkNw==").slice(1);

		var url = endpoint + "?" + stringify_queries(query);

		real_api_query(api_cache, do_request, "imgur_api:" + url, {
			url: url,
			imu_mode: "xhr",
			headers: {
				Referer: "https://imgur.com/"
			},
			json: true
		}, cb,
		function(done, resp) {
			return done(resp, 60*60);
		});
	};

	common_functions["imgur_api_fetch_album_media"] = function(do_request, api_cache, type, id, cb) {
		// another option: https://api.imgur.com/3/image/id?client_id=...
		//                 https://api.imgur.com/3/album/id?client_id=...
		// works for logged in accounts, does it work for anonymous accounts too? is there a reason to use this instead?

		if (type === "album")
			type = "albums";
		else if (type === "image")
			type = "media";

		var endpoint = "https://api.imgur.com/post/v1/" + type + "/" + id;
		// FIXME: is adconfig,account required?
		var query = {include: "media,adconfig,account"};

		return common_functions["imgur_run_api"](do_request, api_cache, endpoint, query, cb);
	};

	common_functions["imgur_fetch_album_media"] = function(options, api_cache, type, id, cb) {
		if (type !== "album" && type !== "image") {
			console_error("Bug! Invalid type:", type);
			return cb(null);
		}

		var finalcb = function(data) {
			if (!data)
				return cb(data);

			var normalized = common_functions["imgur_normalize"](data);
			return cb(normalized);
		};

		if (("rule_specific" in options) && ("imgur_source" in options.rule_specific) && options.rule_specific.imgur_source) {
			var url = "https://imgur.com/";
			if (type === "album")
				url += "a/";

			url += id;

			common_functions["fetch_imgur_webpage"](options.do_request, api_cache, null, url, function(data) {
				// either new webpage or nsfw
				//console_log(data);
				if (!data || !data.found_match || !data.imageinfo) {
					return common_functions["imgur_api_fetch_album_media"](options.do_request, api_cache, type, id, finalcb);
				} else {
					return finalcb(data.imageinfo);
				}
			});
		} else {
			return common_functions["imgur_api_fetch_album_media"](options.do_request, api_cache, type, id, finalcb);
		}
	};

	common_functions["imgur_normalize"] = function(obj) {
		// v1
		if (!("media" in obj)) {
			if (obj.album_images) {
				// old web
				obj.media = obj.album_images.images;
			} else if (obj.images) {
				// v3
				obj.media = obj.images;
			}
		}

		// v1
		if (!("is_album" in obj)) {
			// old web
			if ("album_images" in obj)
				obj.is_album = true;
		}

		// v1
		if (!("url" in obj)) {
			if (obj.link) {
				// v3
				obj.url = obj.link;
			} else if (obj.hash) {
				// old web
				var prefix = "https://imgur.com/";
				if (obj.is_album) {
					prefix += "a/";
				}

				obj.url = prefix + obj.hash
			}
		}
		return obj;
	};

	common_functions["imgur_image_to_obj"] = function(options, baseobj:BigImageInfoSObject, json) {
		var retobj = [];

		try {
			//if (!json.is_album && json.media && json.media.length === 1)
			//	json = json.media[0];

			var metadata = json;

			// api
			if (json.metadata)
				metadata = json.metadata;

			if (metadata.description || metadata.title) {
				baseobj.extra.caption = metadata.description || metadata.title;
			}

			if (!json.hash) {
				// v1?
				if (json.id) {
					json.hash = json.id;
				}
			}

			if (!baseobj.headers)
				baseobj.headers = {Referer: null};
			if (!baseobj.referer_ok)
				baseobj.referer_ok = {same_domain_nosub: true};

			baseobj.extra.page = "https://imgur.com/" + json.hash;

			if (json.ext) {
				// v1?
				if (json.ext[0] !== ".")
					json.ext = "." + json.ext;

				if (json.ext.toLowerCase() === ".jpeg")
					json.ext = ".jpg";
			}

			var realfilename = null;
			if (json.hash && json.ext) {
				realfilename = json.hash + json.ext;

				var base1obj = deepcopy(baseobj);

				// v1
				if (("rule_specific" in options) && ("imgur_filename" in options.rule_specific) && options.rule_specific.imgur_filename) {
					if (json.name)
						base1obj.filename = json.name;
				}

				var obj = deepcopy(base1obj);
				obj.url = "https://i.imgur.com/" + realfilename;

				var mimetype = json.mimetype || json.mime_type;
				if (/^video\//.test(mimetype)) {
					obj.video = true;
					retobj.push(obj);

					var obj1 = deepcopy(base1obj);
					obj1.url = "https://i.imgur.com/" + json.hash + ".jpg"
					retobj.push(obj1);
				} else {
					// Prefer video if possible
					var animated = metadata.is_animated || json.animated;
					// fixme: prefer_video isn't in the api version
					if (animated && (json.prefer_video || true)) {
						var newobj = deepcopy(base1obj);
						newobj.url = "https://i.imgur.com/" + json.hash + ".mp4";
						newobj.video = true;

						retobj.push(newobj);
					}

					retobj.push(obj);
				}
			}

			// (old) webpage
			// doesn't work anymore
			if (false && json.source && /^https?:\/\//.test(json.source)) {
				if (!("rule_specific" in options) || !("imgur_source" in options.rule_specific) || options.rule_specific.imgur_source === true) {
					retobj.unshift({ url: json.source });
				}
			}
		} catch (e) {
			console_error(e);

			retobj = [];
		}

		return retobj;
	};

	common_functions["deviantart_url_from_id"] = function(do_request, api_cache, id, cb) {
		if (typeof id === "string" && /^[a-z0-9]+$/.test(id) && id.length === 7 && id[0] === "d") {
			// 28298170368.toString(36) = "d000000"
			var numerical_id = parseInt(id, 36) - 28298170368;
			//return cb("https://deviantart.com/a/art/" + numerical_id);
			return common_functions["deviantart_url_from_id"](do_request, api_cache, numerical_id, cb);
		} else {
			real_api_query(api_cache, do_request, "deviantart_url_from_id:" + id, {
				method: "HEAD",
				// use /deviation/ to find the original page instead of fav.me (which only supported http)
				// thanks to litterbox1 on discord for reporting
				url: "https://deviantart.com/deviation/" + id,
				cookie_url: "https://www.deviantart.com/" // workaround
			}, cb, function(done, resp, cache_key) {
				done(resp.finalUrl, 6*60*60);
			});
		}
	};

	common_functions["deviantart_page_from_id"] = function(do_request, api_cache, id, cb) {
		common_functions["deviantart_url_from_id"](do_request, api_cache, id, function(url) {
			if (!url) return cb(null);

			real_api_query(api_cache, do_request, "deviantart_page_from_id:" + id, {
				url: url
			}, cb, function(done, resp, cache_key) {
				done(resp, 60*60);
			});
		});
	};

	type WixImageInfo = {
		has_token?:boolean,
		preview?:boolean,
		original?:boolean,
		w?:number,
		h?:number,
		pixels?:number,
		q?:number // deprecated
	};
	common_functions["wix_image_info"] = function(url):WixImageInfo|null {
		var obj:WixImageInfo = {};

		// https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/f/06653b48-43c3-403f-9d72-c1c5519db560/ddl6lkp-cde05779-5a0a-47d8-8d43-f31a063fd30e.jpg/v1/fill/w_623,h_350,q_100/into_the_light_by_pajunen_ddl6lkp-350t.jpg
		// https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/f/faa48d2d-12c2-43d1-bf23-b5e99857825b/ddo0eau-c742e0f9-07f9-4a22-8d47-933e9fd3fb2b.png/v1/crop/w_244,h_350,x_0,y_0,scl_0.066812705366922,q_70,strp/railway_road_to_the_stars_by_ellysiumn_ddo0eau-350t.jpg

		// https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/intermediary/f/e04c7e93-4504-4dbe-91f9-fd353fc145f2/dcx503r-30c02b72-c26d-4732-9c9f-14fcbc633aaa.jpg
		var match = url.match(/^[a-z]+:\/\/[^/]+\/+(?:intermediary\/+)?([if])\/+[-0-9a-f]{20,}\/+[^/?]+([?#].*)?$/);
		if (match) {
			if (match[3] && match[3][0] === "?") {
				obj.has_token = true;
			}

			if (match[1] === "i") {
				obj.preview = true;
			} else {
				obj.original = true;
			}

			return obj;
		}

		var match = url.match(/^[a-z]+:\/\/[^/]+\/+(?:intermediary\/+)?[if]\/+[-0-9a-f]{20,}\/+[^/]+\/+v1\/+(?:fit|fill|crop)\/+([^/]+)\/+[^/]+(?:[?#].*)?$/);
		if (!match) {
			return null;
		}

		var infostr = match[1];
		var splitted = infostr.split(",");

		for (var i = 0; i < splitted.length; i++) {
			if (splitted[i].match(/^[a-z]+$/)) {
				obj[splitted[i]] = true;
				continue;
			}

			var name = splitted[i].replace(/_.*$/, "");
			var value = splitted[i].replace(/^.*?_/, "");

			if (value.match(/^[-0-9.]+$/))
				value = parseFloat(value);

			obj[name] = value;
		}

		if (obj.w && obj.h) {
			obj.pixels = obj.w * obj.h;
		}

		return obj;
	};

	common_functions["wix_compare"] = function(url1, url2, prefer_size) {
		if (_nir_debug_)
			console_log("wix_compare", url1, url2, prefer_size);

		if (!url2)
			return url1;

		var info1:WixImageInfo|null = common_functions["wix_image_info"](url1);
		var info2:WixImageInfo|null = common_functions["wix_image_info"](url2);

		if (_nir_debug_)
			console_log("wix_compare (info1:", info1, "info2:", info2, ")");

		if (!info1 || !info2)
			return null;

		// needed to avoid constant reloading between /intermediary/ and /f/.*?token
		// thanks to Wisedrow on discord for reporting
		// https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/intermediary/f/4ac770c0-c37b-43a0-866f-2a2707ea61c7/d854mkr-cf30cc53-6b99-4651-916d-1703c943255c.jpg
		if (info1.original && info2.original) {
			if (info2.has_token) {
				return url1;
			} else {
				return url2;
			}
		}

		if (info1.original && (!prefer_size || !info2.preview))
			return url1;

		if (info2.original && (!prefer_size || !info1.preview))
			return url2;

		if (info1.pixels && info2.pixels) {
			if (info1.pixels > info2.pixels)
				return url1;
			else if (info2.pixels > info1.pixels)
				return url2;
			else if (info1.q && info2.q) {
				if (info1.q > info2.q) {
					return url1;
				} else if (info2.q > info1.q) {
					return url2;
				}
			}
		}

		return null;
	};

	common_functions["_wix_bigimage_inner"] = function(src) {
		var newsrc = src.replace(/(:\/\/[^/]*\/)(f\/+[-0-9a-f]{36}\/+[0-9a-z]+-[-0-9a-f]{20,}(?:\.[^/.]*)?\/+v1\/+(?:fill|fit)\/+w_[0-9]+,h_[0-9]+)(?:,[^/]+)?(\/+.*[?&]token=.*)$/, "$1$2,q_100$3");
		if (newsrc !== src) {
			return newsrc;
		}

		// thanks to MrSeyker on greasyfork: https://greasyfork.org/en/scripts/36662-image-max-url/discussions/34976#comment-160842
		newsrc = src.replace(/(:\/\/[^/]*\/f\/+[-0-9a-f]{36}\/+[0-9a-z]+-[-0-9a-f]{20,}\.(?:png|PNG)\/+v1\/+(?:fill|fit)\/+[^/]+\/+[^/?#]+)\.[^/.?#]+(\?.*)?$/, "$1.png$2");
		if (newsrc !== src) {
			return newsrc;
		}

		// thanks to MrSeyker on github: https://github.com/qsniyg/maxurl/issues/616#issuecomment-762570739
		// https://www.deviantart.com/hugotendaz/art/Rosetta-The-Best-Buns-Cartoony-PinUp-Comm-729023803
		// https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/f/a776a3e5-3e6f-4f61-89b7-1724ab9c2567/dc21id7-2610a389-46ea-4388-83ec-e144cfa0b73c.jpg?token=... -- 71kb
		// https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/intermediary/f/a776a3e5-3e6f-4f61-89b7-1724ab9c2567/dc21id7-2610a389-46ea-4388-83ec-e144cfa0b73c.jpg -- 43kb, visible artifacting
		if (!/^[a-z]+:\/\/[^/]+\/+f\/+[-0-9a-f]{36}\/+[a-z0-9]{5,}-[-0-9a-f]{36}\.[^/.?#]+\?token=[^&]+(?:#.*)?$/.test(src)) {
			newsrc = src.replace(/(:\/\/[^/]*\/)(f\/+[-0-9a-f]{36}\/+.*?)[?&]token=.*$/, "$1intermediary/$2");
			if (newsrc !== src) {
				return newsrc;
			}
		}

		if (!src.match(/[?&]token=.{30,}/)) {
			newsrc = src
				.replace(/(\.[^/.]*)\/v1\/.*/, "$1")
				.replace(/(\/[^/.]*\.[^/.]*?)_[_0-9.a-z]*$/, "$1");

			if (newsrc !== src) {
				return newsrc;
			}
		}

		return null;
	};

	// FIXME: this is basically replicating bigimage_recursive
	common_functions["wix_bigimage"] = function(src) {
		var urls = [];

		while (src) {
			urls.unshift(src);
			src = common_functions["_wix_bigimage_inner"](src);
		}

		return urls;
	};

	common_functions["deviantart_fullimage"] = function(options, api_cache, src, id, cb) {
		// animated:
		// https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/i/db0d85b1-b8b9-4790-bef0-121edb2dce7d/ddabn1h-5342115a-06a6-4f89-9c54-a2843719553a.jpg/v1/fit/w_150,h_150,q_70,strp/spaghetti_high_by_f1x_2_ddabn1h-150.jpg
		// https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/i/db0d85b1-b8b9-4790-bef0-121edb2dce7d/ddabn1h-5342115a-06a6-4f89-9c54-a2843719553a.jpg -- 1920x1080, but original size says 1280x720 and is animated. however, it doesn't look upscaled either
		//   https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/f/db0d85b1-b8b9-4790-bef0-121edb2dce7d/ddabn1h-1d7ac558-1fa8-4943-a3b6-0ad8b06be106.gif
		common_functions["deviantart_page_from_id"](options.do_request, api_cache, id, function(result) {
			if (!result) {
				return cb(null);
			}

			var obj = {
				url: null,
				waiting: false,
				extra: {
					page: result.finalUrl
				}
			};

			var urls = [];

			if (!src.match(/:\/\/[^/]*\/fake_image\//)) {
				array_extend(urls, common_functions["wix_bigimage"](src));
			}

			var deviationid = result.finalUrl.replace(/.*-([0-9]+)(?:[?#].*)?$/, "$1");
			if (deviationid === result.finalUrl)
				deviationid = null;

			// Support the redesign
			var initialstate = result.responseText.match(/window\.__INITIAL_STATE__\s*=\s*JSON\.parse\((".*")\);\s*(?:window\.|<\/script)/);
			if (initialstate && deviationid) {
				try {
					// for some reason DA escapes ', breaking JSON.parse
					initialstate = JSON_parse(JSON_parse(initialstate[1].replace(/\\'/g, "'")));
				} catch (e) {
					console.error(e, {initialstate: initialstate, result: result});
					throw e;
				}
				console_log(initialstate);

				try {
					var entities = initialstate["@@entities"];
					var deviation = entities.deviation[deviationid];

					var deviationExtended = null;
					if (entities.deviationExtended)
						deviationExtended = entities.deviationExtended[deviationid];

					if (_nir_debug_) {
						console_log("Deviation object", deviation);
						console_log("Extended deviation object", deviationExtended);
					}

					if (deviation.title)
						obj.extra.caption = deviation.title;

					var maxurl = obj.url;

					var files = deviation.files;

					if (is_array(files)) {
						for (var i = files.length - 1; i >= 0; i--) {
							var current = files[i];
							var newurl = common_functions["wix_compare"](current.src, maxurl, options.rule_specific.deviantart_prefer_size);
							if (newurl === current.src)
								maxurl = newurl;
						}
					} else if ("media" in deviation && is_array(deviation.media.types)) {
						if (deviation.media.prettyName)
							obj.filename = deviation.media.prettyName;

						var types = deviation.media.types;

						for (var i = types.length - 1; i >= 0; i--) {
							var link = null;

							var tokenid = 0;

							// https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/f/40458dca-4360-4b4b-8aca-ba831f8db36d/ddsdflz-9484b31e-187e-4761-9724-6853698242a7.png/v1/fill/w_712,h_1123,q_100/morning_sun_by_pegaite_ddsdflz-pre.png
							// https://www.deviantart.com/pegaite/art/Morning-Sun-833716295
							if ("r" in types[i] && types[i].r < deviation.media.token.length)
								tokenid = types[i].r;

							var tokenq = "?token=" + deviation.media.token[tokenid];

							if (types[i].c) {
								link = deviation.media.baseUri + "/" + types[i].c.replace("<prettyName>", deviation.media.prettyName).replace(/^\/+/, "") + tokenq;
							} else if (types[i].b) { // e.g. animated gifs
								link = types[i].b + tokenq;
							} else if (types[i].t === "fullview" && "r" in types[i]) {
								// TODO: improve check?
								link = deviation.media.baseUri + tokenq;
							}

							// Occasionally this exists for some images, where it instead has:
							// s: "https://st.deviantart.net/misc/noentrythumb-200.png" (for t: "social_preview")
							if (!link)
								continue;

							var newurl = common_functions["wix_compare"](link, maxurl, options.rule_specific.deviantart_prefer_size);
							if (newurl === link)
								maxurl = newurl;
						}
					}

					var suburls = [];
					var ourobj = {};

					suburls = common_functions["wix_bigimage"](maxurl);

					var image_info = common_functions["wix_image_info"](maxurl);
					if (false && image_info && image_info.original) {
						ourobj.is_original = true;
					}

					// basically: array_prepend(urls, suburls);
					array_extend(suburls, urls);
					urls = suburls;

					if (deviationExtended) {
						if (options.rule_specific.deviantart_support_download && deviationExtended.download && deviationExtended.download.url) {
							urls.unshift({
								url: deviationExtended.download.url,
								is_private: true
							});
						}
					}
				} catch (e) {
					console_error(e);
				}
			}

			if (false) {
				// remove duplicates (todo: factor this out?)
				var prevurls = new_set();
				for (var i = 0; i < urls.length; i++) {
					if (set_has(prevurls, urls[i].url)) {
						urls.splice(i, 1);
						i--;
					} else {
						set_add(prevurls, urls[i].url);
					}
				}
			}

			return cb(fillobj_urls(urls, obj));
		});
	};

	common_functions["getty_image_info"] = function(url) {
		if (!/^[a-z]+:\/\/media\.(?:gettyimages|istockphoto)\.com\//.test(url)) {
			return null;
		}

		let info = {}

		let match = url.match(/:\/\/[^/]+\/+id\/+([0-9]+)\/(?:[a-z]{2}\/+)?([^/.]+)\/+([^/.]+)\.([a-z]+)/);
		if (match) {
			info["id"] = match[1];
			info["category"] = match[2];
			info["filename"] = match[3];
			info["ext"] = match[4];
		} else {
			match = url.match(/\/([a-z]+?)s?\/+([^/.]*?)-id([0-9]+)(?:[?#].*)?$/);
			if (match) {
				info["id"] = match[3];
				info["category"] = match[1];
				info["filename"] = match[2];
				info["ext"] = "jpg";
			}
		}

		if (!info["id"])
			return null;

		let queries = get_queries(url);
		if (!queries) {
			queries = {};
		}

		if (!queries.s) {
			info["size"] = 1024;
			info["size2"] = 1024*1024;
		} else {
			let sizematch = (queries.s + "").match(/^([0-9]+)x([0-9]+)$/);
			if (sizematch) {
				let size1 = parse_int(sizematch[1]);
				let size2 = parse_int(sizematch[2]);

				info["size"] = Math_max(size1, size2);
				info["size2"] = size1 * size2;
			} else {
				info["size"] = 0;
				info["size2"] = 0;
			}
		}

		if (queries.w) {
			if (queries.w === "0")
				info["watermark"] = false;
			else
				info["watermark"] = queries.w;
		} else {
			if (info["size"] <= 170) {
				info["watermark"] = false;
			} else {
				info["watermark"] = "gi";
			}
		}

		return info;
	};

	common_functions["getty_transform_url"] = function(url) {
		return url
			.replace(/(\/id\/+[0-9]+\/+)(?:[a-z]{2}\/+)?foto\/+/, "$1photo/")
			.replace(/(\/id\/+[0-9]+\/+)(?:[a-z]{2}\/+)?(?:向量|%E5%90%91%E9%87%8F)\/+/, "$1vector/")
			.replace(/\/id\/+([0-9]+)\/+(?:[a-z]{2}\/+)?(photo|vector)\/+([^/.?#]+)(?:[?#.].*)?$/, "/$2s/$3-id$1");
	};

	common_functions["get_testcookie_cookie"] = function(options, api_cache, site, cb) {
		var cache_key = "testcookie_cookie:" + site;
		var do_request = options.do_request;

		api_cache.fetch(cache_key, cb, function (done) {
			get_library("testcookie_slowaes", options, options.do_request, function (lib) {
				if (!lib) {
					console_error(cache_key, "Unable to fetch patched slowAES library");
					return done(null, false);
				}

				do_request({
					method: "GET",
					url: site,
					headers: {
						Referer: "",
						Cookie: ""
					},
					onload: function (result) {
						if (result.readyState !== 4)
							return;

						if (result.status !== 200) {
							console_log(cache_key, result);
							return done(null, false);
						}

						var matches = result.responseText.match(/[a-z]=\s*toNumbers\(["'][0-9a-f]+["']/g);
						if (!matches) {
							console_log(cache_key, "Unable to find toNumbers match", result);
							return done(null, false);
						}

						var vartable = {};
						for (var i = 0; i < matches.length; i++) {
							var match = matches[i].match(/([a-z])=toNumbers\(["']([0-9a-f]+)["']/);
							vartable[match[1]] = hex_to_numberarray(match[2]);
						}

						var slowaesmatch = result.responseText.match(/slowAES\.decrypt\s*\(\s*(.)\s*,\s*(.)\s*,\s*(.)\s*,\s*(.)\s*\)/);
						if (!slowaesmatch) {
							console_log(cache_key, "Unable to find slowAES match", result);
							return done(null, false);
						}

						var cookiename = result.responseText.match(/document\.cookie\s*=\s*["']([^='"]*?)=/);
						if (!cookiename) {
							console_log(cache_key, "Unable to find cookie name match", result);
							return done(null, false);
						} else {
							cookiename = cookiename[1];
						}

						var getarg = function(x) {
							if (/[a-z]/.test(x))
								return vartable[x];
							return parse_int(x);
						};

						var cookievalue = numberarray_to_hex(lib.decrypt(
							getarg(slowaesmatch[1]), getarg(slowaesmatch[2]),
							getarg(slowaesmatch[3]), getarg(slowaesmatch[4])));

						done(cookiename + "=" + cookievalue, 6*60*60);
					}
				});
			});
		});
	};

	common_functions["static_unpack_packer"] = function(format, base, in_table_length, in_table) {
		var encode_base62 = function(n) {
			var output = "";

			if (n >= base) {
				output = encode_base62(parse_int(n / base));
			}

			n = n % base;

			if (n > 35) {
				output += string_fromcharcode(n + 29);
			} else {
				output += n.toString(36);
			}

			return output;
		};

		var encode_base10 = function(n) {
			return n + "";
		};

		var encode_base36 = function(n) {
			return n.toString(base);
		};

		var encode;
		if (base === 10) {
			encode = encode_base10;
		} else if (base <= 36) {
			encode = encode_base36;
		} else { // base can be things like 14 too
			encode = encode_base62;
		}

		var table = {};

		for (var i = in_table_length; i >= 0; i--) {
			var encoded = encode(i);
			table[encoded] = in_table[i] || encoded;
		}

		return format.replace(/\b\w+\b/g, function(e) {
			return table[e];
		});
	};

	common_functions["unpack_packer"] = function(packed) {
		var regex = /eval\(function\(p,a,c,k,e,[rd]\){.*?return p}\('(.*?)',([0-9]+),([0-9]+),'(.*?)'\.split\('[|]'\)(?:,0,{})?\)\)/;
		var match = packed.match(regex);
		if (!match) {
			return null;
		}

		var format = match[1].replace(/([^\\])\\'/g, "$1'");
		var base = parseInt(match[2]);
		var table_length = parseInt(match[3]);
		var table = match[4].split("|");

		return common_functions["static_unpack_packer"](format, base, table_length, table);
	};

	common_functions["instagram_username_from_sharedData"] = function(json) {
		if (json.username)
			return json.username;
		else {
			var entrydata = json.entry_data;

			if (entrydata.ProfilePage)
				return entrydata.ProfilePage[0].graphql.user.username;
			else
				return entrydata.PostPage[0].user.username;
		}
	};

	common_functions["instagram_get_imageid"] = function(image_url) {
		if (!image_url)
			return image_url;

		if (typeof image_url === "number") return image_url; // e.g. img_i: 0, 1, 2

		// story id
		var newurl = image_url.replace(/.*\/stories\/+[^/]+\/+([0-9]+)\/*(?:[?#].*)?$/, "$1");
		if (newurl !== image_url) return newurl;

		// thanks to robindz on github for reporting: https://github.com/qsniyg/maxurl/issues/983
		// https://scontent-bru2-1.cdninstagram.com/v/t51.2885-15/e35/271760634_141729454899363_6673546970842196313_n.webp.jpg
		newurl = image_url.replace(/.*\/([^/.?#]*)\.[^/]*(?:[?#].*)?$/, "$1");
		if (newurl === image_url) return null;
		return newurl;
	};

	common_functions["instagram_norm_url"] = function(src) {
		// thanks to remlap on github: https://github.com/qsniyg/maxurl/issues/239
		// https://github.com/qsniyg/maxurl/issues/522
		// some info: https://sorsnce.com/2020/04/15/the-truth-about-social-media-content-delivery-networks/
		// _nc_cat is useless, but doesn't appear to change anything, so let's not remove it to avoid useless redirects
		// no idea if ig_cache_key does anything or not, but since we're changing the url, perhaps, from the name, this could lead to issues?
		// no idea what efg or _nc_rid do, haven't seen them change anything yet
		return remove_queries(src, ["se", "ig_cache_key"]);
		//return remove_queries(src, ["se", "_nc_cat", "_nc_rid", "efg", "ig_cache_key"]);
		// these remove_queries calls are separated in case the next one doesn't work.
		/*newsrc = remove_queries(src, ["se"]);
		if (newsrc !== src)
			return newsrc;

		newsrc = remove_queries(src, ["_nc_cat", "_nc_rid", "efg", "ig_cache_key"]);
		if (newsrc !== src)
			return newsrc;*/
	};

	common_functions["set_cdninstagram_obj"] = function(obj) {
		if (typeof obj === "string")
			obj = {
				url: obj
			};

		// https://github.com/qsniyg/maxurl/issues/719
		// if referer/origin is not present (or not set to instagram.com), "access-control-allow-origin: *" will not exist in the response headers
		// if one is set to something other than instagram.com, it will also fail
		if (!obj.headers)
			obj.headers = {};

		// referer = instagram.com is crucial to avoid throttling (thanks to remlap for reporting)
		headerobj_set(obj.headers, "Referer", "https://www.instagram.com/");
		// origin apparently seems to throttle? is this placebo?
		//headerobj_set(obj.headers, "Origin", "https://www.instagram.com"); // is this needed?

		// instagram seems to throttle without these?
		if (obj.video)
			headerobj_set(obj.headers, "Sec-Fetch-Dest", "video");
		else
			headerobj_set(obj.headers, "Sec-Fetch-Dest", "image");
		headerobj_set(obj.headers, "Sec-Fetch-Mode", "cors");
		headerobj_set(obj.headers, "Sec-Fetch-Site", "cross-site");

		// in order to allow the extension to override allow-access-control-origin
		obj.need_credentials = false;

		// is this needed to avoid throttling?
		//obj.max_chunks = 1;

		return obj;
	};

	var instagram_shortcode_table = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
	common_functions["instagram_shortcode_to_id"] = function(shortcode, cb) {
		common_functions["get_bigint"](do_request, function(bigint) {
			if (!bigint) {
				return cb(null);
			}

			shortcode = shortcode.substring(0, 11); // truncate for private ids
			var base = bigint.create(0);
			var sixtyfour = bigint.create(64);

			for (var i = 0; i < shortcode.length; i++) {
				var index = bigint.create(string_indexof(instagram_shortcode_table, shortcode[i]));
				base = bigint.mul(base, sixtyfour);
				base = bigint.add(base, index);
			}

			return cb(bigint.stringify(base));
		});
	};

	common_functions["instagram_parse_el_info"] = function(api_cache, do_request, use_app_api, dont_use_web, prefer_video_quality, info, host_url, cb) {
		var host_is_ig = /^[a-z]+:\/\/[^/]*\.instagram\.com\//.test(host_url);

		var shortcode_to_url = function(type, shortcode) {
			return "https://www.instagram.com/" + type + "/" + shortcode + "/";
		};

		var url_to_shortcode = function(url) {
			var match = url.match(/^[a-z]+:\/\/[^/]+\/+(?:[^/]+\/+)?(?:p|tv|reel)\/+([^/]+)/);
			if (match)
				return match[1];
			return null;
		};

		var id_to_shortcode, shortcode_to_id;

		var shortcode_table = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";

		// TODO: don't use recursion
		// FIXME: use library instead of BigInt
		var _id_to_shortcode = function(id) {
			var sixtyfour = BigInt(64);
			if (id < sixtyfour) {
				return shortcode_table[parseInt(id)];
			} else {
				return id_to_shortcode(id / sixtyfour) + shortcode_table[id % sixtyfour];
			}
		};

		id_to_shortcode = function(id) {
			return _id_to_shortcode(BigInt(id));
		};

		shortcode_to_id = function(shortcode, cb) {
			common_functions["get_bigint"](do_request, function(bigint) {
				if (!bigint) {
					return cb(null);
				}

				shortcode = shortcode.substring(0, 11); // truncate for private ids
				var base = bigint.create(0);
				var sixtyfour = bigint.create(64);

				for (var i = 0; i < shortcode.length; i++) {
					var index = bigint.create(string_indexof(shortcode_table, shortcode[i]));
					base = bigint.mul(base, sixtyfour);
					base = bigint.add(base, index);
				}

				return cb(bigint.stringify(base));
			});
		};

		var get_sharedData_from_resptext = function(text) {
			try {
				var regex1 = /window\._sharedData = *(.*?);?<\/script>/;
				var regex2 = /window\._sharedData *= *(.*?}) *;[\s]*window\.__initialDataLoaded/;

				var match = text.match(regex1);
				if (!match) {
					match = text.match(regex2);
				}

				var parsed = JSON_parse(match[1]);

				var regex3 = /window\.__additionalDataLoaded\(["'].*?["']\s*,\s*({.*?})\);?\s*<\/script>/;
				match = text.match(regex3);
				if (match) {
					var parsed1 = JSON_parse(match[1]);
					for (var key in parsed.entry_data) {
						if (is_array(parsed.entry_data[key])) {
							if (parsed1.items && is_array(parsed1.items)) {
								parsed1 = parsed1.items[0];
							}

							parsed.entry_data[key][0] = overlay_object(parsed.entry_data[key][0], parsed1);
						}
					}
				}

				return parsed;
			} catch (e) {
				console_error(e);
			}

			return null;
		};

		var query_ig_page = function(url, cb) {
			if (!do_request)
				return cb(null);

			// Normalize the URL to reduce duplicate cache checks
			url = url
				.replace(/[?#].*/, "")
				.replace(/([^/])$/, "$1/")
				.replace(/^http:/, "https:")
				.replace(/(:\/\/)(instagram\.com\/)/, "$1www.$2")
				.replace(/(:\/\/.*?)\/\/+/g, "$1/");

			var cache_key = "instagram_page_query:" + url;
			api_cache.fetch(cache_key, cb, function (done) {
				do_request({
					method: "GET",
					url: url,
					onload: function (result) {
						if (result.readyState !== 4)
							return;

						return done(result, 60*60);
					}
				});
			});
		};

		var query_ig = function(url, cb) {
			query_ig_page(url, function(result) {
				if (!result)
					return cb(null);

				var parsed = get_sharedData_from_resptext(result.responseText);
				if (!parsed) {
					console_log("instagram_sharedData", result);
					return cb(null);
				} else {
					return cb(parsed);
				}
			});
		};

		var uid_from_sharedData = function(json) {
			if (json.id)
				return json.id;
			else {
				var entrydata = json.entry_data;

				if (entrydata.ProfilePage)
					return entrydata.ProfilePage[0].graphql.user.id;
				else
					return entrydata.PostPage[0].user.pk;
			}
		};

		var username_to_uid = function(username, cb) {
			if (username.match(/^http/)) {
				username = username.replace(/^[a-z]+:\/\/[^/]*\/+(?:stories\/+)?([^/]*)(?:\/.*)?(?:[?#].*)?$/, "$1");
			}

			var cache_key = "instagram_username_uid:" + username;
			api_cache.fetch(cache_key, cb, function (done) {
				query_ig_page("https://www.instagram.com/" + username + "/", function(result) {
					if (!result || result.status !== 200) {
						console_error(cache_key, "Unable to query", result);
						return done(null, false);
					}

					var ids = {};
					var matches = match_all(result.responseText, /"props":{"id":"([0-9]+)",/);
					if (!matches || !matches.length) {
						console_error(cache_key, "Unable to find UID from user page", result);
						return done(null, false);
					}

					for (let match of matches) {
						let id = match[1];
						if (!(id in ids))
							ids[id] = 0;
						ids[id]++;
					}

					// FIXME: is this needed?
					// find most popular ID. I've only observed 2 ids per page, both are the same
					var id_keys = Object.keys(ids);
					id_keys.sort(function(a, b) {
						return ids[b] - ids[a];
					});

					return done(id_keys[0], 5*60);
				});
			});
		};

		var uid_to_profile = function(uid, cb) {
			var cache_key = "instagram_uid_to_profile:" + uid;
			api_cache.fetch(cache_key, cb, function (done) {
				var url = "https://i.instagram.com/api/v1/users/" + uid + "/info/";
				app_api_call(url, function (result) {
					if (!result)
						return done(null, false);

					if (result.readyState !== 4)
						return;

					try {
						var parsed = JSON_parse(result.responseText).user;

						// 5 minutes since they can change their profile pic often
						done(parsed, 5 * 60);
					} catch (e) {
						console_log("instagram_uid_to_profile", result);
						console_error("instagram_uid_to_profile", e);
						done(null, false);
					}
				});
			});
		};

		var get_instagram_cookies = function(cb) {
			// For now, we'll disable this as it doesn't appear to be needed
			if (true) {
				cb(null);
			} else {
				var cookie_cache_key = "instagram";
				if (cookie_cache.has(cookie_cache_key)) {
					return cb(cookie_cache.get(cookie_cache_key));
				}

				cb(null);

				// commenting out due to options not existing
				/*if (options.get_cookies) {
					options.get_cookies("https://www.instagram.com/", function(cookies) {
						cookie_cache.set(cookie_cache_key, cookies);
						cb(cookies);
					});
				} else {
					cb(null);
				}*/
			}
		};

		var app_api_call = function (url, cb) {
			return web_api_call(url, cb); // FIXME: for testing only

			if (!do_request) {
				return cb(null);
			}

			var headers = {
				//"User-Agent": "Instagram 10.26.0 (iPhone7,2; iOS 10_1_1; en_US; en-US; scale=2.00; gamut=normal; 750x1334) AppleWebKit/420+",
				//"User-Agent": "Instagram 10.26.0 Android (23/6.0.1; 640dpi; 1440x2560; samsung; SM-G930F; herolte; samsungexynos8890; en_US)",
				// thanks to ambler on discord for reporting, earlier UAs don't receive stories anymore
				//"User-Agent": "Instagram 146.0.0.27.125 Android (23/6.0.1; 640dpi; 1440x2560; samsung; SM-G930F; herolte; samsungexynos8890; en_US)",
				//"User-Agent": "Instagram 146.0.0.27.125 Android (30/11; 420dpi; 2678x1080; samsung; SM-G988U1; z3q; qcom; en_US)", // made up
				// from instaloader:
				"User-Agent": "Instagram 146.0.0.27.125 (iPhone12,1; iOS 13_3; en_US; en-US; scale=2.00; 1656x3584; 190542906)",
				//"User-Agent": "Mozilla/5.0 (Linux; Android 10; SM-T860 Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/87.0.4280.101 Mobile Safari/537.36 Instagram 168.0.0.40.355 Android (29/10; 360dpi; 2560x1492; samsung; SM-T860; gts6lwifi; qcom; en_US; 261079769)",
				"X-IG-Capabilities": "36oD",
				"Accept": "*/*",
				"Accept-Language": "en-US,en;q=0.8",
				"Sec-CH-UA": "" // prevent the browser from leaking user-agent
			};

			get_instagram_cookies(function(cookies) {
				if (cookies) {
					headers.Cookie = cookies_to_httpheader(cookies);
				}

				if (!use_app_api)
					headers.Cookie = "";

				do_request({
					method: "GET",
					url: url,
					headers: headers,
					onload: cb
				});
			});
		};

		var web_api_call = function(url, cb) {
			if (!do_request) {
				return cb(null);
			}

			var run_request = function() {
				if (!wwwclaim) {
					console_warn("Unable to find value for x-ig-www-claim header");
				}

				// https://www.instagram.com/static/bundles/es6/ConsumerLibCommons.js/...
				var headers = {
					"Accept": "*/*",
					"X-ASBD-ID": "198387", // .ASBD_ID, todo: fetch! -- same as of june 28 2022
						// not always sent though?
						// id as of august 10 2023: 129477
					// TODO: x-csrftoken (csrftoken cookie)
					"X-IG-App-ID": "936619743392459", // instagramWebDesktopFBAppId
					"Origin": "https://www.instagram.com",
					"Referer": "https://www.instagram.com/",
					"Sec-Fetch-Site": "same-site",
					"Sec-Fetch-Mode": "cors",
					"Sec-Fetch-Dest": "empty"
				};

				if (wwwclaim) {
					headers["X-IG-WWW-Claim"] = wwwclaim;
				}

				do_request({
					method: "GET",
					url: url,
					headers: headers,
					onload: cb
				});
			};

			var wwwclaim = null;
			if (get_localstorage) {
				// https://www.instagram.com/static/bundles/es6/ConsumerLibCommons.js/...
				get_localstorage("https://www.instagram.com/", ["www-claim-v2"], function(data) {
					if (data && data["www-claim-v2"]) {
						wwwclaim = data["www-claim-v2"];
					}

					run_request();
				}, {storage: "session"});
			} else {
				run_request();
			}
		};

		var mediainfo_api = function(id, cb) {
			if (!use_app_api)
				return cb(null);

			var cache_key = "instagram_mediainfo:" + id;
			api_cache.fetch(cache_key, cb, function (done) {
				var url = "https://i.instagram.com/api/v1/media/" + id + "/info/";
				app_api_call(url, function (result) {
					if (!result)
						return done(null, false);

					if (result.readyState !== 4)
						return;

					if (result.status === 200) {
						var parsed = null;

						try {
							parsed = JSON_parse(result.responseText);
						} catch (e) {
							console_log("instagram_mediainfo", result);
							console_error("instagram_mediainfo", e);
						}

						if (_nir_debug_) {
							console_log("instagram_mediainfo", parsed);
						}

						if (parsed) {
							return done(parsed, 60 * 60);
						}
					} else {
						console_error(cache_key, result);
					}

					done(null, false);
				});
			});
		};

		var get_all_stories_api = function(uid, cb) {
			return get_all_stories_webapi(uid, cb);

			if (!use_app_api)
				return cb(null);

			var story_cache_key = "instagram_story_uid:" + uid;
			api_cache.fetch(story_cache_key, cb, function (done) {
				var url = "https://i.instagram.com/api/v1/feed/user/" + uid + "/reel_media/";
				app_api_call(url, function(result) {
					if (!result)
						return done(null, false);

					if (result.readyState !== 4)
						return;

					if (result.status !== 200) {
						console_log(story_cache_key, result);
						return done(null, false);
					}

					try {
						var parsed = JSON_parse(result.responseText);

						return done(parsed, 10*60);
					} catch(e) {
						console_log(story_cache_key, result);
						console_error(story_cache_key, e);
					}

					return done(null, false);
				});
			});
		};

		var reels_webapi = function(id, cb) {
			if (!use_app_api)
				return cb(null);

			var reels_cache_key = "instagram_reels:" + id;
			api_cache.fetch(reels_cache_key, cb, function(done) {
				// id can be highlight:[highlight id]
				var url = "https://www.instagram.com/api/v1/feed/reels_media/?reel_ids="+ encodeURIComponent(id);
				web_api_call(url, function(result) {
					if (!result)
						return done(null, false);

					if (result.readyState !== 4)
						return;

					if (result.status !== 200) {
						console_log(reels_cache_key, result);
						return done(null, false);
					}

					try {
						var parsed = JSON_parse(result.responseText);

						if (!(id in parsed.reels)) {
							console_error(reels_cache_key, "Unable to find", id, "in", result);
							return done(null, false);
						}

						return done(parsed.reels[id], 10*60);
					} catch (e) {
						console_log(reels_cache_key, result);
						console_error(reels_cache_key, e);
					}

					return done(null, false);
				})
			});
		};

		var reels_api = function(id, picid, cb) {
			let cache_key = "instagram_reels:" + id;
			reels_webapi(id, function(result) {
				if (!result)
					return cb(null);

				try {
					var images = parse_story_items(result.items, picid);
					return cb(images);
				} catch (e) {
					console_error(cache_key, result);
					console_error(cache_key, e);
				}
			});
		};

		var get_all_stories_webapi = function(uid, cb) {
			if (!use_app_api)
				return cb(null);

			var story_cache_key = "instagram_story_uid:" + uid;
			api_cache.fetch(story_cache_key, cb, function (done) {
				var url = "https://i.instagram.com/api/v1/feed/user/" + uid + "/story/";
				web_api_call(url, function(result) {
					if (!result)
						return done(null, false);

					if (result.readyState !== 4)
						return;

					if (result.status !== 200) {
						console_log(story_cache_key, result);
						return done(null, false);
					}

					try {
						var parsed = JSON_parse(result.responseText);

						return done(parsed.reel, 10*60);
					} catch(e) {
						console_log(story_cache_key, result);
						console_error(story_cache_key, e);
					}

					return done(null, false);
				});
			});
		};

		var parse_story_items = function(items, picid) {
			var all_images = [];
			var our_item = null;

			for (var i = 0; i < items.length; i++) {
				var item = items[i];

				var images = get_maxsize_app(item);
				if (images.length < 1) {
					console_warn("No images found for", item);
					continue;
				}
				var image = images[0];
				all_images.push(image);

				if (image.username && image.id)
					image.page = "https://www.instagram.com/stories/" + image.username + "/" + image.id + "/";

				var item_picid = common_functions["instagram_get_imageid"](image.src);
				api_cache.set("instagram_story_pic:" + item_picid, image, 6*60*60);

				if (image.video) {
					var item_vidid = common_functions["instagram_get_imageid"](image.video);
					api_cache.set("instagram_story_pic:" + item_vidid, image, 6*60*60);
				}

				if (image.id) {
					api_cache.set("instagram_story_pic:" + image.id, image, 6*60*60);
				}

				if (picid && (item_picid === picid || item_vidid === picid || image.id === picid.replace(/_[0-9]+$/, ""))) {
					our_item = image;
				}
			}

			var album = [];
			array_foreach(all_images, function(image) {
				if (image.page) {
					album.push(image.page);
				}

				image.album_link = image.page;
				image.album = album;
			});

			if (picid) {
				if (our_item !== null)
					return our_item;
			} else {
				return all_images;
			}

			return null;
		};

		var story_api = function(picid, uid, cb) {
			var cache_key = "instagram_story_api:" + uid;

			var get_stories = function(cb) {
				get_all_stories_webapi(uid, function(result) {
					if (!result) {
						return cb(null);
					}

					try {
						var images = parse_story_items(result.items, picid);
						return cb(images);
					} catch (e) {
						console_log(cache_key, result);
						console_error(cache_key, e);
						return cb(null);
					}
				});
			};

			if (picid) {
				cache_key = "instagram_story_pic:" + picid;
				api_cache.fetch(cache_key, cb, function (done) {
					get_stories(function(result) {
						if (result) {
							return done(result, 6*60*60);
						} else {
							return done(result, false);
						}
					});
				});
			} else {
				get_stories(cb);
			}
		};

		var profile_to_url = function(profile) {
			try {
				// Try using the app's API
				return profile.hd_profile_pic_url_info.url;
			} catch (e) {
				// Try using the normal browser json
				try {
					return profile.profile_pic_url;
				} catch (e) {
					console_error(e, profile);
					return null;
				}
			}
		};

		var request_profile = function(username, cb) {
			username_to_uid(username, function(uid) {
				if (!uid) {
					return cb(null);
				}

				uid_to_profile(uid, function(profile) {
					if (!profile)
						return cb(null);

					var url = profile_to_url(profile);

					var obj = {
						url: common_functions["instagram_norm_url"](url),
						extra: {
							author_username: profile.username,
							page: "https://www.instagram.com/" + profile.username
						}
					};

					return cb(common_functions["set_cdninstagram_obj"](obj));
				});
			});

			return {
				waiting: true
			};
		};

		var parse_caption = function(caption) {
			if (typeof caption === "string")
				return caption;

			if (caption.text)
				return caption.text;

			if (caption.edges && caption.edges.length > 0)
				return caption.edges[0].node.text;

			return null;
		};

		var get_caption = function(item) {
			if (item.caption)
				return parse_caption(item.caption);

			if (item.title)
				return parse_caption(item.title);

			if (item.edge_media_to_caption)
				return parse_caption(item.edge_media_to_caption);

			return void 0;
		};

		var get_shortcode = function(item) {
			// thanks to robindz on github: https://github.com/qsniyg/maxurl/issues/983
			// shortcode was used for ajax, but new version seems to use code
			var shortcode = item.shortcode || item.code;
			return shortcode || null;
		};

		var get_page = function(item) {
			var shortcode = get_shortcode(item);
			if (!shortcode) return null;

			if (item.product_type === "igtv") {
				return shortcode_to_url("tv", shortcode);
			} else if (item.product_type === "clips") {
				return shortcode_to_url("reel", shortcode);
			} else {
				return shortcode_to_url("p", shortcode);
			}
		};

		var get_username = function(item) {
			// user = app, owner = graphql
			var user_obj = item.user || item.owner;
			if (user_obj && user_obj.username) {
				return user_obj.username;
			}

			return null;
		};

		var get_created_date = function(item) {
			if (item.date) return item.date * 1000; // *1000?
			if (item.taken_at_timestamp) return item.taken_at_timestamp * 1000; // *1000?
			if (item.created_time) return item.created_time * 1000; // *1000?
			if (item.taken_at) return item.taken_at * 1000; // story app api

			return null;
		};

		var get_id = function(item) {
			// app api & story graphql api (https://i.instagram.com/api/v1/feed/reels_media/?reel_ids=...)
			if (item.id && typeof item.id === "string") return item.id.replace(/_[0-9]+$/, "");
			if (item.pk) return item.pk.toString(); // this is inaccurate due to floating point issues

			return null;
		};

		var imageid_in_objarr = function(imageid, objarr) {
			for (var i = 0; i < objarr.length; i++) {
				if (imageid === "first")
					return objarr[i];

				if (typeof imageid === "number") {
					if (imageid === objarr[i].i) return objarr[i];
					continue;
				}

				if (string_indexof(objarr[i].src, imageid) > 0)
					return objarr[i];

				// stories
				if (objarr[i].id === imageid)
					return objarr[i];
			}

			return null;
		}

		var image_in_objarr = function(image, objarr, objarr1) {
			var imageid = image;

			if (typeof imageid === "string" && imageid !== "first")
				imageid = common_functions["instagram_get_imageid"](image);

			var largest = imageid_in_objarr(imageid, objarr);
			if (!largest)
				return null;

			var smallest = null;
			if (objarr1) {
				smallest = imageid_in_objarr(imageid, objarr1);
			}

			var retobj = {
				largest: largest
			};

			if (smallest && smallest !== largest) {
				retobj.smallest = smallest;
			}

			return retobj;
		};

		// known parts:
		//   v -- beginning of url
		//   t51.2885-15
		//   e35
		//   c118.0.688.688a -- crops the image
		var instagram_get_url_parts = function(src) {
			var parts = src.replace(/^[a-z]+:\/\/[^/]+\/+/, "").replace(/\/[^/]+(?:[?#].*)?$/, "");
			parts = parts.split(/\/+/g);

			var newparts = [];
			array_foreach(parts, function(part) {
				if (part === "v")
					return;

				if (/^e[0-9]+$/.test(part))
					return;

				if (/^t[0-9]+\./.test(part))
					return;

				newparts.push(part);
			});

			// thanks to remlap for reporting
			var queries = get_queries(src);
			if (queries && queries.stp) {
				// c0.177.1440.1440a_dst-jpg_e35_s150x150
				let transforms = queries.stp.split("_");
				array_foreach(transforms, function(part) {
					if (/^e[0-9]+$/.test(part))
						return;

					if (/^dst-/.test(part))
						return;

					array_upush(newparts, part);
				});
			}

			return newparts;
		};

		var get_maxsize_app = function(item) {
			var images = [];
			var total_images = 1;

			var get_corrected_height = function(img, candidate) {
				var corrected_height = candidate.height;
				if (!corrected_height) {
					corrected_height = (img.original_height / img.original_width) * candidate.width;
				}

				return corrected_height;
			};

			var candidates_sorter = function(a, b) {
				// thanks to robindz on github: https://github.com/qsniyg/maxurl/issues/1000
				// https://www.instagram.com/p/B7AXLsplw6Y/
				// https://www.instagram.com/p/B8BFW14Ffwz/
				if (!a.is_unprocessed || !b.is_unprocessed) {
					if (a.is_unprocessed)
						return -1;
					if (b.is_unprocessed)
						return 1;
				}

				return b.size - a.size;
			};

			var parse_image = function (img_i, img) {
				var candidates = img.image_versions2.candidates;
				var maxsize = 0;
				var maxobj = null;

				var candidate_ids = {};

				for (var i = 0; i < candidates.length; i++) {
					candidates[i].corrected_height = get_corrected_height(img, candidates[i]);
					candidates[i].is_unprocessed = instagram_get_url_parts(candidates[i].url).length === 0;
					candidates[i].image_id = common_functions["instagram_get_imageid"](candidates[i].url);
					candidates[i].size = candidates[i].width * candidates[i].corrected_height;

					if (!(candidates[i].image_id in candidate_ids))
						candidate_ids[candidates[i].image_id] = [];

					candidate_ids[candidates[i].image_id].push(candidates[i]);
				}

				var bestcandidates = [];

				for (var id in candidate_ids) {
					candidate_ids[id].sort(candidates_sorter);
					bestcandidates.push(candidate_ids[id][0]);
				}

				bestcandidates.sort(candidates_sorter);
				maxobj = bestcandidates[0];

				var image = null;
				if (maxobj !== null) {
					image = {
						src: maxobj.url,
						caption: get_caption(item),
						shortcode: get_shortcode(item),
						page: get_page(item),
						username: get_username(item),
						created: get_created_date(item),
						id: get_id(item),
						width: maxobj.width,
						height: maxobj.height,
						i: img_i + 1,
						total_images: total_images
					};
				}

				if (image && img.video_versions) {
					maxsize = 0;
					maxobj = null;
					var videos = img.video_versions;

					let video_hevc = null;

					for (var i = 0; i < videos.length; i++) {
						videos[i].corrected_height = get_corrected_height(img, videos[i]);
						var size = videos[i].width * videos[i].corrected_height;

						// 104 > 101, but 104/_ptProgressive.mp4 is HEVC
						if (string_indexof(videos[i].url, "_ptProgressive.mp4") >= 0) {
							video_hevc = videos[i];
						} else {
							// >= because for some reason, in stories, type 102==103, but higher quality than 101 (all same dimensions)
							// thanks to remlap on discord for reporting
							if (size >= maxsize) {
								maxsize = size;
								maxobj = videos[i];
							}
						}
					}

					if (maxobj !== null) {
						image.video = maxobj.url;
						image.video_width = maxobj.width;
						image.video_height = maxobj.corrected_height;
					}

					if (img.video_dash_manifest) {
						image.video_dash = img.video_dash_manifest;
					}

					if (video_hevc) {
						image.video_hevc = video_hevc.url;
					}
				}

				if (image !== null) {
					images.push(image);
				}
			};

			if ("carousel_media" in item) {
				total_images = item.carousel_media.length;

				for (var i = 0; i < item.carousel_media.length; i++) {
					parse_image(i, item.carousel_media[i]);
				}
			} else {
				total_images = 1;
				parse_image(0, item);
			}

			return images;
		};

		var get_maxsize_graphql = function(media) {
			var images = [];
			var total_images = 1;

			var parse_image = function(img_i, node) {
				var image = node.display_src;
				if (!image)
					image = node.display_url;

				var width = 0, height = 0;
				var vwidth = 0, vheight = 0;
				if (node.dimensions) {
					width = node.dimensions.width;
					height = node.dimensions.height;
				}

				if (!image)
					return;

				var found_image = image_in_objarr(image, images);
				if (found_image) {
					var found_size = found_image.largest.width * found_image.largest.height;
					var our_size = width * height;

					// fixme: why is this check even here? it breaks width=0, height=0 videos
					if (our_size <= found_size || true)
						return;
				}

				if (node.video_url) {
					// width/height corresponds to the image, not the video
					// apparently not anymore?
					// https://www.instagram.com/p/CAIJRpshE0z/ (thanks to fireattack on discord)
					// https://www.instagram.com/p/CAatETTofMK/ graphql returns 640x640 but states it to be 750x750. app api returns 720x720, but is of a lower quality than 640x640 (thanks to remlap and Regis on discord)

					//width = 0;
					//height = 0;

					// This is a terrible hack, but it works
					if (width > 640) {
						var ratio = 640. / width;
						vwidth = width * ratio;
						vheight = height * ratio;
					}
				}

				// hack to work around an issue in instagram's servers where they have null characters in their urls
				// thanks to fireattack on discord for reporting
				if (is_invalid_url(node.video_url) || is_invalid_url(image)) {
					width = 0;
					height = 0;
				}

				if (!vwidth && !vheight) {
					vwidth = width;
					vheight = height;
				}

				var vdash = null;
				if (node.dash_info && node.dash_info.video_dash_manifest)
					vdash = node.dash_info.video_dash_manifest;

				images.push({
					src: image,
					video: node.video_url,
					caption: get_caption(media),
					shortcode: get_shortcode(media),
					page: get_page(media),
					username: get_username(media),
					created: get_created_date(media),
					width: width,
					height: height,
					video_width: vwidth,
					video_height: vheight,
					video_dash: vdash,
					i: img_i + 1,
					total_images: total_images
				});
			};

			if (media.edge_sidecar_to_children) {
				var edges = media.edge_sidecar_to_children.edges;
				total_images = edges.length; // is this correct?
				for (var i = 0; i < edges.length; i++) {
					var edge = edges[i];
					if (edge.node)
						edge = edge.node;

					parse_image(i, edge);
				}
			}

			parse_image(0, media);

			return images;
		};

		var raw_image_to_obj = function(image, obj, preobj) {
			var extra = {};
			var album_info = null;
			if (image.caption) extra.caption = image.caption;
			if (image.page) extra.page = image.page;
			if (image.username) extra.author_username = image.username;
			if (image.created) extra.created_date = image.created;
			if (image.shortcode) extra.id = image.shortcode;

			if (image.album) {
				var links = [];
				album_info = {"type": "links", "links": links};

				for (var i = 0; i < image.album.length; i++) {
					links.push({
						url: image.album[i],
						is_current: image.album_link === image.album[i]
					});
				}
			} else if (image.total_images && "i" in image && !isNaN(image.i) && image.page) {
				var links = [];
				album_info = {"type": "links", "links": links};

				// stupid hack, but 1 because !0 == !image_id == null
				for (var i = 1; i < image.total_images + 1; i++) {
					links.push({
						url: image.page + "#imu-i=" + i,
						is_current: i === image.i
					});
				}
			}

			if (image.video_hevc) {
				preobj.push({
					url: common_functions["instagram_norm_url"](image.video_hevc),
					media_info: {
						type: "video",
						codec: "hevc"
					},
					extra: deepcopy(extra),
					album_info: deepcopy(album_info)
				});
			}

			if (image.video_dash) {
				var dashurl = "data:application/dash+xml," + encodeURIComponent(image.video_dash);

				preobj.push(common_functions["set_cdninstagram_obj"]({
					url: dashurl,
					video: "dash",
					extra: deepcopy(extra),
					album_info: deepcopy(album_info)
				}));
			}

			if (image.video) {
				obj.push({
					url: common_functions["instagram_norm_url"](image.video),
					video: true,
					extra: deepcopy(extra),
					album_info: deepcopy(album_info)
				});
			}

			obj.push({
				url: common_functions["instagram_norm_url"](image.src),
				extra: deepcopy(extra),
				album_info: deepcopy(album_info)
			});

			// set true to overwrite, as the cdninstagram headers are critical
			return fillobj_urls(obj, common_functions["set_cdninstagram_obj"]({}), true);
		};

		var image_meld_largest = function(image) {
			if (!image.smallest) return image;

			//console_log(image.largest, image.smallest);
			image = deepcopy(image);

			var largest = image.largest;
			var smallest = image.smallest;

			var largest_vb = largest.video_width * largest.video_height;
			var smallest_vb = smallest.video_width * smallest.video_height;

			if (smallest_vb > largest_vb) {
				var largest_url = largest.video;
				largest.video = smallest.video;
				smallest.video = largest_url;

				var largest_vw = largest.video_width, largest_vh = largest.video_height;
				largest.video_width = smallest.video_width;
				largest.video_height = smallest.video_height;
				smallest.video_width = largest_vw;
				smallest.video_height = largest_vh;
			}

			//console_log(largest, smallest);

			return {
				largest: largest,
				smallest: smallest
			};
		};

		var image_to_obj = function(image) {
			if (!image)
				return null;

			var obj = [];
			var preobj = [];

			image = image_meld_largest(image);

			// obj= is needed because of fillobj_urls in raw_image_to_obj
			obj = raw_image_to_obj(image.largest, obj, preobj);
			if (image.smallest)
				obj = raw_image_to_obj(image.smallest, obj, preobj);

			array_extend(preobj, obj);

			// TODO: maybe put videos before images?

			return preobj;
		};

		var cache_graphql_post = function(edge) {
			// disable cache for now
			// the PostPage result differs quite significantly from the ProfilePage result
			return;

			var shortcode = get_shortcode(edge);
			if (shortcode) {
				api_cache.set("graphql_ig_post:" + shortcode, edge);
			}
		};

		var fill_graphql_cache_with_postpage = function(postpage_text) {
			if (!host_is_ig || true) // June 30 2022: This doesn't work due to _sharedData not existing
				return;

			var shareddata = get_sharedData_from_resptext(postpage_text);
			if (!shareddata)
				return;

			try {
				var entry_data = shareddata.entry_data;
				if ("ProfilePage" in entry_data) {
					var edges = entry_data.ProfilePage[0].graphql.user.edge_owner_to_timeline_media.edges;
					// todo: also cache edge_felix_video_timeline to avoid requesting videos

					for (var i = 0; i < edges.length; i++) {
						var edge = edges[i].node;
						cache_graphql_post(edge);
					}
				} else if ("PostPage" in entry_data) {
					var shortcode_media = entry_data.PostPage[0];
					cache_graphql_post(shortcode_media);
				}
			} catch (e) {
				console_error(e, shareddata);
			}
		};

		var request_query_ig_post = function(url, cb) {
			query_ig(url, function(json) {
				if (!json) {
					return cb(null);
				}

				try {
					var media = json.entry_data.PostPage[0];
					return cb(media);
				} catch (e) {
					console_error(e);
				}

				return cb(null);
			});
		};

		var request_ig_post = function(url, code, cb) {
			if (!code)
				return cb(null);

			var cache_key = "graphql_ig_post:" + code;

			api_cache.fetch(cache_key, function(data) {
				if (!data)
					return cb(null);

				var needs_ig_query = false;

				if (data.__typename === "GraphVideo" && !data.video_url) {
					needs_ig_query = true;
				} else if (data.__typename === "GraphSidecar") {
					if (data.edge_sidecar_to_children && data.edge_sidecar_to_children.edges && data.edge_sidecar_to_children.edges.length > 0) {
						var edges = data.edge_sidecar_to_children.edges;

						for (var i = 0; i < edges.length; i++) {
							if (!edges[i] || !edges[i].node) {
								needs_ig_query = true;
								break;
							}

							if (edges[i].node.__typename === "GraphVideo" && !edges[i].node.video_url) {
								needs_ig_query = true;
								break;
							}
						}
					} else {
						needs_ig_query = true;
					}
				}

				if (needs_ig_query && do_request) {
					request_query_ig_post(url, function(newdata) {
						if (newdata) {
							api_cache.set(cache_key, newdata);
							data = newdata;
						}

						cb(data);
					});
				} else {
					cb(data);
				}
			}, function(done) {
				request_query_ig_post(url, function(data) {
					if (data) {
						return done(data, 60*60);
					} else {
						return done(null, false);
					}
				});
			});
		};

		var get_shortcode_to_id = function(post_url, shortcode, cb) {
			api_cache.fetch("ig_shortcode_to_id:" + shortcode, cb, function(done) {
				shortcode_to_id(shortcode, function(id) {
					if (id) {
						return done(id, 24*60*60);
					} else {
						request_ig_post(post_url, shortcode, function(media) {
							if (!media || !media.id) {
								return done(null, false);
							}

							return done(media.id, 24*60*60);
						});
					}
				});
			});
		};

		var request_post_inner = function(post_url, image_url, cb) {
			var shortcode = url_to_shortcode(post_url);

			get_shortcode_to_id(post_url, shortcode, function(media_id) {
				if (!media_id) {
					return cb(null);
				}

				try {
					//media.id + "_" + media.owner.id
					mediainfo_api(media_id, function(app_response) {
						var images = [];
						var images_small = [];

						var images_app = [];
						var images_graphql = [];

						var need_graphql = false; //!dont_use_web; // June 30 2022: Currently needed to avoid _sharedData queries

						if (app_response !== null) {
							images_app = get_maxsize_app(app_response.items[0]);
						} else {
							if (use_app_api) {
								console_warn("Unable to use API to find Instagram image, you may need to login to Instagram");
							}

							need_graphql = true;
						}

						var final = function() {
							if (_nir_debug_) {
								console_log("images_app", images_app);
								console_log("images_graphql", images_graphql);
							}

							if (!images_app || !images_app.length)
								images_app = null;

							if (!images_graphql || !images_graphql.length)
								images_graphql = null;

							if (!images_app && !images_graphql) {
								return cb(null);
							}

							var final2 = function() {
								if (_nir_debug_) {
									console_log("images_small", deepcopy(images_small));
									console_log("images", deepcopy(images), image_url);
								}

								if (image_url) {
									var image = image_in_objarr(image_url, images, images_small);
									if (image) {
										return cb(image_to_obj(image));
									} else {
										console_error("Unable to find", image_url, "in", deepcopy(images), deepcopy(images_small));
									}
								} else {
									return cb(images);
								}

								cb(null);
							};

							if (images_app && images_graphql && images_app.length === images_graphql.length) {
								var processed = 0;
								var total = 0;

								for (var i = 0; i < images_app.length; i++) {
									var app_size = images_app[i].width * images_app[i].height;
									var graphql_size = images_graphql[i].width * images_graphql[i].height;

									if (graphql_size > app_size) {
										//console_log("Using graphql image", images[i], images_graphql[i]);
										images[i] = images_graphql[i];
										images_small[i] = images_app[i];
									} else {
										images[i] = images_app[i];
										images_small[i] = images_graphql[i];
									}

									// sometimes videos have higher quality for graphql, even though it's smaller (640 vs 720)
									// relevant issue: https://github.com/qsniyg/maxurl/issues/547
									(function(i) {
										if (!prefer_video_quality || !images_app[i].video) return;

										total++;
										common_functions["find_actual_largest_image"](images[i].video, [
											images[i].video,
											images_small[i].video
										], function(url) {
											processed++;

											// awful hack
											if (url === images[i].video) {
												images[i].video_width = 10000;
												images[i].video_height = 10000;
											} else if (url === images_small[i].video) {
												images_small[i].video_width = 10000;
												images_small[i].video_height = 10000;
											}

											if (processed >= total) {
												// run_soon, because find_actual_largest_image might use cached values, therefore running final2 before images/images_small has been filled
												// thanks to Speedy on discord for reporting
												run_soon(final2);
											}
										}, {
											check_length: true,
											api_cache: api_cache,
											do_request: do_request
										});
									})(i);
								}

								if (total) {
									return;
								}
							} else {
								if (images_app) {
									images = images_app;
									images_small = images_graphql;
								} else {
									images = images_graphql;
									images_small = images_app;
								}
							}

							final2();
						};

						if (need_graphql) {
							request_ig_post(post_url, shortcode, function(media) {
								if (media) {
									//images_graphql = get_maxsize_graphql(media);
									images_graphql = get_maxsize_app(media);
								}

								final();
							});
						} else {
							final();
						}
					});
				} catch (e) {
					console_error(e);
					cb(null);
				}
			});

			return {
				waiting: true
			};
		};

		var request_post = function(post_url, image_url, cb) {
			if (typeof document !== "undefined")
				fill_graphql_cache_with_postpage(document.documentElement.innerHTML);

			return request_post_inner(post_url, image_url, cb);
		};

		var request_stories = function(url, image_url, cb, all) {
			var username = url.replace(/.*\/stories\/+([^/]*).*$/, "$1");
			if (username === url)
				return null;

			var result_cb = function(uid) {
				var image_id = common_functions["instagram_get_imageid"](image_url);
				var story_id = null;

				if (url) {
					let _storyid = url.replace(/.*\/stories\/+[^/]+\/+([0-9]+)\/*(?:[?#].*)?$/, "$1");
					if (_storyid !== url)
						story_id = _storyid;
				}

				var story_result_cb = function(result) {
					if (!result) {
						return cb(null);
					}

					var images = result;
					if (!is_array(images))
						images = [images];

					if (image_id && image_url) {
						var image = image_in_objarr(image_url, images);
						if (!image) {
							console_warn("Unable to find", image_url, "in", deepcopy(images));
							return cb(null);
						}

						var obj = image_to_obj(image);
						return cb(obj);
					} else {
						return cb(images);
					}
				};

				if (uid === "highlight") {
					if (story_id)
						reels_api("highlight:" + story_id, image_id, story_result_cb);
					else
						console_error("Unable to find story_id");
				} else {
					if (!image_id && story_id)
						image_id = story_id;
					story_api(image_id, uid, story_result_cb);
				}
			};

			if (username === "highlights") {
				result_cb("highlight");
			} else {
				username_to_uid(username, function(uid) {
					if (!uid) {
						return cb(null);
					}

					result_cb(uid);
				});
			}

			return {
				waiting: true
			};
		};

		var parse_single_el_info = function(info, cb) {
			var retval;

			if (info.type === "post") {
				if (info.all)
					info.image = null;

				retval = request_post(info.url, info.image, cb);
				if (retval)
					return retval;
			} else if (info.type === "profile") {
				retval = request_profile(info.url, cb);
				if (retval)
					return retval;
			} else if (info.type === "story") {
				if (info.all)
					info.image = null;

				retval = request_stories(info.url, info.image, cb);
				if (retval)
					return retval;
			}

			return retval;
		};

		var parse_el_info = function(info, cb) {
			var retval;

			for (var i = 0; i < info.length; i++) {
				retval = parse_single_el_info(info[i], cb);
				if (retval)
					return retval;
			}

			return retval;
		};

		return parse_el_info(info, cb);
	};

	common_functions["instagram_get_el_for_imageid"] = function(element) {
		var newel = element;
		if (newel.tagName === "SOURCE") {
			newel = newel.parentElement;
		}

		if (newel.tagName === "VIDEO" && newel.parentElement) {
			try {
				newel = newel.parentElement.querySelectorAll("img[srcset]");
				if (!newel || newel.length === 0)
					newel = element;
				else
					newel = newel[0];
			} catch (e) {
				console_error(e);
				newel = element;
			}
		} else {
			newel = element;
		}

		return newel;
	};

	common_functions["instagram_get_image_src_from_el"] = function(el) {
		// try image id from gallery helper
		if (el.hasAttribute("data-imu-data")) {
			try {
				var json = JSON_parse(el.getAttribute("data-imu-data"));
				if (json.src) return json.src;
			} catch (e) {
				console_error(e);
			}
		}

		if (el.tagName === "VIDEO") {
			// use the poster instead as the larger video urls differ
			return el.poster || el.currentSrc || el.src;
		} else if (el.tagName === "IMG") {
			return el.src;
		} else if (el.tagName === "DIV") {
			return el.style.backgroundImage.replace(/^url\(["'](.*)["']\)$/, "$1");
		} else if (el.tagName === "SOURCE") {
			if (el.parentElement) {
				var newsrc = common_functions["instagram_get_image_src_from_el"](el.parentElement);
				if (newsrc) return newsrc;
			}

			return el.src;
		}

		console_error("Unable to find source for", el);
		return;
	}

	common_functions["instagram_find_el_info"] = function(document, element, host_url) {
		var possible_infos = [];

		var element_src = common_functions["instagram_get_image_src_from_el"](element);

		if (element.hasAttribute("data-imu-info")) {
			try {
				var json = JSON_parse(element.getAttribute("data-imu-info"));
				for (var i = 0; i < json.length; i++) {
					json[i].element = element;

					if (!json[i].image)
						json[i].image = element_src;

					delete json[i].all;
				}

				return json;
			} catch (e) {
				console_error("Unable to parse data-imu-info for", element);
			}
		}

		// check for links first
		var current = element;
		while ((current = current.parentElement)) {
			if (current.tagName !== "A")
				continue;

			if (current.href.match(/:\/\/[^/]+\/+(?:[^/]+\/+)?(?:p|tv|reel)\//)) {
				// link to post
				possible_infos.push({
					type: "post",
					subtype: "link",
					url: current.href,
					image: element_src,
					element: current
				});
			} else if (current.href.match(/:\/\/[^/]+\/+[^/]+(?:\/+(?:[?#].*)?)?$/)) {
				// link to profile (e.g. for someone who comments on a post)
				possible_infos.push({
					type: "profile",
					subtype: "link",
					url: current.href,
					element: current
				});
			}
		}

		current = element;
		while ((current = current.parentElement)) {
			// profile image
			// a better way would be to check the username from the h2 > a (title, href, innerText)
			if (current.tagName === "HEADER") {
				var sharedData = null;

				// Still keep this code because this way we can know it exists?
				// We can't use this directly because the user might have switched the profile they're currently viewing
				// Jun 29 2022: Disabling because _sharedData no longer exists
				if (false) {
					var scripts = document.getElementsByTagName("script");
					for (var i = 0; i < scripts.length; i++) {
						if (scripts[i].innerText.match(/^ *window\._sharedData/)) {
							sharedData = scripts[i].innerText.replace(/^ *window\._sharedData *= *({.*}) *;.*?/, "$1");
						}
					}

					if (!sharedData) {
						console_error("Shared data not found");
						continue;
					} else {
						sharedData = JSON_parse(sharedData);
					}
				}

				var url = host_url;
				if (url.match(/:\/\/[^/]+\/+p\//)) {
					var username;

					if (element.parentElement.tagName === "SPAN" && element.parentElement.getAttribute("role") === "link") {
						var as = current.getElementsByTagName("a");
						for (var i = 0; i < as.length; i++) {
							var a = as[i];
							var amatch = a.href.match(/^[a-z]+:\/\/[^/]+\/+([^/]+)\/*(?:[?#].*)?$/);
							if (amatch) {
								if (strip_whitespace(a.innerText).toLowerCase() === amatch[1].toLowerCase()) {
									username = strip_whitespace(a.innerText).toLowerCase();
									break;
								}
							}
						}
					}

					if (!username) {
						try {
							var h2 = current.querySelector("h2 > a");
							if (strip_whitespace(h2.innerText) === strip_whitespace(h2.title)) {
								username = h2.innerText;
							}
						} catch (e) {}
					}

					if (!username) {
						try {
							// There are 2 h1's, the first should be the username (the second is the person's "name")
							username = current.querySelector("section h1").innerText;
						} catch (e) {
							console_error(e);
						}
					}

					if (username) {
						url = "https://www.instagram.com/" + strip_whitespace(username);//common_functions["instagram_username_from_sharedData"](sharedData);
					} else {
						url = null;
					}
				}

				if (url) {
					possible_infos.push({
						type: "profile",
						subtype: "page",
						url: url,
						element: current
					});
				}
			}

			// popup
			if ((current.tagName === "DIV" && current.getAttribute("role") === "dialog") ||
				// post page
				(current.tagName === "BODY" && host_url.match(/:\/\/[^/]*\/+(?:[^/]+\/+)?(?:p|tv|reel)\//))) {
				possible_infos.push({
					type: "post",
					subtype: current.tagName === "BODY" ? "page" : "popup",
					url: host_url,
					image: element_src,
					element: current
				});
			}

			// home
			if (current.tagName === "ARTICLE" && host_url.match(/:\/\/[^/]+\/+(?:[?#].*)?$/)) {
				var timeel = current.querySelector("a > time");
				if (!timeel)
					timeel = current.querySelector("a > div > time");
				if (timeel) {
					var linkel = timeel.parentElement;
					if (linkel.tagName !== "A")
						linkel = linkel.parentElement;

					var href = linkel.href;
					if (/:\/\/[^/]*\/+(?:[^/]+\/+)?p\//.test(href)) {
						possible_infos.push({
							type: "post",
							subtype: "home",
							url: href,
							image: element_src,
							element: current
						});
					}
				}
			}

			// stories
			// https://www.instagram.com/stories/hollyearl__/2271839116690161119/
			if (current.tagName === "BODY" && host_url.match(/:\/\/[^/]*\/+stories\/+([^/]*)(?:\/+[0-9]+)?\/*(?:[?#].*)?$/)) {
				// try to find image instead of video because video ids change for app stories
				var newel = common_functions["instagram_get_el_for_imageid"](element);

				possible_infos.push({
					type: "story",
					url: host_url,
					image: common_functions["instagram_get_image_src_from_el"](newel),
					element: current
				});
			}
		}

		return possible_infos;
	};

	common_functions["twitter_normalize_status_link"] = function(link) {
		var match = link.match(/\/status\/+([0-9]+)(?:\/+(?:retweets|likes|photo|video)(?:\/+.*)?|\/*)(?:[?#].*)?$/);
		if (match) {
			return link.replace(/(\/status\/+[0-9]+)\/*.*(?:[?#].*)?$/, "$1");
		}

		return null;
	};

	common_functions["get_twitter_tweet_link"] = function(el) {
		var currentel = el;
		while ((currentel = currentel.parentElement)) {
			if (currentel.tagName === "A") {
				var norm = common_functions["twitter_normalize_status_link"](currentel.href);
				if (norm) return norm;
			}

			if (currentel.tagName === "ARTICLE") {
				var our_as = currentel.querySelectorAll("a[role='link']");
				for (var i = 0; i < our_as.length; i++) {
					var our_href = our_as[i].href;
					if (!our_href)
						continue;

					var norm = common_functions["twitter_normalize_status_link"](our_href);
					if (norm) return norm;
				}
				break;
			}
		}

		return null;
	};

	common_functions["get_twitter_caption"] = function(el) {
		var currentel = el;
		while ((currentel = currentel.parentElement)) {
			if (currentel.tagName === "ARTICLE") {
				var captiondiv = currentel.querySelectorAll("div[lang]");
				if (captiondiv && captiondiv.length === 1) {
					return captiondiv[0].innerText;
				}

				break;
			}
		}

		return null;
	};

	common_functions["get_twitter_video_tweet"] = function(el, window) {
		if (el.tagName !== "VIDEO" || !el.src.match(/^blob:/))
			return null;

		var poster = el.poster;
		if (!poster)
			return null;

		// note that the numbers here corresponds to the media id, not the tweet id, so it can't be used
		if (!/\/ext_tw_video_thumb\/+[0-9]+\/+pu\/+img\//.test(poster))
			return null;

		var href = window.location.href;

		// embedded video
		var match = href.match(/\/i\/+videos\/+tweet\/+([0-9]+)(?:[?#].*)?$/);
		if (match) {
			return {
				id: match[1]
			};
		}

		var currentel = el;
		while ((currentel = currentel.parentElement)) {
			if (currentel.tagName === "ARTICLE") {
				var our_as = currentel.querySelectorAll("a[role='link']");
				for (var i = 0; i < our_as.length; i++) {
					var our_href = our_as[i].href;
					if (!our_href)
						continue;

					var match = our_href.match(/\/status\/+([0-9]+)(?:\/+(?:retweets|likes)|\/*)(?:[?#].*)?$/);
					if (match) {
						return {
							id: match[1]
						};
					}
				}
				break;
			}
		}

		return null;
	};

	common_functions["get_snapchat_story"] = function(api_cache, do_request, username, cb) {
		var cache_key = "snapchat_story:" + username;
		api_cache.fetch(cache_key, cb, function(done) {
			do_request({
				method: "GET",
				url: "https://search.snapchat.com/lookupStory?id=" + username,
				headers: {
					"sec-fetch-dest": "empty",
					"sec-fetch-mode": "cors",
					"sec-fetch-site": "same-site",
					"Origin": "https://www.snapchat.com",
					"Referer": "https://www.snapchat.com/add/" + username // maybe use real url instead?
				},
				onload: function(resp) {
					if (resp.readyState !== 4)
						return;

					if (resp.status !== 200) {
						console_error(resp);
						return done(null, false);
					}

					try {
						var json = JSON_parse(resp.responseText);
						return done(json, 60); // story can change, so 60 seconds? or less?
					} catch (e) {
						console_error(e, resp);
						return done(null, false);
					}
				}
			});
		});
	};

	common_functions["get_snapchat_storysharing"] = function(api_cache, do_request, username, cb) {
		var cache_key = "snapchat_storysharing:" + username;
		api_cache.fetch(cache_key, cb, function(done) {
			do_request({
				method: "GET",
				url: "https://storysharing.snapchat.com/v1/fetch/" + username + "?request_origin=ORIGIN_WEB_PLAYER",
				headers: {
					"sec-fetch-dest": "empty",
					"sec-fetch-mode": "cors",
					"sec-fetch-site": "same-site",
					"Origin": "https://www.snapchat.com",
					"Referer": "https://www.snapchat.com/add/" + username // maybe use real url instead?
				},
				onload: function(resp) {
					if (resp.readyState !== 4)
						return;

					if (resp.status !== 200) {
						console_error(resp);
						return done(null, false);
					}

					try {
						var json = JSON_parse(resp.responseText);
						var story = json.story;
						return done(story, 60); // story can change, so 60 seconds? or less?
					} catch (e) {
						console_error(e, resp);
						return done(null, false);
					}
				}
			});
		});
	};

	common_functions["snap_norm_obj"] = function(obj) {
		// ids are not very human-readable, maybe add an option?
		var match = obj.url.match(/:\/\/[^/]+\/+[0-9a-f]{2}\/+([^/]{10,})\//);
		if (match) {
			// = causes issues with ffmpeg (thanks to remlap on discord for reporting), - can cause issues with command-line args
			obj.filename = match[1].replace(/[-=]/g, "");
		}

		return obj;
	};

	common_functions["snap_to_obj"] = function(snap) {
		var caption = null;

		// Apparently this isn't related to the caption?
		if (false) {
			caption = snap.snapTitle + snap.snapSubtitles;
			caption = caption.replace(/^\s*([\s\S]*)\s*$/, "$1");
		}

		var obj = {
			url: snap.media.mediaUrl,//snap.snapUrls.mediaUrl,
			extra: {
				caption: caption || null
			},
			need_blob: true
		};

		common_functions["snap_norm_obj"](obj);

		return obj;
	};

	common_functions["get_snapchat_info_from_el"] = function(el) {
		if (el.getAttribute("data-imu")) {
			return {
				username: el.getAttribute("data-username"),
				pos: parse_int(el.getAttribute("data-pos")),
				url: el.getAttribute("data-url")
			};
		}

		if (el.tagName !== "VIDEO" && el.tagName !== "IMG") {
			// <div class="css-crr1df" style="background-image: url(&quot;blob:https://www.snapchat.com/...&quot;);"></div>
			if (el.tagName !== "DIV" || !el.style.backgroundImage || el.style.backgroundImage.indexOf("blob:") < 0) {
				return null;
			}
		}

		var current = el;
		while ((current = current.parentElement)) {
			// new layout
			if (current.tagName === "DIV" && current.getAttribute("data-test") === "storyWebPlayer") {
				// check, because otherwise it could be profile pic or an svg
				if (!/:\/\/s\.sc-cdn\.net\//.test(el.src))
					continue;

				var username_a = current.querySelector('a[data-test="userName"]');
				if (!username_a) {
					console_error("Unable to find username element");
					continue;
				}

				return {
					username: strip_whitespace(username_a.innerText),
					pos: 0 // fixme?
				};
			}

			// old layout
			if (current.tagName === "DIV" && current.getAttribute("role") === "presentation") {
				var username = "";

				var as = current.getElementsByTagName("a");
				for (var i = 0; i < as.length; i++) {
					var match = as[i].href.match(/^[a-z]+:\/\/story\.snapchat\.com\/+s\/+([^/?#]+)(?:[?#].*)?$/);
					if (match) {
						username = match[1];
						break;
					}
				}

				var pos = 0;

				var prevbutton = current.querySelector("#PrevButton");
				if (prevbutton) {
					pos = 1;
				}

				var nextbutton = current.querySelector("#NextButton");
				if (!nextbutton) {
					pos = -1;
				}

				return {
					username: username,
					pos: pos
				};
			}
		}

		return null;
	};

	common_functions["get_obj_from_snap_info"] = function(api_cache, do_request, info, cb) {
		if (!info) {
			return cb(null);
		}

		common_functions["get_snapchat_storysharing"](api_cache, do_request, info.username, function(data) {
			if (!data) {
				return cb(null);
			}

			if (info.pos === -1) {
				info.pos = data.snaps.length - 1;//data.snapList.length - 1;
			}

			return cb(common_functions["snap_to_obj"](data./*snapList*/snaps[info.pos]));
		});
	};

	common_functions["get_md5"] = function(options, text, cb) {
		get_library("cryptojs_aes", options, options.do_request, function(CryptoJS) {
			if (!CryptoJS) {
				console_error("Unable to fetch CryptoJS");
				return cb(null);
			}

			try {
				return cb(CryptoJS.MD5(text).toString());
			} catch (e) {
				console_error(e);
				return cb(null);
			}
		});
	};

	common_functions["get_tiktok_urlvidid"] = function(url) {
		var match = url.match(/^[a-z]+:\/\/[^/]+\/+(?:[0-9a-f]{32}\/+[0-9a-f]{8}\/+)?video\/+(?:[^/]+\/+)?[^/]+\/+[^/]+\/+([0-9a-f]{32})\/*\?/);
		if (match)
			return match[1];

		return null;
	};

	common_functions["set_tiktok_vid_filename"] = function(obj) {
		var vidid = common_functions["get_tiktok_urlvidid"](obj.url);
		if (vidid) {
			obj.filename = vidid + ".mp4"; // hack, but needed because firefox etc. doesn't automatically set the extension, because content-type isn't set
			return true;
		}

		return false;
	};

	common_functions["get_tiktok_weburl_parts"] = function(url) {
		var match = url.match(/^[a-z]+:\/\/[^/]+\/+@([^/]*)\/+video\/+([0-9]+)(?:[?#].*)?$/);
		if (!match) {
			return null;
		}

		return {
			username: match[1],
			web_vid: match[2]
		};
	};

	common_functions["get_tiktok_from_ttloader"] = function(site, api_cache, do_request, url, cb) {
		// https://codecanyon.net/item/tiktok-video-downloader-wordpress-plugin/26370715
		// returns hd (720p)
		// ttloader.com, onlinetik.com, demo.wppress.net, tiktokdownloader.in, savevideo.ninja
		// uses older versions (watermarked):
		// tiktoktoolstation.com (video.src)
		var cache_key = site + ":" + url;
		site = site.replace(/:.*/, "");
		real_api_query(api_cache, do_request, cache_key, {
			url: "https://" + site + "/wp-json/wppress/tiktok-downloader/videos?search=" + encodeURIComponent(url) + "&type=video_url&max=0",
			headers: {
				Referer: "https://" + site + "/?tiktok-search=" + encodeURIComponent(url),
				"X-Requested-With": "XMLHttpRequest",
				"Sec-Fetch-Dest": "empty",
				"Sec-Fetch-Mode": "cors",
				"Sec-Fetch-Site": "same-origin",
				"Accept": "application/json, text/javascript, */*; q=0.01"
			},
			json: true
		}, cb, function(done, resp, cache_key) {
			var nowm = resp.items[0].video.noWatermark;
			if (!nowm) {
				console_error(cache_key, "Unable to find noWatermark from", resp);
				return done(null, false);
			}

			return done(nowm, 60*60);
		});
	};

	common_functions["get_tiktok_from_ttloader_token"] = function(site, api_cache, do_request, url, cb, options) {
		url = url.replace(/\?.*/, "");

		var cache_key = site + ":" + url;
		site = site.replace(/:.*/, "");

		var referer = "https://" + site + "/?tiktok-search=" + encodeURIComponent(url);
		if (site === "savevideo.ninja")
			referer = "https://" + site + "/tiktok-no-watermark-video-downloader/?tiktok-search=" + encodeURIComponent(url);

		var get_raw_token = function(cb) {
			real_api_query(api_cache, do_request, site + ":token", {
				method: "POST",
				url: "https://" + site + "/wp-json/wppress/tiktok-downloader/token",
				imu_mode: "xhr",
				data: "",
				headers: {
					Origin: "https://" + site,
					Referer: referer,
					"x-requested-with": "XMLHttpRequest"
				},
				json: true
			}, cb, function(done, resp, cache_key) {
				if (resp.token)
					return done(resp.token, 60*60);

				console_error(cache_key, "Unable to find token from", resp);
				return done(null, false);
			});
		};

		var parse_raw_token = function(raw_token, url, requesttype, useragent, cb) {
			var urladd = "";
			if (requesttype === "videos")
				urladd = "0";

			var catted = raw_token + ":" + url + urladd + ":" + useragent;
			var encoded = unescape(encodeURIComponent(catted));

			//console_log(encoded);
			common_functions.get_md5(options, encoded, cb);
		};

		var get_video_api = function(token, url, cb) {
			real_api_query(api_cache, do_request, cache_key, {
				method: "POST",
				url: "https://" + site + "/wp-json/wppress/tiktok-downloader/videos",
				data: "search=" + encodeURIComponent(url) + "&type=video_url&max=0&token=" + token,
				imu_mode: "xhr",
				headers: {
					Referer: referer,
					"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
					"x-requested-with": "XMLHttpRequest"
				},
				json: true
			}, cb, function(done, resp, cache_key) {
				var nowm = resp.items[0].video.noWatermark;
				if (!nowm) {
					console_warn(cache_key, "Unable to find noWatermark from", resp);

					if (false) {
						nowm = resp.items[0].video.playAddr;
						if (!nowm) {
							console_error(cache_key, "Unable to find downloadAddr from", resp);
							return done(null, false);
						}
					} else {
						return done(null, false);
					}
				}

				return done(nowm, 60*60);
			});
		};

		var get_nowatermark_videourl = function(token:string, url:string) {
			var url = "https://" + site + "/wp-admin/admin-ajax.php?action=wppress_tt_download&url=" + encodeURIComponent(url) + "&key=no-watermark&token=" + token;
			return {
				url: url,
				headers: {
					Referer: "https://" + site + "/?tiktok-search=" + encodeURIComponent(url),
					Accept: "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
					"Sec-Fetch-Dest": "document",
					"Sec-Fetch-Mode": "navigate",
					"Sec-Fetch-Site": "same-origin",
					"Sec-Fetch-User": "?1"
				},
				cookie_url: "https://" + site + "/",
				// linked to user-agent
				is_private: true
			};
		};

		get_raw_token(function(raw_token) {
			if (!raw_token)
				return cb(null);

			if (false) {
				parse_raw_token(raw_token, url, "videos", navigator.userAgent, function(token) {
					if (!token)
						return cb(null);

					//console_log(token);
					get_video_api(token, url, cb);
				});
			} else {
				parse_raw_token(raw_token, url, "nowatermark", navigator.userAgent, function(token) {
					if (!token)
						return cb(null);

					return cb(get_nowatermark_videourl(token, url));
				});
			}
		});
	};

	common_functions["get_tiktok_from_socialvideodownloader"] = function(site, api_cache, do_request, url, cb) {
		// https://codecanyon.net/item/social-video-downloader-wordpress-plugin/26563734?s_rank=3
		// https://demo.wppress.net/social-video-downloader/
		// hd:
		// savevideo.ninja (thanks to remlap on discord)
		var cache_key = site + ":" + url;
		site = site.replace(/:.*/, "");
		real_api_query(api_cache, do_request, cache_key, {
			url: "https://" + site + "/wp-json/wppress/video-downloader/videos?url=" + encodeURIComponent(url),
			headers: {
				Referer: "https://" + site + "/",
				"Sec-Fetch-Dest": "empty",
				"Sec-Fetch-Mode": "cors",
				"Sec-Fetch-Site": "same-origin",
				"Accept": "application/json, text/javascript, */*"
			},
			json: true
		}, cb, function(done, resp, cache_key) {
			var urls = resp[0].urls;
			var ids = {};
			for (var i = 0; i < urls.length; i++) {
				ids[urls[i].id] = urls[i];
			}

			if (!("vid-no-watermark" in ids)) {
				console_error(cache_key, "Unable to find vid-no-watermark in", {ids: ids, resp: resp});
				return done(null, false);
			}

			return done(ids["vid-no-watermark"]["src"], 60*60);
		});
	};

	common_functions["get_tiktok_from_keeptiktok"] = function(site, api_cache, do_request, url, cb) {
		var urlparts = common_functions["get_tiktok_weburl_parts"](url);
		if (!urlparts) {
			console_error("Invalid url", url);
			return cb(null);
		}

		var cache_key = site + ":" + url;
		real_api_query(api_cache, do_request, cache_key, {
			url: "https://" + site + "/" + urlparts.username.replace(/\..*/, "") + "/" + urlparts.web_vid
		}, cb, function(done, resp, cache_key) {
			var match = resp.responseText.match(/<video[^>]+>\s*<source src="(https?:\/\/[^/]*(?:tiktok|bytei)cdn\.[^"]+)"/);
			if (!match) {
				console_error(cache_key, "Unable to find match for", resp);
				return done(null, false);
			}

			return done(decode_entities(match[1]), 60*60);
		});
	};

	common_functions["get_tiktok_from_snaptik"] = function(site, api_cache, do_request, url, cb) {
		var urlparts = common_functions["get_tiktok_weburl_parts"](url);
		if (!urlparts) {
			console_error("Invalid url", url);
			return cb(null);
		}

		var query_snaptik_1 = function(url) {
			url = url.replace(/[?#].*/, "");
			var cache_key = site + ":" + url;
			api_cache.fetch(cache_key, cb, function(done) {
				// first query is to populate the cookies
				do_request({
					url: "https://snaptik.app/", //pre_download.php?aweme_id=" + urlparts.web_vid,
					imu_mode: "document",
					method: "GET",
					onload: function(resp) {
						if (resp.status !== 200) {
							console_error(cache_key, resp);
							return done(null, false);
						}

						// this query is needed for the third to work
						do_request({
							method: "POST",
							url: "https://snaptik.app/check_user.php",
							imu_mode: "xhr",
							headers: {
								Referer: "https://" + site + "/"
							},
							imu_multipart: {},
							onload: function(resp) {
								if (resp.status !== 200) {
									console_error(cache_key, resp);
									return done(null, false);
								}

								do_request({
									method: "POST",
									url: "https://" + site + "/action-v9.php",
									imu_mode: "xhr",
									imu_multipart: {
										url: url
									},
									headers: {
										Referer: "https://snaptik.app/", //pre_download.php?aweme_id=" + urlparts.web_vid,
									},
									onload: function(resp) {
										if (resp.status !== 200) {
											console_error(cache_key, resp);
											return done(null, false)
										}

										var match = resp.responseText.match(/<a[^>]*\s+href=["']https?:\/\/sv[0-9]*\.snaptik.app\/+dl\.php\?token=([^&]+)/);
										if (!match) {
											console_error(cache_key, "Unable to find match for", resp);
											return done(null, false);
										}

										return done(base64_decode(decodeURIComponent(decode_entities(match[1]))), 60*60);
									}
								});
							}
						});
					}
				});
			});
		};

		var query_snaptik_2 = function(url) {
			url = url.replace(/[?#].*/, "");
			var cache_key = site + ":" + url;
			api_cache.fetch(cache_key, cb, function(done) {
				// first query is to populate the cookies
				do_request({
					url: "https://snaptik.app/",
					imu_mode: "document",
					method: "GET",
					onload: function(resp) {
						if (resp.status !== 200) {
							console_error(cache_key, resp);
							return done(null, false);
						}

						do_request({
							method: "POST",
							url: "https://" + site + "/action.php",
							imu_mode: "xhr",
							imu_multipart: {
								url: url
							},
							headers: {
								Origin: "https://snaptik.app",
								Referer: "https://snaptik.app/"
							},
							onload: function(resp) {
								if (resp.status !== 200) {
									console_error(cache_key, resp);
									return done(null, false)
								}

								var match = resp.responseText.match(/<a[^>]*\s+href=["'](?:https?:\/\/(?:(?:sv|cdn)[0-9]*\.)?(?:snaptik\.app|snapsave\.info))?\/+dl\.php\?token=([^&'"]+)/);
								if (!match) {
									console_error(cache_key, "Unable to find match for", resp);
									return done(null, false);
								}
								var x = decodeURIComponent(decode_entities(match[1])).replace(/^s|s$/g, "");
								var splitted = x.split("/");
								array_foreach(splitted, function(x, i) {
									splitted[i] = base64_decode(x);
								});


								var newsrc = splitted.join("?");
								done({
									url: newsrc,
									cookie_url: "https://" + site + "/"
								}, 60*60);
							}
						});
					}
				});
			});
		};

		//query_snaptik_1(url);
		query_snaptik_2(url);
	};

	common_functions["get_tiktok_from_musicallydown"] = function(site, api_cache, do_request, url, cb) {
		var get_token_data = function(cb) {
			// using real_api_query even if we don't cache because it's just less code than do_request
			real_api_query(api_cache, do_request, "musicallydown:vtoken", {
				url: "https://musicallydown.com"
			}, cb, function(done, resp, cache_key) {
				var match = resp.responseText.match(/<input name="(_[a-zA-Z0-9]+)" type="hidden" value="([0-9a-f]{5,})"\s*\/>/);
				if (!match) {
					console_error(cache_key, "Unable to find token from", resp);
					return done(null, false);
				}

				var obj = {
					token_name: match[1],
					token_value: match[2]
				};

				match = resp.responseText.match(/<input name="(_?[a-zA-Z0-9]+)" type="text"[^/>]+id="link_url"/);
				if (!match) {
					console_error(cache_key, "Unable to find link name from", resp);
					return done(null, false);
				}

				obj.link_name = match[1];

				return done(obj, false);
			});
		};

		var query_musicallydown = function(url, token, cb) {
			var cache_key = site + ":" + url;
			real_api_query(api_cache, do_request, cache_key, {
				url: "https://musicallydown.com/download",
				method: "POST",
				imu_mode: "document",
				headers: {
					"Content-Type": "application/x-www-form-urlencoded",
					"Origin": "https://musicallydown.com",
					"Referer": "https://musicallydown.com/",
				},
				data: token.link_name + "=" + encodeURIComponent(url) + "&" + token.token_name + "=" + token.token_value + "&verify=1"
			}, cb, function(done, resp, cache_key) {
				var match = resp.responseText.match(/<a\s+(?:style="[^"]+"\s+)?target="_blank" rel="noreferrer" href="(https?:\/\/[^/]*tiktokcdn\.com\/[^"]+)"[^>]*>\s*<i[^>]*>[^<]*<\/i>\s*Download MP4/);
				if (!match) {
					console_error(cache_key, "Unable to find match from", resp);
					return done(null, false);
				}

				return done(decode_entities(match[1]), 60*60);
			});
		};

		get_token_data(function(token) {
			if (!token)
				return cb(null);

			query_musicallydown(url, token, cb);
		});
	};

	common_functions["get_tiktok_from_ssstiktok"] = function(site, api_cache, do_request, url, cb) {
		var get_token = function(cb) {
			real_api_query(api_cache, do_request, "ssstiktok:token", {
				url: "https://ssstik.io"
			}, cb, function(done, resp, cache_key) {
				var match = resp.responseText.match(/<form.*?data-hx-post=".*?>/);
				if (!match) {
					console_error(cache_key, "Unable to find match from", resp);
					return done(null, false);
				}

				var parsed = parse_tag_def(match[0]);
				var url = urljoin("https://ssstik.io/", parsed.args["data-hx-post"], true);

				try {
					var include_vals = JSON_parse(fixup_js_obj("{" + parsed.args["include-vals"] + "}"));
				} catch (e) {
					console_error(cache_key, e);
					return done(null, false);
				}

				match = resp.responseText.match(/<input id="locale".*?>/);
				if (!match) {
					console_error(cache_key, "Unable to find locale", resp);
					return done(null, false);
				}

				parsed = parse_tag_def(match[0]);
				include_vals.locale = parsed.args.value;

				return done({
					url: url,
					queries: include_vals
				}, false);
			});
		};

		var query_ssstiktok = function(url, token, cb) {
			var cache_key = site + ":" + url;
			token.queries.id = encodeURIComponent(url);
			real_api_query(api_cache, do_request, cache_key, {
				url: token.url,
				method: "POST",
				imu_mode: "xhr",
				headers: {
					"HX-Active-Element": "submit",
					"HX-Current-URL": "https://ssstik.io/",
					"HX-Request": "true",
					"HX-Target": "target",
					"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
				},
				data: stringify_queries(token.queries)
			}, cb, function(done, resp, cache_key) {
				var match = resp.responseText.match(/<a href="(https?:\/\/[^/]*tiktokcdn\.com\/[^"]+)"[^>]*>Without watermark/);
				if (!match) {
					console_error(cache_key, "Unable to find match for", resp);
					return done(null, false);
				}

				return done(decode_entities(match[1]), 60*60);
			});
		};

		get_token(function(token) {
			if (!token)
				return cb(null);

			query_ssstiktok(url, token, cb);
		});
	};

	common_functions["get_tiktok_from_tikmate"] = function(site, api_cache, do_request, url, cb) {
		var urlparts = common_functions["get_tiktok_weburl_parts"](url);
		if (!urlparts) {
			console_error("Invalid url", url);
			return cb(null);
		}

		var referer_url = "https://" + site + "/" + urlparts.username.replace(/_/g, "-") + "/" + urlparts.web_vid;

		var fill_cookies = function(cb) {
			real_api_query(api_cache, do_request, site + ":cookie:" + urlparts.username + "/" + urlparts.web_vid, {
				url: referer_url
			}, cb, function(done, resp, cache_key) {
				done(null, 6*60*60);
			});
		};

		var get_dl_url = function() {
			return {
				url: "https://" + site + "/dl.php",
				headers: {
					"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
					"Accept-Language": "en-US,en;q=0.9",
					"Cache-Control": "no-cache",
					"Pragma": "no-cache",
					Referer: referer_url,
					"Sec-Fetch-Dest": "document",
					"Sec-Fetch-Mode": "navigate",
					"Sec-Fetch-Site": "same-origin",
					"Sec-Fetch-User": "?1"
				},
				cookie_url: "https://" + site + "/", // otherwise it'll get overridden
				can_head: false,
				//content_type: "video/mp4", // otherwise it downloads as 'text/html; charset=UTF-8', which cannot be played. fixme: is this really needed?
				video: true
			};
		};

		fill_cookies(function() {
			cb(get_dl_url());
		});
	};

	// This is a terrible duct-tape solution, but required until I can find a proper way to fix get_best_tiktok_url
	// Note that this will NOT be called unless "Rules using 3rd-party websites" is enabled (it's disabled by default)
	common_functions["get_tiktok_from_3rdparty"] = function(site, api_cache, options, url, cb) {
		var sites = {
			// hd
			"ttloader.com:ttt": common_functions["get_tiktok_from_ttloader_token"],
			"onlinetik.com:ttt": common_functions["get_tiktok_from_ttloader_token"],
			"demo.wppress.net:tt": common_functions["get_tiktok_from_ttloader"],
			"tiktokdownloader.in:ttt": common_functions["get_tiktok_from_ttloader_token"],
			"savevideo.ninja:ttt": common_functions["get_tiktok_from_ttloader_token"],
			"tikdowns.com:ttt": common_functions["get_tiktok_from_ttloader_token"],
			"ssstiktok.net:ttt": common_functions["get_tiktok_from_ttloader_token"],

			"demo.wppress.net:svd": common_functions["get_tiktok_from_socialvideodownloader"],
			"savevideo.ninja:svd": common_functions["get_tiktok_from_socialvideodownloader"],

			// not hd
			"keeptiktok.com": common_functions["get_tiktok_from_keeptiktok"],
			"ssstiktok.io:1": common_functions["get_tiktok_from_ssstiktok"],
			"musicallydown.com:1": common_functions["get_tiktok_from_musicallydown"],
			"snaptik.app": common_functions["get_tiktok_from_snaptik"],
			"tikmate.online": common_functions["get_tiktok_from_tikmate"]
		};

		if (!(site in sites)) {
			console_error("Invalid site", site, sites);
			return cb(null);
		}

		sites[site](site, api_cache, options.do_request, url, cb, options);
	};

	common_functions["get_best_tiktok_url"] = function(api_cache, do_request, src, cb) {
		var get_tiktok_vidid_key = function(url) {
			var urlvidid = common_functions["get_tiktok_urlvidid"](url);
			if (!urlvidid) {
				console_warn("Unknown video URL:", url);
				return null;
			}

			return "tiktok_vidid:" + urlvidid;
		};

		var query_tiktok_vidid = function(url, cb) {
			var cache_key = get_tiktok_vidid_key(url);
			if (!cache_key)
				return cb(null);

			api_cache.fetch(cache_key, cb, function(done) {
				var request_handle;
				var request_aborted = false;

				var progress_cb = function(resp) {
					if (request_aborted)
						return;

					if (!resp.responseText) {
						if (resp.readyState !== 4)
							return;

						// Tampermonkey has a bug with onprogress: https://github.com/Tampermonkey/tampermonkey/issues/906
						if (resp.loaded && resp.total && resp.status === 200)
							return;

						request_handle.abort();
						request_aborted = true;

						console_error(resp);
						return done(null, false);
					}

					var match = resp.responseText.match(/mdtacomment[\s\S]{10,400}vid:([0-9a-z]{32})/);
					// after that, it stores 0, 0, 0, 37, with 37 being the length of vid:..., is this related?
					if (!match) {
						if (false) {
							var is_orig = /mdta[\s\S]{10,400}mdtacom\.apple\.quicktime\.description/.test(resp.responseText);
							if (is_orig) {
								request_handle.abort();
								request_aborted = true;

								console_log("Probably original video, skipping remainder of download", url);
								return done(null, 60*60);
							}
						}

						if (resp.readyState !== 4) {
							return;
						}

						if (resp.readyState === 4) {
							request_handle.abort();
							request_aborted = true;

							console_warn("Unable to find video ID for", url);

							if (resp.status !== 200) {
								done(null, false);
							} else {
								done(null, 60);
							}
						}
					} else {
						request_handle.abort();
						request_aborted = true;

						done(match[1], 24*60*60);
					}
				};

				request_handle = do_request({
					url: url,
					method: "GET",
					headers: {
						Referer: "https://www.tiktok.com/"
					},
					onprogress: progress_cb,
					onload: progress_cb
				});
			});
		};

		var get_nowatermark_for_vidid = function(vidid, cb) {
			var cache_key = "tiktok_watermarkfree:" + vidid;
			api_cache.fetch(cache_key, cb, function(done) {
				//var request_url = "https://api.tiktokv.com/aweme/v1/playwm/?video_id=" + vidid + "&ratio=default&improve_bitrate=1";
				var request_url = "https://api2-16-h2.musical.ly/aweme/v1/play/?video_id=" + vidid + "&ratio=default&improve_bitrate=1";

				var request_video = function(times) {
					do_request({
						// &ratio=1080p actually lowers the resolution to 480x* (instead of 576x*):
						// &ratio=default returns the original version (thanks to remlap on discord)
						// https://www.tiktok.com/@mariamenounos/video/6830547359403937030
						url: request_url,
						headers: {
							Referer: "https://www.tiktok.com/",
							//Accept: "text/html",
							Accept: "*/*",
							"Sec-Fetch-Dest": "video",
							"Sec-Fetch-Mode": "no-cors",
							"Sec-Fetch-Site": "cross-site"
						},
						method: "HEAD",
						onload: function(resp) {
							if (resp.readyState !== 4)
								return;

							// https://www.tiktok.com/@auliicravalho/video/6813323310521224454 - returns 302
							// sometimes it can return 503 (service unavailable), but still return a video url (thanks to JoshuaCalvert on discord for reporting)
							//   the video url still doesn't work though, so let's not check for that?
							if (resp.status === 503) {
								if (times < 5) {
									return setTimeout(function() {
										request_video(times + 1);
									}, 500);
								}
							}

							if (resp.status !== 200 && resp.status !== 302 /*&& string_indexof(resp.finalUrl, "/video/") <= 0*/) {
								console_error(resp);
								return done(null, false);
							}

							var finalurl = force_https(get_resp_finalurl(resp));

							// probably the application/json, content-length: 0 bug
							if (finalurl === request_url) {
								if (times < 5) {
									return setTimeout(function() {
										request_video(times + 1);
									}, 500);
								}
							}

							var finalurl_urlvidid = common_functions["get_tiktok_urlvidid"](finalurl);
							if (finalurl_urlvidid) {
								var finalurl_cache_key = "tiktok_vidid:" + finalurl_urlvidid;

								if (!api_cache.has(finalurl_cache_key)) {
									api_cache.set(finalurl_cache_key, vidid, 60*60);
								}
							}

							return done(finalurl, 60*60);
						}
					});
				};

				request_video(0);
			});
		};

		var get_newurl_if_changed = function(newsrc, src) {
			var old_urlvidid = common_functions["get_tiktok_urlvidid"](src);

			if (!newsrc)
				newsrc = src;
			var new_urlvidid = common_functions["get_tiktok_urlvidid"](newsrc);

			// to avoid infinite redirects
			if (new_urlvidid === old_urlvidid) {
				newsrc = src;
			}

			return newsrc;
		};

		query_tiktok_vidid(src, function(vidid) {
			if (!vidid) {
				return cb(null);
			}

			get_nowatermark_for_vidid(vidid, function(newsrc) {
				cb(get_newurl_if_changed(newsrc, src));
			});
		});
	};

	common_functions["tiktok_remove_watermark"] = function(api_cache, options, url, weburl, cb) {
		// Disabling this for now, it doesn't work anymore and serves no purpose with the latest tiktok rule updates
		if (!options.rule_specific || true) {
			return cb(null);
		}

		var funcs = [];

		if (options.rule_specific.tiktok_no_watermarks) {
			funcs.push("[local]");
		}

		if (options.rule_specific.tiktok_thirdparty && weburl) {
			var thirdparty = options.rule_specific.tiktok_thirdparty;

			// fixme (once/if multiple third party sites are supported)
			if (is_array(thirdparty))
				thirdparty = thirdparty[0];
			funcs.push(thirdparty);
		}

		var process_func = function(newurl?) {
			if (newurl) {
				return cb(newurl);
			}

			if (funcs.length === 0) {
				return cb(null);
			}

			var func = funcs[0];
			funcs.shift();

			if (func === "[local]") {
				common_functions["get_best_tiktok_url"](api_cache, options.do_request, url, process_func);
			} else {
				common_functions.get_tiktok_from_3rdparty(func, api_cache, options, weburl, process_func);
			}
		};

		process_func();
	};

	common_functions["youtube_fetch_watchpage_raw"] = function(api_cache, options, id, cb) {
		var url = "https://www.youtube.com/watch?v=" + id;
		if (/^embed:/.test(id)) {
			url = "https://www.youtube.com/embed/" + id.replace(/^embed:/, "") + "/";
		}

		real_api_query(api_cache, options.do_request, "youtube_watchpage_raw:" + id, {
			url: url
		}, cb, function(done, resp, cache_key) {
			return done(resp.responseText, 60*60);
		});
	};

	common_functions["youtube_fetch_watchpage_config"] = function(api_cache, options, id, context, cb) {
		var cache_key = "youtube_watchpage_config:" + id + ":" + context;
		api_cache.fetch(cache_key, cb, function(done) {
			common_functions["youtube_fetch_watchpage_raw"](api_cache, options, id, function(data) {
				if (!data)
					return done(null, false);

				var contexts = [context];
				if (context !== "config")
					contexts.push("config");

				var match;
				array_foreach(contexts, function(context) {
					var regex = new RegExp("ytplayer\\." + context + "\\s*=\\s*({.*?});");
					match = data.match(regex);
					if (match) {
						return false;
					}
				});

				if (!match) {
					console_warn(cache_key, "Unable to find ytplayer." + context + " for", {data: data});
					return done(null, false);
				}

				var add_args = false;
				if (/:ytInitialPlayerResponse|:(?:window\.)?ytplayer\.bootstrapPlayerResponse/.test(match[1])) {
					// both window[...] and var ... variants exist
					match = data.match(/(?:window\["ytInitialPlayerResponse"\]|var ytInitialPlayerResponse)\s*=\s*({.*?});/);
					if (!match) {
						console_warn(cache_key, "Unable to find ytInitialPlayerResponse for", {data: data});
						return done(null, false);
					}

					add_args = true;
				}

				try {
					var json = JSON_parse(match[1]);
					if (add_args) json.imu_need_args = false;
					return done(json, 5*60*60);
				} catch (e) {
					console_error(cache_key, e, {json: match[1]});
				}

				return done(null, false);
			});
		});
	};

	common_functions["youtube_fetch_watchpage"] = function(api_cache, options, id, cb) {
		return common_functions["youtube_fetch_watchpage_config"](api_cache, options, id, "config", function(json) {
			if (!json)
				return cb(null);

			try {
				if (json.imu_need_args === false) {
					return cb(json);
				}

				var player_response = json.args.player_response;
				var player_response_json = JSON_parse(player_response);
				return cb(player_response_json);
			} catch (e) {
				console_error(e, json);
			}

			return cb(null);
		});
	};

	common_functions["youtube_fetch_ytcfg"] = function(api_cache, options, id, cb) {
		var cache_key = "youtube_ytcfg:" + id;

		api_cache.fetch(cache_key, cb, function(done) {
			common_functions["youtube_fetch_watchpage_raw"](api_cache, options, id, function(data) {
				if (!data) return done(null, false);

				var match = data.match(/;\s+ytcfg\.set\(({.*})\);/);
				if (!match) {
					console_log(cache_key, "Unable to find ytcfg match for", {data: data});
					return done(null, false);
				}

				var jsonstr = match[1];
				var json = null;

				try {
					json = JSON_parse(jsonstr);
				} catch (e) {
					console_error(cache_key, e, {data: data, jsonstr: jsonstr});
					return done(null, false);
				}

				return done(json, 5*60*60);
			});
		});
	};

	common_functions["youtube_fetch_asset"] = function(api_cache, options, id, asset, cb) {
		var cache_key = "youtube_asset:" + asset;

		api_cache.fetch(cache_key, cb, function(done) {
			common_functions["youtube_fetch_ytcfg"](api_cache, options, id, function(json) {
				if (!json) return done(null, false);

				var asseturl = null;
				try {
					var context_config = json.WEB_PLAYER_CONTEXT_CONFIGS.WEB_PLAYER_CONTEXT_CONFIG_ID_KEVLAR_WATCH;
					if ((asset + "Url") in context_config)
						asseturl = context_config[asset + "Url"];
				} catch (e) {
					console_error(cache_key, e, json);
					return done(null, false);
				}

				if (!asseturl) {
					console_warn("Unable to find asset", asset, "in", json);
					return done(null, false);
				}

				var asset_url = urljoin("https://www.youtube.com/", asseturl, true);
				options.do_request({
					url: asset_url,
					method: "GET",
					headers: {
						Referer: "https://www.youtube.com/"
					},
					onload: function(resp) {
						if (resp.status !== 200) {
							console_error(cache_key, resp);
							return done(null, false);
						}

						return done(resp.responseText, 60*60);
					}
				});
			});
		});
	};

	common_functions["youtube_fetch_embed"] = function(api_cache, options, id, cb) {
		var cache_key = "youtube_embed_info:" + id;
		api_cache.fetch(cache_key, cb, function(done) {
			common_functions["youtube_fetch_ytcfg"](api_cache, options, "embed:" + id, function(json) {
				if (!json) return done(null, false);

				try {
					var player_response = json.PLAYER_VARS.embedded_player_response;
					var player_response_json = JSON_parse(player_response);
					return done(player_response_json, 5*60*60); // video URLs expire in 6 hours
				} catch (e) {
					console_error(cache_key, e, json);
					return done(null, false);
				}
			});
		});
	};

	// doesn't work anymore
	/*common_functions["youtube_fetch_embed"] = function(api_cache, options, id, cb) {
		var cache_key = "youtube_embed_info:" + id;
		api_cache.fetch(cache_key, cb, function(done) {
			options.do_request({
				url: "https://www.youtube.com/get_video_info?video_id=" + id,
				method: "GET",
				onload: function(resp) {
					if (resp.readyState !== 4)
						return;

					if (resp.status !== 200) {
						console_error(resp);
						return done(null, false);
					}

					// todo: use get_queries instead
					var splitted = resp.responseText.split("&");
					var found_player_response = false;
					for (var i = 0; i < splitted.length; i++) {
						if (/^player_response=/.test(splitted[i])) {
							found_player_response = true;
							var data = decodeURIComponent(splitted[i].replace(/^[^=]+=/, "").replace(/\+/g, "%20"));

							try {
								var json = JSON_parse(data);

								// sometimes fails with: playabilityStatus { status: UNPLAYABLE, reason: Video+unavailable }
								// also fails when video is about to premiere
								//var formats = json.streamingData.formats; // just to make sure it exists
								return done(json, 5*60*60); // video URLs expire in 6 hours
							} catch (e) {
								console_error(e, resp, splitted[i], data);
							}

							break;
						}
					}

					if (!found_player_response) {
						console_error("Unable to find player_response in", splitted[i]);
					}

					done(null, false);
				}
			});
		});
	};*/

	common_functions["parse_flixv2"] = function(resp, cache_key) {
		var regex = /<item>\s*<res>([^<]+)<\/res>\s*<videoLink>(?:<!\[CDATA\[)?(.*?)(?:\]\]>)?<\/videoLink>/;
		var global_regex = new RegExp(regex as any as string, "g"); // RegExp allows regexes, but TS doesn't like it

		var match = resp.responseText.match(global_regex);
		if (!match) {
			console_error(cache_key, "Unable to find items in", resp);
			return null;
		}
		var urls = [];
		for (var i = 0; i < match.length; i++) {
			var smatch = match[i].match(regex);

			var quality = smatch[1];
			var url = decode_entities(smatch[2]);

			urls.push({
				url: url,
				quality: parse_int(quality.replace(/^([0-9]+)p$/, "$1")),
				video: true
			});
		}

		urls.sort(function(a, b) {
			return b.quality - a.quality;
		});

		for (var i = 0; i < urls.length; i++) {
			delete urls[i].quality;
		}

		return urls;
	};

	common_functions["parse_mediadefinition"] = function(api_cache, options, src, data, cache_key, cb) {
		if (!data) {
			return null;
		}

		let final = function(defs) {
			try {
				defs.sort((a, b) => {
					if (a.format !== b.format) {
						if (a.format === "hls")
							return -1;
						if (b.format === "hls")
							return 1;
					}

					let diff = (b.quality|0) - (a.quality|0);
					if (diff)
						return diff;

					let a_dims = (a.height||1) * (a.width||1);
					let b_dims = (b.height||1) * (b.width||1);
					return b_dims - a_dims;
				});

				let urls = [];

				for (let def of defs) {
					// the queries constantly change, so to avoid constantly refreshing, let's make sure the base URL is different
					// the domain can also change (cv/ev) so remove that as well
					let newsrc = def.videoUrl;
					let noq = src.replace(/[?#].*$/, "").replace(/^[a-z]+:\/\/[^/]+\/+/, "");
					let newnoq = newsrc.replace(/[?#].*$/, "").replace(/^[a-z]+:\/\/[^/]+\/+/, "");

					if (noq === newnoq)
						newsrc = src;

					let video:any = true;
					if (def.format === "hls")
						video = "hls";

					urls.push({
						url: newsrc,
						extra: {
							page: data.link_url,
							caption: data.video_title
						},
						headers: {
							Referer: data.link_url
						},
						video: video,
						is_private: true // linked to IP
					});
				}

				cb(urls);
			} catch (e) {
				console_error(cache_key, e);
			}
		};

		try {
			let defs = [];
			let waiting = 0;
			let videourls = new_set();
			for (let def of data.mediaDefinition) {
				// e.g. 2160/1440p videos for non-logged in members
				if (!def.videoUrl)
					continue;

				if (set_has(videourls, def.videoUrl))
					continue;

				set_add(videourls, def.videoUrl);

				if (!def.quality) {
					real_api_query(api_cache, options.do_request, cache_key + ":" + def.videoUrl, {
						url: def.videoUrl,
						headers: {
							Referer: data.link_url
						},
						json: true
					}, function(data) {
						if (data)
							array_extend(defs, data);

						waiting -= 1;
						if (waiting <= 0) {
							final(defs);
						}
					}, function(done, resp, cache_key) {
						done(resp, 60*60);
					});

					waiting += 1;
				} else {
					defs.push(def);
				}
			}

			if (waiting <= 0)
				final(defs);
		} catch(e) {
			console_error(cache_key, e);
		}

		return null;
	};

	common_functions["get_parent_el_matching"] = function(el, match) {
		var current = el;

		while (current) {
			if (match(current)) {
				return current;
			}

			current = current.parentElement;
		}

		return null;
	};

	var _get_match_func = function(match) {
		var func = match;
		if (typeof func === "object" && func instanceof RegExp) {
			var regex = func;
			func = function(x) {
				return regex.test(x.href);
			};
		}

		return func;
	};

	common_functions["get_link_el_matching"] = function(el, match) {
		var func = _get_match_func(match);

		return common_functions["get_parent_el_matching"](el, function(x) {
			return x.tagName === "A" && func(x);
		});
	};

	common_functions["get_pagelink_el_matching"] = function(el, match) {
		var link_el = common_functions["get_link_el_matching"](el, match);
		if (!link_el)
			return null;

		return {
			url: link_el.href,
			is_pagelink: true
		};
	};

	common_functions["get_host_el_matching"] = function(el, host_url, el_match) {
		el = common_functions["get_parent_el_matching"](el, el_match);
		if (!el) return null;

		return {
			url: host_url,
			is_pagelink: true
		};
	};

	common_functions["get_pagelink_host_el_matching"] = function(options, our_options) {
		var newsrc = common_functions["get_pagelink_el_matching"](options.element, our_options.url_match);
		if (newsrc) return newsrc;

		if (!our_options.url_match.test(options.host_url)) return null;

		newsrc = common_functions["get_host_el_matching"](options.element, options.host_url, our_options.el_match);
		if (newsrc) return newsrc;
	};

	common_functions["is_pinterest_domain"] = function(domain) {
		var domain_nosub = get_domain_nosub(domain);
		return !!(/^pinterest\./.test(domain_nosub));
	};

	common_functions["get_jsonformatter_for_cryptojs"] = function(CryptoJS) {
		var JsonFormatter = {
			stringify: function(cipherParams) {
				var jsonObj = { ct: cipherParams.ciphertext.toString(CryptoJS.enc.Base64) };

				if (cipherParams.iv) {
					jsonObj.iv = cipherParams.iv.toString();
				}

				if (cipherParams.salt) {
					jsonObj.s = cipherParams.salt.toString();
				}

				return JSON_stringify(jsonObj);
			},
			parse: function(jsonStr) {
				var jsonObj = JSON_parse(jsonStr);

				var cipherParams = CryptoJS.lib.CipherParams.create({
					ciphertext: CryptoJS.enc.Base64.parse(jsonObj.ct)
				});

				if (jsonObj.iv) {
					cipherParams.iv = CryptoJS.enc.Hex.parse(jsonObj.iv);
				}

				if (jsonObj.s) {
					cipherParams.salt = CryptoJS.enc.Hex.parse(jsonObj.s);
				}

				return cipherParams;
			}
		};

		return JsonFormatter;
	};

	common_functions["create_dash_stream"] = function(data) {
		var header = "<?xml version=\"1.0\"?>\n"
		header += "<MPD xmlns=\"urn:mpeg:dash:schema:mpd:2011\" type=\"static\"";
		header += " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"";
		header += " xsi:schemaLocation=\"urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd\"";

		var get_attrib = function(attrib, value) {
			if (value === void 0)
				return "";

			return " " + attrib + "=\"" + encode_entities(value + "") + "\"";
		};

		if (data.duration) {
			var hours = (data.duration / 60 / 60) | 0;
			var minutes = ((data.duration / 60) | 0) % 60;
			var seconds = data.duration % 60;

			header += get_attrib("mediaPresentationDuration", "PT" + hours + "H" + minutes + "M" + seconds + "S");
		}

		if (data.min_buffer_time) {
			header += get_attrib("minBufferTime", data.min_buffer_time);
		}

		header += " profiles=\"urn:mpeg:dash:profile:isoff-main:2011\"";
		//header += " profiles=\"urn:mpeg:dash:profile:isoff-on-demand:2011\"";
		header += ">\n<Period>\n";

		var get_range_str = function(range) {
			if (typeof range === "string")
				return range;
			return range.start + "-" + range.end;
		}

		var create_representation = function(representation) {
			var rep = "  <Representation";

			rep += get_attrib("mimeType", representation.mime);
			rep += get_attrib("codecs", representation.codecs);
			rep += get_attrib("bandwidth", representation.bandwidth);
			rep += get_attrib("width", representation.width);
			rep += get_attrib("height", representation.height);
			rep += get_attrib("id", representation.id);
			if ("frame_rate" in representation)
				rep += get_attrib("frameRate", representation.frame_rate);
			if ("start_with_sap" in representation)
				rep += get_attrib("startWithSap", representation.start_with_sap);
			if ("sar" in representation)
				rep += get_attrib("sar", representation.sar);

			rep += ">\n";
			rep += "    <BaseURL>" + encode_entities(representation.url) + "</BaseURL>\n";

			if (representation.index_range || representation.init_range) {
				rep += "    <SegmentBase";
				if (representation.index_range)
					rep += get_attrib("indexRange", get_range_str(representation.index_range));
				rep += ">\n";

				if (representation.init_range) {
					rep += "      <Initialization"
					rep += get_attrib("range", get_range_str(representation.init_range));
					rep += " />\n";
				}

				rep += "    </SegmentBase>\n";
			}

			rep += "  </Representation>";

			return rep;
		};

		var create_adaptationset = function(mime, items) {
			var as = "  <AdaptationSet mimeType=\"" + mime + "\"";
			as += ">\n";

			array_foreach(items, function(item) {
				as += create_representation(item).replace(/^/mg, "  ") + "\n";
			});

			as += "  </AdaptationSet>";

			return as;
		};

		if (!data.mimes) {
			data.mimes = {};

			var add_video_audio = function(audiovideo) {
				var array = audiovideo === "audio" ? data.audios : data.videos;

				array_foreach(array, function(item) {
					if (!item.mime) {
						// todo: create common_function for getting the extension
						var ext = item.url.replace(/^[^?#]+\.([^/.?#]+)(?:[?#].*)?$/, "$1");

						if (ext !== item.url) {
							if (!item.codecs) {
								// https://cconcolato.github.io/media-mime-support/
								if (ext === "mp4") {
									//item.codecs = "avc1.640028";
									item.codecs = "avc1.4d401f";
								} else if (ext === "mp3") {
									item.codecs = "mp3";
									//item.codecs = "mp4a.40.2";
								}
							}

							if (ext === "mp3") ext = "mp4";

							item.mime = audiovideo + "/" + ext;
						} else {
							console_warn("Unable to get mime for", item);
							return;
						}
					}

					if (!(item.mime in data.mimes))
						data.mimes[item.mime] = [];

					data.mimes[item.mime].push(item);
				});
			};

			add_video_audio("video");
			add_video_audio("audio");
		}

		for (var mime in data.mimes) {
			header += create_adaptationset(mime, data.mimes[mime]) + "\n";
		}

		header += "</Period>\n</MPD>\n";

		return header;
	};

	var _sources_or_null = function(sources) {
		if (!sources.video.length) {
			if (!sources.image.length) {
				console_warn("Unable to find video sources");
				return null;
			}
		}

		return sources;
	};

	common_functions["get_videotag_sources"] = function(text) {
		var videomatch = text.match(/<video[\s\S]+?<\/video>/i);
		if (!videomatch) {
			console_error("Unable to find video tag from", {text: text});
			return null;
		}

		var video_parsed = parse_tag_def(videomatch[0]);
		if (!video_parsed) {
			console_error("Unable to parse <video> tag", videomatch[0]);
			return null;
		}

		var add_source = function(parsed) {
			parsed.name = parsed.args.res || parsed.args.title || parsed.args.label || null;
			parsed.url = parsed.args.src;
			sources.video.push(parsed);
		};

		var sources = {
			video: [],
			image: [],
			subtitles: []
		};
		if (video_parsed.args["src"])
			add_source(video_parsed);

		if (video_parsed.args["poster"]) {
			sources.image.push(video_parsed.args["poster"]);
		}

		var sources_match = videomatch[0].match(/<source.*?\/?>\s*(?:<\/source>)?/g);
		if (!sources_match) {
			return _sources_or_null(sources);
		}

		array_foreach(sources_match, function(source) {
			var parsed = parse_tag_def(source);
			if (!parsed) {
				console_warn("Unable to parse <source> tag", source);
				return;
			}

			if (parsed.args["src"])
				add_source(parsed);
		});

		let captions_match = videomatch[0].match(/<track[^>]+?>/g);
		if (captions_match) {
			for (let caption of captions_match) {
				let parsed = parse_tag_def(caption);
				if (!parsed) {
					console_warn("Unable to parse <track> tag", caption);
					continue;
				}

				if (parsed.args["kind"] !== "captions" && parsed.args["kind"] !== "subtitles")
					continue;

				if (!parsed.args["src"])
					continue;

				let capt_obj = {
					url: parsed.args["src"],
					title: null
				};

				if (parsed.args["label"])
					capt_obj.title = parsed.args["label"];

				sources.subtitles.push(capt_obj);
			}
		}

		sources.video.sort(function(a, b) {
			if (!a.name || !b.name)
				return 0;

			let amatch = a.name.match(/^([0-9]+)p$/);
			let bmatch = b.name.match(/^([0-9]+)p$/);

			if (!amatch || !bmatch)
				return 0;

			return parse_int(bmatch[1]) - parse_int(amatch[1]);
		});

		return _sources_or_null(sources);
	};

	common_functions["get_holaplayer_sources"] = function(objtext) {
		if (objtext[0] !== "{") {
			var match = objtext.match(/window\.hola_player\(({.*?}),\s*function/);
			if (match) {
				objtext = match[1];
			} else {
				console_error("Unable to find hola_player match from", {text: objtext});
				return null;
			}
		}

		match = objtext.match(/sources["']?:\s*(\[{.*?}\]),/);
		if (!match) {
			console_error("Unable to find sources match for", {text: objtext});
			return null;
		}

		var video_sources = JSON_parse(fixup_js_obj(match[1]));

		var poster = null;
		match = objtext.match(/poster["']?:\s*["'](https?:\/\/[^"']+)["'],/);
		if (!match) {
			console_warn("Unable to find poster match for", {text: objtext});
		} else {
			poster = match[1];
		}

		var sources = {
			video: [],
			image: []
		};

		if (poster) {
			sources.image.push(poster);
		}

		array_foreach(video_sources, function(source) {
			sources.video.push({
				src: source.src,
				type: source.type,
				url: source.src
			});
		});

		return _sources_or_null(sources);
	};

	common_functions["get_obj_from_videosources"] = function(page, sources):BigImageInfoMulti {
		var urls:BigImageInfoMulti = [];
		array_foreach(sources.video, function(source) {
			var video:VideoProp = true;
			if (source.type === "application/x-mpegURL" || string_indexof(source.url, ".m3u8") >= 0) {
				video = "hls";
			}

			// TODO: DASH

			urls.push({
				url: urljoin(page, source.url, true),
				video: video
			});
		});

		array_foreach(sources.image, function(image) {
			urls.push(urljoin(page, image, true));
		});

		return urls;
	};

	common_functions["get_videotag_obj"] = function(resp, options) {
		if (!options) options = {};
		if (!("ogimage" in options)) options.ogimage = true;
		if (!("videotag" in options)) options.videotag = true;

		var sources = {video: [], image: [], subtitles: []};

		if (options.videotag) {
			sources = common_functions["get_videotag_sources"](resp.responseText);
			if (!sources) return null;
		}

		var page = get_meta(resp.responseText, "og:url");
		if (page)
			page = urljoin(resp.finalUrl, page, true);
		else
			page = resp.finalUrl;

		let baseurl = get_base(resp.responseText, page);

		var obj:BigImageInfoSObject = {
			headers: {
				Referer: page
			},
			extra: {
				page: page
			}
		};

		var caption = get_meta(resp.responseText, "og:title");
		if (caption) obj.extra.caption = caption;

		// todo: should this be in get_videotag_sources instead?
		sources.video.sort(function(a, b) {
			if (a.args.res && b.args.res) {
				return b.args.res - a.args.res;
			}

			return 0;
		});

		var video_urls = [];
		array_foreach(sources.video, function(source) {
			video_urls.push(urljoin(baseurl, source.url, true));
		});

		let subs = null;
		if (sources.subtitles && sources.subtitles.length) {
			subs = [];
			for (let subtitle of sources.subtitles) {
				let baseobj = deepcopy(subtitle);
				baseobj.url = urljoin(baseurl, subtitle.url, true);
				subs.push(baseobj);
			}
		}

		if (options.ogvideo) {
			var ogvideo = get_meta(resp.responseText, "og:video");
			if (ogvideo) {
				array_upush(video_urls, urljoin(baseurl, ogvideo, true));
			}
		}

		var image_urls = [];
		array_foreach(sources.image, function(image) {
			image_urls.push(urljoin(baseurl, image, true));
		});

		if (options.ogimage) {
			var ogimage = get_meta(resp.responseText, "og:image");
			if (ogimage) {
				array_upush(image_urls, urljoin(baseurl, ogimage, true));
			}
		}

		var urls = [];
		array_foreach(video_urls, function(url) {
			let obj:BigImageInfoSObject = {
				url: url,
				video: true
			};

			if (subs) {
				obj.subtitles = deepcopy(subs);
			}

			urls.push(obj);
		});

		array_extend(urls, image_urls);

		if (!urls.length) return null;

		return fillobj_urls(urls, obj);
	};

	common_functions["update_album_info_links"] = function(obj, cmp) {
		var links = obj.album_info.links;

		var found = false;
		array_foreach(links, function(link, i) {
			if (!found && cmp(link.x_id || link.url)) {
				links[i].is_current = true;
				obj.url = links[i].real_url || links[i].url;
				found = true;
			} else {
				links[i].is_current = false;
			}
		});

		if (!found && links.length > 0) {
			links[0].is_current = true;
		}

		return obj;
	};

	common_functions["run_msml_op"] = function(state, process_data, cb) {
		var matches = state.matches;
		var op = process_data.op;
		var waiting = false;

		//console_log(process_data);

		if (op === "obj_set") {
			var value;

			if (process_data.value) {
				value = process_data.value;
			} else if (process_data.match) {
				value = matches[process_data.match];
			}

			if (process_data.subkey) {
				value = value[process_data.subkey];
			}

			var outfolder = matches;
			var outvar = process_data.out;

			if (process_data.out_subkey) {
				outfolder = matches[process_data.out];
				outvar = process_data.out_subkey;
			}

			outfolder[outvar] = value;
		} else if (op === "run") {
			var args = [];
			array_foreach(process_data.args, function(arg) {
				var value;

				if (typeof arg !== "object")
					arg = {value: arg};

				if (arg.value) {
					value = arg.value;
				} else if (arg.match) {
					value = matches[arg.match];
				} else if (arg.self) {
					value = state.ms_data[arg.self];
				}

				if (arg.subkey) {
					value = value[arg.subkey];
				}

				if (arg.regex)
					value = encode_regex(value);

				if (arg.cb) {
					value = function(data) {
						if (process_data.out) {
							matches[process_data.out] = data;
						}

						if ("bad" in process_data && data === process_data.bad) {
							cb(false);
						} else {
							cb(true);
						}
					};

					waiting = true;
				}

				args.push(value);
			});

			var obj = common_functions;
			if (process_data.match) {
				obj = matches[process_data.match];
			}

			var result = obj[process_data.key].apply(this, args);

			if ("bad" in process_data && result === process_data.bad) {
				console_error("Error running", process_data);
				return false;
			}

			if (process_data.out) {
				matches[process_data.out] = result;
			}
		} else if (op === "regex") {
			var flags = deepcopy(state.ms_data[process_data.flags]);

			obj_foreach(flags, function(key, data) {
				if (typeof data === "object") {
					if (data.replace_match) {
						delete flags[key];

						obj_foreach(data.replace_match, function(key1, value1) {
							key = string_replaceall(key, "%" + key1 + "%", encode_regex(matches[value1]));
						});

						flags[key] = data.source;
					}
				}
			});

			var regex_str = common_functions[process_data.key](common_functions[process_data.base], flags, state.ms_dadta);

			var in_match = process_data.in || "in";
			var match = matches[in_match].match(new RegExp(regex_str));
			if (!match) {
				console_error("Unable to find match from", {
					str: matches[in_match],
					regex: regex_str
				});
				return false;
			}

			matches[process_data.out] = match[process_data.save];
		} else if (op === "parse_queries") {
			var url = matches[process_data.match];
			if (!/^(?:https?:)?\//.test(url))
				url = "?" + url;

			var queries:QueryDict = get_queries(url, {decode: true});

			if (is_array(process_data.out)) {
				var keys = Object.keys(queries).sort();
				array_foreach(keys, function(key, i) {
					if (i in process_data.out) {
						matches[process_data.out[i]] = queries[key];
					} else {
						return false;
					}
				});
			} else {
				obj_foreach(process_data.out, function(key, value) {
					if (key in queries)
						matches[value] = queries[key];
				});
			}
		} else if (op === "add_queries") {
			url = matches[process_data.match];
			var queries:QueryDict = {};

			array_foreach(process_data.queries, function(query_obj) {
				var query = query_obj.query;
				var value = query_obj.value;

				if (typeof query === "object") query = matches[query.match];
				if (typeof value === "object") value = matches[value.match];

				queries[query] = value;
			});

			matches[process_data.out] = add_queries(url, queries);
		} else if (op === "parse_match") {
			var out = [];

			array_foreach(matches[process_data.match], function(sdata) {
				var subarr = [];

				obj_foreach(sdata, function(key, value) {
					if (typeof value === "string") {
						subarr.push(matches[process_data.subkey][value]);
					} else if (is_array(value)) {
						subarr.push(value[value.length - 1]);
					} else {
						subarr.push(value);
					}
				});

				out.push(deepcopy(subarr));
			});

			matches[process_data.out] = out;
		} else if (op === "final") {
			state.ok = true;
		} else {
			console_error("Unknown operation", process_data);
		}

		if (waiting)
			return "waiting";
	};

	common_functions["run_msml_oplist"] = function(state, oplist, cb) {
		state.ok = false;
		var waiting = false;
		try {
			array_foreach(oplist, function(op, i) {
				var result = common_functions["run_msml_op"](state, op, function(success) {
					if (!success) {
						state.ok = false;
						return cb(state.ok);
					} else {
						common_functions["run_msml_oplist"](state, oplist.slice(i + 1), cb);
					}
				});
				if (!result) return result;

				if (result === "waiting") {
					waiting = true;
					return false;
				}
			});
		} catch (e) {
			console_error("Error running oplist", state.matches);
			throw e;
		}

		if (!waiting) cb(state.ok);
	};

	common_functions["run_msml"] = function(ms_data, in_data, cb) {
		if (!ms_data || !in_data) {
			return cb(null);
		}

		var state = {
			matches: {},
			ms_data: ms_data
		};

		var our_run = function(data, cb) {
			var our_state = {
				matches: deepcopy(state.matches),
				ms_data: ms_data
			};

			our_state.matches["in"] = data;
			common_functions["run_msml_oplist"](our_state, our_state.ms_data.run, function(ok) {
				if (!ok) {
					return cb(null);
				}

				cb(our_state.matches.out);
			});
		};

		if (state.ms_data.bootstrap) {
			state.matches["in"] = in_data;
			common_functions["run_msml_oplist"](state, state.ms_data.bootstrap, function(ok) {
				if (!ok) {
					return cb(null);
				}

				cb(our_run);
			});
		} else {
			cb(our_run);
		}
	};

	common_functions["process_formats"] = function(api_cache, options, formats, cb) {
		var total = 0;
		var processed = 0;
		var msmls = {};

		var do_cb = function() {
			//console_log(processed, total);

			if (processed >= total) {
				cb(formats);
				processed = -1; // don't run final twice
			}
		};

		//console_log(deepcopy(formats));

		array_foreach(formats, function(format) {
			obj_foreach(format, function(key) {
				if (!format[key] || !options.process_format || !(key in options.process_format)) {
					return;
				}

				total++;

				if (!(key in msmls)) {
					msmls[key] = [];
				}

				msmls[key].push(format);
			});
		});

		obj_foreach(msmls, function(key) {
			msmls[key][0].imu_msml_options = options;
			msmls[key][0].imu_msml_api_cache = api_cache;

			common_functions["run_msml"](options.process_format[key], msmls[key][0], function(msml) {
				if (!msml) {
					processed++;
					do_cb();
					return;
				}

				array_foreach(msmls[key], function(format) {
					msml(format, function() {
						processed++;
						do_cb();
					});
				});
			});
		});

		do_cb();
	};

	common_functions["normalize_function"] = function(func, vars) {
		var body = func.toString()
			.replace(/\/\/.*/g, "") // fixme: this would break "//"
			.replace(/(return|var)\s+/g, "$1##") // awful hack
			.replace(/\s*/g, "")
			.replace(/(return|var)##/g, "$1 ")
			.replace(/^(?:function\([^)]*\))?{(.*?);*}$/, "{$1}");

		if (vars) {
			for (var out_var in vars) {
				var values = vars[out_var];
				if (!is_array(values))
					values = [values];

				array_foreach(values, function(our_var) {
					if (typeof our_var === "string") {
						our_var = {source: our_var};
					}

					if (our_var.regex) {
						body = body.replace(new RegExp(our_var.source, "g"), out_var);
					} else {
						body = string_replaceall(body, our_var.source, out_var);
					}
				});
			}
		}

		return body;
	};

	common_functions["get_mappings_for_objstr"] = function(funcs, objstr, vars) {
		var debug_info = {
			funcs: funcs,
			objstr: objstr,
			vars: vars
		};

		var funcmapping_regex = new RegExp("(" + js_obj_token_types.jvarname.source + ")[\"']?\\s*:\\s*function\\s*[(][^)]*[)]\\s*({.*?})(?:,|};?$)");
		var matches = match_all(objstr, funcmapping_regex);
		if (!matches) {
			console_error("Unable to find mappings", debug_info);
			return null;
		}

		var mappings = {};
		var mappings_ok = true;

		var func_norm = [];
		array_foreach(funcs, function(func) {
			func_norm.push(common_functions["normalize_function"](func, vars));
		});

		array_foreach(matches, function(match) {
			var func_name = match[1];
			var func_body = common_functions["normalize_function"](match[2]);

			array_foreach(func_norm, function(our_body, i) {
				if (our_body === func_body) {
					mappings[func_name] = i;
					return false;
				}
			});

			if (!mappings[func_name]) {
				debug_info.matches = matches;
				debug_info.match = match;
				console_error("Unable to find mapping", debug_info);
				mappings_ok = false;
				return false;
			}
		});

		if (!mappings_ok) {
			return null;
		} else {
			return mappings;
		}
	};

	common_functions["parse_js_calls"] = function(namespace, code) {
		var regex = "";

		if (namespace) {
			regex = namespace + "\\.";
		} else {
			regex = "[^$_a-zA-Z0-9]";
		}

		regex += "(" + js_obj_token_types.jvarname.source + ")[(]([^)]*)[)][;\\s}]";

		var matches = match_all(code, new RegExp(regex));
		if (!matches) {
			return null;
		}

		var calls = [];

		array_foreach(matches, function(match) {
			var call = {
				name: match[1],
				args: []
			};

			var arg_matches = match_all(match[2], /([$_a-zA-Z0-9.]+)\s*(?:,|$)/);
			if (!arg_matches) {
				return;
			}
			array_foreach(arg_matches, function(argmatch) {
				var argval = argmatch[1];

				if (js_obj_token_types.number.test(argval)) {
					argval = parseFloat(argval);
				}

				call.args.push(argval);
			});

			calls.push(call);
		});

		return calls;
	};

	common_functions["find_actual_largest_image"] = function(current, images, cb, options) {
		if (images.length < 2) {
			return cb(images[0]);
		}

		if (!options) options = {};
		if (!options.cache) options.cache = {};

		var cache = options.cache;

		var query_contentlength = function(url, cb) {
			real_api_query(options.api_cache, options.do_request, "contentlength:" + url, {
				url: url,
				headers: {
					Referer: ""
				},
				method: "HEAD",
				silent: true
			}, cb, function(done, resp, cache_key) {
				var headers = headers_list_to_dict(parse_headers(resp.responseHeaders));

				if (!("content-length" in headers)) {
					if (resp.status === 404) {
						return done(null, 60*60);
					} else {
						return done(null, false);
					}
				}

				return done(parse_int(headers["content-length"]), 60*60);
			});
		};

		var our_get_image_size = function(src, cb) {
			if (src in cache) {
				return cb(cache[src][0], cache[src][1]);
			}

			if (!options.check_length) {
				get_image_size(src, function(x, y) {
					if (!x || !y) {
						return cb(x, y);
					}

					cache[src] = [x, y];
					cb(x, y);
				});
			} else {
				query_contentlength(src, function(contentlength) {
					cb(contentlength, contentlength);
				});
			}
		};

		var do_imageurl = function(imageurl, i) {
			our_get_image_size(imageurl, function(x, y) {
				if (cancel) return;

				if (!x || !y) {
					if (imageurl === current) {
						cancel = true;
						return cb(null);
					}
				} else {
					processed_urls[imageurl] = [x, y, i];
				}

				processed++;
				if (processed < total) return;

				var min = -1;
				var min_url = null;

				// to avoid redirects to identically sized images
				if (current in processed_urls) {
					min_url = current;
					min = processed_urls[current][0] * processed_urls[current][1];
				}

				obj_foreach(processed_urls, function(key, value) {
					var ours = value[0] * value[1];
					if (ours > min) {
						min = ours;
						min_url = key;
					}
				});

				if (total < images.length) {
					images.splice(0, total);
					images.unshift(min_url);
					common_functions["find_actual_largest_image"](current, images, cb, options);
				} else {
					cb(min_url);
				}
			});
		};

		var processed = 0;
		var processed_urls = {};
		var cancel = false;

		var total = images.length;
		if (total > 2 && options.respect_order) {
			total = 2;
		}

		for (var i = 0; i < total; i++) {
			do_imageurl(images[i], i);
		}
	};

	common_functions["gen_jquery_callback"] = function() {
		return "jQuery" + get_random_text(20) + "_" + Date.now();
	};

	common_functions["get_largest_twimg"] = function(url:string, options?:BigImageOptions):BigImageInfoObject|undefined {
		var fill_obj_filename = function(obj:BigImageInfoSObject, url:string) {
			var format = get_queries(url).format;
			if (format) {
				var basename = url.match(/\/([^/.?#]+)(?:\.[^/.]+)?(?:[?#].*)?$/);
				obj.filename = basename[1] + "." + format;
			}
		};

		var use_ext = false;
		if (options && options.rule_specific && options.rule_specific.twitter_use_ext) {
			use_ext = true;
		}

		var obj:BigImageInfoSObject = {
			url: url,
			can_head: false // 503 sometimes
		};

		var newsrc, match;

		if (string_indexof(obj.url, "/profile_images/") >= 0) {
			// https://pbs.twimg.com/profile_images/539057632435122178/1_MUcoAZ_bigger.jpeg
			// https://pbs.twimg.com/profile_images/642139282325417984/uXOHdmTV_mini.png
			// https://pbs.twimg.com/profile_images/1079712585186852864/l9IiWuzk_reasonably_small.jpg
			//   https://pbs.twimg.com/profile_images/1079712585186852864/l9IiWuzk.jpg
			// thanks to Liz on discord:
			// https://pbs.twimg.com/profile_images/1120032409045602304/id2Moo0W_x96.png
			//   https://pbs.twimg.com/profile_images/1120032409045602304/id2Moo0W.png
			//return src.replace(/_[a-zA-Z0-9]+\.([^/_]*)$/, "\.$1");
			newsrc = obj.url
				.replace(/[?#].*$/, "")
				.replace(/_(?:bigger|normal|mini|reasonably_small|[0-9]*x[0-9]+)(\.[^/_]*)$/, "$1");
			if (newsrc !== obj.url) {
				obj.url = newsrc;
				return obj;
			} else {
				return;
			}
		}

		if (string_indexof(obj.url, "/profile_banners/") >= 0) {
			// https://pbs.twimg.com/profile_banners/811769379020947458/1503413326/1500x500 -- stretched
			//   https://pbs.twimg.com/profile_banners/811769379020947458/1503413326
			// thanks to Gyuri on discord:
			// https://pbs.twimg.com/profile_banners/4746636714/1520928319/1500x500 -- possibly not stretched?
			//   https://pbs.twimg.com/profile_banners/4746636714/1520928319
			newsrc = obj.url.replace(/\/[0-9]+x[0-9]+(?:[?#].*)?$/, "");
			if (newsrc !== obj.url) {
				obj.url = newsrc;
				return obj;
			} else {
				return;
			}
		}

		fill_obj_filename(obj, obj.url);

		// replace :orig to name=orig, should always work?
		newsrc = obj.url
			.replace(/:([^/?]+)(.*)?$/, "$2?name=$1")
			.replace(/(\?.*)\?name=/, "$1&name=");
		if (newsrc !== obj.url) {
			obj.url = newsrc;
		}

		if (false && !(/\/(?:card|ad|semantic_core)_img\//.test(obj.url))) {
			// replace format=jpg to .jpg, doesn't work for /card_img/
			// doesn't work for some tweet images too (thanks to llacb47 on github for reporting: https://github.com/qsniyg/maxurl/issues/545)
			// https://pbs.twimg.com/media/EnlTOuPVkAEVFcG?format=jpg&name=medium
			//   https://pbs.twimg.com/media/EnlTOuPVkAEVFcG?format=jpg&name=orig
			if (false) {
				newsrc = obj.url
					.replace(/(\/[^/.?]+)\?(.*?&)?format=([^&]*)(.*?$)?/, "$1.$3?$2$4")
					.replace(/\?&/, "?")
					.replace(/[?&]+$/, "");
			}
		}

		if (/:\/\/[^/]+\/+media\//.test(obj.url)) {
			match = obj.url.match(/^([^?#]+\/[^/.?#]+)\.([^/.?#]+)([?#].*)?$/);
			if (match) {
				// todo: check if format already exists and don't overwrite?
				newsrc = add_queries(match[1] + (match[3]||""), {format: match[2]});
			}

			newsrc = newsrc.replace(/([?&]format=)webp(&.*)?$/, "$1jpg$2");

			// should always work?
			if (newsrc !== obj.url) {
				fill_obj_filename(obj, newsrc);
				obj.url = newsrc;
			}
		}

		// http://pbs.twimg.com/tweet_video_thumb/EmCgOz9U4AA0bib.jpg
		//   https://pbs.twimg.com/tweet_video/EmCgOz9U4AA0bib.mp4
		match = obj.url.match(/\/tweet_video_thumb\/+([^/.?#]+)\./);
		if (match) {
			return {
				url: obj.url.replace(/\/tweet_video_thumb\/+[^/]+\.[^/.]+(?:[?#].*)?$/, "/tweet_video/" + match[1] + ".mp4"),
				video: true
			};
		}

		// try various names (thanks to rEnr3n for reporting): https://github.com/qsniyg/maxurl/issues/165
		// https://pbs.twimg.com/media/Bu4G7k3CcAA6Nx7.jpg
		//   https://pbs.twimg.com/media/Bu4G7k3CcAA6Nx7.jpg?name=medium -- same size, anything higher doesn't work
		// thanks to fireattack on discord for reporting:
		// https://pbs.twimg.com/media/F7L8Rmyb0AAxAro?format=jpg&name=small
		//   https://pbs.twimg.com/media/F7L8Rmyb0AAxAro?format=jpg&name=medium -- 404
		var names = ["orig", "4096x4096", "large", "medium"];
		var baseobj = obj;
		var mobj:BigImageInfoMObject = [];

		var name_match = baseobj.url.match(/[?&]name=([^&]+)/);
		var name = name_match ? name_match[1] : null;

		// don't downscale
		var end = array_indexof(names, name);
		if (end < 0)
			end = names.length;

		var obj_add = function(x:string) {
			var newobj = deepcopy(baseobj);
			newobj.url = x;
			fill_obj_filename(newobj, newobj.url);

			mobj.push(newobj);
		};

		var format_to_ext = function(src, format) {
			src = keep_queries(src, ["name"]);
			src = src.replace(/(\/[^/?&#.]+)(?:\.[^/?&#.]+)?(\?.*)?$/, "$1." + format + "$2");
			return src;
		};

		for (var i = 0; i < end; i++) {
			newsrc = baseobj.url
				.replace(/(\.[a-z]+)\?(?:(.*)&)?format=[^&]+/, "$1?$2&")
				.replace(/&$/, "");

			newsrc = add_queries(newsrc, {name: names[i]});
			//var newsrc_colon = newsrc.replace(/\?name=([^&]+)$/, ":$1");

			// don't do this, this doesn't work for .jpg?format=jpg&name=...
			// commenting out because src doesn't exist
			/*if (false) {
				newsrc = src.replace(/([?&]name=)[^&]+(&.*)?$/, "$1" + names[i] + "$2");
				if (newsrc === src)
					newsrc = src
						.replace(/(\?.*)?$/, "$1?name=" + names[i])
						.replace(/(\?.*)\?name=/, "$1&name=");
			}*/

			var queries = get_queries(newsrc);

			if (queries.format === "png" || queries.format === "jpg") {
				if (use_ext) obj_add(format_to_ext(newsrc, "png"));
				obj_add(add_queries(newsrc, {format: "png"}));
				if (use_ext) obj_add(format_to_ext(newsrc, "jpg"));
				obj_add(add_queries(newsrc, {format: "jpg"}));
			} else {
				if (use_ext && queries.format) obj_add(format_to_ext(newsrc, queries.format));
				obj_add(newsrc);
			}
		}

		obj_add(baseobj.url);

		if (mobj.length > 1)
			return mobj;
	};

	common_functions["parse_imu_hash"] = function(url) {
		var match = url.match(/#(.*)/);
		if (!match) return null;

		var queries = {};
		obj_foreach(get_queries("?" + match[1]), function(key, value) {
			var keymatch = key.match(/^imu-(.*)/);
			if (!keymatch) return;

			queries[keymatch[1]] = value;
		});

		return queries;
	};

	common_functions["multidomain__nitter"] = function(domain, domain_nowww) {
		return domain_nowww === "nitter.net" ||
			// https://github.com/zedeus/nitter/wiki/Instances
			// sorting same as instance list in case we need to add new ones from it
			domain === "nitter.lacontrevoie.fr" ||
			domain === "nitter.nixnet.services" ||
			domain === "nitter.fdn.fr" ||
			domain === "nitter.1d4.us" ||
			domain === "nitter.kavin.rocks" ||
			domain === "nitter.unixfox.eu" ||
			domain === "nitter.domain.glass" ||
			domain === "birdsite.xanny.family" ||
			domain === "nitter.moomoo.me" ||
			domain === "bird.trom.tf" ||
			domain === "nitter.it" ||
			domain === "nitter.weiler.rocks" ||
			domain === "nitter.sethforprivacy.com" ||
			domain === "nitter.nl" ||
			domain === "nitter.mint.lgbt" ||
			domain === "nitter.esmailelbob.xyz" ||
			domain === "tw.artemislena.eu" ||
			domain === "nitter.tiekoetter.com" ||
			domain === "nitter.privacy.com.de" ||
			domain === "nitter.bird.froth.zone" ||
			domain === "nitter.cz" ||
			domain === "nitter.privacydev.net" ||
			domain === "tweet.lambda.dance" ||
			domain === "nitter.kylrth.com" ||
			domain === "unofficialbird.com" ||
			domain === "nitter.projectsegfau.lt" ||
			domain === "nitter.eu.projectsegfau.lt" ||
			domain === "nitter.in.projectsegfau.lt" ||
			domain === "singapore.unofficialbird.com" ||
			domain === "canada.unofficialbird.com" ||
			domain === "india.unofficialbird.com" ||
			domain === "nederland.unofficialbird.com" ||
			domain === "uk.unofficialbird.com" ||
			domain === "nitter.soopy.moe" ||
			domain === "nitter.qwik.space" ||
			domain === "read.whatever.social" ||
			domain === "nitter.rawbit.ninja" ||
			domain === "nt.vern.cc" ||
			domain === "n.sneed.network" ||
			domain === "nitter.smnz.de" ||
			domain === "nitter.twei.space" ||
			domain === "nitter.inpt.fr" ||
			domain === "nitter.d420.de" ||
			domain === "nitter.caioalonso.com" ||
			domain === "nitter.at" ||
			domain === "nitter.nicfab.eu" ||
			domain === "bird.habedieeh.re" ||
			domain === "nitter.hostux.net" ||
			domain === "nitter.adminforge.de" ||
			domain === "nitter.platypush.tech" ||
			domain === "nitter.us.projectsegfau.lt" ||
			domain === "t.com.sb" ||
			domain === "nitter.kling.gg" ||
			domain === "nitter.riverside.rocks" ||
			domain === "nitter.lunar.icu" ||
			domain === "twitter.moe.ngo" ||
			domain === "nitter.freedit.eu" ||
			domain === "n.opnxng.com" ||
			domain === "nitter.tux.pizza" ||
			domain === "nitter.altgr.xyz" ||
			domain === "jote.lile.cl" ||
			domain === "nitter.one" ||
			domain === "nitter.io.lol" ||
			domain === "nitter.no-logs.com" ||
			domain === "tweet.whateveritworks.org" ||
			domain === "nitter.fediflix.org" ||
			domain === "nitter.nohost.network" ||
			domain === "nitter.simpleprivacy.fr" ||
			domain === "nitter.onthescent.xyz" ||
			domain === "nitter.x86-64-unknown-linux-gnu.zip" ||
			domain === "nitter.private.coffee" ||
			domain === "nitter.oksocial.net" ||
			domain === "nitter.services.woodland.cafe" ||
			domain === "nitter.dafriser.be" ||
			domain === "nitter.catsarch.com" ||
			//domain === "nitter.13ad.de" ||
			//domain === "tw.openalgeria.org" ||
			domain === "nitter.42l.fr" ||
			domain === "nitter.pussthecat.org" ||
			//domain === "nitter.mastodont.cat" ||
			domain === "nitter.tedomum.net" ||
			domain === "nitter-home.kavin.rocks" ||
			domain === "nitter.cc" ||
			domain === "nitter.vxempire.xyz" ||
			domain === "nitter.eu" ||
			domain === "nitter.ethibox.fr" ||
			domain === "nitter.namazso.eu" ||
			domain === "nitter.mailstation.de" ||
			domain === "nitter.actionsack.com" ||
			domain === "nitter.cattube.org" ||
			domain === "nitter.40two.app" ||
			domain === "nitter.skrep.in" ||
			domain === "nitter.hu" ||
			domain === "nitter.database.red" ||
			domain === "nitter.exonip.de" ||
			domain === "twitr.gq" ||
			domain === "nitter.koyu.space" ||
			domain === "nitter.dark.fail" ||
			//domain === "t.maisputain.ovh" ||
			//domain === "nitter.weaponizedhumiliation.com" ||
			domain === "nitter.snopyta.org";
	};

	common_functions["multidomain__teddit"] = function(domain, domain_nowww) {
		return domain_nowww === "teddit.net" ||
			domain === "teddit.froth.zone" ||
			domain === "teddit.zaggy.nl" ||
			domain === "teddit.pussthecat.org" ||
			domain === "teddit.sethforprivacy.com" ||
			domain === "teddit.totaldarkness.net" ||
			domain === "teddit.adminforge.de" ||
			domain === "teddit.bus-hit.me" ||
			domain === "rdt.trom.tf" ||
			domain === "i.opnxng.com" ||
			domain === "teddit.garudalinux.org" ||
			domain === "tedd.it" ||
			domain === "teddit.privacytools.io" ||
			domain === "td.vern.cc" ||
			domain === "teddit.rawbit.ninja" ||
			domain === "teddit.artemislena.eu" ||
			domain === "teddit.manasiwibi.com" ||
			domain === "teddit.hostux.net" ||
			domain === "reddit.lurkmore.com";
	};

	common_functions["multidomain__xhamster"] = function(domain_nosub) {
		// trustURLs in initials object
		return domain_nosub === "xhamster.com" || // 1-45?, 500
			domain_nosub === "xhamster.one" ||
			domain_nosub === "xhamster.desi" || // 1-5, 7
			//domain_nosub === "xhamsterpremium.com" ||
			domain_nosub === "openxh.com" ||
			domain_nosub === "openxh1.com" ||
			domain_nosub === "openxh2.com" ||
			domain_nosub === "xhopen.com" ||
			domain_nosub === "xhlocal.com" ||
			domain_nosub === "unlockxh.com" || // 1-5
			domain_nosub === "fullxh.com" ||
			domain_nosub === "xhtotal.com" ||
			domain_nosub === "localxh.com" || // 1-5
			// 1-4
			domain_nosub === "xhofficial.com";
	};

	// this requires removing everything before the thumbor url with /
	common_functions["get_thumbor_url"] = function(src) {
		// /S4Fr7rEpLL-QZnU3bsNT5ORJzYQ=/364x130/https%3A%2F%2Fblueprint-api-production.s3.amazonaws.com%2Fuploads%2Fstory%2Fthumbnail%2F73835%2Fd72a8d3f-baf0-4132-b6f9-358d27d1c0c9.JPG
		//   https%3A%2F%2Fblueprint-api-production.s3.amazonaws.com%2Fuploads%2Fstory%2Fthumbnail%2F73835%2Fd72a8d3f-baf0-4132-b6f9-358d27d1c0c9.JPG
		// /tREpzmUU7LJX1cbkAN-unm7wL0Y=/fit-in/800x600/top/filters:fill(black)/arc-anglerfish-arc2-prod-tronc.s3.amazonaws.com/public/XC6HBG2I4VHTJGGCOYVPLBGVSM.jpg
		//   arc-anglerfish-arc2-prod-tronc.s3.amazonaws.com/public/XC6HBG2I4VHTJGGCOYVPLBGVSM.jpg
		// /Aq5Tn8-7kqPSJs4U0_QaYoM6x8Q/fit-in/1024x1024/filters:format_auto-!!-:strip_icc-!!-/2015/03/30/647/n/1922564/ccc1eafd_edit_img_cover_file_864129_1397566805/i/Emma-Watson-Best-Red-Carpet-Looks.png
		//   2015/03/30/647/n/1922564/ccc1eafd_edit_img_cover_file_864129_1397566805/i/Emma-Watson-Best-Red-Carpet-Looks.png
		// /t85Z6EqhDjIu8EaEzfzk5hOJ1Ck/0x360:2400x2394/fit-in/728xorig/filters:format_auto-!!-:strip_icc-!!-:watermark-!popsugar-watermark.png,-5,-5,0!-/2020/01/16/687/n/1922564/4606d55d5e20819816a430.09594567_/i/selena-gomez-style-for-new-album-release-2020.jpg
		//   2020/01/16/687/n/1922564/4606d55d5e20819816a430.09594567_/i/selena-gomez-style-for-new-album-release-2020.jpg
		// https://images.macrumors.com/t/H0ZN9uTQCAlcNAvgJLkUkfNyHDI=/112x112/smart/article-new/2021/05/Top-Stories-59-Feature.jpg
		//   article-new/2021/05/Top-Stories-59-Feature.jpg
		// https://images.vs-static.com/yfr09nm8pH3P694LHLLivqhMRDg=/0x314:2999x2001/1900x0/Getty_Images_1330811041_046fcd0f40/Getty_Images_1330811041_046fcd0f40.jpg
		src = src
			.replace(/^\/*/, "/")
			.replace(/^\/[-_0-9a-zA-Z]{20,}=?\/+/, "/")
			.replace(/^\/(?:[0-9]+|orig)x(?:[0-9]+|orig)(?::[0-9]+x[0-9]+)?\/+/, "/")
			.replace(/^\/fit-in\/+(?:[0-9]+|orig)x(?:[0-9]+|orig)\/+(?:top\/+)?/, "/")
			.replace(/^\/filters:[^/]+\/+/, "/")
			.replace(/^\/smart\/+/, "/")
			.replace(/^\/(?:[0-9]+|orig)x(?:[0-9]+|orig)(?::[0-9]+x[0-9]+)?\/+/, "/")
			.replace(/^\/*/, "");

		return src;
	};

	// currently type is ignored as only ReleaseAllImages has been discovered
	common_functions["query_discogs_images_api"] = function(options, type, discogsid, cb) {
		var vars = encodeURIComponent("{\"discogsId\":" + discogsid + ",\"count\":500}");

		// magic
		var extensions = "%7B%22persistedQuery%22%3A%7B%22version%22%3A1%2C%22sha256Hash%22%3A%2213e41f41a02b02d0a7e855a71e1a02478fd2fb0a2d104b54931d649e1d7c6ecd%22%7D%7D";

		real_api_query(options.api_cache, options.do_request,
			"discogs_images:" + discogsid, {
				url: " https://release-page.discogs.com/api/graphql?operationName=ReleaseAllImages&variables=" + vars + "&extensions=" + extensions,
				imu_mode: "xhr",
				headers: {
					origin: "https://www.discogs.com",
					referer: "https://www.discogs.com/",
					"content-type": "application/json",
					accept: "*/*"
				},
				json: true
			}, cb, function(done, resp, cache_key) {
				var images = resp.data.release.images.edges;
				var out_images = [];
				array_foreach(images, function(image) {
					var node = image.node;

					// webpUrl seems to be better quality than sourceUrl?
					// https://img.discogs.com/Amgne6j0gBvX12BXuwyyx1U6afU=/fit-in/600x600/filters:strip_icc():format(webp):mode_rgb():quality(90)/discogs-images/R-6114127-1413723322-8982.jpeg.jpg
					// https://img.discogs.com/_4HU0V6fRalpgDVx08VPdQl7ZMk=/fit-in/600x600/filters:strip_icc():format(jpeg):mode_rgb():quality(90)/discogs-images/R-6114127-1413723322-8982.jpeg.jpg
					out_images.push(node.fullsize.webpUrl);
				});

				done(out_images, 6*60*60);
			}
		);
	};

	common_functions["query_discogs_images_web"] = function(options, type, discogsid, cb) {
		real_api_query(options.api_cache, options.do_request,
			"discogs_images:" + type + ":" + discogsid, {
				url: "https://www.discogs.com/" + type + "/" + discogsid + "/images",
				imu_mode: "document"
			}, cb, function(done, resp, cache_key) {
				var matches = match_all(resp.responseText, /<span class="thumbnail_link">.*?<img src="(https?:\/\/img\.discogs\.com\/[^"]+)"/);
				if (!matches || !matches.length) {
					console_error(cache_key, "Unable to find matches from", resp);
					return done(null, false);
				}

				var images = [];
				array_foreach(matches, function(match) {
					images.push(decode_entities(match[1]));
				});

				done(images, 6*60*60);
			}
		);
	};

	common_functions["query_discogs_images"] = function(options, type, discogsid, cb) {
		if (type === "release") {
			return common_functions["query_discogs_images_api"](options, type, discogsid, cb);
		} else {
			return common_functions["query_discogs_images_web"](options, type, discogsid, cb);
		}
	};

	common_functions["do_flickr_request"] = function(options, url, cb) {
		var headers = {
			"Origin": "https://www.flickr.com",
			"Referer": "https://www.flickr.com/",
			"Sec-Fetch-Site": "same-site",
			// why?
			"Cookie": ""
		};

		return options.do_request({
			url: url,
			method: "GET",
			headers: headers,
			onload: cb
		});
	};

	common_functions["flickr_find_api_info"] = function(options, api_cache, cb) {
		api_cache.fetch("flickr_api_info", cb, function (done) {
			common_functions["do_flickr_request"](options, "https://www.flickr.com/", function (resp) {
				var regex = /root\.YUI_config\.flickr\.api\.site_key\s*=\s*['"]([0-9a-f]+)['"]\s*;/;
				var matchobj = resp.responseText.match(regex);
				if (!matchobj) {
					console_error("Unable to find Flickr API key");
					return done(null, false);
				}

				var key = matchobj[1];
				if (!key || typeof key !== "string") {
					console_error("Unable to find Flickr API key");
					return done(null, false);
				}

				regex = /root\.auth\s*=\s*({.*?});/;
				matchobj = resp.responseText.match(regex);
				var auth = {};
				if (!matchobj) {
					console_error("Unable to find Flickr auth info");
				} else {
					try {
						auth = JSON_parse(matchobj[1]);
					} catch (e) {
						auth = {};
						console_error("Unable to find Flickr auth info");
					}
				}

				var reqid = "";
				matchobj = resp.responseText.match(/root\.reqId\s*=\s*["']([0-9a-f]+)["']\s*;/);
				if (matchobj) {
					reqid = matchobj[1];
				}

				if ("user" in auth && "nsid" in auth.user) {
					auth.nsid = auth.user.nsid;
				}

				var info = {
					key: key,
					nsid: auth.nsid,
					csrf: auth.csrf,
					reqId: reqid
				};

				done(info, 60 * 60);
			});
		});
	}

	common_functions["flickr_api_request"] = function(options, info, params, cb) {
		var url = "https://api.flickr.com/services/rest?csrf=";

		if (info.csrf) {
			url += info.csrf;
		}

		url += "&api_key=" + info.key + "&format=json&hermes=1&hermesClient=1";

		if (info.nsid) {
			url += "&viewerNSID=" + info.nsid;
		} else {
			url += "&viewerNSID=";
		}

		if (info.reqId) {
			url += "&reqId=" + info.reqId;
		}

		url += "&format=json&nojsoncallback=1&" + params;

		common_functions["do_flickr_request"](options, url, function(resp) {
			try {
				var json = JSON_parse(resp.responseText);

				if (json.stat === "fail") {
					console_error(json.message);
					return cb(null);
				}
			} catch (e) {
				console_error(e);
				return cb(null);
			}

			cb(json);
		});
	};

	common_functions["flickr_info_to_obj"] = function(info):BigImageInfoSObject {
		var getstr = function(prop):string {
			if (!prop || typeof prop === "string")
				return prop;

			return prop._content;
		};

		var extra:InfoExtraObject = {
			caption: getstr(info.title) || getstr(info.description)
		};

		var obj:BigImageInfoSObject = {
			extra: extra
		};

		var pathalias;
		if (info.owner) {
			pathalias = getstr(info.owner.nsid);
		} else {
			pathalias = getstr(info.pathalias);
		}
		var photo_id = getstr(info.id);
		if (pathalias && photo_id)
			extra.page = "https://www.flickr.com/photos/" + pathalias + "/" + photo_id;

		var largest = 0;
		var largest_url = null;
		for (var widthkey in info) {
			var match = widthkey.match(/^width_([0-9a-z]+)$/);
			if (!match)
				continue;

			var key = match[1];
			var urlkey = "url_" + key;
			var heightkey = "height_" + key;

			if (!(urlkey in info) || !(heightkey in info))
				continue;

			var our_size = info[widthkey] * info[heightkey];
			if (our_size > largest) {
				largest = our_size;
				largest_url = info[urlkey];
			}
		}

		if (largest_url)
			obj.url = largest_url;

		return obj;
	};

	common_functions["get_redirect_url"] = function(api_cache, options, url, cb) {
		var reqobj = url;
		if (typeof url === "string") {
			reqobj = {
				url: url
			};
		}

		url = reqobj.url;
		real_api_query(api_cache, options.do_request, "redirect:" + url, reqobj, cb, function(done, resp, cache_key) {
			if (!resp.finalUrl)
				return done(null, false);

			return done(resp.finalUrl, 60*60);
		});
	};

	let match_single_file_signature = function(data, signature) {
		if (typeof signature === "string") {
			let newsig = [];
			for (let i = 0; i < signature.length; i++) {
				newsig.push(signature.charCodeAt(i));
			}
			signature = newsig;
		}

		if (data.length < signature.length)
			return false;

		for (let i = 0; i < signature.length; i++) {
			if (signature[i] === null)
				continue;

			if (data[i] !== signature[i]) {
				return false;
			}
		}

		return true;
	}

	let match_file_signature = function(data) {
		// https://en.wikipedia.org/wiki/List_of_file_signatures
		const signatures = {
			mp4: [
				[ null, null, null, null, 0x66, 0x74, 0x79, 0x70, 0x69, 0x73, 0x6F, 0x6D ],
				[ null, null, null, null, 0x66, 0x74, 0x79, 0x70, 0x4D, 0x53, 0x4E, 0x56 ]
			],
			jpg: [
				[ 0xFF, 0xD8, 0xFF ]
				/*[ 0xFF, 0xD8, 0xFF, 0xE0, 0x00, 0x10, 0x4A, 0x46, 0x49, 0x46, 0x00, 0x01 ],
				[ 0xFF, 0xD8, 0xFF, 0xEE ],
				[ 0xFF, 0xD8, 0xFF, 0xE1, null, null, 0x45, 0x78, 0x69, 0x66, 0x00, 0x00 ],
				[ 0xFF, 0xD8, 0xFF, 0xE0 ]*/
			],
			gif: [ "GIF87a", "GIF89a" ],
			png: [
				[ 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A ]
			],
			webm: [
				[ 0x1A, 0x45, 0xDF, 0xA3 ]
			],
			webp: [
				[ 0x52, 0x49, 0x46, 0x46, null, null, null, null, 0x57, 0x45, 0x42, 0x50 ]
			]
		};

		for (let key in signatures) {
			for (let sig of signatures[key]) {
				if (match_single_file_signature(data, sig))
					return key;
			}
		}

		return null;
	};

	common_functions["get_file_signature"] = function(api_cache, options, url, cb) {
		var reqobj = url;
		if (typeof url === "string") {
			reqobj = {
				url: url
			};
		}

		url = reqobj.url;
		let cache_key = "file_signature:" + url;
		api_cache.fetch(cache_key, cb, function(done) {
			let handled = false;
			let onload_cb = function(resp) {
				if (handled || !resp.response)
					return;

				handled = true;
				req.abort();

				let signature;
				try {
					let view = new Uint8Array(resp.response);
					signature = match_file_signature(view);
				} catch (e) {
					console_error(cache_key, e);
					return done(null, false);
				}

				done(signature, 60*60);
			};

			reqobj.responseType = "arraybuffer";
			reqobj.onload = onload_cb;
			reqobj.onabort = onload_cb;
			reqobj.onprogress = function(resp) {
				if (resp.lengthComputable && resp.responseHeaders && resp.readyState >= 2 && resp.loaded >= 10) {
					onload_cb(resp);
				}
			};

			let req = options.do_request(reqobj);
		});
	};

	var get_domain_from_url = function(url) {
		return url.replace(/^[a-z]+:\/\/([^/]*)(?:\/+.*)?$/, "$1");
	};

	var get_origin_from_url = get_domain_from_url;

	var get_domain_nosub = function(domain) {
		var domain_nosub = domain.replace(/^.*\.([^.]*\.[^.]*)$/, "$1");
		// stream.ne.jp
		// *.edu.tr
		if (/^(?:(?:com?|org|net|edu)\.[a-z]{2}|(?:ne|or)\.jp)$/.test(domain_nosub)) {
			domain_nosub = domain.replace(/^.*\.([^.]*\.[^.]*\.[^.]*)$/, "$1");
		}

		return domain_nosub;
	};

	var looks_like_valid_link = function(src, el) {
		if (/\.(?:jpe?g|png|web[mp]|gif|mp4|mkv|og[gv]|svg)(?:[?#].*)?$/i.test(src))
			return true;

		if (el && check_highlightimgs_supported_image(el))
			return true;

		return false;
	};

	function bigimage(src, options) {
		// for element_ok with elements without sources (src == null)
		// function too large for analysis
		// @ts-expect-error
		if (!src) {
			src = "data:";
			//return src;
		}

		if (!src.match(/^(?:https?|x-raw-image):\/\//) && !src.match(/^(?:data|blob):/))
			return src;

		var origsrc = src;
		src = norm_url(src);

		var protocol;
		var domain;
		var port;

		if (!src.match(/^(?:data|x-raw-image|blob):/)) {
			// to prevent infinite loops
			if (src.length >= 65535)
				return src;

			var protocol_split = src.split("://");
			protocol = protocol_split[0];
			var splitted = protocol_split[1].split("/");
			domain = splitted[0];

			port = domain.replace(/.*:([0-9]+)$/, "$1");
			if (port === domain)
				port = "";
			domain = domain.replace(/(.*):[0-9]+$/, "$1");
		} else {
			//protocol = src.replace(/^([-a-z]+):.*/, "$1");
			protocol = "data";
			domain = "";
			src = ""; // FIXME: this isn't great
		}

		var domain_nowww = domain.replace(/^www\./, "");
		var domain_nosub = get_domain_nosub(domain);

		var amazon_container = null;
		if (string_indexof(domain, ".amazonaws.com") >= 0) {
			// https://timely-api-public.s3.us-west-2.amazonaws.com/116743_phpg7Ixww_small.JPG
			// https://pixls-discuss.s3.dualstack.us-east-1.amazonaws.com/optimized/3X/0/5/0530ef1424b7bace746cd10d2bc26b5cd58d5e27_2_690x388.png
			// http://stezor-img-res.s3-website.eu-central-1.amazonaws.com/600x0/0eefab17-aa8b-4f8e-9017-7b9442d1ee9e
			if (domain.match(/^s3(?:-website)?(?:\.dualstack)?(?:[-.][-a-z0-9]+)?\.amazonaws\.com/))
				amazon_container = src.replace(/^[a-z]*:\/\/[^/]*\/+([^/]*)\/.*/, "$1");
			else if (domain.match(/[^/]*\.s3(?:-website)?(?:\.dualstack)?(?:[-.][-a-z0-9]+)?\.amazonaws\.com/))
				amazon_container = src.replace(/^[a-z]*:\/\/([^/]*)\.s3(?:-website)?(?:\.dualstack)?(?:[-.][-a-z0-9]+)?\.amazonaws\.com\/.*/, "$1");
		}

		var googleapis_container = null;
		if (string_indexof(domain, ".googleapis.com") >= 0) {
			googleapis_container = src.replace(/^[a-z]*:\/\/[^/]*\/([^/]*)\/.*/, "$1");
		}

		var googlestorage_container = null;
		if (domain_nosub === "googleapis.com" &&
			(domain === "storage.googleapis.com" ||
			 domain.match(/\.storage\.googleapis\.com$/) ||
			 domain === "commondatastorage.googleapis.com" ||
			 domain.match(/\.commondatastorage\.googleapis\.com$/))) {
			if (domain.match(/\.[a-z]+\.googleapis\.com$/)) {
				googlestorage_container = src.replace(/^[a-z]*:\/\/([^/]*)\.[a-z]+\.googleapis\.com\/.*/, "$1");
			} else {
				googlestorage_container = src.replace(/^[a-z]*:\/\/[^/]*\/([^/]*)\/.*/, "$1");
			}
		}

		var digitalocean_container = null;
		if (domain_nosub === "digitaloceanspaces.com") {
			// https://sfo2.digitaloceanspaces.com/btrtoday/uploads/20190611114017/ft.Cyberpunk2077.jpg
			// https://btrtoday.sfo2.digitaloceanspaces.com/uploads/20190611114017/ft.Cyberpunk2077.jpg
			// https://movieassetsdigital.sgp1.cdn.digitaloceanspaces.com/thumb/ca584e585152f32d7eeb9fb1837732ea5566d431
			if (/^[a-z]{3}[0-9]+\.(?:cdn\.)?digitaloceanspaces\./.test(domain)) {
				digitalocean_container = src.replace(/^[a-z]*:\/\/[^/]*\/+([^/]*)\/.*/, "$1");
			} else {
				digitalocean_container = domain.replace(/^([^/.]+)\..*/, "$1");
			}
		}

		var host_domain = "";
		var host_domain_nowww = "";
		var host_domain_nosub = "";
		if (options.host_url) {
			host_domain = options.host_url.replace(/^[a-z]+:\/\/([^/]*?)(?::[0-9]+)?(?:\/.*)?$/,"$1");

			host_domain_nowww = host_domain.replace(/^www\./, "");
			host_domain_nosub = host_domain.replace(/^.*\.([^.]*\.[^.]*)$/, "$1");
			if (host_domain_nosub.match(/^co\.[a-z]{2}$/)) {
				host_domain_nosub = host_domain.replace(/^.*\.([^.]*\.[^.]*\.[^.]*)$/, "$1");
			}
		}

		try {
			if (options.document)
				document = options.document;
			if (options.window)
				window = options.window;
		} catch (e) {
			//console_warn("Failed to set document/window", e);
		}

		var problem_excluded = function(problem) {
			if (!options.exclude_problems)
				return false;

			if (typeof options.exclude_problems === "string" && options.exclude_problems === problem)
				return true;

			if (!is_array(options.exclude_problems))
				return false;

			return array_indexof(options.exclude_problems, problem) >= 0;
		};

		var api_cache = real_api_cache;
		if (options.use_api_cache === false) {
			api_cache = new IMUCache();
		}

		if (!options.api_cache) {
			options.api_cache = api_cache;
		}

		var api_query = function(key, request, cb, process) {
			return real_api_query(api_cache, options.do_request, key, request, cb, process);
		};

		var website_query = function(_options) {
			_options.do_request = options.do_request;
			_options.api_cache = api_cache;

			if (!_options.cb)
				_options.cb = options.cb;

			if (!_options.url)
				_options.url = src;

			return real_website_query(_options);
		};

		var newsrc, i, id, size, origsize, regex, match;

		// instart logic morpheus
		// test urls:
		// char - 5
		// https://c-6rtwjumjzx7877x24nrlncx2ewfspjwx2ehtr.g00.ranker.com/g00/3_c-6bbb.wfspjw.htr_/c-6RTWJUMJZX77x24myyux78x3ax2fx2fnrlnc.wfspjw.htrx2fzx78jw_stij_nrlx2f94x2f415044x2ftwnlnsfqx2fjzs-on-bts-wjhtwinsl-fwynx78yx78-fsi-lwtzux78-umtyt-z6x3fbx3d105x26vx3d05x26krx3doulx26knyx3dhwtux26hwtux3dkfhjx78x26n65h.rfwp.nrflj.yduj_$/$/$/$/$/$
		//   https://imgix.ranker.com/user_node_img/49/960599/original/eun-ji-won-recording-artists-and-groups-photo-u1?w=650&q=50&fm=jpg&fit=crop&crop=faces
		// https://c-6rtwjumjzx7877x24nrlncx2ewfspjwx2ehtr.g00.ranker.com/g00/3_c-6bbb.wfspjw.htr_/c-6RTWJUMJZX77x24myyux78x3ax2fx2fnrlnc.wfspjw.htrx2fzx78jw_stij_nrlx2f03x2f6698837x2ftwnlnsfqx2fmjj-hmzq-umtyt-z4x3fbx3d105x26vx3d05x26krx3doulx26knyx3dhwtux26hwtux3dkfhjx78x26n65h.rfwp.nrflj.yduj_$/$/$/$/$/$
		//   https://imgix.ranker.com/user_node_img/58/1143382/original/hee-chul-photo-u9?w=650&q=50&fm=jpg&fit=crop&crop=faces
		// https://c-6rtwjumjzx7877x24nrlncx2ewfspjwx2ehtr.g00.ranker.com/g00/3_c-6bbb.wfspjw.htr_/c-6RTWJUMJZX77x24myyux78x3ax2fx2fnrlnc.wfspjw.htrx2fzx78jw_stij_nrlx2f16x2f6757374x2ftwnlnsfqx2fmdzs-dtzsl-z7x3fbx3d105x26vx3d05x26krx3doulx26knyx3dhwtux26hwtux3dkfhjx78x26n65h.rfwp.nrflj.yduj_$/$/$/$/$/$
		//   https://imgix.ranker.com/user_node_img/61/1202829/original/hyun-young-u2?w=650&q=50&fm=jpg&fit=crop&crop=faces
		// https://c-7npsfqifvt0x24jnh-t-nto-dpnx2eblbnbjafex2eofu.g01.msn.com/g00/3_c-7x78x78x78.nto.dpn_/c-7NPSFQIFVT0x24iuuqtx3ax2fx2fjnh-t-nto-dpn.blbnbjafe.ofux2fufoboux2fbnqx2ffoujuzjex2fBBFFIbi.jnhx3fix3d2191x26x78x3d2031x26nx3d7x26rx3d71x26px3dgx26mx3dgx26yx3d665x26zx3d341x26j21d.nbslx3djnbhf_$/$/$/$/$
		//   https://img-s-msn-com.akamaized.net/tenant/amp/entityid/AAEEHah.img
		//
		// http://c-6rtwjumjzx7877x24bbbx2esfstanx78twx2ent.g00.tomshardware.com/g00/3_c-6bbb.ytrx78mfwibfwj.htr_/c-6RTWJUMJZX77x24myyux78x3ax2fx2fbbb.sfstanx78tw.ntx2fx40u6x2fHfhmjfgqjHXXx3fywfhpx26n65h.rfwp.qnsp.yduj_$/$/$
		//   https://www.nanovisor.io/@p1/CacheableCSS?track
		//
		// char - 8
		// https://c-5uwzmx78pmca09x24quoqfx2ezivsmzx2ekwu.g00.ranker.com/g00/3_c-5eee.zivsmz.kwu_/c-5UWZMXPMCA09x24pbbx78ax3ax2fx2fquoqf.zivsmz.kwux2fcamz_vwlm_quox2f25x2f716313x2fwzqoqvitx2fmuui-eibawv-x78mwx78tm-qv-bd-x78pwbw-c01x3fex3d903x26px3d903x26nqbx3dkzwx78x26kzwx78x3dnikmax26yx3d48x26nux3drx78ox26q98k.uizs.quiom.bgx78m_$/$/$/$/$/$
		//   https://imgix.ranker.com/user_node_img/47/938535/original/emma-watson-people-in-tv-photo-u23?w=125&h=125&fit=crop&crop=faces&q=60&fm=jpg
		//
		// http://c-6rtwjumjzx7877x24zlh-56x2ehfkjrtrx78yfynhx2ehtr.g00.cafemom.com/g00/3_c-6ymjx78ynw.hfkjrtr.htr_/c-6RTWJUMJZX77x24myyux78x3ax2fx2fzlh-56.hfkjrtrx78yfynh.htrx2fljsx2fhwtux2f705x2f695x2f25x2f7563x2f57x2f56x2f65x2f82x2fibx2futpmy32vnt27.uslx3fn65h.rfwpx3dnrflj_$/$/$/$/$/$/$/$/$/$/$/$/$
		//   https://ugc-01.cafemomstatic.com/gen/crop/250/140/70/2018/02/01/10/37/dw/pokht87qio72.png
		if (string_indexof(src, "/g00/") >= 0 && /\.g0[0-9]\./.test(domain)) {
			var str = "";
			//var i;

			// decode x[0-9][0-9] to \x[0-9][0-9]
			for (i = 0; i < src.length; i++) {
				if (src[i] == 'x') {
					var char = parseInt(src[i + 1] + src[i + 2], 16);
					str += string_fromcharcode(char);
					i += 2;
				} else {
					str += src[i];
				}
			}

			str = str.split("/").slice(5).join("/").split("$").slice(1).join("$");
			if (str && string_indexof(str, "://") < 10 && str[1] == str[2]) {
				var diff = mod(str.charCodeAt(0) - 'h'.charCodeAt(0), 26);

				// char - diff
				var str1 = "";
				for (i = 0; i < str.length; i++) {
					var code = str.charCodeAt(i);
					if (code > 47 && code < 58) {
						/* number */
						code = (mod((code - 48 - diff), 10) + 48);
					} else if (code > 64 && code < 91) {
						/* uppercase */
						code = (mod((code - 65 - diff),26) + 65);
					} else if (code > 96 && code < 123) {
						/* lowercase */
						code = (mod((code - 97 - diff),26) + 97);
					}
					str1 += string_fromcharcode(code);
				}

				var urlparts = str1;
				if (urlparts && string_indexof(urlparts, "http") === 0) {
					var $s = urlparts.replace(/.*?([$/]*)$/, "$1");
					if ($s !== urlparts && $s) {
						var count = $s.split("$").length - 1;
						if (count > 0) {
							// + 2 for http://
							var newurl = urlparts.split("/").slice(0, count + 2).join("/");

							// https://ugc-01.cafemomstatic.com/gen/crop/250/140/70/2018/02/01/10/37/dw/pokht87qio72.png?i10c.mark=image_$
							//newurl = newurl.split("&").slice(0,-1).join("&"); // remove &i10c.mark.link.type_...
							newurl = newurl.replace(/[?&]i10c\.mark[^/]*$/, "");

							if (newurl)
								return newurl;
						}
					}
				} else {
					console_log(urlparts);
				}
			}
		}

		// -- start bigimage --

		if ((host_domain_nowww === "google.com" ||
			 domain_nowww === "google.com") && /^[a-z]+:\/\/[^/]+\/+recaptcha\//.test(options.host_url)) {
			return {
				url: origsrc,
				bad: "mask"
			};
		}

		if (host_domain === "assets.hcaptcha.com" || domain === "assets.hcaptcha.com" || domain === "imgs.hcaptcha.com") {
			return {
				url: origsrc,
				bad: "mask"
			};
		}

		/*if (false && string_indexof(domain, "img.tenasia.hankyung.com") >= 0) {
			// http://img.hankyung.com/photo/201612/AA.12967766.4.jpg -- larger than .1.
			//   http://img.hankyung.com/photo/201612/AA.12967766.1.jpg
			return src.replace(/-[0-9]+x[0-9]+\.([^/.]*)$/, ".$1");
		}*/

		if (domain === "img.hankyung.com" ||
			// http://img.hankyung.com/photo/201612/AA.12967766.4.jpg -- larger than .1.
			//   http://img.hankyung.com/photo/201612/AA.12967766.1.jpg
			domain === "img.tenasia.hankyung.com") {
			// http://img.hankyung.com/photo/201808/ZK.17491055.3.jpg
			//   http://img.hankyung.com/photo/201808/ZK.17491055.1.jpg -- watermark
			// http://img.hankyung.com/photo/201902/01.19032633.3.jpg
			//   http://img.hankyung.com/photo/201902/01.19032633.1.jpg -- no watermark
			// http://img.hankyung.com/photo/201802/ZA.16036542.1.jpg -- 3696x2778 (4 is not available)
			// https://img.hankyung.com/photo/201906/01.19968607.1-1200x.jpg -- 1200x795, upscaled
			//   https://img.hankyung.com/photo/201906/01.19968607.1.jpg
			// https://img.hankyung.com/photo/201506/ZA.10064438.1.jpg -- 4078x2155
			// http://ac.hankyung.com/data/file/53fa81e2501efc21f89ed7a440d2d22c.JPG -- 4032x3024
			//
			// thanks to Bobfrnw on greasyfork for reporting this:
			// http://img.hankyung.com/photo/201903/03.19066867.4.jpg -- no watermark, larger (1800x1200)
			//   http://img.hankyung.com/photo/201903/03.19066867.1.jpg -- watermark, smaller (620x420)
			newsrc = src.replace(/(\/photo\/+[0-9]{6}\/+[0-9A-Z]{2}\.[0-9]+\.[0-9]+)-[0-9]*x[0-9]*(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
			if (newsrc !== src)
				return newsrc;

			if (src.match(/\.[0-9](\.[^/.]*)(?:[?#].*)?$/)) {
				newsrc = src.replace(/[?#].*$/, "");
				if (newsrc !== src)
					return newsrc;

				return [
					src.replace(/\.[0-9](\.[^/.]*)$/, ".4$1"),
					src.replace(/\.[0-9](\.[^/.]*)$/, ".1$1")
				];
			}
		}

		if (domain_nosub === "naver.net" ||
			domain_nosub === "pstatic.net") {
			if (string_indexof(domain, "gfmarket.") >= 0) {
				return src;
			}

			// https://ssl.pstatic.net/img.tvcast/pc/img/sp_tvcast75.png
			// https://ssl.pstatic.net/static.post/image/im/blank.gif
			// https://ssl.pstatic.net/static.post/image/im/sp_181016.png
			// https://ssl.pstatic.net/static/m/vlive/pc/2018/05/29/profile_noimg_small.png
			if (/\/img\.tvcast\/+pc\/+img\/+/.test(src) ||
				/\/static\/+m\/+vlive\/+pc\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}profile_noimg_[a-z]+\./.test(src) ||
				/\/static\.post\/+image\/+im\/+/.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}

			// http://tv03.search.naver.net/thm?size=120x150&quality=9&q=http://sstatic.naver.net/people/portrait/201401/20140127145415321.jpg
			//   http://sstatic.naver.net/people/portrait/201401/20140127145415321.jpg
			// https://tv.pstatic.net/thm?size=120x150&quality=9&q=http://sstatic.naver.net/people/portrait/201604/20160426164831645.jpg
			//   http://sstatic.naver.net/people/portrait/201604/20160426164831645.jpg
			if (domain.match(/tv[0-9]*\.search\.naver\.net/) ||
				domain.match(/tv[0-9]*\.pstatic\.net/)) {
				return src.replace(/.*\/thm\?.*?q=/, "");
			}

			if (src.match(/[?&]src=/)) {
				return decodeURIComponent(src.replace(/.*src=*([^&]*).*/, "$1")).replace(/^"*/, '').replace(/"$/, '');
			}

			// for some reason it doesn't work with (some?) cafe files?
			// test:
			// https://cafeptthumb-phinf.pstatic.net/20150611_228/pht0829_1434017180824U5auR_JPEG/U01.jpg?type=w1
			// proper:
			// https://cafeptthumb-phinf.pstatic.net/20150611_228/pht0829_1434017180824U5auR_JPEG/U01.jpg

			// however in cases such as
			// https://postfiles.pstatic.net/MjAxNzA2MjVfMjcg/MDAxNDk4MzY2NTU1NDA1._jJeyTBgxoS4OUVFnfUpCTwFlWgsQANPgd5g4Wr__2kg._o3wfc4uAzyG_buHGKqENCl6g1pDt6-thoX-akGet9Qg.JPEG.amyo916/%EB%B0%A4%EB%B9%84%EB%85%B8_%EC%9D%80%EC%86%943.jpg?type=w1
			// doing
			// https://postfiles.pstatic.net/MjAxNzA2MjVfMjcg/MDAxNDk4MzY2NTU1NDA1._jJeyTBgxoS4OUVFnfUpCTwFlWgsQANPgd5g4Wr__2kg._o3wfc4uAzyG_buHGKqENCl6g1pDt6-thoX-akGet9Qg.JPEG.amyo916/%EB%B0%A4%EB%B9%84%EB%85%B8_%EC%9D%80%EC%86%943.jpg
			// returns a smaller file
			// https://blogfiles.pstatic.net/MjAxNzA2MjVfMjcg/MDAxNDk4MzY2NTU1NDA1._jJeyTBgxoS4OUVFnfUpCTwFlWgsQANPgd5g4Wr__2kg._o3wfc4uAzyG_buHGKqENCl6g1pDt6-thoX-akGet9Qg.JPEG.amyo916/%EB%B0%A4%EB%B9%84%EB%85%B8_%EC%9D%80%EC%86%943.jpg is the same size as ?type=w1
			//
			// https://postfiles.pstatic.net/MjAxNzA5MjFfMTg1/MDAxNTA1OTk3ODQzNjU3.oR8-_8p2zkJuFfz41D_ABFDKc82luEh45nxxiH1riAUg.NqrW3NUoqqR_a3Pqbg0jAttIrNst4k5BdFG2M7WNfQsg.JPEG.bho1000/IMG_4092_resize.JPG?type=w966 (900x600)
			//  https://postfiles.pstatic.net/MjAxNzA5MjFfMTg1/MDAxNTA1OTk3ODQzNjU3.oR8-_8p2zkJuFfz41D_ABFDKc82luEh45nxxiH1riAUg.NqrW3NUoqqR_a3Pqbg0jAttIrNst4k5BdFG2M7WNfQsg.JPEG.bho1000/IMG_4092_resize.JPG = smallest
			//  https://postfiles.pstatic.net/MjAxNzA5MjFfMTg1/MDAxNTA1OTk3ODQzNjU3.oR8-_8p2zkJuFfz41D_ABFDKc82luEh45nxxiH1riAUg.NqrW3NUoqqR_a3Pqbg0jAttIrNst4k5BdFG2M7WNfQsg.JPEG.bho1000/IMG_4092_resize.JPG?type=w1 = largest (eq to w966)
			//  https://postfiles.pstatic.net/MjAxNzA5MjFfMTg1/MDAxNTA1OTk3ODQzNjU3.oR8-_8p2zkJuFfz41D_ABFDKc82luEh45nxxiH1riAUg.NqrW3NUoqqR_a3Pqbg0jAttIrNst4k5BdFG2M7WNfQsg.JPEG.bho1000/IMG_4092_resize.JPG?type=w2 = smaller
			//  https://postfiles.pstatic.net/MjAxNzA5MjFfMTg1/MDAxNTA1OTk3ODQzNjU3.oR8-_8p2zkJuFfz41D_ABFDKc82luEh45nxxiH1riAUg.NqrW3NUoqqR_a3Pqbg0jAttIrNst4k5BdFG2M7WNfQsg.JPEG.bho1000/IMG_4092_resize.JPG?type=w3 = smallest (but larger than without)
			//  https://blogfiles.pstatic.net/MjAxNzA5MjFfMTg1/MDAxNTA1OTk3ODQzNjU3.oR8-_8p2zkJuFfz41D_ABFDKc82luEh45nxxiH1riAUg.NqrW3NUoqqR_a3Pqbg0jAttIrNst4k5BdFG2M7WNfQsg.JPEG.bho1000/IMG_4092_resize.JPG = largest (eq to w966)

			// there is also ?type=w2 to consider, but with no change i've seen so far

			// ?type=w1 doesn't work:
			//
			// https://img-pholar.pstatic.net/20161120_290/1479626135018LJPrw_JPEG/p?type=ffn720_720
			//  https://img-pholar.pstatic.net/20161120_290/1479626135018LJPrw_JPEG/p?type=w1 is broken
			//  https://img-pholar.pstatic.net/20161120_290/1479626135018LJPrw_JPEG/p is ok
			// http://dic.phinf.naver.net/20170424_170/1493009773923GjUgo_JPEG/196_cobis_20070206153112.jpg?type=nf118_80_q80

			// ?type=w1 works:
			//
			// https://postfiles.pstatic.net/MjAxNzEyMjNfMTc5/MDAxNTEzOTk4OTA3MzQ0.3GiIBnqVyIshzpThGEE92-RMzAWDRShnmSwfZyviyVQg.OiRXD8qLAXSNXgDUF1yPsXnx8SPxj3RWhYr-eUoCWhUg.JPEG.com862/IMG_1826.jpg?type=w773
			//   https://postfiles.pstatic.net/MjAxNzEyMjNfMTc5/MDAxNTEzOTk4OTA3MzQ0.3GiIBnqVyIshzpThGEE92-RMzAWDRShnmSwfZyviyVQg.OiRXD8qLAXSNXgDUF1yPsXnx8SPxj3RWhYr-eUoCWhUg.JPEG.com862/IMG_1826.jpg?type=w1
			// http://sstatic.naver.net/people/194/201710101543498651.jpg
			//   http://sstatic.naver.net/people/194/201710101543498651.jpg?type=w1
			// http://sstatic.naver.net/people/portraitGroup/201709/20170929171408460-4330243.jpg
			//   http://sstatic.naver.net/people/portraitGroup/201709/20170929171408460-4330243.jpg?type=w1

			// ?type=w1 makes a smaller file:
			// http://blogfiles.naver.net/MjAxNzEyMTNfNzAg/MDAxNTEzMTcxOTYwMTYy.LUNqGf98PVcskK0cLDV3Gil8H861pt8Y-Mv1PP0BnLcg.gC3LNf7q0rJZJ044ZjdDbUQTGqXIYzL-bRiKyxYocDcg.PNG.vvyeo/1_%BD%BA%C0%A7%C4%A1_.png
			//   http://blogfiles.pstatic.net/MjAxNzEyMTNfNzAg/MDAxNTEzMTcxOTYwMTYy.LUNqGf98PVcskK0cLDV3Gil8H861pt8Y-Mv1PP0BnLcg.gC3LNf7q0rJZJ044ZjdDbUQTGqXIYzL-bRiKyxYocDcg.PNG.vvyeo/1_%BD%BA%C0%A7%C4%A1_.png?type=w1
			//   http://blogfiles.pstatic.net/MjAxNzEyMTNfNzAg/MDAxNTEzMTcxOTYwMTYy.LUNqGf98PVcskK0cLDV3Gil8H861pt8Y-Mv1PP0BnLcg.gC3LNf7q0rJZJ044ZjdDbUQTGqXIYzL-bRiKyxYocDcg.PNG.vvyeo/1_%BD%BA%C0%A7%C4%A1_.png?type=w2 (even smaller)
			//   http://blogfiles.pstatic.net/MjAxNzEyMTNfNzAg/MDAxNTEzMTcxOTYwMTYy.LUNqGf98PVcskK0cLDV3Gil8H861pt8Y-Mv1PP0BnLcg.gC3LNf7q0rJZJ044ZjdDbUQTGqXIYzL-bRiKyxYocDcg.PNG.vvyeo/1_%BD%BA%C0%A7%C4%A1_.png?type=w3 (smallest)
			// with that being said, type=w3 does look the least stretched. however, with other images, it just resizes, no un-stretching
			if (domain.search(/^[-a-z0-9]*cafe[-a-z0-9]*\./) < 0 &&
				domain.search(/^img-pholar[-a-z0-9]*\./) < 0 &&
				domain.search(/^shopping-phinf[-a-z0-9]*\./) < 0 &&
				domain.search(/^dic.phinf.naver.net/) < 0 &&
				domain.search(/^musicmeta.phinf.naver.net/) < 0 && false)
				src = src.replace(/\?type=[^/]*$/, "?type=w1");
			else
				src = src.replace(/\?type=[^/]*$/, "");

			src = src.replace(/#[^/]*$/, "");

			if (domain.search(/^[-a-z0-9]*blog[-a-z0-9]*\./) < 0 &&
				domain.search(/^[-a-z0-9]*cafe[-a-z0-9]*\./) < 0 &&
				domain.search(/^[-a-z0-9]*news[-a-z0-9]*\./) < 0 &&
				domain.search(/^[-a-z0-9]*post[-a-z0-9]*\./) < 0 &&
				domain.search(/^[-a-z0-9]*v.phinf[-a-z0-9]*\./) < 0 &&
				domain.search(/^[-a-z0-9]*shopping.phinf[-a-z0-9]*\./) < 0 &&
				domain.search(/^[-a-z0-9]*musicmeta.phinf[-a-z0-9]*\./) < 0) {
				return src;
			}

			// http://post.phinf.naver.net/20160324_74/1458783545129zPGJg_JPEG/%B0%AD%B3%B2TV_%B0%C9%B1%D7%B7%EC_%BD%BA%C0%A7%C4%A1%BA%A3%B8%AE_%B0%A1%BB%F3%C7%F6%BD%C7_360VR_%BC%EE%C4%C9%C0%CC%BD%BA_%B9%C2%C1%F7%BA%F1%B5%F0%BF%C0_%BB%E7%C1%F82.jpg/IT8SeAh7YSaM55bq7KMOEE5ImDlU.jpg
			//   http://post-phinf.pstatic.net/20160324_74/1458783545129zPGJg_JPEG/%B0%AD%B3%B2TV_%B0%C9%B1%D7%B7%EC_%BD%BA%C0%A7%C4%A1%BA%A3%B8%AE_%B0%A1%BB%F3%C7%F6%BD%C7_360VR_%BC%EE%C4%C9%C0%CC%BD%BA_%B9%C2%C1%F7%BA%F1%B5%F0%BF%C0_%BB%E7%C1%F82.jpg/IT8SeAh7YSaM55bq7KMOEE5ImDlU.jpg

			// works:
			// https://s.pstatic.net/shopping.phinf/20180115_4/ce3dfbda-c44b-43aa-83d0-2ffb8fa3dd47.jpg
			//   https://shopping-phinf.pstatic.net/20180115_4/ce3dfbda-c44b-43aa-83d0-2ffb8fa3dd47.jpg
			// http://imgnews.pstatic.net/image/origin/433/2017/07/31/33727.jpg
			//   http://s.pstatic.net/imgnews/image/origin/433/2017/07/31/33727.jpg
			// http://imgnews.pstatic.net/image/origin/416/2018/04/04/223346.jpg
			// doesn't work:
			// http://dic.phinf.naver.net/20170424_126/14930112296681HPid_JPEG/14051_getty_20080128162512.jpg
			//   http://s.pstatic.net/dic.phinf/20170424_126/14930112296681HPid_JPEG/14051_getty_20080128162512.jpg
			//
			// can't remove ?
			// http://dbscthumb.phinf.naver.net/4209_000_1/20160408160657214_SYEAAJM97.jpg/5%EA%B0%90%EA%B5%AC.jpg?type=r160
			//   http://dbscthumb-phinf.pstatic.net/4209_000_1/20160408160657214_SYEAAJM97.jpg/5%EA%B0%90%EA%B5%AC.jpg?type=r160

			newsrc = src
				.replace(/postfiles[^/.]*\./, "blogfiles.")
				.replace(/m?blogthumb[^./]*/, "blogfiles")
				.replace(/blogfiles[^/.]*\./, "blogfiles.")
				.replace(/postfiles[^/.]*\./, "blogfiles.")

				.replace(/cafeptthumb[^./]*/, "cafefiles")

				// https://cafeskthumb-phinf.pstatic.net/MjAxNzAyMjhfMjIw/MDAxNDg4Mjg1NzU1ODY0.FAX24pXzUaNN-_C5yRRGcJJsswcKtGmsdOi2hTQQfJog.muWF7CuoY7-HKdrPQRYDyp8OlZGyITwmkcGQgzkxzFcg.PNG.yj991224/main-cover1.png?type=w740
				.replace(/cafeskthumb[^./]*/, "cafefiles")
				.replace(/m?cafethumb[^./]*/, "cafefiles")
				.replace(/cafefiles[^/.]*\./, "cafefiles.")

				.replace(/mimgnews[^./]*/, "imgnews")

				//.replace(/post\.phinf\./, "post-phinf.") // doesn't work anymore
				// http://v.phinf.naver.net/20180117_164/1516193382182Jx9lx_JPEG/df9c0c3b-fb84-11e7-9554-000000008ca5_07.jpg
				.replace(/v\.phinf\./, "v-phinf.")
				// http://musicmeta.phinf.naver.net/album/002/152/2152949.jpg
				.replace(/musicmeta\.phinf\./, "musicmeta-phinf.")
				.replace(/shopping\.phinf\./, "shopping-phinf.")
				// http://blogpfthumb.phinf.naver.net/20131119_160/thenote_13847965353237CovB_JPEG/controlrooma.jpg
				//   http://blogpfthumb-phinf.pstatic.net/20131119_160/thenote_13847965353237CovB_JPEG/controlrooma.jpg
				.replace(/blogpfthumb\.phinf\./, "blogpfthumb-phinf.")

				//.replace(/\.phinf\./, ".")
				//.replace(".naver.net/", ".pstatic.net/")

				// http://mblogthumb4.phinf.naver.net/20140302_211/ttlyoung333_1393761808293P7TKj_JPEG/17.jpg?type=w2 -- normal
				//   http://blogfiles.pstatic.net/20140302_211/ttlyoung333_1393761808293P7TKj_JPEG/17.jpg -- cropped and upscaled (same as type=w1 and type=w2)
				//   http://blogfiles.naver.net/20140302_211/ttlyoung333_1393761808293P7TKj_JPEG/17.jpg -- works
				// https for naver.net doesn't work (invalid certificate)
				.replace(/(:\/\/blogfiles\.)pstatic\.net\/+/, "$1naver.net/")
				.replace(/^https?(:\/\/[^/.]*(?:phinf|files)\.naver\.net\/)/, "http$1");
			if (newsrc !== src)
				return newsrc;

			return {
				url: src,
				headers: {
					Referer: ""
				},
				referer_ok: {
					same_domain_nosub: true
				},
				head_wrong_contenttype: true // no content-type
			};
		}

		if ((domain_nosub === "daumcdn.net" ||
			 domain_nosub === "kakaocdn.net") &&
			string_indexof(src, "/thumb/") >= 0) {
			// https://search1.kakaocdn.net/thumb/C72x90h.q85/?fname=http%3A%2F%2Fcfile66.uf.daum.net%2Fimage%2F26191E4558DC88D52BF198
			//   http://cfile66.uf.daum.net/image/26191E4558DC88D52BF198
			return decodeURIComponent(src.replace(/.*fname=([^&]*).*/, "$1"));
		}

		/*if (false && (string_indexof(src, "daumcdn.net/argon/") >= 0 ||
					  string_indexof(src, ".kakaocdn.net/argon/") >= 0)) {
			// wip
			// https://search3.kakaocdn.net/argon/600x0_65_wr/CdIaPo4lsew
			// https://search3.kakaocdn.net/argon/0x200_85_hr/CdIaPo4lsew
		}*/

		if (domain_nosub === "daumcdn.net" && /^(?:t|img)[0-9]*\./.test(domain)) {
			// http://t1.daumcdn.net/cafe_image/fancafe/2018/fancafe-cheer-color-bg.png
			// https://t1.daumcdn.net/kakaotv/2016/pw/new/slider_mask_v2.png
			// https://img1.daumcdn.net/kakaotv/2016/player/web/pc/bg_box.png -- thanks to ambler on discord for reporting
			// https://t1.daumcdn.net/kakaotv/2016/pw/img_backlogo.png
			// https://t1.daumcdn.net/kakaotv/2016/pw/img_backcover.jpg
			// https://t1.daumcdn.net/tistory_admin/lib/lightbox/images/next.png
			if (/\/cafe_image\/+fancafe\/+[0-9]+\/+fancafe-cheer-color-bg\./.test(src) ||
				/\/tistory_admin\/+lib\/+lightbox\//.test(src) ||
				/\/kakaotv\/+[0-9]+\/+(?:pw|player\/+web)\/+(?:(?:new|pc)\/+)?(?:slider_mask|bg_box|img_back(?:logo|cover))/.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}
		}

		if ((domain_nosub === "tistory.com" ||
			  domain_nosub === "daum.net") &&
			 (domain.match(/\.uf\.[a-z]+\.[a-z]+$/) ||
			  domain.match(/^cfs[0-9]*\./))) {
			// http://cfile21.uf.tistory.com/image/994900485A9A66EF2564F4 -- 1000x1500
			//   http://cfile21.uf.tistory.com/original/994900485A9A66EF2564F4 -- 1333x2000
			// http://cfile37.uf.daum.net/C160x160/23138C47524BB2D42DD743
			//   http://cfile37.uf.daum.net/original/23138C47524BB2D42DD743
			// http://cfs9.tistory.com/image/30/tistory/2008/06/12/11/13/4850862dc2093
			//   http://cfs9.tistory.com/original/30/tistory/2008/06/12/11/13/4850862dc2093
			// http://cfs11.blog.daum.net/image/10/blog/2008/05/25/00/14/483830c0500a4
			//   http://cfs11.blog.daum.net/original/10/blog/2008/05/25/00/14/483830c0500a4
			// http://cfile23.uf.tistory.com/media/1947E0374F15B01F148CE6
			//   http://cfile23.uf.tistory.com/original/1947E0374F15B01F148CE6
			// unhandled:
			// https://tistory4.daumcdn.net/tistory/458362/attach/3a4fa78bca8649b6a44bf4627075837e
			// http://t1.daumcdn.net/tvpot/thumb/s07a6T8ejtee6OXNNXjQtVE/thumb.png?ts=1523956270
			//
			// https://t1.daumcdn.net/cfile/tistory/996D34465B12921B1A
			//   http://cfile2.uf.tistory.com/original/996D34465B12921B1AE97C
			//   996D34465B12921B1A
			//   996D34465B12921B1AE97C
			// https://t1.daumcdn.net/cfile/tistory/996A16355B12784D0B
			//   http://cfile5.uf.tistory.com/original/996A16355B12784D0B9CF8
			//   996A16355B12784D0B
			//   996A16355B12784D0B9CF8
			// credit to severus on greasyfork:
			// https://t1.daumcdn.net/cfile/tistory/9921ED405B0FCEDB17 -- 1600x2036
			//   http://cfile25.uf.tistory.com/original/9921ED405B0FCEDB17DF05 -- 2200x2800
			//   9921ED405B0FCEDB17
			//   9921ED405B0FCEDB17DF05
			return src
				.replace("/attach/", "/original/")
				.replace("/media/" , "/original/")
				.replace("/image/", "/original/")
				.replace(/\/[RTC][0-9]*x[0-9]*\//, "/original/");
		}

		if (domain_nosub === "daumcdn.net" &&
			domain.match(/^t[0-9]*\.daumcdn\.net/)) {
			// credit to 灰原米兰 on greasyfork for finding this pattern:
			// https://t1.daumcdn.net/cfile/tistory/99DECC4B5B1150482D
			//   https://t1.daumcdn.net/cfile/tistory/99DECC4B5B1150482D?original
			// credit again to severus for the link:
			// https://t1.daumcdn.net/cfile/tistory/9921ED405B0FCEDB17 -- 1600x2036
			//   https://t1.daumcdn.net/cfile/tistory/9921ED405B0FCEDB17?original -- 2200x2800
			//
			// https://t1.daumcdn.net/cfile/211DD54C5627181233
			//   https://t1.daumcdn.net/cfile/211DD54C5627181233?original -- no difference
			return src.replace(/(\/cfile\/(?:tistory\/)?[0-9A-F]+)(?:\\?.*)$/, "$1?original");
		}

		if (domain_nosub === "daumcdn.net" &&
			domain.match(/^i[0-9]*\.media\./)) {
			// http://i1.media.daumcdn.net/uf/image/U01/agora/5134354D420CC80021
			//   http://i1.media.daumcdn.net/uf/original/U01/agora/5134354D420CC80021
			return src.replace(/\/uf\/image\//, "/uf/original/");
		}

		if (domain_nosub === "daumcdn.net" &&
			domain.match(/^[mi][0-9]*\.daumcdn\.net/)) {
			// http://i1.daumcdn.net/cfile37/C160x160/23138C47524BB2D42DD743
			//   http://cfile37.uf.daum.net/C160x160/23138C47524BB2D42DD743
			// http://m1.daumcdn.net/cfile81/C41x41/150A68444FFA321A18F2DB
			//   http://cfile81.uf.daum.net/C41x41/150A68444FFA321A18F2DB

			// unhandled:
			// http://i2.daumcdn.net/thumb/S160x160/18287A354FA757530767B0 (https://warmpm.tistory.com/798)
			return src.replace(/:\/\/[^/]*\/(cfile[0-9]+)\//, "://$1.uf.daum.net/");
		}

		if (domain_nosub === "daumcdn.net" && /^i[0-9]*\.tvpot\./.test(domain)) {
			// http://i1.tvpot.daumcdn.net/svc/image/U03/tvpot_thumb/7sbtgVQMZk8$/thumb.jpg.mini
			//   http://i1.tvpot.daumcdn.net/svc/image/U03/tvpot_thumb/7sbtgVQMZk8$/thumb.jpg
			return src.replace(/(\/thumb\.[a-z0-9]+)\.mini(?:[?#].*)?$/, "$1");
		}

		if (domain === "image.news1.kr" ||
			// thanks to anonymous for reporting:
			// https://i2n.news1.kr/system/photos/2024/5/2/6629066/article.jpg
			//   https://i2n.news1.kr/system/photos/2024/5/2/6629066/original.jpg
			domain === "i2n.news1.kr") {
			// http://image.news1.kr/system/thumbnails/photos/2018/2/19/2973418/thumb_336x230.jpg
			//   http://image.news1.kr/system/photos/2018/2/19/2973418/original.jpg
			// http://image.news1.kr/system/photos/2014/8/22/985836/main_thumb.jpg
			//   http://image.news1.kr/system/photos/2014/8/22/985836/original.jpg/dims/optimize
			//   http://image.news1.kr/system/photos/2014/8/22/985836/original.jpg
			// http://image.news1.kr/system/photos/2018/6/15/3162887/high.jpg -- 1400x1867
			//   http://image.news1.kr/system/photos/2018/6/15/3162887/original.jpg -- 1500x2000
			newsrc = src.replace(/\/+dims\/.*/, "");
			if (newsrc !== src)
				return newsrc;

			newsrc = src
				.replace(/\/thumbnails\/(.*)\/thumb_[0-9]+x(?:[0-9]+)?(\.[^/.]*)$/, "/$1/original$2")
				.replace(/main_thumb\.jpg/, "original.jpg")
				.replace(/article.jpg/, "original.jpg")
				.replace(/no_water.jpg/, "original.jpg")
				.replace(/photo_sub_thumb.jpg/, "original.jpg")
				.replace(/section_top\.jpg/, "original.jpg")
				.replace(/high\.jpg/, "original.jpg");

			var filename = src.replace(/.*\/photos\/+[0-9]{4}\/+(?:[0-9]{1,2}\/+){2}([0-9]+)\/+.*$/, "$1");
			if (filename !== src) {
				return {
					url: newsrc,
					filename: filename,
					extra: {
						page: "http://news1.kr/photos/view/?" + filename
					},
					can_head: false // hangs, thanks to f2005 on discord for reporting
				};
			}

			return newsrc;
		}

		if (string_indexof(domain, ".joins.com") >= 0) {
			// need test case
			newsrc = src.replace(/\.tn_[0-9]*\..*/, "");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "ir.joins.com" ||
			// https://loki.zhibotie.net/?u=https%3A%2F%2Fimg3.doubanio.com%2Fview%2Fgroup_topic%2Flarge%2Fpublic%2Fp66834704.jpg
			//   https://img3.doubanio.com/pview/group_topic/large/public/p66834704.jpg
			domain === "loki.zhibotie.net") {
			// http://ir.joins.com/?u=http%3A%2F%2Fpds.joins.com%2F%2Fnews%2Fcomponent%2Fhtmlphoto_mmdata%2F201802%2F02%2Ff1272e1a-836b-4e54-be62-1ab42de3b53b.jpg
			//   http://pds.joins.com//news/component/htmlphoto_mmdata/201802/02/f1272e1a-836b-4e54-be62-1ab42de3b53b.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/.*?[?&]u=([^&]*).*$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nosub === "koreadaily.com" &&
			domain.match(/^thumb[0-9]*\./)) {
			// http://thumb5.koreadaily.com/tn.dll?w=450&h=253&url=http://pds.joins.com/news/component/htmlphoto_mmdata/201808/21/687941c0%2Dc590%2D4222%2D9263%2D669a56ff3bbc.jpg
			//   http://pds.joins.com/news/component/htmlphoto_mmdata/201808/21/687941c0-c590-4222-9263-669a56ff3bbc.jpg
			// http://thumb5.koreadaily.com/cache/pds_joins_com/news/component/htmlphoto_mmdata/201808/21/F450x253_687941c0-c590-4222-9263-669a56ff3bbc_jpg.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/tn\.dll.*?[?&]url=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeURIComponent(newsrc);
		}

		if (domain === "uhd.img.topstarnews.net") {
			// http://www.topstarnews.net/news/articleView.html?idxno=59506
			// http://uhd.img.topstarnews.net/wys2/file_attach/2014/05/20/1400555456-84-org.jpg -- dead
			//   http://www.topstarnews.net/news/photo/first/201405/img_59506_1_org.jpg
			return src
				.replace("/file_attach_thumb/", "/file_attach/")
				.replace(/_[^/]*[0-9]*x[0-9]*_[^/]*(\.[^/]*)$/, "-org$1")
				.replace(/(-[0-9]*)(\.[^/]*)$/, "$1-org$2");
		}

		if (domain_nowww === "topstarnews.net" ||
			domain === "cdn.topstarnews.net" ||
			// http://cds.topstarnews.net/news/thumbnail/201911/698561_409137_392_v150.jpg
			//   http://cds.topstarnews.net/news/photo/201911/698561_409137_392_org.jpg
			domain === "cds.topstarnews.net") {
			// http://www.topstarnews.net/news/thumbnail/201802/365216_8748_4653_v150.jpg
			//   http://www.topstarnews.net/news/photo/201802/365216_8748_4653_org.jpg
			// http://www.topstarnews.net/news/photo/201802/364365_7857_4310.jpg
			//   http://www.topstarnews.net/news/photo/201802/364365_7857_4310_org.jpg
			// http://www.topstarnews.net/news/thumbnail/first/201710/img_319718_1_v150.jpg
			//   http://www.topstarnews.net/news/photo/first/201710/img_319718_1_org.jpg
			//   http://cdn.topstarnews.net/news/photo/first/201710/img_319718_1_org.jpg

			// credit to Gyuri on discord
			// http://cdn.topstarnews.net/news/photo/first/201406/img_63025_1.jpg/ndsoft/optimize
			//   http://www.topstarnews.net/news/photo/first/201406/img_63025_1_org.jpg
			newsrc = src.replace(/:\/\/[^/]*\/(.*\/photo\/.*_[0-9]+)(\.[^/.]*)\/.*$/, "://www.topstarnews.net/$1_org$2");
			if (newsrc !== src)
				return newsrc;

			return src
				.replace(/_v[0-9]+(\.[^/.]*)$/, "_org$1")
				.replace(/(_[0-9]+)(\.[^/.]*)$/, "$1_org$2")
				.replace("/thumbnail/", "/photo/");
		}

		if (domain === "thumb.mt.co.kr" ||
			domain === "thumb.mtstarnews.com") {
			// http://thumb.mt.co.kr/06/2017/12/2017122222438260548_1.jpg
			//   http://image.mt.co.kr/2017/12/2017122222438260548_1.jpg
			// http://thumb.mtstarnews.com/06/2018/04/2018040415075698337_1.jpg
			//   http://thumb.mtstarnews.com/07/2018/04/2018040415075698337_1.jpg -- much smaller
			//   http://image.mtstarnews.com/2018/04/2018040415075698337_1.jpg
			// http://thumb.mtstarnews.com/star_chi/02/2019/04/2019040415557949978_1.jpg
			//   http://image.mtstarnews.com/star_chi/2019/04/2019040415557949978_1.jpg

			// https://thumb.mt.co.kr/11/2019/08/2019082308100726893_1.jpg/dims/resize/100x/optimize/
			//   http://image.mt.co.kr/2019/08/2019082308100726893_1.jpg
			newsrc = src.replace(/\/+dims\/.*/, "");
			if (newsrc !== src)
				return newsrc;

			// 06 and 21 seem to be identical
			// after that, in order of size: 05, 07, 17, 11, 16, 10, 20, 04, 15, 03, 14, 19
			//src = src.replace(/(thumb\.[^/]*)\/[0-9]+(\/[0-9]*\/[0-9]*\/[^/]*).*/, "$1/06$2");
			newsrc = src.replace(/^[a-z]+:\/\/thumb\.([^/]*)\/+([^/]*\/+)?[0-9]{2}\/+([0-9]{4}\/+[0-9]{2}\/+[0-9]{8,}_[0-9]+\.)/, "http://image.$1/$2$3");
			if (newsrc !== src)
				return newsrc;

			// thanks to anonymous for reporting:
			// https://thumb.mtstarnews.com/star_realdisp.php?ImageID=2017051015315128279_2.jpg
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+star_realdisp\.php\?(?:.*&)?ImageID=([0-9]+_[0-9]+\.[a-z]+)(?:[&#].*)?$/,
				run: function(cb, match) {
					let url = match[1];
					let urlmatch = url.match(/^([0-9]{4})([0-9]{2})/);
					cb("https://thumb.mtstarnews.com/06/" + urlmatch[1] + "/" + urlmatch[2] + "/" + url);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "menu.mt.co.kr" ||
			// https://img.koreatimes.co.kr/upload/thumbnailV2/590K2019061200203.jpg/dims/resize/720/optimize
			//   https://img.koreatimes.co.kr/upload/thumbnailV2/590K2019061200203.jpg
			domain === "img.koreatimes.co.kr" ||
			// http://1290000230.desst.vcase2.myskcdn.com/1100000038/dev/1290000230/2018/03/20/1890835738_1_1.jpg?key=6a156742b5f85fb887bd7b79a94eea2471884c8c.3669019742&cid=1890835745&pid=1993936257&oid=1890835738/dims/resize/95x54
			//   http://1290000230.desst.vcase2.myskcdn.com/1100000038/dev/1290000230/2018/03/20/1890835738_1_1.jpg?key=6a156742b5f85fb887bd7b79a94eea2471884c8c.3669019742&cid=1890835745&pid=1993936257&oid=1890835738
			domain_nosub === "myskcdn.com") {
			// http://moneys.mt.co.kr/photoDb/mwPhotoDbList.php?no=2017013115555978429&page=1&idx=3
			//   http://menu.mt.co.kr/moneyweek/photoDb/2017/01/31/20170131155559784294333.jpg/dims/optimize
			//   http://menu.mt.co.kr/moneyweek/thumb/2017/01/31/06/2017013115108024857_1.jpg -- smaller
			//   http://menu.mt.co.kr/moneyweek/thumb/2017/01/31/00/2017013115108024857_1.jpg -- not found
			// http://menu.mt.co.kr/moneyweek/thumb/2018/03/05/19/2018030511008030850_1.jpg
			//   http://menu.mt.co.kr/moneyweek/thumb/2018/03/05/06/2018030511008030850_1.jpg
			//   http://menu.mt.co.kr/moneyweek/thumb/2018/03/05/00/2018030511008030850_1.jpg -- larger
			// http://menu.mt.co.kr/moneyweek/thumb/2017/11/16/00/2017111614558031796_1.jpg/dims/optimize/
			//   http://menu.mt.co.kr/moneyweek/thumb/2017/11/16/00/2017111614558031796_1.jpg
			//   http://menu.mt.co.kr/moneyweek/thumb/2017/11/16/06/2017111614558031796_1.jpg -- smaller
			// http://menu.mt.co.kr/moneyweek/thumb/2018/01/14/00/2018011416088035798_2.jpg/dims/optimize/
			// http://menu.mt.co.kr/moneyweek/thumb/2018/03/09/06/2018030917238012410_1.jpg (found on sidebar)
			//   http://menu.mt.co.kr/moneyweek/thumb/2018/03/09/00/2018030917238012410_1.jpg
			// http://menu.mt.co.kr/moneyweek/thumb/2017/06/24/06/2017062410078087905_1.jpg - larger than 00, but looks scaled
			// https://menu.mt.co.kr/theleader/thumb/2019/12/06/2019120212067878586_1.jpg
			//   https://menu.mt.co.kr/theleader/thumb/2019/12/00/2019120212067878586_1.jpg

			// http://menu.mt.co.kr/moneyweek/thumb/2017/05/26/00/2017052617068063683_1.jpg -- works
			// http://menu.mt.co.kr/moneyweek/thumb/2017/05/23/00/2017052310108026652_1.jpg -- doesn't

			// http://menu.mt.co.kr/theleader/photo_img/00/2018/02/01/2018020114447262989_0.jpg

			// http://menu.mt.co.kr/moneys/images/bg_png30.png
			// http://menu.mt.co.kr/moneys/images/bg_num1.png
			if (/\/images\/+bg_[a-z]+[0-9]+\.png(?:[?#].*)?$/.test(src))
				return {
					url: src,
					bad: "mask"
				};

			var obj = src.match(/\/thumb\/+(?:[0-9]+\/+){2,3}([0-9]+)\/[0-9]{10,}_/);
			if (obj && obj[1] !== "00") {
				var obj1_str = src.replace(/.*\/thumb\/+([0-9]+\/+[0-9]+\/+[0-9]+\/).*/, "$1").replace(/\//g, "");
				var obj1 = parseInt(obj1_str);
				//console_log(obj1_str);
				var num = "00";
				if (obj1 < 20170526)
					num = "06";

				src = src.replace(/(\/thumb\/+(?:[0-9]+\/+){2,3})[0-9]+(\/+[0-9]{10,}_)/, "$1" + num + "$2");
			}

			return src
				.replace(/\/dims\/.*/, "");
		}

		if (domain === "tkfile.yes24.com") {
			// http://tkfile.yes24.com/upload2/BoardNotice/202003/20200305/20200305-222.jpg/dims/quality/70/
			//   http://tkfile.yes24.com/upload2/BoardNotice/202003/20200305/20200305-222.jpg
			return src.replace(/(\/upload2\/.*?)\/dims\/+.*/, "$1");
		}

		if (domain === "cdn.music-flo.com") {
			// https://cdn.music-flo.com/image/album/820/314/04/04/404314820_5e28056d.jpg?1579681134148/dims/resize/500x500/quality/90
			//   https://cdn.music-flo.com/image/album/820/314/04/04/404314820_5e28056d.jpg
			return src.replace(/(\/image\/.*?)(?:[?#].*)?$/, "$1");
		}

		if (domain === "static.discovery-expedition.com") {
			// thanks to rEnr3n on github: https://github.com/qsniyg/maxurl/issues/266
			// https://static.discovery-expedition.com/images/goods/detail/x/20190507/DXSH02911-BE-8998685969005915.jpg/dims/resize/940x1253
			//   https://static.discovery-expedition.com/images/goods/detail/x/20190507/DXSH02911-BE-8998685969005915.jpg
			return src.replace(/(\/images\/.*)\/dims\/.*/, "$1");
		}

		if (domain === "image.genie.co.kr") {
			// thanks to JustLurkingHere on github: https://github.com/qsniyg/maxurl/issues/1163
			// https://image.genie.co.kr/Y/IMAGE/IMG_MUZICAT/IV2/Genie_Magazine/13051/Mgz_Sub_IMG_20230407110405.jpg/dims/resize/Q_80,0
			//   https://image.genie.co.kr/Y/image/IMG_MUZICAT/IV2/Genie_Magazine/13051/Mgz_Sub_IMG_20230407110405.jpg
			return src.replace(/(\/image\/.*)\/dims\/.*/i, "$1");
		}

		if (domain === "img.enews24.cjenm.skcdn.com") {
			// http://img.enews24.cjenm.skcdn.com/News/NewsThumbnail/20180821/4_81524182.jpg
			//   http://img.enews24.cjenm.skcdn.com/News/NewsThumbnail/20180821/81524182.jpg -- 555x757
			//   http://img.enews24.cjenm.skcdn.com/News/Contents/20180821/81524182.jpg -- same size
			// http://img.enews24.cjenm.skcdn.com/News/NewsThumbnail/20180305/96260245.jpg -- 2208x2457
			//   http://img.enews24.cjenm.skcdn.com/News/Contents/20180305/96260245.jpg -- 2208x2457
			// http://img.enews24.cjenm.skcdn.com/Photo/Contents/20180821/3_55037036.jpg -- 115x65
			//   http://img.enews24.cjenm.skcdn.com/Photo/Contents/20180821/55037036.jpg -- 450x602
			return src
				.replace(/\/News\/NewsThumbnail(\/[0-9]+\/)(?:[0-9]+_)?([0-9]+\.[^/.]*)$/, "/News/Contents$1$2")
				.replace(/(\/Photo\/Contents\/[0-9]+\/)[0-9]+_([0-9]+\.[^/.]*)$/, "$1$2");
		}

		if (domain_nosub === "stardailynews.co.kr" ||
			// http://www.stardailynews.co.kr/news/thumbnail/201808/212431_241837_1916_v150.jpg
			//   http://www.stardailynews.co.kr/news/photo/201808/212431_241837_1916.jpg

			// http://www.liveen.co.kr/news/thumbnail/201809/230495_282622_126_v150.jpg
			//   http://www.liveen.co.kr/news/photo/201809/230495_282622_126.jpg
			domain_nosub === "liveen.co.kr" ||
			// http://ilyoseoul.co.kr/news/thumbnail/201808/251059_177609_143_v150.jpg
			//   http://ilyoseoul.co.kr/news/photo/201808/251059_177609_143.jpg
			domain_nosub === "ilyoseoul.co.kr" ||
			// http://www.sportsq.co.kr/news/thumbnail/201808/300799_291630_537_v150.jpg
			//   http://www.sportsq.co.kr/news/photo/201808/300799_291630_537.jpg
			domain_nosub === "sportsq.co.kr" ||
			// http://www.zenithnews.com/news/thumbnail/201808/119840_109469_1835_v150.jpg
			//   http://www.zenithnews.com/news/photo/201808/119840_109469_1835.jpg
			domain_nosub === "zenithnews.com" ||
			// http://www.munhwanews.com/news/thumbnail/201809/149954_197569_4039_v150.jpg
			//   http://www.munhwanews.com/news/photo/201809/149954_197569_4039.jpg
			// doesn't work for all:
			// http://www.munhwanews.com/news/thumbnail/201801/106108_163361_2456_v150.jpg
			//   http://www.munhwanews.com/news/photo/201801/106108_163361_2456.jpg
			//   http://www.munhwanews.com/news/photo/201801/106108_163361_2456.png -- works
			domain_nowww === "munhwanews.com" ||
			// http://www.mhns.co.kr/news/thumbnail/201801/106108_163361_2456_v150.jpg
			//   http://www.mhns.co.kr/news/photo/201801/106108_163361_2456.png
			domain_nowww === "mhns.co.kr" ||
			// http://www.ccdailynews.com/news/thumbnail/201801/953374_384565_4611_v150.jpg
			domain_nowww === "ccdailynews.com" ||
			// http://ph.kyeonggi.com/news/thumbnail/201802/1440153_1332290_5913_150.jpg
			//   http://ph.kyeonggi.com/news/photo/201802/1440153_1332290_5913.jpg
			// http://ph.kyeonggi.com/edit/news/view_img/PHOTO_1440148_1332273_5348_47.jpg
			//   http://ph.kyeonggi.com/news/photo/201802/1440148_1332273_5348.jpg
			domain === "ph.kyeonggi.com" ||
			// http://www.jemin.com/news/thumbnail/201802/495551_158263_5710_v150.jpg
			domain_nowww === "jemin.com" ||
			// http://www.domin.co.kr/news/thumbnail/201802/1183690_311011_329_v150.jpg
			//   http://www.domin.co.kr/news/photo/201802/1183690_311011_329.jpg (very hq)
			// http://www.domin.co.kr/news/view_img/MAIN_2_2639_2152.jpg
			//   http://www.domin.co.kr/news/photo/201802/1183700_311009_2038.jpg
			domain_nowww === "domin.co.kr" ||
			// http://cdn.jejudomin.co.kr/news/thumbnail/201802/96102_90506_3656_v150.jpg
			// http://www.jejudomin.co.kr/photobox/photo/2018020261404454865.jpg
			//   http://cdn.jejudomin.co.kr/news/photo/201802/96119_90524_4043.jpg
			domain === "cdn.jejudomin.co.kr" ||
			// http://ph.incheonilbo.com/news/thumbnail/201712/792780_315340_1230_150.jpg
			domain === "ph.incheonilbo.com" ||
			// http://www.hidomin.com/news/thumbnail/201802/349870_151635_5018_v150.jpg
			domain_nowww === "hidomin.com" ||
			// http://www.newsfreezone.co.kr/news/thumbnail/201802/38623_37635_844_v150.jpg
			domain_nowww === "newsfreezone.co.kr" ||
			// http://cdn.newsfreezone.co.kr/news/thumbnail/201802/41850_39614_2056_v150.jpg
			domain === "cdn.newsfreezone.co.kr" ||
			// http://www.newsinside.kr/news/thumbnail/201606/412819_220009_299_v150.jpg
			domain_nowww === "newsinside.kr" ||
			// http://cdn.newsinside.kr/news/thumbnail/201807/500595_348177_554_v150.jpg
			domain === "cdn.newsinside.kr" ||
			// http://www.greenpostkorea.co.kr/news/thumbnail/201802/85004_79031_3615_v150.jpg
			domain_nowww === "greenpostkorea.co.kr" ||
			// http://www.egn.kr/news/thumbnail/201802/90010_149058_921_v150.jpg
			//
			// http://www.egn.kr/news/photo/201710/87447_142141_178.jpg
			// http://www.egn.kr/news/photo/201710/87447_142142_179.jpg
			// http://www.egn.kr/news/photo/201710/87447_142143_1710.jpg
			domain_nowww === "egn.kr" ||
			// http://www.whitepaper.co.kr/news/thumbnail/201802/95633_76403_5942_v150.jpg
			domain_nowww === "whitepaper.co.kr" ||
			// http://www.outdoornews.co.kr/news/thumbnail/201802/30078_79659_4819_v150.jpg
			domain_nowww === "outdoornews.co.kr" ||
			// http://www.shinailbo.co.kr/news/thumbnail/201803/1049737_358211_645_v150.jpg
			// http://www.shinailbo.co.kr/news/articleView.html?idxno=319278
			//   http://www.shinailbo.co.kr/news/photo/201304/319278_175094_5325.jpg - 3500x1807
			domain_nowww === "shinailbo.co.kr" ||
			// http://www.ngtv.tv/news/thumbnail/201803/44169_57237_2756_v150.jpg
			// http://www.ngtv.tv/news/articleView.html?idxno=24743
			//   http://www.ngtv.tv/news/thumbnail/201503/24743_28146_3449_v150.jpg
			//     http://www.ngtv.tv/news/photo/201503/24743_28146_3449.jpg - 2364x1971
			domain_nowww === "ngtv.tv" ||
			// http://www.rnx.kr/news/thumbnail/201803/62152_50525_470_150.jpg
			// http://m.rnx.kr/news/articleView.html?idxno=1390
			domain_nowww === "rnx.kr" ||
			// http://www.intronews.net/news/thumbnail/201803/85854_115174_717_v150.jpg
			// http://www.intronews.net/news/articleView.html?idxno=85633
			//   http://www.intronews.net/news/thumbnail/201802/85633_114974_1625_v150.jpg
			domain_nowww === "intronews.net" ||
			// http://www.hg-times.com/news/thumbnail/201803/178090_128993_4414_v150.jpg
			//   http://www.hg-times.com/news/photo/201803/178090_128993_4414.jpg
			domain_nowww === "hg-times.com" ||
			// http://www.iemn.kr/news/thumbnail/201606/2457_2879_40_v150.jpg
			domain_nowww === "iemn.kr" ||
			// http://www.newscj.com/news/thumbnail/201803/newscj_%EC%B2%9C%EC%A7%80%EC%9D%BC%EB%B3%B4_505243_487804_229_v150.jpg
			//   http://www.newscj.com/news/photo/201803/newscj_%EC%B2%9C%EC%A7%80%EC%9D%BC%EB%B3%B4_505243_487804_229.jpg
			// http://www.newscj.com/news/thumbnail/201809/newscj_천지일보_552148_548008_98_v150.jpg
			//   http://www.newscj.com/news/photo/201809/newscj_%EC%B2%9C%EC%A7%80%EC%9D%BC%EB%B3%B4_552148_548008_98.jpg
			// http://cds.newscj.com/news/thumbnail/201809/newscj_천지일보_552148_548008_98_v150.jpg
			//   http://cds.newscj.com/news/photo/201809/newscj_%EC%B2%9C%EC%A7%80%EC%9D%BC%EB%B3%B4_552148_548008_98.jpg
			// http://www.newscj.com/news/thumbnail/201908/newscj_%EC%B2%9C%EC%A7%80%EC%9D%BC%EB%B3%B4_661837_676135_413_orgBig_v150.jpg
			//   http://www.newscj.com/news/photo/201908/newscj_%EC%B2%9C%EC%A7%80%EC%9D%BC%EB%B3%B4_661837_676135_413.jpg
			domain_nosub === "newscj.com" ||
			// http://www.ggilbo.com/news/thumbnail/201802/444114_351433_497_v150.jpg
			domain_nowww === "ggilbo.com" ||
			// http://www.bstoday.kr/news/thumbnail/201804/200376_125982_145_v150.jpg
			//
			// http://www.bstoday.kr/news/articleView.html?idxno=5090
			// http://www.bstoday.kr/photobox/photo/2018032371050517410.jpg
			//   http://www.bstoday.kr/news/photo/201508/5090_4090_1029.jpg
			domain_nowww === "bstoday.kr" ||
			// http://interfootball.heraldcorp.com/news/thumbnail/201803/194965_212367_3835_150.jpg
			domain === "interfootball.heraldcorp.com" ||
			// http://www.ilyosisa.co.kr/news/thumbnail/201805/145247_81281_562_v150.jpg
			domain_nowww === "ilyosisa.co.kr" ||
			// http://www.ynnews.kr/news/thumbnail/201805/130007_85746_295_150.jpg
			domain_nowww === "ynnews.kr" ||
			// http://www.starilbo.com/news/thumbnail/201802/43552_58572_5916_v150.jpg
			domain_nowww === "starilbo.com" ||
			// http://www.autoherald.co.kr/news/thumbnail/201805/31572_48631_5317_v150.jpg
			domain_nowww === "autoherald.co.kr" ||
			// http://www.00news.co.kr/news/thumbnail/201805/53198_101527_5227_v150.jpg
			domain_nowww === "00news.co.kr" ||
			// http://www.kstarfashion.com/news/thumbnail/201805/131724_67495_4142_v150.jpg
			domain_nowww === "kstarfashion.com" ||
			// http://www.inewspeople.co.kr/news/thumbnail/201611/12355_20610_5726_v150.jpg
			domain_nowww === "inewspeople.co.kr" ||
			// http://www.staraz.co.kr/news/thumbnail/201703/32882_7294_2352_v150.jpg
			// no longer works
			//domain_nowww === "staraz.co.kr" ||
			// http://www.wonnews.co.kr/news/thumbnail/201805/201275_36498_2029_v150.jpg
			domain_nowww === "wonnews.co.kr" ||
			// http://www.gukjenews.com/news/thumbnail/201806/938035_714703_1521_v150.jpg
			// http://cdn.gukjenews.com/news/thumbnail/201806/938035_714703_1521_v150.jpg
			domain_nosub === "gukjenews.com" ||
			// http://www.lunarglobalstar.com/news/thumbnail/201806/19254_15963_1148_v150.jpg
			domain_nowww === "lunarglobalstar.com" ||
			// http://www.sundayjournal.kr/news/thumbnail/201806/15914_26675_3235_v150.jpg
			domain_nowww === "sundayjournal.kr" ||
			// http://www.stnsports.co.kr/news/thumbnail/201806/78500_39611_034_v150.jpg
			domain_nowww === "stnsports.co.kr" ||
			// http://www.thekpm.com/news/thumbnail/201806/21213_21127_1440_v150.jpg
			domain_nowww === "thekpm.com" ||
			// http://chunchu.yonsei.ac.kr/news/thumbnail/201806/24380_12155_3112_v150.jpg
			domain === "chunchu.yonsei.ac.kr" ||
			// http://www.e2news.com/news/thumbnail/201807/200453_60290_1157_v150.jpg
			domain_nowww === "e2news.com" ||
			// http://www.newswiz.kr/news/thumbnail/201803/2250_2132_412_150.jpg
			// doesn't work anymore
			//domain_nowww === "newswiz.kr" ||
			// http://ph.spotvnews.co.kr/news/thumbnail/201809/234592_287106_0230_150.jpg
			//   http://ph.spotvnews.co.kr/news/photo/201809/234592_287106_0230.jpg
			domain === "ph.spotvnews.co.kr" ||
			// http://www.sisunnews.co.kr/news/thumbnail/201603/34339_48461_5310_v150.jpg
			domain_nowww === "sisunnews.co.kr" ||
			// http://www.kpinews.co.kr/news/thumbnail/201810/83057_52603_315_150.jpg
			domain_nowww === "kpinews.co.kr" ||
			// http://www.4th.kr/news/thumbnail/201611/28739_3653_4123_150.jpg
			//   http://www.4th.kr/news/photo/201611/28739_3653_4123.png
			domain_nowww === "4th.kr" ||
			// http://cds.topdaily.kr/news/thumbnail/201812/56185_20164_437_v150.jpg
			//   http://cds.topdaily.kr/news/photo/201812/56185_20164_437.jpeg
			domain === "cds.topdaily.kr" ||
			// http://www.kntimes.co.kr/news/thumbnail/201807/26257_33405_1126_v150.jpg
			domain_nowww === "kntimes.co.kr" ||
			// http://www.senmedia.kr/news/thumbnail/201709/2842_2729_2543_v150.jpg
			domain_nowww === "senmedia.kr" ||
			// http://www.siminilbo.co.kr/news/thumbnail/201904/617941_158117_436_v150.jpg
			domain_nowww === "siminilbo.co.kr" ||
			// http://www.sisafocus.co.kr/news/thumbnail/201904/207963_245791_2137_v150.jpg
			domain_nowww === "sisafocus.co.kr" ||
			// http://www.futurekorea.co.kr/news/thumbnail/201904/116934_117354_5130_v150.jpg
			domain_nowww === "futurekorea.co.kr" ||
			// http://www.dailygrid.net/news/thumbnail/201904/216463_115815_96_v150.jpg
			domain_nowww === "dailygrid.net" ||
			// http://www.datanet.co.kr/news/thumbnail/201904/133154_58977_577_v150.jpg
			domain_nowww === "datanet.co.kr" ||
			// http://www.slist.kr/news/thumbnail/201902/67706_145468_352_v150.jpg
			domain_nowww === "slist.kr" ||
			// http://www.secondmirror.co.kr/news/thumbnail/201902/975_949_3434_v150.jpg
			domain_nowww === "secondmirror.co.kr" ||
			// http://www.ntoday.co.kr/news/thumbnail/201604/42811_17317_2848_v150.jpg
			domain_nowww === "ntoday.co.kr" ||
			// http://www.seoulilbo.com/news/thumbnail/201603/130273_55917_389_v150.jpg
			domain_nowww === "seoulilbo.com" ||
			// http://www.lecturernews.com/news/thumbnail/201905/19595_47130_5520_150.jpg
			domain_nowww === "lecturernews.com" ||
			// http://www.youthdaily.co.kr/news/thumbnail/201904/11136_11059_4958_v150.jpg
			domain_nowww === "youthdaily.co.kr" ||
			// http://www.mdaily.net/news/thumbnail/201904/21619_26375_1729_v150.jpg
			domain_nowww === "mdaily.net" ||
			// http://www.cctoday.co.kr/news/thumbnail/201906/2006428_504058_3632_v150.jpg
			domain_nowww === "cctoday.co.kr" ||
			// http://www.gnmaeil.com/news/thumbnail/201903/409191_447180_487_v150.jpg
			domain_nowww === "gnmaeil.com" ||
			// http://en.mhnew.com/news/thumbnail/201903/3370_5124_295_v150.jpg
			domain_nosub === "mhnew.com" ||
			// http://www.mediadale.com/news/thumbnail/201903/14728_18216_3020_v150.jpg
			domain_nowww === "mediadale.com" ||
			// http://viewers.heraldcorp.com/news/thumbnail/201903/31241_27009_3343_v150.jpg
			domain === "viewers.heraldcorp.com" ||
			// http://www.biztribune.co.kr/news/thumbnail/201903/204838_55259_3431_v150.jpg
			domain_nowww === "biztribune.co.kr" ||
			// http://www.obsnews.co.kr/news/thumbnail/201903/1147272_352387_1820_v150.jpg
			domain_nowww === "obsnews.co.kr" ||
			// http://www.kyeonggi.com/news/thumbnail/201903/2067792_861603_5016_v150.jpg
			domain_nowww === "kyeonggi.com" ||
			// http://www.iloveorganic.co.kr/news/thumbnail/201903/221692_24198_530_150.jpg
			domain_nowww === "iloveorganic.co.kr" ||
			// http://www.newslock.co.kr/news/thumbnail/201903/3564998_high_v150.jpg
			//   http://www.newslock.co.kr/news/photo/201903/3564998_high.jpg
			// http://www.newslock.co.kr/news/thumbnail/201906/19336_14698_1623_v150.jpg
			//   http://www.newslock.co.kr/news/photo/201906/19336_14698_1623.jpg
			//   http://www.newslock.co.kr/news/photo/201906/19336_high.jpg -- doesn't work
			domain_nowww === "newslock.co.kr" ||
			// http://www.news33.net/news/thumbnail/201809/31583_15312_1018_v150.jpg
			domain_nowww === "news33.net" ||
			// http://www.mainnews.kr/news/thumbnail/201812/66967_53693_258_150.jpg
			domain_nowww === "mainnews.kr" ||
			// http://www.ilemonde.com/news/thumbnail/201901/10159_20297_4932_v150.jpg
			domain_nowww === "ilemonde.com" ||
			// http://www.canews.kr/news/thumbnail/201901/1598_2307_444_v150.jpg
			domain_nowww === "canews.kr" ||
			// http://www.newsflix.co.kr/news/thumbnail/201901/348_168_4151_v150.jpg
			domain_nowww === "newsflix.co.kr" ||
			// http://www.gokorea.kr/news/thumbnail/201901/66876_104058_015_v150.jpg
			domain_nowww === "gokorea.kr" ||
			// http://www.womaneconomy.kr/news/thumbnail/201701/43819_73700_258_v150.jpg
			domain_nowww === "womaneconomy.kr" ||
			// http://www.apsk.co.kr/news/thumbnail/201907/4133_10362_2721_v150.jpg
			domain_nowww === "apsk.co.kr" ||
			// http://www.sporbiz.co.kr/news/thumbnail/201907/356684_265899_649_v150.jpg
			domain_nowww === "sporbiz.co.kr" ||
			// http://www.lovesbeauty.co.kr/news/thumbnail/201403/6451_10368_1200_v150.jpg
			domain_nowww === "lovesbeauty.co.kr" ||
			// http://www.ikoreadaily.co.kr/news/thumbnail/201506/200257_95468_3552_v150.jpg
			domain_nowww === "ikoreadaily.co.kr" ||
			// http://www.interview365.com/news/thumbnail/201908/88350_115004_3128_v150.jpg
			domain_nowww === "interview365.com" ||
			// http://www.newsa.co.kr/news/thumbnail/201908/229705_168792_3246_v150.jpg
			domain_nowww === "newsa.co.kr" ||
			// http://www.newstown.co.kr/news/thumbnail/201801/311251_198441_4816_v150.jpg
			domain_nowww === "newstown.co.kr" ||
			// http://www.kgdm.co.kr/news/thumbnail/201908/652501_225858_1621_v150.jpg
			src.match(/^[a-z]+:\/\/[^/]+\/+news\/+thumbnail\/+[0-9]{6}\/+[0-9]+_[0-9]+_[0-9]+_v?150\.[^/.]*(?:[?#].*)?$/)) {
			newsrc = src.replace(/\/thumbnail\/+([0-9]{6}\/+(?:[^/.]*_)?[0-9]+_[0-9]+_[0-9]+)(?:_orgBig)?_v?150(\.[^/.]*)(?:[?#].*)?$/, "/photo/$1$2");
			if (newsrc !== src)
				return add_extensions_upper_jpeg(newsrc);
			//return add_extensions_upper_jpeg(src
			//                            .replace("/thumbnail/", "/photo/")
			//                            //.replace(/_v[0-9]*\.([^/]*)$/, ".$1")
			//                            .replace(/(\/[0-9]+_[0-9]+_[0-9]+)_(?:orgBig_)?v?150(\.[^/.]*)$/, "$1$2"));
		}

		if (domain === "shop.newsen.com") {
			// http://shop.newsen.com/data/thumb/200_142_201808171221570910_1.jpg
			//   http://photo.newsen.com/news_photo/2018/08/17/201808171221570910_1.jpg
			return src.replace(/:\/\/[^/]*\/+data\/+thumb\/+[0-9]+_[0-9]+_([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([^/]*)$/, "://photo.newsen.com/news_photo/$1/$2/$3/$1$2$3$4");
		}

		if (domain === "cdn.newsen.com" ||
			domain === "photo.newsen.com") {
			// http://photo.newsen.com/news_photo/2011/04/28/201104281531181001_1.jpg -- 2880x4320
			// http://cdn.newsen.com/newsen/news_photo/2011/04/28/201104281531181001_1.jpg -- same

			// http://www.newsen.com/news_view.php?uid=201903062017275510
			//   http://cdn.newsen.com/newsen/news_photo/2019/03/06/201903062017275510_1.jpg -- 540x842
			// https://entertain.v.daum.net/v/20190306201751601
			//   https://t1.daumcdn.net/news/201903/06/newsen/20190306201751195iqvu.jpg -- 641x1000
			// other:
			// http://photo.newsen.com/photo/2006/05/15/200605151650091006_1.jpg
			newsrc = src.replace(/_ts\.[^/._]*$/, ".jpg").replace("/mphoto/", "/news_photo/");
			if (newsrc !== src)
				return newsrc;

			if (string_indexof(src, "/main_photo/") >= 0) {
				// http://cdn.newsen.com/newsen/main_photo/index_a2_201801030825321910_1.jpg
				//   http://cdn.newsen.com/newsen/news_photo/2018/01/03/201801030825321910_1.jpg
				// http://cdn.newsen.com/newsen/main_photo/mobile/favphoto_201807131531391510_1.jpg
				//   http://cdn.newsen.com/newsen/news_photo/2018/07/13/201807131531391510_1.jpg
				//   http://photo.newsen.com/news_photo/2018/07/13/201807131531391510_1.jpg
				newsrc = src.replace(/\/main_photo\/+(?:mobile\/+)?[^/]*_([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([^/]*)$/, "/news_photo/$1/$2/$3/$1$2$3$4");
				if (newsrc !== src)
					return newsrc;
			}

			// http://cdn.newsen.com/newsen/resize/235x-/2019/05/18/201905182149162610_1.jpg
			//   http://cdn.newsen.com/newsen/news_photo/2019/05/18/201905182149162610_1.jpg
			newsrc = src.replace(/\/resize\/+[-0-9]+x[-0-9]+\/+/, "/news_photo/");
			if (newsrc !== src)
				return newsrc;

			var extra = {};
			match = src.match(/cdn\.newsen\.com\/+newsen\/+news_photo\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}([0-9]{10,})_[0-9]+\.[^/.]*(?:[?#].*)?$/);
			var pageid = null;
			if (match ||
				(match = src.match(/photo\.newsen\.com\/+news_photo\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}([0-9]{10,})_[0-9]+\.[^/.]*(?:[?#].*)?$/))) {
				pageid = match[1];
				extra.page = "http://www.newsen.com/news_view.php?uid=" + match[1];
			}

			obj = {
				url: src,
				headers: {
					Referer: "http://www.newsen.com/"
				},
				referer_ok: {
					same_domain_nosub: true
				},
				extra: extra
			};

			// http://www.newsen.com/news_view.php?uid=201909050803320410 -- multiple images in one page
			//   http://cdn.newsen.com/newsen/news_photo/2019/09/05/201909050803320410_1.jpg
			if (extra.page && options && options.cb && options.allow_thirdparty && options.do_request) {
				var get_imageid = function(url) {
					if (!url)
						return url;

					var match = url.match(/\/[0-9]{4}\/+(?:[0-9]{2}\/+){2}([0-9]{10,}_[0-9]+)\.[^/.]*(?:[?#].*)?$/);
					if (!match)
						return null;

					if (_nir_debug_)
						console_log("Image ID for " + url + ":", match[1]);

					return match[1];
				};

				var get_newsen_pageinfo = function(page, pageid, cb) {
					api_cache.fetch("newsen_pageinfo:" + pageid, cb, function(done) {
						options.do_request({
							method: "GET",
							url: extra.page,
							overrideMimeType: "text/html; charset=euc-kr",
							onload: function(result) {
								if (result.readyState !== 4)
									return;

								if (result.status !== 200) {
									return done(null, false);
								}

								var match = result.responseText.match(/<meta\s+property=["']og:title["']\s+content=["']([^'"]+)["']/);
								if (!match) {
									console_warn("Newsen title not found", result);
									return done(null, false);
								}

								var title = strip_whitespace(match[1]);
								console_log("Title: ", title);

								match = result.responseText.match(/<img\s+id=["']artImg["']\s+src=["'](?:https?:)?\/\/[a-z]+\.newsen\.com\/.*?["']/g);
								if (!match) {
									console_warn("Newsen images not found", result);
									return done(null, false);
								}

								return done({
									page: result.finalUrl,
									title: title,
									images: match
								}, 6*60*60);
							}
						});
					});
				};

				var get_imagenum_from_newsen_pageinfo = function(image, pageinfo) {
					var imageid = get_imageid(image);
					if (!imageid)
						return null;

					var imagenum;
					for (imagenum = 0; imagenum < pageinfo.images.length; imagenum++) {
						var i_imageid = get_imageid(pageinfo.images[imagenum]);
						if (!i_imageid)
							continue;

						if (i_imageid === imageid)
							break;
					}

					if (imagenum === pageinfo.images.length) {
						return null;
					}

					return imagenum;
				};

				var get_daum_search_results = function(title, cb) {
					api_cache.fetch("newsen_daum_search:" + title, cb, function(done) {
						var searchurl = "https://m.search.daum.net/search?w=news&q=" + encodeURIComponent(title) + "&enc=utf8";
						options.do_request({
							method: "GET",
							url: searchurl,
							onload: function (result) {
								if (result.readyState !== 4) {
									return;
								}

								if (result.status !== 200) {
									return done(null, false);
								}

								// TODO: check date too
								var entry_regex = /<a\s+class=["']info_item["']\s+href=["']((?:https?:)\/\/v\.media\.daum\.net\/+.*?)["'][^>]*?>\s*<strong\s+class=["']tit-g[^'"]*["']\s*>\s*([\s\S]*?)\s*<\/strong>/g;
								var nonglobal_regex = new RegExp(entry_regex, "");
								var entries_match = result.responseText.match(entry_regex);
								if (!entries_match) {
									console_error("No search entries found for", result);
									return done(null, false);
								}

								var search_entries = [];

								for (var entry_i = 0; entry_i < entries_match.length; entry_i++) {
									var match = entries_match[entry_i].match(nonglobal_regex);
									if (!match) {
										console_error("Unable to match non-global regex (this shouldn't happen)");
										continue;
									}

									search_entries.push({
										title: decode_entities(match[2].replace(/<([a-z]+)(?:\s+.*?)?>(.*?)<\/\1>/g, "$2")),
										// getting rid of ?f=o, which'll redirect to newsen instead
										url: urljoin(result.finalUrl, match[1].replace(/[?#].*/, ""), true)
									});
								}

								if (search_entries.length === 0) {
									console_error("Zero search entries found", searchurl);
								}

								done(search_entries, 2*60*60);
							}
						});
					});
				};

				var get_daum_url_from_results = function(real_title, real_pageid, results) {
					if (!results)
						return null;

					// Daum seems to cut off the text at 38 characters in, let's use 35 to be safe
					var real_fuzzy = fuzzify_text(real_title).substr(0, 35);

					for (var i = 0; i < results.length; i++) {
						if (real_fuzzy !== fuzzify_text(results[i].title).substr(0, 35)) {
							continue;
						}

						var pageid = results[i].url.replace(/.*\/v\/([0-9]+)$/, "$1");
						if (pageid === results[i].url) {
							console_error("Unhandled URL: " + results[i].url);
							continue;
						}

						if (!fuzzy_date_compare(pageid.substr(0, 8), real_pageid.substr(0, 8))) {
							if (_nir_debug_) {
								console_log("Skipping:", pageid, real_pageid);
							}
							continue;
						}

						return results[i].url;
					}

					console_error("Unable to find result from search", real_title, results);

					return null;
				};

				var get_daum_pageinfo = function(daumurl, cb) {
					api_cache.fetch("newsen_daum_pageinfo:" + daumurl, cb, function(done) {
						options.do_request({
							method: "GET",
							url: daumurl,
							onload: function (result) {
								if (result.readyState !== 4)
									return;

								if (result.status !== 200) {
									return done(null, false);
								}

								var image_regex = /<img[^>]+dmcf-mtype=["']image["'][^>]+src=["']((?:https?:)\/\/[^/]+\.daumcdn\.net\/.*?)["']/g;
								var nonglobal_regex = new RegExp(image_regex, "");

								var obj = {
									url: result.finalUrl,
									images: []
								};

								var images_match = result.responseText.match(image_regex);
								if (!images_match) {
									return done(obj, 60*60);
								}

								for (var i = 0; i < images_match.length; i++) {
									var image_match = images_match[i].match(nonglobal_regex);
									if (!image_match)
										continue;

									obj.images.push(urljoin(result.finalUrl, image_match[1], true));
								}

								done(obj, 6*60*60);
							}
						});
					});
				};

				get_newsen_pageinfo(extra.page, pageid, function(pageinfo) {
					if (!pageinfo) {
						return options.cb(obj);
					}

					var title = pageinfo.title;
					var total_images = pageinfo.images.length;
					var imagenum = get_imagenum_from_newsen_pageinfo(src, pageinfo);
					if (imagenum === null) {
						return options.cb(obj);
					}

					get_daum_search_results(title, function(results) {
						var daumurl = get_daum_url_from_results(title, pageid, results);
						if (!daumurl)
							return options.cb(obj);

						console_log("Daum article URL:", daumurl);

						get_daum_pageinfo(daumurl, function(daum_pageinfo) {
							if (!daum_pageinfo)
								return options.cb(obj);

							if (daum_pageinfo.images.length !== total_images) {
								console_error("Image number mismatch");
								return options.cb(obj);
							}

							obj.url = daum_pageinfo.images[imagenum];
							obj.extra.page = daum_pageinfo.url;
							delete obj.headers.Referer;
							return options.cb(obj);
						});
					});
				});

				return {
					waiting: true
				};
			}

			return obj;
		}

		if (domain === "sccdn.chosun.com") {
			// http://sccdn.chosun.com/news/photobook/201504/13267_scr_201504140000000022741_t.jpg
			//   http://sccdn.chosun.com/news/photobook/201504/13267_201504140000000022741.jpg
			// http://sccdn.chosun.com/news/photobook/201504/13267_2015041400000000000122741_t.jpg
			//   http://sccdn.chosun.com/news/photobook/201504/13267_2015041400000000000122741.jpg
			// http://sccdn.chosun.com/news/photobook/201203/4488_scr_%EB%8D%9C%EB%8D%9C_t.jpg
			// large:
			// http://sccdn.chosun.com/news/photobook/201710/23202_2017101301010007001.jpeg
			// http://sccdn.chosun.com/news/photobook/201412/11896_20141201010101000972.jpeg
			// http://sccdn.chosun.com/news/photobook/201607/18084_207777778888816070401010002381.jpeg
			// http://sccdn.chosun.com/news/photobook/201412/11896_2014120101000156100006731.jpg - small
			// http://sccdn.chosun.com/news/photobook/201412/11896_2014120101000155800006701.jpg - ^
			// other:
			// http://sccdn.chosun.com/news/photobook/201908/29780_2019062501001807700123651.jpg
			//   http://sccdn.chosun.com/news/html/2019/06/25/2019062501001807700123651.jpg
			//   http://sports.chosun.com/news/news.htm?id=201906250100180770012365&ServiceDate=20190625 -- ServiceDate is needed

			return src.replace(/\/([0-9]*_)(?:scr_)?([^._/]*)(?:_t)?(\.[^/.]*)$/, "/$1$2$3");
		}

		if (domain_nosub === "chosun.com" ||
			// http://the-star.co.kr/site/data/thumb_dir/2015/11/13/2015111301003_0_thumb.jpg
			//   http://the-star.co.kr/site/data/img_dir/2015/11/13/2015111301003_0.jpg
			domain_nowww === "the-star.co.kr" ||
			// http://digitalchosun.dizzo.com/site/data/html_dir/2019/10/02/2019100280037.html
			// http://digitalchosun.dizzo.com/site/data/thumb_dir/2019/10/02/2019100280036_0_thumb.jpg
			//   http://digitalchosun.dizzo.com/site/data/img_dir/2019/10/02/2019100280036_0.jpg
			domain === "digitalchosun.dizzo.com" ||
			domain_nosub === "chosunonline.com") {
			// works:
			// http://woman.chosun.com/up_fd/wc_news/2018-01/simg_thumb/1802_292s.jpg
			//   http://woman.chosun.com/up_fd/wc_news/2018-01/simg_org/1802_292s.jpg
			//   http://woman.chosun.com/up_fd/wc_news/2018-01/bimg_org/1802_292.jpg
			// http://woman.chosun.com/up_fd/wc_news/2018-01/simg_org/1802_294s.jpg
			//   http://woman.chosun.com/up_fd/wc_news/2018-01/bimg_org/1802_294.jpg
			// http://woman.chosun.com/up_fd/wc_news/2018-02/simg_org/1802_88s.jpg
			//   http://woman.chosun.com/up_fd/wc_news/2018-02/bimg_org/1802_88.jpg
			// http://woman.chosun.com/up_fd/wc_news/2018-02/simg_org/1802_340s.jpg
			//   http://woman.chosun.com/up_fd/wc_news/2018-02/bimg_org/1802_340.jpg
			// http://woman.chosun.com/up_fd/wc_news/2018-01/simg_org/1802_294s.jpg
			//   http://woman.chosun.com/up_fd/wc_news/2018-01/bimg_org/1802_294.jpg
			// http://woman.chosun.com/up_fd/wc_news/2018-02/simg_org/1802_322s.jpg
			//   http://woman.chosun.com/up_fd/wc_news/2018-02/bimg_org/1802_322.jpg
			// http://ekr.chosunonline.com/site/data/thumb_dir/2018/02/23/2018022301051_1_thumb.jpg
			//   http://ekr.chosunonline.com/site/data/img_dir/2018/02/23/2018022301051_1.jpg
			// http://ekr.chosunonline.com/site/data/thumb_dir/2018/02/21/2018022101757_3_thumb.jpg
			//   http://ekr.chosunonline.com/site/data/img_dir/2018/02/21/2018022101757_3.jpg
			//
			// doesn't work:
			// http://woman.chosun.com/up_fd/wc_news/2018-01/simg_org/1801_164s.jpg
			// http://ekr.chosunonline.com/site/data/img_dir/2015/07/16/2015071601601_thumb.jpg
			// http://ekr.chosunonline.com/site/data/img_dir/2017/10/24/2017102400705_thumb.jpg
			//   http://ekr.chosunonline.com/site/data/img_dir/2017/10/24/2017102400675_0.jpg

			newsrc = src
				//.replace(/\/simg_(?:thumb|org)\/([^/]*)s(\.[^/.]*)$/, "/bimg_org/$1$2")
				.replace("/simg_thumb/", "/simg_org/")
				.replace(/\/thumb_dir\/(.*)_thumb(\.[^/.]*)$/, "/img_dir/$1$2")
				// http://image.chosun.com/sitedata/thumbnail/201803/08/2018030801755_0_thumb.jpg
				//   http://image.chosun.com/sitedata/image/201803/08/2018030801755_0.jpg
				.replace(/\/thumbnail\/(.*?)(?:_thumb)?(\.[^/.]*)$/, "/image/$1$2");

			if (newsrc !== src)
				return add_full_extensions(newsrc);

			id = src.match(/\/site\/+data\/+img_dir\/+([0-9]{4}\/+(?:[0-9]{2}\/+){2})([0-9]{10,})_[0-9]+\./);
			if (false && id) {
				var id_plus_one = parseInt(id[2]) + 1; // doesn't always work
				return {
					url: src,
					extra: {
						page: src.replace(/\/site\/+data\/+img_dir\/+.*/, "/site/data/html_dir/" + id[1] + (id_plus_one) + ".html")
					}
				};
			}
		}

		// replaced in large rule above
		/*if (false && string_indexof(domain, "ph.spotvnews.co.kr") >= 0) {
			return src.replace("/thumbnail/", "/photo/").replace(/([0-9]+_[0-9]+_[0-9]+)_[0-9]+\.([^/]*)$/, "$1.$2");
		}*/

		if (domain === "photo.hankooki.com") {
			// http://photo.hankooki.com/newsphoto/v001/thumbs/2017/06/23/tsjmao20170623113309_O_00_C_1.jpg
			// http://photo.hankooki.com/newsphoto/v001/2017/06/23/sjmao20170623113309_O_00_C_1.jpg

			// http://photo.hankooki.com/arch/thumbs/P/2017/10/25/t20171025182853_P_00_C_1_846.jpg
			// http://photo.hankooki.com/arch/photo/P/2017/10/25/20171025182853_P_00_C_1_846.jpg
			// http://photo.hankooki.com/arch/original/P/2017/10/25/20171025182853_P_00_C_1_846.jpg

			// http://photo.hankooki.com/newsphoto/yonhap/thumbs/2016/05/17/t_20160517121834.jpg
			// http://photo.hankooki.com/newsphoto/yonhap/2016/05/17/20160517121834.jpg

			// http://photo.hankooki.com/newsphoto/v001/thumbs/2018/01/28/20180128000108_1_holic.jpg -- doesn't work
			//   http://photo.hankooki.com/newsphoto/v001/2018/01/27/jay1220180127233802_P_02_C_1.jpg (unrelated url?)

			// http://photo.hankooki.com/newsphoto/v001/thumbs/2014/11/11/tegeriace20141111172610_X_01_C_1.jpg -- doesn't work, tries to go to:
			//   http://photo.hankooki.com/newsphoto/v001/2014/11/11/egeriace20141111172610_X_01_C_1.jpg
			// real:
			//   http://photo.hankooki.com/newsphoto/v001/2014/11/11/wegeriace20141111172610_X_01_C_1.jpg
			newsrc = src.replace("/arch/photo/", "/arch/original/")
				.replace("/arch/thumbs/", "/arch/original/")
				.replace(/(\/newsphoto\/[^/]*\/)thumbs\//, "$1");
				//.replace(/(.*\/)t([0-9]*[^/]*)$/, "$1$2");
			if (newsrc !== src) {
				return newsrc.replace(/(.*\/)t_?([^/]*)$/, "$1$2");
			} else {
				return src;
			}
		}

		if (domain === "thumb.hankooki.com") {
			// http://thumb.hankooki.com/gisaphoto/inews/2014/09/11/282x170xIR@0911087100636.jpg
			//   http://photo.hankooki.com/gisaphoto/inews/2014/09/11/0911087100636.jpg
			return src.replace(/:\/\/[^/]*\/+(.*\/+)[0-9]+x[0-9]+x[^/]*@([^/]*)(?:[?#].*)?$/,
							   "://photo.hankooki.com/$1$2");
		}

		if (domain_nosub === "ettoday.net") {
			// https://cdn2.ettoday.net/images/1760/d1760595.jpg
			//   https://cdn2.ettoday.net/images/1760/1760595.jpg
			// https://static.ettoday.net/images/3341/c3341311.jpg -- 400x267
			//   https://static.ettoday.net/images/3341/3341311.jpg -- 5499x3666
			// http://cdn2.ettoday.net/images/3228/c3228532.jpg
			//   http://cdn2.ettoday.net/images/3228/3228532.jpg -- works, but is not interpreted as an image
			//   http://static.ettoday.net/images/3228/3228532.jpg
			// https://cdn2.ettoday.net/images/4135/d4135251.jpg
			//   https://static.ettoday.net/images/4135/4135251.jpg
			return {
				url: src
					.replace(/\/[a-z]+([0-9]*\.[^/]*)(?:[?#].*)?$/, "/$1")
					.replace(/:\/\/cdn[0-9]*\./, "://static."),
				head_wrong_contenttype: true
			};
		}

		if (domain === "img.mbn.co.kr") {
			// http://img.mbn.co.kr/filewww/news/other/2012/04/30/340200121110.jpg - 5705x2917
			return src.replace(/_s[0-9]+x[0-9]+(\.[^/]*)$/, "$1");
		}

		if (domain === "imgmmw.mbn.co.kr") {
			// http://imgmmw.mbn.co.kr/storage/news/2018/12/11/0BBA1180-1749-4768-8F8A-91A334414CB9_576.jpg
			//   http://imgmmw.mbn.co.kr/storage/news/2018/12/11/0BBA1180-1749-4768-8F8A-91A334414CB9.jpg
			return src.replace(/(\/storage\/+news\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[-0-9A-F]{30,})_[0-9]+(\.[^/.]*)*(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain === "image-gd.inews24.com") {
			// http://image-gd.inews24.com/image.php?u=/image_joy/201804/1522932288117_1_214943.jpg
			//   http://image-gd.inews24.com/image2.php?u=/image_joy/201804/1522932288117_1_214943.jpg
			//   http://image3.inews24.com/image_joy/201804/1522932288117_1_214943.jpg
			return src.replace(/:\/\/[^/]*\/image[0-9]*\.php\?u=([^&]*).*/, "://image3.inews24.com$1");
		}

		if ((domain_nosub === "inews24.com" && /^img\.(?:lb|xml|[0-9]+)\./.test(domain)) ||
			(domain_nosub === "inews24.com" && /^image[0-9]*\./.test(domain)) ||
			// http://inews24.ext3.cache.iwinv.net/image_joy/thumbnail/201804/152292797427_1_203359.jpg
			//   http://inews24.ext3.cache.iwinv.net/image_joy/201804/152292797427_1_203359.jpg
			// http://inews24.cache.iwinv.net/image_joy/thumbnail/201604/1461628592495_1_173610.jpg
			//   http://inews24.cache.iwinv.net/image_joy/201604/1461628592495_1_173610.jpg
			(domain_nosub === "iwinv.net" && /^inews24\.(?:ext[0-9]+\.)?cache\./.test(domain))) {
			// http://img.lb.inews24.com/face/100dpi/180x220/image_joy/201911/1575008174298_1_152007.jpg
			//   http://img.lb.inews24.com/image_joy/201911/1575008174298_1_152007.jpg
			// http://img.lb.inews24.com/100dpi/x280/image_joy/201911/1575009715956_1_161653.jpg
			//   http://img.lb.inews24.com/image_joy/201911/1575009715956_1_161653.jpg
			// http://img.5.inews24.com/300x/image_joy/201911/1573547923849_1_175144.jpg
			//   http://img.5.inews24.com/image_joy/201911/1573547923849_1_175144.jpg
			// http://img.xml.inews24.com/x289/image_joy/201904/155576283786_1_212113.jpg
			//   http://image.inews24.com/image_joy/201904/155576283786_1_212113.jpg
			//   http://img.xml.inews24.com/image_joy/201904/155576283786_1_212113.jpg
			// http://img.xml.inews24.com/200x200/image_joy/thumbnail/201904/1554893184953_2_203020.jpg
			//   http://image.inews24.com/image_joy/201904/1554893184953_2_203020.jpg
			//   http://img.xml.inews24.com/image_joy/thumbnail/201904/1554893184953_2_203020.jpg
			//   http://img.xml.inews24.com/image_joy/201904/1554893184953_2_203020.jpg
			// http://img.2.inews24.com/200x/300x/400x/image_joy/201911/1573192207502_1_221148.jpg
			//   http://img.2.inews24.com/image_joy/201911/1573192207502_1_221148.jpg
			return src
				.replace(/(:\/\/[^/]+\/)(?:face\/+)?(?:[0-9]+dpi\/+){0,}(?:[0-9]*x[0-9]*\/+){0,}image_joy\//, "$1image_joy/")
				.replace(/\/image_joy\/+thumbnail\//, "/image_joy/");
			//return src.replace(/:\/\/[^/]*\/(?:[0-9]+)?x[0-9]+\/+/, "://image.inews24.com/");
		}

		if (domain_nosub === "wowkorea.jp" &&
			(string_indexof(src, ".wowkorea.jp/img") >= 0 ||
			 string_indexof(src, ".wowkorea.jp/upload") >= 0)) {
			// works:
			// http://kt.wowkorea.jp/img/album/10/54888/94580_l.jpg
			//   http://kt.wowkorea.jp/img/album/10/54888/94580.jpg
			// http://image.wowkorea.jp/upload/news/214660/20180612_cosm_n.jpg
			//   http://image.wowkorea.jp/upload/news/214660/20180612_cosm.jpg
			// http://kt.wowkorea.jp/img/album/8/43853/78804_ss.jpg
			//   http://kt.wowkorea.jp/img/album/8/43853/78804.jpg
			//
			// http://www.wowkorea.jp/upload/news/153102/450_teyon1003.jpg
			//   http://www.wowkorea.jp/upload/news/153102/teyon1003.jpg -- not sure how to make a rule for this
			//
			// doesn't work:
			// http://kt.wowkorea.jp/img/news/3/19899/53692_s.jpg
			//   http://kt.wowkorea.jp/img/news/3/19899/53692_l.jpg - works
			//   http://kt.wowkorea.jp/img/news/3/19899/53692.jpg - 404
			// http://kt.wowkorea.jp/img/news/3/19961/53856_160.jpg

			// thanks to Gyuri on discord
			// http://www.wowkorea.jp/upload/photoSpecial/731/re_1-1.jpg -- 80x60
			//   http://www.wowkorea.jp/upload/photoSpecial/731/1-1.jpg -- 600x450
			newsrc = src.replace(/(\/upload\/+photoSpecial\/+[0-9]+\/+)re_([^/]*\.[^/.]*)(?:[?#].*)?$/, "$1$2");
			if (newsrc !== src)
				return newsrc;

			if (string_indexof(src, "/img/album/") < 0 &&
				!src.match(/\/upload\/news\/+[0-9]+\//)) {
				return src.replace(/([^/]*_)[a-z0-9]*(\.[^/.]*)$/, "$1l$2");
			}

			newsrc = src.replace(/_(?:[a-z0-9]|ss)(\.[^/.]*)$/, "$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nosub === "saostar.vn" &&
			domain.match(/img[0-9]*\.saostar\.vn/)) {
			// https://img.saostar.vn/fb660png_1/2017/11/04/1750083/img_0127.jpg/fbsscover.png
			//   https://img.saostar.vn/2017/11/04/1750083/img_0127.jpg
			newsrc = src
				.replace(/saostar.vn\/fb[0-9]+[^/]*(\/.*\.[^/.]*)\/[^/]*$/, "saostar.vn$1")
				.replace(/saostar.vn\/[a-z][0-9]+\//, "saostar.vn/")
				.replace(/saostar.vn\/[0-9]+x[0-9]+\//, "saostar.vn/");
			if (newsrc !== src)
				return newsrc;
		}

		// keep this?
		if (domain_nosub.match(/^google\./) &&
			src.match(/\/www\.google\.(?:[a-z]+\.)?[a-z]*\/url\?/)) {
			newsrc = src.replace(/.*url=([^&]*).*/, "$1");
			if (newsrc !== src && /^https?/.test(newsrc))
				return decodeURIComponent(newsrc);
		}

		if ((domain_nowww === "lipstickalley.com" ||
			 // https://stephenking.com/xf/proxy.php?image=http%3A%2F%2Fimages.askmen.com%2Fphotos%2Fdimension-films-presents-the-world-premiere-of-1408%2F20574.jpg&hash=f8f6f7179d75c0fd0a960ac5e65612a2
			 //   http://images.askmen.com/photos/dimension-films-presents-the-world-premiere-of-1408/20574.jpg
			 domain_nowww === "stephenking.com" ||
			 // https://forums.audioholics.com/forums/proxy.php?image=https%3A%2F%2Fd27t0qkxhe4r68.cloudfront.net%2Ft_300%2F095115881941.jpg%3F1401982484&hash=54776c8557b4835a9c8cae1ce1b0d56c
			 //   https://d27t0qkxhe4r68.cloudfront.net/t_300/095115881941.jpg?1401982484
			 domain === "forums.audioholics.com" ||
			 // https://www.ambercutie.com/forums/proxy.php?image=http%3A%2F%2F24.media.tumblr.com%2Fc4395a17e157f2a9d9dd7fb9c56495b6%2Ftumblr_mhkekoQgAh1qcr6iqo1_1280.jpg&hash=f7e1ba2a0eb3236d02ea79aa629dfc1a
			 //   http://66.media.tumblr.com/c4395a17e157f2a9d9dd7fb9c56495b6/tumblr_mhkekoQgAh1qcr6iqo1_1280.jpg
			 domain_nowww === "ambercutie.com" ||
			 // https://www.overlandbound.com/forums/proxy.php?image=https%3A%2F%2Fimages.craigslist.org%2F01212_fPIssUioOZZ_600x450.jpg&hash=3b56ef6d5815bbf2cdfa526d369e229b
			 domain_nowww === "overlandbound.com" ||
			 string_indexof(domain, "forum.purseblog.com") >= 0) &&
			string_indexof(src, "/proxy.php?") >= 0) {
			// https://www.lipstickalley.com/proxy.php?image=http%3A%2F%2Fwww.trendalert.nl%2Fpostsize%2Fw700-h759%2F201508%2F1441031539_MTV_VMA_Rita%2520Ora.jpg&hash=c9113b1d6e27f0f572b1423ba92979d0
			//   http://www.trendalert.nl/postsize/w700-h759/201508/1441031539_MTV_VMA_Rita%20Ora.jpg
			newsrc = src.replace(/.*image=([^&]*).*/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "images.askmen.com") {
			// http://images.askmen.com/photos/dimension-films-presents-the-world-premiere-of-1408/20574.jpg
			return {
				url: src,
				head_wrong_contentlength: true
			};
		}

		if ((domain_nosub === "127.net" && string_indexof(domain, "nosdn.127.net") >= 0) ||
			// thanks to contextnerror: https://github.com/qsniyg/maxurl/issues/965
			// https://imglf4.lf127.net/img/5a9bf93b166eff36/ZjhHL2g4R05GM3lvZFBrL1JpWHhXaGUxQ29FcVRxaFl0d2RBY3AwdHhVVT0.jpg?imageView&thumbnail=1680x0&quality=96&stripmeta=0&type=jpg
			//   https://imglf4.lf127.net/img/5a9bf93b166eff36/ZjhHL2g4R05GM3lvZFBrL1JpWHhXaGUxQ29FcVRxaFl0d2RBY3AwdHhVVT0.jpg
			// thanks to CetaceanNation on github: https://github.com/qsniyg/maxurl/issues/1057
			// https://imglf5.lf127.net/img/52be31cc369db74d/azlrUC85Vk9BQjNNVml4VEVyTG1YdEZSeFJwQ1hucEpmbDZsOU40WWpKWT0.jpg?imageView&thumbnail=500x0&quality=96&stripmeta=0&type=jpg
			//   https://imglf5.lf127.net/img/52be31cc369db74d/azlrUC85Vk9BQjNNVml4VEVyTG1YdEZSeFJwQ1hucEpmbDZsOU40WWpKWT0.jpg
			// https://imglf3.lf127.net/img/8268674b2387a247/SHhZR0graEhUOVByV3kvUlczSjVQT0tCREcyc2NKbU5XbjNqK3poUERKQT0.png?imageView&thumbnail=500x0&quality=96&stripmeta=0
			//   https://imglf3.lf127.net/img/8268674b2387a247/SHhZR0graEhUOVByV3kvUlczSjVQT0tCREcyc2NKbU5XbjNqK3poUERKQT0.png
			(domain_nosub === "lf127.net" && /^imglf[0-9]+\./.test(domain)) ||
			// https://pic-bucket.ws.126.net/photo/0003/2018-12-03/E23MBHK63LF60003NOS.jpg?imageView&thumbnail=690x465&quality=85&type=webp&interlace=1
			//   https://pic-bucket.ws.126.net/photo/0003/2018-12-03/E23MBHK63LF60003NOS.jpg
			domain === "pic-bucket.ws.126.net") { //lofter
			// http://imglf1.nosdn.127.net/img/cVVvSm1kaHhURWlQcVkyQVBzZ2lMRExONjBVS1N1UnZUV3dvQ3BtaFVuYjFuUk9EUG5OcnFnPT0.jpg?imageView&thumbnail=1680x0&quality=96&stripmeta=0&type=jpg%7Cwatermark&type=2&text=wqkg5p6B5ZywIC8ga3lva3VjaGkubG9mdGVyLmNvbQ==&font=bXN5aA==&gravity=southwest&dissolve=30&fontsize=680&dx=32&dy=36&stripmeta=0
			//   http://imglf1.nosdn.127.net/img/cVVvSm1kaHhURWlQcVkyQVBzZ2lMRExONjBVS1N1UnZUV3dvQ3BtaFVuYjFuUk9EUG5OcnFnPT0.jpg
			// http://imglf0.nosdn.127.net/img/cytFZVcyeDNVU2pvR0l0QkdXM0FBUmJuU1paTnVDQnM1UmJ4T3BhNE94WW1BZlVOQ1dLSld3PT0.png?imageView&thumbnail=500x0&quality=96&stripmeta=0&type=jpg
			// http://pic-bucket.nosdn.127.net/photo/0001/2018-01-24/D8SM4CRK00AP0001NOS.jpg?imageView&amp;thumbnail=100y75
			//   http://pic-bucket.nosdn.127.net/photo/0001/2018-01-24/D8SM4CRK00AP0001NOS.jpg
			// http://dingyue.nosdn.127.net/lJszRnDoqxNbRLPfYG2DackcH7WAEdAe=8SdmaEDOhxMz1542447679423compressflag.jpg?imageView&thumbnail=250x0&quality=85&type=jpg&interlace=1
			//   http://dingyue.nosdn.127.net/lJszRnDoqxNbRLPfYG2DackcH7WAEdAe=8SdmaEDOhxMz1542447679423compressflag.jpg
			return src.replace(/\?.*$/, "");
		}

		if (domain === "board.makeshop.co.kr") {
			// http://board.makeshop.co.kr/board/premium204/mastideco_image2/mini::20130513094047.jpg
			//   http://board.makeshop.co.kr/board/premium204/mastideco_image2/20130513094047.jpg
			return src.replace(/\/[a-z]*::/, "/");
		}

		if (domain_nosub === "naver.jp" &&
			domain.match(/^rr\.img[0-9]*\.naver\./)) {
			// https://rr.img1.naver.jp/mig?src=http%3A%2F%2Fimgcc.naver.jp%2Fkaze%2Fmission%2FUSER%2F20161018%2F76%2F7776016%2F17%2F600x450x28290423f03522c4ff136cd5.jpg&twidth=414&theight=0&qlt=80&res_format=jpg&op=r
			//   http://imgcc.naver.jp/kaze/mission/USER/20161018/76/7776016/17/600x450x28290423f03522c4ff136cd5.jpg
			//return decodeURIComponent(src.replace(/.*src=([^&]*).*/, "$1"));
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/mig.*?[?&]src=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeURIComponent(newsrc);
		}

		if (domain === "imgcc.naver.jp") {
			// http://imgcc.naver.jp/kaze/mission_anm/USER/20141027/15/1773065/0/thumb/450x253x18f52e3379003e23293ac0c3_300_600.gif
			//   http://imgcc.naver.jp/kaze/mission_anm/USER/20141027/15/1773065/0/450x253x18f52e3379003e23293ac0c3.gif
			// http://imgcc.naver.jp/kaze/mission_anm/USER/20141027/15/1773065/0/450x253x18f52e3379003e23293ac0c3.gif/300/600
			//   http://imgcc.naver.jp/kaze/mission_anm/USER/20141027/15/1773065/0/450x253x18f52e3379003e23293ac0c3.gif
			//return src.replace(/\/[0-9]+\/[0-9]+\/*$/, "");
			return src
				.replace(/\/thumb(\/[0-9]+x[0-9]+x[0-9a-f]+)_[0-9]+_[0-9]+(\.[^/.]*)$/, "$1$2")
				.replace(/\/[0-9]+\/[0-9]+\/*(?:[?&].*)?$/, "");
		}

		if (domain === "dimg.donga.com") {
			// http://dimg.donga.com/c/138/175/90/1/wps/NEWS/IMAGE/2018/04/04/89455472.2.jpg
			//   http://dimg.donga.com/wps/NEWS/IMAGE/2018/04/04/89455472.2.jpg
			// http://dimg.donga.com/a/280/60/90/2/wps/NEWS/FEED/Top_Main_Top_2013/89467049.1.thumb.jpg
			//   http://dimg.donga.com/wps/NEWS/FEED/Top_Main_Top_2013/89467049.1.thumb.jpg
			// 3, 4, 5, and 6 seem to be the same
			// other:
			// http://dimg.donga.com/egc/PHOTO/udata/photonews/image/201506/04/201506040012/A84P4320.jpg
			// http://dimg.donga.com/egc/PHOTO/udata/photonews/image/201406/05/201406050013/P90151637.jpg -- 6378x4252
			//   http://www.donga.com/BIZN/realestate/List/3/all/20141024/67412273/1
			//   https://dimg.donga.com/egc/PHOTO/udata/photonews/image/201408/19/201408190052/spl823546_002.jpg
			// http://www.donga.com/news/List/PoliticsN/article/all/20140826/66006935/1
			//   http://dimg.donga.com/egc/PHOTO/udata/photonews/image/201408/25/201408250020/1.jpg -- 2560x1707
			//   https://dimg.donga.com/wps/STUDIO/IMAGE/2014/08/25/1363601.1.jpg
			// https://dimg.donga.com/wps/NEWS/IMAGE/2014/08/26/66006897.2.jpg
			//   https://dimg.donga.com/wps/STUDIO/IMAGE/2014/08/25/1363600.1.jpg
			//   http://dimg.donga.com/egc/PHOTO/udata/photonews/image/201408/25/201408250020/2.jpg
			// https://dimg.donga.com/wps/NEWS/IMAGE/2013/11/18/58982640.3.jpg -- 4505x8026
			//   http://www.donga.com/news/article/all/20131118/58982687/1
			// http://dimg.donga.com/ugc/CDB/CHINA/Article/59/3c/c5/f0/593cc5f00d78d2738243.jpg -- 3372x2283
			//   http://china.donga.com/List/3/all/43/949830/1
			//   http://china.donga.com/Profile?cid=728339
			return src
				.replace(/\/[ca]\/(?:[0-9]+\/){4}/, "/")
				.replace(/\/i\/[0-9]+\/[0-9]+\/[0-9]+\//, "/");
		}

		if (domain === "imgpark.donga.com" && string_indexof(src, "/fileUpload/") >= 0) {
			// http://imgpark.donga.com/mbs/fileUpload/201507/02/55948bb91e89b4e44119.jpg
			return {
				url: src,
				headers: {
					Referer: "http://mlbpark.donga.com/"
				}
			};
		}

		if ((domain_nosub === "marishe.com" &&
			 domain.match(/s[0-9]\.marishe\.com/)) ||
			// https://www.klik.gr/uploads_image/2017/06/19/p1bivfplat1vjv1ls95fr57b10rlt_900.jpg
			//   https://www.klik.gr/uploads_image/2017/06/19/p1bivfplat1vjv1ls95fr57b10rlt.jpg
			(domain_nowww === "klik.gr" && string_indexof(src, "/uploads_image/") >= 0) ||
			// https://ug-ts.ru/psyzoo/content/pics/e7e/e7ed71ca9bdb10f35cabb3ac43c2104a_400.jpg
			//   https://ug-ts.ru/psyzoo/content/pics/e7e/e7ed71ca9bdb10f35cabb3ac43c2104a.jpg
			(domain_nowww === "ug-ts.ru" && /\/content\/+pics\//.test(src)) ||
			// http://eroticasearch.net/content/pics/ce9/ce9462d41e02e0c73662f316b1ebaf8f_400.jpg
			//   http://eroticasearch.net/content/pics/ce9/ce9462d41e02e0c73662f316b1ebaf8f.jpg
			(domain_nowww === "eroticasearch.net" && string_indexof(src, "/content/pics/") >= 0) ||
			// http://resource.breakingnews.mn/image/2015/09/30/0p23eruc8h4gu2mi/articleemmawatson167901856201509301039_400.jpg
			//   http://resource.breakingnews.mn/image/2015/09/30/0p23eruc8h4gu2mi/articleemmawatson167901856201509301039.jpg
			domain === "resource.breakingnews.mn") {
			newsrc = src.replace(/(\/[^/]*)_[0-9]+(\.[^/.]*)$/, "$1$2");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nowww === "klik.gr") {
			return {
				url: src,
				can_head: false
			};
		}

		// img77
		/*if (false && domain.match(/img[0-9]*\.dreamwiz\.com/)) {
			// most tested don't work (anymore?)
			// http://img77.dreamwiz.com/MV/2006/y/yfGjHAz_l.jpg -- 3000x1994
			// http://img77.dreamwiz.com/YTN_IMAGE/20180316/201803161101514477_d.jpg -- 2500x1667
			return src.replace(/(\/[^/]*)_[a-z]\.([^/.]*)$/, "$1_o.$2");
		}*/

		if (domain === "cdn.hk01.com") {
			// https://cdn.hk01.com/di/media/images/1016988/org/95b53d52af36ddfa9103948bdfc9ccdd.jpg/ZfwdPWx-CWi144GhhxOAdNml9EacWur1YaGOe2Ghjns?v=w1920 -- stretched
			//   https://cdn.hk01.com/di/media/images/1016988/org/95b53d52af36ddfa9103948bdfc9ccdd.jpg/ZfwdPWx-CWi144GhhxOAdNml9EacWur1YaGOe2Ghjns
			// https://cdn.hk01.com/di/media/images/1552737/org/b7034991651c8724ee7f02176fcd853b.JPG/h4N9QxvaH15uPPX8Agz_dSIL0ikqT1nBef3OuXn9zrk?v=w1920r16_9
			//   https://cdn.hk01.com/di/media/images/1552737/org/b7034991651c8724ee7f02176fcd853b.JPG/h4N9QxvaH15uPPX8Agz_dSIL0ikqT1nBef3OuXn9zrk
			// https://cdn.hk01.com/media/images/1432611/xlarge/4b37b8fbd88672371e5f090abc2acf59.jpg
			//   https://cdn.hk01.com/media/images/1432611/org/4b37b8fbd88672371e5f090abc2acf59.jpg
			// https://cdn.hk01.com/media/images/1357333/xlarge/43372fd2c8e52bec13601ad123401616.jpg -- stretched
			//   https://cdn.hk01.com/media/images/1357333/org/43372fd2c8e52bec13601ad123401616.jpg
			// thanks to leoli1110 on github for reporting: https://github.com/qsniyg/maxurl/issues/1297
			// https://cdn.hk01.com/di/media/images/dw/20220408/589109801313636352450837.jpeg/-ew3Wf-32cREsL9HLU0bslop6haQsfJEBjNV4QYzVeE?v=w640
			//   https://cdn.hk01.com/di/media/images/dw/20220408/589109801313636352450837.jpeg/-ew3Wf-32cREsL9HLU0bslop6haQsfJEBjNV4QYzVeE
			newsrc = src.replace(/\?.*/, "");
			if (newsrc !== src)
				return newsrc;

			return src.replace(/(\/media\/+images\/+[0-9]+\/+)[^/]+\//, "$1org/");
		}

		if (domain_nosub === "sinaimg.cn") {
			// works:
			// http://ss12.sinaimg.cn/orignal/66a6ce75g8b46ba3a373b&690
			// http://ss12.sinaimg.cn/orignal/6bc10695g923b8902976b&690
			// http://ss7.sinaimg.cn/orignal/67a7cd73g8b48c289ae26&690
			// http://ss6.sinaimg.cn/orignal/6b3178f4g92678953d725&690
			// thanks to fireattack on github for these examples: https://github.com/qsniyg/maxurl/issues/147#issue-503777148
			// https://wx4.sinaimg.cn/mw690/9a646dd9ly1g7qil8atsgj22ao328qv6.jpg
			//   https://wx4.sinaimg.cn/large/9a646dd9ly1g7qil8atsgj22ao328qv6.jpg
			// doesn't:
			// http://ww4.sinaimg.cn/large/ad769c8bgy1fnaovhjp4rj21m62iob2d.jpg
			//   http://ww4.sinaimg.cn/woriginal/ad769c8bgy1fnaovhjp4rj21m62iob2d.jpg - works
			// http://wx3.sinaimg.cn/large/71080fe4gy1fehxmeusddj21kw2ddb2a.jpg
			// https://wxt.sinaimg.cn/large/006Qyga5ly1fnsl8inznlj31ww2pgqv8.jpg
			//
			// http://k.sinaimg.cn/n/ent/transform/w150h100/20180227/Mf6R-fyrwsqi6927544.jpg/w150h100f1t0l0syf.png
			//   http://n.sinaimg.cn/sinacn/w603h580/20180227/b993-fyrwsqi5950343.jpg
			// http://n.sinaimg.cn/ent/transform/w500h750/20180206/FzeL-fyrhcqz0888399.jpg
			//   http://k.sinaimg.cn/ent/transform/w500h750/20180206/FzeL-fyrhcqz0888399.jpg - doesn't work (bad request)
			//   http://n.sinaimg.cn/sinacn/w500h750/20180206/FzeL-fyrhcqz0888399.jpg - doesn't work
			//
			// http://n.sinaimg.cn/translate/w750h484/20180206/c8U1-fyrhcqy9899138.jpg
			//   http://n.sinaimg.cn/transform/w750h484/20180206/c8U1-fyrhcqy9899138.jpg - doesn't work
			//
			// http://n.sinaimg.cn/translate/20170819/QwU0-fykcpru8486163.jpg
			//
			// http://n.sinaimg.cn/ent/4_ori/upload/a57892fc/w2048h3072/20180217/zPxq-fyrpeif2120125.jpg
			//
			// https://tc.sinaimg.cn/maxwidth.800/tc.service.weibo.com/img_mp_itc_cn/8236ed1acca6f9b1f2d57a59cb5088cf.jpg
			//   https://tc.sinaimg.cn/original/tc.service.weibo.com/img_mp_itc_cn/8236ed1acca6f9b1f2d57a59cb5088cf.jpg -- 403 if head
			//
			// https://wx4.sinaimg.cn/large/008gKD25ly1grw0kvjdhhj34na672b2l.jpg -- 6022x8030
			//   https://wx4.sinaimg.cn/original/008gKD25ly1grw0kvjdhhj34na672b2l.jpg -- same file
			if (src.match(/:\/\/[^/]*\/+max(?:width|height)\.[0-9]+\//)) {
				return {
					url: src.replace(/(:\/\/[^/]*\/+)[^/]*\//, "$1original/"),
					can_head: false
				};
			}

			if (domain.match(/^ss/)) {
				src = src.replace(/\.sinaimg\.cn\/+[^/]*\/+([^/]*)\/*$/, ".sinaimg.cn/orignal/$1");
			} else {
				src = src.replace(/\.sinaimg\.cn\/+[^/]*\/+([^/]*)\/*$/, ".sinaimg.cn/large/$1");
			}

			if (domain.match(/^n\./)) {
				// http://n.sinaimg.cn/ent/4_img/upload/75913a59/20170522/iHLB-fyfkzhs8250377.jpg
				//   http://n.sinaimg.cn/ent/4_ori/upload/75913a59/20170522/iHLB-fyfkzhs8250377.jpg
				newsrc = src.replace(/(\/ent\/+[0-9]+_)img(\/+upload\/)/, "$1ori$2");
				if (newsrc !== src)
					return newsrc;
			}

			// http://www.sinaimg.cn/qc/autoimg/serial/00/00/32182318_340.JPG
			//   http://www.sinaimg.cn/qc/autoimg/serial/00/00/32182318_src.JPG
			newsrc = src.replace(/(\/autoimg\/+serial\/+[0-9]{2}\/+[0-9]{2}\/+[0-9]+)_[0-9]+(\.[^/.]+)(?:[?#].*)?$/, "$1_src$2");
			if (newsrc !== src)
				return newsrc;

			// http://www.sinaimg.cn/dy/slidenews/4_t500/2014_15/704_1283534_165508.jpg
			//   http://www.sinaimg.cn/dy/slidenews/4_img/2014_15/704_1283534_165508.jpg
			newsrc = src.replace(/\/slidenews\/+([^/_]*)_[^/_]*\//, "/slidenews/$1_img/"); // there's also _ori, but it seems to be smaller?
			if (newsrc !== src)
				return newsrc;

			return {
				url: src,
				headers: {
					Referer: "https://weibo.com/"
				},
				referer_ok: {
					same_domain: true
				}
			}
		}

		if (domain_nosub === "sina.com.cn" && domain.match(/^static[0-9]\.photo\.sina\.com\.cn/)) {
			// http://static7.photo.sina.com.cn/medium/49d0afb2g87b3e7e7a066&690
			//   http://ss7.sinaimg.cn/medium/49d0afb2g87b3e7e7a066&690
			//   http://ss7.sinaimg.cn/orignal/49d0afb2g87b3e7e7a066&690
			return src.replace(/:\/\/static([0-9]*)\.photo\.sina\.com\.cn\//, "://ss$1.sinaimg.cn/");
		}

		if (domain === "sinaimg.acgsoso.com") {
			// https://sinaimg.acgsoso.com/mw690/007ZKdkxgy1gbpcfz57t9j30oo104442
			//   https://wx4.sinaimg.cn/large/007ZKdkxgy1gbpcfz57t9j30oo104442
			return src.replace(/:\/\/[^/]+\/+/, "://wx4.sinaimg.cn/");
		}

		if (domain === "thumbnail.egloos.net" ||
			// http://thumb.egloos.net/460x0/http://pds25.egloos.com/pds/201208/22/41/f0095041_503490baddcc4.jpg
			//   http://pds25.egloos.com/pds/201208/22/41/f0095041_503490baddcc4.jpg
			domain === "thumb.egloos.net") {
			// http://thumbnail.egloos.net/600x0/http://pds27.egloos.com/pds/201802/20/90/e0060990_5a8bc59b9b6c5.jpg
			//   http://pds27.egloos.com/pds/201802/20/90/e0060990_5a8bc59b9b6c5.jpg
			return src.replace(/^[a-z]+:\/\/thumb(?:nail)?\.egloos\.net\/[^/]*\/*/, "");
		}

		if (domain === "k.kakaocdn.net") {
			// https://k.kakaocdn.net/dn/YRLG1/btqfOF1cFrB/OgpuqdEHB0GR3FmuwUHMtK/img_l.jpg -- 800x1200
			//   https://k.kakaocdn.net/dn/YRLG1/btqfOF1cFrB/OgpuqdEHB0GR3FmuwUHMtK/img.jpg -- 3000x4500
			return src.replace(/\/img_[a-z]*\.([^./]*)$/, "/img.$1");
		}

		if (domain === "images.sportskhan.net" ||
			// thanks to fireattack on discord:
			// https://images.khan.co.kr/article/2023/05/11/news-p.v1.20230511.a63cbc0d860e4216905e878604f34693_P1.png
			//   https://images.khan.co.kr/article/2023/05/11/news-p.v1.20230511.a63cbc0d860e4216905e878604f34693.png
			domain === "images.khan.co.kr" ||
			// http://img.khan.co.kr/news/2018/08/13/l_2018081401000000000117731.jpg
			//   http://img.khan.co.kr/news/2018/08/13/2018081401000000000117731.jpg
			domain === "img.khan.co.kr") {
			newsrc = src
			// http://images.sportskhan.net/article/r/155x155/2016/04/25/l_2016042502001091100264931.jpg
			//   http://images.sportskhan.net/article/2016/04/25/l_2016042502001091100264931.jpg
				.replace(/\/r\/[0-9]+x[0-9]+\//, "/")
			// http://images.sportskhan.net/article/2016/04/25/l_2016042502001091100264931.jpg
			//   http://images.sportskhan.net/article/2016/04/25/2016042502001091100264931.jpg
				.replace(/\/[a-z]*_([0-9]+\.[a-z0-9A-Z]*)$/, "/$1")
			// http://images.sportskhan.net/spkn/ranking/c/94x94/3100/310005/20180904135417_31000501.jpeg
			//   http://images.sportskhan.net/spkn/ranking/3100/310005/20180904135417_31000501.jpeg
				.replace(/\/c\/[0-9]*x[0-9]*\//, "/")
			// http://img.khan.co.kr/news/2011/01/25/20110125.01200199991308.03S.jpg
			//   http://img.khan.co.kr/news/2011/01/25/20110125.01200199991308.03L.jpg -- L, M, S (tested all uppercase, lowercase)
				.replace(/(\/news\/[0-9]{4}\/[0-9]{2}\/[0-9]{2}\/[0-9]{8}\.[0-9]+\.[0-9]+)[A-Z](\.[^/.]*)$/, "$1L$2")
			// thanks to fireattack on discord:
			// https://img.khan.co.kr/lady/2023/05/09/news-p.v1.20230508.8379ed33bccf4803893c07db45cbddd8_P1.webp
			//   https://img.khan.co.kr/lady/2023/05/09/news-p.v1.20230508.8379ed33bccf4803893c07db45cbddd8.webp
				.replace(/(\/news-p\.v[0-9]+\.[0-9]{8}\.[0-9a-f]{20,})_[A-Z][0-9]+(\.[^/.]*)$/, "$1$2")
			// http://images.sportskhan.net/photodb/c/85x85/16/2017/10/25/GettyImages-865606556_594_screen.jpg
			//   http://images.sportskhan.net/PhotoDB/16/2017/10/25/GettyImages-865606556_594_screen.jpg
				.replace(/\/photodb\//, "/PhotoDB/");
			return {
				url: newsrc,
				head_wrong_contentlength: true
			};
		}

		if (domain_nosub === "sbs.co.kr" &&
			domain.match(/^img[0-9]*\.sbs\.co\.kr/)) {
			// http://img.sbs.co.kr/sbscnbc/upload/2017/11/06/10000590366_700.jpg
			//   http://img.sbs.co.kr/sbscnbc/upload/2017/11/06/10000590366.jpg
			// https://img.sbs.co.kr/newsnet/etv/upload/2019/04/21/30000626551_16v9.jpg
			//   https://img.sbs.co.kr/newsnet/etv/upload/2019/04/21/30000626551.jpg
			newsrc = src.replace(/(\/[0-9]+)_[0-9v]+\.([a-z0-9A-Z]*)$/, "$1.$2");
			if (newsrc !== src)
				return newsrc;

			// http://img2.sbs.co.kr/img/sbs_cms/SR/2017/06/26/SR88942637_w640_h360.jpg
			//   http://img2.sbs.co.kr/img/sbs_cms/SR/2017/06/26/SR88942637_ori.jpg
			return src.replace(/(\/[^_]*)_[^/.]*(\.[^/.]*)$/, "$1_ori$2");
		}

		if (domain === "image.board.sbs.co.kr") {
			// http://image.board.sbs.co.kr/2018/02/02/h191517549706907-600.jpg
			//   http://image.board.sbs.co.kr/2018/02/02/h191517549706907.jpg
			return src.replace(/-[0-9]+(\.[^/.]*)$/, "$1");
		}

		if (domain === "photocloud.sbs.co.kr") {
			// https://photocloud.sbs.co.kr/S01_P462511102/thumb/65279fd45d38a2208180fe79-640.jpg
			//   https://photocloud.sbs.co.kr/origin/edit/S01_P462511102/65279fd45d38a2208180fe79-p.jpg
			// https://photocloud.sbs.co.kr/S01_P462511102/thumb/64f95cccc483fa1f61ab61c1-c600x600.jpg
			//   https://photocloud.sbs.co.kr/origin/edit/S01_P462511102/64f95cccc483fa1f61ab61c1-p.jpg
			return src.replace(/(:\/\/[^/]+\/+)([^/]+\/+)thumb\/+([0-9a-f]{10,})-(?:[0-9]+|c[0-9]+x[0-9]+)\./, "$1origin/edit/$2$3-p.");
		}

		if (domain === "board.sbs.co.kr") {
			// thanks to anonymous for reporting:
			// https://board.sbs.co.kr/popup/pc/imageView?imageUrl=https%3A%2F%2Fphotocloud.sbs.co.kr%2Forigin%2Fedit%2FS01_V0000010182%2F652cf858ce7ede2f9a1eed5a-p.jpg&imageAlt=Inkigayo%20Ive
			//   https://photocloud.sbs.co.kr/origin/edit/S01_V0000010182/652cf858ce7ede2f9a1eed5a-p.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+popup\/+pc\/+imageView\?(?:.*&)?imageUrl=([^&]+)(?:[&#].*)?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nosub === "edaily.co.kr" &&
			string_indexof(domain, "image.edaily.co.kr") >= 0 ||
			string_indexof(domain, "img.edaily.co.kr") >= 0) {
			// http://spnimage.edaily.co.kr/images/Photo/files/NP/S/2018/02/PS18021400011h.jpg
			// http://image.edaily.co.kr/images/Photo/files/NP/S/2018/02/PS18021100248t.jpg
			// (none, g), b, t, h, s, m
			// http://img.edaily.co.kr/images/photo/files/NP/S/2018/04/b_5ACD63A4B813DB7E7DBDBA63.jpg
			//   http://img.edaily.co.kr/images/photo/files/NP/S/2018/04/5ACD63A4B813DB7E7DBDBA63.jpg
			// others:
			// http://www.edaily.co.kr/news/news_detail.asp?newsId=01203766619110520&mediaCodeNo=257
			//  http://image.edaily.co.kr/images/photo/files/NP/S/2018/02/PS18021400103.jpg (original?)
			//  http://image.edaily.co.kr/images/photo/files/HN/H/2018/02/HNE01203766619110520_LV1.jpg - zoomed in
			//  http://image.edaily.co.kr/images/photo/files/HN/H/2018/02/HNE01203766619110520.jpg - not zoomed in, but cropped
			// http://image.edaily.co.kr/images/photo/files/NP/S/2016/04/PS16040100068.jpg - 3278x4918

			// http://edaily.co.kr/news/news_detail.asp?newsId=02059846615960080&mediaCodeNo=257
			//  http://image.edaily.co.kr/images/photo/files/NP/S/2017/06/PS17060900211.jpg
			//
			//    http://beautyin.edaily.co.kr/read/news.asp?newsid=329216886615960080
			//     http://superdeskapi.edaily.co.kr/api/upload/5939e0ffb813db52b1fb81aa/raw?_schema=http
			return src
				.replace(/\/[a-z]_([A-Z0-9]+)\.([a-z0-9A-Z]*)$/, "/$1.$2")
				.replace(/(\/[A-Z0-9]+)[a-z]\.([a-z0-9A-Z]*)$/, "$1.$2");
		}

		// cloudinary
		// /master/master/ is another possible alternative
		if (domain === "media.glamour.com" ||
			// https://media.glamour.com/photos/58c420d33b757b7cc97d0a5f/master/w_644,c_limit/emma-watson.jpg

			// https://assets.teenvogue.com/photos/56c648746d38be8a461b4c31/master/pass/GettyImages-104044913_master.jpg
			domain === "assets.teenvogue.com" ||
			// https://assets.vogue.com/photos/55c651b108298d8be2265985/16:9/pass/00010fullscreen.jpg
			domain === "assets.vogue.com" ||
			// http://media.vanityfair.com/photos/58a77812c41f737fae527fab/16:9/w_1200,h_630,c_limit/t-march-issue-ed-letter-trump.jpg
			domain === "media.vanityfair.com" ||
			// http://media.gq.com/photos/58eb8e4c8e4ae708183f9291/3:2/w_300/Stephen-Curry-0517-GQ-FECU02-01.jpg
			domain === "media.gq.com" ||
			// https://media.wmagazine.com/photos/5b2fa4640008757085e61704/1:1/w_767/GettyImages-982174754.jpg
			domain === "media.wmagazine.com" ||
			// https://media.self.com/photos/5b5a606cf658c67200f6a772/4:3/w_570/SELF%2520film-139.jpg
			domain === "media.self.com" ||
			// https://media.pitchfork.com/photos/5931ce6dd13a3d6b24765f82/2:1/w_790/fd0304ef.jpeg
			domain === "media.pitchfork.com" ||
			// https://media.wired.com/photos/5b8837d22997aa2df18d9970/16:9/w_2400,c_limit/roomba.jpg
			domain === "media.wired.com" ||
			// https://media.golfdigest.com/photos/5a7498e5b9a33161e3689aa9/master/w_780,c_limit/180202-sb-party.jpg
			domain === "media.golfdigest.com" ||
			// https://media.architecturaldigest.com/photos/56380571a6f997a353b888a2/master/w_640,c_limit/worlds-best-stained-glass-windows-13-10.jpg
			domain === "media.architecturaldigest.com" ||
			// https://media.cntraveler.com/photos/59bb6a56e35d8f08044a32cf/16:9/pass/Rakotzbrucke-GettyImages-538162756.jpg
			// http://media.cntraveler.com/photos/59305e5611e6e853c33e7587/master/w_1440,c_limit/car-free-halibut-cove-alaska-GettyImages-496660709.jpg
			domain === "media.cntraveler.com" ||
			// https://media.allure.com/photos/5771af392554df47220a75cb/3:4/w_767/beauty-trends-blogs-daily-beauty-reporter-2016-05-19-selena-gomez-hair.jpg
			domain === "media.allure.com" ||
			src.match(/:\/\/[^/]*\/photos\/[0-9a-f]{24}\/[^/]*\/[^/]*\/[^/]*$/)) {
			newsrc = src.replace(/\/[^/]*\/[^/]*\/([^/]*)$/, "/original/original/$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nosub === "cloudinary.com" ||
			// http://images.playmates.com/playboy-digital/image/fetch/q_80/http://images.contentful.com/l7es9q9kzr9z/KVC2bUAzyUkW6KaMgGkeA/2f45f07b331a60fc360ff8d641a29d7a/778_KimberlyMcArthur_15.jpg
			//   http://images.contentful.com/l7es9q9kzr9z/KVC2bUAzyUkW6KaMgGkeA/2f45f07b331a60fc360ff8d641a29d7a/778_KimberlyMcArthur_15.jpg
			domain === "images.playmates.com" ||
			// https://images.playboy.com/playboy-digital/image/fetch/s--s1yV9nz0--/c_fit,h_1024,q_80,w_1024/http://images-origin.playboy.com/ogz4nxetbde6/3CJdCBvUEU2qaE6E00CYQU/a8277fb2808ea265a219036c150c4ffe/24_Dodger.jpg
			// https://images.playboy.com/playboy-digital/image/fetch/s--82ZXSENj--/c_fit,h_1024,q_80,w_1024%2Fhttp%3A%2F%2Fimages-origin.playboy.com%2Fogz4nxetbde6%2F5hBHszaLoWia0AGcMQQOKs%2F84892f7ff68f2755536203b369398814%2F04_Dodger.jpg
			//   http://images-origin.playboy.com/ogz4nxetbde6/5hBHszaLoWia0AGcMQQOKs/84892f7ff68f2755536203b369398814/04_Dodger.jpg
			domain === "images.playboy.com" ||
			// https://transcode3.app.engoo.com/image/fetch/f_auto,c_lfill,w_300,dpr_1/https://assets.app.engoo.com/images/5jlP76Tw4fNwJDhoBVqrqT.jpeg
			//   https://assets.app.engoo.com/images/5jlP76Tw4fNwJDhoBVqrqT.jpeg
			(domain_nosub === "engoo.com" && domain.match(/^transcode[0-9]*\.app\./)) ||
			// http://images.thehollywoodgossip.com/iu/s--09NH5dFF--/t_xlarge_l/f_auto,fl_lossy,q_75/v1375379663/rihanna-natural-hair.jpg
			//   http://images.thehollywoodgossip.com/iu/s--09NH5dFF--/v1375379663/rihanna-natural-hair.jpg
			//   http://images.thehollywoodgossip.com/iu/v1375379663/rihanna-natural-hair.jpg -- also works
			domain === "images.thehollywoodgossip.com" ||
			// https://cdn.apartmenttherapy.info/image/fetch/f_auto,q_auto:eco/https%3A%2F%2Fstorage.googleapis.com%2Fgen-atmedia%2F3%2F2018%2F03%2F43997be9fb4a1acca400bfea464fe31701f17157.jpeg
			//   https://storage.googleapis.com/gen-atmedia/3/2018/03/43997be9fb4a1acca400bfea464fe31701f17157.jpeg
			domain === "cdn.apartmenttherapy.info" ||
			// https://image.thestartmagazine.com/fetch/d_magazineDefault.jpg,c_fill,g_face:auto,fl_lossy,q_70,w_480/http%3A%2F%2Fimages.summitmedia-digital.com%2Fpreview%2Fimages%2F2019%2F10%2F07%2Fmimiyuh-nm.jpg
			//   http://images.summitmedia-digital.com/preview/images/2019/10/07/mimiyuh-nm.jpg
			domain === "image.thestartmagazine.com" ||
			// https://cdn.substack.com/image/fetch/c_limit,q_auto:good,f_auto/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F0d3b9fbf-c06e-4b6e-ac84-13c53da04462_952x400.png
			//   https://bucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com/public/images/0d3b9fbf-c06e-4b6e-ac84-13c53da04462_952x400.png
			domain === "cdn.substack.com" ||
			// https://c.bellesa.co/dkvdbifey/image/fetch/h_250,q_75,ar_16:9,c_fill,f_auto//https://i.bellesa.co/video_upload/2350cover.jpg
			//   https://i.bellesa.co/video_upload/2350cover.jpg
			domain === "c.bellesa.co" ||
			// https://images.haarets.co.il/image/fetch/fl_lossy.any_format.preserve_transparency.progressive:none/https://www.haaretz.co.il/polopoly_fs/1.8674827!/image/4132815329.jpg
			//   https://www.haaretz.co.il/polopoly_fs/1.8674827!/image/4132815329.jpg
			domain === "images.haarets.co.il" ||
			// https://assets.mocha.global/mobicast/image/fetch/w_144,q_40/https%3A%2F%2Fr.kelkoo.com%2Fresize.php%3Fcountry%3Dde%26merchantId%3D16240913%26categoryId%3D134101%26width%3D90%26height%3D90%26image%3Dhttps%253A%252F%252Fstatic.shop-apotheke.com%252Fimages%252FD12391508-p1.jpg%26sign%3DESE.mSGBandnnojBPJJ9hgnoooEByCwODsLQPH42iEY-
			//   https://r.kelkoo.com/resize.php?country=de&merchantId=16240913&categoryId=134101&width=90&height=90&image=https://static.shop-apotheke.com/images/D12391508-p1.jpg&sign=ESE.mSGBandnnojBPJJ9hgnoooEByCwODsLQPH42iEY-
			domain === "assets.mocha.global" ||
			// https://tbn.bidorbuy.co.za/image/fetch/dpr_1.0,f_auto,t_btbnx/https://media.loot.co.za/images/x400/7756832250603179215.jpg
			//   https://media.loot.co.za/images/x400/7756832250603179215.jpg
			domain === "tbn.bidorbuy.co.za" ||
			// https://resources.sonyliv.com/image/fetch/h_254,w_438,c_fill,fl_lossy,f_auto,q_auto,e_contrast:30,e_brightness:10/https%3A%2F%2Fcf-images.ap-southeast-1.prod.boltdns.net%2Fv1%2Fjit%2F5182475815001%2F9fd45fd7-fdd4-4835-b3bf-d2e2680c1684%2Fmain%2F720x405%2F1m43s780ms%2Fmatch%2Fimage.jpg
			//   https://cf-images.ap-southeast-1.prod.boltdns.net/v1/jit/5182475815001/9fd45fd7-fdd4-4835-b3bf-d2e2680c1684/main/720x405/1m43s780ms/match/image.jpg -- different image
			domain === "resources.sonyliv.com" ||
			// thanks to Liz on discord:
			// https://cdn.allbirds.com/image/fetch/q_auto,f_auto/w_1200,f_auto,q_auto,b_rgb:f5f5f5/https://cdn.shopify.com/s/files/1/1104/4168/products/AB001AM_SHOE_PAIR_GLOBAL_MENS_WOOL_RUNNER_FLUFFY_NATURAL_BLACK_BLACK_13f4a5b2-ae41-4afa-bbf7-9732e3cf79fb.png?v=1653493222
			//   https://cdn.shopify.com/s/files/1/1104/4168/products/AB001AM_SHOE_PAIR_GLOBAL_MENS_WOOL_RUNNER_FLUFFY_NATURAL_BLACK_BLACK_13f4a5b2-ae41-4afa-bbf7-9732e3cf79fb.png?v=1653493222
			domain === "cdn.allbirds.com" ||
			// https://images2.minutemediacdn.com/image/fetch/http%3A%2F%2Fwww.media2.hw-static.com%2Fmedia%2F2015%2F12%2Ftaylor-swift-april-2008-getty-121115.jpg
			//   https://www.media2.hw-static.com/media/2015/12/taylor-swift-april-2008-getty-121115.jpg
			(domain_nosub === "minutemediacdn.com" && /^images[0-9]*\./.test(domain)) ||
			// https://imagecache.365scores.com/image/fetch/f_png,w_240,h_132,c_fill,q_auto:eco,dpr_1,g_auto,d_WebSite:AssetsSVG:Logo:ic_dashboard_video_placeholder_light.png/https%3A%2F%2Fimg.gazeta.ru%2Ffiles3%2F784%2F13456784%2FAP_21025219541639-pic905-895x505-37993.jpg
			//   https://img.gazeta.ru/files3/784/13456784/AP_21025219541639-pic905-895x505-37993.jpg
			domain === "imagecache.365scores.com" ||
			domain === "images.taboola.com" ||
			// thanks to anonymous for reporting:
			// https://c.neevacdn.net/image/fetch/s--PcaC38mF--/https%3A//assets.mubi.com/images/notebook/post_images/24771/images-w1400.jpg%3F1511016423?savepath=images-w1400.jpg
			//   https://assets.mubi.com/images/notebook/post_images/24771/images-w1400.jpg?1511016423?savepath=images-w1400.jpg
			domain === "c.neevacdn.net" ||
			// thanks to anonymous for reporting:
			// https://substackcdn.com/image/fetch/w_1166,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack.com%2Fimg%2Fhome_page%2Fhero_image.png
			//   https://substack.com/img/home_page/hero_image.png
			// https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2Fecdbb34f-056e-48a0-8074-62580cfaf8e5_1024x683.jpeg
			//   https://substackcdn.com/image/fetch/c_limit/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2Fecdbb34f-056e-48a0-8074-62580cfaf8e5_1024x683.jpeg
			domain === "substackcdn.com" ||
			/\/image\/+fetch\/+.*?\/+https?(?::|%3A)(?:\/\/|%2F%2F)/.test(src)) {
			// https://res.cloudinary.com/emazecom/image/fetch/c_limit,a_ignore,w_320,h_200/https%3A%2F%2Fimg-aws.ehowcdn.com%2F877x500p%2Fs3.amazonaws.com%2Fcme_public_images%2Fwww_ehow_com%2Fi.ehow.com%2Fimages%2Fa04%2Fbd%2Fic%2Fchemical-energy-work-3.1-800x800.jpg
			// https://images.taboola.com/taboola/image/fetch/f_jpg%2Cq_auto%2Cc_fill%2Cg_faces:auto%2Ce_sharpen/https%3A%2F%2Fwww.gannett-cdn.com%2F-mm-%2F2e56892f6a349ad47192b530425d443fb365e5e9%2Fr%3Dx1803%26c%3D3200x1800%2Fhttps%2Fmedia.gannett-cdn.com%2F37861007001%2F37861007001_5735420050001_5735409691001-vs.jpg%3FpubId%3D37861007001
			// https://res.cloudinary.com/emazecom/image/fetch/c_limit,a_ignore,w_320,h_200/http%3A%2F%2Fcdn.expansion.mx%2Fdims4%2Fdefault%2F5227468%2F2147483647%2Fthumbnail%2F850x478%255E%2Fquality%2F75%2F%3Furl%3Dhttps%253A%252F%252Fcdn.expansion.mx%252Fmedia%252F2010%252F06%252F08%252Fobreros-chinos-trabajadores-china.jpg
			// https://res.cloudinary.com/practicaldev/image/fetch/s--MF38Atq3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://gateoverflow.in/%3Fqa%3Dblob%26qa_blobid%3D14382465908978628560
			//   https://gateoverflow.in/?qa=blob&qa_blobid=14382465908978628560
			if (src.search(/:\/\/[^/]*\/(?:[^/]*\/+)?(?:image\/+)?fetch\//) >= 0) {
				// https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2Fecdbb34f-056e-48a0-8074-62580cfaf8e5_1024x683.jpeg
				//   https://substackcdn.com/image/fetch/c_limit/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2Fecdbb34f-056e-48a0-8074-62580cfaf8e5_1024x683.jpeg
				newsrc = src.replace(/(.*?:\/\/[^/]*\/(?:[^/]*\/)?(?:image\/+)?fetch\/+)(?:.*?\/)?(https?(?::|%3A)(?:\/|%2F).*)/, "$1c_limit/$2");
				if (newsrc !== src)
					return {
						url: newsrc,
						head_wrong_contenttype: true
					};

				newsrc = src.replace(/.*?:\/\/[^/]*\/(?:[^/]*\/)?(?:image\/+)?fetch\/(?:.*?(?:\/|%2F))?([^/%]*(?::|%3A)(?:\/|%2F).*)/, "$1");
				newsrc = newsrc.replace(/\?savepath=[^&#?]+$/, "");
				if (/^[^/:]*%3A/.test(newsrc) ||
					(string_indexof(newsrc, "?") < 0 && string_indexof(newsrc, "%3F") >= 0))
					newsrc = decodeURIComponent(newsrc);
				return newsrc;
			}

			// https://the-hollywood-gossip-res.cloudinary.com/iu/s--xSziJrCi--/t_v_xlarge_l/cs_srgb,f_auto,fl_strip_profile.lossy,q_auto:420/v1409168696/video/victoria-justice-twerks-dances-like-nicki-minaj.png
			//   https://the-hollywood-gossip-res.cloudinary.com/iu/v1409168696/video/victoria-justice-twerks-dances-like-nicki-minaj.png
			newsrc = src.replace(/(\/iu\/[^/]*)\/.*?(\/v[0-9]*\/)/, "$1$2");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nosub === "jpimedia.uk" && domain.match(/^images(?:-[a-z])?\./)) {
			// https://images-a.jpimedia.uk/imagefetch/w_700,f_auto,ar_3:2,q_auto:low,c_fill/if_h_lte_200,c_mfit,h_201/https://www.lep.co.uk/webimage/1.9676998.1553766389!/image/image.jpg
			//   https://www.lep.co.uk/webimage/1.9676998.1553766389!/image/image.jpg
			return src.replace(/^[a-z]+:\/\/[^/]*\/+imagefetch\/+.*?\/(https?:\/\/)/, "$1");
		}

		// https://res.cloudinary.com/beamly/image/upload/s--Ayyiome3--/c_fill,g_face,q_70,w_479/f_jpg/v1/news/sites/6/2014/11/Nick-Hewer-The-Apprentice.jpg
		//   https://res.cloudinary.com/beamly/image/upload/v1/news/sites/6/2014/11/Nick-Hewer-The-Apprentice.jpg
		//   https://res.cloudinary.com/beamly/image/upload/news/sites/6/2014/11/Nick-Hewer-The-Apprentice.jpg
		// https://res.cloudinary.com/beamly/image/upload/s--pMOefc2U--/c_fill,g_face,q_70,w_1160/f_jpg/v1/news/sites/6/2014/05/LuisaSwimsuit621.jpg
		//   https://res.cloudinary.com/beamly/image/upload/v1/news/sites/6/2014/05/LuisaSwimsuit621.jpg
		// https://res.cloudinary.com/beamly/image/upload/s--1uSHUtr1--/c_fill,g_face,q_70,w_1160/f_jpg/v1/news/sites/6/2013/12/o-katie-hopkins-570.jpg
		//   https://res.cloudinary.com/beamly/image/upload/v1/news/sites/6/2013/12/o-katie-hopkins-570.jpg
		// http://thefader-res.cloudinary.com/private_images/w_1440,c_limit,f_auto,q_auto:best/Badgyal5RGB_wbgyon/bad-gyal-nicest-cocky-interview-dancehall-catalan.jpg
		//   http://thefader-res.cloudinary.com/private_images/c_limit/Badgyal5RGB_wbgyon/bad-gyal-nicest-cocky-interview-dancehall-catalan.jpg
		// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/440
		// https://thefader-res.cloudinary.com/private_images/c_limit,w_1024/c_crop,h_576,w_1024,x_0,y_0/h_100,w_100,c_fill,g_face,f_auto,q_auto:eco/maxresdefault_8_izscqi/watch-lil-durks-new-video-the-voice.jpg
		//   https://thefader-res.cloudinary.com/private_images/c_limit/maxresdefault_8_izscqi/watch-lil-durks-new-video-the-voice.jpg
		// https://thefader-res.cloudinary.com/private_images/c_limit,w_1024/c_crop,h_587,w_1017,x_7,y_37/w_300,c_limit,f_auto,q_auto:eco/GettyImages-946045380_dg6mdo/GettyImages-946045380_dg6mdo.jpg
		//   https://thefader-res.cloudinary.com/private_images/c_limit/GettyImages-946045380_dg6mdo/GettyImages-946045380_dg6mdo.jpg
		// https://thefader-res.cloudinary.com/private_images/c_limit,w_1024/c_crop,h_591,w_1017,x_7,y_35/w_300,c_limit,f_auto,q_auto:eco/GettyImages-1180497945_4_xkstxf/GettyImages-1180497945_4_xkstxf.jpg
		//   https://thefader-res.cloudinary.com/private_images/c_limit/GettyImages-1180497945_4_xkstxf/GettyImages-1180497945_4_xkstxf.jpg
		// https://res.cloudinary.com/dk-find-out/image/upload/q_80,w_1920,f_auto/MA_00079563_yvu84f.jpg
		// https://res.cloudinary.com/jerrick/image/upload/p7jbqvi0aoxm4mdn3x6x
		// https://talenthouse-res.cloudinary.com/image/upload/c_limit,f_auto,fl_progressive,h_2048,w_2048/v1457507984/user-555017/submissions/a1kqddzzmsoyjxh2mkks.jpg
		//   https://talenthouse-res.cloudinary.com/image/upload/c_limit,f_auto,fl_progressive,h_2048,w_2048/user-555017/submissions/a1kqddzzmsoyjxh2mkks.jpg
		//   https://talenthouse-res.cloudinary.com/image/upload/v1457507984/user-555017/submissions/a1kqddzzmsoyjxh2mkks.jpg
		//   https://talenthouse-res.cloudinary.com/image/upload/user-555017/submissions/a1kqddzzmsoyjxh2mkks.jpg
		// https://nordot-res.cloudinary.com/t_size_l/ch/images/359126053920392289/origin_1.jpg
		//   https://nordot-res.cloudinary.com/ch/images/359126053920392289/origin_1.jpg
		// https://the-hollywood-gossip-res.cloudinary.com/iu/s--xSziJrCi--/t_v_xlarge_l/cs_srgb,f_auto,fl_strip_profile.lossy,q_auto:420/v1409168696/video/victoria-justice-twerks-dances-like-nicki-minaj.png
		// http://res-4.cloudinary.com/uan/image/private/c_fill,d_event_default.jpg,g_north,h_640,q_80,w_1280/jzigjdloajy6wzbzqjk1.jpg
		//   http://res-4.cloudinary.com/uan/image/private/c_limit/jzigjdloajy6wzbzqjk1.jpg
		// https://res.cloudinary.com/teepublic/image/private/s--AcQdRwqc--/t_Resized%20Artwork/c_fit,g_north_west,h_1054,w_1054/co_ffffff,e_outline:53/co_ffffff,e_outline:inner_fill:53/co_bbbbbb,e_outline:3:1000/c_mpad,g_center,h_1260,w_1260/b_rgb:eeeeee/c_limit,f_jpg,h_630,q_90,w_630/v1518936493/production/designs/2373946_0.jpg
		// thanks to anonymous for reportign:
		// https://res-2.cloudinary.com/dostuff-media/image//upload//w_1200,q_75,c_limit,f_auto/v1484762076/page-image-7848-47724fd0-0f2e-4251-9f42-6154a2baf765.jpg
		//   https://res-2.cloudinary.com/dostuff-media/image/upload//w_1200,q_75,c_limit,f_auto/v1484762076/page-image-7848-47724fd0-0f2e-4251-9f42-6154a2baf765.jpg
		//   https://res-2.cloudinary.com/dostuff-media/image/upload/page-image-7848-47724fd0-0f2e-4251-9f42-6154a2baf765.jpg
		if ((domain_nosub === "cloudinary.com" && /res(?:-[0-9]+)?\./.test(domain)) ||
			// https://i.kinja-img.com/gawker-media/image/upload/s--aj1fB409--/c_fill,f_auto,fl_progressive,g_center,h_675,q_80,w_1200/181f6al0l60gjjpg.jpg -- stretched, cropped
			//   https://i.kinja-img.com/gawker-media/image/upload/181f6al0l60gjjpg.jpg
			domain === "i.kinja-img.com") {
			newsrc = src
				// depends on repetition
				.replace(/\/image\/+upload\/+/, "/image/upload/")
				.replace(/\/image\/upload\/s\-\-[^/]*\-\-\//, "/image/upload/")
				.replace(/\/iu\/s\-\-[^/]*\-\-\//, "/iu/")
				.replace(/\/image\/upload\/[^/]*_[^/]*\//, "/image/upload/")
				.replace(/\/image\/upload\/v[0-9]+\//, "/image/upload/")
				//.replace(/(\/image\/upload\/)(?:(?:.*?\/?(v1\/))|(?:[^/]*\/))/, "$1$2")
				//.replace(/(\/private_images\/)[^/]*\//, "$1c_limit/")
				.replace(/(\/private_images\/+)(?:c_limit\/+)?[chwxyfq]_[^/]*\//, "$1c_limit/")
				.replace(/(\/image\/private\/)[^s][^-][^/]*\//, "$1c_limit/")
				.replace(/(:\/\/[^/]*\/)[^/]*\/(ch\/images\/[0-9]+\/[^/]*$)/, "$1$2");
			if (newsrc !== src) {
				return {
					url: newsrc,
					head_wrong_contentlength: true
				};
			}

			//return src.replace(/\/image\/+upload\/+[a-z]l?[_-][^/]*\//, "/image/upload/");
		}

		if (domain === "fiverr-res.cloudinary.com" ||
			// https://assets.lybrate.com/q_auto,f_auto,h_80,w_120,c_fill,g_auto/imgs/tic/improving-hair-health/male/Improving-Hair-Health-male-02.jpg
			//   https://assets.lybrate.com/imgs/tic/improving-hair-health/male/Improving-Hair-Health-male-02.jpg
			domain === "assets.lybrate.com") {
			// https://fiverr-res.cloudinary.com/w_iw_div_3.0,q_auto,f_auto/general_assets/homepage/assets/f6/desktop_subcategory_logo.jpg
			//   https://fiverr-res.cloudinary.com/general_assets/homepage/assets/f6/desktop_subcategory_logo.jpg
			// https://fiverr-res.cloudinary.com/images/t_main1,q_auto,f_auto/gigs/106410116/original/de3608cf995c4b2de061c6147d7f5899b5dacc12/get-you-authoritative-media-citation-on-nbc-cbs-abc-and-fox.jpg
			//   https://fiverr-res.cloudinary.com/images/gigs/106410116/original/de3608cf995c4b2de061c6147d7f5899b5dacc12/get-you-authoritative-media-citation-on-nbc-cbs-abc-and-fox.jpg
			return src.replace(/(:\/\/[^/]*\/+(?:images\/+)?)[a-z]_[^/]*\//, "$1");
		}

		if (domain === "images.complex.com") {
			// https://images.complex.com/complex/images/c_crop,h_2437,w_3289,x_0,y_1067/c_limit,w_680/fl_lossy,pg_1,q_auto/gc123hobhudxx063ak8v/converse-yung-lean-one-star
			//   https://images.complex.com/complex/images/gc123hobhudxx063ak8v/converse-yung-lean-one-star
			// https://images.complex.com/complex/image/upload/c_limit,w_680/fl_lossy,pg_1,q_auto/qh1ve8ncxzxlfiy9aauw.jpg
			//   https://images.complex.com/complex/image/upload/qh1ve8ncxzxlfiy9aauw.jpg
			// https://images.complex.com/complex/images/c_scale,w_1100/fl_lossy,pg_1,q_auto/blwjl76jv2vcqdgd3sqy/bella-thorne
			//   https://images.complex.com/complex/images/blwjl76jv2vcqdgd3sqy/bella-thorne
			// http://images.complex.com/complex/image/upload/t_article_image/ckxhi0lpw2jsvm3rx3f4.jpg
			//   http://images.complex.com/complex/image/upload/ckxhi0lpw2jsvm3rx3f4.jpg
			// https://images.complex.com/complex/images/c_scale,w_1100/fl_lossy,pg_1,q_auto/brfqstj5jihhzr9eu1bw/bella-thorne
			//   https://images.complex.com/complex/images/brfqstj5jihhzr9eu1bw/bella-thorne
			return src.replace(/\/(images|image\/upload)\/[^/]*_[^/]*\//, "/$1/");
		}

		// https://images.spot.im/image/upload/q_70,fl_lossy,dpr_1.0,h_300,w_320,c_fill,g_face/v200/production/watfc8itl4hcgavprfku
		//   https://images.spot.im/image/upload/production/watfc8itl4hcgavprfku
		if (domain === "images.spot.im" ||
			// https://fashionista.com/.image/ar_16:9%2Cc_fill%2Ccs_srgb%2Cg_faces:center%2Cq_80%2Cw_620/MTQyNjI1MjYyNTc4NzA1NzM0/emma-watson-promojpg.jpg
			// https://fashionista.com/.image/t_share/MTQ2Njg0NzA2NzUzMDk1NTQ3/gettyimages-672499332.jpg
			domain_nowww === "fashionista.com" ||
			// http://images.pigeonsandplanes.com/images/c_crop,h_2268,w_3024,x_0,y_330/c_limit,f_auto,fl_lossy,q_auto,w_1030/obk4degjo35h2jzuwyd7/opal-press-2017
			domain === "images.pigeonsandplanes.com" ||
			// https://images.sftcdn.net/images/t_optimized,f_auto/p/2fbcf826-96d0-11e6-ac58-00163ec9f5fa/62785002/gang-beasts-screenshot.jpg
			domain === "images.sftcdn.net" ||
			// http://cdn.primedia.co.za/primedia-broadcasting/image/upload/c_fill,h_289,q_70,w_463/o0nu1bpsbgpfgvwa7vmj
			domain === "cdn.primedia.co.za" ||
			// https://www.maxim.com/.image/c_limit%2Ccs_srgb%2Cq_80%2Cw_960/MTUzMzQ0MzA2MTQzNTAzNzUz/harley-davidson-livewire3.webp
			//   https://www.maxim.com/.image/MTUzMzQ0MzA2MTQzNTAzNzUz/harley-davidson-livewire3.webp
			domain_nowww === "maxim.com" ||
			// https://img.thedailybeast.com/image/upload/c_crop,d_placeholder_euli9k,h_1439,w_2560,x_0,y_0/dpr_2.0/c_limit,w_740/fl_lossy,q_auto/v1492195023/articles/2014/10/19/the-world-s-most-beautiful-boat-yours-for-half-a-billion-dollars/141018-teeman-star-yacht-tease_tlw0nl
			domain === "img.thedailybeast.com" ||
			// https://alibaba.kumpar.com/kumpar/image/upload/h_153,w_273,c_fill,ar_16:9,g_face,f_jpg,q_auto,fl_progressive,fl_lossy/hzwutxv6kqhrj3grgbtf.jpg
			domain === "alibaba.kumpar.com" ||
			// https://5b0988e595225.cdn.sohucs.com/q_70,c_zoom,w_640/images/20180121/1fad12f07c90464295f05598305a08ad.jpeg
			domain === "5b0988e595225.cdn.sohucs.com" ||
			// nano defender blocks this?
			// https://images-cdn.moviepilot.com/images/c_fill,h_1800,w_2897/t_mp_quality/vg7z3yhfbklgnnlki3cs/angelina-jolie-s-next-project-is-close-to-her-heart-and-her-son-maddox-will-be-involved-530390.jpg
			domain === "images-cdn.moviepilot.com" ||
			// http://img.playbuzz.com/image/upload/f_auto,fl_lossy,q_auto/cdn/a205ab41-8564-4ed6-8bc2-42d742b284f0/de57f9d2-be24-43e8-910a-c972d8cf6cb8.jpg
			domain === "img.playbuzz.com" ||
			// https://images.discerningassets.com/image/upload/c_scale,h_44,w_90/v1424385252/ahmf3bignioajopkklpo.jpg
			domain === "images.discerningassets.com" ||
			// https://images.radio-canada.ca/q_auto,w_310/v1/ici-info/16x9/fusee-space-tsss.jpg
			domain === "images.radio-canada.ca" ||
			// https://img.wcdn.co.il/f_auto,w_100/2/0/4/7/2047784-46.jpg
			//   https://img.wcdn.co.il/2/0/4/7/2047784-46.jpg
			domain === "img.wcdn.co.il" ||
			// https://images.haarets.co.il/image/upload/w_2178,h_1267,x_22,y_99,c_crop,g_north_west/w_468,h_272,q_auto,c_fill,f_auto/fl_any_format.preserve_transparency.progressive:none/v1531586984/1.6270687.637195137.jpg
			//   https://images.haarets.co.il/image/upload/fl_any_format.preserve_transparency.progressive:none/1.6270687.637195137.jpg
			//   https://images.haarets.co.il/image/upload/1.6270687.637195137.jpg
			domain === "images.haarets.co.il" ||
			// https://images.cdn.yle.fi/image/upload/fl_keep_iptc,f_auto,fl_progressive/q_88/w_1600,h_900,c_fill,g_faces/w_500/v1531638823/13-1-50005334-1531638819357.jpg
			//   https://images.cdn.yle.fi/image/upload/fl_keep_iptc,f_auto,fl_progressive/13-1-50005334-1531638819357.jpg
			//   https://images.cdn.yle.fi/image/upload/13-1-50005334-1531638819357.jpg
			domain === "images.cdn.yle.fi" ||
			// https://sol.no/s/img/t_sol-forty-v2,w_490/solmediaCloudify/giwkcu7lqlluohdmbfcn.jpg
			//   https://sol.no/s/img/solmediaCloudify/giwkcu7lqlluohdmbfcn.jpg
			(domain_nowww === "sol.no" && string_indexof(src, "/img/") >= 0)||
			// https://prof.prepics-cdn.com/image/upload/c_fit,w_480/v1514146939/prcm_news-gazo-129019-3.jpg
			//   https://prof.prepics-cdn.com/image/upload/prcm_news-gazo-129019-3.jpg
			(domain === "prof.prepics-cdn.com" && string_indexof(src, "/image/upload/") >= 0) ||
			// https://images.ezvid.com/image/upload/fl_immutable_cache/c_limit,f_auto,h_400,w_400,q_auto:eco/rhnqlnvwkb39gukug44z
			//   https://images.ezvid.com/image/upload/fl_immutable_cache/rhnqlnvwkb39gukug44z
			domain === "images.ezvid.com" ||
			// https://img.peerspace.com/image/upload/c_crop,g_custom/g_auto,c_fill,q_auto:eco,f_auto,fl_progressive:steep,w_169,h_100/stoszz7hp3jjbwyrhyeb
			//   https://img.peerspace.com/image/upload/stoszz7hp3jjbwyrhyeb
			domain === "img.peerspace.com" ||
			// https://dhgywazgeek0d.cloudfront.net/watcha/image/upload/c_fill,h_400,q_80,w_280/v1520472661/t1f98e-142589.jpg
			//   https://dhgywazgeek0d.cloudfront.net/watcha/image/upload/t1f98e-142589.jpg
			domain === "dhgywazgeek0d.cloudfront.net" ||
			// https://assets.nuuvem.com/image/upload/t_screenshot_full/v1/products/557dbb7f69702d0a9c7c9c00/screenshots/opczeymdmcouc9npu8wn.jpg
			//   https://assets.nuuvem.com/image/upload/products/557dbb7f69702d0a9c7c9c00/screenshots/opczeymdmcouc9npu8wn.jpg
			domain === "assets.nuuvem.com" ||
			// https://images.lanouvellerepublique.fr/image/upload/t_1020w/5b703714badf36d7618b458a.jpg
			//   https://images.lanouvellerepublique.fr/image/upload/5b703714badf36d7618b458a.jpg
			domain === "images.lanouvellerepublique.fr" ||
			// https://images.fastcompany.net/image/upload/w_1280,f_auto,q_auto,fl_lossy/wp-cms/uploads/2018/04/3-braille-neue-combines-letters-you-can-touch-with-letters-you-can-see-1.jpg
			//   https://images.fastcompany.net/image/upload/wp-cms/uploads/2018/04/3-braille-neue-combines-letters-you-can-touch-with-letters-you-can-see-1.jpg
			domain === "images.fastcompany.net" ||
			// http://dwgyu36up6iuz.cloudfront.net/heru80fdn/image/upload/c_scale,h_315,w_560/g_south_east,l_newsletter_play_button_overlay,w_100,x_11,y_11/g_north_west,l_circle_brand_overlay_vanityfair,w_80,x_11,y_11/c_fill,d_placeholder_thescene.jpg,fl_progressive,g_center,q_80/v1426695217/vanityfair_vf-confidential-psych-of-a-psychopath-legend-with-a-bullet.jpg
			//   http://dwgyu36up6iuz.cloudfront.net/heru80fdn/image/upload/v1426695217/vanityfair_vf-confidential-psych-of-a-psychopath-legend-with-a-bullet.jpg
			domain === "dwgyu36up6iuz.cloudfront.net" ||
			// https://images2.minutemediacdn.com/image/upload/c_fill,w_684,h_387,f_auto,q_auto,g_auto/shape/cover/entertainment/5956983e27a119a9dd00001a.jpeg
			//   https://images2.minutemediacdn.com/image/upload/shape/cover/entertainment/5956983e27a119a9dd00001a.jpeg
			(domain_nosub === "minutemediacdn.com" && domain.match(/^images[0-9]*\./)) ||
			// https://planet-sports-res.cloudinary.com/images/q_80,f_auto,dpr_2.0,d_planetsports:products:nopic.jpg/planetsports/products/46867500_00/rip-curl-fiesta-bandeau-bikini-set-women-black.jpg
			//   https://planet-sports-res.cloudinary.com/images/planetsports/products/46867500_00/rip-curl-fiesta-bandeau-bikini-set-women-black.jpg
			(domain_nosub === "cloudinary.com" && string_indexof(domain, "res.cloudinary.com") >= 0 && string_indexof(src, "/images/") >= 0) ||
			// https://media.stubhubstatic.com/stubhub-product/t_face-faces-noface/a_0,q_auto:good,f_auto,c_fill,w_900,h_300/st/PYEAAOSw-9xZ26cw/s-l600.jpg
			//   https://media.stubhubstatic.com/stubhub-product/st/PYEAAOSw-9xZ26cw/s-l600.jpg
			domain === "media.stubhubstatic.com" ||
			// https://img.promipool.de/www-promipool-de/image/upload/w_580,f_jpg,q_auto:eco/Megan_Fox_fku2vopjkf
			//   https://img.promipool.de/www-promipool-de/image/upload/Megan_Fox_fku2vopjkf
			domain === "img.promipool.de" ||
			// https://blue.kumparan.com/kumpar/image/upload/fl_progressive,fl_lossy,c_fill,q_auto:best,w_640/v1501935658/emma_zpvivy.jpg
			//   https://blue.kumparan.com/kumpar/image/upload/emma_zpvivy.jpg
			domain === "blue.kumparan.com" ||
			// http://file2.answcdn.com/answ-cld/image/upload/w_760,c_fill,g_faces:center,q_60/v1401441847/iqjpcuhvwtw1ocnpeibc.jpg
			//   http://file2.answcdn.com/answ-cld/image/upload/iqjpcuhvwtw1ocnpeibc.jpg
			(domain_nosub === "answcdn.com" && domain.match(/^file[0-9]*\./)) ||
			// https://res.fashionsnap.com/image/upload/f_auto,q_auto/media2/2017/09/helpern-18ss_001.jpg?1563879770653
			domain === "res.fashionsnap.com" ||
			// thanks to susanqt on github: https://github.com/qsniyg/maxurl/issues/100
			// http://user-images.strikinglycdn.com/res/hrscywv4p/image/upload/c_limit,fl_lossy,h_9000,w_1200,f_auto,q_auto/1515559/534889_633117.jpg
			//   http://user-images.strikinglycdn.com/res/hrscywv4p/image/upload/1515559/534889_633117.jpg
			domain === "user-images.strikinglycdn.com" ||
			// thanks to fireattack on discord:
			// https://custom-images.strikinglycdn.com/res/hrscywv4p/image/upload/c_limit,fl_lossy,h_1440,w_720,f_auto,q_auto/242805/218348_394202.jpeg
			//   https://custom-images.strikinglycdn.com/res/hrscywv4p/image/upload/242805/218348_394202.jpeg
			domain === "custom-images.strikinglycdn.com" ||
			// https://novel-img.prepics-cdn.com/image/upload/c_fill,w_156,h_222/p/c75f2ea15a148139b76ebdee2064737f8a4523c1/cover/ne7yeah9k1dsmwxmyuvn.jpg
			//   https://novel-img.prepics-cdn.com/image/upload/p/c75f2ea15a148139b76ebdee2064737f8a4523c1/cover/ne7yeah9k1dsmwxmyuvn.jpg
			domain === "novel-img.prepics-cdn.com" ||
			// https://cdn.apartmenttherapy.info/image/upload/f_jpg,q_auto:eco,c_fill,g_auto,w_1500,ar_16:9/k/Photo/Recipes/2019-07-recipe-farmers-market-breakfast-bread/vegetable_quick_bread_4.12
			//   https://cdn.apartmenttherapy.info/image/upload/k/Photo/Recipes/2019-07-recipe-farmers-market-breakfast-bread/vegetable_quick_bread_4.12
			domain === "cdn.apartmenttherapy.info" ||
			// https://cdn.domestika.org/c_fill,dpr_auto,h_157,t_base_params.format_jpg,w_280/v1529661169/course-covers/000/000/262/262-original.jpg?1529661169
			//   https://cdn.domestika.org/course-covers/000/000/262/262-original.jpg?1529661169
			domain === "cdn.domestika.org" ||
			// https://assets.charmboard.com/images/w_375,ar_0.75,c_fill,c_pad,q_auto:eco,e_sharpen/im/lk/810912/pallavi-patil-wearing-kurta.jpg
			//   https://assets.charmboard.com/images/im/lk/810912/pallavi-patil-wearing-kurta.jpg
			(domain === "assets.charmboard.com" && string_indexof(src, "/images/") >= 0) ||
			// https://image.spreadshirtmedia.com/content/q_auto/h_150,f_auto,b_rgb:f2f2f2/v27/cms/ml/tiles/models/t_shirts_men_us
			//   https://image.spreadshirtmedia.com/content/cms/ml/tiles/models/t_shirts_men_us
			// https://image.spreadshirtmedia.com/content/w_650/cms/cyo/seo/cheaptshirts/6_us_desktop.png
			//   https://image.spreadshirtmedia.com/content/cms/cyo/seo/cheaptshirts/6_us_desktop.png
			domain === "image.spreadshirtmedia.com" ||
			// https://c.bellesa.co/dkvdbifey/image/upload/h_250,q_75,f_auto/v1559314010/body_paint_1.jpg
			//   https://c.bellesa.co/dkvdbifey/image/upload/body_paint_1.jpg
			domain === "c.bellesa.co" ||
			// https://img.ssensemedia.com/images/b_white,c_lpad,g_south,h_1086,w_724/c_scale,h_480/f_auto,dpr_1.0/201392F054001_1/henrik-vibskov-black-plisse-no3-dress.jpg
			//   https://img.ssensemedia.com/images/201392F054001_1/henrik-vibskov-black-plisse-no3-dress.jpg
			domain === "img.ssensemedia.com" ||
			// https://images.jpost.com/image/upload/f_auto,fl_lossy/t_JD_MostReadFaceDetect/454445
			//   https://images.jpost.com/image/upload/454445
			domain === "images.jpost.com" ||
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/399
			// https://img.hellofresh.com/f_auto,fl_lossy,q_auto,w_360/hellofresh_s3/image/5f0619e1899ede042d77d003-0d509f38.jpg
			//   https://img.hellofresh.com/hellofresh_s3/image/5f0619e1899ede042d77d003-0d509f38.jpg
			domain === "img.hellofresh.com" ||
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/493
			// https://assets.petco.com/petco/image/upload/f_auto,q_auto,t_PLP-item-small/2388555-center-1
			//   https://assets.petco.com/petco/image/upload/2388555-center-1 (.psd?)
			//   TODO: redirect to /f_auto/
			// https://assets.petco.com/image/upload/f_auto,q_auto,t_PLP-item-large/2130861-center-1
			//   https://assets.petco.com/image/upload/2130861-center-1
			// https://assets.petco.com/petco/image/upload/f_auto,q_auto,t_Thumbnail/2987144-center-2
			//   https://assets.petco.com/petco/image/upload/2987144-center-2
			// https://assets.petco.com/petco/image/upload/f_auto,q_auto,t_tile-recommendations/2516449-center-1
			//   https://assets.petco.com/petco/image/upload/2516449-center-1
			// https://assets.petco.com/petco/image/upload/c_fill,dpr_3.0,f_auto,q_auto,w_72/logo-tetra
			//   https://assets.petco.com/petco/image/upload/logo-tetra
			// https://assets.petco.com/petco/image/upload/f_auto,q_auto/2992584-center-1
			//   https://assets.petco.com/petco/image/upload/2992584-center-1
			domain === "assets.petco.com" ||
			// thanks to fedesk on discord
			// https://img.redbull.com/images/c_crop,x_0,y_0,h_2133,w_3200/c_fill,w_860,h_573/q_auto,f_auto/redbullcom/2020/5/27/ytr1jfdloekllyxf4igt/charli-xcx
			//   https://img.redbull.com/images/redbullcom/2020/5/27/ytr1jfdloekllyxf4igt/charli-xcx
			domain === "img.redbull.com" ||
			// https://images.tou.tv/c_scale,q_80,w_1200,h_675/v1/ici-tou-tv/promos/16x9/2309e3b4-0bda-f70a-c8fb-5a308e0ab03f.jpg
			//   https://images.tou.tv/v1/ici-tou-tv/promos/16x9/2309e3b4-0bda-f70a-c8fb-5a308e0ab03f.jpg
			domain === "images.tou.tv" ||
			// thanks to Liz on discord:
			// https://assets.nintendo.com/image/upload/c_limit,f_auto,q_auto,w_1920/ncom/en_US/games/switch/o/onigiri-switch/screenshot-gallery/screenshot03?v=2021060520
			//   https://assets.nintendo.com/image/upload/ncom/en_US/games/switch/o/onigiri-switch/screenshot-gallery/screenshot03?v=2021060520
			domain === "assets.nintendo.com" ||
			// thanks to MinuteAd8502 on github: https://github.com/qsniyg/maxurl/issues/792
			// https://assets.myntassets.com/dpr_2,h_240,q_50,w_180/assets/images/productimage/2019/12/21/9eb4d964-5c68-4b2f-adf2-df7fde570b871576889282570-1.jpg
			//   https://assets.myntassets.com/assets/images/productimage/2019/12/21/9eb4d964-5c68-4b2f-adf2-df7fde570b871576889282570-1.jpg
			domain === "assets.myntassets.com" ||
			// thanks to MinuteAd8502 on github: https://github.com/qsniyg/maxurl/issues/794
			// https://static.nike.com/a/images/t_PDP_864_v1/f_auto,b_rgb:f5f5f5/6d6c66ec-4866-45a5-a311-d0c31b9a6f7a/run-short-sleeve-running-top-PQszMF.png
			//   https://static.nike.com/a/images/t_PDP_864_v1/6d6c66ec-4866-45a5-a311-d0c31b9a6f7a/run-short-sleeve-running-top-PQszMF.png
			domain === "static.nike.com" ||
			// thanks to MinuteAd8502 on github: https://github.com/qsniyg/maxurl/issues/816
			// https://assets.myntassets.com/dpr_2,h_240,q_50,w_180/assets/images/productimage/2020/11/9/9c081b63-bd33-457a-b642-cf87967423781604926461757-1.jpg
			//   https://assets.myntassets.com/assets/images/productimage/2020/11/9/9c081b63-bd33-457a-b642-cf87967423781604926461757-1.jpg
			domain === "assets.myntassets.com" ||
			// https://img.sndimg.com/food/image/upload/c_thumb,q_80,w_60,h_60/v1/gk-static/gk/img/avatar/pasta.png
			//   https://img.sndimg.com/food/image/upload/gk-static/gk/img/avatar/pasta.png
			domain === "img.sndimg.com" ||
			// thanks to anonymous
			// https://assets.adidas.com/images/w_383,h_383,f_auto,q_auto:sensitive,fl_lossy/6cbe482b224d4efdbaffac8000d2e235_9366/run-for-the-oceans-graphic-tank-top.jpg
			domain === "assets.adidas.com" ||
			// https://images.moviepilot.com/images/c_limit,q_auto:good,w_600/uom2udz4ogmkncouu83q/beauty-and-the-beast-credit-disney.jpg
			// https://images.moviepilot.com/image/upload/c_fill,h_64,q_auto,w_64/lpgwdrrgc3m8duvg7zt2.jpg
			domain === "images.moviepilot.com" ||
			// thanks to roi:
			// https://media.bleacherreport.com/f_auto,w_1440,q_auto,c_fill/br-cms/c2/71/b4/54/5349/4908/a84d/c9c81b918bdd/crop_exact_gettyimages-1243584038.jpeg
			//   https://media.bleacherreport.com/br-cms/c2/71/b4/54/5349/4908/a84d/c9c81b918bdd/crop_exact_gettyimages-1243584038.jpeg
			domain === "media.bleacherreport.com" ||
			// thanks to roi:
			// https://img.olympicchannel.com/images/image/private/t_16-9_1240-700/f_auto/v1538355600/primary/gyfzl46yuxcmzsprbrt8
			//   https://img.olympicchannel.com/images/image/private/t_16-9_1240-700/primary/gyfzl46yuxcmzsprbrt8
			//   https://img.olympicchannel.com/images/image/private/f_png/primary/gyfzl46yuxcmzsprbrt8
			domain === "img.olympicchannel.com" ||
			// thanks to karpuzikov on github: https://github.com/qsniyg/maxurl/issues/1060
			// https://resource.logitech.com/w_80,h_50,c_limit,q_auto,f_auto,dpr_1.0/d_transparent.gif/content/dam/logitech/en/products/mice/mx-anywhere-3/gallery/mx-anywhere-3-product-gallery-pale-gray-top.png?v=1
			//   https://resource.logitech.com/content/dam/logitech/en/products/mice/mx-anywhere-3/gallery/mx-anywhere-3-product-gallery-pale-gray-top.png?v=1
			domain === "resource.logitech.com" ||
			// thanks to roi:
			// https://media-cldnry.s-nbcnews.com/image/upload/t_fit-560w,f_auto,q_auto:best/rockcms/2022-02/220217-Alina-Zagitova-ew-157p-6f5ec2.jpg
			//   https://media-cldnry.s-nbcnews.com/image/upload/rockcms/2022-02/220217-Alina-Zagitova-ew-157p-6f5ec2.jpg
			domain == "media-cldnry.s-nbcnews.com" ||
			// thanks to roi:
			// https://derivates.kicker.de/image/upload/c_crop,x_39,y_302,w_3922,h_2206/w_637,q_auto,f_webp/v1/2023/02/24/f84de7be-2178-4453-a6a6-d9a1962ca0e2.jpeg
			//   https://derivates.kicker.de/image/upload/2023/02/24/f84de7be-2178-4453-a6a6-d9a1962ca0e2.jpeg
			domain === "derivates.kicker.de" ||
			// thanks to roi:
			// https://media.istra24.hr/istra24-hr/image/upload/c_limit,h_800,w_1200/q_auto:eco/f_jpg/HN20220214387326_gze6q0apwr
			//   https://media.istra24.hr/istra24-hr/image/upload/HN20220214387326_gze6q0apwr
			domain === "media.istra24.hr" ||
			// thanks to roi:
			// https://p7.itc.cn/c_lfill,w_310,h_206,g_face,q_70/images03/20230425/9b4a41ce2684427d8ada9cdda0a0e235.jpeg
			(domain_nosub === "itc.cn" && /^p[0-9]*\./.test(domain) && /\/images[0-9]+\//.test(src)) ||
			// thanks to roi:
			// https://assets.simpleviewinc.com/simpleview/image/upload/c_fill,f_jpg,h_213,q_65,w_280/v1/clients/columbus/_26R6006_fb082a53-676a-4887-a2b4-29799a8dd587.jpg
			//   https://assets.simpleviewinc.com/simpleview/image/upload/clients/columbus/_26R6006_fb082a53-676a-4887-a2b4-29799a8dd587.jpg
			domain === "assets.simpleviewinc.com" ||
			// thanks to anonymous for reporting:
			// https://img.guess.com/image/upload/b_auto,c_pad,dpr_3.0,f_auto,h_532,q_auto,w_400/c_pad,h_532,w_400/v1/NA/Style/ECOMM/WB9AJ3D3KI1-CUMB
			//   https://img.guess.com/image/upload/NA/Style/ECOMM/WB9AJ3D3KI1-CUMB
			domain === "img.guess.com" ||
			// thanks to jonestly on discord:
			// https://media.niftygateway.com/image/upload/q_auto:good,w_500/v1611163321/uytsu1kcau69meprfdak.webp
			//   https://media.niftygateway.com/image/upload/uytsu1kcau69meprfdak.webp
			//   https://media.niftygateway.com/image/upload/uytsu1kcau69meprfdak.png
			domain === "media.niftygateway.com" ||
			// thanks to anonymous for reporting:
			// https://img1.hotstarext.com/image/upload/f_auto,t_web_vl_2_5x/sources/r1/cms/prod/8301/1018301-v-c0d978391184
			//   https://img1.hotstarext.com/image/upload/sources/r1/cms/prod/8301/1018301-v-c0d978391184
			(domain_nosub === "hotstarext.com" && /^img[0-9]*\./.test(domain)) ||
			// thanks to anonymous for reporting:
			// https://res.garmin.com/transform/image/upload/b_rgb:FFFFFF,c_pad,dpr_1.0,f_auto,h_520,q_auto,w_520/c_pad,h_520,w_520/v1/Product_Images/en/products/010-02627-11/v/cf-xl-1cee6511-d508-4f9b-9f75-9d9650717fd8?pgw=1&pgwact=1
			//   https://res.garmin.com/transform/image/upload/Product_Images/en/products/010-02627-11/v/cf-xl-1cee6511-d508-4f9b-9f75-9d9650717fd8?pgw=1&pgwact=1
			domain === "res.garmin.com" ||
			// thanks to anonymous for reporting:
			// https://media-cdn.grubhub.com/image/upload/d_search:browse-images:default.jpg/w_300,q_100,fl_lossy,dpr_2.0,c_fit,f_auto,h_300/a1vax0oh5nj2w7skkt3h
			//   https://media-cdn.grubhub.com/image/upload/a1vax0oh5nj2w7skkt3h
			domain === "media-cdn.grubhub.com" ||
			// thanks to anonymous for reporting:
			// https://media.bauerradio.com/image/upload/q_auto,c_fill,g_faces,w_2500,h_2500/v1690191917/shows/gsnaoaqcepivgvxslh13.png
			//   https://media.bauerradio.com/image/upload/shows/gsnaoaqcepivgvxslh13.png
			domain === "media.bauerradio.com" ||
			// thanks to anonymous for reporting:
			// https://www.wine.com/product/images/w_600,h_600,dpr_2.0,c_fit,q_auto:good,fl_progressive/fgqknv9w2dkfmx9mffrx.jpg
			//   https://www.wine.com/product/images/fgqknv9w2dkfmx9mffrx.jpg
			(domain_nowww === "wine.com" && /\/product\/+images\//.test(src)) ||
			// thanks to Viper33 for reporting:
			// https://puls-img.chanel.com/c_limit/1696595583929-jennyportrait1jpg_7056x5760.jpg
			domain === "puls-img.chanel.com" ||
			// thanks to roi:
			// https://resources.finalsite.net/images/t_image_size_4/v1548952592/finalsite/iheofywrk6vnds3lqcae/ResourcesBlogHeader.png
			//   https://resources.finalsite.net/images/finalsite/iheofywrk6vnds3lqcae/ResourcesBlogHeader.png
			domain === "resources.finalsite.net" ||
			// thanks to anonymous for reporting:
			// https://c.static-nike.com/a/images/w_1536,c_limit,f_auto/rdjukugxuljyne9f551j/kyrie-5-pineapple-house-release-date.png
			//   https://c.static-nike.com/a/images/rdjukugxuljyne9f551j/kyrie-5-pineapple-house-release-date.png
			domain === "c.static-nike.com" ||
			// thanks to anonymous for reporting:
			// https://resources.mynewsdesk.com/image/upload/ar_16:9,c_fill,dpr_auto,f_auto,g_auto,q_auto:good,w_746/lr6uyrf6pnefauywylkq
			//   https://resources.mynewsdesk.com/image/upload/ar_16:9,c_fill,dpr_auto,f_auto,g_auto,q_auto:good,w_746/lr6uyrf6pnefauywylkq
			domain === "resources.mynewsdesk.com" ||
			// thanks to anonymous for reporting:
			// https://brand.assets.adidas.com/image/upload/f_auto,fl_lossy,q_1/enUS/Images/xcat-fw20-rfc-DerrickRose-statement-02-d_tcm221-581175.jpg
			//   https://brand.assets.adidas.com/image/upload/enUS/Images/xcat-fw20-rfc-DerrickRose-statement-02-d_tcm221-581175.jpg
			domain === "brand.assets.adidas.com" ||
			// thanks to roi:
			// https://images.tennis.com/image/private/t_16-9_768/f_auto/tenniscom-prd/in1ds81hd2ufj4gomffx.jpg
			//   https://images.tennis.com/image/private/f_png/tenniscom-prd/in1ds81hd2ufj4gomffx.jpg
			domain === "images.tennis.com" ||
			// thanks to anonymous for reporting:
			// https://images.crunchbase.com/image/upload/c_pad,h_512,w_512,f_auto,b_white,q_auto:eco,dpr_2/gjtsg7wocebhdu7bzf6v
			//   https://images.crunchbase.com/image/upload/gjtsg7wocebhdu7bzf6v
			domain === "images.crunchbase.com" ||
			// thanks to karpuzikov on github: https://github.com/qsniyg/maxurl/issues/1066
			// https://resource.logitechg.com/w_677,ar_1:1,c_limit,b_rgb:2f3132,q_auto,f_auto,dpr_auto/d_transparent.gif/content/dam/gaming/en/homepage/product-swatch-carousel/home-product-swatch-4.png?v=1
			//   https://resource.logitechg.com/content/dam/gaming/en/homepage/product-swatch-carousel/home-product-swatch-4.png?v=1
			domain === "resource.logitechg.com") {
			newsrc = src
				.replace(/%2C/g, ",")
				.replace(/\/[a-z]+_[^/_,]+(?:,[^/]*)?\//, "/")
				.replace(/\/fl_any_format\.[^/]*\//, "/")
				.replace(/\/fl_keep_iptc[^/]*\//, "/")
				.replace("/t_mp_quality/", "/")
				.replace(/\/t_PDP_[0-9]+_v1\//, "/") // static.nike.com, number seems to be the width
				.replace(/\/t_image_size_[^/]+\//, "/") // resources.finalsite.net
				.replace(/\/private\/+t_[-0-9_]+\//, "/private/f_png/") // img.olympicchannel.com
				.replace(/\/v[0-9]{10}\//, "/")
				.replace(/\/image\/+upload\/+t_[^/]*\//, "/image/upload/");
			if (newsrc !== src)
				return newsrc;

			// breaks tou.tv
			newsrc = src
				.replace(/\/v[0-9]+\//, "/");
			if (newsrc !== src)
				return newsrc;

			// thanks to jonestly on discord:
			newsrc = src.replace(/\.webp(?:[?#].*)?$/, ".png");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "image.kkday.com") {
			// https://image.kkday.com/image/get/w_1900%2Cc_fit/s1.kkday.com/product_17911/20170926035641_Kii80/jpg
			//   https://image.kkday.com/image/get/s1.kkday.com/product_17911/20170926035641_Kii80/jpg
			return src.replace(/\/image\/+get\/+[^/]*(?:%2C|,)[^/]*\//, "/image/get/");
		}

		if (domain === "cdn.skim.gs") {
			// http://cdn.skim.gs/image/upload/c_fill,dpr_1.0,f_auto,fl_lossy,q_auto,w_940/v1456338060/msi/fc8_k4lgbp.jpg -- 940x1413 (stretched)
			//   http://cdn.skim.gs/image/upload/v1456338060/msi/fc8_k4lgbp.jpg -- 600x902
			return src
				.replace(/\/image\/upload\/[^/]*_[^/]*\//, "/image/upload/")
				.replace(/\/images\/[^/]*_[^/]*\//, "/images/");
		}

		if (domain === "www-konga-com-res.cloudinary.com") {
			// thanks to anonymous for reporting:
			// https://www-konga-com-res.cloudinary.com/w_400,f_auto,fl_lossy,dpr_3.0,q_auto/media/catalog/product/N/a/68975_1516157735.jpg
			//   https://www-konga-com-res.cloudinary.com/media/catalog/product/N/a/68975_1516157735.jpg
			return src.replace(/(:\/\/[^/]+\/+).*?\/+media\//, "$1media/");
		}

		if (((domain_nosub === "biography.com" ||
			  domain_nowww === "guitarworld.com" ||
			  domain_nowww === "guitaraficionado.com" ||
			  domain_nowww === "psneurope.com") &&
			 string_indexof(src, "/.image/") >= 0) ||
			src.match(/:\/\/[^/]*\/\.image\/[^/]*_[^/]*\/[A-Za-z-0-9]{24}\/[^/]*$/)) {
			// https://www.biography.com/.image/c_limit%2Ccs_srgb%2Cq_80%2Cw_960/MTI2NDQwNDA2NTg5MTUwNDgy/ariana-grande-shutterstock_213445195-600x487jpg.webp
			//   https://www.biography.com/.image/MTI2NDQwNDA2NTg5MTUwNDgy/ariana-grande-shutterstock_213445195-600x487jpg.webp
			// https://www.guitarworld.com/.image/t_share/MTUxNDQ0NTk1MTMyMDgxNDA3/keithrichardsgettyimages-71684054.jpg
			//   https://www.guitarworld.com/.image//MTUxNDQ0NTk1MTMyMDgxNDA3/keithrichardsgettyimages-71684054.jpg
			// https://www.guitarworld.com/.image/ar_8:10%2Cc_fill%2Ccs_srgb%2Cg_faces:center%2Cq_80%2Cw_620/MTUwNjEyNDY4MDM2MzQ3MjU2/keith_richards_2jpg.jpg
			//   https://www.guitarworld.com/.image//MTUwNjEyNDY4MDM2MzQ3MjU2/keith_richards_2jpg.jpg
			// https://www.psneurope.com/.image/c_limit%2Ccs_srgb%2Cq_80%2Cw_482/MTUwNjU0MjczNjQ2NjM0NjU3/vintage-studios-web.webp
			//   https://www.psneurope.com/.image/MTUwNjU0MjczNjQ2NjM0NjU3/vintage-studios-web.webp
			newsrc = src.replace(/(\/.image)\/[^/]*(\/[^/]*\/[^/]*)$/, "$1$2");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "resources.mynewsdesk.com") {
			// https://resources.mynewsdesk.com/image/upload/t_next_gen_span3_fit_and_crop/b3d5cr3yxtxylt7sp9wu.jpg
			//   https://resources.mynewsdesk.com/image/upload/b3d5cr3yxtxylt7sp9wu.jpg
			return src.replace(/(\/image\/+upload\/+)t_[^/]+\/+/, "$1");
		}

		if (domain_nosub === "bridestory.com") {
			// thanks to resentizised on discord:
			// https://london.bridestory.com/images/c_fill,dpr_1.0,f_auto,fl_progressive,pg_1,q_80,w_680/v1/assets/the-barracks-hotel_wedding_mixed-tables_day_lo-res-By6IX3isU/the-barracks-hotel-sentosa_barracks-lawn_1.webp
			//   https://images.bridestory.com/image/upload/assets/the-barracks-hotel_wedding_mixed-tables_day_lo-res-By6IX3isU.jpg -- 5600x3735
			return src.replace(/^[a-z]+:\/\/[^/]+\/+images\/+.*?\/+assets\/+([^/]+)\/+[^/]+(?:[?#].*)?$/,
				"https://images.bridestory.com/image/upload/assets/$1.jpg");
		}

		if (domain_nowww === "chanel.com" ||
			// thanks to roi:
			// https://img.olympics.com/images/image/private/t_original_760/f_auto/primary/d3mlgzrzc3vdbt936jxk
			//   https://img.olympics.com/images/image/private/c_limit/primary/d3mlgzrzc3vdbt936jxk - 8000x4500
			domain === "img.olympics.com") {
			// thanks to rEnr3n on github: https://github.com/qsniyg/maxurl/issues/917
			// https://www.chanel.com/images/q_auto,f_auto,fl_lossy,dpr_auto/w_1920/FSH-1632391810548-coconeige2021slideshowcampagnedesktop1.jpg
			//   https://www.chanel.com/images/c_limit/FSH-1632391810548-coconeige2021slideshowcampagnedesktop1.jpg
			return src.replace(/(\/images\/+(?:image\/+private\/+)?)(?:(?:q|fl?|dpr|w|h|t)_[^/]+\/+)+/, "$1c_limit/");
		}

		if (domain === "cloudinary-cdn.ffm.to") {
			// thanks to anonymous for reporting:
			// https://cloudinary-cdn.ffm.to/s--Kf-wM-9c--/f_webp/https%3A%2F%2Fimagestore.ffm.to%2Flink%2F850d7beb9bc03aaf1b8f07ea22ca5bf5.png
			//   https://imagestore.ffm.to/link/850d7beb9bc03aaf1b8f07ea22ca5bf5.png
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+.*?\/+(https?.*)$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nosub === "popsugar-assets.com" ||
			domain_nosub === "onsugar.com") {
			// https://media1.popsugar-assets.com/files/thumbor/Aq5Tn8-7kqPSJs4U0_QaYoM6x8Q/fit-in/1024x1024/filters:format_auto-!!-:strip_icc-!!-/2015/03/30/647/n/1922564/ccc1eafd_edit_img_cover_file_864129_1397566805/i/Emma-Watson-Best-Red-Carpet-Looks.png
			//   https://media1.popsugar-assets.com/files/2015/03/30/647/n/1922564/ccc1eafd_edit_img_cover_file_864129_1397566805/i/Emma-Watson-Best-Red-Carpet-Looks.png
			// https://media1.popsugar-assets.com/files/thumbor/1ktKvFdaPtIVjrL085ZgDu-0IUM/160x160/filters:format_auto-!!-:strip_icc-!!-:sharpen-!1,0,true!-/2014/04/09/959/n/1922564/d006b9f456c00f56_478466321_10/i/Emma-Watson-Wes-Gordon-2014-Noah-Germany-Premiere.jpg
			//   https://media1.popsugar-assets.com/files/2014/04/09/959/n/1922564/d006b9f456c00f56_478466321_10/i/Emma-Watson-Wes-Gordon-2014-Noah-Germany-Premiere.jpg
			// http://media1.popsugar-assets.com/files/thumbor/hEi29uVq6ywnKLkB2konCS2CMJI=/fit-in/2048xorig/2016/05/22/156/n/1922398/c7b25a8fd8aaab98_GettyImages-533596620/i/Mila-Kunis-Ashton-Kutcher-Billboard-Music-Awards-2016.jpg
			//   http://media1.popsugar-assets.com/files/2016/05/22/156/n/1922398/c7b25a8fd8aaab98_GettyImages-533596620/i/Mila-Kunis-Ashton-Kutcher-Billboard-Music-Awards-2016.jpg
			// https://media1.popsugar-assets.com/files/thumbor/t85Z6EqhDjIu8EaEzfzk5hOJ1Ck/0x360:2400x2394/fit-in/728xorig/filters:format_auto-!!-:strip_icc-!!-:watermark-!popsugar-watermark.png,-5,-5,0!-/2020/01/16/687/n/1922564/4606d55d5e20819816a430.09594567_/i/selena-gomez-style-for-new-album-release-2020.jpg
			//   https://media1.popsugar-assets.com/files/2020/01/16/687/n/1922564/4606d55d5e20819816a430.09594567_/i/selena-gomez-style-for-new-album-release-2020.jpg
			// thanks to bsydow on github: https://github.com/qsniyg/maxurl/issues/1323
			// https://media1.popsugar-assets.com/files/thumbor/nABWpoAEkMbUUQ-0rBRznnHGnlQ=/fit-in/792x527/top/filters:format_auto():upscale()/2019/04/23/687/n/1922564/7aba47deaf9aef0f_GettyImages-1144527044.jpg
			//   https://media1.popsugar-assets.com/files/2019/04/23/687/n/1922564/7aba47deaf9aef0f_GettyImages-1144527044.jpg
			if (string_indexof(src, "/thumbor/") >= 0) {
				newsrc = src.replace(/\/thumbor\/.*/, "/" + common_functions["get_thumbor_url"](src.replace(/.*?\/thumbor\//, "/")));
				if (newsrc !== src)
					return newsrc;
			}

			// http://media1.popsugar-assets.com/files/2013/02/08/2/192/1922398/13bc50e021acd58e_wenn10840119.xxxlarge/i/Spring-Breakers-Berlin-Red-Carpet-Premiere-Pictures.jpg
			//   http://media1.popsugar-assets.com/files/2013/02/08/2/192/1922398/13bc50e021acd58e_wenn10840119/i/Spring-Breakers-Berlin-Red-Carpet-Premiere-Pictures.jpg
			// https://media1.popsugar-assets.com/files/2015/09/02/221/n/37139775/d391fe8f30364ef0_15._2007_GettyImages-81449203/i/Selena-Gomez.jpg
			// http://media4.onsugar.com/files/2013/12/16/757/n/1922398/1f2e71247e26b096_Twoimageskinnyheadshot_R.jpg.xlarge/i/Gisele-Bundchen-Wearing-Bikini-Miami.jpg
			//   http://media4.onsugar.com/files/2013/12/16/757/n/1922398/1f2e71247e26b096_Twoimageskinnyheadshot_R/i/Gisele-Bundchen-Wearing-Bikini-Miami.jpg
			// http://media1.popsugar-assets.com/files/2014/04/09/009/n/1922441/9933a3baeee323df_141827630.xxxlarge_2x/i/Dog-Thinks-Parade-All-Him.jpg
			//   http://media1.popsugar-assets.com/files/2014/04/09/009/n/1922441/9933a3baeee323df_141827630/i/Dog-Thinks-Parade-All-Him.jpg
			// http://media1.popsugar-assets.com/files/2011/01/02/4/192/1922564/bacd60f46322150a_105266939.xxxlarge/i/Scarlett-Johansson-2004.jpg
			//   http://media1.popsugar-assets.com/files/2011/01/02/4/192/1922564/bacd60f46322150a_105266939/i/Scarlett-Johansson-2004.jpg
			// https://media1.popsugar-assets.com/files/2013/01/03/4/192/1922398/079410d93cbf965d_89387PCN_Banks44._original_wm/i/Elizabeth-Banks-Filming-Walk-Shame-Yellow-Dress.jpg
			//   https://media1.popsugar-assets.com/files/2013/01/03/4/192/1922398/079410d93cbf965d_89387PCN_Banks44/i/Elizabeth-Banks-Filming-Walk-Shame-Yellow-Dress.jpg
			// http://media2.popsugar-assets.com/files/2013/01/03/4/192/1922398/079410d93cbf965d_89387PCN_Banks44.xxxlarge_wm/i/Elizabeth-Banks-Filming-Walk-Shame-Yellow-Dress.jpg
			//   http://media2.popsugar-assets.com/files/2013/01/03/4/192/1922398/079410d93cbf965d_89387PCN_Banks44/i/Elizabeth-Banks-Filming-Walk-Shame-Yellow-Dress.jpg
			// http://media1.onsugar.com/files/2013/01/03/4/192/1922398/8aedd815f4d135be_89387PCN_Banks38.preview_wm/i/Elizabeth-Banks-Filming-Walk-Shame-Yellow-Dress.jpg
			//   http://media1.onsugar.com/files/2013/01/03/4/192/1922398/8aedd815f4d135be_89387PCN_Banks38/i/Elizabeth-Banks-Filming-Walk-Shame-Yellow-Dress.jpg
			// http://media3.onsugar.com/files/2014/03/25/832/n/1922398/586721e67a483aca_thumb_temp_image344319351395692338.jpg.preview_tall/i/Madeline-Brewer-Life-After-Orange-New-Black.jpg
			//   http://media3.onsugar.com/files/2014/03/25/832/n/1922398/586721e67a483aca_thumb_temp_image344319351395692338/i/Madeline-Brewer-Life-After-Orange-New-Black.jpg
			// doesn't work:
			// http://media3.popsugar-assets.com/files/2013/09/16/795/n/1922564/b962955383f6b80f_1592163256t6a65.xxxlarge_2x/i/Emma-Watson-all-legs-sexy-Peter-Pilotto-cutout-minidress.jpg
			//   http://media3.popsugar-assets.com/files/2013/09/16/795/n/1922564/b962955383f6b80f_1592163256t6a65/i/Emma-Watson-all-legs-sexy-Peter-Pilotto-cutout-minidress.jpg -- doesn't work (403)
			// http://media4.popsugar-assets.com/files/2015/12/14/081/n/1922398/74d22b8d4b738d72_GettyImages-491215020E3065m.xxxlarge.jpg
			//   http://media4.popsugar-assets.com/files/2015/12/14/081/n/1922398/74d22b8d4b738d72_GettyImages-491215020E3065m.jpg -- doesn't work
			//   http://media4.popsugar-assets.com/files/2015/12/14/081/n/1922398/74d22b8d4b738d72_GettyImages-491215020E3065m.xxxlarge/i/a.jpg -- works
			//   http://media4.popsugar-assets.com/files/2015/12/14/081/n/1922398/74d22b8d4b738d72_GettyImages-491215020E3065m/i/a.jpg -- doesn't work
			//   http://media4.popsugar-assets.com/files/2015/12/14/081/n/1922398/74d22b8d4b738d72_GettyImages-491215020E3065/i/a.jpg -- doesn't work
			// http://media1.popsugar-assets.com/files/2015/01/03/181/n/1922398/5bccdcce4f5c73c6_460999856_10ioj9fk.150square/i/Felicity-Jones.jpg -- works
			//   http://media1.popsugar-assets.com/files/2015/01/03/181/n/1922398/5bccdcce4f5c73c6_460999856_10ioj9fk/i/Felicity-Jones.jpg -- doesn't work
			newsrc = src.replace(/\.(?:preview_)?(?:[a-z]*|_original)(?:_(?:[0-9x]+|wm))?(\/i\/[^/]*)$/, "$1");
			if (newsrc !== src)
				return newsrc;

			// https://media1.popsugar-assets.com/files/2010/08/34/3/301/3019466/36cde93e8d75bf68_HeidiMont_Denis_60124316_Max.preview.jpeg
			//   https://media1.popsugar-assets.com/files/2010/08/34/3/301/3019466/36cde93e8d75bf68_HeidiMont_Denis_60124316_Max.jpeg
			// http://media4.onsugar.com/files/2013/07/19/761/n/1922564/d5d89db25acd7746_173781022.xxxlarge.jpg
			//   http://media4.onsugar.com/files/2013/07/19/761/n/1922564/d5d89db25acd7746_173781022.jpg
			// http://media3.onsugar.com/files/2012/06/24/4/192/1922153/8e8d2f2e956a6470_Giada.xxxlarge_1.jpg
			//   http://media3.onsugar.com/files/2012/06/24/4/192/1922153/8e8d2f2e956a6470_Giada.jpg
			// doesn't work:
			// http://media3.onsugar.com/files/2014/07/25/003/n/1922441/07ae12e6fcb9b25c_Screen_Shot_2014-07-25_at_4.00.20_PM.xxxlarge.jpg
			//   http://media3.onsugar.com/files/2014/07/25/003/n/1922441/07ae12e6fcb9b25c_Screen_Shot_2014-07-25_at_4.00.20_PM.jpg -- doesn't work
			// https://media1.popsugar-assets.com/files/2011/02/08/3/192/1922283/6c3a7c3fcbdf7dc6_best_actress.preview.jpg -- 550x456
			//   https://media1.popsugar-assets.com/files/2011/02/08/3/192/1922283/6c3a7c3fcbdf7dc6_best_actress.jpg -- doesn't work
			return src.replace(/\.(?:preview|x*large)(?:_(?:[0-9x]+|wm))?(\.[^/.]*)$/, "$1");

			// other:
			// thanks to redrobbin7 on reddit for reporting:
			// https://media1.popsugar-assets.com/files/2011/10/41/5/192/1922398/bb4270abae65deb2_AU-1447838wtmk/i/Prince-William-speaks-100-Women-Hedge-Funds-charity-dinner.jpg
			// other old urls:
			// https://media1.popsugar-assets.com/files/2011/05/20/4/192/1922564/bfa7dbfcab07c972_114197900_10/i/Bing-Bing-Club.jpg -- 2180x3000
			//   https://media1.popsugar-assets.com/files/2011/05/20/4/192/1922564/bfa7dbfcab07c972_114197900_10.jpg -- same image
		}

		if (domain_nosub === "ceros.com" && domain.match(/^media[-.]/)) {
			// https://media-s3-us-east-1.ceros.com/popsugar/images/2018/08/17/73bd83a889f54cc67731a00623f5a1ca/ps18-cotton-np2-forceros.jpg?imageOpt=1&fit=bounds&width=1962
			//   https://media-s3-us-east-1.ceros.com/popsugar/images/2018/08/17/73bd83a889f54cc67731a00623f5a1ca/ps18-cotton-np2-forceros.jpg
			newsrc = src.replace(/\?.*/, "");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "elleuk.cdnds.net") {
			// http://elleuk.cdnds.net/15/37/980x1306/980x1306--29f8-11e6-9cdd-21395b3400d9-assets-elleuk-com-gallery-16644-1365760633-emma-watson-january-2013-jpg.jpg
			//   http://assets.elleuk.com/gallery/16644/1365760633-emma-watson-january-2013.jpg
			//
			// http://elleuk.cdnds.net/15/37/768x1024/768x1024-d38b1ahttp-s3-eu-west-1-amazonaws-com-ee-elleuk-2-emma-watson-december-2014-cover-star-composite-jpg.jpg
			// http://s3-eu-west-1.amazonaws.com/ee-elleuk/Hailey-Baldwin-Topshop-unique-RS15-0515-Imaxtree.jpg
			// problem: capitalized
			newsrc = src.replace(/:\/\/.*\/[^/]*assets-elleuk-com-gallery-([0-9]*)-([^/]*)-([^-/.]*)\.[^-/.]*$/, "://assets.elleuk.com/gallery/$1/$2.$3");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nosub === "cdnds.net" &&
			//!src.match(/\/gallery_[^/]*$/) &&
			!src.match(/\/[0-9]*x[0-9]*-[^/]*$/)) {
			//domain.indexOf("esquireuk.cdnds.net") < 0 &&
			//domain.indexOf("digitalspyuk.cdnds.net") < 0

			// doesn't work:
			// http://digitalspyuk.cdnds.net/14/42/768x512/gallery_7065877-low_res-.jpg
			//   http://digitalspyuk.cdnds.net/14/42/1600x1067/gallery_7065877-low_res-.jpg
			//   http://digitalspyuk.cdnds.net/14/42/7065877-low_res-.jpg -- works
			// http://digitalspyuk.cdnds.net/11/51/768x512/gallery_tv_countdown_nick_hewer_2.jpg
			//   http://digitalspyuk.cdnds.net/11/51/gallery_tv_countdown_nick_hewer_2.jpg
			//   http://digitalspyuk.cdnds.net/11/51/tv_countdown_nick_hewer_2.jpg -- works
			// http://digitalspyuk.cdnds.net/13/40/980x1470/gallery_emma-watson.jpg
			//   http://digitalspyuk.cdnds.net/13/40/emma-watson.jpg -- works
			//
			// works:
			// http://digitalspyuk.cdnds.net/16/47/980x490/landscape-1479890677-gettyimages-108378197.jpg
			//   http://digitalspyuk.cdnds.net/16/47/landscape-1479890677-gettyimages-108378197.jpg
			//   http://digitalspyuk.cdnds.net/16/47/1479890677-gettyimages-108378197.jpg
			// http://elleuk.cdnds.net/17/06/1600x900/hd-aspect-1486581368-emma-web.jpg
			//   http://elleuk.cdnds.net/17/06/hd-aspect-1486581368-emma-web.jpg
			//   http://elleuk.cdnds.net/17/06/1486581368-emma-web.jpg
			// http://cosmouk.cdnds.net/14/51/980x490/nrm_1418985628-nick-hewer-quits-apprentice.jpg?resize=768:*
			//   http://cosmouk.cdnds.net/14/51/nrm_1418985628-nick-hewer-quits-apprentice.jpg?resize=768:*
			// http://elleuk.cdnds.net/17/25/480x719/gallery-1498212018-emmawatsonlouisvuitton.jpg
			//   http://elleuk.cdnds.net/17/25/gallery-1498212018-emmawatsonlouisvuitton.jpg
			//   http://elleuk.cdnds.net/17/25/1498212018-emmawatsonlouisvuitton.jpg
			// http://digitalspyuk.cdnds.net/18/05/landscape-1517275491-cameron1.jpg
			//   http://digitalspyuk.cdnds.net/18/05/1517275491-cameron1.jpg
			// http://i1.cdnds.net/13/34/M/lily-collins_2.jpg
			//   http://i1.cdnds.net/13/34/L/lily-collins_2.jpg
			//   http://i1.cdnds.net/13/34/lily-collins_2.jpg
			newsrc = src
				.replace(/\/[0-9]+x[0-9]+\/gallery_/, "/")
				.replace(/\/[0-9]+x[0-9]+\/([^/]*)$/, "/$1")
				.replace(/\/[ML]\/([^/]*)$/, "/$1")
				.replace(/\/(?:landscape|hd-aspect|gallery)-([^/]*)$/, "/$1")
				.replace(/(\/[^/]*)\?[^/]*$/, "$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "redonline.cdnds.net") {
			// http://redonline.cdnds.net/main/gallery/21794/grammy-awards-2016-taylor-swift__portrait.jpg
			//   http://redonline.cdnds.net/main/gallery/21794/grammy-awards-2016-taylor-swift.jpg
			return src.replace(/__[a-z]+(\.[^/.]*)$/, "$1");
		}

		if (domain === "img.usmagazine.com") {
			// http://img.usmagazine.com/660-width/matthew-clines-624d28c3-5401-4041-9b40-1f25c25bf397.jpg
			//   http://img.usmagazine.com/matthew-clines-624d28c3-5401-4041-9b40-1f25c25bf397.jpg
			return src.replace(/(.*?[^:])\/[0-9]*-[^/]*\//, "$1/");
		}

		if (domain_nosub === "gannett-cdn.com" &&
			string_indexof(src, "/-mm-/") >= 0) {
			// https://www.gannett-cdn.com/-mm-/2e56892f6a349ad47192b530425d443fb365e5e9/r=x1803&c=3200x1800/https/media.gannett-cdn.com/35547429001/35547429001_5727574988001_5727573873001-vs.jpg?pubId=35547429001
			//   https://media.gannett-cdn.com/35547429001/35547429001_5727574988001_5727573873001-vs.jpg
			// https://www.gannett-cdn.com/-mm-/2eab0172f87f63087b9b90322b67744820df1d8d/c=0-230-4565-2809&r=x1683&c=3200x1680/local/-/media/2018/02/27/USATODAY/USATODAY/636553489293713705-AFP-AFP-10H1QY-97704432.JPG
			//   https://www.gannett-cdn.com/media/2018/02/27/USATODAY/USATODAY/636553489293713705-AFP-AFP-10H1QY-97704432.JPG
			newsrc = src.replace(/.*?\/-mm-\/[0-9a-f]*\/[^/]*\/(http[^/]*)\/(.*)$/, "$1://$2");
			if (newsrc !== src)
				return newsrc;

			return src.replace(/\/-mm-\/.*?\/-\//, "/");
		}

		if (domain_nowww === "usatoday.com") {
			// thanks to Harmony on discord:
			// https://www.usatoday.com/gcdn/-mm-/f619dc5571442d0321f83dd1bb9d8bcb5ed561ab/c=0-0-3165-1788/local/-/media/2017/08/22/USATODAY/USATODAY/636389898160834387-AP-Britain-Logan-Lucky-Premiere.jpg?width=1200&disable=upscale&format=pjpg&auto=webp
			//   https://www.gannett-cdn.com/media/2017/08/22/USATODAY/USATODAY/636389898160834387-AP-Britain-Logan-Lucky-Premiere.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+gcdn\/+/, "https://www.gannett-cdn.com/");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nosub === "aolcdn.com") {
			var regex1 = /.*image_uri=([^&]*).*/;

			if (src.match(regex1)) {
				// https://o.aolcdn.com/images/dims?thumbnail=640%2C420&quality=75&format=jpg&image_uri=https%3A%2F%2Faol-releases-assets-production.s3.amazonaws.com%2Fgenerator%2F07A13DEB.jpg&client=cbc79c14efcebee57402&signature=09ed437d01bfde0d182a609c759f58006578aa3a
				//   https://aol-releases-assets-production.s3.amazonaws.com/generator/07A13DEB.jpg
				// https://o.aolcdn.com/images/dims?resize=1200%2C630&amp;crop=1200%2C630%2C0%2C0&amp;quality=80&amp;image_uri=https%3A%2F%2Fimg.vidible.tv%2Fprod%2F2018-07%2F03%2F5b3bcb63158f855373e8f026%2F5b3bcc4d802b9473f9df3077_o_U_v1.jpg&amp;client=cbc79c14efcebee57402&amp;signature=358c49852d6c8cdd678cc7dea0ad0995c5f7d224
				//   https://img.vidible.tv/prod/2018-07/03/5b3bcb63158f855373e8f026/5b3bcc4d802b9473f9df3077_o_U_v1.jpg
				newsrc = decodeURIComponent(src.replace(/.*image_uri=([^&]*).*/, "$1"));
			} else if (src.match(/.*o\.aolcdn\.com\/images\//)) {
				// https://o.aolcdn.com/images/dims3/GLOB/legacy_thumbnail/1028x675/format/jpg/quality/85/http%3A%2F%2Fo.aolcdn.com%2Fhss%2Fstorage%2Fmidas%2F652aa88cb26c6aafe4dca4eef405c15%2F205409332%2FScreen%2BShot%2B2017-06-23%2Bat%2B2.36.37%2BPM.png
				//   http://o.aolcdn.com/hss/storage/midas/652aa88cb26c6aafe4dca4eef405c15/205409332/Screen+Shot+2017-06-23+at+2.36.37+PM.png
				newsrc = decodeURIComponent(src).replace(/.*o\.aolcdn\.com\/images\/[^:]*\/([^:/]*:.*)/, "$1");
			} else if (src.match(/^[a-z]+:\/\/[^/]*\/hss\/storage\/midas\//)) {
				// https://s.aolcdn.com/hss/storage/midas/668dd572f108685386710ff09bb15f2a/205350917/1280_selena_gomez_the_weeknd_carbone_backgrid_BGUS_879674_007.jpg
				//   https://s.aolcdn.com/hss/storage/midas/668dd572f108685386710ff09bb15f2a/205350917/selena_gomez_the_weeknd_carbone_backgrid_BGUS_879674_007.jpg
				return src.replace(/\/[0-9]+_([^/]*)$/, "/$1");
			}

			if (newsrc && newsrc !== src)
				return newsrc;
		}

		if (domain === "imagesvc.timeincapp.com") {
			// http://imagesvc.timeincapp.com/v3/foundry/image/?q=70&w=1440&url=https%3A%2F%2Ftimedotcom.files.wordpress.com%2F2017%2F11%2Fcolumbia-1.jpg%3Fquality%3D85
			//   https://timedotcom.files.wordpress.com/2017/11/columbia-1.jpg
			// https://imagesvc.timeincapp.com/v3/fan/image?url=https://winteriscoming.net/files/2019/05/Official-806-Daenerys-Helen-Sloan-HBO.jpg&c=sc&w=736&h=485
			//   https://winteriscoming.net/files/2019/05/Official-806-Daenerys-Helen-Sloan-HBO.jpg
			// https://imagesvc.timeincapp.com/v3/mm/image?url=https%3A%2F%2Fcdn-s3.si.com%2Fs3fs-public%2F2013%2F05%2F13_kate-upton-body-paint_02.jpg&w=900&q=85
			//   https://cdn-s3.si.com/s3fs-public/2013/05/13_kate-upton-body-paint_02.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/v3\/+[a-z]+\/+image\/?.*?[?&]url=(http[^&]*).*/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "g.foolcdn.com") {
			// https://g.foolcdn.com/image/?url=https%3A//g.foolcdn.com/editorial/images/579023/wb_hub_1200x678_arkham_city_1_190710-image-1.jpg&w=2000&op=resize
			//   https://g.foolcdn.com/editorial/images/579023/wb_hub_1200x678_arkham_city_1_190710-image-1.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+image\/+\?(?:.*&)?url=([^&]+).*?$/, "$1");
			if (newsrc !== src)
				return decodeURIComponent(newsrc);
		}

		/*if (false && string_indexof(domain, ".photoshelter.com") >= 0) {
		  return src.replace(/\/s\/[0-9]*\/[0-9]*\//, "/");
		}*/

		if (domain_nosub === "photoshelter.com") {
			// http://c.photoshelter.com/img-get/I00002_.IhMQAZEg/t/200/I00002_.IhMQAZEg.jpg
			//   https://ssl.c.photoshelter.com/img-get/I00002_.IhMQAZEg/s/700/SHM-Spider-Man-Homecoming-Prem-28062017-001.jpg
			//   https://ssl.c.photoshelter.com/img-get2/I00002_.IhMQAZEg/fit=4000x4000/SHM-Spider-Man-Homecoming-Prem-28062017-001.jpg
			//   https://ssl.c.photoshelter.com/img-get2/I00002_.IhMQAZEg/fit=99999999999/SHM-Spider-Man-Homecoming-Prem-28062017-001.jpg
			// https://ssl.c.photoshelter.com/img-get2/I00007dPXW9BAIiU/sec=wd0sd0oe0lwe0ms1000ed20170311lyHGYvV7mWMka15/fit=2040x2040/Rutgers-womens-rowing-team-works-out-on-the-Raritan-River.jpg -- 2040x1357
			//   https://ssl.c.photoshelter.com/img-get2/I00007dPXW9BAIiU/fit=4000x4000/Rutgers-womens-rowing-team-works-out-on-the-Raritan-River.jpg
			// https://culver.photoshelter.com/asset-get/A0000N3HQ83lQtzA/20160913_325_RS-0.jpg -- 5000x3333
			// https://ssl.c.photoshelter.com/img-get/I0000sljp0JcarNs/pak05lhecop-57.jpg -- 500x332
			// https://ssl.c.photoshelter.com/img-get/I0000x_JQ_qY2rhs/s/750/750/1678-James-Brown-11-and-Tomi-Rae-Hynie-Brown-and-Martha-Stewart.jpg
			//   https://ssl.c.photoshelter.com/img-get2/I0000x_JQ_qY2rhs/fit=99999999999/1678-James-Brown-11-and-Tomi-Rae-Hynie-Brown-and-Martha-Stewart.jpg
			// https://ssl.c.photoshelter.com/img-get2/I0000Ie55NrhpWqc/sec=wdfsdfoeflwefms1440ed20190122M0EoIIVFG8_ziPw/fit=350x2040
			//   https://ssl.c.photoshelter.com/img-get2/I0000Ie55NrhpWqc/fit=99999999999/fit=350x2040
			//   https://ssl.c.photoshelter.com/img-get2/I0000Ie55NrhpWqc/fit=99999999999

			// https://ssl.c.photoshelter.com/img/photoshelter_unavailable.jpg
			if (/\/img\/+photoshelter_unavailable\./.test(src)) {
				return {
					url: src,
					bad: true
				};
			}

			return src
				.replace(/\/img-get2\/([^/]*)\/(?:[a-z]+=[^/]*\/)*([^/]*)$/, "/img-get2/$1/fit=99999999999/$2")
				.replace(/\/img-get\/([^/]*)(?:\/[ts]\/[0-9]+\/(?:[0-9]+\/)?)?([^/]*)$/, "/img-get2/$1/fit=99999999999/$2")
				.replace(/\/+fit=[0-9x]+\/+fit=[0-9x]+/, "/fit=99999999999");
		}

		if (domain_nowww === "marcusgetta.photography" ||
			// thanks to anonymous for reporting:
			domain_nowww === "schreyer-photo.com" ||
			// thanks to anonymous for reporting:
			domain_nowww === "stellapictures.co.uk" ||
			// thanks to anonymous for reporting:
			domain_nowww === "mgpstockphotos.com") {
			// thanks to meloner on discord for reporting:
			// https://www.marcusgetta.photography/img-get2/I0000RIQ98yTy98k/fill=/fit=188x188/I0000RIQ98yTy98k.jpg
			//   https://ssl.c.photoshelter.com/img-get2/I0000RIQ98yTy98k/fit=99999999999/I0000RIQ98yTy98k.jpg
			return src.replace(/^[a-z]+:\/\/[^/]+\/+(img-get2\/)/, "https://ssl.c.photoshelter.com/$1");
		}

		if (domain_nowww === "celebzz.com" &&
			string_indexof(src, "/wp-content/uploads/") >= 0) {
			// http://www.celebzz.com/wp-content/uploads/2018/03/jenna-ortega-at-ready-player-one-premiere-at-dolby-theatre-in-hollywood-21_thumbnail.jpg
			//   http://www.celebzz.com/wp-content/uploads/2018/03/jenna-ortega-at-ready-player-one-premiere-at-dolby-theatre-in-hollywood-21.jpg
			newsrc = src.replace(/_thumbnail(\.[^/.]*)$/, "$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nosub === "images-amazon.com" ||
			// http://ec2.images-amazon.com/images/I/81IotHEYjBL._AA1417_.jpg
			//   http://ec2.images-amazon.com/images/I/81IotHEYjBL.jpg

			// https://images-na.ssl-images-amazon.com/images/I/B1GLFkULdTS._CR0,0,3840,2880_._SL1000_.png
			//   https://images-na.ssl-images-amazon.com/images/I/B1GLFkULdTS.png
			// https://images-na.ssl-images-amazon.com/images/I/81yxJ9lr5vL.AC_SL1500_.jpg -- no ._
			//   https://images-na.ssl-images-amazon.com/images/I/81yxJ9lr5vL.jpg
			// https://images-eu.ssl-images-amazon.com/images/I/41TMMGD0XZL._SL500_AC_SS350_.jpg
			//   https://images-eu.ssl-images-amazon.com/images/I/41TMMGD0XZL.jpg
			// https://images-na.ssl-images-amazon.com/images/S/abs-image-upload-na/3/AmazonStores/ATVPDKIKX0DER/bd40c858f5fe4f2734eea3b15695e490.w10200.h25650._SL5000_AC_.png
			//   https://images-na.ssl-images-amazon.com/images/S/abs-image-upload-na/3/AmazonStores/ATVPDKIKX0DER/bd40c858f5fe4f2734eea3b15695e490.w10200.h25650.png
			//   https://images-na.ssl-images-amazon.com/images/S/abs-image-upload-na/3/AmazonStores/ATVPDKIKX0DER/bd40c858f5fe4f2734eea3b15695e490.png -- doesn't work (403)
			// https://images-na.ssl-images-amazon.com/images/S/abs-image-upload-na/9/AmazonStores/ATVPDKIKX0DER/02918ee40d2ef3b6901d11895620f31b.w7402.h4915._SL5000_AC_.png -- 5000x3320
			//   https://images-na.ssl-images-amazon.com/images/S/abs-image-upload-na/9/AmazonStores/ATVPDKIKX0DER/02918ee40d2ef3b6901d11895620f31b.w7402.h4915.png
			// https://images-na.ssl-images-amazon.com/images/G/01/aplusautomation/vendorimages/73da407a-f7e0-4d9a-8943-178d8838be48.jpg._CB329731638_.jpg -- 3744x5616
			//   https://images-na.ssl-images-amazon.com/images/G/01/aplusautomation/vendorimages/73da407a-f7e0-4d9a-8943-178d8838be48.jpg.jpg -- same size
			//   https://images-na.ssl-images-amazon.com/images/G/01/aplusautomation/vendorimages/73da407a-f7e0-4d9a-8943-178d8838be48.jpg -- works too
			// https://images-na.ssl-images-amazon.com/images/I/71a+-4NCCzL.SR160,240_BG243,243,243.jpg
			//   https://images-na.ssl-images-amazon.com/images/I/71a+-4NCCzL.jpg
			// thanks to fireattack on discord
			// https://images-fe.ssl-images-amazon.com/images/I/81b-Cse+9OL._AC_US218_..jpg
			//   https://images-fe.ssl-images-amazon.com/images/I/81b-Cse+9OL.jpg
			// https://images-fe.ssl-images-amazon.com/images/I/81b-Cse+9OL._V_AC_US218_..jpg
			//   https://images-fe.ssl-images-amazon.com/images/I/81b-Cse+9OL.jpg
			domain_nosub === "ssl-images-amazon.com" ||
			// https://m.media-amazon.com/images/I/61rtKO6VrUL._SL500_.jpg
			//   https://m.media-amazon.com/images/I/61rtKO6VrUL.jpg
			// https://m.media-amazon.com/images/M/MV5BNTJjZDE0YzQtNjQ1Mi00M2EwLTkxYTEtZDBiY2Q5NzY4NmQ5XkEyXkFqcGdeQXVyMDM2NDM2MQ@@._CR294,163,2581,2581_UX614_UY614.jpg
			//   https://m.media-amazon.com/images/M/MV5BNTJjZDE0YzQtNjQ1Mi00M2EwLTkxYTEtZDBiY2Q5NzY4NmQ5XkEyXkFqcGdeQXVyMDM2NDM2MQ@@.jpg
			// https://m.media-amazon.com/images/M/MV5BYmY4NTExN2MtOWZjMy00NWU0LWIzZDMtMzQ4NThjNGM3OGU0XkEyXkFqcGdeQXVyOTc5MDI5NjE@.UX1000.jpeg -- via https://libremdb.herokuapp.com/title/tt11697820/
			//   https://m.media-amazon.com/images/M/MV5BYmY4NTExN2MtOWZjMy00NWU0LWIzZDMtMzQ4NThjNGM3OGU0XkEyXkFqcGdeQXVyOTc5MDI5NjE@.jpeg
			// https://m.media-amazon.com/images/M/MV5BOGFkMTZkYmYtNTliNy00N2U3LTkyZjQtYTIxNjEyY2I5MjhiXkEyXkFqcGdeQXVyOTc5MDI5NjE@.UX1000.jpeg -- upscaled
			//   https://m.media-amazon.com/images/M/MV5BOGFkMTZkYmYtNTliNy00N2U3LTkyZjQtYTIxNjEyY2I5MjhiXkEyXkFqcGdeQXVyOTc5MDI5NjE@.jpeg -- original
			// thanks to nimbuz on discord:
			// https://m.media-amazon.com/images/I/A13usaonutL._CLa%7C2140%2C2000%7C91ZCXdqRg0L.png%7C0%2C0%2C2140%2C2000%2B0.0%2C0.0%2C2140.0%2C2000.0_AC_SX466_.png
			//   https://m.media-amazon.com/images/I/A13usaonutL._CLa%7C2140%2C2000%7C91ZCXdqRg0L.png%7C0%2C0%2C2140%2C2000%2B0.0%2C0.0%2C2140.0%2C2000.png
			domain_nosub === "media-amazon.com" ||
			// https://ia.media-imdb.com/images/M/MV5BNjA1NDYwMDQ3MF5BMl5BanBnXkFtZTcwOTYyNDQ0MQ@@._V1_UY268_CR1,0,182,268_AL_.jpg
			//   https://ia.media-imdb.com/images/M/MV5BNjA1NDYwMDQ3MF5BMl5BanBnXkFtZTcwOTYyNDQ0MQ@@.jpg
			// https://ia.media-imdb.com/images/M/MV5BMTU2NDI2YjktYjYxMy00OGIwLWEzMjktNzEzNzA4YzVmZGRjXkEyXkFqcGdeQXVyNDU4MDk4OA@@._V1_UY317_CR51,0,214,317_AL_.jpg
			//   https://ia.media-imdb.com/images/M/MV5BMTU2NDI2YjktYjYxMy00OGIwLWEzMjktNzEzNzA4YzVmZGRjXkEyXkFqcGdeQXVyNDU4MDk4OA@@.jpg
			// https://ia.media-imdb.com/images/M/MV5BYmY4NTExN2MtOWZjMy00NWU0LWIzZDMtMzQ4NThjNGM3OGU0XkEyXkFqcGdeQXVyOTc5MDI5NjE@.UX1000.jpeg -- see above
			//   https://ia.media-imdb.com/images/M/MV5BYmY4NTExN2MtOWZjMy00NWU0LWIzZDMtMzQ4NThjNGM3OGU0XkEyXkFqcGdeQXVyOTc5MDI5NjE@.jpeg
			domain_nosub === "media-imdb.com" ||
			// http://in.in3w.info/i/MV5BMjM3MTczNzY1MF5BMl5BanBnXkFtZTgwNjgwODgzNDE@._V1_.jpg
			//   http://in.in3w.info/i/MV5BMjM3MTczNzY1MF5BMl5BanBnXkFtZTgwNjgwODgzNDE@.jpg
			// moving to ia.media-imdb.com doesn't work
			domain === "in.in3w.info" ||
			// thanks to fireattack on discord
			// https://www.amazon.co.jp/images/I/61tgAxzPy2S._SL1500_.jpg
			//   https://www.amazon.co.jp/images/I/61tgAxzPy2S.jpg
			domain_nowww === "amazon.co.jp" ||
			// https://i.gr-assets.com/images/S/compressed.photo.goodreads.com/users/1497668011i/22813064._UX100_CR0,0,100,100_.jpg
			//   https://i.gr-assets.com/images/S/compressed.photo.goodreads.com/users/1497668011i/22813064.jpg
			domain === "i.gr-assets.com") {
			// https://images-na.ssl-images-amazon.com/images/G/01/apparel/rcxgs/tile.gif
			if (/^[a-z]+:\/\/[^/]+\/+images\/+[A-Z]\/+[0-9]+\/+apparel\/+rcxgs\/+tile\.(?:[^/?#]+\.)?gif(?:[?#].*)?$/.test(src))
				return {
					url: src,
					bad: "mask"
				};

			let parse_directives = function(url) {
				let match = url.match(/((?:\.+_*(?:0_)?(?:[A-Z][A-Z0-9]|V_)[^/.]*)+)\.+[^/.]+(?:[?#].*)?$/);
				if (!match)
					return null;

				let raw_directives = match[1].replace(/\./g, "_").replace(/_+/g, "_").split("_");
				let directives = [];

				for (let directive of raw_directives) {
					if (!directive || !directive.length)
						continue;

					let dmatch = directive.match(/^([A-Z][A-Z0-9]|V|0)(.*)?$/);
					if (!dmatch) {
						console_warn("Invalid directive", directive, "for URL", url);
						return null;
					}

					directives.push({key: dmatch[1], value: dmatch[2] || null});
				}

				return directives;
			}

			let stringify_directives = function(url, directives) {
				let stringified_arr = [];

				for (let directive of directives) {
					let str = [directive.key];
					if (directive.value)
						str.push(directive.value);
					stringified_arr.push(str.join(""));
				}

				let stringified = "._" + stringified_arr.join("_") + "_";
				if (!stringified_arr.length)
					stringified = "";

				let urlmatch = url.match(/^(.*\/[^/]+?)(?:\.+_*(?:0_)?(?:[A-Z][A-Z0-9]|V_)[^/.]*)*\.*(\.[^/.]+(?:[?#].*)?)$/);
				if (!urlmatch) {
					console_warn("Unable to find URL match for", url);
					return url;
				}

				return urlmatch[1] + stringified + urlmatch[2];
			}

			let parsed_directives = parse_directives(src);
			if (parsed_directives) {
				let new_directives = [];
				for (let directive of parsed_directives) {
					if (directive.key === "V1" ||
						directive.key === "UX" ||
						directive.key === "UY" ||
						directive.key === "US" ||
						directive.key === "CR" ||
						directive.key === "AC" ||
						directive.key === "AL" ||
						directive.key === "AA" ||
						directive.key === "SL" ||
						directive.key === "SS" ||
						directive.key === "SR" ||
						directive.key === "SX" ||
						directive.key === "SY" ||
						directive.key === "V" ||
						directive.key === "BG" || // background color
						directive.key === "0" ||
						directive.key === "CB") {
						continue;
					}

					new_directives.push(directive);
				}

				newsrc = stringify_directives(src, new_directives);
				if (newsrc !== src) {
					return {
						url: newsrc,
						can_head: false
					};
				}
			}

			// apparently some images can be replaced to 160px? ._SCRM_. apparently fixes this?
			//   ref: https://wiki.musicbrainz.org/User:Nikki/CAA
			// thanks to TristanWasTaken on github: https://github.com/qsniyg/maxurl/issues/1167
			// https://www.amazon.co.jp/dp/B0BG56NRZW
			// https://m.media-amazon.com/images/P/B0BG56NRZW.01.MAIN._SCRM_.jpg
			//   https://m.media-amazon.com/images/P/B0BG56NRZW._SCRM_.jpg -- 353x500
			// https://m.media-amazon.com/images/P/B0BG56NRZW.01._SCRM_.jpg -- 1145x2048
			if (/\/images\/+P\//.test(src)) {
				return {
					url: src.replace(/(\/P\/+[A-Z0-9]+)(?:\.[0-9]+)?(?:\.[^/]+)?(\.[^/.?#]+)(?:[?#].*)?$/, "$1.01._SCRM_$2"),
					can_head: false
				};
			}

			return {
				//url: src.replace(/\._[^/]*\.([^./]*)$/, "._.$1"),
				url: src
					.replace(/(\.[^/.]*)(?:\.[^/.]*_){1,}\1(?:[?#].*)?$/, "$1") // is this needed?
					.replace(/(?:\.+_*[A-Z][A-Z0-9][^/.]*)+\.([^./]*(?:[?#].*)?)$/, ".$1"), // for now this seems to work for all images
				//always_ok: true,
				is_original: true,
				can_head: false
			};
		}

		if (domain_nosub === "otapol.jp") {
			// http://otapol.jp/img/amazon/size130/41CUQ4yXvwL.jpg
			//   https://images-na.ssl-images-amazon.com/images/I/41CUQ4yXvwL.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/img\/amazon\/size[0-9]+\/([^/]*)$/,
								 "https://images-na.ssl-images-amazon.com/images/I/$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nowww === "movpins.com") {
			// http://www.movpins.com/big/MV5BMjgxMzU1NDcxNV5BMl5BanBnXkFtZTgwODMzMjEyNTE@.__UY268_CR1,0,182,268_AL/stefanie-scott-at-event-of-insidious:-chapter-3-(2015)-large-picture.jpg
			//   https://ia.media-imdb.com/images/M/MV5BMjgxMzU1NDcxNV5BMl5BanBnXkFtZTgwODMzMjEyNTE@.jpg
			return src.replace(/^[a-z]+:\/\/[^/]*\/[a-z]+\/+(.)([a-zA-Z0-9]+(?:@+)?)(?:\.[^/]*)?\/[^/]*(\.[^/.]*)$/,
							   "https://ia.media-imdb.com/images/$1/$1$2$3");
		}

		if (domain === "cdn.cafehulu.com") {
			// https://cdn.cafehulu.com/MV5BOGFlNTdmYWQtM2IzMi00YTY3LTlmMDQtZDI5NGQ5MjYzZmEwXkEyXkFqcGdeQXVyNjY1MTg4Mzc@._V1_SX300.jpg
			//   https://ia.media-imdb.com/images/M/MV5BOGFlNTdmYWQtM2IzMi00YTY3LTlmMDQtZDI5NGQ5MjYzZmEwXkEyXkFqcGdeQXVyNjY1MTg4Mzc@.jpg
			return src.replace(/^[a-z]+:\/\/[^/]+\/+(.)([a-zA-Z0-9]{40,}(?:@+)?)(\.[^/?#]+)(?:[?#].*)?$/, "https://ia.media-imdb.com/images/$1/$1$2$3");
		}

		if (domain_nowww === "imdb.com") {
			newsrc = website_query({
				website_regex: /\/video(?:player)?\/+(?:embed\/+)?vi([0-9]+)\/*(?:[?#].*)?$/,
				query_for_id: "https://www.imdb.com/video/vi${id}",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/<script id="__NEXT_DATA__" type="application\/json">({.*?})<\/script>/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					var json = JSON.parse(match[1]);
					var video = json.props.pageProps.videoPlaybackData.video;

					var baseobj = {
						extra: {
							caption: video.name.value || video.description.value
						}
					};

					var urls = [];

					for (var i = 0; i < video.playbackURLs.length; i++) {
						var our_obj = video.playbackURLs[i];

						var our_url:BigImageInfoSObject = {
							url: our_obj.url
						};

						if (our_obj.mimeType === "video/mp4") {
							our_url.video = true;
						} else if (our_obj.mimeType === "application/x-mpegurl") {
							our_url.video = "hls";
						} else {
							console_warn("Unsupported mime type", our_obj.mimeType);
							continue;
						}

						urls.push(our_url);
					}

					urls.push(video.thumbnail.url); // TODO: remove ._???_.

					return done(fillobj_urls(urls, baseobj), 6*60*60); // urls expire in 23 hours
				}
			});
			if (newsrc) return newsrc;
		}

		/*if (false && string_indexof(domain, "cdn-img.instyle.com") >= 0) {
		  return src.replace(/(\/files\/styles\/)[^/]*(\/public)/, "$1original$2");
		}

		if (false && string_indexof(domain, "static.independent.co.uk") >= 0) {
		  return src.replace(/(\/styles\/)story_[^/]*(\/public)/, "$1story_large$2");
		}*/

		if (domain_nowww === "cinema.de") {
			// https://www.cinema.de/sites/default/files/styles/cin_portrait_180/public/sync/cms3.cinema.de/imgdb/import/dreams2/5ffd/5ce/0/5ffd5ce081896512339484d5.jpeg.jpg?itok=nifUBvQj
			//   https://www.cinema.de/sites/default/files/sync/cms3.cinema.de/imgdb/import/dreams2/5ffd/5ce/0/5ffd5ce081896512339484d5.jpeg
			//   http://cms3.cinema.de/imgdb/import/dreams2/5ffd/5ce/0/5ffd5ce081896512339484d5.jpeg
			return src
				.replace(/.*\/files\/+sync\/([^/]+\.cinema\.de\/)/, "http://$1")
				.replace(/\/styles\/+.*?\/+(?:public|private)\/(.*\.jpeg)\.jpg(?:[?#].*)?$/, "/$1");
		}

		if (domain_nowww === "gamersnexus.net") {
			// thanks to anonymous for reporting:
			// https://gamersnexus.net/u/styles/card_teaser/public/inline-images/image_176.png.webp
			//   https://gamersnexus.net/u/styles/large_responsive_no_watermark_/public/inline-images/image_176.png
			newsrc = src.replace(/(\/styles\/+[^/]+\/+public\/+[^/]+\/+[^/]+\.[a-z]+)\.webp(?:[?#].*)?$/, "$1");
			if (newsrc !== src)
				return newsrc;

			// other:
			// https://gamersnexus.net/u/2024-02/cablemod-failure-website_gn.jpg
			return src.replace(/\/styles\/+card_teaser(\/+public\/+[^/]+\/+[^/]+)(?:[?#].*)?$/, "/styles/large_responsive_no_watermark_$1");
		}

		// drupal
		// https://italyxp.com/sites/default/files/mediaitalyxp/vesuvius.jpg?width=820&height=620&iframe=true
		// https://www.windowscentral.com/sites/wpcentral.com/files/styles/xlarge_wm_brw/public/field/image/2018/03/surviving-mars-hero.jpg?itok=4_uW-AOb
		//   https://www.windowscentral.com/sites/wpcentral.com/files/field/image/2018/03/surviving-mars-hero.jpg -- different image
		if (domain === "cdn-img.instyle.com" ||
			// https://cdn-img.instyle.com/sites/default/files/styles/684xflex/public/images/2016/07/071616-blake-lively-lead.jpg?itok=MFWx_-rR
			//   https://cdn-img.instyle.com/sites/default/files/images/2016/07/071616-blake-lively-lead.jpg

			// https://static.independent.co.uk/s3fs-public/styles/story_large/public/thumbnails/image/2016/02/20/20/21-LGBT-MPs-TeriPeng.jpg
			//   https://static.independent.co.uk/s3fs-public/thumbnails/image/2016/02/20/20/21-LGBT-MPs-TeriPeng.jpg
			domain === "static.independent.co.uk" ||
			// https://static.standard.co.uk/s3fs-public/thumbnails/image/2017/04/21/09/graham-norton-harry-styles-2.jpg?w968
			//   https://static.standard.co.uk/s3fs-public/thumbnails/image/2017/04/21/09/graham-norton-harry-styles-2.jpg -- 1500x1000
			// https://static.standard.co.uk/s3fs-public/styles/story_large/public/thumbnails/image/2018/06/22/14/summerdresses.jpg
			//   https://static.standard.co.uk/s3fs-public/thumbnails/image/2018/06/22/14/summerdresses.jpg
			domain === "static.standard.co.uk" ||
			/*domain.indexOf("www.billboard.com") >= 0 ||
			  string_indexof(domain, "www.harpersbazaararabia.com") >= 0 ||
			  string_indexof(domain, "www.etonline.com") >= 0 ||*/
			domain === "o.oystermag.com" ||
			/*domain.indexOf("www.metro.us") >= 0 ||
			  string_indexof(domain, "www.mtv.co.uk") >= 0 ||
			  string_indexof(domain, "www.grammy.com") >= 0 ||*/
			// https://cdn1.thr.com/sites/default/files/imagecache/scale_crop_768_433/2017/08/shot_02_-_warren_solo_00220-h_2017_thr.jpg
			//   https://cdn1.thr.com/sites/default/files/2017/08/shot_02_-_warren_solo_00220-h_2017_thr.jpg
			(domain_nosub === "thr.com" && domain.match(/cdn[0-9]*\.thr\.com/)) ||
			// http://cdnau.ibtimes.com/sites/au.ibtimes.com/files/styles/v2_article_large/public/2016/02/23/kendall-jenner.jpg
			//   http://cdnau.ibtimes.com/sites/au.ibtimes.com/files/2016/02/23/kendall-jenner.jpg
			domain.match(/s[0-9]*\.ibtimes\.com/) ||
			// https://www.standard.co.uk/s3fs-public/styles/hero_tablet/public/thumbnails/image/2014/11/18/15/nickhewer4.jpg
			//   https://www.standard.co.uk/s3fs-public/thumbnails/image/2014/11/18/15/nickhewer4.jpg
			//
			// https://www.standard.co.uk/s3fs-public/image/2014/11/18/15/nickhewer4.jpg
			// is redirected to:
			// http://www.standard.co.uk/s3/files/image/2014/11/18/15/nickhewer4.jpg
			// which is not found
			// but replacing /s3fs-public/ to /s3/files/ doesn't work
			//domain_nowww === "standard.co.uk" ||
			// https://media.pri.org/s3fs-public/styles/story_main/public/story/images/coco-movie.jpg?itok=Uo82G_FI
			//   https://media.pri.org/s3fs-public/story/images/coco-movie.jpg
			src.match(/\/s3fs-public\/styles\/[^/]*\/public\//) ||
			domain === "media.pri.org" ||
			// https://www.wwe.com/f/styles/gallery_img_l/public/all/2018/06/101_Tokyo_06282018hm_2329--f4c8f1052cba83a4a8b3f05905330617.jpg
			domain_nowww === "wwe.com" ||
			// https://akm-img-a-in.tosshub.com/indiatoday/styles/video_landing_page_170_x_127/public/images/photogallery/201807/ambani_party.jpeg?XzEToHYNGMQ8GE4HVzpMci7KFJEe2wYe
			domain === "akm-img-a-in.tosshub.com" ||
			// https://cdn.9razia.de/f/styles/facebook/public/media/gallery/2016-05-26/rihanna_red.jpg
			//   https://cdn.9razia.de/f/media/gallery/2016-05-26/rihanna_red.jpg
			domain === "cdn.9razia.de" ||
			// https://www.bravo.de/assets/styles/teaserimage_200x200/public/field/image/on_gettyimages-521255466.jpg?itok=NwumyGri
			//   https://www.bravo.de/assets/field/image/on_gettyimages-521255466.jpg
			domain_nowww === "bravo.de" ||
			// https://static.reservationvacances.com/reservationvacances/public/styles/mg_thumb_1/public/2018-02/poster-tour-eiffel-jour-nuit.jpg?itok=sVDUxLws
			//   https://static.reservationvacances.com/reservationvacances/public/2018-02/poster-tour-eiffel-jour-nuit.jpg
			domain === "static.reservationvacances.com" ||
			// https://cdn.okmag.de/f/styles/facebook/public/media/gallery/2015/08/06/isabel-lucas.jpg
			//   https://cdn.okmag.de/f/media/gallery/2015/08/06/isabel-lucas.jpg
			domain === "cdn.okmag.de" ||
			// http://www.soganhaber.com/dosyalar/styles/kr_150x150/public/Kisi/K/nm1083271/nm1083271_0.jpg?itok=uYzb0OTH
			//   http://www.soganhaber.com/dosyalar/Kisi/K/nm1083271/nm1083271_0.jpg
			domain_nowww === "soganhaber.com" ||
			// https://favera.ru/img/styles/pin_tmb_2/public/2016/09/11/1368071_1473572524.jpg
			//   https://favera.ru/img/2016/09/11/1368071_1473572524.jpg
			domain_nowww === "favera.ru" ||
			// https://cdn.businessinsider.es/sites/navi.axelspringer.es/public/styles/480/public/media/image/2019/03/Kim%20Jong-Un%2C%20li%CC%81der%20de%20Corea%20del%20Norte.jpg?itok=_Cf23v2r
			//   https://cdn.businessinsider.es/sites/navi.axelspringer.es/public/media/image/2019/03/Kim%20Jong-Un%2C%20li%CC%81der%20de%20Corea%20del%20Norte.jpg
			domain === "cdn.businessinsider.es" ||
			// https://ru-24.ru/_files/styles/origina/public/news/image/pic_5093dfd3fb1ea735b63380a78a3389be.jpg?itok=p5WOiINr
			//   https://ru-24.ru/_files/news/image/pic_5093dfd3fb1ea735b63380a78a3389be.jpg
			(domain_nowww === "ru-24.ru" && string_indexof(src, "/_files/") >= 0) ||
			// https://www.selenagomez.com/sites/g/files/aaj1261/f/styles/suzuki_opengraph/public/news/201710/IMG_2992.jpg.jpeg?itok=R0NVE31p
			//   https://www.selenagomez.com/sites/g/files/aaj1261/f/news/201710/IMG_2992.jpg.jpeg
			(domain_nowww === "selenagomez.com" && string_indexof(src, "/sites/") >= 0) ||
			// https://zizki.com/ien/styles/large/public/comics/kirk-lindo/e866597549.jpg?itok=wZbf5gbB
			//   https://zizki.com/ien/comics/kirk-lindo/e866597549.jpg
			(domain_nowww === "zizki.com" && string_indexof(src, "/styles/") >= 0) ||
			// https://rcf.fr/sites/default/static.rcf.fr/imagecache/vignette_diffusion_small/radios/rcf72/visuels/adastra.jpg
			//   https://rcf.fr/sites/default/static.rcf.fr/radios/rcf72/visuels/adastra.jpg
			(domain_nowww === "rcf.fr" && string_indexof(src, "/sites/") >= 0) ||
			// https://images.pagina12.com.ar/styles/focal_3_2_960x640/public/2020-07/whatsapp-20image-202020-07-03-20at-2013-18-37.jpeg?itok=-X6G-0N_
			//   https://images.pagina12.com.ar/2020-07/whatsapp-20image-202020-07-03-20at-2013-18-37.jpeg
			domain === "images.pagina12.com.ar" ||
			// https://wasliestdu.de/dateien/styles/50x50/public/community/31914/profile/img_1636_4.jpg?itok=nMcZvJlb
			//   https://wasliestdu.de/dateien/community/31914/profile/img_1636_4.jpg
			domain_nowww === "wasliestdu.de" ||
			// thanks to anonymous for reporting:
			// https://projects.balmain.com/assets/styles/330x440/public/2019-07/gesaffelstein.jpg?name=orig
			//   https://projects.balmain.com/assets/2019-07/gesaffelstein.jpg
			(domain === "projects.balmain.com" && string_indexof(src, "/assets/") >= 0) ||
			// thanks to roi:
			// https://images.sportkp.ru/sites/default/files/styles/post_list_thumb_347x271/public/text-images/2022-10/ria_6481437.mr_.1000._1666712142_1666712172.webp
			//   https://images.sportkp.ru/sites/default/files/text-images/2022-10/ria_6481437.mr_.1000._1666712142_1666712172.jpg
			// https://sportkp.ru/sites/default/files/styles/post_list_thumb_347x271/public/text-images/2022-10/ria_6481437.mr_.1000._1666712142_1666712172.webp
			//   https://sportkp.ru/sites/default/files/text-images/2022-10/ria_6481437.mr_.1000._1666712142_1666712172.jpg
			domain_nosub === "sportkp.ru" ||
			// thanks to roi:
			// https://cdn-live.foreignaffairs.com/sites/default/files/styles/_webp_large_2x/public/images/2023/09/05/RTSNCEK8.JPG.webp?itok=yfCfahRC
			//   https://cdn-live.foreignaffairs.com/sites/default/files/images/2023/09/05/RTSNCEK8.JPG
			domain === "cdn-live.foreignaffairs.com" ||
			// thanks to roi:
			// https://negrusty.pro/sites/default/files/styles/post_content_1200xany/public/text-images/2024-04/20141101_gaf_rg15_011_1712662477_1712662561.webp?itok=uva8AgrE
			//   https://negrusty.pro/sites/default/files/text-images/2024-04/20141101_gaf_rg15_011_1712662477_1712662561.jpg
			domain_nowww === "negrusty.pro" ||
			// http://cdn.whodoyouthinkyouaremagazine.com/sites/default/files/imagecache/623px_wide/episode/hewer500.jpg
			//   http://cdn.whodoyouthinkyouaremagazine.com/sites/default/files/episode/hewer500.jpg
			// https://www.telugucinema.com/sites/default/files2/styles/media_gallery_thumbnail/public/amy-jackson-instagram1.jpg?itok=nwFhV2Iy
			//   https://www.telugucinema.com/sites/default/files2/amy-jackson-instagram1.jpg
			src.match(/\/sites\/[^/]*\/files2?\/styles\/[^/]*/) ||
			src.match(/\/sites\/[^/]*\/files2?\/[^/]*\/styles\/[^/]*/) ||
			// https://cdn2.benzinga.com/files/imagecache/1024x768xUP/images/story/2012/rihanna.jpg
			// http://mobile.dlisted.com/files/imagecache/photo-preview-mobile/files/hotslutweeknorwoodyoung.jpg
			//   http://i.dlisted.com/files/hotslutweeknorwoodyoung.jpg
			// http://scd.en.rfi.fr/sites/english.filesrfi/imagecache/aef_ct_wire_image_620/images/afp/7270320fc21023b847f3f7755db401cc5de551bc.jpg
			//   http://scd.en.rfi.fr/sites/english.filesrfi/images/afp/7270320fc21023b847f3f7755db401cc5de551bc.jpg
			// https://cdn.hobbyconsolas.com/sites/navi.axelspringer.es/public/styles/480/public/media/image/2016/06/601572-analisis-mirrors-edge-catalyst-ps4-xbox-one-pc.jpg?itok=6-RQwgNm
			src.match(/(?:(?:\/sites\/+[^/]*)?\/files\/+|\/sites\/+[^/]*\/+)imagecache\/+[^/]*|\/sites\/+[^/]*\/+public\/+styles\/+/) ||
			// http://shakespearestaging.berkeley.edu/system/files/styles/large/private/images/titus-andronicus-the-old-globe-2006-2109.jpg?itok=zmPfmjYs
			src.search(/\/files\/styles\/[^/]*\/(?:public|private)\//) >= 0 ||
			// https://www.straight.com/files/v3/styles/gs_large/public/2013/09/MUS_Nostalghia_2386.jpg
			//   https://www.straight.com/files/v3/2013/09/MUS_Nostalghia_2386.jpg
			src.search(/\/files\/[^/]*\/styles\/[^/]*\/(?:public|private)\//) >= 0) {

			newsrc = src
				.replace(/\/styles\/+.*?\/+(?:public|private)\//, "/")
				.replace(/\/imagecache\/+[^/]*\/+(?:files\/)?/, "/");
			if (newsrc !== src)
				return newsrc;

			newsrc = src.replace(/(\.jpe?g)\.webp([?#].*)?$/i, "$1$2");
			if (newsrc !== src)
				return newsrc;

			newsrc = src.replace(/\.webp([?#].*)?$/, ".jpg$1");
			if (newsrc !== src)
				return newsrc;

			newsrc = src.replace(/\?.*$/, "");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "cdn-img.instyle.com") {
			// https://cdn-img.instyle.com/sites/default/files/styles/594xflex/public/images/2015/04/042015-dakota-fanning-lead_0_0.jpg
			//   https://cdn-img.instyle.com/sites/default/files/images/2015/04/042015-dakota-fanning-lead.jpg
			// https://cdn-img.instyle.com/sites/default/files/images/2015/05/050915-lotd-dakota-fanning_0.jpg
			newsrc = src.replace(/(\/images\/+[0-9]{4}\/+[0-9]{2}\/+[0-9]+-[^/]+)_0(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nowww === "etonline.com" && /\/sites\/+default\/+files\//.test(src)) {
			// https://www.etonline.com/sites/default/files/styles/max_970x546/public/images/2014-11/640_mike_myers_458987658.jpg?itok=Z5VnvwQ1
			// thanks to BlindWanda on github for reporting: https://github.com/qsniyg/maxurl/issues/1311
			// https://www.etonline.com/sites/default/files/images/2020-07/gettyimages-1179647624.jpg?width=640
			//   https://www.etonline.com/sites/default/files/images/2020-07/gettyimages-1179647624.jpg -- 3717x5575
			return {
				url: src.replace(/\?.*/, ""),
				head_wrong_contentlength: true
			};
		}

		if (domain === "diveng.rosselcdn.net") {
			// thanks to anonymous for reporting:
			// https://diveng.rosselcdn.net/sites/default/files/dpistyles_v2/diverto_16_9_749w/2024/04/30/node_14928/26551/public/2024/04/30/hd_anne_morin_ok_11-03-2024-0693-.jpg?itok=MOVKV6-O1714513374
			//   https://diveng.rosselcdn.net/sites/default/files/2024/04/30/hd_anne_morin_ok_11-03-2024-0693-.jpg?itok=MOVKV6-O1714513374
			return src.replace(/(\/sites\/+default\/+files\/).*?\/+public\//, "$1");
		}

		if (domain === "cdn.okmag.de" ||
			// https://cdn.9razia.de/s/fotostrecke__slider/public/media/gallery/2016-05-26/rihanna_red.jpg
			//   https://cdn.9razia.de/media/gallery/2016-05-26/rihanna_red.jpg
			domain === "cdn.9razia.de") {
			// https://cdn.okmag.de/s/article_main/public/media/gallery/2015/08/19/emily-ratajkowski-promotour_good_morning_america.jpg
			//   https://cdn.okmag.de/media/gallery/2015/08/19/emily-ratajkowski-promotour_good_morning_america.jpg
			return src.replace(/(:\/\/[^/]*\/)s\/[^/]*\/public\/(media\/)/, "$1$2");
		}

		if (domain === "img.elcomercio.pe" ||
			// https://img.peru21.pe/files/article_main/uploads/2017/12/02/5a23434bd163c.jpeg
			//   https://img.peru21.pe/uploads/2017/12/02/5a23434bd163c.jpeg
			domain === "img.peru21.pe" ||
			// https://www.elpais.com.co/files/article_graphic_small_inset/uploads/2018/08/06/5b686285870b6.jpeg
			//   https://www.elpais.com.co/uploads/2018/08/06/5b686285870b6.jpeg
			domain_nowww === "elpais.com.co") {
			// https://img.elcomercio.pe/files/article_main/uploads/2018/07/13/5b48b97d53da2.jpeg
			//   https://img.elcomercio.pe/uploads/2018/07/13/5b48b97d53da2.jpeg
			return src.replace(/\/files\/[^/]*\/uploads\//, "/uploads/");
		}

		if (domain === "media.voltron.voanews.com") {
			// https://media.voltron.voanews.com/Drupal/01live-166/styles/sourced/s3/2019-04/E5076B31-4E4E-4435-AD6A-3784CE9C188D.jpg?itok=jV9YimuM
			//   https://media.voltron.voanews.com/Drupal/01live-166/2019-04/E5076B31-4E4E-4435-AD6A-3784CE9C188D.jpg?itok=jV9YimuM
			return src.replace(/\/styles\/+[^/]*\/+s3\/+/, "/");
		}

		if (domain_nowww === "schweizer-illustrierte.ch") {
			// thanks to roi:
			// https://www.schweizer-illustrierte.ch/fp/1155/770/1445/945/sites/default/files/media/field_image/2024-02/imago_images_0397678741.jpg
			//   https://www.schweizer-illustrierte.ch/sites/default/files/media/field_image/2024-02/imago_images_0397678741.jpg
			return src.replace(/\/fp\/+(?:[0-9]+\/+){4}(sites\/+)/, "/$1");
		}

		if (domain_nowww === "trbimg.com") {
			// http://www.trbimg.com/img-53eeca18/turbine/la-1930791-me-adv-street-signs-001-jpg-20140815/700/700x394
			//   https://www.trbimg.com/img-53eeca18/turbine/la-1930791-me-adv-street-signs-001-jpg-20140815/
			return src.replace(/(\/img-[0-9a-f]+\/+[^/]+\/+[^/]+\/+)[0-9]+(?:\/+[0-9]+x[0-9]+\/*)?(?:[?#],*)?$/, "$1");
			//return src.replace(/\/[0-9]*\/[0-9]*x[0-9]*\/*$/, "/").replace(/\/[0-9]*\/*$/, "/");
		}

		if (domain_nosub === "ggpht.com" && /^geo[0-9]*\./.test(domain) && /:\/\/[^/]+\/+(?:cbk|maps\/+photothumb\/+fd\/+v1)\?/.test(src)) {
			// thanks to llacb47 on github for reporting: https://github.com/qsniyg/maxurl/issues/394
			// https://geo1.ggpht.com/cbk?panoid=G27yBPFPohgfkiutzyysbg&output=thumbnail&cb_client=search.gws-prod.gps&thumb=2&w=408&h=240&yaw=108.68918&pitch=0&thumbfov=100
			//   https://geo1.ggpht.com/cbk?panoid=G27yBPFPohgfkiutzyysbg&output=thumbnail&cb_client=search.gws-prod.gps&thumb=2&w=1000&h=588&yaw=108.68918&pitch=0&thumbfov=100
			// https://geo3.ggpht.com/maps/photothumb/fd/v1?bpb=ChEKD3NlYXJjaC5nd3MtcHJvZBJJCjsJaY1X_rEsDogRET7KWKQfP2UaJwsQ04W4QhoeGhwKFgoUChIJaY1X_rEsDogRTWY07U5B9GMSAjVXDCoKDQAAAAAVAAAAABoGCPABEJgD&gl=US
			//   https://geo3.ggpht.com/maps/photothumb/fd/v1?bpb=ChEKD3NlYXJjaC5nd3MtcHJvZBJJCjsJaY1X_rEsDogRET7KWKQfP2UaJwsQ04W4QhoeGhwKFgoUChIJaY1X_rEsDogRTWY07U5B9GMSAjVXDCoKDQAAAAAVAAAAABoGCPABEJgD&gl=US&w=2048&h=1228
			queries = get_queries(src);
			if (queries.panoid || queries.bpb) {
				var w = parse_int(queries.w) || 0;
				var h = parse_int(queries.h) || 0;

				// FIXME: only accurate for photothumb, not cbk
				if (!w && !h) {
					w = 2000;
					h = 1200;
				}

				var largest = Math_max(w, h);
				var smallest = Math_min(w, h);
				var ratio;

				if (!smallest || !largest) {
					ratio = 1;
				} else {
					ratio = largest / smallest;
				}

				var mostlarge = 9999;
				if (!queries.panoid && queries.bpb)
					mostlarge = 2048;

				if (largest < mostlarge) {
					largest = mostlarge;
					smallest = parse_int(largest / ratio);

					if (w > h) {
						queries.w = largest;
						queries.h = smallest;
					} else {
						queries.h = largest;
						queries.w = smallest;
					}

					return add_queries(src, queries);
				}
			}
		}

		if ((/^google\./.test(domain_nosub) || domain_nosub === "googleapis.com") &&
			(/:\/\/[^/]+\/+maps\/+vt\//.test(src) || (/^mts[0-9]*\./.test(domain) && /:\/\/[^/]+\/+vt\//.test(src)))) {
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/394
			// https://www.google.com/maps/vt/data=Leddz2aqp_Mk825wP5mcK9LgV2vB9rrZ-gvvKK-Ugecwh1qQHGzTEEgosor4epP7N6Pe3z-RrkL5-HRw0yd3pLvxHB-MYAVoZKvZosa5pcpSuLl6tGPm3VCJy5EXcUWkIrJoWRteRk88o0FHcAJJA0bT43kNr6lDe8EFLf-zCe8GnQdHl1pCqIOP5FFttLmsi_qxdTEdIf3iW8Q4846B7Ll3d_wt&w=226&h=160
			//   https://www.google.com/maps/vt/data=Leddz2aqp_Mk825wP5mcK9LgV2vB9rrZ-gvvKK-Ugecwh1qQHGzTEEgosor4epP7N6Pe3z-RrkL5-HRw0yd3pLvxHB-MYAVoZKvZosa5pcpSuLl6tGPm3VCJy5EXcUWkIrJoWRteRk88o0FHcAJJA0bT43kNr6lDe8EFLf-zCe8GnQdHl1pCqIOP5FFttLmsi_qxdTEdIf3iW8Q4846B7Ll3d_wt&w=1000&h=1000
			//   https://www.google.com/maps/vt/data=Leddz2aqp_Mk825wP5mcK9LgV2vB9rrZ-gvvKK-Ugecwh1qQHGzTEEgosor4epP7N6Pe3z-RrkL5-HRw0yd3pLvxHB-MYAVoZKvZosa5pcpSuLl6tGPm3VCJy5EXcUWkIrJoWRteRk88o0FHcAJJA0bT43kNr6lDe8EFLf-zCe8GnQdHl1pCqIOP5FFttLmsi_qxdTEdIf3iW8Q4846B7Ll3d_wt&w=1000&h=1000
			// https://github.com/qsniyg/maxurl/issues/398
			// https://mts0.google.com/vt/data=fB930u99vngQ2MCsdPo2oSQoizsXMum6D-4nzuEkr6xUC8IJ1xWkmESiAERYiTpKhSSS6QcRAwmTkm72lD3MPL7zWJcLrtePu22X4U4DfOOVzs17f4plW1s5dJrwvlAavy0kAs9AdRC1aG5rhpZ0q4-bIn2TORZNk5hff1dTImOPXVhCqzcNMcYFNXlcDc2je3nGTRN81lS63ZMlY-yBegOUDA?w=1024&h=199
			//   https://mts0.google.com/vt/data=fB930u99vngQ2MCsdPo2oSQoizsXMum6D-4nzuEkr6xUC8IJ1xWkmESiAERYiTpKhSSS6QcRAwmTkm72lD3MPL7zWJcLrtePu22X4U4DfOOVzs17f4plW1s5dJrwvlAavy0kAs9AdRC1aG5rhpZ0q4-bIn2TORZNk5hff1dTImOPXVhCqzcNMcYFNXlcDc2je3nGTRN81lS63ZMlY-yBegOUDA&w=1024&h=1024
			var queries = get_queries(src.replace(/^[a-z]+:\/\/[^/]+\/+(?:maps\/+)?vt\/+/, "?").replace(/(\?.*)\?/, "$1&"));
			if (queries.data) {
				queries.w = 1024;
				queries.h = 1024;

				newsrc = src.replace(/^([a-z]+:\/\/[^/]+\/+(?:maps\/+)?vt\/+).*/, "$1") + stringify_queries(queries);
				return newsrc;
			}
		}

		if ((domain_nosub === "blogspot.com" && string_indexof(domain, ".bp.blogspot.com") >= 0) ||
			// https://4.bp.blogspot.com/-1ndmEdQX3AM/Tv04FWJ3kTI/AAAAAAAAAzg/P-WNaJRST6Q/s400/Bookworm%2B3.jpg?ssl=1
			//   https://4.bp.blogspot.com/-1ndmEdQX3AM/Tv04FWJ3kTI/AAAAAAAAAzg/P-WNaJRST6Q/s0/Bookworm%2B3.jpg=s0?imgmax=0
			((domain_nosub === "googleusercontent.com" ||
			 // http://lh4.google.com.tw/thorking01/R7p9oIzdBMI/AAAAAAAACDA/wCm5zzbzkVE/s400/Hitomi101.jpg
			  domain_nosub.match(/^google\./)) &&
			  // https://gp3.googleusercontent.com/a/AGF-l79M_XGVECzZZjz0fjvLRQ2F12vPycaGh4QLpKNN=s32-p-no
			  //   https://gp3.googleusercontent.com/a/AGF-l79M_XGVECzZZjz0fjvLRQ2F12vPycaGh4QLpKNN=s0?imgmax=0
			  // https://ci3.googleusercontent.com/proxy/5wDs0lW9VwiJ9VuY3yV6TxZcSB2RQa7HcEWfwi_2elR976_QTHuRO464NJr1plEnsJc25ug3XZs1Xuw7TcVfvp6o-djvrmsHNobTAE13jxqHLm_IcCSl5KV924zY=w530-h300-p
			  //   https://ci3.googleusercontent.com/proxy/5wDs0lW9VwiJ9VuY3yV6TxZcSB2RQa7HcEWfwi_2elR976_QTHuRO464NJr1plEnsJc25ug3XZs1Xuw7TcVfvp6o-djvrmsHNobTAE13jxqHLm_IcCSl5KV924zY=s0?imgmax=0
			  // thanks to Liz on discord:
			  // https://yt3.googleusercontent.com/tSAvF4Jtayiiw8gcSmmvTtKutxrVfWHjy3dWkOnefawD6GSXmMYmQrSXFYeJyFJSuGi0kEg-QQ=w2560-fcrop64=1,00005a57ffffa5a8-k-c0xffffffff-no-nd-rj
			  //   https://yt3.googleusercontent.com/tSAvF4Jtayiiw8gcSmmvTtKutxrVfWHjy3dWkOnefawD6GSXmMYmQrSXFYeJyFJSuGi0kEg-QQ=s0?imgmax=0
			  // https://lh3.googleusercontent.com/qAhRBhfciCcosUoYHPJr5WtNYSJ81vpSqcQwbQitZtsR3mB2aCUj7J5LvhJOCfWn-CWqiLB18SyTr1VJvm_HI7B72opIAMZiZvg=w9999-h9999
			  //   https://lh3.googleusercontent.com/qAhRBhfciCcosUoYHPJr5WtNYSJ81vpSqcQwbQitZtsR3mB2aCUj7J5LvhJOCfWn-CWqiLB18SyTr1VJvm_HI7B72opIAMZiZvg=s0?imgmax=0
			  // https://lh3.googleusercontent.com/j7RWveJMFLh5TNHWRRvQnTpwFF3Xzz-mZd8ff-2PmKGIycRxZkUaOmf14g7wIj7D5x2ci1d6DbstteRtb9GN5OXF6ozB32KIY0HUtXFKnN48A1DaxnV-7Nk3YoGbI5ITVJiHA6HyN1cGo_djsw
			  //   https://lh3.googleusercontent.com/j7RWveJMFLh5TNHWRRvQnTpwFF3Xzz-mZd8ff-2PmKGIycRxZkUaOmf14g7wIj7D5x2ci1d6DbstteRtb9GN5OXF6ozB32KIY0HUtXFKnN48A1DaxnV-7Nk3YoGbI5ITVJiHA6HyN1cGo_djsw=s0?imgmax=0
			  // https://lh3.googleusercontent.com/C6yBYozE1sXc9o_jsrh29_AYQ6ffCKO-fpooQ5nwuu7FSgQvdGtfSbcJVBUGSDi1VXE9TqYT2g=s0?imgmax=s0 -- "imgmax=s0"
			  // thanks to anonymous for reporting:
			  // https://lh7-us.googleusercontent.com/u/0/sheets/ACTFsxTil-YVOtdlIVAIK2xh_cxcZ2tDwFCvabS7in3gaiH-OMjxZ9EHU3mv9AZ_0oXRj3NzXtZBRvzBbuLW-LWu2jSFKQdwWkX3J_3lvCzB0OEwmkM0VZv5vF7QXJb_u8ySiMMFmJ0xYU-Tz1BZjfzqwF8JdtmUpYS316sB5TXNxskakfzMFCXpM_1a3ekMS2X51MS2ytIQO7s1NAj3dsDFDCTWxBtUHLK3tMINr_SrewtFw3eiaBDqsh4aI3KHxfmFT3xsx3yS_9dvZ0cGfinRCSnTwOIQep4aZTuVQ7hfp8aYoXx2tLU4sV-Sv2CKayEgfmublclXitGpV84p7i4dW4Kpi5-BMzK-iT8L0MzInR1KswrwvqHHXClXReu458QJ1Ju5EJvcuAjWHZqKnp1K1Spt4zRlqhleYnO4f4taUjSEbMHDe5ZdnLl9APKDET9Zgy6dya_eLACOh6So1H2SX3Ix4Q5lke97HAxd1Wx3VddzBh2Lw3Im0Pte-Pl4H4yJvGh_u_f8DY6i262mfNkz5HyDLn_QGv7DbpTo6QkPgrovpMSQM2Ef9CPx5vDGb0lMz1Siw8WzXl7bGfMYHMcmXgP-w5hZpTOo7ctIsF1Nri3Kx-Qgg-5Ks2tmq75KrSddgTiHmHV0_Fmt_UT8CXhmwHWq_BCTEXcuwOB00GOlAZv-T8gVMMaieniVAP6G1zhIK3dVDLn-OP41aEj0BrTcuNuSIK2Ae-3L4L_n22sjr6LvpBMAq_I7o8NrHFvvh_GJweZbBbjZhyjGH2AahFUqaxiN7uwab---y-l3Fb52PVpjFFpC2LRyNIpDb_YE03TJjV9EqSw8m4oG6aBLZcV2Z5tExRefpRJ0q-47NpqTTHdQv_9E73JBwmcIgcjXRjKvPIkrwphqPThaek9s1LaDamLTQJtN-liZ_FG0Xa_BligOSrMV94qaMa6Q_nNHdClnFIKNvsntnpzhCdNhrsAXWT3sB6CyT4yyRTC4pKhgCHdj5v6E1Eg50TUpNtdOQmb8MnD9c-lLq3jTgjwrT-LJtLbOTkuIefempXm22CRBdZ_ut1Yh8FaQxoW9ncn96tYJH1_R_CdfI4Vug2-0ePjL4Ti1n_rZtn2p-x2bMgypz9vMaYGQVVfcQTysF9k3X82s55cNSuz7hl4sGsWRDL0d9Q=w340-h339
			  //   https://lh7-us.googleusercontent.com/u/0/sheets/ACTFsxTil-YVOtdlIVAIK2xh_cxcZ2tDwFCvabS7in3gaiH-OMjxZ9EHU3mv9AZ_0oXRj3NzXtZBRvzBbuLW-LWu2jSFKQdwWkX3J_3lvCzB0OEwmkM0VZv5vF7QXJb_u8ySiMMFmJ0xYU-Tz1BZjfzqwF8JdtmUpYS316sB5TXNxskakfzMFCXpM_1a3ekMS2X51MS2ytIQO7s1NAj3dsDFDCTWxBtUHLK3tMINr_SrewtFw3eiaBDqsh4aI3KHxfmFT3xsx3yS_9dvZ0cGfinRCSnTwOIQep4aZTuVQ7hfp8aYoXx2tLU4sV-Sv2CKayEgfmublclXitGpV84p7i4dW4Kpi5-BMzK-iT8L0MzInR1KswrwvqHHXClXReu458QJ1Ju5EJvcuAjWHZqKnp1K1Spt4zRlqhleYnO4f4taUjSEbMHDe5ZdnLl9APKDET9Zgy6dya_eLACOh6So1H2SX3Ix4Q5lke97HAxd1Wx3VddzBh2Lw3Im0Pte-Pl4H4yJvGh_u_f8DY6i262mfNkz5HyDLn_QGv7DbpTo6QkPgrovpMSQM2Ef9CPx5vDGb0lMz1Siw8WzXl7bGfMYHMcmXgP-w5hZpTOo7ctIsF1Nri3Kx-Qgg-5Ks2tmq75KrSddgTiHmHV0_Fmt_UT8CXhmwHWq_BCTEXcuwOB00GOlAZv-T8gVMMaieniVAP6G1zhIK3dVDLn-OP41aEj0BrTcuNuSIK2Ae-3L4L_n22sjr6LvpBMAq_I7o8NrHFvvh_GJweZbBbjZhyjGH2AahFUqaxiN7uwab---y-l3Fb52PVpjFFpC2LRyNIpDb_YE03TJjV9EqSw8m4oG6aBLZcV2Z5tExRefpRJ0q-47NpqTTHdQv_9E73JBwmcIgcjXRjKvPIkrwphqPThaek9s1LaDamLTQJtN-liZ_FG0Xa_BligOSrMV94qaMa6Q_nNHdClnFIKNvsntnpzhCdNhrsAXWT3sB6CyT4yyRTC4pKhgCHdj5v6E1Eg50TUpNtdOQmb8MnD9c-lLq3jTgjwrT-LJtLbOTkuIefempXm22CRBdZ_ut1Yh8FaQxoW9ncn96tYJH1_R_CdfI4Vug2-0ePjL4Ti1n_rZtn2p-x2bMgypz9vMaYGQVVfcQTysF9k3X82s55cNSuz7hl4sGsWRDL0d9Q=s0?imgmax=0
			  (/^(?:yt|ci|lh|gp)[0-9](?:-[a-z]{2})?\./.test(domain) ||
			  // thanks to Elliot Alderson on discord for reporting
			  // https://play-lh.googleusercontent.com/DfAVURLgv0F8OZxFds3vLqd6o7dW9hbe9AUPgvVi4kzY5qb7Y-VRitHYA8_9W8edidI=w1440-h620-rw
			  //   https://play-lh.googleusercontent.com/DfAVURLgv0F8OZxFds3vLqd6o7dW9hbe9AUPgvVi4kzY5qb7Y-VRitHYA8_9W8edidI=s0?imgmax=0
			  /^play-lh\./.test(domain))) ||
			// https://d2yal1mtmg1ts6.cloudfront.net/iFkddP_wLWySXrHXQ9oDom9utMCj3_9wsPjLcT3mipityCgMxnuspjAL5mejAeAQFA=h350-r
			//   https://d2yal1mtmg1ts6.cloudfront.net/iFkddP_wLWySXrHXQ9oDom9utMCj3_9wsPjLcT3mipityCgMxnuspjAL5mejAeAQFA=s0?imgmax=0
			// https://d2yal1mtmg1ts6.cloudfront.net/iFkddP_wLWySXrHXQ9oDom9utMCj3_9wsPjLcT3mipityCgMxnuspjAL5mejAeAQFA=g -- works, but is useless (s0 works fine)
			// <TileInfo tile_width="512" tile_height="512" full_pyramid_depth="2" origin="TOP_LEFT" tiler_version_number="2" image_width="608" image_height="789">
			//   <pyramid_level num_tiles_x="1" num_tiles_y="1" inverse_scale="2" empty_pels_x="208" empty_pels_y="118"/>
			//   <pyramid_level num_tiles_x="2" num_tiles_y="2" inverse_scale="1" empty_pels_x="416" empty_pels_y="235"/>
			// </TileInfo>
			domain === "d2yal1mtmg1ts6.cloudfront.net" ||
			// https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsRNY0yzBfyRCGarneaRv62ByU0b1SFbzyEB_GcL58erRz8ER4T7rhxjEjFmOiWPPrLWKm1KrqPjoAlkd60sA3XRE9q2WMLgVO7HmerF2Rff6yh1l6MEwoBPbVBi5QjoI4KK_hRx9rcZwQyOuS62wMZo-lOkdyYKb2LIhCptfd3fv8MtFU4IH5yMZDTQ/s1600/Shoppy%20Blogger%20Template.jpg
			//   https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsRNY0yzBfyRCGarneaRv62ByU0b1SFbzyEB_GcL58erRz8ER4T7rhxjEjFmOiWPPrLWKm1KrqPjoAlkd60sA3XRE9q2WMLgVO7HmerF2Rff6yh1l6MEwoBPbVBi5QjoI4KK_hRx9rcZwQyOuS62wMZo-lOkdyYKb2LIhCptfd3fv8MtFU4IH5yMZDTQ/s0/Shoppy%20Blogger%20Template.jpg=s0?imgmax=0
			domain === "blogger.googleusercontent.com" ||
			// thanks to liraqb on github: https://github.com/qsniyg/maxurl/issues/337
			// https://apps.qoo-app.com/app/6681
			// https://d2jcw5q7j4vmo4.cloudfront.net/tJs6xu-sNx4SH9Dz7uaH_YAKfAko6F8r30U4v6Q_S-TS-cFlSmK_D472yK4sNMbt=w720-h310
			//   https://d2jcw5q7j4vmo4.cloudfront.net/tJs6xu-sNx4SH9Dz7uaH_YAKfAko6F8r30U4v6Q_S-TS-cFlSmK_D472yK4sNMbt=s0?imgmax=0
			domain === "d2jcw5q7j4vmo4.cloudfront.net" ||
			// http://bp0.blogger.com/_sBBi-c1S7gU/SD5OZiDWDnI/AAAAAAAAFNc/3-cwL7frca0/s400/Copy+of+milla-jovovich-2.jpg
			//   https://1.bp.blogspot.com/_sBBi-c1S7gU/SD5OZiDWDnI/AAAAAAAAFNc/3-cwL7frca0/s0/Copy+of+milla-jovovich-2.jpg=s0?imgmax=0
			// https://1.bp.blogspot.com/_sBBi-c1S7gU/SD5OZiDWDnI/AAAAAAAAFNc/3-cwL7frca0/s0/Copy+of+milla-jovovich-2.jpg=s0?imgmax=0
			(domain_nosub === "blogger.com" && domain.match(/^bp[0-9]*\.blogger\.com/)) ||
			// thanks to Froktime on github: https://github.com/qsniyg/maxurl/issues/1356
			domain === "drive.google.com" ||
			// thanks to Froktime on github: https://github.com/qsniyg/maxurl/issues/1332
			// https://drive.fife.usercontent.google.com/u/0/d/1E-2OSeKmUH1TU0aHXNncrGJltXky2VjR=w300-h285-p-k-rw-v1-nu-iv1
			//   https://drive.fife.usercontent.google.com/u/0/d/1E-2OSeKmUH1TU0aHXNncrGJltXky2VjR=s0?imgmax=0
			domain === "drive.fife.usercontent.google.com" ||
			// http://lh4.ggpht.com/__zoKJ77EvEc/TO-9wdVTcwI/AAAAAAAAJEA/SbyR-4a03S0/dekotora%20%289%29%5B2%5D.jpg?imgmax=800 -- larger than s0?
			//   http://lh4.ggpht.com/__zoKJ77EvEc/TO-9wdVTcwI/AAAAAAAAJEA/SbyR-4a03S0/dekotora%20%289%29%5B2%5D.jpg=s0?imgmax=0 -- same size
			// note: some photos are larger:
			// https://artsandculture.google.com/story/7QXBu-CU26X6QQ
			// https://lh5.ggpht.com/NkeM5HB7f2PzAWBRYu3RIILrAWWd4b6OgXcu-YK1LQxo9CwEmQfYCW0=g -- info:
			// <TileInfo tile_width="512" tile_height="512" full_pyramid_depth="5" origin="TOP_LEFT" timestamp="1586660947">
			//   <pyramid_level num_tiles_x="1" num_tiles_y="1" inverse_scale="16" empty_pels_x="322" empty_pels_y="235"/>
			//   <pyramid_level num_tiles_x="1" num_tiles_y="2" inverse_scale="8" empty_pels_x="131" empty_pels_y="470"/>
			//   <pyramid_level num_tiles_x="2" num_tiles_y="3" inverse_scale="4" empty_pels_x="261" empty_pels_y="428"/>
			//   <pyramid_level num_tiles_x="3" num_tiles_y="5" inverse_scale="2" empty_pels_x="9" empty_pels_y="343"/>
			//   <pyramid_level num_tiles_x="6" num_tiles_y="9" inverse_scale="1" empty_pels_x="18" empty_pels_y="174"/>
			// </TileInfo>
			// https://lh5.ggpht.com/NkeM5HB7f2PzAWBRYu3RIILrAWWd4b6OgXcu-YK1LQxo9CwEmQfYCW0=x0-y0-z0-t7_0zmtlXxvVN0a4cAsXJYDTVVDQ -- z is probably scale
			// https://lh5.ggpht.com/NkeM5HB7f2PzAWBRYu3RIILrAWWd4b6OgXcu-YK1LQxo9CwEmQfYCW0=x0-y0-z3-tG0EfYTE65CyvDZ5cX04k_8Slzak -- tile
			// https://lh5.ggpht.com/NkeM5HB7f2PzAWBRYu3RIILrAWWd4b6OgXcu-YK1LQxo9CwEmQfYCW0=x0-y1-z3-tae2UpBVjU2LkaZkmKQ3cWmTh8s8
			// https://lh5.ggpht.com/NkeM5HB7f2PzAWBRYu3RIILrAWWd4b6OgXcu-YK1LQxo9CwEmQfYCW0=x0-y2-z3-tBm23v_61ZEIChggQIOBypI8K7ps
			// https://lh5.ggpht.com/NkeM5HB7f2PzAWBRYu3RIILrAWWd4b6OgXcu-YK1LQxo9CwEmQfYCW0=x1-y0-z3-tYmeZ7gkPsTX0jJmNIXbA0rTgb0c
			// https://lh5.ggpht.com/NkeM5HB7f2PzAWBRYu3RIILrAWWd4b6OgXcu-YK1LQxo9CwEmQfYCW0=x1-y1-z3-t0140arxvbW8b2H3DxDiSzTT3ur0
			// https://lh5.ggpht.com/NkeM5HB7f2PzAWBRYu3RIILrAWWd4b6OgXcu-YK1LQxo9CwEmQfYCW0=x1-y2-z3-tzl9N9fOYsFgBpAA1GNxr_C_k6o0
			// https://lh5.ggpht.com/NkeM5HB7f2PzAWBRYu3RIILrAWWd4b6OgXcu-YK1LQxo9CwEmQfYCW0=x2-y0-z3-thNBg5c4zX46kL6erYiaboGKSGuk
			// https://lh5.ggpht.com/NkeM5HB7f2PzAWBRYu3RIILrAWWd4b6OgXcu-YK1LQxo9CwEmQfYCW0=x2-y1-z3-tOGOP3ky1HKwBr_nipLx6Giu_414
			// https://lh5.ggpht.com/NkeM5HB7f2PzAWBRYu3RIILrAWWd4b6OgXcu-YK1LQxo9CwEmQfYCW0=x2-y2-z3-tVsoWKC9bk2FYVafDH8ra_7zACos
			// it can go even deeper:
			// https://lh5.ggpht.com/NkeM5HB7f2PzAWBRYu3RIILrAWWd4b6OgXcu-YK1LQxo9CwEmQfYCW0=x4-y6-z4-tV5JRod2CcCsS1Kwd35hFVBhxKvk
			// https://lh5.ggpht.com/NkeM5HB7f2PzAWBRYu3RIILrAWWd4b6OgXcu-YK1LQxo9CwEmQfYCW0=x5-y7-z4-t_LbLZkj4U_KTySghTdk0xE_IGzc
			// https://lh5.ggpht.com/NkeM5HB7f2PzAWBRYu3RIILrAWWd4b6OgXcu-YK1LQxo9CwEmQfYCW0=s2000 -- same size as s0 (353x512), can be downscaled, but not upscaled
			domain_nosub === "ggpht.com") {
			newsrc = src;

			if (!(/^[a-z]+:\/\/[^/]+\/+[^/?#=]{30,}=x[0-9]+-y[0-9]+-z[0-9]+-t[^-/?#]{23,}(?:[?#].*)?$/.test(src))) {
				newsrc = src
					.replace(/#.*$/, "")
					.replace(/\?.*$/, "")
					.replace(/\/[swh][0-9]*(-[^/]*]*)?\/([^/]*)$/, "/s0/$2")
					.replace(/(=[^/]*)?$/, "=s0?imgmax=0");
			}

			return {
				url: newsrc,
				can_head: false // 404
			};
		}

		if (domain === "ssl.gstatic.com") {
			// https://ssl.gstatic.com/docs/common/material_common_sprite157_grey_medium.svg
			if (/\/docs\/+common\/+[^/]+\.svg(?:[?#].*)?$/.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}
		}

		if (/^google\./.test(domain_nosub) && /^books\./.test(domain)) {
			// thanks to anonymous for reporting
			// https://books.google.fr/books/publisher/content?id=YkMxBwAAQBAJ&pg=PR1&img=1&zoom=3&hl=en&sig=ACfU3U2tu2D5dAIbMqQ62QGFFHDGvTS_XA
			// https://books.google.fr/books/publisher/content?id=YkMxBwAAQBAJ&pg=PR1&img=1&zoom=3&hl=en&sig=ACfU3U2tu2D5dAIbMqQ62QGFFHDGvTS_XA&w=100
			//   https://books.google.fr/books/publisher/content?id=YkMxBwAAQBAJ&pg=PR1&img=1&zoom=3&hl=en&sig=ACfU3U2tu2D5dAIbMqQ62QGFFHDGvTS_XA&w=99999 -- 2032x2500
			// https://books.google.fr/books/publisher/content?id=YkMxBwAAQBAJ&printsec=frontcover&img=1&zoom=5&edge=curl&imgtk=AFLRE721XZ6lPeoWODQwWBsQLnWqf4Ig8Y7xnADVM56YtCv7PUJgzLmvkSv4XrQqiiA6E2sb2opLEs30tJolfMzPC7TG7xA8LBSpM0h76WdSwfmxj5WF5KK2KsP83lTfnuiI8lnuFg_G&w=99999 -- 1992x2500, upscaled
			// thanks to eightyy8 on github: https://github.com/qsniyg/maxurl/issues/1144
			// https://books.google.com/books/content?id=1kbG47pDHG4C&printsec=frontcover&img=1&zoom=1&edge=curl&imgtk=Aflre71czgapxhuindxku68lr68xivjhgbzra9zjnf5zhh2xfx1jrxrty3q2w-ebrz5ucnodada29rulgxzrxtg8a0jlleq_qxhiffsddmavimb77darndec-o9naxv8vehbfxa55x3-
			//   https://books.google.com/books/content?id=1kbG47pDHG4C&printsec=frontcover&img=1&zoom=1&w=99999 -- 1900x2500
			//   https://books.google.com/books/content?id=1kbG47pDHG4C&printsec=frontcover&img=1&zoom=1&h=99999 -- 1900x2500
			//   https://books.google.com/books/content?id=1kbG47pDHG4C&printsec=frontcover&img=0&zoom=0&h=99999 -- 1900x2500
			//   https://books.google.com/books/content?id=1kbG47pDHG4C&printsec=frontcover&img=0&zoom=0 -- 2201x2896
			if (/\/books\/+(?:publisher\/+)?content\?/.test(src)) {
				let urls = [];

				newsrc = remove_queries(add_queries(src, {w: "99999"}), ["h", "imgtk", "edge"]);
				if (newsrc !== src) {
					urls.push({
						url: newsrc,
						problems: {
							possibly_upscaled: true
						}
					});
				}

				if (!/[?&]sig=/.test(src)) {
					urls.unshift(remove_queries(add_queries(src, {img: "0", zoom: "0"}), ["w", "h", "imgtk", "edge"]));
				}

				if (urls.length)
					return urls;
			}
		}

		if (host_domain === "docs.google.com" && options.element) {
			if (options.element.tagName.toUpperCase() === "SVG" && options.element.classList.contains("kix-embeddedobject-image")) {
				var images = options.element.getElementsByTagName("image");
				if (images.length === 1) {
					newsrc = images[0].getAttribute("xlink:href");
					if (newsrc && newsrc !== src)
						return newsrc;
				}
			}
		}

		if (domain === "gimg.quizlet.com") {
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/549
			// https://gimg.quizlet.com/a-/AOh14GgY786zMOL8uFswlEBNT3kyqGM2Zmi57PEp9lxwiQ?sz=48
			//   https://lh3.googleusercontent.com/a-/AOh14GgY786zMOL8uFswlEBNT3kyqGM2Zmi57PEp9lxwiQ=s0?imgmax=0
			// https://gimg.quizlet.com/-kQudKumKZVc/AAAAAAAAAAI/AAAAAAAAAAA/AMZuucmfoxWZRRGdjq07juSAXKtKuZ_uow/photo.jpg?sz=48
			//   https://lh3.googleusercontent.com/-kQudKumKZVc/AAAAAAAAAAI/AAAAAAAAAAA/AMZuucmfoxWZRRGdjq07juSAXKtKuZ_uow/photo.jpg=s0?imgmax=0
			// https://gimg.quizlet.com/a-/AOh14GgMqQYnhmbKr94I6XZNto0r2ZTZ1md7lz0hpICmBw=s96-c?sz=48
			//   https://lh3.googleusercontent.com/a-/AOh14GgMqQYnhmbKr94I6XZNto0r2ZTZ1md7lz0hpICmBw=s0?imgmax=0
			// https://gimg.quizlet.com/a-/AOh14GjkJ7PECItpFbj1_vNUR6tPEs7Rv-Eu8far92A8=s96-c?sz=48
			//   https://lh3.googleusercontent.com/a-/AOh14GjkJ7PECItpFbj1_vNUR6tPEs7Rv-Eu8far92A8=s0?imgmax=0
			// https://gimg.quizlet.com/a-/AOh14Gj4vniFQ6t0uvOMd3uipvyy4hMazk3nNqVb1C_D=s96-c?sz=24
			//   https://lh3.googleusercontent.com/a-/AOh14Gj4vniFQ6t0uvOMd3uipvyy4hMazk3nNqVb1C_D=s0?imgmax=0
			// https://gimg.quizlet.com/-YU-C4l8AAU8/AAAAAAAAAAI/AAAAAAAAAAA/AMZuuclAhqEyzYJwgRfjbeCKmDxni2Xd4w/photo.jpg?sz=24
			//   https://lh3.googleusercontent.com/-YU-C4l8AAU8/AAAAAAAAAAI/AAAAAAAAAAA/AMZuuclAhqEyzYJwgRfjbeCKmDxni2Xd4w/photo.jpg=s0?imgmax=0
			return src.replace(/^[a-z]+:\/\/[^/]+\/+((?:a-|-[-A-Za-z0-9]+)\/.*)/, "https://lh3.googleusercontent.com/$1");
		}

		if (domain_nowww === "star-tool.ru") {
			// https://star-tool.ru/-IqS0oUzPD8E/V3aAbr--0FI/AAAAAAAAD44/p1gVF4jSTSs5vu_w30KE6C-9SpkNiyWmQCLcB/s200/036-9oBtltvbsT8.jpg
			//   https://lh3.googleusercontent.com/-IqS0oUzPD8E/V3aAbr--0FI/AAAAAAAAD44/p1gVF4jSTSs5vu_w30KE6C-9SpkNiyWmQCLcB/s0/036-9oBtltvbsT8.jpg=s0?imgmax=0
			// this rule could probably be improved
			return src.replace(/^[a-z]+:\/\/[^/]+\/+([^/]+\/+[^/]+\/+[^/]+\/+[^/]+\/+[swh][0-9]*(?:-[^/]*]*)?\/+)/, "https://lh3.googleusercontent.com/$1");
		}

		if (domain_nowww === "thehackernews.com") {
			// https://thehackernews.com/images/-yEdv4-r_GCU/XoWjJRMXVeI/AAAAAAAA2nc/z1aSxCSBjJQ1ooqCHbvx7Y4vpNVTkl6cgCLcBGAsYHQ/s72-c-e100/zoom-hacking.jpg
			//   https://1.bp.blogspot.com/-yEdv4-r_GCU/XoWjJRMXVeI/AAAAAAAA2nc/z1aSxCSBjJQ1ooqCHbvx7Y4vpNVTkl6cgCLcBGAsYHQ/s0/zoom-hacking.jpg=s0?imgmax=0
			return src.replace(/^[a-z]+:\/\/[^/]+\/+images\/+((?:[^/]+\/+){4}[^/]+\/+[^/]+)(?:[?#].*)?$/, "https://1.bp.blogspot.com/$1");
		}

		if (domain_nosub === "googleusercontent.com" &&
			string_indexof(domain, "opensocial.googleusercontent.com") >= 0) {
			// https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F1.bp.blogspot.com%2F-jdpU1PhmEgg%2FU2lBLnp50QI%2FAAAAAAAAChs%2FUu01Lvq-2xc%2Fs1600%2Frihanna%2Bmccartney.jpg&container=blogger&gadget=a&rewriteMime=image%2F*
			//   http://1.bp.blogspot.com/-jdpU1PhmEgg/U2lBLnp50QI/AAAAAAAAChs/Uu01Lvq-2xc/s1600/rihanna+mccartney.jpg
			// http://images1-focus-opensocial.googleusercontent.com/gadgets/proxy?container=focus&gadget=a&no_expand=1&resize_w=0&rewriteMime=image/*&url=http%3A%2F%2Fs5.mgimgcdn.com%2Fmangakakalot%2Fb1%2Fblack_rock_shooter_innocent_soul%2Fchapter_1%2F49.jpg
			//   http://s5.mgimgcdn.com/mangakakalot/b1/black_rock_shooter_innocent_soul/chapter_1/49.jpg
			return decodeURIComponent(src.replace(/^[a-z]+:\/\/[^/]*\/gadgets\/proxy.*?[?&]url=([^&]*).*?$/, "$1"));
		}

		// replaced by thumbor rule
		/*if (false && domain === "images.thestar.com") {
			// https://images.thestar.com/-ZOPF3_-dhsPDK5diZsl7k2AWyE=/1086x724/smart/filters:cb(1533380883140)/https://www.thestar.com/content/dam/thestar/opinion/contributors/2018/08/02/mall-is-wrong-about-use-of-captured-images/rpjeatoncameras04.jpg
			//   https://www.thestar.com/content/dam/thestar/opinion/contributors/2018/08/02/mall-is-wrong-about-use-of-captured-images/rpjeatoncameras04.jpg
			newsrc = src.replace(/(\/[^/.]*\.[^/.]*)\.[^/]*$/, "$1");
			if (newsrc !== src)
				return newsrc;
		}*/

		if (domain === "cdn.narcity.com" ||
			// https://www.narcity.com/u/2018/01/11/e4b085930cc3bcc2a07ebab04580eadd81a0c6e0.jpg_1200x630.jpg
			//   https://www.narcity.com/u/2018/01/11/e4b085930cc3bcc2a07ebab04580eadd81a0c6e0.jpg
			domain_nowww === "narcity.com") {
			// https://cdn.narcity.com/uploads/288430_2f9bf6228fb968d30f49e19268da5c3719d76d74.jpg_facebook.jpg -- stretched?
			//   https://cdn.narcity.com/uploads/288430_2f9bf6228fb968d30f49e19268da5c3719d76d74.jpg
			// https://cdn.narcity.com/u/2018/01/24/a84af3e5ab19eb3af3688b2e4ec6f768801df3fc.jpg_1200x630.jpg
			//   https://cdn.narcity.com/u/2018/01/24/a84af3e5ab19eb3af3688b2e4ec6f768801df3fc.jpg
			// nano defender blocks js, need website to test
			return src.replace(/(\/[^/.]*\.[^/._]+)_(?:facebook|[0-9]+x[0-9]+)\.[^/.]*(?:[?#].*)?$/, "$1");
		}

		if (domain === "images.vanityfair.it" ||
			// https://images.glamour.it/gallery/64001/Mid/c8962608-9e0f-432c-8a31-17f24b645e7f.jpg
			//   https://images.glamour.it/gallery/64001/Original/c8962608-9e0f-432c-8a31-17f24b645e7f.jpg
			domain === "images.glamour.it") {
			// https://images.vanityfair.it/gallery/92363/Mid/190f628a-c665-4b01-a73d-5a230ad8b3b6.jpg
			//   https://images.vanityfair.it/gallery/92363/Original/190f628a-c665-4b01-a73d-5a230ad8b3b6.jpg
			return src.replace(/(\/gallery\/[0-9]*\/)[^/]*\//, "$1Original/");
		}

		if (domain_nosub === "r29static.com" ||
			// https://static2.refinery29.com/bin/entry/253/x,80/1173580/1janmain.jpg
			//   https://static2.refinery29.com/bin/entry/253/x,100/1173580/1janmain.jpg
			(domain_nosub === "refinery29.com" && domain.match(/^static[0-9]*\./))) {
			// http://s1.r29static.com//bin/entry/812/0,12,460,552/0x864,80/1207816/image.jpg -- stretched
			//   https://s1.r29static.com//bin/entry/812/x,100/1207816/image.jpg
			// https://s1.r29static.com//bin/public/e32/0,0,2000,2400/720x864,80/1573061/image.jpg
			//   https://s1.r29static.com//bin/entry/e32/x,100/1573061/image.jpg
			//   https://s1.r29static.com//bin/public/e32/x,100/1573061/image.jpg
			// https://s1.r29static.com//bin/entry/a34/340x408,80/1970977/image.jpg
			//   https://s1.r29static.com//bin/entry/a34/x,100/1970977/image.jpg
			// https://s2.r29static.com//bin/author/f58/75x75,85/1320357/image.webp
			//   https://s2.r29static.com//bin/author/f58/x,100/1320357/image.webp
			// 0x0,100 and x,100 both work
			// other: https://www.refinery29.com/images/8499155.jpg?format=webp&width=720&height=864&quality=85
			return src.replace(/(\/bin\/(?:entry|public|author)\/[^/]*)\/(?:[0-9]+,[0-9]+,[0-9]+,[0-9]+\/)?[^/]*(?:,[^/]*)?\/([^,]*)$/, "$1/x,100/$2");
		}

		if (domain === "img.huffingtonpost.com") {
			// http://img.huffingtonpost.com/asset/5936853f2200003d00c6c785.png
			// http://img.huffingtonpost.com/asset/5a6b56b02d00004900942e4e.jpeg
			return src
			// http://img.huffingtonpost.com//asset/scaleFit_630_noupscale/55a658581200002b001348b0.jpeg
			//   http://img.huffingtonpost.com//asset/55a658581200002b001348b0.jpeg
				.replace(/\/asset\/[^/]*\/([^/.]*\.[^/.]*)$/, "/asset/$1")
			// https://img.huffingtonpost.com/asset/5b670cbb2000009f00378f9a.jpeg?cache=aklfxnevww&ops=1910_1000
			//   https://img.huffingtonpost.com/asset/5b670cbb2000009f00378f9a.jpeg
				.replace(/\?[^/]*$/, "");
		}

		if (domain === "images.huffingtonpost.com" ||
			// http://www.kisax.com/images/Samantha-Mumba/Samantha-Mumba-3-thumb.JPG
			//   http://www.kisax.com/images/Samantha-Mumba/Samantha-Mumba-3.JPG
			(domain_nowww === "kisax.com" && string_indexof(src, "/images/") >= 0) ||
			// https://i2.nicepik.com/files/576/225/299/alberta-aspen-autumn-canada-thumb.jpg
			//   https://i2.nicepik.com/files/576/225/299/alberta-aspen-autumn-canada.jpg
			(domain_nosub === "nicepik.com" && domain.match(/^i[0-9]*\./) && string_indexof(src, "/files/") >= 0) ||
			// https://c7.uihere.com/files/103/496/983/bella-thorne-autumn-falls-actor-fashion-is-my-kryptonite-photography-actor-thumb.jpg
			//   https://c7.uihere.com/files/103/496/983/bella-thorne-autumn-falls-actor-fashion-is-my-kryptonite-photography-actor.jpg
			(domain_nosub === "uihere.com" && domain.match(/^c[0-9]*\./) && string_indexof(src, "/files/") >= 0) ||
			// https://babylonbee.com/img/articles/article-4919-1-thumb.jpg
			//   https://babylonbee.com/img/articles/article-4919-1.jpg
			(domain_nowww === "babylonbee.com" && /\/img\/+articles\//.test(src)) ||
			// http://www.womansdiary.gr/articles/1686/774bb14b-4d63-4969-adc4-06322e6b852f-thumb.jpg
			//   http://www.womansdiary.gr/articles/1686/774bb14b-4d63-4969-adc4-06322e6b852f.jpg
			(domain_nowww === "womansdiary.gr" && src.match(/\/articles\/[0-9]+\/[-0-9a-f]+-thumb/))) {
			// https://images.huffingtonpost.com/2015-12-15-1450212883-2879887-356670f8740946d741c648b23_villarufologardensravellocampaniaitalycrgetty-thumb.jpg
			//   https://images.huffingtonpost.com/2015-12-15-1450212883-2879887-356670f8740946d741c648b23_villarufologardensravellocampaniaitalycrgetty.jpg
			return src.replace(/-thumb(\.[^/.]*)$/, "$1");
		}

		if (domain === "i.huffpost.com" ||
			domain === "s-i.huffpost.com") {
			// https://i.huffpost.com/gen/1557988/thumbs/o-EMMA-570.jpg
			// https://i.huffpost.com/gen/1557988/images/o-EMMA-570.jpg
			// https://i.huffpost.com/gen/3142438/images/o-LORD-SUGAR-570.jpg
			// https://i.huffpost.com/gen/4681756/thumbs/o-601718112-900.jpg
			// https://i.huffpost.com/gen/4681864/thumbs/o-601718288-900.jpg?2
			// https://s-i.huffpost.com/gen/4681864/original.jpg
			// https://i.huffpost.com/gen/3217980/images/n-JAZMIN-GRACE-GRIMALDI-628x314.jpg
			// https://i.huffpost.com/gen/816377/original.jpg

			// http://i.huffpost.com/gadgets/slideshows/331487/slide_331487_3313386_free.jpg
			// http://i.huffpost.com/gadgets/slideshows/331487/slide_331487_3313616_free.jpg
			// http://i.huffpost.com/gadgets/slideshows/366854/slide_366854_4186736_compressed.jpg
			// http://i.huffpost.com/gadgets/slideshows/278815/slide_278815_2063217_original.jpg
			return src
				.replace(/(\/gadgets\/slideshows\/[0-9]*\/slide_[^/]*_)[a-z]*(\.[^/.]*)$/, "$1original$2")
				.replace(/(\/gen\/[0-9]*\/).*(\.[^/.?]*)(?:\?[^/]*)?$/, "$1original$2");
		}

		if (domain_nosub === "washingtonpost.com") {
			// https://www.washingtonpost.com/pbox.php?url=http://m.static.newsvine.com/servista/imagesizer?file=meena-hart-duerson--today9358FF7B-91E7-365E-2C23-5DD8416B1703.jpg&width=500&w=1484&op=resize&opt=1&filter=antialias&t=20170517
			//   http://m.static.newsvine.com/servista/imagesizer?file=meena-hart-duerson--today9358FF7B-91E7-365E-2C23-5DD8416B1703.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+pbox\.php\?(?:.*&)?url=([^&]+).*$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);

			// https://img.washingtonpost.com/wp-apps/imrs.php?src=https://img.washingtonpost.com/rw/2010-2019/Wires/Images/2017-10-15/AP/Britain_Hogwarts_Express_15930-4186c.jpg
			//   https://img.washingtonpost.com/rw/2010-2019/Wires/Images/2017-10-15/AP/Britain_Hogwarts_Express_15930-4186c.jpg
			// https://img.washingtonpost.com/wp-apps/imrs.php?src=https://img.washingtonpost.com/news/comic-riffs/wp-content/uploads/sites/15/2017/11/PIXAR-COCO-frida-kahlo-cordova-buckley.jpg&w=480
			//   https://img.washingtonpost.com/news/comic-riffs/wp-content/uploads/sites/15/2017/11/PIXAR-COCO-frida-kahlo-cordova-buckley.jpg
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/472
			// https://www.washingtonpost.com/wp-apps/imrs.php?src=https%3A%2F%2Fwww%2Ewashingtonpost%2Ecom%2Fwp-stat%2Fgraphics%2Fhomepage-promos%2Fimages%2Fmask-topper-1005%2Ejpg&w=232&h=131
			//   https://www.washingtonpost.com/wp-stat/graphics/homepage-promos/images/mask-topper-1005.jpg
			// https://www.washingtonpost.com/wp-apps/imrs.php?src=https%3A%2F%2Farc-anglerfish-washpost-prod-washpost%2Es3%2Eamazonaws%2Ecom%2Fpublic%2FQNVAE4ADFUI6XOJOAKLHN6PL5Q%2Ejpg&w=496&h=331
			//   https://arc-anglerfish-washpost-prod-washpost.s3.amazonaws.com/public/QNVAE4ADFUI6XOJOAKLHN6PL5Q.jpg
			// https://www.washingtonpost.com/wp-apps/imrs.php?src=https%3A%2F%2Farc-anglerfish-washpost-prod-washpost%2Es3%2Eamazonaws%2Ecom%2Fpublic%2FVZCIJI6JEZGFHII66ZZNKWAZDQ%2Ejpg&w=298&h=168
			//   https://arc-anglerfish-washpost-prod-washpost.s3.amazonaws.com/public/VZCIJI6JEZGFHII66ZZNKWAZDQ.jpg
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/482 (moving this rule above the /rf/ one due to [?#].*)
			// https://img.washingtonpost.com/wp-apps/imrs.php?src=https://www.washingtonpost.com/rf/image_982w/2010-2019/WashingtonPost/2020/03/14/Health-Environment-Science/Graphics/promo2-coronavirus-simulator-0313.jpg&w=60&h=60
			//   https://www.washingtonpost.com/rw/2010-2019/WashingtonPost/2020/03/14/Health-Environment-Science/Graphics/promo2-coronavirus-simulator-0313.jpg
			// thanks to liamengland1 on github: https://github.com/qsniyg/maxurl/pull/1380
			// https://www.washingtonpost.com/wp-apps/imrs.php?src=https%3A%2F%2Farc-anglerfish-washpost-prod-washpost%252Es3%252Eamazonaws%252Ecom%2Fpublic%2FBJVONBA3VBXPZDXZILSARTNYY4%252Ejpg&w=992&h=662
			//   https://arc-anglerfish-washpost-prod-washpost.s3.amazonaws.com/public/BJVONBA3VBXPZDXZILSARTNYY4.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+wp-apps\/+imrs\.php\?(?:.*&)?src=([^&]+).*/, "$1");
			if (newsrc !== src)
				return decodeURIComponent(decodeuri_ifneeded(newsrc));

			// thumbor (todo: have a sort of get_dest_from_thumbor in common_functions)
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/482
			// https://www.washingtonpost.com/resizer/5i6h3byfAbADvdFUAn-5RMklGQ4=/1200x630/filters:focal(2231x1260:4531x2559):quality(100)/arc-anglerfish-washpost-prod-washpost/public/JBWJ3HR4RQI6VL7CBEHLG63AWE.jpg
			//   https://arc-anglerfish-washpost-prod-washpost.s3.amazonaws.com/public/JBWJ3HR4RQI6VL7CBEHLG63AWE.jpg
			// https://www.washingtonpost.com/resizer/Heq_MXyYFkN5Knz0ImwQ3QmaPGQ=/arc-anglerfish-washpost-prod-washpost/public/W5HKYCWPJJF6XBNGTRCZHXZ4EU.jpg
			//   https://arc-anglerfish-washpost-prod-washpost.s3.amazonaws.com/public/W5HKYCWPJJF6XBNGTRCZHXZ4EU.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+resizer\/+[^/]+=\/+(?:.*\/)?(arc-anglerfish-washpost-prod-washpost)\/+/, "https://$1.s3.amazonaws.com/");
			if (newsrc !== src)
				return newsrc;
		}

		if (amazon_container === "arc-anglerfish-washpost-prod-washpost") {
			// thanks to roi:
			// https://arc-anglerfish-washpost-prod-washpost.s3.us-east-1.amazonaws.com/public/PIOG6C7PYNGKBKXF7MGWBVRNAM_size-normalized.jpg
			//   https://arc-anglerfish-washpost-prod-washpost.s3.us-east-1.amazonaws.com/public/PIOG6C7PYNGKBKXF7MGWBVRNAM.jpg
			return src.replace(/_size-normalized(\.[^/.]+)(?:[?#].*)?$/, "$1");
		}

		if ((domain_nosub === "washingtonpost.com" ||
			 // https://www.statesman.com/rf/image_md/Pub/p9/AJC/Blog/Diehards/2018/04/05/Images/240866_GettyImages-872925824_sndecp.jpg
			 domain_nowww === "statesman.com" ||
			 // https://www.myajc.com/rf/image_lowres/Pub/p6/CmgSharedContent/2015/05/18/Images/photos.medleyphoto.7287170.jpg
			 domain_nowww === "myajc.com" ||
			 // https://www.ajc.com/rf/image_lowres/Pub/p6/CmgSharedContent/2015/05/18/Images/photos.medleyphoto.7287170.jpg
			 domain_nowww === "ajc.com" ||
			 // http://www.lastampa.it/rf/image_lowres/Pub/p4/2018/03/09/Tecnologia/Foto/RitagliWeb/Mario%20Day1-15627-U11012767847446UFI-U11012767847446WcE-1400x788%40LaStampa.it.jpg
			 domain_nowww === "lastampa.it" ||
			 // https://www.whio.com/rf/image_md/Pub/p7/CmgSharedContent/2016/08/01/Images/photos.medleyphoto.10777077.jpg
			 domain_nowww === "whio.com" ||
			 // https://www.daytondailynews.com/rf/image_lowres/Pub/p7/CmgSharedContent/2016/08/01/Images/photos.medleyphoto.10777077.jpg
			 domain_nowww === "daytondailynews.com" ||
			 // https://www.livemint.com/rf/Image-621x414/LiveMint/Period1/2012/09/28/Photos/currency--621x414.jpg
			 //   https://www.livemint.com/rw/LiveMint/Period1/2012/09/28/Photos/currency--621x414.jpg
			 domain_nowww === "livemint.com" ||
			 // https://c.o0bg.com/rf/image_371w/Boston/2011-2020/2018/01/03/BostonGlobe.com/Arts/Images/AFP_V03Q8.jpg
			 domain === "c.o0bg.com" ||
			 // https://www.bostonglobe.com/rf/image_r/Boston/2011-2020/2018/01/29/BostonGlobe.com/Metro/Images/Polkgetty.r.jpg
			 //   https://www.bostonglobe.com/rw/Boston/2011-2020/2018/01/29/BostonGlobe.com/Metro/Images/Polkgetty.jpg
			 // https://www3.bostonglobe.com/rf/image_r/Boston/2011-2020/2018/01/29/BostonGlobe.com/Metro/Images/Polkgetty.r.jpg?arc404=true
			 //   https://www3.bostonglobe.com/rw/Boston/2011-2020/2018/01/29/BostonGlobe.com/Metro/Images/Polkgetty.jpg
			 domain_nosub === "bostonglobe.com" ||
			 // https://www.960theref.com/rf/image_lowres/Pub/p6/CmgSharedContent/2015/05/18/Images/photos.medleyphoto.7287170.jpg
			 //domain_nowww === "960theref.com" ||
			 // https://www.wgauradio.com/rf/image_lowres/Pub/p6/CmgSharedContent/2015/05/18/Images/photos.medleyphoto.7287170.jpg
			 //domain_nowww === "wgauradio.com" ||
			 // https://www.journal-news.com/rf/image_medium/Pub/p10/JournalNews/2019/06/17/Images/newsEngin.24329221_Hamilton-Pothole-1.jpg
			 //domain_nowww === "journal-news.com" ||
			 // https://www.wsbradio.com/rf/image_lowres/Pub/p9/CmgSharedContent/2018/08/14/Images/GettyImages-946417236.jpg
			 //domain_nowww === "wsbradio.com" ||
			 // https://www.springfieldnewssun.com/rf/image_lowres/Pub/p10/DaytonDailyNews/2019/04/29/Images/newsEngin.24132011_IMG_1550.jpg
			 //domain_nowww === "springfieldnewssun.com" ||
			 // https://www.dayton.com/rf/image_lowres/Pub/p10/DaytonDailyNews/2019/02/05/Images/newsEngin.23769425_Busy-Shopping-001--3-.jpg
			 //domain_nowww === "dayton.com" ||
			 // https://www.krmg.com/rf/image_lowres/Wires/w2/AP_Top_News/2019/06/15/Images/1919968b8f534f8895c03c5625535ed9.jpg
			 //domain_nowww === "krmg.com" ||
			 // https://www.news965.com/rf/image_lowres/Pub/p10/News965/2019/04/20/Images/lakeola.JPG
			 //domain_nowww === "news965.com" ||
			 // https://www.magic1053.com/rf/image_lowres/Pub/p10/Magic1053/2019/06/12/Images/Office-Crash-2019-0612.jpg
			 //domain_nowww === "magic1053.com" ||
			 // https://www.kissrocks.com/rf/image_lowres/Pub/p10/KissRocks/2019/02/21/Images/Alexa-Slider.jpg
			 //domain_nowww === "kissrocks.com" ||
			 // https://www.kiss104fm.com/rf/image_lowres/Pub/p10/Kiss104FM/2019/04/02/Videos/4625859.vpx
			 //domain_nowww === "kiss104fm.com" ||
			 // https://www.hot105fm.com/rf/image_lowres/Pub/p10/CmgSharedContent/2019/06/01/Images/juju%20smith%20schuster%20ketchup.jpg
			 //domain_nowww === "hot105fm.com" ||
			 // https://www.k99online.com/rf/image_lowres/Pub/p10/K99Online/2019/06/10/Images/cj.jpg
			 //domain_nowww === "k99online.com" ||
			 // https://www.news965.com/rf/image_lowres/Pub/p10/CmgSharedContent/2019/06/17/Images/gloria%20vanderbilt.jpg
			 //domain_nowww === "news965.com" ||
			 // https://www.hits973.com/rf/image_lowres/Pub/Web/Hits973/Special%20Contents/FlatPages/Images/AppPage-830x467_HITS_2019-01.jpg
			 //domain_nowww === "hits973.com" ||
			 // https://www.969theeagle.com/rf/image_lowres/Pub/p10/WAPE/2019/04/02/Images/IMG_7908.jpg
			 //domain_nowww === "969theeagle.com" ||
			 // https://www.971theriver.com/rf/image_lowres/Pub/Web/971TheRiver/Special%20Contents/Links/Images/theeaglesthridshow.jpg
			 //domain_nowww === "971theriver.com" ||
			 // https://www.thenew93q.com/rf/image_lowres/Pub/p10/TheNew93Q/2019/03/20/Images/MVIMG_20190304_160203.jpg
			 //domain_nowww === "thenew93q.com" ||
			 // https://www.power953.com/rf/image_lowres/Pub/p10/Power953/2019/06/10/Images/CB_Slider1.jpg
			 //domain_nowww === "power953.com" ||
			 // https://www.y100fm.com/rf/image_lowres/Pub/p10/Y100FM/2019/06/11/Images/Big-Reveal-2019-2.jpg
			 //domain_nowww === "y100fm.com" ||
			 // https://www.easy93.com/rf/image_lowres/Pub/p10/Easy93/2019/06/12/Images/Free%20Lunch%20Friday_REV.jpg
			 //domain_nowww === "easy93.com" ||
			 // https://www.1073theeagle.com/rf/image_lowres/Pub/Web/1073TheEagle/Special%20Contents/Links/Images/WXGL-Weather-RR-COLLEGE%20OF%20ROCK%20KNOWLEDGE.png
			 //domain_nowww === "1073theeagle.com" ||
			 // https://www.hindustantimes.com/rf/image_size_640x362/HT/p2/2016/06/07/Pictures/_5e4299f2-2c82-11e6-85eb-521f5a9851b5.png
			 //   https://www.hindustantimes.com/rw/HT/p2/2016/06/07/Pictures/_5e4299f2-2c82-11e6-85eb-521f5a9851b5.png
			 // https://m.hindustantimes.com/rf/image_size_640x362/HT/p2/2016/06/07/Pictures/_5e4299f2-2c82-11e6-85eb-521f5a9851b5.png
			 //   https://www.hindustantimes.com/rw/HT/p2/2016/06/07/Pictures/_5e4299f2-2c82-11e6-85eb-521f5a9851b5.png
			 domain_nosub === "hindustantimes.com") &&
			string_indexof(src, "/rf/") >= 0 ||
			src.match(/^[a-z]+:\/\/[^/]*\/rf\/+image_[^/]*\/+(?:[0-9]{4}-[0-9]{4}\/+)?(?:Pub|Wires|HT)\/+(?:[wp][0-9]+|Online|Web)\/+/)) {
			// test: https://img.washingtonpost.com/rf/image_1483w/2010-2019/Wires/Online/2017-11-21/AP/Images/Music_Taylor_Swift_36357.jpg
			// error: Query String : src=http://www.washingtonpost.com/rw/2010-2019/Wires/Online/2017-11-21/AP/Images/Music_Taylor_Swift_36357.jpg&w=1483
			// real: https://img.washingtonpost.com/rf/image_1484w/2010-2019/Wires/Online/2017-11-21/AP/Images/Music_Taylor_Swift_36357.jpg-ced9a.jpg?uuid=TiTSis5fEeeoe0fxS3MWKg

			// https://www.washingtonpost.com/rf/image_480x320/2010-2019/WashingtonPost/2018/01/26/Foreign/Images/AFP_XY105.jpg?t=20170517a
			//   https://www.washingtonpost.com/rw/2010-2019/WashingtonPost/2018/01/26/Foreign/Images/AFP_XY105.jpg

			// https://www.hindustantimes.com/rf/image_size_960x540/HT/p2/2018/01/08/Pictures/susan-sarandon-watson-clemente-marai-larasi-emma_f6e96a02-f475-11e7-95e6-04e0a17510b6.jpg - stretched
			//   https://www.hindustantimes.com/rf/image/HT/p2/2018/01/08/Pictures/susan-sarandon-watson-clemente-marai-larasi-emma_f6e96a02-f475-11e7-95e6-04e0a17510b6.jpg
			// https://www.hindustantimes.com/rf/image_size_90x90/HT/p2/2018/01/27/Pictures/parliament-session_d792b3aa-037c-11e8-8651-33050e64100a.jpg
			//   https://www.hindustantimes.com/rf/image/HT/p2/2018/01/27/Pictures/parliament-session_d792b3aa-037c-11e8-8651-33050e64100a.jpg
			// https://www.hindustantimes.com/rf/image_size_960x540/HT/p2/2018/01/27/Pictures/parliament-session_d146b4e2-037c-11e8-8651-33050e64100a.jpg
			//   https://www.hindustantimes.com/rf/image/HT/p2/2018/01/27/Pictures/parliament-session_d146b4e2-037c-11e8-8651-33050e64100a.jpg
			// https://www.hindustantimes.com/rf/image_size_960x540/HT/p2/2018/01/08/Pictures/emma-watson_af695f5c-f475-11e7-95e6-04e0a17510b6.jpg
			//   https://www.hindustantimes.com/rf/image/HT/p2/2018/01/08/Pictures/emma-watson_af695f5c-f475-11e7-95e6-04e0a17510b6.jpg
			//   https://www.hindustantimes.com/rw/HT/p2/2018/01/08/Pictures/emma-watson_af695f5c-f475-11e7-95e6-04e0a17510b6.jpg

			// return src.replace(/\/image_size_[0-9]+x[0-9]+\//, "/image/");
			newsrc = src
				.replace(/(.*?:\/\/[^/]*\/)rf\/[^/]*\/(.*)$/, "$1rw/$2")
				.replace(/[?&].*$/, "")
				.replace(/\.r(\.[^/.]*)$/, "$1");
			if (newsrc !== src) {
				return newsrc;
			}
		}

		// why was this separate?
		/*if (false && domain_nowww === "livemint.com") {
			// https://www.livemint.com/rf/Image-621x414/LiveMint/Period1/2012/09/28/Photos/currency--621x414.jpg
			//   https://www.livemint.com/rw/LiveMint/Period1/2012/09/28/Photos/currency--621x414.jpg
			return src.replace(/\/rf\/[^/]*\/(.*)$/, "/rw/$1");
		}*/

		if (domain_nosub === "foxnews.com" &&
			domain.match(/^a[0-9]*\.foxnews\.com/)) {
			// http://a57.foxnews.com/images.foxnews.com/content/fox-news/world/2017/11/15/firefighters-in-thailands-capital-on-front-line-citys-fight-against-snakes/_jcr_content/par/featured_image/media-0.img.jpg/931/524/1510749948281.jpg?ve=1&tl=1
			// down for now?
			//console_log(src.replace(/.*\/a[0-9]*\.foxnews\.com\/(.*).*/, "$1"));
			if (src.replace(/.*\/a[0-9]*\.foxnews\.com\/([^/]*).*/, "$1") !== "images.foxnews.com") {
				return src.replace(/.*\/a[0-9]*\.foxnews\.com\/(.*)\/[0-9]+\/[0-9]+\/([^/]*)$/, "http://$1/$2");
			}
			return src.replace(/(\/a[0-9]*\.foxnews\.com\/.*)\/[0-9]+\/[0-9]+\/([^/?]*)(?:\?.*)?$/, "$1/0/0/$2");
		}

		if (domain === "cdn.cliqueinc.com" ||
			// http://cliqueimg.com/cache/posts/185680/threes-a-trend-super-sequins-bring-a-sexy-edge-to-the-oscars-1677261-1456708645.640x0c.jpg
			//   http://cliqueimg.com/cache/posts/185680/threes-a-trend-super-sequins-bring-a-sexy-edge-to-the-oscars-1677261-1456708645.jpg
			//   http://cliqueimg.com/posts/185680/threes-a-trend-super-sequins-bring-a-sexy-edge-to-the-oscars-1677261-1456708645.jpg
			// http://cliqueimg.com/cache/posts/img/uploads/current/images/0/70/213/main.original.600x0c.jpg
			//   http://cliqueimg.com/cache/posts/img/uploads/current/images/0/70/213/main.original.jpg
			// http://cliqueimg.com/posts/img/uploads/current/images/0/174/782/promo.original.600x0.jpg
			//   http://cliqueimg.com/posts/img/uploads/current/images/0/174/782/promo.original.jpg
			domain_nosub === "cliqueimg.com") {
			// https://cdn.cliqueinc.com/posts/img/uploads/current/images/0/39/490/main.original.640x0c.jpg
			//   https://cdn.cliqueinc.com/posts/img/uploads/current/images/0/39/490/main.original.jpg
			return src
				.replace(/(\/[^/]*)\.[0-9]*x[0-9]*[^/.]*\.([^./]*)$/, "$1.$2")
				.replace(/\/cache\/posts\//, "/posts/");
			//return src.replace(/(\/[a-z]+)\.[a-z]+(?:\.[^/.]*)(\.[^/.]*)$/, "$1.original$2");
		}

		if (domain_nosub === "hubstatic.com") {
			// https://usercontent1.hubstatic.com/9165264_f520.jpg
			//   https://usercontent1.hubstatic.com/9165264.jpg
			// https://hubstatic.com/14406441_f1024.jpg
			//   https://hubstatic.com/14406441.jpg
			// https://usercontent1.hubstatic.com/10262262_f120.jpg
			//   https://usercontent1.hubstatic.com/10262262.png
			// https://hubstatic.com/14483890_f1024.jpg
			//   https://usercontent1.hubstatic.com/14483890.png
			newsrc = src.replace(/(\/[0-9]+)_f[0-9]+(\.[^/.]*)$/, "$1$2");
			if (newsrc !== src)
				return add_extensions(newsrc);
		}

		if (domain === "cdn.cms-twdigitalassets.com") {
			// thanks to anonymous for reporting:
			// https://cdn.cms-twdigitalassets.com/content/dam/about-twitter/en/home/home-bg-texture1.jpg.twimg.768.jpg
			//   https://cdn.cms-twdigitalassets.com/content/dam/about-twitter/en/home/home-bg-texture1.jpg
			return src.replace(/(\.[a-z]+)\.twimg\.[0-9]+\.[a-z]+(?:[?#].*)?$/, "$1");
		}

		if (domain === "pbs.twimg.com" ||
			(domain === "ton.twitter.com" && string_indexof(src, "/ton/data/dm/") >= 0)) {
			// https://pbs.twimg.com/card_img/1233609033145171968/yM9hHz4R?format=jpg&name=small
			//   https://pbs.twimg.com/card_img/1233609033145171968/yM9hHz4R?format=jpg&name=orig
			// https://pbs.twimg.com/ad_img/1228452474039619584/WZtokGPI?format=jpg&name=small
			//   https://pbs.twimg.com/ad_img/1228452474039619584/WZtokGPI?format=jpg&name=orig
			// https://pbs.twimg.com/semantic_core_img/1236969872543768578/18vxA6iq?format=jpg&name=240x240
			//   https://pbs.twimg.com/semantic_core_img/1236969872543768578/18vxA6iq?format=jpg&name=orig
			// https://pbs.twimg.com/tweet_video_thumb/EXNl_O1XQAEKPTh.jpg:thumb
			//   https://pbs.twimg.com/tweet_video_thumb/EXNl_O1XQAEKPTh.png?name=orig

			// use ?name=orig instead of :orig, see:
			//   https://github.com/qsniyg/maxurl/issues/2

			// https://pbs.twimg.com/media/DWREhilXkAAcafr?format=jpg&name=small -- 403
			//   https://pbs.twimg.com/media/DWREhilXkAAcafr.jpg:orig
			//   https://pbs.twimg.com/media/DWREhilXkAAcafr?format=jpg&name=orig
			//   https://pbs.twimg.com/media/DWREhilXkAAcafr.jpg?name=orig
			// https://pbs.twimg.com/media/DWO61F5X4AISSsF?format=jpg
			//   https://pbs.twimg.com/media/DWO61F5X4AISSsF.jpg:orig
			//   https://pbs.twimg.com/media/DWO61F5X4AISSsF?format=jpg&name=orig
			// https://pbs.twimg.com/media/Dbxmq4BV4AA2ozg.jpg:orig
			//   https://pbs.twimg.com/media/Dbxmq4BV4AA2ozg.jpg?name=orig
			// https://pbs.twimg.com/media/DdxPc2eU0AAED8b.jpg:thumb
			//   https://pbs.twimg.com/media/DdxPc2eU0AAED8b.jpg?name=orig
			// https://pbs.twimg.com/media/DhI2IjaU8AAzEFA.jpg?format=jpg&name=orig
			//   https://pbs.twimg.com/media/DhI2IjaU8AAzEFA.jpg?name=orig
			// https://pbs.twimg.com/media/DhbrylaVAAYlrss?format=png
			//   https://pbs.twimg.com/media/DhbrylaVAAYlrss.jpg?name=orig
			//   https://pbs.twimg.com/media/DhbrylaVAAYlrss:orig?format=jpg
			// https://pbs.twimg.com/card_img/958636711470223361/S0DycGGB?format=jpg&name=600x314
			//   https://pbs.twimg.com/card_img/958636711470223361/S0DycGGB?format=jpg&name=orig
			// https://pbs.twimg.com/ext_tw_video_thumb/1078225907569967105/pu/img/-Dw-qFfQvMTHz6YA?format=jpg&name=120x120
			//   https://pbs.twimg.com/ext_tw_video_thumb/1078225907569967105/pu/img/-Dw-qFfQvMTHz6YA?format=jpg&name=orig
			// https://pbs.twimg.com/media/DhqeJS2UcAAo7fr.png
			//   https://pbs.twimg.com/media/DhqeJS2UcAAo7fr.jpg
			//   https://pbs.twimg.com/media/DhqeJS2UcAAo7fr.jpg?name=orig -- doesn't work
			//   https://pbs.twimg.com/media/DhqeJS2UcAAo7fr.png?name=orig -- works
			// https://pbs.twimg.com/media/ESHsHpCXkAA2xfZ.png
			//   https://pbs.twimg.com/media/ESHsHpCXkAA2xfZ.jpg?name=orig
			// https://pbs.twimg.com/media/EUEKr-gUYAMrXt_?format=jpg&name=900x900
			// https://pbs.twimg.com/media/EWHdLzNUwAIy7Ik.jpg:orig -- works (1368x2048) -- no longer, probably a cache error?
			//   https://pbs.twimg.com/media/EWHdLzNUwAIy7Ik.jpg?name=orig -- doesn't work (404)
			// thanks to llacb47 on github: https://pbs.twimg.com/media/EhML7FPXkAEK4GZ?format=webp&name=tiny
			// https://pbs.twimg.com/media/EhML7FPXkAEK4GZ?format=webp&name=tiny
			//   https://pbs.twimg.com/media/EhML7FPXkAEK4GZ.jpg?name=orig
			// https://pbs.twimg.com/media/EhMO9OhU0AA6vZv?format=webp&name=tiny
			//   https://pbs.twimg.com/media/EhMO9OhU0AA6vZv.jpg?name=orig
			// 4096x4096 is also a valid "name"
			// medium == null?

			newsrc = common_functions["get_largest_twimg"](src, options);
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "twitter.com" ||
			domain_nowww === "x.com") {
			// https://github.com/qsniyg/maxurl/issues/243
			// https://twitter.com/NoMansSky/status/1325458262800683009
			var _query_twitter_webapi = function(url, cookies, cb) {
				// ct0 = x-csrf-token (32 bytes for non-logged in, 160 for logged in)
				// auth_token is present if logged in
				// gt = x-guest-token (can be provided by a twitter webpage if it's not present)
				if (!cookies || !cookies.ct0) {
					console_warn("Cookies are needed for Twitter API calls", cookies);
					return cb(null);
				}

				var headers = {
					Accept: "*/*",
					Authorization: base64_decode("YWJjZEJlYXJlciBBQUFBQUFBQUFBQUFBQUFBQUFBQUFOUklMZ0FBQUFBQW5Od0l6VWVqUkNPdUg1RTZJOHhuWno0cHVUcyUzRDFadjd0dGZrOExGODFJVXExNmNIamhMVHZKdTRGQTMzQUdXV2pDcFRuQQ==").substr(4),
					//Origin: "https://twitter.com",
					Referer: "https://twitter.com/",
					"sec-fetch-dest": "empty",
					"sec-fetch-mode": "cors",
					"sec-fetch-site": "same-origin",
					"x-csrf-token": cookies.ct0,
					"x-twitter-client-language": cookies.lang || "en",
					"x-twitter-active-user": "yes"
				};

				if (cookies.twid) { // don't use auth_token, it doesn't exist on non-httponly-side
					headers["x-twitter-auth-type"] = "OAuth2Session";
				} else {
					if (cookies.gt) {
						headers["x-guest-token"] = cookies.gt;
					} else {
						// TODO: fetch
						console_warn("Guest token not found");
						return cb(null);
					}
				}

				api_query("twitter_api:" + url, {
					url: url,
					method: "GET",
					imu_mode: "xhr",
					headers: headers,
					json: true
				}, cb, function(done, resp, cache_key) {
					done(resp, 60*60);
				});
			};

			var query_twitter_webapi = function(url, cb) {
				if (options.get_cookies) {
					options.get_cookies("https://www.x.com/", function(cookies) {
						if (cookies) cookies = headers_list_to_dict(cookies);
						_query_twitter_webapi(url, cookies, cb);
					});
				} else {
					_query_twitter_webapi(url, null, cb);
				}
			};

			var query_tweet = function(tweet_id, cb) {
				//var url = "https://api.twitter.com/2/timeline/conversation/" + tweet_id + ".json";
				var url = "https://twitter.com/i/api/2/timeline/conversation/" + tweet_id + ".json";
				var queries = {
					// u = useless, but adding to match twitter's api
					include_profile_interstitial_type: "1",
					include_blocking: "1", // u
					include_blocked_by: "1", // u
					include_followed_by: "1", // u
					include_want_retweets: "1", // u
					include_mute_edge: "1", // u
					include_can_dm: "1", // u
					include_can_media_tag: "1", // u
					skip_status: "1",
					cards_platform: "Web-12",
					include_cards: "1",
					include_ext_alt_text: "true",
					include_quote_count: "true", // u
					include_reply_count: "1", // u
					tweet_mode: "extended",
					include_entities: "true",
					include_user_entities: "true",
					include_ext_media_color: "true",
					include_ext_media_availability: "true",
					send_error_codes: "true",
					simple_quoted_tweet: "true",
					//referer: "home", // only sent in dynamic
					//controller_data: atob(...) // ???, only sent in dynamic
					count: "20", // u
					include_ext_has_birdwatch_notes: "false",
					ext: "mediaStats%2ChighlightedLabel"
				};

				url = add_queries(url, queries);

				query_twitter_webapi(url, function(data) {
					if (!data)
						return cb(null);

					try {
						var tweet_data = data.globalObjects.tweets[tweet_id];
						data.globalObjects.tweet = tweet_data;
						cb(data.globalObjects);
					} catch (e) {
						console_error(e, data);
						cb(null);
					}
				});
			};

			var get_baseobj_from_tweet = function(tweet, users) {
				var obj:BigImageInfoSObject = {
					can_head: false, // returns 503 sometimes
					extra: {}
				};

				if (tweet.created_at) {
					obj.extra.created_date = new Date(tweet.created_at).getTime();
				}

				if (users && tweet.id_str && tweet.user_id_str) {
					var username = users[tweet.user_id_str].screen_name;
					obj.extra.author_username = username;
					obj.extra.page = "https://x.com/" + username + "/status/" + tweet.id_str;
				}

				if (tweet.full_text) {
					obj.extra.caption = tweet.full_text;
				}

				return obj;
			};

			var get_single_media_obj = function(media) {
				var urls = [];

				if (array_indexof(["photo", "animated_gif", "video"], media.type) < 0) {
					console_warn("Unknown media type", media);
					return null;
				}

				if (media.video_info && media.video_info.variants) {
					var added_mimes = new_set();

					// thanks to NekoAlosama on github for reporting: https://github.com/qsniyg/maxurl/issues/1005
					media.video_info.variants.sort(function(a, b) {
						if (a.content_type === "application/x-mpegURL")
							return -1;
						if (b.content_type === "application/x-mpegURL")
							return 1;

						if (a.bitrate && b.bitrate)
							return b.bitrate - a.bitrate;

						return 0;
					});

					array_foreach(media.video_info.variants, function(variant) {
						if (set_has(added_mimes, variant.content_type))
							return;

						set_add(added_mimes, variant.content_type);

						var unshift = false;

						var video:VideoProp = true;
						if (variant.content_type === "video/mp4") {
							video = true;
						} else if (variant.content_type === "application/x-mpegURL") {
							video = "hls";
							unshift = true;
						} else {
							console_warn("Unknown content type", variant, media);
							return;
						}

						var obj = {
							url: variant.url,
							video: video
						};

						urls.push(obj);
					});
				}

				var media_url = media.media_url_https;

				// animated_gif/video are not affected
				if (false && media.type === "photo") {
					var largest_size = null;
					var largest_size_br = 0;
					// all sizes are required: https://twitter.com/fkey123/status/1331186716795781122/photo/1
					// returns large as the largest size, but it doesn't work, only medium does (but sometimes orig does??)
					obj_foreach(media.sizes, function(key, size) {
						var our_br = size.w * size.h;
						if (our_br > largest_size_br) {
							largest_size = key;
							largest_size_br = our_br;
						}
					});

					if (largest_size) {
						media_url += "?name=" + largest_size;
					}

					if (largest_size !== "orig") {
						urls.push(media_url.replace(/\?.*$/, "?name=orig"));
						//urls.push(media_url.replace(/\.[^/]+$/, ".png?name=orig"));
						//urls.push(media_url.replace(/\.[^/]+$/, ".jpg?name=orig"));
					}
				}

				var larger_media = common_functions["get_largest_twimg"](media_url, options);
				if (larger_media) {
					array_extend(urls, larger_media);
				} else {
					urls.push(media_url);
				}

				return urls;
			};

			newsrc = website_query({
				website_regex: [
					/^[a-z]+:\/\/[^/]+\/+[^/]+\/+status\/+([0-9]+)(?:\/.*)?(?:[?#].*)?$/,
					/^[a-z]+:\/\/[^/]+\/+i\/+web\/+status\/+([0-9]+)(?:[?#].*)?$/
				],
				run: function(cb, match) {
					var id = match[1];
					query_tweet(id, function(data) {
						if (!data) {
							return cb(null);
						}

						var tweet = data.tweet;
						var obj = get_baseobj_from_tweet(tweet, data.users);

						var media_id = 0;
						var media_id_match = src.match(/#imu-media-id=([0-9]+)$/);
						if (media_id_match) media_id = media_id_match[1];

						var imu_url_id = null;
						var imu_url_match = src.match(/#imu-url=(.*)$/);
						if (imu_url_match) {
							var imu_url = imu_url_match[1];
							imu_url_match = imu_url.match(/.*\/([^/.?#]+)(?:\.[^/]+)?(?:[?#].*)?$/);
							if (imu_url_match) {
								imu_url_id = imu_url_match[1];
							}
						}

						var medias = [];
						var currenturls = [];
						var album_links = [];
						if (tweet.extended_entities && tweet.extended_entities.media) {
							array_foreach(tweet.extended_entities.media, function(media, i) {
								var singleobj = get_single_media_obj(media);
								if (!singleobj)
									return;

								var is_current = i == media_id;
								if (imu_url_id) {
									array_foreach(singleobj, function(ourobj) {
										var url = ourobj.url || ourobj;
										var our_id = url.match(/.*\/([^/.?#]+)(?:\.[^/]+)?(?:[?#].*)?$/)[1];

										is_current = our_id === imu_url_id;
										if (is_current) return;
									});
								}

								album_links.push({
									url: obj.extra.page + "#imu-media-id=" + i,
									is_current: is_current
								});

								medias[i] = singleobj;
								if (is_current) currenturls = singleobj;
							});

							if (album_links.length > 1) {
								obj.album_info = {
									type: "links",
									links: album_links
								};
							}
						}

						if (tweet.card && !currenturls.length) {
							var card = tweet.card;

							var card_url = card.url;
							var card_image = null;

							if (card.binding_values) {
								// in case the url is shortened
								if (card.binding_values.player_url) {
									card_url = card.binding_values.player_url.string_value;
								}

								if (card.binding_values.player_image) {
									card_image = card.binding_values.player_image.image_value.url;
								}
							}

							currenturls.push({
								url: card_url,
								is_pagelink: true
							})

							if (card_image) currenturls.push(card_image);
						}

						if (tweet.quoted_status_permalink && !currenturls.length) {
							return cb({
								url: tweet.quoted_status_permalink.expanded,
								is_pagelink: true
							});
						}

						//console_log(data, obj, currenturls);

						return cb(fillobj_urls(currenturls, obj));
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if ((host_domain_nowww === "twitter.com" || host_domain_nowww === "x.com") && options.element) {
			var tweet_link = common_functions["get_twitter_tweet_link"](options.element);

			page_nullobj = null;
			if (tweet_link) {
				page_nullobj = {
					url: tweet_link,
					is_pagelink: true
				};

				if (src) {
					page_nullobj.url += "#imu-url=" + src;
				} else {
					return page_nullobj;
				}
			}

			var caption = common_functions["get_twitter_caption"](options.element);
			if (caption) {
				var newobj = {
					url: src,
					extra: {
						caption: caption
					}
				};

				if (page_nullobj) {
					return [page_nullobj, newobj];
				} else {
					return newobj;
				}
			} else if (page_nullobj) {
				return page_nullobj;
			}
		}

		if (common_functions["multidomain__nitter"](domain, domain_nowww)
			&& string_indexof(src, "/pic/") >= 0) {
			// thanks to bigdiff on discord:
			// https://nitter.cz/pic/enc/bWVkaWEvRjl0ekcwdFhZQUEtRU0zLmpwZz9uYW1lPXNtYWxsJmZvcm1hdD13ZWJw
			//   https://pbs.twimg.com/media/F9tzG0tXYAA-EM3.jpg?name=orig
			match = src.match(/\/pic\/+enc\/(bWVka[^/?#.]+)(?:[?#].*)?$/);
			if (match) {
				try {
					newsrc = base64_decode(match[1]);
					return "https://pbs.twimg.com/" + newsrc;
				} catch (e) {
					console_error(e);
				}
			}

			// thanks to Rnksts on discord
			// https://nitter.net/pic/profile_images%2F1229633518826901506%2FHEuZ9fcX_400x400.jpg
			//   https://pbs.twimg.com/profile_images/1229633518826901506/HEuZ9fcX.jpg
			// https://nitter.net/pic/media%2FEQru8x6WsAIz_eY.jpg%3Fname%3Dsmall
			//   https://pbs.twimg.com/media/EQru8x6WsAIz_eY.jpg?name=orig
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+pic\/+(.*)$/, "$1");
			if (newsrc !== src) {
				newsrc = decodeURIComponent(newsrc);

				// https://nitter.net/pic/video.twimg.com%2Ftweet_video%2FEXNl_O1XQAEKPTh.mp4
				//   https://video.twimg.com/tweet_video/EXNl_O1XQAEKPTh.mp4
				if (string_indexof(newsrc, "video.twimg.com") === 0) {
					// is there any reason for this?
					//return urljoin("https://video.twimg.com/", newsrc.replace(/^[^/]*\//, "/"), true);
				} else {
					var urls = common_functions["get_largest_twimg"](urljoin("https://pbs.twimg.com/", "/" + decodeURIComponent(newsrc), true));
					if (urls) {
						if (!is_array(urls)) urls = [urls];

						array_foreach(urls, function(url) {
							var queries = get_queries(url.url);

							if (!url.filename) {
								url.filename = url_basename(url.url);
							}

							url.url = encodeURIComponent(url.url.replace(/^[a-z]+:\/\/[^/]+\/+/, ""));
							url.url = "https://" + domain + "/pic/" + url.url;

							if (queries.format && /\/(?:profile_images|media)/.test(url.url)) {
								url.url = url.url.replace(/(.*%2F[^.%]+)(?:\..*)?(%.*)?$/, "$1." + queries.format + "$2");
							}
						});

						return urls;
					} else {
						return {
							url: src,
							filename: url_basename(newsrc)
						};
					}
				}
			}
		}

		if (options.element &&
			common_functions["multidomain__nitter"](host_domain, host_domain_nowww)) {
			if (options.element.tagName === "VIDEO" && !src) {
				newsrc = options.element.getAttribute("data-url");
				if (newsrc) {
					return {
						url: urljoin(options.host_url, newsrc, true),
						media_info: {
							type: "video",
							delivery: "hls",
							need_custom_xhr: true // in order to override head requests
						},
						can_head: false // 404
					};
				}
			}
		}

		if (host_domain_nosub === "youtube.com" && options.element) {
			if (options.element.tagName.toLowerCase() === "svg") {
				var parent_tagname = options.element.parentElement.tagName.toLowerCase();
				// "play_all" is one icon to exclude
				if (parent_tagname === "yt-icon" || parent_tagname === "button")
					return {
						url: origsrc,
						bad: "mask"
					};
			}

			if (options.element.tagName === "DIV" && options.element.classList.contains("ytp-gradient-bottom")) {
				return {
					url: origsrc,
					bad: "mask"
				};
			}

			if (!src) {
				newsrc = common_functions["get_host_el_matching"](options.element, options.host_url, function(x) {
					return x.tagName === "VIDEO" && x.classList.contains("html5-main-video");
				});
				if (newsrc) return newsrc;
			}
		}

		if (domain_nosub === "youtube.com" || domain === "m.youtube.com" || domain_nowww === "youtu.be") {
			// for thumbnails
			match = src.match(/^[a-z]+:\/\/(?:(?:www|m(?:usic)?)\.)?youtube\.com\/+watch\?(?:.*&)?v=([^&#]*)/);
			if (!match) {
				match = src.match(/^[a-z]+:\/\/(?:www\.)?youtu\.be\/+([^?&#]*)/);
			}
			if (!match) {
				match = src.match(/^[a-z]+:\/\/(?:(?:www|m)\.)?youtube\.com\/+(?:embed|shorts)\/+([^?#/]+)\/*(?:[?#].*)?$/);
			}

			if (match) {
				return "https://i.ytimg.com/vi/" + match[1] + "/mqdefault.jpg";
			}
		}

		if (domain === "ytimg.googleusercontent.com" ||
			// https://i.ytimg.com/vi/WLUWOwO2U8c/hqdefault.jpg?sqp=-oaymwEZCPYBEIoBSFXyq4qpAwsIARUAAIhCGAFwAQ==&rs=AOn4CLApoW235ABiHOfyJan0ArZIRsbUOA
			(domain_nosub === "ytimg.com" && domain.match(/^i[0-9]*\./)) ||
			// https://img.youtube.com/vi/KsB1ydR8NFk/hqdefault.jpg
			domain === "img.youtube.com") {
			// thanks to speedymaan on github: https://github.com/qsniyg/maxurl/issues/29
			// https://i.ytimg.com/vi/sxItyrp55g8/0.jpg
			//   https://i.ytimg.com/vi/sxItyrp55g8/maxresdefault.jpg
			// https://i1.ytimg.com/vi/KSUGZNEP-T4/1.jpg
			//   https://i1.ytimg.com/vi/KSUGZNEP-T4/mq1.jpg
			//   https://i1.ytimg.com/vi/KSUGZNEP-T4/maxres1.jpg
			// https://i.ytimg.com/vi_webp/c8e9Nc36lRg/mqdefault.webp
			//   https://i.ytimg.com/vi_webp/c8e9Nc36lRg/sddefault.webp
			// thanks to Broly on discord:
			// https://i.ytimg.com/vi/z6mQrSDB3kA/maxres2.jpg
			//   https://i.ytimg.com/vi/z6mQrSDB3kA/oardefault.jpg
			// doesn't work for some urls:
			// https://i.ytimg.com/vi/o-gVbQHG0Ck/hqdefault.jpg
			//   https://i.ytimg.com/vi/o-gVbQHG0Ck/sddefault.jpg -- different image
			// https://i.ytimg.com/vi/bXMUBdqyVAE/hq720.jpg
			//   https://i.ytimg.com/vi/bXMUBdqyVAE/maxresdefault.jpg
			// https://i.ytimg.com/an_webp/Yn_RYDP93as/mqdefault_6s.webp?du=3000&sqp=CN6znOQF&rs=AOn4CLCcLq2tY4Xg6tnNM01LEHPm--eUmQ

			obj = {
				problems: {
					// disable for now, it's really rare, and probably a cache issue from youtube.
					possibly_different: false
				}
			};

			match = src.match(/\/(?:vi|an)(?:_webp)?\/+([^/]+)\/+[^/]+\.[^/.]+(?:[?#].*)?$/);
			id = null;
			if (match) {
				obj.extra = {page: "https://www.youtube.com/watch?v=" + match[1]};
				id = match[1];
			}

			// Transforms private signed URLs (generally from youtube studio) into public ones. Only works for public videos.
			// Signed URLs can't be changed, so this step is needed.
			newsrc = src.replace(/^([a-z]+:\/\/)i[0-9]+(\.ytimg\.com\/vi(?:_webp)?\/+[^/]+\/+[a-z]+\.)/, "$1i$2");
			if (newsrc !== src) {
				obj.url = newsrc;
				// FIXME: is it possibly_different?
				return obj;
			}

			// https://i.ytimg.com/vi/ygdaPcspmDE/hqdefault_live.jpg
			//   https://i.ytimg.com/vi/ygdaPcspmDE/maxresdefault.jpg
			// thanks to hentai lzno on greasyfork: https://greasyfork.org/forum/discussion/70889/youtube-live-thumbnails-dont-redirect-to-original-image
			regex = /^(.+\/+(?:vi|an)(?:_webp)?\/+[^/]*\/+)[a-z]*(default|[0-9]+)(?:_(?:live|[0-9]+s))?(\.[^/.?#]*)(?:[?#].*)?$/;
			if (regex.test(src) /*&& !problem_excluded("possibly_different")*/) {
				var sizes = [
					"oar", // shorts
					"maxres",
					//"hq720", // don't use because it'll break mq1 etc.
					"sd",
					"hq",
					"mq"
				];

				// an = animated, replace to vi for this to work
				src = src.replace(/\/an(_webp)?\/+/, "/vi$1/");

				var urls = []
				array_foreach(sizes, function(size) {
					// todo: move out of here
					var match = src.match(regex);

					var number = match[2];
					if (number.length > 1 || number === "0") {
						number = "default";
					}

					var newsrc = match[1] + size + number + match[3];

					if (newsrc !== src) {
						urls.push(newsrc);
					} else {
						return false;
					}
				});

				if (urls.length > 0)
					return fillobj_urls(urls, obj);
			}

			if (id && options && options.do_request && options.cb) {
				var parse_player_response = function(player_response) {
					if (!player_response) {
						return options.cb(null);
					}

					console_log(player_response);

					obj.url = src;
					obj.problems.possibly_different = false;

					var videoid = null;
					if (player_response.videoDetails && player_response.videoDetails.title && player_response.videoDetails.videoId) {
						videoid = player_response.videoDetails.videoId;
						obj.extra = {
							page: "https://www.youtube.com/watch?v=" + videoid,
							caption: player_response.videoDetails.title,
							id: videoid
						};
					}

					var maxbitrate = 0;
					var maxobj = null;
					var duration = 0;

					var available_formats = [];
					var has_sig = false;

					var add_formats = function(formats, is_adaptive) {
						for (var i = 0; i < formats.length; i++) {
							var our_format = formats[i];

							available_formats.push(our_format);

							our_format.imu_video_id = videoid;

							if (is_adaptive) {
								our_format.imu_is_adaptive = true;
							}

							// this is awful
							if (our_format.approxDurationMs) {
								var ms = parseFloat(our_format.approxDurationMs);
								ms /= 1000;

								if (ms > duration)
									duration = ms;
							}

							our_format.imu_has_sig = our_format.cipher || our_format.signatureCipher;

							if (our_format.imu_has_sig) {
								has_sig = true;
							}
						}
					};

					var get_n_replacer = function(cb) {
						if (!options.rule_specific.youtube_replace_n) {
							console_warn("Youtube n replacing is disabled, expect slow speeds.");
							return cb(null);
						}

						api_cache.fetch("youtube:n_replacer", cb, function(done) {
							common_functions["youtube_fetch_asset"](api_cache, options, videoid, "js", function(asset) {
								let match = asset.match(/b=([a-zA-Z0-9]{3})\[0\]\(b\),a\.set\("n",b\)/);
								if (!match) {
									console_error("Unable to find n match in", {asset});
									return done(null, 6*60*60);
								}

								let match2 = asset.match(new RegExp("var " + match[1] + "=\\[([a-zA-Z0-9]{3})\\]"));
								if (!match2) {
									console_error("Unable to find n sub-match in", {asset, match});
									return done(null, 6*60*60);
								}

								let match3 = asset.match(new RegExp("\n" + match2[1] + "=function\\(a\\){([\\s\\S]*?join\\(\"\"\\);?)};\n"));
								if (!match3) {
									console_error("Unable to find n function match in", {asset, match, match2});
									return done(null, 6*60*60);
								}

								let sanitized = match3[1];

								let sanitize = function(code) {
									return code
										.replace(/new Date\("([^"]+)"\)/, function(_, x) {
											return new Date(x).getTime();
										})
										.replace(/Math.pow\(([0-9]+),([0-9]+)\)/, function(_, x, y) {
											return Math_pow(x, y);
										});
								};

								while (true) {
									let new_sanitized = sanitize(sanitized);
									if (new_sanitized === sanitized)
										break;

									sanitized = new_sanitized;
								}

								get_library("JSInterpreter", options, options.do_request, function(JSInterpreter) {
									if (!JSInterpreter) {
										console_error(cache_key, "Unable to fetch JSInterpreter");
										return done(null, false);
									}

									let source = "var replacer = function(a) {" + sanitized + "}; replacer(a);";

									//let func = new Function(["a"], sanitized); // for comparison
									let cache = {};

									let replacer_wrap = function(n) {
										if (n in cache)
											return cache[n];

										// TODO: move this out of replacer_wrap, somehow change "a".
										let source = "var a = \"" + n + "\";var replacer = function(a) {" + sanitized + "}; replacer(a);";
										let interp = new JSInterpreter(source);
										let globalObject = interp.getGlobalScope().object;
										//interp.setProperty(globalObject, "a", interp.nativeToPseudo(n));
										interp.run();
										cache[n] = interp.value;
										return interp.value;
									};

									return done(replacer_wrap, 60*60);
								});
							});
						});
					};

					var replace_n = function(n, cb) {
						api_cache.fetch("youtube_n:" + n, cb, function(done) {
							get_n_replacer(function(replacer) {
								if (!replacer)
									return done(n, false);

								done(replacer(n), 60*60);
							});
						});
					};

					if (player_response.streamingData) {
						if (player_response.streamingData.formats) {
							add_formats(player_response.streamingData.formats, false);
						}

						if (player_response.streamingData.adaptiveFormats) {
							add_formats(player_response.streamingData.adaptiveFormats, true);
						}
					}

					// videos about to premiere don't contain the "formats" key: https://github.com/qsniyg/maxurl/issues/326
					if (player_response.streamingData && player_response.streamingData.formats) {
						var formats = player_response.streamingData.formats;

						for (var j = 0; j < formats.length; j++) {
							var our_format = formats[j];

							if (our_format.bitrate > maxbitrate) {
								maxbitrate = our_format.bitrate;
								maxobj = our_format;
							}
						}
					}

					var subtitles = [];
					if (player_response.captions && player_response.captions.playerCaptionsTracklistRenderer &&
						player_response.captions.playerCaptionsTracklistRenderer.captionTracks) {
						let captionTracks = player_response.captions.playerCaptionsTracklistRenderer.captionTracks;

						for (let track of captionTracks) {
							let subtitle:SubtitleObject = {};
							subtitle.language_code = track.languageCode;
							if (track.name)
								subtitle.title = track.name.simpleText;
							subtitle.url = track.baseUrl + "&fmt=vtt";
							subtitle.mime = "text/vtt";
							subtitles.push(subtitle);
						}
					}

					var final = function() {
						if (available_formats.length === 0) {
							console_error("Unable to find any formats", player_response);
							return options.cb(obj);
						}

						var dashdata = {
							mimes: {}
						};
						var has_adaptive = false;

						var maxbitrate = 0;
						var maxobj = null;

						var baseobj = deepcopy(obj);
						baseobj.is_private = true;
						baseobj.headers = {
							Origin: "https://www.youtube.com",
							Referer: "https://www.youtube.com/"
						};

						for (var i = 0; i < available_formats.length; i++) {
							var our_format = available_formats[i];

							if (!our_format.url) {
								continue;
							}

							if (our_format.imu_is_adaptive) {
								var formatdash = {
									url: our_format.url,
									width: our_format.width,
									height: our_format.height,
									bandwidth: our_format.bitrate,
									id: our_format.itag,
									init_range: our_format.initRange,
									index_range: our_format.indexRange
								};

								var mime_match = our_format.mimeType.match(/^((?:video|audio)\/[^ /;]+);\s*codecs="([^"]+)"$/);
								if (!mime_match) {
									console_error("Unable to parse mime type", our_format.mimeType);
									continue;
								}

								formatdash.mime = mime_match[1];
								formatdash.codecs = mime_match[2];

								// otf streams don't work with dash
								if (!formatdash.init_range) {
									continue;
								}

								// hack, av1 causes issues for some reason
								if (/^av[0-9]+\./.test(formatdash.codecs))
									continue;

								if (!(formatdash.mime in dashdata.mimes))
									dashdata.mimes[formatdash.mime] = [];

								dashdata.mimes[formatdash.mime].push(formatdash);
							} else {
								if (our_format.bitrate > maxbitrate) {
									maxbitrate = our_format.bitrate;
									maxobj = our_format;
								}
							}
						}

						var urls = [];

						// need custom url loader, because origin: null for some reason
						if (Object.keys(dashdata.mimes).length > 0) {
							dashdata.duration = duration;
							var dash = common_functions["create_dash_stream"](dashdata);
							var dashurl = "data:application/dash+xml," + encodeURIComponent(dash);
							urls.push({
								url: dashurl,
								video: {
									type: "dash",
									need_custom_xhr: true
								}
							});
						}

						if (maxobj && maxobj.url) {
							urls.push({
								url: maxobj.url,
								video: true
							});
						}

						if (subtitles.length) {
							for (let url of urls) {
								url.subtitles = subtitles;
							}
						}

						if (urls.length === 0) {
							if (has_sig) {
								console_warn("Encrypted/ciphered videos aren't supported");
							} else {
								console_error("Unknown streamingData object", maxobj);
							}

							return options.cb(obj);
						}

						return options.cb(fillobj_urls(urls, baseobj));
					};

					if (!maxobj) {
						console_error("Unable to find any formats", player_response);
						return options.cb(obj);
					}

					if (!videoid || !available_formats.length) {
						return final(/*maxobj*/);
					}

					common_functions["process_formats"](api_cache, options, available_formats, function() {
						get_n_replacer(function(replacer) {
							if (replacer) {
								for (let format of available_formats) {
									if (!format.url)
										continue;

									if (/[?&]n=/.test(format.url)) {
										format.url = format.url.replace(/([?&]n=)([^&#]+)/, function(_, pre, n) {
											return pre + replacer(n)
										});
									}
								}
							}

							return final(maxobj);
						});
					});
				};

				common_functions["youtube_fetch_embed"](api_cache, options, id, function(data) {
					if (!data || !data.playabilityStatus || data.playabilityStatus.status === "UNPLAYABLE") {
						common_functions["youtube_fetch_watchpage"](api_cache, options, id, parse_player_response);
					} else {
						parse_player_response(data);
					}
				});

				return {
					waiting: true
				};
			}
		}

		if (domain === "images.attvideo.com") {
			// https://images.attvideo.com/image/BQ0mxQXmLsk/camila-cabello-havana-official-music-video-ft-young-thug.jpg
			match = src.match(/^[a-z]+:\/\/[^/]*\/+image\/+([^/]+)\/+[^/]*(?:[?#].*)?$/);
			if (match) {
				return "https://i.ytimg.com/vi/" + match[1] + "/mqdefault.jpg";
			}
		}

		if (domain_nowww === "phim24h.vn") {
			// https://phim24h.vn/5yphoto/thumb-172/BQ0mxQXmLsk/camila-cabello-havana-official-music-video-ft-young-thug.jpg
			//   https://phim24h.vn/5yphoto/BQ0mxQXmLsk/camila-cabello-havana-official-music-video-ft-young-thug.jpg
			newsrc = src.replace(/\/5yphoto\/+thumb-[0-9]+\/+/, "/5yphoto/");
			if (newsrc !== src)
				return newsrc;

			match = src.match(/^[a-z]+:\/\/[^/]*\/+5yphoto\/+([^/]+)\/+[^/]+\.[^/.]+(?:[?#].*)?$/);
			if (match) {
				return "https://i.ytimg.com/vi/" + match[1] + "/mqdefault.jpg";
			}
		}

		if (domain === "zeroinger.herokuapp.com" ||
			// https://you2php.me/thumbnail.php?type=mqdefault&vid=Utx1UMAM4zU
			domain_nowww === "you2php.me") {
			// https://zeroinger.herokuapp.com/thumbnail.php?type=mqdefault&vid=BQ0mxQXmLsk
			//   https://zeroinger.herokuapp.com/thumbnail.php?vid=BQ0mxQXmLsk
			if (/^[a-z]+:\/\/[^/]*\/+thumbnail\.php\?/.test(src)) {
				var queries = get_queries(src);
				var type = queries.type || "mqdefault";
				return "https://i.ytimg.com/vi/" + queries.vid + "/" + type + ".jpg";
			}
		}

		if (domain_nowww === "wapinda.in") {
			// http://www.wapinda.in/vimg.php?v=KAzH-fPJDLQ
			return src.replace(/.*\/vimg\.php\?(?:.*?&)?v=([^&]*).*?$/, "https://i.ytimg.com/vi/$1/mqdefault.jpg");
		}

		if (domain_nowww === "invidio.us" ||
			// https://dev.invidio.us/vi/Ipi0C0L8AM0/maxres.jpg
			domain === "dev.invidio.us" ||
			// thanks to oifj34f34f on github for reporting: https://github.com/qsniyg/maxurl/issues/1251
			// https://yewtu.be/vi/K_CbgLpvH9E/mqdefault.jpg
			domain === "yewtu.be" ||
			// https://docs.invidious.io/instances/
			domain === "vid.puffyan.us" ||
			domain === "yt.artemislena.eu" ||
			domain === "invidious.flokinet.to" ||
			domain === "invidious.projectsegfau.lt" ||
			domain === "invidious.slipfox.xyz" ||
			domain === "invidious.privacydev.net" ||
			domain === "iv.melmac.space" ||
			domain === "iv.ggtyler.dev" ||
			domain === "invidious.lunar.icu" ||
			domain === "inv.nadeko.net" ||
			domain === "inv.tux.pizza" ||
			domain === "invidious.protokolla.fi" ||
			domain === "iv.nboeck.de" ||
			domain === "invidious.private.coffee" ||
			domain === "yt.drgnz.club" ||
			domain === "iv.datura.network" ||
			domain === "invidious.fdn.fr" ||
			domain === "invidious.perennialte.ch" ||
			domain === "yt.cdaut.de" ||
			domain === "invidious.drgns.space" ||
			domain === "inv.us.projectsegfau.lt" ||
			domain === "invidious.einfachzocken.eu" ||
			domain === "invidious.nerdvpn.de" ||
			domain === "inv.n8pjl.ca" ||
			domain === "youtube.owacon.moe" ||
			domain === "invidious.jing.rocks" ||
			domain === "vid.lilay.dev" ||
			domain === "inv.oikei.net" ||
			domain === "invidious.privacyredirect.com") {
			// https://invidio.us/vi/814QFJ4mDaM/mqdefault.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+(vi\/+.*?)(?:[?#].*)?$/, "https://i.ytimg.com/$1");
			if (newsrc !== src)
				return newsrc;

			// https://invidio.us/ggpht/a/AATXAJwaxE0nOWJviTyjNG-tjzryyOoCjXhwoPv4Lg=s48-c-k-c0xffffffff-no-rj-mo
			//   https://lh4.ggpht.com/a/AATXAJwaxE0nOWJviTyjNG-tjzryyOoCjXhwoPv4Lg=s0?imgmax=0
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+ggpht\/+(.*?)(?:[?#].*)?$/, "https://lh4.ggpht.com/$1");
			if (newsrc !== src)
				return newsrc;

			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+watch\?(?:.*&)?v=([^&]+)(?:[&#].*)?$/,
				query_for_id: "https://" + domain + "/watch?v=${id}",
				process: function(done, resp, cache_key) {
					var obj = common_functions["get_videotag_obj"](resp);
					if (!obj)
						return done(null, false);

					return done(fillobj_urls(obj, {
						headers: {
							Referer: resp.finalUrl
						}
					}), 60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "image.bugsm.co.kr") {
			// blank image: (?version= doesn't impact)
			// https://image.bugsm.co.kr/artist/images/200/200498/20049877.jpg?version=20180108002103
			//   https://image.bugsm.co.kr/artist/images/0/200498/20049877.jpg
			//   https://image.bugsm.co.kr/artist/images/original/200498/20049877.jpg -- same
			//
			// non-blank image:
			// https://image.bugsm.co.kr/album/images/170/201403/20140343.jpg
			//   https://image.bugsm.co.kr/album/images/0/201403/20140343.jpg
			//
			// http://image.bugsm.co.kr/artist/images/original/801326/80132659.jpg
			return src.replace(/\/images\/[0-9]*\//, "/images/original/").replace(/\?.*$/, "");
		}

		if (domain_nosub === "wp.com" &&
			domain.match(/i[0-9]\.wp\.com/)) {
			// https://i1.wp.com/img-aws.ehowcdn.com/default/cme/cme_public_images/www_ehow_com/photos.demandstudios.com/getty/article/240/3/178773543_XS.jpg?resize=400%2C267
			//   http://photos.demandstudios.com/getty/article/240/3/178773543.jpg
			// http://i0.wp.com/mmsns.qpic.cn/mmsns/7KE858KbWtJWJFCnub4OrBAHial0SicILILia7G2I1h6VwXG5cWSWpnPQ/0 -- redirect error, but works
			// https://i1.wp.com/images-na.ssl-images-amazon.com/images/G/01/aplusautomation/vendorimages/73da407a-f7e0-4d9a-8943-178d8838be48.jpg._CB329731638_.jpg?ssl=1
			newsrc = remove_queries(src, ["w", "h", "resize", "zoom", "quality", "strip"]);
			if (newsrc !== src)
				return newsrc;

			newsrc = src.replace(/^[a-z]+:\/\/i[0-9]*\.wp\.com\/(.*?)(?:\?.*)?$/, "$1");
			if (newsrc !== src) {
				if (src.match(/[?&]ssl=1(?:&.*)?$/))
					return "https://" + newsrc;
				else
					return "http://" + newsrc;
			}
		}

		if (domain_nosub === "pmdstatic.net") {
			// https is not supported
			// http://img.voi.pmdstatic.net/fit/http.3A.2F.2Fprd2-bone-image.2Es3-website-eu-west-1.2Eamazonaws.2Ecom.2Fvoi.2F2018.2F09.2F05.2Ff6deca2b-fea8-4f1b-8045-fa30eb8515df.2Ejpeg/565x317/quality/80/pamela-anderson-decouvrez-qui-sera-son-partenaire-dans-danse-avec-les-stars-9.jpg
			//   http://prd2-bone-image.s3-website-eu-west-1.amazonaws.com/voi/2018/09/05/f6deca2b-fea8-4f1b-8045-fa30eb8515df.jpeg
			// https://voi.img.pmdstatic.net/fit/http.3A.2F.2Fprd2-bone-image.2Es3-website-eu-west-1.2Eamazonaws.2Ecom.2Fvoi.2F2018.2F09.2F05.2Ff6deca2b-fea8-4f1b-8045-fa30eb8515df.2Ejpeg/565x317/quality/80/pamela-anderson-decouvrez-qui-sera-son-partenaire-dans-danse-avec-les-stars-9.jpg
			//   http://prd2-bone-image.s3-website-eu-west-1.amazonaws.com/voi/2018/09/05/f6deca2b-fea8-4f1b-8045-fa30eb8515df.jpeg
			// http://img.ptv.pmdstatic.net/fit/http.3A.2F.2Fphoto.2Eprogramme.2Etv.2Fupload.2Fslideshow.2Fla-robe-transparente-de-blake-lively-enflamme-le-tapis-rouge-6107.2Fptvs-30022367865-101198.2Ejpg/102x81/crop-from/top/quality/80/blake-lively-au-top-dans-sa-robe-de-sirene.jpg
			//   http://photo.programme.tv/upload/slideshow/la-robe-transparente-de-blake-lively-enflamme-le-tapis-rouge-6107/ptvs-30022367865-101198.jpg -- 404, but url looks correct
			// https://tls.img.pmdstatic.net/scale/http.3A.2F.2Fprd2-bone-image.2Es3-website-eu-west-1.2Eamazonaws.2Ecom.2FTLS.2F2019.2F09.2F20.2F6b64c3e0-3249-4052-ac96-070509713401.2Epng/autox450/quality/65/crop-from/center/picture.jpeg
			//   http://prd2-bone-image.s3-website-eu-west-1.amazonaws.com/TLS/2019/09/20/6b64c3e0-3249-4052-ac96-070509713401.png
			var base = src.replace(/^[a-z]+:\/\/[^/]+\/+(?:fit|scale)\/+(https?\.3A[^/]+)\/.*/, "$1");
			if (base !== src) {
				base = base.replace(/\./g, "%");
				base = decodeURIComponent(base);
				return base;
			}

			// thanks to sn3akybear on github: https://github.com/qsniyg/maxurl/issues/1310
			// https://photo.voici.fr/adam-sandler-lenny-kravitz-billie-eilish-les-stars-presentes-aux-peoples-choice-awards-2024-59444
			// https://voi.img.pmdstatic.net/scale/~1~voi~2024~02~19~15af5e46-e0a6-4c83-a188-c42170541d61.jpeg/autox600/quality/65/crop-from/center/picture.jpeg
			//   https://i.pmdstatic.net/voi/2024/02/19/15af5e46-e0a6-4c83-a188-c42170541d61.jpeg
			match = src.match(/^[a-z]+:\/\/[^/]+\/+[a-z]+\/+~1~(voi)~([0-9]{4})~([0-9]{2})~([0-9]{2})~([-0-9a-f]+\.[a-z]+)\//);
			if (match) {
				return "https://i.pmdstatic.net/" + match[1] + "/" + match[2] + "/" + match[3] + "/" + match[4] + "/" + match[5];
			}
		}

		if (domain_nosub === "pmdstatic.net" && domain.match(/img\..*?pmdstatic\.net$/)) {
			// https://gal.img.pmdstatic.net/fit/https.3A.2F.2Fphoto.2Egala.2Efr.2Fupload.2Fslideshow.2Fquels-parrains-pour-les-revelations-cesar-les-photos-de-la-soiree-chanel-au-petit-palais-27606.2Fsolene-rigot-chien-et-son-parrain-samuel-benchetrit-475504.2Ejpg/400x600/quality/65/solene-rigot-chien-et-son-parrain-samuel-benchetrit.jpg
			//   https://photo.gala.fr/upload/slideshow/quels-parrains-pour-les-revelations-cesar-les-photos-de-la-soiree-chanel-au-petit-palais-27606/solene-rigot-chien-et-son-parrain-samuel-benchetrit-475504.jpg
			// http://gal.img.pmdstatic.net/fit/https.3A.2F.2Fi.2Eimgur.2Ecom.2FQK42KsW.2Ejpg/400x600/quality/65/test.jpg
			//   https://i.imgur.com/QK42KsW.jpg
			// http://img.tra.pmdstatic.net/fit/http.3A.2F.2Fwww.2Efoodreporter.2Efr.2Fupload.2Foriginal.2F5.2Fc.2Fz.2F8.2Fu.2F1258707.2Ejpg/312x240/quality/100/picture.jpg
			newsrc = src.replace(/.*?\.pmdstatic\.net\/fit\/([^/]*).*/, "$1").replace(/\./g, "%");
			if (newsrc !== src)
				return decodeURIComponent(newsrc);
		}

		if (domain_nowww === "gala.fr"
			// thanks to anonymous for reporting:
			// https://www.capital.fr/imgre//fit/http.3A.2F.2Fprd2-bone-image.2Es3-website-eu-west-1.2Eamazonaws.2Ecom.2Fcap.2F2017.2F05.2F09.2F1c21c36a-b809-4662-bf09-1068218410b9.2Ejpeg/896x504/focus-point/50%2C50/background-color/ffffff/quality/70/picture.jpg
			//domain_nowww === "capital.fr"
			) {
			// thanks to anonymous for reporting:
			// http://www.gala.fr/imgre/fit/https.3A.2F.2Fwww.2Egala.2Efr.2Fimgre.2Ffit.2Fhttps.2E3A.2E2F.2E2Fi.2E2Epmdstatic.2E2Enet.2E2Fgal.2E2F2023.2E2F02.2E2F24.2E2F1236eecd-78f3-48e5-9160-1908c9718578.2E2Ejpeg.2F1120x747.2Fquality.2F80.2Fthumbnail.2Ejpg/480x320/quality/80/picture.jpg
			//   https://i.pmdstatic.net/gal/2023/02/24/1236eecd-78f3-48e5-9160-1908c9718578.jpeg
			return src.replace(/^[a-z]+:\/\/[^/]+\/+imgre\//, "https://gal.img.pmdstatic.net/");
		}

		if (domain_nowww === "programme.tv") {
			// thanks to anonymous for reporting:
			// https://www.programme.tv/imgre/fit/~1~tls~2022~01~14~d4150d48-2fa5-4cc5-a26a-7223b8fc3ed4.jpeg/660x370/crop-from/top/quality/80/focus-point/2115,2297/un-village-a-la-diete-quand-tf1-met-toute-une-commune-au-regime.jpg
			//   https://i.pmdstatic.net/tls/2022/01/14/d4150d48-2fa5-4cc5-a26a-7223b8fc3ed4.jpeg
			// https://www.programme.tv/imgre/fit/~1~tel~2024~05~24~45f70d11-7b14-44c3-a648-96d4e723b975.jpeg/640x360/crop-from/top/quality/80/le-remplacant-ce-qu-il-faut-savoir-sur-la-saison-2.jpg
			//   https://i.pmdstatic.net/tel/2024/05/24/45f70d11-7b14-44c3-a648-96d4e723b975.jpeg
			// https://www.programme.tv/imgre/fit/~1~gal~2023~04~24~3a1912e1-f015-4c38-8ddb-465eec4da517.jpeg/107x59/quality/80/affaire-pierre-palmade-le-comedien-va-etre-juge-pour-blessures-involontaires.jpg
			//   https://i.pmdstatic.net/gal/2023/04/24/3a1912e1-f015-4c38-8ddb-465eec4da517.jpeg
			// other:
			// https://www.programme.tv/imgre/fit/~2~program~2f56ff1da0a77487.jpg/630x355/quality/80/la-grande-semaine.jpg
			match = src.match(/\/imgre\/+(?:fit|scale)\/+~1~(tls|tel|gal)~([0-9]{4})~([0-9]{2})~([0-9]{2})~([-0-9a-f]{10,}\.[a-z]+)\//);
			if (match) {
				return "https://i.pmdstatic.net/" + match[1] + "/" + match[2] + "/" + match[3] + "/" + match[4] + "/" + match[5];
			}

			// https://www.programme.tv/imgre/fit/http.3A.2F.2Fprmd.2Etmsimg.2Ecom.2Fassets.2Fp3537284_v_s3_aj.2Ejpg/630x355/quality/80/crop-from/top/princess-protection-program-mission-rosalinda.jpg
			//   https://prmd.tmsimg.com/assets/p3537284_v_s3_aj.jpg
			match = src.match(/\/imgre\/+(?:fit|scale)\/+(https?\.3A\.2F\.2F[^/]+)\//);
			if (match) {
				return src.replace(/^[a-z]+:\/\/[^/]+\/+imgre\/+/, "https://img.voi.pmdstatic.net/");
			}
		}

		if (domain === "dynaimage.cdn.cnn.com") {
			// https://dynaimage.cdn.cnn.com/cnn/q_auto,w_672,c_fill/http%3A%2F%2Fcdn.cnn.com%2Fcnnnext%2Fdam%2Fassets%2F170428012205-28-met-gala-kurkova.jpg
			//   http://cdn.cnn.com/cnnnext/dam/assets/170428012205-28-met-gala-kurkova.jpg
			return decodeURIComponent(src.replace(/.*\/cnn\/[^/]*\//, ""));
		}

		// http://wcmimages.ottawasun.com/images?url=http://storage.ottawasun.com/v1/dynamic_resize/sws_path/suns-prod-images/1297804218043_ORIGINAL.jpg%3Fsize=520x&w=840&h=630
		//   http://storage.ottawasun.com/v1/dynamic_resize/sws_path/suns-prod-images/1297804218043_ORIGINAL.jpg?size=520x -- broken, but 520x520 works
		if (domain === "wcmimages.ottawasun.com" ||
			// http://wcmimages.torontosun.com/images?url=http://postmediatorontosun.files.wordpress.com/2017/12/ts20171211vh16159.jpg&w=840&h=630
			//   https://postmediatorontosun.files.wordpress.com/2017/12/ts20171211vh16159.jpg
			domain === "wcmimages.torontosun.com" ||
			// http://wcmimages.winnipegsun.com/images?url=http://storage.winnipegsun.com/v1/dynamic_resize/sws_path/suns-prod-images/1297974096773_ORIGINAL.jpg%3Fsize=520x&w=840&h=630
			//   http://storage.winnipegsun.com/v1/suns-prod-images/1297974096773_ORIGINAL.jpg
			domain === "wcmimages.winnipegsun.com" ||
			// http://wcmimages.edmontonjournal.com/images?url=https://postmediaedmontonjournal2.files.wordpress.com/2017/10/1014-you-black-hole8057-jpg.jpg&w=107&h=80
			//   https://postmediaedmontonjournal2.files.wordpress.com/2017/10/1014-you-black-hole8057-jpg.jpg
			domain === "wcmimages.edmontonjournal.com" ||
			src.match(/^[a-z]+:\/\/wcmimages\.[^/]*\/images\?url=http/)) {
			//return decodeURIComponent(src.replace(/.*\/images\?[^/]*url=/, ""));
			//return src.replace(/.*\/images\?url=([^&]*).*/, "$1");
			newsrc = decodeURIComponent(src.replace(/^[a-z]+:\/\/[^/]*\/images.*?[?&]url=([^&]*).*/, "$1"));
			if (newsrc !== src)
				return newsrc;
		}

		// moved to thumbor section
		if (false && domain === "i.amz.mshcdn.com") {
			// https://i.amz.mshcdn.com/S4Fr7rEpLL-QZnU3bsNT5ORJzYQ=/364x130/https%3A%2F%2Fblueprint-api-production.s3.amazonaws.com%2Fuploads%2Fstory%2Fthumbnail%2F73835%2Fd72a8d3f-baf0-4132-b6f9-358d27d1c0c9.JPG
			//   https://blueprint-api-production.s3.amazonaws.com/uploads/story/thumbnail/73835/d72a8d3f-baf0-4132-b6f9-358d27d1c0c9.JPG
			// https://i.amz.mshcdn.com/vWTWthC534bzcGDk15NwrBy-dd4=/fit-in/1200x9600/https%3A%2F%2Fblueprint-api-production.s3.amazonaws.com%2Fuploads%2Fcard%2Fimage%2F54484%2FGettyImages-520238014.jpg
			// doesn't work:
			// https://i.amz.mshcdn.com/gXMzg2Z3xmXPa7EhIYOuwMmUu6M=/950x534/filters:quality(90)/2014%2F11%2F02%2F05%2Frihanna.40a2d.jpg
			//return decodeURIComponent(src.replace(/.*i\.amz\.mshcdn\.com\/[^/]*\/[^/]*\/[^/]*\/([^/]*).*/, "$1"));
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/[^/]*=\/[0-9]+x[0-9]+\/(?:filters:[^/]*\/)?(https?(?:%3A|:\/\/))/, "$1");
			if (newsrc !== src)
				return decodeURIComponent(newsrc);
		}

		if (host_domain_nosub === "yahoo.com" && string_indexof(host_domain, "search.") >= 0 && options.element) {
			if (options.element.parentElement && options.element.parentElement.tagName === "A") {
				match = options.element.parentElement.href.match(/^[a-z]+:\/\/[^/]*images\.search\.[^/]+\/+(?:search\/+images|images\/+view)(?:;.*?)\?(?:.*&)?imgurl=([^&]+)/);
				if (match) {
					newsrc = add_http(decodeURIComponent(match[1]));
					if (newsrc !== src)
						return newsrc;
				}
			}
		}

		if ((domain_nosub === "yimg.com" && domain.match(/^(?:[sl]|ct)[0-9]*\.yimg\.com/)) ||
			// https://movies.yahoo.com.tw/y/r/w520/bt/api/res/1.2/7CVvg8ycHHyQQhIFbt0eFw--~A/YXBwaWQ9dHdhYnVuZXdzO2ZpPWZpbGw7dz0xMzY1O2g9MjA0ODs-/http://media.zenfs.com/en/homerun/feed_manager_auto_publish_494/a292a5af4b414a75fc4aa1d0762bc2f2
			//   http://media.zenfs.com/en/homerun/feed_manager_auto_publish_494/a292a5af4b414a75fc4aa1d0762bc2f2
			// https://movies.yahoo.com.tw/x/r/w340/i/o/production/movie-photos/December2018/J2l1xQpwWxuv2BGAQk3D-5568x3712.jpg
			//   https://movies.yahoo.com.tw/i/o/production/movie-photos/December2018/J2l1xQpwWxuv2BGAQk3D-5568x3712.jpg
			// https://movies.yahoo.com.tw/x/r/h340/i/o/production/movie-photos/September2018/b3VeqXiLz0dWg7fRKSWf-533x800.jpg
			//   https://movies.yahoo.com.tw/i/o/production/movie-photos/September2018/b3VeqXiLz0dWg7fRKSWf-533x800.jpg
		   domain_nosub === "yahoo.com.tw") {
			// http://l.yimg.com/bt/api/res/1.2/YIgTLkK5SkGYHzqDt4_e8Q--/YXBwaWQ9eW5ld3M7cT04NQ--/http:/mit.zenfs.com/316/2011/11/T-ZUCKERBERG_AP.jpg
			//   http://mit.zenfs.com/316/2011/11/T-ZUCKERBERG_AP.jpg
			// https://s.yimg.com/uu/api/res/1.2/dO0cMruL5vXOYMSnK577KQ--~B/aD03OTg7dz0xMzMwO3NtPTE7YXBwaWQ9eXRhY2h5b24-/https://s.yimg.com/cd/resizer/2.0/FIT_TO_WIDTH-w1330/a8b0bce04276cee4a1a80ea615a18c6e087e3b28.jpg
			//   https://s.yimg.com/cd/resizer/2.0/FIT_TO_WIDTH-w1330/a8b0bce04276cee4a1a80ea615a18c6e087e3b28.jpg
			// https://s.yimg.com/ny/api/res/1.2/guu198chJ6n8wlBLHhuLtg--/YXBwaWQ9aGlnaGxhbmRlcjtzbT0xO3c9NDUwO2g9MzAwO2lsPXBsYW5l/http://media.zenfs.com/en_us/News/Reuters/2017-03-17T012117Z_1_LYNXMPED2G03G_RTROPTP_2_PEOPLE-EMMAWATSON.JPG.cf.jpg
			//   http://media.zenfs.com/en_us/News/Reuters/2017-03-17T012117Z_1_LYNXMPED2G03G_RTROPTP_2_PEOPLE-EMMAWATSON.JPG
			// https://s.yimg.com/uu/api/res/1.2/1aGXhnnFE3EBXf7EvkNT6w--~B/Zmk9c3RyaW07aD0xNjA7cHlvZmY9MDtxPTgwO3c9MzQwO3NtPTE7YXBwaWQ9eXRhY2h5b24-/https://media.zenfs.com/creatr-images/GLB/2018-06-15/acf56170-70a4-11e8-ad9e-1f5591b0f4d1_trump-kim-new.jpg.cf.webp
			//   https://media.zenfs.com/creatr-images/GLB/2018-06-15/acf56170-70a4-11e8-ad9e-1f5591b0f4d1_trump-kim-new.jpg
			// http://l2.yimg.com/bt/api/res/1.2/K9XINOdK8vorcF7Ed__x2g--/YXBwaWQ9eW5ld3M7cT04NTt3PTMxMA--/http://media.zenfs.com/en-US/blogs/partner/emma_watson_bling_ring.jpg
			//   http://media.zenfs.com/en-US/blogs/partner/emma_watson_bling_ring.jpg
			// https://s.yimg.com/ny/api/res/1.2/i7vByicVXw.SMw0TEmwy5Q--~A/YXBwaWQ9aGlnaGxhbmRlcjtzbT0xO3c9ODAw/http://media.zenfs.com/en/homerun/feed_manager_auto_publish_494/e1f72d9e2dc10d66297f7241501c98bd
			//   https://media.zenfs.com/en/homerun/feed_manager_auto_publish_494/e1f72d9e2dc10d66297f7241501c98bd
			// https://ct.yimg.com/xd/api/res/1.2/sZNPkU7aHGDv1ysfUUaZHA--/YXBwaWQ9eXR3YXVjdGlvbnNlcnZpY2U7aD04MDA7cT04NTtyb3RhdGU9YXV0bzt3PTgwMA--/https://s.yimg.com/ob/image/4deef77a-5e3b-438b-8024-627e0eed0e72.jpg
			//   https://s.yimg.com/ob/image/4deef77a-5e3b-438b-8024-627e0eed0e72.jpg
			// https://s.yimg.com/ny/api/res/1.2/4WntAF7kdtkpQHSyXxDQGA--~A/YXBwaWQ9aGlnaGxhbmRlcjtzbT0xO3c9MjA1MDtoPTMwMDA7aWw9cGxhbmU-/http:/l.yimg.com/os/251/2012/11/13/156279341-10-jpg_021614.jpg
			newsrc = src
				.replace(/.*\/+..\/+api\/+res\/+1\.2\/+[^/]*\/[^/]*\/(https?:)\/{1,2}(.*?)(?:\.cf\.(?:jpg|webp))?$/, "$1//$2")
				.replace(/^http:\/\/l\.yimg\.com\//, "https://l.yimg.com/")
				.replace(/^([a-z]*:\/)([^/])/, "$1/$2")
				.replace(/(:\/\/[^/]*\/)x\/+r\/+[wh][0-9]+\/+i\/+/, "$1i/");
			if (newsrc !== src)
				return newsrc;
		}

		if (false && domain === "media.zenfs.com") {
			// wip
			// http://media.zenfs.com/en-US/homerun/w_988/a6ca1ccb43ed5e7ef568057bf72638a2 -- 2137x3000
		}

		if (domain === "image.iol.co.za" ||
			// thanks to MinuteAd8502 on github: https://github.com/qsniyg/maxurl/issues/814
			// https://image.tfgmedia.co.za/image/1/process/750x750?source=https://cdn.tfgmedia.co.za/06/ProductImages/57149527.jpg
			//   https://cdn.tfgmedia.co.za/06/ProductImages/57149527.jpg
			domain === "image.tfgmedia.co.za") {
			// https://image.iol.co.za/image/1/process/620x349?source=https://inm-baobab-prod-eu-west-1.s3.amazonaws.com/public/inm/media/2017/12/28/iol/665/18156546_10155339323235555_1085978007028663507_o.jpg
			//   https://inm-baobab-prod-eu-west-1.s3.amazonaws.com/public/inm/media/2017/12/28/iol/665/18156546_10155339323235555_1085978007028663507_o.jpg
			newsrc = src.replace(/.*\/process\/.*\?.*source=([^&]*).*/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "image-prod.iol.co.za") {
			// https://image-prod.iol.co.za/resize/1550x999999?source=https://inm-baobab-prod-eu-west-1.s3.amazonaws.com/public/inm/iol/media/image/2020/05/15/47989928/CTcase3.jpg&operation=CROP&offset=0x0&resize=607x355
			//   https://inm-baobab-prod-eu-west-1.s3.amazonaws.com/public/inm/iol/media/image/2020/05/15/47989928/CTcase3.jpg
			// https://image-prod.iol.co.za/16x9/650?source=https://xlibris.public.prod.oc.inl.infomaker.io:8443/opencontent/objects/746c3ec4-bde0-53e8-99fe-edf093c9ccc0&operation=CROP&offset=38x56&resize=2899x1629
			// https://image-prod.iol.co.za/16x9/410/Gang-linked-to-Ndwedwe-top-cop-s-murder-killed-in-shootout-with-police-SAPS-K9-killed?source=https://xlibris.public.prod.oc.inl.infomaker.io:8443/opencontent/objects/60126660-b5e8-52d1-8214-1bfd4bf82d94
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+(?:[0-9]+x[0-9]+|resize)\/+[0-9]+(?:x[0-9]+)?(?:\/+[^/]*)?\?(?:.*&)?source=([^&]+).*?$/, "$1");
			if (newsrc !== src) {
				newsrc = decodeuri_ifneeded(newsrc);
				// needs authorization
				if (!/:\/\/xlibris\.[^/]+\.infomaker\.io:/.test(newsrc)) {
					return newsrc;
				}
			}
		}

		// moved to thumbor section
		/*if (false && string_indexof(domain, "imageresizer.static9.net.au") >= 0) {
			//return decodeURIComponent(src.replace(/.*imageresizer\.static9\.net\.au\/[^=/]*=\/[0-9]+x[0-9]+\//, ""));
			return decodeURIComponent(src.replace(/.*imageresizer\.static9\.net\.au\/.*?\/([^/.?&]*%3A%2F%2F)/, "$1"));
		}*/

		if (domain_nosub === "squarespace.com" &&
			domain.match(/^static[0-9]*\.squarespace\.com/)) {
			// https://static1.squarespace.com/static/56e08f834c2f850f604de326/5aa3c6d141920255c00dfa67/5aa3c705652dea7e55277e8f/1520682759079/POR_Stylist_Letitia+Wright_1.jpg?format=500w
			//   https://static1.squarespace.com/static/56e08f834c2f850f604de326/5aa3c6d141920255c00dfa67/5aa3c705652dea7e55277e8f/1520682759079/POR_Stylist_Letitia+Wright_1.jpg?format=original
			newsrc = src.replace(/(?:\?.*)?$/, "?format=original");
			if (newsrc !== src)
				return {
					url: newsrc,
					head_wrong_contentlength: true
				};
		}

		if (domain === "images.squarespace-cdn.com") {
			// thanks to Lerortle on greasyfork
			// original & 2500w don't work
			// https://static1.squarespace.com/static/5af7497355b02c256beb398f/5ca91c12b208fc8763436403/5ca9236bf4e1fc950f180091/1554588542724/JM2_0214.jpg -- adding ?format=original removes format
			// https://images.squarespace-cdn.com/content/5af7497355b02c256beb398f/1554588539422-SOGLCVARD0WFVBETEVV2/JM2_0214.jpg?format=500w&content-type=image%2Fjpeg
			//   https://images.squarespace-cdn.com/content/5af7497355b02c256beb398f/1554588539422-SOGLCVARD0WFVBETEVV2/JM2_0214.jpg?content-type=image%2Fjpeg
			//
			// no format doesn't work
			// https://static1.squarespace.com/static/5af7497355b02c256beb398f/5ca91c12b208fc8763436403/5ca92359e4966bd72ecaf3c5/1554588550591/CF039538+v2+CU+copy.jpg -- adding ?format=original results in 2500w
			// https://images.squarespace-cdn.com/content/5af7497355b02c256beb398f/1554588547904-N1RMALTJ0CDMXDDMEZL6/CF039538+v2+CU+copy.jpg?format=1000w&content-type=image%2Fjpeg
			//   https://images.squarespace-cdn.com/content/5af7497355b02c256beb398f/1554588547904-N1RMALTJ0CDMXDDMEZL6/CF039538+v2+CU+copy.jpg?format=2500w&content-type=image%2Fjpeg
			//
			// https://images.squarespace-cdn.com/content/5ad803f6f8370ac56e54a302/1554142468529-R05GL9RO9KSTOOTTT21Y/500w?content-type=image%2Fjpeg
			//   https://images.squarespace-cdn.com/content/5ad803f6f8370ac56e54a302/1554142468529-R05GL9RO9KSTOOTTT21Y?content-type=image%2Fjpeg
			//
			// proxy? or just image name?
			// https://images.squarespace-cdn.com/content/589e834eff7c50486de031c3/1587075064704-H0L0WI13DJ5V81WAIVQ5/https%25253A%25252F%25252Fstatic.onecms.io%25252Fwp-content%25252Fuploads%25252Fsites%25252F28%25252F2020%25252F02%25252Fqatar-qsuites-seat-FREEQATAR0519.jpg?content-type=image%2Fjpeg
			//   triple URI encoded, decodes to: https://static.onecms.io/wp-content/uploads/sites/28/2020/02/qatar-qsuites-seat-FREEQATAR0519.jpg

			var contenttype = get_queries(src)["content-type"];
			let queries = {};
			if (contenttype) queries["content-type"] = contenttype;

			newsrc = src
				.replace(/\?.*/, "")
				.replace(/\/+[0-9]+w$/, "");

			var urls = [];

			queries.format = "original";
			urls.push(add_queries(newsrc, queries));

			queries.format = "2500w";
			urls.push(add_queries(newsrc, queries));

			delete queries.format;
			urls.push(add_queries(newsrc, queries));

			return urls;
		}

		if (domain_nosub === "sqspcdn.com") {
			// https://static1.1.sqspcdn.com/static/p/1143251/17399689/1359875559457/img_2816.jpg?asThumbnail=true&token=s3nIU6nvLYSGVP5b0zHkHk4Xntc%3D
			//   https://static1.1.sqspcdn.com/static/p/1143251/17399689/1359875559457/img_2816.jpg?token=s3nIU6nvLYSGVP5b0zHkHk4Xntc%3D
			if (/\/static\/+p\/+[0-9]+\/+[0-9]+\/+[0-9]+\//.test(src)) {
				return keep_queries(src, ["token"]);
			}
		}

		if (domain === "static.onecms.io") {
			// thanks to remlap on discord for reporting
			// https://static.onecms.io/wp-content/uploads/sites/14/2020/07/31/InStyle-September-Zendaya-2-2000.jpg
			//   https://static.onecms.io/wp-content/uploads/sites/14/2020/07/31/InStyle-September-Zendaya-2.jpg
			newsrc = src.replace(/(\/wp-content\/+uploads\/+sites\/+[0-9]+\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[^/]+)-2000(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nowww === "watchdust.com") {
			// https://watchdust.com/wp-content/uploads/2020/12/EXPLORE-FEATURED-CONTENT_v2.png
			if (/\/wp-content\/+uploads\/+[0-9]{4}\/+[0-9]{2}\/+EXPLORE-FEATURED-CONTENT_v2\./.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}
		}

		// /wp/uploads:
		// http://ksassets.timeincuk.net/wp/uploads/sites/46/2017/02/oscars.jpg
		if ((domain_nosub === "wordpress.com" && string_indexof(domain, ".files.wordpress.com") >= 0) ||
			//domain.indexOf("typeset-beta.imgix.net") >= 0 ||

			// what about pngs? shouldn't this be replaced to ?fm=png?
			// https://nylon-img.imgix.net/featured_images/attachments/000/008/458/original/Emma_Watson_Gravity_Premieres_NYC_Part_4_uWbHv1Bg6Owx.jpg?auto=format&ch=Width%2CDPR&q=75&w=640&ixlib=js-1.1.1&s=1587e8684f7fef1feac6d703480a760b
			((domain_nosub === "imgix.net" ||
			  // https://imgix.bustle.com/uploads/getty/2018/3/14/a38ca3e6-056e-4aef-9c2b-1b00a134d7be-getty-917851058.jpg?w=970&h=582&fit=crop&crop=faces&auto=format&q=70
			  domain === "imgix.bustle.com" ||
			  // https://imgix.ovp.tv2.dk/s/73/45137373-da3fa00af722541b2a7b64cdb7847f0c.jpeg?auto=format%2Ccompress&fit=min&crop=top&w=200
			  domain === "imgix.ovp.tv2.dk" ||
			  // https://imgix.elitedaily.com/elite-daily/2015/12/06102252/elitedaily-fox-xfiles.jpg?w=945&h=574&auto=format&q=70&fit=crop&crop=faces
			  domain === "imgix.elitedaily.com" ||
			  // https://imgix.thezoereport.com/zoe-report/2017/11/margot-robbie-style-versace-gold-gown-web.jpg?w=640&fit=max&auto=format&q=70
			  domain === "imgix.thezoereport.com" ||
			  // https://cdn-imgix-open.headout.com/blog/Paris+Guide/ND-exterior.JPG?auto=compress&fm=pjpg&fit=min&crop=faces&w=600&h=600&q=20
			  domain === "cdn-imgix-open.headout.com" ||
			  // https://images.assettype.com/mediaone%2F2018-06%2F2da714b8-3908-47f6-86fa-8a88ea1ef9d8%2Femma_stone.jpg?w=480&auto=format%2Ccompress&fit=max
			  domain === "images.assettype.com" ||
			  // thanks to anonymous for reporting:
			  // https://media.assettype.com/bdnews24-english%2F2023-10%2F43ab7fbd-585d-4834-a210-edd83e85a707%2Fniger_junta_111023_01.jpeg?auto=format%2Ccompress&fit=max&w=732
			  domain === "media.assettype.com" ||
			  // https://images.seoghoer.dk/s3fs-public/storage_1/media/kylie_jenner_1.jpg?ixlib=imgixjs-3.4.0&w=200
			  domain === "images.seoghoer.dk" ||
			  // https://static.camp-fire.jp/uploads/project_version/image/390115/00102017-a11b-48ed-8d7f-fad2faa496b4.jpg?ixlib=rails-2.1.4&auto=format&w=500
			  (domain === "static.camp-fire.jp" && string_indexof(src, "/uploads/") >= 0) ||
			  // https://media.popculture.com/2020/11/sadie-robertson-getty-20098523.jpeg?auto=webp&crop=2:1&width=640&height=320
			  domain === "media.popculture.com" ||
			  // thanks to fedesk on discord
			  // https://img.urbania.ca/media/2019/08/Image-d%E2%80%99iOS.jpg?fm=webp&quality=75&fit=max&width=1400&height=1400
			  (domain === "img.urbania.ca" && string_indexof(src, "/media/") >= 0) ||
			  // thanks to remlap
			  // https://images.thefacecdn.com/images/The-Face_ZAMAR_OliviaRodrigo_1-4x5.jpg?fit=crop&crop=focalpoint&fp-x=0.5&fp-y=0.5&w=2800 -- upscaled
			  (domain === "images.thefacecdn.com" && string_indexof(src, "/images/") >= 0) ||
			  // thanks to Liz on discord
			  // https://image6.thenewslens.com/2019/2/kjg955id8363y8hjz50ck5vwrz4os5.jpg?auto=compress&fit=crop&h=648&q=85&updated_at=2019-02-28-18-08-19&w=1080
			  (domain_nosub === "thenewslens.com" && /^image[0-9]*\./.test(domain)) ||
			  // thanks to Liz on discord
			  // https://imgix.kotaku.com.au/content/uploads/sites/3/2021/08/27/age-of-empires-4-gamescom-2021-1.jpg?ar=16%3A9&auto=format&fit=crop&q=65&w=1280
			  domain === "imgix.kotaku.com.au" ||
			  // https://imgix.billedbladet.dk/2023-09-08/_han2265.jpg?ixlib=vue-2.9.1&auto=format&fit=min&fp-x=0.5&fp-y=0.5&w=799
			  domain === "imgix.billedbladet.dk" ||
			  // https://imgix.elle.dk/2023-09-13/netflix-ehrengard3448-1-1_3.jpg?ixlib=vue-2.9.1&auto=format&ar=414:548&fit=crop&fp-x=0.6&fp-y=0.21
			  domain === "imgix.elle.dk" ||
			  // https://imgix.romper.com/2016/8/22/584902004.jpg?w=640&fit=max&auto=format&q=70
			  domain === "imgix.romper.com") &&
			 !src.match(/[?&]s=[^/]*$/)) ||
			// https://stream-cloud-uploads.imgix.net/images/44430/90a03829-cc48-4211-a285-8b68006502b1.68D6A70A-1FC6-4DBA-BF4C-81D80934E9B7.jpeg?ro=0&s=5f6ef1dd7da8506302abf5387073024c&w=740&auto=format&fit=max
			// seems like &s= can be removed here
			domain === "stream-cloud-uploads.imgix.net" ||

			// http://hmg-prod.s3.amazonaws.com/images/bgus-1060427-037-1-1510856807.jpg
			// http://s3.amazonaws.com/hmg-prod/images/bgus-1060427-037-1-1510856807.jpg
			amazon_container === "hmg-prod" ||
			// https://blogs-images.forbes.com/niallmccarthy/files/2017/11/20171114_Cigarettes.jpg?width=960
			domain === "blogs-images.forbes.com" ||
			// https://images-production.global.ssl.fastly.net/uploads/images/file/47918/jonah-hill-2015-vs-2017.jpg?auto=compress&fit=crop&h=727&q=55&w=750
			domain === "images-production.global.ssl.fastly.net" ||
			// https://images-production.freetls.fastly.net/uploads/photos/file/116888/selena-gomez-no-bra-2015.jpg?auto=compress&crop=top&fit=max&q=55&w=750
			domain === "images-production.freetls.fastly.net" ||
			// thanks to dym-sh on github: https://github.com/qsniyg/maxurl/issues/1038
			// https://www.fastly.com/cimages/6pk8mg3yh2ee/4zLuDTDqRq5H2Nuj8Ch0jB/d51cd0d20e0881043bec5c84151f1f4f/hero-laptop_1.png?auto=webp&fit=contain&height=345&width=626
			(domain_nowww === "fastly.com" && string_indexof(src, "/cimages/") >= 0) ||
			//domain.indexOf("typeset-beta.imgix.net") >= 0 ||
			//domain.indexOf("cosmouk.cdnds.net") >= 0 ||
			// http://esquireuk.cdnds.net/15/37/2048x2730/2048x2730-felicity-jones-oscars-43-jpg-fe5ebdf1.jpg?resize=768:*
			domain_nosub === "cdnds.net" ||
			/*domain.indexOf("hbz.h-cdn.co") >= 0 ||
			  string_indexof(domain, "cos.h-cdn.co") >= 0 ||*/
			domain_nosub === "h-cdn.co" ||
			// http://cdn.newsapi.com.au/image/v1/00f120191891d8b371ae91eba6290c76?width=316
			domain === "cdn.newsapi.com.au" ||
			// https://images.indianexpress.com/2018/09/feat1.jpg?w=450
			domain === "images.indianexpress.com" ||
			// can't find a test case
			domain === "images.contentful.com" ||
			// https://d.ibtimes.co.uk/en/full/435849/anjem-choudary-shariah-project-protest-brick-lane-pic-ibtimes-co-uk.jpg?w=720&e=f9b092054c209d993bb1be7d435f293a
			domain === "d.ibtimes.co.uk" ||
			// http://akns-images.eonline.com/eol_images/Entire_Site/2014519/rs_300x300-140619060824-600.Harry-Potter-Cast-JR-61914.jpg
			// http://akns-images.eonline.com/eol_images/Entire_Site/2014519/rs_1024x759-140619060822-1024.Harry-Potter-Cast-JR-61914.jpg
			domain === "akns-images.eonline.com" ||
			/*domain.indexOf("www.telegraph.co.uk") >= 0 ||
			// http://subscriber.telegraph.co.uk/content/dam/news/2018/01/08/GettyImages-862428716_trans_NvBQzQNjv4BqZgEkZX3M936N5BQK4Va8RWtT0gK_6EfZT336f62EI5U.jpg?imwidth=480
			domain === "subscriber.telegraph.co.uk" ||
			// https://secure.aws.telegraph.co.uk/content/dam/wellbeing/2016/12/28/graham5_trans_NvBQzQNjv4BqNyaloxhBNUSEitvcqmzeaNrVK9LoR4c_wZH1EhIay9c.jpg?imwidth=480
			string_indexof(domain, "aws.telegraph.co.uk") >= 0 ||*/
			// thanks to anonymous for reporting:
			// https://www.telegraph.co.uk/multimedia/archive/02934/dad02_2934001k.jpg?imwidth=350
			(domain_nosub === "telegraph.co.uk" && /\/(?:content\/+dam|multimedia\/+archive)\//.test(src)) ||
			// https://img.buzzfeed.com/thumbnailer-prod-us-east-1/video-api/assets/175593.jpg?output-format=auto&output-quality=auto&resize=625:*
			domain === "img.buzzfeed.com" ||
			// doesn't work with google's referrer
			// http://p3.music.126.net/MsiMKqHKy4xHxpLHngSuYQ==/19145795975058896.jpg?param=200y200
			(domain_nosub === "126.net" && domain.match(/^p[0-9]*\.music\.126\.net/)) ||
			// https://stat.profile.ameba.jp/profile_images/20180312/04/0d/ir/j/o03980600p_1520796916426_wiwja.jpg?cat=248
			domain === "stat.profile.ameba.jp" ||
			// https://stat.blogskin.ameba.jp/blogskin_images/20181221/11/87/6A/p/o11200520cherrsee1545359990390.png?caw=1120
			domain === "stat.blogskin.ameba.jp" ||
			// https://stat.ameba.jp/user_images/20180222/17/kirarinfairy/75/1c/j/o0414060014136605494.jpg?caw=200
			domain === "stat.ameba.jp" ||
			// http://image.uczzd.cn/5758462716763402626.jpg?id=0&width=480
			domain === "image.uczzd.cn" ||
			// http://img.danawa.com/prod_img/500000/803/712/img/1712803_1.jpg?shrink=500:500&_v=20150119135203
			domain === "img.danawa.com" ||
			// https://img-www.tf-cdn.com/movie/2/dont-worry-he-wont-get-far-on-foot-2018.jpeg?_v=20180709235653&w=1024&h=512&dpr=1&auto=compress&fm=pjpg&fit=crop&crop=faces%2Ctop
			domain === "img-www.tf-cdn.com"||
			// https://6.viki.io/image/85db05c96d2c4a4ba4d6d2fa9798281c.jpeg?x=b&a=0x0&s=460x268&e=t&f=t&cb=1
			domain_nosub === "viki.io" ||
			// https://avatars2.githubusercontent.com/u/1?s=400&v=4
			(domain_nosub === "githubusercontent.com" && domain.match(/^avatars[0-9]*\./)) ||
			// https://bloximages.newyork1.vip.townnews.com/heraldmailmedia.com/content/tncms/assets/v3/editorial/1/9a/19a45cfe-354a-11e3-939d-001a4bcf6878/5800f2836b369.image.jpg?resize=1200%2C675
			(domain_nosub === "townnews.com" && domain.match(/bloximages\..*vip\.townnews\.com/)) ||
			//domain === "bloximages.newyork1.vip.townnews.com" ||
			domain === "steamuserimages-a.akamaihd.net" ||
			// haven't tested, but it's imgix
			//domain === "image.assets.pressassociation.io" ||
			// https://content.assets.pressassociation.io/2018/02/06210749/1324f25e-1b19-4315-9420-e8e027475cf2.jpg?rect=0,183,2355,1325&ext=.jpg
			//domain === "content.assets.pressassociation.io" ||
			(domain_nosub === "pressassociation.io" && domain.match(/\.assets\.pressassociation\.io$/)) ||
			// http://media.immediate.co.uk/volatile/sites/3/2012/05/13874.jpg?quality=90&lb=620,413&background=white
			domain === "media.immediate.co.uk" ||
			// https://images.immediate.co.uk/volatile/sites/3/2018/03/Emma-Watson-Oscars-tattoo-25baac2.jpg?quality=10&lb=620,413&background=white
			domain === "images.immediate.co.uk" ||
			// https://media.gettyimages.com/photos/nick-hewer-arriving-for-the-2012-arqiva-british-academy-television-picture-id848052898?k=6&m=848052898&s=612x612&w=0&h=4QnBTCuNyp6nYhAumGR6k9gqH3iYagsnqkDo0ouGnts=
			// adds watermark, sometimes smaller
			//domain === "media.gettyimages.com" ||
			// https://media.npr.org/assets/artslife/arts/2010/10/keith-richards/keith-richards_wide-68d0d5994c72c50de849d27e7c75519f2c832fc8.jpg?s=1400
			domain === "media.npr.org" ||
			// http://assets.teamrock.com/image/1cfd675c-33c9-4081-a27f-3f41abc88b69?w=800
			domain === "assets.teamrock.com" ||
			// https://media2.woopic.com/api/v1/images/156%2FS6N4g%2Fles-revoltes-rencontre-avec-simon-leclere-et-solene-rigot%7Cx240-WfM.jpg?format=300x175&facedetect=1&quality=85
			(domain_nosub === "woopic.com" && domain.match(/^media[0-9]\.woopic\.com/)) ||
			// http://md1.libe.com/photo/357188-de-gauche-a-droite-louise-grinberg-yara-pilartz-roxane-duran-solene-rigot-et-juliette-darche.jpg?modified_at=1322675617&width=975 -- redirects to the pattern below
			(domain_nosub === "libe.com" && domain.match(/^md[0-9]\.libe\.com/)) ||
			// http://medias.liberation.fr/photo/357188-de-gauche-a-droite-louise-grinberg-yara-pilartz-roxane-duran-solene-rigot-et-juliette-darche.jpg?modified_at=1322675617&width=975
			domain === "medias.liberation.fr" ||
			// https://regmedia.co.uk/2016/08/03/newsboy.jpg?x=442&y=293&crop=1
			domain === "regmedia.co.uk" ||
			// https://imageservice.nordjyske.dk/images/nordjyske.story/2012_05_12/961b43d2-64b8-47df-8c37-1c0e73565fb0.jpg?w=624&mode=crop&scale=both
			domain === "imageservice.nordjyske.dk" ||
			// https://cms.algoafm.co.za/img/or_2018111575720.jpeg?mode=crop&w=320&h=240&anchor=topcenter&scale=both
			(domain === "cms.algoafm.co.za" && string_indexof(src, "/img/") >= 0) ||
			// http://www.gosoutheast.com/images/2015/9/29/Tony_Anderson-150917-JR.jpg?width=300
			(domain_nowww === "gosoutheast.com" && string_indexof(src, "/images/") >= 0) ||
			// http://itpro.nikkeibp.co.jp/atcl/column/17/010900605/011000014/ph01.jpg?__scale=w:450,h:501&_sh=0e0c309803
			//(domain === "itpro.nikkeibp.co.jp" && src.toLowerCase().match(/\.(?:jpg|png)$/)) ||
			// http://trendy.nikkeibp.co.jp/atcl/column/17/011800066/020900003/01.jpg?__scale=w:400,h:267&_sh=08d0b10ff0
			// http://wol.nikkeibp.co.jp/atcl/column/15/011500044/021300142/icon_m.jpg?__scale=w:214,h:147&_sh=0820dc0240
			(domain_nosub === "nikkeibp.co.jp" && src.toLowerCase().match(/\.(?:jpg|png)/)) ||
			// http://s-a4.best.gg/rosters/players/default2.png?image=c_fill,g_south,h_90,w_90
			(domain_nosub === "best.gg" && domain.match(/s-a[0-9]*\.best\.gg/)) ||
			// https://i5.walmartimages.com/asr/5375d30c-11a2-4725-a32d-cb59da53b5a5_1.20c1f4d2ccae8f4840ae88be99babb3e.jpeg?odnHeight=450&odnWidth=450&odnBg=FFFFFF
			(domain_nosub === "walmartimages.com" && domain.match(/i[0-9]*\.walmartimages\.com/)) ||
			// https://nails.newsela.com/s3/newsela-media/article_media/2017/10/elem-hogwarts-express-rescue-fa623e3b.jpg?crop=0,139,1366,907&height=497&width=885
			domain === "nails.newsela.com" ||
			// http://ojsfile.ohmynews.com/CT_T_IMG/2018/0201/IE002279450_APP.jpg?2034
			domain === "ojsfile.ohmynews.com" ||
			// https://lumiere-a.akamaihd.net/v1/images/image_4cca1969.jpeg?region=0,0,512,288
			domain === "lumiere-a.akamaihd.net" ||
			// http://img.lum.dolimg.com/v1/images/homepage_sabrinacarpenter_hero_ec42cce5.jpeg?region=704,0,519,480
			domain === "img.lum.dolimg.com" ||
			// http://www.xxlmag.com/files/2018/02/Iggy-Azalea-interview.jpeg?w=980&q=75
			// http://xxlmag.com/files/2018/02/Iggy-Azalea-interview.jpeg?w=980&q=75
			domain_nowww === "xxlmag.com" ||
			// https://image.insider.com/5d1b732b21a8617668149572?width=1100&format=jpeg&auto=webp
			domain === "image.insider.com" ||
			// https://i.insider.com/520e7783eab8ea6f27000005?width=1300&format=jpeg&auto=webp
			domain === "i.insider.com" ||
			// https://image.businessinsider.com/5bc0aeeddde8677f346b9a82?width=1100&format=jpeg&auto=webp
			domain === "image.businessinsider.com" ||
			// https://video-images.vice.com/articles/592ed99499168942accbdf39/lede/1496243427040-BadGyal_JavierRuiz_2.jpeg?crop=1xw:0.4212xh;0xw,0.3534xh&resize=1200:*
			// https://i-d-images.vice.com/images/2016/07/29/club-marab-cierra-su-temporada-con-bad-gyal-la-princesa-del-trap-cataln-body-image-1469779091.jpg?crop=1xw:0.5625xh;center,center&resize=0:*
			// https://images.vice.com/noisey/content-images/article/die-antwoord-gucci-coochie/Screen-Shot-2016-05-18-at-16-32-36.jpg?crop=1xw%3A0.8371478873239436xh%3Bcenter%2Ccenter&resize=650%3A*&output-quality=55
			(domain_nosub === "vice.com" && domain.match(/images\.vice\.com$/)) ||
			// https://i.imgur.com/ajsLfCa_d.jpg?maxwidth=520&shape=thumb&fidelity=high
			// https://i.imgur.com/3FQPndz.jpg?play
			// https://i.imgur.io/MzDoRsM_d.webp?maxwidth=0&fidelity=high
			((domain === "i.imgur.com" || domain === "i.imgur.io") && !src.match(/\?[0-9]+$/)) ||
			// https://images.discordapp.net/.eJwFwcsRgyAQANBeKIDltwIWkB48IjKgo4FhN6dMes97X_GZt1hFYx60Ahwn5T4PSdxnqkXW3utd0jhJ5v5AYk65PeXNBAaVDSF6ZVR0WitvwGrEBbVzyvsQ7eIMvPYWM27yGlX8_v3wIf4.2PoWG1MegEuQyuPigedqzEcwm7Y?width=462&height=600
			domain === "images.discordapp.net" ||
			// https://images.theconversation.com/files/159874/original/image-20170308-14932-n1fsc6.jpg?ixlib=rb-1.1.0&q=45&auto=format&w=1000&fit=clip
			domain === "images.theconversation.com" ||
			// https://www.rspb.org.uk/globalassets/images/birds-and-wildlife/non-bird-species-illustrations/grey-squirrel_1200x675.jpg?preset=landscape_mobile
			(domain_nowww === "rspb.org.uk" && string_indexof(src, "/globalassets/") >= 0) ||
			// http://media.beliefnet.com/~/media/photos/inspiration/galleries/20-most-beautiful-places-in-the-world/tunnel_of_love_ukraine.jpg?as=1&w=400
			(domain === "media.beliefnet.com" && (/\/media\//i).test(src)) ||
			// https://www.ramblers.org.uk/~/media/Images/Walk%20magazine/Features/Winter%202013%20and%20past/12.jpg?h=394&amp;la=en&amp;w=200
			(domain_nowww === "ramblers.org.uk" && (/\/media\//i).test(src)) ||
			// https://warnerbrosuk.azureedge.net/~/media/images/warner-bro/movies/aquaman/37.jpg?w=400
			// https://warnerbrosuk.azureedge.net/~/Media/Images/warner-bro/movies/aquaman/37.jpg?w=400
			(domain === "warnerbrosuk.azureedge.net" && (/\/media\//i).test(src)) ||
			// https://www.warnerbros.co.uk/~/media/images/warner%20bro/movies/aquaman/37.ashx?mw=1200
			(domain_nowww === "warnerbros.co.uk" && (/\/media\//i).test(src)) ||
			// http://img.cdn2.vietnamnet.vn/Images/english/2017/11/10/09/20171110093351-sez.jpg?w=80&h=45
			// http://imgs.vietnamnet.vn/Images/2015/11/17/10/20151117104955-av-240x160.jpg?w=10
			(domain_nosub === "vietnamnet.vn" && /^(?:[^/]*\.)?img(?:\.cdn[0-9]*|s)\./.test(domain)) ||
			// http://img.cdn2.vietnamnet.vn/Images/english/2018/05/23/09/20180523095208-3.jpg?w=80&h=45
			//domain.match(/img\.cdn[0-9]*\.vietnamnet\.vn/) ||
			// https://i.gadgets360cdn.com/large/tara_main_1511903994721.jpg?output-quality=70&output-format=webp
			domain === "i.gadgets360cdn.com" ||
			// https://i.ndtvimg.com/video/images/vod/medium/2018-02/big_478201_1517848813.jpg?downsize=298:224&output-quality=70&output-format=webp
			// https://c.ndtvimg.com/2020-01/gmvetdoo_gadgets-360_640x480_27_January_20.jpg?downsize=140:105&output-quality=80&output-format=jpg
			domain_nosub === "ndtvimg.com" ||
			// https://d3lp4xedbqa8a5.cloudfront.net/s3/digital-cougar-assets/Now/2018/02/16/44694/Healthy-pizza.jpg?width=132&height=107&mode=crop&scale=both&anchor=middlecenter&quality=85
			domain === "d3lp4xedbqa8a5.cloudfront.net" ||
			// https://brnow.org/getattachment/cc67f65b-b0b7-4365-abd5-258e4e1c1680?maxsidesize=50
			(domain_nowww === "brnow.org" && string_indexof(src, "/getattachment/") >= 0) ||
			// https://p3.ssl.cdn.btime.com/t01b3d8cb1040fbe0ba.jpg?size=730x1110
			(domain_nosub === "btime.com" && domain.match(/p[0-9]*\.(?:ssl\.)?cdn\.btime\.com/)) ||
			// http://images.twistmagazine.com/uploads/images/file/21604/sabrina-carpenter-selfie.jpg?fit=crop&h=666&w=500
			domain === "images.twistmagazine.com" ||
			// https://sites.google.com/site/faustrolemodel/_/rsrc/1427391714266/sabrina-carpenter/452204682.jpg?height=400&width=331
			domain === "sites.google.com" ||
			// https://images.pexels.com/photos/68147/waterfall-thac-dray-nur-buon-me-thuot-daklak-68147.jpeg?h=350&auto=compress&cs=tinysrgb
			domain === "images.pexels.com" ||
			// https://images.unsplash.com/photo-1503320748329-9455bea97a68?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=324bf91b29fb196d6aefb2f4806d04c0&auto=format&fit=crop&w=1000&q=60
			domain === "images.unsplash.com" ||
			// tshop will automatically be replaced to shop
			// https://tshop.r10s.jp/book/cabinet/3966/4907953093966.jpg?fitin=200:300&composite-to=*,*|200:300
			//   https://shop.r10s.jp/book/cabinet/3966/4907953093966.jpg
			//domain === "tshop.r10s.jp" ||
			// https://tshop.r10s.com/4bf21390-ec8c-11e4-9162-005056b75bda/upload/np/A685-M1.jpg?_ex=330x330
			domain_nosub === "r10s.com" ||
			// https://rakuma.r10s.jp/d/strg/ctrl/25/af89f9418a6f8fc899e2e0a280d79acd0c274d16.79.1.25.2.jpg?fit=inside%7C300%3A300
			//domain === "rakuma.r10s.jp" ||
			// https://r.r10s.jp/ran/img/1001/0004/943/674/259/502/10010004943674259502_1.jpg?fitin=100:100
			domain_nosub === "r10s.jp" ||
			// http://static.netlife.vn//2017/11/07/14/43/sao-han-trong-1-tuan-tara-den-viet-nam-2-lan_1.jpg?maxwidth=480
			domain === "static.netlife.vn" ||
			// http://rs.phunuonline.com.vn/staticFile/Subject/2018/02/14/7391244/unnamed_182138203.png?w=51&h=32
			domain === "rs.phunuonline.com.vn" ||
			// https://images.nbcolympics.com/www.nbcolympics.com/field_image/22February2018/shuster_smile.jpg?impolicy=960x540_rectangle
			domain === "images.nbcolympics.com" ||
			// https://dist.joshinweb.jp/cdshop/img/jacket/P5_G/5863/P5_G5863047W.JPG?impolicy=tp100
			(domain === "dist.joshinweb.jp" && string_indexof(src, "/img/") >= 0) ||
			// https://live-production.wcms.abc-cdn.net.au/2f345d15c7568513477fc44daa552c2d?impolicy=wcms_crop_resize&cropH=709&cropW=1260&xPos=0&yPos=393&width=862&height=485
			domain === "live-production.wcms.abc-cdn.net.au" ||
			// https://compote.slate.com/images/4e1e4179-fb17-436b-a890-1a4fdb417d45.jpeg?width=1180&offset=0x0&rect=1560x1040&height=842
			domain === "compote.slate.com" ||
			// https://media.gannett-cdn.com/29906170001/29906170001_5720100432001_5720093419001-vs.jpg?pubId=29906170001&quality=10
			//domain === "media.gannett-cdn.com" ||
			// https://www.gannett-cdn.com/media/2016/04/15/USATODAY/USATODAY/635963424849581175-GTY-463036250-70683098.JPG?width=299&height=168&fit=bounds
			domain_nosub === "gannett-cdn.com" ||
			// http://www.rdfm-radio.fr/medias/images/media.nrj.fr-2f436x327-2f2017-2f11-2fbiographie-de-mc-fioti-484.jpg?fx=c_180_180 -- dead?
			(domain_nowww === "rdfm-radio.fr" && string_indexof(src, "/medias/") >= 0) ||
			// http://salleobscure.e-monsite.com/medias/images/affiche-premier-contact-arrival-2016-5.jpg?fx=r_1170_600
			(domain === "salleobscure.e-monsite.com" && string_indexof(src, "/medias/") >= 0) ||
			// http://image-api.nrj.fr/02_5a02579e3cb49.png?w=730&h=410
			domain === "image-api.nrj.fr" ||
			// http://api.hdwallpapers5k.com/resource/fileuploads/photos/albums/1400/5382c527-5081-4bf4-8b2b-25ea11356bf4.jpeg?quality=100&w=2560&h=2560&mode=crop
			domain === "api.hdwallpapers5k.com" ||
			// http://images.en.koreaportal.com/data/images/full/14639/rita-ora.jpg?w=600
			(domain_nosub === "koreaportal.com" && domain.match(/images\.[^.]*\.koreaportal\.com/)) ||
			// http://www.officialcharts.com/media/653733/taylor-swift-press-image-1100.jpg?width=796&mode=stretch
			(domain_nowww === "officialcharts.com" && string_indexof(src, "/media/") >= 0) ||
			// https://citywonders.com/media/11395/mt-vesuvius-crater.jpg?anchor=center&mode=crop&quality=65&width=1200&height=900
			(domain_nowww === "citywonders.com" && string_indexof(src, "/media/") >= 0) ||
			// https://fee.org/media/22152/karliekloss_mini.jpg?anchor=center&mode=crop&width=1920&rnd=131388985770000000
			(domain_nowww === "fee.org" && string_indexof(src, "/media/") >= 0) ||
			// http://pix10.agoda.net/hotelImages/519/519394/519394_14031416100018704350.jpg?s=1024x768
			(domain_nosub === "agoda.net" && domain.match(/pix[0-9]*\.agoda\.net/)) ||
			// https://images.pottermore.com/bxd3o8b291gf/1FC5pSmkSg44SMew0osm4Y/afb1fbf505eaf4c6a398b80ca075e014/DracoMalfoy_WB_F6_DracoMalfoyOnBathroomFloorHarryStanding_Still_080615_Land.jpg?w=1330&q=85
			domain === "images.pottermore.com" ||
			// https://www.google.com/s2/u/0/photos/public/AIbEiAIAAABECKjC6cfB5MXfkQEiC3ZjYXJkX3Bob3RvKig5NThhYjU1NjkzZGJkOTBmY2ZhZDAyYjE4NThjZjlmMzZmY2ZiZGY3MAHuuVSn2yIIP3390PZse6G3donZOg?sz=50
			(domain_nowww === "google.com" && src.match(/\/photos\/public\/[^/]*$/)) ||
			// https://images.streamable.com/east/image/pqxns_first.jpg?height=100
			domain === "images.streamable.com" ||
			// https://cdn.amebaowndme.com/madrid-prd/madrid-web/images/sites/121508/7b13cca970a6eae1f46625638213900b_3a2cc2bd26844834e05b77f95b7500b7.jpg?width=724
			domain === "cdn.amebaowndme.com" ||
			// http://www.kaixian.tv/gd/d/file/201803/13/6b65c9bc4e0128a92a0e9fc0aa2d2d2d.jpg?imageView&thumbnail=100y75
			(domain_nowww === "kaixian.tv" && string_indexof(src, "/file/") >= 0) ||
			// http://pic-bucket.nosdn.127.net/photo/0001/2018-01-24/D8SM4CRK00AP0001NOS.jpg?imageView&amp;thumbnail=100y75
			// forbidden with referrer
			// http://imglf6.nosdn.127.net/img/NStLVUtLYlBtSm9PTWJqMmpEVXF5N2pSL1U1a2I5SjhTdG50QzNMRHljblFlV1VQeUtGVUJ3PT0.jpg?imageView&thumbnail=1680x0&quality=96&stripmeta=0&type=jpg
			//(string_indexof(domain, "nosdn.127.net") >= 0 && string_indexof(src, "/photo/") >= 0) ||
			// https://sumo.cdn.tv2.no/imageapi/v2/img/58aff90284ae6c3cc0945755-1519386606657?width=1920&height=1080&location=list
			(domain === "sumo.cdn.tv2.no" && string_indexof(src, "/imageapi/") >= 0) ||
			// http://www.bzqzsj.com/uploads/allimg/181203/1553324424-1.jpg?imageView&thumbnail=100y75
			(domain_nowww === "bzqzsj.com" && string_indexof(src, "/uploads/") >= 0) ||
			// https://media.missguided.com/s/missguided/L4227488_set/1/brown-square-back-thong-swimsuit.jpg?$category-page__grid--1x$
			domain === "media.missguided.com" ||
			// https://photo.venus.com/im/V1092-COB_V2362-COB.0288.s.jpg?preset=product
			domain === "photo.venus.com" ||
			// https://cdn-images.prettylittlething.com/c/4/f/f/c4ffac27c350089f9cb5214a68bad59c7a943bb5_CLW1289_1.JPG?imwidth=60
			domain === "cdn-images.prettylittlething.com" ||
			// https://www.sephora.com/productimages/sku/s2354140-main-zoom.jpg?imwidth=162
			(domain_nowww === "sephora.com" && string_indexof(src, "/productimages/") >= 0) ||
			// http://popcrush.com/files/2014/07/EmmaWatson1.jpg?w=980&q=75
			(domain_nowww === "popcrush.com" && string_indexof(src, "/files/") >= 0) ||
			// http://screencrush.com/files/2013/03/50_shades_of_grey_emma_watson.jpg?w=980&q=75
			(domain_nowww === "screencrush.com" && string_indexof(src, "/files/") >= 0) ||
			// http://assets.cougar.nineentertainment.com.au/assets/Dolly/2014/03/20/52622/3.jpg?mode=max&quality=80&width=1024
			(domain_nosub === "nineentertainment.com.au" && domain.match(/assets\.[^.]*\.nineentertainment\.com\.au/)) ||
			// https://www.thenational.ae/image/policy:1.479136:1499670177/image/jpeg.jpg?f=16x9&w=1024&$p$f$w=2589da4
			(domain_nowww === "thenational.ae" && string_indexof(src, "/image/") >= 0) ||
			// thanks to fedesk on discord:
			// https://www.dagsavisen.no/image/policy:1.1803002:1605699106/image.jpg?f=16x9&w=980&$p$f$w=06ef47e
			(domain_nowww === "dagsavisen.no" && string_indexof(src, "/image/") >= 0) ||
			// https://s3.kh1.co/80e0569ad275cc700a5b9bee37447bd432a63ced.jpg?m=thumb&w=400&h=560
			(domain_nosub === "kh1.co" && domain.match(/s[0-9]*\.kh1\.co/)) ||
			// https://uploads.disquscdn.com/images/9b96ed95917fe3b747f0b441246985a838e3e0b370607817a540b4a40119b9a6.gif?w=800&h=253
			domain === "uploads.disquscdn.com" ||
			// https://www.voidu.com/content/products/gallery/99832a851b23b8a91f296adac...-20180216101631.jpg?width=1140&height=450&mode=crop&scale=both
			// https://voidu.com/content/products/gallery/99832a851b23b8a91f296adac...-20180216101631.jpg?width=1140&height=450&mode=crop&scale=both
			(domain_nowww === "voidu.com" && string_indexof(src, "/gallery/") >= 0) ||
			// https://store.playstation.com/store/api/chihiro/00_09_000/container/US/en/99/UP4139-CUSA10160_00-SURVIVINGMARSFCE//image?_version=00_09_000&platform=chihiro&w=720&h=720&bg_color=000000&opacity=100
			(domain === "store.playstation.com" && string_indexof(src, "/image?") >= 0) ||
			// https://blog.us.playstation.com/tachyon/2020/04/49811271288_81f0c02714_k.jpg?resize=1088,612&crop_strategy=smart&zoom=1.5
			(domain_nosub === "playstation.com" && /^blog\./.test(domain)) ||
			// https://www.snopes.com/tachyon/2021/01/mcdonalds-curved-glass.jpg?resize=1200,630&quality=65
			(domain_nowww === "snopes.com" && string_indexof(src, "/tachyon/") >= 0) ||
			// https://images.interactives.dk/cdn-connect/98f5b7864bfb4efba3e65b9d0c983122.jpg?auto=compress&ch=Width%2CDPR&ixjsv=2.2.4&w=750
			domain === "images.interactives.dk" ||
			// https://toyo-arhxo0vh6d1oh9i0c.stackpathdns.com/media/1200/xl-hero-tire-pr-ra1.jpg?quality=10
			// https://toyo-arhxo0vh6d1oh9i0c.stackpathdns.com/media/1908/xl-pxr8r-hero-740x740.jpg?anchor=center&mode=crop&quality=90&width=470&rnd=131206940370000000
			domain === "toyo-arhxo0vh6d1oh9i0c.stackpathdns.com" ||
			// http://www.zmonline.com/media/17805975/pussycat.jpg?mode=crop&width=620&height=349&quality=60&scale=both
			(domain_nowww === "zmonline.com" && string_indexof(src, "/media/") >= 0) ||
			// https://cdn.instructables.com/ORIG/FLU/3BAI/JF8IWE1M/FLU3BAIJF8IWE1M.jpg?width=400&crop=3:2
			domain === "cdn.instructables.com" ||
			// http://images.performgroup.com/di/library/sporting_news/a5/be/edmonton-oilers-getty-images-041102017-ftrjpg_jt08mu2eqgwn1xr30wgvpqdzv.jpg?t=1619857107&w=960&quality=70
			domain === "images.performgroup.com" ||
			// http://media.playmobil.com/i/playmobil/9022_product_detail?locale=en-US,en,*&$pdp_product_main_xl$
			domain === "media.playmobil.com" ||
			// https://img.crocdn.co.uk/images/products2/pl/00/00/00/38/pl0000003849.jpg?width=940&height=940
			domain === "img.crocdn.co.uk" ||
			// http://www.calgaryherald.com/life/cms/binary/6748001.jpg?size=sw620x65
			(domain_nowww === "calgaryherald.com" && string_indexof(src, "/cms/") >= 0) ||
			// http://www.montrealgazette.com/cms/binary/8317804.jpg?size=640x420
			(domain_nowww === "montrealgazette.com" && string_indexof(src, "/cms/") >= 0) ||
			// https://m2.ikea.com/images/pokoj-dziecka-z-niebieskimi-scianami-i-monochromatyczna-posc-919afda5ac9e85ba681cd2e3e698e893.jpg?f=l
			(domain_nosub === "ikea.com" && string_indexof(src, "/images/") >= 0) ||
			// https://colorwallpaper.net/img/2018/01/pashion-with-a-fashion.jpg?w=544&h=967&fit=stretch
			(domain_nowww === "colorwallpaper.net" && string_indexof(src, "/img/") >= 0) ||
			// https://img.cache.vevo.com/thumb/cms/6adeb8f9fb65d67e94044181f4e102c6/281x159.jpg?resize=fit&remove_borders=true
			domain === "img.cache.vevo.com" ||
			// https://drop.ndtv.com/albums/uploadedpics/small/vivo_v9_youth_small_636598304295938786.jpg?downsize=120:90&output-quality=70&output-format=webp
			(domain === "drop.ndtv.com" && string_indexof(src, "/albums/") >= 0) ||
			// http://kr.images.christianitydaily.com/data/images/full/107742/97.jpg?w=304&h=152&l=50&t=40
			(domain_nosub === "christiandaily.com" && string_indexof(domain, "images.christianitydaily.com") >= 0) ||
			// http://cdn.christianitydaily.com/data/images/full/3559/vanessa-hudgens.jpg?w=600
			domain === "cdn.christianitydaily.com" ||
			// http://images.christiandaily.co.kr/data/images/full/50674/image.jpg?w=600
			(domain_nosub === "christiandaily.co.kr" && string_indexof(domain, "images.christiandaily.co.kr") >= 0) ||
			// http://images.christiantoday.co.kr/data/images/full/292467/image.png?w=600
			domain === "images.christiantoday.co.kr" ||
			// https://blogimg.goo.ne.jp/cnv/v1/user_image/5d/9d/e2b49057338c93324e0f70dd6fc4be03.jpg?dw=110,dh=110,cw=110,ch=110,q=90,da=s,ds=s
			domain === "blogimg.goo.ne.jp" ||
			// https://cdn.clien.net/web/api/file/F01/6848785/5a32dafe05c22a.jpg?w=780&h=30000
			domain === "cdn.clien.net" ||
			// https://s1.imgs.cc/img/aaaaaRmUn.jpg?_w=500
			(domain_nosub === "imgs.cc" && domain.match(/s[0-9]*\.imgs\.cc/)) ||
			// https://ssl-stat.amebame.com/pub/content/8265872137/user/article/unknown/unknown/376668982082606877/6af49eccc7dd77e2b3bde8002f6be55c/uploaded.png?width=546
			// https://stat.amebame.com/pub/content/8265872137/user/article/unknown/unknown/376668982082606877/6af49eccc7dd77e2b3bde8002f6be55c/uploaded.png?width=546
			(domain_nosub === "amebame.com" && string_indexof(domain, "stat.amebame.com") >= 0) ||
			// https://cdn-hit.scadigital.io/media/10650/justin-bieber-selena-gomez.jpg?preset=MainImage
			domain === "cdn-hit.scadigital.io" ||
			// https://cdn56.picsart.com/169599975000202.jpeg?r1024x1024
			(domain_nosub === "picsart.com" && domain.match(/cdn[0-9]*\.picsart\.com/)) ||
			// https://cdn.ndtv.com/tech/gadgets/Electronic_Arts_Dragon_Age_Inquisition_Cover.jpg?output-quality=10
			domain === "cdn.ndtv.com" ||
			// https://assets-a1.kompasiana.com/images/avatar/13267750-10207923832071268-7573729854263131153-n-57aeadc0d89373090f9eb6eb.jpg?t=t&v=70&x=70
			(domain_nosub === "kompasiana.com" && domain.match(/assets(?:-[a-z][0-9])?\.kompasiana\.com/)) ||
			// https://images.popbuzz.com/images/2126?crop=1_1&width=200&signature=CbNpTNT994BxnDA7v5idqFKtsOs=
			domain === "images.popbuzz.com" ||
			// https://i1.adis.ws/i/Marc_Jacobs/friends_dovecameron_beautyconfestival_spring17?w=800&qlt=70&img404=NOIMAGEMEDIUM
			(domain_nosub === "adis.ws" && domain.match(/i[0-9]*\.adis\.ws/)) ||
			// http://images2.9c9media.com/image_asset/2017_6_18_79194164-a321-4264-a5e3-f641dad7e65b_png_1920x1080.jpg?size=400
			(domain_nosub === "9c9media.com" && domain.match(/^images[0-9]*\.9c9media\.com/)) ||
			// http://img1-azcdn.newser.com/image/1180030-0-20180515094436.jpeg?width=76&height=76&crop=yes
			(domain_nosub === "newser.com" && domain.match(/img[0-9]*(?:-[a-z]+)?\.newser\.com/)) ||
			// http://images.m-magazine.com/uploads/posts/image/62933/dove-cameron-descendants-doll.jpg?crop=top&fit=clip&h=500&w=698
			domain === "images.m-magazine.com" ||
			// https://www.zoom.co.uk/assets/images/0/0/2/4/4/mm00244615.jpg?width=208
			(domain_nowww === "zoom.co.uk" && src.match(/\/assets\/+images\/+/)) ||
			// https://ctd-thechristianpost.netdna-ssl.com/en/full/21939/a-thief-in-the-night.jpg?w=400&h=608
			domain === "ctd-thechristianpost.netdna-ssl.com" ||
			// https://img.vidible.tv/prod/2017-06/19/59481cb6f3bdc95f62ebf5bf/59481cb56709846d28c25ea1_o_F_v0.jpg?w=1440&h=900 -- upscaled
			domain === "img.vidible.tv" ||
			// http://images.es.j-14.com/uploads/posts/image/67560/dove-cameron-new-music.jpg?crop=top&fit=clip&h=900&w=2000 -- upscaled
			(domain_nosub === "j-14.com" && domain.match(/images\.(?:[a-z]+\.)?j-14\.com/)) ||
			// https://cdn.abcotvs.com/dip/images/3174795_030418aposcarsredcarpetronan.jpg?w=120&r=16:9
			domain === "cdn.abcotvs.com" ||
			// http://www.tasteofcountry.com/files/2018/04/ACM-RC-Pictures.jpg?w=980&q=75
			(domain_nowww === "tasteofcountry.com" && string_indexof(src, "/files/") >= 0) ||
			// https://images.thewest.com.au/publication/B88845233Z/1527064708921_GEP1KTC2C.2-2.jpg?imwidth=640&impolicy=.auto
			domain === "images.thewest.com.au" ||
			// https://cdn1.ntv.com.tr/gorsel/sanat/izlemeniz-gereken-100-anime/izlemeniz-gereken-100-anime,cZEsQuQhvUqIlKd_mSoGvw.jpg?w=960&mode=max&v=20100504143043000
			(domain_nosub === "ntv.com.tr" && domain.match(/cdn[0-9]*\.ntv\.com\.tr/)) ||
			// https://img6.hotnessrater.com/3892309/cailin-russo.jpg?w=200&h=300
			(domain_nosub === "hotnessrater.com" && domain.match(/img[0-9]*\.hotnessrater\.com/)) ||
			// http://www.starcrush.com/files/2012/11/AnnaSophia-Robb.jpg?w=980&q=75
			domain_nowww === "starcrush.com" ||
			// https://www.chrichri.dk/media/11430/11.jpeg?width=634&height=1004
			// https://www.chrichri.dk/media/30431/_k8t8450_kopi.jpg?width=264&height=176
			(domain_nowww === "chrichri.dk" && string_indexof(src, "/media/") >= 0) ||
			// https://www.rightstufanime.com/images/productImages/816546020668_anime-anohana-the-flower-we-saw-that-day-tv-series-box-set-blu-ray-primary.jpg?resizeid=4&resizeh=100&resizew=60
			(domain_nowww === "rightstufanime.com" && string_indexof(src, "/images/") >= 0) ||
			// thanks to anonymous
			// https://images1.teeshirtpalace.com/images/productImages/wt/ILiveInAMadhouseRunByATinyArmyMomLife/productImage/I-Live-In-A-Madhouse-Run-By-A-Tiny-Army-Mom-Life-navy-wt-back.jpg?width=600
			(domain_nosub === "teeshirtpalace.com" && /^images[0-9]*\./.test(domain)) ||
			// https://assets.bigcartel.com/product_images/203868677/ANOHANA+SITE.jpg?auto=format&fit=max&w=1500
			domain === "assets.bigcartel.com" ||
			// http://binaryapi.ap.org/2df5c8e3642d4183a08cf802c2dd50b1/preview/AP13344549840.jpg?wm=api&ver=0
			domain === "binaryapi.ap.org" ||
			// https://images.8tracks.com/cover/i/000/618/338/hive_mind_cover-4092.jpg?rect=0,0,500,500&q=98&fm=jpg&fit=max&w=320&h=320
			domain === "images.8tracks.com" ||
			// https://d2ykdu8745rm9t.cloudfront.net/cover/i/010/244/327/IMG_20160907_220847-1787.jpg?rect=0,0,1024,100&amp;q=98&amp;fm=jpg&amp;fit=max
			domain === "d2ykdu8745rm9t.cloudfront.net" ||
			// http://cdn2.spoilercat.com/ac/a/christopher-nolan-53c9cd8d5bbe5d40048c7003.jpeg?s=640x0 -- upscaled
			(domain_nosub === "spoilercat.com" && domain.match(/cdn[0-9]*\.spoilercat\.com/)) ||
			// https://www.mumbailive.com/images/news/Christopher_1514973032318.jpg?w=205
			(domain_nowww === "mumbailive.com" && string_indexof(src, "/images/") >= 0) ||
			// https://static.juksy.com/files/articles/68423/59704be703149.png?m=widen&i=600&q=75
			domain === "static.juksy.com" ||
			// http://img.reblog.hu/blogs/28942/christophere8d6.jpg?w=640
			domain === "img.reblog.hu" ||
			// http://www.thefw.com/files/2012/11/tumblr_ls6ujhB6wV1qfq9oxo1_5001.jpg?w=980&q=75 -- stretched
			(domain_nowww === "thefw.com" && string_indexof(src, "/files/") >= 0) ||
			// https://img.csfd.cz/files/images/creator/photos/160/654/160654750_730831.jpg?w100h132crop
			domain === "img.csfd.cz" ||
			// http://img.timesnownews.com/2_1518716279__rend_1_1.jpg?d=300x225
			// https://imgk.timesnownews.com/00000656_p_edited_1568362924__rend_4_3.jpg?tr=w-600
			(domain_nosub === "timesnownews.com" && /^img/.test(domain)) ||
			// https://img.siksinhot.com/place/1487044026161009.jpg?w=508&h=412&c=Y
			domain === "img.siksinhot.com" ||
			// https://mp-seoul-image-production-s3.mangoplate.com/keyword_search/meta/pictures/19bmu--ycm0atk5q.png?fit=around|600:400&crop=600:400;*,*&output-format=jpg&output-quality=80
			domain === "mp-seoul-image-production-s3.mangoplate.com" ||
			// http://api.theweek.com/sites/default/files/sbr070118dAPR.jpg?resize=807x807
			domain === "api.theweek.com" ||
			// https://i.smalljoys.me/2018/02/kpop-girls-generation-popularity_2017112803570_0.jpg?w=300&ssl=1&strip=all
			domain === "i.smalljoys.me" ||
			// https://t1.huanqiu.cn/98c0e4cbd2b91f316105adef408fb21b.jpg?w=150
			(domain_nosub === "huanqiu.cn" && domain.match(/t[0-9]*\.huanqiu.cn/)) ||
			// https://hypebeast.com/image/2018/07/kaws-companion-sculpture-gwanggyo-ipark-0.jpg?q=90
			(domain_nowww === "hypebeast.com" && string_indexof(src, "/image/") >= 0) ||
			// https://dramaguru.net/images/actors/amar_khan_645.jpeg?w=315&h=350&fit=crop-top
			(domain_nowww === "dramaguru.net" && string_indexof(src, "/images/") >= 0) ||
			// http://sos.vfan.vlive.tv/b/2jfi2j/8_187Ud018svc1i6cch4stmk9h_flwfzl.jpeg?type=e640
			domain === "sos.vfan.vlive.tv" ||
			// https://img.journalmedia.ie/article/3622641?width=1366&version=3622995
			(domain_nosub === "journalmedia.ie" && domain.match(/^img[0-9]*\./)) ||
			// http://img2.thejournal.ie/inline/3749439/original?width=200&version=3749439
			(domain_nosub === "thejournal.ie" && domain.match(/^img[0-9]*\./)) ||
			// http://external.polskieradio.pl/files/75762f5c-6ae2-40f2-b06d-bbc45beaa6d5.file?format=136x81
			(domain === "external.polskieradio.pl" && string_indexof(src, "/files/") >= 0) ||
			// https://thumb.netz.id/image/2018/06/29/4a093f0c3ce6da7948cb456893cbb926.jpg?w=600
			domain === "thumb.netz.id" ||
			// https://us-east-1.tchyn.io/snopes-production/uploads/2018/04/kkk_feature.jpg?resize=865,452
			(domain_nosub === "tchyn.io" && string_indexof(src, "/snopes-production/uploads/") >= 0) ||
			// http://img.diply.com/article-images/a/884c637e-7288-480a-a2df-543ff15ae971.jpg?impolicy=mobile
			domain === "img.diply.com" ||
			// https://cdn-assets.ziniopro.com/var/site_877/storage/images/media2/cover187/440239-1-eng-US/cover2.jpg?w=200
			domain === "cdn-assets.ziniopro.com" ||
			// https://netherlands-grlk5lagedl.stackpathdns.com/production/netherlands/images/1526305860593210-Julianne-Moore-in-Givenchy-.jpg?w=802&h=720&fit=clip&fm=pjpg&auto=compress
			domain === "netherlands-grlk5lagedl.stackpathdns.com" ||
			// https://russia-grlk5lagedl.stackpathdns.com/production/russia/images/1526119976681968-c0da67fdb8b-1524024352.jpg?w=450&h=800&fit=clip&crop=faces&fm=pjpg&auto=compress
			(domain_nosub === "stackpathdns.com" && string_indexof(domain, "-grlk5lagedl.stackpathdns.com") >= 0) ||
			// https://www.beautycrew.com.au/media/12866/jessica-alba-portrait.jpg?width=200
			(domain_nowww === "beautycrew.com.au" && string_indexof(src, "/media/") >= 0) ||
			// https://dsx.weather.com/util/image/w/greenaldnberg.jpg?v=at&w=320&h=180&api=7db9fe61-7414-47b5-9871-e17d87b8b6a0
			(domain === "dsx.weather.com" && string_indexof(src, "/util/image/") >= 0) ||
			// https://img.r7.com/images/iceberg-gigante-14072018102456056?dimensions=600x315
			domain === "img.r7.com" ||
			// https://cdn-images.rtp.pt/icm/images/e1/e12cf8ca828c5079d156e5e1f4903c1a?1200&rect=0,17,700,384&q=100&w=620&q=75
			domain === "cdn-images.rtp.pt" ||
			// https://media.ouest-france.fr/v1/pictures/f34478ee116ed1a208792e10a772aa78-banquise-glacier-iceberg-tout-fond-sur-terre.jpg?width=940&height=531&fill=0&focuspoint=49%2C25&cropresize=1
			domain === "media.ouest-france.fr" ||
			// https://images.pluto.tv/episodes/620e12b2df454b001354f682/screenshot16_9.jpg?fill=blur&fit=fill&fm=jpg&h=500&q=70&w=1946&auto=&ixlib=react-9.1.5&dpr=1
			domain === "images.pluto.tv" ||
			// https://www.rbsdirect.com.br/imagesrc/24569629.jpg?w=1024&h=512&a=c
			(domain_nowww === "rbsdirect.com.br" && string_indexof(src, "/imagesrc/") >= 0) ||
			// https://www.newfoundlandlabrador.com/-/media/marquees/things-to-do/iceberg-viewing/our-icebergs/iceberg-viewing-our-icebergs-marquee.jpg?mh=477&mw=1272&hash=013C8094C8B7F70F880BE7567A37631629C58B07
			((domain_nowww === "newfoundlandlabrador.com" ||
			  // thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/481
			  // https://www.mccormick.com/-/media/mccormick-us/products/gourmet/o/2000/organic-thyme.png?vd=20200628T220443Z&ir=1&width=484&height=262&crop=auto&quality=75&speed=0&hash=CEDD2CBF69459633033DBD4FC34D4D9A
			  //   https://www.mccormick.com/-/media/mccormick-us/products/gourmet/o/2000/organic-thyme.png
			  domain_nowww === "mccormick.com" ||
			  // thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/481
			  // https://d1e3z2jco40k3v.cloudfront.net/-/media/mccormick-us/products/gourmet/o/2000/organic-thyme.png?vd=20200628T220443Z&ir=1&width=484&height=262&crop=auto&quality=75&speed=0&hash=CEDD2CBF69459633033DBD4FC34D4D9A
			  //   https://d1e3z2jco40k3v.cloudfront.net/-/media/mccormick-us/products/gourmet/o/2000/organic-thyme.png
			  // https://d1e3z2jco40k3v.cloudfront.net/-/media/mccormick-us/recipes/gourmet/r/2000/roasted-paprika-cornish-hens.jpg?vd=20200628T122238Z&ir=1&width=232&height=126&crop=auto&quality=75&speed=0&hash=22B8B52DC770E4E7E2B97585E18A6D25
			  // https://d1e3z2jco40k3v.cloudfront.net/-/media/mccormick-us/recipes/gourmet/r/2000/rye-on-rye-roast-beef-panini.jpg?vd=20200628T122325Z&ir=1&width=331&height=179&crop=auto&quality=75&speed=0&hash=3BF935F44B7ED36193ECF502A3A60C04
			  // https://d1e3z2jco40k3v.cloudfront.net/-/media/mccormick-us/products/mccormick/s/800/sauage_flavor_country_gravy_800x800.png?vd=20200628T213927Z&ir=1&width=300&height=300&crop=auto&quality=75&speed=0&hash=825A2E5D11AB152A16AF8C372EF60113
			  // https://d1e3z2jco40k3v.cloudfront.net/-/media/mccormick-us/videos/desktop/productionfile572cbc618cdbad0300d26422jpg/490_tukeyb.jpg?vd=20200627T095045Z&ir=1&width=355&height=250&crop=auto&quality=75&speed=0&hash=69BAC8F296A31B2BDA15F169A714E496
			  // https://d1e3z2jco40k3v.cloudfront.net/-/media/mccormick-us/products/frenchs/c/800/frenchs_crunchy_toppers_red_pepper_800x800.png?vd=20200629T005822Z&ir=1&width=200&height=200&crop=auto&quality=75&speed=0&hash=22A933DB062C3E531F0539C88F78C7AD
			  domain === "d1e3z2jco40k3v.cloudfront.net") && string_indexof(src, "/-/media/") >= 0) ||
			// https://images.businessoffashion.com/site/uploads/2016/02/shutterstock_85109977.jpg?auto=format%2Ccompress&crop=top&fit=crop&h=573&w=1024
			domain === "images.businessoffashion.com" ||
			// http://n10.cmsfile.pg0.cn/group2/M00/2C/C8/Cgqg2lh3CNGAK9KoAANuU1gzN84392.jpg?enable=&w=550&h=731&cut=
			(domain_nosub === "pg0.cn" && domain.match(/cmsfile\.pg0\.cn/)) ||
			// http://api.ning.com/files/JtotRF7dxCUb6oEDdSaFzZJXhL0GGMo-wPYbqAOga3rqEmhaecqI*AxzoQNAArT08Pqt4g9PX*0aFA8I2bPe1b8RtTBY8KD8/011212natalieportmanoscars350.jpg?width=30
			domain === "api.ning.com" ||
			// http://storage0.dms.mpinteractiv.ro/media/2/1401/16207/16175015/4/b30cdcf1c208a63611f6d15a9b76276e.jpg?width=400
			(domain_nosub === "mpinteractiv.ro" && domain.match(/^storage[0-9]*\./) && string_indexof(src, "/media/") >= 0) ||
			// https://a0.muscache.com/im/pictures/14866a48-c889-4cad-91fa-ae3216e2841e.jpg?aki_policy=x_medium
			(domain_nosub === "muscache.com" && src.match(/\/im\/pictures\/[-0-9a-f]+\./)) ||
			// https://wedd.today/wallpaper/99c10ed13a6aa8620bd5955f14c08bdd/tgc-easy-on-the-eye-thread-no-nsfw-image-pics-only-no-chat-no-paige-spiranac-wallpaper-hd?w=116&h=88
			(domain_nowww === "wedd.today" && string_indexof(src, "/wallpaper/") >= 0) ||
			// https://www.looklive.at/media/72109/riri.jpg?anchor=center&mode=crop&width=1024&rnd=131565967210000000
			(domain_nowww === "looklive.at" && src.match(/\/media\/[0-9]+\//)) ||
			// https://t.tudocdn.net/150447?w=100&h=1080&fit=clip
			domain === "t.tudocdn.net" ||
			// http://me.phununet.com/topic/resources/img/upload/htsmjle/08032016034306749.jpg?w=400&mode=crop&anchor=topcenter&scale=both
			(domain === "me.phununet.com" && string_indexof(src, "/resources/img/") >= 0) ||
			// http://cdn.diario26.com.ar/media/image/2018/05/25/389592.jpg?s=2
			(domain === "cdn.diario26.com.ar" && string_indexof(src, "/media/image/") >= 0) ||
			// http://discovermagazine.com/~/media/Images/Promo%20Images/2018/june/CentaurusA.jpg?mw=200
			(domain_nowww === "discovermagazine.com" && string_indexof(src, "/media/Images/") >= 0) ||
			// https://steamusercontent-a.akamaihd.net/ugc/952958110703301417/7410320729F64979B9BFFED4C742F9BC1535FB64/?interpolation=lanczos-none&output-format=jpeg&output-quality=95&fit=inside%7C506%3A284&composite-to=*,*%7C506%3A284&background-color=black
			domain === "steamusercontent-a.akamaihd.net" ||
			// https://www.qfeast.com/imret/qq/iI4Fe2.jpg?w=300&h=300&sc=1
			(domain_nowww === "qfeast.com" && string_indexof(src, "/imret/") >= 0) ||
			// http://statis.gamen.vn/images/upload/2016/09/14/57_l5u2MnoUOr_animemomokofanartrinkyajapan6.jpg?w=200
			(domain === "statis.gamen.vn" && string_indexof(src, "/images/upload/") >= 0) ||
			// https://img.anikore.jp/images/board/4/2/2/55422/55422.jpg?width=560&height=560&type=resize
			domain === "img.anikore.jp" ||
			// https://cdn1.newsplex.pt/media/2018/3/5/628723.jpg?type=xl
			(domain_nosub === "newsplex.pt" && domain.match(/^cdn[0-9]*\./)) ||
			// http://static.origos.hu/s/img/i/1712/2017121499.jpg?w=644&h=866
			(domain === "static.origos.hu" && string_indexof(src, "/img/") >= 0) ||
			// https://cdn.nwmgroups.hu/s/img/i/1909//20190913comedy-wildlife-photography-awards-20192.jpg?w=600&h=447
			(domain === "cdn.nwmgroups.hu" && string_indexof(src, "/img/") >= 0) ||
			// http://robertocavada.com/Images/6c732c90-1dee-4d93-968f-47c3bd9d8d9d.jpg?width=385&format=png
			(domain_nowww === "robertocavada.com" && string_indexof(src, "/Images/") >= 0) ||
			// https://images.mncdn.pl/com_calendar/kurt_nilsen.png?resizeimage=w:230,q:97?resizeimage=w:130,q:97
			domain === "images.mncdn.pl" ||
			// https://imgsearches.com/i/arod-meme-jenniferlopez-losangeles-tights-jennifer-lopez-in-tights-los-D3bdaa424e3c7179ddfcdda66a5c38e5e.jpg?w=238
			(domain_nowww === "imgsearches.com" && string_indexof(src, "/i/") >= 0) ||
			// http://www.thetimesnews.com/storyimage/NC/20180904/NEWS/180909253/AR/AR-180909253.jpg?Q=75&maxH=775&maxW=775
			// http://www.thetimesnews.com/galleryimage/NC/20180905/NEWS/905009997/PH/1/1/PH-905009997.jpg?Q=75&maxH=775&maxW=775
			(domain_nowww === "thetimesnews.com" && (
				string_indexof(src, "/storyimage/") >= 0 ||
					string_indexof(src, "/galleryimage/") >= 0)) ||
			// https://static.fthis.gr/userfiles/articles/legacy/badb6201-6565-4904-bcdd-3494b9ddea15.jpg?h=573&scale=both&bgcolor=151515&mode=pad
			domain === "static.fthis.gr" ||
			// https://img.pixelz.com/blog/how-to-shoot-a-lookbook/photo-bohemian-model-rocks-and-sand.jpg?w=1000
			(domain === "img.pixelz.com" && string_indexof(src, "/blog/") >= 0) ||
			// https://ca.hellomagazine.com/imagenes/healthandbeauty/201210249802/get-the-bond-girl-body/0-49-79/naomie-harris-1--a.jpg?interpolation=lanczos-normal&downsize=200px:*&output-format=progressive-jpeg
			// https://ca.hellomagazine.com/images/stories/0/2016/09/02/000/383/648/gallery_3_5.jpg?interpolation=lanczos-normal&downsize=0.75xw:*
			(domain_nosub === "hellomagazine.com" && (string_indexof(src, "/imagenes/") >= 0 || string_indexof(src, "/images/") >= 0)) ||
			// thanks to anonymous for reporting:
			// https://images.hellomagazine.com/horizon/portrait/1935e1050422-gettyimages-2074321118.jpg?tx=c_limit,w_640
			domain === "images.hellomagazine.com" ||
			// https://i0.1616.ro/media/521/2861/35030/17944527/1/jennifer-lawrence.jpg?width=160
			(domain_nosub === "1616.ro" && domain.match(/^i[0-9]*\./)) ||
			// http://images.lifeandstylemag.com/uploads/posts/image/35601/paula-patton-spirit-awards.jpg?crop=top&fit=clip&h=500&w=698
			domain === "images.lifeandstylemag.com" ||
			// https://img1.fonwall.ru/o/zl/redhead-freckles-sensual-gaze.jpg?route=low&h=200
			(domain_nosub === "fonwall.ru" && domain.match(/^img[0-9]*\./)) ||
			// https://www.wonderwall.com/photos/2018/09/14/1036597-copper-fit-and-kate-upton-launch-event-in-nyc.jpg?x=500&y=1025&icq=74&sig=43aca4eba07017dd9e832c2a0b806368
			(domain_nowww === "wonderwall.com" && string_indexof(src, "/photos/") >= 0) ||
			// https://www.thestar.com.my/~/media/online/2013/08/29/11/46/doc6bgz1axwovp1c21a5duc.ashx/?w=620&h=413&crop=1&hash=F8EDD8B2D1EF3FA235A86220BB7EB24045FE73B5
			(domain_nowww === "thestar.com.my" && string_indexof(src, "/~/media/online/") >= 0) ||
			// http://www.vancouversun.com/entertainment/movie-guide/cms/binary/8231595.jpg?size=140x95
			(domain_nowww === "vancouversun.com" && string_indexof(src, "/cms/") >= 0) ||
			// https://image.lag.vn/upload/news/17/11/20/13-1511026059714_QVIK.jpg?w=200
			(domain === "image.lag.vn" && string_indexof(src, "/upload/") >= 0) ||
			// https://www.booktrust.org.uk/globalassets/images/news-and-blogs/blogs-2017/03.-march/dr-seuss/dr-seuss-16x9.jpg?w=200&h=675&quality=70&anchor=middlecenter
			(domain_nowww === "booktrust.org.uk" && string_indexof(src, "/globalassets/images/") >= 0) ||
			// https://ind5.ccio.co/lF/9B/u6/7b47872636fed37e01f8124ee07e6e66.jpg?iw=300
			(domain_nosub === "ccio.co" && domain.match(/^ind[0-9]*\./)) ||
			// https://i3.cpcache.com/product/1940586465/Elegant_Floral_Abstract_Decorative_Shower_Curtain_300x300.jpg?height=300&width=300&qv=90&side=front&Filters=[{%22name%22:%22background%22,%22value%22:%22ddddde%22,%22sequence%22:2}]
			(domain_nosub === "cpcache.com" && domain.match(/^i[0-9]*\./)) ||
			// https://i.rocdn.com/v2/2515808?w=480&h=480
			domain === "i.rocdn.com" ||
			// https://resource.globenewswire.com/Resource/Download/63bc1237-3bf3-4ac4-99b0-6c07b738e939?size=2
			(domain === "resource.globenewswire.com" && string_indexof(src, "/Resource/Download/") >= 0) ||
			// http://townsquare.media/site/252/files/2018/10/blackpink.jpg?w=980&q=75
			(domain_nowww === "townsquare.media" && src.match(/\/+site\/+[0-9]+\/+files\/+/)) ||
			// https://images.reference.com/reference-production-images/question/782bd2daeda6430a1f9227e816a5339a/aq/things-consider-before-buying-scottish-fold-kitten_ae37beb63bfc893a_EKBERfd0RHqThVWjPBS5eA.jpg?width=760&amp;height=411&amp;fit=crop
			domain === "images.reference.com" ||
			// https://assets.pcmag.com/media/images/394301-devil-may-cry-4-special-edition-for-pc.jpg?width=740&height=416
			domain === "assets.pcmag.com" ||
			// https://images.jg-cdn.com/image/b6461302-bd22-42f1-984d-ffb8de0d8093.jpg?template=fundraisingpagegalleryxl
			domain === "images.jg-cdn.com" ||
			// https://mjzj-static.sh1a.qingstor.com/images/articles/2018/06/04/VQLtshi8bp3vV0zcbkYCGzo5jJ9djp20gtrXGhxe.jpeg?image&action=resize:w_400,m_1
			(domain_nosub === "qingstor.com" && string_indexof(src, "/images/articles/") >= 0) ||
			// https://img.ibxk.com.br/2014/05/23/23164043333557.jpg?w=1040
			domain === "img.ibxk.com.br" ||
			// https://image.biccamera.com/img/00000003627646_A01.jpg?sr.dw=320&sr.dh=320&sr.jqh=60&sr.mat=1
			(domain === "image.biccamera.com" && string_indexof(src, "/img/") >= 0) ||
			// https://sp-m.mu-mo.net/image/jacket/84/1_11765843.jpg?sr.dw=172&sr.dh=172&sr.mat=1
			(domain_nosub === "mu-mo.net" && string_indexof(src, "/image/") >= 0) ||
			// https://www.g-mark.org/media/award/2010/10E16015/10E16015_01_880x660.jpg?w=680&h=460&m=0
			(domain_nowww === "g-mark.org" && string_indexof(src, "/media/") >= 0) ||
			// https://kubrick.htvapps.com/htv-prod-media.s3.amazonaws.com/images/sf19-thomasrhett-blog-lg-1547637894.jpg?crop=1.00xw:0.858xh;0,0&amp;resize=900:*
			((domain === "kubrick.htvapps.com" || amazon_container === "htv-prod-media") && string_indexof(src, "/images/") >= 0) ||
			// https://images.france.fr/zeaejvyq9bhj/5QsvRnijLyI2SacuII8mcO/94de7994698fa0baf56366b62fa4b7ff/183-18_cmjn_ouverture.jpg?w=1000&h=200&q=70&fl=progressive&fit=fill
			domain === "images.france.fr" ||
			// https://az877327.vo.msecnd.net/~/media/images/references/2018/notre%20dame%20projection%20mapping/notredamemapping%202%20jpg.jpg?v=1&mw=1800&mh=1200
			(domain === "az877327.vo.msecnd.net" && string_indexof(src, "/media/images/") >= 0) ||
			// https://en.hoteljardinlebrea.com/usermedia/photo-636263964711140067-1.JPG?dummy=0&h=800
			(domain_nosub === "hoteljardinlebrea.com" && string_indexof(src, "/usermedia/") >= 0) ||
			// https://cdn2.veltra.com/ptr/20170913144602_1511696320_10189_0.jpg?imwidth=480&impolicy=custom
			(domain_nosub === "veltra.com" && domain.match(/^cdn[0-9]*\./)) ||
			// https://img.letgo.com/images/20/63/07/50/206307501f2c7130c7fe212906ca0558.jpeg?impolicy=img_100
			//   https://img.letgo.com/images/20/63/07/50/206307501f2c7130c7fe212906ca0558.jpeg -- upscaled?
			(domain === "img.letgo.com" && string_indexof(src, "/images/") >= 0) ||
			// https://images.musement.com/cover/0001/58/thumb_57463_cover_header.jpeg?&q=60&fit=crop&lossless=true&auto=format&w=412&h=200
			(domain === "images.musement.com" && string_indexof(src, "/cover/") >= 0) ||
			// https://i.playground.ru/i/blog/344061/icon.jpg?600xauto
			domain === "i.playground.ru" ||
			// https://www.treeoftheyear.org/getmedia/ecd7b001-6c64-4279-9eee-32c76dedc3dc/117221b;.aspx?width=600
			(domain_nowww === "treeoftheyear.org" && string_indexof(src, "/getmedia/") >= 0) ||
			// thanks to anonymous for reporting:
			// https://www.dukeupress.edu/getmedia/957daa00-db65-49cf-9f10-316be1b42d32/AleMeija_Headshot_1.jpg?width=152&height=203
			(domain_nowww === "dukeupress.edu" && string_indexof(src, "/getmedia/") >= 0) ||
			// thanks to anonymous for reporting:
			// https://www.canadashistory.ca/getmedia/7176bbe1-a55a-4c0a-afa5-741f210de9ab/ExpArtBearFactsGoggles.jpg.aspx?width=768&height=511&ext=.jpg
			(domain_nowww === "canadashistory.ca" && string_indexof(src, "/getmedia/") >= 0) ||
			// https://cdn.indicium.nu/source/grazia/2018/06/selena.jpg?w=410&h=290&fit=crop
			(domain === "cdn.indicium.nu" && string_indexof(src, "/source/grazia/") >= 0) ||
			// https://news-img.51y5.net/91849b1acbfae70c2995b276557582c5_3?w=640&h=400
			domain === "news-img.51y5.net" ||
			// https://st.automobilemag.com/uploads/sites/11/2019/04/wm-2019-techno-classica-43.jpg?interpolation=lanczos-none&fit=around%7C660%3A440&fit=around%7C680%3A453
			(domain === "st.automobilemag.com" && string_indexof(src, "/uploads/sites/") >= 0) ||
			// thanks to PwnicornDev on github: https://github.com/qsniyg/maxurl/issues/46
			// https://styles.redditmedia.com/t5_3pguo/styles/profileIcon_hdpofk4olag01.jpg?width=256&height=256&crop=256:256,smart&s=3df0ac6cd6b812fc38a249f3579e261d442424b3
			//   https://styles.redditmedia.com/t5_3pguo/styles/profileIcon_hdpofk4olag01.jpg
			(domain === "styles.redditmedia.com" && string_indexof(src, "/styles/") >= 0) ||
			// https://img.webmd.com/dtmcms/live/webmd/consumer_assets/site_images/article_thumbnails/other/zoe_saldana_2017_other/375x321_zoe_saldana_2017_other.jpg?resize=*:85px
			domain === "img.webmd.com" ||
			// https://embedwistia-a.akamaihd.net/deliveries/156d4cda7d1fd80c4d334b35f3f033b9.jpg?image_crop_resized=1280x720
			domain === "embedwistia-a.akamaihd.net" ||
			// http://ame-prod-redonline-assets.s3.amazonaws.com/main/thumbs/25292/january_jones_3_redonline.jpg?resize=480:*
			amazon_container === "ame-prod-redonline-assets" ||
			// https://www.noted.co.nz/media/19199/ls2818_50_gi_464223141.jpg?width=800
			(domain_nowww === "noted.co.nz" && string_indexof(src, "/media/") >= 0) ||
			// https://image.cnbcfm.com/api/v1/image/101914724-105911909.jpg?v=1532564436&w=630&h=420
			domain === "image.cnbcfm.com" ||
			// https://images.newrepublic.com/cbb807bdf41088690fba891f74be19765fec4144.jpeg?w=1200&q=65&dpi=2.625&fm=pjpg&h=496
			domain === "images.newrepublic.com" ||
			// https://www.madametussauds.com/media/1897935/_dsc6467-ariana-grande-mta-2017.jpg?center=0.380281690140845,0.495&mode=crop&width=584&height=643
			(domain_nowww === "madametussauds.com" && string_indexof(src, "/media/") >= 0) ||
			// https://www.tirolerin.at/media/63724/rihanna-wearing-the-rihanna-chopard-joaillerie-collection.jpg?center=0.30769230769230771,0.36073825503355705&mode=crop&width=800&height=400&rnd=131438597590000000
			(domain_nowww === "tirolerin.at" && string_indexof(src, "/media/") >= 0) ||
			// https://media.deseretdigital.com/file/7b4eed7931?resize=width_1200&type=jpg&c=21&a=e0717f4c
			(domain === "media.deseretdigital.com" && string_indexof(src, "/file/") >= 0) ||
			// https://assets.audiomack.com/djsev/c829ceb284e2d4b043145aec664a93dc.jpeg?width=165&height=165&max=true
			domain === "assets.audiomack.com" ||
			// https://pic.rutube.ru/video/ba/58/ba58dead2098b9c37486ad4d86e7453f.jpg?size=z
			domain === "pic.rutube.ru" ||
			// http://cdn.marketplaceimages.windowsphone.com/v8/images/c8268cdc-ac27-4a03-bd9b-f2c3645e5387?imageType=ws_icon_large
			(domain === "cdn.marketplaceimages.windowsphone.com" && string_indexof(src, "/images/") >= 0) ||
			// https://dsocdn.akamaized.net/Assets/Images_Upload/2009/10/06/meganfoxtransformers.jpg?maxheight=550&maxwidth=550&scale=both
			((domain === "dsocdn.akamaized.net" ||
			 // https://nbocdn.akamaized.net/Assets/Images_Upload/2011/06/20/megan_fox_transformers_movie_image.jpg?maxheight=460&maxwidth=638&scale=both
			 domain === "nbocdn.akamaized.net" ||
			 // https://avecdn.akamaized.net/Assets/Images_Upload/Actu24/2019/01/17/5db5bcce-1a52-11e9-8d8b-af38f65ef78d_web_.jpg?maxheight=1000&maxwidth=1000&scale=both
			 domain === "avecdn.akamaized.net" ||
			 // https://static.hbvl.be/Assets/Images_Upload/2020/01/18/5db2f5a4-3895-11ea-851f-4cd0e4980a9f.jpg?maxheight=280&maxwidth=400
			 domain === "static.hbvl.be" ||
			 // https://static.standaard.be/Assets/Images_Upload/2020/01/15/61c6fa7c-36e3-11ea-8d7f-eca0964b0462.jpg?maxheight=280&maxwidth=400
			 domain === "static.standaard.be" ||
			 // https://limnlcdn.akamaized.net/Assets/Images_Upload/2018/10/19/Rihanna.jpg?maxheight=460&maxwidth=629
			  domain === "limnlcdn.akamaized.net") && /\/Assets\/+Images_Upload\//i.test(src)) ||
			// https://netstorage-nur.akamaized.net/images/pogudx820tio3bdte.jpg?imwidth=900
			(domain === "netstorage-nur.akamaized.net" && string_indexof(src, "/images/") >= 0) ||
			// https://images.moviebuff.com/35923d1e-e6bc-4abb-96b6-da98a0569475?w=100
			domain === "images.moviebuff.com" ||
			// https://static-ugc-media.hk01.com/5cbdd7eb51801661e96f9578.jpeg?v=200h
			domain === "static-ugc-media.hk01.com" ||
			// https://warwick.film/image/wi/3481.jpeg?maxwidth=300&maxheight=300
			(domain_nowww === "warwick.film" && string_indexof(src, "/image/") >= 0) ||
			// https://quizizz.com/media/resource/gs/quizizz-media/quizzes/7ba7f6b8-81fe-427a-b455-eb5fabc60880?w=90&h=90
			(domain_nowww === "quizizz.com" && src.match(/\/media\/+resource\/+/)) ||
			// http://eroce.com/img/post-images/2017-03-17/35234/009.jpg?p=small
			(domain_nowww === "eroce.com" && string_indexof(src, "/img/") >= 0) ||
			// https://img-cdn.hipertextual.com/files/2019/05/hipertextual-juego-tronos-episodio-final-es-mas-visto-historia-hbo-2019773047.jpg?strip=all&lossy=1&quality=70&resize=740%2C490&ssl=1
			(domain === "img-cdn.hipertextual.com" && string_indexof(src, "/files/") >= 0) ||
			// https://img.ponparemall.net/imgmgr/61/00101261/img0132/00001411407.jpg?ver=1&size=pict200_200
			(domain === "img.ponparemall.net" && string_indexof(src, "/imgmgr/") >= 0) ||
			// https://smart.usen.com/data/jacket/SME/0001/4706/jacket_SRCL09319B01A_600over.jpg?size=600
			(domain === "smart.usen.com" && string_indexof(src, "/data/") >= 0) ||
			// https://img.digitaldjpool.com/6/4/0/b/a/0/640ba029-71be-4bfd-a5dc-9b1fa7e1bbc7.jpg?mode=max&width=320&height=320&
			domain === "img.digitaldjpool.com" ||
			// https://d25-a.sdn.szn.cz/d_25/c_img_F_GO/OAeDZF.jpeg?fl=res,350,350,1
			(domain_nosub === "szn.cz" && domain.match(/\.sdn\./) && string_indexof(src, "_img_") >= 0) ||
			// https://banana1015.com/files/2013/04/Daryl-Salad-ft.jpg?w=600&h=0&zc=1&s=0&a=t&q=89
			(domain_nowww === "banana1015.com" && string_indexof(src, "/files/") >= 0) ||
			// https://mix106radio.com/files/2017/05/RS8710_177369626.jpg?w=630&h=420&zc=1&s=0&a=t&q=89
			(domain_nowww === "mix106radio.com" && string_indexof(src, "/files/") >= 0) ||
			// https://static-cdn.sr.se/sida/images/3138/3464680_2048_1152.jpg?preset=768x432
			(domain === "static-cdn.sr.se" && string_indexof(src, "/images/") >= 0) ||
			// https://cdn.kaumo.jp/element/25beb439-c680-42cb-b4da-01082ffd495e.jpg?w=200&h=200&t=resize&q=90
			(domain === "cdn.kaumo.jp" && string_indexof(src, "/element/") >= 0) ||
			// https://d12swbtw719y4s.cloudfront.net/images/HAH4ZNFC/j8zc9QNLZWdMLRkJoJ10/13876272_154185325010658_4931241332073474710_n.jpeg?w=300
			(domain === "d12swbtw719y4s.cloudfront.net" && string_indexof(src, "/images/") >= 0) ||
			// https://www.saplinghr.com/hs-fs/hubfs/Imported_Blog_Media/Adobe-1024x425.png?width=1024&name=Adobe-1024x425.png
			(domain_nowww === "saplinghr.com" && string_indexof(src, "/hubfs/") >= 0) ||
			// https://telefe-static2.akamaized.net/media/172711/keanu.png?v=20190610125202000&format=main&width=640&height=360&mode=crop
			(domain === "telefe-static2.akamaized.net" && string_indexof(src, "/media/") >= 0) ||
			// https://10daily.com.au/ip/s3/2019/06/10/2463e4bc5827eeb7aec3ffee82d4126a-280668.jpg?image-profile=card_max&io=landscape
			domain_nowww === "10daily.com.au" ||
			// https://spark.adobe.com/page/eq97XntUeP3NA/images/314ec4b7-f138-46b4-8246-7e5ab62e33ee.jpg?asset_id=9ec649f8-f5d8-4178-a637-f1e6c9f95a20&img_etag=7743c1a8f9943940e303fcdc239a3291&size=2560
			(domain === "spark.adobe.com" && string_indexof(src, "/page/") >= 0) ||
			// thanks to dym-sh on github: https://github.com/qsniyg/maxurl/issues/480
			// https://blog.adobe.com/en/2020/09/23/adobe-unveils-ambitious-multi-year-vision-for-pdf-introduces-liquid-mode.html
			// https://blog.adobe.com/hlx_da4186554b4266692a126e34487444d6f7884263.jpeg?width=1500&auto=webp
			(domain === "blog.adobe.com" && /:\/\/[^/]+\/+(?:[a-z]+_)?[0-9a-f]{20,}\./.test(src)) ||
			// https://s.w-x.co/util/image/w/ap_19171124776280.jpg?v=at&w=485&h=273
			(domain === "s.w-x.co" && string_indexof(src, "/image/") >= 0) ||
			// https://img.monocle.com/radio/episodes/untitled-1-55df1345e1fea.jpg?w=408&g=center&q=50
			domain === "img.monocle.com" ||
			// https://bildix.mmcloud.se/bildix/api/images/2ec6e4f9-0a6f-449b-9429-2e63ba616165.jpg?fit=crop&w=300
			(domain === "bildix.mmcloud.se" && /\/bildix\/+api\/+images\/+/.test(src)) ||
			// https://media.cinedb.com.tr/Upload/News/c9f58bdc-6f94-41d9-8e3e-90d5961cddfd.jpeg?h=320&crop=true
			(domain === "media.cinedb.com.tr" && /\/Upload\//i.test(src)) ||
			// https://www.newidea.com.au/media/41689/gettyimages-859537364.jpg?width=720&center=0.0,0.0
			(domain_nowww === "newidea.com.au" && string_indexof(src, "/media/") >= 0) ||
			// https://www.essexstudent.com/asset/Event/6006/aquaman-original.jpg?thumbnail_width=595&thumbnail_height=883&resize_type=CropToFit
			(domain_nowww === "essexstudent.com" && /\/asset\//i.test(src)) ||
			// https://d.newsweek.com/en/full/1505905/belle-delphine.png?w=1600&h=1600&l=50&t=40&q=88&f=14e520e290afd404d58c1386f9e4bd20
			(domain === "d.newsweek.com" && string_indexof(src, "/full/") >= 0) ||
			// https://images.techtimes.com/data/images/full/249878/mirrors-edge-catalyst.jpg?w=600&h=300
			(domain === "images.techtimes.com" && /\/data\/+images\/+/.test(src)) ||
			// https://oyster.ignimgs.com/mediawiki/apis.ign.com/mirrors-edge-2/7/7f/ME_Imprisoned2.jpg?width=640
			domain === "oyster.ignimgs.com" ||
			// https://www.marieclaire.com.au/media/29220/gettyimages-873295564.jpg?width=640
			(domain_nowww === "marieclaire.com.au" && string_indexof(src, "/media/") >= 0) ||
			// https://www.stylist.co.uk/images/app/uploads/2015/09/24222225/kendall-jenner-8.jpg?w=200&h=1&fit=max&auto=format%2Ccompress
			(domain_nowww === "stylist.co.uk" && /\/images\/+app\/+uploads\/+/.test(src)) ||
			// https://www.britishfashioncouncil.co.uk/uploads/collections/3162/70/original/282717.jpg?w=600&h=894&mode=crop
			(domain_nowww === "britishfashioncouncil.co.uk" && string_indexof(src, "/uploads/") >= 0) ||
			// https://static.fptplay.net/static/img/share/video/09_05_2016/9794a73f2472ed913bf6f44718a1acaf1355153297_full09-05-2016_10g02-52.jpg?w=300&h=430&mode=scale
			(domain === "static.fptplay.net" && string_indexof(src, "/img/") >= 0) ||
			// https://images-mega.mdstrm.com/2019/06/30/91551_1_5d19275c96931.jpg?d=300x200
			domain === "images-mega.mdstrm.com" ||
			// https://www.girlfriend.com.au//media/13027/1000-selena-gomez-justin-bieber-hailey-baldwin.png?width=200&format=jpg
			(domain_nowww === "girlfriend.com.au" && string_indexof(src, "/media/") >= 0) ||
			// http://imgs.ngaotruyen.com//LibIma/TruyenChu/anh-yeu-em-co-be-ngoc-a.jpg?width=160&quality=95&v=41
			domain === "imgs.ngaotruyen.com" ||
			// https://d1ywb8dvwodsnl.cloudfront.net/files.fuzoku.jp/img/shop/eroma/diary/57347859/thumbnail_57347859_1563667048_0.jpeg?width=160&height=240&type=resize&quality=80
			(domain === "d1ywb8dvwodsnl.cloudfront.net" && /\/files\.fuzoku\.jp\/+img\//.test(src)) ||
			// https://www.menshealth.com.au/media/10567/rihanna.jpg?width=606&mode=crop&center=0.0,0.0
			(domain_nowww === "menshealth.com.au" && string_indexof(src, "/media/") >= 0) ||
			// https://2sao.vietnamnetjsc.vn/images/2019/05/28/11/04/hara-ava2.jpg?width=150
			(domain === "2sao.vietnamnetjsc.vn" && string_indexof(src, "/images/") >= 0) ||
			// http://images.jkn.co.kr/data/images/full/939969/image.jpg?w=64&h=64&l=50&t=40
			(domain === "images.jkn.co.kr" && string_indexof(src, "/images/") >= 0) ||
			// https://www.instylemag.com.au/media/19665/anne-hathaway.jpg?width=640
			(domain_nowww === "instylemag.com.au" && string_indexof(src, "/media/") >= 0) ||
			// thanks to DevWannabe-dot on github: https://github.com/qsniyg/maxurl/issues/904
			// https://www.who.com.au/media/24019/ed-sheeran-ellie-goulding.jpg?width=720&center=0.0,0.0
			(domain_nowww === "who.com.au" && /\/media\/+[0-9]+\//.test(src)) ||
			// https://i.eurosport.com/2018/06/17/2356762-49034010-2560-1440.jpg?w=750
			domain === "i.eurosport.com" ||
			// https://blog.wirelessanalytics.com/hs-fs/hubfs/bigstock-Burj-Al-Arab-Jumeirah-In-Dubai-129187832.jpg?width=524&name=bigstock-Burj-Al-Arab-Jumeirah-In-Dubai-129187832.jpg
			(domain === "blog.wirelessanalytics.com" && string_indexof(src, "/hubfs/") >= 0) ||
			// https://b.zmtcdn.com/data/user_profile_pictures/b8b/0bbe96945a87de2eb8c9d9d82e1ecb8b.jpg?fit=around%7C400%3A400&crop=400%3A400%3B%2A%2C%2A
			(domain_nosub === "zmtcdn.com" && string_indexof(src, "/data/") >= 0) ||
			// https://images.mubi.com/images/film/179265/image-w1280.jpg?size=740x
			(domain === "images.mubi.com" && string_indexof(src, "/images/") >= 0) ||
			// https://i.obozrevatel.com/gallery/2011/4/1/840669.jpg?size=400x400
			domain === "i.obozrevatel.com" ||
			// https://assetscdn1.paytm.com/images/catalog/product/K/KI/KIDPRIYA-COLLECPRIY20786186F9A127/1564605875711_0..jpg?imwidth=320&impolicy=hq
			(domain_nosub === "paytm.com" && /^assetscdn[0-9]*\./.test(domain)) ||
			// https://images.perthnow.com.au/publication/B881248267Z/1562057175392_GKT29TC6J.2-2.jpg?imwidth=668&impolicy=pn_v3
			domain === "images.perthnow.com.au" ||
			// https://netstorage-yen.akamaized.net/images/3o3bpd2bs54589rka.jpg?imwidth=900
			(domain === "netstorage-yen.akamaized.net" && string_indexof(src, "/images/") >= 0) ||
			// thanks to roi:
			// https://static.nexilia.it/nextquotidiano/2022/09/liverpool3.jpg?impolicy=nexilia-16-9&imwidth=2206
			domain === "static.nexilia.it" ||
			// https://cdn1.eldia.com/092017/1506251744295.jpg?&cw=320
			(domain_nosub === "eldia.com" && /^cdn[0-9]*\./.test(domain)) ||
			// https://esquire.com.gr/Content/ImagesDatabase/dd/dd305859aa7b4181b03ee3f615490545.jpg?v=1&maxwidth=760&
			(domain_nowww === "esquire.com.gr" && /\/Content\/+ImagesDatabase\//i.test(src)) ||
			// https://akmedia.hollywoodlife.com/2012/04/041012_1d_teaser_spl380257_017120410085753.jpg?w=150&h=115&crop=1
			domain === "akmedia.hollywoodlife.com" ||
			// https://www.refinery29.com/images/8499155.jpg?format=webp&width=720&height=864&quality=85
			(domain_nowww === "refinery29.com" && string_indexof(src, "/images/") >= 0) ||
			// https://images.radio.com/aiu-media/BebeRexha.jpg?width=300&crop=16:9,offset-y0
			(domain === "images.radio.com" && string_indexof(src, "/aiu-media/") >= 0) ||
			// http://www.casseycds.net/uploads/sanpham/g1hv6_09.jpg?w=160&h=140&mode=pad
			(domain_nowww === "casseycds.net" && string_indexof(src, "/uploads/") >= 0) ||
			// http://www.youmekorea.com/event_4.brd/_12.12.cea0c14/T-ara%20Day%20By%20Day.jpg?cid=smime_6_50434350&thumb=300x226
			(domain_nowww === "youmekorea.com" && /[?&]thumb=/.test(src)) ||
			// https://cdfront.tower.jp/~/media/Images/Mag/Mikiki/mikiki_icon_70.jpg?h=70&thn=1&w=70
			// https://tower.jp/~/media/Images/Mag/Mikiki/mikiki_icon_70.jpg?h=70&thn=1&w=70
			(domain_nosub === "tower.jp" && /\/~\/+media\//.test(src)) ||
			// https://images.boosty.to/user/23212/avatar?change_time=1566827978&croped=1&mh=560&mw=450
			domain === "images.boosty.to" ||
			// https://media.nbcnewyork.com/2019/09/bestdressed-uma.jpg?fit=700%2C1000
			domain === "media.nbcnewyork.com" ||
			// https://d15-a.sdn.cz/d_15/c_img_E_J/Da7BAUs.jpeg?fl=cro,0,0,1280,719%7Cres,1200,,1%7Cwebp,75
			domain_nosub === "sdn.cz" ||
			// https://cdn2.unrealengine.com/Diesel%2Fproductv2%2Fcorruption-2029%2Fhome%2FEGS_TheBeardedLadies_CORRUPTION2029_S1-2560x1440-b8e91bac33e7b50e2dc3e0b8f975b2843f06334f.jpg?h=100&resize=1&w=100
			(domain_nosub === "unrealengine.com" && /^cdn[0-9]*\./.test(domain)) ||
			// https://cdn.repub.ch/s3/republik-assets/github/republik/article-facebook-influenced-elections-in-66-countries/images/0054f5fb5cc553222090e78d27ef4c8ffcf5e85f.jpeg?size=2031x622
			(domain === "cdn.repub.ch" && string_indexof(src, "/republik-assets/") >= 0) ||
			// https://www.smarthomebeginner.com/images/2012/08/SSH-ubuntu-putty-screenshot-500x301.png?ezimgfmt=ng:webp/ngcb5
			(domain_nowww === "smarthomebeginner.com" && string_indexof(src, "/images/") >= 0) ||
			// https://images.ask.com/amg-cms-images/media/8rwij2v6x38alhvuwzv-uzy6ssz0zdonqnjlbjt7iykv0vikb9jins3tein0-camegg11x9zq4xnml5haykux-5j1vaz63vk0okokwezlexsa7anvf4kgodprsmdajun-mi7-lfpetvdpmhhg.png?width=380&height=210&fit=crop
			domain === "images.ask.com" ||
			// https://i.vimeocdn.com/video/875541868.jpg?mw=960&mh=540
			// thanks to jonestly on discord:
			// https://i.vimeocdn.com/custom_asset/1842?w=816&q=60
			//   https://i.vimeocdn.com/custom_asset/1842 -- 2560x1546
			(domain === "i.vimeocdn.com" && /\/(?:video|custom_asset)\//.test(src)) ||
			// thanks to nimuxoha on github: https://github.com/qsniyg/maxurl/issues/352
			// https://artwork.jaxsta.com/995/e6c1a3ee-e276-4bd7-8c86-d1784df93b13.png?d=85x85
			// https://artwork.jaxsta.com/550/18UMGIM52273_T1_cvrart.jpg?d=85x85
			domain === "artwork.jaxsta.com" ||
			// https://www.tisamipo.co.il/s3/prod.beprotravel/182/BeTop/CMSGALLERY/show/billie-eilish/399px-billie_eilish_2019_by_glenn_francis_20ef0b37.jpg?width=360&height=260&mode=crop&
			(domain_nowww === "tisamipo.co.il" && string_indexof(src, "/CMSGALLERY/") >= 0) ||
			// https://images.shakespearesglobe.com/uploads/2020/05/Lysander-and-Hermnia-A-Midsummer-Nights-Dream-Shakespeares-Globe-2019.jpg?w=1600&gravity
			(domain === "images.shakespearesglobe.com" && string_indexof(src, "/uploads/") >= 0) ||
			// https://cdn.hashnode.com/res/hashnode/image/upload/v1597244649420/jX9JzFN5o.png?w=1600&h=840&fit=crop&crop=entropy&auto=format&q=60
			domain === "cdn.hashnode.com" ||
			// https://d31wcbk3iidrjq.cloudfront.net/SiseXevjk_gl05K7umA.jpg?w=300&h=300
			domain === "d31wcbk3iidrjq.cloudfront.net" ||
			// https://marketplace-screenshots.githubusercontent.com/4085/08623180-5fd0-11e9-9f82-d8feafbd9057?auto=webp&format=jpeg&width=670&dpr=1.5
			domain === "marketplace-screenshots.githubusercontent.com" ||
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/445
			// https://stmedia.stimg.co/1595204480_15483561+George+Floyd+Minneapolis+Police.jpg?h=244&w=396&fit=crop&bg=999&crop=faces
			// https://stmedia.stimg.co/ows_64b11dc5-5e8b-4fa7-9d8d-e1e6e30cdf9b.jpg?h=150&w=300&fit=crop&bg=999&crop=faces
			// https://stmedia.stimg.co/08_1011593363_03DOCK091320_59786311.JPG?auto=compress&crop=faces&dpr=1&w=525
			domain === "stmedia.stimg.co" ||
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/466
			// https://cdn1.coppel.com/images/catalog/pm/6243143-1.jpg?iresize=width:300,height:240
			// https://cdn1.coppel.com/images/catalog/pr/1126002-1.jpg?iresize=width:300,height:240
			// https://cdn1.coppel.com/images/catalog/pr/1094552-1.jpg?iresize=width:300,height:240
			(domain_nosub === "coppel.com" && /^cdn[0-9]*\./.test(domain) && /\/images\//.test(src)) ||
			// thanks to ambler on discord for reporting
			// https://dynamicmedia.livenationinternational.com/Media/k/d/r/c2c71d8c-46eb-4212-a40a-6d8c5ae622b2.jpg?auto=webp&width=408
			(domain === "dynamicmedia.livenationinternational.com" && /:\/\/[^/]+\/+media\//i.test(src)) ||
			// thanks to dym-sh on github: https://github.com/qsniyg/maxurl/issues/501
			// https://www.sanity.io/
			// https://cdn.sanity.io/images/3do82whm/next/0cbb9c1a369267344f0b3748934c156bd5653cbe-2560x1532.png?w=1200&h=718&fit=clip&auto=format
			//   https://cdn.sanity.io/images/3do82whm/next/0cbb9c1a369267344f0b3748934c156bd5653cbe-2560x1532.png -- removing -2560x1532 is 404
			(domain === "cdn.sanity.io" && string_indexof(src, "/images/") >= 0) ||
			// thanks to keophcp on github: https://github.com/qsniyg/maxurl/issues/515
			// https://www.e-outdoor.co.uk/pi/ronhill/RH-003394_BA_8.jpg?w=800&h=800
			(domain_nowww === "e-outdoor.co.uk" && string_indexof(src, "/pi/") >= 0) ||
			// https://eu2-prod-images.disco-api.com/2018/07/09/show-1110-17106492928411.jpg?f=jpeg&p=true&q=75&w=600
			(domain_nosub === "disco-api.com" && /images\./.test(domain)) ||
			// thanks to fedesk on discord
			// https://www.devold.com/globalassets/catalog-images/tc-650-550-a-284c2.jpg?width=320&height=320&mode=max
			(domain_nowww === "devold.com" && /\/globalassets\/+catalog-images\//.test(src)) ||
			// thanks to nijaz-lab on github: https://github.com/qsniyg/maxurl/issues/572
			// https://contents.mediadecathlon.com/p1838690/k$4753af5cd214ab403bb9c745ae932702/sq/Free+Standing+Punching+Bag+100+Inflatable.webp?f=250x250
			domain === "contents.mediadecathlon.com" ||
			// https://ubiservices.cdn.ubi.com/c619c78d-1c6b-47cf-9b36-80160d5c0e8f/applicationCardAsset/lowBoxArt.jpg?imwidth=320
			// https://ubiservices.cdn.ubi.com/c619c78d-1c6b-47cf-9b36-80160d5c0e8f/connect/DEFAULT_WD3REWARDX012_epic.jpg?imwidth=640
			// https://ubiservices.cdn.ubi.com/de132bb9-2b0b-4bd2-b918-7bc26a92d413/spaceCardAsset/boxArt_mobile.jpg?imwidth=320
			domain === "ubiservices.cdn.ubi.com" ||
			// thanks to fedesk on discord: https://news.abplive.com/photo-gallery/news/india-in-pics-delhi-s-protest-sites-fortified-to-prevent-any-further-violence-amid-farmers-agitation-1442144
			// https://feeds.abplive.com/onecms/images/uploaded-images/2021/02/01/c8c6f97001293dbc0bde1e9233e1caba_original.jpg?impolicy=abp_cdn&imwidth=480
			//   https://feeds.abplive.com/onecms/images/uploaded-images/2021/02/01/c8c6f97001293dbc0bde1e9233e1caba_original.jpg
			domain === "feeds.abplive.com" ||
			// thanks to fedesk on discord: https://www.thequint.com/
			// https://images.thequint.com/thequint%2F2018-08%2Fb469a264-0df6-44ed-a4e1-daca007cd998%2Fac576068_30ee_4c46_a4e3_1fe720f0b1dc.jpg?rect=0%2C0%2C750%2C422&auto=format%2Ccompress&fmt=webp&format=webp&w=576&dpr=1.0
			//   https://images.thequint.com/thequint%2F2018-08%2Fb469a264-0df6-44ed-a4e1-daca007cd998%2Fac576068_30ee_4c46_a4e3_1fe720f0b1dc.jpg
			domain === "images.thequint.com" ||
			// https://images.prismic.io/dotdash/f2dda93a-d02a-49df-bc66-006e4f5a753c_flipped_new.jpg?auto=compress,format&rect=0,0,5250,2917&w=1440&h=800&fit=clip&cs=srgb
			domain === "images.prismic.io" ||
			// thanks to fedesk on discord
			// https://files.vierlive.io/protected/images/products/3510ff72-5656-4ff2-8203-674fda015436/hero/f41a67b1-ef61-43c8-8075-8e72c6b1cc32.jpg?d=200x200
			//   https://files.vierlive.io/protected/images/products/3510ff72-5656-4ff2-8203-674fda015436/hero/f41a67b1-ef61-43c8-8075-8e72c6b1cc32.jpg
			(domain === "files.vierlive.io" && string_indexof(src, "/images/") >= 0) ||
			// https://assets.isu.pub/document-structure/200921144707-2a0aae0971b1107bc38f00c114084169/v1/596f8183da0ceda1429acd4217a94513.jpg?crop=451%2C338%2Cx0%2Cy29&originalHeight=500&originalWidth=451&zoom=1
			domain === "assets.isu.pub" ||
			// https://img.nbc.com/sites/nbcunbc/files/images/2020/12/10/53508680-e3a4-36d1-8849-61ae33d92d68.jpg?impolicy=nbc_com&imwidth=480&imdensity=1
			(domain === "img.nbc.com" && /\/files\/+images\//.test(src)) ||
			// https://kake.images.worldnow.com/images/20522261_G.jpeg?auto=webp&disable=upscale&lastEditedDate=1616552523000&width=767
			(domain === "kake.images.worldnow.com" && string_indexof(src, "/images/") >= 0) ||
			// thanks to fedesk on discord
			// https://www.datocms-assets.com/39109/1610833767-1543356619658501-anna5.jpg?auto=format%2Ccompress&fit=clip&h=720&w=802
			domain_nowww === "datocms-assets.com" ||
			// https://cdn.amomama.com/21ac2385baf41f3d3554d857365b62b3.jpg?width=100&height=200
			domain === "cdn.amomama.com" ||
			// thanks to kellnerd on github: https://github.com/qsniyg/maxurl/issues/770
			// https://images.ardmediathek.de/vrwifdtrtsys/6B0pQKK5D6VKnpETpWkp0L/20f93de9e39723911351ac8e3fe6ef20/Mord_im_Spiegel.jpg?w=368
			// https://images.ardmediathek.de/vrwifdtrtsys/MPjpOH4IwFTyEWxlhGnQn/65828fbad0b207683e83d0fd6c168047/16x9-Hackerville.png?w=368
			domain === "images.ardmediathek.de" ||
			// thanks to kellnerd on github: https://github.com/qsniyg/maxurl/issues/1046
			// https://api.ardmediathek.de/image-service/images/urn:ard:image:d5bcbcea380ca802?w=448&ch=58fc6af7dc2f8030
			//   https://api.ardmediathek.de/image-service/images/urn:ard:image:d5bcbcea380ca802 -- 1400x1400
			(domain === "api.ardmediathek.de" && /\/image-service\/+images\//.test(src)) ||
			// https://i.weltbild.de/p/eine-geschichte-die-uns-verbindet-309222922.jpg?v=1&wp=_list-xl
			domain === "i.weltbild.de" ||
			// thanks to MinuteAd8502 on github: https://github.com/qsniyg/maxurl/issues/792
			// https://images-static.nykaa.com/media/catalog/product/7/a/7a73905c861_1.jpg?tr=w-500,pr-true
			domain === "images-static.nykaa.com" ||
			// https://www.familyvideo.com/media/catalog/product/M/V/MVD_BREP202104_1.jpg?quality=80&bg-color=255,255,255&fit=bounds&height=300&width=240&canvas=240:300
			((domain_nowww === "familyvideo.com" ||
			  // thanks to jonestly on discord:
			  // https://us.coca-cola.com/store/media/catalog/product/c/o/coke_byte_gif_867_3_.png?quality=80&fit=bounds&height=750&width=700&canvas=700:750
			  domain_nosub === "coca-cola.com" ||
			  // thanks to karpuzikov on github: https://github.com/qsniyg/maxurl/issues/1254
			  // https://ua.store.asus.com/media/catalog/product/_/i/_inwybrkvetwu4tyg.png?width=439&height=439&store=rog_ua_UA&image-type=image
			  (domain_nosub === "asus.com" && /store\./.test(domain)) ||
			  // thanks to MinuteAd8502 on github: https://github.com/qsniyg/maxurl/issues/851
			  // https://doa.robinson.co.th/media/catalog/product/9/c/9cf533a8499a188af99ceef4979e9c52cbd545a0_mkp0009834dummy.jpg?impolicy=resize&width=553
			  //   https://doa.robinson.co.th/media/catalog/product/9/c/9cf533a8499a188af99ceef4979e9c52cbd545a0_mkp0009834dummy.jpg
			  domain === "doa.robinson.co.th")
			 && /\/media\/+catalog\//.test(src)) ||
			// thanks to MinuteAd8502 on github: https://github.com/qsniyg/maxurl/issues/798
			// doesn't look like /is/image/, seems like a custom system
			// https://media.littlewoodsireland.ie/v/littlewoodsireland/QHWCM_SQ8_0000000024_BLACK_BLUE_DVvL?$180x240_retinamobilex2$
			//   https://media.littlewoodsireland.ie/v/littlewoodsireland/QHWCM_SQ8_0000000024_BLACK_BLUE_DVvL -- 2834x2228
			// https://media.littlewoodsireland.ie/i/littlewoodsireland/NWUFA_SQ1_0000000005_GREY_MDf?$300x400_retinamobilex2$
			//   https://media.littlewoodsireland.ie/i/littlewoodsireland/NWUFA_SQ1_0000000005_GREY_MDf -- 1350x1800
			//   https://media.littlewoodsireland.ie/v/littlewoodsireland/NWUFA_SQ1_0000000005_GREY_MDf -- 404
			domain === "media.littlewoodsireland.ie" ||
			// https://media.littlewoods.com/i/littlewoods/MDKQG_SQ1_0000000099_N_A_SLf1/yawn-double-air-bed.jpg?$234x312_retinax2$&fmt=webp
			//   https://media.littlewoods.com/i/littlewoods/MDKQG_SQ1_0000000099_N_A_SLf1/yawn-double-air-bed.jpg
			domain === "media.littlewoods.com" ||
			// https://media.very.co.uk/i/very/R9R9H_SQ1_0000000013_WHITE_CBf/michelle-keegan-paper-bag-tie-waist-denim-short-white.jpg?$234x312_retinax2$&$roundel_very$&p1_img=new_2017&fmt=webp
			//   https://media.very.co.uk/i/very/R9R9H_SQ1_0000000013_WHITE_CBf/michelle-keegan-paper-bag-tie-waist-denim-short-white.jpg -- 1350x1800
			domain === "media.very.co.uk" ||
			// thanks to MinuteAd8502 on github: https://github.com/qsniyg/maxurl/issues/800
			// https://www.prodirectrunning.com/ProductImages/Main/211051_Main_Thumb_0579942.jpg?impolicy=thumb&imwidth=512
			// https://www.prodirectrunning.com/ProductImages/Gallery_2/211051_Gallery_2_0579945.jpg?impolicy=thumb&imwidth=512
			(domain_nowww === "prodirectrunning.com" && string_indexof(src, "/ProductImages/") >= 0) ||
			// thanks to nimbuz on discord:
			// https://studywalker.jp/images/stdy/seminar/m/0/5gzYsLjBrvNbRDX3Wx.jpg?w=700
			(domain_nowww === "studywalker.jp" && string_indexof(src, "/images/") >= 0) ||
			// thanks to Liz on discord:
			// https://repo.packix.com/api/Packages/5e4d84f299d8fd002e548630/icon/download?size=medium
			(domain === "repo.packix.com" && /\/api\/+Packages\/+[0-9a-f]{10,}\/+icon\//.test(src)) ||
			// https://new.static.tv.nu/93118512?forceFit=0&height=118&quality=80&width=210
			domain === "new.static.tv.nu" ||
			// thanks to Liz for reporting (imgix)
			// https://cdn.royalcanin-weshare-online.io/mSJIPmYBaxEApS7LNQb6/v1/ec62h-signs-your-cat-is-getting-old-hero-cat?w=1440&
			domain === "cdn.royalcanin-weshare-online.io" ||
			// thanks to Liz for reporting
			// https://images.stockx.com/products/streetwear/The-North-Face-x-Brain-Dead-Civilisation-Is-Overrated-Parka-Blue-Multi.png?fit=fill&bg=FFFFFF&w=480&h=320&auto=compress&q=90&dpr=2&trim=color&updated_at=1603481985&pad=0&fm=webp
			domain === "images.stockx.com" ||
			// thanks to nimbuz on discord:
			// https://www.paravi.jp/title/68981
			// https://img.paravi.jp/files/2156d64cf05342d28beb8adffac1563c/95160856936.jpg?w=800&h=800
			//   https://img.paravi.jp/files/2156d64cf05342d28beb8adffac1563c/95160856936.jpg
			(domain === "img.paravi.jp" && string_indexof(src, "/files/") >= 0) ||
			// thanks to MinuteAd8502 on github: https://github.com/qsniyg/maxurl/issues/871
			// https://runningbare-cdn.global.ssl.fastly.net/Data/Media/Images/catalogue/B15686A_black_2.jpg?height=900&width=675&404=default.jpg
			//   https://runningbare-cdn.global.ssl.fastly.net/Data/Media/Images/catalogue/B15686A_black_2.jpg
			domain === "runningbare-cdn.global.ssl.fastly.net" ||
			// thanks to MinuteAd8502 on github: https://github.com/qsniyg/maxurl/issues/882
			// https://ak1.ostkcdn.com/images/products/is/images/direct/ea064dc4d5061a03cb0cc0d680d2e496e265e274/Under-Armour-Womens-Tech-V-Neck-Twist-Short-Sleeve-T-Shirt.jpg?imwidth=200&impolicy=medium
			domain_nosub === "ostkcdn.com" ||
			// thanks to jonestly on discord:
			// https://media.dior.com/couture/ecommerce/media/catalog/product/E/I/1592293528_3SH118YJP_H069_E09_GH.jpg?imwidth=430
			domain === "media.dior.com" ||
			// thanks to anonymous for reporting:
			// https://netstorage-legit.akamaized.net/images/c73948cd410c64f5_w.png?imwidth=900
			(domain === "netstorage-legit.akamaized.net" && string_indexof(src, "/images/") >= 0) ||
			// thanks to fedesk on discord for reporting:
			// https://images.dn.no/image/UTlmUU1ERXhVM1pEUytobzlLb05UQlUzUWgya2lsVVh4Z0U4TmNoMEhuMD0=/nhst/binary/840602aa764ecfe6047ac9c8fc22d2ca?image_version=1080
			//   https://images.dn.no/image/UTlmUU1ERXhVM1pEUytobzlLb05UQlUzUWgya2lsVVh4Z0U4TmNoMEhuMD0=/nhst/binary/840602aa764ecfe6047ac9c8fc22d2ca -- 1600x1928
			domain === "images.dn.no" ||
			// thanks to Liz on discord
			// https://cash-images-f.squarecdn.com/apps/imgs/UUPQFpGnxtpPcWFeIOX8aE.jpeg?width=150
			//   https://cash-images-f.squarecdn.com/apps/imgs/UUPQFpGnxtpPcWFeIOX8aE.jpeg
			(domain === "cash-images-f.squarecdn.com" && /\/apps\/+imgs\//.test(src)) ||
			// thanks to ayunami2000 on github: https://github.com/qsniyg/maxurl/issues/899
			// https://blog.hubspot.com/hs-fs/hubfs/kfc-fck.png?width=600&name=kfc.png
			(domain === "blog.hubspot.com" && /\/hubfs\//.test(src)) ||
			// thanks to anonymous:
			// https://cdn.waplog.com/v1/image/waplog/jpeg/cdn_1630080935_135358065_0aed142b2e.jpg?c=1&q=67&w=350&h=350
			domain === "cdn.waplog.com" ||
			// thanks to DevWannabe-dot: https://github.com/qsniyg/maxurl/issues/928
			// https://wiki.lycanitesmobs.com/_media/equipment:equipment_example.png?w=500&tok=5b77e3
			(domain === "wiki.lycanitesmobs.com" && /\/_media\//.test(src)) ||
			// thanks to Liz on disocrd:
			// https://image.pbs.org/curate-console/239850cf-ac36-49c2-9475-28bfd73543da.jpg?focalcrop=1724x862x50x10&format=webp
			domain === "image.pbs.org" ||
			// thanks to RolerGames on github: https://github.com/qsniyg/maxurl/issues/1010
			// https://squareenixmangaandbooks.square-enix-games.com/en-us/product/9781646091157
			// https://fyre.cdn.sewest.net/manga-books/610a98293b7287001317e11c/cover_img_247x350_amanandhiscat_05_coverfinal-9XnSRPuh_.jpg
			// https://fyre.cdn.sewest.net/manga-books/610a98293b7287001317e11c/cover-OocFiSI19.jpg?width=1000
			domain === "fyre.cdn.sewest.net" ||
			// thanks to Nguyen on discord:
			// https://image.uniqlo.com/UQ/ST3/vn/imagesgoods/439178/item/vngoods_68_439178.jpg?width=1600&impolicy=quality_75
			// https://image.uniqlo.com/UQ/ST3/jp/imagesgoods/448045/item/jpgoods_69_448045.jpg?width=750
			domain === "image.uniqlo.com" ||
			// thanks to nimbuz on discord:
			// https://imgc.nxtv.jp/img/info/tit/00068/SID0068108.png?output-format=webp&output-quality=10&resize=336:*
			//   https://imgc.nxtv.jp/img/info/tit/00068/SID0068108.png
			domain === "imgc.nxtv.jp" ||
			// thanks to fedesk on discord:
			// https://vcdn.polarismedia.no/a6d4c603-c9e5-4899-8fa2-1b122271c9b8?fit=crop&h=600&q=80&tight=false&w=1000
			domain === "vcdn.polarismedia.no" ||
			// https://assistant.gloria.tv/1z94gyaCTBei3D8MsGrYwjE6j/9kguycj0c4267ea2fyoe3xqkq5vnxzhnybwzynt.webp?crop=1080.1080.677.0&still=on&scale=128&format=webp
			//domain === "assistant.gloria.tv" ||
			// thanks to jonestly on discord:
			// https://thumbnails.cbc.ca/maven_legacy/thumbnails/270/427/1-nn-renner-accident-020123.jpg?crop=1.777xh:h;*,*&downsize=1130px:*
			domain === "thumbnails.cbc.ca" ||
			// thanks to roi:
			// https://media.nbcchicago.com/2022/03/107031388-1647446151825-gettyimages-1238588156-BEIJING2022CHINA-BEIJING-OLYMPIC_WINTER_GAMES-FIGURE_SKATING-WOMEN_SINGLE_SKATING-FREE_SKATING_CN.jpeg?quality=85&strip=all&resize=850%2C478
			domain === "media.nbcchicago.com" ||
			// thanks to roi:
			// https://cdn.mopo.de/uploads/sites/4/2022/02/imago1009927687h-scaled.jpg?resize=1024%2C600&crop=0px%2C89px%2C2552px%2C1496px&webp=1
			// https://cdn.mopo.de/uploads/sites/4/2022/02/imago1009862141h.jpg?resize=1024%2C600&webp=1&crop_strategy=smart
			(domain === "cdn.mopo.de" && /\/uploads\//.test(src)) ||
			// thanks to roi:
			// https://images.nordbayern.de/image/contentid/policy:1.12453826:1661111912/Blitzer.jpg?f=16%3A9&h=480&m=FIT&w=900&$p$f$h$m$w=c54e094
			domain === "images.nordbayern.de" ||
			// thanks to roi:
			// https://www.sportsbusinessjournal.com/-/media/images/Daily/2023/02/24/carlos-vela-mls-big-beauty.ashx?mw=100
			(domain_nowww === "sportsbusinessjournal.com" && /\/-\/+media\/+Images\//i.test(src)) ||
			// thanks to roi:
			// https://www.newschainonline.com/bsp-static/image/2023/02/24/17/6c80929b56e560f2b6de552320959da0Y29udGVudHNlYXJjaGFwaSwxNjc3MzQ2Mzk3-2.68826944.jpg?crop=61:45,smart&quality=50&auto=webp&width=955
			(domain_nowww === "newschainonline.com" && /\/bsp-static\//.test(src)) ||
			// thanks to roi:
			// https://images.berliner-kurier.de/2022/12/13/96526302-d9a8-4709-860d-22e8c1963443.jpeg?rect=0%2C51%2C2454%2C1636&w=1024&auto=format
			domain === "images.berliner-kurier.de" ||
			// thanks to roi:
			// https://cdn.nba.com/manage/2022/11/victor-wembanyama-looks.jpg?w=384&h=224
			(domain === "cdn.nba.com" && /\/manage\//.test(src)) ||
			// thanks to roi:
			// https://sportal365images.com/process/smp-images-production/sportal.bg/07122022/a6b06218-27d4-40de-bb50-5da32d2458e6.jpg?operations=crop(25:48:2999:1721),fit(768:433)&format=webp
			domain_nowww === "sportal365images.com" ||
			// thanks to roi:
			// https://cdn.unitycms.io/images/Cmdq5rAiKbM98N-kIQhPPh.jpg?op=ocroped&val=1200,1200,1000,1000,0,0&sum=Zxt0uxj2UQo
			(domain === "cdn.unitycms.io" && /\/images\//.test(src)) ||
			// thanks to roi:
			// https://img.nzz.ch/2023/02/22/09e10c6f-f3d7-43ea-b5f1-5f2d6b56d42b.jpeg?width=1440&height=814&fit=bounds&quality=75&auto=webp&crop=5971,3375,x0,y263
			domain === "img.nzz.ch" ||
			// thanks to roi:
			// https://media.necn.com/2023/02/Screen-Shot-2023-02-23-at-11.52.30-AM.png?resize=850%2C478&quality=85&strip=all
			domain === "media.necn.com" ||
			// thanks to karpuzikov on github: https://github.com/qsniyg/maxurl/issues/1136
			// https://nzxt.com/assets/cms/34299/1627488599-streamerpc1-white-2000x2000-hero.png?ar64=MTox&auto=format&bg64=I2Y2ZjZmOQ&fit=crop&h=100&w=100
			(domain_nowww === "nzxt.com" && /\/assets\/+cms\//.test(src)) ||
			// thanks to karpuzikov on github: https://github.com/qsniyg/maxurl/issues/1142
			// https://www.eposaudio.com/globalassets/__pim/products/h3-series/h3pro-hybrid--green/61c08317-24bd-42ce-8b84-9e82942d0788_33711_h3pro-hybrid-green_if-design-award_fullsizepng.png?width=50
			(domain_nowww === "eposaudio.com" && /\/globalassets\/+__pim\//.test(src)) ||
			// https://static.okko.tv/images/v2/20095036?width=856&scale=1&quality=80&mediaType=webp&trimBorder=true
			domain === "static.okko.tv" ||
			// thanks to roi:
			// https://news.leicester.gov.uk/media/2650/treeoftrees-planting3.jpg?anchor=center&mode=crop&width=400&height=400&rnd=133144559400000000
			(domain === "news.leicester.gov.uk" && /\/media\//.test(src)) ||
			// thanks to roi:
			// https://chorus.stimg.co/24610156/merlin_70635031.jpg?h=133&w=212&fit=crop&bg=999&crop=faces
			domain === "chorus.stimg.co" ||
			// thanks to roi:
			// https://fssochi.ru/content/cms/files/100341.jpg?w=250&h=250&mode=crop
			(domain_nowww === "fssochi.ru" && /\/content\/+cms\/+files\//.test(src)) ||
			// thanks to roi:
			// https://i.gremicdn.pl/image/free/c0f47c117c2e7b7c6462540458831e6d/?t=crop:5000:3101:nowe:0:116,resize:fill:516:317,enlarge:1
			(domain === "i.gremicdn.pl" && /\/image\/+free\//.test(src)) ||
			// thanks to anonymous for reporting:
			// https://images.getbento.com/accounts/7d72c944018b10970914d0f2f3773dbb/media/images/DAU-CrawfishBoil-Postcard-1.jpg?w=100&fit=max&auto=compress,format&h=1000
			domain === "images.getbento.com" ||
			// thanks to anonymous for reporting:
			// https://www.christies.com/img/LotImages/2000/NYR/2000_NYR_09534_0116_000(021056).jpg?maxwidth=200&maxheight=1300
			(domain_nowww === "christies.com" && string_indexof(src, "/img/") >= 0) ||
			// thanks to anonymous for reporting:
			// https://bmg-images.forward-publishing.io/2021/4/5/23c88851-29e0-455b-9c37-7ad884758f59.jpeg?w=1024&auto=format
			domain === "bmg-images.forward-publishing.io" ||
			// thanks to meloner on discord for reporting:
			// https://image-via.katsomo.fi/api/v2/img/6326b431e4b057290876a640?location=main&impolicy=scale&mtvwidth=1600&mtvheight=900
			(domain === "image-via.katsomo.fi" && /\/api\/+v2\/+img\//.test(src)) ||
			// thanks to anonymous for reporting:
			// https://img.plasmic.app/img-optimizer/v1/img/8452dc54121ae641ecc5a565cdd88edd.jpg?q=20&f=webp
			(domain === "img.plasmic.app" && /\/img-optimizer\/+v1\//.test(src)) ||
			// thanks to anonymous for reporting:
			// https://d2kq0urxkarztv.cloudfront.net/5f21d7f2d2e8bc007bf7a34c/3923577/upload-d8621439-e6e9-41bb-9ecc-d61324435798.jpg?w=840&e=webp&cX=0.16666666666662877&cY=0&cW=1666.6666666666667&cH=2500
			domain === "d2kq0urxkarztv.cloudfront.net" ||
			// thanks to anonymous for reporting:
			// https://www.peacocktv.com/dam/growth/assets/seo/HarryPotter/Franchise/hp-tm-logo.png?downsize=200:*&output-format=webp&output-quality=70
			(domain_nowww === "peacocktv.com" && /\/dam\/+[^/]+\/+assets\//.test(src)) ||
			// https://m.hng.io/catalog/product/9/5/951007_BROWN_AND_OTHER_5.jpg?io=PLP&dpr=1
			(domain === "m.hng.io" && /\/catalog\/+product\//.test(src)) ||
			// thanks to anonymous for reporting:
			// https://uploads.dailydot.com/2023/06/Daily-Dot-Newsletter-Web-Crawlr-Image-06-30-2023.jpg?q=65&auto=format&w=1000&ar=2:1&fit=crop
			domain === "uploads.dailydot.com" ||
			// thanks to anonymous for reporting:
			// https://images.audacy2-prod.ext.audacy.com/d526904b-c165-4fdc-9adc-0e09e8a0e16d.jpg?auto=webp&width=152
			domain === "images.audacy2-prod.ext.audacy.com" ||
			// thanks to JustLurkingHere on github: https://github.com/qsniyg/maxurl/issues/1190 (weverse.io)
			// https://phinf.wevpstatic.net/MjAyMzA1MjJfNTUg/MDAxNjg0NzY2ODk4MjAy.dZY02zGoooRX3-K-O1U_d5tRs3APOB2DqEQoIizz4f4g.AFEl-MDN3M8NI4xaMa1sDvxJqW-3FyNsd6evkH5LPnAg.JPEG/image.jpg?type=s468_468_stopgif
			domain === "phinf.wevpstatic.net" ||
			// thanks to anonymous for reporting:
			// https://prod-images.tcm.com/Master-Profile-Images/atriptothemoon1902.401809.jpg?crop=rect&w=960&h=518
			domain === "prod-images.tcm.com" ||
			// thanks to anonymous for reporting:
			// http://media.redbullmusicacademy.com/assets/DWLP-3227.d98ee08b.jpg?auto=format&w=300
			//   http://media.redbullmusicacademy.com/assets/DWLP-3227.d98ee08b.jpg
			domain === "media.redbullmusicacademy.com" ||
			// thanks to TheOne on discord:
			// https://s3media.247sports.com/Uploads/Assets/118/749/10749118.jpeg?width=auto&height=30
			(domain === "s3media.247sports.com" && string_indexof(src, "/Uploads/") >= 0) ||
			// thanks to anonymous for reporting:
			// https://eva.ru/imgix/eva/530000-540000/530020/channel/MyCollages-3_11776317265166448.jpg?w=360
			(domain_nowww === "eva.ru" && string_indexof(src, "/imgix/") >= 0) ||
			// thanks to anonymous for reporting:
			// https://assets.goal.com/v3/assets/bltcc7a7ffd2fbf71f5/blt3989e4d3aad395b8/64e1441c2665ee46c03b733b/GettyImages-1621332903_(1).jpg?auto=webp&format=pjpg&width=1080&quality=60
			domain === "assets.goal.com" ||
			// thanks to anonymous for reporting:
			// https://imgs.casasbahia.com.br/55048758/1g.jpg?imwidth=292
			(domain === "imgs.casasbahia.com.br" && /:\/\/[^/]+\/+[0-9]+\/+[0-9]+[a-z]+\./.test(src)) ||
			// thanks to anonymous for reporting:
			// https://imgr.starmag.com/2023/09/Mathieu-Kassovitz-victime-dun-accident.jpg?resize=450%2C338&ssl=1&ulb=true&ver=2
			domain === "imgr.starmag.com" ||
			// thanks to anonymous for reporting:
			// https://cdn.thewirecutter.com/wp-content/media/2022/07/slot-toaster-2048px-5411-2x1-1.jpg?auto=webp&quality=75&crop=2:1&width=320
			(domain === "cdn.thewirecutter.com" && /\/wp-content\/+media\//.test(src)) ||
			// thanks to anonymous for reporting:
			// https://files.ekmcdn.com/retonthenet/images/vintage-shaving-3-piece-brass-open-comb-safety-razor-made-in-england-1930s-standard-de-blades-6398-p.png?w=141&h=141&v=889c25bf-6052-4e81-8eea-519f4d94e9c9
			(domain === "files.ekmcdn.com" && string_indexof(src, "/images/") >= 0) ||
			// thanks to sn3akyb3ar on github: https://github.com/qsniyg/maxurl/issues/1216
			// https://www.highsnobiety.com/static-assets/dato/1695226374-hs05_lookbook_aw23_d2_003.jpg?fp-x=0.5&fp-y=0.5&fit=crop&auto=compress%2Cformat&cs=srgb&ar=2234%3A1489&w=2234
			(domain_nowww === "highsnobiety.com" && string_indexof(src, "/static-assets/") >= 0) ||
			// thanks to jonestly on discord:
			// https://cdn.kodansha.us/statics/comics/2020/12/9781632363589.jpeg?f=webp&w=405
			//   https://cdn.kodansha.us/statics/comics/2020/12/9781632363589.jpeg
			(domain === "cdn.kodansha.us" && string_indexof(src, "/statics/") >= 0) ||
			// https://assetsio.reedpopcdn.com/Cyberpunk2077_Phantom_Liberty_PS5_The_Heart_of_Dogtown_RGB_clean_WEB.png?width=690&quality=70&format=jpg&auto=webp
			//   https://assetsio.reedpopcdn.com/Cyberpunk2077_Phantom_Liberty_PS5_The_Heart_of_Dogtown_RGB_clean_WEB.png
			domain === "assetsio.reedpopcdn.com" ||
			// thanks to anonymous for reporting:
			// https://www.sony.com/image/a0c3f28f7a8cdb42cf1bc6616116dec8?fmt=jpeg&wid=1160&qlt=43
			(domain_nowww === "sony.com" && /\/image\/+[0-9a-f]{5,}\?/.test(src)) ||
			// thanks to jonestly on discord:
			// https://ugc.production.linktr.ee/5BmIujQReiGmdRmusqiL_s07dSPcNn9ynxclq?io=true&size=avatar
			domain === "ugc.production.linktr.ee" ||
			// thanks to ValiumBear on github: https://github.com/qsniyg/maxurl/issues/1228
			// https://s13emagst.akamaized.net/products/43324/43323414/images/res_75bf76c9d8450a07ecb29cb8fce9cc64.jpg?width=300&height=300&hash=CCF5DBDA23683CC1B3880BDBC810E3A9
			//   https://s13emagst.akamaized.net/products/43324/43323414/images/res_75bf76c9d8450a07ecb29cb8fce9cc64.jpg
			(domain === "s13emagst.akamaized.net" && /\/products\/+[0-9]+\/+[0-9]+\/+images\//.test(src)) ||
			// https://content.api.news/v3/images/bin/883a2c349f46b70366c8d18ea433a7df?width=100
			(domain === "content.api.news" && /\/v3\/+images\/+bin\/+[0-9a-f]{10,}/.test(src)) ||
			// 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)) ||
			// thanks to anonymous for reporting:
			// https://groundnews.b-cdn.net/assets/web/images/about-us/Pointing_Digital_Cutout%201-new.png?width=100
			(domain === "groundnews.b-cdn.net" && /\/assets\/+web\/+images\//.test(src)) ||
			// thanks to anonymous for reporting:
			// https://images.pangobooks.com/images/4a04886a-7c70-4faa-9872-b1822b5be83e?width=800&quality=85&crop=1%3A1
			domain === "images.pangobooks.com" ||
			// thanks to anonymous for reporting:
			// https://assets.mmsrg.com/isr/166325/c1/-/pixelboxx-mss-74995836?x=480&y=334&format=jpg&quality=80&sp=yes&strip=yes&trim&ex=480&ey=334&align=center&resizesource&unsharp=1.5x1+0.7+0.02&cox=0&coy=0&cdx=480&cdy=334
			domain === "assets.mmsrg.com" ||
			// thanks to anonymous for reporting:
			// https://images.moviesanywhere.com/403bd2d2bf3759bf064ffa1da3464306/ca6ba8af-cd64-4c8d-81fb-7808d243ad0c.webp?h=375&resize=fit&w=250
			domain === "images.moviesanywhere.com" ||
			// thanks to anonymous for reporting:
			// https://d1kq2dqeox7x40.cloudfront.net/images/posts/20230810_Ig2PxEY2ZEFTVlC.jpg?w=300
			// https://d1kq2dqeox7x40.cloudfront.net/images/profile_images/20211214_M2CHl32roXp4kTn.png?h=48&w=48
			(domain === "d1kq2dqeox7x40.cloudfront.net" && /\/images\//.test(src)) ||
			// thanks to anonymous for reporting:
			// https://nouwcdn.com/v201/u/44/1353044/419/201908221517070611.jpg?version=202007&width=700
			domain_nowww === "nouwcdn.com" ||
			// thanks to anonymous for reporting:
			// https://eh96lnrmau.user-space.cdn.idcfcloud.net/thumbnail/book/1897.jpg?auto=webp&width=750
			domain === "eh96lnrmau.user-space.cdn.idcfcloud.net" ||
			// https://www.lego.com/cdn/cs/set/assets/blt94d6ae80cbfd9f54/01_Tall_10307_Desktop.jpg?fit=crop&format=webply&quality=80&width=1600&height=700&dpr=1
			(domain_nowww === "lego.com" && /\/cdn\/+.*\/assets\//.test(src)) ||
			// thanks to anonymous for reporting:
			// https://images.delfi.ee/media-api-image-cropper/v1/aa38a240-b907-11eb-922a-c7bedcd3f781.jpg?w=1600&h=914&noup=1
			(domain === "images.delfi.ee" && /\/media-api-image-cropper\//.test(src)) ||
			// thanks to anonymous for reporting:
			// https://images.delfi.lv/media-api-image-cropper/v1/17fe062f-e747-46fe-9293-17807fe26299.jpg?w=588&h=331&r=16:9
			//   https://images.delfi.lv/media-api-image-cropper/v1/17fe062f-e747-46fe-9293-17807fe26299.jpg
			(domain === "images.delfi.lv" && /\/media-api-image-cropper\//.test(src)) ||
			// thanks to nimbuz on discord: https://github.com/qsniyg/maxurl/issues/948
			// https://img.br.de/5d72b187-bd87-4b00-b972-6e2b2b92922d.jpeg?q=80&rect=0%2C125%2C2880%2C1619&w=2000
			// https://img.br.de/64705972-8ec2-4b41-96c6-7a36cecbe0f5.jpeg?q=80&rect=0%2C385%2C2644%2C1488&w=2000
			domain === "img.br.de" ||
			// thanks to anonymous for reporting:
			// https://images.prod.hjholdings.tv/d3urerHm/uploads/migration/1be48297-bb1c-4925-8c6a-1df18751d389.png?w=331&h=447&p=t
			domain === "images.prod.hjholdings.tv" ||
			// thanks to roi:
			// https://img.haarets.co.il/bs/0000018d-805e-daa1-a9fd-e25e74450000/d1/69/6404b74446c6a1e97f964591779e/66679.jpg?height=331&width=570
			//   https://img.haarets.co.il/bs/0000018d-805e-daa1-a9fd-e25e74450000/d1/69/6404b74446c6a1e97f964591779e/66679.jpg
			domain === "img.haarets.co.il" ||
			// thanks to roi:
			// https://www.wnoz.de/imgs/03/1/5/6/9/0/2/wnoz.de__Print-2fbf2d5d9bb48277.png?crop=crop-center&fm=webp&q=70&fit=crop-50-50&s=41b8a3d362451eef7ee46d2e7d3b284a
			(domain_nowww === "wnoz.de" && /\/imgs\//.test(src)) ||
			// thanks to roi:
			// https://assets.steadyhq.com/production/post/1ad97076-f4e7-4d2e-8ad8-f896e4fee0ea/uploads/images/3ebxqpf5as/6.png?auto=compress&w=800&fit=max&dpr=2&fm=webp
			domain === "assets.steadyhq.com" ||
			// thanks to Viper33 on discord for reporting:
			// https://eu-images.contentstack.com/v3/assets/blt6b0f74e5591baa03/blt5bdfa2b3ea18e47c/6594549eb0996904075ca0b5/News_Image_(44).jpg?width=850&auto=webp&quality=95&format=jpg&disable=upscale
			((domain === "eu-images.contentstack.com" ||
			 // https://images.blz-contentstack.com/v3/assets/blt2477dcaf4ebd440c/blt5762082739367179/5dd464a3f4eb996c3143d110/shortstory-thumb_Mercy_MX.jpg?auto=webp&quality=5
			 domain === "images.blz-contentstack.com")
			 && /\/v3\/+assets\//.test(src)) ||
			// thanks to anonymous for reporting:
			// https://img.projektn.sk/wp-static/2014/11/GABK1199.jpg?w=240&h=240&fit=crop-top&fm=png&markx=10w&marky=5w&markpost=bottom-right&markw=15w&mark=2019/08/dennike-512x512.png
			domain === "img.projektn.sk" ||
			// thanks to anonymous for reporting:
			// https://images.daznservices.com/di/library/DAZN_News/77/15/max-verstappen-red-bull-racing-gp-miami-2023-7-mayo-2023-f1_1ma5pdxghb98z1hxevs66jyen7.jpg?t=-48570153&w=800
			//   https://images.daznservices.com/di/library/DAZN_News/77/15/max-verstappen-red-bull-racing-gp-miami-2023-7-mayo-2023-f1_1ma5pdxghb98z1hxevs66jyen7.jpg
			(domain === "images.daznservices.com" &&/\/di\/+library\//.test(src)) ||
			// thanks to anonymous for reporting:
			// https://thetv.jp/i/tl/200/0062/2000062723/8223_r.jpg?w=200&h=547
			domain_nowww === "thetv.jp" ||
			// thanks to nimbuz on discord:
			// https://metac.nxtv.jp/img/info/video/0000201/tit/D0240104-001/D0240104-001_D0240104-001-0010.jpg?output-format=webp&output-quality=60&resize=336:*
			(domain === "metac.nxtv.jp" && /\/img\//.test(src)) ||
			// thanks to anonymous for reporting:
			// https://media.victorinox.com/transform/b450ab5b-7c72-4004-bb26-8d9d710ea4dd/SAK_3_0224_3CN__S3-tif?io=transform%3Afit%2Cwidth%3A1100%2Cheight%3A830&quality=80
			(domain === "media.victorinox.com" && string_indexof(src, "/transform/") >= 0) ||
			// thanks to Froktime on github: https://github.com/qsniyg/maxurl/issues/1292
			// https://image.heavenly.tv/content/11260069207084254729-20240130085043.png?w=300
			//   https://image.heavenly.tv/content/11260069207084254729-20240130085043.png
			// https://image.heavenly.tv/content-item/17738048344724538567-20240219084049.jpg?w=600
			//   https://image.heavenly.tv/content-item/17738048344724538567-20240219084049.jpg
			domain === "image.heavenly.tv" ||
			// thanks to nimbuz on discord:
			// https://images.footballfanatics.com/hokkaido-nippon-ham-fighters/nippon-ham-fighters-x-morning-musume-%E2%80%9924-collaboration-goods-support-furifuri-keychain-mari-makino-24-04-16_16_57_ss5_p-201530806+u-hvrbnttggyrb5tgqluid+v-qeatftb4ama9yv9sfkzg.jpg?_hv=2&w=180
			//   https://images.footballfanatics.com/hokkaido-nippon-ham-fighters/nippon-ham-fighters-x-morning-musume-%E2%80%9924-collaboration-goods-support-furifuri-keychain-mari-makino-24-04-16_16_57_ss5_p-201530806+u-hvrbnttggyrb5tgqluid+v-qeatftb4ama9yv9sfkzg.jpg
			domain === "images.footballfanatics.com" ||
			// thanks to SUPER7X on github: https://github.com/qsniyg/maxurl/issues/1313
			// https://stat.dokusho-ojikan.jp/bf0e01c5-6bc4-4ce0-815a-1d90b9e19130.jpg?dh=302&dw=212&of=webp&q=70
			//   https://stat.dokusho-ojikan.jp/bf0e01c5-6bc4-4ce0-815a-1d90b9e19130.jpg
			domain === "stat.dokusho-ojikan.jp" ||
			// thanks to anonymous for reporting:
			// https://www.savannahnow.com/gcdn/authoring/2006/05/27/NSMN/ghows-GA-436437d7-3af2-44b4-a743-3ff643329b91-de026424.jpeg?width=660&height=527&fit=crop&format=pjpg&auto=webp
			(domain_nowww === "savannahnow.com" && string_indexof(src, "/gcdn/") >= 0) ||
			// thanks to NeverForgotten on discord:
			// https://www.fsunews.com/gcdn/authoring/authoring-images/2024/04/06/NSTN/73230257007-usatsi-22955446-168389668-lowres.jpg?width=660&height=491&fit=crop&format=pjpg&auto=webp
			(domain_nowww === "fsunews.com" && string_indexof(src, "/gcdn/") >= 0) ||
			// thanks to NeverForgotten on discord:
			// https://tallahassee.com/gcdn/authoring/authoring-images/2024/02/11/PFSU/72559764007-427120139-18408937945010663-921368414061942147-n.jpg?width=300&height=347&fit=crop&format=pjpg&auto=webp
			(domain_nowww === "tallahassee.com" && string_indexof(src, "/gcdn/") >= 0) ||
			// thanks to anonymous:
			// https://cdn.leonardo.ai/users/b8083275-cc92-4166-b44f-7c73799e22fb/generations/f0d074d0-f8c5-4113-a465-8d472a3343b9/Default_2D_illustration_of_a_25yo_Supergirl_marathon_runner_sh_2.jpg?w=512
			(domain === "cdn.leonardo.ai" && /\/generations\//.test(src)) ||
			// thanks to anonymous for reporting:
			// https://sozcu01.sozcucdn.com/sozcu/production/uploads/images/2024/5/lllver215486356jpg-oKk3RNrt1kiZmVROnu8xGg.jpg?w=618&h=347&mode=crop&scale=both
			(domain_nosub === "sozcucdn.com" && /^sozcu[0-9]*\./.test(domain) && /\/uploads\/+images\//.test(src)) ||
			// thanks to fireattack on discord:
			// https://prcdn.freetls.fastly.net/release_image/19470/3747/19470-3747-5201a2b2b273708df18ca35314266072-3900x2600.jpg?format=jpeg&auto=webp&quality=85%2C65&width=1950&height=1350&fit=bounds
			domain === "prcdn.freetls.fastly.net" ||
			// thanks to anonymous for reporting:
			// https://www.filmfest-muenchen.de/Pictures/Filme/118/7614/Call_me_Levi-online1_neu.jpg?width=1280
			(domain_nowww === "filmfest-muenchen.de" && string_indexof(src, "/Pictures/") >= 0) ||
			// thanks to anonymous for reporting:
			// https://cdn.hobbyconsolas.com/sites/navi.axelspringer.es/public/media/image/2014/09/388292-caja-metalica-contenidos-exclusivos-comprar-ravens-cry-game.jpg?tf=1200x
			domain === "cdn.hobbyconsolas.com" ||
			// thanks to tathastu871 on discord:
			// https://www.nottingham.ac.uk/Homepage-2021/Images/Hero/Normal-Never-Changed-the-World/Mobile/uon-bbw-603.xcc4dd816.jpg?w=1820&h=1213&crop=1820,500,0,99
			(domain_nowww === "nottingham.ac.uk" && /\/images\//i.test(src)) ||
			// thanks to anonymous for reporting:
			// https://www.catholicnewsagency.com/storage/image/south-korea.jpg?w=180&h=120
			(domain_nowww === "catholicnewsagency.com" && /\/storage\/+image\//.test(src)) ||
			// thanks to anonymous for reporting:
			// https://cdn.ferrari.com/cms/network/media/img/resize/660d022be08fe10010bca850-ferrari-f1-2024-japan-cover-art-full-cover?width=768&height=0
			//   https://cdn.ferrari.com/cms/network/media/img/resize/660d022be08fe10010bca850-ferrari-f1-2024-japan-cover-art-full-cover
			(domain === "cdn.ferrari.com" && /\/media\/+img\//.test(src)) ||
			// thanks to anonymous for reporting:
			// https://www.otempo.com.br/adobe/dynamicmedia/deliver/dm-aid--33a460a9-9598-46e3-863d-b5afc96c0f78/cidades-pris-o-em-bh-1716939511.jpg?preferwebp=true&width=200&quality=90
			//   https://www.otempo.com.br/adobe/dynamicmedia/deliver/dm-aid--33a460a9-9598-46e3-863d-b5afc96c0f78/cidades-pris-o-em-bh-1716939511.jpg
			(domain_nowww === "otempo.com.br" && /\/dynamicmedia\/+deliver\//.test(src)) ||
			// thanks to Liz on discord:
			// https://assetsio.gnwcdn.com/painted_world1.jpg?width=1200&height=1200&fit=bounds&quality=70&format=jpg&auto=webp
			domain === "assetsio.gnwcdn.com" ||
			// thanks to Liz on discord:
			// https://www.azcentral.com/gcdn/presto/2023/06/05/PPHX/d14cdd74-f08e-4aeb-8698-d8a1d856cba4-20230604161124_-_FFusion.jpg?width=1320&height=880&fit=crop&format=pjpg&auto=webp
			(domain_nowww === "azcentral.com" && /\/gcdn\//.test(src)) ||
			// thanks to Liz on discord:
			// https://www.tennessean.com/gcdn/authoring/authoring-images/2024/09/21/USAT/75316038007-charli-xcx-troye-sivan-2024-tour.jpg?width=1200&disable=upscale&format=pjpg&auto=webp
			(domain_nowww === "tennessean.com" && /\/gcdn\//.test(src)) ||
			// thanks to James Joint on discord:
			// https://images.kerrangcdn.com/images/2023/05/NessaBarrett-JamieLeeTaete-2023-9.jpg?auto=compress&fit=max&w=640
			domain === "images.kerrangcdn.com" ||
			// thanks to anonymous for reporting:
			// https://cso.org/media/ls1fzrky/kelliohara_1500x1125_v2.jpg?anchor=center&mode=crop&width=1440&height=795&format=jpg&quality=85&rnd=132965911799130000
			(domain_nowww === "cso.org" && /\/media\//.test(src)) ||
			// thanks to nimbuz on discord:
			// https://newscast.jp/attachments/UnM6oKBOKKWmF98aFEXg.jpg?w=700&h=500&q=100
			//   https://newscast.jp/attachments/UnM6oKBOKKWmF98aFEXg.jpg
			(domain_nowww === "newscast.jp" && string_indexof(src, "/attachments/") >= 0) ||
			// thanks to anonymous for reporting:
			// https://img.trampt.com/products/000/033/448/Love_Thy_Neighbor-Brian_Hurst-Gicle_Digital_Print-trampt-33448o.jpg?tr=w-750,h-750,cm-pad_resize
			domain === "img.trampt.com" ||
			// 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\//) ||
			// https://cdn1.kongcdn.com/assets/avatars/defaults/robotboy.png?i10c=img.resize(width:40)
			src.match(/\?i10c=[^/]*$/) ||
			// http://hypebeast.com/wp-content/blogs.dir/4/files/2018/01/louis-vuitton-2018-fall-winter-50.jpg?q=75&w=400
			// doesn't work:
			// https://d2u7zfhzkfu65k.cloudfront.net/resize/wp-content/uploads/2018/5/8/15/f21a56c81474b277e24bca7575e94dc7.jpg?w=70&q=85
			/^[a-z]+:\/\/[^?]*\/wp(?:-content\/+(?:uploads|blogs.dir)|\/+uploads)\//.test(src)
			/*src.indexOf("/wp-content/blogs.dir/") >= 0 ||
			string_indexof(src, "/wp-content/uploads/") >= 0 ||
			string_indexof(src, "/wp/uploads/") >= 0*/) {
			//src = src.replace(/\?[^/]*$/, "");
			src = src.replace(/\?.*$/, "");
		}

		// https://cdn.odigo.net/60168923a5f06af67f74250c44de7861.png?imageView2/2/w/800/interlace/1%7Cimageslim
		if (domain === "cdn.odigo.net" ||
			// http://wangsuimg.fanshuapp.com/14892066562143large17ef000388f3e91c711a?imageView2/2/w/375/q/80
			domain === "wangsuimg.fanshuapp.com" ||
			// https://img.aiji66.com/83/9d/f1/f4/64/afe732c7-9501-11e7-9040-11832666daf4.jpg?ufopmogr3/auto-orient/thumbnail/300x/crop/x792/interlace/1/quality/100/&e=1519833600&token=Uon2lwH6FDLYBhVyGu5jN25PwVCQuNAIf-_PaQ8E:2Du8aIDyVBLvGBAdS0vvI1eX53c=
			domain === "img.aiji66.com" ||
			// http://imgs.aixifan.com/content/2018_05_01/1525165813.jpg?imageView2/1/w/432/h/240
			domain === "imgs.aixifan.com" ||
			// http://imgcdn.thecover.cn/cf48adfc-f370-4ee9-922e-dd17fe90691e@1532497060708?imageView2/1/w/315/h/157
			domain === "imgcdn.thecover.cn" ||
			// http://img.shelive.net/201704/1c700003b38741b2ef81.jpg?imageView2/2/w/640/h/427
			domain === "img.shelive.net" ||
			// http://img.qdaily.com/article/article_show/201801221803061ecNiBfxSIF2pzrU.jpg?imageMogr2/auto-orient/thumbnail/!245x185r/gravity/Center/crop/245x185/quality/85/format/webp/ignore-error/1
			domain === "img.qdaily.com" ||
			// https://qimage.owhat.cn/prod/shop/cover/1557915266300.jpg?imageMogr2/auto-orient/thumbnail/!750x480r/gravity/Center/quality/80/crop/750x480
			domain === "qimage.owhat.cn" ||
			// https://cdn.ruguoapp.com/7b7fbe6f0a56510160ffe58bbdb9f76a?imageMogr2/auto-orient/thumbnail/1000x2000%3E/quality/70/interlace/1
			domain === "cdn.ruguoapp.com" ||
			// http://user-assets.sxlcdn.com/images/87741/FnNRSp9wPHG_XCQBPjpiPs6vGwlq.jpg?imageMogr2/strip/auto-orient/thumbnail/1920x9000%3E/quality/90!/interlace/1/format/jpg
			(domain === "user-assets.sxlcdn.com" && string_indexof(src, "/images/") >= 0) ||
			// https://img.ksl.com/slc/2657/265775/26577563.jpg?filter=ksl/img143
			domain === "img.ksl.com" ||
			// https://img3.tapimg.com/avatars/1e81533319ff240f73fa29a04ae8b769.jpg?imageMogr2/auto-orient/strip/thumbnail/!300x300r/gravity/Center/crop/300x300/format/jpg/interlace/1/quality/80
			(domain_nosub === "tapimg.com" && domain.match(/^img[0-9]*\./)) ||
			// http://7xka0y.com1.z0.glb.clouddn.com/%E3%80%90%E6%8E%A8%E8%8D%90%E3%80%91%E8%80%81%E5%A4%96%E5%B8%B8%E6%8C%82%E5%9C%A8%E5%98%B4%E8%BE%B9%E7%9A%84%E7%9F%AD%E5%8F%A5%E8%A1%A8%E8%BE%BE%EF%BC%882%EF%BC%89.jpg?imageView2/1/w/375/h/250/q/100
			domain === "7xka0y.com1.z0.glb.clouddn.com" ||
			// https://p4-q.mafengwo.net/s10/M00/73/67/wKgBZ1l9RWWAEl9xAAFOhGs4tI892.jpeg?imageMogr2%2Fthumbnail%2F%21440x260r%2Fgravity%2FCenter%2Fcrop%2F%21440x260%2Fquality%2F100
			// http://b1-q.mafengwo.net/s10/M00/5E/92/wKgBZ1mXs1SAOJDoAAe3hRNOEs475.jpeg?imageView2%2F2%2Fw%2F700%2Fq%2F90%7Cwatermark%2F1%2Fimage%2FaHR0cDovL24xLXEubWFmZW5nd28ubmV0L3MxMS9NMDAvOTEvNzAvd0tnQkVGcF9faTZBUHYtZEFBQUwxMzg3aE0wNjk5LnBuZw%3D%3D%2Fgravity%2FSouthEast%2Fdx%2F10%2Fdy%2F11
			(domain_nosub === "mafengwo.net" && domain.match(/^[a-z][0-9]*(?:-[a-z])?\./)) ||
			//(domain_nosub === "mafengwo.net" && domain.match(/^p[0-9]*(?:-[a-z]+)\./)) ||
			// http://mplive-1253454074.image.myqcloud.com/mplive_dev/imgZmFkNWY0Y2ItNDFkOS00ZTNlLWE3ZmEtZmE4YTA2MGI1NjM0.jpg?imageView2/1/w/400/h/225
			(domain_nosub === "myqcloud.com" && domain.match(/image\.myqcloud\.com/)) ||
			// http://pic.qianye88.com/0c4b3bc07a69b2ed260d3b17e15ff4f2.jpeg?imageMogr2/thumbnail/x300/quality/90!
			domain === "pic.qianye88.com" ||
			// http://imgboys1.yohobuy.com/spidercms/2018/01/27/01/0127fc0ca0f50496e5235ebc742ff0e056.jpeg?imageView2/2/w/240/q/75|imageslim
			(domain_nosub === "yohobuy.com" && domain.match(/^img[a-z]*[0-9]*\.yohobuy\.com$/)) ||
			// http://i-4-yxdown.715083.com/2018/3/30/a9be3ebb-50a7-4993-9cfb-c1a3ddc3ff61.png?imageView2/2/q/65/w/600
			(domain_nosub === "715083.com" && domain.match(/^i-[0-9]*-yxdown\./)) ||
			// http://i-4.yxdown.com/2018/3/30/KDYwMHgp/a9be3ebb-50a7-4993-9cfb-c1a3ddc3ff61.png?imageView2/2/q/65/w/600
			(domain_nosub === "yxdown.com" && domain.match(/^i-[0-9]*\./)) ||
			// https://jkcdn.pajk.com.cn/image/T1iZhnBvd_1R4bAZ6K.jpg?img=/tf,d_jpg,q_70/rs,w_500
			(domain === "jkcdn.pajk.com.cn" && string_indexof(src, "/image/") >= 0) ||
			// https://www.hola.com/imagenes/moda/tendencias/2016071486971/summer-denim-looks/0-377-84/jessica_alba_1-a.jpg?interpolation=lanczos-normal&downsize=200px:*&output-format=progressive-jpeg
			// https://us.hola.com/en/imagenes/fashion/2017111710813/latin-grammy-awards-2017-red-carpet-fashion/0-16-344/latin-grammys-t.jpg?interpolation=lanczos-normal&downsize=780px:*&output-format=progressive-jpeg
			// https://us.hola.com/en/imagenes/celebrities/2018012911210/grammy-awards-2018-camila-cabello-mom-nick-jonas/0-19-519/camila-cabello-grammy-awards-t.jpg?composite=0.9%7C1/8xw%3A%2A%3Bright%5B0.02xw%5D%2Cbottom%5B0.02xw%5D%7CRJmqrP23Dz8EaRRxMm5bs07f5pu42i2f
			(domain_nosub === "hola.com" && string_indexof(src, "/imagenes/") >= 0) ||
			// http://static.leiphone.com/uploads/new/article/600_600/201409/54087bb6e4a2c.jpg?imageMogr2/thumbnail/1920x%3E/format/jpg/quality/90
			(domain === "static.leiphone.com" && string_indexof(src, "/uploads/") >= 0) ||
			// https://static-movie.a.88cdn.com/3e253bd7c046ee9ab3611b6fa6df6380584de3a2?imageView2/2/q/85/interlace/1/format/gif
			domain === "static-movie.a.88cdn.com" ||
			// http://image.qianye88.com/pic/4a05c5838eb8bbb41a3a1af82815c4f7?imageMogr2/thumbnail/!400x260r/gravity/North/crop/400x260/quality/90!
			(domain === "image.qianye88.com" && string_indexof(src, "/pic/") >= 0) ||
			// http://pc.wangpan.xycdn.n0808.com/57984519e2491eb5cf3a536c3e2a434016908e1a?imageView2/2/w/460/q/90/interlace/1/format/gif
			domain === "pc.wangpan.xycdn.n0808.com" ||
			// http://resource.meihua.info/fa6c53e3-2dfb-441d-a323-158146e5a9aa.jpg?imageView2/0/format/jpg
			domain === "resource.meihua.info" ||
			// https://i.ezbuy.sg/Fgf2dNzJvLXyyw04b-yGRWTRUbmx?imageView2/2/w/264/q/90/format/webp
			domain === "i.ezbuy.sg" ||
			// https://i.guancha.cn/bbs/2020/01/15/20200115091914743?imageView2/2/w/500/format/jpg
			domain === "i.guancha.cn" ||
			// http://pic.xcarimg.com/2020/02/09/o_1e0jjiker16k31i831ig61jho1b9d0.jpg?imageMogr2/format/jpg/sizeLimit/100k!/ignore-error/1
			domain === "pic.xcarimg.com" ||
			// http://upload-images.jianshu.io/upload_images/1685198-ebfc2a22664f623c?imageMogr2/auto-orient/strip%7CimageView2/2/w/300
			domain === "upload-images.jianshu.io" ||
			// thanks to roi:
			// https://mz.eastday.com/62506697.jpeg?imageView2/1/w/675/h/450
			//   https://mz.eastday.com/62506697.jpeg?imageslim
			domain === "mz.eastday.com" ||
			// thanks to anonymous for reporting:
			// https://s.isanook.com/gu/0/pichistory/118112112007053654.jpg?ip/crop/w200/q90/webp
			domain === "s.isanook.com" ||
			// thanks to doio on github: https://github.com/qsniyg/maxurl/issues/1065
			// https://att.fengimg.com/2022/10/01/180531wola29wdc80v3bq1.jpeg?imageMogr2/thumbnail/320x/format/jpg/interlace/0/quality/100 -- via https://www.feng.com/post/13618502
			//    https://att.fengimg.com/2022/10/01/180531wola29wdc80v3bq1.jpeg
			domain_nosub === "fengimg.com") {
			src = src.replace(/\?.*$/, "");
		}

		if ((domain_nosub === "tradesy.com" && domain.match(/^item[0-9]*\.tradesy/) && string_indexof(src, "/images/") >= 0) ||
			// thanks to roi:
			// https://www.birminghamworld.uk/jpim-static/image/2023/01/10/12/newFile-4.jpg?quality=65&smart&width=640
			(domain_nowww === "birminghamworld.uk" && /\/jpim-static\/+image\//.test(src)) ||
			// thanks to roi:
			// https://www.nationalworld.com/jpim-static/image/2023/01/14/15/newFile.jpg?quality=65&smart&width=640
			(domain_nowww === "nationalworld.com" && /\/jpim-static\/+image\//.test(src)) ||
			// thanks to Liz on discord for reporting:
			// https://digitalcontent.api.tesco.com/v2/media/ghs/c63ca81c-b4d0-471f-b141-41a4427c8b8c/6469fe59-3273-466e-83ce-18670abf8545_1589390207.jpeg?h=225&w=225
			(domain === "digitalcontent.api.tesco.com" && /\/v2\/+media\//.test(src)) ||
			// thanks to anonymous for reporting:
			// https://gitlab.winehq.org/uploads/-/system/user/avatar/4/avatar.png?width=24
			(domain === "gitlab.winehq.org" && /\/uploads\/+/.test(src)) ||
			// thanks to anonymous for reporting:
			// https://cdn.hfashionmall.com/goods/THBR/23/12/06/GM0123120671139_9_ORGINL_1707960601850.jpg?RS=600x600&AR=0&CS=400x600
			domain === "cdn.hfashionmall.com" ||
			// thanks to n0099 on github: https://github.com/qsniyg/maxurl/issues/1314
			// https://steamcommunity-a.akamaihd.net/chat/image/ytVLh2iuegcBz8cmwozQlRfu4DI9bkP3nqrIsC2towJsb9Vg8-QAX71yzn1RAw/share_image.jpg?s=256x140
			(domain === "steamcommunity-a.akamaihd.net" && string_indexof(src, "/image/") >= 0) ||
			// thanks to anonymous for reporting:
			// https://media-assets.grailed.com/prd/listing/temp/566bb1a355784bfba56883862d980d4a?w=123&h=164&fit=crop&auto=format
			domain === "media-assets.grailed.com" ||
			// thanks to anonymous for reporting:
			// https://hexbear.net/pictrs/image/c501cc95-0e88-4b1e-a72b-de8a19a87adf.png?format=webp&thumbnail=256
			(domain_nowww === "hexbear.net" && /\/pictrs\/+image\//.test(src)) ||
			// thanks to MinuteAd8502 on github: https://github.com/qsniyg/maxurl/issues/874
			// https://img01.ztat.net/article/spp-media-p1/369ffb094cae4443bee45519929dddb8/4269d8d79cfe418888fdc155bf1a8e2e.jpg?imwidth=762
			//   https://img01.ztat.net/article/spp-media-p1/369ffb094cae4443bee45519929dddb8/4269d8d79cfe418888fdc155bf1a8e2e.jpg -- 1801x2600
			(domain_nosub === "ztat.net" && /^img[0-9]*\./.test(domain))) {
			// https://item4.tradesy.com/images/miu-miu-cut-off-cat-eye-marble-havana-retro-funky-sunnies-sunglasses-1063438-5-0.jpg?width=720&height=960 -- stretched, 406 for head
			return {
				url: src.replace(/\?.*$/, ""),
				can_head: false
			};
		}

		if (domain === "img-static.tradesy.com") {
			// https://img-static.tradesy.com/item/1063438/miu-miu-cut-off-cat-eye-marble-havana-retro-funky-sunnies-sunglasses-5-0-960-960.jpg
			//   https://item4.tradesy.com/images/miu-miu-cut-off-cat-eye-marble-havana-retro-funky-sunnies-sunglasses-1063438-5-0.jpg
			return src.replace(/:\/\/[^/]+\/+item\/+([0-9]+)\/+([^/]+)(-[0-9]+-[0-9]+)-[0-9]+-[0-9]+(\.[^/.?]+)(?:[?#].*)?$/, "://item4.tradesy.com/images/$2-$1$3$4");
		}

		if (domain === "store-images.microsoft.com" ||
			// http://store-images.s-microsoft.com/image/apps.29315.9007199266376618.a07f1cfa-b27d-402c-98e5-a3bae29e8cf3.9fd604bc-2a5c-4e17-be7d-37af2d7afe02?w=180&h=180&q=60
			domain === "store-images.s-microsoft.com") {
			// https://store-images.microsoft.com/image/apps.48655.9007199266600012.ac6a9859-80c3-4fc8-8ac1-45b10b74e7ab.e9bce38b-5ca6-4355-8e25-a2d486d2d568?w=712&h=400&mode=letterbox&background=black
			return {
				url: src.replace(/\?.*$/, ""),
				head_wrong_contenttype: true
			};
		}

		if (domain === "ci.xiaohongshu.com" ||
			// thanks to Froktime on github for reporting: https://github.com/qsniyg/maxurl/issues/1363
			// https://sns-img-al.xhscdn.com/55aecc9b-df03-0ef1-a602-1d126e78035b?imageView2/2/w/1080/format/jpg
			//   https://sns-img-al.xhscdn.com/55aecc9b-df03-0ef1-a602-1d126e78035b
			domain === "sns-img-al.xhscdn.com") {
			// https://ci.xiaohongshu.com/751cccf1-a34a-57fd-ac5e-438265582359?imageMogr2/thumbnail/640x640/format/jpg/quality/92/auto-orient/strip
			return {
				url: src.replace(/\?.*$/, ""),
				headers: {
					Referer: ""
				},
				referer_ok: {
					same_domain: true
				}
			};
		}

		if (domain_nowww === "dailyherald.com") {
			// http://www.dailyherald.com/storyimage/DA/20140418/news/140418160/AR/0/AR-140418160.jpg&updated=201404182313&MaxW=800&maxH=800&noborder
			newsrc = src.replace(/[?&].*$/, "");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nosub === "billboard.com" && /static\./.test(domain)) {
			// thanks to DevWannabe-dot on github: https://github.com/qsniyg/maxurl/issues/908
			// https://charts-static.billboard.com/img/2020/11/the-kid-laroi-qev-without-you-mqd-155x155.jpg
			//   https://charts-static.billboard.com/img/2020/11/the-kid-laroi-qev-without-you-mqd-480x480.jpg
			newsrc = src
				.replace(/(\/img\/+[0-9]{4}\/+[0-9]{2}\/+[^/]+-)240x240\./, "$1480x480.")
				.replace(/(\/img\/+[0-9]{4}\/+[0-9]{2}\/+[^/]+-)155x155\./, "$1240x240.");
			if (newsrc !== src)
				return newsrc;
		}

		if ((domain_nowww === "elindependiente.com" ||
			// thanks to roi:
			// https://www.stadtlandmama.de/wp-content/uploads/2023/04/Schmiedel_Stevie_c_Miguel_Ferraz-720x471.jpg.webp
			//   https://www.stadtlandmama.de/wp-content/uploads/2023/04/Schmiedel_Stevie_c_Miguel_Ferraz.jpg
			domain_nowww === "stadtlandmama.de" ||
			// thanks to roi:
			// https://www.5min.at/wp-content/uploads/2023/04/Panorama-Weissensee-01_web-cStabentheiner-121-1-310x174.jpg.webp
			//   https://www.5min.at/wp-content/uploads/2023/04/Panorama-Weissensee-01_web-cStabentheiner-121-1.jpg
			domain_nowww === "5min.at" ||
			// thanks to TheLastZombie on github: https://github.com/qsniyg/maxurl/issues/1055
			// https://fantasytopics.com/wp-content/uploads/2022/07/Ore-Distribution-735x631.jpg.webp
			//   https://fantasytopics.com/wp-content/uploads/2022/07/Ore-Distribution.jpg
			domain_nowww === "fantasytopics.com") && /\/wp-content\/+uploads\//.test(src) ||
			// thanks to anonymous for reporting:
			// https://mmerevise.co.uk/app/uploads/2023/05/GCSE-English-Cards-How-they-look-NEW-2-1536x1089.png.webp
			//   https://mmerevise.co.uk/app/uploads/2023/05/GCSE-English-Cards-How-they-look-NEW-2.png
			(domain_nowww === "mmerevise.co.uk" && /\/app\/+uploads\//.test(src))) {
			// thanks to roi:
			// https://www.elindependiente.com/wp-content/uploads/2023/02/6bb9b138ba3df401a3040dc097e383ff9b8bc9a2-672x375.jpg.webp
			//   https://www.elindependiente.com/wp-content/uploads/2023/02/6bb9b138ba3df401a3040dc097e383ff9b8bc9a2.jpg
			return src
				.replace(/(\.[a-z]+)\.webp([?#].*)?$/, "$1$2")
				.replace(/-[0-9]+x[0-9]+(\.[^/.]+(?:[?#].*)?)$/, "$1");
		}

		if (domain_nowww === "collectivegen.com" && /\/wp-content\/+uploads\//.test(src)) {
			// thanks to roi:
			// https://collectivegen.com/wp-content/uploads/2016/12/Wardrobe-Rehab_Colour-Guide_InfographicV2-778x1146@2x.jpg
			//   https://collectivegen.com/wp-content/uploads/2016/12/Wardrobe-Rehab_Colour-Guide_InfographicV2.jpg
			return src.replace(/-[0-9]+x[0-9]+(?:@[0-9]+x)?(\.[^/.]+(?:[?#].*)?)$/, "$1");
		}

		// check to make sure this doesn't break anything
		// test: https://s3.amazonaws.com/oscars-img-abc/wp-content/uploads/2017/02/26164054/950c51cde0a1cab411efdbf8f1abc117a6aad749397172c9b95dd3c47bfb6f6f-370x492.jpg
		// http://3.imimg.com/data3/BH/EP/MY-26242/silk-printed-ties-500x500.jpg
		if (domain_nosub === "imimg.com" ||
			//domain.indexOf(".files.wordpress.com") >= 0 || // doesn't work
			// https://blogs-images.forbes.com/jasonevangelho/files/2018/06/playstation-logo-1200x675.jpg
			domain === "blogs-images.forbes.com" ||
			// http://static.thesuperficial.com/uploads/2016/07/lindsay-lohan-egor-tarabasov-butterfly-ball-0701-01-420x560.jpg -- dead
			domain === "static.thesuperficial.com" ||
			// doesn't work:
			// http://static.celebuzz.com/uploads/2011/06/10/Emma-Roberts-Outside-Today-Show-in-NYC-e1435832610488-385x560.jpg
			// http://static.celebuzz.com/uploads/2011/06/10/Emma-Roberts-Outside-Today-Show-in-NYC.jpg
			// http://static.celebuzz.com/uploads/2011/06/10/Emma-Roberts-Outside-Today-Show-in-NYC-e1435832660684-310x560.jpg
			// http://static.celebuzz.com/uploads/2011/06/10/Emma-Roberts-Outside-Today-Show-in-NYC.JPG
			// works:
			// http://static.celebuzz.com/uploads/2018/02/kim-kardashian-celeb-snaps-020218-1517608914-414x268.jpg
			domain === "static.celebuzz.com" ||
			// http://img.vogue.co.kr/vogue/2018/07/style_5b43023b0c1b0-783x930.jpg
			domain === "img.vogue.co.kr" ||
			// https://static.spin.com/files/2016/11/needledropjeremy-1480526302-1648x800.png
			domain === "static.spin.com" ||
			// https://zrockr.com/user-files/uploads/2018/04/John5.4.7.2018-3867-1024x683.jpg
			domain_nowww === "zrockr.com" ||
			// http://electricegg.co.uk/media/uploads/2017/08/nick-hewer-by-electric-egg-375x320.jpg
			domain_nowww === "electricegg.co.uk" ||
			// https://iphone7wallpapers.co/media/uploads/2017/08/Josie-Lane-Model-Girl-Cute-300x533.jpg
			(domain_nowww === "iphone7wallpapers.co" && /\/media\/+uploads\//.test(src)) ||
			// https://androidhdwallpapers.com/media/uploads/2017/08/Josie-Lane-Model-Girl-Cute-640x960.jpg
			(domain_nowww === "androidhdwallpapers.com" && /\/media\/+uploads\//.test(src)) ||
			// http://www.media2.hw-static.com/media/2018/01/wenn_kerrywashington_012618-442x216.jpg
			(domain_nosub === "hw-static.com" && domain.match(/www\.media[0-9]*\.hw-static\.com/)) ||
			// http://i2.cdn.turner.com/money/dam/assets/160511121527-emma-watson-780x439.jpg
			(domain_nosub === "turner.com" && /^i[0-9]*\.cdn\./.test(domain)) ||
			// http://k99.com/files/2013/01/JohnnyCarson_Facebook-630x477.jpg
			domain_nowww === "k99.com" ||
			// http://97rockonline.com/files/2012/07/Flag-Bikini-Venus-214x300.jpg
			domain_nowww === "97rockonline.com" ||
			// http://wfgr.com/files/2011/03/old-rich-woman-200x300.jpg
			domain_nowww === "wfgr.com" ||
			// http://wblk.com/files/2013/04/sirius-alien-630x355.jpg
			domain_nowww === "wblk.com" ||
			// http://fun107.com/files/2015/01/charlie-hunnam-and-chris-hemsworth-630x346.jpg
			domain_nowww === "fun107.com" ||
			// http://965kvki.com/files/2013/12/christmasgenius-630x472.jpg
			domain_nowww === "965viki.com" ||
			// http://1079ishot.com/files/2013/06/90713084-630x434.jpg
			domain_nowww === "1079ishot.com" ||
			// https://edge.alluremedia.com.au/m/l/2017/05/Surface-Laptop-410x231.png
			domain === "edge.alluremedia.com.au" ||
			// https://s3-us-west-1.amazonaws.com/blogs-prod-media/us/uploads/2016/06/02110848/Coco-Austin-breastfeeding-650x630.jpg
			(amazon_container === "blogs-prod-media" && string_indexof(src, "/uploads/") >= 0) ||
			// https://d36tnp772eyphs.cloudfront.net/blogs/1/2014/08/8754021448_bf2a5c94a3_k-940x403.jpg
			domain === "d36tnp772eyphs.cloudfront.net" ||
			// http://img.allurekorea.com/allure/2016/10/style_581190dac6d83-835x1024.jpg
			domain === "img.allurekorea.com" ||
			// https://www.psu.com/app/uploads/2017/12/gang_beasts_review_01-1024x576.jpg
			// https://psu.com/app/uploads/2017/12/gang_beasts_review_01-1024x576.jpg
			domain_nowww === "psu.com" ||
			// http://media.popculture.com/2018/01/demi-lovato-fabletics-fitness-leggings-20022601-160x90.jpeg
			domain === "media.popculture.com" ||
			// http://www.rap-up.com/app/uploads/2018/02/rihanna-gpe-340x330.jpg
			// http://rap-up.com/app/uploads/2018/02/rihanna-gpe-340x330.jpg
			domain_nowww === "rap-up.com" ||
			// https://www.funweek.it/app/uploads/2018/01/kay-panabaker-38703-200x300.jpeg
			(domain_nowww === "funweek.it" && string_indexof(src, "/uploads/") >= 0) ||
			// http://img.snacker.hankyung.com/hk-content/2017/08/terracotta-army-1865006__340-400x300.jpg
			(domain_nosub === "hankyung.com" && domain.match(/img\..*?\.hankyung\.com$/)) ||
			// https://www.traveltipy.com/content/uploads/2015/10/Gorlitz-Germany-1024x692.jpg
			domain_nowww === "traveltipy.com" ||
			// http://coveteur.com/content/uploads/2017/03/Emma-Roberts-Hair-3-940x940.jpg
			domain_nowww === "coveteur.com" ||
			// thanks to fedesk on discord
			// https://s3-eu-central-1.amazonaws.com/gaffa-prod/content/uploads/2014/10/08090711/167516-h1000-980x552.jpeg
			amazon_container === "gaffa-prod" ||
			// http://food-ehow-com.blog.ehow.com/files/2014/12/edits-2282-1024x682.jpg
			(domain_nosub === "ehow.com" && string_indexof(domain, ".blog.ehow.com") >= 0) ||
			// https://cdn2.theheartysoul.com/uploads/2016/06/image1-798x418.jpg
			(domain_nosub === "theheartysoul.com" && domain.match(/cdn[0-9]*\.theheartysoul\.com/)) ||
			// http://www.bandt.com.au/information/uploads/2017/08/Screen-Shot-2017-08-01-at-10.58.17-am-420x280.png
			// http://bandt.com.au/information/uploads/2017/08/Screen-Shot-2017-08-01-at-10.58.17-am-420x280.png
			domain_nowww === "bandt.com.au" ||
			// https://www.theepochtimes.com/assets/uploads/2017/08/28/Agriculture-dependent-to-the-river-5-700x420.jpg
			(domain_nosub === "theepochtimes.com" && src.match(/\/assets\/+uploads\/+/)) ||
			// https://m.theepochtimes.com/assets/uploads/2016/06/15/Argan_Tree_near_Tafraoute-550x330.jpg
			//domain === "m.theepochtimes.com" ||
			// https://images.gamme.com.tw/news2/2018/82/30/pJySpaabj56WsKQ-300x250.jpg
			// https://images2.gamme.com.tw/news2/2016/48/54/q5iYop_Xk6CXqqQ-270x180.jpg
			(domain_nosub === "gamme.com.tw" && /^images[0-9]*\./.test(domain)) ||
			// http://images.gamme.com.cn/news2/2017/97/14/pZeao56Yj6aZqA-380x300.jpg
			domain === "images.gamme.com.cn" ||
			// http://cdn.hoahoctro.vn/uploads/2018/02/5a87a07c09b7e-pagehihi-600x450.jpg
			domain === "cdn.hoahoctro.vn" ||
			// https://vnn-imgs-f.vgcloud.vn/2018/02/22/09/fan-xon-xao-mat-son-tung-beo-u-sau-tet-nguyen-dan-140x78.jpg
			domain === "vnn-imgs-f.vgcloud.vn" ||
			// https://static.vibe.com/files/archives/galleries/2005/01/23/ciara2-160x160.jpg
			domain === "static.vibe.com" ||
			// https://rightsinfo.org/app/uploads/2018/02/nathan-dumlao-378988-unsplash-1024x671.jpg
			(domain_nowww === "rightsinfo.org" && string_indexof(src, "/uploads/") >= 0) ||
			// http://spotted.tv/app/uploads/20131210-2339481-750x355.jpg
			(domain_nowww === "spotted.tv" && string_indexof(src, "/uploads/") >= 0) ||
			// http://tokyopopline.com/images/2013/01/130106kara6-515x341.jpg
			(domain_nowww === "tokyopopline.com" && string_indexof(src, "/images/") >= 0) ||
			// http://px1img.getnews.jp/img/archives/2017/10/ba35fadf68725a24224b306250f20c2f-1024x761.jpg
			domain === "px1img.getnews.jp" ||
			// https://media.thetab.com/blogs.dir/279/files/2017/03/emma-1177x557.jpg
			domain === "media.thetab.com" ||
			// https://assets.rockpapershotgun.com/images//2018/02/survivingmars2-620x315.jpg
			domain === "assets.rockpapershotgun.com" ||
			// http://f.imgs.vietnamnet.vn/2017/11/05/09/t-ara-roi-nuoc-mat-vi-fan-viet-4-100x30.jpg
			// http://imgs.vietnamnet.vn/Images/2015/11/17/10/20151117104955-av-240x160.jpg
			(domain_nosub === "vietnamnet.vn" && /^(?:[^/]*\.)?img(?:\.cdn[0-9]*|s)\./.test(domain)) ||
			//(domain_nosub === "vietnamnet.vn" && string_indexof(domain, ".imgs.vietnamnet.vn") >= 0) ||
			// https://sloanreview.mit.edu/content/uploads/2018/04/GEN-Ross-Digital-Transformation-Speed-Long-Term-1200-300x300.jpg
			domain === "sloanreview.mit.edu" ||
			// http://business.inquirer.net/files/2017/09/pet6-1024x682.jpg
			// https://preen.inquirer.net/files/2017/08/IMG_1911-300x200.jpg
			(domain_nosub === "inquirer.net" && string_indexof(src, "/files/") >= 0) ||
			// http://static.thefrisky.com/uploads/2013/07/10/Victoria-Justice-Lucy-Hale-And-Nina-Dobrev-600x450.jpg
			//   http://static.thefrisky.com/uploads/2013/07/10/Victoria-Justice-Lucy-Hale-And-Nina-Dobrev.jpg
			domain === "static.thefrisky.com" ||
			// http://hobby.dengeki.com/ss/hobby/uploads/2017/12/P1014922-440x586.jpg
			domain === "hobby.dengeki.com" ||
			// https://cdn-blog.adafruit.com/uploads/2017/06/megumin-cosplay-360x480.jpg
			domain === "cdn-blog.adafruit.com" ||
			// http://img.uuhy.com/uploads/2010/10/sexy-cosplay-46-550x825.jpg
			// http://simg.uuhy.com/2017/06/businesscards7-220x150.jpg
			(domain_nosub === "uuhy.com" && domain.match(/s?img\.uuhy\.com/)) ||
			// http://img.butongshe.com/2017/12/DSXVVOWVAAEVjVa-520x245.jpg
			domain === "img.butongshe.com" ||
			// https://myreco.asia/img/uploads/article/SE9OJk4VWYhKq8JN1t7THTyVFzvdbA2qOy3XgEVS-2000x1000.jpeg
			(domain_nowww === "myreco.asia" && string_indexof(src, "/uploads/") >= 0) ||
			// https://d3p157427w54jq.cloudfront.net/uploads/2018/01/selena-site-637x397.jpg
			(domain === "d3p157427w54jq.cloudfront.net" && string_indexof(src, "/uploads/") >= 0) ||
			// http://cdn.harpersbazaar.com.sg/2017/10/DSC_2716-1200x799.jpg
			domain === "cdn.harpersbazaar.com.sg" ||
			// https://media.harpersbazaar.com.sg/2018/03/Emma-Watson-700x933.jpg
			domain === "media.harpersbazaar.com.sg" ||
			// http://nsfw.myconfinedspace.com/files/2017/06/gomez__7__1-1000x1500.jpg
			domain_nosub === "myconfinedspace.com" ||
			// https://s3.amazonaws.com/hiphopdx-production/2017/08/Rihanna-826x620.jpg
			amazon_container === "hiphopdx-production" ||
			// https://assets.wonderlandmagazine.com/uploads/2014/11/Taylor-Swift-Wonderland-1-Crop-345x483.jpg
			domain === "assets.wonderlandmagazine.com" ||
			// https://am24.akamaized.net/tms/cnt/uploads/2017/04/taylor-swift-650x372.jpg
			// https://am21.akamaized.net/tms/cnt/uploads/2019/01/CardiB-1200x831.jpg
			(domain_nosub === "akamaized.net" && domain.match(/^am[0-9]*\./) && /\/tms\/+cnt\/+uploads\//.test(src)) ||
			// http://snappa.static.pressassociation.io/assets/2016/04/08154418/1460126656-210b91ce6f5398e743add7f71b3e9b72-600x986.jpg
			(domain_nosub === "pressassociation.io" && string_indexof(domain, "static.pressassociation.io") >= 0) ||
			// https://assets.vg247.com/current/2014/09/sep_23_-_keyart_inquisitormf_v3-156x108.jpg
			domain === "assets.vg247.com" ||
			// https://www.theblemish.com/images/2015/02/taylor-swift-stops-by-kelsey-edwards-studio-17-640x881.jpg
			(domain_nowww === "theblemish.com" && string_indexof(src, "/images/") >= 0) ||
			// https://www.dailyxtra.com/content/uploads/2017/06/billc36-479x270.jpg
			(domain_nowww === "dailyxtra.com" && /\/content\/+uploads\//.test(src)) ||
			// https://media.metrolatam.com/2018/05/12/neymarseponecamistapsg2018-09b3bddb47d54ac1e4d12b24697bc2e8-300x200.jpg
			domain === "media.metrolatam.com" ||
			// http://media.comicbook.com/2018/01/dove-cameron-ruby-agents-of-shield-1079103-1280x0.jpeg
			domain === "media.comicbook.com" ||
			// https://www.grazia.it/content/uploads/2018/01/Dove-Cameron-800x599.jpg
			domain_nowww === "grazia.it" ||
			// https://img.kpopmap.com/2018/05/loco-445x262.jpg
			domain === "img.kpopmap.com" ||
			// https://s.nbst.gr/files/1/2018/03/AP_18064008875527-353x221.jpg
			domain === "s.nbst.gr" ||
			// https://assets.metrolatam.com/gt/2015/01/14/488408753-200x300.jpg
			domain === "assets.metrolatam.com" ||
			// https://women.mthai.com/app/uploads/2014/01/rihanna2-100x140.jpg
			domain_nosub === "mthai.com" ||
			// https://cdn.webnoviny.sk/sites/13/2013/02/cerveny-koberec-55-hudobnych-cien-grammy1-640x897.jpeg
			domain === "cdn.webnoviny.sk" ||
			// https://bloggar.expressen.se/emmasmode/files/2013/02/2013-GRAMMY-AWARDS-ARRIVALS.JPEG-0AB3E3-835x1022.jpg
			domain === "bloggar.expressen.se" ||
			// http://img2.saostar.vn/2016/02/16/279989/taylor-swift-grammys-red-carpet-2016-646x1024.jpg
			(domain_nosub === "saostar.vn" && domain.match(/img[0-9]*\.saostar\.vn/)) ||
			// https://s3.gossipcop.com/up/2018/06/Selena-Gomez-Jennifer-Aniston-Justin-Theroux-533x395.jpg
			(domain_nosub === "gossipcop.com" && domain.match(/s[0-9]*\.gossipcop\.com/)) ||
			// https://petapixel.com/assets/uploads/2017/01/RT40170-800x534.jpg
			(domain_nowww === "petapixel.com" && string_indexof(src, "/uploads/") >= 0) ||
			// https://d3i6fh83elv35t.cloudfront.net/newshour/app/uploads/2017/03/cat-tongue_AdobeStock_70141743-1024x719.jpeg
			domain === "d3i6fh83elv35t.cloudfront.net" ||
			// https://d17fnq9dkz9hgj.cloudfront.net/uploads/2018/03/Russian-Blue_01-390x203.jpg
			domain === "d17fnq9dkz9hgj.cloudfront.net" ||
			// https://images.everyeye.it/img-notizie/yakuza-6-emergono-40-minuti-gameplay-v6-272793-350x16.jpg
			domain === "images.everyeye.it" ||
			// https://koreaboo-cdn.storage.googleapis.com/2016/12/15123352_1467738783241379_1368418332014232741_o-650x867.jpg
			googlestorage_container === "koreaboo-cdn" ||
			// https://www.behindzscene.net/file/2018/01/%D8%A7%D8%B3%D8%B7%D9%88%D8%B1%D8%A9-440x264.jpg
			(domain_nowww === "behindzscene.net" && string_indexof(src, "/file/") >= 0) ||
			// https://www.hipertextual.com/files/2014/12/christopher-nolan-670x410.jpg
			(domain_nowww === "hipertextual.com" && string_indexof(src, "/files/") >= 0) ||
			// https://geeksofdoom.com/GoD/img/2015/11/the-bastard-executioner-110-03-530x353.jpg
			(domain_nowww === "geeksofdoom.com" && string_indexof(src, "/img/") >= 0) ||
			// http://newsimages.fashionmodeldirectory.com/content/2018/06/july-cover2-392x400.jpg
			domain === "newsimages.fashionmodeldirectory.com" ||
			// http://img.blogtamsu.vn/2015/12/tae-yeon-hanh-trinh-vit-hoa-thien-nga-blogtamsu291-600x900.jpg
			domain === "img.blogtamsu.vn" ||
			// https://cdn03.starsdaily.net/starsdaily/uploads/2016/11/%E1%9F%A5%E1%9F%A5-683x1024.jpg
			(domain_nosub === "starsdaily.net" && domain.match(/cdn[0-9]+\.starsdaily\.net/)) ||
			// https://nextnature.net/app/uploads/2017/02/71HTjrSeI5L-1280x450.jpg
			//   https://nextnature.net/app/uploads/2017/02/71HTjrSeI5L.jpg
			(domain_nowww === "nextnature.net" && string_indexof(src, "/uploads/") >= 0) ||
			// https://www.vooks.net/img/2018/06/mosiac-1000x562.jpg
			(domain_nowww === "vooks.net" && string_indexof(src, "/img/") >= 0) ||
			// https://i.ido.bi/assets/podcast/2017/12/jenna-ortega-friends-434x650.jpg
			domain === "i.ido.bi" ||
			// https://cdn.techgyd.com/150-best-Anime-Wallpaper-In-HD-For-Your-Device-65-640x1024.jpg
			domain === "cdn.techgyd.com" ||
			// https://4girls.co.il/uploads/mediaBank/2017/02/22-gallery_photos-1f4c8c1e-120x80.jpg
			(domain_nowww === "4girls.co.il" && string_indexof(src, "/uploads/") >= 0) ||
			// http://gceleb.com/photo/2016/06/Mathematician-Rachel-Riley-768x1152.jpg
			(domain_nowww === "gceleb.com" && string_indexof(src, "/photo/") >= 0) ||
			// https://www.seriouseats.com/recipes/images/2015/02/20150216-grilled-tofu-banh-mi-recipe-vegan-12-1500x1125.jpg
			(domain_nowww === "seriouseats.com" && string_indexof(src, "/images/") >= 0) ||
			// http://i.epochtimes.com/assets/uploads/2016/11/yangmi-600x400.jpg
			domain === "i.epochtimes.com" ||
			// https://cdn.thammysen.vn//2017/04/tam-trang-toan-than-bang-sua-chua-va-mat-ong3-300x200.jpg
			domain === "cdn.thammysen.vn" ||
			// http://d1lofqbqbj927c.cloudfront.net/xtremaGT/2017/12/06190753/camila-500x263.jpg
			domain === "d1lofqbqbj927c.cloudfront.net" ||
			// http://www.180grados.com.mx/img/2017/05/rs-camila-cabello-ad1dc260-a687-4b5a-8fe3-9fad3800ab7b-560x294.jpg
			(domain_nowww === "180grados.com.mx" && string_indexof(src, "/img/") >= 0) ||
			// http://photo.tin8.co/upload/2018/07/06/14663363979018311466336543sumarionormal14838670891530849084-308x201.jpg
			domain === "photo.tin8.co" ||
			// https://cdn3.whatculture.com/images/2015/04/avengers-end-scene-600x400.jpg
			(domain_nosub === "whatculture.com" && domain.match(/^cdn[0-9]*\.whatculture\.com/) && string_indexof(src, "/images/") >= 0) ||
			// http://www.electronicbeats.net/app/uploads/2013/11/baxxter-oehlen-electronic-beats-luci-lux-1240x710.jpg
			(domain_nowww === "electronicbeats.net" && string_indexof(src, "/uploads/") >= 0) ||
			// https://media.iconsingapore.com/2018/05/Julianne-Moore-in-Givenchy-750x1125.jpg
			domain === "media.iconsingapore.com" ||
			// http://p.cosmopolitan.bg/g/e/gettyimages-699742676-74636-636x0.jpg?1504777991774
			domain === "p.cosmopolitan.bg" ||
			// https://cache.pakistantoday.com.pk/447464_24204507-230x130.jpg
			domain === "cache.pakistantoday.com.pk" ||
			// https://media.breitbart.com/media/2017/06/EmiliaClarkeSexismGameOfThrones-640x480.jpg
			domain === "media.breitbart.com" ||
			// https://s.rozali.com/p/j/e/jesika-alba-34-320293-500x0.jpg
			domain === "s.rozali.com" ||
			// https://s.sdgcdn.com/7/2018/06/d15ed3e907d41b4e1236d5bd0d14836f768ce800_90f83913e7f20144896634648ea442679d3ed64e_2016_06_29_07_24_12_2412_05e4_optimized-429x600.jpg
			domain === "s.sdgcdn.com" ||
			// http://ticket.heraldtribune.com/files/2013/08/Victoria-Justice-200x300.jpg
			(domain === "ticket.heraldtribune.com" && string_indexof(src, "/files/") >= 0) ||
			// https://blog.hola.com/estilistademodacristinareyes/files/2014/09/elle-08-birthdays-beyonce-xln-xln-200x300.jpg
			domain === "blog.hola.com" ||
			// http://www.therussiantimes.com/upkeep/uploads/2018/07/00103c8b-800-650x366.jpg
			(domain_nowww === "therussiantimes.com" && string_indexof(src, "/uploads/") >= 0) ||
			// http://static.idolator.com/uploads/2010/09/selenagomez-vmas1-500x747.jpg
			domain === "static.idolator.com" ||
			// http://images.saloona.co.il/commelle/files/2016/03/i3kxpbzo4wr9enzrr18-199x300.jpg
			domain === "images.saloona.co.il" ||
			// http://bellezaenvena.com/my_uploads/2017/08/miss-dior-eau-de-parfum-450x600.jpg
			(domain_nowww === "bellezaenvena.com" && string_indexof(src, "/my_uploads/") >= 0) ||
			// http://c1.thejournal.ie/media/2014/06/samantha-mumba-752x501.jpg
			(domain_nosub === "thejournal.ie" && string_indexof(src, "/media/") >= 0) ||
			// http://tvperson.ru/2016/01/jeanne-tripplehorn-006-682x1024.jpg
			domain_nowww === "tvperson.ru" ||
			// http://iwantpix.com/stuff/female-celebrities/female-celebrities-33-810x1024.jpg
			domain_nowww === "iwantpix.com" ||
			// http://nudemodelpics.com/girls/2016/12/nelly-show-me-yummy/nelly-amour-angels-nudemodel.pics-01-180x240.jpg
			domain_nowww === "nudemodelpics.com" ||
			// https://images.chr.bg/uploads/2017/07/Zendaya-Feet-2287006-1108x831.jpg
			(domain === "images.chr.bg" && string_indexof(src, "/uploads/") >= 0) ||
			// http://woman.ua/file/images/2014/08/2014081353eb770bdc340-370x515.jpg
			(domain_nowww === "woman.ua" && string_indexof(src, "/file/images/") >= 0) ||
			// https://gdsit.cdn-immedia.net/2015/11/Rihanna-4-423x505.jpg
			domain === "gdsit.cdn-immedia.net" ||
			// http://cseditors.com/g/pho/photoshoot-for-the-new-york-times-style-magazine-october-2015-615x734.jpg
			domain_nowww === "cseditors.com" ||
			// https://imcdn.org/uploads/2016/02/emma-watson-300x178.gif
			(domain_nowww === "imcdn.org" && string_indexof(src, "/uploads/") >= 0) ||
			// http://t.a4vn.com/2009/12/emma-127x92.jpg
			domain === "t.a4vn.com" ||
			// http://dodskypict.com/D/Emma-Watson-Wallpaper-On-Wallpaper-Hd-8-480x320.jpg
			domain_nowww === "dodskypict.com" ||
			// https://files.dals.media/mediafiles/wpf/2016/12/15534872_1362015517143304_547806809268682752_n-1024x1024.jpg
			domain === "files.dals.media" ||
			// https://cdn.crhoy.net/imagenes/2018/08/asia-argento%C2%BA-300x169.jpg
			domain === "cdn.crhoy.net" ||
			// http://longwallpapers.com/Desktop-Wallpaper/cute-bunny-images-For-Desktop-Wallpaper-230x140.jpg
			domain_nowww === "longwallpapers.com" ||
			// https://files.greatermedia.com/uploads/sites/53/2018/06/GettyImages-845019148-1-1400x1727.jpg
			domain === "files.greatermedia.com" ||
			// https://tsundora.com/image/2016/05/re_zero_kara_hajimeru_isekai_seikatsu_181-1024x576.jpg
			(domain_nowww === "tsundora.com" && string_indexof(src, "/image/") >= 0) ||
			// https://clips-media-assets2.twitch.tv/vod-290596181-offset-0-preview-260x147.jpg
			(domain_nosub === "twitch.tv" && domain.match(/^clips-media-assets[0-9]*\./) && src.match(/-preview-[0-9]+x[0-9]+\.[^/.]*$/)) ||
			// https://file.immo.vlan.be/ImageHandler/Image/Wordpress/effeil2-1024x576.jpg
			(domain === "file.immo.vlan.be" && string_indexof(src, "/Image/Wordpress/") >= 0) ||
			// https://media.trud.bg/2016/10/26-6-360x540.jpg
			domain === "media.trud.bg" ||
			// https://rotativo.com.mx/assets//2018/03/rihanna-se-lanza-contra-a-snapchat-696x573.jpg
			(domain_nowww === "rotativo.com.mx" && string_indexof(src, "/assets/") >= 0) ||
			// https://www.chfi.com/wp-content/blogs.dir/2/files/Rihanna_Diamonds_World_Tour_2013_Cropped-637x838.png
			(domain_nowww === "chfi.com" && string_indexof(src, "/wp-content/") >= 0) ||
			// https://storage.googleapis.com/sin-cdn/2017/12/rihanna-367x215.jpg
			// https://sin-cdn.storage.googleapis.com/2017/12/rihanna-367x215.jpg
			googlestorage_container === "sin-cdn" ||
			// https://cdn.appleigeek.com/2018/03/rihanna-644x350.jpg
			domain === "cdn.appleigeek.com" ||
			// https://media.cnnchile.com/sites/2/2018/06/imagen_principal-9349-740x430.jpg
			domain === "media.cnnchile.com" ||
			// http://festivalteen.com.br/qsafrcbfds/uploads/2018/08/WhatsApp-Image-2018-08-06-at-14.40.46-252x300.jpeg
			(domain_nowww === "festivalteen.com.br" && string_indexof(src, "/uploads/") >= 0) ||
			// https://rhodiesworld.s3.amazonaws.com/uploads/2018/08/bey5-400x483.jpg
			(amazon_container === "rhodiesworld" && string_indexof(src, "/uploads/") >= 0) ||
			// https://ntdtv.kr/assets/uploads/2017/11/1-1-10-795x436.jpg
			(domain_nowww === "ntdtv.kr" && string_indexof(src, "/assets/") >= 0) ||
			// http://xdn.tf.rs/2015/05/18/Dzenifer-Lopez-1-670x984.jpg
			domain === "xdn.tf.rs" ||
			// https://static.acg12.com/uploads/2015/07/7cedbaa31f53feaa86fed37fd9fe9da6-320x200.jpg
			domain === "static.acg12.com" ||
			// https://img.zone5.ru/50/1/0/zone5.ru-hermione-corfield-176882-145x200.jpg
			domain === "img.zone5.ru" ||
			// https://i2.bssl.es/lacosarosa/2017/12/emiliaclarke-880x495.jpg
			(domain_nosub === "bssl.es" && domain.match(/^i[0-9]*\./)) ||
			// http://images.virgula.com.br/2017/06/Sofia-Solares-1-387x479.jpg
			domain === "images.virgula.com.br" ||
			// http://rotana.net/assets/uploads/2017/08/2936489101502703278-406x228.jpg
			(domain_nowww === "rotana.net" && string_indexof(src, "/assets/uploads/") >= 0) ||
			// https://elle.unitedinfluencers.org/content/uploads/sites/19/2013/04/c11-621x1024.jpg
			(domain === "elle.unitedinfluencers.org" && string_indexof(src, "/content/uploads/") >= 0) ||
			// http://www.notredamedeparis.fr/content/uploads/sites/3/2017/01/Tallon_Paris_ND_January_2013_CF020507-1024x1021.jpg
			(domain_nowww === "notredamedeparis.fr" && string_indexof(src, "/content/uploads/") >= 0) ||
			// https://zenska.hudo.com/files/2016/08/c24e131d48b6c478405ad53365ae90fa-409x660.jpg
			(domain === "zenska.hudo.com" && string_indexof(src, "/files/") >= 0) ||
			// https://s3.ap-south-1.amazonaws.com/seenitblog/uploads/2016/02/Margot-634x1024.jpg
			(amazon_container === "seenitblog" && string_indexof(src, "/uploads/") >= 0) ||
			// https://marieclaire.hu/uploads/2016/10/A-vilag-legkulonlegesebb-gyemantmarkaja-Magyarorszagon-1-680x1024.jpg
			(domain_nowww === "marieclaire.hu" && string_indexof(src, "/uploads/") >= 0) ||
			// http://infinitymemories.com/amour/files/2018/05/Margot-Robbie-assiste-%C3%A0-la-90e-Annual-Academy-Awards-au-Hollywood-Highland-Center-683x1024.jpg
			(domain_nowww === "infinitymemories.com" && string_indexof(src, "/files/") >= 0) ||
			// https://www.tuxboard.com/photos/2013/12/best-photo-nature-2013-14-640x405.jpg
			(domain_nowww === "tuxboard.com" && string_indexof(src, "/photos/") >= 0) ||
			// http://arcdn02.mundotkm.com/2014/08/S11-286x400.jpg
			(domain_nosub === "mundotkm.com" && domain.match(/^arcdn[0-9]*\./)) ||
			// http://cdn2.game4v.com/2015/09/cosplay-game-322-560x373.jpg
			(domain_nosub === "game4v.com" && domain.match(/^cdn[0-9]*\./)) ||
			// https://cosplaytime.pl/uploads/2018/06/5297219860-400x600.jpg
			(domain_nosub === "cosplaytime.pl" && string_indexof(src, "/uploads/") >= 0) ||
			// http://img.wkorea.com/w/2018/04/style_5ad5567c70116-924x1200.jpg
			domain === "img.wkorea.com" ||
			// https://i.mdel.net/newfaces/i/2013/09/dd_ak_25-783x1024.jpg
			(domain === "i.mdel.net" && string_indexof(src, "/newfaces/i/") >= 0) ||
			// https://media.celebmasta.com/2016/03/real-lindsay-lohan-nude-pics-and-video-scene-41-370x297.jpg
			domain === "media.celebmasta.com" ||
			// https://media.korea25.com/news/2018/10/0003458151_3267522_I-280x280.jpg
			// I and U, can't find any difference
			domain === "media.korea25.com" ||
			// http://sexyfandom.com/images/2018/02/A2-Cosplay-by-Miyuko-1-650x922.jpg
			(domain_nowww === "sexyfandom.com" && string_indexof(src, "/images/") >= 0) ||
			// https://i.dmarge.com/2016/06/twothousand-610x424.jpg
			domain === "i.dmarge.com" ||
			// http://assets.boundingintocomics.com/content/uploads/2018/05/Korg-Thor-Ragnarok-750x400.jpg
			domain === "assets.boundingintocomics.com" ||
			// https://media.profootballfocus.com/2018/10/DENZEL-1024x581.jpg
			domain === "media.profootballfocus.com" ||
			// http://www.redu.pl/img/2012/08/539863_391053194270196_1915005508_n-600x425.jpg
			(domain_nowww === "redu.pl" && string_indexof(src, "/img/") >= 0) ||
			// https://multifiles.pressherald.com/uploads/sites/4/2018/10/1590594_931934-20180930_112727-1024-1024x556.jpg
			(domain === "multifiles.pressherald.com" && string_indexof(src, "/uploads/") >= 0) ||
			// http://img.time2draw.com/2015/02/Learn-to-Draw-Anime-Natsu-Fairy-Tail-Drawing-final-step-215x382.png
			domain === "img.time2draw.com" ||
			//http://ffw.uol.com.br/app/uploads/desfiles/2013/02/desfile-dvf-ny-inv2014-331-150x224.jpg
			(domain === "ffw.uol.com.br" && string_indexof(src, "/app/uploads/") >= 0) ||
			// http://images.harianjogja.com/2014/09/Taeyeon-SNSD-Soompi.com_-370x219.jpg
			domain === "images.harianjogja.com" ||
			// http://images.hamodia.com/hamod-uploads/2017/09/08134636/2017-09-08T172110Z_338724345_RC1482A3A370_RTRMADP_3_STORM-IRMA-1024x854.jpg
			domain === "images.hamodia.com" ||
			// https://www.bz-berlin.de/data/uploads/multimedia/archive/00071/Megan_Fox2_71614a-450x432.jpg
			(domain_nowww === "bz-berlin.de" && string_indexof(src, "/data/uploads/multimedia/") >= 0) ||
			// https://luxury-inside.vn/data/uploads/2019/05/Alan-Turing-3-1440x809.jpg
			(domain_nowww === "luxury-inside.vn" && src.match(/\/data\/+uploads\//)) ||
			// http://worldcupgirls.net/girls-pics/hottest-girls-fans-world-cup-2014_41-korean-530x353.jpg
			domain_nowww === "worldcupgirls.net" ||
			// https://cdn1-www.playstationlifestyle.net/assets/uploads/2018/07/gta6hack-555x423.jpg
			(domain_nosub === "playstationlifestyle.net" && domain.match(/^cdn[0-9]*-www\./) && string_indexof(src, "/assets/uploads/") >= 0) ||
			// http://image2.aving.net/2018/12/26/201812261637237790-120x80.jpg
			(domain_nosub === "aving.net" && domain.match(/^image[0-9]*\./)) ||
			// https://ss-images.catscdn.vn/2016/07/01/591387/Sao-n%E1%BB%AF-%E1%BB%9F-Hollywood-3-290x393.jpg
			domain === "ss-images.catscdn.vn" ||
			// https://blogs.gnome.org/chergert/files/2019/01/new-workspace-768x432.png
			(domain === "blogs.gnome.org" && string_indexof(src, "/files/") >= 0) ||
			// https://cdn01.zoomit.ir/2018/12/93350cef-0eed-44a5-8bef-b3b08947b98f-400x267.jpg
			(domain_nosub === "zoomit.ir" && domain.match(/^cdn[0-9]*\./)) ||
			// https://img.myfirstshow.com/uploads/2018/06/Super-hot-Amy-jackson-at-the-2018-Life-Ball-4-362x450.jpg
			domain === "img.myfirstshow.com" ||
			// https://cdn3-www.musicfeeds.com.au/assets/uploads/justin-bieber-2016-press-pic-supplied-671x377.jpg
			(domain_nosub === "musicfeeds.com.au" && domain.match(/^cdn[0-9]*/) && string_indexof(src, "/assets/uploads/") >= 0) ||
			// https://d13vpcwfpcq1p8.cloudfront.net/contents/official/sites/887/2019/02/x20190219000550684_20190219-000548-image-300x300.jpg
			(domain === "d13vpcwfpcq1p8.cloudfront.net" && string_indexof(src, "/contents/") >= 0) ||
			// https://media3.paperblog.fr/i/582/5820009/critique-colombiana-L-WlVd2S-175x130.jpeg
			(domain_nosub === "paperblog.fr" && domain.match(/^media[0-9]*\./)) ||
			// https://m52.paperblog.com/i/77/774024/barbara-palvin-for-zoltan-tombor-in-marie-cla-L-ztr8o_-175x130.jpeg
			(domain_nosub === "paperblog.com" && domain.match(/^m[0-9]*\./)) ||
			// http://bikini.sbgefree.org/files/2018/11/sexy-bikini-models-image328-150x150.jpg
			(domain === "bikini.sbgefree.org" && string_indexof(src, "/files/") >= 0) ||
			// http://redbust.com/stuff/kloe-kane-in-jeans-mini-skirt/kloe-redhead-jeans-miniskirt-pussy-twistys-02-800x534.jpg
			(domain_nowww === "redbust.com" && string_indexof(src, "/stuff/") >= 0) ||
			// https://img.providr.com/AS13-297x300.png
			domain === "img.providr.com" ||
			// https://static.hiphopdx.com/2018/09/180924-cardi-b-getty-800x600.jpg
			domain === "static.hiphopdx.com" ||
			// https://queerty-prodweb.s3.amazonaws.com/2019/02/ariana-grande-break-up-girlfriend-670x456.jpg
			amazon_container === "queerty-prodweb" ||
			// https://static.timesofisrael.com/njjewishnews/uploads/2018/09/JohnnyCash-640x400.jpg
			domain === "static.timesofisrael.com" ||
			// https://hairstylesweekly.com/images/2013/01/Cute-Korean-Mushroom-Haircut-with-Bangs-150x150.jpg
			(domain_nowww === "hairstylesweekly.com" && string_indexof(src, "/images/") >= 0) ||
			// https://www.famousbirthsdeaths.com/fbd-uploads/2015/10/is-felicity-jones-dead-or-alive-150x150.jpg
			(domain_nowww === "famousbirthsdeaths.com" && string_indexof(src, "/fbd-uploads/") >= 0) ||
			// https://img.leaksx.com/2017/12/Melanie-Inglesias-Leaked-Pictures-21-150x150.jpg
			domain === "img.leaksx.com" ||
			// https://www.top10films.co.uk/img/felicity-jones-bifa-2018-150x150.jpg
			(domain_nowww === "top10films.co.uk" && string_indexof(src, "/img/") >= 0) ||
			// https://www.hotel-aramis.com/inc/uploads/sites/8/2016/03/cathedrale_notre-dame_de_paris-461x400.jpg
			domain_nowww === "hotel-aramis.com" ||
			// https://dvfmubv4tjrqd.cloudfront.net/uploads/2018/04/25122626/NDDP_Coliseum_2000x1000px_v24-800x400.jpg
			(domain === "dvfmubv4tjrqd.cloudfront.net" && string_indexof(src, "/uploads/") >= 0) ||
			// https://s3-ap-southeast-2.amazonaws.com/assets.whatson.cityofsydney.nsw.gov.au/2016/07/SabrinaCarpenter-sideview-493x480.jpg
			amazon_container === "assets.whatson.cityofsydney.nsw.gov.au" ||
			// http://static.hasselblad.com/2017/04/HH_7-792x1000.jpg
			domain === "static.hasselblad.com" ||
			// https://saywho.fr/app/uploads/2018/06/NinaRicci00880-768x1151.jpg
			(domain_nowww === "saywho.fr" && string_indexof(src, "/app/uploads/") >= 0) ||
			// https://talentandpartner.com/data/uploads/2016/12/1216-MX-FT_CoverStoryBarbaraPalvin-2-497x600.jpg
			(domain_nowww === "talentandpartner.com" && string_indexof(src, "/data/uploads/") >= 0) ||
			// http://files.vividscreen.info/soft/b19df99ca381f5439ee6ae9e9c69663c/Cute-Anime-Girl-With-Snowman-128x128.jpg
			domain === "files.vividscreen.info" ||
			// https://s3.amazonaws.com/lilianpacce/media/2013/10/291013-little-black-jacket-29-400x600.jpg
			(amazon_container === "lilianpacce" && string_indexof(src, "/media/") >= 0) ||
			// http://chl-network.s3.amazonaws.com/uploads/chl/2019/04/15130734/ByramFinalRankingsEN-1024x600.jpg
			(amazon_container === "chl-network" && string_indexof(src, "/uploads/") >= 0) ||
			// https://www.starkbros.com/images/dynamic/4877-200x200.jpg
			(domain_nowww === "starkbros.com" && string_indexof(src, "/images/dynamic/") >= 0) ||
			// https://m.actve.net/evropa2/image/2017/02/2-7-140x208.jpg
			// https://m.actve.net/koule2017/70067/motiv-640x427.jpg
			domain === "m.actve.net" ||
			// http://d279m997dpfwgl.cloudfront.net/wp/2013/10/IMG_9694-1000x666.jpg
			(domain === "d279m997dpfwgl.cloudfront.net" && string_indexof(src, "/wp/") >= 0) ||
			// https://telegraf.com.ua/files/2016/04/EJE_wM3kipw-188x118.jpg
			//   https://telegraf.com.ua/files/2016/04/EJE_wM3kipw.jpg
			(domain_nowww === "telegraf.com.ua" && string_indexof(src, "/files/") >= 0) ||
			// http://media.womanista.com/2017/02/selena-gomez-bikini-body-56680-57265-1280x0.png
			domain === "media.womanista.com" ||
			// https://jenny.gr/storage/photos/master/201607/13414121_1137258113004232_916616221_n-577x720.jpg
			(domain_nowww === "jenny.gr" && string_indexof(src, "/storage/photos/") >= 0) ||
			// https://static.infomusic.ro/media/2017/09/selena-gomez-800x533.jpg
			(domain === "static.infomusic.ro" && string_indexof(src, "/media/") >= 0) ||
			// https://www.csiete.net/contenido/imagenes/2018/07/Selena-Gomez-2016-237x143.jpg
			(domain_nowww === "csiete.net" && string_indexof(src, "/contenido/imagenes/") >= 0) ||
			// https://wallpaper4rest.com/water/wallpaper/amazing-photography-arts-style-yellow-leaf-rain_1-1-237x134.jpg
			(domain_nowww === "wallpaper4rest.com" && string_indexof(src, "/wallpaper/") >= 0) ||
			// https://ichip.ru/blobimgs/uploads/2018/10/IMG_7900-696x464.jpg
			(domain_nowww === "ichip.ru" && string_indexof(src, "/blobimgs/uploads/") >= 0) ||
			// http://pophaircuts.com/images/2013/11/Selena-Gomez-Hairstyles-Blond-Highlights-138x180.jpg
			(domain_nowww === "pophaircuts.com" && string_indexof(src, "/images/") >= 0) ||
			// http://she12.com/uploads/2012/07/Emma-Stone-Cover-Shoots-For-VOGUE-Mag-9-150x150.jpg
			(domain_nowww === "she12.com" && string_indexof(src, "/uploads/") >= 0) ||
			// http://cdn.stylefrizz.com/img/Emma-Stone-2012-SAG-Awards-black-dress-150x150.jpg
			(domain === "cdn.stylefrizz.com" && string_indexof(src, "/img/") >= 0) ||
			// http://cdn5.windows7themes.net/wp-content/files/rachel-mcadams-1-150x150.jpg
			(domain_nosub === "windows7themes.net" && string_indexof(src, "/wp-content/files/") >= 0) ||
			// http://quotes.whyfame.com/files/2010/01/zoe_saldana-150x150.jpg
			(domain === "quotes.whyfame.com" && string_indexof(src, "/files/") >= 0) ||
			// https://hacks.mozilla.org/files/2019/05/Worker-Threads-Panel-500x301.png
			(domain_nosub === "mozilla.org" && src.match(/:\/\/[^/]*\/files\/+[0-9]{4}\/+[0-9]{2}\/+/)) ||
			// https://s3.amazonaws.com/pas-wordpress-media/content/uploads/2014/08/Robin-Williams-featured-e1407947796569-653x339.jpg
			(amazon_container === "pas-wordpress-media" && string_indexof(src, "/uploads/") >= 0) ||
			// https://news.artnet.com/app/news-upload/2018/05/4_636613246135627500954662_53_METBALL_050718_SZ_010-1024x684.jpg
			(domain === "news.artnet.com" && string_indexof(src, "/news-upload/") >= 0) ||
			// https://edmhunters-563e.kxcdn.com/mediafiles/song/images/199733-165x165.jpg
			(domain === "edmhunters-563e.kxcdn.com" && string_indexof(src, "/mediafiles/") >= 0) ||
			// https://s3.amazonaws.com/bkt-respaldomtonline/uploads/2016/05/mikaela-banes-transformers-71359_1920_1278-megan-fox-returning-for-transformers-5-not-exactly-jpeg-136469-600x399.jpg
			(amazon_container === "bkt-respaldomtonline" && string_indexof(src, "/uploads/") >= 0) ||
			// http://img.emao.net/news/w/nc/bca/ljfk-640x427.jpg
			domain === "img.emao.net" ||
			// http://p.potv.bg/t/r/transfrevenge-still-19613v01-29870-625x0.jpg?1471529675894
			domain === "p.potv.bg" ||
			// http://media.yadbegir.com/yadmedia/2018/02/ema-180x120.jpg
			domain === "media.yadbegir.com" ||
			// https://digitalb.vo.llnwd.net/triplemedia/site/uploads/55a674b1fff2c16856a6bd9e_emma-stone-aloha-miscast-1-560x416.jpg
			(domain_nosub === "llnwd.net" && src.match(/\/site\/+uploads\/+/)) ||
			// http://cinemio.it/wp-content/upload/images125-300x168.jpg
			(domain_nowww === "cinemio.it" && string_indexof(src, "/upload/") >= 0) ||
			// https://www.flavourmag.co.uk/files/2016/11/DF-07670R_rgb-300x194.jpg
			(domain_nowww === "flavourmag.co.uk" && string_indexof(src, "/files/") >= 0) ||
			// https://img.ananweb.jp/2017/04/DF-07670R-768x513.jpg
			domain === "img.ananweb.jp" ||
			// https://filmz.dk/files/gfx/6/67397-h668xw1000-edge-of-seventeen-4-filmz-1000x668.jpg
			(domain_nowww === "filmz.dk" && string_indexof(src, "/files/") >= 0) ||
			// http://mit24h.com/g/2/ha/hailee-steinfeld-is-so-cool-she-gets-girls-and-fights-for-girl-kai-clean-tove-lo-mp3-free-download-habits-ideas-meaning-ytmp3-conversion-them-lady-860x1075.jpg
			domain_nowww === "mit24h.com" ||
			// https://dimwhp0w2rs83.cloudfront.net/2017/11/1510667327-hailee-steinfeld-700x463.jpg
			domain === "dimwhp0w2rs83.cloudfront.net" ||
			// http://cdn.macrumors.com/article-new/2018/05/haileesteinfeld-800x450.jpg
			(domain === "cdn.macrumors.com" && string_indexof(src, "/article-new/") >= 0) ||
			// https://cam4-images.xcdnpro.com/7fd7d8cc-cdc2-4d37-af65-3b35e30d1a83-400x300.jpg -- upscaled
			(domain_nosub === "xcdnpro.com" && domain.match(/images\./)) ||
			// https://www.lifezette.com/files/2017/03/Zac_Efron_Cannes_2012-851x1200.jpg
			(domain_nowww === "lifezette.com" && string_indexof(src, "/files/") >= 0) ||
			// https://cdn.junglecreations.com/wp/junglecms/2019/04/34912930-zac-efron-as-ted-bundy-featured-image-1-200x106.jpg
			(domain === "cdn.junglecreations.com" && string_indexof(src, "/wp/") >= 0) ||
			// http://rip-youth.jp/images/itsuki2-400x533.png
			(domain_nowww === "rip-youth.jp" && string_indexof(src, "/images/") >= 0) ||
			// https://www.asian-sirens.net/uploads/2019/05/22280887_530817700592929_7113082934487154688_n1-500x500.jpg
			(domain_nowww === "asian-sirens.net" && string_indexof(src, "/uploads/") >= 0) ||
			// https://cdn2-www.comingsoon.net/assets/uploads/2019/05/game-of-thrones-season-8-episode-6-daenerys-throne-face-225x150.jpg
			(domain_nosub === "comingsoon.net" && src.match(/\/assets\/+uploads\//)) ||
			// https://cdn.zoomg.ir/2019/5/84b8175d-c88f-4287-9025-00e54d614b31-400x267.jpg
			domain === "cdn.zoomg.ir" ||
			// https://wikiofthrones.com/static/uploads/2019/05/Emilia-Clarke-tells-parents-who-named-their-daughters-Khaleesi-not-to-worry-900x600.jpg
			(domain_nowww === "wikiofthrones.com" && src.match(/\/static\/+uploads\//)) ||
			// https://www.hitc.com/static/uploads/2020/08/What-time-does-Madden-NFL-21-come-out-Standard-Edition-release-time-on-PS4-Xbox-One-and-Origin-1-768x473.jpg
			(domain_nowww === "hitc.com" && src.match(/\/static\/+uploads\//)) ||
			// https://files.theblemish.com/images/2014/06/kate-upton-body-paint-640x853.jpg
			(domain === "files.theblemish.com" && string_indexof(src, "/images/") >= 0) ||
			// http://i2.esmas.com/galerias/fotos/2016/08/30/screams_960d5e11_acaf_b76f_82c9_a2e0d581e47b-468x624.jpg
			// http://i2.esmas.com/editorial-televisa/2012/07/04/392000/vanessa-hudgens-290x474.jpg
			(domain_nosub === "esmas.com" && domain.match(/^i[0-9]*\./)) ||
			// http://www.mortalfm.es/archivos/2015/04/artworks-000108247651-2kw5xk-t500x500-390x390.jpg
			(domain_nowww === "mortalfm.es" && string_indexof(src, "/archivos/") >= 0) ||
			// https://d2yoo3qu6vrk5d.cloudfront.net/images/20171115152738/nicki-minaj2-482x320.jpg?itok=1510782120
			(domain === "d2yoo3qu6vrk5d.cloudfront.net" && string_indexof(src, "/images/") >= 0) ||
			// https://courrier.jp/media/2017/11/10041739/s_GettyImages-459754376-625x446.jpg
			(domain_nowww === "courrier.jp" && string_indexof(src, "/media/") >= 0) ||
			// https://dieta.pourfemme.it/img/2010/07/dieta-vegana-8-420x260.jpg
			(domain === "dieta.pourfemme.it" && string_indexof(src, "/img/") >= 0) ||
			// https://static.atmag.co.il/www/uploads/2017/02/GettyImages-634329518_h-2000x1125.jpg
			(domain === "static.atmag.co.il" && string_indexof(src, "/uploads/") >= 0) ||
			// https://xtra.works/app/uploads/sites/2/2018/11/download-300x124.png
			(domain_nowww === "xtra.works" && string_indexof(src, "/uploads/") >= 0) ||
			// https://www.myce.com/wp-content/images_posts/2017/07/adobe_logo-670x278.png
			(domain_nowww === "myce.com" && string_indexof(src, "/images_posts/") >= 0) ||
			// https://www.unison.org.uk/content/uploads/2018/02/iceberg-tip-of1000x563-745x420.jpg
			(domain_nowww === "unison.org.uk" && string_indexof(src, "/content/uploads/") >= 0) ||
			// https://www.businessinsider.fr/content/uploads/2016/11/icerberg-800x400.jpg
			(domain_nowww === "businessinsider.fr" && string_indexof(src, "/content/uploads/") >= 0) ||
			// https://sfo2.digitaloceanspaces.com/btrtoday/uploads/20190611114017/ft.Cyberpunk2077-620x349.jpg
			// https://btrtoday.sfo2.digitaloceanspaces.com/uploads/20190611114017/ft.Cyberpunk2077-620x349.jpg
			(digitalocean_container === "btrtoday" && string_indexof(src, "/uploads/") >= 0) ||
			// https://m8q3v4v6.stackpathcdn.com/2019/06/cf579a94-keanurevees-e3-min-1260x709.jpg
			domain === "m8q3v4v6.stackpathcdn.com" ||
			// https://www.linda.nl/lindanl-assets/uploads/2018/10/19212659/Schermafbeelding-2015-02-23-om-10.55.31-600x803.png
			(domain_nowww === "linda.nl" && string_indexof(src, "/uploads/") >= 0) ||
			// https://ww1.sites-telechargement.com/affiche/0842353-360x490.jpg
			(domain === "ww1.sites-telechargement.com" && string_indexof(src, "/affiche/") >= 0) ||
			// https://d3n2u7gfnpd084.cloudfront.net/film/5b/23/6c/d3/38ff9109733f6aa8/5b236cd338ff9109733f6aa8-400x545.jpg?etag=684116adfdeae65ad86d1ab5618b9b26
			(domain === "d3n2u7gfnpd084.cloudfront.net" && src.match(/\/(?:[0-9a-f]{2}\/+){4}/)) ||
			// http://www.journal-farandole.com//content/uploads/2018/07/ANT-MAN-et-LA-GUEPE-624x850.jpeg
			(domain_nowww === "journal-farandole.com" && src.match(/\/content\/+uploads\/+/)) ||
			// http://www.dpstreaming.live/upload/2018/07/0842353-752x1024.jpg
			(domain_nowww === "dpstreaming.live" && string_indexof(src, "/upload/") >= 0) ||
			// http://cdn.videos.rollcall.com/hoh/Perabo-Getty-4912210451200x1700-238x330.jpg
			domain === "cdn.videos.rollcall.com" ||
			// https://www.rawkblog.com/content/uploads/2019/05/carly-rae-jepsen-768x512.jpg
			(domain_nowww === "rawkblog.com" && string_indexof(src, "/uploads/") >= 0) ||
			// https://cdn.stereo.vn/uploads/2015/08/carly-rae-jepsen-press-2015-billboard-650-770x462.jpg
			(domain === "cdn.stereo.vn" && string_indexof(src, "/uploads/") >= 0) ||
			// http://dailybruin.com/images/2019/01/DSC_2847a-300x200.jpg
			(domain_nowww === "dailybruin.com" && string_indexof(src, "/images/") >= 0) ||
			// http://razorpics.net/rachel-mcadams/HollywoodAwards-07-[Ravens_Young_Stars]%20Rachel%20Mcadams%203-150x150.jpg
			domain_nowww === "razorpics.net" ||
			// https://www.1in.am/assets/uploads/2019/01/02-56-540x360.jpg
			(domain_nowww === "1in.am" && string_indexof(src, "/assets/") >= 0) ||
			// https://cdn.entertainmentfuse.com/media/2016/06/funny-load-screen-MEC-800x450.png
			(domain === "cdn.entertainmentfuse.com" && string_indexof(src, "/media/") >= 0) ||
			// https://www.n3rdabl3.com/wp-content/images/uploads/2015/04/FPS_Enix_DeusEX-720x423-720x423.jpg
			(domain_nowww === "n3rdabl3.com" && /\/wp-content\/+images\/+uploads\/+/.test(src)) ||
			// https://kizsalsorunlar.com/k/uploads/2012/11/victorias-secret-2012-defile-19-160x239.jpg?x15615
			(domain_nowww === "kizsalsorunlar.com" && string_indexof(src, "/uploads/") >= 0) ||
			// https://neskaties.lv/2016/09/foto-parizes-modes-nedela-modeles-staiga-ar-kailiem-krutsgaliem-57eb682d1db29-672x1010.jpg
			domain_nowww === "neskaties.lv" ||
			// https://img.eroero-gazou.net/images/2019/07/62471a0b7b42478eb16a1321e8799189-300x200.jpg
			domain === "img.eroero-gazou.net" ||
			// https://media.sistemampa.com.br/2019/02/Camila-Cabello-Net-Worth-300x160.jpg
			domain === "media.sistemampa.com.br" ||
			// https://img1.looper.com/img/uploads/2017/04/why-hollywood-won_t-cast-jessica-alba-anymore-780x438.jpg
			(domain_nosub === "looper.com" && /^img[0-9]*\./.test(domain) && string_indexof(src, "/uploads/") >= 0) ||
			// https://i0.dtslb.com//2019/02/m8sCa24YbFIatKlElTMdiH18A5N-185x278.jpg
			(domain_nosub === "dtslb.com" && /^i[0-9]*\./.test(domain)) ||
			// https://static.otvfoco.com.br/2019/08/rihanna-donald-trump-tweet-gun-control-130x86.jpg
			domain === "static.otvfoco.com.br" ||
			// https://static2.diariouno.com.ar/media/2019/03/1543247666-rihanna-hermosa-y-talentosa-estrella-mundial-del-pop-y-del-universo-entero-416x234.jpg
			(domain_nosub === "diariouno.com.ar" && /^static[0-9]*\./.test(domain) && string_indexof(src, "/media/") >= 0) ||
			// https://thugarmada.com/ta-files/2018/10/ayumi-hamasaki-japanese-trance-j-277x156.jpg
			(domain_nowww === "thugarmada.com" && string_indexof(src, "/ta-files/") >= 0) ||
			// https://flipwallpapers.com/wallpapers/cute-anime-hd-desktop-wallpaper-For-desktop-Wallpaper-200x113.jpg
			(domain_nowww === "flipwallpapers.com" && string_indexof(src, "/wallpapers/") >= 0) ||
			// http://hanamaru-photo.com/common/images/2019/08/EA62qgAU0AEXbDT-200x300.jpg
			(domain_nowww === "hanamaru-photo.com" && /\/common\/+images\//.test(src)) ||
			// http://p.elle.bg/s/a/saweetie-and-quavo-of-migos-attend-the-2019-billboard-music-news-photo-1146346699-1556753469-123056-680x0.jpg
			domain === "p.elle.bg" ||
			// https://illustrationwest.org/53/files/2014/10/Mayer_Bill_A_1-180x180.jpg
			(domain_nowww === "illustrationwest.org" && string_indexof(src, "/files/") >= 0) ||
			// https://www.myjane.ru/data/cache/2018feb/14/28/773144_49860-250x0.jpg
			(domain_nowww === "myjane.ru" && /\/data\/+cache\//.test(src)) ||
			// http://www.chickradar.net/content/uploads/2013/05/Barbara-Palvin-8-150x150.png
			(domain_nowww === "chickradar.net" && /\/content\/+uploads\//.test(src)) ||
			// http://www.creepmachine.com/images/2012/07/yolandi_visser_soeymilk-610x765-520x400.jpg
			(domain_nowww === "creepmachine.com" && string_indexof(src, "/images/") >= 0) ||
			// https://theinspirationgrid.com/app/uploads/2019/03/photography-neon-flowers-06-768x1023.jpg
			(domain_nowww === "theinspirationgrid.com" && /\/app\/+uploads\//.test(src)) ||
			// https://static-koimoi.akamaized.net/wp-content/new-galleries/2013/05/Preity-Zinta-promotes-Ishkq-In-Paris-Pic-3-195x300.jpg
			(domain === "static-koimoi.akamaized.net" && string_indexof(src, "/new-galleries/") >= 0) ||
			// https://img1.elperiodico.com/15/34/f6/keanu-reeves-465x310.jpg
			(domain_nosub === "elperiodico.com" && /^img[0-9]*\./.test(domain)) ||
			// https://gsud.cdn-immedia.net/2019/08/MEGHAN-MARKLE-2-296x505.jpg
			domain_nosub === "cdn-immedia.net" ||
			// https://mmglobalmovies.com/wp-content/upload_folders/mmglobalmovies.com/2019/04/MMGlobalMovies-Zoe-L%C3%A9a-Seydoux-214x317.jpg?v=1554664150250
			(domain_nowww === "mmglobalmovies.com" && /\/wp-content\/+upload_folders\//.test(src)) ||
			// https://images.in.com/uploads/2018/01/7746509462_deffbcb546_b-768x976.jpg
			(domain === "images.in.com" && string_indexof(src, "/uploads/") >= 0) ||
			// https://staticuestudio.blob.core.windows.net/buhomag/2016/02/16170844/GettyImages-510506276-1000x793.jpg
			domain === "staticuestudio.blob.core.windows.net" ||
			// https://cdn.imvges.com/hMJjQo2S-160x160.jpg
			domain === "cdn.imvges.com" ||
			// http://media.pamper.my/2015/11/PAP-PE16-12-312x420.jpg
			domain === "media.pamper.my" ||
			// https://www.rnbjunk.com/foto/2016/08/2016-vmas-hailee-steinfeld-300x450.jpg
			(domain_nowww === "rnbjunk.com" && string_indexof(src, "/foto/") >= 0) ||
			// https://cdn.xpicsxx.com/uploads/2019/10/17151356/ahri-cosplay-364x485.jpg
			(domain === "cdn.xpicsxx.com" && string_indexof(src, "/uploads/") >= 0) ||
			// https://zokatv.net//media/movies/2018/11/image_5a81a2557cb187f555946504aa8130f8-300x444.jpg
			(domain_nowww === "zokatv.net" && string_indexof(src, "/media/") >= 0) ||
			// https://magazin.lufthansa.com/content/uploads/2018/07/Skytalk_Alicia_Vikander_Slider_LHM_08_2018-980x551.jpg
			//   https://magazin.lufthansa.com/content/uploads/2018/07/Skytalk_Alicia_Vikander_Slider_LHM_08_2018.jpg
			(domain_nowww === "magazin.lufthansa.com" && /\/content\/+uploads\//.test(src)) ||
			// https://www.nexofin.com/archivos/2016/05/alicia-vikander-7-360x216.jpg
			(domain_nowww === "nexofin.com" && string_indexof(src, "/archivos/") >= 0) ||
			// https://gallery.southindianactress.in/2019/11/priya-singh-photos-q9-fashion-studio-launch-21-720x411.jpg
			//   https://gallery.southindianactress.in/2019/11/priya-singh-photos-q9-fashion-studio-launch-21.jpg
			domain === "gallery.southindianactress.in" ||
			// https://ffp4g1ylyit3jdyti1hqcvtb-wpengine.netdna-ssl.com/addons/files/2019/10/bj-160x160.jpg
			(domain === "ffp4g1ylyit3jdyti1hqcvtb-wpengine.netdna-ssl.com" && /\/addons\/+files\//.test(src)) ||
			// https://medinaa.archolda.com/ime/a3d78b74fb613f5f-120x86.jpg
			(domain === "medinaa.archolda.com" && string_indexof(src, "/ime/") >= 0) ||
			// https://londonsvenskar.com/kultur/files/2018/10/van-gogh-654x441.jpg
			(domain_nowww === "londonsvenskar.com" && string_indexof(src, "/files/") >= 0) ||
			// https://ia.eferrit.com/ia/a3d78b74fb613f5f-1024x682.jpg -- upscaled (nearest)?
			(domain === "ia.eferrit.com" && string_indexof(src, "/ia/") >= 0) ||
			// https://dokkaebi.tv/file/2017/05/60JODGfbtIIZ0FqE8SfLSs1QfHb-185x278.jpg
			(domain_nowww === "dokkaebi.tv" && string_indexof(src, "/file/") >= 0) ||
			// https://www.porncomix.one/gallery/2019/11/Matemi-%E2%80%93-Silver-Soul-vol.-10-1-351x565.jpg
			(domain_nowww === "porncomix.one" && string_indexof(src, "/gallery/") >= 0) ||
			// https://www.porncomix.info/images/2013/05/001-39-225x320.jpg
			(domain_nowww === "porncomix.info" && string_indexof(src, "/images/") >= 0) ||
			// http://celebsfake.adultcase.com/files/2016/11/jizzonme2-150x150.jpg
			//   http://celebsfake.adultcase.com/files/2016/11/jizzonme2.jpg
			(domain === "celebsfake.adultcase.com" && string_indexof(src, "/files/") >= 0) ||
			// thanks to cbadoud on github: https://github.com/qsniyg/maxurl/issues/203#issuecomment-578967505
			// https://www.theonemilano.com/the-one-milano-uploads/2017/01/IMG_0657-768x573.jpg
			(domain_nowww === "theonemilano.com" && string_indexof(src, "/the-one-milano-uploads/") >= 0) ||
			// https://public.flashingjungle.com/exhibitionism/2020/01/tumblr_l7d540zpVM1qd5asfo1_1280-681x1024.jpg
			domain === "public.flashingjungle.com" ||
			// https://static.pr.ricmais.com.br/ricmaispr/uploads/2019/09/adastra01ric-220x134.jpg
			(domain === "static.pr.ricmais.com.br" && string_indexof(src, "/uploads/") >= 0) ||
			// https://www.smarthomebeginner.com/images/2012/08/SSH-ubuntu-putty-screenshot-500x301.png
			(domain_nowww === "smarthomebeginner.com" && string_indexof(src, "/images/") >= 0) ||
			// https://www.inspirationde.com/media/2014/04/world-stunning-and-beautiful-eyes-photography-photography-heat-photography-inspirations-and-onli-13981561444k8ng-150x150.jpg
			(domain_nowww === "inspirationde.com" && string_indexof(src, "/media/") >= 0) ||
			// https://cache.escapistmagazine.com/2020/04/Hello-Neighbor-400x225.jpg
			domain === "cache.escapistmagazine.com" ||
			// https://www.stickboybkk.com/images/2015/09/girls-next-door-3-160x120.jpg
			(domain_nowww === "stickboybkk.com" && string_indexof(src, "/images/") >= 0) ||
			// https://www.fitolsam.com/uploads/2019/05/1-2-1024x658.jpg
			(domain_nowww === "fitolsam.com" && string_indexof(src, "/uploads/") >= 0) ||
			// https://sevelina.ru/images/uploads/2015/08/1212121-139x120.gif
			(domain_nowww === "sevelina.ru" && /\/images\/+uploads\//.test(src)) ||
			// https://www.cdprojekt.com/en/wp-content/uploads-en/2020/04/cyberpunk2077-running_the_show-rgb-1024x576.jpg
			(domain_nowww === "cdprojekt.com" && string_indexof(src, "/wp-content/") >= 0) ||
			// http://www.bilgimanya.com/resimler/2011/07/selena-gomez-resimleri-fotograflari-photos-gallery-17-170x170.jpg
			(domain_nowww === "bilgimanya.com" && string_indexof(src, "/resimler/") >= 0) ||
			// https://storage.googleapis.com/unlimitedcnd.appspot.com/2020/06/439453-200x300.jpg
			googlestorage_container === "unlimitedcnd.appspot.com" ||
			// http://cdn.newlineporn.com/thumbs/orgy-cash/tyrannized/femdom/36724/00-74x74.jpg
			domain === "cdn.newlineporn.com" ||
			// http://galleries.xxxasianpussy.com/thumbs/butterfly-bucks/thai-girls-wild/asian/23121/07-160x220.jpg
			(domain === "galleries.xxxasianpussy.com" && /\/thumbs\//.test(src)) ||
			// https://okdiario.com/img/2020/05/20/billie-eilish-143x89.jpg
			(domain_nowww === "okdiario.com" && string_indexof(src, "/img/") >= 0) ||
			// https://s3-us-west-1.amazonaws.com/static-spin-com/files/2020/08/PaulMescal_RollingStones_Scarlet-1596657752-768x511.jpg
			(amazon_container === "static-spin-com" && string_indexof(src, "/files/") >= 0) ||
			// thanks to jloqfjgk on github: https://github.com/qsniyg/maxurl/issues/408
			// https://www.lapisrelights.com/assets/img/uploads/2020/08/lapis_crossword_thumb2-1024x576.jpg
			(domain_nowww === "lapisrelights.com" && /\/assets\/+img\/+uploads\//.test(src)) ||
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/439
			// https://www.wbbjtv.com/content/uploads/2020/03/MGN_1280x960_00321B00-INZQY-1024x768.jpg
			((domain_nowww === "wbbjtv.com" ||
				// https://www.channel3000.com/content/uploads/2020/09/Drink-1024x576.jpg
				domain_nowww === "channel3000.com" ||
				// https://www.9and10news.com/content/uploads/2020/07/BOAT-3-553x360.jpg
				domain_nowww === "9and10news.com" ||
				(domain_nosub === "tn-cloud.net" && /^wpcdn\./.test(domain)) ||
				// https://www.kxly.com/content/uploads/2020/09/computer-keyboard-Cropped-1024x576-640x360.jpg
				domain_nowww === "kxly.com") && /\/content\/+uploads\//.test(src)) ||
			// https://static.acgsoso.com/uploads/2020/02/19bd4f091f03c191195d5e626c3190f9-200x300.jpg
			(domain === "static.acgsoso.com" && string_indexof(src, "/uploads/") >= 0) ||
			// https://static.billboard.com/files/media/Lil-Wayne-face-tattoo-gallery-billboard-1548-300x198.jpg
			// https://static.billboard.com/files/media/07-demi-lovato-aa-bb7-27-fea-billboard-1548-1024x677.jpg
			// https://static.billboard.com/files/2020/10/01-ireneisgood-tiktok-2020-billboard-1548-1601742564-300x198.jpg
			// https://static.billboard.com/files/2020/09/Carrie-Underwood-My-Gift-cr-Joseph-Llanes-2020-billboard-1548-1601050964-300x198.jpg
			// https://charts-static.billboard.com/img/2013/06/bts-4i5-155x155.jpg
			// https://charts-static.billboard.com/img/2020/08/24kgoldn-hvh-mood-23c-155x155.jpg
			(domain_nosub === "billboard.com" && /static\./.test(domain)) ||
			// thanks to dym-sh on github: https://github.com/qsniyg/maxurl/issues/480
			// https://images.fastcompany.net/image/upload/wp-cms/uploads/2019/06/5-inside-silicon-valleys-new-robot-run-farm-813x457.jpg
			(domain === "images.fastcompany.net" && /\/wp-cms\/+uploads\//.test(src)) ||
			// https://www.gamerevolution.com/assets/uploads/2020/10/amnesia-rebirth-box-236x306.jpg
			(domain_nowww === "gamerevolution.com" && /\/assets\/+uploads\//.test(src)) ||
			// https://inglam.ru/img/2020/11/Jennifer-Lawrence-Harpers-Bazaar-2016-003-166x200.jpg
			(domain_nowww === "inglam.ru" && /\/img\/+[0-9]{4}\/+/.test(src)) ||
			// https://media.spiked-online.com/website/images/2020/12/23213144/CW-24.12-600x338.jpeg
			(domain === "media.spiked-online.com" && string_indexof(src, "/images/") >= 0) ||
			// https://www.unicef.ie/app/uploads/2016/09/Emma-Watson-introduces-The-Worlds-Largest-Lesson-on-Global-Goals-2016-300x191.jpg
			(domain_nowww === "unicef.ie" && /\/app\/+uploads\//.test(src)) ||
			// https://cdn.downriversundaytimes.com/2020/05/StreetSweeper20151-150x150.jpg
			domain === "cdn.downriversundaytimes.com" ||
			// thanks to fedesk on discord
			// https://media.hotpress.com/uploads/2019/11/25101541/IMGL8113-copy-200x300.jpg
			(domain === "media.hotpress.com" && string_indexof(src, "/uploads/") >= 0) ||
			// https://images.thedigitalfix.com/img/6/2021/04/tfatws-105-truth-1-330x185.jpeg
			domain === "images.thedigitalfix.com" ||
			// thanks to dym-sh on github: https://github.com/qsniyg/maxurl/issues/806
			// https://www.quantamagazine.org/broadband-networks-of-viruses-may-help-bacteria-evolve-faster-20181016/
			// https://d2r55xnwy6nx47.cloudfront.net/uploads/2018/10/Bacteriophages_520x292-520x292.jpg
			//   https://d2r55xnwy6nx47.cloudfront.net/uploads/2018/10/Bacteriophages_520x292.jpg
			//   https://d2r55xnwy6nx47.cloudfront.net/uploads/2018/10/Bacteriophages_2880x1620.jpg
			// https://d2r55xnwy6nx47.cloudfront.net/uploads/2018/10/Chen_v1-520x520.jpg
			//   https://d2r55xnwy6nx47.cloudfront.net/uploads/2018/10/Chen_v1.jpg
			// https://www.quantamagazine.org/the-mystery-at-the-heart-of-physics-that-only-math-can-solve-20210610/
			// https://d2r55xnwy6nx47.cloudfront.net/uploads/2021/06/QFT_Infinity_520x292-520x293.jpg
			//   https://d2r55xnwy6nx47.cloudfront.net/uploads/2021/06/QFT_Infinity_520x292.jpg
			//   https://d2r55xnwy6nx47.cloudfront.net/uploads/2021/06/Quantum-Field-Theory_Infinity-Bridge_Lede.jpg
			// https://d2r55xnwy6nx47.cloudfront.net/uploads/2018/10/Jose-Penades-1200x1600-390x520.jpg
			//   https://d2r55xnwy6nx47.cloudfront.net/uploads/2018/10/Jose-Penades-1200x1600.jpg
			//   https://d2r55xnwy6nx47.cloudfront.net/uploads/2018/10/Jose-Penades.jpg -- 403
			domain === "d2r55xnwy6nx47.cloudfront.net" ||
			// thanks to nimbuz on discord:
			// https://cdn.entameclip.com/2021/06/pic20210622st1-1200x675.jpg
			//   https://cdn.entameclip.com/2021/06/pic20210622st1.jpg
			domain === "cdn.entameclip.com" ||
			// https://generalarcade.com/content/uploads/2013/09/ss_5ad31d165e449a534924c830207bdaff76dc6669.1920x1080-300x169.jpg
			//   https://generalarcade.com/content/uploads/2013/09/ss_5ad31d165e449a534924c830207bdaff76dc6669.1920x1080.jpg
			(domain_nowww === "generalarcade.com" && /\/content\/+uploads\//.test(src)) ||
			// thanks to nimbuz on discord:
			// https://news.r18.com/assets/2020/02/yuka-debut-300x300.jpg
			(domain === "news.r18.com" && /\/assets\/+[0-9]{4}\/+[0-9]{2}\/+/.test(src)) ||
			// https://www.stylebook.de/data/uploads/2020/03/gettyimages-1207210287_1583405418-660x660.jpg
			(domain_nowww === "stylebook.de" && /\/data\/+uploads\//.test(src)) ||
			// thanks to DevWannabe-dot on github: https://github.com/qsniyg/maxurl/issues/1035
			// https://cdn.kastatic.org/images/badges/meteorite-60x60.png
			(domain === "cdn.kastatic.org" && string_indexof(src, "/images/") >= 0) ||
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/473
			// https://cdn.theathletic.com/app/uploads/2020/10/06131145/GettyImages-1228899699-1024x683.jpg
			// https://cdn.theathletic.com/app/uploads/2020/10/06123927/dickerson-1024x653.jpg
			// https://cdn.theathletic.com/app/uploads/2020/08/12102954/USATSI_14704215-1024x715.jpg
			(domain === "cdn.theathletic.com" && /\/app\/+uploads\//.test(src)) ||
			// https://cgaxisimages.fra1.cdn.digitaloceanspaces.com/2020/10/metal_space_ship_floor_28_16_render-1-708x708.jpg
			//   https://cgaxisimages.fra1.cdn.digitaloceanspaces.com/2020/10/metal_space_ship_floor_28_16_render-1.jpg
			digitalocean_container === "cgaxisimages" ||
			// thanks to jonestly on discord:
			// https://www.pockettactics.com/wp-content/sites/pockettactics/2022/06/nier-automata-endings-550x309.jpg
			(domain_nowww === "pockettactics.com" && /\/wp-content\//.test(src)) ||
			// thanks to roi:
			// https://ogden_images.s3.amazonaws.com/www.reviewonline.com/images/2022/02/03221107/AP220333520862561-1100x733.jpg
			amazon_container === "ogden_images" ||
			// thanks to roi:
			// https://www.lapersonne.com/app/uploads/2021/12/timeless-pandora-lapersonne-13-1024x585.jpg
			(domain_nowww === "lapersonne.com" && /\/app\/+uploads\//.test(src)) ||
			// thanks to Adrthegamedev on github: https://github.com/qsniyg/maxurl/issues/1132
			// https://www.ipcc.ch/site/assets/uploads/sites/4/2019/11/Figure-3.4-150x150.jpg
			//   https://www.ipcc.ch/site/assets/uploads/sites/4/2019/11/Figure-3.4.jpg
			(domain_nowww === "ipcc.ch" && /\/assets\/+uploads\//.test(src)) ||
			// https://lindenstaub.b-cdn.net/app/uploads/2023/02/IMG_0193-750x1125.jpg
			(domain === "lindenstaub.b-cdn.net" && /\/app\/+uploads\//.test(src)) ||
			// thanks to vscum on github: https://github.com/qsniyg/maxurl/pull/1137
			// https://blogs.stlawu.edu/israel2017/files/2018/05/916ABEDD-F817-4DA9-9092-6E1FBDBE29C1-768x576.jpg
			(domain === "blogs.stlawu.edu" && string_indexof(src, "/files/") >= 0) ||
			// thanks to roi:
			// https://static.nexilia.it/nextquotidiano/2022/11/giorgia-meloni-cdm-750x391.jpg
			domain === "static.nexilia.it" ||
			// thanks to jonestly on discord:
			// https://www.fractal-design.com/app/uploads/2019/07/PD_Building_3-1-1800x1200.jpg
			(domain_nowww === "fractal-design.com" && /\/app\/+uploads\//.test(src)) ||
			// thanks to sn3akyb3ar on github: https://github.com/qsniyg/maxurl/issues/1224
			// https://static.purple.fr/2023/09/Screenshot-2023-09-27-at-16.16.37-374x550.png
			//   https://static.purple.fr/2023/09/Screenshot-2023-09-27-at-16.16.37.png
			domain === "static.purple.fr" ||
			// thanks to sn3akyb3ar on github: https://github.com/qsniyg/maxurl/issues/1062
			// https://www.voguehk.com/media/2022/08/VHK-041-Kim-Tae-Ri-Cover-02-1440x1800.jpg
			//   https://www.voguehk.com/media/2022/08/VHK-041-Kim-Tae-Ri-Cover-02.jpg
			(domain_nowww === "voguehk.com" && /\/media\//.test(src)) ||
			// thanks to anonymous for reporting:
			// https://cdn.anime-planet.com/characters/primary/shinku-1-190x263.jpg?t=1625965389
			domain === "cdn.anime-planet.com" ||
			// thanks to anonymous for reporting:
			// https://inglam.club/img/2024/04/Joey-King-30th-Annual-Screen-Actors-Guild-Awards-2024-3FD47855-133x200.jpg
			//   https://inglam.club/img/2024/04/Joey-King-30th-Annual-Screen-Actors-Guild-Awards-2024-3FD47855.jpg
			(domain_nowww === "inglam.club" && /\/img\//.test(src)) ||
			// thanks to anonymous for reporting:
			// https://d23.com/app/uploads/2024/05/1180w_600h_051724_Pepe_Disney_Springs_FL_Offer_00-1024x521.jpg
			//   https://d23.com/app/uploads/2024/05/1180w_600h_051724_Pepe_Disney_Springs_FL_Offer_00.jpg
			(domain_nowww === "d23.com" && /\/app\/+uploads\//.test(src)) ||
			// thanks to anonymous for reporting:
			// https://cdn1.sunderlandafc.news/uploads/40/2024/06/GettyImages-1794407675-750x478.jpg
			(domain_nosub === "sunderlandafc.news" && /^cdn[0-9]*\./.test(domain) && /\/uploads\//.test(src)) ||
			// thanks to vscum on github: https://github.com/qsniyg/maxurl/issues/1191
			// https://cdn.cherrynudes.com/app/uploads/2024/09/riley-reid-risky-business-playboy-3-410x410.jpg
			//   https://cdn.cherrynudes.com/app/uploads/2024/09/riley-reid-risky-business-playboy-3.jpg
			(domain === "cdn.cherrynudes.com" && /\/app\/+uploads\//.test(src)) ||
			// thanks to vscum on github: https://github.com/qsniyg/maxurl/issues/1191
			// https://cdn.bunnylust.com/app/uploads/2024/09/riley-reid-risky-business-playboy-3-300x375.jpg
			//   https://cdn.bunnylust.com/app/uploads/2024/09/riley-reid-risky-business-playboy-3.jpg
			(domain === "cdn.bunnylust.com" && /\/app\/+uploads\//.test(src)) ||
			// https://wp-assets.futurism.com/2024/01/Screenshot-2024-01-12-at-10.19.15%E2%80%AFAM-1200x865.png
			//   https://wp-assets.futurism.com/2024/01/Screenshot-2024-01-12-at-10.19.15%E2%80%AFAM.png
			domain === "wp-assets.futurism.com" ||
			// thanks to anonymous for reporting:
			// https://mei.kuudere.pw/j0lL63uqpto-218x400.jpg
			domain === "mei.kuudere.pw" ||
			// thanks to anonymous for reporting:
			// https://gizmodo.com/app/uploads/2020/01/omu3x1ljkuxngkz1ledn-1024x576.jpg
			(domain_nowww === "gizmodo.com" && /\/app\/+uploads\//.test(src)) ||
			// thanks to anonymous for reporting:
			// https://cdn.entameclip.com/2024/10/pic20241023kimitoband1-300x225.jpg
			//   https://cdn.entameclip.com/2024/10/pic20241023kimitoband1.jpg
			domain === "cdn.entameclip.com"
			) {
			src = src.replace(/-[0-9]+x[0-9]+\.([^/]*(?:[?#].*)?)$/, ".$1");
		}

		if ((domain === "store.pinseyun.com" && string_indexof(src, "/uploads/") >= 0) ||
			// thanks to anonymous for reporting:
			// https://s3.manualzz.com/store/data/019683962_1-63c5f7e3eec5b6a39772d3cb21b7e749-360x466.png
			//   https://s3.manualzz.com/store/data/019683962_1-63c5f7e3eec5b6a39772d3cb21b7e749.png
			(domain === "s3.manualzz.com" && /\/store\/+data\//.test(src)) ||
			// https://media.coindesk.com/uploads/2018/07/shutterstock_703755544-860x430.jpg
			(domain === "media.coindesk.com" && string_indexof(src, "/uploads/") >= 0)) {
			// http://store.pinseyun.com/uploads/2016/10/20161021222440-150x150.jpg
			// http://store.pinseyun.com/uploads/2016/06/201605work-94-150x15`0.jpg
			return {
				url: src.replace(/-[0-9]*x[0-9]*\.([^/.]*)$/, ".$1"),
				can_head: false
			};
		}

		if (domain === "cdn.fashionmagazine.com") {
			// https://cdn.fashionmagazine.com/wp-content/uploads/2018/04/CULaubrey_01_0518-480x600-c-top.jpg
			//   https://cdn.fashionmagazine.com/wp-content/uploads/2018/04/CULaubrey_01_0518.jpg
			return src.replace(/(\/+wp-content\/+uploads\/+[0-9]{4}\/+[0-9]{2}\/+[^/]*)-[0-9]+x[0-9]+-c-[a-z]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		// https://cdn.heatworld.com/one/lifestyle-legacy/fc/e7794/f8a77/be88e/964ad/02b2a/6e7bd/claude-littner_940x526.jpg
		//   https://cdn.heatworld.com/one/lifestyle-legacy/fc/e7794/f8a77/be88e/964ad/02b2a/6e7bd/claude-littner.jpg
		if (domain === "cdn.heatworld.com" ||
			// http://www.sohobluesgallery.com/mm5/graphics/00000001/Rolling_Stones_Keith_Richards_Guitar_God_475x705.jpg
			//   http://www.sohobluesgallery.com/mm5/graphics/00000001/Rolling_Stones_Keith_Richards_Guitar_God.jpg
			domain_nowww === "sohobluesgallery.com" ||
			// https://media.indiatimes.in/media/content/2018/Feb/arun_jaitley_allocates_rs_1200_crore_to_promote_bamboo_cultivation_1517487222_100x150.jpg
			domain === "media.indiatimes.in" ||
			// https://www.bangkokpost.com/media/content/20180126/c1_1401970_180126042828_620x413.jpg
			// https://bangkokpost.com/media/content/20180126/c1_1401970_180126042828_620x413.jpg
			domain_nowww === "bangkokpost.com" ||
			// https://media2.mensxp.com/media/content/2018/Feb/congress-takes-digs-at-bjp-and-pm-modi-with-a-valentines-day-video-1400x653-1518681640_401x187.jpg
			//(domain_nosub === "mensxp.com" && domain.match(/media[0-9]*\.mensxp\.com/)) ||
			// http://media.new.mensxp.com/media/photogallery/2014/Nov/zoesaldana6_1415100628_100x50.jpg
			// https://media1.mensxp.com/media/photogallery/2014/Nov/zoesaldana2_1415100585_100x50.jpg
			(domain_nosub === "mensxp.com" && domain.match(/media[0-9]*\./) && string_indexof(src, "/media/") >= 0) ||
			// http://221.132.38.109/nvdata/uploads/thumbnail/2017/12/01/baogiohetbatlucnhintremamnonbibaohanh_20171201151535_220x124.jpg
			domain === "221.132.38.109" ||
			// http://www.jpcoast.com/img/201403/21_DSC_1247_600x400.jpg
			// http://jpcoast.com/img/201403/21_DSC_1247_600x400.jpg
			(domain_nowww === "jpcoast.com" && string_indexof(src, "/img/") >= 0) ||
			// https://pics.prcm.jp/908a8687073fe/66459731/jpeg/66459731_220x241.jpeg
			domain === "pics.prcm.jp" ||
			// http://s1.lprs1.fr/images/2017/08/17/7197618_sofia-solares-cover_940x500.PNG
			(domain_nosub === "lprs1.fr" && domain.match(/s[0-9]*\.lprs1\.fr/)) ||
			// http://m.wsj.net/video/20170227/022717oscarsfashion/022717oscarsfashion_1280x720.jpg
			domain === "m.wsj.net" ||
			// http://img.lifestyler.co.kr/uploads/program/1/1728/menu/16/board/0/0/f131717137323426000(0)_226x146.jpg
			domain === "img.lifestyler.co.kr" ||
			// http://fototo.blox.pl/resource/rihanna_and_red_400x400.jpg
			domain === "fototo.blox.pl" ||
			// http://media.nvyouj.com/photos/2017/1007/20/DLiF1LFVoAAdtbR_240x240.jpg
			domain === "media.nvyouj.com" ||
			// http://cl.buscafs.com/www.tomatazos.com/public/uploads/images/184724_600x315.jpg
			(domain === "cl.buscafs.com" && string_indexof(src, "/www.tomatazos.com/") >= 0) ||
			// http://tomatazos.buscafs.com/uploads/images/199130_600x759.jpg
			(domain === "tomatazos.buscafs.com" && string_indexof(src, "/uploads/images/") >= 0) ||
			// http://nisfeldunia.ahram.org.eg/Media/NewsMedia/2017/6/4/2017-636321794648424569-842_242x160.jpg
			(domain === "nisfeldunia.ahram.org.eg" && string_indexof(src, "/Media/") >= 0) ||
			// https://d2t7cq5f1ua57i.cloudfront.net/images/r_images/51261/54063/51261_54063_77_0_8968_20141223201250892_200x200.jpg
			domain === "d2t7cq5f1ua57i.cloudfront.net" ||
			// https://image.ibb.co/fmOKNJ/h_54456811_768x530.jpg
			//domain === "image.ibb.co" ||
			// http://socdn.smtown.com/upload/smtownnow/pictures/images/2018/06/15/o_1cg12bap41e5v3vh1iu2mhkjaj9_600x800.jpg
			domain === "socdn.smtown.com" ||
			// http://www.lecturas.com/medio/2018/03/14/andrea-duro-4_6a8880f6_800x1200.jpg
			(domain_nowww === "lecturas.com" && string_indexof(src, "/medio/") >= 0) ||
			// https://www.clara.es/medio/2018/02/26/margot-robbie-oscars-2017_f0ed3ed6_600x900.jpg
			(domain_nowww === "clara.es" && string_indexof(src, "/medio/") >= 0) ||
			// https://images.anandtech.com/doci/12326/2018-01-09_14.26.05_678x452.jpg
			domain === "images.anandtech.com" ||
			// https://cdn.popbela.com/content-images/post/20170217/foto-cover-tweak-10c04c1a30b06c260e3dedd966775b45_750x500.jpg
			domain === "cdn.popbela.com" ||
			// http://cdnimg103.lizhi.fm/audio_cover/2017/06/01/2605105337514729479_320x320.png
			(domain_nosub === "lizhi.fm" && domain.match(/^cdnimg[0-9]*\./)) ||
			// https://img.cf.47news.jp/public/photo/46f4777d8bbca4365d93bdd700e40cb4/photo_120x96.jpg
			domain === "img.cf.47news.jp" ||
			// https://static.filmin.es/images/media/22272/4/still_1_3_790x398.jpg
			domain === "static.filmin.es" ||
			// http://img0.ropose.com/story/9fNu_1496394464744_db0ebcd0_a337_350x525.jpeg
			(domain_nosub === "ropose.com" && domain.match(/^img[0-9]*\./)) ||
			// http://resource.info.mn/infomn/images/2013/5/266c1f4994f07d060888db46a9100581/2013+Billboard+Music+Awards+Arrivals+19GjdCzDuPix_500x500.jpg
			domain === "resource.info.mn" ||
			// http://image1.thegioitre.vn/2018/08/16/neu-khong-muon-vai-u-thit-bap-chi-em-dung-tap-6-bai-the-duc-nay-thumb_160x106.jpg
			(domain_nosub === "thegioitre.vn" && domain.match(/^image[0-9]*\./)) ||
			// http://img.uduba.com/uduba/user_data/60/8c/608c39df8cadf0a631422b5000631aba_430x272.jpg?uduba_pid=3164615
			//   http://img.uduba.com/uduba/user_data/60/8c/608c39df8cadf0a631422b5000631aba.jpg?uduba_pid=3164615
			domain === "img.uduba.com" ||
			// http://img.51ztzj.com//upload/image/20140929/dn201409304011_172x108.jpg
			domain === "img.51ztzj.com" ||
			// http://mediaresources.idiva.com/media/photogallery/2011/May/isabel_lucas_india_inspired_320x240.jpg
			(domain === "mediaresources.idiva.com" && string_indexof(src, "/media/") >= 0) ||
			// https://static.bangkokpost.com/media/content/20180913/c1_1539258_620x413.jpg
			domain === "static.bangkokpost.com" ||
			// https://www.lepoint.fr/images/2016/12/23/6504996lpw-6505226-article-jpg_4470079_1250x625.jpg -- upscaled?
			// https://static.lpnt.fr/images/2017/06/01/8809423lpw-8809517-article-rea249774071-jpg_4324942_660x281.jpg
			((domain_nowww === "lepoint.fr" || domain === "static.lpnt.fr") && string_indexof(src, "/images/") >= 0) ||
			// https://i2.sdpnoticias.com/sdpnoticias/2018/11/07/1616_selena-gomez_620x350.jpg
			//   https://i2.sdpnoticias.com/sdpnoticias/2018/11/07/1616_selena-gomez.jpg
			(domain_nosub === "sdpnoticias.com" && domain.match(/^i[0-9]*\./)) ||
			// https://s.thestreet.com/files/tsc/v2008/photos/contrib/uploads/1a72764a-38f2-11e8-840e-0fede5440c05_600x400.png
			(domain === "s.thestreet.com" && string_indexof(src, "/files/") >= 0) ||
			// https://www.cosmopolitan.com.hk/var/cosmopolitanhk/storage/nodejs/legacy/images/lifestyle/lulu_0_708x708.jpeg
			// https://www.cosmopolitan.com.hk/var/cosmopolitanhk/storage/nodejs/files/2017/03/02/15a8e0fe-a0a5-47be-91fe-760e8b48fe0d.15a8e0fe-a0ae-443f-be2a-74d53c711306_708x708.jpeg
			(domain_nowww === "cosmopolitan.com.hk" && src.match(/\/storage\/+nodejs\/+(?:legacy\/+images|files)\//)) ||
			// http://s2.cdn.bbwc.cn/issue_0/articles/200058005/2016/1228/58639baea2fdb_640x426.png
			(domain_nosub === "bbwc.cn" && domain.match(/^s[0-9]*\.cdn\./)) ||
			// https://d4zcrs0v202ys.cloudfront.net/images/2019/03/stone1_2_1200x0.jpg
			(domain === "d4zcrs0v202ys.cloudfront.net" && string_indexof(src, "/images/") >= 0) ||
			// http://cdn2.sornamag.com/files/images/20195/25/2019525124338560410a_215x160.jpg
			(domain_nosub === "sornamag.com" && src.match(/\/files\/+images\//)) ||
			// http://arhiva.nacional.hr/img/5/e/0/5e0d49042d5cb85f05d03d2485e2ba1b_700x550.jpg
			(domain === "arhiva.nacional.hr" && string_indexof(src, "/img/") >= 0) ||
			// https://img.myvideo.net.tw/images/MUS030/0000/0254/201407071400064359_210x300.jpg
			(domain === "img.myvideo.net.tw" && string_indexof(src, "/images/") >= 0) ||
			// https://image.apost.com/media/articletranslation/2019/05/21/15/c4ac945abf24c9a59a81cdc6130689b8_500x1.jpg
			(domain === "image.apost.com" && string_indexof(src, "/media/") >= 0) ||
			// https://im.indiatimes.in/content/2014/Aug/s_1407321747_540x540.jpg
			(domain === "im.indiatimes.in" && string_indexof(src, "/content/") >= 0) ||
			// http://admin.alo.rs/resources/images/0000/071/770/profimedia-0305047636_400x0.jpg
			(domain === "admin.alo.rs" && /\/resources\/+images\//.test(src)) ||
			// https://img.pcauto.com.cn/images/upload/upc/tx/bbs6/2002/03/c14/190948489_1580708733128_700x700.jpg
			(domain === "img.pcauto.com.cn" && /\/images\/+upload\//.test(src)) ||
			// thanks to MinuteAd8502 on github: https://github.com/qsniyg/maxurl/issues/843
			// https://cdn.sportrebel.pl/photos/Womens-UA-HeatGear-Armour-Shorty-bpk-3_460x440.jpg
			//   https://cdn.sportrebel.pl/photos/Womens-UA-HeatGear-Armour-Shorty-bpk-3.jpg
			(domain === "cdn.sportrebel.pl" && string_indexof(src, "/photos/") >= 0) ||
			// thanks to MinuteAd8502 on github: https://github.com/qsniyg/maxurl/issues/878
			// https://cdn.sweatband.com/asics_gel-surveyor_4_ladies_running_shoes_asics_gel-surveyor_4_ladies_running_shoes_-_alternative_view_400x400.jpg
			//   https://cdn.sweatband.com/asics_gel-surveyor_4_ladies_running_shoes_asics_gel-surveyor_4_ladies_running_shoes_-_alternative_view.jpg
			// https://cdn.sweatband.com/yonex%20tournament%2012060ex%20t-shirt_yonex_12060ex_t-shirt_400x400.jpg
			//   https://cdn.sweatband.com/yonex%20tournament%2012060ex%20t-shirt_yonex_12060ex_t-shirt.jpg
			domain === "cdn.sweatband.com" ||
			// http://images.cinefil.com/movies/1053952_1600x450.jpg
			//   http://images.cinefil.com/movies/1053952.jpg
			domain === "images.cinefil.com" ||
			// thanks to anonymous for reporting:
			// https://palmaresadisq.ca/uploads/equisoft/37/2df5f57428653b07f7f9749f6c61788f_250x250.jpg
			//   https://palmaresadisq.ca/uploads/equisoft/37/2df5f57428653b07f7f9749f6c61788f.jpg
			(domain_nowww === "palmaresadisq.ca" && string_indexof(src, "/uploads/") >= 0) ||
			// thanks to anonymous for reporting:
			// https://image.b2bmilestone.com/9b548baace8311b86ed42435b22d801599ffbb5f/00047740382_01_350x350.jpg
			domain === "image.b2bmilestone.com" ||
			// thanks to DoomTay on github: https://github.com/qsniyg/maxurl/issues/1376
			// https://www.booksie.com/files/postings/8/93163-22445_MEDIA_IMAGE__230x230.jpg
			//   https://www.booksie.com/files/postings/8/93163-22445_MEDIA_IMAGE_.jpg
			(domain_nowww === "booksie.com" && /\/files\/+postings\//.test(src)) ||
			// https://music-bandlink.s3.yandex.net/img/bandlinks/sGCmi_igXrmdjp_370x370.jpg
			//   https://music-bandlink.s3.yandex.net/img/bandlinks/sGCmi_igXrmdjp.jpg
			domain === "music-bandlink.s3.yandex.net") {
			newsrc = src.replace(/_[0-9]+x[0-9]+(\.[^/.]*)$/, "$1");
			if (newsrc !== src)
				return newsrc;
		}

		// http://www.mediaonlinevn.com/wp-content/uploads/2016/03/160315-pantech-launch-hcm-41_resize-680x365_c.jpg
		// https://mediaonlinevn.com/wp-content/uploads/2016/03/160315-pantech-launch-hcm-41_resize-680x365_c.jpg
		if (domain_nowww === "mediaonlinevn.com" ||
			// https://www.delas.pt/files/2017/07/Selena-Gomez-671x377_c.jpg
			//   https://www.delas.pt/files/2017/07/Selena-Gomez.jpg
			// https://www.delas.pt/files/2016/08/hd-aspect-1459874430-hbz-jennifer-lawrence-may-2016-09-150x84.jpg
			//   https://www.delas.pt/files/2016/08/hd-aspect-1459874430-hbz-jennifer-lawrence-may-2016-09.jpg
			(domain_nowww === "delas.pt" && string_indexof(src, "/files/") >= 0) ||
			// https://www.xda-developers.com/files/2020/01/Google-Nearby-Sharing-Featured-Image-250x125_c.jpg
			//   https://www.xda-developers.com/files/2020/01/Google-Nearby-Sharing-Featured-Image.jpg
			(domain_nowww === "xda-developers.com" && string_indexof(src, "/files/") >= 0) ||
			// http://www.onthemoveworld.com/otm-fr/wp-content/uploads/2019/03/Carly-rae-jepsen-2018-cr-Natalie-OMoore-billboard-1548-347x246_c.jpg
			//   http://www.onthemoveworld.com/otm-fr/wp-content/uploads/2019/03/Carly-rae-jepsen-2018-cr-Natalie-OMoore-billboard-1548.jpg
			domain_nowww === "onthemoveworld.com" ||
			// https://1.soompi.io/wp-content/blogs.dir/8/files/2015/09/HA-TFELT-Wonder-Girls-590x730.jpg -- doesn't work
			// https://cdn0.tnwcdn.com/wp-content/blogs.dir/1/files/2018/01/GTA-6-Female-Protag-796x417.jpg -- does work
			// https://dreamix.eu/blog/wp-content/uploads/2017/05/20150224test644-1508x706_c.jpg
			//   https://dreamix.eu/blog/wp-content/uploads/2017/05/20150224test644.jpg
			// https://rimworldbase.com/wp-content/uploads/2017/05/star-wars-the-force-3-150x150.jpg.webp
			//   https://rimworldbase.com/wp-content/uploads/2017/05/star-wars-the-force-3.jpg.webp
			// thanks to Liz on discord:
			// https://lafayettecarmelites.org/wp-content/uploads/2020/08/TwoSisters2020-uai-720x609.jpg
			//   https://lafayettecarmelites.org/wp-content/uploads/2020/08/TwoSisters2020.jpg
			// don't run it for query args:
			// https://she12.com/wp-content/plugins/seo-alrp/php/thumb.php?src=http://she12.com/uploads/2012/09/Emo-Hairstyles-for-girls.jpg&h=90&w=114&q=90&zc=1
			/^[a-z]+:\/\/[^?]+\/wp(?:-content\/+(?:uploads|images|photos|blogs.dir)|\/+uploads)\/[^?]+-[0-9]+x[0-9]+(?:_c)?\./.test(src)
			//src.indexOf("/wp-content/blogs.dir/") >= 0 ||
			// https://d13ezvd6yrslxm.cloudfront.net/wp/wp-content/images/x-men-apocalypse-700x300.jpg
			//src.indexOf("/wp/wp-content/images/") >= 0 ||
			// http://ljshopch.com/wp-content/photos/2017/12/e6c61489857f770f1738b9a5b8702671-250x150.jpg
			//src.indexOf("/wp-content/photos/") >= 0 ||
			// https://cdn.gamerant.com/wp-content/uploads/resident-evil-2-director-remake-faith-738x410.jpg.webp
			//   https://cdn.gamerant.com/wp-content/uploads/resident-evil-2-director-remake-faith.jpg.webp
			//src.indexOf("/wp-content/uploads/") >= 0 ||
			//src.indexOf("/wp/uploads/") >= 0
			) {
			newsrc = src.replace(/(?:-uai)?-[0-9]+x[0-9]+(?:_c)?(\.[^/.]*(?:\.webp)?)(?:[?#].*)?$/, "$1");
			// thanks to DevWannabe-dot on github for reporting: https://github.com/qsniyg/maxurl/issues/876
			// https://portalrapmais.com/wp-content/uploads/2020/05/travis-kylie-e1589054381471-120x86.jpg
			//   https://portalrapmais.com/wp-content/uploads/2020/05/travis-kylie-e1589054381471.jpg
			//   https://portalrapmais.com/wp-content/uploads/2020/05/travis-kylie.jpg -- broken
			if (newsrc !== src)
				return newsrc;
		}

		// http://felipepitta.com/blog/wp-content/uploads/2014/08/Harry-Potter-Hogwarts-Express-Jacobite-Fort-William-Scotland-Train(pp_w970_h646).jpg
		// http://www.onelittlepicture.com.au/wp-content/uploads/2012/07/IMG_0077a-copy-682x1024(pp_w599_h900).jpg
		if (string_indexof(src, "/wp-content/uploads/") >= 0 ||
			//domain.indexOf(".files.wordpress.com") >= 0 || -- no evidence of this actually working, other patterns don't work for it either
			string_indexof(src, "/wp/uploads/") >= 0) {
			src = src.replace(/\(pp_w[0-9]+_h[0-9]+\)(\.[^/.]*)$/, "$1");
		}


		// doesn't work:
		// https://thechive.files.wordpress.com/2018/06/funny-football-memes-fifa-world-cup-27-5b34f3ecb603a__700.jpg
		if (
			//domain.indexOf(".files.wordpress.com") >= 0 ||
			// https://static.boredpanda.com/blog/wp-content/uploads/2017/08/GW-130817_DSC1426-copy-599f17eddebf2__880.jpg
			//   https://static.boredpanda.com/blog/wp-content/uploads/2017/08/GW-130817_DSC1426-copy-599f17eddebf2.jpg
			string_indexof(src, "/wp-content/uploads/") >= 0 ||
			string_indexof(src, "/wp/uploads/") >= 0) {
			// http://www.randomnude.com/wp-content/uploads/sites/39/2017/06/gomez__7__1.jpg
			src = src.replace(/__[0-9]{2,}(\.[^/.]*)$/, "$1");
		}

		// https://www.thetrace.org/wp-content/uploads/2017/04/Cleveland_Gun_Survivors_065-5394x0-c-default.jpg
		if ((domain_nowww === "djavan.com.br" && /\/content\/+uploads\//.test(src)) ||
			string_indexof(src, "/wp-content/uploads/") >= 0 ||
			string_indexof(src, "/wp/uploads/") >= 0) {
			// thanks to anonymous for reporting:
			// https://djavan.com.br/content/uploads/2018/11/djavan_5367024877_o-300x0-c-default.jpg
			//   https://djavan.com.br/content/uploads/2018/11/djavan_5367024877_o.jpg
			src = src.replace(/-[0-9]+x[0-9]+-c-default(\.[^/.]*)$/, "$1");
		}

		/*if (false && (domain === "storage.journaldemontreal.com" ||
			domain === "storage.torontosun.com" ||
			domain === "storage.ottawasun.com")) {
			return {
				url: src,
				head_wrong_contenttype: true
			};
		}*/

		if (domain === "pictures.ozy.com" ||
			// http://www.retail-jeweller.com/pictures/2000x2000fit/4/2/6/3007426_Pandora-ambassador-Tess-Daly-UK.jpg
			//   http://www.retail-jeweller.com/pictures/99999999x99999999/4/2/6/3007426_Pandora-ambassador-Tess-Daly-UK.jpg
			domain_nowww === "retail-jeweller.com" ||
			// https://d1nslcd7m2225b.cloudfront.net/Pictures/2000x2000fit/1/7/5/1281175_lily_collins_wondercon_2013_555557.jpg
			//   https://d1nslcd7m2225b.cloudfront.net/Pictures/99999999x99999999/1/7/5/1281175_lily_collins_wondercon_2013_555557.jpg
			domain === "d1nslcd7m2225b.cloudfront.net") {
			// https://pictures.ozy.com/pictures/768xany/9/5/0/127950_LESLIE_HILL.jpg
			//   https://pictures.ozy.com/pictures/99999999x99999999/9/5/0/127950_LESLIE_HILL.jpg
			// https://pictures.ozy.com/pictures/600x337fit/9/1/5/127915_sean_ozyfest_00628.jpg
			//   https://pictures.ozy.com/pictures/99999999x99999999/9/1/5/127915_sean_ozyfest_00628.jpg
			// https://pictures.ozy.com/Pictures/385x385/4/3/1/111431_culligan_ozyfest_054.jpg
			//   https://pictures.ozy.com/Pictures/99999999x99999999/4/3/1/111431_culligan_ozyfest_054.jpg
			// https://pictures.ozy.com/pictures/anyx296/2/0/5/70205_OZY_mix_tape_2.jpg
			//   https://pictures.ozy.com/pictures/99999999x99999999/2/0/5/70205_OZY_mix_tape_2.jpg
			return src.replace(/(\/[Pp]ictures\/)[0-9any]+x[0-9any]+(?:[a-z]+)?\//, "$199999999x99999999/");
		}

		if (domain === "static.gofugyourself.com" ||
			// thanks to anonymous for reporting:
			// https://www.kencarson.xyz/files/2022/10/BLACK-COVER1-compressed-1024x1024.jpg
			//   https://www.kencarson.xyz/files/2022/10/BLACK-COVER1.jpg
			(domain_nowww === "kencarson.xyz" && string_indexof(src, "/files/") >= 0) ||
			// https://static.stereogum.com/uploads/2017/02/CAMILA_MOBLEY-2-1487873904-640x427.jpg
			//   https://static.stereogum.com/uploads/2017/02/CAMILA_MOBLEY-2-1487873904.jpg
			// http://static.stereogum.com/uploads/2009/07/megan_fox_car-compressed.jpg
			//   http://static.stereogum.com/uploads/2009/07/megan_fox_car.jpg
			domain === "static.stereogum.com") {
			// https://static.gofugyourself.com/uploads/2017/10/shutterstock_9134610ar-1507848416-353x560.jpg
			//   https://static.gofugyourself.com/uploads/2017/10/shutterstock_9134610ar-1507848416.jpg
			// https://static.gofugyourself.com/uploads/2016/11/GettyImages-509071946-510x766-compressed.jpg
			//   https://static.gofugyourself.com/uploads/2016/11/GettyImages-509071946-510x766.jpg
			//   https://static.gofugyourself.com/uploads/2016/11/GettyImages-509071946.jpg -- doesn't work
			return src.replace(/-(?:[0-9]+x[0-9]+|compressed)(\.[^/.]*)(?:[?#].*)?$/, "$1");
		}

		if (domain === "hips.hearstapps.com") {
			// https://hips.hearstapps.com/hmg-prod.s3.amazonaws.com/images/bgus-1060427-037-1-1510856807.jpg
			//   http://hmg-prod.s3.amazonaws.com/images/bgus-1060427-037-1-1510856807.jpg
			// https://hips.hearstapps.com/rover/profile_photos/21445446-1bde-4290-a24e-2bdd274be027_1516741729.jpg?fill=1:1&resize=200:*
			//   https://hips.hearstapps.com/rover/profile_photos/21445446-1bde-4290-a24e-2bdd274be027_1516741729.jpg
			newsrc = src.replace(/.*hips\.hearstapps\.com\/([^/]+\.[^/]+)/, "http://$1");
			if (newsrc !== src)
				return newsrc;
			return src.replace(/\?[^/]*$/, "");
		}

		if (domain === "img.wennermedia.com") {
			// http://img.wennermedia.com/social/benson-fe365ae4-d2a2-461d-a6c1-9468b99177a2.jpg
			//   http://img.wennermedia.com/benson-fe365ae4-d2a2-461d-a6c1-9468b99177a2.jpg
			return src.replace(/:\/\/img\.wennermedia\.com\/[^?#]*\/([^/]*)$/, "://img.wennermedia.com/$1");
		}

		if (domain_nosub === "forbesimg.com" ||
			// https://imageio.forbes.com/specials-images/imageserve/622a0e83491f5556b07a7528/900x0.jpg?format=jpg&width=1200
			//   https://imageio.forbes.com/specials-images/imageserve/622a0e83491f5556b07a7528/0x0.jpg
			// https://imageio.forbes.com/specials-images/imageserve/622a0e83491f5556b07a7528/abcdefg/900x0.jpg?format=jpg&width=1200
			//   https://imageio.forbes.com/specials-images/imageserve/622a0e83491f5556b07a7528/abcdefg/0x0.jpg
			domain === "imageio.forbes.com") {
			// https://specials-images.forbesimg.com/imageserve/8988f42a4522469f9aeded6263f85183/960x0.jpg?fit=scale
			//   https://specials-images.forbesimg.com/imageserve/8988f42a4522469f9aeded6263f85183/0x0.jpg

			return {
				url: src
					.replace(/(\/imageserve\/+[0-9a-f]{10,}\/+(?:[^/]+\/+)?)[0-9]+x[0-9]+(\.[^/.?#]+)$/, "$10x0$2")
					.replace(/(\/imageserve\/+[0-9a-f]{10,}\/+(?:[^/]+\/+)?[0-9]+x[0-9]+\.[^/.?#]+)(?:[?#].*)?$/, "$1"),
				head_wrong_contentlength: true
			};

			/*return {
				url: src.replace(/\/[0-9]*x[0-9]*\.([^/.?]*)(\?.*)?/, "/0x0.$1"),
				head_wrong_contentlength: true
			};*/
		}

		if (domain === "pixel.nymag.com") {
			// https://pixel.nymag.com/imgs/thecut/slideshows/2015/02/oscars-red-carpet/batch-7/464162110_10.nocrop.w443.h670.2x.jpg
			//   http://pixel.nymag.com/imgs/thecut/slideshows/2015/02/oscars-red-carpet/batch-7/464162110_10.jpg
			// https://pixel.nymag.com/imgs/thecut/slideshows/2015/05/met-gala/23/472181460.o.jpg/a_4x-vertical.jpg
			//   https://pixel.nymag.com/imgs/thecut/slideshows/2015/05/met-gala/23/472181460.jpg -- 3280x4928
			// https://pixel.nymag.com/imgs/thecut/slideshows/lookbooks/lindsay-lohan/lindsay-lohan-2016-06-22.o.jpg/a_4x-vertical.jpg
			//   https://pixel.nymag.com/imgs/thecut/slideshows/lookbooks/lindsay-lohan/lindsay-lohan-2016-06-22.jpg
			return src
				.replace(/\/([^/.]*)(\.[^/]*)?\.([^/.]*)$/, "/$1.$3")
			//.replace(/\/slideshows\/(?:[0-9]+\/[0-9]+\/[^/]*\/[^/]*\/[0-9]+(?:_[0-9]+)?)(?:\.[^/]*)?(\.[^/.]*)\/[^/]*$/, "$1$2");
				.replace(/(\/slideshows\/.*\/[^/]*)\.[a-z](\.[^/.]*)\/[^/]*(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "pyxis.nymag.com") {
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/432
			// https://pyxis.nymag.com/v1/imgs/729/cc9/040edf97c4ef041ec1f48829be69842eed-24-Doja-Cat.rsquare.w330.jpg
			//   https://pyxis.nymag.com/v1/imgs/729/cc9/040edf97c4ef041ec1f48829be69842eed-24-Doja-Cat.rvertical.jpg
			//   https://pyxis.nymag.com/v1/imgs/729/cc9/040edf97c4ef041ec1f48829be69842eed-24-Doja-Cat.rdeep-vertical.jpg
			//   https://pyxis.nymag.com/v1/imgs/729/cc9/040edf97c4ef041ec1f48829be69842eed-24-Doja-Cat.w330.jpg
			//   https://pyxis.nymag.com/v1/imgs/729/cc9/040edf97c4ef041ec1f48829be69842eed-24-Doja-Cat.jpg
			// https://pyxis.nymag.com/v1/imgs/92c/88f/d4a2dede7120bc943ed95943b6ac5fe212-trump.rsquare-zoom.w100.jpg
			//   https://pyxis.nymag.com/v1/imgs/92c/88f/d4a2dede7120bc943ed95943b6ac5fe212-trump.jpg
			// https://pyxis.nymag.com/v1/imgs/5d3/ba9/44036335bf752271c445cd3ed12bf0c20d-02-LL-cool-J--WICLW-NEW.rhorizontal.w700.jpg
			//   https://pyxis.nymag.com/v1/imgs/5d3/ba9/44036335bf752271c445cd3ed12bf0c20d-02-LL-cool-J--WICLW-NEW.jpg
			// https://pyxis.nymag.com/v1/imgs/8b0/b62/f1212d7c71c261c4d2582d4e9bcbc155c4-steve-underwood.2x.rhorizontal.w700.jpg
			//   https://pyxis.nymag.com/v1/imgs/8b0/b62/f1212d7c71c261c4d2582d4e9bcbc155c4-steve-underwood.jpg
			// https://pyxis.nymag.com/v1/imgs/0ce/fd4/5fb0f096041f7bdbc2395f36c1f56ecf00-Sept30-Oct13-Testimonies.2x.rsocial.w600.jpg
			//   https://pyxis.nymag.com/v1/imgs/0ce/fd4/5fb0f096041f7bdbc2395f36c1f56ecf00-Sept30-Oct13-Testimonies.jpg
			return src.replace(/(\/v1\/+imgs\/+[0-9a-f]{3}\/+[0-9a-f]{3}\/+[0-9a-f]{10,}[^/.?#]*\.)(?:(?:r(?:deep-)?(?:square|horizontal|vertical|social)(?:-[a-z]+)?|[wh][0-9]+|[0-9]+x)\.){0,}([a-z]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "assets.nydailynews.com" ||
			// http://assets.nydailynews.com/polopoly_fs/1.1756087.1397507807!/img/httpImage/image.jpg_gen/derivatives/article_750/ccweb15s-2-web.jpg
			//   http://assets.nydailynews.com/polopoly_fs/1.1756087.1397507807!/img/httpImage/ccweb15s-2-web.jpg

			// http://static1.nydailynews.com/polopoly_fs/1.2229393.1432140395!/img/httpImage/image.jpg_gen/derivatives/article_400/lopez21f-2-web.jpg
			//   http://static1.nydailynews.com/polopoly_fs/1.2229393.1432140395!/img/httpImage/lopez21f-2-web.jpg
			(domain_nosub === "nydailynews.com" && domain.match(/^static[0-9]*\./)) ||
			// https://i.cbc.ca/1.4304676.1506225777!/fileImage/httpImage/edmonton-oilers.JPG?imwidth=720
			//   https://i.cbc.ca/1.4304676.1506225777!/fileImage/httpImage/edmonton-oilers.JPG
			domain === "i.cbc.ca" ||
			// http://cdn.newsday.com/polopoly_fs/1.6354403.1383272745!/httpImage/image.JPG_gen/derivatives/landscape_1280/image.JPG
			//   https://cdn.newsday.com/polopoly_fs/1.6354403.1383272745!/httpImage/image.JPG
			domain === "cdn.newsday.com" ||
			// https://www.stripes.com/polopoly_fs/1.545877.1536091200!/image/image.jpg_gen/derivatives/300x200/image.jpg
			//   https://www.stripes.com/polopoly_fs/1.545877.1536091200!/image/image.jpg
			domain_nowww === "stripes.com" ||
			// can't find any test case, disabling for now
			//domain.indexOf("www.thetimesnews.com") >= 0 ||
			// https://www.irishtimes.com/polopoly_fs/1.3616909.1535987603!/image/image.jpg_gen/derivatives/box_300_160/image.jpg
			//   https://www.irishtimes.com/polopoly_fs/1.3616909.1535987603!/image/image.jpg
			domain_nowww === "irishtimes.com" ||
			// https://www.ctvnews.ca/polopoly_fs/1.4071511.1535482319!/httpImage/image.jpg_gen/derivatives/landscape_300/image.jpg
			//   https://www.ctvnews.ca/polopoly_fs/1.4071511.1535482319!/httpImage/image.jpg
			domain_nowww === "ctvnews.ca" ||
			// http://www.lancashirelife.co.uk/polopoly_fs/1.1596808!/image/2417471173.jpg_gen/derivatives/landscape_490/2417471173.jpg
			//   http://www.lancashirelife.co.uk/polopoly_fs/1.1596808!/image/2417471173.jpg
			domain_nowww === "lancashirelife.co.uk" ||
			// http://images.archant.co.uk/polopoly_fs/1.5453783.1522228810!/image/image.jpg_gen/derivatives/landscape_630/image.jpg
			//   http://images.archant.co.uk/polopoly_fs/1.5453783.1522228810!/image/image.jpg
			domain === "images.archant.co.uk" ||
			// https://www.tsn.ca/polopoly_fs/1.432481!/fileimage/httpImage/image.jpg_gen/derivatives/default/connor-mcdavid.jpg -- doesn't work
			//domain === "www.tsn.ca" ||
			// http://images.glaciermedia.ca/polopoly_fs/1.23165389.1517899084!/fileImage/httpImage/image.jpg_gen/derivatives/landscape_804/edm110453004-jpg.jpg
			//   https://images.glaciermedia.ca/polopoly_fs/1.23165389.1517899084!/fileImage/httpImage/edm110453004-jpg.jpg
			domain === "images.glaciermedia.ca" ||
			// https://static.gulfnews.com/polopoly_fs/1.2168576!/image/3397099558.jpg_gen/derivatives/box_460346/3397099558.jpg
			//   https://static.gulfnews.com/polopoly_fs/1.2168576!/image/3397099558.jpg
			domain === "static.gulfnews.com" ||
			// cp24.com doesn't exist, only www.
			// https://www.cp24.com/polopoly_fs/1.3742970.1514935441!/httpImage/image.jpg_gen/derivatives/landscape_150/image.jpg
			//   https://www.cp24.com/polopoly_fs/1.3742970.1514935441!/httpImage/image.jpg
			domain === "www.cp24.com" ||
			// https://images.anandabazar.com/polopoly_fs/1.832890.1531660919!/image/image.jpg_gen/derivatives/box_375_281/image.jpg
			// https://www.anandabazar.com/polopoly_fs/1.832890!/image/image.jpg_gen/derivatives/landscape_390/image.jpg
			domain_nosub === "anandabazar.com" ||
			// http://www.islingtongazette.co.uk/polopoly_fs/1.957786!/image/89195513.jpg_gen/derivatives/landscape_490/89195513.jpg
			//   https://www.islingtongazette.co.uk/polopoly_fs/1.957786!/image/89195513.jpg
			domain_nowww === "islingtongazette.co.uk" ||
			// http://www.vrak.tv/polopoly_fs/1.2821149.1499878585!/image/maddie-ziegler-2017-getty-resize.jpg_gen/derivatives/vrak_816_459/maddie-ziegler-2017-getty-resize.jpg
			//   http://www.vrak.tv/polopoly_fs/1.2821149.1499878585!/image/maddie-ziegler-2017-getty-resize.jpg
			domain_nowww === "vrak.tv" ||
			// https://images.haaretz.co.il/polopoly_fs/1.5869852.1521547002!/image/2715066667.jpg_gen/derivatives/size_300xAuto/2715066667.jpg
			//   https://images.haaretz.co.il/polopoly_fs/1.5869852.1521547002!/image/2715066667.jpg
			domain === "images.haaretz.co.il" ||
			// https://www.ltu.se/cms_fs/1.172775!/image/Iceberg_in_the_Arctic_with_its_underside_exposed.jpg_gen/derivatives/landscape_fullwidth/Iceberg_in_the_Arctic_with_its_underside_exposed.jpg
			//   https://www.ltu.se/cms_fs/1.172775!/image/Iceberg_in_the_Arctic_with_its_underside_exposed.jpg
			domain_nowww === "ltu.se" ||
			// http://www.lanuovasardegna.it/polopoly_fs/1.17782426.1552123612!/httpImage/image.jpg_gen/derivatives/detail_558/image.jpg
			//   http://www.lanuovasardegna.it/polopoly_fs/1.17782426.1552123612!/httpImage/image.jpg
			domain_nowww === "lanuovasardegna.it" ||
			// https://www.huntspost.co.uk/polopoly_fs/1.5817586.1544697986!/image/image.jpg_gen/derivatives/landscape_630/image.jpg
			//   https://www.huntspost.co.uk/polopoly_fs/1.5817586.1544697986!/image/image.jpg
			domain_nowww === "huntspost.co.uk" ||
			// https://rdsimages.cookieless.ca/polopoly_fs/1.17234751.1686396580!/img/httpImage/image.jpg_gen/derivatives/box_385x250/image.jpg
			//   https://rdsimages.cookieless.ca/polopoly_fs/1.17234751.1686396580!/img/httpImage/image.jpg
			domain == "rdsimages.cookieless.ca" ||
			// thanks to fedesk on discord
			// https://www.dagsavisen.no/polopoly_fs/1.962466.1493970974!/image/image.jpg_gen/derivatives/169_980/image.jpg -- doesn't work
			//domain_nowww === "dagsavisen.no" ||
			// https://daqui.opopular.com.br/polopoly_fs/1.1791604.1557142930!/image/image.jpg_gen/derivatives/landscape_420/image.jpg
			//domain_nosub === "opopular.com.br" ||
			// http://p1014p.quotidiano.net/polopoly_fs/1.3245998.1499154460!/httpImage/image.JPG_gen/derivatives/gallery_800/image.JPG -- doesn't work
			//(domain_nosub === "quotidiano.net" && string_indexof(src, "/polopoly_fs/") >= 0) ||
			// http://www.edp24.co.uk/polopoly_fs/1.5540960!/image/image.jpg_gen/derivatives/landscape_630/image.jpg
			//   http://www.edp24.co.uk/polopoly_fs/1.5540960!/image/image.jpg
			domain_nowww === "edp24.co.uk") {
			newsrc = src
				.replace(/(\/[^/.]*\.[^_/.]*)_gen\/+derivatives\/+[^/]*\/+/, "/")
				.replace(/\/image\.[^_/]*_gen\/+derivatives\/+[^/]*\//, "/")
				.replace(/\/image\/+[^_/]*_gen\/+derivatives\/+[^/]*\//, "/image/");
			if (newsrc !== src) {
				return newsrc.replace(/\?.*/, "");
			}
			// doesn't work for all:
			// https://ludovica.opopular.com.br/polopoly_fs/1.850210.1431538905!/image/image.jpg_gen/derivatives/landscape_800/image.jpg
		}

		if (domain === "static.gulfnews.com") {
			return {
				url: src,
				head_wrong_contenttype: true
			};
		}

		if (domain_nowww === "tsn.ca") {
			// thanks to roi:
			// https://www.tsn.ca/content/dam/tsn/en/home/images/2023/4/8/bo-bichette-1-1942690-1680929834272.jpeg/jcr:content/renditions/cq5dam.thumbnail.860.860.png
			//   https://www.tsn.ca/content/dam/tsn/en/home/images/2023/4/8/bo-bichette-1-1942690-1680929834272.jpeg
			newsrc = src.replace(/(\/images\/+[0-9]{4}\/+(?:[0-9]{1,2}\/+){2}[^/]+)\/+jcr:.*/, "$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "www.tsn.ca") {
			// nowww doesn't exist
			// https://www.tsn.ca/polopoly_fs/1.738832!/fileimage/httpImage/image.jpg_gen/derivatives/landscape_620/kyle-fuller.jpg
			//   https://www.tsn.ca/polopoly_fs/1.738832!/fileimage/httpImage/image.jpg_gen/derivatives/default/kyle-fuller.jpg
			return src.replace(/(\/image\.[^_/]*_gen\/+derivatives\/+)[^/]*\//, "$1default/");
		}

		if ((domain_nosub === "bbci.co.uk" ||
			 // thanks to Anamon on github: https://github.com/qsniyg/maxurl/issues/595
			 // https://ichef.bbc.co.uk/images/ic/96x96/p01bqjml.jpg
			 //   https://ichef.bbc.co.uk/images/ic/raw/p01bqjml.jpg
			 domain_nosub === "bbc.co.uk") && domain.match(/^ichef(?:-[0-9]*)?\./)) {
			newsrc = src.replace(/\.jpg\.webp([?#].*)?$/, ".jpg$1");
			if (newsrc !== src) return newsrc;

			newsrc = src.replace(/\/[0-9]+_[0-9]+\//, "/original/");
			if (newsrc !== src)
				return newsrc;

			// http://ichef.bbci.co.uk/corporate2/images/width/live/p0/55/fh/p055fhy8.jpg/624
			//   http://ichef.bbci.co.uk/corporate2/images/width/live/p0/55/fh/p055fhy8.jpg/0
			newsrc = src.replace(/(\.[^/.]*)\/[0-9]+$/, "$1/0");
			if (newsrc !== src)
				return newsrc;

			// https://ichef.bbci.co.uk/images/ic/960x540/p03jg3g8.jpg
			//   https://ichef.bbci.co.uk/images/ic/raw/p03jg3g8.jpg
			// https://ichef.bbci.co.uk/images/ic/720x405/p0517py6.jpg
			//   https://ichef.bbci.co.uk/images/ic/raw/p0517py6.jpg
			// https://ichef.bbci.co.uk/images/ic/1920xn/p0698c1x.jpg
			//   https://ichef.bbci.co.uk/images/ic/raw/p0698c1x.jpg
			// http://ichef.bbci.co.uk/images/ic/144x81/p02cbtdd.jpg
			//   http://ichef.bbci.co.uk/images/ic/raw/p02cbtdd.jpg
			// https://ichef.bbci.co.uk/images/ic/736x414_b/p0fhb5qf.jpg
			//   https://ichef.bbci.co.uk/images/ic/raw/p0fhb5qf.jpg
			newsrc = src.replace(/(:\/\/[^/]*)\/images\/ic\/[0-9n]+x[0-9n]+(?:_[a-z])?\//, "$1/images/ic/raw/");
			if (newsrc !== src)
				return newsrc;

			// http://ichef.bbci.co.uk/wwhp/999/cpsprodpb/7432/production/_99764792_8e240163-62f5-4b0f-bf90-6def2cdc883b.jpg
			//   http://ichef.bbci.co.uk/news/999/cpsprodpb/7432/production/_99764792_8e240163-62f5-4b0f-bf90-6def2cdc883b.jpg
			//   https://c.files.bbci.co.uk/7432/production/_99764792_8e240163-62f5-4b0f-bf90-6def2cdc883b.jpg
			// https://ichef.bbci.co.uk/news/999/media/images/79831000/jpg/_79831755_hewer2_bbc.jpg
			//   https://news.bbcimg.co.uk/media/images/79831000/jpg/_79831755_hewer2_bbc.jpg
			// https://ichef-1.bbci.co.uk/news/235/cpsprodpb/A771/production/_99756824_trumpmueller.jpg
			//   https://c.files.bbci.co.uk/A771/production/_99756824_trumpmueller.jpg
			// http://ichef.bbci.co.uk/news/999/mcs/media/images/79839000/jpg/_79839098_bbcnickhewer.jpg
			//   http://news.bbcimg.co.uk/media/images/79839000/jpg/_79839098_bbcnickhewer.jpg
			// http://news.bbcimg.co.uk/news/special/2016/newsspec_15380/img/trump_annotated_976v2.png
			// http://news.bbcimg.co.uk/news/special/2017/newsspec_17595/img/hurricane_globe_v6.gif
			// http://ichef.bbci.co.uk/news/976/cpsprodpb/11B74/production/_88046527_getty_ora.jpg
			//   http://news.bbcimg.co.uk/media/images/88046527/jpg/_88046527_getty_ora.jpg -- not found
			//   http://c.files.bbci.co.uk/11B74/production/_88046527_getty_ora.jpg
			// http://news.bbcimg.co.uk/media/images/74104000/jpg/_74104195_6671990f-809f-432b-8699-7b5b92d053a0.jpg
			// http://news.bbcimg.co.uk/media/images/61015000/jpg/_61015960_3a79d215-7772-4ec1-b157-1655c66793ad.jpg
			// http://news.bbcimg.co.uk/news/special/2016/newsspec_12799/content/full-width/common/img/italy_graves_intro_1400.jpg
			// https://ichef.bbci.co.uk/onesport/cps/800/cpsprodpb/41F9/production/_98998861_ragnbone.jpg
			// http://c.files.bbci.co.uk/28EE/production/_98587401_afoty_624x351_player5.jpg
			// https://ichef.bbci.co.uk/live-experience/cps/800/cpsprodpb/vivo/live/images/2018/5/29/433b3e44-09ac-4366-a535-c1fbd8bc9cde.jpg
			//   https://c.files.bbci.co.uk/vivo/live/images/2018/5/29/433b3e44-09ac-4366-a535-c1fbd8bc9cde.jpg
			// https://ichef.bbci.co.uk/food/ic/food_16x9_832/recipes/irish_fish_chowder_with_08587_16x9.jpg -- 832x468
			//   https://food-images.files.bbci.co.uk/food/recipes/irish_fish_chowder_with_08587_16x9.jpg -- 5341x3004
			//
			//
			// larger images:
			// https://news.files.bbci.co.uk/include/shorthand/40714/media/nk_family_tree_shorthand_la.png -- 2560x1440
			// http://www.bbc.co.uk/staticarchive/3950fd5e40621b9769250aecda90d060da592198.jpg -- 602x357
			//   http://www.bbc.co.uk/sing/hallelujah/images/bbc_sing-hallelujah-london_fullsize.jpg -- 5616x3329
			// http://ichef.bbci.co.uk/images/ic/raw/p05k91nn.png -- 4001x3438
			//
			// subdomains for files.bbci.co.uk:
			//   a
			//   b
			//   c
			//   nav
			//   news
			//   childrens-binary
			//   search
			//   m
			//     https://m.files.bbci.co.uk/modules/bbc-morph-sport-opengraph/1.1.1/images/bbc-sport-logo.png
			//   guides
			//   food
			//   podcasts
			//   mybbc
			//   bbcthree-web-cdn
			//     https://bbcthree-web-cdn.files.bbci.co.uk/bbcthree-web-server/2.9.0-257.x86_64/images/share-best-of.png
			//   bam
			//     https://bam.files.bbci.co.uk/bam/live/content/zm8497h/large
			//     https://bam.files.bbci.co.uk/bam/live/content/zm8497h/small -- different (but related) image
			// subdomains for bbci.co.uk:
			//   static -- used for js etc. sometimes for images
			//   feeds -- used for rss feeds
			//   downloads
			//     http://downloads.bbc.co.uk/commissioning/site/CBBC_New_Logo_RGB.png
			//   android
			//   r
			//   [blank]
			//   www
			//   emp
			//
			// different cropping:
			// https://ichef.bbci.co.uk/news/999/cpsprodpb/01C8/production/_99765400_hi039575218.jpg
			// https://ichef.bbci.co.uk/news/999/cpsprodpb/DB2A/production/_99760165_hi039575218.jpg
			// http://news.bbcimg.co.uk/media/images/99765000/jpg/_99765400_hi039575218.jpg - doesn't work
			newsrc = src.replace(/.*\.bbci\.co\.uk\/news\/[0-9]*\/(?:[^/]*\/)?media\//, "http://news.bbcimg.co.uk/media/");
			if (newsrc !== src)
				return newsrc;

			newsrc = src.replace(/:\/\/[^/]*\/food\/ic\/[^/]*\//, "://food-images.files.bbci.co.uk/food/");
			if (newsrc !== src)
				return newsrc;

			// http://ichef.bbci.co.uk/naturelibrary/images/ic/credit/640x395/h/hu/hummingbird/hummingbird_1.jpg
			//   http://ichef.bbci.co.uk/naturelibrary/images/ic/640x395/h/hu/hummingbird/hummingbird_1.jpg
			newsrc = src.replace(/\/images\/ic\/credit(\/[0-9]+x[0-9]+\/)/, "/images/ic$1");
			if (newsrc !== src)
				return newsrc;

			newsrc = src.replace(/.*\/cpsprodpb\//, "https://c.files.bbci.co.uk/");
			if (newsrc !== src)
				return newsrc;

			// https://ichef.bbci.co.uk/news/1024/branded_portuguese/D518/production/_102525545_mediaitem102524830.jpg
			//   https://c.files.bbci.co.uk/D518/production/_102525545_mediaitem102524830.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/news\/[0-9]+\/[^/]*\//, "https://c.files.bbci.co.uk/");
			if (newsrc !== src)
				return newsrc;

			/*var origsize = src.match(/\.bbci\.co\.uk\/[^/]*\/([0-9]*)\//);
			if (origsize && false) { // scales up
				var size = parseInt(origsize[1], 10);
				if (size < 2048) {
					return src.replace(/(\.bbci\.co\.uk\/[^/]*)\/[0-9]*\//, "$1/2048/");
				}
			}*/
		}

		if (domain === "ychef.files.bbci.co.uk") {
			// thanks to fedesk on discord
			// https://ychef.files.bbci.co.uk/1600x900/p04wsy0d.webp
			//   https://ychef.files.bbci.co.uk/original/p04wsy0d.webp
			return src.replace(/(:\/\/[^/]+\/+)[0-9]+x[0-9]+\/+/, "$1original/");
		}

		if (domain_nowww === "bbc.co.uk") {
			// https://www.bbc.co.uk/rd/images/dynamic/W1siZmYiLCJwdWJsaWMvcmQvc2l0ZXMvNTAzMzVmZjM3MGI1YzI2MmFmMDAwMDA0L2NvbnRlbnRfZW50cnk1MDRlMTgxNTcwYjVjMjBhMGMwMDEzNDQvNTIxY2NmMTJhY2ZiYWIwZjRiMGE2ZGI3L2ZpbGVzL2Fic3RyYWN0LTE0MDg5OC0xOTIweDEwODAuanBnIl0sWyJwIiwidGh1bWIiLCIxMjQ4eDcwMiMiXV0/abstract-140898-1920x1080.jpg?sha=807ac90a498ad062
			//   https://www.bbc.co.uk/rd/sites/50335ff370b5c262af000004/content_entry504e181570b5c20a0c001344/521ccf12acfbab0f4b0a6db7/files/abstract-140898-1920x1080.jpg
			match = src.match(/\/rd\/+images\/+dynamic\/+([^/.]{50,})\/+/);
			if (match) {
				var decoded = base64_decode(match[1]);
				var parsed = JSON_parse(decoded);
				for (let i = 0; i < parsed.length; i++) {
					if (!parsed[i].length) continue;

					if (parsed[i][0] === "ff") {
						var internal_filename = parsed[i][1];
						if (string_indexof(internal_filename, "public/") === 0) {
							return "https://www.bbc.co.uk/" + internal_filename.substr(7);
						} else {
							break;
						}
					}
				}

				console_error("Unhandled URL", parsed);
			}
		}

		if (domain === "amp.thisisinsider.com" ||
			// https://amp.insider.com/images/5c3e320e5241470201598c93-750-562.jpg
			//   https://static2.insider.com/image/5c3e320e5241470201598c93/
			domain === "amp.insider.com" ||
			domain === "amp.businessinsider.com") {
			// nano defender disables javascript on here, so redirect via userscript doesn't work
			// https://amp.thisisinsider.com/images/58c2c3d580c5ac1f008b47dc-960-1545.jpg
			//   https://static2.thisisinsider.com/image/58c2c3d580c5ac1f008b47dc/
			// https://amp.businessinsider.com/images/56dc9a3052bcd028008b4703-750-887.jpg
			//   https://static2.thisisinsider.com/image/56dc9a3052bcd028008b4703/
			//   https://static2.businessinsider.com/image/56dc9a3052bcd028008b4703/
			// https://amp.businessinsider.com/images/5a383bcc7101ad309463675a-480-320.jpg
			//   https://static2.thisisinsider.com/image/5a383bcc7101ad309463675a/ -- doesn't work
			//   https://static2.businessinsider.com/image/5a383bcc7101ad309463675a.jpg
			//   https://static2.businessinsider.com/image/5a383bcc7101ad309463675a/
			// https://amp.businessinsider.com/images/59c5495519d2f523008b4c91-750-375.jpg
			//   https://static2.businessinsider.com/image/59c5495519d2f523008b4c91/
			// https://amp.businessinsider.com/images/58b36d34dd0895f4328b4c39-750-1125.jpg
			//   https://static2.businessinsider.com/image/58b36d34dd0895f4328b4c39/
			// https://amp.businessinsider.com/images/50be4860ecad04c541000001-750-562.jpg
			//   https://static2.businessinsider.com/image/50be4860ecad04c541000001/
			return src.replace(/^[a-z]+:\/\/amp\.([^/]*)\/images\/([a-f0-9]+)-[0-9]+(?:-[0-9]+)?(\.[^/.]*)$/, "https://static2.$1/image/$2/");
		}

		if ((domain_nosub === "businessinsider.com" ||
			 // https://static1.insider.com/image/5b52591b51dfbe21008b4592-400-300/gomez-was-all-smiles-at-the-premiere-of-hotel-transylvania-3-summer-vacation-in-june-2018.jpg
			 //   https://static1.insider.com/image/5b52591b51dfbe21008b4592/
			 domain_nosub === "insider.com" ||
			 domain_nosub === "thisisinsider.com") &&
			domain.match(/^static[0-9]*\./)) {
			// http://static2.thisisinsider.com/image/58c2c3d580c5ac1f008b47dc-200/
			//   https://static2.thisisinsider.com/image/58c2c3d580c5ac1f008b47dc/
			// http://static6.uk.businessinsider.com/image/58ae09acdd089506308b4ad1-2377/undefined
			//   http://static6.uk.businessinsider.com/image/58ae09acdd089506308b4ad1/undefined
			//   http://static6.uk.businessinsider.com/image/58ae09acdd089506308b4ad1/
			// http://static.thisisinsider.com/image/59f0985d9091c139008b45da-750.jpg
			//   http://static.thisisinsider.com/image/59f0985d9091c139008b45da.jpg
			//return src.replace(/(\/image\/[^/]*)-[0-9]*(\/[^/]*|\.[^/.]*)$/, "$1$2");
			//return src.replace(/\/image\/([^-/]*)[^/]*\//, "/image/$1/");
			return src.replace(/(\/image\/[0-9a-f]+)(?:-[^/]*|\.[^/]*)?(?:\/.*)?$/, "$1/");
		}

		if (domain === "media.nbcwashington.com" ||
			// https://media.nbcnewyork.com/images/653*367/AP_18012240030020.jpg
			domain === "media.nbcnewyork.com" ||
			// http://media.graytvinc.com/images/810*455/TAYLOR+SWIFT19.jpg
			domain === "media.graytvinc.com" ||
			// https://media.telemundochicago.com/images/600*300/tlmd_leslie_grace_llega_a_radio_disney.jpg
			domain === "media.telemundochicago.com" ||
			// https://media.nbcdfw.com/images/652*367/calboy+picture.JPG
			//   https://media.nbcdfw.com/images/calboy+picture.JPG
			domain === "media.nbcdfw.com" ||
			// https://media.nbcphiladelphia.com/images/1200*675/600-Year-Old-Tree_Carl.jpg
			domain === "media.nbcphiladelphia.com" ||
			// https://media.nbcsandiego.com/images/652*367/NBC+Article+Graphic.jpg
			domain === "media.nbcsandiego.com" ||
			// http://media.heartlandtv.com/images/652*367/NBC.jpg
			domain === "media.heartlandtv.com" ||
			// https://media.nbcmiami.com/images/652*367/120718+roku+nbc+6.jpg
			domain === "media.nbcmiami.com" ||
			// https://media.nbcconnecticut.com/images/652*367/softball+team+nbc+connecticut.jpg
			domain === "media.nbcconnecticut.com" ||
			// https://media.nbclosangeles.com/images/652*367/Chris-Hardwick-NBC-sexual-assault-review.jpg
			domain === "media.nbclosangeles.com" ||
			// https://media.nbcboston.com/images/578*368/7am+weather+nbc+thumb.JPG
			domain === "media.nbcboston.com" ||
			// https://media.nbcbayarea.com/images/652*397/FoC+2018+nbc.png
			domain === "media.nbcbayarea.com" ||
			// https://media.winnipegfreepress.com/images/390*260/AVE201345020_high.jpg
			domain === "media.winnipegfreepress.com" ||
			// https://media.brandonsun.com/images/648*432/AVE201345020_high.jpg
			domain === "media.brandonsun.com" ||
			// https://media.necn.com/images/652*367/Anne4.jpg
			domain === "media.necn.com" ||
			// https://media.telemundoareadelabahia.com/images/970*1393/GettyImages-865603188-tlmd-00.jpg
			domain === "media.telemundoareadelabahia.com" ||
			// https://media.nbcchicago.com/images/652*367/t-swift-cover.jpg
			domain === "media.nbcchicago.com") {
			return src.replace(/\/images\/+[0-9]+\*[0-9]+\//, "/images/");
		}

		if (domain_nowww === "bet.com") {
			// https://www.bet.com/style/living/2018/01/29/chrissy-teigen-gender-reveal/_jcr_content/squareImage.featured1x1.dimg/__1517248018208__1517242933377/012918-style-chrissy-teigen-gender-reveal.jpg
			//   https://www.bet.com/style/living/2018/01/29/chrissy-teigen-gender-reveal/_jcr_content/bodycopycontainer/embedded_image_0/image.custom0fx0fx0xcrop.dimg/__1517248018208__1517242933377/012918-style-chrissy-teigen-gender-reveal.jpg
			// https://www.bet.com/style/beauty/2018/01/30/cheap-beauty-products-celebrities-use/_jcr_content/bodycopycontainer/listiclecontainer/listicleitem_3/embedded_image/image.custom1200x1581.dimg/__1516987722286__1516987306610/012618-style-yara-shahidi-cheap-beauty-products.jpg
			// https://www.bet.com/style/fashion/2018/01/28/see-all-the-looks-from-the-grammy-s-2018-red-carpet/_jcr_content/squareImage.featuredlist.dimg/__1517191072539__1517189173163/012818-style-grammy-looks-1.jpg
			// https://www.bet.com/style/fashion/2018/01/28/see-rihanna-slay-a-patent-trench-as-she-accepted-a-grammy-award-/_jcr_content/image.ampheroimage.dimg/__1517189314895__1517188008118/012818-style-see-rihanna-slay-a-patent-trench-as-she-accepted-a-grammy-award.jpg
			// https://www.bet.com/style/living/2018/02/01/leslie-jones-meagan-good-body-positivity-black-girl-magic/_jcr_content/squareImage.relatedinline1x1.dimg/__1517510003204__1517501332582/020118-Celebs-Leslie-Jones-Megan-Good.jpg
			// https://www.bet.com/style/fashion/2018/01/31/jennifer-lopez-shows-off-toned-legs/_jcr_content/image.feedcontainer.dimg/__1517429162639__1517412507314/013118-style-jennifer-lopez-shows-off-toned-legs-3.jpg
			return src
				.replace(/\/(_jcr_content.*?\/[^/]*)\.custom[0-9]+fx[0-9]+fx[0-9]+xcrop\.([^/]*)\//, "/$1.custom0fx0fx0xcrop.$2/")
				.replace(/\/(_jcr_content.*?\/[^/]*)\.custom[0-9]+x[0-9]+\.([^/]*)\//, "/$1.custom0fx0fx0xcrop.$2/")
				.replace(/\/(_jcr_content.*?\/[^/]*)\.featured[0-9]+x[0-9]+\.([^/]*)\//, "/$1.custom0fx0fx0xcrop.$2/")
				.replace(/\/(_jcr_content.*?\/[^/]*)\.featuredlist\.([^/]*)\//, "/$1.custom0fx0fx0xcrop.$2/")
				.replace(/\/(_jcr_content.*?\/[^/]*)\.ampheroimage\.([^/]*)\//, "/$1.custom0fx0fx0xcrop.$2/")
				.replace(/\/(_jcr_content.*?\/[^/]*)\.feedcontainer\.([^/]*)\//, "/$1.custom0fx0fx0xcrop.$2/")
				.replace(/\/(_jcr_content.*?\/[^/]*)\.[^/.]*\.([^/]*)\//, "/$1.custom0fx0fx0xcrop.$2/")
				.replace(/\/(_jcr_content.*?\/[^/]*)\.relatedinline[0-9]+x[0-9]+\.([^/]*)\//, "/$1.custom0fx0fx0xcrop.$2/");
				//.replace(/\/_jcr_content\/.*(\/[^/]*)$/, "/_jcr_content/bodycopycontainer/embedded_image_0/image.custom0fx0fx0xcrop.dimg/$1");
		}

		if (domain_nosub === "cbsistatic.com" && /^gamefaqs[0-9]*\./.test(domain)) {
			// thanks to keophcp on github: https://github.com/qsniyg/maxurl/issues/519
			// https://gamefaqs1.cbsistatic.com/screen/thumb/5/0/8/436508.jpg
			//   https://gamefaqs1.cbsistatic.com/screen/full/5/0/8/436508.jpg
			newsrc = src.replace(/(:\/\/[^/]+\/+)screen\/+thumb\/+/, "$1screen/full/");
			if (newsrc !== src)
				return {
					url: newsrc,
					head_wrong_contentlength: true
				};
		}

		if (domain_nosub === "cbsistatic.com" && /cnet[0-9]*\./.test(domain)) {
			// thumbor
			// https://cnet3.cbsistatic.com/img/FK8CGJDejVV-sEaEJZ2nXW8eM3k=/1600x900/2017/03/15/a2595ca5-43fc-4508-9c36-745b04dd49a1/coco2.jpg
			//   https://cnet3.cbsistatic.com/img/2017/03/15/a2595ca5-43fc-4508-9c36-745b04dd49a1/coco2.jpg
			// https://cnet1.cbsistatic.com/img/nCMng7w4iuS_uxiPM4wghBjtQBg=/81x398:2438x2724/0x527/2017/05/08/9f832785-f506-4ec3-b175-f85723d123dc/ew-opener.jpg
			//   https://cnet1.cbsistatic.com/img/2017/05/08/9f832785-f506-4ec3-b175-f85723d123dc/ew-opener.jpg
			// https://cnet1.cbsistatic.com/img/DIHwjRMV2yd28ex651bXyFnHQmE=/2017/12/27/3397f9e3-e1b9-4630-8e14-451a97546d32/dsc01630.jpg
			//   https://cnet1.cbsistatic.com/img/2017/12/27/3397f9e3-e1b9-4630-8e14-451a97546d32/dsc01630.jpg
			// https://cnet1.cbsistatic.com/img/7WiR6Xi_Xc5FW2s5N7TdDmG6qLM=/fit-in/570x0/2017/12/12/c2363e6d-59e7-4027-9fda-7a5c467122fe/falcon-tie-finn.gif
			//   https://cnet1.cbsistatic.com/img/2017/12/12/c2363e6d-59e7-4027-9fda-7a5c467122fe/falcon-tie-finn.gif
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+img\/+([^/]+=\/+)/, "/$1");
			if (newsrc !== src) {
				return urljoin("https://" + domain + "/img/", common_functions["get_thumbor_url"](newsrc), true);
			}
		}

		if (domain_nosub === "cbsistatic.com" ||
			// thanks to roi:
			// https://assets1.cbsnewsstatic.com/hub/i/r/2023/02/24/f43bec99-5bc9-4f76-a2f5-c62e4bf30f43/thumbnail/640x360/54115f548f93acfcecdeddfea0a7f9eb/gettyimages-1247322077.jpg
			//   https://assets1.cbsnewsstatic.com/hub/i/r/2023/02/24/f43bec99-5bc9-4f76-a2f5-c62e4bf30f43/54115f548f93acfcecdeddfea0a7f9eb/gettyimages-1247322077.jpg
			domain_nosub === "cbsnewsstatic.com" ||
			// http://cimg.tvgcdn.net/i/r/2016/07/22/56a5114b-3639-4f72-8eac-12f22575c2e2/resize/900x600/2d6504f572963ac75616d4ef74dcc162/160722-news-rorys-boyfriends.jpg
			//   http://cimg.tvgcdn.net/i/r/2016/07/22/56a5114b-3639-4f72-8eac-12f22575c2e2/2d6504f572963ac75616d4ef74dcc162/160722-news-rorys-boyfriends.jpg
			domain === "cimg.tvgcdn.net") {
			// http://cbsnews1.cbsistatic.com/hub/i/r/2015/05/21/6836ca67-f2b8-48ae-ac4e-807d36830612/thumbnail/620x350/eca9fadfb6373619ab9174af67663e21/justin-bieber-and-james-cordon.jpg
			//   http://cbsnews1.cbsistatic.com/hub/i/r/2015/05/21/6836ca67-f2b8-48ae-ac4e-807d36830612/eca9fadfb6373619ab9174af67663e21/justin-bieber-and-james-cordon.jpg
			// https://dl1.cbsistatic.com/i/r/2018/04/11/0b04d1c3-90d6-413f-9ac9-5fafeac65caa/thumbnail/170x134/3d7ad3678a8c4a7b72d72a8820e3c2f0/felicity-jones.jpg
			//   https://dl1.cbsistatic.com/i/r/2018/04/11/0b04d1c3-90d6-413f-9ac9-5fafeac65caa/3d7ad3678a8c4a7b72d72a8820e3c2f0/felicity-jones.jpg
			// https://dl1.cbsistatic.com/i/r/2018/04/11/0b04d1c3-90d6-413f-9ac9-5fafeac65caa/thumbnail/170x134/3d7ad3678a8c4a7b72d72a8820e3c2f0/felicity-jones.jpg
			//   https://dl1.cbsistatic.com/i/r/2018/04/11/0b04d1c3-90d6-413f-9ac9-5fafeac65caa/3d7ad3678a8c4a7b72d72a8820e3c2f0/felicity-jones.jpg
			// https://zdnet1.cbsistatic.com/hub/i/r/2018/01/12/2dcbd29f-f3fa-4283-b11a-e163c03bbc08/resize/770xauto/99721c4b340e885277343e7f6cb4b6c3/ndcboom1-alt.jpg
			//   https://zdnet1.cbsistatic.com/hub/i/r/2018/01/12/2dcbd29f-f3fa-4283-b11a-e163c03bbc08/99721c4b340e885277343e7f6cb4b6c3/ndcboom1-alt.jpg
			// https://zdnet4.cbsistatic.com/hub/i/r/2018/02/06/1eef8bb5-4034-4e88-b356-ff9b035778d9/thumbnail/170x128/122ea3f0f9d0c3b86c23c3ff362ad252/brooke-cagle-195777.jpg
			//   https://zdnet4.cbsistatic.com/hub/i/r/2018/02/06/1eef8bb5-4034-4e88-b356-ff9b035778d9/122ea3f0f9d0c3b86c23c3ff362ad252/brooke-cagle-195777.jpg
			// https://sportshub.cbsistatic.com/i/r/2017/12/07/49119fbe-9e96-49a6-8c87-503f699477f2/thumbnail/770x433/9994a568cadde287e9e29ef38cf2ef36/demarcus-cousins.jpg
			//   https://sportshub.cbsistatic.com/i/r/2017/12/07/49119fbe-9e96-49a6-8c87-503f699477f2/9994a568cadde287e9e29ef38cf2ef36/demarcus-cousins.jpg

			newsrc = src
				.replace(/\/resize\/[0-9a-z]*x[0-9a-z]*\//, "/")
				.replace(/\/crop\/[^/]*\//, "/")
				.replace(/\/thumbnail\/[^/]*\//, "/");
			if (newsrc !== src) {
				return {
					url: newsrc,
					head_wrong_contentlength: true
				};
			}
		}

		if ((domain_nosub === "cbsstatic.com" &&
			domain.match(/wwwimage[0-9]*(?:-secure)?\.cbsstatic\.com/)) ||
			// http://wwwimage2.cbsstatic.com/thumbnails/photos/w370/blog/abd70cf777ca6a77_marissa_golds_guide_1920.jpg
			//   http://wwwimage2.cbsstatic.com/base/files/blog/abd70cf777ca6a77_marissa_golds_guide_1920.jpg
			// http://wwwimage.cbsstatic.com/thumbnails/photos/files/asset/10/00/56/47/927857742dd31df2_dianes_world.jpg
			//   http://wwwimage.cbsstatic.com/base/files/asset/10/00/56/47/927857742dd31df2_dianes_world.jpg
			// http://wwwimage4.cbsstatic.com/thumbnails/videos/w270/CBS_Production_Entertainment_VMS/761/811/2018/02/06/1145406531709/CBS_SCORPION_416_IMAGE_NO_LOGO_thumb_Master.jpg
			//   http://wwwimage4.cbsstatic.com/thumbnails/videos/files/CBS_Production_Entertainment_VMS/761/811/2018/02/06/1145406531709/CBS_SCORPION_416_IMAGE_NO_LOGO_thumb_Master.jpg
			// http://wwwimage2.cbsstatic.com/thumbnails/photos/770xh/danielle_big_brother_over_the_top.jpg
			// http://wwwimage2.cbsstatic.com/thumbnails/photos/100q/danielle_big_brother_over_the_top.jpg
			// https://wwwimage-secure.cbsstatic.com/thumbnails/photos/770xh/610a45ac16030991_lady-gaga-2-red-carpet-2018-grammy-awards.jpg
			//
			// error:
			//Not enough parameters were given.
			//
			//Available parameters:
			//w = Maximum width
			//h = Maximum height
			//c = Crop ratio (width:height)
			//q = Quality (0-100)
			//b = Background fill color (RRGGBB or RGB)
			//p = Progressive (0 or 1)
			//
			//Example usage:
			// http://wwwimage2.cbsstatic.com/thumbnails/photos/w300-h300-c1:1/path/to/image.jpg
			(domain_nosub === "pplusstatic.com" &&
			domain.match(/wwwimage[0-9]*(?:-(?:secure|us))?\.pplusstatic\.com/))) {
			// thanks to antiops on github: https://github.com/qsniyg/maxurl/issues/1063
			// https://wwwimage-us.pplusstatic.com/thumbnails/photos/w370-q80/movie_asset/59/56/70/pof_salone_poster_1400x2100_nb.jpg
			//   https://wwwimage-us.pplusstatic.com/thumbnails/photos/q100/movie_asset/59/56/70/pof_salone_poster_1400x2100_nb.jpg
			//   https://wwwimage-us.pplusstatic.com/base/files/movie_asset/59/56/70/pof_salone_poster_1400x2100_nb.jpg
			// https://wwwimage-us.pplusstatic.com/thumbnails/photos/w1920-q80/movie_asset/59/56/72/pof_salone_ott_3840x2160.jpg
			//   https://wwwimage-us.pplusstatic.com/thumbnails/photos/q100/movie_asset/59/56/72/pof_salone_ott_3840x2160.jpg
			//   https://wwwimage-us.pplusstatic.com/base/files/movie_asset/59/56/72/pof_salone_ott_3840x2160.jpg
			return src
				//.replace(/\/thumbnails\/([^/]*)\/[wh][0-9]*\//, "/thumbnails/$1/files/")
				.replace(/\/thumbnails\/([^/]*)\/[-a-z0-9:]*\//, "/thumbnails/$1/files/")
				.replace("/thumbnails/photos/files/", "/base/files/");
		}

		if (domain === "api.fidji.lefigaro.fr") {
			// http://api.fidji.lefigaro.fr/media/ext/1900x/madame.lefigaro.fr/sites/default/files/img/2015/01/defile-valentino-automne-hiver-2015-2016-paris-look-46.jpg
			//   http://i.f1g.fr/media/ext/1900x/madame.lefigaro.fr/sites/default/files/img/2015/01/defile-valentino-automne-hiver-2015-2016-paris-look-46.jpg
			// http://api.fidji.lefigaro.fr/media/ext/1900x/img.tvmag.lefigaro.fr/ImCon/Arti/89615/PHO0ce17170-86bd-11e5-81ca-efc6b4cd613e-805x453.jpg
			//   http://i.f1g.fr/media/ext/1900x/img.tvmag.lefigaro.fr/ImCon/Arti/89615/PHO0ce17170-86bd-11e5-81ca-efc6b4cd613e-805x453.jpg
			return src.replace("://api.fidji.lefigaro.fr/", "://i.f1g.fr/");
		}

		if (domain === "i.f1g.fr") {
			newsrc = src.replace(/.*i\.f1g\.fr\/media\/ext\/[^/]*\//, "http://");
			var newdomain = newsrc.replace(/^http:\/\/([^/]*)\/.*/, "$1");
			if (newsrc !== src &&
				newdomain !== "img.tvmag.lefigaro.fr")
				return newsrc;

			// http://svn.pimentech.org/pimentech/libcommonDjango/django_pimentech/pixr/views.py
			// mirror: https://pastebin.com/D7zPvfa1
			//
			// http://i.f1g.fr/media/figaro/493x100_crop/2017/03/28/XVM5540edbe-13a3-11e7-9e28-7b011fa4a165.jpg
			//   http://i.f1g.fr/media/figaro/orig/2017/03/28/XVM5540edbe-13a3-11e7-9e28-7b011fa4a165.jpg
			// http://i.f1g.fr/media/eidos/493x178_crop/2017/11/05/XVM758e1cb8-c212-11e7-b1f9-8e8a8cad8fcc.jpg
			//   http://i.f1g.fr/media/eidos/orig/2017/11/05/XVM758e1cb8-c212-11e7-b1f9-8e8a8cad8fcc.jpg
			return src.replace(/\/media\/([a-z]*)\/[^/]*\//, "/media/$1/orig/");
		}

		if ((domain_nosub === "h-cdn.co" ||
			 // http://cnl.h.cdn.cosmopolitan.nl/assets/14/52/480x419/nrm_1419442245-billboard-awards-2013.jpg
			 //   http://cnl.h.cdn.cosmopolitan.nl/assets/14/52/nrm_1419442245-billboard-awards-2013.jpg
			 (domain_nosub === "cosmopolitan.nl" && domain.match(/h\.cdn\.cosmopolitan\./))) &&
			string_indexof(src, "/assets/") >= 0) {
			// http://cos.h-cdn.co/assets/15/10/980x490/landscape_nrm_1425328178-tiffanypps2.jpg
			//   http://cos.h-cdn.co/assets/15/10/landscape_nrm_1425328178-tiffanypps2.jpg -- 1024x512
			//   http://cos.h-cdn.co/assets/15/10/1425328178-tiffanypps2.jpg -- doesn't work
			//   http://cos.h-cdn.co/assets/15/10/nrm_1425328178-tiffanypps2.jpg -- works, 1024x576
			// http://ell.h-cdn.co/assets/15/24/980x490/landscape-1433956992-elle-wit.jpg
			//   http://ell.h-cdn.co/assets/15/24/landscape-1433956992-elle-wit.jpg -- 4000x2000
			//   http://ell.h-cdn.co/assets/15/24/1433956992-elle-wit.jpg -- 4000x2000
			// http://cos.h-cdn.co/assets/16/23/sd-aspect-1465527150-kate-upton.jpg -- 4000x3000
			//   http://cos.h-cdn.co/assets/16/23/1465527150-kate-upton.jpg -- 4000x3000
			return src
				.replace(/\/[0-9]*x[0-9]*\//, "/")
				.replace(/\/(?:landscape|[a-z]+-aspect)[-_]((?:nrm_)?[0-9]{5,}[^/]*)(?:[?#].*)?$/, "/$1");
			// return src.replace(/(\/assets\/[^/]*\/[^/]*\/)[0-9]+x[0-9]+\//, "$1");
		}

		if (domain === "imgix.ranker.com") {
			// https://imgix.ranker.com/user_node_img/50076/1001516851/original/sheldon-and-_39_s-in-an-insane-asylum-and-the-show-only-takes-place-in-his-head-photo-u1?w=600&q=50&fm=jpg
			//   https://imgix.ranker.com/user_node_img/50076/1001516851/original/sheldon-and-_39_s-in-an-insane-asylum-and-the-show-only-takes-place-in-his-head-photo-u1?fm=png
			return src.replace(/\?.*$/, "?fm=png");
		}

		if (domain_nosub === "rnkr-static.com" &&
			domain.match(/^img[0-9]*\./)) {
			// http://img1.rnkr-static.com/user_node_img/3369/67378502/C250/bree-daniels-people-in-film-photo-u1.jpg
			//   http://img1.rnkr-static.com/user_node_img/3369/67378502/full/bree-daniels-people-in-film-photo-u1.jpg -- has artifacts
			//   http://img1.rnkr-static.com/user_node_img/3369/67378502/full/bree-daniels-people-in-film-photo-u1.png -- 404
			//   http://imgix.ranker.com/user_node_img/3369/67378502/original/bree-daniels-people-in-film-photo-u1?fm=png
			// http://img1.rnkr-static.com/node_img/83/1644505/C100/namie-amuro-recording-artists-and-groups-photo-1.jpg
			//   https://imgix.ranker.com/node_img/83/1644505/original/namie-amuro-recording-artists-and-groups-photo-1?fm=png -- looks better, maybe original?
			//   http://img1.rnkr-static.com/node_img/83/1644505/full/namie-amuro-recording-artists-and-groups-photo-1.jpg -- edges are less blurry, but has artifacts
			return src.replace(/^[a-z]+:\/\/[^/]*\/+((?:user_)?node_img\/+[0-9]+\/+[0-9]+)\/+[^/]*\/+([^/]*)\.[^/.]*(?:[?#].*)?$/,
							   "https://imgix.ranker.com/$1/original/$2?fm=png");
		}

		if (domain_nosub === "imgix.net") {
			// https://driftt.imgix.net/https%3A%2F%2Fdriftt.imgix.net%2Fhttps%253A%252F%252Fs3.amazonaws.com%252Fcustomer-api-avatars-prod%252F124400%252Fa382421eaa0c3184c7c1588a54a481014za77e245kzk%3Ffit%3Dmax%26fm%3Dpng%26h%3D200%26w%3D200%26s%3Db662f982cf04f9f733dcb1ce4522ee73?fit=max&fm=png&h=200&w=200&s=cd4c2695da2c9621a41fc14e92516b37
			//  https://driftt.imgix.net/https%3A%2F%2Fs3.amazonaws.com%2Fcustomer-api-avatars-prod%2F124400%2Fa382421eaa0c3184c7c1588a54a481014za77e245kzk?fit=max&fm=png&h=200&w=200&s=b662f982cf04f9f733dcb1ce4522ee73
			//   https://s3.amazonaws.com/customer-api-avatars-prod/124400/a382421eaa0c3184c7c1588a54a481014za77e245kzk
			// https://pathwright.imgix.net/https%3A%2F%2Fcdn.filestackcontent.com%2Fapi%2Ffile%2FIKM4hngTeadpScVNjbD6%3Fsignature%3D888b9ea3eb997a4d59215bfbe2983c636df3c7da0ff8c6f85811ff74c8982e34%26policy%3DeyJjYWxsIjogWyJyZWFkIiwgInN0YXQiLCAiY29udmVydCJdLCAiZXhwaXJ5IjogNDYyMDM3NzAzMX0%253D?fit=crop&ixlib=python-1.1.0&w=500&s=7c58aa94c9a2446b0d7552e5574ac39e
			//   https://cdn.filestackcontent.com/api/file/IKM4hngTeadpScVNjbD6?signature=888b9ea3eb997a4d59215bfbe2983c636df3c7da0ff8c6f85811ff74c8982e34&policy=eyJjYWxsIjogWyJyZWFkIiwgInN0YXQiLCAiY29udmVydCJdLCAiZXhwaXJ5IjogNDYyMDM3NzAzMX0%3D
			// https://mms-images-secure-prod.imgix.net/https%3A%2F%2Fmms-images.out.customink.com%2Fmms%2Fimages%2Fcatalog%2Fcolors%2F116200%2Fviews%2Falt%2Ffront_medium_extended.png%3Fdesign%3Ddjn0-00bm-qyge%26autoNegate%3D1%26digest%3D0000000013%26placeMax%3D1%26placeMaxPct%3D0.8%26placeUseProduct%3D1%26placeUseView%3Dfront?ixlib=rb-1.1.0&w=600&h=600&fit=fill&dpr=1&bg=ffffff&fm=pjpg&trim=auto&trimmd=0&q=50&auto=compress&s=e18d4010b5be78f8d517a26ed971d0a0
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\.imgix\.net\/(https?%3A[^?]+).*?$/, "$1")
			if (newsrc !== src)
				return decodeURIComponent(newsrc);
		}

		if (domain === "data.whicdn.com") {
			// https://data.whicdn.com/images/284282683/superthumb.jpg
			//   https://data.whicdn.com/images/284282683/original.jpg
			match = src.match(/^([a-z]+:\/\/[^/]+\/+images\/+([0-9]+)\/+)[^/.]*\.([^/.]*)$/);
			if (match) {
				return {
					url: match[1] + "original." + match[3],
					extra: {
						page: "https://weheartit.com/entry/" + match[2]
					}
				};
			}
		}

		if (domain_nosub === "whicdn.com" && domain.match(/^data[0-9]*\./)) {
			// http://data3.whicdn.com/images/139561907/large.jpg
			//   http://data.whicdn.com/images/139561907/large.jpg
			return src.replace(/:\/\/data[0-9]*\./, "://data.");
		}

		if (host_domain_nowww === "weheartit.com" && options.element) {
			if (domain === "assets.whicdn.com" && /\/assets\/+whi-[^/]+\/+entry_stub\/+entry_stub_unsafe-/.test(src)) {
				if (options.element.parentElement && options.element.parentElement.tagName === "A") {
					var href = options.element.parentElement.href;
					match = href.match(/\/entry\/+([0-9]+)\/*(?:[?#].*)?$/);

					if (match) {
						return "https://data.whicdn.com/images/" + match[1] + "/original.jpg";
					}
				}
			}
		}

		if (domain === "cdn.empireonline.com") {
			// 12
			// https://cdn.empireonline.com/jpg/70/0/0/640/480/aspectfit/0/0/0/0/0/0/c/reviews_films/5a57bf3d652c21bb08ce7fc8/pixar-coco-concept-art.jpg
			//   https://cdn.empireonline.com/c/reviews_films/5a57bf3d652c21bb08ce7fc8/pixar-coco-concept-art.jpg
			// https://cdn.empireonline.com/jpg/80/0/0/300/170/0/north/0/0/0/0/0/c/reviews_films/5a73e5036bb57fce0af3b5ab/den-of-thieves-1.jpg
			//   https://cdn.empireonline.com/c/reviews_films/5a73e5036bb57fce0af3b5ab/den-of-thieves-1.jpg
			//return src.replace(/cdn\.empireonline\.com\/(?:jpg|png|gif)\/(?:[0-9]+\/){5}aspectfit\/(?:[0-9]+\/){6}/, "cdn.empireonline.com/");
			return src.replace(/cdn\.empireonline\.com\/(?:jpg|png|gif)\/(?:[^/.]+\/){12}/, "cdn.empireonline.com/");
			//return urljoin(src, src.replace(/cdn\.empireonline\.com\/(jpg)|(png)|(gif)\/[^/]*\/[^/]*\/[^/]*\/[^/]*\/[^/]*\/[^/]*\/[^/]*\/[^/]*\/[^/]*\/[^/]*\/[^/]*\/[^/]*\//, "/"));
		}

		if (domain_nosub === "celebmafia.com" ||
			domain_nosub === "hawtcelebs.com") {
			return src.replace(/\/([^/]*)_thumbnail\.([^/.]*)$/, "/$1.$2");
		}

		if ((domain_nosub === "pixhost.org" ||
			 domain_nosub === "pixhost.to") &&
			domain.match(/^[a-z]*[0-9]*\./)) {
			// https://t17.pixhost.to/thumbs/469/66269400_ns4w-org-2.jpg
			//   https://img17.pixhost.to/images/469/66269400_ns4w-org-2.jpg
			// https://t16.pixhost.org/thumbs/419/63150269_dsera-023.jpg
			//   https://img16.pixhost.to/images/419/63150269_dsera-023.jpg
			return src
				.replace(/(:\/\/[^/]*\.)pixhost\.org\//, "$1pixhost.to/")
				.replace(/\/t([0-9]*\.pixhost\.[a-z]*)\/thumbs\//, "/img$1/images/");
		}

		/*if (false && string_indexof(domain, "ssli.ulximg.com") >= 0) {
			return src.replace(/\/image\/[0-9]+x[0-9]+\//, "/image/full/");
		}*/

		if (domain_nosub === "ulximg.com" ||
			// https://www.hotnewhiphop.com/image/620x412/cover/1524605990_feb5e308477137cbfd1b33ec83a5ba73.jpg/a2190aede262d8430a74acf84c6fc2b3/1524605990_b78abf068561f64fc0d7a44ff44dde65.jpg
			//   https://www.hotnewhiphop.com/image/full/cover/1524605990_feb5e308477137cbfd1b33ec83a5ba73.jpg/a2190aede262d8430a74acf84c6fc2b3/1524605990_b78abf068561f64fc0d7a44ff44dde65.jpg
			//   https://www.hotnewhiphop.com/image/full/cover/1524605990_feb5e308477137cbfd1b33ec83a5ba73.jpg -- also works
			domain_nowww === "hotnewhiphop.com") {
			// https://sslh.ulximg.com/image/740x493/cover/1517447102_98a80a4ead45fe6ea39dba7f13d82d59.jpg/cf804979603806d94cb139fc0676f0ca/1517447102_4694e8c352198b439a03d90f0ea03910.jpg
			//   https://sslh.ulximg.com/image/full/cover/1517447102_98a80a4ead45fe6ea39dba7f13d82d59.jpg/cf804979603806d94cb139fc0676f0ca/1517447102_4694e8c352198b439a03d90f0ea03910.jpg
			// https://sslb.ulximg.com/image/640xfull/gallery/1519079706_9a191bef4598aefcd89fdb14d43dd943.jpg/ab146c791e98eccd4a763e2a31fa10ce/1519079706_65c3b37c6f9215a3c80d86f6172920c2.jpg
			//   https://sslb.ulximg.com/image/full/gallery/1519079706_9a191bef4598aefcd89fdb14d43dd943.jpg/ab146c791e98eccd4a763e2a31fa10ce/1519079706_65c3b37c6f9215a3c80d86f6172920c2.jpg
			// doesn't work for all:
			// https://sslh.ulximg.com/image/740x493/cover/1517954740_3e7856551e64f1217860014d8853d1e1.jpg
			return src
				.replace(/\/image\/[0-9a-z]*x[0-9a-z]*\//, "/image/full/");
				//.replace(/(\/cover\/[^/.]*\.[^/.]*)\/.*/, "$1");
		}

		if (domain === "fm.cnbc.com") {
			// https://fm.cnbc.com/applications/cnbc.com/resources/img/editorial/2018/07/12/105325481-Preview10.600x400.jpeg?v=1531393316
			//   https://fm.cnbc.com/applications/cnbc.com/resources/img/editorial/2018/07/12/105325481-Preview10.jpeg?v=1531393316
			return src.replace(/\.[0-9]+x[0-9]+\.([^/.]*)$/, ".$1");
		}

		if (domain === "images.bwwstatic.com" ||
			// thanks to louthecute on discord:
			// https://cloudimages.broadwayworld.com/upload13/2005458/tn-500_burnthiswm076769780059330.jpg
			//   https://cloudimages.broadwayworld.com/upload13/2005458/burnthiswm076769780059330.jpg -- 2586x3600
			// https://cloudimages.broadwayworld.com/upload7/319544/tn-500_tn-500_anger4863.jpg
			//   https://cloudimages.broadwayworld.com/upload7/319544/tn-500_anger4863.jpg -- 600x402
			domain === "cloudimages.broadwayworld.com" ||
			// https://newimages.bwwstatic.com/upload11/1600837/tn-500_17stg11.jpg
			//   https://newimages.bwwstatic.com/upload11/1600837/17stg11.jpg
			domain === "newimages.bwwstatic.com") {
			// https://images.bwwstatic.com/upload/44785/tn-500_(23).jpg
			//   https://images.bwwstatic.com/upload/44785/(23).jpg
			// https://images.bwwstatic.com/columnpic10/x170BDEF933D-7AF0-441D-B4212BE606623B0E.jpg.pagespeed.ic.fsaymxZU7N.jpg
			//   https://images.bwwstatic.com/columnpic10/BDEF933D-7AF0-441D-B4212BE606623B0E.jpg
			// https://images.bwwstatic.com/columnpic10/155x64x170ACAF3A86-10F8-4C49-A5A20BCB3E5870DD.jpg.pagespeed.ic.XjIWMZEHy2.jpg
			//   https://images.bwwstatic.com/columnpic10/ACAF3A86-10F8-4C49-A5A20BCB3E5870DD.jpg
			return src
				.replace(/\/tn-[0-9]+_([^/]*)$/, "/$1")
				.replace(/\/(?:[0-9]+)?x(?:[0-9]*)(?:x[0-9]+)?([^/]*)\.pagespeed\.[^/]*(?:[?#].*)?$/, "/$1");
		}

		if (domain_nowww === "broadwayworld.com") {
			// thanks to louthecute on discord:
			// https://www.broadwayworld.com/ezoimgfmt/cloudimages.broadwayworld.com/upload13/2005458/tn-500_burnthiswm076769780059330.jpg?ezimgfmt=rs:148x206/rscb35/ng:webp/ngcb35
			//   https://cloudimages.broadwayworld.com/upload13/2005458/tn-500_burnthiswm076769780059330.jpg
			// https://www.broadwayworld.com/ezoimgfmt/cloudimages.broadwayworld.com/upload7/319544/tn-500_tn-500_anger4863.jpg?ezimgfmt=rs:600x402/rscb35/ng:webp/ngcb35
			//   https://cloudimages.broadwayworld.com/upload7/319544/tn-500_tn-500_anger4863.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+ezoimgfmt\/+([^/]+\.[^/]+\/[^?#]+)(?:[?#].*)?$/, "$1");
			if (newsrc !== src)
				return add_http(newsrc);
		}

		if (false && domain === "img.rasset.ie") {
			// https://img.rasset.ie/000a704c-440.jpg
			//   https://img.rasset.ie/000a704c-9999.jpg -- wildly stretched (4096x6144)
			return src.replace(/(\/[^/]*)-[0-9]*(\.[^/.]*)$/, "$1-9999$2");
		}

		if (common_functions["is_pinterest_domain"](domain)) {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+pin\/+([0-9]+)\/*(?:[?#].*)?$/,
				query_for_id: "https://www.pinterest.com/pin/${id}/",
				process_old: function(done, resp, cache_key, website_match) {
					var match = resp.responseText.match(/<script id="initial-state" type="application\/json">({.*?})<\/script>/);
					if (!match) {
						console_error(cache_key, "Unable to find initial state for", resp);
						return done(null, false);
					}

					var initial_state = JSON_parse(match[1]);
					//console_log(initial_state);

					var id = website_match[1];
					var responses = initial_state.resourceResponses;
					var response = null;

					for (var i = 0; i < responses.length; i++) {
						if (responses[i].options.id !== id)
							continue;

						response = responses[i];
						break;
					}

					if (!response) {
						console_error(cache_key, "Unable to find response for id", id, " in", resp, initial_state);
						return done(null, false);
					}

					response = response.response.data;

					var urls = [];

					var baseobj:BigImageInfoSObject = {
						extra: {
							page: resp.finalUrl
						}
					};

					if (response.title) {
						baseobj.extra.caption = response.title;
					}

					if (response.videos) {
						var videolist = [];
						var deduplicated_urls = {};

						for (var video_id in response.videos.video_list) {
							var video = response.videos.video_list[video_id];
							if (video.url in deduplicated_urls)
								continue;

							video.id = video_id;
							deduplicated_urls[video.url] = video;
							videolist.push(video);
						}

						videolist.sort(function(a, b) {
							var a_wh = a.width * a.height;
							var b_wh = b.width * b.height;

							if (a_wh !== b_wh) {
								return b_wh - a_wh;
							}

							var a_id = a.id.replace(/^V_/, "");
							var b_id = b.id.replace(/^V_/, "");

							var a_hls = string_indexof(a_id, "HLS") === 0;
							var b_hls = string_indexof(b_id, "HLS") === 0;

							if (a_hls) {
								if (b_hls) {
									// TODO: compare _MOBILE, _WEB, and _V[34]
									return 0;
								} else {
									return -1;
								}
							} else {
								if (b_hls) {
									return 1;
								} else {
									return parseInt(b_id) - parseInt(a_id);
								}
							}
						});

						var videourls = [];
						for (var i = 0; i < videolist.length; i++) {
							var video = videolist[i];

							var video_hls = string_indexof(video.id, "V_HLS") === 0;
							videourls.push({
								url: video.url,
								video: video_hls ? "hls" : true
							});
						}

						array_extend(urls, videourls);
					}

					if (response.images) {
						urls.push(response.images.orig);
					}

					var obj = fillobj_urls(urls, baseobj);

					if (response.link) {
						obj.unshift({
							url: response.link,
							is_pagelink: true
						});
					}

					return done(obj, 6*60*60);
				},
				process: function(done, resp, cache_key, website_match) {
					let matches = match_all(resp.responseText, /<script data-relay-response="true" type="application\/json">({.*?"data":\s*{\s*"v3GetPinQuery".*?})<\/script>/);
					if (!matches) {
						console_error(cache_key, "Unable to find pin queries for", resp);
						return done(null, false);
					}

					let id = website_match[1];
					let response = null;

					for (let match of matches) {
						let json = JSON_parse(match[1]);
						let data = json.response.data.v3GetPinQuery.data;
						if (data.entityId !== id)
							continue;

						if (!response) {
							response = data;
						} else {
							for (let key in data) {
								if (!(key in response)) {
									response[key] = data[key];
								}

								if (key === "videos" && data[key]) {
									if (data.videos.videoUrls)
										response.videos.videoUrls = data.videos.videoUrls;
								}
							}
						}
					}

					if (!response) {
						console_error(cache_key, "Unable to find pin from", resp, matches);
						return done(null, false);
					}

					//console_log(response);

					var urls = [];

					var baseobj:BigImageInfoSObject = {
						extra: {
							page: resp.finalUrl
						}
					};

					if (response.title) {
						baseobj.extra.caption = response.title;
					}

					let pinner = response.originPinner || response.pinner;
					if (pinner) {
						baseobj.extra.author_username = pinner.username;
					}

					if (response.videos) {
						let get_url_properties = function(url) {
							let props = {
								hevc: 0,
								videofile: 1,
								dash: 0,
								multi: 0,
								type: null
							};

							if (/\/(?:hevc|h265)/.test(url)) {
								props.hevc = 1;
							}

							if (/\.(?:m3u8|mpd)$/.test(url))
								props.videofile = 0;

							if (/\.mpd$/.test(url))
								props.dash = 1;

							if (/-multi-.*\.(?:m3u8|mpd)$/.test(url))
								props.multi = 1;

							let match = url.match(/_t([0-9]+)\./);
							if (match) {
								props.type = parseInt(match[1]);
							}

							return props;
						};

						let raw_videourls = response.videos.videoUrls;

						let new_videourls = [];
						for (let url of raw_videourls) {
							if (array_indexof(new_videourls, url) >= 0)
								continue;

							let props = get_url_properties(url);
							let delivery:VideoDelivery = null;
							if (!props.videofile) {
								delivery = props.dash ? "dash" : "hls"
							};

							new_videourls.push({
								url: url,
								media_info: {
									type: "video",
									delivery: delivery,
									codec: props.hevc ? "hevc" : null
								}
							});
						}

						new_videourls.sort(function(a, b) {
							let ap = get_url_properties(a.url);
							let bp = get_url_properties(b.url);

							if (ap.hevc !== bp.hevc)
								return bp.hevc - ap.hevc;

							// prioritize streams over raw video files
							if (ap.videofile !== bp.videofile)
								return ap.videofile - bp.videofile;

							if (ap.multi !== bp.multi)
								return bp.multi - ap.multi;

							// dash requires less network calls
							if (!ap.videofile && !bp.videofile && ap.dash !== bp.dash)
								return bp.dash - ap.dash;

							if (ap.type !== null && bp.type !== null)
								return bp.type - ap.type;

							return 0;
						});

						array_extend(urls, new_videourls);
					}

					if (response.imageSpec_orig) {
						urls.push(response.imageSpec_orig.url);
					}

					var obj = fillobj_urls(urls, baseobj);

					if (response.link) {
						obj.unshift({
							url: response.link,
							is_pagelink: true
						});
					}

					return done(obj, 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (common_functions["is_pinterest_domain"](host_domain) && options.element) {
			var current = options.element;
			do {
				if (current.tagName === "A" && /^[a-z]+:\/\/[^/]+\/+pin\/+[0-9]{5,}/.test(current.href)) {
					return {
						url: current.href,
						is_pagelink: true
					};
				}

				if (current.tagName === "DIV" && current.getAttribute("data-test-id") === "pin-closeup-image") {
					var script = current.querySelector("script[type=\"application/ld+json\"]");
					if (!script)
						continue;

					try {
						var parsed = JSON_parse(script.innerHTML);
						if (parsed["@id"]) {
							return {
								url: parsed["@id"],
								is_pagelink: true
							};
						}
					} catch (e){
						console_error(e);
					}
				}
			} while (current = current.parentElement);
		}

		if (domain === "i.pinimg.com" ||
			// https://i-h2.pinimg.com/474x/2c/03/5a/2c035a1668bfe4fc71abbade44a9423d--flat-design-ui-design.jpg?b=t
			//   https://i-h2.pinimg.com/originals/2c/03/5a/2c035a1668bfe4fc71abbade44a9423d--flat-design-ui-design.jpg?b=t
			//   https://i-h2.pinimg.com/originals/2c/03/5a/2c035a1668bfe4fc71abbade44a9423d--flat-design-ui-design.jpg
			// https://media-cache-ak0.pinimg.com/originals/fb/c6/9e/fbc69eb3d8a79379e81399ca94d410d2.jpg
			// https://s-media-cache-ak0.pinimg.com/736x/d0/e6/7d/d0e67d12638858dbad180eaa6e9e4463--lesley-ann-brandt-gay-celebrities.jpg
			//   https://s-media-cache-ak0.pinimg.com/originals/d0/e6/7d/d0e67d12638858dbad180eaa6e9e4463--lesley-ann-brandt-gay-celebrities.jpg
			(domain_nosub === "pinimg.com" && domain.match(/^(?:i|(?:s-)?media-cache)-[^.]*\.pinimg/)) ||
			// http://s3.amazonaws.com/media.pinterest.com/640x/c9/68/4a/c9684afc422e69662bed9f59835d2001.jpg
			//   http://s3.amazonaws.com/media.pinterest.com/originals/c9/68/4a/c9684afc422e69662bed9f59835d2001.jpg
			// http://media.pinterest.com.s3.amazonaws.com/640x/c9/68/4a/c9684afc422e69662bed9f59835d2001.jpg
			//   http://media.pinterest.com.s3.amazonaws.com/originals/c9/68/4a/c9684afc422e69662bed9f59835d2001.jpg
			amazon_container === "media.pinterest.com") {
			// https://i.pinimg.com/640x/1f/3f/ed/1f3fed6c284955934c7d724d2fe13ecb.jpg
			//   https://i.pinimg.com/originals/1f/3f/ed/1f3fed6c284955934c7d724d2fe13ecb.png
			// https://i.pinimg.com/640x/a7/db/c3/a7dbc392372f1ca8f744032ba3c5ade1.jpg
			//   https://i.pinimg.com/originals/a7/db/c3/a7dbc392372f1ca8f744032ba3c5ade1.gif
			src = src.replace(/[?#].*$/, "");

			if (src.match(/:\/\/[^/]*\/media\.pinterest\.com\//))
				newsrc = src.replace(/(:\/\/[^/]*\/media\.pinterest\.com\/)[^/]*(\/.*\/[^/]*\.[^/.]*)$/, "$1originals$2");
			else
				newsrc = src.replace(/(:\/\/[^/]*\/)[^/]*(\/.*\/[^/]*\.[^/.]*)$/, "$1originals$2");

			if (newsrc !== src) {
				return add_extensions_gif({
					url: newsrc,
					is_original: true
				});
			}
		}

		if (domain_nosub === "condecdn.net" && string_indexof(domain, "images.condecdn.net") >= 0) {
			// http://vg-images.condecdn.net/image/5LQVw4Pp8rR/crop/1020
			//   https://vg-images.condecdn.net/image/5LQVw4Pp8rR/original/
			// https://gl-images.condecdn.net/image/DAwRBl12EGY/crop/810
			//   https://gl-images.condecdn.net/image/DAwRBl12EGY/original/
			obj = {url: src};

			match = src.match(/\/image\/+([a-zA-Z0-9]+)\//);
			if (match) {
				obj.filename = match[1];
			}

			newsrc = src.replace(/(\/image\/[^/]*\/).*/, "$1original/");
			if (newsrc !== src)
				obj.url = newsrc;

			return obj;
		}

		if (domain === "media.fromthegrapevine.com" ||
			// http://gretschpages.com/media/img/fretboard/2014/8/snake.jpg.540x540_q85_autocrop.jpg
			//   http://gretschpages.com/media/img/fretboard/2014/8/snake.jpg
			(domain_nowww === "gretschpages.com" && string_indexof(src, "/media/img/") >= 0) ||
			// https://pornstars.me/media/pornstars/naomi-woods.jpg.960x0_q85.jpg
			//   https://pornstars.me/media/pornstars/naomi-woods.jpg
			(domain_nowww === "pornstars.me" && string_indexof(src, "/media/") >= 0) ||
			// thanks to anonymous for reporting:
			// https://jz.img0.cz/media/35/d8/35d89e81-21f7-45c1-bb28-6f2995efc0ca.jpg.570x570_q85_crop.jpg
			//   https://jz.img0.cz/media/35/d8/35d89e81-21f7-45c1-bb28-6f2995efc0ca.jpg
			(domain === "jz.img0.cz" && string_indexof(src, "/media/") >= 0) ||
			// https://www.mediavillage.com/media/articles/alex-wong-17993-unsplash.jpg.1440x1000_q85_box-19%2C0%2C634%2C427_crop_detail.jpg
			//   https://www.mediavillage.com/media/articles/alex-wong-17993-unsplash.jpg
			domain_nowww === "mediavillage.com") {
			// https://media.fromthegrapevine.com/assets/images/2017/3/waiting-in-long-line.jpg.824x0_q71_crop-scale.jpg
			//   https://media.fromthegrapevine.com/assets/images/2017/3/waiting-in-long-line.jpg
			return src.replace(/\/([^/.]*\.[^/.]*)\.[^/.]*\.[^/.]*$/, "/$1");
		}

		if (domain_nosub === "acsta.net" && domain.search(/img[0-9]*\.acsta\.net/) >= 0) {
			newsrc = src.replace(/acsta\.net\/[^/]*\/pictures\//, "acsta.net/pictures/");
			if (newsrc !== src)
				return newsrc;

			// http://fr.web.img4.acsta.net/r_640_360/videothumbnails/15/06/05/12/59/008779.jpg
			//   http://fr.web.img4.acsta.net/videothumbnails/15/06/05/12/59/008779.jpg
			// http://fr.web.img2.acsta.net/c_208_117/videothumbnails/17/02/08/14/59/169562.jpg
			//   http://fr.web.img2.acsta.net/videothumbnails/17/02/08/14/59/169562.jpg
			return src.replace(/\/[rc]_[0-9]+_[0-9]+\//, "/");
		}

		if (domain === "em.wattpad.com") {
			// https://em.wattpad.com/10c43b485be3ed7d7dd3e7e24ad6cb9d8a11a264/687474703a2f2f6a656e6d6172696577696c64652e636f6d2f77702d636f6e74656e742f75706c6f6164732f323031352f30332f4576614642436f7665722e6a7067?s=fit&h=360&w=360&q=80
			//   http://jenmariewilde.com/wp-content/uploads/2015/03/EvaFBCover.jpg
			// https://em.wattpad.com/08067e2680eba0d36693e085bc95b85c9c0d8f8b/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f776174747061642d6d656469612d736572766963652f53746f7279496d6167652f3062446c6b2d786e5565654d54673d3d2d32303633363333342e313436393133373236306332313733383233313938393638383435332e6a7067?s=fit&w=720&h=720
			//   https://s3.amazonaws.com/wattpad-media-service/StoryImage/0bDlk-xnUeeMTg==-20636334.1469137260c21738231989688453.jpg
			return src.replace(/.*\.wattpad\.com\/[a-f0-9]*\/([a-f0-9]*).*/, "$1").replace(/([0-9A-Fa-f]{2})/g, function() {
				return string_fromcharcode(parseInt(arguments[1], 16));
			});
		}

		if (domain === "camo.githubusercontent.com") {
			// thanks to n0099 for reporting: https://github.com/qsniyg/maxurl/issues/1124
			// https://camo.githubusercontent.com/3b48927ffb3c3d5f21776558962e4bcbb1e391ed7dd478f27dddb6657d46fd9b/68747470733a2f2f693334392e70686f746f6275636b65742e636f6d2f616c62756d732f713336342f74636d61706c65722f506167655f30315f5472616e736c617465642e706e67
			//   https://i349.photobucket.com/albums/q364/tcmapler/Page_01_Translated.png
			match = src.match(/^[a-z]+:\/\/[^/]+\/+[0-9a-f]+\/+(68747470[0-9a-f]+)(?:[?#].*)?$/);
			if (match) {
				let hex = match[1];
				return hex.replace(/[0-9a-f]{2}/g, function(x) {
					return string_fromcharcode(parseInt(x, 16));
				});
			}
		}

		if (host_domain_nosub === "fandom.com" && options.element) {
			if (src.length < 10 && options.element.hasAttribute("data-src")) {
				return options.element.getAttribute("data-src");
			}

			if (options.element.hasAttribute("data-video-key") && options.do_request && options.cb) {
				var query_wikia_video = function(key, cb) {
					api_query("wikia:" + key, {
						url: urljoin(options.host_url, "/wikia.php?controller=Lightbox&method=getMediaDetail&fileTitle=" + key + "&format=json", true),
						headers: {
							"x-requested-with": "XMLHttpRequest"
						}
					}, cb, function(done, resp, cache_key) {
						try {
							var json = JSON_parse(resp.responseText);
							if (json.videoEmbedCode.provider === "youtube") {
								return done("https://i.ytimg.com/vi/" + json.videoEmbedCode.jsParams.videoId + "/mqdefault.jpg", 24*60*60);
							}
						} catch (e) {
							console_error(e);
						}

						return done(null, false);
					});
				};

				query_wikia_video(options.element.getAttribute("data-video-key"), options.cb);
				return {
					waiting: true
				};
			}
		}

		if (domain_nosub === "nocookie.net" &&
			domain.match(/^(?:vignette|static|img)[0-9]*\.wikia\./)) {
			// https://vignette.wikia.nocookie.net/arresteddevelopment/images/2/2a/2015_MM_and_A_TGIT_Party_-_Portia_de_Rossi.jpg/revision/latest/top-crop/width/320/height/320?cb=20151215213157
			//   https://vignette.wikia.nocookie.net/arresteddevelopment/images/2/2a/2015_MM_and_A_TGIT_Party_-_Portia_de_Rossi.jpg/revision/latest/?cb=20151215213157
			// https://vignette.wikia.nocookie.net/kpop/images/9/95/Various_Seulki_I_Only_Want_You_photo.png/revision/latest/scale-to-width-down/350
			//   https://vignette.wikia.nocookie.net/kpop/images/9/95/Various_Seulki_I_Only_Want_You_photo.png/revision/latest/
			// http://vignette3.wikia.nocookie.net/kpop/images/d/da/Gugudan_debut_group_photo.png/revision/latest?cb=20160617225600 -- 200x133
			//   https://vignette3.wikia.nocookie.net/kpop/images/d/da/Gugudan_debut_group_photo.png/revision/latest?cb=20160617225600 -- 1620x1080
			// http://img1.wikia.nocookie.net/__cb20131123125039/sonic/images/4/47/GUNsmapofearth.png
			//   https://img1.wikia.nocookie.net/sonic/images/4/47/GUNsmapofearth.png
			// thanks to dym-sh on github: https://github.com/qsniyg/maxurl/issues/490
			// https://non-aliencreatures.fandom.com/wiki/Machine_Elf?file=Machineelf.jpg
			// https://static.wikia.nocookie.net/non-aliencreatures/images/f/f6/Machineelf.jpg/revision/latest/scale-to-width-down/600?cb=20110214083503
			//   https://static.wikia.nocookie.net/non-aliencreatures/images/f/f6/Machineelf.jpg/revision/latest/?cb=20110214083503
			// thanks to Noodlers on discord:
			// https://static.wikia.nocookie.net/klonoa/images/7/7c/Fix_pk_bsc.jpg/revision/latest/scale-to-width-down/350?cb=20090113193248
			//   https://static.wikia.nocookie.net/klonoa/images/7/7c/Fix_pk_bsc.jpg/revision/latest/?cb=20090113193248
			//   https://static.wikia.nocookie.net/klonoa/images/7/7c/Fix_pk_bsc.jpg/revision/latest/?format=original
			// thanks to Liz on discord:
			// https://static.wikia.nocookie.net/b177d35a-d5b0-4dc1-a869-a099e4a9cb1d/scale-to-width/48
			//   https://static.wikia.nocookie.net/b177d35a-d5b0-4dc1-a869-a099e4a9cb1d
			// https://static.wikia.nocookie.net/322dfe61-5d0b-461c-ad01-216d01c7b0ec/thumbnail/width/400/height/400
			//   https://static.wikia.nocookie.net/322dfe61-5d0b-461c-ad01-216d01c7b0ec
			//return src.replace(/(\/images\/[^/]*\/.*)\/scale-to-width-down\/[0-9]*/, "$1");
			obj = {
				url: src
			};
			match = src.match(/\/images\/+[0-9a-f]\/+[0-9a-f]{2}\/+([^/]+)\/+revision\//);
			if (match) {
				obj.filename = match[1];
			}

			newsrc = src.replace(/(:\/\/[^/]+\/+[-a-f0-9]{10,})\/+.*$/, "$1");
			if (newsrc !== src)
				return newsrc;

			newsrc = src.replace(/(\/revision\/[^/?#]+\/*)(?:[?#].*)?$/, "$1?format=original");
			if (newsrc !== src) {
				obj.url = newsrc;
				return obj;
			}

			newsrc = src.replace(/(:\/\/[^/]+\/+)__cb[0-9]{5,}\/+/, "$1");
			if (newsrc !== src) {
				obj.url = newsrc;
				return obj;
			}

			newsrc = src
				.replace(/\/revision\/([^/]*)\/.*?(\?.*)?$/, "/revision/$1/$2")
				.replace(/^http:\/\//, "https://");
			if (newsrc !== src)
				obj.url = newsrc;

			return obj;
		}

		if (domain === "static.asiachan.com") {
			// https://static.asiachan.com/600/38/06/50338.jpg
			//   https://static.asiachan.com/full/38/06/50338.jpg
			// https://static.asiachan.com/Seohyun.600.171223.jpg
			//   https://static.asiachan.com/Seohyun.full.171223.jpg
			return src
				.replace(/(\/[^/]*\.)[0-9]*(\.[0-9]*\.[^/.]*$)/, "$1full$2")
				.replace(/(:\/\/[^/]*\/)[0-9]+(\/[0-9]+\/[0-9]+\/[0-9]+\.[^/.]*)$/, "$1full$2");
		}

		if (domain === "pic.xiami.net" ||
			// https://club-img.kdslife.com/attach/1k2/jm/36/p79ee9-1m6r.jpg@1o_1l_600w_90q.jpg
			//   https://club-img.kdslife.com/attach/1k2/jm/36/p79ee9-1m6r.jpg -- stretched?
			domain === "club-img.kdslife.com" ||
			// http://p0.meituan.net/movie/86f093dd1c7dfb6306ab488c958be31d356758.png@200w_1l
			//   http://p0.meituan.net/movie/86f093dd1c7dfb6306ab488c958be31d356758.png
			// http://p1.meituan.net/dpgroup/29bb001965d31aa20c90ff99f405769d21403.jpg%40100w_100h_1e_1c_1l%7Cwatermark%3D0
			//   http://p1.meituan.net/dpgroup/29bb001965d31aa20c90ff99f405769d21403.jpg
			(domain_nosub === "meituan.net" && /^p[0-9]*\./.test(domain)) ||
			// http://piccn.ihuaben.com/pic/mark/201903/1552277921814-Vi79361274_540-540.jpeg@200w
			//   http://piccn.ihuaben.com/pic/mark/201903/1552277921814-Vi79361274_540-540.jpeg
			(domain === "piccn.ihuaben.com" && string_indexof(src, "/pic/") >= 0) ||
			// http://oss2.lanlanlife.com/188de9f8b0de57a55b503fca041f1781_846x564.jpg@!2-w750-80-jpg
			//   http://oss2.lanlanlife.com/188de9f8b0de57a55b503fca041f1781_846x564.jpg
			(domain_nosub === "lanlanlife.com" && /^oss[0-9]*\./.test(domain)) ||
			// thanks to doio on github: https://github.com/qsniyg/maxurl/issues/625
			// https://www.zcool.com.cn/work/ZNDg5MTc4ODQ=.html
			// https://img.zcool.cn/community/01e8d65facdc7b11013ee04d8abc61.png@1280w_1l_2o_100sh.png
			//   https://img.zcool.cn/community/01e8d65facdc7b11013ee04d8abc61.png
			domain === "img.zcool.cn" ||
			// thanks to fireattack on discord:
			// https://i0.hdslb.com/bfs/archive/748f221f822ba0eaa12e1de51ccef8af72ae9751.png@640w_400h_1c_!web-space-index-myvideo.webp
			(domain_nosub === "hdslb.com" && /^i[0-9]*\./.test(domain)) ||
			// thanks to doio on github: https://github.com/qsniyg/maxurl/issues/1226
			// https://album.biliimg.com/bfs/new_dyn/cff5e1d43b05f89941e3259027ba03cb36180361.jpg@135h_1s_!web-comment-note.avif
			//   https://album.biliimg.com/bfs/new_dyn/cff5e1d43b05f89941e3259027ba03cb36180361.jpg
			domain === "album.biliimg.com" ||
			// thanks to anonymous for reporting:
			// https://pic-bstarstatic.akamaized.net/ugc/d88ed9043b6931a9918dfcefd3e3ceed.jpg@1200w_630h_1e_1c_1f.webp
			//   https://pic-bstarstatic.akamaized.net/ugc/d88ed9043b6931a9918dfcefd3e3ceed.jpg
			domain === "pic-bstarstatic.akamaized.net" ||
			// http://img.sdxapp.com/say/source/12/d2/12d2bb054022c4fc1038f3e4d279353d.jpg@600w_400h
			//   http://img.sdxapp.com/say/source/12/d2/12d2bb054022c4fc1038f3e4d279353d.jpg
			domain === "img.sdxapp.com") {
			// http://pic.xiami.net/images/artistlogo/43/15296162953243.png@!c-330-330
			//   http://pic.xiami.net/images/artistlogo/43/15296162953243.png
			newsrc = src.replace(/(?:@|%40)[^/]*$/, "");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "oss.tan8.com") {
			// https://oss.tan8.com/resource/attachment/2019/201908/32b8d7076aa5dd7f340511ed1a7a5e78_thumb.jpg
			//   https://oss.tan8.com/resource/attachment/2019/201908/32b8d7076aa5dd7f340511ed1a7a5e78.jpg
			return src.replace(/(\/resource\/+attachment\/+[0-9]{4}\/+[0-9]{6}\/+[0-9a-f]{20,})_thumb(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "ultimate-guitar.com") {
			// https://www.ultimate-guitar.com/static/storage/album/images/4/0/4073dfb6d00c5097ccffd68e6872014492625d3b.jpg@115
			//   https://www.ultimate-guitar.com/static/storage/album/images/4/0/4073dfb6d00c5097ccffd68e6872014492625d3b.jpg
			return src.replace(/(\/images\/+(?:[0-9a-f]\/+){2}[0-9a-f]+\.[^/.]*?)@[0-9]+(?:[?#].*)?$/, "$1");
		}

		// img4.c.yinyuetai.com
		if ((domain_nosub === "yinyuetai.com" && domain.match(/^img[0-9]*\.c\.yinyuetai\.com/)) ||
			// http://img0.yytcdn.com/video/mv/160701/2609575/-M-73056332b149ae15daed84981c3ba4c4_240x135.jpg
			//   http://img0.yytcdn.com/video/mv/160701/2609575/-M-73056332b149ae15daed84981c3ba4c4_0x0.jpg
			(domain_nosub === "yytcdn.com" && domain.match(/^img[0-9]*\./))) {
			// http://img0.c.yinyuetai.com/video/mv/180802/0/-M-f2e73b6131de7338d8375c82e7e60f70_240x135.jpg
			//   http://img0.c.yinyuetai.com/video/mv/180802/0/-M-f2e73b6131de7338d8375c82e7e60f70_0x0.jpg
			// http://img1.c.yinyuetai.com/user/avatar/170813/4165907-1502610570582/-M-3fe425e60e2fcf46bad875cc638be60f_180x180.jpg
			//   http://img1.c.yinyuetai.com/user/avatar/170813/4165907-1502610570582/-M-3fe425e60e2fcf46bad875cc638be60f_0x0.jpg -- doesn't work
			return src.replace(/[0-9]+x[0-9]+(\.[^/.]*)$/, "0x0$1");
		}

		// it also has img7.qiyipic.com, which hosts /passport/, which doesn't work with this (mp2.qiyipic.com)
		// test cases can be found, but can't find referer headers
		if (domain.search(/mp[0-9]*\.qiyipic\.com/) >= 0 && string_indexof(src, "/passport/") < 0) {
			return src.replace(/[0-9]*_[0-9]*(\.[^/.]*)$/, "0_0$1");
		}

		if (domain_nosub === "duitang.com" || domain_nosub === "dtstatic.com") {
			// https://b-ssl.duitang.com/uploads/item/201508/01/20150801214854_2Vr53.thumb.700_0.jpeg -- 403
			//   https://b-ssl.duitang.com/uploads/item/201508/01/20150801214854_2Vr53.jpeg -- works
			// https://c-ssl.duitang.com/uploads/item/201808/08/20180808195029_brxev.thumb.400_0.jpg
			//   https://c-ssl.duitang.com/uploads/item/201808/08/20180808195029_brxev.jpg
			// thanks to aslian on github: https://github.com/qsniyg/maxurl/pull/1263
			// https://c-ssl.dtstatic.com/uploads/people/201502/06/20150206101745_EFwrX.thumb.100_100_c.jpeg
			//   https://c-ssl.dtstatic.com/uploads/people/201502/06/20150206101745_EFwrX.jpeg
			// https://c-ssl.duitang.com/uploads/blog/202209/06/20220906131540_249df.jpeg_webp
			//   https://c-ssl.duitang.com/uploads/blog/202209/06/20220906131540_249df.jpeg
			// https://c-ssl.dtstatic.com/uploads/blog/202312/20/GgSl4lahdzLw8b.thumb.400_0.png
			//   https://c-ssl.dtstatic.com/uploads/blog/202312/20/GgSl4lahdzLw8b.png
			// https://c-ssl.dtstatic.com/uploads/blog/202209/06/20220906131540_249df.thumb.1000_0.jpeg
			//   https://c-ssl.dtstatic.com/uploads/blog/202209/06/20220906131540_249df.jpeg
			// https://d-ssl.dtstatic.com/uploads/blog/202209/06/20220906131540_249df.thumb.300_300_c.jpeg_webp
			//   https://d-ssl.dtstatic.com/uploads/blog/202209/06/20220906131540_249df.jpeg
			// https://c-ssl.duitang.com/uploads/blog/202209/06/20220906131540_249df.thumb.300_300_c.jpeg_webp
			//   https://c-ssl.duitang.com/uploads/blog/202209/06/20220906131540_249df.jpeg
			return src
				.replace(/(\.[a-z]+)_webp(?:[?#].*)?$/, "$1")
				.replace(/(\/uploads\/+[^/]+\/+.*)\.thumb\.[0-9]+_[0-9]+(?:_c)?\./, "$1.");
		}

		if (domain_nosub === "vcimg.com" &&
			domain.match(/i-[0-9]\.vcimg.com/)) {
			// http://i-7.vcimg.com/trim/8d8fb8b28853070f596166213f455c1c1806479/trim.jpg
			//   http://i-7.vcimg.com/8d8fb8b28853070f596166213f455c1c1806479/trim.jpg
			// http://i-7.vcimg.com/crop/c626725e944a9b4bd836f20be4ebf264254823(600x)/thumb.jpg
			//   http://i-7.vcimg.com/c626725e944a9b4bd836f20be4ebf264254823(600x)/thumb.jpg
			//   http://i-7.vcimg.com/c626725e944a9b4bd836f20be4ebf264254823/thumb.jpg
			// http://i-7.vcimg.com/7f4b42387d185e716a73dbe687badd6a54387%28280x%29/thumb.jpg
			//   http://i-7.vcimg.com/7f4b42387d185e716a73dbe687badd6a54387/thumb.jpg
			// filename can be anything
			return src.replace(/\/(?:crop|trim)\//, "/").replace(/(\/[0-9a-f]+)(?:\(|%28)[0-9]+x(?:[0-9]+)?(?:\)|%29)\//, "$1/");
		}

		if (domain_nosub === "zhimg.com" &&
			domain.match(/pic[0-9a-z]\.zhimg\.com/)) {
			// https://pic1.zhimg.com/74c63994d55e7307d41d39066d53eb72_1200x500.jpg
			//   https://pic1.zhimg.com/74c63994d55e7307d41d39066d53eb72.jpg
			//   https://pic1.zhimg.com/74c63994d55e7307d41d39066d53eb72_r.jpg
			// https://pic1.zhimg.com/80/4ae63ae895f29a18e035d78aad1804d8_hd.png
			//   https://pic1.zhimg.com/80/4ae63ae895f29a18e035d78aad1804d8.png
			//   https://pic1.zhimg.com/80/4ae63ae895f29a18e035d78aad1804d8_r.png
			// https://pic3.zhimg.com/90/v2-d9e93a3b23f6fe8ff5bfbb07317dce9f_250x0.jpg
			//   https://pic3.zhimg.com/90/v2-d9e93a3b23f6fe8ff5bfbb07317dce9f_r.jpg
			// https://pic1.zhimg.com/v2-6349cfe0f38eab94c9fc41a919c526c4_540x450.jpeg -- 540x540
			//   https://pic1.zhimg.com/v2-6349cfe0f38eab94c9fc41a919c526c4_r.jpeg -- 540x540
			// thanks to anonymous for reporting:
			// https://pica.zhimg.com/v2-5cb9a1ba9a5bb3ae877d83290d2901b6_l.jpg?source=1940ef5c
			//   https://pica.zhimg.com/v2-5cb9a1ba9a5bb3ae877d83290d2901b6_r.jpg?source=1940ef5c
			// thanks to n0099 on github for reporting: https://github.com/qsniyg/maxurl/issues/1219
			// https://pica.zhimg.com/70/v2-cf43c815483cd4abc039f4136bc8c8e3_1440w.avis?source=172ae18b&biz_tag=Post
			//   https://pica.zhimg.com/70/v2-cf43c815483cd4abc039f4136bc8c8e3_r.avis?source=172ae18b&biz_tag=Post
			// doesn't work with google's referer
			return {
				url: src.replace(/\/((?:v[0-9]*-)?[0-9a-f]+)(?:_[^/._]*)?(\.[^/.]*)$/, "/$1_r$2"),
				headers: {
					Referer: ""
				},
				referer_ok: {
					same_domain: true
				}
			};
		}

		// seems to returns 403 if 'referer' header is set:
		//   {"code":"40310014","msg":"invalid Referer header"}
		if (domain === "img.hb.aicdn.com" ||
			// https://hbimg.huabanimg.com/bf5ac958cea88fb4342a6a1e7d1238eb428879613bb18-Rv4G6g_fw78
			//   https://hbimg.huabanimg.com/bf5ac958cea88fb4342a6a1e7d1238eb428879613bb18-Rv4G6g
			domain === "hbimg.huabanimg.com" ||
			// thanks to anonymous for reporting:
			// https://gd-hbimg.huaban.com/63dc82b64e20c9b71904307c0a799ec1caaf43511ecfeb-JpsLz2_fw658webp
			//   https://gd-hbimg.huaban.com/63dc82b64e20c9b71904307c0a799ec1caaf43511ecfeb-JpsLz2
			domain === "gd-hbimg.huaban.com" ||
			domain_nosub === "upaiyun.com") {
			// http://img.hb.aicdn.com/504850944a803cb529c8ea7672c7959aa930b911b37e7-FjZhoC_fw658
			// http://hbimg.b0.upaiyun.com/61a5e5496ff85c52aedb1a0b88cfa6cf2fab85b25baa4-OOfVFz_fw236
			// http://hbimg.b0.upaiyun.com/24c9187996fff6a463a6e0cf33e445a5c106f840110dad-GoXNdV_fw658
			// http://hbimg.b0.upaiyun.com/eb022d252413c843904d7929cd20efad6ce5ad1d1a13b-nuwiDc_fw236
			// http://hbimg.b0.upaiyun.com/2dee7739bd27dac4368381fc5e571fc5efffa0dc1b2530-76nu98
			// http://hbimg.b0.upaiyun.com/26f0536f7035fde61b7332a3bbf1e54bf0255c4d2d07b-gZ7snl_fw658
			return {
				url: src.replace(/_[^/_]*$/, ""),
				headers: {
					Referer: ""
				}
			};
			// return src.replace(/_fw[0-9]*$/, "");
		}

		if (domain === "imagev2.xmcdn.com") {
			// http://imagev2.xmcdn.com/group22/M07/3C/67/wKgJM1rvlETB0ToJAAfrPV-PTII537.jpg!op_type=5&upload_type=album&device_type=ios&name=mobile_large&strip=0&quality=7
			//   http://imagev2.xmcdn.com/group22/M07/3C/67/wKgJM1rvlETB0ToJAAfrPV-PTII537.jpg
			// https://i2.wp.com/imagev2.xmcdn.com/group35/M08/4B/55/wKgJnFoJZEeyBE1iAAVLw1BLZEE066_mobile_large.jpg!op_type=5&upload_type=album&device_type=ios&name=mobile_large&magick=jpg&strip=1&quality=6
			//   http://imagev2.xmcdn.com/group35/M08/4B/55/wKgJnFoJZEeyBE1iAAVLw1BLZEE066.jpg
			// http://imagev2.xmcdn.com/group21/M01/EC/AE/wKgJKFiGm4_DV0_TAAJWeaCCpzE969.jpg!op_type=5&upload_type=album&device_type=ios&name=mobile_large&strip=0&quality=7
			//   http://imagev2.xmcdn.com/group21/M01/EC/AE/wKgJKFiGm4_DV0_TAAJWeaCCpzE969.jpg
			return src.replace(/![^/]*$/, "").replace(/(\/[^/]*?)(?:_[a-z_]+)?(\.[^/.]*)$/, "$1$2");
		}

		if ((domain_nosub === "bdimg.com" || domain_nosub === "baidu.com") &&
			// https://timg04.bdimg.com/timg?wapbaike&quality=60&size=b396_593&sec=1349839550&di=55fd97fcbc1e84aca81eda03ac89fa53&src=http://imgsrc.baidu.com/baike/pic/item/a1ec08fa513d2697a2dc0cf653fbb2fb4316d80a.jpg
			//   http://imgsrc.baidu.com/baike/pic/item/a1ec08fa513d2697a2dc0cf653fbb2fb4316d80a.jpg
			(domain.match(/timg.*?\.bdimg\.com/) ||
			 domain.match(/timg.*?\.baidu\.com/))) {
			// https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1490961932774&di=65b21e6bef59bf6b1f6e71f18f46008c&imgtype=0&src=http%3A%2F%2Fqcloud.dpfile.com%2Fpc%2FqqYXMqI9j2MqLzJ3hKYFqx6407skBHDx-gKkvyfBaUcZWk8eZQMRW2FeuVD9x_wbTYGVDmosZWTLal1WbWRW3A.jpg
			//   http://qcloud.dpfile.com/pc/qqYXMqI9j2MqLzJ3hKYFqx6407skBHDx-gKkvyfBaUcZWk8eZQMRW2FeuVD9x_wbTYGVDmosZWTLal1WbWRW3A.jpg
			newsrc = decodeURIComponent(src.replace(/.*\/[^/]*[?&]src=([^&]*).*/, "$1"));
			if (newsrc !== src)
				return newsrc;
		}

		if ((domain_nosub === "bdstatic.com" ||
			 domain_nosub === "baidu.com") &&
			domain.match(/gss[0-9]*\./)) {
			if (string_indexof(src, "/timg?") >= 0) {
				// https://gss3.bdstatic.com/84oSdTum2Q5BphGlnYG/timg?wapp&quality=80&size=b150_150&subsize=20480&cut_x=0&cut_w=0&cut_y=0&cut_h=0&sec=1369815402&srctrace&di=c10cad3328e6895cc32131aa4cfa7d32&wh_rate=null&src=http%3A%2F%2Fimgsrc.baidu.com%2Fforum%2Fpic%2Fitem%2F90529822720e0cf3c1045a710046f21fbf09aa4c.jpg
				//   http://imgsrc.baidu.com/forum/pic/item/90529822720e0cf3c1045a710046f21fbf09aa4c.jpg
				return {
					url: decodeURIComponent(src.replace(/.*?\/timg.*?[?&]src=([^&]*).*/, "$1")),
					head_wrong_contenttype: true
				};
			}

			if (string_indexof(src, "/sign=") >= 0 ||
				string_indexof(src, "/pic/item/") >= 0) {
				// HEAD request gives text/html
				// https://gss1.bdstatic.com/9vo3dSag_xI4khGkpoWK1HF6hhy/baike/w%3D268%3Bg%3D0/sign=3cca8ea804087bf47dec50efcae83011/d058ccbf6c81800a388738edb73533fa838b47f6.jpg
				//   https://imgsrc.baidu.com/baike/pic/item/d058ccbf6c81800a388738edb73533fa838b47f6.jpg
				return {
					url: src.replace(/:\/\/[^/]*\/[^/]*\//, "://imgsrc.baidu.com/"),
					head_wrong_contenttype: true
				};
			}
		}

		if (domain === "imgsrc.baidu.com" ||
			// http://tiebapic.baidu.com/forum/wh%3D200%2C90%3B/sign=2a1cbd806bd98d1076810433110f9437/7531232dd42a2834305a1d774cb5c9ea14cebfb1.jpg
			//   http://tiebapic.baidu.com/forum/pic/item/7531232dd42a2834305a1d774cb5c9ea14cebfb1.jpg
			// thanks to n0099 on github: https://github.com/qsniyg/maxurl/issues/1100
			// https://tiebapic.baidu.com/forum/pic/item/4ba6b7fd5266d016e17995ecd22bd40734fa350b.jpg?tbpicau=2022-12-25-05_2ae0f8dbe307e91d5228fb7b90bdc060
			//   https://imgsrc.baidu.com/forum/pic/item/4ba6b7fd5266d016e17995ecd22bd40734fa350b.jpg
			domain === "tiebapic.baidu.com" ||
			// http://c.hiphotos.baidu.com/forum/w%3D272%3Bq%3D80%3Bg%3D0/sign=9a65dccd7f8da9774e2f812c826a8924/bf848226cffc1e175a7793cf4690f603728de936.jpg?&src=http%3A%2F%2Fimgsrc.baidu.com%2Fforum%2Fpic%2Fitem%2Fbf848226cffc1e175a7793cf4690f603728de936.jpg
			//   http://imgsrc.baidu.com/forum/pic/item/bf848226cffc1e175a7793cf4690f603728de936.jpg
			// http://f.hiphotos.baidu.com/zhidao/wh=600,800/sign=be7fdbc3034f78f0805e92f54901266d/a9d3fd1f4134970a75dc55b895cad1c8a6865dfd.jpg
			//   http://f.hiphotos.baidu.com/zhidao/pic/item/a9d3fd1f4134970a75dc55b895cad1c8a6865dfd.jpg
			//   https://imgsrc.baidu.com/zhidao/pic/item/a9d3fd1f4134970a75dc55b895cad1c8a6865dfd.jpg
			(domain_nosub === "baidu.com" && domain.match(/^(?:[a-z]\.)?hiphotos\./)) ||
			// thanks to fireattack on github: https://github.com/qsniyg/maxurl/issues/22
			// https://imgsa.baidu.com/forum/w%3D580/sign=b48af07db34543a9f51bfac42e168a7b/2b3e91160924ab1890b8cfbe31fae6cd7a890b60.jpg
			//   https://imgsa.baidu.com/forum/pic/item/2b3e91160924ab1890b8cfbe31fae6cd7a890b60.jpg
			//   https://imgsrc.baidu.com/forum/pic/item/2b3e91160924ab1890b8cfbe31fae6cd7a890b60.jpg
			domain === "imgsa.baidu.com") {
			// http://imgsrc.baidu.com/forum/wh%3D200%2C90%3B/sign=a5aa97f7bb7eca80125031e5a113bbe4/f7582e381f30e924af22ade547086e061c95f734.jpg
			// http://imgsrc.baidu.com/forum/wh=200,90;/sign=a5aa97f7bb7eca80125031e5a113bbe4/f7582e381f30e924af22ade547086e061c95f734.jpg
			//   http://imgsrc.baidu.com/forum/w%3D580%3B/sign=fc7fb3a148a98226b8c12b2fbab9bb01/7af40ad162d9f2d34097153ba2ec8a136227cc5b.jpg - slightly larger
			//   http://imgsrc.baidu.com/forum/pic/item/f7582e381f30e924af22ade547086e061c95f734.jpg - orig?
			// http://imgsrc.baidu.com/forum/abpic/item/dda5e6fe9925bc31b6fe8f4b5edf8db1ca137017.jpg
			//   http://imgsrc.baidu.com/forum/pic/item/dda5e6fe9925bc31b6fe8f4b5edf8db1ca137017.jpg
			// http://imgsrc.baidu.com/forum/w%3D415/sign=e28730d85edf8db1bc2e7d653c22dddb/b164910a304e251f2b2dd5b8a786c9177e3e536c.jpg
			//   http://imgsrc.baidu.com/forum/pic/item/b164910a304e251f2b2dd5b8a786c9177e3e536c.jpg
			// https://gss1.bdstatic.com/9vo3dSag_xI4khGkpoWK1HF6hhy/baike/h%3D160/sign=750b8bdd9ceef01f52141cc3d0ff99e0/9345d688d43f879465467a97da1b0ef41ad53ac9.jpg
			//   https://gss1.bdstatic.com/9vo3dSag_xI4khGkpoWK1HF6hhy/baike/w%3D268%3Bg%3D0/sign=7f8d6ceafe246b607b0eb572d3c37d71/9345d688d43f879465467a97da1b0ef41ad53ac9.jpg
			//   https://gss1.bdstatic.com/9vo3dSag_xI4khGkpoWK1HF6hhy/baike/c0=baike933,5,5,933,330/sign=6ccfd69a7bf08202399f996d2a929088/9345d688d43f879465467a97da1b0ef41ad53ac9.jpg
			//   https://imgsrc.baidu.com/baike/c0=baike933,5,5,933,330/sign=6ccfd69a7bf08202399f996d2a929088/9345d688d43f879465467a97da1b0ef41ad53ac9.jpg
			//   http://imgsrc.baidu.com/baike/pic/item/9345d688d43f879465467a97da1b0ef41ad53ac9.jpg
			newsrc = decodeURIComponent(src.replace(/.*\/[^/]*[?&]src=([^&]*).*/, "$1"));
			if (newsrc !== src)
				return newsrc;

			newsrc = src
				.replace("/abpic/item/", "/pic/item/")
				.replace(/\/[^/]*(?:=|%3D)[^/]*\/sign=[^/]*\//, "/pic/item/");

			if (newsrc !== src)
				return {
					url: newsrc,
					head_wrong_contenttype: true
				};

			if (domain !== "imgsrc.baidu.com") {
				return remove_queries(src.replace(/:\/\/[^/]+\/+/, "://imgsrc.baidu.com/"), ["tbpicau"]);
			}

			return {
				url: newsrc,
				head_wrong_contenttype: true
			};
		}

		if (domain_nosub === "baidu.com" && string_indexof(domain, "himg.baidu.com") >= 0) {
			// http://tb.himg.baidu.com/sys/portrait/item/57cf0859
			//    http://tb.himg.baidu.com/sys/portraitn/item/57cf0859
			//    http://tb.himg.baidu.com/sys/portraitm/item/57cf0859
			//    http://tb.himg.baidu.com/sys/portraitl/item/57cf0859
			//    http://tb.himg.baidu.com/sys/original/item/57cf0859 (doesn't matter the text, can be anything other than the ones above)
			//    http://himg.baidu.com/sys/original/item/57cf4b616e6748796559656f6e0859
			return src.replace(/\/sys\/[^/]*\/item\//, "/sys/original/item/");
		}

		if (domain_nosub === "baidu.com" && /^img[0-9]*\./.test(domain)) {
			// thanks to anonymous for reporting:
			// https://img0.baidu.com/it/u=3571861246,1567596953&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=313
			//   http://img0.baidu.com/it/u=3571861246,1567596953&fm=253
			if (/\/it\/+u=/.test(src)) {
				let fm = src.match(/[?&](fm=[0-9]+)(?:[&#].*)?$/);
				if (fm) {
					return src.replace(/[?&#].*/, "&" + fm[1]);
				}
			}
		}

		if (domain_nosub === "baidu.com" && /^pics[0-9]*\./.test(domain)) {
			// thanks to anonymous for reporting:
			// https://pics5.baidu.com/feed/5fdf8db1cb13495425890cb1b5cc5253d3094ada.jpeg@f_auto?token=87cce86ae4f92f9445cdeb9c28b22a4c
			//   https://pics5.baidu.com/feed/5fdf8db1cb13495425890cb1b5cc5253d3094ada.jpeg
			return src.replace(/(\/feed\/+[0-9a-f]{5,}(?:\.[a-z]+)?)@.*/, "$1");
		}

		// p2.xiaohx.net
		// test urls can be found, but all are 403, even from the website
		// https://www.xiaohx.org/ (new address)
		// https://ftp.vpnx.cn:8080/WNZMFU.jpg
		/*if (false && domain.search(/p[0-9]*\.xiaohx\.net/) >= 0) {
			// http://p2.xiaohx.net/thumb/VZlQhgoo1.jpg
			//   http://p2.xiaohx.net/VZlQhgoo1.jpg
			return src.replace("/thumb/", "/");
		}*/

		// img1.doubanio.com
		if (domain_nosub === "doubanio.com" &&
			domain.match(/^img[0-9]*\./)) {
			// https://img3.doubanio.com/lpic/s26811681.jpg
			//   https://img3.doubanio.com/opic/s26811681.jpg
			// https://img3.doubanio.com/img/musician/small/24961.jpg
			//   https://img3.doubanio.com/img/musician/large/24961.jpg
			//   https://img3.doubanio.com/pview/musician/raw/public/p24961.jpg
			//   https://img3.doubanio.com/img/musician/o/24961.jpg -- 1426x1426
			//   https://img3.doubanio.com/view/musician/raw/public/p24961.jpg -- 404
			// https://img3.doubanio.com/pview/event_poster/large/public/ac898415e6278f1.jpg
			//   https://img3.doubanio.com/pview/event_poster/raw/public/ac898415e6278f1.jpg
			// https://img1.doubanio.com/img/celebrity/large/24687.jpg
			//   https://img1.doubanio.com/pview/celebrity/raw/public/p24687.jpg
			//   https://img1.doubanio.com/view/celebrity/o/public/p24687.jpg
			//   https://img1.doubanio.com/view/celebrity/raw/public/p24687.jpg
			// https://img1.doubanio.com/view/celebrity/l_ratio_celebrity/public/p24687.webp
			//   https://img1.doubanio.com/pview/celebrity/raw/public/p24687.jpg -- webp doesn't work
			// https://img3.doubanio.com/view/photo/sqxs/public/p2223361605.webp
			//   https://img3.doubanio.com/pview/photo/raw/public/p2223361605.jpg
			// https://img3.doubanio.com/view/subject/s/public/s4580920.jpg
			//   https://img3.doubanio.com/view/subject/raw/public/s4580920.webp
			//   https://img3.doubanio.com/view/subject/raw/public/s4580920.jpg
			// https://img3.doubanio.com/img/trailer/small/2538645310.jpg?
			//   https://img3.doubanio.com/img/trailer/medium/2538645310.jpg?
			// thanks to anonymous for reporting:
			// https://img9.doubanio.com/view/photo/s/public/p2884829504.webp -- 270x405
			//   https://img9.doubanio.com/view/photo/m/public/p2884829504.webp -- 540x810
			//   https://img9.doubanio.com/view/photo/l/public/p2884829504.webp -- 1080x1620
			//   https://img9.doubanio.com/view/photo/xl/public/p2884829504.webp -- 2160x3240
			//   https://img9.doubanio.com/view/photo/o/public/p2884829504.webp -- 3000x4500
			//   https://img9.doubanio.com/view/photo/t/public/p2884829504.webp -- 3000x4500
			//   https://img9.doubanio.com/view/photo/raw/public/p2884829504.jpg -- 3000x4500
			baseobj = {
				url: src,
				head_wrong_contentlength: true
			};

			newsrc = src.replace(/\/img\/+trailer\/+small\/+/, "/img/trailer/medium/");
			if (newsrc !== src) {
				baseobj.url = newsrc;
				return baseobj;
			}

			newsrc = src
				.replace(/\/[a-z]+(\/public\/[a-f0-9]+\.[^/.]*)$/, "/raw$1")
				.replace(/\/(?:small|medium)\//, "/large/")
				.replace(/\/[a-z]pic\//, "/opic/")
				.replace(/\/+img\/+([^/]*)\/+o\/+([0-9]+[^/]*)(?:[?#].*)?$/,
						 "/view/$1/raw/public/p$2")
				.replace(/\/+img\/+([^/]*)\/+[^/]*\/+([0-9]+[^/]*)(?:[?#].*)?$/, "/img/$1/o/$2");
			if (newsrc !== src) {
				baseobj.url = newsrc;
				return baseobj;
			}

			newsrc = src.replace(/\/view\/+subject\/+[a-z]+\/+/, "/view/subject/raw/");
			if (newsrc !== src) {
				baseobj.url = newsrc;
				return baseobj;
			}

			if (src.match(/\/+view\/+([^/]*)\/+[^/]*\/+/)) {
				newsrc = src.replace(/(\/+view\/+[^/]+\/+[^/]+\/+.*?)\.webp(?:[?#].*)?$/, "$1.jpg");
				if (newsrc !== src) {
					baseobj.url = newsrc;
					return baseobj;
				}

				newsrc = src.replace(/(\/+view\/+[^/]+\/+)o\/+/, "$1raw/");
				if (newsrc !== src) {
					baseobj.url = newsrc;
					return baseobj;
				}

				if (!/\/view\/+[^/]+\/+raw\//.test(src)) {
					newsrc = src.replace(/(\/+view\/+[^/]+\/+)[^/]+\/+/, "$1o/");
					if (newsrc !== src) {
						baseobj.url = newsrc;
						return baseobj;
					}
				}

				newsrc = src.replace(/\/+view\/+([^/]*)\/+[^/]*\/+/, "/pview/$1/raw/");
				if (newsrc !== src) {
					return fillobj_urls(add_extensions(newsrc.replace(/\.webp(?:[?#].*)?$/, ".jpg")), baseobj);
				}
			}

			return baseobj;
		}

		if (domain === "img.idol001.com") {
			// https://img.idol001.com/thumbnail/2014/12/14/e7e8a98d3a6553e71c3014549e07c7301418560761.jpg
			//   https://img.idol001.com/origin/2014/12/14/e7e8a98d3a6553e71c3014549e07c7301418560761.jpg
			// http://img.idol001.com/origin/2017/07/12/a4b9f31547c1a41a36606d1f6d94ceff1499865415_watermark.jpg
			//   http://img.idol001.com/origin/2017/07/12/a4b9f31547c1a41a36606d1f6d94ceff1499865415.jpg
			return src
				.replace(/(:\/\/[^/]*\/+)thumbnail\/+/, "$1origin/")
				.replace(/(\/[0-9a-f]+)_watermark(\.[^/.]*)$/, "$1$2");
		}

		if (domain === "star-img.idol001.com") {
			// https://star-img.idol001.com/atlas/7179/images/2019/8/23/kCfYaPyRaS1566559898247.jpg/default-w720
			//   https://star-img.idol001.com/atlas/7179/images/2019/8/23/kCfYaPyRaS1566559898247.jpg
			return src.replace(/(\/images\/+[0-9]{4}\/+(?:[0-9]{1,2}\/+){2}[^/]+\.[^/.]+)\/+[^/]*(?:[?#].*)?$/, "$1");
		}

		// for media.nrj.fr
		// http://media.nrj.fr/1900x1200/2017/11/selena-gomez-et-ariana-grande_7134.jpg
		// http://media.nrj.fr/800x600/2017/12/cover-ariana-grande-jpg5981_1375899.jpg
		// http://media.nrj.fr/436x327/113-jpg_200414.jpg
		// http://media.nrj.fr/1400x1400/2017/09/guillaume-radio-podcasts-_388327.jpg
		// http://media.nrj.fr/360x270/2017/07/julien-dore_5171.jpg
		// http://media.nrj.fr/300x500/2015/08/11907170-1042189502503923-8150073793944711126-n-jpg-9164253.jpg
		// http://media.nrj.fr/160x120/2014/10/logodjbuzz-3159-1111-8790_8361.jpg
		// http://media.nrj.fr/manu69/2017/06/fugitif-paris-2.jpg
		// http://media.nrj.fr/217x326/2013/05/the-big-bang-theory-penny_9252.jpg
		// http://media.nrj.fr/200x150/2017/01/cover-kanye-west-jpg638_1351247.jpg
		// http://image-api.nrj.fr/02_5a02579e3cb49.png?w=730&h=410
		//   http://image-api.nrj.fr/02_5a02579e3cb49.png
		// http://image-api.nrj.fr/une-chance-sur-deux_5a7ad778514a1.jpg
		// http://image-api.nrj.fr/6-jobs-etudiants-qui-recrutent-en-periode-de-fetes-istock-519555835_584fb5cc450ec.jpg
		// http://players.nrjaudio.fm/live-metadata/player/img/600x/196622-202066.JPG
		// http://www.nrj.fr/img/nrjactive/orientation/motivations/relever_des_defis.jpg
		// http://cdn.nrj-platform.fr/uploads/pages/58c59bc78b042_capture-d-cran-2017-03-12--20-03-22.jpg
		// while it can be downscaled, it can't be upscaled, can't find any other pattern
		if (domain === "image-api.nrj.fr") {
			// http://image-api.nrj.fr/http/players.nrjaudio.fm%2Flive-metadata%2Fplayer%2Fimg%2Fplayer-files%2Fnrj%2Flogos%2F640x640%2FP_logo_NRJ_wr_La_Playlist_du_jeudi_New.png?w=360&h=360
			//   http://players.nrjaudio.fm/live-metadata/player/img/player-files/nrj/logos/640x640/P_logo_NRJ_wr_La_Playlist_du_jeudi_New.png
			// https://image-api.nrj.fr/https/players.nrjaudio.fm%2Flive-metadata%2Fplayer%2Fimg%2Fplayer-files%2Fnosta%2Flogos%2Fmobile_2%2FPODCASTS-NOSTALGIE-La-Story-Nostalgie.jpg
			//   https://players.nrjaudio.fm/live-metadata/player/img/player-files/nosta/logos/mobile_2/PODCASTS-NOSTALGIE-La-Story-Nostalgie.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/(https?)\/([^/?&#]*).*?$/, "$1://$2");
			if (newsrc !== src)
				return decodeURIComponent(newsrc);
			//return "http://" + decodeURIComponent(src.replace(/.*\.nrj\.fr\/http\/([^/?&]*).*/, "$1"));
		}

		if (domain_nowww === "norwalkreflector.com" &&
			string_indexof(src, "/image/") >= 0) {
			// http://www.norwalkreflector.com/image/2018/06/25/x700_q30/Scott-Hamernik-badge.jpg
			//   http://www.norwalkreflector.com/image/2018/06/25/Scott-Hamernik-badge.jpg
			return src.replace(/(\/image\/[0-9]*\/[0-9]*\/[0-9]*\/)[^/]*\/([^/]+)$/, "$1$2");
		}

		if (domain === "assets.bwbx.io") {
			// https://assets.bwbx.io/images/users/iqjWHBFdfxIU/iY0p6s6mL24Q/v3/800x-1.png
			//   https://assets.bwbx.io/images/users/iqjWHBFdfxIU/iY0p6s6mL24Q/v3/-1x-1.png
			// https://assets.bwbx.io/images/users/iqjWHBFdfxIU/iulaO7VvcFII/v0/1200x1200.jpg
			//   https://assets.bwbx.io/images/users/iqjWHBFdfxIU/iulaO7VvcFII/v0/-1x-1.jpg -- 800x533
			//   https://assets.bwbx.io/images/users/iqjWHBFdfxIU/iulaO7VvcFII/v0/0x0.jpg -- 800x533
			return src.replace(/\/[-0-9]*x[-0-9]*(\.[^/]*)$/, "/-1x-1$1");
		}

		if (domain === "file.osen.co.kr") {
			// http://file.osen.co.kr/article_thumb/2018/01/25/201801251451774572_5a6975efc76bc_120x68.jpg
			//   http://file.osen.co.kr/article/2018/01/25/201801251451774572_5a6975efc76bc.jpg
			//   http://file.osen.co.kr/article/original/2018/01/25/201801251451774572_5a6975efc76bc.jpg
			// thanks to Bobfrnw on greasyfork for reporting this issue:
			// http://file.osen.co.kr/article/2019/02/21/201902211510774248_5c6e40fd4a1e8_1024x.jpg -- 1024x657 (proper)
			//   http://file.osen.co.kr/article/2019/02/21/201902211510774248_5c6e40fd4a1e8.jpg -- 650x417 (downscaled)
			//   http://file.osen.co.kr/article/original/2019/02/21/201902211510774248_5c6e40fd4a1e8.jpg -- 4731x3039
			// doesn't work for gifs?
			// http://file.osen.co.kr/article/2017/05/16/201705162046770073_591ae7395381a.gif
			//   http://file.osen.co.kr/article/original/2017/05/16/201705162046770073_591ae7395381a.gif -- doesn't work
			// doesn't work for older files? later 20120916 works, earlier 20120916 doesn't
			// http://file.osen.co.kr/article_thumb/2012/08/22/201208221430778898_1_80x.jpg
			//   http://file.osen.co.kr/article/2012/08/22/201208221430778898_1.jpg
			//   http://file.osen.co.kr/article/original/2012/08/22/201208221430778898_1.jpg -- doesn't work
			newsrc = src.replace(/\/article_thumb\/+([0-9]{4}\/+[0-9]{2}\/+[0-9]{2}\/+[0-9]+(?:_[^/._]*)?)_[0-9]+x(?:[0-9]+)?(\.[^/.]*)(?:[?#].*)?$/,
								 "/article/$1$2");
			if (newsrc !== src)
				return newsrc;

			return src
				.replace("/article_thumb/", "/article/")
				.replace(/\/article\/+([0-9]{4})\//, "/article/original/$1/")
				.replace(/_[0-9]+x(?:[0-9]+)?(\.[^/.]*)$/, "$1");
		}

		if (domain === "thumbnews.nateimg.co.kr") {
			// http://thumbnews.nateimg.co.kr/news130/http://news.nateimg.co.kr/orgImg/nn/2018/03/30/201803302311296710_1.jpg
			//   http://news.nateimg.co.kr/orgImg/nn/2018/03/30/201803302311296710_1.jpg
			// http://thumbnews.nateimg.co.kr/mnews105/http://news.nateimg.co.kr/orgImg/dh/2018/03/30/b38bab99257a78968bceed1266895c20.jpg
			//   http://news.nateimg.co.kr/orgImg/dh/2018/03/30/b38bab99257a78968bceed1266895c20.jpg
			return src.replace(/.*\/(?:view|m?news)[0-9]*\//, "");
		}

		if (domain === "thumb.pann.com") {
			// http://thumb.pann.com/tc_100x75/http://fimg4.pann.com/new/download.jsp?FileID=45339728
			//   http://fimg4.pann.com/new/download.jsp?FileID=45339728
			return src.replace(/^[a-z]+:\/\/[^/]*\/[^/]*\//, "");
		}

		if (domain_nosub === "nate.com" && string_indexof(domain, ".video.nate.com") >= 0) {
			// http://mpmedia003.video.nate.com/img/thumb/75_57/006/76/00/0F/B_20180413100402594366711006.jpg
			//   http://mpmedia003.video.nate.com/img/006/76/00/0F/B_20180413100402594366711006.jpg
			return src.replace(/\/img\/thumb\/[0-9]+[^/]*\//, "/img/");
		}

		if (false && string_indexof(domain, "img.sedaily.com") >= 0) {
			// http://www.sedaily.com/Photo/Gallery/Viewer/2154#48592
			//   http://img.sedaily.com/Photo/Gallery/2018/05/2154_b.jpg
			//     http://img.sedaily.com/Photo/Gallery/2018/05/2154.jpg -- completely different picture
			//   http://img.sedaily.com/Photo/Unit/2018/05/48592_s.jpg
			//     http://img.sedaily.com/Photo/Unit/2018/05/48592.jpg -- proper
			// http://img.sedaily.com/Photo/Gallery/2018/05/2149_b.jpg
			//   http://img.sedaily.com/Photo/Gallery/2018/05/2149.jpg -- works
			//   http://img.sedaily.com/Photo/Unit/2018/05/48368.jpg -- same
			// http://newsimg.sedaily.com/2018/05/20/1RZLV7PG9Q_2_m.jpg
			//   http://newsimg.sedaily.com/2018/05/20/1RZLV7PG9Q_2.jpg -- works
			// http://newsimg.sedaily.com/2018/06/15/1S0TG51GGK_1_m.jpg
			//   http://newsimg.sedaily.com/2018/06/15/1S0TG51GGK_1.jpg -- works
			// https://newsimg.sedaily.com/2018/07/15/1S23EZEURP_1_m.jpg
			//   https://newsimg.sedaily.com/2018/07/15/1S23EZEURP_1.jpg -- works
			return src.replace(/(\/[0-9]*)_[^/.]*(\.[^/.]*)$/, "$1$2");
		}

		if (domain === "newsimg.sedaily.com") {
			// https://www.sedaily.com/NewsView/1VN4SN68DC
			// https://newsimg.sedaily.com/2019/08/27/1VN4SN68DC_1_m.jpg
			//   https://newsimg.sedaily.com/2019/08/27/1VN4SN68DC_1.jpg
			// other:
			// https://newsimg.sedaily.com/2018/11/26/1S7C8XI4V3_1.jpg -- 4656x3091
			newsrc = src.replace(/(\/[0-9]{4}\/+(?:[0-9]{2}\/+){2}[^/_]+_[0-9]+)_[a-z](\.[^/.]*)(?:[?#].*)?$/, "$1$2");
			if (newsrc !== src)
				return newsrc;

			var extra = {};
			match = src.match(/\/[0-9]{4}\/+(?:[0-9]{2}\/+){2}([^/_]+)_[0-9]+(?:_[a-z])?\.[^/.]*(?:[?#].*)?$/);
			if (match) {
				extra.page = "https://www.sedaily.com/NewsView/" + match[1];
			}

			return {
				url: src,
				extra: extra
			};
		}

		if (domain === "stat.ameba.jp" ||
			domain === "stat.profile.ameba.jp") {
			return src.replace(/\/t[0-9]*_([^/]*)$/, "/o$1");
		}

		//if (domain === "livedoor.blogimg.jp") {
		if (domain_nosub === "blogimg.jp" ||
			// http://image.news.livedoor.com/newsimage/stf/5/6/5634f_249_20180424039-m.jpg
			//   http://image.news.livedoor.com/newsimage/stf/5/6/5634f_249_20180424039.jpg
			domain === "image.news.livedoor.com") {
			// http://lineofficial.blogimg.jp/en/imgs/c/5/c5832999-s.png
			//   http://lineofficial.blogimg.jp/en/imgs/c/5/c5832999.png
			return src.replace(/(\/[^/.]*)-[sm](\.[^/.]*)/, "$1$2");
		}

		if (domain === "cdn.livedoor.jp") {
			// thanks to rEnr3n on github: https://github.com/qsniyg/maxurl/issues/693
			// https://news.kstyle.com/article.ksn?articleNo=2164776
			// https://cdn.livedoor.jp/kstyle/2db7a49a8ad303b5e9cd913b125e7eb7.jpg/r.580x0
			//   https://cdn.livedoor.jp/kstyle/2db7a49a8ad303b5e9cd913b125e7eb7.jpg
			// https://cdn.livedoor.jp/kstyle/3839f6eaaad5ead8e0357b11cc01a669.jpg/r.580x0
			//   https://cdn.livedoor.jp/kstyle/3839f6eaaad5ead8e0357b11cc01a669.jpg
			return src.replace(/(\/[0-9a-f]{10,}\.[^/.]+)\/+r\.[0-9]+x[0-9]+(?:[?#].*)?$/, "$1");
		}

		if (domain === "image.cine21.com") {
			// http://image.cine21.com/resize/IMGDB/people/2004/0504/large/105535_spe45[H800-].jpg?H300
			//   http://image.cine21.com/IMGDB/people/2004/0504/large/105535_spe45.jpg
			// http://image.cine21.com/resize/cine21/still/2017/1213/11_39_08__5a3092cc9f638[X50,60].jpg
			//   http://image.cine21.com/cine21/still/2017/1213/11_39_08__5a3092cc9f638.jpg
			// http://image.cine21.com/resize/cine21/poster/2005/0603/M0010044_1[F230,329].jpg
			//   http://image.cine21.com/cine21/poster/2005/0603/M0010044_1.jpg
			return src
				.replace("/resize/", "/")
				.replace(/\/(?:small|medium)(\/[^/]*)$/, "/large$1")
				.replace(/\?.*$/, "")
				.replace(/\[[WH][-0-9]*\](\.[^/.]*)$/, "$1")
				.replace(/\[[XF][0-9]+,[0-9]+\](\.[^/.]*)$/, "$1");
		}

		if (domain === "cdnimg.melon.co.kr" ||
			// http://image.melon.co.kr/cm/album/images/022/91/986/2291986_500.jpg
			//   http://image.melon.co.kr/cm/album/images/022/91/986/2291986_org.jpg
			domain === "image.melon.co.kr" ||
			// http://kakaoimg.melon.co.kr/cm/album/images/021/33/148/2133148_500.jpg/melon/resize/200x200/quality/80/optimize
			//   http://kakaoimg.melon.co.kr/cm/album/images/021/33/148/2133148_org.jpg
			domain === "kakaoimg.melon.co.kr" ||
			// https://cdnticket.melon.co.kr/resource/image/upload/ticketopen/2020/03/20200305093126b8c9e0c8-09cb-4cfc-90a4-462a0a2e26cd.jpg/melon/resize/160x225/strip/true
			//   https://cdnticket.melon.co.kr/resource/image/upload/ticketopen/2020/03/20200305093126b8c9e0c8-09cb-4cfc-90a4-462a0a2e26cd.jpg
			domain === "cdnticket.melon.co.kr" ||
			domain === "cmtimg.melon.co.kr"/* &&
			(string_indexof(src, "/images/") >= 0 ||
			 string_indexof(src, "/image/") >= 0 ||
			 string_indexof(src, "/user_images/") >= 0)*/) {
			// thanks to soplparty on discord
			// https://cdnimg.melon.co.kr/resource/image/web/artist/bg_atist_frame.png
			// https://cdnimg.melon.co.kr/resource/image/web/main/bg_frame.png
			// thanks to anonymous for reporting:
			// https://cdnimg.melon.co.kr/resource/image/cmt/web/common/bg_frame02_54.png
			// thanks to anonymous for reporting:
			// https://cdnimg.melon.co.kr/resource/image/web/common/bg_album_frame.png
			if (/\/resource\/+image\/+web\/+(?:artist|main)\/+/.test(src) ||
				/\/resource\/+image\/+(?:cmt\/+)?web\/+common\/+bg_(?:album_)?frame/.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}

			// http://cdnimg.melon.co.kr/svc/user_images/plylst/2016/12/21/56/425022806_org.jpg?tm=20171210105300/melon/resize/x262/quality/100/optimize
			//   http://cdnimg.melon.co.kr/svc/user_images/plylst/2016/12/21/56/425022806_org.jpg
			// http://cdnimg.melon.co.kr/cm/album/images/003/74/978/374978_500.jpg/melon/resize/120/quality/80/optimize
			//   http://cdnimg.melon.co.kr/cm/album/images/003/74/978/374978_org.jpg
			// http://cdnimg.melon.co.kr/cm/artistcrop/images/006/72/337/672337_500.jpg?f88c5a23497a77f68d8ac296e218db02/melon/resize/416/quality/80/optimize
			//   http://cdnimg.melon.co.kr/cm/artistcrop/images/006/72/337/672337_org.jpg
			// http://cdnimg.melon.co.kr/cm/artistcrop/images/010/24/317/1024317_500.jpg

			// http://cdnimg.melon.co.kr/cm/mv/images/43/501/78/990/50178990_1_640.jpg/melon/quality/80/resize/144/optimize
			//   http://cdnimg.melon.co.kr/cm/mv/images/43/501/78/990/50178990_1_org.jpg
			// https://cdnimg.melon.co.kr/cm2/mv/images/wide/502/25/281/50225281_20200828140018_org.jpg

			// http://cdnimg.melon.co.kr/svc/images/main/imgUrl20180123110250.jpg/melon/quality/80
			//   http://cdnimg.melon.co.kr/svc/images/main/imgUrl20180123110250.jpg

			// http://cdnimg.melon.co.kr/resource/mobile40/cds/event/image/201711/mixnine/artist/079.jpg/melon/quality/80/resize/134/optimize

			// http://cmtimg.melon.co.kr/20180331/542/52/233808_0483.png/melon/resize/192x192/quality/80/optimize
			newsrc = src.replace(/(\.[a-zA-Z]+)\/melon\/.*/, "$1");
			if (newsrc !== src)
				return newsrc;

			if (string_indexof(src, "/images/main/") >= 0) {
				newsrc = src.replace(/(images\/.*\/[^/_]*)((_[^/.]*)_)?(_?[^/._]*)?(\.[^/.?]*)(?:[?/].*)?$/, "$1$3$5");
			} else {
				newsrc = src.replace(/(images\/.*\/[^/_]*)((_[^/.]*)_)?(_?[^/._]*)?(\.[^/.?]*)(?:[?/].*)?$/, "$1$3_org$5");
			}

			if (newsrc !== src)
				return newsrc;

			match = src.match(/\/cm[0-9]*\/+mv\/+images\/+.*\/([0-9]+)_[0-9]+_(?:[0-9]+|org)\.[^/.]+(?:[?#].*)?$/);
			if (match) {
				return {
					url: "https://www.melon.com/video/player.htm?mvId=" + match[1],
					is_pagelink: true
				};
			}
		}

		if (domain === "cdnticket.melon.co.kr") {
			// https://cdnticket.melon.co.kr/resource/image/web/common/frame_180_180_radius.png
			if (/\/resource\/+image\/+web\/+common\//.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}
		}

		if (domain_nowww === "melon.com") {
			// thanks to ambler on discord for reporting
			// https://www.melon.com/video/player.htm?mvId=50224837&menuId=&autoPlay=Y -- livestream (link given by ambler)
			// https://www.melon.com/video/player.htm?mvId=50206531&menuId=&autoPlay=Y -- short video (35 seconds)
			// https://www.melon.com/video/detail2.htm?mvId=50225043&menuId=27120101
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+video\/+(?:player|detail2)\.htm\?(?:.*&)?mvId=([0-9]+)/,
				run: function(cb, match) {
					var id = match[1];
					var cache_key = "melon_video:" + id;
					api_query(cache_key, {
						url: "https://www.melon.com/delivery/streamingInfo.json?contsId=" + id + "&contsType=VIDEO&bitrate=HD&stRight=N&_=" + Date.now(),
						imu_mode: "xhr",
						headers: {
							Referer: "https://www.melon.com/video/player.htm?mvId=" + id,
							"X-Requested-With": "XMLHttpRequest",
							"Content-Type": "application/json",
							"Accept": "application/json, text/javascript, */*; q=0.01"
						},
						json: true
					}, cb, function(done, resp, cache_key) {
						var videourl = resp.streamingInfo.encUrl;
						if (!videourl) {
							console_error(cache_key, "Unable to find video url in", resp);
							return done(null, false);
						}

						// fixme?
						if (!/\.m3u8\?/.test(videourl)) {
							console_error(cache_key, "Unknown video url type", {videourl: videourl, json: resp});
							return done(null, false);
						}

						videourl = force_https(videourl);

						return done({
							url: videourl,
							video: "hls"
						}, 60*60);
					});
				}
			});
			if (newsrc) return newsrc;
		}

		// itunes, is4-ssl.mzstatic.com
		if (domain_nosub === "mzstatic.com" && domain.match(/is[0-9](-ssl)?\.mzstatic\.com/) &&
			string_indexof(src, "/image/thumb/") >= 0) {
			// https://is3-ssl.mzstatic.com/image/thumb/Music111/v4/e1/dc/68/e1dc6808-6d55-1e38-a34d-a3807d488859/191061355977.jpg/1200x630bb.jpg
			//   https://is3-ssl.mzstatic.com/image/thumb/Music111/v4/e1/dc/68/e1dc6808-6d55-1e38-a34d-a3807d488859/191061355977.jpg/999999999x0w.jpg
			// http://is4.mzstatic.com/image/thumb/Music6/v4/4e/92/37/4e923792-948a-ae3a-dc5b-b7416c23807a/source/165x165bb.jpg
			//   http://is4.mzstatic.com/image/thumb/Music6/v4/4e/92/37/4e923792-948a-ae3a-dc5b-b7416c23807a/source/999999999x0w.jpg
			// http://a3.mzstatic.com/us/r30/Video/v4/3e/8a/b0/3e8ab028-45f5-a0dd-6a6f-84daf9f93a11/101_Dalmatians_E-Distribution_Standard_Electronic_Apple_Taiwan.jpg
			// https://s1.mzstatic.com/eu/r30/Purple71/v4/a6/be/93/a6be93ed-e301-5e91-68c2-2c5df31a4b8a/sc2732x2048.jpeg
			// http://is5.mzstatic.com/image/thumb/Music62/v4/0b/1f/36/0b1f364c-cc8f-1c8c-74a4-70cfb01d8ef4/source/100000x100000-999.jpg
			// http://a3.mzstatic.com/us/r30/Music5/v4/2e/0d/6d/2e0d6d8f-bd38-9240-b150-0e989f00374e/cover170x170.jpeg
			// http://a4.mzstatic.com/us/r30/Music62/v4/fe/61/54/fe6154f6-b064-d788-d114-4b544def3d30/cover1400x1400.jpeg
			// thanks to jonestly on discord:
			// http://is5.mzstatic.com/image/thumb/Music123/v4/6b/07/f3/6b07f378-9ec6-a46f-f742-9a8491336245/source/999999999x0w-999.png -- 6000x6000
			// thanks to n0stal6ic on matrix:
			// https://is1-ssl.mzstatic.com/image/thumb/AMCArtistImages112/v4/15/76/5d/15765d98-4aed-ec39-c630-91679ee9e082/44d44a01-da23-4c1e-ac76-7d761ee9cc3e_file_cropped.png/999999999x0w-999.png
			//   https://is1-ssl.mzstatic.com/image/thumb/AMCArtistImages112/v4/15/76/5d/15765d98-4aed-ec39-c630-91679ee9e082/44d44a01-da23-4c1e-ac76-7d761ee9cc3e_file.png/999999999x0w-999.png -- 4385x6612
			// add -999 to always set the quality to the max value (https://github.com/qsniyg/maxurl/issues/164)
			obj = {
				can_head: false // GET can return 502, but HEAD is ok
			};

			match = src.match(/\/([-0-9a-f]{20,}(?:_[^/]+)?)\/+source\/+[^/]+(?:[?#].*)?$/);
			if (!match)
				match = src.match(/\/[-0-9a-f]{20,}\/+([^/]+)\.[^/.]+\/+[^/]+(?:[?#].*)?$/);
			if (match)
				obj.filename = match[1];

			obj.url = src.replace(/\/[0-9]*x[0-9]*[a-z]*(?:-[0-9]+)?(\.[^/.]*)$/, "/999999999x0w-999$1");
			if (obj.url !== src)
				return obj;

			obj.url = src.replace(/(_file)_cropped(\.[a-z]+\/+999999999x0w[^/]+)$/, "$1$2");
			if (obj.url !== src)
				return obj;

			if (/\.png(?:[?#].*)?$/i.test(obj.url)) {
				// thanks to lrcn80 on reddit: https://github.com/qsniyg/maxurl/issues/962
				// http://is4.mzstatic.com/image/thumb/Music6/v4/4e/92/37/4e923792-948a-ae3a-dc5b-b7416c23807a/source/999999999x0w-999.png
				//   https://a1.mzstatic.com/us/r1000/063/Music6/v4/4e/92/37/4e923792-948a-ae3a-dc5b-b7416c23807a/source
				//   https://a1.mzstatic.com/us/r30/Music6/v4/4e/92/37/4e923792-948a-ae3a-dc5b-b7416c23807a/source -- same file
				// https://is3-ssl.mzstatic.com/image/thumb/Music111/v4/e1/dc/68/e1dc6808-6d55-1e38-a34d-a3807d488859/191061355977.jpg/999999999x0w-999.png
				//   https://a1.mzstatic.com/us/r1000/063/Music111/v4/e1/dc/68/e1dc6808-6d55-1e38-a34d-a3807d488859/191061355977.jpg
				// https://is2-ssl.mzstatic.com/image/thumb/Music113/v4/c5/9c/ee/c59ceefe-719d-8a49-e124-201ec8738b5d/cover.jpg/999999999x0w-999.png
				//   https://a1.mzstatic.com/us/r1000/063/Music113/v4/c5/9c/ee/c59ceefe-719d-8a49-e124-201ec8738b5d/cover.jpg
				// thanks to jonestly on discord:
				// https://is2-ssl.mzstatic.com/image/thumb/Features/d6/9d/12/dj.kdxjwtqj.jpg/316x316bb.webp
				//   https://is2-ssl.mzstatic.com/image/thumb/Features/d6/9d/12/dj.kdxjwtqj.jpg/999999999x0w-999.png
				//   https://a1.mzstatic.com/us/r1000/063/Features/d6/9d/12/dj.kdxjwtqj.jpg
				match = src.match(/image\/+thumb\/+(.*?\/+(?:[a-f0-9]{2}\/+){3}(?:[-0-9a-f]{20,}\/)?[^/]+)\//);
				if (match) {
					obj.url = "https://a1.mzstatic.com/us/r1000/063/" + match[1];
					return obj;
				}
			}

			// thanks to a-vrma on github for the idea to convert jpg to png: https://github.com/qsniyg/maxurl/issues/393
			return fillobj_urls(add_full_extensions(obj.url, ["png", "jpg"], true), obj);
		}

		if (domain_nosub === "mzstatic.com" && /^[as][0-9]+\./.test(domain)) {
			// http://a3.mzstatic.com/us/r30/Music5/v4/2e/0d/6d/2e0d6d8f-bd38-9240-b150-0e989f00374e/cover170x170.jpeg
			//   https://s3.mzstatic.com/us/r30/Music5/v4/2e/0d/6d/2e0d6d8f-bd38-9240-b150-0e989f00374e/source -- 1800x1800
			// https://s1.mzstatic.com/eu/r30/Purple71/v4/a6/be/93/a6be93ed-e301-5e91-68c2-2c5df31a4b8a/sc2732x2048.jpeg
			//   https://s1.mzstatic.com/eu/r30/Purple71/v4/a6/be/93/a6be93ed-e301-5e91-68c2-2c5df31a4b8a/source
			// doesn't work for all:
			// https://a1.mzstatic.com/us/r1000/063/Music111/v4/e1/dc/68/e1dc6808-6d55-1e38-a34d-a3807d488859/191061355977.jpg
			//   https://a1.mzstatic.com/us/r1000/063/Music111/v4/e1/dc/68/e1dc6808-6d55-1e38-a34d-a3807d488859/source -- 404
			// https://a1.mzstatic.com/us/r1000/063/Music113/v4/c5/9c/ee/c59ceefe-719d-8a49-e124-201ec8738b5d/cover.jpg
			//   https://a1.mzstatic.com/us/r1000/063/Music113/v4/c5/9c/ee/c59ceefe-719d-8a49-e124-201ec8738b5d/source
			// other:
			// thanks to jonestly on discord:
			// https://a1.mzstatic.com/us/r1000/063/Features125/v4/a3/06/29/a3062947-2a47-9a5d-1029-e35ac343ed8a/mza_7369059540633120517.jpg -- 12500x12500
			return src.replace(/(\/v4\/+(?:[a-f0-9]{2}\/+){3}[-0-9a-f]{20,}\/+)[^/]+(?:[?#].*)?$/, "$1source");
		}

		if (domain === "images.moviesrankings.com") {
			// thanks to anonymous for reporting:
			// https://images.moviesrankings.com/image/thumb/Video112/v4/8d/12/38/8d1238ab-85da-53e8-c460-3e96436fdb7b/pr_source.lsr/900x900bb.jpg
			//   https://is3-ssl.mzstatic.com/image/thumb/Video112/v4/8d/12/38/8d1238ab-85da-53e8-c460-3e96436fdb7b/pr_source.lsr/999999999x0w-999.png
			return src.replace(/^[a-z]+:\/\/[^/]+\/+/, "https://is3-ssl.mzstatic.com/");
		}

		if (domain === "img-tmdetail.alicdn.com") {
			// https://img-tmdetail.alicdn.com/bao/uploaded///img.alicdn.com/bao/uploaded/TB1_5tiidknBKNjSZKPXXX6OFXa_!!0-item_pic.jpg_160x160q90.jpg
			//   http://img.alicdn.com/bao/uploaded/TB1_5tiidknBKNjSZKPXXX6OFXa_!!0-item_pic.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+bao\/+uploaded\/+([^/]+\.[^/]+\/+)/, "$1");
			if (newsrc !== src)
				return add_http(newsrc);
		}

		if (domain_nosub === "alicdn.com" ||
			// thanks to anonymous for reporting:
			// https://ae-pic-a1.aliexpress-media.com/kf/S24e857e1e554444bb8ac7fc2dfd6f5bc7.jpg_80x80.jpg_.webp
			//   https://ae-pic-a1.aliexpress-media.com/kf/S24e857e1e554444bb8ac7fc2dfd6f5bc7.jpg
			domain_nosub === "aliexpress-media.com") {
			// https://ae01.alicdn.com/kf/HTB1AMo8a4uaVKJjSZFjq6AjmpXai/BINYEAE-new-CD-seal-State-of-Grace-Paul-Schwartz-Lisbeth-Scott-CD-disc-free-shipping.jpg_640x640.jpg
			//   https://ae01.alicdn.com/kf/HTB1AMo8a4uaVKJjSZFjq6AjmpXai/BINYEAE-new-CD-seal-State-of-Grace-Paul-Schwartz-Lisbeth-Scott-CD-disc-free-shipping.jpg
			// https://ae01.alicdn.com/kf/HT1N7knFG0dXXagOFbXQ/220255879/HT1N7knFG0dXXagOFbXQ.jpg?size=209686&height=1472&width=970&hash=b068627a285860c5226596bada694403
			//   https://ae01.alicdn.com/kf/HT1N7knFG0dXXagOFbXQ/220255879/HT1N7knFG0dXXagOFbXQ.jpg
			// https://cbu01.alicdn.com/img/ibank/2016/379/147/3522741973_1026601309.310x310.jpg
			//   https://cbu01.alicdn.com/img/ibank/2016/379/147/3522741973_1026601309.jpg
			// https://ae01.alicdn.com/kf/H2c12a31220bd493e9179002b39df1788P/Cooling-Skull-Cap-Breathable-Sweat-Wicking-Cycling-Running-Hat-Cap-Odorless-and-Sweat-absorbent-sweat-absorbent.jpg_220x220xz.jpg
			//   https://ae01.alicdn.com/kf/H2c12a31220bd493e9179002b39df1788P/Cooling-Skull-Cap-Breathable-Sweat-Wicking-Cycling-Running-Hat-Cap-Odorless-and-Sweat-absorbent-sweat-absorbent.jpg
			// thanks to nijaz-lab on github: https://github.com/qsniyg/maxurl/issues/578
			// https://ae01.alicdn.com/kf/HTB1TQqIOpXXXXbhXXXXq6xXFXXX3/Leggings-Fitness-Women-Sexy-Women-Jean-Skinny-Jeggings-Fake-Ripped-Holes-Pocket-Print-Stretchy-Slim-Leggings.jpg_Q90.jpg_.webp
			//   https://ae01.alicdn.com/kf/HTB1TQqIOpXXXXbhXXXXq6xXFXXX3/Leggings-Fitness-Women-Sexy-Women-Jean-Skinny-Jeggings-Fake-Ripped-Holes-Pocket-Print-Stretchy-Slim-Leggings.jpg_Q90.jpg
			//   https://ae01.alicdn.com/kf/HTB1TQqIOpXXXXbhXXXXq6xXFXXX3/Leggings-Fitness-Women-Sexy-Women-Jean-Skinny-Jeggings-Fake-Ripped-Holes-Pocket-Print-Stretchy-Slim-Leggings.jpg
			// thanks to AdClear247 on github: https://github.com/qsniyg/maxurl/issues/696
			// https://ae01.alicdn.com/kf/H2c12a31220bd493e9179002b39df1788P/Cooling-Skull-Cap-Breathable-Sweat-Wicking-Cycling-Running-Hat-Cap-Odorless-and-Sweat-absorbent-sweat-absorbent.jpg_q10.jpg
			//   https://ae01.alicdn.com/kf/H2c12a31220bd493e9179002b39df1788P/Cooling-Skull-Cap-Breathable-Sweat-Wicking-Cycling-Running-Hat-Cap-Odorless-and-Sweat-absorbent-sweat-absorbent.jpg
			// thanks to anonymous for reporting:
			// https://gw.alicdn.com/imgextra/i1/111942793/O1CN011WVEgBtKvAdl7O0_!!111942793.jpg_110x10000Q75.jpg
			//   https://gw.alicdn.com/imgextra/i1/111942793/O1CN011WVEgBtKvAdl7O0_!!111942793.jpg
			return src
				.replace(/\.[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1")
				.replace(/(\.[^/._?#]+)_(?:[0-9z]+x[0-9z]+(?:x[0-9z]+)?)?(?:[qQ][0-9]+)?\.[^/.]+$/, "$1")
				.replace(/(\.[^/._?#]+)_\.webp(?:[?#].*)?$/, "$1")
				.replace(/\?.*/, "");
		}

		if (domain_nosub === "1818lao.com" &&
			domain.match(/^i[0-9]*\./)) {
			// http://i0.1818lao.com/aliexpress1/kf/HTB1PMR.QXXXXXaAXVXXq6xXFXXXP/anime-swimsuits-Cosplay-Costume-D-VA-SUKUMIZU-Spandex-Swimsuit-DVA-Costume-anime-cosplay-Su-ku-water.jpg
			//   http://ae01.alicdn.com/kf/HTB1PMR.QXXXXXaAXVXXq6xXFXXXP/anime-swimsuits-Cosplay-Costume-D-VA-SUKUMIZU-Spandex-Swimsuit-DVA-Costume-anime-cosplay-Su-ku-water.jpg -- no watermark
			return src.replace(/:\/\/[^/]*\/aliexpress[0-9]*(\/kf\/)/, "://ae01.alicdn.com$1");
		}

		if (false && domain === "thumbor.forbes.com") {
			return decodeURIComponent(src.replace(/.*\/([^/]*%3A%2F%2F[^/]*).*/, "$1"));
		}

		if (domain === "lastfm-img2.akamaized.net" ||
			// thanks to TheLastZombie on github: https://github.com/qsniyg/maxurl/pull/171
			// https://lastfm.freetls.fastly.net/i/u/300x300/12b1bfb5e2ea09bf084888c6542de63d.jpg
			//   https://lastfm.freetls.fastly.net/i/u/34s/12b1bfb5e2ea09bf084888c6542de63d.jpg
			//   https://lastfm.freetls.fastly.net/i/u/12b1bfb5e2ea09bf084888c6542de63d.jpg
			// https://lastfm.freetls.fastly.net/i/u/avatar170s/286c3c59c3c14f9037f0b4ce0fef9bf5.jpg
			//   https://lastfm.freetls.fastly.net/i/u/286c3c59c3c14f9037f0b4ce0fef9bf5.jpg
			// thanks to TheLastZombie on github: https://github.com/qsniyg/maxurl/pull/594
			// https://www.last.fm/event/4273773+Bon+Iver+at+Mercedes-Benz+Arena+on+10+November+2021
			// https://lastfm.freetls.fastly.net/i/u/arXL/d7aaa8f00e775dc043cfd78650ca9153.jpg
			//   https://lastfm.freetls.fastly.net/i/u/arL/d7aaa8f00e775dc043cfd78650ca9153.jpg
			//   https://lastfm.freetls.fastly.net/i/u/d7aaa8f00e775dc043cfd78650ca9153.jpg
			//   https://lastfm.freetls.fastly.net/i/u/ar0/d7aaa8f00e775dc043cfd78650ca9153.webp -- result when clicking on the image, same size as /u/
			// thanks to anonymous for reporting:
			// https://lastfm.freetls.fastly.net/i/u/ar0/3a6656cc151d474ac74d7d9d862e6f45.jpg
			//   https://lastfm.freetls.fastly.net/i/u/3a6656cc151d474ac74d7d9d862e6f45.jpg
			domain === "lastfm.freetls.fastly.net" ||
			// http://img2-ak.lst.fm/i/u/770x0/2c2ffdfa64ad4db8d6b5e8c47474fbe8.jpg
			//   http://img2-ak.lst.fm/i/u/2c2ffdfa64ad4db8d6b5e8c47474fbe8.jpg
			domain_nosub === "lst.fm") {
			return src.replace(/\/i\/+u\/+(?:avatar)?(?:[0-9]+x[0-9]+|[0-9]+s|ar(?:X?L|[0-9]))\//, "/i/u/");
		}

		if (domain_nosub === "myspacecdn.com" &&
			domain.match(/a[0-9](?:\...)?-images\.myspacecdn\.com/)) {
			// http://a2.ec-images.myspacecdn.com/images02/152/52c2d549e3a647199831fab8c34c2b92/l.jpg
			//   http://a2.ec-images.myspacecdn.com/images02/152/52c2d549e3a647199831fab8c34c2b92/full.jpg
			// https://a3-images.myspacecdn.com/images01/3/06c1249fcc1441046241101fa905b56b/300x300.jpg
			//   https://a3-images.myspacecdn.com/images01/3/06c1249fcc1441046241101fa905b56b/full.jpg
			// doesn't work(?) for all:
			// https://a1-images.myspacecdn.com/images02/81/20f202e46332442381bbd6ac7e96dd18/300x300.jpg
			//   https://a1-images.myspacecdn.com/images02/81/20f202e46332442381bbd6ac7e96dd18/full.jpg -- 503 (service temporarily unavailable), jpeg = 403, png = 503
			// however, the photo page tries to load /full too (and fails)
			return src.replace(/\/[^/.]*(\.[^/.]*)$/, "/full$1");
		}

		if (false && domain === "pics.vampirefreaks.com") {
			// ip not found, vampirefreaks.com uses shopify now
			// https://pics.vampirefreaks.com/S/Sn/Sno/SnowWhitePoisonApple/52205231_s.jpg
			//   https://pics.vampirefreaks.com/S/Sn/Sno/SnowWhitePoisonApple/52205231.jpg
			return src.replace(/(\/[0-9]+)_s(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "geo-media.beatport.com") {
			// https://geo-media.beatport.com/image_size/250x250/e6997bab-e115-41b2-acab-3cae7bcf3615.jpg
			return {
				url: src.replace(/\/image_size\/+[0-9]*x[0-9]*\//, "/image_size/0x0/"),
				can_head: false // 400
			}
		}

		if (domain_nosub === "tumblr.com" &&
			string_indexof(domain, "media.tumblr.com") >= 0) {
			// some gifs don't play properly (same case with raw?)
			// handle this?
			// https://78.media.tumblr.com/25e643db76a1e626ff4e79faa2f7bb3d/tumblr_inline_mvspvogcB51sq8rci.jpg
			// https://static.tumblr.com/2074b5c013a08663cbfe4f86f54aad99/b70lpcc/m9Vnkyvyw/tumblr_static_d04dkibmyqokwgwsgcwggkowg.jpg
			// https://static.tumblr.com/978c2da2706d61fcdc5a13083a05c70c/yffueik/n9Znvprsi/tumblr_static_bp7fdwcxpbwc8k440ksocks8c.png
			// https://static.tumblr.com/rpaguup/J6wmdtouh/tumblr_mdipupjoku1r2xx88o1_500.png
			//   http://data.tumblr.com/rpaguup/J6wmdtouh/tumblr_mdipupjoku1r2xx88o1_raw.png -- doesn't work
			// http://media.tumblr.com/tumblr_m94wh56woC1ro0opg.png
			// http://media.tumblr.com/bbeec3764efd6b63c14fe1e56f4f5b22/tumblr_inline_mn9bgayRCZ1qz4rgp.png
			// http://media.tumblr.com/cd90bd6fe3989956567f086153430e4c/tumblr_inline_mimvhtpoYw1qz4rgp.gif
			// https://78.media.tumblr.com/tumblr_m2p6yiRZNR1qha0cy.gif
			// http://media.tumblr.com/tumblr_mah067upzv1rtyo86.gif
			// https://static.tumblr.com/ae53741763a8e9a937e587fd71c24ee5/065fclu/Okon9yxx0/tumblr_static_filename_640_v2.jpg
			// https://static.tumblr.com/9d9cb03d00947212897f5fa390615bb1/szhmsgg/PW8ok7jgi/tumblr_static_tumblr_static__640.jpg
			// https://static.tumblr.com/9873073729f37d9fb36dce1576f1f3ee/gtqzlnb/34Ync89wm/tumblr_static_tumblr_static_79qnyyc3l2os0c84swcswowks_640.gif
			// https://66.media.tumblr.com/76597bb3640f73e6af0f5cff3430f6e1/tumblr_inline_pa5nk1DnJW1twvjda_540.jpg
			//   https://66.media.tumblr.com/76597bb3640f73e6af0f5cff3430f6e1/tumblr_inline_pa5nk1DnJW1twvjda_1280.jpg
			// http://static.tumblr.com/db01df3dee618afdc00cc6e886ed1591/xjv1zxw/8G6myp4yn/tumblr_static_kirigiri.kyouko.full.1546231.jpg
			// http://media.tumblr.com/tumblr_mdsw17461H1qeaqka.jpg -- 2575x3500
			// https://static.tumblr.com/fd14a16bf8d1e9a1147933e8b5d545c1/esbkosq/XLdpbuqlf/tumblr_static_1x2wbomx0a2sko0k0s4wogw8w_2048_v2.jpg
			// http://66.media.tumblr.com/3brTgWjvCqzpp6rkLtAuUGACo1_400.jpg
			//   http://66.media.tumblr.com/3brTgWjvCqzpp6rkLtAuUGACo1_1280.jpg
			//
			// working gifs:
			// https://78.media.tumblr.com/4b9573a2fdd97a6e6cac771d4a0c0edd/tumblr_ntg9jreu9X1s5q5l6o4_400.gif
			//   http://data.tumblr.com/4b9573a2fdd97a6e6cac771d4a0c0edd/tumblr_ntg9jreu9X1s5q5l6o4_raw.gif
			//   https://78.media.tumblr.com/4b9573a2fdd97a6e6cac771d4a0c0edd/tumblr_ntg9jreu9X1s5q5l6o4_1280.gif -- works
			// https://78.media.tumblr.com/e7976904bb598ed701324ee471056156/tumblr_ntg9jreu9X1s5q5l6o3_400.gif
			//   http://data.tumblr.com/e7976904bb598ed701324ee471056156/tumblr_ntg9jreu9X1s5q5l6o3_raw.gif
			// https://78.media.tumblr.com/2d799573226814e336e0984263269507/tumblr_nwe2hfH0dX1u9vqklo1_250.gif
			//   https://s3.amazonaws.com/data.tumblr.com/2d799573226814e336e0984263269507/tumblr_nwe2hfH0dX1u9vqklo1_raw.gif
			// https://78.media.tumblr.com/tumblr_lyqq4hsfo01qdphnvo1_500.gif
			//   https://78.media.tumblr.com/tumblr_lyqq4hsfo01qdphnvo1_1280.gif
			// https://66.media.tumblr.com/cdcb216eb8e7af14c2e2d8e6d0aa0436/tumblr_nkopbvn3U81qaysjmo1_r2_500.jpg
			//   https://66.media.tumblr.com/cdcb216eb8e7af14c2e2d8e6d0aa0436/tumblr_nkopbvn3U81qaysjmo1_r2_1280.jpg
			//
			// semi-working gifs: (thanks to rEnr3n on github)
			// https://78.media.tumblr.com/b6a2ed8abae3e9f0a64ccc5bd14b5bbf/tumblr_n8w8k50vpR1r3kk98o1_250.gif -- works
			//   https://78.media.tumblr.com/b6a2ed8abae3e9f0a64ccc5bd14b5bbf/tumblr_n8w8k50vpR1r3kk98o1_1280.gif -- doesn't work (works now?)
			//
			// https://78.media.tumblr.com/a1dfad9537af0e38063ec186e2ff392e/tumblr_n87ft44o4Y1r3kk98o1_250.gif -- works
			//   https://78.media.tumblr.com/a1dfad9537af0e38063ec186e2ff392e/tumblr_n87ft44o4Y1r3kk98o1_500.gif -- doesn't work (works now?)
			//   https://78.media.tumblr.com/a1dfad9537af0e38063ec186e2ff392e/tumblr_n87ft44o4Y1r3kk98o1_1280.gif -- doesn't work (works now?)
			//   https://s3.amazonaws.com/data.tumblr.com/a1dfad9537af0e38063ec186e2ff392e/tumblr_n87ft44o4Y1r3kk98o1_raw.gif -- works
			// https://78.media.tumblr.com/b6a2ed8abae3e9f0a64ccc5bd14b5bbf/tumblr_n8w8k50vpR1r3kk98o1_250.gif
			//
			// non-working gifs: (all sizes don't work, except for _raw, credit to rEnr3n again for finding these)
			// https://78.media.tumblr.com/102fca5704db6aa1cc5e56ed7d9aa369/tumblr_n5ltfvGJC51r3kk98o1_250.gif
			//   https://s3.amazonaws.com/data.tumblr.com/102fca5704db6aa1cc5e56ed7d9aa369/tumblr_n5ltfvGJC51r3kk98o1_raw.gif -- works
			// https://78.media.tumblr.com/257cce1bd6ec64e56b1c55129ddc547d/tumblr_n5lbkmnp5g1r3kk98o1_250.gif
			//   https://s3.amazonaws.com/data.tumblr.com/257cce1bd6ec64e56b1c55129ddc547d/tumblr_n5lbkmnp5g1r3kk98o1_raw.gif -- works
			//
			// raw doesn't work:
			// https://78.media.tumblr.com/9968a8dffa5ade4eeaf6a77a1f5323e3/tumblr_inline_oca234l0kV1sszmh4_500.gif
			//   https://s3.amazonaws.com/data.tumblr.com/9968a8dffa5ade4eeaf6a77a1f5323e3/tumblr_inline_oca234l0kV1sszmh4_raw.gif
			//
			// new format:
			// https://66.media.tumblr.com/2b129630fe50ae796d9383c5ba6ba35b/9e0fb8a88fdd1bdf-10/s640x960/d1a52d700422d91b37d653867fcadf46e933a1b1.jpg
			//   https://66.media.tumblr.com/2b129630fe50ae796d9383c5ba6ba35b/9e0fb8a88fdd1bdf-10/s1280x1920/8a3215ccfce8484f565a5a7b71745c49a72ff211.jpg

			obj = {
				headers: {
					"Accept": "*/*" // otherwise it can return an HTML
				},
				problems: {
					possibly_broken: false
				}
			};

			// doesn't seem to be needed anymore
			if (false && src.match(/_[0-9]*\.gif$/)) {
				obj.problems.possibly_broken = true;
			}

			// https://78.media.tumblr.com/4efd905dfc517da760d1d53f98b5c5d4/tumblr_oy8m3u1aR01tsmy5xo1_1280.pnj
			//   https://78.media.tumblr.com/4efd905dfc517da760d1d53f98b5c5d4/tumblr_oy8m3u1aR01tsmy5xo1_1280.png
			//   https://s3.amazonaws.com/data.tumblr.com/4efd905dfc517da760d1d53f98b5c5d4/tumblr_oy8m3u1aR01tsmy5xo1_raw.png
			// https://78.media.tumblr.com/b05b512a57c51e5ead1be5159d28b428/tumblr_p8665hUaJv1sejmmmo2_540.gifv
			//   https://78.media.tumblr.com/b05b512a57c51e5ead1be5159d28b428/tumblr_p8665hUaJv1sejmmmo2_540.gif
			//   https://s3.amazonaws.com/data.tumblr.com/b05b512a57c51e5ead1be5159d28b428/tumblr_p8665hUaJv1sejmmmo2_raw.gif
			newsrc = src
				.replace(/\.pnj(\?.*)?$/, ".png$1")
				.replace(/\.gifv(\?.*)?$/, ".gif$1");
			if (newsrc !== src) {
				obj.url = newsrc;
				return obj;
			}

			// http://78.media.tumblr.com/avatar_43c10cb80f16_64.png
			//   http://78.media.tumblr.com/avatar_43c10cb80f16_512.png -- upscaled?
			if (src.match(/\/avatar_[0-9a-f]+_(?:16|64|128)\./))
				return src.replace(/_[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "_512$1");

			// https://66.media.tumblr.com/a304d969f5d0012df41d657d7e4f5c5e/tumblr_p5cne9vRBD1wsufgw_og_500.jpg
			//   https://66.media.tumblr.com/a304d969f5d0012df41d657d7e4f5c5e/tumblr_p5cne9vRBD1wsufgw_og_1280.jpg
			// https://68.media.tumblr.com/bca95f7469dda1fc0a5e133bc5d93c21/tumblr_ovczmq44pM1vm1t2io5_75sq.png
			//   https://68.media.tumblr.com/bca95f7469dda1fc0a5e133bc5d93c21/tumblr_ovczmq44pM1vm1t2io5_1280.png
			newsrc = src.replace(/(\/(?:tumblr(?:_(?:static|inline))?_)?[0-9a-zA-Z]+(?:_og)?(?:_r[0-9]*)?)_[0-9]+(?:sq)?(\.[^/.]*)$/, "$1_1280$2");
			if (newsrc !== src) {
				obj.url = newsrc;
				return obj;
			}

			// https://66.media.tumblr.com/previews/tumblr_qa1wm1nDFw1v1ooh6_filmstrip.jpg
			//   https://66.media.tumblr.com/tumblr_qa1wm1nDFw1v1ooh6_frame1.jpg
			//   https://ve.media.tumblr.com/tumblr_qa1wm1nDFw1v1ooh6.mp4
			// https://66.media.tumblr.com/tumblr_q9ruh3h3IV1rd8qzh_smart1.jpg
			//   https://ve.media.tumblr.com/tumblr_q9ruh3h3IV1rd8qzh.mp4
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+(?:previews\/+)?(tumblr_[^/_.]+)_(?:filmstrip|(?:frame|smart)1)\.jpg(?:[?#].*)?$/, "https://ve.media.tumblr.com/$1.mp4");
			if (newsrc !== src) {
				obj.url = newsrc;
				return obj;
			}

			// thanks to Wisedrow on discord for reporting that the media trick doesn't work anymore
			if (false) {
				newsrc = src.replace(/^[a-z]+:\/\/[0-9]+\.media\./, "https://media.");
				if (newsrc !== src) {
					obj.url = newsrc;
					return obj;
				}
			}

			// thanks to fireattack on discord for the link + notifying me that this is possible
			// https://66.media.tumblr.com/da5fa368ca23d24d1bf2cdcddd6c208e/26b38fdc3a5c76b6-57/s540x810/db7a535b967ca998ef133eb833d8cdb24bed5dc8.png
			//   https://66.media.tumblr.com/da5fa368ca23d24d1bf2cdcddd6c208e/26b38fdc3a5c76b6-57/s75x75_c1/66f3b76d54cd15c6ef7ff1d2f601aaff4c230bdf.png
			//   https://66.media.tumblr.com/da5fa368ca23d24d1bf2cdcddd6c208e/26b38fdc3a5c76b6-57/s2048x3072/04accefde073ce214c19e5e3d437755108e737ef.png
			// https://66.media.tumblr.com/2f1e06be02fe7b7cac4c7f1634a9fcc5/0117045da5da2818-ab/s1280x1920/c2e312c7c204a31974c1a45472a929e5ddc2b7de.jpg
			// thanks to modelfe on github: https://github.com/qsniyg/maxurl/issues/88#issuecomment-637202663
			// https://66.media.tumblr.com/7378b1813629aa8b841f6079ab9303a4/e24e926459952d1b-b1/s64x64u_c1/c7acf4139f2981e5d3ddaa6686e9240f3cf6f98d.jpg
			// thanks to anonymous for reporting:
			// https://44.media.tumblr.com/a415b30327591b1233ec0c9783b7b3bb/8876be95cf21457f-55/s400x600_f1/195209414c3eeede4e1a577c7ae527e4c279db53.gif
			if (options.do_request && options.cb && /:\/\/[^/]+\/+[0-9a-f]{32}\/+[0-9a-f]{16}-[0-9a-f]{2}\/+s[0-9]+x[0-9]+u?(?:_[fc][0-9]+)?\/+[0-9a-f]{20,}\./.test(src)) {
				var get_initialstate_from_text = function(text) {
					var match = text.match(/window\['___INITIAL_STATE___'\]\s*=\s*({.*?"ImageUrlPage":.*?})\s*;\s*(?:<\/script>[\s\S]*)?$/);
					if (!match) {
						match = text.match(/___INITIAL_STATE___">\s*({.*?})\s*<\/script/);
					}
					if (match) {
						var json = match[1].replace(/(\"\s*:)\s*(?:\/.*?\/|undefined|new RegExp\(.*?\))\s*([,}])/g, "$1null$2");

						try {
							var parsed = JSON_parse(json);
							return parsed;
						} catch (e) {
							console_error(e, {
								match: match,
								text: text,
								json: json
							});
						}

						return null;
					}

					return null;
				};

				var url_to_tumblr_imageinfo = function(url) {
					var match = url.match(/:\/\/[^/]+\/+([0-9a-f]{32})\/+([0-9a-f]{16}-[0-9a-f]{2})\/+s([0-9]+)x([0-9]+)u?(?:_[a-z][0-9]+)?\/+[0-9a-f]{20,}\.([^/.?#]+)(?:[?#].*)?$/);
					if (match) {
						return {
							mediaKey: match[1] + ":" + match[2],
							url: url,
							width: match[3],
							height: match[4]
						};
					} else {
						return null;
					}
				};

				var query_tumblr_original = function(url, cb) {
					// thanks to Regis on discord for letting me know about this trick
					url = url
						.replace(/\/s[0-9]+x[0-9]+u?(?:_c[0-9]+)?\/+([0-9a-f]{20,}\.)/, "/s999999999x999999999/$1")
						// thanks to Wisedrow on discord: https://github.com/qsniyg/maxurl/issues/340
						.replace(/:\/\/media\./, "://66.media.");

					var cache_key = "tumblr_image_page:" + url;
					api_cache.fetch(cache_key, cb, function(done) {
						options.do_request({
							url: url,
							headers: {
								Referer: "",
								"sec-fetch-mode": "navigate",
								"sec-fetch-dest": "document",
								"sec-fetch-site": "none",
								"if-none-match": "",
								"accept": "text/html" // This appears to be the important line
							},
							method: "GET",
							onload: function(resp) {
								if (resp.status !== 200) {
									console_error(cache_key, resp);
									return done(null, false);
								}

								var initialstate = get_initialstate_from_text(resp.responseText);
								if (!initialstate) {
									console_warn(cache_key, "Unable to get initial state from", resp);
									return done(null, false);
								}

								try {
									var imageresponse_raw = deepcopy(initialstate.ImageUrlPage.photo.imageResponse);

									// tumblr now returns {0: ..., 1: ...} instead of an array for some reason (thanks to Wisedrow for reporting)
									// todo: maybe add a wrapper for Array.from? not supported in earlier browsers so a shim would be needed
									var imageresponse = [];
									for (var i = 0; i < imageresponse_raw.length; i++) {
										// is this needed?
										if (!imageresponse_raw[i])
											continue;

										imageresponse.push(imageresponse_raw[i]);
									}

									var request_imageinfo;
									if (initialstate.ImageUrlPage.requestedImage) {
										request_imageinfo = url_to_tumblr_imageinfo(initialstate.ImageUrlPage.requestedImage);
										if (request_imageinfo)
											imageresponse.push(request_imageinfo);
									}

									// https://66.media.tumblr.com/7378b1813629aa8b841f6079ab9303a4/e24e926459952d1b-b1/s64x64u_c1/c7acf4139f2981e5d3ddaa6686e9240f3cf6f98d.jpg
									var page = null;
									if (initialstate.ImageUrlPage.post) {
										page = initialstate.ImageUrlPage.post.postUrl;
									}

									return done({
										images: imageresponse,
										page: page
									});
								} catch (e) {
									console_error(e, initialstate);
								}

								return done(null, false);
							}
						});
					});
				};

				var find_largest_from_media = function(media) {
					var pixels = 0;
					var obj = null;
					for (var i = 0; i < media.length; i++) {
						var ourobj = media[i];
						var ourpixels = ourobj.width * ourobj.height;

						if (ourpixels > pixels) {
							obj = ourobj;
							pixels = ourpixels;
						}
					}

					return obj;
				};

				var get_obj_from_imageinfo = function(imageinfo) {
					var largest = find_largest_from_media(imageinfo.images);

					if (!largest)
						return;

					// thanks to Wisedrow on discord for reporting that the media trick doesn't work anymore
					var obj:BigImageInfoSObject = {
						url: largest.url,//.replace(/^[a-z]+:\/\/[0-9]+\.media\./, "https://media."),
						headers: {
							"Accept": "*/*" // otherwise it can return an HTML
						},
						is_original: largest.hasOriginalDimensions
					};

					if (imageinfo.page) {
						obj.extra = {page: imageinfo.page};
					}

					return obj;
				};

				query_tumblr_original(src, function(imageinfo) {
					if (!imageinfo) {
						return options.cb(null);
					}

					var newobj:BigImageInfoObject = get_obj_from_imageinfo(imageinfo);
					newobj = fillobj(newobj, obj);
					return options.cb(newobj);
				});

				return {
					waiting: true
				};
			}
		}

		if (domain_nosub === "tumblr.com" && /media\.tumblr\.com$/.test(domain) && options && options.element &&
			options.do_request && options.cb) {
			// thanks to dogancelik on github: https://github.com/qsniyg/maxurl/issues/88#issuecomment-569612947
			// no trail:
			//   https://samirafee.tumblr.com/post/189953679332/lake-neusiedl-neusiedlersee-fert%C3%B6-largest
			//   https://samirafee.tumblr.com/post/189952698762/cat-art-by-elizabeth-katzenlinemensite
			// trail:
			//   https://samirafee.tumblr.com/post/189567617202/kerovous-own-picture-337-my-friend-and
			// custom domain:
			//   https://takashiyasui.com/

			var apikey = null;
			if (options.rule_specific && options.rule_specific.tumblr_api_key)
				apikey = options.rule_specific.tumblr_api_key;

			var get_initialstate_from_text = function(text) {
				var match = text.match(/window\['___INITIAL_STATE___'\]\s*=\s*({.*?"tumblelog":.*?})\s*;\s*(?:<\/script>[\s\S]*)?$/);
				if (match) {
					// remove regex
					var json = match[1].replace(/(\"\s*:)\s*\/.*?\/\s*([,}])/g, "$1null$2");

					try {
						var parsed = JSON_parse(json);
						return parsed;
					} catch (e) {
						console_error(e);
					}

					return null;
				}

				return null;
			};

			var get_initialstate = function() {
				var scripts = document.getElementsByTagName("script");
				for (var i = 0; i < scripts.length; i++) {
					var text = scripts[i].innerText;

					if (text.length < 100)
						continue;

					var initialstate = get_initialstate_from_text(text);
					if (initialstate)
						return initialstate;
				}

				return null;
			};

			var get_apikey_from_initialstate = function(initialstate) {
				if (initialstate && initialstate.apiFetchStore && "API_TOKEN" in initialstate.apiFetchStore) {
					return initialstate.apiFetchStore.API_TOKEN;
				}

				return null;
			};

			var initialstate = get_initialstate();
			var initialstate_api_key = get_apikey_from_initialstate(initialstate);

			var get_beta_api_key = function(cb) {
				api_cache.fetch("tumblr_api_key", cb, function(done) {
					if (initialstate_api_key) {
						return done(initialstate_api_key, 24*60*60);
					}

					options.do_request({
						method: "GET",
						url: "https://support.tumblr.com/archive",
						headers: {
							Referer: ""
						},
						onload: function(resp) {
							if (resp.readyState !== 4)
								return;

							if (resp.status !== 200) {
								console_error(resp);
								return done(null, false);
							}

							var initialstate = get_initialstate_from_text(resp.responseText);
							if (initialstate) {
								var apikey = get_apikey_from_initialstate(initialstate);
								if (apikey) {
									return done(apikey, 24*60*60);
								}
							}

							return done(null, false);
						}
					});
				});
			};

			var do_tumblr_api_call = function(path, params, cb) {
				var request_obj = {
					url: "https://api.tumblr.com/v2" + path + "?api_key=" + apikey + "&" + params,
					method: "GET",
					onload: function(resp) {
						if (resp.readyState !== 4)
							return;

						if (resp.status !== 200) {
							console_error(resp);
							return cb(null);
						}

						return cb(resp.responseText);
					}
				};

				if (!apikey) {
					get_beta_api_key(function(apikey) {
						request_obj.headers = {
							"Authorization": "Bearer " + apikey,
							"X-Version": "redpop/3/0//redpop/"
						};

						request_obj.url = request_obj.url.replace(/\?api_key=.*?&/, "?");
						options.do_request(request_obj);
					});
				} else {
					options.do_request(request_obj);
				}
			};

			var get_post_api = function(blogname, postid, cb) {
				var cache_key = "tumblr_api_blog:" + blogname + ":post:" + postid;
				api_cache.fetch(cache_key, cb, function(done) {
					do_tumblr_api_call("/blog/" + blogname + "/posts", "id=" + postid + "&npf=true", function(data) {
						if (!data) {
							return done(null, false);
						}

						try {
							var json = JSON_parse(data);
							var post = json.response.posts[0];

							var content = post.content;

							if (post.trail) {
								for (var i = 0; i < post.trail.length; i++) {
									array_extend(content, post.trail[i].content);
								}
							}

							return done(content, 6*60*60);
						} catch (e) {
							console_error(e, data);
							return done(null, false);
						}
					});
				});
			};

			var get_post_http = function(blogname, postid, cb) {
				var cache_key = "tumblr_blog_image:" + blogname + ":post:" + postid;
				api_cache.fetch(cache_key, cb, function(done) {
					options.do_request({
						url: "https://" + blogname + ".tumblr.com/image/" + postid + "/",
						method: "GET",
						onload: function(resp) {
							if (resp.readyState !== 4)
								return;

							if (resp.status !== 200) {
								console_error(resp);
								return done(null, false);
							}

							var match = resp.responseText.match(/window\['___INITIAL_STATE___'\]\s*=\s*({.*?});\s*<\/script>/);
							if (!match) {
								console_warn("Unable to find match", resp);
								return done(null, false);
							}

							// remove regex, as it's not valid JSON
							var jsontxt = match[1].replace(/,\"[^"]+?\":\/.*?,\"/, ",\"");
							try {
								var json = JSON_parse(jsontxt);
								// the json does contain apiFetchStore.API_TOKEN, but although it's also 50chars long, it returns 401
								// it also contains a csrfToken property, but I haven't seen either the api token or the csrf token being used
								var imageresponse = json.ImagePage.photo.imageResponse;

								var firstimage = {media: []};
								for (var i = 0; i < imageresponse.length; i++) {
									imageresponse[i].media_key = imageresponse[i].mediaKey;
									imageresponse[i].has_original_dimensions = imageresponse[i].hasOriginalDimensions;
									firstimage.media.push(imageresponse[i]);
								}

								return done([firstimage], 6*60*60);
							} catch(e) {
								console_error(e);
								return done(null, false);
							}
						}
					});
				});
			}

			var get_post = function(blogname, postid, cb) {
				if (apikey || initialstate_api_key) {
					return get_post_api(blogname, postid, cb);
				} else {
					get_beta_api_key(function (apikey) {
						if (apikey) {
							return get_post_api(blogname, postid, cb);
						} else {
							return get_post_http(blogname, postid, cb);
						}
					});
				}
			};

			var find_largest_from_media = function(media) {
				var pixels = 0;
				var obj = null;
				for (var i = 0; i < media.length; i++) {
					var ourobj = media[i];
					var ourpixels = ourobj.width * ourobj.height;

					if (ourpixels > pixels) {
						obj = ourobj;
						pixels = ourpixels;
					}
				}

				return obj;
			};

			var find_mediakey_from_url = function(url) {
				var match = url.match(/^[a-z]+:\/\/[^/]+\/+([0-9a-f]{32})\/+([0-9a-f]{16}-[0-9a-f]{2})\/+/);
				if (match) {
					return match[1] + ":" + match[2];
				}

				return null;
			};

			var find_media_from_post_mediakey = function(post, mediakey) {
				for (var i = 0; i < post.length; i++) {
					if (!post[i].media)
						continue;

					if (post[i].media[0].media_key === mediakey) {
						return post[i].media;
					}
				}

				return null;
			};

			var find_blogname_from_url = function(url) {
				match = url.match(/^[a-z]+:\/\/([^/.]+)\.tumblr\.com\//);
				if (match) {
					if (match[1] !== "www" && match[1] !== "support")
						return match[1];
				}

				return null;
			};

			var find_blogname_id_from_url = function(url) {
				match = url.match(/^[a-z]+:\/\/([^/.]+)\.tumblr\.com\/+post\/+([0-9]+)\//);
				if (match) {
					return {
						blogname: match[1],
						postid: match[2]
					};
				}

				return null;
			};

			var find_blogname_from_head = function() {
				if (!options.document)
					return null;

				var links = options.document.getElementsByTagName("link");
				for (var i = 0; i < links.length; i++) {
					var href = links[i].href;
					if (!href)
						continue;

					var match = href.match(/^android-app:\/\/com\.tumblr\/tumblr\/x-callback-url\/blog\?blogName=(.*?)(?:[&%].*)?$/);
					if (match) {
						return match[1];
					}
				}

				return null;
			};

			var find_blogname_from_initialstate = function() {
				if (initialstate && "tumblelog" in initialstate && "name" in initialstate.tumblelog) {
					return initialstate.tumblelog.name;
				}

				return null;
			};

			var find_postid_from_el = function(el) {
				var currentel = el;

				while ((currentel = currentel.parentElement)) {
					// tumblr homepage
					if (currentel.tagName === "ARTICLE" && currentel.hasAttribute("data-id")) {
						var id = currentel.getAttribute("data-id");
						if (/^[0-9]+$/.test(id)) {
							return id;
						}
					}

					// todo: also check for the postid through the reblog buttons
					var id = currentel.getAttribute("id");

					if (id) {
						var match = id.match(/^photoset_([0-9]+)$/);
						if (match) {
							return match[1];
						}

						if (currentel.tagName === "ARTICLE") {
							return id;
						}
					}

					// https://4seasonstaeyeon.tumblr.com/post/190718700259
					if (currentel.tagName === "A") {
						var match = currentel.href.match(/:\/\/[^/]+\/+image\/+([0-9]{8,})\/*(?:[?#].*)?$/);
						if (match) {
							return match[1];
						}
					}

					// https://ponderation.net/archive
					if (currentel.tagName === "FIGURE") {
						try {
							var as = currentel.parentElement.parentElement.getElementsByTagName("a");
							for (var i = 0; i < as.length; i++) {
								var match = as[i].href.match(/:\/\/[^/]+\/+(?:image|post)\/+([0-9]{8,})\/*(?:[?#].*)?$/);
								if (match) {
									return match[1];
								}
							}
						} catch (e) {
							console_error(e);
						}
					}
				}

				return null;
			};

			var el_has_mediakey = function(el, mediakey) {
				if (el.tagName === "IMG") {
					return find_mediakey_from_url(el.src) === mediakey;
				} else if (el.tagName === "IFRAME" && /\/post\/+[0-9]+\/+/.test(el.src)) {
					try {
						var images = el.contentDocument.querySelectorAll("img");
						for (var i = 0; i < images.length; i++) {
							if (el_has_mediakey(images[i], mediakey))
								return true;
						}
					} catch (e) {
						console_error(e, el);
						return false;
					}
				}

				return false;
			};

			var try_finding_postid_from_url = function(url) {
				if (!options.document)
					return null;

				var mediakey = find_mediakey_from_url(url);
				if (!mediakey)
					return null;

				// use api_cache because this has the chance of being relatively cpu-intensive
				// don't use fetch because this is synchronous
				var cache_key = "tumblr_url_postid:" + mediakey;
				if (api_cache.has(cache_key)) {
					return api_cache.get(cache_key);
				}

				var els = options.document.querySelectorAll("article img, article iframe");
				for (var i = 0; i < els.length; i++) {
					// todo: array_indexof(get_el_mediakeys, mediakey) >= 0, then set cache for all the media keys for performance
					if (el_has_mediakey(els[i], mediakey)) {
						var postid = find_postid_from_el(els[i]);
						if (postid) {
							api_cache.set(cache_key, postid);
						}

						return postid;
					}
				}

				return null;
			}

			var try_finding_info = function() {
				var info = find_blogname_id_from_url(options.host_url);
				if (info)
					return info;

				var blogname = find_blogname_from_url(options.host_url);
				if (!blogname) {
					blogname = find_blogname_from_head();
				}

				if (!blogname) {
					// needed for https://ponderation.net/archive
					blogname = find_blogname_from_initialstate();
				}

				if (blogname) {
					var obj:any = {
						blogname: blogname
					};

					var postid = find_postid_from_el(options.element);
					if (!postid) {
						postid = try_finding_postid_from_url(src);
					}

					if (postid) {
						obj.postid = postid;
						return obj;
					}
				} else if (host_domain_nowww === "tumblr.com") {
					// Tumblr homepage
					var currentel = options.element;
					while ((currentel = currentel.parentElement)) {
						if ((currentel.tagName === "DIV" || currentel.tagName === "ARTICLE") && currentel.getAttribute("data-json")) {
							var jsondata = currentel.getAttribute("data-json");
							try {
								var json = JSON_parse(jsondata);
								return {
									blogname: json.tumblelog,
									postid: json["post-id"]
								};
							} catch(e) {
								console_error(e);
							}

							// there likely won't be anything after this
							return null;
						}
					}
				}

				return null;
			};

			var mediakey = find_mediakey_from_url(src);
			if (mediakey) {
				var info = try_finding_info();
				if (info) {
					get_post(info.blogname, info.postid, function(data) {
						if (!data) {
							console_warn("Unable to get post data from API", info);
							return options.cb(null);
						}

						var media = find_media_from_post_mediakey(data, mediakey);
						if (!media) {
							console_warn("Unable to find media from post and mediakey", data, mediakey);
							return options.cb(null);
						}

						var largest = find_largest_from_media(media);

						var obj:BigImageInfoSObject = {url: largest.url};
						if (largest.has_original_dimensions)
							obj.is_original = true;

						return options.cb(obj);
					});

					return {
						waiting: true
					};
				}
			}
		}

		if (domain === "wc-ahba9see.c.sakurastorage.jp" ||
			// https://cdn.worldcosplay.net/553279/ydllsnlmqigtzjdeycnoucmbtreadgeplevutcww-740.jpg
			//   https://cdn.worldcosplay.net/553279/ydllsnlmqigtzjdeycnoucmbtreadgeplevutcww-3000.jpg
			// other:
			// https://cdn.worldcosplay.net/cv/31293/kiilaerajhaksniiiyobnuwhfshqsbstohlpdvws-store.jpg
			//   https://cdn.worldcosplay.net/cv/31293/kiilaerajhaksniiiyobnuwhfshqsbstohlpdvws-3000.jpg -- doesn't work
			domain === "cdn.worldcosplay.net") {
			newsrc = src;
			if (string_indexof(src, "/max-1200/") >= 0) {
				// https://wc-ahba9see.c.sakurastorage.jp/max-1200/59530/e929c45f84ace23cf416c2b6fc1c1eacb34f20bf-350x600.jpg
				//   https://wc-ahba9see.c.sakurastorage.jp/max-1200/59530/e929c45f84ace23cf416c2b6fc1c1eacb34f20bf-1200.jpg
				newsrc = src.replace(/-[0-9a-z]+(\.[^/.]*)$/, "-1200$1");
			} else {
				// https://wc-ahba9see.c.sakurastorage.jp/533191/ebqzwxdflpsovyghbvfmpvzowripdfdorrlkwogi-350x600.jpg
				//   https://wc-ahba9see.c.sakurastorage.jp/533191/ebqzwxdflpsovyghbvfmpvzowripdfdorrlkwogi-3000.jpg
				// https://wc-ahba9see.c.sakurastorage.jp/424045/hmkianomuekqviktmyruykbxejilztchdqdwgsow-350x600.jpg
				//   https://wc-ahba9see.c.sakurastorage.jp/424045/hmkianomuekqviktmyruykbxejilztchdqdwgsow-3000.jpg
				// doesn't work:
				// https://wc-ahba9see.c.sakurastorage.jp/40021/5a4bd340b2c95e674a1816f9adece947d06b1df2-100.jpg
				//   https://wc-ahba9see.c.sakurastorage.jp/40021/5a4bd340b2c95e674a1816f9adece947d06b1df2-3000.jpg -- 404
				newsrc = src.replace(/-[0-9]+(?:x[0-9]+)?(\.[^/.]*)$/, "-3000$1");
			}

			return {
				url: newsrc,
				can_head: false,
				headers: {
					Referer: ""
				},
				referer_ok: {
					same_domain: true
				}
			};
		}

		if (domain_nowww === "nautiljon.com" && src.match(/\/images[a-z]*\//)) {
			// nowww redirects to www
			// https://www.nautiljon.com/imagesmin/anime/00/48/kuroko_no_basket_2184.jpg?1517340247
			//   https://www.nautiljon.com/images/anime/00/48/kuroko_no_basket_2184.jpg?1517340247
			// https://www.nautiljon.com/images/86x86/people/00/51/il_hoon_btob_33715.jpg?1520059769
			//   https://www.nautiljon.com/images/people/00/51/il_hoon_btob_33715.jpg?1520059769
			// https://www.nautiljon.com/images/actualite/00/68/medium/1525681783131_image.jpg -- 177x250
			//   https://www.nautiljon.com/images/actualite/00/68/large/1525681783131_image.jpg -- 638x900
			//   https://www.nautiljon.com/images/actualite/00/68/1525681783131_image.jpg -- 680x960
			return src
				.replace(/\/imagesmin\//, "/images/")
				.replace(/\/images\/[0-9]+x[0-9]+\//, "/images/")
				.replace(/\/mini\/([^/]*)$/, "/$1")
				.replace(/(\/[0-9]+\/[0-9]+\/)[a-z]+\/([^/]*)$/, "$1$2");
		}

		// wall street journal:
		// A, C, D, (E,F), G, H, P, J, M
		// https://s.wsj.net/public/resources/images/BN-WV466_rotiss_A_20180103172646.jpg
		// https://s.wsj.net/public/resources/images/BN-WV466_rotiss_C_20180103172646.jpg
		// https://s.wsj.net/public/resources/images/BN-WV466_rotiss_D_20180103172646.jpg
		// https://s.wsj.net/public/resources/images/BN-WV466_rotiss_G_20180103172646.jpg
		// https://s.wsj.net/public/resources/images/BN-WV466_rotiss_M_20180103172646.jpg
		//
		// https://s.wsj.net/public/resources/images/BN-WV815_3m8WN_M_20180104143735.jpg
		// https://si.wsj.net/public/resources/images/BN-WV794_apples_M_20180104140237.jpg (s.wsj.net works too)
		//
		// doesn't support J or M:
		//
		// A, C, D, E, F, G, P
		// https://s.wsj.net/public/resources/images/OB-YL084_KoreaC_G_20130805214258.jpg
		// https://s.wsj.net/public/resources/images/OB-YL082_KoreaC_P_20130805213748.jpg
		//
		// so far it seems that P is the largest common one, but M can be larger. maybe date has something to do with it?
		//
		// other:
		// https://si.wsj.net/public/resources/images/BN-WW013_0105KO_Z120_20180104213322.jpg
		// Z120 works with "newer" urls, but not with older ones (Z0, Z100, etc. don't work)
		//
		// https://art.wsj.net/api/photos/gams-files/BN-WV826_3fHQP_A_20180104144705.jpg?width=110&height=73
		// https://s.wsj.net/public/resources/images/BN-WV826_3fHQP_A_20180104144705.jpg
		// width=0&height=0 returns a 1x1, same for width=-1&height=-1. width=8000&height=8000 results in a zoomed in image (but rather high quality nonetheless)
		// https://art.wsj.net/api/photos/gams-files/BN-WV826_3fHQP_A_20180104144705.jpg (invalid, since it requires parameters) results in:
		// {"message":"No HTTP resource was found that matches the request URI 'http://art.wsj.net/api/photos/gams-id:3fHQP/smartcrop?crophint=A'.","messageDetail":"No action was found on the controller 'PhotoApi' that matches the request."}
		// http://art.wsj.net/api/photos/gams-id:3fHQP/smartcrop
		// {"message":"No HTTP resource was found that matches the request URI 'http://art.wsj.net/api/photos/gams-id:3fHQP/smartcrop'.","messageDetail":"No action was found on the controller 'PhotoApi' that matches the request."}
		// http://art.wsj.net/api/photos/gams-id:3fHQP - works!
		//
		// https://art.wsj.net/api/photos/gams-files/BN-WV815_3m8WN_A_20180104143735.jpg?width=110&height=61
		// https://art.wsj.net/api/photos/gams-id:3m8WN
		//
		// id is base62 using 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ as the alphabet
		//
		// most don't work with this though
		//
		// https://si.wsj.net/public/resources/images/BN-KS721_GerryB_AM_20151013072049.jpg
		// M doesn't work, but P does (conversely, AM doesn't work with some old images, but seems to work with newer ones)
		// https://si.wsj.net/public/resources/images/BN-WV959_SYRDET_ER_20180104172634.jpg
		// https://s.wsj.net/public/resources/images/BN-WU361_SZA_01_D_20171229145931.jpg

		if (domain === "art.wsj.net") {
			if (string_indexof(src, "/api/photos/gams-files/") >= 0) {
				return src.replace(/\/gams-files\/[^-_/.]*-[^-_/.]*_([^/_.]*)_.*$/, "/gams-id:$1");
			}

			if (string_indexof(src, "/api/photos/gams-id:") >= 0) {
				return src.replace(/(\/gams-id:[^/]*)\/.*$/, "$1");
			}
		}

		if (domain_nosub === "fanpop.com" &&
			domain.match(/images[0-9]*\.fanpop\.com/)) {
			// http://images6.fanpop.com/image/photos/33100000/Zetsuen-No-Tempest-zetsuen-no-tempest-33126825-2048-2970.jpg
			//   http://images6.fanpop.com/image/photos/33100000/Zetsuen-No-Tempest-zetsuen-no-tempest-33126825.jpg
			// http://images1.fanpop.com/images/image_uploads/cf-calista-flockhart-912712_525_700.jpg
			//   http://images1.fanpop.com/images/image_uploads/cf-calista-flockhart-912712.jpg
			// http://images.fanpop.com/images/image_uploads/Emma-Watson--emma-watson-95242_500_400.jpg
			//   http://images.fanpop.com/images/image_uploads/Emma-Watson--emma-watson-95242.jpg
			// http://images6.fanpop.com/image/answers/3197000/3197239_1364966408102.53res_426_300.jpg
			//
			// http://images6.fanpop.com/image/photos/38000000/Zayn-Malik-2015-one-direction-38049270-2121-2500.jpg
			//   http://images6.fanpop.com/image/photos/38000000/Zayn-Malik-2015-one-direction-38049270.jpg - doesn't work
			return src
				.replace(/([0-9]+)-[0-9]+-[0-9]+(\.[^/.]*)$/, "$1$2")
				.replace(/([0-9]+)_[0-9]+_[0-9]+(\.[^/.]*)$/, "$1$2");
		}

		if (domain === "image.jimcdn.com") {
			// https://image.jimcdn.com/app/cms/image/transf/dimension=299x10000:format=png/path/s07f3459425dd27f2/image/i23aaf7ddb2a0e16d/version/1471508912/image.png
			//   https://image.jimcdn.com/app/cms/image/transf/none/path/s07f3459425dd27f2/image/i23aaf7ddb2a0e16d/version/1471508912/image.png
			// https://github.com/thumbor/thumbor/issues/564
			return src.replace(/(\/app\/cms\/image\/transf\/)[^/]*\//, "$1none/");
		}

		// useless, nearly impossible to test due to redirects
		if (false && domain === "u.jimdo.com") {
			// http://u.jimdo.com/www54/o/sef0c3710159530fc/img/i314f3a735d2ffdcc/1406803251/std/image.jpg
			//   https://image.jimcdn.com/app/cms/image/transf/none/path/sef0c3710159530fc/image/i314f3a735d2ffdcc/version/1440585179/cara-delevingne-wird-neues-kampagnengesicht-des-brit-labels-topshop.jpg
			return src.replace(/:\/\/[^/]*\/www[0-9]*\/[a-z]\/([0-9a-z]+)\/img\/(i[0-9a-f]+)\/([0-9]+)\/[^/]*\/([^/]\.[^/.]*)$/,
							   "://image.jimcdn.com/app/cms/image/transf/none/path/$1/image/$2/version/$3/$4");
		}

		if ((domain_nosub === "ladmedia.fr" ||
			 domain_nosub === "lanmedia.fr") &&
			domain.match(/(?:resize|cdn)[0-9]*-[a-z]*\./)) {
			// http://resize-parismatch.ladmedia.fr/r/625,417,center-middle,ffffff/img/var/news/storage/images/paris-match/people/meurtre-du-cousin-de-rihanna-un-suspect-en-detention-provisoire-1432127/23594795-1-fre-FR/Meurtre-du-cousin-de-Rihanna-un-suspect-en-detention-provisoire.jpg
			//   http://cdn-parismatch.ladmedia.fr/var/news/storage/images/paris-match/people/meurtre-du-cousin-de-rihanna-un-suspect-en-detention-provisoire-1432127/23594795-1-fre-FR/Meurtre-du-cousin-de-Rihanna-un-suspect-en-detention-provisoire.jpg
			// http://resize1-parismatch.ladmedia.fr/r/300,300,center-middle,ffffff/img/var/news/storage/images/paris-match/people-a-z/rihanna/5971706-8-fre-FR/Rihanna.jpg
			//   http://cdn-parismatch.ladmedia.fr/var/news/storage/images/paris-match/people-a-z/rihanna/5971706-8-fre-FR/Rihanna.jpg
			// http://resize1-doctissimo.ladmedia.fr/r/1010,,forcex/img/var/doctissimo/storage/images/fr/www/beaute/diaporamas/coiffure-de-star-coiffures-de-stars/coiffure-ciara/2440196-1-fre-FR/Le-Tie-Dye-rate-de-Ciara.jpg
			//   http://cdn-doctissimo.ladmedia.fr/var/doctissimo/storage/images/fr/www/beaute/diaporamas/coiffure-de-star-coiffures-de-stars/coiffure-ciara/2440196-1-fre-FR/Le-Tie-Dye-rate-de-Ciara.jpg
			// https://resize-public.ladmedia.fr/rcrop/140,104/img/var/public/storage/images/toutes-les-photos/photos-emilie-nef-naf-torride-en-tout-petit-bikini-wahiba-ribery-sous-le-choc-1469251/38549175-1-fre-FR/Photos-Emilie-Nef-Naf-torride-en-tout-petit-bikini-Wahiba-Ribery-sous-le-choc-!.jpg
			//   https://resize-public.ladmedia.fr/img/var/public/storage/images/toutes-les-photos/photos-emilie-nef-naf-torride-en-tout-petit-bikini-wahiba-ribery-sous-le-choc-1469251/38549175-1-fre-FR/Photos-Emilie-Nef-Naf-torride-en-tout-petit-bikini-Wahiba-Ribery-sous-le-choc-!.jpg
			//   https://cdn-public.ladmedia.fr/var/public/storage/images/toutes-les-photos/photos-emilie-nef-naf-torride-en-tout-petit-bikini-wahiba-ribery-sous-le-choc-1469251/38549175-1-fre-FR/Photos-Emilie-Nef-Naf-torride-en-tout-petit-bikini-Wahiba-Ribery-sous-le-choc-!.jpg
			// https://resize-elle.ladmedia.fr/r/625,,forcex/crop/625,625,center-middle,forcex,ffffff/img/var/plain_site/storage/images/loisirs/musique/news/selena-gomez-pourquoi-pose-t-elle-presque-nue-2982877/56148853-1-fre-FR/Selena-Gomez-pourquoi-pose-t-elle-presque-nue.png
			//   https://resize-elle.ladmedia.fr/crop/625,625,center-middle,forcex,ffffff/img/var/plain_site/storage/images/loisirs/musique/news/selena-gomez-pourquoi-pose-t-elle-presque-nue-2982877/56148853-1-fre-FR/Selena-Gomez-pourquoi-pose-t-elle-presque-nue.png
			//   https://resize-elle.ladmedia.fr/img/var/plain_site/storage/images/loisirs/musique/news/selena-gomez-pourquoi-pose-t-elle-presque-nue-2982877/56148853-1-fre-FR/Selena-Gomez-pourquoi-pose-t-elle-presque-nue.png
			//   https://cdn-elle.ladmedia.fr/var/plain_site/storage/images/loisirs/musique/news/selena-gomez-pourquoi-pose-t-elle-presque-nue-2982877/56148853-1-fre-FR/Selena-Gomez-pourquoi-pose-t-elle-presque-nue.png
			// https://resize-parismatch.lanmedia.fr/r/620,/img/var/news/storage/images/media/images/capture-d-e-cran-2015-02-06-a-11-46-142/7312692-1-fre-FR/Capture-d-e-cran-2015-02-06-a-11.46.14_original_backup.png
			//   https://cdn-parismatch.lanmedia.fr/var/news/storage/images/media/images/capture-d-e-cran-2015-02-06-a-11-46-142/7312692-1-fre-FR/Capture-d-e-cran-2015-02-06-a-11.46.14.png
			// thanks to remlap:
			// https://resize-parismatch.lanmedia.fr/f/webp/r/620,/img/var/news/storage/images/media/images/capture-d-e-cran-2015-02-06-a-11-46-142/7312692-1-fre-FR/Capture-d-e-cran-2015-02-06-a-11.46.14_original_backup.png
			//   https://cdn-parismatch.lanmedia.fr/var/news/storage/images/media/images/capture-d-e-cran-2015-02-06-a-11-46-142/7312692-1-fre-FR/Capture-d-e-cran-2015-02-06-a-11.46.14.png

			// https://resize-elle.ladmedia.fr/rcrop/638,,forcex/img/var/plain_site/storage/images/site/cannes/star-du-jour/soiree-des-trophees-chopard-2009/vahina-giocante/11296447-1-fre-FR/vahina_giocante.jpg
			//   https://cdn-elle.ladmedia.fr/var/plain_site/storage/images/site/cannes/star-du-jour/soiree-des-trophees-chopard-2009/vahina-giocante/11296447-1-fre-FR/vahina_giocante.jpg
			//
			// https://cdn2-public.ladmedia.fr/var/public/storage/images/news/photos/photos-rihanna-elle-nous-refait-le-coup-de-la-robe-fendue-et-ultra-decolletee-197341/rihanna-a-la-soiree-stella-mccartney-hier-soir-a-londres-197343/1701021-1-fre-FR/Rihanna-a-la-soiree-Stella-McCartney-hier-soir-a-Londres_portrait_w674.jpg
			//   https://cdn2-public.ladmedia.fr/var/public/storage/images/news/photos/photos-rihanna-elle-nous-refait-le-coup-de-la-robe-fendue-et-ultra-decolletee-197341/rihanna-a-la-soiree-stella-mccartney-hier-soir-a-londres-197343/1701021-1-fre-FR/Rihanna-a-la-soiree-Stella-McCartney-hier-soir-a-Londres.jpg
			return {
				url: src
					.replace(/:\/\/resize[0-9]*-([a-z]+[^/]*?)\/+img\/var\//, "://cdn-$1/var/")
					.replace(/\/(?:[rf]|crop|rcrop)\/[^/]*\//, "/")
					.replace(/_(?:original|portrait)_[a-z0-9_]+(\.[^/.]*)$/, "$1"),
				can_head: true
			};
		}

		if (domain === "resize.elle.fr") {
			// thanks to remlap:
			// https://resize.elle.fr/article/var/plain_site/storage/images/people/la-vie-des-people/news/ariana-grande-omar-sy-charlene-de-monaco-les-stars-illuminent-le-tapis-rouge-de-la-ceremonie-d-ouverture-des-jo-2024/102503276-1-fre-FR/Ariana-Grande-Omar-Sy-Charlene-de-Monaco-Les-stars-illuminent-le-tapis-rouge-de-la-ceremonie-d-ouverture-des-JO-2024.jpg
			//   https://resize.elle.fr/original/var/plain_site/storage/images/people/la-vie-des-people/news/ariana-grande-omar-sy-charlene-de-monaco-les-stars-illuminent-le-tapis-rouge-de-la-ceremonie-d-ouverture-des-jo-2024/102503276-1-fre-FR/Ariana-Grande-Omar-Sy-Charlene-de-Monaco-Les-stars-illuminent-le-tapis-rouge-de-la-ceremonie-d-ouverture-des-JO-2024.jpg
			//   https://cdn-elle.ladmedia.fr/var/plain_site/storage/images/people/la-vie-des-people/news/ariana-grande-omar-sy-charlene-de-monaco-les-stars-illuminent-le-tapis-rouge-de-la-ceremonie-d-ouverture-des-jo-2024/102503276-1-fre-FR/Ariana-Grande-Omar-Sy-Charlene-de-Monaco-Les-stars-illuminent-le-tapis-rouge-de-la-ceremonie-d-ouverture-des-JO-2024.jpg
			return src
				.replace(/:\/\/[^/]+\/+original\/+(var\/.*)$/, "://cdn-elle.ladmedia.fr/$1")
				.replace(/(:\/\/[^/]+\/+)[^/]+\/+var\/+/, "$1original/var/");
		}

		if (domain_nowww === "parismatch.com") {
			// thanks to remlap:
			// https://www.parismatch.com/lmnr/f/webp/rcrop/576,384,center-middle/img/var/pm/public/styles/paysage/public/media/image/2024/08/11/14/2024-08-11t113619z_1074125323_up1ek8b0w8iti_rtrmadp_3_olympics-2024-modernpentathlon.jpg?VersionId=vLbXvBWnVF7QFoYYM_mDd9cIoLnRHEFR
			//   https://cdn-parismatch.lanmedia.fr/var/pm/public/styles/paysage/public/media/image/2024/08/11/14/2024-08-11t113619z_1074125323_up1ek8b0w8iti_rtrmadp_3_olympics-2024-modernpentathlon.jpg?VersionId=vLbXvBWnVF7QFoYYM_mDd9cIoLnRHEFR
			return src.replace(/^[a-z]+:\/\/[^/]+\/+lmnr\/+/, "https://resize-parismatch.lanmedia.fr/");
		}

		if (domain_nosub === "imgbox.com" &&
			(domain.match(/^thumbs[0-9]*\./) ||
			 domain.match(/images[0-9]*\./))) {
			// https://thumbs2.imgbox.com/6b/e7/rklghXlY_t.jpg
			//   https://images2.imgbox.com/6b/e7/rklghXlY_o.jpg
			// https://thumbs3.imgbox.com/63/1b/bUg59AO0_b.jpg
			//   https://images3.imgbox.com/63/1b/bUg59AO0_o.jpg
			// https://5-t.imgbox.com/H8mh6PYR.jpg
			//   https://thumbs3.imgbox.com/a5/e8/H8mh6PYR_t.jpg
			//   https://images3.imgbox.com/a5/e8/H8mh6PYR_o.jpg
			// https://1-t.imgbox.com/Q3x3sr3Z.jpg
			//   https://thumbs3.imgbox.com/9d/37/Q3x3sr3Z_t.jpg
			//   https://images3.imgbox.com/9d/37/Q3x3sr3Z_o.jpg
			// http://0.t.imgbox.com/eLFM9k0c.jpg
			//   https://thumbs3.imgbox.com/e4/3f/eLFM9k0c_t.jpg
			//   https://images3.imgbox.com/e4/3f/eLFM9k0c_o.jpg
			let obj = {
				url: src
			};

			let match = src.match(/\/(?:[0-9a-f]{2}\/+){2}([^/_.]+)_([a-z])\./);
			if (match) {
				if (match[2] === "o")
					obj.is_original = true;
				obj.extra = {
					page: "https://imgbox.com/" + match[1]
				};
			}

			newsrc = src
				.replace(/\/thumbs([0-9]*)\.imgbox\.com\//, "/images$1.imgbox.com/")
				.replace(/_[a-z](\.[^/.]*)/, "_o$1");
			if (newsrc !== src) {
				obj.url = newsrc;
				return obj;
			}

			return obj;
		}

		if (domain_nosub === "imgbox.com" && /^(?:[0-9]+[-.])?t\./.test(domain) && options.do_request && options.cb) {
			newsrc = src.replace(/^[a-z]+:\/\/(?:[0-9]+[-.])?t\./, "https://t.");
			api_query("imgbox_redirect:" + newsrc, {
				url: newsrc
			}, options.cb, function(done, resp, cache_key) {
				done(resp.finalUrl, 6*60*60);
			});

			return {
				waiting: true
			};
		}

		if (domain_nowww === "imgbox.com") {
			// https://imgbox.com/images/background-body.png
			if (/\/images\/+background-body\./.test(src))
				return {
					url: src,
					bad: "mask"
				};

			newsrc = website_query({
				// no async
				website_regex: /^[a-z]+:\/\/[^/]+\/+([0-9a-zA-Z]+)(?:[?#].*)?$/,
				run: function(cb, match) {
					return cb("https://t.imgbox.com/" + match[1] + ".jpg");
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "community.akamai.steamstatic.com") {
			// https://community.akamai.steamstatic.com/public/images/sharedfiles/game_highlight_activethumb_blue.png
			if (/\/public\/+images\/+sharedfiles\/+game_highlight_activethumb/.test(src))
				return {
					url: src,
					bad: "mask"
				};

			// thanks to ljcool2006 on github: https://github.com/qsniyg/maxurl/issues/1338
			// https://community.akamai.steamstatic.com/economy/image/RgGbIK_Xaakl8PcQ2KQKK0i_2YIC7wZf7gTzKvLti-4wttL6ECYQfWnVrvtPO17Cg21bxebO3U9ipAtKlE8ALp2SN7cy4BnDeP3mbTsvYTyjoI8dxrcZq7BhYmFUB80R9lCkKSBHR24nqw/330x192?allow_animated=1
			//   https://community.akamai.steamstatic.com/economy/image/RgGbIK_Xaakl8PcQ2KQKK0i_2YIC7wZf7gTzKvLti-4wttL6ECYQfWnVrvtPO17Cg21bxebO3U9ipAtKlE8ALp2SN7cy4BnDeP3mbTsvYTyjoI8dxrcZq7BhYmFUB80R9lCkKSBHR24nqw/?allow_animated=1
			newsrc = src.replace(/(\/economy\/+image\/+[^/]+\/+)[0-9]+x[0-9]+([?#].*)?$/, "$1$2");
			if (newsrc !== src)
				return {
					url: newsrc,
					head_wrong_contentlength: true
				};
		}

		if ((domain_nosub === "steamstatic.com" && domain.match(/(?:cdn|shared)\.[^.]*\.steamstatic\.com/)) ||
			// https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/2c/2c43030ea4900ebfcd3c42a4e665e9d926b488ef_medium.jpg
			//   https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/2c/2c43030ea4900ebfcd3c42a4e665e9d926b488ef_full.jpg
			// https://steamcdn-a.akamaihd.net/steam/apps/256659790/movie480.webm?t=1452876592
			//   https://steamcdn-a.akamaihd.net/steam/apps/256659790/movie_max.webm?t=1452876592
			// https://steamcdn-a.akamaihd.net/steam/apps/256787896/movie480_vp9.webm?t=1592147233
			//   https://steamcdn-a.akamaihd.net/steam/apps/256787896/movie_max.webm?t=1592147233
			(domain_nosub === "akamaihd.net" && domain.match(/steamcdn(?:-[a-z]*)?\.akamaihd\.net/))) {
			// http://cdn.edgecast.steamstatic.com/steam/apps/405710/ss_8555059322d118b6665f1ddde6eaa987c54b2f31.600x338.jpg?t=1516755673
			//   http://cdn.edgecast.steamstatic.com/steam/apps/405710/ss_8555059322d118b6665f1ddde6eaa987c54b2f31.jpg?t=1516755673
			// http://cdn.akamai.steamstatic.com/steam/apps/678950/ss_cd54f0430e919020ce554f6cfa8d2f3b0d062716.600x338.jpg
			//   http://cdn.akamai.steamstatic.com/steam/apps/678950/ss_cd54f0430e919020ce554f6cfa8d2f3b0d062716.jpg
			// http://cdn.akamai.steamstatic.com/steamcommunity/public/images/avatars/c4/c44ec2d22a0c379d697c66b05e5ca8204827ce75.jpg
			//   http://cdn.akamai.steamstatic.com/steamcommunity/public/images/avatars/c4/c44ec2d22a0c379d697c66b05e5ca8204827ce75_full.jpg
			// thanks to siloricity on discord:
			// https://shared.akamai.steamstatic.com/store_item_assets/steam/apps/2492390/ss_7748a2bee37581349c9d477e8655d82b68c7820b.600x338.jpg
			//   https://shared.akamai.steamstatic.com/store_item_assets/steam/apps/2492390/ss_7748a2bee37581349c9d477e8655d82b68c7820b.jpg
			newsrc = src.replace(/(\/steam\/+apps\/+[0-9]+\/+movie)[0-9]+(?:_vp9)?(\.[^/.]+)(?:[?#].*)?$/, "$1_max$2");
			if (newsrc !== src)
				return newsrc;

			// https://steamcdn-a.akamaihd.net/steam/apps/256774788/movie.jpg?t=1581353800
			//   https://steamcdn-a.akamaihd.net/steam/apps/256774788/movie_max.webm
			newsrc = src.replace(/(\/steam\/+apps\/+[0-9]+\/+movie)\.(?:jpg|JPG|jpeg|JPEG|png|PNG)(?:[?#].*)?$/, "$1_max.webm");
			if (newsrc !== src)
				return {
					url: newsrc,
					video: true
				};

			// https://steamcdn-a.akamaihd.net/steamcommunity/public/images/clans/33544040/3e42984f09f867b901398c21f41c5135708d6d72_400x225.png
			//   https://steamcdn-a.akamaihd.net/steamcommunity/public/images/clans/33544040/3e42984f09f867b901398c21f41c5135708d6d72.png
			newsrc = src.replace(/(\/steamcommunity\/+public\/+images\/+clans\/+[0-9]+\/+[0-9a-f]{20,})_[0-9]+x[0-9]+(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
			if (newsrc !== src)
				return newsrc;

			if (string_indexof(src, "/public/images/avatars/") >= 0) {
				src = src.replace(/(?:_[^/.]*)?(\.[^/.]*)$/, "_full$1");
			}

			// thanks to Elexid on discord:
			// https://cdn.akamai.steamstatic.com/steam/apps/739630/library_600x900.jpg
			//   https://cdn.akamai.steamstatic.com/steam/apps/739630/library_600x900_2x.jpg
			newsrc = src.replace(/(\/steam\/+apps\/+[0-9]+\/+library_[0-9]+x[0-9]+)\./, "$1_2x.");
			if (newsrc !== src)
				return newsrc;

			return src.replace(/\.[0-9]+x[0-9]+(\.[^/]*)$/, "$1");
		}

		if (domain === "steamstore-a.akamaihd.net") {
			// https://steamstore-a.akamaihd.net/public/images/v6/app/game_page_background_shadow.png?v=2
			// https://steamstore-a.akamaihd.net/public/images/v5/ico_game_highlight_video.png
			// https://steamstore-a.akamaihd.net/public/images/v5/game_highlight_activethumb.png
			// https://steamstore-a.akamaihd.net/public/images/v6/arrows.png
			if (/\/public\/+images\/+v[0-9]*\/+(?:app\/+game_page|(?:(?:ico_)?game_|arrows\.)).*/.test(src))
				return {
					url: src,
					bad: "mask"
				};
		}

		if (domain_nosub === "steamstatic.com" && /^avatars\./.test(domain)) {
			// thanks to anonymous for reporting:
			// https://avatars.cloudflare.steamstatic.com/25263a29b06b83d76c156f8e9b14d01f9dde5c2f.jpg
			//   https://avatars.cloudflare.steamstatic.com/25263a29b06b83d76c156f8e9b14d01f9dde5c2f_medium.jpg
			//   https://avatars.steamstatic.com/25263a29b06b83d76c156f8e9b14d01f9dde5c2f_full.jpg
			return src.replace(/(:\/\/[^/]+\/+[0-9a-f]{10,})(?:_medium)?\./, "$1_full.");
		}

		if (domain_nosub === "nutaku.com" && /^cdn[0-9]*-images\./.test(domain)) {
			// https://cdn1-images.nutaku.com/images/manage/games/synthetic-love/screenshot5-thumb.jpg
			//   https://cdn1-images.nutaku.com/images/manage/games/synthetic-love/screenshot5.jpg
			return src.replace(/(\/images\/.*)-thumb(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nosub === "medium.com" &&
			(domain.match(/cdn-images-[0-9]*\.medium\.com/) ||
			 // https://miro.medium.com/fit/c/240/240/1*Znlrcvh2KRPP4xG_s9Bp7A@2x.jpeg
			 //   https://miro.medium.com/1*Znlrcvh2KRPP4xG_s9Bp7A@2x.jpeg
			 // https://miro.medium.com/v2/resize:fit:720/0*vik__ur6bXGo0jvD
			 //   https://miro.medium.com/v2/0*vik__ur6bXGo0jvD -- 3800x2533
			 domain === "miro.medium.com")) {
			// https://cdn-images-1.medium.com/fit/c/120/120/1*EBmQkTlD1aZEsZOHFiBcdg.png
			//   https://cdn-images-1.medium.com/1*EBmQkTlD1aZEsZOHFiBcdg.png
			// https://cdn-images-1.medium.com/max/800/1*BvC8Rvz4L-CLuK5Ou37qoA.png
			//   https://cdn-images-1.medium.com/1*BvC8Rvz4L-CLuK5Ou37qoA.png
			//return src.replace(/\/max\/[^/]*\//, "/");
			return src.replace(/(:\/\/[^/]*\/+(?:v2\/+)?).*?\/([^/]*)$/, "$1$2");
		}

		if ((domain_nosub === "zimbio.com" ||
			 domain_nosub === "stylebistro.com" ||
			 domain_nosub === "livingly.com") &&
			domain.match(/www[0-9]*\.pictures\.(.*\.)?[a-z]+\.com/)) {
			// http://www4.pictures.zimbio.com/bg/Calista+Flockhart+2001+SAG+Awards+FuUveoCUR9_l.jpg
			//   http://www4.pictures.zimbio.com/bg/Calista+Flockhart+2001+SAG+Awards+FuUveoCUR9_x.jpg
			// http://www4.pictures.stylebistro.com/gi/HeEXH_STdIGx.jpg
			// http://www1.pictures.gi.zimbio.com/Katy+Perry+NRJ+Music+Awards+2009+uA-QnAhT6Wul.jpg
			//   http://www1.pictures.gi.zimbio.com/Katy+Perry+NRJ+Music+Awards+2009+uA-QnAhT6Wux.jpg
			// http://www3.pictures.fp.zimbio.com/Emma+Watson+Celebs+Set+Harry+Potter+Deathly+T2P80JadJBDl.jpg
			//   http://www3.pictures.fp.zimbio.com/Emma+Watson+Celebs+Set+Harry+Potter+Deathly+T2P80JadJBDx.jpg -- doesn't work?
			// x, l, m, p, s, c, t
			return src.replace(/[a-z](\.[^/.]*)$/, "x$1");
		}

		if (domain_nowww === "theplace2.ru" ||
			// https://www.theplace.ru/archive/jordyn_jones/img/jordyn_jones_social_media_03_26_2018_1_s.jpg
			//   https://theplace.ru/archive/jordyn_jones/img/jordyn_jones_social_media_03_26_2018_1.jpg
			domain_nowww === "theplace.ru" ||
			// http://image.chaojimote.com/FashionCorrelation/%E7%BB%B4%E5%A4%9A%E5%88%A9%E4%BA%9A%C2%B7%E5%98%89%E4%B8%9D%E8%92%82_VictoriaJustice(13)_s.jpg -- 220x330
			//   http://image.chaojimote.com/FashionCorrelation/%E7%BB%B4%E5%A4%9A%E5%88%A9%E4%BA%9A%C2%B7%E5%98%89%E4%B8%9D%E8%92%82_VictoriaJustice(13).jpg -- 1500x2250
			domain === "image.chaojimote.com" ||
			// http://moviepic.manmankan.com/yybpic/yanyuan/pic/12960/319665_s.jpg
			//   http://moviepic.manmankan.com/yybpic/yanyuan/pic/12960/319665.jpg
			domain === "moviepic.manmankan.com" ||
			domain === "img.star.iecity.com") {
			// https://www.theplace2.ru/archive/calista_flockhart/img/calista611924_s.jpg
			//   https://www.theplace2.ru/archive/calista_flockhart/img/calista611924.jpg
			// http://img.star.iecity.com/Upload/File/201707/29/20170729202504241_s.jpg
			newsrc = src.replace(/_[a-z](\.[^/.]*)$/, "$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nowww === "theplace2.ru" ||
			// https://www.theplace.ru/cache/forum/pics/rachelle_lefevre_at_fox_la_screenings_gala_in_los_angeles_0-gthumb-gwdata1200-ghdata1800-gfitdatamax.jpg
			//   https://www.theplace.ru/forum/pics/rachelle_lefevre_at_fox_la_screenings_gala_in_los_angeles_0.jpg
			domain_nowww === "theplace.ru" ||
			// thanks to anonymous for reporting:
			// https://theplace-2.com/cache/archive/nadja_bender/img/nadja-bender-elle-it-gthumb-ghdata300.jpg
			//   https://theplace-2.com/archive/nadja_bender/img/nadja-bender-elle-it.jpg
			domain_nowww === "theplace-2.com") {
			// https://www.theplace2.ru/cache/archive/rihanna/img/488408753_10-gthumb-gwdata1200-ghdata1200-gfitdatamax.jpg
			//   https://www.theplace2.ru/archive/rihanna/img/488408753_10.jpg
			// https://www.theplace2.ru/cache/archive/jessica_stroup/img/Jessica_Stroup_dress-1-gthumb-gwdata1200-ghdata1200-gfitdatamax.jpg
			//   https://www.theplace2.ru/archive/jessica_stroup/img/Jessica_Stroup_dress.jpg -- different image
			//   https://www.theplace2.ru/archive/jessica_stroup/img/Jessica_Stroup_dress-1.jpg -- correct image
			return src.replace(/(:\/\/[^/]*\/)cache\/(.*?)-g[^/.]*(\.[^/.]*)/, "$1$2$3");
		}

		// NextGEN?
		if ((domain_nosub === "craveonline.com" && domain.match(/cdn[0-9]*-www\.craveonline\.com/)) ||
			// http://www.legswiki.com/pics/rachel-riley/thumbs/thumbs_Rachel-Riley-Legs-Feet1.jpg
			//   http://www.legswiki.com/pics/rachel-riley/Rachel-Riley-Legs-Feet1.jpg
			domain_nowww === "legswiki.com" ||
			// http://cdn1-www.mandatory.com/assets/uploads/gallery/milla-jovovich-of-resident-evil-at-her-hottest-mandatory/thumbs/thumbs_milla-jovovich-2.jpg
			//   http://cdn1-www.mandatory.com/assets/uploads/gallery/milla-jovovich-of-resident-evil-at-her-hottest-mandatory/milla-jovovich-2.jpg
			// https://cdn2-www.mandatory.com/assets/uploads/2018/02/kate-upton1-390x261.jpg
			//   https://cdn2-www.mandatory.com/assets/uploads/2018/02/kate-upton1.jpg
			(domain_nosub === "mandatory.com" && domain.match(/^cdn[0-9]*-www\./)) ||
			// https://www.indiancinemagallery.com/wp-content/photos/celebs/shraddha-das/thumbs/thumbs_shraddha-das-photo-shoot-stills-16.jpg
			//   https://www.indiancinemagallery.com/wp-content/photos/celebs/shraddha-das/shraddha-das-photo-shoot-stills-16.jpg
			domain_nowww === "indiancinemagallery.com" ||
			// http://www.allwomensites.com/news/gallery/five-ways-of-making-a-woman-feel-loved-and-appreciated-picture/thumbs/thumbs_Five-ways-of-making-a-woman-feel-loved-and-appreciated.jpg
			//   http://www.allwomensites.com/news/gallery/five-ways-of-making-a-woman-feel-loved-and-appreciated-picture/Five-ways-of-making-a-woman-feel-loved-and-appreciated.jpg
			(domain_nowww === "allwomensites.com" && string_indexof(src, "/gallery/") >= 0) ||
			// https://zemanceleblegs.com/wp-content/gallery/r/rachel-mcadams/thumbs/thumbs_Rachel-McAdams-Legs-Sexy-Celebrity-Picture-Zeman-Celebrity-Legs-00002.jpg
			//   https://zemanceleblegs.com/wp-content/gallery/r/rachel-mcadams/Rachel-McAdams-Legs-Sexy-Celebrity-Picture-Zeman-Celebrity-Legs-00002.jpg
			domain_nowww === "zemanceleblegs.com" ||
			// https://blog.chron.com/rodeoblog/wp-content/blogs.dir/1890/files/selena-gomez-at-rodeohouston/thumbs/thumbs_20140209_rodeo_jjh043.jpg
			//   https://blog.chron.com/rodeoblog/wp-content/blogs.dir/1890/files/selena-gomez-at-rodeohouston/20140209_rodeo_jjh043.jpg
			domain === "blog.chron.com" ||
			// https://cdn2-www.comingsoon.net/assets/uploads/gallery/anon-set-photos/thumbs/thumbs_anon0020.jpg
			//   https://cdn2-www.comingsoon.net/assets/uploads/gallery/anon-set-photos/anon0020.jpg
			(domain_nosub === "comingsoon.net" && domain.match(/cdn[0-9]*-www\./)) ||
			// http://porngirlserotica.com/hardx/wp-content/blogs.dir/16/files/alexis-blair/thumbs/thumbs_alexis-monroe-blair-williams.jpg
			//   http://porngirlserotica.com/hardx/wp-content/blogs.dir/16/files/alexis-blair/alexis-monroe-blair-williams.jpg
			(domain_nowww === "porngirlserotica.com" && /\/wp-content\/+blogs\.dir\/+[0-9]+\/+files\/+/.test(src)) ||
			// http://cdn2-www.dogtime.com/assets/uploads/gallery/shih-tzu-dog-breed-pictures/thumbs/thumbs_shih-tzu-breed-picture-6.jpg
			//   http://cdn2-www.dogtime.com/assets/uploads/gallery/shih-tzu-dog-breed-pictures/shih-tzu-breed-picture-6.jpg
			(domain_nosub === "dogtime.com" && domain.match(/cdn[0-9]*-www\./))) {
			// http://cdn2-www.craveonline.com/assets/uploads/gallery/portia-de-rossi-has-arrested-development-mandatory/thumbs/thumbs_portiaderossihotpictures13.jpg
			//   http://cdn2-www.craveonline.com/assets/uploads/gallery/portia-de-rossi-has-arrested-development-mandatory/portiaderossihotpictures13.jpg
			newsrc = src.replace("/thumbs/thumbs_", "/");
			if (newsrc !== src)
				return newsrc;

			newsrc = src.replace(/-[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "static.tvgcdn.net") {
			// http://static.tvgcdn.net/mediabin/galleries/shows/a_f/bq_bz/brothersandsisters/season3/smallcrops/brothers-sisters282sm.jpg
			//   http://static.tvgcdn.net/mediabin/galleries/shows/a_f/bq_bz/brothersandsisters/season3/brothers-sisters282.jpg
			// http://static.tvgcdn.net/mediabin/showcards/celebs/d-f/thumbs/felicity-jones_768x1024.png
			//   http://static.tvgcdn.net/mediabin/showcards/celebs/d-f/felicity-jones.png
			// return src.replace(/\/thumbs\/([^/.]*)_[0-9]+x[0-9]+(\.[^/.]*)$/, "/$1$2");
			return src
				.replace("/smallcrops/", "/")
				.replace("/thumbs/", "/")
				.replace(/sm(\.[^/.]*)$/, "$1")
				.replace(/_[0-9]+x[0-9]+(\.[^/.]*)$/, "$1");
		}

		if (domain_nosub === "blogcdn.com") {
			// https://s.blogcdn.com/slideshows/images/slides/506/163/7/S5061637/slug/l/selena-gomez-visits-the-elvis-duran-z100-morning-show-1.jpg
			// http://www.blogcdn.com/slideshows/images/slides/289/321/4/S2893214/slug/l/2013-american-music-awards-arrivals-1.jpg
			// http://www.blogcdn.com/slideshows/images/slides/289/305/8/S2893058/slug/l/2014-mtv-video-music-awards-arrivals-1.jpg
			// https://www.blogcdn.com/slideshows/images/slides/851/019/S851019/s.jpg?1
			//   https://www.blogcdn.com/slideshows/images/slides/851/019/S851019/l.jpg?1
			// only found /slug/s and /slug/l so far, tried a-z
			return src
				.replace(/(\/S[0-9]+\/)[a-z](\.[^/.]*)$/, "$1l$2")
				.replace(/\/slug\/[a-z]\//, "/slug/l/");
		}

		if (domain === "photos.imageevent.com") {
			// https://photos.imageevent.com/afap/wallpapers/movies/soulsurfer/small/AnnaSophia%20Robb%20-%20Soul%20Surfer%20-9.jpg
			//   https://photos.imageevent.com/afap/wallpapers/movies/soulsurfer/large/AnnaSophia%20Robb%20-%20Soul%20Surfer%20-9.jpg
			// http://photos.imageevent.com/afap/wallpapers/stars/bellathorne/icons/Bella%20Thorne%20and%20Zendaya%20Coleman.jpg
			//   http://photos.imageevent.com/afap/wallpapers/stars/bellathorne/Bella%20Thorne%20and%20Zendaya%20Coleman.jpg
			return src.replace(/\/(?:small|large|huge|giant|icons)\/([^/]*)$/, "/$1");
		}

		if (domain === "image.ajunews.com") {
			// http://image.ajunews.com//content/image/2015/10/10/20151010181219457255_258_161.jpg
			//   http://image.ajunews.com//content/image/2015/10/10/20151010181219457255.jpg
			return src.replace(/_[0-9]*_[0-9]*(\.[^/.]*)$/, "$1");
		}

		if (domain_nosub === "telegraph.co.uk" &&
			(domain_nowww === "telegraph.co.uk" ||
			 // https://secure.aws.telegraph.co.uk/content/dam/wellbeing/2016/12/28/graham5_trans_NvBQzQNjv4BqNyaloxhBNUSEitvcqmzeaNrVK9LoR4c_wZH1EhIay9c.jpg?imwidth=480
			 //   https://secure.aws.telegraph.co.uk/content/dam/wellbeing/2016/12/28/graham5_trans_NvBQzQNjv4BqNyaloxhBNUSEitvcqmzeaNrVK9LoR4c_wZH1EhIay9c.jpg
			 string_indexof(domain, "aws.telegraph.co.uk") >= 0 ||
			 domain === "subscriber.telegraph.co.uk")) {
			// http://www.telegraph.co.uk/content/dam/men/2016/02/26/Headerraz-small_trans_NvBQzQNjv4BqqVzuuqpFlyLIwiB6NTmJwfSVWeZ_vEN7c6bHu2jJnT8.jpg
			//       http://www.telegraph.co.uk/content/dam/men/2016/02/26/Headerraz_trans_NvBQzQNjv4BqqVzuuqpFlyLIwiB6NTmJwfSVWeZ_vEN7c6bHu2jJnT8.jpg
			// http://www.telegraph.co.uk/content/dam/luxury/2018/01/17/018_MM4_9844-large_trans_NvBQzQNjv4BqeqwG1mMdY8c_ukC_8VAhqgb1Y9UHRh9-1rvsHveO7k8.JPG
			//       http://www.telegraph.co.uk/content/dam/luxury/2018/01/17/018_MM4_9844_trans_NvBQzQNjv4BqeqwG1mMdY8c_ukC_8VAhqgb1Y9UHRh9-1rvsHveO7k8.JPG
			// http://www.telegraph.co.uk/content/dam/Author%20photos/Martin%20byline-small.png
			//       http://www.telegraph.co.uk/content/dam/Author%20photos/Martin%20byline.png
			// http://www.telegraph.co.uk/content/dam/fashion/2016/10/11/110910109_ONLINE_USE_ONLY_ONE_USE_ONLY_MUST_CREDIT_Alexi_Lubomirski_-_Harpers__Bazaar_US__MUST_HOTLI_trans_NvBQzQNjv4BqqVzuuqpFlyLIwiB6NTmJwfSVWeZ_vEN7c6bHu2jJnT8.jpg
			// http://www.telegraph.co.uk/content/dam/Travel/Cruise/titanic-1997-film-still-ship-xlarge.jpg
			//        http://www.telegraph.co.uk/content/dam/Travel/Cruise/titanic-1997-film-still-ship.jpg
			// doesn't work:
			// https://www.telegraph.co.uk/content/dam/fashion/2015/12/17/victoria-beckham-9-large_trans_NvBQzQNjv4Bq2oUEflmHZZHjcYuvN_Gr-bVmXC2g6irFbtWDjolSHWg.jpg?imwidth=480
			//   https://www.telegraph.co.uk/content/dam/fashion/2015/12/17/victoria-beckham-9_trans_NvBQzQNjv4Bq2oUEflmHZZHjcYuvN_Gr-bVmXC2g6irFbtWDjolSHWg.jpg -- doesn't work
			//   https://www.telegraph.co.uk/content/dam/fashion/2015/12/17/victoria-beckham-9-large_trans_NvBQzQNjv4Bq2oUEflmHZZHjcYuvN_Gr-bVmXC2g6irFbtWDjolSHWg.jpg -- works
			//return src.replace(/(\/[^/-]*[^-_])-(?:x*(?:large|medium|small))(_[^/]*)?(\.[^/.]*$)$/, "$1$2$3");
			return src.replace(/-(?:x*(?:large|medium|small))(_[^/]*)?(\.[^/.]*$)$/, "$1$2");
		}

		if (false && (domain === "i.telegraph.co.uk" ||
					  domain === "secure.i.telegraph.co.uk")) {
			// works:
			// http://i.telegraph.co.uk/multimedia/archive/03218/Hogwarts_3218917c.jpg
			// k, a, m, i, b, n, l, c, d, e, f, g, o, p, j, h
			// doesn't work:
			// http://i.telegraph.co.uk/multimedia/archive/02804/Felicity-Jones_2804773c.jpg
			// n, b, i, l, d, c, a, f, g, o, p, j, h
			// doesn't work:
			// https://secure.i.telegraph.co.uk/multimedia/archive/03443/London-Connections_3443046a.jpg
			//
			// https://i.telegraph.co.uk/multimedia/archive/03049/night-tube-full_3049237a.jpg
			//   https://i.telegraph.co.uk/multimedia/archive/03049/night-tube-full_3049237a.jpg - smaller
			//return src.replace(/[a-z](\.[^/.]*)$/, "k$1");
		}

		if (domain === "image.munhwa.com") {
			// http://image.munhwa.com/gen_thumb/201605/20160510MW162123225413_120.jpg
			//    http://image.munhwa.com/gen_news/201605/20160510MW162123225413_b.jpg
			// http://image.munhwa.com/gen_news/201708/2017081701032603000001_b.jpg
			// http://marathon.munhwa.com/munhwa_anyadmin/amboard/imgview.php?no=785&fno=23996&group=basic&code=gallery - very large
			//   http://marathon.munhwa.com/netizen/index02.php?sno=60&group=basic&code=gallery&category=&&abmode=view&no=23996&bsort=&bfsort=&PHPSESSID=91245c6b3debc2a851d802574460ea78 - article
			return src.replace("/gen_thumb/", "/gen_news/").replace(/_[^/._]*(\.[^/.]*$)/, "_b$1");
		}

		if (domain_nosub === "dspmedia.co.kr") {
			// http://kara.dspmedia.co.kr/data/file/karam41/thumb_125x215_100/1935537395_3AVlZGS5__YS_1284.jpg
			//   http://kara.dspmedia.co.kr/data/file/karam41/1935537395_3AVlZGS5__YS_1284.jpg
			return src.replace(/(\/file\/[^/]*\/)thumb_[0-9]*x[0-9]*[^/]*\//, "$1");
		}

		if (domain_nosub === "wixmp.com" &&
			options && options.do_request && options.cb && (!options._internal_info || !options._internal_info.deviantart_page)) {
			// https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/intermediary/f/bc11a5bd-c85a-4e07-a890-a83ce286cfee/dcqjbom-5b42308b-181c-4bb6-9108-5ce3508986e4.jpg
			// https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/f/922c6655-afbf-45cb-929f-b971943216f4/d906aqf-b0e71f31-20c2-45f4-831f-2442087fbbad.jpg/v1/fill/w_1024,h_640,q_75,strp/goblin_naturists_by_warmics_d906aqf-fullview.jpg?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1cm46YXBwOjdlMGQxODg5ODIyNjQzNzNhNWYwZDQxNWVhMGQyNmUwIiwiaXNzIjoidXJuOmFwcDo3ZTBkMTg4OTgyMjY0MzczYTVmMGQ0MTVlYTBkMjZlMCIsIm9iaiI6W1t7ImhlaWdodCI6Ijw9NjQwIiwicGF0aCI6IlwvZlwvOTIyYzY2NTUtYWZiZi00NWNiLTkyOWYtYjk3MTk0MzIxNmY0XC9kOTA2YXFmLWIwZTcxZjMxLTIwYzItNDVmNC04MzFmLTI0NDIwODdmYmJhZC5qcGciLCJ3aWR0aCI6Ijw9MTAyNCJ9XV0sImF1ZCI6WyJ1cm46c2VydmljZTppbWFnZS5vcGVyYXRpb25zIl19.FTWlO6H5303XfAWoFjliFO73UtCmv0WvMNxADrjNBGs
			// https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/f/3953b6c9-6b84-493b-9832-cc14ba59fa07/d1fl69c-907907a6-ce19-48b2-b915-f823507cbbc4.jpg?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1cm46YXBwOjdlMGQxODg5ODIyNjQzNzNhNWYwZDQxNWVhMGQyNmUwIiwiaXNzIjoidXJuOmFwcDo3ZTBkMTg4OTgyMjY0MzczYTVmMGQ0MTVlYTBkMjZlMCIsIm9iaiI6W1t7InBhdGgiOiJcL2ZcLzM5NTNiNmM5LTZiODQtNDkzYi05ODMyLWNjMTRiYTU5ZmEwN1wvZDFmbDY5Yy05MDc5MDdhNi1jZTE5LTQ4YjItYjkxNS1mODIzNTA3Y2JiYzQuanBnIn1dXSwiYXVkIjpbInVybjpzZXJ2aWNlOmZpbGUuZG93bmxvYWQiXX0.5IJp0mWnHzp_yKTxTaoNvw5c1r_1-PhUvzcvVdt_8Vk
			//   https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/intermediary/f/3953b6c9-6b84-493b-9832-cc14ba59fa07/d1fl69c-907907a6-ce19-48b2-b915-f823507cbbc4.jpg
			match = src.match(/^[a-z]+:\/\/(?:images-)?wixmp-[0-9a-f]+\.wixmp\.com\/+(?:intermediary\/+)?[^/]*\/+[-0-9a-f]+\/+([0-9a-z]+)-[-0-9a-f]+\.[^/.]+(?:\/+v[0-9]*\/.*?)?(?:[?#].*)?$/);
			if (match) {
				id = match[1];

				common_functions["deviantart_page_from_id"](options.do_request, api_cache, id, function(result) {
					options._internal_info.deviantart_page = (result && result.finalUrl) || true;

					if (!result) {
						return options.cb({
							url: null,
							waiting: false
						});
					}

					common_functions["deviantart_fullimage"](options, api_cache, src, id, function(obj) {
						if (!obj) {
							obj = {
								url: src,
								extra: {
									page: result.finalUrl
								}
							};
						}

						if (!is_array(obj))
							obj = [obj];

						var normalize_da = url => url
							.replace(/([?&])(?:token|ts)=[^&]+/g, "$1")
							.replace(/[?&]+$/, "");

						array_foreach(obj, sobj => {
							if (sobj.url) {
								var simplesrc = normalize_da(src);
								var simplenewsrc = normalize_da(sobj.url);

								// don't infinitely recurse if token keeps changing, thanks to Michyrr on reddit for reporting
								if (simplesrc === simplenewsrc)
									sobj.url = src;
							}

							sobj.forcerecurse = true;

							if (!sobj.extra) {
								sobj.extra = {
									page: result.finalUrl
								};
							}
						});

						return options.cb(obj);
					});
				});

				return {
					waiting: true
				};
			}
		}

		if (domain === "static.wixstatic.com" ||
			// https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/intermediary/f/bc11a5bd-c85a-4e07-a890-a83ce286cfee/dcqjbom-5b42308b-181c-4bb6-9108-5ce3508986e4.jpg/v1/fill/w_730,h_1095,q_70,strp/mileena_by_motesoegyi_dcqjbom-pre.jpg
			//   https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/intermediary/f/bc11a5bd-c85a-4e07-a890-a83ce286cfee/dcqjbom-5b42308b-181c-4bb6-9108-5ce3508986e4.jpg
			// doesn't work with new pattern:
			// https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/f/5a49de59-57c5-45c7-a6fb-13cf111210fb/dd0k87w-e519b8c0-7eb7-4650-82e2-4c130db1f483.jpg/v1/fill/w_1055,h_757,q_70,strp/spider_gwen_by_geofffffff_dd0k87w-pre.jpg?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1cm46YXBwOjdlMGQxODg5ODIyNjQzNzNhNWYwZDQxNWVhMGQyNmUwIiwiaXNzIjoidXJuOmFwcDo3ZTBkMTg4OTgyMjY0MzczYTVmMGQ0MTVlYTBkMjZlMCIsIm9iaiI6W1t7ImhlaWdodCI6Ijw9OTE5IiwicGF0aCI6IlwvZlwvNWE0OWRlNTktNTdjNS00NWM3LWE2ZmItMTNjZjExMTIxMGZiXC9kZDBrODd3LWU1MTliOGMwLTdlYjctNDY1MC04MmUyLTRjMTMwZGIxZjQ4My5qcGciLCJ3aWR0aCI6Ijw9MTI4MCJ9XV0sImF1ZCI6WyJ1cm46c2VydmljZTppbWFnZS5vcGVyYXRpb25zIl19.zs91pq07IIAEgdwq2HSOfdOYkd6BNaYM6IziFXRjn2M
			// however, adding intermediary does work:
			// https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/intermediary/f/5a49de59-57c5-45c7-a6fb-13cf111210fb/dd0k87w-e519b8c0-7eb7-4650-82e2-4c130db1f483.jpg/v1/fill/w_1055,h_757,q_70,strp/spider_gwen_by_geofffffff_dd0k87w-pre.jpg
			//   https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/intermediary/f/5a49de59-57c5-45c7-a6fb-13cf111210fb/dd0k87w-e519b8c0-7eb7-4650-82e2-4c130db1f483.jpg
			// intermediary no longer works:
			// https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/f/58f002d0-3a61-4c38-9c1a-8cb2e93669b0/dd2w0bq-f554248d-cf71-4636-8969-cb10312b2e3e.png/v1/fill/w_1089,h_734,q_70,strp/tattletale_and_simurgh_by_flick_the_thief_dd2w0bq-pre.jpg?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1cm46YXBwOjdlMGQxODg5ODIyNjQzNzNhNWYwZDQxNWVhMGQyNmUwIiwiaXNzIjoidXJuOmFwcDo3ZTBkMTg4OTgyMjY0MzczYTVmMGQ0MTVlYTBkMjZlMCIsIm9iaiI6W1t7ImhlaWdodCI6Ijw9ODYzIiwicGF0aCI6IlwvZlwvNThmMDAyZDAtM2E2MS00YzM4LTljMWEtOGNiMmU5MzY2OWIwXC9kZDJ3MGJxLWY1NTQyNDhkLWNmNzEtNDYzNi04OTY5LWNiMTAzMTJiMmUzZS5wbmciLCJ3aWR0aCI6Ijw9MTI4MCJ9XV0sImF1ZCI6WyJ1cm46c2VydmljZTppbWFnZS5vcGVyYXRpb25zIl19.TMMxZM4DrSwX05FkjFjoFPkpZpO_wsuKg9kVtGmtL1Y
			// smaller than original (thanks to Dragoniel on reddit):
			// https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/f/d7920e4f-e2a6-4606-8a1d-3968edc0e298/dd0ns3a-3fcfe503-39bd-4e45-b6ca-9c3ed62e4721.png/v1/fill/w_1024,h_1152,q_80,strp/night_and_light_fury_by_luckycessy_dd0ns3a-fullview.jpg?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1cm46YXBwOjdlMGQxODg5ODIyNjQzNzNhNWYwZDQxNWVhMGQyNmUwIiwiaXNzIjoidXJuOmFwcDo3ZTBkMTg4OTgyMjY0MzczYTVmMGQ0MTVlYTBkMjZlMCIsIm9iaiI6W1t7ImhlaWdodCI6Ijw9MTE1MiIsInBhdGgiOiJcL2ZcL2Q3OTIwZTRmLWUyYTYtNDYwNi04YTFkLTM5NjhlZGMwZTI5OFwvZGQwbnMzYS0zZmNmZTUwMy0zOWJkLTRlNDUtYjZjYS05YzNlZDYyZTQ3MjEucG5nIiwid2lkdGgiOiI8PTEwMjQifV1dLCJhdWQiOlsidXJuOnNlcnZpY2U6aW1hZ2Uub3BlcmF0aW9ucyJdfQ.wZUZvqRaWdEZNYLJvvDcx8F8TbLV1tHVPqo-AgZO71I
			//   https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/intermediary/f/d7920e4f-e2a6-4606-8a1d-3968edc0e298/dd0ns3a-3fcfe503-39bd-4e45-b6ca-9c3ed62e4721.png -- 2309x2598
			//   original is 4000x4500
			domain_nosub === "wixmp.com") {
			// https://static.wixstatic.com/media/c30de2_5bb577f8c9f949178994f77b47f5eb27~mv2_d_1500_2250_s_2.jpg/v1/fill/w_241,h_378,al_c,q_80,usm_0.66_1.00_0.01/c30de2_5bb577f8c9f949178994f77b47f5eb27~mv2_d_1500_2250_s_2.webp
			//   https://static.wixstatic.com/media/c30de2_5bb577f8c9f949178994f77b47f5eb27~mv2_d_1500_2250_s_2.jpg
			// http://static.wixstatic.com/media/140a90_5b3fa9eb4568eac9b3d5e79cf37525d0.jpg_512
			//   http://static.wixstatic.com/media/140a90_5b3fa9eb4568eac9b3d5e79cf37525d0.jpg
			// http://static.wixstatic.com/media/4bd5ee_8328e23583d647c8bbc36a50b9bdaa77.jpg_srz_162_288_85_22_0.50_1.20_0.00_jpg_srz -- forces download?
			//   http://static.wixstatic.com/media/4bd5ee_8328e23583d647c8bbc36a50b9bdaa77.jpg
			// https://static.wixstatic.com/media/964c6e_5f9921a4f67248ba807c0a69416a7ec4~mv2_d_3550_5325_s_4_2.jpg/v1/fill/w_183,h_274,al_c,q_80,usm_0.66_1.00_0.01/964c6e_5f9921a4f67248ba807c0a69416a7ec4~mv2_d_3550_5325_s_4_2.jpg
			//   https://static.wixstatic.com/media/964c6e_5f9921a4f67248ba807c0a69416a7ec4~mv2_d_3550_5325_s_4_2.jpg

			if (/^[a-z]+:\/\/[^/]+\/+media\/+0da768_361994b0f154464682a0aaf9724471cc\./.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}

			// thanks to nywilds on github: https://github.com/qsniyg/maxurl/issues/93
			// https://www.deviantart.com/f1x-2/art/Nightfall-800934586
			// https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/f/db0d85b1-b8b9-4790-bef0-121edb2dce7d/dd8ut2y-b61a578f-28be-496b-8044-559159433e36.jpg/v1/fill/w_1280,h_720,q_75,strp/nightfall_by_f1x_2_dd8ut2y-fullview.jpg?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1cm46YXBwOjdlMGQxODg5ODIyNjQzNzNhNWYwZDQxNWVhMGQyNmUwIiwiaXNzIjoidXJuOmFwcDo3ZTBkMTg4OTgyMjY0MzczYTVmMGQ0MTVlYTBkMjZlMCIsIm9iaiI6W1t7ImhlaWdodCI6Ijw9NzIwIiwicGF0aCI6IlwvZlwvZGIwZDg1YjEtYjhiOS00NzkwLWJlZjAtMTIxZWRiMmRjZTdkXC9kZDh1dDJ5LWI2MWE1NzhmLTI4YmUtNDk2Yi04MDQ0LTU1OTE1OTQzM2UzNi5qcGciLCJ3aWR0aCI6Ijw9MTI4MCJ9XV0sImF1ZCI6WyJ1cm46c2VydmljZTppbWFnZS5vcGVyYXRpb25zIl19.2ttX4dZcVj27yeTuh05fdJbZJSF2hj3pmgWaeCfh63Y
			obj = {};

			if (options._internal_info && options._internal_info.deviantart_page && typeof options._internal_info.deviantart_page === "string") {
				obj.extra = {page: options._internal_info.deviantart_page};
			} else {
				obj._copy_old_props = ["extra"];
			}

			newsrc = common_functions["_wix_bigimage_inner"](src);
			if (newsrc) {
				obj.url = newsrc;

				// copying from rule above
				var normalize_da = url => url
					.replace(/([?&])(?:token|ts)=[^&]+/g, "$1")
					.replace(/[?&]+$/, "");

				if (normalize_da(src) === normalize_da(newsrc))
					obj.url = src;
			}

			return obj;
		}

		if (domain_nosub === "kukinews.com" ||
			// http://www.inews365.com/data/cache/public/photos/20180205/art_15174759398393_648x365.jpg
			//   http://www.inews365.com/data/photos/20180205/art_15174723165416.jpg
			domain_nowww === "inews365.com" ||
			// http://www.newsinstar.com/data/cache/public/photos/20180309/art_15200463472991_6c6a6f_90x60_c0.jpg
			//   http://www.newsinstar.com/data/photos/20180309/art_15200463472991_6c6a6f.jpg
			domain_nowww === "newsinstar.com" ||
			// http://www.artkoreatv.com/data/cache/public/photos/20180311/art_15209739753682_ce7de1_260x364_c0.jpg
			//   http://www.artkoreatv.com/data/photos/20180311/art_15209739753682_ce7de1.jpg
			domain_nowww === "artkoreatv.com" ||
			// http://www.cnbnews.com/data/cache/public/photos/cdn/20181251/art_1545381746_176x135.jpg
			//   http://www.cnbnews.com/data/photos/cdn/20181251/art_1545381746.jpg
			domain_nowww === "cnbnews.com" ||
			// http://www.newsgg.net/data/cache/public/photos/20190521/art_1558846341886_b2bf4b_178x118.jpg
			//   http://www.newsgg.net/data/photos/20190521/art_1558846341886_b2bf4b.jpg
			domain_nowww === "newsgg.net" ||
			// http://www.newsam.co.kr/data/cache/public/photos/20190834/art_15661884005506_506078_90x60_c0.jpg
			//   http://www.newsam.co.kr/data/photos/20190834/art_15661884005506_506078.jpg
			domain_nowww === "newsam.co.kr" ||
			// http://www.fetv.co.kr/data/cache/public/photos/20191145/art_15732040131037_8d84e1_313x210_c0.jpg
			//   http://www.fetv.co.kr/data/photos/20191145/art_15732040131037_8d84e1.jpg
			domain_nowww === "fetv.co.kr" ||
			// http://www.ddaily.co.kr/data/cache/public/photos/cdn/20180205/art_1517533165_58x58.jpg
			domain_nowww === "ddaily.co.kr") {
			// http://cdn.kukinews.com/data/cache/public/photos/cdn/20180104/art_1516601165_300x190.jpg
			//   http://cdn.kukinews.com/data/photos/cdn/20180104/art_1516601165.jpg
			// http://news.kukinews.com/data/cache/public/photos/20180119/art_1516353322_300x190.jpg
			//   http://news.kukinews.com/data/photos/20180119/art_1516353322.jpg
			// http://cdn.kukinews.com/data/photos/kukiArticle/2011/0719/2011071901.jpg - 3594x2202
			// http://m.kukinews.com/data/photos/kukiArticle/2013/0527/09251832521234.jpg - 4636x2891
			// http://cdn.kukinews.com/data/photos/kukiArticle/2013/1208/contax_34.jpg
			// http://kukinews.com/data/cache/public/photos/20180510/art_1525933651_125x105.jpg
			//   http://kukinews.com/data/photos/20180510/art_1525933651.jpg
			return src
				.replace(/\/data\/+cache\/+public\//, "/data/")
				.replace(/_[0-9]+x[0-9]+(?:_c[0-9]*)?\.([^/.]*)/, ".$1");
		}

		// wip
		// http://cdn.emetro.co.kr/html/image_view.php?f=20180116000114.jpg&x=175&y=120&b=0&p=tl&ds=320
		//   http://cdn.emetro.co.kr/imagebank/2018/01/16/0480/20180116000114.jpg - 480 pixels (/0480/), removing doesn't work, but replacing with 0320, 0640, 1024 works (image is 568x329)
		// http://cdn.emetro.co.kr/html/image_view.php?f=20180123000084.jpg&x=263&y=230&b=20&p=tc&ds=100000
		//   http://cdn.emetro.co.kr/imagebank/2018/01/23/0320/20180123000047.jpg - 320 pixels
		// http://cdn.emetro.co.kr/html/image_view.php?f=20180123000037.jpg&x=122&y=105&b=0&p=tc&ds=1024
		//   http://cdn.emetro.co.kr/imagebank/2018/01/23/0640/20180123000037.jpg
		// http://cdn.emetro.co.kr/html/image_view_maxw.php?f=20180207000150.jpg&x=640&ds=640
		//   http://cdn.emetro.co.kr/html/image_view_maxw.php?f=20180207000150.jpg&x=9999&ds=9999
		//   http://cdn.emetro.co.kr/html/image_view_maxw.php?f=20180207000150.jpg&x=9999999999&ds=9999999999
		//
		// p: position (tl = top left, tc = top center?, etc.), optional
		// d: quality? the higher it is, the less blurry it is, optional
		// b: no idea, optional
		// x, y: required, 0 doesn't work (blank page), -1 returns a 10x10? image, 1 returns 1px, larger stretches it
		if (domain === "cdn.emetro.co.kr") {
			return src
				.replace(/\/image_view\.php.*?[?&]f=([^&]*).*/, "/image_view_maxw.php?f=$1&x=9999999999&ds=9999999999")
				.replace(/\/imagebank\/[0-9]*\/[0-9]*\/[0-9]*\/[0-9]*\/([^/]*)$/, "/html/image_view_maxw.php?f=$1&x=9999999999&ds=9999999999")
				.replace(/\/image_view_maxw.php.*?[?&]f=([^&]*).*/, "/image_view_maxw.php?f=$1&x=9999999999&ds=9999999999");
			/*origsize = src.match(/\/([0-9]*)\/[^/]*$/);
			if (origsize) {
				size = parseInt(origsize[1], 10);
				if (size < 1024) {
					return src.replace(/\/[0-9]*(\/[^/]*)$/, "/1024$1");
				}
			}*/
		}

		if (domain === "50.7.164.242:8182" ||
			// http://imgspice.com/o4sy99ejf4p1
			//   https://imgspice.com/o4sy99ejf4p1.html
			//   https://imgspice.com/o4sy99ejf4p1/.html
			// http://img80.imgspice.com/i/04137/o4sy99ejf4p1_t.jpg
			//   https://img80.imgspice.com/i/04137/o4sy99ejf4p1.jpg
			domain_nosub === "imgspice.com" ||
			// http://img21.imageporter.com/i/01522/rcvaaktx2q05_t.jpg
			//   http://img21.imageporter.com/i/01522/rcvaaktx2q05.jpg
			domain_nosub === "imageporter.com" ||
			// https://img30.imagedunk.com/i/02072/ws89tkyz5tk3_t.jpg
			//   https://img30.imagedunk.com/i/02072/ws89tkyz5tk3.jpg
			domain_nosub === "imagedunk.com" ||
			domain === "main.imgclick.net" ||
			// thanks to elvisef on github for reporting: https://github.com/qsniyg/maxurl/issues/601
			// https://img80.imagedax.net/i/02270/7amskdbiz6qz_t.jpg
			//   https://img80.imagedax.net/i/02270/7amskdbiz6qz.jpg
			domain_nosub === "imagedax.net" ||
			// thanks to elvisef on github for reporting: https://github.com/qsniyg/maxurl/issues/631
			// https://img30.piclambo.net/i/02173/ivq13bhw5zoi_t.jpg
			//   https://img30.piclambo.net/i/02173/ivq13bhw5zoi.jpg
			domain_nosub === "piclambo.net" ||
			// thanks to elvisef on github for reporting: https://github.com/qsniyg/maxurl/issues/631
			// https://img80.picturedip.com/i/04321/mv4ciy8rrfrb_t.jpg
			//   https://img80.picturedip.com/i/04321/mv4ciy8rrfrb.jpg
			domain_nosub === "picturedip.com" ||
			// http://img150.pixroute.com/i/01807/71x1h0plzn0d_t.jpg
			//   http://img150.pixroute.com/i/01807/71x1h0plzn0d.jpg
			domain_nosub === "pixroute.com") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+([a-z0-9]{5,})(?:(?:\/+[^/?#]*)?\.html)?(?:[?#].*)?$/,
				query_for_id: "https://" + domain + "/${id}/.html",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/<img id="imgpreview" src="(https?:\/\/[^/]+\/+i\/+[^"]+)"/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					return done(decode_entities(match[1]), 6*60*60);
				}
			});
			if (newsrc) return newsrc;

			// http://50.7.164.242:8182/i/05/00355/qpjey5skv52d_t.jpg
			//   http://50.7.164.242:8182/i/05/00355/qpjey5skv52d.jpg
			newsrc = src.replace(/(\/i\/+(?:[0-9]+\/+)?[0-9]+\/+[a-z0-9]{5,})_t(\.[^/.]*)$/, "$1$2");

			obj = {
				url: src,
				headers: {
					Referer: ""
				},
				bad_if: [
					{
						headers: {
							"content-length": "40275",
							"content-type": "image/jpeg"
							//"last-modified": "Sat, 09 Mar 2019 01:29:42 GMT" // always changes
						}
					}
				]
			};

			if (newsrc !== src) {
				return fillobj_urls(add_extensions_jpeg(newsrc), obj);
			} else {
				return obj;
			}
		}

		if (domain_nosub === "imagetwist.com" && src.match(/:\/\/[^/]*\/+error\.[^/.]*(?:[?#].*)?$/)) {
			// https://imagetwist.com/error.jpg
			return {
				url: src,
				bad: true
			};
		}

		if (domain_nosub === "imagetwist.com" ||
			// https://img118.imagexport.com/th/31366/sg42bjfx22p4.jpg
			//   https://img118.imagetwist.com/i/31366/sg42bjfx22p4.jpg/101100-001.jpg
			// https://imagexport.com/sg42bjfx22p4/101100-001.jpg.html
			domain_nosub === "imagexport.com" ||
			// https://img200.imagenpic.com/th/24767/dokio7jjefsw.jpg
			//   https://img200.imagetwist.com/i/24767/dokio7jjefsw.png/yoshiki.png
			domain_nosub === "imagenpic.com" ||
			domain_nosub === "vipr.im" ||
			// http://img26.picshick.com/th/13110/2ab7lhypu3l2.jpg
			//   http://img26.picshick.com/i/13110/2ab7lhypu3l2.jpg -- forces download
			// https://img164.picshick.com/th/31938/athcsocrumor.jpg
			//   https://img164.imagetwist.com/i/31938/athcsocrumor.jpg/1.jpg -- forces download
			// some images return an error image with 200
			// there are many headers that could help identify (last-modified, content-length)
			domain_nosub === "picshick.com") {
			// https://i2.imagetwist.com/th/23629/qxpfyyv61890.jpg
			//   https://i2.imagetwist.com/i/23629/qxpfyyv61890.jpg
			// http://img64.imagetwist.com/th/20956/qfucojvzag41.jpg
			//   http://img64.imagetwist.com/i/20956/qfucojvzag41.jpg
			// https://img201.imagetwist.com/th/28668/v007u2hokmhj.jpg
			//   https://img201.imagetwist.com/i/28668/v007u2hokmhj.JPG
			// https://i7phun.imagetwist.com/th/00009/0dxfv5vy2o1p.jpg
			//   https://i7phun.imagetwist.com/i/00009/0dxfv5vy2o1p.jpg/ec__1_.jpg

			let bad_if = [
				{
					headers: {
						"Last-Modified": "Fri, 28 May 2010 08:58:40 GMT",
						"Content-Length": "8183"
					}
				}
			]

			var is_picdomain = false;
			var request_domain;
			match = domain.match(/^[uis](?:mg)?[0-9]+([a-z]+)?\./);
			if (match) {
				is_picdomain = true;
				request_domain = domain_nosub;
				if (match[1]) {
					request_domain = match[1] + "." + request_domain;
				}
			}

			if (!is_picdomain) {
				newsrc = website_query({
					website_regex: {
						regex: /^[a-z]+:\/\/([^/]+)\/+([0-9a-z]{8,})\/+[^/.?#]*(\.[^/.]+)(?:[?#].*)?$/,
						groups: ["domain", "id", "ext"]
					},
					query_for_id: "https://${domain}/${id}/${ext}",
					process: function(done, resp, cache_key) {
						var match = resp.responseText.match(/<a\s+href=["'](https?:\/\/[ius](?:mg)?[0-9]*(?:[a-z]+)?\.[^/]+\/+i\/+.*?)["'][^>]*\sdownload/);
						if (!match) {
							match = resp.responseText.match(/<p[^>]*>\s*<img\s+src=["'](https?:\/\/[ius](?:mg)?[0-9]*(?:[a-z]+)?\.[^/]+\/+i\/+[^"']+)["'][^>]*\sclass="[^"]*pic[^"]*"/);
						}
						if (!match) {
							console_error(cache_key, "Unable to find match for", resp);
							return done(null, false);
						}

						done({
							url: decode_entities(match[1]),
							headers: {
								Referer: src.replace(/:\/\/(?:[^/]*\.)?([^/.]*\.[^/.]*)\/.*/, "://$1/"),
								Origin: src.replace(/:\/\/(?:[^/]*\.)?([^/.]*\.[^/.]*)\/.*/, "://$1/"),
								"Sec-Metadata": "destination=image, site=same-site"
							},
							bad_if: bad_if,
							is_original: true
						}, 60*60);
					}
				});
				if (newsrc) return newsrc;
			} else {
				newsrc = src.replace(/^([a-z]+:\/\/)[^/]+\/+th\/+[0-9]+\/+([0-9a-z]+)(\.[^/.]*)?$/, "$1" + request_domain + "/$2/$3");
				if (newsrc !== src) {
					return [
						{
							url: newsrc,
							is_pagelink: true
						},
						{
							url: src.replace(/\/th\//, "/i/"),
							headers: {
								Referer: src.replace(/:\/\/(?:[^/]*\.)?([^/.]*\.[^/.]*)\/.*/, "://$1/"),
								Origin: src.replace(/:\/\/(?:[^/]*\.)?([^/.]*\.[^/.]*)\/.*/, "://$1/"),
								"Sec-Metadata": "destination=image, site=same-site"
							},
							bad_if: bad_if
						}
					];
				}
			}
		}

		if (domain_nosub === "fappic.com") {
			// https://img100.fappic.com/i/00698/y86osh64in9k_t.jpg
			//   https://fappic.com/y86osh64in9k/.jpg -- original page
			//   https://img100.fappic.com/img/lyhjsfz3nde7hsjrkaehbba63w5xjupbtmqt67awuu/0002.jpeg
			// https://www.fappic.com/i/00536/vz6f4d6kubov_t.jpg
			//   https://www.fappic.com/img/lahkdnrgnddldsjyc4chbwyc2gbhthljxo25o7spsu/27afDSm-lhf_1091_0001.jpeg

			if (domain_nosub === domain_nowww) {
				newsrc = website_query({
					website_regex: {
						regex: /^[a-z]+:\/\/([^/]+)\/+([0-9a-z]{8,})\/+[^/.?#]*(\.[^/.]+)(?:[?#].*)?$/,
						groups: ["domain", "id", "ext"]
					},
					query_for_id: "https://${domain}/${id}/${ext}",
					process: function(done, resp, cache_key) {
						var match = resp.responseText.match(/<img\s+src=["'](https?:\/\/[^/]+\/+img\/+.*?)["'][^>]*\s+class=['"]pic["']/);
						if (!match) {
							console_error(cache_key, "Unable to find match for", resp);
							return done(null, false);
						}

						done({
							url: decode_entities(match[1]),
							headers: {
								Referer: src.replace(/:\/\/(?:[^/]*\.)?([^/.]*\.[^/.]*)\/.*/, "://$1/"),
								Origin: src.replace(/:\/\/(?:[^/]*\.)?([^/.]*\.[^/.]*)\/.*/, "://$1/"),
								"Sec-Metadata": "destination=image, site=same-site"
							},
							is_private: true, // linked to ip
							is_original: true
						}, 60*60);
					}
				});
				if (newsrc) return newsrc;
			}

			newsrc = src.replace(/^([a-z]+:\/\/)(?:[^/.]*\.)?([^/.]+\.[^/.]+\/+)(?:th|i)\/+[0-9]+\/+([0-9a-z]+)(?:_t)?(\.[^/.]*)?$/, "$1$2$3/$4");
			if (newsrc !== src) {
				return [
					{
						url: newsrc,
						is_pagelink: true
					},
					{
						url: src,
						headers: {
							Referer: src.replace(/:\/\/(?:[^/]*\.)?([^/.]*\.[^/.]*)\/.*/, "://$1/"),
							Origin: src.replace(/:\/\/(?:[^/]*\.)?([^/.]*\.[^/.]*)\/.*/, "://$1/"),
							"Sec-Metadata": "destination=image, site=same-site"
						}
					}
				];
			}
		}

		if (domain_nowww === "imgflare.com") {
			var get_form_inputs = function(text) {
				var matches = match_all(text, /<input\s+(?:id=\S+\s+)?type="hidden"\s+name="([^"]+)" value="([^"]+)"/);
				if (!matches || !matches.length)
					return null;

				var data = {};
				array_foreach(matches, function(match) {
					data[decode_entities(match[1])] = decode_entities(match[2]);
				});

				return data;
			};

			var get_img_from_imgflare = function(resp) {
				var match = resp.responseText.match(/<img[^>]*src="(https?:\/\/i\.imgflare\.com\/+i\.php\?[^"]+)"/);
				if (!match)
					return null;

				return {
					url: decode_entities(match[1]),
					headers: {
						Referer: resp.finalUrl,
						Origin: "https://www.imgflare.com"
					},
					is_private: true // linked to ip
				};
			};

			var query_imgflare = function(url, cb, inputs?, times?:number) {
				if (!times) times = 0;

				// works after the 3-5th time usually
				if (times >= 5) {
					console_error("Unable to find image for", url, "(tried too many times)");
					return cb(null);
				}

				var req:DoRequestData = {
					url: url,
					imu_mode: "document",
					headers: {
						Referer: "https://www.imgflare.com/",
						Origin: "https://www.imgflare.com"
					}
				};

				if (inputs) {
					req.method = "POST",
					req.data = stringify_queries(inputs);
					req.headers["Content-Type"] = "application/x-www-form-urlencoded";
				}

				api_query("imgflare:" + url, req, function(data) {
					if (!data)
						return cb(null);

					if (data.img)
						return cb(data.img);

					if (data.inputs) {
						return setTimeout(function() {
							query_imgflare(url, cb, data.inputs, times + 1);
						}, 3*1000);
					}
				}, function(done, resp, cache_key) {
					var img = get_img_from_imgflare(resp);
					if (img) {
						return done({
							img: img
						}, 60*60);
					}

					var inputs = get_form_inputs(resp.responseText);
					if (!inputs) {
						console_error(cache_key, "Unable to find form inputs for", resp, "(is captcha solved?)");
						return done(null, false);
					}

					return done({
						inputs: inputs
					}, false);
				});
			};

			newsrc = website_query({
				website_regex: [
					/^[a-z]+:\/\/[^/]+\/+([0-9a-z]{5,})\/+[^/]*\.html(?:[?#].*)?$/, // old style
					/^[a-z]+:\/\/[^/]+\/+f\/+([0-9a-z]{5,})(?:[?#].*)?$/
				],
				run: function(cb, match) {
					var id = match[1];
					var url = "https://www.imgflare.com/f/" + id;
					query_imgflare(url, cb);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "i.imgflare.com") {
			match = src.match(/\/i\/+[0-9]+\/+([0-9a-z]{5,})_t\./);
			if (match)
				return {
					url: "https://www.imgflare.com/f/" + match[1],
					is_pagelink: true
				};
		}

		// no longer works for imgflare either
		if (false && domain_nosub === "imgflare.com" //||
			// http://i.imgbabes.com/i/00403/r0hjwo7rnsr4_t.jpg
			//   http://i.imgbabes.com/files/7/nxxbauvvaqq5ud/beyonce%20pubes.jpg
			// doesn't work anymore
			//domain_nosub === "imgbabes.com") {
		) {
			// http://www.imgflare.com/i/00026/u6j8ulxub2su_t.jpg
			//   http://www.imgflare.com/files/9/mug5ve6613zk84/403.jpg
			id = src.replace(/^([a-z]+:\/\/)(?:[^/.]*\.)?([^/.]+\.[^/.]+\/+)i\/+[0-9]+\/+([0-9a-z]+)(?:_t)?(\.[^/.]*)?$/,
							 "$1www.$2$3/$4");
			//console_log(id);
			if (id !== src && options && options.cb && options.do_request) {
				common_functions["get_testcookie_cookie"](options, api_cache, "http://www." + domain_nosub + "/", function (cookie) {
					var headers:Record<string, string> = {
						Referer: ""
					};

					if (cookie) {
						headers.Cookie = cookie;
					} else {
						return options.cb(null);
					}

					options.do_request({
						method: "GET",
						headers: headers,
						url: id + ".html",
						onload: function (resp) {
							//console_log(resp);
							if (resp.readyState === 4) {
								var match = resp.responseText.match(/<img\s+src=["'](https?:\/\/[^/]+\/+files\/+.*?)["'][^>]*\s+class=['"]pic["']/);
								if (match) {
									options.cb({
										url: match[1],
										is_original: true
									});
								} else {
									console_error("Unable to find match for", resp);
									options.cb(null);
								}
							}
						}
					});
				});

				return {
					waiting: true
				};
			}

			return {
				url: src,
				headers: {
					Referer: src.replace(/:\/\/(?:[^/]*\.)?([^/.]*\.[^/.]*)\/.*/, "://$1/"),
					Origin: src.replace(/:\/\/(?:[^/]*\.)?([^/.]*\.[^/.]*)\/.*/, "://$1/"),
					"Sec-Metadata": "destination=image, site=same-site"
				}
			};
		}

		if (domain_nosub === "tezzpic.com" ||
			domain_nosub === "piczhq.com" ||
			domain_nosub === "crownimg.com" ||
			domain_nosub === "outletpic.com" ||
			domain_nosub === "imgoutlet.com" ||
			domain_nosub === "pictwn.com" ||
			domain_nosub === "trypicz.com" ||
			domain_nosub === "imgtown.net" ||
			domain_nosub === "dewimg.com" ||
			domain_nosub === "imgdew.com" ||
			domain_nosub === "imgmaze.com" ||
			domain_nosub === "meetimgz.com" ||
			domain_nosub === "imgview.net" ||
			domain_nosub === "picyield.com" ||
			domain_nosub === "usefto.com") {
			// list of domains and redirects: https://github.com/adsbypasser/adsbypasser/issues/3744
			let img_domain = domain_nosub;
			if (img_domain === "piczhq.com")
				img_domain = "tezzpic.com";
			if (img_domain === "usefto.com" ||
				img_domain === "imgoutlet.com")
				img_domain = "outletpic.com";
			if (img_domain === "trypicz.com" ||
				img_domain === "imgtown.net")
				img_domain = "pictwn.com";
			if (img_domain === "imgdew.com")
				img_domain = "dewimg.com";
			if (img_domain === "imgmaze.com")
				img_domain = "meetimgz.com";
			if (img_domain === "imgview.net")
				img_domain = "picyield.com";

			let query_tezzpic_img = function(url, id, token, cb) {
				api_query(img_domain + ":" + id + ":" + token, {
					url: url,
					imu_mode: "document",
					method: "POST",
					headers: {
						origin: "https://" + img_domain,
						referer: url,
						"content-type": "application/x-www-form-urlencoded"
					},
					data: "op=view&id=" + id + "&pre=1&" + token + "=1"
				}, cb, function(done, resp, cache_key) {
					let match = resp.responseText.match(/<img src="(https?:\/\/[^"]+)" class="pic(?:view)?"/);
					if (!match) {
						console_error(cache_key, "Unable to find img match for", {
							resp,
							url,
							id,
							token
						});
						return done(null, false);
					}

					return done(match[1], 60*60);
				});
			};

			let check_captcha = function(responseText) {
				if (/Completing the CAPTCHA proves you are a human and gives you access to/.test(responseText)) {
					return true;
				}

				return false;
			};

			let advise_captcha = function(responseText) {
				if (check_captcha(responseText)) {
					console_error("You may need to solve a CAPTCHA");
				}
			};

			let process_final_tezzpic = function(done, resp, cache_key, match, options) {
				let section_match = resp.responseText.match(/(?:\$\(document\)\['\\x6f\\x6e'\]\(|'\\x70\\x72\\x65\\x76\\x65\\x6e\\x74\\x44\\x65\\x66\\x61\\x75\\x6c\\x74'|'\\x62\\x75\\x74\\x74\\x6f\\x6e\\x5b\\x6e\\x61\\x6d\\x65\\x3d\\x22\\x6e\\x65\\x78\\x74\\x22\\x5d').*?(?:'\\x6f\\x72\\x69\\x67\\x69\\x6e\\x61\\x6c\\x45\\x76\\x65\\x6e\\x74'|'\\x69\\x73\\x54\\x72\\x75\\x73\\x74\\x65\\x64'|'\\x73\\x65\\x74\\x41\\x74\\x74\\x72\\x69\\x62\\x75\\x74\\x65').*?,((?:_0x[0-9a-f]+\s*(?:\+\s*)?)+)\);\s*}?else/);
				if (!section_match) {
					console_error(cache_key, "Unable to find section match for", resp);
					advise_captcha(resp.responseText);
					return done(null, false);
				}

				let section_text = section_match[0];

				let id = null;

				// crownimg.com
				let url_id_match = options.url.match(/:\/\/[^/]+\/+([0-9a-z]+)\/+[^/]*\.html/);
				if (url_id_match) {
					id = url_id_match[1];
				} else {
					//let id_match = resp.responseText.match(/\\x22\\x69\\x64\\x22\\x20\\x76\\x61\\x6c\\x75\\x65\\x3d\\x22'\s*\+\s*'([^']+)'/);
					let id_match = resp.responseText.match(/(?:'|0x[0-9a-f]+\))\s*\+\s*'([0-9a-z]+)'\s*\+\s*(?:'[^']+'|_0x[0-9a-f]+\(0x[0-9a-f]+\))\s*\+\s*'[0-9a-f]{32}'/);
					if (!id_match) {
						console_error(cache_key, "Unable to find image ID match for", resp);
						return done(null, false);
					}
					id = id_match[1];
				}

				let args_text = section_match[1];
				let args = args_text.match(/(_0x[0-9a-f]+)/g);
				let values = [];
				for (let arg of args) {
					let argval_match = section_text.match(new RegExp(arg + "='([^']*)'"));
					if (!argval_match) {
						console_error("Unable to find value for arg", arg, {
							section_text,
							args,
							args_text,
							resp
						});
						return done(null, false);
					}

					values.push(argval_match[1]);
				}

				let token = values.join("");

				query_tezzpic_img(options.url, id, token, function(url) {
					if (!url) {
						return done(null, false);
					}

					return done({
						url: url,
						headers: {
							Referer: "https://" + domain + "/"
						}
					}, 60*60);
				})
			};

			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+([-_0-9a-zA-Z]{20,})\.php(?:[?#].*)?$/,
				query_for_id: "https://" + img_domain + "/${id}.php",
				process: process_final_tezzpic
			});
			if (newsrc) return newsrc;

			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+([0-9a-z]+)\/+[^/]*\.html(?:[?#].*)?$/,
				query_for_id: "https://" + img_domain + "/${id}/.html",
				process(done, resp, cache_key, match, options) {
					if (domain_nosub === "crownimg.com") {
						return process_final_tezzpic(done, resp, cache_key, match, options);
					}

					let vars_string_match = resp.responseText.match(/((?:_0x[0-9a-f]+\s*=\s*(?:(?:'[^']*'|(?:_0x[0-9a-f]+\s*(?:\+\s*)?)+),\s*))+_0x[0-9a-f]+=atob\([^)]+\);)/);
					if (!vars_string_match) {
						console_error(cache_key, "Unable to find vars match for", resp);
						advise_captcha(resp.responseText);
						return done(null, false);
					}

					let vars_parsed = match_all(vars_string_match[1], /(_0x[0-9a-f]+)\s*=\s*([^,]+)\s*[;,]/);
					let vars_obj = {};
					let final_var = null;
					for (let parsed of vars_parsed) {
						let varname = parsed[1];
						let varvalue = parsed[2];

						if (varvalue[0] === "'") {
							varvalue = varvalue.replace(/^'(.*)'$/, "$1");
						} else  {
							let refs = varvalue.match(/(_0x[0-9a-f]+)/g);
							let varvalues = [];
							for (let ref of refs) {
								varvalues.push(vars_obj[ref]);
							}

							let new_varvalue = varvalues.join("");

							if (/^atob/.test(varvalue)) {
								varvalue = base64_decode(new_varvalue);
								final_var = varname;
							} else {
								varvalue = new_varvalue;
							}
						}

						vars_obj[varname] = varvalue;
					}

					if (!final_var || !/^https?:\/\//.test(vars_obj[final_var])) {
						console_error(cache_key, "Unable to find final var for", resp, vars_obj);
						return done(null, false);
					}

					done({
						url: vars_obj[final_var],
						is_pagelink: true
					}, 10*60);
				}
			});
			if (newsrc) return newsrc;

			match = src.match(/\/i\/+[0-9]+\/+([0-9a-z]+)(?:_t)?\./);
			if (match) {
				return {
					url: "https://" + img_domain + "/" + match[1] + "/.html",
					is_pagelink: true
				};
			}
		}

		if (domain === "www.theactuary.com") {
			// nowww !== www
			// http://www.theactuary.com/EasysiteWeb/getresource.axd?AssetID=552225&type=custom&servicetype=Inline&customSizeId=104
			//   http://www.theactuary.com/EasysiteWeb/getresource.axd?AssetID=552225
			return src.replace(/getresource\.axd\?.*(AssetID=[0-9]*).*/, "getresource.axd?$1");
		}

		if (domain === "static.new-magazine.co.uk" ||
			// http://star-magazine.co.uk.s3.amazonaws.com/prod/media/images/600x400_ct/834228_56665_1_85643f98ed384ea3c2910d34044488d9.jpg
			//   http://star-magazine.co.uk.s3.amazonaws.com/prod/media/images/original/834228_56665_1_85643f98ed384ea3c2910d34044488d9.jpg
			amazon_container === "star-magazine.co.uk") {
			// https://static.new-magazine.co.uk/prod/media/images/300x200_ct/1105261_334919_157_106_2_b4536ad77d2a7ac6c5c342d5ba94c83a.jpg
			//   https://static.new-magazine.co.uk/prod/media/images/625x833_ct/1105261_334919_157_106_2_b4536ad77d2a7ac6c5c342d5ba94c83a.jpg
			//   https://static.new-magazine.co.uk/prod/media/images/original/1105261_334919_157_106_2_b4536ad77d2a7ac6c5c342d5ba94c83a.jpg
			return src.replace(/(\/prod\/media\/images\/)[^/]*\//, "$1original/");
		}

		if (domain_nowww === "irishexaminer.com" ||
			// https://www.breakingnews.ie/remote/media.central.ie/media/images/r/roryBestShaneRoss6NationsTrophy_large.jpg?width=600&s=bn-833165
			//   http://media.central.ie/media/images/r/roryBestShaneRoss6NationsTrophy_large.jpg
			domain_nowww === "breakingnews.ie" ||
			// https://ip.index.hr/remote/indexnew.s3.index.hr/rethatrhtsrhgertr.jpg?width=765&height=440
			//   http://indexnew.s3.index.hr/rethatrhtsrhgertr.jpg
			domain === "ip.index.hr" ||
			// https://images.radiotimes.com/remote/images.atlas.metabroadcast.com/pressassociation.com/webANXloomintowerbbc.jpg?quality=60&mode=crop&width=700&height=422
			//   http://images.atlas.metabroadcast.com/pressassociation.com/webANXloomintowerbbc.jpg
			domain === "images.radiotimes.com" ||
			// https://www.mffashion.com/remote/static.classeditori.it/content_upload/img/2019/08/201908081535086700/keanu-gq-4-771138.jpg?width=370&height=220&mode=crop
			//   http://static.classeditori.it/content_upload/img/2019/08/201908081535086700/keanu-gq-4-771138.jpg
			domain_nowww === "mffashion.com" ||
			// http://download.iask.ca/remote/img3.doubanio.com/view/photo/s_ratio_poster/public/p2568921730.jpg
			//   http://img3.doubanio.com/pview/photo/raw/public/p2568921730.jpg
			domain === "download.iask.ca" ||
			domain === "ip.trueachievements.com") {
			// removing ?.* entirely returns 500
			// https://www.irishexaminer.com/remote/image.assets.pressassociation.io/v2/image/production/144492a205ad478ef0233c59e6617054Y29udGVudHNlYXJjaCwxNTEzMDczMTc2/2.30748323.jpg?crop=0,102,3712,2190&ext=.jpg&width=600
			//   https://www.irishexaminer.com/remote/image.assets.pressassociation.io/v2/image/production/144492a205ad478ef0233c59e6617054Y29udGVudHNlYXJjaCwxNTEzMDczMTc2/2.30748323.jpg?ext=.jpg&width=600
			// however, /remote/ is a remote address
			//   http://image.assets.pressassociation.io/v2/image/production/144492a205ad478ef0233c59e6617054Y29udGVudHNlYXJjaCwxNTEzMDczMTc2/2.30748323.jpg
			// https://ip.trueachievements.com/remote/images-eds-ssl.xboxlive.com%2Fimage%3Furl%3D8Oaj9Ryq1G1_p3lLnXlsaZgGzAie6Mnu24_PawYuDYIoH77pJ.X5Z.MqQPibUVTcSEliFeYEcpYdMffymmILaXcS00LePBQajKrVx_Va4DQAxgf7VKT9o10FP5RijVvisttt9.R8el9KW5aWefdGAyAK7PHk.TSf1spbv8.x6hWsZrJa2pOp_PXzU7fSK76BcdJyPe_XVC7ZQNPT1kWf.D_KXVQtjCDHj7_wiu8ekYM-?width=1200&height=675
			//   http://images-eds-ssl.xboxlive.com/image?url=8Oaj9Ryq1G1_p3lLnXlsaZgGzAie6Mnu24_PawYuDYIoH77pJ.X5Z.MqQPibUVTcSEliFeYEcpYdMffymmILaXcS00LePBQajKrVx_Va4DQAxgf7VKT9o10FP5RijVvisttt9.R8el9KW5aWefdGAyAK7PHk.TSf1spbv8.x6hWsZrJa2pOp_PXzU7fSK76BcdJyPe_XVC7ZQNPT1kWf.D_KXVQtjCDHj7_wiu8ekYM-
			newsrc = src.replace(/.*:\/\/[^/]*\/remote\/([^?]*).*/, "$1");
			if (newsrc !== src)
				return "http://" + decodeURIComponent(newsrc);
		}

		if (domain === "images.radiotimes.com") {
			// https://images.radiotimes.com/namedimage/Benedict_Cumberbatch_has_the_best_nickname_for_Tom_Hiddleston.jpg?quality=85&mode=crop&width=620&height=374&404=tv&url=/uploads/images/original/113286.jpg
			//   https://images.radiotimes.com/uploads/images/original/113286.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/namedimage\/[^?]*.*?[?&]url=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return urljoin(src, newsrc, true);
		}

		if (domain === "images.radiotimes.com" ||
			domain_nowww === "radiotimes.com") {
			// https://images.radiotimes.com/uploads/images/Medium/24523.jpg?quality=60&mode=crop&404=tv
			//   https://images.radiotimes.com/uploads/images/medium/24523.jpg?quality=60&mode=crop&404=tv
			//   https://images.radiotimes.com/uploads/images/medium/24523.jpg
			//   https://images.radiotimes.com/uploads/images/original/24523.jpg -- image not available, but 200
			// https://www.radiotimes.com/uploads/images/original/140622.d01d7e34-379c-4bcd-9a84-4caea87320db.jpg?width=426&height=256&mode=crop&quality=60
			//   https://www.radiotimes.com/uploads/images/original/140622.d01d7e34-379c-4bcd-9a84-4caea87320db.jpg
			//   https://images.radiotimes.com/uploads/images/original/140622.d01d7e34-379c-4bcd-9a84-4caea87320db.jpg
			return src.replace(/(\/uploads\/+images\/+[a-zA-Z]+\/+[0-9]+(?:\.[-0-9a-f]+)?\.[^/.?]*)(?:[?#].*)?$/, "$1");
		}

		if ((domain === "tellymix-spykawebgroup.netdna-ssl.com" ||
			 // http://static6.tellymixcdn.com/ts/800/450/www.tellymix.co.uk/files/2013/06/Tess-Daly.jpg
			 //   https://tellymix.co.uk/wp-content/uploads/2013/06/Tess-Daly.jpg
			 domain_nosub === "tellymixcdn.com") &&
			src.match(/:\/\/[^/]*\/+ts\//)) {
			// https://tellymix-spykawebgroup.netdna-ssl.com/ts/800/450/tellymix-spykawebgroup.netdna-ssl.com/wp-content/uploads/2016/10/the-apprentice-2016-sugar.jpg
			//   http://tellymix-spykawebgroup.netdna-ssl.com/wp-content/uploads/2016/10/the-apprentice-2016-sugar.jpg
			return src.replace(/^[a-z]+:\/\/[^/]*\/+ts\/+[0-9]*\/+[0-9]*\/+/, "http://");
		}

		if (domain === "assets.goodhousekeeping.co.uk") {
			// http://assets.goodhousekeeping.co.uk/main/embedded/37045/nick_hewer__large.jpg?20170224112427
			//   http://assets.goodhousekeeping.co.uk/main/embedded/37045/nick_hewer.jpg?20170224112427
			// http://assets.goodhousekeeping.co.uk/main/embedded/37045/scams_2__medium.jpg
			//   http://assets.goodhousekeeping.co.uk/main/embedded/37045/scams_2.jpg
			// http://assets.goodhousekeeping.co.uk/main/embedded/961/DH-esther-rantzen-170913-de__medium.jpg
			//   http://assets.goodhousekeeping.co.uk/main/embedded/961/DH-esther-rantzen-170913-de.jpg
			// http://assets.goodhousekeeping.co.uk/main/galleries/22679/brilliant-hairstyles-at-the-baftas---felicity-jones__small.jpg?20150209111956
			//   http://assets.goodhousekeeping.co.uk/main/galleries/22679/brilliant-hairstyles-at-the-baftas---felicity-jones.jpg?20150209111956
			//
			// doesn't work:
			// http://assets.goodhousekeeping.co.uk/main/options/sized-good-housekeeping-institute-cookery-school-outside-institute__medium.jpg
			return src.replace(/(\/(?:embedded|galleries)\/+(?:[0-9]*\/+)[^/]*)__[^/.]*(\.[^/]*)$/, "$1$2");
			//return src.replace(/(\/main\/+galleries\/+[0-9]+\/+[^/]*)__small(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (false && ((domain_nowww === "femalefirst.co.uk" ||
					   domain_nowww === "malextra.com") &&
					  string_indexof(src, "/image-library/") >= 0)) {
			// wip, need a better way to find numbers ... seems to stretch the image
			// http://www.femalefirst.co.uk/image-library/square/1000/n/nick-hewer.jpg.pagespeed.ce.hpbDLhN-Bn.jpg
			//   http://www.femalefirst.co.uk/image-library/square/1000/n/nick-hewer.jpg
			// http://www.femalefirst.co.uk/image-library/square/250/i/125x125xi-am-health-ledger.jpg.pagespeed.ic.FlFI8UcEzf.webp
			//   http://www.femalefirst.co.uk/image-library/square/250/i/i-am-health-ledger.jpg
			// http://www.femalefirst.co.uk/image-library/partners/bang/land/1000/b/xbruno-mars-bdb9ea9c22850bc313ff7ac8e630fb1d828ffc4f.jpg.pagespeed.ic.rBtqQphklp.jpg
			//   http://www.femalefirst.co.uk/image-library/partners/bang/land/1000/b/bruno-mars-bdb9ea9c22850bc313ff7ac8e630fb1d828ffc4f.jpg
			// https://www.femalefirst.co.uk/image-library/partners/bang/port/1000/c/camila-cabello-03bdc9bf2a1513d9a06c55f25c33f87ea098a0e3.jpg
			// http://www.femalefirst.co.uk/image-library/partners/bang/square/250/l/lord-alan-sugar-d9c582eb51a37f070569b849b1ec3916e0bb28e0.jpg
			//   http://www.femalefirst.co.uk/image-library/partners/bang/square/1000/l/lord-alan-sugar-d9c582eb51a37f070569b849b1ec3916e0bb28e0.jpg -- stretched
			// http://www.femalefirst.co.uk/image-library/deluxe/d/despicable-me-3-character-poster-5.jpg (4050x6000)
			// http://www.femalefirst.co.uk/image-library/deluxe/r/real-housewives-of-beverly-hills-season-8-camille-grammer-deluxe-image.jpg (2249x3000)
			// http://www.femalefirst.co.uk/image-library/deluxe/w/world-of-warcraft-battle-for-azeroth-logo-deluxe.jpg (4500x2400)
			// https://www.femalefirst.co.uk/image-library/deluxe/s/starsdance-1.jpg -- 404, returns blank document (0 bytes), but "original" etc. return a proper 404 html page
			//return src.replace(/\/(?:[0-9]+x[0-9]+x)?x*([^/.]*\.[^/.]*)[^/]*$/, "/$1");
			src = src.replace(/\/[0-9x]*([^/.]*\.[^/.]*)[^/]*$/, "/$1");
			origsize = src.match(/\/([0-9]*)\/.\/[^/]*$/);
			if (origsize) {
				size = origsize[1];
				if (parseInt(size, 10) < 1000) {
					src = src.replace(/\/[0-9]*(\/.\/[^/]*)$/, "/1000$1");
				}
			}
			return src;
		}

		if (domain === "img.buzzfeed.com") {
			// wip
			// https://img.buzzfeed.com/buzzfeed-static/static/2014-11/19/17/enhanced/webdr10/longform-original-17700-1416435430-4.png
			// https://img.buzzfeed.com/buzzfeed-static/static/2014-11/19/17/campaign_images/webdr03/nick-hewer-has-just-done-his-best-ever-facial-exp-2-32167-1416437197-0_dblbig.jpg
			// https://img.buzzfeed.com/buzzfeed-static/static/2018-01/26/9/campaign_images/buzzfeed-prod-fastlane-03/the-us-olympic-committee-demands-all-usa-gymnasti-2-2591-1516975268-0_dblwide.jpg
			// https://img.buzzfeed.com/buzzfeed-static/static/2018-01/26/8/campaign_images/buzzfeed-prod-fastlane-01/the-supreme-court-stopped-alabama-from-executing--2-14117-1516973637-0_dblwide.jpg
			//   https://img.buzzfeed.com/buzzfeed-static/static/2018-01/25/22/asset/buzzfeed-prod-fastlane-02/sub-buzz-5552-1516935824-2.jpg -- unrelated?
			// https://img.buzzfeed.com/buzzfeed-static/static/2016-05/12/16/enhanced/webdr08/original-6479-1463084088-1.jpg
			// https://img.buzzfeed.com/buzzfeed-static/static/2017-08/22/15/enhanced/buzzfeed-prod-fastlane-01/original-18338-1503431220-9.png
			// https://img.buzzfeed.com/buzzfeed-static/static/2018-04/11/8/enhanced/buzzfeed-prod-web-03/original-16715-1523449517-2.jpg
			return src
				.replace(/_big(\.[^/.]*)$/, "_dblbig$1")
				.replace(/_wide(\.[^/.]*)$/, "_dblbig$1")
				.replace(/_dblwide(\.[^/.]*)$/, "_dblbig$1");
		}

		if (domain_nowww === "thegenealogist.co.uk") {
			// https://www.thegenealogist.co.uk/images/featuredarticles/header_sm/wdytya2016_dyer.jpg
			//   https://www.thegenealogist.co.uk/images/featuredarticles/header_lg/wdytya2016_dyer.jpg
			return src.replace(/\/images\/+featuredarticles\/+header_sm\//, "/images/featuredarticles/header_lg/");
		}

		if (domain === "251d2191a60056d6ba74-1671eccf3a0275494885881efb0852a4.ssl.cf1.rackcdn.com" ||
			// https://8583b52b4a309671f69d-b436b898353c7dc300b5887446a26466.ssl.cf1.rackcdn.com/20971239_donatella-arpaia-announces-shes_9eb94af2_m.jpg?bg=C6BDA4
			//   https://8583b52b4a309671f69d-b436b898353c7dc300b5887446a26466.ssl.cf1.rackcdn.com/20971239_donatella-arpaia-announces-shes_9eb94af2.jpg
			domain === "8583b52b4a309671f69d-b436b898353c7dc300b5887446a26466.ssl.cf1.rackcdn.com" ||
			// https://2e0a24317f4a9294563f-26c3b154822345d9dde0204930c49e9c.ssl.cf1.rackcdn.com/10033326_legends-of-tomorrow-casts-maisie-richardson-_35dcb2d4_m.jpg?bg=686658
			//   https://2e0a24317f4a9294563f-26c3b154822345d9dde0204930c49e9c.ssl.cf1.rackcdn.com/10033326_legends-of-tomorrow-casts-maisie-richardson-_35dcb2d4.jpg
			domain === "2e0a24317f4a9294563f-26c3b154822345d9dde0204930c49e9c.ssl.cf1.rackcdn.com" ||
			// https://7f9c61237bd6e732e57e-5fa18836a2ae6b5e7c49abcc89b20237.ssl.cf1.rackcdn.com/21774981_asia-argento-allegedly-admitted-to-sex_c58de1d1_m.jpg?bg=5E5E5E
			//   https://7f9c61237bd6e732e57e-5fa18836a2ae6b5e7c49abcc89b20237.ssl.cf1.rackcdn.com/21774981_asia-argento-allegedly-admitted-to-sex_c58de1d1.jpg
			domain === "7f9c61237bd6e732e57e-5fa18836a2ae6b5e7c49abcc89b20237.ssl.cf1.rackcdn.com" ||
			// http://homerumah.info/biggest-single-pon-de-replay
			// https://b6c18f286245704fe3e9-05e2055f4cd9122af02914269431c9f6.ssl.cf1.rackcdn.com/20635950_rihanna-is-still-jamming-out-to-pon_c63473e4_m.jpg?bg=554F57
			//   https://b6c18f286245704fe3e9-05e2055f4cd9122af02914269431c9f6.ssl.cf1.rackcdn.com/20635950_rihanna-is-still-jamming-out-to-pon_c63473e4.jpg
			domain === "b6c18f286245704fe3e9-05e2055f4cd9122af02914269431c9f6.ssl.cf1.rackcdn.com" ||
			// https://www.notey.com/blogs/her-source-%7C-hip-hop-beauty-trends
			// https://41dcdfcd4dea0e5aba20-931851ca4d0d7cdafe33022cf8264a37.ssl.cf1.rackcdn.com/18305364_some-fans-are-now-realizing-rihanna_97a66a0b_m.jpg?bg=503D37
			//   https://41dcdfcd4dea0e5aba20-931851ca4d0d7cdafe33022cf8264a37.ssl.cf1.rackcdn.com/18305364_some-fans-are-now-realizing-rihanna_97a66a0b.jpg
			domain === "41dcdfcd4dea0e5aba20-931851ca4d0d7cdafe33022cf8264a37.ssl.cf1.rackcdn.com" ||
			// https://www.notey.com/blogs/taryn-manning?page=2
			// https://575717b777ff8d928c6b-704c46a8034042e4fc898baf7b3e75d9.ssl.cf1.rackcdn.com/11492238_taryn-manning-flaunts-a-colorful-80s-inspired_f0ada11c_m.jpg?bg=A08D87
			//   https://575717b777ff8d928c6b-704c46a8034042e4fc898baf7b3e75d9.ssl.cf1.rackcdn.com/11492238_taryn-manning-flaunts-a-colorful-80s-inspired_f0ada11c.jpg
			domain === "575717b777ff8d928c6b-704c46a8034042e4fc898baf7b3e75d9.ssl.cf1.rackcdn.com" ||
			// https://598d5fcf392acad97538-395e64798090ee0a3a571e8c148d44f2.ssl.cf1.rackcdn.com/19551117_israeli-vr-tech-takes-fashiontv_2f7b85b8_m.jpg?bg=2A323B
			//   https://598d5fcf392acad97538-395e64798090ee0a3a571e8c148d44f2.ssl.cf1.rackcdn.com/19551117_israeli-vr-tech-takes-fashiontv_2f7b85b8.jpg
			domain === "598d5fcf392acad97538-395e64798090ee0a3a571e8c148d44f2.ssl.cf1.rackcdn.com") {
			// https://251d2191a60056d6ba74-1671eccf3a0275494885881efb0852a4.ssl.cf1.rackcdn.com/11860912_countdowns-nick-hewer-amstrad-should_6d456945_m.jpg?bg=7C7374
			//   https://251d2191a60056d6ba74-1671eccf3a0275494885881efb0852a4.ssl.cf1.rackcdn.com/11860912_countdowns-nick-hewer-amstrad-should_6d456945.jpg
			return src.replace(/(\/[^/.]*)_[a-z](\.[^/.?]*)(?:\?[^/]*)?$/, "$1$2");
		}

		if (domain === "be35832fa5168a30acd6-5c7e0f2623ae37b4a933167fe83d71b5.ssl.cf3.rackcdn.com") {
			// https://be35832fa5168a30acd6-5c7e0f2623ae37b4a933167fe83d71b5.ssl.cf3.rackcdn.com/2827/holly-willoughby-head-shot__hero.jpg?1469632555
			//   https://be35832fa5168a30acd6-5c7e0f2623ae37b4a933167fe83d71b5.ssl.cf3.rackcdn.com/2827/holly-willoughby-head-shot.jpg?1469632555
			return src.replace(/__hero(\.[^/.]*)(?:[?#].*)?$/, "$1");
		}

		if (domain === "7e7781e2f767494a7128-d0458b7f69ca26f2871554faadb4939e.ssl.cf5.rackcdn.com") {
			// https://7e7781e2f767494a7128-d0458b7f69ca26f2871554faadb4939e.ssl.cf5.rackcdn.com/wp-content/themes/photolux/images/box-hover-plus.png
			// https://7e7781e2f767494a7128-d0458b7f69ca26f2871554faadb4939e.ssl.cf5.rackcdn.com/wp-content/themes/photolux/images/box-hover.png
			if (/\/wp-content\/+themes\/+photolux\/+images\//.test(src))
				return {
					url: src,
					bad: "mask"
				};
		}

		if ((domain_nosub === "shopify.com" && /^cdn[0-9]*\./.test(domain)) ||
			// thanks to jonestly on discord:
			// https://fellowproducts.com/cdn/shop/products/1_MBStudio_PDP_500x.png?v=1664823133
			((domain_nowww === "fellowproducts.com" ||
			// thanks to anonymous for reporting:
			// https://store.mossyoak.com/cdn/shop/collections/MossyOakStore_2880x1620_Men_2400x.jpg?v=1641484929
			//   https://store.mossyoak.com/cdn/shop/collections/MossyOakStore_2880x1620_Men.jpg?v=1641484929
			domain === "store.mossyoak.com" ||
			// thanks to karpuzikov on github: https://github.com/qsniyg/maxurl/issues/1198
			// https://eu.ecoflow.com/cdn/shop/products/ecoflow-river-2-pro-portable-power-station-42466006433956_150x.png?v=1675844913
			//   https://eu.ecoflow.com/cdn/shop/products/ecoflow-river-2-pro-portable-power-station-42466006433956.png?v=1675844913
			domain_nosub === "ecoflow.com" ||
			// thanks to anonymous for reporting:
			// https://levitation.fm/cdn/shop/files/KGLW-REDROCKS2023-SPLATTERVINYLBOXSET-23_2048x2048.jpg?v=1692213769
			//   https://levitation.fm/cdn/shop/files/KGLW-REDROCKS2023-SPLATTERVINYLBOXSET-23.jpg?v=1692213769
			domain_nowww === "levitation.fm" ||
			// thanks to anonymous for reporting:
			// https://mariahcarey.store/cdn/shop/products/Mariah-Daydream_02a8f0ee-4fb3-47b9-81b2-cb1d812b5bae_1800x1800.png?v=1599600218
			domain_nowww === "mariahcarey.store" ||
			// thanks to fireattack:
			// https://trueself2020.com/cdn/shop/articles/NEWS_41e9c5c0-22ee-4211-8b45-d6ab6f478282_1600x.jpg?v=1698137059
			//   https://trueself2020.com/cdn/shop/articles/NEWS_41e9c5c0-22ee-4211-8b45-d6ab6f478282.jpg?v=1698137059
			domain_nowww === "trueself2020.com" ||
			// thanks to anonymous for reporting:
			// https://theoldmapshop.com/cdn/shop/products/il_fullxfull.1732560398_rzty_1500x.jpg
			//   https://theoldmapshop.com/cdn/shop/products/il_fullxfull.1732560398_rzty.jpg
			domain_nowww === "theoldmapshop.com" ||
			// thanks to anonymous for reporting:
			// https://www.ballyrobertgardens.com/cdn/shop/products/Asplenium_scolopendrium_7_1024x1024.JPG?v=1549464813
			//   https://www.ballyrobertgardens.com/cdn/shop/products/Asplenium_scolopendrium_7.JPG?v=1549464813
			domain_nowww === "ballyrobertgardens.coM" ||
			// thanks to anonymous for reporting:
			// https://herb-era.com/cdn/shop/articles/38_2000x.jpg?v=1628635384
			//   https://herb-era.com/cdn/shop/articles/38.jpg?v=1628635384
			domain_nowww === "herb-era.com" ||
			// thanks to anonymous for reporting:
			// https://deltagoodrem.com/cdn/shop/files/large.T95JuiIkD8uYxlRIpRCfgQnCh0amkV9xVTg8fLiqK9o_1920x.jpg?v=1689099080
			//   https://deltagoodrem.com/cdn/shop/files/large.T95JuiIkD8uYxlRIpRCfgQnCh0amkV9xVTg8fLiqK9o.jpg?v=1689099080
			domain_nowww === "deltagoodrem.com" ||
			// thanks to karpuzikov on github: https://github.com/qsniyg/maxurl/issues/1268
			// https://partners.spigen.com/cdn/shop/products/title_ipad_pro_11_2020_rugged_armor_pro_02_175x.progressive.jpg?v=1659056452
			//   https://partners.spigen.com/cdn/shop/products/title_ipad_pro_11_2020_rugged_armor_pro_02.jpg?v=1659056452
			domain === "partners.spigen.com" ||
			// thanks to anonymous for reporting:
			// https://cosmicbackground.io/cdn/shop/articles/hunt_banner.jpg?v=1661104358&width=100
			//   https://cosmicbackground.io/cdn/shop/articles/hunt_banner.jpg?v=1661104358
			domain_nowww === "cosmicbackground.io" ||
			// thanks to anonymous for reporting:
			// https://spicetribe.com/cdn/shop/articles/20221104222541-ej39kij_360x.jpg?v=1679358983
			//   https://spicetribe.com/cdn/shop/articles/20221104222541-ej39kij.jpg?v=1679358983
			//domain_nowww == "spicetribe.com" ||
			// thanks to jonestly on discord:
			// https://www.roguewavecoffee.ca/cdn/shop/products/zp6dark_532x532.png?v=1670808549
			domain_nowww === "roguewavecoffee.ca") && /\/cdn\/+shop\//.test(src)) ||
			/^[a-z]+:\/\/[^/]+\/+cdn\/+shop\/+(?:products|collections|files|articles)\/+[^/.?#]+(?:\.progressive)?\.[a-zA-Z]+(?:[?#].*)?$/.test(src)) {
			// https://cdn.shopify.com/s/files/1/0086/0969/3776/t/56/assets/product-highlight-color-hover.svg
			if (/\/assets\/+product-highlight-color-hover\.svg(?:[?#].*)?$/.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}

			// https://cdn.shopify.com/s/files/1/0947/6410/products/a2178934757_10_1024x1024.jpeg?v=1458824230
			//   https://cdn.shopify.com/s/files/1/0947/6410/products/a2178934757_10_x1024.jpeg?v=1458824230
			//   https://cdn.shopify.com/s/files/1/0947/6410/products/a2178934757_10.jpeg?v=1458824230
			// https://cdn.shopify.com/s/files/1/0947/6410/products/Om-Sweet-Om_1024x1024.png?v=1450196316
			//   https://cdn.shopify.com/s/files/1/0947/6410/products/Om-Sweet-Om.png?v=1450196316
			// https://cdn.shopify.com/s/files/1/2220/9229/products/Siticker_laptop_image_2048x.jpg
			//   https://cdn.shopify.com/s/files/1/2220/9229/products/Siticker_laptop_image.jpg
			// https://cdn.shopify.com/s/files/1/0846/3086/products/DM21_copy2_large.jpg?v=1464040850
			//   https://cdn.shopify.com/s/files/1/0846/3086/products/DM21_copy2.jpg?v=1464040850
			// http://cdn.shopify.com/s/files/1/0683/4117/products/IMG_6727_grande.jpg?v=1514569448
			//   https://cdn.shopify.com/s/files/1/0683/4117/products/IMG_6727.jpg?v=1514569448
			// https://cdn.shopify.com/s/files/1/1581/4309/articles/stealherstyle-emmawatsonmetgala-tutorial02_1400x.progressive.jpg?v=1490365007
			//   https://cdn.shopify.com/s/files/1/1581/4309/articles/stealherstyle-emmawatsonmetgala-tutorial02.jpg?v=1490365007
			// https://cdn.shopify.com/s/files/1/2684/7106/products/LKE600_720x@2x.jpg?v=1514632635
			//   https://cdn.shopify.com/s/files/1/2684/7106/products/LKE600.jpg?v=1514632635
			// https://cdn.shopify.com/s/files/1/1066/4366/products/MG_84122_compact.jpg?v=1527671088
			//   https://cdn.shopify.com/s/files/1/1066/4366/products/MG_84122.jpg?v=1527671088
			// https://cdn.shopify.com/s/files/1/1878/3879/products/N0690_400x_crop_center.jpg?v=1510258264
			//   https://cdn.shopify.com/s/files/1/1878/3879/products/N0690.jpg?v=1510258264
			// https://cdn.shopify.com/s/files/1/2656/7538/files/de-mining_large.jpg?v=1524250443-/format/auto/-/stretch/off/-/resize/3000x/-/quality/lighter/-/format/auto/-/stretch/off/-/resize/3000x/-/quality/lighter/-/format/auto/-/stretch/off/-/resize/3000x/-/quality/lighter/
			//   https://cdn.shopify.com/s/files/1/2656/7538/files/de-mining.jpg
			// https://cdn2.shopify.com/s/files/1/0875/3268/products/Max-Payne-3-Sony-PlayStation-3-PS3-Game-Screenshot-4_1024x1024.jpg?v=1501206616
			//   https://cdn2.shopify.com/s/files/1/0875/3268/products/Max-Payne-3-Sony-PlayStation-3-PS3-Game-Screenshot-4.jpg?v=1501206616
			// thanks to jonestly on discord:
			// https://cdn.shopify.com/s/files/1/0702/0489/products/TINOCO.gif?v=1641501965&width=900
			//   https://cdn.shopify.com/s/files/1/0702/0489/products/TINOCO.gif?v=1641501965&width=900
			// https://cdn.shopify.com/s/files/1/0702/0489/products/TINOCO.gif?v=1641501965&height=900
			//   https://cdn.shopify.com/s/files/1/0702/0489/products/TINOCO.gif?v=1641501965
			newsrc = src.replace(/_(?:large|medium|small|grande|compact|[0-9]+x(?:[0-9]+)?|x[0-9]+)(?:@[0-9]+x)?(?:_crop_[a-z]+)?(?:\.progressive)?(\.[^/.]*)(?:[?#].*)?$/, "$1");
			return remove_queries(newsrc, ["width", "height"]);
		}

		if (domain === "cdn.itv.com") {
			// https://cdn.itv.com/uploads/editor/medium_DyTW1moFnODLSb6a6IiBigbhufrsOXe2y3XWw1ekUN8.jpg
			//   https://cdn.itv.com/uploads/editor/DyTW1moFnODLSb6a6IiBigbhufrsOXe2y3XWw1ekUN8.jpg
			return src.replace(/\/[a-z]*_([^/_]*)$/, "/$1");
		}

		if (domain === "thumbnailer.mixcloud.com") {
			// https://thumbnailer.mixcloud.com/unsafe/300x300/extaudio/8/4/1/d/f744-6169-4217-8d70-fe2abfd417f2
			//   https://thumbnailer.mixcloud.com/unsafe/0x0/extaudio/8/4/1/d/f744-6169-4217-8d70-fe2abfd417f2
			return src.replace(/\/unsafe\/[0-9]+x[0-9]+\//, "/unsafe/0x0/");
		}

		if (domain === "d3mkh5naggjddw.cloudfront.net" ||
			// https://img.blvds.com/unsafe/fit-in/smart/https://res.cloudinary.com/hynomj8e0/image/upload/v1487089435/ajb3zxdwskxppk9ih7fi.jpg
			//   https://res.cloudinary.com/hynomj8e0/image/upload/ajb3zxdwskxppk9ih7fi.jpg
			domain === "img.blvds.com" ||
			// https://resizer.mundotkm.com/unsafe/700x1050/http://cfglobal01.mundotkm.com/2017/07/147114_MP1_1318-e1500065093615.jpg
			//   http://cfglobal01.mundotkm.com/2017/07/147114_MP1_1318-e1500065093615.jpg
			// https://resizer.mundotkm.com/unsafe/http://cfglobal01.mundotkm.com/2017/07/147114_MP1_1037-e1500064972548.jpg
			// https://resizer.mundotkm.com/unsafe/smart/http://cfglobal01.mundotkm.com/2016/12/leslie.jpg
			//   http://cfglobal01.mundotkm.com/2016/12/leslie.jpg
			domain === "resizer.mundotkm.com" ||
			// https://d2isyty7gbnm74.cloudfront.net/unsafe/646x646/https://square-production.s3.amazonaws.com/files/6b56d9597b7a852f61ae767adb0bbe68f722cc80/original.jpeg
			//   https://square-production.s3.amazonaws.com/files/6b56d9597b7a852f61ae767adb0bbe68f722cc80/original.jpeg
			domain === "d2isyty7gbnm74.cloudfront.net" ||
			// http://thumb.connect360.vn/unsafe/0x0/imgs.emdep.vn/Share/Image/2015/05/14/1-100345208.jpg
			//   http://imgs.emdep.vn/Share/Image/2015/05/14/1-100345208.jpg
			domain === "thumb.connect360.vn" ||
			// https://img.movietimes.com/unsafe/fit-in/300x500/smart/https://assets.movietimes.com/v1/celebrity_images/6589/2DN3Hi8AxyiUClzCun7ANG3YBhS.jpg
			//   https://assets.movietimes.com/v1/celebrity_images/6589/2DN3Hi8AxyiUClzCun7ANG3YBhS.jpg
			domain === "img.movietimes.com" ||
			// https://t.t2online.co.in/unsafe/smart/filters:format(webp)/images.anandabazar.com/polopoly_fs/1.855966.1535611606!/image/image.jpg_gen/derivatives/landscape_390/image.jpg
			//   http://images.anandabazar.com/polopoly_fs/1.855966.1535611606!/image/image.jpg_gen/derivatives/landscape_390/image.jpg
			domain === "t.t2online.co.in" ||
			// http://thum.buzzni.com/unsafe/320x320/center/smart/http://image.gsshop.com/image/31/58/31580182_L1.jpg
			//   http://image.gsshop.com/image/31/58/31580182_L1.jpg
			domain === "thum.buzzni.com" ||
			// https://resizer.mundotkm.com/unsafe/smart/http://cfus01.mundotkm.com/2015/12/nicki-look.jpg
			//   http://cfus01.mundotkm.com/2015/12/nicki-look.jpg
			domain === "resizer.mundotkm.com" ||
			// https://quicksilver.scoopwhoop.com/unsafe/200x105/center/https://s4.scoopwhoop.com/anj2/5cf6091cd0aa382561bf481b/e32a27fe-26ce-4a41-93c9-e96200aa57bf.jpg
			//   https://s4.scoopwhoop.com/anj2/5cf6091cd0aa382561bf481b/e32a27fe-26ce-4a41-93c9-e96200aa57bf.jpg
			domain === "quicksilver.scoopwhoop.com" ||
			// https://m.telegraphindia.com/unsafe/620x350/smart/static.telegraphindia.com/derivative/THE_TELEGRAPH/1691157/16X9/imagef8c0f45f-486b-4aba-9ee8-21091dce0902.jpg
			//   https://static.telegraphindia.com/derivative/THE_TELEGRAPH/1691157/16X9/imagef8c0f45f-486b-4aba-9ee8-21091dce0902.jpg
			domain_nosub === "telegraphindia.com" ||
			// https://mediacdn.libertatea.ro/unsafe/1260x708/smart/filters:contrast(8):quality(80)/https://static4.libertatea.ro/wp-content/uploads/2019/12/morga-timisoaraprofimedia-0416497986.jpg
			//   https://static4.libertatea.ro/wp-content/uploads/2019/12/morga-timisoaraprofimedia-0416497986.jpg
			domain === "mediacdn.libertatea.ro" ||
			// thanks to roi:
			// https://imgresizer.eurosport.com/unsafe/420x0/filters:format(webp):focal(1277x598:1279x596)/origin-imgresizer.eurosport.com/2022/10/21/3476596-70879088-2560-1440.jpg
			//   https://origin-imgresizer.eurosport.com/2022/10/21/3476596-70879088-2560-1440.jpg
			domain === "imgresizer.eurosport.com" ||
			// thanks to anonymous for reporting:
			// https://gdn.printerval.com/unsafe/136x136/assets.printerval.com/2023/01/17/51acb986-8e15-4ee0-aeee-f7459c1982c7.png
			//   http://assets.printerval.com/2023/01/17/51acb986-8e15-4ee0-aeee-f7459c1982c7.png
			domain === "gdn.printerval.com" ||
			// https://t2.genius.com/unsafe/220x0/https%3A%2F%2Fimages.genius.com%2F4e99624bb74700cf1a5ac40f142cb7cf.1000x1000x1.jpg
			//   https://images.genius.com/4e99624bb74700cf1a5ac40f142cb7cf.1000x1000x1.jpg
			(domain_nosub === "genius.com" && domain.match(/t[0-9]*\.genius\.com/))) {
			// https://d3mkh5naggjddw.cloudfront.net/unsafe/smart/filters:format(jpeg)/http%3A%2F%2Fi.dailymail.co.uk%2Fi%2Fpix%2F2017%2F08%2F10%2F19%2F43248C1D00000578-0-image-a-10_1502389640540.jpg
			//   http://i.dailymail.co.uk/i/pix/2017/08/10/19/43248C1D00000578-0-image-a-10_1502389640540.jpg
			return add_http(decodeURIComponent(src
											   .replace(/.*\/unsafe\/(?:fit-in\/)?(?:[0-9]+x[0-9]+\/)?smart\/(?:filters:[^/]*\/)?/, "")
											   .replace(/.*\/unsafe\/(?:fit-in\/)?(?:[0-9]+x[0-9]+\/)?filters:[^/]*\//, "")
											   .replace(/.*\/unsafe\/fit-in\/smart\//, "")
											   .replace(/.*\/unsafe\/(?:fit-in\/)?(?:[0-9]*x[0-9]*\/)?(?:center\/)?(?:smart\/)?/, "")));
		}

		if (domain === "cdn.uwants.com" ||
			// https://cdn.discuss.com.hk/t/4f8708/f/800x0/https://img.discuss.com.hk/d/attachments/day_141006/20141006_8f6117fe2810d1ccb83bqK4OauUMfFXe.jpg
			//   https://img.discuss.com.hk/d/attachments/day_141006/20141006_8f6117fe2810d1ccb83bqK4OauUMfFXe.jpg
			// https://cdn.discuss.com.hk/t/10b213/f/800x0/https://i.ytimg.com/an_webp/upAJE_XhT2Y/mqdefault_6s.webp?du=3000&sqp=CJjq9uwF&rs=AOn4CLB94EaP5VlCpbK0D325pPcOUX4kKg
			//   https://i.ytimg.com/an_webp/upAJE_XhT2Y/mqdefault_6s.webp?du=3000&sqp=CJjq9uwF&rs=AOn4CLB94EaP5VlCpbK0D325pPcOUX4kKg
			domain === "cdn.discuss.com.hk") {
			// https://cdn.uwants.com/t/d72610/f/320x0/filters:extract_cover()/https://img.uwants.com/attachments/day_160614/20160614_9242d5cc975b38a704016qYhzjhCytoI.jpg
			//   https://img.uwants.com/attachments/day_160614/20160614_9242d5cc975b38a704016qYhzjhCytoI.jpg
			// https://cdn.uwants.com/t/03d004/f/800x0/https://img.uwants.com/attachments/day_160614/20160614_9242d5cc975b38a704016qYhzjhCytoI.jpg
			//   https://img.uwants.com/attachments/day_160614/20160614_9242d5cc975b38a704016qYhzjhCytoI.jpg
			return src.replace(/^[a-z]+:\/\/[^/]*\/+t\/+[0-9a-f]+\/+f\/+[0-9]+x[0-9]+\/+(?:filters:[^/]*\/+)?(https?:)/, "$1");
			//return src.replace(/^[a-z]+:\/\/[^/]*\/t\/+[0-9a-z]+\/+.\/+[0-9]+x[0-9]+\/http/, "http");
		}

		if (domain === "elsewhere.scdn3.secure.raxcdn.com") {
			// seems to be the number of pixels??
			// https://elsewhere.scdn3.secure.raxcdn.com/images/v95000/articles/the-rolling-stones-2013-glastonbury-festival-35.jpg -- 267x354
			//   https://elsewhere.scdn3.secure.raxcdn.com/images/v9999999999999/articles/the-rolling-stones-2013-glastonbury-festival-35.jpg -- 754x1000
			//   https://elsewhere.scdn3.secure.raxcdn.com/images/downloads/articles/the-rolling-stones-2013-glastonbury-festival-35.jpg -- 754x1000
			// https://elsewhere.scdn3.secure.raxcdn.com/images/s290/articles/Bj%C3%B6rk-Debut-1993.png -- 290x290
			//   https://elsewhere.scdn3.secure.raxcdn.com/images/downloads/articles/Bj%C3%B6rk-Debut-1993.png
			// https://elsewhere.scdn3.secure.raxcdn.com/images/v9500/articles/Bj%C3%B6rk-Debut-1993.png -- 97x97
			//   https://elsewhere.scdn3.secure.raxcdn.com/images/downloads/articles/Bj%C3%B6rk-Debut-1993.png -- 316x316
			//return src.replace(/\/images\/v[0-9]*\//, "/images/v999999999999999999/");
			return src.replace(/\/images\/[sv][0-9]+\/articles\//, "/images/downloads/articles/");
		}

		if (domain === "japantoday-asset.scdn3.secure.raxcdn.com") {
			// https://japantoday-asset.scdn3.secure.raxcdn.com/img/store/76/9f/6cd5af44f1b594cd199d09b52aa23fea5659/amuro/_w850.jpg
			//   https://japantoday-asset.scdn3.secure.raxcdn.com/img/store/76/9f/6cd5af44f1b594cd199d09b52aa23fea5659/amuro.jpg
			return src.replace(/(\/+img\/+store\/+[0-9a-f]{2}\/+[0-9a-f]{2}\/+[0-9a-f]+\/+[^/]*)(?:\/+_[wh][0-9]+)?(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "static01.nyt.com" ||
			// http://graphics8.nytimes.com/images/2011/11/17/fashion/17felicityspan/17felicityspan-thumbStandard.jpg
			//   http://graphics8.nytimes.com/images/2011/11/17/fashion/17felicityspan/17felicityspan-jumbo.jpg
			(domain_nosub === "nytimes.com" && domain.match(/^graphics[0-9]*\./)) ||
			domain === "cdn1.nyt.com") {
			// https://static01.nyt.com/images/2018/02/03/arts/03playlist/merlin_123145877_5ed2acde-72d5-4afb-a19a-93dbc29b5d2f-superJumbo.jpg?quality=100&auto=webp
			// https://static01.nyt.com/images/2015/08/30/arts/30RICHARDSJP5/30RICHARSJP5-superJumbo.jpg
			// https://static01.nyt.com/images/2015/09/17/arts/17KEITH/17KEITH-jumbo.jpg
			// https://static01.nyt.com/images/2015/09/17/arts/17KEITH/17KEITH-thumbStandard.jpg
			// https://static01.nyt.com/images/2015/08/30/arts/30RICHARDS1/30RICHARDS1-master1050.jpg
			// https://static01.nyt.com/images/2015/08/30/arts/30RICHARDSSUB4/30RICHARDSSUB4-master675.jpg
			// https://static01.nyt.com/images/2018/02/03/arts/03playlist/merlin_123145877_5ed2acde-72d5-4afb-a19a-93dbc29b5d2f-superJumbo.jpg?quality=100&auto=webp
			// https://static01.nyt.com/newsgraphics/2018/02/11/mens-slopestyle/assets/images/composite-2-2000_x2.jpg (4000x2058)
			// https://static01.nyt.com/images/2018/02/23/nyregion/23WOMEN01/merlin_134412716_f1cbfeaa-8204-41b1-9576-8cc8c5063348-threeByTwoLargeAt2X.jpg (3600x2400)
			// https://static01.nyt.com/newsgraphics/2014/09/24/private-lives/assets/private_lives_nilsen_1400_v1.png
			// https://static01.nyt.com/packages/flash/Lens/2011/06/20110629-KM-Weiwei/012-20110629-KM-Weiwei.JPG (4193x3307)
			// https://static01.nyt.com/images/2018/02/23/us/politics/23dc-note/merlin_134350481_6712d7ba-b262-4d9e-97f3-8094cc9de088-threeByTwoLargeAt2X.jpg
			// https://static01.nyt.com/newsgraphics/2017/10/31/yellen-legacy/50c5752d6294e63077f7e841ccf62b880fd1599e/yellen-office-alt-1.jpg (5472x3648)
			// https://static01.nyt.com/packages/flash/Lens/2010/10/20101025-NK-Joao/20101025-Joao-extra4.jpg (3200x2108)
			// https://static01.nyt.com/images/2010/10/06/nyregion/20101006Nocturnalist/20101006Nocturnalist-custom1.jpg (5120x3413)
			// https://static01.nyt.com/images/2010/10/06/nyregion/20101006Nocturnalist/20101006Nocturnalist-custom2.jpg ^
			// https://static01.nyt.com/images/2009/02/08/sports/20090209-SIOUX-S.JPG
			// https://static01.nyt.com/images/2010/01/05/arts/supperbig2.jpg (3000x2000)
			// https://static01.nyt.com/images/2015/10/25/t-magazine/25tmag-11well_rihanna-t_CA0/25tmag-11well_rihanna-t_CA0-facebookJumbo.jpg (1050x550)
			//   https://static01.nyt.com/images/2015/10/25/t-magazine/25tmag-11well_rihanna-t_CA0/25tmag-11well_rihanna-t_CA0-superJumbo.jpg (1639x2048)
			// https://static01.nyt.com/images/2015/10/12/t-magazine/12tmag-rihanna-toc-t/12tmag-rihanna-toc-t-blog427.jpg
			//   https://static01.nyt.com/images/2015/10/12/t-magazine/12tmag-rihanna-toc-t/12tmag-rihanna-toc-t-superJumbo.jpg
			// https://static01.nyt.com/images/2016/11/03/fashion/03SKIN1/03SKIN1-master1050-v2.jpg
			//   https://static01.nyt.com/images/2016/11/03/fashion/03SKIN1/03SKIN1-superJumbo-v2.jpg
			// https://static01.nyt.com/images/2013/07/02/fashion/01RUNWAYVERSACE1/01RUNWAYVERSACE1-articleInline.jpg
			//   https://static01.nyt.com/images/2013/07/02/fashion/01RUNWAYVERSACE1/01RUNWAYVERSACE1-superJumbo.jpg
			// https://static01.nyt.com/images/2018/10/03/opinion/the-argument-album-art/the-argument-album-art-square320-v3.png
			//   https://static01.nyt.com/images/2018/10/03/opinion/the-argument-album-art/the-argument-album-art-superJumbo-v3.png
			// https://static01.nyt.com/images/2018/11/02/arts/02NOVEMBER-STREAM-grid/02NOVEMBER-STREAM-grid-videoSixteenByNineJumbo1600.jpg
			//   https://static01.nyt.com/images/2018/11/02/arts/02NOVEMBER-STREAM-grid/02NOVEMBER-STREAM-grid-superJumbo.jpg
			// https://static01.nyt.com/images/2017/02/06/opinion/RFD-Uber-boycott/RFD-Uber-boycott-sfSpan.jpg
			//   https://static01.nyt.com/images/2017/02/06/opinion/RFD-Uber-boycott/RFD-Uber-boycott-superJumbo.jpg
			// https://static01.nyt.com/images/2018/11/07/upshot/up-amazonLIC/merlin_146433831_bfa25793-62a9-4d41-9317-28c0706c4664-videoLarge.jpg
			//   https://static01.nyt.com/images/2018/11/07/upshot/up-amazonLIC/merlin_146433831_bfa25793-62a9-4d41-9317-28c0706c4664-superJumbo.jpg
			// https://static01.nyt.com/images/2018/09/20/style/XXtinylove-promo-4/XXtinylove-promo-4-videoLarge-v2.jpg
			//   https://static01.nyt.com/images/2018/09/20/style/XXtinylove-promo-4/XXtinylove-promo-4-superJumbo.jpg
			// https://static01.nyt.com/images/2018/08/10/dining/10SKILLET3/10SKILLET3-mediumThreeByTwo252-v2.jpg
			//   https://static01.nyt.com/images/2018/08/10/dining/10SKILLET3/10SKILLET3-superJumbo-v2.jpg
			// https://static01.nyt.com/images/2018/01/14/arts/14CAMILA1/14CAMILA1-articleLarge.jpg
			//   https://static01.nyt.com/images/2018/01/14/arts/14CAMILA1/14CAMILA1-superJumbo.jpg
			// https://cdn1.nyt.com/images/2018/01/14/arts/14CAMILA1/14CAMILA1-thumbLarge-v2.jpg
			//   https://cdn1.nyt.com/images/2018/01/14/arts/14CAMILA1/14CAMILA1-superJumbo.jpg
			// https://static01.nyt.com/images/2018/01/14/arts/14CAMILA1/14CAMILA1-videoSixteenByNine768-v2.jpg
			//   https://static01.nyt.com/images/2018/01/14/arts/14CAMILA1/14CAMILA1-superJumbo.jpg
			// https://static01.nyt.com/images/2018/01/14/arts/14CAMILA1/14CAMILA1-watch308-v2.jpg
			//   https://static01.nyt.com/images/2018/01/14/arts/14CAMILA1/14CAMILA1-superJumbo.jpg
			// https://static01.nyt.com/images/2019/05/22/arts/22got-clarke/9f1eb2dc57734232b6f8cd0f13567ce9-threeByTwoSmallAt2X.jpg
			//   https://static01.nyt.com/images/2019/05/22/arts/22got-clarke/9f1eb2dc57734232b6f8cd0f13567ce9-superJumbo.jpg
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/458
			// https://static01.nyt.com/images/2020/09/26/business/25Adviser-illo/25Adviser-illo-videoSmall.jpg
			//   https://static01.nyt.com/images/2020/09/26/business/25Adviser-illo/25Adviser-illo-superJumbo.jpg
			// https://static01.nyt.com/images/2020/09/25/arts/25playlist/25playlist-videoSmall.jpg
			//   https://static01.nyt.com/images/2020/09/25/arts/25playlist/25playlist-superJumbo.jpg
			// https://static01.nyt.com/images/2020/09/24/us/politics/24onpolitics-SS-02/24onpolitics-SS-02-videoSmall-v2.jpg
			//   https://static01.nyt.com/images/2020/09/24/us/politics/24onpolitics-SS-02/24onpolitics-SS-02-superJumbo-v2.jpg
			// https://static01.nyt.com/images/2020/09/22/multimedia/22firehistory-08/22firehistory-08-threeByTwoMediumAt2X.jpg
			//   https://static01.nyt.com/images/2020/09/22/multimedia/22firehistory-08/22firehistory-08-superJumbo.jpg
			// https://static01.nyt.com/images/2020/09/26/multimedia/26Weekend-reads-promo/26Weekend-reads-promo-threeByTwoMediumAt2X.jpg
			//   https://static01.nyt.com/images/2020/09/26/multimedia/26Weekend-reads-promo/26Weekend-reads-promo-superJumbo.jpg
			// https://static01.nyt.com/images/2020/09/27/us/26protest-print/26protest3-threeByTwoMediumAt2X-v2.jpg
			//   https://static01.nyt.com/images/2020/09/27/us/26protest-print/26protest3-superJumbo-v2.jpg
			// https://static01.nyt.com/images/2020/09/23/arts/23idles1/23idles1-threeByTwoMediumAt2X-v2.jpg
			//   https://static01.nyt.com/images/2020/09/23/arts/23idles1/23idles1-superJumbo.jpg
			// https://static01.nyt.com/images/2020/09/27/arts/27michael-rimmer1/27michael-rimmer1-threeByTwoSmallAt2X-v2.jpg?quality=75&auto=webp&disable=upscale&width=400
			//   https://static01.nyt.com/images/2020/09/27/arts/27michael-rimmer1/27michael-rimmer1-threeByTwoSmallAt2X-v2.jpg
			// thanks to anonymous for reporting:
			// https://static01.nyt.com/images/2011/09/11/t-magazine/11well-emilia/11well-emilia-tmagArticle.jpg
			//   https://static01.nyt.com/images/2011/09/11/t-magazine/11well-emilia/11well-emilia-jumbo.jpg
			//
			// smaller:
			// https://static01.nyt.com/images/2019/02/14/nyregion/14NYAMAZON2/merlin_146867472_15c39bb2-67e7-40b9-9ae6-ef4693dd2ce9-videoSixteenByNine3000.jpg -- 3000x1688
			//   https://static01.nyt.com/images/2019/02/14/nyregion/14NYAMAZON2/merlin_146867472_15c39bb2-67e7-40b9-9ae6-ef4693dd2ce9-superJumbo.jpg --2048x1366
			// https://static01.nyt.com/images/2020/09/26/us/politics/26dc-scotus-2/26dc-scotus-2-threeByTwoLargeAt2X.jpg -- 5512x3675
			//
			// other urls:
			// https://static01.nyt.com/images/2018/04/14/business/dealbook/14db-anotherview1/merlin_136623336_403f4f04-e65b-4a16-8483-f7770fb63093-threeByTwoLargeAt2X.jpg -- 5823x3882
			//   https://static01.nyt.com/images/2018/04/14/business/dealbook/14db-anotherview1/merlin_136623336_403f4f04-e65b-4a16-8483-f7770fb63093-superJumbo.jpg -- 2048x1365
			// https://static01.nyt.com/images/2018/06/04/us/05DC-trump/05DC-trump-threeByTwoLargeAt2X.jpg -- 5472x3648
			// https://static01.nyt.com/images/2018/06/15/opinion/14endorseWeb-slide-B0R2/14endorseWeb-slide-B0R2-horizontalMediumAt2X.jpg -- 6510x4340
			// https://static01.nyt.com/images/2010/06/03/garden/03qanda-2/03qanda-2-popup.jpg -- 3744x5616
			// thanks to anonymous for reporting:
			// https://s1.nyt.com/timesmachine/pages/1/1977/07/31/92266267_360W.png?quality=75&auto=webp&disable=upscale
			// https://static01.nyt.com/images/2023/03/19/multimedia/15NASA-STYLE-01-mcqv/15NASA-STYLE-01-mcqv-videoSixteenByNine3000.jpg -- 3000x1687
			//
			// doesn't work:
			// https://static01.nyt.com/images/2010/10/24/arts/RICHARDS-Jp-1/RICHARDS-Jp-1-popup.jpg
			// https://static01.nyt.com/images/2011/11/17/fashion/17felicityspan/17felicityspan-jumbo.jpg
			// https://static01.nyt.com/images/2007/05/04/fashion/06love.1.ready/06love.1.ready-videoLarge-v3.jpg
			newsrc = src.replace(/[?#].*$/, "");
			if (newsrc !== src)
				return newsrc;

			// thanks to anonymous:
			// https://graphics8.nytimes.com/images/2008/11/02/opinion/02chart_190h.jpg
			//   https://graphics8.nytimes.com/images/2008/11/02/opinion/02chart_large.jpg
			newsrc = src.replace(/(\/images\/.*)_[0-9]+h(\.[a-z]+)$/, "$1_large$2");
			if (newsrc !== src)
				return newsrc;

			var matched = src.match(/-([^-_/.]*?)(?:-v[0-9]*)?\.[^/.]*$/);
			if (matched) {
				if (matched[1] === "jumbo" ||
					matched[1] === "thumbStandard" ||
					matched[1] === "facebookJumbo" ||
					matched[1] === "articleInline" ||
					matched[1] === "articleLarge" ||
					matched[1] === "sfSpan" ||
					matched[1] === "videoSmall" ||
					matched[1] === "videoLarge" ||
					matched[1] === "thumbLarge" ||
					matched[1] === "tmagArticle" ||
					matched[1].match(/^videoSixteenByNine(?:Jumbo)?(?:[0-9]{0,3}|[01][0-9]{3}|20[0-4][0-9])?$/) ||
					matched[1].match(/^mediumThreeByTwo[0-9]*/) ||
					matched[1].match(/^threeByTwo(?:Small|Medium)(?:At[0-9]+X)/) ||
					matched[1].match(/^watch[0-9]*$/) ||
					matched[1].slice(0, 6) === "master" ||
					matched[1].slice(0, 6) === "square" ||
					matched[1].slice(0, 4) === "blog") {
					newsrc = src.replace(/-[^-_/.]*(-v[0-9]*)?(\.[^/.]*)$/, "-superJumbo$1$2");
					if (newsrc !== src) {
						if (newsrc.match(/-v[0-9]*\.[^/.]*$/)) {
							return [
								newsrc,
								newsrc.replace(/-v[0-9]*(\.[^/.]*)$/, "$1")
							];
						} else {
							return [
								newsrc,
								newsrc.replace(/-superJumbo(\.[^/.]*)$/, "-jumbo$1")
							];
						}
					}
				}
			}
		}

		if (domain === "render.fineartamerica.com") {
			// https://render.fineartamerica.com/images/rendered/search/print/images-medium-5/keith-richards-andre-koekemoer.jpg
			//   https://images.fineartamerica.com/images-medium-large-5/keith-richards-andre-koekemoer.jpg
			// thanks to snek on discord for reporting:
			// https://pixels.com/featured/the-deep-blue-evening-ii-elena-kotliarker.html
			//   https://render.fineartamerica.com/previewhighresolutionimage.php?artworkid=16754002&widthmedium=780&heightmedium=500&x=400&y=200&domainUrl=pixels.com
			//   https://render.fineartamerica.com/previewhighresolutionimage.php?artworkid=16754002&widthmedium=780&heightmedium=500&x=400&y=200&domainUrl=++++++++++
			// other:
			// thanks to anonymous for reporting:
			// https://images.fineartamerica.com/images/artworkimages/mediumlarge/1/9-pink-floyd-early-years-booklet-alexandr-testudo.jpg
			newsrc = src.replace(/render\.fineartamerica\.com\/images\/rendered\/search\/print\/[^/]*(-[0-9]*)\/([^/]*)$/, "images.fineartamerica.com/images-medium-large$1/$2");
			if (newsrc !== src)
				return newsrc;

			// thanks to Noodlers on discord
			if (/\/previewhighresolutionimage\.php\?/.test(src)) {
				return add_queries(src, {domainUrl: "++++++++++"});
			}
		}

		if (domain === "media.npr.org") {
			// https://media.npr.org/assets/artslife/arts/2010/10/keith-richards/keith-richards-730d749c083f177cc443b4114ee1b19b1e257988-s400-c85.jpg
			//   https://media.npr.org/assets/artslife/arts/2010/10/keith-richards/keith-richards-730d749c083f177cc443b4114ee1b19b1e257988.jpg
			// https://media.npr.org/assets/img/2018/04/13/ap_17339773700572_wide-5b2806a60758e44c259842da1f23f45ac58b1c47.jpg
			//   https://media.npr.org/assets/img/2018/04/13/ap_17339773700572-5b2806a60758e44c259842da1f23f45ac58b1c47.jpg
			// https://media.npr.org/assets/img/2018/02/27/ap_17299821347425-0a0868f089eae2f95d1e5a4aaa0252c2176f1334-s800-c85.jpg
			//   https://media.npr.org/assets/img/2018/02/27/ap_17299821347425-0a0868f089eae2f95d1e5a4aaa0252c2176f1334.jpg
			// https://media.npr.org/assets/img/2018/04/13/gettyimages-111077711_wide-7cec6f88bb5f86c005767e5866a00404396e869e.jpg?s=400
			//   https://media.npr.org/assets/img/2018/04/13/gettyimages-111077711-7cec6f88bb5f86c005767e5866a00404396e869e.jpg
			// https://media.npr.org/assets/img/2018/01/27/rtx4ixrd_sq-744e57fe23b306ed1ccb050b38967d41b5a9c8bd-s400-c85.jpg
			//   https://media.npr.org/assets/img/2018/01/27/rtx4ixrd-744e57fe23b306ed1ccb050b38967d41b5a9c8bd.jpg
			// thanks to kuchenmitsahne on github: https://github.com/qsniyg/maxurl/issues/96
			// https://media.npr.org/assets/img/2018/09/17/linnaeus_custom-e310e859d180def59eb94bbe2f4e5415271451ab-s600-c85.jpg
			//   https://media.npr.org/assets/img/2018/09/17/linnaeus_custom-e310e859d180def59eb94bbe2f4e5415271451ab.jpg
			//   removing _custom changes the crop
			// thanks to roi:
			// https://media.npr.org/assets/artslife/arts/2010/10/keith-richards/keith-richards-730d749c083f177cc443b4114ee1b19b1e257988-s400-c85.webp
			//   https://media.npr.org/assets/artslife/arts/2010/10/keith-richards/keith-richards-730d749c083f177cc443b4114ee1b19b1e257988.jpg
			return {
				url: src
					.replace(/(\/[^/]*)-[sc][0-9]*(?:-[sc][0-9]*)?(\.[^/.]*)/, "$1$2")
					.replace(/(_custom)?(?:_[a-z]+)?-([a-f0-9]{30,})(\.[^/.]*)$/, "$1-$2$3")
					.replace(/\.webp([?#].*)?$/, ".jpg$1"),
				head_wrong_contentlength: true
			};
		}

		if (domain_nosub === "pbsrc.com" && domain.match(/rs[0-9]*\.pbsrc\.com/)) {
			// http://rs375.pbsrc.com/albums/oo198/ZaraTTucker/Get%20Italian%20Translation%20Services%20to%20Boost_zpsms99llho.jpg~c400
			//   http://i375.photobucket.com/albums/oo198/ZaraTTucker/Get%20Italian%20Translation%20Services%20to%20Boost_zpsms99llho.jpg
			// http://i843.photobucket.com/albums/zz352/loaloauk/dlp%20encounter/New%20Album%2042/4640363830_9e9c2ae51b_z.jpg~original
			//   http://oi843.photobucket.com/albums/zz352/loaloauk/dlp%20encounter/New%20Album%2042/4640363830_9e9c2ae51b_z.jpg
			// http://rs414.pbsrc.com/albums/pp228/sweetblonda/NATURA.jpg?w=280&h=210&fit=crop
			//   http://i414.photobucket.com/albums/pp228/sweetblonda/NATURA.jpg
			return src
				.replace(/rs([0-9]*)\.pbsrc\.com/, "i$1.photobucket.com")
				.replace(/\?.*/, "")
				.replace(/(?:~[^/.]*)?$/, "~original");
		}

		if (domain_nosub === "photobucket.com" && /^i(?:[0-9]+|mg)\./.test(domain)) {
			// https://i785.photobucket.com/albums/yy140/Impzor/points.png?1568174690926&1568174703483 -- watermark
			//   https://oi785.photobucket.com/albums/yy140/Impzor/points.png?1568174690926&1568174703483 -- no watermark
			//   https://oi785.photobucket.com/albums/yy140/Impzor/points.png
			//   http://s785.photobucket.com/user/Impzor/media/points.png.html?o=4
			//   https://photobucket.com/gallery/https://s785.photobucket.com/user/Impzor/media/points.png.html?o=4
			//   https://photobucket.com/gallery/user/Impzor/media/cGF0aDovcG9pbnRzLnBuZw==?ref=
			//   atob: path:/points.png
			// https://i785.photobucket.com/albums/yy140/Impzor/points.png?width=100&height=100&crop=1:1,smart
			//   https://oi785.photobucket.com/albums/yy140/Impzor/points.png
			// http://i843.photobucket.com/albums/zz352/loaloauk/dlp%20encounter/New%20Album%2042/4640363830_9e9c2ae51b_z.jpg~original
			//   http://oi843.photobucket.com/albums/zz352/loaloauk/dlp%20encounter/New%20Album%2042/4640363830_9e9c2ae51b_z.jpg -- ~original works too
			// http://i496.photobucket.com/albums/rr323/878990/555.jpg
			//   http://oi496.photobucket.com/albums/rr323/878990/555.jpg
			//   https://photobucket.com/gallery/user/878990/media/bWVkaWFJZDoyMTgwODM0OA==/?ref=
			newsrc = src.replace(/\?.*/, "");
			if (newsrc !== src)
				return newsrc;

			newsrc = src.replace(/(?:~[^/.]*)?(?:[?#].*)?$/, "~original");
			if (newsrc !== src)
				return newsrc;

			return src.replace(/:\/\/i((?:[0-9]+|mg)\..*?)(?:~original)?(?:[?#].*)?$/, "://oi$1");
		}

		if (domain_nosub === "photobucket.com" && /^o?i(?:[0-9]*|mg)\./.test(domain)) {
			match = src.match(/^[a-z]+:\/\/[a-z]*([0-9]+)?\.[^/]*\/+albums\/+[a-z]{1,2}[0-9]+\/+([^/]+)\/+([^/]+\.[^/.~]*?)(?:~[^/.]*)?(?:[?#].*)?$/);
			if (match) {
				var pbdomain = "www";
				if (match[1])
					pbdomain = "s" + match[1];

				var page = "http://" + pbdomain + ".photobucket.com/user/" + match[2] + "/media/" + match[3] + ".html";
				return {
					url: src,
					headers: {
						Referer: page
					},
					extra: {
						page: page
					}
				};
			}
		}

		if (domain === "www.welt.de" ||
			// https://img.welt.de/img/kultur/pop/mobile132505066/0972501497-ci102l-w1024/Keith-Richards-mit-Enkel-Otto.jpg
			//   https://img.welt.de/img/kultur/pop/mobile132505066/0972501497-coriginal-w0/Keith-Richards-mit-Enkel-Otto.jpg
			// thanks to anonymous for reporting:
			// https://img.welt.de/img/kultur/mobile105837855/3531627187-ci23x11-w1136/Laurel-Hardy-Hinter-Schloss-und-Riegel.jpg
			//   https://img.welt.de/img/kultur/mobile105837855/3531627187-coriginal-w0/Laurel-Hardy-Hinter-Schloss-und-Riegel.jpg
			// doesn't work for all:
			// https://img.welt.de/img/sport/fussball/bundesliga/mobile250019410/8651622817-ci23x11-w1800/Germany-Soccer-Bundesliga.jpg
			//   https://img.welt.de/img/sport/fussball/bundesliga/mobile250019410/8651622817-coriginal-w0/Germany-Soccer-Bundesliga.jpg -- 404
			// https://img.welt.de/img/ausland/crop124685943/0278727095-ci3x2l-w620/DWO-schweiz-abstimmung-aw.jpg
			//   https://img.welt.de/img/ausland/crop124685943/0278727095-coriginal-w0/DWO-schweiz-abstimmung-aw.jpg -- 404
			domain === "img.welt.de") {
			// nowww !== www
			// https://www.welt.de/img/kultur/pop/mobile132505066/0972501497-ci102l-w1024/Keith-Richards-mit-Enkel-Otto.jpg
			//   https://www.welt.de/img/kultur/pop/mobile132505066/0972501497-ci102l-w0/Keith-Richards-mit-Enkel-Otto.jpg
			return src.replace(/-c[^-/]+-w[0-9]*(\/[^/]*)$/, "-coriginal-w0$1");
		}

		if (domain === "cdn.baeblemusic.com" && string_indexof(src, "/images/") >= 0) {
			// https://cdn.baeblemusic.com/images/bblog/5-8-2017/keith-richards-almost-died-580.jpg
			//   https://cdn.baeblemusic.com/images/bblog/5-8-2017/keith-richards-almost-died.jpg
			return src.replace(/-[0-9]*(\.[^/.]*)$/, "$1");
		}

		if (domain_nosub === "deviantart.net" && domain.match(/^t[0-9]*\./)) {
			// https://t00.deviantart.net/7PiX79OLWVS6WAzA0thSVYzWarQ=/300x200/filters:fixed_height(100,100):origin()/pre00/f044/th/pre/i/2004/235/7/b/megaman.jpg
			//   https://pre00.deviantart.net/f044/th/pre/i/2004/235/7/b/megaman.jpg
			// https://t00.deviantart.net/lNDj1np7JyLzN7U1MHhJlzp38Vs=/300x200/filters:fixed_height(100,100):origin()/pre00/4328/th/pre/f/2011/194/b/6/megaman_tribute_by_saiyagina-d3odj4t.jpg
			//   https://pre00.deviantart.net/4328/th/pre/f/2011/194/b/6/megaman_tribute_by_saiyagina-d3odj4t.jpg
			// https://t00.deviantart.net/hbXtsO07Julo2fHWk6VyTkPgU5Y=/fit-in/700x350/filters:fixed_height(100,100):origin()/pre00/034f/th/pre/i/2017/346/6/5/abyss___chibi_by_nightstar234-dbwhn28.png
			//   https://pre00.deviantart.net/034f/th/pre/i/2017/346/6/5/abyss___chibi_by_nightstar234-dbwhn28.png
			return src.replace(/:\/\/.*?\.deviantart\.net\/.*?\/[0-9]*x[0-9]*\/[^/]*\/([^/]*)\/(.*)/, "://$1\.deviantart\.net/$2");
		}

		if (domain_nosub === "grazia.fr" && domain.match(/img[0-9]*\.grazia\.fr/) ||
			// https://www.glamour.de/var/condenast/storage/images/mode/mode-news/galerien/kleider-die-wir-nicht-vergessen/margot-robbie-oscar-2016-gettyimages-512917014/13287889-1-ger-DE/margot-robbie-oscar-2016-gettyimages-512917014_gallery_large_portrait.jpg
			//   https://www.glamour.de/var/condenast/storage/images/mode/mode-news/galerien/kleider-die-wir-nicht-vergessen/margot-robbie-oscar-2016-gettyimages-512917014/13287889-1-ger-DE/margot-robbie-oscar-2016-gettyimages-512917014.jpg
			// https://www.glamour.de/var/condenast/storage/images/media/images/artikelbilder/mode-bilder/margot-robbie-oscar-2016-gettyimages-512917014/13287964-1-ger-DE/margot-robbie-oscar-2016-gettyimages-512917014_g1500xx.jpg
			//   https://www.glamour.de/var/condenast/storage/images/media/images/artikelbilder/mode-bilder/margot-robbie-oscar-2016-gettyimages-512917014/13287964-1-ger-DE/margot-robbie-oscar-2016-gettyimages-512917014.jpg
			domain_nowww === "glamour.de" ||
			// https://asia.nikkei.com/var/site_cache/storage/images/node_43/node_51/2018/201802/20180208t/20180208_malaysia-worker/8879284-1-eng-GB/20180208_Malaysia-worker_article_thumbnail.jpg
			// https://asia.nikkei.com/var/site_cache/storage/images/node_43/node_51/2018/201802/20180208t/20180208_malaysia-worker/8879284-1-eng-GB/20180208_Malaysia-worker_article_main_image.jpg
			// https://asia.nikkei.com/var/site_cache/storage/images/node_43/node_51/2018/201802/0217n/0217n-audi/8939471-1-eng-GB/0217N-Audi_large_image.jpg
			// https://asia.nikkei.com/var/site_cache/storage/images/node_43/node_51/2018/201802/20180213t/20180213_rocket/8908091-1-eng-GB/20180213_rocket_photo_galleries_thumbnail.jpg
			// https://asia.nikkei.com/var/site_cache/storage/images/node_43/node_51/2018/201802/20180213t/20180213_rocket/8908091-1-eng-GB/20180213_rocket_article_main_image.jpg
			// https://asia.nikkei.com/var/site_cache/storage/images/node_43/node_51/2018/201802/20180205t/20180130citiesocial-founder-eric-wang/8846170-2-eng-GB/20180130Citiesocial-Founder-Eric-Wang_more_in_thumbnail.jpg
			//   https://asia.nikkei.com/var/site_cache/storage/images/node_43/node_51/2018/201802/20180205t/20180130citiesocial-founder-eric-wang/8846170-2-eng-GB/20180130Citiesocial-Founder-Eric-Wang.jpg
			// https://asia.nikkei.com/var/site_cache/storage/images/top/viewpoints/humphrey-hawksley/5784021-2-app-WF/Humphrey-Hawksley_square80_thumbnail.png
			// https://asia.nikkei.com/var/site_cache/storage/images/top/magazine/20180215/8920429-1-app-WF/FREEDOM-OF-THE-OPPRESSION_cover_image.jpg
			// https://asia.nikkei.com/var/site_cache/storage/images/node_43/node_51/2018/201802/20180217t/20180217_panda/8940872-1-eng-GB/20180217_Panda_medium_thumbnail.jpg
			domain === "asia.nikkei.com" ||
			// http://www.elle.co.jp/var/ellejp/storage/images/fashion/celeb/selenagomez-bestsnap-2016_17_02/node_1087470/19466418-1-jpn-JP/2017-6-7-NY_image_size_900_x.jpg
			//   http://elle.co.jp/var/ellejp/storage/images/fashion/celeb/selenagomez-bestsnap-2016_17_02/node_1087470/19466418-1-jpn-JP/2017-6-7-NY.jpg
			// http://img.elle.co.jp/var/ellejp/storage/images/fashion/celeb/selenagomez-bestsnap-2016_17_02/node_1087470/19466418-1-jpn-JP/2017-6-7-NY_image_size_192_x.jpg
			//   http://img.elle.co.jp/var/ellejp/storage/images/fashion/celeb/selenagomez-bestsnap-2016_17_02/node_1087470/19466418-1-jpn-JP/2017-6-7-NY.jpg
			domain_nosub === "elle.co.jp" ||
			// http://harpersbazaar.jp/var/hb/storage/images/news/rihanna-30th-birhtday-bad-girl-style-180220-hns/node_54568/658313-1-jpn-JP/2017-9-7_image_size_150_x.jpg
			//   http://harpersbazaar.jp/var/hb/storage/images/news/rihanna-30th-birhtday-bad-girl-style-180220-hns/node_54568/658313-1-jpn-JP/2017-9-7.jpg
			domain_nowww === "harpersbazaar.jp" ||
			// http://www.fotogramas.es/var/ezflow_site/storage/images/media/imagenes/recursos/irnidos/137969938-1-esl-ES/irnidos_reference.jpg
			//   http://www.fotogramas.es/var/ezflow_site/storage/images/media/imagenes/recursos/irnidos/137969938-1-esl-ES/irnidos.jpg
			// http://www.fotogramas.es/var/ezflow_site/storage/images/cinefilia/vicky-luengo-fotomaton/138002962-1-esl-ES/Fotomaton-a-Vicky-Luengo_line.jpg
			//   http://www.fotogramas.es/var/ezflow_site/storage/images/cinefilia/vicky-luengo-fotomaton/138002962-1-esl-ES/Fotomaton-a-Vicky-Luengo.jpg
			// http://www.fotogramas.es/var/ezflow_site/storage/images/noticias-cine/bryan-singer-resuelve-agujero-guion-franquicia-x-men/138127548-1-esl-ES/Bryan-Singer-resuelve-uno-de-los-mayores-agujeros-de-guion-de-la-franquicia-X-Men_columna.jpg
			//   http://www.fotogramas.es/var/ezflow_site/storage/images/noticias-cine/bryan-singer-resuelve-agujero-guion-franquicia-x-men/138127548-1-esl-ES/Bryan-Singer-resuelve-uno-de-los-mayores-agujeros-de-guion-de-la-franquicia-X-Men.jpg
			// http://www.fotogramas.es/var/ezflow_site/storage/images/media/imagenes/recursos/david/138049887-1-esl-ES/david_reference.jpg
			//   http://www.fotogramas.es/var/ezflow_site/storage/images/media/imagenes/recursos/david/138049887-1-esl-ES/david.jpg -- 4283x2855
			// http://www.fotogramas.es/var/ezflow_site/storage/images/cinefilia/fotomaton-a-andrea-duro/77425064-1-esl-ES/Fotomaton-a-Andrea-Duro_dos_elementos.jpg
			//   http://www.fotogramas.es/var/ezflow_site/storage/images/cinefilia/fotomaton-a-andrea-duro/77425064-1-esl-ES/Fotomaton-a-Andrea-Duro.jpg
			// http://www.fotogramas.es/var/ezflow_site/storage/images/cinefilia/documentales-musicales-que-tienes-que-ver/85507133-3-esl-ES/Documentales-musicales-que-tienes-que-ver_inferior-seccion-mos.jpg
			//   http://www.fotogramas.es/var/ezflow_site/storage/images/cinefilia/documentales-musicales-que-tienes-que-ver/85507133-3-esl-ES/Documentales-musicales-que-tienes-que-ver.jpg
			// http://www.fotogramas.es/var/ezflow_site/storage/images/cinefilia/ant-man-avispa-peliculas-personajes-reducidos-diminutos/138126801-1-esl-ES/Ant-Man-y-la-Avispa-y-otras-10-peliculas-con-protagonistas-reducidos_inferior-seccion-mos_portrait.jpg
			//   http://www.fotogramas.es/var/ezflow_site/storage/images/cinefilia/ant-man-avispa-peliculas-personajes-reducidos-diminutos/138126801-1-esl-ES/Ant-Man-y-la-Avispa-y-otras-10-peliculas-con-protagonistas-reducidos.jpg
			// http://www.fotogramas.es/var/ezflow_site/storage/images/noticias-cine/michelle-pfeiffer-entrevista-ant-man-y-la-avispa/138123067-1-esl-ES/El-heroico-retorno-de-Michelle-Pfeiffer-Nunca-pense-a-mi-edad-volver-al-universo-de-los-superheroes_slideshow_principal.jpg
			//   http://www.fotogramas.es/var/ezflow_site/storage/images/noticias-cine/michelle-pfeiffer-entrevista-ant-man-y-la-avispa/138123067-1-esl-ES/El-heroico-retorno-de-Michelle-Pfeiffer-Nunca-pense-a-mi-edad-volver-al-universo-de-los-superheroes.jpg
			domain_nowww === "fotogramas.es" ||
			// http://ellegirl.jp/var/assets/storage/images/article/f_c_daisy_ridley_17_1214/20160410/2386181-1-jpn-JP/MTV-2016_rect600_315.jpg
			//   http://img.ellegirl.jp/var/assets/storage/images/article/f_c_daisy_ridley_17_1214/20160410/2386181-1-jpn-JP/MTV-2016.jpg
			// http://img.ellegirl.jp/var/assets/storage/images/article/f_c_daisy_ridley_17_1214/20160410/2386181-1-jpn-JP/MTV-2016_rect490.jpg
			//   http://img.ellegirl.jp/var/assets/storage/images/article/f_c_daisy_ridley_17_1214/20160410/2386181-1-jpn-JP/MTV-2016.jpg
			// http://img.ellegirl.jp/var/assets/storage/images/article/c_jennifer_aniston_been_treated_worse_by_women_18_0803/2717464-1-jpn-JP/_1_square64.jpg
			//   http://img.ellegirl.jp/var/assets/storage/images/article/c_jennifer_aniston_been_treated_worse_by_women_18_0803/2717464-1-jpn-JP/_1.jpg
			domain_nosub === "ellegirl.jp" ||
			// https://esquire.jp/var/mensclubjp/storage/images/fashion/news/jimmy-choo-dakota-fanning-170313-hns/03/910674-3-jpn-JP/03_rect480.jpg
			//   https://esquire.jp/var/mensclubjp/storage/images/fashion/news/jimmy-choo-dakota-fanning-170313-hns/03/910674-3-jpn-JP/03.jpg
			domain_nosub === "esquire.jp" ||
			// http://img.25ans.jp/var/25ansjp/storage/images/news/fashion/2018-oscar-after-party-by-vanityfair-180306-hns/xcx/1397821-1-jpn-JP/XCX_image_630_x.jpg
			//   http://img.25ans.jp/var/25ansjp/storage/images/news/fashion/2018-oscar-after-party-by-vanityfair-180306-hns/xcx/1397821-1-jpn-JP/XCX.jpg
			domain === "img.25ans.jp" ||
			// https://www.cosmopolitan.com.hk/var/cosmopolitanhk/storage/images/love/1547654e3981d65/154765314ff54c10933edc096fec3b76154765314fff4e8c9f9d0bdc6dc79fd6/1644822-1-chi-HK/154765314ff54c10933edc096fec3b76154765314fff4e8c9f9d0bdc6dc79fd6_img_750_h.png
			//   https://www.cosmopolitan.com.hk/var/cosmopolitanhk/storage/images/love/1547654e3981d65/154765314ff54c10933edc096fec3b76154765314fff4e8c9f9d0bdc6dc79fd6/1644822-1-chi-HK/154765314ff54c10933edc096fec3b76154765314fff4e8c9f9d0bdc6dc79fd6.png
			domain_nowww === "cosmopolitan.com.hk" ||
			// https://www.elle.com.hk/var/ellehk/storage/images/fashion/style_insight/the-most-memorable-oscar-dresses-of-all-time/margot-robbie-2016/22000015-1-chi-HK/MARGOT-ROBBIE-2016_img_885_590.jpg
			//   https://www.elle.com.hk/var/ellehk/storage/images/fashion/style_insight/the-most-memorable-oscar-dresses-of-all-time/margot-robbie-2016/22000015-1-chi-HK/MARGOT-ROBBIE-2016.jpg
			// https://www.elle.com.hk/var/ellehk/storage/images/fashion/celeb_style/billboard-music-awards-red-carpet-dresses-2019/node_1745454/29920879-1-chi-HK/Chantel-jeffries-attends-the-2019-billboard-music-awards-at-news-photo-1140612654-1556748941_img_885_590.jpg
			//   https://www.elle.com.hk/var/ellehk/storage/images/fashion/celeb_style/billboard-music-awards-red-carpet-dresses-2019/node_1745454/29920879-1-chi-HK/Chantel-jeffries-attends-the-2019-billboard-music-awards-at-news-photo-1140612654-1556748941.jpg
			domain_nowww === "elle.com.hk" ||
			// http://m.vogue.de/var/vogue/storage/images/home/vogue/fashion-shows/kollektionen/fruehjahr-2017-hc/paris/alexandre-vauthier/runway/_arc0726/23291608-1-ger-DE/_arc0726_v540x910.jpg
			//   https://m.vogue.de/var/vogue/storage/images/home/vogue/fashion-shows/kollektionen/fruehjahr-2017-hc/paris/alexandre-vauthier/runway/_arc0726/23291608-1-ger-DE/_arc0726.jpg
			domain_nosub === "vogue.de" ||
			// https://img1.telestar.fr/var/telestar/storage/images/2/9/0/290401/1732584-1/Calista-Flockhart-dans-la-serie-Ally-McBeal-en-1997_width1024.jpg
			//   https://img1.telestar.fr/var/telestar/storage/images/2/9/0/290401/1732584-1/Calista-Flockhart-dans-la-serie-Ally-McBeal-en-1997.jpg
			(domain_nosub === "telestar.fr" && domain.match(/img[0-9]*\.telestar\.fr/)) ||
			// http://www.haz.de/var/storage/images/np/nachrichten/medien/uebersicht/lena-meyer-landrut-hat-in-der-schule-keinen-musikunterricht/5676757-1-ger-DE/Lena-Meyer-Landrut-hat-in-der-Schule-keinen-Musikunterricht_big_teaser_article.jpg
			//   http://www.haz.de/var/storage/images/np/nachrichten/medien/uebersicht/lena-meyer-landrut-hat-in-der-schule-keinen-musikunterricht/5676757-1-ger-DE/Lena-Meyer-Landrut-hat-in-der-Schule-keinen-Musikunterricht.jpg
			domain_nowww === "haz.de" ||
			// https://www.connexionfrance.com/var/connexion/storage/images/media/images/notre-dame-light/564377-1-eng-GB/notre-dame-light_articleimage.jpg
			//   https://www.connexionfrance.com/var/connexion/storage/images/media/images/notre-dame-light/564377-1-eng-GB/notre-dame-light.jpg
			domain_nowww === "connexionfrance.com" ||
			// http://www.novilist.hr/var/novilist/storage/images/znanost-i-tehnologija/znanost/znanstvenici-objasnili-enigmu-zelenih-ledenjaka-uskoro-cemo-otkriti-koliko-su-oni-vazni!/15766267-1-cro-HR/Znanstvenici-objasnili-enigmu-zelenih-ledenjaka-Uskoro-cemo-otkriti-koliko-su-oni-vazni!_ca_large.jpg -- upscaled? 518x291
			//   http://www.novilist.hr/var/novilist/storage/images/znanost-i-tehnologija/znanost/znanstvenici-objasnili-enigmu-zelenih-ledenjaka-uskoro-cemo-otkriti-koliko-su-oni-vazni!/15766267-1-cro-HR/Znanstvenici-objasnili-enigmu-zelenih-ledenjaka-Uskoro-cemo-otkriti-koliko-su-oni-vazni!.jpg -- 299x168
			// http://www.novilist.hr/var/novilist/storage/images/_aliases/fb_friendly_img/znanost-i-tehnologija/znanost/znanstvenici-objasnili-enigmu-zelenih-ledenjaka-uskoro-cemo-otkriti-koliko-su-oni-vazni!/15766267-1-cro-HR/Znanstvenici-objasnili-enigmu-zelenih-ledenjaka-Uskoro-cemo-otkriti-koliko-su-oni-vazni!.jpg -- very upscaled
			//   http://www.novilist.hr/var/novilist/storage/images/znanost-i-tehnologija/znanost/znanstvenici-objasnili-enigmu-zelenih-ledenjaka-uskoro-cemo-otkriti-koliko-su-oni-vazni!/15766267-1-cro-HR/Znanstvenici-objasnili-enigmu-zelenih-ledenjaka-Uskoro-cemo-otkriti-koliko-su-oni-vazni!.jpg
			domain_nowww === "novilist.hr" ||
			// http://www.ville-wasquehal.fr/var/ptic/storage/images/services-en-ligne/agenda/ant-man-et-la-guepe/406908-48-fre-FR/Ant-Man-et-la-guepe_zoom_colorbox.jpg
			//   http://www.ville-wasquehal.fr/var/ptic/storage/images/services-en-ligne/agenda/ant-man-et-la-guepe/406908-48-fre-FR/Ant-Man-et-la-guepe.jpg
			domain_nowww === "ville-wasquehal.fr" ||
			// https://www.gq-magazin.de/var/gq/storage/images/media/images/artikelbilder/unterhaltung/aquaman-workout-quer/7121951-1-ger-DE/aquaman-workout-quer_article_landscape.jpg
			//   https://www.gq-magazin.de/var/gq/storage/images/media/images/artikelbilder/unterhaltung/aquaman-workout-quer/7121951-1-ger-DE/aquaman-workout-quer.jpg
			domain_nowww === "gq-magazin.de" ||
			// http://www.esa.int/var/esa/storage/images/esa_multimedia/images/2019/07/edrs-c_being_fuelled/19645582-1-eng-GB/EDRS-C_being_fuelled_latestnews.jpg
			//   http://www.esa.int/var/esa/storage/images/esa_multimedia/images/2019/07/edrs-c_being_fuelled/19645582-1-eng-GB/EDRS-C_being_fuelled.jpg
			domain_nowww === "esa.int" ||
			// http://www.quejadore.com/var/quejadore_fr/storage/images/culture/cine-tv-series-dvd/autour-d-un-verre-avec-solene-rigot-a-l-affiche-de-les-revoltes-cette-semaine-56359-15-07-2015/986942-1-fre-MASTER/Autour-d-un-verre-avec-Solene-Rigot-a-l-affiche-de-Les-revoltes-cette-semaine_carrousel_quejadore.jpg
			//   http://www.quejadore.com/var/quejadore_fr/storage/images/culture/cine-tv-series-dvd/autour-d-un-verre-avec-solene-rigot-a-l-affiche-de-les-revoltes-cette-semaine-56359-15-07-2015/986942-1-fre-MASTER/Autour-d-un-verre-avec-Solene-Rigot-a-l-affiche-de-Les-revoltes-cette-semaine.jpg
			domain_nowww === "quejadore.com" ||
			// https://file1.grazia.fr/var/grazia/storage/images/media/images/galerie/2016-05-18-en-images.-la-folle-soiree-de-grisogno-a-cannes/barbara-palvin/13423851-2-fre-FR/Barbara-Palvin_width1024.jpg
			//   https://file1.grazia.fr/var/grazia/storage/images/media/images/galerie/2016-05-18-en-images.-la-folle-soiree-de-grisogno-a-cannes/barbara-palvin/13423851-2-fre-FR/Barbara-Palvin.jpg
			(domain_nosub === "grazia.fr" && /^file[0-9]*\./.test(domain)) ||
			// https://www.esquirehk.com/var/esquirehk/storage/images/people/women_we_love/2015-girl-group-korea-hong-kong-japn-hottest/girl-s-day-yura/293873-1-chi-HK/Girl-s-Day-Yura_img_1032_688.jpg
			//   https://www.esquirehk.com/var/esquirehk/storage/images/people/women_we_love/2015-girl-group-korea-hong-kong-japn-hottest/girl-s-day-yura/293873-1-chi-HK/Girl-s-Day-Yura.jpg
			domain_nosub === "esquirehk.com" ||
			// http://gfx.elle.ci/var/ezflow_site/storage/images/people-lifestyle/people/les-senegalais-refusent-de-recevoir-rihanna-dans-leur-pays/42914-1-eng-GB/Les-Senegalais-refusent-de-recevoir-Rihanna-dans-leur-Pays_article_north.jpg
			//   http://gfx.elle.ci/var/ezflow_site/storage/images/people-lifestyle/people/les-senegalais-refusent-de-recevoir-rihanna-dans-leur-pays/42914-1-eng-GB/Les-Senegalais-refusent-de-recevoir-Rihanna-dans-leur-Pays.jpg
			domain === "gfx.elle.ci" ||
			// https://img3.closermag.fr/var/closermag/storage/images/bio-people/biographie-jose-garcia-112817/827937-1-fre-FR/Jose-Garcia_square500x500.jpg
			//   https://img3.closermag.fr/var/closermag/storage/images/bio-people/biographie-jose-garcia-112817/827937-1-fre-FR/Jose-Garcia.jpg
			// https://img1.closermag.fr/var/closermag/storage/images/media/images-des-contenus/actu-people/people-anglo-saxons/20151129-selena/selena-gomez-pose-pour-in-style/4987068-1-fre-FR/Selena-Gomez-pose-pour-In-Style.png?v1/focus=0x0/cover=626x768
			//   https://img1.closermag.fr/var/closermag/storage/images/media/images-des-contenus/actu-people/people-anglo-saxons/20151129-selena/selena-gomez-pose-pour-in-style/4987068-1-fre-FR/Selena-Gomez-pose-pour-In-Style.png
			// https://file1.closermag.fr/var/closermag/storage/images/media/images-des-contenus/actu-people/people-anglo-saxons/20151129-selena/selena-gomez-pose-pour-in-style/4987068-1-fre-FR/Selena-Gomez-pose-pour-In-Style_exact1024x768_p.png
			//   https://file1.closermag.fr/var/closermag/storage/images/media/images-des-contenus/actu-people/people-anglo-saxons/20151129-selena/selena-gomez-pose-pour-in-style/4987068-1-fre-FR/Selena-Gomez-pose-pour-In-Style.png
			(domain_nosub === "closermag.fr" && domain.match(/(?:img|file)[0-9]*\.closermag\.fr/))) {
			// https://img3.grazia.fr/var/grazia/storage/images/article/cinema-solene-rigot-grande-petite-849768/13583494-1-fre-FR/Cinema-Solene-Rigot-grande-petite_exact1900x908_l.jpg
			//   https://img3.grazia.fr/var/grazia/storage/images/article/cinema-solene-rigot-grande-petite-849768/13583494-1-fre-FR/Cinema-Solene-Rigot-grande-petite.jpg
			return src
				.replace(/(:\/\/[^/]*\/var\/+(?:[^/]*\/+)?storage\/+images\/+.*\/[^/]+?)(?:_[a-z][^-/._]*(?:_[0-9]+){0,})?(\.[^/.?]*)(?:[?#].*)?$/, "$1$2")
				.replace(/\/storage\/+images\/+_aliases\/+[^/]*\/+/, "/storage/images/");
			//return src.replace(/_(?:article|large|medium|photo_galleries|more_in_thumbnail|square[0-9]*|cover_image)(?:_[a-z_]*)?(\.[^/.]*)$/, "$1");
			//return src.replace(/_image_size_[0-9]+_x(?:_[0-9]+)?(\.[^/.]*)$/, "$1");
			//return src.replace(/_image_[0-9]+_x(\.[^/.]*)$/, "$1");
			//return src.replace(/_(?:columna|line|reference|dos_elementos|inferior-seccion-mos|portrait|slideshow|principal)(\.[^/.]*)$/, "$1");
			//return src.replace(/_(?:rect|square)[0-9]+(?:_[0-9]+)?(\.[^/.]*)$/, "$1");
			//return src.replace(/_img_[0-9]+_[a-z](\.[^/.]*)$/, "$1");
			//return src.replace(/_img_[0-9]+_[0-9]+(\.[^/.]*)$/, "$1");
			//return src.replace(/_v[0-9]*x[0-9]*\.([^/]*)$/, ".$1");
			//return src.replace(/_width[0-9]*(\.[^/.]*)$/, "$1");
		}


		if ((domain_nosub === "purepeople.com" ||
			 // http://static1.purepeople.com.br/articles/2/21/41/22/@/2458737-camila-queiroz-admitiu-que-nunca-consegu-950x0-3.jpg
			 //   http://static1.purepeople.com.br/articles/2/21/41/22/@/2458737-camila-queiroz-admitiu-que-nunca-consegu-999999999x0-3.jpg
			 domain_nosub === "purepeople.com.br" ||
			 // http://static1.purebreak.com/articles/8/59/23/8/@/208690-ciara-800x0-2.jpg
			 //   http://static1.purebreak.com/articles/8/59/23/8/@/208690-ciara-0x0-2.jpg -- white padding?
			 domain_nosub === "purebreak.com" ||
			 // http://static1.purebreak.com.br/articles/5/63/38/5/@/250333-fifth-harmony-releva-desejo-de-fazer-par-696x0-2.jpg
			 //   http://static1.purebreak.com.br/articles/5/63/38/5/@/250333-fifth-harmony-releva-desejo-de-fazer-par-999999999x0-2.jpg
			 domain_nosub === "purebreak.com.br" ||
			 // http://static1.get-the-look.ca/articles/7/11/03/7/@/35882-for-a-perfect-matte-complexion-like-barb-1000x0-2.jpg
			 //   http://static1.get-the-look.ca/articles/7/11/03/7/@/35882-for-a-perfect-matte-complexion-like-barb-999999999x0-2.jpg
			 domain_nosub === "get-the-look.ca" ||
			 // http://static1.hairstyle.com/articles/2/29/32/@/9632-barbara-palvin-s-slicked-back-updo-if-905x0-2.jpg
			 //   http://static1.hairstyle.com/articles/2/29/32/@/9632-barbara-palvin-s-slicked-back-updo-if-999999999x0-2.jpg
			 domain_nosub === "hairstyle.com" ||
			 // http://static1.puretrend.com/articles/5/13/91/15/@/1572135-ciara-joue-un-jeu-dangeureux-en-robe-950x0-2.jpg
			 //   http://static1.puretrend.com/articles/5/13/91/15/@/1572135-ciara-joue-un-jeu-dangeureux-en-robe-999999999x0-2.jpg
			 domain_nosub === "puretrend.com") &&
			domain.match(/^static[0-9]*\./)) {
			// http://static1.purepeople.com/articles/8/21/01/98/@/2822958-l-actrice-solene-rigot-pour-le-film-en-950x0-1.jpg
			//   http://static1.purepeople.com/articles/8/21/01/98/@/2822958-l-actrice-solene-rigot-pour-le-film-en-0x0-1.jpg
			// http://static1.purepeople.com/articles/8/21/01/98/@/2822931-l-acteur-jose-garcia-pour-le-film-a-fon-114x114-1.jpg
			//   http://static1.purepeople.com/articles/8/21/01/98/@/2822931-l-acteur-jose-garcia-pour-le-film-a-fon-0x0-1.jpg
			// http://static1.purepeople.com/articles/4/20/07/24/@/2631120-solene-rigot-photocall-de-la-soiree-de-opengraph_1200-1.jpg
			//   http://static1.purepeople.com/articles/4/20/07/24/@/2631120-solene-rigot-photocall-de-la-soiree-de-opengraph_99999999x0-1.jpg
			// http://static1.purepeople.com/articles/4/20/07/24/@/2631120-solene-rigot-photocall-de-la-soiree-de-950x0-1.jpg
			//   http://static1.purepeople.com/articles/4/20/07/24/@/2631120-solene-rigot-photocall-de-la-soiree-de-999999999x0-1.jpg
			//return src.replace(/-[0-9]+x[0-9]+(-[0-9]*)?(\.[^/.]*)$/, "-0x0$1$2");
			return src.replace(/([-_])[0-9]+(?:x[0-9]+)?(-[0-9]\.[^/.]*)/, "$1999999999x0$2");
		}

		if (domain_nosub === "belezaextraordinaria.com.br" && domain.match(/^static[0-9]*\./)) {
			// http://static1.belezaextraordinaria.com.br/articles/3/52/3/@/3604--article_versus-4.jpg
			//   http://static1.belezaextraordinaria.com.br/articles/3/52/3/@/3604--article_news-4.jpg
			// http://static1.belezaextraordinaria.com.br/articles/2/23/29/2/@/237944-para-comecar-o-penteado-separe-uma-mech-article_thumb_medium-2.jpg
			//   http://static1.belezaextraordinaria.com.br/articles/2/23/29/2/@/237944-para-comecar-o-penteado-separe-uma-mech-article_news-2.jpg
			// http://static1.belezaextraordinaria.com.br/articles/4/13/38/4/@/161764-o-efeito-ondulado-valoriza-o-corte-e-as-opengraph_1200-3.jpg
			//   http://static1.belezaextraordinaria.com.br/articles/4/13/38/4/@/161764-o-efeito-ondulado-valoriza-o-corte-e-as-article_news-3.jpg
			// using 999999999x0 does work, but it adds black borders around the image
			return src.replace(/([-_])(?:[0-9]+(?:x[0-9]+)?|(?:article|opengraph)_[^-/.]+)(-[0-9]\.[^/.]*)/, "$1article_news$2");
		}

		if (domain === "medias.unifrance.org") {
			// https://medias.unifrance.org/medias/143/107/27535/format_web/media.jpg
			//   https://medias.unifrance.org/medias/143/107/27535/format_page/jose-garcia.jpg -- 685x853
			//   https://medias.unifrance.org/medias/143/107/27535/format_hd/media.jpg -- 685x853
			// https://medias.unifrance.org/medias/167/23/202663/format_affiche/portfolio.jpg -- 186x140
			//   https://medias.unifrance.org/medias/167/23/202663/format_hd/portfolio.jpg -- 3814x2873
			return src.replace(/(\/medias\/+.*\/+)format_(?:web|affiche|page)\/+/, "$1format_hd/");
		}

		if (domain === "lthumb.lisimg.com") {
			// https://lthumb.lisimg.com/043/2916043.jpg?width=280&sharpen=true
			//   https://lthumb.lisimg.com/043/2916043.jpg
			newsrc = src.replace(/\?.*/, "");
			if (newsrc !== src) return newsrc;

			// https://lthumb.lisimg.com/043/2916043.jpg -- 500x753
			//   https://ilarge.lisimg.com/image/2916043/99999999999full.jpg -- 1118x1683
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+[0-9]+\/+([0-9]+)\..*/, "https://ilarge.lisimg.com/image/$1/0full.jpg");
			if (newsrc !== src) return newsrc;
		}

		if (domain_nosub === "lisimg.com" ||
			domain_nosub === "listal.com") {
			// http://iv1.lisimg.com/image/10752485/628full-sol%C3%A8ne-rigot.jpg
			//   http://iv1.lisimg.com/image/10752485/0full-sol%C3%A8ne-rigot.jpg
			// http://i5.lisimg.com/10752485/70.jpg
			//   http://i5.lisimg.com/10752485/0full.jpg
			// http://lb1.lisimg.com/10752485/70.jpg
			//   http://lb1.lisimg.com/10752485/0full.jpg
			// http://ilarge.lisimg.com/image/6915143/780full-sol%C3%A8ne-rigot.jpg
			//   http://ilarge.lisimg.com/image/6915143/0full.jpg
			// http://iv1.lisimg.com/image/2916057/516full-rachel-riley.jpg
			//   http://ilarge.lisimg.com/image/2916057/0full.jpg
			obj = {
				url: src
			};

			id = src.match(/^[a-z]+:\/\/[^/]+\/+(?:image\/+)?([0-9]+)\/+[0-9]+/);
			if (id) {
				id = id[1];
				obj.extra = {page: "https://www.listal.com/viewimage/" + id};
			}

			obj.url = src
				.replace(/:\/\/[^\./]*\.lisimg\.com\//, "://ilarge.lisimg.com/")
				.replace(/(:\/\/[^/]+\/+(?:image\/+)?[0-9]+)\/+[0-9]+(?:full)?([^/]*?(?:\/[^/]*)?(?:[?#].*)?)$/, "$1/99999999999full$2");
				//.replace(/\/([^/]*)\.jpg$/, "/0full.jpg");

			return obj;
		}

		if (domain_nosub === "lesinrocks.com") {
			// https://www.lesinrocks.com/content/thumbs/uploads/2017/03/width-1120-height-612-srcset-1/solene-rigot-1.jpg - stretched
			//   https://www.lesinrocks.com/content/thumbs/uploads/2017/03/width-0-height-0-srcset-1/solene-rigot-1.jpg
			// https://statics.lesinrocks.com/content/thumbs/uploads/2017/12/width-100-height-100/nerd-no-one-ever-really-dies-album-cover-release-date-1.jpg
			//   https://www.lesinrocks.com/content/thumbs/uploads/2017/12/width-0-height-0/nerd-no-one-ever-really-dies-album-cover-release-date-1.jpg
			return src.replace(/\/width-[0-9]*-height-[0-9]*/, "/width-0-height-0");
		}

		if (domain === "media.senscritique.com") {
			// https://media.senscritique.com/media/000006647807/150_200/Solene_Rigot.png
			//   https://media.senscritique.com/media/000006647807/0_0/Solene_Rigot.png
			// https://media.senscritique.com/media/000017848056/130/Ant_Man_et_la_Guepe.jpg
			//   https://media.senscritique.com/media/000017848056/0/Ant_Man_et_la_Guepe.jpg
			// https://media.senscritique.com/media/000004655645/150x230/Sanja_Mikitisin.jpg
			//   https://media.senscritique.com/media/000004655645/0/Sanja_Mikitisin.jpg
			// https://media.senscritique.com/media/000017420993/source_big/Ano_hi_mita_hana_no_namae_o_bokutachi_wa_mada_shiranai.jpg -- 666x1000
			//   https://media.senscritique.com/media/000017420993/0/Ano_hi_mita_hana_no_namae_o_bokutachi_wa_mada_shiranai.jpg -- 666x1000
			return src.replace(/(\/media\/+[0-9]{8,}\/+)[0-9]+(?:[_x][0-9]+)?\/+([^/]*\.[^/.]*)(?:[?#].*)?$/, "$10/$2");
			//return src.replace(/\/[0-9]*_[0-9]*\/([^/]*)$/, "/0_0/$1");
		}

		if (domain_nowww === "franceinter.fr" ||
			// https://cdn.radiofrance.fr/s3/cruiser-production/2017/01/10918994-f2f3-453e-952c-37dc27f8db33/maxnewsfrthree604614.jpg
			//   https://cdn.radiofrance.fr/s3/cruiser-production/2017/01/10918994-f2f3-453e-952c-37dc27f8db33/maxnewsfrthree604614.jpg
			domain === "cdn.radiofrance.fr") {
			// https://www.franceinter.fr/s3/cruiser-production/2017/03/e97f73a2-2cba-4d48-bdc4-e50392aad75a/640_orpheline.jpg
			//   https://www.franceinter.fr/s3/cruiser-production/2017/03/e97f73a2-2cba-4d48-bdc4-e50392aad75a/orpheline.jpg
			return src.replace(/\/[0-9]+(?:x[0-9]+)?_([^/]*\.[^/.]+)(?:[?#].*)?$/, "/$1");
		}

		if (domain === "1645110239.rsc.cdn77.org" ||
			// https://cinenews.be/image/s300/q50/mm/befr/movies14119/posters/puppylove.0.jpg
			//   https://cinenews.be/image/mm/befr/movies14119/posters/puppylove.jpg
			domain_nowww === "cinenews.be") {
			// https://1645110239.rsc.cdn77.org/image/s300/q50/mm/befr/movies14119/posters/puppylove.0.jpg
			//   https://1645110239.rsc.cdn77.org/image/mm/befr/movies14119/posters/puppylove.jpg
			// https://1645110239.rsc.cdn77.org/image/x1200x800/q80/mm/been/movies17158/posters/orpheline-1.jpg
			//   https://1645110239.rsc.cdn77.org/image/mm/been/movies17158/posters/orpheline-1.jpg
			newsrc = src
				.replace(/\/image\/[a-z][0-9]+\//, "/image/") // to be repeated
				.replace(/\/image\/x[0-9]+x[0-9]+\//, "/image/")
				.replace(/\/([^/.]*)\.[0-9]+(\.[^/.]*)$/, "/$1$2");

			return {
				url: newsrc,
				head_wrong_contentlength: true
			};
		}

		if (domain_nowww === "diymag.com" && string_indexof(src, "/media/img") >= 0) {
			// http://diymag.com/media/img/Artists/B/Beck/_1500x1000_crop_center-center_75/Beck-UpAllNightVideo.jpg
			//   http://diymag.com/media/img/Artists/B/Beck/Beck-UpAllNightVideo.jpg
			return src.replace(/(\/media\/img\/.*\/)_[^/]*\/([^/]*)$/, "$1$2");
		}

		if (domain_nowww === "kerry-brown.com") {
			// thanks to Harmony on discord for reporting:
			// https://kerry-brown.com/assets/white-wall/_1984x2976_crop_center-center_61_line/White-Wall-1-Resized.jpg
			//   https://kerry-brown.com/assets/white-wall/White-Wall-1-Resized.jpg
			return src.replace(/(\/assets\/+[^/]+\/+)_[^/]+\/+/, "$1");
		}

		if (false && domain === "cdn.nationaltvawards.com") {
			// thanks to anonymous for reporting:
			// https://cdn.nationaltvawards.com/Gallery/2019/_800x800_fit_center-center_none/368/2019-show-29.jpeg
			//   https://cdn.nationaltvawards.com/Gallery/2019/368/2019-show-29.jpeg -- doesn't work
			//   https://cdn.nationaltvawards.com/Gallery/2019/2019-show-29.jpeg -- doesn't work
			return src.replace(/\/_[0-9]+x[0-9]+_(?:fit|crop)_[^/]+\/+([^/]+\/+[^/]+\.[a-z]+)(?:[?#].*)?$/, "/$1");
		}

		if (domain_nowww === "semainedelacritique.com" && string_indexof(src, "/ttimg-rsz") >= 0) {
			// http://www.semainedelacritique.com/ttimg-rsz?src=/uploads/galleriemedia/ed9cf1c0cd7756b1e7e782f8bc2bc3d2.jpg&w=1200&h=800&q=100&zc=2&a=c
			//   http://www.semainedelacritique.com/uploads/galleriemedia/ed9cf1c0cd7756b1e7e782f8bc2bc3d2.jpg
			newsrc = src.replace(/.*\/ttimg-rsz\?(?:.*&)?src=([^&]*).*/, "$1");
			if (newsrc !== src)
				return urljoin(src, newsrc, true);
		}

		if (domain === "photo.gala.fr") {
			// gives content-length of 0
			// https://photo.gala.fr/upload/slideshow/quels-parrains-pour-les-revelations-cesar-les-photos-de-la-soiree-chanel-au-petit-palais-27606/solene-rigot-chien-et-son-parrain-samuel-benchetrit-475504.jpg
			return {
				url: src,
				head_wrong_contentlength: true
			};
		}

		if (domain === "cdn.cnn.com" ||
			(domain_nosub === "turner.com" && domain.match(/^(?:i[0-9]*\.)?cdn\.turner\.com/))) {
			// https://cdn.cnn.com/cnnnext/dam/assets/170301101237-emma-watson-selfies-exlarge-169.jpg
			//   https://cdn.cnn.com/cnnnext/dam/assets/170301101237-emma-watson-selfies.jpg
			// https://cdn.cnn.com/cnnnext/dam/assets/171226214729-carl-bernstein-12-26-super-169.jpg
			//   https://cdn.cnn.com/cnnnext/dam/assets/171226214729-carl-bernstein-12-26.jpg
			// https://cdn.cnn.com/cnnnext/dam/assets/170220104445-mark-turner-volvo-ocean-race-super-169.jpg
			//   https://cdn.cnn.com/cnnnext/dam/assets/170220104445-mark-turner-volvo-ocean-race.jpg
			// https://cdn.cnn.com/cnnnext/dam/assets/170303101934-emma-watson---premiere-full-169.jpg (definitely not full)
			//   https://cdn.cnn.com/cnnnext/dam/assets/170303101934-emma-watson---premiere.jpg
			// https://cdn.cnn.com/cnnnext/dam/assets/170307035422-emma-watson-on-kimmel-02-large-169.jpg
			//   https://cdn.cnn.com/cnnnext/dam/assets/170307035422-emma-watson-on-kimmel-02.jpg
			// https://cdn.cnn.com/cnnnext/dam/assets/180209072938-33-winter-olympics-opening-ceremony-0209-overlay-tease.jpg
			//   https://cdn.cnn.com/cnnnext/dam/assets/180209072938-33-winter-olympics-opening-ceremony-0209.jpg
			// https://cdn.cnn.com/cnnnext/dam/assets/180209112927-10-winter-olympics-opening-ceremony-0209-large-tease.jpg
			//   https://cdn.cnn.com/cnnnext/dam/assets/180209112927-10-winter-olympics-opening-ceremony-0209.jpg
			// https://cdn.cnn.com/cnnnext/dam/assets/180208122950-palestinian-deportee-6-large-alt-11.jpg
			//   https://cdn.cnn.com/cnnnext/dam/assets/180208122950-palestinian-deportee-6.jpg
			// http://i2.cdn.turner.com/cnn/dam/assets/130318122753-emma-watson-january-2013-story-top.jpg
			//   http://i2.cdn.turner.com/cnn/dam/assets/130318122753-emma-watson-january-2013.jpg
			// http://cdn.cnn.com/cnnnext/dam/assets/170428012205-28-met-gala-kurkova.jpg
			// https://cdn.cnn.com/cnnnext/dam/assets/180405060923-plastic-bags-edinburgh-beach-file-restricted-exlarge-169.jpg
			//   https://cdn.cnn.com/cnnnext/dam/assets/180405060923-plastic-bags-edinburgh-beach-file-restricted.jpg
			// https://cdn.cnn.com/cnnnext/dam/assets/141027170602-victoria-beckham-fashion-horizontal-large-gallery.jpg
			//   https://cdn.cnn.com/cnnnext/dam/assets/141027170602-victoria-beckham-fashion.jpg
			// https://cdn.cnn.com/cnnnext/dam/assets/210430154633-screengrab-erlend-ness-medium-plus-169.jpg
			//   https://cdn.cnn.com/cnnnext/dam/assets/210430154633-screengrab-erlend-ness.jpg
			// doesn't work:
			// http://cdn.cnn.com/cnnnext/dam/assets/140630134917-12-canada-most-beautiful-places-super-169.jpg
			// http://cdn.cnn.com/cnnnext/dam/assets/140630134917-12-canada-most-beautiful-places-large-169.jpg
			// http://cdn.cnn.com/cnnnext/dam/assets/140630134917-12-canada-most-beautiful-places-exlarge-169.jpg
			// http://cdn.cnn.com/cnnnext/dam/assets/140630134917-12-canada-most-beautiful-places-full-169.jpg
			//return src.replace(/-(?:small|medium|large|exlarge|super|full|overlay)-[0-9]*(\.[^/.]*)$/, "$1");
			return {
				url: src.replace(/-(?:small|medium|large|exlarge|super|full|overlay|alt|tease|story-top|horizontal)(?:-(?:small|medium|large|exlarge|super|full|overlay|alt|tease|plus))?(?:-(?:[0-9]+|gallery))?(\.[^/.]*)$/, "$1"),
				can_head: false
			};
			//return src.replace(/-[a-z]*-(?:169|tease)(\.[^/.]*)$/, "$1");
		}

		if (domain === "media.cnn.com") {
			// https://media.cnn.com/api/v1/images/stellar/prod/230111163015-01-cnn-atlanta-headquarters-1117.jpg -- 800x533
			//   https://media.cnn.com/api/v1/images/stellar/prod/230111163015-01-cnn-atlanta-headquarters-1117.jpg?c=original -- 2000x1333
			return src.replace(/(\/api\/+v1\/+images\/[^?#]+)(?:[?#].*)?$/, "$1?c=original");
		}

		if (domain === "ugc.kn3.net"/* &&
			string_indexof(src, "/i/origin/") >= 0*/) {
			// https://ugc.kn3.net/i/origin/http://media3.popsugar-assets.com/files/2013/09/16/795/n/1922564/b962955383f6b80f_1592163256t6a65.xxxlarge_2x/i/Emma-Watson-all-legs-sexy-Peter-Pilotto-cutout-minidress.jpg
			// https://ugc.kn3.net/i/760x/https://butacadavidciana.files.wordpress.com/2015/01/hatefuleightposter.jpg
			// https://ugc.kn3.net/i/c_960x720/http://damimage.com/upload/big/2017/04/13/58eee7857d1f5.png
			//   http://damimage.com/upload/big/2017/04/13/58eee7857d1f5.png
			//return src.replace(/.*?\/i\/origin\//, "");
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/i\/(?:c_)?[0-9a-z]+\//, "");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "media.shoko.fr" ||
			// https://media.fan2.fr/article-2548712-ajust_1020-f205148/dove-cameron-devoile-un-trailer-du-nouveau.jpg
			//   https://media.fan2.fr/article-2548712-redim-f205148/dove-cameron-devoile-un-trailer-du-nouveau.jpg
			domain === "media.fan2.fr" ||
			// https://media.melty.it/article-2883254-so-f1/media.jpg
			//   https://media.melty.it/article-2883254-redim-f1/media.jpg
			domain === "media.melty.it" ||
			// https://media.virginradio.fr/article-3917679-ratio265_400-f5/media.jpg
			//   https://media.virginradio.fr/article-3917679-redim-f5/media.jpg
			// different image:
			// https://www.virginradio.fr/selena-gomez-et-demi-lovato-s-eclatent-avec-les-muppets-dans-un-teaser-a615462.html -- header is nonexistent
			//   https://media.virginradio.fr/article-3545974-thumb-f8/selena-gomez-et-demi-lovato-s-apos-eclatent.jpg
			//   https://media.virginradio.fr/article-3545974-redim-f8/selena-gomez-et-demi-lovato-s-apos-eclatent.jpg -- different image!
			domain === "media.virginradio.fr" ||
			// https://media.melty.mx/article-2260674-ajust_930-f1424195409/selena-gomez-en-v-magazine-marzo-2015.jpg -- upscaled
			//   https://media.melty.mx/article-2260674-redim-f1424195409/selena-gomez-en-v-magazine-marzo-2015.jpg
			domain === "media.melty.mx" ||
			// https://media.melty.fr/article-3657708-thumb-f8/quantico-saison-3-priyanka-chopra-alex-tease.jpg
			// https://media.melty.fr/article-3658090-head-f4/rihanna-anniversaire-pornhub-film-porno-pornographie.jpg
			// https://media.melty.fr/article-3658090-full/booba-veut-arreter-sa-carriere-fergie-en.jpg
			// https://media.melty.fr/article-923024-head/meltylife-meryl-melty-fr-redactrice-travaille.jpg
			domain === "media.melty.fr") {
			// https://media.shoko.fr/article-3410081-ajust_1000-f1483450645/emma-watson-en-2013-a-l-avant-premiere-de.jpg
			// https://media.shoko.fr/article-3410093-ratio_100-f1483451011/emma-watson-en-1998-une-star-est-nee.jpg
			// https://media.shoko.fr/media_aggregate-3410071-ajust_700-f1483450315/emma-watson-2014-look-red-carpet-harry-potter.jpg
			// https://media.shoko.fr/article-3410071-redim-f1483450315/emma-watson-en-2014-aux-brit-fashion-awards.jpg
			// https://media.shoko.fr/article-1234470-head/emma-watson-peoples-choice-awards-2013.jpg
			// https://media.shoko.fr/emma-watson-harry-potter-et-les-reliques-image-393422-article-head.jpg
			// different:
			// https://media.melty.fr/article-3657733-thumb-f8/julia-les-marseillais-australia-celibataire.jpg
			//   https://media.melty.fr/article-3657733-redim-f8/julia-les-marseillais-australia-celibataire.jpg
			// others:
			// https://media.melty.fr/article-3835215-so/media.jpg -- 2283x3110
			//   https://media.melty.fr/article-3835215-redim/media.jpg -- 2283x3110
			return src
				.replace(/(:\/\/[^/]*)\/([^/]*?)-[^-/]*((?:-f[^/]*)?\.[^/.]*)$/, "$1/$2-redim$3")
				.replace(/(:\/\/[^/]*)\/([^/-]*?-[0-9]*-)[^/-]*(-f[^/]*)?\//, "$1/$2redim$3/");
		}

		if (domain_nosub === "vogue.fr" ||
			// http://www.glamourparis.com/uploads/images/thumbs/201637/48/rodarte_jpg_8718_north_458x687_white.jpg
			domain_nowww === "glamourparis.com" ||
			// http://www.gqmagazine.fr/uploads/images/thumbs/201803/b7/_vui0653_jpg_9983_north_640x960_transparent.jpg
			//   http://www.gqmagazine.fr/uploads/images/201803/b7/_vui0653_jpg_9983.jpg
			domain_nowww === "gqmagazine.fr") {
			// https://en.vogue.fr/uploads/images/thumbs/201804/a0/tee_1841.jpeg_north_499x_white.jpg
			//   https://en.vogue.fr/uploads/images/201804/a0/tee_1841.jpeg
			// https://en.vogue.fr/uploads/images/thumbs/201725/26/emma_watson__jpg_3972_jpeg_2620.jpeg_north_499x_white.jpg
			//   https://en.vogue.fr/uploads/images/201725/26/emma_watson__jpg_3972_jpeg_2620.jpeg
			// https://en.vogue.fr/uploads/images/thumbs/201725/55/emma_watson_miu_miu_the_circle_premiere_21_06_2017_paris_jpg_8082_jpeg_7667.jpeg_north_499x_white.jpg
			//   https://en.vogue.fr/uploads/images/201725/55/emma_watson_miu_miu_the_circle_premiere_21_06_2017_paris_jpg_8082_jpeg_7667.jpeg
			//
			// https://en.vogue.fr/uploads/images/thumbs/201712/d2/gettyimages_647393804_jpg_9242_north_499x_white.jpg
			//   https://en.vogue.fr/uploads/images/201712/d2/gettyimages_647393804_jpg_9242.jpg
			// https://en.vogue.fr/uploads/images/thumbs/201712/a4/emma_watson_in_givenchy_hc_par_rt_jpg_340_north_499x_white.jpg
			//   https://en.vogue.fr/uploads/images/201712/a4/emma_watson_in_givenchy_hc_par_rt_jpg_340.jpg
			src = src.replace(/\/images\/+thumbs\//, "/images/");
			newsrc = src.replace(/(\.[^/._]*)_[^/]*$/, "$1");
			if (newsrc !== src)
				return newsrc;
			return src.replace(/_north_[0-9]*x(?:[0-9]+)?_(?:white|transparent)(\.[^/.]*)$/, "$1");
		}

		if (domain === "img.culturacolectiva.com") {
			// https://img.culturacolectiva.com/featured/2017/10/bdfd42e4-138b-4037-8b56-8c309a3dc385-high.jpg
			// https://img.culturacolectiva.com/featured/2018/01/24/1516840709928/le-moine-le-moine-the-monk-13-07-2011-1-g_a_l-medium.jpg
			newsrc = src.replace(/-(?:high|medium|low)(\.[^/.]*)$/, "$1");
			if (newsrc !== src)
				return newsrc;
		}

		if ((domain_nosub === "reveliststatic.com" ||
			 // http://cdn-ugc.cafemom.com/gen/min/200/200/85/2010/10/06/01/9n/1n/pobz17xl441b0sg.jpg?imageId=19848772
			 //   http://cdn-ugc.cafemom.com/gen/full/2010/10/06/01/9n/1n/pobz17xl441b0sg.jpg?imageId=19848772
			 domain_nosub === "cafemom.com" ||
			 // https://ugc-01.cafemomstatic.com/gen/resize/256/386/80/2012/02/16/10/ci/6g/pofsu3tdkw.jpg
			 //   https://ugc-01.cafemomstatic.com/gen/full/2012/02/16/10/ci/6g/pofsu3tdkw.jpg
			 // https://ugc-01.cafemomstatic.com/gen/crop/9999/9999/0/2018/02/01/11/4g/tr/po8puaj0cg72.png
			 //   https://ugc-01.cafemomstatic.com/gen/full/2018/02/01/11/4g/tr/po8puaj0cg72.png
			 // http://ugc-01.cafemomstatic.com/gen/crop/9999/9999/0/2018/01/25/11/44/8r/ph1gxpvbeo2qbwe.jpg -- stretched
			 //   http://ugc-01.cafemomstatic.com/gen/full/2018/01/25/11/44/8r/ph1gxpvbeo2qbwe.jpg
			 // https://static-01.cafemomstatic.com/images/stir_2014/special/celebrate-dad/celebrate_dad_activities_header.jpg
			 domain_nosub === "cafemomstatic.com") &&
			domain.match(/^(?:cdn-)?ugc(?:-[0-9]*)?\./)) {
			// http://ugc.reveliststatic.com/gen/constrain/800/800/80/2017/05/09/10/6x/ix/phdkya0kkk2qbwe.jpg
			//   http://ugc.reveliststatic.com/gen/full/2017/05/09/10/6x/ix/phdkya0kkk2qbwe.jpg

			//return src.replace(/\/gen\/crop\/[0-9]*\/[0-9]*\/[0-9]*\//, "/gen/crop/9999/9999/0/");
			//return src.replace(/\/gen\/crop\/[0-9]+\/[0-9]+\/[0-9]+\//, "/gen/full/");
			return src.replace(/\/gen\/(?:constrain|crop|resize|min)\/[0-9]*\/[0-9]*\/[0-9]*\//, "/gen/full/");
		}

		if (domain === "images.shazam.com") {
			// https://images.shazam.com/coverart/t113448093-b320004845_s400.jpg
			//   https://images.shazam.com/coverart/t113448093-b320004845_s0.jpg
			return src.replace(/_s[0-9]+(\.[^/.]*)$/, "_s0$1");
		}

		if (domain_nosub === "ebayimg.com") {
			// https://i.ebayimg.com/images/g/2lIAAOSwsS1Zkh1k/s-l300.jpg
			//   https://i.ebayimg.com/images/g/2lIAAOSwsS1Zkh1k/s-l9999.jpg
			// https://ssli.ebayimg.com/images/g/nqQAAOSwh2RZ6b1q/s-l500.jpg
			//   https://ssli.ebayimg.com/images/g/nqQAAOSwh2RZ6b1q/s-l9999.jpg
			// http://i.ebayimg.com/images/i/121630247122-0-1/s-l1000.jpg -- 9999 doesn't work
			// http://i.ebayimg.com/images/i/262923537353-0-1/s-l1000.jpg -- 9999
			//   https://i.ebayimg.com/images/g/6OoAAOSw3gJZHI1d/s-l1000.jpg
			// https://i.ebayimg.com/thumbs/images/g/2FMAAOSw4A5Y0l-Z/s-l200.jpg
			//   https://i.ebayimg.com/images/g/2FMAAOSw4A5Y0l-Z/s-l9999.jpg

			// http://i.ebayimg.com/t/Trashy-Red-Riding-Hood-Gingham-Cute-Dress-Up-Halloween-Sexy-Teen-Adult-Costume-/00/s/MzUwWDM1MA==/z/be8AAMXQxVZRCdlO/$T2eC16VHJHgE9n0yFji(BRCdlO!Zpg~~60_35.JPG
			//   http://i.ebayimg.com/00/s/MzUwWDM1MA==/z/be8AAMXQxVZRCdlO/$T2eC16VHJHgE9n0yFji(BRCdlO!Zpg~~60_35.JPG
			//   http://i.ebayimg.com/images/g/be8AAMXQxVZRCdlO/s-l9999.jpg
			obj = {
				url: src,
				can_head: false, // fixme: does it hang here too?
				bad_if: [{
					headers: {
						"x-ebay-c-extension": "responsecode=404,responsemessage=Not Found"
					}
				}]
			};

			newsrc = src.replace(/\/t\/.*?(\/[0-9]+\/s\/)/, "$1");
			if (newsrc !== src) {
				return fillobj_urls([newsrc, src], obj);
			}

			// http://i.ebayimg.com/00/s/NjAwWDQ1MA==/z/mEAAAOSwKIpWBa25/$_23.JPG
			//   http://i.ebayimg.com/images/g/mEAAAOSwKIpWBa25/s-l9999.jpg
			// doesn't work for all:
			// https://i.ebayimg.com/00/s/MTAyNVg4Mjc=/$(KGrHqR,!rYE-VkK4Bl!BQHN8IC(F!~~60_35.JPG?set_id=880000500F
			newsrc = src.replace(/\/[0-9]+\/[a-z]+\/[^/]*\/[a-z]+\/([^/]+)\/[^/.]*(\.[^/.]*)$/, "/images/g/$1/s-l9999$2");
			if (newsrc !== src) {
				newsrc = newsrc.replace(/(.*\.)[^/.]*$/, "$1") + newsrc.replace(/.*\.([^/.]*)$/, "$1").toLowerCase();
				return fillobj_urls([newsrc, src], obj);
			}

			newsrc = src
				.replace(/\/thumbs\/images\//, "/images/")
				.replace(/-l[0-9]+(\.[^/.]*)$/, "-l9999$1");
			if (newsrc !== src) {
				return fillobj_urls([newsrc, src], obj);
			}

			return obj;
		}

		if ((domain_nosub === "ebaystatic.com" && domain.match(/thumbs[0-9]*\.ebaystatic\.com/)) ||
			// https://securethumbs.ebay.com/d/l140/m/mk1ADy4oa1rnraV-rOti0YQ.jpg
			//   https://ssli.ebayimg.com/images/m/mk1ADy4oa1rnraV-rOti0YQ/s-l9999.jpg
			domain === "securethumbs.ebay.com") {
			// https://thumbs2.ebaystatic.com/m/mKuDpR7Z1yrk82zzlihfOCw/140.jpg
			//   https://ssli.ebayimg.com/images/m/mKuDpR7Z1yrk82zzlihfOCw/s-l9999.jpg
			// https://thumbs2.ebaystatic.com/d/l225/m/mjVOwmkHHi8X0sPdlQhUV7Q.jpg
			//   https://ssli.ebayimg.com/images/m/mjVOwmkHHi8X0sPdlQhUV7Q/s-l9999.jpg
			// https://thumbs.ebaystatic.com/d/l225/pict/400793189705_4.jpg
			//   https://i.ebayimg.com/images/g/X20AAOSwgN9bTFxs/s-l9999.jpg
			//   https://thumbs.ebaystatic.com/d/l9999/pict/400793189705_4.jpg
			// http://thumbs4.ebaystatic.com/pict/1723764064234040_2.jpg
			// other:
			// thanks to MinuteAd8502 on github: https://github.com/qsniyg/maxurl/issues/819
			// https://thumbs.ebaystatic.com/d/l400/pict/302332922620_/Womens-Nike-Dri-FIT-Sprint-Running-Crew-Long-Sleeve.jpg
			// for 404: x-ebay-c-extension: responsecode=404,responsemessage=Not Found
			newsrc = src
				.replace(/^[a-z]*:\/\/[^/]*\/(.*?)\/[0-9]+(\.[^/.]*)$/, "https://ssli.ebayimg.com/images/$1/s-l9999$2")
				.replace(/^[a-z]*:\/\/[^/]*\/d\/l[0-9]+\/([a-z]\/[^/]*)(\.[^/.]*)$/, "https://ssli.ebayimg.com/images/$1/s-l9999$2");
			if (newsrc !== src) {
				return newsrc;
			}

			newsrc = src.replace(/\/d\/[a-z][0-9]+\/pict\//, "/d/l9999/pict/");
			if (newsrc !== src) {
				return newsrc;
			}

			return {
				url: src,
				can_head: false, // it just hangs
				bad_if: [{
					headers: {
						"x-ebay-c-extension": "responsecode=404,responsemessage=Not Found"
					}
				}]
			};
		}

		if (domain === "q.ebaystatic.com") {
			// https://q.ebaystatic.com/aw/pics/cmp/ui/imgzoomregionmask_50x50.png
			if (/\/pics\/+cmp\/+ui\/+imgzoomregionmask/.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}
		}

		if (domain_nowww === "picclickimg.com") {
			// https://www.picclickimg.com/d/l400/pict/232427221641_/Dove-Cameron-Delicate-8x10-Photo-Picture-Celebrity-Print.jpg
			//   https://thumbs.ebaystatic.com/d/l400/pict/232427221641_/Dove-Cameron-Delicate-8x10-Photo-Picture-Celebrity-Print.jpg
			//   https://www.picclickimg.com/d/l9999/pict/232427221641_/Dove-Cameron-Delicate-8x10-Photo-Picture-Celebrity-Print.jpg
			//   https://thumbs.ebaystatic.com/d/l9999/pict/232427221641_/Dove-Cameron-Delicate-8x10-Photo-Picture-Celebrity-Print.jpg
			// https://www.picclickimg.com/00/s/ODAwWDgwMA==/z/qYUAAOSwzqFY-smJ/$/Overwatch-Swimsuit-OW-Game-D-Va-Swimwear-Cosplay-_1.jpg
			//   https://i.ebayimg.com/00/s/ODAwWDgwMA==/z/qYUAAOSwzqFY-smJ/$/Overwatch-Swimsuit-OW-Game-D-Va-Swimwear-Cosplay-_1.jpg
			return src
				.replace(/:\/\/www.picclickimg.com\/d\//, "://thumbs.ebaystatic.com/d/")
				.replace(/:\/\/www.picclickimg.com(\/[0-9]+\/s\/)/, "://i.ebayimg.com$1");
		}

		if (domain_nowww === "ezcorporateembroidery.com") {
			// http://www.ezcorporateembroidery.com/images/scale/l200/pict/323407082997_1.jpg
			//   http://thumbs4.ebaystatic.com/d/l200/pict/323407082997_1.jpg
			//   https://securethumbs.ebay.com/d/l200/pict/323407082997_1.jpg
			//   https://securethumbs.ebay.com/d/l9999/pict/323407082997_1.jpg
			// http://www.ezcorporateembroidery.com/packs/imageslarge/http://www.ezcorporateembroidery.com/images/scale/l400/pict/323407082997_1.jpg
			//   http://www.ezcorporateembroidery.com/images/scale/l400/pict/323407082997_1.jpg
			//   https://securethumbs.ebay.com/d/l9999/pict/323407082997_1.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/packs\/images[a-z]+\/(https?:\/\/)/, "$1");
			if (newsrc !== src)
				return newsrc;
			return src.replace(/^[a-z]+:\/\/[^/]*\/images\/scale\/([a-z][0-9]+\/)/, "https://securethumbs.ebay.com/d/$1");
		}

		if (domain_nowww === "dealsanimg.com") {
			// https://www.dealsanimg.com/d/l400/pict/302538448607_/selena-gomez-poster-6-4-sizes-you-choose-uk-seller-uk.jpg
			//   https://securethumbs.ebay.com/d/l9999/pict/302538448607_/selena-gomez-poster-6-4-sizes-you-choose-uk-seller-uk.jpg
			return src.replace(/^[a-z]+:\/\/[^/]*\/+d\//, "https://securethumbs.ebay.com/d/");
		}

		if (domain === "i.slkimg.com") {
			// https://i.slkimg.com/isv1/album/v5d0aa81654166d6a/3248641/web/3/fill/5,0/600.jpg
			//    https://i.slkimg.com/isv1/album/v5d0aa81654166d6a/3248641/web/3/999999999.jpg
			return src
				.replace(/\/fill\/[0-9]+,[0-9]+\//, "/")
				.replace(/[0-9]+(\.[^/.]*)$/, "999999999$1");
		}

		if (domain === "i.vimeocdn.com" && string_indexof(src, "/filter/overlay") >= 0) {
			// https://i.vimeocdn.com/filter/overlay?src0=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F504371620_1280x720.jpg&src1=https%3A%2F%2Ff.vimeocdn.com%2Fimages_v6%2Fshare%2Fplay_icon_overlay.png
			//   https://i.vimeocdn.com/video/504371620_1280x720.jpg
			return decodeURIComponent(src.replace(/.*\/overlay\?.*?src0=([^&]*).*/, "$1"));
		}

		if (domain === "i.vimeocdn.com") {
			// https://i.vimeocdn.com/video/530332183_780x439.jpg
			//   https://i.vimeocdn.com/video/530332183.jpg
			// https://i.vimeocdn.com/portrait/7230697_640x640 -- upscaled
			//   https://i.vimeocdn.com/portrait/7230697
			// https://i.vimeocdn.com/video/1660497239-552be1365a2eb6c0d8f35fdfeff60b1f1f8779689fb1d9f193b6a7e8426e4f23-d_780x439
			//   https://i.vimeocdn.com/video/1660497239-552be1365a2eb6c0d8f35fdfeff60b1f1f8779689fb1d9f193b6a7e8426e4f23-d
			newsrc = src.replace(/(:\/\/[^/]+\/+(?:video|portrait|vod_poster)\/+[0-9]+(?:-[0-9a-f]{20,}-d)?)_[0-9]+x[0-9]+(\.[^/.?#]+)?(?:[?#].*)?$/, "$1$2");
			if (newsrc !== src) {
				return newsrc;
			}
		}

		if (host_domain_nowww === "vimeo.com" && options.element) {
			newsrc = common_functions["get_pagelink_el_matching"](options.element, /^[a-z]+:\/\/(?:www\.)?vimeo\.com\/+([0-9]+)(?:[?#].*)?$/);
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "vimeo.com") {
			// TODO: support player.vimeo.com, and set the correct referer header
			match = src.match(/^[a-z]+:\/\/[^/]+\/+([0-9]+)(?:[?#].*)?$/);
			if (match) {
				id = match[1];

				var query_vimeo_clippageconfig = function(id, cb) {
					api_query("vimeo:" + id, {
						url: "https://vimeo.com/" + id,
						headers: {
							Referer: ""
						}
					}, cb, function(done, resp, cache_key) {
						var match = resp.responseText.match(/window\.vimeo\.clip_page_config\s*=\s*({.*?});\s*\n/);
						if (!match) {
							console_warn(cache_key, "Unable to find match for", resp);
							return done(null, false);
						}

						try {
							var json = JSON_parse(match[1]);
							return done(json, 60*60);
						} catch (e) {
							console_error(cache_key, e);
							return done(null, false);
						}
					});
				};

				var get_id_from_vimeo_playerconfig_url = function(url) {
					var match = url.match(/^[a-z]+:\/\/player\.vimeo\.com\/+video\/+([0-9]+)\/+config/);
					if (match)
						return match[1];
					return null;
				};

				var query_vimeo_playerconfig = function(url, cb) {
					var id = get_id_from_vimeo_playerconfig_url(url);
					if (!id)
						return cb(null);

					api_query("vimeo_playerconfig:" + id, {
						url: url,
						headers: {
							Origin: "https://vimeo.com",
							Referer: "https://vimeo.com/" + id
						}
					}, cb, function(done, resp, cache_key) {
						try {
							var json = JSON_parse(resp.responseText);
							return done(json, json.request.expires || 60*60);
						} catch (e) {
							console_error(cache_key, e);
							return done(null, false);
						}
					});
				};

				var page_nullobj = {
					url: src,
					is_pagelink: true
				};

				var get_obj_from_vimeo_playerconfig = function(data) {
					if (!data || !data.request || !data.video)
						return page_nullobj;

					var obj:BigImageInfoSObject = {extra: {}};
					var urls = [];

					if (data.video.title) {
						obj.extra.caption = data.video.title;
					}

					if (data.video.share_url) {
						obj.extra.page = data.video.share_url;
					}

					try {
						var files = data.request.files;
						var progressive = files.progressive;

						var max = 0;
						var maxobj = null;

						for (var i = 0; i < progressive.length; i++) {
							var ourobj = progressive[i];
							if (!ourobj.url)
								continue;

							var oursize = ourobj.width * ourobj.height;
							if (oursize > max) {
								max = oursize;
								maxobj = ourobj;
							}
						}

						if (maxobj) {
							urls.push({
								url: maxobj.url,
								video: true
							});
						}

						urls.push(data.video.thumbs.base);
					} catch (e) {
						console_error(e);
					}

					urls.push(page_nullobj);

					return fillobj_urls(urls, obj);
				};

				var query_vimeo_for_obj = function(id, cb) {
					query_vimeo_clippageconfig(id, function(data) {
						if (!data || !data.player || !data.player.config_url)
							return cb(page_nullobj);

						query_vimeo_playerconfig(data.player.config_url, function(data) {
							cb(get_obj_from_vimeo_playerconfig(data));
						});
					});
				};

				if (options.do_request && options.cb) {
					query_vimeo_for_obj(id, options.cb);
					return {
						waiting: true
					};
				} else {
					return page_nullobj;
				}
			}
		}

		if (domain === "imagelab.nownews.com") {
			// https://imagelab.nownews.com/?w=300&q=70&src=https://rssimg.nownews.com/images/5a6f132bda68fc5330825347_201801292027.jpg
			//   https://rssimg.nownews.com/images/5a6f132bda68fc5330825347_201801292027.jpg
			// https://imagelab.nownews.com/?w=300&q=70&src=https%3A%2F%2Fimg.nownews.com%2Fnownews_production%2Fimages%2F5a6f3bb53d666a52fa4894d8_201801292320.png
			//   https://img.nownews.com/nownews_production/images/5a6f3bb53d666a52fa4894d8_201801292320.png
			return decodeURIComponent(src.replace(/.*[/?&]src=(.*)$/, "$1"));
		}

		if (host_domain_nowww === "discord.com" && options.element) {
			let has_discord_class = function(el, cl) {
				let regex = new RegExp("^" + cl + "_+[0-9a-f]+$");
				for (let c of el.classList) {
					if (regex.test(c))
						return true;
				}

				return false;
			};

			if (options.element.tagName === "IMG" && has_discord_class(options.element, "lazyImg")) {
				let el = common_functions["get_parent_el_matching"](options.element, function(x) {
					return has_discord_class(x, "imageWrapper");
				});

				if (el) {
					let ael = el.querySelector('a[data-role="img"]');
					return ael.href;
				}
			}
		}

		if (domain === "cdn.discordapp.com") {
			// https://cdn.discordapp.com/avatars/191394916771823617/a_0cc6551148c73504703e5c4dba44bc0a.png?size=128
			//   https://cdn.discordapp.com/avatars/191394916771823617/a_0cc6551148c73504703e5c4dba44bc0a.png?size=2048
			//   https://cdn.discordapp.com/avatars/191394916771823617/a_0cc6551148c73504703e5c4dba44bc0a.png?size=4096
			// thanks to Noodlers on discord:
			// https://cdn.discordapp.com/app-assets/450485984333660181/450706425182683166.png
			//   https://cdn.discordapp.com/app-assets/450485984333660181/450706425182683166.png?size=4096
			// https://cdn.discordapp.com/app-icons/450485984333660181/e2e0267807d0ef20a0b93c1b559e2ad1.png?size=64&keep_aspect_ratio=false
			//   https://cdn.discordapp.com/app-icons/450485984333660181/e2e0267807d0ef20a0b93c1b559e2ad1.png?size=4096
			// thanks to Noodlers on discord:
			// https://cdn.discordapp.com/guilds/197038439483310086/users/182253824491126784/avatars/f39e8ec3a86be8b7521f7e2d12ccd7e4.png?size=128
			//   https://cdn.discordapp.com/guilds/197038439483310086/users/182253824491126784/avatars/f39e8ec3a86be8b7521f7e2d12ccd7e4.png?size=4096 -- 120x120
			// https://cdn.discordapp.com/icons/615166304227295233/ff643cad9c5224d79f92e4503d9d6161.png?size=128
			//   https://cdn.discordapp.com/icons/615166304227295233/ff643cad9c5224d79f92e4503d9d6161.png?size=4096
			// https://cdn.discordapp.com/channel-icons/689198957133693048/2a0fb16d6c233b4426bce3a76599aa96.png?
			//   https://cdn.discordapp.com/channel-icons/689198957133693048/2a0fb16d6c233b4426bce3a76599aa96.png?size=4096
			// thanks to Noodlers and nimbuz on discord: https://github.com/qsniyg/maxurl/issues/952
			// https://cdn.discordapp.com/emojis/615195900155002901.png?size=22
			//   https://cdn.discordapp.com/emojis/615195900155002901.png
			//   https://cdn.discordapp.com/emojis/615195900155002901.png?size=4096
			return src
				.replace(/(\/emojis\/+[0-9]+\.[^/.?#]+)(?:[?#].*)?$/, "$1?size=4096")
				.replace(/(\/[-a-z]+\/+[0-9]{5,}\/+(?:users\/+[0-9]+\/+avatars\/+)?[^/]+\.[^/.?#]+)(?:[?#].*)?$/, "$1?size=4096");
		}

		if (domain === "media.discordapp.net") {
			// thanks to ayunami2000 on github for reporting: https://github.com/qsniyg/maxurl/issues/838
			// https://media.discordapp.net/stickers/863979734199435285.png?size=512
			//   https://media.discordapp.net/stickers/863979734199435285.png?size=4096
			newsrc = src.replace(/(\/stickers\/+[0-9]{5,}\.[^/.?#]+)(?:[?#].*)?$/, "$1?size=4096");
			if (newsrc !== src)
				return newsrc;

			// doesn't work anymore:
			// https://media.discordapp.net/attachments/170399623859404800/411963827412795394/CdynalsW4AQYsgy.png?width=223&height=300
			// thanks to Froktime on github: https://github.com/qsniyg/maxurl/issues/1278
			// https://media.discordapp.net/attachments/1134546497606791248/1206941945436577792/image.png?ex=65ddd747&is=65cb6247&hm=3a7cdd94a6ca9b2668b1ee548d0e8fbe7f8dfba011ca4ad436609204d0666825&=&format=webp&quality=lossless&width=1098&height=732
			//   https://media.discordapp.net/attachments/1134546497606791248/1206941945436577792/image.png?ex=65ddd747&is=65cb6247&hm=3a7cdd94a6ca9b2668b1ee548d0e8fbe7f8dfba011ca4ad436609204d0666825
			if (/\/attachments\/+[0-9]+\/+/.test(src)) {
				return keep_queries(src, ["ex", "is", "hm"]);
			}
		}

		if (domain_nosub === "discordapp.net" && domain.match(/images-ext-[0-9]*\.discordapp\.net/)) {
			// https://images-ext-1.discordapp.net/external/2rLDB8F8wm8zJBuYqxmLrM31K-VuJavo6cBLu62McoY/%3Fsize%3D1024/https/cdn.discordapp.com/avatars/378382650597179392/10a9986e76557e24e53f8da2a573e6d1.webp?width=80&height=80
			//   https://cdn.discordapp.com/avatars/378382650597179392/10a9986e76557e24e53f8da2a573e6d1.webp?size=1024
			// https://images-ext-1.discordapp.net/external/Yu5JBnNXOrtdA4di9Pom8R5u-FXQVuHwUQVNA5VE6TQ/https/instagram.ftxl1-1.fna.fbcdn.net/vp/43a40cdb127e4b2731e0d73056813310/5B049080/t51.2885-15/e35/26293979_199841880752391_9218323895503814656_n.jpg?width=240&height=300
			//   https://instagram.ftxl1-1.fna.fbcdn.net/vp/43a40cdb127e4b2731e0d73056813310/5B049080/t51.2885-15/e35/26293979_199841880752391_9218323895503814656_n.jpg
			return decodeURIComponent(src.replace(/.*\/external\/[^/]*\/(?:([^/]*)\/)?(https?)\/(.*?)(?:\?[^/]*)?$/, "$2://$3$1"));
		}

		if (domain_nowww === "hot-korea.net") {
			// https://hot-korea.net/uploads/gallery/thumbs/1238.jpg
			//   https://hot-korea.net/uploads/gallery/1238.jpg
			return src.replace(/\/uploads\/+([^/]*\/+)thumbs\//, "/uploads/$1");
		}

		if (domain_nosub === "sndcdn.com" && domain.match(/i[0-9]*\.sndcdn\.com/)) {
			// https://i1.sndcdn.com/avatars-000300362115-78ogrs-t500x500.jpg
			//   https://i1.sndcdn.com/avatars-000300362115-78ogrs-original.jpg
			// thanks to fedesk:
			// https://i1.sndcdn.com/avatars-000077258072-dklikp-t500x500.jpg
			//   https://i1.sndcdn.com/avatars-000077258072-dklikp-original.png
			newsrc = src.replace(/-[^-/.]*(\.[^/.]*)$/, "-original$1");
			if (newsrc !== src)
				return add_extensions(newsrc);
		}

		if (domain_nowww === "soundcloud.com") {
			var soundcloud_get_clientid_from_js_resp = function(resp) {
				var match = resp.responseText.match(/[{,]client_id:("[^"]{20,}"),/);
				if (!match) {
					console_error("Unable to find text from", resp);
					return null;
				}

				return JSON_parse(match[1]);
			};

			var soundcloud_fetch_clientid_from_js = function(jsfile, cb) {
				api_query("soundcloud:clientid:js:" + jsfile, {
					url: jsfile,
					headers: {
						Referer: "https://soundcloud.com/",
						Origin: "https://soundcloud.com"
					}
				}, cb, function(done, resp, cache_key) {
					var clientid = soundcloud_get_clientid_from_js_resp(resp);
					return done(clientid, clientid ? 2*60*60 : false);
				});
			};

			var soundcloud_fetch_clientid_js_from_resp = function(resp, cb) {
				// third `<script crossorigin` after hydratable
				var match = match_all(resp.responseText, /<script crossorigin src="(https?:\/\/[^/]+\.sndcdn\.com\/+assets\/+1-[0-9a-f]+(?:-[0-9]+)?\.js)"><\/script>/);
				if (!match || !match.length) {
					console_error("Unable to find clientjs match from", resp);
					return cb(null);
				}

				var lastmatch = match[match.length - 1];
				var url = lastmatch[1];
				soundcloud_fetch_clientid_from_js(url, cb);
			};

			var query_soundcloud = function(clientid, url, cb) {
				api_query("soundcloud_api:" + url, {
					url: url + "?client_id=" + clientid,
					imu_mode: "xhr",
					headers: {
						Accept: "*/*",
						Origin: "https://soundcloud.com",
						Referer: " https://soundcloud.com/",
						"Sec-Fetch-Dest": "empty",
						"Sec-Fetch-Mode": "cors",
						"Sec-Fetch-Site": "same-site"
					},
					json: true
				}, cb, function(done, resp, cache_key) {
					return done(resp, 60*60);
				});
			};

			newsrc = website_query({
				website_regex: {
					regex: /^[a-z]+:\/\/[^/]+\/+([^/]+)\/+([^/]+)\/*(?:[?#].*)?$/,
					groups: ["author", "permalink_id"]
				},
				query_for_id: "https://soundcloud.com/${author}/${permalink_id}",
				id: "${author}/${permalink_id}",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/,(\[{"id":[0-9]+,"chunks":\[[0-9]+\],"data":.*?}\])\);<\/script/);
					if (!match) {
						match = resp.responseText.match(/__sc_hydration\s*=\s*(\[.*?\]);<\/script/);
					}
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					var json = JSON_parse(match[1]);
					// author_data = id: 30, chunks: [48]
					// track_data = id: 18, chunks: [48]
					var author_data, track_data;

					array_foreach(json, function(data) {
						let kind = null;
						if (!data.hydratable) {
							if (!data.data || data.data.length !== 1) return;
							data = data.data[0];
							kind = data.kind;
						} else {
							kind = data.hydratable;
							data = data.data;
						}

						if (kind === "user") {
							//author_data = data;
						} else if (kind === "track" || kind === "sound") {
							track_data = data;
						}
					});

					if (!track_data) {
						console_error(cache_key, "Unable to find track data from", resp);
						return done(null, false);
					}

					// we get the info we need from track_data.user
					if (false && !author_data) {
						console_warn(cache_key, "Unable to find author data from", resp);
					}

					var obj = {
						extra: {
							page: track_data.permalink_url,
							id: track_data.id,
							created_date: new Date(track_data.created_at).getTime(),
							updated_date: new Date(track_data.last_modified).getTime(),
							caption: track_data.title || track_data.description,
							author_username: track_data.user.username,
							//author_uid: track_data.user.id
						}
					};

					var waiting = false;

					var urls = [];
					if (!track_data.media || !track_data.media.transcodings || !track_data.media.transcodings.length) {
						console_warn(cache_key, "Unable to find audio from", track_data, resp);
					} else {
						soundcloud_fetch_clientid_js_from_resp(resp, function(clientid) {
							var backup = fillobj_urls(urls, obj);
							if (!clientid) return done(backup, 60*60);

							var progressive = null;

							array_foreach(track_data.media.transcodings, function(media) {
								// progressive or hls
								if (media.format.protocol !== "progressive") {
									return;
								}

								progressive = media.url;
								return false;
							});

							if (!progressive) {
								console_error(cache_key, "Unable to find progressive track from", track_data);
								return done(backup, 60*60);
							}

							// todo: support hls too? will require more api calls, maybe using multiqueue?
							query_soundcloud(clientid, progressive, function(data) {
								if (!data || !data.url) {
									console_error(cache_key, "Unable to fetch progressive track url", track_data, resp);
									return done(backup, 60*60);
								}

								urls.unshift({
									url: data.url,
									headers: {
										Referer: "https://soundcloud.com/"
									},
									media_info: {
										type: "audio"
									}
								});

								return done(fillobj_urls(urls, obj), 60*60);
							});
						});

						waiting = true;
					}

					urls.push(track_data.artwork_url.replace(/-[^-/.]*(\.[^/.]*)$/, "-original$1"));
					urls.push(track_data.artwork_url);

					if (!waiting) return done(fillobj_urls(urls, obj), 60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nosub === "licdn.com" && /^media(?:-[^.]+)?\./.test(domain)) {
			// https://media.licdn.com/mpr/mpr/shrinknp_200_200/AAEAAQAAAAAAAAIsAAAAJDI3NTdjMDNhLWM3ZWMtNGQzZS04MGE1LWJjMzlkNWIzNDlhNw.jpg
			//   https://media.licdn.com/mpr/mpr/AAEAAQAAAAAAAAIsAAAAJDI3NTdjMDNhLWM3ZWMtNGQzZS04MGE1LWJjMzlkNWIzNDlhNw.jpg
			return src.replace(/\/shrinknp_[0-9]+_[0-9]+\//, "/");
		}

		if ((domain_nosub === "townnews.com" && domain.match(/bloximages\..*vip\.townnews\.com/)) ||
			// https://s3-ap-southeast-2.amazonaws.com/syd.cdn.coreweb.com.au/136/1734561-our-neighbourhood-650x360.jpg
			//   http://syd.cdn.coreweb.com.au/136/1734561-our-neighbourhood-650x360.jpg
			amazon_container === "syd.cdn.coreweb.com.au") {
			// https://bloximages.chicago2.vip.townnews.com/tucson.com/content/tncms/assets/v3/editorial/9/e1/9e16bd10-2343-5819-a7c7-89a7d520c38e/5a653cb109be0.image.jpg?resize=750%2C1067
			// https://bloximages.newyork1.vip.townnews.com/roanoke.com/content/tncms/assets/v3/editorial/5/fd/5fd9841d-3b33-5f9a-b8e7-efb5a1730a65/5408aee812bf4.image.jpg
			// https://bloximages.newyork1.vip.townnews.com/heraldmailmedia.com/content/tncms/assets/v3/editorial/1/9a/19a45cfe-354a-11e3-939d-001a4bcf6878/5800f2836b369.image.jpg?resize=1200%2C675
			return src.replace(/^(.*?:\/\/)[^/]*\//, "http://");
		}

		if (domain_nosub === "psbin.com" && domain.match(/cdn[^.]*\.psbin\.com/)) {
			// http://cdnak1.psbin.com/img/mw=160/mh=210/cr=n/d=choz0/0gdge8mcb86p3dfk.jpg
			//   http://cdnak1.psbin.com/img/0gdge8mcb86p3dfk.jpg
			return {
				url: src.replace(/\/img\/[^/]*=[^/]*\//, "/img/"), // repeated
				head_wrong_contentlength: true
			};
		}

		if (domain === "wac.450f.edgecastcdn.net") {
			// http://wac.450f.edgecastcdn.net/80450F/k99.com/files/2013/01/JohnnyCarson_Facebook-630x477.jpg
			// http://wac.450f.edgecastcdn.net/80450F/banana1015.com/files/2013/04/Daryl-Salad-ft.jpg?w=600&h=0&zc=1&s=0&a=t&q=89
			// http://wac.450f.edgecastcdn.net/80450F/thefw.com/files/2012/06/Jimmy-Kimmel-Hooks-Kids-Up-to-Fake-Lie-Detector1.jpg
			// http://wac.450f.edgecastcdn.net/80450F/wokq.com/files/2015/11/12011246_10153099160181766_6355448705489009380_n.jpg
			// http://wac.450f.edgecastcdn.net/80450F/mix106radio.com/files/2017/05/RS8710_177369626.jpg?w=630&h=420&zc=1&s=0&a=t&q=89
			return src.replace(/^(.*?:\/\/)[^/]*\/80450F\/(.*?)$/, "http://$2");
		}

		if (domain === "gp1.wac.edgecastcdn.net") {
			// https://gp1.wac.edgecastcdn.net/802892/http_public_production/musicians/images/458607/original/resize:248x186/crop:x0y8w740h554/hash:1467386813/1425323540_10201484920743713_511360204_n.jpg?1467386813
			//   https://gp1.wac.edgecastcdn.net/802892/http_public_production/musicians/images/458607/original/1425323540_10201484920743713_511360204_n.jpg?1467386813
			return src.replace(/(\/images\/[0-9]*\/[^/]*\/)[^/]*:[^/]*\//, "$1"); // repeated
		}

		if (domain === "r.fashionunited.com") {
			// https://r.fashionunited.com/JgvJQgsYbdElnLjmN6ytAOlaH8YPGrFd_78Hd5FoVog/resize:fill:582:0:0/gravity:ce/quality:70/aHR0cHM6Ly9mYXNoaW9udW5pdGVkLmNvbS9pbWcvdXBsb2FkLzIwMjIvMDUvMDEvMS1idXJiZXJyeS1sb2xhLWJhZy10b3Jzby1zb2x1dGlvbnMtMDItb3p6bmVpdHctMjAyMi0wNS0wMS5qcGVn
			//   https://fashionunited.com/img/upload/2022/05/01/1-burberry-lola-bag-torso-solutions-02-ozzneitw-2022-05-01.jpeg
			newsrc = src.replace(/.*?\/(aHR0c.*?)(?:[?#].*)?$/, "$1");
			if (newsrc !== src)
				return base64_decode(newsrc);
		}

		if (domain === "cdn.tag-walk.com" ||
			domain === "d2r7w2ky9n5k2b.cloudfront.net") {
			// https://cdn.tag-walk.com/webp/list/look-25-76888d.jpg
			// https://cdn.tag-walk.com/webp/zoom/look-25-76888d.jpg -- 1994x3000, watermark
			// https://cdn.tag-walk.com/webp/zoom_nw/look-25-76888d.jpg -- no watermark
			// https://cdn.tag-walk.com/webp/custom,fit_cover/look-25-76888d.jpg -- 2385x3589
			return {
				url: src.replace(/\/(?:webp|jpeg)\/+[^/]+\/+/, "/webp/custom,fit_cover/"),
				can_head: false // 403
			};
		}

		if (domain_nowww === "century21.com") {
			// https://www.century21.com/c21/photo/320x240/c21.azureedge.net/1103i96/6m7cc0c7t2ke40abf3a2tgy386i96
			//   http://c21.azureedge.net/1103i96/6m7cc0c7t2ke40abf3a2tgy386i96
			// https://www.century21.com/c21/photo/maxxmax/c21.azureedge.net/1i103/rk8yf7dx6g8z4na3er4jc4m9b1i103
			//   http://c21.azureedge.net/1i103/rk8yf7dx6g8z4na3er4jc4m9b1i103
			// https://www.century21.com/c21/photo/maxxmax/c21.azureedge.net/1228i0/jyxkay59ty7p4qyd1edb7mw8w3i
			//   http://c21.azureedge.net/1228i0/jyxkay59ty7p4qyd1edb7mw8w3i
			return src.replace(/.*?\/photo\/[0-9a-z]*x[0-9a-z]*\//, "https://");
		}

		if (domain === "cdn.instructables.com") {
			// https://cdn.instructables.com/FK3/KJ6O/J1WW1VNZ/FK3KJ6OJ1WW1VNZ.RECTANGLE1.jpg
			//   https://cdn.instructables.com/ORIG/FK3/KJ6O/J1WW1VNZ/FK3KJ6OJ1WW1VNZ.jpg
			return src.replace(/(:\/\/[^/]*\/)(.*)\.[^/.]*(\.[^/.]*)$/, "$1ORIG/$2$3");
		}

		if (domain_nosub === "pressreader.com" && domain.match(/cdn[0-9]*-img\.pressreader\.com/)) {
			// https://cdn2-img.pressreader.com/pressdisplay/docserver/getimage.aspx?regionKey=nsDHuRjfHcgbdqHuZt9cKQ%3D%3D&scale=100
			//   https://cdn2-img.pressreader.com/pressdisplay/docserver/getimage.aspx?regionKey=nsDHuRjfHcgbdqHuZt9cKQ%3D%3D
			return src.replace(/getimage\.aspx[^/]*[?&](regionKey=[^&]*).*$/, "getimage.aspx?$1");
		}

		if (domain_nowww === "layfielddesign.com") {
			// http://layfielddesign.com/assets/uploads/project_images/_fullSize/harpers-bazaar-statistics.jpg
			//   http://layfielddesign.com/assets/uploads/project_images/harpers-bazaar-statistics.jpg
			return src.replace(/\/uploads\/+([^/]*)\/+_[^/]*\//, "/uploads/$1/");
		}

		if (googlestorage_container === "mediaslide-europe") {
			// https://mediaslide-europe.storage.googleapis.com/uno/pictures/423/24823/large-1489494252-0801f3a26891df01462bae3da66cf8e7.jpg
			//   https://mediaslide-europe.storage.googleapis.com/uno/pictures/423/24823/1489494252-0801f3a26891df01462bae3da66cf8e7.jpg
			return src.replace(/\/[a-z]*-([^/]*)$/, "/$1");
		}

		if (domain_nosub === "netinfo.bg" && domain.match(/m[^.]*\.netinfo\.bg/)) {
			// https://www.vesti.bg/galerii/foto/zvezdite-s-dve-razlichni-obuvki-na-cherveniia-kilim-4877/32735277
			//
			// https://mm.netinfo.bg/resize/resize_on_the_fly.php?address=media/images/32735/32735277/r-1024-768-obuvki-cherven-kilim-znamenitosti.jpg
			//   https://mm.netinfo.bg/resize/resize_on_the_fly.php?address=media/images/32735/32735277/orig-orig-obuvki-cherven-kilim-znamenitosti.jpg
			// https://m5.netinfo.bg/media/images/32735/32735277/r-1024-768-obuvki-cherven-kilim-znamenitosti.jpg
			// https://m5.netinfo.bg/media/images/32735/32735277/r-976-734-obuvki-cherven-kilim-znamenitosti.jpg
			// https://m5.netinfo.bg/media/images/32735/32735277/80-49-obuvki-cherven-kilim-znamenitosti.jpg
			// https://mm.netinfo.bg/resize/resize_on_the_fly.php?address=media/images/32713/32713259/orig-orig-emili-ratajkovski.jpg
			// https://mm.netinfo.bg/resize/resize_on_the_fly.php?address=media/images/32735/32735277/orig-orig-obuvki-cherven-kilim-znamenitosti.jpg
			//
			// https://m.netinfo.bg/media/images/32735/32735274/80-49-obuvki-cherven-kilim-znamenitosti.jpg
			return src.replace(/([/=]media\/images\/[0-9]*\/[0-9]*\/)(?:r-)?[^-/.]*-[^-/.]*/, "$1orig-orig");
		}

		if (domain_nowww === "imgur.com") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+(?:a|gallery)\/+([a-zA-Z0-9]+)(?:[?#].*)?$/,
				run: function(cb, match) {
					common_functions["imgur_fetch_album_media"](options, api_cache, "album", match[1], function(data) {
						if (!data)
							return cb(null);

						if (!data.media || data.media.length === 0) {
							console_error("Unable to find images in", data);
							return cb(null);
						}

						var imageobjs = [];

						array_foreach(data.media, function(image) {
							var baseobj = {extra: {}};
							var obj = common_functions["imgur_image_to_obj"](options, baseobj, image);
							imageobjs.push(fillobj_urls(obj, baseobj));
						});

						var obj = {
							extra: {
								page: data.url,
								caption: data.title || null
							}
						};

						if (data.created_at) {
							obj.extra.created_date = new Date(data.created_at).getTime();
						}

						if (data.media.length > 1) {
							obj.album_info = {
								type: "links",
								links: []
							};

							array_foreach(imageobjs, function(imageobj, i) {
								obj.album_info.links.push({
									url: imageobj[0].extra.page,
									is_current: i === 0
								});
							});
						}

						var newobj = fillobj_urls(imageobjs[0], obj);
						return cb(newobj);
					});
				}
			});
			if (newsrc) return newsrc;

			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+([a-zA-Z0-9]+)(?:[?#].*)?$/,
				run: function(cb, match) {
					common_functions["imgur_fetch_album_media"](options, api_cache, "image", match[1], function(data) {
						if (!data)
							return cb("https://i.imgur.com/" + match[1] + ".jpg");

						var baseobj = {
							extra: {
								page: data.url,
								caption: data.title || null
							}
						};

						if (data.created_at) {
							baseobj.extra.created_date = new Date(data.created_at).getTime();
						}

						var media = data;
						if (media.media && media.media[0])
							media = media.media[0];

						var obj = common_functions["imgur_image_to_obj"](options, baseobj, media);

						if (!obj) {
							console_error("Unable to parse obj from", data);
							return cb(null);
						}

						return cb(obj);
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "i.imgur.com" ||
			// thanks to eightyy8 on github: https://github.com/qsniyg/maxurl/issues/1106
			// https://i.imgur.io/MzDoRsM_d.webp?maxwidth=640&shape=thumb&fidelity=medium
			//   https://i.imgur.com/MzDoRsM.png
			domain === "i.imgur.io") {
			// https://i.imgur.com/ajsLfCab.jpg
			// https://i.imgur.com/ajsLfCam.jpg
			// https://i.imgur.com/ajsLfCal.jpg
			// https://i.imgur.com/ajsLfCa_d.jpg?maxwidth=520&shape=thumb&fidelity=high
			//   https://i.imgur.com/ajsLfCa.jpg
			// https://i.imgur.com/ajsLfCa.mp4
			// https://i.imgur.com/2t5WVj6.jpg
			//   https://35photo.pro/photos_main/465/2325482.jpg
			// ?fb, ?fbplay both scale down the image too
			// h, r, l, g, m, t, b, s

			if (src.match(/\/removed\.[a-zA-Z]+(?:[?#].*)?$/))
				return {
					url: src,
					bad: true
				};

			var baseobj:BigImageInfoSObject = {
				url: src.replace(/\?.*/, ""),
				headers: {
					Referer: "https://www.reddit.com/" // overrides bandwidth limitations
				},
				referer_ok: {
					same_domain_nosub: true
				}
			};

			var idregex = /^[a-z]+:\/\/[^/]+\/+([a-zA-Z0-9]{7})\./;

			newsrc = src.replace(/\/([a-zA-Z0-9]{7})(?:[hrlgmtbs]|_d)(\.[^/.?]*)$/, "/$1$2");
			if (newsrc !== src) {
				baseobj.url = newsrc;

				match = newsrc.match(idregex);
				if (match) {
					baseobj.extra = {page: "https://imgur.com/" + match[1]};
				}

				return baseobj;
			}

			match = src.match(idregex);
			var idhash;
			if (match) {
				idhash = match[1];
				baseobj.extra = {page: "https://imgur.com/" + idhash};

				return [
					{url: baseobj.extra.page, is_pagelink: true},
					baseobj
				];
			}

			return baseobj;
		}

		if (domain === "imgur.dcard.tw" ||
			// https://i.wgirlz.us/iYezyBA.jpg
			//   https://i.imgur.com/iYezyBA.jpg
			domain === "i.wgirlz.us") {
			// https://imgur.dcard.tw/gyU7d4s.jpg
			//   https://i.imgur.com/gyU7d4s.jpg
			return src.replace(/:\/\/[^/]*\//, "://i.imgur.com/");
		}

		if (domain_nowww === "siamzone.com") {
			// https://www.siamzone.com/board/imgur.php?R7wGOGq.jpg
			//   https://www.siamzone.com/board/imgur/R/R7wGOGq.jpg
			//   https://i.imgur.com/R7wGOGq.jpg
			return src
				.replace(/^[a-z]+:\/\/[^/]*\/board\/+(?:imgur\.php\?|imgur\/+.\/+)([^/]*)$/, "https://i.imgur.com/$1");
		}

		if (domain_nosub === "disp.cc" && /^i[0-9]*\./.test(domain)) {
			// https://i4.disp.cc/imgur/5zwjc96h.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+imgur\/+([^/?#]+)(?:[?#].*)?$/, "https://i.imgur.com/$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "i.stack.imgur.com") {
			// thanks to Noodlers on discord
			// https://i.stack.imgur.com/LClNA.png?s=32&g=1
			//   https://i.stack.imgur.com/LClNA.png
			// (yes this could be integrated in the main ?.* rule, but imgur can be weird)
			return src.replace(/\?.*/, "");
		}

		if (domain_nowww === "vidble.com" ||
			// https://i.vidble.com//FLJ23AtOz0_sqr.jpg
			//   https://i.vidble.com//FLJ23AtOz0.jpg
			domain === "i.vidble.com") {
			// https://www.vidble.com/ZNOTKNmw6y_sqr.jpg
			//   https://www.vidble.com/ZNOTKNmw6y.jpg
			return src.replace(/_[^/._]*(\.[^/.]*)$/, "$1");
		}

		if (domain === "itpro.nikkeibp.co.jp") {
			// http://itpro.nikkeibp.co.jp/pc/article/interview/20130319/1083744/thumb_420_ph2_px420.jpg
			//   http://itpro.nikkeibp.co.jp/pc/article/interview/20130319/1083744/ph2_px420.jpg
			return src.replace(/\/thumb_[0-9]+_([^/]*)$/, "/$1");
		}

		if (domain === "media-cdn.tripadvisor.com") {
			// https://media-cdn.tripadvisor.com/media/photo-s/0e/8d/a4/5e/hogwarts-express.jpg
			//   https://media-cdn.tripadvisor.com/media/photo-s/0e/8d/a4/5e/hogwarts-express.jpg
			// 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.
			domain === "resources.stuff.co.nz" ||
			// https://www.fairfaxstatic.com.au/content/dam/images/g/p/f/d/b/e/image.gallery.tallPortrait.400x600.gpfddu.png/1465447253403.jpg
			//   https://www.fairfaxstatic.com.au/content/dam/images/g/p/f/d/b/e/image.
			domain_nowww === "fairfaxstatic.com.au" ||
			// https://www.smh.com.au/content/dam/images/g/r/0/l/p/v/image.gallery.landscape.620x413.gr2z10.png/1472359686893.jpg
			//   https://www.smh.com.au/content/dam/images/g/r/0/l/p/v/image.
			domain_nowww === "smh.com.au" ||
			// http://www.dailylife.com.au/content/dam/images/2/x/v/6/k/image.related.articleLeadNarrow.300x0.2y0pa.png/1385226001000.jpg
			//   http://www.dailylife.com.au/content/dam/images/2/x/v/6/k/image.
			domain_nowww === "dailylife.com.au" ||
			// http://www.essentialbaby.com.au/content/dam/images/4/6/9/8/d/image.gallery.articleLeadwide.620x349.23z5t.png
			//   http://www.essentialbaby.com.au/content/dam/images/4/6/9/8/d/image.
			domain_nowww === "essentialbaby.com.au") {
			// http://www.traveller.com.au/content/dam/images/3/5/o/g/5/image.related.articleLeadwide.620x349.gz1l7v.png/1508294036655.jpg
			//   http://www.traveller.com.au/content/dam/images/3/5/o/g/5/image.related.articleLeadwide.620x349.gz1l7v.png
			//   http://www.traveller.com.au/content/dam/images/3/5/o/g/5/image.
			// http://www.traveller.com.au/content/dam/images/1/0/f/c/k/q/image.
			//return src.replace(/(\/images\/[0-9a-z]\/[0-9a-z]\/[0-9a-z]\/[0-9a-z]\/[0-9a-z]\/image\.).*$/, "$1");
			return src.replace(/(\/images\/+(?:[0-9a-z]\/+){4,}image\.).*$/, "$1");
		}

		if (domain_nowww === "getwallpapers.com" ||
			// http://hintergrundbild.org/wallpaper/small/f/5/3/71029-full-size-freundschaft-hintergrundbilder-1920x1080.jpg
			//   http://hintergrundbild.org/wallpaper/full/f/5/3/71029-full-size-freundschaft-hintergrundbilder-1920x1080.jpg
			domain_nowww === "hintergrundbild.org" ||
			// https://wallpapertag.com/wallpaper/small/3/3/8/7792-anime-backgrounds-1920x1200-smartphone.jpg
			//   https://wallpapertag.com/wallpaper/full/3/3/8/7792-anime-backgrounds-1920x1200-smartphone.jpg
			domain_nowww === "wallpapertag.com") {
			// http://getwallpapers.com/wallpaper/small/4/b/a/573224.jpg
			//   http://getwallpapers.com/wallpaper/full/4/b/a/573224.jpg
			return src.replace(/\/wallpaper\/+[^/]*\/+((?:[0-9a-f]\/+){3})/, "/wallpaper/full/$1");
		}

		if (domain === "ideascdn.lego.com") {
			// https://ideascdn.lego.com/community/projects/be9/7b9/163334/2794778-o_1b5ccku8lf9a1sep1r8of4to8j7-thumbnail-b5Us8BCO1UerJg.png
			//   https://ideascdn.lego.com/community/projects/be9/7b9/163334/2794778-o_1b5ccku8lf9a1sep1r8of4to8j7.png
			// https://ideascdn.lego.com/community/projects/be9/7b9/163334/2794790-o_1b5ccmo8e53mofh1gnao2ag8ef-square-100.png
			return src
				.replace(/-thumbnail[^/.]*(\.[^/.]*)$/, "$1")
				.replace(/-square[^/.]*(\.[^/.]*)$/, "$1");
		}

		if (domain === "images.newindianexpress.com" ||
			// https://images.indulgexpress.com/uploads/user/imagelibrary/2019/4/12/w600X300/rihanna-barbados-ambassador.jpg
			//   https://images.indulgexpress.com/uploads/user/imagelibrary/2019/4/12/original/rihanna-barbados-ambassador.jpg
			domain === "images.indulgexpress.com") {
			// http://images.newindianexpress.com/uploads/user/imagelibrary/2018/2/2/w100X65/d5cd2a22045a49e1a1bfef3810b0144f.jpg
			//   http://images.newindianexpress.com/uploads/user/imagelibrary/2018/2/2/original/d5cd2a22045a49e1a1bfef3810b0144f.jpg
			return src.replace(/\/[wh][0-9]+X[0-9]*\//, "/original/");
		}

		if (false && domain === "image.spreadshirtmedia.com") {
			// https://image.spreadshirtmedia.com/image-server/v1/designs/1001957174,width=178,height=178/harry-potter-hogwarts-express-coffee-mug.png
			//   https://image.spreadshirtmedia.com/image-server/v1/designs/1001957174/harry-potter-hogwarts-express-coffee-mug.png
			// doesn't work:
			//  https://image.spreadshirtmedia.com/image-server/v1/mp/products/T812A2MPA1663PT17X49Y58D1014395106S29/views/1,width=1200,height=1200,appearanceId=2,backgroundColor=E8E8E8,modelId=115,crop=detail,version=1515071979/deathgrips-men-s-premium-t-shirt.webp - 1200x1200
			//    https://image.spreadshirtmedia.com/image-server/v1/mp/products/T812A2MPA1663PT17X49Y58D1014395106S29/views/1/deathgrips-men-s-premium-t-shirt.webp -- 190x190, different image
			// https://image.spreadshirtmedia.com/content/w_650/cms/cyo/seo/cheaptshirts/6_us_desktop.png
			//   https://image.spreadshirtmedia.com/content/cms/cyo/seo/cheaptshirts/6_us_desktop.png
			return src
				.replace(/\/content\/+w_[0-9]+\/+cms\/+/, "/content/cms/");
			//.replace(/(\/[0-9]*),(?:[^=/,]*=[^=/,]*,?){1,}(\/[^/]*$)/, "$1$2");
		}

		if (domain_nosub === "blastingcdn.com" && domain.match(/staticr[0-9]*\.blastingcdn\.com/)) {
			// http://staticr1.blastingcdn.com/media/photogallery/2017/10/14/660x290/b_586x276/a-family-was-rescued-by-the-harry-potter-hogwarts-express-in-the-scottish-highlands-image-credit-pixabaycc0_1631843.jpg
			//   http://static.blastingnews.com/media/photogallery/2017/10/14/main/a-family-was-rescued-by-the-harry-potter-hogwarts-express-in-the-scottish-highlands-image-credit-pixabaycc0_1631843.jpg
			// https://staticr1.blastingcdn.com/media/listicle/2018/12/07/b_660xauto/3345b197-deb8-4f4c-8994-c68ae08e7e06.jpg
			//   https://staticr1.blastingcdn.com/media/listicle/2018/12/07/3345b197-deb8-4f4c-8994-c68ae08e7e06.jpg
			//return src.replace(/(\/media\/+listicle\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2})[a-z]_[auto0-9]+x[auto0-9]+\/+/, "$1");
			return src
				.replace(/\/b_[auto0-9]+x[auto0-9]+\/([^/]*)$/, "/$1")
				.replace(/\/[0-9]+x[0-9]+\/([^/]*)$/, "/main/$1");
		}

		if (domain_nowww === "gjdream.com") {
			// http://www.gjdream.com/news/contents/UPFILE/2018/20180201485362_tmb.jpg
			//   http://www.gjdream.com/news/contents/UPFILE/2018/20180201485362.jpg
			return src.replace(/_tmb(\.[^/.]*)$/, "$1");
		}

		if (domain === "www.imaeil.com") {
			// http://www.imaeil.com/m_wiz/imgsrc3.php?w=261&h=142&t=&rate=100&src=/news_img/event_plus/2018.02.02.14.04.38_mainphoto01_1.jpg
			//   http://www.imaeil.com//news_img/event_plus/2018.02.02.14.04.38_mainphoto01_1.jpg
			// http://news.imaeil.com/inc/thumbnails/main/2020102417232900758.jpg?33581
			//   http://news.imaeil.com/Politics/2020102417232900758
			//   http://news.imaeil.com/inc/photos/2020/10/24/2020102417194979732_l.jpg
			return src.replace(/\/m_wiz\/imgsrc[0-9]\.php.*?[?&]src=([^&]*).*/, "/$1");
		}

		if (domain_nowww === "kwnews.co.kr") {
			// http://www.kwnews.co.kr/kwnews_view.asp?kwurl=20180202-218020100137-3001.jpg
			//   http://www.kwnews.co.kr/newsphoto/2018/02/218020100137.jpg
			return src.replace(/\/kwnews_view\.asp?.*?kwurl=([0-9]{4})([0-9]{2})[0-9]*-([0-9]*)-[0-9]*(\.[^/.]*)$/, "/newsphoto/$1/$2/$3$4");
		}

		if (false && domain_nowww === "yeongnam.com" && string_indexof(src, "/Photo/") >= 0) {
			// doesn't work anymore
			// http://www.yeongnam.com/Photo/2018/01/26/S20180126.99001151846332501.jpg
			//   http://www.yeongnam.com/Photo/2018/01/26/R20180126.99001151846332501.jpg
			// https://www.yeongnam.com/mnt/thum/201801/20180126.99001151846332501.jpg
			// R, L, M, S
			return src.replace(/\/[A-Z]([^/]*)$/, "/R$1");
		}

		if (domain_nowww === "yeongnam.com") {
			// https://www.yeongnam.com/mnt/thum/202010/20201023002047563_1.jpg
			//   https://www.yeongnam.com/mnt/file_m/202010/20201023002047563_1.jpg
			//   https://www.yeongnam.com/mnt/file/202010/20201023002047563_1.jpg
			// https://www.yeongnam.com/mnt/thum/201801/20180126.99001151846332501.jpg
			//   https://www.yeongnam.com/mnt/file/201801/20180126.99001151846332501.jpg
			return src.replace(/\/mnt\/+(?:thum|file_[a-z])\/+/, "/mnt/file/");
		}

		// doesn't always work, due to .jpg/.jpeg
		if (false && domain_nowww === "yeongnam.com" && string_indexof(src, "/news/screennews/") >= 0) {
			// doesn't work anymore
			// http://www.yeongnam.com/news/screennews/159_20180329_L20180327_99001152405345001.jpg
			//   http://www.yeongnam.com/Photo/2018/03/27/R20180327.99001152405345001.jpeg
			return src
				.replace(/\/news\/screennews\/[0-9]+_[0-9]+_[A-Z]([0-9]{4})([0-9]{2})([0-9]{2})_([0-9]+)(\.[^/.]*)/,
						 "/Photo/$1/$2/$3/R$1$2$3.$4.jpeg");
		}

		if (domain === "db.kookje.co.kr") {
			// http://www.kookje.co.kr/news2011/asp/newsbody.asp?key=20180202.22001000306
			//   http://db.kookje.co.kr/news2000/photo/2018/0202/L20180202.22001000306i1.jpg -- 600x403
			//   http://db.kookje.co.kr/news2000/photo/2018/0202/20180202.22001000306i1.jpg -- 300x202
			// http://db.kookje.co.kr/news2000/photo/2012/0414/20120414.99002182507i1.jpg - 2568x1640
			//   http://db.kookje.co.kr/news2000/photo/2012/0414/L20120414.99002182507i1.jpg ??? (website overloaded, try again later, also generic 404 page)
			// http://db.kookje.co.kr/news2000/photo/2013/1003/20131003.99002193930i2.jpeg -- 1674x2718
			//   http://db.kookje.co.kr/news2000/photo/2013/1003/L20131003.99002193930i2.jpeg -- 600x974
			// http://db.kookje.co.kr/news2000/photo/2016/0514/L20160514.33001222704i1.jpg -- 4738x2604
			// http://db.kookje.co.kr/news2000/photo/download/20190123.jpg
			// http://db.kookje.co.kr/news2000/photo/download/20171121-1.jpg
			// L, S
			match = src.match(/\/[A-Z]?([0-9]{8}\.[0-9]+)i[0-9]+\.[^/.]*(?:[?#].*)?$/);
			var extra = {};
			if (match) {
				extra.page = "http://www.kookje.co.kr/news2011/asp/newsbody.asp?key=" + match[1];
			}

			return {
				url: src.replace(/\/[A-Z]([0-9]{8}\.[0-9]+i[0-9]+\.[^/.]*)(?:[?#].*)?$/, "/L$1"),
				extra: extra
			};
		}

		if (domain_nowww === "kookje.co.kr") {
			// http://www.kookje.co.kr/news2011/screennews/thumb/466_20180305_20180305.99099001307i1.jpg
			//   http://www.kookje.co.kr/news2011/screennews/466_20180305_20180305.99099001307i1.jpg
			//   http://db.kookje.co.kr/news2000/photo/2018/0305/20180305.99099001307i1.jpg
			//   http://db.kookje.co.kr/news2000/photo/2018/0305/L20180305.99099001307i1.jpg
			// http://www.kookje.co.kr/news2011/screennews/466_20180305_20180305.99099001300i1.jpg
			//   http://db.kookje.co.kr/news2000/photo/2018/0305/20180305.99099001300i1.jpg
			//   http://db.kookje.co.kr/news2000/photo/2018/0305/L20180305.99099001300i1.jpg
			// http://www.kookje.co.kr/news2011/screennews/thumb/466_20180305_20180211.99099004174i1.jpg
			//   http://db.kookje.co.kr/news2000/photo/2018/0211/20180211.99099004174i1.jpg
			//   http://db.kookje.co.kr/news2000/photo/2018/0211/L20180211.99099004174i1.jpg
			return src
				.replace("/thumb/", "/")
				.replace(/.*\/[0-9]+_[0-9]+_([0-9]{4})([0-9]{4})([^/]*)$/, "http://db.kookje.co.kr/news2000/photo/$1/$2/L$1$2$3");
		}

		if (domain_nowww === "joongdo.co.kr" ||
			// http://www.viva100.com/mnt/images/webdata/content/2020y/01m/17d/crop2020011701001363700060161.jpg
			//    http://www.viva100.com/mnt/images/file/2020y/01m/17d/2020011701001363700060161.jpg
			domain_nowww === "viva100.com") {
			// http://www.joongdo.co.kr/mnt/images/webdata/content/2018y/02m/01d/crop2018020101000198000004991.jpg
			//   http://www.joongdo.co.kr/mnt/images/file/2018y/02m/01d/2018020101000198000004991.jpg
			return src.replace(/\/webdata\/+content\/+([0-9]{4}y\/+[0-9]{2}m\/+[0-9]{2}d\/+)crop([0-9]+\.[^/.]+)(?:[?#].*)?$/, "/file/$1$2");
		}

		if (false && domain === "img.asiatoday.co.kr") {
			// http://img.asiatoday.co.kr/webdata/content/2018y/02m/28d/20180228002024152_77_58.jpg
			//   http://img.asiatoday.co.kr/file/2018y/02m/28d/20180228002024152_1.jpg
			// http://img.asiatoday.co.kr/webdata/content/2018y/03m/09d/20180309010004779_77_58.jpg
			//   http://img.asiatoday.co.kr/file/2018y/03m/09d/20180309010004779_1.jpg - doesn't work
			//   http://img.asiatoday.co.kr/file/2018y/03m/09d/2018030901000828800047791.jpg - works
			// http://img.asiatoday.co.kr/webdata/content/2017y/03m/31d/20170331010021088_300_300.jpg
			//   http://img.asiatoday.co.kr/file/2017y/03m/31d/2017033101002937000210881.jpg
			// http://img.asiatoday.co.kr/webdata/content/2018y/09m/12d/20180912010007252_300_300.jpg
			//   http://img.asiatoday.co.kr/file/2018y/09m/12d/201809120100072521.jpg -- doesn't work
			//   http://img.asiatoday.co.kr/file/2018y/09m/12d/2018091201000933500072521.jpg
			regex = /\/webdata\/content\/(.*)_[0-9]+_[0-9]+(\.[^/.]*)$/;
			return [
				src.replace(regex, "/file/$1_1$2"),
				src.replace(regex, "/file/$11$2")
			];
		}

		if (false && domain === "img.asiatoday.co.kr") {
			// http://img.asiatoday.co.kr/thum/thumbnail/2012y/04m/25d/thumb631124(0)-100120_98432.jpg
			//   http://img.asiatoday.co.kr/file/2012y/04m/25d/631124(0)-100120_98432.jpg -- doesn't work
			//   http://img.asiatoday.co.kr/file/2012y/04m/25d/631124(0)-480640_98432.jpg -- actual full image
			return src.replace(/\/thum\/+thumbnail\/+([0-9]+y\/+[0-9]+m\/+[0-9]+d\/+)thumb/, "/file/$1");
		}

		if (domain === "img.asiatoday.co.kr") {
			// thanks to f2005 on discord:
			// https://img.asiatoday.co.kr/file/2022y/07m/12d/20220712002055404_150.jpg?1657634383
			//   https://img.asiatoday.co.kr/file/2022y/07m/12d/20220712002055404_1.jpg?1657634383
			newsrc = src.replace(/(\/file\/+.*\/+[0-9]{10,}_)[0-9]+\./, "$11.");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "img.asiatoday.co.kr") {
			// http://img.asiatoday.co.kr/file/2019y/06m/27d/20190627000744579_350.jpg
			//   http://img.asiatoday.co.kr/file/2019y/06m/27d/20190627000744579_1561589714_1.jpg?1561589714
			//   http://www.asiatoday.co.kr/view.php?key=20190627000744579
			// http://img.asiatoday.co.kr/webdata/content/2019y/09m/10d/20190910010006235_77_58.jpg
			//   http://img.asiatoday.co.kr/file/2019y/09m/10d/2019091001001161400069161.jpg
			//   http://www.asiatoday.co.kr/view.php?key=20190910010006235
			match = src.match(/\/[0-9]{4}y\/+[0-9]{2}m\/+[0-9]{2}d\/+([0-9]{15,})_[0-9]+(?:_[0-9]+)?\./);
			if (match) {
				return {
					url: src,
					extra: {
						page: "http://www.asiatoday.co.kr/view.php?key=" + match[1]
					}
				};
			}
		}

		if (domain === "jmagazine.joins.com" ||
			// http://www.urbanbug.net/uploads/gallery/photos/2083/thumb_31888-170-05-005.jpg
			//   http://www.urbanbug.net/uploads/gallery/photos/2083/31888-170-05-005.jpg
			(domain_nowww === "urbanbug.net" && string_indexof(src, "/uploads/") >= 0) ||
			// https://shobiddak.com/uploads/picture/stuff/name/159476/thumb_maxresdefault.jpg
			//   https://shobiddak.com/uploads/picture/stuff/name/159476/maxresdefault.jpg
			(domain_nowww === "shobiddak.com" && /\/uploads\/+picture\//.test(src)) ||
			// http://celebs-news.ru/images/persons/natalie-portman/1611/thumb_natalie_portman_32.jpg
			//   http://celebs-news.ru/images/persons/natalie-portman/1611/natalie_portman_32.jpg
			(domain_nowww === "celebs-news.ru" && string_indexof(src, "/images/") >= 0)) {
			// https://jmagazine.joins.com/_data/photo/2018/01/thumb_237268740_ZeJ4MpkI_1.jpg
			return src.replace(/\/thumb_([^/]*)$/, "/$1");
		}

		if (domain === "cdn.ppomppu.co.kr" ||
			// https://www.popco.net/zboard/data/sigma_forum/2018/04/25/thumb_53666d20e05f8691128b91b8456961a7.jpeg
			//   https://popco.net/zboard/data/sigma_forum/2018/04/25/53666d20e05f8691128b91b8456961a7.jpeg
			domain_nowww === "popco.net") {
			// https://cdn.ppomppu.co.kr/zboard/data3/2017/0619/m_20170619132334_ibiwqsfv.jpg
			//   https://cdn.ppomppu.co.kr/zboard/data3/2017/0619/20170619132334_ibiwqsfv.jpg
			return src.replace(/(\/zboard\/+data[0-9]*\/+(?:[^/]*\/+)?[0-9]{4}\/+[0-9]{2}\/*[0-9]{2}\/+)(?:thumb|m)_/, "$1");
		}

		if (domain === "media.codeweavers.com") {
			// https://media.codeweavers.com/pub/crossover/website/appdb/thumb_7be7461d09f5dfd6c43f533ff8d1f62b.png
			//   https://media.codeweavers.com/pub/crossover/website/appdb/7be7461d09f5dfd6c43f533ff8d1f62b.png
			return src.replace(/\/thumb_([0-9a-f]+\.[^/.]*)(?:[?#].*)?$/, "/$1");
		}

		if (domain === "img.tvreport.co.kr" ||
			// http://img.tvreportcdn.de/images/20150612/20150612_1434098756_42297100_1.jpg?1434125364
			// other:
			// https://img.tvreportcdn.de/cms-content/uploads/2019/08/23/312163f3-8749-409c-96b9-d6f4b519ff69.jpg
			domain === "img.tvreportcdn.de") {
			// http://img.tvreport.co.kr/images/20171017/20171017_1508207555_22483100_4.jpg?1512513157
			//   http://img.tvreport.co.kr/images/20171017/20171017_1508207555_22483100_0.jpg?1512513157
			// http://img.tvreport.co.kr/images/20171211/20171211_1512955026_44177100_1.jpg (stretched)
			//   http://img.tvreport.co.kr/images/20171211/20171211_1512955026_44177100_0.jpg (smaller, but not stretched)
			// http://img.tvreport.co.kr/images/20171203/20171203_1512266720_61938500_1.jpg
			//   http://img.tvreport.co.kr/images/20171203/20171203_1512266720_61938500_0.jpg (larger)
			// 0 = original
			// 1 = large
			return src.replace(/_[0-9]*(\.[^/.]*)$/, "_0$1");
		}

		if (domain === "ojsfile.ohmynews.com") {
			// http://ojsfile.ohmynews.com/CT_T_IMG/2018/0131/IE002278988_APP.jpg?4957
			//   http://ojsfile.ohmynews.com/PHT_IMG_FILE/2018/0131/IE002278988_PHT.jpg
			//   http://ojsfile.ohmynews.com/BIG_IMG_FILE/2018/0131/IE002278988_BIG.jpg
			//   http://ojsfile.ohmynews.com/ORG_IMG_FILE/2018/0131/IE002278988_ORG.jpg
			// http://ojsfile.ohmynews.com/CT_T_IMG/2018/0201/IE002279450_APP.jpg?2034
			//   http://ojsfile.ohmynews.com/PHT_IMG_FILE/2018/0201/IE002279450_PHT.jpg
			//   http://ojsfile.ohmynews.com/BIG_IMG_FILE/2018/0201/IE002279450_BIG.jpg
			//   http://ojsfile.ohmynews.com/ORG_IMG_FILE/2018/0201/IE002279450_ORG.jpg
			// http://ojsfile.ohmynews.com/STD_IMG_FILE/2013/0705/IE001596678_STD.jpg
			//   http://ojsfile.ohmynews.com/ORG_IMG_FILE/2013/0705/IE001596678_ORG.jpg
			// http://ojsfile.ohmynews.com/STD_IMG_FILE/2012/0714/IE001464177_STD.jpg -- 550x399
			//   http://ojsfile.ohmynews.com/PHT_IMG_FILE/2012/0714/IE001464177_PHT.jpg -- 800x581
			//   http://ojsfile.ohmynews.com/ORG_IMG_FILE/2012/0714/IE001464177_ORG.jpg -- 404
			// other:
			// http://ojsfile.ohmynews.com/CRI_T_IMG/2019/0530/A0002541423_T.jpg -- 5225x3392
			newsrc = src.replace(/\/STD(_IMG_FILE\/+.*?)_STD(\.[^/.]*)(?:[?#].*)?$/, "/PHT$1_PHT$2");
			if (newsrc !== src)
				return newsrc;

			return src
				.replace(/\/CT_T_IMG\/(.*?)\/([^/]*)_[A-Z]+(\.[^/.]*?)(?:\?.*)?$/, "/ORG_IMG_FILE/$1/$2_ORG$3")
				.replace(/\/[A-Z]*_IMG_FILE\/(.*?)\/([^/]*)_[A-Z]*(\.[^/.]*)(?:\?.*)?$/, "/ORG_IMG_FILE/$1/$2_ORG$3");
		}

		if (domain === "cmsimg.mnet.com" ||
			// thanks to Fray on greasyfork: https://greasyfork.org/en/forum/discussion/47633/x
			// http://cmsimg.global.mnet.com/clipimage/artist/240/000/428/428228.jpg
			//   http://cmsimg.global.mnet.com/clipimage/artist/1024/000/428/428228.jpg
			domain === "cmsimg.global.mnet.com") {
			// wip
			// http://cmsimg.mnet.com/clipimage/artist/240/000/428/428228.jpg
			// http://cmsimg.mnet.com/clipimage/artist/Other/610/000/167/167134.jpg
			//   http://cmsimg.mnet.com/clipimage/artist/Other/1024/000/167/167134.jpg
			//   http://cmsimg.mnet.com/clipimage/artist/Other/000/167/167134.jpg -- 404
			// http://cmsimg.mnet.com/clipimage/vod/Other/000/058/58694.jpg
			//   http://cmsimg.mnet.com/clipimage/vod/Other/610/000/058/58694.jpg -- scaled down to 400x600
			// http://static.global.mnet.com/data/ucc/000/162/359
			// http://static.global.mnet.com/data/ucc/000/162/442
			// http://mnetimg.mnet.com/tvmnetimg/admin/poll/2014/10/1_1413538495789.jpg
			// http://cmsimg.mwave.me/pgmVideo/contentImgUrl/201711/10/0b694d59-29d6-4d36-8470-0e2db3a32e8f.jpg
			// https://cjmwave-prd.s3.ap-northeast-2.amazonaws.com/ion/front/editor/201801/10/e6d980fe-53c3-4604-bce7-08d98c7f2d99.jpg
			// http://mnetimg.mnet.com/L_uimg/adupload/special/2017/08/22/1401090000.jpg
			//return src.replace(/(\/clipimage\/[^/]*)\/[0-9]*\//, "$1/1024/");
			regex = /(\/clipimage\/.*?[^0-9]\/)[0-9]+\/([0-9]+\/[0-9]+\/[0-9]+\.[^/.]*)$/;
			return [
				src.replace(regex, "$1$2"),
				src.replace(regex, "$11024/$2")
			];
		}

		if (domain === "image.cloud.sbs.co.kr") {
			// http://image.cloud.sbs.co.kr/smr/clip/201605/20/ihv2JuZcKz8ChXAsxFPPpC_320.jpg
			//   http://image.cloud.sbs.co.kr/smr/clip/201605/20/ihv2JuZcKz8ChXAsxFPPpC.jpg
			return src.replace(/_[0-9]*(\.[^/.]*)$/, "$1");
		}

		if ((domain_nosub === "st-hatena.com" && /^cdn-ak-scissors\./.test(domain)) ||
			 // thanks to RolerGames on github: https://github.com/qsniyg/maxurl/issues/1009
			 // https://cdn-scissors.gigaviewer.com/image/scale/ec6d4f55a935b83409885221462264a02f09e61f/enlarge=0;height=711.25;no_unsharpmask=1;quality=90;version=1;width=500/https%3A%2F%2Fcdn-img.comic-gardo.com%2Fpublic%2Fseries-sub-thumbnail-vertical-with-logo%2F3269754496561189278-fd4854f7d4eb828a43d1863e889a23d1%3F1646291370
			 //   https://cdn-img.comic-gardo.com/public/series-sub-thumbnail-vertical-with-logo/3269754496561189278-fd4854f7d4eb828a43d1863e889a23d1?1646291370
			 domain === "cdn-scissors.gigaviewer.com" ||
			 domain === "cdn.image.st-hatena.com") {
			// https://cdn-ak-scissors.b.st-hatena.com/image/scale/6b49da1455b11be153a6a5c060fbb6a65ada1cde/enlarge=0;height=480;type=max;version=1;width=480/https%3A%2F%2Fcdn.image.st-hatena.com%2Fimage%2Fscale%2F4220af82af99afcb2b70c52a3d4ee7a5cea0ba38%2Fbackend%3Dimager%3Benlarge%3D0%3Bheight%3D1000%3Bversion%3D1%3Bwidth%3D1200%2Fhttps%253A%252F%252Fcdn.user.blog.st-hatena.com%252Fdefault_entry_og_image%252F672828%252F1514219817468589
			//   https://cdn.image.st-hatena.com/image/scale/4220af82af99afcb2b70c52a3d4ee7a5cea0ba38/backend=imager;enlarge=0;height=1000;version=1;width=1200/https%3A%2F%2Fcdn.user.blog.st-hatena.com%2Fdefault_entry_og_image%2F672828%2F1514219817468589
			//   https://cdn.user.blog.st-hatena.com/default_entry_og_image/672828/1514219817468589
			// https://cdn-ak-scissors.b.st-hatena.com/image/square/2fc5e622ac7d1dc703f1059dcacff46f0afbb002/height=90;version=1;width=120/http://livedoor.blogimg.jp/milano/imgs/1/b/1b341774.jpg
			newsrc = src.replace(/.*?\/image\/(?:scale|square)\/[^/]*\/[^/]*\/(.*)$/, "$1");
			if (newsrc !== src)
				return decodeURIComponent(newsrc);
		}

		if (domain_nosub === "st-hatena.com" && domain.match(/cdn(?:-[a-z]+)\.[a-z]\.st-hatena\.com/)) {
			// https://cdn-ak.f.st-hatena.com/images/fotolife/A/Amayadori-June/20180419/20180419183448_120.jpg
			//   https://cdn-ak.f.st-hatena.com/images/fotolife/A/Amayadori-June/20180419/20180419183448.jpg
			// https://cdn-ak.f.st-hatena.com/images/fotolife/k/kara-hara_8825/20100909/20100909200143_m.jpg
			//   https://cdn-ak.f.st-hatena.com/images/fotolife/k/kara-hara_8825/20100909/20100909200143.jpg
			return src.replace(/_(?:[0-9]+|m)(\.[^/.]*)$/, "$1");
		}

		if (domain === "nimage.newsway.kr") {
			// http://nimage.newsway.kr/phpwas/restmb_idxmake.php?idx=6&simg=20180116000099_0640.jpg
			// http://nimage.newsway.kr/phpwas/restmb_idxmake.php?idx=200&simg=20180202000058_1024.jpg
			// http://nimage.newsway.kr/phpwas/restmb_idxmake.php?idx=138&simg=%2Fphoto%2F2016%2F06%2F02%2F20160602000250_0640.jpg
			//   http://nimage.newsway.kr/photo/2016/06/02/20160602000250_0640.jpg
			if (src.match(/[?&]simg=[%/]/)) {
				return decodeURIComponent(src.replace(/\/phpwas\/restmb_idxmake\.php.*?simg=([^&]*).*?$/, "$1"));
			}
			//return src.replace(/\/phpwas\/restmb_idxmake\.php.*?simg=([0-9]{4})([0-9]{2})([0-9]{2})([^&]*).*?$/, "/photo/$1/$2/$3/$1$2$3$4");

			// http://nimage.newsway.kr/photo/2018/02/01/20180201000273_0480.jpg
			// doesn't work for all:
			// http://nimage.newsway.kr/photo/2016/08/26/20160826000014_0640.png
			//return src.replace(/_[0-9]+(\.[^/.]*)$/, "_1024$1");
		}

		if (domain === "imgsrv.piclick.me") {
			// http://imgsrv.piclick.me/publish.php?pid=1319
			//   https://imgsrv.piclick.me/cimg/1319.jpg
			newsrc = src.replace(/\/publish\.php\?(?:.*&)?pid=([0-9]+)(?:[?#].*)?$/, "/cimg/$1.jpg");
			if (newsrc !== src)
				return newsrc;

			// http://imgsrv.piclick.me/cimg/163x220xN_477539.jpg
			//   https://imgsrv.piclick.me/cimg/N_477539.jpg
			//   https://imgsrv.piclick.me/cimg/477539.jpg -- same
			newsrc = src.replace(/\/cimg\/+[0-9]+x[0-9]+x/, "/cimg/");
			if (newsrc !== src)
				return newsrc;

			// https://imgsrv.piclick.me/cimg/N_477539.jpg
			//   https://imgsrv.piclick.me/cimg/477539.jpg
			newsrc = src.replace(/\/cimg\/+N_/, "/cimg/");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nowww === "slate.com") {
			// http://www.slate.com/content/dam/slate/blogs/browbeat/2017/12/01/how_pixar_made_coco_the_biggest_box_office_hit_in_mexico_s_history/cocorgb_c041_41a_pubpub16565.jpg.CROP.promo-xlarge2.jpg
			//   http://www.slate.com/content/dam/slate/blogs/browbeat/2017/12/01/how_pixar_made_coco_the_biggest_box_office_hit_in_mexico_s_history/cocorgb_c041_41a_pubpub16565.jpg
			return src.replace(/(\/[^/.]*\.[^/.]*)\.[^/]*$/, "$1");
		}

		if (domain === "img.cinemablend.com" ||
			// https://img.minq.com/filter:scale/slides/3/6/0/0/9/0/3600901349/29fc1d2cc8d2499990adfafcce8f922ac2e6df13.jpeg?mw=615
			//   https://img.minq.com/slides/3/6/0/0/9/0/3600901349/29fc1d2cc8d2499990adfafcce8f922ac2e6df13.jpeg
			domain === "img.minq.com") {
			// https://img.cinemablend.com/filter:scale/quill/3/d/0/6/a/d/3d06addd736f79f9449400bed217e59f98ff86af.jpg?mw=600
			//   https://img.cinemablend.com/quill/3/d/0/6/a/d/3d06addd736f79f9449400bed217e59f98ff86af.jpg
			return src.replace(/(:\/\/[^/]*\/)filter:[^/]*\/(.*?)(?:\?[^/]*)?$/, "$1$2");
		}

		if (domain_nowww === "cinemablend.com") {
			// https://www.cinemablend.com/static/images/icons/quote.svg
			if (/\/static\/+images\/+icons\/+/.test(src))
				return {
					url: origsrc,
					bad: "mask"
				};
		}

		if (((domain_nosub === "abcimg.es" && domain.match(/r[0-9]*\.abcimg\.es/)) ||
			 // https://resizer.lasprovincias.es/resizer/resizer.php?imagen=http://www.lasprovincias.es/multimedia/201405/30/media/s18.jpg&nuevoalto=480
			 //   https://static.lasprovincias.es/multimedia/201405/30/media/s18.jpg
			 domain === "resizer.lasprovincias.es" ||
			 // http://resizer.abc.es/resizer/resizer.php?imagen=http://laguiatv.abc.es/archivos/201204/ana-de-armas.jpg&nuevoancho=312&nuevoalto=416
			 //   http://laguiatv.abc.es/archivos/201204/ana-de-armas.jpg
			 domain === "resizer.abc.es" ||
			 // https://resizer.larioja.com/resizer/resizer.php?imagen=/deliverty/demo/resources/jpg/5/2/1281441365725.jpg&nuevoancho=950&nuevoalto=570&copyright=conCopyright&encrypt=false
			 //   https://resizer.larioja.com/deliverty/demo/resources/jpg/5/2/1281441365725.jpg -- not found
			 //   tried with main domain as well, no luck
			 //domain === "resizer.larioja.com" ||
			 // https://resizer.elcorreo.com/resizer/resizer.php?imagen=http://www.elcorreo.com/multimedia/201408/30/media/06-modelos-halle-berry.jpg&nuevoalto=480
			 //   https://www.elcorreo.com/multimedia/201408/30/media/06-modelos-halle-berry.jpg
			 domain === "resizer.elcorreo.com") &&
			string_indexof(src, "/resizer.php") >= 0) {
			// http://r1.abcimg.es/resizer/resizer.php?imagen=http%3A%2F%2Fwww.abc.es%2Fmedia%2Fsociedad%2F2018%2F02%2F01%2Freina-letizia-kYuH--420x236%40abc.jpg&nuevoancho=128&nuevoalto=73&crop=1&medio=abc
			//   http://www.abc.es/media/sociedad/2018/02/01/reina-letizia-kYuH--420x236@abc.jpg
			//   http://www.abc.es/media/sociedad/2018/02/01/reina-letizia-kgrH-U213052464546JvF-620x370@abc.jpg
			newsrc = src.replace(/.*\/resizer\.php.*?[?&]imagen=([^&]*).*$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "resizer.elnortedecastilla.es" ||
			// https://resizer.ideal.es/resizer/resizer.php?imagen=http://www.ideal.es/multimedia/201505/18/media/sel/s7.jpg&nuevoalto=480
			//   https://www.ideal.es/multimedia/201505/18/media/sel/s7.jpg
			domain === "resizer.ideal.es" ||
			// https://resizer.nortecastilla.es/resizer/resizer.php?imagen=/deliverty/demo/resources/jpg/1/3/1295942905031.jpg&nuevoancho=950&nuevoalto=570&copyright=conCopyright&encrypt=false
			//   https://foto-cache.elnortedecastilla.es/jpg/1/3/1295942905031.jpg
			domain === "resizer.nortecastilla.es") {
			// https://resizer.elnortedecastilla.es/resizer/resizer.php?imagen=/deliverty/demo/resources/jpg/1/3/1295942905031.jpg&nuevoancho=950&nuevoalto=570&copyright=conCopyright&encrypt=false
			//   https://resizer.elnortedecastilla.es/resizer/resizer.php?imagen=/deliverty/demo/resources/jpg/1/3/1295942905031.jpg -- 1182x1809
			//   https://foto-cache.elnortedecastilla.es/jpg/1/3/1295942905031.jpg -- 1182x1809

			if (false) {
				return {
					url: src.replace(/\/+resizer\.php.*?[?&](imagen=[^&]*).*/, "/resizer.php?$1"),
					head_wrong_contentlength: true
				};
			} else {
				return src
					.replace(/:\/\/[^/]*\/+resizer\/+resizer\.php.*?[?&]imagen=\/+deliverty\/+[^/]*\/resources\/+([^&]*).*/, "://foto-cache.elnortedecastilla.es/$1")
					.replace(/^[a-z]+:\/\/[^/]*\/+resizer\/+resizer\.php.*?[?&]imagen=(http[^&]*).*/, "$1");
			}
		}

		if (domain === "vz.cnwimg.com") {
			// https://vz.cnwimg.com/thumbc-300x300/wp-content/uploads/2012/03/coco.jpg
			// https://vz.cnwimg.com/thumb-300x170/wp-content/uploads/2018/01/GettyImages-127497645.jpg
			return src.replace(/\/thumb[a-z]*-[0-9]+x[0-9]+\//, "/");
		}

		if (domain_nowww === "coleman-rayner.com" &&
			string_indexof(src, "/watermark/insertwm.php?") >= 0) {
			// http://www.coleman-rayner.com/watermark/insertwm.php?src=http%3A%2F%2Fwww.coleman-rayner.com%2Fwp-content%2Fuploads%2F2014%2F09%2F05.-INSIDE-COCO%E2%80%99S-LAS-VEGAS-WARDROBE-1000.jpg
			return {
				can_head: false,
				url: decodeURIComponent(src.replace(/.*\/watermark\/insertwm\.php.*?[?&]src=([^&]*).*$/, "$1"))
			};
		}

		if (domain === "media.guestofaguest.com") {
			// http://media.guestofaguest.com/t_card_medium/wp-content/uploads/wppa/Coco_Austin6.jpg
			//   http://media.guestofaguest.com/wp-content/uploads/wppa/Coco_Austin6.jpg
			// http://media.guestofaguest.com/t_card_medium/gofg-media/2016/05/1/46413/533596622.jpg
			//   http://media.guestofaguest.com/gofg-media/2016/05/1/46413/533596622.jpg
			return src.replace(/(:\/\/[^/]*\/)[^/]*\/(wp-content|gofg-media)\//, "$1$2/");
		}

		if (domain === "d3wo5wojvuv7l.cloudfront.net") {
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/456
			// https://d3wo5wojvuv7l.cloudfront.net/t_rss_itunes_square_1400/images.spreaker.com/original/76f208970427c501099020ebef187b84.jpg
			//   https://d3wo5wojvuv7l.cloudfront.net/images.spreaker.com/original/76f208970427c501099020ebef187b84.jpg
			//   http://images.spreaker.com/original/76f208970427c501099020ebef187b84.jpg
			return src
				.replace(/^[a-z]+:\/\/[^/]+\/+(images\.spreaker\.com\/)/, "http://$1")
				.replace(/(:\/\/[^/]+\/+)t_[^/.]+\/+/, "$1");
		}

		if (domain_nosub === "heartyhosting.com" &&
			domain.match(/i[0-9]*\.heartyhosting\.com/)) {
			// https://i0.heartyhosting.com/starmagazine.com/wp-content/uploads/2016/01/ice-t-coco-austin-baby-chanel-body-anniversary-dress-05.jpg
			return src.replace(/.*?:\/\/[^/]*\//, "http://");
		}

		if (domain === "images.contactmusic.com") {
			// http://images.contactmusic.com/newsimages/wenn2949343_1_14734_24-cm.jpg
			//   http://images.contactmusic.com/newsimages/wenn2949343_1_14734_24.jpg
			// http://images.contactmusic.com/newsimages/wenn90807_1_16815_34-cm.jpg
			//   http://images.contactmusic.com/newsimages/wenn90807_1_16815_34.jpg -- 403
			newsrc = src.replace(/-cm(\.[^/.]*)$/, "$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nowww === "contactmusic.com") {
			// http://www.contactmusic.com/pics/mn/20180304/040318_oscarawards2018arrivals/oscar-awards-2018-arrivals_6016429.jpg -- watermark
			//   http://www.contactmusic.com/pics/sn/20180304/040318_oscarawards2018arrivals/oscar-awards-2018-arrivals_6016429.jpg -- no watermark
			//   http://www.contactmusic.com/pics/ln/20180304/040318_oscarawards2018arrivals/oscar-awards-2018-arrivals_6016429.jpg -- larger, watermark
			// http://www.contactmusic.com/pics/sn/20130516/160513_cw_upfront_2/kristin-kreuk-2013-cw-upfront-presentation-_3667039.jpg -- no watermark
			// http://www.contactmusic.com/pics/sa/kerrang_arrivals_210808/thirty_seconds_to_mars_with_jared_leto_5177350.jpg -- 110x139, no watermark
			//   http://www.contactmusic.com/pics/la/kerrang_arrivals_210808/thirty_seconds_to_mars_with_jared_leto_5177350.jpg -- 1747x2200, watermark
			// http://www.contactmusic.com/images/feature-images/the-leftovers-s1-justin-theroux-636-380.jpg -- 3888x2592, no watermark
			// http://www.contactmusic.com/pics/s/dwp_pizza_sculptures_071107/a_sculpture_of_pope_benedict_xvi_1652401.jpg -- 110x160, no watermark
			//   http://www.contactmusic.com/pics/l/dwp_pizza_sculptures_071107/a_sculpture_of_pope_benedict_xvi_1652401.jpg -- 2058x3000, watermark
			var retarray = [];

			newsrc = src.replace(/\/pics\/[a-z]([a-z]?\/)/,"/pics/s$1");
			if (newsrc !== src)
				retarray.push({
					url: newsrc,
					problems: {
						smaller: true
					}
				});

			newsrc = src.replace(/\/pics\/[a-z]([a-z]?\/)/,"/pics/l$1");
			if (newsrc !== src)
				retarray.push({
					url: newsrc,
					problems: {
						watermark: true
					}
				});

			if (retarray.length > 0)
				return retarray;
		}

		if (domain === "d15mj6e6qmt1na.cloudfront.net") {
			// https://d15mj6e6qmt1na.cloudfront.net/i/19186419/600/c
			//   https://d15mj6e6qmt1na.cloudfront.net/i/19186419
			return src.replace(/(\/i\/[0-9]*)\/.*/, "$1");
		}

		if (domain === "th.bing.com") {
			// https://th.bing.com/th/id/R[a-f0-9]{32}?rik=[a-zA-Z0-9/]+&riu=http://famousnipple.com/content/2020/08/emma-watson_001-6.jpeg&ehk=[a-zA-Z0-9/+=]+&risl=&pid=ImgRaw
			//   http://famousnipple.com/content/2020/08/emma-watson_001-6.jpeg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+th\/+id\/+R\.?[a-f0-9]{30,}\?(?:.*&)?riu=(http[^&]+).*/, "$1");
			if (newsrc !== src) return decodeuri_ifneeded(newsrc);
		}

		if ((domain_nosub === "bing.net" && domain.match(/tse[0-9]*\.(?:mm|explicit)\.bing\.net/)) ||
			domain_nosub === "bing.com") {
			// http://tse4.mm.bing.net/th?id=OGC.aea12e4c5efc00f2b1e95e6cf2a165e1&pid=1.7&rurl=https%3A%2F%2Fthumbs.gfycat.com%2FYellowTornCockatiel-size_restricted.gif&ehk=YrV%2F46NR4yeQKcnktlbKNA
			//   https://thumbs.gfycat.com/YellowTornCockatiel-size_restricted.gif
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/th[^/]*[?&]rurl=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeURIComponent(newsrc);

			// https://tse1.mm.bing.net/th?id=Ad9e81485410912702a018d5f48ec0f5c&w=136&h=183&c=8&rs=1&qlt=90&pid=3.1&rm=2
			// https://www.bing.com/th?id=OPN.RTNews_jJZmvGD6PzvUt22LbHHUUg&w=186&h=88&c=7&rs=2&qlt=80&cdv=1&pid=News
			newsrc = src.replace(/(:\/\/[^/]*)\/th[^/]*[?&]id=([^&]*)&[^/]*$/, "$1/th?id=$2");
			if (newsrc !== src)
				return newsrc;

			// thanks to DevWannabe-dot on github for reporting: https://github.com/qsniyg/maxurl/issues/916
			// https://th.bing.com/th/id/OIP.kef7amvOdjQCragyEGUiHAHaHa?pid=ImgDet&w=100&h=100&c=7
			//   https://th.bing.com/th/id/OIP.kef7amvOdjQCragyEGUiHAHaHa?pid=ImgDet&c=7
			// https://th.bing.com/th/id/OIP.D4C-i8dfc0T_eveS9Mz2nAHaHg?pid=Api&w=210&h=213
			//   https://th.bing.com/th/id/OIP.D4C-i8dfc0T_eveS9Mz2nAHaHg?pid=Api
			if (/\/th\/+id\//.test(src)) {
				newsrc = remove_queries(src, [ "w", "h", "rs", "qlt" ]);
				if (newsrc !== src)
					return newsrc;
			}
		}

		if (domain === "cdn.4archive.org") {
			// https://cdn.4archive.org/img/t4Drepmm.jpg
			//   https://cdn.4archive.org/img/t4Drepm.jpg
			return src.replace(/(\/img\/[^/.]{7})m(\.[^/.]*)$/, "$1$2");
		}

		if (domain === "i.4cdn.org" ||
			// https://i.4pcdn.org/pol/1495294640794s.jpg
			//   https://i.4pcdn.org/pol/1495294640794.jpg
			domain === "i.4pcdn.org") {
			// http://i.4cdn.org/hr/1517608108705s.jpg
			//   http://i.4cdn.org/hr/1517608108705.jpg
			return fillobj_urls(add_extensions(src.replace(/(\/[0-9]*)s(\.[^/.]*)$/, "$1$2")), {
				headers: {
					Referer: ""
				},
				referer_ok: {
					same_domain_nosub: true
				}
			});
		}

		if (domain === "img.4plebs.org" ||
			// https://img.fireden.net/v/thumb/1470/95/1470959423951s.jpg
			//   https://img.fireden.net/v/image/1470/95/1470959423951.jpg
			// https://img.fireden.net/v/thumb/1473/86/1473865883091s.jpg
			//   https://img.fireden.net/v/image/1462/89/1462892637456.gif
			domain === "img.fireden.net" ||
			// https://img-lb.fireden.net/cm/thumb/1704/66/1704667072520561s.jp
			domain === "img-lb.fireden.net" ||
			// https://torako.wakarimasen.moe/file/torako/mu/thumb/1607/77/1607774036400s.jpg
			//   https://torako.wakarimasen.moe/file/torako/mu/image/1607/77/1607774036400.jpg
			domain === "torako.wakarimasen.moe" ||
			// https://www.thebarchive.com/data/b/thumb/1473/37/1473370176558s.jpg
			//   https://www.thebarchive.com/data/b/image/1473/37/1473370176558.jpg
			domain_nowww === "thebarchive.com" ||
			// https://desu-usergeneratedcontent.xyz/int/thumb/1512/86/1512866510412s.jpg
			//   https://desu-usergeneratedcontent.xyz/int/image/1512/86/1512866510412.png
			// https://cdn2.desu-usergeneratedcontent.xyz/int/thumb/1506/02/1506029481182s.jpg
			//   https://cdn2.desu-usergeneratedcontent.xyz/int/image/1506/02/1506029481182.jpg
			domain_nosub === "desu-usergeneratedcontent.xyz" ||
			// https://archive-media-0.nyafuu.org/w/thumb/1524/41/1524414969310s.jpg
			//   https://archive-media-0.nyafuu.org/w/image/1524/41/1524414969310.jpg
			// https://archive-media-0.nyafuu.org/w/thumb/1490/20/1490207933485s.jpg
			//   https://archive-media-0.nyafuu.org/w/image/1490/20/1490207933485.png
			(domain_nosub === "nyafuu.org" && /^archive-media/.test(domain)) ||
			// https://archiveofsins.com/data/s/thumb/1477/81/1477816195263s.jpg
			//   https://archiveofsins.com/data/s/image/1477/81/1477816195263.jpg
			domain_nowww === "archiveofsins.com") {
			// http://img.4plebs.org/boards/hr/thumb/1526/06/1526064949904s.jpg
			//   http://img.4plebs.org/boards/hr/image/1526/06/1526064949904.jpg
			let baseobj = {};
			if (domain_nowww === "thebarchive.com" ||
				domain_nowww === "archiveofsins.com") {
				baseobj = {
					headers: {
						Referer: "https://" + domain + "/"
					}
				};
			}

			newsrc = src.replace(/\/thumb(\/+[0-9]{4}\/+[0-9]{2}\/+[0-9]+)s(\.[^/.]*)(?:[?#].*)?$/, "/image$1$2");
			if (newsrc !== src)
				return fillobj_urls(add_full_extensions(newsrc), baseobj);

			baseobj.url = src;
			return baseobj;
		}

		if (domain === "arch.b4k.co") {
			// https://arch.b4k.co/files/jp/thumb/1578/68/1578682104565s.jpg
			//   https://i.4cdn.org/jp/1578682104565.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+files\/+([^/]+)\/+thumb\/+[0-9]+\/+[0-9]+\/+([0-9]+s\.[^/.]*)$/, "https://i.4cdn.org/$1/$2");
			if (newsrc !== src)
				return newsrc;

			// thanks to anonymous for reporting:
			// https://arch.b4k.co/media/vp/thumb/1689/98/1689982305216s.jpg
			//   https://arch-img.b4k.co/vp/1689982305216.png
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+media\/+([^/]+)\/+thumb\/+[0-9]+\/+[0-9]+\/+([0-9]+)s(\.[^/.]*)$/, "https://arch-img.b4k.co/$1/$2$3");
			if (newsrc !== src)
				return add_full_extensions(newsrc);
		}

		if (domain === "i.warosu.org") {
			// https://i.warosu.org/data/lit/thumb/0062/33/1425676352426s.jpg
			//   https://i.warosu.org/data/lit/img/0062/33/1425676352426.jpg
			return src.replace(/\/thumb\/([0-9]+\/[0-9]+\/[0-9]+)s?(\.[^/.]*)$/, "/img/$1$2");
		}

		if (domain === "ii.yakuji.moe" ||
			// https://iichan.hk/c/thumb/1483306651580s.jpg
			//   https://iichan.hk/c/src/1483306651580.jpg
			domain_nowww === "iichan.hk" ||
			// https://zip.2chan.net/1/thumb/1577237595290s.jpg
			//   https://zip.2chan.net/1/src/1577237595290.jpg
			domain_nosub === "2chan.net" ||
			// https://kurisa.ch/vg/thumb/152328219583s.jpg
			//   https://kurisa.ch/vg/src/152328219583.jpg
			domain_nowww === "kurisa.ch" ||
			// https://niuchan.org/art/thumb/159009536725s.jpg
			//   https://niuchan.org/art/src/159009536725.jpg
			domain_nowww === "niuchan.org" ||
			// https://nowere.net/a/thumb/1606984270616s.png
			//   https://nowere.net/a/src/1606984270616.jpg
			domain_nowww === "nowere.net" ||
			// https://ponyach.ru/b/thumb/161023129803s.png
			//   https://ponyach.ru/b/src/161023129803.png
			domain_nowww === "ponyach.ru" ||
			// https://02ch.su/a/thumb/151791919151s.jpg
			//   https://02ch.su/a/src/151791919151.jpg
			domain_nowww === "02ch.su" ||
			// http://410chan.org/b/thumb/160771148794s.png
			//   http://410chan.org/b/src/160771148794.png
			domain_nowww === "410chan.org" ||
			// https://desuchan.net/jum/thumb/1594901057230s.png
			//   https://desuchan.net/jum/src/1594901057230.png
			domain_nowww === "desuchan.net" ||
			// http://ernstchan.xyz/int/thumb/1608576566-878s.jpg
			//   http://ernstchan.xyz/int/src/1608576566-878.jpg
			domain_nowww === "ernstchan.xyz" ||
			// thanks to anonymous for reporting:
			// https://neochan.net/mu/thumb/1602874862994-3.jpg
			//   https://neochan.net/mu/src/1602874862994-3.jpg
			domain_nowww === "neochan.net" ||
			// thanks to anonymous for reporting:
			// https://gaia.komica1.org/00b/thumb/1716311461279s.jpg
			//   https://gaia.komica1.org/00b/src/1716311461279.jpg
			domain === "gaia.komica1.org" ||
			// http://aqua.komica.org/60/thumb/1509040275477s.jpg
			//   http://aqua.komica.org/60/src/1509040275477.jpg
			domain === "aqua.komica.org") {
			// http://ii.yakuji.moe/b/thumb/1534110350035s.jpg
			//   http://ii.yakuji.moe/b/src/1534110350035.jpg
			newsrc = src.replace(/\/thumb\/([0-9]{5,}(?:-[0-9]+)?)s?(\.[^/.]*)$/, "/src/$1$2");
			if (newsrc !== src)
				return add_full_extensions(newsrc, ["mp4", "webm", "png", "jpg", "jpeg"]);
		}

		if (domain_nowww === "crystal.cafe" ||
			// https://cdn.syn-ch.com/thumb/148/46/03/1484603772-9cd34.png
			//   https://cdn.syn-ch.com/src/148/46/03/1484603772-9cd34.jpg
			domain === "cdn.syn-ch.com" ||
			// https://cdn.syn-ch.org/thumb/161/03/58/1610358151-ef4fb.png
			//   https://cdn.syn-ch.org/src/161/03/58/1610358151-ef4fb.jpg
			domain === "cdn.syn-ch.org" ||
			// http://alphachan.org/eot/thumb/151908726550.jpg
			//   http://alphachan.org/eot/src/151908726550.jpg
			domain_nowww === "alphachan.org" ||
			// http://zonadelta.net/deltachan/thumb/1494318792278.png
			//   http://zonadelta.net/deltachan/src/1494318792278.png
			(domain_nowww === "zonadelta.net" && string_indexof(src, "/deltachan/") >= 0) ||
			// https://wikieat.club/cel/thumb/1589848210316.png
			//   https://wikieat.club/cel/src/1589848210316.jpg
			// https://wikieat.club/cel/thumb/1596756327267.jpg
			//   https://wikieat.club/cel/src/1596756327267.mp4
			domain_nowww === "wikieat.club" ||
			// https://kropyva.ch/b/thumb/1593965116.54219-.png
			//   https://kropyva.ch/b/src/1593965116.54219-.jpg
			domain_nowww === "kropyva.ch" ||
			// https://lainchan.org/%CE%A9/thumb/1576640799636.png
			//   https://lainchan.org/%CE%A9/src/1576640799636.jpg
			domain_nowww === "lainchan.org" ||
			// https://www.ponychan.net/chat/thumb/1610261411419.jpg
			//   https://www.ponychan.net/chat/src/1610261411419.jpg
			domain_nowww === "ponychan.net" ||
			// https://2-ch.su/a/thumb/1608586528007.jpeg
			//   https://2-ch.su/a/src/1608586528007.jpeg
			domain_nowww === "2-ch.su" ||
			// https://2--ch.ru/wr/thumb/1560554676304.jpeg
			//   https://2--ch.ru/wr/src/1560554676304.jpeg
			domain_nowww === "2--ch.ru" ||
			// https://55chan.org/an/thumb/1610044584287.jpg
			//   https://55chan.org/an/src/1610044584287.jpg
			domain_nowww === "55chan.org" ||
			// thanks to anonymous:
			// https://leftychan.net/hobby/thumb/1616876696039.png
			//   https://leftychan.net/hobby/src/1616876696039.png
			domain_nowww === "leftychan.net" ||
			// thanks to anonymous for reporting:
			// https://anonimageboards.com/a/thumb/1706125797680.png
			//   https://anonimageboards.com/a/src/1706125797680.jpg
			domain_nowww === "anonimageboards.com" ||
			// https://lolcow.farm/ot/thumb/1530053186253.jpg
			//   https://lolcow.farm/ot/src/1530053186253.jpg
			domain_nowww === "lolcow.farm") {
			// https://crystal.cafe/hb/thumb/1497657761080.jpeg
			//   https://crystal.cafe/hb/src/1497657761080.jpeg
			newsrc = src.replace(/\/thumb\//, "/src/");
			if (newsrc !== src)
				return add_full_extensions(newsrc, ["mp4", "webm", "png", "jpg", "jpeg"]);
		}

		if (domain_nowww === "2ch.hk" ||
			// https://2ch.pm/au/thumb/4888055/15596413989340s.jpg
			//   https://2ch.pm/au/src/4888055/15596413989340.jpg
			domain_nowww === "2ch.pm" ||
			// https://2channel.moe/b/thumb/166050/16102639016670s.jpg
			//   https://2channel.moe/b/src/166050/16102639016670.jpg
			domain_nowww === "2channel.moe" ||
			// https://2ch.rip/au/thumb/61/15855092890690s.jpg
			//   https://2ch.rip/au/src/61/15855092890690.jpg
			domain_nowww === "2ch.rip" ||
			// https://dva-ch.net/au/thumb/61/15855092890690s.jpg
			//   https://dva-ch.net/au/src/61/15855092890690.jpg
			domain_nowww === "dva-ch.net" ||
			// http://www.shisharc.com/vg/arch/2017-11-11/thumb/24469242/15101342791610s.jpg
			//   https://www.shisharc.com/vg/arch/2017-11-11/src/24469242/15101342791610.jpg -- doesn't work, but it's what's linked
			// https://www.shisharc.com/rf/thumb/3190059/15376372180120s.jpg
			//   https://www.shisharc.com/rf/src/3190059/15376372180120.png
			domain_nowww === "shisharc.com") {
			// https://2ch.hk/mov/arch/2018-01-11/thumb/1715093/15144001211300s.jpg
			//   https://2ch.hk/mov/arch/2018-01-11/src/1715093/15144001211300.jpg
			// thanks to anonymous for reporting:
			// https://2ch.hk/b/thumb/310946465/17275023228290s.jpg
			//   https://2ch.hk/b/src/310946465/17275023228290.webp
			return add_full_extensions(src.replace(/\/thumb\/([0-9]+\/[0-9]+)s(\.[^/.]*)$/, "/src/$1$2"), ["mp4", "webm", "png", "jpg", "jpeg"]);
		}

		if (domain_nowww === "m2ch.hk") {
			// https://m2ch.hk/cg/big/thumb/1252393/15246051789290s.jpg
			//   https://m2ch.hk/cg/src//1252393/15246051789290.jpg
			return src.replace(/\/big\/thumb(\/[0-9]+\/[0-9]+)s(\.[^/.]*)$/, "/src/$1$2");
		}

		if (domain_nowww === "neochan.ru") {
			// https://neochan.ru/kpop/thumb/1526040603153.jpg
			//   https://s.neochan.ru/kpop/1526040603153.jpg
			// https://neochan.ru/kpop/thumb/1555744119012.png
			//   https://neochan.ru/kpop/src/1555744119012.jpg
			newsrc = src.replace(/:\/\/(?:www\.)?([^/]+\/+[^/]+\/+)thumb\/+/, ":\/\/s.$1");
			if (newsrc !== src) {
				obj = add_extensions_gif(newsrc);

				array_extend(obj, add_extensions_gif(src.replace(/\/thumb\//, "/src/")));
				return obj;
			}
		}

		if (domain_nowww === "soyjak.party") {
			// thanks to anonymous for reporting:
			// https://soyjak.party/soy/thumb/1691384159131.jpg
			//   https://soyjak.party/soy/src/1691384159131.jpg
			return src.replace(/\/thumb\//, "/src/");
		}

		if (domain === "file.tinnhac.com" ||
			domain === "file.tintuckpop.net" ||
			// http://media.bongda.com.vn/resize/455x300/files/hai.phan/2017/03/08/er10-1546.jpg
			domain === "media.bongda.com.vn" ||
			// https://3.404content.com/resize/730x-/1/8C/F7/1206431106501707365/fullsize.jpg
			//   https://3.404content.com/1/8C/F7/1206431106501707365/fullsize.jpg
			domain_nosub === "404content.com" ||
			// https://image.vtcns.com/resize/480x270/files/thuylinh/2018/08/01/selenagomez2225x1498instylephotoshoothot2017hd8852-1052581.jpg
			//   https://image.vtcns.com/files/thuylinh/2018/08/01/selenagomez2225x1498instylephotoshoothot2017hd8852-1052581.jpg
			domain === "image.vtcns.com" ||
			// https://media.cungcau.vn/resize/174x104/files/buithuy/2019/07/09/305-2224.jpg
			//   https://media.cungcau.vn/files/buithuy/2019/07/09/305-2224.jpg
			domain === "media.cungcau.vn" ||
			// thanks to roi
			// https://cdn-storage-tass.cdnvideo.ru/resize/488x326/tass_media/2022/10/08/d/1665231913296714_d3YPJ-3j.jpg
			//   https://cdn-storage-tass.cdnvideo.ru/tass_media/2022/10/08/d/1665231913296714_d3YPJ-3j.jpg
			domain === "cdn-storage-tass.cdnvideo.ru" ||
			// thanks to roi
			// https://cdn-storage-media.tass.ru/resize/488x326/tass_media/2022/10/08/d/1665231913296714_d3YPJ-3j.jpg
			//   https://cdn-storage-media.tass.ru/tass_media/2022/10/08/d/1665231913296714_d3YPJ-3j.jpg
			domain === "cdn-storage-media.tass.ru" ||
			// different though? - and crop doesn't work
			// https://image.vtc.vn/resize/80x60/files/news/2018/02/21/-210540.jpg
			domain === "image.vtc.vn") {
			// https://file.tinnhac.com/crop/97x74/music/2018/02/03/3-e875.jpg
			//   https://file.tinnhac.com/music/2018/02/03/3-e875.jpg
			// https://file.tinnhac.com/resize/600x-/2016/05/25/1eca49c4b-0953.jpg
			//   https://file.tinnhac.com/2016/05/25/1eca49c4b-0953.jpg
			// http://file.tintuckpop.net/resize/640x-/2016/05/16/1a922-1670.jpg
			// http://file.tintuckpop.net/crop/210x158/tintuckpop/2018/02/22/shinminah-1519107250-d126.jpg
			return src
				.replace(/\/crop\/+[-0-9]+x[-0-9]+\//, "/")
				.replace(/\/resize\/+[-0-9]+x[-0-9]+\//, "/");
		}


		if (domain === "cdn-media.tass.ru") {
			// thanks to roi:
			// https://cdn-media.tass.ru/width/1200_4ce85301/tass/m2/uploads/i/20230814/7324491.jpg
			//   https://cdn-media.tass.ru/tass/m2/uploads/i/20230814/7324491.jpg
			return src.replace(/(:\/\/[^/]+\/+)width\/+[0-9]+_[0-9a-f]+\/+/, "$1");
		}

		if ((domain_nosub === "zadn.vn" && domain.match(/^photo-resize-/)) ||
			domain === "org.photo-resize.mp3.zdn.vn") {
			// https://photo-resize-zmp3.zadn.vn/w240h240_jpeg/covers/9/d/9df0d52438b40d91aeaef1c1c2338e92_1476548588.jpg
			//   https://photo-resize-zmp3.zadn.vn/w240h240_jpeg/covers/9/d/9df0d52438b40d91aeaef1c1c2338e92_1476548588.jpg -- gets redirected to:
			//   http://org.photo-resize.mp3.zdn.vn/covers/9/d/9df0d52438b40d91aeaef1c1c2338e92_1476548588.jpg
			newsrc = src.replace(/(:\/\/[^/]*\/+)w[0-9]+h[0-9]+(?:_[a-z]+)?\/+/, "$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "image.mp3.zdn.vn") {
			// http://image.mp3.zdn.vn/thumb/240_240/covers/e/0/e06d061a77a7bde916b8a91163029d41_1341286111.jpg
			//   http://image.mp3.zdn.vn/covers/e/0/e06d061a77a7bde916b8a91163029d41_1341286111.jpg
			return src.replace(/\/thumb\/+[0-9]+_[0-9]+\/+/, "/");
		}

		if (domain_nosub === "zadn.vn" ||
			// https://images.vov.vn/h500/uploaded/wgyyweux2icrb7fgmumzw/2017_05_21/6_LLVB.jpg
			//   https://images.vov.vn/uploaded/wgyyweux2icrb7fgmumzw/2017_05_21/6_LLVB.jpg
			(domain_nosub === "vov.vn" && domain.match(/images?\.(?:[^/.]*\.)?vov\.vn/)) ||
			// https://ss-images.catscdn.vn/w620/2018/06/15/3005641/35380238_1893554624043549_7227395902841815040_n.jpg
			//   https://ss-images.catscdn.vn/2018/06/15/3005641/35380238_1893554624043549_7227395902841815040_n.jpg
			// https://ss-images.catscdn.vn/-x250/2018/08/21/3516394/south-korea-peace-sign-v-sign.jpg
			//   https://ss-images.catscdn.vn/2018/08/21/3516394/south-korea-peace-sign-v-sign.jpg
			// https://ss-images.catscdn.vn/wp600/2018/06/24/3075529/taeyeon-14.jpg
			//   https://ss-images.catscdn.vn/2018/06/24/3075529/taeyeon-14.jpg
			// https://ss-images.catscdn.vn/wpm450/2017/03/02/1128437/2.jpg
			//   https://ss-images.catscdn.vn/2017/03/02/1128437/2.jpg
			domain === "ss-images.catscdn.vn" ||
			// http://img.v3.news.zdn.vn/w660/Uploaded/cqxrcajwp/2014_12_14/t13.jpg
			//   http://img.v3.news.zdn.vn/Uploaded/cqxrcajwp/2014_12_14/t13.jpg
			//domain === "img.v3.news.zdn.vn" ||
			// http://znews-photo.d.za.zdn.vn/w660/Uploaded/xbhunku/2017_01_08/batchston.jpg
			//   http://znews-photo.d.za.zdn.vn/Uploaded/xbhunku/2017_01_08/batchston.jpg
			domain_nosub === "zdn.vn" ||
			// https://media.stylenews.vn/w660/2018/11/22/rihanna-barbados-ambassador-1542884388587820599121.jpg
			//   https://media.stylenews.vn/2018/11/22/rihanna-barbados-ambassador-1542884388587820599121.jpg
			domain === "media.stylenews.vn" ||
			// https://img.vietnamplus.vn/t660/Uploaded/ifysy/2015_02_10/grammy_10.jpg
			//   https://img.vietnamplus.vn/Uploaded/ifysy/2015_02_10/grammy_10.jpg
			domain === "img.vietnamplus.vn" ||
			// https://cdnimg.vietnamplus.vn/t660/Uploaded/ifysv/2014_12_12/x39.jpg
			//   https://cdnimg.vietnamplus.vn/Uploaded/ifysv/2014_12_12/x39.jpg
			domain === "cdnimg.vietnamplus.vn" ||
			// https://image.baonghean.vn/w607/Uploaded/2018/nkdkswkqoc/201602/original/image_7593475.jpg
			//   https://image.baonghean.vn/Uploaded/2018/nkdkswkqoc/201602/original/image_7593475.jpg
			// https://image.baonghean.vn/80x60/Uploaded/2018/ftgbtgazsnzm/2018_09_19/trantieuvy1381crop15372615750611556122614_jlls.jpg
			//   https://image.baonghean.vn/Uploaded/2018/ftgbtgazsnzm/2018_09_19/trantieuvy1381crop15372615750611556122614_jlls.jpg
			// https://image2.baonghean.vn/w607/Uploaded/2018/nkdkswkqoc/201406/original/images997829_fan8_7857_1403158274.jpg
			//   https://image2.baonghean.vn/Uploaded/2018/nkdkswkqoc/201406/original/images997829_fan8_7857_1403158274.jpg
			(domain_nosub === "baonghean.vn" && domain.match(/^image[0-9]*\./)) ||
			// http://image.baophapluat.vn/230x160/Uploaded/2018/hfobdvicbuhvoc/2014_08_14/v_-_bao_phap_luat_zycd.jpg
			//   http://image.baophapluat.vn/Uploaded/2018/hfobdvicbuhvoc/2014_08_14/v_-_bao_phap_luat_zycd.jpg
			domain === "image.baophapluat.vn" ||
			// https://image.giaoducthoidai.vn/Uploaded/tranghn/2014_08_06/v1_ZDNQ.jpg?width=100
			//   https://image.giaoducthoidai.vn/Uploaded/tranghn/2014_08_06/v1_ZDNQ.jpg
			domain === "image.giaoducthoidai.vn" ||
			// http://image.laodong.com.vn/Uploaded/phanthiphuongthuy/2014_06_22/ht4_HDEY.jpg.ashx?width=660
			//   http://image.laodong.com.vn/Uploaded/phanthiphuongthuy/2014_06_22/ht4_HDEY.jpg
			domain === "image.laodong.com.vn" ||
			// https://cdn-images.saostar.vn/wp600/2017/04/10/1210695/exid-teaser2.jpg
			//   https://cdn-images.saostar.vn/2017/04/10/1210695/exid-teaser2.jpg
			domain === "cdn-images.saostar.vn" ||
			// https://image.tienphong.vn/w665/Uploaded/2018/pcgycivo/2016_08_25/5_pyxg.jpg -- stretched
			//   https://image.tienphong.vn/Uploaded/2018/pcgycivo/2016_08_25/5_pyxg.jpg
			// https://image3.tienphong.vn/w665/Uploaded/2018/khunflu/2016_07_03/jessica_alba_braun_beauty_campaign_2016_adds_04_redb.jpg
			//   https://image3.tienphong.vn/Uploaded/2018/khunflu/2016_07_03/jessica_alba_braun_beauty_campaign_2016_adds_04_redb.jpg
			(domain_nosub === "tienphong.vn" && domain.match(/image[0-9]*\.tienphong\.vn/)) ||
			// https://img.infonet.vn/w490/Uploaded/2019/hb_yuqzfdgzs/2017_02_04/thai_kim_dinh.jpg
			//   https://img.infonet.vn/Uploaded/2019/hb_yuqzfdgzs/2017_02_04/thai_kim_dinh.jpg
			// https://img2.infonet.vn/w480/Uploaded/2018/rog/469/t469361.jpg
			//   https://img2.infonet.vn/Uploaded/2018/rog/469/t469361.jpg
			(domain_nosub === "infonet.vn" && /^img[0-9]*/.test(domain)) ||
			// https://img.giaoduc.net.vn/w1050/uploaded/2019/rutmne/2012_11_14/nicole-kidman-giaoduc.net.vn.jpg -- upscaled?
			//   https://img.giaoduc.net.vn/uploaded/2019/rutmne/2012_11_14/nicole-kidman-giaoduc.net.vn.jpg
			domain === "img.giaoduc.net.vn" ||
			domain === "media.laodong.vn") {
			// https://znews-photo-td.zadn.vn/w960/Uploaded/qfssu/2017_11_05/NGT.jpg
			//   https://znews-photo-td.zadn.vn/Uploaded/qfssu/2017_11_05/NGT.jpg
			// http://image.english.vov.vn/w490/uploaded/wzzqbijjvws/2016_02_25/tara_GCLM.jpg
			//   http://image.english.vov.vn/uploaded/wzzqbijjvws/2016_02_25/tara_GCLM.jpg
			// http://image.english.vov.vn/130x82/Uploaded/TmT2B47lHgLy8UZVeuKg/2018_02_04/Xoang_singing_DPVE.jpg
			//   http://image.english.vov.vn/Uploaded/TmT2B47lHgLy8UZVeuKg/2018_02_04/Xoang_singing_DPVE.jpg
			// http://image.english.vov.vn/h500/uploaded/wzzqbijjvws/2016_03_14/tara_2_KUJE.jpg
			//   http://image.english.vov.vn/uploaded/wzzqbijjvws/2016_03_14/tara_2_KUJE.jpg
			// https://baomoi-photo-2-td.zadn.vn/w700_r1m/16/03/13/105/18868393/9_65381.jpg
			//   https://baomoi-photo-2-td.zadn.vn/16/03/13/105/18868393/9_65381.jpg
			// https://baomoi-photo-3.zadn.vn/w460x/17/10/23/94/23663774/11_117795.jpg
			//   https://baomoi-photo-3.zadn.vn/17/10/23/94/23663774/11_117795.jpg
			// https://baomoi-photo-3-td.zadn.vn/w720x480/18/07/13/100/26873675/2_45090.jpeg
			//   https://baomoi-photo-3-td.zadn.vn/18/07/13/100/26873675/2_45090.jpeg
			// https://media.laodong.vn/Uploaded/thuctapsinh/2016_03_13/6_QVZZ.jpg?w=629&h=419&crop=auto&scale=both
			newsrc = src
				.replace(/(:\/\/[^/]*)\/+[wht]p?m?[0-9]+x?(?:_[^/]*)?(?:[0-9]+)?\//, "$1/")
				.replace(/(:\/\/[^/]*)\/+[-0-9]+x[-0-9]+\//, "$1/")
				.replace(/(?:\.ashx)?\?.*$/, "");

			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "cdn.tuoitre.vn" ||
			// https://dantricdn.com/thumb_w/640/487bd2df65/2016/09/24/chipi-1474675645816.jpg
			//   https://dantricdn.com/487bd2df65/2016/09/24/chipi-1474675645816.jpg
			// https://dantricdn.com/zoom/327_245/2018/2/22/img4232-15192810897621333688893.jpg
			//   https://dantricdn.com/thumb_w/600/2018/2/22/img4232-15192810897621333688893.jpg
			//   https://dantricdn.com/2018/2/22/img4232-15192810897621333688893.jpg
			domain_nowww === "dantricdn.com" ||
			// http://afamilycdn.com/thumb_w/660/2017/taf-0942-1509860607829.jpg
			//   http://afamilycdn.com/2017/taf-0942-1509860607829.jpg
			domain_nowww === "afamilycdn.com" ||
			// https://cafebiz.cafebizcdn.vn/thumb_w/600/2016/14593683-10210661710609628-1503569961-n-1475666918244-crop-1475673547715.jpg
			//   https://cafebiz.cafebizcdn.vn/2016/14593683-10210661710609628-1503569961-n-1475666918244-crop-1475673547715.jpg
			//   http://cafebiz.cafebizcdn.vn/2016/14593683-10210661710609628-1503569961-n-1475666918244.jpg
			domain_nosub === "cafebizcdn.vn" ||
			// http://sohanews.sohacdn.com/thumb_w/1000/2017/photo-1-1510035508692-0-57-337-600-crop-1510035607740.jpg
			//   http://sohanews.sohacdn.com/2017/photo-1-1510035508692.jpg
			domain_nosub === "sohacdn.com" ||
			// http://kenh14cdn.com/thumb_w/300/2016/img-6763-1458013125674-25-0-650-1000-crop-1458013471506.jpg
			//   http://kenh14cdn.com/2016/img-6763-1458013125674.jpg
			domain_nosub === "kenh14cdn.com" ||
			// https://cafebiz.cafebizcdn.vn/zoom/420_264/2018/2/22/photo1519268407880-15192684078814005972.jpg
			domain === "cafebiz.cafebizcdn.vn" ||
			// http://afamily1.vcmedia.vn/thumb_w/600/dnPHhBsGbzUbzOL6NIfgilSBRC2AR0/Image/2014/10/Jiyeon-20f88.jpg
			//   http://afamily1.vcmedia.vn/dnPHhBsGbzUbzOL6NIfgilSBRC2AR0/Image/2014/10/Jiyeon-20f88.jpg
			domain_nosub === "vcmedia.vn" ||
			// https://genknews.genkcdn.vn/thumb_w/600/2016/photo-1-1471225578014.jpg
			//   https://genknews.genkcdn.vn/2016/photo-1-1471225578014.jpg
			domain_nosub === "genkcdn.vn" ||
			// https://icdn.dantri.com.vn/thumb_w/640/2018/4/12/selena9-15235036066921137660736.jpg
			//   https://icdn.dantri.com.vn/2018/4/12/selena9-15235036066921137660736.jpg
			domain === "icdn.dantri.com.vn" ||
			// https://vtv1.mediacdn.vn/zoom/93_93/2018/2/22/nauy-crop-1519281533709468961755.jpg
			//   https://vtv1.mediacdn.vn/2018/2/22/nauy.jpg -- doesn't work
			//   https://vtv1.mediacdn.vn/2018/2/22/nauy-crop-1519281533709468961755.jpg
			domain_nosub === "mediacdn.vn") {
			// https://cdn.tuoitre.vn/thumb_w/640/2017/5-nguoi-ham-mo-1509855071319.jpg
			//   https://cdn.tuoitre.vn/2017/5-nguoi-ham-mo-1509855071319.jpg
			return src
				.replace(/\/zoom\/[^/]*\//, "/")
				.replace(/-[0-9]+-[0-9]+-[0-9]+-[0-9]+-crop-[0-9]+(\.[^/.]*)$/, "$1")
				.replace(/-crop-[0-9]{13,}(\.[^/.]*)$/, "$1")
				.replace(/(:\/\/[^/]*)\/thumb_[a-z]\/[0-9]+\//, "$1/");
		}

		if (domain_nosub === "24hstatic.com" ||
			// https://image-us.24h.com.vn/upload/2-2018/images/2018-06-07/medium/nguoi-gay-an-gi-av-1528357320-626-width640height480.jpg
			//   https://image-us.24h.com.vn/upload/2-2018/images/2018-06-07/nguoi-gay-an-gi-av-1528357320-626-width640height480.jpg
			// https://image-us.24h.com.vn/upload/1-2018/images/2018-02-09/1518170617-487-sao--8--1518169128-width650height482_97_125.jpg
			//   https://image-us.24h.com.vn/upload/1-2018/images/2018-02-09/1518170617-487-sao--8--1518169128-width650height482.jpg
			// https://image-us.24h.com.vn/upload/1-2018/images/2018-03-21/1521627412-702-152162041273441-thumbnail-auto-crop-640x335-watermark.jpg
			//   https://image-us.24h.com.vn/upload/1-2018/images/2018-03-21/1521627412-702-152162041273441-thumbnail.jpg
			domain_nosub === "24h.com.vn" ||
			// http://streaming1.danviet.vn/upload/1-2018/images/2018-03-12/miko-matsuda-01-1520847171-width650height650-1520848378-width650height650.jpg
			(domain_nosub === "danviet.vn" && domain.match(/^streaming[0-9]*\./)) ||
			// https://image-us.eva.vn/upload/2-2018/images/2018-06-10/medium/image_dai_dien_gifava-1528642487-944-width640height480.jpg
			//   https://image-us.eva.vn/upload/2-2018/images/2018-06-10/image_dai_dien_gifava-1528642487-944-width640height480.jpg
			(domain_nosub === "eva.vn" && domain.match(/^image(?:-[a-z]+)?\./)) ||
			// http://anh.24h.com.vn//upload/4-2017/images/2017-11-08/medium/1510125598-629-151011694144796-chi-pu-5.jpg
			domain === "anh.eva.vn") {
			// https://eva-img.24hstatic.com/upload/1-2017/images/2017-01-18/large/1484712995-1ava.jpg
			//   https://eva-img.24hstatic.com/upload/1-2017/images/2017-01-18/large/1484712995-1ava.jpg
			// https://eva-img.24hstatic.com/upload/1-2017/images/2017-01-18/san-khau-dem-nhac-bi-chay-t-ara-van-nhiet-tinh-het-minh-vi-khan-gia-1-1484711458-width500height334.jpg
			// https://eva-img.24hstatic.com/upload/4-2017/images/2017-10-15/extra_large/1508037671-thumbnail.jpg
			//   https://eva-img.24hstatic.com/upload/4-2017/images/2017-10-15/1508037671-thumbnail.jpg
			// https://eva-img.24hstatic.com/upload/1-2018/images/2018-02-01/thumbnail/cover1-1517500750-188-width640height480.jpg
			//   https://eva-img.24hstatic.com/upload/1-2018/images/2018-02-01/cover1-1517500750-188-width640height480.jpg
			// https://anh.eva.vn///upload/1-2016/images/2016-03-13/medium/1457807610-ava1.jpg
			if (src.match(/\/upload\/+[0-9]+-[0-9]{4}\/+images\//)) {
				return src
					.replace(/(\/images\/.*)_[0-9]+_[0-9]+(\.[^/.]*)$/, "$1$2")
					.replace(/-watermark(\.[^/.]*)$/, "$1")
					.replace(/-auto-crop-[0-9]+x[0-9]+(\.[^/.]*)$/, "$1")
					.replace(/(\/images\/[0-9]*-[0-9]*-[0-9]*\/)[^/]*\/([^/]*)$/, "$1$2");
			}
		}

		if ((domain_nosub === "yan.vn" && domain.match(/static[0-9]*\.yan\.vn/)) ||
			// https://myzutv.ro/uploads/modules/news/0/2018/3/9/37130/560x400_15205880152019549a.jpg
			//   https://myzutv.ro/uploads/modules/news/0/2018/3/9/37130/15205880152019549a.jpg
			(domain_nowww === "myzutv.ro" && string_indexof(src, "/uploads/") >= 0) ||
			// http://www.rainews.it/dl/img/2018/07/640x360_1531473973863.rainews_20180713112334780.jpg
			//   http://www.rainews.it/dl/img/2018/07/1531473973863.rainews_20180713112334780.jpg
			(domain_nowww === "rainews.it" && string_indexof(src, "/img/") >= 0) ||
			// https://a.jeu.cc/images/jeux/600x372_wedgie-toss.jpg -- upscaled
			//   https://a.jeu.cc/images/jeux/wedgie-toss.jpg
			(domain === "a.jeu.cc" && string_indexof(src, "/images/") >= 0) ||
			// https://www.soyuz.ru/public/uploads/files/22/2435186/740x457_201601140813318f7f7e924d.jpg
			//   https://www.soyuz.ru/public/uploads/files/22/2435186/201601140813318f7f7e924d.jpg
			(domain_nowww === "soyuz.ru" && /\/uploads\/+files\//.test(src)) ||
			// https://www.mjuznews.com/public/photos/1000/236/604x320_236-Wikluh_Sky.jpg
			//   https://www.mjuznews.com/public/photos/1000/236/236-Wikluh_Sky.jpg
			(domain_nowww === "mjuznews.com" && string_indexof(src, "/photos/") >= 0)) {
			// http://static2.yan.vn/YanThumbNews/2167221/201711/260x130_414f9ea4-e35b-4b11-aed5-883b288ea050.jpg
			//   http://static2.yan.vn/YanThumbNews/2167221/201711/414f9ea4-e35b-4b11-aed5-883b288ea050.jpg
			return src.replace(/\/[0-9]+x[0-9]+_([^/]*)$/, "/$1");
		}

		if (domain_nowww === "raiplay.it") {
			// https://www.raiplay.it/cropgd/300x400/dl/img/2021/08/06/1628246462019_1536x2048_logo.jpg
			//   https://www.raiplay.it/dl/img/2021/08/06/1628246462019_1536x2048_logo.jpg
			return src.replace(/\/cropgd\/+[0-9]+x[0-9]+\/+/, "/");
		}

		if (domain_nosub === "autoimg.cn") {
			// https://car2.autoimg.cn/cardfs/product/g30/M01/A3/D2/640x480_autohomecar__wKgHHFs7NY6AUXLiAAj8ddqKSUg436.jpg
			//   https://car2.autoimg.cn/cardfs/product/g30/M01/A3/D2/autohomecar__wKgHHFs7NY6AUXLiAAj8ddqKSUg436.jpg
			// https://www2.autoimg.cn/newsdfs/g27/M03/9C/69/185x104_0_autohomecar__ChcCQF47p-uAAudlAAZydiRS6bY154.jpg
			//   https://www2.autoimg.cn/newsdfs/g27/M03/9C/69/autohomecar__ChcCQF47p-uAAudlAAZydiRS6bY154.jpg
			// https://club2.autoimg.cn/album/g29/M05/9F/DB/userphotos/2020/02/08/17/240180_ChsEfl4-fxaANMwCAAFSlCZ0qHg088.jpg
			//   https://club2.autoimg.cn/album/g29/M05/9F/DB/userphotos/2020/02/08/17/ChsEfl4-fxaANMwCAAFSlCZ0qHg088.jpg
			return src.replace(/\/(?:[0-9]+x[0-9]+_(?:[0-9]+_)?|[0-9]+_)([^/]+)(?:[?#].*)?$/, "/$1");
		}

		if (domain_nowww === "xperienceunited.com") {
			// thanks to fyhtma on github: https://github.com/qsniyg/maxurl/issues/1193
			// https://xperienceunited.com:8080/userphotos/63f20f4cd1ab9a64b2909056-1676823380378-800.webp?0-6406eac4bc4b4c2ad16245c5.webp
			//   https://xperienceunited.com:8080/userphotos/63f20f4cd1ab9a64b2909056-1676823380378.webp?0-6406eac4bc4b4c2ad16245c5.webp
			// https://xperienceunited.com:8080/userphotos/63f20f4cd1ab9a64b2909056-1676823380378-thumbnail?0-6406eac4bc4b4c2ad16245c5.webp
			//   https://xperienceunited.com:8080/userphotos/63f20f4cd1ab9a64b2909056-1676823380378.webp?0-6406eac4bc4b4c2ad16245c5.webp
			return src
				.replace(/(\/userphotos\/+[0-9a-f]+-[0-9]+)-thumbnail([?#].*)?$/, "$1.webp$2")
				.replace(/(\/userphotos\/+[0-9a-f]+-[0-9]+)-[0-9]+\./, "$1.")
		}

		if (domain === "image.thanhnien.vn") {
			// https://image.thanhnien.vn/1600/Uploaded/phangiang/2016_03_12/anh_lfyk.jpg
			//   https://image.thanhnien.vn/Uploaded/phangiang/2016_03_12/anh_lfyk.jpg
			// https://image.thanhnien.vn/Uploaded/phinp/2018_02_19/thumnail-bi-mat-tuan-anh_cms_VOVN.jpg?width=178&height=100&crop=auto&scale=both
			//   https://image.thanhnien.vn/Uploaded/phinp/2018_02_19/thumnail-bi-mat-tuan-anh_cms_VOVN.jpg
			// https://image.thanhnien.vn/c150x100/0,23,0,79/Uploaded/binhhh/2020_01_09/selena_gomez_UURR.jpg
			//   https://image.thanhnien.vn/Uploaded/binhhh/2020_01_09/selena_gomez_UURR.jpg
			return {
				url: src
					.replace(/\?.*/, "")
					.replace(/(:\/\/[^/]*)\/+(?:[0-9]+|c[0-9]+x[0-9]+\/+[0-9]+(?:,[0-9]+){3})\/+(uploaded\/)/i, "$1/$2"),
				can_head: false // hangs?
			};
			//return src.replace(/\/c[0-9]+x[0-9]+\/+[0-9]+(?:,[0-9]+){3}\/+Uploaded\/+/i, "/Uploaded/");
		}

		if (domain === "images2.thanhnien.vn") {
			// thanks to anonymous for reporting:
			// https://images2.thanhnien.vn/zoom/448_280/528068263637045248/2023/8/7/lu-lut-dang-cao-169139109439171578944-135-0-810-1080-crop-16913912630281541368286.jpeg
			//   https://images2.thanhnien.vn/thumb_w/640/528068263637045248/2023/8/7/lu-lut-dang-cao-169139109439171578944.jpeg
			//   https://images2.thanhnien.vn/528068263637045248/2023/8/7/lu-lut-dang-cao-169139109439171578944-135-0-810-1080-crop-16913912630281541368286.jpeg
			//   https://images2.thanhnien.vn/528068263637045248/2023/8/7/lu-lut-dang-cao-169139109439171578944.jpeg
			// https://images2.thanhnien.vn/thumb_w/640/528068263637045248/2023/8/7/lu-lut-dang-cao-169139109439171578944.jpeg
			//   https://images2.thanhnien.vn/528068263637045248/2023/8/7/lu-lut-dang-cao-169139109439171578944.jpeg
			return src
				.replace(/(:\/\/[^/]+\/+[0-9]{5,}\/+[0-9]{4}\/+(?:[0-9]{1,2}\/+){2}[^/.]+?)-(?:[0-9]+-){4}crop-[0-9]+\./, "$1.")
				.replace(/(:\/\/[^/]+\/+)(?:zoom\/+[0-9]+_[0-9]+|thumb_[wh]\/+[0-9]+)\/+/, "$1");
		}

		if (domain === "media-local.phunu365.net" ||
			// http://media-local.mywow.vn/api1x1/res/ext/0x0/r/img.v3.news.zdn.vn/w660/Uploaded/nphpayp/2014_09_11/4.jpg
			//   http://img.v3.news.zdn.vn/w660/Uploaded/nphpayp/2014_09_11/4.jpg
			//   http://img.v3.news.zdn.vn/Uploaded/nphpayp/2014_09_11/4.jpg
			domain === "media-local.mywow.vn") {
			// http://media-local.phunu365.net/api1x1/res/ext/0x0/r/image.24h.com.vn/upload/1-2017/images/2017-01-16/1484562734-148456151330358-dia-1.jpg
			return src.replace(/.*?\/api[0-9]+x[0-9]+\/res\/ext\/[0-9]+x[0-9]+\/[^/]*\//, "http://");
		}

		if ((domain_nosub === "nguoiduatin.vn" && domain.match(/.*media[0-9]*\.nguoiduatin\.vn/)) ||
			// http://media.doisongphapluat.com/thumb_x200x/352/2015/2/9/lady-gaga-grammy-doisongphapluat.jpg
			//   http://media.doisongphapluat.com/352/2015/2/9/lady-gaga-grammy-doisongphapluat.jpg
			domain === "media.doisongphapluat.com" ||
			// http://media.vietq.vn/thumb_x394x263/upload/2017/01/14/chup-anh-gio-ngon-tay-chu-v-co-the-se-bi-hack-van-tay-de-lam-gia8.jpg
			//   http://media.vietq.vn/upload/2017/01/14/chup-anh-gio-ngon-tay-chu-v-co-the-se-bi-hack-van-tay-de-lam-gia8.jpg
			domain === "media.vietq.vn" ||
			// https://baouc.com/thumb_x550x400/upload/thanhxuan/2017/11/13/nhung-cach-giu-cua-can-than-toi-noi-sieu-trom-nhin-xong-cung-thay-chan-han1510543145.jpg
			//   https://baouc.com/upload/thanhxuan/2017/11/13/nhung-cach-giu-cua-can-than-toi-noi-sieu-trom-nhin-xong-cung-thay-chan-han1510543145.jpg
			domain_nowww === "baouc.com" ||
			// https://media.hay.tv/thumb_x108x130//upload/default/star/24122016/photo/got1.jpg
			//   https://media.hay.tv//upload/default/star/24122016/photo/got1.jpg
			domain === "media.hay.tv" ||
			// http://media.hotbirthdays.com/thumb_x200x204/upload/2015/10/27/emilia-clarke.jpg
			//   http://media.hotbirthdays.com/upload/2015/10/27/emilia-clarke.jpg
			domain === "media.hotbirthdays.com") {
			// http://xmedia.nguoiduatin.vn/amp_thumb_x1120x832/ndt/16/03/12/202/18865226/8_288040.jpg
			//   http://xmedia.nguoiduatin.vn/ndt/16/03/12/202/18865226/8_288040.jpg
			// http://media1.nguoiduatin.vn/thumb_x680x354/media/le-nham-than/2018/02/04/hoa.png
			//   http://media1.nguoiduatin.vn/media/le-nham-than/2018/02/04/hoa.png
			return src.replace(/(:\/\/[^/]*)\/[^/]*x[0-9]+x(?:[0-9]+)?\//, "$1/");
		}

		if (domain_nowww === "wowkorea.live" ||
			// http://fotofap.net/img/1541304288/1_m.jpg
			//   http://fotofap.net/img/1541304288/1.jpg
			(domain_nowww === "fotofap.net" && string_indexof(src, "/img/") >= 0) ||
			// http://images.vfl.ru/ii/1517170346/e739011e/20348673_s.jpg
			//   http://images.vfl.ru/ii/1517170346/e739011e/20348673.jpg
			domain === "images.vfl.ru") {
			// http://www.wowkorea.live/img/album/8/42081/76033_m.jpg
			//   http://wowkorea.live/img/album/8/42081/76033.jpg
			return src.replace(/(\/[0-9]*)_[a-z](\.[^/.]*)$/, "$1$2");
		}

		if (domain === "content.erooups.com") {
			// http://content.erooups.com/img3/20141213/37/wonderful_blonde_girl_in_purple_-_bree_daniels_2_m.jpg?1422153720
			//   http://content.erooups.com/img3/20141213/37/wonderful_blonde_girl_in_purple_-_bree_daniels_2.jpg?1422153720
			// http://content.erooups.com/img4/20201013/8/sensual_diana_is_masturbating_on_the_sofa_thumb.jpg?1603266840
			return src.replace(/(\/img[0-9]*\/+[0-9]{8}\/+[0-9]+\/+[^/]*)_(?:m|thumb)(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nosub === "seoul.co.kr" && domain.match(/img[^.]*\.seoul\.co\.kr/)) {
			// http://img.seoul.co.kr/img/upload/2018/02/04/SSI_20180204221012_V.jpg
			//   http://img.seoul.co.kr/img/upload/2018/02/04/SSI_20180204221012.jpg
			// none, O, V, L, S, N, N2, N3, N4, N5
			// http://img.seoul.co.kr//img/upload/2017/02/20/SSI_20170220101030_V.jpg
			//   http://img.seoul.co.kr//img/upload/2017/02/20/SSI_20170220101030.jpg
			// (V, none), O, L, S, N,...
			// http://imgnn.seoul.co.kr/img//upload/2009/01/20/SSI_20090120114407_V.jpg
			//
			// http://img.seoul.co.kr/img/upload/2015/12/29/SSI_20151229090141_V.jpg
			//   http://img.seoul.co.kr/img/upload/2015/12/29/SSI_20151229090141.jpg - 2500x3235
			return src.replace(/_[A-Z](?:[0-9]){0,2}(\.[^/.]*)$/, "$1");
		}

		if (domain === "img.yonhapnews.co.kr" ||
			// http://vmg.yonhapnews.co.kr/etc/inner/KR/2015/08/20/AKR20150820090700005_01_i_P4.jpg
			domain === "vmg.yonhapnews.co.kr" ||
			// https://img2.yna.co.kr/etc/inner/KR/2018/12/07/AKR20181207074000005_01_i_P2.jpg
			//   https://img2.yna.co.kr/etc/inner/KR/2018/12/07/AKR20181207074000005_01_i.jpg -- no difference
			// https://img1.yna.co.kr/etc/inner/JP/2019/02/19/AJP20190219001100882_02_i_T2.jpg
			//   https://img1.yna.co.kr/etc/inner/JP/2019/02/19/AJP20190219001100882_02_i.jpg
			// https://img.yna.co.kr/etc/inner/CK/2019/02/19/ACK20190219001100881_01_i_P2.jpg
			//   https://img.yna.co.kr/etc/inner/CK/2019/02/19/ACK20190219001100881_01_i.jpg
			(domain_nosub === "yna.co.kr" && domain.match(/^img[0-9]*\./))) {
			// http://img.yonhapnews.co.kr/photo/yna/YH/2017/12/30/PYH2017123017200001300_P1.jpg
			//   http://img.yonhapnews.co.kr/photo/yna/YH/2017/12/30/PYH2017123017200001300_P4.jpg
			// https://img5.yna.co.kr/etc/inner/EN/2018/12/31/AEN20181231122400315_04_i_P4.jpg
			//   https://img5.yna.co.kr/etc/inner/EN/2018/12/31/AEN20181231122400315_04_i.jpg
			// http://img.yonhapnews.co.kr/etc/graphic/YH/2017/10/25/GYH2017102500160004400.jpg
			// http://img.yonhapnews.co.kr/etc/inner/EN/2018/02/19/AEN20180219010000315_02_i.jpg
			// http://img.yonhapnews.co.kr/etc/graphic/YH/2013/11/28/GYH2013112800040003900_P2.jpg
			// http://img.yonhapnews.co.kr/etc/inner/KR/2017/04/28/AKR20170428061900017_01_i.jpg
			// http://img.yonhapnews.co.kr/mpic/YH/2018/02/23/MYH20180223017200038.jpg (1920x1080)
			// http://img.yonhapnews.co.kr/etc/inner/KR/2016/11/03/AKR20161103119100061_01_i.jpg (3810x2704)
			// returns 400 even if it exists
			var extra = {};

			match = src.match(/\/(PYH[0-9]{17})[0-9]{2}[_.][^/]*(?:[?#].*)?$/);
			if (match) {
				extra.page = "https://www.yna.co.kr/view/" + match[1];
			}

			return {
				url: src
					.replace(/(\/PYH[^/_.]*)_[^/.]*(\.[^/.]*)$/, "$1_P4$2")
					.replace(/(\/A(?:KR|JP|CK|EN)[^/_.]*_[0-9]+_i)_[^/.]*(\.[^/.]*)$/, "$1$2"),
				can_head: false, // 400
				extra: extra
			};
		}

		if (domain_nosub === "yonhapnews.co.kr" && domain.match(/big[0-9]*\.yonhapnews\.co\.kr/)) {
			// http://big5.yonhapnews.co.kr:83/gate/big5/img.yonhapnews.co.kr/basic/template/ck/2018/02/09/tmp_4504_20180209103744.jpg
			//   http://img.yonhapnews.co.kr/basic/template/ck/2018/02/09/tmp_4504_20180209103744.jpg
			return src.replace(/.*:\/\/[^/]*\/gate\/[^/]*\//, "http://");
		}

		if (domain_nosub === "bunjang.net") {
			// http://seoul-p-studio.bunjang.net/product/64557873_1_1514396938_w320.jpg
			//   http://seoul-p-studio.bunjang.net/product/64557873_1_1514396938.jpg
			return {
				url: src.replace(/_[wh][0-9]*(\.[^/.]*)$/, "$1"),
				can_head: false // 404
			};
		}

		if (domain === "betanews.heraldcorp.com" ||
			domain_nowww === "betanews.net") {
			// http://betanews.heraldcorp.com:8080/imagedb/thumb/2017/0821/acc59960.jpg
			//   http://betanews.heraldcorp.com:8080/imagedb/orig/2017/0821/acc59960.jpg
			// http://www.betanews.net/imagedb/first/2018/0204/d37686d0.jpg
			//   http://betanews.net/imagedb/orig/2018/0204/d37686d0.jpg
			// http://www.betanews.net/imagedb/main/thumb/805/805660.jpg
			//   http://www.betanews.net/imagedb/main/orig/805/805660.jpg
			return src
				.replace(/(\/imagedb\/(:?[^/]*\/)?)(?:first|thumb)\//, "$1orig/");
		}

		if (domain === "img.smlounge.co.kr") {
			// http://img.smlounge.co.kr/upload/grazia/article/201611/thumb/32609-190630-sampleM.jpg
			//   http://img.smlounge.co.kr/upload/grazia/article/201611/32609-190630.jpg
			// http://www.smlounge.co.kr/upload/grazia/article/201801/thumb/37419-279467-sample.jpg
			//   http://img.smlounge.co.kr/upload/grazia/article/201801/37419-279467.jpg
			return src.replace(/\/thumb\/([^/.]*)-sample[^/.-]*(\.[^/.]*)$/, "/$1$2");
		}

		if (false && domain === "img.etoday.co.kr") {
			// wip
			// http://www.etoday.co.kr/news/section/newsview_photo.php?idxno=1315836&seq=1
			// http://img.etoday.co.kr/pto_db/2016/04/20160412091428_851269_450_691.jpg (450x691)
			// http://img.etoday.co.kr/html/lib_img_crop.php?id=851269&mw=300&mh=225 (doesn't go up to 691, stretches)
			// http://img.etoday.co.kr/html/lib_img_mxwidth.php?idxno=1220670&maxw=530
		}

		if (domain === "img.etoday.co.kr") {
			// http://img.etoday.co.kr/pto_db/2013/04/600/20130425103458_292642_1800_3052.jpg
			//   http://img.etoday.co.kr/pto_db/2013/04/20130425103458_292642_1800_3052.jpg
			return src.replace(/(\/pto_db\/+[0-9]{4}\/+[0-9]{2}\/+)[0-9]+\/+([0-9]+_[0-9]+[^/]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain === "image.tving.com" &&
			string_indexof(src, "tving.com/resize.php") >= 0) {
			// http://image.tving.com/resize.php?u=http://image.tving.com/upload/smr/clip/2018/02/04/C01_150548_0405.jpg&w=228
			return src.replace(/.*:\/\/[^/]*\/resize\.php.*?[?&]u=([^&]*).*/, "$1");
		}

		// thanks to fireattack on discord for the link
		// https://www.movabletype.jp/documentation/appendices/config-directives/assetcachedir.html
		if (domain === "cdn.pastemagazine.com") {
			// https://cdn.pastemagazine.com/www/articles/assets_c/2015/02/skyrim%20mod%206-thumb-500x281-138387.jpg
			//   https://cdn.pastemagazine.com/www/articles/skyrim%20mod%206.jpg
			// https://cdn.pastemagazine.com/www/system/images/photo_albums/robin-williams/medium/14-williams-deadagain.jpg?1384968217
			//   https://cdn.pastemagazine.com/www/system/images/photo_albums/robin-williams/original/14-williams-deadagain.jpg?1384968217
			return src
				.replace(/(\/[^/]*\/)assets_[^/]*\/[0-9]*\/[0-9]*\/([^-]*)-.*(\.[^/.]*)$/, "$1$2$3")
				.replace(/(\/www\/+system\/+images\/+.*\/)[a-z]+\/+([^/]*)(?:[?#].*)?$/, "$1original/$2");
		}

		if (domain_nowww === "beauty-co.jp") {
			// https://www.beauty-co.jp/news/assets_c/2018/02/180228_lucy_01-thumb-142xauto-21539.jpg
			//   https://www.beauty-co.jp/news/img/180228_lucy_01.jpg
			return src.replace(/\/news\/+assets_[^/]*\/+[0-9]{4}\/+[0-9]{2}\/+([^-]*)-.*(\.[^/.]*)$/, "/news/img/$1$2");
		}

		if (domain_nowww === "seichimap.jp") {
			// https://seichimap.jp/contents/assets_c/2015/08/P8150066-thumb-400xauto-539.jpg
			//   https://seichimap.jp/contents/pht/P8150066.JPG
			newsrc = src.replace(/(\/[^/]*\/)assets_[^/]*\/+[0-9]{4}\/+[0-9]{2}\/+([^-]*)-.*(\.[^/.]*)$/, "$1pht/$2$3");
			if (newsrc !== src) {
				return add_extensions_upper(newsrc);
			}
		}

		if (domain === "community.pia.jp") {
			// thanks to fireattack on discord:
			// http://community.pia.jp/stage_pia/assets_c/2023/10/f1c186063ebf744104f7bc4db633ba0bcde8c0d0-thumb-350xauto-34273.jpg
			//   http://community.pia.jp/stage_pia/img/f1c186063ebf744104f7bc4db633ba0bcde8c0d0.jpg
			return src.replace(/(\/stage_pia)\/+assets_[^/]*\/+[0-9]{4}\/+[0-9]{2}\/+([^-/]*)-.*(\.[^/.]*)$/, "$1/img/$2$3");
		}

		if (domain === "lp.p.pia.jp") {
			// thanks to fireattack on discord:
			// https://lp.p.pia.jp/shared/materials/c1cbec6b-4af1-4a2e-a0af-6947bb586a24/thumbnail
			//   https://lp.p.pia.jp/shared/materials/c1cbec6b-4af1-4a2e-a0af-6947bb586a24/origin.jpg
			return src.replace(/(\/shared\/+materials\/+[-0-9a-f]{10,}\/+)thumbnail(?:[?#].*)?$/, "$1origin.jpg");
		}

		if (domain === "cdn.fashionsnap.com" ||
			// thanks to fireattack on discord for reporting
			// https://www.fashionsnap.com/collection/assets_c/2017/09/helpern-18ss_001-thumb-440xauto-748590.jpg
			//   https://res.fashionsnap.com/image/upload/media2/2017/09/helpern-18ss_001.jpg
			domain_nowww === "fashionsnap.com") {
			// https://cdn.fashionsnap.com/collection/assets_c/2017/09/helpern-18ss_001-thumb-440xauto-748590.jpg
			//   https://res.fashionsnap.com/image/upload/media2/2017/09/helpern-18ss_001.jpg
			return src.replace(/:\/\/[^/]*\/collection\/+assets_c\/+([0-9]{4}\/+[0-9]{2}\/+[^/]*)-thumb-[auto0-9]+x[auto0-9]+-[0-9]+(\.[^/.]*)(?:[?#].*)?$/,
							   "://res.fashionsnap.com/image/upload/media2/$1$2");
		}

		if (domain_nowww === "joqr.co.jp") {
			// thanks to fireattack on discord
			// http://www.joqr.co.jp/agson/assets_c/2018/06/IMG_0278%20%282%29-thumb-400xauto-23830.jpg
			//   http://www.joqr.co.jp/agson/IMG_0278%20%282%29.JPG
			newsrc = src.replace(/(:\/\/[^/]*\/agson\/+)assets_c\/+[0-9]{4}\/+[0-9]{2}\/+([^/]*)-thumb-[auto0-9]+x[auto0-9]+-[0-9]+(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2$3");
			if (newsrc !== src)
				return add_extensions_upper(newsrc);
		}

		if (domain === "sportiva.shueisha.co.jp") {
			// thanks to nimbuz on discord for reporting:
			// https://sportiva.shueisha.co.jp/contents/entertainment/2021/assets_c/2021/10/_49T2995-thumb-autox825-259378.jpg
			//   https://sportiva.shueisha.co.jp/contents/entertainment/2021/images/_49T2995.jpg
			// https://sportiva.shueisha.co.jp/contents/entertainment/2021/assets_c/2021/10/_49T2995_1-thumb-160xauto-259382.jpg
			//   https://sportiva.shueisha.co.jp/contents/entertainment/2021/images/_49T2995_1.jpg
			return src.replace(/(:\/\/[^/]+\/+contents\/+entertainment\/+[0-9]{4}\/+)assets_c\/+[0-9]{4}\/+[0-9]{2}\/+([^/]*)-thumb-[auto0-9]+x[auto0-9]+-[0-9]+(\.[^/.]*)(?:[?#].*)?$/,
				"$1images/$2$3");
		}

		if (domain_nowww === "rooftop1976.com") {
			// thanks to nimbuz on discord: https://github.com/qsniyg/maxurl/issues/935
			// https://rooftop1976.com/news/assets_c/2021/11/1127event_2-thumb-autox600-225620.jpg
			//   https://rooftop1976.com/news/1127event_2.jpg
			// https://rooftop1976.com/news/assets_c/2021/11/1127event_3_s-thumb-autox627-225616.jpg
			//   https://rooftop1976.com/news/1127event_3_s.jpg
			// https://rooftop1976.com/news/assets_c/2021/11/1127event_1-thumb-autox600-225622.jpg
			//   https://rooftop1976.com/news/1127event_1.jpg
			// https://rooftop1976.com/news/assets_c/2021/11/motn_1-thumb-600xauto-225624.jpg
			//   https://rooftop1976.com/news/motn_1.jpg
			return src.replace(/(\/news)\/+assets_[^/]*\/+[0-9]{4}\/+[0-9]{2}\/+([^-/]*)-.*(\.[^/.]*)$/, "$1/$2$3");
		}

		if (domain_nowww === "agencyteo.com") {
			// http://www.agencyteo.com/news/download/28302/w/600/KakaoTalk_20161121_144905918.jpg
			//   http://www.agencyteo.com/news/download/28302/KakaoTalk_20161121_144905918.jpg
			// http://www.agencyteo.com/news/download/48614/w/600/735318-800w.jpg
			//   http://www.agencyteo.com/news/download/48614/735318.jpg
			return src
				.replace(/-[0-9]*[wh]*(\.[^/.]*)$/, "$1")
				.replace(/(\/download\/[0-9]*\/)[wh]\/[0-9]*\//, "$1");
		}

		if (domain_nosub === "riotpixels.net" && domain.match(/s[0-9]*\.riotpixels\.net/)) {
			// http://s01.riotpixels.net/data/37/29/3729e0a0-9e4c-4efa-9eb2-f89f17dde8fa.jpg.240p.jpg
			// http://s01.riotpixels.net/data/37/29/3729e0a0-9e4c-4efa-9eb2-f89f17dde8fa.jpg/screenshot.assassins-creed-origins.1920x1080.2017-11-25.87.jpg
			//   http://s01.riotpixels.net/data/37/29/3729e0a0-9e4c-4efa-9eb2-f89f17dde8fa.jpg
			// http://s01.riotpixels.net/data/b5/d0/b5d0cf29-9c4e-44f1-a2f4-1a5613453006.jpg.240p.jpg
			return src.replace(/(\/data\/[a-f0-9]*\/[a-f0-9]*\/[^./]*\.[^/.]*)[./].*$/, "$1");
		}

		if ((domain_nosub === "ignimgs.com" ||
			 domain_nosub === "ign.com") &&
			(domain.match(/^assets[0-9]*(?:-prd)?\./) ||
			 // http://moviesmedia.ign.com/movies/image/article/996/996170/transformers-revenge-of-the-fallen-20090618000150436_640w.jpg
			 //   http://moviesmedia.ign.com/movies/image/article/996/996170/transformers-revenge-of-the-fallen-20090618000150436.jpg
			 // https://ps3media.ign.com/ps3/image/object/114/114861/Saints-Row-2-Greatest-Hits_US_ESRB_PS3.jpg?width=188
			 //   https://ps3media.ign.com/ps3/image/object/114/114861/Saints-Row-2-Greatest-Hits_US_ESRB_PS3.jpg
			 // doesn't work for all:
			 // http://media.ign.com/games/image/object/143/14304363/Saints-Row-2_LOGOboxart_160w.jpg
			 //   http://media.ign.com/games/image/object/143/14304363/Saints-Row-2_LOGOboxart.jpg -- doesn't work
			 domain.match(/^[^.]*media\./))) {
			// http://assets1.ignimgs.com/2018/02/02/ac-origins-the-hidden-ones---button-1517533272073_180h.jpg
			//   http://assets1.ignimgs.com/2018/02/02/ac-origins-the-hidden-ones---button-1517533272073.jpg
			// http://assets1.ignimgs.com/2018/02/06/nightinthewoods-deck-ff6c25-1517944777381_358w.jpg
			//   http://assets1.ignimgs.com/2018/02/06/nightinthewoods-deck-ff6c25-1517944777381.jpg
			// http://assets1.ignimgs.com/2017/05/09/1-1-1494366320371_grande.jpg
			//   http://assets1.ignimgs.com/2017/05/09/1-1-1494366320371.jpg
			// https://assets.ign.com/thumbs/userUploaded/2014/9/19/20823568_fatalframewiiu_tgs2014trailer_ign-1411150047803_medium.jpg
			// https://assets1.ignimgs.com/thumbs/userUploaded/2019/6/9/ignnow060919-cyberpunkblogroll-1560126294042.jpg?fit=bounds&dpr=1&quality=75&crop=16%3A9&width=300&format=pjpg
			//   https://assets1.ignimgs.com/thumbs/userUploaded/2019/6/9/ignnow060919-cyberpunkblogroll-1560126294042.jpg
			// https://assets-prd.ignimgs.com/2020/03/04/ign-screen-ghostrunner-8-1583357455265.png?width=158&crop=16%3A9
			//   https://assets-prd.ignimgs.com/2020/03/04/ign-screen-ghostrunner-8-1583357455265.png
			//return src.replace(/_[0-9]*[wh](\.[^/.]*)$/, "$1");
			newsrc = src.replace(/[?#].*$/, "");
			if (newsrc !== src)
				return newsrc;

			return src.replace(/_(?:[0-9]+[hw]|medium|grande)(\.[^/.]*)$/, "$1");
		}

		if (domain === "i.neoseeker.com" &&
			src.match(/\/size\/[0-9]+x[0-9]+\//)) {
			// https://i.neoseeker.com/size/166x85/1/n/1/1500662379_dbz_disc_display.jpg
			//   https://i.neoseeker.com/size/0x0/1/n/1/1500662379_dbz_disc_display.jpg
			return src.replace(/\/size\/[0-9]+x[0-9]+\//, "/size/0x0/");
		}

		if (domain === "i.neoseeker.com" &&
			src.match(/\/p\/[0-9]*\/[0-9]*\//)) {
			// https://i.neoseeker.com/p/206/46/dragon-ball-fighterz_thumb_pOUTR.jpg
			//   https://i.neoseeker.com/screenshots/MjA2LzQ2Lw==/dragon-ball-fighterz_image_pOUTR.jpg
			//   https://i.neoseeker.com/p/206/46/dragon-ball-fighterz_image_pOUTR.jpg
			return src.replace(/_thumb_([^/]*$)/, "_image_$1");
		}

		if (domain === "resource.supercheats.com") {
			// https://resource.supercheats.com/library/640w/ember/emb_intro.jpg
			//   https://resource.supercheats.com/library/ember/emb_intro.jpg
			// https://resource.supercheats.com/library/thumbs/2018/1515877801dlc.png
			//   https://resource.supercheats.com/library/2018/1515877801dlc.png
			return src.replace(/\/library\/(?:(?:[0-9]*[wh])|thumbs)\//, "/library/");
		}

		if (amazon_container === "intergi-phoenix") {
			// https://intergi-phoenix.s3.amazonaws.com/1021319/videos/5450791/images/thumb_large_Cod-WWII-dlc.jpg
			//   https://intergi-phoenix.s3.amazonaws.com/1021319/videos/5450791/images/Cod-WWII-dlc.jpg
			return src.replace(/\/images\/thumb_large_([^/]*)$/, "/images/$1");
		}

		if (domain_nowww === "primagames.com" ||
			// https://www.rockpapershotgun.com/images/16/jun/mirrorsedgecatalyst3.jpg/RPSS/resize/760x-1/format/jpg/quality/90
			//   https://www.rockpapershotgun.com/images/16/jun/mirrorsedgecatalyst3.jpg
			// thanks to Liz on discord:
			// https://assets2.rockpapershotgun.com/days-gone-quality-settings-very-high.jpg/BROK/resize/1920x1920%3E/format/jpg/quality/80/days-gone-quality-settings-very-high.jpg
			//   https://assets2.rockpapershotgun.com/days-gone-quality-settings-very-high.jpg
			domain_nosub === "rockpapershotgun.com" ||
			// https://assets.cosplaycentral.com/doctor-strange-lookalike.jpg/BROK/resize/720%3E/format/jpg/quality/80/doctor-strange-lookalike.jpg
			//   https://assets.cosplaycentral.com/doctor-strange-lookalike.jpg
			domain === "assets.cosplaycentral.com" ||
			// http://images.eurogamer.net/2015/articles//a/1/8/3/4/8/3/6/Fri_Jun_3_11_42_35_UTC2B0100_2016.png/EG11/resize/600x-1/quality/80/format/jpg
			//   http://images.eurogamer.net/2015/articles//a/1/8/3/4/8/3/6/Fri_Jun_3_11_42_35_UTC2B0100_2016.png
			domain === "images.eurogamer.net" ||
			// https://assets.rockpapershotgun.com/images/2018/09/acship.jpg/RPSS/resize/760x-1/format/jpg/quality/70
			//   https://assets.rockpapershotgun.com/images/2018/09/acship.jpg
			domain === "assets.rockpapershotgun.com") {
			// https://www.primagames.com/media/images/news/Playdead-Inside-ResearchFacility-40.jpg/PRIMA/resize/100x/format/jpg
			// https://www.primagames.com/media/files/news/dragon-age-inquisition-landing-page/dragon-age-inquisition-cover-ce.png/PRIMAP/resize/618x/format/jpg/quality/80 -- scaled up
			//   https://www.primagames.com/media/files/news/dragon-age-inquisition-landing-page/dragon-age-inquisition-cover-ce.png
			//return src.replace(/\/PRIMAP?\/.*/, "");
			return src.replace(/(\/[^/]*\.[^/.]*)\/[A-Z0-9]+\/(?:resize|format|crop|quality)?\/.*$/, "$1");
		}

		if (amazon_container === "assets.primagames.com") {
			// https://s3.amazonaws.com/assets.primagames.com/_resized/images/news/Playdead-Inside-ResearchFacility-40.jpg_100x0_.jpg
			//   https://s3.amazonaws.com/assets.primagames.com/images/news/Playdead-Inside-ResearchFacility-40.jpg
			return src.replace(/\/_resized\/+(images\/.*\.[^/._?#]+)_[0-9]+x[0-9]+_\.[^/.]+(?:[?#].*)?$/, "/$1");
		}

		if ((domain_nosub === "ixquick.com" ||
			 domain_nosub === "startpage.com") &&
			domain.match(/s[0-9]*-[^.]*\./)) {
			// https://s15-us2.ixquick.com/cgi-bin/serveimage?url=http%3A%2F%2Ft0.gstatic.com%2Fimages%3Fq%3Dtbn%3AANd9GcQybc24UPrYyg-TnWPRUYH7zgzbQXgL4P86ngojIWv8J-Fzom7dAA&sp=ea6bc994daf22079cacb1e62879fa8d4&anticache=581224
			//   http://t0.gstatic.com/images?q=tbn:ANd9GcQybc24UPrYyg-TnWPRUYH7zgzbQXgL4P86ngojIWv8J-Fzom7dAA
			// https://s16-us2.startpage.com/cgi-bin/serveimage?url=https%3A%2F%2Fshop.r10s.jp%2Fcandy%2Fcabinet%2Fcrossmoll%2Fs3%2F3140-thum10n.jpg&sp=da601974efae2ac4b74ed8d2f7727366
			//   https://shop.r10s.jp/candy/cabinet/crossmoll/s3/3140-thum10n.jpg
			// https://s17-us2.startpage.com/cgi-bin/serveimage?url=https%3A%2F%2Fpbs.twimg.com%2Fmedia%2FDqzGRf3UwAAI1dG.jpg&sp=2c361f2da4eb784198142d2423391c87
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+cgi-bin\/+serveimage.*?[?&]url=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeURIComponent(newsrc);
			//return decodeURIComponent(src.replace(/.*\/serveimage.*?[?&]url=([^&]*).*/, "$1"));
		}

		if (domain_nowww === "startpage.com") {
			// https://www.startpage.com/av/proxy-image?piurl=http%3A%2F%2Fstatic-fhg.met-art.com%2Fmedia%2F595A60F2826F4B4445659F8AB347DBA3%2Fw_53476867D0B958B499A9CB1AC895C5EF.jpg&sp=1593165866T87208020d8c7ffd8a198d93868ada980660b66f33ca96502713b2b5500da9f75
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+av\/+proxy-image\?(?:.*&)?piurl=([^&]+).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (host_domain_nowww === "startpage.com" && /\/sp\/+search/.test(options.host_url) && options.element) {
			if (options.element.parentElement && options.element.parentElement.tagName === "DIV") {
				if (options.element.parentElement.classList.contains("image-container")) {
					var imgurl = options.element.parentElement.getAttribute("data-img-click-url");
					if (imgurl !== src)
						return imgurl;
				}
			}
		}

		if (domain === "beta.ems.ladbiblegroup.com") {
			// http://beta.ems.ladbiblegroup.com/s3/content/353x199/0b7434735a7a95090e0210baf66f63ed.png
			//   http://beta.ems.ladbiblegroup.com/s3/content/0b7434735a7a95090e0210baf66f63ed.png
			return src.replace(/\/s3\/content\/[0-9]+x[0-9]+\//, "/s3/content/");
		}

		if (domain === "gaia.adage.com") {
			// http://gaia.adage.com/images/bin/image/x-large/GettyImages90319988832.jpg?1515686676
			//   http://gaia.adage.com/images/bin/image/GettyImages90319988832.jpg?1515686676
			// http://gaia.adage.com/images/bin/image/medium/Bud-Light-Super-Bowl-2018---Bud-Knight.jpg?1517433099
			//   http://gaia.adage.com/images/bin/image/Bud-Light-Super-Bowl-2018---Bud-Knight.jpg?1517433099
			return src.replace(/\/images\/bin\/image\/[^/]*\//, "/images/bin/image/");
		}

		if (domain === "t-eska.cdn.smcloud.net") {
			// http://t-eska.cdn.smcloud.net/hotplota/t/2/t/image/98343cf69b8e6bfcd82fd21c1573c5b4IMU2KOV8-en-0.jpg/ru-0-r-600,600-n-98343cf69b8e6bfcd82fd21c1573c5b4IMU2KOV8en0.jpg
			//   http://t-eska.cdn.smcloud.net/hotplota/t/2/t/image/98343cf69b8e6bfcd82fd21c1573c5b4IMU2KOV8-en-0.jpg/n-98343cf69b8e6bfcd82fd21c1573c5b4IMU2KOV8en0.jpg
			// http://t-eska.cdn.smcloud.net/hotplota/t/2/t/image/adc18921067ea9ca27d451b35ac4b964a2tUvABZ-prze.PNG/ru-0-ra-280,255-n-adc18921067ea9ca27d451b35ac4b964a2tUvABZprze.PNG
			//   http://t-eska.cdn.smcloud.net/hotplota/t/2/t/image/adc18921067ea9ca27d451b35ac4b964a2tUvABZ-prze.PNG/n-adc18921067ea9ca27d451b35ac4b964a2tUvABZprze.PNG
			return src.replace(/\/[^/]*?n-([^/]*)$/, "/n-$1");
		}

		if (domain === "cdn.wegow.com") {
			// https://cdn.wegow.com/media/artist-media/bad-gyal/bad-gyal-4132.-1x2560.jpg - stretched
			//   https://cdn.wegow.com/media/artist-media/bad-gyal/bad-gyal-4132.jpg
			return src.replace(/\.[-0-9]*x[-0-9]*(\.[^/.]*)$/, "$1");
		}

		if (domain_nowww === "ecestaticos.com") {
			// https://www.ecestaticos.com/image/clipping/330/74d2adf4c3ccfa3144086c71e16eabf3/alba-farelo-es-bad-gyal-una-de-las-mujeres-que-lidera-el-dancehall-espanol-gerard-lopez.jpg
			//   https://www.ecestaticos.com/image/clipping/0/74d2adf4c3ccfa3144086c71e16eabf3/alba-farelo-es-bad-gyal-una-de-las-mujeres-que-lidera-el-dancehall-espanol-gerard-lopez.jpg
			return src.replace(/\/clipping\/[0-9]*\//, "/clipping/0/");
		}

		if (domain_nowww === "sonarreykjavik.com" ||
			// http://www.gamer.ru/system/attached_images/images/000/314/112/normal/8636.jpg
			//   http://www.gamer.ru/system/attached_images/images/000/314/112/original/8636.jpg
			domain_nowww === "gamer.ru" ||
			// https://li1613-47.members.linode.com/system/App/BlogBody/photos/000/225/791/medium/44a50f07b4bdc57740901280f9eddaf5.PNG
			//   https://li1613-47.members.linode.com/system/App/BlogBody/photos/000/225/791/original/44a50f07b4bdc57740901280f9eddaf5.PNG
			domain_nosub === "linode.com" ||
			// http://img.noritter.com/system/App/BlogBody/photos/000/169/173/largethumb/44558aadbc23ffc36240198c7e47a0bb.jpg
			//   http://img.noritter.com/system/App/BlogBody/photos/000/169/173/original/44558aadbc23ffc36240198c7e47a0bb.jpg
			domain === "img.noritter.com" ||
			// https://esportivo.net/system/post_pictures/files/000/000/007/medium/Bez_tytu%C5%82u.jpg?1500980126
			//   https://esportivo.net/system/post_pictures/files/000/000/007/original/Bez_tytu%C5%82u.jpg?1500980126
			// https://esportivo.net/system/posts/posters/000/001/303/thumb/fortnite.jpg?1536761386
			//   https://esportivo.net/system/posts/posters/000/001/303/original/fortnite.jpg?1536761386
			domain_nowww === "esportivo.net" ||
			// http://pvgroup.ru/system/post_pictures/pictures/000/000/260/medium/Thermoplast_2018-9.jpg?1531233838
			//   http://pvgroup.ru/system/post_pictures/pictures/000/000/260/original/Thermoplast_2018-9.jpg?1531233838 -- doesn't work
			// http://pvgroup.ru/system/post_pictures/pictures/000/000/072/medium/DSC09097.JPG?1425970948
			//   http://pvgroup.ru/system/post_pictures/pictures/000/000/072/original/DSC09097.JPG?1425970948 -- works
			domain_nowww === "pvgroup.ru" ||
			// http://leit.is/system/events/images/000/002/054/small/6-mind-blowing-ways-wear-your-steampunk-goggles.w654.jpg?1433916032
			//   http://leit.is/system/events/images/000/002/054/original/6-mind-blowing-ways-wear-your-steampunk-goggles.w654.jpg?1433916032
			domain_nowww === "leit.is" ||
			// http://www.rovina-project.eu/system/post_pictures/assets/000/000/054/big/premiazione-fabrizio.jpg?1450022017 -- 600x417
			//   http://www.rovina-project.eu/system/post_pictures/assets/000/000/054/original/premiazione-fabrizio.jpg?1450022017 -- 1319x917
			domain_nowww === "rovina-project.eu" ||
			// https://mmorpg.org.pl/system/post_pictures/files/000/006/015/thumb/40668144_2172392399469743_8786830147845095424_n.jpg?1537099596
			//   https://mmorpg.org.pl/system/post_pictures/files/000/006/015/original/40668144_2172392399469743_8786830147845095424_n.jpg?1537099596
			domain_nowww === "mmorpg.org.pl" ||
			// http://girlspolish.jp/system/item_images/images/000/017/452/medium/13c97c51-60d1-4dfc-b9e6-5b8df642af16.jpg?1468969209
			//   http://girlspolish.jp/system/item_images/images/000/017/452/original/13c97c51-60d1-4dfc-b9e6-5b8df642af16.jpg?1468969209
			domain_nowww === "girlspolish.jp" ||
			// http://joah-girls.com/system/item_images/images/000/112/476/medium/a9faac95-20df-48f5-a855-0c9791e1ec11.jpg?1513993165
			//   http://joah-girls.com/system/item_images/images/000/112/476/original/a9faac95-20df-48f5-a855-0c9791e1ec11.jpg?1513993165
			// http://joah-girls.com/system/articles/images/000/005/369/square/2964aa6c-389c-4920-b383-83083f5d2279.jpg?1547101266
			domain_nowww === "joah-girls.com" ||
			// http://listas.eleconomista.es/system/items/000/106/409/medium/listas-eleconomista-enma-stone.jpg?1518398807
			//   http://listas.eleconomista.es/system/items/000/106/409/original/listas-eleconomista-enma-stone.jpg?1518398807
			domain === "listas.eleconomista.es" ||
			// https://gonintendo.com/system/file_uploads/uploads/000/011/876/medium/New-Super-Mario-Bros-U_2012_06-05-12_012.jpg
			//   https://gonintendo.com/system/file_uploads/uploads/000/011/876/original/New-Super-Mario-Bros-U_2012_06-05-12_012.jpg
			domain_nowww === "gonintendo.com" ||
			// https://gozzip.id/system/App/BlogBody/photos/000/203/493/medium/24f76634ce96b927cfdcdd6dce44e5ef.jpg
			//   https://gozzip.id/system/App/BlogBody/photos/000/203/493/original/24f76634ce96b927cfdcdd6dce44e5ef.jpg
			(domain_nowww === "gozzip.id" && /\/BlogBody\/+photos\//.test(src)) ||
			// https://greasyfork.org/system/screenshots/screenshots/000/010/208/thumb/Snipaste_2018-03-05_12-28-39.png?1520224343
			//   https://greasyfork.org/system/screenshots/screenshots/000/010/208/original/Snipaste_2018-03-05_12-28-39.png?1520224343
			domain_nowww === "greasyfork.org" ||
			// https://static.themezy.com/system/resources/previews/000/000/244/non_2x/web-designer-portfolio-website-template.jpg
			//   https://static.themezy.com/system/resources/previews/000/000/244/original/web-designer-portfolio-website-template.jpg
			domain === "static.themezy.com" ||
			// thanks to anonymous for reporting:
			// https://static.vecteezy.com/system/resources/thumbnails/002/727/618/small_2x/american-football-balloon-isolated-icon-free-vector.jpg
			//   https://static.vecteezy.com/system/resources/previews/002/727/618/original/american-football-balloon-isolated-icon-free-vector.jpg
			// https://static.vecteezy.com/system/resources/previews/002/187/079/non_2x/football-icon-set-vector.jpg
			//   https://static.vecteezy.com/system/resources/previews/002/187/079/original/football-icon-set-vector.jpg
			// doesn't work for all:
			// https://static.vecteezy.com/system/resources/thumbnails/039/344/819/small/1800-backgrounds-and-textures-bundle.png
			//
			// https://www.vecteezy.com/vector-art/266318-american-footbal-emblem-orange-ball
			// https://static.vecteezy.com/system/resources/thumbnails/000/266/318/small_2x/American_Football_Emblems_Vector_RON_10.jpg
			//   https://static.vecteezy.com/system/resources/previews/000/266/318/original/american-footbal-emblem-orange-ball-vector.jpg
			domain === "static.vecteezy.com" ||
			// https://hairhapi.com/images/item_images/images/000/037/150/medium/27b4ce4e-b343-4d78-a4f4-7d610099257f.jpg
			//   https://hairhapi.com/images/item_images/images/000/037/150/original/27b4ce4e-b343-4d78-a4f4-7d610099257f.jpg
			domain_nowww === "hairhapi.com" ||
			// http://babyfashion.me/system/pictures/imgs/000/026/436/gallery_view/altuzarra-vesna-leto-2017_545153pw_7516888955953422.jpg?1477389806
			//   http://babyfashion.me/system/pictures/imgs/000/026/436/original/altuzarra-vesna-leto-2017_545153pw_7516888955953422.jpg?1477389806
			domain_nowww === "babyfashion.me" ||
			// https://cdn-learn.adafruit.com/guides/cropped_images/000/001/849/medium640/PC090531_2k.jpg?1512885505
			//   https://cdn-learn.adafruit.com/guides/cropped_images/000/001/849/original/PC090531_2k.jpg?1512885505
			domain === "cdn-learn.adafruit.com" ||
			// https://www.advocate-art.com/system/ART/Modules/Application/Images/Image/images/000/376/119/medium/ALL258457.png?1788fbdd5f9e2355cd5b5100045df0bc262ada91a284f206a2fe02cd0a68e3e5
			//   https://www.advocate-art.com/system/ART/Modules/Application/Images/Image/images/000/376/119/original/ALL258457.png?1788fbdd5f9e2355cd5b5100045df0bc262ada91a284f206a2fe02cd0a68e3e5
			domain_nowww === "advocate-art.com" ||
			// thanks to anonymous for reporting:
			// https://d34gglw95p9zsk.cloudfront.net/item_cocreco_images/images/000/122/614/medium/eb02072f-fca2-4a0e-bbd8-7627229f6930.jpg?1672023100
			//   https://d34gglw95p9zsk.cloudfront.net/item_cocreco_images/images/000/122/614/original/eb02072f-fca2-4a0e-bbd8-7627229f6930.jpg?1672023100
			domain === "d34gglw95p9zsk.cloudfront.net" ||
			// thanks to anonymous for reporting:
			// https://www.scandalbeauties.com/system/blog_headers/avatars/000/024/543/cropped/3810dcb63b142b34647e5c319a5c0689.jpeg
			//   https://www.scandalbeauties.com/system/blog_headers/avatars/000/024/543/original/3810dcb63b142b34647e5c319a5c0689.jpeg
			// https://www.scandalbeauties.com/system/blog_headers/ultras/000/024/216/cropped/d3391146a7e3c832d1269c78cca7d7e8.jpeg
			//   https://www.scandalbeauties.com/system/blog_headers/ultras/000/024/216/original/d3391146a7e3c832d1269c78cca7d7e8.jpeg
			domain_nowww === "scandalbeauties.com" ||
			// https://sonar.es/system/attached_images/18702/medium/badgyal_xs_sonar2017_fernandoschlaepfer_004.jpg?1497713257 -- stretched?
			//   https://sonar.es/system/attached_images/18702/original/badgyal_xs_sonar2017_fernandoschlaepfer_004.jpg?1497713257
			domain_nowww === "sonar.es") {
			// https://sonarreykjavik.com/system/attached_images/19379/medium/BadGyal_AlexisG%C3%B3mez.jpg?1513685256
			//   https://sonarreykjavik.com/system/attached_images/19379/large/BadGyal_AlexisG%C3%B3mez.jpg?1513685256
			//   https://sonarreykjavik.com/system/attached_images/19379/original/BadGyal_AlexisG%C3%B3mez.jpg?1513685256
			return src
				.replace(/(\/attached_images\/+[0-9]+\/+)[a-z]+\/+/, "$1original/")
				.replace(/(\/system\/+resources\/+)thumbnails\/+/, "$1previews/")
				.replace(/(\/(?:(?:system|images)\/+)?(?:(?:attached|item)_images|App\/+BlogBody|post_pictures|events|posts|items|articles|file_uploads|screenshots|resources|pictures|guides|Image|item_cocreco_images|blog_headers)\/+(?:(?:images|photos|files|assets|pictures|posters|uploads|screenshots|previews|imgs|cropped_images|avatars|ultras)\/+)?(?:[0-9]{3}\/+){3})[a-z_0-9]+\/+/, "$1original/");
			//return src.replace(/(\/system\/(?:post_pictures\/(?:files|assets|pictures)\/|posts\/posters\/|events\/images\/)(?:[0-9]+\/){3})[a-z]+(\/[^/]*)$/, "$1original$2");
			//return src.replace(/\/[a-z]*\/([-0-9a-f]*\.[^/.]*)$/, "/original/$1");
			//return src.replace(/(\/[0-9]+\/[0-9]+\/[0-9]+)\/[a-z]+\/([^/]*)$/, "$1/original/$2");
			//return src.replace("/thumb/", "/original/");
		}

		if (domain === "pgw.udn.com.tw") {
			// https://pgw.udn.com.tw/gw/photo.php?u=https://uc.udn.com.tw/photo/2016/08/03/99/2447700.jpg&x=0&y=0&sw=0&sh=0&sl=W&fw=750
			// https://pgw.udn.com.tw/gw/photo.php?u=https://uc.udn.com.tw/photo/2018/05/16/realtime/4742890.jpg&x=0&y=0&sw=0&sh=0&sl=W&fw=1050&exp=3600
			//   https://uc.udn.com.tw/photo/2018/05/16/realtime/4742890.jpg
			return src.replace(/.*\/photo\.php.*?[?&]u=([^&]*).*/, "$1");
		}

		if (domain === "uc.udn.com.tw") {
			// https://uc.udn.com.tw/photo/2018/05/16/realtime/4742890.jpg -- HEAD returns 404
			return {
				url: src,
				can_head: false
			};
		}

		if ((domain_nosub === "hdslb.com" && domain.match(/i[0-9]*\.hdslb\.com/)) ||
			// https://img.xiaohongshu.com/avatar/5b56be0014de415b2db830a6.jpg@160w_160h_92q_1e_1c_1x.jpg
			//   https://img.xiaohongshu.com/avatar/5b56be0014de415b2db830a6.jpg
			domain === "img.xiaohongshu.com" ||
			// http://alcdn.img.xiaoka.tv/20160708/899/367/44745628/899367337e05da1af210de07ff2740e6.jpg@1e_1c_0o_0l_640h_640w_100q_1pr.jpg
			//   http://alcdn.img.xiaoka.tv/20160708/899/367/44745628/899367337e05da1af210de07ff2740e6.jpg
			// https://alcdn.img.xiaoka.tv/20161017/a33/379/27774175/a333797899a6aa5d2766de56d58dc7a3.jpg@1e_1c_0o_0l_330h_330w
			//   https://alcdn.img.xiaoka.tv/20161017/a33/379/27774175/a333797899a6aa5d2766de56d58dc7a3.jpg
			(domain_nosub === "xiaoka.tv" && domain.match(/alcdn\.img\.xiaoka\.tv/))) {
			// thanks to liraqb on github for reporting: https://github.com/qsniyg/maxurl/issues/346
			// https://i0.hdslb.com/bfs/videoshot/47146296.jpg@.webp
			if (/:\/\/[^/]+\/+bfs\/+videoshot\/+[0-9]+\.[^/]+(?:[?#].*)?$/.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}
			// https://i0.hdslb.com/bfs/bangumi/546991a5d3add9b550925b1168abf0a460e5f552.jpg@240w_320h.jpg
			// https://i2.hdslb.com/bfs/archive/6b1d06f79ec31b6e23e4ecb7eb87c53ccd86f965.jpg@.webp
			//   https://i2.hdslb.com/bfs/archive/6b1d06f79ec31b6e23e4ecb7eb87c53ccd86f965.jpg
			// http://i0.hdslb.com/320_180/u_user/a5ab2c18e8e4a62240fad3f0b040ba00.jpg
			//   http://i0.hdslb.com/u_user/a5ab2c18e8e4a62240fad3f0b040ba00.jpg
			// https://i2.hdslb.com/bfs/archive/be06808687a0eb892744bc7ec701372fab74357e.jpg@560w_350h_100Q_1c.webp
			//   https://i2.hdslb.com/bfs/archive/be06808687a0eb892744bc7ec701372fab74357e.jpg
			// https://i2.hdslb.com/bfs/face/a63f3fb3fd63574ca52e09574fa0f2e4a531746f.jpg_64x64.jpg
			//   https://i2.hdslb.com/bfs/face/a63f3fb3fd63574ca52e09574fa0f2e4a531746f.jpg
			return src
				.replace(/(:\/\/[^/]*\/)[0-9]+_[0-9]+\//, "$1")
			//.replace(/(\.[^/.]*)@(?:[0-9]*[a-z](?:_[0-9]*[wh])?)?(\.[^/.]*)$/, "$1");
				.replace(/(\.[^/.]*)@[_0-9a-zQ]*(?:\.[^/.]*)?$/, "$1")
				.replace(/(\/[0-9a-f]{20,}\.[^/._]+)_[0-9]+x[0-9]+\.[^/]+(?:[?#].*)?$/, "$1")
		}

		if (domain === "d.ifengimg.com") {
			// http://d.ifengimg.com/w204_h115/p0.ifengimg.com/pmop/2017/1230/E538B9A1631291D8B1578F161157F26647C97944_size296_w448_h252.png
			// http://d.ifengimg.com/w600/p0.ifengimg.com/pmop/2017/0726/F4057A55111AE62724AF9C914EFEE425FEBD79C7_size41_w750_h422.jpeg
			// http://d.ifengimg.com/q100/p0.ifengimg.com/pmop/2017/0726/F4057A55111AE62724AF9C914EFEE425FEBD79C7_size41_w750_h422.jpeg
			// https://d.ifengimg.com/mw640_q100/y3.ifengimg.com/yidian/2015_46/4321111b2929329_w366_h550.jpg
			//   http://y3.ifengimg.com/yidian/2015_46/4321111b2929329_w366_h550.jpg

			return src.replace(/.*?\/[a-z]+[0-9]*(?:_[whq][0-9]*)?\//, "http://");
			//return src.replace(/(:\/\/[^/]*\/)[wh][0-9]+(?:_[wh][0-9]*)?\//, "$1w0/");
		}

		if (domain_nowww === "nationalgeographic.com") {
			// https://www.nationalgeographic.com/content/dam/magazine/rights-exempt/2012/04/unseen-titanic/01-port-bow-titanic-3x2.ngsversion.1492030266842.adapt.1900.1.jpg
			//   https://www.nationalgeographic.com/content/dam/magazine/rights-exempt/2012/04/unseen-titanic/01-port-bow-titanic-3x2.jpg
			return src.replace(/\.[^/]*(\.[^/.]*)$/, "$1");
		}

		// fixme: find other and merge with it
		if (domain === "media.mnn.com" ||
			// https://alljapantours.com/places-to-visit-in-japan/most-beautiful-places-in-japan/img/issue_04most_photo01.jpg.pagespeed.ce.woxsyqYnu2.jpg
			domain_nowww === "alljapantours.com" ||
			// http://shows.gqimg.com.cn/showspic/FashionImages/F2018MEN/paris/louis-vuitton/collection/_VUI0653h.jpg.100X150.jpg
			domain === "shows.gqimg.com.cn" ||
			// http://shows.vogueimg.com.cn/showspic/FashionImages/S2017CTR/paris/alexandre-vauthier/collection/_ARC0726h.jpg.100X150.jpg
			domain === "shows.vogueimg.com.cn" ||
			// https://smedia.webcollage.net/rwvfp/wc/cp/22757735/module/cpwalmart/_cp/products/1472244742078/tab-0e3f8313-5e4d-4103-9de5-caca68cf8437/eaddf5d5-afe7-4086-9bc7-149b6b486cdd.jpg.w480.jpg
			//    https://media3.webcollage.net/a8d14734c22ff05fcb5aa464bcde656048f8ec9b?response-content-type=image%2Fjpeg&AWSAccessKeyId=AKIAIIE5CHZ4PRWSLYKQ&Expires=1893510561&Signature=eqN507piWJYrWEhhc72wNlKeaao%3D
			// https://smedia.webcollage.net/rwvfp/wc/cp/22757735/module/cpwalmart/_cp/products/1472244742078/tab-0e3f8313-5e4d-4103-9de5-caca68cf8437/eaddf5d5-afe7-4086-9bc7-149b6b486cdd.jpg
			//    https://media3.webcollage.net/0ddf5fd70a8e0511dcd624ae9620bae32ae1ca4b?response-content-type=image%2Fjpeg&AWSAccessKeyId=AKIAIIE5CHZ4PRWSLYKQ&Expires=1893509612&Signature=cb7UbzZXRXb4S%2BLblX1crSDyOB0%3D
			(domain_nosub === "webcollage.net" && string_indexof(domain, "media.webcollage.net") >= 0) ||
			// http://www.metronews.ca/content/dam/thestar/uploads/2017/3/29/oilers.jpg.size.xxlarge.promo.jpg
			domain_nowww === "metronews.ca" ||
			// https://images.meredith.com/content/dam/bhg/Images/life-in-color/arnold%20gian.jpg.rendition.largest.jpg
			domain === "images.meredith.com" ||
			// http://img-cdn.jg.jugem.jp/584/719314/20131206_802590.jpg.thumb.jpg
			domain === "img-cdn.jg.jugem.jp" ||
			// http://anime-thai.net/bbs/data/attachment/album/201405/22/171403xnhmbbh70bx5kp47.jpg.thumb.jpg
			domain_nowww === "anime-thai.net" ||
			// https://www.mymypic.net/data/attachment/forum/201903/15/1709395e0xsg17jxi0x1g9.jpg.thumb.jpg
			domain_nowww === "mymypic.net" ||
			// http://styleyen.com/galleries/6/image_slide/2/taylor-swift-bangs.jpg.thumb_200_width.jpg
			domain_nowww === "styleyen.com" ||
			// http://www.nbstr.org/sitebuildercontent/sitebuilderpictures/webassets/hercules.jpg.w300h300.jpg
			domain_nowww === "nbstr.org" ||
			// https://dyn0.media.forbiddenplanet.com/products/201226.jpg.maxheight-285_square-true_size-285.jpg
			(domain_nosub === "forbiddenplanet.com" && domain.match(/^dyn[0-9]*\.media\.forbiddenplanet\.com/)) ||
			// https://media.treehugger.com/assets/images/2018/02/16300451622_c972b01dae_b_1.jpg.860x0_q70_crop-smart.jpg
			domain === "media.treehugger.com" ||
			// https://attitude.co.uk/media/images/2018/01/rise-series-order-nbc.jpg.750x400_q85_box-0%2C27%2C650%2C373_crop_detail.jpg
			(domain_nowww === "attitude.co.uk" && string_indexof(src, "/media/images/") >= 0) ||
			// http://media.allyou.net/2/28690/images/7918324/MarieClaire-72.jpg.5000x640_q90.jpg
			domain === "media.allyou.net" ||
			// https://image.pbs.org/poster_images/assets/IcebergCultureBlank_JPEG1.jpg.resize.710x399.jpg
			domain === "image.pbs.org" ||
			// http://plasticsurgerystar.com/images/measurements2/jennifer-lawrence-body-height-weight-bra-size/jennifer-lawrence-weight.jpg.thumb_100_width.jpg
			(domain_nowww === "plasticsurgerystar.com" && string_indexof(src, "/images/") >= 0) ||
			// http://www.peoplite.com/public/album_photo/e7/23/02/71fbf88a7a3d6ee2d1ff7cca9a1fd736.jpg.pagespeed.ce.SiSZg6-g3I.jpg
			//   http://www.peoplite.com/public/album_photo/e7/23/02/71fbf88a7a3d6ee2d1ff7cca9a1fd736.jpg
			(domain_nowww === "peoplite.com" && string_indexof(src, "/public/album_photo/") >= 0) ||
			// https://cdn.admireme.vip/media/cdeecc80-7cf7-4083-9e2e-9690ad143432.jpg.288x288_q85_crop_upscale.jpg
			(domain === "cdn.admireme.vip" && string_indexof(src, "/media/") >= 0) ||
			// https://estaticos.globoradio.globo.com/fotos/2019/05/6311f398-e2fb-4267-8cbb-2adba1dae8eb.jpg.640x360_q75_box-0%2C0%2C1024%2C576_crop_detail.jpg
			//   https://estaticos.globoradio.globo.com/fotos/2019/05/6311f398-e2fb-4267-8cbb-2adba1dae8eb.jpg
			(domain_nosub === "globo.com" && string_indexof(src, "/fotos/") >= 0) ||
			// https://d26oc3sg82pgk3.cloudfront.net/files/media/uploads/zinnia/2017/08/22/0824-felicity-jones_cred_shutterstock-featureflash-photo-agency.jpg.644x420_q100.jpg
			//   https://d26oc3sg82pgk3.cloudfront.net/files/media/uploads/zinnia/2017/08/22/0824-felicity-jones_cred_shutterstock-featureflash-photo-agency.jpg
			domain === "d26oc3sg82pgk3.cloudfront.net" ||
			// https://memberme.net/media/creator/creators/d60239d1-4877-445c-913a-4cc837875214.jpg.300x300_q85_crop-50%2C%2050_detail_upscale.jpg
			(domain_nowww === "memberme.net" && string_indexof(src, "/media/") >= 0) ||
			// https://funasia.net/site_media/coverphoto/7aef660a-9d55-4f48-a75f-4b500f821312.jpg.260x0_q85.jpg
			(domain_nowww === "funasia.net" && string_indexof(src, "/site_media/") >= 0) ||
			// https://image.photocnc.com/photocnc/2019-06/21/201906210455231280.jpg.h200.jpg
			domain === "image.photocnc.com" ||
			// https://d53l9d6fqlxs2.cloudfront.net/photos/41/41127-tokyos-tak.jpg.660x0_q80_crop-scale_upscale.jpg
			//   https://d53l9d6fqlxs2.cloudfront.net/photos/41/41127-tokyos-tak.jpg
			domain === "d53l9d6fqlxs2.cloudfront.net") {
			// https://media.mnn.com/assets/images/2017/03/cyclops-2-titanic-wreck.jpg.653x0_q80_crop-smart.jpg
			//   https://media.mnn.com/assets/images/2017/03/cyclops-2-titanic-wreck.jpg
			newsrc = src.replace(/(\/[^/.]*\.[^/.]*)\.[^/]*$/, "$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "media.contentapi.ea.com") {
			// https://media.contentapi.ea.com/content/dam/ea/dragonage/inquisition-refresh/videos/2018/01/90614bfc-1566-7230-3359-3ea9a1f39577.youtube/subassets/poster.jpg.adapt.crop16x9.1920w.jpg
			//   https://media.contentapi.ea.com/content/dam/ea/dragonage/inquisition-refresh/videos/2018/01/90614bfc-1566-7230-3359-3ea9a1f39577.youtube/subassets/poster.jpg
			// https://media.contentapi.ea.com/content/dam/ea/dragonage/inquisition-refresh/images/2018/01/ea-hero-medium-dai-homepage-7x2-xl.jpg.adapt.crop3x5.320w.jpg
			//   https://media.contentapi.ea.com/content/dam/ea/dragonage/inquisition-refresh/images/2018/01/ea-hero-medium-dai-homepage-7x2-xl.jpg
			newsrc = src.replace(/(\/[^/.]*\.[^/.]*)\.[^/]*$/, "$1");
			if (newsrc !== src)
				return {
					url: newsrc,
					can_head: false
				};
		}


		if (domain === "img.bleacherreport.net") {
			// https://img.bleacherreport.net/cms/media/image/fa/2f/08/6e/dfb9/4c1f/b030/48ba951160bd/crop_exact_USATSI_10579599.jpg?w=460&h=259&q=75
			//   https://img.bleacherreport.net/cms/media/image/fa/2f/08/6e/dfb9/4c1f/b030/48ba951160bd/USATSI_10579599.jpg?w=999999999999&h=999999999999
			return src
				.replace(/\/crop_exact_([^/]*)$/, "/$1")
				.replace(/\?.*$/, "?w=999999999999&h=999999999999");
		}

		if (domain === "images.gr-assets.com") {
			// https://images.gr-assets.com/books/1403200898m/7923163.jpg
			// https://images.gr-assets.com/authors/1281489919p2/3443203.jpg
			// https://images.gr-assets.com/users/1268072620p2/1668975.jpg
			return src
				.replace(/(\/(?:authors|users)\/[0-9]*p)[0-9]\//, "$18/")
				.replace(/(\/books\/[0-9]*)[a-z]\//, "$1l/");
		}

		if (domain === "dynamic.indigoimages.ca") {
			// https://dynamic.indigoimages.ca/books/1506701655.jpg?altimages=false&scaleup=true&maxheight=515&width=380&quality=85&sale=0&lang=en
			// https://dynamic.indigoimages.ca/books/1506701655.jpg?width=999999999
			return src.replace(/(\?.*)?$/, "?width=999999999");
		}

		if (domain === "cdn.mos.cms.futurecdn.net") {
			// https://cdn.mos.cms.futurecdn.net/wtXpUq7DAuPqftGRshxtzD-650-80.jpg
			//   https://cdn.mos.cms.futurecdn.net/wtXpUq7DAuPqftGRshxtzD.jpg
			// https://cdn.mos.cms.futurecdn.net/8viJ74GoyGzofeCZA37MM8-650-80.jpg.webp
			//   https://cdn.mos.cms.futurecdn.net/8viJ74GoyGzofeCZA37MM8.jpg.webp
			return src.replace(/-[0-9]+-[0-9]+(\.[^/.]*(?:\.webp)?)(?:[?#].*)?$/, "$1");
		}

		if (domain === "www.allkpop.com") {
			// https://www.allkpop.com/upload/2018/02/af/12101614/clc.jpg
			//   https://www.allkpop.com/upload/2018/02/af_org/12101614/clc.jpg
			// thanks to azadandro on github for reporting: https://github.com/qsniyg/maxurl/issues/1388
			// https://www.allkpop.com/upload/2024/12/content/141416/thumb/1734203817-aespawinter.jpg
			//   https://www.allkpop.com/upload/2024/12/content/141416/1734203817-aespawinter.jpg
			return src
				.replace(/\/af\/([0-9]*\/[^/]*)$/, "/af_org/$1")
				.replace(/(\/content\/+[0-9]+\/+)thumb\/+/, "$1");
		}

		if (domain === "cwcontent.asiae.co.kr") {
			return src
				//.replace(/\/amgimagelink\/[0-9]*\//, "/amgimagelink/0/")
				.replace(/^(.*?:\/\/).*\/[^/]*resize\/[0-9]*\/([^/]*)$/, "$1cphoto.asiae.co.kr/listimglink/4/$2");
			// http://cwcontent.asiae.co.kr/stooresize/32/2018020812382111881_1518061101.jpg
			//   http://cwcontent.asiae.co.kr/stooresize/28/2018020812382111881_1518061101.jpg
			//   http://cphoto.asiae.co.kr/listimglink/7/2018020812382111881_1518061101.jpg
			//   http://cphoto.asiae.co.kr/listimglink/4/2018020812382111881_1518061101.jpg - max
			// http://cwcontent.asiae.co.kr/amgimagelink/98/2018020408443101207A_1.jpg
			//   http://cphoto.asiae.co.kr/listimglink/4/201110161718307486692A_1.jpg - different
			// http://cwcontent.asiae.co.kr/asiaresize/80/2018021210005919425_1518397258.jpg
			//   http://cwcontent.asiae.co.kr/asiaresize/113/2018021210005919425_1518397258.jpg
			//   http://cwcontent.asiae.co.kr/asiaresize/132/2018021210005919425_1518397258.jpg
			//   http://cphoto.asiae.co.kr/listimglink/4/2018021210005919425_1518397258.jpg - max, same as above
			// http://cwcontent.asiae.co.kr/asiaresize/103/2018021210300316119_2.jpg
			//   http://cphoto.asiae.co.kr/listimglink/4/2018021210300316119_2.jpg - doesn't work
			//   http://cphoto.asiae.co.kr/listimglink/4/2018021210291519546_1518398953.jpg - proper
			// http://cwcontent.asiae.co.kr/amgimagelink/98/2018031311511632721A_1.jpg -- not
			//   http://cwcontent.asiae.co.kr/amgimagelink/0/2018031311511632721A_1.jpg -- gif
			//   http://cwcontent.asiae.co.kr/listimglink/4/2018031311511632721A_1.jpg -- doesn't work
			// http://cwcontent.asiae.co.kr/amgimagelink/98/2017092915472067985A_1.jpg -- not
			//   http://cwcontent.asiae.co.kr/amgimagelink/0/2017092915472067985A_1.jpg -- gif??
			//   http://cwcontent.asiae.co.kr/listimglink/4/2017092915472067985A_1.jpg -- doesn't work
			// http://cwcontent.asiae.co.kr/amgimagelink/0/201411151911520388001A_1.jpg -- watermark
			//   http://cwcontent.asiae.co.kr/listimglink/4/201411151911520388001A_1.jpg -- without
			// http://cphoto.asiae.co.kr/listimglink/4/2016051308263757999_1.jpg
			//   http://cwcontent.asiae.co.kr/amgimagelink/0/2016051308263757999_1.jpg -- smaller
			//   http://cwcontent.asiae.co.kr/amgimagelink/0/2016051308263757999_1.jpg -- slightly larger
			// http://cwcontent.asiae.co.kr/stooresize/33/2018031311332188690A_1.jpg
			//   http://cphoto.asiae.co.kr/listimglink/4/2018031311332188690A_1.jpg -- content length: 0
			//   http://cwcontent.asiae.co.kr/amgimagelink/0/2018031311332188690A_1.jpg -- proper
			// http://cwcontent.asiae.co.kr/amgimagelink/0/2018030609164136390A_1.jpg -- 540x607
			//   http://cwcontent.asiae.co.kr/amgimagelink/98/2018030609164136390A_1.jpg -- 1080x1215
			// http://cwcontent.asiae.co.kr/amgimagelink/0/2014091709013891379_1.jpg -- 540x379
			//   http://cwcontent.asiae.co.kr/listimglink/4/2014091709013891379_1.jpg -- larger (885x623)
			// http://cwcontent.asiae.co.kr/amgimagelink/98/201410202126598761515A_1.jpg
			//   http://cphoto.asiae.co.kr/listimglink/4/201410202126598761515A_1.jpg -- same size, without watermark
			// http://wcontent.asiaeconomy.co.kr/amgimage_link.htm?idx=0&no=2008090309143458665_1.jpg
			// http://photo.asiae.co.kr/listimg_link.php?idx=2&no=2018031212153472858_1520824535.jpg
			// http://cwstoo.asiae.co.kr/freeimg_get.htm?img=1371 -- download
			// resize:
			// 28, 1, 20, 16, 3, 34, 18, 9, 35, 13, 21, 24, 39, 7, 15, 2, 23, 44, 11, 5, 22, 30, 4, 6, 25, 40, 8, 36, 47, 27, 48, 43, 46, 33, 17, 38, 41, 37, 14, 32, 45, 42, 31, 26, 12, 29, 10, 19
			// listimglink:
			// (4, 5 [=download]), 7, 6, 2, 3
			// amgimagelink:
			// (98, 12, 0), 11, 3, 14, 10, 4
		}

		if (domain === "cphoto.asiae.co.kr") {
			// http://cphoto.asiae.co.kr/listimglink/4/2015101609215433891_1.jpg - 2598x3354
			// http://cphoto.asiae.co.kr/listimg_link.php?idx=3&no=2010070915075405717_2.jpg
			//   http://cphoto.asiae.co.kr/listimg_link.php?idx=4&no=2010070915075405717_2.jpg
			// http://cphoto.asiae.co.kr/resizeimglink/2/201012011609040182464A_1.jpg
			//   http://cphoto.asiae.co.kr/listimglink/4/201012011609040182464A_1.jpg
			return src
				.replace(/\/listimglink\/[0-9]*\//, "/listimglink/4/")
				.replace(/\/resizeimglink\/[0-9]*\//, "/listimglink/4/")
				.replace(/\/listimg_link\.php.*?[?&]no=([^&]*).*?$/, "/listimg_link.php?idx=4&no=$1");
		}

		if (domain === "thumbs-prod.si-cdn.com") {
			// https://thumbs-prod.si-cdn.com/eoEYA_2Hau4795uKoecUZZgz-3w=/800x600/filters:no_upscale()/https://public-media.smithsonianmag.com/filer/52/f9/52f93262-c29b-4a4f-b031-0c7ad145ed5f/42-33051942.jpg
			//   https://public-media.smithsonianmag.com/filer/52/f9/52f93262-c29b-4a4f-b031-0c7ad145ed5f/42-33051942.jpg
			return src.replace(/.*\/(https?:\/\/)/, "$1");
		}

		if (domain === "assets.atlasobscura.com") {
			// https://assets.atlasobscura.com/article_images/800x/17628/image.jpg
			//   https://assets.atlasobscura.com/article_images/17628/image.jpg
			return src.replace(/\/article_images\/[0-9]*x\//, "/article_images/");
		}

		if (domain_nowww === "wonderopolis.org" && string_indexof(src, "/_img") >= 0) {
			// https://wonderopolis.org/_img?img=/wp-content/uploads/2012/01/squirell_shutterstock_6383917.jpg&transform=resizeCrop,720,450
			//   https://wonderopolis.org/_img?img=/wp-content/uploads/2012/01/squirell_shutterstock_6383917.jpg
			//   https://www.wonderopolis.org/wp-content/uploads/2012/01/squirell_shutterstock_6383917.jpg
			newsrc = src.replace(/\/_img\?(?:.*&)?(img=[^&]*).*/, "/_img?$1");
			if (newsrc !== src)
				return newsrc;

			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+_img\?img=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return urljoin(src, newsrc, true);
		}

		if (domain_nowww === "thehindu.com" ||
			domain_nowww === "gloria.hr" ||
			// http://i4.mirror.co.uk/incoming/article1323853.ece/ALTERNATES/s1227b/Sky%20Sports%20news%20female%20presenters
			//   http://i4.mirror.co.uk/incoming/article1323853.ece/BINARY/Sky%20Sports%20news%20female%20presenters
			((domain_nosub === "mirror.co.uk" ||
			  // https://i2-prod.birminghammail.co.uk/incoming/article15152252.ece/ALTERNATES/s615/2_NWP_BEM_130918Bailey01JPG.jpg
			  //   https://i2-prod.birminghammail.co.uk/incoming/article15152252.ece/BINARY/2_NWP_BEM_130918Bailey01JPG.jpg
			  domain_nosub === "birminghammail.co.uk" ||
			  // https://i2-prod.dailypost.co.uk/incoming/article15148144.ece/BINARY/2_Joint-owner-Jules-Peters-has-opened-a-new-coffee-shop-called-Haus-on-Penrhyn-Road-Colwyn-Bay-Image.jpg
			  //   https://i2-prod.dailypost.co.uk/incoming/article15148144.ece/BINARY/2_Joint-owner-Jules-Peters-has-opened-a-new-coffee-shop-called-Haus-on-Penrhyn-Road-Colwyn-Bay-Image.jpg
			  domain_nosub === "dailypost.co.uk" ||
			  // https://i2-prod.bristolpost.co.uk/incoming/article1628442.ece/ALTERNATES/s615/BristolMagsCourtPNG.png
			  //   https://i2-prod.bristolpost.co.uk/incoming/article1628442.ece/BINARY/BristolMagsCourtPNG.png
			  domain_nosub === "bristolpost.co.uk" ||
			  // https://i2-prod.irishmirror.ie/incoming/article8862957.ece/ALTERNATES/s615b/abb08375.jpg
			  //   https://i2-prod.irishmirror.ie/incoming/article8862957.ece/BINARY/abb08375.jpg
			  // https://i2-prod.irishmirror.ie/incoming/article12859145.ece/ALTERNATES/s615b/0_Holly-Willoughby.jpg
			  //   https://i2-prod.irishmirror.ie/incoming/article12859145.ece/BINARY/0_Holly-Willoughby.jpg -- head is 403, but works
			  domain_nosub === "irishmirror.ie" ||
			  // https://i2-prod.coventrytelegraph.net/incoming/article14083906.ece/ALTERNATES/s1200/Davina-McCall-1.jpg
			  //   https://i2-prod.coventrytelegraph.net/incoming/article14083906.ece/BINARY/Davina-McCall-1.jpg
			  domain_nosub === "coventrytelegraph.net" ||
			  // https://i2-prod.dublinlive.ie/incoming/article14444188.ece/ALTERNATES/s458/CC-METRO-FIRE190393751.jpg
			  //   https://i2-prod.dublinlive.ie/incoming/article14444188.ece/BINARY/CC-METRO-FIRE190393751.jpg
			  domain_nosub === "dublinlive.ie") &&
			 domain.match(/i[0-9]*(?:-prod)?\./)) ||
			// https://www.mirror.co.uk/incoming/article1323853.ece/ALTERNATES/s1227b/Sky%20Sports%20news%20female%20presenters -- upscaled?
			//   https://www.mirror.co.uk/incoming/article1323853.ece/BINARY/Sky%20Sports%20news%20female%20presenters
			domain_nowww === "mirror.co.uk" ||
			// https://beta.images.theglobeandmail.com/76a/sports/hockey/article38351471.ece/ALTERNATES/w620/web-sp-hk-senators-0326.JPG
			// https://beta.images.theglobeandmail.com/339/sports/article34852751.ece/BINARY/w620/hk-moss28sp3.JPG
			// https://beta.images.theglobeandmail.com/6f3/report-on-business/industry-news/marketing/article4543679.ece/ALTERNATES/w620/persuasion-cdntire14rb1.JPG -- BINARY doesn't work
			domain === "beta.images.theglobeandmail.com" ||
			// https://static.theglobeandmail.ca/954/incoming/article890990.ece/ALTERNATES/w620/web-shoppers.jpg
			//   https://static.theglobeandmail.ca/954/incoming/article890990.ece/BINARY/web-shoppers.jpg -- 404
			//domain === "static.theglobeandmail.ca" ||
			// http://www.globalblue.com/destinations/uk/london/article288436.ece/alternates/LANDSCAPE2_970/cara_delevingne_rochas.jpg -- upscaled?
			//   https://www.globalblue.com/destinations/uk/london/article288436.ece/BINARY/cara_delevingne_rochas.jpg
			domain_nowww === "globalblue.com" ||
			// https://cdn-04.belfasttelegraph.co.uk/entertainment/film-tv/news/article36669885.ece/ALTERNATES/w620/bpanews_d1dbd5df-f462-4575-86fd-ef234930e632_embedded235347559
			//   https://cdn-04.belfasttelegraph.co.uk/entertainment/film-tv/news/article36669885.ece/BINARY/bpanews_d1dbd5df-f462-4575-86fd-ef234930e632_embedded235347559
			// https://www.belfasttelegraph.co.uk/migration_catalog/article25788206.ece/ALTERNATES/h342/SamanthaMumba
			// https://www.belfasttelegraph.co.uk/incoming/c5491/38997334.ece/AUTOCROP/w940h530/AFP_1PD6Z5.jpg -- BINARY doesn't work
			(domain_nosub === "belfasttelegraph.co.uk" && domain.match(/^(?:cdn(-[0-9]+)?|www)\./)) ||
			// http://www.ladylike.gr/articles/galleries/photostories/article2773870.ece/ALTERNATES/w60/olsen.jpg
			// http://www.ladylike.gr/articles/galleries/photostories/article2773872.ece/BINARY/original/Rihanna.jpg
			//   http://www.ladylike.gr/articles/galleries/photostories/article2773872.ece/BINARY/Rihanna.jpg -- same
			domain_nowww === "ladylike.gr" ||
			// http://www.24horas.cl/incoming/iceberg-en-groenlandia-2764254/ALTERNATES/w620h350/iceberg%20en%20Groenlandia
			//   http://www.24horas.cl/incoming/iceberg-en-groenlandia-2764254/BINARY/iceberg%20en%20Groenlandia
			domain_nowww === "24horas.cl" ||
			// https://www.jyllands-posten.dk/pictures/image/10752571/qz36h4/ALTERNATES/g-5_3/innarsuit
			domain_nowww === "jyllands-posten.dk" ||
			// https://www.svtstatic.se/image-cms/svtse/1531589739/nyheter/article18662486.svt/alternates/large/180714-gronlandisberg-715344-a001nh-jpg
			//   https://www.svtstatic.se/image-cms/svtse/1531589739/nyheter/article18662486.svt/BINARY/180714-gronlandisberg-715344-a001nh-jpg
			domain_nowww === "svtstatic.se" ||
			// https://www.adressa.no/incoming/article17124160.ece/9r0lq0/ALTERNATES/w980-default/td0459ed.jpg
			domain_nowww === "adressa.no" ||
			// https://www.miamiherald.com/entertainment/celebrities/b166pq/picture149952302/alternates/FREE_1140/cabello
			//   https://www.miamiherald.com/entertainment/celebrities/b166pq/picture149952302/BINARY/cabello -- 403 HEAD, but fine with GET
			domain_nowww === "miamiherald.com" ||
			// https://www.filmweb.no/bilder/migration_catalog/article583908.ece/representations/w1500/Megan%20Fox%20i%20Transformers
			//   https://www.filmweb.no/bilder/migration_catalog/article583908.ece/BINARY/Megan%20Fox%20i%20Transformers
			domain_nowww === "filmweb.no" ||
			// https://www.kansascity.com/entertainment/movies-news-reviews/14x5cd/picture115119338/alternates/FREE_1140/edge%20of%20seventeen(2)
			//   https://www.kansascity.com/entertainment/movies-news-reviews/14x5cd/picture115119338/BINARY/edge%20of%20seventeen(2)
			domain_nowww === "kansascity.com" ||
			// https://www.sanluisobispo.com/entertainment/movies-news-reviews/i9fla8/picture189785229/alternates/LANDSCAPE_160/COVER%201%20Zac%20Efron
			//   https://www.sanluisobispo.com/entertainment/movies-news-reviews/i9fla8/picture189785229/BINARY/COVER%201%20Zac%20Efron
			domain_nowww === "sanluisobispo.com" ||
			// https://www.star-telegram.com/living/home-garden/neil-sperry/bfdn9z/picture162479848/alternates/FREE_1140/Photo%202%20Arch%20adds%20more%20curves%20to%20Sperry%20landscape.%20Walk%20stones%20made%20at%20home
			domain_nowww === "star-telegram.com" ||
			// thanks to heptal on github (#83)
			// https://sportske.jutarnji.hr/incoming/dalic_moskva_pletikosajpg/9013841/alternates/FREE_680/Dalic_Moskva_pletikosa.jpg
			//   https://sportske.jutarnji.hr/incoming/dalic_moskva_pletikosajpg/9013841/alternates/BASE_FREE/Dalic_Moskva_pletikosa.jpg -- 1180x786
			//   https://sportske.jutarnji.hr/incoming/dalic_moskva_pletikosajpg/9013841/BINARY/Dalic_Moskva_pletikosa.jpg -- 2048x1365
			// https://www.jutarnji.hr/incoming/davorin_rudolf1-220316jpg/6319624/ALTERNATES/LANDSCAPE_380/davorin_rudolf1-220316.jpg
			//   https://www.jutarnji.hr/incoming/davorin_rudolf1-220316jpg/6319624/BINARY/davorin_rudolf1-220316.jpg
			domain_nosub === "jutarnji.hr" ||
			// https://www.oneman.gr/gynaikes/special_edition/article5512371.ece/ALTERNATES/w300/Eurovision1.jpg
			//   https://www.oneman.gr/gynaikes/special_edition/article5512371.ece/BINARY/Eurovision1.jpg
			domain_nowww === "oneman.gr" ||
			// https://th.thgim.com/migration_catalog/article10518620.ece/alternates/FREE_660/15mar_TCJPPHI-k+MA16_KERALA.jpg.jpg
			//   https://th.thgim.com/migration_catalog/article10518620.ece/BINARY/15mar_TCJPPHI-k+MA16_KERALA.jpg.jpg
			domain_nowww === "th.thgim.com" ||
			// https://www.thehindubusinessline.com/opinion/6hdv46/article27406353.ece/ALTERNATES/LANDSCAPE_1200/SMRITI
			domain_nowww === "thehindubusinessline.com" ||
			// https://d30fl32nd2baj9.cloudfront.net/media/2019/05/03/tundra-landscape.jpg/ALTERNATES/w640/tundra-landscape.jpg
			//   https://d30fl32nd2baj9.cloudfront.net/media/2019/05/03/tundra-landscape.jpg/BINARY/tundra-landscape.jpg
			domain === "d30fl32nd2baj9.cloudfront.net" ||
			// https://www.elsoldepuebla.com.mx/gossip/omg/z7ut9g-amanda-interior.jpg/ALTERNATES/FREE_768/Amanda%20interior.jpg
			//   https://www.elsoldepuebla.com.mx/gossip/omg/z7ut9g-amanda-interior.jpg/BINARY/Amanda%20interior.jpg
			domain_nowww === "elsoldepuebla.com.mx" ||
			// https://www.svensktnaringsliv.se/bilder_och_dokument/medarbetare-bilder/johan-britz-3jpg_637088.html/ALTERNATES/LANDSCAPE_1200/Johan%20Britz%203.jpg
			//   https://www.svensktnaringsliv.se/bilder_och_dokument/medarbetare-bilder/johan-britz-3jpg_637088.html/BINARY/Johan%20Britz%203.jpg
			domain_nowww === "svensktnaringsliv.se" ||
			// thanks to anonymous for reporting:
			// https://billeder.jyllands-posten.dk/pictures/image/3101765/u2bg6m/ALTERNATES/master-social/skadestuen-erer
			//   https://billeder.jyllands-posten.dk/pictures/image/3101765/u2bg6m/BINARY/skadestuen-erer
			(domain_nosub === "jyllands-posten.dk" && /\/pictures\/+image\/+[0-9]+\//.test(src)) ||
			src.match(/\/(?:article[0-9]+\.(?:ece|svt)|[0-9a-z]+\/+picture[0-9]{4,})\/+(?:[^/]*\/)?alternates\//i) ||
			src.match(/:\/\/i[0-9]*(?:-prod)?\..*\/article[^/]*\.(?:ece|svt)\//i)
			// https://www.independent.ie/world-news/article37114917.ece/ALTERNATES/h342/ipanews_2350b658-06c1-4a29-b747-cbfdcd1b624c_1
			//   https://www.independent.ie/world-news/article37114917.ece/BINARY/ipanews_2350b658-06c1-4a29-b747-cbfdcd1b624c_1
			// https://cdn-01.independent.ie/incoming/article35675982.ece/70a4f/AUTOCROP/w940/675787992.jpg
			//   https://cdn-01.independent.ie/incoming/article35675982.ece/70a4f/BINARY/675787992.jpg
			//domain_nosub === "independent.ie" // doesn't work anymore
			) {
			// http://www.thehindu.com/migration_catalog/article14926809.ece/alternates/FREE_660/30MPSQUIRREL
			// http://www.thehindu.com/migration_catalog/article14926809.ece/alternates/FREE_960/30MPSQUIRREL
			// http://www.thehindu.com/migration_catalog/article14926809.ece
			// http://www.thehindu.com/news/national/kerala/article22745555.ece/alternates/LANDSCAPE_100/Priya
			// http://www.thehindu.com/news/national/kerala/article22745555.ece/alternates/FREE_460/Priya
			// https://i2-prod.mirror.co.uk/incoming/article7024597.ece/ALTERNATES/s615/PAY-Three-cute-squirrels-CUDDLING.jpg
			// https://i2-prod.mirror.co.uk/incoming/article236507.ece/ALTERNATES/s615/FA8A36EC-B0C4-D13B-383835E6F08D4428.jpg
			// https://i2-prod.mirror.co.uk/incoming/article11181827.ece/ALTERNATES/s615b/PROD-JRP_LEC_140117lsquirral_002JPG.jpg
			// https://i2-prod.mirror.co.uk/incoming/article11691534.ece/ALTERNATES/s1227b/PAY-SQUIRREL-AND-BIRD.jpg
			// https://i2-prod.mirror.co.uk/incoming/article11691532.ece/ALTERNATES/s1227b/PAY-SQUIRREL-AND-BIRD.jpg
			// https://i2-prod.mirror.co.uk/incoming/article5603898.ece/ALTERNATES/s1200/PAY-Squirrels.jpg
			// https://i2-prod.mirror.co.uk/incoming/article11263183.ece/ALTERNATES/s1168v/VIDEO-SQUIRREL.jpg
			// https://i2-prod.mirror.co.uk/incoming/article12021721.ece/ALTERNATES/s1176b/MGP_MDG_1302182281JPG.jpg
			// https://i2-prod.mirror.co.uk/incoming/article12021243.ece/ALTERNATES/s270b/MAIN-paddy.jpg
			// https://i2-prod.mirror.co.uk/incoming/article8949472.ece/ALTERNATES/s270b/National-Lottery-Euromillions-ticket.jpg
			//   https://i2-prod.mirror.co.uk/incoming/article8949472.ece/ALTERNATES/s810/National-Lottery-Euromillions-ticket.jpg
			// https://i2-prod.mirror.co.uk/incoming/article12021158.ece/ALTERNATES/s508/RIP-Pizza-Express-give-away-free-meals-to-certain-customers-who-do-this-one-thing.jpg
			//   https://i2-prod.mirror.co.uk/incoming/article12021158.ece/ALTERNATES/s615/RIP-Pizza-Express-give-away-free-meals-to-certain-customers-who-do-this-one-thing.jpg
			//   https://i2-prod.mirror.co.uk/incoming/article12021158.ece/ALTERNATES/s810/RIP-Pizza-Express-give-away-free-meals-to-certain-customers-who-do-this-one-thing.jpg
			//   https://i2-prod.mirror.co.uk/incoming/article12021158.ece/ALTERNATES/s1200/RIP-Pizza-Express-give-away-free-meals-to-certain-customers-who-do-this-one-thing.jpg
			// https://i2-prod.mirror.co.uk/incoming/article4997473.ece/ALTERNATES/s298/Actress-Felicity-Jones.jpg
			// http://www.dailymirror.lk/article/Rare-albino-squirrel-posing-in-his-white-suit--126748.html
			//   http://static.dailymirror.lk/media/images/image_1491276569-ba3932b3dc.jpg
			//   http://static.dailymirror.lk/media/images/image_1491276584-77a6a42e37.jpg
			//   http://static.dailymirror.lk/media/images/image_1491276594-bc6ed40255.jpg
			// https://i2-prod.birminghammail.co.uk/news/midlands-news/article8438687.ece/ALTERNATES/s615b/Felicity-Jones-The-Worst-Witch.jpg
			//   https://i2-prod.birminghammail.co.uk/news/midlands-news/article8438687.ece/BINARY/Felicity-Jones-The-Worst-Witch.jpg
			// https://i2-prod.mirror.co.uk/incoming/article9801836.ece/ALTERNATES/s810/SUNDAYPEOPLE-PROD-Tara-Palmer-Tomkinson.jpg
			// https://i2-prod.mirror.co.uk/incoming/article7009917.ece/BINARY/CS85701845-1.png
			// https://i2-prod.dailypost.co.uk/incoming/article12849370.ece/binary/BigBubble.jpg
			// https://i2-prod.bristolpost.co.uk/incoming/article1143957.ece/BINARY/Elise-Britten-profile-pic-square.jpg
			// https://www.gloria.hr/moda/novosti/naomicampbell01jpg/6949668/alternates/FREE_580/NaomiCampbell01.jpg
			// doesn't work for all:
			// https://www.inforum.com/entertainment/article542555.ece/alternates/BASE_LANDSCAPE/Herbs%20like%20dill%20can%20make%20a%20nice%20addition%20to%20an%20edible%20landscape.%20%20Photo%20special%20to%20The%20Forum.%20
			//   https://www.inforum.com/entertainment/article542555.ece/BINARY/Herbs%20like%20dill%20can%20make%20a%20nice%20addition%20to%20an%20edible%20landscape.%20%20Photo%20special%20to%20The%20Forum.%20 -- 404
			// https://www.fccnn.com/incoming/886099-A-row-of-wind-turbines-towers-over-the-landscape-near-Edgeley-N.D.-in-this-file-photo.-Darren-Gibbins-Forum-News-Service/alternates/BASE_LANDSCAPE/A%20row%20of%20wind%20turbines%20towers%20over%20the%20landscape%20near%20Edgeley%2C%20N.D.%20Darren%20Gibbins%20%20Forum%20News%20Service
			//   https://www.fccnn.com/incoming/886099-A-row-of-wind-turbines-towers-over-the-landscape-near-Edgeley-N.D.-in-this-file-photo.-Darren-Gibbins-Forum-News-Service/BINARY/A%20row%20of%20wind%20turbines%20towers%20over%20the%20landscape%20near%20Edgeley%2C%20N.D.%20Darren%20Gibbins%20%20Forum%20News%20Service -- 404, similar layout to above?
			//return src.replace(/(\/article[0-9]*\.ece\/.*?)(?:alternates|ALTERNATES|AUTOCROP|autocrop)\/[^/]*\//, "$1BINARY/");
			newsrc = src.replace(/(?:alternates|autocrop|binary)\/+[^/]*\/+([^/]*)$/i, "BINARY/$1");
			if (newsrc !== src)
				return newsrc;

			newsrc = src.replace(/\/representations\/+[^/]*\/+([^/]*)(?:[?#].*)?$/i, "/BINARY/$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nowww === "ekstrabladet.dk") {
			// https://ekstrabladet.dk/incoming/urkamg/6524751/IMAGE_ALTERNATES/relationSmall_150/reality-awards
			//   https://ekstrabladet.dk/incoming/urkamg/6524751/IMAGE_BINARY/original/reality-awards
			return src.replace(/\/IMAGE_ALTERNATES\/+[^/]*\/+/, "/IMAGE_BINARY/original/");
		}

		if (domain_nowww === "tvn.pl") {
			// thanks to anonymous for reporting:
			// https://tvn.pl/programy/true-love/cdn-zdjecie-nzgzne-true-love-6719570/alternates/LANDSCAPE_840
			//   https://tvn.pl/programy/true-love/cdn-zdjecie-nzgzne-true-love-6719570/BINARY
			// https://tvn.pl/programy/true-love/cdn-zdjecie-nzgzne-true-love-6719570/alternates/LANDSCAPE_840/test
			//   https://tvn.pl/programy/true-love/cdn-zdjecie-nzgzne-true-love-6719570/BINARY/test
			return src.replace(/\/alternates\/+[A-Z]+_[0-9]+(\/.*)?$/, "/BINARY$1");
		}

		if (domain === "images.fandango.com" ||
			// http://www.statf.com/ImageRenderer/0/0/redesign/static/img/default_poster.png/0/images/masterrepository/other/INTRO-1_Getty_139033234.jpg
			//   http://www.statf.com/images/masterrepository/other/INTRO-1_Getty_139033234.jpg
			domain_nowww === "statf.com") {
			// no noticeable change though
			// https://images.fandango.com/ImageRenderer/0/0/redesign/static/img/default_poster.png/0/images/masterrepository/performer%20images/p237485/thetempest2010-mv-19.jpg
			//   https://images.fandango.com/images/masterrepository/performer%20images/p237485/thetempest2010-mv-19.jpg
			// http://images.fandango.com/ImageRenderer/0/0/redesign/static/img/default_poster.png/0/images/masterrepository/performer%20images/p237485/felicityjones-cheri-7.jpg
			//   http://images.fandango.com/images/masterrepository/performer%20images/p237485/felicityjones-cheri-7.jpg
			newsrc = src.replace(/\/ImageRenderer\/.*?\/images\//, "/images/");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "images.fandango.com") {
			// http://images.fandango.com/mdcsite/images/featured/201612/felicity-jones-rogue-one_188x188.jpg
			//   http://images.fandango.com/mdcsite/images/featured/201612/felicity-jones-rogue-one.jpg
			return src.replace(/_[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1");
		}

		if (amazon_container === "assets.forward.com") {
			// https://s3.amazonaws.com/assets.forward.com/images/cropped/gettyimages-655344102-1500478034.jpg
			//   http://assets.forward.com/images/gettyimages-655344102-1500478034.jpg
			return src.replace(/.*:\/\/[^/]*\//, "http://");
		}

		if (domain === "assets.forward.com" ||
			// https://assets.forwardcdn.com/images/cropped/1020-5-1524514529.jpeg
			//   https://assets.forwardcdn.com/images/1020-5-1524514529.jpeg
			domain === "assets.forwardcdn.com") {
			// http://assets.forward.com/images/cropped/gettyimages-655344102-1500478034.jpg
			//   http://assets.forward.com/images/gettyimages-655344102-1500478034.jpg
			return src.replace(/\/images\/cropped\//, "/images/");
		}

		if (domain_nowww === "thejewelleryeditor.com") {
			// http://www.thejewelleryeditor.com/media/images_thumbnails/filer_public_thumbnails/old/21228/Felicity-Jones-Finch-Oscars-2013.jpg__1536x0_q75_crop-scale_subsampling-2_upscale-false.jpg - stretched
			//   http://www.thejewelleryeditor.com/media/images/old/21228/Felicity-Jones-Finch-Oscars-2013.jpg
			return src.replace(/\/images_thumbnails\/+[^/]*_thumbnails\/+([^/]*\/+[0-9]*\/+[^/.]*\.[^_/.]*)__[^/]*(?:[?#].*)?$/, "/images/$1");
		}

		if (domain_nowww === "sass.com.ua" ||
			// thanks to roi:
			// https://media.globalcitizen.org/thumbnails/e2/bf/e2bfb436-b68c-43f3-8e4c-9ebac4a4280f/elladj_hudson_0590.jpeg__1600x900_q85_crop_subsampling-2.jpg
			//   https://media.globalcitizen.org/e2/bf/e2bfb436-b68c-43f3-8e4c-9ebac4a4280f/elladj_hudson_0590.jpeg
			domain === "media.globalcitizen.org" ||
			// thanks to anonymous for reporting:
			// https://www.kexp.org/media/filer_public_thumbnails/filer_public/7c/66/7c669136-fb7a-4164-b2f5-909b01453468/miapw_flight_facilities-web.png__800x500_q85_crop_subject_location-714%2C250_subsampling-2_upscale.jpg
			//   https://www.kexp.org/media/filer_public/7c/66/7c669136-fb7a-4164-b2f5-909b01453468/miapw_flight_facilities-web.png
			(domain_nowww === "kexp.org" && /:\/\/[^/]+\/+media\//.test(src)) ||
			// https://bento.cdn.pbs.org/hostedbento-prod/filer_public_thumbnails/filer_public/latinmusicusa/Artists/selena_16x9.jpg__1024x576_q85_subsampling-2.jpg
			//   https://bento.cdn.pbs.org/hostedbento-prod/filer_public/latinmusicusa/Artists/selena_16x9.jpg
			domain === "bento.cdn.pbs.org") {
			// https://sass.com.ua/static/media/public_thumbnails/public/2017/11/11/03.jpg__1024x1024_q85_subsampling-2.jpg
			//   https://sass.com.ua/static/media/public/2017/11/11/03.jpg
			return src.replace(/\/(?:filer_)?(?:public_)?thumbnails\/+(.*\/[^/]*?\.[a-z]+)__[^/]*(?:[?#].*)?$/, "/$1");
		}

		if (domain === "files.sharenator.com") {
			// https://files.sharenator.com/felicity-jones-s3504x4800-453760-1020.jpg
			//   https://files.sharenator.com/felicity-jones-s3504x4800-453760.jpg
			//   https://files.sharenator.com/453760.jpg -- 3504x4800
			// https://files.sharenator.com/jessica-alba-s700x1001-432323.jpg
			//   https://files.sharenator.com/432323.jpg -- 700x1001
			return src.replace(/(:\/\/[^/]*\/)[^/.]+-s[0-9]+x[0-9]+-([0-9]{4,})(?:-[0-9]*)?(\.[^/.]*)$/, "$1$2$3");
		}

		if (domain === "cdn.jolie.de" ||
			// https://cdn.maedchen.de/51531-726241-1/image360w/emma-watson-getty-images-300x500-1122033.jpg
			//   https://cdn.maedchen.de/51531-726241-1/original/emma-watson-getty-images-300x500-1122033.jpg
			domain === "cdn.maedchen.de") {
			// http://cdn.jolie.de/297989-4137908-2/image160w/felicity-jones-oscars-2017.jpg
			//   http://cdn.jolie.de/297989-4137908-2/original/felicity-jones-oscars-2017.jpg
			return src.replace(/\/image[0-9]*[wh]\//, "/original/");
		}

		if (domain === "img.mp.itc.cn" ||
			// http://wallpapercraze.com/images/wallpapers/02_CGI_Robert_Downey_Jr_th.png
			//   http://wallpapercraze.com/images/wallpapers/02_CGI_Robert_Downey_Jr.png
			(domain_nowww === "wallpapercraze.com" && string_indexof(src, "/images/wallpapers/") >= 0) ||
			// http://img.mp.sohu.com/upload/20170512/af6d692d7b6b493b9c3e002db2feebd1_th.png
			//   http://img.mp.sohu.com/upload/20170512/af6d692d7b6b493b9c3e002db2feebd1.png
			domain === "img.mp.sohu.com") {
			// http://img.mp.itc.cn/upload/20170227/aa7bad178ad94c1e94428c87b6227fc7_th.jpeg
			//   http://img.mp.itc.cn/upload/20170227/aa7bad178ad94c1e94428c87b6227fc7.jpeg
			return src.replace(/_th(\.[^/.]*)$/, "$1");
		}

		if (domain_nosub === "qpic.cn" ||
			// thanks to doio on github: https://github.com/qsniyg/maxurl/issues/1039
			// https://wx.qlogo.cn/mmhead/l9wBIj25RSIYlPTnn3LJQtvc6MtvYQic0MoR91agezsw/132
			//   https://wx.qlogo.cn/mmhead/l9wBIj25RSIYlPTnn3LJQtvc6MtvYQic0MoR91agezsw/0
			// http://wx.qlogo.cn/mmopen/aXUpZVUYfjw3n5ZtyC7CB16NMTmib2QqWiaEz4c1hbtIY39AMVnopBrliadL0sgKgItyMTadNTLUMyqAq1yyuicx4F8PQD69KxdC/96
			//   http://wx.qlogo.cn/mmopen/aXUpZVUYfjw3n5ZtyC7CB16NMTmib2QqWiaEz4c1hbtIY39AMVnopBrliadL0sgKgItyMTadNTLUMyqAq1yyuicx4F8PQD69KxdC/0
			domain === "wx.qlogo.cn") {
			// http://mmbiz.qpic.cn/mmbiz_jpg/HiaNy8LPboMwzXqYuvrlHAicCbwUffgUbjY2EgQa81icMQxeKHeG5dTmhupXk7MKHibwKQAtNxEbeceH7elpaTT2fw/640?wx_fmt=jpeg&_ot=1514246400129
			// https://puui.qpic.cn/vcover_vt_pic/0/7m7cvdfbslfme4u1478827029/260
			// http://t3.qpic.cn/mblogpic/afb2a8f5fc3b14b0015e/0
			//   http://t3.qpic.cn/mblogpic/afb2a8f5fc3b14b0015e/2000
			// http://mmbiz.qpic.cn/mmbiz_jpg/BKb3XsZIgQaRTBiaocsuNJlzpfAqVOx8kzJRt8icY75kPjiaD42TE7F75Vf5xicn0L8YKQ2FYpFK2znwMfBSKWCAsg/640.jpeg
			//   http://mmbiz.qpic.cn/mmbiz_jpg/BKb3XsZIgQaRTBiaocsuNJlzpfAqVOx8kzJRt8icY75kPjiaD42TE7F75Vf5xicn0L8YKQ2FYpFK2znwMfBSKWCAsg/0
			if (src.match(/\/mblogpic\//))
				return {
					url: src.replace(/\/[0-9]*(?:\.[^/.]*)?(?:\?.*)?$/, "/2000"),
					headers: {
						Referer: "" // if not, it redirects to t100.qpic.cn, which doesn't work
					}
				};

			return src.replace(/\/[0-9]*(?:\.[^/.]*)?(?:\?.*)?$/, "/0");
		}

		if ((domain_nosub === "49qmz.com" ||
			 // http://img1.ii77.com/mmbiz_jpg/OBQWTDeVLCNaib0HP024ucQ9A58IVjEes79snzkTRnI2nBpRYrkIRcKHveGb6XdKDtIrD8K8UtXBnNtibLOjPrCg/640?wx_fmt=jpeg
			 //   http://mmbiz.qpic.cn/mmbiz_jpg/OBQWTDeVLCNaib0HP024ucQ9A58IVjEes79snzkTRnI2nBpRYrkIRcKHveGb6XdKDtIrD8K8UtXBnNtibLOjPrCg/0
			 domain_nosub === "ii77.com" ||
			 // http://img1.vhaor.com/mmbiz_jpg/Keiao0PZ6AuK6HmUvlxH25mwI1FQ1kbicMzSwX70C1KojImoefyiclDcWIcIO5oUfmicMRz1KpkMk9HjPIzciaBV3ow/0?wx_fmt=jpeg
			 //   http://mmbiz.qpic.cn/mmbiz_jpg/Keiao0PZ6AuK6HmUvlxH25mwI1FQ1kbicMzSwX70C1KojImoefyiclDcWIcIO5oUfmicMRz1KpkMk9HjPIzciaBV3ow/0
			 domain_nosub === "vhaor.com")
			&& domain.match(/^img[0-9]*\./)) {
			// http://img1.49qmz.com/mmbiz_jpg/Cf63e80XA9vKicOgBW17jh3FpL6rUiczfspSKgDuJYlTeZ6icWhqlL5YibMRuXaaLeInw2jr2Dj0p2rWbZtMYhhGjw/640?wx_fmt=jpeg
			//   http://mmbiz.qpic.cn/mmbiz_jpg/Cf63e80XA9vKicOgBW17jh3FpL6rUiczfspSKgDuJYlTeZ6icWhqlL5YibMRuXaaLeInw2jr2Dj0p2rWbZtMYhhGjw/0
			return src.replace(/:\/\/[^/]*\/mmbiz_jpg\//, "://mmbiz.qpic.cn/mmbiz_jpg/");
		}

		if (domain_nowww === "vod.lu" && /\/media\/+cache\//.test(src)) {
			// https://github.com/liip/LiipImagineBundle/issues/912 related?

			// http://www.vod.lu/media/cache/resolve/400x225/97/0c/970c16f8-fd8f-11e6-823c-d10fb8a0c611.jpg
			//   http://www.vod.lu/media/cache/resolve/9999999x9999999/97/0c/970c16f8-fd8f-11e6-823c-d10fb8a0c611.jpg
			//   http://www.vod.lu/media/97/0c/970c16f8-fd8f-11e6-823c-d10fb8a0c611.jpg
			// http://www.vod.lu/media/cache/190x253/92/7d/927da5b5-fd8f-11e6-9eab-ed7742afa678.jpg
			//   http://www.vod.lu/media/cache/9999999x9999999/92/7d/927da5b5-fd8f-11e6-9eab-ed7742afa678.jpg
			//   http://www.vod.lu/media/92/7d/927da5b5-fd8f-11e6-9eab-ed7742afa678.jpg
			//return src.replace(/\/media\/+cache\/+(?:resolve\/+)?[0-9]+x[0-9]+\//, "/media/cache/$19999999x9999999/");
			return src.replace(/\/media\/+cache\/+(?:resolve\/+)?[0-9]+x[0-9]+\/+/, "/media/");
		}

		if (domain_nowww === "vogue.ua") {
			// https://vogue.ua/media/cache/resolve/inline_620x/uploads/article-inline/319/d10/af8/56b9af8d10319.jpeg
			//   https://vogue.ua/cache/inline_620x/uploads/article-inline/319/d10/af8/56b9af8d10319.jpeg
			// https://vogue.ua/cache/gallery_x1160_watermark/uploads/image/dc0/ab2/a48/58b3a48ab2dc0.jpeg
			//   https://vogue.ua/uploads/image/dc0/ab2/a48/58b3a48ab2dc0.jpeg
			// https://vogue.ua/cache/gallery_x315_watermark/upload/photogallery/139961_original.jpg
			//   https://vogue.ua/upload/photogallery/139961_original.jpg
			return src
				.replace(/\/media\/+cache\/+resolve\//, "/cache/")
				.replace(/\/cache\/+[^/]+\/+(uploads?)\//, "/$1/");
		}

		if (false && domain === "bt.bmcdn.dk") {
			// https://bt.bmcdn.dk/media/cache/resolve/image_420/image/103/1032257/17913568-.jpg
			//   https://bt.bmcdn.dk/media/cache/resolve/image/image/103/1032257/17913568-.jpg
			// doesn't work:
			// https://bdk.bmcdn.dk/media/cache/resolve/image_910x511/image/97/976522/21478831-isfjeld-grundstdt-lige-uden-f.jpeg
			// https://bt.bmcdn.dk/media/cache/resolve/image_1240/image/149/1492339/23433335-.jpg
			//   https://bt.bmcdn.dk/media/cache/resolve/image/image/149/1492339/23433335-.jpg -- cropped
			// other:
			// https://bt.bmcdn.dk/users/berlingske/images/44939310.jpg?t%5Bstrip%5D=true&t%5Bcrop%5D%5Bx%5D=0&t%5Bcrop%5D%5By%5D=0&t%5Bcrop%5D%5Bwidth%5D=1280&t%5Bcrop%5D%5Bheight%5D=668&t%5Bresize%5D%5Bwidth%5D=940&t%5Bresize%5D%5Bheight%5D=491&accessToken=21db3e8dfcf1e874aeeed40e9aa471ade6f4020cc8b578e8c8558231aa103520
			//   decoded: "t[strip]=true&t[crop][x]=0&t[crop][y]=0&t[crop][width]=1280&t[crop][height]=668&t[resize][width]=940&t[resize][height]=491&accessToken=21db3e8dfcf1e874aeeed40e9aa471ade6f4020cc8b578e8c8558231aa103520 -- accessToken = signature
			// https://bt.bmcdn.dk/media/cache/resolve/image_1240/image/118/1185031/21897833-frede.jpg -- last part cannot be modified
			// http://i4.disp.cc/t/s2/berlingske.bmcdn.dk/f94f032f8652ec22f2754ad31e4a5960.jpg
			// pair:
			// https://bt.bmcdn.dk/users/berlingske/images/45639917.jpg?t%5Bstrip%5D=true&t%5Bcrop%5D%5Bx%5D=0&t%5Bcrop%5D%5By%5D=133&t%5Bcrop%5D%5Bwidth%5D=1240&t%5Bcrop%5D%5Bheight%5D=575&t%5Bresize%5D%5Bwidth%5D=940&t%5Bresize%5D%5Bheight%5D=436&accessToken=...
			//   https://bt.bmcdn.dk/media/cache/resolve/image_1240/image/164/1645752/23719571-nyhavn-3.jpg
			return src.replace(/\/image_[0-9]+(?:x[0-9]+)?\/+image\//, "/image/image/");
		}

		if (domain_nosub === "blogspot.es") {
			// http://creaeventos.blogspot.es/cache/media/files/00/248/376/2014/05/lupita-nyongo-met-gala-2014.jpg -- 600x822
			//   http://creaeventos.blogspot.es/files/00/248/376/2014/05/lupita-nyongo-met-gala-2014.jpg -- 747x1024
			// http://girlpotatolistas.blogspot.es/media/cache/resolve/media/files/01/140/838/2016/05/shingeki-no-kyojin-574-1365335049.jpg
			//   http://girlpotatolistas.blogspot.es/files/01/140/838/2016/05/shingeki-no-kyojin-574-1365335049.jpg
			return src.replace(/(?:\/media)?\/+cache\/+(?:resolve\/+)?media\/+files\//, "/files/");
		}

		if (domain === "csn.naekranie.pl") {
			// https://csn.naekranie.pl/media/cache/resolve/thumb-big/2017/01/Shot-31_129_R5_2.jpg
			//   https://csn.naekranie.pl/media/cache/thumb-big/2017/01/Shot-31_129_R5_2.jpg
			//   https://csn.naekranie.pl/wp-content/uploads/2017/01/Shot-31_129_R5_2.jpg
			return src.replace(/\/media\/+cache\/+(?:resolve\/+)?[^/]*\/+([0-9]{4}\/+[0-9]{2}\/+)/,
							   "/wp-content/uploads/$1");
		}

		if (domain === "imagesvc.timeincuk.net" ||
			// https://imagesvc.meredithcorp.io/v3/mm/image?url=https%3A%2F%2Fimages.hellogiggles.com%2Fuploads%2F2019%2F01%2F18152040%2Fariana-grande-seven-rings.jpg&w=450&c=sc&poi=face&q=85
			//   https://images.hellogiggles.com/uploads/2019/01/18152040/ariana-grande-seven-rings.jpg
			// http://imagesvc.meredithcorp.io/v3/tardis/image?url=https%3A%2F%2Fpeopledotcom.files.wordpress.com%2F2019%2F09%2Fleamichele_02.jpg&h=1000&amp;f=jpg&amp;q=80
			//   https://peopledotcom.files.wordpress.com/2019/09/leamichele_02.jpg
			domain === "imagesvc.meredithcorp.io") {
			// https://imagesvc.timeincuk.net/v3/keystone/image?w=441&url=http://ksassets.timeincuk.net/wp/uploads/sites/46/2016/12/Felicity-Jonesw-style-file-december-2016.jpg&q=82
			return decodeuri_ifneeded(src.replace(/^[a-z]+:\/\/[^/]*\/v3\/+[a-z]+\/+image.*?[?&]url=([^&]*).*/, "$1"));
		}

		if (domain === "img.timeinc.net") {
			// http://img.timeinc.net/time/daily/2010/1003/360_afestival_0315.jpg
			//   http://img.timeinc.net/time/daily/2010/1003/afestival_0315.jpg
			// http://img.timeinc.net/time/daily/2010/1011/360_br10q_1129.jpg -- upscaled?
			//   http://img.timeinc.net/time/daily/2010/1011/br10q_1129.jpg
			return src.replace(/\/[0-9]+_([^/_]+_[0-9]+(?:_[^/]*)?\.[^/.]*)$/, "/$1");
		}

		if (domain === "i.ksd-i.com") {
			// http://i.ksd-i.com/s/800_86400_8a0ec3922bafcaa900bb552e00d9685c/static.koreastardaily.com/2014-08-22/46572-256196.jpg
			//   http://static.koreastardaily.com/2014-08-22/46572-256196.jpg
			//   https://a.ksd-i.com/a/2014-08-22/46572-256196.jpg
			return src.replace(/^[a-z]+:\/\/[^/]*\/+s\/+[0-9]+_[0-9]+_[0-9a-f]+\/+/, "http://");
		}

		if (domain === "a.ksd-i.com") {
			// https://a.ksd-i.com/s/160l_86400_82d10665e8e8ca12632547568577442d/static.koreastardaily.com/2017-10-24/99264-550368.jpg
			// https://a.ksd-i.com/s/480x_86400_53c96fbf9a6baa55c9b527dcbeb4928e/static.koreastardaily.com/2017-10-24/99264-550368.jpg
			//   http://static.koreastardaily.com/2017-10-24/99264-550368.jpg
			// https://a.ksd-i.com/s/160l_86400_aaf286b862dc657320f390e272bd7cb8/static.koreastardaily.com/2017-06-26/95799-521086.jpg
			// https://a.ksd-i.com/s/480x_86400_63072b0849030d169deca9872c37d761/static.koreastardaily.com/2017-10-24/99264-550364.jpg
			return src.replace(/.*:\/\/[^/]*\/s\/[^/]*\//, "http://");
		}

		if (domain === "static.koreastardaily.com") {
			// http://static.koreastardaily.com/2017-04-13/93388-506687.jpg
			//   https://a.ksd-i.com/a/2017-04-13/93388-506687.jpg -- same (but HTTPS)
			return src.replace(/.*:\/\/[^/]*\/([0-9]+-[0-9]+-[0-9]+\/[0-9]+-[0-9]+\.[^/.]*)$/, "https://a.ksd-i.com/a/$1");
		}

		if (domain === "pic.pimg.tw") {
			// https://pic.pimg.tw/silvia17895/1518597084-877783212_n.jpg
			//   https://pic.pimg.tw/silvia17895/1518597084-877783212.jpg
			// http://pic.pimg.tw/kflim/normal_4a56a95bbedef.jpg
			//   http://pic.pimg.tw/kflim/4a56a95bbedef.jpg
			// https://pic.pimg.tw/typhoon1212/1528283365-3372533556_wn.jpg
			//   https://pic.pimg.tw/typhoon1212/1528283365-3372533556.jpg
			// (none, l), b, m, n, q, s, t
			return src
				.replace(/\/[a-z]+_([0-9a-f]+\.[^/.]*)(?:[?#].*)?$/, "/$1")
				.replace(/_w?[a-z](\.[^/]*)$/, "$1");
		}

		if (domain === "imageproxy.pimg.tw") {
			// https://imageproxy.pimg.tw/zoomcrop?url=http%3A%2F%2Fimage.newsis.com%2F2013%2F06%2F21%2FNISI20130621_0008354474_web.jpg&width=380&height=228
			//   http://image.newsis.com/2013/06/21/NISI20130621_0008354474_web.jpg
			// https://imageproxy.pimg.tw/resize?url=https%3A%2F%2Ffarm5.staticflickr.com%2F4597%2F39252323662_13f70176d7_c.jpg&maxwidth=500&maxheight=350
			//   https://farm5.staticflickr.com/4597/39252323662_13f70176d7_c.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+(?:zoomcrop|resize)\?(?:.*?&)?url=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "images.sidearmdev.com") {
			// thanks to roi:
			// https://images.sidearmdev.com/resize?url=https%3a%2f%2fdxbhsrqyrr690.cloudfront.net%2fsidearm.nextgen.sites%2friceowls.com%2fimages%2f2012%2f10%2f14%2f6580785.jpeg&width=1416&type=jpeg
			//   https://dxbhsrqyrr690.cloudfront.net/sidearm.nextgen.sites/riceowls.com/images/2012/10/14/6580785.jpeg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+resize\?(?:.*?&)?url=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nowww === "helloidol.com" &&
			string_indexof(src, "/script/get_pic.php") >= 0) {
			// http://www.helloidol.com/script/get_pic.php?src=https://1.bp.blogspot.com/-iblNAdULcFY/WnkEGyGjySI/AAAAAAAADHQ/pgVIIcLeHOo6IngbASGuakOIpxBwHr8dACLcBGAs/s1600/Eulachacha-Waikiki.jpg&h=256&w=400&zc=1
			return src.replace(/.*\/script\/get_pic\.php.*?[?&]src=([^&]*).*?$/, "$1");
		}

		if (domain === "yams.akamaized.net" &&
			string_indexof(src, "/Assets/") >= 0) {
			// https://yams.akamaized.net/Assets/56/610/p0082761056.jpg
			return src.replace(/\/(?:[^/._]*_)?([^/_]*)$/, "/l_$1");
		}

		if (domain_nosub === "pixpo.net" && domain.match(/img[0-9]\.pixpo\.net/)) {
			// https://img1.pixpo.net/img/da/4/0dwxci32wc/sg_0DwXCi32Wc_t324x216.jpg
			//   https://img1.pixpo.net/img/da/4/0dwxci32wc/sg_0DwXCi32Wc.jpg
			return src.replace(/_t[0-9]+x[0-9]+(\.[^/.]*)$/, "$1");
		}

		if (domain === "www.mirrormedia.mg" &&
			string_indexof(src, "/assets/images/") >= 0) {
			// https://www.mirrormedia.mg/assets/images/20170626110017-7cd692da02e985b28918adaf10d858ad-desktop.jpg
			return src.replace(/-desktop(\.[^/.]*)$/, "$1");
		}

		if (domain_nosub === "kknews.cc" && domain.match(/i[0-9]*\.kknews\.cc/)) {
			// https://i1.kknews.cc/SIG=32hj89t/p6700021qr20759nn46_s.jpg
			//   https://i1.kknews.cc/SIG=32hj89t/p6700021qr20759nn46.jpg
			return src.replace(/_[a-z]*(\.[^/.]*)$/, "$1");
		}

		if (domain === "resource.holyshare.com.tw") {
			// http://resource.holyshare.com.tw/uploads/article/85x65/1443691071QSo_1.png
			// http://resource.holyshare.com.tw/uploads/article/600x0/1413181844EmZ_1.jpg
			return src.replace(/\/article\/[0-9]*x[0-9]*\//, "/article/");
		}

		if (domain_nowww === "kyeongin.com") {
			// http://www.kyeongin.com/mnt/file_m/201802/2018021501001103400052931.jpg
			//   http://www.kyeongin.com/mnt/file/201802/2018021501001103400052931.jpg
			// http://www.kyeongin.com/mnt/thum/201903/20190326001657091_1.jpg
			//   http://www.kyeongin.com/mnt/file/201903/20190326001657091_1.jpg
			// http://www.kyeongin.com/mnt/file/201704/20170425010008610_1.jpg
			//   http://www.kyeongin.com/mnt/org/201704/20170425010008610_1.jpg
			// other:
			// http://www.kyeongin.com/mnt/file/201908/2019082701001971400094231.jpg
			//   http://www.kyeongin.com/main/view.php?key=20190827010009423
			var extra = {};
			match = src.match(/^[a-z]+:\/\/[^/]+\/+mnt\/+[^/]+\/+[0-9]{6}\/+([0-9]{17})(?:_[0-9]+)?\.[^/.]+(?:[?#].*)?$/);
			if (match) {
				extra.page = "http://www.kyeongin.com/main/view.php?key=" + match[1];
			}

			regex = /\/mnt\/+(?:thum|file(?:_[a-z]+)?)\/+/;
			if (regex.test(src)) {
				// FIXME: for some reason deepcopy(extra) is needed when using an array?
				return [
					{
						url: src.replace(regex, "/mnt/org/"),
						extra: deepcopy(extra)
					},
					{
						url: src.replace(regex, "/mnt/file/"),
						extra: deepcopy(extra)
					}
				];
			} else {
				return {
					url: src,
					extra: extra
				};
			}
			//return src.replace("/file_m/", "/file/");
		}

		if (domain_nowww === "wallpaperup.com") {
			// https://www.wallpaperup.com/uploads/wallpapers/2013/04/05/70727/793b48d70207428a317f912ac9f1342e-250.jpg
			//   https://www.wallpaperup.com/uploads/wallpapers/2013/04/05/70727/793b48d70207428a317f912ac9f1342e.jpg
			return src.replace(/-[0-9]+(\.[^/.]*)$/, "$1");
		}

		if ((domain_nosub === "wallhere.com" ||
			 domain_nosub === "pxhere.com") &&
			domain.match(/^[a-z]*\./)) {
			// https://c.wallhere.com/photos/e2/9a/women_brunette_model_Marina_Shimkovich_window_sill_jean_shorts_legs_barefoot-285016.jpg!d
			//   https://get.wallhere.com/photo/women_brunette_model_Marina_Shimkovich_window_sill_jean_shorts_legs_barefoot-285016.jpg
			// https://get.wallhere.com/photo/Asian-Sunny-Girls-Generation-SNSD-Person-Kwon-Yuri-Jessica-Jung-Im-Yoona-Choi-Sooyoung-Kim-Taeyeon-Kim-Hyoyeon-Seohyun-Tiffany-Hwang-finger-2560x1600-px-523643.jpg
			//   https://get.wallhere.com/photo/Asian-Sunny-Girls-Generation-SNSD-Person-Kwon-Yuri-Jessica-Jung-Im-Yoona-Choi-Sooyoung-Kim-Taeyeon-Kim-Hyoyeon-Seohyun-Tiffany-Hwang-finger-523643.jpg
			// https://get.wallhere.com/photo/5333x3000-px-Girls-Generation-K-pop-Korean-Lee-Soonkyu-Sunny-989174.jpg
			//   https://get.wallhere.com/photo/Girls-Generation-K-pop-Korean-Lee-Soonkyu-Sunny-989174.jpg
			// https://c.pxhere.com/photos/73/fc/women_model_sauna_beauty_girl_pretty_sexy_woman_photography-696156.jpg!s
			//   https://get.pxhere.com/photo/women_model_sauna_beauty_girl_pretty_sexy_woman_photography-696156.jpg
			// https://c.pxhere.com/images/38/fe/762e69512e53d94f4b4711f60d0e-1419055.png!s
			//   https://get.pxhere.com/photo/762e69512e53d94f4b4711f60d0e-1419055.png
			return src
				.replace(/[a-z]*\.wallhere\.com/, "get.wallhere.com")
				.replace(/[a-z]*\.pxhere\.com/, "get.pxhere.com")
				.replace(/\/(?:photos|images)\/[0-9a-f]*\/[0-9a-f]*\/([^/.]*\.[^/.!]*).*?$/, "/photo/$1")
				.replace(/\/[0-9]+x[0-9]+-px-([^/]*)$/, "/$1")
				.replace(/-[0-9]+x[0-9]+-px-([0-9]+\.[^/.]*)$/, "-$1");
		}

		if (domain === "img.grouponcdn.com") {
			// https://img.grouponcdn.com/deal/nx2giiTu5SBQbemLQteLqW/shutterstock_140728459-2-1500x900/v1/c300x182.jpg
			return src.replace(/\/v[0-9]+\/[^/]*$/, "");
		}

		if ((domain_nosub === "goodfon.com" ||
			 // https://img1.goodfon.ru/original/2560x1440/8/18/devochka-povyazka-kniga-bluzka.jpg
			 //   https://img1.goodfon.ru/wallpaper/original/8/18/devochka-povyazka-kniga-bluzka.jpg
			 // https://img.goodfon.ru/wallpaper/big/9/66/ohashi-bridge-kobe-japan.webp
			 //   https://img.goodfon.ru/wallpaper/original/9/66/ohashi-bridge-kobe-japan.jpg
			 domain_nosub === "goodfon.ru" ||
			 // https://img3.badfon.ru/wallpaper/big/c/b0/devushka-nagota-dlinnye-volosy.jpg
			 //   https://img3.badfon.ru/wallpaper/original/c/b0/devushka-nagota-dlinnye-volosy.jpg
			domain_nosub === "badfon.ru") &&
			domain.match(/^img[0-9]*\./)) {
			// https://img4.goodfon.com/wallpaper/middle/2/86/brevno-sova-ptitsa.jpg
			//   https://img4.goodfon.com/wallpaper/original/2/86/brevno-sova-ptitsa.jpg
			// https://img2.goodfon.com/original/1280x720/0/e6/venera-ray-devushka-krasivaya.jpg
			//   https://img2.goodfon.com/wallpaper/original/0/e6/venera-ray-devushka-krasivaya.jpg
			newsrc = src.replace(/(:\/\/[^/]*\/)[^/]*\/[^/]*\//, "$1wallpaper/original/");
			if (newsrc !== src)
				return newsrc;

			if (/\.webp(?:[?#].*)?$/.test(src))
				return src.replace(/\.webp(?:[?#].*)?$/, ".jpg");
			//return src.replace(/\/wallpaper\/[^/]*\//, "/wallpaper/original/");
		}

		if (domain_nosub === "greatfon.com" && domain.match(/^cdn[0-9]*\./)) {
			// http://cdn3.greatfon.com/uploads/picture/477/111/111477/thumbs_elisha-cuthbert-happy-endings.jpg
			//   http://cdn3.greatfon.com/uploads/picture/477/111/111477/elisha-cuthbert-happy-endings.jpg
			return src.replace(/(\/uploads\/+picture\/.*\/)thumbs_([^/]*)(?:[?#].*)?$/, "$1$2");
		}

		if ((domain_nosub === "yimg.jp" && string_indexof(domain, ".c.yimg.jp") >= 0) &&
			src.match(/:\/\/[^/]*\/im_/)) {
			// https://lpt.c.yimg.jp/im_siggiQbAsU9YOpUOxobTU3EtUg---x200-y200/amd/20180215-00205238-okinawat-000-view.jpg
			//   https://lpt.c.yimg.jp/amd/20180215-00205238-okinawat-000-view.jpg
			// https://amd.c.yimg.jp/im_siggfkAIHQmt2wB5qZ4fql1LCw---x900-y506-q90-exp3h-pril/amd/20180216-00010002-ksbv-000-1-view.jpg
			//   https://amd.c.yimg.jp/amd/20180216-00010002-ksbv-000-1-view.jpg
			// https://iwiz-news-profile.c.yimg.jp/im_sigg6aeoTpWVSD8ZSZj4Bo7mBA---x64-y64-pril-n1-exp30d/d/iwiz-news-profile/img/nb34khhuyczsy7o6f4dsott4zq.png?1477551484
			//   https://iwiz-news-profile.c.yimg.jp/d/iwiz-news-profile/img/nb34khhuyczsy7o6f4dsott4zq.png?1477551484
			//return src.replace(/(:\/\/[^/]*)\/[^/]*(\/amd\/[^/]*)$/, "$1$2");
			return src.replace(/(:\/\/[^/]*\/)im_[^/]*\//, "$1");
		}

		if ((domain_nosub === "yimg.jp" && string_indexof(domain, ".c.yimg.jp") >= 0) &&
			src.match(/:\/\/[^/]*\/sim\?/)) {
			// https://wing-auctions.c.yimg.jp/sim?furl=auctions.c.yimg.jp/images.auctions.yahoo.co.jp/image/dr000/auc0402/users/0/4/9/4/ane6371969-img600x425-1518659462gyve6525845.jpg&dc=1&sr.fs=20000
			//   http://auctions.c.yimg.jp/images.auctions.yahoo.co.jp/image/dr000/auc0402/users/0/4/9/4/ane6371969-img600x425-1518659462gyve6525845.jpg
			return src.replace(/.*:\/\/[^/]*\/sim.*?[?&]furl=([^&]*).*/, "http://$1");
		}

		if ((domain_nosub === "yimg.jp" && string_indexof(domain, ".c.yimg.jp") >= 0) &&
			src.match(/\/Images\/(?:[a-z]_)?[0-9]+(\.[^/]*)$/)) {
			// https://daily.c.yimg.jp/gossip/2015/06/16/Images/08127258.jpg
			//   https://daily.c.yimg.jp/gossip/2015/06/16/Images/f_08127258.jpg
			// f, d, g, e, b, a
			return src.replace(/\/Images\/(?:[a-z]_)?([0-9]+\.[^/.]*)$/, "/Images/f_$1");
		}

		if (domain_nosub === "yimg.jp" && string_indexof(domain, ".c.yimg.jp") >= 0 &&
			src.match(/:\/\/[^/]*\/yjimage\?/)) {
			// https://msp.c.yimg.jp/yjimage?q=SXErbsYXyLGSwqjcra07dAdtU7oG4sOUUXYButchAcGfrPPO0AFW2QnVBOjrLkIHN.SUOzCFDQcmuyDlnejSiBuj0wolEJkWkN379HL35K5_JOwQpplbsz0KNgGrbHRtY.dBoqXpBFPiZFOcSQ--&sig=138glqrj7&x=30&y=16
			//   https://msp.c.yimg.jp/yjimage?q=SXErbsYXyLGSwqjcra07dAdtU7oG4sOUUXYButchAcGfrPPO0AFW2QnVBOjrLkIHN.SUOzCFDQcmuyDlnejSiBuj0wolEJkWkN379HL35K5_JOwQpplbsz0KNgGrbHRtY.dBoqXpBFPiZFOcSQ--&sig=138glqrj7
			return keep_queries(src, ["q", "sig"]);
		}

		if (domain_nosub === "yimg.jp" && string_indexof(domain, ".c.yimg.jp") >= 0) {
			// thanks to fireattack on discord:
			// https://auc-pctr.c.yimg.jp/i/auctions.c.yimg.jp/images.auctions.yahoo.co.jp/image/dr000/auc0409/users/e4f79d3b2c22ab6996ad9af29430571e1a43bd6f/i-img1200x857-16954112841ttubd369919.jpg?pri=l&w=300&h=300&up=0&nf_src=sy&nf_path=images/auc/pc/top/image/1.0.3/na_170x170.png&nf_st=200
			//   https://auctions.c.yimg.jp/images.auctions.yahoo.co.jp/image/dr000/auc0409/users/e4f79d3b2c22ab6996ad9af29430571e1a43bd6f/i-img1200x857-16954112841ttubd369919.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+i\/+([^/]+\.yimg\.jp\/+[^?#]+)(?:[?#].*)?$/, "https://$1");
			if (newsrc !== src)
				return newsrc;

			// hangs
			// https://auctions.c.yimg.jp/images.auctions.yahoo.co.jp/image/dr000/auc0409/users/e4f79d3b2c22ab6996ad9af29430571e1a43bd6f/i-img1200x857-16954112841ttubd369919.jpg
			//   https://images.auctions.yahoo.co.jp/image/dr000/auc0409/users/e4f79d3b2c22ab6996ad9af29430571e1a43bd6f/i-img1200x857-16954112841ttubd369919.jpg
			//newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+([^/]+\.yahoo\.co\.jp\/+)/, "https://$1");
			//if (newsrc !== src)
			//	return newsrc;
		}

		if (domain_nosub === "yimg.jp" && string_indexof(domain, ".c.yimg.jp") >= 0 &&
			(/:\/\/[^/]*\/r\/+iwiz-amd\//.test(src) || /:\/\/[^/]+\/+i\/+/.test(src))) {
			// thanks to nimbuz on discord:
			// https://newsatcl-pctr.c.yimg.jp/r/iwiz-amd/20220414-04127636-tospoweb-000-2-view.jpg?pri=l&w=566&h=640&exp=10800&fmt=webp
			//   https://newsatcl-pctr.c.yimg.jp/r/iwiz-amd/20220414-04127636-tospoweb-000-2-view.jpg
			// -
			// thanks to fireattack on discord:
			// https://auc-pctr.c.yimg.jp/i/auctions.c.yimg.jp/images.auctions.yahoo.co.jp/image/dr000/auc0409/users/e4f79d3b2c22ab6996ad9af29430571e1a43bd6f/i-img1200x857-16954112841ttubd369919.jpg?pri=l&w=300&h=300&up=0&nf_src=sy&nf_path=images/auc/pc/top/image/1.0.3/na_170x170.png&nf_st=200
			//   https://auc-pctr.c.yimg.jp/i/auctions.c.yimg.jp/images.auctions.yahoo.co.jp/image/dr000/auc0409/users/e4f79d3b2c22ab6996ad9af29430571e1a43bd6f/i-img1200x857-16954112841ttubd369919.jpg
			return {
				url: src.replace(/\?.*$/, ""),
				can_head: false // 404
			};
		}

		if (domain === "av.watch.impress.co.jp") {
			// https://av.watch.impress.co.jp/img/avw/docs/1106/827/01_s.jpg
			//   https://av.watch.impress.co.jp/img/avw/docs/1106/827/01_o.jpg
			return src.replace(/(\/[0-9]+)_s(\.[^/.]*)$/, "$1_o$2");
		}

		if (domain === "internet.watch.impress.co.jp" ||
			// https://pc.watch.impress.co.jp/img/pcw/docs/1071/084/01_s.jpg
			//   https://pc.watch.impress.co.jp/img/pcw/docs/1071/084/01.jpg
			domain === "pc.watch.impress.co.jp") {
			// https://internet.watch.impress.co.jp/img/iw/docs/1106/860/01_s.jpg
			//   https://internet.watch.impress.co.jp/img/iw/docs/1106/860/01.jpg
			return src.replace(/(\/[0-9]+)_s(\.[^/.]*)$/, "$1$2");
			//return src.replace(/_s(\.[^/.]*)$/, "$1");
		}

		if (domain === "media.image.infoseek.co.jp") {
			// https://media.image.infoseek.co.jp/isnews/photos/mag2news/mag2news_350262_0-small.jpg
			// https://media.image.infoseek.co.jp/isnews/photos/gree/gree_164114_0-small.jpg
			//   https://media.image.infoseek.co.jp/isnews/photos/gree/gree_164114_0.jpg
			// https://media.image.infoseek.co.jp/isnews/photos/sirabee/sirabee_20161410960_0-small.jpg
			//   https://media.image.infoseek.co.jp/isnews/photos/sirabee/sirabee_20161410960_0.jpg
			return src.replace(/-[a-z]*(\.[^/.]*)$/, "$1");
		}

		if (domain === "bundles.sfd.pl") {
			// https://bundles.sfd.pl/SFD/2018/2/27/448ea4267069482cb09dfc5cac173927-small.jpg
			//   https://bundles.sfd.pl/SFD/2018/2/27/448ea4267069482cb09dfc5cac173927.jpg
			return src.replace(/(\/SFD\/+[0-9]{4}\/+[0-9]+\/+[0-9]+\/+[0-9a-f]{10,})-small(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "s.eximg.jp") {
			// https://s.eximg.jp/exnews/feed/President/President_24421_0d46_1_s.jpg
			// https://s.eximg.jp/exnews/feed/Reuters/Reuters_newsml_KCN1G009M_1_s.jpg
			//   https://s.eximg.jp/exnews/feed/Reuters/Reuters_newsml_KCN1G009M_1.jpeg
			//
			// https://s.eximg.jp/exnews/feed/Getnews/Getnews_1869376_84b6_1_s.jpg
			//   https://s.eximg.jp/exnews/feed/Getnews/Getnews_1869376_84b6_1.jpg
			return src.replace(/(_[0-9]+)_s(\.[^/.]*)$/, "$1$2");
		}

		if (domain === "imgc.eximg.jp") {
			// https://imgc.eximg.jp/i=https%253A%252F%252Fs.eximg.jp%252Fexnews%252Ffeed%252FShouhin%252FShouhin_93784_1.jpg,zoom=400,type=jpg
			//   https://s.eximg.jp/exnews/feed/Shouhin/Shouhin_93784_1.jpg
			// https://imgc.eximg.jp/cv/resize?i=https%3A%2F%2Fs.eximg.jp%2Fexnews%2Ffeed%2FCobs%2FCobs_1893125_c14f_1.jpg&t=jpeg&q=70&w=600
			//   https://s.eximg.jp/exnews/feed/Cobs/Cobs_1893125_c14f_1.jpg
			// https://imgc.eximg.jp/cv/trim?i=https%3A%2F%2Fs.eximg.jp%2Fexnews%2Ffeed%2FOricon%2FOricon_2132644_21df_1.jpg&t=webp&q=100&trim=1&w=184&h=184
			//   https://s.eximg.jp/exnews/feed/Oricon/Oricon_2132644_21df_1.jpg
			newsrc = src.replace(/.*?\/i=([^,&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
			newsrc = src.replace(/.*?\/cv\/+(?:resize|trim)\?i=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "image.itmedia.co.jp" &&
			!src.match(/\/l_[^/]*$/) &&
			!src.match(/\/[0-9]+_[^/]*$/)) {
			// http://image.itmedia.co.jp/news/articles/1802/16/koya_AP18039560928544.jpg
			//   http://image.itmedia.co.jp/news/articles/1802/16/l_koya_AP18039560928544.jpg
			// http://image.itmedia.co.jp/news/articles/1802/16/mm_houseten_02.jpg
			//   http://image.itmedia.co.jp/news/articles/1802/16/l_mm_houseten_02.jpg
			// http://image.itmedia.co.jp/news/articles/1802/16/nu_nec0216_02.jpg
			// doesn't work:
			// http://image.itmedia.co.jp/news/articles/1802/16/240_news084.jpg
			return src.replace(/\/([^/]*)$/, "/l_$1");
		}

		if (domain_nosub === "bigcommerce.com" && domain.match(/cdn[0-9]*\.bigcommerce\.com/)) {
			// http://cdn7.bigcommerce.com/s-aeyni5y9/images/stencil/500x659/products/517/520/bear_papa_7328_2__12787.1400287249.jpg?c=2
			//   https://cdn7.bigcommerce.com/s-aeyni5y9/images/stencil/500w/products/517/520/bear_papa_7328_2__12787.1400287249.jpg?c=2
			//   http://cdn7.bigcommerce.com/s-aeyni5y9/images/stencil/original/products/517/520/bear_papa_7328_2__12787.1400287249.jpg?c=2
			// https://cdn7.bigcommerce.com/s-c14n6tful3/images/stencil/735x374/products/136/460/checkbox-categories-filter-for-product-search-preview-734x374__10327.1518675514.jpg?c=2&imbypass=on
			//   https://cdn7.bigcommerce.com/s-c14n6tful3/images/stencil/original/products/136/460/checkbox-categories-filter-for-product-search-preview-734x374__10327.1518675514.jpg?c=2&imbypass=on -- zero length head
			// other:
			// https://cdn2.bigcommerce.com/server5100/wxfmbm/products/7017/images/70970/MVB_0261_92322.1440979988.501.751_1__27160.1444692485.60.90.jpg?c=2
			//   https://cdn2.bigcommerce.com/server5100/wxfmbm/images/stencil/original/products/7017/70970/MVB_0261_92322.1440979988.501.751_1__27160.1444692485.jpg?c=2
			newsrc = src.replace(/\/images\/+stencil\/+[0-9]+(?:x[0-9]+|w)\//, "/images/stencil/original/");
			if (newsrc !== src)
				return newsrc;

			newsrc = src.replace(/\/products\/+([0-9]+)\/+images\/+([0-9]+)\/+(.*\.[0-9]{8,})(?:\.[0-9]+\.[0-9]+)?(\.[^/.]*)(?:[?#].*)?$/, "/images/stencil/original/products/$1/$2/$3$4");
			if (newsrc !== src)
				return newsrc;

			return {
				url: src,
				head_wrong_contentlength: true
			};
		}

		if (domain_nosub === "behance.net") {
			// https://mir-s3-cdn-cf.behance.net/project_modules/max_1200/9e81bc25691931.5634a6d5ee11a.png
			// https://mir-s3-cdn-cf.behance.net/project_modules/1400/9e81bc25691931.5634a6d5ee11a.png
			// https://mir-s3-cdn-cf.behance.net/project_modules/disp/9e81bc25691931.5634a6d5ee11a.png
			// https://mir-s3-cdn-cf.behance.net/project_modules/hd/9e81bc25691931.5634a6d5ee11a.png
			// https://mir-s3-cdn-cf.behance.net/project_modules/fs/9e81bc25691931.5634a6d5ee11a.png
			//
			// https://mir-s3-cdn-cf.behance.net/project_modules/1400/828dc625691931.5634a721e19dd.jpg
			// https://mir-cdn.behance.net/v1/rendition/project_modules/1400/828dc625691931.5634a721e19dd.jpg
			// https://mir-s3-cdn-cf.behance.net/project_modules/fs/828dc625691931.5634a721e19dd.jpg
			//
			// https://mir-s3-cdn-cf.behance.net/project_modules/hd/ad62c919260569.562e23ee8f6be.jpg
			// https://mir-s3-cdn-cf.behance.net/project_modules/fs/ad62c919260569.562e23ee8f6be.jpg
			//
			// thanks to rahidz on github:
			// https://mir-s3-cdn-cf.behance.net/project_modules/max_1200/27452674022631.5c1db814e8a02.jpg
			//   https://mir-s3-cdn-cf.behance.net/project_modules/source/27452674022631.5c1db814e8a02.jpg
			//
			// https://mir-cdn.behance.net/v1/rendition/project_modules/1400_opt_1/4df4d449362517.58b2d9b3b3a2e.jpg
			//   https://mir-cdn.behance.net/v1/rendition/project_modules/source/4df4d449362517.58b2d9b3b3a2e.jpg -- 404 on head, but works
			//
			// https://mir-s3-cdn-cf.behance.net/projects/404/a6273165478883.5af575c34bbad.jpg
			//   https://mir-s3-cdn-cf.behance.net/projects/source/a6273165478883.5af575c34bbad.jpg
			//
			// doesn't work for all:
			// https://mir-s3-cdn-cf.behance.net/project_modules/max_1200/1cd9f445156279.58286c59a16f6.jpg
			//   https://mir-s3-cdn-cf.behance.net/project_modules/fs/1cd9f445156279.58286c59a16f6.jpg -- doesn't work
			//   https://mir-s3-cdn-cf.behance.net/project_modules/source/1cd9f445156279.58286c59a16f6.jpg -- works
			// https://mir-s3-cdn-cf.behance.net/project_modules/disp/568ec59308969.560cc39b2569a.jpg
			//   https://mir-cdn.behance.net/v1/rendition/project_modules/fs/568ec59308969.560cc39b2569a.jpg -- 404
			//   https://mir-s3-cdn-cf.behance.net/project_modules/source/568ec59308969.560cc39b2569a.jpg -- works
			return [
				{
					url: src.replace(/(\/project(?:_modules|s)\/+)[^/]*\//, "$1source/"),
					is_original: true
				},
				src.replace(/(\/project(?:_modules|s)\/+)[^/]*\//, "$1fs/")
			];
		}

		if (domain === "www.worldatlas.com") {
			// https://www.worldatlas.com/r/w728-h425-c728x425/upload/22/a1/0a/shutterstock-330445028.jpg
			//   https://www.worldatlas.com/upload/22/a1/0a/shutterstock-330445028.jpg
			return src.replace(/(:\/\/[^/]*\/)r\/[^/]*\/(upload\/)/, "$1$2");
		}

		if (domain_nosub === "thrillist.com" && domain.match(/assets[0-9]*\.thrillist\.com/)) {
			// https://assets3.thrillist.com/v1/image/2642818/size/tmg-article_default_mobile.jpg
			//   https://assets3.thrillist.com/v1/image/2642818/size/tl-horizontal_main.jpg
			//   https://assets3.thrillist.com/v1/image/2642818
			// https://assets3.thrillist.com/v1/image/2729043/size/tl-right_rail_short.jpg
			//   https://assets3.thrillist.com/v1/image/2729043
			// https://assets3.thrillist.com/v1/image/2728632/size/gn-gift_guide_variable_c.jpg
			//   https://assets3.thrillist.com/v1/image/2728632
			// https://assets3.thrillist.com/v1/image/2442399/size/tmg-article_tall.jpg
			//   https://assets3.thrillist.com/v1/image/2442399
			// http://assets3.thrillist.com/v1/image/1210040
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/455
			// https://assets3.thrillist.com/v1/image/2895526/280x374/flatten;crop;jpeg_quality=60.jpg
			//   https://assets3.thrillist.com/v1/image/2895526
			// https://assets3.thrillist.com/v1/image/2874558/1584x1054/crop;jpeg_quality=60.jpg
			//   https://assets3.thrillist.com/v1/image/2874558
			// https://assets3.thrillist.com/v1/image/2895205/444x250/flatten;crop;jpeg_quality=60.jpg
			//   https://assets3.thrillist.com/v1/image/2895205
			// https://assets3.thrillist.com/v1/image/2893902/1200x600/scale;
			//   https://assets3.thrillist.com/v1/image/2893902
			return src.replace(/(:\/\/[^/]+\/+v1\/+image\/+[0-9]+)(?:\/.*)?(?:[?#].*)?$/, "$1");
		}

		if (domain_nowww === "vacationidea.com" &&
			string_indexof(src, "/pix/") >= 0) {
			// http://vacationidea.com/pix/img25Hy8R/articles/t-b4_beautiful_places_oia,_santorin_27304_mobi.jpg
			//   http://vacationidea.com/pix/img25Hy8R/articles/t-b4_beautiful_places_oia,_santorin_27304.jpg
			return src.replace(/_mobi(\.[^/.]*)$/, "$1");
		}

		if (domain_nosub === "quoracdn.net") {
			// https://qph.fs.quoracdn.net/main-qimg-0f9434ad2ebdb0024bab1b334ce791a9-c
			//   https://qph.fs.quoracdn.net/main-qimg-0f9434ad2ebdb0024bab1b334ce791a9
			// https://qph.fs.quoracdn.net/main-raw-392620873-joffqkghcbjrhnyvxrzwyzwepvyuubyh.jpeg
			// thanks to anonymous for reporting:
			// https://qph.cf2.quoracdn.net/main-qimg-ce650e3cb82159b6042f9c5da845dfc8-lq
			//   https://qph.cf2.quoracdn.net/main-qimg-ce650e3cb82159b6042f9c5da845dfc8
			// thanks to anonymous for reporting:
			// https://qph.cf2.quoracdn.net/main-qimg-46e4c09f4f78ed4ca33470d3adb7073f-pjlq
			//   https://qph.cf2.quoracdn.net/main-qimg-46e4c09f4f78ed4ca33470d3adb7073f
			// thanks to anonymous for reporting:
			// https://qph.cf2.quoracdn.net/main-thumb-787466541-200-pqnwkfwplsapthrxdiswtzkhvpgvdkdv.jpeg
			//   https://qph.cf2.quoracdn.net/main-raw-787466541-pqnwkfwplsapthrxdiswtzkhvpgvdkdv.jpeg
			return src
				.replace(/(\/main-)thumb-([0-9]+-)[0-9]+-([a-z]{10,}\.)/, "$1raw-$2$3")
				.replace(/(\/main-qimg-[0-9a-f]{10,})-(?:[a-z]|(?:pj)?lq)$/, "$1");
		}

		if (false && domain_nosub === "fan.pw" &&
			string_indexof(src, "/cpg/albums/") >= 0) {
			// coppermine
			// http://actresses.fan.pw/cpg/albums/userpics/10001/thumb_001~64.jpg
			// http://actresses.fan.pw/cpg/albums/userpics/10001/normal_002~51.jpg
			//   http://actresses.fan.pw/cpg/albums/userpics/10001/002~51.jpg
			return src.replace(/\/[a-z]*_([^/]*)$/, "/$1");
		}

		if (domain_nosub === "haibao.cn" && domain.match(/c[0-9]*\.haibao\.cn/)) {
			// http://c3.haibao.cn/pic/0_0_100_0/litQzsnR5qDSo/imagecut/0_400/piccommon/1215/12155/litQzsnR5qDSo.jpg
			//   http://c3.haibao.cn/pic/0_0_100_0/litQzsnR5qDSo/piccommon/1215/12155/litQzsnR5qDSo.jpg
			// http://c1.haibao.cn/pic/0_0_100_0/liJjsVbbnxshY/imagecut/0_400/piccommon/1218/12184/liJjsVbbnxshY.jpg
			//   http://c1.haibao.cn/pic/0_0_100_0/liJjsVbbnxshY/piccommon/1218/12184/liJjsVbbnxshY.jpg -- 404
			//   http://c3.haibao.cn/pic/0_0_100_0/liJjsVbbnxshY/piccommon/1218/12184/liJjsVbbnxshY.jpg -- works
			newsrc = src.replace(/:\/\/[^/]*\/(.*)\/+imagecut\/+[0-9]+_[0-9]+\/+/, "://c3.haibao.cn/$1/");
			if (newsrc !== src) {
				return {
					url: newsrc,
					can_head: false
				};
			}
		}

		if (domain.match(/c[0-9]*\.haibao\.cn/)) {
			// http://c3.haibao.cn/img/600_0_100_0/1258349756.6184/bigfiles/200946/1258349756.6184.jpg -- doesn't work
			//   http://c4.haibao.cn/img/0_0_0_0/1258349756.6184/bigfiles/200946/1258349756.6184.jpg
			// doesn't work: (any changes fail)
			// http://c3.haibao.cn/img/600_0_100_1/1443219715.4295/44ceff65db35a823fafb9572341a17e4.jpg
			//   http://c4.haibao.cn/img/0_0_100_1/1443219715.4295/44ceff65db35a823fafb9572341a17e4.jpg
			//   http://c4.haibao.cn/img/0_0_0_0/1443219715.4295/44ceff65db35a823fafb9572341a17e4.jpg -- works
			// http://c2.haibao.cn/img/3620_5430_100_1/1498032292.4375/e2097b3504fdeefd6d94c0fbd8e3bcd6.jpg
			// works:
			// http://c4.haibao.cn/img/480_640_100_0/1337160726.1610/bigfiles/201220/1337160726.1610.jpg
			//   http://c4.haibao.cn/img/0_0_100_0/1337160726.1610/bigfiles/201220/1337160726.1610.jpg
			//   http://c4.haibao.cn/img/0_0_0_0/1337160726.1610/bigfiles/201220/1337160726.1610.jpg
			newsrc = src.replace(/:\/\/[^/]*\/img\/+[0-9]+(?:_[0-9]+){3}\//, "://c4.haibao.cn/img/0_0_0_0/");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nosub === "hbimg.cn" && domain.match(/cdn[0-9]*\.hbimg\.cn/)) {
			// http://cdn4.hbimg.cn/store/thumbs/130_165/piccommon/1214/12147/D52599CFADB3EFF2DCBE83AF.jpg
			//   http://cdn4.hbimg.cn/store/wm/piccommon/1214/12147/D52599CFADB3EFF2DCBE83AF.jpg
			// http://cdn4.hbimg.cn/store/tuku/310_999/piccommon/1219/12199/D525A1EAE883EFE5E98291834B.jpg
			//   http://cdn4.hbimg.cn/store/wm/piccommon/1219/12199/D525A1EAE883EFE5E98291834B.jpg -- watermark
			// http://cdn0.hbimg.cn/store/snsthumbs/650_2000/album/201311/817ADEBDE8AD9BB085F5C3C148AB89FACA8528F5F89F.jpg
			// other:
			// http://cdn4.hbimg.cn/store/wm/bigfiles/201227/887FDBBCEFC69CBB85FFD5C245A685.jpg
			//   http://cdn4.hbimg.cn/store/bigfiles/201227/887FDBBCEFC69CBB85FFD5C245A685.jpg -- doesn't work
			// http://cdn4.hbimg.cn/store/bigfiles/201408/li0ORMvGTBRLE.jpg
			//   http://cdn4.hbimg.cn/store/wm/bigfiles/201408/li0ORMvGTBRLE.jpg -- doesn't work
			// http://cdn0.hbimg.cn/store/data/attachment/album/201402/18/140655t3v2373scoavo5li.jpg
			// http://cdn0.hbimg.cn/store/data/attachment/forum/201607/07/231331f3pud2uuth88su8w.jpg
			// http://cdn6.hbimg.cn/store/uploads/2015/0602/1433227913.8475.jpg
			// http://cdn2.hbimg.cn/store/piccommon/1220/12205/limmXaa8StWk.jpg
			return {
				url: src.replace(/\/(?:thumbs|tuku|snsthumbs)\/[0-9]+(?:_[0-9]+)\//, "/wm/"),
				problems: {
					watermark: true
				}
			};
		}

		if (domain_nowww === "wallpaperset.com") {
			// https://wallpaperset.com/w/small/6/7/2/314686.jpg
			//   https://wallpaperset.com/w/full/6/7/2/314686.jpg
			return src.replace(/(:\/\/[^/]*\/w\/)[^/]*\//, "$1full/");
		}

		// disabled due to redirects
		if (domain_nosub === "wallpapermania.eu") {
			// http://www.wallpapermania.eu/download/2012-04/1037/emma-roberts-11-sexy-hd-wallpaper_1366x768.jpg
			//   http://www.wallpapermania.eu/images/data/2012-04/1037_emma-roberts-11-sexy-hd-wallpaper.jpg
			// http://static.wallpapermania.eu/images/thumbs/2012-04/1030_emma-roberts-4-sexy-hd-wallpaper.jpg
			//   http://www.wallpapermania.eu/images/data/2012-04/1030_emma-roberts-4-sexy-hd-wallpaper.jpg
			// http://www.wallpapermania.eu/wallpaper/victoria-justice-6-sexy-hd-wallpaper
			// http://www.wallpapermania.eu/images/lthumbs/2012-04/2210_victoria-justice-6-sexy-hd-wallpaper.jpg
			//   http://www.wallpapermania.eu/images/data/2012-04/2210_victoria-justice-6-sexy-hd-wallpaper.jpg
			newsrc = src
				.replace("://static.wallpapermania.eu/", "://www.wallpapermania.eu/")
				.replace(/\/images\/[a-z]?thumbs\//, "/images/data/")
				.replace(/\/download\/([^/]*)\/([0-9]*)\/([^/.]*)_[0-9]+x[0-9]+(\.[^/.]*)$/, "/images/data/$1/$2_$3$4");
			if (newsrc !== src) {
				var referer = newsrc.replace(/.*\/[0-9]+_([^/.]*)(?:_[0-9]+x[0-9]+)?\.[^/.]*$/,
											 "http://www.wallpapermania.eu/wallpaper/$1");
				return {
					url: newsrc,
					headers: {
						"Referer": referer
					}
				};
			}
			//return newsrc;
		}

		if (domain === "img-aws.ehowcdn.com" ||
			domain === "img.aws.ehowcdn.com" ||
			domain === "img.aws.livestrongcdn.com" ||
			domain === "img-aws.livestrongcdn.com") {
			// wip
			// https://img-aws.ehowcdn.com/750x428p/photos.demandstudios.com/getty/article/165/202/96162194.jpg
			//   http://photos.demandstudios.com/getty/article/165/202/96162194.jpg
			//
			// https://img-aws.ehowcdn.com/1440x520/cme/uploadedimages.demandmedia/chocmouse.jpg
			//
			// https://img-aws.ehowcdn.com/640/cme/photography.prod.demandstudios.com/8f9cba5d-f28d-47e7-bcc7-985cc310ce6a.jpg
			// https://img-aws.ehowcdn.com/1440/cme/photography.prod.demandstudios.com/8f9cba5d-f28d-47e7-bcc7-985cc310ce6a.jpg
			// http://img.aws.ehowcdn.com/intl-300m200/ds-photo/getty/article/129/156/86543427.jpg
			// http://img.aws.ehowcdn.com/intl-1200x630/ehow/images/a04/8n/pn/sell-wholesale-pandora-jewelry-800x800.jpg
			// http://img-aws.ehowcdn.com/default/ds-photo/getty/article/190/38/153473402_XS.jpg
			// https://img-aws.ehowcdn.com/default/getty/xc/87706466.jpg?v=1&c=EWSAsset&k=2&d=910C62E22B9F47AA92D0F6B5F9282134E184698B84D1D7E2E240CBB021893A9E
			//
			// http://img.aws.livestrongcdn.com/ls-article-image-400/cme/cme_public_images/www_livestrong_com/photos.demandstudios.com/getty/article/106/30/113475809_XS.jpg
			/*newsrc = src.replace(/.*?:\/\/[^/]*\/[0-9]+x[0-9]+p\//, "http://")
			if (newsrc !== src) {
				return newsrc;
			}*/
			newsrc = src
				.replace(/(:\/\/[^/]*\/)[^/]*\//, "$1default/");
			// breaks some urls:
			// https://img-aws.ehowcdn.com/150X100/getty/xc/87613263.jpg?v=1&c=EWSAsset&k=2&d=860EC25688CC8B2E9617B166F6C00C467D8EB72EFB52D4B89BE18AFE639C03A0
			//   https://img-aws.ehowcdn.com/default/getty/xc/87613263.jpg?v=1&c=EWSAsset&k=2&d=860EC25688CC8B2E9617B166F6C00C467D8EB72EFB52D4B89BE18AFE639C03A0
			//.replace(/\?.*$/, "");
			if (newsrc !== src) {
				return newsrc;
			}

			// http://img-aws.ehowcdn.com/300x200/photos.demandstudios.com/getty/article/88/150/87682980.jpg
			// http://img.aws.livestrongcdn.com/default/cme/cme_public_images/www_livestrong_com/photos.demandstudios.com/getty/article/92/185/472711312_XS.jpg
			newsrc = src.replace(/.*?:\/\/[^/]*\/.*?\/(photos\.demandstudios\.com\/)/, "http://$1");
			if (newsrc !== src) {
				return newsrc;
			}

			// https://img-aws.ehowcdn.com/640/ehow-food-blog-us/files/2014/12/edits-2282-1024x682.jpg
			// http://food-ehow-com.blog.ehow.com/files/2014/12/edits-2282-1024x682.jpg
			//   http://food-ehow-com.blog.ehow.com/files/2014/12/edits-2282.jpg
			newsrc = src.replace(/.*?:\/\/[^/]*\/[^/]*\/ehow-([^-/.]*)-blog-([^/.]*)\//, "http://$1-ehow-com.blog.ehow.com/");
			if (newsrc !== src) {
				return newsrc;
			}

			// http://img-aws.ehowcdn.com/615x200/cpi-studiod-com/www_ehow_com/i.ehow.com/images/a07/ai/07/prevent-soggy-graham-cracker-crust-800x800.jpg
			//   http://i.ehow.com/images/a07/ai/07/prevent-soggy-graham-cracker-crust-800x800.jpg
			// https://img-aws.ehowcdn.com/default/cme/cme_public_images/www_ehow_com/i.ehow.com/images/a04/pc/d6/season-pizza-stone-800x800.jpg
			// http://img-aws.ehowcdn.com/default/cme/cme_public_images/www_ehow_com/cdn-write.demandstudios.com/upload/image/18/2F/99D61A9C-FD10-4110-9241-BAA39E072F18/99D61A9C-FD10-4110-9241-BAA39E072F18.jpg
			//   http://cdn-write.demandstudios.com/upload/image/18/2F/99D61A9C-FD10-4110-9241-BAA39E072F18/99D61A9C-FD10-4110-9241-BAA39E072F18.jpg
			// doesn't work:
			// https://img-aws.ehowcdn.com/default/s3.amazonaws.com/cme_public_images/www_demandstudios_com/sitelife.studiod.com/ver1.0/Content/images/store/5/12/45fe6090-8ca0-4f71-9cb1-14efedc73b2e.Small.jpg
			newsrc = src.replace(/.*?:\/\/[^/]*\/.*?\/www_ehow_com\/([^/.]*\.[^/]*)\//, "http://$1/");
			if (newsrc !== src) {
				return newsrc;
			}

			// https://img-aws.ehowcdn.com/default/s3.amazonaws.com/cme_public_images/www_demandstudios_com/sitelife.studiod.com/ver1.0/Content/images/store/5/12/45fe6090-8ca0-4f71-9cb1-14efedc73b2e.Small.jpg
			newsrc = src.replace(/.*?:\/\/[^/]*\/[^/]*\/s3\.amazonaws\.com\//, "https://s3.amazonaws.com/");
			if (newsrc !== src) {
				return newsrc;
			}
		}

		if (amazon_container === "cme_public_images") {
			// http://s3.amazonaws.com/cme_public_images/www_livestrong_com/photos.demandstudios.com/getty/article/142/9/78291574_XS.jpg
			// http://cme_public_images.s3.amazonaws.com/www_livestrong_com/photos.demandstudios.com/getty/article/142/9/78291574_XS.jpg
			newsrc = src.replace(/.*?:\/\/[^/]*\/.*?\/(photos\.demandstudios\.com\/)/, "http://$1");
			if (newsrc !== src) {
				return newsrc;
			}
		}

		if (domain === "imageproxy.themaven.net") {
			// https://imageproxy.themaven.net/http%3A%2F%2Fimg.aws.livestrongcdn.com%2Fls-1200x630%2Fcme%2Fcme_public_images%2Fwww_livestrong_com%2Fphotos.demandstudios.com%2Fgetty%2Farticle%2F178%2F99%2F79711775_XS.jpg
			// https://imageproxy.themaven.net/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fmaven-user-photos%2Fthe-maven%2Fpress%2FhAfH0nLTEU-5d4pCxu-TUA%2F2wNFvsqAbUaqAch2Ndhq9w?w=688&q=75&h=512&auto=format&fit=crop
			//   https://s3-us-west-2.amazonaws.com/maven-user-photos/the-maven/press/hAfH0nLTEU-5d4pCxu-TUA/2wNFvsqAbUaqAch2Ndhq9w
			// https://imageproxy.themaven.net/https%3A%2F%2Fmedia-exp1.licdn.com%2Fdms%2Fimage%2FC5622AQF-OIaklbqWOA%2Ffeedshare-shrink_2048_1536%2F0%3Fe%3D1589414400%26v%3Dbeta%26t%3DNzgEJe0DDaOs4dAcMviVvPr1cfWCnzZW-ji-Ol1bQYs
			//   https://media-exp1.licdn.com/dms/image/C5622AQF-OIaklbqWOA/feedshare-shrink_2048_1536/0?e=1589414400&v=beta&t=NzgEJe0DDaOs4dAcMviVvPr1cfWCnzZW-ji-Ol1bQYs
			// https://imageproxy.themaven.net/273x206/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fmaven-user-photos%2Fwarriormaven%2Ffuture-weapons%2FE01f5D5P-0-UPsMl0JPoiQ%2FiHfBsqi-1EmhxXHsGkkxrg
			//   https://s3-us-west-2.amazonaws.com/maven-user-photos/warriormaven/future-weapons/E01f5D5P-0-UPsMl0JPoiQ/iHfBsqi-1EmhxXHsGkkxrg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+(?:[0-9]+x[0-9]+\/+)?(http)/, "$1")
			if (newsrc !== src) {
				return decodeURIComponent(newsrc.replace(/\?.*/, ""));
			}
		}

		if ((domain_nosub === "demandstudios.com" && domain.match(/photos[0-9]*\.demandstudios\.com/)) &&
			string_indexof(src, "/dm-resize/") >= 0) {
			// http://photos2.demandstudios.com/dm-resize/s3.amazonaws.com%2Fcme_public_images%2Fwww_livestrong_com%2Fphotos.demandstudios.com%2Fgetty%2Farticle%2F142%2F9%2F78291574_XS.jpg?w=267&h=10000&keep_ratio=1
			return decodeURIComponent(src.replace(/.*?\/dm-resize\/([^/?]*).*/, "http://$1"));
		}

		if (domain_nosub === "demandstudios.com" && domain.match(/photos[0-9]*\.demandstudios\.com/)) {
			// http://photos.demandstudios.com/getty/article/92/121/114336181_XS.jpg
			//   http://photos.demandstudios.com/getty/article/92/121/114336181.jpg
			// http://photos.demandstudios.com/getty/article/94/77/145190904_XS.jpg
			// http://photos.demandstudios.com/getty/article/225/172/476257962_XS.jpg
			// doesn't work:
			// photos.demandstudios.com/74/208/fotolia_608243_XS.jpg
			return src.replace(/(\/[0-9]+)_XS(\.[^/.]*)$/, "$1$2");
		}

		if (domain_nosub === "abcnews.com") {
			// https://s.abcnews.com/images/International/WireAP_118c1517b7f34b8bb7746eedfc01c12d_12x5_992.jpg
			//   https://s.abcnews.com/images/International/WireAP_118c1517b7f34b8bb7746eedfc01c12d.jpg
			// https://s.abcnews.com/images/US/chicago-pd-funeral-02-ap-jrl-180217_16x9t_240.jpg
			//   https://s.abcnews.com/images/US/chicago-pd-funeral-02-ap-jrl-180217.jpg
			// http://a.abcnews.com/images/Entertainment/GTY_sophie_turner_jef_150528_7x10_1600.jpg
			//   http://a.abcnews.com/images/Entertainment/GTY_sophie_turner_jef_150528.jpg
			return src.replace(/_[0-9]+x[0-9]+[a-z]?_[0-9]+(\.[^/.]*)$/, "$1");
		}

		if (domain_nowww === "nationmultimedia.com") {
			// http://www.nationmultimedia.com/img/gallery/2017/10/14/194/9ef48d31930c4bbe00957654ab1aaf1a-vps.jpeg
			//   http://www.nationmultimedia.com/img/gallery/2017/10/14/194/9ef48d31930c4bbe00957654ab1aaf1a.jpeg
			// http://www.nationmultimedia.com/img/news/2018/02/18/30339149/b4065a2adeea2230b7d230a13eda5701-atwb.jpeg
			//   http://www.nationmultimedia.com/img/news/2018/02/18/30339149/b4065a2adeea2230b7d230a13eda5701.jpeg
			return src.replace(/-[^/.]*(\.[^/.]*)$/, "$1");
		}

		if (domain_nosub === "indiatimes.com" ||
			// https://img.etimg.com/thumb/msid-63592870,width-643,imgsize-125649,resizemode-4/how-rihannas-song-became-howard-universitys-protest-anthem.jpg
			//   https://img.etimg.com/photo/63592870.cms
			domain === "img.etimg.com" ||
			// https://etimg.etb2bimg.com/thumb/msid-62837430,imgsize-,width-800,height-434,overlay-etenergyworld/canada-s-meg-energy-to-sell-pipeline-storage-assets-for-c-1-61-bln.jpg
			//   https://etimg.etb2bimg.com/photo/62837430.cms
			domain === "etimg.etb2bimg.com" ||
			// https://telugu.samayam.com/thumb/msid-65304761,width-600,resizemode-4/photo-gallery/bollywood/amy-jackson-hot-pics.jpg
			//   https://telugu.samayam.com/photo/65304761.cms
			domain === "telugu.samayam.com" ||
			// https://static.langimg.com/thumb/msid-69234694,resizemode-4,width-250,height-172/%E0%B2%88%E0%B2%97%E0%B2%B2%E0%B3%87-%E0%B2%AC%E0%B2%95%E0%B3%8D%E0%B2%95%E0%B2%A4%E0%B2%B2%E0%B3%86-%E0%B2%86%E0%B2%97%E0%B2%BF%E0%B2%A6%E0%B3%86,-%E0%B2%87%E0%B2%A8%E0%B3%8D%E0%B2%A8%E0%B3%81-%E0%B2%AE%E0%B2%A6%E0%B3%81%E0%B2%B5%E0%B3%86-%E0%B2%AF%E0%B2%BE%E0%B2%95%E0%B3%86-%E0%B2%8E%E0%B2%82%E0%B2%A6-%E0%B2%85%E0%B2%B0%E0%B3%8D%E0%B2%9C%E0%B3%81%E0%B2%A8%E0%B3%8D-%E0%B2%95%E0%B2%AA%E0%B3%82%E0%B2%B0%E0%B3%8D.jpg
			domain === "static.langimg.com" ||
			// https://m.timesofindia.com/thumb/msid-69414219,imgsize-84774,width-800,height-600,resizemode-4/69414219.jpg
			domain_nosub === "timesofindia.com" ||
			// https://m.vijaykarnataka.com/thumb/msid-69234694,width-300,height-200,resizemode-4/pic.jpg
			domain_nosub === "vijaykarnataka.com" ||
			// https://www.businessinsider.in/thumb/msid-71187928,width-1200,height-900/iacs-dotdash-is-quietly-building-a-beauty-empire-to-compete-with-the-likes-of-conde-nast-and-hearst.jpg
			//   https://www.businessinsider.in/photo/71187928.cms
			domain_nowww === "businessinsider.in" ||
			// https://static.toiimg.com/thumb/imgsize-376350,msid-62972146,width-200,resizemode-4/62972146.jpg
			//   https://static.toiimg.com/photo/62972146.cms
			domain === "static.toiimg.com") {
			// https://timesofindia.indiatimes.com/thumb/msid-62829284,width-400,resizemode-4/62829284.jpg
			//   https://timesofindia.indiatimes.com/photo/62829284.cms
			// http://photogallery.indiatimes.com/thumb/62742103.cms?width=164&height=122
			//   http://photogallery.indiatimes.com/photo/62742103.cms
			// https://economictimes.indiatimes.com/thumb/msid-62966896,width-274,height-198/how-the-rs-11k-cr-nirav-modi-scandal-will-affect-diamantaires.jpg
			//   https://economictimes.indiatimes.com/photo/62966896.cms

			obj = {
				url: src,
				head_wrong_contentlength: true
			};

			newsrc = src.replace(/(:\/\/[^/]*\/)thumb\//, "$1photo/");
			if (newsrc !== src) {
				obj.url = newsrc;
				return obj;
			}

			newsrc = src.replace(/\/(?:thumb|photo)\/[^/]*msid-([0-9]*)[,/].*$/, "/photo/$1.cms");
			if (newsrc !== src) {
				obj.url = newsrc;
				return obj;
			}

			newsrc = src.replace(/\/(?:thumb|photo)\/(?:[^/]*\/)?([0-9]*)\.[^/.]*$/, "/photo/$1.cms");
			if (newsrc !== src) {
				obj.url = newsrc;
				return obj;
			}
		}

		if (domain === "opt.toiimg.com") {
			// https://opt.toiimg.com/recuperator/img/toi/m-65021637,h-114,w-204/65021637.jpg?pl=175598
			//   https://opt.toiimg.com/recuperator/img/toi/65021637.cms
			return src.replace(/\/recuperator\/+img\/+toi\/+m-([0-9]+)(?:,[^/]*)\/+.*/,
							   "/recuperator/img/toi/$1.cms");
		}

		if (domain_nowww === "jawapos.com") {
			// https://www.jawapos.com/thumbs/xs/news/2018/02/18/tips-menghadapi-kulit-kering-di-musim-hujan_m_189572.jpeg
			//   https://www.jawapos.com/thumbs/l/news/2018/02/18/tips-menghadapi-kulit-kering-di-musim-hujan_m_189572.jpeg
			//   https://www.jawapos.com/uploads/news/2018/02/18/tips-menghadapi-kulit-kering-di-musim-hujan_m_189572.jpeg
			return src.replace(/\/thumbs\/+[^/]*\//, "/uploads/");
		}

		if (domain_nowww === "tnnthailand.com") {
			// http://www.tnnthailand.com/stocks/media/thumb_big/0656a4.jpg
			//   http://www.tnnthailand.com/stocks/media/0656a4.jpg
			return src.replace(/\/media\/+[^/]+\/+([^/]+)(?:[?#].*)?$/, "/media/$1");
		}

		if ((domain_nosub === "ibtimes.co.in" ||
			 domain_nosub === "ibtimes.sg") &&
			domain.match(/data[0-9]*\.ibtimes\./)) {
			// http://data1.ibtimes.co.in/cache-img-0-450/en/full/554638/1420537417_beant-singh.jpg
			//   http://data1.ibtimes.co.in/en/full/554638/1420537417_beant-singh.jpg
			// https://data1.ibtimes.co.in/cache-img-900-0-photo/en/full/66506/-62170003800_cannes-2017-aishwarya-rai-bachchan-looks-stunning-she-walks-red-carpet.jpg
			//   https://data1.ibtimes.co.in/en/full/66506/-62170003800_cannes-2017-aishwarya-rai-bachchan-looks-stunning-she-walks-red-carpet.jpg -- doesn't work
			//   The requested URL /en/full/6/65/66506.jpg was not found on this server.
			// https://data.ibtimes.sg/en/full/16882/changi-airport.jpg?w=564&h=340&l=50&t=40
			// https://data.ibtimes.sg/en/thumb/21008/finance-minister-heng-swee-keat.jpg
			return src
				.replace(/(:\/\/[^/]*\/)cache-img-[0-9]*-[0-9]*(?:-photo)?\//, "$1")
				.replace(/\/[a-z]*(\/[0-9]+\/[^/]*)$/, "/full$1")
				.replace(/\?.*$/, "");
		}

		if (amazon_container === "astro-image-resizer" ||
			// https://static03.astro.com.my/8/resize/xuan/media/xuan-assets/2019/june/05/768x432_kara_banner.jpg
			//   https://astrokentico.s3.amazonaws.com/xuan/media/xuan-assets/2019/june/05/kara_banner.jpg
			domain_nosub === "astro.com.my") {
			// http://astro-image-resizer.s3-ap-southeast-1.amazonaws.com/17/resize/rojakdaily/media/jessica-chua/news/2018/jan/saying%20goodbye%20to%20anw%20pj%20outlet/115x76_a-w.png
			//   http://astrokentico.s3.amazonaws.com/rojakdaily/media/jessica-chua/news/2018/jan/saying%20goodbye%20to%20anw%20pj%20outlet/a-w.png?ext=.png
			//   http://astrokentico.s3.amazonaws.com/rojakdaily/media/jessica-chua/news/2018/jan/saying%20goodbye%20to%20anw%20pj%20outlet/a-w.png
			// http://s3-ap-southeast-1.amazonaws.com/astro-image-resizer/17/resize/rojakdaily/media/jessica-chua/news/2018/jan/saying%20goodbye%20to%20anw%20pj%20outlet/115x76_a-w.png
			//   http://astrokentico.s3.amazonaws.com/rojakdaily/media/jessica-chua/news/2018/jan/saying%20goodbye%20to%20anw%20pj%20outlet/a-w.png
			return src
				.replace(/:\/\/(?:astro-image-resizer\.([^.]*\.)?amazonaws\.com|static[0-9]*\.astro\.com\.my)\/+/, "://astrokentico.s3.amazonaws.com/")
				.replace(/(:\/\/s3[^/.]*\.amazonaws\.com\/+)astro-image-resizer\//, "://astrokentico.s3.amazonaws.com/")
				.replace(/(:\/\/[^/]*)\/[0-9]*\/+resize\//, "$1/")
				.replace(/\/[0-9]+x[0-9]+_/, "/");
		}

		if ((amazon_container && string_indexof(amazon_container, "nxs-wkrgtv-media") >= 0) ||
			// http://pic1.win4000.com/pic/f/bd/9db51148625_130_170.jpg
			//   http://pic1.win4000.com/pic/f/bd/9db51148625.jpg
			(domain_nosub === "win4000.com" && domain.match(/^pic[0-9]*\.win4000\.com/)) ||
			// https://media.fox29.com/media.fox29.com/photo/2018/07/09/GETTY_thai_cave_rescue_ambulance_070918%20_OP_2_CP__1531142830871.jpg_5770639_ver1.0_640_360.jpg
			//   https://media.fox29.com/media.fox29.com/photo/2018/07/09/GETTY_thai_cave_rescue_ambulance_070918%20_OP_2_CP__1531142830871.jpg_5770639_ver1.0.jpg
			domain === "media.fox29.com" ||
			// https://media.foxla.com/media.foxla.com/photo/2018/06/11/Panga_boat_lands_on_Laguna_Beach_shore___0_5651395_ver1.0_640_360.jpg
			//   https://media.foxla.com/media.foxla.com/photo/2018/06/11/Panga_boat_lands_on_Laguna_Beach_shore___0_5651395_ver1.0.jpg
			domain === "media.foxla.com" ||
			// https://sharedmedia.grahamdigital.com/photo/2016/04/06/Rachel+McAdams_19105756_10868403_ver1.0_160_90.jpg
			//   https://sharedmedia.grahamdigital.com/photo/2016/04/06/Rachel+McAdams_19105756_10868403_ver1.0.jpg
			domain === "sharedmedia.grahamdigital.com" ||
			// http://pic.sucaibar.com/pic/201606/20/b79d344371_184_320.jpg
			//   http://pic.sucaibar.com/pic/201606/20/b79d344371.jpg
			(domain === "pic.sucaibar.com" && src.match(/\/pic\/+[0-9]{6}\/+/)) ||
			// https://mediaassets.wxyz.com/photo/2018/05/22/poster_22074aded9dd4214ae42eb62a4404769_87749608_ver1.0_320_240.jpg
			//   https://mediaassets.wxyz.com/photo/2018/05/22/poster_22074aded9dd4214ae42eb62a4404769_87749608_ver1.0.jpg
			domain === "mediaassets.wxyz.com") {
			// http://s3.amazonaws.com/nxs-wkrgtv-media-us-east-1/photo/2018/02/17/Bail_Bonds_0_34542427_ver1.0_320_180.jpg
			//   http://s3.amazonaws.com/nxs-wkrgtv-media-us-east-1/photo/2018/02/17/Bail_Bonds_0_34542427_ver1.0.jpg
			newsrc = src.replace(/_[0-9]+_[0-9]+(\.[^/.]*)$/, "$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nosub === "win4000.com" && domain.match(/^pic[0-9]*\./)) {
			// http://pic1.win4000.com/pic/0/84/7a3a1529019.jpg?down
			return src.replace(/\?down$/, ""); // removes forced downloading
		}

		if (domain === "bobcat.grahamdigital.com") {
			// https://bobcat.grahamdigital.com/image/upload/view?width=320&height=180&method=crop&url=https://sharedmedia.grahamdigital.com/photo/2019/05/19/1140268550_1558269024435_21870279_ver1.0_1280_720.jpg
			//   https://sharedmedia.grahamdigital.com/photo/2019/05/19/1140268550_1558269024435_21870279_ver1.0_1280_720.jpg
			return src.replace(/^[a-z]+:\/\/[^/]*\/image\/+upload\/+view.*?[?&]url=([^&]*).*?$/, "$1");
		}

		if ((domain === "image.photohito.k-img.com" ||
			 domain === "photohito.k-img.com") &&
			string_indexof(src, "/uploads/") >= 0) {
			// http://image.photohito.k-img.com/uploads/photo33/user32067/a/7/a77a9f46cca054d6d488ab039382d140/a77a9f46cca054d6d488ab039382d140_s.jpg
			//   http://image.photohito.k-img.com/uploads/photo33/user32067/a/7/a77a9f46cca054d6d488ab039382d140/a77a9f46cca054d6d488ab039382d140_o.jpg
			// http://photohito.k-img.com/uploads/photo82/user81866/5/4/54cc586ea0191c8ad108c74bfff0a09d/54cc586ea0191c8ad108c74bfff0a09d_l.jpg
			//   http://photohito.k-img.com/uploads/photo82/user81866/5/4/54cc586ea0191c8ad108c74bfff0a09d/54cc586ea0191c8ad108c74bfff0a09d_o.jpg -- 4000x6016
			// o, l, s
			return src.replace(/_[a-z]*(\.[^/]*)/, "_o$1");
		}

		if (domain === "eiga.k-img.com") {
			// https://eiga.k-img.com/images/person/83193/300x.jpg
			//   https://eiga.k-img.com/images/person/83193/original.jpg
			// https://eiga.k-img.com/images/buzz/67970/b4763ecf68d81f0e/160.jpg?1505989880
			//   https://eiga.k-img.com/images/buzz/67970/b4763ecf68d81f0e.jpg?1505989880
			// https://eiga.k-img.com/images/movie/87956/photo/2a98637bcfd5c2c2/640.jpg?1531358070
			//   https://eiga.k-img.com/images/movie/87956/photo/2a98637bcfd5c2c2.jpg?1531358070
			// https://eiga.k-img.com/images/anime/news/104504/photo/ca6b941587bf429e/640.jpg
			//   https://eiga.k-img.com/images/anime/news/104504/photo/ca6b941587bf429e.jpg
			// https://eiga.k-img.com/images/top_news/4109/f47df35189459e32/320.jpg
			//   https://eiga.k-img.com/images/top_news/4109/f47df35189459e32.jpg
			// thanks to anonymous for reporting:
			// https://eiga.k-img.com/images/movie/81950/gallery/04.jpg?1426654966 -- 90x60
			//   https://eiga.k-img.com/images/movie/81950/gallery/04_large.jpg?1426654966 -- 640x349
			return src
				.replace(/(\/images\/+movie\/+[0-9]+\/+gallery\/+[0-9]+)\./, "$1_large.")
				.replace(/(\/images\/+[a-z]+\/+(?:[a-z]+\/+)?[0-9]+\/)[0-9]+x(?:[0-9]+)?(\.[^/.]*)$/, "$1original$2")
				.replace(/(\/images\/+[a-z_]+\/+(?:[a-z]+\/+)?[0-9]+\/(?:[a-z]+\/)?[0-9a-f]+)\/[0-9]+(\.[^/.]*)$/, "$1$2");
		}

		if (domain === "akiba-souken.k-img.com" ||
			// http://image.akiba-souken.k-img.com/images/article/000/602/t640_602346.jpg
			//   http://image.akiba-souken.k-img.com/images/article/000/602/602346.jpg
			domain === "image.akiba-souken.k-img.com") {
			// https://akiba-souken.k-img.com/assets/images/article/000/602/t640_602120.jpg
			//   https://akiba-souken.k-img.com/assets/images/article/000/602/602120.jpg
			// thanks to fireattack on github: https://github.com/qsniyg/maxurl/issues/199
			// https://akiba-souken.k-img.com/thumbnail/images/official/71/71cea5d83dfa537e053b8b8e31b98649.jpg?w=60&h=60
			//   https://akiba-souken.k-img.com/assets/images/official/71/71cea5d83dfa537e053b8b8e31b98649.jpg
			return src
				.replace(/\/thumbnail\/+images\/+/, "/assets/images/")
				.replace(/(\/images\/+[^/]+\/+(?:(?:[0-9]{3}\/+){2}|[0-9a-f]{2}\/+))(?:t[0-9]+_)?([^/]+?)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "image.yes24.com") {
			// http://image.yes24.com/goods/24213246/S
			// http://image.yes24.com/goods/24213246
			//   http://image.yes24.com/goods/24213246/L
			// http://image.yes24.com/dms/201802/%EC%8A%A4%EC%B9%B4%EC%9D%B4-%EA%B3%A0%EC%A0%95%EC%9A%B1.jpg
			// http://image.yes24.com/Goods/57840388/800x0
			// http://image.yes24.com/goods/76075109/L -- 3000x3000
			// http://image.yes24.com/goods/76175408/1150x1150 -- 150x150
			return src.replace(/(:\/\/[^/]*\/goods\/[0-9]+)(?:\/S)?$/i, "$1/L");
		}

		if (domain_nowww === "phileweb.com") {
			// thanks to fireattack on github: https://github.com/qsniyg/maxurl/issues/974
			// https://www.phileweb.com/interview/article/image.php?id=611&row=14
			// https://www.phileweb.com/news/photo/201812/6819.jpg
			//   https://www.phileweb.com/news/photo/201812/6819_big.jpg
			newsrc = src.replace(/(\/photo\/+[0-9]{6}\/+[0-9]+)\./, "$1_big.");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "img.danawa.com" ||
			// http://wallpoper.com/images/00/26/57/27/taylor-momsen_00265727_thumb.jpg
			//   http://wallpoper.com/images/00/26/57/27/taylor-momsen_00265727.jpg
			domain_nowww === "wallpoper.com" ||
			// https://cdn.maximsfinest.com/930d55d5bae81ab5ab5c4bca2a2eab8b42e503f85bbd48086c9a9c89945f12e7_thumb.jpg
			domain === "cdn.maximsfinest.com" ||
			// https://www.phileweb.com/news/photo/d-av/437/43780/2_thumb.jpg
			//   https://www.phileweb.com/news/photo/d-av/437/43780/2.jpg
			// https://www.phileweb.com/news/photo/interview/6/611/2_thumb.jpg
			//   https://www.phileweb.com/news/photo/interview/6/611/2.jpg
			domain_nowww === "phileweb.com" ||
			// https://imgpic.org/upload/images/e91e1c3d-938d-f6b0-ab71-593bcbf52253_thumb.jpg
			//   https://imgpic.org/upload/images/e91e1c3d-938d-f6b0-ab71-593bcbf52253.jpg
			(domain_nowww === "imgpic.org" && string_indexof(src, "/upload/images/") >= 0) ||
			// http://img10.imgdino.com/images/21620746826144988852_thumb.jpg
			//   http://img10.imgdino.com/images/21620746826144988852.jpg
			(domain_nosub === "imgdino.com" && domain.match(/img[0-9]*\.imgdino\.com/) && string_indexof(src, "/images/") >= 0) ||
			// https://foto-pic.net/images/92186498534843139589_thumb.jpg
			//   https://foto-pic.net/images/92186498534843139589.jpg
			(domain_nowww === "foto-pic.net" && /\/images\/+[0-9]{10,}_thumb\./.test(src)) ||
			// https://storage.cobak.co/uploads/1524570414485762_2d28e314d0_thumb.jpg
			(domain === "storage.cobak.co" && string_indexof(src, "/uploads/") >= 0) ||
			// https://mycotopia.net/uploads/monthly_11_2016/post-147969-0-17237500-1479361240_thumb.jpg
			(domain_nowww === "mycotopia.net" && string_indexof(src, "/uploads/") >= 0) ||
			// http://static.becomegorgeous.com/img/arts/2011/Apr/28/4386/pixielotthairstyles_thumb.jpg
			(domain === "static.becomegorgeous.com" && string_indexof(src, "/img/") >= 0) ||
			// http://i.imagepow.com/2-68/barbara-palvin-10_thumb.jpg
			domain === "i.imagepow.com" ||
			// https://cdn2.techadvisor.co.uk/cmsdata/features/3651601/gta6rumoursgtaonline_thumb.png
			(domain_nosub === "techadvisor.co.uk" && domain.match(/^cdn[0-9]*\./)) ||
			// thanks to dym-sh on github: https://github.com/qsniyg/maxurl/issues/1036
			// https://images.macworld.co.uk/cmsdata/features/3669087/dark_mode_thumb.jpg
			domain === "images.macworld.co.uk" ||
			// http://www.funtasticecards.com/postcard/images/quote-japanese-animated-girl-love_thumb.gif
			(domain_nowww === "funtasticecards.com" && string_indexof(src, "/images/") >= 0) ||
			// https://www.hockey-live.sk/images/ovechkin_thumb.jpg
			(domain_nowww === "hockey-live.sk" && string_indexof(src, "/images/") >= 0) ||
			// https://khaandaniha.ir/Upload/Public/Content/Images/1398/03/04/0159330066e_thumb.jpeg
			(domain_nowww === "khaandaniha.ir" && src.match(/\/Upload\/+Public\/+Content\/+Images\/+/)) ||
			// https://www.mediavida.com/imagenes/2009/7/cine-musica-libros-y-comics/62369_harry_potter_misterio_principe_2009_0_thumb.jpg
			(domain_nowww === "mediavida.com" && string_indexof(src, "/imagenes/") >= 0) ||
			// http://img.twitrer.com/upload/2/53/253ba5e34957482d46887976a716d5d3_thumb.jpg
			(domain === "img.twitrer.com" && string_indexof(src, "/upload/") >= 0) ||
			// http://img.beevar.com/upload/1/92/192d08bf43ce0dc8_thumb.jpg
			(domain === "img.beevar.com" && string_indexof(src, "/upload/") >= 0) ||
			// http://adobe-abid.waphall.com/images/Adobe-Logos-HD_1_thumb.png
			(domain === "adobe-abid.waphall.com" && string_indexof(src, "/images/") >= 0) ||
			// https://cdn2.cdnme.se/cdn/9-2/631991/images/2011/emmood-3_143059858_thumb.jpg
			(domain_nosub === "cdnme.se" && string_indexof(src, "/images/") >= 0) ||
			// https://znews-photo.zadn.vn/Uploaded/neg_yslewlx/2019_04_26/selenagomezwedayapril252019billboard1548_thumb.jpg
			//   https://znews-photo.zadn.vn/uploaded/neg_yslewlx/2019_04_26/selenagomezwedayapril252019billboard1548.jpg
			(domain_nosub === "zadn.vn" && src.match(/\/uploaded\//i)) ||
			// thanks to nimbuz on discord:
			// https://www.tv-tokyo.co.jp/raisechan2/gallery/?trgt=s_02&gid=88717#tx_photo_gallery
			// https://www.tv-tokyo.co.jp/photo/img/210817/e49e0389ff4311eb83cfa4a8c83d00f3_thumb.jpg
			//   https://www.tv-tokyo.co.jp/photo/img/210817/e49e0389ff4311eb83cfa4a8c83d00f3.jpg
			(domain_nowww === "tv-tokyo.co.jp" && /\/photo\/+img\//.test(src)) ||
			// thanks to fireattack on discord:
			// https://ecdnimg.toranoana.jp/ec/img/21/0006/65/11/210006651178-1p_thumb.jpg
			//   https://ecdnimg.toranoana.jp/ec/img/21/0006/65/11/210006651178-1p.jpg
			domain === "ecdnimg.toranoana.jp" ||
			// https://www.bellazon.com/main/uploads/monthly_01_2015/post-40923-0-58758100-1422215257_thumb.jpg
			domain_nowww === "bellazon.com") {
			// http://img.danawa.com/cms/img/2010/11/19/%C7%D6%C6%D1_thumb.png
			newsrc = src.replace(/_thumb(\.[^/.]*)(?:[?#].*)?$/, "$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nosub === "pcgames.com.cn" && domain.match(/^img[0-9]*\./)) {
			// http://img.pcgames.com.cn/images/upload/upc/tx/gamephotolib/1510/29/c3/14626065_1446106131090_small.jpg
			//   http://img.pcgames.com.cn/images/upload/upc/tx/gamephotolib/1510/29/c3/14626065_1446106131090.jpg
			// http://img0.pcgames.com.cn/pcgames/1412/19/4672783_11386975_980x1200_0_thumb.jpg
			//   http://img0.pcgames.com.cn/pcgames/1412/19/4672783_11386975_980x1200_0.jpg
			//   http://img0-arch.pconline.com.cn/pcgames/1412/19/4672783_11386975.jpg -- doesn't work
			//   http://img0-arch.pconline.com.cn/pcgames/1412/19/4672783_11386975_0.jpg -- doesn't work
			return src.replace(/_(?:thumb|small|medium)(\.[^/.]*)$/, "$1");
		}

		if (domain_nowww === "mosaicon.hu" && string_indexof(src, "/wallpapers/") >= 0) {
			// http://mosaicon.hu/wallpapers/sztarok/fullhd-hatterkep-368046462-rihanna_thumb.jpg
			//   http://mosaicon.hu/wallpapers/sztarok/fullhd-hatterkep-368046462-rihanna_largethumb.jpg
			//   http://mosaicon.hu/wallpapers/sztarok/fullhd-hatterkep-368046462-rihanna.jpg
			return src.replace(/_(?:large)?thumb(\.[^/.]*)$/, "$1");
		}

		if (domain_nosub === "imagecurl.com") {
			// https://imagecurl.com/images/25047944450893600587_thumb.jpg
			//   https://imagecurl.com/images/25047944450893600587_medium.jpg
			//   https://imagecurl.com/images/25047944450893600587.jpg
			// https://cdn.imagecurl.com/images/25047944450893600587_thumb.jpg
			//   https://cdn.imagecurl.com/images/25047944450893600587.jpg
			return src.replace(/(\/images\/+[0-9]{5,})_(?:thumb|medium)(\.[^/.]*)$/, "$1$2");
		}

		if (domain === "item.ssgcdn.com") {
			// http://item.ssgcdn.com/58/31/79/item/1000023793158_i1_1000.jpg
			//   http://item.ssgcdn.com/58/31/79/item/1000023793158_i1.jpg
			return src.replace(/(\/item\/[^/]*)_[0-9]+(\.[^/.]*)$/, "$1$2");
		}

		if (domain_nosub === "coupangcdn.com" && domain.match(/thumbnail[0-9]*\.coupangcdn\.com/)) {
			// https://thumbnail3.coupangcdn.com/thumbnails/remote/48x48ex/image/product/image/vendoritem/2016/11/02/3054079121/95e6ce14-cd6e-43ef-89af-6f50046c19e8.jpg
			//   https://image3.coupangcdn.com/image/product/image/vendoritem/2016/11/02/3054079121/95e6ce14-cd6e-43ef-89af-6f50046c19e8.jpg
			return src
				.replace(/thumbnail([0-9]*\.coupangcdn\.com)/, "image$1")
				.replace(/\/thumbnails\/remote\/[^/]*\//, "/");
		}

		if (domain === "image.notepet.co.kr") {
			// http://image.notepet.co.kr/resize/540x-/seimage/20160127%2F201601271000_61120010294826_1.jpg
			return src.replace(/\/resize\/[^/]*\//, "/");
		}

		// https://echosting.cafe24.com/Main/
		if (domain_nowww === "koreamg.com" ||
			// http://yufit.co.kr/web/product/medium/201802/1402_shop1_771117.jpg
			domain_nowww === "yufit.co.kr" ||
			// http://lovelanc.com/web/product/small/gz20171225_j32.jpg
			//   http://lovelanc.com/web/product/big/gz20171225_j32.jpg
			domain_nowww === "lovelanc.com" ||
			// http://mimibabi.com/web/product/small/201606/8563_shop1_617841.jpg
			domain_nowww === "mimibabi.com" ||
			// https://akamai.poxo.com/socal/getbarrel.com/web/product/medium/go_eve-white_black0.jpg
			//   https://akamai.poxo.com/socal/getbarrel.com/web/product/big/go_eve-white_black00.jpg
			// https://akamai.poxo.com/socal/getbarrel.com/web/product/tiny/w_eve_rashguard_papayawht0.jpg
			//   https://akamai.poxo.com/socal/getbarrel.com/web/product/big/w_eve_rashguard_papayawht00.jpg
			domain === "akamai.poxo.com" ||
			// http://getbarrel.com/web/product/big/go_eve-white_black00.jpg
			domain_nowww === "getbarrel.com" ||
			// http://sexypet.co.kr/web/product/medium/201711/856_shop1_379496.jpg
			//   http://sexypet.co.kr/web/product/big/201711/856_shop1_379496.jpg -- upscaled?
			domain_nowww === "sexypet.co.kr" ||
			// https://withdrama.net/web/product/medium/withdrama_901.jpg
			//   https://withdrama.net/web/product/big/withdrama_901.jpg
			domain_nowww === "withdrama.net" ||
			// http://bookculture.co.kr/product/detail.html?product_no=107573&cate_no=164&display_group=1
			// http://bookculture.co.kr/web/product/medium/201905/a9dd5883f1bc104d7ddeb6c4faf9a1b1.jpg
			//   http://bookculture.co.kr/web/product/big/201905/90957b7ab17a2d2ca15f038b9220c295.jpg
			//domain_nowww === "bookculture.co.kr" ||
			// http://www.comicbookclub.co.kr/product/detail.html?product_no=4155&cate_no=1&display_group=3
			// http://www.comicbookclub.co.kr/web/product/tiny/201902/09b398f5996561b79ae039567e888e33.jpg
			//   http://www.comicbookclub.co.kr/web/product/big/201902/2db1140f95b2b01f650064710bc3a32e.jpg
			//domain_nowww === "comicbookclub.co.kr" ||
			// thanks to Broly on discord:
			// https://cafe24img.poxo.com/maymacgandy/web/product/extra/small/201809/6352370a9785140e44ac350e5ebcbf54.jpg
			//   https://cafe24img.poxo.com/maymacgandy/web/product/extra/big/201809/6352370a9785140e44ac350e5ebcbf54.jpg
			// https://cafe24img.poxo.com/maymacgandy/web/product/extra/small/201809/a2b9fadf4b74735da7b3c9cc8b07fe0f.jpg
			//   https://cafe24img.poxo.com/maymacgandy/web/product/extra/big/201809/a2b9fadf4b74735da7b3c9cc8b07fe0f.jpg
			domain === "cafe24img.poxo.com" ||
			// thanks to anonymous for reporting:
			// https://dunststudio.com/web/product/extra/small/202308/18a01ce03c3b018ecd22b4d9661c2ca3.jpg
			//   https://dunststudio.com/web/product/extra/big/202308/18a01ce03c3b018ecd22b4d9661c2ca3.jpg
			domain_nowww === "dunststudio.com" ||
			// http://fncstore.com/web/product/small/201805/624_shop1_15268628600267.jpg
			domain_nowww === "fncstore.com") {
			// http://koreamg.com/web/product/big/201511/1198_shop1_844046.jpg
			newsrc = src.replace(/(\/web\/+product\/+(?:extra\/+)?)(?:tiny|small|medium)\//, "$1big/");
			if (newsrc !== src) {
				return [newsrc, newsrc.replace(/0(\.[^/.]*)(?:[?#].*)?$/, "00$1")];
			}
		}

		if (domain_nosub === "mynavi.jp") {
			// https://news.mynavi.jp/article/20160717-a030/images/004.jpg
			//   https://news.mynavi.jp/article/20160717-a030/images/004l.jpg
			// https://news.mynavi.jp/article/20180219-586202/index_images/index.jpg/iapp
			//   https://news.mynavi.jp/article/20180219-586202/index_images/index.jpg
			//   https://news.mynavi.jp/article/20180219-586202/images/001l.jpg
			// thanks to nimbuz on discord:
			// https://news.mynavi.jp/article/20220217-2274602/images/003.jpg/webp
			//   https://news.mynavi.jp/article/20220217-2274602/images/003l.jpg
			return src
				.replace(/\/index_images\/[^/]*(?:\/[^/]*)?$/, "/images/001l.jpg")
				.replace(/\/images\/([0-9]+)(\.[^/.]*)$/, "/images/$1l$2")
				.replace(/(\/images\/+[0-9]+l?\.[^/.]+)\/+webp(?:[?#].*)?$/, "$1");
		}

		if (domain === "cdn.deview.co.jp") {
			// https://cdn.deview.co.jp/imgs/news_image.img.php?am_file=757f7eac8208248ef689a9c8f195cc0a.jpg&am_width=10&am_height=10
			// https://cdn.deview.co.jp/imgs/news_image.img.php?am_file=8a0abbef91348f3b44e2225c761fe8e8.jpg&am_width=0&am_height=0
			//   https://cdn.deview.co.jp/imgs/news/8/a/0/8a0abbef91348f3b44e2225c761fe8e8.jpg
			//return src.replace(/\/imgs\/news_image\.img\.php.*?(am_file=[^&]*).*/, "/imgs/news_image.img.php?$1&am_width=0&am_height=0");
			return src.replace(/\/imgs\/news_image\.img\.php.*?am_file=([^&])([^&])([^&])([^&]*).*/, "/imgs/news/$1/$2/$3/$1$2$3$4");
		}

		if (domain === "imgcache.dealmoon.com") {
			// http://imgcache.dealmoon.com/fsvr.dealmoon.com/dealmoon/082/3a3/a3a/e33/eed/93a/ffd/aae/d10/29e/37.jpg_600_0_15_363b.jpg
			//   http://fsvr.dealmoon.com/dealmoon/082/3a3/a3a/e33/eed/93a/ffd/aae/d10/29e/37.jpg
			return src.replace(/.*?:\/\/[^/]*\/(.*?)(\.[^/._]*)_[^/]*?$/, "http://$1$2");
		}

		// magento
		if (domain === "www.usmall.us" ||
			// http://www.sofiehouse.co/media/catalog/product/cache/1/image/9df78eab33525d08d6e5fb8d27136e95/E/l/Elegant-Sweetheart-Long-Gold-Sequined-Taylor-Swift-Red-Carpet-Celebrity-Dress_2.jpg
			//   http://www.sofiehouse.co/media/catalog/product/E/l/Elegant-Sweetheart-Long-Gold-Sequined-Taylor-Swift-Red-Carpet-Celebrity-Dress_2.jpg
			domain === "www.sofiehouse.co" ||
			// https://www.thecelebritydresses.com/media/catalog/product/cache/1/small_image/295x/040ec09b1e35df139433887a97daa66f/t/a/taylor_swift_red_lace_party_dress_iheartradio_music_festival_2012_dresses_5.jpg
			//   https://www.thecelebritydresses.com/media/catalog/product/cache/1/image/650x/040ec09b1e35df139433887a97daa66f/t/a/taylor_swift_red_lace_party_dress_iheartradio_music_festival_2012_dresses_5.jpg
			//   https://www.thecelebritydresses.com/media/catalog/product/t/a/taylor_swift_red_lace_party_dress_iheartradio_music_festival_2012_dresses_5.jpg
			domain === "www.thecelebritydresses.com" ||
			// https://www.celebredcarpetdresses.com/media/catalog/product/cache/8/image/9df78eab33525d08d6e5fb8d27136e95/t/a/taylor-swift-at-the-2012-billboard-music-awards-2.jpg
			//   https://www.celebredcarpetdresses.com/media/catalog/product/t/a/taylor-swift-at-the-2012-billboard-music-awards-2.jpg
			domain === "www.celebredcarpetdresses.com" ||
			// https://www.minimal.co.id/media/catalog/product/cache/1/small_image/252x/7b8fef0172c2eb72dd8fd366c999954c/1/3/136_02_02dsc00253ed.jpg
			//   https://www.minimal.co.id/media/catalog/product/1/3/136_02_02dsc00253ed.jpg
			domain === "www.minimal.co.id" ||
			// http://www.bridesmaidca.ca/media/catalog/product/cache/1/thumbnail/56x90/9df78eab33525d08d6e5fb8d27136e95/B/D/BD2305-1832-01/BD2305CA1832-Mermaid-Trumpet-Blue-Stretch-Satin-V-Neck-Floor-Length-Bridesmaid-Dresses-11.jpg
			//   http://www.bridesmaidca.ca/media/catalog/product/cache/1/image/9df78eab33525d08d6e5fb8d27136e95/B/D/BD2305-1832-01/BD2305CA1832-Mermaid-Trumpet-Blue-Stretch-Satin-V-Neck-Floor-Length-Bridesmaid-Dresses-31.jpg
			// http://www.bridesmaidca.ca/media/catalog/product/cache/1/image/9df78eab33525d08d6e5fb8d27136e95/B/D/BD1749-03/Short-Lace-and-Tulle-Black-Bridesmaid-Dress-BD-CA1749-33.jpg
			// http://www.bridesmaidca.ca/media/catalog/product/cache/1/image/9df78eab33525d08d6e5fb8d27136e95/B/D/BD1749-02/Short-Lace-and-Tulle-Black-Bridesmaid-Dress-BD-CA1749-32.jpg
			domain === "www.bridesmaidca.ca" || // doesn't work
			// http://www.sisley-paris.com/ko-KR/media/catalog/product/cache/3/sisley_hd_image/450x/9df78eab33525d08d6e5fb8d27136e95/sisley_hd_image/3473311704000.jpg
			//   http://www.sisley-paris.com/ko-KR/media/catalog/product/cache/3/sisley_hd_image/9df78eab33525d08d6e5fb8d27136e95/sisley_hd_image/3473311704000.jpg
			//   http://www.sisley-paris.com/ko-KR/media/catalog/product/sisley_hd_image/3473311704000.jpg
			domain === "www.sisley-paris.com" ||
			// https://d2ovdo5ynwfl3w.cloudfront.net/media/catalog/product/cache/5/image/03deeb199a85666540b12534551b8531/0/0/001CH-003-03172-1_1_1-DS.jpg
			//   https://d2ovdo5ynwfl3w.cloudfront.net/media/catalog/product/0/0/001CH-003-03172-1_1_1-DS.jpg -- doesn't work
			domain === "d2ovdo5ynwfl3w.cloudfront.net" ||
			// https://d1cizyvjjqnss7.cloudfront.net/media/catalog/product/cache/1/image/700x700/af097278c5db4767b0fe9bb92fe21690/2/0/2017-9-26-isabelle-31991_2_2.jpg
			//   https://d1cizyvjjqnss7.cloudfront.net/media/catalog/product/2/0/2017-9-26-isabelle-31991_2_2.jpg
			domain === "d1cizyvjjqnss7.cloudfront.net" ||
			// https://executiveponies.com/media/catalog/product/cache/2/thumbnail/90x144/9df78eab33525d08d6e5fb8d27136e95/3/2/327a6104_copy.jpg
			//   https://executiveponies.com/media/catalog/product/3/2/327a6104_copy.jpg
			domain_nowww === "executiveponies.com" ||
			// http://www.trendygowns.com/media/catalog/product/cache/1/image/1190x1920/5e06319eda06f020e43594a9c230972d/s/c/scd303-03/isabel-lucas-2011-met-ball-dresses-ball-gown-floor-length-charmeuse-dresses(scd303)-33.jpg
			domain_nowww === "trendygowns.com" ||
			// https://www.bramimi.com/static/ecommerce/251/251360/media/catalog/product/cache/1/thumbnail/40x56/9df78eab33525d08d6e5fb8d27136e95/b/a/ba0b1a68-1e98-43cf-bd66-97b4e41700fc-549-0000006e636e9c3d/www.bramimi.com-m05-11.jpeg
			//   https://www.bramimi.com/static/ecommerce/251/251360/media/catalog/product/cache/1/image/9df78eab33525d08d6e5fb8d27136e95/b/a/ba0b1a68-1e98-43cf-bd66-97b4e41700fc-549-0000006e636e9c3d/www.bramimi.com-m05-31.jpeg
			// 11.jpeg -> 31.jpeg
			//domain_nowww === "bramimi.com" ||
			domain === "www.lizandliz.com" ||
			// thanks to MinuteAd8502 on github: https://github.com/qsniyg/maxurl/issues/803
			// https://cdn.sportshop.com/media/catalog/product/cache/stores/thumbnail/90x80/9df78eab33525d08d6e5fb8d27136e95/a/d/adidas-br9970_242245.jpg
			//   https://cdn.sportshop.com/media/catalog/product/a/d/adidas-br9970_242245.jpg
			domain === "cdn.sportshop.com" ||
			// https://cdn-4.cdp.pl/media/catalog/product/cache/1/image/x100/17f82f742ffe127f42dca9de82fb58b1/7/3/7321930350823a_1_1.jpg
			//   https://cdn-4.cdp.pl/media/catalog/product/7/3/7321930350823a_1_1.jpg
			(domain_nosub === "cdp.pl" && domain.match(/^cdn-[0-9]+\./)) ||
			src.match(/(?:\/media)?\/catalog\/product\/cache\/(?:[0-9]*\/[^/]*\/)?(?:[0-9]+x(?:[0-9]+)?\/)?[0-9a-f]{32}\//)) {
			// https://www.sonassi.com/blog/knowledge-base/deconstructing-the-cache-image-path-on-magento
			//
			// http://www.usmall.us/media/catalog/product/cache/16/image/600x600/d58d44b981214661663244ef00ea7e30/1/7/17_9__2.jpg
			//   http://www.usmall.us/media/catalog/product/cache/16/image/d58d44b981214661663244ef00ea7e30/1/7/17_9__2.jpg
			// https://www.lizandliz.com/media/catalog/product/cache/4/thumbnail/492x705/9df78eab33525d08d6e5fb8d27136e95/t/a/taylor-swift-red-dress-cma-awards-2013-02.jpg
			//   https://www.lizandliz.com/media/catalog/product/cache/4/thumbnail/9df78eab33525d08d6e5fb8d27136e95/t/a/taylor-swift-red-dress-cma-awards-2013-02.jpg
			//   https://www.lizandliz.com/media/catalog/product/t/a/taylor-swift-red-dress-cma-awards-2013-02.jpg
			// https://www.lizandliz.com/media/catalog/product/cache/4/image/492x705/9df78eab33525d08d6e5fb8d27136e95/t/a/taylor-swift-red-dress-cma-awards-2013-01.jpg
			//   https://www.lizandliz.com/media/catalog/product/cache/4/image/9df78eab33525d08d6e5fb8d27136e95/t/a/taylor-swift-red-dress-cma-awards-2013-01.jpg
			//   https://www.lizandliz.com/media/catalog/product/t/a/taylor-swift-red-dress-cma-awards-2013-01.jpg
			// https://www.naturehills.com/media/catalog/product/cache/5643cdae475c4be953fc8c21f6960dc2/f/o/forsythia-fiesta-medium-shrub-425x425.jpg
			//   https://www.naturehills.com/media/catalog/product/f/o/forsythia-fiesta-medium-shrub-425x425.jpg
			/*return src
				.replace(/(\/cache\/[0-9]*\/)small_image\//, "$1/image/")
				.replace(/\/(thumbnail|image)\/[0-9]+x[0-9]+\//, "/$1/");*/
			newsrc = src.replace(/\/+cache\/+(?:(?:[0-9]+|stores)\/+[^/]*\/+)?(?:[0-9]*x[0-9]*\/+)?[0-9a-f]{32}\/+((?:.\/+.\/+)|(?:[^/]*\/+))([^/]*)$/, "/$1$2");
			if (newsrc !== src)
				return newsrc;
			// doesn't work:
			/*newsrc = src.replace(/(\/+cache\/+[0-9]+\/+)thumbnail\/+[0-9]+x[0-9]+\/+/, "$1image/");
			if (newsrc !== src)
				return newsrc;*/
			//return src.replace(/\/image\/[0-9]+x[0-9]+\//, "/image/");
		}

		if (domain === "cdn.okdress.co.nz" ||
			// https://www.promshopau.com/media/catalog/product/cache/1/small_image/400x600/va/cymz2697/5wxh3src.jpg?1496649473
			// forbidden
			(domain_nowww === "promshopau.com" && false)) {
			// https://cdn.okdress.co.nz/media/catalog/product/cache/1/small_image/400x600/va/crqx3207/yhhv4ee5.jpg?1497240049
			//   https://cdn.okdress.co.nz/media/catalog/product/va/crqx3207/yhhv4ee5.jpg?1497240049
			return src.replace(/(\/media\/catalog\/product\/)cache\/[0-9]*\/[^/]*\/[0-9]+x[0-9]+\//, "$1");
		}

		if (domain === "img.nextmag.com.tw") {
			// http://img.nextmag.com.tw//campaign/28/640x_dc09fc97b8f881555c21e8df08f39d01.jpg
			return src.replace(/\/[0-9]+x(?:[0-9]+)?_([^/]*)$/, "/$1");
		}

		if (domain_nosub === "meitudata.com") {
			// http://mvimg10.meitudata.com/568fd904846585397.jpg!thumb320
			return src.replace(/![^/]*$/, "");
		}

		if (domain === "www.shogakukan.co.jp") {
			// https://www.shogakukan.co.jp/thumbnail/books/09682221
			//   https://www.shogakukan.co.jp/thumbnail/snsbooks/09682221
			return src.replace(/\/thumbnail\/books\//, "/thumbnail/snsbooks/");
		}

		if (domain === "images.sysapi.mtg.now.com") {
			// https://images.sysapi.mtg.now.com/mposter/album/m/VASB00139622A_m.jpg
			//   https://images.sysapi.mtg.now.com/mposter/album/o/VASB00139622A_o.jpg
			return src.replace(/\/[a-z]\/([^/]*)_[a-z](\.[^/.]*)$/, "/o/$1_o$2");
		}

		if (domain_nosub === "lst.fm" && domain.match(/img[0-9]*[^.]*\.lst\.fm/)) {
			// http://img2-ak.lst.fm/i/u/174s/ac79a7aa21de5694760ad9228e15c6a5.png
			//   http://img2-ak.lst.fm/i/u/ac79a7aa21de5694760ad9228e15c6a5.png
			// http://img2-ak.lst.fm/i/u/avatar170s/42333f92bcb14d3e89e3ad2d5e800977.jpg
			//   http://img2-ak.lst.fm/i/u/42333f92bcb14d3e89e3ad2d5e800977.jpg
			return src.replace(/(\/i\/[a-z]\/)(?:avatar)?[0-9]+s\//, "$1");
		}

		if (domain === "www.hdwallpapers.in" ||
			// http://www.bhmpics.com/thumbs/empty_road_on_a_mountain-t2.jpg
			//   http://www.bhmpics.com/walls/empty_road_on_a_mountain-wide.jpg
			// doesn't work for all:
			// http://www.bhmpics.com/wallpapers/selena_gomez_gq-852x480.jpg
			domain_nowww === "bhmpics.com" ||
			domain_nowww === "freshwallpapers.in") {
			// https://www.hdwallpapers.in/download/selena_gomez_2018_4k_8k-1440x2560.jpg
			// https://www.hdwallpapers.in/thumbs/2018/selena_gomez_2018_4k_8k-t2.jpg
			//   https://www.hdwallpapers.in/walls/selena_gomez_2018_4k_8k-wide.jpg
			// http://freshwallpapers.in/thumbs/sonam_kapoor_sexy_wallpaper-t1.jpg
			//   http://freshwallpapers.in/walls/sonam_kapoor_sexy_wallpaper-wide.jpg
			return src
				.replace(/\/(?:download|thumbs)\//, "/walls/")
				.replace(/-[^-_/.]*(\.[^/.]*)$/, "-wide$1");
		}

		if (domain_nowww === "superwallpapers.in") {
			// http://www.superwallpapers.in/hdwallpapers/parineeti-chopra-shuddh-desi-romance_100_100_100_ff.jpg
			//   http://www.superwallpapers.in/hdwallpapers/parineeti-chopra-shuddh-desi-romance.jpg
			return src.replace(/(\/hdwallpapers\/+[^/]+)_[0-9]+_[0-9]+_[0-9]+_[0-9a-f]{2}(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if ((domain_nosub === "deezer.com" || domain_nosub === "dzcdn.net") && /images\./.test(domain)) {
			// not reliable, can upscale
			// http://e-cdn-images.deezer.com/images/artist/7d026f08b34a098e270a663839d8ae8e/200x200-000000-80-0-0.jpg
			//   http://e-cdn-images.deezer.com/images/artist/7d026f08b34a098e270a663839d8ae8e/99999999999x99999999999-000000-100-0-0.jpg -- 1200x1200, unscaled
			//   http://e-cdn-images.deezer.com/images/artist/7d026f08b34a098e270a663839d8ae8e/99999999999x0-000000-100-0-0.jpg -- 800x1200, unscaled, more height, less detail
			//   http://e-cdn-images.deezer.com/images/artist/7d026f08b34a098e270a663839d8ae8e/99999999999x0.jpg -- 800x1200
			//   http://e-cdn-images.deezer.com/images/artist/7d026f08b34a098e270a663839d8ae8e/2700x0-000000-100-0-0.jpg -- 1800x2700
			// https://e-cdns-images.dzcdn.net/images/artist/aca61b38901f884503e9cb0fbf0b93b4/200x200-000000-80-0-0.jpg
			//   https://e-cdns-images.dzcdn.net/images/artist/aca61b38901f884503e9cb0fbf0b93b4/99999999999x0-000000-100-0-0.jpg -- 801x1200, definitely scaled
			// http://e-cdn-images.deezer.com/images/artist/076659ecd6d7dc5042df677a6a24ea9a/500x500.jpg
			// https://e-cdns-images.dzcdn.net/images/artist/7d026f08b34a098e270a663839d8ae8e/999x999.jpg
			// https://e-cdns-images.dzcdn.net/images/cover/f8bdca63c2dce11670b9c0b54684ddcb/4000x0.jpg -- 4000x4000
			// https://e-cdns-images.dzcdn.net/images/artist/d1f9aa9e4271ab737b0c2b456ba6e53e/1200x0.jpg -- 1207x1200
			// max appears to be 4000

			// thanks to Rnksts on discord for the urls below:
			// https://e-cdns-images.dzcdn.net/images/cover/36fe13382bfca28a5edcb36e6b7ee68c/264x264-000000-80-0-0.jpg
			// https://e-cdns-images.dzcdn.net/images/cover/36fe13382bfca28a5edcb36e6b7ee68c/2000x2000-000000-80-0-0.jpg -- 1200x1200, lower quality
			// https://e-cdns-images.dzcdn.net/images/cover/36fe13382bfca28a5edcb36e6b7ee68c/2000x2000-000000-100-0-0.jpg -- unauthorized
			// https://e-cdns-images.dzcdn.net/images/cover/36fe13382bfca28a5edcb36e6b7ee68c/1921x1921-000000-100-0-0.jpg -- unauthorized
			// https://e-cdns-images.dzcdn.net/images/cover/36fe13382bfca28a5edcb36e6b7ee68c/1920x1920-000000-100-0-0.jpg -- 1200x1200
			// https://e-cdns-images.dzcdn.net/images/cover/36fe13382bfca28a5edcb36e6b7ee68c/1401x1401-000000-100-0-0.jpg -- 1200x1200
			// https://e-cdns-images.dzcdn.net/images/cover/36fe13382bfca28a5edcb36e6b7ee68c/1400x1400-000000-100-0-0.jpg -- 1400x1400

			// https://e-cdns-images.dzcdn.net/images/cover/5cd71ce9813d9c7559d9c4eda624eb76/2000x2000-000000-80-0-0.jpg -- 2000x2000, lower quality
			// https://e-cdns-images.dzcdn.net/images/cover/5cd71ce9813d9c7559d9c4eda624eb76/2000x2000-000000-80-0-0.jpg -- unauthorized
			// https://e-cdns-images.dzcdn.net/images/cover/5cd71ce9813d9c7559d9c4eda624eb76/1920x1920-000000-100-0-0.jpg -- 1920x1920
			//   https://e-cdns-images.dzcdn.net/images/cover/5cd71ce9813d9c7559d9c4eda624eb76/4000x0-000000-100-0-0.jpg -- 4000x4000

			// https://e-cdns-images.dzcdn.net/images/cover/79bf0fcde7554320d40681e21e043c0a/264x264-000000-80-0-0.jpg
			// https://e-cdns-images.dzcdn.net/images/cover/79bf0fcde7554320d40681e21e043c0a/2000x2000-000000-80-0-0.jpg -- unauthorized
			// https://e-cdns-images.dzcdn.net/images/cover/79bf0fcde7554320d40681e21e043c0a/2000x2000-000000-100-0-0.jpg -- unauthorized
			// https://e-cdns-images.dzcdn.net/images/cover/79bf0fcde7554320d40681e21e043c0a/1921x1921-000000-100-0-0.jpg -- unauthorized
			// https://e-cdns-images.dzcdn.net/images/cover/79bf0fcde7554320d40681e21e043c0a/1920x1920-000000-100-0-0.jpg -- 1920x1920
			// https://e-cdns-images.dzcdn.net/images/cover/79bf0fcde7554320d40681e21e043c0a/1800x1800-000000-100-0-0.jpg
			// if the size is larger than the image, it will scale back down to 1200 on the largest side

			newsrc = src.replace(/(\/[0-9a-f]{32}\/+[0-9]+x[0-9]+)(?:(?:-[0-9]+){4})?(\.[^/.]+)(?:[?#].*)?$/, "$1-000000-100-0-0$2");
			if (newsrc !== src)
				return newsrc;

			match = src.match(/\/([0-9a-f]{32})\/+([0-9]+)x([0-9]+)/);
			if (match) {
				id = match[1]
				var current_x = parseInt(match[2]);
				var current_y = parseInt(match[3]);

				if (current_x < 1200 && current_y < 1200 && !problem_excluded("possibly_upscaled")) {
					return {
						url: src.replace(/(\/[0-9a-f]{32}\/+)[0-9]+x[0-9]+/, "$11200x0"),
						problems: {
							possibly_upscaled: true
						}
					};
				} else if (get_image_size && options.cb && !problem_excluded("bruteforce")) {
					var mingood = 1200;
					var minbad = null;
					var firstrun = true;
					var currentsrc = src;

					// thanks to Rnksts on discord for the idea to use a quality of 1 while testing
					var get_deezer_image_url = function(origsrc, newsize, newquality) {
						return origsrc.replace(/(\/[0-9a-f]{32}\/+)[0-9]+x[0-9]+(?:(?:-[0-9]+){4})?(\.[^/.]+)(?:[?#].*)?$/, "$1" + newsize + "-000000-" + newquality + "-0-0$2");
					}

					if (current_x <= 1200) {
						currentsrc = get_deezer_image_url(currentsrc, "1201x0", 1);
						firstrun = false;
					}

					var cache_key = "deezer:" + id;

					var fetch_image_size = function(src, cb) {
						api_cache.fetch("deezer:" + src, cb, function(done) {
							get_image_size(src, function(x, y) {
								done([x, y], 60*60);
							});
						});
					};

					var try_new_image = function() {
						fetch_image_size(currentsrc, function(xy) {
							if (window.do_stop)
								return;

							var x = xy[0];
							var y = xy[1];

							//console_log(currentsrc, x, y);

							if (!x || !y) {
								if (!minbad || current_x < minbad) {
									minbad = current_x;
								}
							} else {
								var largest = Math_max(x, y);
								if (x === 1200 || y === 1200) {
									if (!minbad || current_x < minbad) {
										minbad = current_x;
									}
								} else {
									if (current_x > mingood) {
										mingood = current_x;
									}
								}
							}

							if (!minbad) {
								if (firstrun && current_x < 4000) {
									current_x++;
								} else if (current_x < 1920) {
									current_x = 1921;
								} else if (current_x < 4000) {
									current_x *= 2;

									if (current_x < 4000)
										current_x = 4000;
								}
							} else if ((minbad - mingood) > 1) {
								current_x = (mingood + Math_floor((minbad - mingood) / 2)) | 0;
							}

							//console_log(mingood, minbad, current_x);

							var goodsrc = get_deezer_image_url(currentsrc, mingood + "x0", 100);

							if (current_x !== mingood) {
								var newsrc = get_deezer_image_url(currentsrc, current_x + "x0", 1);
								if (newsrc !== currentsrc) {
									currentsrc = newsrc;

									firstrun = false;
									try_new_image();
								} else {
									options.cb(goodsrc);
								}
							} else {
								options.cb(goodsrc);
							}
						});
					};

					if (get_image_size && options.cb) {
						try_new_image();
						return {
							waiting: true
						};
					}
				} else if (current_x < 1920 && current_y < 1920) {
					return {
						url: src.replace(/(\/[0-9a-f]{32}\/+)[0-9]+x[0-9]+/, "$11920x0"),
						problems: {
							possibly_upscaled: true
						}
					};
				}
			}
			//return src.replace(/\/[0-9]+x[0-9]+-[0-9]+-[0-9]+-[0-9]+-[0-9]+(\.[^/.]*)$/, "/99999999999x0-000000-100-0-0$1");
		}

		if (domain === "cdn.wallpaper.com") {
			// https://cdn.wallpaper.com/main/styles/wp_medium_grid/s3/2018/02/astonmartindb11volantefrontsideview.jpg
			//   https://cdn.wallpaper.com/main/astonmartindb11volantefrontsideview.jpg
			// https://cdn.wallpaper.com/main/styles/wp_large/s3/2018/02/go_gardenofrussolo.jpg
			//   https://cdn.wallpaper.com/main/go_gardenofrussolo.jpg
			// https://cdn.wallpaper.com/main/styles/responsive_920w_scale/s3/baldacchino-by-stanton-williams-c-saverio-lombardi-vallauri_006_0.jpg
			//   https://cdn.wallpaper.com/main/baldacchino-by-stanton-williams-c-saverio-lombardi-vallauri_006_0.jpg
			// https://cdn.wallpaper.com/main/styles/wp_large/s3/l-kosmosbywonderglass_photoleonardoduggento02.jpg
			//   https://cdn.wallpaper.com/main/kosmosbywonderglass_photoleonardoduggento02.jpg
			// https://cdn.wallpaper.com/main/styles/wp_medium_grid/s3/2018/04/hermessalonedelmobile2018.jpg
			//   https://cdn.wallpaper.com/main/2018/04/hermessalonedelmobile2018.jpg
			//   https://cdn.wallpaper.com/main/hermessalonedelmobile2018.jpg -- doesn't work
			regex = /\/main\/styles\/[^/]*\/[^/]*\/(.*\/)?(?:l-)?([^/]*)/;
			return [src.replace(regex, "/main/$2"), src.replace(regex, "/main/$1$2")];
			//return src.replace(/\/styles\/[^/]*\/s[0-9]*\/[0-9]+\/[0-9]+\/([^/]*)$/, "/$1");
		}

		if (domain === "cdn.wallpaper.com") {
			// https://cdn.wallpaper.com/main/styles/responsive_920w_scale/s3/baldacchino-by-stanton-williams-c-saverio-lombardi-vallauri_006_0.jpg
			return src.replace(/\/main\/styles\/[^/]*\/[^/]*\//, "/");
		}

		if (domain === "static.warthunder.com") {
			// https://static.warthunder.com/upload/image/wallpapers/_thumbs/280x/magach_3_1920x1080_logo_com_73e9f4582d0d841a6abf1f2c75beaf4d.jpg
			//   https://static.warthunder.com/upload/image/wallpapers/magach_3_1920x1080_logo_com_73e9f4582d0d841a6abf1f2c75beaf4d.jpg
			return src.replace(/\/_thumbs\/[0-9]+x(?:[0-9]+)?\//, "/");
		}

		if (domain === "cdn.wallpaperdirect.com") {
			// https://cdn.wallpaperdirect.com/shared-assets/images/products/094269_163x163_thumb.jpg
			//   https://cdn.wallpaperdirect.com/shared-assets/images/products/094269orig.jpg
			return src.replace(/(\/[0-9]*)_[^/.]*(\.[^/.]*)$/, "$1orig$2");
		}

		if (domain_nosub === "bamcontent.com" ||
			// thanks to anonymous for reporting:
			// https://cms.nhl.bamgrid.com/images/photos/316907882/258x44/cut.jpg
			//   https://cms.nhl.bamgrid.com/images/photos/316907882/raw.jpg
			// other:
			// https://cms.nhl.bamgrid.com/images/assets/binary/301172494/binary-file/file.svg
			// https://cms.nhl.bamgrid.com/images/headshots/current/168x168/8476166.jpg
			domain_nosub === "bamgrid.com") {
			// https://nhl.bamcontent.com/images/photos/291203200/2568x1444/cut.jpg
			//   https://nhl.bamcontent.com/images/photos/291203200/raw.jpg
			return src.replace(/(\/images\/photos\/[0-9]*\/)[0-9]+x[0-9]+\/[^/.]*(\.[^/.]*)$/, "$1raw$2");
		}

		if (domain_nosub === "mail.ru" &&
			domain.match(/filed.*\.mail\.ru$/) &&
			src.match(/:\/\/[^/]*\/pic/)) {
			// https://filed17-26.my.mail.ru/pic?url=https%3A%2F%2Fcontent-17.foto.my.mail.ru%2Fmail%2Faudioknigi.online%2F_musicplaylistcover%2Fi-760.jpg&sigt=a2f820fc2604a1526688be9b380e7e24&ts=1519171200&mw=156&mh=156&croped=1
			//   https://content-17.foto.my.mail.ru/mail/audioknigi.online/_musicplaylistcover/i-760.jpg
			// https://filed17-26.my.mail.ru/pic?url=https%3A%2F%2Fcontent-25.foto.my.mail.ru%2Fdraw%2Fmusic%2Fplaylist%2F4649700154%2Ftracks%2Fcover%3F1505444126&mw=&mh=&sig=7f6083a07f204187e8d76ecde06923a9
			//   https://content-25.foto.my.mail.ru/draw/music/playlist/4649700154/tracks/cover?1505444126
			return decodeURIComponent(src.replace(/.*\/pic.*?[?&]url=([^&]*).*?$/, "$1"));
		}

		if (domain_nosub === "mail.ru" && /^content-[0-9]+\.foto\.my\./.test(domain)) {
			// https://my.mail.ru/community/mir/photo/_groupsphoto/49452.html
			// https://content-29.foto.my.mail.ru/community/mir/_groupsphoto/i-49452.jpg?1583157324
			//   https://content-29.foto.my.mail.ru/community/mir/_groupsphoto/b-49452.jpg
			return {
				url: src.replace(/(\/community\/+[^/]+\/+_groupsphoto\/+)i(-[0-9]+\.[^/.?#]+)(?:[?#].*)?$/, "$1b$2"),
				can_head: false // 400
			};
		}

		if (domain_nosub === "mail.ru" &&
			domain.match(/^avt.*\.foto\.mail\.ru/)) {
			// https://avt-30.foto.mail.ru/mail/philimonova56/_avatar180?
			//   https://avt-30.foto.mail.ru/mail/philimonova56/_avatar
			//   https://avt-30.foto.mail.ru/mail/philimonova56/_avatarbig
			return src.replace(/\/_avatar[0-9]*(?:[?#].*)?$/, "/_avatarbig");
		}

		if (domain === "games.mail.ru") {
			// https://games.mail.ru/pre_1000x1000_resize/pic/pc/article/2018/1/f3d5c09.jpeg
			//   https://games.mail.ru/pic/pc/article/2018/1/f3d5c09.jpeg
			// https://games.mail.ru/pre_xl_resize/pic/pc/gallery/b6/63/ae529711.jpeg
			//   https://games.mail.ru/pic/pc/gallery/b6/63/ae529711.jpeg
			// https://games.mail.ru/pre_700x393_resize/hotbox/content_files/article/2019/06/11/d2cf96b1bf514e9e8b9c641d76da8879.png
			//   https://games.mail.ru/hotbox/content_files/article/2019/06/11/d2cf96b1bf514e9e8b9c641d76da8879.png
			// https://games.mail.ru/pre_340x175_crop/hotbox/content_files/game/26989/picture/5e2d5.jpeg?quality=85
			//   https://games.mail.ru/hotbox/content_files/game/26989/picture/5e2d5.jpeg
			return src
				.replace(/\/pre_(?:[0-9]+x[0-9]+|[a-z]+)_(?:resize|crop)\/+(pic|hotbox)\/+/, "/$1/")
				.replace(/\?quality.*/, "");
		}

		if (domain === "my.mail.ru") {
			let query_mailru_videometa = function(vidid, cb) {
				let cache_key = "mailru_video:" + vidid;
				api_query(cache_key, {
					url: "https://my.mail.ru/+/video/meta/" + vidid,
					imu_mode: "xhr",
					headers: {
						Referer: "https://my.mail.ru/",
						Accept: "application/json, text/javascript, */*; q=0.01"
					},
					json: true
				}, cb, function(done, resp, cache_key) {
					done(resp, 60*60);
				})
			};

			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+(fb\/+[0-9]+\/+video\/+_myvideo\/+[0-9]+)\.html(?:[?#].*)?$/,
				query_for_id: "https://my.mail.ru/${id}.html",
				process: function(done, resp, cache_key) {
					let match = resp.responseText.match(/<script type="text\/plain" class="sp-video__page-config">\s*({.*})\s*<\/script>/);
					if (!match) {
						console_error(cache_key, "Unable to find video page config for", resp);
						return done(null, false);
					}

					let json = JSON_parse(match[1]);
					let vidid = json.itemId;
					if (!vidid) {
						console_error(cache_key, "Unable to find video id for", resp, json);
						return done(null, false);
					}

					query_mailru_videometa(vidid, function(meta) {
						if (!meta) {
							return done(null, false);
						}

						let baseobj = {
							extra: {
								caption: meta.meta.title,
								created_at: meta.meta.timestamp * 1000
							}
						};

						let urls:Array<BigImageInfoSObject> = [];

						// TODO: sort
						for (let video of meta.videos) {
							urls.push({
								url: urljoin(resp.finalUrl, meta.videos[0].url, true),
								headers: {
									Referer: resp.finalUrl
								},
								video: true,
								is_private: true
							});
						}

						urls.push(urljoin(resp.finalUrl, meta.meta.poster, true));

						return done(fillobj_urls(urls, baseobj), 60*60);
					})
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "mg.soupingguo.com") {
			// http://mg.soupingguo.com/attchment2/AppImg/110x73/2016/01/26/c2d275d9-ffc4-4ca3-86d0-70f717f789dc.jpg
			//   http://mg.soupingguo.com/attchment2/AppImg/0x0/2016/01/26/c2d275d9-ffc4-4ca3-86d0-70f717f789dc.jpg
			return src.replace(/(\/attchment[^/]*\/[^/]*Img\/)[0-9]+x[0-9]+\//, "$10x0/");
		}

		if (domain === "img.yaplog.jp") {
			// http://img.yaplog.jp/img/17/mo/y/a/m/yamu98/24/24094.jpg
			//   http://img.yaplog.jp/img/17/pc/y/a/m/yamu98/24/24094.jpg
			return src.replace(/(\/img\/[^/]*\/)mo\//, "$1pc/");
		}

		if (domain === "www.hochi.co.jp") {
			// http://www.hochi.co.jp/photo/20180220/20180220-OHT1I50164-L.jpg
			// L, T, N
			return src.replace(/-[A-Z](\.[^/.]*)$/, "-L$1");
		}

		if (domain_nosub === "wikispaces.com") {
			// https://sweetteaandscience.wikispaces.com/file/view/111.jpg/539497268/460x315/111.jpg
			//   https://sweetteaandscience.wikispaces.com/file/view/111.jpg
			return src.replace(/(\/view\/[^/]*\.[^/]*)\/.*?$/, "$1");
		}

		if (false && domain === "cdn.mdpr.jp") {
			// wip
			// https://cdn.mdpr.jp/photo/images/9b/c4b/244c1e_129677c70cb47761dc2243224aee09db43068c042b172144.jpg
			// aligned:
			//   https://cdn.mdpr.jp/photo/images/9b/c4b/244c1e_  129677c70cb47761dc2243224aee09db43068c042b172144.jpg
			//   https://cdn.mdpr.jp/photo/images/9b/c4b/w700c-ez_129677c70cb47761dc22432245d7f66fdae68c042b172144.jpg
			// https://mdpr.jp/photo/images/2016/02/21/e_1997280.jpg
			//   https://mdpr.jp/photo/images/2016/02/21/1997280.jpg
			// https://mdpr.jp/photo/detail/3179461
			//   https://cdn.mdpr.jp/photo/images/73/014/w700c-ez_923f6fd535f050dd50a0c1844e00845cfda81f02f814a731.jpg
			// https://mdpr.jp/news/detail/1319088
			//   https://mdpr.jp/photo/images/2014/01/17/600c-_1181978.jpg
			//   https://mdpr.jp/photo/images/2014/01/17/e_1181978.jpg
			//   https://cdn.mdpr.jp/photo/images/de/f96/w700c-ez_5f31b9207ce33a447ceff0069f5057adc853bf29a07018d6.jpg
			// https://cdn.mdpr.jp/photo/images/ff/357/w720c-e_86733135a9e323a66d900f9f12614d8db65c8521f7b16fdc.jpg
			// http://mdpr.jp/news/detail/1672412
			//   https://cdn.mdpr.jp/photo/images/cb/aba/0_3c3602ff62198c52f8e11a287cfbf2542e7a8470e1cfdbc2.jpg
			//  https://mdpr.jp/photo/detail/2714005
			//   https://cdn.mdpr.jp/photo/images/4d/9be/0_eb892aca2b6f152631f04dbe0b7ec6d67bad6240e6373cd5.jpg
			//   https://cdn.mdpr.jp/photo/images/4d/9be/0_eb892aca2b6f152631f04dbe05759594bb7ec6d6e6373cd5.jpg - broken
			//   https://cdn.mdpr.jp/photo/images/4d/9be/w700c-ez_eb892aca2b6f152631f04dbe05759594bb7ec6d6e6373cd5.jpg
			//   https://cdn.mdpr.jp/photo/images/4d/9be/eb892aca2b6f152631f04dbe0b7ec6d67bad6240e6373cd5.jpg
		}

		if (domain === "img-mdpr.freetls.fastly.net") {
			// https://img-mdpr.freetls.fastly.net/article/Wf7O/nm/Wf7Oi0E0-_n8CRBG4lyiHeFarklxrewLePLfp6cFSf0.jpg?width=250&enable=upscale&crop=250:250,offset-y0&auto=webp&quality=50
			//   https://img-mdpr.freetls.fastly.net/article/Wf7O/nm/Wf7Oi0E0-_n8CRBG4lyiHeFarklxrewLePLfp6cFSf0.jpg
			//   https://img-mdpr.freetls.fastly.net/article/Wf7O/nm/Wf7Oi0E0-_n8CRBG4lyiHeFarklxrewLePLfp6cFSf0.jpg?quality=100
			// thanks to billkewl on github: https://github.com/qsniyg/maxurl/issues/1290
			// https://img-mdpr.freetls.fastly.net/article/3PAL/nm/3PALRhB9GlTvhbGVrKYxgnU0GJMdFkmrnGGowdtaTok.jpg
			//   https://img-mdpr.freetls.fastly.net/article/3PAL/nm/3PALRhB9GlTvhbGVrKYxgnU0GJMdFkmrnGGowdtaTok.jpg?quality=100
			return src.replace(/(?:\?.*)?$/, "?quality=100");
		}

		if (domain_nowww === "sponichi.co.jp") {
			// http://www.sponichi.co.jp/entertainment/news/2017/12/12/jpeg/20171211s00041000381000p_thum.jpg
			//   http://www.sponichi.co.jp/entertainment/news/2017/12/12/jpeg/20171211s00041000381000p_view.jpg
			// https://www.sponichi.co.jp/entertainment/news/2018/04/01/jpeg/20180331s00041000612000p_thum.jpg
			//   https://www.sponichi.co.jp/entertainment/news/2018/04/01/jpeg/20180331s00041000612000p_view.jpg
			return {
				url: src.replace(/_thum(\.[^/.]*)$/, "_view$1"),
				can_head: false
			};
		}

		if (domain === "thumbnail.image.rakuten.co.jp") {
			// source:
			// https://books.rakuten.co.jp/rb/12499383/?scid=af_pc_etc&sc2id=af_111_1_10000673
			//
			// https://thumbnail.image.rakuten.co.jp/@0_mall/book/cabinet/3966/4907953093966.jpg?_ex=76x76
			//   https://tshop.r10s.jp/book/cabinet/3966/4907953093966.jpg?fitin=200:300&composite-to=*,*|200:300
			//   https://shop.r10s.jp/book/cabinet/3966/4907953093966.jpg
			return src.replace(/.*?:\/\/[^/]*\/@[^/]*\/([^?]*).*?$/, "http://shop.r10s.jp/$1");
		}

		if (domain === "tshop.r10s.com") {
			// https://tshop.r10s.com/4bf21390-ec8c-11e4-9162-005056b75bda/upload/np/A685-M1.jpg?_ex=330x330
			//   https://shop.r10s.com/4bf21390-ec8c-11e4-9162-005056b75bda/upload/np/A685-M1.jpg
			return src.replace(/:\/\/[^/]*\/(.*?)(?:[?#].*)?$/, "://shop.r10s.com/$1");
		}

		if (domain_nowww === "billboard-japan.com" ||
			// https://fotos.jornaldacidadeonline.com.br/uploads/fotos/650x0_1472919049_979715540.jpeg -- upscaled
			//   https://fotos.jornaldacidadeonline.com.br/uploads/fotos/1472919049_979715540.jpeg
			domain === "fotos.jornaldacidadeonline.com.br") {
			// http://www.billboard-japan.com/scale/news/00000057/57632/800x_image.jpg - upscaled
			//   http://www.billboard-japan.com/scale/news/00000057/57632/image.jpg
			// http://www.billboard-japan.com/scale/news/00000057/57981/170x170_image.jpg
			//   http://www.billboard-japan.com/scale/news/00000057/57981/image.jpg
			// http://www.billboard-japan.com/scale/news/00000044/44202/x200_sub_image99541.jpg
			//   http://www.billboard-japan.com/scale/news/00000044/44202/sub_image99541.jpg
			return src.replace(/\/(?:[0-9]+)?x(?:[0-9]+)?_([^/]*)$/, "/$1");
		}

		if (domain_nosub === "tsite.jp" &&
			string_indexof(domain, "top.tsite.jp") >= 0 &&
			string_indexof(src, "/contents_image/") >= 0) {
			// http://cdn.top.tsite.jp/static/top/sys/contents_image/038/778/192/38778192_0_sl.jpg
			//   http://cdn.top.tsite.jp/static/top/sys/contents_image/038/778/192/38778192_0.jpg
			// http://cdn.top.tsite.jp/static/top/sys/contents_image/034/410/417/34410417_0_rl.jpg
			//   http://cdn.top.tsite.jp/static/top/sys/contents_image/034/410/417/34410417_0.jpg
			// http://top.tsite.jp/static/top/sys/contents_image/038/780/255/38780255_133963.jpg
			// http://cdn.top.tsite.jp/static/top/sys/contents_image/media_image/035/136/128/35136128_0.jpeg
			//return src.replace(/_sl(\.[^/.]*)$/, "$1");
			return src.replace(/(\/[0-9]+)_[0-9]+(?:_[^/.]+)?(\.[^/.]*)$/, "$1_0$2");
		}

		if (domain === "www.sanspo.com") {
			// http://www.sanspo.com/geino/images/20171108/geo17110807000004-m1.jpg
			//   http://www.sanspo.com/geino/images/20171108/geo17110807000004-p1.jpg
			// http://www.sanspo.com/geino/images/20140818/oth14081805030011-s3.jpg
			//   http://www.sanspo.com/geino/images/20140818/oth14081805030011-p3.jpg
			// http://www.sanspo.com/geino/images/20140818/oth14081805030011-m1.jpg
			//   http://www.sanspo.com/geino/images/20140818/oth14081805030011-p1.jpg
			//
			// p, m, n, s
			// https://sankei2img.durasite.net/images//uploads/creative/image1/111885/20180221_bmw_150x150.jpg
			//   http://www.sankei.com/images/news/180221/lif1802210001-p1.jpg -- unrelated?
			newsrc = src.replace(/(\/images\/[0-9]*\/[^/]*-)[a-z]([0-9]+\.[^/.]*)$/, "$1p$2");
			// fallthrough to thumbor rule
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "www.sonymusicshop.jp") {
			// https://www.sonymusicshop.jp/img/1/item/SRC/L00/000/SRCL000009658_SHOP__576_320_102400_jpg.jpg?tf=gray
			//   https://www.sonymusicshop.jp/img/1/item/SRC/L00/000/SRCL000009658_SHOP__9999999999999999_9999999999999999_102400_jpg.jpg?tf=gray
			//   https://www.sonymusicshop.jp/img/1/item/SRC/L00/000/SRCL000009658_SHOP_jpg.jpg
			//return src.replace(/__[0-9]+_[0-9]+(_[0-9]+_[a-z]+\.[a-z]*)(?:\?.*)?$/, "__9999999999999999_9999999999999999$1");
			return src.replace(/__[0-9]+_[0-9]+_[0-9]+_([a-z]+\.[a-z]*)(?:\?.*)?$/, "_$1");
		}

		if (domain_nowww === "prtimes.jp") {
			// https://prtimes.jp/i/13546/1204/thumb/68x45/d13546-1204-280004-0.jpg
			//   https://prtimes.jp/i/13546/1204/original/d13546-1204-280004-0.jpg
			// https://prtimes.jp/api/file.php?c=13546&r=1204&t=thumb&d=68x45&f=d13546-1204-280004-0.jpg&e=rss
			//   https://prtimes.jp/i/13546/1204/original/d13546-1204-280004-0.jpg
			// https://prtimes.jp/i/13546/826/resize/d13546-826-654115-3.jpg
			//   https://prtimes.jp/i/13546/826/original/d13546-826-654115-3.jpg
			// https://prtimes.jp/i/19948/3/origin/d19948-3-285038-0.jpg -- 3072x4608
			//   https://prtimes.jp/i/19948/3/original/d19948-3-285038-0.jpg -- 3072x4608
			// https://prtimes.jp/img/664/1363/thumb/d664-1363-463559-0.jpg
			//   https://prtimes.jp/img/664/1363/original/d664-1363-463559-0.jpg
			if (/\/api\/+file\.php\?/.test(src)) {
				var queries = get_queries(src);
				return "https://prtimes.jp/i/" + queries.c + "/" + queries.r + "/original/" + queries.f;
			}

			return src
				.replace(/\/thumb\/+(?:[0-9]+x[0-9]+\/+)?(d[0-9]+-)/, "/original/$1")
				.replace(/\/resize\/+([^/]*)$/, "/original/$1");
		}

		if (domain_nosub === "vietbao.vn") {
			// http://vietbao.vn/The-gioi-giai-tri/Hot-girl-Le-Huyen-Anh-Mong-xuan-nay-co-nguoi-som-hoi-cuoi/2147799797/235/ - article
			// http://img.vietbao.vn/images/280/vn888/hot/v2014/cropping-1518416661-27540512-1833666450263816-461803420186171326-n.jpeg
			//   http://img.vietbao.vn/images/0/vn888/hot/v2014/cropping-1518416661-27540512-1833666450263816-461803420186171326-n.jpeg - larger, not full
			//      http://a9.vietbao.vn/images/vn888/hot/v2014/cropping-1518416661-27540512-1833666450263816-461803420186171326-n.jpeg - same
			//
			//   filename can be anything for img.vietbao.vn, but not for a9.vietbao.vn
			//   http://img.vietbao.vn/images/0/vn999/upload/hangct/27540512_1833666450263816_461803420186171326_n.jpg - full
			//      http://a9.vietbao.vn/images/vn999/upload/hangct/27540512_1833666450263816_461803420186171326_n.jpg - orig
			//
			// http://vietbao.vn/The-gioi-giai-tri/Thieu-gia-giau-nhat-Trung-Quoc-lao-dao-vi-tin-chong-lung-tang-sieu-xe-tien-ty-cho-Tara/55932319/235/ - article
			// http://a9.vietbao.vn/images/vn888/hot/v2014/cropping-1515483333-nhat-trung-quoc-lao-dao-vi-tin-chong-lung-tang-sieu-xe-tien-ty-cho-t-ara-1.jpeg
			//   http://a9.vietbao.vn/images/vn999/55/2018/01/20180109-ia-giau-nhat-trung-quoc-lao-dao-vi-tin-chong-lung-tang-sieu-xe-tien-ty-cho-t-ara-1.jpg
			return src
				//.replace(/\/images\/[0-9]+\//, "/images/0/")
				.replace(/:\/\/img\.vietbao\.vn\/images\/[0-9]+\//, "://a9.vietbao.vn/images/");
		}

		if (domain === "media.tinnong.net.vn") {
			// http://media.tinnong.net.vn/uploaded/Images/Thumb/2018/02/22/Toi_dau_don_roi_bo_anh_de_den_voi_mot_nguoi_khong_binh_thuong_vi_mot_chu_hieu2_2202144833.jpg
			//   http://media.tinnong.net.vn/uploaded/Images/Original/2018/02/22/Toi_dau_don_roi_bo_anh_de_den_voi_mot_nguoi_khong_binh_thuong_vi_mot_chu_hieu2_2202144833.jpg
			return src.replace(/\/Images\/[^/]*\//, "/Images/Original/");
		}

		if (domain === "images.kienthuc.net.vn" ||
			// https://images.khoeplus24h.vn/zoomh/500/uploaded/anhtuan/2016_09_27/3/taylor-switt-dep-the-nao-moi-lan-xuat-hien-ben-ban-trai.jpg
			//   https://images.khoeplus24h.vn/uploaded/anhtuan/2016_09_27/3/taylor-switt-dep-the-nao-moi-lan-xuat-hien-ben-ban-trai.jpg
			domain === "images.khoeplus24h.vn") {
			// http://images.kienthuc.net.vn/zoomh/500/uploaded/nguyenvan/2018_02_22/vang/vang-1_CUMV.jpg
			//   http://images.kienthuc.net.vn/uploaded/nguyenvan/2018_02_22/vang/vang-1_CUMV.jpg
			return src.replace(/\/zoom[a-z]\/[0-9]*\//, "/");
		}

		if (domain === "rez.cdn.kul.vn" ||
			// https://www.glamour.pl/media/cache/gallery_view/uploads/media/default/0003/13/8ad84df2c40d8f28bf21ef23b50967e212f697fc.jpeg
			//   https://www.glamour.pl/uploads/media/default/0003/13/8ad84df2c40d8f28bf21ef23b50967e212f697fc.jpeg
			domain_nowww === "glamour.pl" ||
			// https://al3arabi.com/media/cache/homepage_editors_pick_content/uploads/cms/standalone-content/thumbnail/5acb65aedaa4d.jpg
			//   https://al3arabi.com/uploads/cms/standalone-content/thumbnail/5acb65aedaa4d.jpg
			domain_nowww === "al3arabi.com" ||
			// http://www.starwars-holocron.net/media/cache/iloweb_news_front_blog/uploads/media/files/actualites/star-wars-rogue-one/emilia-clarke-1.jpg
			//   http://www.starwars-holocron.net/uploads/media/files/actualites/star-wars-rogue-one/emilia-clarke-1.jpg
			domain_nowww === "starwars-holocron.net" ||
			// https://www.elle.pl/media/cache/default_view/uploads/media/default/0001/88/elle-style-awards-2014_20.jpeg
			//   https://www.elle.pl/uploads/media/default/0001/88/elle-style-awards-2014_20.jpeg
			domain_nowww === "elle.pl" ||
			// https://www.gala.pl/media/cache/default_view/uploads/media/default/0003/51/8a53ff2963b8374d1aeefc68d73069421ab0edb1.jpeg
			//   https://www.gala.pl/uploads/media/default/0003/51/8a53ff2963b8374d1aeefc68d73069421ab0edb1.jpeg
			domain_nowww === "gala.pl" ||
			// https://i.moveek.com/media/cache/full_fixed/media/ee46a470620916e0524592d6859d54a467ad2fb6.jpg
			//   https://i.moveek.com/media/ee46a470620916e0524592d6859d54a467ad2fb6.jpg
			domain === "i.moveek.com" ||
			// https://mainstyles.ru/media/cache/default/rc/hSGOTMvi_maRMn6VB/uploads/material/Selena-Gomes-vypustila-tretiy-albom.jpg
			//   https://mainstyles.ru/uploads/material/Selena-Gomes-vypustila-tretiy-albom.jpg
			domain_nowww === "mainstyles.ru" ||
			// https://programme-tv.leparisien.fr/media/cache/program_item_210x286_up/uploads/svod/cf997756-ddd9-46de-abeb-9be9db71a20f.jpg
			//   https://programme-tv.leparisien.fr/uploads/svod/cf997756-ddd9-46de-abeb-9be9db71a20f.jpg
			domain === "programme-tv.leparisien.fr" ||
			// https://shukrabar.nagariknetwork.com/media/cache/nagarik_thumbnail_389_283/uploads/media/Camila%20Cabello.jpg
			//   https://shukrabar.nagariknetwork.com/uploads/media/Camila%20Cabello.jpg
			//domain === "shukrabar.nagariknetwork.com" ||
			// http://longtake.it/media/cache/medium_poster/uploads/du/dunkirk/poster-dunkirk.jpeg
			//   http://longtake.it/uploads/du/dunkirk/poster-dunkirk.jpeg
			domain_nowww === "longtake.it" ||
			src.match(/^[a-z]+:\/\/[^/]*\/+media\/+cache\/+[^/]*\/+uploads\/+media\//)) {
			// http://rez.cdn.kul.vn/media/cache/thumbnail_16x10_672x420/uploads/media/thumbnail/59db/29/thumbnail_16x9_t-ara4.jpg
			//   http://rez.cdn.kul.vn/uploads/media/kul/59db/28/kul_news_t-ara4.jpg
			return src
				.replace(/\/media\/+cache\/+.*\/+uploads\/+/, "/uploads/")
				.replace(/\/media\/+cache\/+[^/]*\//, "/");
		}

		if (domain_nowww === "themebeta.com") {
			// https://www.themebeta.com/media/cache/400x225/files/windows/images/201701/19/c712fcf69f2a15163f1e9cfbdc62b5f8.jpeg
			//   https://www.themebeta.com/files/windows/images/201701/19/c712fcf69f2a15163f1e9cfbdc62b5f8.jpeg
			return src.replace(/\/media\/+cache\/+[0-9]+x[0-9]+\/+files\//, "/files/");
		}

		if (domain === "static.kstyle.com") {
			// http://static.kstyle.com/stf/ad622b862613fa27895446d446bca918.jpg/r.580x0
			//   http://static.kstyle.com/stf/ad622b862613fa27895446d446bca918.jpg
			return src.replace(/\/r\.[0-9]+x[0-9]+$/, "");
		}

		if (amazon_container === "lifesite-cache" ||
			// http://www.golocalprov.com/cache/images/cached/cache/images/remote/http_s3.amazonaws.com/images.golocalprov.com/Emma_Watson_dress_360_533_90.jpg
			//   http://s3.amazonaws.com/images.golocalprov.com/Emma_Watson_dress.jpg
			domain_nowww === "golocalprov.com" ||
			// https://d1lfxha3ugu3d4.cloudfront.net/assets/system-images/made/assets/system-images/remote/https_d1lfxha3ugu3d4.cloudfront.net/exhibitions/images/2020_African_Arts_Global_Conversations_41.222_threequarter_right_PS11_1719w_729_800.jpg
			//   https://d1lfxha3ugu3d4.cloudfront.net/exhibitions/images/2020_African_Arts_Global_Conversations_41.222_threequarter_right_PS11_1719w.jpg
			// needs to be updated somehow for this url:
			// https://d1lfxha3ugu3d4.cloudfront.net/assets/system-images/made/assets/system-images/remote/https_d1lfxha3ugu3d4.cloudfront.net/assets/system-images/made/assets/system-images/remote/https_d1lfxha3ugu3d4.cloudfront.net/exhibitions/images/2020_African_Arts_Global_Conversations_41.222_threequarter_right_PS11_1719w_600_658_220_220_c1_c_t_0_0.jpg
			(domain === "d1lfxha3ugu3d4.cloudfront.net" && /\/assets\/+system-images\/+remote\/+http/.test(src)) ||
			// https://ee-harpers-bazaar.s3.amazonaws.com/made/remote/http_assets-prod.harpersbazaar.co.uk/people-and-parties/Best_Dressed/cannes-red-carpet/adrianalima_667_1000_90.jpg
			//   http://assets-prod.harpersbazaar.co.uk/people-and-parties/Best_Dressed/cannes-red-carpet/adrianalima.jpg
			amazon_container === "ee-harpers-bazaar" ||
			// https://assets.lifesitenews.com/images/made/images/remote/https_www.lifesitenews.com/images/local/Transhumanism_Thumbnail_copy_720_470_75_s_c1.jpg
			//   https://www.lifesitenews.com/images/local/Transhumanism_Thumbnail_copy.jpg
			domain === "assets.lifesitenews.com" ||
			// https://cdn2.thelineofbestfit.com/images/remote/https_cdn2.thelineofbestfit.com/galleries/2014/11_clean_bandit-bts_rdn1016_bc.jpg
			//   https://cdn2.thelineofbestfit.com/galleries/2014/11_clean_bandit-bts_rdn1016_bc.jpg
			(domain_nosub === "thelineofbestfit.com" && domain.match(/^cdn[0-9]*\.thelineofbestfit\.com/))) {
			// https://lifesite-cache.s3.amazonaws.com/images/made/images/remote/https_s3.amazonaws.com/lifesite/man_and_woman_arguing_with_signs_810_500_55_s_c1.jpg
			//   https://s3.amazonaws.com/lifesite/man_and_woman_arguing_with_signs.jpg
			// https://lifesite-cache.s3.amazonaws.com/images/made/images/remote/https_s3.amazonaws.com/lifesite/Billy_Graham__finger_pointing_720_470_55_s_c1.jpg
			//   https://s3.amazonaws.com/lifesite/Billy_Graham__finger_pointing.jpg
			// https://s3.amazonaws.com/lifesite-cache/images/made/images/remote/https_s3.amazonaws.com/lifesite/man_and_woman_arguing_with_signs_810_500_55_s_c1.jpg
			//   https://s3.amazonaws.com/lifesite/man_and_woman_arguing_with_signs.jpg
			return src
				.replace(/.*\/(?:(?:system-)?images|made)\/+remote\/+(https?)_(.*?)(?:(?:_[0-9]+)?_[0-9]+_[0-9]+(?:_[a-z]_[a-z][0-9])?)?(\.[^/.]*)$/, "$1://$2$3");
		}

		if (domain === "d1lfxha3ugu3d4.cloudfront.net") {
			// https://d1lfxha3ugu3d4.cloudfront.net/exhibitions/images/2020_African_Arts_Global_Conversations_41.222_threequarter_right_PS11_1719w.jpg
			//   https://d1lfxha3ugu3d4.cloudfront.net/exhibitions/images/2020_African_Arts_Global_Conversations_41.222_threequarter_right_PS11.jpg
			return src.replace(/(\/exhibitions\/+images\/+[^/]+)_[0-9]+w(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "mosaic.tnaflix.com" ||
			// https://img.empstatic.com/a16:8q80w300/thumbs/70/2695871-8l.jpg
			domain === "img.empstatic.com" ||
			// https://img.moviefap.com/a16:9w990r/thumbs/86/571632-1l.jpg
			//   https://img.moviefap.com/a16/thumbs/86/571632-1l.jpg -- unstretched
			// https://img.moviefap.com/a3:2q80w278r/thumbs/30/238814-1l.jpg
			domain === "img.moviefap.com") {
			// https://mosaic.tnaflix.com/1883746/a16:8q10w300/22.jpg
			//   https://mosaic.tnaflix.com/1883746/a16/22.jpg
			newsrc = src.replace(/(\/a[0-9]+):[0-9a-z]+(\/|\.[^/.]*)/, "$1$2");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nosub === "tnastatic.com" && domain.match(/^img[0-9]*\./)) {
			// http://img.tnastatic.com/q80w200r/pics/alpha/2687237821/510542978/332373910.jpg
			//   http://img.tnastatic.com/q100/pics/alpha/2687237821/510542978/332373910.jpg
			// https://img.tnastatic.com/a3:2q80w600r/thumbs/b5/31_1029639l.jpg -- stretched
			//   https://img.tnastatic.com/a3/thumbs/b5/31_1029639l.jpg
			newsrc = src.replace(/(:\/\/[^/]*\/)[^/]*\/(pics|thumbs)\//, "$1q100/$2/");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nowww === "tnaflix.com" ||
			domain_nowww === "empflix.com") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+[^/]+\/+[^/]+\/+video([0-9]+)(?:[?#].*)?$/,
				query_for_id(id) {
					return {
						url: "https://www." + domain_nosub + "/ajax/video-player/" + id,
						headers: {
							Accept: "*/*",
							Referer: "https://" + domain + "/"
						},
						imu_mode: "xhr",
						json: true
					}
				},
				process(done, resp, cache_key, match) {
					if (!resp.html) {
						console_error(cache_key, "Unable to find html from", resp);
						return done(null, false);
					}

					let fakeresp = {
						responseText: resp.html,
						finalUrl: "https://" + domain_nosub + "/a/a/video" + match[1]
					};

					var obj = common_functions["get_videotag_obj"](fakeresp);
					if (!obj)
						return done(null, false);

					return done(fillobj_urls(obj, {
						headers: {
							Referer: fakeresp.finalUrl
						}
					}), 60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nosub === "tnaflix.com" || domain_nosub === "tnastatic.com" ||
			domain_nosub === "empflix.com" || domain_nosub === "empstatic.com") {
			var is_pagelink = true;
			var is_vkey = false;

			match = src.match(/^[a-z]+:\/\/[^/]+\/+[^/]+\/+[^/]+\/+video([0-9]+)(?:[?#].*)?$/);
			if (!match) {
				match = src.match(/^[a-z]+:\/\/[^/]+\/+view_video\.php\?(?:.*&)?viewkey=([0-9a-f]+)/);
				if (match)
					is_vkey = true;
			}
			if (!match) {
				is_pagelink = false;
				match = src.match(/^[a-z]+:\/\/img[0-9]*\.[^/]+\/+[^/]+\/+thumbs\/+[0-9a-f]{2}\/+[0-9a-f]{1,2}_([0-9]+)l\./);
			}
			if (!match) {
				// https://img.empstatic.com/a16:8q80w300/thumbs/70/2695871-8l.jpg
				is_pagelink = false;
				match = src.match(/^[a-z]+:\/\/img[0-9]*\.[^/]+\/+[^/]+\/+thumbs\/+[0-9a-f]{2}\/+([0-9]+)-[0-9]+l\./);
			}
			if (!match) {
				is_pagelink = false;
				match = src.match(/^[a-z]+:\/\/img[0-9]*\.[^/]+\/+[^/]+\/+.*\/([0-9]+)\/+thumbs\/+[0-9]+\./);
			}
			if (!match) {
				is_pagelink = false;
				// https://mosaic.tnaflix.com/1883746/a16:8q10w300/22.jpg
				match = src.match(/^[a-z]+:\/\/mosaic\.[^/]+\/+([0-9]+)\/+a[0-9]+(?::[^/]+)?\/+/);
			}
			if (!match) {
				is_pagelink = false;
				match = src.match(/^[a-z]+:\/\/[^/]+\/+(?:[0-9]+\/+)+([0-9]+)\/+trailer\.mp4(?:[?#].*)?$/);
			}
			if (!match) {
				is_pagelink = false;
				match = src.match(/\/trailer\/+empflix\/+(?:[0-9a-f]\/+){3}([0-9a-f]+)\./);
				if (match)
					is_vkey = true;
			}

			var base_domain = domain_nosub.replace(/static\./, "flix.");
			var base_domain_noext = base_domain.replace(/\..*/, "");
			var vid_suffix = "";

			if (base_domain_noext === "empflix") {
				vid_suffix = "-1";
			}

			if (match) {
				id = match[1];

				page_nullobj = {
					url: src,
					is_pagelink: true
				};

				if (!is_pagelink)
					page_nullobj = null;

				var query_tnaflix_api = function(data, cb) {
					if (!data || !data.vkey || !data.nkey || !data.VID || !("thumb" in data) || !data.finalUrl) {
						console_error("Invalid parameters", data);
						return cb(null);
					}

					var url = "https://cdn-fck." + base_domain + "/" + base_domain_noext + "/" + data.vkey + vid_suffix + ".fid?key=" + data.nkey + "&VID=" + data.VID + "&startThumb=" + data.thumb + "&nomp4=1&catID=0&rollover=1&embed=0&utm_source=0&multiview=0&premium=1&country=0user=0&vip=1&cd=0&ref=0&alpha"
					api_query(base_domain + "_api:" + data.VID, {
						url: url,
						headers: {
							origin: "https://www." + base_domain,
							Referer: data.finalUrl
						}
					}, cb, function(done, resp, cache_key) {
						var urls = common_functions.parse_flixv2(resp, cache_key);
						if (!urls || urls.length === 0) {
							urls = [];
						}

						if (page_nullobj)
							urls.push(page_nullobj);

						if (!urls.length) {
							return done(null, false);
						} else {
							for (var i = 0; i < urls.length; i++) {
								urls[i].url = urljoin("https://www." + base_domain + "/", urls[i].url, true);
							}

							var baseobj = {
								headers: {
									Referer: "https://www." + base_domain + "/",
									"Sec-Fetch-Dest": "video"
								}
							};

							if (page_nullobj)
								urls.push(page_nullobj);

							return done(fillobj_urls(urls, baseobj), 60*60);
						}
					});
				};

				var process_tnaflix_site = function(done, resp, cache_key) {
					var regex = /<input id="(VID|vkey|nkey|thumb)" type="hidden" value="([^"]+)"/;
					var global_regex = new RegExp(regex as any as string, "g");

					var match = resp.responseText.match(global_regex);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					var values = {};

					for (var i = 0; i < match.length; i++) {
						var smatch = match[i].match(regex);

						var key = smatch[1];
						var value = smatch[2];

						values[key] = value;
					}

					values["finalUrl"] = resp.finalUrl;

					done(values, 60*60);
				};

				var query_tnaflix_site_by_vid = function(vid, cb) {
					api_query(base_domain + "_site_vid:" + vid, {
						url: "https://www." + base_domain + "/a/a/video" + vid
					}, cb, process_tnaflix_site);
				};

				var query_tnaflix_site_by_vkey = function(vkey, cb) {
					api_query(base_domain + "_site_vkey:" + vkey, {
						url: "https://www." + base_domain + "/view_video.php?viewkey=" + vkey
					}, cb, process_tnaflix_site);
				};

				if (!is_vkey) {
					return {
						url: "https://www." + base_domain + "/a/a/video" + id,
						is_pagelink: true
					};
				}

				if (options.do_request && options.cb) {
					var final = function(data) {
						query_tnaflix_api(data, options.cb);
					};

					if (!is_vkey) {
						query_tnaflix_site_by_vid(id, final);
					} else {
						query_tnaflix_site_by_vkey(id, final);
					}

					return {
						waiting: true
					};
				}
			}
		}

		if (domain_nowww === "imagefap.com") {
			var query_imagefap_photo = function(id, cb) {
				api_query("imagefap_photo:" + id, {
					url: "https://www.imagefap.com/photo/" + id + "/"
				}, cb, function(done, resp, cache_key) {
					var link_regex = /<a href="(https?:\/\/[a-z]+\.imagefap\.com\/+images\/+full[^"]+)"[^>]+?imageid="([0-9]+)"/;
					var links = resp.responseText.match(new RegExp(link_regex, "g"));

					if (!links) {
						console_error(cache_key, "Unable to find image links for", resp);
						return done(null, false)
					}

					var url = null;
					array_foreach(links, function(link) {
						var submatch = link.match(link_regex);
						var our_url = decode_entities(submatch[1]);
						var our_id = submatch[2];

						// == to compare int/string
						if (our_id != id) {
							api_cache.set("imagefap_photo:" + our_id, our_url, 60*60);
						} else {
							url = our_url;
						}
					});

					if (!url) {
						console_error("Unable to find", id, "in", links, resp);
						return done(null, false);
					}

					return done(url, 60*60);
				});
			};

			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+photo\/+([0-9]+)\/*(?:[?#].*)?$/,
				run: function(done, match) {
					var id = match[1];

					query_imagefap_photo(id, function(url) {
						if (!url) {
							return done(null, false);
						} else {
							return done({
								url: url,
								extra: {
									page: "https://www.imagefap.com/photo/" + id + "/"
								}
							}, 60*60);
						}
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "imagefap.com" ||
			// https://www.moviefap.com/videos/308d6807378358e7727c/firm-tits-teen-stacie-andrews-public-sex.html
			// or: https://www.imagefap.com/video.php?vid=238814?vid=238814
			domain_nowww === "moviefap.com") {
			var query_moviefap_flv = function(flvurl, cb) {
				api_query("moviefap_flv:" + flvurl, {
					url: flvurl,
					headers: {
						Origin: "https://www.imagefap.com",
						Referer: "https://cdn-fck.moviefap.com/",
						"Content-Type": "application/x-www-form-urlencoded"
					}
				}, cb, function(done, resp, cache_key) {
					var urls = common_functions.parse_flixv2(resp, cache_key);
					if (!urls || urls.length === 0) {
						urls = [];
					}

					if (page_nullobj)
						urls.push(page_nullobj);

					if (!urls.length) {
						return done(null, false);
					} else {
						var baseobj = {
							headers: {
								Referer: "https://www.imagefap.com/",
								"Sec-Fetch-Dest": "video"
							}
						};

						if (page_nullobj)
							urls.push(page_nullobj);

						return done(fillobj_urls(urls, baseobj), 60*60);
					}
				});
			};

			var get_flvurl = null;

			// https://www.imagefap.com/video.php?vid=571632
			match = src.match(/:\/\/[^/]*imagefap\.com\/+video\.php\?(?:.*?&)?vid=([0-9]+)/);
			if (match) {
				id = match[1];

				var query_imagefap_flvurl = function(vid, cb) {
					api_query("imagefap_flvurl:" + vid, {
						url: "https://www.imagefap.com/video.php?vid=" + vid
					}, cb, function(done, resp, cache_key) {
						var match = resp.responseText.match(/url: '(https?:\/\/cdn-fck\.moviefap.com\/+moviefap\/+[0-9a-f]{10,}\.flv\?(?:.*&)?VID=.*?)',/);
						if (!match) {
							console_error(cache_key, "Unable to find info flv URL for", resp);
							return done(null, false);
						}

						return done(match[1], 60*60);
					});
				};

				get_flvurl = function(cb) {
					query_imagefap_flvurl(id, cb);
				};
			} else {
				match = src.match(/:\/\/[^/]+\/+videos\/+([0-9a-f]{10,})\/+[^/]*\.html(?:[?#].*)?$/);
				if (match) {
					id = match[1];

					var query_moviefap_flvurl = function(vid, cb) {
						api_query("moviefap_flvurl:" + vid, {
							url: "https://www.moviefap.com/videos/" + vid + "/a.html"
						}, cb, function(done, resp, cache_key) {
							var match = resp.responseText.match(/<input type="hidden" id="config1" name="config1" value="(https?:\/\/cdn-fck\.moviefap.com\/+moviefap\/+[0-9a-f]{10,}\.flv\?(?:.*(?:&|%26))?VID=.*?)" \/>/);
							if (!match) {
								console_error(cache_key, "Unable to find info flv URL for", resp);
								return done(null, false);
							}

							return done(match[1], 60*60);
						});
					};

					get_flvurl = function(cb) {
						query_moviefap_flvurl(id, cb);
					};
				}
			}

			if (get_flvurl) {
				page_nullobj = {
					url: src,
					is_pagelink: true
				};

				if (options.do_request && options.cb) {
					get_flvurl(function(flvurl) {
						if (!flvurl) {
							return options.cb(page_nullobj);
						}

						query_moviefap_flv(flvurl, options.cb);
					});

					return {
						waiting: true
					};
				} else {
					return page_nullobj;
				}
			}
		}

		if (domain === "img.moviefap.com") {
			// https://img.moviefap.com/a3:2q80w160r/thumbs/86/571632-1l.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+[^/]+\/+thumbs\/+[0-9a-f]{2}\/+([0-9]+)-[0-9]+l\.[^/.]+/, "https://www.imagefap.com/video.php?vid=$1");
			if (newsrc !== src)
				return {
					url: newsrc,
					is_pagelink: true
				};
		}

		// doesn't work anymore
		if (false && (domain_nosub === "fap.to" ||
			// http://images.imagefap.com/images/thumb/62/114/1146416891.jpg
			//   http://images.imagefap.com/images/full/62/114/1146416891.jpg
			(domain_nosub === "imagefap.com" && /^(?:www|images)\./.test(domain)))) {
			// http://x3.fap.to/images/thumb/62/114/1146416891.jpg
			//   http://x3.fap.to/images/full/62/114/1146416891.jpg
			// http://x.fap.to/h175q90/images/full/57/401/401519803.jpg
			//   http://x.fap.to/images/full/57/401/401519803.jpg
			// http://x.fap.to/h60q90c35.444444x10.666667x57.555556x25.407407/images/full/57/401/401519803.jpg
			//   http://x.fap.to/images/full/57/401/401519803.jpg
			return src
				.replace(/:\/\/x[0-9]*\./, "://x.") // temporary error?
				.replace(/(:\/\/[^/]*\/)[a-z0-9.]+\/images\//, "$1images/")
				.replace(/\/images\/[a-z]*\//, "/images/full/");
		}

		if (false && domain === "cdn.imagefap.com") {
			// cdn.* contains a required signature (?end=...&secure=...), but images.* works
			// no longer working, however https://www.imagefap.com/photo/{id}/ contains the info needed
			return src.replace(/:\/\/cdn\.(.*?)(?:[?#].*)?$/, "://images.$1");
		}

		if (domain_nowww === "imagefap.com" ||
			(domain_nosub === "imagefap.com" && /^(?:cdn[ch]?|images)\./.test(domain)) ||
			domain_nosub === "fap.to") {
			match = src.match(/^[a-z]+:\/\/[^/]+\/+(?:[a-z][a-z0-9.]+\/+)?images\/+(?:mini|thumb)\/+[0-9]+\/+[0-9]+\/+([0-9]+)\./);
			if (match) {
				return {
					url: "https://www.imagefap.com/photo/" + match[1] + "/",
					is_pagelink: true
				};
			}
		}

		if (domain_nosub === "imagefapusercontent.com" && /^x[0-9]*\./.test(domain)) {
			// https://x.imagefapusercontent.com/u/GoddessKitty/8345235/1680001787/1.jpg
			match = src.match(/^[a-z]+:\/\/[^/]+\/+u\/+[^/]+\/+[0-9]+\/+([0-9]+)\/+[^/]+\./);
			if (match) {
				return {
					url: "https://www.imagefap.com/photo/" + match[1] + "/",
					is_pagelink: true
				};
			}
		}

		if (domain === "www.gannett-cdn.com" &&
			string_indexof(src, "/-ip-/") >= 0) {
			// https://www.gannett-cdn.com/-ip-/https://media.gannett-cdn.com/29906170001/29906170001_5720100432001_5720093419001-vs.jpg?pubId=29906170001&quality=10
			//   https://media.gannett-cdn.com/29906170001/29906170001_5720100432001_5720093419001-vs.jpg
			return src.replace(/.*?\/-ip-\//, "");
		}

		if (domain === "cdn.mainichi.jp") {
			// https://cdn.mainichi.jp/vol1/2018/02/19/20180219p2g00m0sp060000p/4.jpg
			//   https://cdn.mainichi.jp/vol1/2018/02/19/20180219p2g00m0sp060000p/9.jpg
			return src.replace(/\/[0-9]+(\.[^/.]*)$/, "/9$1");
		}

		if (domain === "img.evbuc.com" ||
			// https://cdn.mall.adeptmind.ai/https%3A%2F%2Fcdn.media.amplience.net%2Fi%2Fharryrosen%2F20096712053_large.webp
			domain === "cdn.mall.adeptmind.ai") {
			// forces download?
			// https://img.evbuc.com/https%3A%2F%2Fcdn.evbuc.com%2Fimages%2F37338904%2F45878487997%2F1%2Foriginal.jpg?w=1000&rect=0%2C236%2C1890%2C945&s=53555af848d3afd2d9a9b2cb603d9516
			return decodeURIComponent(src.replace(/.*:\/\/[^/]*\/([^?]*).*/, "$1"));
		}

		if (domain === "img.cdandlp.com") {
			// https://img.cdandlp.com/2017/08/imgL/118890893.jpg
			// https://img.cdandlp.com/2017/08/imgS/118890893.jpg
			// https://img.cdandlp.com/img_ssl/1274211304-73249-1.jpg
			// https://ring.cdandlp.com/sleazyx/photo_grande/115030078-3.jpg
			// https://content.cdandlp.com/superflyrecords/catalogue/40106.jpg
			// https://www.soundfinder.jp/img/products/102065/1507215600/59d727b5-151c-4c14-8768-62417697bade/1180602.jpg
			// https://img.cdandlp.com/2014/09/imgM/117153395.jpg
			return src.replace("/imgS/", "/imgL/").replace("/imgM/", "/imgL/");
		}

		if (domain === "walter.trakt.tv") {
			// https://walter.trakt.tv/images/movies/000/224/301/posters/thumb/687ddf47d8.jpg.webp
			//   https://walter.trakt.tv/images/movies/000/224/301/posters/thumb/687ddf47d8.jpg
			//   https://walter.trakt.tv/images/movies/000/224/301/posters/medium/687ddf47d8.jpg.webp
			//   https://walter.trakt.tv/images/movies/000/224/301/posters/medium/687ddf47d8.jpg
			//   https://walter.trakt.tv/images/movies/000/224/301/posters/full/687ddf47d8.jpg.webp
			//   https://walter.trakt.tv/images/movies/000/224/301/posters/full/687ddf47d8.jpg
			//   https://walter.trakt.tv/images/movies/000/224/301/posters/original/687ddf47d8.jpg
			// https://walter.trakt.tv/images/shows/000/082/248/fanarts/thumb/04342b5daf.jpg.webp
			//   https://walter.trakt.tv/images/shows/000/082/248/fanarts/thumb/04342b5daf.jpg
			//   https://walter.trakt.tv/images/shows/000/082/248/fanarts/medium/04342b5daf.jpg.webp
			//   https://walter.trakt.tv/images/shows/000/082/248/fanarts/medium/04342b5daf.jpg
			//   https://walter.trakt.tv/images/shows/000/082/248/fanarts/full/04342b5daf.jpg.webp
			//   https://walter.trakt.tv/images/shows/000/082/248/fanarts/full/04342b5daf.jpg
			//   https://walter.trakt.tv/images/shows/000/082/248/fanarts/original/04342b5daf.jpg
			// https://walter.trakt.tv/images/users/001/257/078/avatars/thumb/bfb7994232.jpg
			//   https://walter.trakt.tv/images/users/001/257/078/avatars/medium/bfb7994232.jpg
			//   https://walter.trakt.tv/images/users/001/257/078/avatars/large/bfb7994232.jpg
			//   https://walter.trakt.tv/images/users/001/257/078/avatars/original/bfb7994232.jpg
			// https://walter.trakt.tv/images/users/001/006/285/avatars/medium/ff4a3b514d.png -- 300x300, upscaled
			//   https://walter.trakt.tv/images/users/001/006/285/avatars/original/ff4a3b514d.png -- 200x199
			return src
				.replace(/\/(posters|fanarts|avatars)\/(?:thumb|medium|large|full)\/([^/]*?)(\.webp)?$/, "/$1/original/$2");
		}

		if (domain === "cdn.apk-cloud.com" ||
			// https://apk-dl.com/detail/screenshot/Xg3DPZyvIegjKqZll4OzWpK41znXorY76j3MDa759ZNFkCv72CRkHI9yUcPx_Q1V2g=h300.png
			//   https://apk-dl.com/detail/screenshot/Xg3DPZyvIegjKqZll4OzWpK41znXorY76j3MDa759ZNFkCv72CRkHI9yUcPx_Q1V2g=h0.png
			domain_nowww === "apk-dl.com") {
			// http://cdn.apk-cloud.com/detail/screenshot/sYpEJNqANEbHAkHjLbYOOdRyn3sIhEtHgF8qSEpKXE38UR0RpI4X7b2eQfTQIiiljCrL.png
			// http://cdn.apk-cloud.com/detail/screenshot/sYpEJNqANEbHAkHjLbYOOdRyn3sIhEtHgF8qSEpKXE38UR0RpI4X7b2eQfTQIiiljCrL=h400.png
			return src
				.replace(/(?:=[a-z][0-9]*)?(\.[^/.]*)$/, "=h0$1");
		}

		if (domain_nosub === "polyvoreimg.com") {
			// down?
			// https://ak2.polyvoreimg.com/cgi/img-thing/size/l/tid/3884489.jpg
			//   https://www.polyvore.com/cgi/img-thing?.out=jpg&size=l&tid=3884489
			// https://cfc.polyvoreimg.com/cgi/img-set/.sig/9ndQlKC89OQ6ut3OULMg/cid/230139023/id/tsrtpPy65xGAdEGMmAc2pA/size/c1024x1024.jpg
			//   https://cfc.polyvoreimg.com/cgi/img-set/cid/230139023/id/tsrtpPy65xGAdEGMmAc2pA/size/c1024x1024.jpg
			//   https://cfc.polyvoreimg.com/cgi/img-set/cid/230139023/size/c1024x1024.jpg
			//   https://www.polyvore.com/cgi/img-set?.out=jpg&.sig=9ndQlKC89OQ6ut3OULMg&cid=230139023&id=tsrtpPy65xGAdEGMmAc2pA&size=c1024x1024
			// http://ak2.polyvoreimg.com/cgi/img-set/cid/39051735/id/XHw8HlYH4RGZj34mPmiMmg/size/y.jpg
			// http://ak2.polyvoreimg.com/cgi/img-set/cid/39051735/size/y.jpg
			// y, x, e, l, g, m, s, t
			var cginame = src.replace(/.*\/cgi\/([^/]*)\/.*/, "$1");
			var paramsbase = src.replace(/.*\/cgi\/[^/]*/, "");
			var params = paramsbase.replace(/\/([^/]*)\/([^/]*)/g, "$1=$2&");
			params = params
				.replace(/(.*)\.([^/.&]*)&$/, ".out=$2&$1");
			return "https://www.polyvore.com/cgi/" + cginame + "?" + params;
		}

		if (domain === "www.polyvore.com" &&
			string_indexof(src, "/cgi/") >= 0) {
			// https://www.polyvore.com/cgi/img-thing?.out=jpg&size=l&tid=95293327
			//   https://www.polyvore.com/cgi/img-thing?.out=jpg&size=y&tid=95293327
			// https://www.polyvore.com/cgi/img-set?.out=jpg&.sig=9ndQlKC89OQ6ut3OULMg&cid=230139023&id=tsrtpPy65xGAdEGMmAc2pA&size=c1024x1024
			//   https://www.polyvore.com/cgi/img-set?.out=jpg&.sig=9ndQlKC89OQ6ut3OULMg&cid=230139023&id=tsrtpPy65xGAdEGMmAc2pA&size=c99999x99999
			return src
				.replace(/\/img-set(.*?)&size=[^&]*/, "/img-set$1&size=c99999x99999");
				//.replace(/\/img-thing(.*?)&size=[^&]*/, "/img-thing$1&size=y"); // doesn't work well
		}

		if (domain === "aliyun-cdn.hypebeast.cn" &&
			string_indexof(src, "/hypebeast.com/") >= 0) {
			// https://aliyun-cdn.hypebeast.cn/hypebeast.com/wp-content/blogs.dir/4/files/2018/01/louis-vuitton-2018-fall-winter-50.jpg?q=75&w=400
			return src.replace(/.*:\/\/[^/]*\//, "http://");
		}

		if (domain_nowww === "girlscene.nl" ||
			// https://www.beautyscene.nl/thumb/200x200/ckfinder/userfiles/images/Beautyscene/Artikelen/December%202015/021215/IMG_5074.jpg
			//   https://www.beautyscene.nl/ckfinder/userfiles/images/Beautyscene/Artikelen/December%202015/021215/IMG_5074.jpg
			domain_nowww === "beautyscene.nl" ||
			// https://www.trendalert.nl/thumb/200x200/ckfinder/userfiles/images/Fashionscene/Beelden%202016/April%202016/Cara%20Delevingne%20Fashionscene14.jpg
			//   https://www.trendalert.nl/ckfinder/userfiles/images/Fashionscene/Beelden%202016/April%202016/Cara%20Delevingne%20Fashionscene14.jpg
			domain_nowww === "trendalert.nl") {
			// https://www.girlscene.nl/thumb/782x0/ckfinder/userfiles/images/Beauty/2015/mei/Braun%20Silk-epil%209%20-%20Jessica%20Alba.jpg -- stretched
			//   https://www.girlscene.nl/ckfinder/userfiles/images/Beauty/2015/mei/Braun%20Silk-epil%209%20-%20Jessica%20Alba.jpg
			return src.replace(/\/thumb\/+[0-9]+x[0-9]+\/+ckfinder\/+/, "/ckfinder/");
		}

		if (domain_nowww === "hdfullfilmizle.com" ||
			// http://www.hdfilmcix.net/thumb/183x284/uploads/film/2019/09/kum-adam-fragman-izle-597.jpg
			//   http://www.hdfilmcix.net/uploads/film/2019/09/kum-adam-fragman-izle-597.jpg
			domain_nowww === "hdfilmcix.net" ||
			// https://www.fullhdfilmizletio.com/thumb/183x284/uploads/film/2020/04/ajanlar-is-basinda-spies-in-disguise-izle-508.jpg
			//   https://www.fullhdfilmizletio.com/uploads/film/2020/04/ajanlar-is-basinda-spies-in-disguise-izle-508.jpg
			domain_nowww === "fullhdfilmizletio.com" ||
			// https://sinefun.com/thumb/183x284/uploads/film/2017/02/jolly-llb-turkce-dublaj-izle-161.jpg
			//   https://sinefun.com/uploads/film/2017/02/jolly-llb-turkce-dublaj-izle-161.jpg
			domain_nowww === "sinefun.com" ||
			// https://www.1080hdfilmizle.com/thumb/183x284/uploads/film/2019/09/madness-in-the-method-izle-304.jpg
			//   https://www.1080hdfilmizle.com/uploads/film/2019/09/madness-in-the-method-izle-304.jpg
			domain_nowww === "1080hdfilmizle.com" ||
			// https://www.sinemagecesi.com/thumb/183x284/uploads/film/2017/03/logan-118.jpg
			//   https://www.sinemagecesi.com/uploads/film/2017/03/logan-118.jpg
			domain_nowww === "sinemagecesi.com" ||
			// http://www.fullfilmburada.com/thumb/183x284/uploads/film/2017/03/hizli-ve-ofkeli-the-fast-and-the-furious-720p-2001-turkce-dublaj-full-hd-izle-745.jpg
			//   http://www.fullfilmburada.com/uploads/film/2017/03/hizli-ve-ofkeli-the-fast-and-the-furious-720p-2001-turkce-dublaj-full-hd-izle-745.jpg
			domain_nowww === "fullfilmburada.com" ||
			// https://www.evrenselfilmizle.net/thumb/183x284/uploads/film/2016/10/homeland-2sezon-turkce-dublaj-720p-hd-izle-865.jpg
			//   https://www.evrenselfilmizle.net/uploads/film/2016/10/homeland-2sezon-turkce-dublaj-720p-hd-izle-865.jpg -- smaller
			// https://www.evrenselfilmizle.net/thumb/170x225/uploads/oyuncu/2017/07simone-kessell-ana.jpg
			//   https://www.evrenselfilmizle.net/uploads/oyuncu/2017/07simone-kessell-ana.jpg
			domain_nowww === "evrenselfilmizle.net" ||
			// http://www.vizyonfilmlerizle.com/thumb/183x284/uploads/film/2017/03/caki-gibi-turkce-dublaj-full-izle-436.jpg
			//   http://www.vizyonfilmlerizle.com/uploads/film/2017/03/caki-gibi-turkce-dublaj-full-izle-436.jpg
			domain_nowww === "vizyonfilmlerizle.com" ||
			// https://www.sinemangoo.org/thumb/183x284/uploads/film/2017/01/arrival-gelis-turkce-altyazili-izle-255.jpg
			//   https://www.sinemangoo.org/uploads/film/2017/01/arrival-gelis-turkce-altyazili-izle-255.jpg
			domain_nowww === "sinemangoo.org" ||
			/^[a-z]+:\/\/[^/]+\/+thumb\/+[0-9]+x[0-9]+\/+uploads\/+(?:film|oyuncu)\/+[0-9]{4}\/+(?:[0-9]{2}\/+[^/]+-[0-9]{3}|[0-9]{2}[^/]+)\.[^/.]+(?:[?#].*)?$/.test(src)) {
			// http://www.hdfullfilmizle.com/thumb/131x150/uploads/oyuncu/2018/04/milla-jovovich-744.jpg
			//   http://www.hdfullfilmizle.com/uploads/oyuncu/2018/04/milla-jovovich-744.jpg
			return src.replace(/\/thumb\/+[0-9]+x[0-9]+\/+uploads\//, "/uploads/");
		}

		if (domain_nowww === "hairstyleinsider.com" ||
			// https://sites.eveyo.com/thumbnail.php?file=images/Lady_Amelia_279174293.jpg&size=article_large
			//   https://sites.eveyo.com/files.php?file=images/Lady_Amelia_279174293.jpg
			//   https://sites.eveyo.com/files/images/Lady_Amelia_279174293.jpg
			domain === "sites.eveyo.com" ||
			// http://24sata.info/files.php?file=news/2016/Mart_2016/lopez_haljina_1_199914503.jpg
			//   http://24sata.info/files/news/2016/Mart_2016/lopez_haljina_1_199914503.jpg
			domain_nowww === "24sata.info" ||
			// http://www.alankabout.com/thumbnail.php?file=photo_galleries/celebrities/western_celebrities/milla_jovovich/Milla-Jovovich-37.JPG&size=article_medium
			//   http://www.alankabout.com/files/photo_galleries/celebrities/western_celebrities/milla_jovovich/Milla-Jovovich-37.JPG
			domain_nowww === "alankabout.com" ||
			// https://www.cosmopolitan.rs/files.php?file=2017/11/ovo_nije_bio_crveni_tepih_na_kakav_smo_navikli_747279824.jpg
			//   https://www.cosmopolitan.rs/files/2017/11/ovo_nije_bio_crveni_tepih_na_kakav_smo_navikli_747279824.jpg
			domain_nowww === "cosmopolitan.rs" ||
			domain_nowww === "elle.rs") {
			// https://www.hairstyleinsider.com/thumbnail.php?file=2015/Emma_Watson_Bobby_Pinned_Updo_629726963.jpg&size=article_large
			//   https://www.hairstyleinsider.com/files/2015/Emma_Watson_Bobby_Pinned_Updo_629726963.jpg
			//   https://www.hairstyleinsider.com/files.php?file=2015/Emma_Watson_Bobby_Pinned_Updo_629726963.jpg
			// http://www.elle.rs/files.php?file=images/2018/01/kate_i_naomi_na_reviji_1_169904615.jpg
			// http://www.elle.rs/thumbnail.php?file=images/2018/02/gucci_moschino_fall_winter_2018_abs___983890735.jpg&size=summary_large
			//   http://www.elle.rs/files.php?file=images/2018/02/gucci_moschino_fall_winter_2018_abs___983890735.jpg
			//   https://www.elle.rs/files/images/2018/02/gucci_moschino_fall_winter_2018_abs___983890735.jpg
			//return src.replace(/\/thumbnail.php.*?file=([^&]*).*/, "/files.php?file=$1");
			return src.replace(/\/(?:thumbnail|files).php.*?file=([^&]*).*/, "/files/$1");
		}

		if (domain_nowww === "zkpm.net" ||
			// https://www.zyzpes.com/img.php?url=http://inews.gtimg.com/newsapp_match/0/4982172462/0
			//   http://inews.gtimg.com/newsapp_match/0/4982172462/0
			domain_nowww === "zyzpes.com" ||
			// https://yoptel.ru/vk/img.php?url=https://pp.userapi.com/c849320/v849320861/dda30/ooRORXzkxuU.jpg
			//   https://pp.userapi.com/c849320/v849320861/dda30/ooRORXzkxuU.jpg
			domain_nowww === "yoptel.ru" ||
			// http://img.viyuedu.com/img.php?url=http://mmbiz.qpic.cn/mmbiz/HiaNy8LPboMzo9U0Dg38XibJQia6sicM2D26icquxZic0eRPVRNLGDSMYu2tgnZ6RjqOaZEJ3608def8gpZEicX2WAM2Q/0?wx_fmt=jpeg
			//   http://mmbiz.qpic.cn/mmbiz/HiaNy8LPboMzo9U0Dg38XibJQia6sicM2D26icquxZic0eRPVRNLGDSMYu2tgnZ6RjqOaZEJ3608def8gpZEicX2WAM2Q/0?wx_fmt=jpeg
			domain === "img.viyuedu.com") {
			// http://www.zkpm.net/img.php?url=http://mmbiz.qpic.cn/mmbiz_jpg/Hey2N7g1r13EPyvv9cxxvy7uYsT9NZuAkbahJGeFoQGO9r0Wwicu7Oh2YiceaMgfObxznBkn4hx61JzCYnwWwMNA/0?wx_fmt=jpeg
			//   http://mmbiz.qpic.cn/mmbiz_jpg/Hey2N7g1r13EPyvv9cxxvy7uYsT9NZuAkbahJGeFoQGO9r0Wwicu7Oh2YiceaMgfObxznBkn4hx61JzCYnwWwMNA/0
			return src.replace(/.*\/img\.php.*?url=(.*)/, "$1");
		}

		if (domain_nowww === "aidu360.com") {
			// https://www.aidu360.com/img.php?u=http://inews.gtimg.com/newsapp_match/0/4587106415/0
			//   http://inews.gtimg.com/newsapp_match/0/4587106415/0
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+img\.php\?(?:.*?&)?u=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "img.xiaohuazu.com") {
			// http://img.xiaohuazu.com/?tag=a&url=mmbizz-zqpicz-zcn/mmbiz_jpg/bm1gUegOAnjmwzCcibTuzlH2uqYZnAgPqZHUjew7icxAIAGIkfUdxFaBMuGs5wVEiboyXw4dS94DHATt6ibPhgCK1Q/0?wx_fmt=jpeg
			//   http://mmbiz.qpic.cn/mmbiz_jpg/bm1gUegOAnjmwzCcibTuzlH2uqYZnAgPqZHUjew7icxAIAGIkfUdxFaBMuGs5wVEiboyXw4dS94DHATt6ibPhgCK1Q/0?wx_fmt=jpeg
			return src.replace(/.*?[?&]url=(.*)/, "$1").replace(/z-z/g, ".").replace(/^/, "http://");
		}

		if (domain_nowww === "viewsofia.com") {
			// https://www.viewsofia.com/upload/fck_editor_thumb/fck_editor/Image/LV18/_VUI0653.jpg
			//   https://www.viewsofia.com/upload/fck_editor/fck_editor/Image/LV18/_VUI0653.jpg
			return src.replace("/fck_editor_thumb/", "/fck_editor/");
		}

		if (domain_nosub === "condenast.ru" && string_indexof(domain, ".static.media.condenast.ru") >= 0) {
			// https://d6.static.media.condenast.ru/vogue/collection/49d7fa92bdcb9696c7ebac700ca6983e.jpg/0ce73d99/o/t214x320
			//   https://d6.static.media.condenast.ru/vogue/collection/49d7fa92bdcb9696c7ebac700ca6983e.jpg/0ce73d99/o/w99999999
			// http://static.glamour.ru/iblock/d4c/71048307.jpg
			return src.replace(/\/[a-z][0-9]*(?:x[0-9]+)?$/, "/w99999999");
		}

		if (domain_nowww === "vogue.co.jp") {
			// https://www.vogue.co.jp/uploads/media/2017/01/25/ALEXANDRE_VAUTHIER_2017SS_Haute_Couture_Collection_runway_gallery-26-171-256.jpg
			//   https://www.vogue.co.jp/uploads/media/2017/01/25/ALEXANDRE_VAUTHIER_2017SS_Haute_Couture_Collection_runway_gallery-26.jpg
			return src.replace(/(\/uploads\/+media\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[^/]+)-[0-9]+-[0-9]+(\.[^/.]*)$/, "$1$2");
		}

		if (domain_nosub === "vogue.mx" ||
			// https://cdn.glamour.mx/uploads/images/thumbs/mx/glam/2/s/2018/20/looks_de_billboard_awards_2018_3250_413x620.jpg
			//   https://cdn.glamour.mx/uploads/images/mx/glam/s/2018/20/looks_de_billboard_awards_2018_3250.jpg
			domain_nosub === "glamour.mx" ||
			// https://cdn.glamour.es/uploads/images/thumbs/es/glam/4/s/2017/35/gigi_hadid_bella_desfile_victorias_secret_china_2017_6551_2505x.jpg
			//   https://cdn.glamour.es/uploads/images/es/glam/s/2017/35/gigi_hadid_bella_desfile_victorias_secret_china_2017_6551.jpg
			// https://cdn2.glamour.es/uploads/images/thumbs/es/glam/4/s/2017/20/selena_gomez_met_5352_1200x630.jpg
			//   https://cdn2.glamour.es/uploads/images/es/glam/s/2017/20/selena_gomez_met_5352.jpg
			// http://cdn.glamour.es/uploads/images/thumbs/201419/gala_met_2014_todos_los_vestidos_de_la_alfombra_roja_343183988_667x1000.jpg
			//   http://cdn.glamour.es/uploads/images/201419/gala_met_2014_todos_los_vestidos_de_la_alfombra_roja_343183988.jpg
			// http://cdn.glamour.es/uploads/images/thumbs/201546/el_desfile_de_victorias_secret_la_alfombra_rosa_244031781_335x.jpg
			//   http://cdn.glamour.es/uploads/images/201546/el_desfile_de_victorias_secret_la_alfombra_rosa_244031781.jpg
			domain_nosub === "glamour.es" ||
			// https://cdn.gq.com.mx/uploads/images/thumbs/201543/anna_sizykh__272304971_2954x1969.jpg
			//   https://cdn.gq.com.mx/uploads/images/201543/anna_sizykh__272304971.jpg
			// https://cdn.gq.com.mx/uploads/images/thumbs/mx/gq/2/s/2016/03/la_belleza_de_margot_robbie_956194671_977x1454.jpg
			//   https://cdn.gq.com.mx/uploads/images/mx/gq/2/s/2016/03/la_belleza_de_margot_robbie_956194671.jpg -- doesn't work
			//   https://cdn.gq.com.mx/uploads/images/mx/gq/s/2016/03/la_belleza_de_margot_robbie_956194671.jpg -- works
			domain === "cdn.gq.com.mx" ||
			// http://cdn.revistavanityfair.es/uploads/images/thumbs/201519/todos_los_looks_fabulosamente_indescriptibles_de_rihanna_38784214_93x125.jpg
			//   http://cdn.revistavanityfair.es/uploads/images/201519/todos_los_looks_fabulosamente_indescriptibles_de_rihanna_38784214.jpg
			// https://cdn.revistavanityfair.es/uploads/images/thumbs/es/vf/2/s/2018/07/karen_gillan_1730_1199x1800.jpg
			//   http://cdn.revistavanityfair.es/uploads/images/es/vf/s/2018/07/karen_gillan_1730.jpg
			domain === "cdn.revistavanityfair.es" ||
			// http://cdn.vogue.es/uploads/images/thumbs/201541/top_looks_las_mejor_vestidas_de_la_semana_del_2_al_9_de_octubre_de_2015_758656006_800x.jpg
			//   http://cdn.vogue.es/uploads/images/201541/top_looks_las_mejor_vestidas_de_la_semana_del_2_al_9_de_octubre_de_2015_758656006.jpg
			// https://cdn2.vogue.es/uploads/images/thumbs/201541/top_looks_las_mejor_vestidas_de_la_semana_del_2_al_9_de_octubre_de_2015_758656006_800x.jpg
			//   https://cdn2.vogue.es/uploads/images/201541/top_looks_las_mejor_vestidas_de_la_semana_del_2_al_9_de_octubre_de_2015_758656006.jpg
			domain_nosub === "vogue.es") {
			// http://cdn.vogue.mx/uploads/images/thumbs/mx/vog/2/c/2017/04/alexandre_vauthier_pasarela_387309230_377x566.jpg
			//   http://cdn.vogue.mx/uploads/images/thumbs/mx/vog/2/c/2017/04/alexandre_vauthier_pasarela_387309230_1200x1800.jpg
			//   http://cdn.vogue.mx/uploads/images/mx/vog/c/2017/04/alexandre_vauthier_pasarela_170811342.jpg
			// http://cdn.vogue.mx/uploads/images/thumbs/mx/vog/2/c/2017/04/alexandre_vauthier_pasarela_170811342_185x278.jpg
			//   http://cdn.vogue.mx/uploads/images/mx/vog/c/2017/04/alexandre_vauthier_pasarela_170811342.jpg
			// http://cdn.vogue.mx/uploads/images/mx/vog/s/2016/10/familia_real_britanica_780685680.jpg
			newsrc = src
				.replace(/\/uploads\/+images\/+thumbs(?:(\/+(?:mx|es)\/+(?:vog|glam|gq|vf)\/+)[0-9]*\/+([a-z]))?(\/+(?:[0-9]{4}\/+[0-9]+|[0-9]{4,})\/+[^/]*)_[0-9]+x(?:[0-9]+)?(\.[^/.]*)(?:[?#].*)?$/, "/uploads/images$1$2$3$4");
			if (newsrc !== src)
				return newsrc;
			//return src.replace(/\/thumbs\/([0-9]+\/[^/.]*)_[0-9]+x[0-9]+(\.[^/.]*)$/, "/$1$2");
			//return src.replace(/(\/uploads\/images)\/thumbs(?:(\/[a-z]+\/(?:vf|gq))\/[0-9]+)?(\/.*)_[0-9]+x(?:[0-9]+)?(\.[^/.]*)$/, "$1$2$3$4");
		}

		if (domain_nosub === "ykt.ru" ||
			domain_nosub === "ykt2.ru") {
			// http://cs-msk-fd-4.ykt2.ru/media/upload/photo/2015/11/16/thumb/561772143a52dw350h530cr.jpeg
			// http://www.news.ykt.ru/upload/image/2017/04/55619/thumb/58ec2ea7219bd.jpg
			newsrc = src.replace(/\/thumb\/([^/]*)$/, "/$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "i.guim.co.uk") {
			// https://static.guim.co.uk/sys-images/Guardian/Pix/pictures/2014/6/2/1401727592551/Jeremy-Paxman--014.jpg
			// https://static.guim.co.uk/sys-images/Observer/Pix/pictures/2012/4/4/1333534694618/Lily-Collins-003.jpg
			// https://i.guim.co.uk/img/media/25e99cf42defaf460da04eb3fa08fac1f10aac55/0_138_3500_2100/master/3500.jpg?w=600&q=20&auto=format&usm=12&fit=max&dpr=2&s=5366bc1d02c96c9062f7c1c19318626f
			//   https://media.guim.co.uk/25e99cf42defaf460da04eb3fa08fac1f10aac55/0_138_3500_2100/master/3500.jpg
			// https://i.guim.co.uk/img/static/sys-images/Guardian/Pix/pictures/2015/2/18/1424261816248/34329776-7c4a-488a-a767-57ee9477cad3-2060x1236.jpeg
			//   https://static.guim.co.uk/sys-images/Guardian/Pix/pictures/2015/2/18/1424261816248/34329776-7c4a-488a-a767-57ee9477cad3-2060x1236.jpeg
			return src.replace(/:\/\/[^/]*\/img\/([^/]*)\/([^?]*).*?$/, "://$1.guim.co.uk/$2");
		}

		if (domain === "media.guim.co.uk") {
			// https://media.guim.co.uk/25e99cf42defaf460da04eb3fa08fac1f10aac55/0_138_3500_2100/master/3500.jpg
			//   https://media.guim.co.uk/25e99cf42defaf460da04eb3fa08fac1f10aac55/0_138_3500_2100/3500.jpg
			// https://media.guim.co.uk/5cef1f5322cece5683b42385ce834bdb45b153a3/0_0_1994_2993/666.jpg -- 666x1000
			//   https://media.guim.co.uk/5cef1f5322cece5683b42385ce834bdb45b153a3/0_0_1994_2993/1994.jpg -- 1994x2993
			return src
				.replace(/\/((?:[0-9]*_){3}[0-9]*)\/[^/]*\/([0-9]*\.[^/.]*)$/, "/$1/$2")
				.replace(/(\/[0-9]+_[0-9]+_([0-9]+)_[0-9]+\/)[0-9]+(\.[^/.]*)$/, "$1$2$3");
		}

		if (domain_nowww === "g2d.co.in") {
			// https://www.g2d.co.in/img/Photo/385/sml_amy-jackson-latest-hot-and-bold-pics-0-amy-jackson-18-08-04-02-08-42.jpeg
			//   https://www.g2d.co.in/img/Photo/385/amy-jackson-latest-hot-and-bold-pics-0-amy-jackson-18-08-04-02-08-42.jpeg
			return src.replace(/(\/img\/+Photo\/+[0-9]+\/+)(?:sml|med)_([^/]*\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain === "vogue.gjstatic.nl" ||
			// https://glamour.gjstatic.nl/thumbnails/GenjGalleryBundle/Item/fileUpload/detail/02/00/69/candice-swanepoel-7-20069.jpg -- doesn't work
			domain === "glamour.gjstatic.nl") {
			// https://vogue.gjstatic.nl/thumbnails/GenjArticleBundle/Article/fileUpload/medium/00/58/12/dit-heeft-gigi-hadid-te-zeggen-tegen-al-haar-body-shamers-5812.jpg
			//   https://vogue.gjstatic.nl/thumbnails/GenjArticleBundle/Article/fileUpload/big/00/58/12/dit-heeft-gigi-hadid-te-zeggen-tegen-al-haar-body-shamers-5812.jpg
			// https://vogue.gjstatic.nl/thumbnails/GenjArticleBundle/Article/fileUpload/detail/01/06/15/glitter-sparkle-shine-alexa-chung-staat-op-de-cover-van-vogue-december-2017-10615.jpg -- 1000x1295
			//   https://vogue.gjstatic.nl/thumbnails/GenjArticleBundle/Article/fileUpload/big/01/06/15/glitter-sparkle-shine-alexa-chung-staat-op-de-cover-van-vogue-december-2017-10615.jpg -- 1600x2072
			// https://vogue.gjstatic.nl/uploads/media/image/dolce-gabbana-make-capri-a-paparazzi-free-zone_9.jpg
			// https://vogue.gjstatic.nl/uploads/media/image/singer-songwriter-angela-vertelt-de-californie-hea-1.jpg
			// https://vogue.gjstatic.nl/thumbnails/GenjArticleBundle/Article/teaserFileUpload/teaser/00/84/17/tommy-x-gigi-has-landed-dit-zijn-vogue-s-favorieten-uit-de-ultieme-cali-girl-collectie-8417.jpg
			//   https://vogue.gjstatic.nl/thumbnails/GenjArticleBundle/Article/fileUpload/detail/00/84/17/tommy-x-gigi-has-landed-dit-zijn-vogue-s-favorieten-uit-de-ultieme-cali-girl-collectie-8417.jpg
			// https://vogue.gjstatic.nl/thumbnails/GenjArticleBundle/Article/fileUpload/detail/00/89/30/gigi-hadid-verlengt-samenwerking-met-tommy-hilfiger-8930.jpg
			//   https://vogue.gjstatic.nl/thumbnails/GenjArticleBundle/Article/fileUpload/big/00/89/30/gigi-hadid-verlengt-samenwerking-met-tommy-hilfiger-8930.jpg
			// https://designer-vintage.gjstatic.nl/thumbnails/GenjArticleBundle/Article/fileUpload/detail/00/13/27/the-exclusive-designer-vintage-summer-sale-1327.jpg -- 1000x1249
			//   https://designer-vintage.gjstatic.nl/uploads/media/image/the-exclusive-designer-vintage-summer-sale.jpg -- 4048x5059
			// https://designer-vintage.gjstatic.nl/thumbnails/GenjArticleBundle/Article/fileUpload/detail/00/19/42/the-top-5-best-snow-white-winter-bags-1942.jpg
			//   https://designer-vintage.gjstatic.nl/uploads/medi/image/the-top-5-best-snow-white-winter-bags.jpg -- doesn't work, error 500
			return src
				.replace(/\/teaserFileUpload\//, "/fileUpload/") // doesn't work on all
				.replace(/\/fileUpload\/[^/]*\//, "/fileUpload/big/");
		}

		if (domain_nosub === "favim.com" && domain.match(/^s[0-9]*\./)) {
			// https://s10.favim.com/mini/171202/book-Favim.com-5265965.jpeg
			//   https://s10.favim.com/orig/171202/book-Favim.com-5265965.jpeg
			// https://s8.favim.com/mini/151114/girls-generation-icons-snsd-taeyeon-Favim.com-3566828.png
			//   https://s8.favim.com/orig/151114/girls-generation-icons-snsd-taeyeon-Favim.com-3566828.png
			return src.replace(/(:\/\/[^/]*\/)[^/]*\//, "$1orig/");
		}

		if (domain_nowww === "derpibooru.org" ||
			domain_nowww === "furbooru.org") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+(?:images\/+)?([0-9]+)\/*(?:[?#].*)?$/,
				query_for_id: function(id) {
					return {
						url: "https://" + domain_nosub + "/" + id
					};
				},
				process: function(done, resp, cache_key) {
					var ogimage = resp.responseText.match(/<meta content="([^"]+)" property="og:image">/);
					if (!ogimage) {
						console_error(cache_key, "Unable to find og:image match for", resp);
						return done(null, false);
					}

					return done(decode_entities(ogimage[1]), 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (host_domain_nowww === "derpibooru.org" ||
			host_domain_nowww === "furbooru.org") {
			var link = common_functions["get_link_el_matching"](options.element, function(a) {
				return /^[a-z]+:\/\/[^/]+\/+(?:images\/+)?([0-9]+)\/*(?:[?#].*)?$/.test(a.href);
			});

			if (link) {
				return {
					url: link.href,
					is_pagelink: true
				};
			}
		}

		if (domain_nowww === "derpicdn.net" ||
			// https://furrycdn.org/img/2020/7/20/10078/thumb.jpg
			domain_nowww === "furrycdn.org") {
			// https://derpicdn.net/img/2018/2/24/1664344/thumb.png
			//   https://derpicdn.net/img/2018/2/24/1664344/large.png
			//   https://derpicdn.net/img/2018/2/24/1664344/full.png
			// https://derpicdn.net/img/2016/10/9/1268708/large.png -- 1280x973
			//   https://derpicdn.net/img/2016/10/9/1268708/full.png -- 4603x3500
			//   https://derpicdn.net/img/view/2016/10/9/1268708.png -- 4603x3500
			newsrc = src.replace(/\/(?:thumb|large)(\.[^/.]*)$/, "/full$1");
			if (newsrc !== src)
				return newsrc;

			// thanks to /u/evan555alpha: https://www.reddit.com/r/mylittlepony/comments/f4nxru/sparkle_family_artistangusdra/fhsdtzv/
			// https://derpicdn.net/img/2019/5/4/2030328/full.jpeg
			//   https://derpicdn.net/img/view/2019/5/4/2030328.jpeg
			// https://derpibooru.org/2030328
			newsrc = src.replace(/(\/img\/+)([0-9]{4}\/+[0-9]{1,2}\/+[0-9]{1,2}\/+[0-9]+)\/+[^/.]+(\.[^/.]+)(?:[?#].*)?$/, "$1view/$2$3");
			if (newsrc !== src)
				return newsrc;

			var basedomain = "derpibooru.org";
			if (domain_nosub === "furrycdn.org")
				basedomain = "furbooru.org";

			match = src.match(/\/img\/+(?:view\/+)?[0-9]{4}\/+(?:[0-9]{1,2}\/+){2}([0-9]+)[./]/);
			if (match) {
				// https://furbooru.org/10078 or https://furbooru.org/images/10078
				return {
					url: src,
					extra: {page: "https://" + basedomain + "/" + match[1]}
				};
			}
		}

		if (domain_nosub === "iimg.me") {
			// http://mnetjapan.iimg.me/interest.php?url=http%3A%2F%2Fjp.mnet.com%2Fdata%2Fwww.mnetjapan.com%2Fadmin%2F000%2F172%2F494
			//   http://jp.mnet.com/data/www.mnetjapan.com/admin/000/172/494
			// http://s.iimg.me/profile.php?url=http%3A%2F%2Fs.iimg.me%2FprofileImage%2Fg%2F9%2F98g_1423385594_profile
			newsrc = src.replace(/.*\/[a-z]*\.php.*?[?&]url=([^&]*).*?$/, "$1");
			if (newsrc !== src && string_indexof(newsrc, "http") === 0) {
				return decodeURIComponent(newsrc);
			}
		}

		if (domain === "pix.avaxnews.com" ||
			// https://pix.avax.news/avaxnews/7d/39/0005397d_medium.jpeg
			//   https://pix.avax.news/avaxnews/7d/39/0005397d.jpeg
			domain === "pix.avax.news" ||
			// https://pixhost.icu/avaxhome/36/ae/0061ae36_medium.jpg
			//   https://pixhost.icu/avaxhome/36/ae/0061ae36.jpg
			domain_nowww === "pixhost.icu" ||
			// https://pxhst.co/avaxhome/90/ce/0029ce90_medium.jpeg
			//   https://pxhst.co/avaxhome/90/ce/0029ce90.jpeg
			domain_nowww === "pxhst.co") {
			// http://pix.avaxnews.com/avaxnews/99/e2/0002e299_medium.jpeg
			//   http://pix.avaxnews.com/avaxnews/99/e2/0002e299.jpeg
			// https://pix.avaxnews.com/avaxnews/9c/e2/0002e29c_medium.jpeg
			//   https://pix.avaxnews.com/avaxnews/9c/e2/0002e29c.jpeg
			return src.replace(/_[^/]*(\.[^/.]*)$/, "$1");
		}

		if (domain_nosub === "hurimg.com" ||
			// http://img.posta.com.tr/img/78/567x391/5ae22558ae298b8e001426ff
			//   http://img.posta.com.tr/img/78/0x0/5ae22558ae298b8e001426ff
			//   http://img.posta.com.tr/img/100/0x0/5ae22558ae298b8e001426ff
			domain === "img.posta.com.tr" ||
			// http://icdn.pstimg.com/img/80/700x410/5ae2c6f066a97c82afd94131
			//   http://icdn.pstimg.com/img/100/0x0/5ae2c6f066a97c82afd94131
			domain === "icdn.pstimg.com" ||
			// http://img.fanatik.com.tr/img/78/394x0/5b0d157966a97c43510a1c3d
			//   http://img.fanatik.com.tr/img/100/0x0/5b0d157966a97c43510a1c3d
			domain === "img.fanatik.com.tr" ||
			// https://assets.dogannet.tv/img/10/640x0/5ac6231aae298b8e01213bed
			//   https://assets.dogannet.tv/img/100/0x0/5ac6231aae298b8e01213bed
			domain === "assets.dogannet.tv" ||
			// https://img2.fanatik.com.tr/img/78/364x364/5af541ee66a97c82afdd810f
			//  https://img2.fanatik.com.tr/img/100/0x0/5af541ee66a97c82afdd810f
			domain_nosub === "fanatik.com.tr" ||
			// https://i.pstimaj.com/img/78/394x0/5ae2d796ae298b8e001550d0
			//   https://i.pstimaj.com/img/100/0x0/5ae2d796ae298b8e001550d0
			((domain_nosub === "pstimaj.com" ||
			  // https://i.milimaj.com/i/milliyet/90/0x420/5c8d444445d2a05010d4f31f.jpg
			  //   https://i.milimaj.com/i/milliyet/100/0x0/5c8d444445d2a05010d4f31f.jpg
			  domain_nosub === "milimaj.com" ||
			  // https://i.cnnturk.com/ps/cnnturk/75/630x0/582064a15659341ab0aea248.jpg
			  //   https://i.cnnturk.com/ps/cnnturk/75/0x0/582064a15659341ab0aea248.jpg
			  //   https://i.cnnturk.com/ps/cnnturk/100/0x0/582064a15659341ab0aea248.jpg
			  // https://i2.cnnturk.com/i/cnnturk/75/350x0/55d45591e50aa915d0fba246.jpg
			  //   https://i2.cnnturk.com/i/cnnturk/100/0x0/55d45591e50aa915d0fba246.jpg
			  domain_nosub === "cnnturk.com") && /^i[0-9]*\./.test(domain))) {
			// http://i.hurimg.com/i/hdn/10/100x0/5a8becad18c7731320697a39.jpg
			//   http://i.hurimg.com/i/hdn/100/0x0/5a8becad18c7731320697a39.jpg
			// http://i.hurimg.com/i/hurriyet/75/770x0/563f20410f2544733cbe7185
			//   http://i.hurimg.com/i/hurriyet/100/0x0/563f20410f2544733cbe7185
			// http://i4.hurimg.com/i/hurriyet/75/590x332/5d89e33a67b0a903f89d0d99.jpg
			//   http://i4.hurimg.com/i/hurriyet/100/0x0/5d89e33a67b0a903f89d0d99.jpg

			//return src.replace(/(\/i\/[a-z]+\/)[0-9]+\/[0-9]+x[0-9]+\//, "$1100/0x0/");
			//return src.replace(/\/[0-9]+x[0-9]+\/([0-9a-f]+)$/, "/0x0/$1");
			//return src.replace(/\/img\/[0-9]+\/[0-9]+x[0-9]+\/([0-9a-f]+)(?:[?#].*)?$/, "/img/100/0x0/$1")
			return src.replace(/\/[0-9]+\/[0-9]+x[0-9]+\/([0-9a-f]+(?:\.[^/.]*)?)([?#].*)?$/, "/100/0x0/$1");
		}

		if (domain === "image.gazetevatan.com" ||
			// thanks to anonymous for reporting:
			// https://image.posta.com.tr/i/posta/75/540x400/657bfe26623a7853c1b5567c.jpg
			//   https://image.posta.com.tr/i/posta/100/0x0/657bfe26623a7853c1b5567c.jpg
			domain === "image.posta.com.tr") {
			// thanks to anonymous for reporting:
			// https://image.gazetevatan.com/i/gazetevatan/75/1200x0/60cac3ed932151089007c3bc.jpg
			//   https://image.gazetevatan.com/i/gazetevatan/100/0x0/60cac3ed932151089007c3bc.jpg
			return src.replace(/(\/i\/+[^/]+\/+)[0-9]+\/+[0-9]+x[0-9]+\/+/, "$1100/0x0/");
		}

		if (domain === "www.kurtkomaromi.com" ||
			// http://fashionweddingdress.typepad.com/.a/6a0147e0f2fc76970b01901cf76eda970b-800wi
			// http://attheloft.typepad.com/.a/6a00e54ecca8b9883301901f038a73970b-pi
			domain_nosub === "typepad.com" ||
			// http://blogs.elpais.com/.a/6a00d8341bfb1653ef01a511bd02ef970c-pi
			//   http://blogs.elpais.com/.a/6a00d8341bfb1653ef01a511bd02ef970c
			domain === "blogs.elpais.com" ||
			// nowww doesn't exist
			// http://www.summerofdan.net/.a/6a00d83431352e53ef01b8d2d8eada970c-500wi
			domain === "www.summerofdan.net" ||
			// http://www.thequeenofstyle.com/.a/6a00e554e5d8fe883301bb097df669970d-pi
			//   http://www.thequeenofstyle.com/.a/6a00e554e5d8fe883301bb097df669970d
			domain_nowww === "thequeenofstyle.com" ||
			// http://www.thequestforit.com/.a/6a00d83451b1d169e2017c36ac73b8970b-320wi
			//   http://www.thequestforit.com/.a/6a00d83451b1d169e2017c36ac73b8970b
			domain_nowww === "thequestforit.com" ||
			// https://robertmccusker.blogs.com/.a/6a00d8341cf3a353ef022ad376dd30200c-500wi
			// https://backstage.blogs.com/.a/6a00d8341c9cc153ef011571d351fd970b-500wi
			//   https://backstage.blogs.com/.a/6a00d8341c9cc153ef011571d351fd970b
			//domain === "backstage.blogs.com" ||
			// https://reporter.blogs.com/.a/6a00d83451d69069e2011571119659970c-600wi
			//   https://reporter.blogs.com/.a/6a00d83451d69069e2011571119659970c
			//domain === "reporter.blogs.com" ||
			domain_nosub === "blogs.com" ||
			// https://latimesblogs.latimes.com/.a/6a00d8341c630a53ef0134885e7e2a970c-200wi
			//   https://latimesblogs.latimes.com/.a/6a00d8341c630a53ef0134885e7e2a970c
			domain === "latimesblogs.latimes.com" ||
			// nowww doesn't exist
			// http://www.weeklystorybook.com/.a/6a0105369e6edf970b01b8d0ebd465970c-400wi
			//   http://www.weeklystorybook.com/.a/6a0105369e6edf970b01b8d0ebd465970c
			domain === "www.weeklystorybook.com") {
			// nowww doesn't exist
			// http://www.kurtkomaromi.com/.a/6a00d8341c764653ef01b8d144082f970c-500wi
			//   http://www.kurtkomaromi.com/.a/6a00d8341c764653ef01b8d144082f970c
			return src.replace(/^([a-z]+:\/\/[^/]+\/+\.a\/+[0-9a-f]{10,})-[^/]*(?:[?#].*)?$/, "$1");
		}

		if (domain_nowww === "bathingnews.com") {
			// http://www.bathingnews.com/.a/6a01156ef01963970c0133f527312d970b-pi -- head: 500
			//   http://www.bathingnews.com/.a/6a01156ef01963970c0133f527312d970b
			return {
				can_head: false,
				url: src.replace(/(\/\.a\/[^-/]*)-[^/]*$/, "$1")
			};
		}

		if (domain_nowww === "fmyokohama.jp") {
			// https://www.fmyokohama.jp/umore/.assets/thumbnail/UICS-1351_UuB_extralarge-1200wi.png
			//   https://www.fmyokohama.jp/umore/.assets/UICS-1351_UuB_extralarge.png
			return src.replace(/\/thumbnail\/+([^/]*)-[0-9]+wi(\.[^/.]*)(?:[?#].*)?$/, "/$1$2");
		}

		if (domain === "gd.image-qoo10.jp") {
			// https://gd.image-qoo10.jp/ai/059/846/1044846059_07.g_80-w-st_g.jpg
			//   https://gd.image-qoo10.jp/ai/059/846/1044846059_07.jpg -- 900x1200
			return src.replace(/\.[^/.]*(\.[^/.]*)$/, "$1");
		}

		if (domain === "img.jakpost.net") {
			// http://img.jakpost.net/c/2017/08/11/2017_08_11_30875_1502421112._small.jpg
			//   https://img.jakpost.net/c/2017/08/11/2017_08_11_30875_1502421112.jpg -- 1360x910
			// https://img.jakpost.net/c/2018/11/13/2018_11_13_58522_1542082764._small.jpg -- 363x241
			//   https://img.jakpost.net/c/2018/11/13/2018_11_13_58522_1542082764.jpg -- doesn't work
			//   https://img.jakpost.net/c/2018/11/13/2018_11_13_58522_1542082764._large.jpg -- 660x438
			return [
				src.replace(/\.[^/.]*(\.[^/.]*)$/, "$1"),
				src.replace(/\._[a-z]+(\.[^/.]*)$/, "._large$1")
			];
		}

		if (domain === "r.ddmcdn.com") {
			// http://r.ddmcdn.com/w_1330/s_f/o_1/cx_0/cy_0/cw_1330/ch_1995/TLC/uploads/2016/03/SYTTD_ep1407_051.jpg
			//   http://r.ddmcdn.com/cx_0/cy_0/cw_0/ch_0/TLC/uploads/2016/03/SYTTD_ep1407_051.jpg
			//   http://static.ddmcdn.com/TLC/uploads/2016/03/SYTTD_ep1407_051.jpg
			// http://r.ddmcdn.com/s_f/o_1/APL/uploads/2015/11/pangolin-ARTICLE-PAGE.jpg
			//   http://static.ddmcdn.com/APL/uploads/2015/11/pangolin-ARTICLE-PAGE.jpg
			// http://r.ddmcdn.com/w_2574/s_f/o_1/cx_7/cy_0/cw_2574/ch_1716/DSC/uploads/2015/01/mythbusters-228-07.jpg
			//   http://static.ddmcdn.com/DSC/uploads/2015/01/mythbusters-228-07.jpg
			return src.replace(/:\/\/[^/]*\/(?:[^/_]*_[^/_]*\/)*/, "://static.ddmcdn.com/");
		}

		if ((domain_nosub === "newegg.com" && /images[0-9]*\./.test(domain)) ||
			// thanks to Luke-L on github for reporting: https://github.com/qsniyg/maxurl/issues/1175
			// https://c1.neweggimages.com/ProductImageCompressAll300/24-281-222-42.jpg
			//   https://c1.neweggimages.com/ProductImageOriginal/24-281-222-42.jpg
			// https://c1.neweggimages.com/ProductImageCompressAll60/BJ66S23050504RCXO2A.jpg
			//   https://c1.neweggimages.com/ProductImageOriginal/BJ66S23050504RCXO2A.jpg
			domain_nosub === "neweggimages.com") {
			// https://images10.newegg.com/ProductImageCompressAll300/A24G_131515246497615592Gsxgghs342.jpg
			//   https://images10.newegg.com/ProductImageOriginal/A24G_131515246497615592Gsxgghs342.jpg
			// https://images10.newegg.com/NeweggImage/ProductImage/11-129-212-Z01.jpg
			//   https://images10.newegg.com/NeweggImage/ProductImageCompressAll1280/11-129-212-Z01.jpg
			//   https://images10.newegg.com/ProductImageOriginal/11-129-212-Z01.jpg
			// https://images10.newegg.com/NeweggImage/productimage/11-154-087-13.jpg
			//   https://images10.newegg.com/ProductImageOriginal/11-154-087-13.jpg
			// ignore:
			// https://images10.newegg.com/BizIntell/item/11/129/11-129-209/a6_120817.jpg
			// thanks to Liz on discord for reporting:
			// https://c1.neweggimages.com/itemreivewimages/reviewimg300/21ea27a6db4e107e55c6f089f005034b4eca0c9cfb7e7cfe366cc494138e52ad.jpg
			//   https://c1.neweggimages.com/itemreivewimages/reviewimg1920/21ea27a6db4e107e55c6f089f005034b4eca0c9cfb7e7cfe366cc494138e52ad.jpg
			// https://c1.neweggimages.com/itemreivewimages/original/bcd444ff99d746a4a8eb3c87bf796e2da8e52f20fe1e7a88e8373bdf3d2eb3ec.jpg -- 4032x3024
			return src
				.replace(/(:\/\/[^/]*\/)(?:NeweggImage\/)?(?:ProductImage|productimage)[^/]*\//, "$1ProductImageOriginal/")
				.replace(/\/itemreivewimages\/+reviewimg[0-9]+\/+/, "/itemreivewimages/original/");
		}

		if (domain === "images.costco-static.com" ||
			domain === "images.costcobusinesscentre.ca") {
			// https://images.costco-static.com/ImageDelivery/imageService?profileId=12026539&imageId=1660214-894__1&recipeName=350
			//   https://images.costco-static.com/ImageDelivery/imageService?profileId=12026539&imageId=1660214-894__1
			// https://images.costcobusinesscentre.ca/ImageDelivery/imageService?profileId=12027981&imageId=1030100__1&recipeName=350
			//   https://images.costcobusinesscentre.ca/ImageDelivery/imageService?profileId=12027981&imageId=1030100__1
			return src
				.replace(/([?&])recipeName=[^&]*/, "$1")
				.replace(/&$/, "");
		}

		if (amazon_container === "emerge-tech") {
			// https://emerge-tech.s3.amazonaws.com/content/thumb/24764608_main_thumb.jpeg
			//   https://emerge-tech.s3.amazonaws.com/content/full/24764608_main_full.jpeg
			// https://s3.amazonaws.com/emerge-tech/content/thumb/24764608_main_thumb.jpeg
			//   https://s3.amazonaws.com/emerge-tech/content/full/24764608_main_full.jpeg
			return src.replace(/\/[a-z]*\/([0-9]*_[a-z]*_)[a-z]*(\.[^/.]*)$/, "/full/$1full$2");
		}

		if (domain_nosub === "wfcdn.com" && domain.match(/img[0-9]*(?:-[^.]*)?\.wfcdn\.com/) ||
			// thanks to anonymous for reporting:
			// https://assets.wfcdn.com/im/53059156/compr-r85/2536/253669738/600+Fill+Power+All+Seasons+Down+Comforter.jpg
			//   https://assets.wfcdn.com/lf/unprocessed/hash/2536/253669738/1/600+Fill+Power+All+Seasons+Down+Comforter.jpg
			domain === "assets.wfcdn.com") {
			// https://secure.img1-fg.wfcdn.com/im/46823086/resize-h800%5Ecompr-r85/1292/12924520/Water+Resistant+Combination+Security+Safe+with+Dial+/+Combination/Key/Dual-Lock.jpg
			//   https://secure.img1-fg.wfcdn.com/im/46823086/compr-r85/1292/12924520/Water+Resistant+Combination+Security+Safe+with+Dial+/+Combination/Key/Dual-Lock.jpg
			//   https://secure.img1-fg.wfcdn.com/lf/unprocessed/hash/1292/12924520/1/Water+Resistant+Combination+Security+Safe+with+Dial+/+Combination/Key/Dual-Lock.jpg
			// https://secure.img1-fg.wfcdn.com/lf/maxsquare/hash/11510/9457200/1/Waverly-Imperial-Dress-Porcelain-50-Curtain-Valance.jpg
			//   https://secure.img1-fg.wfcdn.com/lf/unprocessed/hash/11510/9457200/1/Waverly-Imperial-Dress-Porcelain-50-Curtain-Valance.jpg
			return src
				.replace(/\/im\/+[0-9]+\/+compr-r85\/+([0-9]+\/+[0-9]+\/+)/, "/lf/unprocessed/hash/$11/")
				.replace(/(\/lf\/+)[a-z]+(\/+hash\/)/, "$1unprocessed$2")
				.replace(/(\/im\/[0-9]+\/)[^/]*\//, "$1compr-r85/");
		}

		if (domain_nosub === "hdnux.com") {
			// https://s.hdnux.com/photos/71/36/40/15067141/3/1024x1024.jpg
			//   https://s.hdnux.com/photos/71/36/40/15067141/3/rawImage.jpg
			// http://ww2.hdnux.com/photos/70/63/07/14889457/3/1024x1024.jpg
			//   https://s.hdnux.com/photos/70/63/07/14889457/3/rawImage.jpg
			// https://s.hdnux.com/photos/70/63/07/14889457/3/1024x1024.jpg
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/445
			// https://s.hdnux.com/photos/01/14/11/70/19963411/3/core_breaking_now_medium.jpg
			//   https://s.hdnux.com/photos/01/14/11/70/19963411/3/rawImage.jpg
			// https://s.hdnux.com/photos/01/13/31/60/19766273/3/core_thumbnail_list_small.jpg
			//   https://s.hdnux.com/photos/01/13/31/60/19766273/3/rawImage.jpg
			// https://s.hdnux.com/photos/01/14/05/62/19946629/3/core_centerpiece_tab_small.jpg
			//   https://s.hdnux.com/photos/01/14/05/62/19946629/3/rawImage.jpg
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/477
			// https://s.hdnux.com/photos/01/13/61/33/19863286/5/landscape_43.jpg
			//   https://s.hdnux.com/photos/01/13/61/33/19863286/5/rawImage.jpg
			// https://s.hdnux.com/photos/01/14/14/30/19973652/3/ratio3x2_1200.jpg
			//   https://s.hdnux.com/photos/01/14/14/30/19973652/3/rawImage.jpg
			// https://s.hdnux.com/photos/01/14/46/25/20079940/3/ratio3x2_875.jpg
			//   https://s.hdnux.com/photos/01/14/46/25/20079940/3/rawImage.jpg
			// https://s.hdnux.com/photos/01/14/50/15/20087648/3/ratio3x2_225.jpg
			//   https://s.hdnux.com/photos/01/14/50/15/20087648/3/rawImage.jpg
			// https://s.hdnux.com/photos/01/06/44/44/18499903/5/ratio1x1_200.jpg
			//   https://s.hdnux.com/photos/01/06/44/44/18499903/5/rawImage.jpg
			// https://s.hdnux.com/photos/51/22/04/10821926/4/ratio1x1_85.jpg
			//   https://s.hdnux.com/photos/51/22/04/10821926/4/rawImage.jpg
			return src.replace(/(\/photos\/+(?:[0-9]{2}\/+){3,4}[0-9]+\/+[0-9]+\/+)[^/.?#]+(\.[^/.]*)(?:[?#].*)?$/, "$1rawImage$2");
		}

		if (domain_nosub === "busan.com" && domain.match(/^news[0-9]*\./)) {
			// http://news20.busan.com/content/image/2018/02/28/20180228000313_t.jpg
			//   http://news20.busan.com/content/image/2018/02/28/20180228000313_0.jpg
			return src.replace(/(\/content\/+image\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9]+)_t(\.[^/.]*)$/, "$1_0$2");
		}

		if (domain_nowww === "busan.com") {
			// http://www.busan.com/nas/wcms/wcms_data/photos/2019/05/13/2019051315415469263_m.jpg
			//   http://www.busan.com/nas/wcms/wcms_data/photos/2019/05/13/2019051315415469263_l.jpg
			// s = 160, m = 480, l = 640 (width)
			// other:
			// http://mt.busan.com/data/cheditor4/14052740/9085ef4bcf362d18cb375ffd3d0f5064_xMgX3pCB.jpg -- 4188x2574
			// http://news20.busan.com/content/image/2008/12/31/20081231000021_0.jpg --2807x1872 (very pixelated)
			// http://bfmr.busan.com/data/photo/6009b4cb901429490495.JPG -- 2500x1875
			// http://builfilm.busan.com/data/editor/1710/thumb-3c5ec79e3ad1c60d14f318fdcf7cf5dd_1508311345_387_1200x1688.jpg --1200x1688
			return src.replace(/(\/wcms\/+wcms_data\/+photos\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9]+)_[sm](\.[^/.]*)(?:[?#].*)?$/, "$1_l$2");
		}

		if (amazon_container === "bucket.scribblelive.com" ||
			// http://images.scribblelive.com/2016/2/29/7cb26c6a-fa29-46cb-8917-26885e458232_500.jpg
			//   http://images.scribblelive.com/2016/2/29/7cb26c6a-fa29-46cb-8917-26885e458232.jpg
			domain === "images.scribblelive.com") {
			// http://s3.amazonaws.com/bucket.scribblelive.com/12554/2016/6/27/9509e65e-3508-415c-9517-e378eec731b9_1000.jpg
			//   http://s3.amazonaws.com/bucket.scribblelive.com/12554/2016/6/27/9509e65e-3508-415c-9517-e378eec731b9.jpg
			return src.replace(/_[0-9]+(\.[^/.]*)$/, "$1");
		}

		if (false && domain === "cdn.images.express.co.uk") {
			// wip
			// https://cdn.images.express.co.uk/img/dynamic/mps/110x120/Barry-McElduff.jpg
			// https://cdn.images.express.co.uk/img/dynamic/79/590x/secondary/Sophie-Turner-295434.jpg - 590x832
			// https://cdn.images.express.co.uk/img/dynamic/59/590x/secondary/windows-10-creators-update-security-centre-settings-884921.png - 5464x2912
			// https://cdn.images.express.co.uk/img/dynamic/galleries/x701/45523.jpg
			// https://cdn.images.express.co.uk/img/dynamic/79/590x/361211_1.jpg
			// https://cdn.images.express.co.uk/img/dynamic/139/590x/secondary/screen-660225.png -- 3190x1790
			// https://cdn.images.dailystar.co.uk/dynamic/140/photos/491000/BEYONCE-4-924491.jpg
			// http://cdn.images.dailystar.co.uk/dynamic/1/281x351/205610_1.jpg
			// https://cdn.images.dailystar.co.uk/dynamic/45/281x351/120690_1.jpg
		}

		if (domain === "www.dhresource.com" ||
			domain === "image.dhgate.com") {
			// https://www.dhresource.com/webp/m/100x100/f2/albu/g5/M01/44/8F/rBVaI1mBeuGAZgrYAAERdzyHfFk078.jpg
			//   https://www.dhresource.com/0x0/f2/albu/g5/M01/44/8F/rBVaI1mBeuGAZgrYAAERdzyHfFk078.jpg
			// https://www.dhresource.com/albu_385099241_00-1.0x0/ms-lure-large-size-sexy-lingerie-lace-thong.jpg
			// http://www.dhresource.com/albu_281896403_00/1.0x0.jpg
			// https://www.dhresource.com/100x100s/f2-albu-g5-M00-DC-58-rBVaI1kBY-yAf6R4AB3gjDk3S28974.jpg/new-arrive-lady-fashion-jumpsuits-long-palazzo.jpg
			//   https://www.dhresource.com/0x0s/f2-albu-g5-M00-DC-58-rBVaI1kBY-yAf6R4AB3gjDk3S28974.jpg/new-arrive-lady-fashion-jumpsuits-long-palazzo.jpg
			// http://www.dhresource.com/albu_1061302516_00-1.600x600/wholesale-mens-travel-holster-shoulder-wallet.jpg
			//   http://www.dhresource.com/albu_1061302516_00-1.0x0/wholesale-mens-travel-holster-shoulder-wallet.jpg
			// https://image.dhgate.com/albu_381865235_00/1.0x0.jpg
			return src
				.replace(/(:\/\/[^/]*\/albu_[0-9]+_[0-9]+[-/].*?)[0-9]+x[0-9]+/, "$10x0")
				.replace(/(:\/\/[^/]*\/)[0-9]+x[0-9]+/, "$10x0")
				.replace(/(:\/\/[^/]*\/)[^/]*\/[^/]*\/[0-9]+x[0-9]+\//, "$10x0/");
		}

		if (domain_nowww === "storify.com" && /\/services\/+proxy\//.test(src)) {
			// https://storify.com/services/proxy/2/X3vpwL2T19SKqyTM4tGayg/http/www.navy.mil/management/photodb/photos/131112-N-TG831-184.JPG
			//   http://www.navy.mil/management/photodb/photos/131112-N-TG831-184.JPG
			// https://storify.com/services/proxy/2/zCwCS2c37byorPhrTXxeJQ/https/pbs.twimg.com/media/CnHZuSZWIAAfesh.jpg:large
			return src.replace(/.*\/services\/proxy\/[0-9]+\/[^/]*\/([a-z]+)\/(.*)$/, "$1://$2");
		}

		if (domain_nowww === "mbcsportsplus.com" ||
			// http://m.mbcsportsplus.com/images/img.php?srv=1&type=a&src=/2019/04/20190404150712_hnblnnoi.png
			//   http://m.mbcsportsplus.com/data/board/attach/2019/04/20190404150712_hnblnnoi.png
			domain === "m.mbcsportsplus.com") {
			// http://www.mbcsportsplus.com/images/img.php?srv=1&type=m&src=/201803/99908540_2018030209204161.jpg&gImg=1&refresh=&w=300
			//   http://www.mbcsportsplus.com/data/home/data/msplMain/201803/99908540_2018030209204161.jpg
			// http://www.mbcsportsplus.com/images/img.php?srv=1&type=a&src=/2018/06/20180618070830_wdeabmol.jpg
			//   http://www.mbcsportsplus.com/data/board/attach/2018/06/20180618070830_wdeabmol.jpg

			var outdir = null;
			if (src.match(/[?&]type=m[^a-z0-9A-Z]/))
				outdir = "/data/home/data/msplMain";
			else if (src.match(/[?&]type=a[^a-z0-9A-Z]/))
				outdir = "/data/board/attach";

			if (outdir)
				return src.replace(/\/images\/+img\.php\?(?:.*&)?src=([^&]*).*/, outdir + "$1");
		}

		if (domain_nosub === "joomag.com" && domain.match(/s[0-9]*cdn\.joomag\.com/)) {
			// https://view.joomag.com/%EB%85%84-%EC%9B%94%ED%98%B8-maxim%EB%A7%A5%EC%8B%AC-%ED%91%9C%EC%A7%80%EB%AA%A8%EB%8D%B8-%EB%A0%88%EC%9D%B8%EB%B3%B4%EC%9A%B0-%EC%A7%80%EC%88%99-%EC%B5%9C%ED%98%84%EC%84%9D-new-07-2015/0970864001438089053
			// https://s2cdn.joomag.com/mobile/0/548/548615/102_1-0.PNG?.1520177124
			//   https://s2cdn.joomag.com/mobile/0/548/548615/102_0-0.PNG?.1520177124
			//   https://www.joomag.com/Frontend/WebService/getPageCopy.php?uID=0/548/548615/102_0-0.PNG
			// https://s2cdn.joomag.com/res_mag/0/305/305387/548615/thumbs/spread/102.jpg?1458945882
			//   https://s2cdn.joomag.com/res_mag/0/305/305387/548615/thumbs/spread/101.jpg?1458945882 - 101 == 102
			return src.replace(/(\/mobile\/.*\/[0-9]+_)[0-9]+(-[0-9]*\.[^/]*)$/, "$10$2");
		}

		if (domain === "i.pximg.net" ||
			// thanks to TheLastZombie on github: https://github.com/qsniyg/maxurl/pull/598
			// https://itsukiyu.fanbox.cc/
			// https://pixiv.pximg.net/c/1620x580_90_a2_g5/fanbox/public/images/creator/439106/cover/4V3LygXYwPDd2IIR8RxBM4Ht.jpeg
			//   https://pixiv.pximg.net/fanbox/public/images/creator/439106/cover/4V3LygXYwPDd2IIR8RxBM4Ht.jpeg
			// https://pixiv.pximg.net/c/160x160_90_a2_g5/fanbox/public/images/user/439106/icon/NTphzOei0lqoXSSMkPuwY4rV.jpeg
			//   https://pixiv.pximg.net/fanbox/public/images/user/439106/icon/NTphzOei0lqoXSSMkPuwY4rV.jpeg
			// https://pixiv.pximg.net/c/936x600_90_a2_g5/fanbox/public/images/plan/109474/cover/3rfOxbEV0Vwr6FWeZJUB6Fak.jpeg
			//   https://pixiv.pximg.net/fanbox/public/images/plan/109474/cover/3rfOxbEV0Vwr6FWeZJUB6Fak.jpeg
			domain === "pixiv.pximg.net" ||
			// thanks to Nguyen on discord:
			// https://pixiv.moe/illust/95993720
			// https://i.pixiv.re/img-master/img/2022/02/04/16/50/20/95993720_p0_master1200.jpg
			//   https://i.pixiv.re/img-original/img/2022/02/04/16/50/20/95993720_p0.png
			domain === "i.pixiv.re" ||
			// https://tc-pximg01.techorus-cdn.com/c/250x250_80_a2/img-master/img/2010/07/31/02/46/26/12235259_p0_square1200.jpg
			//   https://tc-pximg01.techorus-cdn.com/img-original/img/2010/07/31/02/46/26/12235259_p0.png
			(domain_nosub === "techorus-cdn.com" && /^tc-pximg[0-9]*\./.test(domain))) {
			// only works if the referrer is correct
			// https://i.pximg.net/c/600x600/img-master/img/2017/06/25/17/53/43/63558968_p0_master1200.jpg
			//   https://i.pximg.net/img-original/img/2017/06/25/17/53/43/63558968_p0.jpg
			// https://i.pximg.net/c/600x600/img-master/img/2017/06/10/23/13/15/63320604_p0_master1200.jpg
			//   https://i.pximg.net/c/600x600/img-master/img/2017/06/10/23/13/15/63320604_p0_master1200.jpg
			// https://i.pximg.net/c/600x600/img-master/img/2017/06/10/23/13/15/63320604_p0_master1200.jpg
			//   https://i.pximg.net/img-original/img/2017/06/10/23/13/15/63320604_p0.jpg
			//   https://i.pximg.net/img-original/img/2017/06/10/23/13/15/63320604_p0.jpg
			//   referer: https://www.pixiv.net/member_illust.php?mode=medium&illust_id=63320604
			// https://i.pximg.net/c/600x1200_90/img-master/img/2017/12/26/20/00/02/66469686_p0_master1200.jpg
			//   https://i.pximg.net/img-master/img/2017/12/26/20/00/02/66469686_p0_master1200.jpg
			//   https://i.pximg.net/img-original/img/2017/12/26/20/00/02/66469686_p0.jpg
			//   https://www.pixiv.net/member_illust.php?mode=manga&illust_id=66469686
			// https://i.pximg.net/c/128x128/img-master/img/2017/07/15/21/52/41/63880467_p0_square1200.jpg
			//   https://i.pximg.net/img-original/img/2017/07/15/21/52/41/63880467_p0.jpg
			// https://i.pximg.net/c/128x128/img-master/img/2016/04/20/21/54/33/56447170_p0_square1200.jpg
			//   https://i.pximg.net/img-original/img/2016/04/20/21/54/33/56447170_p0.png
			// https://i.pximg.net/c/250x250_80_a2/img-original/img/2018/05/20/14/43/30/68834563_p0.png
			//   https://i.pximg.net/img-original/img/2018/05/20/14/43/30/68834563_p0.png
			// https://i.pximg.net/user-profile/img/2008/06/17/01/28/01/171098_fc06efd15628e2ee252941ae5298b5ff_170.jpg
			//   https://i.pximg.net/user-profile/img/2008/06/17/01/28/01/171098_fc06efd15628e2ee252941ae5298b5ff.jpg
			// thanks to coo11 on github:
			// https://i.pximg.net/c/250x250_80_a2/custom-thumb/img/2020/12/08/00/00/18/86162834_p0_custom1200.jpg
			//   https://i.pximg.net/img-original/img/2020/12/08/00/00/18/86162834_p0.jpg
			newsrc = src
				.replace(/(\/user-profile\/+img\/.*\/[0-9]+_[0-9a-f]{20,})_[0-9]+(\.[^/.]+)(?:[?#].*)?$/, "$1$2")
				.replace(/\/c\/[0-9]+x[0-9]+(?:_[0-9]+)?(?:_[ag][0-9]+)*\//, "/")
				.replace(/\/(?:img-master|custom-thumb)\//, "/img-original/")
				.replace(/(\/[0-9]+_p[0-9]+)_[^/]*(\.[^/.]*)$/, "$1$2");

			//var referer_url = "https://www.pixiv.net/member_illust.php?mode=medium&illust_id=" + src.replace(/.*\/([0-9]+)_[^/]*$/, "$1");
			var referer_url = "https://www.pixiv.net/";

			if (domain === "pixiv.pximg.net" || domain_nosub === "pixiv.re") {
				referer_url = null;
			}

			match = src.match(/\/([0-9]+)_p([0-9]+)(?:_[^/.]+)?\.[^/.]+$/);
			if (!match) {
				id = null;
			} else {
				id = match[1];
				referer_url = "https://www.pixiv.net/artworks/" + id;
			}

			obj = {};

			if (referer_url && domain_nosub !== "pixiv.re") {
				obj.headers = {
					Referer: referer_url
				};
			}

			if (id) {
				obj.extra = {
					page: referer_url
				};
			}

			var urls = [src];
			if (newsrc !== src) {
				urls = add_extensions(newsrc);
			}

			var retobj = fillobj_urls(urls, obj);

			if (id && options && options.force_page && options.cb && options.do_request) {
				retobj.unshift({
					url: referer_url + "#imu-page=" + match[2],
					is_pagelink: true
				});
			}

			return retobj;
		}

		if (domain_nowww === "pixiv.net") {
			// thanks to kattjevfel on github: https://github.com/qsniyg/maxurl/issues/464
			// multi-page post: https://www.pixiv.net/en/artworks/84777803

			var query_pixiv_page = function(id, page, cb) {
				var url = "https://www.pixiv.net/artworks/" + id;

				api_query("pixiv_page:" + id, {
					url: url
				}, function(obj) {
					if (!obj)
						return cb(null);

					if (obj[0].album_info) {
						var links = obj[0].album_info.links;

						for (var i = 0; i < links.length; i++) {
							// != for string/int comparison
							if (i != page) {
								links[i].is_current = false;
								continue;
							}

							links[i].is_current = true;
							obj[0].url = links[i].url;
						}
					}

					return cb(obj);
				}, function(done, resp, cache_key) {
					var match = resp.responseText.match(/<meta\s+name=\"preload-data\"\s+id=\"meta-preload-data\"\s+content='(.*?)'>/);
					if (!match) {
						console_error(cache_key, "Unable to find match", resp);
						return done(null, false);
					}

					var json = JSON_parse(decode_entities(match[1]));
					var illust = json.illust[id];

					//console_log("pixiv data", json, json.illust, illust);

					var obj = {
						extra: {
							page: resp.finalUrl
						},
						headers: {
							Referer: resp.finalUrl
						}
					};

					if (illust.illustTitle) {
						obj.extra.caption = illust.illustTitle;
					}

					var urls = [];
					var urltypes = ["original", "regular", "small", "thumb", "mini"];

					var unsorted_urls = [];
					for (var type in illust.urls) {
						unsorted_urls.push({
							type: type,
							url: illust.urls[type]
						});
					}

					unsorted_urls.sort(function(a, b) {
						var a_index = array_indexof(urltypes, a.type);
						var b_index = array_indexof(urltypes, b.type);

						if (a_index < 0)
							return 1;

						if (b_index < 0)
							return -1;

						return a_index - b_index;
					});

					for (var i = 0; i < unsorted_urls.length; i++) {
						if (array_indexof(urltypes, unsorted_urls[i].type) >= 0)
							urls.push(unsorted_urls[i].url);
					}

					if (urls.length === 0) {
						console_error(cache_key, "Unable to find valid urls from", json, illust);
						return done(null, false);
					}

					var url = urls[0];

					if (illust.pageCount && illust.pageCount > 1) {
						obj.album_info = {
							type: "links",
							links: []
						};

						for (var i = 0; i < illust.pageCount; i++) {
							obj.album_info.links.push({
								url: url.replace(/(_p)[0-9]+(_[^/.]+)?(\.[^/.]+)$/, "$1" + i + "$2$3")
							});
						}
					}

					return done(fillobj_urls([urls[0]], obj), 60*60);
				});
			};

			newsrc = website_query({
				website_regex: [
					/^[a-z]+:\/\/[^/]+\/+(?:[^/]+\/+)?artworks\/+([0-9]+)\/*(?:[?#].*)?$/,
					/^[a-z]+:\/\/[^/]+\/+member_illust\.php\?(?:.*&)?illust_id=([0-9]+)/
				],
				run: function(cb, match, website_options) {
					var page = 0;
					var pagematch = website_options.url.match(/#imu-page=([0-9]+)/);
					if (pagematch)
						page = pagematch[1];

					query_pixiv_page(match[1], page, cb);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nosub === "booth.pm" && domain.match(/s[0-9]*\.booth\.pm/) ||
			domain === "booth.pximg.net") {
			// https://s2.booth.pm/c/c_300/57b9c1d2-83c2-43ca-8368-8caef0f77ecf/i/740855/ce009797-aea2-4084-a029-a766159fa233.jpg
			//   https://s2.booth.pm/c/c_300/57b9c1d2-83c2-43ca-8368-8caef0f77ecf/i/740855/ce009797-aea2-4084-a029-a766159fa233.jpg
			// https://s2.booth.pm/c/f_128/users/4030105/icon_image/2a5bf25c-cf1e-4aaa-a537-483ce0a7cbb7.jpg
			//   https://s2.booth.pm/users/4030105/icon_image/2a5bf25c-cf1e-4aaa-a537-483ce0a7cbb7.jpg
			// https://s2.booth.pm/7279e569-4081-41f9-9188-21d28fa637cc/i/674179/e994efb8-f8a2-45e9-9b5b-27815aec0abc_c_72x72.jpg
			//   https://s2.booth.pm/7279e569-4081-41f9-9188-21d28fa637cc/i/674179/e994efb8-f8a2-45e9-9b5b-27815aec0abc.jpg
			// https://s.booth.pm/c/f_620/5ee95071-e09f-4178-bf7a-8e91d5520f91/i/422674/60a4c70c-a57d-421a-bd0b-89bd3e3be1bf.jpg
			//   https://s.booth.pm/5ee95071-e09f-4178-bf7a-8e91d5520f91/i/422674/60a4c70c-a57d-421a-bd0b-89bd3e3be1bf.jpg
			// doesn't work for all:
			// https://s.booth.pm/c/f_620/c9fda5ec-b0a8-4ed6-971e-72629be03365/i/752229/c723db57-697e-4bde-8d6f-307a52747400.jpg
			//   https://s.booth.pm/c9fda5ec-b0a8-4ed6-971e-72629be03365/i/752229/c723db57-697e-4bde-8d6f-307a52747400.jpg -- doesn't work
			// doesn't work for all, some are ".JPG" in the end instead of ".jpg"
			newsrc = src
				.replace(/\/c\/[a-z]_[0-9]+\//, "/")
				.replace(/_c_[0-9]+x[0-9]+(\.[^/.]*)$/, "$1");
			if (newsrc !== src) {
				return add_full_extensions(newsrc);
			}

			// https://booth.pximg.net/c/128x128/users/30729/icon_image/8036b56a-897e-44ec-a192-aa418b9df730_base_resized.jpg
			//   https://booth.pximg.net/users/30729/icon_image/8036b56a-897e-44ec-a192-aa418b9df730_base_resized.jpg
			//   https://booth.pximg.net/users/30729/icon_image/8036b56a-897e-44ec-a192-aa418b9df730.jpg
			// https://booth.pximg.net/c/300x300_a2_g5/c363684d-1871-4a28-bab5-361cc883ffb4/i/921726/52ebec3e-b6fb-489b-aa7e-c6b610e1a4a8_base_resized.jpg
			//   https://booth.pximg.net/c363684d-1871-4a28-bab5-361cc883ffb4/i/921726/52ebec3e-b6fb-489b-aa7e-c6b610e1a4a8_base_resized.jpg
			//   https://booth.pximg.net/c363684d-1871-4a28-bab5-361cc883ffb4/i/921726/52ebec3e-b6fb-489b-aa7e-c6b610e1a4a8.jpg -- 404
			// https://booth.pximg.net/c/300x300_a2_g5/0008efae-fa87-4871-84c3-d7ae38577fb0/i/963716/52fccf85-ab15-4585-a551-00d347553ccb_base_resized.jpg -- 300x300
			//   https://booth.pximg.net/0008efae-fa87-4871-84c3-d7ae38577fb0/i/963716/52fccf85-ab15-4585-a551-00d347553ccb.jpg -- 2000x3000
			// https://booth.pximg.net/c/150x150/3c32475d-0f04-4157-b5bb-6a56cd5d633f/i/178794/1174b9d1-9f8a-4525-88e8-77c7fc7cf858_base_resized.jpg -- works
			//   https://booth.pximg.net/3c32475d-0f04-4157-b5bb-6a56cd5d633f/i/178794/1174b9d1-9f8a-4525-88e8-77c7fc7cf858_base_resized.jpg -- works
			//   https://booth.pximg.net/3c32475d-0f04-4157-b5bb-6a56cd5d633f/i/178794/1174b9d1-9f8a-4525-88e8-77c7fc7cf858.jpg -- 404
			// https://booth.pximg.net/users/1974112/icon_image/4c012645-7cdf-4023-a26f-15b0434c4006_base_resized.jpg
			//   https://booth.pximg.net/users/1974112/icon_image/4c012645-7cdf-4023-a26f-15b0434c4006.jpeg
			// https://s2.booth.pm/bf6ae946-2384-473f-b9bc-3f72205b983e/i/1885913/124255bf-702b-4e62-9824-f1fe363716d8_base_resized.jpg
			//   https://s2.booth.pm/bf6ae946-2384-473f-b9bc-3f72205b983e/i/1885913/124255bf-702b-4e62-9824-f1fe363716d8.jpeg
			// thanks to fireattack on github for reporting this issue: https://github.com/qsniyg/maxurl/issues/33
			// https://booth.pximg.net/30cd84bf-4155-491d-abee-5770b2947e00/i/1236274/0df91fe3-7ce5-41ad-89f8-a6a52625e752_base_resized.jpg
			//   https://booth.pximg.net/30cd84bf-4155-491d-abee-5770b2947e00/i/1236274/0df91fe3-7ce5-41ad-89f8-a6a52625e752.png
			newsrc = src.replace(/(:\/\/[^/]*\/)c\/[0-9]+x[0-9]+(?:_[^/]*)?\//, "$1");
			if (newsrc !== src)
				return add_full_extensions(newsrc);

			newsrc = src.replace(/(\/[-0-9a-f]+)_[^/.]*(\.[^/.]*)$/, "$1$2");
			if (newsrc !== src)
				return add_full_extensions(newsrc);

			//return src
			//    .replace(/\/c\/[^/]*\//, "/")
			//    .replace(/(\/[^/.]*)_c_[0-9]+x[0-9]+(\.[^/.]*$)/, "$1$2");
		}

		if (domain === "downloads.fanbox.cc") {
			// thanks to Froktime on github:
			// https://downloads.fanbox.cc/images/post/7521021/w/1200/QLCWVrj9WHWkTPLLSOePGVQ8.jpeg
			//   https://downloads.fanbox.cc/images/post/7521021/QLCWVrj9WHWkTPLLSOePGVQ8.png
			let page = null;

			match = src.match(/\/images\/+post\/+([0-9]+)\/+/);
			if (match) {
				page = "https://a.fanbox.cc/posts/" + match[1];
			}

			obj = {
				url: src,
				extra: {page}
			};

			newsrc = src.replace(/(\/images\/+post\/+[0-9]+\/+)w\/+[0-9]+\/+/, "$1");
			if (newsrc !== src) {
				obj.url = newsrc;
				return fillobj_urls(add_extensions_with_jpeg(newsrc), obj);
			}

			return obj;
		}

		if (domain === "cache-graphicslib.viator.com") {
			// http://cache-graphicslib.viator.com/graphicslib/media/e0/mt-vesuvius-photo_987616-770tall.jpg
			//   http://cache-graphicslib.viator.com/graphicslib/media/e0/mt-vesuvius-photo_987616-raw.jpg
			// https://cache-graphicslib.viator.com/graphicslib/thumbs360x240/2958/SITours/naples-shore-excursion-mt-vesuvius-half-day-trip-from-naples-in-naples-45216.jpg
			//   https://cache-graphicslib.viator.com/graphicslib/thumbs674x446/2958/SITours/naples-shore-excursion-mt-vesuvius-half-day-trip-from-naples-in-naples-45216.jpg
			//   https://cache-graphicslib.viator.com/graphicslib/2958/SITours/naples-shore-excursion-mt-vesuvius-half-day-trip-from-naples-in-naples-45216.jpg -- smaller
			// https://cache-graphicslib.viator.com/graphicslib/mm/28/the-original-london-sightseeing-tour-hop-on-hop-off-156128-raw.jpg
			// https://cache-graphicslib.viator.com/graphicslib/mm/83/i-amsterdam-card-city-pass-for-amsterdam-155183-raw.jpg
			return {
				url: src.replace(/([-_][0-9]+)-[^-_/.]*(\.[^/.]*)$/, "$1-raw$2"),
				head_wrong_contentlength: true
			};
		}

		if (domain_nosub === "4sqi.net") {
			// https://igx.4sqi.net/img/general/200x200/14154508__KFDGWAVvjjTcK6pEKNuQER_10kmzcBR7eU3BWbYGG4.jpg
			//   https://igx.4sqi.net/img/general/original/14154508__KFDGWAVvjjTcK6pEKNuQER_10kmzcBR7eU3BWbYGG4.jpg
			// https://fastly.4sqi.net/img/general/200x200/12267819_ZAYNBPR7UX7mVSGBdJfRKEIjAbB3Rwq5WrvTENLVPhA.jpg
			//   https://fastly.4sqi.net/img/general/original/12267819_ZAYNBPR7UX7mVSGBdJfRKEIjAbB3Rwq5WrvTENLVPhA.jpg
			return src.replace(/\/img\/+general\/+[0-9]+x[0-9]+\//, "/img/general/original/");
		}

		if (domain === "static.panoramio.com" ||
			// http://commondatastorage.googleapis.com/static.panoramio.com/photos/small/43008410.jpg -- same as below
			//   http://commondatastorage.googleapis.com/static.panoramio.com/photos/original/43008410.jpg -- doesn't work, "Anonymous caller does not have storage.objects.get access to ..."
			// https://static.panoramio.com.storage.googleapis.com/photos/large/8327198.jpg
			//   https://static.panoramio.com.storage.googleapis.com/photos/original/8327198.jpg
			googlestorage_container === "static.panoramio.com") {
			//(domain === "commondatastorage.googleapis.com" && src.match(/:\/\/[^/]*\/static\.panoramio\.com\//))) {
			// http://static.panoramio.com/photos/small/6106783.jpg
			// http://static.panoramio.com/photos/large/6106783.jpg
			// http://static.panoramio.com/photos/original/6106783.jpg
			return src.replace(/\/photos\/[^/]*\//, "/photos/original/");
		}

		if (domain_nosub === "myportfolio.com" && domain.match(/.*cdn.*\.myportfolio\.com$/)) {
			// https://pro2-bar-s3-cdn-cf.myportfolio.com/4b7b32c34c99b966ad6f0ba84341a0df/8c698e4c5561ed288f2350a6_rw_3840.jpg?h=ec899b0e004e5d1cd5bcf474b259302d
			//   https://pro2-bar-s3-cdn-cf.myportfolio.com/4b7b32c34c99b966ad6f0ba84341a0df/8c698e4c5561ed288f2350a6.jpg
			//   https://pro2-bar.myportfolio.com/v1/assets/4b7b32c34c99b966ad6f0ba84341a0df/8c698e4c5561ed288f2350a6.jpg -- hash is required
			// https://pro2-bar-s3-cdn-cf2.myportfolio.com/fc87a328b5563b3948ee90b56bb47c80/df42aa71-c29a-4ccb-b40d-70e9f87872bf_car_202x158.jpg?h=8332ff2d4ba2a81d4cd8957d4a8f9d85
			//   https://pro2-bar-s3-cdn-cf2.myportfolio.com/fc87a328b5563b3948ee90b56bb47c80/df42aa71-c29a-4ccb-b40d-70e9f87872bf_car_202x158.jpg - still works
			//   https://pro2-bar.myportfolio.com/v1/assets/fc87a328b5563b3948ee90b56bb47c80/df42aa71-c29a-4ccb-b40d-70e9f87872bf_car_202x158.jpg -- hash is required
			//   https://pro2-bar-s3-cdn-cf2.myportfolio.com/fc87a328b5563b3948ee90b56bb47c80/df42aa71-c29a-4ccb-b40d-70e9f87872bf.jpg:
			//     https://pro2-bar.myportfolio.com/v1/assets/fc87a328b5563b3948ee90b56bb47c80/df42aa71-c29a-4ccb-b40d-70e9f87872bf.jpg -- hash is required
			// https://pro2-bar-s3-cdn-cf2.myportfolio.com/fc703cfcf746a4d9e06fa9a2d703067c/d454466e-51ca-4b6e-8714-04bcec8991e5_rw_1200.jpg
			//   https://pro2-bar-s3-cdn-cf2.myportfolio.com/fc703cfcf746a4d9e06fa9a2d703067c/d454466e-51ca-4b6e-8714-04bcec8991e5.jpg -- redirects to:
			//   https://pro2-bar.myportfolio.com/v1/assets/fc703cfcf746a4d9e06fa9a2d703067c/d454466e-51ca-4b6e-8714-04bcec8991e5.jpg -- hash is required
			// https://pro2-bar-s3-cdn-cf3.myportfolio.com/2c9d32f35ab4460a12de135330211ca6/e23e72ac-ffa4-4321-a768-0c876c007a57_rwc_0x0x600x798x600.jpg
			//   https://pro2-bar.myportfolio.com/v1/assets/2c9d32f35ab4460a12de135330211ca6/e23e72ac-ffa4-4321-a768-0c876c007a57.jpg -- hash is required
			return src.replace(/_(?:rw_[0-9]+|rwc_[0-9]+(?:x[0-9]+){4})(\.[^/.?]*)(?:\?.*)?$/, "$1");
		}

		if (domain === "i.dell.com") {
			// http://i.dell.com/das/xa.ashx/global-site-design%20web/00000000-0000-0000-0000-000000000000/1/LargePNG?id=Dell/Product_Images/Dell_Client_Products/Desktops/Inspiron_Desktops/Inspiron_3250_SFF/global_spi/desktop-inspiron-3250-small-form-factor-black-right-hero-504x350.psd
			//   http://i.dell.com/das/xa.ashx/global-site-design%20web/00000000-0000-0000-0000-000000000000/1/originalpng?id=Dell/Product_Images/Dell_Client_Products/Desktops/Inspiron_Desktops/Inspiron_3250_SFF/global_spi/desktop-inspiron-3250-small-form-factor-black-right-hero-504x350.psd
			// http://i.dell.com/sites/imagecontent/app-merchandizing/responsive/HomePage/en/PublishingImages/22437-home-desktop-inspiron-3650-silver-3656-red-150x120.png
			// http://i.dell.com/das/dih.ashx/189w/das/xa_____/global-site-design%20web/c09863ef-2675-4682-0704-6dc976226db3/1/originalpng?id=Dell/Product_Images/Dell_Client_Products/Desktops/Inspiron_Desktops/Inspiron_3250_SFF/global_spi/desktop-inspiron-3250-small-form-factor-black-left-bestof-500-ng.psd
			// http://si.cdn.dell.com/sites/imagecontent/consumer/merchandizing/en/publishingimages/24031-desktop-inspiron-3268-169x121.png
			return src.replace(/(\/(?:[0-9a-f]+-){4}[0-9a-f]+\/[0-9]+\/)LargePNG/, "$1originalpng");
		}

		if (domain === "thumb.zumst.com") {
			// http://thumb.zumst.com/530x0/http://static.news.zumst.com/images/23/2018/03/09/73abd6e986ec4160b1e9a8459532eed2.jpg
			//   http://static.news.zumst.com/images/23/2018/03/09/73abd6e986ec4160b1e9a8459532eed2.jpg
			// http://news.zum.com/articles/5254413
			//   http://static.news.zum.com/images/18/2013/01/18/20130118_1358493810.jpg - 2132x2845
			return src.replace(/.*:\/\/[^/]*\/[0-9]+[^/]*\//, "");
		}

		if (domain === "imgp.golos.io") {
			// https://imgp.golos.io/0x0/https://s26.postimg.org/hfb38d3e1/Dubai_Towers_1.jpg
			//   https://s26.postimg.org/hfb38d3e1/Dubai_Towers_1.jpg -- postimg.org is down though
			return src.replace(/^[a-z]+:\/\/[^/]*\/+[0-9]+x[0-9]+\/+(https?:)/, "$1");
		}

		if (domain === "images.underskog.no") {
			// thanks to kjetilho on github: https://github.com/qsniyg/maxurl/issues/384
			// https://images.underskog.no/620x100/https://underskog.no/image/get/972480
			//   https://images.underskog.no/620x/https://underskog.no/image/get/972480
			//   https://images.underskog.no/x100/https://underskog.no/image/get/972480
			//   https://images.underskog.no/x/https://underskog.no/image/get/972480
			//   https://underskog.no/image/get/972480
			return src.replace(/^[a-z]+:\/\/[^/]+\/+[0-9]*x[0-9]*\/+(https?:\/\/)/, "$1");
		}

		if ((domain_nosub === "zumst.com" ||
			 domain_nosub === "zum.com") &&
			domain.match(/^static\./)) {
			// http://static.hubzum.zumst.com/hubzum/2017/07/19/13/25ae58643b56453da421d17a4e42dbc5_780x0c.jpg
			//   http://static.hubzum.zumst.com/hubzum/2017/07/19/13/25ae58643b56453da421d17a4e42dbc5.jpg
			// http://static.news.zumst.com/images/thumb/18/2018/04/17/a9f0d24d1aa64b9f868a5743640e8de8.jpg
			//   http://static.news.zumst.com/images/18/2018/04/17/a9f0d24d1aa64b9f868a5743640e8de8.jpg
			// http://static.news.zumst.com/images/3/2018/12/23/PCM20181214003940005_P2.jpg
			// http://static.news.zumst.com/images/51/2014/01/02/716383_medium.jpg
			return src
				.replace(/\/images\/+thumb\/+/, "/images/")
				.replace(/\/([0-9a-f]+)_[0-9]+x[0-9]+[a-z]?(\.[^/.]*)(?:[?#].*)?$/, "/$1$2");
		}

		if (domain === "file.mk.co.kr" ||
			// http://celebs.mediapundit.net/emma-watson/Emma8.jpg.thumb
			//   http://celebs.mediapundit.net/emma-watson/Emma8.jpg
			domain_nosub === "mediapundit.net") {
			// http://file.mk.co.kr/meet/2018/03/image_listtop_2018_156502_1520579288.jpg.thumb
			//   http://file.mk.co.kr/meet/2018/03/image_listtop_2018_156502_1520579288.jpg - slightly larger
			//   http://file.mk.co.kr/meet/2018/03/image_readtop_2018_156502_1520578294.jpg
			newsrc = src.replace(/\.thumb(?:[?#].*)?$/, "");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "kobis.or.kr") {
			// http://kobis.or.kr/common/mast/movie/2016/04/thumb/thn_4ddde64e76f64663998f4123ae837fcc.jpg
			//   http://kobis.or.kr/common/mast/movie/2016/04/4ddde64e76f64663998f4123ae837fcc.jpg
			return src.replace(/\/thumb\/+thn_/, "/");
		}

		if (domain_nowww === "breaknews.com") {
			// http://www.breaknews.com/data/breaknews_com/mainimages/201803/2018020713038427.jpg
			//   http://www.breaknews.com/imgdata/breaknews_com/201802/2018020713038427.jpg
			// http://www.breaknews.com/sub_read.html?uid=488764&section=sc4
			//   http://www.breaknews.com/imgdata/breaknews_com/201701/2017012752287231.jpg - 2000x3159
			// http://breaknews.com/data/breaknews_com/mainimages/201803/2018030742107604.jpg
			// doesn't always work:
			// http://breaknews.com/data/breaknews_com/mainimages/201803/2018030742107604.jpg
			//   http://www.breaknews.com/imgdata/breaknews_com/201803/2018030742107604.jpg -- doesn't work
			//   http://www.breaknews.com/imgdata/breaknews_com/201803/2018030604302058.jpg -- works
			// http://breaknews.com/data/breaknews_com/mainimages/201803/2017090815222839.jpg
			//   http://breaknews.com/imgdata/breaknews_com/201709/2017090815222839.jpg -- works (not a problem with www.)
			return src.replace(/\/data\/([^/]*)\/mainimages\/[0-9]*\/([0-9]{6})/, "/imgdata/$1/$2/$2");
		}

		if (domain_nowww === "ilyo.co.kr" ||
			// https://beatsports.net/contents/article/images/2019/0626/thm300_1561478450595263.jpeg
			//   https://beatsports.net/contents/article/images/2019/0626/1561478450595263.jpeg
			domain_nowww === "beatsports.net" ||
			// http://www.ohfun.net/contents/article/images/2014/0925/thm200_1411630979197969.jpg
			//   http://www.ohfun.net/contents/article/images/2014/0925/1411630979197969.jpg
			domain_nowww === "ohfun.net") {
			// http://ilyo.co.kr/contents/article/images/2015/0306/thm200_1425610033458142.jpg
			//   http://ilyo.co.kr/contents/article/images/2015/0306/1425610033458142.jpg - 1788x2698
			return src.replace(/\/thm[0-9]+_/, "/");
		}

		if (domain_nowww === "joseilbo.com") {
			// http://www.joseilbo.com/gisa_img_origin/15090052681509005268_yumju423_origin.jpg - 5312x2988
			// http://www.joseilbo.com/gisa_img/1518397320.thumbnail.jpg
			//   http://www.joseilbo.com/gisa_img/1518397320.jpg
			// http://www.joseilbo.com/gisa_img/15199713541519971354_kiruki54.jpg
			//   http://www.joseilbo.com/gisa_img_origin/15199713541519971354_kiruki54_origin.jpg
			// http://www.joseilbo.com/xml/racing/image/6f1f52ac11d533a84f41705a5f09411f.thumbnail.jpg
			//   http://www.joseilbo.com/xml/racing/image/6f1f52ac11d533a84f41705a5f09411f.jpg
			return src
				.replace(/\.thumbnail(\.[^/.]*)$/, "$1")
				.replace(/\/gisa_img\/([0-9]+_[^/._]+)(\.[^/.]*)$/, "/gisa_img_origin/$1_origin$2");
		}

		if (false && (domain_nosub === "phncdn.com" ||
			domain_nosub === "pornhub.com")) {
			// doesn't work anymore
			// https://ci.phncdn.com/pics/albums/000/430/541/4503569/(m=eiJ_8b)(mh=EvXtHOjNcliZ7ja0)original_4503569.jpg
			//   https://ci.phncdn.com/pics/albums/000/430/541/4503569/original_4503569.jpg
			// https://ci.phncdn.com/m=e_rU8f/pics/pornstars/000/284/192/thumb_1068522.jpg
			//   https://ci.phncdn.com/pics/pornstars/000/284/192/thumb_1068522.jpg
			// apparently some do still work (thanks to nijaz-lab on github: https://github.com/qsniyg/maxurl/issues/552 )
			// https://ci.phncdn.com/videos/201805/19/166810662/original/(m=eaf8Ggaaaa)(mh=l7GhhRja7RgPmYte)1.jpg
			//   https://ci.phncdn.com/videos/201805/19/166810662/original/1.jpg
			newsrc = src.replace(/\/(?:\([a-z]+=[^/)]*\))*([^/]*)$/, "/$1");
			if (newsrc !== src) {
				obj = add_full_extensions(newsrc, ["mp4", "gif", "png", "jpg"], true);
				return obj;
			}

			newsrc = src.replace(/(:\/\/[^/]*\/+)[a-z]=[^/]*\/+/, "$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nosub === "phncdn.com") {
			match = src.match(/\/pics\/+albums\/+(?:[0-9]+\/+){3}([0-9]+)\/+/);
			if (match) {
				return {
					url: "https://www.pornhub.com/photo/" + match[1],
					is_pagelink: true
				};
			}
		}

		if (domain_nowww === "pornhub.com") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+photo\/+([0-9]+)(?:[?#].*)?$/,
				query_for_id: "https://www.pornhub.com/photo/${id}",
				process: function(done, resp, cache_key) {
					var imagesrc = get_meta(resp.responseText, "twitter:image:src"); //og:image is thumbnail
					if (!imagesrc) {
						console_error(cache_key, "Unable to find source image for", resp);
						return done(null, false);
					}

					var obj:BigImageInfoSObject = {
						url: imagesrc.replace(/:\/\/di\./, "://ci."), // normalize to avoid excessive redirects
						extra: {
							page: resp.finalUrl
						}
					};

					var caption = get_meta(resp.responseText, "twitter:title");
					if (caption) {
						obj.extra.caption = caption
					}

					return done(obj, 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nosub === "pornhub.com") {
			match = src.match(/^[a-z]+:\/\/[^/]+\/+(?:view_video\.php\?(?:.*&)?viewkey=|embed\/+)([^&]+).*$/);
			if (!match) {
				match = src.match(/^[a-z]+:\/\/[^/]+\/+embed\/+([^?&#]+)(?:[?#].*)?$/);
			}
			if (match) {
				id = match[1];

				var get_pornhub_videodata = function(key, cb) {
					var cache_key = "pornhub_video:" + key;
					api_cache.fetch(cache_key, cb, function(done) {
						options.do_request({
							url: "https://www.pornhub.com/view_video.php?viewkey=" + key,
							method: "GET",
							onload: function(resp) {
								if (resp.readyState !== 4) {
									return;
								}

								if (resp.status !== 200) {
									console_error(resp);
									return done(null, false);
								}

								var match = resp.responseText.match(/<script[^>]*>\s*var (flashvars_[0-9]+) = ({.*});\s*var player_mp4_seek\s*=\s*\S+;(?:\s*\/\/.*)?\s*(var ra[0-9a-z]{10,}\s*=.*;)?/);
								if (!match) {
									console_error("Unable to find flashvars match", resp);
									return done(null, false);
								}

								var vartable = {};

								try {
									vartable[match[1]] = JSON_parse(match[2]);
								} catch (e) {
									console_error(e, resp);
									return done(null, false);
								}

								var main_name = match[1];
								var obfuscated = match[3];
								if (!obfuscated) {
									return done(vartable[main_name], 3*60*60);
								}

								var tokens = [];
								var current_token = "";
								var in_comment = false;
								var escaping = false;
								var in_string = false;

								var commit_token = function() {
									if (current_token.length > 0) {
										tokens.push(current_token);
										current_token = "";
									}
								};

								for (var i = 0; i < obfuscated.length; i++) {
									var c = obfuscated[i];

									if (in_comment) {
										if (c === "/" && obfuscated[i - 1] === "*") {
											in_comment = false;
											continue;
										} else {
											continue;
										}
									}

									if (escaping) {
										current_token += c;
										escaping = false;
										continue;
									}

									if (in_string) {
										current_token += c;

										if (c === in_string) {
											in_string = false;
											commit_token();
										}

										continue;
									}

									if (/\s/.test(c)) {
										commit_token();
										continue;
									}

									if (/["']/.test(c)) {
										commit_token();

										current_token += c;
										in_string = c;
										continue;
									}

									if (/[\[\]=;+:,{}]/.test(c)) {
										commit_token();

										current_token = c;
										commit_token();
										continue;
									}

									if (c === "\\") {
										escaping = true;
										continue;
									}

									if (c === "/" && obfuscated[i + 1] === "*") {
										in_comment = true;
										i++;
										continue;
									}

									current_token += c;
								}

								var eval_varvalue = function(varvalue) {
									var newvalues = [];

									for (var i = 0; i < varvalue.length; i++) {
										var currentvalue = varvalue[i];

										currentvalue = currentvalue.replace(/^'(.*)'$/, '"$1"'); // TODO: handle "

										if (currentvalue === "+")
											continue;

										if (varvalue[i] in vartable) {
											currentvalue = vartable[varvalue[i]];

											var currentname = null;
											var startbracket = -1;
											var had_startbracket = false;
											for (; (i + 1) < varvalue.length; i++) {
												if (varvalue[i] === "[") {
													startbracket = i;
													had_startbracket = true;
													continue;
												} else if (!had_startbracket) {
													break;
												}

												if (varvalue[i] === "]") {
													had_startbracket = false;

													currentname = varvalue.slice(startbracket + 1, i);
													currentvalue = currentvalue[eval_varvalue(currentname)];
													continue;
												}
											}

											currentvalue = JSON_stringify(currentvalue);
										}

										if (i > 1 && varvalue[i-1] === "+") {
											var lastvalue = JSON_parse(newvalues[newvalues.length-1]);
											newvalues[newvalues.length-1] = JSON_stringify(lastvalue + JSON_parse(currentvalue));
										} else {
											newvalues.push(currentvalue);
										}
									}

									return JSON_parse(newvalues.join(" "));
								};

								for (var i = 0; i < tokens.length; i++) {
									var token = tokens[i];
									if (token === "var") {
										var varname = tokens[i + 1];
										i += 3; // =
										var begin = i;
										for (; i < tokens.length; i++) {
											if (tokens[i] === ";")
												break;
										}

										var varvalue = tokens.slice(begin, i);
										vartable[varname] = eval_varvalue(varvalue);
									} else if (token in vartable) {
										// TODO: refactor this and eval_varvalue
										var parent_table = vartable;
										var currentname = token;
										var startbracket = -1;
										var had_startbracket = false;

										i++;
										for (; (i + 1) < tokens.length; i++) {
											if (tokens[i] === "[") {
												startbracket = i;
												had_startbracket = true;
												continue;
											} else if (!had_startbracket) {
												break;
											}

											if (tokens[i] === "]") {
												had_startbracket = false;

												parent_table = parent_table[currentname];
												currentname = tokens.slice(startbracket + 1, i);
												currentname = eval_varvalue(currentname);
												continue;
											}
										}

										i++; // =

										var begin = i;
										for (; i < tokens.length; i++) {
											if (tokens[i] === ";")
												break;
										}

										var varvalue = tokens.slice(begin, i);
										parent_table[currentname] = eval_varvalue(varvalue);
									}
								}

								done(vartable[main_name], 3*60*60);
							}
						});
					});
				};

				var get_pornhub_obj = function(data, cb) {
					//console_log(data);
					var obj:BigImageInfoSObject = {
						url: null,
						headers: {
							Accept: "*/*",
							Origin: "https://www.pornhub.com",
							Referer: "https://www.pornhub.com/",
							"sec-fetch-dest": "empty",
							"sec-fetch-mode": "cors",
							"sec-fetch-site": "cross-site"
						},
						extra: {}
					};

					if (data.link_url) {
						obj.extra.page = data.link_url;
					}

					if (data.video_title) {
						obj.extra.caption = data.video_title;
					}

					if (!data.mediaDefinitions) {
						return cb(obj);
					}

					var process_mediadef = function(def) {
						if (typeof def.quality === "string")
							def.quality = parseInt(def.quality);

						if (typeof def.quality === "number")
							def.quality = [def.quality];
					};

					var mediadefs = [];
					var fetchurls = [];
					array_foreach(data.mediaDefinitions, function(def) {
						process_mediadef(def);
						if (!is_array(def.quality) || !def.quality.length) {
							if (def.remote && def.videoUrl) {
								fetchurls.push(def.videoUrl);
							} else {
								console_warn("Unable to find quality for", def, "in", data);
							}

							return;
						}

						mediadefs.push(def);
					});

					var get_largest_quality = function(x) {
						return x.sort().reverse()[0];
					};

					var final = function() {
						mediadefs.sort(function(a, b) {
							var a_quality = get_largest_quality(a.quality);
							var b_quality = get_largest_quality(b.quality);

							if (!a_quality || !b_quality) return 0;

							var diff = b_quality - a_quality;
							if (diff) return diff;

							return b.quality.length - a.quality.length;
						});

						//console_log(mediadefs);

						var urls = [];
						array_foreach(mediadefs, function(def) {
							var video:VideoProp = true;
							if (def.format === "hls") {
								video = "hls";
							}

							if (!def.videoUrl) {
								// for >1080p when not logged in
								return;
							}

							urls.push({
								url: def.videoUrl,
								video: video,
								is_private: true // linked to ip
							});
						});

						if (data.image_url) urls.push(data.image_url);

						return cb(fillobj_urls(urls, obj));
					};

					var waiting = false;

					var finished = 0;
					array_foreach(fetchurls, function(url) {
						api_query("pornhub_url: " + url, {
							url: url,
							imu_mode: "ajax",
							headers: {
								Referer: "https://www.pornhub.com/"
							},
							json: true
						}, function(data) {
							if (data)
								array_extend(mediadefs, data);

							finished++;
							if (finished >= fetchurls.length)
								final();
						}, function(done, resp, cache_key) {
							if (!is_array(resp) || !resp.length) {
								console_error(cache_key, "Invalid response", resp);
								return done(null, false);
							}

							array_foreach(resp, process_mediadef);

							return done(resp);
						});

						waiting = true;
					});

					if (!waiting)
						final();
				};

				page_nullobj = {
					url: src,
					is_pagelink: true
				};

				if (options.do_request && options.cb) {
					get_pornhub_videodata(id, function(data) {
						//console_log(data);

						if (!data) {
							return options.cb(page_nullobj);
						}

						get_pornhub_obj(data, function(obj) {
							//console_log(obj);
							if (!obj) return options.cb(page_nullobj);

							obj.push(page_nullobj);
							return options.cb(obj);
						});

					});

					return {
						waiting: true
					};
				} else {
					return page_nullobj;
				}
			}
		}

		if (host_domain_nosub === "pornhub.com" && options.element) {
			newsrc = common_functions["get_pagelink_host_el_matching"](options, {
				url_match: /^[a-z]+:\/\/[^/]+\/+view_video\.php\?(.*&)?viewkey=/,
				el_match: function(x) {
					return x.tagName.toLowerCase() === "video-element" && x.hasAttribute("unique-id");
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "pornkai.com") {
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+view\?(?:.*&)?key=(ph[0-9a-z]+)(?:&.*)?$/, "https://pornhub.com/view_video.php?viewkey=$1");
			if (newsrc !== src) {
				return {
					url: newsrc,
					is_pagelink: true
				};
			}
		}

		if (host_domain_nowww === "youporn.com") {
			newsrc = common_functions["get_pagelink_host_el_matching"](options, {
				url_match: /^[a-z]+:\/\/[^/]+\/+(?:watch|embed)\/+([0-9]+)(?:\/+(?:[^/]+\/*)?)?(?:[?#].*)?$/,
				el_match: function(x) {
					return x.tagName === "DIV" && x.id === "videoContainer"
				}
			});
			if (newsrc && newsrc.url !== src) return newsrc;
		}

		if (domain_nosub === "t8cdn.com" ||
			// https://di1.ypncdn.com/201905/07/15322879/original/3/mixed-wrestling-with-mia-little-using-a-strapon-after-winning-3(m=eqvVKgaaaa).jpg
			//   https://di1.ypncdn.com/201905/07/15322879/original/3/mixed-wrestling-with-mia-little-using-a-strapon-after-winning-3.jpg
			domain_nosub === "ypncdn.com") {
			// https://ei1.t8cdn.com/201707/10/37854111/190x143/1(m=eqw4mgaaaa).jpg
			//   https://ei1.t8cdn.com/201707/10/37854111/originals/1(m=eqw4mgaaaa).jpg
			//   https://ei1.t8cdn.com/201707/10/37854111/originals/1.jpg
			newsrc = src
				.replace(/\/[0-9]+x[0-9]+\/+([0-9]+)(?:[(][a-z]+=[^/)]*\)){1,}([^/]*)$/, "/originals/$1$2")
				.replace(/(\/originals?\/+[0-9]+(?:\/+[^/]*?)?)(?:[(][a-z]+=[^/)]*\)){1,}([^/]*)$/, "$1$2");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nosub === "rdtcdn.com" && /^[a-z]i\./.test(domain)) {
			// https://ei.rdtcdn.com/m=eVYR8f/_thumbs/gallery/000/005/150/i_15005151_423291_5150301_/Sexy-Big-Booty-Black-Girls-Ebony-Babes-with-Thick-Thighs-And-Fat-Asses-9922564.jpg
			//   https://ei.rdtcdn.com/m=eVYR8f/_thumbs/gallery/000/005/150/i_15005151_423291_5150301_9922564.jpg
			//   https://ei.rdtcdn.com/m=/_thumbs/gallery/000/005/150/i_15005151_423291_5150301_9922564.jpg
			// https://di.rdtcdn.com/m=eVYR8f/_thumbs/gallery/000/005/150/i_15005151_423291_5150281_/Sexy-Big-Booty-Black-Girls-Ebony-Babes-with-Thick-Thighs-And-Fat-Asses-1726828.jpg
			//   https://di.rdtcdn.com/m=/_thumbs/gallery/000/005/150/i_15005151_423291_5150281_1726828.jpg
			// https://ei.rdtcdn.com/m=bI4vELVg5p/_thumbs/gallery/000/002/489/i_1768726_132293_2489986_/Selena-enjoying-pump-dildo-143875.webp
			//   https://ei.rdtcdn.com/m=/_thumbs/gallery/000/002/489/i_1768726_132293_2489986_143875.jpg
			newsrc = src
				.replace(/\.webp(?:[?#].*)?$/, ".jpg")
				.replace(/\/m=[^/]*\/+_thumbs\/+/, "/m=/_thumbs/")
				.replace(/\/m=[^/]*\/+(_thumbs\/+gallery\/.*_[0-9]+_)\/+[^/]+-([0-9]+\.[^/.]+)(?:[?#].*)?$/, "/m=/$1$2");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nosub === "rdtcdn.com" ||
			domain_nowww === "redtube.com" ||
			domain_nowww === "redtube.com.br" ||
			domain === "embed.redtube.com") {
			page_nullobj = null;
			var get_redtube_id_from_url = function(url) {
				var match = url.match(/:\/\/[^/]+\/+(?:m=[^/]+\/+)?media\/+videos\/+[0-9]{6}\/+[0-9]{2}\/+([0-9]+)\/+/);
				if (match) {
					return match[1];
				}

				match = url.match(/:\/\/embed\.[^/]+\/+\?(?:.*&)?id=([0-9]+)/);
				if (!match) {
					match = url.match(/:\/\/(?:www\.)redtube\.com\/+([0-9]+)(?:[?#].*)?$/);
				}
				if (match) {
					page_nullobj = {
						url: url,
						is_pagelink: true
					};

					return match[1];
				}

				return null;
			};

			var query_redtube = function(id, cb) {
				var cache_key = "redtube:" + id;
				api_cache.fetch(cache_key, cb, function(done) {
					options.do_request({
						url: "https://www.redtube.com/" + id,
						method: "GET",
						onload: function(resp) {
							if (resp.status !== 200) {
								console_error(cache_key, resp);
								return done(null, false);
							}

							var match = resp.responseText.match(/page_params\.video_player_setup[\s\S]+playervars:\s*({.*}),/);
							if (!match) {
								console_error(cache_key, "Unable to find match for", resp);
								return done(null, false);
							}

							try {
								var json = JSON_parse(match[1])
								return done(json, 60*60);
							} catch (e) {
								console_error(cache_key, e);
							}

							return done(null, false);
						}
					});
				});
			};

			var get_obj_from_redtube_info = function(data) {
				var baseobj = {
					extra: {
						page: data.link_url,
						caption: data.video_title
					}
				};

				data.mediaDefinitions.sort((a, b) => {
					return b.height - a.height;
				});

				let urls = [];

				for (let md of data.mediaDefinitions) {
					continue; // FIXME: md.videoUrl returns a json
					urls.push({
						url: urljoin("https://www.redtube.com/", md.videoUrl, true),
						video: md.format === "hls" ? "hls" : true,
						//height: md.height,
						headers: {
							Referer: baseobj.extra.page,
							//Origin: "https://redtube.com"
							"Sec-Fetch-Dest": "empty",
							"Sec-Fetch-Mode": "cors",
							"Sec-Fetch-Site": "same-origin"
						}
					})
				}

				urls.push(data.image_url);

				return fillobj_urls(urls, baseobj);
			};

			id = get_redtube_id_from_url(src);
			if (id) {
				obj = {
					url: src,
					extra: {
						page: "https://www.redtube.com/" + id
					}
				};

				if (page_nullobj)
					obj.is_pagelink = true;

				if (options.do_request && options.cb) {
					query_redtube(id, function(data) {
						if (!data) {
							return options.cb(obj);
						}

						var newobj = get_obj_from_redtube_info(data);
						if (!is_array(newobj))
							newobj = [newobj as BigImageInfoSObject];

						newobj.push(obj);
						return options.cb(newobj);
					});

					return {
						waiting: true
					};
				}

				return obj;
			}
		}

		if (domain_nowww === "tube8.com") {
			var fetch_tube8_flashvars = function(id, cb) {
				api_query("tube8_flashvars:" + id, {
					url: "https://www.tube8.com/a/a/" + id + "/"
				}, cb, function(done, resp, cache_key) {
					var match = resp.responseText.match(/var\s+flashvars\s*=\s*({.*?})\s*; *\n/);
					if (!match) {
						console_error(cache_key, "Unable to find match", resp);
						return done(null, false);
					}

					try {
						var json = JSON_parse(match[1]);
						done(json, 6*60*60);
					} catch (e) {
						console_error(cache_key, e);
						return done(null, false);
					}
				});
			};

			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+[^/]+\/+[^/]+\/+([0-9]+)\/*(?:[?#].*)?$/,
				run: function(cb, match) {
					var id = match[1];

					fetch_tube8_flashvars(id, function(data) {
						var origsrc = src;
						if (options._internal_info && options._internal_info.mediadefinition_src) {
							origsrc = options._internal_info.mediadefinition_src;
						}

						common_functions["parse_mediadefinition"](api_cache, options, origsrc, data, cache_key, cb);
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "youporn.com") {
			var fetch_youporn_flashvars = function(id, cb) {
				api_query("youporn_flashvars:" + id, {
					url: "https://www.youporn.com/watch/" + id + "/"
				}, cb, function(done, resp, cache_key) {
					var match = resp.responseText.match(/(?:page_params.video.mediaDefinition\s*=|\s+mediaDefinition:)\s*(\[{.*?}\])\s*[;,] *\n/);
					if (!match) {
						console_error(cache_key, "Unable to find match", resp);
						return done(null, false);
					}

					try {
						var mediaDefinition = JSON_parse(match[1]);
						var json = {
							link_url: resp.finalUrl,
							mediaDefinition: mediaDefinition
						};
						done(json, 6*60*60);
					} catch (e) {
						console_error(cache_key, e);
						return done(null, false);
					}
				});
			};

			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+(?:watch|embed)\/+([0-9]+)(?:\/+(?:[^/]+\/*)?)?(?:[?#].*)?$/,
				run: function(cb, match) {
					var id = match[1];

					fetch_youporn_flashvars(id, function(data) {
						var origsrc = src;
						if (options._internal_info && options._internal_info.mediadefinition_src) {
							origsrc = options._internal_info.mediadefinition_src;
						}

						common_functions["parse_mediadefinition"](api_cache, options, origsrc, data, cache_key, cb);
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "xtube.com") {
			var fetch_xtube_flashvars = function(id, cb) {
				api_query("xtube_flashvars:" + id, {
					url: "https://www.xtube.com/video-watch/a-" + id
				}, cb, function(done, resp, cache_key) {
					var match = resp.responseText.match(/var playerConf\s*=\s*({.*?}),\s*loaderConf/);
					if (!match) {
						console_error(cache_key, "Unable to find match", resp);
						return done(null, false);
					}

					try {
						var match1 = match[1].replace(/![01]/g, "\"true\"");
						var fixup = fixup_js_obj_proper(match1);
						var playerconf = JSON_parse(fixup);
						var json = playerconf.mainRoll;
						json.link_url = json.videoUrl;
						json.video_title = json.title;
						done(json, 6*60*60);
					} catch (e) {
						console_error(cache_key, e, match);
						return done(null, false);
					}
				});
			};

			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+video-watch\/+[^/]+-([0-9]+)\/*(?:[?#].*)?$/,
				run: function(cb, match) {
					var id = match[1];

					fetch_xtube_flashvars(id, function(data) {
						var origsrc = src;
						if (options._internal_info && options._internal_info.mediadefinition_src) {
							origsrc = options._internal_info.mediadefinition_src;
						}

						common_functions["parse_mediadefinition"](api_cache, options, origsrc, data, cache_key, cb);
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nosub === "xtube.com" && /^cdn[0-9]*-/.test(domain)) {
			// https://cdn7-s-hw-e5.xtube.com/m=eoeM8f/videos/202006/19/44281942/xtube_original/1.jpg
			// paid: // https://cdn10-s-hw-e5.xtube.com/m=e6AaKyFb/videos/202003/27/43379161/xtube_original/12.jpg
			// doesn't work for all:
			// https://cdn7-s-hw-e5.xtube.com/m=eoeM8f/video_thumb/2009/20090220pm/5626SBd5OTF_0000.jpg
			//   https://www.xtube.com/video-watch/video-sexperts-interracial-807230
			// https://cdn2-s-ha-e5.xtube.com/m=eSuQ8f/videos/201804/27/PsexV-S836-/original/1.jpg
			//   https://www.xtube.com/video-watch/cute-nerdy-ukrainian-camslut-550cams-com-35002521
			match = src.match(/^[a-z]+:\/\/[^/]+\/+m=[^/]+\/+videos\/+[0-9]{6}\/+[0-9]{1,2}\/+([0-9]+)\/+/);
			if (match) {
				id = match[1];

				options._internal_info.mediadefinition_src = src;

				return {
					url: "https://www.xtube.com/video-watch/a-" + id,
					is_pagelink: true
				};
			}
		}

		if (domain_nosub === "t8cdn.com" || domain_nosub === "ypncdn.com") {
			// https://ep.t8cdn.com/201305/26/11984001/vl_mp4_ultra_480p_11984001.mp4
			// https://ev-ph.ypncdn.com/videos/201911/26/264376432/240P_400K_264376432.mp4 -- video ID doesn't work
			// https://ev.ypncdn.com/202001/19/15807000/240p_240k_15807000/YouPorn_-_swim-sexy-suit-on-the-beach-hot-bikini.mp4
			// thumbnail
			// https://ei2.t8cdn.com/201201/17/2640011/190x143/1.jpg
			//   https://ep.t8cdn.com/201201/17/2640011/vl_mp4_ultra_480p_2640011.mp4
			id = src.match(/:\/\/[^/]+\/+[0-9]{6}\/+[0-9]{1,2}\/+([0-9]+)\/+(?:vl_|[0-9]+[pP]_[0-9]+[kK]_|(?:[0-9]+x[0-9]+|originals?)\/+(?:[0-9]+\/+[^/]+-[0-9]+|[0-9]+(?:[(][a-z]+=[^/)]*\)){0,})\.)/);
			if (id) {
				id = id[1];

				options._internal_info.mediadefinition_src = src;

				if (domain_nosub === "t8cdn.com") {
					return {
						url: "https://www.tube8.com/a/a/" + id + "/",
						is_pagelink: true
					};
				} else if (domain_nosub === "ypncdn.com") {
					return {
						url: "https://www.youporn.com/watch/" + id + "/",
						is_pagelink: true
					};
				}
			}
		}

		if (domain === "cci.xnxx.fan") {
			// https://cci.xnxx.fan/softbinarygoforward/eDIwMTcwNw==/eDA1/eDEyMzE0NjQyMQ==/original/(m=eafTGgaaaa)(mh=hW68exBtqiBaRXjF)16.jpg
			//   https://cci.xnxx.fan/softbinarygoforward/eDIwMTcwNw==/eDA1/eDEyMzE0NjQyMQ==/original/16.jpg
			return src.replace(/(\/original\/)(?:\([a-z]+=[^/)]*\))*([^/]*)$/, "$1$2");
		}

		if (domain === "img.fril.jp") {
			// https://img.fril.jp/img/102398107/s/288867076.jpg?1506827930
			// l, m, s
			return src.replace(/\/[a-z]\/([^/]*)$/, "/l/$1");
		}

		if (domain === "img.cinematoday.jp") {
			// https://img.cinematoday.jp/a/E0000548/_size_c640x/_v_1337344420/18.JPG
			//   https://img.cinematoday.jp/a/E0000548/_v_1337344420/18.JPG -- 640x480
			//   https://img.cinematoday.jp/a/E0000548/_size_rx9999/_v_1337344420/18.JPG -- 1825x1369
			// https://img.cinematoday.jp/res/GA/2015/0725_05/v1437812942/DSC_0027-cx.JPG
			//   https://img.cinematoday.jp/res/GA/2015/0725_05/v1437812942/DSC_0027.JPG
			// http://img.cinematoday.jp/res/GA/2014/0712_02/v1405139653/IMG_2930-x.JPG
			// https://img.cinematoday.jp/a/E0010088/_size_1200x/_v_1473853900/19.jpg
			//   https://img.cinematoday.jp/a/E0010088/_v_1473853900/19.jpg -- 640x426
			//   https://img.cinematoday.jp/a/E0010088/_size_rx9999/_v_1473853900/19.jpg -- 3000x1998
			// https://img.cinematoday.jp/res/GA/2015/1028_08/v1446033979/07-0x0.JPG
			//   https://img.cinematoday.jp/res/GA/2015/1028_08/v1446033979/07.JPG
			// http://s.cinematoday.jp/res/N0/04/86/v1355451846/N0048658_l.jpg
			//   http://s.cinematoday.jp/res/N0/04/86/v1355451846/N0048658.jpg -- smaller
			//   https://img.cinematoday.jp/res/N0/04/86/v1355451846/N0048658.jpg -- same
			// https://img.cinematoday.jp/res/GA/2016/0624_01/v1466737624/IMG_1177-560x600.JPG
			// https://img.cinematoday.jp/a/A0005070/_size_/_v_1469826000/11.jpg
			// https://img.cinematoday.jp/a/E0011605/_size_c640x/_v_1499569440/02.jpg
			// thanks to fireattack on discord:
			// https://img.cinematoday.jp/a/nr46TDdZuLHI/_size_640x/_v_1672306835/2.jpg
			//   https://img.cinematoday.jp/a/nr46TDdZuLHI/_size_rx9999/_v_1672306835/2.jpg -- 2000x1330
			newsrc = src
				.replace(/-[a-z0-9]*x[a-z0-9]*(\.[^/.]*)$/, "$1")
				.replace(/\/_size_[^/]*\//, "/_size_rx9999/");
			return {
				url: newsrc,
				head_wrong_contentlength: true
			}
		}

		if (domain_nosub === "seesaa.net" ||
			// http://fanblogs.jp/yokozuna0079/file/E38182E38280E3828D-thumbnail2.jpg
			//   http://fanblogs.jp/yokozuna0079/file/E38182E38280E3828D.jpg
			(domain_nowww === "fanblogs.jp" && string_indexof(src, "/file/") >= 0)) {
			// http://flamant.up.seesaa.net/image/1981AAA9-2780-4445-8DF7-C72FA57A6738-thumbnail2.jpg
			//   http://flamant.up.seesaa.net/image/1981AAA9-2780-4445-8DF7-C72FA57A6738.jpg
			return src.replace(/-thumbnail[0-9]*(\.[^/.]*)(?:[?#].*)?$/, "$1");
		}

		if (false && domain_nosub === "biglobe.ne.jp") {
			// wip
			// https://news.biglobe.ne.jp/entertainment/1227/5332001629/nrn_2016-12-27-050012_thum630.jpg
			// https://news.biglobe.ne.jp/animal/0309/8840287090/pec_301481_thum500.png
			// removing thum[0-9]* makes it smaller
		}

		if (domain_nosub === "ledevoir.com" && domain.match(/media[0-9]*\.ledevoir\.com/)) {
			// http://media2.ledevoir.com/images_galerie/nwl_602637_453756/image.jpg
			//   http://media2.ledevoir.com/images_galerie/nwdp_602637_453756/image.jpg
			// http://media1.ledevoir.com/images_galerie/nwlb_602533_453783/image.jpg
			//   http://media1.ledevoir.com/images_galerie/nwdp_602533_453783/image.jpg
			// http://media2.ledevoir.com/images_galerie/1_453723/le-coup-de-crayon-du-10-mars.jpg
			//   http://media2.ledevoir.com/images_galerie/nwdp_1_453723/le-coup-de-crayon-du-10-mars.jpg
			// http://media1.ledevoir.com/images_galerie/app_1_452365/le-coup-de-crayon-du-7-mars.jpg
			//   http://media1.ledevoir.com/images_galerie/nwdp_1_452365/le-coup-de-crayon-du-7-mars.jpg
			return src.replace(/\/images_galerie\/(?:[^-/._]*_)?([0-9]+_[0-9]+)\//, "/images_galerie/nwdp_$1/");
		}

		if (domain_nowww === "infotel.ca") {
			// https://infotel.ca/news/medialibrary/image/hl-mediaitemid50826-1365.jpg
			//   https://infotel.ca/news/medialibrary/image/hd-mediaitemid50826-1365.jpg
			//   https://infotel.ca/news/medialibrary/image/orig-mediaitemid50826-1365.jpg
			return src.replace(/\/medialibrary\/image\/[^-_/.]*-/, "/medialibrary/image/orig-");
		}

		if ((domain_nowww === "eleconomista.com.mx" && string_indexof(src, "/img/") >= 0) ||
			// https://www.informador.mx/__export/1531502739399/sites/elinformador/img/2018/07/13/iceberg_en_groenlandia_efe_k__petersen_crop1531502120593.jpg_195882809.jpg
			//   https://www.informador.mx/__export/1531502739399/sites/elinformador/img/2018/07/13/iceberg_en_groenlandia_efe_k__petersen_crop1531502120593.jpg
			(domain_nowww === "informador.mx" && string_indexof(src, "/img/") >= 0) ||
			// https://www.eldeber.com.bo/__export/1531611838470/sites/eldeber/img/2018/07/14/_102530719_mediaitem102524830.jpg_1739845681.jpg
			//   https://www.eldeber.com.bo/__export/1531611838470/sites/eldeber/img/2018/07/14/_102530719_mediaitem102524830.jpg
			(domain_nowww === "eldeber.com.bo" && string_indexof(src, "/img/") >= 0) ||
			// https://www.chispa.tv/__export/1531501223040/sites/debate/img/2018/07/13/el-iceberg-puede-generar-un_0_64_1259_784.jpg_497593902.jpg
			//   https://www.chispa.tv/__export/1531501223040/sites/debate/img/2018/07/13/el-iceberg-puede-generar-un_0_64_1259_784.jpg
			(domain_nowww === "chispa.tv" && string_indexof(src, "/img/") >= 0) ||
			// https://www.debate.com.mx/export/sites/debate/img/2016/12/02/rr.jpg_854719774.jpg -- stretched?
			//   https://www.debate.com.mx/export/sites/debate/img/2016/12/02/rr.jpg
			// https://www.debate.com.mx/__export/1520548870968/sites/debate/img/2018/03/08/ramal_1_crop1520548767730.jpg_1425355029.jpg
			//   https://www.debate.com.mx/__export/1520548870968/sites/debate/img/2018/03/08/ramal_1_crop1520548767730.jpg
			(domain_nowww === "debate.com.mx" && string_indexof(src, "/img/") >= 0) ||
			// https://www.diarioshow.com/export/sites/cronica/img/2018/05/19/asia_argento.jpg_515674892.jpg
			//   https://www.diarioshow.com/export/sites/cronica/img/2018/05/19/asia_argento.jpg
			(domain_nowww === "diarioshow.com" && string_indexof(src, "/img/") >= 0) ||
			// https://wp.eldeber.com.bo/__export/1523667548231/sites/eldeber/img/2018/04/13/poster-tour-eiffel-jour-nuit.jpg_1775534641.jpg
			//   https://wp.eldeber.com.bo/__export/1523667548231/sites/eldeber/img/2018/04/13/poster-tour-eiffel-jour-nuit.jpg
			(domain === "wp.eldeber.com.bo" && string_indexof(src, "/img/") >= 0) ||
			// https://www.tribuna.com.mx/export/sites/tribuna/img/2018/08/06/3_1.jpg_498273042.jpg
			//  https://www.tribuna.com.mx/export/sites/tribuna/img/2018/08/06/3_1.jpg
			(domain_nowww === "tribuna.com.mx" && string_indexof(src, "/img/") >= 0) ||
			// https://www.nacionrex.com/__export/1545682445821/sites/debate/img/2018/12/24/blackpink_mean_girls_crop1545682445483.jpg_1834093470.jpg -- stretched
			//   https://www.nacionrex.com/__export/1545682445821/sites/debate/img/2018/12/24/blackpink_mean_girls_crop1545682445483.jpg
			(domain_nowww === "nacionrex.com" && string_indexof(src, "/img/") >= 0) ||
			// https://www.enpareja.com/__export/1462924202952/sites/debate/img/2016/05/10/selena2.jpg_554688468.jpg -- upscaled
			//   https://www.enpareja.com/__export/1462924202952/sites/debate/img/2016/05/10/selena2.jpg
			(domain_nowww === "enpareja.com" && string_indexof(src, "/img/") >= 0) ||
			// https://www.filo.news/export/sites/claro/malditosnerds/img/2019/03/11/1562376487-image.png_1514431338.png
			//   https://www.filo.news/export/sites/claro/malditosnerds/img/2019/03/11/1562376487-image.png
			(domain_nowww === "filo.news" && string_indexof(src, "/img/") >= 0) ||
			// https://laverdadnoticias.com/__export/1514576574761/sites/laverdad/img/2017/12/29/camila_cabello.jpg_2024461655.jpg
			//   https://laverdadnoticias.com/__export/1514576574761/sites/laverdad/img/2017/12/29/camila_cabello.jpg
			(domain_nowww === "laverdadnoticias.com" && string_indexof(src, "/img/") >= 0) ||
			// https://www.rosario3.com/export/sites/rosario3/img/2018/05/08/met_4.jpg_753198914.jpg
			//   https://www.rosario3.com/export/sites/rosario3/img/2018/05/08/met_4.jpg
			(domain_nowww === "rosario3.com" && string_indexof(src, "/img/") >= 0) ||
			// https://www.soycarmin.com/export/sites/debate/img/celebs/2015/07/22/sel3.jpg_128859593.jpg
			//   https://www.soycarmin.com/export/sites/debate/img/celebs/2015/07/22/sel3.jpg
			(domain_nowww === "soycarmin.com" && string_indexof(src, "/img/") >= 0) ||
			// https://www.am.com.mx/__export/1557176283396/sites/am/img/2019/05/06/socavon-se-traga-excavadora.jpg_524172160.jpg
			//   https://www.am.com.mx/__export/1557176283396/sites/am/img/2019/05/06/socavon-se-traga-excavadora.jpg
			// https://www.debate.com.mx/export/sites/debate/img/2016/11/01/gallery-1475161353-hbz-kim-kimdarshian-balmain-getty.jpg_1562486662.jpg_1562486662.jpg
			//   https://www.debate.com.mx/export/sites/debate/img/2016/11/01/gallery-1475161353-hbz-kim-kimdarshian-balmain-getty.jpg_1562486662.jpg
			src.match(/^[a-z]+:\/\/[^/]*\/(?:__)?export\/+(?:[0-9]{10,}\/+)?sites\/+[^/]+\/+img\/+(?:[^/]*\/+)?[0-9]{4}\/+[0-9]{2}\/+[0-9]{2}\/+[^/]*\.[^/._]*_[0-9]{5,}\.[^/.]*(?:_[0-9]{5,}\.[^/.]*)?(?:[?#].*)?$/)) {
			// https://www.eleconomista.com.mx/__export/1518538244604/sites/eleconomista/img/2018/02/13/mario_draghi.jpg_332989735.jpg
			//   https://www.eleconomista.com.mx/__export/1518538244604/sites/eleconomista/img/2018/02/13/mario_draghi.jpg
			return src.replace(/(\/[^/.]*\.[^/]*)_[0-9]+\.[^/._]*$/, "$1");
		}

		if (domain === "gcm-v2.omerlocdn.com") {
			// https://gcm-v2.omerlocdn.com/production/global/files/image/16c89c8b-58a1-490f-b9a6-323adb16ca75_1024.jpg
			//   https://gcm-v2.omerlocdn.com/production/global/files/image/16c89c8b-58a1-490f-b9a6-323adb16ca75.jpg
			return src.replace(/_[0-9]+(\.[^/.]*)$/, "$1");
		}

		if (domain === "www.dailystar.com.lb" ||
			domain === "dailystar.com.lb") {
			// https://www.dailystar.com.lb/dailystar/Comics/23-02-2018/7cartoon%20New%20maths%20teacher_636549414776995725_main.jpg
			//   https://www.dailystar.com.lb/dailystar/Comics/23-02-2018/7cartoon%20New%20maths%20teacher_636549414776995725.jpg
			// http://www.dailystar.com.lb/dailystar/Pictures/2011/06/27/SaudiSpecialForces03_634448139672228001_img900x550_img900x550_crop.jpg
			//   http://www.dailystar.com.lb/dailystar/Pictures/2011/06/27/SaudiSpecialForces03_634448139672228001.jpg
			// http://www.dailystar.com.lb/dailystar/Pictures/2011/05/06/Mirna-Chaker-Jeita-Grotto-4_634403009433363875_img900x550_img900x550_crop.jpg
			// http://www.dailystar.com.lb/dailystar/Pictures/2011/07/04/13_634453800140116703_img900x550_img900x550_crop.jpg
			// http://www.dailystar.com.lb/dailystar/Pictures/2018/01/11/669500_img900x550_img900x550_crop.jpg
			//   http://www.dailystar.com.lb/dailystar/Pictures/2018/01/11/669500.jpg
			// http://www.dailystar.com.lb/dailystar/Pictures/2015/04/27/411756_img900x550_img900x550_crop.jpg
			//   http://www.dailystar.com.lb/dailystar/Pictures/2015/04/27/411756.jpg
			// http://www.dailystar.com.lb/dailystar/Pictures/2014/02/26/253362_img900x550_img900x550_crop.jpg
			//   http://www.dailystar.com.lb/dailystar/Pictures/2014/02/26/253362.jpg
			// http://www.dailystar.com.lb/dailystar/Pictures/2011/07/12/IMG_0080_634461096008782915_img900x550_img900x550_crop.JPG
			//   http://www.dailystar.com.lb/dailystar/Pictures/2011/07/12/IMG_0080_634461096008782915.JPG
			// https://dailystar.com.lb/dailystar/Pictures/2018/02/18/679287_img650x420_img650x420_crop.jpg
			//   https://dailystar.com.lb/dailystar/Pictures/2018/02/18/679287.jpg
			return src.replace(/([0-9]+)(?:_[^0-9][^/.]*)*(\.[^/.]*)$/, "$1$2");
		}

		if (domain === "images.dailykos.com") {
			// https://images.dailykos.com/images/359004/story_image/2016_Comparison_of_Presidential_and_House_Election_Margins_-_Republican_Incumbents.png?1485791213
			//   https://images.dailykos.com/images/359004/original/2016_Comparison_of_Presidential_and_House_Election_Margins_-_Republican_Incumbents.png?1485791213
			// https://images.dailykos.com/images/402092/small/GettyImages-135785191.jpg?1495062293
			//   https://images.dailykos.com/images/402092/original/GettyImages-135785191.jpg?1495062293
			// https://images.dailykos.com/images/489359/small/GpfQTnJ_1_.gif?1514432636
			//   https://images.dailykos.com/images/489359/original/GpfQTnJ_1_.gif?1514432636
			// https://images.dailykos.com/avatars/363/small/image.jpg?1454078865
			//   https://images.dailykos.com/avatars/363/original/image.jpg?1454078865
			return src.replace(/(\/(?:images|avatars)\/[0-9]+\/)[^/]*\/([^/]*)$/, "$1original/$2");
		}

		if (domain === "i.pixl.li") {
			// https://i.pixl.li/image3b64ca9d2cf0688e.png
			if (/image3b64ca9d2cf0688e\./.test(src)) {
				return {
					url: src,
					bad: true
				};
			}
		}

		if (domain_nosub === "jpg.church") {
			// thanks to SakalliTavernaci on github for reporting: https://github.com/qsniyg/maxurl/issues/1274#issuecomment-2021611522
			// https://simp6.jpg.church/images/testfcc38151209151b9.th.jpg
			//   https://simp6.host.church/images/testfcc38151209151b9.th.jpg
			return src.replace(/(:\/\/(?:[^/]+\.)?)jpg\.church\/+/, "$1host.church/");
		}

		// chevereto
		if (domain_nowww === "imgmax.com" ||
			// https://404store.com/2017/11/12/b1Ik9Cj-emma-watson-wallpapers.th.jpg
			// https://404store.com/2017/05/18/wc1715233.md.jpg
			domain_nowww === "404store.com" ||
			// https://www.imgpost.co.uk/images/2018/01/07/HagpiwP.md.jpg
			domain_nowww === "imgpost.co.uk" ||
			// http://ap.imagensbrasil.org/images/2017/07/26/3855442_orig.md.jpg
			domain === "ap.imagensbrasil.org" ||
			// https://www.picture-post.com/images/2018/01/15/701ddw_15.md.jpg
			domain_nowww === "picture-post.com" ||
			// http://stakimages.me/images/2018/07/08/DAZn.md.jpg
			domain_nowww === "stakimages.me" ||
			// https://imgsnap.com/images/2017/07/13/victoria-justice-out-and-about-on-broadway-in-new-york-06-21-2017_1.md.jpg
			domain_nowww === "imgsnap.com" ||
			// http://img.imgmax.com/images/2018/02/11/Q6tWj.th.jpg
			domain === "img.imgmax.com" ||
			// https://i.img.ie/uST.md.jpg
			domain === "i.img.ie" ||
			// https://i.lensdump.com/i/8UiN2c.md.jpg
			domain === "i.lensdump.com" ||
			// https://img.faploads.com/2018/06/21/Mandy-Moore-223.md.jpg
			domain === "img.faploads.com" ||
			// http://celebact.org/images/2017/03/09/DakotaFanning.4.th.jpg
			(domain_nowww === "celebact.org" && string_indexof(src, "/images/") >= 0) ||
			// https://imghost.io/images/2018/06/15/11.md.jpg
			domain_nosub === "imghost.io" ||
			// http://s18.img26.com/2018/04/22/127_Page_15.md.jpg
			domain_nosub === "img26.com" ||
			// http://cheapesthosting.xyz/i/images/2018/03/11/bHlx.th.jpg
			(domain_nowww === "cheapesthosting.xyz" && src.match(/\/i\/+images\//)) ||
			// http://www.s4tu.com/images/2018/08/01/289571b.md.jpg
			domain_nowww === "s4tu.com" ||
			// https://www.jiopic.com/images/2018/08/08/3f0LiqD.md.jpg
			domain_nowww === "jiopic.com" ||
			// https://www.beautifulmodels.xyz/images/2018/02/07/SeanArcherPhotography502a3.md.jpg
			domain_nowww === "beautifulmodels.xyz" ||
			// https://images.superimg.com/2019/02/24/Image_33_tM6hk.md.gif
			domain === "images.superimg.com" ||
			// https://ultraimg.com/images/insta0209c2fd.md.gif
			(domain_nowww === "ultraimg.com" && string_indexof(src, "/images/") >= 0) ||
			// https://celebfeetpics.com/images/Barbara-Palvins-Feet-474354c407ad489c4.md.jpg
			(domain_nowww === "celebfeetpics.com" && string_indexof(src, "/images/") >= 0) ||
			// https://lolzilla.net/img/images/2015/10/07/Kate-Upton-Camel-Toe-in-SI.md.jpg
			(domain_nowww === "lolzilla.net" && string_indexof(src, "/images/") >= 0) ||
			// https://extraimage.net/images/2019/05/22/e481286736b43bfd6508de1fb55feef8.md.jpg
			(domain_nowww === "extraimage.net" && string_indexof(src, "/images/") >= 0) ||
			// https://celebphotos.club/images/2019/07/23/selena-gomez-at-her-cousin-s-wedding-in-la-07-19-2019-2.md.jpg
			(domain_nowww === "celebphotos.club" && string_indexof(src, "/images/") >= 0) ||
			// http://www.image.farm/images/2017/08/25/160ea9b2aca90d9a83a894b36e9dbef9.md.jpg
			(domain_nowww === "image.farm" && string_indexof(src, "/images/") >= 0) ||
			// https://girlspic.net/images/2018/04/05/403215_01bige47b3488e70ef46a.md.jpg
			(domain_nowww === "girlspic.net" && string_indexof(src, "/images/") >= 0) ||
			// https://tgfimage.rocks/images/2018/01/25/0b7e8a02ed3c2d3611675f678fecead9.md.jpg
			(domain_nowww === "tgfimage.rocks" && string_indexof(src, "/images/") >= 0) ||
			// https://imgfy.net/images/2018/11/27/30-mugdha-godse-hd-picture.md.jpg
			(domain_nowww === "imgfy.net" && string_indexof(src, "/images/") >= 0) ||
			// https://s1.picho.st/2017/08/18/diwd.md.png
			(domain_nosub === "picho.st" && /^s[0-9]*\./.test(domain)) ||
			// https://imagenup.com/images/2019/02/05/images.th.jpg
			domain_nowww === "imagenup.com" ||
			// http://imgz.pw/ch/images/2018/03/23/SJU2.th.jpg
			//   http://imgz.pw/ch/images/2018/03/23/SJU2.jpg
			(domain_nowww === "imgz.pw" && /\/ch\/+images\//.test(src)) ||
			// https://xxximg.art/ssdimg1/images/2019/12/14/Ariel_Rebel_Purple_Lingerie_Set_001_001.th.jpg
			//   https://xxximg.art/ssdimg1/images/2019/12/14/Ariel_Rebel_Purple_Lingerie_Set_001_001.jpg
			// other: https://xxximg.art/cdn/site1/uploads/2019/12/Ariel_Rebel_Purple_Lingerie_Set_001_001.th_.jpg
			//   can't replace because /14/ is added
			(domain_nowww === "xxximg.art" && string_indexof(src, "/images/") >= 0) ||
			// http://data01.tag-fox.com/2020/01/21/giphy-279d2b6e54aa52733.md.gif
			//   http://data01.tag-fox.com/2020/01/21/giphy-279d2b6e54aa52733.gif
			(domain_nosub === "tag-fox.com" && /^data[0-9]*\./.test(domain)) ||
			// https://s5.gifyu.com/images/05---frack-you.md.gif
			(domain_nosub === "gifyu.com" && string_indexof(src, "/images/") >= 0) ||
			// https://iili.io/J81JIa.md.jpg
			domain_nowww === "iili.io" ||
			// https://privacypic.com/images/2020/01/18/0a24f9d469a758cac.md.png
			domain_nowww === "privacypic.com" ||
			// http://s5.imgcredit.xyz/2020/10/31/5d4eea0674c6aac3e7e723899c97826c.th.jpg
			(domain_nosub === "imgcredit.xyz" && /^s[0-9]*\./.test(domain)) ||
			// thanks to MinuteAd8502 on github: https://github.com/qsniyg/maxurl/issues/791
			// https://imgcloud.pw/images/2019/10/03/1080p-cest-leclate-totale-pour-pauline-21ans.mp4_snapshot_02.42.00089e163141828fa66.th.jpg
			//   https://imgcloud.pw/images/2019/10/03/1080p-cest-leclate-totale-pour-pauline-21ans.mp4_snapshot_02.42.00089e163141828fa66.jpg
			(domain_nowww === "imgcloud.pw" && string_indexof(src, "/images/") >= 0) ||
			// https://imgmak.com/images/2020/12/04/tmpposter13945.th.jpg
			(domain_nosub === "imgmak.com" && string_indexof(src, "/images/") >= 0) ||
			// http://pixio.pw/images/2020/04/06/AL-5.th.jpg
			(domain_nowww === "pixio.pw" && string_indexof(src, "/images/") >= 0) ||
			// thanks to remlap:
			// https://simp6.jpg.church/images/testfcc38151209151b9.th.jpg
			//   https://simp6.jpg.church/images/testfcc38151209151b9.jpg
			(domain_nosub === "jpg.church" && /^simp[0-9]*\./.test(domain)) ||
			// thanks to beeznutsonly on github: https://github.com/qsniyg/maxurl/issues/1274
			// https://simp6.host.church/images/testfcc38151209151b9.th.jpg
			//   https://simp6.host.church/images/testfcc38151209151b9.jpg
			(domain_nosub === "host.church" && /^simp[0-9]*\./.test(domain)) ||
			// thanks to evilxsloth on github: https://github.com/qsniyg/maxurl/issues/1352
			// https://simp4.jpg5.su/IMG_18687a176c20c99d7d45.th.jpg
			//   https://simp4.jpg5.su/IMG_18687a176c20c99d7d45.jpg
			(domain_nosub === "jpg5.su" && /^simp[0-9]*\./.test(domain)) ||
			// thanks to vscum on github: https://github.com/qsniyg/maxurl/issues/1166
			// https://photoloading.com/images/2023/01/28/6475687587.th.jpg
			//   https://photoloading.com/images/2023/01/28/6475687587.jpg
			(domain_nowww === "photoloading.com" && string_indexof(src, "/images/") >= 0) ||
			// https://i1.lensdump.com/i/0VlLT2.md.png
			(domain_nosub === "lensdump.com" && /^i[0-9]*\./.test(domain)) ||
			// https://i.pixl.li/realgirlsbb.com-Christelle-Mackie134306c1c56f12d5acd.md.jpg
			domain === "i.pixl.li" ||
			// https://everest.picturedent.org/images/2023/06/27/O42sXcN.th.jpg
			//   https://everest.picturedent.org/images/2023/06/27/O42sXcN.jpg
			// https://picturedent.org/images/2021/12/30/Harone22607.th.jpg
			//   https://picturedent.org/images/2021/12/30/Harone22607.jpg
			(domain_nosub === "picturedent.org" && string_indexof(src, "/images/") >= 0) ||
			// https://s1.media-storage.net/images/14d3a06dc67c68be35b6c2cfa2cc38f5.md.jpeg
			//   https://s1.media-storage.net/images/14d3a06dc67c68be35b6c2cfa2cc38f5.jpeg
			(domain_nosub === "media-storage.net" && /^s[0-9]\./.test(domain)) ||
			// https://imagehost.thasnasty.com/images/2023/09/18/the-mask-jim-carrey.md.gif
			//   https://imagehost.thasnasty.com/images/2023/09/18/the-mask-jim-carrey.gif
			domain === "imagehost.thasnasty.com" ||
			// thanks to anonymous for reporting:
			// https://img.kiwi/images/2024/01/14/b5331815bc160dc4c0c4eb160107a49c.th.jpg
			//   https://img.kiwi/images/2024/01/14/b5331815bc160dc4c0c4eb160107a49c.jpg
			domain_nowww === "img.kiwi" ||
			// thanks to hosadokha on github for reporting: https://github.com/qsniyg/maxurl/issues/1269
			// https://add.pics/images/2020/05/07/ScreenShot_20200507200118.md.png
			//   https://add.pics/images/2020/05/07/ScreenShot_20200507200118.png
			domain_nowww === "add.pics" ||
			// thanks to anonymous for reporting:
			// https://putmega.com/images/image_2024-05-24_101150404702263668646a4d9.md.png
			//   https://putmega.com/images/image_2024-05-24_101150404702263668646a4d9.png
			domain_nowww === "putmega.com" ||
			// http://image-bugs.com/images/2017/09/09/CelebsFlash.com_NP_Harpers_Bazaar_090817__3_.md.jpg
			domain_nowww === "image-bugs.com") {
			// http://imgmax.com/images/2017/03/20/0OQhE.th.jpg
			//   http://imgmax.com/images/2017/03/20/0OQhE.jpg
			return src.replace(/\.(?:th|md)(\.[^/.]*)$/, "$1");
		}

		if (domain_nowww === "imgpile.com" && /\/images\//.test(src)) {
			// https://imgpile.com/images/nnHvi2.md.jpg
			return {
				url: src.replace(/\.(?:th|md)(\.[^/.]*)$/, "$1"),
				headers: {
					"Accept": "*/*"
				}
			};
		}

		if (domain_nowww === "cheapesthosting.xyz") {
			// http://cheapesthosting.xyz/upload/small/2018/03/06/5a9e9814dbc47.jpeg
			//   http://cheapesthosting.xyz/upload/big/2018/03/06/5a9e9814dbc47.jpeg
			return src.replace(/\/upload\/[a-z]+(\/[0-9]+\/[0-9]+\/[0-9]+\/)/, "/upload/big$1");
		}

		if (domain === "static.maxmodels.pl") {
			// https://static.maxmodels.pl/photos/1/c/b8/1cb801e95b178afa97bd106362bdec15_320123_thumb.jpg
			//   https://static.maxmodels.pl/photos/1/c/b8/1cb801e95b178afa97bd106362bdec15_320123.jpg
			// https://static.maxmodels.pl/article/e/f/e/efe5e8884994e41861fa95c6b48f4723_thumb.jpg
			//   https://static.maxmodels.pl/article/e/f/e/efe5e8884994e41861fa95c6b48f4723.jpg
			if (string_indexof(src, "/photos/") >= 0 || string_indexof(src, "/article/") >= 0) {
				return src.replace(/_thumb(\.[^/.]*)$/, "$1");
			}

			if (string_indexof(src, "/profile/") >= 0) {
				// https://static.maxmodels.pl/profile/6/c/9/6c9fd60f434f2a06212844dc6c073bf0_428915_428915_tinythumb.jpg
				//   https://static.maxmodels.pl/profile/6/c/9/6c9fd60f434f2a06212844dc6c073bf0_428915_428915_profile.jpg
				// thanks to anonymous for reporting:
				// https://static.maxmodels.pl/profile/1/a/9/1a96cd827a7b2f300b61d53992e348fc_232282_232282_profile.jpeg
				//   https://static.maxmodels.pl/photos/1/a/96/1a96cd827a7b2f300b61d53992e348fc_232282.jpeg
				return src
					.replace(/\/profile\/+(.\/+.\/+.)\/+([0-9a-f]{3})([0-9a-f])([0-9a-f]+_[0-9]+)_[0-9]+_[a-z]+(\.[a-z]+)(?:[?#].*)?$/, "/photos/$1$3/$2$3$4$5")
					.replace(/_[a-z]+(\.[^/.]*)$/, "_profile$1");
			}
		}

		if (domain_nosub === "img.yt") {
			// dead?
			// https://x001.img.yt/small/2015/04/19/5532fb62ba401.jpg
			//   https://x001.img.yt/big/2015/04/19/5532fb62ba401.jpg
			return src.replace("/small/", "/big/");
		}

		if (domain === "cdn.wallpaperjam.com") {
			// http://cdn.wallpaperjam.com/static/images/m/2b/35/2b359c913f740935e350c0b42c8c5b9da9804763.jpg
			//   https://cdn.wallpaperjam.com/2b359c913f740935e350c0b42c8c5b9da9804763/image.jpg
			return src.replace(/\/static\/images\/.*?\/([a-f0-9]+)(\.[^/.]*)$/, "/$1/image$2");
		}

		if (domain === "cdn.oboi7.com") {
			// http://cdn.oboi7.com/static/images/m/cd/0b/cd0b818eff905203d171ea234ac475c9e7e4586e.jpg -- 760x1062
			//   http://cdn.oboi7.com/content/images/cd/0b/cd0b818eff905203d171ea234ac475c9e7e4586e.jpg -- 2656x3712
			return src.replace(/\/static\/images\/[a-z]\//, "/content/images/");
		}

		if (domain === "media.tabloidbintang.com") {
			// https://media.tabloidbintang.com/files/thumb/yoona-snsd_dira_2.jpg/1500
			//   https://media.tabloidbintang.com/files/yoona-snsd_dira_2.jpg
			// https://media.tabloidbintang.com/files/thumb/8bb22765c251c7b2741c1f69d06f2f93.jpg/222/140/fit
			return src.replace(/\/thumb\/([^/]*\.[^/.]*)(?:\/.*)/, "/$1");
		}

		if (domain === "media.teen.co.id") {
			// https://media.teen.co.id/files/thumb/tay6.jpg?p=trias93/&w=300&h=220&m=fit
			// https://media.teen.co.id/files/thumb/bianca_hello_4.jpg?p=trias93/&w=1024&m=fit
			//   https://media.teen.co.id/files/view/bianca_hello_4.jpg?p=trias93/
			return src.replace(/\/thumb\/([^/?]*\.[^/.?]*).*?[?&](p=[^&]*).*/, "/view/$1?$2");
		}

		if (domain === "cdn.imgchest.com") {
			// https://cdn.imgchest.com/files/thumb/j7mmcqq2g76.jpeg
			//   https://cdn.imgchest.com/files/j7mmcqq2g76.jpeg
			return src.replace(/\/files\/+thumb\//, "/files/");
		}

		if ((domain_nosub === "hudong.com" && string_indexof(domain, ".att.hudong.com") >= 0) ||
			// https://eiga-board.com/assets/medias/posts/1365/201903ErfpIwvNuG_s.jpg
			//   https://eiga-board.com/assets/medias/posts/1365/201903ErfpIwvNuG.jpg
			(domain_nowww === "eiga-board.com" && string_indexof(src, "/assets/medias/") >= 0) ||
			// https://www.kaigai-drama-board.com/assets/medias/2017/12/20171224-getty_884684510_s.jpg
			(domain_nowww === "kaigai-drama-board.com" && string_indexof(src, "/assets/medias/") >= 0)) {
			// http://a0.att.hudong.com/62/10/20200000013920144739106585140_s.jpg
			//   http://a0.att.hudong.com/62/10/20200000013920144739106585140.jpg
			// http://a4.att.hudong.com/41/08/300022729906133502080921900_s.jpg
			//   http://a4.att.hudong.com/41/08/300022729906133502080921900.jpg
			newsrc = src.replace(/_s(\.[^/.]*)$/, "$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nosub === "hudong.com" && string_indexof(domain, ".att.hudong.com") >= 0) {
			// http://a4.att.hudong.com/21/51/01200000032935136113511508746_140.jpg
			//   http://a4.att.hudong.com/21/51/01200000032935136113511508746.jpg
			return src.replace(/_[0-9]+(\.[^/.]*)$/, "$1");
		}

		if (domain_nowww === "ihanyu.com") {
			// http://www.ihanyu.com/cache/yiren/photo/0/2/130/2871.jpg
			//   http://www.ihanyu.com/uploadfile/yiren/photo/0/2/2871.jpg
			return src.replace(/\/cache\/([^/]*)\/([^/]*\/[0-9]+\/[0-9]+\/)[0-9]+\/([0-9]+\.[^/.]*)$/, "/uploadfile/$1/$2$3");
		}

		if (domain_nowww === "gongl8.com" ||
			// http://upload.mcchina.com/2014/0908/thumb_600_800_1410147115827.jpg
			//   http://upload.mcchina.com/2014/0908/1410147115827.jpg
			domain === "upload.mcchina.com" ||
			// http://www.suanning.com/uploadfile/2015/0413/thumb_100_137_20150413011609783.jpg
			//   http://www.suanning.com/uploadfile/2015/0413/20150413011609783.jpg
			domain_nowww === "suanning.com" ||
			// http://upload.site.cnhubei.com/2015/0915/thumb_200_200_1442309977981.jpg
			//   http://upload.site.cnhubei.com/2015/0915/1442309977981.jpg
			domain === "upload.site.cnhubei.com" ||
			// http://www.artsbj.com/uploadfile/2018/0807/thumb_100_137_20180807020554237.jpg
			//   http://www.artsbj.com/uploadfile/2018/0807/20180807020554237.jpg
			domain_nowww === "artsbj.com" ||
			// http://upload.taihainet.com/2016/0713/thumb_500_0_1468369050794.jpg
			//   http://upload.taihainet.com/2016/0713/1468369050794.jpg
			domain === "upload.taihainet.com" ||
			// http://news.yule.com.cn/uploadfile/2019/0411/thumb_500_0_20190411043755590.jpg
			//   http://news.yule.com.cn/uploadfile/2019/0411/20190411043755590.jpg
			domain === "news.yule.com.cn" ||
			// http://upload.sanqin.com/2015/0801/thumb_900_600_1438417056121.jpg
			//   http://upload.sanqin.com/2015/0801/1438417056121.jpg
			domain === "upload.sanqin.com" ||
			// http://upload.art.ifeng.com/2017/0410/thumb_700_325_1491790874748.jpg
			//   http://upload.art.ifeng.com/2017/0410/1491790874748.jpg
			domain === "upload.art.ifeng.com" ||
			// http://uploads.rayli.com.cn/2016/0413/thumb_264_1460513211233.jpg
			//   http://uploads.rayli.com.cn/2016/0413/1460513211233.jpg
			domain === "uploads.rayli.com.cn" ||
			// http://m1.ablwang.com/uploadfile/2018/0430/thumb_110_69_20180430070256125.jpg
			//   http://m1.ablwang.com/uploadfile/2018/0430/20180430070256125.jpg
			(domain_nosub === "ablwang.com" && domain.match(/m[0-9]*\.ablwang\.com/)) ||
			// http://image14.m1905.cn/uploadfile/2016/0802/thumb_0_647_500_20160802095117440123_watermark.jpg
			//   http://image14.m1905.cn/uploadfile/2016/0802/20160802095117440123.jpg
			(domain_nosub === "m1905.cn" && domain.match(/image[0-9]*\.m1905\.cn/)) ||
			// http://www.ozanyerli.com/uploadfile/2016/0411/thumb_240_0_20160411034324215.jpg
			//   http://www.ozanyerli.com/uploadfile/2016/0411/20160411034324215.jpg
			domain_nowww === "ozanyerli.com" ||
			// http://www.entline.cn/uploadfile/2016/0411/thumb_260_0_20160411034315914.jpg
			//   http://www.entline.cn/uploadfile/2016/0411/20160411034315914.jpg
			domain_nowww === "entline.cn" ||
			// http://img.ixiumei.com/uploadfile/2016/0602/thumb_294_224_20160602105701954.jpg
			//   http://img.ixiumei.com/uploadfile/2016/0602/20160602105701954.jpg
			domain === "img.ixiumei.com" ||
			// http://www.69876.com/uploadfile/2017/0524/thumb_100_137_20170524125326237.jpg
			//   http://www.69876.com/uploadfile/2017/0524/20170524125326237.jpg
			domain_nowww === "69876.com" ||
			// http://222.186.12.239:10012/uploadfile/2017/0524/thumb_100_137_20170524125326237.jpg
			domain === "222.186.12.239") {
			// http://gongl8.com/uploadfile/2018/0228/thumb_0_300_20180228054831686.jpg
			//   http://gongl8.com/uploadfile/2018/0228/20180228054831686.jpg
			newsrc = src.replace(/(\/[0-9]{4}\/+[0-9]{4}\/+)thumb_[0-9]+_(?:[0-9]+_){0,2}([0-9]{8,})(?:_watermark)?(\.[^/.]+)(?:[?#].*)?$/, "$1$2$3");
			if (newsrc !== src)
				return newsrc;
			//newsrc = src.replace(/\/(?:thumb_[0-9]+_[0-9]+_(?:[0-9]+_)?)?([0-9]+)(?:_watermark)?(\.[^/.]*)$/, "/$1$2");
			//if (newsrc !== src)
			//	return newsrc;
		}

		if (domain === "imgsh.jpnxcn.com" ||
			// https://img.94hnr.com/160711/thumb_600_0_38_162716_1.jpg
			//   https://img.94hnr.com/160711/38_162716_1.jpg
			domain === "img.94hnr.com" ||
			// https://img.cancai.net/160711/thumb_600_0_38_162716_1.jpg
			//   https://img.cancai.net/160711/38_162716_1.jpg
			domain === "img.cancai.net" ||
			// http://img.sexbeautygirl.com/2015/091002/thumb_300_0_201110301600096500.jpg
			//   http://img.sexbeautygirl.com/2015/091002/201110301600096500.jpg
			domain === "img.sexbeautygirl.com" ||
			// http://himg2.huanqiu.com/attachment2010/2017/0628/09/26/thumb_100_65_20170628092609389.jpg
			//   http://himg2.huanqiu.com/attachment2010/2017/0628/09/26/20170628092609389.jpg
			(domain_nosub === "huanqiu.com" && /^himg[0-9]*\./.test(domain)) ||
			// https://file.acgxmanga.com/h/2019102609/thumb_250_0_jozjk4m5b13.jpg
			//   https://file.acgxmanga.com/h/2019102609/jozjk4m5b13.jpg
			domain === "file.acgxmanga.com") {
			// http://imgsh.jpnxcn.com/pics/star/pic/thumb_180_0_5de4fc683a33a8e1731ecc044918e3b3.jpg
			//   http://imgsh.jpnxcn.com/pics/star/pic/5de4fc683a33a8e1731ecc044918e3b3.jpg
			return src.replace(/\/thumb_[0-9]+_[0-9]+_/, "/");
		}

		if (domain_nowww === "gaobei.com" &&
			string_indexof(src, "/upload/") >= 0) {
			// s resizes up, b seems to be original
			// http://www.gaobei.com/upload/10001/article/2018_03/12175401_ace4sg_s.jpg
			//   http://www.gaobei.com/upload/10001/article/2018_03/12175401_ace4sg_b.jpg
			// http://www.gaobei.com/upload/10001/article/2015_12/28013712_kmxwsc_b.jpg - 2000x3000
			// http://www.gaobei.com/upload/10001/article/2016_05/10175130_1f7z15_b.jpg
			//   http://www.gaobei.com/upload/10001/article/2016_05/10175130_1f7z15.jpg -- doesn't work
			// http://www.gaobei.com/upload/10001/article/2017_10/20220510_cesgua.jpg
			//   http://www.gaobei.com/upload/10001/article/2017_10/20220510_cesgua_b.jpg -- doesn't work
			return src.replace(/_[a-z](\.[^/.]*)$/, "_b$1");
		}

		if (domain_nowww === "urlebird.com") {
			// https://urlebird.com/video/get-ready-for-a-new-mind-blowing-series-6893985013889584389/
			match = src.match(/^[a-z]+:\/\/[^/]+\/+video\/+(?:[^/?#]+-)?([0-9]{10,})\/*(?:[?#].*)?$/);
			if (match) {
				return {
					url: "https://www.tiktok.com/@a/video/" + match[1],
					is_pagelink: true
				};
			}
		}

		if (host_domain_nowww === "urlebird.com" && options.element) {
			if (!src && options.element.classList.contains("overlay")) {
				return {
					url: origsrc,
					bad: "mask"
				};
			}

			// div.thumb > div.img > img.img-fluid
			if (domain_nowww !== "tiktok.com" && options.element.parentElement && options.element.parentElement.parentElement) {
				var dparent = options.element.parentElement.parentElement;
				if (dparent.classList.contains("thumb")) {
					var a = dparent.querySelector("a[href*=video]");
					if (a) {
						return {
							url: a.href,
							is_pagelink: true
						};
					}
				}
			}
		}

		if (host_domain_nosub === "tiktok.com" && options.element) {
			if (options.element.tagName === "DIV" && options.element.classList.contains("play-button")) {
				return {
					url: origsrc,
					bad: "mask"
				};
			}
		}

		if (domain_nowww === "tiktok.com") {
			var query_tiktok_url = function(url, cb) {
				var normalized_url = url
					.replace(/^[a-z]+:\/\//, "https://")
					.replace(/:\/\/[^/]*tiktok\.com\/+/, "://www.tiktok.com/")
					.replace(/\/*(?:[?#].*)?$/, "");
				var cache_key = "tiktok_nextdata:" + normalized_url;
				api_cache.fetch(cache_key, cb, function(done) {
					options.do_request({
						url: url.replace(/#.*/, ""),
						method: "GET",
						onload: function(resp) {
							if (resp.readyState < 4)
								return;

							if (resp.status !== 200) {
								console_error(resp);
								return done(null, false);
							}

							var match = resp.responseText.match(/<script[^>]+id="__UNIVERSAL_DATA_FOR_REHYDRATION__"[^>]*>({.*?})<\/script>/);
							if (!match)
								match = resp.responseText.match(/<script[^>]+id="SIGI_STATE"[^>]*>({.*?})\s*<\/script>/);
							if (!match) {
								console_error("Unable to find sigi match", resp);
								return done(null, false);
							}

							try {
								var json = JSON_parse(match[1]);

								// rehydration
								if (json.__DEFAULT_SCOPE__) {
									json = json.__DEFAULT_SCOPE__["webapp.video-detail"];
								}

								return done(json, 60*60);
							} catch (e) {
								console_error(e);
								return done(null, false);
							}
						}
					});
				});
			};

			var query_tiktok_post = function(params, cb) {
				// TODO: https://m.tiktok.com/v/[vid].html
				// /@/video/... works too
				var url = "https://www.tiktok.com/@" + params.username + "/video/" + params.web_vid;
				return query_tiktok_url(url, cb);
			};

			var query_tiktok1 = function(params, cb) {
				var url = "https://www.tiktok.com/node/share/video/@" + params.username + "/" + params.web_vid + "?request_from=server";
				var cache_key = "tiktok_node:" + params.username + "/" + params.web_vid;

				api_query(cache_key, {
					url: url,
					json: true
				}, cb, function(done, resp) {
					if (!resp || !resp.itemInfo || !resp.itemInfo.itemStruct) {
						console_error(cache_key, "Unable to get tiktok info from API", resp, params);
						return done(null, false);
					}

					done(resp, 60*60);
					//done(resp.body, 60*60);
				});
			};

			let query_tiktok_appapi = function(params, cb) {
				if (!options.rule_specific || !options.rule_specific.tiktok_app_api) {
					return cb(null);
				}

				let cache_key = "tiktok_appapi:" + params.username + "/" + params.web_vid;

				api_query(cache_key, {
					url: "https://api2.musical.ly/aweme/v1/feed/?aweme_id=" + params.web_vid,
					headers: {
						"User-Agent": "TikTok 32.6.0 rv:326001 (iPhone; iOS 17.1.2; en_US) Cronet"
					},
					json: true
				}, cb, function(done, resp) {
					let found_item = null;
					for (let item of resp.aweme_list) {
						if (item.aweme_id === params.web_vid) {
							found_item = item;
							break;
						}
					}

					if (!found_item) {
						console_error(cache_key, "Unable to find", params.web_vid, "from API", resp);
						return done(null, false);
					}

					return done(found_item, 60*60);
				})
			}

			var tiktok_api_to_obj = function(data) {
				// some tiktok users' videos return 404 (e.g. geoblock)
				// thanks to remlap on discord for sharing that videoData doesn't exist for some videos. pageProps gives serverCode: 404
				if (!data || !data.itemInfo || !data.itemInfo.itemStruct) {
					return null;
				}

				try {
					var item = data.itemInfo.itemStruct;
					var caption = item.desc;

					let baseobj:BigImageInfoSObject = {
						extra: {
							caption: caption
						},
						headers: {
							"accept": "*/*",
							referer: "https://www.tiktok.com/",
							"sec-fetch-dest": "video",
							"sec-fetch-mode": "no-cors",
							"sec-fetch-site": "same-site"
						},
						cookie_url: "https://www.tiktok.com/",
						can_head: false,
						//can_multiple_request: false
					};

					if (data.metaParams && data.metaParams.canonicalHref) {
						baseobj.extra.page = data.metaParams.canonicalHref;
					} else {
						baseobj.extra.page = "https://www.tiktok.com/@" + item.author.uniqueId + "/video/" + item.id;
					}

					//var videourl = item.video.bitrateInfo[0].PlayAddr.UrlList[0] || item.video.downloadAddr || item.video.playAddr;

					let urls:BigImageInfoMObject = [];
					for (let bri of item.video.bitrateInfo) {
						let codec = null;
						if (bri.CodecType === "h265_hvc1") {
							codec = "hevc";
						} else if (bri.CodecType !== "h264") {
							console_warn("Unknown codec type for", bri);
						}

						if (!bri.PlayAddr.UrlList.length || !bri.PlayAddr.UrlList[0]) {
							console_warn("Skipping", bri);
							continue;
						}

						urls.push({
							url: bri.PlayAddr.UrlList[0],
							media_info: {
								type: "video",
								codec
							}
						});
					}

					let finalobj = fillobj_urls(urls, baseobj);
					for (let obj of finalobj) {
						common_functions["set_tiktok_vid_filename"](obj);
					}

					return finalobj;
				} catch (e) {
					console_error(e);
					return null;
				}
			};

			var tiktok_sigiapi_to_obj = function(data, id) {
				if (!data || !data.ItemModule || !(id in data.ItemModule)) {
					console_warn("Unable to find", id, "in", data);
					return null;
				}

				try {
					var item = data.ItemModule[id];
					var videourl = item.video.downloadAddr || item.video.playAddr;
					var caption = item.desc;

					var obj:BigImageInfoSObject = {
						url: videourl,
						extra: {
							caption: caption,
							author_username: item.author,
							created_date: parse_int(item.createTime) * 1000,
							page: "https://www.tiktok.com/@" + item.authorId + "/video/" + item.id
						},
						headers: {
							"accept": "*/*",
							referer: "https://www.tiktok.com/",
							"sec-fetch-dest": "video",
							"sec-fetch-mode": "no-cors",
							"sec-fetch-site": "same-site"
						},
						cookie_url: "https://www.tiktok.com/",
						video: true,
						can_head: false,
						//can_multiple_request: false
					};

					common_functions["set_tiktok_vid_filename"](obj);

					return obj;
				} catch (e) {
					console_error(e, data);
					return null;
				}
			};

			var tiktok_live_sigiapi_to_obj = function(data) {
				if (!data || !data.LiveRoom) {
					console_warn("Unable to find LiveRoom in", data);
					return null;
				}

				try {
					// TODO: hevcStreamData if supported
					let userinfo = data.LiveRoom.liveRoomUserInfo.user;
					var streamdata_str = data.LiveRoom.liveRoomUserInfo.liveRoom.streamData.pull_data.stream_data;
					var streamdata = JSON_parse(streamdata_str);

					var obj:BigImageInfoSObject = {
						url: streamdata.data.origin.main.hls,
						extra: {
							author_username: userinfo.uniqueId,
							page: "https://www.tiktok.com/@" + userinfo.uniqueId  + "/live"
						},
						headers: {
							"accept": "*/*",
							origin: "https://www.tiktok.com",
							referer: "https://www.tiktok.com/",
							"sec-fetch-dest": "none",
							"sec-fetch-mode": "no-cors",
							"sec-fetch-site": "cross-site"
						},
						media_info: {
							type: "video",
							delivery: "hls",
							is_live: true
						}
					};

					//common_functions["set_tiktok_vid_filename"](obj);

					return obj;
				} catch (e) {
					console_error(e, data);
					return null;
				}
			};

			var tiktok_webvideo_to_obj = function(data, id) {
				if (data.itemInfo) {
					return tiktok_api_to_obj(data);
				} else {
					return tiktok_sigiapi_to_obj(data, id);
				}
			};

			var tiktok_appapi_to_obj = function(data) {
				if (!data || !data.video) {
					console_warn("Unable to find data in", data);
					return null;
				}

				try {
					var obj:BigImageInfoSObject = {
						url: data.video.bit_rate[0].play_addr.url_list[0],
						extra: {
							caption: data.desc,
							author_username: data.author.unique_id,
							created_date: parse_int(data.create_time) * 1000,
							page: "https://www.tiktok.com/@" + data.author.unique_id + "/video/" + data.aweme_id
						},
						headers: {
							"accept": "*/*",
							referer: "https://www.tiktok.com/",
							"sec-fetch-dest": "video",
							"sec-fetch-mode": "no-cors",
							"sec-fetch-site": "same-site"
						},
						cookie_url: "https://www.tiktok.com/",
						video: true,
						can_head: false,
						//can_multiple_request: false
					};

					common_functions["set_tiktok_vid_filename"](obj);

					return obj;
				} catch (e) {
					console_error(e, data);
					return null;
				}
			};

			var remove_tiktok_watermark = function(obj, cb) {
				var page = null;

				let sobj = obj;
				if (is_array(obj))
					sobj = obj[0];

				if (sobj.extra && sobj.extra.page) page = sobj.extra.page;

				common_functions["tiktok_remove_watermark"](api_cache, options, sobj.url, page, function(newurl) {
					if (newurl) {
						sobj = fillobj_urls([newurl], sobj)[0];
					}

					if (!common_functions["set_tiktok_vid_filename"](sobj)) {
						delete sobj.filename;
					}

					if (is_array(obj))
						obj[0] = sobj;

					return cb(obj);
				});
			};

			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+(@[^/]+)\/+live(?:[?#].*)?$/,
				run: function(cb, match) {
					query_tiktok_url("https://www.tiktok.com/" + match[1] + "/live", function(data) {
						if (!data)
							return cb(null);

						let obj = tiktok_live_sigiapi_to_obj(data);
						return cb(obj);
					})
				}
			});
			if (newsrc) return newsrc;

			var params = common_functions["get_tiktok_weburl_parts"](src);
			if (params) {
				page_nullobj = {
					url: src,
					is_pagelink: true
				};

				var finalcb = function(obj) {
					if (!obj) {
						var match = src.match(/#imu-video=(https?:\/\/.*)$/);
						if (match) {
							return options.cb([{
								url: src,
								video: true,
								can_head: false
							}, page_nullobj]);
						} else {
							return options.cb(page_nullobj);
						}
					} else {
						remove_tiktok_watermark(obj, function(obj) {
							if (!is_array(obj))
								obj = [obj];

							obj.push(page_nullobj);
							return options.cb(obj);
						});
					}
				};

				query_tiktok_appapi(params, function(data) {
					if (!data) {
						query_tiktok_post(params, function(data) {
							if (!data) {
								return finalcb(null);
							}

							finalcb(tiktok_webvideo_to_obj(data, params.web_vid));
						});
						return;
					}

					finalcb(tiktok_appapi_to_obj(data));
				});

				return {
					waiting: true
				};
			}
		}

		if (host_domain_nosub === "tiktok.com" && options && options.cb && options.do_request && options.element) {
			var current = options.element;
			while (current) {
				if (current.tagName === "A" && /\/@[^/]+\/+video\/+[0-9]+\/*(?:[?#].*)?$/.test(current.href)) {
					var pageurl = current.href;
					var video_query = current.querySelector("video");
					if (video_query && video_query.src && /(?:muscdn|tiktokcdn)\.com\//.test(video_query.src)) {
						pageurl += "#imu-video=" + video_query.src;
					}

					return {
						url: pageurl,
						is_pagelink: true
					};
				}

				current = current.parentElement;
			}

			var params = common_functions["get_tiktok_weburl_parts"](options.host_url);
			if (params) {
				return {
					url: options.host_url,
					is_pagelink: true
				};
			}
		}

		if ((domain_nosub === "muscdn.com" || domain_nosub === "tiktokcdn.com") && /^v[0-9]+m?\./.test(domain)) {
			let baseobj = {
				url: src,
				video: true,
				can_head: false // 503 sometimes
			};

			common_functions["set_tiktok_vid_filename"](baseobj);

			if (options.do_request && options.cb && options.rule_specific && options.rule_specific.tiktok_no_watermarks) {
				common_functions["get_best_tiktok_url"](api_cache, options.do_request, src, function(newurl) {
					if (newurl) {
						baseobj.url = newurl;
					}
					common_functions["set_tiktok_vid_filename"](baseobj);

					options.cb(baseobj);
				});

				return {
					waiting: true
				};
			} else {
				return baseobj;
			}
		}

		if ((domain_nosub === "pstatp.com" ||
			 // https://p0.ipstatp.com/list/pgc-image-va/Rgmv8E92sxXqtz.jpg
			 //   https://p0.ipstatp.com/origin/pgc-image-va/Rgmv8E92sxXqtz.jpg
			 domain_nosub === "ipstatp.com" ||
			 domain_nosub === "sgpstatp.com")
			&& domain.match(/[pi][a-z]?[0-9]*\./) ||
			// https://p16-tiktokcdn-com.akamaized.net/aweme/100x100/tiktok-obj/1647151559190530.jpeg
			//   https://p16-tiktokcdn-com.akamaized.net/origin/tiktok-obj/1647151559190530.jpeg
			// https://p16-tiktokcdn-com.akamaized.net/large/v0201/a4d90921ec0947ed959b757497367d9e.jpg
			//   https://p16-tiktokcdn-com.akamaized.net/img/v0201/a4d90921ec0947ed959b757497367d9e~noop.jpg
			//   https://p16-tiktokcdn-com.akamaized.net/obj/v0201/a4d90921ec0947ed959b757497367d9e.jpg -- 720x1080
			//   https://p16-tiktokcdn-com.akamaized.net/origin/v0201/a4d90921ec0947ed959b757497367d9e.jpg -- 720x1080
			domain === "p16-tiktokcdn-com.akamaized.net" ||
			// https://p16-va-default.akamaized.net/img/musically-maliva-obj/1654872269613062~c5_720x720.jpeg
			//   https://p16-va-default.akamaized.net/origin/musically-maliva-obj/1654872269613062.jpeg
			domain === "p16-va-default.akamaized.net" ||
			// https://p16.tiktokcdn.com/aweme/100x100/tiktok-obj/1647151559190530.jpeg
			//   https://p16.tiktokcdn.com/origin/tiktok-obj/1647151559190530.jpeg
			//domain === "p16.tiktokcdn.com" ||
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/426
			// https://p16-amd-va.tiktokcdn.com/img/musically-maliva-obj/d8bcd7b974df059dd548e98a39b705d9~c5_100x100.jpeg
			//   https://p16-amd-va.tiktokcdn.com/origin/musically-maliva-obj/d8bcd7b974df059dd548e98a39b705d9.jpeg -- upscaled?
			// https://p16-amd-va.tiktokcdn.com/tos-maliva-p-0068/3cc29b70b9ed45d1b86f5a525da02f13_1598931018~noop.image
			//   https://p16-amd-va.tiktokcdn.com/tos-maliva-p-0068/3cc29b70b9ed45d1b86f5a525da02f13_1598931018~noop.jpg
			//   https://p16-amd-va.tiktokcdn.com/img/tos-maliva-p-0068/3cc29b70b9ed45d1b86f5a525da02f13_1598931018~noop.jpg
			//   https://p16-amd-va.tiktokcdn.com/origin/tos-maliva-p-0068/3cc29b70b9ed45d1b86f5a525da02f13_1598931018.jpg
			// https://p16-amd-va.tiktokcdn.com/musically-maliva-obj/1663656694255621~noop.jpeg
			//   https://p16-amd-va.tiktokcdn.com/origin/musically-maliva-obj/1663656694255621.jpeg
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/431
			// https://p16-amd-va.tiktokcdn.com/tiktok-obj/1628900944743426~c5_168x168.webp
			//   https://p16-amd-va.tiktokcdn.com/origin/tiktok-obj/1628900944743426.webp
			// https://p61-sg.tiktokcdn.com/img/tos-maliva-avt-0068/6786738264c09fd4f4e959b1b384f768~c5_100x100.webp
			// https://p61-va.tiktokcdn.com/img/tos-maliva-avt-0068/6786738264c09fd4f4e959b1b384f768~c5_100x100.webp
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/433
			// https://p16.tiktokcdn.com/aweme/200x200/tos-alisg-i-0000/735a1666aed24306ad91380ac6b05c6a.jpeg
			//   https://p16.tiktokcdn.com/origin/tos-alisg-i-0000/735a1666aed24306ad91380ac6b05c6a.jpeg
			// other:
			// https://p16-amd-va.tiktokcdn.com/origin/tos-maliva-p-0068/3c666aa393714922b10def1ee39ad780_1599009621
			// update 2020 oct 1: /[0-9a-f]{10,}_[0-9]+ doesn't seem to work anymore for non-signed urls
			//domain === "p16-amd-va.tiktokcdn.com" ||
			// http://p16.hypstarcdn.com/img/hpimg/db21de51a5c58250bfc4daa08c218e936ba721100afcabf845ba99e09a69c409~100x100.jpg
			//   http://p16.hypstarcdn.com/origin/hpimg/db21de51a5c58250bfc4daa08c218e936ba721100afcabf845ba99e09a69c409.jpg
			// http://p16-va.hypstarcdn.com/img/hpimg/db21de51a5c58250bfc4daa08c218e936ba721100afcabf845ba99e09a69c409~100x100.jpg
			//   http://p16-va.hypstarcdn.com/origin/hpimg/db21de51a5c58250bfc4daa08c218e936ba721100afcabf845ba99e09a69c409.jpg
			// thanks to remlap:
			// https://p16-useast2a.tiktokcdn.com/tos-useast2a-avt-0068-euttp/743d32a7bc416238c4c06f57c873ab10~c5_100x100.jpeg
			//   https://p16-useast2a.tiktokcdn.com/origin/tos-useast2a-avt-0068-euttp/743d32a7bc416238c4c06f57c873ab10.jpeg
			((domain_nosub === "tiktokcdn.com" ||
			  // thanks to anonymous for reporting:
			  // https://p16-tm-sg.tiktokmusic.me/img/tos-alisg-v-2102/d29f3be2930646509463429175481b47~c5_500x500.jpg
			  //   https://p16-tm-sg.tiktokmusic.me/origin/tos-alisg-v-2102/d29f3be2930646509463429175481b47.jpg
			  domain_nosub === "tiktokmusic.me" ||
			  // thanks to anonymous for reporting:
			  // https://p16.resso.me/img/tos-alisg-v-2102/f97263a494c244bc9517d6d4526cdd77~c5_1000x1000.jpg
			  //   https://p16.resso.me/origin/tos-alisg-v-2102/f97263a494c244bc9517d6d4526cdd77.jpg
			  domain_nosub === "resso.me" ||
			  // thanks to anonymous for reporting:
			  // https://p16.tiktokcdn-us.com/tos-useast5-avt-0068-tx/58ccf604486bbcdb183b63577c5f1070~c5_100x100.jpeg
			  //   https://p16.tiktokcdn-us.com/origin/tos-useast5-avt-0068-tx/58ccf604486bbcdb183b63577c5f1070.jpeg
			  // https://p77-sign-va.tiktokcdn.com/tos-maliva-p-0068/26c6938092c04566b1de05f4d04f3851_1694416241~tplv-photomode-zoomcover:480:480.avif?...
			  // https://p16-sign-sg.tiktokcdn.com/tos-alisg-p-0037/okrQXUb2DnEfrogeQ08HAEgDjANoGdNbIeCJ2h~tplv-photomode-zoomcover:480:480.avif?...
			  domain_nosub === "tiktokcdn-us.com" ||
			  domain_nosub === "hypstarcdn.com") &&
			  (/^p[0-9]+(?:-[^/]+)?\./.test(domain) && !/-sign[-.]/.test(domain))) ||
			// http://p16-hypstarcdn-com.akamaized.net/img/hpimg/db21de51a5c58250bfc4daa08c218e936ba721100afcabf845ba99e09a69c409~100x100.jpg
			//   http://p16-hypstarcdn-com.akamaized.net/img/hpimg/db21de51a5c58250bfc4daa08c218e936ba721100afcabf845ba99e09a69c409~noop.jpg
			//   http://p16-hypstarcdn-com.akamaized.net/origin/hpimg/db21de51a5c58250bfc4daa08c218e936ba721100afcabf845ba99e09a69c409.jpg
			// http://p16-hypstarcdn-com.akamaized.net/img/tos-alisg-i-0000/81caebe48e7a45ca87e6ec57322294c7~480x0_35k.jpg
			//   http://p16-hypstarcdn-com.akamaized.net/img/tos-alisg-i-0000/81caebe48e7a45ca87e6ec57322294c7~noop.jpg
			//   http://p16-hypstarcdn-com.akamaized.net/origin/tos-alisg-i-0000/81caebe48e7a45ca87e6ec57322294c7.jpg
			domain === "p16-hypstarcdn-com.akamaized.net" ||
			// https://p3-tt.bytecdn.cn/img/pgc-image/f16e7bd2daf14850a8509015e6a45d71~noop_1913x1080.jpeg
			//   https://p3-tt.bytecdn.cn/img/pgc-image/f16e7bd2daf14850a8509015e6a45d71~noop.jpeg
			//   https://p3-tt.bytecdn.cn/origin/pgc-image/f16e7bd2daf14850a8509015e6a45d71.jpeg
			// http://p9-tt.bytecdn.cn/large/pgc-image/59e09a4f55d24a719681881263c67a12
			//   http://p9-tt.bytecdn.cn/img/pgc-image/59e09a4f55d24a719681881263c67a12~noop.jpeg
			//   http://p9-tt.bytecdn.cn/origin/pgc-image/59e09a4f55d24a719681881263c67a12
			// http://p9-hs.bytecdn.cn/large/tos-cn-p-0000/70d1b8c13f074407a38fd77dd8be2833.webp
			//   http://p9-hs.bytecdn.cn/origin/tos-cn-p-0000/70d1b8c13f074407a38fd77dd8be2833.webp
			// https://p3-tt.bytecdn.cn/img/tos-cn-i-0022/8407ceb2ec2a4af6ba39cbb73f9a7493~noop_2000x2999.jpeg
			//   https://p3-tt.bytecdn.cn/large/tos-cn-i-0022/8407ceb2ec2a4af6ba39cbb73f9a7493
			//   https://p3-tt.bytecdn.cn/origin/tos-cn-i-0022/8407ceb2ec2a4af6ba39cbb73f9a7493
			//   https://p3-tt.bytecdn.cn/img/tos-cn-i-0022/8407ceb2ec2a4af6ba39cbb73f9a7493~noop.jpeg
			//   https://p3-tt.bytecdn.cn/origin/tos-cn-i-0022/8407ceb2ec2a4af6ba39cbb73f9a7493.jpeg
			// http://p9-dy.bytecdn.cn/aweme/720x720/3308000e2f14f3ed5161.webp
			//   http://p9-dy.bytecdn.cn/obj/3308000e2f14f3ed5161.webp -- 1242x1209
			//   http://p9-dy.bytecdn.cn/origin/3308000e2f14f3ed5161.webp -- 1242x1209
			// http://p1-tt.bytecdn.cn/list/300x196/pgc-image/RPqKymt6GomelJ
			//   http://p1-tt.bytecdn.cn/obj/pgc-image/RPqKymt6GomelJ
			//   http://p1-tt.bytecdn.cn/origin/pgc-image/RPqKymt6GomelJ
			// http://p3a.bytecdn.cn/large/153300075dbdb085556d?imageView2/2/w/500/h/840
			//   http://p3a.bytecdn.cn/large/153300075dbdb085556d
			//   http://p3a.bytecdn.cn/origin/153300075dbdb085556d
			// http://p9-hs.bytecdn.cn/large/tos-cn-p-0000/70d1b8c13f074407a38fd77dd8be2833.webp
			//   http://p9-hs.bytecdn.cn/img/tos-cn-p-0000/70d1b8c13f074407a38fd77dd8be2833~noop.jpeg
			//   http://p9-tt.bytecdn.cn/origin/pgc-image/59e09a4f55d24a719681881263c67a12.jpeg
			domain_nosub === "bytecdn.cn" ||
			// https://p9-dy.byteimg.com/aweme/1080x1080/fbcd00041376e7f54cc6.jpeg
			//   https://p9-dy.byteimg.com/origin/fbcd00041376e7f54cc6.jpeg
			// https://p1-bcy.byteimg.com/img/banciyuan/77e60afabbab42278d6240620154cbfb~tplv-banciyuan-w650.image
			//   https://p1-bcy.byteimg.com/img/banciyuan/77e60afabbab42278d6240620154cbfb~noop.image
			//   https://p1-bcy.byteimg.com/origin/banciyuan/77e60afabbab42278d6240620154cbfb.jpg
			//   https://p1-bcy.byteimg.com/origin/banciyuan/77e60afabbab42278d6240620154cbfb.png
			// https://p9-bcy.byteimg.com/img/banciyuan/Public/Upload/avatar/4146977575282589/a51aeadaa7d44fd481084e79f27b0cad/fat.jpg~tplv-banciyuan-abig.image
			//   https://p9-bcy.byteimg.com/img/banciyuan/Public/Upload/avatar/4146977575282589/a51aeadaa7d44fd481084e79f27b0cad/fat.jpg~noop.image
			//   https://p9-bcy.byteimg.com/origin/banciyuan/Public/Upload/avatar/4146977575282589/a51aeadaa7d44fd481084e79f27b0cad/fat.jpg.jpg
			//   https://p9-bcy.byteimg.com/origin/banciyuan/Public/Upload/avatar/4146977575282589/a51aeadaa7d44fd481084e79f27b0cad/fat.jpg
			// https://p1-bcy.byteimg.com/img/banciyuan/user/219002/item/web/17al0/62afbfd0deb611e9afe7e78e9c02f7f3.jpg~tplv-banciyuan-w650.image
			//   https://p1-bcy.byteimg.com/img/banciyuan/user/219002/item/web/17al0/62afbfd0deb611e9afe7e78e9c02f7f3.jpg~noop.image
			//   https://p1-bcy.byteimg.com/origin/banciyuan/user/219002/item/web/17al0/62afbfd0deb611e9afe7e78e9c02f7f3.jpg.jpg
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/426
			// https://p1-hera.byteimg.com/tos-cn-i-jbbdkfciu3/753f819c23db45ca9c505a4d073657f6~tplv-jbbdkfciu3-webp:720:436.webp
			//   https://p1-hera.byteimg.com/tos-cn-i-jbbdkfciu3/753f819c23db45ca9c505a4d073657f6~tplv-jbbdkfciu3-webp:0:0.webp
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/703
			// http://p1-faceu.byteimg.com/tos-cn-i-0000/b9b498f430f248d19eaa58560c264b0a~tplv-resize:500:0.webp
			//   http://p1-faceu.byteimg.com/origin/tos-cn-i-0000/b9b498f430f248d19eaa58560c264b0a.png
			// http://p6-faceu.byteimg.com/web.business.image/20210407a7ad26f817360d3e4820b265~tplv-resize:900:0.webp
			//   http://p6-faceu.byteimg.com/web.business.image/20210407a7ad26f817360d3e4820b265~noop.webp
			//   http://p6-faceu.byteimg.com/origin/web.business.image/20210407a7ad26f817360d3e4820b265.png
			domain_nosub === "byteimg.com" ||
			// thanks to remlap on discord:
			// https://p16-va-tiktok.ibyteimg.com/img/musically-maliva-obj/42b35206fcf1aa59acd5bcdb2ae82ac8~c5_720x720.jpeg
			//   https://p16-va-tiktok.ibyteimg.com/origin/musically-maliva-obj/42b35206fcf1aa59acd5bcdb2ae82ac8.jpeg
			domain_nosub === "ibyteimg.com" ||
			// https://sf-tb-sg.ibytedtos.com/img/ttfe-malisg/tiktok_web/store-badge/en.png~296x0.webp
			//   https://sf-tb-sg.ibytedtos.com/origin/ttfe-malisg/tiktok_web/store-badge/en.png.webp
			//   https://sf-tb-sg.ibytedtos.com/origin/ttfe-malisg/tiktok_web/store-badge/en.png
			// thanks to lnp5131 on github: https://github.com/qsniyg/maxurl/issues/426#issuecomment-685697086
			// http://sf16-muse-va.ibytedtos.com/img/tos-maliva-p-0000/e5cd91966a794433a1f0f846b12fb0df~500x500.image
			//   http://sf16-muse-va.ibytedtos.com/origin/tos-maliva-p-0000/e5cd91966a794433a1f0f846b12fb0df.png
			domain_nosub === "ibytedtos.com" ||
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/703
			// https://p3.douyinpic.com/tos-cn-p-0015/d6b05871b3924710b44a077d8073571d~tplv-dy-cropcenter:248:330.webp?from=2563711402_large&s=PackSourceEnum_PUBLISH&se=true&sh=248_330&sc=cover&l=20210408020454010133055051202E9508
			//   https://p3.douyinpic.com/tos-cn-p-0015/d6b05871b3924710b44a077d8073571d~tplv-dy-cropcenter:0:0.webp
			//   https://p3.douyinpic.com/origin/tos-cn-p-0015/d6b05871b3924710b44a077d8073571d.webp
			//   https://p3.douyinpic.com/origin/tos-cn-p-0015/d6b05871b3924710b44a077d8073571d.png
			// https://p5-ipv6.douyinpic.com/aweme/1080x1080/iesmusic-cn-local/v1/tos-ag-i-0000/cf517a9a2864479b9388288bed337e83.jpeg
			//   https://p5-ipv6.douyinpic.com/origin/iesmusic-cn-local/v1/tos-ag-i-0000/cf517a9a2864479b9388288bed337e83.jpeg
			//   https://p5-ipv6.douyinpic.com/origin/iesmusic-cn-local/v1/tos-ag-i-0000/cf517a9a2864479b9388288bed337e83.png -- no perceptible difference in image quality
			// https://p9.douyinpic.com/img/tos-cn-avt-0015/30402529cce02ba50ee0bfcf5a5b3209~c5_100x100.jpeg?from=4010531038
			//   https://p9.douyinpic.com/origin/tos-cn-avt-0015/30402529cce02ba50ee0bfcf5a5b3209.jpeg
			// https://p11.douyinpic.com/314540005cfdcb7a0bcca~tplv-dy-shrink:96:96.webp?from=2563711402&s=PackSourceEnum_FEED&se=true&sh=96_96&sc=avatar&l=20210408022907010133054161542EDEB9
			//   https://p11.douyinpic.com/314540005cfdcb7a0bcca~tplv-dy-shrink:0:0.webp
			//   https://p11.douyinpic.com/origin/314540005cfdcb7a0bcca.png
			domain_nosub === "douyinpic.com" ||
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/703
			// http://p6.toutiaoimg.com/details/v1/w640/pgc-image/10a714e4f97c4104b322f6fe56a514f0.awebp?from=detail
			//   http://p6.toutiaoimg.com/origin/pgc-image/10a714e4f97c4104b322f6fe56a514f0.awebp?from=detail
			//   http://p6.toutiaoimg.com/origin/pgc-image/10a714e4f97c4104b322f6fe56a514f0.png
			// http://p5.toutiaoimg.com/img/pgc-image/0061c728e2e04ff1b7915c3e2a2ad6c5~tplv-tt-cs0:960:540.webp?from=feed
			//   http://p5.toutiaoimg.com/origin/pgc-image/0061c728e2e04ff1b7915c3e2a2ad6c5.png
			domain_nosub === "toutiaoimg.com" ||
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/703
			// https://p1-dy.bytexservice.com/img/user-avatar/abc7f176df517662315ba04934598ccc~c5_300x300.image
			//   https://p1-dy.bytexservice.com/origin/user-avatar/abc7f176df517662315ba04934598ccc.png
			domain_nosub === "bytexservice.com" ||
			// https://p16.muscdn.com/img/musically-maliva-obj/1634882550258693~c5_100x100.jpeg
			//   https://p16.muscdn.com/img/musically-maliva-obj/1634882550258693~noop.jpeg
			//   https://p16.muscdn.com/origin/musically-maliva-obj/1634882550258693.jpeg
			domain_nosub === "muscdn.com") {
			// http://p3.pstatp.com/medium/30f1001008f9067618b8
			//   http://p3.pstatp.com/large/30f1001008f9067618b8
			//   http://p3.pstatp.com/origin/30f1001008f9067618b8
			// https://p3.pstatp.com/list/190x124/12340017b4ef97c42e83
			//   https://p3.pstatp.com/origin/12340017b4ef97c42e83
			// http://p9.pstatp.com/large/1234001893bf059b82cf -- desaturated slightly
			//   http://p9.pstatp.com/origin/1234001893bf059b82cf
			// https://pb1.pstatp.com/aweme/1080x1080/330a00018476bb9c1e8c.jpeg
			//   https://pb1.pstatp.com/origin/330a00018476bb9c1e8c.jpeg
			// http://pb3.pstatp.com/obj/v0201/e369221678f0420b91913850354a67ab
			//   http://pb3.pstatp.com/origin/v0201/e369221678f0420b91913850354a67ab
			// http://i0.pstatp.com/large/6ebf0008169e56582256
			//   http://i0.pstatp.com/origin/6ebf0008169e56582256
			// http://p0.sgpstatp.com/large/tos-alisg-i-0000/6a3d2ee4939f47b09704d1463c0440f0
			//   http://p0.sgpstatp.com/origin/tos-alisg-i-0000/6a3d2ee4939f47b09704d1463c0440f0 -- without /tos-alisg-i-000/ works too
			newsrc = src
				.replace(/\?imageView2.*/, "")
				.replace(/(\/[0-9a-f]{10,})\.a?webp$/, "$1.png")
				.replace(/\.avif$/, ".png")
				.replace(/^([a-z]+:\/\/[^/]+\/+)([^/.:~]+)~(?:[^/.:]+:0:0|noop)\./, "$1origin/$2.")
				.replace(/(~[^/.:]+-[^/.:]+):[0-9]+:[0-9]+(\.(?:webp|avif))(?:[?#].*)?$/, "$1:0:0$2")
				.replace(/(:\/\/[^/]+\/+origin\/.*\.[a-z]+)\.[a-z]+(?:[?#].*)?$/, "$1")
				.replace(/(:\/\/[^/]+\/+)(?:medium|large|obj|img|aweme|list)\/+(?:[0-9]+x[0-9]+\/+)?((?:.*?\/+)?[^/~]+)(?:~noop)?(\.[^/.]+)?(?:[?#].*)?$/, "$1origin/$2$3")
				.replace(/(:\/\/[^/]+\/+)((?:(?:tos|musically)-(?:maliva|alisg|cn|us[a-z]+[0-9]*[a-z]*)-[^/]+|tiktok-obj|web\.[^/]+)\/+.*)$/, "$1img/$2")
				.replace(/(:\/\/[^/]+\/+.*?)\.image(?:[?#].*)?$/, "$1.png")
				.replace(/\/details\/+v1\/+[wh][0-9]+\/+/, "/origin/")
				.replace(/~[^/.?#:]+:0:0(\.[^/.?#]+)$/, "~noop$1")
				.replace(/(:\/\/[^/]+\/+(?:medium|large|obj|img|aweme|list)\/+.*)~[^/.?#]+(\.[^/.?#]+)?(?:[?#].*)?$/, "$1~noop$2");
			newsrc = remove_queries(newsrc, ["from"]);
			obj = {
				url: newsrc, /*src
					.replace(/(:\/\/[^/]*\/+)(?:medium|large|obj|aweme|list)\/+(?:[0-9]+x[0-9]+\/+)?/, "$1origin/")
					.replace(/(:\/\/[^/]+\/+.*?)\.image(?:[?$].*)?$/, "$1.jpg")
					.replace(/\/img\/+(.+\/+[0-9a-f]{10,}(?:_[0-9]+)?(?:\/+[^/]+|\.[^/.~?#]+)?)~noop(\.[^/.]*)(?:[?#].*)?$/, "/origin/$1$2")
					.replace(/(\/origin\/+.+\/+[0-9a-f]{10,}\/+[^/.]+\.[^/.]+)\.[^/.]+$/, "$1")
					.replace(/(\/img\/+.+\/+[0-9a-f]{10,}(?:\/+[^/]+|\.[^/.~?#]+)?~)[^/.]*?(\.[^/.]*)(?:[?#].*)?$/, "$1noop$2")
					.replace(/(:\/\/[^/]+\/+)(tos-[^/]+\/+.*)/, "$1img/$2")
					.replace(/\?imageView2.*$/, ""),*/
				can_head: false // 404
			};

			// https://v16.muscdn.com/31e4c5f591859bacb8fc9b7b3babf6b8/5e771718/video/tos/useast2a/tos-useast2a-ve-0068c002/8e6887884f1e4942a608f092bdea10b4/
			//  http://v19.muscdn.com/1689da26e0ec6e5f9b2545b4e610abfa/5e771702/video/tos/useast2a/tos-useast2a-ve-0068c001/f168a57c2c9f401db55337c7dab5e210/
			if (/^v[0-9]*\./.test(domain) && string_indexof(src, "/video/") >= 0) {
				obj.video = true;
			}

			return obj;
		}

		if (false) {
			// old tiktok rule
			newsrc = src
				.replace(/(\/img\/+[^/]*\/+[0-9a-f]+~)[^/.]*?(\.[^/.]*)(?:[?#].*)?$/, "$1noop$2")
				.replace(/\/large(\/+[^/]*\/+[0-9a-f]+)(?:\.[^/.]*)?(?:[?#].*)?$/, "/img$1~noop.jpeg")
				.replace(/\/(?:aweme|list)\/+[0-9]+x[0-9]+\/+/, "/obj/")
				.replace(/\?imageView2.*/, "");
			if (newsrc !== src)
				return newsrc;

			return {
				url: src,
				can_head: false // 404
			};
		}

		if (false && domain_nosub === "akamaized.net" &&
			domain.match(/^p[0-9]*-tiktokcdn-com\./)) {
			// https://p16-tiktokcdn-com.akamaized.net/large/v0201/a4d90921ec0947ed959b757497367d9e.jpg
			//   https://p16-tiktokcdn-com.akamaized.net/obj/v0201/a4d90921ec0947ed959b757497367d9e.jpg
			return src.replace(/(:\/\/[^/]*\/)[a-z]+\//, "$1obj/");
		}

		if (domain_nosub === "tiktokcdn.com" && /^p[0-9]*-sign-[^/.]+\./.test(domain)) {
			// thanks to remlap:
			// https://p16-sign-useast2a.tiktokcdn.com/tos-useast2a-avt-0068-euttp/743d32a7bc416238c4c06f57c873ab10~c5_100x100.jpeg?...
			//   https://p16-useast2a.tiktokcdn.com/tos-useast2a-avt-0068-euttp/743d32a7bc416238c4c06f57c873ab10~c5_100x100.jpeg
			return src.replace(/(:\/\/p[0-9]+-)sign-([^/]+\/[^?#]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nosub === "tiktokcdn.com" && /^p[0-9]*-sign-(?:va|sg)\./.test(domain)) {
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/426
			// https://p16-sign-va.tiktokcdn.com/tos-maliva-p-0068/3cc29b70b9ed45d1b86f5a525da02f13_1598931018~tplv-tiktokx-360p.image?x-expires=1599033600&x-signature=%2BJAF%2BVz2hXai0gjnYm6R97lLk7c%3D
			//   https://p16-amd-va.tiktokcdn.com/tos-maliva-p-0068/3cc29b70b9ed45d1b86f5a525da02f13_1598931018~noop.image
			//   https://p16-amd-va.tiktokcdn.com/origin/tos-maliva-p-0068/3cc29b70b9ed45d1b86f5a525da02f13_1598931018.jpg
			//   https://p16-amd-va.tiktokcdn.com/origin/tos-maliva-p-0068/3cc29b70b9ed45d1b86f5a525da02f13_1598931018.png
			// https://p16-sign-va.tiktokcdn.com/obj/tos-maliva-p-0068/af3de2fba1d14be1acec66e680ace0f0?x-expires=1599188400&x-signature=46nLVCmcHczpmYo4rev%2FJRILYso%3D
			//   https://p16-amd-va.tiktokcdn.com/origin/tos-maliva-p-0068/af3de2fba1d14be1acec66e680ace0f0.jpeg
			// https://p16-sign-sg.tiktokcdn.com/aweme/300x400/v0201/351a548f244242b083bd25ad4694f1fa.jpeg?x-expires=1599037200&x-signature=zWvZpPwroz0zMoF%2Fu5amBRicWEI%3D
			//   https://p16-amd-va.tiktokcdn.com/origin/v0201/351a548f244242b083bd25ad4694f1fa.jpeg
			// https://p16-sign-va.tiktokcdn.com/musically-maliva-obj/1663656694255621~c5_100x100.jpeg?x-expires=1599156000&x-signature=nStsWM6ZtewLuGlGbLp5N9o6MTg%3D
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/431
			// https://p16-sign-sg.tiktokcdn.com/aweme/100x100/tiktok-obj/1628900944743426.webp?x-expires=1599253200&x-signature=xrIQhCpLscEARw5wUqQB5Nk1Tg8%3D
			//   https://p16-amd-va.tiktokcdn.com/origin/tiktok-obj/1628900944743426.webp
			// https://p16-amd-va.tiktokcdn.com/tiktok-obj/1628900944743426~c5_168x168.webp
			//   https://p16-amd-va.tiktokcdn.com/tiktok-obj/1628900944743426~c5_168x168.webp
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/454
			// https://p77-sign-sg.tiktokcdn.com/musically-maliva-obj/1640051850297350~c5_100x100.jpeg?x-expires=1601161200&x-signature=bCErvp6OtiUTB9NRl4nqNTaiob0%3D
			//   https://p16-amd-va.tiktokcdn.com/origin/musically-maliva-obj/1640051850297350.jpeg
			// other:
			// https://p16-sign-useast2a.tiktokcdn.com/tos-useast2a-p-0037-euttp/b95d129e2ff14122bef33948911eb698_1693929750~tplv-photomode-zoomcover:480:480.avif?...
			return src.replace(/:\/\/[^/]+\/+([^?#&]+)(?:[?#].*)?$/, "://p16-amd-va.tiktokcdn.com/$1");
		}

		if (domain_nosub === "tiktokcdn-us.com" && /^p[0-9]*-sign/.test(domain)) {
			// thanks to anonymous for reporting:
			 // https://p16-sign.tiktokcdn-us.com/tos-useast5-avt-0068-tx/58ccf604486bbcdb183b63577c5f1070~c5_100x100.jpeg?x-expires=1692712800&x-signature=BXehwnY2iEt1bt5W8udDdMpZMKc%3D
			 //   https://p16.tiktokcdn-us.com/tos-useast5-avt-0068-tx/58ccf604486bbcdb183b63577c5f1070~c5_100x100.jpeg
			 //   https://p16.tiktokcdn-us.com/origin/tos-useast5-avt-0068-tx/58ccf604486bbcdb183b63577c5f1070.jpeg
			 return src.replace(/:\/\/(p[0-9]+)-sign(?:-[^/.]+)?(\.[^?#]+)(?:[?#].*)?$/, "://$1$2");
		}

		if (domain_nosub === "bcyimg.com" && /^p[0-9]*-bcy-sign\./.test(domain)) {
			// thanks to contextnerror on github for reporting: https://github.com/qsniyg/maxurl/issues/972
			// https://p3-bcy-sign.bcyimg.com/banciyuan/d651da348a5042fea13103a439dd90b4~tplv-banciyuan-w650.image?x-expires=...&x-signature=...
			//   https://p1-bcy.byteimg.com/origin/banciyuan/d651da348a5042fea13103a439dd90b4.png
			return src.replace(/:\/\/[^/]+\/+(banciyuan\/[^?#&]+)(?:[?#].*)?$/, "://p1-bcy.byteimg.com/img/$1");
		}

		if (host_domain_nowww === "bcy.net" && !src && options.element) {
			// thanks to contextnerror on github for reporting: https://github.com/qsniyg/maxurl/issues/972
			let parent = options.element.parentElement;
			if (parent && parent.tagName === "A") {
				let dparent = parent.parentElement;
				if (dparent && dparent.tagName === "DIV" && dparent.classList.contains("publish-loaf")) {
					// youtube/etc social icons
					return {
						url: origsrc,
						bad: "mask"
					}
				}
			}
		}

		if (domain === "img-bcy-qn.pstatp.com") {
			// https://img-bcy-qn.pstatp.com/coser/8816/post/c0c4i/en6yuxycdg7zzcvublf3vnowstzelqh7.jpg/tl640 -- 640x640
			//   https://img-bcy-qn.pstatp.com/coser/8816/post/c0c4i/en6yuxycdg7zzcvublf3vnowstzelqh7.jpg -- 2976x3968
			// https://img-bcy-qn.pstatp.com/coser/8816/post/c0c4i/rguwkd8k1n1nxusj02riziiqof1ud9j2.jpg/2X2 -- 200x200
			//   https://img-bcy-qn.pstatp.com/coser/8816/post/c0c4i/rguwkd8k1n1nxusj02riziiqof1ud9j2.jpg -- 2976x3968
			// https://img-bcy-qn.pstatp.com/Public/Upload/avatar/48018/7821a87235884bdf98f24948ec407d93/fat.jpg/abig
			//   https://img-bcy-qn.pstatp.com/Public/Upload/avatar/48018/7821a87235884bdf98f24948ec407d93/fat.jpg -- upscaled? 500x500
			//   https://img-bcy-qn.pstatp.com/Public/Upload/avatar/48018/7821a87235884bdf98f24948ec407d93/small.jpg -- 30x30
			//   https://img-bcy-qn.pstatp.com/Public/Upload/avatar/48018/7821a87235884bdf98f24948ec407d93/big.jpg -- 150x150
			return src
				.replace(/(\/post\/[a-z0-9]+\/[a-z0-9]+\.[^/.]*)\/[^/]*(?:[?#].*)?$/, "$1")
				.replace(/(\/avatar\/[0-9]+\/[a-f0-9]+\/[^/]*\.[^/.]*)\/[^/]*(?:[?#].*)?$/, "$1");
		}

		if (domain === "tuchong.pstatp.com") {
			// https://tuchong.pstatp.com/267685/g/6945495.jpg
			//   https://tuchong.pstatp.com/267685/f/6945495.jpg -- 800x1200
			// https://tuchong.pstatp.com/3557775/ft640/553265620.jpg
			//   https://tuchong.pstatp.com/3557775/f/553265620.jpg
			return add_full_extensions(src.replace(/(\/[0-9]+\/+)[a-z](?:t[0-9]+)?(\/+[0-9]+\.[^/.]*)(?:[?#].*)?$/,
												   "$1f$2"));
		}

		if (domain === "p16-sg-default.akamaized.net") {
			// https://p16-sg-default.akamaized.net/china-img/aweme/200x200/330600193414987bd95e.jpeg
			//   https://p0.pstatp.com/origin/330600193414987bd95e.jpeg
			return src.replace(/^[a-z]+:\/\/[^/]+\/+china-img\/+/, "https://p0.pstatp.com/");
		}

		if (domain_nosub === "tiktokcdn.com" && /^v[0-9]*m?(?:-[^.]+)?\./.test(domain) && string_indexof(src, "/video/") >= 0) {
			// https://v21.tiktokcdn.com/video/n/v0102/ab13a0512d41473bb07c555205e2d0b2/
			// https://v19-web-newkey.tiktokcdn.com/...
			return {
				url: src,
				video: true,
				can_head: false,
				headers: {
					Referer: "https://www.tiktok.com/"
				}
			};
		}

		if (domain === "img.jizy.cn") {
			// l, m, s
			// https://img.jizy.cn/img/m/276318
			//   https://img.jizy.cn/img/l/276318
			return src.replace(/\/img\/[a-z]\//, "/img/l/");
		}

		if (domain === "v.img.pplive.cn") {
			// http://v.img.pplive.cn/sp240/ac/70/ac70a84165ea6782446f267948a0cd4e/3.jpg.webp
			//   http://v.img.pplive.cn/ac/70/ac70a84165ea6782446f267948a0cd4e/3.jpg.webp
			return src.replace(/(:\/\/[^/]*\/)sp[0-9]+\//, "$1");
		}

		if (domain === "uploadfile.bizhizu.cn") {
			// http://uploadfile.bizhizu.cn/2015/0821/20150821111539262.jpg
			//   http://uploadfile.bizhizu.cn/2015/0821/20150821111539262.jpg.source.jpg
			// http://uploadfile.bizhizu.cn/2017/1014/f9ddc2a68f0f516dcdbdbc0a32a7d187.jpg
			//   https://uploadfile.bizhizu.cn/2017/1014/f9ddc2a68f0f516dcdbdbc0a32a7d187.jpg.source.jpg
			// https://uploadfile.bizhizu.cn/up/ef/7e/ae/ef7eaed1fa63be09208d2baef700bd75.jpg.220.146.jpg
			//   https://uploadfile.bizhizu.cn/up/ef/7e/ae/ef7eaed1fa63be09208d2baef700bd75.jpg.source.jpg
			return src.replace(/(\/[0-9a-f]*\.)([^/.]*)(?:\.[0-9]+\.[0-9]+\.[^/.]*)?$/, "$1$2.source.$2");
		}

		if (domain_nosub === "tgbusdata.cn" ||
			domain_nosub === "tuwandata.com") {
			// http://tv05.tgbusdata.cn/v3/thumb/jpg/YzhlMyw2MDAsNjAwLDQsMywxLC0xLDE=/u/shouji.tgbus.com/uploads/allimg/1508/17/3200-150QG32232.jpg
			//   http://shouji.tgbus.com/uploads/allimg/1508/17/3200-150QG32232.jpg
			// http://img2.tgbusdata.cn/v2/thumb/jpg/YzQ0NSw4MzAsNjQwLDQsMywxLC0xLDAscms1MA==/u/olpic.tgbusdata.cn/uploads/allimg/160324/238-160324160031.jpg
			//   http://olpic.tgbusdata.cn/uploads/allimg/160324/238-160324160031.jpg
			// http://img2.tgbusdata.cn/v2/thumb/jpg/MmIwZCw3MzAsNzMwLDQsMSwxLC0xLDAscms1MA==/u/olpic.tgbusdata.cn/uploads/allimg/121107/62-12110G34539.jpg
			//   http://olpic.tgbusdata.cn/uploads/allimg/121107/62-12110G34539.jpg
			// http://olpic.tgbusdata.cn/uploads/allimg/130415/62-1304151Q4110-L.jpg
			// http://ol04.tgbusdata.cn/v2/thumb/jpg/NmIxMSwwLDAsNCwzLDEsLTEsMCxyazUw/u/olpic.tgbusdata.cn/uploads/allimg/150408/144-15040QI505.jpg
			//   http://olpic.tgbusdata.cn/uploads/allimg/150408/144-15040QI505.jpg
			// http://img2.tgbusdata.cn/v2/thumb/jpg/NWM0NywwLDAsNCwzLDEsLTEsMCxyazUw/u/olpic.tgbusdata.cn/uploads/allimg/160321/274-160321115611.jpg
			//   http://olpic.tgbusdata.cn/uploads/allimg/160321/274-160321115611.jpg
			// http://img1.tuwandata.com/v2/thumb/all/NWI3OSw4MDEsMjAwLDQsMywxLC0xLDAsLCw5MA==/u/www.tuwan.com/uploads/allimg/1712/20/793-1G220135S0.jpg
			//   http://www.tuwan.com/uploads/allimg/1712/20/793-1G220135S0.jpg
			return src.replace(/.*\/thumb\/[^/]*\/[^/]*\/u\//, "http://");
		}

		if (domain_nowww === "dajiazhao.com" ||
			// http://www.hscbw.com/upfile/allimg/140619/6-140619123005-lp.jpg
			//   http://www.hscbw.com/upfile/allimg/140619/6-140619123005.jpg
			domain_nowww === "hscbw.com" ||
			// https://www.xgkoushi.com/uploads/allimg/181009/21202060O-0-lp.jpg
			//   https://www.xgkoushi.com/uploads/allimg/181009/21202060O-0.jpg
			domain_nowww === "xgkoushi.com" ||
			// http://youdew88yl.com/uploads/allimg/181013/1152024443-0-lp.jpg
			//   http://youdew88yl.com/uploads/allimg/181013/1152024443-0.jpg
			domain_nowww === "youdew88yl.com" ||
			// http://www.nvshenmen.com/uploads/allimg/20190412/1555055498637313-lp.png
			//   http://www.nvshenmen.com/uploads/allimg/20190412/1555055498637313.png
			domain_nowww === "nvshenmen.com" ||
			// http://www.sfyry.com/uploads/allimg/190510/1012211310-0-lp.jpg
			//   http://www.sfyry.com/uploads/allimg/190510/1012211310-0.jpg
			domain_nowww === "sfyry.com" ||
			// http://www.ynjzsf.com/uploads/allimg/171214/0116312931-0-lp.jpg
			//   http://www.ynjzsf.com/uploads/allimg/171214/0116312931-0.jpg
			domain_nowww === "ynjzsf.com" ||
			src.match(/:\/\/[^/]*\/+(?:uploads|upfile)\/+allimg\/+[0-9]{6,8}\/+[0-9]+-[0-9A-Z]+-lp\.[^/.]*(?:[?#].*)?$/)) {
			// http://www.dajiazhao.com/uploads/allimg/180517/1-1P51G00459264-lp.jpg -- 240x135
			//   http://www.dajiazhao.com/uploads/allimg/180517/1-1P51G00459264.jpg -- 1920x1080
			return src.replace(/(\/(?:uploads|upfile)\/+allimg\/+[0-9]+\/+[0-9A-Z]+(?:-[0-9A-Z]+)?)(?:-lp)(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nosub === "taopic.com" && domain.match(/^pic[0-9]*\./)) {
			// http://pic01.taopic.com/180402/235105-1P4020Q04920-lp.jpg
			//   http://img01.taopic.com/180402/235105-1P4020Q04920.jpg
			return src.replace(/:\/\/pic([0-9]*\.[^/]*\/[0-9]+\/[0-9]+-[A-Z0-9]+)-[a-z]+(\.[^/.]*)$/,
							   "://img$1$2");
		}

		if (domain_nowww === "renwenjun.com") {
			// http://www.renwenjun.com/uploads/allimg/170929/12012X635_lit.jpg
			//   http://www.renwenjun.com/uploads/allimg/170929/12012X635_0.jpg
			return src.replace(/_lit(\.[^/.]*)$/, "_0$1");
		}

		if (domain_nowww === "9x2.net" ||
			// http://img1.izaoxing.com/allimg/c190726/1564095V601350-1T58_lit.jpg
			//   http://img1.izaoxing.com/allimg/c190726/1564095V601350-1T58.jpg
			(domain_nosub === "izaoxing.com" && /^img[0-9]*\./.test(domain))) {
			// http://www.9x2.net/uploads/allimg/c150117/14214X005960-129259_lit.jpg
			//   http://www.9x2.net/uploads/allimg/c150117/14214X005960-129259.jpg
			return src.replace(/_lit(\.[^/.]*)$/, "$1");
		}

		if (domain_nowww === "lrfczp.com") {
			// http://lrfczp.com/uploads/allimg/17090908/co1FZ9201H5-0_160_220.jpg
			//   http://lrfczp.com/uploads/allimg/17090908/co1FZ9201H5-0.jpg
			return src.replace(/_[0-9]+_[0-9]+(\.[^/.]*)$/, "$1");
		}

		if (domain === "img-toutiao.mia.com") {
			// https://img-toutiao.mia.com/d78e5392e7c518f7870c4ef9941b9809_img@base@tag=imgScale&q=60
			return src.replace(/\&.*/, ""); // removing @ works, but forces download, and very big images have imgScale so it's probably fine
		}

		if (domain_nosub === "xeeok.com" && string_indexof(domain, "pic.xeeok.com") >= 0) {
			// http://spic.xeeok.com/uploads/20171228/201712281413013469/297453_001_s.jpg
			//   http://spic.xeeok.com/uploads/20171228/201712281413013469/297453_001.jpg
			// http://pic.xeeok.com/uploads/20170406/201704060839007259/257437_001.jpg
			// http://pic.xeeok.com/uploads/20171208/201712080649411660/11988_007_s1024.jpg
			//   http://pic.xeeok.com/uploads/20171208/201712080649411660/11988_007.jpg
			//
			// http://pic.xeeok.com/uploads/20170902/201709021724546130/9683_010.jpg -- 001 = first image in album, not size
			return src.replace(/_s[0-9]*(\.[^/.]*)$/, "$1");
		}

		if (domain === "img.laonanren.com" ||
			// thanks to BiZkViT on discord:
			// https://m6.imhentai.xxx/020/iu9loafdqh/5t.jpg
			//   https://m6.imhentai.xxx/020/iu9loafdqh/5.jpg
			(domain_nosub === "imhentai.xxx" && /^m[0-9]+/.test(domain) && /\/[0-9a-z]+\/+[0-9]+t\./.test(src)) ||
			// http://cf.whl4u.jp/wh27/images/gallery/products/415t.jpg
			//   http://cf.whl4u.jp/wh27/images/gallery/products/415.jpg
			domain === "cf.whl4u.jp") {
			// https://img.laonanren.com/upload2/2015-02/15020914251864t.jpg
			//   https://img.laonanren.com/upload2/2015-02/15020914251864.jpg
			return src.replace(/t(\.[^/.]*)$/, "$1");
		}

		if (domain_nosub === "xuite.net" && string_indexof(domain, ".share.photo.xuite.net") >= 0) {
			// https://4.share.photo.xuite.net/sm06059201/1469f4f/2721202/257867165_c.jpg
			// https://e.share.photo.xuite.net/esther1793/1e6a1d9/19835410/1124368327_x.jpg
			// https://7.share.photo.xuite.net/anber314/17e2d43/16287589/875503326_z.jpg (z > y, but y = 1.9mb, z = 900kb. larger, but a bit of quality is lost)
			// x and X are the same etc., o doesn't work
			// z, y, x, l, m, s, c, q, t (c is larger than x for gifs)
			return src.replace(/_[a-zA-Z](\.[^/.]*)$/, "_y$1");
		}

		if (domain === "img.sportsv.net") {
			// https://img.sportsv.net/img/ablheadline/cover/6/56/fit-fcc38HPLxU-1045x340.jpg
			//   https://img.sportsv.net/img/ablheadline/cover/6/56/fcc38HPLxU.jpg
			// https://img.sportsv.net/img/photo/image/5/78295/aspect-f3qjUcGTB2-1000xauto.jpg
			//   https://img.sportsv.net/img/photo/image/5/78295/f3qjUcGTB2.jpg
			// https://img.sportsv.net/img/photo/image/1/161211/tPkQGdrO3s.jpg
			return src.replace(/\/[a-z]+-([^-/]*)-[0-9a-z]*x[0-9a-z]*(\.[^/.]*)$/, "/$1$2");
		}

		if (domain_nosub === "espncdn.com") {
			// http://a3.espncdn.com/combiner/i?img=%2Fphoto%2F2017%2F0115%2Fr171425.jpg
			//   http://a3.espncdn.com/photo/2017/0115/r171425.jpg
			// http://a.espncdn.com/photo/2014/0615/nba_a_gindunc_288x162.jpg
			// http://a3.espncdn.com/photo/2016/0114/r44141_1296x729_16-9.jpg
			//   http://a3.espncdn.com/photo/2016/0114/r44141.jpg
			// http://a3.espncdn.com/combiner/i?img=%2Fphoto%2F2015%2F0429%2Fnba_g_crittenton1x_1296x729.jpg
			//   http://a3.espncdn.com/photo/2015/0429/nba_g_crittenton1x_1296x729.jpg
			// http://a3.espncdn.com/photo/2013/0209/nba_jordan_36.jpg
			// http://a.espncdn.com/photo/2012/0930/rn_georgiatennessee_ms_21.jpg
			// http://a.espncdn.com/photo/2013/0922/nfl_u_darnelldockett_cmg_600.jpg
			// http://a.espncdn.com/combiner/i?img=/i/headshots/nba/players/full/2968436.png&w=350&h=254
			//   http://a.espncdn.com/i/headshots/nba/players/full/2968436.png
			// thanks to roi:
			// http://a.espncdn.com/photo/2017/0828/r250288_2_600x400_3-2.jpg
			//   http://a.espncdn.com/photo/2017/0828/r250288_2.jpg
			newsrc = decodeURIComponent(src.replace(/\/combiner\/i\?img=([^&]*).*/, "$1"));
			if (newsrc !== src)
				return newsrc;

			newsrc = src.replace(/(\/r[0-9]+(?:_[0-9]+)?)(?:_[^/.]*)(\.[^/.]*)$/, "$1$2");
			if (newsrc !== src)
				return newsrc;
		}

		if (host_domain_nosub === "fc2.com" && options.element) {
			if (options.element.tagName === "svg" && options.element.parentElement && options.element.parentElement.tagName === "DIV") {
				if (string_indexof(options.element.parentElement.getAttribute("class"), "c-videoThumbOver") >= 0)
					return {
						url: origsrc,
						bad: "mask"
					};
			}
		}

		if (domain_nosub === "fc2.com" && domain.match(/blog-imgs-[0-9]*(?:-[^.]*)?.*\.fc2\.com/)) {
			// https://blog-imgs-118.fc2.com/s/h/i/shiomusubinokasu/20171212120106s.jpg
			//   https://blog-imgs-118-origin.fc2.com/s/h/i/shiomusubinokasu/20171212120106.jpg
			// https://blog-imgs-77-origin.fc2.com/t/r/e/trendbooks/IMG_0012_201804162120240e6s.jpg
			//   https://blog-imgs-77-origin.fc2.com/t/r/e/trendbooks/IMG_0012_201804162120240e6.jpg
			// http://blog-imgs-82-origin.fc2.com/s/w/e/sweettriangle2/0c262356s.jpg
			//   http://blog-imgs-82-origin.fc2.com/s/w/e/sweettriangle2/0c262356.jpg
			// http://blog-imgs-13.fc2.com/a/k/u/akuma777xx/sofuto060as.jpg
			//   http://blog-imgs-13-origin.fc2.com/a/k/u/akuma777xx/sofuto060a.jpg
			// https://blog-imgs-38-origin.fc2.com/n/e/t/netateki/0832b476323d6891250f-1024s.jpg
			//   https://blog-imgs-38-origin.fc2.com/n/e/t/netateki/0832b476323d6891250f-1024.jpg
			newsrc = src.replace(/:\/\/(blog-imgs-[0-9]*)\./, "://$1-origin.");
			if (newsrc !== src)
				return newsrc;

			return src.replace(/s(\.[^/.]*)$/, "$1");
		}

		if (domain === "blogthumbnail.fc2.com") {
			// thanks to anonymous for reporting:
			// https://blogthumbnail.fc2.com/r72/102/d/i/a/dia3/fc2blog_20181110193158e7e.jpg
			//   https://blog-imgs-102-origin.fc2.com/d/i/a/dia3/fc2blog_20181110193158e7e.jpg
			return src.replace(/:\/\/[^/]+\/+r[0-9]+\/+([0-9]+)\/+/, "://blog-imgs-$1.fc2.com/");
		}

		if (domain === "video.fc2.com") {
			var query_fc2 = function(pageurl, token, id, cb) {
				api_query("fc2_api:" + id, {
					url: "https://video.fc2.com/api/v3/videoplaylist/" + id + "?sh=1&fs=0",
					imu_mode: "xhr",
					headers: {
						Referer: pageurl,
						"X-FC2-Video-Access-Token": token
					},
					json: true
				}, cb, function(done, json, cache_key) {
					var playlist = json.playlist;

					var newurl = playlist.nq || playlist.sample;

					if (!newurl) {
						console_error(cache_key, "Unable to find playlist URL", json);
						return done(null, false);
					}

					var obj = {
						url: urljoin(pageurl, newurl, true),
						extra: {
							page: pageurl
						},
						headers: {
							Referer: pageurl
						},
						referer_ok: {
							same_domain_nosub: true
						},
						video: true
					};

					return done(obj, 6*60*60);
				});
			};

			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+(?:a\/+)?content\/+([0-9a-zA-Z]+)(?:[?#&].*)?$/,
				query_for_id: "https://video.fc2.com/content/${id}",
				process: function(done, resp, cache_key, match) {
					var id = match[1];

					var match = resp.responseText.match(/window\.FC2VideoObject\.push\(\['..',\s*'([0-9a-f]{10,})'/);
					if (!match) {
						console_error(cache_key, "Unable to find access token for", resp);
						return done(null, false);
					}

					var token = match[1];
					query_fc2(resp.finalUrl, token, id, function(data) {
						if (!data) return done(null, false);

						return done(data, 6*60*60);
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nosub === "fc2.com" && /^(?:vip-)?video[0-9]*-thumbnail[0-9]*\./.test(domain)) {
			// https://video8-thumbnail2.fc2.com/up/thumb/202003/16/r/20200316ruCdutuy.jpg
			//   https://video8-thumbnail2.fc2.com/up/thumb2/202003/16/r/20200316ruCdutuy.jpg
			// https://video2-thumbnail2.fc2.com/up/member/85/09/mb_pict_icon_14390985.JPG?20200116211601
			//   https://video2-thumbnail2.fc2.com/up/member/85/09/mb_pict_14390985.JPG?20200116211601
			// https://video-thumbnail2.fc2.com/w240h135/vip.video52000.fc2.com/up/thumb2/202001/26/v/20200126vgUPMh2x.jpg
			//   http://vip.video52000.fc2.com/up/thumb2/202001/26/v/20200126vgUPMh2x.jpg
			obj = {
				url: src
			};

			id = null;
			match = src.match(/\/up\/+thumb[0-9]*\/+[0-9]{6}\/+[0-9]{2}\/+.\/+([0-9]{8}[a-zA-z0-9]+)\./);
			if (match) {
				id = match[1];

				obj.extra = {page: "https://video.fc2.com/content/" + id};
			}

			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+(?:[wh][0-9]+){1,2}\/+([^/]+\.fc2\.com\/)/, "http://$1");
			if (newsrc !== src)
				return fillobj_urls([newsrc, src], obj);

			newsrc = src.replace(/(\/member\/+[0-9]+\/+[0-9]+\/+mb_pict_)icon_/, "$1");
			if (newsrc !== src)
				return fillobj_urls([newsrc, src], obj);

			// https://vip-video82000-thumbnail2.fc2.com/up/thumb/201912/11/Y/20191211YDRY2vyn.jpg
			//   https://vip-video82000-thumbnail2.fc2.com/up/thumb2/201912/11/Y/20191211YDRY2vyn.jpg
			newsrc = src.replace(/\/up\/+thumb\/+([0-9]{6}\/+)/, "/up/thumb2/$1");
			if (newsrc !== src)
				return fillobj_urls([newsrc, src], obj);

			if (id) {
				return {
					url: obj.extra.page,
					is_pagelink: true
				};
			}

			return obj;
		}

		if (domain_nosub === "fc2.com" && /^contents-thumbnail[0-9]*\./.test(domain)) {
			// thanks to vscum on github: https://github.com/qsniyg/maxurl/issues/1191
			// https://contents-thumbnail2.fc2.com/w240/storage75000.contents.fc2.com/file/376/37514663/1672125492.95.jpg
			//   https://storage75000.contents.fc2.com/file/376/37514663/1672125492.95.jpg
			return src.replace(/:\/\/[^/]+\/+w[0-9]+\/+(storage[0-9]+\.contents\.fc2\.com\/)/, "://$1");
		}

		if (domain === "photos.hancinema.net" ||
			domain_nowww === "hancinema.net") {
			// https://photos.hancinema.net/photos/posterphoto679289.jpg
			//   https://photos.hancinema.net/photos/fullsizephoto679289.jpg
			// https://www.hancinema.net/photos/photo954334.jpg
			//   https://www.hancinema.net/photos/fullsizephoto954334.jpg
			return src.replace(/\/photos\/[a-z]*(photo[0-9]*\.[^/.]*)$/, "/photos/fullsize$1");
		}

		// OpenCart
		if (domain_nowww === "inimura.com" ||
			// https://www.celebritydresses.shop/image/cache/data/category_59/1133Lisa%20Rinna%20Red%20Sexy%20Prom%20Dress%20For%20Women%202009%20SAG%20Awards%20Red%20Carpet-800x800.jpg
			//   https://www.celebritydresses.shop/image/data/category_59/1133Lisa%20Rinna%20Red%20Sexy%20Prom%20Dress%20For%20Women%202009%20SAG%20Awards%20Red%20Carpet.jpg
			domain_nowww === "celebritydresses.shop" ||
			// http://www.thecelebritydresses.us/image/cache/data/02015-01-29/Felicity-Jones-Teal-Green-High-collared-Formal-Dress-2015-Golden-Globe-Awards-Red-Carpet-4-100x100.jpg
			//   http://www.thecelebritydresses.us/image/data/02015-01-29/Felicity-Jones-Teal-Green-High-collared-Formal-Dress-2015-Golden-Globe-Awards-Red-Carpet-4.jpg
			domain_nowww === "thecelebritydresses.us" ||
			// http://www.customcelebritydresses.com/image/cache/data/02014-08-20/Rita-Ora-Red-Sexy-High-Slit-Backless-V-neck-Prom-Dress-MTV-VMAs-2014-Red-Carpet-600x600.jpg
			domain_nowww === "customcelebritydresses.com" ||
			// https://realistgold.com/Cart/image/cache/catalog/product_oldschoolgold-500x500.png -- stretched
			//    https://realistgold.com/Cart/image/catalog/product_oldschoolgold.png
			domain_nowww === "realistgold.com" ||
			// https://supersoccershop.com/image/cache/catalog/jersey-16-17/National%20team%2016-17/France/france-griezmann-jersey-2016-soccer-shirt-kit-maillot-600x600.jpg
			//   https://supersoccershop.com/image/catalog/jersey-16-17/National%20team%2016-17/France/france-griezmann-jersey-2016-soccer-shirt-kit-maillot.jpg
			domain_nowww === "supersoccershop.com" ||
			// http://cheap-promdresses.com/image/cache/catalog/160714/celebrity_dress_keira_knightley_grey_strapless_chiffon_gown_the_duchess_premiere...-228x380.jpg
			//   http://cheap-promdresses.com/image/catalog/160714/celebrity_dress_keira_knightley_grey_strapless_chiffon_gown_the_duchess_premiere....jpg
			domain_nowww === "cheap-promdresses.com" ||
			// http://www.weandestudio.com/image/cache/data/category_12/20180717105918738802368-200x200-product_list.jpg
			//   http://www.weandestudio.com/image/data/category_12/20180717105918738802368.jpg
			domain_nowww === "weandestudio.com" ||
			// https://www.black-leatherjacket.com/image/cache/data/Olive-green-leann-rimes-leather-jacket/olive-green-leather-jacket-900x900.jpg
			//   https://www.black-leatherjacket.com/image/data/Olive-green-leann-rimes-leather-jacket/olive-green-leather-jacket.jpg
			domain_nowww === "black-leatherjacket.com" ||
			// https://kpopultra.net/image/cache/catalog/bts-kpop-kawaii-harajuku/harajuku-fashion/swimwear-bikini/2/harajuku-swimwear-21-250x250.jpg
			//   https://kpopultra.net/image/catalog/bts-kpop-kawaii-harajuku/harajuku-fashion/swimwear-bikini/2/harajuku-swimwear-21.jpg
			domain_nowww === "kpopultra.net" ||
			// https://www.myhaircare.com.au/image/cache/data/tigi-catwalk-sleek-mystique-calming-conditioner-470x470.jpg
			//   https://www.myhaircare.com.au/image/data/tigi-catwalk-sleek-mystique-calming-conditioner.jpg
			domain_nowww === "myhaircare.com.au" ||
			// http://ultimateapparels.com/image/cache/data/2015/Oct15/%20NOVEMBER%201/New-Peyton-List-Black-Bomber-Ladies-Biker-Jacket-450x450.jpg
			//   http://ultimateapparels.com/image/data/2015/Oct15/%20NOVEMBER%201/New-Peyton-List-Black-Bomber-Ladies-Biker-Jacket.jpg
			domain_nowww === "ultimateapparels.com" ||
			// https://www.cajalwinterconference.es/image/cache/data/category_3/forever-new-embroidered-dress-vestido-informal-negro-fod21c00m-q11-lclqqfz-ropa--2322-600x600_0.jpg
			//   https://www.cajalwinterconference.es/image/data/category_3/forever-new-embroidered-dress-vestido-informal-negro-fod21c00m-q11-lclqqfz-ropa--2322.jpg
			domain_nowww === "cajalwinterconference.es" ||
			// https://www.justfashionnow.com/image_cache/resize/335x445/image/catalog/product/2019-03-26/8sWmRmr-jpg-1553581216464.jpeg
			//   https://www.justfashionnow.com/image/catalog/product/2019-03-26/8sWmRmr-jpg-1553581216464.jpeg
			domain_nowww === "justfashionnow.com" ||
			// https://mall.3785tv.com/image/cache/catalog/g316/CIMG662920180821152620-3606-600x600.jpg
			//   https://mall.3785tv.com/image/catalog/g316/CIMG662920180821152620-3606.jpg
			domain === "mall.3785tv.com" ||
			// https://www.layla-lingerie.com/image/cache/data/1403/NA14030025/6079-800x800.jpg
			//   https://www.layla-lingerie.com/image/data/1403/NA14030025/6079.jpg
			domain_nowww === "layla-lingerie.com" ||
			// https://www.fnac-andorra.com/image/cache/productes/6-0075678669668-487x487.jpg
			//   https://www.fnac-andorra.com/image/productes/6-0075678669668.jpg
			domain_nowww === "fnac-andorra.com" ||
			// https://www.keymailrecords.com/image/cache/catalog/7764961_00001-800x800.jpg -- upscaled
			//   https://www.keymailrecords.com/image/catalog/7764961_00001.jpg -- 569x569
			domain_nowww === "keymailrecords.com" ||
			// http://www.bdmaster.net/image/cache/data/posters/1477834-700x1037.jpg
			//   http://www.bdmaster.net/image/data/posters/1477834.jpg
			domain_nowww === "bdmaster.net" ||
			// https://prettyzone.net/image/cache/catalog/category/manikyur-lak-90x90.jpg
			//   https://prettyzone.net/image/catalog/category/manikyur-lak.jpg
			domain_nowww === "prettyzone.net" ||
			// https://filmstarjackets.com/image/cache/data/Nov15/mal-descendants-dove-cameron-leather-jacket-1000x1100.jpg
			//   https://filmstarjackets.com/image/data/Nov15/mal-descendants-dove-cameron-leather-jacket.jpg
			domain_nowww === "filmstarjackets.com" ||
			// https://www.moviesjacket.com/image/cache/data/lily-collins-mortal-instruments-clary-fray-leather-jacket/mortal-instruments-leather-jacket-70x106.jpg
			//   https://www.moviesjacket.com/image/data/lily-collins-mortal-instruments-clary-fray-leather-jacket/mortal-instruments-leather-jacket.jpg -- upscaled?
			domain_nowww === "moviesjacket.com" ||
			// https://www.af-hobby.com/image/cache/catalog/Figure/Prize%20Figure/Fate/Taito/Jack%20The%20Ripper/s-l1600%20(1)-228x228.jpg
			//   https://www.af-hobby.com/image/catalog/Figure/Prize%20Figure/Fate/Taito/Jack%20The%20Ripper/s-l1600%20(1).jpg
			domain_nowww === "af-hobby.com" ||
			// http://sky-seller.com/image/cache/data/Game_Jackets/Assassins_Creed_Syndicate_Jack_Ripper_Black_Game_Coat-800x800.jpg
			//   http://sky-seller.com/image/data/Game_Jackets/Assassins_Creed_Syndicate_Jack_Ripper_Black_Game_Coat.jpg
			domain_nowww === "sky-seller.com" ||
			// http://www.i-aurai.com/OpenCart/image/cache/data/demo/apple_cinema_30-80x80.jpg
			//   http://www.i-aurai.com/OpenCart/image/data/demo/apple_cinema_30.jpg
			domain_nowww === "i-aurai.com" ||
			// http://www.onesieponatime.com/image/cache/data/NHL%20Edmongton%20Oilers%20Onesie-500x500.jpg
			//   http://www.onesieponatime.com/image/data/NHL%20Edmongton%20Oilers%20Onesie.jpg
			domain_nowww === "onesieponatime.com" ||
			// http://ucanstarjob.com/image/cache/catalog/651525photo_1478496700262_m-600x600.product_main.jpg
			//   http://ucanstarjob.com/image/catalog/651525photo_1478496700262_m.jpg
			domain_nowww === "ucanstarjob.com" ||
			// http://beniko.ninethemes.net/opencart/image/cache/data/photodune-523529-glamorous-m-250x150w.jpg
			//   http://beniko.ninethemes.net/opencart/image/data/photodune-523529-glamorous-m.jpg
			domain === "beniko.ninethemes.net" ||
			// https://duvardamoda.com/image/cache/data/poster/kpkm-moda-kozmetik/aksesuar/kpkm-041-aksesuarli-manken-3d-duvar-kagidi-poster-300x200.jpg
			//   https://duvardamoda.com/image/data/poster/kpkm-moda-kozmetik/aksesuar/kpkm-041-aksesuarli-manken-3d-duvar-kagidi-poster.jpg
			domain_nowww === "duvardamoda.com" ||
			// http://fresh38.ru/image/cache/data/gifts/hobbi/master-klass-po-izgotovleniyu-bizhuterii/master-klass-po-izgotovleniyu-bizhuterii-1-600x400.jpg
			//   http://fresh38.ru/image/data/gifts/hobbi/master-klass-po-izgotovleniyu-bizhuterii/master-klass-po-izgotovleniyu-bizhuterii-1.jpg
			domain_nowww === "fresh38.ru" ||
			// https://www.malaysiadropship.com/image/creativeffects/image/cache/data/all_product_images/product-1707/1sexy-bikini-babydoll-yw672-536-850x1000-700x700.jpg
			//   https://www.malaysiadropship.com/image/creativeffects/image/data/all_product_images/product-1707/1sexy-bikini-babydoll-yw672-536-850x1000.jpg
			domain_nowww === "malaysiadropship.com" ||
			// http://yukite.ru/image/cache/data/product-29118/HTB1f17EGXXXXXXdXXXXq6xXFXXX5-585x650.jpg
			//   http://yukite.ru/image/data/product-29118/HTB1f17EGXXXXXXdXXXXq6xXFXXX5.jpg
			domain_nowww === "yukite.ru" ||
			// http://huzzk.com/image/cache/data/Vocaloid-Hatsune-Miku-Cosplay-Costume--MR-046-001--p11923551638/1-800x800.jpg
			//   http://huzzk.com/image/data/Vocaloid-Hatsune-Miku-Cosplay-Costume--MR-046-001--p11923551638/1.jpg
			domain_nowww === "huzzk.com" ||
			// http://www.gasookpopgalore.net/image/cache/data/product/CD/0T-Ara%20-%20Day%20By%20Day-158x158.jpeg
			//   http://www.gasookpopgalore.net/image/data/product/CD/0T-Ara%20-%20Day%20By%20Day.jpeg
			domain_nowww === "gasookpopgalore.net" ||
			// http://www.honeydear.my/image/cache/data/YW1031WH/213%20(4)-850x1300.jpg
			//   http://www.honeydear.my/image/data/YW1031WH/213%20(4).jpg
			domain_nowww === "honeydear.my" ||
			// https://americasuits.com/image/cache/catalog/the-queens-gambit-anya-taylor-joy-red-coat/The-Queens-Gambit-Anya-Taylor-Joy-Red-Coat-550x550h.jpg
			//   https://americasuits.com/image/catalog/the-queens-gambit-anya-taylor-joy-red-coat/The-Queens-Gambit-Anya-Taylor-Joy-Red-Coat.jpg
			domain_nowww === "americasuits.com" ||
			src.match(/^[a-z]+:\/\/[^/]+\/+image\/+cache\/+(?:data|catalog)\/.*-[0-9]+x[0-9]+\.[^/.]+(?:[?#].*)?$/)) {
			// https://inimura.com/image/cache/catalog/product/lingerie/0068-01-270x360.jpg
			//   https://inimura.com/image/catalog/product/lingerie/0068-01.jpg
			return src
				.replace(/\/image_cache\/+resize\/+[0-9]+x[0-9]+\/+image\/+/, "/image/")
				.replace(/\/cache\/(.*)-[0-9]+x[0-9]*(?:-[a-z_]+)?(?:_[0-9]+|[wh])?(?:\.[a-z_]+)?(\.[^/.]*(?:[?#].*)?)$/, "/$1$2");
			//return src.replace(/\/image\/cache\/data\/(.*)-[0-9]+x[0-9]+(\.[^/.]*)$/, "/image/data/$1$2");
			//return src.replace(/\/image\/cache\/(.*)-[0-9]+x[0-9]+(\.[^/.]*)$/, "/image/$1$2");
			//return src.replace(/\/image\/cache\/([a-z]+)\/(.*)-[0-9]+x(?:[0-9]+(?:[wh])?)?(?:\.[a-z_]+)?(\.[^/.]*)$/, "/image/$1/$2$3");
		}

		if (domain_nowww === "outlookweekly.net" && string_indexof(src, "/images/") >= 0) {
			// http://www.outlookweekly.net/images/cfile5.uf.tistory.com/image/2338CD4D5312E8CF036158
			//   http://cfile5.uf.tistory.com/image/2338CD4D5312E8CF036158
			// http://www.outlookweekly.net/thumbnail/s/styles-and-latest-fashion-trends-on-krazyfashionrocksblogspotcom-32.jpeg
			return src.replace(/.*:\/\/[^/]*\/images\//, "http://");
		}

		if (domain === "www.cdn.tv2.no" ||
			// thanks to fedesk on discord
			// https://image.klikk.no/4664450.jpg?imageId=4664450&x=0&y=0&cropw=100&croph=100&width=1000&height=1672
			//   https://image.klikk.no/4664450.jpg?width=-1&height=-1
			domain === "image.klikk.no" ||
			// thanks to fedesk on discord
			// https://image.side2.no/4664450.jpg?imageId=4664450&x=0&y=0&cropw=100&croph=100&width=480&height=803
			//   https://image.side2.no/4664450.jpg?width=-1&height=-1
			domain === "image.side2.no" ||
			// https://image.side3.no/4280643.jpg?imageId=4280643&x=0&y=0&cropw=100&croph=100&width=1000&height=666
			//   https://image.side3.no/4280643.jpg?width=-1&height=-1
			domain === "image.side3.no" ||
			// thanks to fedesk on discord
			// https://www.dagbladet.no/images/69566557.jpg?imageId=69566557&width=980&height=559&compression=80
			//   https://www.dagbladet.no/images/69566557.jpg?width=-1&height=-1
			// can be replaced to dbstatic.no
			domain_nowww === "dagbladet.no" ||
			// thanks to fedesk on discord:
			// https://www.seher.no/images/68749338.jpg?imageId=68749338&panow=0&panoh=0&panox=0&panoy=0&heightw=34.366197183099&heighth=100&heightx=48.169014084507&heighty=0&width=1200&height=630
			//   https://www.seher.no/images/68749338.jpg?width=-1&height=-1
			domain_nowww === "seher.no" ||
			// thanks to fedesk on discord:
			// https://image.underdusken.no/151158.jpg?imageId=151158&width=480&height=719
			//   https://image.underdusken.no/151158.jpg?width=-1&height=-1
			domain === "image.underdusken.no" ||
			// thanks to fyhtma on github: https://github.com/qsniyg/maxurl/issues/1203
			// https://image.seiska.fi/1112138.webp?imageId=1112138&width=710&format=webp
			//   https://image.seiska.fi/1112138.webp?width=-1&height=-1 -- 2500x1668
			//   https://image.seiska.fi/1112138.webp?width=-1&height=-1&format=jpg
			// https://image.seiska.fi/834926.webp?imageId=834926&x=0.00&y=0.00&cropw=100.00&croph=100.00&width=960&height=960&format=jpg
			//   https://image.seiska.fi/834926.webp?width=-1&height=-1 -- 625x484
			domain === "image.seiska.fi" ||
			// thanks to meloner on discord:
			// https://image.elle.no/833781.webp?imageId=833781&width=960&height=1440&format=webp
			//   https://image.elle.no/833781.webp?width=-1&height=-1&format=jpg
			domain === "image.elle.no" ||
			// https://image.nyheder.dk/1725449.webp?imageId=1725449&width=960&height=644&format=jpg
			//   https://image.nyheder.dk/1725449.webp?width=-1&height=-1&format=jpg
			domain === "image.nyheder.dk" ||
			// thanks to anonymous for reporting:
			// https://image.herognu.dk/4604537.webp?imageId=4604537&x=0.00&y=0.00&cropw=100.00&croph=100.00&width=1926&height=2890&format=webp -- upscaled?
			//   https://image.herognu.dk/4604537.webp?width=-1&height=-1&format=jpg -- 1667x2500
			domain === "image.herognu.dk" ||
			// https://www.dbstatic.no/68267011.jpg?imageId=68267011&x=0&y=0&cropw=100&croph=100&width=1024&height=1539
			//   https://www.dbstatic.no/68267011.jpg -- 100x150
			//   https://www.dbstatic.no/68267011.jpg?width=-1&height=-1 -- 1664x2500
			domain_nowww === "dbstatic.no") {
			// http://www.cdn.tv2.no/images?imageId=8999096&width=3000
			// thanks to fedesk on discord
			// https://www.cdn.tv2.no/?imageId=9698940&width=200&height=128
			//   https://www.cdn.tv2.no/images?imageId=9698940&height=-1
			//return src.replace(/\/images.*?[?&]imageId=([0-9]+).*/, "/images?imageId=$1&height=-1");
			//return src.replace(/(:\/\/[^/]*\/[0-9]+\.[^/.]*?)(?:\?.*)?$/, "$1?width=-1&height=-1");
			newsrc = src
				.replace(/(:\/\/[^/]+\/+(?:images\/+)?[0-9]+\.[^/.?#]*)(?:[?#].*)?$/, "$1?width=-1&height=-1")
				.replace(/\/(?:images)?\?(?:.*&)?imageId=([0-9]+).*/, "/?imageId=$1&height=-1")
				.replace(/(\/[0-9]+\.webp\?width=-1&height=-1)$/, "$1&format=jpg");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nowww === "media-spiceee.net") {
			// https://media-spiceee.net/uploads/content/image/828907/small_zzzzzzzzzzzzzzzzzzzzzzzz156.jpg
			//   https://media-spiceee.net/uploads/content/image/828907/large_zzzzzzzzzzzzzzzzzzzzzzzz156.jpg
			//   https://media-spiceee.net/uploads/content/image/828907/zzzzzzzzzzzzzzzzzzzzzzzz156.jpg
			// https://media-spiceee.net/uploads/article/image/36221/thumb_lg_ee41b4b3-5fc8-453d-b160-2fa8c3f2ee07.png
			//   https://media-spiceee.net/uploads/article/image/36221/ee41b4b3-5fc8-453d-b160-2fa8c3f2ee07.png
			// https://media-spiceee.net/uploads/shopper/product_image/extra_image/2086/thumb_a8.jpg
			//   https://media-spiceee.net/uploads/shopper/product_image/extra_image/2086/a8.jpg
			return src.replace(/\/(?:large|small|thumb_lg|thumb)_([^/]*)$/, "/$1");
		}

		if (domain_nowww === "vettri.net") {
			// http://www.vettri.net/gallery/celeb/emma_watson/2015-Time-100-Gala/thumb/Emma_Watson_2015Time100Gala_Vettri.Net-03_resize.jpg
			//   http://www.vettri.net/gallery/celeb/emma_watson/2015-Time-100-Gala/Emma_Watson_2015Time100Gala_Vettri.Net-03.jpg
			return src.replace(/\/thumb\/([^/]*)_resize(\.[^/.]*)$/, "/$1$2");
		}

		// PrestaShop
		if (domain_nowww === "tiarashop.eu" ||
			// http://streetstylestore.com/img/p/7/4/7/7/3/74773-home_default.jpg
			//   http://streetstylestore.com/img/p/7/4/7/7/3/74773.jpg
			domain_nowww === "streetstylestore.com" ||
			// http://asog-labs.com/img/p/4/7/47-thickbox_default.jpg
			//   http://asog-labs.com/img/p/4/7/47.jpg
			domain_nowww === "asog-labs.com" ||
			// https://dreamline.com/img/p/1/4/7/5/7/0/147570-thickbox_default.jpg
			//   https://dreamline.com/img/p/1/4/7/5/7/0/147570.jpg
			domain_nowww === "dreamline.com" ||
			// https://techno-import.fr/shop/img/p/3/5/9/5/0/35950-thickbox_default.jpg
			//   https://techno-import.fr/shop/img/p/3/5/9/5/0/35950.jpg
			domain_nowww === "techno-import.fr" ||
			// https://cdn.poplook.com/15360-92883-large_default/lane-bubble-sleeve-blouse-dusty-teal.jpg
			domain === "cdn.poplook.com" ||
			// https://www.directgardening.com/878-large_default/forsythia.jpg
			domain_nowww === "directgardening.com" ||
			// https://kanedashop.com/6388-large_default/outlet-taito-anohana-naruko-anjou-anaru-figure-ano-hi-mita-hana-no-namae.jpg
			//   https://kanedashop.com/6388/outlet-taito-anohana-naruko-anjou-anaru-figure-ano-hi-mita-hana-no-namae.jpg
			domain_nowww === "kanedashop.com" ||
			// https://www.myamericanmarket.com/9477-large_default/kelloggs-super-mario-cereal.jpg
			domain_nowww === "myamericanmarket.com" ||
			// http://lapakfiguremiina.com/1071-thickbox_default/figma-tv-animation-black-rock-shooter-chariot-tv-animation-ver.jpg
			domain_nowww === "lapakfiguremiina.com" ||
			// https://www.donnashape.com/39816-thickbox_default/dynamite-denim-bodypaint-legging-.jpg
			domain_nowww === "donnashape.com" ||
			// https://media2.nin-nin-game.com/21296-pos_product/black-rock-shooter-dead-master-anime-ver-good-smile-comapny-fr.jpg
			(domain_nosub === "nin-nin-game.com" && domain.match(/^media[0-9]*\.nin/)) ||
			// https://adintime.com/844-large_default/marie-claire-arabia.jpg
			domain_nowww === "adintime.com" ||
			// http://shop.marymary.gr/7505-large_default/xyesil-forma.jpg.pagespeed.ic.o2bHh4izla.webp
			domain === "shop.marymary.gr" ||
			// https://www.evawigs.com/1117-5735-small/rihanna-inspired-long-wavy-in-stock-full-lace-virgin-human-hair-wig.jpg
			//   https://www.evawigs.com/1117-5735/rihanna-inspired-long-wavy-in-stock-full-lace-virgin-human-hair-wig.jpg
			domain_nowww === "evawigs.com" ||
			// http://tehrankbs.pw/5314-home_default/%D9%83%D9%86%D8%B3%D8%B1%D8%AA-%DA%AF%D8%B1%D9%88%D9%87-%D8%AF%D8%AE%D8%AA%D8%B1%D8%A7%D9%86-g-friend-%D8%B3%D8%A7%D9%84-2016.jpg
			//   http://tehrankbs.pw/5314/%D9%83%D9%86%D8%B3%D8%B1%D8%AA-%DA%AF%D8%B1%D9%88%D9%87-%D8%AF%D8%AE%D8%AA%D8%B1%D8%A7%D9%86-g-friend-%D8%B3%D8%A7%D9%84-2016.jpg
			domain_nowww === "tehrankbs.pw" ||
			// https://ticketshow.ma/124-home_default/le-pass-marvel-studios-festival-.jpg
			//   https://ticketshow.ma/124/le-pass-marvel-studios-festival-.jpg
			domain_nowww === "ticketshow.ma" ||
			// https://www.asiaworldmusic.fr/64615-medium_default/taeyeon-s-taeyeon-concert-kihno-video-edition-coreenne.jpg
			//   https://www.asiaworldmusic.fr/64615/taeyeon-s-taeyeon-concert-kihno-video-edition-coreenne.jpg
			domain_nowww === "asiaworldmusic.fr" ||
			// https://kpopmart.com/17674-home_default/nature-republic-exo-edition-water-tint-3g-8-types.jpg
			//   https://kpopmart.com/17674/nature-republic-exo-edition-water-tint-3g-8-types.jpg
			domain_nowww === "kpopmart.com" ||
			// http://www.planetongames.com/2881-medium_default/ad-astra.jpg
			//   http://www.planetongames.com/2881/ad-astra.jpg
			domain_nowww === "planetongames.com" ||
			// https://www.baba.es/21845-home_default/selena-gomez-rare-edicion-deluxe-cd.jpg
			//   https://www.baba.es/21845/selena-gomez-rare-edicion-deluxe-cd.jpg
			domain_nowww === "baba.es" ||
			// https://www.teamworldshop.it/2603-home_default/cd-selena-gomez-rare.jpg
			//   https://www.teamworldshop.it/2603/cd-selena-gomez-rare.jpg
			domain_nowww === "teamworldshop.it" ||
			// thanks to nijaz-lab on github: https://github.com/qsniyg/maxurl/issues/575
			// https://www.donnemetropolitane.it/shop/c/249-medium_default/profumi-da-uomo.jpg -- doesn't work
			// https://www.donnemetropolitane.it/shop/49963-home_default/profumo-donna-dkny-donna-karan-edt-energizing.jpg
			//   https://www.donnemetropolitane.it/shop/49963/profumo-donna-dkny-donna-karan-edt-energizing.jpg
			domain_nowww === "donnemetropolitane.it" ||
			// thanks to AdClear247 on github: https://github.com/qsniyg/maxurl/issues/737
			// https://extremehobby.eu/7119-small_default/longsleeve-rashguard-women-workout.jpg
			//   https://extremehobby.eu/7119-thickbox_default/longsleeve-rashguard-women-workout.jpg
			//   https://extremehobby.eu/7119/longsleeve-rashguard-women-workout.jpg
			domain_nowww === "extremehobby.eu" ||
			// thanks to MinuteAd8502 on github: https://github.com/qsniyg/maxurl/issues/845
			// https://besto24.com/55325-large_default/women-s-t-shirt-under-armour-graphic-sportstyle-classiccrew.jpg
			//   https://besto24.com/55325-thickbox_default/women-s-t-shirt-under-armour-graphic-sportstyle-classiccrew.jpg
			//   https://besto24.com/55325/women-s-t-shirt-under-armour-graphic-sportstyle-classiccrew.jpg
			domain_nowww === "besto24.com" ||
			// thanks to MinuteAd8502 on github: https://github.com/qsniyg/maxurl/issues/847
			// https://static.footshop.com/517144-full_product/105328.jpg
			//   https://static.footshop.com/517144/105328.jpg
			domain === "static.footshop.com" ||
			// thanks to anonymous
			// https://www.rosendy.com/18863-medium_default/women-s-lace-long-sleeve-tunic-tops-shirt-clothing-scoop-neck-womens-plus-size-tunic-blouses-tops-blue-cp189sl927x.jpg
			//   https://www.rosendy.com/18863/women-s-lace-long-sleeve-tunic-tops-shirt-clothing-scoop-neck-womens-plus-size-tunic-blouses-tops-blue-cp189sl927x.jpg
			domain_nowww === "rosendy.com" ||
			// thanks to anonymous
			// http://www.ultimateselfcare.com/en/58-203-thickbox/ultimate-bedside-organizer.jpg
			//   http://www.ultimateselfcare.com/en/58-203/ultimate-bedside-organizer.jpg
			domain_nowww === "ultimateselfcare.com" ||
			// thanks to karpuzikov on github: https://github.com/qsniyg/maxurl/issues/1179
			// https://tucano.com/8637-thickbox_default/BSTN17.jpg
			//   https://tucano.com/8637/BSTN17.jpg
			domain_nowww === "tucano.com" ||
			// thanks to anonymous for reporting:
			// https://project-38music.nl/shop/12666-large_default/tears-for-fears-the-seeds-of-love-limited-deluxe-edition.jpg
			//   https://project-38music.nl/shop/12666/tears-for-fears-the-seeds-of-love-limited-deluxe-edition.jpg
			domain_nowww === "project-38music.nl" ||
			// thanks to anonymous for reporting:
			// https://recordsalbums.com/62616-thickbox_default/the-4-seasons-new-gold-hits-lp-vinyl-record-for-sale.jpg
			//   https://recordsalbums.com/62616/the-4-seasons-new-gold-hits-lp-vinyl-record-for-sale.jpg
			domain_nowww === "recordsalbums.com" ||
			// thanks to anonymous for reporting:
			// https://libreriaeldesvan.com/56423-large_default/1984-george-orwell.jpg
			//   https://libreriaeldesvan.com/56423/1984-george-orwell.jpg
			domain_nowww === "libreriaeldesvan.com" ||
			// thanks to anonymous for reporting:
			// https://www.fortunapost.com/60789-home_default/carte-postale-ancienne-carte-postale-fantaisie-illustrateur-guillaume-timbre-1-centime-illusions-perdues.jpg
			//   https://www.fortunapost.com/60789/carte-postale-ancienne-carte-postale-fantaisie-illustrateur-guillaume-timbre-1-centime-illusions-perdues.jpg
			domain_nowww === "fortunapost.com" ||
			// http://flyhighstore.pl/2210-home_default/fh-cool-red-winter-jacket.jpg
			//   http://flyhighstore.pl/2210/fh-cool-red-winter-jacket.jpg
			domain_nowww === "flyhighstore.pl" ||
			// thanks to anonymous for reporting:
			// https://www.sublimet.com/12604-large_default/serviettes-microfibre-cotton-sublimation.webp
			//   https://www.sublimet.com/12604/serviettes-microfibre-cotton-sublimation.webp
			domain_nowww === "sublimet.com" ||
			/^[a-z]+:\/\/[^/]+\/+[0-9]+-(?:home|large|thickbox)_default\/+[^/.]+\.(?:jpg|webp)(?:[?#].*)?$/.test(src)) {
			// https://www.tiarashop.eu/3412-home_default/o.jpg
			//   https://www.tiarashop.eu/3412/o.jpg
			newsrc = src.replace(/(\/img\/+p\/+(?:[0-9]\/+){1,}[0-9]+)[-_][^/.]*(\.[^/.]*)$/, "$1$2");
			if (newsrc !== src) return newsrc;

			var prefix = "(://[^/]+/+";
			if (domain_nowww === "donnemetropolitane.it" ||
				domain_nowww === "project-38music.nl") {
				prefix += "shop/+";
			} else if (domain_nowww === "ultimateselfcare.com") {
				prefix += "en/+";
			}

			newsrc = src.replace(new RegExp(prefix + "[0-9]+(?:-[0-9]+)?)(?:[-_][^/]*?)?(\/[^/]*)$"), "$1$2");
			if (newsrc !== src) return newsrc;
		}

		if (domain === "skinzwearphotography.com") {
			// www.skinzwearphotography.com points to a different part of the site
			// https://skinzwearphotography.com/prodMids/sexy-animal-print-boy-shorts-B78L-6517-F.jpg
			//   https://skinzwearphotography.com/prodImages/sexy-animal-print-boy-shorts-B78L-6517-F.jpg
			return src.replace(/\/prod[A-Z][a-z]*\//, "/prodImages/");
		}

		if (domain_nowww === "dubiobikinis.com") {
			// https://www.dubiobikinis.com/prodimages/E-PA59-Ct.jpg
			//   https://www.dubiobikinis.com/prodimages/E-PA59-C.jpg
			// https://www.dubiobikinis.com/prodimages/Bikini_Coverup_02t.jpg
			//   https://www.dubiobikinis.com/prodimages/Bikini_Coverup_02.jpg
			return src.replace(/(\/prodimages\/+[^/]*(?:-[A-Z]|_[0-9]+))t(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "shelot.com") {
			// https://www.shelot.com/images/com_hikashop/upload/thumbnails/500x500f/0479_1199671901.jpg
			//   https://www.shelot.com/images/com_hikashop/upload/0479_1199671901.jpg
			//   https://www.shelot.com/images/BIKINI0400-0500/0479.jpg
			// https://www.shelot.com/images/com_hikashop/upload/thumbnails/500x500f/0480-5.jpg
			//   https://www.shelot.com/images/com_hikashop/upload/0480-5.jpg
			return src.replace(/\/upload\/thumbnails\/[0-9]+x[0-9]+[^/]*\//, "/upload/");
		}

		if (domain === "xo.lulus.com") {
			// https://xo.lulus.com/images/product/small-medium/2192052_408952.jpg
			//   https://xo.lulus.com/images/product/xlarge/2192052_408952.jpg
			//   https://xo.lulus.com/images/product/w_1.0/2192052_408952.jpg
			// https://xo.lulus.com/images/content/w_1.0/content_298_15400_holidaylanding02.jpg
			return src.replace(/(\/images\/[^/]*\/)[^/]*\/([^/]*)$/, "$1w_1.0/$2");
		}

		if (domain_nowww === "in-tense.se") {
			// http://in-tense.se/shop/thumbnails/shop/32353/art53/h1698/115801698-origpic-011d3c.jpg_0_0_100_100_405_654_85.jpg
			//   http://in-tense.se/shop/32353/art53/h1698/115801698-origpic-011d3c.jpg
			return src
				.replace(/\/thumbnails\/[^/]*\//, "/")
				.replace(/(\.[^/._])*_[^/]*$/, "$1");
		}

		if (domain === "image.brazilianbikinishop.com") {
			// https://image.brazilianbikinishop.com/images/products/cache_images/set-laplaya-aguas-do-mar-0_80_80_defined.jpg
			//   https://image.brazilianbikinishop.com/images/products/set-laplaya-aguas-do-mar-0.jpg
			return src.replace(/\/cache_images\/([^/_]*)_[^/.]*(\.[^/.]*)$/, "/$1$2");
		}

		if (domain === "i.embed.ly" ||
			// https://i-cdn.embed.ly/1/display/crop?height=300&key=fd92ebbc52fc43fb98f69e50e7893c13&url=https%3A%2F%2Fimageresizer.static9.net.au%2FV3xR1INr6kGBTcMsUaIul0O6dDs%3D%2F0x0%2Fhttps%253A%252F%252Fcf-images.ap-southeast-2.prod.boltdns.net%252Fv1%252Fstatic%252F664969388001%252F4ce4fcf5-cbeb-45cf-905d-2d4660787cd1%252F374da747-31e2-46e3-a1eb-8520b351ef90%252F640x360%252Fmatch%252Fimage.jpg&width=636
			//   https://cf-images.ap-southeast-2.prod.boltdns.net/v1/static/664969388001/4ce4fcf5-cbeb-45cf-905d-2d4660787cd1/374da747-31e2-46e3-a1eb-8520b351ef90/640x360/match/image.jpg
			domain === "i-cdn.embed.ly") {
			// https://i.embed.ly/1/display?key=fc778e44915911e088ae4040f9f86dcd&url=http://www.mixtapesaga.com/tapes/mixtape-covers/431.jpg
			//   http://www.mixtapesaga.com/tapes/mixtape-covers/431.jpg
			// https://i.embed.ly/1/display?key=fc778e44915911e088ae4040f9f86dcd&url=http%3A%2F%2Fis5.mzstatic.com%2Fimage%2Fthumb%2FMusic6%2Fv4%2F05%2Fd2%2Fdb%2F05d2db2b-a4a9-b1a4-53ef-36e192631a18%2Fsource%2F2400x2400bb.jpg
			// https://i.embed.ly/1/image?url=https%3A%2F%2Fscontent-iad3-1.cdninstagram.com%2Fvp%2Fbd3ac9237f46bffab2d0265b5e6c0cd7%2F5B335D8F%2Ft51.2885-15%2Fe35%2F25013144_505639503145174_6650174657859158016_n.jpg&key=fc778e44915911e088ae4040f9f86dcd
			newsrc = src.replace(/.*\/(?:display|image).*?[?&]url=([^&]*).*/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "i.genius.com") {
			// https://i.genius.com/1d14e3ce755b87a963559b9e1f888e097d194c9e?url=http%3A%2F%2Fis5.mzstatic.com%2Fimage%2Fthumb%2FMusic6%2Fv4%2F05%2Fd2%2Fdb%2F05d2db2b-a4a9-b1a4-53ef-36e192631a18%2Fsource%2F2400x2400bb.jpg
			return decodeURIComponent(src.replace(/.*\/[0-9a-f]+.*?[?&]url=([^&]*).*/, "$1"));
		}

		if (domain_nowww === "hdqwalls.com") {
			// http://www.hdqwalls.com/wallpapers/bthumb/victoria-justice-4-do.jpg
			//   http://www.hdqwalls.com/wallpapers/victoria-justice-4-do.jpg
			// http://hdqwalls.com/wallpapers/thumb/victoria-justice.jpg
			//   http://hdqwalls.com/wallpapers/victoria-justice.jpg
			// http://hdqwalls.com/wallpapers/thumb/emma-watson-16-pic.jpg
			//   http://hdqwalls.com/wallpapers/emma-watson-16-pic.jpg
			//
			// https://hdqwalls.com/camila-cabello-fotos-2017-wallpaper -- Original Resolution: 5792x4624
			// https://hdqwalls.com/walls/thumb/camila-cabello-fotos-2017-k0.jpg -- 200x300
			//   https://hdqwalls.com/wallpapers/thumb/camila-cabello-fotos-2017-k0.jpg -- 304x204
			//   https://hdqwalls.com/download/1/camila-cabello-fotos-2017-k0-5792x8688.jpg -- not cropped
			//   https://hdqwalls.com/download/1/camila-cabello-fotos-2017-k0-5792x9000.jpg -- 5792x9000, stretched
			//   https://hdqwalls.com/wallpapers/camila-cabello-fotos-2017-k0.jpg -- 5792x4624, but cropped
			// https://hdqwalls.com/download/camren-bicondova-2018-mp-1080x2160.jpg
			//   https://hdqwalls.com/wallpapers/camren-bicondova-2018-mp.jpg -- but cropped
			//   https://hdqwalls.com/download/1/camren-bicondova-2018-mp.jpg -- still cropped
			// http://hdqwalls.com/leslie-grace-5k-wallpaper
			//   http://hdqwalls.com/wallpapers/leslie-grace-5k-4v.jpg -- 6144x4096

			return src
				//.replace(/\/walls\/thumb\//, "/wallpapers/") //-- crops
				.replace(/\/wallpapers\/[a-z]?thumb\//, "/wallpapers/");
				//.replace(/\/wallpapers\//, "/download/")
				//.replace(/(\/download\/)([^/]*)-[0-9]+x[0-9]+(\.[^/.]*)$/, "$11/$2$3"); // still crops, and forces download
		}

		if (domain_nowww === "wallpaperclicker.com") {
			// http://wallpaperclicker.com/storage/Thumb/Emma-Watson-Hot-Photos-65420656.jpg
			//   https://wallpaperclicker.com/storage/wallpaper/Emma-Watson-Hot-Photos-65420656.jpg
			// https://wallpaperclicker.com/storage/Thumb/harry-potter-and-the-chamber-of-secrets-wallpapers-picture-10025771.jpg
			//   https://wallpaperclicker.com/storage/image/harry-potter-and-the-chamber-of-secrets-wallpapers-picture-10025771.jpg
			if (src.match(/\/storage\/+Thumb\/+/)) {
				return [
					src.replace(/\/storage\/+Thumb\/+/, "/storage/wallpaper/"),
					src.replace(/\/storage\/+Thumb\/+/, "/storage/image/")
				];
			}

			// https://wallpaperclicker.com/download/Image.aspx?Imagefilename=harry-potter-and-the-chamber-of-secrets-wallpapers-picture-10025771.jpg&resolution=1280x1024
			//   https://wallpaperclicker.com/storage/image/harry-potter-and-the-chamber-of-secrets-wallpapers-picture-10025771.jpg
			// https://wallpaperclicker.com/wallpaper/Download.aspx?wallfilename=selena-gomez-wallpapers-hd-26262968.jpg&resolution=640x360
			//   https://wallpaperclicker.com/storage/image/selena-gomez-wallpapers-hd-26262968.jpg
			return src
				.replace(/\/download\/+Image\.aspx.*?[?&]Imagefilename=([^&]*).*?$/, "/storage/Thumb/$1")
				.replace(/\/wallpaper\/+Download\.aspx.*?[?&]wallfilename=([^&]*).*?$/, "/storage/Thumb/$1");
		}

		if (domain_nosub === "prothomalo.com") {
			// http://en.prothomalo.com/contents/cache/images/300x0x1/uploads/media/2016/07/24/b2e9a47e2b605b04351f740d816b6bdc-Emmavv.jpg
			//   http://en.prothomalo.com/contents/uploads/media/2016/07/24/b2e9a47e2b605b04351f740d816b6bdc-Emmavv.jpg
			return src.replace(/\/cache\/images\/[0-9]+x[0-9]+(?:x[0-9]+)\//, "/");
		}

		if (domain === "c.tribune.com.pk") {
			// https://c.tribune.com.pk/2016/05/1101624-image-1462981240-590-640x480.JPG
			//   https://c.tribune.com.pk/2016/05/1101624-image-1462981240.JPG
			return src.replace(/-[0-9]+-[0-9]+x[0-9]+(\.[^/.]*)$/, "$1");
		}

		if (domain_nosub === "reutersmedia.net" ||
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/442
			// https://static.reuters.com/resources/r/?m=02&d=20200910&t=2&i=1532848169&r=LYNXMPEG8902P&w=120
			//   https://static.reuters.com/resources/r/?d=20200910&t=2&i=1532848169
			// https://static.reuters.com/resources/r/?m=02&d=20200910&t=2&i=1532898275&r=LYNXMPEG89165&w=120
			//   https://static.reuters.com/resources/r/?d=20200910&t=2&i=1532898275
			domain === "static.reuters.com") {
			// https://s1.reutersmedia.net/resources/r/?m=02&d=20140708&t=2&i=924720732&r=LYNXMPEA670U0&w=900
			//   https://s1.reutersmedia.net/resources/r/?d=20140708&t=2&i=924720732
			// https://pictures.reuters.com/Doc/RTR/Media/TR3_UNWATERMARKED/d/5/8/2/RTS1NLQY.jpg
			// https://s3.reutersmedia.net/resources/r/?d=20180418&t=2&i=1252629147
			var queries = get_queries(src);

			if (queries.d && queries.i) {
				return src.replace(/\/r\/\?.*/, "/r/?d=" + queries.d + "&t=2&i=" + queries.i);
			}
		}

		if (domain === "r.fod4.com") {
			// https://r.fod4.com/c=ar16x9/s=w400,pd1/o=80/http://t.fod4.com/t/1a93d97833/c1920x1080_1.jpg
			//   http://t.fod4.com/t/1a93d97833/c1920x1080_1.jpg
			return src.replace(/^[a-z]*:\/\/[^/]*\/.*\/([a-z]*:\/\/)/, "$1");
		}

		if (domain === "p.fod4.com") {
			// http://p.fod4.com/p/media/ed608625ad/c=sq/s=w700/o=90/wAkqh8LKRVWWJohZfCCl_Screen%20Shot%202014-07-02%20at%207.03.49%20PM.png
			//   http://p.fod4.com/p/media/ed608625ad/wAkqh8LKRVWWJohZfCCl_Screen%20Shot%202014-07-02%20at%207.03.49%20PM.png
			// depends on repetition
			return src.replace(/(\/media\/[0-9a-f]+\/)[a-z]=[a-z0-9]+\//, "$1");
		}

		if (domain_nowww === "xdressy.com" ||
			// https://starcelebritydresses.com/uploads/product/1/R/1R284/dove-cameron-blush-lace-and-chiffon-short-sweet-16-dress-ted-baker-ss-2016-1-thumb.jpg
			domain_nowww === "starcelebritydresses.com") {
			// https://www.xdressy.com/uploads/product/1/R/1R550/emma-watson-vintage-queen-anne-neck-short-navy-cocktail-dress-lancome-dinner-1-thumb.jpg
			//   https://www.xdressy.com/uploads/product/1/R/1R550/emma-watson-vintage-queen-anne-neck-short-navy-cocktail-dress-lancome-dinner-1.jpg
			return src.replace(/-thumb(\.[^/.]*)$/, "$1");
		}

		if (domain_nowww === "wallpaperflare.com" && src.match(/\/static\//)) {
			// https://www.wallpaperflare.com/static/691/945/100/leslie-grace-hot-5k-woman-wallpaper-preview.jpg
			//   https://www.wallpaperflare.com/static/691/945/100/leslie-grace-hot-5k-woman-wallpaper.jpg
			// https://www.wallpaperflare.com/static/532/54/508/rihanna-saturday-night-live-singer-face-wallpaper-thumb.jpg
			//   https://www.wallpaperflare.com/static/532/54/508/rihanna-saturday-night-live-singer-face-wallpaper.jpg
			// https://www.wallpaperflare.com/static/786/500/37/girl-anime-automaton-guns-wallpaper-preview.jpg
			//   https://www.wallpaperflare.com/static/786/500/37/girl-anime-automaton-guns-wallpaper.jpg
			// other:
			// thanks to anonymous for reporting:
			// https://c4.wallpaperflare.com/wallpaper/731/656/62/asian-model-women-black-dress-wallpaper-preview.jpg
			return src.replace(/-(?:thumb|preview)(\.[^/.]*)$/, "$1");
			//return src.replace(/-preview(\.[^/.]*)$/, "$1");
		}

		if (domain === "cdn.store-assets.com") {
			// thanks to anonymous for reporting:
			// https://cdn.store-assets.com/s/304945/i/81123616.png?width=1024&format=webp
			//   https://cdn.store-assets.com/s/304945/i/81123616.png
			newsrc = src.replace(/(\/s\/+[0-9]+\/+[a-z]\/+[0-9]+[^/?#]+)(?:[?#].*)?$/, "$1");
			if (newsrc !== src)
				return newsrc;

			// other: https://cdn.store-assets.com/s/304945/f/14511290.jpg -- 3024x4032
			// https://cdn.store-assets.com/s/304945/i/81123579.jpeg -- 1800x2400
			//   https://cdn.store-assets.com/s/304945/f/14511290.jpg -- 3024x4032
			// https://cdn.store-assets.com/s/304945/i/81123577.jpeg -- 1800x2400
			//   https://cdn.store-assets.com/s/304945/f/14511291.jpg -- 3024x4032
			// https://cdn.store-assets.com/s/304945/i/81123582.jpeg
			//   https://cdn.store-assets.com/s/304945/f/14511292.jpg

			// https://cdn.store-assets.com/s/5319/i/1058445_480x.jpeg
			//   https://cdn.store-assets.com/s/5319/i/1058445.jpeg
			return src.replace(/_[0-9]+x(?:[0-9]+)?(\.[^/.]*)$/, "$1");
		}

		if (domain === "img.shopperboard.com") {
			// https://img.shopperboard.com/1184938/5a20a29ecfdea-small.jpg
			//   https://img.shopperboard.com/1184938/5a20a29ecfdea.jpg
			return src.replace(/-[a-z]+(\.[^/.]*)$/, "$1");
		}

		if ((domain_nosub === "gog.com" ||
			// https://images.gog-statics.com/6361d6a0b2816bbe7deb138d8675569e97d77bca3f078b495f747e9c9e41f543_product_card_v2_thumbnail_271.jpg
			//   https://images.gog-statics.com/6361d6a0b2816bbe7deb138d8675569e97d77bca3f078b495f747e9c9e41f543.jpg
			domain_nosub === "gog-statics.com") && domain.match(/images.*\./)) {
			// https://images-2.gog.com/859a7d00d0c0d46c8c4a215906479580f06837daa13d90837deba59ad51fdd8a_product_card_screenshot_112.jpg
			//   https://images-2.gog.com/859a7d00d0c0d46c8c4a215906479580f06837daa13d90837deba59ad51fdd8a.jpg
			// https://images-3.gog-statics.com/e81916c6d3612e5423b32e6c641e9589fc5e34cf5b6ccbba09d912f51fa8c4bd_bs_logo_small.webp
			//   https://images-3.gog-statics.com/e81916c6d3612e5423b32e6c641e9589fc5e34cf5b6ccbba09d912f51fa8c4bd_bs_logo_big.webp
			newsrc = src.replace(/(\/[0-9a-f]{10,}_bs_logo)_small(\.[^/.]+)(?:[?#].*)?$/, "$1_big$2");
			if (newsrc !== src)
				return newsrc;

			// https://images-2.gog-statics.com/c9410707e8fa68b3fcd414f217c4f72b653fbc4dca6abf17c603d924149e3398_bs_background_500.webp
			//   https://images-2.gog-statics.com/c9410707e8fa68b3fcd414f217c4f72b653fbc4dca6abf17c603d924149e3398_bs_background_800.webp
			//   https://images-2.gog-statics.com/c9410707e8fa68b3fcd414f217c4f72b653fbc4dca6abf17c603d924149e3398_bs_background_1275.webp
			newsrc = src.replace(/(\/[0-9a-f]{10,}_bs_background)_(?:500|800)(\.[^/.]+)(?:[?#].*)?$/, "$1_1275$2");
			if (newsrc !== src)
				return newsrc;

			// https://images-4.gog-statics.com/7ec3664b4bb3746797e252fd71ad48abea130abf847bf30d0b9eaf25a915da2d_product_tile_349.webp
			//   https://images-4.gog-statics.com/7ec3664b4bb3746797e252fd71ad48abea130abf847bf30d0b9eaf25a915da2d_product_tile_349_2x.webp
			// https://images-4.gog-statics.com/7ec3664b4bb3746797e252fd71ad48abea130abf847bf30d0b9eaf25a915da2d_product_tile_398.webp
			//   https://images-4.gog-statics.com/7ec3664b4bb3746797e252fd71ad48abea130abf847bf30d0b9eaf25a915da2d_product_tile_398_2x.webp
			// https://images-1.gog-statics.com/43f1850febaf13b4185d9f31ffb7d63ee1e85b496bac723af2bffc7a832ab827_product_tile_536.webp
			newsrc = src.replace(/(\/[0-9a-f]{10,}_product_tile_(?:349|398))(\.[^/.]+)(?:[?#].*)?$/, "$1_2x$2");
			if (newsrc !== src)
				return newsrc;

			return src.replace(/(\/[0-9a-f]*)_[^/.]*(\.[^/.]*)$/, "$1$2");
		}

		if (domain === "items.gog.com") {
			// https://items.gog.com/in_other_waters/mp4/IOW_Convo_brine_600px.gif.mp4
			if (/\/mp4\/+[^/]+\.mp4(?:[?#].*)?$/.test(src)) {
				return {
					url: src,
					video: true
				};
			}
		}

		if (domain === "www.destructoid.com") {
			// https://www.destructoid.com/ul/494427-AB-t.jpg
			//   https://www.destructoid.com//ul/494427-AB.jpg'); -- yes, not a typo
			//   https://www.destructoid.com//ul/494427-AB.jpg
			// https://www.destructoid.com/ul/493655-review-surviving-mars/DWawyA4XcAAHojb-noscale.jpg
			//   https://www.destructoid.com/ul/493655-review-surviving-mars/DWawyA4XcAAHojb.jpg
			// https://www.destructoid.com//ul/492359-h1-t.jpg
			//   https://www.destructoid.com//ul/492359-h1.jpg
			return src.replace(/-(?:t|noscale)(\.[^/.]*)$/, "$1");
		}

		if (domain_nosub === "xboxlive.com" &&
			domain.match(/images.*\.xboxlive\.com/) &&
			src.match(/\/image\?/)) {
			// https://images-eds-ssl.xboxlive.com/image?url=8Oaj9Ryq1G1_p3lLnXlsaZgGzAie6Mnu24_PawYuDYIoH77pJ.X5Z.MqQPibUVTc6mdXIF7EzzBzjbCi0PAFFm9oIFRURAIJY671mz65mpafwXTRitZCcs1mXngtlGKXGL6FtVwx1C9b1AIuJhv8KnSQBHdQ22A122Oh6Fpn5ncAYey7_nKGGXB7mkCs9jnrsclui.l_ItF9D7zgF8n0o3RXWpfe8IGE7Wkqn5ZMTac-&w=200&h=300&format=jpg
			//   https://images-eds-ssl.xboxlive.com/image?url=8Oaj9Ryq1G1_p3lLnXlsaZgGzAie6Mnu24_PawYuDYIoH77pJ.X5Z.MqQPibUVTc6mdXIF7EzzBzjbCi0PAFFm9oIFRURAIJY671mz65mpafwXTRitZCcs1mXngtlGKXGL6FtVwx1C9b1AIuJhv8KnSQBHdQ22A122Oh6Fpn5ncAYey7_nKGGXB7mkCs9jnrsclui.l_ItF9D7zgF8n0o3RXWpfe8IGE7Wkqn5ZMTac-
			newsrc = src.replace(/\/image[^/]?[?&]url=([^&]*).*/, "/image?url=$1");
			if (newsrc !== src)
				return newsrc;

			return {
				url: src,
				head_wrong_contenttype: true
			};
		}

		if (domain === "musicimage.xboxlive.com") {
			// https://musicimage.xboxlive.com/catalog/video.contributor.EF755600-0200-11DB-89CA-0019B92A3933/image?locale=en-CA&target=circle&mode=crop&q=90&h=373&w=373
			return {
				url: src.replace(/\/image\?.*/, "/image?locale=en-US"),
				can_head: false // GET, OPTIONS
			};
		}

		if (domain === "media.withtank.com") {
			// http://media.withtank.com/e077b4d7c8/img_6535_690_wide.jpg
			//   http://media.withtank.com/e077b4d7c8/img_6535.jpg
			// http://media.withtank.com/1d7cdaeb6c/bb_colour_swatch_720_wide.jpg
			//   http://media.withtank.com/1d7cdaeb6c/bb_colour_swatch.jpg
			return src.replace(/_[0-9]+_wide(\.[^/.]*)$/, "$1");
		}

		if (domain === "images.cdn.realviewdigital.com") {
			// http://images.cdn.realviewdigital.com/rvimageserver/Intimo%20Lingerie/The%20Intimo%20Opportunity/The%20Intimo%20Opportunity/page0000002.jpg?type=3&width=920&quality=70&v=v2
			//   http://images.cdn.realviewdigital.com/rvimageserver/Intimo%20Lingerie/The%20Intimo%20Opportunity/The%20Intimo%20Opportunity/page0000002.jpg?type=3
			let type = src.match(/[?&]type=([^&]*)/);
			return src.replace(/\?.*/, "?type=" + type[1]);
		}

		if (domain === "proxy.duckduckgo.com" ||
			// https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fi.pinimg.com%2Foriginals%2F8f%2F75%2Fad%2F8f75adeb5cd796fc403ade05e3a7b5ca.jpg&f=1&nofb=1
			//   https://i.pinimg.com/originals/8f/75/ad/8f75adeb5cd796fc403ade05e3a7b5ca.jpg
			domain === "external-content.duckduckgo.com") {
			// https://proxy.duckduckgo.com/iu/?u=https%3A%2F%2Ftse1.mm.bing.net%2Fth%3Fid%3DOIP.-fIJ70TgJpidmW2R6qcp3QHaE1%26pid%3D15.1&f=1
			//   https://tse1.mm.bing.net/th?id=OIP.-fIJ70TgJpidmW2R6qcp3QHaE1
			// https://proxy.duckduckgo.com/iu/?u=http%3A%2F%2Fwww.billboard.com%2Ffiles%2Fmedia%2FGrabbitz-mic-press-photo-2016-billboard-1548.jpg&f=1
			//   https://www.billboard.com/files/media/Grabbitz-mic-press-photo-2016-billboard-1548.jpg
			// https://proxy.duckduckgo.com/iur/?f=1&image_host=http://www.billboard.com/files/media/Grabbitz-mic-press-photo-2016-billboard-1548.jpg&u=https://www.billboard.com/files/media/Grabbitz-mic-press-photo-2016-billboard-1548.jpg
			//   https://www.billboard.com/files/media/Grabbitz-mic-press-photo-2016-billboard-1548.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+iur?\/\?(?:.*&)?u=([^&]*).*/, "$1");
			if (newsrc !== src) {
				return decodeuri_ifneeded(newsrc);
			}
		}

		if (host_domain_nowww === "duckduckgo.com" && options.element && options.do_request && options.cb) {
			// FIXME... this is a horrible rule
			var get_query_params = function(url, cb) {
				var query = url.replace(/.*\?(?:.*&)?q=([^&]+).*?$/, "$1");

				var cache_key = "duckduckgo_imagequeryparams:" + query;
				api_cache.fetch(cache_key, cb, function(done) {
					options.do_request({
						url: url,
						method: "GET",
						onload: function(resp) {
							if (resp.readyState !== 4)
								return;

							if (resp.status !== 200) {
								console_error(resp);
								return done(null, false);
							}

							var respobj = {
								query: query,
								start: 0
							};

							//var match = resp.responseText.match(/;\s*rl\s*=\s*["']([^'"]+)["'];/);
							var match = resp.responseText.match(/'\/[td]\.js\?(?:.*?&)?l=([^&]+)/);
							if (!match) {
								console_error("Unable to find language", resp);
								return done(null, false);
							}

							respobj.lang = match[1];

							match = resp.responseText.match(/;\s*vqd\s*=\s*["']([-0-9]{20,})["']/);
							if (!match) {
								console_error("Unable to find vqd", resp);
								return done(null, false);
							}

							respobj.vqd = match[1];

							return done(respobj, 60*60);
						}
					});
				});
			};

			var get_images = function(querydata, cb) {
				var cache_key = "duckduckgo_imageresults:" + querydata.query + "," + querydata.start;
				api_cache.fetch(cache_key, cb, function(done) {
					var start_query = "";
					if (querydata.start) {
						start_query = "&s=" + querydata.start;
					}

					options.do_request({
						method: "GET",
						url: "https://duckduckgo.com/i.js?l=" + querydata.lang + "&o=json&q=" + querydata.query + "&vqd=" + querydata.vqd + "&p=-1" + start_query + "&v7exp=a",
						onload: function(resp) {
							if (resp.readyState !== 4)
								return;

							if (resp.status !== 200) {
								console_error(resp);
								return done(null, false);
							}

							try {
								var json = JSON_parse(resp.responseText);
								return done(json, 60*60);
							} catch (e) {
								console_error(e);
								return done(null, false);
							}
						}
					});
				});
			};

			var get_bing_imageid = function(url) {
				var newurl = url.replace(/.*[?&]id=([^&]+).*/, "$1");
				if (newurl !== url)
					return newurl;

				return null;
			};

			var get_result_from_image = function(querydata, image, cb) {
				get_images(querydata, function(data) {
					if (!data) {
						return cb(null);
					}

					var image_src = decodeURIComponent(image.src);
					var image_id = get_bing_imageid(image_src);
					if (!image_id) {
						console_warn("Unable to get bing image id for" + image.src);
						return cb(null);
					}

					for (var i = 0; i < data.results.length; i++) {
						var thumbnail_id = get_bing_imageid(data.results[i].thumbnail);
						if (!thumbnail_id) {
							console_warn("Unable to get bing image id for" + data.results[i].thumbnail);
							continue;
						}

						// FIXME: hacky
						if (image_id === thumbnail_id) {
							return cb(data.results[i].image);
						}
					}

					if (data.next) {
						var start = data.next.replace(/.*&s=([0-9]+).*$/, "$1");
						if (start !== data.next) {
							querydata.start = start;
						}

						return get_result_from_image(querydata, image, cb);
					}

					return cb(null);
				});
			}

			if (!options._internal_info || !options._internal_info.duckduckgo_host) {
				if (options.element.tagName === "IMG") {
					if (options.element.classList.contains("tile--img__img") ||
						options.element.classList.contains("module--images__thumbnails__image")) {
						options._internal_info.duckduckgo_host = true;

						get_query_params(document.location.href, function(data) {
							if (!data) {
								return options.cb(null);
							}

							get_result_from_image(data, options.element, function(url) {
								return options.cb(url);
							});
						});

						return {
							waiting: true
						};
					}
				}
			}
		}

		// Mura CMS (http://www.getmura.com/)
		if (domain === "static.scientificamerican.com") {
			// https://static.scientificamerican.com/blogs/cache/file/95AC5EF1-B21C-4B68-8A6CA35ED072425A_medium.jpg?w=170&h=113&fit=crop
			//   https://static.scientificamerican.com/blogs/cache/file/95AC5EF1-B21C-4B68-8A6CA35ED072425A.jpg
			//   https://static.scientificamerican.com/blogs/cache/file/95AC5EF1-B21C-4B68-8A6CA35ED072425A_source.jpg
			// https://static.scientificamerican.com/sciam/cache/file/DD410F93-4B85-4031-90CEF95B8C722F36.jpg?w=590&h=393
			//   https://static.scientificamerican.com/sciam/cache/file/DD410F93-4B85-4031-90CEF95B8C722F36.jpg
			//   https://static.scientificamerican.com/sciam/cache/file/DD410F93-4B85-4031-90CEF95B8C722F36_source.jpg
			// https://static.scientificamerican.com/sciam/cache/file/6A6323ED-DC05-47CA-B132FF74AAEC4163_agenda.jpg?w=210&amp;h=140
			//   https://static.scientificamerican.com/sciam/cache/file/6A6323ED-DC05-47CA-B132FF74AAEC4163.jpg
			//   https://static.scientificamerican.com/sciam/cache/file/6A6323ED-DC05-47CA-B132FF74AAEC4163_source.jpg
			// https://static.scientificamerican.com/blogs/cache/file/95AC5EF1-B21C-4B68-8A6CA35ED072425A_small.jpg?fit=crop
			//   https://static.scientificamerican.com/blogs/cache/file/95AC5EF1-B21C-4B68-8A6CA35ED072425A.jpg
			//   https://static.scientificamerican.com/blogs/cache/file/95AC5EF1-B21C-4B68-8A6CA35ED072425A_source.jpg
			// https://static.scientificamerican.com/sciam/cache/file/E82AEBA1-0A06-4B0F-9B1CFF1CE6BD8745_source.png?w=220&amp;h=100
			//   https://static.scientificamerican.com/sciam/cache/file/E82AEBA1-0A06-4B0F-9B1CFF1CE6BD8745_source.png
			return src.replace(/(?:_[^/.]*)?(\.[^/.?]*)(?:\?.*)?$/, "_source$1");
		}

		if (domain_nosub === "qwant.com" && domain.match(/s[0-9]*\.qwant\.com/) &&
			string_indexof(src, "/thumbr/") >= 0) {
			// https://s1.qwant.com/thumbr/0x110/a/6/415e8905eb30e1a48a6374550f1852/b_1_q_0_p_0.jpg?u=https%3A%2F%2Fb.fssta.com%2Fuploads%2Fcontent%2Fdam%2Ffsdigital%2Ffscom%2Fnfl%2Fimages%2F2016%2F09%2F19%2F9034572-kyle-fuller-nfl-detroit-lions-chicago-bears.vresize.1200.630.high.0.jpg&q=0&b=1&p=0&a=0
			//   https://b.fssta.com/uploads/content/dam/fsdigital/fscom/nfl/images/2016/09/19/9034572-kyle-fuller-nfl-detroit-lions-chicago-bears.vresize.1200.630.high.0.jpg
			return decodeURIComponent(src.replace(/.*[?&]u=([^&]*).*/, "$1"));
		}

		if (domain === "b.fssta.com") {
			// https://b.fssta.com/uploads/content/dam/fsdigital/fscom/nfl/images/2016/09/19/9034572-kyle-fuller-nfl-detroit-lions-chicago-bears.vresize.1200.630.high.0.jpg -- stretched
			//   https://b.fssta.com/uploads/content/dam/fsdigital/fscom/nfl/images/2016/09/19/9034572-kyle-fuller-nfl-detroit-lions-chicago-bears.jpg
			return src.replace(/(\/[^/.]*)\.[^/]*(\.[^/.]*)$/, "$1$2");
		}

		if (domain_nosub === "espn.com" && domain.match(/media\..*\.espn\.com$/)) {
			// http://media.video-cdn.espn.com/motion/2018/0316/dm_180316_ncb_bilas_on_buffalo/dm_180316_ncb_bilas_on_buffalo_default.jpg
			//   http://media.video-cdn.espn.com/motion/2018/0316/dm_180316_ncb_bilas_on_buffalo/dm_180316_ncb_bilas_on_buffalo.jpg
			return src.replace(/(\/[0-9]+\/[0-9]+\/)([^/]*)\/[^/]*(\.[^/.]*)$/, "$1$2\/$2$3");
		}

		if (domain === "img.skysports.com" ||
			domain_nosub === "365dm.com") {
			// http://img.skysports.com/18/02/768x432/skysports-matt-patricia-detroit-lions_4225501.jpg?20180208065403
			//   http://img.skysports.com/18/02/master/skysports-matt-patricia-detroit-lions_4225501.jpg?20180208065403
			// http://img.skysports.com/18/02/1-1/40/skysports-matt-patricia-detroit-lions_4225501.jpg?20180208065403
			//   http://img.skysports.com/18/02/master/skysports-matt-patricia-detroit-lions_4225501.jpg?20180208065403
			// http://e2.365dm.com/18/02/1-1/40/skysports-matt-patricia-detroit-lions_4225501.jpg?20180208065403
			//   http://e2.365dm.com/18/02/master/skysports-matt-patricia-detroit-lions_4225501.jpg?20180208065403
			return src.replace(/(:\/\/[^/]*\/[0-9]*\/[0-9]*\/)[^/]*\/(?:[0-9]*\/)?([^/]*)$/, "$1master/$2");
		}

		if (domain_nosub === "bcbits.com" &&
			domain.match(/f[0-9]*\.bcbits\.com/) &&
			string_indexof(src, "/img/") >= 0) {
			// see discussion here about _1 vs _0 https://github.com/qsniyg/maxurl/issues/116
			//   current conclusion is that _1 is a stripped png'd version of _0, which is likely the original image
			// https://f4.bcbits.com/img/0012903078_36.jpg
			//   https://f4.bcbits.com/img/0012903078_1.jpg -- 3000x2000, png, smaller+stripped
			//   https://f4.bcbits.com/img/0012903078_0.jpg -- 3000x2000, png
			// https://f4.bcbits.com/img/a0452005993_10.jpg -- desaturated slightly
			//   https://f4.bcbits.com/img/a0452005993_1.jpg -- 1600x1600, png
			//   https://f4.bcbits.com/img/a0452005993_0.jpg -- ^, jpg, more saturated
			// thanks to eighty8 on matrix:
			// https://f4.bcbits.com/img/0031043462_4
			//   https://f4.bcbits.com/img/0031043462_0
			return src.replace(/_[0-9]+(\.[^/.]*)?$/, "_0$1");
		}

		if (domain === "tent.sny.sh" ||
			// thanks to anonymous for reporting:
			// https://tent.sny.sh/image.php?file=1593557344_4.jpg
			//   https://tent.sny.sh/image.php?file=1593557344_0.jpg -- 3591x3618
			//   https://f4.bcbits.com/img/1593557344_0 -- 404
			//   https://f4.bcbits.com/img/a1593557344_0 -- 3591x3618
			// https://tent.sny.sh/image.php?file=0012903078_4
			//   https://tent.sny.sh/image.php?file=0012903078_0
			//   https://f4.bcbits.com/img/0012903078_0
			domain === "tent.bloatcat.tk" ||
			// https://tent.bloatcat.tk/image.php?file=1593557344_4.jpg
			//   https://tent.bloatcat.tk/image.php?file=1593557344_0.jpg
			domain === "tent.bloat.cat" ||
			domain === "tn.vern.cc" ||
			domain === "tent.vern.cc" ||
			domain === "bandcamp.vern.cc" ||
			domain === "tent.deep-swarm.xyz" ||
			domain === "bandcamp.lurkmore.com") {
			return src.replace(/\/image\.php\?(?:.*&)?file=([0-9]+_)[0-9]+(\.[^/.&#]+)?(?:[#&].*)?$/, "/image.php?file=$10$2");
		}

		if (domain_nosub === "bandcamp.com") {
			// thanks to remlap on discord for reporting
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/([^/]+\/+track\/+[^/]+)\/*(?:[?#].*)?$/,
				query_for_id: "https://${id}",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/<script.*?data-tralbum="({[^"]+?})"/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					var json_txt = decode_entities(match[1]);
					var json = JSON_parse(json_txt);

					// todo: do something with freeDownloadPage

					// fixme: is 0 always correct?
					var trackinfo = json.trackinfo[0];

					var obj = {
						extra: {
							page: urljoin(resp.finalUrl, trackinfo.title_link, true) || resp.finalUrl,
							caption: trackinfo.title
						}
					};

					var urls = [];

					// fixme: are there more formats?
					var file = trackinfo.file["mp3-128"];
					if (file) {
						urls.push({
							url: file,
							media_info: {
								type: "audio"
							}
						});
					}

					var art_fn = "a" + zpadnum(json.art_id, 10, "0") + "_0.jpg";
					urls.push("https://f4.bcbits.com/img/" + art_fn);

					return done(fillobj_urls(urls, obj), 60*60);
				}
			});
			if (newsrc !== src) return newsrc;
		}

		if (domain_nosub === "motherlessmedia.com") {
			// http://cdn4.thumbs.motherlessmedia.com/thumbs/FDE845E-zoom.jpg?fs=opencloud
			//   http://cdn4.images.motherlessmedia.com/images/FDE845E.jpg
			return src
				.replace(/(:\/\/cdn[0-9]*\.)thumbs(\.motherlessmedia\.com\/)/, "$1images$2")
				.replace(/\/thumbs\//, "/images/")
				.replace(/-[a-z]*(\.[^/.?]*)(?:\?.*)?$/, "$1");
		}

		if (domain_nosub === "kiev.ua" &&
			string_indexof(domain, "shram.kiev.ua") >= 0 &&
			string_indexof(src, "/img/") >= 0) {
			// http://en.shram.kiev.ua/img/fun/emilia-clarke/Emilia_Clarke_2013-small.jpg
			//   http://en.shram.kiev.ua/img/fun/emilia-clarke/Emilia_Clarke_2013-big.jpg
			// http://en.shram.kiev.ua/img/fun/emilia-clarke/emilia-clarke2-w370.jpg
			//   http://en.shram.kiev.ua/img/fun/emilia-clarke/emilia-clarke2.jpg
			return src
				.replace(/-small(\.[^/.]*)$/, "-big$1")
				.replace(/-w[0-9]+(\.[^/.]*)$/, "$1");
		}

		if (googlestorage_container === "cr-resource" &&
			string_indexof(src, "/image/") >= 0) {
			// http://storage.googleapis.com/cr-resource/image/5a1100e09ab0cc45cb108bbcd5d1238d/nosenter/800/151e456e844516e04e222d9d9487e79c.jpg
			//   http://storage.googleapis.com/cr-resource/image/5a1100e09ab0cc45cb108bbcd5d1238d/nosenter/151e456e844516e04e222d9d9487e79c.jpg
			return src.replace(/\/[0-9]+(\/[0-9a-f]*\.[^/.]*)$/, "$1");
		}

		if (domain_nosub === "iol.pt" &&
			string_indexof(src, "/multimedia/") >= 0) {
			// http://www.iol.pt/multimedia/oratvi/multimedia/imagem/id/13513489/800
			// http://www.iol.pt/multimedia/oratvi/multimedia/imagem/id/5903556c0cf2572470620c62/800
			// http://www.tvi24.iol.pt/multimedia/oratvi/multimedia/imagem/id/5734c40c0cf209b36b78bd3a/600.jpg
			// http://www.iol.pt/multimedia/oratvi/multimedia/imagem/id/13734488/600.5423278f3004574342d70571.jpg
			//   http://www.iol.pt/multimedia/oratvi/multimedia/imagem/id/13734488/
			return src.replace(/(\/id\/[0-9a-f]+)\/[0-9]+(?:\.[0-9a-f]+)?(?:\.[^/.]*)?$/, "$1");
		}

		if (domain === "img.purch.com") {
			// https://img.purch.com/w/660/aHR0cDovL3d3dy5saXZlc2NpZW5jZS5jb20vaW1hZ2VzL2kvMDAwLzAwMy8xMjQvb3JpZ2luYWwvMDkwNjA4LWNvcm4tc25ha2UtMDIuanBn -- mildly stretched
			//   https://img.purch.com/o/aHR0cDovL3d3dy5saXZlc2NpZW5jZS5jb20vaW1hZ2VzL2kvMDAwLzAwMy8xMjQvb3JpZ2luYWwvMDkwNjA4LWNvcm4tc25ha2UtMDIuanBn
			//   http://www.livescience.com/images/i/000/003/124/original/090608-corn-snake-02.jpg
			// https://img.purch.com/rc/317x177/aHR0cDovL3d3dy5saXZlc2NpZW5jZS5jb20vaW1hZ2VzL2kvMDAwLzA2MC84MzQvb3JpZ2luYWwvYW5jaWVudC1mYWJyaWMzLmpwZw==
			//   https://img.purch.com/o/aHR0cDovL3d3dy5saXZlc2NpZW5jZS5jb20vaW1hZ2VzL2kvMDAwLzA2MC84MzQvb3JpZ2luYWwvYW5jaWVudC1mYWJyaWMzLmpwZw==
			//   http://www.livescience.com/images/i/000/060/834/original/ancient-fabric3.jpg
			// https://img.purch.com/nxgl7xz4-400x400-jpg/o/aHR0cDovL21lZGlhLmJlc3RvZm1pY3JvLmNvbS81L0IvODA3NTk5L29yaWdpbmFsL054Z2w3eHo0XzQwMHg0MDAuanBn
			//   https://img.purch.com/o/aHR0cDovL21lZGlhLmJlc3RvZm1pY3JvLmNvbS81L0IvODA3NTk5L29yaWdpbmFsL054Z2w3eHo0XzQwMHg0MDAuanBn
			//   http://media.bestofmicro.com/5/B/807599/original/Nxgl7xz4_400x400.jpg
			newsrc = src
				.replace(/\/[a-z]+\/[0-9]+(?:x[0-9]+)?\//, "/o/")
				.replace(/\/[a-z0-9]+-[0-9]+x[0-9]+(?:-[^/]*)?\/o\//, "/o/");
			if (newsrc !== src)
				return newsrc;

			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+.*?\/(aHR0c[^?#/.]+)(?:[?#.].*)?$/, "$1");
			if (newsrc !== src)
				return base64_decode(newsrc);
		}

		if ((domain_nosub === "taobaocdn.com" ||
			 // http://img4.tbcdn.cn/tfscom/i2/TB1pfOBJVXXXXXbXpXXXXXXXXXX_!!0-item_pic.jpg_400x400.jpg
			 //   http://img4.tbcdn.cn/tfscom/i2/TB1pfOBJVXXXXXbXpXXXXXXXXXX_!!0-item_pic.jpg
			 domain_nosub === "tbcdn.cn") &&
			domain.match(/img[0-9]*\./)) {
			// http://img03.taobaocdn.com/bao/uploaded/i3/14462022101110112/T1vwOaXppbXXXXXXXX_!!0-item_pic.jpg_310x310.jpg
			//   http://img03.taobaocdn.com/bao/uploaded/i3/14462022101110112/T1vwOaXppbXXXXXXXX_!!0-item_pic.jpg
			return src.replace(/(\.[^/._]*)_[^/.]*\.[^/.]*$/, "$1");
		}

		if (domain === "www.musictory.com" &&
			src.match(/\/pictures\//)) {
			// http://www.musictory.com/pictures/thumbnails/78647.jpg
			return src.replace(/\/pictures\/[a-z]*\//, "/pictures/originali/");
		}

		if (domain_nosub === "santabanta.com" && domain.match(/media[0-9]*\.santabanta\.com/)) {
			// http://media1.santabanta.com/full1/Music%20Bands/The%20Pussycat%20Dolls/the-pussycat-dolls-33a.jpg
			//   http://media1.santabanta.com/full8/Music%20Bands/The%20Pussycat%20Dolls/the-pussycat-dolls-33a.jpg
			// http://media.santabanta.com/gallery/Global%20Celebrities(F)/Alejandra%20Guilmant/Alejandra-Guilmant-3-d_th.jpg
			//   http://media.santabanta.com/gallery/Global%20Celebrities(F)/Alejandra%20Guilmant/Alejandra-Guilmant-3-d.jpg
			// http://media.santabanta.com/medium1/global%20celebrities(f)/alejandra%20guilmant/alejandra-guilmant-2a.jpg
			//   http://media1.santabanta.com/full1/global%20celebrities(f)/alejandra%20guilmant/alejandra-guilmant-2a.jpg
			//   http://media1.santabanta.com/full6/global%20celebrities(f)/alejandra%20guilmant/alejandra-guilmant-2a.jpg (7 and 8 don't work)
			newsrc = src
				.replace(/_th(\.[^/.]*)$/, "$1")
				.replace(/:\/\/media\.santabanta\.com\/medium[0-9]*\//, "://media1.santabanta.com/full1/");
			if (newsrc !== src)
				return newsrc;

			if (src.match(/\/full[0-9]*\//)) {
				return [
					src.replace(/\/full[0-9]*\//, "/full8/"),
					src.replace(/\/full[0-9]*\//, "/full7/"),
					src.replace(/\/full[0-9]*\//, "/full6/"),
					src.replace(/\/full[0-9]*\//, "/full5/")
				];
			}
		}

		if (domain === "www.movieinsider.com" &&
			string_indexof(src, "/images/p/") >= 0) {
			// https://www.movieinsider.com/images/p/600//18408_m1273372143.jpg
			//   https://www.movieinsider.com/images/p//18408_m1273372143.jpg
			return src.replace(/\/images\/p\/[0-9]+\//, "/images/p/");
		}

		if (domain_nosub === "kastden.org") {
			// https://selca.kastden.org/thumb/1271876
			//   https://selca.kastden.org/original/1271876
			// https://kastden.org/topstarnews/thumbs/1433163841-81-org_th.jpg
			//   https://kastden.org/topstarnews/1433163841-81-org.jpg
			return src
				.replace(/\/thumbs\/+([^/]+)_th(\.[^/]+)(?:[?#].*)?$/, "/$1$2")
				.replace(/\/thumb\//, "/original/");
		}

		if (domain === "img.hani.co.kr") {
			// http://img.hani.co.kr/imgdb/resize/2018/0324/53_1521866554_00500158_20180324.JPG
			//   http://img.hani.co.kr/imgdb/resize/2018/0324/00500158_20180324.JPG
			//   http://img.hani.co.kr/imgdb/original/2018/0324/00500158_20180324.JPG
			// http://img.hani.co.kr/imgdb/resize/2018/0325/52_1521866282_152186627183_20180325.JPG
			//   http://img.hani.co.kr/imgdb/resize/2018/0325/152186627183_20180325.JPG
			//   http://img.hani.co.kr/imgdb/original/2018/0325/152186627183_20180325.JPG
			// http://img.hani.co.kr/imgdb/thumbnail/2018/0223/151928494178_20180223.JPG
			//   http://img.hani.co.kr/imgdb/resize/2018/0223/151928494178_20180223.JPG
			//   http://img.hani.co.kr/imgdb/original/2018/0223/151928494178_20180223.JPG
			return src
				.replace(/\/(?:thumbnail|resize)\//, "/original/")
				.replace(/\/[0-9]+_[0-9]+_([0-9]+_[0-9]+\.[^/.]*)$/, "/$1");
		}

		if (domain === "flexible.img.hani.co.kr") {
			// http://flexible.img.hani.co.kr/flexible/box/120/120/imgdb/resize/2018/0320/00503324_20180320.JPG
			//   http://img.hani.co.kr/imgdb/resize/2018/0320/00503324_20180320.JPG
			// http://flexible.img.hani.co.kr/flexible/box/120/120/imgdb/resize/2012/0823/1345624227_134562400908_20120823.JPG
			//   http://img.hani.co.kr/imgdb/resize/2012/0823/1345624227_134562400908_20120823.JPG
			//   original doesn't work
			return src.replace(/:\/\/[^/]*\/flexible\/.*?\/imgdb\//, "://img.hani.co.kr/imgdb/");
		}

		if (domain === "static.ok.co.uk" ||
			// http://static.ok.co.uk.s3.amazonaws.com/media/images/625x938_ct/635516_1433940709_dani-dyer-age-of-kill-private-screening_ba3b9a6ae1c2f94238d6371b18ab9c9d.jpg
			//   http://static.ok.co.uk.s3.amazonaws.com/media/images/original/635516_1433940709_dani-dyer-age-of-kill-private-screening_ba3b9a6ae1c2f94238d6371b18ab9c9d.jpg -- same size
			amazon_container === "static.ok.co.uk" ||
			// https://images.24ur.com/media/images/884xX/Mar2017/57e99fb58d_61899670.jpg?v=2316 -- stretched
			//   https://images.24ur.com/media/images/original/Mar2017/57e99fb58d_61899670.jpg?v=2316
			domain === "images.24ur.com" ||
			// https://image.dnevnik.hr/media/images/1024xX/Jun2018/61512291-jennifer-aniston-courteney-cox.jpg
			//   https://image.dnevnik.hr/media/images/original/Jun2018/61512291-jennifer-aniston-courteney-cox.jpg
			domain === "image.dnevnik.hr" ||
			// https://img.bg.sof.cmestatic.com/media/images/640x/Aug2013/61160739.jpg
			//   https://img.bg.sof.cmestatic.com/media/images/original/Aug2013/61160739.jpg
			domain === "img.bg.sof.cmestatic.com" ||
			// https://static.altchar.com/live/media/images/950x633_ct/8751_GTA_V_Trevor_816147886355e25279eae3062893c081.jpg
			//   https://static.altchar.com/live/media/images/original/8751_GTA_V_Trevor_816147886355e25279eae3062893c081.jpg
			domain === "static.altchar.com" ||
			// https://img.cz.prg.cmestatic.com/media/images/660xX/Jul2015/1769944.jpg?d41d
			//   https://img.cz.prg.cmestatic.com/media/images/original/Jul2015/1769944.jpg?d41d
			domain === "img.cz.prg.cmestatic.com" ||
			// https://image.stirileprotv.ro/media/images/680xX/Sep2016/61836926.jpg
			//   https://image.stirileprotv.ro/media/images/original/Sep2016/61836926.jpg
			domain === "image.stirileprotv.ro" ||
			// thanks to ValiumBear on github: https://github.com/qsniyg/maxurl/issues/1367
			// https://images.rtl.hr/media/images/822x468/Nov2022/c755032ed5a7494a17e8_47733.jpg?v=5470
			//   https://images.rtl.hr/media/images/original/Nov2022/c755032ed5a7494a17e8_47733.jpg
			domain === "images.rtl.hr" ||
			// http://ns.hitcreative.com.s3.amazonaws.com/media/images/640x960/651.jpg
			//   http://ns.hitcreative.com.s3.amazonaws.com/media/images/original/651.jpg
			amazon_container === "ns.hitcreative.com") {
			// https://static.ok.co.uk/media/images/625x938_ct/1060392_GettyImages_488606950_ddcc7556b12de0d94bf5118cda2310d2.jpg
			//   https://static.ok.co.uk/media/images/original/1060392_GettyImages_488606950_ddcc7556b12de0d94bf5118cda2310d2.jpg
			// http://static.ok.co.uk/media/images/625x417_ct/737562_nick_hewer_9ab914ab8a82c5effdb695a41741ab84.jpg?w=900
			//   http://static.ok.co.uk/media/images/original/737562_nick_hewer_9ab914ab8a82c5effdb695a41741ab84.jpg
			return src
				.replace(/\?.*/, "")
				.replace(/\/media\/images\/[^/]*\//, "/media/images/original/");
		}

		if (domain_nosub === "galaxypub.vn" && domain.match(/rs[0-9]*\.galaxypub\.vn/)) {
			// http://rs100.galaxypub.vn/staticFile/Subject/2018/02/14/361011/2_141343791.jpg?w=300&h=168
			//   http://st.galaxypub.vn/staticFile/Subject/2018/02/14/361011/2_141343791.jpg
			return src.replace(/:\/\/[^/]*(\/.*?)(?:\?.*)?$/, "://st.galaxypub.vn$1");
		}

		if (domain_nowww === "implanetcorp.com" &&
			string_indexof(src, "/upload/ctoon/") >= 0) {
			// http://www.implanetcorp.com/upload/ctoon/gravure/15/2cx368d9b03d25a21839e3ff2c8b4ff3e266gyv5/15_thumb_0f4b73d6eb051c635a246df3e36d712c.jpg
			//   http://www.implanetcorp.com/upload/ctoon/gravure/15/2cx368d9b03d25a21839e3ff2c8b4ff3e266gyv5/resize/001.JPG
			//   http://www.implanetcorp.com/upload/ctoon/gravure/15/2cx368d9b03d25a21839e3ff2c8b4ff3e266gyv5/original/001.JPG
			// http://www.implanetcorp.com/upload/ctoon/gravure/15/m1648d5a7d3f7856e668c7fa20336f9a97bc6vro/15_thumb_fecc0a9e6650bca40094b86194629705.jpg
			//   http://www.implanetcorp.com/upload/ctoon/gravure/15/m1648d5a7d3f7856e668c7fa20336f9a97bc6vro/original/001.jpg
			return src
				//.replace(/\/[0-9]+_thumb_[0-9a-f]+(\.[^/.]*)$/, "/original/001.JPG")
				.replace(/\/[a-z]*\/([0-9]+\.[^/.]*)$/, "/original/$1");
		}

		if (domain_nowww === "doramakun.ru") {
			// http://doramakun.ru/thumbs/users/15581/photo/84/TQPg5IWwQTQ-185.jpg
			//   http://doramakun.ru/users/15581/photo/84/TQPg5IWwQTQ.jpg
			// http://doramakun.ru/thumbs/users/15581/photo/84/bRhbKntPXhI-185.jpg
			//   http://doramakun.ru/thumbs/users/15581/photo/84/bRhbKntPXhI-413.jpg
			//   http://doramakun.ru/users/15581/photo/84/bRhbKntPXhI.jpg -- same size
			return src.replace(/\/thumbs\/(.*)-[0-9]+(\.[^/.]*)$/, "/$1$2");
		}

		if (domain === "1gr.cz") {
			// www.1gr.cz != 1gr.cz
			// https://1gr.cz/fotky/idnes/15/043/cl5/ZAR5ab634_MA210_USA_ENTERTAINMENT_0421_11.JPG
			//   https://1gr.cz/fotky/idnes/15/043/org/ZAR5ab634_MA210_USA_ENTERTAINMENT_0421_11.JPG
			return src.replace(/(\/[0-9]+\/[0-9]+\/)[^/]*\/([^/]*)$/, "$1org/$2");
		}

		if (domain_nosub === "ancensored.com" &&
			src.match(/\/files\/images\//)) {
			// http://ancensored.com/files/images/vthumbs/r/f284d8efea6df08d1df56ced003397f2.jpg
			//   http://ancensored.com/files/images/vthumbs/r/f284d8efea6df08d1df56ced003397f2_full.jpg
			// http://es.ancensored.com/files/images/vthumbs/r/f284d8efea6df08d1df56ced003397f2.jpg
			//   http://es.ancensored.com/files/images/vthumbs/r/f284d8efea6df08d1df56ced003397f2_full.jpg
			return src.replace(/(\/[0-9a-f]*)(?:_[a-z]*)?(\.[^/.]*)$/, "$1_full$2");
		}

		if (domain_nowww === "desktopbackground.org" ||
			// https://www.desktop-background.com/download/720x1280/2013/10/17/655520_kristen-stewart-sexy-wallpapers-hd-1600x1200-pictures-collection_1920x1440_h.jpg
			//   https://www.desktop-background.com/download/o/2013/10/17/655520_kristen-stewart-sexy-wallpapers-hd-1600x1200-pictures-collection_1920x1440_h.jpg
			domain_nowww === "desktop-background.com") {
			// https://www.desktopbackground.org/download/800x600/2014/11/15/856176_hd-wallpapers-4users-rachel-riley-hd-wallpapers-1080p_1600x1000_h.jpg
			//   https://www.desktopbackground.org/p/2014/11/15/856176_hd-wallpapers-4users-rachel-riley-hd-wallpapers-1080p_1600x1000_h.jpg
			//   https://www.desktopbackground.org/download/o/2014/11/15/856176_hd-wallpapers-4users-rachel-riley-hd-wallpapers-1080p_1600x1000_h.jpg
			// https://www.desktopbackground.org/t/2011/05/11/201347_stella-with-a-sword-black-rock-shooter-desktop-wallpapers-28850_2560x1600_h.jpg
			//   https://www.desktopbackground.org/download/o/2011/05/11/201347_stella-with-a-sword-black-rock-shooter-desktop-wallpapers-28850_2560x1600_h.jpg
			return src
				.replace(/\/download\/[^/]*\//, "/download/o/")
				.replace(/(:\/\/[^/]*)\/[pt]\//, "$1/download/o/");
		}

		if (domain === "image.mlive.com" ||
			// http://image.nj.com/home/njo-media/width600/img/sixers_main/photo/embiid-rihannajpg-f2240659a535f626.jpg
			//   http://media.nj.com/sixers_main/photo/embiid-rihannajpg-f2240659a535f626.jpg
			domain === "image.nj.com" ||
			// https://image.cleveland.com/home/cleve-media/width600/img/ent_impact_home/photo/rihanna-1075cbb4ed700882.jpg
			//   https://media.cleveland.com/ent_impact_home/photo/rihanna-1075cbb4ed700882.jpg
			domain === "image.cleveland.com") {
			// http://image.mlive.com/home/mlive-media/width307/img/grpress/news_impact/photo/24285148-standard.jpg
			//   https://image-api.advance.net/prod/resize?key=home/mlive-media/width307/img/grpress/news_impact/photo/24285148-standard.jpga
			//   http://media.mlive.com/grpress/news_impact/photo/24285148-standard.jpg
			return src.replace(/:\/\/image\.([^/]*)\/home\/[a-z]+-media\/[^/]*\/img\//, "://media.$1/");
		}

		if (domain === "s9v7j7a4.ssl.hwcdn.net" ||
			// thanks to anonymous for reporting:
			// https://data-cdn.multi.xnxx.com/galleries/new_small/cd/88/49/cd8849f19d6f5fff5e6ba44172a4fd09/3.jpg
			//   https://data-cdn.multi.xnxx.com/galleries/full/cd/88/49/cd8849f19d6f5fff5e6ba44172a4fd09/3.jpg
			domain === "data-cdn.multi.xnxx.com") {
			// https://s9v7j7a4.ssl.hwcdn.net/galleries/new_big/58/df/5c/58df5c4f13e698517e6a9aa00e311f9a/3.jpg
			//   https://s9v7j7a4.ssl.hwcdn.net/galleries/full/58/df/5c/58df5c4f13e698517e6a9aa00e311f9a/3.jpg
			//return src.replace(/\/galleries\/[^/]*\//, "/galleries/full/");
			return src.replace(/(\/galleries\/+)[^/]+\/+([0-9a-f]{2}\/+)/, "$1full/$2");
		}

		if (domain === "k5x5n5g8.ssl.hwcdn.net" ||
			// https://k4b8k3x5.ssl.hwcdn.net/content/170846/cute-doll-hottie-higurashi-rin-shows-her-attractive-young-body-in-miracle-miko-1-01_w400.jpg
			//   https://k4b8k3x5.ssl.hwcdn.net/content/170846/cute-doll-hottie-higurashi-rin-shows-her-attractive-young-body-in-miracle-miko-1-01.jpg
			domain === "k4b8k3x5.ssl.hwcdn.net" ||
			// https://f6j6u6m9.ssl.hwcdn.net/content/190631/mesmerizing-young-redhead-sensualy-presents-her-naked-petite-body-in-the-kitchen-01_w400.jpg
			//   https://f6j6u6m9.ssl.hwcdn.net/content/190631/mesmerizing-young-redhead-sensualy-presents-her-naked-petite-body-in-the-kitchen-01.jpg
			domain === "f6j6u6m9.ssl.hwcdn.net" ||
			// https://cdn.yavtube.com/babes/content/140701/aislin-bogotha-01_w400.jpg
			//   https://cdn.yavtube.com/babes/content/140701/aislin-bogotha-01.jpg
			domain === "cdn.yavtube.com" ||
			// https://img.yavtube.com/babes/content/140701/aislin-bogotha-01_w400.jpg
			//   https://img.yavtube.com/babes/content/140701/aislin-bogotha-01.jpg
			domain === "img.yavtube.com" ||
			// https://a2h6m3w6.ssl.hwcdn.net/content/200101/0004-01_w400.jpg
			//   https://a2h6m3w6.ssl.hwcdn.net/content/200101/0004-01.jpg
			// other:
			// https://a2h6m3w6.ssl.hwcdn.net/content/200104/0001_400.jpg -- 0001.jpg doesn't work, album cover
			domain === "a2h6m3w6.ssl.hwcdn.net" ||
			// thanks to vscum on github: https://github.com/qsniyg/maxurl/pull/1121
			// https://p8k5i9q7.map2.ssl.hwcdn.net/content/170625/skinny-babe-ivy-can-load-a-huge-dildo-deep-into-her-shaved-pussy-02_w600.jpg
			//   https://p8k5i9q7.map2.ssl.hwcdn.net/content/170625/skinny-babe-ivy-can-load-a-huge-dildo-deep-into-her-shaved-pussy-02.jpg
			// https://p8k5i9q7.map2.ssl.hwcdn.net/content/130107/black-dress-with-embry-01_w600.jpg
			//   https://p8k5i9q7.map2.ssl.hwcdn.net/content/130107/black-dress-with-embry-01.jpg
			domain === "p8k5i9q7.map2.ssl.hwcdn.net" ||
			// thanks to vscum on github: https://github.com/qsniyg/maxurl/issues/1240
			// https://cdn.elitebabes.com/content/171153/0010-05_w600.jpg
			//   https://cdn.elitebabes.com/content/171153/0010-05.jpg
			// https://cdn.elitebabes.com/content/181136/0002-01_w400.jpg
			//   https://cdn.elitebabes.com/content/181136/0002-01.jpg
			// https://cdn.elitebabes.com/content/140517/selena-the-love-i-need-01_w400.jpg
			//   https://cdn.elitebabes.com/content/140517/selena-the-love-i-need-01.jpg
			// https://cdn.elitebabes.com/content/141012/sati-rinise-01_w400.jpg
			//   https://cdn.elitebabes.com/content/141012/sati-rinise-01.jpg
			// thanks to anonymous for reporting:
			// https://cdn.elitebabes.com/content/200905/0002-01_1200.jpg
			//   https://cdn.elitebabes.com/content/200905/0002-01.jpg
			domain === "cdn.elitebabes.com" ||
			// thanks to anonymous for reporting:
			// https://cdn.metarthunter.com/content/231257/0010-01_w400.jpg
			//   https://cdn.metarthunter.com/content/231257/0010-01_1200.jpg
			domain === "cdn.metarthunter.com" ||
			// https://c9w8v3m5.ssl.hwcdn.net/content/130305/bree-glamorous-01_w400.jpg
			//   https://c9w8v3m5.ssl.hwcdn.net/content/130305/bree-glamorous-01.jpg
			domain === "c9w8v3m5.ssl.hwcdn.net") {
			// https://k5x5n5g8.ssl.hwcdn.net/content/181035/0013-03_w400.jpg
			//   https://k5x5n5g8.ssl.hwcdn.net/content/181035/0013-03.jpg
			newsrc = src.replace(/(\/content\/+[0-9]+\/+[^/]+-[0-9]+)_(?:[wh][0-9]+|1200)(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
			if (newsrc !== src) {
				return {
					url: newsrc,
					headers: {
						Referer: "https://" + domain_nosub + "/"
					}
				};
			}
		}

		if (domain_nowww === "xjapanese.com") {
			// https://xjapanese.com/pornpics/azusa-misaki/bgg00003/azusa-misaki-12-pin.jpg
			//   https://xjapanese.com/pornpics/azusa-misaki/bgg00003/azusa-misaki-12.jpg
			return src.replace(/(\/pornpics\/.*)-pin(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "hwcdn.funbags.com" ||
			// https://hwcdn.voyeurweb.com/albums/3330225/large/5634400-boudoir-set.jpg
			//   https://hwcdn.voyeurweb.com/albums/3330225/orig/5634400-boudoir-set.jpg
			domain === "hwcdn.voyeurweb.com") {
			// https://hwcdn.funbags.com/albums/1082885/thumb/2646921-hot-mexican-girlfriend-at-the-computer.jpg
			//   https://hwcdn.funbags.com/albums/1082885/orig/2646921-hot-mexican-girlfriend-at-the-computer.jpg
			regex = /(\/albums\/+[0-9]+\/+)(?:thumb|large)\/+/;

			obj = [];

			newsrc = src.replace(regex, "$1orig/");
			if (newsrc !== src)
				obj.push(newsrc);

			newsrc = src.replace(regex, "$1large/");
			if (newsrc !== src)
				obj.push(newsrc);

			if (obj.length > 0)
				return obj;
		}

		if (domain === "aws-foto.amateri.com") {
			// https://aws-foto.amateri.com/foto/4/9/7/1/g1778419/14400873/170x220c.jpg
			//   https://aws-foto.amateri.com/foto/4/9/7/1/g1778419/14400873/x.jpg
			return src.replace(/\/[0-9]+x[^/.]*(\.[^/.]*)$/, "/x$1");
		}

		if (domain === "cdn.tobi.com" ||
			// thanks to anonymous for reporting:
			// https://img.tobi.com/product_images/xs/1/red-no-time-dolphin-hem-skirt.jpg
			//   https://img.tobi.com/product_images/lg/1/red-no-time-dolphin-hem-skirt@2x.jpg
			domain === "img.tobi.com") {
			// https://cdn.tobi.com/product_images/sm/1/natural-infinite-glow-layered-bracelet-set.jpg
			//   https://cdn.tobi.com/product_images/lg/1/natural-infinite-glow-layered-bracelet-set@2x.jpg
			// https://cdn.tobi.com/product_images/md/1/rose-eyes-on-you-knotted-maxi-dress.jpg
			//   https://cdn.tobi.com/product_images/lg/1/rose-eyes-on-you-knotted-maxi-dress@2x.jpg
			// https://cdn.tobi.com/product_images/xs/1/black-zeira-top.jpg
			//   https://cdn.tobi.com/product_images/lg/1/black-zeira-top@2x.jpg
			return src
				.replace(/\/product_images\/[a-z]+\//, "/product_images/lg/")
				.replace(/(\/[^/.@]*)(\.[^/.]*)$/, "$1@2x$2");
		}

		if (domain === "www.rfa.org") {
			// https://www.rfa.org/english/commentaries/energy_watch/tariff-row-may-do-little-economic-damage-in-china-04022018101727.html/china-shopper-supermarket-beijing-apr2-2018.jpg/@@images/0fe75452-e65b-4e6b-a5b3-3db87b335e19.jpeg
			//   https://www.rfa.org/english/commentaries/energy_watch/tariff-row-may-do-little-economic-damage-in-china-04022018101727.html/china-shopper-supermarket-beijing-apr2-2018.jpg
			// https://www.rfa.org/english/news/china/surveillance-03302018111415.html/china-security-camera-beijing-march-2018.jpg/@@images/87f9b6b7-fcea-43d1-845b-a1ae6a022908.jpeg
			//   https://www.rfa.org/english/news/china/surveillance-03302018111415.html/china-security-camera-beijing-march-2018.jpg
			return src.replace(/\/@@images\/.*/, "");
		}

		if (domain === "resize.blogsys.jp") {
			// http://resize.blogsys.jp/94afa543ba574167ccfea7dfa414f8f2672f474a/crop1/70x70/http://livedoor.blogimg.jp/destinychild/imgs/2/e/2eed2325.jpg
			//   http://livedoor.blogimg.jp/destinychild/imgs/2/e/2eed2325.jpg
			return src.replace(/^[a-z]*:\/\/.*\/([a-z]*:\/\/.*)$/, "$1");
		}

		if (amazon_container === "bw-1651cf0d2f737d7adeab84d339dbabd3-gallery") {
			// https://bw-1651cf0d2f737d7adeab84d339dbabd3-gallery.s3.amazonaws.com/images/image_2766690/b3c7292a567fb4de95fbf3cadfcecc67_thumbnail.jpg
			//   https://bw-1651cf0d2f737d7adeab84d339dbabd3-gallery.s3.amazonaws.com/images/image_2766690/b3c7292a567fb4de95fbf3cadfcecc67_large.jpg
			//   https://bw-1651cf0d2f737d7adeab84d339dbabd3-gallery.s3.amazonaws.com/images/image_2766690/b3c7292a567fb4de95fbf3cadfcecc67_original.jpg
			// https://s3.amazonaws.com/bw-1651cf0d2f737d7adeab84d339dbabd3-gallery/images/image_2766690/b3c7292a567fb4de95fbf3cadfcecc67_thumbnail.jpg
			//   https://s3.amazonaws.com/bw-1651cf0d2f737d7adeab84d339dbabd3-gallery/images/image_2766690/b3c7292a567fb4de95fbf3cadfcecc67_original.jpg
			return src.replace(/_[a-z]+(\.[^/.]*)$/, "_original$1");
		}

		if (domain_nosub === "rl0.ru" && domain.match(/img[0-9]*\.rl0\.ru/)) {
			// https://img09.rl0.ru/a4a2e0b13fb27ee8aed0196cebf4a0bc/c500x281/i.imgur.com/a5MASCq.gif
			//   http://i.imgur.com/a5MASCq.gif
			// https://img02.rl0.ru/f0ae2d1540ad72f10378305af4ff7201/563x1000/news.rambler.ru/img/2017/09/18140001.943169.900.jpeg
			//   https://news.rambler.ru/img/2017/09/18140001.943169.900.jpeg
			// https://img.rl0.ru/afisha/144x144/newid.afisha.ru/StaticContent/UserPhoto/f0/8a/e4f2dc0aa41d4aaa99f508853432f08a.jpg
			//   http://newid.afisha.ru/StaticContent/UserPhoto/f0/8a/e4f2dc0aa41d4aaa99f508853432f08a.jpg
			// https://img02.rl0.ru/36ce9f16fe7e2f1ea50222bac271ac8a/500x-/news.rambler.ru/img/2017/12/30144958.211648.7624.jpg
			//   https://news.rambler.ru/img/2017/12/30144958.211648.7624.jpg
			// https://img.rl0.ru/d7d0fa8bb9c76a36bd70c516c6c405dc/c615x400i/news.rambler.ru/img/2019/02/20174630.183199.6426.jpg
			//   https://news.rambler.ru/img/2019/02/20174630.183199.6426.jpg
			// https://img03.rl0.ru/afisha/195x120q85i/s.afisha.ru/mediastorage/db/a7/4a602d933872404093ea0292a7db.jpeg
			//   http://s.afisha.ru/mediastorage/db/a7/4a602d933872404093ea0292a7db.jpeg
			// https://img06.rl0.ru/afisha/e630x310p0x126f6052x3018q85i/s.afisha.ru/mediastorage/e2/4d/89dc0c928a1b424eb2bca9004de2.jpg
			//   http://s.afisha.ru/mediastorage/e2/4d/89dc0c928a1b424eb2bca9004de2.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/[^/]*\/+[ce]?[-0-9]+x[-0-9]+(?:[pf][0-9]+x[0-9]+)*(?:q[0-9]+)?i?\/+([^/]*\.[^/.]*\/)/, "$1");
			if (newsrc !== src)
				return add_http(newsrc);
			//return src.replace(/^[a-z]+:\/\/[^/]*\/[a-z0-9]+\/c?[-0-9]+x[-0-9]+[a-z]?\//, "http://");
		}

		if (domain === "news.store.rambler.ru") {
			// thanks to roi
			// https://news.store.rambler.ru/img/9b4aed4b1dd0b05eb16e3b6f095434fb?img-format=auto&img-1-resize=height:315,fit:max&img-2-filter=sharpen
			//   https://news.store.rambler.ru/img/9b4aed4b1dd0b05eb16e3b6f095434fb?img-format=png
			return src.replace(/(\/img\/+[0-9a-f]+)\?.*/, "$1?img-format=png");
		}

		if (domain_nosub === "wanelo.com" && domain.match(/cdn-img-[0-9]+\.wanelo\.com/)) {
			// https://cdn-img-1.wanelo.com/p/914/ad1/157/33d5c0fef57bd90c33c7fd0/x354-q80.jpg
			//   https://cdn-img-1.wanelo.com/p/914/ad1/157/33d5c0fef57bd90c33c7fd0/full_size.jpg
			return src.replace(/\/[^/.]*(\.[^/.]*)$/, "/full_size$1");
		}

		if (domain === "static.kvraudio.com") {
			// https://static.kvraudio.com/i/s/g-sonique-neurofunker-xg6.jpg
			//   https://static.kvraudio.com/i/b/g-sonique-neurofunker-xg6.jpg
			return src.replace(/(:\/\/[^/]*\/i\/)[a-z]\//, "$1b/");
		}

		if (domain === "contents.dt.co.kr") {
			// http://contents.dt.co.kr/thum/99/2018040602100932052001_99_3.jpg
			//   http://contents.dt.co.kr/images/201804/2018040602100932052001[1].jpg
			//   http://contents.dt.co.kr/images/201804/2018040602100932052001.jpg
			return src.replace(/\/thum\/[0-9]+\/([0-9]{6})([0-9]+)_[^/.]*(\.[^/.]*)/, "/images/$1/$1$2$3");
		}

		if (domain === "eng.dt.co.kr") {
			// http://eng.dt.co.kr/images/thum/20180405111518001543.jpg
			//   http://eng.dt.co.kr/images/oriimg/20180405111518001543[0].jpg
			return src.replace(/\/images\/thum\/([0-9]+)/, "/images/oriimg/$1[0]");
		}

		// http://image.ytn.co.kr/general/jpg/2017/0831/201708311021406804_d.jpg
		if (domain === "image.ytn.co.kr" ||
			// http://img.sciencetv.kr/sciencetv/jpg/vod1142/2018/201801301101561712_h.jpg
			//   http://img.sciencetv.kr/sciencetv/jpg/vod1142/2018/201801301101561712_d.jpg
			domain === "img.sciencetv.kr") {
			// http://image.ytn.co.kr/general/jpg/2018/0402/201804022235469141_h.jpg -- doesn't work:
			//   http://image.ytn.co.kr/general/jpg/2018/0402/201804022235469141_t.jpg -- works
			//   http://www.ytn.co.kr/_ln/0102_201804022235469141_002 -- is video thumbnail
			// https://image.ytn.co.kr/osen/2015/04/201504021535773633_551ce374d4e52.jpg
			//   http://file.osen.co.kr/article/original/2015/04/02/201504021535773633_551ce374d4e52.jpg
			// d, t, h, k, j
			return src
				.replace(/(:\/\/[^/]*\/[^/]*\/jpg\/[^/]*\/[^/]*\/[0-9]+_)[a-z](\.[^/.]*)$/, "$1d$2")
				.replace(/^[a-z]+:\/\/[^/]*\/osen\/+([0-9]{4}\/+[0-9]{2}\/+)([0-9]{6})([0-9]{2})([^/]*)(?:[?#].*)?$/,
						 "http://file.osen.co.kr/article/$1$3/$2$3$4");
		}

		if (domain === "photo.kmib.co.kr") {
			//http://photo.kmib.co.kr/index.asp?number=4925&page=6
			// http://photo.kmib.co.kr/data/4925/thumb_20150825103025.jpg
			//   http://photo.kmib.co.kr/data/4925/20150825103025.jpg
			return src.replace(/\/thumb_([0-9]+\.[^/.]*)$/, "/$1");
		}

		if (domain === "image.kmib.co.kr") {
			// http://image.kmib.co.kr/online_image/2019/0828/611811110013651516_1.jpg
			// other:
			// http://image.kmib.co.kr/online_image/2011/0505/0923098852.jpg -- 3184x2120
			// http://image.kmib.co.kr/online_image/2012/0412/0412yd71-in.jpg -- 2000x2500
			// http://image.kmib.co.kr/online_image/2018/1212/611211110012911552_1.jpg -- 4406x2244
			//
			// http://news.kmib.co.kr/article/view.asp?arcid=0013641297&code=61171811&sid1=lif
			//   http://image.kmib.co.kr/clipImage/2019/0827/20190827101345.JPG
			//   http://image.kmib.co.kr/online_image/2019/0826/611718110013641297_1.jpg
			var extra = {};
			match = src.match(/\/online_image\/+[0-9]{4}\/+[0-9]{4}\/+[0-9]*([0-9]{10})(?:_[0-9]+)?\.[^/.]*(?:[?#].*)?$/);
			if (match) {
				extra.page = "http://news.kmib.co.kr/article/view.asp?arcid=" + match[1];
			}

			return {
				url: src,
				extra: extra
			};
		}

		if (domain === "r.kelkoo.com") {
			// http://r.kelkoo.com/r/uk/15002013/146501/auto/auto/https%253A%252F%252Fdyson-h.assetsadobe2.com%252Fis%252Fimage%252Fcontent%252Fdam%252Fdyson%252Fimages%252Fproducts%252Fprimary%252F231868-01.png%253F%2524responsive%2524%2526fmt%253Dpng-alpha%2526cropPathE%253Ddesktop%2526fit%253Dstretch%252C1%2526wid%253D800/T5JylUsrxw8XjkR2zJUTmqQIfK8oIrzwXgEbTo_Jtn0-?searchId=10769920122096_1520492759094_270260&offerId=206b270741bc0810a4c2fc0d1b48d86f
			//   https://dyson-h.assetsadobe2.com/is/image/content/dam/dyson/images/products/primary/231868-01.png?$responsive$&fmt=png-alpha&cropPathE=desktop&fit=stretch,1&wid=800
			// https://r.kelkoo.com/resize.php?country=de&merchantId=16240913&categoryId=134101&width=90&height=90&image=https://static.shop-apotheke.com/images/D12391508-p1.jpg&sign=ESE.mSGBandnnojBPJJ9hgnoooEByCwODsLQPH42iEY-
			//   https://static.shop-apotheke.com/images/D12391508-p1.jpg
			newsrc = src.replace(/^[a-z]*:\/\/(?:[^/]*\/){7}(http[^/]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);

			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+resize\.php\?(?:.*?&)?image=([^&]+).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		// scene7?
		if (((domain_nosub === "assetsadobe2.com" ||
			 // https://sh-s7-live-s.legocdn.com/is/image/LEGO/75192_alt4?fit=constrain,1&wid=46&hei=37&fmt=jpg
			 //   https://sh-s7-live-s.legocdn.com/is/image/LEGO/75192_alt4?scl=1 -- 2400x1800 (with white background)
			 //   https://sh-s7-live-s.legocdn.com/is/image/LEGO/75192_alt4?scl=1&fmt=png-alpha (transparent)
			 // https://sh-s7-live-s.legocdn.com/is/image/LEGOMKTG/71043-family--2018--gl--mainstage-background--large?$MainStageBackgroundLarge$ -- 1280x500
			 //   https://sh-s7-live-s.legocdn.com/is/image/LEGOMKTG/71043-family--2018--gl--mainstage-background--large?scl=1 -- 2560x1000
			 domain_nosub === "legocdn.com" ||
			 // https://store.storeimages.cdn-apple.com/4982/as-images.apple.com/is/image/AppleInc/aos/published/images/i/pa/ipad/mini/ipad-mini-select-201903_FMT_WHH?wid=2000&hei=2000&fmt=jpeg&qlt=80&op_usm=0.5,0.5&.v=1552171100800
			 //   https://store.storeimages.cdn-apple.com/4982/as-images.apple.com/is/image/AppleInc/aos/published/images/i/pa/ipad/mini/ipad-mini-select-201903_FMT_WHH?scl=1&fmt=png-alpha -- same size, but with alpha
			 domain === "store.storeimages.cdn-apple.com" ||
			 // https://media.playstation.com/is/image/SCEA/ea-sports-nhl-19-logo-white-01-ps4-us-13sep18?$native_t$
			 //   https://media.playstation.com/is/image/SCEA/ea-sports-nhl-19-logo-white-01-ps4-us-13sep18?scl=1&fmt=png-alpha
			 domain === "media.playstation.com" ||
			 // https://images.samsung.com/is/image/samsung/p5/nz/faq_images/hhp_images/tash/SAM0212_Suglasses.png?$ORIGIN_PNG$ -- 3674x2258
			 //   https://images.samsung.com/is/image/samsung/p5/nz/faq_images/hhp_images/tash/SAM0212_Suglasses.png?scl=1&fmt=png-alpha -- 3674x2258 (same, but took a much longer time to load)
			 domain === "images.samsung.com" ||
			 // https://images.anthropologie.com/is/image/Anthropologie/51517498_000_b6?scl=1
			 //   https://images.anthropologie.com/is/image/Anthropologie/51517498_000_b6?scl=1&fmt=png-alpha -- same, but much longer to load
			 domain === "images.anthropologie.com" ||
			 // http://s7.leapfrog.com/is/image/LeapFrog/leapstart-3d-moonlight-hero-pj-masks-80-460100_1
			 //   http://s7.leapfrog.com/is/image/LeapFrog/leapstart-3d-moonlight-hero-pj-masks-80-460100_1?scl=1&fmt=png-alpha -- doesn't work ("illegal image size")
			 //domain_nosub === "leapfrog.com" ||
			 // https://eu.louisvuitton.com/images/is/image/lv/1/PP_VP_L/louis-vuitton-vivienne-stole-scarves-and-hats--MP2122_PM2_Front%20view.jpg
			 //   https://eu.louisvuitton.com/images/is/image/lv/1/PP_VP_L/louis-vuitton-vivienne-stole-scarves-and-hats--MP2122_PM2_Front%20view.jpg?scl=1
			 domain_nosub === "louisvuitton.com" ||
			 // https://images.ulta.com/is/image/Ulta/revlon-photoready-candid-natural-finish-anti-pollution-foundation
			 //   https://images.ulta.com/is/image/Ulta/revlon-photoready-candid-natural-finish-anti-pollution-foundation?scl=1&fmt=png-alpha
			 domain === "images.ulta.com" ||
			 // https://image.uniqlo.com/is/image/UNIQLO/featured-stories-20181224-ut.jpg?$jpgMQ$
			 //   https://image.uniqlo.com/is/image/UNIQLO/featured-stories-20181224-ut.jpg?scl=1 -- 306x230 (same size?)
			 domain === "image.uniqlo.com" ||
			 // https://www.staples-3p.com/s7/is/image/Staples/sp36619013_sc7?wid=512&hei=512
			 //   https://www.staples-3p.com/s7/is/image/Staples/sp36619013_sc7?scl=1&fmt=png-alpha
			 domain_nowww === "staples-3p.com" ||
			 // https://s.shld.net/is/image/Sears/20190528_k_HP_Hero_MayWk4_01?$cq_width_300$&qlt=90,0&resMode=sharp&op_usm=0.9,0.5,0,0,&jpegSize=100&bgc=ffffff
			 //   https://s.shld.net/is/image/Sears/20190528_k_HP_Hero_MayWk4_01?scl=1&fmt=png-alpha
			 // https://s.shld.net/is/image/Sears/dishwashercycle_hero-qm-wid-eq-1500-amp-qlt-eq-100-amp-op_usm-eq-0.9,0.5,0,0
			 //   https://s.shld.net/is/image/Sears/dishwashercycle_hero?scl=1&fmt=png-alpha
			 domain === "s.shld.net" ||
			 // https://assets.ray-ban.com/is/image/RayBan/tile_ddm_eye_227x130_oval?$jpeg-full$
			 //   https://assets.ray-ban.com/is/image/RayBan/tile_ddm_eye_227x130_oval?scl=1&fmt=png-alpha
			 domain === "assets.ray-ban.com" ||
			 // thanks to user-00 on github: https://github.com/qsniyg/maxurl/issues/244
			 // https://images.menswearhouse.com/is/image/TMW/MW40_67AA_01_JOE_JOSEPH_ABBOUD_NAVY_SET?$40MainPDP$
			 //   https://images.menswearhouse.com/is/image/TMW/MW40_67AA_01_JOE_JOSEPH_ABBOUD_NAVY_SET?scl=1&fmt=png-alpha
			 domain === "images.menswearhouse.com" ||
			 // https://image.but.fr/is/image/but/3700989515089_Q?$produit_niv3_l$
			 //   https://image.but.fr/is/image/but/3700989515089_Q?scl=1&fmt=png-alpha -- illegal image size
			 //domain === "image.but.fr" ||
			 // https://images.shaneco.com/is/image/ShaneCo/diamonds101-hero-Sept2017-lg?wid=1300&hei=1200
			 //   https://images.shaneco.com/is/image/ShaneCo/diamonds101-hero-Sept2017-lg?scl=1&fmt=png-alpha
			 domain === "images.shaneco.com" ||
			 // thanks to AdClear247 on github: https://github.com/qsniyg/maxurl/issues/704
			 // https://media.kohlsimg.com/is/image/kohls/1514899_Pink_White?wid=600&hei=600&op_sharpen=1
			 //   https://media.kohlsimg.com/is/image/kohls/1514899_Pink_White?scl=1&fmt=png-alpha
			 // https://media.kohlsimg.com/is/image/kohls/1514899_ALT11?wid=96&hei=96&op_sharpen=1
			 //   https://media.kohlsimg.com/is/image/kohls/1514899_ALT11?scl=1&fmt=png-alpha
			 domain === "media.kohlsimg.com" ||
			 // https://photos.mandarinoriental.com/is/image/MandarinOriental/tokyo-fine-dining-signature-food-12?wid=1290&hei=860&fmt=jpeg&qlt=75,0&op_sharpen=0&resMode=sharp2&op_usm=0.8,0.8,4,0&iccEmbed=0&printRes=72&fit=crop
			 //   https://photos.mandarinoriental.com/is/image/MandarinOriental/tokyo-fine-dining-signature-food-12?scl=1&fmt=png-alpha
			 domain === "photos.mandarinoriental.com" ||
			 // https://keysight-h.assetsadobe.com/is/image/content/dam/keysight/en/doc/gate/application-notes/5980-0288.pdf?$card-image$&wid=1008&hei=567
			 //   https://keysight-h.assetsadobe.com/is/image/content/dam/keysight/en/doc/gate/application-notes/5980-0288.pdf?scl=1&fmt=png-alpha
			 domain_nosub === "assetsadobe.com" ||
			 // thanks to MinuteAd8502: https://github.com/qsniyg/maxurl/issues/790
			 // https://images.asics.com/is/image/asics/1012A898_400_SR_RT_GLB?$thumb$ -- 120x120
			 //   https://images.asics.com/is/image/asics/1012A898_400_SB_BT_GLB?$sfcc-product$ -- 683x512
			 //   https://images.asics.com/is/image/asics/1012A898_400_SB_BT_GLB?$zoom$ -- 1024x768
			 //   https://images.asics.com/is/image/asics/1012A898_400_SB_BT_GLB?scl=1&fmt=png-alpha -- 1500x1717
			 domain === "images.asics.com" ||
			 // https://s7g10.scene7.com/is/image/UrbanOutfittersEU/0119477794907_010_b?$xlarge$&hei=900&qlt=80&fit=constrain
			 //   https://s7g10.scene7.com/is/image/UrbanOutfittersEU/0119477794907_010_b?scl=1
			 // https://iittala.scene7.com/is/image/iittala/?&src=is{iittala/iittala%2Dkastehelmi%2Dplate%2D170mm%2Dsea%5Fblue?size=3800,3800&wid=2000&hei=2000&scl=2.6}&extend=100,100,100,100
			 //   https://iittala.scene7.com/is/image/iittala/iittala-kastehelmi-plate-170mm-sea_blue?scl=1&fmt=png-alpha
			 // https://s7d4.scene7.com/is/image/Belk?layer=0&src=9999999_1510MAID_A_000_T10L00&layer=comp&$P_PROD$
			 //   https://s7d4.scene7.com/is/image/Belk?src=9999999_1510MAID_A_000_T10L00&scl=1&fmt=png-alpha
			 // https://bonprix.scene7.com/is/image/OttoUK/800h/dippy-hem-blouse~979903FRSP.jpg
			 //   https://bonprix.scene7.com/is/image/OttoUK/800h/dippy-hem-blouse~979903FRSP.jpg?scl=1 -- crops to 1584x800
			 //   https://bonprix.scene7.com/is/image/OttoUK/600w/dippy-hem-blouse~979903FRSP.jpg?scl=1 -- crops to 600x2200
			 // thanks to MinuteAd8502 on github: https://github.com/qsniyg/maxurl/issues/805
			 // https://s7ondemand1.scene7.com/is/image/roadrunnersports/34348
			 //   https://s7ondemand1.scene7.com/is/image/roadrunnersports/34348?scl=1&fmt=png-alpha
			 // thanks to MinuteAd8502 on github: https://github.com/qsniyg/maxurl/issues/817
			 // https://underarmour.scene7.com/is/image/Underarmour/V5ProdWithBadge?rp=standard-0pad%7CgridTileDesktop&scl=1&fmt=jpg&qlt=85&resMode=sharp2&cache=on,off&bgc=F7F7F7&rect=0,0,281,345&$p_pos=141,172&$p_size=281,345&extendN=0,0,0,0&$p_src=is%7BUnderarmour/V5-1361925-001_BC_Main%7D
			 //   https://underarmour.scene7.com/is/image/Underarmour/V5-1361925-001_BC_Main?scl=1&fmt=png-alpha
			 // doesn't work for all:
			 // https://s7d9.scene7.com/is/image/zumiez/pdp_hero/adidas-Boys-Trefoil-Black-Hoodie-_289406.jpg
			 //   https://s7d9.scene7.com/is/image/zumiez/pdp_hero/adidas-Boys-Trefoil-Black-Hoodie-_289406.jpg?scl=1 -- image not found
			 // thanks to kophcp on github for reminding me about this: https://github.com/qsniyg/maxurl/issues/488
			 domain_nosub === "scene7.com"
			 ) && string_indexof(src, "/is/image/") >= 0) ||
			// thanks to MinuteAd8502: https://github.com/qsniyg/maxurl/issues/799
			// https://images.asos-media.com/products/nike-running-miler-long-sleeve-top-in-grey/14971488-2?$XXL$&wid=513&fit=constrain
			//   https://images.asos-media.com/products/nike-running-miler-long-sleeve-top-in-grey/14971488-2?scl=1&fmt=png-alpha --
			// https://images.asos-media.com/products/asos/9503862-1-black?wid=1959&hei=2500&size=1959,2500&rect=653,625,653,625&qlt=90
			domain === "images.asos-media.com" ||
			// thanks to MinuteAd8502: https://github.com/qsniyg/maxurl/issues/837
			// https://images.nike.com/is/image/DotCom/NESSA421_693_A_PREM
			//   https://images.nike.com/is/image/DotCom/NESSA421_693_A_PREM?scl=1&fmt=png-alpha
			domain === "images.nike.com" ||
			// https://c.shld.net/rpx/i/s/i/spin/image/spin_prod_944500112?hei=185&wid=185&op_sharpen=1&qlt=85
			//   https://c.shld.net/rpx/i/s/i/spin/image/spin_prod_944500112?scl=1&fmt=png-alpha
			// http://c.shld.net/rpx/i/s/pi/mp/10143589/prod_17215362615?src=http%3A%2F%2Fprodimage.images-bn.com%2Fpimages%2F9780739052204.jpg&d=31514ed0ddc4e4d8bba1651321ad7287b49da72f
			//   http://prodimage.images-bn.com/pimages/9780739052204.jpg
			domain === "c.shld.net" ||
			// thanks to karpuzikov on github: https://github.com/qsniyg/maxurl/issues/1071
			// https://image.panasonic.com/is/image/Panasonic/SD-R2530-KTS-CIS_accessory_2-1?$Thumbnail96$&wid=96&hei=54&fmt=png-alpha
			//   https://image.panasonic.com/is/image/Panasonic/SD-R2530-KTS-CIS_accessory_2-1?wid=2000&hei=2000&fmt=png-alpha
			domain === "image.panasonic.com" ||
			// thanks to karpuzikov on github for reporting: https://github.com/qsniyg/maxurl/issues/1122
			// https://store.storeimages.cdn-apple.com/4982/as-images.apple.com/is/HNGY2?wid=38&hei=38&fmt=jpeg&qlt=95&.v=1620945188000
			//   https://store.storeimages.cdn-apple.com/4982/as-images.apple.com/is/HNGY2?scl=1&fmt=png-alpha
			domain === "store.storeimages.cdn-apple.com" ||
			// thanks to anonymous for reporting:
			// https://www.sony.lu/image/a71e51053c03634f8ff5d4a78fb4b1fb?fmt=png-alpha&wid=900&hei=800
			//   https://www.sony.lu/image/a71e51053c03634f8ff5d4a78fb4b1fb?scl=1&fmt=png-alpha
			(domain_nowww === "sony.lu" && string_indexof(src, "/image/") >= 0) ||
			/^[a-z]+:\/\/[^/]+\/+is\/+image\/+[^/]+\/+[^/]+(?:[?#].*)?$/.test(src)) {
			// https://dyson-h.assetsadobe2.com/is/image//content/dam/dyson/products/hair-care/dyson-supersonic/customisation/personal-care-dyson-supersonic-customisation-homepage.jpg?scl=1
			// https://dyson-h.assetsadobe2.com/is/image//content/dam/dyson/icons/owner-footer/register-my-machine.png?scl=1&fmt=png-alpha
			// https://airbus-h.assetsadobe2.com/is/image/content/dam/products-and-solutions/commercial-aircraft/beluga/belugaxl/BelugaXL.jpg?wid=1920&fit=fit,1&qlt=85,0
			// https://dyson-h.assetsadobe2.com/is/image//content/dam/dyson/services-and-support/troubleshoot/hassle-free-repalcement.png
			// https://airbus-h.assetsadobe2.com/is/image/content/dam/products-and-solutions/commercial-aircraft/beluga/belugaxl/BelugaXL.jpg?wid=1920&fit=fit,1&qlt=85,0
			//   https://airbus-h.assetsadobe2.com/is/image/content/dam/products-and-solutions/commercial-aircraft/beluga/belugaxl/BelugaXL.jpg -- much smaller (300x203)
			//   https://airbus-h.assetsadobe2.com/is/image/content/dam/products-and-solutions/commercial-aircraft/beluga/belugaxl/BelugaXL.jpg?scl=1
			obj = {url: src};
			if (domain_nosub === "scene7.com") {
				obj.bad_if = [
					{
						headers: {
							"content-type": "image/jpeg",
							"content-length": "27898"
						}
					},
					// bonprix.scene7.com
					{
						headers: {
							"content-type": "image/jpeg",
							"content-length": "5996"
						}
					}
				];
			}

			match = src.match(/\/i\/s\/.*\?(?:.*&)?(?:\$p_)?src=(https?%3A.*?)(?:&.*)?$/);
			if (match) {
				obj.url = decodeURIComponent(match[1]);
				return obj;
			}

			match = src.match(/\/is\/image\/+.*\?(?:.*?&)?(?:\$p_)?src=is(?:{|%7B)(.*?)(?:}|%7D)/);
			if (match) {
				obj.url = src.replace(/\/is\/image\/.*/, "/is/image/" + decodeURIComponent(match[1]));
				return obj;
			}

			// thanks to anyunami2000: https://github.com/qsniyg/maxurl/issues/926
			// https://partycity6.scene7.com/is/image/PartyCity/_pdp_sq_?$_500x500_$&$product=PartyCity/177905_01
			//   https://partycity6.scene7.com/is/image/PartyCity/177905_01?scl=1&fmt=png-alpha
			match = src.match(/\/is\/+image\/+.*?[?&]\$product=([^&]+).*?$/);
			if (match) {
				obj.url = src.replace(/\/is\/+image\/.*/, "/is/image/" + decodeURIComponent(match[1]));
				return obj;
			}

			if (domain === "bonprix.scene7.com") {
				src = src.replace(/\/[0-9]+[wh]\/+([^/]+(?:[?#].*)?)$/, "/original/$1"); // can be anything
			}

			if (domain === "image.panasonic.com") {
				src = src.replace(/\$Thumbnail\d+\$/, "");
				return add_queries(src, {
					wid: "2000",
					hei: "2000"
				});
			}

			// https://s.shld.net/is/image/Sears/dishwashercycle_hero-qm-wid-eq-1500-amp-qlt-eq-100-amp-op_usm-eq-0.9,0.5,0,0
			//   https://s.shld.net/is/image/Sears/dishwashercycle_hero?wid=1500&qlt=100&op_usm=0.9,0.5,0,0
			if (string_indexof(src, "?") < 0) {
				var basename = url_basename(src);
				var querystr = basename.replace(/.*?-qm-/, "?");
				if (querystr !== basename) {
					querystr = querystr
						.replace(/-eq-/g, "=")
						.replace(/-amp-/g, "&");

					newsrc = src.replace(/^(.*\/)[^/]+$/, "$1") + basename.replace(/(.*)?-qm-.*$/, "$1") + querystr;
					if (newsrc !== src) return newsrc;
				}
			}

			if (/:[0-9]+-[0-9]+\?.*$/.test(src)) {
				// thanks to anonymous for reporting:
				// https://intelcorp.scene7.com/is/image/intelcorp/diagram-mpi-library-l-v2-rwd:1072-603?scl=1&fmt=png-alpha
				//   https://intelcorp.scene7.com/is/image/intelcorp/diagram-mpi-library-l-v2-rwd?scl=1&fmt=png-alpha
				return src.replace(/:[0-9]+-[0-9]+(\?.*)?$/, "$1");
			}

			var srcadd = "";

			if (src.match(/\.(?:jpe?g|JPE?G)(?:\?.*)?$/))
				srcadd = "scl=1";
			else
				srcadd = "scl=1&fmt=png-alpha";

			newsrc = src.replace(/(\/is\/+image\/+.*)\?(?:.*?&)?((?:\$p_)?src)=([^&]*).*?$/, "$1?$2=$3&" + srcadd);
			if (newsrc !== src) {
				obj.url = newsrc;
				return obj;
			}

			if (!(/[?&]src=/.test(src))) {
				obj.url = src.replace(/(?:[?#].*)?$/, "") + "?" + srcadd;
				return obj;
			}
		}

		if (domain === "media.bechtle.com") {
			// thanks to karpuzikov on github: https://github.com/qsniyg/maxurl/issues/1143
			// https://media.bechtle.com/is/180712/1c4b3d4ee288fc9434f5175bf56070570/c3/picture/d123c83ae884430b8c2a291fdc48a79c?version=0
			//   https://media.bechtle.com/is/180712/1c4b3d4ee288fc9434f5175bf56070570/c3/original/d123c83ae884430b8c2a291fdc48a79c?version=0 -- 4292x6310
			return src.replace(/(\/is\/+[0-9]+\/+[0-9a-f]{20,}\/+[0-9a-f]+\/+)[a-z]+\/+/, "$1original/");
		}

		if (domain === "sm.ign.com") {
			// http://sm.ign.com/t/ign_in/feature/a/afl-clubs-/afl-clubs-recognise-that-esports-are-sports-why-hasnt-everyo_azz8.300.jpg
			//   http://sm.ign.com/t/ign_in/feature/a/afl-clubs-/afl-clubs-recognise-that-esports-are-sports-why-hasnt-everyo_azz8.999999999999999.jpg
			return src.replace(/\.[0-9]+\.([^/.]*)$/, ".999999999999999.$1");
		}

		// nopCommerce
		if ((domain === "shop.unitedcycle.com" ||
			 // https://unicorncards.co.uk/images/thumbs/0027281_mp19-en043-called-by-the-grave-prismatic-secret-rare-1st-edition-mint-yugioh-card_415.jpeg
			 //   https://unicorncards.co.uk/images/thumbs/0027281_mp19-en043-called-by-the-grave-prismatic-secret-rare-1st-edition-mint-yugioh-card.jpeg
			 domain_nowww === "unicorncards.co.uk" ||
			 // https://4my3boyz.com/content/images/thumbs/0015622_beautiful-birds-housing-boom-songbirds-song-bird-cream-cotton-fabric_500.jpeg
			 //   https://4my3boyz.com/content/images/thumbs/0015622_beautiful-birds-housing-boom-songbirds-song-bird-cream-cotton-fabric.jpeg
			 domain_nowww === "4my3boyz.com") &&
			string_indexof(src, "/images/thumbs/") >= 0) {
			// https://shop.unitedcycle.com/content/images/thumbs/0277134_mens-nhl-edmonton-oilers-connor-mcdavid-authentic-home-jersey_276.jpeg
			//   https://shop.unitedcycle.com/content/images/thumbs/0277134_mens-nhl-edmonton-oilers-connor-mcdavid-authentic-home-jersey.jpeg
			return src.replace(/_[0-9]+(\.[^/.]*)$/, "$1");
		}

		if (domain_nowww === "imgr.es") {
			// https://imgr.es/4AVP/thumb
			//   https://imgr.es/4AVP
			return src.replace(/\/thumb(?:[?#].*)?$/, "");
		}

		if (domain_nosub === "frgimages.com" ||
			domain === "images.footballfanatics.com") {
			// http://nhl.frgimages.com/FFImage/thumb.aspx?i=/productImages/_2799000/ff_2799544_full.jpg&w=340
			//   http://nhl.frgimages.com/productImages/_2799000/ff_2799544_full.jpg
			// http://images.footballfanatics.com/FFImage/thumb.aspx?i=/productImages/_821000/ff_821054_xl.jpg&amp;w=200
			//   http://images.footballfanatics.com/productImages/_821000/ff_821054_xl.jpg
			//   http://images.footballfanatics.com/productImages/_821000/ff_821054_full.jpg
			// http://images.footballfanatics.com/FFImage/thumb.aspx?i=%2fproductImages%2f_1759000%2fff_1759679_xl.jpg&w=400
			//   http://images.footballfanatics.com/productImages/_1759000/ff_1759679_full.jpg
			newsrc = decodeURIComponent(src.replace(/\/FFImage\/thumb.aspx.*?[?&]i=([^&]*).*/, "$1"));
			if (newsrc !== src)
				return newsrc;

			return src
				.replace(/_[a-z]+(\.[^/.?&]*)$/, "_full$1");
		}

		if (domain === "myanimelist.cdn-dena.com" ||
			// https://cdn.myanimelist.net/r/96x136/images/anime/3/44724.jpg?s=f18de0aa37ccbe2b9ac76fb2158a1bfe
			//   https://cdn.myanimelist.net/images/anime/3/44724.jpg?s=f18de0aa37ccbe2b9ac76fb2158a1bfe
			domain === "cdn.myanimelist.net" ||
			// https://dizigol.net/r/100x0/upload/sanatciafis/alexz-johnson-57137-b.jpg
			//   https://dizigol.net/upload/sanatciafis/alexz-johnson-57137-b.jpg
			domain_nowww === "dizigol.net") {
			// https://myanimelist.cdn-dena.com/r/23x32/images/characters/5/303016.webp?s=3e198afde53adfb2b47dc59782dc82f7
			//   https://myanimelist.cdn-dena.com/images/characters/5/303016.webp?s=3e198afde53adfb2b47dc59782dc82f7
			return src.replace(/(:\/\/[^/]*\/)r\/+[0-9]+x[0-9]+\/+/, "$1");
		}

		if (domain === "picture-cdn.wheretoget.it") {
			// http://picture-cdn.wheretoget.it/qey8wu-i-c60x60.jpg
			//   http://picture-cdn.wheretoget.it/qey8wu-i.jpg
			return src.replace(/(\/[a-z0-9]*-[a-z])[^/.]*(\.[^/.]*)$/, "$1$2");
		}

		if (domain === "sl.sbs.com.au") {
			// https://sl.sbs.com.au/public/image/file/4f4cf0a2-ec64-46e8-9958-faa712440c28/crop/16x9_medium
			//   https://sl.sbs.com.au/public/image/file/4f4cf0a2-ec64-46e8-9958-faa712440c28
			// https://sl.sbs.com.au/public/image/file/0c3ca54a-0cfa-400e-9cb0-d09631c81769/crop/1x1_small
			//   https://sl.sbs.com.au/public/image/file/0c3ca54a-0cfa-400e-9cb0-d09631c81769
			return src.replace(/(\/public\/image\/file\/[-a-f0-9]*)\/.*/, "$1");
		}

		if ((domain_nosub === "prezly.com" && string_indexof(domain, ".assets.prezly.com") >= 0) ||
			// https://i.shgcdn.com/1fab7627-3dea-484e-8130-6915168befc0/-/format/auto/-/preview/3000x3000/-/quality/lighter/
			//   https://i.shgcdn.com/1fab7627-3dea-484e-8130-6915168befc0/-
			domain === "i.shgcdn.com" ||
			// https://ucarecdn.com/1687fe52-388c-4856-974c-1de3effb4d9c~3/nth/0/-/format/auto/-/quality/lighter/
			//   https://ucarecdn.com/1687fe52-388c-4856-974c-1de3effb4d9c~3/nth/0/-
			// https://ucarecdn.com/ab72986c-0e99-4e1b-bb8e-562afa21df3c/-/stretch/off/-/resize/2000x/-/quality/normal/
			//   https://www.ucarecdn.com/ab72986c-0e99-4e1b-bb8e-562afa21df3c/
			domain_nowww === "ucarecdn.com" ||
			// https://cdn.vyper.io/21eb103f-b54d-454c-bdbb-a1d119a0a269/-/quality/lighter/-/format/auto/null
			//   https://cdn.vyper.io/21eb103f-b54d-454c-bdbb-a1d119a0a269/-
			domain === "cdn.vyper.io" ||
			// https://assets.myzeki.com/3f7d45fc-9007-4c1f-8a74-281cd4724d31/-/preview/1200x630/-/stretch/fill/-/resize/1200x630/-/format/webp/-/quality/lighter/image.webp
			//   https://assets.myzeki.com/3f7d45fc-9007-4c1f-8a74-281cd4724d31/
			domain === "assets.myzeki.com" ||
			// https://thumb.tildacdn.com/tild6133-3662-4734-a163-303763373638/-/format/webp/stefan-stefancik-257.jpg
			//   https://static.tildacdn.com/tild6133-3662-4734-a163-303763373638/stefan-stefancik-257.jpg -- thumb gets automatically redirected to static
			domain === "thumb.tildacdn.com" ||
			// https://cdn.slant.co/999bce7d-6fb0-4b6b-9820-24e58633edf8/-/format/jpeg/-/progressive/yes/-/preview/480x480/
			//   https://cdn.slant.co/999bce7d-6fb0-4b6b-9820-24e58633edf8/-
			domain === "cdn.slant.co") {
			// https://cdn.uc.assets.prezly.com/d24b5696-a65c-48d6-9cfd-1b0b98ca1f3c/-/preview/1108x1108/
			//   https://cdn.uc.assets.prezly.com/d24b5696-a65c-48d6-9cfd-1b0b98ca1f3c/-
			//   https://cdn.uc.assets.prezly.com/d24b5696-a65c-48d6-9cfd-1b0b98ca1f3c/
			// https://cdn.uc.assets.prezly.com/6201f512-e09d-440f-95e3-d1aa316f70e6/-/resize/1108x/-/quality/best/
			//   https://cdn.uc.assets.prezly.com/6201f512-e09d-440f-95e3-d1aa316f70e6/-
			// https://cdn.uc.assets.prezly.com/c204db5f-a17a-4c64-96b2-112b0876cb84/-/preview/1108x1108/
			//   https://cdn.uc.assets.prezly.com/c204db5f-a17a-4c64-96b2-112b0876cb84/-
			return src.replace(/(:\/\/[^/]*\/+(?:[a-z]+)?[-a-f0-9]{30,}(?:~[0-9a-f]+)?\/+(?:nth\/+[0-9]+\/+)?).*?(?:\/([^/.]+\.[^/.]+))?(?:[?#].*)?$/, "$1$2");
			//return src.replace(/(:\/\/[^/]*\/[-0-9a-f]+\/).*/, "$1");
		}

		if (domain_nowww === "slant.co") {
			// https://www.slant.co/images/play.png
			if (/:\/\/[^/]+\/+images\/+play\.png(?:[?#].*)?$/.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}
		}

		if (domain === "leonardo.osnova.io" ||
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/412
			// https://uploadcare.com/
			// https://images.universe.com/87135321-9b85-480d-a4f1-8d526b879789/-/scale_crop/972x389/-/quality/lightest/-/progressive/yes/-/format/webp/-/inline/yes/
			//   https://images.universe.com/87135321-9b85-480d-a4f1-8d526b879789/
			domain === "images.universe.com") {
			// https://leonardo.osnova.io/f90ba5cd-3995-4708-f20f-312472809618/-/scale_crop/590x881/center/
			//   https://leonardo.osnova.io/f90ba5cd-3995-4708-f20f-312472809618/
			return src.replace(/(:\/\/[^/]*\/[-a-f0-9]*\/)-\/.*/, "$1");
		}

		if (domain === "cdn.iview.abc.net.au") {
			// https://cdn.iview.abc.net.au/thumbs/460/nn/NN1603D568368a49e2fa8.38197525_940.jpg
			//   https://cdn.iview.abc.net.au/thumbs/i/nn/NN1603D568368a49e2fa8.38197525_940.jpg
			return src.replace(/\/thumbs\/[0-9]+\//, "/thumbs/i/");
		}

		if (domain_nosub === "ipstatic.net") {
			// http://ipstatic.net/img?url=http%3A%2F%2Fstatic.independent.co.uk%2Fs3fs-public%2Fthumbnails%2Fimage%2F2015%2F12%2F22%2F23%2FSesame-Credit.jpg
			//   http://static.independent.co.uk/s3fs-public/thumbnails/image/2015/12/22/23/Sesame-Credit.jpg
			// http://ipstatic.net/img?url=http%3A%2F%2Fi.imgur.com%2FfauqaqC.png
			newsrc = decodeURIComponent(src.replace(/.*\/img.*?[?&]url=([^&]*).*?$/, "$1"));
			if (newsrc !== src)
				return newsrc;

			// https://th1-us.ipstatic.net/thumbs/100x100/57/26/700x699_830169982986518529_830172363316953088.jpg
			//   https://us.ipstatic.net/photos/57/26/700x699_830169982986518529_830172363316953088.jpg
			return src.replace(/\/thumbs\/[0-9]+x[0-9]+\//, "/photos/");
		}

		if (domain === "image.fnnews.com") {
			// http://image.fnnews.com/resource/paper/image/2018/02/22/f201802222005_s.jpg - 150x252
			//   http://image.fnnews.com/resource/paper/image/2018/02/22/f201802222005_m.jpg - 1024x1826
			//   http://image.fnnews.com/resource/paper/image/2018/02/22/f201802222005_l.jpg - 2048x3452
			//   http://image.fnnews.com/resource/paper/image/2018/02/22/f201802222005.jpg - 2294x3867
			// http://image.fnnews.com/resource/media/image/2015/01/07/201501071226571964.jpg
			// http://image.fnnews.com/resource/media/image/2015/02/09/201502091020442956_s.jpg
			//
			// http://image.fnnews.com/resource/crop_image/2018/03/28/thumb/201803280955183839_1522283684662.jpg
			//   http://image.fnnews.com/resource/media/image/2018/03/28/201803281002583124.jpg
			return src
				.replace(/(\/[a-z]?[0-9]+)_[a-z](\.[^/.]*)/, "$1$2");
		}

		if (domain_nosub === "kym-cdn.com") {
			// http://i0.kym-cdn.com/featured_items/icons/wide/000/007/926/46b.jpg
			//   http://i0.kym-cdn.com/featured_items/icons/original/000/007/926/46b.jpg
			// http://i0.kym-cdn.com/photos/images/newsfeed/001/318/958/c7d.png
			//   http://i0.kym-cdn.com/photos/images/original/001/318/958/c7d.png
			// http://i0.kym-cdn.com/entries/icons/mobile/000/025/888/the-problem-with-apu.jpg
			//   http://i0.kym-cdn.com/entries/icons/original/000/025/888/the-problem-with-apu.png
			// https://i.kym-cdn.com/entries/icons/mobile/000/018/847/e4a829e2-502a-42d4-898f-f3169442026b-bestSizeAvailable.jpg
			//   https://i.kym-cdn.com/entries/icons/original/000/018/847/e4a829e2-502a-42d4-898f-f3169442026b-bestSizeAvailable.png
			return add_extensions({
				url: src.replace(/(:\/\/[^/]*\/[^/]*\/(?:images|icons)\/)[^/]*\//, "$1original/"),
				is_original: true
			});
		}

		if (domain === "cmeimg-a.akamaihd.net" ||
			domain === "leafimg-a.akamaihd.net") {
			// https://cmeimg-a.akamaihd.net/640/photos.demandstudios.com/getty/article/144/8/178883146.jpg
			//   http://photos.demandstudios.com/getty/article/144/8/178883146.jpg
			// http://cmeimg-a.akamaihd.net/640/photos.demandstudios.com/getty/article/56/93/78034732.jpg
			//   http://photos.demandstudios.com/getty/article/56/93/78034732.jpg
			// https://cmeimg-a.akamaihd.net/640/ppds/1ad05338-0679-4fa1-b259-631df59b4a89.png -- default doesn't work
			// https://cmeimg-a.akamaihd.net/400x400/ppds/53e36ed7-8bb2-4448-b7f5-96acdc58ee1b.jpg
			//   https://cmeimg-a.akamaihd.net/default/ppds/53e36ed7-8bb2-4448-b7f5-96acdc58ee1b.jpg
			// https://cmeimg-a.akamaihd.net/x650/clsd/4/3/11bf5d91994d4b90a21192a6c464390c
			//   https://cmeimg-a.akamaihd.net/default/clsd/4/3/11bf5d91994d4b90a21192a6c464390c
			// https://cmeimg-a.akamaihd.net/400x269/photos.demandstudios.com/getty/article/181/85/492145443.jpg
			//   http://photos.demandstudios.com/getty/article/181/85/492145443.jpg
			// https://cmeimg-a.akamaihd.net/default/clsd/4/3/fb64bd3f01f541f3bbcd4fd0f3c821fc
			// https://cmeimg-a.akamaihd.net/default/ppds/d88f0042-735e-404f-8156-519ba9c85d8c.png
			// https://cmeimg-a.akamaihd.net/cute-article-rcp/photos.demandstudios.com/getty/article/110/112/87490270.jpg
			//   http://photos.demandstudios.com/getty/article/110/112/87490270.jpg
			// https://leafimg-a.akamaihd.net/640/ppds/00e86e6a-fcfc-4bea-b451-4b58187cf0cf.jpg
			//   https://leafimg-a.akamaihd.net/default/ppds/00e86e6a-fcfc-4bea-b451-4b58187cf0cf.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/(?:[0-9]+(?:x[0-9]+)?|x[0-9]+|cute-article-rcp)\/([^/.]*\.[^/]*\/.*)/, "http://$1");
			if (newsrc !== src)
				return newsrc;

			return src.replace(/^([a-z]+:\/\/[^/]*\/)(?:[0-9]+(?:x[0-9]+)?|x[0-9]+)\//, "$1default/");
		}

		if ((domain_nosub === "luxnet.ua" && domain.match(/imagecdn[0-9]*\.luxnet\.ua/)) ||
			// https://beztabu.net/uploads/640_DIR/media_news/2018/08/5b6960963029e998726219.jpg
			//   https://beztabu.net/uploads/media_news/2018/08/5b6960963029e998726219.jpg
			domain_nowww === "beztabu.net" ||
			// https://34.ua/uploads/640_DIR/media_news/2019/12/5dfa139f75468048407587.jpg
			//   https://34.ua/uploads/media_news/2019/12/5dfa139f75468048407587.jpg
			domain_nowww === "34.ua" ||
			// https://24tv.ua/resources/photos/news/620_DIR/201808/1010954_2349563.jpg?201808163040
			//   https://24tv.ua/resources/photos/news/201808/1010954_2349563.jpg?201808163040
			// https://auto.24tv.ua/resources/photos/news/640_DIR/201707/895.jpg?1501002807000
			//   https://auto.24tv.ua/resources/photos/news/201707/895.jpg?1501002807000
			domain_nosub === "24tv.ua" ||
			// https://football24.ua/resources/photos/news/640_DIR/201404/201015_1397570335954.jpg
			//   https://football24.ua/resources/photos/news/201404/201015_1397570335954.jpg
			domain_nowww === "football24.ua" ||
			// https://maximum.fm/uploads/424x239_DIR/media_news/2019/10/5da1ac7105c1a714987453.png
			//   https://maximum.fm/uploads/media_news/2019/10/5da1ac7105c1a714987453.png
			domain_nowww === "maximum.fm" ||
			// https://lux.fm/uploads/640_DIR/media_news/2018/01/6e57fff0aac4c5d6707b1e3a4df76f575e6d34f8.jpg
			//   https://lux.fm/uploads/media_news/2018/01/6e57fff0aac4c5d6707b1e3a4df76f575e6d34f8.jpg
			domain_nowww === "lux.fm") {
			// https://imagecdn1.luxnet.ua/football24/resources/photos/news/660x364_DIR/201803/443933.jpg?201803090027
			//   https://imagecdn1.luxnet.ua/football24/resources/photos/news/201803/443933.jpg?201803090027
			// https://imagecdn1.luxnet.ua/radio24/uploads/640_DIR/media_news/2017/07/16340fc3f938eec4245df2c441b49bf67fb0ad28.jpg
			//   https://imagecdn1.luxnet.ua/radio24/uploads/media_news/2017/07/16340fc3f938eec4245df2c441b49bf67fb0ad28.jpg
			return src.replace(/\/[0-9]+(?:x[0-9]+|[wh])?_DIR\//, "/");
		}

		if (domain_nowww === "userstyles.org") {
			// https://userstyles.org/style_screenshot_thumbnails/139772_after.jpeg
			//   https://userstyles.org/style_screenshots/139772_after.jpeg
			return src.replace("/style_screenshot_thumbnails/", "/style_screenshots/");
		}

		if ((domain_nosub === "narvii.com" ||
			// thanks to anonymous for reporting:
			// https://pm1.aminoapps.com/6445/7777674d1fdf9a3f8c6396a3728e2cf0f895f916_00.jpg
			//   https://pm1.aminoapps.com/6445/7777674d1fdf9a3f8c6396a3728e2cf0f895f916_hq.jpg
			domain_nosub === "aminoapps.com") && /^[a-z]+[0-9]*\./.test(domain)) {
			// https://pm1.narvii.com/6144/3af419d28deec398f490c7b1e0106d41165f84e0_128.jpg
			//   https://pm1.narvii.com/6144/3af419d28deec398f490c7b1e0106d41165f84e0_hq.jpg
			// https://pm1.narvii.com/6795/59948b2d6d93878fcfbcbf091d9edfa9399b93c4v2_00.jpg
			//   https://pm1.narvii.com/6795/59948b2d6d93878fcfbcbf091d9edfa9399b93c4v2_hq.jpg
			// https://pm1.narvii.com/6893/a215fc0f8d3bf92b03a4c9b6aef84042e3c2a190r1-738-1107v2_00.jpg
			//   https://pm1.narvii.com/6893/a215fc0f8d3bf92b03a4c9b6aef84042e3c2a190r1-738-1107v2_hq.jpg
			//   https://pm1.narvii.com/6893/a215fc0f8d3bf92b03a4c9b6aef84042e3c2a190r1-738-1107v2_uhq.jpg
			// https://pa1.narvii.com/6504/323454eb6137f5366c3a0df14c662d0ad81cc253_hq.gif
			// http://s3.narvii.com/image/wgy27on3h5wthe4ix2nhzqvbdok65mnd_00.jpg
			//   http://s3.narvii.com/image/wgy27on3h5wthe4ix2nhzqvbdok65mnd_hq.jpg
			// http://cm1.narvii.com/6735/9a9cd2eb50d2305358eebd487da63ab06a9549f6_00.jpg
			//   http://cm1.narvii.com/6735/9a9cd2eb50d2305358eebd487da63ab06a9549f6_hq.jpg -- doesn't work
			// doesn't work for all:
			// https://pm1.narvii.com/6516/5a012772e565ae7b0e6cd1f9ecae669afea0d0a2_00.jpg -- bg
			//   https://pm1.narvii.com/6516/5a012772e565ae7b0e6cd1f9ecae669afea0d0a2_hq.jpg -- doesn't work
			//return src.replace(/(\/[0-9a-frv]+(?:-[-0-9a-z]+)?_)[^/.]*(\.[^/.]*)/, "$1hq$2");
			regex = /(\/[0-9a-z]+(?:-[-0-9a-z]+)?_)[^/.]*(\.[^/.]*)/;
			return [
				src.replace(regex, "$1uhq$2"),
				src.replace(regex, "$1hq$2")
			];
		}

		if (domain === "img.oastatic.com") {
			// https://img.oastatic.com/img2/14456082/671x335r/view-from-zumstein.jpg
			//   https://img.oastatic.com/img/14456082/view-from-zumstein.jpg -- much smaller
			//   https://img.oastatic.com/imgmax/14456082/view-from-zumstein.jpg -- smaller (2048x1149)
			//   https://img.oastatic.com/img2/14456082/full/view-from-zumstein.jpg (3648x2048)
			//   https://img.oastatic.com/imgsrc/14456082/view-from-zumstein.jpg (3648x2048)
			// https://img.oastatic.com/img/671/335/fit/3159891/baeume-im-urwald-reinhardswald.jpg
			//   https://img.oastatic.com/img2/3159891/full/baeume-im-urwald-reinhardswald.jpg
			// http://img.oastatic.com/img/800/600/7214820/7214820.jpg
			//   http://img.oastatic.com/img2/7214820/full/7214820.jpg
			// http://img.oastatic.com/img/22917128/.jpg
			//   http://img.oastatic.com/img2/22917128/full/.jpg
			// http://img.oastatic.com/imgmax/8078056/das-alte-oesterreichische-zollhaus-am-krimmler-tauern.jpg (2000x1328)
			//   http://img.oastatic.com/img2/8078056/full/das-alte-oesterreichische-zollhaus-am-krimmler-tauern.jpg (2000x1328)
			// https://img.oastatic.com/img2/4273466/671x335r/der-historic-firetower-am-gipfel-des-mount-revelstoke..jpg
			//   https://img.oastatic.com/img2/4273466/full/der-historic-firetower-am-gipfel-des-mount-revelstoke..jpg (4320x2880)
			//   https://img.oastatic.com/imgsrc/4273466/der-historic-firetower-am-gipfel-des-mount-revelstoke..jpg (4320x2880)
			// http://img.oastatic.com/imgsrc/6128163/.jpg
			// https://img.oastatic.com/img/6351623/der-septimer-pass-wo-koenige-und-kaiser-die-alpen-ueberschritten.jpg
			//   https://img.oastatic.com/img2/6351623/full/der-septimer-pass-wo-koenige-und-kaiser-die-alpen-ueberschritten.jpg -- doesn't work
			//   https://img.oastatic.com/imgsrc/6351623/der-septimer-pass-wo-koenige-und-kaiser-die-alpen-ueberschritten.jpg -- doesn't work
			return src
				.replace(/\/img\/[0-9]+\/[0-9]+(?:\/fit)?\/([0-9]+)\/([^/]*)$/, "/img/$1/$2")
				.replace(/\/img\/([0-9]+)\/([^/]*)$/, "/img2/$1/full/$2")
				.replace(/\/imgmax\/([0-9]+)\/([^/]*)$/, "/img2/$1/full/$2")
				.replace(/(\/img2\/[0-9]+\/)[^/]*\/([^/]*)$/, "$1full/$2")
				.replace(/\/img2\/([0-9]+)\/full\/([^/]*)$/, "/imgsrc/$1/$2");
		}

		if (domain === "img.valais.ch" ||
			// https://wsrv.nl/?url=i.imgur.com%2FQL25lgF.jpg&h=300&w=300&t=square
			//   http://i.imgur.com/QL25lgF.jpg
			domain === "wsrv.nl" ||
			// https://images.weserv.nl/?url=i.imgur.com%2FQL25lgF.jpg&h=300&w=300&t=square
			//   http://i.imgur.com/QL25lgF.jpg
			domain === "images.weserv.nl" ||
			// http://i9.qiuzhi5.com/?url=http%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz%2FcWn3CdwgsB17ibkDEiaYRfMiagKvWDWRhfrzpfqq9p8LJgW342Fa372RTvJH7KPooF1BeWRBicB98Y45pppmgPxlBA%2F0%3Fwx_fmt%3Djpeg
			//   http://mmbiz.qpic.cn/mmbiz/cWn3CdwgsB17ibkDEiaYRfMiagKvWDWRhfrzpfqq9p8LJgW342Fa372RTvJH7KPooF1BeWRBicB98Y45pppmgPxlBA/0
			(domain_nosub === "qiuzhi5.com" && domain.match(/^i[0-9]*\./)) ||
			// https://proxy1.baaz.com/?url=https%3A%2F%2Fstorage.googleapis.com%2Fafs-prod%2Fmedia%2Fmedia%3A0d2e2804327849c3871722b4b10a357b%2F2865.jpeg&key=VEBVekHXnAXr37dCdepmrQ
			//   https://storage.googleapis.com/afs-prod/media/media:0d2e2804327849c3871722b4b10a357b/2865.jpeg
			(domain_nosub === "baaz.com" && domain.match(/^proxy[0-9]*\./)) ||
			// https://p0-ia.powr-media.com/?url=https://s3.us-east-1.amazonaws.com/powr-content/p0/videos/8485e323/f04a/4b28/bba5/d9a6baad4123/preview.jpg&w=600&mode=clip&pos=face&fmt=jpeg&q=60
			//   https://s3.us-east-1.amazonaws.com/powr-content/p0/videos/8485e323/f04a/4b28/bba5/d9a6baad4123/preview.jpg
			(domain_nosub === "powr-media.com" && domain.match(/^p[0-9]*-ia\./)) ||
			// http://nimg.ws.126.net/?url=http://dingyue.nosdn.127.net/jb2e85NSJvtbKrQdYP4op3hynHZMQ5TiYL0tR=t5jOnSn1533830845266compressflag.jpeg&thumbnail=260x150&quality=75&type=jpeg
			//   http://dingyue.nosdn.127.net/jb2e85NSJvtbKrQdYP4op3hynHZMQ5TiYL0tR=t5jOnSn1533830845266compressflag.jpeg
			domain === "nimg.ws.126.net") {
			// https://img.valais.ch/?url=img.oastatic.com%2Fimg%2F22917128%2F.jpg&w=940&h=580&t=square&q=75
			//   http://img.oastatic.com/img/22917128/.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/.*?[?&]url=([^&]*).*/, "$1");
			if (newsrc !== src)
				return add_http(decodeURIComponent(newsrc));
		}

		if (domain_nosub === "etsystatic.com" &&
			(domain.match(/img[0-9]*\.etsystatic\.com/) ||
			 domain === "i.etsystatic.com")) {
			// https://img.etsystatic.com/il/ee4147/687832738/il_340x270.687832738_akcv.jpg?version=3
			//   https://img.etsystatic.com/il/ee4147/687832738/il_570xN.687832738_akcv.jpg?version=3
			//   https://img.etsystatic.com/il/ee4147/687832738/il_fullxfull.687832738_akcv.jpg?version=3
			// https://img0.etsystatic.com/024/0/41472418/icm_fullxfull.34237406_jkqru58m5s84804o448s.jpg
			// https://img0.etsystatic.com/204/0/116068862/iusa_fullxfull.52864766_sco2.jpg
			// https://img1.etsystatic.com/188/0/14551365/isla_fullxfull.26904175_4smpme6j.jpg
			// https://img1.etsystatic.com/182/0/6993388/iss_fullxfull.12517843_i8l62k59.jpg
			// https://img0.etsystatic.com/196/0/7799858/igwp_fullxfull.1357445390_9pt1mltn.jpg
			// https://img0.etsystatic.com/189/0/274695830074/inv_fullxfull.1434228736_9e2pmqxr.jpg
			// https://img1.etsystatic.com/191/0/96548065/imfs_fullxfull.22421_y67munzc.jpg
			// https://img.etsystatic.com/il/ed3eab/845091829/il_570xN.845091829_qcz9.jpg?version=0
			//   https://img.etsystatic.com/il/ed3eab/845091829/il_fullxfull.845091829_qcz9.jpg?version=0
			// https://i.etsystatic.com/5313083/r/il/cbef0a/1250159710/il_570xN.1250159710_lwnm.jpg
			//   https://i.etsystatic.com/5313083/r/il/cbef0a/1250159710/il_fullxfull.1250159710_lwnm.jpg
			return src.replace(/(\/[a-z]+_)[0-9a-zA-Z]+x[0-9a-zA-Z]+\./, "$1fullxfull.");
		}

		if (domain_nosub === "twnmm.com") {
			// https://s1.twnmm.com/thumb?src=http://pelmorexpd-a.akamaihd.net/img/1942203455001/201804/1942203455001_5769239466001_5769162032001-vs.jpg?pubId=1942203455001&videoId=5769162032001&w=268&h=151&scale=1&crop=1
			//   http://pelmorexpd-a.akamaihd.net/img/1942203455001/201804/1942203455001_5769239466001_5769162032001-vs.jpg
			// https://s1.twnmm.com/thumb?src=//s1.twnmm.com/images/en_ca/12/GETTY%20-%20Snow%20and%20freezing%20rain-99295.jpg&w=145&h=80&scale=1&crop=1
			//   https://s1.twnmm.com/images/en_ca/12/GETTY%20-%20Snow%20and%20freezing%20rain-99295.jpg -- zero length image?
			return urljoin(src, src.replace(/^[a-z]+:\/\/[^/]*\/thumb.*?[?&]src=([^?&]*).*/, "$1"), true);
		}

		if (domain_nowww === "vuecinemas.nl") {
			// https://www.vuecinemas.nl/thumb?w=268&f=jpg&src=userfiles/image/movies/43008800_72645.jpg&alt=img/movie_placeholder.png
			//   https://www.vuecinemas.nl/userfiles/image/movies/43008800_72645.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+thumb\?(?:.*&)?src=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return urljoin(src, decodeURIComponent(newsrc), true);
		}

		if (domain === "www.findx.com" &&
			string_indexof(src, "/api/images/assets/") >= 0) {
			// https://www.findx.com/api/images/assets/500,sJb7dhfdfn7FbXJ9txRO2ZJNsRJNSBrHH5D-lTi8zPa8/https://image.shutterstock.com/display_pic_with_logo/3323144/524606014/stock-vector-la-vie-est-belle-postcard-life-is-beautiful-in-french-ink-illustration-modern-brush-calligraphy-524606014.jpg
			//   https://image.shutterstock.com/display_pic_with_logo/3323144/524606014/stock-vector-la-vie-est-belle-postcard-life-is-beautiful-in-french-ink-illustration-modern-brush-calligraphy-524606014.jpg
			return src.replace(/^[a-z]+:\/\/[^/]*\/api\/images\/assets\/[^/]*\//, "");
		}

		if (domain_nowww === "konsolinet.fi") {
			// https://www.konsolinet.fi/tuotekuvat/900x600/dims-quality-100-image_uri-http-3A-2F-2Fo-aolcdn-com-2Fhss-2Fstorage-2Fmidas-2Fc580709e7625f4ae45b7728ca8e4c68c-2F205370453-2Fmatterfall-cutscene-jpg-client-cbc79c14efcebee57402-signature-d89cb8da745b275966310f72eeb47f993dd3f470.jpg
			//   https://www.konsolinet.fi/tuotekuvat/dims-quality-100-image_uri-http-3A-2F-2Fo-aolcdn-com-2Fhss-2Fstorage-2Fmidas-2Fc580709e7625f4ae45b7728ca8e4c68c-2F205370453-2Fmatterfall-cutscene-jpg-client-cbc79c14efcebee57402-signature-d89cb8da745b275966310f72eeb47f993dd3f470.jpg
			return src.replace(/(:\/\/[^/]*\/[^/]*\/)[0-9]+x[0-9]+\//, "$1");
		}

		if ((domain_nosub === "vigbo.com" ||
			 // thanks to anonymous for reporting:
			 // https://static-cdn4-2.vigbo.tech/u109775/105500/blog/5883263/5390328/70992433/1000-20f13d28b0ee688196c88af1b711253f.jpg
			 //   https://static-cdn4-2.vigbo.tech/u109775/105500/blog/5883263/5390328/70992433/2000-20f13d28b0ee688196c88af1b711253f.jpg
			 domain_nosub === "vigbo.tech" ||
			 domain_nosub === "gophotoweb.com") &&
			domain.match(/^static[0-9]*(?:-cdn[^./]+)?\./)) {
			// http://static1.vigbo.com/u19820/22951/photos/3065711/1500-gophotoweb-5e9e0caa00352abf3c64dd6656552c8c.JPG
			//   http://static1.vigbo.com/u19820/22951/photos/3065711/2000-gophotoweb-5e9e0caa00352abf3c64dd6656552c8c.JPG
			// http://static1.gophotoweb.com/u4419/3425/photos/680943/500-alexey_trofimov-170b44c09e9fdabd1446bf2f125c2836.jpg
			// http://static1.gophotoweb.com/u5132/6272/photos/956409/1000-ilona_bitz-d03e78a0cbf053ad6f528185a36adb6e.jpg -- 2574x3861
			//   http://static1.gophotoweb.com/u5132/6272/photos/956409/2000-ilona_bitz-d03e78a0cbf053ad6f528185a36adb6e.jpg -- 2000x3000
			// http://static1.vigbo.com/u27635/36776/photos/2923250/27995e8e47fa8ce68f3bd8d453d39ef7.jpg
			// http://static1.vigbo.com/u25048/31970/blog/2516051/1515299/section/54291811154e5322f8bd5bb20dea92c9.JPG
			// http://static1.gophotoweb.com/u6358/7237/news/20481/olgailyina_011_small_size.jpg
			// http://static1.gophotoweb.com/u4846/4148/photos/3915482/500-angelina_popova-18dc621c7a32c1e2713004d4da7a448a.jpg -- 2832x3964
			//   http://static1.gophotoweb.com/u4846/4148/photos/3915482/2000-angelina_popova-18dc621c7a32c1e2713004d4da7a448a.jpg -- 2000x2799
			// http://static1.gophotoweb.com/u5582/8320/photos/1020204/1500-579c1845b3d10ee7c47879da356f7c96.jpg
			// http://static1.gophotoweb.com/u4101/2850/photos/68038/2000-MAXIM_PRUSAKOV-a9d75cf62aab8acd8b63bd08344f53e1.jpg
			// http://static1.gophotoweb.com/u3610/2156/photos/53740/1000-marinasapega%20%20-853ebe2afa24da5b6b817b6dbc97f492.jpg -- 3644x5466
			//   http://static1.gophotoweb.com/u3610/2156/photos/53740/2000-marinasapega%20%20-853ebe2afa24da5b6b817b6dbc97f492.jpg -- same size
			return src.replace(/\/[0-9]+-((?:[^/]*-)?[a-f0-9]{20,}\.[^/.]*)$/, "/2000-$1");
		}

		if (domain_nosub === "feelway.com" && domain.match(/img[0-9]*.feelway\.com/)) {
			// http://img016.feelway.com/3188/smallbd305pd3188424229ed1.jpg
			//   http://img016.feelway.com/3188/bd305pd3188424229ed1.jpg
			//   http://img016.feelway.com/goods_image/fpho_3188_bd305pd3188424229ed1/Amiri_%EB%B9%84%EB%B9%84%EC%95%84%EB%85%B8_17SSMDT01DST_%EB%94%94%EC%8A%A4%EB%8D%94%ED%8B%B0%EC%98%A4%EC%9D%BC_%EB%8D%B0%EB%8B%98%EC%9E%90%EC%BC%93_%EC%95%84%EB%AF%B8%EB%A6%AC_AM_1.jpg -- same size
			return src.replace(/(\/[0-9]+\/)small([^/]*)$/, "$1$2");
		}

		if (domain_nosub === "pichunter.com") {
			// https://www.pichunter.com/gallery/3550353/
			// https://y2.pichunter.com/3550353_9_t.jpg
			//   https://y2.pichunter.com/3550353_9.jpg
			//   https://y2.pichunter.com/3550353_9_o.jpg
			// http://cdn.pichunter.com/262/2/2622674/2622674_1_i.jpg
			//   http://cdn.pichunter.com/262/2/2622674/2622674_1_o.jpg
			newsrc = src.replace(/(:\/\/[^/]*\/+(?:[0-9]+\/+[0-9]+\/+[0-9]+\/+)?[0-9]+_[0-9]+)(?:_[a-z])?(\.[^/.]*)(?:[?#].*)?$/, "$1_o$2");
			if (newsrc !== src) {
				return {
					url: newsrc,
					headers: {
						Referer: "https://www.pichunter.com/"
					},
					referer_ok: {
						same_domain: true
					}
				};
			}
		}

		if (domain === "appdb.winehq.org") {
			// https://appdb.winehq.org/appimage.php?iId=27878&bThumbnail=true
			//   https://appdb.winehq.org/appimage.php?iId=27878
			return src.replace(/(\/appimage\.php.*?)([?&])bThumbnail=[^&]*/, "$1$2").replace(/&$/, "");
		}

		if (domain_nosub === "ikea.com" &&
			string_indexof(src, "/images/") >= 0) {
			// https://www.ikea.com/us/en/images/products/gurli-throw-green__0587646_PE672711_S4.JPG
			//   https://www.ikea.com/us/en/images/products/gurli-throw-green__0587646_PE672711_S5.JPG
			// https://www.ikea.com/ie/en/images/homepage/ikea-april-news-at-ikea__1364530466290-s2.jpg
			//   https://www.ikea.com/ie/en/images/homepage/ikea-april-news-at-ikea__1364530466290-s5.jpg
			// doesn't work:
			// https://www.ikea.com/gb/en/images/gb-img-fy15/ikea-sofa-guarantee__1364342102206-s4.jpg
			//   https://www.ikea.com/gb/en/images/gb-img-fy15/ikea-sofa-guarantee__1364342102206-s5.jpg -- doesn't work
			return src.replace(/([-_][sS])[0-9](\.[^/.]*)/, "$15$2");
		}

		if (domain === "img.onestore.co.kr") {
			// http://img.onestore.co.kr/thumbnails/img_sac/0_423_F20_95/data6/android/201411/19/IF1423406830820110607140552/0000677987/img/preview/0000677987_DP000103.jpg
			//   http://img.onestore.co.kr/thumbnails/img_sac/0_0_100/data6/android/201411/19/IF1423406830820110607140552/0000677987/img/preview/0000677987_DP000103.jpg
			// http://img.onestore.co.kr/thumbnails/img_sac/182_182_F10_95/data6/android/201411/19/IF1423406830820110607140552/0000677987/img/original/0000677987_DP000101.png
			//   http://img.onestore.co.kr/thumbnails/img_sac/0_0_100/data6/android/201411/19/IF1423406830820110607140552/0000677987/img/original/0000677987_DP000101.png
			return src.replace(/\/[0-9]+_[0-9]+_(?:F[0-9]+_)?[0-9]+\//, "/0_0_100/");
		}

		if (domain_nosub === "ismcdn.jp" ||
			// http://mikiki.tokyo.jp/mwimgs/7/3/200/img_73f63b815ccbc962f9202bd0701f6d6f123483.jpg
			//   http://mikiki.tokyo.jp/mwimgs/7/3/-/img_73f63b815ccbc962f9202bd0701f6d6f123483.jpg
			// http://mikiki.tokyo.jp/mwimgs/d/8/120h/img_d87f138a9b1a5a4f453e1fd9927141ff295888.jpg
			//   http://mikiki.tokyo.jp/mwimgs/d/8/-/img_d87f138a9b1a5a4f453e1fd9927141ff295888.jpg
			domain === "mikiki.tokyo.jp" ||
			// http://wedge.ismedia.jp/mwimgs/c/a/200/img_ca529af8c945704fb5432aceff2d60f2795379.jpg
			//   http://wedge.ismedia.jp/mwimgs/c/a/-/img_ca529af8c945704fb5432aceff2d60f2795379.jpg
			domain === "wedge.ismedia.jp" ||
			// http://ure.pia.co.jp/mwimgs/1/1/150/img_11e927362deb536d06a148164711f753324690.jpg
			//   http://ure.pia.co.jp/mwimgs/1/1/-/img_11e927362deb536d06a148164711f753324690.jpg
			domain === "ure.pia.co.jp" ||
			// thanks to nimbuz on discord:
			// https://wanibooks-newscrunch.com/mwimgs/f/4/375m/img_f4880f13fa21ca378d4857c18ad6c5691387725.jpg
			//   https://wanibooks-newscrunch.com/mwimgs/f/4/-/img_f4880f13fa21ca378d4857c18ad6c5691387725.jpg
			domain_nowww === "wanibooks-newscrunch.com" ||
			// http://www.afpbb.com/mwimgs/c/5/810x540/img_c5f0f05a10b37771fc7fc89f3e02ad86302635.jpg
			//   http://www.afpbb.com/mwimgs/c/5/-/img_c5f0f05a10b37771fc7fc89f3e02ad86302635.jpg
			domain_nowww === "afpbb.com") {
			// http://www.afpbb.com/articles/-/3171540
			//   http://afpbb.ismcdn.jp/mwimgs/3/4/320x280/img_34b67f980d17e0eeb91b850dedddbfcd64467.jpg - thumbnail
			//     http://afpbb.ismcdn.jp/mwimgs/3/4/full//img_34b67f980d17e0eeb91b850dedddbfcd64467.jpg
			//     http://afpbb.ismcdn.jp/mwimgs/3/4/-//img_34b67f980d17e0eeb91b850dedddbfcd64467.jpg -- same
			//     http://afpbb.ismcdn.jp/mwimgs/6/b/full//img_6b3d3ed08132ac948cb47d119a152aad174843.jpg -- much larger
			// http://dol.ismcdn.jp/mwimgs/3/8/670m/img_38ec77dc8d6e7438877c3cf39207e20a26382.jpg
			//   http://dol.ismcdn.jp/mwimgs/3/8/-/img_38ec77dc8d6e7438877c3cf39207e20a26382.jpg
			// https://tokushima.ismcdn.jp/mwimgs/f/b/600mw/img_fb362946e995ce69ae5a7ad8eaf59c99100255.jpg
			//   https://tokushima.ismcdn.jp/mwimgs/f/b/-/img_fb362946e995ce69ae5a7ad8eaf59c99100255.jpg
			// https://bunshun.ismcdn.jp/mwimgs/2/7/1500wm/img_27d11dc1e57a8d508fb5c39ecb00ffe13151300.jpg
			//   https://bunshun.ismcdn.jp/mwimgs/2/7/-/img_27d11dc1e57a8d508fb5c39ecb00ffe13151300.jpg
			return src.replace(/(\/mwimgs\/+(?:[0-9a-f]\/+){2})[0-9]+(?:[xmhw][whm]?[0-9]*)?(\/+img_[0-9a-f]{20,}\.[^/.]*)(?:[?#].*)?$/, "$1-$2");
			//return src.replace(/(\/mwimgs\/+(?:[0-9a-f]\/+){2})[0-9]+\/+(img_)/, "$1-/$2");
			//return src.replace(/(\/mwimgs\/[0-9a-f]+\/[0-9a-f]+\/)[0-9]+\//, "$1-/");
		}

		if (domain_nosub === "yomiuri.co.jp" && string_indexof(src, "/photo/") >= 0) {
			// http://sp.yomiuri.co.jp/photo/20161027/20161027-OYT8I50121-L.jpg (1003x2393)
			//   http://sp.yomiuri.co.jp/photo/20161027/20161027-OYT8I50121-1.jpg (209x500)
			// http://sp.yomiuri.co.jp/photo/20180418/20180418-OYT1I50024-T.jpg
			//   http://sp.yomiuri.co.jp/photo/20180418/20180418-OYT1I50024-L.jpg
			// http://www.yomiuri.co.jp/photo/20180417/20180417-OYT8I50039-N.jpg
			//   http://www.yomiuri.co.jp/photo/20180417/20180417-OYT8I50039-L.jpg
			return src.replace(/-[A-Z0-9](\.[^/.]*)$/, "-L$1");
		}

		if (domain_nosub === "newswitch.jp" && domain.match(/c[0-9]*\.newswitch\.jp/)) {
			// https://c01.newswitch.jp/cover?url=http%3A%2F%2Fnewswitch.jp%2Fimg%2Fupload%2FphpG8O8Wr_585240ce5a647.JPG
			//   http://newswitch.jp/img/upload/phpG8O8Wr_585240ce5a647.JPG
			return decodeURIComponent(src.replace(/^[a-z]*:\/\/[^/]*\/cover.*?[?&]url=([^&]*).*?$/, "$1"));
		}

		if (domain_nowww === "fashion-headline.com") {
			// https://www.fashion-headline.com/api/image/width/2000/images/migration/2015/01/a9201396f5dfc04a665e58a118f8f6cf.jpg
			//   https://www.fashion-headline.com/images/migration/2015/01/a9201396f5dfc04a665e58a118f8f6cf.jpg
			return src.replace(/\/api\/+image\/+(?:width|height)\/+[0-9]+\//, "/");
		}

		if (domain_nosub === "stream.ne.jp" && string_indexof(domain, "cdnext.stream.ne.jp") >= 0) {
			// https://c799eb2b0cad47596bf7b1e050e83426.cdnext.stream.ne.jp/img/article/000/227/336/0f58889dfd526d5ad4588cf35b598b5320180417142350635_262_262.jpg
			//   https://c799eb2b0cad47596bf7b1e050e83426.cdnext.stream.ne.jp/img/article/000/227/336/0f58889dfd526d5ad4588cf35b598b5320180417142350635.jpg
			return src.replace(/(\/[0-9a-f]+)_[0-9]*_[0-9]*(\.[^/.]*)$/, "$1$2");
		}

		if (domain_nosub === "ptcdn.info") {
			// https://ptcdn.info/movies/2018/NDeXUJq0TD-1522146022_s.jpg
			//   https://ptcdn.info/movies/2018/NDeXUJq0TD-1522146022_o.jpg
			// https://f.ptcdn.info/406/056/000/p4x3357tsNw7rwRxtqs-s.jpg
			//   https://f.ptcdn.info/406/056/000/p4x3357tsNw7rwRxtqs-o.jpg
			// doesn't work with all:
			// https://ptcdn.info/pick/185/000/000/p7aa3c5czjptg1MsPPd-s.jpg
			//   https://pantip.com/topic/37569184
			//   https://f.ptcdn.info/118/057/000/p7aa3c5czjptg1MsPPd-o.jpg
			return src.replace(/([-_])[a-z](\.[^/.]*)$/, "$1o$2");
		}

		if (domain_nosub === "pikabu.ru") {
			// https://cs7.pikabu.ru/post_img/2018/04/17/4/1523941253189748852.jpg
			//   https://cs7.pikabu.ru/post_img/big/2018/04/17/4/1523941253189748852.jpg
			// https://cs10.pikabu.ru/images/previews_comm/2018-04_6/1524835822161164251.jpg
			//   https://cs10.pikabu.ru/images/big_size_comm/2018-04_6/1524835822161164251.jpg
			// doesn't work for all:
			// https://cs8.pikabu.ru/post_img/big/2016/10/28/8/147765812818422511.jpg
			return src
				.replace(/\/post_img\/([0-9]+)\//, "/post_img/big/$1/")
				.replace(/\/images\/+previews_comm\/+/, "/images/big_size_comm/");
		}

		if (domain_nosub === "podium.life" ||
			// thanks to anonymous for reporting:
			// https://c.podium.im/r/h4/44b/bfd/39b9c6878a2a3826886c54c207.jpg
			//   https://c.podium.im/44b/bfd/39b9c6878a2a3826886c54c207.jpg
			// https://c.podium.im/r/w12/c9b/91c/7f64ce310b1e45b4bd9a14a602.jpg
			//   https://c.podium.im/c9b/91c/7f64ce310b1e45b4bd9a14a602.jpg
			domain === "c.podium.im") {
			// https://c.podium.life/content/r/80/photo/2409/2409496/533aaf0ded61d.jpg
			//   https://c.podium.life/content/photo/2409/2409496/533aaf0ded61d.jpg
			// https://c.podium.life/content/r/2/p/28765/8112/5a81580060110.jpg
			//   https://c.podium.life/content/p/28765/8112/5a81580060110.jpg
			return src.replace(/(:\/\/[^/]+\/+(?:content\/+)?)r\/+[wh]?[0-9]*(?:x[0-9]+)?\/+/, "$1");
		}

		if (domain_nowww === "lelulove.com") {
			// https://www.lelulove.com/content/photo/g7f6q5b7s3h6p8/thumbs/0003.jpg
			//   https://www.lelulove.com/content/photo/g7f6q5b7s3h6p8/full/0003.jpg
			return src.replace(/(\/content\/+photo\/+[0-9a-z]+\/+)thumbs\/+/, "$1full/");
		}

		if (domain_nosub === "filesor.com") {
			// bad if content-length == 9408 and last-modified == Tue, 12 Dec 2017 14:23:28 GMT
			// http://ist5-1.filesor.com/pimpandhost.com/1/_/_/_/1/5/S/b/y/5Sbyx/IE001955316_ORG_l.jpg
			//   http://ist5-1.filesor.com/pimpandhost.com/1/_/_/_/1/5/S/b/y/5Sbyx/IE001955316_ORG.jpg
			// http://ist3-2.filesor.com/pimpandhost.com/1/_/_/_/1/3/4/Q/V/34QVp/1_0.jpg
			//   http://ist3-2.filesor.com/pimpandhost.com/1/_/_/_/1/3/4/Q/V/34QVp/1.jpg
			// http://ist3-6.filesor.com/pimpandhost.com/1/1/2/0/112024/4/i/C/t/4iCt9/The.Good.Wife.S07_0.jpg
			return {
				url: src.replace(/_(?:[a-z]|[0-9])(\.[^/.]*)/, "$1"),
				bad_if: [{
					// This is too broad, but I can't find another consistent way without requiring CRCs
					headers: {
						"content-length": "9408",
						"content-type": "image/gif"
					}
				}]
			};
		}

		if (domain_nowww === "namooactors.com") {
			// http://www.namooactors.com/data/file/nm3002/thumb_latest/latest_120X160_2072965477_kGZly3he_HB_CHA-PO4_7.jpg.jpg
			//   http://www.namooactors.com/data/file/nm3002/2072965477_kGZly3he_HB_CHA-PO4_7.jpg
			// http://www.namooactors.com/data/file/nm3402/thumb/list_175px_2072965478_ZIMqombp_13419267_1093373410756804_4684262674469315848_n__1_.jpg.jpg
			//   http://www.namooactors.com/data/file/nm3402/2072965478_ZIMqombp_13419267_1093373410756804_4684262674469315848_n__1_.jpg
			return src.replace(/\/thumb(?:_[^/]*)?\/[a-z]+_[0-9]+(?:px|X[0-9]+)_(.*?\.[^/.]*)\.[^/.]*$/, "/$1");
		}

		if (domain_nowww === "ftopx.com" ||
			// http://www.goodwp.com/large/201410/31901.jpg
			//   http://www.goodwp.com/images/201410/goodwp.com_31901.jpg
			domain_nowww === "goodwp.com" ||
			// http://www.kartinkijane.ru/min/201504/85923.jpg
			//   http://www.kartinkijane.ru/images/201504/kartinkijane.ru_85923.jpg
			domain_nowww === "kartinkijane.ru" ||
			// https://www.nastol.com.ua/large/201706/228246.jpg
			//   https://www.nastol.com.ua/images/201706/nastol.com.ua_228246.jpg
			domain_nowww === "nastol.com.ua" ||
			// http://www.fonstola.ru/mini/201607/239100.jpg
			//   http://www.fonstola.ru/images/201607/fonstola.ru_239100.jpg
			// http://www.fonstola.ru/pic/201305/2560x1440/fonstola.ru-96157.jpg
			//   http://www.fonstola.ru/images/201305/fonstola.ru_96157.jpg
			domain_nowww === "fonstola.ru" ||
			// http://luxfon.com/min/201212/18906.jpg
			//   http://luxfon.com/images/201212/luxfon.com_18906.jpg
			domain_nowww === "luxfon.com" ||
			// https://look.com.ua/pic/201608/2560x1600/look.com.ua-175355.jpg
			//   https://look.com.ua/images/201608/look.com.ua_175355.jpg -- 404
			//   https://www.look.com.ua/images/201608/look.com.ua-175355.jpg -- 404
			//   https://www.look.com.ua/images/201608/175355.jpg -- 404
			//domain_nowww === "look.com.ua" ||
			// https://www.artleo.com/mini/201608/322769.jpg
			//   https://www.artleo.com/images/201608/artleo.com_322769.jpg
			domain_nowww === "artleo.com") {
			// https://ftopx.com/mini/201801/5a6b3a6bbc364.jpg
			//   https://ftopx.com/pic/1280x1024/201801/5a6b3a6bbc364.jpg
			//   https://ftopx.com/images/201801/ftopx.com_5a6b3a6bbc364.jpg
			// https://ftopx.com/mini/201709/59c718085fb87.jpg
			//   https://ftopx.com/images/201709/ftop.ru_59c718085fb87.jpg
			let prefix;

			if (domain_nowww === "ftopx.com") {
				var timestamp = parseInt(src.replace(/.*[/_]([a-f0-9]{10,})\.[^/.]*$/, "$1"), 16);
				prefix = ["ftop.ru", "ftopx.com"];
				if (timestamp > 1579484587755500)
					prefix = ["ftopx.com", "ftop.ru"];
			} else {
				prefix = domain_nosub;
			}

			regex = /\/(?:(?:(?:mini?|large)|pic\/+[0-9]+x[0-9]+)\/+([0-9]+)|pic\/+([0-9]{6})\/+[0-9]+x[0-9]+)\/+(?:[^/]*?\.[a-z]+[-_])?((?:[0-9a-f]+|[0-9]+)\.[^/.]*)(?:[?#].*)?$/;

			if (is_array(prefix)) {
				var urls = [];
				for (i = 0; i < prefix.length; i++) {
					urls.push(src.replace(regex, "/images/$1$2/" + prefix[i] + "_$3"));
				}
				return urls;
			} else {
				return src.replace(regex, "/images/$1$2/" + prefix + "_$3");
			}
		}

		if (domain_nowww === "wykop.pl" && string_indexof(src, "/cdn/") >= 0) {
			// https://www.wykop.pl/cdn/c3201142/comment_N6Pmm34BPk025H5hqkRnulsYFT9SvVHc,w400.jpg
			//   https://www.wykop.pl/cdn/c3201142/comment_N6Pmm34BPk025H5hqkRnulsYFT9SvVHc.jpg
			// https://www.wykop.pl/cdn/c3397993/link_AtyRCGO0byZiykQx9SX8p0KO34BFHSoB,w113h64.jpg
			//   https://www.wykop.pl/cdn/c3397993/link_AtyRCGO0byZiykQx9SX8p0KO34BFHSoB.jpg
			return src.replace(/,[^/.]*(\.[^/.]*)$/, "$1");
		}

		if (domain_nowww === "phoronix.net") {
			// https://www.phoronix.net/image.php?id=tomb-raider-20&image=tomb_vulkan_1_med
			//   https://www.phoronix.net/image.php?id=tomb-raider-20&image=tomb_vulkan_1
			// https://www.phoronix.net/image.php?id=tomb-raider-20&image=tomb_vulkan_4_med
			//   https://www.phoronix.net/image.php?id=tomb-raider-20&image=tomb_vulkan_4
			// https://www.phoronix.net/image.php?id=2020&image=gnome_40_shell_med
			//   https://www.phoronix.net/image.php?id=2020&image=gnome_40_shell_show
			return src
				.replace(/(\/image\.php.*?[?&]image=[^&]*)_show/, "$1")
				.replace(/(\/image\.php.*?[?&]image=[^&]*)_med/, "$1_show");
		}

		if (domain === "image.diyidan.net") {
			// https://www.diyidan.com/main/post/6294360860111032652/detail/1
			//   https://image.diyidan.net/post/2017/11/19/bWeT79y7vwR4GETq.jpg!weblarge
			//   https://image.diyidan.net/post/2017/11/19/bWeT79y7vwR4GETq.jpg
			// https://image.diyidan.net/user/2017/11/6/OKw88SkGjXLjINKS.jpg!tiny
			// it requires either a redirect from that page, or no headers whatsoever
			return {
				url: src.replace(/!.*/, ""),
				headers: {
					Referer: "https://www.diyidan.com/"
				}
			};
		}

		if (domain === "www.hrkgame.com" &&
			string_indexof(src, "/.thumbnails/") >= 0) {
			// https://www.hrkgame.com/media/screens/245280/.thumbnails/ss_1fd48fdc4cc57663dbc04e87e5f131076eac11d6.600x338.jpg/ss_1fd48fdc4cc57663dbc04e87e5f131076eac11d6.600x338-800x500.jpg
			//   https://www.hrkgame.com/media/screens/245280/ss_1fd48fdc4cc57663dbc04e87e5f131076eac11d6.600x338.jpg
			return src.replace(/\/\.thumbnails\/([^/]*)\/.*/, "/$1");
		}

		if (domain_nowww === "dlcompare.com" &&
			string_indexof(src, "/upload/cache/") >= 0) {
			// http://www.dlcompare.com/upload/cache/game_screenshot/img/enslaved-odyssey-to-the-west-screenshot-2.jpg
			//   http://www.dlcompare.com/upload/cache/slider/img/enslaved-odyssey-to-the-west-screenshot-2.jpg
			//   http://www.dlcompare.com:8042/img/enslaved-odyssey-to-the-west-img-4.jpg
			// http://www.dlcompare.com/upload/cache/slider/upload/gameimage/file/36257.jpeg - 3840x2160
			//   http://www.dlcompare.com/upload/gameimage/file/36257.jpeg -- same size
			// http://www.dlcompare.com/upload/cache/game_widget/upload/gameimage/file/21574.jpeg
			//   http://www.dlcompare.com/upload/gameimage/file/21574.jpeg
			//   http://www.dlcompare.com:8042/upload/gameimage/file/21575.jpeg -- much bigger
			return src.replace(/\/upload\/cache\/[^/]*\//, "/");
			/*newsrc = src.replace(/\/upload\/cache\/[^/]*\/upload\//, "/upload/");
			if (newsrc !== src)
				return newsrc;
			return src.replace(/\/upload\/cache\/[^/]*\//, "/upload/cache/slider/");*/
		}

		if (domain_nosub === "alphacoders.com" &&
			(domain.match(/images[0-9]*\.alphacoders\.com/) ||
			 // https://artfiles.alphacoders.com/741/thumb-74141.jpg
			//   https://artfiles.alphacoders.com/741/74141.jpg
			 domain === "artfiles.alphacoders.com" ||
			 // https://picfiles.alphacoders.com/172/thumb-172338.jpg
			 //   https://picfiles.alphacoders.com/172/172338.jpg
			 domain === "picfiles.alphacoders.com" ||
			 // https://avatarfiles.alphacoders.com/130/thumb-130907.jpg
			 //   https://avatarfiles.alphacoders.com/130/130907.jpg
			 domain === "avatarfiles.alphacoders.com" ||
			 // https://coverfiles.alphacoders.com/617/thumb-61790.jpg
			 //   https://coverfiles.alphacoders.com/617/61790.jpg
			 domain === "coverfiles.alphacoders.com" ||
			 // https://photofiles.alphacoders.com/421/thumb-42184.jpg
			 //   https://photofiles.alphacoders.com/421/42184.jpg
			 domain === "photofiles.alphacoders.com")) {
			// https://images2.alphacoders.com/728/thumb-350-728780.jpg
			//   https://images2.alphacoders.com/728/728780.jpg
			// https://images.alphacoders.com/107/thumbbig-1072438.webp
			//   https://images.alphacoders.com/107/1072438.jpg
			newsrc = src.replace(/\/thumb(?:-[0-9]*|big)?-([0-9]*\.[^/.]*)$/, "/$1");
			if (newsrc !== src)
				return add_extensions_from_webp(newsrc);
		}

		if (domain === "wall.alphacoders.com") {
			// https://wall.alphacoders.com/big.php?i=1019142
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+big\.php\?(?:.*&)?i=([0-9]+)(?:[&#].*)?$/,
				query_for_id: "https://wall.alphacoders.com/big.php?i=${id}",
				process: function(done, resp, cache_key) {
					var image = get_meta(resp.responseText, "og:image");
					if (!image) {
						console_error(cache_key, "Unable to find og:image for", resp);
						return done(null, false);
					}

					// FIXME: mostly useless because it gets redirected by the above rule anyways
					var obj:BigImageInfoSObject = {
						url: image,
						extra: {
							page: resp.finalUrl,
						}
					};

					var wallpaper_name = resp.responseText.match(/<h1 class="[^"]+wallpaper-name">([^<]+)<\/h1>/);
					if (wallpaper_name) {
						wallpaper_name = decode_entities(wallpaper_name[1]);
						obj.extra.caption = wallpaper_name;
					}

					return done(obj, 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "mobile.alphacoders.com") {
			// https://mobile.alphacoders.com/wallpapers/view/883925
			// https://mobile.alphacoders.com/wallpapers/view/883925/Fantasy-Cthulhu-Wallpapers
			// https://mobile.alphacoders.com/wallpapers/view/883925/Fantasy-Cthulhu-Wallpapers/
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+wallpapers\/+view\/+([0-9]+)(?:\/+[^/]*\/*)?(?:[?#].*)?$/,
				query_for_id: "https://mobile.alphacoders.com/wallpapers/view/${id}/",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/href="([a-z]+:\/\/wall\.alphacoders\.com\/big\.php\?i=[0-9]+)"/);
					if (!match) {
						console_error(cache_key, "Unable to find big.php match for", resp);
						return done(null, false);
					}

					var mobile_url = get_meta(resp.responseText, "image");

					return done([
						{
							url: match[1],
							is_pagelink: true,
							problems: {
								uncropped: true
							}
						},
						{
							url: mobile_url
						}
					], 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "mfiles.alphacoders.com") {
			// https://mfiles.alphacoders.com/184/18416.jpg
			//   https://images5.alphacoders.com/414/414660.jpg
			// https://mfiles.alphacoders.com/586/thumb-586777.jpg
			//   https://images2.alphacoders.com/152/152200.jpg
			// https://mobile.alphacoders.com/wallpapers/view/18416/
			id = src.replace(/.*\/(?:thumb(?:-[0-9]*)?-)?([0-9]+)\.[^/.]*$/, "$1");
			if (id !== src) {
				return {
					url: "https://mobile.alphacoders.com/wallpapers/view/" + id + "/",
					is_pagelink: true
				};
			}
		}

		if (domain_nowww === "gpstatic.com") {
			// https://gpstatic.com/acache/11/67/1/uk/s2_thumb-c5e9b414fd43a81842692da09938a394.jpg
			//   https://gpstatic.com/acache/11/67/1/uk/s2-c5e9b414fd43a81842692da09938a394.jpg
			return src.replace(/\/(s[0-9]*)_thumb(-[a-f0-9]*\.[^/.]*)$/, "/$1$2");
		}

		if (domain_nosub === "walldevil.com") {
			// https://www.walldevil.com/wallpapers/a81/thumb/enslaved-enslaved-odyssey-to-the-west.jpg
			//   https://www.walldevil.com/wallpapers/a81/enslaved-enslaved-odyssey-to-the-west.jpg
			// https://wallpapers.walldevil.com/wallpapers/a75/preview/wallpaper-anime-dark.jpg
			//   https://wallpapers.walldevil.com/wallpapers/a75/wallpaper-anime-dark.jpg
			return src.replace(/\/(?:thumb|preview)\//, "/");
		}

		if (domain === "www.peency.com" &&
			string_indexof(src, "/images/") >= 0) {
			// http://www.peency.com/images/2016/09/28/6b7af02546a41cd54_full.png
			//   http://www.peency.com/images/2016/09/28/6b7af02546a41cd54.png
			// http://www.peency.com/images/2014/10/21/jessica-alba-hot-photoshoot-wallpaper-2560x1440_240x200.jpg
			//   http://www.peency.com/images/2014/10/21/jessica-alba-hot-photoshoot-wallpaper-2560x1440.jpg
			return src.replace(/_[^/._]*(\.[^/.]*)$/, "$1");
		}

		if (domain === "www.wallpaperbetter.com" &&
			string_indexof(src, "/wallpaper/") >= 0) {
			// http://www.wallpaperbetter.com/wallpaper/659/286/567/sergey-fat-1080P-wallpaper-thumb.jpg
			//   http://www.wallpaperbetter.com/wallpaper/659/286/567/sergey-fat-1080P-wallpaper-middle-size.jpg
			//   http://www.wallpaperbetter.com/wallpaper/659/286/567/sergey-fat-1080P-wallpaper.jpg
			return src.replace(/-(?:thumb|middle-size)(\.[^/.]*)$/, "$1");
		}

		if (domain_nowww === "thiswallpaper.com" && string_indexof(src, "/cdn/") >= 0) {
			// https://thiswallpaper.com/cdn/thumb/796/amazing%20rihanna%20full%20screen%20image.jpg
			//   https://thiswallpaper.com/cdn/hdwallpapers/796/amazing%20rihanna%20full%20screen%20image.jpg
			return src.replace("/cdn/thumb/", "/cdn/hdwallpapers/");
		}

		if (domain_nowww === "superwallpapers.in" ||
			// https://www.hdcarwallpapers.in/hdwallpapers/2010-porsche-911-sport-classic-hd-wallpapers_196_196_100_cf.jpg
			//   https://www.hdcarwallpapers.in/hdwallpapers/2010-porsche-911-sport-classic-hd-wallpapers.jpg
			domain_nowww === "hdcarwallpapers.in") {
			// http://www.superwallpapers.in/hdwallpapers/selena-gomez-172_196_196_90_cf.jpg
			//   http://www.superwallpapers.in/hdwallpapers/selena-gomez-172.jpg
			return src.replace(/_[0-9]+_[0-9]+_[0-9]+_cf(\.[^/.]*)(?:[?#].*)?$/, "$1");
		}

		if (domain_nowww === "booklikes.com") {
			// http://booklikes.com/photo/max/600/0/upload/post/a/8/azure_a8af8e2f197da5d3c84dbec44eb0ffed.jpg
			//   http://booklikes.com/upload/post/a/8/azure_a8af8e2f197da5d3c84dbec44eb0ffed.jpg
			// http://booklikes.com/www/thumb.php?mode=max&w=600&h=0&img=upload/post/a/8/azure_a8af8e2f197da5d3c84dbec44eb0ffed.jpg
			//   http://booklikes.com/upload/post/a/8/azure_a8af8e2f197da5d3c84dbec44eb0ffed.jpg
			newsrc = src.replace(/.*\/www\/+thumb\.php\?(?:.*&)?img=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return "http://" + domain + "/" + decodeURIComponent(newsrc);

			return src.replace(/\/photo\/+max\/+[0-9]+\/+[0-9]+\/upload\/+/, "/upload/");
		}

		if ((domain_nowww === "hdwallsource.com" ||
			 // https://pickywallpapers.com/img/2018/1/thumb/hailee-steinfeld-wallpaper-190-197-hd-wallpapers-thumb.jpg
			 //   https://pickywallpapers.com/img/2018/1/hailee-steinfeld-wallpaper-190-197-hd-wallpapers.jpg
			 domain_nowww === "pickywallpapers.com") &&
			string_indexof(src, "/img/") >= 0) {
			// https://hdwallsource.com/img/2016/6/thumb/jamie-bell-actor-wallpaper-background-hd-55539-57284-hd-wallpapers-thumb.jpg
			//   https://hdwallsource.com/img/2016/6/jamie-bell-actor-wallpaper-background-hd-55539-57284-hd-wallpapers.jpg
			return src.replace(/\/thumb\/+([^/.]*)-thumb(\.[^/.]*)(?:[?#].*)?$/, "/$1$2");
		}

		if ((domain_nowww === "customity.com" && string_indexof(src, "/storage/public/") >= 0) ||
			// https://www.wisebread.com/files/fruganomics/imagecache/605x340/blog-images/man_with_cash_000073068135.jpg
			//   https://www.wisebread.com/files/fruganomics/blog-images/man_with_cash_000073068135.jpg
			(domain_nowww === "wisebread.com" && string_indexof(src, "/files/") >= 0)) {
			// http://www.customity.com/storage/public/imagecache/0100x0100/image/wallpaper/201007/507-charlize-theron-wallpaper-1600x1200-customity.jpg
			//   http://www.customity.com/storage/public/image/wallpaper/201007/507-charlize-theron-wallpaper-1600x1200-customity.jpg
			return src.replace(/\/imagecache\/+[0-9]+x[0-9]+\//, "/");
		}

		if ((domain_nowww === "desktopimages.org" ||
			 // http://www.hdbilder.eu//pictures/2012/1002/1/th1_214136.jpg
			 //   http://www.hdbilder.eu//pictures/2012/1002/1/orig_214136.jpg
			 // http://www.hdbilder.eu/p/get_photo/214136/960/600
			 domain_nowww === "hdbilder.eu" ||
			 // http://www.hdfondos.eu/pictures/2013/0103/1/th1_584218.jpg
			 //   http://www.hdfondos.eu/pictures/2013/0103/1/orig_584218.jpg
			 // http://www.hdfondos.eu/preview/get_photo/213027/1366/768
			 //   http://www.hdfondos.eu/pictures/2014/0329/1/orig_213027.jpg
			 domain_nowww === "hdfondos.eu" ||
			 // http://www.banktapet.pl/pictures/2012/0216/1/th1_501871.jpg
			 //   http://www.banktapet.pl/pictures/2012/0216/1/orig_501871.jpg
			 domain_nowww === "banktapet.pl" ||
			 // http://www.fondsecran.eu//pictures/2015/1106/1/th1_637032.jpg
			 //   http://www.fondsecran.eu//pictures/2015/1106/1/orig_637032.jpg
			 domain_nowww === "fondsecran.eu")) {
			// http://www.desktopimages.org/pictures/2015/0713/1/th1_144184.jpg
			//   http://www.desktopimages.org/pictures/2015/0713/1/apple-os-x-el-capitans-wallpaper-144184.jpg
			//   http://www.desktopimages.org/pictures/2015/0713/1/orig_144184.jpg
			if (string_indexof(src, "/pictures/") >= 0) {
				newsrc = src.replace(/\/[^/]*[-_]([0-9]+\.[^/.]*)$/, "/orig_$1");
				if (newsrc !== src)
					return newsrc;
			}

			if (options && options.cb && options.do_request &&
				src.match(/\/(?:p|preview)\/+get_photo\/+[0-9]+\/+[0-9]+/)) {
				var querysrc = src.replace(/\/(?:p|preview)\/+get_photo\/+([0-9]+\/+[0-9]+)(?:\/.*)?$/, "/p/$1/0/o");
				options.do_request({
					url: querysrc,
					method: "GET",
					onload: function(resp) {
						if (resp.readyState === 4) {
							var match = resp.responseText.match(/<img *src="([^">]*\/orig_[^/">]*)"/);
							if (match) {
								options.cb(match[1]);
							} else {
								options.cb(null);
							}
						}
					}
				});

				return {
					waiting: true
				};
			}
		}

		if (domain_nowww === "bikerpunks.com" && string_indexof(src, "/media/") >= 0) {
			// https://www.bikerpunks.com/media/thumbs/79687f0c3d11.jpg
			//   https://www.bikerpunks.com/media/largethumbs/79687f0c3d11.jpg
			//   https://www.bikerpunks.com/media/79687f0c3d11.jpg
			// doesn't work for all:
			// https://www.bikerpunks.com/media/thumbs/6c6820f9fb17.jpg
			//   https://www.bikerpunks.com/media/gallery/061e37dea07d99618dba00438d5f87ff.jpg
			return src.replace(/\/media\/[^/]*\/([0-9a-f]*\.[^/.]*)$/, "/media/$1");
		}

		if (domain_nosub === "livejournal.com" && domain.match(/i[a-z]*\.pics\.livejournal\.com/)) {
			// https://i.pics.livejournal.com/babymelaw/34311960/10819/10819_900.jpg
			//   https://i.pics.livejournal.com/babymelaw/34311960/10819/10819_original.jpg
			// https://ic.pics.livejournal.com/babymelaw/34311960/10819/10819_900.jpg
			//   https://ic.pics.livejournal.com/babymelaw/34311960/10819/10819_original.jpg
			// https://ic.pics.livejournal.com/zoyanailru/46712907/10570/300.jpg
			//   https://ic.pics.livejournal.com/zoyanailru/46712907/10570/original.jpg
			// https://pics.livejournal.com/feenal/pic/000h5zaw/s640x480 -- redirects to:
			//   https://ic.pics.livejournal.com/feenal/17315534/121949/121949_640.jpg
			// https://pics.livejournal.com/feenal/pic/000h5zaw/ -- redirects to:
			//   https://ic.pics.livejournal.com/feenal/17315534/121949/121949_original.jpg
			return src
				.replace(/(\/pic\/[0-9a-z]+\/)s[0-9]+x[0-9]+(?:[?#].*)?$/, "$1")
				.replace(/_[0-9]*(\.[^/.]*)$/, "_original$1")
				.replace(/(\/[0-9]+\/)[0-9]+(\.[^/.]*)$/, "$1original$2");
		}

		if (domain === "pics.livejournal.com") {
			// https://pics.livejournal.com/a_poli/pic/007dqxxd/s640x480
			//   https://pics.livejournal.com/a_poli/pic/007dqxxd/original
			//   https://ic.pics.livejournal.com/k_poli/8872958/1499870/1499870_original.jpg
			return src.replace(/\/s[0-9]+x[0-9]+(?:[?#].*)?$/, "/original");
		}

		if (host_domain_nosub === "livejournal.com" && options.element && domain === "imgprx.livejournal.net") {
			// thanks to elvisef on github for reporting: https://github.com/qsniyg/maxurl/issues/755
			// see below rule for research
			// note that not all journals with imgprx have <a>s surrounding, for example: https://tacit.livejournal.com/630210.html
			if (options.element.tagName === "IMG" && options.element.getAttribute("loading") === "lazy" &&
				options.element.parentElement && options.element.parentElement.tagName === "A" && options.element.parentElement.getAttribute("rel") === "nofollow") {
				return options.element.parentElement.href;
			}
		}

		if (domain === "imgprx.livejournal.net") {
			// thanks to elvisef on github for reporting: https://github.com/qsniyg/maxurl/issues/755
			// test: https://the-dimka.livejournal.com/
			// the handwriting fonts do not redirect, the artworks below do redirect
			if (options.do_request && options.cb) {
				common_functions["get_redirect_url"](api_cache, options, {
					url: src,
					imu_mode: "document"
				}, options.cb);
				return {
					waiting: true
				};
			}
		}

		if (domain_nowww === "yastatic.net") {
			// https://yastatic.net/s3/web4static/_/v2/[...].gif
			if (/\/s3\/+web4static\/+_\/+v2\/+/.test(src))
				return {
					url: src,
					bad: "mask"
				};
		}

		if (domain_nowww === "dzen.ru") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+video\/+watch\/+([0-9a-f]{10,})(?:[?#].*)?$/,
				query_for_id: "https://dzen.ru/video/watch/${id}",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/var data\s*=\s*({.*"__serverSettings__video-site_.*});\s*\n/);
					if (!match) {
						console_error(cache_key, "Unable to find data match for", resp);
						return done(null, false);
					}

					var json = JSON_parse(match[1]);
					let serversettingskey = null;
					for (let key in json) {
						if (string_indexof(key, "serverSettings") >= 0) {
							serversettingskey = key;
							break;
						}
					}

					if (!serversettingskey) {
						console_error(cache_key, "Unable to find serverSettings key in", {
							resp,
							json
						});
						return done(null, false);
					}

					let serversettings = json[serversettingskey];
					let videodata = serversettings.exportData.video;

					let extra = {
						caption: videodata.title,
						page: videodata.link,
						created_date: parse_int(videodata.publicationDate) * 1000
					};

					let urls = [];

					for (let url of videodata.video.streams) {
						if (/\.m3u8\?/.test(url)) {
							urls.push({
								url: url,
								video: "hls"
							});
						} else if (/\.mpd\?/.test(url)) {
							urls.push({
								url: url,
								video: "dash"
							});
						} else {
							console_warn(cache_key, "Unhandled url", url);
						}
					}

					urls.push(videodata.image);

					return done(fillobj_urls(urls, {
						extra
					}), 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "zen.yandex.ru") {
			// thanks to mcOrmenos on discord for reporting
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+video\/+watch\/+([0-9a-f]{10,})(?:[?#].*)?$/,
				run(cb, match) {
					return cb({
						url: "https://dzen.ru/video/watch/" + match[1],
						is_pagelink: true
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if ((host_domain_nowww === "yandex.ru" ||
			 host_domain_nowww === "yandex.com")
			 && options && options.element) {
			var current = options.element;
			while ((current = current.parentElement)) {
				if (current.tagName === "A") {
					match = current.href.match(/^[a-z]+:\/\/[^/]+\/+images\/+search\?(?:.*&)?img_url=([^&]+)/);
					if (match) {
						newsrc = decodeuri_ifneeded(match[1]);
						if (newsrc !== src)
							return newsrc;
					}

					break;
				}
			}
		}

		if (domain === "img-fotki.yandex.ru") {
			// http://img-fotki.yandex.ru/get/4606/142895192.a/0_6776c_3e548a9d_XL.gif
			//   http://img-fotki.yandex.ru/get/4606/142895192.a/0_6776c_3e548a9d_orig.gif
			// http://img-fotki.yandex.ru/get/4606/142895192.a/0_6776c_3e548a9d_XL
			//   http://img-fotki.yandex.ru/get/4606/142895192.a/0_6776c_3e548a9d_orig
			return src.replace(/_[^-/._]*(\.[^/.]*)?$/, "_orig$1");
		}

		if (domain_nosub === "yandex.ru" && /downloader.disk.yandex.ru/.test(domain)) {
			return src.replace(/(\/preview\/+[0-9a-f]{30,}\/+.*?\?(?:.*&)?size=)[0-9]+x[0-9]+(&.*)?$/, "$10x0$2");
		}

		if (domain_nosub === "steemitimages.com") {
			// deprecated, it's returning hashed urls now
			// https://steemitimages.com/0x0/https://steemitimages.com/DQmUXTDZ82P2K8iK1naLZETucmAcz7W9vvReEbTi5osSh4U/quantstamp_network-1.png
			//   https://steemitimages.com/DQmUXTDZ82P2K8iK1naLZETucmAcz7W9vvReEbTi5osSh4U/quantstamp_network-1.png
			// https://cdn.steemitimages.com/0x0/https://i.redd.it/satbsuymrzwz.jpg
			//   https://i.redd.it/satbsuymrzwz.jpg
			// https://steemitimages.com/p/3DLAmCsuTe3bwjPJtcJJmZusPtExyx3sTaZakhzEoKUSV8xYAASVbCAvL5JmQJ7DTbiBfff5UTda7CrsA1sBkmQjt1f7GpLhBZ8SGsgoKU6CXpUJG2CwD1y3XtPAYzc1qkAc5ZFj8U9zgxhzZS3AAdo9r9jh3TU?format=match&mode=fit&width=640
			//   https://steemitimages.com/p/3DLAmCsuTe3bwjPJtcJJmZusPtExyx3sTaZakhzEoKUSV8xYAASVbCAvL5JmQJ7DTbiBfff5UTda7CrsA1sBkmQjt1f7GpLhBZ8SGsgoKU6CXpUJG2CwD1y3XtPAYzc1qkAc5ZFj8U9zgxhzZS3AAdo9r9jh3TU
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/[0-9]+x[0-9]+\//, "");
			if (newsrc !== src)
				return newsrc;
			return src.replace(/\?.*/, "");
		}

		if (amazon_container &&
			amazon_container.match(/^steemit-production-imageproxy-[^-.]*/)) {
			// doesn't work in all cases? private images maybe?
			// https://steemit-production-imageproxy-thumbnail.s3.amazonaws.com/DQmUXTDZ82P2K8iK1naLZETucmAcz7W9vvReEbTi5osSh4U_1680x8400
			//   https://steemit-production-imageproxy-upload.s3.amazonaws.com/DQmUXTDZ82P2K8iK1naLZETucmAcz7W9vvReEbTi5osSh4U
			// https://s3.amazonaws.com/steemit-production-imageproxy-thumbnail/DQmUXTDZ82P2K8iK1naLZETucmAcz7W9vvReEbTi5osSh4U_1680x8400
			//   https://s3.amazonaws.com/steemit-production-imageproxy-upload/DQmUXTDZ82P2K8iK1naLZETucmAcz7W9vvReEbTi5osSh4U
			return src
				.replace(/-imageproxy-thumbnail((?:\.[^/]*)?\/[A-Za-z0-9]*)_[0-9]+x[0-9]+$/, "-imageproxy-upload$1");
		}

		if (domain === "images.hive.blog") {
			// https://images.hive.blog/p/2gsjgna1uruvGBHDnRaj2zVCcpeJW4jyLMe4SBCHyjmJ8QDfAdggyN6HvtKcZ38HFqTQ67Zmd93fd3ejxvMqLDixSZLkao9HwQvCdJp2DxujnrLmxS?format=match&mode=fit&width=256&height=512
			//   https://images.hive.blog/p/2gsjgna1uruvGBHDnRaj2zVCcpeJW4jyLMe4SBCHyjmJ8QDfAdggyN6HvtKcZ38HFqTQ67Zmd93fd3ejxvMqLDixSZLkao9HwQvCdJp2DxujnrLmxS
			return src.replace(/(\/p\/+[0-9a-zA-Z]{50,})\?.*/, "$1");
		}

		if (domain_nowww === "newsprom.ru") {
			// http://newsprom.ru/i/n/913/237913/237913_b78a299e453f.jpg
			//   http://newsprom.ru/i/n/913/237913/tn_237913_b78a299e453f.jpg
			return src.replace(/\/([0-9]+_[a-f0-9]+\.[^/.]*)$/, "/tn_$1");
		}

		if (domain_nosub === "fotocdn.net" && domain.match(/i[0-9]*\.fotocdn\.net/)) {
			// https://i07.fotocdn.net/s26/177/user_m/279/2643400368.jpg
			//   https://i07.fotocdn.net/s26/177/user_xl/279/2643400368.jpg
			// https://i10.fotocdn.net/s11/185/gallery_m/239/2308894392.jpg
			//   https://i10.fotocdn.net/s11/185/gallery_l/239/2308894392.jpg
			// https://i03.fotocdn.net/s28/142/user_l/328/2680637325.jpg
			// https://i01.fotocdn.net/s13/206/gallery_m/79/2370850509.jpg
			//   https://i01.fotocdn.net/s13/206/gallery_l/79/2370850509.jpg
			// https://i03.fotocdn.net/s10/119/public_pin_l/473/2467682422.jpg -- don't believe there's a public_pin_xl
			// https://i07.fotocdn.net/s26/103/public_pin_3c/186/2651896166.jpg
			//   https://i07.fotocdn.net/s26/103/public_pin_l/186/2651896166.jpg
			// https://i03.fotocdn.net/s105/84875d618bc8f8f9/public_pin_m/2266704428.jpg
			//  https://i03.fotocdn.net/s105/84875d618bc8f8f9/public_pin_l/2266704428.jpg -- doesn't work
			regex = /_(?:[a-z]+|[0-9]+c)(\/+[0-9]+\/+[0-9]+\.[^/.]*)$/;
			return [
				src.replace(regex, "_xl$1"),
				src.replace(regex, "_l$1")
			];
		}

		if (domain_nowww === "news-people.fr" && string_indexof(src, "/galerie/") >= 0) {
			// http://www.news-people.fr/galerie/731658/2.jpg
			//   http://www.news-people.fr/galerie/731658/2_hd.jpg
			return src.replace(/\/([0-9]*)(\.[^/.]*)$/, "/$1_hd$2");
		}

		if (domain_nosub === "cdn107.com") {
			// http://album2.cdn107.com/70/4d/704d6c866c741cced6136951968c51a1_sm.jpg
			//   http://album2.cdn107.com/70/4d/704d6c866c741cced6136951968c51a1.jpg
			// http://artist1.cdn107.com/16a/16a9b15e1220b200bb67f5fb4a46004c_lg.jpg
			//   http://artist1.cdn107.com/16a/16a9b15e1220b200bb67f5fb4a46004c.jpg
			return src.replace(/_[a-z]*(\.[^/.]*)$/, "$1");
		}

		if (domain === "hairstyles.thehairstyler.com") {
			// https://hairstyles.thehairstyler.com/hairstyle_views/front_view_images/12346/icon/short-straight-hairstyle.jpg
			//   https://hairstyles.thehairstyler.com/hairstyle_views/front_view_images/12346/original/short-straight-hairstyle.jpg
			// https://hairstyles.thehairstyler.com/hairstyles/images/20324/tiny/short-straight-hairstyle-with-bangs.jpg
			//   https://hairstyles.thehairstyler.com/hairstyles/images/20324/original/short-straight-hairstyle-with-bangs.jpg
			// https://hairstyles.thehairstyler.com/hairstyles/images/20353/thumb/short-blonde-asymmetrical-hairstyle.jpg
			//   https://hairstyles.thehairstyler.com/hairstyles/images/20353/thumb/short-blonde-asymmetrical-hairstyle.jpg
			return src.replace(/(\/[0-9]*\/)[^/]*\/([^/]*)$/, "$1original/$2");
		}

		if (domain_nowww === "abload.de") {
			// http://www.abload.de/thumb/celebrity-paradise.coxdc2s.jpg
			//   http://www.abload.de/img/celebrity-paradise.coxdc2s.jpg
			return {
				url: src.replace(/(:\/\/[^/]+\/+)thumb\/+/, "$1img/"),
				head_wrong_contenttype: true
			};
		}

		if (domain_nowww === "wallpaperpulse.com") {
			// http://wallpaperpulse.com/thumb/2358346.jpg
			//   http://wallpaperpulse.com/img/2358346.jpg
			return src.replace(/\/thumb\//, "/img/");
		}

		if (domain === "assets.capitalfm.com" ||
			domain === "assets.gcstatic.com") {
			// https://assets.capitalfm.com/2018/15/sprite-cucumber-1524239960-list-tablet-0.png
			//   https://assets.capitalfm.com/2018/15/sprite-cucumber-1524239960-herowidev4-0.png
			//   https://assets.capitalfm.com/2018/15/sprite-cucumber-1524239960.png
			// http://assets.gcstatic.com/u/apps/asset_manager/uploaded/2017/17/victorious--1493385031-custom-0.jpg
			//   http://assets.gcstatic.com/u/apps/asset_manager/uploaded/2017/17/victorious--1493385031.jpg
			// https://assets.capitalfm.com/2017/17/victorious-1493385935-herowidev4-0.jpg
			//   https://assets.capitalfm.com/2017/17/victorious-1493385935.jpg
			return src.replace(/(\/[^/]*-[0-9]{8,})-[^/]*(\.[^/.]*)$/, "$1$2");
		}

		if (domain_nowww === "leathercelebrities.com") {
			// doesn't work
			// http://www.leathercelebrities.com/images/resized/victoria-justice-attends-lmdm-grand-opening-party-300x450.jpg
			//   http://www.leathercelebrities.com/images/uploads/Victoria-Justice-attends-LMDM-Grand005.jpg
			// http://www.leathercelebrities.com/images/uploads/21621/victoria_justice_attends_lmdm_grand002__thumb.jpg
			//   http://www.leathercelebrities.com/images/uploads/21621/victoria_justice_attends_lmdm_grand002.jpg
			//
			// http://www.leathercelebrities.com/download.php?file=http%3A%2F%2Fwww.leathercelebrities.com%2Fimages%2Fuploads%2F21058%2Fdanielle_panabaker_is_seen_leaving_craig10.jpg
			//   http://www.leathercelebrities.com/images/uploads/21058/danielle_panabaker_is_seen_leaving_craig10.jpg
			return decodeURIComponent(src
									  .replace(/^[a-z]+:\/\/[^/]*\/download\.php.*?[?&]file=([^&]*).*?$/, "$1")
									  .replace(/(\/uploads\/[0-9]*\/[^/]*)__thumb(\.[^/.]*)$/, "$1$2"));
		}

		if (domain === "img.cache.vevo.com" ||
			// https://scache.vevo.com/thumb/cms/d6e08360-4716-11e7-8dfb-83b07a2ebb67/200x200.jpg?resize=fit&remove_borders=true
			//   https://scache.vevo.com/thumb/cms/d6e08360-4716-11e7-8dfb-83b07a2ebb67.jpg
			// https://scache.vevo.com/thumb/cms/d6e08360-4716-11e7-8dfb-83b07a2ebb67.jpg?height=510&crop=auto
			//   https://scache.vevo.com/thumb/cms/d6e08360-4716-11e7-8dfb-83b07a2ebb67.jpg
			domain === "scache.vevo.com") {
			// https://img.cache.vevo.com/thumb/cms/6adeb8f9fb65d67e94044181f4e102c6/281x159.jpg
			//   https://img.cache.vevo.com/thumb/cms/6adeb8f9fb65d67e94044181f4e102c6.jpg
			// https://img.cache.vevo.com/thumb/artist/victoria-justice/220x220.jpeg
			//   https://img.cache.vevo.com/thumb/artist/victoria-justice.jpeg
			newsrc = src.replace(/[?#].*$/, "");
			if (newsrc !== src)
				return newsrc;

			return src.replace(/(\/thumb\/[^/]*\/[^/]*)\/[0-9]+x[0-9]+(\.[^/.]*?)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "superiorpics.com" ||
			// https://i.bollywoodmantra.com/albums/candids/actresses/amy-jackson-1/thumb400/amy-jackson__1065204.jpg
			//   https://i.bollywoodmantra.com/albums/candids/actresses/amy-jackson-1/amy-jackson__1065204.jpg -- adds watermark? first one seems to have it too
			domain === "i.bollywoodmantra.com") {
			// http://www.superiorpics.com/pictures2/thumb168/1TeenChoRD2028754.jpg
			//   http://www.superiorpics.com/pictures2/1TeenChoRD2028754.jpg
			return src.replace(/\/thumb[0-9]+\//, "/");
		}

		if (domain_nowww === "celebjihad.com" ||
			// https://image.dek-d.com/27/0327/3957/t_126536551
			//   https://image.dek-d.com/27/0327/3957/126536551
			domain === "image.dek-d.com") {
			// https://www.celebjihad.com/celeb-jihad/harlots/victoria_justice38/t_victoria_justice1.jpg
			//   https://www.celebjihad.com/celeb-jihad/harlots/victoria_justice38/victoria_justice1.jpg
			return src.replace(/\/t_([^/]*)$/, "/$1");
		}

		if (false && (domain === "www.looktothestars.org" && string_indexof(src, "/photo/") >= 0)) {
			// https://www.looktothestars.org/photo/6950-victoria-justice-fronts-psa/story_wide.jpg
			//   https://www.looktothestars.org/photo/6950-victoria-justice-fronts-psa/large.jpg
			// https://www.looktothestars.org/photo/3-george-clooney/small_square-1503121378.jpg
			//   https://www.looktothestars.org/photo/3-george-clooney/large.jpg -- stretched
			return src.replace(/\/[^/]*(\.[^/.]*)$/, "/large$1");
		}

		if (domain === "cdn.teamcococdn.com") {
			// http://cdn.teamcococdn.com/image/1000x1000,scale:none/victoria-justice-54ed2693b4bf1.jpg -- stretched
			//   http://cdn.teamcococdn.com/file/victoria-justice-54ed2693b4bf1.jpg
			return src.replace(/\/image\/[^/]*\//, "/file/");
		}

		if (domain === "live.staticflickr.com") {
			// https://live.staticflickr.com/4741/buddyicons/70777296@N08_l.jpg
			//   https://live.staticflickr.com/4741/buddyicons/70777296@N08_r.jpg
			newsrc = src.replace(/(\/buddyicons\/+[0-9]+@N[0-9]+)(?:_[slm])?(\.[^/.]*)(?:[?#].*)?$/, "$1_r$2");
			if (newsrc !== src)
				return newsrc;
		}

		if (host_domain_nowww === "flickr.com" && domain === "combo.staticflickr.com" && options.element) {
			// thanks to anonymous for reporting:
			// https://combo.staticflickr.com/ap/build/images/photo-fuzzy-t.png
			// https://combo.staticflickr.com/ap/build/images/photo-fuzzy.png
			// https://combo.staticflickr.com/pw/images/fuzzy/photo-fuzzy-t.png.v[date].75
			if (/\/images\/+(?:fuzzy\/+)?photo-fuzzy(?:-t)?\./.test(src)) {
				if (options.element.tagName === "IMG" && options.element.parentElement && options.element.parentElement.tagName === "A") {
					return options.element.parentElement.href;
				}
			}
		}

		if ((domain_nosub === "staticflickr.com" ||
			 domain === "static.flickr.com" ||
			 (domain_nosub === "flickr.com" && string_indexof(domain, ".static.flickr.com") >= 0)) &&
			(src.match(/\/[0-9]+_[0-9a-f]+(?:_[a-z0-9]*)*\.[a-z]+.*$/) || /\/video\/+[0-9]+\/+[0-9a-f]+\/+/.test(src)) &&
			options && options.do_request && options.cb) {
			// https://c1.staticflickr.com/5/4190/34341416210_29e6098b30.jpg
			//   https://farm5.staticflickr.com/4190/34341416210_9f14cc1576_o.jpg
			// https://farm5.static.flickr.com/4157/34467046051_631ea7efa7_b.jpg
			//   https://farm5.staticflickr.com/4157/34467046051_9b6f0e9a7c_o.jpg
			// http://farm8.staticflickr.com/7034/6693295971_22e55a1b42_z.jpg%3C/br%3E
			// http://farm8.staticflickr.com/7034/6693295971_22e55a1b42_z.jpg</undefined
			// http://farm8.staticflickr.com/7034/6693295971_22e55a1b42_z.jpg%3C/undefined.
			//   https://farm8.staticflickr.com/7034/6693295971_36acecc53b_o.jpg
			// https://farm8.staticflickr.com/7002/6432649813_4fe18483a6.jpg
			//   https://farm8.staticflickr.com/7002/6432649813_21c9e80f43_o.jpg
			// https://live.staticflickr.com/65535/48913730532_83284fa99d_3k.jpg
			//   https://live.staticflickr.com/65535/48913730532_c31a823c53_o.jpg
			// https://live.staticflickr.com/31337/49782135648_bff29ec44e_b.jpg
			//   https://live.staticflickr.com/video/49782135648/bff29ec44e/1080p.mp4
			// thanks to anonymous for reporting:
			// https://live.staticflickr.com/2624/4134813569_42c3f585de_b_d.jpg

			var find_photoid_secret_from_url = function(src) {
				var match = src.match(/\/video\/+([0-9]+)\/+([0-9a-f]+)\/+/);
				if (!match) {
					match = src.match(/\/[0-9]+\/+([0-9]+)_([0-9a-z]+)(?:_[^/.]+)?\..*/);
				}

				if (match) {
					return {
						id: match[1],
						secret: match[2]
					};
				} else {
					return null;
				}
			};

			var find_image_obj = function(info, src, cb, origobj) {
				var photoinfo = find_photoid_secret_from_url(src);

				var cache_key = "flickr_image_obj:" + photoinfo.id;
				api_cache.fetch(cache_key, function(obj) {
					if (!obj)
						return cb(null);

					if (origobj) {
						if (!is_array(origobj)) origobj = [origobj];
						cb(fillobj_urls(origobj, obj));
					} else {
						cb(obj);
					}
				}, function(done) {
					find_image_info(info, src, function(info) {
						if (!info)
							return done(null, false);

						return done(common_functions["flickr_info_to_obj"](info), 60*60);
					});
				});
			};

			var find_image_info = function(info, src, cb) {
				var photoinfo = find_photoid_secret_from_url(src);

				var cache_key = "flickr_image_info:" + photoinfo.id + "_" + photoinfo.secret;

				api_cache.fetch(cache_key, cb, function(done) {
					var apirequest = "method=flickr.photos.getInfo&photo_id=" + photoinfo.id;

					// k in "fake" isn't hex
					if (photoinfo.secret !== "face")
						apirequest += "&secret=" + photoinfo.secret;

					common_functions["flickr_api_request"](options, info, apirequest, function(out) {
						if (!out)
							return done(null, false);

						done(out.photo, 60*60);
					});
				});
			}

			var get_obj_from_image_info = function(info) {
				try {
					var url = info.urls.url[0]._content;
					if (!(/^https?:\/\//.test(url))) {
						url = null;
					}

					var caption = info.title._content;
					if (!caption)
						caption = null;

					var extra = {
						page: url,
						caption: caption
					};

					return extra;
				} catch (e) {
					console_error(e, info);
				}

				return null;
			};

			var find_video_info = function(info, photoinfo, cb) {
				// https://live.staticflickr.com/31337/49782135648_4bef5823d8_k.jpg
				// returns info secret (bff29ec44e, available in the smaller urls) instead of url secret
				var cache_key = "flickr_video:" + photoinfo.id + "_" + photoinfo.secret;
				api_cache.fetch(cache_key, cb, function(done) {
					var apirequest = "method=flickr.video.getStreamInfo&photo_id=" + photoinfo.id;

					// k in "fake" isn't hex
					if (photoinfo.secret !== "face")
						apirequest += "&secret=" + photoinfo.secret;

					common_functions["flickr_api_request"](options, info, apirequest, function(out) {
						if (!out)
							return done(null, false);

						if (out.streams.stream.length > 0) {
							done(out.streams.stream, 60*60);
						} else {
							console_error(cache_key, "No streams in", out);
							done(null, false);
						}
					});
				});
			};

			var find_largest_video = function(videodata) {
				var max = 0;
				var maxobj = null;

				for (var i = 0; i < videodata.length; i++) {
					var quality = parseInt(videodata[i].type);
					if (!quality || isNaN(quality) || !videodata[i]._content)
						continue;

					if (quality > max) {
						maxobj = videodata[i];
						max = quality;
					}
				}

				if (maxobj) {
					return maxobj._content;
				} else {
					return null;
				}
			};

			newsrc = src.replace(/(:\/\/[^/]*\/(?:[0-9]+\/)?[0-9]+\/[0-9]+_[0-9a-f]+(?:_[a-z])?\.[a-zA-Z0-9]*).*$/, "$1");
			if (newsrc.match(/\/[0-9]+_[0-9a-f]+_o\.[a-z]+.*$/)) {
				obj = {
					url: src,
					is_original: true
				};

				if (options.force_page) {
					common_functions["flickr_find_api_info"](options, api_cache, function(info) {
						if (!info) {
							return options.cb(obj);
						}

						find_image_obj(info, newsrc, function(newobj) {
							options.cb(newobj || obj);
						}, obj);
					});

					return {
						waiting: true
					};
				} else {
					return obj;
				}
			}

			var find_larger_image = function(info, src, cb) {
				var photoinfo = find_photoid_secret_from_url(src);
				var photoid = photoinfo.id;

				var cache_key = "flickr_larger:" + photoid;
				api_cache.fetch(cache_key, cb, function(done) {
					common_functions["flickr_api_request"](options, info, "method=flickr.photos.getSizes&photo_id=" + photoid, function (out) {
						if (!out)
							return done(null, false);

						var largesturl = null;
						var largestsize = 0;
						var is_video = false;
						array_foreach(out.sizes.size, function(size) {
							var currentsize = parseInt(size.width) * parseInt(size.height);
							if (currentsize > largestsize || size.label === "Original") {
								largestsize = currentsize;
								largesturl = size.source;
							}

							if (size.media === "video") {
								is_video = true;
							}
						});

						if (typeof largesturl === "string" && /^https?:\/\//.test(largesturl)) {
							// Set this to 10 minutes as maybe the person might enable original images later?
							// FIXME: should we even cache this?
							done({
								url: largesturl,
								has_video: is_video
							}, 10 * 60);
						} else {
							done(null, false);
						}
					});
				});
			}

			common_functions["flickr_find_api_info"](options, api_cache, function(info) {
				if (!info) {
					return options.cb(null);
				}

				find_larger_image(info, src, function(largest_data) {
					if (!largest_data) {
						return options.cb(null);
					}

					var baseobj = {};
					var urls = [largest_data.url];

					var final_cb = function(photoinfo) {
						if (photoinfo && largest_data.has_video) {
							find_video_info(info, photoinfo, function(video_data) {
								if (video_data) {
									var largest_video_url = find_largest_video(video_data);
									if (largest_video_url) {
										if (largest_video_url.replace(/[?#].*/, "") === src.replace(/[?#].*/, "")) {
											largest_video_url = src;
										}

										urls.unshift({
											url: largest_video_url,
											video: true
										});
									}
								}

								return options.cb(fillobj_urls(urls, baseobj));
							});
						} else {
							return options.cb(fillobj_urls(urls, baseobj));
						}
					};

					if (largest_data.has_video) {
						find_image_info(info, newsrc, function(info) {
							if (info) {
								baseobj = {
									extra: get_obj_from_image_info(info)
								};
							}

							final_cb(info);
						});
					} else if (options.force_page) {
						find_image_obj(info, newsrc, function(obj) {
							if (obj)
								baseobj = obj;

							final_cb();
						});
					} else {
						final_cb();
					}
				});
			});

			return {
				waiting: true
			};
		}

		if (domain === "flimg.flickr.com") {
			// https://flimg.flickr.com/?url=https%3A%2F%2Ffarm1.staticflickr.com%2F580%2F23423118816_76de25b5d4_t.jpg&h=2f84d86ed4f17c3791d5fcadcb34c3f3bcf01298055f0d4320eae8fe2a7d642c
			//   https://live.staticflickr.com/580/23423118816_065118f0c2_o.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+\?(?:.*&)?url=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (host_domain_nosub === "flickr.com" && options.element) {
			// new website design sets img to have pointer-events: none
			// thanks to radam9 on github for reporting: https://github.com/qsniyg/maxurl/issues/1052
			if (options.element.tagName === "DIV") {
				let imgel = options.element.querySelector("img.main-photo");
				if (imgel)
					return imgel.src;
			}

			if (!src) {
				if (options.element.classList.contains("spaceball")) {
					return {
						url: origsrc,
						bad: "mask"
					};
				}
			} else if (string_indexof(src, "staticflickr.com/") < 0) {
				// https://www.flickr.com/photos/30574959@N08/5194905477/
				var current = options.element;
				while ((current = current.parentElement)) {
					if (current.tagName === "DIV" && current.classList.contains("restricted-interstitial")) {
						var meta_image = document.head.querySelector("meta[property=\"og:image\"]");
						if (meta_image) {
							return meta_image.content;
						}
					}
				}
			}
		}

		if (domain_nowww === "flickr.com") {
			var paginate = function(query, cb, token, arr) {
				if (!arr)
					arr = [];

				query(token, function(data, nexttoken) {
					if (data)
						array_extend(arr, data);

					if (nexttoken) {
						// todo: stackoverflow_guard
						paginate(query, cb, nexttoken, arr);
					} else {
						cb(arr);
					}
				});
			};

			var get_album_photos = function(info, albumid, cb) {
				var queries = {
					per_page: 200,
					page: 1,
					extras: "can_addmeta,can_comment,can_download,can_print,can_share,contact,count_comments,count_faves,count_views,date_taken,date_upload,description,icon_urls_deep,isfavorite,ispro,license,media,needs_interstitial,owner_name,owner_datecreate,path_alias,perm_print,realname,rotation,safety_level,secret_k,secret_h,url_sq,url_q,url_t,url_s,url_n,url_w,url_m,url_z,url_c,url_l,url_h,url_k,url_3k,url_4k,url_f,url_5k,url_6k,url_o,visibility,visibility_source,o_dims,publiceditability,system_moderation",
					photoset_id: albumid,
					method: "flickr.photosets.getPhotos"
				};

				var getpage = function(page, cb) {
					if (!page)
						page = 1;

					console_log("Querying", page);
					queries.page = page;
					common_functions["flickr_api_request"](options, info, stringify_queries(queries), function(data) {
						if (!data)
							return cb(null);

						var photoset = data.photoset;
						var photos = photoset.photo;
						var objs = [];
						array_foreach(photos, function(photo) {
							var obj = common_functions["flickr_info_to_obj"](photo);
							if (!obj)
								return;

							api_cache.set("flickr_image_obj:" + photo.id, obj);

							objs.push(obj);
						});

						var current_page = parseInt(photoset.page);
						var total_pages = parseInt(photoset.pages);

						var next_page = current_page < total_pages ? current_page + 1 : null;

						cb(objs, next_page);
					});
				};

				api_cache.fetch("flickr_album:" + albumid, cb, function(done) {
					paginate(getpage, function(data) {
						if (!data || !data.length)
							done(null, false);

						done(data, 60*60);
					});
				});
			};

			// thanks to anonymous for reporting:
			// https://www.flickr.com/photos/129337299@N04/19021845639/sizes/h/
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+photos\/+[^/]+\/+([0-9]+)(?:\/+(?:(?:in|sizes)\/+.*)?)?(?:[?#].*)?$/,
				run: function(cb, match) {
					var id = match[1];
					return cb("https://live.staticflickr.com/0000/" + id + "_face_b.jpg");
				}
			});
			if (newsrc) return newsrc;

			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+photos\/+[^/]+\/+albums\/+([0-9]+)(?:[?#].*)?$/,
				run: function(cb, match) {
					var id = match[1];
					common_functions["flickr_find_api_info"](options, api_cache, function(info) {
						get_album_photos(info, id, function(objs) {
							if (!objs || !objs.length)
								return cb(null);

							var links = [];
							array_foreach(objs, function(obj, i) {
								links.push({
									url: obj.url,
									is_current: i === 0
								});
							});

							objs[0].album_info = {
								type: "links",
								links: links
							};

							cb(objs[0]);
						});
					});
				}
			});
			if (newsrc) return newsrc;
		}

		// http://galleryproject.org/
		if (domain === "www.imagozone.com" ||
			// http://www.imagozone.ro/var/thumbs/vedete/Victoria%20Justice/2010/Victoria%20Justice%2001.jpg?m=1312910214
			//   http://www.imagozone.ro/var/albums/vedete/Victoria%20Justice/2010/Victoria%20Justice%2001.jpg?m=1312910214
			domain_nowww === "imagozone.ro" ||
			// http://ohsohumorous.com/var/thumbs/Cosplay-Memes/cosplay8-16.jpg?m=1525371835
			//   http://ohsohumorous.com/var/albums/Cosplay-Memes/cosplay8-16.jpg?m=1525371835
			domain_nowww === "ohsohumorous.com" ||
			// http://www.travelseyahat.com/var/thumbs/Saudi-Arabia/Makkah%20Kaaba.jpg?m=1384894761
			//   http://www.travelseyahat.com/var/albums/Saudi-Arabia/Makkah%20Kaaba.jpg?m=1384894761
			domain_nowww === "travelseyahat.com" ||
			// http://www.carphotoshow.com/var/thumbs/Ford/Ford-F150-Powertrain-Lineup/Ford%20F150%20Powertrain%20Lineup.jpg?m=1311929207
			//   http://www.carphotoshow.com/var/albums/Ford/Ford-F150-Powertrain-Lineup/Ford%20F150%20Powertrain%20Lineup.jpg?m=1311929207
			domain_nowww === "carphotoshow.com" ||
			// http://www.crnobelo.com/gallery3/var/thumbs/slavni-licnosti/rihanna-vo-cuden-outfit/rihanna_outfit_25.jpg
			//   http://www.crnobelo.com/gallery3/var/resizes/slavni-licnosti/rihanna-vo-cuden-outfit/rihanna_outfit_25.jpg
			//   http://www.crnobelo.com/gallery3/var/albums/slavni-licnosti/rihanna-vo-cuden-outfit/rihanna_outfit_25.jpg -- 503
			domain_nowww === "crnobelo.com" ||
			// https://myhentaicomics.com/var/thumbs/Corrupted%20Data/002.jpg?m=1579643210
			domain_nowww === "myhentaicomics.com" ||
			// https://komodogirls.com/var/thumbs/Pacific_Girls/475%20Hitomi/hitomi-003.jpg?m=1585801632
			//   https://komodogirls.com/var/albums/Pacific_Girls/475%20Hitomi/hitomi-003.jpg?m=1585801632
			domain_nowww === "komodogirls.com" ||
			// http://www.celebritiestown.com/celebritypictures/var/resizes/Celebrity-Street-Style/Jessica-Alba-Best-Street-Style-09.jpg?m=1450092223
			//   http://www.celebritiestown.com/celebritypictures/var/albums/Celebrity-Street-Style/Jessica-Alba-Best-Street-Style-09.jpg?m=1450092223
			domain_nowww === "celebritiestown.com") {
			// https://myhentaicomics.com/modules/hover_navigation/images/photonav_prev.png
			if (/\/modules\/+hover_navigation\/+images\//.test(src))
				return {
					url: src,
					bad: "mask"
				};

			// http://www.imagozone.com/var/resizes/vedete/Victoria%20Justice/Victoria%20Justice%203012.jpg
			//   http://www.imagozone.com/var/albums/vedete/Victoria%20Justice/Victoria%20Justice%203012.jpg
			// http://www.imagozone.com/var/thumbs/vedete/Amber%20Heard/Amber%20Heard%20005.jpg?m=1312958883
			//   http://www.imagozone.com/var/albums/vedete/Amber%20Heard/Amber%20Heard%20005.jpg?m=1312958883
			// doesn't work:
			// http://www.imagozone.com/var/thumbs/vedete/Amber%20Heard/2007/.album.jpg?m=1312542209
			if (!src.match(/\/\.album\.[^/.]*$/)) {
				newsrc = src.replace(/(\/var\/+thumbs\/)/, "/var/resizes/");
				if (newsrc !== src)
					return newsrc;

				return src.replace(/\/var\/(?:resizes|thumbs)\//, "/var/albums/");
			}
		}

		// gallery v1
		if (domain_nowww === "bjwinslow.com") {
			// http://www.bjwinslow.com/albums/liz-katz/zombie_stocks_7.sized.jpg
			//   http://www.bjwinslow.com/albums/liz-katz/zombie_stocks_7.jpg
			return src.replace(/(\/albums\/.*)\.sized(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nosub === "tunes.zone") {
			// http://ru.tunes.zone/poster/person/230x230/29/22/72/0/292272-fotografii-iz-victoria-justice.jpg
			//   http://tunes.zone/poster/person/full/29/22/72/0/292272-fotografii-iz-victoria-justice.jpg
			// http://ru.tunes.zone/poster/banner/400x250o/15/84/57/9/1584579/19572-spider-man-homecoming.jpg
			// doesn't work for all:
			// http://ru.tunes.zone/poster/person/100x100/29/22/68/0/292268-fotografii-iz-victoria-justice-4.jpg
			//   http://ru.tunes.zone/poster/person/full/29/22/68/0/292268-fotografii-iz-4.jpg
			// http://tunes.zone/poster/person/100x100/57/48/0/0/5748-photos-with-galia-albin-1.jpg
			//   http://tunes.zone/poster/person/full/57/48/0/0/5748-photos-with-1.jpg
			// http://es.tunes.zone/poster/person/full/33/52/63/0/335263-las-fotografias-de-2.jpg
			// http://jp.tunes.zone/poster/person/100x100/29/56/29/0/295629--maisie-richardson-sellers-14.jpg
			//   http://jp.tunes.zone/poster/person/full/29/56/29/0/295629--14.jpg
			// http://jp.tunes.zone/poster/person/230x230/29/56/18/0/295618--maisie-richardson-sellers.jpg
			//   http://jp.tunes.zone/poster/person/full/29/56/18/0/295618--maisie-richardson-sellers.jpg
			var basic = src.replace(/\/[0-9]+x[0-9]+[a-z]?\//, "/full/");
			if (basic !== src) {
				var other = basic.replace(/-[a-z]+-[a-z]+(-[0-9]+)?(\.[^/.]*)$/, "$1$2");
				var other1 = basic.replace(/(\/[0-9]+-+)[^/]*-([0-9]+\.[^/.]*)$/, "$1$2");
				if (basic.match(/\/[0-9]+--/))
					return [other1, basic, other];
				else if (basic.match(/-[0-9]+\.[^/.]*$/))
					return [other, basic, other1];
				else
					return [basic, other, other1];
			}
		}

		if (domain === "sf.co.ua") {
			// http://sf.co.ua/16/12/tn-4358.jpg
			//   http://sf.co.ua/16/12/wallpaper-4358.jpg
			return src.replace(/\/tn-([0-9]*\.[^/.]*)/, "/wallpaper-$1");
		}

		if (domain_nosub === "zerochan.net" && domain.match(/^s[^.]*.zerochan.net/)) {
			// https://s3.zerochan.net/IA.240.878867.jpg
			//   https://static.zerochan.net/IA.240.878867.jpg
			//   https://static.zerochan.net/IA.full.878867.jpg
			// https://static.zerochan.net/Kirigaya.Kazuto.600.1450176.jpg
			//   https://static.zerochan.net/Kirigaya.Kazuto.full.1450176.jpg
			// thanks to Froktime on github: https://github.com/qsniyg/maxurl/issues/1341
			// https://s1.zerochan.net/Berusaiyu.no.Bara.600.3749354.jpg
			//   https://static.zerochan.net/Berusaiyu.no.Bara.full.3749354.png

			obj = {
				url: src
			};

			id = src.match(/:\/\/[^/]+\/+(?:[^/]*\.[^/.]+\.([0-9]+)|[^/]+\/+(?:[0-9]+\/+){2}([0-9]+))\.[^/.]+(?:[?#].*)?$/);
			if (id) {
				obj.extra = {page: "https://www.zerochan.net/" + (id[1] || id[2])};
			}

			obj.url = src
				.replace(/:\/\/s[^.]*.zerochan.net\//, "://static.zerochan.net/")
				.replace(/(:\/\/[^/]*\/[^/]*\.)[0-9]+(\.[0-9]+\.[^/.]*)$/, "$1full$2")
				// https://static.zerochan.net/240/21/19/413471.jpg
				//   https://static.zerochan.net/full/21/19/413471.jpg
				.replace(/(:\/\/[^/]+\/+)[0-9]+\/+([0-9]+\/+[0-9]+\/+[0-9]+\.)/, "$1full/$2");

			if (obj.url !== src) {
				return fillobj_urls(add_extensions(obj.url), obj);
			}

			return obj;
		}

		if (domain === "cdn.aibooru.download") {
			// thanks to anonymous for reporting:
			// https://cdn.aibooru.download/180x180/ab/7f/ab7fa15dd719c9a5c91c2949a8a8e269.jpg
			//   https://cdn.aibooru.download/preview/ab/7f/ab7fa15dd719c9a5c91c2949a8a8e269.jpg
			//   https://cdn.aibooru.download/sample/ab/7f/__a__sample-ab7fa15dd719c9a5c91c2949a8a8e269.jpg
			//   https://cdn.aibooru.download/sample/ab/7f/__original_generated_by_ocean3__sample-ab7fa15dd719c9a5c91c2949a8a8e269.jpg
			//   https://cdn.aibooru.download/original/ab/7f/__original_generated_by_ocean3__ab7fa15dd719c9a5c91c2949a8a8e269.png
			newsrc = src.replace(/(:\/\/[^/]+\/+)(?:preview|[0-9]+x[0-9]+)\/+((?:[a-f0-9]{2}\/+){2})/, "$1sample/$2__a__sample-")
			if (newsrc !== src)
				return newsrc;

			newsrc = src.replace(/(:\/\/[^/]+\/+)sample\/+((?:[a-f0-9]{2}\/+){2}__[^/]+?__)sample-/, "$1original/$2");
			if (newsrc !== src)
				return add_extensions(newsrc);
		}

		if (domain === "cdn.donmai.us") {
			// thanks to nadomodan on github: https://github.com/qsniyg/maxurl/issues/304
			// https://cdn.donmai.us/preview/5e/c1/5ec172460e1f8cf0dff7219c2ba52f4c.jpg
			//   https://hijiribe.donmai.us/data/5ec172460e1f8cf0dff7219c2ba52f4c.png
			// thanks to NightSky on discord:
			// https://cdn.donmai.us/sample/b1/cf/__original_drawn_by_nekodosaiun__sample-b1cf707ece29a0f0f5f0529e9c48b3a1.jpg
			//   https://cdn.donmai.us/original/b1/cf/b1cf707ece29a0f0f5f0529e9c48b3a1.jpg
			// thanks to aslian on github: https://github.com/qsniyg/maxurl/issues/1040
			// https://cdn.donmai.us/sample/0b/32/sample-0b325822cc92a57e28303acf91a557ca.jpg
			//   https://cdn.donmai.us/original/0b/32/0b325822cc92a57e28303acf91a557ca.jpg
			// thanks to aslian on github for reporting: https://github.com/qsniyg/maxurl/issues/1040#issuecomment-1270358276
			// https://cdn.donmai.us/180x180/f1/e5/f1e50b6d687e2ec107e014248349d1ae.jpg
			//   https://cdn.donmai.us/original/f1/e5/f1e50b6d687e2ec107e014248349d1ae.png
			newsrc = src.replace(/^([a-z]+:\/\/[^/]+\/+)[0-9]+x[0-9]+\/+/, "$1preview/");
			if (newsrc !== src)
				return newsrc;

			return src.replace(/^[a-z]+:\/\/[^/]+\/+(preview|sample)\/+(?:[0-9a-f]{2}\/+){2}((?:(?:[^/]+__)?sample-)?[0-9a-f]{10,}\.[^/.]+)(?:[?#].*)?$/, "https://danbooru.donmai.us/data/$1/$2");
		}

		if (domain_nosub === "donmai.us") {
			// https://hijiribe.donmai.us/data/sample/__nishimori_yusa_otosaka_ayumi_and_tomori_nao_charlotte_anime_and_newtype_drawn_by_higashiji_kazuki_inoue_katsue_kato_chie_satou_youko_sekiguchi_kanami_and_sugawara_mika__sample-5bae8d2a395e9b9b9f9f803a8c3eb4b1.jpg
			//   https://hijiribe.donmai.us/data/__nishimori_yusa_otosaka_ayumi_and_tomori_nao_charlotte_anime_and_newtype_drawn_by_higashiji_kazuki_inoue_katsue_kato_chie_satou_youko_sekiguchi_kanami_and_sugawara_mika__5bae8d2a395e9b9b9f9f803a8c3eb4b1.jpg
			// https://danbooru.donmai.us/data/preview/3f22b81d5d80e06bdb3f6e157f66ed00.jpg
			//   https://danbooru.donmai.us/data/__original__3f22b81d5d80e06bdb3f6e157f66ed00.jpg
			//   https://hijiribe.donmai.us/data/3f22b81d5d80e06bdb3f6e157f66ed00.jpg
			// https://hijiribe.donmai.us/data/sample/sample-1585a3ea7ca3c467b7631ce59850b2af.jpg
			//   https://hijiribe.donmai.us/data/1585a3ea7ca3c467b7631ce59850b2af.jpg
			// https://danbooru.donmai.us/data/preview/1585a3ea7ca3c467b7631ce59850b2af.jpg
			//   https://danbooru.donmai.us/data/__original__1585a3ea7ca3c467b7631ce59850b2af.jpg -- doesn't work
			//   https://hijiribe.donmai.us/data/1585a3ea7ca3c467b7631ce59850b2af.jpg
			// https://danbooru.donmai.us/data/preview/3ef47b49bd09e97a009eac8465b662f0.jpg
			//   https://hijiribe.donmai.us/data/3ef47b49bd09e97a009eac8465b662f0.png
			// thanks to dungeon_addiction on reddit for reporting:
			// https://danbooru.donmai.us/data/sample/4f/96/__original_drawn_by_jiumudao__sample-4f96cfc1ccc21854d49369409e7aa15c.jpg
			//   https://danbooru.donmai.us/data/4f/96/__original_drawn_by_jiumudao__4f96cfc1ccc21854d49369409e7aa15c.png
			//   https://danbooru.donmai.us/data/original/4f/96/__original_drawn_by_jiumudao__4f96cfc1ccc21854d49369409e7aa15c.png
			newsrc = src
				.replace(/\/data\/+((?:[0-9a-f]{2}\/+){2}__original)/, "/data/original/$1")
				.replace(/\/data\/sample\/((?:(?:[0-9a-f]{2}\/+){2})?[^/]*__)?sample-([0-9a-f]*\.[^/.]*)$/, "/data/$1$2")
				.replace(/:\/\/danbooru\.donmai\.us\/data\/preview\//, "://hijiribe.donmai.us/data/")
				// the text doesn't matter, as long as it's __[a-z_]+__
				.replace(/\/data\/preview\/([^/]*)$/, "/data/__original__$1");

			if (newsrc !== src)
				return add_extensions_gif(newsrc);
		}

		if (domain === "yukkuri.shii.org") {
			// https://yukkuri.shii.org/data/preview/c5a91701bceedfe76b6090d6a54db244.jpg
			//   https://yukkuri.shii.org/data/sample/sample-c5a91701bceedfe76b6090d6a54db244.jpg
			//   https://yukkuri.shii.org/data/c5a91701bceedfe76b6090d6a54db244.png
			newsrc = src.replace(/\/data\/+(?:preview|sample)\/+(?:sample-)?([0-9a-f]{20,}\.[^/.]*)(?:[?#].*)?$/, "/data/$1");
			if (newsrc !== src) {
				return add_extensions(newsrc);
			}
		}

		if ((domain_nosub === "e621.net" && /^static[0-9]*\./.test(domain)) ||
			// http://behoimi.org/data/preview/ee/b0/eeb0a41dc90c7861d5ca0fb200e06847.jpg
			//   http://behoimi.org/data/ee/b0/eeb0a41dc90c7861d5ca0fb200e06847.jpg
			domain_nowww === "behoimi.org") {
			// https://static1.e621.net/data/preview/5b/77/5b775b9fbcff339ce15fef7b85b1f9b9.jpg
			//   https://static1.e621.net/data/5b/77/5b775b9fbcff339ce15fef7b85b1f9b9.png
			// https://static1.e621.net/data/sample/de/b8/deb8350027c2edb949486319c1f78256.jpg
			//   https://static1.e621.net/data/de/b8/deb8350027c2edb949486319c1f78256.png
			newsrc = src.replace(/(:\/\/[^/]+\/+data\/+)(?:preview|sample)\/+([0-9a-f]{2}\/+)/, "$1$2");
			if (newsrc !== src) {
				return add_extensions(newsrc);
			}
		}

		if (domain_nowww === "hypnohub.net") {
			// http://hypnohub.net//data/preview/ce4154eb5de93edeae9389e5e1c5a31e.jpg
			//   http://hypnohub.net//data/sample/ce4154eb5de93edeae9389e5e1c5a31e.jpg
			//   http://hypnohub.net//data/image/ce4154eb5de93edeae9389e5e1c5a31e.jpg
			newsrc = src.replace(/\/data\/+(?:preview|sample)\/+([0-9a-f]{20,}\.[^/.]*)(?:[?#].*)?$/, "/data/image/$1");
			if (newsrc !== src) {
				return add_extensions(newsrc);
			}
		}

		if (domain === "files.yande.re") {
			// https://files.yande.re/sample/c3e3fd1d97b4e237e996e6b1bfafa4e6/yande.re%20190111%20sample%20anime_tenchou%20anizawa_meito%20cosplay%20hiiragi_kagami%20izumi_konata%20kusakabe_misao%20lucky_star%20seifuku%20sword%20takara_miyuki%20thighhighs%20vocaloid.jpg
			//   https://files.yande.re/image/c3e3fd1d97b4e237e996e6b1bfafa4e6/yande.re%20190111%20anime_tenchou%20anizawa_meito%20cosplay%20hiiragi_kagami%20izumi_konata%20kusakabe_misao%20lucky_star%20seifuku%20sword%20takara_miyuki%20thighhighs%20vocaloid.jpg
			// thanks to Logidy on greasyfork for reporting the issue below: https://greasyfork.org/en/forum/discussion/53007/x?locale=en
			// https://files.yande.re/jpeg/fe3070fd3aa5a017397cd0d3b2163448/yande.re%20519701%20cleavage%20clyde_s%20girls_frontline%20kalina_%28girls_frontline%29%20megane%20no_bra%20open_shirt%20seifuku%20thighhighs%20weapon.jpg
			//   https://files.yande.re/image/fe3070fd3aa5a017397cd0d3b2163448/yande.re%20519701%20cleavage%20clyde_s%20girls_frontline%20kalina_%28girls_frontline%29%20megane%20no_bra%20open_shirt%20seifuku%20thighhighs%20weapon.png
			return add_extensions(src
								  .replace(/\/(?:sample|jpeg)\/+([0-9a-f]+\/)/, "/image/$1"));
		}

		if (domain === "assets.yande.re") {
			// https://assets.yande.re/data/preview/5c/0d/5c0dce008b820e531309e54a17c83f3a.jpg
			//   https://files.yande.re/image/5c0dce008b820e531309e54a17c83f3a.jpg
			// https://assets.yande.re/data/preview/1f/c5/1fc58ed6d37b0392b8881de9507d0a65.jpg
			//   https://files.yande.re/image/1fc58ed6d37b0392b8881de9507d0a65.png
			return add_extensions(src.replace(/:\/\/assets.yande.re\/data\/preview\/[0-9a-f]+\/[0-9a-f]+\//, "://files.yande.re/image/"));
		}

		/*if (false && domain_nowww === "konachan.net") {
			// https://konachan.net/data/preview/e1/29/e12943f0e1591d2d0b0a29581d92c81b.jpg
			//   https://konachan.net/jpeg/e12943f0e1591d2d0b0a29581d92c81b.jpg
			// https://konachan.net/data/preview/98/6d/986d22d11cb6963ab1fc0dbcda942ea7.jpg
			//   https://konachan.net/image/986d22d11cb6963ab1fc0dbcda942ea7.jpg
			regex = /\/data\/preview\/[0-9a-f]{2}\/[0-9a-f]{2}\/([0-9a-f]+\.[^/.]*)$/;
			return [src.replace(regex, "/jpeg/$1"),
					src.replace(regex, "/image/$1")];
		}*/

		if (domain_nowww === "konachan.com" ||
			domain_nowww === "konachan.net") {
			// https://konachan.com/data/preview/33/fe/33fe5a47e2274171d02f7bb8347b9ab9.jpg
			//   https://konachan.com/sample/33fe5a47e2274171d02f7bb8347b9ab9.jpg
			//   https://konachan.com/image/33fe5a47e2274171d02f7bb8347b9ab9.png
			//   https://konachan.com/sample/33fe5a47e2274171d02f7bb8347b9ab9/Konachan.com%20-%20129575%20sample.jpg?0.7594912488960968
			//   https://konachan.com/image/33fe5a47e2274171d02f7bb8347b9ab9/Konachan.com%20-%20129575%20sample.png?0.7594912488960968
			// https://konachan.net/data/preview/e1/29/e12943f0e1591d2d0b0a29581d92c81b.jpg
			//   https://konachan.net/jpeg/e12943f0e1591d2d0b0a29581d92c81b.jpg
			//   https://konachan.net/image/e12943f0e1591d2d0b0a29581d92c81b.png
			// https://konachan.net/data/preview/98/6d/986d22d11cb6963ab1fc0dbcda942ea7.jpg
			//   https://konachan.net/image/986d22d11cb6963ab1fc0dbcda942ea7.jpg
			//   https://konachan.net/image/986d22d11cb6963ab1fc0dbcda942ea7.jpg
			// https://konachan.com/sample/839253fb3f1f63f92cb768b2a6672b48/Konachan.com%20-%20255145%20sample.jpg
			//   https://konachan.com/image/839253fb3f1f63f92cb768b2a6672b48.png
			newsrc = src.replace(/(?:\/data\/preview\/[0-9a-f]+\/[0-9a-f]+\/|\/(?:sample|jpeg)\/)([0-9a-f]+)(\/[^/]*)?(\.[^/.?]*)(?:[?#]*)?$/, "/image/$1$3");
			if (newsrc !== src)
				return add_full_extensions(newsrc);

			return {
				url: src,
				headers: {
					Referer: "https://konachan.com/post"
				}
			};
		}

		if (domain_nowww === "gelbooru.me") {
			// https://gelbooru.me/cdnimg1/thumbnails/0a/52/thumbnail_0a52177e255e054abffd59b20620e964.jpg
			//   https://img1.gelbooru.com/thumbnails/0a/52/thumbnail_0a52177e255e054abffd59b20620e964.jpg
			return src.replace(/^[a-z]+:\/\/[^/]+\/+cdn(img[0-9]+)\/+/, "https://$1.gelbooru.com/");
		}

		if (domain_nowww === "gelbooru.com") {
			// https://gelbooru.com/thumbnails/56/24/thumbnail_562420ec66ff68dd8e31a8f651283e0d.jpg
			//   https://img2.gelbooru.com/thumbnails/56/24/thumbnail_562420ec66ff68dd8e31a8f651283e0d.jpg
			return src.replace(/:\/\/[^/]*\/thumbnails\//, "://img2.gelbooru.com/thumbnails/");
		}

		if (domain_nosub === "gelbooru.com" && /^s?img[0-9]*\./.test(domain)) {
			// https://simg3.gelbooru.com/thumbnails/ce/b8/thumbnail_ceb852df49b45c7c595eea61951b9ffb.jpg
			//   https://simg3.gelbooru.com/images/ce/b8/ceb852df49b45c7c595eea61951b9ffb.jpg
			// https://img2.gelbooru.com//samples/56/24/sample_562420ec66ff68dd8e31a8f651283e0d.jpg
			//   https://img2.gelbooru.com//images/56/24/562420ec66ff68dd8e31a8f651283e0d.jpg
			// thanks to anonymous for reporting:
			// https://img3.gelbooru.com/thumbnails//ef/49/thumbnail_ef497630135d33712123465e716fc638.jpg
			//   https://img3.gelbooru.com/images/ef/49/ef497630135d33712123465e716fc638.jpg
			// no referer is needed: http://www.reddit.com/r/traphentai/comments/fv608m/punish_the_king_of_the_fairies/fmgsi1d/?context=3
			obj = {
				url: src,
				can_head: false,
				imu_mode: "image",
				headers: {
					Referer: "https://www." + domain_nosub + "/"
				}
			};

			newsrc = src.replace(/\/+thumbnails\/+([0-9a-f]+\/[0-9a-f]+\/)thumbnail_/, "/images/$1")
						.replace(/\/+samples\/+([0-9a-f]+\/[0-9a-f]+\/)sample_/, "/images/$1");
			if (newsrc !== src) {
				return fillobj_urls(add_full_extensions(newsrc), obj);
			}
		}

		if (domain === "cali.rule34.xxx") {
			return src.replace(/^[a-z]+:\/\/[^/]+\/+/, "https://us.rule34.xxx/");
		}

		if (domain_nowww === "safebooru.org" ||
			// https://tbib.org/thumbnails/6318/thumbnail_bc6c3a6300b51966c444c1de7c882c9fe9d0e853.jpg?6830612
			//   https://tbib.org/images/6318/bc6c3a6300b51966c444c1de7c882c9fe9d0e853.png?6830612
			// https://tbib.org//samples/6401/sample_c4c751ed72f749616d5a15a5d17e7a243961ca3f.jpg?6914345 -- 850x1183
			//   https://tbib.org//images/6401/c4c751ed72f749616d5a15a5d17e7a243961ca3f.jpg?6914345 -- 2920x4065
			domain_nowww === "tbib.org" ||
			// https://img.xbooru.com/thumbnails/274/thumbnail_2b2c848fa3ee71d81a165b3809ec0169.jpg?767855
			//   https://img.xbooru.com/images/274/2b2c848fa3ee71d81a165b3809ec0169.jpeg?767855
			domain === "img.xbooru.com" ||
			// https://img.booru.org/size/thumbnails/6/thumbnail_72aeab428988ee126e8d47d5f4b2b310f85dfb00.jpg?5456
			//   https://img.booru.org/size/images/6/72aeab428988ee126e8d47d5f4b2b310f85dfb00.jpg?5456
			// https://img.booru.org/thh/thumbnails//100/thumbnail_c450ceb12ae9903b650e2bb8cf08fbb14536d4da.jpg
			//   https://img.booru.org/thh/images//100/c450ceb12ae9903b650e2bb8cf08fbb14536d4da.jpg
			domain === "img.booru.org" ||
			// https://us.rule34.xxx/thumbnails/3196/thumbnail_a969ee2e75d0165716df8e68357a775d.jpg?3590878
			//   https://us.rule34.xxx/images/3196/a969ee2e75d0165716df8e68357a775d.jpeg
			domain_nosub === "rule34.xxx" ||
			// https://realbooru.com/thumbnails/512/thumbnail_73f1ecc9ae212fa6be7e45d30aae769bfa5376c0.jpg?513812
			//   https://realbooru.com/images/512/73f1ecc9ae212fa6be7e45d30aae769bfa5376c0.jpg?513812
			// thanks to vscum on github: https://github.com/qsniyg/maxurl/pull/1121
			// https://realbooru.com/thumbnails/af/79/thumbnail_af79ae1a86d827e39d324cc3808b78e2.jpg
			//   https://realbooru.com/images/af/79/af79ae1a86d827e39d324cc3808b78e2.jpeg
			// https://realbooru.com/thumbnails/d9/c2/thumbnail_d9c260941bba9fcaf852360852398d89.jpg
			//   https://realbooru.com/images/d9/c2/d9c260941bba9fcaf852360852398d89.jpeg
			domain_nowww === "realbooru.com") {
			// http://safebooru.org/thumbnails/2473/thumbnail_6cf1f0d716b67c369ffe6310219a595f.jpeg?2574463
			//   http://safebooru.org//images/2473/6cf1f0d716b67c369ffe6310219a595f.jpeg?2574463
			// http://safebooru.org//samples/1293/sample_661a213e5b86a59e86ebfb58ab60b137d4518731.png?1346716
			//   http://safebooru.org//images/1293/661a213e5b86a59e86ebfb58ab60b137d4518731.png?1346716
			newsrc = src.replace(/\/(?:thumbnails|samples|images)(\/+(?:[0-9a-f]+\/+)?[0-9a-f]+\/+)(?:(?:thumbnail|sample)_)?([0-9a-f]+\.[^/.]*)$/, "/images$1$2");
			if (/\/images\/+(?:[0-9a-f]+\/+)?[0-9a-f]+\/[0-9a-f]+\./.test(newsrc))
				return add_full_extensions(newsrc,
					[
						"mp4", "MP4", "jpg", "jpeg", "png", "gif", "webp",
						"JPG", "JPEG", "PNG", "GIF"
					], true);
		}

		if (domain === "thumbs.booru.org") {
			// https://thumbs.booru.org/thh/thumbnails//100/thumbnail_c450ceb12ae9903b650e2bb8cf08fbb14536d4da.jpg
			//   https://img.booru.org/thh/thumbnails//100/thumbnail_c450ceb12ae9903b650e2bb8cf08fbb14536d4da.jpg
			return src.replace(/:\/\/[^/]*\//, "://img.booru.org/");
		}

		if (domain_nosub === "booru.org" && domain !== "img.booru.org") {
			// https://size.booru.org/thumbnails/6/thumbnail_72aeab428988ee126e8d47d5f4b2b310f85dfb00.jpg?5456
			//   https://img.booru.org/size/thumbnails/6/thumbnail_72aeab428988ee126e8d47d5f4b2b310f85dfb00.jpg?5456
			return src.replace(/:\/\/([^/]*)\.booru\.org\/thumbnails\/+/, "://img.booru.org/$1/thumbnails/");
		}

		if (domain === "cdn.aibooru.online") {
			// https://cdn.aibooru.online/180x180/c0/ef/c0ef3e4dd2b641ecb295a08885e83f63.jpg
			//   https://cdn.aibooru.online/original/c0/ef/c0ef3e4dd2b641ecb295a08885e83f63.png
			newsrc = src.replace(/(:\/\/[^/]+\/+)[0-9]+x[0-9]+\/+/, "$1original/");
			if (newsrc !== src)
				return add_full_extensions(newsrc, ["mp4", "gif", "png", "jpg"], true);
		}

		if (domain === "cdn.vor.us") {
			// https://cdn.vor.us/event/350763/thumbsm/458aa4c3a2c74b409282dd83a36cbf25.image!jpeg.9752676.jpg._Z5J5526.jpg
			//   https://cdn.vor.us/event/350763/og/458aa4c3a2c74b409282dd83a36cbf25.image!jpeg.9752676.jpg._Z5J5526.jpg
			// https://cdn.vor.us/event/350763/thumbsm/0aa7913a692d4f97b1a549660eb80eba.image!jpeg.16170343.jpg._Z5J4082.jpg
			//   https://cdn.vor.us/event/350763/og/0aa7913a692d4f97b1a549660eb80eba.image!jpeg.16170343.jpg._Z5J4082.jpg
			return src.replace(/\/thumbs[a-z]?\//, "/og/");
		}

		if (domain === "wallpapers.wallhaven.cc" ||
			// https://alpha.wallhaven.cc/wallpapers/thumb/small/th-527922.jpg
			//   https://alpha.wallhaven.cc/wallpapers/full/wallhaven-527922.jpg
			domain === "alpha.wallhaven.cc") {
			// https://wallpapers.wallhaven.cc/wallpapers/thumb/small/th-68352.jpg
			//   https://wallpapers.wallhaven.cc/wallpapers/full/wallhaven-68352.jpg
			return src.replace(/\/thumb\/[^/]*\/th-/, "/full/wallhaven-");
		}

		if (domain === "static.wallhaven.cc") {
			// https://static.wallhaven.cc/images/layout/bg-dark-grain.png
			if (/\/images\/+layout\/+bg-/.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}
		}

		if (domain_nowww === "wallhaven.cc") {
			// https://wallhaven.cc/w/pk2mke
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+w\/+([a-z0-9]+)(?:[?#].*)?$/,
				query_for_id: "https://wallhaven.cc/w/${id}",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/<img id="wallpaper" src="(https?:\/\/[^/]+\/+full\/+[^"']+)"/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					return done(decode_entities(match[1]), 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "th.wallhaven.cc") {
			// https://th.wallhaven.cc/small/pk/pk2mke.jpg
			//   https://th.wallhaven.cc/lg/pk/pk2mke.jpg
			//   https://w.wallhaven.cc/full/pk/wallhaven-pk2mke.jpg
			// https://th.wallhaven.cc/lg/pk/pkkm6p.jpg
			//   https://w.wallhaven.cc/full/pk/wallhaven-pkkm6p.png
			// thanks to anonymous for reporting:
			// https://th.wallhaven.cc/orig/pk/pk2mke.jpg
			//   https://w.wallhaven.cc/full/pk/wallhaven-pk2mke.jpg
			newsrc = src.replace(/:\/\/th\.([^/]+\/+)(?:small|lg|orig)\/+([a-z0-9]{2}\/+)([a-z0-9]+\.)/, "://w.$1full/$2wallhaven-$3");
			if (newsrc !== src) {
				return add_extensions(newsrc);
			}
		}

		if (domain_nowww === "pussycalor.com") {
			// http://www.pussycalor.com/fotospc/th-14502.jpg
			//   http://www.pussycalor.com/fotospc/14502.jpg
			return src.replace(/(\/fotospc\/+)th-([0-9]+\.)/, "$1$2");
		}

		if (domain === "cdn.animenewsnetwork.com" ||
			// https://www.animenewsnetwork.com/thumbnails/hotlink-max450x450/cms/news/103321/sword-art-online.jpg
			//   https://www.animenewsnetwork.com/images/cms/news/103321/sword-art-online.jpg
			domain_nowww === "animenewsnetwork.com") {
			// https://cdn.animenewsnetwork.com/thumbnails/max350x1000/cms/interview/40076/keyart.jpg.jpg
			//   https://cdn.animenewsnetwork.com/thumbnails/hotlink-full/cms/interview/40076/keyart.jpg.jpg -- 3956x5373
			//   https://cdn.animenewsnetwork.com/images/cms/interview/40076/keyart.jpg.jpg -- same size
			// https://cdn.animenewsnetwork.com/images/cms/feature/111684/09.jpg -- 1920x1080
			// https://cdn.animenewsnetwork.com/thumbnails/cover400x200/cms/episode-review.2/135908/chioep8.jpg
			//   https://cdn.animenewsnetwork.com/images/cms/episode-review.2/135908/chioep8.jpg
			// thanks to jonestly on discord:
			// https://cdn.animenewsnetwork.com/thumbnails/max300x600/cms/preview-guide/193152/jb-w23-19-reincarnated-exorcist-preview-2.png.jpg
			//   https://cdn.animenewsnetwork.com/images/cms/preview-guide/193152/jb-w23-19-reincarnated-exorcist-preview-2.png
			//return src.replace(/\/thumbnails\/[^/]*\//, "/thumbnails/hotlink-full/");
			return src
				.replace(/\/thumbnails\/[^/]*\/cms\//, "/images/cms/")
				.replace(/(\.[a-z]{3,4})\.jpg(?:[?#].*)?$/, "$1");
		}

		if ((domain_nowww === "digitalart.io" && string_indexof(src, "/storage/") >= 0) ||
			// https://www.fashion-press.net/img/news/23766/w300_rianna_13.jpg
			//   https://www.fashion-press.net/img/news/23766/rianna_13.jpg
			domain_nowww === "fashion-press.net" && string_indexof(src, "/img/") >= 0) {
			// https://digitalart.io/storage/artworks/1301/h250_anime_protagonist-wide.jpeg
			//   https://digitalart.io/storage/artworks/1301/anime_protagonist-wide.jpeg
			// https://digitalart.io/storage/artworks/709/h250_Asuka-Langley-Neon-Genesis-Evangelist-Wallpaper.jpeg
			//   https://digitalart.io/storage/artworks/709/Asuka-Langley-Neon-Genesis-Evangelist-Wallpaper.jpeg
			return src.replace(/(\/[0-9]*\/)[wh][0-9]+_([^/]*)$/, "$1$2");
		}

		if (domain_nowww === "4everstatic.com" ||
			domain === "pictures.4ever.eu") {
			// still has logo though
			// http://4everstatic.com/pictures/850xX/cartoons/anime-and-fantasy/anime-girl,-red-dress,-river-218133.jpg
			//   http://4everstatic.com/pictures/cartoons/anime-and-fantasy/anime-girl,-red-dress,-river-218133.jpg
			//   http://pictures.4ever.eu/data/download/cartoons/anime-and-fantasy/anime-girl,-red-dress,-river-218133.jpg?no-logo
			// http://4everstatic.com/bilderse/674xX/manniskor/musiker/rihanna,-rodharig-217524.jpg
			//   http://4everstatic.com/bilderse/manniskor/musiker/rihanna,-rodharig-217524.jpg
			//   http://4everstatic.com/pictures/people/musicians/rihanna,-redhead-217524.jpg
			//return src.replace(/\/pictures\/[0-9X]+x[0-9X]+\//, "/pictures/");

			if (!src.match(/:\/\/[^/]*\/data\/+download\//)) {
				return [
					// removes the logo, but forces download
					src.replace(/:\/\/[^/]*\/[a-z]+\/(?:[0-9X]+x[0-9X]+\/)?([^?]*).*?$/, "://pictures.4ever.eu/data/download/$1?no-logo"),

					//src.replace(/:\/\/[^/]*\/[a-z]+\/(?:[0-9X]+x[0-9X]+\/)?([^?]*).*?$/, "://pictures.4ever.eu/data/download/$1?no-logo"),
					src.replace(/(:\/\/[^/]*\/[a-z]+\/)[0-9X]+x[0-9X]+\//, "$1")
				];
			}
		}

		if (domain_nowww === "tapeciarnia.pl") {
			// https://tapeciarnia.pl/tapety/srednie/264402_dziewczyna_manga_anime.jpg
			//   https://tapeciarnia.pl/tapety/normalne/264402_dziewczyna_manga_anime.jpg
			return src.replace(/\/tapety\/[^/]*\//, "/tapety/normalne/");
		}

		if (domain_nowww === "zastavki.com") {
			// http://zastavki.com/pictures/640x480/2015/Anime_Picnic_on_the_lawn__anime_Klannad_102412_29.jpg
			//   http://zastavki.com/pictures/originals/2015/Anime_Picnic_on_the_lawn__anime_Klannad_102412_.jpg
			// http://www.zastavki.com/pictures/286x180/2015/Anime_Yuki_Asuna_smiles_092918_32.jpg
			//   http://www.zastavki.com/pictures/originals/2015/Anime_Yuki_Asuna_smiles_092918_.jpg
			// http://www.zastavki.com/pictures/640x480/2018Animals___Dogs_A_little_funny_puppy_with_his_tongue_hanging_out_122826_29.jpg
			//   http://www.zastavki.com/pictures/originals/2018Animals___Dogs_A_little_funny_puppy_with_his_tongue_hanging_out_122826_.jpg
			return src.replace(/\/pictures\/[0-9]+x[0-9]+\/(.*_[0-9]+)_[0-9]+(\.[^/.]*)$/, "/pictures/originals/$1_$2");
		}

		if (domain_nosub === "wallls.com" && domain.match(/w[0-9]*\.wallls.com/)) {
			// http://w4.wallls.com/uploads/high-thumbnail/201702/01/121462.jpg
			//   http://w4.wallls.com/uploads/original/201702/01/wallls.com_121462.jpg
			// http://w4.wallls.com/uploads/thumbnail/201711/21/157267.jpg
			//   http://w4.wallls.com/uploads/original/201711/21/wallls.com_157267.jpg
			return src.replace(/\/uploads\/[^/]*\/([0-9]*\/[0-9]*\/)([0-9]*\.[^/.]*)$/, "/uploads/original/$1wallls.com_$2");
		}

		if (domain === "content.hardtunes.com") {
			// https://content.hardtunes.com/albums/6541/6815/248x248.jpg
			//   https://content.hardtunes.com/albums/6541/6815/original.jpg
			return src.replace(/\/[0-9]+x[0-9]+(\.[^/.]*)$/, "/original$1");
		}

		if (domain_nowww === "4kw.in" &&
			string_indexof(src, "/Wallpapers/") >= 0) {
			// http://4kw.in/Wallpapers/Beautiful-anime-girl-4k-3840x21601.jpg
			//   http://www.4kw.in/Wallpapers/Beautiful-anime-girl-4k-3840x2160.jpg
			// http://4kw.in/Wallpapers/Anime-girl-ice-cream-desert-4k1.jpg
			//   http://4kw.in/Wallpapers/Anime-girl-ice-cream-desert-4k.jpg
			return src.replace(/1(\.[^/.]*)$/, "$1");
		}

		if (domain === "imgs-art-dragoart-386112.c.cdn77.org") {
			// https://imgs-art-dragoart-386112.c.cdn77.org/anime-girl-running-into-the-light_1_000000074972_4.jpg
			//   https://imgs-art-dragoart-386112.c.cdn77.org/anime-girl-running-into-the-light_1_000000074972_1.jpg
			return src.replace(/_[0-9]*(\.[^/.]*)$/, "_1$1");
		}

		if (domain_nosub === "hulkshare.com" && domain.match(/s[0-9]*\.hulkshare\.com/)) {
			// http://s0.hulkshare.com//artists/180/c/3/6/c361bc7b2c033a83d663b8d9fb4be56e.jpg?dd=1513632152
			//   http://s0.hulkshare.com//artists/original/c/3/6/c361bc7b2c033a83d663b8d9fb4be56e.jpg?dd=1513632152
			// http://s3.hulkshare.com/song_images/120/a/3/4/a342dfe999a823948f4472afed3ecc74.jpg?dd=1405601334
			//   http://s3.hulkshare.com/song_images/original/a/3/4/a342dfe999a823948f4472afed3ecc74.jpg?dd=1405601334
			return src.replace(/\/[0-9]*\/([0-9a-f]\/[0-9a-f]\/[0-9a-f]\/[0-9a-f]*\.[^/.]*)$/, "/original/$1");
		}

		if (domain_nowww === "wikihow.com" &&
			string_indexof(src, "/images/") >= 0) {
			// https://www.wikihow.com/images/thumb/b/ba/Roll-Sod-Step-14-Version-3.jpg/aid1391676-v4-728px-Roll-Sod-Step-14-Version-3.jpg
			//   https://www.wikihow.com/images/b/ba/Roll-Sod-Step-14-Version-3.jpg
			return src.replace(/\/thumb\/(.*?\.[^/.]*)(?:\/.*)/, "/$1");
		}

		if (domain_nosub === "kakaocdn.net" ||
			domain_nosub === "kakao.co.kr") {
			// https://dn-s-story.kakaocdn.net/dn/Qqfey/hytef1ArTx/qZmOLz8iP9oj5eZDEQEbDk/img_m.jpg?width=650&height=975&avg=%2523817f77&v=2
			//   http://dn-s-story.kakao.co.kr/dn/Qqfey/hytef1ArTx/qZmOLz8iP9oj5eZDEQEbDk/img_m.jpg
			//   https://dn-xl0-story.kakaocdn.net/dn/Qqfey/hytef1ArTx/qZmOLz8iP9oj5eZDEQEbDk/img_xl.jpg?width=650&height=975&avg=%2523817f77&v=2
			//   http://dn-s-story.kakao.co.kr/dn/Qqfey/hytef1ArTx/qZmOLz8iP9oj5eZDEQEbDk/img.jpg
			// https://story-img.kakaocdn.net/dn/Qqfey/hytef1ArTx/qZmOLz8iP9oj5eZDEQEbDk/img_m.jpg?width=650&height=975&avg=%2523817f77&v=2
			//   https://story-img.kakaocdn.net/dn/Qqfey/hytef1ArTx/qZmOLz8iP9oj5eZDEQEbDk/img.jpg
			// http://dn-l1-story.kakao.co.kr/dn/bpU40i/hyglUiBxbK/TgKflthO9wKjHf1TemKnx0/img_l.jpg?width=1446&height=1920
			//   http://dn-l1-story.kakao.co.kr/dn/bpU40i/hyglUiBxbK/TgKflthO9wKjHf1TemKnx0/img_l.jpg
			//   http://dn-l1-story.kakao.co.kr/dn/bpU40i/hyglUiBxbK/TgKflthO9wKjHf1TemKnx0/img_xl.jpg -- stretched?
			//   http://dn-l1-story.kakao.co.kr/dn/bpU40i/hyglUiBxbK/TgKflthO9wKjHf1TemKnx0/img.jpg -- 404
			newsrc = src
				.replace(/(\/img(?:_[a-z]+)?\.[^/.?#]*)(?:[?#].*)?$/, "$1")
				.replace(/\/img_[a-z]+(\.[^/.]*)$/, "/img$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (host_domain === "tv.kakao.com" && domain_nosub === "kakaocdn.net" && /\/vod_thumbnail\//.test(src) && options.element) {
			newsrc = common_functions["get_pagelink_el_matching"](options.element, /\/channel\/+[0-9]+\/+cliplink\/+[0-9]+/);
			if (newsrc) return newsrc;
		}

		if (domain === "tv.kakao.com") {
			// https://tv.kakao.com/channel/3527229/cliplink/411915208
			// https://tv.kakao.com/embed/player/cliplink/411915208?service=kakao_tv&section=channel&autoplay=1&profile=HIGH&wmode=transparent
			// https://tv.kakao.com/channel/2669634/livelink/8629498
			// https://tv.kakao.com/channel/3629101/cliplink/411920988 -- requires ABR (video urls are provided, but return 404)
			var query_dash_with_params = function(req, params, cb) {
				req.method = "GET";
				req.onload = function(resp) {
					if (resp.status !== 200) {
						console_error("Unable to request", req, resp);
						return cb(null);
					}

					var text = resp.responseText;
					var baseurl = req.url.replace(/\/[^/]+(?:[?#].*)?$/, "/");
					params = encode_entities(params);
					text = text.replace(/((?:initialization|media)=")([^"]+)(")/g, "$1" + baseurl + "$2?" + params + "$3");

					cb(text);
				};

				options.do_request(req);
			};

			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+(?:channel\/+[0-9]+|embed\/+player)\/+cliplink\/+([0-9]+)(?:[?#].*)?$/,
				run: function(cb, match) {
					var id = match[1];

					var cache_key = "kakao_video:" + id;
					var queries = {
						player: "monet_html5",
						referer: "https://tv.kakao.com/",
						uuid: "",
						profile: "HIGH4", // 1080p ... is there anything larger?
						service: "kakao_tv",
						//section: "channel", or "kakao_tv" for livelink instead of cliplink
						fields: "seekUrl,abrVideoLocationList",
						playerVersion: "3.7.1",
						startPosition: "0",
						tid: "",
						dteType: "PC",
						contentType: ""
					};

					queries[Date.now()] = "";

					api_query(cache_key, {
						url: "https://tv.kakao.com/katz/v1/ft/cliplink/" + id + "/readyNplay?" + stringify_queries(queries),
						imu_mode: "xhr",
						headers: {
							"Content-Type": "application/x-www-form-urlencoded",
							Referer: "https://tv.kakao.com/"
						},
						json: true
					}, cb, function(done, resp, cache_key) {
						//console_log(resp);
						if (!resp.videoLocation || !resp.videoLocation.url) {
							console_error(cache_key, "Unable to find video URL for", resp);
							return done(null, false);
						}

						var baseobj = {
							headers: {
								Referer: "https://tv.kakao.com/",
								Origin: "https://tv.kakao.com"
							}
						};

						var urls = [];

						var abr_urls = resp.abrVideoLocationList;
						var waiting = false;
						if (abr_urls) {
							for (var i = 0; i < abr_urls.length; i++) {
								var videotype = null;
								if (abr_urls[i].type === "DASH") {
									videotype = "dash";
								} else if (abr_urls[i].type === "HLS") {
									videotype = "hls";
								}

								if (!videotype) {
									console_warn(cache_key, "Unknown ABR content type", abr_urls[i].type, "for", abr_urls[i], resp);
									continue;
								}

								var obj = {
									video: videotype
								};

								var url = abr_urls[i].url;
								obj.url = url;
								if (abr_urls[i].params) {
									url += "?" + abr_urls[i].params;
									obj.url = url;

									if (abr_urls[i].type === "DASH") {
										query_dash_with_params({
											url: url,
											headers: {
												Referer: "https://tv.kakao.com/",
												Origin: "https://tv.kakao.com"
											}
										}, abr_urls[i].params, function(dash) {
											if (dash) {
												obj.url = "data:application/dash+xml," + encodeURIComponent(dash);
											}

											return done(fillobj_urls(urls, baseobj), 60*60);
										});

										waiting = true;
									}
								}

								urls.push(obj);
							}
						}

						var contenttype = resp.videoLocation.contentType;
						var video:VideoProp = true;

						if (contenttype) {
							if (contenttype === "HLS") {
								video = "hls";
							} else if (contenttype === "DASH") {
								video = "dash";
							} else if (contenttype === "MP4") {
								video = true;
							} else {
								console_warn(cache_key, "Unknown contentType:", {contenttype: contenttype, json: resp});
								video = null;
							}
						}

						if (video) {
							urls.push({
								url: resp.videoLocation.url,
								video: video,
								can_head: false // 404
							});
						}

						if (urls.length === 0)
							return done(null, false);

						if (!waiting)
							return done(fillobj_urls(urls, baseobj), 60*60);
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "dn-img-page.kakao.com" ||
			// thanks to TristanWasTaken on github: https://github.com/qsniyg/maxurl/issues/1307
			// https://page-images.kakaoentcdn.com/download/resource?kid=qFrns/hAd47wJicm/Cr4Bq4DkXn44OcNbCVb3Sk&filename=o1/dims/resize/384
			//   https://page-images.kakaoentcdn.com/download/resource?kid=qFrns/hAd47wJicm/Cr4Bq4DkXn44OcNbCVb3Sk&filename=o1
			domain === "page-images.kakaoentcdn.com") {
			// thanks to TristanWasTaken on github: https://github.com/qsniyg/maxurl/issues/1176
			// https://page.kakao.com/content/56566288
			// https://dn-img-page.kakao.com/download/resource?kid=bXtxpT/hzN2hYnygX/dIpdFOEOrYAyfehnSQ8EG0&filename=th1 -- 106x152
			//   https://dn-img-page.kakao.com/download/resource?kid=bXtxpT/hzN2hYnygX/dIpdFOEOrYAyfehnSQ8EG0&filename=th3 -- 240x343
			//   https://dn-img-page.kakao.com/download/resource?kid=bXtxpT/hzN2hYnygX/dIpdFOEOrYAyfehnSQ8EG0&filename=o1 -- 720x1030
			//   https://dn-img-page.kakao.com/download/resource?kid=bXtxpT/hzN2hYnygX/dIpdFOEOrYAyfehnSQ8EG0 -- 720x1030
			// thanks to TristanWasTaken on github: https://github.com/qsniyg/maxurl/issues/1266
			// https://page.kakao.com/content/58396566
			// https://dn-img-page.kakao.com/download/resource?kid=7QQvu/hAd4ne478s/N76c0HerPo9poqVpoc0IC1
			//   https://dn-img-page.kakao.com/download/resource?kid=7QQvu/hAd4ne478s/N76c0HerPo9poqVpoc0IC1&filename=o1 -- 720x1030
			if (/\/download\/+resource\?/.test(src)) {
				return keep_queries(src, "kid") + "&filename=o1";
			}
		}

		if (domain === "obs.line-scdn.net") {
			// https://obs.line-scdn.net/0hHuiuzxHgF1pUDDvjJ95oDSBRETUtbw1SPnQAYCFaHXQhYABaPHYebDRcFjoqaAxUNzoQYm0OGQwONQBwIDgIQjpSPCl8YBUFNBxcfQleMT0BQQpJOHZYOHIJTWh4NVMMaGIKaXcLQW48PVkMODpcOnU/small
			//   https://obs.line-scdn.net/0hHuiuzxHgF1pUDDvjJ95oDSBRETUtbw1SPnQAYCFaHXQhYABaPHYebDRcFjoqaAxUNzoQYm0OGQwONQBwIDgIQjpSPCl8YBUFNBxcfQleMT0BQQpJOHZYOHIJTWh4NVMMaGIKaXcLQW48PVkMODpcOnU
			// https://obs.line-scdn.net/0hKIDhz0IEFGZ5ETjf-dFrMQ1MEgkAcg5uE2kDXAxHHkgMfQNmEWsdUBlBFQYHdQ9oGicTXkARHjcwVzJLLBYfaw5kPgYwegxiNjMJa1VXMwhdRzNZOmtbBF8UTlRRJlU4RX8JUFwZSFERIFowFSReCVo/small
			//   https://obs.line-scdn.net/0hKIDhz0IEFGZ5ETjf-dFrMQ1MEgkAcg5uE2kDXAxHHkgMfQNmEWsdUBlBFQYHdQ9oGicTXkARHjcwVzJLLBYfaw5kPgYwegxiNjMJa1VXMwhdRzNZOmtbBF8UTlRRJlU4RX8JUFwZSFERIFowFSReCVo
			// https://obs.line-scdn.net/0hC4kQ_ABvHBtWKDChhAhjTCJ1GnQvSwYTPFALISN-FjUjRAsbPlIVLTZ4HXsoTAcVNR4bI293JmJ8YBIxNBESKQEuR04wQyZPDDw3GwZMQlg-S10dPVJTeXAtRyN6GFpPakYBKHQvSi4-GVJNOk9UenU/small
			//   https://obs.line-scdn.net/0hC4kQ_ABvHBtWKDChhAhjTCJ1GnQvSwYTPFALISN-FjUjRAsbPlIVLTZ4HXsoTAcVNR4bI293JmJ8YBIxNBESKQEuR04wQyZPDDw3GwZMQlg-S10dPVJTeXAtRyN6GFpPakYBKHQvSi4-GVJNOk9UenU
			// https://obs.line-scdn.net/0hkNQBJYc8NGFsOxgIp3lLNiRmMg4VWC5pBkMjWxltPk8ZVyNhBEE4Vwt5LhIRVDZ1TCYNTk1aGQc2UiFvJikLRA96KRQ_YCx2LiQhDjZiAxADF3MzUFxzB088blNBAyFgUFp9AAw6bFQRXyY2VA/small
			//   https://obs.line-scdn.net/0hkNQBJYc8NGFsOxgIp3lLNiRmMg4VWC5pBkMjWxltPk8ZVyNhBEE4Vwt5LhIRVDZ1TCYNTk1aGQc2UiFvJikLRA96KRQ_YCx2LiQhDjZiAxADF3MzUFxzB088blNBAyFgUFp9AAw6bFQRXyY2VA/large
			//   https://obs.line-scdn.net/0hkNQBJYc8NGFsOxgIp3lLNiRmMg4VWC5pBkMjWxltPk8ZVyNhBEE4Vwt5LhIRVDZ1TCYNTk1aGQc2UiFvJikLRA96KRQ_YCx2LiQhDjZiAxADF3MzUFxzB088blNBAyFgUFp9AAw6bFQRXyY2VA - 4032x3168
			// https://obs.line-scdn.net/0hYJbHYMpsBmVfMSkJA2N5MmdsABImHwNhfRMIUSRtAAokHRNqf1FPA3I1XUlxAhEyY1FKAD8wX1B0B0dkZw/s375x375
			//   https://obs.line-scdn.net/0hYJbHYMpsBmVfMSkJA2N5MmdsABImHwNhfRMIUSRtAAokHRNqf1FPA3I1XUlxAhEyY1FKAD8wX1B0B0dkZw
			// thanks to nimbuz on discord:
			// https://viewing.live.line.me/liveg/571
			// https://obs.line-scdn.net/0hSbqyZY6kDE1MABs-wfdzGhxdCjo1LhZcKHhDfG1TUXQxN0pIeDYTezxQBy82YktIJzYRfGlTVClmMUscc29FKWsHU3xhOBkTdWZDLCwBBnlgYE0TcQ/f375x375
			//   https://obs.line-scdn.net/0hSbqyZY6kDE1MABs-wfdzGhxdCjo1LhZcKHhDfG1TUXQxN0pIeDYTezxQBy82YktIJzYRfGlTVClmMUscc29FKWsHU3xhOBkTdWZDLCwBBnlgYE0TcQ
			// https://obs.line-scdn.net/0h13h02m0kbhxVSXlpXX8RS2kMYHEiZ2hULX9xcnJNNCxxKy8aaHggf3YdYil9eCxNOSp1KCUZYC9w/preview
			//   https://obs.line-scdn.net/0h13h02m0kbhxVSXlpXX8RS2kMYHEiZ2hULX9xcnJNNCxxKy8aaHggf3YdYil9eCxNOSp1KCUZYC9w
			// other:
			// https://obs.line-scdn.net/r/musicjp/c/c19cc4929t0a0760a4/v256x256
			//   https://obs.line-scdn.net/r/musicjp/c/c19cc4929t0a0760a4 -- doesn't work (403) -- works now?
			// thanks to nimbuz on discord for reporting:
			// https://news.line.me/vision/oa-vi-hana/r62jiwvdc6jx
			// https://obs.line-scdn.net/0hXGMyGkAUB2hwABHF36V4P0hdAQcJbxR4DngPEFNCBgEYZBh7HzAeRwJBHwJdOBI2T2BBDRABDVlaYkhqTw/a640
			//   https://obs.line-scdn.net/0hXGMyGkAUB2hwABHF36V4P0hdAQcJbxR4DngPEFNCBgEYZBh7HzAeRwJBHwJdOBI2T2BBDRABDVlaYkhqTw -- no content-length/type
			// https://obs.line-scdn.net/0hXGMyGkAUB2hwABHF36V4P0hdAQcJbxR4DngPEFNCBgEYZBh7HzAeRwJBHwJdOBI2T2BBDRABDVlaYkhqTw/a640
			//   https://obs.line-scdn.net/0hXGMyGkAUB2hwABHF36V4P0hdAQcJbxR4DngPEFNCBgEYZBh7HzAeRwJBHwJdOBI2T2BBDRABDVlaYkhqTw -- no content-length/type
			//   small, large, s375x375 returns 400
			// thanks to jonestly on discord:
			// https://obs.line-scdn.net/r/musicjp/c/cb81219e56655t0fecc0ce/m470x470
			//   https://obs.line-scdn.net/r/musicjp/c/cb81219e56655t0fecc0ce
			return {
				can_head: false,
				url: src.replace(/(:\/\/[^/]*\/(?:r\/+musicjp\/+.\/+)?[-_0-9A-Za-z]*)\/(?:small|large|preview|[fsm][0-9]+x[0-9]+)(?:[?#].*)?$$/, "$1")
			};
		}

		if (domain === "scdn.line-apps.com") {
			// https://scdn.line-apps.com/obs/0hYJbHYMpsBmVfMSkJA2N5MmdsABImHwNhfRMIUSRtAAokHRNqf1FPA3I1XUlxAhEyY1FKAD8wX1B0B0dkZw/s375x375
			//   https://scdn.line-apps.com/0hYJbHYMpsBmVfMSkJA2N5MmdsABImHwNhfRMIUSRtAAokHRNqf1FPA3I1XUlxAhEyY1FKAD8wX1B0B0dkZw/s375x375
			//   https://obs.line-scdn.net/0hYJbHYMpsBmVfMSkJA2N5MmdsABImHwNhfRMIUSRtAAokHRNqf1FPA3I1XUlxAhEyY1FKAD8wX1B0B0dkZw/s375x375
			//   https://obs.line-scdn.net/0hYJbHYMpsBmVfMSkJA2N5MmdsABImHwNhfRMIUSRtAAokHRNqf1FPA3I1XUlxAhEyY1FKAD8wX1B0B0dkZw
			return src.replace(/^[a-z]+:\/\/[^/]*\/(?:obs\/)?([-_0-9A-Za-z]*)(?:\/[a-z0-9]*)?$/, "https://obs.line-scdn.net/$1");
		}

		if (domain === "resource-jp-linemusic.line-scdn.net") {
			// thanks to anonymous for reporting:
			// https://resource-jp-linemusic.line-scdn.net/r/musicjp/c/c86c819e44064t0fc8923f/m470x470
			//   https://obs.line-scdn.net/r/musicjp/c/c86c819e44064t0fc8923f
			return src.replace(/:\/\/[^/]+\/+/, "://obs.line-scdn.net/");
		}

		if (domain === "cdn-obs.line-apps.com") {
			// http://cdn-obs.line-apps.com/line/r/lineq/c/39502AA7-70E6-4CA0-BC5A-BAA75CFE9AAD.be1e14t04a16236/200x200.rf
			//   http://cdn-obs.line-apps.com/line/r/lineq/c/39502AA7-70E6-4CA0-BC5A-BAA75CFE9AAD.be1e14t04a16236
			return src.replace(/(\/[-0-9A-F]+\.[0-9a-z]+)\/[^/]*$/, "$1");
		}

		if (domain === "resize-image.lineblog.me") {
			// https://resize-image.lineblog.me/47c5e2ea477a5b48ce91fcca631bbd99655224b0/crop1/60x60/https://obs.line-scdn.net/0hKIDhz0IEFGZ5ETjf-dFrMQ1MEgkAcg5uE2kDXAxHHkgMfQNmEWsdUBlBFQYHdQ9oGicTXkARHjcwVzJLLBYfaw5kPgYwegxiNjMJa1VXMwhdRzNZOmtbBF8UTlRRJlU4RX8JUFwZSFERIFowFSReCVo/small
			return src.replace(/^[a-z]+:\/\/[^/]*\/[0-9a-f]*\/.*?\/([a-z]+:\/\/.*)/, "$1");
		}

		if (domain === "stickershop.line-scdn.net") {
			// https://stickershop.line-scdn.net/stickershop/v1/product/3001205/LINEStorePC/main.png;compress=true
			//   https://stickershop.line-scdn.net/stickershop/v1/product/3001205/LINEStorePC/main.png
			return src.replace(/;[a-z]+=[^/]*(?:[?#].*)?$/, "");
		}

		if (domain === "d.line-scdn.net") {
			// https://d.line-scdn.net/lcp-prod-photo/20190116_219/800000358_1547591821731hiuUI_JPEG/pyb01jsbo76y9m.jpg?type=r280_trim
			//   https://d.line-scdn.net/lcp-prod-photo/20190116_219/800000358_1547591821731hiuUI_JPEG/pyb01jsbo76y9m.jpg
			return src.replace(/[?].*/, "");
		}

		if (domain_nosub === "viki.io" && domain.match(/^[0-9]*\.viki\.io/)) {
			// https://6.viki.io/image/8c632348fc5d4e8b80db59c38fbf6f29.jpeg?x=b&a=0x0&s=780x436&q=h&e=t&f=t&cb=1
			//   https://6.viki.io/image/8c632348fc5d4e8b80db59c38fbf6f29.jpeg
			return {
				can_head: false,
				url: src.replace(/\?.*/, "")
			};
		}

		if (domain_nosub === "crunchyroll.com" && domain.match(/img[0-9]*\.[^/.]*\.crunchyroll\.com/)) {
			// http://img1.ak.crunchyroll.com/i/spire1/863ba423b729f58769a4004834e5554e1491069428_thumb.jpg
			//   http://img1.ak.crunchyroll.com/i/spire1/863ba423b729f58769a4004834e5554e1491069428_full.jpg -- 640x960
			//   https://img1.ak.crunchyroll.com/i/spire1/863ba423b729f58769a4004834e5554e1491069428_main.jpg -- 1064x1596
			// thanks to fireattack on discord:
			// https://img1.ak.crunchyroll.com/i/spire4/b169d1e1424b9c20ec0f0f9dc16464591677883703_full.png -- 640x634
			//   https://img1.ak.crunchyroll.com/i/spire4/b169d1e1424b9c20ec0f0f9dc16464591677883703_main.png -- 1600x1584
			return src.replace(/(\/[0-9a-f]+)_(?:thumb|full)(\.[^/.]*)$/, "$1_main$2");
		}

		if (domain === "d3ieicw58ybon5.cloudfront.net") {
			// https://d3ieicw58ybon5.cloudfront.net/resize/1600/u/e33bc7c858c44506a860fc2409f80d7b.jpg.webp
			//   https://d3ieicw58ybon5.cloudfront.net/full/u/e33bc7c858c44506a860fc2409f80d7b.jpg.webp
			// https://d3ieicw58ybon5.cloudfront.net/ex/640.400/0.127.2455.1535/u/abbaffa834cc49f9aa318ae280fd10f0.jpg.webp
			//   https://d3ieicw58ybon5.cloudfront.net/full/u/abbaffa834cc49f9aa318ae280fd10f0.jpg.webp
			// https://d3ieicw58ybon5.cloudfront.net/ex/350.350/shop/product/bf108bdf69264ab9992775fbd8906521.jpg
			//   https://d3ieicw58ybon5.cloudfront.net/ex/350.350/shop/product/bf108bdf69264ab9992775fbd8906521.jpg
			return {
				url: src
					.replace(/\/resize\/[0-9]+\//, "/full/")
					.replace(/\/ex\/[0-9]+\.[0-9]+\/(?:(?:[0-9]+\.){3}[0-9]+\/)?/, "/full/"),
				can_head: false
			};
		}

		if (domain === "az616578.vo.msecnd.net") {
			// https://az616578.vo.msecnd.net/files/responsive/cover/main/desktop/2016/05/22/6359949242235344891413001074_All%20the%20anime.jpeg
			//   https://az616578.vo.msecnd.net/files/2016/05/22/6359949242235344891413001074_All%20the%20anime.jpeg
			return src.replace(/\/files\/responsive\/[^/]*\/[^/]*\/[^/]*\//, "/files/");
		}

		if ((domain_nosub === "dreamwiz.net" && domain.match(/img[0-9]*\.dreamwiz\.net/)) ||
			// https://kep.cdn.index.hu/1/0/1081/10818/108187/10818731_a9dd5fca6ef2c0a76289d40cdc7bfa3e_m.jpg -- has watermark
			//   https://kep.cdn.index.hu/1/0/1081/10818/108187/10818731_a9dd5fca6ef2c0a76289d40cdc7bfa3e_o.jpg -- no watermark
			// http://kep.cdn.index.hu/1/0/109/1095/10959/1095933_dac6c5cac679c316db35cc7d8f2c3342_wm.jpg
			//   http://kep.cdn.index.hu/1/0/109/1095/10959/1095933_dac6c5cac679c316db35cc7d8f2c3342_o.jpg
			domain === "kep.cdn.index.hu" ||
			// http://kep.index.hu/1/0/161/1610/16107/1610781_0ca4a1e55ba465f8f9ed40b65e2b12db_wm.jpg
			//   http://kep.index.hu/1/0/161/1610/16107/1610781_0ca4a1e55ba465f8f9ed40b65e2b12db_o.jpg -- doesn't work
			domain === "kep.index.hu" ||
			// https://kep.cdn.indexvas.hu/1/0/1390/13903/139030/13903056_a12075627654662f42ea3dbf77b8e0bf_s.jpg
			//   https://kep.cdn.indexvas.hu/1/0/1390/13903/139030/13903056_a12075627654662f42ea3dbf77b8e0bf_o.jpg
			// doesn't work:
			// http://kep.cdn.indexvas.hu/1/0/1101/11010/110101/11010115_4822af4c84231b7d1bea46ce1f6e78db_wm.jpg
			//   http://kep.cdn.indexvas.hu/1/0/1101/11010/110101/11010115_4822af4c84231b7d1bea46ce1f6e78db_o.jpg -- doesn't work
			// http://kep.cdn.indexvas.hu/1/0/161/1610/16107/1610781_0ca4a1e55ba465f8f9ed40b65e2b12db_wm.jpg
			//   http://kep.cdn.indexvas.hu/1/0/161/1610/16107/1610781_0ca4a1e55ba465f8f9ed40b65e2b12db_o.jpg -- doesn't work
			// changing to index.hu doesn't work either:
			// https://kep.cdn.index.hu/1/0/1101/11010/110101/11010115_4822af4c84231b7d1bea46ce1f6e78db_wm.jpg -- works
			//   https://kep.cdn.index.hu/1/0/1101/11010/110101/11010115_4822af4c84231b7d1bea46ce1f6e78db_o.jpg -- doesn't work
			domain === "kep.cdn.indexvas.hu") {
			// http://img77.dreamwiz.net/E/Z/T/EZTk3KA_m.jpg
			//   http://img77.dreamwiz.net/E/Z/T/EZTk3KA_l.jpg
			//   http://img77.dreamwiz.net/E/Z/T/EZTk3KA_o.jpg
			// doesn't work for all:
			// http://img77.dreamwiz.com/20180425/INI_DATA/hottopic/IMAGE/l/t/N/ltNNq0A_m.jpg
			//   http://img77.dreamwiz.com/l/t/N/ltNNq0A_m.jpg -- doesn't work
			return src.replace(/_(?:[a-z]|wm)(\.[^/.]*)$/, "_o$1");
		}

		if (domain === "galeria.cdn.index.hu") {
			// thanks to anonymous for reporting:
			// https://galeria.cdn.index.hu/kult/2018/08/11/lana_del_ray_scarlxrd_shame_-_penteki_koncertek_a_szigeten/20720652_71a5adc15836c9d916b39640c7553c6a_t.jpg
			//   https://galeria.cdn.index.hu/kult/2018/08/11/lana_del_ray_scarlxrd_shame_-_penteki_koncertek_a_szigeten/20720652_71a5adc15836c9d916b39640c7553c6a.jpg
			// thanks to anonymous:
			// https://galeria.cdn.index.hu/tech/2013/10/01/breaking_bad/4894462_89f3477b075aad534179b9ad01441213_xs.jpg
			//   https://galeria.cdn.index.hu/tech/2013/10/01/breaking_bad/4894462_89f3477b075aad534179b9ad01441213.jpg
			return src.replace(/_[a-z]{1,2}(\.[a-z]+)(?:[?#].*)?$/, "$1");
		}

		if ((domain_nosub === "sportsworldi.com" ||
			 domain_nosub === "segye.com") &&
			string_indexof(src, "/content/image/") >= 0) {
			// http://img.sportsworldi.com/content/image/2018/04/23/20180423000784_t.jpg
			//   http://img.sportsworldi.com/content/image/2018/04/23/20180423000784_0.jpg -- not larger
			// http://img.sportsworldi.com/content/image/2018/04/25/20180425002868_t.jpg
			//   http://img.sportsworldi.com/content/image/2018/04/25/20180425002868_0.jpg
			// http://img.segye.com/content/image/2018/04/23/20180423000737_t.jpg
			//   http://img.segye.com/content/image/2018/04/23/20180423000737_0.jpg
			// http://img.sportsworldi.com/content/image/2018/06/15/20180615000548_t.jpg
			//   http://mimg.sportsworldi.com/content/image/2018/06/20/20180620000504_t.jpg
			//   http://m.sportsworldi.com/content/image/2018/06/20/20180620000504_p.jpg
			//   http://m.sportsworldi.com/content/image/2018/06/20/20180620000504_0.jpg
			// doesn't work for all:
			// http://m.sportsworldi.com/content/image/2018/01/01/20180101001612_t.jpg -- 960x1440
			//   http://mimg.sportsworldi.com/content/image/2018/01/01/20180101001612_p.jpg -- 310x465
			//   http://m.sportsworldi.com/content/image/2018/01/01/20180101001612_0.jpg -- smaller (same for img.sportsworldi.com too)
			// http://img.sportsworldi.com/content/image/2017/12/23/20171223000846_t.jpg
			//   http://img.sportsworldi.com/content/image/2017/12/23/20171223000846_0.jpg -- smaller
			// http://img.sportsworldi.com/content/image/2017/12/12/20171212001686_t.jpg -- 5208x3858
			//   http://img.sportsworldi.com/content/image/2017/12/12/20171212001686_0.jpg -- 500x370
			//return src.replace(/_[a-z](\.[^/.]*)$/, "_0$1");

			// other:
			// http://img.sportsworldi.com/content/image/2019/01/17/20190117640866.png -- 3808x2097

			// http://img.sportsworldi.com/content/image/2019/02/26/128/20190226550905.jpg
			//   http://img.sportsworldi.com/content/image/2019/02/26/20190226550905.jpg
			return src.replace(/(\/content\/+image\/+[0-9]{4}\/+[0-9]{2}\/+[0-9]{2}\/+)[0-9]+\/+([0-9]+(?:_[^/.]*)?\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain_nowww === "maximkorea.net") {
			// http://www.maximkorea.net/magdb/file/138/138_3289240590_img_400.jpg
			//   http://www.maximkorea.net/magdb/file/138/138_3289240590_img.jpg
			// thanks to rEnr3n on github:
			// http://www.maximkorea.net/missmaxim/m2girl_view.php?m2girl_uid=151
			// http://www.maximkorea.net/missmaxim/m2girl/20145/73_2014502_133127_img_300.jpg
			//   http://www.maximkorea.net/missmaxim/m2girl/20145/73_2014502_133127_img.jpg -- upscaled?
			// thanks to Broly on discord:
			// https://www.maximkorea.net/magdb/file/271/271_img_1654069649_400.jpg
			//   https://www.maximkorea.net/magdb/file/271/271_img_1654069649_1215.jpg
			//   https://www.maximkorea.net/magdb/file/271/271_img_1654069649.jpg -- 2480x3236
			// https://www.maximkorea.net/magdb/file/282/282_img_1669081572_400.jpg
			//   https://www.maximkorea.net/magdb/file/282/282_img_1669081572.jpg
			return src
				.replace(/(\/[0-9]+_img_[0-9]{5,})_[0-9]+(\.[^/.]+)(?:[?#].*)?$/, "$1$2")
				.replace(/(\/[0-9]+_[0-9]+(?:_[0-9]+)?_img)_[0-9]+(\.[^/.]*)$/, "$1$2");
		}

		if (domain === "blogimgc.eximg.jp") {
			// https://blogimgc.eximg.jp/i=https%253A%252F%252Fpds.exblog.jp%252Fpds%252F1%252F201804%252F20%252F93%252Fd0150493_21520100.jpg,small=200,quality=75,type=jpg
			//   https://pds.exblog.jp/pds/1/201804/20/93/d0150493_21520100.jpg
			return decodeURIComponent(decodeURIComponent(src.replace(/^[a-z]+:\/\/[^/]*\/.*?i=([^,]*).*?$/, "$1")));
		}

		if (domain === "i.gzn.jp" ||
			// https://galeri4.uludagsozluk.com/120/_168878_m.jpg
			//   https://galeri4.uludagsozluk.com/120/_168878.jpg -- 2164x2900
			(domain_nosub === "uludagsozluk.com" && domain.match(/^galeri[0-9]*\./))) {
			// https://i.gzn.jp/img/2016/05/05/costume-players-fashion-machiasobi16/P368001cf_m.jpg
			//   https://i.gzn.jp/img/2016/05/05/costume-players-fashion-machiasobi16/P368001cf.jpg
			// https://i.gzn.jp/img/2018/04/25/amazon-route-53-hacked/00_m.jpg
			//   https://i.gzn.jp/img/2018/04/25/amazon-route-53-hacked/00.jpg
			// doesn't work for all:
			// https://i.gzn.jp/img/2016/05/05/costume-players-fashion-machiasobi16/00_m.jpg
			return src.replace(/_[a-z](\.[^/.]*)$/, "$1");
		}

		if (domain_nosub === "okmusic.jp" ||
			// http://newsimg.music-book.jp/news_images/images/1131249/large.?1485747730
			//   http://newsimg.music-book.jp/news_images/images/1131249/original.?1485747730
			domain === "newsimg.music-book.jp") {
			// https://c.okmusic.jp/news_items/images/261768/more_large.jpg?1524641204
			//   https://c.okmusic.jp/news_items/images/261768/original.jpg?1524641204
			// https://c.okmusic.jp/app_artist_media_files/images/149/large.jpg
			//   https://c.okmusic.jp/app_artist_media_files/images/149/original.jpg
			// http://s.okmusic.jp/news_images/images/2103004/large.jpg?1485745865
			//   http://s.okmusic.jp/news_images/images/2103004/original.jpg?1485745865
			return src.replace(/(\/images\/[0-9]*\/)[^/.]*(\.[^/.]*)$/, "$1original$2");
		}

		if (domain_nowww === "kai-you.net") {
			// https://kai-you.net/r/img/a/752x/160814_kc90_0043.jpg?20180417135722
			//   https://kai-you.net/press/img/160814_kc90_0043.jpg?20180417135722
			// http://kai-you.net/r/img/a/c192x192/160814_kc90_0039.jpg
			//   http://kai-you.net/press/img/160814_kc90_0039.jpg
			// https://kai-you.net/images/a/2018/04/c672x416/37538746dc80daa2447b2652c73fb88a.jpg
			//   https://kai-you.net/images/a/2018/04/37538746dc80daa2447b2652c73fb88a.jpg
			//   https://kai-you.net/press/img/a7b4d4ab27d40caa23a964184b4903db.jpg?20180425182556
			return src
				.replace(/\/r\/img\/[a-z]\/[a-z]?[0-9]+x(?:[0-9]+)?\//, "/press/img/")
				.replace(/(\/images\/.*)\/[a-z]?[0-9]+x(?:[0-9]+)?\/([^/]*)$/, "$1/$2");
		}

		if (domain === "cdn.fortune-girl.com") {
			// https://cdn.fortune-girl.com/medium/513f7c8a-e8a1-44e8-9eec-76b37b4e7e42.jpg?1496131561
			//   https://cdn.fortune-girl.com/original/513f7c8a-e8a1-44e8-9eec-76b37b4e7e42.jpg?1496131561
			return src.replace(/(:\/\/[^/]*\/)[a-z]*\/([-0-9a-f]*\.[^/.]*)$/, "$1original/$2");
		}

		if (domain === "storage.withnews.jp" ||
			amazon_container === "storage.withnews.jp") {
			// http://storage.withnews.jp/2014/08/17/5/b4/5b4bd1e0-s.jpg
			//   http://storage.withnews.jp/2014/08/17/5/b4/5b4bd1e0.jpg
			// https://s3-ap-northeast-1.amazonaws.com/storage.withnews.jp/2016/10/06/9/c8/9c867eb1-ml.jpg
			//   https://s3-ap-northeast-1.amazonaws.com/storage.withnews.jp/2016/10/06/9/c8/9c867eb1-l.jpg
			//   https://s3-ap-northeast-1.amazonaws.com/storage.withnews.jp/2016/10/06/9/c8/9c867eb1.jpg -- 3205x2133
			return src.replace(/-[a-z]+(\.[^/.]*)$/, "$1");
		}

		if (domain_nosub === "wowma.net" && domain.match(/ic[0-9]*-a\.wowma\.net/)) {
			// https://ic4-a.wowma.net/mi/gr/114/item5.goqsystem.com/goqdir/starriver/prodimg/30816_1.jpg
			//   http://item5.goqsystem.com/goqdir/starriver/prodimg/30816_1.jpg
			// https://ic4-a.wowma.net/mi/gr/115/item5.goqsystem.com/goqdir/starriver/prodimg/30816_2.jpg
			//   http://item5.goqsystem.com/goqdir/starriver/prodimg/30816_2.jpg
			// https://ic4-a.wowma.net/mi/w/1280/h/1280/q/90/bcimg1-a.wowma.net/plus/u10068283/pc/event/season/moccasin/img/mayumayu_img.jpg
			//   http://bcimg1-a.wowma.net/plus/u10068283/pc/event/season/moccasin/img/mayumayu_img.jpg
			// https://ic4-a.wowma.net/mis/gr/115/imgu-a.wowma.net/exu7/cb/1/11788337/13/mb/267355277_1.jpg
			//   http://imgu-a.wowma.net/exu7/cb/1/11788337/13/mb/267355277_1.jpg
			//   http://image.wowma.jp/11554363/img/srcl-9489.jpg
			return src.replace(/^[a-z]*:\/\/[^/]*\/mis?\/.*?\/([^/]*\.[^/]*\/.*)/, "http://$1");
		}

		if (domain_nowww === "sokuup.net") {
			// https://sokuup.net/imgm/soku_30203.jpg
			//   https://sokuup.net/imgs/soku_30203.jpg
			//   https://sokuup.net/img/soku_30203.jpg -- 4000x6016
			return src.replace(/\/img[a-z]\//, "/img/");
		}

		if (domain_nosub === "cosp.jp" && domain.match(/image[0-9]\.cosp\.jp/)) {
			// http://image7.cosp.jp/thumb/member/g/487/487029/12414133s.gif
			//   http://image7.cosp.jp/images/member/g/487/487029/12414133b.jpg
			//   http://image7.cosp.jp/images/member/g/487/487029/12414133.jpg
			// http://image7.cosp.jp/thumb/member/g/487/487029/12412384s.gif
			//   http://image7.cosp.jp/images/member/g/487/487029/12412384.jpg
			// https://image7.cosp.jp/thumb/member/g/208/208575/12524167m.jpg
			//   https://image7.cosp.jp/images/member/g/208/208575/12524167.jpg
			// https://image7.cosp.jp/images/member/g/350/350035/12015221_740.jpg
			//   https://image7.cosp.jp/images/member/g/350/350035/12015221.jpg
			return src
				.replace(/\/thumb\/(.*?\/[0-9]+)[a-z]\.(?:gif|jpg)$/, "/images/$1.jpg")
				.replace(/(\/images\/.*\/[0-9]+)_[0-9]+(\.[^/.]*)$/, "$1$2")
				.replace(/(\/[0-9]+)[a-z](\.[^/.]*)/, "$1$2");
		}

		if (domain_nowww === "gahag.net") {
			// can't have google's referrer
			// http://gahag.net/img/201605/11s/gahag-008493.jpg
			//   http://gahag.net/img/201605/11s/gahag-0084931896-1.jpg
			//   http://img01.gahag.net/201605/11o/gahag-0084931896.jpg
			// http://gahag.net/img/201605/12s/gahag-0085298715-1.jpg
			//   http://img01.gahag.net/201605/12o/gahag-0085298715.jpg
			// http://gahag.net/img/201608/27s/gahag-0119469310-1.jpg
			//   http://img01.gahag.net/201608/27o/gahag-0119469310.jpg
			return {
				url: src.replace(/:\/\/[^/]*\/img\/([^/]*)\/([0-9]+)[a-z]\/([^-/]+-[0-9]+)-[0-9](\.[^/.]*)/,
								 "://img01.gahag.net/$1/$2o/$3$4"),
				headers: {
					Referer: "http://gahag.net/",
				}
			};
		}

		if (domain === "img-cdn.jg.jugem.jp") {
			// http://img-cdn.jg.jugem.jp/584/719314/20131206_802592_t.jpg
			//   http://img-cdn.jg.jugem.jp/584/719314/20131206_802592.jpg
			//   http://img-cdn.jg.jugem.jp/584/719314/20131206_802592.jpg?guid=ON&view=mobile&tid=1 -- no difference
			return src.replace(/_[a-z](\.[^/.]*)$/, "$1");
		}

		if (domain === "public.muragon.com") {
			// https://public.muragon.com/6phbmj9m/16q9y7i0/crop/270x270.png
			//   https://public.muragon.com/6phbmj9m/16q9y7i0.png
			// https://public.muragon.com/6phbmj9m/y8zyxnww/resize/640x640.jpg?1508627308000
			//   https://public.muragon.com/6phbmj9m/y8zyxnww.jpg?1508627308000
			return src.replace(/\/(?:crop|resize)\/[0-9]+x[0-9]+(\.[^/.]*)$/, "$1");
		}

		if (domain === "base-ec2if.akamaized.net") {
			// https://base-ec2if.akamaized.net/w=76,a=0,q=90,u=1/images/item/origin/d38861ba6e9f258591fbbb495f133a62.jpg
			//   https://base-ec2if.akamaized.net/images/item/origin/d38861ba6e9f258591fbbb495f133a62.jpg
			return src.replace(/(:\/\/[^/]*\/)[^/]*[a-z]=[0-9][^/]*\//, "$1");
		}

		if (domain_nosub === "imageflux.jp" ||
			// thanks to jloqfjgk on github: https://github.com/qsniyg/maxurl/issues/413
			// https://static.mercdn.net/c!/w=240/item/detail/orig/photos/m81805157460_1.jpg?1598779743
			//   https://static.mercdn.net/item/detail/orig/photos/m81805157460_1.jpg?1598779743
			domain === "static.mercdn.net" ||
			domain === "img-comic.pximg.net" ||
			// https://public-img-comic.pximg.net/c!/q=90,f=webp%3Ajpeg/images/story_thumbnail/3JqLicKWlCHhXpGYXl1N/79984.jpg?20200827121813
			//   https://public-img-comic.pximg.net/images/story_thumbnail/3JqLicKWlCHhXpGYXl1N/79984.jpg?20200827121813
			domain === "public-img-comic.pximg.net") {
			// https://p1-e6eeae93.imageflux.jp/c!/a=2,w=460,h=460/mytown/6761e7b2ef74bca9a858.jpeg
			//   https://p1-e6eeae93.imageflux.jp/mytown/6761e7b2ef74bca9a858.jpeg
			newsrc = src.replace(/\/c!\/+[^/]*[a-z]=[0-9a-z%A-Z]+[^/]*\/+/, "/");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "img-comic.pximg.net") {
			// from: https://comic.pixiv.net/viewer/stories/79984
			return {
				url: src,
				imu_mode: "xhr",
				headers: {
					Referer: "https://comic.pixiv.net/",
					Origin: "https://comic.pixiv.net"
				}
			};
		}

		if (domain_nosub === "bloguru.com" &&
			string_indexof(src, "/userdata/") >= 0) {
			// http://jp.bloguru.com/userdata/173/173/201504062228130.JPG
			//   http://jp.bloguru.com/userdata/173/173/orig_201504062228130.JPG
			// http://en.bloguru.com/userdata/173/173/201504062228130.JPG
			//   http://en.bloguru.com/userdata/173/173/orig_201504062228130.JPG
			return src.replace(/\/([^/_]*)$/, "/orig_$1");
		}

		if (domain === "www.atpress.ne.jp") {
			// https://www.atpress.ne.jp/releases/112459/js_img_112459_3.jpg
			//   https://www.atpress.ne.jp/releases/112459/img_112459_3.jpg
			// https://www.atpress.ne.jp/releases/112459/js_img_112459_2.jpg
			//   https://www.atpress.ne.jp/releases/112459/img_112459_2.jpg
			// thanks to nimbuz on discord for reporting:
			// https://www.atpress.ne.jp/releases/264569/LL_img_264569_2.jpg -- 610x870
			//   https://www.atpress.ne.jp/releases/264569/img_264569_2.jpg -- 1864x2659
			// https://www.atpress.ne.jp/releases/264569/LL_img_264569_1.jpg -- 610x439
			//   https://www.atpress.ne.jp/releases/264569/img_264569_1.jpg -- 2122x1530
			return src.replace(/(\/[0-9]+\/)[a-zA-Z]{2}_(img_[0-9]+[^/]*\.[^/.]*)$/, "$1$2");
		}

		if (domain === "img-proxy.blog-video.jp" ||
			// https://api.pddataservices.com/images?url=http://storage.torontosun.com/v1/dynamic_resize/sws_path/suns-prod-images/1297884869613_ORIGINAL.jpg%3Fsize=520x&w=840&h=560
			domain === "api.pddataservices.com") {
			// https://img-proxy.blog-video.jp/images?url=http%3A%2F%2Fuguisu.skr.jp%2Frecollection%2Fimg%2Fyudai121014.jpg
			//   http://uguisu.skr.jp/recollection/img/yudai121014.jpg
			return decodeURIComponent(src.replace(/^[a-z]+:\/\/[^/]*\/images.*?[?&]url=([^&]*).*?$/, "$1"));
		}

		if (domain === "cdn.otamart.com") {
			// https://cdn.otamart.com/item-picture/18188083/0-1517534918796-thumbnail.jpg
			//   https://cdn.otamart.com/item-picture/18188083/0-1517534918796.jpg
			return src.replace(/-thumbnail(\.[^/.]*)$/, "$1");
		}

		if (domain === "www.pakutaso.com") {
			// https://www.pakutaso.com/shared/img/thumb/yuseiIMGL2091_TP_V1.jpg
			//   https://www.pakutaso.com/shared/img/thumb/yuseiIMGL2091.jpg
			return src.replace(/(\/img\/thumb\/[^/_.]*)_[^/.]*(\.[^/.]*)$/, "$1$2");
		}

		if (domain === "cdn.atwiki.jp" ||
			// down, moved to ppe.pl
			// https://www.neosite.pl/upload/user/15/89/33/small_1589337670.jpg
			//   https://www.neosite.pl/upload/user/15/89/33/1589337670.jpg
			//(domain_nowww === "neosite.pl" && string_indexof(src, "/upload/user/") >= 0) ||
			// http://kinohron.mskcentrum.sk/data-files/kino/photogallery/155/small_3301.jpg
			//   http://kinohron.mskcentrum.sk/data-files/kino/photogallery/155/3301.jpg -- larger, but adds watermark
			(domain === "kinohron.mskcentrum.sk" && string_indexof(src, "/data-files/") >= 0)) {
			// https://cdn.atwiki.jp/game/news/image/1553/small_2e8123c6-479e-4e49-a787-f20a36f5767e.jpg
			//   https://cdn.atwiki.jp/game/news/image/1553/2e8123c6-479e-4e49-a787-f20a36f5767e.jpg
			return src.replace(/\/small_([^/]*)$/, "/$1");
		}

		if (domain === "pliki.ppe.pl") {
			// https://pliki.ppe.pl/storage/a0bce5ee7339d0025523/a0bce5ee7339d0025523@cover.jpg
			//   https://pliki.ppe.pl/storage/a0bce5ee7339d0025523/a0bce5ee7339d0025523@widescreen.jpg
			//   https://pliki.ppe.pl/storage/a0bce5ee7339d0025523/a0bce5ee7339d0025523.jpg -- 1200x675
			return src.replace(/(\/storage\/+[0-9a-f]+\/+[0-9a-f]+)@[a-z]+\./, "$1.");
		}

		if (domain === "getfile.fmkorea.com") {
			// https://getfile.fmkorea.com/getfile.php?code=a210413ef29c311aa833f8b468e8d4dc&file=http%3A%2F%2Fimg.ruliweb.com%2Fdata%2Fnews18%2F06m%2F12%2Fmulti%2Fmai01s.jpg&r=
			//   http://img.ruliweb.com/data/news18/06m/12/multi/mai01s.jpg
			return decodeURIComponent(src.replace(/.*?\/getfile\.php.*?[?&]file=([^&]*).*/, "$1"));
		}

		if (domain === "img.ruliweb.com" ||
			// http://img.korewaeroi.com/imgs07/1533651606/1_3s.jpg
			//   http://img.korewaeroi.com/imgs07/1533651606/1_3.jpg
			domain === "img.korewaeroi.com" ||
			// https://abc.imgxyqpdrs.xyz/tokimeki/img/otakara/201709/amuro_namie/ha170922-amuro_namie-50s.jpg
			//   https://abc.imgxyqpdrs.xyz/tokimeki/img/otakara/201709/amuro_namie/ha170922-amuro_namie-50.jpg
			domain === "abc.imgxyqpdrs.xyz" ||
			// http://www.koreanartist.jp/img/kasyu/000202s.jpg
			//   http://www.koreanartist.jp/img/kasyu/000202.jpg
			(domain_nowww === "koreanartist.jp" && string_indexof(src, "/img/") >= 0 && src.match(/\/[0-9]+s\./)) ||
			// www.image-bankingf25.com doesn't exist, only -www works
			// http://image-bankingf25.com/tokimeki/img/otakara/201702/mikami_yua/ie17021605-mikami_yua-06s.jpg
			//   http://image-bankingf25.com/tokimeki/img/otakara/201702/mikami_yua/ie17021605-mikami_yua-06.jpg
			domain === "image-bankingf25.com") {
			// http://img.ruliweb.com/data/news18/06m/12/multi/mai01s.jpg
			//   http://img.ruliweb.com/data/news18/06m/12/multi/mai01.jpg
			return src.replace(/s(\.[^/.]*)(?:[?#].*)?$/, "$1");
		}

		if (domain_nosub === "dtiblog.com" && /^[0-9]*\./.test(domain)) {
			// http://20.dtiblog.com/s/sstommy2/file/0701-5-7s.jpg
			//   http://20.dtiblog.com/s/sstommy2/file/0701-5-7.jpg
			// http://2.dtiblog.com/t/trackbackhonsya/file/eric-charlizes.jpg
			//   http://2.dtiblog.com/t/trackbackhonsya/file/eric-charlize.jpg
			// https://101.dtiblog.com/s/scarlett/file/Caribbeancom_111913-482_01_thumb.jpg
			//   https://101.dtiblog.com/s/scarlett/file/Caribbeancom_111913-482_01.jpg
			return src.replace(/(?:_thumb|s)(\.[^/.]+)(?:[?#].*)?$/, "$1");
		}

		if (domain === "img2.ruliweb.com") {
			// http://img2.ruliweb.com/mypi/gup/a/1/56/s/55816063001.jpg
			//   http://img2.ruliweb.com/mypi/gup/a/1/56/o/55816063001.jpg
			return src.replace(/(\/mypi\/gup\/a\/[0-9]+\/[0-9]+\/)[a-z]+(\/[0-9]+\.[^/.]*)$/, "$1o$2");
		}

		if (domain === "file.thisisgame.com") {
			// http://file.thisisgame.com/upload/nboard/news/2017/06/27/s_20170627110032_1557.jpg
			//   http://file.thisisgame.com/upload/nboard/news/2017/06/27/20170627110032_1557.jpg
			return src.replace(/\/s_([0-9]+_[0-9]+\.[^/.]*)$/, "/$1");
		}

		if (domain === "www.op.gg") {
			// http://www.op.gg/forum/outImage/https://attach.s.op.gg/forum/20180426004418_551404.png
			//   https://attach.s.op.gg/forum/20180426004418_551404.png
			return src.replace(/^.*?\/forum\/outImage\/(http.*)$/, "$1");
		}

		if (domain === "ssproxy.ucloudbiz.olleh.com" ||
			// https://s.gae9.com/trend/1e2099297cf9c17e.small
			//   https://s.gae9.com/trend/1e2099297cf9c17e.orig
			domain === "s.gae9.com") {
			// http://ssproxy.ucloudbiz.olleh.com/v1/AUTH_6a92e249-183a-47ef-870b-b6f2fb771cfa/gae9/trend/f4867c07f1d60768.small
			//   http://ssproxy.ucloudbiz.olleh.com/v1/AUTH_6a92e249-183a-47ef-870b-b6f2fb771cfa/gae9/trend/f4867c07f1d60768.orig
			return src.replace(/\.[a-z]*(?:[?#].*)?$/, ".orig");
		}

		if (domain_nowww === "artstation.com") {
			// https://www.artstation.com/assets/overlay-no-triangle-1c31439ce6ef3bf7ce31abe68712cd01.png
			if (/\/assets\/+overlay-no-triangle-[0-9a-f]+\./.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}
		}

		if (domain_nosub === "artstation.com" && domain.match(/cdn[a-z0-9]*\.artstation\.com/)) {
			// https://cdnb.artstation.com/p/assets/images/images/001/982/361/small/kevin-lourdel-2012-06-12-09-53-11.jpg?1455539239
			//   https://cdnb.artstation.com/p/assets/images/images/001/982/361/large/kevin-lourdel-2012-06-12-09-53-11.jpg?1455539239
			// there's also /original/, but it's forbidden for some?
			// https://cdnb.artstation.com/p/assets/images/images/011/367/353/original/alexandra-lavrentive-cold-winter-gif.gif -- works
			// https://cdna.artstation.com/p/assets/images/images/013/337/602/20181009231052/small_square/ruan-jia-2018-09-21-2-34-08.jpg?1539144652
			//   https://cdna.artstation.com/p/assets/images/images/013/337/602/large/ruan-jia-2018-09-21-2-34-08.jpg?1539144652
			// https://cdna.artstation.com/p/assets/images/images/016/493/858/20190312025510/smaller_square/thales-simonato-francois-boquet-leopard-sx-hdrib.jpg?1552377310
			//   https://cdna.artstation.com/p/assets/images/images/016/493/858/large/thales-simonato-francois-boquet-leopard-sx-hdrib.jpg?1552377310
			// https://cdna.artstation.com/p/assets/images/images/016/242/734/20190301045023/micro_square/zephyr-zheng-terra2.jpg?1551437424
			//   https://cdna.artstation.com/p/assets/images/images/016/242/734/large/zephyr-zheng-terra2.jpg?1551437424
			// https://cdnb.artstation.com/p/assets/images/images/008/668/847/large/brady-goldsmith-goddessesofcosplay1lizkatzvariantlow.jpg?1514426043
			// https://cdna.artstation.com/p/assets/images/images/027/308/686/4k/lyuba-dashinova-sabrina2.jpg -- thanks to remlap on discord
			regex = /(\/assets\/+(?:images|covers)\/+images\/+[0-9]{3}\/+[0-9]{3}\/+[0-9]{3}\/+)(?:[0-9]+\/+)?(?:small(?:er)?|micro|medium|large|4k)(?:_square)?\/([^/]*)$/;

			if (regex.test(src)) {
				return [
					src.replace(regex, "$1original/$2"),
					src.replace(regex, "$14k/$2"),
					src.replace(regex, "$1large/$2")
				];
			}

			// thanks to snec on discord for reporting:
			// https://www.artstation.com/prints/hd_metal_print/zYG9/retrowave-1986#hd_metal_print_size_12x18_no_frame
			// https://cdna.artstation.com/p/marketplace/printed_product_covers/000/046/662/downscaled/file.jpg -- 1200x800
			//   https://cdna.artstation.com/p/marketplace/printed_product_covers/000/046/662/white_wrap_small/file.jpg
			//   https://cdna.artstation.com/p/marketplace/printed_product_covers/000/046/662/white_wrap_big/file.jpg
			//   https://cdna.artstation.com/p/marketplace/printed_product_covers/000/046/662/art_print_small/file.jpg
			//   https://cdna.artstation.com/p/marketplace/printed_product_covers/000/046/662/art_print_big/file.jpg
			//   https://cdna.artstation.com/p/marketplace/printed_product_covers/000/046/662/hd_metal_print_scene/file.jpg?1596106561
			//   https://cdna.artstation.com/p/marketplace/printed_product_covers/000/046/662/big_image/file.jpg -- 1920x2880
			return src.replace(/(\/marketplace\/+printed_product_covers\/+(?:[0-9]{3}\/+){3})(?:downscaled|(?:white_wrap|art_print)_(?:small|big)|hd_metal_print_scene)\/+/, "$1big_image/");
		}

		if (domain === "static.cosplay-it.com") {
			// forces download (binary/octet-stream)
			// https://static.cosplay-it.com/b391a71e-4306-46df-9d3e-ff61e3c2f73b_medium.jpg
			//   https://static.cosplay-it.com/b391a71e-4306-46df-9d3e-ff61e3c2f73b.jpg -- forces download
			return src.replace(/(\/[-0-9a-f]*)_[a-z]+(\.[^/.]*)/, "$1$2");
		}

		if (domain === "a.fsdn.com") {
			// https://a.fsdn.com/con/app/proj/paintball2/screenshots/build036_midnight2_1.jpg/245/183/1
			//   https://a.fsdn.com/con/app/proj/paintball2/screenshots/build036_midnight2_1.jpg
			return src.replace(/(\/screenshots\/[^/]*)\/[0-9]+\/.*/, "$1");
		}

		if (domain === "media.moddb.com" ||
			// https://cdn.dbolical.com/cache/images/articles/1/263/262221/crop_120x90/ModDB_Background.jpg
			//   https://cdn.dbolical.com/images/articles/1/263/262221/ModDB_Background.jpg
			domain === "cdn.dbolical.com" ||
			domain === "media.indiedb.com") {
			// http://media.moddb.com/cache/images/mods/1/4/3463/crop_120x90/62199.jpg
			//   http://media.moddb.com/cache/images/mods/1/4/3463/thumb_620x2000/62199.jpg
			//   http://media.moddb.com/images/mods/1/4/3463/62199.jpg
			// http://media.indiedb.com/cache/images/articles/1/253/252120/crop_120x90/DevStream_Thumbnail2.png
			//   http://media.indiedb.com/images/articles/1/253/252120/DevStream_Thumbnail2.png
			// https://media.moddb.com/cache/images/mods/1/42/41342/thumb_620x2000/WD_Living_City_Mod_1.9_TRAILER.mp4.jpg
			//   https://media.moddb.com/videos/mods/1/42/41342/WD_Living_City_Mod_1.9_TRAILER.mp4
			newsrc = src.replace(/\/cache\/+images\/(.*?)\/[a-z]+_[0-9]+[^/]*(\/[^/]*\.[^/.]*)$/, "/images/$1$2");
			if (newsrc !== src)
				return newsrc;

			newsrc = src.replace(/\/images\/+(.*?)\.mp4\.jpg(?:[?#].*)?$/, "/videos/$1.mp4");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "thumb.modcdn.io") {
			// https://thumb.modcdn.io/mods/ce36/2616264/crop_320x180/int_preview_v5_1.jpg
			//   https://thumb.modcdn.io/mods/ce36/2616264/thumb_1020x2000/int_preview_v5_1.jpg
			//   https://image.modcdn.io/mods/ce36/2616264/int_preview_v5_1.jpg
			// https://thumb.modcdn.io/games/0de5/3992/crop_64x64/icon.jpg
			//   https://image.modcdn.io/games/0de5/3992/icon.jpg
			return src.replace(/:\/\/thumb\.(.*\/)(?:crop|thumb)_[0-9]+x[0-9]+\/+/, "://image.$1");
		}

		if (domain === "static.gamefront.com" ||
			// http://www.wallpaperawesome.com/wallpapers-awesome/wallpapers-anime-manga-japan-cartoons-awesome/thumbnails/wallpaper-anime-manga-japan-cartoon-comic-awesome-184.jpg
			//   http://www.wallpaperawesome.com/wallpapers-awesome/wallpapers-anime-manga-japan-cartoons-awesome/wallpaper-anime-manga-japan-cartoon-comic-awesome-184.jpg
			domain_nowww === "wallpaperawesome.com" ||
			// http://ukstockingsex.com/galleries/jim/sylvia/thumbnails/001.jpg
			//   http://ukstockingsex.com/galleries/jim/sylvia/001.jpg
			(domain_nowww === "ukstockingsex.com" && string_indexof(src, "/galleries/") >= 0) ||
			// https://cg.adultwork.com/G12/thumbnails/5928554.jpg
			//   https://cg.adultwork.com/G12/5928554.jpg -- 4080x2720
			domain === "cg.adultwork.com") {
			// https://static.gamefront.com/storage/images/games/thumbnails/Hd6mCPO4MFbqTI9c75olYsSgVXv5Za7EjEheIZ2L.jpeg
			//   https://static.gamefront.com/storage/images/games/Hd6mCPO4MFbqTI9c75olYsSgVXv5Za7EjEheIZ2L.jpeg
			return src.replace("/thumbnails/", "/");
		}

		if (domain === "thumb.test.mod.io" ||
			// https://thumb.mod.io/mods/1ba7/93437/crop_320x180/logo.png
			//   https://image.mod.io/mods/1ba7/93437/logo.png
			domain === "thumb.mod.io") {
			// https://thumb.test.mod.io/mods/ca81/866/thumb_1020x2000/modio-bg.jpg
			//   https://image.test.mod.io/mods/ca81/866/modio-bg.jpg
			return src.replace(/:\/\/thumb\.([^/]*\..*?\/)[a-z]+_[0-9]+[^/]*\/([^/]*)$/, "://image.$1$2");
		}

		if (domain_nosub === "scirra.net" && domain.match(/static[0-9]*\.scirra\.net/)) {
			// https://static4.scirra.net/avatars/128/eadc0da9f707ff5a5a5195d405639f71.png
			//   https://static4.scirra.net/avatars/256/eadc0da9f707ff5a5a5195d405639f71.png
			// error when using size 0:
			// https://pastebin.com/UkcRAMwt
			return src.replace(/\/avatars\/[0-9]+\//, "/avatars/256/");
		}

		if (domain === "cdn.gamer-network.net" ||
			// https://d2skuhm0vrry40.cloudfront.net/2018/articles/2018-09-27-16-11/pokemon_milan_fashion_week_2.jpg/EG11/resize/300x-1/quality/75/format/jpg
			//   https://d2skuhm0vrry40.cloudfront.net/2018/articles/2018-09-27-16-11/pokemon_milan_fashion_week_2.jpg
			domain === "d2skuhm0vrry40.cloudfront.net") {
			// https://cdn.gamer-network.net/2018/articles/2018-04-25-13-25/fifa.png/EG11/resize/690x-1/quality/75/format/jpg
			//   https://cdn.gamer-network.net/2018/articles/2018-04-25-13-25/fifa.png
			// https://cdn.gamer-network.net/2013/articles//a/1/5/9/9/9/4/8/The_Crew_002.jpg.jpg/EG11/thumbnail/115x64/quality/60
			//   https://cdn.gamer-network.net/2013/articles//a/1/5/9/9/9/4/8/The_Crew_002.jpg.jpg
			return src.replace(/(\.[^/.]*)\/EG[0-9]+\/.*/, "$1");
		}

		if (domain_nosub === "wikiart.org" && domain.match(/uploads[0-9]*\.wikiart\.org/)) {
			// https://uploads5.wikiart.org/images/anton-melbye/laguna-di-venezia-1878.jpg!PinterestSmall.jpg
			//   https://uploads5.wikiart.org/images/anton-melbye/laguna-di-venezia-1878.jpg
			return src.replace(/![^/]*$/, "");
		}

		if ((domain_nosub === "fdncms.com" ||
			 // https://images1.miaminewtimes.com/imager/u/745x420/10228444/https_3a_2f_2fcdn.evbuc.com_2fimages_2f42846199_2f213046196680_2f1_2foriginal.jpg_h_200_w_450_rect_0_2c50_2c1542_2c771_s_5cbbeb572f467a67fed17f3f68594108
			 //   https://images1.miaminewtimes.com/imager/u/original/10228444/https_3a_2f_2fcdn.evbuc.com_2fimages_2f42846199_2f213046196680_2f1_2foriginal.jpg_h_200_w_450_rect_0_2c50_2c1542_2c771_s_5cbbeb572f467a67fed17f3f68594108
			 //   https://cdn.evbuc.com/images/42846199/213046196680/1/original.jpg
			 // improper, but still works
			 // https://images1.miaminewtimes.com/imager/u/original/10228444/https_3a_2f_2fcdn.evbuc.com_2fimages_2f42846199_2f213046196680_2f1_2foriginal.jpg_h_200_w_450_rect_0_2c50_2c1542_2c771_s_5cbbeb572f467a67fed17f3f68594108/https:_2f_2fcdn.evbuc.com_2fimages_2f42846199_2f213046196680_2f1_2foriginal.jpg_h_200_w_450_rect_0_2c50_2c1542_2c771_s_5cbbeb572f467a67fed17f3f68594108
			 domain_nosub === "miaminewtimes.com" ||
			 // https://images1.houstonpress.com/imager/u/745x420/9795106/10-19_745x420.jpg
			 //   https://images1.houstonpress.com/imager/u/original/9795106/10-19_745x420.jpg
			 domain_nosub === "houstonpress.com" ||
			 // https://images1.laweekly.com/imager/u/745xauto/7348078/nocturnal-wonderland-2016-arrests.jpg
			 //   https://images1.laweekly.com/imager/u/original/7348078/nocturnal-wonderland-2016-arrests.jpg
			 domain_nosub === "laweekly.com" ||
			 // thanks to anonymous for reporting:
			 // https://media2.cltampa.com/cltampa/imager/u/golden-s/12084048/scarlxrd_fb.5d81399ae3acc.png
			 //   https://media2.cltampa.com/cltampa/imager/u/original/12084048/scarlxrd_fb.5d81399ae3acc.png
			 domain_nosub === "cltampa.com" ||
			 // https://images1.phoenixnewtimes.com/imager/u/745x420/10442190/hidden_gems.jpg
			 //   https://images1.phoenixnewtimes.com/imager/u/original/10442190/hidden_gems.jpg
			 domain_nosub === "phoenixnewtimes.com") &&
			domain.match(/^(?:images|media)[0-9]*\./)) {
			// https://media2.fdncms.com/stranger/imager/u/small/26096836/1524685866-nether_render_2.jpg
			//   https://media2.fdncms.com/stranger/imager/u/original/26096836/1524685866-nether_render_2.jpg
			// https://media2.fdncms.com/stranger/imager/u/small/24700385/seventeen.jpg
			//   https://media2.fdncms.com/stranger/imager/u/original/24700385/seventeen.jpg
			//return src.replace(/\/imager\/u\/[a-z]+\//, "/imager/u/original/");
			//return src.replace(/(\/imager\/[^/]*\/)[^/]*\//, "$1original/");
			newsrc = src.replace(/\/imager\/u\/[^/]*\/([0-9]+\/[^/]*)(?:\/.*)?/, "/imager/u/original/$1");
			if (newsrc !== src)
				return newsrc;

			if (src.match(/\/imager\/u\/[^/]*\/[0-9]+\/https?_3[aA]/)) {
				newsrc = src
					.replace(/.*?\/imager\/u\/[^/]*\/[0-9]+\/(https?_3[aA].*\.[^/._]*)(?:_[^/]*)?$/, "$1")
					.replace(/_([0-9a-fA-F][0-9a-fA-F])/g, "%$1");
				newsrc = decodeURIComponent(newsrc);
				return newsrc;
			}
		}

		if (domain === "images.techhive.com" ||
			domain === "images.idgesg.net") {
			// https://images.techhive.com/images/article/2016/10/20161010210440_1-100687367-large.jpg
			//   https://images.techhive.com/images/article/2016/10/20161010210440_1-100687367-orig.jpg
			// https://images.techhive.com/images/article/2016/10/20161010204135_1-100687365-carousel.idge.jpg
			//   https://images.techhive.com/images/article/2016/10/20161010204135_1-100687365-orig.jpg
			// https://images.idgesg.net/images/article/2018/02/ryzen_3_2200g_3-100748962-large.jpg
			//   https://images.idgesg.net/images/article/2018/02/ryzen_3_2200g_3-100748962-orig.jpg
			return src.replace(/-[a-z]+(?:\.[^/.]*)?(\.[^/.]*)$/, "-orig$1");
		}

		if (domain_nosub === "rimg.com.tw" ||
			// http://b0.rimg.tw/wishseed/84c6485d_s.jpg
			//   http://b0.rimg.tw/wishseed/84c6485d.jpg
			// http://pcdn1.rimg.tw/photos/2906507_5j6ijbh_l.png?131541
			//   http://pcdn1.rimg.tw/photos/2906507_5j6ijbh_o.png?131541 -- removing _l doesn't work
			domain_nosub === "rimg.tw" ||
			// http://photo.roodo.com/photos/2830061_1frolhm_l.jpg?291733
			//   http://photo.roodo.com/photos/2830061_1frolhm_o.jpg?291733
			domain === "photo.roodo.com" ||
			// https://img.ruten.com.tw/s1/a/b0/15/21308219439125_793.jpg
			domain === "img.ruten.com.tw") {
			// https://a.rimg.com.tw/s1/a/b0/15/21308219439125_793_m.jpg

			if (src.match(/(\/photos\/[0-9]+_[0-9a-z]+_)[a-z](\.[^/.]*)$/)) {
				return src.replace(/(\/photos\/[0-9]+_[0-9a-z]+_)[a-z](\.[^/.]*)$/, "$1o$2");
			}

			return {
				url: src.replace(/_[a-z](\.[^/.]*)$/, "$1"),
				headers: {
					Referer: "https://goods.ruten.com.tw/item/show"
				},
				referer_ok: {
					same_domain: true
				}
			};
		}

		if (domain === "buy.line-scdn.net") {
			// https://buy.line-scdn.net/d9ae5f0c/s/wb/images/2AA7830B6AA9A10B8FBA21C36BF8CF28A36BAB1D
			//   https://s.yimg.com/wb/images/2AA7830B6AA9A10B8FBA21C36BF8CF28A36BAB1D
			// https://buy.line-scdn.net/d9ae5f0c/s/ut/api/res/1.2/jGyoWt7od2NeNBE5FWHtLA--~B/dz02MDA7aD02MDA7cT04MTtmaT1maXQ7YXBwaWQ9eXR3bWFsbA--/http://imgcld.zenfs.com:80/ps_image_prod/item/p03761821666-item-0338xf3x0600x0600-m.jpg
			//   https://s.yimg.com/ut/api/res/1.2/jGyoWt7od2NeNBE5FWHtLA--~B/dz02MDA7aD02MDA7cT04MTtmaT1maXQ7YXBwaWQ9eXR3bWFsbA--/http://imgcld.zenfs.com:80/ps_image_prod/item/p03761821666-item-0338xf3x0600x0600-m.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/[a-f0-9]+\/s\//, "https://s.yimg.com/");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nosub === "hc360.cn" && domain.match(/img[0-9]*\.hc360\.cn/)) {
			// https://img006.hc360.cn/m7/M01/9C/9B/wKhQpFczDoOEFjnwAAAAAFJvURI463.jpg..400x400.jpg
			//   https://img006.hc360.cn/m7/M01/9C/9B/wKhQpFczDoOEFjnwAAAAAFJvURI463.jpg
			return src.replace(/(\.[^/.]*)\.[^/]*$/, "$1");
		}

		if (domain_nosub === "ganref.jp" && domain.match(/photo[0-9]*\.ganref\.jp/)) {
			// https://photo1.ganref.jp/photo/0/7033e5f31807519185c42ec12a0e3b87/thumb5.jpg
			//   https://photo1.ganref.jp/photo/0/7033e5f31807519185c42ec12a0e3b87/original.jpg
			return src.replace(/(\/[0-9a-f]+\/)thumb[0-9]*(\.[^/.]*)$/, "$1original$2");
		}

		if (domain === "img.cdn.nimg.jp") {
			// http://news.nicovideo.jp/watch/nw3468901
			// https://img.cdn.nimg.jp/s/niconews/articles/images/3468901/45213edfb355c57cd4794f0ef0c83a3463a6fdb540ccf59db7d2e094c0427a77f183c2c622560c45fa676d4febc525f15ce3aeb95a623b7533a96750725290c6/300x300s_FFFFFFFF?key=293b5fc6c8c97c8a96505ff25eadda2e537c4b415566571114ed309cca61acfb
			//   https://dcdn.cdn.nimg.jp/niconews/articles/images/3468901/45213edfb355c57cd4794f0ef0c83a3463a6fdb540ccf59db7d2e094c0427a77f183c2c622560c45fa676d4febc525f15ce3aeb95a623b7533a96750725290c6
			// https://img.cdn.nimg.jp/s/niconews/articles/images/2365358/2091988l.jpg/640x480s_FFFFFF?key=617a5b5376e6c089d5c966da650b799984cced8e591ca380692b40649b2c470e
			//   https://dcdn.cdn.nimg.jp/niconews/articles/images/2365358/2091988l.jpg
			return src.replace(/:\/\/img\.cdn\.nimg\.jp\/s\/(.*?\/images\/+[0-9]+\/+(?:[0-9a-f]+|[^/.]*\.[^/.]*))\/.*/,
							   "://dcdn.cdn.nimg.jp/$1");
		}

		if (domain_nosub === "photozou.jp") {
			// http://photozou.jp/photo/show/2422777/173992738?lang=ja
			// http://kura3.photozou.jp/pub/777/2422777/photo/173992771_thumbnail.v1524913392.jpg
			//   http://kura3.photozou.jp/pub/777/2422777/photo/173992771_org.v1524913392.jpg
			// http://kura1.photozou.jp/pub/777/2422777/photo/173992738_624.jpg
			//   http://kura1.photozou.jp/bin/photo/173992738/org.bin?size=1024
			//   http://kura1.photozou.jp/pub/777/2422777/photo/173992738_large.v1525158218.jpg
			//   http://kura1.photozou.jp/pub/777/2422777/photo/173992738_org.v1525158218.jpg
			return src
				.replace(/(\/photo\/[0-9]+\/org\.bin)\?.*$/, "$1")
				.replace(/(\/photo\/[0-9]+)_[a-z0-9]+(\.[^/]*)$/, "$1_org$2");
		}

		if (domain === "desktop.sakura.ne.jp" ||
			// http://kysiamesecat.sakura.ne.jp/sblo_files/new-world-47ft/image/048-a2f72-thumbnail2.jpg
			//   http://kysiamesecat.sakura.ne.jp/sblo_files/new-world-47ft/image/048-a2f72.jpg
			domain === "kysiamesecat.sakura.ne.jp") {
			// http://desktop.sakura.ne.jp/sblo_files/desktop/image/_MG_1072_DxO_raw-thumbnail2.jpg
			//   http://desktop.sakura.ne.jp/sblo_files/desktop/image/_MG_1072_DxO_raw.jpg
			return src.replace(/-thumbnail[0-9]*(\.[^/.]*)$/, "$1");
		}

		if ((domain_nowww === "ya.sakura.ne.jp" || domain === "mabi4751.orz.hm") &&
			string_indexof(src, "/~mabi/") >= 0) {
			// http://www.ya.sakura.ne.jp/~mabi/4751/
			//   http://www.ya.sakura.ne.jp/~mabi/etc/20180403/IMG_8319s.jpg
			//     http://www.ya.sakura.ne.jp/~mabi/etc/20180403/IMG_8319.jpg
			// http://www.ya.sakura.ne.jp/~mabi/etc/20200905B/IMG_8835m.jpg
			//   http://www.ya.sakura.ne.jp/~mabi/etc/20200905B/IMG_8835.jpg
			// http://mabi4751.orz.hm/~mabi/20110503F/index.html
			//   http://mabi4751.orz.hm/~mabi/20110503F/IMG_9905s.jpg
			//     http://mabi4751.orz.hm/~mabi/20110503F/IMG_9905s.jpg
			// http://mabi4751.orz.hm/~mabi/20100820B/index.html
			//   http://mabi4751.orz.hm/~mabi/20100820B/IMG_0119s.jpg
			//     http://mabi4751.orz.hm/~mabi/20100820B/IMG_0119.jpg
			return src.replace(/[sm](\.jpg|\.JPG)$/, "$1");
		}

		if (domain === "waganeko.sakura.ne.jp") {
			// http://waganeko.sakura.ne.jp/unko/public/image/ave/201304/.thumbnail/GXHvQJM.jpg.jpg
			//   http://waganeko.sakura.ne.jp/unko/public/image/ave/201304/GXHvQJM.jpg
			return src.replace(/\/\.thumbnail\/([^/]*\.[^/.]*)\.[^/.]*$/, "/$1");
		}

		if (domain_nosub === "storage-yahoo.jp") {
			// https://blogs.yahoo.co.jp/thssythssy/64651630.html
			// https://blog-001.west.edge.storage-yahoo.jp/res/blog-03-7e/thssythssy/folder/1591373/30/64651630/img_0_m?1481865302
			//   https://blog-001.west.edge.storage-yahoo.jp/res/blog-03-7e/thssythssy/folder/1591373/30/64651630/img_0?1481865302
			// https://blog-001.west.edge.storage-yahoo.jp/res/blog-03-7e/thssythssy/folder/1591373/97/64967897/img_0_thumb?1506177062
			//   https://blog-001.west.edge.storage-yahoo.jp/res/blog-03-7e/thssythssy/folder/1591373/97/64967897/img_0?1506177062
			return src.replace(/_(?:m|thumb)(\?.*)?$/, "$1");
		}

		if (domain === "static-mercari-jp-imgtr2.akamaized.net" ||
			// https://mercari-images.global.ssl.fastly.net/photos/m64465317108_1.jpg?1582464453&w=200&h=200&fitcrop&sharpen
			//   https://mercari-images.global.ssl.fastly.net/photos/m64465317108_1.jpg
			// https://mercari-images.global.ssl.fastly.net/thumb/members/730481941.jpg?1508697152
			//   https://mercari-images.global.ssl.fastly.net/members/730481941.jpg
			domain === "mercari-images.global.ssl.fastly.net") {
			// https://static-mercari-jp-imgtr2.akamaized.net/thumb/photos/m67374048071_1.jpg?1520960098
			//   https://static-mercari-jp-imgtr2.akamaized.net/photos/m67374048071_1.jpg?1520960098
			// https://static-mercari-jp-imgtr2.akamaized.net/thumb/members/583883227.jpg?1501875459
			//   https://static-mercari-jp-imgtr2.akamaized.net/members/583883227.jpg?1501875459 -- stretched
			// https://static-mercari-jp-imgtr2.akamaized.net/thumb/photos/m86027196730_1.jpg?1528127240
			//   https://static-mercari-jp-imgtr2.akamaized.net/photos/m86027196730_1.jpg?1528127240 -- 2448x3264
			return src
				.replace(/\/thumb\/+(photos|members)\/+/, "/$1/")
				.replace(/(\/(?:photos|members)\/.*?)(?:[?#].*)$/, "$1");
		}

		if (domain === "assets.mercari-shops-static.com") {
			// thanks to Froktime on github: https://github.com/qsniyg/maxurl/issues/1343
			// https://assets.mercari-shops-static.com/-/small/plain/DkShtigFFRbWXakBX2pjhd.jpg
			//   https://assets.mercari-shops-static.com/-/large/plain/DkShtigFFRbWXakBX2pjhd.jpg@jpg
			return src
				.replace(/(:\/\/[^/]+\/+-\/+large\/+[^/]+\/+[^/.]+\.[a-z]+)(?:@webp)?(?:[?#].*)?$/, "$1@jpg")
				.replace(/(:\/\/[^/]+\/+-\/+)small\/+/, "$1large/");
		}

		if (false && domain_nosub === "fbcdn.net" && /^scontent\.f[^/.]+\.fna\.fbcdn\./.test(domain) && options && options.do_request && options.cb) {
			// wip
			// https://www.facebook.com/Mahore.official.page/photos/a.1771049596262263.1073742012.148396778527561/1771049639595592/?type=3&theater
			// https://scontent.fcxh3-1.fna.fbcdn.net/v/t1.0-0/c0.0.200.200/p200x200/26804734_1771049639595592_724697207772414518_n.jpg?_nc_cat=0&oh=620d6a106e5646c7829532e0616e2c5f&oe=5B5EE91F
			// https://graph.facebook.com/1771049639595592?fields=images&access_token=
			// https://www.facebook.com/photo/download/?fbid=1771049639595592&ext=1525461615&hash=AeS2Z2X1LdqZYGmJ
			//   https://scontent.fcxh3-1.fna.fbcdn.net/v/t31.0-8/26756562_1771049639595592_724697207772414518_o.jpg?_nc_cat=0&oh=e184f1c97589b647994c3458cb20fb84&oe=5B5DF86F&dl=1
			// https://scontent.fyvr2-1.fna.fbcdn.net/v/t1.0-1/cp0/p50x50/1486791_550904851654663_569233636_n.jpg?....
			//   https://www.facebook.com/photo.php?fbid=550904851654663 -- m.facebook.com works too, but only returns 320x320 scaled

			// interesting discovery:
			// 117913229_2820753624812208_8699158882580754841_o (photo in post album)
			// image id: 2820753621478875
			// 2820753624812208 - 2820753621478875 = 3333333
			// urlid | imageid
			// 2820753624812208 | 2820753621478875
			// 2820753744812196 | 2820753741478863
			// 2820753861478851 | 2820753858145518
			// 2820753931478844 | 2820753928145511
			// 2820753984812172 | 2820753981478839
			// 1541839212663405 | 1541839209330072

			// 50477975_2158534177697768_6450249170090459136_o (profile pic)
			// image id: 2158534171031102
			// 2158534177697768 - 2158534171031102 = 6666666

			// below only works for profile pics (url matching is not a reliable way to find the id)
			match = src.match(/\/[0-9]+_([0-9]+)_[0-9]+_[a-z]+\.[^/.]+(?:[?#].*)?$/);
			if (match) {
				var fbid = match[1];

				var cache_key = "facebook_fbid:" + fbid;
				api_cache.fetch(cache_key, options.cb, function(done) {
					options.do_request({
						url: "https://www.facebook.com/photo.php?fbid=" + fbid,
						method: "GET",
						onload: function(result) {
							if (result.readyState !== 4)
								return;

							if (result.status !== 200) {
								console_error(result);
								return done(null, false);
							}

							var match = result.responseText.match(/\<div\s+class=\"hidden_elem\"\s*>.*?data-ploi=\"(https?:\/\/[^"]*?)\"/);
							if (!match) {
								console_warn("Unable to find match", result);
								return done(null, false);
							}

							return done(decode_entities(match[1]), 6*60*60);
						}
					});
				});

				return {
					waiting: true
				};
			}
		}

		if (domain_nowww === "facebook.com" ||
			domain === "m.facebook.com" ||
			domain === "mbasic.facebook.com") {
			var find_from_serverjs = function(obj, requireid) {
				var require = [];

				// bigpipe
				if (obj.pre_display_requires) {
					require = obj.pre_display_requires;
				} else {
					if (obj.require) {
						require = obj.require;
					} else {
						return null;
					}
				}

				var result = [];
				for (var i = 0; i < require.length; i++) {
					if (require[i][0] === requireid) {
						result.push(require[i]);
					}
				}

				if (result.length === 0)
					return null;

				return result;
			};

			var find_prefetched_from_serverjs = function(obj, find) {
				var prefetched = find_from_serverjs(obj, "RelayPrefetchedStreamCache");
				if (!prefetched)
					return null;

				if (!find)
					find = [];

				if (!is_array(find))
					find = [find];

				var result = [];
				for (var i = 0; i < prefetched.length; i++) {
					var pre = prefetched[i];
					var data = pre[3];
					//console_log("prefetched", i, data);

					if (find.length > 0) {
						var found = false;
						for (var j = 0; j < find.length; j++) {
							if (find[j].test(data[0])) {
								found = true;
								break;
							}
						}

						if (!found)
							continue;
					}

					result.push(data);
				}

				if (result.length === 0)
					return null;

				return result;
			};

			var get_fb_serverjs = function(cache_key, resp, find) {
				var regex = /\(new ServerJS\(\)\)\.handleWithCustomApplyEach\(ScheduledApplyEach,({"(?:define|require)":.*?\]\]})\);\}/;
				var global = new RegExp(regex as any as string, "g");

				var match = resp.responseText.match(global);
				if (!match) {
					console_error(cache_key, "Unable to find matches for", resp);
					return null;
				}

				var jsons = [];

				for (var i = 0; i < match.length; i++) {
					var m = match[i];

					var submatch = m.match(regex);

					try {
						var json = JSON_parse(submatch[1]);
						//console_log("serverjs", i, json);

						var prefetched = find_prefetched_from_serverjs(json, find);
						if (!prefetched)
							continue;

						for (var j = 0; j < prefetched.length; j++) {
							jsons.push(prefetched[j]);
						}
					} catch (e) {
						console_error(cache_key, e, {match: m, submatch: submatch, resp: resp});
					}
				}

				if (jsons.length === 0)
					return null;

				return jsons;
			};

			var find_prefetched_from_bigpipe = function(bigpipe, find) {
				if (!bigpipe.jsmods || !bigpipe.jsmods.pre_display_requires)
					return;

				return find_prefetched_from_serverjs(bigpipe.jsmods, find);
			};

			var find_jsmods_instances_from_bigpipe = function(bigpipe, find) {
				if (!bigpipe.jsmods || !bigpipe.jsmods.instances)
					return;

				var instances = bigpipe.jsmods.instances;
				//console_log(instances);

				var retinstances = [];

				for (var i = 0; i < instances.length; i++) {
					if (find.length > 0 && false) {
						var type = instances[i][1];
						var found = false;
						for (var j = 0; j < find.length; j++) {
							for (var k = 0; k < type.length; k++) {
								console_log(type[k]);
								if (find[j].test(type[k])) {
									found = true;
									break;
								}
							}
							if (found) break;
						}

						if (!found)
							continue;
					}

					retinstances.push(instances[i]);
				}

				if (retinstances.length === 0)
					return null;

				return retinstances;
			};

			var get_fb_bigpipe = function(cache_key, resp, find) {
				var regex = /requireLazy\(\["__bigPipe"\],\(function\(bigPipe\){bigPipe\.onPageletArrive\(({.*?})\);}\)\);/;
				var global = new RegExp(regex as any as string, "g");

				var match = resp.responseText.match(global);
				if (!match) {
					console_error(cache_key, "Unable to find matches for", resp);
					return null;
				}

				if (!find)
					find = [];

				if (!is_array(find))
					find = [find];

				var ourfind = [];
				for (var i = 0; i < find.length; i++) {
					ourfind.push(new RegExp(find[i].source.replace(/[$^]/g, "")));
				}

				var jsons = [];

				for (var i = 0; i < match.length; i++) {
					var m = match[i];

					var submatch = m.match(regex);

					// since fixup_js_obj_proper is very expensive, we do a preliminary run here
					if (ourfind.length > 0 && false) {
						var found = false;

						for (var j = 0; j < ourfind.length; j++) {
							console_log(ourfind[j]);
							if (ourfind[j].test(submatch[1])) {
								found = true;
								break;
							}
						}

						if (!found)
							break;
					}

					try {
						//var start = Date.now();
						var fixedup = fixup_js_obj_proper(submatch[1]);
						//console_log({
						//	submatch: submatch[1],
						//	fixup: fixedup,
						//	time: Date.now() - start
						//});
						var json = JSON_parse(fixedup);
						//console_log(json);

						//var instances = find_jsmods_instances_from_bigpipe(json, find);
						//console_log(instances);

						var prefetched = find_prefetched_from_bigpipe(json, find);
						//console_log(prefetched);
						if (prefetched)
							array_extend(jsons, prefetched);
					} catch (e) {
						console_error(cache_key, e, {match: m, submatch: submatch, resp: resp});
					}
				}

				if (jsons.length === 0)
					return null;

				return jsons;
			};

			var parse_newstyle_fb = function(cache_key, resp) {
				var serverjs = get_fb_serverjs(cache_key, resp, /^adp_CometPhotoRootQueryRelayPreloader_/);
				if (!serverjs) {
					console_error(cache_key, "Unable to find serverjs match for", resp);
					return null;
				}

				//console_log(serverjs);
				var json = serverjs[0];
				var data = json[1].__bbox.result.data;

				var currMedia = data.currMedia;

				// todo: support currMedia.container_story.post_id or currMedia.default_mediaset.(next|prev)Media

				var obj:BigImageInfoSObject = {
					extra: {
						page: resp.finalUrl
					}
				};

				if (currMedia.message && currMedia.message.text) {
					obj.extra.caption = currMedia.message.text;
				} else if (currMedia.accessibility_caption) {
					obj.extra.caption = currMedia.accessibility_caption;
				}

				obj.url = common_functions["instagram_norm_url"](currMedia.image.uri);

				return obj;
			};

			var parse_oldstyle_fb = function(cache_key, resp) {
				var match = resp.responseText.match(/\<div\s+class=\"hidden_elem\"\s*>.*?data-ploi=\"(https?:\/\/[^"]*?)\"/);
				if (!match) {
					console_error(cache_key, "Unable to find match for", resp);
					return null;
				}

				var obj:BigImageInfoObject = {
					extra: {
						page: resp.finalUrl
					}
				};

				obj.url = decode_entities(match[1]);

				return obj;
			};

			var parse_html_post = function(cache_key, resp, current_id) {
				var matches = match_all(resp.responseText, /<a rel="theater" ajaxify="([^"]+)"/);
				if (!matches) {
					console_error(cache_key, "Unable to find theater match for", resp);
					return null;
				}

				var links = [];

				array_foreach(matches, function(match, i) {
					var url = match[1];
					// let's remove some tracking
					url = url.replace(/[?#].*$/, "");
					url = urljoin("https://www.facebook.com/", url, true);

					links.push({
						url: url,
						is_current: i === current_id
					});
				});

				if (!links.length) {
					console_error(cache_key, "No photos found for", resp,  matches);
					return null;
				}

				return {
					url: links[current_id].url,
					is_pagelink: true,
					album_info: {
						type: "links",
						links: links
					}
				};
			};

			var query_facebook_post = function(uid, post_id, cb) {
				var cache_key = "facebook_post:" + uid + ":" + post_id;

				var url = "https://www.facebook.com/" + uid + "/posts/" + post_id;
				if (/^[0-9]{10,}$/.test(uid)) {
					url = "https://www.facebook.com/permalink.php?story_fbid=" + post_id + "&id=" + uid;
				}

				api_query(cache_key, {
					url: url,
					imu_mode: "document"
				}, cb, function(done, resp, cache_key) {
					var current_id = 0;
					var serverjs = get_fb_serverjs(cache_key, resp, [
						/^adp_CometSinglePostRootQueryRelayPreloader_/,
						/^adp_CometPagePostsRootHoistedStoryQueryRelayPreloader_/ // xpost
					]);
					if (!serverjs) {
						var html_parse = parse_html_post(cache_key, resp, 0);
						if (html_parse)
							return done(html_parse, 60*60);

						console_error(cache_key, "Unable to find serverjs match for", resp);
						return done(null, false);
					}

					var json = serverjs[0];
					var data = json[1].__bbox.result.data;
					var node;

					if ("node" in data) {
						node = data.node;
					} else if ("nodes" in data) { // hoisted story
						node = data.nodes[0];
					} else {
						console_error(cache_key, "Unable to find node from", data, json, resp);
						return done(null, false);
					}

					var story = node.comet_sections.content.story;
					if (story.attached_story)
						story = story.attached_story;

					var attachments = story.attachments;
					//console_log(attachments);
					for (var i = 0; i < attachments.length; i++) {
						try {
							var attachment = attachments[i].style_type_renderer.attachment;

							var album_info = null;

							if (attachment.all_subattachments) {
								var nodes = attachment.all_subattachments.nodes;
								attachment = nodes[current_id];

								album_info = {
									type: "links",
									links: []
								};
								for (var j = 0; j < nodes.length; j++) {
									var node = nodes[j];
									//console_log(node);
									var node_url = node.url || node.media.url;

									var media_url;
									try {
										var node_image = node.image || node.media.image;
										var media_url = node_image.uri;
									} catch (e) {
										console_error(e);
									}

									album_info.links.push({
										url: node_url,
										x_id: media_url,
										is_current: j === current_id
									});
								}
							}

							// videos contain the actual data in the media option itself (and the url is in attachment.url, not media.url), maybe cache?
							var url = attachment.url || attachment.media.url;
							var obj = {
								url: url,
								is_pagelink: true,
								album_info: album_info
							};
							return done(obj, 6*60*60);
						} catch (e) {
							console_error(cache_key, e);
						}
					}

					return done(null, false);
				});
			};

			var parse_facebook_post_url = function(url) {
				// https://www.facebook.com/permalink.php?story_fbid={post_id}&id={uid} -- uid has to be a number here
				// https://www.facebook.com/{uid}/posts/{post_id} -- uid must be the user-friendly username
				var match = url.match(/^[a-z]+:\/\/[^/]+\/+([^/]+)\/+posts\/+([0-9]+)(?::[0-9]+)?\/*(?:[?#].*)?$/);
				if (match) {
					return {
						uid: match[1],
						post_id: match[2]
					};
				}

				match = url.match(/^[a-z]+:\/\/[^/]+\/+(?:permalink|story)\.php\?/);
				if (match) {
					var queries = get_queries(url);
					if (queries.story_fbid && queries.id) {
						return {
							uid: queries.id,
							post_id: queries.story_fbid
						};
					}
				}

				return null;
			};

			newsrc = website_query({
				website_regex: [
					/^[a-z]+:\/\/[^/]+\/+[^/]+\/+photos\/+(?:[^/]+\/+)?([0-9]+)\/*(?:[?#].*)?$/,
					/^[a-z]+:\/\/[^/]+\/+photo(?:\/+|\.php)\?(?:.*&)?fbid=([0-9]+)(?:[&#].*)?$/
				],
				cache_key: "facebook_photo",
				query_for_id: function(id) {
					return {
						//url: "https://lookaside.fbsbx.com/lookaside/crawler/media/?media_id=" + id,
						url: "https://www.facebook.com/photo/?fbid=" + id, // needed for private photos
						imu_mode: "document"
					};
				},
				process: function(done, resp, cache_key) {
					var obj = parse_newstyle_fb(cache_key, resp);
					if (!obj) {
						obj = parse_oldstyle_fb(cache_key, resp);
					}

					if (obj) {
						return done(obj, 60*60);
					} else {
						return done(null, false);
					}
				}
			});
			if (newsrc) return newsrc;

			newsrc = website_query({
				website_regex: [
					/^[a-z]+:\/\/[^/]+\/+watch\/+\?(?:.*&)?v=([0-9]+)(?:&.*)?(?:[?#].*)?$/,
					/^[a-z]+:\/\/[^/]+\/+[^/]+\/+videos\/+([0-9]+)\/*(?:[?#].*)?$/
				],
				cache_key: "facebook_video",
				query_for_id: function(id) {
					return {
						url: "https://www.facebook.com/watch/?v=" + id,
						imu_mode: "document"
					};
				},
				process: function(done, resp, cache_key) {
					var results = get_fb_serverjs(cache_key, resp, [
						/^adp_CometVideoHomeInjectedFeedUnitQueryRelayPreloader_/,
						/^adp_CometTahoeRootQueryRelayPreloader_/
					]);

					if (!results) {
						results = get_fb_bigpipe(cache_key, resp, [
							/^adp_CometVideoHomeFeedRootQueryRelayPreloader_/,
							/^adp_CometVideoHomeInjectedFeedUnitQueryRelayPreloader_/
							// todo: when not logged in (jsmods.instances)
							///^VideoConfig$/
						]);

						if (!results) {
							console_error(cache_key, "Unable to find serverjs match for", resp);
							//console_log(get_fb_serverjs(cache_key, resp));
							return done(null, false);
						}
					}

					for (var i = 0; i < results.length; i++) {
						var data = results[i][1].__bbox.result.data;
						if (!data.video && !data.story)
							continue;

						var media;

						if (data.video)
							media = data.video;
						else if (data.story) // bigpipe
							media = data;

						if (media.story && media.story.attachments && media.story.attachments.length && media.story.attachments[0].media) {
							media = media.story.attachments[0].media;
						}

						if (!media.videoId && !media.id && !media.permalink_url) {
							continue;
						}

						var obj = {
							extra: {
								page: media.permalink_url || media.url || resp.finalUrl
							}
						};

						var video_data:any = {};
						try {
							var json_video_data = media.video_player_component_renderer.video.video_player_dash_module_renderer.json_encoded_video_data;
							video_data = JSON_parse(json_video_data);
						} catch(e) {
							video_data = media;
						}

						var urls = [];
						// dummy file
						if (false && media.playable_url_dash) {
							urls.push({
								url: media.playable_url_dash,
								video: "dash"
							});
						}

						if (video_data.dash_manifest) {
							urls.push({
								url: "data:application/dash+xml," + encodeURIComponent(video_data.dash_manifest),
								video: "dash"
							});
						}

						if (media.playable_url_quality_hd || video_data.hd_src) {
							urls.push({
								url: media.playable_url_quality_hd || video_data.hd_src,
								video: true
							});
						}

						if (media.playable_url || video_data.sd_src_no_ratelimit || video_data.sd_src) {
							urls.push({
								url: media.playable_url || video_data.sd_src_no_ratelimit || video_data.sd_src,
								video: true
							});
						}

						// image = bigpipe
						var thumbnail = media.thumbnailImage || media.image;
						if (thumbnail && thumbnail.uri) {
							urls.push(thumbnail.uri);
						}

						return done(fillobj_urls(urls, obj), 60*60);
					}

					console_error(cache_key, "Unable to find media from", {resp: resp, serverjs: results});
					return done(null, false);
				}
			});
			if (newsrc) return newsrc;

			var parsed_url = parse_facebook_post_url(src);
			if (parsed_url) {
				page_nullobj = {
					url: src,
					is_pagelink: true
				};

				if (options.do_request && options.cb) {
					query_facebook_post(parsed_url.uid, parsed_url.post_id, function(obj) {
						if (!obj) {
							return options.cb(page_nullobj);
						}

						var imuurl;
						var imu_imageid;
						var imu_match = src.match(/#imu-url=(.*)$/)
						if (imu_match) {
							imuurl = imu_match[1];
							imu_imageid = common_functions["instagram_get_imageid"](imuurl);
						}

						if (imuurl && obj.album_info) {
							common_functions["update_album_info_links"](obj, function(x) {
								var imageid = common_functions["instagram_get_imageid"](x);
								//console_log(imu_imageid, imageid);
								return imu_imageid === imageid;
							});
						}

						return options.cb([obj, page_nullobj]);
					});

					return {
						waiting: true
					};
				} else {
					return page_nullobj;
				}
			}

			// todo
			if (false) {
				newsrc = website_query({
					website_regex: [
						/^[a-z]+:\/\/[^/]+\/+stories\/([0-9]+)\/+([^/]+)\/*(?:[?#].*)?$/
					],
					cache_key: "facebook_story",
					query_for_id: function(id) {
						return {
							url: "https://www.facebook.com/stories/" + id,
							imu_mode: "document"
						};
					},
					process: function(done, resp, cache_key) {
						// commenting out because get_fb_serverjs form isn't correct anymore
						/*var results = get_fb_serverjs(cache_key, resp);
						console_log(results);*/
					}
				});
				if (newsrc) return newsrc;
			}
		}

		if (false && host_domain_nowww === "facebook.com" && options.element) {
			// doesn't work, the 'a' link only gets filled in on mouseover
			// the story_id is only present in the photo url, so let's use that instead
			var current = options.element;

			while ((current = current.parentElement)) {
				if (current.tagName === "DIV" && current.getAttribute("role") === "article") {
					// date timestamp (permalink to post)
					var permalinks = current.querySelectorAll("div a[role=\"link\"]");

					var found = null;
					array_foreach(permalinks, function(permalink) {
						var newurl = permalink.href;
						if (/^[a-z]+:\/\/[^/]+\/+(?:[?#].*)?$/.test(newurl)) {
							return;
						}

						if (src && string_indexof(src, "#imu-url=") < 0) {
							newurl += "#imu-url=" + src;
						}

						found = {
							url: newurl,
							is_pagelink: true
						};
						return false;
					});

					if (found) return found;
				}
			}
		}

		if (host_domain === "m.facebook.com" && options.element) {
			if (options.element.tagName === "IMG" && options.element.classList.contains("img")) {
				common_functions["get_pagelink_el_matching"](options.element, /\/photos\//);
			}
		}

		if (false && domain === "www.the-a.jp") {
			// don't really plan on implementing this one unless a better way is found
			// http://www.the-a.jp/event.cgi?eventnum=071215 -- album
			// http://www.the-a.jp/view/view.php?file=071215001_001 -- image viewer
			// http://www.the-a.jp/thm.cgi?071215001_001 -- 120x160
			// http://www.the-a.jp/thm.php?image=071215001_001 -- 120x160
			// http://www.the-a.jp/photodata/07/071215/thumb/071215001_001.jpg -- 120x160
			// http://www.the-a.jp/imgresize.php?image=071215001_001 -- 240x320
			// http://www.the-a.jp/img.php?image=071215001_001 -- 582x861, badly scaled with badly scaled text
			// http://www.the-a.jp/imgtwit.php?image=071215001_001 -- 800x400, lots of blackspace after
			// to get the original image, stitch these 2 together
			// http://www.the-a.jp/imgdivide.php?image=071215001_001&dx=0 -- 393x836
			// http://www.the-a.jp/imgdivide.php?image=071215001_001&dx=1 -- 320x811
		}

		if (domain === "waichi.sakura.ne.jp") {
			// http://waichi.sakura.ne.jp/prev/chtft68/chtft68_pdx.html
			// http://waichi.sakura.ne.jp/prev/chtft68/momoko.jpg
			//   http://waichi.sakura.ne.jp/prev/chtft68/momoko_L.jpg
			return src.replace(/(\/[^/_.]*)(\.(?:jpg|JPG|jpeg|png|PNG))$/, "$1_L$2");
		}

		if (domain === "news.merumo.ne.jp") {
			// https://news.merumo.ne.jp/imgs/rect78/7372693
			//   https://news.merumo.ne.jp/img/7372693
			//   https://news.merumo.ne.jp/imgs/src/7372693
			// https://news.merumo.ne.jp/articleimg/4677784/0
			//   https://news.merumo.ne.jp/imgs/src/4677784
			// https://news.merumo.ne.jp/img/8697658
			//   https://news.merumo.ne.jp/imgs/src/8697658
			newsrc = src
				.replace(/\/imgs\/+rect[0-9]*\//, "/imgs/src/")
				.replace(/\/(?:article)?img\/+([0-9]+)(?:\/+[0-9]+)?(?:[?#].*)?$/, "/imgs/src/$1");
			if (newsrc !== src)
				return newsrc;

			match = src.match(/\/imgs\/+src\/+([0-9]+)(?:[?#].*)?$/);
			// old urls don't seem to work with the new system
			if (false && match) {
				let id = match[1];
				let folder_id = zpadnum(match[1], 9);
				return "https://images.merumo.ne.jp/" + folder_id.slice(0, 3) + "/" + folder_id.slice(3, 6) + "/" + folder_id.slice(6, 9) + "/" + id + "_src_0.jpg";
			}
		}

		if (domain === "images.merumo.ne.jp") {
			// thanks to fireattack on discord
			// https://images.merumo.ne.jp/010/881/370/10881370_normal_0.jpg
			//   https://images.merumo.ne.jp/010/881/370/10881370_src_0.jpg
			return src.replace(/(\/(?:[0-9]{3}\/+){3}[0-9]+)_(?:[a-z]+|rect[0-9]*)((?:_[0-9]+)?\.)/, "$1_src$2");
		}

		if ((domain_nosub === "shikimori.org" ||
			// https://moe.shikimori.one/system/animes/preview/14967.jpg?1561448019
			//   https://moe.shikimori.one/system/animes/original/14967.jpg?1561448019
			// https://dere.shikimori.one/system/user_images/thumbnail/89335/336604.jpg
			//   https://dere.shikimori.one/system/user_images/original/89335/336604.jpg
			domain_nosub === "shikimori.one") &&
			string_indexof(src, "/system/") >= 0) {
			// https://shikimori.org/animes/1887-lucky-star/cosplay
			// https://dere.shikimori.org/system/cosplay_images/preview/24174.jpg?1305086273
			//   https://dere.shikimori.org/system/cosplay_images/original/24174.jpg?1305086273
			//   https://nyaa.shikimori.org/system/cosplay_images/original/24174.jpg?1305086273
			// https://dere.shikimori.org/system/animes/preview/36949.jpg?1524536106
			//   https://dere.shikimori.org/system/animes/original/36949.jpg?1524536106
			// https://nyaa.shikimori.org/system/cosplay_images/original/26810.jpg?1306746150
			return src.replace(/\/[a-z]+\/+((?:[0-9]+\/+)?[0-9]+\.[^/.]*)$/, "/original/$1");
		}

		if (domain === "assets.survivalinternational.org") {
			// https://assets.survivalinternational.org/pictures/2015/img-9072_article_column.jpeg
			//   https://assets.survivalinternational.org/pictures/2015/img-9072_screen.jpeg
			//   https://assets.survivalinternational.org/pictures/2015/img-9072_original.jpeg
			// https://assets.survivalinternational.org/pictures/939/col-arh-yc-41_600_landscape.jpg
			//   https://assets.survivalinternational.org/pictures/939/col-arh-yc-41_original.jpg
			return src.replace(/_[0-9a-z_]+(\.[^/.]*)$/, "_original$1");
		}

		if (domain === "alioss.g-cores.com" &&
			string_indexof(src, "/uploads/image/") >= 0) {
			// https://alioss.g-cores.com/uploads/image/5c072496-cff6-427e-b465-ff189b68729c_watermark.jpg
			//   https://alioss.g-cores.com/uploads/image/5c072496-cff6-427e-b465-ff189b68729c.jpg
			// http://alioss.g-cores.com/uploads/image/07bc730f-0a7e-4af3-bdf9-4b8e45ad0cd4_watermark.jpg
			//   http://alioss.g-cores.com/uploads/image/07bc730f-0a7e-4af3-bdf9-4b8e45ad0cd4.jpg
			// https://alioss.g-cores.com/assets/5th/souvenir/1-5016dae53ea027acdb653e78d25208780cc556bde2ff35007b3d164b9a2b04ac.jpg
			return src.replace(/_watermark(\.[^/.]*)$/, "$1");
		}

		if (domain === "img.nyato.com" ||
			// https://img.ifun01.com/images/2017/09/05/03/4032_hhc1D9_CIyCf7.jpg!r200x0.jpg
			//   https://img.ifun01.com/images/2017/09/05/03/4032_hhc1D9_CIyCf7.jpg
			domain === "img.ifun01.com" ||
			// https://img.itw01.com/images/2018/02/25/05/1120_C0OXdb_4SO7EBF.jpg!r100x0.jpg
			//   https://img.itw01.com/images/2018/02/25/05/1120_C0OXdb_4SO7EBF.jpg
			domain === "img.itw01.com" ||
			// https://img.mttmp.com/images/2018/04/16/20/4147_Olcr3N_dc64in2.jpg!r800x0.jpg
			//   https://img.mttmp.com/images/2018/04/16/20/4147_Olcr3N_dc64in2.jpg
			domain === "img.mttmp.com" ||
			// http://img.maoduoer.com/uploads/images/20170528/162760057.jpg!webp
			//   http://img.maoduoer.com/uploads/images/20170528/162760057.jpg
			domain === "img.maoduoer.com" ||
			// https://img.sycs.net/tupian/cosplay/lyb1mgt3i5v.jpg!800
			//   https://img.sycs.net/tupian/cosplay/lyb1mgt3i5v.jpg
			domain === "img.sycs.net" ||
			// http://img.6jyx.com/2017/0422/20170422114112538.jpg!picS -- 333x500
			//   http://img.6jyx.com/2017/0422/20170422114112538.jpg -- 1280x1920
			domain === "img.6jyx.com" ||
			// https://dn-kdt-img.qbox.me/upload_files/2015/09/21/195e1cdedfeb126e736312bebc5cd30a.jpeg!200x0.jpg
			//   https://dn-kdt-img.qbox.me/upload_files/2015/09/21/195e1cdedfeb126e736312bebc5cd30a.jpeg
			domain === "dn-kdt-img.qbox.me" ||
			// http://pic-cdn.35pic.com/58pic/25/63/84/25g58PIC5Jp.jpg!w290
			//   http://pic-cdn.35pic.com/58pic/25/63/84/25g58PIC5Jp.jpg
			domain === "pic-cdn.35pic.com" ||
			// http://img.imogu.cn/pic/mgcpex/de/78/5f/bd/6a736d686aecb61a.jpeg!h300
			//   http://img.imogu.cn/pic/mgcpex/de/78/5f/bd/6a736d686aecb61a.jpeg -- forbidden access to the original image
			//(domain === "img.imogu.cn" && string_indexof(src, "/pic/") >= 0) ||
			// http://images.sharerails.com/sharerailsmall/rel/client1/products/retailer14/25913_636259140797926478.jpg!w~500!h~500!b~Contain -- upscaled
			//   http://images.sharerails.com/sharerailsmall/rel/client1/products/retailer14/25913_636259140797926478.jpg
			domain === "images.sharerails.com" ||
			// https://oi5mmhyk8.qnssl.com/23/1412094474230_1dt6uy.jpg!bigger
			domain === "oi5mmhyk8.qnssl.com" ||
			// https://pic.cr173.com/up/2011-7/20117712121655531663.jpg!360_360
			domain === "pic.cr173.com" ||
			// http://i5.5ceimg.com/cover/a2a4bca2-b2e4-e911-8da1-20040ff9d71d.png!158_100
			//   http://www.5ce.com/view/5ce/a2a4bca2-b2e4-e911-8da1-20040ff9d71d/70%E5%B9%B4%E9%98%85%E5%85%B5%E7%A9%BA%E9%99%8D%E5%85%B5
			//   http://i5.5ceimg.com/cover/a2a4bca2-b2e4-e911-8da1-20040ff9d71d.png
			//   http://i3.5ceimg.com/content/c3a1bca2-b2e4-e911-8da1-20040ff9d71d.png
			(domain_nosub === "5ceimg.com" && /^i[0-9]*\./.test(domain)) ||
			// https://movieboo.oss-cn-hangzhou.aliyuncs.com/uploadfile/star/1/1354/1354982.jpg!320_480
			domain === "movieboo.oss-cn-hangzhou.aliyuncs.com" ||
			// http://cover.read.duokan.com/mfsv2/download/fdsc3/p01lfaVZynW3/byoAKvtBmNKzjf.jpg!s
			//   http://cover.read.duokan.com/mfsv2/download/fdsc3/p01lfaVZynW3/byoAKvtBmNKzjf.jpg
			domain === "cover.read.duokan.com" ||
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/478
			// https://img-us1.asus.com/A/show/AW000706/2020/0723/AM0000009/202007AM230000009_15954579550714010008879.jpg!t220x220
			// https://img-us1.asus.com/A/show/AW000706/2020/0228/AM0000002/202002AM280000002_15828512002706480002675.jpg!t220x220
			// https://img-us1.asus.com/A/show/AW000706/2020/0708/AM0000004/202007AM080000004_15941637802760830097162.jpg!t360x360
			// https://img-us1.asus.com/A/show/AW000706/2020/0527/AM0000002/202005AM270000002_15905358848381700017634.jpg!t64x64
			// https://img-us1.asus.com/A/show/AW000706/2018/0427/AM0000001/201804AM270000001_15295202329577240001087.jpg!t500x500
			(domain_nosub === "asus.com" && /^img(?:-[a-z]+)?[0-9]*\./.test(domain) && /!t[0-9]+x[0-9]+(?:[?#].*)?$/.test(src)) ||
			// thanks to n0099 on github: https://github.com/qsniyg/maxurl/issues/1158
			// https://foruda.gitee.com/avatar/1676894742397292147/2072_yinian1992_1598196937.png!avatar200
			//   https://foruda.gitee.com/avatar/1676894742397292147/2072_yinian1992_1598196937.png
			(domain_nosub === "gitee.com" && /\/avatar\//.test(src)) ||
			// thanks to RAT on discord:
			// https://image-assets.mihuashi.com/permanent/2717943%7C-2024/11/04/12/FlLSXAohn4VaiZPu-MwvTxlb2ZEW_4910.jpg!artwork.large
			//   https://image-assets.mihuashi.com/permanent/2717943%7C-2024/11/04/12/FlLSXAohn4VaiZPu-MwvTxlb2ZEW_4910.jpg
			domain === "image-assets.mihuashi.com" ||
			// https://img.mgpyh.com/post_image/52fdf552ea637c47518ad8b5d0db379e.jpg!small
			//   https://img.mgpyh.com/post_image/52fdf552ea637c47518ad8b5d0db379e.jpg
			domain === "img.mgpyh.com") {
			// https://img.nyato.com/data/upload/2016/1006/11/57f5cc2d9f2f1.jpg!300x300cut
			//   https://img.nyato.com/data/upload/2016/1006/11/57f5cc2d9f2f1.jpg
			// https://img.nyato.com/data/upload/avatar/22/2d/40/original.jpg!100x100cut
			//   https://img.nyato.com/data/upload/avatar/22/2d/40/original.jpg
			newsrc = src.replace(/!.*/, "");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nosub === "90sjimg.com" ||
			// http://bpic.588ku.com/element_pic/00/16/09/0157c77b11d41c5.jpg!/fw/208/quality/90/unsharp/true/compress/true
			//   http://bpic.588ku.com/element_pic/00/16/09/0157c77b11d41c5.jpg
			domain === "bpic.588ku.com" ||
			// http://588ku.qiao88.com/element_origin_min_pic/16/09/01/0857c77a7da303e.jpg!/fw/285/clip/285x500a0a0
			//   http://588ku.qiao88.com/element_origin_min_pic/16/09/01/0857c77a7da303e.jpg
			domain === "588ku.qiao88.com" ||
			// https://static.pptstore.net/picture/58/02/7792c001c1d89b75ffd0_s.jpg!/fh/300
			//   https://static.pptstore.net/picture/58/02/7792c001c1d89b75ffd0_s.jpg
			domain === "static.pptstore.net" ||
			// https://img.lovepik.com/desgin_photo/40121/5643_detail.jpg!/fw/336/clip/0x456a0a0/quality/90
			//   https://img.lovepik.com/desgin_photo/40121/5643_detail.jpg
			domain === "img.lovepik.com") {
			// http://ku.90sjimg.com/back_pic/04/46/77/375857904cbeb0f.jpg%21/fwfh/804x402/quality/90/unsharp/true/compress/true/watermark/text/OTDorr7orqE=/font/simkai/align/southeast/opacity/20/size/50
			//   http://ku.90sjimg.com/back_pic/04/46/77/375857904cbeb0f.jpg
			newsrc = src.replace(/(?:!|%21)\/.*/, "");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nosub === "woyaogexing.com" && domain.match(/^img[0-9]*\./)) {
			// https://img2.woyaogexing.com/2017/04/25/8245851c53535909!400x400_big.jpg
			//   https://img2.woyaogexing.com/2017/04/25/8245851c53535909.jpg
			return src.replace(/(\/[0-9a-z]+)![^/]*(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "inews.gtimg.com" ||
			// http://pnewsapp.tc.qq.com/newsapp_bt/0/8449780/640
			//   http://pnewsapp.tc.qq.com/newsapp_match/0/8449780/0 -- doesn't work
			domain === "pnewsapp.tc.qq.com") {
			// http://inews.gtimg.com/newsapp_bt/0/21184296/1000
			//   https://inews.gtimg.com/newsapp_match/0/21184296/0
			// https://inews.gtimg.com/newsapp_ls/0/3457832104_150120/0
			//   https://inews.gtimg.com/newsapp_match/0/3457832104_150120/0 -- doesn't work
			// http://inews.gtimg.com/newsapp_bt/0/21184291/1000
			//   http://inews.gtimg.com/newsapp_match/0/21184291/0
			// https://inews.gtimg.com/newsapp_bt/0/151988165/640?tp=webp
			//   https://inews.gtimg.com/newsapp_match/0/151988165/0
			// http://inews.gtimg.com/newsapp_bt/0/4230564475/641/0
			//   http://inews.gtimg.com/newsapp_match/0/4230564475/0
			// other:
			// http://inews.gtimg.com/newsapp_match/0/1607193377/0 -- 2822x4242
			return {
				url: src.replace(/\/newsapp_[a-z]+\/+([0-9]+\/+[0-9]+\/+)[0-9]+(?:\/+[0-9]+)?(?:[?#].*)?$/, "/newsapp_match/$10"),
				headers: {
					"Origin": "",
					"Referer": ""
				}
			};
		}

		if (domain === "y.qq.com") {
			// thanks to adz on discord:
			// https://y.qq.com/music/photo_new/T002R800x800M000004B2OEg0Z6g8L.jpg
			//   https://y.qq.com/music/photo_new/T002M000004B2OEg0Z6g8L.jpg -- 1500x1500
			return src.replace(/(\/music\/+photo_new\/+[^/]*)R[0-9]+x[0-9]+/, "$1");
		}

		if ((domain === "acg.ms" ||
			 domain === "m.acg.ms") &&
			string_indexof(src, "/photo/") >= 0) {
			// www.acg.ms != acg.ms
			// http://acg.ms/photo/19180_0_620.jpeg
			//   http://acg.ms/photo/19180_0_9999999.jpeg ->
			//     http://acg.ms/photo/19180_0_690.jpeg
			// http://m.acg.ms/photo/19183_0_600.jpeg
			//   http://acg.ms/photo/original/809/68d09f8c2c6f4b98e1fd0adcc2bafe46_0.jpeg
			return {
				redirects: true,
				url: src.replace(/(\/[0-9]+)_[0-9]+_[0-9]+(\.[^/.]*)$/, "$1_0_9999999$2")
			};
		}

		if (domain === "sl.news.livedoor.com") {
			// http://sl.news.livedoor.com/ed497b107aabc6a44a13236e45d22ce6456ce615/small_light(dw=120,dh=120,da=s,cw=120,ch=120,q=100,e=imagemagick,sharpen=radius,sigma)/http://image.news.livedoor.com/newsimage/stf/0/8/0812d_1408_a240b678079ee1be40cb46476262012a.jpg
			//   http://image.news.livedoor.com/newsimage/stf/0/8/0812d_1408_a240b678079ee1be40cb46476262012a.jpg
			return src.replace(/^[a-z]+:\/\/[^/]*\/[a-f0-9]+\/[^/]*\//, "");
		}

		if (domain === "photo.tuchong.com") {
			// https://photo.tuchong.com/1171334/s/8210121.jpg
			//   https://photo.tuchong.com/1171334/f/8210121.jpg
			return src.replace(/\/[a-z]\/([0-9]+\.[^/.]*)/, "/f/$1");
		}

		if ((domain === "arine.akamaized.net" ||
			 domain === "media-assets.aumo.jp") &&
			string_indexof(src, "/uploads/photo/") >= 0) {
			// https://arine.akamaized.net/uploads/photo/snap_photo/data/240902/xlarge_3b631896-390b-49ea-b962-f2b7a8dfa590.jpeg
			//   https://arine.akamaized.net/uploads/photo/snap_photo/data/240902/3b631896-390b-49ea-b962-f2b7a8dfa590.jpeg
			// https://media-assets.aumo.jp/uploads/photo/upload_photo/data/9459/xlarge_a280c9e6-11e7-4778-93c9-3ea4b82aa629.jpeg
			//   https://media-assets.aumo.jp/uploads/photo/upload_photo/data/9459/a280c9e6-11e7-4778-93c9-3ea4b82aa629.jpeg
			return src.replace(/(\/[0-9]+\/)[a-z]+_([-0-9a-z]+\.[^/.]*)$/, "$1$2");
		}

		if (domain === "newsimg.glossom.jp") {
			// https://newsimg.glossom.jp/public/img/article/36/86/2833686_580_04.jpg?5ac96eca
			//   https://newsimg.glossom.jp/public/img/article/36/86/2833686_org_04.jpg?5ac96eca
			return src.replace(/(\/[0-9]+_)[0-9]+(_[0-9]+\.[^/.]*)$/, "$1org$2");
		}

		if (domain === "www.vtianxia.cn") {
			// http://www.vtianxia.cn/uploadfile/news/s/2017/1231/1514696987_29121.jpg
			//   http://www.vtianxia.cn/uploadfile/news/big/2017/1231/1514696987_29121.jpg
			return src.replace(/(\/uploadfile\/[a-z]+\/)[a-z]+\//, "$1big/");
		}

		if (domain === "img.over-blog-kiwi.com" ||
			domain === "img.over-blog.com" ||
			(domain_nosub === "over-blog.com" && string_indexof(domain, ".idata.over-blog.com") >= 0)) {
			// http://img.over-blog-kiwi.com/100x100-ct/0/93/38/59/20140217/ob_bb3768_cafe.jpg
			//   http://img.over-blog-kiwi.com/0/93/38/59/20140217/ob_bb3768_cafe.jpg
			// https://img.over-blog-kiwi.com/630x400-ct/1/50/73/92/20180426/ob_f976fb_p1270469.JPG
			//   https://img.over-blog-kiwi.com/1/50/73/92/20180426/ob_f976fb_p1270469.JPG
			// https://img.over-blog-kiwi.com/150x150/0/55/07/74/20180504/ob_20914b_2018-05-04-wooz-nao.jpg
			//   https://img.over-blog-kiwi.com/0/55/07/74/20180504/ob_20914b_2018-05-04-wooz-nao.jpg
			// http://a401.idata.over-blog.com/150x185/4/02/25/29/VRAC-3/FERRIE--2-.jpg
			//   http://a401.idata.over-blog.com/4/02/25/29/VRAC-3/FERRIE--2-.jpg
			return src.replace(/(:\/\/[^/]*\/)[0-9]+x[0-9]+(?:-[a-z]+)?\//, "$1");
		}

		if (domain === "resize.over-blog.com") {
			// http://resize.over-blog.com/150x150.jpg?https://hoax-net.be/wp-content/uploads/2015/10/12063832_10207955947996766_7835521811747899900_n.jpg
			//   https://hoax-net.be/wp-content/uploads/2015/10/12063832_10207955947996766_7835521811747899900_n.jpg
			// http://resize.over-blog.com/600x350-ct.jpg?http://s2.e-monsite.com/2010/04/02/02/resize_128_128//Neree-Beauchemin.jpg
			//   http://s2.e-monsite.com/2010/04/02/02/resize_128_128//Neree-Beauchemin.jpg
			return src.replace(/^[a-z]+:\/\/[^/]*\/[0-9]+x[0-9]+(?:-[a-z]+)?\.[^/.?]*\?/, "");
		}

		if (domain_nosub === "eastday.com" && domain.match(/[0-9]*\.?imgmini\.eastday\.com/)) {
			// http://09.imgmini.eastday.com/mobile/20160905/20160905080255_b9afa06a642df686fe424990c933a90a_1_mwpm_03200403.jpeg
			//   http://09.imgmini.eastday.com/mobile/20160905/20160905080255_b9afa06a642df686fe424990c933a90a_1.jpeg
			// https://03imgmini.eastday.com/mobile/20180825/688f863d9d0dc41df96c6fc3b0c1a35d_wmk.jpeg
			//   https://03imgmini.eastday.com/mobile/20180825/688f863d9d0dc41df96c6fc3b0c1a35d.jpeg
			return src
				.replace(/(\/[0-9]+_[0-9a-f]+_[0-9]+)_[^/.]*(\.[^/.]*)(?:[?#].*)?$/, "$1$2")
				.replace(/_wmk(\.[^/.]*)(?:[?#].*)?$/, "$1");
		}

		if (domain_nosub === "so-net.ne.jp" ||
			// https://harrypotter-fun.c.blog.ss-blog.jp/_images/blog/_985/harrypotter-fun/m_lunalovegood.jpg
			//   https://harrypotter-fun.c.blog.ss-blog.jp/_images/blog/_985/harrypotter-fun/lunalovegood.jpg
			domain_nosub === "ss-blog.jp") {
			// http://harrypotter-fun.c.blog.so-net.ne.jp/_images/blog/_985/harrypotter-fun/m_lunalovegood.jpg
			//   http://harrypotter-fun.c.blog.so-net.ne.jp/_images/blog/_985/harrypotter-fun/lunalovegood.jpg
			// http://news.so-net.ne.jp/photos/30/365455840452641889/S200_365455840452641889_365547478327575649_origin_1.jpg
			//   http://news.so-net.ne.jp/photos/30/365455840452641889/365455840452641889_365547478327575649_origin_1.jpg
			return src.replace(/\/(?:m|S[0-9]+)_([^/]*)$/, "/$1");
		}

		if (amazon_container === "rejob-v2-images-production" ||
			// https://mosaia.s3.amazonaws.com/images/3319178/small.jpg?1510185944
			//   https://mosaia.s3.amazonaws.com/images/3319178/original.jpg?1510185944
			(amazon_container === "mosaia" && src.match(/\/images\/[0-9]+\/[^/]*$/))) {
			// https://s3-ap-northeast-1.amazonaws.com/rejob-v2-images-production/files/client_shop_image/XSaB7Q/s1D8ah/L7RcjU/Um9yL7/bOo/minimum.jpg
			//   https://s3-ap-northeast-1.amazonaws.com/rejob-v2-images-production/files/client_shop_image/XSaB7Q/s1D8ah/L7RcjU/Um9yL7/bOo/detail_top.jpg
			//   https://s3-ap-northeast-1.amazonaws.com/rejob-v2-images-production/files/client_shop_image/XSaB7Q/s1D8ah/L7RcjU/Um9yL7/bOo/original.jpg
			return src.replace(/\/[^/.]*(\.[^/.]*)$/, "/original$1");
		}

		if (domain === "lohas.nicoseiga.jp") {
			// https://lohas.nicoseiga.jp/thumb/6494066i
			//   https://lohas.nicoseiga.jp/thumb/6494066l -- same size
			//   https://lohas.nicoseiga.jp/thumb/6494066cz -- smaller
			// https://lohas.nicoseiga.jp/thumb/7639531m
			//   https://lohas.nicoseiga.jp/thumb/7639531i -- doesn't work
			//   https://lohas.nicoseiga.jp/thumb/7639531l -- largest
			//   https://seiga.nicovideo.jp/seiga/im7639531 -- doesn't exist
			// larger images:
			// https://lohas.nicoseiga.jp/material/4e1a77/8032880
			// http://lohas.nicoseiga.jp/priv/5eb1a6e1e94c0e1a55c4b54145af82950dc5145e/1487849470/6505819
			// (l, i), d, m, t, c, u, z, q, s
			newsrc = src.replace(/(\/thumb\/+[0-9]+)[a-z][a-z]?(\?.*)?$/, "$1l$2");
			if (newsrc !== src)
				return newsrc;

			var get_nicovideo_obj = function(id) {
				return {
					url: src,
					extra: {page: "https://seiga.nicovideo.jp/seiga/im" + id}
				};
			};

			obj = null;
			match = src.match(/\/thumb\/+([0-9]+)(?:[a-z]+)(?:[?#].*)?$/);
			if (match) {
				id = match[1];
				obj = get_nicovideo_obj(id);
			}

			if (match && options.do_request && options.cb) {
				var cache_key = "nicoseiga:" + id;
				api_cache.fetch(cache_key, options.cb, function(done) {
					options.do_request({
						url: "https://seiga.nicovideo.jp/image/source/" + id,
						method: "GET",
						onload: function(resp) {
							if (resp.readyState !== 4)
								return;

							if (resp.status !== 200) {
								console_error(resp)
								return done(null, false);
							}

							// for https://lohas.nicoseiga.jp/thumb/7639531l, https://seiga.nicovideo.jp/image/source/7639531 is the image itself
							// TODO; maybe HEAD request to avoid downloading it twice?
							var headers = headers_list_to_dict(parse_headers(resp.responseHeaders));
							if ("content-type" in headers) {
								if (/^image\//.test(headers["content-type"])) {
									// original page doesn't exist in this case
									return done(resp.finalUrl, 6*60*60);
								}
							}

							var match = resp.responseText.match(/<div\s+class=\"illust_view_big\"[^>]+data-src=\"([^"]+)\"/);
							if (!match) {
								console_error("Unable to find match (are you logged in to nicovideo?)", resp);
								return done(null, false);
							}

							var url = decode_entities(match[1]);
							obj.url = urljoin(resp.finalUrl, url, true);
							done(obj, 6*60*60);
						}
					});
				});

				return {
					waiting: true
				};
			}

			if (!match) {
				match = src.match(/\/priv\/+[0-9a-f]{10,}\/+[0-9]+\/+([0-9]+)(?:[?#].*)?$/);
				if (match) {
					id = match[1];
					obj = get_nicovideo_obj(id);
				}
			}

			if (obj) {
				return obj;
			}
		}

		if (domain === "appdata.hungryapp.co.kr") {
			// http://appdata.hungryapp.co.kr/data_file/data_img_m/201712/22/W15139228709275643.jpg
			//   http://appdata.hungryapp.co.kr/data_file/data_img/201712/22/W15139228709275643.jpg
			// http://appdata.hungryapp.co.kr/data_file/data_img/201801/25/W1516889805885988.png/hungryapp/resize/500
			//   http://appdata.hungryapp.co.kr/data_file/data_img/201801/25/W1516889805885988.png
			return src
				.replace(/\/data_img_[a-z]\//, "/data_img/")
				.replace(/(\/[0-9]{6}\/[0-9]{2}\/[^/]*\.[^/.]*)\/hungryapp\/.*/, "$1");
		}

		if (domain === "media.funradio.fr") {
			// https://media.funradio.fr/cache/6zVW4QAFrwxZgrBHWQ9VTQ/880v587-0/online/image/2017/1211/7791363662_selena-gomez.jpg -- upscaled?
			//   https://media.funradio.fr/online/image/2017/1211/7791363662_selena-gomez.jpg -- smaller
			return src.replace(/\/cache\/[0-9a-zA-Z]+\/[0-9a-z]+-[0-9]+\//, "/");
		}

		if (domain === "image.afcdn.com" ||
			// https://assets.afcdn.com/breves/acc2_video_619363/acc1257x1257a869039_w767h767c1.jpg
			//   https://assets.afcdn.com/breves/acc2_video_619363/acc1257x1257a869039.jpg -- _origin doesn't work
			// https://assets.afcdn.com/story/acc9_3057731/acc1257x1257a383657_w767h767c1.jpg
			//   https://assets.afcdn.com/story/acc9_3057731/acc1257x1257a383657.jpg
			// https://assets.afcdn.com/story/20181025/1309488_w650h476.jpg
			//   https://assets.afcdn.com/story/20181025/1309488.jpg
			//   https://assets.afcdn.com/story/20181025/1309488_origin.jpg -- 4483x3280
			domain === "assets.afcdn.com" ||
			// http://imalbum.aufeminin.com/album/D20130712/925838_GQTT87CR8X4KFVWHZAM2IC4W4A8W8N_lily-collins-hair-hairstyles-6_H152431_L_s100.jpg
			//   http://imalbum.aufeminin.com/album/D20130712/925838_GQTT87CR8X4KFVWHZAM2IC4W4A8W8N_lily-collins-hair-hairstyles-6_H152431_L.jpg
			domain === "imalbum.aufeminin.com" ||
			// http://imworld.aufeminin.com/story/20160114/smokey-eyes-nude-845802_w650.jpg
			//   http://imworld.aufeminin.com/story/20160114/smokey-eyes-nude-845802.jpg
			domain === "imworld.aufeminin.com") {
			// https://image.afcdn.com/story/20170706/selena-gomez-1102651_w767h767c1cx1816cy877.jpg
			//   https://image.afcdn.com/story/20170706/selena-gomez-1102651.jpg
			// https://image.afcdn.com/story/20130911/cara-delevingne-98052_w767h767c1cx345cy200.jpg
			//   https://image.afcdn.com/story/20130911/cara-delevingne-98052.jpg
			// https://image.afcdn.com/album/D20180221/allison-janney-phalbm25328123_w660.jpg
			// https://assets.afcdn.com/album/D20180221/allison-janney-phalbm25328123_w660.jpg -- can't find a working pattern?
			//   https://image.afcdn.com/album/D20180221/allison-janney-phalbm25328123.jpg
			// https://image.afcdn.com/story/20141004/rihanna-507111_w670.jpg
			//   https://image.afcdn.com/story/20141004/rihanna-507111.jpg
			// https://image.afcdn.com/story/20170706/selena-gomez-1102505_w670.jpg
			// https://assets.afcdn.com/story/20170706/selena-gomez-1102505_w670.jpg
			//   https://image.afcdn.com/story/20170706/selena-gomez-1102505.jpg -- still works
			//   https://assets.afcdn.com/story/20170706/1102505_origin.jpg
			// https://image.afcdn.com/story/20170706/selena-gomez-1102441_w670.jpg
			//   https://image.afcdn.com/story/20170706/selena-gomez-1102441.jpg -- still works
			// https://image.afcdn.com/story/20140722/emma-watson-shakes-off-good-girl-image-with-sexy-new-role-in-the-bling-ring-312896_w767h767c1.jpg
			//   https://image.afcdn.com/story/20140722/emma-watson-shakes-off-good-girl-image-with-sexy-new-role-in-the-bling-ring-312896.jpg
			//   https://assets.afcdn.com/story/20140722/312896_origin.jpg -- 686x400
			// https://image.afcdn.com/stars/people/1001-1_s96cx1221cy1290cxt530cyt340cxb1961cyb1770.jpg
			//   https://image.afcdn.com/stars/people/1001-1.jpg
			// https://image.afcdn.com/album/D20181012/emma-watson-a-woman-with-a-plan-phalbm25655862_w660.jpg
			// https://assets.afcdn.com/album/D20181012/emma-watson-a-woman-with-a-plan-phalbm25655862_w660.jpg -- can't find a working pattern?
			//   https://image.afcdn.com/album/D20181012/emma-watson-a-woman-with-a-plan-phalbm25655862.jpg
			// theory: if referer != null (last image), redirects to blank image, no content-length header, can't find differences in headers
			// doesn't seem to be true. trying an image under another browser doesn't work either. could be a cache server problem
			// using referer headers seems to work
			return {
				url: src
					.replace(/(\/acc[0-9]+_(?:[a-z]+_)?[0-9]+\/+[a-z0-9]+)_[a-z0-9]+(\.[^/.]*)/, "$1$2")
					.replace(/(-[0-9]+_[A-Z0-9]+_)[A-Z](?:_[a-z[0-9]+)?(\.[^/.]*)/, "$1L$2")
					.replace(/\/(?:[^/.?#]+-)?((?:[a-z]+)?[0-9]+)_[a-z0-9]+(\.[^/.]*)/, "/$1_origin$2"),
				headers: {
					Origin: "https://www.sofeminine.co.uk/",
					Referer: "https://www.sofeminine.co.uk/"
				}
			};
		}

		if ((domain_nosub === "greatsong.net" && domain.match(/static[0-9]*\.greatsong\.net/)) ||
			// https://img0.utuku.china.com/130x0/news/20180705/b4db88c1-98c1-4434-b2e7-3620855a7274.jpg
			//   https://img0.utuku.china.com/original/news/20180705/b4db88c1-98c1-4434-b2e7-3620855a7274.jpg
			(domain_nosub === "china.com" && domain.match(/img[0-9]*\.(?:[a-z]+\.)?china\.com/))) {
			// https://static2.greatsong.net/artiste/250x250/selena-gomez-204596.jpg
			//   https://static2.greatsong.net/artiste/original/selena-gomez-204596.jpg
			// https://static2.greatsong.net/artiste/270x164/anthony-hamilton-174297.jpg
			//   https://static2.greatsong.net/artiste/original/anthony-hamilton-174297.jpg
			return src.replace(/\/[0-9]+x[0-9]+\//, "/original/");
		}

		if (domain === "ipravda.sk") {
			// www.ipravda.sk != ipravda.sk
			// https://ipravda.sk/res/2018/05/03/thumbs/rok-2008-spevacka-adele-na-fotografii-z-new-yorku-stvorec.jpg
			//   https://ipravda.sk/res/2018/05/03/rok-2008-spevacka-adele-na-fotografii-z-new-yorku.jpg
			// https://ipravda.sk/res/2017/06/07/thumbs/selena-gomez_01-nestandard1.jpg
			//   https://ipravda.sk/res/2017/06/07/selena-gomez_01.jpg
			// https://ipravda.sk/res/2015/05/18/thumbs/jennifer-lopez-galeria.jpeg
			//   https://ipravda.sk/res/2015/05/18/jennifer-lopez.jpeg
			// http://ipravda.sk/res/2018/07/17/thumbs/herecka-meryl-streep-na-premiere-filmu-mamma-mia-here-we-go-again-clanokW.jpg
			//   http://ipravda.sk/res/2018/07/17/herecka-meryl-streep-na-premiere-filmu-mamma-mia-here-we-go-again.jpg
			// http://ipravda.sk/res/2008/11/07/thumbs/28933-juraj-jakubisko-clanok.jpg
			//   http://ipravda.sk/res/2008/11/07/28933-juraj-jakubisko.jpg
			// https://ipravda.sk/res/2018/08/13/thumbs/ciznar-nemecko-unos-strednaW.jpg
			//   https://ipravda.sk/res/2018/08/13/ciznar-nemecko-unos.jpg
			// https://ipravda.sk/res/2018/08/03/thumbs/andy-warhol-malaW.jpg
			//   https://ipravda.sk/res/2018/08/03/andy-warhol.jpg
			return src.replace(/\/thumbs\/([^/]*)-(?:stvorec|nestandard[0-9]*|galeria|clanokW?|strednaW?|malaW?)(\.[^/.]*)$/, "/$1$2");
		}

		if (domain === "d919ce141ef35c47fc40-b9166a60eccf0f83d2d9c63fa65b9129.ssl.cf5.rackcdn.com" ||
			// https://media.phillyvoice.com/media/images/StockTreesCarroll.2e16d0ba.fill-735x490.jpg
			//   https://media.phillyvoice.com/media/images/StockTreesCarroll.original.jpg
			domain === "media.phillyvoice.com") {
			// https://d919ce141ef35c47fc40-b9166a60eccf0f83d2d9c63fa65b9129.ssl.cf5.rackcdn.com/images/147002.max-620x600.jpg
			//   https://d919ce141ef35c47fc40-b9166a60eccf0f83d2d9c63fa65b9129.ssl.cf5.rackcdn.com/images/147002.original.jpg
			// https://d919ce141ef35c47fc40-b9166a60eccf0f83d2d9c63fa65b9129.ssl.cf5.rackcdn.com/images/76827.2e16d0ba.fill-276x245.jpg
			//   https://d919ce141ef35c47fc40-b9166a60eccf0f83d2d9c63fa65b9129.ssl.cf5.rackcdn.com/images/76827.original.jpg
			// https://d919ce141ef35c47fc40-b9166a60eccf0f83d2d9c63fa65b9129.ssl.cf5.rackcdn.com/images/ADAMMIRAI.2e16d0ba.fill-295x279.jpg
			//   https://d919ce141ef35c47fc40-b9166a60eccf0f83d2d9c63fa65b9129.ssl.cf5.rackcdn.com/images/ADAMMIRAI.original.jpg
			// doesn't work for all:
			// https://d919ce141ef35c47fc40-b9166a60eccf0f83d2d9c63fa65b9129.ssl.cf5.rackcdn.com/images/GettyImages-818219262.2e16d0ba.fill-295x279.jpg
			//   https://d919ce141ef35c47fc40-b9166a60eccf0f83d2d9c63fa65b9129.ssl.cf5.rackcdn.com/images/GettyImages-818219262.original.jpg -- doesn't work
			// but it does work for other GettyImages:
			// https://d919ce141ef35c47fc40-b9166a60eccf0f83d2d9c63fa65b9129.ssl.cf5.rackcdn.com/images/GettyImages-927227080.2e16d0ba.fill-295x279.jpg
			//   https://d919ce141ef35c47fc40-b9166a60eccf0f83d2d9c63fa65b9129.ssl.cf5.rackcdn.com/images/GettyImages-927227080.original.jpg
			return src.replace(/(\/images\/[^/.]+\.)[^/]*(\.[^/.]*)$/, "$1original$2");
		}

		if (domain === "nation.com.pk") {
			// https://nation.com.pk/print_images/small/2018-01-21/rihanna-moving-to-london-1516485654-4082.jpg
			// error when specifying other:
			// Please specify size. Eg: thumbnail, small, medium, large
			return src.replace(/\/print_images\/[a-z]+\//, "/print_images/large/");
		}

		if (domain === "dazedimg.dazedgroup.netdna-cdn.com" ||
			// https://images-prod.anothermag.com/200/0-169-1035-690/azure/another-prod/410/9/419831.jpg
			//   https://dazedprod.blob.core.windows.net/another-prod/410/9/419831.jpg
			domain === "images-prod.anothermag.com" ||
			// https://anotherimg-dazedgroup.netdna-ssl.com/1037/azure/another-prod/410/9/419846.jpg
			domain === "anotherimg-dazedgroup.netdna-ssl.com" ||
			// thanks to anonymous for reporting:
			// https://images-prod.dazeddigital.com/1063/azure/dazed-prod/1350/1/1351397.jpg
			//   https://dazedprod.blob.core.windows.net/dazed-prod/1350/1/1351397.jpg
			domain === "images-prod.dazeddigital.com" ||
			// https://dazedimg-dazedgroup.netdna-ssl.com/900/azure/dazed-prod/1070/3/1073070.jpg
			domain === "dazedimg-dazedgroup.netdna-ssl.com") {
			// http://dazedimg.dazedgroup.netdna-cdn.com/320/0-0-558-372/azure/dazed-prod/1240/0/1240136.jpg
			//   https://dazedprod.blob.core.windows.net/dazed-prod/1240/0/1240136.jpg
			// http://dazedimg.dazedgroup.netdna-cdn.com/1600/azure/dazed-prod/1220/7/1227289.jpg
			//   https://dazedprod.blob.core.windows.net/dazed-prod/1220/7/1227289.jpg
			newsrc = src.replace(/(:\/\/[^/]*\/)[0-9]+\/(?:[0-9]+-[0-9]+-[0-9]+-[0-9]+\/)?/, "$1");
			if (newsrc !== src)
				return newsrc;

			return src.replace(/^[a-z]+:\/\/[^/]+\/+azure\/+(.*)/, "https://dazedprod.blob.core.windows.net/$1");
		}

		if (domain === "www.fuse.tv") {
			// https://www.fuse.tv/image/5306185b012d11e57c000012/768/512/photo-of-rihanna-2005.jpg
			//   https://www.fuse.tv/image/5306185b012d11e57c000012/photo-of-rihanna-2005.jpg
			return src.replace(/(\/image\/[0-9a-f]+\/)[0-9]+\/[0-9]+\/([^/]*)$/, "$1$2");
		}

		if (domain === "assets.capitalxtra.com") {
			// https://assets.capitalxtra.com/2018/17/rihanna-1525427948-hero-wide-v4-0.jpg
			//   https://assets.capitalxtra.com/2018/17/rihanna-1525427948.jpg
			return src.replace(/(\/[^/.]*-[0-9]{8,})-[^/.]*(\.[^/.]*)$/, "$1$2");
		}

		if (domain === "imgproc.airliners.net") {
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/396
			// https://imgproc.airliners.net/photos/airliners/9/1/7/6122719-v4993c2438bb-6.jpg
			//   https://imgproc.airliners.net/photos/airliners/9/1/7/6122719.jpg
			// https://imgproc.airliners.net/photos/airliners/9/7/5/2367579-v40-15.jpg
			//   https://imgproc.airliners.net/photos/airliners/9/7/5/2367579.jpg
			// https://imgproc.airliners.net/photos/user/7/0/8/profile-photo-2807-v4207cbf0367-5.jpg
			//   https://imgproc.airliners.net/photos/user/7/0/8/profile-photo-2807.jpg
			return src.replace(/(\/photos\/+[^/]+\/+(?:[0-9]\/+){3}[^/]+)-v[0-9a-f]+-[0-9]+(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "ukmix.org") {
			// https://www.ukmix.org/proxy.php?code=3b69a1220d68c617d6dbba93ccf0ace35a34abf823b8a6e17ae123a692765a43&url=aHR0cDovL2NkbmkuY29uZGVuYXN0LmNvLnVrLzQxMHg1NDAva19uL25vdi0yMDA1X2NvdmVyczIwMDVfZ2xfMjJkZWMxMF9iLmpwZw%3D%3D
			//   https://cdni.condenast.co.uk/410x540/k_n/nov-2005_covers2005_gl_22dec10_b.jpg
			match = src.match(/\/proxy\.php\?(?:.*&)?url=([^&]+)/);
			if (match) {
				return base64_decode(decodeURIComponent(match[1]));
			}
		}

		if (domain === "m.static.newsvine.com" &&
			string_indexof(src, "/servista/imagesizer?") >= 0) {
			// http://m.static.newsvine.com/servista/imagesizer?file=meena-hart-duerson--today9358FF7B-91E7-365E-2C23-5DD8416B1703.jpg&width=400
			//   http://m.static.newsvine.com/servista/imagesizer?file=meena-hart-duerson--today9358FF7B-91E7-365E-2C23-5DD8416B1703.jpg
			return src.replace(/(\/servista\/imagesizer).*?[?&](file=[^&]*).*/, "$1?$2");
		}

		if (domain_nosub === "cosplaywon.com" && domain.match(/theprecious[0-9]*\.cosplaywon\.com/)) {
			// https://theprecious.cosplaywon.com/uploads/post/photo/5198/small_1f3238d6-d48d-42a0-947b-546c14c4771d.jpg
			//   https://theprecious.cosplaywon.com/uploads/post/photo/5198/original_1f3238d6-d48d-42a0-947b-546c14c4771d.jpg -- 3396x5315
			//   https://theprecious.cosplaywon.com/uploads/post/photo/5198/1f3238d6-d48d-42a0-947b-546c14c4771d.jpg          -- 3396x5315
			// https://theprecious2.cosplaywon.com/uploads/post/photo/5051/medium_49ef7a15-37c2-4f6e-a147-4ab6c5bcbfa2.jpg
			//   https://theprecious2.cosplaywon.com/uploads/post/photo/5051/original_49ef7a15-37c2-4f6e-a147-4ab6c5bcbfa2.jpg
			return src.replace(/(\/photo\/[0-9]+\/)[a-z]+_([-0-9a-f]+\.[^/.]*)$/, "$1original_$2");
		}

		if (domain_nowww === "otaku.com") {
			// https://otaku.com/files/images/thumbs/THUMB_206306J2.JPG
			//   https://otaku.com/files/images/fullsize/206306J2.JPG
			// https://otaku.com/files/images/items/206306J.JPG
			//   https://otaku.com/files/images/fullsize/206306J.JPG
			return src.replace(/(\/files\/images\/)[^/]*\/(?:[A-Z]+_)?([^/]*)$/, "$1fullsize/$2");
		}

		if ((domain_nosub === "joyreactor.com" ||
			 // http://img0.reactor.cc/pics/post/art-Anime-nil-293006.jpeg
			 //   http://img0.reactor.cc/pics/post/full/art-Anime-nil-293006.jpeg
			 domain_nosub === "reactor.cc" ||
			 domain_nosub === "thatpervert.com" ||
			 domain_nosub === "joyreactor.cc") &&
			domain.match(/^img[0-9]*\./)) {
			// http://img0.joyreactor.com/pics/post/art-shingeki-no-kyojin-anime-anime-art-2196554.jpeg
			//   http://img0.joyreactor.com/pics/post/full/art-shingeki-no-kyojin-anime-anime-art-2196554.jpeg
			newsrc = src.replace(/(\/pics\/post\/)([^/]*)$/, "$1full/$2");
			if (newsrc !== src)
				return newsrc;

			// http://img1.reactor.cc/pics/thumbnail/post-378769.jpg
			//   http://reactor.cc/post/378769
			//   http://img0.reactor.cc/pics/post/art-Anime-nil-293006.jpeg
			//   http://img0.reactor.cc/pics/post/full/art-Anime-nil-293006.jpeg
			// http://img1.reactor.cc/pics/thumbnail/post-3601821.jpg
			//   http://img0.reactor.cc/pics/post/full/meso-meso-AO-Anime-Art-Anime-4634590.png
			id = src.replace(/.*\/pics\/thumbnail\/post-([0-9]+)\.[^/.]*$/, "$1");
			if (id !== src && options && options.cb && options.do_request) {
				options.do_request({
					url: src.replace(/:\/\/img[0-9]*\.([^/]*\/).*/, "://$1post/" + id),
					method: "GET",
					onload: function(resp) {
						if (resp.readyState === 4) {
							var match = resp.responseText.match(/<div class="image">\s*(?:<a[^>]*>)?\s*<img[^>]*src="([^"]*)"/);
							if (match) {
								options.cb(match[1]);
							} else {
								options.cb(null);
							}
						}
					}
				});

				return {
					waiting: true
				};
			}
		}

		if (domain_nowww === "coolwallpaperz.info") {
			// http://coolwallpaperz.info/user-content/uploads/wall/thumb/62/dark-anime-art-colorful-girl-free-hd-917493.jpg
			//   http://www.coolwallpaperz.info/user-content/uploads/wall/o/62/dark-anime-art-colorful-girl-free-hd-917493.jpg
			return src.replace(/(\/uploads\/wall\/)thumb(\/[0-9]+\/[^/]*)$/, "$1o$2");
		}

		if (domain_nowww === "besthqwallpapers.com" ||
			// http://wallpapers4screen.com/Uploads/14-12-2018/38448/thumb-mariano-grunge-real-madrid-white-stone-dominican-footballers.jpg
			//   http://wallpapers4screen.com/Uploads/14-12-2018/38448/mariano-grunge-real-madrid-white-stone-dominican-footballers.jpg
			domain_nowww === "wallpapers4screen.com" ||
			// http://brightwallpapers.com.ua/Uploads/28-11-2013/d3e7782d-1d67-4812-b6d4-dcf1b4dd720f/thumb2-1f628c29280f859d65db85a5441d5e03.jpg
			//   http://brightwallpapers.com.ua/Uploads/28-11-2013/d3e7782d-1d67-4812-b6d4-dcf1b4dd720f/1f628c29280f859d65db85a5441d5e03.jpg
			domain_nowww === "brightwallpapers.com.ua") {
			// https://besthqwallpapers.com/Uploads/29-3-2018/46318/thumb2-vocaloid-kagamine-rin-kagamine-len-anime-characters-art.jpg
			//   https://besthqwallpapers.com/uploads/29-3-2018/46318/vocaloid-kagamine-rin-kagamine-len-anime-characters-art.jpg
			return src.replace(/(\/[Uu]ploads\/+(?:[0-9]{1,2}-){2}[0-9]{4}\/+(?:[0-9]+|[-0-9a-f]+)\/+)thumb[0-9]*-([^/]*)$/, "$1$2");
			//return src.replace(/(\/Uploads\/+(?:[0-9]{2}-){2}[0-9]{4}\/+([0-9]+)\/+)thumb-([^/]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "avatanplus.com") {
			// https://avatanplus.com/files/resources/mid/5aedb0878e6e31633079919f.png -- 700x826
			//   https://avatanplus.com/files/resources/original/5aedb0878e6e31633079919f.png -- 823x972
			// https://avatanplus.com/resize.php?type=resources&mode=mid&file=5aedb0878e6e31633079919f.png
			//   https://avatanplus.com/files/resources/original/5aedb0878e6e31633079919f.png
			if (string_indexof(src, "/resize.php?") >= 0) {
				var queries = get_queries(src);
				return "https://avatanplus.com/files/" + queries.type + "/original/" + queries.file;
			}
			return src
				.replace(/(\/files\/[a-z]+)\/[a-z]+\/([0-9a-f]+\.[^/.]*)$/, "$1/original/$2");
		}

		// http://data.japanese.kpopstarz.com/data/thumbs/full/90028/300/210/47/25/2.jpg
		//   http://data.japanese.kpopstarz.com/data/images/full/90028/2.jpg
		if (domain === "data.japanese.kpopstarz.com" ||
			// http://image.kpopstarz.com/data/thumbs/full/270672/225/149/50/40/seohyun-thumbs-up-after-tokyo-dome.jpg -- dead
			domain === "image.kpopstarz.com" ||
			// http://images.kpopstarz.com/data/thumbs/full/87676/225/149/50/20/roy-kim-says-he-is-sorry-that-his-song-spring-spring-spring-bom-bom-bom-has-drawn-plagiarism-accusations.jpg
			//   http://images.kpopstarz.com/data/images/full/87676/roy-kim-says-he-is-sorry-that-his-song-spring-spring-spring-bom-bom-bom-has-drawn-plagiarism-accusations.jpg
			domain === "images.kpopstarz.com" ||
			// http://images.kstars.kr/data/images/full/31493/0003803688_001_20180615082716162-jpg.jpg?w=200
			//   http://images.kstars.kr/data/images/full/31493/0003803688_001_20180615082716162-jpg.jpg
			domain === "images.kstars.kr" ||
			// http://images.enstarz.com/data/images/full/30601/rihanna.jpg?w=580
			// http://images.enstarz.com/data/thumbs/full/30601/810/0/0/0/rihanna.jpg
			//   http://images.enstarz.com/data/images/full/30601/rihanna.jpg
			domain === "images.enstarz.com" ||
			// http://cdn.breathecast.com/data/images/full/30717/maddie-ziegler.png?w=200
			//   http://cdn.breathecast.com/data/images/full/30717/maddie-ziegler.png
			domain === "cdn.breathecast.com" ||
			// http://image.en.yibada.com/data/thumbs/full/100716/248/165/50/40/bradley-cooper-will-co-star-lady-gaga-in-the-upcoming-american-horror-story-season-6.png
			//   http://image.en.yibada.com/data/images/full/100716/bradley-cooper-will-co-star-lady-gaga-in-the-upcoming-american-horror-story-season-6.png
			(domain_nosub === "yibada.com" && /^image\./.test(domain)) ||
			// https://1624909224.rsc.cdn77.org/data/images/full/20509/singer-taylor-swift-c-and-selena-gomez-r-attend-the-58th-grammy-awards-at-staples-center-on-february-15-2016-in-los-angeles-california.jpg?w=600&h=300
			//   https://1624909224.rsc.cdn77.org/data/images/full/20509/singer-taylor-swift-c-and-selena-gomez-r-attend-the-58th-grammy-awards-at-staples-center-on-february-15-2016-in-los-angeles-california.jpg
			// https://1734811051.rsc.cdn77.org/data/thumbs/full/370552/150/150/50/40/e3-the-worlds-premier-event-for-video-games-e3-coliseum-day-3.jpg
			//   https://1734811051.rsc.cdn77.org/data/images/full/370552/e3-the-worlds-premier-event-for-video-games-e3-coliseum-day-3.jpg
			(domain_nosub === "cdn77.org" && /^[0-9]+\.rsc\./.test(domain)) ||
			// https://kdrimages-1tmxd3aba43noa.stackpathdns.com/data/thumbs/full/229217/120/100/50/40/mystery-queen.jpg
			//   https://kdrimages-1tmxd3aba43noa.stackpathdns.com/data/images/full/229217/mystery-queen.jpg
			//domain === "kdrimages-1tmxd3aba43noa.stackpathdns.com" ||
			// https://ensimages-1tmxd3aba43noa.stackpathdns.com/data/images/full/30601/rihanna.jpg?h=700
			//   https://ensimages-1tmxd3aba43noa.stackpathdns.com/data/images/full/30601/rihanna.jpg
			//domain === "ensimages-1tmxd3aba43noa.stackpathdns.com" ||
			// https://kpoimages-1tmxd3aba43noa.stackpathdns.com/data/thumbs/full/478065/225/149/0/0/image-jpg.jpg
			//   https://kpoimages-1tmxd3aba43noa.stackpathdns.com/data/images/full/478065/image-jpg.jpg
			// https://kpoimages-1tmxd3aba43noa.stackpathdns.com/data/images/full/167990/bomber-png.png?w=650
			//   https://kpoimages-1tmxd3aba43noa.stackpathdns.com/data/images/full/167990/bomber-png.png
			//domain === "kpoimages-1tmxd3aba43noa.stackpathdns.com" ||
			// https://bbd-1tmxd3aba43noa.stackpathdns.com/data/thumbs/full/595/196/145/0/0/bill-gates-jpg.jpg
			//   https://bbd-1tmxd3aba43noa.stackpathdns.com/data/images/full/595/bill-gates-jpg.jpg
			// https://bbd-1tmxd3aba43noa.stackpathdns.com/data/images/full/196632/adorable-cats-jpg.jpg?w=300
			// https://bbd-1tmxd3aba43noa.stackpathdns.com/data/images/full/163561/rihanna-7-jpg.jpg?w=802&l=50&t=40
			//domain === "bbd-1tmxd3aba43noa.stackpathdns.com" ||
			(domain_nosub === "stackpathdns.com" && domain.match(/1tmxd3aba43noa\./))) {
			// filename can be anything
			newsrc = src
				.replace(/\/data\/thumbs\/full\/([0-9]+)\/[0-9]+\/[0-9]+\/[0-9]+\/[0-9]+\/([^/]*)$/,
						 "/data/images/full/$1/$2")
				.replace(/[?#].*$/, "");
			if (newsrc !== src)
				return newsrc;
			//return src.replace(/\/thumbs\/full\/([^/]*)\/[^/]*\/[^/]*\/[^/]*\/[^/]*\/([^/]*)$/, "/thumbs/full/$1/999999/0/0/0/$2");
			//return src
			//    .replace(/\/data\/thumbs\/[^/]*\/([0-9]+)\/(?:[0-9]+\/){4}/, "/data/images/full/$1/")
			//    .replace(/\?.*/, "");
		}

		if (domain === "studiosol-a.akamaihd.net") {
			// https://studiosol-a.akamaihd.net/letras/215x215/fotos/c/d/e/1/cde1fd38a3142bc266c221f69fb9ee60.jpg
			//   https://studiosol-a.akamaihd.net/uploadfile/letras/fotos/c/d/e/1/cde1fd38a3142bc266c221f69fb9ee60.jpg
			// https://studiosol-a.akamaihd.net/letras/76x76/albuns/d/b/e/b/605161510258737-tb_180.jpg
			//   https://studiosol-a.akamaihd.net/uploadfile/letras/albuns/d/b/e/b/605161510258737-tb_180.jpg
			//   https://studiosol-a.akamaihd.net/uploadfile/letras/albuns/d/b/e/b/605161510258737.jpg
			// https://studiosol-a.akamaihd.net/uploadfile/letras/fotos/5/7/8/a/578ade976c0ac183973f5b628a668eb3-tb_200.jpg
			//   https://studiosol-a.akamaihd.net/uploadfile/letras/fotos/5/7/8/a/578ade976c0ac183973f5b628a668eb3.jpg
			return src
				.replace(/(:\/\/[^/]*\/)([a-z]+)\/[0-9]+x[0-9]+\//, "$1uploadfile/$2/")
				.replace(/-tb_[0-9]+(\.[^/.]*)$/, "$1");
		}

		if (domain_nowww === "letradamusica.net" && string_indexof(src, "/fotos/") >= 0) {
			// https://www.letradamusica.net/fotos/a/hirano-aya/fotos/hirano-aya-7-tb.jpg
			//   https://www.letradamusica.net/fotos/a/hirano-aya/fotos/hirano-aya-7-tb_200.jpg
			//   https://www.letradamusica.net/fotos/a/hirano-aya/fotos/hirano-aya-7.jpg
			return src.replace(/-tb(?:_[0-9]+)?(\.[^/.]*)(?:[?#].*)?$/, "$1");
		}

		if (amazon_container === "quietus_production") {
			// http://s3.amazonaws.com/quietus_production/images/articles/24550/TFSMeatspace_1525802422_crop_168x168.jpg
			//   http://s3.amazonaws.com/quietus_production/images/articles/24550/TFSMeatspace_1525802422.jpg
			return src.replace(/_crop_[0-9]+x[0-9]+(\.[^/.]*)$/, "$1");
		}

		if (domain_nowww === "bmi.com" &&
			string_indexof(src, "/images/") >= 0) {
			// https://www.bmi.com/images/photoblog/2010/cache/bmi_country_106052425ED006_58th_Annual__770_1103_90.JPG
			// https://www.bmi.com/images/photoblog/2010/cache/bmi_country_106052425ED006_58th_Annual__770_1103_90_s.JPG
			//   https://www.bmi.com/images/photoblog/2010/bmi_country_106052425ED006_58th_Annual_.JPG
			return src.replace(/\/cache\/([^/]*)_[0-9]+_[0-9]+_[0-9]+(?:_[a-z]+)?(\.[^/.]*)$/, "/$1$2");
		}

		if (domain === "media.rbl.ms") {
			// https://media.rbl.ms/image?u=%2Ffiles%2F2016%2F03%2F06%2F6359289786772823741235385117_articletaylor6.gif&ho=https%3A%2F%2Faz616578.vo.msecnd.net&s=473&h=bcac1953f8a26948e31526d400fd22ea593e9f404b32236b52589cc0d8dbf28e&size=980x&c=3774816102
			//   https://az616578.vo.msecnd.net/files/2016/03/06/6359289786772823741235385117_articletaylor6.gif
			if (string_indexof(src, "/image?") >= 0) {
				var queries = get_queries(src);
				return urljoin(decodeURIComponent(queries.ho), decodeURIComponent(queries.u));
			}
		}

		if (domain_nowww === "filepicker.io" ||
			// https://cdn.filestackcontent.com/PHbgOwLhTWG8g4xfsFu8/convert?cache=true&crop=46%2C24%2C2468%2C1234
			//   https://cdn.filestackcontent.com/resize=height:200/resize=width:100/PHbgOwLhTWG8g4xfsFu8
			//   https://cdn.filestackcontent.com/PHbgOwLhTWG8g4xfsFu8
			// https://cdn.filestackcontent.com/resize=height:200/v8x4EUOKRS6OowxpkY8i
			//   https://cdn.filestackcontent.com/v8x4EUOKRS6OowxpkY8i
			// https://cdn.filestackcontent.com/resize=height:200/resize=width:100/v8x4EUOKRS6OowxpkY8i
			//   https://cdn.filestackcontent.com/v8x4EUOKRS6OowxpkY8i
			// https://cdn.filestackcontent.com/resize=w:1280,fit:crop/quality=value:75/flop/crop=dim:[0,0,800,600]/flip/compress/v8x4EUOKRS6OowxpkY8i
			//   https://cdn.filestackcontent.com/v8x4EUOKRS6OowxpkY8i
			// https://cdn.filestackcontent.com/api/file/IKM4hngTeadpScVNjbD6?signature=888b9ea3eb997a4d59215bfbe2983c636df3c7da0ff8c6f85811ff74c8982e34&policy=eyJjYWxsIjogWyJyZWFkIiwgInN0YXQiLCAiY29udmVydCJdLCAiZXhwaXJ5IjogNDYyMDM3NzAzMX0%3D
			//   https://cdn.filestackcontent.com/IKM4hngTeadpScVNjbD6
			domain === "cdn.filestackcontent.com" ||
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/496
			// https://process.fs.grailed.com/AJdAgnqCST4iPtnUxiGtTz/auto_image/cache=expiry:max/rotate=deg:exif/resize=width:90,fit:crop/output=quality:90/compress/https://cdn.fs.grailed.com/ypWgr7MR4aijWTuPYd0j
			//   https://cdn.fs.grailed.com/ypWgr7MR4aijWTuPYd0j
			// https://process.fs.grailed.com/AJdAgnqCST4iPtnUxiGtTz/auto_image/cache=expiry:max/rotate=deg:exif/resize=width:580/output=quality:70/compress/https://process.fs.grailed.com/VLz1HW0ROQaMRtuUzDVw
			//   https://process.fs.grailed.com/VLz1HW0ROQaMRtuUzDVw
			// https://process.fs.grailed.com/AJdAgnqCST4iPtnUxiGtTz/auto_image/cache=expiry:max/rotate=deg:exif/resize=height:320,width:240,fit:crop/output=quality:70/compress/https://cdn.fs.grailed.com/api/file/YKru7dqnQGWdQhFbcFPM
			//   https://cdn.fs.grailed.com/api/file/YKru7dqnQGWdQhFbcFPM
			// https://process.fs.grailed.com/AJdAgnqCST4iPtnUxiGtTz/auto_image/cache=expiry:max/rotate=deg:exif/resize=height:150,width:130,fit:crop/output=quality:70/compress/https://cdn.fs.grailed.com/api/file/9BlnGbt1TUQGYjEBwEev
			//   https://cdn.fs.grailed.com/api/file/9BlnGbt1TUQGYjEBwEev
			// https://process.fs.grailed.com/AJdAgnqCST4iPtnUxiGtTz/cache=expiry:max/rotate=deg:exif/resize=height:50,align:center/output=quality:70/compress/https://www.filepicker.io/api/file/AINJEwUSe6ifAy6fNVs6
			//   https://www.filepicker.io/api/file/AINJEwUSe6ifAy6fNVs6
			// https://process.fs.grailed.com/AJdAgnqCST4iPtnUxiGtTz/cache=expiry:max/rotate=deg:exif/resize=height:120,align:center/output=quality:70/compress/https://www.filepicker.io/api/file/t1nDu2bhRtyc4KuZgxeG
			//   https://www.filepicker.io/api/file/t1nDu2bhRtyc4KuZgxeG
			// https://cdn.fs.grailed.com/api/file/{...} = https://www.filepicker.io/api/file/{...}
			domain === "process.fs.grailed.com" ||
			// thanks to dym-sh on github: https://github.com/qsniyg/maxurl/pull/385
			// https://media.graphcms.com/resize=w:1280,fit:crop/quality=value:75/flop/crop=dim:[0,0,800,600]/flip/compress/svyKyGYERiiGp4V9Z6w0
			//   https://media.graphcms.com/svyKyGYERiiGp4V9Z6w0
			domain === "media.graphcms.com" ||
			// thanks to ayunami2000 on github: https://github.com/qsniyg/maxurl/issues/764
			// https://blog.cdn.own3d.tv/resize=fit:crop,height:400,width:600/pKwIyI8RyGtPW35ZFg2m
			//   https://blog.cdn.own3d.tv/pKwIyI8RyGtPW35ZFg2m
			domain === "blog.cdn.own3d.tv" ||
			// https://d1t35hkz8sx2bl.cloudfront.net/api/file/ucxKmBR4S2DGj5pIuNlw/convert?w=1024&h=1024&fit=max&cache=true
			//   https://d1t35hkz8sx2bl.cloudfront.net/api/file/ucxKmBR4S2DGj5pIuNlw
			domain === "d1t35hkz8sx2bl.cloudfront.net") {
			// https://filepicker.io/api/file/9ej84qIQYKLgNFAbt4bz/convert?align=top&fit=clip&h=500&w=698
			//   https://filepicker.io/api/file/9ej84qIQYKLgNFAbt4bz
			// more info (thanks to dym-sh on github): https://github.com/GraphCMS/docs/tree/master/docs/assets
			newsrc = src
				.replace(/^[a-z]+:\/\/[^/]+\/+(?:[a-zA-Z0-9]{15,}\/+)?(?:(?:(?:[a-z]+=[^/]*|(?:fl[io]p|compress|auto_image))\/+)+|api\/+file\/+)?/, "")
				.replace(/^(?:convert(?:[?#].*)?|[?#.].*)$/, ""); // to remove invalid urls
			if (newsrc !== src && newsrc.length) {
				if (/^[a-z]+:\/\/[^/]+\/+/.test(newsrc))
					return newsrc;

				return urljoin(src, "/" + newsrc, true);
			}
			//return src.replace(/(:\/\/[^/]*\/)(?:(?:(?:[a-z]+=[^/]*|(?:fl[io]p|compress|auto_image))\/+)+|api\/+file\/+)?([^/?]*)(?:\/+(?:convert.*)?|\/*\?.*)?$/, "$1$2");

			return {
				url: src.replace(/^([a-z]+:\/\/[^/]+\/+(?:api\/+file\/+)?[0-9a-zA-Z]{15,})\/+convert\?.*/, "$1"),
				head_wrong_contenttype: true
			};
		}

		if (domain === "cdn.teenidols4you.com" ||
			domain === "www.teenidols4you.com") {
			// http://cdn.teenidols4you.com/thumb/Actors/katyperry/88katy-perry-1379801521.jpg
			//   http://www.teenidols4you.com/thumb/Actors/katyperry/katy-perry-1379801521.jpg
			//   http://www.teenidols4you.com/blink/Actors/katyperry/katy-perry-1379801521.jpg
			return src.replace(/:\/\/[^/]*\/thumb\/(.*?)\/(?:[0-9]+)?([^/]*)$/, "://www.teenidols4you.com/blink/$1/$2");
		}

		if (domain === "cdn.pixabay.com") {
			// https://cdn.pixabay.com/photo/2017/03/10/12/16/airbus-2132610_960_720.jpg
			//   https://pixabay.com/en/photos/download/airbus-2132610.jpg
			// only works when logged in
			newsrc = src.replace(/.*?\/photo\/.*\/([^/]*-[0-9]+)_+[0-9]+[^/]*(\.[^/.]*)$/,
								 "https://pixabay.com/en/photos/download/$1$2");

			obj = {
				url: src,
				redirects: true,
				headers: {
					//Cookie: "is_human=1",
					Referer: "https://pixabay.com/"
				}
			};

			var ret = [obj];

			if (newsrc !== src) {
				var newobj = deepcopy(obj);
				newobj.url = newsrc;
				ret.unshift(newobj);
			}

			return ret;
		}

		if (domain_nosub === "meetupstatic.com") {
			// https://secure.meetupstatic.com/photos/member/4/b/1/6/thumb_180259222.jpeg
			// https://secure.meetupstatic.com/photo_api/event/rx308x180/cpt/cr308x180/ql90/sgb54c13bc46/314373292.jpeg
			//   https://secure.meetupstatic.com/photos/event/8/2/0/c/600_314373292.jpeg
			//   https://secure.meetupstatic.com/photos/event/8/2/0/c/highres_314373292.jpeg
			//   https://secure.meetupstatic.com/photos/event/0/0/0/highres_314373292.jpeg
			// http://photos3.meetupstatic.com/photos/event/1/e/1/a/highres_13507706.jpeg -- 3264x2448
			return src
				.replace(/\/photo_api\/([^/]*)\/.*\/([0-9]+\.[^/.]*)$/, "/photos/$1/0/0/0/highres_$2")
				.replace(/\/(?:thumb|[0-9]+)_([0-9]+\.[^/.]*)$/, "/highres_$1");
		}

		if (domain === "d38c5dutwb1t0j.cloudfront.net") {
			// https://d38c5dutwb1t0j.cloudfront.net/Pictures/780xany/7/6/2/130762_shutterstock_174080612.jpg
			//   https://d38c5dutwb1t0j.cloudfront.net/Pictures/9999999xany/7/6/2/130762_shutterstock_174080612.jpg
			return src.replace(/\/Pictures\/[0-9a-z]+x[0-9a-z]+\//, "/Pictures/9999999xany/");
		}

		if (domain === "img.drillspin.com") {
			// http://img.drillspin.com/oi/200/06/DSAX259106.jpg
			//   http://img.drillspin.com/oi/orig/06/DSAX259106.jpg
			// http://img.drillspin.com/ar/144/27/DSAX317727.jpg
			//   http://img.drillspin.com/ar/orig/27/DSAX317727.jpg
			return src.replace(/(:\/\/[^/]*\/[a-z]+\/)[0-9]+\//, "$1orig/");
		}

		if (domain === "pics.drillspin.com") {
			// http://pics.drillspin.com/url/park/db05/bf82/d9aa/9177/dec1/596a/7871/95e3/200.jpg
			//   http://pics.drillspin.com/url/park/db05/bf82/d9aa/9177/dec1/596a/7871/95e3/orig.jpg
			return src.replace(/\/[0-9]+(\.[^/.]*)$/, "/orig$1");
		}

		if ((domain_nosub === "bestie.vn" && domain.match(/^static[0-9]*\./)) ||
			// https://img.highloadtest.com/390x0/1556109964_5cc05a8c3d8de.jpeg
			//   https://img.highloadtest.com/1556109964_5cc05a8c3d8de.jpeg
			domain === "img.highloadtest.com" ||
			// https://cdn.sinemia.com/64x88/artists/1470986296_57ad7838db0e7.jpg
			//   https://cdn.sinemia.com/artists/1470986296_57ad7838db0e7.jpg
			domain === "cdn.sinemia.com") {
			// http://static1.bestie.vn/320x1000/Mlog/ImageContent/201807/3-cap-chi-em-ruot-quyen-luc-nhat-kbiz-dep-xuat-sac-xuat-than-tram-an-44aca2.jpg
			//   http://static1.bestie.vn/Mlog/ImageContent/201807/3-cap-chi-em-ruot-quyen-luc-nhat-kbiz-dep-xuat-sac-xuat-than-tram-an-44aca2.jpg
			return src.replace(/(:\/\/[^/]*\/)[0-9]+x[0-9]+\//, "$1");
		}

		if (domain === "cdn.britannica.com") {
			// https://cdn.britannica.com/100x53/50/71350-118-1F17F9C4.jpg
			//   https://cdn.britannica.com/50/71350-118-1F17F9C4.jpg
			// https://cdn.britannica.com/s:500x350/35/155335-004-7F46A7C3.jpg
			//   https://cdn.britannica.com/35/155335-004-7F46A7C3.jpg
			// https://cdn.britannica.com/s:180x120,c:crop/77/170477-050-1C747EE3/Laptop-computer.jpg
			//   https://cdn.britannica.com/77/170477-050-1C747EE3/Laptop-computer.jpg
			return src.replace(/(:\/\/[^/]*\/)(?:s:)?[0-9]+x[0-9]+(?:,[^/]+)?\//, "$1");
		}

		if (domain === "cdn.awsli.com.br") {
			// https://cdn.awsli.com.br/600x450/493/493253/produto/18754331/8ee5235728.jpg
			//   https://cdn.awsli.com.br/493/493253/produto/18754331/8ee5235728.jpg
			return src.replace(/(:\/\/[^/]+\/+)[0-9]+x[0-9]+\/+([0-9]+\/+[0-9]+\/+)/, "$1$2");
		}

		if (domain_nowww === "pets4homes.co.uk") {
			// https://www.pets4homes.co.uk/images/articles/4276/large/why-might-your-cats-whiskers-fall-out-597f347251d52.jpg
			//   https://www.pets4homes.co.uk/images/articles/4276/original/why-might-your-cats-whiskers-fall-out-597f347251d52.jpg
			// https://www.pets4homes.co.uk/images/breeds/15/large/ea8fd9c9deb4550031c94c9bd7c104f5.jpeg
			//   https://www.pets4homes.co.uk/images/breeds/15/original/ea8fd9c9deb4550031c94c9bd7c104f5.jpeg
			return src.replace(/(\/images\/[^/]+\/[0-9]+\/)[a-z]+\/([^/]*)$/, "$1original/$2");
		}

		if (domain === "r.hswstatic.com") {
			// https://r.hswstatic.com/w_256/gif/now-EOAfigPY-tomatoeyes_hansneleman_gettyimagesjpg-1210-680.jpg
			//   https://s.hswstatic.com/gif/now-EOAfigPY-tomatoeyes_hansneleman_gettyimagesjpg-1210-680.jpg
			return src.replace(/:\/\/[^/]*\/[a-z]_[0-9]+\//, "://s.hswstatic.com/");
		}

		if (domain === "images.woovly.com") {
			// https://images.woovly.com/w_275/82ab5230-b2e9-11e8-b53c-2f37ee36d39a.jpeg -- upscaled
			//   https://images.woovly.com/82ab5230-b2e9-11e8-b53c-2f37ee36d39a.jpeg
			return src.replace(/(:\/\/[^/]+\/+)[wh]_[0-9]+\/+/, "$1");
		}

		if (domain_nowww === "candb.com") {
			// https://www.candb.com/site/candb/cache/artwork/130/dragon-age_the-queen-of-staves_bioware-main_104x180.jpg
			//   https://www.candb.com/site/candb/images/artwork/dragon-age_the-queen-of-staves_bioware-main.jpg
			// https://www.candb.com/site/candb/cache/artwork/1600/dragon-age_the-queen-of-staves_bioware-main_926x1600_marked.jpg
			//   https://www.candb.com/site/candb/images/artwork/dragon-age_the-queen-of-staves_bioware-main.jpg
			return src.replace(/(\/candb\/)cache\/([^/]*\/)[0-9]+\/([^/]*)_[0-9]+x[0-9]+(?:[^/]*)?(\.[^/.]*)$/, "$1images/$2$3$4");
		}

		if (domain_nowww === "ottawalife.com") {
			// http://www.ottawalife.com/admin/cms/images/small/olmgamer-dives-back-into-thedas-with-dragonage-inquisition-3-jpg.jpg
			//   http://www.ottawalife.com/admin/cms/images/large/olmgamer-dives-back-into-thedas-with-dragonage-inquisition-3-jpg.jpg
			return src.replace(/\/cms\/images\/[a-z]+\//, "/cms/images/large/");
		}

		if (domain === "assets.rpgsite.net") {
			// https://assets.rpgsite.net/images/images/000/026/311/block/DAI_Jun92014_16.jpg
			//   https://assets.rpgsite.net/images/images/000/026/311/original/DAI_Jun92014_16.jpg
			return src.replace(/(\/images\/[0-9]+\/[0-9]+\/[0-9]+\/)[a-z]+\/([^/]+)$/, "$1original/$2");
		}

		if (domain_nowww === "nusabali.com") {
			// https://www.nusabali.com/article_images/30694/berryhardianto-juara-australia-terbuka-2018-thumb-2018-05-14-153840_0.jpg
			//   https://www.nusabali.com/article_images/30694/berryhardianto-juara-australia-terbuka-2018-2018-05-14-153840_0.jpg
			// https://www.nusabali.com/article_images/30694/berryhardianto-juara-australia-terbuka-2018-800-2018-05-14-153840_0.jpg
			//   https://www.nusabali.com/article_images/30694/berryhardianto-juara-australia-terbuka-2018-2018-05-14-153840_0.jpg
			// doesn't work for all:
			// https://www.nusabali.com/article_images/30669/pgri-bali-soroti-turunnya-nilai-un-800-2018-05-14-115025_0.jpg
			// https://www.nusabali.com/article_images/30669/pgri-bali-soroti-turunnya-nilai-un-thumb-2018-05-14-115025_0.jpg
			return src.replace(/(\/article_images\/[0-9]+\/[^/]*)-(?:thumb|800)(-[0-9]+-[0-9]+-[0-9]+-[0-9]+_[0-9]+\.[^/.]*)$/, "$1$2");
		}

		if (domain_nowww === "wowkeren.com") {
			// https://www.wowkeren.com/display/images/160x117/2018/05/13/00208257.jpg
			//   https://www.wowkeren.com/display/images/photo/2018/05/13/00208257.jpg
			// https://www.wowkeren.com/images/events/thumb/2017/06/20/emma-watson-interview-mei-2017-01.jpg
			//   https://www.wowkeren.com/images/events/ori/2017/06/20/emma-watson-interview-mei-2017-01.jpg
			return src
				.replace(/\/display\/images\/[0-9]+x[0-9]+\//, "/display/images/photo/")
				.replace(/\/images\/events\/[^/]*\//, "/images/events/ori/");
		}

		if (domain === "m.aceshowbiz.com" ||
			domain_nowww === "aceshowbiz.com") {
			// https://m.aceshowbiz.com/images/wennpic/preview/dove-cameron-2017-iheartradio-mmva-arrivals-01.jpg
			//   https://www.aceshowbiz.com/images/wennpic/dove-cameron-2017-iheartradio-mmva-arrivals-01.jpg
			//   https://m.aceshowbiz.com/images/wennpic/ori/dove-cameron-2017-iheartradio-mmva-arrivals-01.jpg -- doesn't work
			// https://aceshowbiz.com/images/wennpic/preview/barbara-palvin-69th-cannes-film-festival-02.jpg
			//   https://aceshowbiz.com/images/wennpic/barbara-palvin-69th-cannes-film-festival-02.jpg
			//   https://m.aceshowbiz.com/images/wennpic/dove-cameron-2017-iheartradio-mmva-arrivals-01.jpg
			// https://www.aceshowbiz.com/display/images/160x117/2018/05/18/00120311.jpg
			//   https://www.aceshowbiz.com/display/images/photo/2018/05/18/00120311.jpg
			// thanks to DevWannabe-dot on github: https://github.com/qsniyg/maxurl/issues/840
			// https://www.aceshowbiz.com/images/news-thumb/2010/07/gossip_girl_14_wenn2924972.jpg
			//   https://www.aceshowbiz.com/images/wennpic/gossip_girl_14_wenn2924972.jpg
			// https://www.aceshowbiz.com/images/news-thumb/2013/08/taylor-swift-references-kanye-west-s-vmas-rant-on-gift-for-ed-sheeran.jpg
			//   https://www.aceshowbiz.com/images/news/taylor-swift-references-kanye-west-s-vmas-rant-on-gift-for-ed-sheeran.jpg
			newsrc = src
				.replace(/(\/display\/images\/)[0-9]+x[0-9]+\//, "$1/photo/")
				.replace(/(\/images\/[^/]*\/)preview\//, "$1");
			if (newsrc !== src)
				return newsrc;

			regex = /\/images\/+news-thumb\/+[0-9]{4}\/+[0-9]{2}\/+/;
			if (regex.test(src))
				return [
					src.replace(regex, "/images/wennpic/"),
					src.replace(regex, "/images/news/")
				];
		}

		if (domain === "asset.kompas.com" ||
			// https://assets.pikiran-rakyat.com/crop/120x22:1146x575/x/photo/2021/01/22/2066548430.jpg
			//   https://assets.pikiran-rakyat.com/photo/2021/01/22/2066548430.jpg
			domain === "assets.pikiran-rakyat.com" ||
			// http://asset-a.grid.id/crop/0x0:0x0/700x0/photo/2018/08/07/1840019897.jpg
			//   http://asset-a.grid.id/photo/2018/08/07/1840019897.jpg
			// https://asset-a.grid.id/crop/0x0:0x0/x/photo/2018/12/08/3295217691.jpg
			//   https://asset-a.grid.id/photo/2018/12/08/3295217691.jpg
			(domain_nosub === "grid.id" && domain.match(/^asset(?:-[a-z]*)?\./))) {
			// https://asset.kompas.com/crop/113x0:787x449/185x124/data/photo/2018/05/14/4120396036.jpg
			//   https://asset.kompas.com/data/photo/2018/05/14/4120396036.jpg
			// https://asset.kompas.com/crops/bE85pYvuYsJlLSfVy1CcTNTriWk=/0x0:0x0/780x390/filters:watermark(data/photo/2019/08/13/5d528b377fe82.png,0,-0,1)/data/photo/2016/08/30/0931073maria-selena-aplikas780x390.jpg
			//   https://asset.kompas.com/data/photo/2016/08/30/0931073maria-selena-aplikas780x390.jpg
			return src
				.replace(/\/crop\/[0-9x:]+\/[0-9]*x[0-9]*\//, "/")
				.replace(/\/crops\/+.*\/+(data\/+photo\/+)/, "/$1");
		}

		if (domain === "cdn.thinglink.me") {
			// https://cdn.thinglink.me/api/image/777977483742937091/1024/10/scaletowidth
			//   https://cdn.thinglink.me/api/image/777977483742937091
			// https://cdn.thinglink.me/api/image/7DceLftyMsyaZX9oqTXFcE7JbZyn6cssUmHn51dNeQmevWkfEcAcPYixtKrfTusWGcpZMjktM4d2KAD1wDjMx/320/320/scaledown
			//   https://cdn.thinglink.me/api/image/7DceLftyMsyaZX9oqTXFcE7JbZyn6cssUmHn51dNeQmevWkfEcAcPYixtKrfTusWGcpZMjktM4d2KAD1wDjMx
			return src.replace(/(\/api\/image\/[0-9a-zA-Z]+)\/.*$/, "$1");
		}

		if (domain === "images.sk-static.com") {
			// https://images.sk-static.com/images/media/profile_images/artists/8825119/huge_avatar
			//   https://images.sk-static.com/images/media/profile_images/artists/8825119/original
			// https://images.sk-static.com/images/media/profile_images/artists/308922/large_avatar
			return {
				url: src.replace(/(\/[0-9]+\/)[a-z_]+$/, "$1original"),
				head_wrong_contenttype: true
			};
		}

		if (domain === "www.stalkcelebs.com" && string_indexof(src, "/img-folder/") >= 0) {
			// http://www.stalkcelebs.com/img-folder/2018/04/dove-cameron-in-bikini-top-at-v-house-at-coachella-april-14-2018_t_119071958.jpg
			//   http://www.stalkcelebs.com/img-folder/2018/04/dove-cameron-in-bikini-top-at-v-house-at-coachella-april-14-2018_119071958.jpg
			return src.replace(/_t(_[0-9]+\.[^/.]*)$/, "$1");
		}

		if (domain === "www.picsofcelebrities.com") {
			// https://www.picsofcelebrities.com/media/celebrity/dove-cameron/pictures/medium/dove-cameron-kids.jpg
			//   https://www.picsofcelebrities.com/celebrity/dove-cameron/pictures/large/dove-cameron-kids.jpg
			// https://www.picsofcelebrities.com/media/celebrity/dove-cameron/pictures/medium/dove-cameron-2016.jpg
			//   https://www.picsofcelebrities.com/celebrity/dove-cameron/pictures/large/dove-cameron-2016.jpg
			return src.replace(/\/media(\/.*\/pictures\/)[a-z]+(\/[^/]*)$/, "$1large$2");
		}

		if (domain === "dxglax8otc2dg.cloudfront.net") {
			// https://dxglax8otc2dg.cloudfront.net/media/cache/people/idols/akiyama20090906-thumb.6648e6aae2cc.jpg
			//   https://dxglax8otc2dg.cloudfront.net/media/people/idols/akiyama20090906.jpg
			// https://dxglax8otc2dg.cloudfront.net/media/cache/people/groups/momusu_googleprofile_20150101_thumb.08ba8c8b3ef2.jpg
			//   https://dxglax8otc2dg.cloudfront.net/media/people/groups/momusu_googleprofile_20150101.jpg
			return src.replace(/\/media\/cache\/(.*)[-_]thumb\.[a-f0-9]+(\.[^/.]*)$/, "/media/$1$2");
		}

		if (domain_nosub === "smugmug.com" ||
			domain === "photos.smugmug.com") {
			// thanks to anonymous for reporting:
			// https://[subdomain].smugmug.com/img/spacer.gif
			if (/\/img\/+spacer\.gif(?:[?#].*)?$/.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}

			// thanks to /u/GarlicoinAccount on reddit for the example URLs and regex!
			// https://photos.smugmug.com/Portfolio/i-FsKpjtH/0/bc0067fc/L/Dubai%20at%20Dusk-L.jpg
			//   https://photos.smugmug.com/Portfolio/i-FsKpjtH/0/bc0067fc/O/Dubai%20at%20Dusk-O.jpg
			//   https://photos.smugmug.com/Portfolio/i-FsKpjtH/0/bc0067fc/O/.jpg
			// https://photos.smugmug.com/Galleries/Portfolio/i-97t56hx/0/85d1ded6/S/brentgoesoutside%20-%20Deep%20Cold%20-%2020180116_Deep%20Cold_Madison%20WI-S.jpg
			//   https://photos.smugmug.com/Portfolio/i-97t56hx/0/85d1ded6/O/brentgoesoutside%20-%20Deep%20Cold%20-%2020180116_Deep%20Cold_Madison%20WI-O.jpg
			//   gets redirected to:
			//   https://photos.smugmug.com/Galleries/Portfolio/i-97t56hx/0/85d1ded6/XL/brentgoesoutside%20-%20Deep%20Cold%20-%2020180116_Deep%20Cold_Madison%20WI-XL.jpg
			// https://photos.smugmug.com/Portfolio/i-97t56hx/0/85d1ded6/M/brentgoesoutside%20-%20Deep%20Cold%20-%2020180116_Deep%20Cold_Madison%20WI-M.jpg
			//   https://photos.smugmug.com/Portfolio/i-97t56hx/0/85d1ded6/O/brentgoesoutside%20-%20Deep%20Cold%20-%2020180116_Deep%20Cold_Madison%20WI-O.jpg
			// https://photos.smugmug.com/Outdoors/Los-Padres-National-Forest/i-Pm68s3d/0/f60a0297/X5/MCJ05326-X5.jpg
			//   https://photos.smugmug.com/Outdoors/Los-Padres-National-Forest/i-Pm68s3d/0/f60a0297/O/MCJ05326-O.jpg
			//   gets redirected to:
			//   https://photos.smugmug.com/Outdoors/Los-Padres-National-Forest/i-Pm68s3d/0/f60a0297/5K/MCJ05326-5K.jpg
			// https://photos.smugmug.com/Outdoors/Los-Padres-National-Forest/i-Pm68s3d/0/f60a0297/4K/MCJ05326-4K.jpg
			//   https://photos.smugmug.com/Outdoors/Los-Padres-National-Forest/i-Pm68s3d/0/f60a0297/O/MCJ05326-O.jpg
			// https://photos.smugmug.com/Outdoors/Los-Padres-National-Forest/i-Pm68s3d/0/f60a0297/XL/MCJ05326-XL.jpg
			//   https://photos.smugmug.com/Outdoors/Los-Padres-National-Forest/i-Pm68s3d/0/f60a0297/O/MCJ05326-O.jpg
			// https://photos.smugmug.com/Portfolio/Seattle-Sights/West-Seattle/i-PXJzQVB/1/7e0dd2ae/XL/DSC01014-Edit-1-XL.jpg
			//   https://photos.smugmug.com/Portfolio/Seattle-Sights/West-Seattle/i-PXJzQVB/1/7e0dd2ae/O/DSC01014-Edit-1-O.jpg -- 5168x3448, doesn't get redirected after
			//   https://photos.smugmug.com/Portfolio/Seattle-Sights/West-Seattle/i-PXJzQVB/1/7e0dd2ae/O/DSC01014-Edit-1-XL.jpg -- works too
			// https://photos.smugmug.com/Travel/Jongno-2018/i-647W9cb/0/686f9fdc/S/20180504-DSC_7229-Edit.jpg
			//   https://photos.smugmug.com/Travel/Jongno-2018/i-647W9cb/0/686f9fdc/O/20180504-DSC_7229-Edit.jpg
			// https://photos.smugmug.com/GWDC/2016/i-4WJhmJM/15/1b532670/X3/ATW06318-X3.jpg
			//   https://photos.smugmug.com/GWDC/2016/i-4WJhmJM/15/1b532670/4K/ATW06318-4K.jpg
			// https://keinomiayma.smugmug.com/Autumn-color/i-qx3SKvD/0/f6f93242/600x400/DSC09816-600x400.jpg
			// https://photos.smugmug.com/World-AIDS-Day-Gala-UK/n-3hGNK3/Grassroot-Soccer-World-AIDS-Day-Gala-2017/i-dLbnDsd/0/4f8ff87f/Ti/World%20Aids%20Day%20Gala%20%2023-Ti.jpg
			//   https://photos.smugmug.com/World-AIDS-Day-Gala-UK/n-3hGNK3/Grassroot-Soccer-World-AIDS-Day-Gala-2017/i-dLbnDsd/0/4f8ff87f/X5/World%20Aids%20Day%20Gala%20%2023-X5.jpg
			// https://stuckincustoms.smugmug.com/Portfolio/i-mhH9FzP/0/900x613/The%20Secret%20Lair%20of%20Hans%20Zimmer%2C%20where%20he%20inspires%20the%20world-900x613.jpg
			//   https://stuckincustoms.smugmug.com/Portfolio/i-mhH9FzP/0/O/The%20Secret%20Lair%20of%20Hans%20Zimmer%2C%20where%20he%20inspires%20the%20world-900x613.jpg
			//   https://stuckincustoms.smugmug.com/Portfolio/i-mhH9FzP
			// can't find original page:
			// https://photos.smugmug.com/photos/i-HqPJ9sp/0/2fc18a58/X3/i-HqPJ9sp-X3.jpg
			//   https://extremerossphotography.smugmug.com/Into-the-Night
			// but this works:
			//   https://extremerossphotography.smugmug.com/Extreme-Ross-Photography/i-56c4k4m/A
			//   https://photos.smugmug.com/Extreme-Ross-Photography/i-56c4k4m/0/4c1b59d0/XL/Large--XL.jpg
			// thanks to anonymous for reporting:
			// https://photos.smugmug.com/Sports-/Kentucky-Gymnastics-vs-BYU/i-FS8VLfc/0/ChWGMBJbxrHcGMCp9MLrrzf8WRfBwPdvp9mMMT5Fb/L/February%2016%2C%202024-Sports_UKGYM_vs_BYU-by_Tony_Vasquez_1_HR-L.jpg
			//   https://photos.smugmug.com/Sports-/Kentucky-Gymnastics-vs-BYU/i-FS8VLfc/0/6H2BBv5JfbSCZ2DrGFPkcHCLZZkTvBrfwZsrWX5/4K/February%2016%2C%202024-Sports_UKGYM_vs_BYU-by_Tony_Vasquez_1_HR-4K.jpg
			//return src.replace(/^((?:https?:)\/\/photos\.smugmug\.com\.?\/.+?\/)[A-Z0-9]{1,2}(\/[^\/]+?-)[A-Z0-9]{1,2}\.jpg(?:$|\?|#)/i,'$1O$2O.jpg');
			regex  =/(\/i-[A-Za-z0-9]+\/+[0-9]+\/+(?:[^/]+\/+)?)(?:[A-Z0-9x]+|Ti)(\/+[^/]*)(?:\?.*)?$/;
			newsrc = src.replace(regex, "$1O$2");
			obj = {
				url: src
			};

			if (newsrc !== src) {
				if (options.do_request) {
					common_functions["get_redirect_url"](api_cache, options, newsrc, options.cb);
					return {
						waiting: true
					};
				} else {
					return newsrc;
				}
			}

			if (options.force_page && options.do_request && options.cb && (newsrc !== src || regex.test(src))) {
				var get_original_page = function(imageid, cb) {
					api_cache.fetch("smugmug_original_page:" + imageid, cb, function(done) {
						options.do_request({
							method: "GET",
							// it doesn't matter the username, as long as it's a valid username, and it'll get redirected properly
							// A is needed because otherwise it think the path component is wrong
							url: "https://washingtonlife.smugmug.com/A/" + imageid + "/A",
							onload: function (result) {
								if (result.readyState !== 4)
									return;

								var match = result.responseText.match(/document\.location\.href\s*=\s*["'](.*?)["']/);
								if (match) {
									return done(match[1], 6*60*60);
								}

								done(null, false);
							}
						});
					});
				};

				match = src.match(/\/(i-[A-Za-z0-9]+)\/+[0-9]+\/+/);
				if (match) {
					get_original_page(match[1], function(originalpage) {
						if (originalpage)
							obj.extra = { page: originalpage };

						options.cb(obj);
					});

					return {
						waiting: true
					};
				}
			}

			return obj;
		}

		if (domain_nosub === "lithium.com" && string_indexof(domain, ".i.lithium.com") >= 0 ||
			// https://answers.ea.com/t5/image/serverpage/image-id/61452i15549A69E88E263F/image-size/small?v=1.0&px=-1
			//   https://answers.ea.com/t5/image/serverpage/image-id/61452i15549A69E88E263F?v=1.0
			domain === "answers.ea.com" ||
			// thanks to fedesk on discord:
			// https://eu.community.samsung.com/t5/image/serverpage/image-id/717746iC194351C81F0165F/image-size/small?v=v2&px=200
			//   https://eu.community.samsung.com/t5/image/serverpage/image-id/717746iC194351C81F0165F?v=v2
			// can also be replaced to:
			// https://eu.community.samsung.com/t5/image/serverpage/image-id/717746iC194351C81F0165F/image-size/original
			(domain_nosub === "samsung.com" && /^(?:[^.]+\.)?community\.samsung\./.test(domain)) ||
			// thanks to anonymous for reporting:
			// https://community.amd.com/t5/image/serverpage/image-id/93895i9433DD446475FD0C/image-size/large?v=v2&px=999
			//   https://community.amd.com/t5/image/serverpage/image-id/93895i9433DD446475FD0C?v=v2
			domain === "community.amd.com" ||
			// thanks to oifj34f34f on github: https://github.com/qsniyg/maxurl/issues/1231
			// https://community.spotify.com/t5/image/serverpage/image-id/164115iB6FC1DFABF76FC91/image-size/medium?v=v2&px=400
			//   https://community.spotify.com/t5/image/serverpage/image-id/164115iB6FC1DFABF76FC91?v=v2
			domain === "community.spotify.com" ||
			// https://nasz.orange.pl/t5/image/serverpage/image-id/1694i6BBA12E8BB8E9254/image-size/small/is-moderation-mode/true?v=1.0&px=400
			//   https://nasz.orange.pl/t5/image/serverpage/image-id/1694i6BBA12E8BB8E9254?v=1.0
			domain === "nasz.orange.pl" ||
			/^[a-z]+:\/\/[^/]+\/+t5\/+image\/+serverpage\/+image-id\/+[0-9]+i[0-9A-F]+\//.test(src)) {
			// https://spotify.i.lithium.com/t5/image/serverpage/image-id/84635i3C36019474421E94/image-size/large?v=1.0&px=999
			//   https://spotify.i.lithium.com/t5/image/serverpage/image-id/84635i3C36019474421E94/image-size/original?v=1.0
			var v = src.replace(/.*[?&](v=[^&]*).*/, "$1");
			if (v === src)
				v = "";
			else
				v = "?" + v;

			return {
				url: src.replace(/(\/image-id\/+[0-9]+i[0-9A-F]+)\/+image-size\/.*(?:\?.*)?$/, "$1" + v),
				head_wrong_contentlength: true
			};
		}

		if (domain === "www.favepeople.com") {
			// site is dead now
			// https://www.favepeople.com/photos/h0/35/h035d7s238i5e5o5c97b.jpg
			//   https://www.favepeople.com/photos/h0/35/h035d7s238i5e5o5c97b_b/Dove_Cameron_Red_Carpet_Style_3528.jpg
			// https://www.favepeople.com/photos/66/fe/66fe7i5d284bb46hnc04_s.jpg
			//   https://www.favepeople.com/photos/66/fe/66fe7i5d284bb46hnc04_b.jpg
			// https://www.favepeople.com/photos/a9/21/a921h8naond6e6d46es0/Pom_Klementieff_Red_Carpet_Style_38325.jpg -- 650x1069
			//   https://www.favepeople.com/photos/a9/21/a921h8naond6e6d46es0_b/Pom_Klementieff_Red_Carpet_Style_38325.jpg -- 2443x4020
			return src.replace(/(\/photos\/[0-9a-z]+\/[0-9a-z]+\/[0-9a-z]+)(?:_[a-z]+)?(\/[^/]*)?(\.[^/.]*)$/, "$1_b$2$3");
		}

		if (domain === "img.anews.com") {
			// https://img.anews.com/r/358x188/20161207/59703483.jpg
			//   https://img.anews.com/media/posts/images/20161207/59703483.jpg
			// https://img.anews.com/?url=https://img.anews.com/media/posts/images/20171210/81978684.jpg&w=358&h=188
			newsrc = src.replace(/.*\?url=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeURIComponent(newsrc);

			return src.replace(/\/r\/[0-9]+x[0-9]+\//, "/media/posts/images/");
		}

		if (domain_nosub === "5ce.com" && /^img(?:-[0-9]+)\.proxy\./.test(domain)) {
			// http://img-03.proxy.5ce.com/?url=http%3A%2F%2Fi3.5ceimg.com%2Fcontent%2Fc3a1bca2-b2e4-e911-8da1-20040ff9d71d.png&q=75
			//   http://i3.5ceimg.com/content/c3a1bca2-b2e4-e911-8da1-20040ff9d71d.png
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+\?(?:.*?&)?url=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "immagini.quotidiano.net" ||
			// https://safeimage.vusercontent.com/?url=http%3A%2F%2Fassets%2Erpgsite%2Enet%2Fimages%2Fimages%2F000%2F054%2F824%2Foriginal%2FMHW%5FJun122017%5F03%2Ejpg
			//   https://assets.rpgsite.net/images/images/000/054/824/original/MHW_Jun122017_03.jpg
			domain === "safeimage.vusercontent.com") {
			// https://immagini.quotidiano.net/?url=http://p1014p.quotidiano.net:80/polopoly_fs/1.3245998.1499154460!/httpImage/image.JPG_gen/derivatives/gallery_800/image.JPG&h=495&pos=top&w=626&mode=clip
			//   http://p1014p.quotidiano.net/polopoly_fs/1.3245998.1499154460!/httpImage/image.JPG_gen/derivatives/gallery_800/image.JPG
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+\?url=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nowww === "realitytvworld.com" ||
			domain === "cdn.realitytvworld.com") {
			// https://cdn.realitytvworld.com/images/heads/gen/embedded/1064843-s.jpg
			//   https://cdn.realitytvworld.com/images/heads/gen/embedded/1064843-l.jpg
			// https://cdn.realitytvworld.com/images/heads/gen/embedded/1053738-l.jpg -- 1200x1800, slightly desaturated
			//   https://cdn.realitytvworld.com/images/heads/gen/embedded/1053738-a.jpg -- 2000x3000
			// https://cdn.realitytvworld.com/images/heads/gen/embedded/1070430-a.jpg -- 1080x1350
			//   https://cdn.realitytvworld.com/images/heads/gen/embedded/1070430-l.jpg -- 1200x1500, looks upscaled
			// https://www.realitytvworld.com/images/gallery/4045-t.jpg
			//   https://www.realitytvworld.com/images/gallery/4045-o.jpg
			newsrc = src.replace(/(\/images\/+gallery\/+[0-9]+)-[a-z](\.[^/.]*)(?:[?#].*)?$/, "$1-o$2");
			if (newsrc !== src)
				return newsrc;

			regex = /(\/heads\/gen\/embedded\/[0-9]+)-[a-z](\.[^/.]*)$/;
			return [
				src.replace(regex, "$1-a$2"),
				src.replace(regex, "$1-l$2")
			];
		}

		if (domain === "video.newsserve.net" ||
			domain === "cdn.newsserve.net") {
			// https://video.newsserve.net/300/v/20170223/1487811916-Dove-Cameron-Shay-Mitchell-amp-amp-Ariel-Winter.jpg
			//   https://video.newsserve.net/v/20170223/1487811916-Dove-Cameron-Shay-Mitchell-amp-amp-Ariel-Winter.jpg
			// https://cdn.newsserve.net/700/i/20180821/1840-Asia-Argento-Scandal-Things-We-Still-Need.jpg -- stretched
			//   https://cdn.newsserve.net/i/20180821/1840-Asia-Argento-Scandal-Things-We-Still-Need.jpg
			return src.replace(/(:\/\/[^/]*\/)[0-9]+\//, "$1");
		}

		if (domain_nowww === "laughspark.info") {
			// http://www.laughspark.info/thumbfiles/290X169/beautiful-dove-cameron-at-thirst-gala-20-635792432637591680-16984.jpg
			//   http://laughspark.info/uploadfiles/beautiful-dove-cameron-at-thirst-gala-20-635792432637591680-16984.jpg
			return src.replace(/\/thumbfiles\/[0-9]+X[0-9]+\//, "/uploadfiles/");
		}

		if (domain_nosub === "giphy.com" && domain.match(/^(?:media[0-9]*|i)\./)) {
			// https://media.giphy.com/media/3og0IRYXdt9tTE52nK/giphy.gif
			// https://media.giphy.com/media/3og0IRYXdt9tTE52nK/giphy.mp4
			// https://i.giphy.com/media/3og0IRYXdt9tTE52nK/giphy.webp
			//   https://i.giphy.com/media/3og0IRYXdt9tTE52nK/source.gif
			// https://media1.giphy.com/media/l0Iy0lyLZnfdEBmMg/200w.webp
			// https://media1.giphy.com/media/l0Iy0lyLZnfdEBmMg/200w.gif
			// https://media2.giphy.com/media/ZBg5XWrvDVzNe/200_s.gif
			// private gif:
			// https://i.giphy.com/media/gHPsfv5TM792hQdBRH/giphy.webp

			let baseobj = {
				url: src,
				headers: {
					Referer: "https://giphy.com/"
				}
			};
			obj = baseobj;

			match = src.match(/\/media\/+([^/]{10,})\/+/);
			if (match) {
				var get_giphy_page = function(id) {
					return "https://giphy.com/gifs/" + id;
				};

				id = match[1];
				var page = get_giphy_page(id);
				baseobj.extra = {page: page};

				var query_giphy = function(id, cb) {
					var cache_key = "giphy:" + id;
					api_cache.fetch(cache_key, cb, function(done) {
						options.do_request({
							url: get_giphy_page(id),
							method: "GET",
							headers: {
								Referer: ""
							},
							onload: function(result) {
								if (result.readyState !== 4)
									return;

								if (result.status !== 200) {
									console_error(result);
									return done(null, false);
								}

								var match = result.responseText.match(/<script>\s*Giphy\.renderDesktop\(.*?{\s*gif:\s*({.+}),/);
								if (match) {
									try {
										var json = JSON_parse(match[1]);
										return done(json, 6*60*60);
									} catch (e) {
										console_error(e);
									}
								} else {
									console_warn("No match found", result);
								}

								done(null, false);
							}
						});
					});
				};

				if (options && options.do_request && options.cb) {
					query_giphy(id, function(data) {
						if (!data) {
							return options.cb(null);
						}

						var images = data.images;

						var get_image = function(obj) {
							var ourobj = deepcopy(baseobj);
							ourobj.url = obj.url;
							return ourobj;
						}

						if (images.source) {
							return options.cb(get_image(images.source));
						} else {
							// todo: look through images
							return options.cb(null);
						}
					});

					return {
						waiting: true
					};
				}
			}

			// Doesn't seem to always work, need to add bad-if to avoid linking to "private" (i.e. broken) images
			if (false) {
				// private gif:
				// https://i.giphy.com/media/mFYcQFmIkedO77iCEH/source.gif
				newsrc = src.replace(/:\/\/media[0-9]*\./, "://i.");
				if (newsrc !== src) {
					obj.url = newsrc;
					return obj;
				}

				newsrc = src.replace(/\/(?:giphy|[0-9]+[whs_]*)\.(?:gif|webp|mp4)/, "/source.mp4");
				// doesn't seem to work
				if (newsrc !== src) {
					obj.url = newsrc;
					return obj;
				}
			}

			return obj;
		}

		if (domain === "www.showgle.co.kr" && string_indexof(src, "/uploads/") >= 0) {
			// http://www.showgle.co.kr/uploads/data/team_info_new/photos/201803/7ede4d9a797f3899dcdc547f0fd673b2_m.jpg
			//   http://www.showgle.co.kr/uploads/data/team_info_new/photos/201803/7ede4d9a797f3899dcdc547f0fd673b2.jpg
			return src.replace(/(\/[0-9a-f]+)_[a-z](\.[^/.]*)$/, "$1$2");
		}

		if (domain === "photos.modelmayhem.com") {
			// https://photos.modelmayhem.com/photos/111017/06/4e9c2f9a9c118_m.jpg
			//   https://photos.modelmayhem.com/photos/111017/06/4e9c2f9a9c118.jpg
			// https://photos.modelmayhem.com/potd/entrants/110916/potd-110916-412494-small.jpg
			//   https://photos.modelmayhem.com/potd/entrants/110916/potd-110916-412494-big.jpg
			// https://photos.modelmayhem.com/avatars/2/3/1/0/8/0/9/587507cab04e8_m.jpg
			//   https://www.modelmayhem.com/portfolio/pic/41774255
			//   https://photos.modelmayhem.com/photos/170110/07/587501cb8ba84.jpg
			// https://photos.modelmayhem.com/avatars/1/1/2/5/8/5/7/4f5aae2600639_xt.jpg
			//   https://photos.modelmayhem.com/avatars/1/1/2/5/8/5/7/4f5aae2600639_t.jpg
			//   https://photos.modelmayhem.com/avatars/1/1/2/5/8/5/7/4f5aae2600639_m.jpg
			newsrc = src
				.replace(/(\/photos\/[0-9]+\/[0-9a-f]+\/[0-9a-f]+)_[a-z](\.[^/.]*)$/, "$1$2")
				.replace(/(\/potd\/entrants\/[0-9]+\/[^/]*)-[a-z]+(\.[^/.]*)$/, "$1-big$2")
				.replace(/(\/avatars\/+(?:[0-9]\/+){1,}[0-9a-f]+)_x?t(\.[^/.]+)(?:[?#].*)?$/, "$1_m$2");
			if (newsrc !== src)
				return newsrc;
		}

		if (host_domain_nosub === "modelmayhem.com" && options.element) {
			if (!src) {
				var current = options.element;
				while ((current = current.parentElement)) {
					if (current.tagName === "DIV" && current.id === "viewpic") {
						var og_image_meta = document.querySelector("meta[property=\"og:image\"]");
						if (og_image_meta) {
							return og_image_meta.getAttribute("content");
						}

						break;
					}
				}
			}

			var query_picid = function(picid, cb) {
				var cache_key = "modelmayhem:" + picid;

				api_cache.fetch(cache_key, cb, function(done) {
					options.do_request({
						url: "https://www.modelmayhem.com/portfolio/pic/" + picid,
						method: "GET",
						onload: function(resp) {
							if (resp.readyState !== 4)
								return;

							if (resp.status !== 200) {
								console_error(cache_key, resp);
								return done(null, false);
							}

							var match = resp.responseText.match(/<meta\s+property="og:image"\s+content="([^"]+)"/);
							if (!match) {
								console_error(cache_key, "Unable to find match", resp);
								return done(null, false);
							}

							return done(decode_entities(match[1]), 24*60*60);
						}
					});
				});
			};

			var get_picid_from_url = function(url) {
				return url.replace(/.*\/portfolio\/+pic\/+([0-9]+)(?:[?#].)?$/, "$1");
			};

			if (options.do_request && options.cb) {
				var parent = options.element.parentElement;
				if (parent && parent.tagName === "A" && /\/portfolio\/+pic\/+[0-9]+/.test(parent.href)) {
					query_picid(get_picid_from_url(parent.href), function(newsrc) {
						if (newsrc) {
							var obj:BigImageInfoSObject = {
								url: newsrc
							};

							if (/\/images\/+nopic_worksafe-on\./.test(src)) {
								obj.can_cache = false;
							}

							options.cb(obj);
						} else {
							options.cb(null);
						}
					});

					return {
						waiting: true
					};
				}
			}
		}

		if (domain === "static.artbible.info") {
			// https://static.artbible.info/medium/lastman_kruisiging.jpg
			//   https://static.artbible.info/large/lastman_kruisiging.jpg
			return src.replace(/(:\/\/[^/]*\/)[a-z]+\//, "$1large/");
		}

		if (domain_nosub === "oclc.org" && domain.match(/\.contentdm\./) ||
			// http://digital.denverlibrary.org/utils/ajaxhelper/?CISOROOT=p16079coll39&CISOPTR=936&action=2&DMSCALE=5&DMWIDTH=512&DMHEIGHT=416&DMX=0&DMY=0&DMTEXT=&DMROTATE=0
			//   http://digital.denverlibrary.org/cdm/ref/collection/p16079coll39/id/936
			//   http://worldcat.org/digitalarchive/viewmaster/server16079.contentdm.oclc.org/DPL/p16079coll39/CDI/1493140873122/map_2017_124.tif -- archival file, 12085x8333 (257mb)
			//   http://digital.denverlibrary.org/digital/iiif/p16079coll39/936/full/full/0/default.jpg -- file returned by this script, 9000x6205 (16mb)
			domain === "digital.denverlibrary.org") {
			// https://cdm15878.contentdm.oclc.org/digital/api/singleitem/image/p15878coll9/104/default.jpg?highlightTerms=
			//   https://cdm15878.contentdm.oclc.org/digital/iiif/p15878coll9/104/full/full/0/default.jpg
			// https://grpl.contentdm.oclc.org/digital/download/collection/p15416coll4/id/541/size/large
			//   https://grpl.contentdm.oclc.org/digital/api/singleitem/image/p15416coll4/541/default.jpg
			//   https://grpl.contentdm.oclc.org/digital/iiif/p15416coll4/541/full/full/0/default.jpg
			// thanks to rahidz on github: https://github.com/qsniyg/maxurl/issues/21
			// http://cdm16622.contentdm.oclc.org/utils/ajaxhelper/?CISOROOT=gokfa&CISOPTR=973&action=2&DMSCALE=20&DMWIDTH=213&DMHEIGHT=400&DMX=0&DMY=0&DMTEXT=&DMROTATE=0
			//   https://cdm16622.contentdm.oclc.org/digital/api/singleitem/image/gokfa/973/default.jpg
			//   https://cdm16622.contentdm.oclc.org/digital/iiif/gokfa/973/full/full/0/default.jpg
			newsrc = src
				.replace(/\/+digital\/+api\/+singleitem\/+image\/+([^/]*\/+[0-9]+)\/+.*(\.[^/.?#]*)(?:[?#].*)?$/,
						 "/digital/iiif/$1/full/full/0/default$2")
				.replace(/\/+digital\/+download\/+collection\/+([^/]*)\/(?:.*\/)?id\/+([0-9]+).*?$/,
						 "/digital/api/singleitem/image/$1/$2/default.jpg");

			if (newsrc !== src)
				return newsrc;

			if (src.match(/:\/\/[^/]*\/+utils\/+ajaxhelper\/+/)) {
				var queries = get_queries(src);
				var folder = queries.CISOROOT;
				var id = queries.CISOPTR;

				return src.replace(/(:\/\/[^/]*\/).*$/, "$1digital/api/singleitem/image/" + folder + "/" + id + "/default.jpg");
			}
		}

		if (domain === "tools.wmflabs.org") {
			// https://tools.wmflabs.org/zoomviewer/iipsrv.fcgi/?iiif=cache/6302d52ed6ce3d0e2f0c41701aa91813.tif/pct:65,81,35,15/full/0/default.jpg
			//  https://tools.wmflabs.org/zoomviewer/iipsrv.fcgi/?iiif=cache/6302d52ed6ce3d0e2f0c41701aa91813.tif/full/full/0/default.jpg
			newsrc = src.replace(/(\/zoomviewer\/+iipsrv\.fcgi\/+\?(?:.*&)?iiif=[^/]+\/+[^/]+\/+)[^/]+\/[^/]+\/[^/]+\/([^/]+\.[^/.]*)$/, "$1full/full/0/$2");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nowww === "koodtv.com" ||
			// http://www.hanimusic.com/cover/thumb-602577649608A_600x600.jpg
			//   http://www.hanimusic.com/cover/602577649608A.jpg
			domain_nowww === "hanimusic.com") {
			// https://koodtv.com/data/apms/video/youtube/thumb-T-18eNTsNk0_180x320.jpg
			//   https://koodtv.com/data/apms/video/youtube/T-18eNTsNk0.jpg
			return src.replace(/\/thumb-([^/.]*)_[0-9]+x[0-9]+(\.[^/.]*)$/, "/$1$2");
		}

		if (domain === "file.bodnara.co.kr") {
			// http://file.bodnara.co.kr/logo/insidelogo.php?image=%2Fhttp%3A%2F%2Ffile.bodnara.co.kr%2Fwebedit%2Fnews%2F2005%2F1150168644-3gate_at_computex2006_1.jpg
			//   http://file.bodnara.co.kr/webedit/news/2005/1150168644-3gate_at_computex2006_1.jpg
			return decodeURIComponent(src.replace(/.*?\/insidelogo\.php.*?[?&]image=([^&]*).*$/, "$1")).replace(/^\/*/, "");
		}

		if (domain === "passport.mobilenations.com" ||
			// https://www.timpul.md/timpulmd/uploads/modules/news/2016/02/87519/465x0_1.jpg
			//   https://www.timpul.md/timpulmd/uploads/modules/news/2016/02/87519/1.jpg
			(domain_nowww === "timpul.md" && string_indexof(src, "/uploads/") >= 0)) {
			// https://passport.mobilenations.com/avatars/000/000/000/100x100_42.jpg?r=9
			//   https://passport.mobilenations.com/avatars/000/000/000/42.jpg?r=9
			return src.replace(/\/[0-9]+x[0-9]+_([^/]*\.[^/.]*)$/, "/$1");
		}

		// monetate
		if (domain === "www.dollargeneral.com" &&
			string_indexof(src, "/media/") >= 0) {
			// https://www.dollargeneral.com/media/catalog/product/cache/image/700x700/e9c3970ab036de70892d86c6d221abfe/1/3/13480701.jpg
			//   https://www.dollargeneral.com/media/catalog/product/cache/image/e9c3970ab036de70892d86c6d221abfe/1/3/13480701.jpg
			// https://www.dollargeneral.com/media/catalog/product/cache/thumbnail/90x90/beff4985b56e3afdbeabfc89641a4582/1/3/13480701_6.jpg
			//   https://www.dollargeneral.com/media/catalog/product/cache/image/beff4985b56e3afdbeabfc89641a4582/1/3/13480701_6.jpg
			return src.replace(/\/cache\/(?:image|thumbnail)\/[0-9]+x[0-9]+\//, "/cache/image/");
		}

		if (domain === "www.dollartree.com" &&
			string_indexof(src, "/assets/") >= 0) {
			// https://www.dollartree.com/assets/product_images_2016/styles/xlarge/214435.jpg
			//   https://www.dollartree.com/assets/product_images_2016/styles/jumbo/214435.jpg
			// https://www.dollartree.com/assets/product_images_2016/styles/jumbo/114193.jpg -- 3000x3000
			return src.replace(/\/styles\/[^/]*\/([^/]*)$/, "/styles/jumbo/$1");
		}

		if (domain === "d2192bm55jmxp1.cloudfront.net") {
			// https://d2192bm55jmxp1.cloudfront.net/resize/s/article/201801/9e7b653cf2fd97604b64198dd954676e52819077d7e80540113ec5508f641629.jpg
			//   https://d2192bm55jmxp1.cloudfront.net/resize/l/article/201801/9e7b653cf2fd97604b64198dd954676e52819077d7e80540113ec5508f641629.jpg
			//   https://d2192bm55jmxp1.cloudfront.net/origin/article/201801/9e7b653cf2fd97604b64198dd954676e52819077d7e80540113ec5508f641629.jpg
			return src.replace(/\/resize\/[a-z]+\//, "/origin/");
		}

		if (domain === "i.marieclaire.com.tw") {
			// https://i.marieclaire.com.tw/assets/mc/201805/800X533/5AF92AC270A191526278850.jpg
			//   https://i.marieclaire.com.tw/assets/mc/201805/5AF92AC270A191526278850.jpeg
			// https://i.marieclaire.com.tw/assets/mc/201805/80X80/5AF92AC7DAA811526278855.jpg
			//   https://i.marieclaire.com.tw/assets/mc/201805/5AF92AC7DAA811526278855.jpeg
			newsrc = src.replace(/\/[0-9]+X[0-9]+\/([0-9A-F]+\.[^/.]*)$/, "/$1");
			if (newsrc !== src) {
				return [newsrc.replace(/\.jpg$/, ".jpeg"), newsrc];
			}
		}

		if (domain === "ir.marieclaire.com.tw") {
			// https://ir.marieclaire.com.tw/s800t533h100/assets/mc/201808/5B696A05BF13B1533635077.jpeg
			//   https://i.marieclaire.com.tw/assets/mc/201808/5B696A05BF13B1533635077.jpeg
			return src.replace(/:\/\/[^/]*\/(?:[a-z][0-9]+){1,}\/+assets\/+/, "://i.marieclaire.com.tw/assets/");
		}

		if (domain === "img.vogue.com.tw" ||
			// https://dw6vrgax4fzym.cloudfront.net/userfiles/sm/sm640480_images_A1/17335/2019041776152297.JPG
			//   https://dw6vrgax4fzym.cloudfront.net/userfiles/images_A1/17335/2019041776152297.JPG
			domain === "dw6vrgax4fzym.cloudfront.net" ||
			// https://img.gq.com.tw/_rs/645/userfiles/sm/sm1024_images_A1/26353/2016021660174717.jpg
			//   https://img.gq.com.tw/userfiles/sm/sm1024_images_A1/26353/2016021660174717.jpg
			domain === "img.gq.com.tw") {
			// https://img.vogue.com.tw/_rs/960/userfiles/FCK/2018051404582865.jpg
			//   https://img.vogue.com.tw/userfiles/FCK/2018051404582865.jpg
			// https://img.vogue.com.tw/userfiles/thumbnail/sm1280_images_A0/21188/2015073163644141.jpg
			//   https://img.vogue.com.tw/userfiles/images_A0/21188/2015073163644141.jpg
			return src
				.replace(/\/_rs\/[0-9]+\//, "/")
			// https://img.gq.com.tw/userfiles/sm/sm645450_images_A1/35300/2018022167374993.jpg
			// https://img.gq.com.tw/userfiles/sm/sm1024_images_A1/35300/2018022167374993.jpg
			//   https://img.gq.com.tw/userfiles/images_A1/35300/2018022167374993.jpg
				.replace(/\/userfiles\/(?:sm|thumbnail)\/sm[0-9]+_images/, "/userfiles/images");
		}

		if (domain === "niuerdata.donews.com" ||
			// https://niuerdata.g.com.cn/data/shareimg_oss/new_thumb/2018/05/15/thumb_48ac307abe056fa7c49b5e68074e5534.JPEG
			//   https://niuerdata.g.com.cn/data/shareimg_oss/big_media_img/2018/05/15/48ac307abe056fa7c49b5e68074e5534.JPEG
			domain === "niuerdata.g.com.cn") {
			// http://niuerdata.donews.com/data/shareimg_oss/new_thumb/2018/05/21/thumb_692f2b93a7d515a7c853ceb6020763a5.JPEG
			//   http://niuerdata.donews.com/data/shareimg_oss/big_media_img/2018/05/21/692f2b93a7d515a7c853ceb6020763a5.JPEG
			// http://niuerdata.donews.com/data/shareimg_oss/big_media_img/2018/04/16/6251df21989522b68b9cd500ec26894c.JPEG -- 4032x2269
			return src
				.replace(/\/new_thumb\//, "/big_media_img/")
				.replace(/\/thumb_([0-9a-f]+\.[^/.]*)$/, "/$1");
		}

		if (domain === "pictures.icpress.cn") {
			// wip
			// http://pictures.icpress.cn/thumbs/imgs/2018/0511/20180511_83981s.jpg
			//   http://pictures.icpress.cn/thumbs/imgs/2018/0511/20180511_83981.jpg
			return src.replace(/s(\.[^/.]*)$/, "$1");
		}

		if ((domain === "interview365.mk.co.kr" &&
			 string_indexof(src, "/images/") >= 0)) {
			// http://interview365.mk.co.kr/paper/data/news/images/2012/08/2915_S_1343748329.jpg -- 480x324
			//   http://interview365.mk.co.kr/paper/data/news/images/2012/08/2915_L_1343748329.jpg -- same
			// http://interview365.mk.co.kr/paper/data/news/images/2017/09/4272_S_1505186288.jpg -- 99x66
			//   http://interview365.mk.co.kr/paper/data/news/images/2017/09/4272_L_1505186288.jpg -- 2236x1488
			// http://interview365.mk.co.kr/paper/data/news/images/2017/09/4272_S_1506304037.jpg
			//   http://interview365.mk.co.kr/paper/data/news/images/2017/09/4272_L_1506304037.jpg
			// doesn't work for all:
			// http://interview365.mk.co.kr/paper/data/news/images/2017/07/4273_S_1500613825.jpg -- 800x1024
			//   http://interview365.mk.co.kr/paper/data/news/images/2017/07/4273_L_1500613825.jpg -- not found
			return src.replace(/(\/[0-9]+_)[A-Z](_[0-9]+\.[^/.]*)$/, "$1L$2");
		}

		if (domain === "draw.acharts.net") {
			// https://draw.acharts.net/cover/93803-55f057f54dd47-s.jpg
			//   https://draw.acharts.net/cover/93803-55f057f54dd47-l.jpg
			return src.replace(/-[a-z](\.[^/.]*)$/, "-l$1");
		}

		if (domain === "gqhotstuff.gq.com.mx") {
			// http://gqhotstuff.gq.com.mx/api/photos/small/886.jpg
			//   http://gqhotstuff.gq.com.mx/api/photos/medium/886.jpg
			//   http://gqhotstuff.gq.com.mx/api/photos/original/886.jpg
			// http://gqhotstuff.gq.com.mx/api/photos/medium/115.jpg -- upscaled
			//   http://gqhotstuff.gq.com.mx/api/photos/original/115.jpg -- smaller, not upscaled
			// http://gqhotstuff.gq.com.mx/api/photos/medium/100.jpg -- smaller
			//   http://gqhotstuff.gq.com.mx/api/photos/original/100.jpg -- larger, not upscaled
			return src.replace(/\/api\/photos\/[a-z]+\//, "/api/photos/original/");
		}

		if (domain === "images.apester.com") {
			// https://images.apester.com/user-images%2Faa%2Faaecb0949e6508374487f5f8dc120595.jpg/400/undefined/undefined
			//   https://images.apester.com/user-images%2Faa%2Faaecb0949e6508374487f5f8dc120595.jpg
			return {
				url: src.replace(/(:\/\/[^/]*\/[^/]*\.[^/.]*)\/[/a-z0-9]+$/, "$1"),
				head_wrong_contentlength: true
			};
		}

		if (domain === "twt-thumbs.washtimes.com") {
			// https://twt-thumbs.washtimes.com/media/image/2017/04/25/tv-disney-descendants_77076_c0-218-2002-1385_s885x516.jpg?888310701b41d5af593b29f6b17ebf6bfadcfec1
			//   https://twt-media.washtimes.com/media/image/2017/04/25/tv-disney-descendants_77076.jpg
			// https://twt-thumbs.washtimes.com/media/image/2018/01/30/AP_17060654021879_s4096x2865.jpg?be8aca3bb879af6c6a7bfa91ffb108283c5ad921
			//   https://twt-media.washtimes.com/media/image/2018/01/30/AP_17060654021879.jpg
			// https://twt-thumbs.washtimes.com/media/img/staff/2017/TWT_headshot_s220x278.jpg?7061ac50c834ee0aa00bcb0fbf128328750668c6
			//   https://twt-media.washtimes.com/media/img/staff/2017/TWT_headshot.jpg
			return src.replace(/(:\/\/twt-)thumbs(\.[^/]*\/media\/(?:image|img)\/.*?)_[cs][0-9][-_0-9a-z]+(\.[^/.?]*)(?:\?.*)?$/, "$1media$2$3");
		}

		if (domain === "dynamicmedia.zuza.com") {
			// https://www.therecord.com/whatson-story/7496991-new-on-dvd-for-aug-15-descendants-2-alien-covenant-/
			// https://dynamicmedia.zuza.com/zz/m/original_/8/b/8b4ce612-1bac-40dd-ac6b-e4365811da43/B823485990Z.1_20170810201750_000_G5B1UCEI3.2_Super_Portrait.jpg
			//  https://dynamicmedia.zuza.com/zz/m/original_/8/b/8b4ce612-1bac-40dd-ac6b-e4365811da43/B823485990Z.1_20170810201750_000_G5B1UCEI3.2.jpg
			// https://dynamicmedia.zuza.com/zz/m/cropped_135x90/9/6/963074a2-e60d-43a9-9a9c-d4e5e3fae1aa/B88187086Z.1_20180518174044_000_GA76EN9Q.8-0_150x100.jpg
			//   https://dynamicmedia.zuza.com/zz/m/original_/9/6/963074a2-e60d-43a9-9a9c-d4e5e3fae1aa/B88187086Z.1_20180518174044_000_GA76EN9Q.8-0_150x100.jpg
			//   https://dynamicmedia.zuza.com/zz/m/original_/9/6/963074a2-e60d-43a9-9a9c-d4e5e3fae1aa/B88187086Z.1_20180518174044_000_GA76EN9Q.8-0_Super_Portrait.jpg
			//   https://dynamicmedia.zuza.com/zz/m/original_/9/6/963074a2-e60d-43a9-9a9c-d4e5e3fae1aa/B88187086Z.1_20180518174044_000_GA76EN9Q.8-0.jpg
			//   http://media.zuza.com/9/6/963074a2-e60d-43a9-9a9c-d4e5e3fae1aa/B88187086Z.1_20180518174044_000_GA76EN9Q.8-0_150x100.jpg -- https is not supported
			// https://dynamicmedia.zuza.com/zz/m/cropped_250x165/9/3/9316ab6b-6b66-48cc-aa48-cb5804bba6ce/OOSTERHOFFSAM_300x200.jpg
			//   https://dynamicmedia.zuza.com/zz/m/original_/9/3/9316ab6b-6b66-48cc-aa48-cb5804bba6ce/OOSTERHOFFSAM_300x200.jpg
			// https://dynamicmedia.zuza.com/zz/m/original_/3/6/367af217-e9e0-40ab-a914-f46db9d9be2f/BS2BS1291668_Image1_Super_Portrait.jpg
			//   https://dynamicmedia.zuza.com/zz/m/original_/3/6/367af217-e9e0-40ab-a914-f46db9d9be2f/BS2BS1291668_Image1.jpg -- smaller
			//   http://media.zuza.com/3/6/367af217-e9e0-40ab-a914-f46db9d9be2f/BS2BS1291668_Image1_Super_Portrait.jpg
			return src
				.replace(/\/zz\/m\/[^/]*\//, "/zz/m/original_/")
				.replace(/(\.[0-9]*(?:-[0-9]+)?)_[^-./]*(\.[^/.]*)$/, "$1$2");
		}

		if (domain === "images.commeaucinema.com") {
			// http://images.commeaucinema.com/galerie/153509_5ddfccd27e59616c161c5742a63bfd42.jpg -- 260x192
			//   http://images.commeaucinema.com/galerie/big/153509_5ddfccd27e59616c161c5742a63bfd42.jpg -- 3152x2336
			return src.replace(/\/galerie\/([^/]*)$/, "/galerie/big/$1");
		}

		if (domain === "static.screenweek.it" ||
			amazon_container === "static.screenweek.it") {
			// https://s3-eu-west-1.amazonaws.com/static.screenweek.it/2016/11/29/Descendants%202%20Sofia%20Carson%20Dove%20Cameron%20foto%20dal%20film%202_mid.jpg?1480423066
			// http://static.screenweek.it/2016/11/29/Descendants%202%20Sofia%20Carson%20Dove%20Cameron%20foto%20dal%20film%202_mid.jpg?1480423066
			//   http://static.screenweek.it/2016/11/29/Descendants%202%20Sofia%20Carson%20Dove%20Cameron%20foto%20dal%20film%202_big.jpg?1480423066
			//   http://static.screenweek.it/2016/11/29/Descendants%202%20Sofia%20Carson%20Dove%20Cameron%20foto%20dal%20film%202.jpg?1480423066
			return src.replace(/_[a-z]+(\.[^/.]*)$/, "$1");
		}

		if (domain_nowww === "goodblud.com") {
			// https://goodblud.com/media/mppicture/2019/06/18/17_58f22209-093b-4735-a4a2-43f5aee8714f_mid.jpg
			//   https://goodblud.com/media/mppicture/2019/06/18/17_58f22209-093b-4735-a4a2-43f5aee8714f_big.jpg
			return src.replace(/(\/media\/+mppicture\/+[0-9]{4}\/+[0-9]{2}\/+[0-9]{2}\/+[0-9]+_[-0-9a-f]{30,})_mid(\.[^/.]*)(?:[?#].*)?$/, "$1_big$2");
		}

		if (domain === "da4pli3l5vc0d.cloudfront.net") {
			// https://da4pli3l5vc0d.cloudfront.net/0f/dd/0fdd8b9ee75364aff60f148056780047a7dc282e/h=310,w=414,crop=top-20/?app=portal&sig=48add57365ba639191586c902db821d28579a8ebe483ba48027c34b5f221fa94
			//   https://da4pli3l5vc0d.cloudfront.net/0f/dd/0fdd8b9ee75364aff60f148056780047a7dc282e
			return src.replace(/(:\/\/[^/]*\/(?:(?:[0-9a-f]{2})\/){2}[0-9a-f]+)\/.*$/, "$1");
		}

		if (domain_nosub === "hollywood.com" && domain.match(/photo\.media[0-9]*\.hollywood\.com/)) {
			// http://photo.media.hollywood.com/prevcln/3/2/3/32368979.jpg
			//   http://photo.media.hollywood.com/full/3/2/3/32368979.jpg
			return src.replace(/(:\/\/[^/]*\/)[^/]*\//, "$1full/");
		}

		// DataLife Engine?
		if (((domain === "www.doodoo.ru" ||
			  // http://www.youloveit.ru/uploads/posts/2017-07/thumbs/1499865322_youloveit_ru_nasledniki_2_foto_s_krasnoi_kovrovoi_dorogki02.jpg
			  //   http://www.youloveit.ru/uploads/posts/2017-07/1499865322_youloveit_ru_nasledniki_2_foto_s_krasnoi_kovrovoi_dorogki02.jpg
			  domain === "www.youloveit.ru" ||
			  // http://www.take.az/uploads/posts/2014-04/thumbs/1397909548_alba.jpg
			  //   http://www.take.az/uploads/posts/2014-04/1397909548_alba.jpg
			  domain_nowww === "take.az" ||
			  // http://starmodels.ru/uploads/posts/2014-10/thumbs/1413090916_keira-knightley-glamour-01.jpg
			  //   http://starmodels.ru/uploads/posts/2014-10/1413090916_keira-knightley-glamour-01.jpg
			  domain_nowww === "starmodels.ru" ||
			  // http://nevseoboi.com.ua/uploads/posts/2012-06/thumbs/1339242493-1743970-0127743_www.nevseoboi.com.ua.jpg
			  //   http://nevseoboi.com.ua/uploads/posts/2012-06/1339242493-1743970-0127743_www.nevseoboi.com.ua.jpg
			  domain_nowww === "nevseoboi.com.ua" ||
			  // https://photoofnude.com/uploads/posts/2014-03/thumbs/1394439159_761200l-581x0-selena-gomez-na-denudedstar.com-w-9ae745d9.jpg
			  //   https://photoofnude.com/uploads/posts/2014-03/1394439159_761200l-581x0-selena-gomez-na-denudedstar.com-w-9ae745d9.jpg
			  domain_nowww === "photoofnude.com" ||
			  // http://hronika.info/uploads/posts/2017-05/thumbs/1493885290_uotson3.jpg
			  //   http://hronika.info/uploads/posts/2017-05/1493885290_uotson3.jpg
			  domain_nowww === "hronika.info" ||
			  // http://qadin.net/uploads/posts/2014-06/thumbs/1403965159_52229_117350.jpg
			  //   http://qadin.net/uploads/posts/2014-06/1403965159_52229_117350.jpg
			  domain_nowww === "qadin.net" ||
			  // http://allday2.com/uploads/posts/2016-10/thumbs/1476527388_stellar_collision_by_kuldarleement-d6kvnyd.jpg
			  //   http://allday2.com/uploads/posts/2016-10/1476527388_stellar_collision_by_kuldarleement-d6kvnyd.jpg
			  domain_nowww === "allday2.com" ||
			  // http://tonshuul.mn/uploads/posts/2016-08/thumbs/1472456375_ab3e6c5f33b46a86great.jpg
			  //   http://www.tonshuul.mn/uploads/posts/2016-08/1472456375_ab3e6c5f33b46a86great.jpg
			  domain_nowww === "tonshuul.mn" ||
			  // http://animechan.ru/uploads/posts/2017-02/thumbs/1486670042_8964c2494e73461b4a4302eb_1477163497.jpg
			  //   http://animechan.ru/uploads/posts/2017-02/1486670042_8964c2494e73461b4a4302eb_1477163497.jpg
			  domain_nowww === "animechan.ru" ||
			  // http://www.sexs-foto.com/uploads/posts/2015-12/thumbs/1451558834_golaya-natali-portman_13_sexs-foto.com.jpg
			  domain_nowww === "sexs-foto.com" ||
			  // http://sexs-foto.info/uploads/posts/2015-12/thumbs/1451558834_golaya-natali-portman_13_.jpg
			  //   http://sexs-foto.info/uploads/posts/2015-12/1451558834_golaya-natali-portman_13_.jpg
			  // http://sexs-foto.info/uploads/blockpro/200x200/2018-04/200x200_crop_1522920478_golaya-elena-ksenofontova_4_.jpg
			  //   http://sexs-foto.info/uploads/posts/2018-04/1522920478_golaya-elena-ksenofontova_4_.jpg
			  domain_nowww === "sexs-foto.info" ||
			  // http://informaplus.ru/uploads/posts/2014-05/thumbs/zvezdy-na-krasnoy-dorozhke-v-metropoliten-muzee-nyu-yorka_14.jpeg
			  //   http://informaplus.ru/uploads/posts/2014-05/zvezdy-na-krasnoy-dorozhke-v-metropoliten-muzee-nyu-yorka_14.jpeg
			  domain_nowww === "informaplus.ru" ||
			  // http://modnaya.org/uploads/posts/2016-10/thumbs/1475685280_a4.jpg
			  //   http://modnaya.org/uploads/posts/2016-10/1475685280_a4.jpg
			  domain_nowww === "modnaya.org" ||
			  // https://negani.com/uploads/posts/2012-06/thumbs/1340164617_cosplay_girls_27.jpg
			  //   https://negani.com/uploads/posts/2012-06/1340164617_cosplay_girls_27.jpg
			  domain_nowww === "negani.com" ||
			  // http://chukcha.net/uploads/posts/2012-06/thumbs/1340116521_girls_cosplay_01077_019.jpg
			  //   http://chukcha.net/uploads/posts/2012-06/1340116521_girls_cosplay_01077_019.jpg
			  domain_nowww === "chukcha.net" ||
			  // http://opa.kg/uploads/posts/2013-04/thumbs/1365978252_1365942089_Nemnogo_kospleya_8.jpg
			  //   http://opa.kg/uploads/posts/2013-04/1365978252_1365942089_Nemnogo_kospleya_8.jpg
			  domain_nowww === "opa.kg" ||
			  // http://pirojok.net/uploads/posts/2018-03/thumbs/1522295041_metart_tienta_lilit-a_high_0003.jpg
			  //   http://pirojok.net/uploads/posts/2018-03/1522295041_metart_tienta_lilit-a_high_0003.jpg
			  domain_nowww === "pirojok.net" ||
			  // http://femanes.ru/uploads/posts/2018-08/thumbs/1534165217261aaf5fe61d5288d1a35db4b4467f431e5.jpeg
			  domain_nowww === "femanes.ru" ||
			  // https://vistanews.ru/uploads/posts/2016-11/medium/1479532946_40ba528a22585cfd5bd812f26662f0aeabd7a9df0e4243476apimgpsh_fullsize_distr.jpg
			  //   https://vistanews.ru/uploads/posts/2016-11/1479532946_40ba528a22585cfd5bd812f26662f0aeabd7a9df0e4243476apimgpsh_fullsize_distr.jpg
			  // https://vistanews.ru/uploads/base/290x290/2b488c806df9f3a869a07dfe5da7c599_local.jpg
			  //   https://vistanews.ru/uploads/posts/2018-09/1536835783_46.jpg
			  domain_nowww === "vistanews.ru" ||
			  // http://www.tour-rest.ru/uploads/posts/2016-07/thumbs/samyy-masshtabnyy-nevulkanicheskiy-opolzen-severnoy-ameriki_1.jpeg
			  //   http://www.tour-rest.ru/uploads/posts/2016-07/samyy-masshtabnyy-nevulkanicheskiy-opolzen-severnoy-ameriki_1.jpeg
			  domain_nowww === "tour-rest.ru" ||
			  // https://znamenitka.ru/uploads/posts/2017-06/thumbs/polmilliona-dollarov-za-foto-kto-obognal-sester-kardashyan-v-spiske-samyh-vysokooplachivaemyh-zvezd-instagram_1.jpg
			  //   https://znamenitka.ru/uploads/posts/2017-06/polmilliona-dollarov-za-foto-kto-obognal-sester-kardashyan-v-spiske-samyh-vysokooplachivaemyh-zvezd-instagram_1.jpg
			  domain_nowww === "znamenitka.ru" ||
			  // http://all-stars.su/uploads/posts/2016-04/thumbs/1461915953-all-stars.su-selena-gomez-foto-008.jpg
			  //   http://all-stars.su/uploads/posts/2016-04/1461915953-all-stars.su-selena-gomez-foto-008.jpg
			  domain_nowww === "all-stars.su" ||
			  // https://kinoukr.com/uploads/posts/2018-09/thumbs/153655417331519563530-262493817-3.jpg
			  //   https://kinoukr.com/uploads/posts/2018-09/153655417331519563530-262493817-3.jpg
			  domain_nowww === "kinoukr.com" ||
			  //https://ww22.zone-telechargement.lol/uploads/posts/2019-06/thumbs/ant-man-et-la-guepe5d04e7a58500f.jpg
			  //   https://ww22.zone-telechargement.lol/uploads/posts/2019-06/ant-man-et-la-guepe5d04e7a58500f.jpg
			  domain === "ww22.zone-telechargement.lol" ||
			  // http://hdxa.me/uploads/posts/2017-10/thumbs/1509453682-235651219-berdmen-2.jpg
			  domain_nowww === "hdxa.me" ||
			  // https://razdam.net/uploads/posts/2019-05/medium/155802782110c8691034d28.jpg
			  //   https://razdam.net/uploads/posts/2019-05/155802782110c8691034d28.jpg
			  domain_nowww === "razdam.net" ||
			  // https://bugaga.ru/uploads/posts/2015-08/thumbs/1439815321_kartinki-27.jpg
			  //   https://bugaga.ru/uploads/posts/2015-08/1439815321_kartinki-27.jpg
			  domain_nowww === "bugaga.ru") &&
			 string_indexof(src, "/uploads/") >= 0) ||
			// https://cdn.prognozist.ru/posts/2014-06/thumbs/1403274267_011.jpg
			//   https://cdn.prognozist.ru/posts/2014-06/1403274267_011.jpg
			domain === "cdn.prognozist.ru" ||
			// http://sex18.photos/uploads/posts/2017-11/thumbs/15108915885979.jpg
			src.match(/^[a-z]+:\/\/[^/]*\/uploads\/posts\/[0-9]{4}-[0-9]{2}\/(?:thumbs|medium)\/[0-9]+(?:_[^/]*)?\.[^/.]*$/) ||
			src.match(/^[a-z]+:\/\/[^/]*\/uploads\/[a-z]+\/(?:[0-9]+x[0-9]+\/)?[0-9]{4}-[0-9]{2}\/thumbs\/[0-9]+x[0-9]+_crop_[0-9]+_[^/]*$/)) {
			// http://www.doodoo.ru/uploads/posts/2015-08/thumbs/zverey-foto-40.jpg
			//   http://www.doodoo.ru/uploads/posts/2015-08/zverey-foto-40.jpg
			//return src.replace(/\/thumbs\//, "/");
			newsrc = src.replace(/\/uploads\/[a-z]+\/(?:[0-9]+x[0-9]+\/)?([0-9]+-[0-9]+\/)(?:(?:thumbs|medium)\/)?(?:[0-9]+x[0-9]+_crop_)?([^/]*)$/,
								 "/uploads/posts/$1$2");
			if (newsrc !== src)
				return newsrc;
			newsrc = src.replace(/(\/+posts\/+[0-9]{4}-[0-9]{2}\/+)thumbs\/+/, "$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nowww === "henchan.me") {
			// http://henchan.me/showfull_retina/uploads/posts/2019-03/thumbs/1552426401_9b8d00e116a122df180f08d7ac0169fe.jpg
			//   http://henchan.me/uploads/posts/2019-03/1552426401_9b8d00e116a122df180f08d7ac0169fe.jpg
			return src.replace(/(:\/\/[^/]*\/)[^/]*\/+(uploads\/+posts\/+)/, "$1$2");
		}

		// different from above
		if (domain_nowww === "goldwallpapers.com") {
			// https://goldwallpapers.com/uploads/posts/anime-wallpaper-bleach/thumb/anime_wallpaper_bleach_010.jpg
			//   https://goldwallpapers.com/uploads/posts/anime-wallpaper-bleach/anime_wallpaper_bleach_010.jpg
			return src.replace(/(\/uploads\/posts\/[^/]*\/)thumb\/([^/]*)$/, "$1$2");
		}

		if (domain_nowww === "tooob.com" &&
			string_indexof(src, "/api/") >= 0) {
			// https://tooob.com/api/objs/read/noteid/28530874/__image.scaled_1024
			//   https://tooob.com/api/objs/read/noteid/28530874/
			return src.replace(/(\/[0-9]+\/)__[^/]*$/, "$1");
		}

		if (domain_nosub === "ask.fm" && domain.match(/akphoto[0-9]*\.ask\.fm/) ||
			domain === "dok7xy59qfw9h.cloudfront.net") {
			// https://akphoto1.ask.fm/7d2/b3007/cd69/4a06/af54/e29092f7214e/large/324723.jpg -- upscaled
			//
			// https://dok7xy59qfw9h.cloudfront.net/17a/d4ab6/2a49/44a0/9e54/edfc5d963323/original/276314.jpg -- 433x600
			//   https://dok7xy59qfw9h.cloudfront.net/17a/d4ab6/2a49/44a0/9e54/edfc5d963323/large/276314.jpg -- 866x1200, not upscaled
			// https://dok7xy59qfw9h.cloudfront.net/989/279/890/-289996966-207m473-6ggqmjmc3hc6k00/original/Picture_Pub_Sabrina_Carpenter_146.jpg
			//   https://dok7xy59qfw9h.cloudfront.net/989/279/890/-289996966-207m473-6ggqmjmc3hc6k00/large/Picture_Pub_Sabrina_Carpenter_146.jpg
			// doesn't work:
			// https://akimg0.ask.fm/385/22354/974c/48f4/80af/c420c25977ef/normal/5115678.jpg
			//   transforming to akphoto0, akphoto1, doesn't work, large doesn't work either
			// https://akimg0.ask.fm/246/8095d/06cc/47ff/b7e6/75eee9dc975f/normal/913940.jpg
			// https://akimg0.ask.fm/assets2/151/350/838/784/normal/FB_IMG_1458341455293.jpg
			// https://d2hhj3gz5jljkm.cloudfront.net/wallpapers2/093/115/576/576/original/file.jpg
			return src.replace(/\/[a-z]+\/((?:[0-9]+|.+)\.[^/.]*)$/, "/large/$1");
		}

		if (domain_nosub === "ask.fm" && domain.match(/^akimg[0-9]*\.ask\.fm/) ||
			// https://d2hhj3gz5jljkm.cloudfront.net/assets2/135/886/818/560/thumb_big/12230823_529579840540203_777134914_n.jpg
			//   https://d2hhj3gz5jljkm.cloudfront.net/assets2/135/886/818/560/normal/12230823_529579840540203_777134914_n.jpg
			domain === "d2hhj3gz5jljkm.cloudfront.net" ||
			// https://d15eldcwi10xcl.cloudfront.net/assets2/135/886/818/560/thumb_big/12230823_529579840540203_777134914_n.jpg
			//   https://d15eldcwi10xcl.cloudfront.net/assets2/135/886/818/560/normal/12230823_529579840540203_777134914_n.jpg
			domain === "d15eldcwi10xcl.cloudfront.net") {
			return src.replace(/\/thumb(?:_big)?\/+([^/]+)(?:[?#].*)?$/, "/normal/$1");
		}

		if (domain === "d2p4y1juxwnww4.cloudfront.net") {
			// https://d2p4y1juxwnww4.cloudfront.net/9e2/2b1f6/b663/41d8/adf3/e6abf4f541a0/thumb/2445013.jpg
			//   https://d2p4y1juxwnww4.cloudfront.net/9e2/2b1f6/b663/41d8/adf3/e6abf4f541a0/original/2445013.jpg -- upscaled?
			return src.replace(/(\/(?:[0-9a-f]+\/+){6})thumb\/+/, "$1original/");
		}

		if (domain_nowww === "alchetron.com") {
			// https://alchetron.com/cdn/dove-cameron-b073b951-002f-4a02-b6ee-947523dfd11-resize-750.jpeg
			//   https://alchetron.com/cdn/dove-cameron-b073b951-002f-4a02-b6ee-947523dfd11.jpeg
			return src.replace(/-resize-[0-9]+(\.[^/.]*)$/, "$1");
		}

		if (domain === "img.ltn.com.tw") {
			// thanks to rEnr3n on github: https://github.com/qsniyg/maxurl/issues/6
			// http://img.ltn.com.tw/Upload/ent/page/800/2018/05/10/2422261_2.jpg -- 800x800
			//   http://img.ltn.com.tw/Upload/ent/page/orig/2018/05/10/2422261_2.jpg -- 2000x2000
			// http://img.ltn.com.tw/Upload/ent/page/400S/2018/05/22/phpsyErCP.jpg -- 400x533
			//   http://img.ltn.com.tw/Upload/ent/page/orig/2018/05/22/phpsyErCP.jpg -- 720x960
			// https://img.ltn.com.tw/Upload/style/bphoto/normal/2019/01/19/20190228-70499-2.jpeg -- 1333x1999
			//   https://img.ltn.com.tw/Upload/style/bphoto/original/2019/01/19/20190228-70499-2.jpeg -- 3712x5568
			// https://img.ltn.com.tw/Upload/business/page/800/2019/05/11/2786875_1.jpg
			//   https://img.ltn.com.tw/Upload/business/page/orig/2019/05/11/2786875_1.jpg -- 1772x1183
			// https://img.ltn.com.tw/Upload/sports/page/400S/2019/04/28/32.jpg
			//   https://img.ltn.com.tw/Upload/sports/page/orig/2019/04/28/32.jpg -- upscaled?
			// https://img.ltn.com.tw/Upload/news/600/2019/05/01/phpUfpDJK.jpg
			//   https://img.ltn.com.tw/Upload/news/orig/2019/05/01/phpUfpDJK.jpg
			// other:
			// http://img.ltn.com.tw/Upload/Module/2/497/1496422.jpg -- 650x400
			// http://img.ltn.com.tw/Upload/liveNews/BigPic/600_phpbfGlgC.jpg -- 600x402
			// http://img.ltn.com.tw/Upload/liveNews/BigPic/600_phpmMJrzu.jpg -- 2500x1268
			// http://img.ltn.com.tw/2013/new/oct/4/images/bigPic/600_43.jpg -- 1627x1627
			// http://img.ltn.com.tw/Upload/3c/page/2017/12/30/171230-32502-1.jpg -- 3801x2534
			return src
				//.replace(/\/Upload\/+ent\/+page\/[^/]+\//, "/Upload/ent/page/orig/")
				.replace(/(\/Upload\/+(?:[a-z]+\/+page|news)\/+)[0-9]+[A-Z]?\/+([0-9]{4}\/+[0-9]{2}\/+[0-9]{2}\/+)/, "$1orig/$2")
				.replace(/\/Upload\/+style\/+bphoto\/+[^/]+\/+/, "/Upload/style/bphoto/original/");
		}

		if (domain_nosub === "lystit.com" && domain.match(/cdn[a-z]?\.lystit\.com/)) {
			// https://cdnc.lystit.com/520/650/n/photos/missguided/549604c4/missguided-designer-mustard-Mustard-Yellow-Satin-Asymmetric-Twist-Front-Maxi-Dress.jpeg
			//   https://cdnc.lystit.com/photos/missguided/549604c4/missguided-designer-mustard-Mustard-Yellow-Satin-Asymmetric-Twist-Front-Maxi-Dress.jpeg
			// https://cdnb.lystit.com/200/250/tr/photos/nordstrom/3c5054da/mulberry-Clay-Small-Zip-Bayswater-Classic-Leather-Tote.jpeg
			//   https://cdnb.lystit.com/photos/nordstrom/3c5054da/mulberry-Clay-Small-Zip-Bayswater-Classic-Leather-Tote.jpeg
			return src.replace(/(:\/\/[^/]*\/)[0-9]+\/[0-9]+\/[0-9a-z]+\/photos\//, "$1photos/");
		}

		if (domain === "www.newshub.co.nz") {
			// http://www.newshub.co.nz/home/entertainment/2018/01/golden-globes-2018-red-carpet-highlights-a-red-carpet-flooded-in-black/_jcr_content/par/image_1284270800.dynimg.1200.q75.jpg/v1515372069805/GettyImages-902328010.jpg
			//   http://www.newshub.co.nz/home/entertainment/2018/01/golden-globes-2018-red-carpet-highlights-a-red-carpet-flooded-in-black/_jcr_content/par/image_1284270800.dynimg.full.q75.jpg/v1515372069805/GettyImages-902328010.jpg
			// https://www.newshub.co.nz/home/world/2017/12/how-one-plastic-bag-can-harm-millions-of-creatures/_jcr_content/par/image.dynimg.1280.q75.jpg/v1512865401357/GettyImages-612269120-plastic-bag-pollution-ocean-environment-1120.jpg
			//   https://www.newshub.co.nz/home/world/2017/12/how-one-plastic-bag-can-harm-millions-of-creatures/_jcr_content/par/image.dynimg.full.q75.jpg/v1512865401357/GettyImages-612269120-plastic-bag-pollution-ocean-environment-1120.jpg
			return {
				url: src.replace(/(\/image(?:[_.][0-9]+)?\.dynimg\.)[^/]*(\.q[0-9]+\.[^/.]*)(\/.*)?$/, "$1full$2$3"),
				can_head: false
			};
		}

		if (amazon_container === "s3.931wolfcountry.com" ||
			// http://assets.instyle.co.uk/instyle/live/styles/article_landscape_600_wide/s3/14/01/schiaparelli-catwalk.jpg
			domain === "assets.instyle.co.uk" ||
			// https://d2nzqyyfd6k6c7.cloudfront.net/styles/nova_hero/s3/article/thumbnail/screen_shot_2017-07-24_at_2.13.11_pm.png?itok=q34nDL0b
			domain === "d2nzqyyfd6k6c7.cloudfront.net" ||
			// https://s3-us-west-1.amazonaws.com/s3.kllcfm.radio.com/styles/delta__775x515/s3/Untitled%2520design%2520%25283%2529_2.png?itok=vj0l-3wC
			//   https://s3-us-west-1.amazonaws.com/s3.kllcfm.radio.com/Untitled%2520design%2520%25283%2529_2.png?itok=vj0l-3wC
			//amazon_container === "s3.kllcfm.radio.com" ||
			// https://s3.us-east-2.amazonaws.com/s3.wbbmfm.radio.com/styles/alpha__380x250/s3/sipa_24247792.jpg?itok=t2Il5DC8&c=db0c97ea1e7309d4f31f903fbea2a374
			//   https://s3.us-east-2.amazonaws.com/s3.wbbmfm.radio.com/sipa_24247792.jpg?itok=t2Il5DC8&c=db0c97ea1e7309d4f31f903fbea2a374
			//amazon_container === "s3.wbbmfm.radio.com" ||
			// https://s3.amazonaws.com/s3.radio.radio.com/styles/delta__775x515/s3/clean%2520bandit%2520demi.png?itok=nvpQgj12
			//   https://s3.amazonaws.com/s3.radio.radio.com/clean%2520bandit%2520demi.png?itok=nvpQgj12
			//amazon_container === "s3.radio.radio.com" ||
			(amazon_container && amazon_container.match(/^s3(?:\.[^/]*)?\.radio\.com$/)) ||
			// www.qtxasset.com doesn't exist, only -www
			// https://qtxasset.com/styles/breakpoint_xl_880px_w/s3fs/2017-01/AtlantisParadiseIsland.jpg?YX9Bi5IShxorNLjzZjM4CVSKS.tq0x6.&itok=JV3OK3EV
			//   https://qtxasset.com/2017-01/AtlantisParadiseIsland.jpg?YX9Bi5IShxorNLjzZjM4CVSKS.tq0x6.&itok=JV3OK3EV
			domain === "qtxasset.com" ||
			// https://wpr-public.s3.amazonaws.com/ttbook/styles/segment_teaser/s3/images/sander-smeekes-18409.jpg?itok=950FHBAv
			amazon_container === "wpr-public" ||
			// https://s3.amazonaws.com/prod-media.gameinformer.com/styles/body_default/s3/legacy-images/imagefeed/Game%20Of%20Thrones%27%20Emilia%20Clarke%20Cast%20In%20Upcoming%20Han%20Solo%20Film/emiliaclarke610starwars.jpg
			//   https://s3.amazonaws.com/prod-media.gameinformer.com/legacy-images/imagefeed/Game%20Of%20Thrones%27%20Emilia%20Clarke%20Cast%20In%20Upcoming%20Han%20Solo%20Film/emiliaclarke610starwars.jpg
			amazon_container === "prod-media.gameinformer.com" ||
			// https://community-content-assets.minecraft.net/upload/styles/small/s3/e7d9b12a6e7f7c7a7a2b4fd7b0fed4b6-NEW%20IMAGE.jpeg
			//   https://community-content-assets.minecraft.net/upload/e7d9b12a6e7f7c7a7a2b4fd7b0fed4b6-NEW%20IMAGE.jpeg
			domain === "community-content-assets.minecraft.net" ||
			// https://cdn-s3.si.com/styles/si_gallery_slide/s3/images/SWIM146_TK3_05712-rawWMFinal1920.jpg?itok=UfWh_d4n
			// https://cdn-s3.si.com/images/op3j-86931-rawfinal.jpg
			domain === "cdn-s3.si.com" ||
			// https://cdn2.hercampus.com/styles/full_width_embed/s3/GettyImages-675592784.jpg
			(domain_nosub === "hercampus.com" && domain.match(/^cdn[0-9]*\./)) ||
			// https://southbank-ipcmedia-com.s3-eu-west-1.amazonaws.com/instyle/live/styles/article_landscape_600_wide/s3/15/11/instyle-jan2016-selena-1_0.jpg?itok=WOiqGwKu
			//   https://southbank-ipcmedia-com.s3-eu-west-1.amazonaws.com/instyle/live/15/11/instyle-jan2016-selena-1_0.jpg?itok=WOiqGwKu
			amazon_container === "southbank-ipcmedia-com" ||
			// https://cdn.newsbusters.org/styles/blog_body-50/s3/images/2017-07-02-nbc-nn-decries-rise-of-conservative-media-2.png
			//   https://cdn.newsbusters.org/images/2017-07-02-nbc-nn-decries-rise-of-conservative-media-2.png
			domain === "cdn.newsbusters.org" ||
			// https://radioimg.s3.amazonaws.com/kiss985/styles/alpha__380x250/s3/Robin%2520Williams.jpg?itok=mlnntHER
			//   https://radioimg.s3.amazonaws.com/kiss985/Robin%2520Williams.jpg?itok=mlnntHER
			amazon_container === "radioimg" ||
			// https://b2bm.s3.amazonaws.com/styles/default_image/s3/karliekloss_0.jpg?itok=NpNCqZJv
			//   https://b2bm.s3.amazonaws.com/karliekloss_0.jpg?itok=NpNCqZJv
			amazon_container === "b2bm" ||
			// https://looppacificassets.s3.amazonaws.com/styles/carousel_large/s3/thumbnails/image/taylor_swift_plays_the_hits_then_runs_in_swansea.jpg?itok=VEhQSs-s
			//   https://looppacificassets.s3.amazonaws.com/thumbnails/image/taylor_swift_plays_the_hits_then_runs_in_swansea.jpg?itok=VEhQSs-s
			amazon_container === "looppacificassets" ||
			// https://botw-pd.s3.amazonaws.com/styles/logo-thumbnail/s3/012014/2011_nhl_heritage_classic_logo.png?itok=NxkQo6Q7
			//   https://botw-pd.s3.amazonaws.com/012014/2011_nhl_heritage_classic_logo.png?itok=NxkQo6Q7
			amazon_container === "botw-pd" ||
			// thanks to anonymous for reporting:
			// https://s3-eu-central-1.amazonaws.com/cartoons-s3/styles/product_detail_image/s3/AIRaceUSChinaEU_CM.jpg?itok=fu-7kUip
			//   https://s3-eu-central-1.amazonaws.com/cartoons-s3/AIRaceUSChinaEU_CM.jpg?itok=fu-7kUip
			amazon_container === "cartoons-s3" ||
			// thanks to anonymous for reporting:
			// https://static.cdn.turner.com/styles/scale_792/s3/2020-04/zoe-kazan.jpg?itok=FWFnblGk
			//   https://static.cdn.turner.com/2020-04/zoe-kazan.jpg?itok=FWFnblGk
			domain === "static.cdn.turner.com" ||
			// https://kpopimg.s3.amazonaws.com/styles/article_image/s3/eunice-dia.jpg?itok=5JoH8xh6
			//   https://kpopimg.s3.amazonaws.com/eunice-dia.jpg?itok=5JoH8xh6
			amazon_container === "kpopimg") {
			// http://s3.amazonaws.com/s3.931wolfcountry.com/styles/full_content_width__775px_max_/s3/USATSI_10787675.jpg?itok=o8qUHpri
			//   http://s3.amazonaws.com/s3.931wolfcountry.com/USATSI_10787675.jpg?itok=o8qUHpri
			newsrc = src.replace(/\/styles\/+[^/]+\/+s3(?:fs)?\//, "/");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nosub === "s-nbcnews.com" && domain.match(/media[0-9]*\.s-nbcnews\.com/)) {
			// https://media3.s-nbcnews.com/i/newscms/2017_24/1221281/headshot_nbc_b0b4262799627ca0e2e9fffd7b72458c.jpg -- 2832x4256
			// https://media4.s-nbcnews.com/i/newscms/2017_41/1289217/nialhoran-171016-today-tease_7e3030f1a03215e26135bb6d77ced11c.jpg -- 10721x6031
			// https://media3.s-nbcnews.com/j/newscms/2018_21/1340735/billboard-awards-jenna-dewan-today-180521_64d305c86902f706a7b4dc0667946774.760;1811;7;70;3.jpg -- 760x1811
			//   https://media3.s-nbcnews.com/i/newscms/2018_21/1340735/billboard-awards-jenna-dewan-today-180521_64d305c86902f706a7b4dc0667946774.jpg -- 1049x2500
			// https://media2.s-nbcnews.com/j/newscms/2018_21/1340737/billboard-awards-jlo-today-180521-main-art_aa1d851db712d9a513b768ee4646e442.focal-1000x500.jpg -- 1000x500
			//   https://media2.s-nbcnews.com/i/newscms/2018_21/1340737/billboard-awards-jlo-today-180521-main-art_aa1d851db712d9a513b768ee4646e442.jpg -- 2400x1200
			return src.replace(/(:\/\/[^/]*\/)j(\/.*\/[^/.]*)[^/]*(\.[^/.]*)$/, "$1i$2$3");
		}

		if (domain === "imgcp.aacdn.jp") {
			// https://imgcp.aacdn.jp/img-a/488/auto/global-aaj-front/article/2017/10/59d2800498c16_59d27ee42664e_1369399827.JPG
			//   https://imgcp.aacdn.jp/img-a/auto/auto/global-aaj-front/article/2017/10/59d2800498c16_59d27ee42664e_1369399827.JPG
			// https://imgcp.aacdn.jp/img-a/488/auto/global-aaj-front/article/2017/04/58dfa1fb6bf8b_58df9dd195c06_277476442.JPG
			//   https://imgcp.aacdn.jp/img-a/auto/auto/global-aaj-front/article/2017/04/58dfa1fb6bf8b_58df9dd195c06_277476442.JPG
			// https://imgcp.aacdn.jp/img-a/1720/auto/global-aaj-front/article/2017/02/589a9891100fd_589a94dd4439c_950604468.jpg
			//   https://imgcp.aacdn.jp/img-a/auto/auto/global-aaj-front/article/2017/02/589a9891100fd_589a94dd4439c_950604468.jpg
			return src.replace(/\/img-a\/[0-9a-z]+\/[0-9a-z]+\//, "/img-a/auto/auto/");
		}

		if (domain_nowww === "kpopselca.com") {
			// http://kpopselca.com/selca/thumb/49457_i-cant-breathe.jpg
			return src.replace(/\/selca\/thumb\//, "/selca/");
		}

		if (domain_nowww === "koogle.tv") {
			// http://www.koogle.tv/static/media/uploads/newest-news-2/.thumbnails/052418_blackpink_jennie_01-120x120.jpg
			//   http://www.koogle.tv/static/media/uploads/newest-news-2/052418_blackpink_jennie_01.jpg
			return src.replace(/\/\.thumbnails\/([^/]*)-[0-9]+x[0-9]+(\.[^/.]*)$/, "/$1$2");
		}

		if (domain_nowww === "fanaru.com" ||
			// http://stuffpoint.com/anime-and-manga/image/thumb/404463-anime-and-manga-snow-queen.jpg
			//   http://stuffpoint.com/anime-and-manga/image/404463-anime-and-manga-snow-queen.jpg
			domain_nowww === "stuffpoint.com") {
			// http://fanaru.com/waup/image/thumb/188305-waup-wassup.jpg -- 280x210
			//   http://fanaru.com/waup/image/188305-waup-wassup.jpg -- 3888x2592
			return src.replace(/\/image\/thumb\//, "/image/");
		}

		if (domain === "d9nvuahg4xykp.cloudfront.net" ||
			// https://d1w8cc2yygc27j.cloudfront.net/1150484398913714461/8578329675259839686_thumbnail.jpg
			//   https://d1w8cc2yygc27j.cloudfront.net/1150484398913714461/8578329675259839686.jpg
			domain === "d1w8cc2yygc27j.cloudfront.net") {
			// https://d9nvuahg4xykp.cloudfront.net/-9212700925596145478/-1193646998958160813_thumbnail.jpg
			//   https://d9nvuahg4xykp.cloudfront.net/-9212700925596145478/-1193646998958160813.jpg
			return src.replace(/_thumbnail(\.[^/.]*)$/, "$1");
		}

		if (domain === "i.lihkg.com" ||
			// https://f3img.gq/400/https://www.gannett-cdn.com/presto/2018/11/09/USAT/99171f89-9415-4b23-afef-f2c0b718be73-AFP_AFP_1AP1ON.JPG
			//   https://www.gannett-cdn.com/presto/2018/11/09/USAT/99171f89-9415-4b23-afef-f2c0b718be73-AFP_AFP_1AP1ON.JPG
			domain_nowww === "f3img.gq") {
			// https://i.lihkg.com/540/http://gifyu.com/images/cc018d69be4eb6e68887da85d6dd83b9.jpg
			//   https://gifyu.com/images/cc018d69be4eb6e68887da85d6dd83b9.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/[0-9]+\/http/, "http");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nowww === "24minus.ru") {
			// thanks to naonymous for reporting:
			// https://24minus.ru/800/600/http/i.pinimg.com/originals/b7/08/12/b708123e1b6d6b90745de48fdae200f1.jpg
			//   https://i.pinimg.com/originals/b7/08/12/b708123e1b6d6b90745de48fdae200f1.jpg
			return src.replace(/^[a-z]+:\/\/[^/]+\/+[0-9]+\/+[0-9]+\/+(https?)\/+(.*)/, "$1://$2");
		}

		if (domain_nowww === "f3img.gq") {
			// https://f3img.gq/400?u=https%3A%2F%2Fcdn.arstechnica.net%2Fwp-content%2Fuploads%2F2019%2F06%2FScreen-Shot-2019-06-09-at-1.23.17-PM-760x380.png
			//   https://cdn.arstechnica.net/wp-content/uploads/2019/06/Screen-Shot-2019-06-09-at-1.23.17-PM.png
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/[0-9]*.*?[?&]u=(http[^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "www.nintendoworldreport.com" &&
			string_indexof(src, "/media/") >= 0) {
			// http://www.nintendoworldreport.com/media/37218/1/gallery/12.jpg
			//   http://www.nintendoworldreport.com/media/37218/1/12.jpg
			return src.replace(/\/gallery\/([0-9]+\.[^/.]*)$/, "/$1");
		}

		if (domain_nowww === "nintendoeverything.com" &&
			string_indexof(src, "/gallery/") >= 0) {
			// https://www.nintendoeverything.com/wp-content/gallery/fatal-frame-maiden-of-black-water-8515/thumbs/thumbs_fatal-frame-18.jpg
			//   https://nintendoeverything.com/wp-content/gallery/fatal-frame-maiden-of-black-water-8515/fatal-frame-18.jpg
			return src.replace(/\/thumbs\/thumbs_([^/]*)$/, "/$1");
		}

		if (domain === "images.nintendolife.com") {
			// http://images.nintendolife.com/news/2015/09/first_impressions_taking_a_shot_at_fatal_frame_maiden_of_black_water/attachment/0/900x.jpg
			//   http://images.nintendolife.com/news/2015/09/first_impressions_taking_a_shot_at_fatal_frame_maiden_of_black_water/attachment/0/original.jpg
			// https://images.nintendolife.com/d45064cf4e3cf/animal-crossing.900x.jpg
			//   https://images.nintendolife.com/d45064cf4e3cf/animal-crosing.original.jpg
			// thanks to anonymous for reporting:
			// https://images.nintendolife.com/802713810685c/mario-kart-8-deluxe-cover.cover_large.jpg
			//   https://images.nintendolife.com/802713810685c/mario-kart-8-deluxe-cover.cover.jpg
			//   https://images.nintendolife.com/802713810685c/mario-kart-8-deluxe-cover.original.jpg
			// https://images.nintendolife.com/890fc87e35056/xenoblade-chronicles-3-cover.cover_300x.jpg
			//   https://images.nintendolife.com/890fc87e35056/xenoblade-chronicles-3-cover.original.jpg
			return src
				.replace(/(\/attachment\/[^/]*\/)[^/]+(\.[^/.]*)$/, "$1original$2")
				.replace(/(:\/\/[^/]+\/+[0-9a-f]{5,}\/+(?:[^/]+\.)?)(?:cover_)?(?:[0-9]*x[0-9]*|large|cover)(\.[^/.]+)(?:[?#].*)?$/, "$1original$2");
		}

		if (domain === "cdn.igromania.ru") {
			// https://cdn.igromania.ru/mnt/articles/4/b/7/9/4/d/30165/preview/e4c138a20130c713_336x189.jpg
			//   https://cdn.igromania.ru/mnt/articles/4/b/7/9/4/d/30165/preview/e4c138a20130c713_original.jpg
			// https://cdn.igromania.ru/mnt/articles/b/0/8/f/d/3/27221/70b17403b362d9c9_1200xH.jpg
			//   https://cdn.igromania.ru/mnt/articles/b/0/8/f/d/3/27221/70b17403b362d9c9.jpg
			// doesn't work for all:
			// https://cdn.igromania.ru/mnt/articles/b/0/8/f/d/3/27221/html/img/ca7afa51a9675c1d.jpg
			//   https://cdn.igromania.ru/mnt/articles/b/0/8/f/d/3/27221/html/img/ca7afa51a9675c1d_original.jpg -- 404
			// https://www.igromania.ru/mnt/news/9/4/4/8/4/1/74580/html/more/d97ea5df6c0eddf6_original.jpg -- but this works
			return src.replace(/(\/[0-9a-f]+)(?:_[^-_/.]*)?(\.[^/.]*)$/, "$1_original$2");
		}

		if (domain === "i.blogs.es") {
			// https://i.blogs.es/824e4f/bayonetta/150_150.jpg
			//   https://i.blogs.es/824e4f/bayonetta/original.jpg
			return src.replace(/\/[0-9]+_[0-9]+(\.[^/.]*)$/, "/original$1");
		}

		/*if (false && (domain === "popdustroar-img.rbl.ms" ||
			// https://papermag-img.rbl.ms/simage/https%3A%2F%2Fassets.rbl.ms%2F3967597%2F1200x600.jpg/2000%2C2000/3Bthb8U2RPWmDNU8/img.jpg
			//   https://assets.rbl.ms/3967597/1200x600.jpg
			//   https://assets.rbl.ms/3967597/980x.jpg
			// https://assets.rbl.ms/17099886/210x.jpg
			// https://assets.rbl.ms/1361449/origin.jpg
			(string_indexof(domain, ".rbl.ms") >= 0 && string_indexof(src, "/simage/") >= 0))) {
			// https://popdustroar-img.rbl.ms/simage/https%3A%2F%2Fassets.rbl.ms%2F6588627%2F980x.jpg/2000%2C2000/FSxn6Qs9PAa0aHKs/img.jpg
			//   https://assets.rbl.ms/6588627/980x.jpg
			return decodeURIComponent(src.replace(/.*?\/simage\/([^/]*)\/.*\/, "$1")); // fix
		}*/

		if (domain_nosub === "rbl.ms") {
			// https://resize.rbl.ms/image?source=https%3A%2F%2Fassets.rbl.ms%2F3689460%2F1216x700.jpg&size=2000%2C2000&c=qkxiCnuqMLv4GT53
			//   https://assets.rbl.ms/3689460/origin.jpg

			newsrc = src.replace(/.*\/image.*?[?&]source=([^&]*).*/, "$1");
			if (newsrc !== src) {
				return decodeURIComponent(newsrc);
			}

			// http://resize.rbl.ms/simage/https%3A%2F%2Fassets.rbl.ms%2F10514873%2F980x.gif/500%2C230/pC%2BRJHWs2YBGt8at/img.gif
			//   https://assets.rbl.ms/10514873/980x.gif
			// https://papermag-img.rbl.ms/simage/https%3A%2F%2Fassets.rbl.ms%2F3967597%2F1200x600.jpg/2000%2C2000/3Bthb8U2RPWmDNU8/img.jpg -- stretched
			//   https://assets.rbl.ms/3967597/1200x600.jpg
			//   https://assets.rbl.ms/3967597/980x.jpg
			// https://popdustroar-img.rbl.ms/simage/https%3A%2F%2Fassets.rbl.ms%2F6588627%2F980x.jpg/2000%2C2000/FSxn6Qs9PAa0aHKs/img.jpg
			//   https://assets.rbl.ms/6588627/980x.jpg
			newsrc = src.replace(/.*?\/simage\/([^/]*)\/.*/, "$1");
			if (newsrc !== src) {
				return decodeURIComponent(newsrc);
			}
		}

		if (domain === "resize-rbl-ms.cdn.ampproject.org" ||
			// https://www-windowscentral-com.cdn.ampproject.org/ii/w1200/s/www.windowscentral.com/sites/wpcentral.com/files/field/image/2013/10/Halo_3_Xbox_360_multiplayer_0.jpg
			//   https://www.windowscentral.com/sites/wpcentral.com/files/field/image/2013/10/Halo_3_Xbox_360_multiplayer_0.jpg
			// https://www-windowscentral-com.cdn.ampproject.org/i/s/www.windowscentral.com/sites/wpcentral.com/files/field/image/2013/10/Halo_3_Xbox_360_multiplayer_0.jpg
			//   https://www.windowscentral.com/sites/wpcentral.com/files/field/image/2013/10/Halo_3_Xbox_360_multiplayer_0.jpg
			//domain === "www-windowscentral-com.cdn.ampproject.org" ||
			(domain_nosub === "ampproject.org" && domain.match(/\.cdn\.ampproject/))) {
			// https://resize-rbl-ms.cdn.ampproject.org/ii/w1000/s/resize.rbl.ms/simage/https%3A%2F%2Fassets.rbl.ms%2F10514873%2F980x.gif/500%2C230/pC%2BRJHWs2YBGt8at/img.gif
			//   http://resize.rbl.ms/simage/https%3A%2F%2Fassets.rbl.ms%2F10514873%2F980x.gif/500%2C230/pC%2BRJHWs2YBGt8at/img.gif
			return src.replace(/^[a-z]+:\/\/[^/]*\/(?:ii\/[wh][0-9]+|i)\/s\/([^/]+\.[^/]+\/[^?#]+)(?:[?#].*)?$/, "http://$1");
		}

		if (domain === "assets.rbl.ms") {
			// https://odysseyonline-img.rbl.ms/simage/https%3A%2F%2Fassets.rbl.ms%2F10613549%2F980x.jpg/2000%2C2000/CUjBUrbDC4rUON8Q/img.jpg
			//   https://assets.rbl.ms/10613549/origin.jpg
			// https://assets.rbl.ms/17487152/origin.jpg - 3600x2400
			return src.replace(/(:\/\/[^/]*\/[0-9]+\/)[^/.]*(\.[^/.]*)$/, "$1origin$2");
		}

		if (domain === "i.paigeeworld.com" ||
			// https://d395qfwg4461au.cloudfront.net/user-uploads/536ed00576d182086236c63e_536fc7e176d182086237b1e8_320.jpg
			//   https://d395qfwg4461au.cloudfront.net/user-uploads/536ed00576d182086236c63e_536fc7e176d182086237b1e8_rz.jpg
			domain === "d395qfwg4461au.cloudfront.net") {
			// https://i.paigeeworld.com/user-media/1452729600000/5350f6d7ad9e9cec0bb7e1be_56978883e1cf0a1d06737577_320.jpg -- 320x226
			//   https://i.paigeeworld.com/user-media/1452729600000/5350f6d7ad9e9cec0bb7e1be_56978883e1cf0a1d06737577_rz.jpg -- 5787x4093
			return src.replace(/(\/user-(?:uploads|media\/[0-9]+)\/[0-9a-f]+_[0-9a-f]+_)[^/.]*(\.[^/.]*)$/, "$1rz$2");
		}

		if (domain === "1d31c772ec21a65b0a71-0707aae3004193da193e1ad4a942592d.ssl.cf2.rackcdn.com") {
			// https://1d31c772ec21a65b0a71-0707aae3004193da193e1ad4a942592d.ssl.cf2.rackcdn.com/24688/fatal_frame_treehouse__default-news-image.png
			//   https://1d31c772ec21a65b0a71-0707aae3004193da193e1ad4a942592d.ssl.cf2.rackcdn.com/24688/fatal_frame_treehouse.png
			// https://1d31c772ec21a65b0a71-0707aae3004193da193e1ad4a942592d.ssl.cf2.rackcdn.com/24680/fatalframelooksbrettygoodguizee32015__medium.png
			//   https://1d31c772ec21a65b0a71-0707aae3004193da193e1ad4a942592d.ssl.cf2.rackcdn.com/24680/fatalframelooksbrettygoodguizee32015.png
			return src.replace(/(:\/\/[^/]*\/[0-9]+\/[^/.]*)__[^_/.]*(\.[^/.]*)$/, "$1$2");
		}

		if (domain === "i.nextmedia.com.au") {
			// https://i.nextmedia.com.au/Utils/ImageResizer.ashx?n=https%3A%2F%2Fi.nextmedia.com.au%2FFeatures%2Fvampyr3.jpg&w=820&c=0&s=1
			//   https://i.nextmedia.com.au/Features/vampyr3.jpg
			return decodeURIComponent(src.replace(/.*\/Utils\/ImageResizer\.ashx.*?[?&]n=([^&]*).*?$/, "$1"));
		}

		// liquifire os: https://www.liquidpixels.com/liquifire-os
		if ((domain_nosub === "heritagestatic.com" && /^dyn[0-9]*\.heritagestatic\.com/.test(domain)) ||
			// https://prodimage.images-bn.com/lf?set=key%5Bresolve.pixelRatio%5D,value%5B1%5D&set=key%5Bresolve.width%5D,value%5B300%5D&set=key%5Bresolve.height%5D,value%5B10000%5D&set=key%5Bresolve.imageFit%5D,value%5Bcontainerwidth%5D&set=key%5Bresolve.allowImageUpscaling%5D,value%5B0%5D&product=path%5B/pimages/9780525534105_p0_v2%5D&call=url%5Bfile:common/decodeProduct.chain%5D&scale=options%5Blimit%5D,size%5B300x10000%5D&sink
			//   https://prodimage.images-bn.com/lf?set=key%5Bresolve.pixelRatio%5D%2Cvalue%5B1%5D&set=key%5Bresolve.width%5D%2Cvalue%5B99999%5D&set=key%5Bresolve.height%5D%2Cvalue%5B99999%5D&set=key%5Bresolve.imageFit%5D%2Cvalue%5Bcontainerwidth%5D&set=key%5Bresolve.allowImageUpscaling%5D%2Cvalue%5B0%5D&product=path%5B/pimages/9780525534105_p0_v2%5D&call=url%5Bfile:common/decodeProduct.chain%5D&scale=options%5Blimit%5D,size%5B300x10000%5D&sink
			//   https://prodimage.images-bn.com/lf?set=key%5Bresolve.pixelRatio%5D%2Cvalue%5B1%5D&set=key%5Bresolve.width%5D%2Cvalue%5B99999%5D&set=key%5Bresolve.height%5D%2Cvalue%5B99999%5D&set=key%5Bresolve.imageFit%5D%2Cvalue%5Bcontainerwidth%5D&set=key%5Bresolve.allowImageUpscaling%5D%2Cvalue%5B0%5D&product=path%5B/pimages/9780525534105_p0_v2%5D&call=url%5Bfile:common/decodeProduct.chain%5D&sink
			// other:
			// http://prodimage.images-bn.com/pimages/9780316593137_p0_v4_s1200x630.jpg
			domain === "prodimage.images-bn.com" ||
			// thanks to MinuteAd8502 on github for reporting: https://github.com/qsniyg/maxurl/issues/870
			// wip, uncommenting currently does nothing
			// http://lp.hm.com/hmprod?set=key[source],value[/environment/2013/Q10_0652_195R_0.jpg]&set=key[rotate],value[-0.1]&set=key[width],value[4559]&set=key[height],value[5331]&set=key[x],value[560]&set=key[y],value[182]&set=key[type],value[FASHION_FRONT]&call=url[file:/product/large]
			//   http://lp.hm.com/hmprod?set=key%5Bsource%5D%2Cvalue%5B%252Fenvironment%252F2013%252FQ10_0652_195R_0.jpg%5D&set=key%5Brotate%5D%2Cvalue%5B-0.1%5D&set=key%5Bwidth%5D%2Cvalue%5B4559%5D&set=key%5Bheight%5D%2Cvalue%5B5331%5D&set=key%5Bx%5D%2Cvalue%5B560%5D&set=key%5By%5D%2Cvalue%5B182%5D&set=key%5Btype%5D%2Cvalue%5BFASHION_FRONT%5D&call=url[file:/product/large]
			//   http://lp.hm.com/hmprod?set=key%5Bsource%5D%2Cvalue%5B%2Fenvironment%2F2013%2FQ10_0652_195R_0.jpg%5D&set=key%5Brotate%5D%2Cvalue%5B-0.1%5D&set=key%5Bwidth%5D%2Cvalue%5B4559%5D&set=key%5Bheight%5D%2Cvalue%5B5331%5D&set=key%5Bx%5D%2Cvalue%5B560%5D&set=key%5By%5D%2Cvalue%5B182%5D&set=key%5Btype%5D%2Cvalue%5BFASHION_FRONT%5D&call=url%5Bfile%3A%2Fproduct%2Flarge%5D
			//   https://lp.hm.com/hmprod?set=key%5Bsource%5D%2Cvalue%5B%2Fenvironment%2F2013%2FQ10_0652_195R_0.jpg%5D&set=key%5Brotate%5D%2Cvalue%5B-0.1%5D&set=key%5Bwidth%5D%2Cvalue%5B4559%5D&set=key%5Bheight%5D%2Cvalue%5B5331%5D&set=key%5Bx%5D%2Cvalue%5B560%5D&set=key%5By%5D%2Cvalue%5B182%5D&set=key%5Btype%5D%2Cvalue%5BFASHION_FRONT%5D&call=url%5Bfile%3A%2Fproduct%2Fmain%5D -- doesn't work
			//   https://lp.hm.com/hmprod?set=key%5Bsource%5D%2Cvalue%5B%2Fenvironment%2F2013%2FQ10_0652_195R_0.jpg%5D&set=key%5Brotate%5D%2Cvalue%5B-0.1%5D&set=key%5Bwidth%5D%2Cvalue%5B4559%5D&set=key%5Bheight%5D%2Cvalue%5B5331%5D&set=key%5Bx%5D%2Cvalue%5B560%5D&set=key%5By%5D%2Cvalue%5B182%5D&set=key%5Btype%5D%2Cvalue%5BFASHION_FRONT%5D&call=url%5Bfile%3A%2Fproduct%2Ffullscreen%5D -- doesn't work
			//   http://lp.hm.com/hmprod?set=key%5Bsource%5D%2Cvalue%5B%2Fenvironment%2F2013%2FQ10_0652_195R_0.jpg%5D&set=key%5Bwidth%5D%2Cvalue%5B4559%5D&set=key%5Bheight%5D%2Cvalue%5B5331%5D&set=key%5Bx%5D%2Cvalue%5B560%5D&set=key%5By%5D%2Cvalue%5B182%5D&set=key%5Btype%5D%2Cvalue%5BFASHION_FRONT%5D&call=url%5Bfile%3A%2Fproduct%2Ffull%5D
			// http://lp.hm.com/hmprod?set=source[/environment/2015/4ET_0080_014R.jpg],rotate[-0.15],width[4277],height[5001],x[366],y[97],type[FASHION_FRONT]&hmver=0&call=url[file:/product/full]
			//   http://lp.hm.com/hmprod?set=source%5B%2Fenvironment%2F2015%2F4ET_0080_014R.jpg%5D%2Crotate%5B-0.15%5D%2Cwidth%5B4277%5D%2Cheight%5B5001%5D%2Cx%5B366%5D%2Cy%5B97%5D%2Ctype%5BFASHION_FRONT%5D&hmver=0&call=url[file:/product/full]
			// https://lp2.hm.com/hmgoepprod?set=width[320],quality[80],options[limit]&source=url[https://www2.hm.com/content/dam/hm-magazine-2021/inside-hm/january_2022/2015-Studio-1-Top-Image-resized.jpg]&scale=width[global.width],height[15000],options[global.options]&sink=format[jpg],quality[global.quality]
			//   https://www2.hm.com/content/dam/hm-magazine-2021/inside-hm/january_2022/2015-Studio-1-Top-Image-resized.jpg
			// https://lp2.hm.com/hmgoepprod?source=url[https://www2.hm.com/content/dam/ladies_s04/magazine-2021-s04/3024-edition-by-magazine-v2.jpg]&scale=size[1024]&sink=format[jpeg],quality[80]
			//   https://www2.hm.com/content/dam/ladies_s04/magazine-2021-s04/3024-edition-by-magazine-v2.jpg
			// thanks to anonymous:
			// https://lp2.hm.com/hmgoepprod?set=quality[79],source[/e6/f7/e6f70fb89f0f592e1f98fd830e72deae54906836.jpg],origin[dam],category[],type[DESCRIPTIVEDETAIL],res[m],hmver[2]&call=url[file:/product/main
			//   https://lp2.hm.com/hmgoepprod?set=quality%5B79%5D%2Csource%5B%2Fe6%2Ff7%2Fe6f70fb89f0f592e1f98fd830e72deae54906836.jpg%5D%2Corigin%5Bdam%5D%2Ccategory%5B%5D%2Ctype%5BDESCRIPTIVEDETAIL%5D%2Cres%5Bm%5D%2Chmver%5B2%5D&call=url[file:/product/fullscreen
			//   https://lp2.hm.com/hmgoepprod?set=quality%5B100%5D%2Csource%5B%2Fe6%2Ff7%2Fe6f70fb89f0f592e1f98fd830e72deae54906836.jpg%5D%2Corigin%5Bdam%5D%2Ccategory%5B%5D%2Ctype%5BDESCRIPTIVEDETAIL%5D%2Cres%5Bx%5D%2Chmver%5B2%5D&call=url%5Bfile%3A%2Fproduct%2Ffullscreen%5D
			(domain_nosub === "hm.com" && /^lp[0-9]*\./.test(domain)) ||
			// thanks to anonymous for reporting:
			// https://lp.arket.com/app006prod?set=key[resolve.pixelRatio],value[2]&set=key[resolve.width],value[925]&set=key[resolve.height],value[10000]&set=key[resolve.imageFit],value[containerwidth]&set=key[resolve.allowImageUpscaling],value[0]&set=key[resolve.format],value[jpeg]&set=key[resolve.quality],value[70]&set=source[/37/be/37be7678e5b24e70a81d59b51109107c604e1306.jpg],origin[dam],type[LOOKBOOK],ImageVersion[2]&call=url[file:/product/dynamic.chain]
			//   https://lp.arket.com/app006prod?set=source%5B%2F37%2Fbe%2F37be7678e5b24e70a81d59b51109107c604e1306.jpg%5D%2Corigin%5Bdam%5D%2Ctype%5BLOOKBOOK%5D%2CImageVersion%5B2%5D&set=key%5Bresolve.pixelRatio%5D%2Cvalue%5B1%5D&set=key%5Bresolve.width%5D%2Cvalue%5B99999%5D&set=key%5Bresolve.height%5D%2Cvalue%5B99999%5D&set=key%5Bresolve.imageFit%5D%2Cvalue%5Bcontainerwidth%5D&set=key%5Bresolve.allowImageUpscaling%5D%2Cvalue%5B0%5D&set=key%5Bresolve.format%5D%2Cvalue%5Bjpeg%5D&set=key%5Bresolve.quality%5D%2Cvalue%5B100%5D&call=url%5Bfile%3A%2Fproduct%2Fdynamic.chain%5D
			domain === "lp.arket.com" ||
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/445
			// https://images.biglots.com/images?set=key%5Bresolve.pixelRatio%5D,value%5B1%5D&set=key%5Bresolve.width%5D,value%5B400%5D&set=key%5Bresolve.height%5D,value%5B10000%5D&set=key%5Bresolve.imageFit%5D,value%5Bcontainerwidth%5D&set=key%5Bresolve.allowImageUpscaling%5D,value%5B0%5D&set=env%5Bprod%5D,imageURL%5B%252Fimages%252Fmarketing%252F2020%252F08082020%252Fnewhp%252F080720-Homepage-FinancingCards-BLCC.jpg%5D&call=url%5Bfile:resolve/resolve.chain%5D
			//   https://images.biglots.com/images?set=key%5Bresolve.pixelRatio%5D%2Cvalue%5B1%5D&set=key%5Bresolve.width%5D%2Cvalue%5B99999%5D&set=key%5Bresolve.height%5D%2Cvalue%5B99999%5D&set=key%5Bresolve.imageFit%5D%2Cvalue%5Bcontainerwidth%5D&set=key%5Bresolve.allowImageUpscaling%5D%2Cvalue%5B0%5D&set=env%5Bprod%5D%2CimageURL%5B%252Fimages%252Fmarketing%252F2020%252F08082020%252Fnewhp%252F080720-Homepage-FinancingCards-BLCC.jpg%5D&call=url%5Bfile:resolve/resolve.chain%5D
			//   https://www.biglots.com/images/marketing/2020/08082020/newhp/080720-Homepage-FinancingCards-BLCC.jpg
			// https://images.biglots.com/images?set=key%5Bresolve.pixelRatio%5D,value%5B1%5D&set=key%5Bresolve.width%5D,value%5B200%5D&set=key%5Bresolve.height%5D,value%5B10000%5D&set=key%5Bresolve.imageFit%5D,value%5Bcontainerwidth%5D&set=key%5Bresolve.allowImageUpscaling%5D,value%5B0%5D&set=env%5Bprod%5D,imageURL%5B%252Fimages%252Fmarketing%252F2020%252F09132020%252Fhomepage%252F091320-site-hp-indoor-fall_360x302.jpg%5D&call=url%5Bfile:resolve/resolve.chain%5D
			//   https://images.biglots.com/images?set=key%5Bresolve.pixelRatio%5D,value%5B1%5D&set=key%5Bresolve.width%5D,value%5B200%5D&set=key%5Bresolve.height%5D,value%5B10000%5D&set=key%5Bresolve.imageFit%5D,value%5Bcontainerwidth%5D&set=key%5Bresolve.allowImageUpscaling%5D,value%5B0%5D&set=env%5Bprod%5D,imageURL%5B%252Fimages%252Fmarketing%252F2020%252F09132020%252Fhomepage%252F091320-site-hp-indoor-fall_360x302.jpg%5D&call=url%5Bfile:resolve/resolve.chain%5D
			//   https://www.biglots.com/images/marketing/2020/09132020/homepage/091320-site-hp-indoor-fall_360x302.jpg
			// https://images.biglots.com/images?set=key%5Bresolve.pixelRatio%5D,value%5B1%5D&set=key%5Bresolve.width%5D,value%5B400%5D&set=key%5Bresolve.height%5D,value%5B10000%5D&set=key%5Bresolve.imageFit%5D,value%5Bcontainerwidth%5D&set=key%5Bresolve.allowImageUpscaling%5D,value%5B0%5D&set=env%5Bprod%5D,imageURL%5B%252Fimages%252Fproduct%252F110%252F810427233.jpg%5D,ver%5B1%5D&call=url%5Bfile:resolve/resolve.chain%5D
			//   https://images.biglots.com/images?set=key%5Bresolve.pixelRatio%5D%2Cvalue%5B1%5D&set=key%5Bresolve.width%5D%2Cvalue%5B99999%5D&set=key%5Bresolve.height%5D%2Cvalue%5B99999%5D&set=key%5Bresolve.imageFit%5D%2Cvalue%5Bcontainerwidth%5D&set=key%5Bresolve.allowImageUpscaling%5D%2Cvalue%5B0%5D&set=env%5Bprod%5D%2CimageURL%5B%252Fimages%252Fproduct%252F110%252F810427233.jpg%5D%2Cver%5B1%5D&call=url%5Bfile:resolve/resolve.chain%5D
			//   https://www.biglots.com/images/product/110/810427233.jpg
			domain === "images.biglots.com") {
			// https://dyn1.heritagestatic.com/lf?set=path%5B1%2F5%2F3%2F6%2F2%2F15362544%5D%2Csizedata%5B850x600%5D&call=url%5Bfile%3Aproduct.chain%5D
			//   ?set=path[1/5/3/6/2/15362544],sizedata[850x600]&call=url[file:product.chain]
			//
			//   https://dyn1.heritagestatic.com/lf?set=path%5B1%2F5%2F3%2F6%2F2%2F15362544%5D&call=url%5Bfile%3Aproduct.chain%5D
			// https://dyn1.heritagestatic.com/lf?set=path%5B1%2F5%2F3%2F6%2F2%2F15362543%5D&call=url%5Bfile%3Aproduct.chain%5D
			//   ?set=path[1/5/3/6/2/15362543]&call=url[file:product.chain]
			if (/[?&](?:set|source)=/.test(src)) {
				var querystring = src.replace(/.*?\?/, "");
				var splitted = querystring.split("&");

				var newkvs = {};
				var rawkvs = [];

				var parse_command = function(value) {
					var match = value.match(/^([a-z_A-Z]+)\[([^\]]*)\]?$/);
						// [] can be empty
						// call=url[file:/product/fullscreen
						// media_type[...]
					if (!match) {
						return null;
					}

					return {
						cmd: match[1],
						arg: decodeURIComponent(match[2])
					}
				};

				array_foreach(splitted, function(query) {
					var key = query.replace(/=.*$/, "");
					var value = decodeURIComponent(query.replace(/^.*?=/, ""));

					if (key === "set") {
						var setcmds = value.split(",");

						var local_kvs = {};
						array_foreach(setcmds, function(setcmd) {
							var parsed_command = parse_command(setcmd);
							if (!parsed_command) {
								console_error("Unable to parse command:", setcmd, setcmds);
								return false;
							}

							local_kvs[parsed_command.cmd] = parsed_command.arg;
						});

						if (local_kvs["key"]) {
							newkvs[local_kvs["key"]] = {
								value: local_kvs["value"],
								type: "kv"
							};

							delete local_kvs["key"];
							delete local_kvs["value"];
						}

						for (var lkey in local_kvs) {
							newkvs[lkey] = {
								value: local_kvs[lkey],
								type: "string"
							};
						}
					} else {
						var parsed_command = parse_command(value);
						if (!parsed_command) {
							console_warn("Unable to parse command:", parsed_command, value);
							rawkvs.push(query);
							return;
						}

						newkvs[key] = {
							value: parsed_command.arg,
							type: parsed_command.cmd
						};
					}
				});

				console_log(newkvs);

				delete newkvs.scale;
				delete newkvs.sizedata;
				delete newkvs.rotate;

				var imageurls = [];
				if (newkvs.source && newkvs.source.type === "url") {
					imageurls.push(newkvs.source.value);
				}

				if (newkvs.imageURL) {
					if (domain === "images.biglots.com") {
						newkvs.imageURL.value = urljoin("https://www.biglots.com/", newkvs.imageURL.value, true);
						newkvs.imageURL.type = "url";
					}

					imageurls.push(newkvs.imageURL.value);
				}

				var modified_size = false;

				if ("resolve.width" in newkvs)
					newkvs["resolve.width"].value = 99999;

				if ("resolve.height" in newkvs)
					newkvs["resolve.height"].value = 99999;

				if (modified_size)
					newkvs["resolve.allowImageUpscaling"].value = 0;

				if ("resolve.pixelRatio" in newkvs)
					newkvs["resolve.pixelRatio"].value = 1;

				if ("resolve.quality" in newkvs)
					newkvs["resolve.quality"].value = 100;

				if ("quality" in newkvs) {
					// quality[L]
					if (/^[0-9]{1,2}$/.test(newkvs["quality"].value))
						newkvs["quality"].value = 100;
				}

				if ("res" in newkvs && domain_nosub === "hm.com") {
					let resvalue = newkvs["res"].value;
					// fixme: unknown res = 1516x2274
					if (resvalue === "s" || // 564x846
						resvalue === "m" || // 1536x2304
						resvalue === "l") // 2160x3240
						newkvs["res"].value = "x"; // 2280x4320
				}

				if ("call" in newkvs && domain_nosub === "hm.com") {
					newkvs["call"].value = newkvs["call"].value
						.replace(/product\/main$/, "product/fullscreen")
						.replace(/product\/(?:thumb|small|medium|large)$/, "product/full");
				}

				var newqueries = [];
				var sets = [];
				for (let key in newkvs) {
					let objvalue = newkvs[key];
					if (objvalue.type === "kv") {
						newqueries.push("set=" + encodeURIComponent("key[" + key + "],value[" + objvalue.value + "]"));
					} else if (objvalue.type === "string") {
						sets.push([key, objvalue.value]);
					} else {
						newqueries.push(key + "=" + encodeURIComponent(objvalue.type + "[" + objvalue.value + "]"));
					}
				}

				if (sets.length > 0) {
					let setkvs = [];
					array_foreach(sets, function(kv) {
						setkvs.push(kv[0] + "[" + kv[1] + "]");
					});

					newqueries.unshift("set=" + encodeURIComponent(setkvs.join(",")));
				}

				querystring = newqueries.join("&");
				newsrc = src.replace(/\?.*/, "?" + querystring);

				if (newsrc !== src)
					return {
						url: newsrc,
						can_head: false
					};

				if (imageurls.length > 0)
					return imageurls;

				return {
					url: src,
					can_head: false
				};
			}
		}

		if (domain_nowww === "natedsanders.com" && string_indexof(src, "/ItemImages/") >= 0) {
			// https://natedsanders.com/ItemImages/000008/8339a_med.jpeg -- 600x163
			//   https://natedsanders.com/ItemImages/000008/8339a_lg.jpeg -- 4500x1224
			return src.replace(/(\/[0-9a-z]+)_[a-z]+(\.[^/.]*)$/, "$1_lg$2");
		}

		if (domain === "d1x0dndjbjw02n.cloudfront.net" ||
			// https://s3-ap-northeast-1.amazonaws.com/static.lovely-media.jp/production/posts/eyecatches/000/006/246/medium.JPG?1516345778
			//   https://s3-ap-northeast-1.amazonaws.com/static.lovely-media.jp/production/posts/eyecatches/000/006/246/original.JPG?1516345778
			amazon_container === "static.lovely-media.jp" ||
			// https://s3-ap-northeast-1.amazonaws.com/static.cdn.xtreeem.com/production/imgs/images/000/098/799/medium.png
			//   https://s3-ap-northeast-1.amazonaws.com/static.cdn.xtreeem.com/production/imgs/images/000/098/799/original.png
			amazon_container === "static.cdn.xtreeem.com" ||
			// https://s3-ap-northeast-1.amazonaws.com/cdn.bibi-star.jp/production/imgs/images/000/381/572/lqip.jpg?1566385971
			//   https://s3-ap-northeast-1.amazonaws.com/cdn.bibi-star.jp/production/imgs/images/000/381/572/original.jpg?1566385971
			amazon_container === "cdn.bibi-star.jp" ||
			// https://s3-us-west-2.amazonaws.com/cdn.panda-gossips.com/production/posts/eyecatches/000/001/000/thumb.jpg?1511378312
			//   https://s3-us-west-2.amazonaws.com/cdn.panda-gossips.com/production/posts/eyecatches/000/001/000/original.jpg?1511378312
			amazon_container === "cdn.panda-gossips.com") {
			// https://d1x0dndjbjw02n.cloudfront.net/production/posts/eyecatches/000/001/438/thumb.jpg?1496817733
			//   https://d1x0dndjbjw02n.cloudfront.net/production/posts/eyecatches/000/001/438/original.jpg?1496817733
			//return src.replace(/\/thumb(\.[^/.]*)$/, "/original$1");
			return src.replace(/(\/(?:[0-9]{3}\/+){3})[a-z]+(\.[^/.]*)(?:[?#].*)?$/, "$1original$2");
		}

		if (domain === "summary-sv.fc2.com") {
			// https://summary-sv.fc2.com/api/resize_img.php?src=https%3A%2F%2Fsummary-img-sv.fc2.com%2Fsummaryfc2%2Fimg%2Fsummary%2Fwidget%2F100053655.jpeg&width=300&height=600&upd_date=2017-01-11%2008:28:37 -- upscaled
			//   https://summary-img-sv.fc2.com/summaryfc2/img/summary/widget/100053655.jpeg
			return decodeURIComponent(src.replace(/.*?\/api\/resize_img\.php.*?[?&]src=([^&]*).*?$/, "$1"));
		}

		if (domain === "c.fc2.com") {
			// http://c.fc2.com/imgs/http%3A%2F%2Fcreate-pleasure.com%2Fhigh_lp%2Fmod%2Fc500000%2F0002.jpg/
			//   http://create-pleasure.com/high_lp/mod/c500000/0002.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+imgs\/+(http[^/]*)\/*$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "image.tmdb.org" ||
			// https://www.themoviedb.org/t/p/w220_and_h330_face/6SJppowm7cdQgLkvoTlnTUSbjr9.jpg
			//   https://www.themoviedb.org/t/p/original/6SJppowm7cdQgLkvoTlnTUSbjr9.jpg
			domain_nowww === "themoviedb.org") {
			// https://image.tmdb.org/t/p/w500/76gfJrmdBADyJJXqI0GRgj01yUo.jpg -- 500x750
			//   https://image.tmdb.org/t/p/original/76gfJrmdBADyJJXqI0GRgj01yUo.jpg -- 2000x3000
			// https://image.tmdb.org/t/p/w220_and_h330_bestv2/9AMeuhQn99W6deTt6cVemCy6nKe.jpg -- 220x330
			//   https://image.tmdb.org/t/p/original/9AMeuhQn99W6deTt6cVemCy6nKe.jpg -- 1400x2100
			return src.replace(/\/[wh][0-9]+(?:_and[^/]*)?\/+([0-9a-zA-Z]+\.[^/.]*)$/, "/original/$1");
		}

		if (domain_nowww === "lookmovie.ag") {
			// https://lookmovie.ag/images/b/w780/d1977d1e6588a57934bcb4ce54ee438e.jpg
			//   https://lookmovie.ag/images/b/original/d1977d1e6588a57934bcb4ce54ee438e.jpg
			return src.replace(/(\/images\/+[bpf]\/+)[wh][0-9]+\/+([0-9a-f]{10,}\.)/, "$1original/$2");
		}

		if (false && (domain_nosub === "nbcuni.com" &&
					  string_indexof(src, "/prod/image/") >= 0)) {
			// http://tve-static-eonline.nbcuni.com/prod/image/698/238/TotalBellas_S3_Desktop_FeaturedMain_3000x1688_1500x844_1239294019624.jpg -- doesn't exist anymore
			//   http://tve-static-eonline.nbcuni.com/prod/image/698/238/TotalBellas_S3_Desktop_FeaturedMain_3000x1688.jpg
			// http://tve-static-eonline.nbcuni.com/prod/image/775/39/180626_3751765_E__News_7_2_1100x620_1269070915876.jpg -- works, but transformation doesn't
			return src.replace(/_[0-9]+x[0-9]+_[0-9]{8,}(\.[^/.]*)$/, "$1");
		}

		if (domain === "embedly.massrelevance.com") {
			// https://embedly.massrelevance.com/1/image?key=fd577f7497bf11e0b95d4040d3dc5c07&url=https%3A%2F%2Finstagram.com%2Fp%2FBiPaOWNFUvm%2Fmedia%2F%3Fsize%3Dl
			//   https://instagram.com/p/BiPaOWNFUvm/media/?size=l
			return decodeURIComponent(src.replace(/.*\/image.*?[?&]url=([^&]*).*?$/, "$1"));
		}

		if (domain === "media.lolusercontent.com") {
			// https://media.lolusercontent.com/api/embedly/1/image/resize?url=http%3A%2F%2Fddragon.leagueoflegends.com%2Fcdn%2F6.24.1%2Fimg%2Fchampion%2FZiggs.png&key=a45e967db0914c7fb472fd4381e6c85b&width=425
			//   http://ddragon.leagueoflegends.com/cdn/6.24.1/img/champion/Ziggs.png
			return decodeURIComponent(src.replace(/^[a-z]+:\/\/[^/]*\/api\/embedly\/1\/image\/resize.*?[?&]url=([^&]*).*?$/, "$1"));
		}

		if (domain === "img.day.az" ||
			// https://img.milli.az/2017/07/01/250x250f/558980_30.jpg
			//   https://img.milli.az/2017/07/01/thumb/558980_30.jpg
			//   https://img.milli.az/2017/07/01/558980_30.jpg
			domain === "img.milli.az") {
			// https://img.day.az/2018/02/10/250x250f/sexiest-women-selena-gomez.jpg
			//   https://img.day.az/2018/02/10/sexiest-women-selena-gomez.jpg
			// https://img.day.az/2018/03/07/thumb/ali_kerimli.jpg
			//   https://img.day.az/2018/03/07/ali_kerimli.jpg
			// other:
			// https://img.milli.az/250x0s/n/clickable/0b/5/http_photos.milli.az_images_year_2013_177439_212.jpg
			// https://img2.milli.az/n/clickable/0b/5/http_photos.milli.az_images_year_2013_177439_203.jpg
			// no ip found for photos.milli.az
			newsrc = src.replace(/\/(?:(?:[0-9]+x[0-9]+[a-z]?)|thumb)(\/[^/]*)$/, "$1");
			if (newsrc !== src)
				return newsrc;
			//return src.replace(/\/[0-9]+x[0-9]+[a-z]*\/([^/]*)$/, "/$1");
		}

		if (domain_nowww === "publika.az") {
			// https://publika.az/storage/2018/06/22/250x250f/rachel-riley-at-world-aids-day-gala-to-promote-grassroot-soccer-in-london-12-01-2017-6.jpg
			//   https://publika.az/storage/2018/06/22/rachel-riley-at-world-aids-day-gala-to-promote-grassroot-soccer-in-london-12-01-2017-6.jpg
			return src.replace(/(\/storage\/[0-9]{4}\/[0-9]{2}\/[0-9]{2}\/)[0-9]+x[0-9]+[a-z]?\/([^/]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "fotos.caras.uol.com.br") {
			// http://fotos.caras.uol.com.br/media/images/thumb/2017/05/08/img-767195-os-looks-dos-famosos-no-mtv-movie-tv-awards-201720170508101494249579.jpg
			//   http://fotos.caras.uol.com.br/media/images/large/2017/05/08/img-767195-os-looks-dos-famosos-no-mtv-movie-tv-awards-201720170508101494249579.jpg
			//   http://fotos.caras.uol.com.br/media/images/original/2017/05/08/img-767195-os-looks-dos-famosos-no-mtv-movie-tv-awards-201720170508101494249579.jpg
			return src.replace(/\/media\/images\/[^/]*\//, "/media/images/original/");
		}

		if (domain === "img.uol.com.br") {
			// https://img.uol.com.br/_template/v1/bgs/bg_indice-album.png
			// https://img.uol.com.br/_template/v1/album/seta-nav-dir.png
			// https://img.uol.com.br/_template/v1/album/seta-nav-esq.png
			if (/\/_template\/+v1\/+(?:bgs\/+bg_|album\/+seta-nav-)/.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}
		}

		if (domain_nosub === "uol.com.br") {
			// https://rollingstone.uol.com.br/media/_versions/500_melhores_albuns_de_todos_os_tempos_rolling_stone_2020_widemd.jpg
			//   https://rollingstone.uol.com.br/media/_versions/500_melhores_albuns_de_todos_os_tempos_rolling_stone_2020_widelg.jpg
			//   https://rollingstone.uol.com.br/media/uploads/500_melhores_albuns_de_todos_os_tempos_rolling_stone_2020.jpg
			// https://rollingstone.uol.com.br/media/_versions/batman-o_homem_morcego_-_reproducao_sqsm.jpg
			//   https://rollingstone.uol.com.br/media/uploads/batman-o_homem_morcego_-_reproducao.jpg
			// thanks to anonymous for reporting:
			// https://caras.uol.com.br/media/_versions/legacy/2012/06/10/img-401687-felipe-folgosi_widelg.jpg
			//   https://caras.uol.com.br/media/uploads/legacy/2012/06/10/img-401687-felipe-folgosi.jpg
			newsrc = src.replace(/\/media\/+_versions\/+(.*)_(?:sq|wide)(?:sm|md|lg)\./, "/media/uploads/$1.");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "www.wmj.ru" ||
			// https://sih.avn.com/300x300/top/filters:extract_focal()/album-images/2018/07/23/15432/5b55fe1652a8f-dsc5716-copy.jpg
			//   https://sih.avn.com/album-images/2018/07/23/15432/5b55fe1652a8f-dsc5716-copy.jpg
			domain === "sih.avn.com" ||
			// https://www.ferra.ru/thumb/495x0/filters:quality(75):no_upscale()/imgs/2019/09/22/11/3574619/fb673adfd041779c2418d172441a6cc47cf39dbe.jpg
			//   https://www.ferra.ru/imgs/2019/09/22/11/3574619/fb673adfd041779c2418d172441a6cc47cf39dbe.jpg
			domain_nowww === "ferra.ru" ||
			// https://motor.ru/thumb/750x0/filters:quality(75)/imgs/2016/12/30/11/205305/a1cd0b4edb6f2bc4ce457320ef026f22ddd53e33.jpg
			//   https://motor.ru/imgs/2016/12/30/11/205305/a1cd0b4edb6f2bc4ce457320ef026f22ddd53e33.jpg
			domain_nowww === "motor.ru" ||
			// https://www.passion.ru/thumb/400x0/filters:quality(75)//imgs/2017/05/13/15/901933/6ed6cad1b0242b0d401881056ab4e55b5b450065.jpg
			//   https://www.passion.ru//imgs/2017/05/13/15/901933/6ed6cad1b0242b0d401881056ab4e55b5b450065.jpg
			domain_nowww === "passion.ru") {
			// https://www.wmj.ru/thumb/399x0/filters:quality(75)//imgs/2017/05/08/08/1061619/2968fac7cdf1514616b70339f0bd0a3b43c64341.jpg
			//   https://www.wmj.ru//imgs/2017/05/08/08/1061619/2968fac7cdf1514616b70339f0bd0a3b43c64341.jpg
			return src.replace(/(:\/\/[^/]*\/)(?:thumb\/)?[0-9]+x[0-9]+\/(?:top\/)?filters:[^/]*\//, "$1");
		}

		if (domain_nosub === "centerblog.net" && string_indexof(domain, "pic.centerblog.net") >= 0) {
			// http://thebootyhunter.t.h.pic.centerblog.net/de34e5dd.jpg
			//   http://thebootyhunter.t.h.pic.centerblog.net/o/de34e5dd.jpg
			// http://www.centerblog.net/ca/1e5f476d-s.jpg
			//   http://www.centerblog.net/imgs/img/1e5f476d-s.jpg
			//   http://marilynjohn.m.a.pic.centerblog.net/1e5f476d-s.jpg
			//   http://marilynjohn.m.a.pic.centerblog.net/1e5f476d-m.jpg
			// http://marilynjohn.m.a.pic.centerblog.net/tumblr_p1edlhuTny1rxzh05o2_502.jpg
			//   http://marilynjohn.m.a.pic.centerblog.net/o/tumblr_p1edlhuTny1rxzh05o2_502.jpg
			// http://nounousylvie51.n.o.pic.centerblog.net/m/13174182_495970667254617_2594346124069563626_n_1.jpg
			//   http://nounousylvie51.n.o.pic.centerblog.net/o/13174182_495970667254617_2594346124069563626_n_1.jpg
			// http://bionicle.b.i.pic.centerblog.net/55dlahan.jpg
			//   http://bionicle.b.i.pic.centerblog.net/o/55dlahan.jpg -- doesn't work
			return src.replace(/(:\/\/[^/]*\/)(?:[a-z]\/)?([^/]*)$/, "$1o/$2");
		}

		if (domain === "d2n4wb9orp1vta.cloudfront.net") {
			// https://d2n4wb9orp1vta.cloudfront.net/cms/brand/PT/2017-PT/plastic-bag_bpf_2.jpeg;width=560
			//   https://d2n4wb9orp1vta.cloudfront.net/cms/brand/PT/2017-PT/plastic-bag_bpf_2.jpeg
			return src.replace(/;.*/, "");
		}

		if (domain === "gd.image-gmkt.com") {
			// https://gd.image-gmkt.com/li/353/589/801589353.g_400-w_g.jpg
			//   https://gd.image-gmkt.com/li/353/589/801589353.jpg
			return src.replace(/\.[^/.]*(\.[^/.]*)$/, "$1");
		}

		if (domain_nosub === "toonpool.com") {
			// https://www.toonpool.com/user/589/thumbs/zombie_315250.jpg
			//   https://www.toonpool.com/user/589/files/zombie_3152505.jpg
			//   https://www.toonpool.com/user/589/files/zombie_3152509.jpg
			// https://www.toonpool.com/user/463/files/g7-finanzministertreffen_3153385.jpg
			//   https://www.toonpool.com/user/463/files/g7-finanzministertreffen_3153389.jpg
			// https://es.toonpool.com/user/589/files/smoke_signals_3044635.jpg
			//   https://es.toonpool.com/user/589/files/smoke_signals_3044639.jpg -- no watermark
			// 9 sometimes adds a watermark
			return {
				url: src
					.replace(/(\/user\/[0-9]+\/)thumbs\/([^/.]+_[0-9]+)(\.[^/.]*)$/, "$1files/$29$3")
					.replace(/(\/user\/[0-9]+\/)files\/([^/.]+_[0-9]+)[0-9](\.[^/.]*)$/, "$1files/$29$3"),
				problems: {
					watermark: true
				}
			};
		}

		if (domain === "www.cartoonmovement.com") {
			// https://www.cartoonmovement.com/depot/cartoon_thumbnails/2018/06/04/executive_decision__paolo_calleri.jpeg
			//   https://www.cartoonmovement.com/depot/cartoons/2018/06/04/executive_decision__paolo_calleri.jpeg
			return src.replace(/\/cartoon_thumbnails\//, "/cartoons/");
		}

		if (domain_nosub === "sndimg.com") {
			// https://hgtvhome.sndimg.com/content/dam/images/hgtv/fullset/2015/5/11/0/HUHH2015-Curb-Appeal_Dallas-Chateau_4.jpg.rend.hgtvcom.231.231.suffix/1431354155331.jpeg
			//   https://hgtvhome.sndimg.com/content/dam/images/hgtv/fullset/2015/5/11/0/HUHH2015-Curb-Appeal_Dallas-Chateau_4.jpg
			return src.replace(/(\/[^/.]+\.[^/.]+)\.[^/]*(?:\/[^/]*)?$/, "$1");
		}

		if (domain === "st.hzcdn.com") {
			// https://st.hzcdn.com/fimgs/4da1bc970046413d_0612-w74-h74-b0-p0--home-design.jpg
			//   https://st.hzcdn.com/simgs/4da1bc970046413d_4-0612.jpg
			//   https://st.hzcdn.com/simgs/4da1bc970046413d_14-0612/transitional-kitchen.jpg
			// 14, 9, 4, 15, 8, 10, 11, 3, 13, 7, 2, 6, 1, 12, 5, 0
			// thanks to Kerobyte on github for reporting: https://github.com/qsniyg/maxurl/issues/1094
			// https://st.hzcdn.com/simgs/pictures/living-rooms/award-winning-shingle-style-victorian-renovation-main-line-gardner-fox-associates-inc-img~3a21260d02a75ac5_4-5874-1-195fa82.jpg
			//   https://st.hzcdn.com/simgs/pictures/living-rooms/award-winning-shingle-style-victorian-renovation-main-line-gardner-fox-associates-inc-img~3a21260d02a75ac5_14-5874-1-195fa82.jpg
			// https://st.hzcdn.com/fimgs/pictures/kitchens/transitional-kitchen-garrison-hullinger-interior-design-inc-img~4da1bc970046413d_0612-1-3f75260-w74-h74-b0-p0.jpg
			//   https://st.hzcdn.com/simgs/pictures/kitchens/transitional-kitchen-garrison-hullinger-interior-design-inc-img~4da1bc970046413d_14-1-3f75260-w74-h74-b0-p0.jpg
			return src
				.replace(/\/fimgs\/([0-9a-f]+)_([0-9]+)-[^/]*(\.[^/.]*)$/, "/simgs/$1_14-$2$3")
				.replace(/(\/simgs\/[0-9a-f]+)_[0-9]+(-[0-9]+[./])/, "$1_14$2")
				.replace(/\/[fs](imgs\/+pictures\/+.*-img~[0-9a-f]+)_[0-9]+(-[0-9]+)/, "/s$1_14$2");
		}

		if ((domain_nowww === "axisanimation.com" ||
			 // https://www.opernhaus.ch/site/assets/files/0/75/048/belshazzar_ohp_r_herwig_prammer_ana4444.1500x0.jpg
			 //   https://www.opernhaus.ch/site/assets/files/0/75/048/belshazzar_ohp_r_herwig_prammer_ana4444.jpg
			 domain_nowww === "opernhaus.ch" ||
			 // https://sexo18.net/site/assets/files/35399/sexo18-perfect-nude-chick-mila-azul.225x320.jpg
			 //   https://sexo18.net/site/assets/files/35399/sexo18-perfect-nude-chick-mila-azul.jpg
			 domain_nowww === "sexo18.net") &&
			string_indexof(src, "/assets/") >= 0) {
			// http://www.axisanimation.com/site/assets/files/1296/mjs5847.480x270.jpg
			//   http://www.axisanimation.com/site/assets/files/1296/mjs5847.jpg
			return src.replace(/\.[0-9]+x[0-9]+(\.[^/.]*)$/, "$1");
		}

		if (domain === "media.baselineresearch.com") {
			// https://media.baselineresearch.com/images/198582/198582_small.jpg
			//   https://media.baselineresearch.com/images/198582/198582_full.jpg
			return src.replace(/(\/[0-9]+_)[a-z]+(\.[^/.]*)$/, "$1full$2");
		}

		if (domain_nowww === "mireportz.com" ||
			// https://www.gameworld.gr/media/reviews/photos/thumbnail/300x300s/d7/b7/7d/emma-stone-aloha-miscast-83-1490464241.jpg
			//   https://www.gameworld.gr/media/reviews/photos/original/d7/b7/7d/emma-stone-aloha-miscast-83-1490464241.jpg
			domain_nowww === "gameworld.gr" ||
			// https://pakistani.pk/uploads/reviews/photos/thumbnail/200x200c/10/27/d5/Dane20DeHaan201-11-1502137356.jpg
			//   https://pakistani.pk/uploads/reviews/photos/original/10/27/d5/Dane20DeHaan201-11-1502137356.jpg
			domain_nowww === "pakistani.pk") {
			// http://www.mireportz.com/media/reviews/photos/thumbnail/300x300s/62/29/ad/6672-now-she-looks-like-trouble-taylor-swift-ditches-the-girlie-dresses-to-slink-onto-the-acm-red-carpet-in-a-sexy-crop-top-and-slit-skirt-44-1396850272.jpg
			//   http://www.mireportz.com/media/reviews/photos/original/62/29/ad/6672-now-she-looks-like-trouble-taylor-swift-ditches-the-girlie-dresses-to-slink-onto-the-acm-red-carpet-in-a-sexy-crop-top-and-slit-skirt-44-1396850272.jpg
			return src.replace(/\/photos\/+thumbnail\/+[0-9]+x[0-9]+[a-z]*\//, "/photos/original/");
		}

		if (domain_nosub === "gazeta.pl" && domain.match(/bis?\.gazeta\.pl/)) {
			// http://bi.gazeta.pl/im/ca/69/16/z23502282J,Piekary-Slaskie--pielgrzymka-mezczyzn.jpg
			//   http://bi.gazeta.pl/im/ca/69/16/z23502282V,Piekary-Slaskie--pielgrzymka-mezczyzn.jpg
			//   http://bi.gazeta.pl/im/ca/69/16/z23502282V.jpg
			//   http://bi.gazeta.pl/im/ca/69/16/z23502282O.jpg
			//   http://bi.gazeta.pl/im/ca/69/16/z23502282O,Piekary-Slaskie--pielgrzymka-mezczyzn.jpg
			//   https://bis.gazeta.pl/im/ca/69/16/z23502282O,Piekary-Slaskie--pielgrzymka-mezczyzn.jpg
			// https://bi.gazeta.pl/im/1f/07/16/z23100191AA.jpg
			//   https://bi.gazeta.pl/im/1f/07/16/z23100191O.jpg
			return src.replace(/(\/z[0-9]+)[A-Z]+(,[^/.]*)?(\.[^/.]*)$/, "$1O$2$3");
		}

		if (domain_nosub === "static6.com" && domain.match(/cdn[0-9]*(-[a-z]+)?\.production\.[^./]*\.static6\.com$/)) {
			// https://cdn0-a.production.images.static6.com/ngR8X2ZyTXXuQwpawU-EyycTgbM=/673x379/smart/filters:quality(75):strip_icc():format(jpeg)/liputan6-media-production/medias/1961152/original/071093900_1520215866-20180304-Artis-Ini-Pose-Berbaring-di-Red-Carpet-Oscars-AP-1.jpg
			//   https://cdn0-a.production.liputan6.static6.com/medias/1961152/original/071093900_1520215866-20180304-Artis-Ini-Pose-Berbaring-di-Red-Carpet-Oscars-AP-1.jpg
			newsrc = src.replace(/(:\/\/cdn[0-9]*(?:-[a-z]+)?\.production\.)[^./]*(\.static6\.com)\/.*?\/([^/.-]+)-media-production\/(medias\/)/,
								"$1$3$2/$4");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "lajt.co.uk") {
			// http://lajt.co.uk/media/cache/235x177/uploads/article/2016/02/Pokochaj-koronki-2.jpg
			//   http://lajt.co.uk/media/cache/original/uploads/article/2016/02/Pokochaj-koronki-2.jpg
			return src.replace(/\/media\/cache\/[0-9]+x[0-9]+\//, "/media/cache/original/");
		}

		if (domain_nowww === "ellearabia.com" ||
			// http://www.national-geographic.pl/media/cache/default_view/uploads/media/default/0008/46/1fba76fdab7bfa75738a5216b908c39a3e9128d6.jpeg
			//   http://www.national-geographic.pl/uploads/media/default/0008/46/1fba76fdab7bfa75738a5216b908c39a3e9128d6.jpeg
			domain_nowww === "national-geographic.pl" ||
			// https://www.ecranlarge.com/media/cache/160x213/uploads/image/001/031/l1uabslmgse4qwthefxzsm82axp-582.jpg
			//   https://www.ecranlarge.com/uploads/image/001/031/l1uabslmgse4qwthefxzsm82axp-582.jpg
			domain_nowww === "ecranlarge.com" ||
			// https://estaticos.marie-claire.es/media/cache/706x530_thumb/uploads/images/gallery/57d7bfe55cafe82abf1dd4a6/scarlett-johansson.jpg
			//   https://estaticos.marie-claire.es/uploads/images/gallery/57d7bfe55cafe82abf1dd4a6/scarlett-johansson.jpg
			domain === "estaticos.marie-claire.es") {
			// https://ellearabia.com/media/cache/photogallery_entry/uploads/cms/photo-gallery/entries/59b64fb94ef7b.jpg
			//   https://ellearabia.com/uploads/cms/photo-gallery/entries/59b64fb94ef7b.jpg
			return src.replace(/\/+media\/+cache\/+[^/]*\/+/, "/");
		}

		if (domain === "static.t13.cl") {
			// https://static.t13.cl/images/sizes/340x191/1560510004-107367977gettyimages-1155088278.jpg
			//   https://static.t13.cl/images/original/2019/06/1560510004-107367977gettyimages-1155088278.jpg
			match = src.match(/\/images\/+sizes\/+[^/]*\/+([0-9]{8,})-/);
			if (match) {
				var date = new Date(match[1] * 1000);
				return src.replace(/\/images\/+sizes\/+[^/]*\/+/, "/images/original/" + date.getUTCFullYear() + "/" + zpadnum(date.getUTCMonth() + 1, 2) + "/");
			}

			// http://static.t13.cl/ee_images/209706/063_488408753_(1)__360x.jpg
			//   http://static.t13.cl/ee_images/209706/063_488408753_(1).jpg
			return src.replace(/__[0-9]+x(?:[0-9]+)?(\.[^/.]*)$/, "$1");
		}

		if (domain_nowww === "cosmo.com.ua") {
			// https://www.cosmo.com.ua/i/photos_publication/18451/400_535/5p74cZz7.jpg
			//   https://www.cosmo.com.ua/i/photos_publication/18451/5p74cZz7.jpg
			return src.replace(/(\/photos_publication\/[0-9]+\/)[0-9]+_[0-9]+\//, "$1");
		}

		if (domain_nosub === "trrsf.com" && domain.match(/p[0-9]*\.trrsf\.com/)) {
			// https://p2.trrsf.com/image/fget/cf/940/0/images.terra.com/2014/09/17/7-rihanna.jpg
			//   http://images.terra.com/2014/09/17/7-rihanna.jpg
			// https://p2.trrsf.com/image/fget/cf/552/370/217/0/620/300/images.terra.com/2018/06/07/lkjas.png
			//   http://images.terra.com/2018/06/07/lkjas.png
			// https://p2.trrsf.com/image/fget/cf/fit-in/280/187/images.terra.com/2012/11/13/modelovscocarindigenadesfile1.jpg
			//   http://images.terra.com/2012/11/13/modelovscocarindigenadesfile1.jpg
			return src.replace(/^[a-z]+:\/\/[^/]*\/image\/fget\/[^/]*\/(?:(?:[0-9]+\/){4})?(?:fit-in\/+)?[0-9]+\/[0-9]+\//, "http://");
		}

		if (domain === "c.igte.ch" ||
			// https://img.digitalag.ro/?u=http%3A%2F%2Ftvhappy.ro%2Fuploads%2Fmodules%2Fnews%2F0%2F2016%2F8%2F29%2F124107%2F1472486563e2feeed9.jpg&w=527&h=750&c=1
			//   http://tvhappy.ro/uploads/modules/news/0/2016/8/29/124107/1472486563e2feeed9.jpg
			domain === "img.digitalag.ro") {
			// http://c.igte.ch/?u=http:/%2Fwww.trendus.com/Content/Images/PhotoGallery/size1/rihanna-stili-79411-1162016234238.jpg
			//   http://www.trendus.com/Content/Images/PhotoGallery/size1/rihanna-stili-79411-1162016234238.jpg
			return decodeURIComponent(src.replace(/^[a-z]+:\/\/[^/]*\/.*?[?&]u=([^&]*).*/, "$1"));
		}

		if (domain_nowww === "trendus.com" ||
			// https://trendus.igte.ch/Content/Images/PhotoGallery/size1/2016-mtv-video-muzik-odulleri-beyaz-hali-72208-2982016103639.jpg
			//   https://trendus.igte.ch/Content/Images/PhotoGallery/original/2016-mtv-video-muzik-odulleri-beyaz-hali-72208-2982016103639.jpg
			domain === "trendus.igte.ch" ||
			// https://www.boxerdergisi.com.tr/Content/Images/PhotoGallery/size1/victorias-secretin-yeni-fantasy-bra-modeli-lais-ribeiro-95874-2112017171657.jpg
			//   https://www.boxerdergisi.com.tr/Content/Images/PhotoGallery/original/victorias-secretin-yeni-fantasy-bra-modeli-lais-ribeiro-95874-2112017171657.jpg
			domain_nowww === "boxerdergisi.com.tr") {
			// http://www.trendus.com/Content/Images/PhotoGallery/size2/rihanna-stili-79411-1162016234238.jpg
			//   http://trendus.com/Content/Images/PhotoGallery/original/rihanna-stili-79411-1162016234238.jpg
			return src.replace(/\/PhotoGallery\/+size[0-9]*\//, "/PhotoGallery/original/");
		}

		if (domain === "mediacdn.grabone.co.nz") {
			// http://mediacdn.grabone.co.nz/asset/poDaw53KPl/box=615x0
			//   http://mediacdn.grabone.co.nz/asset/poDaw53KPl
			return src.replace(/(\/asset\/[-_=a-zA-Z0-9]+)\/[a-z]+=.*/, "$1");
		}

		if (domain_nosub === "woman.ru" && domain.match(/i[0-9]*(?:-cdn)?\.woman\.ru/)) {
			// http://i41-cdn.woman.ru/images/gallery/0/2/g_02d506839a15d0488cc92c0c4d9f892f_standart_2_1400x1100.jpg?02 -- stretched
			//   http://i41-cdn.woman.ru/images/gallery/0/2/g_02d506839a15d0488cc92c0c4d9f892f_standart.jpg?02
			// http://i41.woman.ru/womanru/images/article/0/5/img_056ceff32e6f0bcb7ffb957a56b5a670_2_700x600.jpg?02
			//   http://i41.woman.ru/womanru/images/article/0/5/img_056ceff32e6f0bcb7ffb957a56b5a670.jpg?02
			return src.replace(/_[0-9]+_[0-9]+x[0-9]+(\.[^/.]*)$/, "$1");
		}

		if (false && domain === "image.brigitte.de") {
			// https://image.brigitte.de/10933292/large1x1-622-622/585b7cb3885104046176db9052522e3f/GN/rihanna-bild.jpg
			//   https://image.brigitte.de/10933292/uncropped-0-0/c7d9d39acf0a47cc66553fd0536d4b58/rj/rihanna-bild.jpg
			//   https://image.brigitte.de/10933292/uncropped-0-0/585b7cb3885104046176db9052522e3f/GN/rihanna-bild.jpg -- doesn't work
			// https://image.brigitte.de/10384676/uncropped-405-622/b686770df2f13107dd62d767f3a0c25a/El/keira-knightley-gettyimages-462994440-master.jpg
			//return src.replace(/(:\/\/[^/]*\/[0-9]+\/)[^/]*(\/[0-9a-f]+\/)/, "$1uncropped-0-0$2"); // doesn't work
		}

		if (domain_nosub === "20minutos.es" && domain.match(/st-[^/.]*\.20minutos\.es/)) {
			// https://st-listas.20minutos.es/images/2016-07/413299/5021227_249px.jpg?1469993664
			//   https://st-listas.20minutos.es/images/2016-07/413299/5021227_original.jpg?1469993664
			// https://st-listas.20minutos.es/images/2010-08/242680/list_640px.jpg?1280711540 -- upscaled
			//   https://st-listas.20minutos.es/images/2010-08/242680/list_original.jpg?1280711540
			return src.replace(/(\/[0-9a-z]+)_[0-9]+px(\.[^/.]*)$/, "$1_original$2");
			//return src.replace(/(\/images\/+[0-9]{4}-[0-9]{2}\/+[0-9]+\/+)list_[0-9]+px(\.[^/.]*)(?:[?#].*)?$/,
			//                   "$1list_original$2");
		}

		if (domain_nosub === "thehunt.com" && domain.match(/cdn[0-9]*\.thehunt\.com/)) {
			// https://cdn1.thehunt.com/app/public/system/zine_images/4558527/zine_view_thumb/3d07f42e10e4992794c5f8246f8940ab.jpg
			//   https://cdn1.thehunt.com/app/public/system/zine_images/4558527/mobile/3d07f42e10e4992794c5f8246f8940ab.jpg
			//   https://cdn1.thehunt.com/app/public/system/zine_images/4558527/original/3d07f42e10e4992794c5f8246f8940ab.jpg
			// https://cdn1.thehunt.com/app/public/system/note_images/4585319/note_view/46cfbaeb48cf8001a85dec930875d86d.jpg
			//   https://cdn1.thehunt.com/app/public/system/note_images/4585319/original/46cfbaeb48cf8001a85dec930875d86d.jpg
			return src.replace(/(\/[0-9]+\/)[^/]*\/([0-9a-f]+\.[^/.]*)$/, "$1original/$2");
		}

		if (domain === "hosted.thehun.net") {
			// https://hosted.thehun.net/.content/5d8/5d89ddf4928c0/thumb.met-art_2019-09-12_POOL_DAZE_02.jpg
			//   https://hosted.thehun.net/.content/5d8/5d89ddf4928c0/met-art_2019-09-12_POOL_DAZE_02.jpg
			return src.replace(/(\/\.content\/+[0-9a-f]{3}\/+[0-9a-f]{5,}\/+)thumb\./, "$1");
		}

		if (domain_nosub === "devote.se" && domain.match(/static[0-9]*\.devote\.se/)) {
			// http://static4.devote.se/gallery/small/20150708/257a5fd7c37599cc814b4760d98eeb81.jpg
			//   http://static4.devote.se/gallery/big/20150708/257a5fd7c37599cc814b4760d98eeb81.jpg
			return src.replace(/\/gallery\/[^/]+\//, "/gallery/big/");
		}

		if (domain_nowww === "vev.ru" && /\/uploads\/+images\//.test(src)) {
			// http://www.vev.ru/uploads/images/00/01/43/2014/04/14/Rihanna-2014-MTV-Movie-Awards.jpg
			//   http://vev.ru/uploads/images/00/01/43/2014/04/14/Rihanna-2014-MTV-Movie-Awards_original.jpg
			return src.replace(/(?:_[a-z]+)?(\.[^/.]*)$/, "_original$1");
		}

		if (domain === "s.glbimg.com") {
			// http://s.glbimg.com/jo/eg/f/288x0/2012/11/14/156353044.jpg
			//   http://s.glbimg.com/jo/eg/f/original/2012/11/14/156353044.jpg
			return src.replace(/\/[0-9]+x[0-9]+\//, "/original/");
		}

		if (domain === "image.xahoi.com.vn" ||
			// http://media.tinmoi.vn/resize_248x156/2014/08/05/tay-chu-v-ava.jpg
			//   http://media.tinmoi.vn/2014/08/05/tay-chu-v-ava.jpg
			domain === "media.tinmoi.vn" ||
			// https://media.ngoisao.vn/resize_580/news/2017/11/29/tae3-ngoisao.vn-w600-h597.jpg
			//   https://media.ngoisao.vn/news/2017/11/29/tae3-ngoisao.vn-w600-h597.jpg
			domain === "media.ngoisao.vn") {
			// http://image.xahoi.com.vn/resize_580x1100/news/2014/12/15/taylor-swift22.jpg
			//   http://image.xahoi.com.vn/news/2014/12/15/taylor-swift22.jpg
			return src.replace(/(:\/\/[^/]*\/)resize_[0-9]+(?:x[0-9]+)?\//, "$1");
		}

		if (domain_nosub === "intermoda.ru" && domain.match(/s[0-9]*\.intermoda\.ru/)) {
			// http://s1.intermoda.ru/p/max1400/1d/4dda/1e85e085d794e335925b586634813387.jpg
			//   http://s1.intermoda.ru/p/original/1d/4dda/1e85e085d794e335925b586634813387.jpg
			// http://s1.intermoda.ru/p/h450/7c/c593/a145e3941441046673b379884eead1cc.jpg
			//   http://s1.intermoda.ru/p/original/7c/c593/a145e3941441046673b379884eead1cc.jpg
			return src.replace(/\/p\/(?:max|h|w)[0-9]*\//, "/p/original/");
		}

		if (domain === "static.life.ru") {
			// https://static.life.ru/posts/2016/02/347017/5fef920a6117a660ad36961f31cd8e83__980x.jpg
			//   https://static.life.ru/posts/2016/02/347017/5fef920a6117a660ad36961f31cd8e83.jpg
			return src.replace(/__[0-9]+x(?:[0-9]+)?(\.[^/.]*)$/, "$1");
		}

		if (domain === "a.ltrbxd.com") {
			// https://a.ltrbxd.com/resized/sm/upload/l1/y0/02/4c/anohana-1200-1200-675-675-crop-000000.jpg?k=dec61b1bd7
			//   https://a.ltrbxd.com/sm/upload/l1/y0/02/4c/anohana.jpg
			// https://a.ltrbxd.com/resized/film-poster/1/7/9/2/3/0/179230-anohana-the-flower-we-saw-that-day-the-movie-0-230-0-345-crop.jpg?k=00177b15f7
			// https://a.ltrbxd.com/resized/film-poster/2/5/8/3/7/25837-rampage-0-230-0-345-crop.jpg?k=f906f9c4ed
			//   https://a.ltrbxd.com/film-poster/2/5/8/3/7/25837-rampage.jpg?k=f906f9c4ed -- broken
			// thanks to remlap for reporting:
			// https://a.ltrbxd.com/resized/avatar/upload/7/3/3/3/5/7/5/shard/avtr-0-1000-0-1000-crop.jpg?v=d4e92a9521
			//   https://a.ltrbxd.com/avatar/upload/7/3/3/3/5/7/5/shard/avtr?v=d4e92a9521 -- 1689x1689
			return src
				.replace(/(\/avatar\/+upload\/.*\/avtr)\.[a-z]+([?#].*)?$/, "$1$2")
				.replace(/\/resized\/(.*)-(?:[0-9]+-){4}crop(?:-[0-9]+)?(\.[^/.]*)?$/, "/$1$2");
		}

		if (domain === "images.goodsmile.info") {
			// http://images.goodsmile.info/cgm/images/product/20151117/5347/36478/medium/7c87232c87be286eaa9acf85ad86e2fb.jpg
			//   http://images.goodsmile.info/cgm/images/product/20151117/5347/36478/large/7c87232c87be286eaa9acf85ad86e2fb.jpg
			//   http://images.goodsmile.info/cgm/images/product/20151117/5347/36478/original/7c87232c87be286eaa9acf85ad86e2fb.jpg
			// doesn't work for all:
			// http://images.goodsmile.info/cgm/images/product/20111026/3326/15941/large/c0cb17556e0c49ccc02e5e47cfa642be.jpg
			//   http://images.goodsmile.info/cgm/images/product/20111026/3326/15941/original/c0cb17556e0c49ccc02e5e47cfa642be.jpg
			return src.replace(/\/[a-z]+(\/[0-9a-f]+\.[^/.]*)$/, "/original$1");
		}

		if (domain === "dzt1km7tv28ex.cloudfront.net") {
			// https://dzt1km7tv28ex.cloudfront.net/u/309884825181880320_35s_d.jpg
			//   https://dzt1km7tv28ex.cloudfront.net/u/309884825181880320_35s_o.jpg
			// https://dzt1km7tv28ex.cloudfront.net/u/195776329524707328_35s_d.jpg
			//   https://dzt1km7tv28ex.cloudfront.net/u/195776329524707328_35s_o.jpg
			return src.replace(/_[a-z](\.[^/.]*)$/, "_o$1");
		}

		if (domain_nowww === "celebs-place.com") {
			// http://www.celebs-place.com/gallery/selena-gomez/image(468)_s.jpg
			//   http://www.celebs-place.com/gallery/selena-gomez/image(468).jpg
			// http://celebs-place.com/news/pics/2019/2498_b.jpg
			//   http://celebs-place.com/news/pics/2019/2498.jpg
			return src.replace(/(\/(?:gallery|news\/+pics)\/+[^/]*\/+[^/]*)_[a-z](\.[^/.]*)$/, "$1$2");
		}

		if (domain === "static.vfiles.com") {
			// https://static.vfiles.com/api/v2/image/media/268246/preview
			return {
				url: src.replace(/(\/image\/media\/[0-9]+\/)[a-z]+(?:\?.*)?$/, "$1original"),
				can_head: false
			};
		}

		if (domain === "img.mediacentrum.sk") {
			// https://img.mediacentrum.sk/gallery/350/1846319.jpg
			//   https://img.mediacentrum.sk/gallery/original/1846319.jpg
			// https://img.mediacentrum.sk/gallery/nwo/maxwidth/233/1846375.jpg
			//   https://img.mediacentrum.sk/gallery/original/1846375.jpg
			// https://img.mediacentrum.sk/images/gallery/640/877491.jpg
			//   https://img.mediacentrum.sk/images/gallery/original/877491.jpg
			// https://img.mediacentrum.sk/gallery/620_a/2932723.jpg
			//   https://img.mediacentrum.sk/gallery/original/2932723.jpg
			//return src.replace(/\/images\/gallery\/[0-9]+\//, "/images/gallery/original/");
			return src.replace(/\/gallery\/(?:.*?\/)?[0-9]+(?:_[a-z])?\/([0-9]+\.[^/.]*)$/, "/gallery/original/$1");
		}

		if (domain === "images.says.com") {
			// http://images.says.com/uploads/story_source/source_image/89484/big_thumb_2285.jpeg -- stretched
			//   http://images.says.com/uploads/story_source/source_image/89484/2285.jpeg
			return src.replace(/(\/[0-9]+\/)[a-z_]+_([0-9]+\.[^/.]*)$/, "$1$2");
		}

		if (domain_nosub === "skyrock.net" && /^(?:[0-9]+\.)?wir\./.test(domain)) {
			// https://wir.skyrock.net/wir/v1/resize/?c=isi&im=%2F7688%2F86157688%2Fpics%2F3171145327_1_9_XywnO238.jpg&w=252
			//   https://i.skyrock.net/7688/86157688/pics/3171145327_1_9_XywnO238.jpg
			// http://02.wir.skyrock.net/wir/v1/resize/?c=isi&im=%2F4921%2F86694921%2Fpics%2F3138257478_1_4_mkNPTfWC.jpg&w=254
			//   https://i.skyrock.net/4921/86694921/pics/3138257478_1_4_mkNPTfWC.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/.*[?&]im=([^&]*).*$/, "$1");
			if (newsrc !== src)
				return urljoin("https://i.skyrock.net/", decodeuri_ifneeded(newsrc), true);
		}

		if (domain === "i.skyrock.net") {
			// https://i.skyrock.net/4356/80274356/pics/photo_80274356_avatar_130.jpg
			//   https://i.skyrock.net/4356/80274356/pics/photo_80274356_130.jpg
			// https://i.skyrock.net/7688/86157688/pics/photo_86157688_small_22.jpg
			//   https://i.skyrock.net/7688/86157688/pics/photo_86157688_22.jpg
			// https://i.skyrock.net/5946/11875946/pics/350347040_small.jpg
			//   https://i.skyrock.net/5946/11875946/pics/350347040.jpg
			// https://i.skyrock.net/1868/84821868/pics/3106900297_0_3_V2mZWGaH.jpg
			//   https://i.skyrock.net/1868/84821868/pics/3106900297_1_3_V2mZWGaH.jpg
			return src
				.replace(/(\/pics\/(?:photo_)?[0-9]+)_[a-z]+((?:_[0-9]+)?\.[^/.]*)$/, "$1$2")
				.replace(/(\/pics\/[0-9]+)_[0-9]_([0-9]+_[A-Za-z0-9]+\.[^/.]*)$/, "$1_1_$2");
		}

		if (domain === "mgl.skyrock.net") {
			// https://mgl.skyrock.net/art/PRIP.80644265.3.0.jpg -- 100x100
			//   https://mgl.skyrock.net/art/PRIP.80644265.3.1.jpg -- 200x200
			return src.replace(/(\/art\/+[A-Z]+\.[0-9]+\.[0-9]+)\.0(\.[^/.]*)(?:[?#].*)?$/, "$1.1$2");
		}

		// no longer works
		if (false && (domain_nosub === "xhcdn.com" &&
			(domain.match(/thumb-p[0-9]*\.xhcdn\.com/) ||
			 // https://upt.xhcdn.com/000/105/050/371_450.jpg
			 //   https://thumb-p1.xhcdn.com/000/105/050/371_450.jpg
			 //   https://thumb-p1.xhcdn.com/000/105/050/371_1000.jpg
			 domain === "upt.xhcdn.com" ||
			 // https://ept.xhcdn.com/000/160/284/253_450.jpg
			//   https://thumb-p3.xhcdn.com/000/160/284/253_1000.jpg
			 domain === "ept.xhcdn.com"))) {
			// https://thumb-p2.xhcdn.com/000/185/972/432_450.jpg
			//   https://thumb-p2.xhcdn.com/000/185/972/432_1000.jpg
			// https://thumb-p1.xhcdn.com/a/wSJ0v3lFPnqwW6WyQJyyEg/000/173/628/371_450.jpg
			//   https://thumb-p1.xhcdn.com/000/173/628/371_1000.jpg
			// https://thumb-p3.xhcdn.com/a/eAt05px_r-lujVDZwwvaDA/000/173/628/363_450.jpg
			//   https://thumb-p3.xhcdn.com/000/173/628/363_1000.jpg
			newsrc = src.replace(/(:\/\/[^/]*\/)a\/+[-_a-zA-Z0-9]{10,}\/+([0-9]+\/)/, "$1$2");
			if (newsrc !== src)
				return newsrc;

			return src.replace(/(\/[0-9]+_)[0-9]+(\.[^/.]*)$/, "$11000$2");
		}

		if (false && domain_nosub === "cdn13.com") {
			if (/:\/\/[^/]+\/+(?:[0-9]{3}\/+){3}[^/?#]+\.(?:mp4|m3u8)/.test(src)) {
				return {
					url: src,
					headers: {
						Origin: "https://xhamster.com",
						Referer: "https://xhamster.com/",
						"Sec-Fetch-Dest": "empty"
					},
					video: true
				};
			}
		}

		if (domain_nowww === "xh.video") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+[ve]\/+([-_a-zA-Z0-9]{2,5})\/*(?:[?#].*)?$/,
				query_for_id: "https://xh.video/v/${id}",
				process: function(done, resp, cache_key) {
					done({
						url: resp.finalUrl,
						is_pagelink: true
					}, 60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "xh.video" ||
			common_functions["multidomain__xhamster"](domain_nosub)) {
			var query_xhamster_hashslug_by_id = function(id, cb) {
				if (/^xh/.test(id))
					return cb(id);

				api_query("xhamster_hashslug:" + id, {
					url: "https://xhamster.com/api/flash.php?/video/info&video_id=" + id,
					headers: {
						Referer: "https://www.xhamster.com/"
					},
					json: true
				}, cb, function(done, resp, cache_key) {
					if (!resp.shareUrl) {
						console_error(cache_key, "Unable to find shareUrl in", resp);
						return done(null, false);
					}

					// TODO: refactor
					var match = resp.shareUrl.match(/^[a-z]+:\/\/[^/]+\/+(?:videos|embed|x)\/+(?:[^/?#.]*-)?([0-9]+|xh[0-9a-zA-Z]+)(?:[?#].*)?$/);
					if (!match) {
						console_error(cache_key, "Unsupported shareUrl", resp.shareUrl);
						return done(null, false);
					}

					return done(match[1], 6*60*60);
				});
			};

			var get_xhamster_initials = function(resp) {
				var match = resp.responseText.match(/window\.initials\s*=\s*({.*});/);
				if (!match) {
					console_error("Unable to find initials from", resp);
					return null;
				}

				try {
					var json = JSON_parse(match[1]);
					return json;
				} catch(e) {
					console_error(e, resp);
				}

				return null;
			};

			var query_xhamster_video = function(id, cb) {
				var cache_key = "xhamster:" + id;
				api_cache.fetch(cache_key, cb, function(done) {
					var tested_hashslug = false;
					var do_query = function() {
						options.do_request({
							url: "https://www." + domain_nosub + "/videos/" + id,
							method: "GET",
							onload: function(resp) {
								if (resp.status !== 200) {
									if (/^[0-9]+$/.test(id) && !tested_hashslug) {
										query_xhamster_hashslug_by_id(id, function(hashslug) {
											if (!hashslug || hashslug === id) {
												console_error(cache_key, resp);
												return done(null, false);
											} else {
												tested_hashslug = true;
												id = hashslug;

												do_query();
											}
										});

										return;
									} else {
										console_error(cache_key, resp);
										return done(null, false);
									}
								}

								var initials = get_xhamster_initials(resp);
								if (!initials) return done(null, false);

								try {
									var videomodel = initials.videoModel;

									if (videomodel.title && videomodel.pageURL) {
										return done(videomodel, 60*60);
									}
								} catch(e) {
									console_error(cache_key, e);
								}

								return done(null, false);
							}
						});
					};

					do_query();
				});
			};

			var get_max_source = function(sources) {
				if (!sources)
					return null;

				var max = 0;
				var maxobj = null;

				for (var quality in sources) {
					var qualityn = parseInt(quality);

					if (!isNaN(qualityn) && qualityn > max) {
						max = qualityn;
						maxobj = sources[quality];
					}
				}

				return maxobj;
			};

			var get_xhamster_photomodel = function(galleryid, photoid, cb) {
				api_query("xhamster_photo:" + photoid, {
					url: "https://" + domain + "/photos/gallery/" + galleryid + "/" + photoid
				}, cb, function(done, resp, cache_key) {
					var initials = get_xhamster_initials(resp);
					if (!initials) return done(null, false);

					var gallery = initials.photosGalleryModel;
					var photos = gallery.photos.items;

					var our_photo = null;

					array_foreach(photos, function(photo) {
						api_cache.set("xhamster_photo:" + photo.id, photo, 6*60*60);

						// intentional == in case of string/int comparison
						if (photo.id == photoid) {
							our_photo = photo;
						}
					});

					if (!our_photo) {
						console_error(cache_key, "Unable to find photo from", initials, resp);
						return done(null, false);
					}

					return done(our_photo, 6*60*60);
				});
			};

			var get_obj_from_xhamster_model = function(model) {
				if (!model) return null;

				var baseobj = {
					extra: {
						page: model.pageURL,
						caption: model.titleLocalized || model.title
					}
				};

				var origin = "https://" + domain;
				if (domain_nosub === "xh.video") {
					origin = "https://www.xhamster.com/";
					baseobj.extra.page = baseobj.extra.page.replace(/xh\.video\//, "xhamster.com/");
				}

				var urls = [];

				if ("sources" in model) {
					var goodsources = [
						"mp4",
						"download"
					];

					for (var i = 0; i < goodsources.length; i++) {
						var our_source = goodsources[i];

						var max = get_max_source(model.sources[our_source]);
						if (max) {
							var our_obj = {
								headers: {
									Accept: "*/*",
									Origin: origin,
									Referer: baseobj.extra.page,
									"Sec-Fetch-Dest": "empty"
								},
								url: max,
								video: true
							};

							urls.push(our_obj);

							break;
						}
					}
				}

				if (model.imageURL) urls.push(model.imageURL); // for photos
				if (model.thumbURL) urls.push(model.thumbURL);

				return fillobj_urls(urls, baseobj);
			};

			newsrc = website_query({
				website_regex: {
					regex: /^[a-z]+:\/\/[^/]+\/+photos\/+gallery\/+([0-9]+)\/+([0-9]+)\/*(?:[?#].*)?$/,
					groups: ["gallery", "id"]
				},
				run: function(cb, match) {
					get_xhamster_photomodel(match.groups.gallery, match.groups.id, function(data) {
						return cb(get_obj_from_xhamster_model(data));
					});
				}
			});
			if (newsrc) return newsrc;

			newsrc = website_query({
				website_regex: [
					/^[a-z]+:\/\/[^/]+\/+(?:videos|embed|x)\/+(?:[^/?#.]*-)?([0-9]+|xh[0-9a-zA-Z]+)(?:[?#].*)?$/,
					/^[a-z]+:\/\/[^/]+\/+xembed\.php\?(?:.*&)?video=([0-9]+|xh[0-9a-zA-Z]+)(?:&.*)?(?:#.*)?$/,
					/^[a-z]+:\/\/[^/]+\/+movies\/+([0-9]+)\/+[^/]+\.html(?:[?#].*)?$/
				],
				run: function(cb, match) {
					query_xhamster_video(match[1], function(data) {
						return cb(get_obj_from_xhamster_model(data));
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nosub === "xhcdn.com") {
			// https://static-lvlt.xhcdn.com/xh-tpl3/images/pixel.gif
			// https://static-lvlt.xhcdn.com/xh-desktop/images/pixel.gif
			if (/\/xh-(?:tpl|desktop)[0-9]*\/+images\/+pixel\./.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}
		}

		if (domain_nosub === "xhcdn.com" && /^thumb-(?:lvlt|v[0-9]*)\./.test(domain)) {
			// https://thumb-lvlt.xhcdn.com/a/XtFVJhj0T4uGdKxntAsGVw/002/499/117/240x135.2.jpg
			match = src.match(/\/a\/+[^/.]{20,}\/+((?:[0-9]{3}\/+){3})/);
			if (match) {
				id = match[1].replace(/\/+/g, "").replace(/^0+/, "");

				return "https://www.xhamster.com/videos/" + id;
			}
		}

		if (domain_nosub === "xhcdn.com" && /^thumb-(?:lvlt|p[0-9]*)\./.test(domain) &&
			options.element &&
			common_functions["multidomain__xhamster"](host_domain_nosub)) {
			newsrc = common_functions["get_pagelink_el_matching"](options.element, /^[a-z]+:\/\/[^/]+\/+photos\/+gallery\/+[0-9]+\/+[0-9]+/);
			if (newsrc) return newsrc;
		}

		if (domain_nosub === "netease.com" && domain.match(/img[0-9]*\.cache\.netease\.com/)) {
			// http://img4.cache.netease.com/photo/0026/2016-02-06/s_BF64NUDI43AJ0026.jpg
			//   http://img4.cache.netease.com/photo/0026/2016-02-06/t_BF64NUDI43AJ0026.jpg
			//   http://img4.cache.netease.com/photo/0026/2016-02-06/BF64NUDI43AJ0026.jpg
			// http://img2.cache.netease.com/lady/2016/4/16/20160416180754fa41d_550.jpg
			//   http://img2.cache.netease.com/lady/2016/4/16/20160416180754fa41d.jpg
			// http://img5.cache.netease.com/photo/0031/2015-09-08/140x98_B30QHVQI4VJD0031.jpg
			//   http://img5.cache.netease.com/photo/0031/2015-09-08/B30QHVQI4VJD0031.jpg
			// http://img4.cache.netease.com/photo/0031/2017-01-06/CA4I992B71570031.550x.0.jpg
			//   http://img4.cache.netease.com/photo/0031/2017-01-06/CA4I992B71570031.jpg
			return src
				.replace(/[?#].*$/, "")
				.replace(/\/(?:[a-z]|[0-9]+x[0-9]+)_([^/]*)$/, "/$1")
				.replace(/_[0-9]+(\.[^/.]*)$/, "$1")
				.replace(/\.[0-9]+x\.[0-9]+(\.[^/.]*)$/, "$1");
		}

		if (domain === "img.lengding.cn") {
			// http://img.lengding.cn/article/getImage.php?url=https://mmbiz.qpic.cn/mmbiz_jpg/OBQWTDeVLCNUFv5o4U2RNVrCSTKphdIibJFyFfeyV1gnmtaGazdEibzuO2kicjH5OM3Uadly6ngQKrQxPLPQTwgpQ/640?wx_fmt=jpeg
			//   https://mmbiz.qpic.cn/mmbiz_jpg/OBQWTDeVLCNUFv5o4U2RNVrCSTKphdIibJFyFfeyV1gnmtaGazdEibzuO2kicjH5OM3Uadly6ngQKrQxPLPQTwgpQ/0
			return src.replace(/.*?\/getImage\.php.*?[?&]url=(.*)$/, "$1");
		}

		if (domain === "cdn.sabay.com") {
			// http://cdn.sabay.com/cdn/media.sabay.com/media/Kanha/Fashion/Feshion-4/selena-4_large.jpg
			return src.replace(/:\/\/[^/]+\/cdn\/([a-z]+\.[a-z]+\.[a-z]+\/)/, "://$1");
		}

		if (domain === "media.sabay.com") {
			// http://media.sabay.com/media/Kanha/Fashion/Feshion-4/selena-4_large.jpg
			//   http://media.sabay.com/media/Kanha/Fashion/Feshion-4/selena-4.jpg
			return src.replace(/_[a-z]+(\.[^/.]*)$/, "$1");
		}

		if (domain === "s.olj.me" ||
			// https://static.addiyar.com/storage/attachments/1430/rihanna_892120_large.jpg
			//   https://static.addiyar.com/storage/attachments/1430/rihanna_892120.jpg
			(domain === "static.addiyar.com" && /\/storage\/+attachments\//.test(src)) ||
			// https://static2.annahar.com/storage/attachments/397/Rihanna-Dior_sunglasses_959864_940431_large.jpg
			//   https://static2.annahar.com/storage/attachments/397/Rihanna-Dior_sunglasses_959864_940431.jpg
			(domain_nosub === "annahar.com" && /^static[0-9]*\./.test(domain) && /\/storage\/+attachments\//.test(src))) {
			// https://s.olj.me/storage/attachments/885/p015-5_727183_thumbnail.jpg
			//   https://s.olj.me/storage/attachments/885/p015-5_727183.jpg
			// https://s.olj.me/storage/attachments/885/p015-5_727183.jpg/r/400
			//   https://s.olj.me/storage/attachments/885/p015-5_727183.jpg
			return src.replace(/(\/storage\/+attachments\/+[0-9]+\/+[^/]*_[0-9]+)(?:_(?:large|thumbnail))?(\.[^/.]*)(?:\/+r\/+[0-9]+)?(?:[?#].*)?$/,
							   "$1$2");
		}

		// haven't found anything yet
		if (domain === "binaryapi.ap.org") {
			// http://binaryapi.ap.org/2df5c8e3642d4183a08cf802c2dd50b1/preview/AP13344549840.jpg
			// http://binaryapi.ap.org/12df59bdddfa40e1967ba8f9884c8f29/940x.jpg
			//   http://binaryapi.ap.org/12df59bdddfa40e1967ba8f9884c8f29/preview.jpg
			//   http://binaryapi.ap.org/12df59bdddfa40e1967ba8f9884c8f29/460x.jpg
			// any number is accepted, not upscaled
			return {
				url: src,
				can_head: false
			};
		}

		// don't know if nosub is correct or not
		if (domain_nosub === "ekladata.com") {
			// http://ekladata.com/Szr7glS4gLW9Qj87s75kpakvTPY@546x364.jpg
			//   http://ekladata.com/Szr7glS4gLW9Qj87s75kpakvTPY.jpg
			return src.replace(/@[0-9]+x(?:[0-9]+)?(\.[^/.]*)$/, "$1");
		}

		if (domain === "img.geinoueroch.com" ||
			// http://image.hoopchina.com/nba/huabian/milla-jovovich-allen-17-s.jpg
			//   http://image.hoopchina.com/nba/huabian/milla-jovovich-allen-17.jpg
			domain === "image.hoopchina.com" ||
			// http://san.imatin.net/images/barba-s.jpg -- 300x192
			//   http://san.imatin.net/images/barba.jpg -- 2691x1725
			(domain === "san.imatin.net" && string_indexof(src, "/images/") >= 0) ||
			// https://kandamori.com/hamblog6201510/2015110704-s.jpg
			//   https://kandamori.com/hamblog6201510/2015110704.jpg
			(domain_nowww === "kandamori.com" && src.match(/\/hamblog[0-9]+\/+[0-9]+/)) ||
			// https://img.momon-ga.com/imgs/2/f/2f380c51-s.jpg
			domain === "img.momon-ga.com") {
			// http://img.geinoueroch.com/imgs/f/c/fc3b9e51-s.jpg
			//   http://img.geinoueroch.com/imgs/f/c/fc3b9e51.jpg
			return src.replace(/-s(\.[^/.]*)$/, "$1");
		}

		if (domain === "note.taable.com" &&
			string_indexof(src, "/photo/") >= 0) {
			// http://note.taable.com/photo/scontent.xx.fbcdn.net/v/t31.0-0/p480x480/11182667_10153880871767871_5071962208418710934_o.jpg%3F_nc_cat%3D0%26oh%3D6bb4ad139609d4a1a828aac3d663b3c8%26oe%3D5B8E87B6%26ti%3D1451386800%26_wi%3D200
			//   https://scontent.xx.fbcdn.net/v/t31.0-0/p480x480/11182667_10153880871767871_5071962208418710934_o.jpg?_nc_cat=0&oh=6bb4ad139609d4a1a828aac3d663b3c8&oe=5B8E87B6&ti=1451386800&_wi=200
			return decodeURIComponent(src.replace(/:\/\/[^/]*\/photo\//, "://"));
		}

		if (domain_nosub === "adult-gazou.me" && domain.match(/img-[^.]*\.adult-gazou\.me/)) {
			// http://img-fdc03.adult-gazou.me/adult_b/2515/s/25.jpg
			//   http://img-fdc03.adult-gazou.me/adult_b/2515/l/25.jpg
			return src.replace(/\/[a-z](\/[0-9]*\.[^/.]*)$/, "/l$1");
		}

		if (domain_nosub === "fukugan.com" &&
			string_indexof(src, "/rssimg/") >= 0) {
			// http://jpn6.fukugan.com/rssimg/thumb_cache/crop_fr0_185x150/http%253A%252F%252Flivedoor.blogimg.jp%252Fseisobitch%252Fimgs%252F8%252Fe%252F8e0df1a7.jpg.%2523FFFFFF.jpg
			//   http://livedoor.blogimg.jp/seisobitch/imgs/8/e/8e0df1a7.jpg
			return decodeURIComponent(decodeURIComponent(src.replace(/.*\/(https?[%:].*)/, "$1"))).replace(/\.#.*/, "");
		}

		if ((domain_nosub === "lostbird.vn" ||
			 // https://img1.nginx.page/480x-/2018/05/08/171604/05b56f2719a34fb4c53e821f158b663f.jpg
			 //   https://img1.nginx.page/2018/05/08/171604/05b56f2719a34fb4c53e821f158b663f.jpg
			 domain_nosub === "nginx.page") &&
			domain.match(/img[0-9]*\./)) {
			// http://img1.lostbird.vn/320x-/2018/02/27/79295/320x480_201312061146592vz0gfz60zu37ihp.jpg
			//   http://img1.lostbird.vn/2018/02/27/79295/320x480_201312061146592vz0gfz60zu37ihp.jpg
			//   http://img1.lostbird.vn/2018/02/27/79295/201312061146592vz0gfz60zu37ihp.jpg -- doesn't work
			return src.replace(/(:\/\/[^/]*\/)[-0-9]+x[-0-9]+\//, "$1");
		}

		if (domain === "img.biggo.com.tw") {
			// https://img.biggo.com.tw/120,fit,s7JNwTn1ERJnfry1vht0i1DbjsRTt5vOWIvAvWscdSBo/https://tshop.r10s.com/a85/93e/b037/66d8/7062/61bc/20f0/11bee787262c600c7376cd.jpg
			//   https://tshop.r10s.com/a85/93e/b037/66d8/7062/61bc/20f0/11bee787262c600c7376cd.jpg
			return src.replace(/^[a-z]+:\/\/[^/]*\/[^/]*\//, "");
		}

		if (((domain_nosub === "book.com.tw" && domain.match(/im[0-9]*\.book\.com\.tw/)) ||
			 // https://www.books.com.tw/image/getImage?i=https%3A%2F%2Fwww.books.com.tw%2Fimg%2FM01%2F004%2F93%2FM010049307.jpg&width=170&height=240
			 //   https://www.books.com.tw/img/M01/004/93/M010049307.jpg
			 domain === "www.books.com.tw" ||
			 // https://buy.line-scdn.net/2962ea41/im1/image/getImage?i=https://www.books.com.tw/img/M01/004/93/M010049307.jpg&v=57bebab0&w=348&h=348
			 //   https://www.books.com.tw/img/M01/004/93/M010049307.jpg
			 domain === "buy.line-scdn.net") &&
			string_indexof(src, "/getImage") >= 0) {
			// http://im2.book.com.tw/image/getImage?i=https://www.books.com.tw/img/M01/004/93/M010049307.jpg&v=56d955b0&w=170&h=170m
			//   https://www.books.com.tw/img/M01/004/93/M010049307.jpg
			return decodeURIComponent(src.replace(/.*\/getImage.*?[?&]i=([^&]*).*?$/, "$1"));
		}

		if (domain === "img.feebee.com.tw") {
			// https://img.feebee.com.tw/ip/80/V-mkCCEt4SsOwU_ATVl53cCQxY5b-fGCIJyxLtJ6L6Y=/https://img.feebee.com.tw/ip/80/x45LJqQkSKXB-QnsHKtYoXDSJ4Y30TxSBJ3D9W8aRwg=/https://s.yimg.com/ut/api/res/1.2/IwnHZ4UimV4jdmDNhzi5jQ--~B/dz02MDA7aD02MDA7cT04MTtmaT1maXQ7YXBwaWQ9eXR3bWFsbA--/https://s.yimg.com/fy/ba06/item/p0303104354614-item-0541xf4x0750x0750-m.jpg
			//   https://s.yimg.com/fy/ba06/item/p0303104354614-item-0541xf4x0750x0750-m.jpg
			return src.replace(/^[a-z]+:\/\/[^/]*\/ip\/[0-9]+\/[^/]+=\//, "");
		}

		if (domain === "www.consolefun.fr" ||
			// https://nookthem.com/contents/combo/4990/thumbs/th_evil-angel-with-chloe-couture-mark-wood-in-open-my-ass-01.jpg
			//   https://nookthem.com/contents/combo/4990/evil-angel-with-chloe-couture-mark-wood-in-open-my-ass-01.jpg
			domain_nowww === "nookthem.com" ||
			// https://nude-gals.com/galleries/karmen%20bella/0001/thumbs/th_karmen-bella-is-a-treat-to-behold-by-digital-desire-01.jpg
			//   https://nude-gals.com/galleries/karmen%20bella/0001/karmen-bella-is-a-treat-to-behold-by-digital-desire-01.jpg
			domain_nowww === "nude-gals.com") {
			// http://www.consolefun.fr/fiche/ps4/thumbs/th_1523541277uwo0iwsr40b1rg0p3fq6.jpg
			//   http://www.consolefun.fr/fiche/ps4/1523541277uwo0iwsr40b1rg0p3fq6.jpg
			return src.replace(/\/thumbs\/+th_/, "/");
		}

		if (domain === "ex.f3img.gq") {
			// https://ex.f3img.gq/api/image?url=https%3A%2F%2Fi.kinja-img.com%2Fgawker-media%2Fimage%2Fupload%2Fs--86MJ72ai--%2Fc_scale%2Cfl_progressive%2Cq_80%2Cw_800%2Fuwo0iwsr40b1rg0p3fq6.jpg&w=715
			//   https://i.kinja-img.com/gawker-media/image/upload/uwo0iwsr40b1rg0p3fq6.jpg
			return decodeURIComponent(src.replace(/.*?\/api\/image.*?[?&]url=([^&]*).*?$/, "$1"));
		}

		if (domain === "images.everyeye.it") {
			// https://images.everyeye.it/img-topscheda/yakuza-6-the-song-of-life-v12-24174-1280.jpg
			//   https://images.everyeye.it/img-topscheda/yakuza-6-the-song-of-life-v12-24174.jpg
			return src.replace(/(-v[0-9]+-[0-9]+)-[0-9]+(\.[&/.]*)/, "$1$2");
		}

		if (domain_nowww === "bobx.com") {
			// http://www.bobx.com/thumbnail/av-idol/tsubomi-tsubomi/tsubomi-tsubomi-preview-04575180.jpg
			//   http://www.bobx.com/av-idol/tsubomi-tsubomi/tsubomi-tsubomi-04575180.jpg
			// http://www.bobx.com/thumbnail/av-idol/tsubomi-tsubomi/tsubomi-tsubomi-04575387.t.jpg
			//   http://www.bobx.com/av-idol/tsubomi-tsubomi/tsubomi-tsubomi-04575387.jpg
			// http://www.bobx.com/av-idol/tsubomi-tsubomi/tsubomi-tsubomi-4236244.html
			// http://www.bobx.com/av-idol/tsubomi-tsubomi/tsubomi-tsubomi--04236244.jpg
			//   http://www.bobx.com/av-idol/tsubomi-tsubomi/tsubomi-tsubomi-04236244.jpg
			// bad if:
			//   Content-Length: 281567
			//   Last-Modified: Tue, 19 Nov 2019 03:54:27 GMT
			// needs login
			var get_obj = function(url) {
				var normurl = url
					.replace(/\/thumbnail\/+(.*?)(?:-preview)?(-[0-9]+)(?:\.t)?(\.[^/.]*)$/, "/$1-$2$3")
					.replace(/--([0-9]+\.[^/.]*)$/, "-$1");

				var obj:BigImageInfoSObject = {
					url: url,
					headers: {
						Referer: normurl.replace(/\/([^/]+)\.[^/.]*$/, "/$1.html")
					},
					bad_if: [{
						headers: {
							"content-length": "281567",
							"last-modified": function(value) {
								if (/^Tue, 19 Nov 2019/i.test(value)) {
									return true;
								}

								return false;
							}
						}
					}]
				};

				if (url.match(/\/[^/]+[^-]-[0-9]+\.[^/.]+(?:[?#].*)?$/)) {
					obj.headers.Referer = normurl.replace(/\/([^/]+)\.[^/.]*$/, "/large-$1.html");
					obj.is_original = true;
				}

				obj.extra = {page: obj.headers.Referer};

				return obj;
			};

			newsrc = src.replace(/\/thumbnail\/+(.*?)(?:-preview)?(-[0-9]+)(?:\.t)?(\.[^/.]*)$/, "/$1-$2$3");
			if (newsrc !== src)
				return get_obj(newsrc);

			newsrc = src.replace(/--([0-9]+\.[^/.]*)$/, "-$1");
			if (newsrc !== src)
				return get_obj(newsrc);

			return get_obj(src);
		}

		if ((domain === "www.altcine.com" && string_indexof(src, "/photo/") >= 0) ||
			// http://gallery-cdn.tiscali.it/repository/1682/312x210/1681221.jpg
			//   http://gallery-cdn.tiscali.it/repository/1682/1681221.jpg
			domain === "gallery-cdn.tiscali.it" ||
			// http://img.amur.info/res/news/142058/660x440/ab12750a0d334659a7ac88b3cc341960.jpg
			//   http://img.amur.info/res/news/142058/ab12750a0d334659a7ac88b3cc341960.jpg
			(domain === "img.amur.info" && string_indexof(src, "/res/") >= 0) ||
			// http://thumbs.vaultsex.com/content/ftvcash/ftvgirls/2215/150x200/002.jpg
			//   http://thumbs.vaultsex.com/content/ftvcash/ftvgirls/2215/002.jpg
			(domain === "thumbs.vaultsex.com" && string_indexof(src, "/content/") >= 0) ||
			// http://dspdaily.com/data/news/1703/284x189/1994203259_5NO7uXb0_ECBAA1ECB2981.JPG
			//   http://dspdaily.com/data/news/1703/1994203259_5NO7uXb0_ECBAA1ECB2981.JPG
			(domain_nowww === "dspdaily.com" && string_indexof(src, "/data/") >= 0)) {
			// http://www.altcine.com/personsphoto/photo/205x205/Miljenovic_Dorde%20%20(Wikluh%20Sky).jpg
			//   http://www.altcine.com/personsphoto/photo/Miljenovic_Dorde%20%20(Wikluh%20Sky).jpg
			return src.replace(/\/[0-9]+x[0-9]+\/([^/]*)$/, "/$1");
		}

		if (domain_nowww === "spacetelescope.org" ||
			// https://cdn.spacetelescope.org/archives/images/news/heic1623a.jpg -- 180x180
			//   https://cdn.spacetelescope.org/archives/images/newsfeature/heic1623a.jpg
			//   https://cdn.spacetelescope.org/archives/images/thumb700x/heic1623a.jpg
			//   https://cdn.spacetelescope.org/archives/images/large/heic1623a.jpg -- 2667x2667
			domain === "cdn.spacetelescope.org" ||
			// https://esahubble.org/static/archives/images/mini/heic1501a.jpg
			//   https://esahubble.org/static/archives/images/medium/heic1501a.jpg
			//   https://esahubble.org/static/archives/images/large/heic1501a.jpg
			domain_nowww === "esahubble.org") {
			// http://www.spacetelescope.org/static/archives/images/medium/heic1501a.jpg
			//   http://www.spacetelescope.org/static/archives/images/large/heic1501a.jpg -- 6780x7071
			//return src.replace(/(\/static\/+archives\/+images\/+)(?:mini|medium)\//, "$1large/");
			return src.replace(/(\/archives\/+images\/+)[a-z]+(?:[0-9]+x)?(\/+[^/.]*\.[^/.]*)(?:[?#].*)?$/, "$1large$2")
		}

		if (domain === "static.qobuz.com") {
			// _max is also supported?
			// https://static.qobuz.com/images/covers/67/31/8606102083167_600.jpg
			//   https://static.qobuz.com/images/covers/67/31/8606102083167_org.jpg
			// thanks to anonymous for reporting:
			// https://static.qobuz.com/images/artists/covers/small/56250b422311b22e65d9d266bfc97fa0.jpg
			//   https://static.qobuz.com/images/artists/covers/large/56250b422311b22e65d9d266bfc97fa0.jpg
			return src
				.replace(/_[0-9]+(\.[^/.]*)$/, "_org$1")
				.replace(/(\/images\/+artists\/+covers\/+)(?:small|medium)\/+/, "$1large/");
		}

		if (domain_nowww === "sarajevo.travel") {
			// https://sarajevo.travel/assets/photos/events/small/tuborg-open-sara-jo-amp-sky-wikler-1503493807.jpg
			//   https://sarajevo.travel/assets//photos/events/medium/tuborg-open-sara-jo-amp-sky-wikler-1503493807.jpg
			//   https://sarajevo.travel/assets/photos/events/big/tuborg-open-sara-jo-amp-sky-wikler-1503493807.jpg
			//   https://www.sarajevo.travel/assets/photos/events/original/tuborg-open-sara-jo-amp-sky-wikler-1503493807.jpg
			return src.replace(/(\/assets\/+photos\/+[^/]+\/+)[a-z]+\/+([^/]+(?:[?#].*)?)$/, "$1original/$2");
		}

		if (domain === "avatars.mds.yandex.net" ||
			// https://avatars.yandex.net/get-music-content/113160/ad3c5bfa.p.3425928/m1000x1000?webp=false
			//   https://avatars.yandex.net/get-music-content/113160/ad3c5bfa.p.3425928/orig?webp=false
			domain === "avatars.yandex.net" ||
			// https://avatars.mds.yandex.net/get-zen_doc/198938/pub_5af84b497425f5fcbcde8785_5af84b6583090599f5aded49/scale_600
			//   https://avatars.mds.yandex.net/get-zen_doc/198938/pub_5af84b497425f5fcbcde8785_5af84b6583090599f5aded49/orig
			// https://avatars.mds.yandex.net/get-pdb/1209663/2630abaf-64c6-43d7-a92b-0bcf49b644b6/s1200?webp=false
			//   https://avatars.mds.yandex.net/get-pdb/1209663/2630abaf-64c6-43d7-a92b-0bcf49b644b6/orig?webp=false
			// https://avatars.mds.yandex.net/get-entity_search/122335/162789516/S76x101Face_2x
			//   https://avatars.mds.yandex.net/get-entity_search/122335/162789516/orig
			// https://avatars.mds.yandex.net/get-zen_doc/4756188/pub_6241ca3a3beafa65f0b4fe9c_6241ce2f47dc0e7df4426de5/smart_crop_516x290
			//   https://avatars.mds.yandex.net/get-zen_doc/4756188/pub_6241ca3a3beafa65f0b4fe9c_6241ce2f47dc0e7df4426de5/orig
			// https://avatars.mds.yandex.net/get-games/1890793/2a00000186a79f24ab81e36760f1f756b5d1/pjpg280x500
			//   https://avatars.mds.yandex.net/get-games/1890793/2a00000186a79f24ab81e36760f1f756b5d1/orig
			domain === "avatars.dzeninfra.ru") {
			// thanks to aslian on github: https://github.com/qsniyg/maxurl/issues/1070
			// https://avatars.dzeninfra.ru/get-zen_doc/135437/pub_5d02297793658100b1ada4e0_5d022fd9778de800b0d69901/scale_600
			//   https://avatars.dzeninfra.ru/get-zen_doc/135437/pub_5d02297793658100b1ada4e0_5d022fd9778de800b0d69901/orig
			// https://avatars.dzeninfra.ru/get-zen_doc/46847/pub_5accfec879885ebb4ce18e76_5accff227ddde8b6903295d8/scale_1200
			//   https://avatars.dzeninfra.ru/get-zen_doc/46847/pub_5accfec879885ebb4ce18e76_5accff227ddde8b6903295d8/orig
			obj = {
				url: src.replace(/\/(?:[a-z]+_(?:[a-z]+_)?|[a-zA-Z]|pjpg)?[0-9]+(?:x[0-9]+)?(?:[A-Za-z_0-9]+)([?&].*)?$/, "/orig$1")
			};

			match = src.match(/\/get-[^/]+\/+([0-9]+)\/+[^/]+\/+[^/]+(?:[?#].*)?$/);
			if (match)
				obj.filename = match[1];

			// thanks to anonymous for reporting:
			// https://avatars.mds.yandex.net/i?id=5ed9d8d0699affd48ceaa024c078d05ff33308a7-8710005-images-thumbs&n=13 -- 480x320
			// https://avatars.mds.yandex.net/i?id=1781fe4c4005b0dcd62a38a2ba808be7_l-5644655-images-thumbs&ref=rim&n=13&w=2507&h=1673 -- 2507x1673
			//   https://avatars.mds.yandex.net/i?id=1781fe4c4005b0dcd62a38a2ba808be7_l-5644655-images-thumbs&n=13 -- 2507x1673
			// https://avatars.mds.yandex.net/i?id=3a4386c4e122170fa579e8ca6c2332ed-4460407-images-taas-consumers&n=13 -- 2059x2912
			newsrc = src.replace(/(:\/\/[^/]+\/+i\?)(?:.*&)?id=([0-9a-f]{10,}[^&#]+)(?:[&#].*)?$/, "$1id=$2&n=13");
			if (newsrc !== src)
				return newsrc;

			return obj;
		}

		if (domain_nowww === "t2online.com") {
			// http://t2online.com/unsafe/s3.ap-south-1.amazonaws.com/cms-abp-prod-media/library/T2_ONLINE/image/2018/5/d67c356e-5ddb-4976-9dcc-877d30a1e4a1.jpg
			//   http://s3.ap-south-1.amazonaws.com/cms-abp-prod-media/library/T2_ONLINE/image/2018/5/d67c356e-5ddb-4976-9dcc-877d30a1e4a1.jpg
			return src.replace(/^[a-z]+:\/\/[^/]*\/unsafe\//, "http://");
		}

		if (domain_nowww === "filmnegah.com") {
			// http://filmnegah.com/Image/Resize?url=~%2FUploads%2FProduct323%2FDark.Knight.Rises.Poster.26.5.91.filmnegah.jpg&width=256
			//   http://www.filmnegah.com/Uploads/Product323/Dark.Knight.Rises.Poster.26.5.91.filmnegah.jpg
			// http://filmnegah.com/Image/Thumbnail?path=~%2FUploads%2FCelebrity%2FChristopher.Nolan.25.12.91.Filmnegah.jpg&width=64
			return decodeURIComponent(src.replace(/(:\/\/[^/]*)\/Image\/(?:Resize|Thumbnail).*?[?&](?:url|path)=~([^&]*).*?$/, "$1$2"));
		}

		if (domain_nowww === "niagara.sk" && string_indexof(src, "/images/") >= 0) {
			// https://www.niagara.sk/images/persons/tmb-100-147/christopher-nolan.jpg
			//   https://niagara.sk/images/persons/big/christopher-nolan.jpg
			return src.replace(/\/tmb-[0-9]+(?:-[0-9]+)\//, "/big/");
		}

		if (domain_nowww === "cdn-cinenode.com") {
			// https://www.cdn-cinenode.com/author_picture/73/christopher-nolan-73464-250-400.jpg
			//   https://www.cdn-cinenode.com/author_picture/73/full/christopher-nolan-73464.jpg
			return src.replace(/(\/[0-9]+\/)([^/]*)-[0-9]+-[0-9]+(\.[^/.]*)$/, "$1full/$2$3");
		}

		if (domain_nosub === "canalblog.com" && domain.match(/\.storage\.canalblog\.com$/)) {
			// http://p0.storage.canalblog.com/07/89/830600/116665408_m.jpg
			//   http://p0.storage.canalblog.com/07/89/830600/116665408.jpg
			//   http://p0.storage.canalblog.com/07/89/830600/116665408_o.jpg
			// http://p1.storage.canalblog.com/15/04/830600/116665417.to_resize_150x3000.png
			//   http://p1.storage.canalblog.com/15/04/830600/116665417_o.png
			return src
				.replace(/\.[^/]*(\.[^/.]*)$/, "$1")
				.replace(/(\/[0-9]+)(?:_[a-z])?(\.[^/.]*)$/, "$1_o$2");
		}

		if (domain_nowww === "film-like.com") {
			// http://film-like.com/images/film/thumb/2008/9908.jpg
			//   http://film-like.com/images/film/full/2008/9908.jpg
			return src.replace(/\/thumb\//, "/full/");
		}

		if (domain_nowww === "24smi.org" ||
			// https://24celebs.com/public/media/153x208/celebrity/2018/01/19/jeqaxjjiq5k5-adele-exarchopoulos.jpg
			//   https://24celebs.com/public/media/celebrity/2018/01/19/jeqaxjjiq5k5-adele-exarchopoulos.jpg
			domain_nowww === "24celebs.com") {
			// https://24smi.org/public/media/105x76/celebrity/2018/02/28/6gehfl9ng7ue-christopher-nolan.jpg
			//   https://24smi.org/public/media/celebrity/2018/02/28/6gehfl9ng7ue-christopher-nolan.jpg
			// https://24smi.org/adwiles2/img/200_150/0/c/0cab42e11498e98f9fb1df71669018a1.jpeg
			//   https://24smi.org/adwiles2/img/999999999_999999999/0/c/0cab42e11498e98f9fb1df71669018a1.jpeg
			// https://24smi.org/public/media/resize/800x-/2018/10/15/emma-watson-harry-potter-and-the-goblet-of-fire-2005.jpg
			//   https://24smi.org/public/media/2018/10/15/emma-watson-harry-potter-and-the-goblet-of-fire-2005.jpg

			return src
				.replace(/\/img\/+[0-9]+_[0-9]+\//, "/img/999999999_999999999/")
				.replace(/\/public\/+media\/+(?:resize\/+)?[-0-9]+x[-0-9]+\//, "/public/media/");
			//return src.replace(/\/public\/+media\/+resize\/+[-0-9]+x[-0-9]+\/+/, "/public/media/");
		}

		if (domain === "cdn.metrotvnews.com" ||
			// https://cdn.medcom.id/dynamic/content/2017/04/10/684188/Jw85BLIVDb.jpg?w=720
			domain === "cdn.medcom.id") {
			// http://cdn.metrotvnews.com/dynamic/content/2017/07/20/732264/aSnEGWRr16.jpg?w=200
			//   http://cdn.metrotvnews.com/dynamic/content/2017/07/20/732264/aSnEGWRr16.jpg?w=99999999999
			return src.replace(/\?.*/, "?w=99999999999");
		}

		if (domain_nowww === "znqnet.com" && string_indexof(src, "/fileupload/") >= 0) {
			// http://www.znqnet.com/fileupload/thumb/20150909/20150909104806_5775.jpg
			//   http://www.znqnet.com/fileupload/image/20150909/20150909104806_5775.jpg
			return src.replace(/\/fileupload\/thumb\//, "/fileupload/image/");
		}

		if (domain_nosub === "rpp-noticias.io" && domain.match(/[a-z]\.rpp-noticias\.io/)) {
			// http://e.rpp-noticias.io/small/2018/02/12/593459_564005.jpg -- 244x126
			//   http://f.rpp-noticias.io/2018/02/12/593459_564005.jpg -- 5200x2925
			return src.replace(/:\/\/e\.rpp-noticias\.io\/[a-z]+\//, "://f.rpp-noticias.io/");
		}

		if (false && domain_nosub === "diarioinformacion.com" && domain.match(/fotos[0-9]*\.diarioinformacion\.com/)) {
			// down, moved to informacion.es
			// https://fotos01.diarioinformacion.com/2017/12/11/328x206/archivosalida20170719194704.jpg
			//   https://fotos01.diarioinformacion.com/2017/12/11/archivosalida20170719194704.jpg
			return src.replace(/\/[0-9]+x[0-9]+\//, "/");
		}

		if (false && domain === "imagenes-cdn.diarioinformacion.com" && string_indexof(src, "/multimedia/fotos/") >= 0) {
			// down, moved to informacion.es
			// https://imagenes-cdn.diarioinformacion.com/multimedia/fotos/2013/02/20/48588/1361356702610-4_p.jpg
			//   https://imagenes-cdn.diarioinformacion.com/multimedia/fotos/2013/02/20/48588/1361356702610-4.jpg
			return src.replace(/_[a-z](\.[^/.]*)$/, "$1");
		}

		if (domain_nowww === "digi-film.ro") {
			// http://www.digi-film.ro/onedb/picture(width=200,crop=1)/56824f6695f9cfef07000000
			//   http://www.digi-film.ro/onedb/picture:56824f6695f9cfef07000000
			//   http://www.digi-film.ro/onedb/picture/56824f6695f9cfef07000000 -- redirected to:
			//     http://storage03dgf.rcs-rds.ro/storage/2015/12/29/545191_545191_nolan.jpg
			return src.replace(/\/onedb\/picture\([^/]*\//, "/onedb/picture/");
		}

		if (domain === "s.iw.ro") {
			// https://s.iw.ro/gateway/g/ZmlsZVNvdXJjZT1odHRwJTNBJTJGJTJG/c3RvcmFnZTAzZGdmLnJjcy1yZHMucm8l/MkZzdG9yYWdlJTJGMjAxOCUyRjAzJTJG/MDUlMkY4ODY0OTFfODg2NDkxX2x1cGl0/YV9ueW9uZ19vX29zY2FyLmpwZyZ3PTcw/MCZoYXNoPWVlYjNiNjFhNzU4NzBkNGNhYzI3NjU4YzYyMjU0YjNi.thumb.jpg -- 700x1049
			//   https://s.iw.ro/gateway/g/ZmlsZVNvdXJjZT1odHRwJTNBJTJGJTJG/c3RvcmFnZTAzZGdmLnJjcy1yZHMucm8l/MkZzdG9yYWdlJTJGMjAxOCUyRjAzJTJG/MDUlMkY4ODY0OTFfODg2NDkxX2x1cGl0/YV9ueW9uZ19vX29zY2FyLmpwZyZ3PTcw/MCZoYXNoPWVlYjNiNjFhNzU4NzBkNGNhYzI3NjU4YzYyMjU0YjNi.jpg -- 3446x5168
			newsrc = src.replace(/\.thumb(\.[^/.]+)([?#].*)?$/, "$1$2");
			if (newsrc !== src)
				return newsrc;

			// https://s.iw.ro/gateway/g/ZmlsZVNvdXJjZT1odHRwJTNBJTJGJTJG/c3RvcmFnZWZpbG1ub3cucmNzLXJkcy5y/byUyRnN0b3JhZ2UlMkYyMDE5JTJGMDcl/MkYwMSUyRjEwODkxMjlfMTA4OTEyOV93/aW4tYS1kYXRlLXdpdGgtdGFkLXBvc3Rl/ci5qcGcmdz0xODAmaD0yNjAmaGFzaD01/N2FlMmNiYTc2ZDk1MDIzNWQ4NjM2ZjMxNGZjNDA4NQ==.jpg?tmp=2019-08-23-20-10-50&app=req-5d601e1a96ac4&retry=2
			//   endstr: fileSource=http%3A%2F%2Fstoragefilmnow.rcs-rds.ro%2Fstorage%2F2019%2F07%2F01%2F1089129_1089129_win-a-date-with-tad-poster.jpg&w=180&h=260&hash=57ae2cba76d950235d8636f314fc4085
			//   http://storagefilmnow.rcs-rds.ro/storage/2019/07/01/1089129_1089129_win-a-date-with-tad-poster.jpg
			match = src.match(/\/gateway\/+g\/+(([^/.?]{32}\/+){1,}[^/.]*\.[^/.?#]*)/);
			if (match) {
				var splittedhex = match[1].replace(/\/+/g, "/").replace(/\..*/, "").split("/");
				var endstr = "";
				for (let i = 0; i < splittedhex.length; i++) {
					endstr += base64_decode(splittedhex[i]);
				}

				newsrc = endstr.replace(/^(?:.*&)?fileSource=([^&]*).*?$/, "$1");
				if (newsrc !== src)
					return decodeURIComponent(newsrc);
			}
		}

		if (domain_nosub === "jiemian.com" && domain.match(/img[0-9]*\.jiemian\.com/)) {
			// http://img2.jiemian.com/101/original/20170902/15043383837444100_a580xH.jpg
			//   http://img2.jiemian.com/101/original/20170902/15043383837444100.jpg
			return src.replace(/\/([0-9]+)_[a-zA-Z0-9]+x[a-zA-Z0-9]+(\.[^/.]*)$/, "/$1$2");
		}

		if (domain === "cdn.highdefdigest.com") {
			// https://cdn.highdefdigest.com/uploads/2017/11/20/660/nolan.jpg
			//   https://cdn.highdefdigest.com/uploads/2017/11/20/nolan.jpg
			return src.replace(/(\/uploads\/[0-9]+\/[0-9]+\/[0-9]+\/)[0-9]+\/([^/]*)$/, "$1$2");
		}

		if (domain_nowww === "ojosdecafe.com") {
			// http://ojosdecafe.com/img/upload/thumbs/750x450_christopher-nolan-dunkirk.jpg
			//   http://www.ojosdecafe.com/img/upload/christopher-nolan-dunkirk.jpg
			return src.replace(/\/thumbs\/[0-9]+x[0-9]+_/, "/");
		}

		if (domain === "img.gestion.pe" ||
			// http://www.multimedios.com/files/og_thumbnail/uploads/2017/09/04/59ad996ab60d9.jpeg
			//   http://www.multimedios.com/uploads/2017/09/04/59ad996ab60d9.jpeg
			domain_nowww === "multimedios.com" ||
			// https://imagenes.heraldo.es/files/image_150_v3/uploads/imagenes/2020/11/12/anya-taylor-joy-como-la-genia-del-ajedrez-beth-harmon-en-la-serie-gambito-de-dama.png
			//   https://imagenes.heraldo.es/uploads/imagenes/2020/11/12/anya-taylor-joy-como-la-genia-del-ajedrez-beth-harmon-en-la-serie-gambito-de-dama.png
			domain === "imagenes.heraldo.es" ||
			// thanks to sn3akyb3ar on github: https://github.com/qsniyg/maxurl/issues/1326
			// https://www.lavanguardia.com/files/content_image_desktop_filter/uploads/2020/11/27/5fc037b9cc702.jpeg
			//   https://www.lavanguardia.com/uploads/2020/11/27/5fc037b9cc702.jpeg
			domain_nowww === "lavanguardia.com") {
			// https://img.gestion.pe/files/ec_article_multimedia_gallery/uploads/2017/11/08/5a03a7dc67e6a.jpeg -- stretched
			//   https://img.gestion.pe/uploads/2017/11/08/5a03a7dc67e6a.jpeg
			return src.replace(/\/files\/+[^/]+\/+uploads\//, "/uploads/");
			//return src.replace(/(:\/\/[^/]*\/)files\/[^/]*\/uploads\//, "$1uploads/");
			//return src.replace(/\/files\/+image_[^/]+\/+(uploads\/+imagenes\/+)/, "/$1");
		}

		if (domain === "imagenes.cronica.com.mx" ||
			// https://imghandler.cronica.com.mx/files/image_948_465/files/fp/uploads/2024/05/04/6636c21b5dafb.jpeg
			//   https://imagenes.cronica.com.mx/uploads/2024/05/04/6636c21b5dafb.jpeg
			domain === "imghandler.cronica.com.mx") {
			// thanks to sn3akyb3ar on github: https://github.com/qsniyg/maxurl/issues/1321
			// https://imagenes.cronica.com.mx/files/image_948_465/files/fp/uploads/2024/05/04/6636c21b5dafb.r_d.974-506-4938.jpeg
			//   https://imagenes.cronica.com.mx/files/image_948_465/files/fp/uploads/2024/05/04/6636c21b5dafb.jpeg
			//   https://imagenes.cronica.com.mx/uploads/2024/05/04/6636c21b5dafb.jpeg
			// https://imagenes.cronica.com.mx/files/content_image_desktop_filter/uploads/2024/05/04/6636c5b6a654c.jpeg
			//   https://imagenes.cronica.com.mx/uploads/2024/05/04/6636c5b6a654c.jpeg
			return src
				.replace(/:\/\/[^/]+\/+.*?\/(uploads\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9a-f]{5,}\.[a-z]+)(?:[?#].*)?/, "://imagenes.cronica.com.mx/$1")
				.replace(/(\/uploads\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9a-f]{5,}\.)[^/?#]+\.([a-z]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "thumb.guucdn.net") {
			// https://thumb.guucdn.net/400x225/images.guucdn.net/full/2018/05/29/7426c2a3bfc916d4cad3b9e921b604087c246dfa.jpg
			//   https://images.guucdn.net/full/2018/05/29/7426c2a3bfc916d4cad3b9e921b604087c246dfa.jpg
			return src.replace(/:\/\/[^/]*\/[0-9]+x[0-9]+\//, "://");
		}

		if ((domain_nowww === "game4v.com" && string_indexof(src, "/thumb/thumb.php?") >= 0) ||
			// http://static.pinwallpapers.com/thumb.php?src=http://static.pinwallpapers.com/anime/anime-wallpapers/anime-wallpaper-1237412.jpg&w=640&h=360
			//   http://static.pinwallpapers.com/anime/anime-wallpapers/anime-wallpaper-1237412.jpg
			domain === "static.pinwallpapers.com") {
			// http://game4v.com/thumb/thumb.php?w=560&src=http%3A%2F%2Fcdn2.game4v.com%2F2014%2F10%2Fphong-than-di-tuong-2.jpg
			//   http://cdn2.game4v.com/2014/10/phong-than-di-tuong-2.jpg
			newsrc = src.replace(/.*?\/thumb\.php.*?[?&]src=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nowww === "newpal.ps" ||
			// https://iravunk.com/thumb.php?src=/frontend/web/uploads/32663.png&h=130&w=200
			//   https://iravunk.com/frontend/web/uploads/32663.png
			domain_nosub === "iravunk.com" ||
			// http://www.mrcapetown.co.za/wp-content/themes/editorial/functions/thumb.php?src=wp-content/uploads/2010/08/megan-fox-transformers.jpg&w=606&h=0&zc=1&q=90
			//   http://www.mrcapetown.co.za/wp-content/uploads/2010/08/megan-fox-transformers.jpg
			(domain_nowww === "mrcapetown.co.za" && src.match(/\/wp-content\/.*\/functions\/+thumb\.php/)) ||
			// https://vtimes.com.au/thumb.php?w=225&h=150&q=85&a=t&src=/up/images/08-17/2739096-emma-stone-co-muc-thu-lao-0.jpg
			//   https://vtimes.com.au/up/images/08-17/2739096-emma-stone-co-muc-thu-lao-0.jpg
			domain_nowww === "vtimes.com.au" ||
			// http://pardisgame.net/thumb.php?src=images/uploads/PBC38QTQBL.jpg&w=150&q=90&iar=1
			//   http://pardisgame.net/images/uploads/PBC38QTQBL.jpg
			domain_nowww === "pardisgame.net") {
			// http://newpal.ps/thumb.php?src=uploads//images/c0b239c0c38317c621e9f2e0f45a80ac.jpg&w=500&zc=1
			//   http://newpal.ps/uploads//images/c0b239c0c38317c621e9f2e0f45a80ac.jpg
			newsrc = decodeURIComponent(src.replace(/.*?\/thumb\.php.*?[?&]src=([^&]*).*?$/, "$1"));
			if (newsrc !== src) {
				if (newsrc.match(/^[a-z]+:\/\//))
					return newsrc;
				else
					return urljoin(src, ("/" + newsrc).replace(/^\/\//, "/"), true);
			}
		}

		if (domain === "static.santruyen.com") {
			// http://static.santruyen.com/medias/covers/49/49367_cover.jpg
			//   http://static.santruyen.com/medias/covers/49/49367_large.jpg
			//   http://static.santruyen.com/medias/covers/49/49367.jpg
			// http://static.santruyen.com/medias/covers/75/75215_thumbnail.jpg
			//   http://static.santruyen.com/medias/covers/75/75215.jpg
			return src.replace(/(\/[0-9]+)_[a-z]+(\.[^/.]*)$/, "$1$2");
		}

		if (amazon_container === "boligsurf-production" &&
			string_indexof(src, "/assets/images/") >= 0) {
			// https://s3.eu-central-1.amazonaws.com/boligsurf-production/assets/images/005/979/084/fixed_500_400/e9f400a3478f97092c7456b9836ea888b367c857.jpg
			//   https://s3.eu-central-1.amazonaws.com/boligsurf-production/assets/images/005/979/084/original/e9f400a3478f97092c7456b9836ea888b367c857.jpg
			return src.replace(/\/fixed_[0-9]+_[0-9]+\//, "/original/");
		}

		if (domain_nowww === "sonara.net") {
			// http://sonara.net/cro.php?width=108&height=80&cropratio=108:80&image=%2F20180610-1331171884648120.jpg
			//   http://images.sonara.net/20180610-1331171884648120.jpg
			return decodeURIComponent(src.replace(/:\/\/[^/]*\/cro\.php.*?[?&]image=([^&]*).*?$/, "://images.sonara.net$1"));
		}

		if (domain === "d2u7zfhzkfu65k.cloudfront.net" &&
			string_indexof(src, "/resize/wp-content/") >= 0) {
			// https://d2u7zfhzkfu65k.cloudfront.net/resize/wp-content/uploads/2018/5/8/15/f21a56c81474b277e24bca7575e94dc7.jpg?w=70&q=85
			//   https://d3kszy5ca3yqvh.cloudfront.net/wp-content/uploads/2018/5/8/15/f21a56c81474b277e24bca7575e94dc7.jpg
			return src.replace(/:\/\/[^/]+\/+resize\//, "://d3kszy5ca3yqvh.cloudfront.net/");
		}

		if (domain === "imgbp.hotp.jp") {
			// https://imgbp.hotp.jp/CSP/IMG_SRC/60/26/B011156026/B011156026_271-361.jpg
			//   https://imgbp.hotp.jp/CSP/IMG_SRC/60/26/B011156026/B011156026.jpg
			return src.replace(/_[0-9]+-[0-9]+(\.[^/.]*)$/, "$1");
		}

		if (domain === "review.zafcdn.com") {
			// https://review.zafcdn.com/upload/zaful/review/20190808/C371FD50B19603DE896AD1C0A1CD3366_640-640.jpg
			//   https://review.zafcdn.com/upload/zaful/review/20190808/C371FD50B19603DE896AD1C0A1CD3366.jpg
			// https://review.zafcdn.com/upload/zaful/review/20190623/thumb/52E3CDB0D3DECA880F5C9923F66E822A_thumb.jpg
			//   https://review.zafcdn.com/upload/zaful/review/20190623/52E3CDB0D3DECA880F5C9923F66E822A.jpg
			return src.replace(/(\/upload\/+zaful\/+review\/+[0-9]{8}\/+)(?:thumb\/+)?([0-9A-F]{10,})_(?:[0-9]+-[0-9]+|thumb)(\.[^/.]*)(?:[?#].*)?$/,
							"$1$2$3");
		}

		if (amazon_container === "ro69-bucket") {
			// https://ro69-bucket.s3.amazonaws.com/uploads/text_image/image/298198/200x200/resize_image.jpg
			//   https://ro69-bucket.s3.amazonaws.com/uploads/text_image/image/298198/default/resize_image.jpg
			// https://rockinon.com/images/entry/width:750/137595/1
			//   https://ro69-bucket.s3.amazonaws.com/uploads/text_image/image/206532/width:750/resize_image.gif
			//   https://ro69-bucket.s3.amazonaws.com/uploads/text_image/image/206532/default/resize_image.gif
			// doesn't work for all:
			// https://rockinon.com/images/entry/width:750/127272/2
			//   https://ro69-bucket.s3.amazonaws.com/uploads/text_image/image/183260/width:750/resize_image.jpg
			// https://ro69-bucket.s3.amazonaws.com/uploads/text_image/image/322150/width:750/resize_image.png
			//   https://ro69-bucket.s3.amazonaws.com/uploads/text_image/image/322150/default/resize_image.png -- doesn't work (403)
			//   https://ro69-bucket.s3.amazonaws.com/uploads/text_image/image/322150/default/resize_image.jpg -- doesn't work either
			//   https://ro69-bucket.s3.amazonaws.com/uploads/text_image/image/322543/default/resize_image.jpg -- works
			// thanks to nimbuz on discord for reporting:
			// https://ro69-bucket.s3.amazonaws.com/uploads/artist_image/image/3471/width:600/resize_image.jpg
			//   https://ro69-bucket.s3.amazonaws.com/uploads/artist_image/image/3471/default/resize_image.jpg -- 403
			return src.replace(/(\/image\/[0-9]+\/)[^/]*\/resize_image/, "$1default/resize_image");
		}

		if (domain === "aimg-pictpix.akamaized.net") {
			// https://aimg-pictpix.akamaized.net/ts600x1/img/pictpix/25/74/04eeb5c81734927eb81cefb1d90e26aa8a340e0b.png
			//   https://aimg-pictpix.akamaized.net/img/pictpix/25/74/04eeb5c81734927eb81cefb1d90e26aa8a340e0b.png
			return src.replace(/(:\/\/[^/]*\/)ts[0-9]+x[0-9]+\/img\//, "$1img/");
		}

		if (amazon_container === "lattepic") {
			// https://lattepic.s3.amazonaws.com/column_bq/pn/fy/5s/n6/km/le/ub/le/tj/5o/wu/hr/u2/5s/xu_medium.png
			//   https://lattepic.s3.amazonaws.com/column_bq/pn/fy/5s/n6/km/le/ub/le/tj/5o/wu/hr/u2/5s/xu_org.png
			// https://lattepic.s3.amazonaws.com/column_pe/qo/iv/g3/lm/e3/6f/e7/q5/lb/b4/jf/rl/xw/ir/fl_square.png
			//   https://lattepic.s3.amazonaws.com/column_pe/qo/iv/g3/lm/e3/6f/e7/q5/lb/b4/jf/rl/xw/ir/fl_org.png
			//
			// https://latte.la/hair/style/10078
			// https://lattepic.s3.amazonaws.com/column_xn/ab/r5/hx/ib/zf/bt/r3/64/73/cn/sy/r2/xz/46/pg_org.png
			//   https://lattepic.s3.amazonaws.com/p_df/v2/3o/6q/kc/4c/ir/cu/4u/ao/un/rj/cy/g3/ev/cr_medium.jpeg?Signature=H6SKvjkyvvSS1bSCJ49ShC4NRG8%3D&Expires=2115594061&AWSAccessKeyId=AKIAIZXE7EOD2KQP55NQ&0
			//   https://lattepic.s3.amazonaws.com/p_df/v2/3o/6q/kc/4c/ir/cu/4u/ao/un/rj/cy/g3/ev/cr_real.jpeg?Signature=MfqquzcPlhIgA%2BM7tkiLegptfHY%3D&Expires=2115594061&AWSAccessKeyId=AKIAIZXE7EOD2KQP55NQ&0
			// doesn't work:
			// https://lattepic.s3.amazonaws.com/p_h3/3n/fe/k2/o5/ts/xf/d4/cc/fz/lb/b3/j6/f7/it/h2_square.jpeg?Signature=YHzaFGZAIkDlez6vmTfRA2KmKjU%3D&Expires=2115594061&AWSAccessKeyId=AKIAIZXE7EOD2KQP55NQ&0 -- signature cannot be removed
			return src.replace(/(\/[a-z]+_)[a-z]+(\.[^/.?]*)$/, "$1org$2");
		}

		if (domain === "coconala.akamaized.net") {
			// https://coconala.akamaized.net/coconala-public-files/service_images/132x132/2da9fdc5-657054.png
			//   https://coconala.akamaized.net/coconala-public-files/service_images/original/2da9fdc5-657054.png -- forces download
			return src.replace(/\/service_images\/[0-9]+x[0-9]+\//, "/service_images/original/");
		}

		if (domain === "dplhqivlpbfks.cloudfront.net") {
			// https://dplhqivlpbfks.cloudfront.net/box_resize/1220x1240/2da9fdc5-657054.png
			//   https://coconala.akamaized.net/coconala-public-files/service_images/original/2da9fdc5-657054.png
			return src.replace(/.*(\/[0-9a-f]+-[0-9]+\.[^/.]*)$/, "https://coconala.akamaized.net/coconala-public-files/service_images/original$1");
		}

		if (domain_nowww === "ysbnow.com") {
			// http://www.ysbnow.com/dam?media-id=599db1edd74440326c7d50ce&width=800
			//   http://www.ysbnow.com/dam?media-id=599db1edd74440326c7d50ce -- 4608x2592
			return src.replace(/(:\/\/[^/]*\/dam).*?[?&](media-id=[^&]*).*?$/, "$1?$2");
		}

		if (domain_nowww === "quizz.biz") {
			// https://www.quizz.biz/uploads/quizz/962477/mini/1_1.jpg?1479738849
			//   https://www.quizz.biz/uploads/quizz/962477/orig/1.jpg?1479738849
			return src.replace(/(\/uploads\/+quizz\/+[0-9]+\/+)[a-z]+(\/+[0-9]+)(?:_[0-9]+)?(\.[^/.]*)(?:[?#].*)?$/,"$1orig$2$3");
		}

		if (domain_nosub === "flipagramcdn.com" && domain.match(/c[0-9]*\.flipagramcdn\.com/)) {
			// https://c1.flipagramcdn.com/d30faeccb979f31d8eea6dd8ad649ddf691b6662_1865984247_1426694464742-small
			//   https://c1.flipagramcdn.com/d30faeccb979f31d8eea6dd8ad649ddf691b6662_1865984247_1426694464742-large?
			//   https://c1.flipagramcdn.com/d30faeccb979f31d8eea6dd8ad649ddf691b6662_1865984247_1426694464742
			return src.replace(/-[a-z]+(?:\?.*)?$/, "");
		}

		if (domain === "images-cdn.9gag.com" ||
			domain === "img-9gag-fun.9cache.com" ||
			// http://d24w6bsrhbeh9d.cloudfront.net/photo/361626_460s.jpg
			//   http://d24w6bsrhbeh9d.cloudfront.net/photo/361626_700b.jpg -- redirects to:
			//   https://img-9gag-fun.9cache.com/photo/361626_700b.jpg
			domain === "d24w6bsrhbeh9d.cloudfront.net" ||
			domain === "miscmedia-9gag-fun.9cache.com") {
			// https://images-cdn.9gag.com/photo/aL2j4BM_460s_v1.jpg
			//   https://images-cdn.9gag.com/photo/aL2j4BM_700b_v1.jpg
			// https://images-cdn.9gag.com/photo/aVXP7Yy_460s.jpg
			//   https://images-cdn.9gag.com/photo/aVXP7Yy_700b.jpg
			// https://images-cdn.9gag.com/photo/a0br3MZ_460s.jpg
			//   https://images-cdn.9gag.com/photo/a0br3MZ_700b.jpg
			// https://img-9gag-fun.9cache.com/photo/a3KW8w7_460swp.webp
			//   https://img-9gag-fun.9cache.com/photo/a3KW8w7_700bwp.webp
			// https://miscmedia-9gag-fun.9cache.com/images/thumbnail-facebook/1482203076.0883_u8yQU9_100x100.jpg
			//   https://miscmedia-9gag-fun.9cache.com/images/thumbnail-facebook/1482203076.0883_u8yQU9_n.jpg
			return src
				.replace(/\/thumbnail-facebook\/([^/]*)_[0-9]+x[0-9]+(\.[^/.]*)$/, "/thumbnail-facebook/$1_n$2")
				.replace(/_460swp(\.[^/.]*)$/, "_700bwp$1")
				.replace(/_460s(_v1)?(\.[^/.]*)$/, "_700b$1$2");
		}

		if (domain_nowww === "samironsheadshots.com" &&
			string_indexof(src, "/images/") >= 0) {
			// http://samironsheadshots.com/images/pages/small/1510138983.jpg
			//   http://samironsheadshots.com/images/pages/large/1510138983.jpg
			return src.replace(/\/small\/([^/]*)$/, "/large/$1");
		}

		if (domain === "cps-static.rovicorp.com") {
			// https://cps-static.rovicorp.com/2/Open/20th_Century_Fox_39/Program/22067798/_derived_jpg_q90_250x0_m0/walking%20with%20the%20enemy_PA.jpg?partner=allrovi.com
			//   https://cps-static.rovicorp.com/2/Open/20th_Century_Fox_39/Program/22067798/walking%20with%20the%20enemy_PA.jpg?partner=allrovi.com
			// https://cps-static.rovicorp.com/3/JPG_100/MI0001/535/MI0001535799.jpg?partner=allrovi.com
			//   https://cps-static.rovicorp.com/3/JPG_SRC/MI0001/535/MI0001535799.jpg?partner=allrovi.com
			// thanks to nimuxoha on github: https://github.com/qsniyg/maxurl/issues/279
			// https://cps-static.rovicorp.com/3/JPG_500/MI0001/754/MI0001754760.jpg?partner=allrovi.com
			//   https://cps-static.rovicorp.com/3/JPG_SRC/MI0001/754/MI0001754760.jpg?partner=allrovi.com
			return src
				.replace(/\/_derived_[^/]*(\/[^/]*)$/, "$1")
				.replace(/\/JPG_[0-9]+\//, "/JPG_SRC/");
		}

		if (domain === "rovimusic.rovicorp.com") {
			// thanks to nimuxoha on github: https://github.com/qsniyg/maxurl/issues/279
			// https://rovimusic.rovicorp.com/image.jpg?c=yYHZyRxSklE9doh5teJWQh_TZlp6n_cq-Emr2zx15tU=&f=5
			//   https://rovimusic.rovicorp.com/image.jpg?c=yYHZyRxSklE9doh5teJWQh_TZlp6n_cq-Emr2zx15tU=&f=0 -- 1408x1386
			// 1 = 75, 2 = 170, 3 = 250, 4 = 400, 5 = 500, 6 = 1080, 0 = full
			if (/[?&]c=[^&]{10,}/.test(src)) {
				var queries = get_queries(src);
				newsrc = src.replace(/\?.*/, "?c=" + queries.c + "&f=0");
				if (newsrc !== src)
					return newsrc;
			}
		}

		if (domain_nosub === "netflixmovies.com" && domain.match(/i[0-9]*\.netflixmovies\.com/)) {
			// https://i1.netflixmovies.com/dibsl9ebc/image/upload/w_1024/mijahb8dbg5qdkxurlwh.jpg
			//   https://i1.netflixmovies.com/dibsl9ebc/image/upload/mijahb8dbg5qdkxurlwh.jpg
			return src.replace(/\/image\/upload\/[wh]_[0-9]+\//, "/image/upload/");
		}

		if (domain_nowww === "shakespearesglobe.com") {
			// http://www.shakespearesglobe.com/images/8610/normal
			//   http://www.shakespearesglobe.com/images/8610
			return src.replace(/(\/images\/[0-9]+)\/[a-z]+(?:\?.*)?$/, "$1");
		}

		if (domain_nosub === "rsc.org.uk" && domain.match(/cdn[0-9]*\.rsc\.org\.uk/)) {
			// https://cdn2.rsc.org.uk/sitefinity/images/productions/2017-shows/Titus-Andronicus/b7452-titus_review_web-amp-social_images_social-amp-hub.tmb-img-820.jpg?sfvrsn=1
			//   https://cdn2.rsc.org.uk/sitefinity/images/productions/2017-shows/Titus-Andronicus/b7452-titus_review_web-amp-social_images_social-amp-hub.jpg?sfvrsn=1
			return src.replace(/\.tmb-img-[0-9]*\./, ".");
		}

		if (domain === "images.fashionmodeldirectory.com") {
			// http://images.fashionmodeldirectory.com/model/000000592070-hanne_linhares-squaresmall.jpg
			//   http://images.fashionmodeldirectory.com/model/000000592070-hanne_linhares-fullsize.jpg
			// https://images.fashionmodeldirectory.com/images/magazines/covers/1599/cosmopolitan-china-2014-july-02-single.jpg
			//   https://images.fashionmodeldirectory.com/images/magazines/covers/1599/cosmopolitan-china-2014-july-02-fullsize.jpg
			// https://images.fashionmodeldirectory.com/model/000000351560-camille_neviere-fit.jpg
			//   https://images.fashionmodeldirectory.com/model/000000351560-camille_neviere-fullsize.jpg
			// https://images.fashionmodeldirectory.com/images/editorials/53541/53541-1132-21095-22261-squaremedium.jpg
			//   https://images.fashionmodeldirectory.com/images/editorials/53541/53541-1132-21095-22261-fullsize.jpg
			// https://images.fashionmodeldirectory.com/model/000000521628-elise_aarnink-modelprofileMainPicCropped.jpg
			//   https://images.fashionmodeldirectory.com/model/000000521628-elise_aarnink-fullsize.jpg
			// https://images.fashionmodeldirectory.com/images/magazines/covers/164/glamour-usa-2019-september-01-profile.jpg
			//   https://images.fashionmodeldirectory.com/images/magazines/covers/164/glamour-usa-2019-september-01-fullsize.jpg
			// https://images.fashionmodeldirectory.com/model/000000059279-lyndall_jarvis-alternative.jpg
			//   https://images.fashionmodeldirectory.com/model/000000059279-lyndall_jarvis-fullsize.jpg
			// doesn't work:
			// https://images.fashionmodeldirectory.com/images/designers/zac-posen_1029-profile.jpg
			//   https://images.fashionmodeldirectory.com/images/designers/zac-posen_1029-fullsize.jpg -- doesn't work
			// https://images.fashionmodeldirectory.com/images/designers/xavier-delcour_1019-profile.jpg -- fullsize doesn't work either
			return src.replace(/-(?:square(?:small|medium)|single|fit|modelprofile[A-Za-z]+|profile|alternative)(\.[^/.]*)$/, "-fullsize$1");
		}

		if (domain === "cdn.public.hegre.com" ||
			// https://p.hegre.com/models/veronika-v/veronika-v-poster-image-240x.jpg?v=1525111814
			//   https://p.hegre.com/models/veronika-v/veronika-v-poster-image-1024x_2x.jpg?v=1525111814
			//   https://p.hegre.com/models/veronika-v/veronika-v-poster-image-fullsize.jpg?v=1525111814
			domain === "p.hegre.com") {
			// http://cdn.public.hegre.com/static-artworks/mr-right-banner-square/mr-right-banner-square-content-image-480x.jpg?v=1541624121
			//   http://cdn.public.hegre.com/static-artworks/mr-right-banner-square/mr-right-banner-square-content-image-fullsize.jpg?v=1541624121
			newsrc = src.replace(/-image-[0-9]+x(?:_2x)?(\.[^/.]*)(?:[?#].*)?$/, "-image-fullsize$1");
			if (newsrc !== src)
				return newsrc;

			// https://p.hegre.com/films/go-west-young-girl/11/go-west-young-girl-11-320x.jpg?v=1577798194
			//   https://p.hegre.com/films/go-west-young-girl/11/go-west-young-girl-11-640x.jpg?v=1577798194
			//   https://p.hegre.com/films/go-west-young-girl/11/go-west-young-girl-11-2000x2000.jpg?v=1577798194
			//   https://p.hegre.com/films/go-west-young-girl/11/go-west-young-girl-11.jpg?v=1577798194 -- 3840x2160
			newsrc = src.replace(/(\/films\/+[^/]+\/+[0-9]+\/+[^/]+)-[0-9]*x[0-9]*\./, "$1.");
			if (newsrc !== src)
				return newsrc;

			// https://p.hegre.com/films/go-west-young-girl/go-west-young-girl-trailer-720p.mp4?v=1577722566
			//   https://p.hegre.com/films/go-west-young-girl/go-west-young-girl-trailer-2160p.mp4?v=1577722566
			var sizes = [
				"2160p",
				"1080p",
				"720p",
				"480p"
			];

			match = src.match(/\/films\/+[^/]+\/+[^/]+-([0-9]+p)\.mp4/);
			if (match && array_indexof(sizes, match[1]) > 0) {
				sizes = sizes.slice(0, array_indexof(sizes, match[1]));

				var urls = [];
				for (let i = 0; i < sizes.length; i++) {
					urls.push({
						url: src.replace(/(\/films\/+[^/]+\/+[^/]+-)[0-9]+p\./, "$1" + sizes[i] + "."),
						video: true
					});
				}

				return urls;
			}
		}

		if (domain === "storage.hegre.com") {
			return src.replace(/(\/img\/+gallery-[0-9]+-)thumb(-[0-9]+\.[^/.]+)(?:[?#].*)?$/, "$1image$2");
		}

		if ((domain_nowww === "skinnygossip.com" ||
			 // https://www.alternatehistory.com/forum/proxy.php?image=http%3A%2F%2Fipravda.sk%2Fres%2F2008%2F12%2F11%2Fthumbs%2F117664-viktor-dvorcak-nestandard2.jpg&hash=7cb6345bce0733d1c6d28d1a25a7e61f
			 //   http://ipravda.sk/res/2008/12/11/thumbs/117664-viktor-dvorcak-nestandard2.jpg
			 domain_nowww === "alternatehistory.com" ||
			 // https://www.gtplanet.net/forum/proxy.php?image=http%3A%2F%2Fipravda.sk%2Fres%2F2016%2F07%2F06%2Fthumbs%2Frenault-megane-grandtour-2016_08-nestandard2.jpg&hash=66af97d137b15a8c3abbd0b7ea2e3b62
			 domain_nowww === "gtplanet.net" ||
			 // https://www.burbuja.info/inmobiliaria/proxy.php?image=http%3A%2F%2Fwww.olympine.com%2Folympine%2Fwp-content%2Fuploads%2F2017%2F06%2Fselena-gomez-seins-nus-juin-2017-02.jpg&hash=fd8f9b3159d623ce0ff64664ba1de47d
			 //   http://www.olympine.com/olympine/wp-content/uploads/2017/06/selena-gomez-seins-nus-juin-2017-02.jpg
			 domain_nowww === "burbuja.info" ||
			 // https://www.kadinlarkulubu.com/forum/proxy.php?image=http%3A%2F%2Fmedia-cache-ak0.pinimg.com%2F736x%2Ffb%2Fc6%2F9e%2Ffbc69eb3d8a79379e81399ca94d410d2.jpg&hash=6225d5cf90f3da41a4557d930e21330e
			 //   https://i.pinimg.com/originals/fb/c6/9e/fbc69eb3d8a79379e81399ca94d410d2.jpg
			 domain_nowww === "kadinlarkulubu.com" ||
			 // https://www.arrse.co.uk/community/proxy.php?image=https%3A%2F%2Fencrypted-tbn0.gstatic.com%2Fimages%3Fq%3Dtbn%3AANd9GcQ00K1p5efcjLiUUeCscJEu_w90plhcQSdU6MtDEiOI5QKjcrhC&hash=8b2a01817b67daf880b8f9d53c2d7d61
			 //   https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQ00K1p5efcjLiUUeCscJEu_w90plhcQSdU6MtDEiOI5QKjcrhC
			 domain_nowww === "arrse.co.uk") &&
			string_indexof(src, "/proxy.php?") >= 0) {
			// https://www.skinnygossip.com/community/proxy.php?image=https%3A%2F%2Fwww.bellazon.com%2Fmain%2Fuploads%2Fmonthly_2017_11%2FGettyImages-876162714.jpg.6f0a67f5cb65d76069675b15e20ec73d.jpg&hash=087ffa4418cc3312b384c32dc19b765a
			//   https://www.bellazon.com/main/uploads/monthly_2017_11/GettyImages-876162714.jpg.6f0a67f5cb65d76069675b15e20ec73d.jpg
			return decodeURIComponent(src.replace(/.*?\/proxy\.php.*?[?&]image=([^&]*).*?$/, "$1"));
		}

		if (domain === "usa-grlk5lagedl.stackpathdns.com") {
			// http://usa-grlk5lagedl.stackpathdns.com/production/usa/images/1514913960191591-Rihanna.tif?w=1920&amp;h=800&amp;fit=crop&amp;crop=faces&amp;fm=pjpg&amp;auto=compress
			return src.replace(/(\/images\/[^/]*)\?.*$/, "$1?fm=pjpg");
		}

		if (domain === "static.sify.com") {
			// http://static.sify.com/cms/image/rh1m7Deiccjhi_thumb.jpg
			//   http://static.sify.com/cms/image/rh1m7Deiccjhi_small.jpg
			//   http://static.sify.com/cms/image/rh1m7Deiccjhi_medium.jpg
			//   http://static.sify.com/cms/image/rh1m7Deiccjhi_big.jpg
			//   http://static.sify.com/cms/image/rh1m7Deiccjhi.jpg
			return src.replace(/(\/cms\/image\/[^/]*)_[a-z]+(\.[^/.]*)$/, "$1$2");
		}

		if (domain_nowww === "wikifeet.com") {
			// https://www.wikifeet.com/profiles/78610.jpg?32
			//   https://www.wikifeet.com/profiles/78610_fs.jpg?32
			return src.replace(/(\/profiles\/+[0-9]+)(\.[^/.]+)(?:[?#].*)?$/, "$1_fs$2");
		}

		if (domain === "thumbs.wikifeet.com") {
			// https://thumbs.wikifeet.com/3398643.jpg
			//   https://pics.wikifeet.com/3398643.jpg
			return src.replace(/:\/\/[^/]*\//, "://pics.wikifeet.com/");
		}

		if (domain === "my.wikifeet.com") {
			// https://my.wikifeet.com/photos/t179623.jpg
			//   https://my.wikifeet.com/photos/179623.jpg
			// https://my.wikifeet.com/avatars/t214.jpg?1
			//   https://my.wikifeet.com/avatars/214.jpg?1
			// doesn't work for all:
			// https://my.wikifeet.com/photos/t166055.jpg
			//   https://my.wikifeet.com/photos/166055.jpg -- access denied (Content-Length: 169698, Last-Modified: Thu, 01 Aug 2019 12:02:01 GMT, Vary: Cookie)
			obj = {
				url: src.replace(/\/(photos|avatars)\/+t([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/$1/$2"),
				bad_if: [{
					headers: {
						"content-length": "169698",
						"last-modified": "Thu, 01 Aug 2019 12:02:01 GMT"
					}
				}]
			};

			match = obj.url.match(/:\/\/[^/]+\/+avatars\/+([0-9]+)\./);
			if (match) {
				obj.extra = {page: "https://my.wikifeet.com/models/" + match[1]};
			}

			return obj;
		}

		if (domain === "static.spotboye.com") {
			// http://static.spotboye.com/uploads/disha-patani-at-femina-awards_08cb1fd04740a924b584520c6087bc78_small.jpg
			//   http://static.spotboye.com/uploads/disha-patani-at-femina-awards_08cb1fd04740a924b584520c6087bc78_original.jpg
			return src.replace(/(_[0-9a-f]+)(?:_[a-z]+)?(\.[^/.]*)$/, "$1_original$2");
		}

		if (domain === "img.news.goo.ne.jp") {
			// https://img.news.goo.ne.jp/cpimg/wedge.ismedia.jp/mwimgs/c/a/-/img_ca529af8c945704fb5432aceff2d60f2795379.jpg
			//   http://wedge.ismedia.jp/mwimgs/c/a/-/img_ca529af8c945704fb5432aceff2d60f2795379.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/cpimg\/([^/]*\.[^/]*)/, "http://$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "img.news.goo.ne.jp" ||
			// thanks to nimbuz on discord:
			// https://img.topics.smt.news.goo.ne.jp/picture/dailysports/m_20240511156.jpg?0x480 -- 320x480
			//   https://img.topics.smt.news.goo.ne.jp/picture/dailysports/m_20240511156.jpg
			// https://img.topics.smt.news.goo.ne.jp/picture/dailysports/s_20240511156.jpg
			//   https://img.topics.smt.news.goo.ne.jp/picture/dailysports/m_20240511156.jpg
			domain === "img.topics.smt.news.goo.ne.jp") {
			// https://img.news.goo.ne.jp/picture/yonhap/s_yonhap-20190219wow012.jpg
			//   https://img.news.goo.ne.jp/picture/yonhap/m_yonhap-20190219wow012.jpg
			// https://img.news.goo.ne.jp/picture/wowkorea/s_wowkorea-20180615wow026.jpg
			//   https://img.news.goo.ne.jp/picture/wowkorea/m_wowkorea-20180615wow026.jpg
			// https://img.news.goo.ne.jp/picture/wowkorea/s2011111590761.jpg
			//   https://img.news.goo.ne.jp/picture/wowkorea/m2011111590761.jpg
			// https://img.news.goo.ne.jp/picture/nagasaki/s_nagasaki-20191006000925.jpg
			//   https://img.news.goo.ne.jp/picture/nagasaki/m_nagasaki-20191006000925.jpg
			// other:
			// http://img.news.goo.ne.jp/picture/megapicture_editor/20140515/20140515200355_490425581.jpg -- 3093x4647
			// http://img.news.goo.ne.jp/picture/megapicture_editor/20130519112834_168985365.jpg -- 4532x3112
			return src
				.replace(/(\/picture\/+[a-z]+\/+m[^/?#]+)(?:[?#].*)?$/, "$1")
				.replace(/\/picture\/+([a-z]+)\/+s((?:_\1-[0-9]{8}wow[0-9]+|_\1-[0-9]{10,}|_?[0-9]{10,})\.[^/.]*)(?:[?#].*)?$/, "/picture/$1/m$2");
		}

		if (domain_nowww === "redditstatic.com") {
			// https://www.redditstatic.com/sprite-reddit.[random characters].png
			// https://www.redditstatic.com/sprite-expando.[random characters].png
			// https://www.redditstatic.com/sidebar-grippy-show.png
			// https://www.redditstatic.com/icon_planet.png
			if (/^[a-z]+:\/\/[^/]+\/+(?:sprite|sidebar|icon)[-_][^/]+\./.test(src))
				return {
					url: src,
					bad: "mask"
				};

			// thanks to Liz for reporting
			// https://www.redditstatic.com/gold/awards/icon/Big_Brain_Time_48.png
			//   https://www.redditstatic.com/gold/awards/icon/Big_Brain_Time_512.png
			return src.replace(/(\/gold\/+awards\/+icon\/+[^/]+)_[1-4]?[0-9]{2}\./, "$1_512.");
		}

		if (domain === "preview.redd.it") {
			// https://preview.redd.it/7nte0k30d7p11.jpg?width=640&crop=smart&s=3045865f8ce23192e486c9f35de800bd6e2a685b
			//   https://i.redd.it/7nte0k30d7p11.jpg
			// thanks to Liz on discord:
			// https://preview.redd.it/award_images/t5_22cerq/2juh333m40n51_Masterpiece.png?width=48&height=48&auto=webp&s=80eb767a877a78c181af1385c2ed98f067b38092
			//   https://i.redd.it/award_images/t5_22cerq/2juh333m40n51_Masterpiece.png
			// thanks to pointydev: https://github.com/qsniyg/maxurl/issues/1133
			// https://preview.redd.it/black-eyed-pees-grail-v0-87udn5gszb6a1.jpg?auto=webp&s=b9ceef6cf0f71ab67ac319e35e41c5c08e3d6553
			//   https://i.redd.it/87udn5gszb6a1.jpg
			return src.replace(/:\/\/preview\.redd\.it\/(award_images\/+t[0-9]*_[0-9a-z]+\/+)?(?:[-0-9a-z]+-)?([^/.]*\.[^/.?]*)\?.*$/, "://i.redd.it/$1$2");
		}

		if (domain === "i.redd.it" && src.match(/^[a-z]+:\/\/[^/]*\/[0-9a-z]+\.[^-/._?#]*$/)) {
			return {
				url: src,
				headers: {
					Accept: '*/*',
					Referer: null
				},
				is_original: true
			};
		}

		if (domain === "i.reddituploads.com") {
			// https://i.reddituploads.com/59933254fd6e44228dc5f0fef3d850af?fit=max&h=1536&w=1536&s=6db141a8ef89df0720e6666f3e7e26bf
			//   https://i.reddituploads.com/59933254fd6e44228dc5f0fef3d850af
			newsrc = src.replace(/(:\/\/[^/]*\/[0-9a-f]+)\?.*$/, "$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (host_domain_nosub === "reddit.com" && options.element) {
			if (src === "" && options.element.tagName === "A" && options.element.classList.contains("image")) {
				// ui elements, e.g. by RES, svg images, ~800 bytes
				return {
					url: origsrc,
					bad: "mask"
				};
			}
		}

		if (domain_nosub === "redditmedia.com" && options.element) {
			if (options.element.tagName === "DIV") {
				if (options.element.classList.contains("arrow")) {
					return {
						url: origsrc,
						bad: "mask"
					};
				}
			}
		}

		if (domain === "v.redd.it") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+([a-z0-9]+)(?:[?#].*)?$/,
				query_for_id: {
					url: "https://v.redd.it/${id}",
					method: "HEAD"
				},
				process: function(done, resp, cache_key) {
					return done({
						url: resp.finalUrl,
						is_pagelink: true
					}, 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nosub === "reddit.com" || domain_nowww === "redd.it") {
			// thanks to anonymous for reporting:
			// https://www.reddit.com/media?url=https%3A%2F%2Fi.redd.it%2Fvop3v3hflzjb1.png
			//   https://i.redd.it/vop3v3hflzjb1.png
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+media\?(?:.*&)?url=([^&]+)(?:[&#].*)?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);

			var request_reddit_api = function(id, cb) {
				api_query("reddit_api:" + id, {
					url: "https://www.reddit.com/api/info.json?id=" + id,
					imu_mode: "xhr",
					// thanks to Noodlers and Zui on discord for reporting, the following user agent returns Blocked:
					// Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.0.0 Safari/537.36
					headers: {
						"Origin": "https://old.reddit.com",
						"Referer": "https://old.reddit.com/"
						//"User-Agent": "" // also returns Blocked
						// TODO: X-Signature-V2: key=RedditFrontend3(events_collector_key), mac=(hmac sha256 as hex, using events_collector_secret)
						//   is it needed? or is it only used for telemetry?
					},
					json: true
				}, cb, function(done, resp, cache_key) {
					console_log(resp);
					var item = resp.data.children[0].data;

					if (_nir_debug_) {
						console_log(id, item);
					}

					done(item, 60*60);
				});
			};

			var request_reddit = function(id, cb) {
				request_reddit_api(id, function(item) {
					if (!item) {
						return cb(null);
					}

					if (item.crosspost_parent) {
						return request_reddit(item.crosspost_parent, cb);
					}

					var urls = [];

					var obj = {
						extra: {}
					};

					if (item.permalink) {
						obj.extra.page = urljoin("https://www.reddit.com/", item.permalink, true);
					}

					if (item.title) {
						obj.extra.caption = item.title;
					}

					var is_selfpost = item.domain && /^self\./.test(item.domain) && item.url && /^[a-z]+:\/\/[^/]*reddit\.com\/r\//.test(item.url);

					// https://www.reddit.com/r/firefox/comments/97dqq1/is_there_a_functional_bookmarks_manager_extension/
					// item.preview.enabled is false also on link/image posts, don't use that
					if (!is_selfpost && item.preview && item.preview.images) {
						var preview_image;
						if (item.preview.images[0].variants.gif)
							preview_image = item.preview.images[0].variants.gif.source.url;
						else
							preview_image = item.preview.images[0].source.url;

						preview_image = preview_image.replace(/&amp;/g, "&");
						urls.push(preview_image);
					}

					if (item.secure_media && item.secure_media.reddit_video) {
						var rv = item.secure_media.reddit_video;

						if (rv.fallback_url) {
							urls.unshift({
								url: rv.fallback_url,
								video: true
							});
						}

						if (rv.hls_url) {
							urls.unshift({
								url: rv.hls_url,
								video: "hls"
							});
						}

						if (rv.dash_url) {
							urls.unshift({
								url: rv.dash_url,
								video: "dash"
							});
						}
					}

					if (item.gallery_data && item.gallery_data.items) {
						var first_url = null;
						var album_links = [];
						array_foreach(item.gallery_data.items, function(item) {
							var url = "https://i.redd.it/" + item.media_id + ".jpg";
							if (!first_url)
								first_url = url;

							album_links.push({
								url: url,
								is_current: first_url === url
							});
						});

						if (first_url) {
							urls.unshift({
								url: first_url,
								album_info: {
									type: "links",
									links: album_links
								}
							});
						}
					}

					if (!/^[a-z]+:\/\/(?:[^/]*\.)?reddit\.com\/+gallery\//.test(item.url) &&
						looks_like_valid_link(item.url, item.url)) {
						urls.unshift(item.url);
					}

					return cb(fillobj_urls(urls, obj));
				});
			}

			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+(?:(?:(?:r|u(?:ser)?)\/+[^/]+\/+comments|gallery)\/+)?([a-z0-9]+)(?:\/+.*)?(?:[?#].*)?$/,
				run: function(cb, match) {
					var id = match[1];
					// t3 = link
					request_reddit("t3_" + id, function(data) {
						cb(data);
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if ((domain_nosub === "redditmedia.com" ||
			 domain_nosub === "redd.it" ||
			 (domain_nosub === "reddit.com" && /:\/\/[^/]+\/+[ru]\/+/.test(src)) ||
			 string_indexof(origsrc, "blob:") === 0) &&
			host_domain_nosub === "reddit.com" && options.element) {
			var get_reddit_link = function(id) {
				id = id.replace(/^t[0-9]+_/, "");

				return {
					url: "https://redd.it/" + id,
					is_pagelink: true
				};
			};

			var current = options.element;
			do {
				if (current.tagName === "DIV") {
					// data-testid: new reddit, subreddit page
					// id: new reddit, post page (with a <div data-test-id="post-content"> element below)
					// data-fullname: old reddit, subreddit page
					var testid = current.getAttribute("data-testid") || current.getAttribute("data-fullname") || current.getAttribute("id");
					if (testid && testid === "post-container") {
						// thanks to secret soup on discord for reporting:
						// new reddit, post page video
						testid = current.getAttribute("id");
					}

					if (testid) {
						match = testid.match(/^t3_([a-z0-9]{2,8})$/);
						if (match) {
							return get_reddit_link(match[1]);
						}
					}
				}
			} while (current = current.parentElement);
		}

		if ((domain_nosub === "gstatic.com" ||
			 domain === "") &&
			host_domain_nosub.match(/^google\./) && options.element) {
			newsrc = (function() {
				// function too large for analysis
				// @ts-expect-error
				var get_imagesearch_url = function(current) {
					do {
						if (current.tagName !== "A")
							continue;

						if (!current.href.match(/\/imgres\?/))
							continue;

						var newsrc = current.href.replace(/.*?\/imgres.*?[?&]imgurl=([^&]*).*?$/, "$1");
						if (newsrc !== src)
							return decodeURIComponent(newsrc);
					} while (current = current.parentElement);

					return null;
				};

				var newsrc = get_imagesearch_url(options.element);
				if (newsrc)
					return newsrc;

				// new image search, only works for images that are part of the page load
				// credit for this technique goes to GooglePanicImages
				var tbnid = null;
				current = options.element;
				if (current.tagName === "IMG") {
					while ((current = current.parentElement)) {
						if (current.tagName !== "DIV")
							continue;

						var our_tbnid = current.getAttribute("data-tbnid");
						if (!our_tbnid)
							continue;

						tbnid = our_tbnid;

						var regex = new RegExp("\\[[0-9]+\\s*,\\s*\"" + tbnid + "\"\\s*,\\s*\\[[^\\]]*\\]\\s*,\\s*\\[(\"[^\"]+\")\\s*,");
						var match = document.documentElement.innerHTML.match(regex); // TODO: optimize
						if (match) {
							return JSON_parse(match[1]);
						} else {
							break;
						}
					}
				}

				if (tbnid && options.cb) {
					try {
						// https://stackoverflow.com/a/52878847
						var event = new MouseEvent("mousedown", {
							bubbles: true,
							cancelable: true,
							//view: window, // doesn't work under VM due to window not being a Window. not needed anyways
							button: 2,
							buttons: 2,
							clientX: 1,
							clientY: 1
						});
						options.element.dispatchEvent(event);

						// 500 seems to work fine. TODO: perhaps retry 2-3 times?
						setTimeout(function() {
							options.cb(get_imagesearch_url(options.element));
						}, 500);

						return {
							waiting: true
						};
					} catch (e) {
						console_error(e);
					}
				}

				// small previews
				current = options.element;
				while ((current = current.parentElement)) {
					if (current.tagName !== "A")
						continue;

					if (!current.href.match(/\/search\?/))
						continue;

					// related images
					var parent = current.parentElement;
					if (parent.tagName !== "DIV")
						continue;

					var notranslate = parent.getElementsByClassName("notranslate");
					if (!notranslate.length) {
						// all search results
						parent = parent.parentElement;
						if (!parent || parent.tagName !== "DIV")
							break;

						notranslate = parent.getElementsByClassName("notranslate");
						if (!notranslate.length)
							continue;
					}

					for (var i = 0; i < notranslate.length; i++) {
						var el = notranslate[i];
						if (!el.innerHTML.match(/^ *{/))
							continue;

						var json = JSON_parse(el.innerHTML);
						// properties:
						// oh = original height
						// ow = original width
						// ou = original url (of image)
						// pt = original url minus protocol
						// rh = host url hostname
						// ru = host url
						// th = thumbnail height
						// tw = thumbnail width
						// tu = thumbnail url

						if (json.ou.match(/^[a-z]+:/))
							return json.ou;

						break;
					}
				}
			})();
			if (newsrc !== void 0)
				return newsrc;
		}

		if (domain_nosub === "fbcdn.net") {
			// https://static.xx.fbcdn.net/rsrc.php/v3/yt/r/nAici4PGRPZ.png
			if (/^[a-z]+:\/\/[^/]+\/+rsrc\.php\//.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}
		}

		if (domain_nosub === "fbcdn.net" && host_domain_nosub === "facebook.com" && options.element) {
			var element = options.element;

			if (element.tagName === "IMG") {
				while ((element = element.parentElement)) {
					if (element.tagName === "A") {
						var ploi = element.getAttribute("data-ploi");
						if (ploi && ploi.match(/^https?:\/\/[^/]*fbcdn\.net\//) && ploi !== src) {
							return ploi;
						} else if (/^[a-z]+:\/\/[^/]+\.?facebook\.com\//.test(element.href)) {
							// thanks to GoblinLegislator on github: https://github.com/qsniyg/maxurl/issues/627
							return {
								url: element.href,
								is_pagelink: true
							};
						}
					}
				}
			}
		}

		if (domain === "thumbnail.named.com" ||
			// https://thumb.named.com/normal/croptop/206x150/file/photo/1019940 -- not gif
			//   https://thumb.named.com/normal/resize/origin/file/photo/1019940 -- gif
			// http://thumb.named.com/normal/croptop/206x150/file/photo/editor/1805/6ab94eb5c32a804217f93133c33782eb_Cq1PC1WPl6bggYURN2BIWdXcFj8b4.jpg
			//   http://thumb.named.com/normal/resize/origin/file/photo/editor/1805/6ab94eb5c32a804217f93133c33782eb_Cq1PC1WPl6bggYURN2BIWdXcFj8b4.jpg
			domain === "thumb.named.com") {
			// http://thumbnail.named.com/normal/croptop/206x150/file/photo/977034
			//   http://data.named.com/data/file/photo/977034 -- forces download
			return [
				//src.replace(/:\/\/[^/]*\/.*?(\/+file\/+photo\/+.*)/, "://data.named.com/data$1"), -- ip address not found
				src.replace(/:\/\/[^/]*\/.*?(\/+file\/+photo\/+.*)/, "://thumb.named.com/normal/resize/origin$1")
			];
		}

		if (host_domain_nosub === "bing.com" &&
			(domain === "" || domain_nosub === "bing.com") && options.element) {
			var current = options.element;
			while ((current = current.parentElement)) {
				if (current.tagName === "DIV" && current.id === "mainImageWindow" && current.hasAttribute("data-m")) {
					let parsed = JSON_parse(current.getAttribute("data-m"));
					return parsed.murl;
				}

				if (current.tagName !== "A")
					continue;

				//console_log(current.href);
				if (!current.href.match(/\/images\/search\?.*mediaurl=/))
					continue;

				newsrc = current.href.replace(/.*?\/search.*?[?&]mediaurl=([^&]*).*?$/, "$1");
				if (newsrc !== current.href && newsrc !== src) {
					newsrc = decodeuri_ifneeded(newsrc);
					//console_log(newsrc);
					return newsrc;
				}
			}
		}

		if (domain_nosub === "deviantart.net" &&
			(domain.match(/^pre[0-9]*\.deviantart\.net/) ||
			 domain.match(/^img[0-9]*\.deviantart\.net/)) &&
			src.match(/\/[a-z0-9]\/[0-9]+\/[0-9a-z]+\/[0-9a-z]+\/[0-9a-z]+\/[^/]*-[0-9a-z]+\.[^/.]*$/) &&
			options && options.do_request && options.cb) {
			// https://github.com/DeviantArt/DeviantArt-API/issues/100#issuecomment-219092634
			//   ids are base36 encoded
			// https://aikiyun.deviantart.com/art/BRS-Strength-619670254 -- sensitive
			// https://img00.deviantart.net/f4a7/i/2016/187/9/8/_brs__strength_by_aikiyun-da8xomm.jpg
			//   https://orig00.deviantart.net/af7a/f/2016/187/6/d/_brs__strength_by_aikiyun-da8xomm.jpg
			//
			// https://pre00.deviantart.net/cc1d/th/pre/i/2015/027/3/7/_brs__nana_gray_by_aikiyun-d8flbyx.png
			//   https://orig00.deviantart.net/5455/f/2015/027/f/c/_brs__nana_gray_by_aikiyun-d8flbyx.png
			//
			// https://darkblueandy.deviantart.com/art/Black-Rock-Shooter-10th-Anniversary-Tribute-749686444 -- no download
			//   https://pre00.deviantart.net/8fe7/th/pre/i/2018/164/6/3/black_rock_shooter_10th_anniversary_tribute_by_darkblueandy-dcecdrg.jpg
			//
			// older links don't work:
			//
			// https://daniwae.deviantart.com/art/Vocaloid-Black-Rock-Shooter-126624173
			//   https://pre00.deviantart.net/1fa8/th/pre/f/2009/171/d/3/vocaloid__black_rock_shooter_by_danny07312017.png
			//   https://orig00.deviantart.net/1d55/f/2009/171/d/3/vocaloid__black_rock_shooter_by_danny07312017.png
			// parseInt("da8xomm", 36) = 28917840622
			//   28917840622 - 619670254 = 28298170368

			newsrc = (function() {
				var id = src.replace(/.*-([0-9a-z]+)\.[^/.]*$/, "$1");
				//id = parseInt(id, 36) - 28298170368;

				return common_functions["deviantart_fullimage"](options, api_cache, src, id, options.cb);
			})();

			return {
				"waiting": true
			};
		}

		if (domain_nowww === "huangdi5000.com") {
			// http://www.huangdi5000.com/p.php?p=http://mmbiz.qpic.cn/mmbiz/vbBlf7WMGAVedhZJHo9ooicWiaOY5RDdAbjYxWicFsdl8NATTCBQ11fdibPmE4Y5BicbpXg9r0g2FF0PZnB0OnZm4IA/0?wx_fmt=jpeg
			//   http://mmbiz.qpic.cn/mmbiz/vbBlf7WMGAVedhZJHo9ooicWiaOY5RDdAbjYxWicFsdl8NATTCBQ11fdibPmE4Y5BicbpXg9r0g2FF0PZnB0OnZm4IA/0
			return decodeURIComponent(src.replace(/^[a-z]+:\/\/[^/]*\/p\.php.*?[?&]p=(.*)$/, "$1"));
		}

		if (domain_nowww === "popcornfor2.com" && string_indexof(src, "/upload/") >= 0) {
			// http://www.popcornfor2.com/upload/101/news-thumb-100097.jpg
			//   http://www.popcornfor2.com/upload/101/news-full-100097.jpg
			// http://popcornfor2.com/upload/101/news-thumb-100665.jpg
			//   http://popcornfor2.com/upload/101/news-full-100665.jpg
			return src.replace(/\/news-[a-z]+-([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/news-full-$1");
		}

		if (domain === "img.daily.co.kr") {
			// http://img.daily.co.kr/@files/www.daily.co.kr/content_watermark/life/2016/20160718/e0c39c44f765af2a2adf6dc0ce825309.jpg
			//   http://img.daily.co.kr/@files/www.daily.co.kr/content/life/2016/20160718/e0c39c44f765af2a2adf6dc0ce825309.jpg
			return src.replace("/content_watermark/", "/content/");
		}

		if (domain === "file.gamedonga.co.kr") {
			// http://file.gamedonga.co.kr/files/2016/05/13/t/sosi1.jpg
			//   http://file.gamedonga.co.kr/files/2016/05/13/sosi1.jpg
			return src.replace(/(\/files\/[0-9]+\/[0-9]+\/[0-9]+\/)[a-z]\/([^/]*)$/, "$1$2");
		}

		if (domain === "jrimage.dongascience.com") {
			// http://jrimage.dongascience.com/press/2015/02/14232860737596_thumb.jpg
			//   http://jrimage.dongascience.com/press/2015/02/14232860737596.jpg
			return src.replace(/(\/[0-9]+)_thumb(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "cloud.tcusercontent.net") {
			// https://cloud.tcusercontent.net/ticket-10462437-ad37350ebc-258.png
			//   https://cloud.tcusercontent.net/ticket-10462437-ad37350ebc.png
			return src.replace(/(-[0-9]+-[0-9a-f]+)-[0-9]+(\.[^/.]*)$/, "$1$2");
		}

		if (domain === "image.entertainment-topics.jp" ||
			// https://image.code-file.jp/item/image/normal/3793054.jpg?time=1486525693
			//   https://image.code-file.jp/item/image/original/3793054.jpg?time=1486525693
			domain === "image.code-file.jp" ||
			// https://image.make-book.jp/item/image/normal/2618489.jpg?time=1494472954
			//   https://image.make-book.jp/item/image/original/2618489.jpg?time=1494472954
			domain === "image.make-book.jp") {
			// http://image.entertainment-topics.jp/item/image/normal/4084176.jpg?time=1508824130
			//   http://image.entertainment-topics.jp/item/image/original/4084176.jpg?time=1508824130
			// http://image.entertainment-topics.jp/article/normal/137930.jpg?time=1529115899
			//   http://image.entertainment-topics.jp/article/original/137930.jpg?time=1529115899
			return src.replace(/(:\/\/[^/]*\/)(item\/image\/|article\/)[a-z]+(\/[^/]*)$/, "$1$2original$3");
		}

		if ((domain_nosub === "styapokupayu.ru" && string_indexof(src, "/images/") >= 0) ||
			(domain_nosub === "yapokupayu.ru" && /\/system\/+images\//.test(src))) {
			// http://st4.styapokupayu.ru/images/blog_post_images/000/137/597_large.jpg
			//   http://st4.styapokupayu.ru/images/blog_post_images/000/137/597_original.jpg
			// http://st10.styapokupayu.ru/images/product/026/756/403_medium.jpg
			//   http://st10.styapokupayu.ru/images/product/026/756/403_original.jpg
			// http://www.yapokupayu.ru/system/images/avatars/000/038/880_large.jpg?1486491028
			//   http://www.yapokupayu.ru/system/images/avatars/000/038/880_original.jpg?1486491028
			return src.replace(/(\/[0-9]+)_[a-z]+(\.[^/.]*)$/, "$1_original$2");
		}

		if (domain_nowww === "thai.ac") {
			// https://thai.ac/news/tn/?fn=https://obs.line-scdn.net/0m01a167cc1b700d30606e7a412827332a6c6f64602f417c46137b3d397c2b3f316a333c6573303c0c342b623b3b/w580
			//   https://obs.line-scdn.net/0m01a167cc1b700d30606e7a412827332a6c6f64602f417c46137b3d397c2b3f316a333c6573303c0c342b623b3b/w580
			return decodeURIComponent(src.replace(/^[a-z]+:\/\/[^/]*\/news\/tn\/.*?[?&]fn=([^&]*).*?/, "$1"));
		}

		if (domain_nosub === "styleshare.kr" &&
			domain.match(/usercontents(?:-[a-z])?\.styleshare\.kr/)) {
			// https://usercontents-c.styleshare.kr/images/14247471/640x640
			//   https://usercontents-c.styleshare.kr/images/14247471/original
			// https://usercontents-c.styleshare.kr/images/14890803/460x-
			//   https://usercontents-c.styleshare.kr/images/14890803/original
			return src.replace(/(\/images\/[0-9]+\/)[-0-9]+x[-0-9]+(?:\?.*)?$/, "$1original");
		}

		if (domain === "images.vingle.net") {
			// https://images.vingle.net/upload/t_us_l/vrcdqlkhhzniaubre2pr.jpg
			//   https://images.vingle.net/upload/vrcdqlkhhzniaubre2pr.jpg
			return src.replace(/(:\/\/[^/]*\/upload\/)t_[^/]*\/([^/]*)$/, "$1$2");
		}

		if (domain === "media.vingle.net") {
			// https://media.vingle.net/images/ca_l/0mcb5mlie2.jpg -- 960x960
			//   https://media.vingle.net/images/ca_xl/0mcb5mlie2.jpg
			// https://media.vingle.net/images/us_s/k8nbdisw8k.jpg
			//   https://media.vingle.net/images/us_l/k8nbdisw8k.jpg
			newsrc = src.replace(/(\/images\/+(?:ca|us))_s\//, "$1_l/");
			if (newsrc !== src)
				return newsrc;

			newsrc = src.replace(/(\/images\/+(?:ca|us))_l\//, "$1_xl/");
			if (newsrc !== src)
				return newsrc;

			return {
				url: src,
				headers: {
					Referer: ""
				}
			};
		}

		if (domain_nowww === "anewsa.com") {
			// http://www.anewsa.com/news_images/2016/07/14/mark/20160714163711-1.jpg
			//   http://www.anewsa.com/news_images/2016/07/14/original/20160714163711-1.jpg
			// page:
			// http://www.anewsa.com/news_images/2019/09/06/original/20190906151757.jpg
			//   http://www.anewsa.com/detail.php?number=1959271
			// other:
			// http://www.anewsa.com/upload/editor/20171118163158_4.jpg -- 3184x2123
			//   http://www.anewsa.com/detail.php?number=1245482&thread=05r02
			return src.replace(/(_images\/[0-9]+\/[0-9]+\/[0-9]+\/)mark(\/[^/]*)$/, "$1original$2");
		}

		if (domain === "img.newspim.com") {
			// http://img.newspim.com/news/2018/06/12/1806121533058220_tc.jpg
			//   http://img.newspim.com/news/2018/06/12/1806121533058220.jpg
			// http://img.newspim.com/slide_image/2019/08/28/19082810380285900_t1.jpg
			//   http://img.newspim.com/slide_image/2019/08/28/19082810380285900.jpg
			// http://img.newspim.com/magazine/2019/08/201908_f231389de1_thumb.jpg
			//   http://img.newspim.com/magazine/2019/08/201908_f231389de1.jpg
			// http://img.newspim.com/news/2016/04/14/1604141714354920_w.jpg -- 2000x3000 (watermark)
			//   http://img.newspim.com/news/2016/04/14/1604141714354920.jpg -- 2000x3000
			// other:
			// http://img.newspim.com/news/2016/11/02/1611021647165900.jpg -- 1818x2756
			// http://monthly.newspim.com/news/view/2658/?yymm=M00103
			//   http://img.newspim.com/magazine/2018/11/201811_fa1ccd355f.jpg -- 5000x2549
			return src
				.replace(/(\/[0-9]+)_(?:t[a-z0-9]|w)(\.[^/.]*)$/, "$1$2")
				.replace(/(\/magazine\/+[0-9]{4}\/+[0-9]{2}\/+[0-9]+_[0-9a-f]+)_thumb(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "insectidentification.org") {
			// https://www.insectidentification.org/imgs/insects/thumbnails/eastern-hercules-beetle_19.jpg
			//   https://www.insectidentification.org/imgs/insects/eastern-hercules-beetle_19.jpg
			// https://insectidentification.org/imgs/insects/thumbnails/abbotts-sphinx-moth.jpg
			//   https://www.insectidentification.org/imgs/insects/abbotts-sphinx-moth.jpg
			return src.replace(/(\/imgs\/[a-z]+\/)thumbnails\//, "$1");
		}

		if (domain_nowww === "a-z-animals.com") {
			// https://a-z-animals.com/media/animals/images/100x100/japanese_macaque6.jpg
			//   https://www.a-z-animals.com/media/animals/images/original/japanese_macaque6.jpg
			return src.replace(/\/images\/[0-9]+x[0-9]+\//, "/images/original/");
		}

		if (domain_nosub === "nicematin.com" && /^cdn\.static[0-9]*\./.test(domain)) {
			// https://cdn.static01.nicematin.com/media/npo/mobile_1440w/2017/04/a1-8874302.jpg
			//   https://cdn.static01.nicematin.com/media/npo/original/2017/04/a1-8874302.jpg
			// https://cdn.static03.nicematin.com/media/npo/square/2018/06/rca12q100_fv_lunallena.jpg
			//   https://cdn.static03.nicematin.com/media/npo/original/2018/06/rca12q100_fv_lunallena.jpg
			//return src.replace(/\/mobile_[0-9]+[whx](?:[0-9]+)?\//, "/original/");
			return src.replace(/(:\/\/[^/]*\/+media\/+[^/]*\/+)[^/]*(\/+[0-9]+\/+[0-9]+\/+[^/]*)(?:[?#].*)?$/, "$1original$2");
		}

		if (domain_nosub === "fbcdn.net" || domain_nosub === "cdninstagram.com") {
			// https://instagram.fcxh2-1.fna.fbcdn.net/v/t51.2885-15/e35/85066278_101857984707704_1091284702256776100_n.jpg?_nc_ht=instagram.fcxh2-1.fna.fbcdn.net&_nc_cat=1&se=7
			//   https://instagram.fcxh2-1.fna.fbcdn.net/v/t51.2885-15/e35/85066278_101857984707704_1091284702256776100_n.jpg?_nc_ht=instagram.fcxh2-1.fna.fbcdn.net

			// thanks to remlap on github: https://github.com/qsniyg/maxurl/issues/239
			// these remove_queries calls are separated in case the next one doesn't work.
			newsrc = common_functions["instagram_norm_url"](src);
			if (newsrc !== src)
				return common_functions["set_cdninstagram_obj"](newsrc);

			/*newsrc = remove_queries(src, ["se"]);
			if (newsrc !== src)
				return newsrc;

			newsrc = remove_queries(src, ["_nc_cat", "_nc_rid", "efg", "ig_cache_key"]);
			if (newsrc !== src)
				return newsrc;*/
		}

		if (domain_nowww === "instagram.com") {
			newsrc = website_query({
				website_regex: {
					regex: /^[a-z]+:\/\/[^/]+\/+(p|tv|reel)\/+([^/]+)(?:\/+(?:(?:media|embed).*)?)?(?:[?#].*)?$/,
					groups: ["type", "id"]
				},
				id: "post:${type}:${id}",
				run: function(cb, match) {
					var info:any = [{
						type: "post",
						subtype: "link",
						url: "https://www.instagram.com/" + match[1] + "/" + match[2] + "/",
						element: options.element
					}];

					var queries = common_functions["parse_imu_hash"](src);
					if (queries) {
						if (queries.i) {
							info[0].image = parseInt(queries.i);
						} else if (queries.image_url) {
							info[0].image = queries.image_url;
						}
					}

					if (!info[0].image) info[0].image = "first";

					return common_functions["instagram_parse_el_info"](
						api_cache, options.do_request,
						options.rule_specific.instagram_use_app_api, options.rule_specific.instagram_dont_use_web, options.rule_specific.instagram_prefer_video_quality,
						info, options.host_url, cb);
				}
			});
			if (newsrc) return newsrc;

			newsrc = website_query({
				website_regex: {
					regex: /^[a-z]+:\/\/[^/]+\/+stories\/+([^/]+)\/+([0-9]+)\/*(?:[?#].*)?$/,
					groups: ["user", "id"]
				},
				id: "story:${user}:${id}",
				run: function(cb, match) {
					var info:any = [{
						type: "story",
						url: "https://www.instagram.com/stories/" + match.groups.user + "/" + match.groups.id + "/",
						element: options.element
					}];

					info[0].image = info[0].url;

					return common_functions["instagram_parse_el_info"](
						api_cache, options.do_request,
						options.rule_specific.instagram_use_app_api, options.rule_specific.instagram_dont_use_web, options.rule_specific.instagram_prefer_video_quality,
						info, options.host_url, cb);
				}
			});
			if (newsrc) return newsrc;
		}

		if (((domain_nosub === "fbcdn.net" && domain.match(/^instagram\./)) ||
			 domain_nosub === "cdninstagram.com" ||
			 // blob videos
			 (!src && origsrc)) &&
			host_domain_nosub === "instagram.com" && options.element && options.cb) {
			// ig_cache_key, se, _nc_cat, _nc_rid, efg aren't needed
			// _nt_ht, _nc_ohc is needed
			// if vs or _nc_vs is missing, "URL signature mismatch"
			// if oe is missing, "Bad URL timestamp"
			// if oh is missing, "Bad URL hash"
			newsrc = (function() {
				var info = common_functions["instagram_find_el_info"](document, options.element, options.host_url);
				return common_functions["instagram_parse_el_info"](api_cache, options.do_request, options.rule_specific.instagram_use_app_api, options.rule_specific.instagram_dont_use_web, options.rule_specific.instagram_prefer_video_quality, info, options.host_url, options.cb);
			})();
			if (newsrc !== void 0)
				return newsrc;
		}

		if (domain_nowww === "instagram.com") {
			// https://www.instagram.com/static/bundles/es6/sprite_video_...
			// https://www.instagram.com/static/images/ico/favicon.svg/[hex].svg
			if (/\/static\/+(?:bundles\/+[^/]+\/+sprite_|images\/+ico\/+)/.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}
		}

		if (domain_nosub === "instagram.com" &&
			src.match(/:\/\/[^/]*\/+p\/+[^/]*\/+media\/*[?]size=[a-z](?:[&#].*)?$/)) {
			// https://www.instagram.com/p/BkArbRJBpNS/media?size=m
			//   https://www.instagram.com/p/BkArbRJBpNS/media?size=l
			//   https://instagram.fyvr2-1.fna.fbcdn.net/vp/6d735911bc97047c9b65a842b7cb3547/5D963B3E/t51.2885-15/e35/34777339_389407841565200_4095040588460589056_n.jpg?_nc_ht=instagram.fyvr2-1.fna.fbcdn.net
			newsrc = {
				url: src.replace(/\/media.*?[?&]size=[a-z].*?$/, "/media?size=l"),
				can_head: false
			};

			match = src.match(/\/p\/+([^/]+)\/+media/);
			if (match) {
				return [
					{url: "https://www.instagram.com/p/" + match[1] + "/", is_pagelink: true},
					newsrc
				];
			} else {
				return newsrc;
			}
		}

		// what was this rule even for?
		// it was probably useful for something, but it's causing issues
		if (false && domain_nosub === "instagram.com" &&
			!((domain_nowww === "instagram.com" ||
			   domain === "about.instagram.com" ||
			   domain === "help.instagram.com") &&
			  (src.match(/:\/\/[^/]*\/+(?:[^/]+\/+)?p\/+[^/]*/) ||
			   src.match(/:\/\/[^/]*\/+(?:accounts|directory|explore|legal|developer|blog|about)\//) ||
			   src.match(/:\/\/[^/]*(?:\/+[-a-zA-Z0-9_.]*)?(?:[?#].*)?$/)))) {
			return {
				url: src,
				headers: {
					"Referer": "https://www.instagram.com"
				}
			};
		}

		if (domain === "l.instagram.com") {
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+\?(?:.*&)?u=([^&]+).*?$/, "$1");
			if (newsrc !== src)
				return decodeURIComponent(newsrc);
		}

		if (false && domain_nowww === "instagram.com" && /^[a-z]+:\/\/[^/]+\/+(?:[^/]+\/+)?p\/+/.test(src) && options.do_request && options.cb) {
			newsrc = src.replace(/(\/p\/+[^/]+)(?:\/+(?:(?:media|embed).*)?)?(?:[?#].*)?$/, "$1/");

			var info = [{
				type: "post",
				subtype: "link",
				url: newsrc,
				image: "first",
				element: options.element
			}];

			return common_functions["instagram_parse_el_info"](api_cache, options.do_request, options.rule_specific.instagram_use_app_api, options.rule_specific.instagram_dont_use_web, options.rule_specific.instagram_prefer_video_quality, info, options.host_url, options.cb);
		}

		if (domain === "s9e.github.io") {
			// https://s9e.github.io/iframe/2/instagram.min.html#CA_k1BvgRsA
			match = src.match(/\/iframe\/+[0-9]+\/+instagram\.min\.html#(.*)$/);
			if (match) {
				return {
					url: "https://www.instagram.com/p/" + match[1] + "/",
					is_pagelink: true
				};
			}
		}

		if (false && host_domain_nowww === "discordapp.com" && (domain_nosub === "fbcdn.net" || domain_nosub === "cdninstagram.com") && options.element && options.cb && options.do_request) {
			if (options.element.tagName === "IMG" && options.element.parentElement && options.element.parentElement.tagName === "A") {
				var aparent = options.element.parentElement;
				var aparent_class = aparent.getAttribute("class");
				if (string_indexof(aparent_class, "embedMedia") >= 0) {
					var divparent = aparent.parentElement;
					if (divparent) {
						var divs = divparent.getElementsByTagName("div");
						for (let i = 0; i < divs.length; i++) {
							var ourdiv_class = divs[i].getAttribute("class");
							if (string_indexof(ourdiv_class, "embedTitle") >= 0) {
								var our_as = divs[i].getElementsByTagName("a");

								if (our_as.length === 1 && /instagram\.com\//.test(our_as[0].href)) {
									var info = [{
										type: "post",
										subtype: "link",
										url: our_as[0].href,
										image: src,
										element: options.element
									}];

									return common_functions["instagram_parse_el_info"](api_cache, options.do_request, options.rule_specific.instagram_use_app_api, options.rule_specific.instagram_dont_use_web, options.rule_specific.instagram_prefer_video_quality, info, options.host_url, options.cb);
								}

								break;
							}
						}
					}
				}
			}
		}

		if (domain === "cdns.klimg.com" ||
			domain === "cdn.klimg.com") {
			// https://cdns.klimg.com/resized/300x150/p/photonews/foto-pesona-cantik-krystal-kenakan-suit-0ef272.jpg
			//   https://cdns.klimg.com/kapanlagi.com/p/photonews/foto-pesona-cantik-krystal-kenakan-suit-0ef272.jpg
			// https://cdns.klimg.com/kapanlagi.com/p/headline/476x238/usai-avicii-meninggal-komunitas-dance-m-1ec3b8.jpg
			//   https://cdns.klimg.com/kapanlagi.com/p/headline/usai-avicii-meninggal-komunitas-dance-m-1ec3b8.jpg
			// https://cdns.klimg.com/resized/476x/p/camila-cabello-camilacabello-com.jpg
			//   https://cdns.klimg.com/kapanlagi.com/p/camila-cabello-camilacabello-com.jpg
			// http://cdn.klimg.com/kapanlagi.com/g/t/i/tiffany_dan_kris_wu_di_red_carpet_2018_amas_para_alumni_sm_ent/t/tiffany-20181010-001-rita.jpg
			//   http://cdn.klimg.com/kapanlagi.com/g/t/i/tiffany_dan_kris_wu_di_red_carpet_2018_amas_para_alumni_sm_ent/tiffany-20181010-001-rita.jpg
			// https://cdns.klimg.com/merdeka.com/resized/100x100/i/w/photonews/2013/02/07/148960/540x270/20130207182024-aksi-para-personel-akb48-001-debby.jpg
			//   https://cdns.klimg.com/merdeka.com/i/w/photonews/2013/02/07/148960/540x270/20130207182024-aksi-para-personel-akb48-001-debby.jpg
			// https://cdns.klimg.com/kapanlagi.com/g/emma_watson_di_premiere_harpot_di_london/t/emma_watson_di_premiere_harpot-20090710-002-rita.jpg
			//   https://cdns.klimg.com/kapanlagi.com/g/emma_watson_di_premiere_harpot_di_london/emma_watson_di_premiere_harpot-20090710-002-rita.jpg
			// thanks to anonymous for reporting:
			// https://cdns.klimg.com/dream.co.id/resources/photonews/2016/07/11/36308/664xauto-foto-foto-jakarta-sepi-di-tinggal-pergi-bikin-susah-move-on-160711y-001.jpg
			//   https://cdns.klimg.com/dream.co.id/resources/photonews/2016/07/11/36308/foto-foto-jakarta-sepi-di-tinggal-pergi-bikin-susah-move-on-160711y-001.jpg
			return src
				.replace(/(:\/\/[^/]*\/+[^/]*\.[^/]*\/+)resized\/+[0-9]+x(?:[0-9]+)?\/+/, "$1")
				.replace(/\/resized\/[0-9]+x(?:[0-9]+)?\//, "/kapanlagi.com/")
				.replace(/(\/g\/.\/.\/[^/]*\/)t\/([^/]*)$/, "$1$2")
				.replace(/(\/p\/+[^/]*\/+)[0-9]+x[0-9]+\/+([^/]*$)/, "$1$2")
				.replace(/\/t\/+([^/]*\.[^/.]*)(?:[?#].*)?$/, "/$1")
				.replace(/(\/resources\/.*\/)[auto0-9]+x[auto0-9]+-([^/]+)(?:[?#].*)?$/, "$1$2");
		}

		if ((domain_nosub === "nintendo-europe.com" && /^cdn[0-9]*\./.test(domain)) ||
			// thanks to immewnity on github: https://github.com/qsniyg/maxurl/issues/1361
			// https://www.nintendo.com/eu/media/images/08_content_images/games_6/gamecube_11/gcn_pokemoncolosseum/CI16_GCN_PokemonColosseum_image950w.png
			//   https://www.nintendo.com/eu/media/images/08_content_images/games_6/gamecube_11/gcn_pokemoncolosseum/CI16_GCN_PokemonColosseum.png
			// https://www.nintendo.com/eu/media/images/11_square_images/games_18/smart_device_6/SQ_SmartDevice_AnimalCrossingPocketCamp_image500w.jpg
			//   https://www.nintendo.com/eu/media/images/11_square_images/games_18/smart_device_6/SQ_SmartDevice_AnimalCrossingPocketCamp.jpg
			// https://www.nintendo.com/eu/media/images/10_share_images/portals_3/2x1_SuperMarioHub_banner66LG.jpg
			//   https://www.nintendo.com/eu/media/images/10_share_images/portals_3/2x1_SuperMarioHub.jpg
			// https://www.nintendo.com/eu/media/images/08_content_images/games_6/gameboy_color/CI_GBC_PokemonGoldAndSilver_CharaPikachu_CMM_big.jpg
			//   https://www.nintendo.com/eu/media/images/08_content_images/games_6/gameboy_color/CI_GBC_PokemonGoldAndSilver_CharaPikachu.jpg
			// https://www.nintendo.com/eu/media/images/06_screenshots/games_5/game_boy_color_2/gbc_pokemonsilverversion/GBC_PokemonSilverVersion_02_TM_Standard.jpg
			//   https://www.nintendo.com/eu/media/images/06_screenshots/games_5/game_boy_color_2/gbc_pokemonsilverversion/GBC_PokemonSilverVersion_02.jpg
			(domain_nowww === "nintendo.com" && /:\/\/[^/]+\/+eu\//.test(src))) {
			// https://cdn02.nintendo-europe.com/media/images/10_share_images/portals_3/H2x1_SuperMario_Hub_image1600w.jpg
			//   https://cdn02.nintendo-europe.com/media/images/10_share_images/portals_3/H2x1_SuperMario_Hub.jpg
			return src.replace(/(\/media\/+images\/.*?)_(?:image[0-9]*[wh]|banner[0-9]+LG|CMM_big|TM_Standard)(\.[^/.]*)$/, "$1$2");
		}

		if (domain_nosub === "15min.lt" && /^s[0-9]*\./.test(domain)) {
			// https://s1.15min.lt/images/photos/2017/05/19/big/olivia-rodrigo-591e9d3a8f81d.jpg
			//   https://s1.15min.lt/images/photos/2017/05/19/original/olivia-rodrigo-591e9d3a8f81d.jpg
			return src.replace(/(\/images\/+photos\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2})[a-z]+(\/+[^/]+\.[^/.]+)(?:[?#].*)?$/, "$1original$2");
		}

		if (false && (domain_nosub === "bdbphotos.com" &&
					  domain.match(/^img[0-9]*\.bdbphotos\.com/))) {
			// doesn't work
			return {
				url: src.replace(/\/images\/[a-z]+\//, "/images/orig/"),
				headers: {
					Referer: "https://www.famousfix.com/"
				}
			};
		}

		if (false && domain_nosub === "lazygirls.info" && /^img[0-9]*\./.test(domain)) {
			// dead
			// http://img004.lazygirls.info/people/jenna_ortega/jenna_ortega_jenna_ortega_at_gifted_premiere_in_los_anegeles_442017_wXtzOMIf.thumb.jpg
			//   http://img004.lazygirls.info/people/jenna_ortega/jenna_ortega_jenna_ortega_at_gifted_premiere_in_los_anegeles_442017_wXtzOMIf.sized.jpg
			//   http://lzimages.lazygirls.info/jenna_ortega_jenna_ortega_at_gifted_premiere_in_los_anegeles_442017_wXtzOMIf
			//return src.replace(/\.thumb\.jpg$/, ".sized.jpg");
			return src.replace(/:\/\/.*\/([^/.]*)\.[^/]*$/, "://lzimages.lazygirls.info/$1");
		}

		if (false && domain === "lzimages.lazygirls.info") {
			// dead
			// http://lzimages.lazygirls.info/rachel_riley_charity_ice_bucket_challenge_19th_august_2014_9Dyh9BAS.thumb
			//   http://lzimages.lazygirls.info/rachel_riley_charity_ice_bucket_challenge_19th_august_2014_9Dyh9BAS -- 2266x3933
			// http://lzimages.lazygirls.info/jenna_ortega_jenna_ortega_at_gifted_premiere_in_los_anegeles_442017_wXtzOMIf.sized
			//   http://lzimages.lazygirls.info/jenna_ortega_jenna_ortega_at_gifted_premiere_in_los_anegeles_442017_wXtzOMIf
			return src.replace(/\.(?:thumb|sized)$/, "");
		}

		if (domain === "image.way2enjoy.com") {
			// https://image.way2enjoy.com/misc/lazyg/kristin_kreuk/people/kristin_kreuk_cw_network_2013_upfront_in_new_york_16may2013_sud8I4qq.sized.jpg
			//   http://lzimages.lazygirls.info/kristin_kreuk_cw_network_2013_upfront_in_new_york_16may2013_sud8I4qq
			return src.replace(/^[a-z]+:\/\/[^/]*\/misc\/lazyg\/.*?\/([^/]*)\.[^/.]*\.[^/.]*$/,
							   "http://lzimages.lazygirls.info/$1");
		}

		if (domain_nowww === "mobtada.com") {
			// https://www.mobtada.com/resize?src=uploads/images/2017/06/447549.jpg&w=190&h=110&zc=1&q=65
			//   https://www.mobtada.com/uploads/images/2017/06/447549.jpg
			return src.replace(/(:\/\/[^/]*\/)resize.*?[?&]src=([^&]*).*?$/, "$1$2");
		}

		if (domain_nowww === "art-dept.com") {
			// http://www.art-dept.com/media/images/useruploaded/cache/168193_2.jpg
			//   http://www.art-dept.com/media/images/useruploaded/168193.jpg
			// http://art-dept.com/media/images/useruploaded/cache/KC_004_3_3.jpg
			//   http://art-dept.com/media/images/useruploaded/KC_004_3.jpg
			return src.replace(/\/cache\/([^/]*)_[0-9]+(\.[^/.]*)$/, "/$1$2");
		}

		if (domain === "static.stylosophy.it" ||
			// https://static.ellahoy.es/r/845X0/www.ellahoy.es/img/Rihanna-y-Chopard-lanzan-coleccion-de-joyas.jpg
			//   https://static.ellahoy.es/r/999999999999x0/www.ellahoy.es/img/Rihanna-y-Chopard-lanzan-coleccion-de-joyas.jpg
			domain === "static.ellahoy.es" ||
			// https://image.nanopress.it/r/845X0/donna.nanopress.it/img/Rita-Ora-agli-MTV-EMA-2017.jpg
			//   https://image.nanopress.it/r/999999999999x0/donna.nanopress.it/img/Rita-Ora-agli-MTV-EMA-2017.jpg
			//   https://donna.nanopress.it/img/Rita-Ora-agli-MTV-EMA-2017.jpg
			domain === "image.nanopress.it") {
			// https://static.stylosophy.it/r/50x0/www.stylosophy.it/img/Trucco-rosso-occhi-verdi.jpg
			//   https://static.stylosophy.it/r/999999999999x0/www.stylosophy.it/img/Trucco-rosso-occhi-verdi.jpg
			// https://static.stylosophy.it/845X0/www/stylosophy/it/img/Keira-Knightley-in-Mary-Kontratzou.jpg
			//   https://static.stylosophy.it/999999999999x0/www/stylosophy/it/img/Keira-Knightley-in-Mary-Kontratzou.jpg -- doesn't work
			// http://static.stylosophy.it/stshoes/fotogallery/1200X0/199283/dakota-fanning-con-sandali-miu-miu.jpg
			//   http://static.stylosophy.it/stshoes/fotogallery/999999999999X0/199283/dakota-fanning-con-sandali-miu-miu.jpg
			newsrc = src.replace(/(:\/\/[^/]*\/)(r\/+|[^/]+\/+fotogallery\/+)[0-9]+[xX][0-9]+\//, "$1$2999999999999X0/");
			if (newsrc !== src)
				return newsrc;

			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/r\/+[0-9]+[xX][0-9]+\/+([^/]*\.[^/]*\/)/, "http://$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "static.stylosophy.it" ||
			// http://static.ellahoy.es/625X0/www/ellahoy/es/img/Rihanna-y-Chopard-lanzan-coleccion-de-joyas.jpg
			//   http://static.ellahoy.es/999999999999X0/www/ellahoy/es/img/Rihanna-y-Chopard-lanzan-coleccion-de-joyas.jpg
			domain === "static.ellahoy.es") {
			// http://static.stylosophy.it/625X0/www/stylosophy/it/img/Trucco-rosso-occhi-verdi.jpg
			//   http://static.stylosophy.it/999999999999X0/www/stylosophy/it/img/Trucco-rosso-occhi-verdi.jpg
			return src.replace(/(:\/\/[^/]*\/)[0-9]+X[0-9]+\/+www\/+/, "$1999999999999X0/www/");
		}

		if (amazon_container === "nikeinc" &&
			string_indexof(src, "/assets/") >= 0) {
			// https://s3.amazonaws.com/nikeinc/assets/7284/Sp12_WT_HopeSolo_NikePro_01_hd_1600.jpg?1328664887 -- 1600x900
			//   https://s3.amazonaws.com/nikeinc/assets/7284/Sp12_WT_HopeSolo_NikePro_01_original.jpg?1328664887 -- 8226x10980
			return src.replace(/_hd_[0-9]+(\.[^/.]*)$/, "_original$1");
		}

		if ((domain_nowww === "mitazamagica.com" ||
			 // http://mengqi.chenggong.it/WebRoot/StoreIT5/Shops/14375/5162/CB01/6F65/1D03/67D3/3E95/9311/1368/T-ara_-_Mini_Album_Vol.6__91_Day_By_Day_93__ml.png
			 //   http://mengqi.chenggong.it/WebRoot/StoreIT5/Shops/14375/5162/CB01/6F65/1D03/67D3/3E95/9311/1368/T-ara_-_Mini_Album_Vol.6__91_Day_By_Day_93_.png
			 domain === "mengqi.chenggong.it") &&
			string_indexof(src, "/Shops/") >= 0) {
			// https://mitazamagica.com/WebRoot/Store8/Shops/6fe0d17f-85dc-4216-b8f7-030dc2226c0a/56FB/F6F1/63AF/4EB2/7C87/0A48/3523/638D/Tmg-097_ml.jpg
			return src.replace(/_(?:s|m|ml)(\.[^/.]*)$/, "$1");
		}

		if (domain_nowww === "imgbase.info" &&
			string_indexof(src, "/images/safe-wallpapers/") >= 0) {
			// https://www.wallpapervortex.com/wallpaper-7420_black_rock_shooter.html
			//   https://www.imgbase.info/images/safe-wallpapers/anime/black_rock_shooter/aa_7420_black_rock_shooter.jpg
			//   https://www.imgbase.info/images/safe-wallpapers/anime/black_rock_shooter/7420_black_rock_shooter.jpg
			newsrc = src.replace(/\/[a-z]+_([0-9]+[^/]*)$/, "/$1");
			return {
				url: newsrc,
				headers: {
					Referer: "https://www.wallpapervortex.com/wallpaper-" + src.replace(/\/[a-z]+_([0-9]+[^/]*)\.[^/.]*$/, "$1") + ".html"
				}
			};
		}

		if (domain_nowww === "paperlief.com" ||
			// http://celebritywc.com/images100_/jennifer-lawrence-11.jpg
			//   http://celebritywc.com/images/jennifer-lawrence-11.jpg
			domain_nowww === "celebritywc.com" ||
			// https://ya-webdesign.com/images250_/adobe-logo-png-3.png
			//   https://i.ya-webdesign.com/images/adobe-logo-png-3.png
			domain_nowww === "ya-webdesign.com" ||
			// https://www.quotationof.com/images250_/margot-robbie-6.jpg
			//   https://www.quotationof.com/images/margot-robbie-6.jpg
			domain_nowww === "quotationof.com" ||
			// http://7desktopthemes.com/images450_300/rihanna-wallpaper-2.jpg
			//   http://7desktopthemes.com/images/rihanna-wallpaper-2.jpg
			domain_nowww === "7desktopthemes.com" ||
			// http://eskipaper.com/images250_/anime-wallpaper-65.jpg
			//   http://eskipaper.com/images/anime-wallpaper-65.jpg
			domain_nowww === "eskipaper.com") {
			// http://paperlief.com/images450_300/insane-black-rock-shooter-huke-wallpaper-4.jpg
			//   http://www.paperlief.com/images/insane-black-rock-shooter-huke-wallpaper-4.jpg
			// http://paperlief.com/images450_300/insane-black-rock-shooter-wallpaper-1.jpg
			//   http://paperlief.com/images/insane-black-rock-shooter-wallpaper-1.jpg
			return src.replace(/\/images[0-9]+_([0-9]+)?\//, "/images/");
		}

		if (domain_nosub === "anidb.net" && /^cdn[0-9]*(?:-[a-z]+)?\./.test(domain)) {
			// old:
			// https://img7-us.anidb.net/pics/anime/thumbs/50x65/74335.jpg-thumb.jpg
			//   https://img7-us.anidb.net/pics/anime/74335.jpg
			// new:
			// https://cdn-eu.anidb.net/images/65x100/74335.jpg-thumb.jpg
			//   https://cdn-eu.anidb.net/images/main/74335.jpg
			// thanks to jonestly on discord:
			// https://cdn-eu.anidb.net/images/65/186189.jpg-thumb.jpg
			//   https://cdn-eu.anidb.net/images/main/186189.jpg
			return src.replace(/\/(thumbs|images)\/+[0-9]+(?:x[0-9]+)?\/+([0-9]+\.[^/.-?#]*)-thumb\.[^/.]+$/, "/$1/main/$2");
		}

		if (domain === "web-ace.jp") {
			// no www.
			// https://web-ace.jp/rp/1/182_182/img/youngace/contents/39/bungou_small.jpg
			//   https://web-ace.jp/img/youngace/contents/39/bungou_small.jpg
			return src.replace(/\/rp\/[0-9_]+\/[0-9]+_[0-9]+\/img\//, "/img/");
		}

		if (domain_nowww === "classy-girls.com" ||
			// http://dillonmarsh.com/images/thumbnails/diamonds01.jpg
			//   http://dillonmarsh.com/images/diamonds01.jpg
			domain_nowww === "dillonmarsh.com") {
			// https://www.classy-girls.com/images/thumbnails/wMdoDWkZv5/9.jpg
			//   https://www.classy-girls.com/images/wMdoDWkZv5/9.jpg
			return src.replace(/\/images\/+thumbnails\//, "/images/");
		}

		if (domain === "staticdelivery.nexusmods.com") {
			// https://staticdelivery.nexusmods.com/mods/1151/images/thumbnails/32634/32634-1529809154-43464164.jpeg
			//   https://staticdelivery.nexusmods.com/mods/1151/images/32634/32634-1529809154-43464164.jpeg
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/469
			// https://staticdelivery.nexusmods.com/images/952/thumbnails/65484206-1601908447.png
			//   https://staticdelivery.nexusmods.com/images/952/65484206-1601908447.png
			// https://staticdelivery.nexusmods.com/images/2531/thumbnails/63748051-1601839677.png
			//   https://staticdelivery.nexusmods.com/images/2531/63748051-1601839677.png
			return src.replace(/(\/images\/+(?:[0-9]+\/+)?)thumbnails\//, "$1");
		}

		if (domain === "forums.nexusmods.com") {
			// https://forums.nexusmods.com/uploads/profile/photo-thumb-375497.jpg?r_=1509119036
			//   https://forums.nexusmods.com/uploads/profile/photo-375497.jpg?r_=1509119036
			return src.replace(/\/uploads\/profile\/photo-thumb-([0-9]+)/, "/uploads/profile/photo-$1");
		}

		if ((domain_nowww === "kb4images.com" ||
			 // http://digitalimagemakerworld.com/images/natural-wallpapers/36343079-natural-wallpapers-small.jpg
			 //   http://digitalimagemakerworld.com/images/natural-wallpapers/36343079-natural-wallpapers.jpg
			 domain_nowww === "digitalimagemakerworld.com" ||
			 // https://99desktopwallpapers.com/images/selena-gomez-wallpapers/14_Selena-Gomez-small.jpg
			 //   https://99desktopwallpapers.com/images/selena-gomez-wallpapers/14_Selena-Gomez.jpg
			 domain_nowww === "99desktopwallpapers.com") &&
			string_indexof(src, "/images/") >= 0) {
			// http://kb4images.com/images/cute-anime-girl-wallpaper/36611827-cute-anime-girl-wallpaper-small.jpg
			//   http://kb4images.com/images/cute-anime-girl-wallpaper/36611827-cute-anime-girl-wallpaper.jpg
			return src.replace(/-small(\.[^/.]*)$/, "$1");
		}

		if (domain === "pics.me.me") {
			// https://pics.me.me/thumb_anime-real-so-cute-anime-say-i-love-you-6285223.png
			//   https://pics.me.me/anime-real-so-cute-anime-say-i-love-you-6285223.png
			return src.replace(/\/thumb_([^/]*-[0-9]+\.[^/.]*)$/, "/$1");
		}

		if (domain === "image.winudf.com") {
			// https://image.winudf.com/v2/image/Y29tLnNnbS5jdXRlYW5pbWVnaXJsd2FsbHBhcGVyX3NjcmVlbnNob3RzXzNfYzA1NDUxZDk/screen-3.jpg?h=355&fakeurl=1&type=.jpg
			//   https://image.winudf.com/v2/image/Y29tLnNnbS5jdXRlYW5pbWVnaXJsd2FsbHBhcGVyX3NjcmVlbnNob3RzXzNfYzA1NDUxZDk/screen-3.jpg?fakeurl=1&type=.jpg
			//   https://image.winudf.com/v2/image/Y29tLnNnbS5jdXRlYW5pbWVnaXJsd2FsbHBhcGVyX3NjcmVlbnNob3RzXzNfYzA1NDUxZDk/screen-3.jpg?fakeurl=1
			// thanks to eightyy8 on github for reporting: https://github.com/qsniyg/maxurl/issues/1113
			// https://image.winudf.com/v2/image/YWRtaW5faWNfbGF1bmNoZXJfcGxheV9zdG9yZS5wbmdfMTUwMjE2MzE4NzkwMw/icon.png?fakeurl=1&type=.webp
			//   https://image.winudf.com/v2/image/YWRtaW5faWNfbGF1bmNoZXJfcGxheV9zdG9yZS5wbmdfMTUwMjE2MzE4NzkwMw/icon.png?fakeurl=1
			if (/\/v2\/+image\//.test(src)) {
				return {
					url: add_queries(remove_queries(src, ["w", "h"]), {
						type: ".png"
					}),
					headers: {
						Accept: '*/*'
					}
				};
			}
		}

		if (domain === "i.supload.com") {
			// https://i.supload.com/300x0/Skiej6q8x.png
			//   https://i.supload.com/Skiej6q8x.png
			return src.replace(/\/[0-9]+x[0-9]+\//, "/");
		}

		if (domain_nosub === "yaplakal.com" &&
			domain.match(/s[0-9]*\.yaplakal\.com/)) {
			// http://s00.yaplakal.com/pics/pics_preview/6/5/7/11722756.jpg
			//   http://s00.yaplakal.com/pics/pics_original/6/5/7/11722756.jpg
			// https://s00.yaplakal.com/pics/pics_preview/7/8/7/8817787.jpg
			//   https://s00.yaplakal.com/pics/pics_original/7/8/7/8817787.jpg
			return src.replace(/\/pics\/pics_[a-z]+\//, "/pics/pics_original/");
		}

		if (domain === "static.comicvine.com" ||
			// https://static.giantbomb.com/uploads/square_medium/0/329/2767259-journey_20150721143742.jpg
			//   https://static.giantbomb.com/uploads/original/0/329/2767259-journey_20150721143742.jpg
			domain === "static.giantbomb.com" ||
			// https://static.gamespot.com/uploads/square_tiny/1578/15789737/3348796-alteredcarbon.jpg
			//   https://static.gamespot.com/uploads/original/1578/15789737/3348796-alteredcarbon.jpg
			// https://static.gamespot.com/uploads/scale_small/1365/13658182/2673733-geralt_yennefer-size_1920x1200.jpg
			//   https://static.gamespot.com/uploads/original/1365/13658182/2673733-geralt_yennefer-size_1920x1200.png
			domain === "static.gamespot.com" ||
			// thanks to synthtech on github https://github.com/qsniyg/maxurl/issues/115
			// https://comicvine1.cbsistatic.com/uploads/scale_small/13/136525/5341716-1.jpg
			//   https://comicvine1.cbsistatic.com/uploads/original/13/136525/5341716-1.jpg
			// https://giantbomb1.cbsistatic.com/uploads/square_small/1/12482/278025-harrygregson122525.jpg
			//   https://giantbomb1.cbsistatic.com/uploads/original/1/12482/278025-harrygregson122525.jpg
			// https://gamespot1.cbsistatic.com/uploads/square_tiny/mig/9/6/0/6/29606-923549_57927.jpg -- upscaled
			//   https://gamespot1.cbsistatic.com/uploads/original/mig/9/6/0/6/29606-923549_57927.jpg
			domain_nosub === "cbsistatic.com") {
			// https://static.comicvine.com/uploads/square_small/6/67663/6449136-800.jpg
			//   https://static.comicvine.com/uploads/original/6/67663/6449136-800.jpg
			newsrc = src.replace(/(:\/\/[^/]+\/+)uploads\/+[^/]+\/+((?:mig\/+(?:[0-9]\/+){4}|[0-9]+\/+[0-9]+\/+)[0-9]+(?:-[^/]+)?\.)/, "$1uploads/original/$2");
			if (newsrc !== src)
				return add_extensions(newsrc);
			//return src.replace(/\/uploads\/[^/]*\//, "/uploads/original/");
			//return add_extensions(src.replace(/\/uploads\/[^/]*\//, "/uploads/original/"));
		}

		if (false && domain === "preview.ibb.co") {
			// https://preview.ibb.co/gfffEy/russia_players_celebrate_following_their_sides_victory_in_a_penalty_picture_id988998656_story_large_9c8c1668_4d53_4b55_ac5c_f7bd71b7f407.jpg
			//   https://image.ibb.co/gfffEy/russia_players_celebrate_following_their_sides_victory_in_a_penalty_picture_id988998656_story_large_9c8c1668_4d53_4b55_ac5c_f7bd71b7f407.jpg -- doesn't work
			// https://preview.ibb.co/gfffEy/russia_players_celebrate_following_their_sides_victory_in_a_penalty_picture.jpg
			//   https://image.ibb.co/gfffEy/russia_players_celebrate_following_their_sides_victory_in_a_penalty_picture.jpg -- doesn't work
			//return src.replace(/:\/\/[^/]*\/([0-9a-zA-Z]+\/[^/]*_id[0-9]{5,}[_.])/, "://image.ibb.co/$1");
		}

		if (domain_nowww === "ibb.co") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+([a-zA-Z0-9]+)(?:[?#].*)?$/,
				query_for_id: "https://ibb.co/${id}",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/CHV\.obj\.image_viewer\.image\s*=\s*{.*?[^a-zA-Z0-9_]["']?url["']?:["'](.*?)["']/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					let url = JSON_parse('"' + match[1] + '"');

					var obj:BigImageInfoSObject = {
						url: url,
						extra: {
							page: urljoin(resp.finalUrl + "/", url.replace(/.*\/([^/.]*).*?$/, "$1"), true)
						}
					};

					var title = get_meta(resp.responseText, "og:title");
					if (title)
						obj.extra.caption = title;

					return done(obj, 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "i.ibb.co" ||
			// https://image.ibb.co/jYsMbo/Screenshot-2018-07-12-15-56-41.png
			//   https://image.ibb.co/gp6Q2T/Screenshot-2018-07-12-15-56-41.png
			domain === "image.ibb.co" ||
			// https://thumb.ibb.co/c9uL58/2018_06_11_09_46_47.jpg
			//   https://image.ibb.co/mdAtQ8/2018-06-11-09-46-47.jpg
			domain === "thumb.ibb.co" ||
			// https://preview.ibb.co/jYsMbo/Screenshot_2018_07_12_15_56_41.png
			//   https://image.ibb.co/gp6Q2T/Screenshot-2018-07-12-15-56-41.png
			domain === "preview.ibb.co") {
			// https://i.ibb.co/7QrHRXp/tshd398yeae31-copy.jpg
			//   https://i.ibb.co/8bPJd0x/image.jpg
			//   https://i.ibb.co/FX890KY/tshd398yeae31-copy.jpg

			// FIXME: is it -_= too? or just A-Za-z0-9?
			match = src.match(/^[a-z]+:\/\/[^/]*\/+([-_A-Za-z0-9=]+)\/+([^?#]*?)(\.[^/.]*)?(?:[?#].*)?$/);
			if (match) {
				return {
					url: "https://ibb.co/" + match[1],
					is_pagelink: true
				}
			}
		}

		if (false && (domain === "image.ibb.co" ||
					  domain === "preview.ibb.co")) {
			// https://image.ibb.co/gfffEy/russia_players_celebrate_following_their_sides_victory_in_a_penalty_picture_id988998656_story_large_9c8c1668_4d53_4b55_ac5c_f7bd71b7f407.jpg
			//   https://image.ibb.co/gfffEy/russia_players_celebrate_following_their_sides_victory_in_a_penalty_picture_id988998656.jpg
			// https://preview.ibb.co/gfffEy/russia_players_celebrate_following_their_sides_victory_in_a_penalty_picture_id988998656_story_large_9c8c1668_4d53_4b55_ac5c_f7bd71b7f407.jpg
			//   https://preview.ibb.co/gfffEy/russia_players_celebrate_following_their_sides_victory_in_a_penalty_picture_id988998656.jpg
			// https://preview.ibb.co/jYsMbo/Screenshot_2018_07_12_15_56_41.png
			return src.replace(/(_id[0-9]{5,})_[0-9a-z_]+(\.[^/.]*)$/, "$1$2");
		}

		if (domain === "cdn.imagepush.to") {
			// https://cdn.imagepush.to/in/625x2090/i/110/1106/11060/77.jpg
			//   https://cdn.imagepush.to/i/110/1106/11060/77.jpg
			return src.replace(/(:\/\/[^/]*\/)(?:in|out)\/[0-9]+x[0-9]+\//, "$1");
		}

		if (domain === "storage.bhs.cloud.ovh.net") {
			// thanks to vscum on github for reporting: https://github.com/qsniyg/maxurl/issues/1166
			newsrc = src.replace(/(\/v1\/+AUTH_[0-9a-f]+\/+images\/+[^/]+\/+[0-9]+\/+[^/]+)\.[0-9]+x[0-9]+\./, "$1.");
			if (newsrc !== src)
				return add_full_extensions(newsrc, ["mp4", "jpg"]);
		}

		if ((domain_nosub === "luscious.net" && /^w[0-9]+\./.test(domain)) ||
			// thanks to vscum on github for reporting: https://github.com/qsniyg/maxurl/issues/1327
			// https://ah-img.luscious.net/MugenUnix/535453/2fwok18w98z61_01HYG7J264R9DFD4SGVR7BAJBP.315x0.jpg
			//   https://cdnio.luscious.net/MugenUnix/535453/2fwok18w98z61_01HYG7J264R9DFD4SGVR7BAJBP.jpg
			domain === "ah-img.luscious.net") {
			// https://w100.luscious.net/Piclocked/316083/29737493_385675231951060_2443315356056420352_n_01CHCAG9S2B6ZYCNE0STTDBZP3.100x100.jpg
			//   https://cdnio.luscious.net/Piclocked/316083/29737493_385675231951060_2443315356056420352_n_01CHCAG9S2B6ZYCNE0STTDBZP3.jpg
			return {
				url: src.replace(/^[a-z]+:\/\/[^/]+\/+/, "https://cdnio.luscious.net/"),
				can_head: false, // 403
				headers: {
					Referer: "https://www.luscious.net/"
				}
			};
		}

		if (domain_nosub === "luscious.net" && /^(?:cdn[a-z]*|gifs)\./.test(domain)) {
			// https://cdnio.luscious.net/Piclocked/316083/29737493_385675231951060_2443315356056420352_n_01CHCAG9S2B6ZYCNE0STTDBZP3.100x100.jpg
			//   https://cdnio.luscious.net/Piclocked/316083/29737493_385675231951060_2443315356056420352_n_01CHCAG9S2B6ZYCNE0STTDBZP3.jpg
			// https://cdna.luscious.net/avatars/unknown474/resized/380/21856557ca4272c7bdaaff9be64cd0bc.jpg
			//   https://cdna.luscious.net/avatars/unknown474/21856557ca4272c7bdaaff9be64cd0bc.jpg
			newsrc = src
				.replace(/\.[0-9]+x[0-9]+(\.[^/]*)$/, "$1")
				.replace(/\/resized\/[0-9]+\//, "/");
			if (newsrc !== src) {
				return fillobj_urls(add_full_extensions(newsrc), {
					can_head: false,
					headers: {
						Referer: "https://www.luscious.net/"
					}
				});
			}
		}

		if (domain === "d2pqhom6oey9wx.cloudfront.net") {
			// https://d2pqhom6oey9wx.cloudfront.net/img_resize/5997041145b3926972f0d8.jpg
			//   https://d2pqhom6oey9wx.cloudfront.net/img_original/5997041145b3926972f0d8.jpg
			// thanks to fireattack on discord:
			// https://privatter.net/friends_image
			// https://d2pqhom6oey9wx.cloudfront.net/img_thumb/17529669766072bd083e962.jpeg
			//   https://d2pqhom6oey9wx.cloudfront.net/img_original/17529669766072bd083e962.jpeg
			return src.replace(/\/img_(?:thumb|resize)\//, "/img_original/");
		}

		if (domain === "i.gyazo.com") {
			// https://i.gyazo.com/thumb/1000/32311a3c69f875d5dc87f81624416d8a-png.jpg
			//   https://i.gyazo.com/32311a3c69f875d5dc87f81624416d8a.png
			return src.replace(/\/thumb\/[0-9]+\/([0-9a-f]+)-([a-z]+)\.[^/.]*$/, "/$1.$2");
		}

		if (domain === "cdn.theatlantic.com") {
			// https://cdn.theatlantic.com/thumbor/8edqTskrFQWDsYMUD50hWAHzrF4=/0x208:4000x2458/720x405/media/img/mt/2020/03/GettyImages_1129273816/original.jpg
			//   https://cdn.theatlantic.com/assets/media/img/mt/2020/03/GettyImages_1129273816/original.jpg
			newsrc = src.replace(/\/thumbor\/.*\/(?:assets\/+)?media\/+/, "/assets/media/");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "cdn.theatlantic.com" &&
			src.match(/\/assets\/+media\/+(?:[^/]*\/)?img\//)) {
			// https://cdn.theatlantic.com/assets/media/img/photo/2018/06/photos-of-the-week-3/w06_AP18176413538038/main_600.jpg
			//   https://cdn.theatlantic.com/assets/media/img/photo/2018/06/photos-of-the-week-3/w06_AP18176413538038/original.jpg
			// https://cdn.theatlantic.com/assets/media/img/2018/06/WEL_Langewiesche_RaidOpener/640x360.jpg?mod=1530451892
			//   https://cdn.theatlantic.com/assets/media/img/2018/06/05/WEL_Langewiesche_RaidOpener/1920.jpg?1528207593
			//   https://cdn.theatlantic.com/assets/media/img/2018/06/WEL_Langewiesche_RaidOpener/original.jpg?mod=1530451892
			// https://cdn.theatlantic.com/assets/media/img/posts/2018/06/WEL_Langewiesche_RaidPilot/fe02c4147.jpg
			//   https://cdn.theatlantic.com/assets/media/img/posts/2018/06/WEL_Langewiesche_RaidPilot/original.jpg
			// https://cdn.theatlantic.com/assets/media/video/img/2018/06/homeSchool_03_03/hero_wide_640.jpg?1529695674
			//   https://cdn.theatlantic.com/assets/media/video/img/2018/06/homeSchool_03_03/original.jpg?1529695674
			//return src.replace(/\/(?:main_[0-9]+|[0-9]+(?:x[0-9]+)?)(\.[^/.]*)$/, "/original$1");
			return src.replace(/\/[^/.]*(\.[^/.]*)$/, "/original$1");
		}

		if (domain === "media.tag24.de") {
			// https://media.tag24.de/3/6/2/62e521e741273fa4f117.jpg
			//   https://media.tag24.de/0/6/2/62e521e741273fa4f117.jpg
			return src.replace(/(:\/\/[^/]*\/)[0-9]+\//, "$10/");
		}

		if (amazon_container === "customink-iotw-east-prod" ||
			// https://d2fzf9bbqh0om5.cloudfront.net/images/5810/main/rave_on_what_to_wear_to_an_edm_concert.jpg?1458661880
			//   https://d2fzf9bbqh0om5.cloudfront.net/images/5810/original/rave_on_what_to_wear_to_an_edm_concert.jpg?1458661880
			domain === "d2fzf9bbqh0om5.cloudfront.net") {
			// https://s3.amazonaws.com/customink-iotw-east-prod/images/87525/large/3FFB96AD-5057-48B2-B198-59C9FEE377D1.jpeg?1529842961
			//   https://s3.amazonaws.com/customink-iotw-east-prod/images/87525/original/3FFB96AD-5057-48B2-B198-59C9FEE377D1.jpeg?1529842961
			return src.replace(/(\/images\/[0-9]+\/)[^/]*\//, "$1original/");
		}

		if (domain === "customink-prod.imgix.net") {
			// https://customink-prod.imgix.net/photos/system/images/96097/large/HAF-2019.jpg?ixlib=rails-4.0.0&w=1448&h=745&fit=crop&crop=faces&fm=jpg&q=85&s=2bfdbac6eb3c987146a62891300efb59
			//   https://s3.amazonaws.com/customink-iotw-east-prod/images/96097/original/HAF-2019.jpg
			return src.replace(/^[a-z]+:\/\/[^/]+\/+photos\/+system\/+(images\/+[0-9]+\/+[a-z]+\/+[^/?#]+)(?:[?#].*)?$/, "https://s3.amazonaws.com/customink-iotw-east-prod/$1");
		}

		if (domain_nowww === "mypokecard.com") {
			// http://www.mypokecard.com/my/galery/thumbs/tRLELnxn16sc.jpg?1530649984
			//   http://www.mypokecard.com/my/galery/tRLELnxn16sc.jpg?1530649984
			return src.replace(/\/galery\/thumbs\//, "/galery/");
		}

		if (domain === "media.women.com" &&
			string_indexof(src, "/images/images/") >= 0) {
			// https://media.women.com/images/images/000/144/217/large/kirsty-tg-146655-unsplash.jpg?1530552637
			//   https://media.women.com/images/images/000/144/217/original/kirsty-tg-146655-unsplash.jpg?1530552637
			return src.replace(/\/[a-z]+\/([^/]*)$/, "/original/$1");
		}

		if (domain_nowww === "alternathistory.com") {
			// http://www.alternathistory.com/files/resize/users/user675/Rolls-Royce_Crecy-01-680x299.jpg
			//   http://www.alternathistory.com/files/users/user675/Rolls-Royce_Crecy-01.jpg
			return src.replace(/\/files\/+resize(\/+.*\/+[^/]*)-[0-9]+x[0-9]+(\.[^/.]*)$/, "/files$1$2");
		}

		if (domain === "img.velvet.by") {
			// http://img.velvet.by/files/resize/userfiles/309/moda_2_4-535x803.jpg
			//   http://img.velvet.by/files/userfiles/309/moda_2_4.jpg
			return src.replace(/\/files\/+resize\/+(userfiles\/+[0-9]+\/+[^/]*)-[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/,
							   "/files/$1$2");
		}

		if (domain_nowww === "mtvwe.com") {
			// http://mtvwe.com/vpic.php?w=280&h=&f=/upload/news/2018/07/03/thumbweb12345678910.jpg
			//   http://www.mtvwe.com/upload/news/2018/07/03/thumbweb12345678910.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+vpic\.php\?(?:.*&)?f=([^&]+).*?$/, "$1");
			if (newsrc !== src)
				return urljoin(src, newsrc, true);
			//return src
			//	.replace(/\/vpic\.php.*?[?&]f=([^&]*).*?$/, "/$1")
			//	.replace(/(:\/\/[^/]*\/)\/*/, "$1");
		}

		if (domain === "yahoo.tw.weibo.com") {
			// https://yahoo.tw.weibo.com/thumbnail/93f8d29dly1fly3yibxtzj20f00exwg2.jpg
			//   https://yahoo.tw.weibo.com/bmiddle/93f8d29dly1fly3yibxtzj20f00exwg2.jpg
			//   https://yahoo.tw.weibo.com/large/93f8d29dly1fly3yibxtzj20f00exwg2.jpg
			return src.replace(/(:\/\/[^/]+\/)[a-z]+\//, "$1large/");
		}

		if (domain === "mobile.pic.people.com.cn") {
			// http://mobile.pic.people.com.cn/thumbs/320/426/data/cms/NMediaFile/2018/0619/WIRELESS201806190920000136814656512.jpg
			//   http://mobile.pic.people.com.cn/data/cms/NMediaFile/2018/0619/WIRELESS201806190920000136814656512.jpg
			return src.replace(/\/thumbs\/+[0-9]+\/+[0-9]+\/+/, "/");
		}

		if (domain === "images.asianstar.cz") {
			// http://images.asianstar.cz/upload/profily/1caed/slider_a0b347b222dee02660c4b8c47d817632.jpg - 640x400
			//  http://images.asianstar.cz/upload/profily/1caed/a0b347b222dee02660c4b8c47d817632.jpg -- 1570x1038
			// http://images.asianstar.cz/upload/gallery/2/35292/c_22ad86dbfd13cc6f3574790c8c1e99fe.jpg -- 280x280
			//   http://images.asianstar.cz/upload/gallery/2/35292/r_22ad86dbfd13cc6f3574790c8c1e99fe.jpg -- 480x600
			//   http://images.asianstar.cz/upload/gallery/2/35292/22ad86dbfd13cc6f3574790c8c1e99fe.jpg -- 635x794
			// http://images.asianstar.cz/upload/users/crop_e2478_3384.jpeg -- 397x397
			//   http://images.asianstar.cz/upload/users/e2478_3384.jpeg -- 636x641
			// http://images.asianstar.cz/upload/profily/8ce81/thumbnail_c9f4ea39e4ab3ba551618c7d02c2f912.jpg -- 400x400
			//   http://images.asianstar.cz/upload/profily/8ce81/slider_c9f4ea39e4ab3ba551618c7d02c2f912.jpg -- 640x400
			//   http://images.asianstar.cz/upload/profily/8ce81/c9f4ea39e4ab3ba551618c7d02c2f912.jpg 1920x1080
			// http://images.asianstar.cz/upload/clanky/f01ef/thumbnail_b450207590d5ace4ecae92eec7b5b0ae.jpg -- 240x150
			//   http://images.asianstar.cz/upload/clanky/f01ef/b450207590d5ace4ecae92eec7b5b0ae.jpg -- 960x960
			// todo: improve
			return src.replace(/\/[a-z]+_([^/]*)$/, "/$1");
		}

		if (domain === "images-cache.asianstar.cz") {
			// http://images-cache.asianstar.cz/upload/gallery/2/39646/r_f46b2ef581ba1c00a157e50fad5e1e2c.jpg
			//   http://images.asianstar.cz/upload/gallery/2/39646/f46b2ef581ba1c00a157e50fad5e1e2c.jpg
			return src.replace(/:\/\/[^/]*\//, "://images.asianstar.cz/");
		}

		if (domain === "picservice.qimai.cn") {
			// https://picservice.qimai.cn/get/http://mmbiz.qpic.cn/mmbiz_jpg/Kia46cB1ib34XkXOEYXhQQ4Gc0me6t7ViaM9ZLLZwpia1CO6VdOQA92PPZzjwHaPET679QlLMmp0NHCA20eccraIlA/640?wx_fmt=jpeg
			//   http://mmbiz.qpic.cn/mmbiz_jpg/Kia46cB1ib34XkXOEYXhQQ4Gc0me6t7ViaM9ZLLZwpia1CO6VdOQA92PPZzjwHaPET679QlLMmp0NHCA20eccraIlA/640?wx_fmt=jpeg
			return src.replace(/^[a-z]+:\/\/[^/]*\/+get\/+(https?:)/, "$1");
		}

		if (false && (domain_nowww === "wxzixun.com" ||
			// https://www.zhihutai.com/p/https://mmbiz.qpic.cn/mmbiz_jpg/Kia46cB1ib34X94nIuVuVGVLL0SqjImK3alXynheIa0MSjQUDZ5Hho1eVozkLiclU9AZiccg23JwvysJVZVC97ePMQ/640?wx_fmt=jpeg
			//   https://mmbiz.qpic.cn/mmbiz_jpg/Kia46cB1ib34X94nIuVuVGVLL0SqjImK3alXynheIa0MSjQUDZ5Hho1eVozkLiclU9AZiccg23JwvysJVZVC97ePMQ/0
			domain_nowww === "zhihutai.com")) {
			// both domains are down
			// https://wxzixun.com/p/https://mmbiz.qpic.cn/mmbiz_jpg/A1IN49X2ibV8Znz9icmdicib1EjRJblrAiaNT2EWLcNXZRIhsQ6uqsFYFrGCbEM6OQFKqfIYmEj8k1C8cYIXe06ic18g/640?wx_fmt=jpeg
			//   https://mmbiz.qpic.cn/mmbiz_jpg/A1IN49X2ibV8Znz9icmdicib1EjRJblrAiaNT2EWLcNXZRIhsQ6uqsFYFrGCbEM6OQFKqfIYmEj8k1C8cYIXe06ic18g/640?wx_fmt=jpeg
			return src.replace(/^[a-z]+:\/\/[^/]*\/p\//, "");
		}

		if (domain === "mediaday.co.kr" ||
			// https://secretvt.com/uploads/cache/post/2019/03/thumb-448dfd0f756034f8be2fdd78bcb44a6a_460x0.jpg
			//   https://secretvt.com/uploads/post/2019/03/448dfd0f756034f8be2fdd78bcb44a6a.jpg
			domain_nowww === "secretvt.com" ||
			// https://file.candlemystar.com/cache/post/2019/09/thumb-320c0273b64098c8dab3746b5542d697_400x400.png
			//   https://file.candlemystar.com/post/2019/09/320c0273b64098c8dab3746b5542d697.png
			// https://file.candlemystar.com/cache/member_photo/2019/09/thumb-6b76ed1bae0e543a1b4aafe7c68b253f_64x64.jpg
			//   https://file.candlemystar.com/member_photo/2019/09/6b76ed1bae0e543a1b4aafe7c68b253f.jpg
			domain === "file.candlemystar.com" ||
			// http://5rs-1.com/uploads/cache/post/2018/12/thumb-5a2a42aa82d6f9a23efd2e24bc048d28_600x0.jpg
			//   http://5rs-1.com/uploads/post/2018/12/5a2a42aa82d6f9a23efd2e24bc048d28.jpg
			domain_nowww === "5rs-1.com") {
			// http://mediaday.co.kr/uploads/cache/editor/2018/06/thumb-6b0c51b23bb282ff8113e620c06e6d40_1529461823064781800_600x0.jpg
			//   http://mediaday.co.kr/uploads/editor/2018/06/6b0c51b23bb282ff8113e620c06e6d40_1529461823064781800.jpg
			// http://mediaday.co.kr/uploads/cache/post/2018/07/thumb-357f8c7e9621a870cfc1c1daaf96b5dc_1530693023034070800_214x180.jpg
			//   http://mediaday.co.kr/uploads/post/2018/07/357f8c7e9621a870cfc1c1daaf96b5dc_1530693023034070800.jpg
			return src.replace(/\/cache\/+([_a-z]+\/+[0-9]{4}\/+[0-9]{2}\/+)thumb-([0-9a-f]+(?:_[0-9]+)?)_[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/,
							   "/$1$2$3");
		}

		// https://github.com/cutechan/cutechan
		if (domain === "up.kpop.re" ||
			// https://store.kpop.events/thumb/79/79cf99bde9d9902162c07af516f7e855872ac5.jpg
			//   https://store.kpop.events/src/79/79cf99bde9d9902162c07af516f7e855872ac5.jpg
			domain === "store.kpop.events") {
			// https://up.kpop.re/thumb/79/79cf99bde9d9902162c07af516f7e855872ac5.jpg
			//   https://up.kpop.re/src/79/79cf99bde9d9902162c07af516f7e855872ac5.jpg
			// https://up.kpop.re/src/19/7240a6e374ba73121b94b1f3e5dcb43fae3efb.jpg/int-136946.jpg
			//   https://up.kpop.re/src/19/7240a6e374ba73121b94b1f3e5dcb43fae3efb.jpg
			// https://up.kpop.re/thumb/65/c0ed73284517c537aad253925185ba500bbf91.jpg
			//   https://up.kpop.re/src/65/c0ed73284517c537aad253925185ba500bbf91.png
			newsrc = src.replace(/(:\/\/[^/]*\/)[a-z]+(\/[0-9a-f]{2}\/[0-9a-f]+\.[^/.]*)(?:\/[^/]*)?$/, "$1src$2");
			if (newsrc !== src)
				return add_extensions(newsrc);
		}

		if (domain === "st.kp.yandex.net" &&
			string_indexof(src, "/images/") >= 0) {
			// https://st.kp.yandex.net/images/kadr/sm_2599504.jpg
			//   https://st.kp.yandex.net/images/kadr/2599504.jpg
			// https://st.kp.yandex.net/images/kadr/sm_226485_03072005195621_HALLEBERRY12.jpg
			//   https://st.kp.yandex.net/images/kadr/226485_03072005195621_HALLEBERRY12.jpg
			// https://st.kp.yandex.net/images/actor_iphone/iphone360_40779.jpg
			//   https://st.kp.yandex.net/images/actor_original/40779.jpg
			return src
				.replace(/_iphone\/+iphone[0-9]+_([0-9]+\.[^/.]*)(?:[?#].*)?$/, "_original/$1")
				.replace(/\/[a-z]+_([0-9]+(?:_[^/]*)?\.[^/.]*)$/, "/$1");
		}

		if (domain_nowww === "startfilm.ru" && string_indexof(src, "/images/") >= 0) {
			// https://www.startfilm.ru/images/base/person/07_08_16/sm_96797_73399_naomie_harris_.jpg
			//   https://www.startfilm.ru/images/base/person/07_08_16/96797_73399_naomie_harris_.jpg
			// https://www.startfilm.ru/images/base/film/f_671539/film_startfilmru1449026.jpeg
			//   https://www.startfilm.ru/images/base/film/f_671539/startfilmru1449026.jpeg
			return src
				.replace(/\/sm_([0-9]+_[^/]*)$/, "/$1")
				.replace(/(\/film\/+f_[0-9]+\/+)film_/, "$1");
		}

		if (domain_nowww === "publicfeet.com") {
			// http://publicfeet.com/public/media/front/post/img/t1414285.jpg
			//   http://publicfeet.com/public/media/front/post/img/1414285.jpg
			return src.replace(/\/img\/t([0-9]+\.[^/.]*)$/, "/img/$1");
		}

		if (domain_nowww === "twatis.com") {
			// can't find a working example url anymore, main site seems to use pornpics.com
			// http://twatis.com/data/07012018/324422718/thumb.jpeg
			//   http://twatis.com/data/07012018/324422718/photo.jpeg
			return src.replace(/\/thumb(\.[^/.]*)$/, "/photo$1");
		}

		if (false && domain === "images.starlets.photos") {
			// dead
			// http://images.starlets.photos/rachel-riley/17027-large.jpg
			//   http://images.starlets.photos/rachel-riley/17027-original.jpg
			return src.replace(/(\/[0-9]+-)[a-z]+(\.[^/.]*)$/, "$1original$2");
		}

		if (domain === "s.smutty.com" ||
			domain === "i.smutty.com") {
			// https://s.smutty.com/media_smutty_2/d/i/r/t/m/dirtyukguy-8qxdg-6b9be5.jpg
			//   https://s.smutty.com/media_smutty_2/d/i/r/t/p/dirtyukguy-8qxdg-6b9be5.jpg
			//   https://s.smutty.com/media_smutty_2/d/i/r/t/b/dirtyukguy-8qxdg-6b9be5.jpg -- 2516x4200
			return src.replace(/\/[a-z]\/+([^/]*)(?:[?#].*)?$/, "/b/$1");
		}

		if (domain_nowww === "welovesexyfeet.com" ||
			// http://podolatria.net/cdn/upload/record/nlmrmlolnmmt/kristin-kreuk-feet-t270x337.jpg
			//   http://podolatria.net/cdn/upload/record/nlmrmlolnmmt/kristin-kreuk-feet.jpg
			domain_nowww === "podolatria.net" ||
			// http://img.ibxk.com.br/2018/07/16/16162511563028-t474x237.jpg
			//   http://img.ibxk.com.br/2018/07/16/16162511563028.jpg
			domain === "img.ibxk.com.br") {
			// http://welovesexyfeet.com/cdn/upload/record/nlmtlomqmplo/rachel-riley-feet-t270x450.jpg
			//   http://welovesexyfeet.com/cdn/upload/record/nlmtlomqmplo/rachel-riley-feet.jpg
			return src.replace(/-t[0-9]+x[0-9]+(\.[^/.]*)$/, "$1");
		}

		if (domain_nowww === "hotflick.net" ||
			amazon_container === "hotflicknet") {
			// http://hotflick.net/u/n/Y2CdwHWG5q/tn/5hPrKMLsdZpFjpT.jpg
			//   http://hotflicknet.s3.amazonaws.com/u/n/Y2CdwHWG5q/5hPrKMLsdZpFjpT.jpg
			// http://www.hotflick.net/u/n/2746164/tn/180_r/victoria-justice-jon-mckee-photoshoot.jpg
			//   http://www.hotflick.net/u/n/2746164/victoria-justice-jon-mckee-photoshoot.jpg
			// https://hotflicknet.s3.amazonaws.com/u/n/5058631/tn/natalie-portman-marie-claire-magazine-france-december-2016-2.jpg
			//   https://hotflicknet.s3.amazonaws.com/u/n/5058631/natalie-portman-marie-claire-magazine-france-december-2016-2.jpg
			// https://s3.amazonaws.com/hotflicknet/u/n/5058631/tn/natalie-portman-marie-claire-magazine-france-december-2016-2.jpg
			//   https://hotflicknet.s3.amazonaws.com/u/n/5058631/natalie-portman-marie-claire-magazine-france-december-2016-2.jpg
			// https://www.hotflick.net/flicks/2011_Abduction/tn149/fhd011ABD_Lily_Collins_029.jpg
			//   https://www.hotflick.net/flicks/2011_Abduction/fhd011ABD_Lily_Collins_029.jpg
			// https://www.hotflick.net/flicks/2009_The_Blind_Side/Thumb/009BLS_Lily_Collins_007.jpg
			//   https://www.hotflick.net/flicks/2009_The_Blind_Side/009BLS_Lily_Collins_007.jpg
			return src
				.replace(/(:\/\/[^/]*\/.*\/[0-9]+\/)tn\/[0-9]+_[a-z]+\/([^/]*)$/, "$1$2")
				.replace(/\/+(?:tn[0-9]+|Thumb)\/+([^/]*)(?:[?#].*)?$/, "/$1")
				.replace(/:\/\/(?:[^/.]*-)?s3\.amazonaws\.com\/hotflicknet\/(.*\/)tn\/([^/]*)$/, "://hotflicknet.s3.amazonaws.com/$1$2")
				.replace(/:\/\/[^/]*\/(.*\/)tn\/([^/]*)$/, "://hotflicknet.s3.amazonaws.com/$1$2");
		}

		if (domain_nowww === "seniorclassaward.com" ||
			// https://www.raincoast.com/images/sized/images/uploads/covers/9781452153230-0x90.jpg
			//   https://www.raincoast.com/images/uploads/covers/9781452153230.jpg
			domain_nowww === "raincoast.com" ||
			// http://www.zocalo.com.mx/images/sized/images/uploads/articles/emmawat-621x354.jpg
			//   http://www.zocalo.com.mx/images/uploads/articles/emmawat.jpg
			domain_nowww === "zocalo.com.mx") {
			// http://www.seniorclassaward.com/images/sized/images/athletes/Rachel_Riley_headshot-150x220.jpg
			//   http://www.seniorclassaward.com/images/athletes/Rachel_Riley_headshot.jpg
			return src.replace(/\/images\/sized(\/images\/.*)-[0-9]+x[0-9]+(\.[^/.]*)$/, "$1$2");
		}

		if (domain_nowww === "hentairing.com") {
			// http://www.hentairing.com/thumb/1/width-248/ada-wong-tomoki-resident-evil.jpg
			//   http://www.hentairing.com/thumb/1/ada-wong-tomoki-resident-evil.jpg?width=150
			//   http://www.hentairing.com/thumb/1/ada-wong-tomoki-resident-evil.jpg
			return src
				.replace(/\/(?:width|height)-[0-9]+\/([^/]*)(?:[?#].*)?$/, "/$1")
				.replace(/\?.*/, "");
		}

		if (domain_nosub === "enterdesk.com" && /^up\./.test(domain)) {
			// https://up.sc.enterdesk.com/edpic_360_360/f2/d9/dd/f2d9dd6f218ddcd958e3726305285b1e.jpg -- 450x300
			//   https://up.sc.enterdesk.com/edpic_source/f2/d9/dd/f2d9dd6f218ddcd958e3726305285b1e.jpg -- 5472x3648
			return src.replace(/\/edpic_[0-9]+(?:_[0-9]+)?\//, "/edpic_source/");
		}

		if (domain_nosub === "gtimg.com" && /^img[0-9]*\./.test(domain)) {
			// http://img1.gtimg.com/18/1852/185277/18527786_640x640_281.jpg
			//   http://img1.gtimg.com/18/1852/185277/18527786.jpg
			// doesn't work for all:
			// https://img1.gtimg.com/rcdimg/20190527/04/8447719908_227x148.jpg
			//   https://img1.gtimg.com/84/8447/844771/8447719908.jpg -- doesn't work either
			return {
				url: src.replace(/_[0-9]+x[0-9]+(?:_[0-9]+)?(\.[^/.]*)$/, "$1"),
				can_head: false // wrong content-length, and GET forces download (but not HEAD)
			};
		}

		if (domain_nosub === "zol-img.com.cn") {
			// https://desk-fd.zol-img.com.cn/t_s960x600c5/g1/M08/06/01/Cg-4jlSTiHOIQBPhAATA0Y9zzg8AAPFzAOGmKkABMDp424.jpg
			//   https://desk-fd.zol-img.com.cn/g1/M08/06/01/Cg-4jlSTiHOIQBPhAATA0Y9zzg8AAPFzAOGmKkABMDp424.jpg
			// https://sjbz-fd.zol-img.com.cn/t_s320x510c/g5/M00/0A/07/ChMkJljBGoeIcgh9AADu6XCSFkUAAamGgBbQ1kAAO8B221.jpg
			//   https://sjbz-fd.zol-img.com.cn/g5/M00/0A/07/ChMkJljBGoeIcgh9AADu6XCSFkUAAamGgBbQ1kAAO8B221.jpg
			// http://2c.zol-img.com.cn/article/13_310x310/70/li6mTksSxuQ.jpg
			//   http://2c.zol-img.com.cn/article/13/70/li6mTksSxuQ.jpg
			return src
				.replace(/(:\/\/[^/]*\/)t_[0-9a-z]+\//, "$1")
				.replace(/(\/article\/[0-9]+)_[0-9]+x[0-9]+\//, "$1/");
		}

		if (domain === "img.faxing11.com" ||
			// http://img.pipimi.com/img/p99.pstatp.com/large/pgc-image/1540166295774bca2128e6f.jpg
			//   http://p99.pstatp.com/origin/pgc-image/1540166295774bca2128e6f.jpg
			domain === "img.pipimi.com" ) {
			// http://img.faxing11.com/img/p3.pstatp.com/large/pgc-image/1525594197806a4d5686dc4.jpg
			//   http://p3.pstatp.com/large/pgc-image/1525594197806a4d5686dc4.jpg
			return src.replace(/^[a-z]+:\/\/[^/]*\/img\//, "http://");
		}

		if (domain_nowww === "bifaxing.com") {
			// http://www.bifaxing.com/gpPic/600/0/p1.pstatp.com/large/757400040333c7cb0ce6
			//   http://p1.pstatp.com/large/757400040333c7cb0ce6
			return src.replace(/^[a-z]+:\/\/[^/]*\/gpPic\/+[0-9]+\/+[0-9]+\/+([^/]*\.[^/]*)/, "http://$1");
		}

		if (domain === "static.congnghe.vn" ||
			// https://congnghe.vn/tinmoi/store/techmag/thumb/30092017/218/top-10-nu-minh-tinh-trung-quoc-hut-khach-cho-thuong-hieu-dai-dien-2094125.jpg.600.0.jpg
			//   https://congnghe.vn/tinmoi/store/techmag/thumb/30092017/218/2094125.jpg
			domain_nowww === "congnghe.vn") {
			// http://static.congnghe.vn/tinmoi/store/techmag/thumb/30092017/218/top-10-nu-minh-tinh-trung-quoc-hut-khach-cho-thuong-hieu-dai-dien-2094125.jpg.600.0.jpg
			//   http://static.congnghe.vn/tinmoi/srv_thumb.ashx?source=218&w=600&h=0&f=store\techmag\thumb\30092017\218\2094125.jpg&title=top-10-nu-minh-tinh-trung-quoc-hut-khach-cho-thuong-hieu-dai-dien
			//   http://static.congnghe.vn/tinmoi/store/techmag/thumb/30092017/218/2094125.jpg
			// http://static.congnghe.vn/tinmoi/srv_thumb.ashx?source=202&w=110&h=96&f=store\techmag\thumb\05072018\202\2132322.jpg&title=nguoi-la-ma-co-dai-da-khien-can-benh-kinh-khung-nay-hoanh-hanh-va-lay-lan-xuyen-luc-dia
			//   http://static.congnghe.vn/tinmoi/store/techmag/thumb/05072018/202/2132322.jpg
			newsrc = src.replace(/\/srv_thumb\.ashx.*?[?&]f=([^&]*).*/, "/$1");
			if (newsrc !== src)
				return newsrc.replace(/\\/g, "/");

			return src.replace(/\/[^/]*-([0-9]+\.[^/.]*)\.[0-9]+\.[0-9]+\.[^/.]*$/, "/$1");
		}

		if (domain === "images.foody.vn") {
			// https://images.foody.vn/res/g24/238192/prof/s640x400/foody-mobile-tan-bot-2-jpg-850-636003866052957560.jpg
			//   https://images.foody.vn/res/g24/238192/prof/s/foody-mobile-tan-bot-2-jpg-850-636003866052957560.jpg
			return src.replace(/\/s[0-9]+x[0-9]+\/([^/]*)$/, "/s/$1");
		}

		if (domain === "programma.sorrisi.com" ||
			// https://shamra.sy/uploads/media/cache/news_article/uploads/news_thumbs/155991063352.jpg
			//   https://shamra.sy/uploads/news_thumbs/155991063352.jpg
			domain_nowww === "shamra.sy") {
			// https://programma.sorrisi.com/guidatv/uploads/media/cache/epg_program_large/uploads/epg/images/programseries/0/0/originale/272826.jpg
			//   https://programma.sorrisi.com/guidatv/uploads/epg/images/programseries/0/0/originale/272826.jpg
			return src.replace(/\/uploads\/+media\/+cache\/+[^/]*\/+uploads\//, "/uploads/");
		}

		if (domain_nowww === "vidofa.com") {
			// http://www.vidofa.com/module/thumb/sr.php?src=http://dl64.vidofa.com/srv//files/thumbs/2018/06/30//1530342529fd517-30.jpg
			//   http://dl64.vidofa.com/srv//files/thumbs/2018/06/30//1530342529fd517-30.jpg
			newsrc = src.replace(/.*?\/module\/+thumb\/+sr\.php\?(?:.*&)?src=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nowww === "free4kwallpapers.com") {
			// https://free4kwallpapers.com/uploads/originals/2015/08/12/black-rock-shooter-anime-wallpaper-2560x1600-640.jpg
			//   https://free4kwallpapers.com/no-watermarks/originals/2015/08/12/black-rock-shooter-anime-wallpaper-2560x1600-640.jpg
			// https://free4kwallpapers.com/uploads/wallpaper/15/08/12/black-rock-shooter-anime-wallpaper-2560x1600-640-1024x768-wallpaper.jpg
			//   https://free4kwallpapers.com/no-watermarks/originals/2015/08/12/black-rock-shooter-anime-wallpaper-2560x1600-640.jpg
			return src
				.replace(/\/uploads\/+wallpaper\/+([0-9]{2}\/.*)-[0-9]+x[0-9]+-wallpaper(\.[^/.]*)$/, "/uploads/originals/20$1$2")
				.replace(/\/uploads\/+originals\//, "/no-watermarks/originals/");
		}

		if (domain_nosub === "webnode.com.br" ||
			// https://kecy-maly-holky.webnode.cz/_files/200000055-e5fbde6f5b/200/KILL%20YOUR%20DARLINGS%2003.jpg
			//   https://kecy-maly-holky.webnode.cz/_files/200000055-e5fbde6f5b/KILL%20YOUR%20DARLINGS%2003.jpg
			domain_nosub === "webnode.cz" ||
			// http://files.twilightstories.webnode.sk/system_preview_detail_200000258-99ace9aa71-public/008.jpg
			//   http://files.twilightstories.webnode.sk/200000258-99ace9aa71-public/008.jpg
			domain_nosub === "webnode.sk" ||
			// https://votestars5.webnode.com/_files/system_preview_200000015-8201482fb4-public/Fifth-Harmony3.jpg
			//   https://votestars5.webnode.com/_files/200000015-8201482fb4-public/Fifth-Harmony3.jpg
			domain_nosub === "webnode.com") {
			// https://predadoresblack.webnode.com.br/_files/system_preview_detail_200000000-c9bd6ca3b5-public/thumbbig-124889.jpg
			//   https://predadoresblack.webnode.com.br/_files/200000000-c9bd6ca3b5-public/thumbbig-124889.jpg
			return src.replace(/(:\/\/(?:files\.[^/]*\.[^/.]*\.[^/]*\/+|[^/]*\/+_files\/+))(?:[^/]*_)?([0-9]+-[0-9a-f]+(?:-[a-z]+)?\/)+(?:[0-9]+\/+)?([^/]*)$/, "$1$2$3");
		}

		if (amazon_container === "cdn.roosterteeth.com") {
			// https://s3.amazonaws.com/cdn.roosterteeth.com/uploads/images/3bc8b57e-f691-4657-8a82-2339f07ce0e4/sm/Titch110151cb4503ddb1f.jpg
			//   https://s3.amazonaws.com/cdn.roosterteeth.com/uploads/images/3bc8b57e-f691-4657-8a82-2339f07ce0e4/original/Titch110151cb4503ddb1f.jpg
			return src.replace(/(\/images\/[-0-9a-f]+\/)[a-z]+(\/[^/]*)$/, "$1original$2");
		}

		if (domain_nowww === "wallpaperk.com") {
			// http://www.wallpaperk.com/wallpapers/resoluciones/16/anime-impresionantes-chicas_1024x600_4719.jpg
			//   http://www.wallpaperk.com/wallpapers/anime-impresionantes-chicas-4719.jpg
			return src.replace(/\/resoluciones\/[0-9]+\/([^/]*)_[0-9]+x[0-9]+_([0-9]+\.[^/.]*)$/, "/$1-$2");
		}

		if (domain === "pic.58pic.com" ||
			// http://ku.90sjimg.com/back_pic/03/62/07/2457a98b1f1e8c9.jpg!/fw/226/quality/90/unsharp/true/compress/true/canvas/226x105a0a0/cvscolor/FFFFFFFF
			//   http://ku.90sjimg.com/back_pic/03/62/07/2457a98b1f1e8c9.jpg
			domain_nosub === "90sjimg.com" ||
			domain === "pic.qiantucdn.com") {
			// http://pic.58pic.com/58pic/17/35/09/58r58PICV96_1024.jpg!/fw/1024/watermark/url/L2ltYWdlcy93YXRlcm1hcmsveGlhb3R1LnBuZw==/align/center
			//   http://pic.58pic.com/58pic/17/35/09/58r58PICV96_1024.jpg
			// http://pic.qiantucdn.com/58pic/17/35/09/58r58PICV96_1024.jpg!/fw/1024/watermark/url/L2ltYWdlcy93YXRlcm1hcmsveGlhb3R1LnBuZw==/align/center
			//   http://pic.qiantucdn.com/58pic/17/35/09/58r58PICV96_1024.jpg
			return src.replace(/!.*/, "");
		}


		if (domain === "img.wallpapersafari.com" ||
			// https://cdn.wallpapersafari.com/2/15/jLsJPf.jpg
			//   https://wallpapersafari.com/w/jLsJPf -- original page
			domain === "cdn.wallpapersafari.com") {
			// https://img.wallpapersafari.com/desktop/1536/864/85/66/Na4mby.jpg
			//   https://img.wallpapersafari.com/85/66/Na4mby.jpg
			// https://img.wallpapersafari.com/img720/12/74/SW1XU0.jpg
			//   https://img.wallpapersafari.com/12/74/SW1XU0.jpg
			newsrc = src
				.replace(/\/img[0-9]+\//, "/")
				.replace(/\/desktop\/+[0-9]+\/+[0-9]+\//, "/");
			if (newsrc !== src)
				return newsrc;

			match = src.match(/^[a-z]+:\/\/[^/]+\/+[0-9]+\/+[0-9]+\/+([^/.]+)\.[^/.]+$/);
			if (match) {
				return {
					url: src,
					extra: {
						page: "https://www.wallpapersafari.com/w/" + match[1]
					}
				};
			}
		}

		if (domain === "mcdn.wallpapersafari.com") {
			// https://mcdn.wallpapersafari.com/medium/35/4/UEQyne.jpg
			//   https://cdn.wallpapersafari.com/35/4/UEQyne.jpg
			// https://mcdn.wallpapersafari.com/small/41/65/C0aESe.jpg
			//   https://cdn.wallpapersafari.com/41/65/C0aESe.jpg
			return src.replace(/:\/\/mcdn(\.[^/]*\/)(?:medium|small)\/+/, "://cdn$1");
		}

		if ((domain_nosub === "fjcdn.com" && /^static[0-9]*\./.test(domain)) ||
			domain_nosub === "funnyjunk.com") {
			// https://static.fjcdn.com/pictures/Anime+and+related+wallpaper+dump+please+help+me+expand+my_937a43_5302360.jpg
			//   https://static.fjcdn.com/large/pictures/93/7a/937a43_5302360.jpg
			// https://bigmemes.funnyjunk.com/pictures/Anime+and+related+wallpaper+dump+please+help+me+expand+my_937a43_5302360.jpg
			//   https://bigmemes.funnyjunk.com/large/pictures/93/7a/937a43_5302360.jpg
			// https://static1.fjcdn.com/thumbnails/comments/Blank+_8610876e6fec56649d73447e057639e3.jpg
			//   https://static1.fjcdn.com/comments/Blank+_8610876e6fec56649d73447e057639e3.jpg
			// https://hg1.funnyjunk.com/thumbnails/comments/I+was+never+the+manliest+man+but+all+this+regressive+_8610876e6fec56649d73447e057639e3.jpg
			//   https://hg1.funnyjunk.com/comments/I+was+never+the+manliest+man+but+all+this+regressive+_8610876e6fec56649d73447e057639e3.jpg
			return src
				.replace(/\/thumbnails\/+comments\//, "/comments/")
				.replace(/\/pictures\/+[^/]*_([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]+_[0-9]+\.[^/.]*)$/, "/large/pictures/$1/$2/$1$2$3");
		}

		if (googlestorage_container === "kendam-148811.appspot.com") {
			// https://storage.googleapis.com/kendam-148811.appspot.com/photo.kendam.com/thumb300/tn300_b903d3471725aeea6387c699c7e06888_3189.jpg
			//   https://storage.googleapis.com/kendam-148811.appspot.com/photo.kendam.com/temp/b903d3471725aeea6387c699c7e06888_3189.jpg
			return src.replace(/\/thumb[0-9]+\/tn[0-9]+_/, "/temp/");
		}

		if (domain === "image-cdn.hypb.st") {
			// https://image-cdn.hypb.st/https%3A%2F%2Fhypebeast.com%2Fimage%2F2018%2F07%2Fkaws-companion-sculpture-gwanggyo-ipark-0.jpg?q=90&w=1400&cbr=1&fit=max
			//   https://hypebeast.com/image/2018/07/kaws-companion-sculpture-gwanggyo-ipark-0.jpg?q=90
			return decodeURIComponent(src.replace(/^[a-z]+:\/\/[^/]*\/([^&]*).*/, "$1"));
		}

		if (domain_nowww === "productionparadise.com") {
			// https://productionparadise.com/newsletters/1128/photos/71900/minisite/delaria.jpg
			//   https://productionparadise.com/newsletters/1128/photos/71900/original/delaria.jpg
			return src.replace(/(\/photos\/[0-9]+\/)[a-z]+(\/[^/]*)$/, "$1original$2");
		}

		if (domain_nosub === "cargocollective.com" && /^payload[0-9]*\./.test(domain)) {
			// https://payload554.cargocollective.com/1/12/394613/13388711/20171210_PolkaDotStory_1_1000.jpg
			//   https://payload554.cargocollective.com/1/12/394613/13388711/20171210_PolkaDotStory_1.jpg
			// https://payload560.cargocollective.com/1/12/394613/13503032/WTL-Web-01_1000.jpg
			//   https://payload560.cargocollective.com/1/12/394613/13503032/WTL-Web-01.jpg
			// https://payload.cargocollective.com/1/6/201592/13122997/PORTFOLIO-2017-Def_0000_Composition-de-calques-1_1600_c.jpg
			//   https://payload.cargocollective.com/1/6/201592/13122997/PORTFOLIO-2017-Def_0000_Composition-de-calques-1.jpg
			// https://payload.cargocollective.com/1/19/637117/10951850/Nike-Zoom-KD9-Airness-11_1340_c.jpg
			//   https://payload.cargocollective.com/1/19/637117/10951850/Nike-Zoom-KD9-Airness-11.jpg -- 403
			// https://payload.cargocollective.com/1/7/239010/6929159/Screen-Shot-2014-06-26-at-00.12.15_900.png
			//   https://payload.cargocollective.com/1/7/239010/6929159/Screen-Shot-2014-06-26-at-00.12.15.png
			return src.replace(/_[0-9]{3,4}(?:_c)?(\.[^/.]*)$/, "$1");
		}

		if (domain_nowww === "imagebam.com") {
			var process_imagebam = function(done, resp, cache_key) {
				/*var ogimage = get_meta(resp.responseText, "og:image");
				if (!ogimage) {
					console_error(cache_key, "Unable to find og:image from", resp);
					return done(null, false);
				}*/

				var match = resp.responseText.match(/<img src="(https?:\/\/images[0-9]*\.imagebam\.com\/[^"]+)" [^>]*class="main-image/);
				if (!match) {
					console_error(cache_key, "Unable to find main image from", resp);
					return done(null, false);
				}
				var ogimage = match[1];

				done({
					url: ogimage,
					is_original: true,
					headers: {
						Referer: "https://www.imagebam.com/"
					},
					referer_ok: {
						same_domain_nosub: true
					},
					extra: {
						page: resp.finalUrl
					}
				}, 60*60);
			};

			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+image\/+([0-9a-f]+)(?:[?#].*)?$/,
				query_for_id: "https://www.imagebam.com/image/${id}",
				process: process_imagebam
			});
			if (newsrc) return newsrc;

			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+view\/+([0-9A-Z]+)(?:[?#].*)?$/,
				query_for_id: "https://www.imagebam.com/view/${id}",
				process: process_imagebam
			});
			if (newsrc) return newsrc;
		}

		if (domain_nosub === "imagebam.com" && /^thumb(?:nail)?s[0-9]*\./.test(domain)) {
			// http://www.imagebam.com/image/b08214643524333
			//   http://thumbs2.imagebam.com/b5/84/c2/b08214643524333.jpg
			//   http://images2.imagebam.com/c9/b4/96/b08214643524333.jpg
			// http://www.imagebam.com/image/172f56480587760
			//   http://thumbnails115.imagebam.com/48059/172f56480587760.jpg
			//   http://images3.imagebam.com/5f/1e/36/172f56480587760.jpg
			id = src.replace(/.*\/([0-9a-f]+)\.[^/.]*$/, "$1");
			if (id !== src) {
				return {
					url: "https://www.imagebam.com/image/" + id,
					is_pagelink: true
				};
			}

			// https://www.imagebam.com/view/MEBIJN
			// https://thumbs4.imagebam.com/7e/0a/f7/MEBIJN_t.jpg
			//   https://images4.imagebam.com/e7/7f/f6/MEBIJN_o.jpg
			id = src.replace(/.*\/([0-9A-Z]+)_t\.[^/.]+$/, "$1");
			if (id !== src) {
				return {
					url: "https://www.imagebam.com/view/" + id,
					is_pagelink: true
				};
			}
		}

		if (domain_nosub === "imagebam.com") {
			// http://109.imagebam.com/download/dWbrQoSl3dQM0smXmubqzw/35844/358432129/1.jpg
			// http://www.imagebam.com/nohotlinking.jpg
			if (/\/nohotlinking\.jpg(?:[?#].*)?$/.test(src)) {
				return {
					url: src,
					bad: true
				};
			}

			if (string_indexof(src, "/download/") >= 0) {
				return {
					url: src,
					is_original: true,
					headers: {
						Referer: "https://www.imagebam.com/"
					},
					referer_ok: {
						same_domain_nosub: true
					}
				};
			}
		}

		if (domain_nosub === "imagevenue.com") {
			// https://cdno-data.imagevenue.com/no_image.jpg
			if (/^[a-z]+:\/\/[^/]+\/+no_image\./.test(src)) {
				return {
					url: src,
					bad: true
				};
			}
		}

		if (domain_nosub === "imagevenue.com" &&
			domain.match(/^img[0-9]+\.imagevenue\.com/) &&
			src.match(/\/th_([^/]*)$/) &&
			options && options.cb && options.do_request) {
			// http://img2250.imagevenue.com/img.php?image=613512642_0_00_0_0sexyhot0___0_123_257lo.jpg
			// http://img250.imagevenue.com/loc257/th_613512642_0_00_0_0sexyhot0___0_123_257lo.jpg
			//   http://img2250.imagevenue.com/aAfkjfp01fo1i-3407/loc257/613512642_0_00_0_0sexyhot0___0_123_257lo.jpg
			// http://img287.imagevenue.com/loc376/th_645746424_XI5EBS1_122_376lo.JPG
			//   http://img287.imagevenue.com/img.php?image=645746424_XI5EBS1_122_376lo.JPG
			//   http://img287.imagevenue.com/aAfkjfp01fo1i-27405/loc376/645746424_XI5EBS1_122_376lo.JPG
			//   http://www.imagevenue.com/view/o/?i=645746424_XI5EBS1_122_376lo.JPG&h=img287
			id = src.replace(/.*\/th_([^/]*?)(?:[?&#].*)?$/, "$1");
			if (id !== src) {
				var requrl = src.replace(/(:\/\/[^/]*\/).*/, "$1img.php?image=" + id);

				var query_imagevenue = function(requrl, cb) {
					// Do it twice to get the cookies
					var do_req = function (requrl, first, cb) {
						var headers = {
							Referer: requrl
						};

						options.do_request({
							url: requrl,
							method: "GET",
							headers: headers,
							onload: function (resp) {
								if (resp.status !== 200) {
									console_error("Bad status", resp);
									return cb(null);
								}

								var match = resp.responseText.match(/<img *id=['"]thepic['"][^>]* (?:src|SRC)=['"]([^"']*)['"]/);
								if (!match) {
									match = resp.responseText.match(/<a href="https?:\/\/www\.imagevenue\.com\/view\/o\?[\s\S]*?<img src="(https?:\/\/(?:img|cdn)[^/]*\.imagevenue\.[^"']+)"/);
								}

								var baseobj = {
									extra: {
										page: requrl
									},
									bad_if: [{
										headers: {
											"Last-Modified": "Mon, 04 May 2020 07:19:52 GMT",
											"Content-Length": "14396",
											"Content-Type": "image/jpeg"
										}
									}]
								};

								if (match) {
									cb(fillobj_urls([{
										url: urljoin(resp.finalUrl, match[1], true),
										is_original: true,
									}, src], baseobj));
								} else {
									console_error("Unable to find match", resp);

									if (first) {
										return do_req(resp.finalUrl, false, cb);
									} else {
										cb(null);
									}
								}
							}
						});
					};

					api_cache.fetch("imagevenue:" + requrl, cb, function(done) {
						do_req(requrl, true, function(data) {
							if (!data) {
								return done(null, false);
							} else {
								return done(data, 60*60);
							}
						});
					});
				};

				query_imagevenue(requrl, options.cb);

				return {
					waiting: true
				};
			}
		}

		if (domain_nowww === "imagevenue.com") {
			// https://www.imagevenue.com/images/loader.svg
			if (/\/images\/+loader\.svg/.test(src))
				return {
					url: src,
					bad: "mask"
				};

			// https://www.imagevenue.com/ME12YFV0
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+([A-Z0-9]{5,})(?:[?#].*)?$/,
				query_for_id: "https://www.imagevenue.com/${id}",
				process: function(done, resp, cache_key, match) {
					var match = resp.responseText.match(/<img src="(https?:\/\/(?:cdn-images\.[^"]+_o\.[^"]+|cdno-data\.[^"]+))"/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					return done(match[1], 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "cdn-thumbs.imagevenue.com") {
			// https://cdn-thumbs.imagevenue.com/42/0e/ba/ME12YFV0_t.jpg
			//   https://cdn-images.imagevenue.com/dc/6a/b2/ME12YFV0_o.jpg
			match = src.match(/\/(?:[0-9a-f]{2}\/+){3}([A-Z0-9]+)_t\./);
			if (match) {
				return {
					url: "https://www.imagevenue.com/" + match[1],
					is_pagelink: true
				};
			}
		}

		if (domain === "static.cinemagia.ro") {
			// https://static.cinemagia.ro/img/resize/db/actor/33/04/29/andrea-duro-731111l-thumbnail_gallery.jpg
			//   https://static.cinemagia.ro/img/db/actor/33/04/29/andrea-duro-731111l.jpg
			// https://static.cinemagia.ro/img/resize/db/actor/33/04/29/andrea-duro-195331l-poza.jpg
			//   https://static.cinemagia.ro/img/db/actor/33/04/29/andrea-duro-195331l.jpg
			// https://static.cinemagia.ro/img/resize/db/movie/00/15/42/the-time-machine-755487l-576x0-w-c5c527bb.jpg
			//   https://static.cinemagia.ro/img/db/movie/00/15/42/the-time-machine-755487l.jpg
			// https://static.cinemagia.ro/img/resize/db/article/03/27/51/240154l-80x56-b-0de90f13.jpg
			//   https://static.cinemagia.ro/img/db/article/03/27/51/240154l.jpg
			//return src.replace(/\/img\/resize\/db\/(.*-[0-9]{4,}[a-z])-[a-z_]+(\.[^/.]*)$/, "/img/db/$1$2");
			//return src.replace(/\/img\/resize\/db\/(.*-[0-9]+[a-z]*)-[0-9]+x[0-9]+-[a-z]+-[0-9a-f]+(\.[^/.]*)$/, "/img/db/$1$2");
			return src.replace(/\/img\/resize\/db\/(.*\/(?:[^/]*?-)?[0-9]+[a-z])-[^/.]*?(\.[^/.]*)$/, "/img/db/$1$2");
		}

		if (domain === "static.kinokopilka.pro") {
			// https://static.kinokopilka.pro/system/images/photos/images/000/046/133/46133_thumb.jpg
			//   https://static.kinokopilka.pro/system/images/photos/images/000/046/133/46133_original.jpg
			// https://static.kinokopilka.pro/system/images/people/images/000/061/034/1336571110/61034_large.jpg
			//   https://static.kinokopilka.pro/system/images/people/images/000/061/034/1336571110/61034_original.jpg
			return src.replace(/(\/[0-9]+)_[a-z]+(\.[^/.]*)$/, "$1_original$2");
		}

		if (domain === "d1uzk9o9cg136f.cloudfront.net") {
			// https://d1uzk9o9cg136f.cloudfront.net/f/16783100/rc/2018/07/06/3ab2cab8878441a5553e43f1ef631bf7f6e97f80_normal.jpg
			//   https://d1uzk9o9cg136f.cloudfront.net/f/16783100/rc/2018/07/06/3ab2cab8878441a5553e43f1ef631bf7f6e97f80.jpg
			//   https://d1uzk9o9cg136f.cloudfront.net/f/16783100/rc/2018/07/06/3ab2cab8878441a5553e43f1ef631bf7f6e97f80_xlarge.jpg -- stretched?
			// https://d1uzk9o9cg136f.cloudfront.net/f/portal/16777363/rc/2018/06/28/ef28b10ad2fae52fea839fdd88bc72c7405f02b4_large.jpg
			//   https://d1uzk9o9cg136f.cloudfront.net/f/portal/16777363/rc/2018/06/28/ef28b10ad2fae52fea839fdd88bc72c7405f02b4.jpg
			// https://d1uzk9o9cg136f.cloudfront.net/f/16783100/rc/2018/07/02/31f0bf6f6992ade98ad3388c3e652a24d96f5990_small.jpg
			//   https://d1uzk9o9cg136f.cloudfront.net/f/16783100/rc/2018/07/02/31f0bf6f6992ade98ad3388c3e652a24d96f5990.jpg
			return src.replace(/(\/[a-f0-9]+)_[a-z]+(\.[^/.]*)$/, "$1$2");
		}

		if (domain === "static.azteca.com") {
			// http://static.azteca.com/crop/crop.php?coordinates=50,50&width=750&height=450&img=http://static.azteca.com/imagenes/2017/45/fotoespecial-2174571.jpg
			//   http://static.azteca.com/imagenes/2017/45/fotoespecial-2174571.jpg
			return decodeURIComponent(src.replace(/^[a-z]+:\/\/[^/]*\/crop\/crop\.php.*?[?&]img=([^&]*).*?$/, "$1"));
		}

		if (domain_nowww === "tasoeur.biz") {
			// http://www.tasoeur.biz/images/2018/01/06/thumbs/CC-2.thumb.jpg
			//   http://www.tasoeur.biz/images/2018/01/06/CC-2.jpg
			return src.replace(/\/thumbs\/([^/]*)\.thumb(\.[^/.]*)$/, "/$1$2");
		}

		if (domain_nowww === "taipeitimes.com") {
			// http://www.taipeitimes.com/images/2019/05/17/thumbs/p15-190517-n004.jpg
			//   http://www.taipeitimes.com/images/2019/05/17/p15-190517-n004.jpg
			return src.replace(/(\/images\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2})thumbs\/+/, "$1");
		}

		if (domain === "imageproxy.ifcdn.com" ||
			// example urls thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/397
			// https://imageproxy.ifunny.co/crop:x-20,resize:320x,crop:x800,quality:90x75/images/bb3c85ed35d9f0c17e58bfa51b4ae95efc64514e4cf7d21b9685f4bbb461bba4_1.jpg
			//   https://img.ifcdn.com/images/bb3c85ed35d9f0c17e58bfa51b4ae95efc64514e4cf7d21b9685f4bbb461bba4_1.jpg
			//   https://img.ifunny.co/images/bb3c85ed35d9f0c17e58bfa51b4ae95efc64514e4cf7d21b9685f4bbb461bba4_1.jpg
			// https://imageproxy.ifunny.co/crop:square,resize:100x,quality:90x75/user_photos/0f08c70e5a2442904c09c85375891918f63f2872_0.jpg
			//   https://img.ifunny.co/user_photos/0f08c70e5a2442904c09c85375891918f63f2872_0.jpg
			domain === "imageproxy.ifunny.co") {
			// https://imageproxy.ifcdn.com/crop:x-20,resize:320x,crop:x800,quality:90x75/images/e9b3c27e6252634d8d55b3936b6d8d1104ffc4fddae247e4bd6188de8f61ef92_1.jpg
			//   https://imageproxy.ifcdn.com/crop:x,resize:x,crop:x,quality:x/images/e9b3c27e6252634d8d55b3936b6d8d1104ffc4fddae247e4bd6188de8f61ef92_1.jpg
			//   https://img.ifcdn.com/images/e9b3c27e6252634d8d55b3936b6d8d1104ffc4fddae247e4bd6188de8f61ef92_1.jpg
			return src.replace(/:\/\/[^/]*\/+[^/]*(\/(?:images|user_photos)\/+[^/]*)(?:[?#].*)?$/, "://img." + domain_nosub + "$1");
		}

		if (domain === "resource.mingweekly.com") {
			// http://resource.mingweekly.com/userfiles/sm/sm640480_images_A1/13366/2018012359061705.jpg -- 320x480
			//   http://resource.mingweekly.com/userfiles/images_A1/13366/2018012359061705.jpg -- 5792x8688
			// http://resource.mingweekly.com/userfiles/sm/sm1200_images_A1/13150/2018010361134885.jpg
			//   http://resource.mingweekly.com/userfiles/images_A1/13150/2018010361134885.jpg
			return src.replace(/\/userfiles\/sm\/sm[0-9]+_images/, "/userfiles/images");
		}

		if (domain_nosub === "allegroimg.com") {
			// https://5.allegroimg.com/s512/03a7a6/3432952a4812a32a7eacaf3611e5
			//   https://5.allegroimg.com/original/03a7a6/3432952a4812a32a7eacaf3611e5
			return src.replace(/(:\/\/[^/]*\/)s[0-9]+\//, "$1original/");
		}

		if (domain === "mmc.tirto.id") {
			// https://mmc.tirto.id/image/otf/600x315/2018/01/13/camila-cabello--youtube.jpg
			//   https://mmc.tirto.id/image/2018/01/13/camila-cabello--youtube.jpg
			return src.replace(/\/image\/otf\/[0-9]+x[0-9]+\//, "/image/");
		}

		if (domain === "ia.tmgrup.com.tr" ||
			// https://iaahbr.tmgrup.com.tr/0219d4/960/540/0/1/640/361?u=https://iahbr.tmgrup.com.tr/album/2018/12/28/1546006796151.jpg
			//   https://iahbr.tmgrup.com.tr/album/2018/12/28/1546006796151.jpg
			domain === "iaahbr.tmgrup.com.tr") {
			// http://ia.tmgrup.com.tr/ec4621/0/0/0/0/960/504?u=http://i.tmgrup.com.tr/es/2018/03/08/turkiyede-en-cok-hangi-kadin-sarkicilar-dinleniyor-1520499517892.jpg&mw=600
			//   http://i.tmgrup.com.tr/es/2018/03/08/turkiyede-en-cok-hangi-kadin-sarkicilar-dinleniyor-1520499517892.jpg
			return decodeURIComponent(src.replace(/^[a-z]+:\/\/[^/]*\/[^/]*\/(?:[0-9]+\/){5}[0-9]+\/?.*?[?&]u=([^&]*).*?$/, "$1"));
		}

		if (domain === "img.erogazou.co") {
			// http://img.erogazou.co/thumb/06ac5470158bdeca9cb58abf386cb8c54fa6ac2e.2.jpg
			//   http://img.erogazou.co/photo/06ac5470158bdeca9cb58abf386cb8c54fa6ac2e.2.jpg
			return src.replace(/\/thumb\//, "/photo/");
		}

		if (domain === "tracks.content.hardstyle.com") {
			// https://tracks.content.hardstyle.com/products/0/275/356/thumbs/500x500/zatox-and-brennan-heart-back-in-the-days.jpg
			//   https://tracks.content.hardstyle.com/products/0/275/356/original/zatox-and-brennan-heart-back-in-the-days.jpg
			return src.replace(/\/thumbs\/[0-9]+x[0-9]+\//, "/original/");
		}

		if ((domain_nosub === "thedjlist.com" && domain.match(/i[0-9]*\./)) ||
			// https://static.inaturalist.org/photos/7473877/large.jpg?1545682860
			//   https://static.inaturalist.org/photos/7473877/original.jpg?1545682860
			domain === "static.inaturalist.org") {
			// http://i9.thedjlist.com/djs/photos/328097/large.jpg
			//   http://i9.thedjlist.com/djs/photos/328097/original.jpg
			return src.replace(/(\/photos\/[0-9]+\/)[a-z]+(\.[^/.]*)$/, "$1original$2");
		}

		if (domain === "artist-assets.hubbardradio.com") {
			// https://artist-assets.hubbardradio.com/clean-bandit-1_v1000.jpg
			//   https://artist-assets.hubbardradio.com/clean-bandit-1.jpg
			return src.replace(/_v[0-9]+(\.[^/.]*)$/, "$1");
		}

		if (domain === "cdn.ebaumsworld.com" ||
			domain === "images.ebaumsworld.com") {
			// http://cdn.ebaumsworld.com/thumbs/picture/718392/84995481.jpg
			//   http://cdn.ebaumsworld.com/mediaFiles/picture/718392/84995481.jpg
			// http://images.ebaumsworld.com/thumbs/picture/718392/84995481.jpg
			//   http://images.ebaumsworld.com/mediaFiles/picture/718392/84995481.jpg
			// http://cdn.ebaumsworld.com/thumbs/gallery/730195/84747317.jpg
			//   http://cdn.ebaumsworld.com/mediaFiles/picture/730195/84747317.jpg -- doesn't work
			//   http://cdn.ebaumsworld.com/mediaFiles/picture/730195/84747318.jpg
			return src.replace(/\/thumbs\/(?:picture|gallery)\//, "/mediaFiles/picture/");
		}

		if (domain_nosub === "kapook.com") {
			// https://my.kapook.com/rf/145/109/img-rambobar/img_rambobar_1_1530873150.jpg
			//   https://my.kapook.com/o/img-rambobar/img_rambobar_1_1530873150.jpg
			// https://simg.kapook.com/rf/145/145/photo/238/kapook_world-237259.jpg
			//   https://simg.kapook.com/o/photo/238/kapook_world-237259.jpg
			// https://s359.kapook.com/rq/400/auto/50/pagebuilder/ba96f5d8-b76e-42df-aed8-53c4a7f38cfa.jpg -- 400x592
			//   https://s359.kapook.com/pagebuilder/ba96f5d8-b76e-42df-aed8-53c4a7f38cfa.jpg -- 2764x4096
			return src
				.replace(/\/rf\/[0-9]+\/[0-9]+\//, "/o/")
				.replace(/\/rq\/+[0-9]+\/+auto\/+[0-9]+\/+pagebuilder\/+/, "/pagebuilder/");
		}

		if (domain_nosub === "amcn.in" &&
			domain.match(/^cdn[0-9]*\.amcn\.in/)) {
			// https://cdn4.amcn.in/a/tomislav.alle.bg/assets/6802a60d74b9-w800-c999999999-v1c51e564c5/bearcms/files/image/x6af845t2fa1r6ptu1i.jpg
			//   https://tomislav.alle.bg/assets/5c0a53cb790c-w255-c999999999-v7fbf8ac942/bearcms/files/image/v9s2dd4t2fa18k2d8lv.jpg
			return src.replace(/^[a-z]+:\/\/[^/]*\/a\/([^/.]*\.[^/]*\/)/, "http://$1");
		}

		if (domain_nosub === "litlepups.net" &&
			domain.match(/^cdn[0-9]*\.litlepups\.net/)) {
			// http://cdn1.litlepups.net/resize/2018/04/27/small-toco-toucan-ramphastos-toco-pgcps-mess-reform.jpg
			//   http://cdn.litlepups.net/2018/04/27/toco-toucan-ramphastos-toco-pgcps-mess-reform.jpg
			return src.replace(/:\/\/[^/]*\/resize\/(.*)\/[a-z]+-([^/]*)$/, "://cdn.litlepups.net/$1/$2");
		}

		if (domain_nowww === "wede-mail.com" ||
			// http://www.warnerchappell.com/slir/w450/app/webroot/assets/3045.jpg
			//   http://www.warnerchappell.com/slir/orig/app/webroot/assets/3045.jpg
			//   http://www.warnerchappell.com/app/webroot/assets/3045.jpg
			// http://www.warnerchappell.com/slir/w125-h109-c1:1/app/webroot/assets/3045.jpg
			//   http://www.warnerchappell.com/app/webroot/assets/3045.jpg
			domain_nowww === "warnerchappell.com") {
			// http://wede-mail.com/slir/w584/wp-content/uploads/2014/11/df2be7aa-8eaa-47be-a1e4-f536300f4319.jpg
			//   http://www.wede-mail.com/slir/orig/wp-content/uploads/2014/11/df2be7aa-8eaa-47be-a1e4-f536300f4319.jpg
			//   http://www.wede-mail.com/wp-content/uploads/2014/11/df2be7aa-8eaa-47be-a1e4-f536300f4319.jpg
			//return src.replace(/\/slir\/[wh][0-9]*\//, "/slir/orig/");
			return src.replace(/\/slir\/(?:[whc][0-9:]+(?:-[^/]*)|orig)\//, "/");
		}

		if (domain_nowww === "photorator.com" ||
			// https://contrastspace.ru/photos/thumbs/hugging-a-tree-346725.jpg
			//   https://contrastspace.ru/photos/images/hugging-a-tree-346725.jpg
			domain_nowww === "contrastspace.ru" ||
			// https://galleon-realty.ru/thisvid/photos/thumbs/rachel-mcadams-1471264.jpg
			//   https://galleon-realty.ru/thisvid/photos/images/rachel-mcadams-1471264.jpg
			domain_nowww === "galleon-realty.ru" ||
			// https://teatrvmeste.ru/video-jav/photos/thumbs/pic-1-piper-perri-class-project-839461.jpg
			//   https://teatrvmeste.ru/video-jav/photos/images/pic-1-piper-perri-class-project-839461.jpg
			domain_nowww === "teatrvmeste.ru" ||
			// https://pornopics.co/photos/thumbs/mckayla-maroney-turns-today-1476244.jpg
			//   https://pornopics.co/photos/small/mckayla-maroney-turns-today-1476244.jpg
			//   https://pornopics.co/photos/images/mckayla-maroney-turns-today-1476244.jpg
			domain_nowww === "pornopics.co") {
			// https://photorator.com/photos/thumbs/a-cozy-toucan--69045.jpg
			//   https://www.photorator.com/photos/images/a-cozy-toucan--69045.jpg
			newsrc = src.replace(/\/photos\/(?:thumbs|small)\//, "/photos/images/");

			page = src.replace(/(\/photo)s\/+[^/]+\/+[^/]+-([0-9]+)\.[^/.]+(?:[?#].*)?$/, "$1/$2");
			if (page !== src) {
				return {
					url: newsrc,
					extra: {
						page: page
					}
				};
			} else {
				return newsrc;
			}
		}

		if (domain_nowww === "expressen.se") {
			// video
			// https://www.expressen.se/tv/nyheter/har-slapar-grizzlybjornen-hjorten-over-floden/ -- todo!
			// https://www.expressen.se/videoplayer/embed/tv/nyheter/har-slapar-grizzlybjornen-hjorten-over-floden/
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+videoplayer\/+embed\/+([^?#]*)(?:[?#].*)?$/,
				query_for_id: "https://www.expressen.se/videoplayer/embed/${id}",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/<body>\s*<figure\s+class="evp evp--embeded"\s+data-article-data='({[^']+})'/);
					if (!match) {
						console_error(cache_key, "Unable to find figure match for", resp);
						return done(null, false);
					}

					var decoded = decode_entities(match[1]);
					var parsed = JSON_parse(decoded);

					var obj = {
						extra: {
							page: urljoin(resp.finalUrl, parsed.linkUrl, true),
							caption: parsed.title
						}
					};

					var urls = [];

					if (parsed.stream) {
						urls.push({
							url: parsed.stream,
							video: "hls"
						});
					}

					if (parsed.mp4File) {
						urls.push({
							url: parsed.mp4File,
							video: true
						});
					}

					if (parsed.image) {
						urls.push(parsed.image);
					}

					return done(fillobj_urls(urls, obj), 60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nosub === "cdn-expressen.se") {
			// https://c.cdn-expressen.se/images/4b/d3/4bd315bf3bb14ac48b8f73c7fbb812f1/16x9/1000@60.jpg
			//   https://c.cdn-expressen.se/images/4b/d3/4bd315bf3bb14ac48b8f73c7fbb812f1/16x9/original.jpg
			//   https://c.cdn-expressen.se/images/4b/d3/4bd315bf3bb14ac48b8f73c7fbb812f1/original.jpg -- doesn't work
			//   https://c.cdn-expressen.se/images/4b/d3/4bd315bf3bb14ac48b8f73c7fbb812f1/annan/original.jpg
			// https://y.cdn-expressen.se/images/d9/7a/d97a1ccee600422ea37a35eb58e74763/original.jpg
			//   https://c.cdn-expressen.se/images/d9/7a/d97a1ccee600422ea37a35eb58e74763/original.jpg -- same
			// https://x.cdn-expressen.se/images/6e/d2/6ed2fd7499174eff97992c4032b77721/16x9/original.jpg
			//   https://x.cdn-expressen.se/images/6e/d2/6ed2fd7499174eff97992c4032b77721/annan/original.jpg
			// https://c.cdn-expressen.se/images/0f/df/0fdf65925e0b4678a1f379bbe09f74d2/16x9/600.jpg
			//   https://c.cdn-expressen.se/images/0f/df/0fdf65925e0b4678a1f379bbe09f74d2/16x9/original.jpg
			//   https://c.cdn-expressen.se/images/0f/df/0fdf65925e0b4678a1f379bbe09f74d2/annan/original.jpg -- 404
			newsrc = src.replace(/\/[0-9]+(?:@[0-9]+)?(\.[^/.]*)$/, "/original$1");
			if (newsrc !== src)
				return newsrc;

			return src.replace(/(\/[0-9a-f]+\/)[0-9]+x[0-9]+(\/[^/]*)$/, "$1annan$2");
		}

		if (domain === "images.csmonitor.com") {
			// https://images.csmonitor.com/csm/2018/06/0629-RedHen.jpg?alias=standard_75x50
			//   https://images.csmonitor.com/csm/2018/06/0629-RedHen.jpg?alias=original
			return src.replace(/(?:\?.*)?$/, "?alias=original");
		}

		if (domain_nowww === "incimages.com" ||
			// https://firenewsfeed.com/image/728x410/aHR0cHM6Ly9pbWFnZXMuYXhpb3MuY29tL2NJQm1aS2xyZ0hiRFhpZDNsQklEdkcyUXdZOD0vMHgwOjE5MjB4MTA4MC8xOTIweDEwODAvMjAxOC8wNy8xNS8xNTMxNjg4MTkyMjg3LmpwZw==
			//   https://firenewsfeed.com/image/aHR0cHM6Ly9pbWFnZXMuYXhpb3MuY29tL2NJQm1aS2xyZ0hiRFhpZDNsQklEdkcyUXdZOD0vMHgwOjE5MjB4MTA4MC8xOTIweDEwODAvMjAxOC8wNy8xNS8xNTMxNjg4MTkyMjg3LmpwZw==
			domain_nowww === "firenewsfeed.com") {
			// https://www.incimages.com/uploaded_files/image/300x200/getty_930534182_200014312000928078_362581.jpg
			//   https://www.incimages.com/uploaded_files/image/getty_930534182_200014312000928078_362581.jpg
			newsrc = src.replace(/\/image\/[0-9]+x[0-9]+\//, "/image/");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nowww === "firenewsfeed.com") {
			// https://firenewsfeed.com/image/aHR0cHM6Ly9pbWFnZXMuYXhpb3MuY29tL2NJQm1aS2xyZ0hiRFhpZDNsQklEdkcyUXdZOD0vMHgwOjE5MjB4MTA4MC8xOTIweDEwODAvMjAxOC8wNy8xNS8xNTMxNjg4MTkyMjg3LmpwZw==
			//   https://images.axios.com/cIBmZKlrgHbDXid3lBIDvG2QwY8=/0x0:1920x1080/1920x1080/2018/07/15/1531688192287.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+image\/+(?:[0-9]+x[0-9]+\/+)?(aHR0c[^?#./]+)(?:[?#].*)?$/, "$1");
			if (newsrc !== src)
				return base64_decode(newsrc);
		}

		if (domain === "cached.imagescaler.hbpl.co.uk") {
			// https://cached.imagescaler.hbpl.co.uk/resize/scaleWidth/743/cached.offlinehbpl.hbpl.co.uk/news/OMC/marie-claire---640-20140814021457224.jpg
			//   http://cached.offlinehbpl.hbpl.co.uk/news/OMC/marie-claire---640-20140814021457224.jpg
			return src.replace(/^[a-z]+:\/\/[^/]*\/resize\/[^/]*\/[0-9]+\/([^/]*\.[^/]*\/)/, "http://$1");
		}

		if (domain === "i.tuenlinea.com") {
			// http://i.tuenlinea.com/dam/moda/17/03/12/orange_carpet_de_los_kids_choice_awards_2017_10.jpg.imgw.1280.1280.jpeg
			//   http://i.tuenlinea.com/dam/moda/17/03/12/orange_carpet_de_los_kids_choice_awards_2017_10.jpg.imgo.jpg
			return src.replace(/(\/[^/]*(\.[^/.]*))\.img[wh]\.[0-9]+\.[0-9]+\.[^/.]*$/, "$1.imgo$2");
		}

		if (domain === "cdn-photos.extratv.com") {
			// http://cdn-photos.extratv.com/gallery-images/2018/05/GettyImages-960168704_thumb.jpg
			//   http://cdn-photos.extratv.com/gallery-images/2018/05/GettyImages-960168704_full.jpg
			return src.replace(/_thumb(\.[^/.]*)$/, "_full$1");
		}

		if (domain === "media.extratv.com") {
			// https://media.extratv.com/2016/02/29/2016-02-gettyimages-513022330-100x100-3.jpg
			//   https://media.extratv.com/2016/02/29/2016-02-gettyimages-513022330-1000w-3.jpg
			//   https://media.extratv.com/2016/02/29/2016-02-gettyimages-513022330.jpg
			// https://media.extratv.com/2017/01/09/sophie-turner-getty-510x600.jpg
			//   https://media.extratv.com/2017/01/09/sophie-turner-getty.jpg
			return src.replace(/-(?:[0-9]+x[0-9]+|[0-9]+[wh])(?:-[0-9]+)?(\.[^/.]*)$/, "$1");
		}

		if (domain === "i.wpimg.pl") {
			// https://i.wpimg.pl/623x882/e5.pudelek.pl.sds.o2.pl/1d3e78c442bd58b4f81c5344b6b39c86f81702b0.jpg
			//   http://e5.pudelek.pl.sds.o2.pl/1d3e78c442bd58b4f81c5344b6b39c86f81702b0.jpg
			// https://i.wpimg.pl/O/352x600/i.wp.pl/a/f/film/033/87/07/0320787.jpg
			//   http://i.wp.pl/a/f/film/033/87/07/0320787.jpg
			// https://i.wpimg.pl/628x/d.wpimg.pl/2091932323-228690355/zac-efron.jpg
			//   http://d.wpimg.pl/2091932323-228690355/zac-efron.jpg
			return src.replace(/^[a-z]+:\/\/[^/]*\/(?:[A-Z]\/)?[0-9]+x(?:[0-9]+)?\//, "http://");
		}

		if (domain === "static.keptelenseg.hu") {
			// https://static.keptelenseg.hu/thumbs/thumb/p/16fe9d08d860f9ce6b525da7554ea66e.jpg
			//   https://static.keptelenseg.hu/p/16fe9d08d860f9ce6b525da7554ea66e.jpg
			return src.replace(/\/thumbs\/thumb\/p\//, "/p/");
		}

		if (domain_nosub === "wdfiles.com") {
			// http://daeren.wdfiles.com/local--resized-images/brendolyn/bren6.jpg/medium.jpg
			//   http://daeren.wdfiles.com/local--files/brendolyn/bren6.jpg
			return src.replace(/\/local--resized-images\/(.*\.[^/.]*)\/[a-z]+\.[^/.]*$/, "/local--files/$1");
		}

		if (domain_nowww === "astrofactor.com") {
			// https://astrofactor.com/imgs/celeb/120/9791-0.jpg
			//   https://astrofactor.com/imgs/celeb/full/9791-0.jpg
			return src.replace(/(\/imgs\/[^/]*\/)[0-9]+(\/[^/]*)$/, "$1full$2");
		}

		if (domain === "makeup.nuovogennarino.org") {
			// http://makeup.nuovogennarino.org/static/250/img/ksassets.timeincuk.net/wp/uploads/sites/46/2016/08/Emma-Watson-THUMB.jpg
			//   https://ksassets.timeincuk.net/wp/uploads/sites/46/2016/08/Emma-Watson-THUMB.jpg
			return src.replace(/^[a-z]+:\/\/[^/]*\/static\/[0-9]+\/img\/([^/.]+\.[^/]+)/, "http://$1");
		}

		if ((domain_nosub === "newsdog.today" && domain.match(/^img[0-9]*\./)) ||
			amazon_container === "img.newsdog.today") {
			// http://img.newsdog.today/thumb_abb85c7b6d6e536b0cd70bc5a2d6227b
			//   http://img.newsdog.today/origin_abb85c7b6d6e536b0cd70bc5a2d6227b
			// https://s3.ap-south-1.amazonaws.com/img.newsdog.today/thumb_preview_3ddcb3d8e1cd57ce6b14ac92fd6cb866
			//   https://s3.ap-south-1.amazonaws.com/img.newsdog.today/origin_3ddcb3d8e1cd57ce6b14ac92fd6cb866
			// http://img1.newsdog.today/thumb_4e7b08f222f7a7ea369f407c0010a05a
			//   http://img1.newsdog.today/origin_4e7b08f222f7a7ea369f407c0010a05a
			return src.replace(/(\.newsdog\.today\/)[a-z_]+_([a-f0-9]+)$/, "$1origin_$2");
		}

		if (domain === "d1qikntta4cp8k.cloudfront.net") {
			// https://d1qikntta4cp8k.cloudfront.net/?q=85&w=772&url=http://ksassets.timeincuk.net/wp/uploads/sites/46/2016/08/Emma-Watson-THUMB.jpg
			//   https://ksassets.timeincuk.net/wp/uploads/sites/46/2016/08/Emma-Watson-THUMB.jpg
			return decodeURIComponent(src.replace(/^[a-z]+:\/\/[^/]*\/.*?[?&]url=([^&]*)$/, "$1"));
		}

		if (domain_nosub === "img.com.ua") {
			// http://v.img.com.ua/b/1100x999999/f/ec/257f1798ba3954d99cb502145ec15ecf.jpg -- stretched
			//   http://v.img.com.ua/b/orig/f/ec/257f1798ba3954d99cb502145ec15ecf.jpg
			// http://bm.img.com.ua/berlin/storage/afisha/600x500/c/32/e2bca5867c6ef06310bf4d8210bda32c.jpg
			//   http://bm.img.com.ua/berlin/storage/afisha/orig/c/32/e2bca5867c6ef06310bf4d8210bda32c.jpg
			//return src.replace(/(:\/\/[^/]*\/[a-z]\/)[0-9]+x[0-9]+\//, "$1orig/");
			newsrc = src.replace(/\/[0-9]+x[0-9]+(\/[0-9a-f]\/[0-9a-f]{2}\/[0-9a-f]+\.[^/.]*)$/, "/orig$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "rs.img.com.ua") {
			// http://rs.img.com.ua/crop?v2=1&w=600&h=0&url=%2F%2Fv.img.com.ua%2Fb%2Forig%2F4%2Fdf%2F326931add26ff5064449f5b923643df4.jpg
			//   http://v.img.com.ua/b/orig/4/df/326931add26ff5064449f5b923643df4.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/crop.*?[?&]url=([^&]*).*?$/, "$1");
			if (newsrc !== src) {
				return urljoin(src, decodeURIComponent(newsrc), true);
			}
		}

		if (domain === "img-hw.xvideos.com" ||
			// https://img-hw.xvideos-cdn.com/videos/profiles/galleries/c5/94/00/mbrisebois1963/gal1148191/pic_3_thumbl.jpg
			//   https://img-hw.xvideos-cdn.com/videos/profiles/galleries/c5/94/00/mbrisebois1963/gal1148191/pic_3_big.jpg
			domain === "img-hw.xvideos-cdn.com") {
			// https://img-hw.xvideos.com/videos/profiles/galleries/c5/94/00/mbrisebois1963/gal1148191/pic_3_thumbl.jpg
			//   https://img-hw.xvideos.com/videos/profiles/galleries/c5/94/00/mbrisebois1963/gal1148191/pic_3_big.jpg
			return src.replace(/(\/pic_[0-9]+)_[a-z]+(\.[^/.]*)$/, "$1_big$2");
		}

		if (domain_nowww === "xvideos.com" ||
			domain === "flashservice.xvideos.com" ||
			domain_nowww === "xvideos.xxx" ||
			domain_nowww === "xvideos.net" ||
			domain_nowww === "xvideos.es" ||
			domain_nowww === "xnxx.com" ||
			domain_nowww === "xnxx.es") {
			var our_host = domain_nosub.replace(/\..*/, "");

			var full_videourl = function(videourl) {
				if (our_host === "xvideos") {
					return urljoin("https://www.xvideos.com/", videourl, true);
				} else if (our_host === "xnxx") {
					return urljoin("https://www.xnxx.com/", videourl, true);
				}
			};

			var parse_xvideos_page = function(cache_key, resp) {
				var matches = resp.responseText.match(/html5player\.set(.*)/g);
				if (!matches) {
					console_error(cache_key, "Unable to find matches", resp);
					return null;
				}

				var table = {};
				for (var i = 0; i < matches.length; i++) {
					var match = matches[i].match(/html5player\.set([a-zA-Z0-9]+)\('([^']+)'\);$/);
					if (!match) {
						continue;
					}

					table[match[1]] = decode_entities(match[2]);
				}

				return table;
			};

			var objify_xvideos_table = function(table) {
				var obj:BigImageInfoSObject = {
					headers: {
						Referer: "https://www.xvideos.com/"
					},
					extra: {}
				};

				if (table.VideoTitle) {
					obj.extra.caption = table.VideoTitle;
				}

				if (table.VideoURL) {
					obj.extra.page = full_videourl(table.VideoURL);
				}

				var urls = [];
				if (table.VideoHLS) {
					urls.push({
						url: table.VideoHLS,
						video: "hls"
					});
				}

				if (table.VideoUrlHigh) {
					urls.push({
						url: table.VideoUrlHigh,
						video: true
					});
				}

				if (table.VideoUrlLow) {
					urls.push({
						url: table.VideoUrlLow,
						video: true
					});
				}

				urls.push(page_nullobj);

				return fillobj_urls(urls, obj);
			};

			var videoid_to_videourl = function(videoid) {
				if (our_host === "xvideos") {
					return "https://www.xvideos.com/video." + videoid + "/a";
				} else if (our_host === "xnxx") {
					return "https://www.xnxx.com/video-" + videoid + "/a";
				}
			};

			var query_xvideos_page = function(videoid, cb) {
				var cache_key = "xvideos:" + videoid;
				if (our_host === "xnxx")
					cache_key = "xnxx:" + videoid;

				api_cache.fetch(cache_key, cb, function(done) {
					options.do_request({
						url: videoid_to_videourl(videoid),
						method: "GET",
						onload: function(resp) {
							if (resp.readyState !== 4)
								return;

							if (resp.status !== 200) {
								console_error(cache_key, resp);
								return done(page_nullobj, false);
							}

							var parsed_table = parse_xvideos_page(cache_key, resp);
							if (!parsed_table) {
								return done(page_nullobj, false);
							}

							var obj = objify_xvideos_table(parsed_table);
							if (!obj) {
								console_error(cache_key, "Unable to get URLs from", parsed_table, resp);
								return done(page_nullobj, false);
							}

							return done(obj, 3*60*60);
						}
					});
				});
			};

			var get_videoid_from_url = function(url) {
				var regex = null;

				if (our_host === "xvideos") {
					regex = /:\/\/[^/]+\/+(?:video\.?|embedframe\/+)([0-9a-z]+)(?:\/+.*)?(?:[?#].*)?$/;
				} else if (our_host === "xnxx") {
					regex = /:\/\/[^/]+\/+video-([^-/._]+)\//;
				}

				if (!regex)
					return null;

				var match = url.match(regex);
				if (!match)
					return null;

				return match[1];
			};

			page_nullobj = {
				url: src,
				is_pagelink: true
			};

			id = get_videoid_from_url(src);
			if (id) {
				if (options.do_request && options.cb) {
					query_xvideos_page(id, options.cb);

					return {
						waiting: true
					};
				} else {
					return page_nullobj;
				}
			}
		}

		if ((host_domain_nowww === "xvideos.com" ||
			 host_domain_nowww === "xvideos.xxx" ||
			 host_domain_nowww === "xvideos.net" ||
			 host_domain_nowww === "xvideos.es" ||
			 host_domain_nowww === "xnxx.com" ||
			 host_domain_nowww === "xnxx.es") &&
			options.element && options.do_request && options.cb) {
			var our_host = host_domain_nosub.replace(/\..*/, "");;

			var videoid_to_videourl = function(videoid) {
				if (our_host === "xvideos") {
					return "https://www.xvideos.com/video" + videoid + "/a";
				} else if (our_host === "xnxx") {
					return "https://www.xnxx.com/video-" + videoid + "/a";
				}
			};

			var get_videoid_from_url = function(url) {
				var regex = null;

				if (our_host === "xvideos") {
					regex = /:\/\/[^/]+\/+(?:video|embedframe\/+)([0-9]+)/;
				} else if (our_host === "xnxx") {
					regex = /:\/\/[^/]+\/+video-([^-/._]+)\//;
				}

				if (!regex)
					return null;

				var match = url.match(regex);
				if (!match)
					return null;

				return match[1];
			};

			var get_xvideos_vidid_from_el = function(el) {
				for (var current = el; current; current = current.parentElement) {
					if (current.tagName === "A") {
						var id = get_videoid_from_url(current.href);
						if (id) {
							return id;
						}
					}
				}
			};

			var vidid = get_xvideos_vidid_from_el(options.element);
			if (vidid) {
				return videoid_to_videourl(vidid);
			}
		}

		if (domain === "camo.derpicdn.net") {
			// https://camo.derpicdn.net/08a79af4e43715ab9e20f943e912ded3c911b6e3?url=http%3A%2F%2Fi43.tinypic.com%2F2eusocg.png
			//   http://i43.tinypic.com/2eusocg.png
			return decodeURIComponent(src.replace(/^[a-z]+:\/\/[^/]*\/[0-9a-f]+\?url=([^&]*).*?$/, "$1"));
		}

		if (domain === "live.store.cmcm.com") {
			// http://live.store.cmcm.com/small/liveme/poster/a34c5fefc0d9ba2cae7dd989a1bfdefc_icon.jpeg
			//   http://live.store.cmcm.com/liveme/poster/a34c5fefc0d9ba2cae7dd989a1bfdefc_icon.jpeg
			return src.replace(/(:\/\/[^/]*\/)[a-z]+\/(liveme\/)/, "$1$2");
		}

		if (domain === "media.timeout.com") {
			// https://media.timeout.com/images/103349268/640/480/image.jpg
			//   https://media.timeout.com/images/103349268/image.jpg
			return src.replace(/(\/images\/[0-9]+\/)[0-9]+\/[0-9]+\/([^/]*)$/, "$1$2");
		}

		if (domain_nowww === "tokkoro.com") {
			// http://www.tokkoro.com/thumbs/2613254-emilia-clarke-computer-desktop-backgrounds.jpg
			//   http://tokkoro.com/picsup/2613254-emilia-clarke-computer-desktop-backgrounds.jpg
			return src.replace(/\/thumbs\//, "/picsup/");
		}

		if (domain_nowww === "wallpapermaiden.com") {
			// http://www.wallpapermaiden.com/image/2017/06/17/model-brown-eyes-short-hair-earring-face-portrait-girls-16379-resized.jpg
			//   http://www.wallpapermaiden.com/image/2017/06/17/model-brown-eyes-short-hair-earring-face-portrait-girls-16379.jpg
			// http://www.wallpapermaiden.com/wallpaper/542/download/1700x1020/ciri-cosplay-the-witcher-3.jpg -- 1700x1020
			//   http://www.wallpapermaiden.com/wallpaper/542/ciri-cosplay-the-witcher-3
			//   http://www.wallpapermaiden.com/image/2016/06/08/ciri-cosplay-the-witcher-3-girls-542.jpg -- 2048x1283
			newsrc = src.replace(/(\/image\/[0-9]+\/[0-9]+\/[0-9]+\/[^/]*)-resized(\.[^/.]*)$/, "$1$2");
			if (newsrc !== src)
				return newsrc;

			id = src.replace(/(\/wallpaper\/[0-9]+\/)download\/[0-9]+x[0-9]+\/([^/]*)\.[^/.]*(?:[?#].*)?$/,
							 "$1$2");
			if (id !== src &&
				options && options.cb && options.do_request) {
				options.do_request({
					url: id,
					method: "GET",
					onload: function(resp) {
						if (resp.readyState === 4) {
							var match = resp.responseText.match(/<meta *property="og:image" *content="([^"]*)"/);
							if (match) {
								options.cb(match[1]);
							} else {
								options.cb(null);
							}
						}
					}
				});
			}
		}

		if (domain_nosub === "pictoa.com" ||
			// https://s.lilitube.com/068/695/0686955565570053c59/thumbs/137493255655700ac8bd.jpg
			//   https://s.lilitube.com/068/695/0686955565570053c59/137493255655700ac8bd.jpg
			domain_nosub === "lilitube.com" ||
			// http://s.heavenlynudes.net/085/279/085279556b1e0a7f645/thumbs/1620146556b1e0aa118c.jpg
			//   http://s.heavenlynudes.net/085/279/085279556b1e0a7f645/1620146556b1e0aa118c.jpg
			domain_nosub === "heavenlynudes.net" ||
			// http://s.nufap.com/194/953/194953594a03e39d850/thumbs/3222369594a03e3a023b.jpg
			domain_nosub === "nufap.com" ||
			// https://s.fapsex.com/059/968/0599685567ec1e8bc31/thumbs/14936165567ec1f278d0.jpg
			domain_nosub === "fapsex.com" ||
			// https://s.clickmyboobs.com/074/636/07463655752c4fa8e79/thumbs/172574455752c50169ea.jpg
			domain_nosub === "clickmyboobs.com" ||
			// http://s.papajizz.com/227/096/22709658c972619c356/thumbs/353469058c972619efaa.jpg
			domain_nosub === "papajizz.com" ||
			// https://s.babaporn.com/180/740/180740594bf165c6cd1/thumbs/3262186594bf165da740.jpg
			//   https://s.babaporn.com/180/740/180740594bf165c6cd1/3262186594bf165da740.jpg
			domain_nosub === "babaporn.com") {
			// https://s2.pictoa.com/media/galleries/058/990/058990556bf9f7d10b8/thumbs/1650366556bf9f89826e.jpg
			//   https://s2.pictoa.com/media/galleries/058/990/058990556bf9f7d10b8/1650366556bf9f89826e.jpg
			newsrc = src.replace(/(\/[0-9a-f]{3}\/+[0-9a-f]{3}\/+[0-9a-f]+\/+)thumbs\/+([^/]*)(?:[?#].*)?$/, "$1$2");
			if (newsrc !== src)
				return newsrc;

			// thanks to anonymous for reporting:
			// https://t1.pictoa.com/media/galleries/169/999/16999959423e419b4e7/302506959423e419e19d.jpg
			//   https://s1.pictoa.com/media/galleries/169/999/16999959423e419b4e7/302506959423e419e19d.jpg
			newsrc = src.replace(/^([a-z]+:\/\/)t([0-9]*\.)/, "$1s$2");
			if (newsrc !== src)
				return newsrc;
			//return src.replace(/\/thumbs\/([0-9a-f]+\.[^/.]*)$/, "/$1");
		}

		if (domain_nosub === "bbend.net" ||
			// https://cdn.cnngreece.gr/media/com_news/galleries/2018/03/07/6568/photos/thumb/emma2.jpg
			//   https://cdn.cnngreece.gr/media/com_news/galleries/2018/03/07/6568/photos/full/emma2.jpg
			// https://cdn.cnngreece.gr/media/com_news/story/2019/04/11/172598/facebook/ASDADAF.jpg
			//   https://cdn.cnngreece.gr/media/com_news/story/2019/04/11/172598/main/ASDADAF.jpg
			domain === "cdn.cnngreece.gr" ||
			// https://www.funtime.gr/media/com_news/galleries/2019/03/08/332/photos/thumb/Alfred-Eisenstaedt-5.jpg
			//   https://www.funtime.gr/media/com_news/galleries/2019/03/08/332/photos/full/Alfred-Eisenstaedt-5.jpg
			domain_nowww === "funtime.gr" ||
			// https://i.mommd.gr/media/com_news/galleries/2019/04/18/11728/photos/thumb/thundercats-1.jpg
			//   https://i.mommd.gr/media/com_news/galleries/2019/04/18/11728/photos/full/thundercats-1.jpg
			domain === "i.mommd.gr" ||
			// https://i.rtpmd.gr/media/com_news/galleries/2019/09/18/5212/photos/thumb/66808498_458790491629181_829656854891845924_n.jpg
			//   https://i.rtpmd.gr/media/com_news/galleries/2019/09/18/5212/photos/full/66808498_458790491629181_829656854891845924_n.jpg
			domain === "i.rtpmd.gr" ||
			// https://i.gosmd.gr/media/news/2019/10/27/611313/thumb/201910261055500.0933_AFRODITI_LIANTOY_EVELINA_PAPOYLIA_15102019.jpg
			//   https://i.gosmd.gr/media/news/2019/10/27/611313/main/201910261055500.0933_AFRODITI_LIANTOY_EVELINA_PAPOYLIA_15102019.jpg -- upscaled
			domain === "i.gosmd.gr" ||
			// https://i.astmd.gr/media/com_news/galleries/2018/03/20/1866/photos/thumb/20-01-39-image-82.png
			//   https://i.astmd.gr/media/com_news/galleries/2018/03/20/1866/photos/full/20-01-39-image-82.png -- upscaled
			domain === "i.astmd.gr" ||
			// https://i.onmmd.gr/media/com_news/galleries/2018/07/12/445/photos/thumb/1-akmi.jpg
			//   https://i.onmmd.gr/media/com_news/galleries/2018/07/12/445/photos/full/1-akmi.jpg
			domain === "i.onmmd.gr" ||
			// https://i.lfmd.gr/media/com_news/galleries/2019/07/22/11437/photos/thumb/garyfa66.jpg
			//   https://i.lfmd.gr/media/com_news/galleries/2019/07/22/11437/photos/full/garyfa66.jpg
			domain === "i.lfmd.gr" ||
			// https://i.qumd.gr/media/com_news/galleries/2016/08/29/20015/photos/thumb/hailee-steinfeld-mtv-vmas-2016.jpg
			//   https://i.qumd.gr/media/com_news/galleries/2016/08/29/20015/photos/full/hailee-steinfeld-mtv-vmas-2016.jpg
			domain === "i.qumd.gr") {
			// https://nb.bbend.net/media/news/2016/12/14/754483/thumb/JenniferLawrence.jpg
			//   https://nb.bbend.net/media/news/2016/12/14/754483/main/JenniferLawrence.jpg -- 1260x755 (full doesn't work)
			// https://nb.bbend.net/media/news/2019/02/07/956470/facebook/facebookLIATSOS-1.jpg
			//   https://nb.bbend.net/media/news/2019/02/07/956470/main/LIATSOS-1.jpg
			// https://nb.bbend.net/media/news/2019/06/02/987139/snapshot/4819075.jpg
			//   https://nb.bbend.net/media/news/2019/06/02/987139/main/4819075.jpg
			// https://nb.bbend.net/media/news/2019/01/15/950640/photos/thumb/r6.JPG
			//   https://nb.bbend.net/media/news/2019/01/15/950640/photos/full/r6.JPG
			// https://cdn6.bbend.net/media/com_news/galleries/2014/09/08/57412/photos/thumb/rihanna-5_0.jpg
			//   https://cdn6.bbend.net/media/com_news/galleries/2014/09/08/57412/photos/full/rihanna-5_0.jpg
			// other:
			// https://nb.bbend.net/media/news/2019/06/01/986898/ekloges-2019-tsipras-epanaliptikes-kipseli.jpg -- 1200x800
			newsrc = src
				.replace(/(\/media\/+.*\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9]+\/+)(?:facebook\/+facebook|(?:thumb|snapshot|facebook)\/+)/, "$1main/")
				.replace(/(\/media\/+.*\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9]+\/+photos\/+)[a-z]+\/+/, "$1full/");
			if (newsrc !== src)
				return newsrc;
			//return src.replace(/\/photos\/thumb\/([^/]*)$/, "/photos/full/$1");
		}

		if (domain === "i.gosmd.gr") {
			// https://i.gosmd.gr/templates/gossip/images/placeholder.jpg
			if (/\/templates\/+gossip\/+images\/+placeholder\.jpg/.test(src))
				return {
					url: src,
					bad: "mask"
				};
		}

		if (domain === "static.fustany.com") {
			// https://static.fustany.com/images/en/photo/large_thumb_Fustany-Celebrity_Style-Celebrities_on_the_Front_Row_at_New_York_Fashion_Week_Spring_2015-Rihanna-Altuzarra.jpg
			//   https://static.fustany.com/images/en/photo/small_Fustany-Celebrity_Style-Celebrities_on_the_Front_Row_at_New_York_Fashion_Week_Spring_2015-Rihanna-Altuzarra.jpg
			//   https://static.fustany.com/images/en/photo/large_Fustany-Celebrity_Style-Celebrities_on_the_Front_Row_at_New_York_Fashion_Week_Spring_2015-Rihanna-Altuzarra.jpg
			//   https://static.fustany.com/images/en/photo/Fustany-Celebrity_Style-Celebrities_on_the_Front_Row_at_New_York_Fashion_Week_Spring_2015-Rihanna-Altuzarra.jpg -- 2001x3000
			return {
				url: src.replace(/\/photo\/[a-z]+_([^/]*)$/, "/photo/$1"),
				headers: {
					Referer: "http://fustany.com/en/fashion/celebrity-style/front-row-celebrities-at-new-york-fashion-week-spring-2015"
				}
			};
		}

		if (domain_nosub === "protv.md" &&
			domain.match(/^assets[0-9]*\.protv/)) {
			// http://assets.protv.md/articles/files/thumbs/650x/1424531.jpg
			//   http://retete.perfecte.md/assets/articles/images/original/1424531.jpg
			// http://assets1.protv.md/articles/files/thumbs/700x/3424711.jpg
			//   http://retete.perfecte.md/assets/articles/images/original/3424711.jpg
			// http://assets.protv.md/articles/files/thumbs/700x/2019/04/24/20190423-kim-jong-un-15560968178ix2fj6.jpeg
			//   http://assets.protv.md/articles/images/original/2019/04/24/20190423-kim-jong-un-15560968178ix2fj6.jpeg
			return src
				.replace(/:\/\/[^/]*\/articles\/files\/thumbs\/[0-9]+x(?:[0-9]+)?(\/[0-9]+\.[^/.]*)$/,
						 "://retete.perfecte.md/assets/articles/images/original$1")
				.replace(/\/articles\/+files\/+thumbs\/+[0-9]+x(?:[0-9]+)?\/+/, "/articles/images/original/");
		}

		if (domain_nowww === "bgol.us" ||
			// https://defenceforumindia.com/forum/proxy.php?image=https%3A%2F%2Fwww.army.mil%2Fe2%2Fc%2Fimages%2F2017%2F03%2F31%2F472049%2Fsize0.jpg&hash=699d728bd8d19598da9dbd722e7f1a6f
			//   https://www.army.mil/e2/c/images/2017/03/31/472049/size0.jpg
			domain_nowww === "defenceforumindia.com") {
			// https://www.bgol.us/forum/proxy.php?image=http%3A%2F%2Fmedia.philstar.com%2Fimages%2Fthe-philippine-star%2Fsports%2F20150414%2Fpacquiao-rousey-2.jpg&hash=846f88cc38c91693da5f567184ee6d2f
			//   http://media.philstar.com/images/the-philippine-star/sports/20150414/pacquiao-rousey-2.jpg
			return decodeURIComponent(src.replace(/.*?\/forum\/proxy\.php.*?[?&]image=([^&]*).*?$/, "$1"));
		}

		if (domain === "resources.tidal.com") {
			// https://resources.tidal.com/images/30503edc/04d2/46d9/88dd/f3274fce9324/320x320.jpg
			//   https://resources.tidal.com/images/30503edc/04d2/46d9/88dd/f3274fce9324/origin.jpg
			return src.replace(/\/[0-9]+x[0-9]+(\.[^/.]*)$/, "/origin$1");
		}

		if (domain === "i.kfs.io") {
			// https://i.kfs.io/album/global/9442692,0v1/fit/500x500.jpg
			//   https://i.kfs.io/album/global/9442692,0v1/original.jpg
			// https://i.kfs.io/playlist/global/28537322v1/cropresize/200x200.jpg
			//   https://i.kfs.io/playlist/global/28537322v1/original.jpg
			return src.replace(/\/(?:fit|cropresize)\/+[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "/original$1");
			//return src.replace(/\/cropresize\/+[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "/original$1");
		}

		if (domain_nosub === "fuskator.com") {
			// https://fuskator.com/small/iA3vsUWvpqT/thumb-1.jpg
			//   https://i9.fuskator.com/large/iA3vsUWvpqT/image-1.jpg
			return {
				url: src
				//.replace(/\/thumb-([0-9]*\.[^/.]*)$/, "/image-$1")
					.replace(/(:\/\/[^/]*\/)small\//, "$1large/"),
				//.replace(/:\/\/fuskator\.com\//, "://i9.fuskator.com/");
				can_head: false
			};
		}

		if (domain === "ssref.net") {
			// ssref.net != www.sfref.net
			// http://ssref.net/scripts/image_resize.cgi?min=200&url=https://d3k2oh6evki4b7.cloudfront.net/req/201806211/images/headshots/e/e083ea50_davis.jpg
			//   https://d3k2oh6evki4b7.cloudfront.net/req/201806211/images/headshots/e/e083ea50_davis.jpg
			return decodeURIComponent(src.replace(/.*?\/image_resize\.cgi.*?[?&]url=([^&]*).*?$/, "$1"));
		}

		if (domain_nosub === "intermedia.ge"/* &&
			domain.match(/server[0-9]*\.intermedia\.ge/)*/) {
			// http://server4.intermedia.ge/article_images/small/201401/2014012814022421579.jpg
			//   http://server4.intermedia.ge/article_images/large/201401/2014012814022421579.jpg
			// http://server1.intermedia.ge/pictures/small/180/180494.jpg?/prezidentis-sasaxle.jpg
			//   http://server1.intermedia.ge/pictures/original/180/180494.jpg?/prezidentis-sasaxle.jpg -- has watermark
			// http://server1.intermedia.ge/pictures/original/187/187829.jpg?/qarTuli-silamaze.jpg -- no watermark
			// http://intermedia.ge/uploads/article_images2/small/13689792768013.jpg
			//   http://intermedia.ge/uploads/article_images2/large/13689792768013.jpg
			return src
				.replace(/(\/article_images[0-9]*\/)[a-z]+\//, "$1large/")
				.replace(/\/pictures\/[a-z]+\//, "/pictures/original/");
		}

		if (domain_nowww === "sqshi.com") {
			// http://www.sqshi.com/img.php?imgurl=http://mmbiz.qpic.cn/mmbiz/tjGXef7Wic6vJYcWwicP133lkTsaxoxFEzZX9MYBhUc3puACLiaWesCjqYXjvyt3cYKV0EeQgvEjYQgaGdRAe4FSw/0?wx_fmt=jpeg
			//   http://mmbiz.qpic.cn/mmbiz/tjGXef7Wic6vJYcWwicP133lkTsaxoxFEzZX9MYBhUc3puACLiaWesCjqYXjvyt3cYKV0EeQgvEjYQgaGdRAe4FSw/0?wx_fmt=jpeg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/img\.php.*?[?&]imgurl=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "i.annihil.us") {
			// http://i.annihil.us/u/prod/marvel/i/mg/5/b0/4f872edbcddde/detail.jpg -- 550x853
			//   http://i.annihil.us/u/prod/marvel/i/mg/5/b0/4f872edbcddde/clean.jpg -- 1816x2816
			return src.replace(/(\/[0-9a-f]+\/)detail(\.[^/.]*)$/, "$1clean$2");
		}

		if (domain === "pimg.mycdn.me" ||
			// https://s4.sywcdn.net/getImage?url=https%3A%2F%2Fimages.homedepot-static.com%2FproductImages%2Ff4e34aad-9d82-46c9-a38f-a1175e50de09%2Fsvn%2Fiq-america-door-chimes-kits-245821-64_1000.jpg&t=Product&w=1500&h=1500&qlt=100&mrg=1&str=1&s=7a5e0893f3afb59a6c1764ea32ecda8f
			//   https://images.homedepot-static.com/productImages/f4e34aad-9d82-46c9-a38f-a1175e50de09/svn/iq-america-door-chimes-kits-245821-64_1000.jpg
			(domain_nosub === "sywcdn.net" && domain.match(/^s[0-9]*\./))) {
			// https://pimg.mycdn.me/getImage?url=http%3A%2F%2Fcdn.ok-magazine.ru%2Fcdn%2Ffarfuture%2FTNYbFLIgxMSinQm9JCDwPwuBARaukO40WV04KXprx8A%2Fmtime%3A1474324275%2Fsites%2Fdefault%2Ffiles%2Fstyles%2F620_620_2014%2Fpublic%2Flll_d34_05759_r.jpg%3Fitok%3DwFNbCbKo&type=WIDE_FEED_PANORAMA&signatureToken=2DySh4jD-d-_4Gmusanj_Q
			//   http://cdn.ok-magazine.ru/cdn/farfuture/TNYbFLIgxMSinQm9JCDwPwuBARaukO40WV04KXprx8A/mtime:1474324275/sites/default/files/styles/620_620_2014/public/lll_d34_05759_r.jpg?itok=wFNbCbKo
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/getImage.*?[?&]url=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nowww === "dissidia-france.com") {
			// http://www.dissidia-france.com/news/18-04-18/small/artwork.jpg
			//   http://www.dissidia-france.com/news/18-04-18/big/artwork.jpg
			return src.replace(/\/small\/([^/]*)$/, "/big/$1");
		}

		if (domain === "cdn.asiatatler.com" ||
			// http://indonesiatatler.com/images/i/gallery1-20170507132916-DakotaFanningJimmyChoo5_resized_600x900.jpg
			//   http://indonesiatatler.com/images/i/gallery1-20170507132916-DakotaFanningJimmyChoo5.jpg
			domain_nowww === "indonesiatatler.com") {
			// https://cdn.asiatatler.com/asiatatler/hk/i/2018/06/01110551-JessicaAlba-HEROshot-1920x1200_cropped_1584x780.jpg
			//   https://cdn.asiatatler.com/asiatatler/hk/i/2018/06/01110551-JessicaAlba-HEROshot-1920x1200.jpg
			// https://cdn.asiatatler.com/asiatatler/hk/i/2018/07/17163159-EmmaWatson_resized_1333x2000.jpg
			//   https://cdn.asiatatler.com/asiatatler/hk/i/2018/07/17163159-EmmaWatson.jpg
			return src.replace(/_(?:cropped|resized)_[0-9]+x[0-9]+(\.[^/.]*)$/, "$1");
		}

		if (domain_nosub === "stylowi.pl" &&
			domain.match(/^img[0-9]*\.stylowi\.pl/)) {
			// http://img1.stylowi.pl//images/items/s/201605/stylowi_pl_fotografia_jessica-alba_44333333.jpg -- 210x294
			//   http://img1.stylowi.pl//images/items/m/201605/stylowi_pl_fotografia_jessica-alba_44333333.jpg -- 440x642
			//   http://img1.stylowi.pl//images/items/l/201605/stylowi_pl_fotografia_jessica-alba_44333333.jpg -- 740x1062
			//   http://img1.stylowi.pl//images/items/o/201605/stylowi_pl_fotografia_jessica-alba_44333333.jpg -- 870x1244
			return src.replace(/\/images\/items\/[a-z]\//, "/images/items/o/");
		}

		if (domain === "files.dals.media") {
			// https://files.dals.media/mediafiles/image/2018/05/07/10-NbyVVd__prev__.jpg
			//   https://files.dals.media/mediafiles/image/2018/05/07/10-NbyVVd__original__.jpg
			return src.replace(/__[a-z]+__(\.[^/.]*)$/, "__original__$1");
		}

		if (domain === "media.linkonlineworld.com") {
			// http://media.linkonlineworld.com/img/large/2018/4/28/2018_4_28_14_10_17_815.jpg
			//   http://media.linkonlineworld.com/img/original/2018/4/28/2018_4_28_14_10_17_815.jpg
			return src.replace(/\/img\/large\//, "/img/original/");
		}

		if (amazon_container === "marieclairebucket") {
			// https://marieclairebucket.s3.amazonaws.com/release/0usr_636376812121056000460x547.jpg
			//   https://marieclairebucket.s3.amazonaws.com/release/0usr_636376812121056000.jpg
			//   https://s3.amazonaws.com/marieclairebucket/release/0usr_636376812121056000.jpg
			// https://marieclairebucket.s3.amazonaws.com/release/0usr_636376812130728000286x334.jpg
			//   https://marieclairebucket.s3.amazonaws.com/release/0usr_636376812130728000286x334.jpg
			return src.replace(/000[0-9]+?x[0-9]+(\.[^/.]*)$/, "000$1");
		}

		if (domain_nosub === "nh.ee" ||
			// https://g3.delphi.lv/images/pix/659x380/gvIr4UDkqlE/d53385645abb20b67b-46714667.jpg
			//   https://g3.delphi.lv/images/pix/gvIr4UDkqlE/d53385645abb20b67b-46714667.jpg
			domain_nosub === "delphi.lv" ||
			// https://g.delfi.ee/images/pix/240x184/sVfaNehgrRc/a5f375c3ebf474efc7-85036223.jpg
			//   https://g.delfi.ee/images/pix/sVfaNehgrRc/a5f375c3ebf474efc7-85036223.jpg
			domain_nosub === "delfi.ee" ||
			// https://g4.dcdn.lt/images/pix/205x124/BZqdAEgEM0k/moteris-61412415.jpg
			//   https://g4.dcdn.lt/images/pix/BZqdAEgEM0k/moteris-61412415.jpg
			domain_nosub === "dcdn.lt") {
			// http://g3.nh.ee/images/pix/376x250/bJ9--ccu2TI/foto-scanpix-75111475.jpg
			//   http://g3.nh.ee/images/pix/bJ9--ccu2TI/foto-scanpix-75111475.jpg
			// http://g2.nh.ee/images/pix/376x250/Oi8Ia67GlU8/reserved-81831817.jpg
			//   http://g2.nh.ee/images/pix/Oi8Ia67GlU8/reserved-81831817.jpg
			return src.replace(/\/images\/pix\/[0-9]+x[0-9]+\//, "/images/pix/");
		}

		if (domain === "read.html5.qq.com" ||
			// https://cdn.read.html5.qq.com/image?src=circle&q=5&r=0&imgflag=7&cdn_cache=24&imageUrl=http%3A%2F%2Fp%2Eqpic%2Ecn%2Fmttcircle%2F3059959958%2F11105527854m656647i1009437104_201803w01_7da7ec0a99792967531853d3e42132f8%2Ejp%2F0
			//   http://p.qpic.cn/mttcircle/3059959958/11105527854m656647i1009437104_201803w01_7da7ec0a99792967531853d3e42132f8.jp/0
			domain === "cdn.read.html5.qq.com") {
			// http://read.html5.qq.com/image?src=forum&q=5&r=0&imgflag=7&imageUrl=https://mmbiz.qpic.cn/mmbiz/HiaNy8LPboMzo9U0Dg38XibJQia6sicM2D26icquxZic0eRPVRNLGDSMYu2tgnZ6RjqOaZEJ3608def8gpZEicX2WAM2Q/0
			//   https://mmbiz.qpic.cn/mmbiz/HiaNy8LPboMzo9U0Dg38XibJQia6sicM2D26icquxZic0eRPVRNLGDSMYu2tgnZ6RjqOaZEJ3608def8gpZEicX2WAM2Q/0
			return decodeURIComponent(src.replace(/^[a-z]+:\/\/[^/]*\/image.*?[?&]imageUrl=([^&]*).*?$/, "$1"));
		}

		if (domain === "img.chuansong.me" ||
			// http://img.weiduba.net/mmbiz_png/3WKoAveGcfiaeOJ4S2270mgicByQTWNK6mHbOXIDInFbic6WolbkXtOta2r1waAToJlhCTI2sLU0iap77iabCvNJ0qg/640?wx_fmt=png
			domain === "img.weiduba.net" ||
			// http://img5.zx590.com/mmbiz/Kia46cB1ib34X5sqr3zgL9fU0fZnL8YwYG3pBWowkibGicRVedl4Ybud681dCUXAEib5H0iawLibDhEagbwKAWicguWeHw/0?wx_fmt=jpeg
			//   http://mmbiz.qpic.cn/mmbiz/Kia46cB1ib34X5sqr3zgL9fU0fZnL8YwYG3pBWowkibGicRVedl4Ybud681dCUXAEib5H0iawLibDhEagbwKAWicguWeHw/0
			(domain_nosub === "zx590.com" && domain.match(/^img[0-9]*\./)) ||
			// http://img1.jinciwei.cn/mmbiz_jpg/Mczq9OQm09bQqk9NXJIeWJJ0wfOHfsicHrdmLbdIdEW0qnZJKOXCFGGdENWwdXiceE0vJlcJQoonnDzhib0y9y59g/640?wx_fmt=jpeg&wx_lazy=1
			//   http://mmbiz.qpic.cn/mmbiz_jpg/Mczq9OQm09bQqk9NXJIeWJJ0wfOHfsicHrdmLbdIdEW0qnZJKOXCFGGdENWwdXiceE0vJlcJQoonnDzhib0y9y59g/640?wx_fmt=jpeg&wx_lazy=1
			(domain_nosub === "jinciwei.cn" && domain.match(/img[0-9]*\./))) {
			// http://img.chuansong.me/mmbiz/6sMn1CfyttCg3RjpIOT9Io9a0zaYCC7ZwuEmjTDj71TeOGfyWXsyCC96mQib9Hr7CCtw6J39BcMdz0eiauOVfjlw/0?wx_fmt=jpeg
			//   http://mmbiz.qpic.cn/mmbiz/6sMn1CfyttCg3RjpIOT9Io9a0zaYCC7ZwuEmjTDj71TeOGfyWXsyCC96mQib9Hr7CCtw6J39BcMdz0eiauOVfjlw/0?wx_fmt=jpeg
			return src.replace(/:\/\/[^/]*\/(mmbiz(?:_[a-z]+)?)\//, "://mmbiz.qpic.cn/$1/");
		}

		if (domain === "cdn.iguang.co") {
			// https://cdn.iguang.co/22c037fc/mmbiz_jpg/m472J5FqZ3jdicDcgFIwdru4GkTR8iaTeAlJv5C2Swmtb7NeOkEiaBvDvBO82VJaXrSpeDRCBKqicJbmibUxZicZUp2A/0?wx_fmt=jpeg
			//   https://mmbiz.qpic.cn/mmbiz_jpg/m472J5FqZ3jdicDcgFIwdru4GkTR8iaTeAlJv5C2Swmtb7NeOkEiaBvDvBO82VJaXrSpeDRCBKqicJbmibUxZicZUp2A/0?wx_fmt=jpeg
			return src.replace(/:\/\/[^/]*\/[0-9a-f]+\/(mmbiz(?:_[a-z]+)?)\//, "://mmbiz.qpic.cn/$1/");
		}

		if (domain === "pic.kuaizhan.com") {
			// http://pic.kuaizhan.com/g2/M01/2A/74/CgpQVFXS1uWAaQTSAAGAmL2_SsY8922594/imageView/v1/thumbnail/640x0
			//   http://pic.kuaizhan.com/g2/M01/2A/74/CgpQVFXS1uWAaQTSAAGAmL2_SsY8922594
			return src.replace(/\/imageView\/v[0-9]*\/.*/, "");
		}

		if ((domain_nosub === "popcornnews.ru" && domain.match(/v[0-9]*\.popcornnews\.ru/)) ||
			// https://static.kinoafisha.info/k/movie_posters/1080x1920/upload/movie_posters/6/0/4/8327406/fbffbd348e19ab4017d143d91a9ecbb5.jpeg
			//   https://static.kinoafisha.info/upload/movie_posters/6/0/4/8327406/fbffbd348e19ab4017d143d91a9ecbb5.jpeg
			// https://static.kinoafisha.info/k/news/580/upload/news_images/0/2/6/8329620/e4d9a81021ca2590a28746e13f900da1.jpeg
			//   https://static.kinoafisha.info/upload/news_images/0/2/6/8329620/e4d9a81021ca2590a28746e13f900da1.jpeg
			// https://static.kinoafisha.info/k/fests/600/upload/fests/4/5/0/54/c0c0606483cd423c088ba8b8da169d68.jpeg
			//   https://static.kinoafisha.info/upload/fests/4/5/0/54/c0c0606483cd423c088ba8b8da169d68.jpeg
			domain === "static.kinoafisha.info") {
			// http://v1.popcornnews.ru/k/news/500x700/upload/news_images/9/3/3/146339/f05d636fe83741bcbd1f870f019c8e26.jpg
			//   http://v1.popcornnews.ru/upload/news_images/9/3/3/146339/f05d636fe83741bcbd1f870f019c8e26.jpg -- no watermark
			return src
				.replace(/(:\/\/[^/]*\/+)k\/+[a-z_]+\/+[0-9]+(?:x[0-9]+)?\/+upload\//, "$1upload/")
			// https://v1.popcornnews.ru/upload/_500_600_80_LWRHQa.jpg
			//   https://v1.popcornnews.ru/upload/LWRHQa.jpg
				.replace(/(:\/\/[^/]*\/+upload\/+)_[0-9]+_[0-9]+_[0-9]+_([^/_.]*\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "amorq.com" ||
			// http://prikolno.cc/uploads/tumb/img/201609/4eec60a6f7b93d8ec969fe7708b209d6_tumb_660.jpg -- stretched
			//   http://prikolno.cc/uploads/img/201609/4eec60a6f7b93d8ec969fe7708b209d6.jpg
			domain_nowww === "prikolno.cc" ||
			// http://interesno.cc/uploads/tumb/title/201703/368b6bf853582f9fcd59ba9c63f397b1_tumb_660.jpg
			//   http://interesno.cc/uploads/title/201703/368b6bf853582f9fcd59ba9c63f397b1.jpg
			domain_nowww === "interesno.cc" ||
			// http://obaldenno.com/uploads/tumb/title/201706/all-inclusive-buffet-breakfast_tumb_340.jpg
			//   http://obaldenno.com/uploads/title/201706/all-inclusive-buffet-breakfast.jpg
			// http://obaldenno.com/uploads/tumb/img/201703/dehjjzi-ridli-foto-daisy-ridley-photo-4_1490809870_tumb_660.jpg
			//   http://obaldenno.com/uploads/img/201703/dehjjzi-ridli-foto-daisy-ridley-photo-4_1490809870.jpg
			domain_nowww === "obaldenno.com") {
			// http://amorq.com/uploads/tumb/img/201802/9cgewbn_tumb_660.jpg
			//   http://amorq.com/uploads/img/201802/9cgewbn.jpg
			return src.replace(/\/uploads\/tumb(\/[a-z]+\/[0-9]+\/[^/.]+)_tumb_[0-9]+(\.[^/.]*)$/, "/uploads$1$2");
		}

		if (domain_nosub === "pinme.ru" &&
			domain.match(/^cdn/)) {
			// https://cdn-nus-1.pinme.ru/tumb/600/photo/af/70/af708c3de5366834ec0f44dac99d4150.jpg
			//   https://cdn-nus-1.pinme.ru/photo/af/70/af708c3de5366834ec0f44dac99d4150.jpg
			// https://cdn-nus-1.pinme.ru/tumb/600//photo/02/a0/02a0a85155afa459cc04b295ea487d9c.jpg
			//   https://cdn-nus-1.pinme.ru/photo/02/a0/02a0a85155afa459cc04b295ea487d9c.jpg
			return src.replace(/\/+tumb\/+[0-9]+\/+photo\//, "/photo/");
		}

		if (domain_nosub === "kakprosto.ru") {
			// https://st03.kakprosto.ru/tumb/680/images/article/2019/11/2/130132_5dbd0570daa4c5dbd0570daa84.jpeg
			//   https://st03.kakprosto.ru/images/article/2019/11/2/130132_5dbd0570daa4c5dbd0570daa84.jpeg
			return src.replace(/\/tumb\/+[0-9]+\/+images\//, "/images/");
		}

		if (domain_nosub === "postila.ru" &&
			domain.match(/^img[0-9]*\.postila\.ru/)) {
			// https://img11.postila.ru/resize?w=660&src=%2Fdata%2F88%2F12%2F77%2F41%2F8812774170b8f5379e1d15f676b1937c89c1ff8c8662136e557a7bc1145609f4.jpg
			//   https://img11.postila.ru/data/88/12/77/41/8812774170b8f5379e1d15f676b1937c89c1ff8c8662136e557a7bc1145609f4.jpg
			return urljoin(src, decodeURIComponent(src.replace(/^[a-z]+:\/\/[^/]*\/resize.*?[?&]src=([^&]*).*?$/, "$1")), true);
		}

		if (domain_nowww === "enolivier.com" ||
			// http://www.fotoventasdigital.com/img/jessica-alba-company/_thumb/chic-parisdiaper-jessica-honest-company-sued-again-in-false-advertising-plus-jessica-alba-at-a-launch-event-then-honest-springtime_jessica-alba-company_250x250.jpg
			//   http://www.fotoventasdigital.com/img/jessica-alba-company/_fullsize/chic-parisdiaper-jessica-honest-company-sued-again-in-false-advertising-plus-jessica-alba-at-a-launch-event-then-honest-springtime_jessica-alba-company.jpg
			domain_nowww === "fotoventasdigital.com") {
			// http://enolivier.com/img/jessica-alba-company/_thumb/excellent-false-advertising-for-parisdiaper-jessica-honest-company-sued-again-together-with-jessica-alba-at-a-launch-event-also-honest-springtime_jessica-alba-company_250x250.jpg
			//   http://enolivier.com/img/jessica-alba-company/_fullsize/excellent-false-advertising-for-parisdiaper-jessica-honest-company-sued-again-together-with-jessica-alba-at-a-launch-event-also-honest-springtime_jessica-alba-company.jpg
			return src.replace(/\/_thumb\/([^/]*)_[0-9]+x[0-9]+(\.[^/.]*)$/, "/_fullsize/$1$2");
		}

		if (domain === "ss.metronews.ru" ||
			// https://ss.sport-express.ru/userfiles/materials/24/241063/medium.jpg -- 258x150
			//   https://ss.sport-express.ru/userfiles/materials/24/241063/full.jpg -- 1200x801
			//   https://ss.sport-express.ru/userfiles/materials/24/241063/origin.jpg -- 7360x4912
			domain === "ss.sport-express.ru") {
			// https://ss.metronews.ru/userfiles/materials/116/1160022/858x540.jpg
			//   https://ss.metronews.ru/userfiles/materials/116/1160022/origin.jpg
			return src.replace(/(\/userfiles\/materials\/[0-9]+\/[0-9]+\/)(?:[0-9]+x[0-9]+|[a-z]+)(\.[^/.]*)$/, "$1origin$2");
		}

		if (domain_nosub === "mtvnimages.com" ||
			// thanks to roi:
			// https://images.paramount.tech/uri/mgid:arc:imageassetref:logotv.com:cb68b9c0-eb41-11ec-b047-02e53f0256a7?quality=0.7&gen=ntrn&legacyStatusCode=true&width=1200&height=630&crop=true
			//   https://images.paramount.tech/uri/mgid:arc:imageassetref:logotv.com:cb68b9c0-eb41-11ec-b047-02e53f0256a7
			domain === "images.paramount.tech" ||
			// http://imagesmtv-a.akamaihd.net/uri/mgid:file:http:shared:mtv.com/news/wp-content/uploads/2016/03/Spy-Kids-1459273031.jpg?quality=.8&height=400&wid
			domain === "imagesmtv-a.akamaihd.net") {
			// http://mtv.mtvnimages.com/uri/mgid:file:gsp:scenic:/international/mtvema/2017/images/nominees/Taylor_Swift_1940x720.jpg?quality=0.85&width=1024&height=450&crop=true -- 400
			// https://mtv.mtvnimages.com/uri/mgid:file:http:shared:mtv.com/news/wp-content/uploads/2017/03/GettyImages-661260604-1490974103.jpg?quality=.8&height=1221.3740458015266&width=800 -- 400
			// http://vh1.mtvnimages.com/uri/mgid:file:http:shared:vh1.com/news/uploads/sites/2/2018/03/GettyImages-873076880-1522090083.jpg?quality=0.85&format=jpg&width=480
			// http://mtv-intl.mtvnimages.com/uri/mgid:arc:content:mtvasia.com:cdeab016-8964-423d-96ae-8ec187190fef?ep=mtvasia.com&stage=live&format=jpg&quality=0.8&quality=0.85&width=656&height=369&crop=true
			//   http://mtv-intl.mtvnimages.com/uri/mgid:arc:content:mtvasia.com:cdeab016-8964-423d-96ae-8ec187190fef

			// https://mtv.mtvnimages.com/uri/mgid:arc:content:mtv.com:cd8f7656-37ff-46f0-8601-aff8e7612fda?quality=0.1
			//   https://mtv.mtvnimages.com/uri/mgid:arc:content:mtv.com:cd8f7656-37ff-46f0-8601-aff8e7612fda -- 1920x1080
			newsrc = remove_queries(src, ["quality", "width", "height", "crop", "legacyStatusCode", "gen"]);
			if (newsrc !== src) {
				return {
					url: newsrc,
					can_head: false
				};
			}

			// can crop:
			// https://mtv.mtvnimages.com/uri/mgid:ao:image:mtv.com:665567?quality=0.8&format=jpg&width=1440&height=810&.jpg
			//   https://mtv.mtvnimages.com/uri/mgid:ao:image:mtv.com:665567 -- 1633x919
			//return src.replace(/(\?ep=[^&]*).*/, "$1");
			newsrc = src.replace(/\?.*$/, "");
			if (false&&newsrc !== src) {
				return {
					url: newsrc,
					can_head: false
				};
			}
		}

		if (domain_nosub === "mtvnimages.com" ||
			// http://imagesmtv-a.akamaihd.net/uri/mgid:file:http:shared:mtv.com/news/wp-content/uploads/2016/09/Guess-whooooooo-1473944872.jpg
			//   http://mtv.com/news/wp-content/uploads/2016/09/Guess-whooooooo-1473944872.jpg -- doesn't exist
			//   http://imagesmtv-a.akamaihd.net/news/wp-content/uploads/2016/09/Guess-whooooooo-1473944872.jpg -- works
			domain === "imagesmtv-a.akamaihd.net") {
			// http://vh1.mtvnimages.com/uri/mgid:file:http:shared:vh1.com/news/uploads/sites/2/2018/03/GettyImages-873076880-1522090083.jpg
			//   http://vh1.com/news/uploads/sites/2/2018/03/GettyImages-873076880-1522090083.jpg
			//   http://www.vh1.com/news/uploads/sites/2/2018/03/GettyImages-873076880-1522090083.jpg
			return src.replace(/^[a-z]+:\/\/[^/]*\/uri\/mgid:file:(https?):shared:([^/:]*\/)/, "$1://$2");
		}

		if (domain_nowww === "vh1.com") {
			// http://www.vh1.com/news/uploads/sites/2/2018/03/GettyImages-873076880-1522090083.jpg
			return {
				url: src,
				can_head: false
			};
		}

		if (domain === "user-uploads.aznude.com") {
			// https://user-uploads.aznude.com/data/thumbs/victoriajustice/OZUWG5DPOJUWCLLKOVZXI2LDMUWXGZLYPEWTCNZNOBUG65DPOMWWO2LGOM======/TheFappeningBlog.com-Victoria-Justice-Sexy-13.jpg
			//   https://user-uploads.aznude.com/data/azncdn/victoriajustice/OZUWG5DPOJUWCLLKOVZXI2LDMUWXGZLYPEWTCNZNOBUG65DPOMWWO2LGOM======/TheFappeningBlog.com-Victoria-Justice-Sexy-13.jpg
			return src.replace(/(:\/\/[^/]*\/data\/)thumbs\//, "$1azncdn/");
		}

		if (domain_nosub === "aznude.com" && /^cdn[0-9]*\./.test(domain)) {
			newsrc = src.replace(/\/antibandit\/+([^/]+\/+[^/]+\/+)thumb[0-9]+_/, "/$1");
			if (newsrc !== src)
				return newsrc;

			// https://cdn1.aznude.com/heatherhemmens/hellcats/hel-bac-hemmens-1-HD-lo.mp4 -- 360p
			//   https://cdn1.aznude.com/heatherhemmens/hellcats/hel-bac-hemmens-1-HD-hi.mp4 -- 480p
			//   https://cdn1.aznude.com/heatherhemmens/hellcats/hel-bac-hemmens-1-HD-hd.mp4 -- 720p
			regex = /(:\/\/[^/]+\/+(?:[^/]+\/+){2}[^/]+)-(?:lo|hi)(\.[^/.]+)(?:[?#].*)?$/;
			if (regex.test(src)) {
				return [
					src.replace(regex, "$1-hd$2"),
					src.replace(regex, "$1-hi$2")
				];
			}
		}

		if (domain_nowww === "bstars.eu" ||
			// http://wstars.net/media/djcatalog2/images/1-grud-dzhennifer-lourens_m.jpg
			//   http://wstars.net/media/djcatalog2/images/1-grud-dzhennifer-lourens.jpg
			// doesn't work for all:
			// http://wstars.net/media/djcatalog2/images/nogi-kiry-najtli-03_t.jpg
			//   http://wstars.net/media/djcatalog2/images/nogi-kiry-najtli-03_f.jpg
			//   http://wstars.net/media/djcatalog2/images/nogi-kiry-najtli-03.jpg -- 404
			domain_nowww === "wstars.net" ||
			// https://bstars.ru/media/djcatalog2/images/item/15/bebe-rexha.3_f.jpg -- watermark
			//   https://bstars.ru/media/djcatalog2/images/item/15/bebe-rexha.3.jpg
			// https://bstars.ru/media/djcatalog2/images/item/15/bebe-rexha.1_l.jpg -- 300x280, watermark
			//   https://bstars.ru/media/djcatalog2/images/item/15/bebe-rexha.1.jpg
			// https://bstars.ru/media/djcatalog2/images/item/15/bebe-rexha.2_t.jpg
			//   https://bstars.ru/media/djcatalog2/images/item/15/bebe-rexha.2.jpg
			// https://bstars.ru/media/djcatalog2/images/item/9/lily-allen.1_m.jpg
			//   https://bstars.ru/media/djcatalog2/images/item/9/lily-allen.1.jpg
			domain_nowww === "bstars.ru") {
			// https://www.bstars.eu/media/djcatalog2/images/item/11/victoria-justice.2_f.jpg
			//   https://www.bstars.eu/media/djcatalog2/images/item/11/victoria-justice.2.jpg
			return src
				.replace(/(\/media\/+djcatalog2\/+images\/+item\/+[0-9]+\/+[^/]+\.[0-9]+)_[a-z](\.[^/.]*)$/, "$1$2")
				.replace(/(\/media\/+djcatalog2\/+images\/+[^/]+)_[a-z](\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "media.toofab.com" ||
			// https://toofab.akamaized.net/2017/03/16/2016-08-gettyimages-591898736-1000w.jpg
			//   https://toofab.akamaized.net/2017/03/16/2016-08-gettyimages-591898736.jpg
			domain === "toofab.akamaized.net") { // doesn't work for all urls
			// works:
			// https://media.toofab.com/2017/12/13/gettyimages-891360920-master-1000w.jpg
			// https://media.toofab.com/2017/12/13/gettyimages-891258416-master-1000w.jpg
			// doesn't work:
			// https://media.toofab.com/2017/10/31/screen-shot-2017-10-31-at-3-57-1000w.jpg (300x250 works)
			src = src.replace(/-[0-9]+w\.([^/.]*)/, ".$1");

			// works:
			// https://media.toofab.com/2018/01/02/stars-who-refuse-to-take-selfies-with-fans-split-480x360.jpg (1000w works too)
			// doesn't work: (access denied)
			// https://media.toofab.com/2018/01/02/0102-justin-timberlake-main-300x250.jpg
			// https://media.toofab.com/2018/01/02/0102-justin-timberlake-main-810x610.jpg
			// https://media.toofab.com/2017/10/23/gettyimages-844434368-810x610.jpg
			// https://media.toofab.com/2018/01/02/traveling-pants-everett-300x400.jpg
			// https://media.toofab.com/2017/11/01/timberlake-teaser-480x360.jpg
			// https://media.toofab.com/2017/12/22/1222-tom-katie-lala-main-300x250.jpg
			src = src.replace(/-[0-9]+x[0-9]+\.([^/.]*)/, ".$1");

			return src;
		}

		if (domain === "thumb.tvpalace.org") {
			// http://thumb.tvpalace.org/actor/victoria-justice/w75_6C.jpg
			//   http://thumb.tvpalace.org/actor/victoria-justice/6C.jpg
			return src.replace(/\/[wh][0-9]+_([^/]*\.[^/.]*)$/, "/$1");
		}

		if (domain_nowww === "mafab.hu") {
			// https://mafab.hu/static/thumb/w150/profiles/2014p/293/05/277358_18.jpg
			//   https://mafab.hu/static/profiles/2014p/293/05/277358_18.jpg
			return src.replace(/\/static\/thumb\/[wh][0-9]+\//, "/static/");
		}

		if (domain === "film.kinootziv.com" ||
			// http://static2.moviesfan.org/source/files/artists_photos_thumbs/dani/215480-danielle-panabaker509381.jpg
			//   http://static2.moviesfan.org/source/files/artists_photos/dani/215480-danielle-panabaker509381.jpg
			(domain_nosub === "moviesfan.org" && domain.match(/^static/)) ||
			// http://kinokach.com/source/files/artists_photos_thumbs/vict/victoriajustice297913.jpg
			//   http://www.kinokach.com/source/files/artists_photos/vict/victoriajustice297913.jpg
			domain_nowww === "kinokach.com") {
			// http://film.kinootziv.com/source/files/films_images_thumbs/vikt/viktoriya44022.jpg
			//   http://film.kinootziv.com/source/files/films_images/vikt/viktoriya44022.jpg
			return src.replace(/(:\/\/[^/]*\/source\/files\/[^/]*)_thumbs\//, "$1/");
		}

		if (amazon_container === "harmony-assets-live") {
			// http://harmony-assets-live.s3.amazonaws.com/image_source/7d/5f/7d5fc9007db632d8ce71fe01f00429732b3dad80.jpg
			return {
				src: url,
				can_head: false
			};
		}

		if (domain === "cdn.kme.si") {
			// https://cdn.kme.si/public/images-cache/750xX/2015/08/21/64f048b69f69d7ff3a1508a5b6b15d85/55d7408f5f4ec/64f048b69f69d7ff3a1508a5b6b15d85.jpeg
			//   https://cdn.kme.si/public/images/2015/08/21/64f048b69f69d7ff3a1508a5b6b15d85.jpeg
			return src.replace(/\/public\/images-cache\/[0-9X]+x[0-9X]+\/([0-9]+\/[0-9]+\/[0-9]+\/)[0-9a-f]+\/[0-9a-f]+\/([0-9a-f]+\.[^/.]*)$/,
							   "/public/images/$1$2");
		}

		if (domain_nosub === "slidely.com" &&
			domain.match(/cdn\.slidely\.com$/)) {
			// https://ak02-cdn.slidely.com/img-proxy/images.coveralia.com/autores/fotos/victoria-justice26398.jpg
			//   http://images.coveralia.com/autores/fotos/victoria-justice26398.jpg
			return src.replace(/^[a-z]+:\/\/[^/]*\/img-proxy\//, "http://");
		}

		if (domain_nosub === "hochu.ua") {
			// https://img2.hochu.ua//thumbnails/articles/cropm_568x568/67199_191683.jpg
			//   https://img2.hochu.ua//images/articles/67199_191683.jpg
			//   https://www.hochu.ua/images/articles/67199_191683.jpg
			return src.replace(/\/thumbnails\/articles\/crop[a-z]*_[0-9]+x[0-9]+\//, "/images/articles/");
		}

		if (domain === "media.professionali.ru") {
			// https://media.professionali.ru/processor/topics/size1/2016/06/02/001.jpg
			//   https://media.professionali.ru/processor/topics/original/2016/06/02/001.jpg
			return src.replace(/(\/processor\/[a-z]+\/)[^/]*\//, "$1original/");
		}

		if (domain_nowww === "stars-naked.ru") {
			// http://www.stars-naked.ru/pictures/Panabaker_Danielle/prev/s_od15tI-fmsc.jpg
			//   http://stars-naked.ru/pictures/Panabaker_Danielle/big/big_od15tI-fmsc.jpg
			//   http://stars-naked.ru/pictures/Panabaker_Danielle/od15tI-fmsc.jpg
			// http://www.stars-naked.ru/pictures/Panabaker_Danielle/prev/med_GvWz23ts7OA.jpg
			//   http://www.stars-naked.ru/pictures/Panabaker_Danielle/GvWz23ts7OA.jpg
			return src.replace(/(:\/\/[^/]*\/pictures\/[^/]*\/)[^/]*\/[a-z]+_([^/]*)$/, "$1$2");
		}

		if (domain_nowww === "avsforum.com" ||
			// http://www.sitcomsonline.com/photopost/data/3696/thumbs/Peyton_List_in_Bunk_d_2015_.jpg
			//   http://www.sitcomsonline.com/photopost/data/3696/Peyton_List_in_Bunk_d_2015_.jpg
			// http://www.sitcomsonline.com/photopost/data/2958/medium/selena_eyeprime_61.jpg
			//   http://www.sitcomsonline.com/photopost/data/2958/selena_eyeprime_61.jpg
			domain_nowww === "sitcomsonline.com") {
			// https://www.avsforum.com/photopost/data/2148226/thumbs/1/11/11ec6f6e_Danielle-Panabaker-Blue.jpeg
			//   https://www.avsforum.com/photopost/data/2148226/1/11/11ec6f6e_Danielle-Panabaker-Blue.jpeg
			return src.replace(/(\/photopost\/data\/[0-9]+\/)(?:thumbs|medium)\//, "$1");
		}

		if (domain_nowww === "pgmscreen.fr") {
			// http://www.pgmscreen.fr/protect.php?src=http://www.pgmscreen.fr/galerie/medium/med-WycxRxXQ2G-02-08-2016.jpg
			//   http://www.pgmscreen.fr/galerie/medium/med-WycxRxXQ2G-02-08-2016.jpg
			// http://www.pgmscreen.fr/watermark.php?src=http://www.pgmscreen.fr/galerie/grande/max-WycxRxXQ2G-02-08-2016.jpg
			//   http://www.pgmscreen.fr/galerie/grande/max-WycxRxXQ2G-02-08-2016.jpg
			newsrc = decodeURIComponent(src.replace(/^[a-z]+:\/\/[^/]*\/(?:protect|watermark)\.php.*?[?&]src=([^&]*).*?$/, "$1"));
			if (newsrc !== src)
				return newsrc;
			return src.replace(/\/galerie\/[a-z]+\/[a-z]+-/, "/galerie/grande/max-");
		}

		if (domain === "celeb.gate.cc" ||
			// thanks to anonymous for reporting:
			// https://celebgate.org/media/cache/headshot/upload/n/o/noel-berry-private-photos-58695.jpg
			//   https://celebgate.org/media/cache/image/upload/n/o/noel-berry-private-photos-58695.jpg
			domain_nowww == "celebgate.org") {
			// http://celeb.gate.cc/media/cache/headshot/upload/d/a/danielle-panabaker-leather-874342.jpeg
			//   http://celeb.gate.cc/media/cache/original/upload/d/a/danielle-panabaker-leather-874342.jpeg
			//   https://celeb.gate.cc/media/cache/image/upload/d/a/danielle-panabaker-leather-874342.jpeg -- 934x1400
			// https://celeb.gate.cc/media/cache/original/upload/i/s/isabela-merced-sexy-173842.jpg -- 815x1222
			//   https://celeb.gate.cc/media/cache/image/upload/i/s/isabela-merced-sexy-173842.jpg -- 2667x4000
			return src.replace(/(:\/\/[^/]*\/+media\/+cache\/+)[a-z]+\/+upload\//, "$1image/upload/");
		}

		if (domain_nowww === "modagid.ru") {
			// http://modagid.ru/files/photos/imgs/356/356155/large_danielle-panabaker-at-2017-entertainment-weekly-pre-emmy-party-in-west-hollywood-09-15-2017_1.jpg?1505575192
			//   http://modagid.ru/files/photos/imgs/356/356155/original_danielle-panabaker-at-2017-entertainment-weekly-pre-emmy-party-in-west-hollywood-09-15-2017_1.jpg?1505575192
			return src.replace(/(\/files\/photos\/imgs\/[0-9]+\/[0-9]+\/)[a-z]+_/, "$1original_");
		}

		if (domain_nowww === "zdf.de" &&
			string_indexof(src, "/assets/") >= 0) {
			// https://www.zdf.de/assets/teletext-dpa-image-der-eisberg-vor-der-groenlaendischen-kueste-am-dorf-innaarsuit-100~2400x1350?cb=1531503697356
			//   https://www.zdf.de/assets/teletext-dpa-image-der-eisberg-vor-der-groenlaendischen-kueste-am-dorf-innaarsuit-100~original?cb=1531503697356
			return src.replace(/~[0-9]+x[0-9]+([?#].*)?$/, "~original$1");
		}

		if (domain_nowww === "arcinfo.ch" ||
			// https://www.lacote.ch/media/image/71/normal_16_9/348625165-1.jpg
			//   https://www.lacote.ch/media/image/71/348625165-1.jpg
			domain_nowww === "lacote.ch") {
			// https://www.arcinfo.ch/media/image/71/small_16_9/348625165-1.jpg
			//   https://www.arcinfo.ch/media/image/71/348625165-1.jpg
			return src.replace(/(\/media\/image\/[0-9]*\/)[^/]*\/([0-9]+-[0-9]+\.[^/.]*)$/, "$1$2");
		}

		if (domain_nowww === "gulf365.co" ||
			// https://www.mogaznews.com/temp/resized/medium_2018-05-04-82574bed7c.jpg
			//   https://www.mogaznews.com/content/uploads/2018/05/04/82574bed7c.jpg
			// https://en.mogaznews.com/temp/resized/medium_2019-05-17-ff31a199b2.jpg
			//   https://en.mogaznews.com/content/uploads/2019/05/17/ff31a199b2.jpg
			domain_nosub === "mogaznews.com" ||
			// https://ksa-press.com/temp/resized/medium_2019-04-12-32857900c4.jpg
			//   https://ksa-press.com/content/uploads/2019/04/12/32857900c4.jpg
			domain_nowww === "ksa-press.com" ||
			// https://news-sinaa.com/temp/resized/medium_2019-06-06-1f09aafd16.jpg
			//   https://news-sinaa.com/content/uploads/2019/06/06/1f09aafd16.jpg
			domain_nowww === "news-sinaa.com" ||
			// https://www.akherkhabrtoday.com/temp/resized/medium_2019-05-17-ba287058f8.jpg
			//   https://www.akherkhabrtoday.com/content/uploads/2019/05/17/ba287058f8.jpg
			domain_nowww === "akherkhabrtoday.com" ||
			// https://www.arabyoum.com/temp/resized/medium_2019-05-21-8bd03f98e6.jpg
			//   https://www.arabyoum.com/content/uploads/2019/05/21/8bd03f98e6.jpg
			domain_nowww === "arabyoum.com" ||
			// https://uk-arabicnews.com/temp/resized/small_2019-05-21-81379206b3.jpg
			//   https://uk-arabicnews.com/content/uploads/2019/05/21/81379206b3.jpg
			domain_nowww === "uk-arabicnews.com" ||
			// https://www.alsharqtimes.com/temp/resized/medium_2018-07-14-12a167f5c5.jpg -- stretched
			//   https://www.alsharqtimes.com/content/uploads/2018/07/14/12a167f5c5.jpg
			domain_nowww === "alsharqtimes.com" ||
			// thanks to fedesk on discord for reporting:
			// https://news.fox-24.com/entertainment/temp/resized/medium_2022-01-06-42e03bde85.jpg
			//   https://news.fox-24.com/entertainment/content/uploads/2022/01/06/42e03bde85.jpg
			domain_nowww === "news.fox-24.com" ||
			// https://www.misrday.com/temp/thumb/450x225_uploads,2019,07,24,524e00c9a9.jpg
			// https://www.dmcnews.org/temp/thumb/450x225_uploads,2019,07,24,9dd6330e80.jpg
			src.match(/^[a-z]+:\/\/[^/]*\/temp\/+(?:thumb|resized)\/+(?:small|medium|[0-9]+x[0-9]+)_[0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9a-f]{10}\.[^/._]+(?:[?#].*)?$/) ||
			src.match(/^[a-z]+:\/\/[^/]*\/temp\/+(?:thumb|resized)\/+(?:small|medium|[0-9]+x[0-9]+)_uploads,[0-9]{4},[0-9]{2},[0-9]{2},[0-9a-f]{10}\.[^/._]+(?:[?#].*)?$/)) {
			// http://www.gulf365.co/temp/thumb/320x190_uploads,2018,07,15,bdc0651fec.jpg
			//   http://www.gulf365.co/content/uploads/2018/07/15/bdc0651fec.jpg
			// http://www.gulf365.co/temp/resized/medium_2017-08-19-bbb37bcbc2.jpg
			//   http://www.gulf365.co/content/uploads/2017/08/19/bbb37bcbc2.jpg
			return src
				.replace(/(\/)temp\/(?:thumb|resized)\/[^-/_.]+_uploads,([0-9]+),([0-9]+),([0-9]+),([0-9a-f]+\.[^/.]*)$/,
						 "$1content/uploads/$2/$3/$4/$5")
				.replace(/(\/)temp\/(?:thumb|resized)\/[a-z]+_([0-9]+)-([0-9]+)-([0-9]+)-([0-9a-f]+\.[^/.]*)$/,
						 "$1content/uploads/$2/$3/$4/$5");
		}

		if (domain_nowww === "aljazeera.com") {
			// https://www.aljazeera.com/mritems/imagecache/mbdresplarge/mritems/Images/2018/7/15/6e6bcf4305f34f38831be340b4912535_18.jpg
			//   https://www.aljazeera.com/mritems/Images/2018/7/15/6e6bcf4305f34f38831be340b4912535_18.jpg
			return src.replace(/\/mritems\/imagecache\/[^/]*\/mritems\//, "/mritems/");
		}

		if (domain === "media.publika.md" ||
			// https://media.dcbusiness.ro/image/201812/w670/aqaman_01347100.jpg
			//   https://media.dcbusiness.ro/image/201812/full/aqaman_01347100.jpg
			domain === "media.dcbusiness.ro" ||
			// https://media.realitatea.net/multimedia/image/201406/w298/petite_asian_girls_05_46604800.jpg
			//   https://media.realitatea.net/multimedia/image/201406/full/petite_asian_girls_05_46604800.jpg
			domain === "media.realitatea.net" ||
			// https://media.feminis.ro/media/image/201902/w650h280/jason_16618900.png
			//   https://media.feminis.ro/media/image/201902/full/jason_16618900.png
			domain === "media.feminis.ro") {
			// https://media.publika.md/md/image/201807/w400/aisberg-groelanda_99594600.jpg
			//   https://media.publika.md/md/image/201807/full/aisberg-groelanda_99594600.jpg
			return src.replace(/(\/image\/+[0-9]{6}\/)+w[0-9]+(?:h[0-9]+)?\/+/, "$1full/");
			//return src.replace(/\/[wh][0-9]+\/([^/]+_[0-9]+\.[^/.]*)$/, "/full/$1");
		}

		if (domain === "images.tagesschau.de") {
			// thanks to roi:
			// https://images.tagesschau.de/image/80b637db-a460-4ec5-8d05-55dc6003e30e/AAABh0bJIz8/AAABibBxvls/16x9-768/panzerhaubitze-ukraine-107.webp
			//   https://images.tagesschau.de/image/80b637db-a460-4ec5-8d05-55dc6003e30e/AAABh0bJIz8/AAABibBxvls/original/panzerhaubitze-ukraine-107.webp
			// https://images.tagesschau.de/image/c6184b7d-2207-4ab7-a5ec-bcce66bbdf05/AAABiiVR52g/AAABibBx2rU/20x9-1280/cyberbunker-146.webp
			//   https://images.tagesschau.de/image/c6184b7d-2207-4ab7-a5ec-bcce66bbdf05/AAABiiVR52g/AAABibBx2rU/original/cyberbunker-146.webp
			// https://images.tagesschau.de/image/130defc7-11bb-4a6d-8458-76dcb21e46bb/AAABh7f9s74/AAABjwnlREM/1x1-256/eu-staaten-flaggen-104.webp
			//   https://images.tagesschau.de/image/130defc7-11bb-4a6d-8458-76dcb21e46bb/AAABh7f9s74/AAABjwnlREM/original/eu-staaten-flaggen-104.webp
			return src.replace(/(\/image\/+[-0-9a-f]{10,}\/+[^/]+\/+[^/]+\/+)[^/]+\/+([^/]+)(?:[?#].*)?$/, "$1original/$2");
		}

		if (domain === "www1.wdr.de" ||
			// https://kinder.wdr.de/radio/kinderradionacht/fotos/krn-teaserbild100~_v-TeaserAufmacher.jpg -- 512x288
			//   https://kinder.wdr.de/radio/kinderradionacht/fotos/krn-teaserbild100.jpg -- 310x174
			//   https://kinder.wdr.de/radio/kinderradionacht/fotos/krn-teaserbild100~_v-original.jpg -- 3449x2160
			domain === "kinder.wdr.de" ||
			// thanks to h-h-h-h on github: https://github.com/qsniyg/maxurl/issues/1013
			// https://www.tagesschau.de/multimedia/bilder/coronavirus-deutschland-283~_v-videowebm.jpg
			//   https://www.tagesschau.de/multimedia/bilder/coronavirus-deutschland-283.jpg -- 1920x1080
			//   https://www.tagesschau.de/multimedia/bilder/coronavirus-deutschland-283~_v-original.jpg -- 1920x1080
			domain_nowww === "tagesschau.de" ||
			// thanks to nimbuz on discord: https://github.com/qsniyg/maxurl/issues/943
			// https://www.hr.de/presse/der-hr/2021/040hr-2021-christopher-plass-100~_t-1633437528836_v-16to7.jpg
			//   https://www.hr.de/presse/der-hr/2021/040hr-2021-christopher-plass-100~_v-original.jpg
			// https://www.hr.de/presse/der-hr/2020/sendesaal-ohne-publikum-100~_t-1626860902067_v-16to7.jpg
			//   https://www.hr.de/presse/der-hr/2020/sendesaal-ohne-publikum-100~_v-original.jpg
			domain_nowww === "hr.de") {
			// https://www1.wdr.de/kinder/radio/kiraka/nachrichten/klicker/eisberg-bedroht-dorf-in-groenland100~_v-gseaclassicxl.jpg
			//   https://www1.wdr.de/kinder/radio/kiraka/nachrichten/klicker/eisberg-bedroht-dorf-in-groenland100~_v-original.jpg
			// https://www1.wdr.de/mediathek/audio/sendereihen-bilder/besser-so-podcast-wdr-100~_v-gseagaleriexl.jpg
			//   https://www1.wdr.de/mediathek/audio/sendereihen-bilder/besser-so-podcast-wdr-100~_v-original.jpg
			// https://www1.wdr.de/verbraucher/rezepte/heimathaeppchen/heimathaeppchen-foto-102~_v-TeaserAufmacher.png
			//   https://www1.wdr.de/verbraucher/rezepte/heimathaeppchen/heimathaeppchen-foto-102.png -- 310x174
			//   https://www1.wdr.de/verbraucher/rezepte/heimathaeppchen/heimathaeppchen-foto-102~_v-original.png -- 1920x1080
			return {
				url: src.replace(/~(?:_t-[0-9]+)?_v-[a-zA-Z0-9]+(\.[^/.]*)$/, "~_v-original$1"),
				can_head: false // wrong content-type
			};
		}

		if (domain_nowww === "xrimaonline.gr" ||
			// https://www.athensmagazine.gr/photos/w_800px/articles/201802/megan_fox_esquire_rus_2017_4.jpg?0.5079567199359913
			//   https://www.athensmagazine.gr/photos/master/articles/201802/megan_fox_esquire_rus_2017_4.jpg?0.5079567199359913
			domain_nowww === "athensmagazine.gr" ||
			// https://www.digalakis.com/photos/w_300px/products/201807/613101510.jpg
			//   https://www.digalakis.com/photos/master/products/201807/613101510.jpg
			// https://www.digalakis.com/photos/w_300px/articles/201808/35459228_206423549991233_4075717178408566784_n.jpg
			//   https://www.digalakis.com/photos/master/articles/201808/35459228_206423549991233_4075717178408566784_n.jpg
			// https://www.digalakis.com/photos/w_800px/201612/desire_card.jpg
			//   https://www.digalakis.com/photos/master/201612/desire_card.jpg
			// doesn't work for all:
			// https://www.digalakis.com/photos/c_100px_75px/products/201607/bandolera_dalia_tan.jpg
			domain_nowww === "digalakis.com" ||
			// https://www.youweekly.gr/photos/w_200px/articles/201901/riri4.jpg?0.6912698141813052
			//   https://www.youweekly.gr/photos/master/articles/201901/riri4.jpg?0.6912698141813052
			domain_nowww === "youweekly.gr" ||
			src.match(/^[a-z]+:\/\/[^/]+\/+photos\/+[wc]_[0-9]+px(?:_[0-9]+px)?\/+(?:products|articles)\//)) {
			// https://www.xrimaonline.gr/photos/c_450px_255px/articles/201807/groilandia_pagobouno.jpg
			//   https://www.xrimaonline.gr/photos/w_999999999999px/articles/201807/groilandia_pagobouno.jpg
			//   https://www.xrimaonline.gr/photos/master/articles/201807/groilandia_pagobouno.jpg -- 1200x750
			// uses gdthumb to resize:
			// https://github.com/mewebstudio/Phpthumb/blob/master/src/Mews/Phpthumb/lib/GdThumb.inc.php
			//return src.replace(/\/photos\/[a-z]_[0-9]+px[^/]*\/articles\//, "/photos/w_999999999999px/articles/");
			return src.replace(/\/photos\/+[a-z]_[0-9]+px[^/]*\/+([^/]+)\//, "/photos/master/$1/");
		}

		if (domain_nosub === "avisen.dk" &&
			domain.match(/^media[0-9]*\.avisen\.dk/)) {
			// https://media2.avisen.dk/GetImage.ashx?imageid=10902044&sizeid=37
			//   https://media2.avisen.dk/GetImage.ashx?imageid=10902044&sizeid=255
			// https://media2.avisen.dk/GetImage.ashx?imageid=9837228&sizeid=255 -- 4928x3280
			// 255, {52,27}, 30, 36, 49, 25, 26, {4, 33, 34, 32, 28, 10}, {51, 37}, 31, 23, 8, 14, 29, 50, 16, 46, 44, {45, 41}, 3, {20, 15}, 19, 47, 7, 18, {5, 40, 35, 2}, 39, 43, 22, 11, {24, 9, 42, 38}, 13, 21, 17, 6, {48, 0}
			return src.replace(/([?&]sizeid=)[0-9]+/, "$1255");
		}

		if (domain_nowww === "elimparcial.es" &&
			string_indexof(src, "/fotos/") >= 0) {
			// https://www.elimparcial.es/fotos/1/53175_636670785479221072w_thumb_570.jpg
			//   https://www.elimparcial.es/fotos/1/53175_636670785479221072w.jpg
			return src.replace(/_thumb_[0-9]+(\.[^/.]*)$/, "$1");
		}

		if (domain_nosub === "agora.md" &&
			domain.match(/^st[0-9]*\.agora\.md/)) {
			// http://st2.agora.md/news/medium/video--un-sat-din-groenlanda--amenintat-de-un-ghetar-urias--ce-risca-localnicii-47637.jpg
			//   http://st2.agora.md/news/big/video--un-sat-din-groenlanda--amenintat-de-un-ghetar-urias--ce-risca-localnicii-47637.jpg
			return src.replace(/(:\/\/[^/]*\/news\/)[a-z]+\//, "$1big/");
		}

		if (domain_nowww === "demokrathaber.org") {
			// https://www.demokrathaber.org/images/resize/100/600x315/haberler/2018/07/gronland_da_bir_koy_devasa_buzdaginin_tehdidi_altinda_h104638_1e4e3.jpg
			//   https://demokrathaber.org/images/haberler/2018/07/gronland_da_bir_koy_devasa_buzdaginin_tehdidi_altinda_h104638_1e4e3.jpg
			return src.replace(/\/images\/resize\/[0-9]+\/[0-9]+x[0-9]+\//, "/images/");
		}

		if (domain === "imgl.krone.at") {
			// https://imgl.krone.at/scaled/1739548/v435e9c/630x356
			//   https://imgl.krone.at/scaled/1739548/v435e9c/full
			// thanks to fedesk on discord:
			// https://imgl.krone.at/scaled/2725530/vf6bea4/630x356.jpg
			//   https://imgl.krone.at/scaled/2725530/vf6bea4/full.jpg
			return src.replace(/(\/scaled\/[0-9]+\/[0-9a-z]+\/)[0-9]+x[0-9]+((?:\.[^/.]+)?(?:[?#].*)?)?$/, "$1full$2");
		}

		if (domain_nowww === "elfinanciero.com.mx" &&
			string_indexof(src, "/uploads/") >= 0) {
			// http://www.elfinanciero.com.mx/uploads/2018/07/13/a4666cd9e11531496851_standard_desktop_medium.jpeg
			//   http://www.elfinanciero.com.mx/uploads/2018/07/13/a4666cd9e11531496851.jpeg
			return src.replace(/(\/[0-9a-f]+)_[a-z_]+(\.[^/.]*)$/, "$1$2");
		}

		if (domain_nosub === "redcdn.pl" &&
			string_indexof(domain, "dcs.redcdn.pl") >= 0) {
			// https://r-scale-00.dcs.redcdn.pl/scale/o2/tvn/web-content/m/p5/i/4496bf24afe7fab6f046bf4923da8de6/5ee170e0-0086-4902-bd53-3ecc7126f4de.jpg?type=1&srcmode=3&srcx=0/1&srcy=0/1&srcw=640&srch=360&dstw=640&dsth=360&quality=80
			//   https://r-scale-00.dcs.redcdn.pl/dcs//o2/tvn/web-content/m/p5/i/4496bf24afe7fab6f046bf4923da8de6/5ee170e0-0086-4902-bd53-3ecc7126f4de.jpg
			// https://n-4-1.dcs.redcdn.pl/dcs/o2/tvn/web-content/m/p1/f/97d0145823aeb8ed80617be62e08bdcc/3d46f316-f013-4b95-9e6e-83a493d21906.jpg -- 7874x5512
			return src.replace(/(:\/\/[^/]*\/)scale(\/.*?)(?:[?#].*)?$/, "$1dcs/$2");
		}

		if (domain === "media.nu.nl") {
			// https://media.nu.nl/m/xc3x2ajaw2pt_wd640.jpeg
			//   https://media.nu.nl/m/xc3x2ajaw2pt.jpeg
			// https://media.nu.nl/m/xc3x2ajaw2pt_wd1280.jpg/groenland-vreest-tsunami-afgebroken-ijsberg-bij-kustplaats.jpg
			//   https://media.nu.nl/m/xc3x2ajaw2pt.jpg
			//   https://media.nu.nl/m/xc3x2ajaw2pt.jpg/groenland-vreest-tsunami-afgebroken-ijsberg-bij-kustplaats.jpg
			// thanks to roi:
			// https://media.nu.nl/m/abqx6qoae11e_wd854/persconferentie-kamila-valieva.jpg
			//   https://media.nu.nl/m/abqx6qoae11e
			//   https://media.nu.nl/m/abqx6qoae11e/persconferentie-kamila-valieva.jpg
			return src.replace(/(:\/\/[^/]*\/+m\/+[0-9a-z]+)_[0-9a-z]+(\.[^/.]*)?(\/[^/]*\.[^/.]*)?$/, "$1$2$3");
		}

		if (domain === "cloudia.hnonline.sk" ||
			// https://img.joj.sk/r1200x/594a7d0a26a9be62ac0a9d84f1c32ded.jpg -- upscaled
			//   https://img.joj.sk/594a7d0a26a9be62ac0a9d84f1c32ded.jpg
			// https://img.joj.sk/r960x/0af19800d00341c4366ce000de3d89cd
			//   https://img.joj.sk/0af19800d00341c4366ce000de3d89cd
			// https://img.joj.sk/rx115/a8821f0c5f162a4a843c0b6e5982fcd6
			//   https://img.joj.sk/a8821f0c5f162a4a843c0b6e5982fcd6
			// thanks to anonymous for reporting:
			// https://img.joj.sk/r1200x/f7596119-5eac-4282-ac0d-fe9276f5503c
			//   https://img.joj.sk/f7596119-5eac-4282-ac0d-fe9276f5503c
			domain === "img.joj.sk") {
			// https://cloudia.hnonline.sk/r740x415n/f46d9eecfa7bc72be2d58a1db131b148.jpg?default=article
			//   https://cloudia.hnonline.sk/f46d9eecfa7bc72be2d58a1db131b148.jpg
			return src.replace(/(:\/\/[^/]*\/)[a-z]?[0-9]*x[0-9]*[a-z]?\/([-0-9a-f]+(?:\.[^/.]*?)?)(?:\?.*)?$/, "$1$2");
		}

		if (googlestorage_container === "nana10img") {
			// https://storage.googleapis.com/nana10img/crop/_w-743_h-418_c-1/images/news/2018-07-13T115944Z_222051012_RC17A823B160_RTRMADP_3_GREENLAND-ICEBERG.JPG
			//   https://storage.googleapis.com/nana10img/images/news/2018-07-13T115944Z_222051012_RC17A823B160_RTRMADP_3_GREENLAND-ICEBERG.JPG
			return src.replace(/\/crop\/(?:_[a-z]-[0-9]+){1,}\/images\//, "/images/");
		}

		if ((domain_nowww === "webnews.bg" ||
			 // https://static.webcafe.bg/uploads/images/96/4196/214196/768x432.jpg
			 //   https://static.webcafe.bg/uploads/images/96/4196/214196/orig.jpg?_=1606914064
			 domain === "static.webcafe.bg" ||
			 // https://static.dir.bg/uploads/images/2018/08/07/1484000/768x.jpg?_=1533643044
			 //   https://static.dir.bg/uploads/images/2018/08/07/1484000/orig.jpg?_=1533643044
			 domain === "static.dir.bg") &&
			/\/uploads\/+images\//.test(src)) {
			// https://www.webnews.bg/uploads/images/70/8070/368070/768x432.jpg
			//   https://www.webnews.bg/uploads/images/70/8070/368070/orig.jpg
			return src.replace(/\/[0-9]+x(?:[0-9]+)?(\.[^/.]*)$/, "/orig$1");
		}

		if (domain === "static.ffx.io") {
			// technically this looks like cloudinary, but possibly a variant?
			// https://static.ffx.io/images/$zoom_0.841%2C$multiply_0.7252124645892352%2C$ratio_1.776846%2C$width_1059%2C$x_0%2C$y_0/t_crop_custom/t_sharpen%2Cq_auto%2Cf_auto/edf6feebc2488f212b2ac65be557a89edda359e6
			//   https://static.ffx.io/images/edf6feebc2488f212b2ac65be557a89edda359e6
			return {
				url: src.replace(/\/images\/\$[^/]*\/.*\/([0-9a-f]+)([?#].*)?$/, "/images/$1$2"),
				can_head: false // 404 for some images
			};
		}

		if (domain === "images.stv.tv") {
			// https://images.stv.tv/articles/w768/598476-the-iceberg-is-said-to-be-grounded-on-the-sea-floor.jpg -- stretched?
			//    https://images.stv.tv/articles/master/598476-the-iceberg-is-said-to-be-grounded-on-the-sea-floor.jpg
			// https://images.stv.tv/articles/w1280xh720xmFit/598472-four-mile-long-iceberg-breaks-off-from-greenland-glacier.jpg -- stretched
			//    https://images.stv.tv/articles/master/598472-four-mile-long-iceberg-breaks-off-from-greenland-glacier.jpg
			return src.replace(/\/articles\/[wh][0-9]+(?:xh[0-9]+)?(?:xm[^/]*)?\/([^/]*)$/, "/articles/master/$1");
		}

		if (domain === "cdn.cretalive.gr") {
			// https://cdn.cretalive.gr/_largeImage/groilandia-pagobouno.jpg?mtime=20180713135637 -- stretched?
			//   https://cdn.cretalive.gr/groilandia-pagobouno.jpg?mtime=20180713135637
			return src.replace(/(:\/\/[^/]*\/)_[a-z]+Image\//, "$1");
		}

		if (domain === "img.budgettravel.com") {
			// https://img.budgettravel.com/_relatedContentImage/Arches-Zoom-Background.jpg?mtime=20200408124252
			//   https://img.budgettravel.com/_contentHero/Arches-Zoom-Background.jpg?mtime=20200408124252
			//   https://img.budgettravel.com/Arches-Zoom-Background.jpg?mtime=20200408124252 -- watermark
			// https://img.budgettravel.com/_galleryImage/golden-gate-bridge-san-francisco-952012-114744_original.jpeg?mtime=20140903194435
			//   https://img.budgettravel.com/golden-gate-bridge-san-francisco-952012-114744_original.jpeg?mtime=20140903194435 -- no watermark
			// https://img.budgettravel.com/_thumbnailSquare/Yosemite_1251853.jpg?mtime=20170410164711
			//   https://img.budgettravel.com/Yosemite_1251853.jpg?mtime=20170410164711
			return src.replace(/(:\/\/[^/]+\/+)_[a-zA-Z]+\/+/, "$1");
		}

		if (amazon_container === "festivalkontoret") {
			// thanks to anonymous for reporting:
			// https://s3.eu-central-1.amazonaws.com/festivalkontoret/nyheter/2021/_indexImage/Maiwenn-%C2%A9-Ste%CC%81phanie-Branchu-Why-Not-Productions-1_2023-08-24-083503_bbpj.png
			//   https://s3.eu-central-1.amazonaws.com/festivalkontoret/nyheter/2021/Maiwenn-%C2%A9-Ste%CC%81phanie-Branchu-Why-Not-Productions-1_2023-08-24-083503_bbpj.png
			// https://s3.eu-central-1.amazonaws.com/festivalkontoret/nyheter/2021/_articleFullWidth/Maiwenn-%C2%A9-Ste%CC%81phanie-Branchu-Why-Not-Productions-1_2023-08-24-083503_bbpj.png
			//   https://s3.eu-central-1.amazonaws.com/festivalkontoret/nyheter/2021/Maiwenn-%C2%A9-Ste%CC%81phanie-Branchu-Why-Not-Productions-1_2023-08-24-083503_bbpj.png
			return src.replace(/\/_[a-zA-Z]+\/+([^/]+)$/, "/$1");
		}

		if ((domain_nosub === "ellingtoncms.com" &&
			 domain.match(/\.media\.clients\.ellingtoncms\.com$/)) ||
			// https://media.lasvegasweekly.com/img/photos/2019/10/22/1024_Nights_Union_20191024_CB_t190.jpg?8f7e25bf5d9051e52786571508cc6ab35225febe
			//   https://media.lasvegasweekly.com/img/photos/2019/10/22/1024_Nights_Union_20191024_CB.jpg?8f7e25bf5d9051e52786571508cc6ab35225febe
			domain === "media.lasvegasweekly.com" ||
			// https://media.spokesman.com/photos/2018/07/13/Greenland_Iceberg.JPG_MYCrmE3_t1200.jpg?298603a24e8d51915fce203907ff2746e482a5a6
			//   https://media.spokesman.com/photos/2018/07/13/Greenland_Iceberg.JPG_MYCrmE3.jpg?298603a24e8d51915fce203907ff2746e482a5a6
			domain === "media.spokesman.com") {
			// https://kpbs.media.clients.ellingtoncms.com/assets/img/2018/07/14/gettyimages-997468440_wide-a78798da0e97d7deb7aa537c32ca8d2ee11d840d_t800.jpg?90232451fbcadccc64a17de7521d859a8f88077d
			//   https://kpbs.media.clients.ellingtoncms.com/assets/img/2018/07/14/gettyimages-997468440_wide-a78798da0e97d7deb7aa537c32ca8d2ee11d840d.jpg?90232451fbcadccc64a17de7521d859a8f88077d
			// http://thetribune.media.clients.ellingtoncms.com/img/photos/2016/07/07/Moodys_t670.jpg?b3f6a5d7692ccc373d56e40cf708e3fa67d9af9d
			//   http://thetribune.media.clients.ellingtoncms.com/img/photos/2016/07/07/Moodys.jpg?b3f6a5d7692ccc373d56e40cf708e3fa67d9af9d
			// http://epmgaa.media.clients.ellingtoncms.com/img/photos/2016/12/08/Grace_t750x550.jpeg?d885fc46c41745b3b5de550c70336c1b382931d2
			//   http://epmgaa.media.clients.ellingtoncms.com/img/photos/2016/12/08/Grace.jpeg?d885fc46c41745b3b5de550c70336c1b382931d2
			return src.replace(/_t[0-9]*(?:x[0-9]+)?(\.[^/.]*)$/, "$1");
		}

		if (domain === "ajo.prod.reuters.tv") {
			// https://ajo.prod.reuters.tv/api/v2/img/5b4a4a4ae4b01cce9ac71a1c-1531595338794?location=LANDSCAPE&width=800&height=450
			//   https://ajo.prod.reuters.tv/api/v2/img/5b4a4a4ae4b01cce9ac71a1c-1531595338794?location=LANDSCAPE
			return src.replace(/(\/img\/[0-9a-f]+-[0-9]+).*?[?&](location=[^&]*).*?$/, "$1?$2");
		}

		if (domain_nowww === "nos.nl" ||
			// thanks to roi:
			// https://cdn.nos.nl/image/2023/04/25/964064/576x432a.jpg
			//   https://cdn.nos.nl/image/2023/04/25/964064/original.jpg
			domain === "cdn.nos.nl" ||
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/474
			// https://assets.nos.nl/data/image/2020/10/08/681829/xxl.jpg
			//   https://assets.nos.nl/data/image/2020/10/08/681829/original.jpg
			// https://assets.nos.nl/data/image/2020/10/08/681773/384x216a.jpg
			//   https://assets.nos.nl/data/image/2020/10/08/681773/original.jpg
			// https://assets.nos.nl/data/image/2020/10/08/681835/128x72.jpg
			//   https://assets.nos.nl/data/image/2020/10/08/681835/original.jpg
			// https://assets.nos.nl/data/image/2020/10/08/681808/512x288a.jpg
			//   https://assets.nos.nl/data/image/2020/10/08/681808/original.jpg
			// https://assets.nos.nl/data/image/2020/10/07/681323/480x270.jpg
			//   https://assets.nos.nl/data/image/2020/10/07/681323/original.jpg
			domain === "assets.nos.nl") {
			// https://nos.nl/data/image/2018/07/13/486455/xxl.jpg
			//   https://nos.nl/data/image/2018/07/13/486455/original.jpg
			return src.replace(/(\/image\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9]+\/+)(?:[a-z]+|[0-9]+x[0-9]+[a-z]*)(\.[^/.]+)(?:[?#].*)?$/, "$1original$2");
		}

		if (domain_nowww === "braunschweiger-zeitung.de" ||
			// https://img.derwesten.de/img/panorama/crop214844835/8353229184-w960-cv16_9/doc70zrsr66hr6mvzbm8l1-MASTER.jpg
			//   https://img.derwesten.de/bin/src-214844835.jpg
			domain === "img.derwesten.de" ||
			// https://www.thueringen24.de/img/welt/crop214844835/5233837185-w960-cv16_9-q85/doc70zrsr66hr6mvzbm8l1-MASTER.jpg
			//   https://www.thueringen24.de/bin/src-214844835.jpg
			domain_nowww === "thueringen24.de" ||
			// thanks to anonymous for reporting:
			// https://www.augsburger-allgemeine.de/img/landsberg/crop39699927/0666421096-cv16_9-w1200/Copy-20of-20-JOR9204.jpg
			//domain_nowww === "augsburger-allgemeine.de" ||
			// https://www.helmstedter-nachrichten.de/img/panorama/crop214844835/2972606866-w820-cv16_9-q85/doc70zrsr66hr6mvzbm8l1-MASTER.jpg
			//   https://www.helmstedter-nachrichten.de/bin/src-214844835.jpg
			domain_nowww === "helmstedter-nachrichten.de") {
			// https://www.braunschweiger-zeitung.de/img/panorama/crop214844835/9502969114-w820-cv16_9-q70/doc70zrsr66hr6mvzbm8l1-MASTER.jpg
			//   https://www.braunschweiger-zeitung.de/bin/src-214844835.jpg
			return src.replace(/\/img\/(?:panorama|welt|landsberg)\/crop([0-9]+)\/.*(\.[^/.]*)$/, "/bin/src-$1$2");
		}

		if (domain === "iprx.ten.com.au") {
			// https://iprx.ten.com.au/ImageHandler.ashx?f=jpg&u=https%3A%2F%2Fimages.tenplay.com.au%2F~%2Fmedia%2FGreenland900W.jpg
			//   https://images.tenplay.com.au/~/media/Greenland900W.jpg
			return decodeURIComponent(src.replace(/^[a-z]+:\/\/[^/]*\/ImageHandler\.ashx.*?[?&]u=([^&]*).*?$/, "$1"));
		}

		if (domain === "images.sudouest.fr") {
			// https://images.sudouest.fr/2018/07/13/5b48afab66a4bd5f4db04b7a/widescreen/1000x500/une-evacuation-a-ete-faite-au-cas-ou-le-bloc-venait-a-rompre.jpg?v1
			//   https://images.sudouest.fr/2018/07/13/5b48afab66a4bd5f4db04b7a/une-evacuation-a-ete-faite-au-cas-ou-le-bloc-venait-a-rompre.jpg?v1
			return src.replace(/(\/[0-9a-f]+\/)[a-z]+\/[0-9]+x[0-9]+\/([^/]*)$/, "$1$2");
		}

		if (domain === "gdb.rferl.org" ||
			// https://gdb.voanews.com/FFF71CAB-7CA6-4876-831A-B7E44ED40BF4_w1200_r1_s.jpg
			//   https://gdb.voanews.com/FFF71CAB-7CA6-4876-831A-B7E44ED40BF4.jpg
			// thanks to anonymous for reporting:
			// https://gdb.voanews.com/92c115a5-dea6-4082-9a22-2e62a325192f_cx0_cy2_cw0_w1597_n_r1_st.jpg
			//   https://gdb.voanews.com/92c115a5-dea6-4082-9a22-2e62a325192f.jpg
			domain === "gdb.voanews.com" ||
			// https://gdb.alhurra.eu/A4CE07B4-32FF-45DE-9D01-26FE034ABC75_cx0_cy5_cw0_w144_r1.jpg
			//   https://gdb.alhurra.eu/A4CE07B4-32FF-45DE-9D01-26FE034ABC75.jpg
			domain === "gdb.alhurra.eu" ||
			// thanks to roi:
			// https://gdb.rferl.org/01000000-0aff-0242-f70d-08db14e16fee_cx0_cy10_cw0_w1023_r1.jpg
			//   https://gdb.rferl.org/01000000-0aff-0242-f70d-08db14e16fee.jpg
			domain === "gdb.rferl.org" ||
			// https://gdb.radiosawa.us/1C56840D-938D-4931-9C15-1BF8EE7E42A6_cx0_cy10_cw0_w1080_h608.jpg
			//   https://gdb.radiosawa.us/1C56840D-938D-4931-9C15-1BF8EE7E42A6.jpg
			domain === "gdb.radiosawa.us") {
			// https://gdb.rferl.org/A8AAF0A8-851A-4A70-8803-05E5409C6A19_w1200_r1_s.jpg
			//   https://gdb.rferl.org/A8AAF0A8-851A-4A70-8803-05E5409C6A19.jpg
			return src.replace(/(:\/\/[^/]*\/+[-0-9A-Fa-f]+)(?:_(?:c?[a-z]|st)[0-9]*){1,}(\.[^/.]*)$/, "$1$2");
			// return src.replace(/_[^/.]*(\.[^/.]*)$/, "$1");
		}

		if (domain === "img.nzz.ch") {
			// https://img.nzz.ch/C=W3500,H1969,X0,Y0/S=W1200/O=75/https://nzz-img.s3.amazonaws.com/2018/7/13/39384ab7-1119-4465-a5c2-12987ed85ec1.jpeg
			//   https://nzz-img.s3.amazonaws.com/2018/7/13/39384ab7-1119-4465-a5c2-12987ed85ec1.jpeg
			return src.replace(/^[a-z]+:\/\/[^/]+\/+(?:[A-Z]=[^/]+\/+){1,}(https?:\/\/)/, "$1");
		}

		if (domain === "images-cdn.impresa.pt" ||
			// https://images.impresa.pt/sicmul/2018-05-08-GettyImages-955883654.jpg/original/mw-1240 -- 1240x1801
			//   https://images.impresa.pt/sicmul/2018-05-08-GettyImages-955883654.jpg/original -- 2048x2974
			domain === "images.impresa.pt") {
			// http://images-cdn.impresa.pt/sicnot/2018-07-14-DOC.20180713.24512537.06885114.jpg-1/16x9/mw-1240
			//   http://images-cdn.impresa.pt/sicnot/2018-07-14-DOC.20180713.24512537.06885114.jpg-1/original -- 2048x1483
			// https://images-cdn.impresa.pt/famashow/2018-03-05-GettyImages-927262244.jpg/original/mw-1240 -- 1240x1860
			//   https://images-cdn.impresa.pt/famashow/2018-03-05-GettyImages-927262244.jpg/original -- 2048x3071
			// http://images-cdn.impresa.pt/caras/2018-02-06-2-Margot-Robbie.jpg?mw=200
			//   http://images-cdn.impresa.pt/caras/2018-02-06-2-Margot-Robbie.jpg/original
			newsrc = src
				.replace(/\/(?:[0-9]+x[0-9]+|original)\/+m[wh]-[0-9]+(?:\?.*)?$/, "/original")
				.replace(/\?.*/, "");
			if (newsrc !== src)
				return newsrc;

			obj = {
				url: src,
				head_wrong_contentlength: true
			};

			match = src.match(/^[a-z]+:\/\/[^/]+\/+[a-z]+\/+([^/]+\.[^/.]*?)(?:-[0-9])?\/original/);
			if (match) {
				obj.filename = match[1];
			}

			return obj;
			//return src.replace(/(:\/\/[^/]*\/[^/]*\/[^/]*\.[^/.]*)\/[^/]*(?:\/[^/]*)?$/, "$1/original");
			//return src.replace(/(\/sicmul\/[^/]*\.[^/.]*)\/.*/, "$1/original");
		}

		if (domain === "awsimages.detik.net.id" ||
			// https://akcdn.detik.net.id/community/media/visual/2016/06/22/4dde9064-5fd0-47e7-82f5-d640d0cdaf3b.jpg?w=770
			//   https://akcdn.detik.net.id/community/media/visual/2016/06/22/4dde9064-5fd0-47e7-82f5-d640d0cdaf3b.jpg?a=1
			domain === "akcdn.detik.net.id") {
			// https://awsimages.detik.net.id/visual/2018/02/21/29c13f53-a628-460a-bdf6-da19a9d8c514.jpeg?w=420&q=90 -- 420x639
			//   https://awsimages.detik.net.id/visual/2018/02/21/29c13f53-a628-460a-bdf6-da19a9d8c514.jpeg?a=1 -- 1973x3000
			// https://awsimages.detik.net.id/customthumb/2015/11/11/431/2GettyImages-496556088d.jpg?w=900&q=60 -- 366x550
			//   https://awsimages.detik.net.id/customthumb/2015/11/11/431/2GettyImages-496556088d.jpg?a=1 -- 200x301 (downscaled)
			//   https://awsimages.detik.net.id/customthumb/2015/11/11/431/2GettyImages-496556088d.jpg -- same as first
			// https://awsimages.detik.net.id/community/media/visual/2016/02/16/90a9545b-3235-4f74-900f-edbe97d59ce3_43.jpg
			//   https://awsimages.detik.net.id/community/media/visual/2016/02/16/90a9545b-3235-4f74-900f-edbe97d59ce3.jpg?a=1
			if (src.match(/\/customthumb\//)) {
				return src.replace(/\?.*/, "");
			}

			newsrc = src.replace(/(\/community\/+media\/+visual\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[-0-9a-f]{20,})_[0-9]+\./, "$1.");
			if (newsrc !== src)
				return newsrc;

			return src.replace(/(?:\?.*)?$/, "?a=1");
		}

		if (domain_nowww === "sexhd.pics" ||
			// https://sexphotos.pw/image/celebmatrix/rihanna/bbwhoneygallery-celebrities-jimslip/hd-rihanna-4.jpg
			//   https://sexphotos.pw/xxx/celebmatrix/rihanna/bbwhoneygallery-celebrities-jimslip/rihanna-4.jpg
			domain_nowww === "sexphotos.pw" ||
			// https://yespornpics.com/thumb/celebmatrix/rihanna/my-favorite-celebs-mobi-sex/hd-rihanna-10.jpg
			//   https://vip.yespornpics.com/media/celebmatrix/rihanna/my-favorite-celebs-mobi-sex/rihanna-10.jpg
			domain_nosub === "yespornpics.com" ||
			// https://babe.today/pics/amourangels/nelly/land-skinny-babes-desnudas/nelly-11.jpg
			//   https://babe.today/pics/amourangels/nelly/land-skinny-babes-desnudas/nelly-11.jpg
			domain_nowww === "babe.today" ||
			// https://xxxporn.pics/thumb/digitaldesire/bree-daniels/gorgeous-softcore-hotel/hd-bree-daniels-15.jpg
			//   https://xxxporn.pics/media/digitaldesire/bree-daniels/gorgeous-softcore-hotel/bree-daniels-15.jpg
			domain_nowww === "xxxporn.pics" ||
			// https://pics.jjgirls.com/thumbs/celebsonly/rihanna/april-celebrities-sweety/hd-rihanna-5.jpg
			//   https://pics.jjgirls.com/pictures/celebsonly/rihanna/april-celebrities-sweety/rihanna-5.jpg
			// https://pics.jjgirls.com/pictures/celebmatrix/selena-gomez/hottest-celebrity-sex-life/hd-selena-gomez-8.jpg
			//   https://pics.jjgirls.com/pictures/celebmatrix/selena-gomez/hottest-celebrity-sex-life/selena-gomez-8.jpg
			domain_nosub === "jjgirls.com") {
			// https://sexhd.pics/photo/celebsonly/rihanna/monday-celebrities-trainer/hd-rihanna-5.jpg
			//   https://sexhd.pics/gallery/celebsonly/rihanna/monday-celebrities-trainer/rihanna-5.jpg
			newsrc = src
				.replace(/(:\/\/[^/]*\/)photo(\/.*\/)hd-([^/]*)$/, "$1gallery$2$3")
				.replace(/(:\/\/[^/]*\/)image(\/.*\/)hd-([^/]*)$/, "$1xxx$2$3")
				.replace(/(:\/\/[^/]*\/)(?:thumbs|pictures)(\/.*\/)hd-([^/]*)$/, "$1pictures$2$3")
				.replace(/(:\/\/[^/]*\/)thumb(\/.*\/)hd-([^/]*)$/, "$1media$2$3")
				.replace(/(:\/\/[^/]*\/)pic(\/.*\/)hd-([^/]*)$/, "$1pics$2$3");

			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nowww === "nakedwench.com") {
			// http://nakedwench.com/galleries/2018/happyfallyall/thumbnail001.jpg
			//   http://nakedwench.com/galleries/2018/happyfallyall/middle001.jpg
			return src.replace(/(\/galleries\/+[0-9]{4}\/+[^/]*\/+)thumbnail([0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1middle$2");
		}

		if (domain === "pics.tubetubetube.com" ||
			// https://pics.javbtc.com/thumbs/hardx/adriana-chechik/downloadporn-brunette-sxy-womens/hd-adriana-chechik-2.jpg
			//   https://pics.javbtc.com/pornpics/hardx/adriana-chechik/downloadporn-brunette-sxy-womens/adriana-chechik-2.jpg
			domain === "pics.javbtc.com") {
			// https://pics.tubetubetube.com/thumbs/teacherfucksteens/hollie-mack-karla-kush-piper-perri/cutey-panties-magazine/hd-hollie-mack-karla-kush-piper-perri-3.jpg
			//   https://pics.tubetubetube.com/pornpics/teacherfucksteens/hollie-mack-karla-kush-piper-perri/cutey-panties-magazine/hd-hollie-mack-karla-kush-piper-perri-3.jpg
			return src.replace(/(:\/\/[^/]*\/)thumbs(\/.*\/)hd-([^/]*)$/, "$1pornpics$2$3")
		}

		if (domain_nowww === "jav.gallery" ||
			// https://javpics.com/xxx/japanese/nao-shiraishi/1/pin-nao-shiraishi-1.jpg
			//   https://javpics.com/images/japanese/nao-shiraishi/1/nao-shiraishi-1.jpg
			domain_nowww === "javpics.com" ||
			// https://javpornpics.com/media/japanese/momo-yurino/13/uhd-momo-yurino-1.jpg
			//   https://javpornpics.com/photos/japanese/momo-yurino/13/momo-yurino-1.jpg
			domain_nowww === "javpornpics.com" ||
			// https://javhd.pics/media/caribbeancom/nao-kojima/031811-647/hd-nao-kojima-2.jpg
			//   https://javhd.pics/media/caribbeancom/nao-kojima/031811-647/uhd-nao-kojima-2.jpg
			//   https://javhd.pics/photos/caribbeancom/nao-kojima/031811-647/nao-kojima-2.jpg
			domain_nowww === "javhd.pics" ||
			// https://jav.photos/pics/japanese/mirei-kurosawa/59/hd-mirei-kurosawa-1.jpg
			//   https://jav.photos/pictures/japanese/mirei-kurosawa/59/mirei-kurosawa-1.jpg
			domain_nowww === "jav.photos" ||
			// https://japanesebeauties.one/media/japanese/kabukicho-girls/1/hd-kabukicho-girls-2.jpg
			//   https://japanesebeauties.one/japanese/kabukicho-girls/1/kabukicho-girls-2.jpg
			domain_nowww === "japanesebeauties.one" ||
			// thanks to vscum on github: https://github.com/qsniyg/maxurl/issues/1319
			// https://pornpics.pictures/media/digitalplayground/olive-glass-agatha-vega-sophie-reade/luxary-redhead-bonbon/hd-olive-glass-agatha-vega-sophie-reade-2.jpg
			//   https://pornpics.pictures/media/digitalplayground/olive-glass-agatha-vega-sophie-reade/luxary-redhead-bonbon/olive-glass-agatha-vega-sophie-reade-2.jpg
			domain_nowww === "pornpics.pictures" ||
			// https://javidol.gallery/media/caribbeancom/yayoi-yamauchi/082824-001/hd-yayoi-yamauchi-2.jpg
			//   https://javidol.gallery/pics/caribbeancom/yayoi-yamauchi/082824-001/yayoi-yamauchi-2.jpg
			domain_nowww === "javidol.gallery" ||
			// https://vip.sexhd.pics/media/wouj/wouj-model/sandy-solo-sex-vediosheidi/hd-wouj-model-3.jpg
			//   https://vip.sexhd.pics/media/wouj/wouj-model/sandy-solo-sex-vediosheidi/wouj-model-3.jpg
			domain_nosub === "sexhd.pics" ||
			// https://vip.sexphotos.pw/media/milehighmedia/ryan-keely-hazel-moore-will-pounder/lixxx-short-hair-leggings/hd-ryan-keely-hazel-moore-will-pounder-3.jpg
			//   https://vip.sexphotos.pw/media/milehighmedia/ryan-keely-hazel-moore-will-pounder/lixxx-short-hair-leggings/ryan-keely-hazel-moore-will-pounder-3.jpg
			domain_nosub === "sexphotos.pw" ||
			// https://vip.pornstar.gallery/pornpics/zishy/olya-derkach/bigbutts-beautiful-ohmibod/hd-olya-derkach-2.jpg
			//   https://vip.pornstar.gallery/pornpics/zishy/olya-derkach/bigbutts-beautiful-ohmibod/olya-derkach-2.jpg
			domain_nosub === "pornstar.gallery" ||
			// https://hdxxx.photos/media/zishy/olya-derkach/bigbutts-beautiful-ohmibod/hd-olya-derkach-2.jpg
			//   https://hdxxx.photos/media/zishy/olya-derkach/bigbutts-beautiful-ohmibod/olya-derkach-2.jpg
			domain_nowww === "hdxxx.photos" ||
			// https://vip.yespornpics.com/media/twistys/lasirena-gizelle-blanco/babexxx-beautiful-easiness/hd-lasirena-gizelle-blanco-2.jpg
			//   https://vip.yespornpics.com/media/twistys/lasirena-gizelle-blanco/babexxx-beautiful-easiness/lasirena-gizelle-blanco-2.jpg
			domain_nosub === "yespornpics.com" ||
			// https://vip.xxxporn.pics/media/digitalplayground/luna-star-ariana-van-x/livexxx-brunette-sexsnap/hd-luna-star-ariana-van-x-2.jpg
			//   https://vip.xxxporn.pics/media/digitalplayground/luna-star-ariana-van-x/livexxx-brunette-sexsnap/luna-star-ariana-van-x-2.jpg
			domain_nosub === "xxxporn.pics") {
			var thumbdir = null;
			var fulldir = null;

			// https://jav.gallery/photo/heyzo/non-suzumiya/2457/pin-non-suzumiya-2.jpg
			//   https://jav.gallery/pics/heyzo/non-suzumiya/2457/non-suzumiya-2.jpg
			if (domain_nowww === "jav.gallery") {
				thumbdir = "photo";
				fulldir = "pics";
			} else if (domain_nowww === "jav.photos") {
				thumbdir = "pics";
				fulldir = "pictures";
			} else if (domain_nowww === "javpics.com") {
				thumbdir = "xxx";
				fulldir = "images";
			} else if (domain_nowww === "javhd.pics" ||
					   domain_nowww === "javpornpics.com") {
				thumbdir = "media";
				fulldir = "photos";
			} else if (domain_nowww === "pornpics.pictures" ||
					   domain_nosub === "xxxporn.pics" ||
					   domain_nosub === "sexhd.pics" ||
					   domain_nosub === "sexphotos.pw" ||
					   domain_nosub === "yespornpics.com" ||
					   domain_nowww === "hdxxx.photos") {
				thumbdir = "media";
				fulldir = "media";
			} else if (domain_nowww === "japanesebeauties.one") {
				thumbdir = "media";
				fulldir = null;
			} else if (domain_nowww === "javidol.gallery") {
				thumbdir = "media";
				fulldir = "pics";
			} else if (domain_nosub === "pornstar.gallery") {
				thumbdir = "pornpics";
				fulldir = "pornpics";
			}

			if (thumbdir) {
				if (fulldir)
					fulldir += "/";
				else
					fulldir = "";

				if (!is_array(thumbdir))
					thumbdir = [thumbdir];

				for (let thdir of thumbdir) {
					regex = new RegExp("(:\/\/[^/]*\/)" + thdir + "\/+(.*\/)(?:u?hd|pin)-([^/]*)(?:[?#].*)?$");
					newsrc = src.replace(regex, "$1" + fulldir + "$2$3");
					if (newsrc !== src)
						return newsrc;
				}
			}
		}

		if (domain_nowww === "pornpics.vip") {
			// thanks to MinuteAd8502 on github: https://github.com/qsniyg/maxurl/issues/828
			// https://pornpics.vip/xxx/onlysportswear/tayla/exammobi-sports-xxxpixsex-com/hd-tayla-7.jpg
			//   https://pornpics.vip/xxx/onlysportswear/tayla/exammobi-sports-xxxpixsex-com/tayla-7.jpg
			return src.replace(/(\/xxx\/.*\/)hd-([^/]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "purejapanese.com" ||
			// http://www.jjgirls.com/uncensored/caribbeancompr/nao-kojima/042514_828/cute-nao-kojima-4.jpg
			//   http://www.jjgirls.com/uncensored/caribbeancompr/nao-kojima/042514_828/nao-kojima-4.jpg
			// http://www.jjgirls.com/japanese/momo-yurino/6/cute-momo-yurino-3.jpg
			//   http://www.jjgirls.com/japanese/momo-yurino/6/momo-yurino-3.jpg
			domain_nowww === "jjgirls.com" ||
			// https://1pondo.com/japanesegirl/yurino-sakurai/1/cute-yurino-sakurai-10.jpg
			//   https://1pondo.com/japanesegirl/yurino-sakurai/1/yurino-sakurai-10.jpg
			// https://1pondo.com/heydouga/caribbeancompr/nao-kojima/042514_828/cute-nao-kojima-3.jpg
			//   https://1pondo.com/heydouga/caribbeancompr/nao-kojima/042514_828/nao-kojima-3.jpg
			domain_nowww === "1pondo.com" ||
			// https://asiauncensored.com/japansex/yurino-sato/5/cute-yurino-sato-8.jpg
			//   https://asiauncensored.com/japansex/yurino-sato/5/yurino-sato-8.jpg
			// https://asiauncensored.com/tokyosex/caribbeancompr/reiko-kobayakawa/013114_759/reiko-kobayakawa-5.jpg
			//   https://asiauncensored.com/tokyosex/caribbeancompr/reiko-kobayakawa/013114_759/reiko-kobayakawa-5.jpg
			domain_nowww === "asiauncensored.com" ||
			// https://69dv.com/javmodel/momo-yurino/30/cute-momo-yurino-5.jpg
			//   https://69dv.com/javmodel/momo-yurino/30/momo-yurino-5.jpg
			domain_nowww === "69dv.com" ||
			// https://japanesethumbs.com/jav/airi-nakajima/2/cute-airi-nakajima-2.jpg
			//   https://japanesethumbs.com/jav/airi-nakajima/2/airi-nakajima-2.jpg
			domain_nowww === "japanesethumbs.com" ||
			// https://img.yavtube.com/japanese/nao-kojima/1/cute-nao-kojima-3.jpg
			//   https://img.yavtube.com/japanese/nao-kojima/1/nao-kojima-3.jpg
			domain === "img.yavtube.com" ||
			// http://www.javtube.com/tokyopic/caribbeancom/nao-kojima/062511-734/cute-nao-kojima-2.jpg
			//   http://www.javtube.com/tokyopic/caribbeancom/nao-kojima/062511-734/nao-kojima-2.jpg
			domain_nowww === "javtube.com") {
			// http://www.purejapanese.com/pic/nao-kojima/13/cute-nao-kojima-1.jpg
			//   http://www.purejapanese.com/pic/nao-kojima/13/nao-kojima-1.jpg
			newsrc = src.replace(/(:\/\/[^/]*\/)(pic|tokyo(?:pic|sex)|uncensored|javmodel|japansex|heydouga|jav|japanese(?:girl)?)(\/.*\/)cute-([^/]*)$/, "$1$2$3$4");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nowww === "jjgirls.com") {
			// http://www.jjgirls.com/photo/javhd/nao-kojima/nao-kojima-asian-house-keeper-has-cunt-licked-after-showing-it/1t.jpg
			//   http://www.jjgirls.com/photo/javhd/nao-kojima/nao-kojima-asian-house-keeper-has-cunt-licked-after-showing-it/1.jpg
			// http://www.jjgirls.com/photo/lbfm/filipina-bargirl/cute-babe/maan01_small.jpg
			//   http://www.jjgirls.com/photo/lbfm/filipina-bargirl/cute-babe/maan01.jpg
			// https://jjgirls.com/photo/bigbuttbounce/big-butt-bounce-lenore/332266/tn02.jpg
			//   https://jjgirls.com/photo/bigbuttbounce/big-butt-bounce-lenore/332266/02.jpg
			// http://www.jjgirls.com/photo/watch4beauty/watch-beauty-sapphira/sapphira-peeing/thumbnail006.jpg
			//   http://www.jjgirls.com/photo/watch4beauty/watch-beauty-sapphira/sapphira-peeing/middle006.jpg
			return src
				.replace(/(\/photo\/+[^/]*\/+[^/]*\/+[^/]*\/+[0-9]+)t(\.[^/.]*)(?:[?#].*)?$/, "$1$2")
				.replace(/(\/photo\/+[^/]*\/+[^/]*\/+[^/]*\/+[^/]*)_small(\.[^/.]*)(?:[?#].*)?$/, "$1$2")
				.replace(/(\/photo\/+[^/]+\/+[^/]+\/+[0-9]+\/+)tn([0-9]+\.[^/.]+)(?:[?#].*)?$/, "$1$2")
				.replace(/(\/photo\/+watch4beauty\/+.*\/+)thumbnail([0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1middle$2");;
		}

		if (domain_nowww === "javbtc.com") {
			// https://javbtc.com/media/caribbeancom/nao-kojima/031811-647/hd-nao-kojima-1.jpg
			//   https://javbtc.com/photos/caribbeancom/nao-kojima/031811-647/nao-kojima-1.jpg
			return src.replace(/(:\/\/[^/]*\/)media(\/.*\/)hd-([^/]*)$/, "$1photos$2$3");
		}

		if (domain_nowww === "japanesebeauties.net") {
			// https://www.japanesebeauties.net/media/japanese/yurino-sato/5/hd-yurino-sato-8.jpg
			//   https://www.japanesebeauties.net/japanese/yurino-sato/5/yurino-sato-8.jpg
			return src.replace(/\/media\/+(.*\/)hd-([^/]*)(?:[?#].*)?$/, "/$1$2");
		}

		if (domain_nowww === "tubetubetube.com") {
			// https://www.tubetubetube.com/media/handjobjapan/mizuho-shiina/075_shiina_mizuho/uhd-mizuho-shiina-1.jpg
			//   https://www.tubetubetube.com/pics/handjobjapan/mizuho-shiina/075_shiina_mizuho/mizuho-shiina-1.jpg
			return src.replace(/(:\/\/[^/]*\/)media(\/.*\/)(?:u?hd|pin)-([^/]*)$/, "$1pics$2$3");
		}

		if (domain_nowww === "nuceleb.ru") {
			// https://www.nuceleb.ru/assets/images/resources/183/144x180/rihanna-golaya-162.jpg
			//   https://www.nuceleb.ru/assets/images/resources/183/rihanna-golaya-162.jpg
			return src.replace(/(\/assets\/images\/resources\/[0-9]+\/)[0-9]+x[0-9]+\/([^/]*)$/, "$1$2");
		}

		if (domain_nosub === "imgserve.net") {
			// http://s12.imgserve.net/images/small/2015/03/26/551470ce6adbe.jpg
			//   http://s12.imgserve.net/images/big/2015/03/26/551470ce6adbe.jpg
			return {
				url: src.replace(/(:\/\/[^/]*\/)images\/[a-z]+\//, "$1images/big/"),
				headers: {
					Referer: src
				}
			};
		}

		if (domain === "image.celebrityrave.com") {
			// http://image.celebrityrave.com/20160815075823/0000/0000/0145/9045/ea0cea8ab4c76e34a438d3b710dc67ba-m2.jpg
			//   http://image.celebrityrave.com/20160815075823/0000/0000/0145/9045/ea0cea8ab4c76e34a438d3b710dc67ba.jpg
			return src.replace(/(\/[0-9a-f]*)-[0-9a-z]+(\.[^/.]*)$/, "$1$2");
		}

		if (domain === "photo.addyoursex.com") {
			// https://photo.addyoursex.com/remote_control.php?time=1554037243&cv2=3475d5030f9a67f0cf3a405323f26f56&file=%2Fcontent%2Fmain%2F9000x1000%2F1000%2F1160%2F16399.jpg&cv3=662eab0cfca5f59221240f92bac96312&cv4=00e638bf1a9a5e0a4f3e8146b167b232
			//   https://photo.addyoursex.com/content/main/9000x1000/1000/1160/16399.jpg
			// https://photo.addyoursex.com/content/main/1000x200/1000/1160/16399.jpg
			// replace to 9000x1000? sources doesn't work (404, even with headers)
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/remote_control\.php.*?[?&]file=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return urljoin(src, decodeURIComponent(newsrc), true);
		}

		if (domain_nowww === "nudostar.tv") {
			// thanks to vscum on github: https://github.com/qsniyg/maxurl/issues/1359
			// https://nudostar.tv/contents/y/y/yyuki-1/1000/yyuki-1_0023_320px.jpg
			//   https://nudostar.tv/contents/y/y/yyuki-1/1000/yyuki-1_0023.jpg
			return src.replace(/(\/contents\/+.\/+.\/+[^/]+\/+[0-9]+\/+[^/]+)_[0-9]+px\./, "$1.");
		}

		if (domain_nowww === "nudogram.com") {
			// thanks to anonymous for reporting:
			// https://nudogram.com/contents/p/u/putri-cinta/1000/putri-cinta_0643_280.jpg
			//   https://nudogram.com/contents/p/u/putri-cinta/1000/putri-cinta_0643.jpg
			newsrc = src.replace(/(\/contents\/+.\/+.\/+[^/]+\/+[0-9]+\/+[^/]+)_280\./, "$1.");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "statics.cdntrex.com" ||
			domain_nowww === "anon-v.com" ||
			// https://www.break.ie/contents/videos_screenshots/2000/2271/320x240/2.jpg
			//   https://www.break.ie/contents/videos/2000/2271/2271_480p.mp4
			domain_nowww === "break.ie" ||
			// https://xcadr.org/contents/videos_screenshots/22000/22743/228x128/1.jpg
			domain_nowww === "xcadr.org" ||
			// https://www.fitting-room.com/contents/videos_screenshots/0/231/preview_trailer.mp4.jpg
			domain_nowww === "fitting-room.com" ||
			// http://www.camwhoreshd.com/contents/videos_screenshots/51000/51460/496x372/1.jpg
			domain_nowww === "camwhoreshd.com" ||
			// http://www.cwtvembeds.com/embed/69644
			domain_nowww === "cwtvembeds.com" ||
			// http://cdn.camwhores.tv/contents/videos_screenshots/5869000/5869367/180x135/2.jpg
			domain_nosub === "camwhores.tv" ||
			// https://www.camwhoresbay.com/contents/videos_screenshots/243000/243143/preview.mp4.jpg
			domain_nowww === "camwhoresbay.com" ||
			domain_nowww === "asianleak.com" ||
			// https://pr1.zbporn.tv/contents/videos/600000/600573/600573_short_preview.mp4
			domain_nosub === "zbporn.tv" ||
			domain_nosub === "zbporn.com" ||
			// https://dato.porn/contents/videos_screenshots/104000/104828/320x180/1.jpg
			domain_nowww === "dato.porn" ||
			// https://smutr.com/contents/videos_screenshots/33000/33141/241x143/3.jpg
			domain_nowww === "smutr.com" ||
			// https://grid.fapster.xxx/contents/videos_screenshots/79000/79064/320x180/1.jpg -- requires referer
			domain_nosub === "fapster.xxx" ||
			// https://bogmedia.org/contents/videos_screenshots/11000/11343/320x180/2.jpg
			domain_nowww === "bogmedia.org" ||
			// http://www.femdomtb.com/contents/videos_screenshots/21000/21963/180x135/1.jpg
			domain_nowww === "femdomtb.com" ||
			// https://www.solopornoitaliani.xxx/contents/videos_screenshots/60000/60096/180x135/1.jpg
			domain_nowww === "solopornoitaliani.xxx" ||
			// http://www.mature-porn.xxx/contents/videos_screenshots/0/391/300x225/3.jpg
			domain_nowww === "mature-porn.xxx" ||
			// http://www.camhub.cc/contents/videos_screenshots/201000/201343/preview.jpg
			// uses embed to www.zzpornozz.xyz/embed/[different id], which itself does use flashvars
			// or camhub.world
			domain_nowww === "camhub.cc" ||
			domain_nowww === "camhub.world" ||
			domain_nowww === "zzpornozz.xyz" ||
			// http://www.caminspector.net/contents/videos_screenshots/111000/111019/180x135/1.jpg
			// frame to www.cwtvembeds.com/embed/[different id]
			//domain_nowww === "caminspector.net" ||
			domain_nowww === "hiddencam.tv" ||
			// https://www.mypornhere.com/contents/videos_screenshots/142000/142247/320x180/1.jpg
			domain_nowww === "mypornhere.com" ||
			// https://www.mvpchannel.net/tube/contents/videos_screenshots/6000/6312/180x135/2.jpg
			(domain_nowww === "mvpchannel.net" && string_indexof(src, "/tube/") >= 0) ||
			// https://www.gaythebest.com/contents/videos_screenshots/1000/1242/180x135/1.jpg
			domain_nowww === "gaythebest.com" ||
			// https://cdn1.watchmygf.me/contents/videos_screenshots/3000/3073/250x149/1.jpg
			domain_nosub === "watchmygf.me" ||
			// https://cdni.yeswegays.com/contents/videos_screenshots/832000/832480/preview.mp4.jpg
			domain_nosub === "yeswegays.com" ||
			// http://mytradevideo.com/contents/videos_screenshots/0/647/preview.jpg
			domain_nowww === "mytradevideo.com" ||
			// https://cnt.boundhub.com/contents/videos_screenshots/157000/157108/180x135/1.jpg
			domain_nosub === "boundhub.com" ||
			// https://youhealthtube.com/contents/videos_screenshots/0/74/496x372/1.jpg
			domain_nowww === "youhealthtube.com" ||
			// http://www.mywebgirls.tv/contents/videos_screenshots/104000/104655/347x260/9.jpg
			domain_nowww === "mywebgirls.tv" ||
			// https://www.thebestshemalevideos.com/contents/videos_screenshots/39000/39368/180x135/1.jpg
			domain_nowww === "thebestshemalevideos.com" ||
			// https://cdn.katestube.com/contents/videos/2573000/2573793/2573793_preview.mp4
			domain_nosub === "katestube.com" ||
			// https://nudogram.com/contents/videos_screenshots/5000/5094/180x135/3.jpg
			domain_nowww === "nudogram.com" ||
			// https://i.analdin.com/contents/videos_screenshots/419000/419019/preview.mp4.jpg
			domain_nosub === "analdin.com" ||
			// https://mediaserver5.tube-bunny.com/storage1/Jv43/4.jpg
			domain_nosub === "tube-bunny.com" ||
			// https://blackporn24.com/contents/videos_screenshots/2000/2539/320x180/2.jpg
			domain_nowww === "blackporn24.com" ||
			domain_nosub === "pornwhite.com" ||
			domain_nosub === "sleazyneasy.com" ||
			domain_nosub === "vikiporn.com" ||
			domain_nosub === "sheshaft.com" ||
			domain_nosub === "xozilla.com" ||
			domain_nosub === "xtits.com" ||
			domain_nosub === "wankoz.com" ||
			domain_nosub === "fetishshrine.com" ||
			domain_nowww === "x18.xxx" ||
			domain_nosub === "mt-static.com" ||
			domain_nosub === "megatube.xxx" ||
			domain_nosub === "slutload-media.com" ||
			domain_nowww === "porngem.com" ||
			domain_nowww === "uiporn.com" ||
			domain_nosub === "pornicom.com" ||
			// https://cdn.youx.xxx/videos/th/180000/180971/320x240/18.jpg
			domain_nosub === "youx.xxx" ||
			// https://cdn1.pornalin.com/18000/18489/18489_preview.mp4?cdn_key=d9900a678a1dad1d&cdn_expired=1593434942&cdn_speed=0&cdn_buffer=3000000&
			domain_nosub === "pornalin.com" ||
			// https://cdn.cartoontube.xxx/th/1000/1871/180x135/1.jpg
			domain_nosub === "cartoontube.xxx" ||
			domain_nowww === "amateurporn.me" ||
			// https://www.hardsexvids.com/contents/videos_screenshots/0/663/336x189/1.jpg
			domain_nowww === "hardsexvids.com" ||
			// https://cdn5.sexvid.xxx/contents/videos_screenshots/8000/8318/284x160/1.jpg
			domain_nosub === "sexvid.xxx" ||
			// https://www.its.porn/contents/videos_screenshots/44000/44089/400x225/1.jpg
			domain_nosub === "its.porn" ||
			domain === "itsporn.woxcdn.com" ||
			domain_nosub === "frprn.com" ||
			// http://japan-whores.com/contents/videos_screenshots/247000/247030/175x131/1.jpg
			domain_nosub === "japan-whores.com" ||
			domain_nosub === "pornid.xxx" ||
			// https://www.mypornhere.com/contents/videos_screenshots/122000/122813/320x180/1.jpg
			domain_nosub === "mypornhere.com" ||
			// https://static.pornhat.com/contents/videos_screenshots/24000/24278/640x360/1.jpg1
			domain_nosub === "pornhat.com" ||
			// http://www.camshooker.com/contents/videos_screenshots/188000/188740/180x135/1.jpg
			domain_nosub === "camshooker.com" ||
			domain_nosub === "cambro.tv" ||
			domain_nosub === "cambro.io" ||
			domain_nosub === "camseek.tv" ||
			// http://www.camvideos.tv/contents/videos_screenshots/94000/94538/180x135/1.jpg
			domain_nowww === "camvideos.tv" ||
			// https://screenshots.anysex.com/videos_screenshots/360000/360936/170x128/3.jpg
			domain_nosub === "anysex.com" ||
			// https://mrdeepfakes.com/contents/videos_screenshots/8000/8148/320x180/1.jpg
			domain_nosub === "mrdeepfakes.com" ||
			// https://i.pornktu.be/contents/videos_screenshots/16000/16668/600x338/1.jpg
			domain_nosub === "pornktu.be" ||
			domain_nosub === "3movs.com" ||
			domain_nosub === "sunporno.com" ||
			domain_nosub === "xcafe.com" ||
			// https://www.18fuck.me/contents/videos_screenshots/0/668/240x180/2.jpg
			domain_nowww === "18fuck.me" ||
			// https://www.my18pussy.com/contents/videos_screenshots/3000/3581/284x160/2.jpg
			domain_nowww === "my18pussy.com" ||
			// https://www.freepornvideo.sex/contents/videos_screenshots/16000/16140/240x180/2.jpg
			domain_nowww === "freepornvideo.sex" ||
			domain_nosub === "sexroom.xxx" ||
			// https://porno666.cam/contents/videos_screenshots/6000/6815/505x297/1.jpg
			domain_nosub === "porno666.cam" ||
			domain_nosub === "pornfappy.com" ||
			// http://www.aporn.xxx/contents/videos_screenshots/0/798/240x180/2.jpg
			domain_nosub === "aporn.xxx" ||
			// https://fapteentube.net/contents/videos_screenshots/2000/2179/301x170/1.jpg
			domain_nosub === "fapteentube.net" ||
			domain_nosub === "xxxsextube.tv" ||
			domain_nosub === "camfz.com" ||
			// https://camclips.tv/contents/videos_screenshots/63000/63354/352x198/1.jpg
			domain_nowww === "camclips.tv" ||
			// https://tubedupe.com/contents/videos_screenshots/143000/143641/preview_embed_360p.mp4.jpg
			domain_nowww === "tubedupe.com" ||
			// https://static-td2.stfucdn.com/contents/videos_screenshots/142000/142926/300x225/1.jpg
			domain_nosub === "stfucdn.com" ||
			domain_nosub === "porntn.com" ||
			// http://tolkorus.info/contents/videos_screenshots/8000/8931/300x224/1.jpg
			domain_nosub === "tolkorus.info" ||
			// https://www.pornozavod.cc/contents/videos_screenshots/0/16/468x282/2.jpg
			domain_nosub === "pornozavod.cc" ||
			// https://onlineporno.cc/contents/videos_screenshots/39000/39460/475x267/1.jpg
			domain_nosub === "onlineporno.cc" ||
			// https://i.prostoporno.help/contents/videos_screenshots/322000/322436/352x198/1.jpg
			domain_nosub === "prostoporno.help" ||
			// https://cdn.pervclips.com/tube/contents/videos_screenshots/1063289000/1063289719/240x180/1.jpg?ver=3
			//domain_nosub === "pervclips.com" ||
			// http://h2porn.com/contents/videos_screenshots/267000/267851/240x180/3.jpg
			// doesn't work with video ids, /embed/ returns 500 with no response
			//domain_nosub === "h2porn.com" ||
			// https://jb503wdraf.ent-cdn.com/contents/videos_screenshots/9000/9364/320x180/1.jpg
			domain === "jb503wdraf.ent-cdn.com" ||
			domain_nosub === "freehardcore.com" ||
			// https://b3bepw16kz.ent-cdn.com/contents/videos_screenshots/16000/16383/400x225/1.jpg
			domain === "b3bepw16kz.ent-cdn.com" ||
			// https://www.asianpornvideo.xxx/contents/videos_screenshots/2000/2297/285x160/1.jpg
			domain_nowww === "asianpornvideo.xxx" ||
			// https://www.18pussy.porn/contents/videos_screenshots/1000/1402/274x154/2.jpg
			domain_nowww === "18pussy.porn" ||
			// https://www.fuckteen.xxx/contents/videos_screenshots/2000/2294/274x154/2.jpg
			domain_nowww === "fuckteen.xxx" ||
			// https://www.japanporn.tv/contents/videos_screenshots/94000/94971/240x135/1.jpg
			domain_nowww === "japanporn.tv" ||
			// https://www.18teenporno.tv/contents/videos_screenshots/5000/5475/280x200/2.jpg
			domain_nowww === "18teenporno.tv" ||
			// https://www.japaneseporn.xxx/contents/videos_screenshots/0/191/272x153/2.jpg
			domain_nowww === "japaneseporn.xxx" ||
			// https://www.hdteen.porn/contents/videos_screenshots/1000/1962/274x154/2.jpg
			domain_nowww === "hdteen.porn" ||
			// https://www.indiansexvideo.xxx/contents/videos_screenshots/0/541/274x154/2.jpg
			domain_nowww === "indiansexvideo.xxx" ||
			// https://cdn.theyarehuge.com/contents/videos_screenshots/40000/40904/324x182/6.jpg
			domain_nosub === "theyarehuge.com" ||
			// https://videocelebs.net/contents/videos_screenshots/75000/75232/preview.mp4.jpg
			domain_nosub === "videocelebs.net" ||
			domain_nowww === "mangovideo.club" ||
			domain_nosub === "xmegadrive.com" ||
			domain_nosub === "deviants.com" ||
			domain_nosub === "cuckoldplacetube.com" ||
			domain_nosub === "alphaporno.com" ||
			domain_nosub === "fapality.com" ||
			domain_nowww === "freeporn8.com" ||
			(domain_nosub === "b-cdn.net" && /^(18yos|amateurporn(?:girlfriends|tape|vidz|wives)|analcuties|asian(?:cuties|teens)|boombj|brosislove|cuteasians|d1ck|d1rty|extremejapanese|faphard(?:er)?|fi1thy|f1ix|fl1rt|freexxxhardcore|hard(?:(?:core)?teens|family|jap|milfs|moms)|hotmature|japteens|k1nk|milfz|porn(?:ouploads|n|r[yz])|roleplayers|taboofamily|teenanal|twistednuts|wanktank|extremeteens)\./.test(domain)) ||
			domain_nosub === "hardmoms.co" ||
			domain_nosub === "d1ck.co" ||
			domain_nosub === "twistednuts.com" ||
			domain_nosub === "f1ix.com" ||
			domain_nosub === "18yos.co" ||
			domain_nosub === "amateurporngirlfriends.com" ||
			domain_nosub === "amateurporntape.com" ||
			domain_nosub === "amateurpornvidz.com" ||
			domain_nosub === "amateurpornwives.com" ||
			domain_nosub === "analcuties.co" ||
			domain_nosub === "asian-cuties.com" ||
			domain_nosub === "asian-teens.co" ||
			domain_nosub === "boombj.com" ||
			domain_nosub === "brosislove.com" ||
			domain_nosub === "cuteasians.co" ||
			domain_nosub === "d1rty.com" ||
			domain_nosub === "extremejapanese.co" ||
			domain_nosub === "faphard.co" ||
			domain_nosub === "fapharder.com" ||
			domain_nosub === "fi1thy.com" ||
			domain_nosub === "fl1rt.com" ||
			domain_nosub === "freexxxhardcore.com" ||
			domain_nosub === "hardcoreteens.co" ||
			domain_nosub === "hardfamily.co" ||
			domain_nosub === "hardjap.co" ||
			domain_nosub === "hardmilfs.co" ||
			domain_nosub === "hardteens.co" ||
			domain_nosub === "hotmature.co" ||
			domain_nosub === "japteens.co" ||
			domain_nosub === "k1nk.co" ||
			domain_nosub === "milfz.co" ||
			domain_nosub === "pornouploads.com" ||
			domain_nosub === "pornn.co" ||
			domain_nosub === "pornry.com" ||
			domain_nosub === "pornrz.com" ||
			domain_nosub === "roleplayers.co" ||
			domain_nosub === "taboofamily.co" ||
			domain_nosub === "teenanal.co" ||
			domain_nosub === "wanktank.co" ||
			domain_nosub === "extremeteens.co" ||
			domain_nowww === "thothub.lol" ||
			domain_nowww === "thothub.to" ||
			domain_nowww === "thothub.tube" ||
			domain_nowww === "thothub.is" ||
			domain_nowww === "cartoon-sex.tv" ||
			domain_nowww === "cartoonporn.pro" ||
			domain_nosub === "love4porn.com" ||
			domain_nosub === "hoes.tube" ||
			domain_nosub === "hqbang.com" ||
			domain_nosub === "porndr.com" ||
			domain_nosub === "pervclips.com" ||
			domain_nosub === "fapnado.xxx" ||
			domain_nosub === "homemade.xxx" ||
			domain_nosub === "xgroovy.com" ||
			domain_nosub === "jizzberry.com" ||
			domain_nosub === "alotporn.com" ||
			domain_nosub === "analdin.xxx" ||
			domain_nosub === "4kporn.xxx" ||
			domain_nosub === "xozilla.xxx" ||
			domain_nosub === "xxxshake.com" ||
			domain_nosub === "fapnow.xxx" ||
			domain_nosub === "4wank.com" ||
			domain_nosub === "fapnado.com" ||
			domain_nosub === "crazyporn.xxx" ||
			domain_nowww === "thisvid.com" ||
			domain_nowww === "amateur8.com" ||
			domain_nowww === "fpo.xxx" ||
			domain_nowww === "masturbationgirl.com" ||
			domain_nowww === "xhomealone.com" ||
			domain_nosub === "porntrex.com" ||
			domain_nosub === "cdntrex.com" ||
			domain_nowww === "alphavids.cc" ||
			domain_nowww === "pornmega.com" ||
			domain_nowww === "viralxxxporn.com" ||
			domain_nowww === "porntrex.tv" ||
			domain_nowww === "bitchesgirls.tv" ||
			domain_nowww === "xxbrits.com" ||
			// different system
			// https://static2.tubepornclassic.com/contents/videos_screenshots/1051000/1051741/240x180/1.jpg
			//domain_nosub === "tubepornclassic.com" ||
			// seems like urls from flashvars don't work anymore, they prefer m3u8 instead
			// https://cdn.mcstatic.com/contents/videos_screenshots/12076000/12076720/140x79/1.jpg
			//domain === "cdn.mcstatic.com" ||
			// https://i.mylust.com/videos_screenshots/412000/412506/200x150/1.jpg
			// https://i.mylust.com/videos_screenshots/359000/359765/200x150/2.jpg
			domain_nosub === "mylust.com" ||
			// https://i.yourlust.com/contents/videos_screenshots/384000/384785/240x180/1.jpg
			domain_nosub === "yourlust.com" ||
			//domain === "cdn84436847.ahacdn.me" ||
			//domain_nowww === "zteenporn.com" ||
			// https://endoscop.tv/contents/videos_screenshots/1000/1069/180x135/1.jpg
			//domain_nowww === "endoscop.tv" ||
			domain_nowww === "pornrewind.com") {
			// https://www.watchmygf.me/player/skin/img/play_white.png
			// https://www.tube-bunny.com/kt_player/skin/img/play_white.png
			// https://cartoon-sex.tv/images/title_icon.png
			if (/\/(?:kt_)?player\/+skin\/+img\//.test(src) ||
				/\/images\/+(?:title_icon|blank)\.[A-Za-z]+(?:[?#].*)?$/.test(src) ||
				// https://anysex.com/static/bg.png
				/\/static\/+bg\.png(?:[?#].*)?$/.test(src))
				return {
					url: src,
					bad: "mask"
				};

			page_nullobj = null;
			var is_pagelink = false;

			// to find more sites: inurl:videos_screenshots
			id = null;
			// https://statics.cdntrex.com/contents/videos_screenshots/1047000/1047563/300x168/1.jpg?v=3
			// https://statics.cdntrex.com/contents/videos_screenshots/1061000/1061072/preview.mp4.jpg
			// https://i.xcafe.com/videos_screenshots/29000/29005/preview_n.mp4.jpg
			// https://tubedupe.com/contents/videos_screenshots/143000/143641/preview_embed_360p.mp4.jpg
			match = src.match(/\/(?:videos_(?:screenshots|sources)|v?th|kvs|videos\/+th)\/+[0-9]+\/+([0-9]+)\/+(?:(?:[0-9]+x[0-9]+|screenshots)\/+|preview(?:mp4_hd|_(?:trailer|[0-9]+p?|[hn]|embed_[0-9]+p))?\.)/);
			if (!match) {
				match = src.match(/\/get_file\/+[0-9a-f]+\/+[0-9a-f]{30,}\/+[0-9a-f]\/+([0-9]+)\/+screenshots\/+/);
			}
			if (!match) {
				match = src.match(/(?:\/get_file\/+[0-9a-f]+\/+[0-9a-f]{30,}|:\/\/[^/]+)\/+[0-9]+\/+[0-9]+\/+([0-9]+)_preview\./);
			}
			// https://pr1.zbporn.tv/contents/videos/600000/600573/600573_short_preview.mp4
			if (!match) {
				match = src.match(/\/(?:contents|c1)\/+videos\/+[0-9]+\/+[0-9]+\/+([0-9]+)(?:_(?:short|small))?_(?:preview|tr)\./);
			}
			// https://mediaserver5.tube-bunny.com/storage1/Jv43/4.jpg
			if (!match) {
				match = src.match(/\/storage[0-9]*\/+([0-9a-zA-Z]+)\/+(?:[0-9]+|default)\./);
			}

			if (match) {
				id = match[1];
			} else {
				match = src.match(/^[a-z]+:\/\/[^/]+\/+(?:(?:(?:tube\/+)?v(?:id(?:eo)?s?)?|embed)\/+(?:([0-9]+)(?:\/+[^/]+)?|([^/]+))\/*)?(?:[?#].*)?$/);
				if (!match) {
					if (domain_nowww === "pornid.xxx") {
						match = src.match(/^[a-z]+:\/\/[^/]+\/+([^/.]{20,})\.html(?:[?#].*)?$/);
					} else if (domain_nosub === "cartoon-sex.tv") {
						match = src.match(/^[a-z]+:\/\/[^/]+\/+video\/+([^/.]+)\.html(?:[?#].*)?$/);
					} else if (domain_nosub === "alotporn.com" ||
							   domain_nosub === "xcafe.com" ||
							   domain_nowww === "anysex.com" ||
							   domain_nosub === "cambro.io") {
						match = src.match(/^[a-z]+:\/\/[^/]+\/+([0-9]+)\/+(?:[^/]+\/*)?(?:[?#].*)?$/);
					}
				}
				if (match) {
					id = match[1] || match[2];
					is_pagelink = true;
					page_nullobj = {
						url: src,
						is_pagelink: true
					};
				}
			}

			var basedomain = "https://www." + domain_nosub + "/";
			var base_component = "";
			var videos_component = "videos";
			let videos_slash = "/";
			var addslash = "/";
			var a_component = "/a";
			var idprefix = "";
			var can_detect_videourl = true;
			var cache_host = domain_nosub;
			let can_add_referer = true;

			if (domain_nosub === "porntrex.com" || domain_nosub === "cdntrex.com") {
				basedomain = "https://www.porntrex.com/";
				cache_host = "porntrex.com";
				videos_component = "embed";
				addslash = "";
				a_component = "";
			} else if (domain_nosub === "porntb.com" ||
					   domain_nosub === "pornstarsadvice.com" ||
					   domain_nosub === "fetishburg.com" ||
					   domain_nosub === "camhub.cc" ||
					   domain_nosub === "camhub.world" ||
					   domain_nosub === "mytradevideo.com" ||
					   domain_nosub === "japan-whores.com" ||
					   domain_nosub === "camshooker.com" ||
					   domain_nosub === "aporn.xxx" ||
					   domain_nosub === "camwhoreshd.com" ||
					   domain_nosub === "mywebgirls.tv") {
				// doesn't support https
				basedomain = "http://www." + domain_nosub + "/";
			} else if (domain_nosub === "tolkorus.info") {
				// doesn't support https or www
				basedomain = "http://" + domain_nosub + "/";
			} else if (domain_nosub === "smutr.com") {
				videos_component = "v";
				a_component = "";
			} else if (domain_nosub === "mature-porn.xxx") {
				videos_component = "v";
				addslash = "";
				basedomain = "http://www." + domain_nosub + "/";
			} else if (domain_nosub === "bogmedia.org") {
				basedomain = "https://bogmedia.org/";
			} else if (domain_nosub === "solopornoitaliani.xxx") {
				videos_component = "video";
				addslash = ".html";
			} else if (domain_nosub === "mvpchannel.net") {
				videos_component = "tube/videos";
			} else if (domain_nosub === "watchmygf.me" ||
					   domain_nosub === "yeswegays.com" ||
					   domain_nosub === "x18.xxx" ||
					   domain_nosub === "thebestshemalevideos.com" ||
					   domain_nosub === "its.porn" ||
					   domain_nosub === "yourlust.com" ||
					   domain_nosub === "sexroom.xxx" ||
					   domain_nosub === "pornalin.com" ||
					   domain_nosub === "fapteentube.net" ||
					   domain_nosub === "alphaporno.com" ||
					   domain_nosub === "videocelebs.net" ||
					   domain_nosub === "pornfappy.com" ||
					   domain_nosub === "theyarehuge.com" ||
					   domain_nosub === "pervclips.com" ||
					   domain_nosub === "thisvid.com") {
				videos_component = "embed";
				addslash = "";
				a_component = "";
			} else if (domain_nosub === "xxxsextube.tv") {
				videos_component = "embed";
				addslash = "";
				a_component = "";
				basedomain = "https://" + domain + "/";
			} else if (domain_nosub === "cuckoldplacetube.com") {
				videos_component = "embed";
				addslash = "";
				a_component = "";
				basedomain = "http://www." + domain_nosub + "/";
			} else if (domain_nosub === "mcstatic.com") {
				basedomain = "https://www.metacafe.com/";
				videos_component = "watch";
				cache_host = "metacafe.com";
			} else if (domain_nosub === "mt-static.com") {
				basedomain = "https://www.megatube.xxx/";
			} else if (domain_nosub === "tube-bunny.com") {
				videos_component = "watch";
			} else if (domain_nosub === "slutload-media.com") {
				videos_component = "embed";
				addslash = "";
				a_component = "";
				basedomain = "https://www.slutload.com/";
			} else if (domain_nosub === "porngem.com" ||
					   domain_nosub === "uiporn.com") {
				idprefix = "a-";
				addslash = "";
				a_component = "";
			} else if (domain_nosub === "youx.xxx") {
				videos_component = "videos/embed";
				a_component = "";
			} else if (domain_nosub === "cartoontube.xxx") {
				idprefix = "video";
				videos_component = "";
			} else if (domain_nosub === "onlineporno.cc") {
				idprefix = "video";
				videos_component = "";
				a_component = "";
			} else if (domain === "cdn84436847.ahacdn.me" ||
					   domain_nosub === "zteenporn.com") {
				basedomain = "https://www.zteenporn.com/";
				idprefix = "a-";
				videos_component = "";
				a_component = "";
			} else if (domain === "itsporn.woxcdn.com") {
				basedomain = "https://www.its.porn/";
				videos_component = "embed";
				addslash = "";
				a_component = "";
			} else if (domain === "frprn.com") {
				a_component = "";
			} else if (domain_nosub === "b-cdn.net") {
				var bcdn_basedomain_map = {
					"hardmoms": "hardmoms.co",
					"d1ck": "d1ck.co",
					"18yos": "18yos.co",
					"analcuties": "analcuties.co",
					"asiancuties": "asian-cuties.com",
					"asianteens": "asian-teens.co",
					"cuteasians": "cuteasians.co",
					"extremejapanese": "extremejapanese.co",
					"faphard": "faphard.co",
					"hardcoreteens": "hardcoreteens.co",
					"hardfamily": "hardfamily.co",
					"hardjap": "hardjap.co",
					"hardmilfs": "hardmilfs.co",
					"hardteens": "hardteens.co",
					"hotmature": "hotmature.co",
					"japteens": "japteens.co",
					"k1nk": "k1nk.co",
					"milfz": "milfz.co",
					"pornn": "pornn.co",
					"roleplayers": "roleplayers.co",
					"taboofamily": "taboofamily.co",
					"teenanal": "teenanal.co",
					"wanktank": "wanktank.co",
					"extremeteens": "extremeteens.co"
				};
				var bcdn_subdomain = domain.replace(/\.b-cdn\.net$/, "");
				if (bcdn_subdomain in bcdn_basedomain_map) {
					basedomain = "https://" + bcdn_basedomain_map[bcdn_subdomain] + "/";
				} else {
					basedomain = "https://" + bcdn_subdomain + ".com/";
				}
			} else if (domain_nosub === "pornid.xxx") {
				can_detect_videourl = false;
			} else if (domain_nosub === "pornhat.com" ||
					   domain_nosub === "mrdeepfakes.com" ||
					   domain_nosub === "tubedupe.com" ||
					   domain_nosub === "porno666.cam") {
				videos_component = "video";
			} else if (domain_nosub === "anysex.com") {
				videos_component = "";
				a_component = "";
			} else if (domain_nosub === "cambro.tv" ||
					   domain_nosub === "cambro.io") {
				videos_component = "";
			} else if (domain_nosub === "camvideos.tv") {
				videos_component = "";
				basedomain = "http://www." + domain_nosub + "/";
			} else if (domain_nosub === "xcafe.com") {
				videos_component = "";
				a_component = "";
			} else if (domain_nosub === "18fuck.me") {
				a_component = "/a.tube";
				addslash = "";
			} else if (domain_nosub === "freepornvideo.sex") {
				videos_component = "xxx";
			} else if (domain_nosub === "pervclips.com") {
				base_component = "tube/";
				videos_component = "embed";
				addslash = "";
				a_component = "";
			} else if (domain_nosub === "stfucdn.com") {
				basedomain = "https://tubedupe.com/";
				videos_component = "video";
			} else if (domain_nosub === "prostoporno.help") {
				basedomain = "https://xxx.prostoporno.help/";
				a_component = "";
			} else if (domain === "jb503wdraf.ent-cdn.com") {
				basedomain = "https://www.freehardcore.com/";
			} else if (domain === "b3bepw16kz.ent-cdn.com") {
				basedomain = "https://www.deviants.com/";
			} else if (domain_nosub === "japaneseporn.xxx") {
				videos_component = "u";
			} else if (domain_nosub === "fapality.com") {
				videos_component = "";
				a_component = "";
			} else if (domain_nosub === "cartoonporn.pro") {
				videos_component = "vids";
			} else if (domain_nosub === "cartoon-sex.tv") {
				videos_component = "video";
				a_component = "";
				addslash = ".html";
			} else if (domain_nosub === "fapnado.xxx") {
				can_add_referer = false;
			} else if (domain_nosub === "alotporn.com" ||
					domain_nosub === "xcafe.com") {
				videos_component = "";
				videos_slash = "";
			}

			var detected_url = null;
			if (can_detect_videourl) {
				detected_url = basedomain + base_component + videos_component + videos_slash + idprefix + id + a_component + addslash;
			}
			if (is_pagelink) {
				if (domain === "embeds.sunporno.com") {
					src = src.replace(/^[a-z]+:\/\/[^/]+\/+embed\/+/, "https://www.sunporno.com/videos/");
				}

				detected_url = src;
			}

			cache_host = basedomain.replace(/^[a-z]+:\/\/(?:www\.)?([^/]+)\/*$/, "$1");

			var fixup_function_url = function(flashvars) {
				var global_fn_num = 0;

				var first_common_sub = function(url, base, mult, divisor) {
					for (var i = 0; i < 12; i++) {
						var num = base;

						for (var url_ch_i = 0; url_ch_i < url.length; url_ch_i++) {
							var current_num = parseInt(url[url_ch_i]) || 0;
							num += i * current_num;
						}

						global_fn_num += mult * Math_floor(num / divisor);
					}
				};

				function update_fn_num2(urls) {
					for (var url_i = 0; url_i < urls.length; url_i++) {
						var url = urls[url_i].url;

						first_common_sub(url, 0, -1, 7);
					}
				}

				function update_fn_num1(urls) {
					var c, d, f, g, i;

					for (var url_i = 0; url_i < urls.length; url_i++) {
						var urlobj = urls[url_i];
						var url_key = urlobj.key;
						var url = urlobj.url;

						var slash_index = string_indexof(url, "/");
						var fn_num, real_url;
						if (slash_index > 0) {
							fn_num = parseInt(url.substring(0, slash_index));
							real_url = url.substring(slash_index);
						} else {
							fn_num = 0;
							real_url = url;
						}

						first_common_sub(url, fn_num, 1, 6);

						if (flashvars[url_key] && flashvars[url_key].substring(0, 8) === "function") {
							if (global_fn_num < 0) {
								// unknown if this works or not, can't find a test case

								f = "" + -global_fn_num;
								for (c = 0; c < 4; c++) f += f;

								real_url = real_url.substring(1);
								real_url = real_url.split("/");

								for (c = 0; c < real_url[5].length; c++) {
									g = c;

									for (d = c; d < f.length; d++) {
										g += parseInt(f[d]);
									}

									while (g >= real_url[5].length) {
										g = g - real_url[5].length;
									}

									i = real_url[5][c];
									real_url[5] = real_url[5].substring(0, c) + real_url[5][g] + real_url[5].substring(c + 1);
									real_url[5] = real_url[5].substring(0, g) + (i + "") + real_url[5].substring(g + 1);
								}
								flashvars[url_key] = real_url.join("/");
							} else {
								flashvars[url_key] = "function" + "/" + global_fn_num + real_url;
							}
						}
					}
				}

				var get_license_from_flashvars = function(flashvars) {
					for (var key in flashvars) {
						if (string_indexof(key, "code") > 0 && flashvars[key].length == 16) {
							return flashvars[key];
						}
					}

					return "";
				};

				var decrypt_license = function(license_code) {
					if (!license_code)
						return license_code;

					var license_num = "";
					for (var license_i = 1; license_i < license_code.length; license_i++) {
						var current_code_n = parseInt(license_code[license_i]);

						if (current_code_n) {
							license_num += current_code_n;
						} else {
							license_num += 1;
						}
					}

					// 7 = Math.floor(license_num.length / 2)
					var first_half = parseInt(license_num.substring(0, 8));
					var second_half = parseInt(license_num.substring(7));

					var license_num1_int = (Math_abs(second_half - first_half) + Math_abs(first_half - second_half)) * 2;
					// turn into string
					var license_num1 = "" + license_num1_int;

					var decrypted = "";

					// 8 = Math.ceil(license_num.length / 2)
					for (var i = 0; i < 8; i++) {
						for (var j = 1; j <= 4; j++) {
							var n = parseInt(license_code[i + j]) + parseInt(license_num1[i]);

							if (n >= 10) {
								n -= 10;
							}

							decrypted += n;
						}
					}

					return decrypted;
				};

				var update_url = function(flashvars) {
					var function_header = "function" + "/";

					for (var key in flashvars) {
						var value = flashvars[key];

						if (string_indexof(value, function_header) === 0) {
							var splitted_url = value.substring(function_header.length).split("/");

							// splitted_url[0] is the number after function/
							if (splitted_url[0] > 0) {
								var vidid = splitted_url[6].substring(0, 32);
								var decrypted_license = decrypt_license(get_license_from_flashvars(flashvars));

								if (decrypted_license && vidid) {
									var old_vidid = vidid;

									for (var vidid_ri = vidid.length - 1; vidid_ri >= 0; vidid_ri--) {
										var current_key = vidid_ri;
										for (var i = vidid_ri; i < decrypted_license.length; i++) {
											current_key += parseInt(decrypted_license[i]);
										}

										while (current_key >= vidid.length) {
											current_key -= vidid.length;
										}

										var new_vidid = "";

										for (var vidid_i = 0; vidid_i < vidid.length; vidid_i++) {
											if (vidid_i === vidid_ri) {
												new_vidid += vidid[current_key];
											} else if (vidid_i === current_key) {
												new_vidid += vidid[vidid_ri];
											} else {
												new_vidid += vidid[vidid_i];
											}
										}

										vidid = new_vidid;
									}

									splitted_url[6] = splitted_url[6].replace(old_vidid, vidid);
									splitted_url.splice(0, 1);

									flashvars[key] = splitted_url.join("/");
								}
							}
						}
					}
				};

				var main = function() {
					var urls = [];
					var function_header = "function" + "/";

					for (var key in flashvars) {
						if (flashvars[key].substring(0, 9) === function_header) {
							var url = flashvars[key].substring(function_header.length);
							urls.push({key: key, url: url});
						}
					}

					if (urls.length === 0) {
						return flashvars;
					} else {
						update_fn_num1(urls);
						update_fn_num2(urls);
						update_url(flashvars);
						return main();
					}
				};

				return main();
			};

			if (id && options.do_request && options.cb) {
				var cache_key = cache_host + ":" + id;

				var parse_flashvars = function(ourdata) {
					if (!ourdata || !ourdata.data) {
						return null;
					}

					var data = ourdata.data;
					var origpage = ourdata.finalurl;

					var maxurl = null;
					var maxsize = null;

					fixup_function_url(data);

					for (var key in data) {
						if (/^video_.*url[0-9]*$/.test(key)) {
							var oururl = data[key];
							var oursize = oururl.replace(/.*_([0-9]+)p\.[^/.]+(?:\/*[^/]*)?(?:[?#].*)?$/, "$1");
							// tube-bunny.com
							if (oursize === oururl) {
								oursize = oururl.replace(/.*\/storage[0-9]*\/+[a-zA-Z0-9]+\/+([0-9]+)p\.mp4(?:[?#].*)?$/, "$1");
							}
							// sunporno.com
							if (oursize === oururl) {
								oursize = oururl.replace(/.*\/key=.*\/+([0-9]+)x[0-9]+_[0-9]+k(?:_h264)?_[0-9]+\.mp4(?:[?#].*)?$/, "$1");
							}
							// sunporno.com
							if (oursize === oururl) {
								oursize = oururl.replace(/.*\/key=.*\/+mobile_[0-9]+\.mp4(?:[?#].*)?$/, "480");
							}
							if (oursize === oururl) {
								oursize = null;

								// there's also key + "_hd": "1" (japan-whores)
								if ((key + "_text") in data) {
									var keytext = data[key + "_text"];
									if (keytext === "LQ") { // 320x180 for prostoporno
										oursize = 240;
									} else if (keytext === "SD") {
										oursize = 360; // 640x360 for japan-whores
									} else if (keytext === "HQ" || keytext === "HD") { // 1280x720 for prostoporno
										oursize = 720;
									} else {
										var keytext_match = keytext.match(/^([0-9]{3,})p$/);
										if (keytext_match) {
											oursize = keytext_match[1];
										}
									}
								}

								// x18.xxx
								if ((key + "_redirect") in data) {
									console_warn("URL appears to redirect: " + oururl);
									continue;
								}

								if (!oursize) {
									if (oururl.match(/\/([0-9]+)\/+\1(?:_(?:trailer|s))?\.[^/.]+(?:\/*[^/]*)?(?:[?#].*)?$/)) {
										oursize = 480;
									} else {
										console_warn("Unable to detect size from URL: " + oururl, data);
										continue;
									}
								}
							}
							oursize = parseInt(oursize);

							if (!maxsize || oursize > maxsize) {
								maxsize = oursize;
								maxurl = oururl;
							}
						}
					}

					if (maxurl) {
						var newobj:BigImageInfoSObject = {
							url: maxurl,
							headers: {
								Referer: origpage || basedomain
							},
							extra: {
								page: origpage,
								caption: data.video_title || data.video_tags || data.video_categories || void 0
							}
						};

						if (!can_add_referer)
							newobj.headers.Referer = null;

						if (string_indexof(maxurl, ".mp4") >= 0) {
							newobj.video = true;
						}

						return newobj;
					} else {
						return null;
					}
				};

				var find_flashvars_from_page = function(resp) {
					let resptext = resp.responseText;
					resptext = resptext.replace(/low_quality_for_uc == true\)\s*{\s*var flashvars[\s\S]+?}\s*else\s*{/, ""); // zbporn.com
					var match = resptext.match(/var\s+flashvars\s*=\s*({[\s\S]+?})\s*;/);
					if (!match) {
						console_warn(cache_key, "Unable to find flashvars match", resp);
						return null;
					}

					// https://www.thebestshemalevideos.com/contents/videos_screenshots/39000/39368/180x135/1.jpg
					// : '...\'....'
					// https://tubedupe.com/contents/videos_screenshots/143000/143641/preview_embed_360p.mp4.jpg
					// : encodeURIComponent('1')
					var jsoned = match[1]
						.replace(/adv_pre_vast(?:_alt)?:\s*'[^\\']+?'(?:\s*\+\s*[a-z_]+),/g, "") // theyarehuge.com, zbporn.com
						.replace(/adv_pre_vast(?:_alt)?:\s*'[^\\']+?'\s*,/g, "") // thisvid.com
						.replace(/([{,]\s*)([^"'\s:]+)\s*:/g, "$1\"$2\":")
						.replace(/:\s*encodeURIComponent\(('[^']+')\)/g, ":$1")
						.replace(/([^\\])\\'/g, "$1\\u0027")
						.replace(/(\"[^\s:"]+?\":)\s*'([^']*)'(\s*[,}])/g, "$1 \"$2\"$3")
						.replace(/,\s*}$/, "}")
						// rudimentary comment removal
						.replace(/((?:[0-9]|")\s*,)\s*\/\/[^\n]*/, "$1");

					try {
						var json = JSON_parse(jsoned);

						// metacafe
						if (!("video_id" in json) && "flashvars" in json && json.flashvars && "video_id" in json.flashvars) {
							json = json.flashvars;
						}

						return json;
					} catch (e) {
						console_error(cache_key, e, {match: match[1], jsoned: jsoned});
						return null;
					}
				};

				var find_itsporn_video = function(resp) {
					var match = resp.responseText.match(/<video\s([^>]+data-src-(?:hls|dash|mp4)="https?:[^"]+".*?)>\s*<\/video>/);
					if (!match) {
						console_warn(cache_key, "Unable to find data-src-(hls|dash|mp4) match", resp);
						return null;
					}

					var obj = [];

					var matches = match_all(match[1], /data-src-(hls|dash|mp4)="(https?:[^"]+)"/);
					array_foreach(matches, function(submatch) {
						var videotype = submatch[1];
						if (videotype === "mp4")
							videotype = true;

						obj.push({
							url: submatch[2],
							video: videotype
						});
					});

					if (obj.length > 0)
						return obj;

					console_error(cache_key, "Unable to find sources for data-src match", resp);
					return null;
				};

				var find_embed = function(resp) {
					var match = resp.responseText.match(/"player-holder">\s*<div class="embed-wrap"[^>]*><iframe\s[^>]*src=['"]([^'"]+)['"]/);
					if (!match) {
						console_warn(cache_key, "Unable to find iframe embed for", resp);
						return null;
					}

					return decode_entities(match[1]);
				};

				// anysex.com
				var find_plainvid = function(resp) {
					var match = resp.responseText.match(/<div id="kt_player"[^>]*>\s*<video id="main_video"[^>]+>\s*<source\s[^>]*src="([^"]+)"/);
					if (!match) { // alphaporno.com
						match = resp.responseText.match(/<video id="bravoplayer"[^>]+>(?:\s*<source[^>]*>){0,}\s*<source\s[^>]*src="([^"]+)"/);
					}
					if (!match) {
						console_warn(cache_key, "Unable to find plain kt video for", resp);
						return null;
					}

					return [{
						url: decode_entities(match[1]),
						video: true
					}];
				}

				var find_pornktube = function(resp) {
					var match = resp.responseText.match(/<div id="player"(?:\s+data-(?:id|[sqnt])="[^"]+?"){5}\s*>/);
					if (!match) {
						console_warn(cache_key, "Unable to find player div for", resp);
						return null;
					}

					var playerdiv = match[0];

					var matches = match_all(playerdiv, /data-(id|[sqnt])="([^"]+?)"/);
					var attrs:Record<string, string> = {};
					array_foreach(matches, function(submatch) {
						attrs[submatch[1]] = decode_entities(submatch[2]);
					});

					var qualities = attrs["q"].split(",");
					qualities.sort(function(a, b) {
						return parseInt(b) - parseInt(a);
					});

					var http_prefix = "https://s" + attrs["n"] + ".fapmedia.com/" + "cq" + "p" + "vid/";
					var folder = 1000 * Math_floor(parseFloat(attrs["id"])/1000);
					var tfolder = folder + "/" + attrs["id"];

					var urls = [];
					for (var i = 0; i < qualities.length; i++) {
						var quality = qualities[i].split(";");
						var suffix = "";

						if (quality[0] !== "720p") {
							if (quality[0] === "2160p") {
								suffix = "_4k";
							} else {
								suffix = "_" + quality[0];
							}
						}

						urls.push(http_prefix + quality[4] + "/" + quality[5] + "/" + tfolder + "/" + attrs.id + suffix + ".mp4");
					}

					return urls;
				};

				api_cache.fetch(cache_key, function(obj) {
					if (!obj)
						return options.cb(page_nullobj);

					if (!is_array(obj))
						obj = [obj];

					if (page_nullobj)
						obj.push(page_nullobj);

					return options.cb(obj);
				}, function(done) {
					var url = detected_url;

					var fetch_video = function(url, can_refetch) {
						if (!url) {
							console_error("Null url, ignoring");
							return done(null, false);
						}

						options.do_request({
							url: url,
							method: "GET",
							onload: function(resp) {
								if (resp.readyState !== 4)
									return;

								if (resp.status === 404) {
									// pornktu.be
									var match = resp.responseText.match(/<meta http-equiv="Refresh" content="[0-9]+; URL=(https?:\/\/[^"]+)">/);
									if (match) {
										finalurl = decode_entities(match[1]);
										if (finalurl !== resp.finalUrl) {
											return fetch_video(finalurl, false);
										}
									}
								}

								if (resp.status !== 200) {
									console_error(resp);
									return done(null, false);
								}

								var finalurl = resp.finalUrl;
								var match = resp.responseText.match(/<link href="(https?:\/\/[^"]+)" rel="canonical"\s*\/>/);
								if (match) {
									finalurl = decode_entities(match[1]);
								}

								var baseobj = {
									headers: {
										Referer: finalurl || basedomain
									},
									extra: {
										page: finalurl
									}
								};

								var flashvars = find_flashvars_from_page(resp);
								if (flashvars) {
									var dataobj = {
										data: flashvars,
										finalurl: finalurl
									};

									return done(parse_flashvars(dataobj), 60*60);
								}

								var obj = find_itsporn_video(resp) || find_plainvid(resp);
								if (obj) {
									return done(fillobj_urls(obj, baseobj), 60*60);
								}

								var embed_url = find_embed(resp);
								if (embed_url) {
									return done({
										url: embed_url,
										is_pagelink: true
									}, 60*60);
								}

								obj = find_pornktube(resp);
								if (obj) {
									return done(fillobj_urls(obj, baseobj), 60*60);
								}

								// its.porn
								if (can_refetch && finalurl !== resp.finalUrl) {
									return fetch_video(finalurl, false);
								} else {
									return done(null, false);
								}
							}
						});
					};

					fetch_video(url, true);
				});

				return {
					waiting: true
				};
			}
		}

		if ((host_domain_nowww === "vikiporn.com" ||
			 // thanks to anonymous for reporting:
			 host_domain_nowww === "sleazyneasy.com") && options.element) {
			if (!src && options.element.tagName === "DIV" && options.element.classList.contains("fp-ui")) {
				return {
					url: origsrc,
					bad: "mask"
				};
			}
		}

		if (domain === "cora.porntrex.com") {
			return {
				url: src,
				headers: {
					Referer: "https://www.porntrex.com/"
				}
			};
		}

		if (domain_nowww === "vjav.com" ||
			domain_nowww === "upornia.com" ||
			//domain_nowww === "tubepornclassic.com" ||
			domain_nowww === "hotmovs.com" ||
			domain_nowww === "shemalez.com" ||
			domain_nowww === "hdzog.com") {
			match = src.match(/^[a-z]+:\/\/[^/]+\/+(?:videos|embed)\/+([0-9]+)(?:\/+.*)?(?:[?#].*)?$/);
			if (match) {
				id = match[1];

				page_nullobj = {
					url: src,
					is_pagelink: true
				};

				var base_domain = domain_nosub;

				var query_vjav_api = function(vidid, url, signature, cb) {
					api_query(base_domain + "_api:" + vidid, {
						url: "https://" + base_domain + "/sn4diyux.php",
						method: "POST",
						imu_mode: "iframe",
						headers: {
							"Content-Type": "application/x-www-form-urlencoded",
							"Origin": "https://" + base_domain,
							"Referer": url
						},
						data: "param=" + encodeURIComponent(vidid + "," + signature)
					}, cb, function(done, resp, cache_key) {
						var obf_b64_decode = function(url) {
							var origurl = url;
							url = url
								.replace(/\u041c/g, 'M')
								.replace(/\u0415/g, 'E')
								.replace(/\u0410/g, 'A')
								.replace(/\u0421/g, 'C')
								.replace(/\u0412/g, 'B')
								.replace(/~/g, '=');

							// tubepornclassic
							var splitted = url.split(",");

							try {
								url = base64_decode(splitted[0]);
								if (splitted.length > 1) {
									url += "?" + base64_decode(splitted[1]);
								}

								return url;
							} catch (e) {
								console_error(cache_key, "Unable to properly decode", url);
								throw e;
							}
						};

						var match = resp.responseText.match(/var [^\s=]+\s*='(\[[^']+aHR0[^']+\])';/);
						if (!match) {
							console_log(cache_key, "Unable to find match for", resp);
							return done(null, false);
						}

						var json = JSON_parse(match[1]);

						for (var key in json[0]) {
							if (/^aHR0/.test(json[0][key])) {
								json[0][key] = obf_b64_decode(json[0][key]);
							}
						}

						return done(json, 60*60);
					});
				};

				var query_vjav = function(vidid, cb) {
					api_query(base_domain + ":" + vidid, {
						url: "https://" + base_domain + "/videos/" + vidid + "/a/"
					}, cb, function(done, resp, cache_key) {
						var match = resp.responseText.match(/window\.jwsettings\s*=\s*{\s*pC3:\s*'([0-9]+\|[0-9]+,[0-9]+)'/);
						if (!match) {
							console_error(cache_key, "Unable to find signature for", resp);
							return done(null, false);
						}

						var sig = match[1];
						query_vjav_api(vidid, resp.finalUrl, sig, function(data) {
							if (!data)
								return done(null, false);

							return done(data, 60*60);
						});
					});
				};

				var jwplayer_obj_to_imu = function(data) {
					if (!data)
						return page_nullobj;

					var baseobj = {
						headers: {
							Referer: "https://" + base_domain + "/"
						}
					};

					var urls = [];

					urls.push({url: data[0].video_url, video: true});
					urls.push(page_nullobj);

					return fillobj_urls(urls, baseobj);
				};

				if (options.do_request && options.cb) {
					query_vjav(id, function(data) {
						options.cb(jwplayer_obj_to_imu(data));
					});

					return {
						waiting: true
					};
				} else {
					return page_nullobj;
				}
			}
		}

		if (domain_nosub === "hclips.com" ||
			domain_nosub === "voyeurhit.com" ||
			domain_nowww === "txxx.com" ||
			domain_nowww === "thegay.com" ||
			domain_nowww === "tubepornclassic.com" ||
			domain_nosub === "videotxxx.com") {
			// https://hclips.com/videos/ashe-maree-excellent-show-made-28-july-2017/?promo=10376
			//   redirects to:
			//   https://hclips.com/videos/2114722/ashe-maree-excellent-show-made-28-july-2017/?promo=10376
			var match = src.match(/^[a-z]+:\/\/[^/]+\/+(?:videos|embed)\/+([0-9]+)\//);
			if (match) {
				id = match[1];

				var base_domain = domain_nosub;
				if (domain_nosub === "videotxxx.com")
					base_domain = "txxx.com";

				var decode_hclips_base64 = function(data) {
					var charset = decodeURIComponent("%D0%90%D0%92%D0%A1D%D0%95FGHIJKL%D0%9CNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.%2C~"),
						output = "";

					var invalid_regex = new RegExp(decodeURIComponent("%5B%5E%D0%90%D0%92%D0%A1%D0%95%D0%9CA-Za-z0-9.%2C~%5D"), "g");
					if (invalid_regex.exec(data)) {
						console_warn("Invalid characters found in", data);
					}

					data = data.replace(invalid_regex, "");

					for (var i = 0; i < data.length;) {
						var c1 = string_indexof(charset, string_charat(data, i++)),
							c2 = string_indexof(charset, string_charat(data, i++)),
							c3 = string_indexof(charset, string_charat(data, i++)),
							c4 = string_indexof(charset, string_charat(data, i++));

						c1 = c1 << 2 | c2 >> 4;
						c2 = (15 & c2) << 4 | c3 >> 2;
						var last = (3 & c3) << 6 | c4;

						output += string_fromcharcode(c1);

						if (c3 !== 64) {
							output += string_fromcharcode(c2);
						}

						if (c4 !== 64) {
							output += string_fromcharcode(last);
						}
					}

					return unescape(output);
				};

				var query_hclips = function(vid, cb) {
					api_query(base_domain + ":" + vid, {
						url: "https://" + base_domain + "/api/videofile.php?video_id=" + vid + "&lifetime=8640000",
						headers: {
							"Accept": "application/json, text/plain, */*",
							"Referer": "https://" + base_domain + "/videos/" + vid + "/"
						},
						json: true
					}, cb, function(done, resp, cache_key) {
						var formats = ["_hq", "_lq"];

						var get_format_id = function(format) {
							format = format.replace(/\..*/, "");
							var index = array_indexof(formats, format);

							if (index < 0) {
								console_warn("Unknown format", format);
								return formats.length;
							} else {
								return index;
							}
						};

						// resp is {error: 1, msg: "not_found"} if 404
						resp.sort(function(a, b) {
							return get_format_id(a) - get_format_id(b);
						});

						for (var i = 0; i < resp.length; i++) {
							resp[i].video_url = urljoin("https://" + base_domain + "/", decode_hclips_base64(resp[i].video_url), true);
						}

						done(resp, 60*60);
					});
				};

				var hclips_to_obj = function(data) {
					if (!data || data.length === 0) {
						return page_nullobj;
					}

					var baseobj = {
						headers: {
							Referer: "https://" + base_domain
						}
					};

					urls = [{
						url: data[0].video_url,
						video: true
					}];

					urls.push(page_nullobj);

					return fillobj_urls(urls, baseobj);
				};

				page_nullobj = {
					url: src,
					is_pagelink: true
				};

				if (options.do_request && options.cb) {
					query_hclips(id, function(data) {
						options.cb(hclips_to_obj(data));
					});

					return {
						waiting: true
					};
				} else {
					return page_nullobj;
				}
			}
		}

		if (domain === "cdn69508963.ahacdn.me" ||

			domain === "cdn35854568.ahacdn.me" ||
			// https://cdn60563788.ahacdn.me/contents/videos_sources/592000/592577/screenshots/1.jpg
			domain === "cdn60563788.ahacdn.me" ||
			// https://12111549.pix-cdn.org/contents/videos_screenshots/592000/592577/268x201/1.jpg
			domain === "12111549.pix-cdn.org" ||

			// https://cdn56191079.ahacdn.me/c8/videos/3604000/3604699/3604699_tr.mp4
			domain === "cdn56191079.ahacdn.me" ||
			// https://cdn25122858.ahacdn.me/contents/videos_sources/1259000/1259001/screenshots/1.jpg
			domain === "cdn25122858.ahacdn.me" ||
			// https://12111553.pix-cdn.org/contents/videos_screenshots/1259000/1259001/268x200/1.jpg
			domain === "12111553.pix-cdn.org" ||

			domain === "cdn22821955.ahacdn.me" ||
			domain === "cdn37699375.ahacdn.me" ||
			(domain_nosub === "tubepornclassic.com" && /^static[0-9]*\./.test(domain)) ||

			domain === "cdn39638151.ahacdn.me" ||
			domain === "vjav1.hclips.net" ||
			domain === "vjav2.hclips.net" ||
			domain === "vjav3.hclips.net" ||

			domain === "cdn61283513.ahacdn.me" ||
			// https://cdn42705446.ahacdn.me/contents/videos_screenshots/7530000/7530843/240x180/1.jpg
			domain === "cdn42705446.ahacdn.me" ||
			domain === "cdn85419624.ahacdn.me" ||

			// https://cdn49752055.ahacdn.me/contents/videos_screenshots//2000/2877/300x169/1.jpg
			domain === "cdn49752055.ahacdn.me" ||
			domain === "cdn12694176.ahacdn.me" ||

			domain === "cdn27185998.ahacdn.me" ||
			domain === "cdn52810799.ahacdn.me" ||

			domain === "cdn47590165.ahacdn.me" ||
			(domain_nosub === "shemalez.com" && /^tn[0-9]*\./.test(domain)) ||

			// https://cdn37804682.ahacdn.me/contents/videos_screenshots/16484000/16484039/288x162/1.jpg
			domain === "cdn37804682.ahacdn.me") {
			var basedomain_map = {
				"cdn69508963.ahacdn.me": "hdzog.com",
				"cdn39638151.ahacdn.me": "vjav.com",
				"vjav1.hclips.net":      "vjav.com",
				"vjav2.hclips.net":      "vjav.com",
				"vjav3.hclips.net":      "vjav.com",
				"cdn35854568.ahacdn.me": "upornia.com",
				"cdn60563788.ahacdn.me": "upornia.com",
				"12111549.pix-cdn.org":  "upornia.com",
				"cdn56191079.ahacdn.me": "hotmovs.com",
				"cdn25122858.ahacdn.me": "hotmovs.com",
				"12111553.pix-cdn.org":  "hotmovs.com",
				"cdn22821955.ahacdn.me": "tubepornclassic.com",
				"cdn37699375.ahacdn.me": "tubepornclassic.com",
				"cdn61283513.ahacdn.me": "hclips.com",
				"cdn42705446.ahacdn.me": "hclips.com",
				"cdn85419624.ahacdn.me": "hclips.com",
				"cdn49752055.ahacdn.me": "hdzog.com",
				"cdn12694176.ahacdn.me": "hdzog.com",
				"cdn27185998.ahacdn.me": "thegay.com",
				"cdn52810799.ahacdn.me": "thegay.com",
				"cdn47590165.ahacdn.me": "shemalez.com",
				"cdn37804682.ahacdn.me": "txxx.com"
			};

			var basedomain = basedomain_map[domain];
			if (!basedomain)
				basedomain = domain_nosub;

			match = src.match(/\/(?:c[0-9]*|contents)\/+videos(?:_(?:sources|screenshots))?\/+[0-9]+\/+([0-9]+)\/+(?:(?:[0-9]+_tr|preview)\.|(?:screenshots|[0-9]+x[0-9]+)\/)/);
			if (match) {
				return {
					url: "https://" + basedomain + "/videos/" + match[1] + "/a/",
					is_pagelink: true
				};
			}
		}

		if (domain_nowww === "xbabe.com") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+videos\/+([^/]+)\/*(?:[?#].*)?$/,
				query_for_id: "https://xbabe.com/videos/${id}/",
				process: function(done, resp) {
					var obj = common_functions["get_videotag_obj"](resp);
					if (!obj)
						return done(null, false);

					return done(fillobj_urls(obj, {
						headers: {
							Referer: resp.finalUrl
						}
					}), 60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "zceleb.com" ||
			// https://cdn.faponix.com/contents/albums/main/300x500/83000/83852/1313934.jpg
			//   https://cdn.faponix.com/contents/albums/sources/83000/83852/1313934.jpg
			domain === "cdn.faponix.com" ||
			// https://i5.fapality.com/contents/albums/main/240x999/1000/1682/64817.jpg
			//   https://i5.fapality.com/contents/albums/sources/1000/1682/64817.jpg
			domain_nosub === "fapality.com" ||
			// https://alb-xb.hellcdn.net/main/682x682/12000/12580/201280.jpg
			//   https://alb-xb.hellcdn.net/sources/12000/12580/201280.jpg
			domain === "alb-xb.hellcdn.net" ||
			// https://www.vjav.com/contents/albums/main/1600x1200/47000/47925/575030.jpg
			//   https://www.vjav.com/contents/albums/sources/47000/47925/575030.jpg
			domain_nowww === "vjav.com" ||
			// https://frprn.com/contents/albums/main/1024x768/0/986/15134.jpg
			//domain_nowww === "frprn.com" || -- doesn't work (404)
			// https://i.tubsexer.com/contents/albums/main/360x480/194000/194421/2840771.jpg
			//   https://i.tubsexer.com/contents/albums/sources/194000/194421/2840771.jpg
			// https://tubsexer.com/contents/albums/main/360x480/278000/278388/3931871.jpg
			//   https://tubsexer.com/contents/albums/sources/278000/278388/3931871.jpg
			domain_nosub === "tubsexer.com" ||
			// https://bobs-tube.com/contents/albums/main/360x480/69000/69190/1104550.jpg
			//   https://bobs-tube.com/contents/albums/sources/69000/69190/1104550.jpg
			domain_nowww === "bobs-tube.com" ||
			// https://i.pornsexer.com/contents/albums/main/360x480/73000/73467/1103108.jpg
			//   https://i.pornsexer.com/contents/albums/sources/73000/73467/1103108.jpg
			domain === "i.pornsexer.com" ||
			// http://www.pervertedmilfs.com/contents/albums/main/180x240/2000/2231/35565.jpg
			//   http://www.pervertedmilfs.com/contents/albums/sources/2000/2231/35565.jpg
			domain_nowww === "pervertedmilfs.com" ||
			// https://xcadr.com/contents/albums/main/855x1400/0/86/1361.jpg
			//   https://xcadr.com/contents/albums/sources/0/86/1361.jpg
			domain_nowww === "xcadr.com" ||
			// https://anon-v.com/contents/albums/main/200x150/15000/15685/267726.jpg
			//   https://anon-v.com/contents/albums/sources/15000/15685/267726.jpg
			domain_nowww === "anon-v.com" ||
			// https://cdn1.okporn.com/contents/albums//main/838x655/7000/7326/152282.jpg
			//   https://cdn1.okporn.com/contents/albums//sources/7000/7326/152282.jpg
			domain_nosub === "okporn.com" ||
			// https://album2.cdntrex.com/main/200x150/2000/2431/94996.jpg
			//   https://album2.cdntrex.com/sources/2000/2431/94996.jpg
			// https://albums1.cdntrex.com/main/200x150/9000/9241/1068488.jpg
			(domain_nosub === "cdntrex.com" && /^albums?[0-9]*\./.test(domain)) ||
			// https://cdn1-sex-hd-images.p7cdn.com/contents/albums/main/1600x220/5000/5327/103399.jpg
			//   https://cdn1-sex-hd-images.p7cdn.com/contents/albums/sources/5000/5327/103399.jpg
			domain_nosub === "p7cdn.com" ||
			// https://cdn.pornoreino.com/albums/main/200x150/0/145/11519.jpg
			//   https://cdn.pornoreino.com/albums/sources/0/145/11519.jpg
			// https://cdn.pornoreino.com/remote_control.php?time=1565526909&cv2=756352ff666039da808a78fa9aef8b58&file=%2Falbums%2Fsources%2F0%2F145%2F11519.jpg&cv3=df8b98eb2fcd9720c10b32652d63c688&cv4=7679f6a6b66a859d48a72271e2f88853
			//   https://cdn.pornoreino.com/albums/sources/0/145/11519.jpg
			domain_nosub === "pornoreino.com" ||
			// https://mylust.com/contents/albums/main/200x150/8000/8452/77273.jpg
			//   https://mylust.com/contents/albums/sources/8000/8452/77273.jpg
			domain_nowww === "mylust.com" ||
			// https://us3.smutr.com/contents/albums/main/690x690/0/721/5058.jpg
			//   https://us3.smutr.com/contents/albums/sources/0/721/5058.jpg
			domain_nosub === "smutr.com" ||
			// https://megaporn.co/contents/albums/main/200x150/0/155/1712.jpg
			//   https://megaporn.co/contents/albums/sources/0/155/1712.jpg
			domain_nowww === "megaporn.co" ||
			// https://i.tubsexer.com/contents/albums/main/360x480/145000/145671/2043061.jpg
			//   https://i.tubsexer.com/contents/albums/sources/145000/145671/2043061.jpg
			domain === "i.tubsexer.com" ||
			// https://www.break.ie/contents/albums/main/700x1800/0/6/523.jpg
			//   https://www.break.ie/contents/albums/sources/0/6/523.jpg
			domain_nowww === "break.ie" ||
			// https://media1.fapcat.com/contents/albums/main/280x370/2000/2732/40740.jpg
			//   https://media1.fapcat.com/contents/albums/sources/2000/2732/40740.jpg -- doesn't work
			//   needs remote_control link
			//(domain_nosub === "fapcat.com" && /^media[0-9]*\./.test(domain)) ||
			// https://cdn2.watchmygf.me/contents/albums/main/300x500/2000/2169/26340.jpg
			//   https://cdn2.watchmygf.me/contents/albums/sources/2000/2169/26340.jpg
			(domain_nosub === "watchmygf.me" && /^cdn[0-9]*\./.test(domain)) ||
			// https://watchmyexgf.good-cdn.com/contents/albums/main/200x150/3000/3363/43183.jpg
			//   https://watchmyexgf.good-cdn.com/contents/albums/sources/3000/3363/43183.jpg
			domain === "watchmyexgf.good-cdn.com" ||
			// https://www.fitting-room.com/contents/albums/main/200x150/0/234/9932.jpg
			//   https://www.fitting-room.com/contents/albums/sources/0/234/9932.jpg -- 3744x5616
			domain_nowww === "fitting-room.com" ||
			// https://static1.tubepornclassic.com/contents/albums/main/200x150/3000/3553/13128.jpg
			//   https://static1.tubepornclassic.com/contents/albums/sources/3000/3553/13128.jpg
			(domain_nosub === "tubepornclassic.com" && /^static[0-9]*\./.test(domain)) ||
			// https://www.matureshare.com/contents/albums/main/200x150/0/84/6933.jpg
			//   https://www.matureshare.com/contents/albums/sources/0/84/6933.jpg -- doesn't work (404)
			//domain_nowww === "matureshare.com" ||
			// https://www.iloveporn.xxx/contents/albums/main/700x930/0/113/1988.jpg
			//   https://www.iloveporn.xxx/contents/albums/sources/0/113/1988.jpg
			domain_nowww === "iloveporn.xxx" ||
			// https://www.zzgays.com/contents/albums/main/155x205/0/642/10393.jpg
			//   https://www.zzgays.com/contents/albums/sources/0/642/10393.jpg
			domain_nowww === "zzgays.com" ||
			// https://www.pornhat.com/contents/albums/main/1920x1080/8000/8719/374152.jpg
			//   https://www.pornhat.com/contents/albums/sources/8000/8719/374152.jpg
			domain_nowww === "pornhat.com" ||
			// https://i.bobs-tube.com/contents/albums/main/360x480/85000/85226/1347662.jpg
			//   https://i.bobs-tube.com/contents/albums/sources/85000/85226/1347662.jpg
			domain === "i.bobs-tube.com" ||
			// http://www.amateurarchiver.com/contents/albums/main/120x160/7000/7163/49802.jpg
			//   http://www.amateurarchiver.com/contents/albums/sources/7000/7163/49802.jpg -- doesn't work (404)
			//domain_nowww === "amateurarchiver.com" ||
			domain_nowww === "xbabe.com" ||
			// https://wtfpass.com/contents/albums/main/167x250/0/828/110967.jpg
			//   https://wtfpass.com/contents/albums/sources/0/828/110967.jpg -- doesn't work (404)
			//domain_nowww === "wtfpass.com" ||
			// https://www.pornzee.com/contents/albums/main/200x150/0/615/9028.jpg
			//   https://www.pornzee.com/contents/albums/sources/0/615/9028.jpg
			domain_nowww === "pornzee.com" ||
			// https://media.thebestshemalevideos.com/contents/albums/main/200x150/0/821/11577.jpg
			//   https://media.thebestshemalevideos.com/contents/albums/sources/0/821/11577.jpg
			domain === "media.thebestshemalevideos.com" ||
			// https://www.themilf.net/contents/albums/main/90x100/13000/13899/57822.jpg
			//   https://www.themilf.net/contents/albums/sources/13000/13899/57822.jpg
			domain_nowww === "themilf.net" ||
			// http://h2porn.com/contents/albums/main/160x160/6000/6512/1080778.jpg
			//   http://h2porn.com/contents/albums/sources/6000/6512/1080778.jpg -- doesn't work (404)
			//domain_nowww === "h2porn.com" ||
			// http://pornstarsadvice.com/contents/albums/main/150x200/24000/24633/339924.jpg
			//   http://pornstarsadvice.com/contents/albums/sources/24000/24633/339924.jpg
			domain_nowww === "pornstarsadvice.com" ||
			// http://www.porntb.com/contents/albums/main/370x250/2000/2380/63923.jpg
			// http://www.porntb.com/contents/albums/main/370x250/2000/2771/111237.jpg
			//   http://www.porntb.com/contents/albums/main/1920x1920/2000/2771/111237.jpg
			domain_nowww === "porntb.com" ||
			domain === "109.206.187.183" ||
			// http://fetishburg.com/contents/albums/main/370x250/22000/22495/336053.jpg
			//   http://fetishburg.com/contents/albums/main/1920x1200/22000/22495/336053.jpg
			domain_nowww === "fetishburg.com" ||
			// https://albums193.zbporn.tv/main/120x160/227000/227924/5410359.jpg
			//   https://albums193.zbporn.tv/main/9998x9998/227000/227924/5410359.jpg
			domain_nosub === "zbporn.tv" ||
			domain_nosub === "zbporn.com" ||
			// thanks to DirtyGoblinLegislator on github: https://github.com/qsniyg/maxurl/issues/585
			// https://static-td-a.stfucdn.com/albums/main/400x400/22000/22390/268575.jpg?ttl=1608842674&token=46ad1e294d2132b11b6efc18055546b5
			//   https://static-td-a.stfucdn.com/albums/sources/22000/22390/268575.jpg?ttl=1608842674&token=46ad1e294d2132b11b6efc18055546b5
			// https://static-td-a.stfucdn.com/albums/main/400x400/22000/22390/268575.jpg
			//   https://static-td-a.stfucdn.com/albums/sources/22000/22390/268575.jpg
			domain_nosub === "stfucdn.com" ||
			// https://www.mythumbnails.com/contents/albums/main/300x500/0/31/459.jpg
			//   https://www.mythumbnails.com/contents/albums/sources/0/31/459.jpg
			domain_nowww === "mythumbnails.com" ||
			// https://static.ok.xxx/contents/albums/main/1920x1080/8000/8723/374252.jpg
			//   https://static.ok.xxx/contents/albums/sources/8000/8723/374252.jpg
			domain === "static.ok.xxx" ||
			// https://www.nudems.com/contents/albums/main/300x500/0/415/4848.jpg
			//   https://www.nudems.com/contents/albums/sources/0/415/4848.jpg
			domain_nowww === "nudems.com" ||
			// thanks to Puk0 on discord:
			// https://apple.thub.lol/contents/albums/main/200x150/26000/26263/1041436.jpg
			//   https://apple.thub.lol/contents/albums/sources/26000/26263/1041436.jpg
			(domain_nosub === "thub.lol" && /\/contents\/+albums\//.test(src)) ||
			// thanks to anonymous for reporting:
			domain === "39f3590d4b98d6338eaee9d88.blazincdn.com" ||
			// https://cdn.pornstill.com/contents/albums/main/300x500/82000/82628/1298509.jpg
			//   https://cdn.pornstill.com/contents/albums/sources/82000/82628/1298509.jpg
			domain === "cdn.pornstill.com") {
			// https://www.zceleb.com/contents/albums/main/235x350/0/73/4807.jpg
			//   https://zceleb.com/contents/albums/main/5000x5000/0/73/4807.jpg
			//   https://www.zceleb.com/contents/albums/sources/0/73/4807.jpg
			if (domain_nosub !== "thebestshemalevideos.com" && domain_nosub !== "smutr.com") {
				newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+remote_control\.php\?(?:.*?&)?file=([^&]*).*?$/, "$1");
				if (newsrc !== src)
					return urljoin(src, decodeURIComponent(newsrc), true);
			}

			// https://www.vjav.com/get_image/2/749399d324d9f4118ef241f8a2d497eb/main/1600x1200/47000/47925/575030.jpg/
			//   https://www.vjav.com/contents/albums/main/1600x1200/47000/47925/575030.jpg
			newsrc = src.replace(/\/get_image\/[0-9a-f]\/[0-9a-f]+\/main\/(.*?)\/+(?:[?#].*)?$/, "/contents/albums/main/$1");
			if (newsrc !== src)
				return newsrc;

			var max = null;
			if (domain_nowww === "porntb.com") {
				max = "1920x1920";
			} else if (domain_nowww === "fetishburg.com") {
				max = "1920x1200";
			} else if (domain_nosub === "zbporn.tv") {
				max = "9998x9998";
			}

			match = src.match(/\/main\/+([0-9]+x[0-9]+)\/+/);
			if (max && match) {
				var get_pixels = function(x) {
					var match = x.match(/^([0-9]+)x([0-9]+)$/);
					if (!match)
						return 0;

					return parseInt(match[1]) * parseInt(match[2]);
				};

				if (get_pixels(max) > get_pixels(match[1])) {
					newsrc = src.replace(/\/main\/+[0-9]+x[0-9]+\/+/, "/main/" + max + "/");
				}
			} else if (!max) {
				newsrc = src.replace(/\/main\/+[0-9]+x[0-9]+\/+/, "/sources/");
			}

			obj = {
				url: newsrc
			};

			let referer = "http://" + domain_nosub + "/";
			if (domain_nosub === "p7cdn.com") {
				referer = "https://www.sex-hd.xxx/";
			} else if (domain_nosub === "cdntrex.com") {
				referer = "";
			} else if (domain === "109.206.187.183" || domain_nosub === "porntb.com") {
				referer = "http://www.porntb.com/";
			} else {
				obj.referer_ok = {same_domain: true};
			}

			// a little overreaching, but easier than manually adding support for each of the sites
			obj.headers = {Referer: referer};

			return obj;
		}

		if (domain === "image.jeuxvideo.com") {
			// http://image.jeuxvideo.com/medias-md/153181/1531806400-2401-card.jpg
			//   http://image.jeuxvideo.com/medias/153181/1531806400-2401-card.jpg
			// https://image.jeuxvideo.com/images-sm/ga/t/o/tospga016.jpg
			//   https://image.jeuxvideo.com/images/ga/t/o/tospga016.jpg
			return {
				url: src.replace(/(:\/\/[^/]+\/+(?:medias|images))-[a-z]+\//, "$1/"),
				can_head: false
			};
		}

		if (domain_nosub === "mt-static.com" && /^img[0-9]*\./.test(domain)) {
			// https://img04.mt-static.com/contents/albums_overview/23000/23818/300x450/4658915.jpg
			//   https://img04.mt-static.com/contents/albums_overview/23000/23818/sources/4658915.jpg
			return src.replace(/(\/contents\/+albums_overview\/+[0-9]+\/+[0-9]+\/+)[0-9]+x[0-9]+\/+/, "$1sources/");
		}

		if (domain === "images.pushsquare.com") {
			// http://images.pushsquare.com/screenshots/77413/900x.jpg -- 900x506
			//   http://images.pushsquare.com/screenshots/77413/large.jpg --1920x1080 (with watermark)
			//   http://images.pushsquare.com/screenshots/77413/original.jpg -- 1920x1080 (without watermark)
			// http://images.pushsquare.com/games/ps4/hitman_episode_3_-_marrakesh/cover_medium.jpg -- 576x766 (stretched)
			//   http://images.pushsquare.com/games/ps4/hitman_episode_3_-_marrakesh/cover.jpg -- 576x766 (stretched)
			//   http://images.pushsquare.com/games/ps4/hitman_episode_3_-_marrakesh/cover_original.jpg -- 255x300
			// http://images.pushsquare.com/news/2018/07/guide_the_best_ps4_rpgs/75x75.jpg
			//   http://images.pushsquare.com/news/2018/07/guide_the_best_ps4_rpgs/original.jpg
			// http://images.pushsquare.com/reviews/ps4/mirrors_edge_catalyst/large.jpg
			//   http://images.pushsquare.com/reviews/ps4/mirrors_edge_catalyst/original.jpg
			// https://images.pushsquare.com/c8dd29b4fc27f/545x385.jpg
			//   https://images.pushsquare.com/c8dd29b4fc27f/large.jpg
			//   https://images.pushsquare.com/c8dd29b4fc27f/original.jpg
			return src
				.replace(/((?:\/news\/+[0-9]+\/+[0-9]+\/+[^/]+\/+)|(?:\/screenshots\/+[0-9]+\/+)|(?:\/reviews\/+[^/]*\/+[^/]*\/+))(?:[0-9]+x(?:[0-9]+)?|[a-z]+)(\.[^/.]*)$/, "$1original$2")
				.replace(/(:\/\/[^/]+\/+[0-9a-f]{5,}\/+)(?:[0-9]+x(?:[0-9]+)?|large)\./, "$1original.")
				.replace(/(\/games\/.*\/cover)(?:_[a-z]+)?(\.[^/.]*)$/, "$1_original$2");
		}

		if (domain_nowww === "pcgames.de") {
			// http://www.pcgames.de/screenshots/110x83/2016/10/Hitman-4--pc-games_b2teaser_43.jpg
			//   http://www.pcgames.de/screenshots/original/2016/10/Hitman-4--pc-games_b2teaser_43.jpg
			// https://www.pcgames.de/screenshots/1020x/2016/06/mirrors-edge-catalyst-test-0003-pc-games.png
			return src.replace(/\/screenshots\/+[0-9]*x[0-9]*\//, "/screenshots/original/");
		}

		if (domain_nowww === "collinsdictionary.com") {
			// https://www.collinsdictionary.com/images/thumb/iceberg_346820033_250.jpg?version=3.1.158
			//   https://www.collinsdictionary.com/images/full/iceberg_346820033.jpg?version=3.1.158
			return src.replace(/\/images\/thumb\/([^/]*)_[0-9]+(\.[^/.]*)(\?.*)?$/, "/images/full/$1$2$3");
		}

		if (domain_nowww === "abc.net.au") {
			// http://www.abc.net.au/archives/80days/pluck-cache/images/49866abe-f614-4ba4-a585-489637e3f829.Small.jpg
			//   http://www.abc.net.au/archives/80days/pluck-cache/images/49866abe-f614-4ba4-a585-489637e3f829.Full.jpg
			// http://www.abc.net.au/cm/rimage/9931726-16x9-thumbnail.jpg -- 160x90
			//   http://www.abc.net.au/cm/rimage/9931726-16x9-small.jpg -- 220x124
			//   http://www.abc.net.au/cm/rimage/9931726-16x9-large.jpg -- 1600x900
			return src
				.replace(/(\/pluck-cache\/images\/[-0-9a-f]+\.)[A-Z][a-z]+(\.[^/.]*)$/, "$1Full$2")
				.replace(/(\/cm\/rimage\/[0-9]+-[0-9]+x[0-9]+-)[a-z]+(\.[^/.]*)$/, "$1large$2");
		}

		if (domain_nowww === "1x.com") {
			// https://1x.com/images/user/e9fd987c2a0231b4ff115afb9728c38e-sq.jpg
			//   https://1x.com/images/user/e9fd987c2a0231b4ff115afb9728c38e-ld.jpg
			//   https://1x.com/images/user/e9fd987c2a0231b4ff115afb9728c38e-sd.jpg
			//   https://1x.com/images/user/e9fd987c2a0231b4ff115afb9728c38e-sd2.jpg
			//   https://1x.com/images/user/e9fd987c2a0231b4ff115afb9728c38e-hd2.jpg
			//   https://1x.com/images/user/e9fd987c2a0231b4ff115afb9728c38e-hd4.jpg -- same size, slightly larger file
			// https://1x.com/img/?id=e9fd987c2a0231b4ff115afb9728c38e&q=sd
			//   https://1x.com/images/user/e9fd987c2a0231b4ff115afb9728c38e-hd4.jpg
			return src
				.replace(/(:\/\/[^/]*\/)img\/[^/]*?[?&]id=([0-9a-f]+).*$/, "$1images/user/$2-hd4.jpg")
				.replace(/(\/images\/user\/[0-9a-f]+)-[a-z]+(?:[0-9]+)?(\.[^/.]*)$/, "$1-hd4$2");
		}

		if (domain === "fotografroku.ifotovideo.cz") {
			// http://fotografroku.ifotovideo.cz/image.php?id=423026&size=2 -- 1600x1060
			return src.replace(/(:\/\/[^/]*\/image\.php).*?[?&]id=([0-9]+).*?$/, "$1?id=$2&size=2");
		}

		if (domain === "img.kutikomiya.jp") {
			// https://img.kutikomiya.jp/thumbnail/sakura-sena/W85xH85/sakura-sena441.jpg
			//   https://img.kutikomiya.jp/album/sakura-sena/sakura-sena441.jpg
			// https://img.kutikomiya.jp/thumbnail/sakura-sena/W180/sakura-sena441.jpg
			//   https://img.kutikomiya.jp/album/sakura-sena/sakura-sena441.jpg
			return src.replace(/\/thumbnail(\/[^/]*\/)W[0-9]+(?:xH[0-9]+)?\//, "/album$1");
		}

		if (domain === "attach.setn.com") {
			// https://attach.setn.com/newsimages/2018/07/19/1452129-XXL.jpg -- 510x287
			//   https://attach.setn.com/newsimages/2018/07/19/1452129.jpg -- 1920x1080
			//   https://attach.setn.com/newsimages/2018/07/19/1452129-SOURCE.jpg -- 404
			// https://attach.setn.com/newsimages/2019/12/15/2303962.jpg -- 600x400
			//   https://attach.setn.com/newsimages/2019/12/15/2303962-SOURCE.jpg
			regex = /(\/newsimages\/+[0-9]+\/+[0-9]+\/+[0-9]+\/+[0-9]+)(?:-[A-Z]+)?(\.[^/.]*)$/;
			if (regex.test(src)) {
				return [
					src.replace(regex, "$1-SOURCE$2"),
					src.replace(regex, "$1$2")
				];
			}
		}

		if (domain_nowww === "heyzo.com") {
			// http://www.heyzo.com:81/contents/3000/0410/gallery/thumbnail_001.jpg
			//   http://www.heyzo.com:81/contents/3000/0410/gallery/001.jpg
			return src.replace(/\/gallery\/thumbnail_([0-9]+\.[^/.]*)$/, "/gallery/$1");
		}

		if (domain === "img.picabcd.com") {
			// http://img.picabcd.com/thumbnail/images/jlksxklxkk/9133178/caribpr-062714_885-002.jpg
			//   http://img.picabcd.com/images/jlksxklxkk/9133178/caribpr-062714_885-002.jpg
			return src.replace(/\/thumbnail\/images\//, "/images/");
		}

		if (domain === "mozishop.cdn.shoprenter.hu") {
			// https://mozishop.cdn.shoprenter.hu/custom/mozishop/image/cache/w400h600q80np1/Cikkek/Mozi%20M%C3%A1nia/Bossz%C3%BA%C3%A1ll%C3%B3k%204%20forgat%C3%A1si%20fot%C3%B3k/bosszuallok_vegtelen_haboru_plakat_comin_con_2018-mozishop.JPG?v=null.1527958420
			//   https://mozishop.cdn.shoprenter.hu/custom/mozishop/image/data/Cikkek/Mozi%20M%C3%A1nia/Bossz%C3%BA%C3%A1ll%C3%B3k%204%20forgat%C3%A1si%20fot%C3%B3k/bosszuallok_vegtelen_haboru_plakat_comin_con_2018-mozishop.JPG?v=null.1527958420
			return src.replace(/\/mozishop\/image\/cache\/(?:[a-z]{1,}[0-9]+){1,}\//, "/mozishop/image/data/");
		}

		if (domain === "terrigen-cdn-dev.marvel.com") {
			// https://terrigen-cdn-dev.marvel.com/content/qa/1x/291f80-LEGION_S1_Poster_REVISED.jpeg -- 1800x2700
			//   https://terrigen-cdn-dev.marvel.com/content/qa/2x/291f80-LEGION_S1_Poster_REVISED.jpeg -- 3600x5400 (not stretched)
			// https://terrigen-cdn-dev.marvel.com/content/prod/1x/291f80-LEGION_S1_Poster_REVISED.jpeg -- 1800x2700
			//   https://terrigen-cdn-dev.marvel.com/content/prod/2x/291f80-LEGION_S1_Poster_REVISED.jpeg -- doesn't work
			// https://terrigen-cdn-dev.marvel.com/content/prod/1x/cbl-08564_r2.jpg -- 2784x1856
			//   https://terrigen-cdn-dev.marvel.com/content/prod/2x/cbl-08564_r2.jpg -- 404
			return src.replace(/(\/content\/[a-z]+\/)1x\//, "$12x/");
		}

		if (domain_nowww === "czmodels.cz" ||
			// http://www.phmodels.cz/image/itemid-59296/h-400/59296.jpg
			//   http://www.phmodels.cz/image/itemid-59296/q-100/59296.jpg
			domain_nowww === "phmodels.cz") {
			// http://www.czmodels.cz/image/itemid-174708/h-130/q-80/174708.jpg
			//   http://www.czmodels.cz/image/itemid-174708/q-100174708.jpg
			//   http://www.czmodels.cz/image/itemid-174708/q-100/174708.jpg
			// .png also works, but is much larger
			// without q-100, it defaults to q-0 or something
			return src.replace(/(\/image\/itemid-([0-9]+)\/).*/, "$1q-100/$2.jpg");
		}

		if (domain_nosub === "amazonaws.com" && /^[a-z0-9]+\.execute-api\./.test(domain)) {
			// https://siirsn90c7.execute-api.eu-central-1.amazonaws.com/image/fit-in/620x700/pudra/3603/mila-kunis.jpg
			//   https://siirsn90c7.execute-api.eu-central-1.amazonaws.com/image/pudra/3603/mila-kunis.jpg
			// http://cdn.pudra.com/9634/fitb620x700/margotrobbie.jpg
			//   https://siirsn90c7.execute-api.eu-central-1.amazonaws.com/image/pudra/9634/margotrobbie.jpg
			// https://3gz8cg829c.execute-api.us-west-2.amazonaws.com/prod/image-renderer/16x9/full/1600/center/80/6225dbbb-913c-476b-9cb3-62ae92158806-AP20150181798929.jpg -- 1600x900
			//   https://3gz8cg829c.execute-api.us-west-2.amazonaws.com/prod/image-renderer/original/full/0/center/99/6225dbbb-913c-476b-9cb3-62ae92158806-AP20150181798929.jpg -- internal server error, due to head request
			//   https://3gz8cg829c.execute-api.us-west-2.amazonaws.com/prod/image-renderer/original/full/0/center/100/6225dbbb-913c-476b-9cb3-62ae92158806-AP20150181798929.jpg -- should work once cache is cleared
			// https://3gz8cg829c.execute-api.us-west-2.amazonaws.com/prod/image-renderer/16x9/full/1015/center/80/bcf86785-cf8e-4031-b301-e54c2a33856f-large16x9_bjthomas.jpg -- mildly upscaled
			//   https://3gz8cg829c.execute-api.us-west-2.amazonaws.com/prod/image-renderer/original/full/0/center/100/bcf86785-cf8e-4031-b301-e54c2a33856f-large16x9_bjthomas.jpg
			// thanks to Liz on discord for reporting:
			// https://abcnews4.com/resources/media/fd2ea1b0-c7f4-49bc-97c4-c4f3bbf3fedb-jumbo16x9_Calvinrecordsthebreathingofoneofhispetferrets.ferretdaddy_RealPress.jpeg
			//   https://3gz8cg829c.execute-api.us-west-2.amazonaws.com/prod/image-renderer/16x9/full/1015/center/80/fd2ea1b0-c7f4-49bc-97c4-c4f3bbf3fedb-large16x9_Calvinrecordsthebreathingofoneofhispetferrets.ferretdaddy_RealPress.jpeg
			//   https://3gz8cg829c.execute-api.us-west-2.amazonaws.com/prod/image-renderer/original/full/0/center/100/fd2ea1b0-c7f4-49bc-97c4-c4f3bbf3fedb-large16x9_Calvinrecordsthebreathingofoneofhispetferrets.ferretdaddy_RealPress.jpeg
			return {
				url: src
					.replace(/(:\/\/[^/]*\/image\/)fit-in\/[0-9]+x[0-9]+\//, "$1")
					.replace(/\/prod\/+image-renderer\/+[^/]+\/+[^/]+\/+[0-9]+\/+[^/]+\/+[0-9]+\/+([-0-9a-f]{20}[^/]+)(?:[?#].*)?$/, "/prod/image-renderer/original/full/0/center/100/$1"),
				can_head: false // otherwise it returns 502
			};
		}

		if (domain === "cdn.pudra.com") {
			// http://cdn.pudra.com/9634/fitb620x700/margotrobbie.jpg
			//   http://cdn.pudra.com/9634/margotrobbie.jpg -- redirects to:
			//   https://siirsn90c7.execute-api.eu-central-1.amazonaws.com/image/pudra/9634/margotrobbie.jpg
			return src.replace(/(:\/\/[^/]*\/[0-9]+\/)fit[a-z]?[0-9]+x[0-9]+\//, "$1");
		}

		if (domain === "arhiva.dalje.com") {
			// http://arhiva.dalje.com/slike/slike_3/r4/g2010/m12/y3252347100705424_1.jpg -- 132x124
			//   http://arhiva.dalje.com/slike/slike_3/r1/g2010/m12/y3252347100705424_1.jpg -- 3234x3060
			return src.replace(/(\/slike_[0-9]*\/)r[0-9]*(\/g[0-9]+\/)/, "$1r1$2");
		}

		if (domain === "media.super.cz") {
			// https://media.super.cz/images/gallery/0000000008211249/vcD3G5I_vuMisULzel6ZJA/57a06ea89d4df922981a0300-188614?size=539
			//   https://media.super.cz/images/gallery/0000000008211249/vcD3G5I_vuMisULzel6ZJA/57a06ea89d4df922981a0300-188614?size=9999999999999
			//   https://media.super.cz/images/original/0000000008211249/vcD3G5I_vuMisULzel6ZJA/57a06ea89d4df922981a0300-188614
			// https://media.super.cz/images/caption/0000000012460702/gH-JIrNCjljbVl3J5BKbMQ/5943f79c007564b1a7f70100-216186.jpg?20170616172206
			//   https://media.super.cz/images/top_foto1/0000000012470702/gH-JIrNCjljbVl3J5BKbMQ/5943f79c007564b1a7f70100-216186.jpg?20170616172206&size=539
			//   https://media.super.cz/images/original/0000000012460702/gH-JIrNCjljbVl3J5BKbMQ/5943f79c007564b1a7f70100-216186.jpg
			//return src.replace(/(\/[0-9a-f]+-[0-9]+)(?:\?.*)$/, "$1?size=9999999999999");
			return src.replace(/(:\/\/[^/]*\/images\/+)[^/]+\/(.*?)(?:[?#].*)?$/, "$1original/$2");
		}

		if (domain_nowww === "d1g.com") {
			// http://www.d1g.com/photos/00/32/3363200_normal.jpg -- 540x303
			//   http://www.d1g.com/photos/00/32/3363200_max.jpg -- 3264x1832
			return src.replace(/(\/photos\/[0-9]+\/[0-9]+\/[0-9]+)_[a-z]+(\.[^/.]*)$/, "$1_max$2");
		}

		if (domain_nowww === "e-shuushuu.net") {
			// http://e-shuushuu.net/images/thumbs/2010-07-17-303994.jpeg
			//   http://e-shuushuu.net/images/2010-07-17-303994.jpeg
			// http://e-shuushuu.net/images/thumbs/2018-07-22-967950.jpeg
			//   http://e-shuushuu.net/images/2018-07-22-967950.png
			return add_extensions_jpeg(src.replace(/(:\/\/[^/]*\/images\/)thumbs\//, "$1"));
		}

		if (domain === "cdn.anime-pictures.net" ||
			// http://ip1.anime-pictures.net/jvwall_images/c40/c40921ef095eaadb0bb668a193b1da3b_bp.jpg
			//   http://ip1.anime-pictures.net/jvwall_images/c40/c40921ef095eaadb0bb668a193b1da3b.jpg
			domain_nosub === "anime-pictures.net") {
			// https://cdn.anime-pictures.net/jvwall_images/5c1/5c1600107b0c809aa60ba085003cbb03_sp.png -- 111x150
			//   https://cdn.anime-pictures.net/jvwall_images/5c1/5c1600107b0c809aa60ba085003cbb03_bp.png.webp -- 447x600
			//   https://cdn.anime-pictures.net/jvwall_images/5c1/5c1600107b0c809aa60ba085003cbb03.png -- 750x1006
			// https://cdn.anime-pictures.net/jvwall_images/297/297017a879930cb80b97d33f4a19e38f_sp.jpg.webp
			//   https://cdn.anime-pictures.net/jvwall_images/297/297017a879930cb80b97d33f4a19e38f.jpg -- 2419x3047
			return src.replace(/(\/[0-9a-f]+)_[a-z]+(\.[^/.]*)(?:\.webp)?(\?.*)?$/, "$1$2$3");
		}

		if (domain === "images.treccani.it") {
			// http://images.treccani.it/enc/media/share/images/lm/system/galleries/IX_Appendice/ix_appendice_c_fig73.jpg
			//   http://images.treccani.it/enc/media/share/images/orig/system/galleries/IX_Appendice/ix_appendice_c_fig73.jpg
			return src.replace(/\/enc\/+media\/+share\/+images\/+[a-z]+\/+system\//, "/enc/media/share/images/orig/system/");
		}

		if (domain === "image-store.slidesharecdn.com") {
			// http://image-store.slidesharecdn.com/7e34b936-0bf8-11e4-94b5-22000aa7091d-large.jpeg
			//   http://image-store.slidesharecdn.com/7e34b936-0bf8-11e4-94b5-22000aa7091d-original.jpeg
			return src.replace(/(:\/\/[^/]*\/[-0-9a-f]+)-large(\.[^/.]*)$/, "$1-original$2");
		}

		if (domain_nosub === "stgy.ovh" && /^(?:[0-9]+\.)?citynews-(?:rimini)?today\./.test(domain)) {
			// http://2.citynews-riminitoday.stgy.ovh/~media/horizontal-low/18483820294027/riccione-controlli-polizia-notte-005-2.jpg
			//   http://2.citynews-riminitoday.stgy.ovh/~media/original-hi/18483820294027/riccione-controlli-polizia-notte-005-2.jpg -- 1000x666 (watermarked, stretched)
			//   http://2.citynews-riminitoday.stgy.ovh/~media/18483820294027/riccione-controlli-polizia-notte-005-2.jpg -- 667x444
			// http://2.citynews-riminitoday.stgy.ovh/~media/original-hi/40457162851293/enea-basianini-2016-2.jpg -- 1000x666
			//   http://2.citynews-riminitoday.stgy.ovh/~media/40457162851293/enea-basianini-2016-2.jpg -- 2500x1667
			// https://citynews-today.stgy.ovh/~media/horizontal-mid/55860123759782/uccello-2.jpg -- watermarked
			//   https://citynews-today.stgy.ovh/~media/55860123759782/uccello-2.jpg -- 720x404, not watermarked
			return src.replace(/\/~media\/[-a-z]+(\/[0-9]+\/)/, "/~media/$1");
		}

		if (domain === "media.raccweb.com") {
			// https://media.raccweb.com/__sized__/products/productimage-picture-jennette-mccurdy-signed-autograph-8x10-photo-sexy-sam-8977-thumbnail-1000x1000-100.jpg
			//   https://media.raccweb.com/products/productimage-picture-jennette-mccurdy-signed-autograph-8x10-photo-sexy-sam-8977.jpg
			//   https://www.racctrusted.com/media/products/productimage-picture-jennette-mccurdy-signed-autograph-8x10-photo-sexy-sam-8977.jpg
			return src.replace(/^[a-z]+:\/\/[^/]+\/+(__sized__\/+)/, "https://www.racctrusted.com/media/$1");
		}

		// funkwhale
		if (domain === "music.librepunk.club" ||
			// thanks to anonymous for reporting:
			// http://www.racctrusted.com/media/__sized__/images/proof/emiliaclarke-thumbnail-800x800-100.JPG
			//   https://www.racctrusted.com/media/images/proof/emiliaclarke.JPG
			// https://www.racctrusted.com/media/__sized__/user_profile/301624898_418415360388664_3344518810484812414_n-crop-c0-5__0-5-200x200.png
			//   https://www.racctrusted.com/media/user_profile/301624898_418415360388664_3344518810484812414_n.png
			// https://www.racctrusted.com/media/__sized__/products/productimage-picture-jennette-mccurdy-signed-autograph-8x10-photo-sexy-sam-8977-thumbnail-1000x1000-100.jpg
			//   https://www.racctrusted.com/media/products/productimage-picture-jennette-mccurdy-signed-autograph-8x10-photo-sexy-sam-8977.jpg
			domain_nowww === "racctrusted.com" ||
			// thanks to anonymous for reporting:
			// 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") {
			// https://music.librepunk.club/media/__sized__/albums/covers/2020/06/17/ba40139f6-b000-44da-b932-68192e154d4b-crop-c0-5__0-5-200x200-70.jpg
			//   https://music.librepunk.club/media/albums/covers/2020/06/17/ba40139f6-b000-44da-b932-68192e154d4b.jpg
			return src.replace(/(:\/\/[^/]*\/+(?:media\/+)?)__sized__\/+(.*)-(?:thumbnail|crop-c[0-9]+-[0-9]+__[0-9]+-[0-9]+)-[0-9]+x[0-9]+(?:-[0-9]+)?(\.[^/.]*)(?:[?#].*)?$/, "$1$2$3");
		}

		if (domain_nowww === "mormonnewsroom.org" ||
			// https://newsroom.churchofjesuschrist.org/media/640x360/20200715-RSMCaresFood-DSC02133-0298.jpg
			//   https://newsroom.churchofjesuschrist.org/media/original/20200715-RSMCaresFood-DSC02133-0298.jpg -- 2048x1365
			domain === "newsroom.churchofjesuschrist.org") {
			// https://www.mormonnewsroom.org/media/800x800/first-presidency-2018-horizontal.jpg
			//   https://www.mormonnewsroom.org/media/original/first-presidency-2018-horizontal.jpg
			return src.replace(/\/media\/+[0-9]+x[0-9]+\//, "/media/original/");
		}

		if (domain === "contents.mediadecathlon.com") {
			// https://contents.mediadecathlon.com/p596601/2000x2000/sq/3mm_thermo_fishing_waders_caperlan_8304142_596601.jpg?k=e5a9a9425cad7905f6351a10b5f4edcf
			//   https://contents.mediadecathlon.com/p596601/3mm_thermo_fishing_waders_caperlan_8304142_596601.jpg?k=e5a9a9425cad7905f6351a10b5f4edcf
			return src.replace(/(\/p[0-9]+\/)(?:[0-9]+x[0-9]+\/)?(?:[a-z]+\/)?([^/]*)$/, "$1$2");
		}

		if (domain_nowww === "overcast.fm") {
			// https://overcast.fm/art?s=9553420abe5c2fde9aa4baa732eb6640f635d57513b48b226a994149d2edf13d&w=840&u=http%3A%2F%2Fclovermedia.s3-us-west-2.amazonaws.com%2Fstore%2F1c%2F1c7b341e-3114-4031-940f-9858ef85928c%2Fthumbnails%2Fmobile%2F7be30075-53e3-4ffe-9539-5de773f033ee.jpg
			//   http://clovermedia.s3-us-west-2.amazonaws.com/store/1c/1c7b341e-3114-4031-940f-9858ef85928c/thumbnails/mobile/7be30075-53e3-4ffe-9539-5de773f033ee.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/art.*?[?&]u=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeURIComponent(newsrc);
		}

		if (amazon_container === "clovermedia") {
			// https://clovermedia.s3-us-west-2.amazonaws.com/store/4d7640df-af58-4875-9f18-3c55306d382b/10d8cf477a/thumbnails/medium/c0dbeb2e-2fee-4832-9364-3b0c55bf8425.jpg
			//   https://clovermedia.s3-us-west-2.amazonaws.com/store/4d7640df-af58-4875-9f18-3c55306d382b/10d8cf477a/thumbnails/original/c0dbeb2e-2fee-4832-9364-3b0c55bf8425.jpg
			// other:
			// http://clovermedia.s3-us-west-2.amazonaws.com/store/1c/1c7b341e-3114-4031-940f-9858ef85928c/thumbnails/mobile/7be30075-53e3-4ffe-9539-5de773f033ee.jpg -- original doesn't work
			return src.replace(/(\/store\/+[-0-9a-f]{20,}\/+[0-9a-f]+\/+thumbnails\/+)[a-z]+\/+/, "$1original/");
		}

		if (domain === "spottappeu01prd.blob.core.windows.net") {
			// https://api-cdn.spott.tv/rest/v004/image/images/a5921178-58de-4b98-8dc5-ba1317880f65?width=414&height=414
			// https://spottappeu01prd.blob.core.windows.net/appiness-spott-prd-img/2e/11/9b/07/c2ef81af78d2e7e48a19065f82507277ee1b1dc3bd5dec99a04777c2fb4ea311/600_600.jpg -- 399x600
			//   https://spottappeu01prd.blob.core.windows.net/appiness-spott-prd-img/2e/11/9b/07/c2ef81af78d2e7e48a19065f82507277ee1b1dc3bd5dec99a04777c2fb4ea311/0.jpg -- 615x923
			return src.replace(/(\/[0-9a-f]+\/)[0-9]+(?:_[0-9]+)(\.[^/.]*)$/, "$10$2");
		}

		if (domain === "medias.spotern.com") {
			// https://medias.spotern.com/spots/w640/100898.jpg
			//   https://medias.spotern.com/spots/original/100898.jpg
			// https://medias.spotern.com/spots/w640/152474-1532336916.jpg
			//   https://medias.spotern.com/spots/original/152474-1532336916.jpg
			// https://medias.spotern.com/users/avatars/w140/205342_c6c3016805e63098c177946807d9102e6b8e611ab12ae476d6bcc2fc8822bba3-1550580070.jpg
			//   https://medias.spotern.com/users/avatars/original/205342_c6c3016805e63098c177946807d9102e6b8e611ab12ae476d6bcc2fc8822bba3-1550580070.jpg
			return src.replace(/\/[wh][0-9]+\/([0-9]+(?:_[0-9a-f]+)?(?:-[0-9]+)?\.[^/.]*)$/, "/original/$1");
			//return src.replace(/\/users\/+avatars\/+[wh][0-9]+\/+/,
			//"/users/avatars/original/");
		}

		if (domain_nosub === "ounousa.com") {
			// http://static.ounousa.com/Content/ResizedImages/169/140/outside/150609123209282.jpg
			//   http://static.ounousa.com/content/uploads/Article/150609123209282.jpg
			// http://kms.ounousa.com/Content/ResizedImages/548/10000/inside/150321091301862.jpg
			//   http://kms.ounousa.com/content/uploads/Article/150321091301862.jpg
			return src.replace(/\/Content\/ResizedImages\/[0-9]+\/[0-9]+\/[a-z]+(\/[0-9]+\.[^/.]*)$/, "/content/uploads/Article$1");
		}

		if (domain_nowww === "divahair.ro") {
			// https://www.divahair.ro/images/speciale/articole/articole_imagini/andreea_baluteanu_107/2016.04.06/650x488/iiunie%202012%20la%20film%20festival%20valentino%20elle%20com_325_488.jpg
			//   https://www.divahair.ro/images/speciale/articole/articole_imagini/andreea_baluteanu_107/2016.04.06/iiunie%202012%20la%20film%20festival%20valentino%20elle%20com.jpg
			return src.replace(/(\/articole_imagini\/[^/]*\/[0-9]+\.[0-9]+\.[0-9]+\/)[0-9]+x[0-9]+\/([^/]*)_[0-9]+_[0-9]+(\.[^/.]*)$/, "$1$2$3");
		}

		if (domain_nowww === "wall.hr") {
			// https://wall.hr/cdn/uploads/850x/2015/02/ce1208af/keira-knightley.jpg
			//   https://wall.hr/cdn/uploads/2015/02/ce1208af/keira-knightley.jpg
			return src.replace(/\/cdn\/uploads\/[0-9]+x\//, "/cdn/uploads/");
		}

		if (domain_nosub === "tialoto.bg") {
			// http://m.tialoto.bg/media/tialoto/files/galleries/540x720scale/a888eccd8535a6bf86cf6729b96eeab2.jpg
			//   http://m.tialoto.bg/media/tialoto/files/galleries/orig/a888eccd8535a6bf86cf6729b96eeab2.jpg
			// http://m.tialoto.bg/media/tialoto/files/articles/451x572/b2a8a0221b893eff06d7411b5f0a742d.jpg -- 451x572
			//   http://m.tialoto.bg/media/tialoto/files/articles/orig/b2a8a0221b893eff06d7411b5f0a742d.jpg -- 4848x3232
			return src.replace(/(\/media\/tialoto\/files\/[a-z]+\/)[0-9]+x[0-9]+(?:[a-z]+)?(\/[0-9a-f]+\.[^/.]*)$/, "$1orig$2");
		}

		if (domain === "bizweb.dktcdn.net") {
			// https://bizweb.dktcdn.net/thumb/grande/100/177/764/products/alicia-vikander-6.jpg?v=1502942542610
			//   https://bizweb.dktcdn.net/thumb/compact/100/177/764/products/alicia-vikander-6.jpg?v=1502942542610
			//   https://bizweb.dktcdn.net/thumb/1024x1024/100/177/764/products/alicia-vikander-6.jpg?v=1502942542610
			//   https://bizweb.dktcdn.net/100/177/764/products/alicia-vikander-6.jpg?v=1502942542610
			return src.replace(/(:\/\/[^/]+\/+)thumb\/+(?:[a-z]+|[0-9]+x[0-9]+)\/+/, "$1");
		}

		if (domain_nowww === "socialbliss.com") {
			// http://www.socialbliss.com/img/280x0/assets/user_images/52774b76abbc1.jpg
			//   http://www.socialbliss.com/assets/user_images/52774b76abbc1.jpg
			return src.replace(/\/img\/[0-9]+x[0-9]+\/assets\//, "/assets/");
		}

		if (domain_nowww === "forumfr.com") {
			// https://www.forumfr.com/applications/core/interface/imageproxy/ximageproxy.php,qimg=,hnsa39.casimages.com,_img,_2018,_02,_07,_180207013159588388.jpg,akey=96fb4ae9f8f30c138ce4b5acf9d67ba5dc66f73ed534691d8e88ff8224bc2f16.pagespeed.ic.ukhs3d8eIr.jpg
			//   https://nsa39.casimages.com/img/2018/02/07/180207013159588388.jpg
			return "http://" + src.replace(/.*\/applications\/core\/interface\/imageproxy\/ximageproxy\.php.*?,qimg=,h(.*?)(?:,[^_].*)?$/, "$1").replace(/,_/g, "/");
		}

		if (domain_nowww === "pinkomatic.com") {
			// https://pinkomatic.com/images/0516/small/tTsOyy3Y16J7.jpg
			//   https://pinkomatic.com/images/0516/full/tTsOyy3Y16J7.jpg
			return src.replace(/(\/images\/[0-9]+\/)[a-z]+\//, "$1full/");
		}

		if (domain_nowww === "khmeread.com" ||
			// https://cdn2-manfashion.techbang.com/system/images/56743/medium/25c5c328460bf586ae2376f80b211d11.jpg?1490608891
			//   https://cdn2-manfashion.techbang.com/system/images/56743/original/25c5c328460bf586ae2376f80b211d11.jpg?1490608891
			(domain_nosub === "techbang.com" && domain.match(/^cdn[0-9]*(?:-[a-z]+)?\./))) {
			// http://khmeread.com/images/111492/medium/Salomon.jpg?1533719848
			//   http://khmeread.com/images/111492/original/Salomon.jpg?1533719848
			return src.replace(/(\/images\/[0-9]+\/)[a-z]+\//, "$1original/");
		}

		if (domain === "cfshopeetw-a.akamaihd.net" ||
			// https://cf.shopee.tw/file/a190639cd8c7a04fcfc2e399d3f8b0f8_tn
			domain === "cf.shopee.tw" ||
			// https://cf.shopee.co.id/file/0818fce27ee5458a8283f1e81ca59cb3_tn
			domain === "cf.shopee.co.id" ||
			// https://cf.shopee.ph/file/c56980db060813c7f2c7be192fab2d32_tn
			domain === "cf.shopee.ph" ||
			// https://cf.shopee.com.my/file/3ae9021af0186a1921da3ee2989863c6_tn
			domain === "cf.shopee.com.my" ||
			// https://cf.shopee.sg/file/e1738f999b9279ce1a1a93ae6cca8216_tn
			domain === "cf.shopee.sg" ||
			// https://cf.shopee.co.th/file/8958f49c1ebf52e394de23fb7f64ee44_tn
			domain === "cf.shopee.co.th" ||
			// https://cf.shopee.vn/file/b7d2cb844c1b46470dda210b7a777709_tn
			//   https://cf.shopee.tw/file/a190639cd8c7a04fcfc2e399d3f8b0f8
			domain === "cf.shopee.vn") {
			// https://cfshopeetw-a.akamaihd.net/file/914c8b8afa8600aede6f41dec60224be_tn
			//   https://cfshopeetw-a.akamaihd.net/file/914c8b8afa8600aede6f41dec60224be
			return src.replace(/(\/file\/[0-9a-f]+)_tn(?:\?.*)?$/, "$1");
		}

		if (domain_nowww === "theredlist.com") {
			// https://theredlist.com/media/.cache/database/muses/icon/cinematic_women/2000/keira-knightley/1468679918-039-keira-knightley-theredlist.jpg
			//   https://theredlist.com/media/database/muses/icon/cinematic_women/2000/keira-knightley/039-keira-knightley-theredlist.jpg
			return src.replace(/\/media\/\.cache\/database\/(.*\/)[0-9]+-([^/]*)$/, "/media/database/$1$2");
		}

		if ((domain_nosub === "hentai-cosplay.com" ||
			 // https://static.hentai-image.com/upload/20150308/25/25444/p=700/3.jpg
			 //   https://static.hentai-image.com/upload/20150308/25/25444/3.jpg
			 domain_nosub === "hentai-image.com" ||
			 domain_nosub === "porn-image-xxx.com" ||
			 domain_nosub === "porn-movie-xxx.com" ||
			 domain_nosub === "hentai-animes.com" ||
			 // https://static19.hentai-comic.com/upload/20190903/1066/1091520/p=160x200/1.jpg
			 //   https://static19.hentai-comic.com/upload/20190903/1066/1091520/1.jpg
			 domain_nosub === "hentai-comic.com" ||
			 // https://static4.aniimg.com/upload/20181112/5777/m/Y/C/p=305/mYCmEF.jpg
			 //   https://static4.aniimg.com/upload/20181112/5777/m/Y/C/mYCmEF.jpg
			 // https://static2.aniimg.com/upload/20170517/473/R/M/N/p=700/RMNFEF.jpg -- 700x393
			//   https://static2.aniimg.com/upload/20170517/473/R/M/N/RMNFEF.jpg -- 1920x1080
			 domain_nosub === "aniimg.com") &&
			domain.match(/^static[0-9]*\./) &&
			string_indexof(src, "/upload/") >= 0) {
			// https://static.hentai-cosplay.com/upload/20170918/67/68234/p=160x200/1.jpg -- 160x106
			//   https://static.hentai-cosplay.com/upload/20170918/67/68234/p=160x200/1.jpg -- 5472x3648
			newsrc = src
				.replace(/^[a-z]+:\/\/[^/]*\/upload\/cache\/thumbnail\/create\.php.*?[?&]image=([^&]*).*?$/, "$1");
			if (newsrc !== src) {
				return newsrc;
			}

			return src
				.replace(/(\/+[0-9]+\/+)(?:[a-z]+=[^/]*\/+){1,}([0-9]+\.[^/.]*)$/, "$1$2")
				.replace(/(\/+[0-9A-Z]+\/+)(?:[a-z]+=[^/]*\/+){1,}([0-9A-Za-z]+\.[^/.]*)$/, "$1$2");
		}

		if (domain === "d1in1v57myx5v.cloudfront.net" ||
			// https://mpics.mgronline.com/pics/Thumbnails/559000012559302.JPEG
			//   https://mpics.mgronline.com/pics/Images/559000012559302.JPEG
			domain === "mpics.mgronline.com") {
			// https://d1in1v57myx5v.cloudfront.net/pics/Thumbnails/561000004541403.JPEG.webp
			//   https://d1in1v57myx5v.cloudfront.net/pics/Images/561000004541403.JPEG.webp
			return src.replace(/\/pics\/+Thumbnails\//, "/pics/Images/");
		}

		if (domain_nowww === "artistic-nude-images.com") {
			// http://www.artistic-nude-images.com/modules/mg3/albums/2012/10-Octobre/thumbnail/tn-NU_artistique_feminin_067.jpg
			//   http://www.artistic-nude-images.com/modules/mg3/albums/2012/10-Octobre/NU_artistique_feminin_067.jpg
			return src.replace(/\/thumbnail\/tn-([^/]*)$/, "/$1");
		}

		if (domain_nowww === "babefilter.net") {
			// http://babefilter.net/i/5b4d/5b4d69cc62878_tn.jpg
			//   http://babefilter.net/i/5b4d/5b4d69cc62878.jpg
			return {
				url: src.replace(/(\/i\/[0-9a-f]+\/[0-9a-f]+)_tn(\.[^/.]*)$/, "$1$2"),
				headers: {
					Referer: src
				}
			};
		}

		if ((domain_nosub === "dagospia.com" && string_indexof(src, "/img/") >= 0) ||
			// http://www.sutki.net/img/g/146/33/1_tn.jpg
			//   http://www.sutki.net/img/g/146/33/1.jpg
			(domain_nowww === "sutki.net" && string_indexof(src, "/img/") >= 0) ||
			// http://screensonic.net/images/169df776e1ec1f491ff3d92a1_tn.jpg
			//   http://screensonic.net/images/169df776e1ec1f491ff3d92a1.jpg
			(domain_nowww === "screensonic.net" && string_indexof(src, "/images/") >= 0)) {
			// http://cdn-static.dagospia.com/img/foto/04-2018/netanyahu-1007071_tn.jpg
			//   http://cdn-static.dagospia.com/img/foto/04-2018/netanyahu-1007071.jpg
			// http://www.dagospia.com/img/foto/03-2016/amelia-windsor-6-771156_tn.jpg
			//   http://www.dagospia.com/img/foto/03-2016/amelia-windsor-6-771156.jpg
			return src.replace(/_tn(\.[^/.]*)$/, "$1");
		}

		if (domain_nowww === "fabhairypussy.com") {
			// http://www.fabhairypussy.com/galleries/Atk/uO6FCACz/01_tn.jpg
			//   http://www.fabhairypussy.com/galleries/Atk/uO6FCACz/01.jpg
			// http://www.fabhairypussy.com/galleries/haw/2019/11/rj584Fwx/01_weah_fmp_rsz.jpg
			//   http://www.fabhairypussy.com/galleries/haw/2019/11/rj584Fwx/01.jpg
			return {
				url: src.replace(/(\/+galleries\/+[^/]*\/+(?:[0-9]{4}\/+[0-9]{2}\/+)?[^/]+\/+[0-9]+)(?:_[a-z]+){1,}(\.[^/.]*)(?:[?#].*)?$/, "$1$2"),
				headers: {
					Referer: ""
				},
				referer_ok: {
					same_domain: true
				}
			};
		}

		if (domain_nowww === "redcarpetnudes.com" ||
			// https://www.shamelesscelebrities.com/xhc/1476180120-selena-gomez-pictures-celebrity-hot-slut-sea-teen-perfect-latin/selena-gomez-pictures-celebrity-hot-slut-sea-teen-perfect-latin-1-tn.jpg
			//   https://www.shamelesscelebrities.com/xhc/1476180120-selena-gomez-pictures-celebrity-hot-slut-sea-teen-perfect-latin/selena-gomez-pictures-celebrity-hot-slut-sea-teen-perfect-latin-1.jpg
			domain_nowww === "shamelesscelebrities.com" ||
			// http://cdn.onedala.tv/uploads/article-image/201711/20171110071239W3npxg0y-tn.jpg -- upscaled?
			//   http://cdn.onedala.tv/uploads/article-image/201711/20171110071239W3npxg0y.jpg
			domain === "cdn.onedala.tv") {
			// https://www.redcarpetnudes.com/xhc/1460358606-selena-gomez-pictures-celebrity-teen-hot-tits-sexy/selena-gomez-pictures-celebrity-teen-hot-tits-sexy-11-tn.jpg
			//   https://www.redcarpetnudes.com/xhc/1460358606-selena-gomez-pictures-celebrity-teen-hot-tits-sexy/selena-gomez-pictures-celebrity-teen-hot-tits-sexy-11.jpg
			return src.replace(/-tn(\.[^/.]*)$/, "$1");
		}

		if (domain === "pat.primecdn.net") {
			// https://pat.primecdn.net/pics/hugethumbs/b9/b9be5e48.jpg
			//   https://pat.primecdn.net/pics/original/b9/b9be5e48.jpg -- upscaled
			return src.replace(/\/pics\/[a-z]+(\/[0-9a-f]+\/[0-9a-f]+\.[^/.]*)$/, "/pics/original$1");
		}

		if (domain_nosub === "imagearn.com") {
			// http://thumbs.imagearn.com/18112009/2112534.jpg
			//   http://thumbs.imagearn.com/imags/18112009/2112534.jpg
			return src.replace(/(:\/\/[^/]*\/)([0-9]+\/[0-9]+\.[^/.]*)$/, "$1imags/$2");
		}

		if (domain === "img.static-smb.be" ||
			// https://img.static-rmg.be/a/view/q75/w/h450/742525/natalie-portman.jpg
			//   https://img.static-rmg.be/a/view/q100/w/h/742525/natalie-portman.jpg
			domain === "img.static-rmg.be") {
			// https://img.static-smb.be/a/view/q75/w/h450/742525/natalie-portman.jpg
			//   https://img.static-smb.be/a/view/q100/w/h/742525/natalie-portman.jpg
			return src.replace(/\/view\/q[0-9]*\/w[0-9]*\/h[0-9]*\//, "/view/q100/w/h/");
		}

		if (domain_nosub === "buro247.mn" ||
			// https://www.buro247.sg/thumb/500x200/local/images/buro/cannes%20film%20festival%20best%20dressed%20red%20carpet%20celebrity%20buro247%20portrait-1.jpg
			//   https://www.buro247.sg/local/images/buro/cannes%20film%20festival%20best%20dressed%20red%20carpet%20celebrity%20buro247%20portrait-1.jpg
			domain_nosub === "buro247.sg" ||
			// https://www.buro247.kz/thumb/125x185/galleries/2018/01/Vuitton%20m%20RF18%201109.jpg
			//   https://www.buro247.kz/local/images/buro/galleries/2018/01/Vuitton%20m%20RF18%201109.jpg
			domain_nosub === "buro247.kz" ||
			// http://www.buro247.mx/thumb/625x960_0/galleries/2018/01/gucci.jpg
			//   http://www.buro247.mx/local/images/buro/galleries/2018/01/gucci.jpg
			domain_nosub === "buro247.mx" ||
			// http://www.buro247.com.au/thumb/640x960_0/thumb/512x760_8/512-GettyImages-151262923.jpg
			//   http://www.buro247.com.au/thumb/512x760_8/512-GettyImages-151262923.jpg
			domain_nosub === "buro247.com.au" ||
			// https://www.buro247.ua/thumb/670x830_0/images/2018/05/900_benedict-cumberbatch-equal-pay.jpg
			//   https://www.buro247.ua/images/2018/05/900_benedict-cumberbatch-equal-pay.jpg
			domain_nosub === "buro247.ua" ||
			// https://m.buro247.mn/thumb/300x300_5/images/rarealbumsq.jpg
			//   https://m.buro247.mn/images/rarealbumsq.jpg
			domain_nosub === "buro247.mn" ||
			// https://www.buro247.ru/thumb/1000x700/local/images/buro/galleries/2018/01/Vuitton-m-RF18-0784.jpg
			//   https://www.buro247.ru/local/images/buro/galleries/2018/01/Vuitton-m-RF18-0784.jpg
			domain_nosub === "buro247.ru") {
			// http://www.m.buro247.mn/thumb/600x960_0/images/b5355e20ca4e6c7938b8fb3d009bf304--brown-hair-facial-hair.jpg
			//   http://www.m.buro247.mn/images/b5355e20ca4e6c7938b8fb3d009bf304--brown-hair-facial-hair.jpg
			// http://www.buro247.mn/thumb/1000x700/local/images/buro/galleries/2018/01/_VUI0653.jpg
			//   http://www.buro247.mn/local/images/buro/galleries/2018/01/_VUI0653.jpg
			//return src.replace(/\/thumb\/[0-9]+x[0-9]+\/local\/images\//, "/local/images/");
			return src
				.replace(/(\/thumb\/[^/]*\/)galleries\//, "$1local/images/buro/galleries/")
				.replace(/\/thumb\/[0-9]+x[0-9]+(?:_[0-9]+)?((?:\/local)?\/(?:images|thumb)\/)/, "$1");
		}

		if (domain_nosub === "hellomagazine.com") {
			// https://ru.hellomagazine.com/thumb/755x550_0/images/2017/february/dasha/emma-010317-zahod2.jpg
			//   https://ru.hellomagazine.com/images/2017/february/dasha/emma-010317-zahod2.jpg
			// https://ru.hellomagazine.com/thumb/715x690_0/gallery/2002/gl17-35.jpg
			//   https://ru.hellomagazine.com/gallery/2002/gl17-35.jpg
			return src.replace(/\/thumb\/+[0-9]+x[0-9]+(?:_[0-9]+)?\/+(images|gallery\/+)/, "/$1");
		}

		if (domain === "images.vogue.it") {
			// https://images.vogue.it/gallery/38166/Big/10c148fb-73cb-49d7-b2fe-4a30926462bd.jpg
			//   https://images.vogue.it/gallery/38166/Original/10c148fb-73cb-49d7-b2fe-4a30926462bd.jpg
			// http://images.vogue.it/imgs/galleries/bellezza/idea-del-giorno/018811/selena-gomez-168691_201x113.jpg
			// http://images.vogue.it/Photovogue/6f1dedb0-f990-11e9-a462-7dc8db5ac32a_small.jpg
			//   http://images.vogue.it/Photovogue/6f1dedb0-f990-11e9-a462-7dc8db5ac32a_large.jpg
			// other:
			// https://www.vogue.it/sfilate/sfilata/collezioni-primavera-estate-2017/altuzarra?refresh_ce=
			// http://images.vogue.it/imgs/sfilate/collezioni-primavera-estate-2017/altuzarra/collezione/Thumb/_ALT0026_20160912015409.jpg
			//   http://images.vogue.it/imgs/sfilate/collezioni-primavera-estate-2017/altuzarra/collezione/Base/_ALT0026_20160912015415.jpg
			//   http://images.vogue.it/imgs/sfilate/collezioni-primavera-estate-2017/altuzarra/collezione/HQ/_ALT0026_20160912015447.jpg -- different IDs
			return src
				.replace(/(\/gallery\/[0-9]+\/)[A-Za-z]+(\/[-0-9a-f]+\.[^/.]*)$/, "$1Original$2")
				.replace(/(\/Photovogue\/+[-0-9a-f]{10,})_small(\.[^/.]+)(?:[?#].*)?$/, "$1_large$2");
		}

		if (domain === "blogs.glamour.de") {
			// https://blogs.glamour.de/danijelapilic/thumbs/teaserimage_large/2011/08/122140252.jpg
			//   https://blogs.glamour.de/danijelapilic/files/2011/08/122140252.jpg
			return src.replace(/\/thumbs\/[^/]*\//, "/files/");
		}

		if (domain === "img.beatles.ru") {
			// http://img.beatles.ru/f/2874/2874233.jpg
			//   http://img.beatles.ru/f/2874b/2874233.jpg
			return src.replace(/(\/[0-9]+)(\/[0-9]+\.[^/.]*)$/, "$1b$2");
		}

		if (domain_nowww === "boutique.az") {
			// http://boutique.az/images/94034_m.jpg
			//   http://boutique.az/images/94034.jpg
			return src.replace(/(\/images\/[0-9]+)_[a-z](\.[^/.]*)$/, "$1$2");
		}

		if (domain_nowww === "izum.ua") {
			// http://izum.ua/Data/GImg/12369/miss-dior-natali-portman-v-novojj-reklamnojj-kampa_209006_sml.jpg
			//   http://izum.ua/Data/GImg/12369/miss-dior-natali-portman-v-novojj-reklamnojj-kampa_209006.jpg
			return src.replace(/(_[0-9]+)_sml[0-9]*(\.[^/.]*)$/, "$1$2");
		}

		if (domain_nosub === "senatus.net" &&
			domain.match(/^cache[0-9]*\./)) {
			// https://cache2.senatus.net/files/albums/resized/senatus_SNsZUm.jpg
			//   https://cache2.senatus.net/files/albums/resized2x/senatus_SNsZUm.jpg
			//   https://cache2.senatus.net/files/albums/senatus_SNsZUm.jpg
			return src.replace(/\/files\/albums\/resized(?:[0-9]+x)?\//, "/files/albums/");
		}

		if (domain_nowww === "max-pix.com" ||
			// https://www.kollywoodzone.com/data/thumbnails/5732/jeyikkira_kuthira_actress_sakshi_agarwal_photos_01.jpg
			//   https://www.kollywoodzone.com/data/media/5732/jeyikkira_kuthira_actress_sakshi_agarwal_photos_01.jpg
			domain_nowww === "kollywoodzone.com" ||
			// https://www.celebwallpaper.org/data/thumbnails/2668/english_actress_felicity_jones_pictures_01.jpg
			//   https://www.celebwallpaper.org/data/media/2668/english_actress_felicity_jones_pictures_01.jpg
			domain_nowww === "celebwallpaper.org" ||
			// http://www.carlyslayjepsen.com/photos/data/thumbnails/24/carly-rae-jepsen-candies-fall-2013-campaign-02.jpg
			//   http://www.carlyslayjepsen.com/photos/data/media/24/carly-rae-jepsen-candies-fall-2013-campaign-02.jpg
			domain_nowww === "carlyslayjepsen.com" ||
			// http://moregirls.org/data/thumbnails/22/moregirlsAsians%20(212).jpg
			//   http://moregirls.org/data/media/22/moregirlsAsians%20(212).jpg
			domain_nosub === "moregirls.org") {
			// http://max-pix.com/data/thumbnails/4767/Portman_13-1.jpg
			//   http://max-pix.com/data/media/4767/Portman_13-1.jpg
			return src.replace(/\/data\/thumbnails(\/[0-9]+\/)/, "/data/media$1");
		}

		if (domain_nowww === "tapeteos.pl") {
			// https://www.tapeteos.pl/data/thumbnails/1214/becky_g_-_rebbeca_marie_gomez_039.jpg
			//   https://www.tapeteos.pl/data/media/1214/becky_g_-_rebbeca_marie_gomez_039.jpg
			//   https://www.tapeteos.pl/data/media/1214/big/becky_g_-_rebbeca_marie_gomez_039.jpg
			// https://www.tapeteos.pl/data/media/1214/big/becky_g_-_rebbeca_marie_gomez_039__resized_1600x900.jpg
			//   https://www.tapeteos.pl/data/media/1214/big/becky_g_-_rebbeca_marie_gomez_039.jpg
			return src
				.replace(/\/data\/thumbnails(\/[0-9]+\/)/, "/data/media$1big/")
				.replace(/(\/data\/media\/[0-9]+\/)([^/]*)$/, "$1big/$2")
				.replace(/__resized_[0-9]+x[0-9]+(\.[^/.]*)$/, "$1");
		}

		if (domain === "media.8ch.net" ||
			// https://media.8kun.top/file_store/thumb/cb73694524387233a9f4bf5a6c3a7021fe82e17b1b6023311eee66e1234f1ca1.jpg
			//   https://media.8kun.top/file_store/cb73694524387233a9f4bf5a6c3a7021fe82e17b1b6023311eee66e1234f1ca1.jpg
			domain === "media.8kun.top") {
			// https://media.8ch.net/file_store/thumb/b024015a42f19d474d282a532ef8b99fdfad69cad68c0e95efc68e071c8afa4c.jpg
			//   https://media.8ch.net/file_store/b024015a42f19d474d282a532ef8b99fdfad69cad68c0e95efc68e071c8afa4c.jpg
			return src.replace(/\/file_store\/thumb\//, "/file_store/");
		}

		if (domain_nowww === "elles-se-mettent-nues-pour-nous.fr") {
			// https://elles-se-mettent-nues-pour-nous.fr/photos/affiche/thumb/closer-1.jpg
			//   https://elles-se-mettent-nues-pour-nous.fr/photos/affiche/closer-1.jpg
			return src.replace(/(\/photos\/[^/]+\/)thumb\//, "$1");
		}

		if (domain === "media.filmz.ru") {
			// http://media.filmz.ru/photos/small/filmz.ru_s_148528.jpg
			//   http://media.filmz.ru/photos/full/filmz.ru_f_148528.jpg
			// http://media.filmz.ru/photos/medium/m_148528.jpg
			//   http://media.filmz.ru/photos/full/f_148528.jpg
			// http://media.filmz.ru/photos/micro/177306.jpeg
			//   http://media.filmz.ru/photos/full/f_177306.jpeg
			return src.replace(/\/photos\/+[a-z]+\/+([^/_]{2,}_)?(?:[a-z]_)?([0-9]+\.[^/.]*)$/, "/photos/full/$1f_$2");
		}

		if (domain_nowww === "kinofilms.ua") {
			// http://www.kinofilms.ua/images/photos/w200/446671.jpg -- 200x133
			//   http://www.kinofilms.ua/images/photos/hd/446671.jpg -- 4928x3280
			return src.replace(/\/images\/photos\/[a-z0-9]+\/([0-9]+\.[^/.]*)$/, "/images/photos/hd/$1");
		}

		if (domain_nowww === "grandmagazine.gr") {
			// http://www.grandmagazine.gr/cache/uploaded_images/articles/1441/75_46_phoca_thumb_l_beautiful-creatures-12.jpg
			//   http://www.grandmagazine.gr/uploaded_images/articles/1441/phoca_thumb_l_beautiful-creatures-12.jpg
			return src.replace(/\/cache\/uploaded_images\/(.*)\/[0-9]+_[0-9]+_([^/]*)$/, "/uploaded_images/$1/$2");
		}

		if (domain === "a69.g.akamai.net") {
			// http://a69.g.akamai.net/n/69/10688/v1/img5.allocine.fr/acmedia/medias/nmedia/18/96/63/32/20480140.jpg
			//   http://img5.allocine.fr/acmedia/medias/nmedia/18/96/63/32/20480140.jpg
			return add_http(src.replace(/^[a-z]+:\/\/[^/]*\/[a-z]+\/[0-9]+\/[0-9]+\/v[0-9]+\//, ""));
		}

		if (domain === "images.allocine.fr") {
			// http://images.allocine.fr/c_160_213/pictures/18/06/08/14/35/0842353.jpg
			//   http://images.allocine.fr/pictures/18/06/08/14/35/0842353.jpg
			// https://images.allocine.fr/r_660_0/pictures/18/06/08/14/35/0842353.jpg
			//   https://images.allocine.fr/pictures/18/06/08/14/35/0842353.jpg
			return src.replace(/\/[rc]_[0-9]+_[0-9]+\/+pictures\/+/, "/pictures/");
		}

		if (domain === "cdn-media.rtl.fr") {
			// https://cdn-media.rtl.fr/cache/mRLUC6KYEOEJJKk1mtII6A/720v1080-2/online/image/2015/1014/7780099593_jeremyironssublimescreaturessnd.jpg
			//   https://cdn-media.rtl.fr/online/image/2015/1014/7780099593_jeremyironssublimescreaturessnd.jpg
			// https://cdn-media.rtl.fr/cache/jHJjYDpcT3hXj3zdd_W9Aw/880v587-0/online/image/2016/0226/7782069121_les-audiences-des-sites-de-la-galaxie-rtlnet-sont-en-hausse.png
			//   https://cdn-media.rtl.fr/online/image/2016/0226/7782069121_les-audiences-des-sites-de-la-galaxie-rtlnet-sont-en-hausse.png
			return src.replace(/\/cache\/[-a-zA-Z0-9_]+\/[0-9]+v[0-9]+(?:-[0-9]+)?\/online\//, "/online/");
		}

		if (domain === "images.rtl.fr") {
			// thanks to anonymous for reporting:
			// https://images.rtl.fr/~c/1200v800/rtl/www/1204505-zizi-jeanmaire-est-morte-le-17-juillet-2020-a-96-ans.jpg
			//   https://images.rtl.fr/rtl/www/1204505-zizi-jeanmaire-est-morte-le-17-juillet-2020-a-96-ans.jpg
			return src.replace(/(:\/\/[^/]+\/+)~c\/+[^/]+\/+/, "$1");
		}

		if (domain === "bcdn.newshunt.com" ||
			// http://assets-news-bcdn.dailyhunt.in/cmd/resize/400x400_60/fetchdata13/images/84/8f/55/848f55be707b5d4cc1e5177728105a36.jpg
			//   http://assets-news-bcdn.dailyhunt.in/rx/fetchdata13/images/84/8f/55/848f55be707b5d4cc1e5177728105a36.jpg
			// http://assets-news-bcdn-ll.dailyhunt.in/cmd/resize/400x400_60/fetchdata13/images/2b/c8/06/2bc8064bc8af1d65f79882d018b1e094.jpg
			//   http://assets-news-bcdn-ll.dailyhunt.in/rx/fetchdata13/images/2b/c8/06/2bc8064bc8af1d65f79882d018b1e094.jpg
			// http://assets-news-bcdn.dailyhunt.in/cmd/resize/400x400_60/fetchdata15/images/69/02/64/690264611ab2b114ec9c0598e0336da7.jpg
			//   http://assets-news-bcdn.dailyhunt.in/fetchdata15/images/69/02/64/690264611ab2b114ec9c0598e0336da7.jpg
			// https://assets-news-bcdn.dailyhunt.in/cmd/resize/400x400_80/fetchdata16/images/41/8c/1f/418c1f22c99fb8dea49d90333c8efbc23c82f1e94c7418812886418668e4cb5f.webp
			//   https://assets-news-bcdn.dailyhunt.in/fetchdata16/images/41/8c/1f/418c1f22c99fb8dea49d90333c8efbc23c82f1e94c7418812886418668e4cb5f.jpg
			(domain_nosub === "dailyhunt.in" && domain.match(/bcdn[-.]/))) {
			// http://bcdn.newshunt.com/cmd/resize/400x400_60/fetchdata13/images/dc/b1/27/dcb1279a206713ea6342291e9f268f42.jpg
			//   http://bcdn.newshunt.com/rx/fetchdata13/images/dc/b1/27/dcb1279a206713ea6342291e9f268f42.jpg
			obj = {
				url: src,
				head_wrong_contentlength: true
			};

			newsrc = src.replace(/\/cmd\/[a-z]+\/[^/]*\/(fetchdata[0-9]*\/images\/)/, "/$1");
			if (newsrc !== src) {
				obj.url = newsrc.replace(/\.webp(?:[?#].*)?$/, ".jpg");
			}

			return obj;
		}

		if (domain === "media.search.lt") {
			// http://media.search.lt/GetFile.php?OID=263904&filetype=1 -- 64x43
			//   http://media.search.lt/GetFile.php?OID=263904&filetype=4 -- 2736x1824
			return src.replace(/\/GetFile\.php.*?[?&](OID=[0-9]+).*?$/, "/GetFile.php?$1&filetype=4");
		}

		if (domain_nowww === "wallofcelebrities.com") {
			// https://www.wallofcelebrities.com/celebrity/samantha-mumba/pictures/psmall/samantha-mumba_669439.jpg
			//   https://www.wallofcelebrities.com/celebrity/samantha-mumba/pictures/original/samantha-mumba_669439.jpg
			return {
				url: src.replace(/\/pictures\/[a-z]+\/([^/]*_[0-9]+\.[^/.]*)$/, "/pictures/original/$1"),
				headers: {
					Referer: "https://www.wallofcelebrities.com/"
				}
			};
		}

		if (domain_nosub === "lmstube.com") {
			// http://pt.lmstube.com/wallpaper/stars/Samantha-Mumba/200x150/Samantha-Mumba-1.JPG
			//   http://pt.lmstube.com/wallpaper/stars/Samantha-Mumba/Samantha-Mumba-1.JPG
			// http://us.lmstube.com/wallpaper/stars/Samantha-Mumba/1280x1024/Samantha-Mumba-1.JPG
			//   http://us.lmstube.com/wallpaper/stars/Samantha-Mumba/Samantha-Mumba-1.JPG
			return src.replace(/\/[0-9]+x[0-9]+\/([^/]*)$/, "/$1");
		}

		if (domain === "assets.mubi.com") {
			// https://assets.mubi.com/images/cast_member/45165/image-w240.jpg?1387570366
			//   https://assets.mubi.com/images/cast_member/45165/image-original.jpg?1387570366
			// https://assets.mubi.com/images/notebook/post_images/21770/images-w1400.jpg?1469543673
			//   https://assets.mubi.com/images/notebook/post_images/21770/images-original.jpg?1469543673
			// https://assets.mubi.com/images/notebook/post_images/24771/images-w1400.jpg?1511016423?savepath=images-w1400.jpg
			//   https://assets.mubi.com/images/notebook/post_images/24771/images-original.jpg?1511016423
			return src.replace(/(\/images?)-[a-z0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1-original$2");
		}

		if (domain_nowww === "fundir.org") {
			// https://fundir.org/th/7vgrj_iy=t!dkk=dwzam5vpu/najpiekniejsze_aktorki.jpg
			//   https://fundir.org/img/7vgrj_iy=t!dkk=dwzam5vpu/najpiekniejsze_aktorki.jpg
			return src.replace(/(:\/\/[^/]*\/)th\//, "$1img/");
		}

		if (domain_nowww === "spletnik.ru") {
			// http://www.spletnik.ru/thumb/300x200/img/2018/07/elizaveta/20180730-beauty-an.jpg
			//   http://www.spletnik.ru/img/2018/07/elizaveta/20180730-beauty-an.jpg
			// http://www.spletnik.ru/thumb/135x200_5/img/gallery/comthumb/989/2902-margo-01.jpg
			//   http://www.spletnik.ru/img/gallery/comthumb/989/2902-margo-01.jpg
			return src.replace(/\/thumb\/[0-9]+x[0-9]+(?:_[0-9]+)?\/img\//, "/img/");
		}

		if (domain === "r.mtdata.ru") {
			// https://r.mtdata.ru/c50x50/u2/photoE179/20222887187-0/original.jpg#20222887187
			//   https://mtdata.ru/u2/photoE179/20222887187-0/original.jpg#20222887187
			// https://r.mtdata.ru/r480x-/u23/photo7A49/20855335731-0/original.jpeg#20855335731
			//   https://mtdata.ru/u23/photo7A49/20855335731-0/original.jpeg#20855335731
			return src.replace(/:\/\/[^/]*\/[a-z][-0-9]+x[-0-9]+\//, "://mtdata.ru/");
		}

		if (domain_nowww === "mtdata.ru" &&
			src.match(/:\/\/[^/]*\/u[0-9]+\/photo/)) {
			// http://mtdata.ru/u23/photoEE41/20442231528-0/big.jpeg -- 480x677
			//   http://mtdata.ru/u23/photoEE41/20442231528-0/huge.jpeg -- 725x1024
			//   http://mtdata.ru/u23/photoEE41/20442231528-0/original.jpeg -- 907x1280
			return src.replace(/\/(?:huge|big)(\.[^/.]*)$/, "/original$1");
		}

		if (domain === "img.uduba.com") {
			// http://img.uduba.com/mtdata.ru/u3/photo96CC/20986372912-0/original_783x0.jpg -- 783x1135 (stretched?)
			//   http://mtdata.ru/u3/photo96CC/20986372912-0/original.jpg -- 745x1080
			newsrc = src.replace(/:\/\/[^/]*\/mtdata\.ru\//, "://mtdata.ru/");
			if (newsrc !== src) {
				return newsrc.replace(/\/[a-z]+_[0-9]+x[0-9]+(\.[^/.]*)$/, "/original$1");
			}
		}

		if (domain_nowww === "russianpulse.ru") {
			// https://russianpulse.ru/img/http://mtdata.ru/u15/photo882D/20980066834-0/original.jpg
			//   http://mtdata.ru/u15/photo882D/20980066834-0/original.jpg
			return src.replace(/^[a-z]+:\/\/[^/]*\/img\/([a-z]+:\/\/.*)$/, "$1");
		}

		if (domain === "img.noobzone.ru" ||
			// https://m.btdx8.com/uploads/getimg.php?src=https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2533283770.jpg
			//   https://img3.doubanio.com/pview/photo/raw/public/p2533283770.jpg
			domain === "m.btdx8.com" ||
			// http://www.guihuayun.com/getimg.php?url=http://mmbiz.qpic.cn/mmbiz/HEwvIqrmFSHOSgdfCNUtZargeuch1HYwhgibGIwylD8rYcqhNibicuCcmwC4zg3N4K4Efws23stKSwohuK5khJNwg/640?wx_fmt=jpeg
			//   http://mmbiz.qpic.cn/mmbiz/HEwvIqrmFSHOSgdfCNUtZargeuch1HYwhgibGIwylD8rYcqhNibicuCcmwC4zg3N4K4Efws23stKSwohuK5khJNwg/0
			domain_nowww === "guihuayun.com") {
			// https://img.noobzone.ru/getimg.php?url=http%3A%2F%2Fmtdata.ru%2Fu2%2Fphoto7447%2F20649820661-0%2Foriginal.jpg
			//   http://mtdata.ru/u2/photo7447/20649820661-0/original.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+(?:uploads\/+)?getimg\.php\?(?:.*&)?(?:url|src)=([^&]+).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "media.aintitcool.com") {
			// https://media.aintitcool.com/media/uploads/2016/quint/ffsplit1_large.jpg
			//   https://media.aintitcool.com/media/uploads/2016/quint/ffsplit1.jpg
			// http://media.aintitcool.com/media/uploads/2013/papa_vinyard/hobbitsdwarvesohmy_big.jpg
			//   http://media.aintitcool.com/media/uploads/2013/papa_vinyard/hobbitsdwarvesohmy.jpg
			// https://media.aintitcool.com/media/uploads/2016/herc/civil_huge.jpg
			//   https://media.aintitcool.com/media/uploads/2016/herc/civil.jpg
			// https://media.aintitcool.com/media/uploads/2017/herc/chung_medium.jpg
			//   https://media.aintitcool.com/media/uploads/2017/herc/chung.jpg
			return src.replace(/_(?:large|big|huge|medium)(\.[^/.]*)(?:[?#].*)?$/, "$1");
		}

		if (domain_nowww === "lichnosti.net") {
			// http://lichnosti.net/rs/thumbs/599/set_8_51e52868d9343_jpg_0_250_250.png
			//   http://lichnosti.net/photos/599/sets/8_51e52868d9343.jpg
			// http://lichnosti.net/rs/thumbs/4758/13791893438_jpg_0_100_0.png
			//   http://lichnosti.net/photos/4758/13791893438.jpg
			//   http://lichnosti.net/photo_55508.html
			return src
				.replace(/\/rs\/+thumbs\/+([0-9]+)\/+set_([^/]*)_([a-z]+)_[0-9]+_[0-9]+_[0-9]+\.[^/.]*$/, "/photos/$1/sets/$2.$3")
				.replace(/\/rs\/+thumbs\/+([0-9]+)\/+([^/]*)_([a-z]+)_[0-9]+_[0-9]+_[0-9]+\.[^/.]*$/, "/photos/$1/$2.$3");
		}

		if (domain_nosub === "zmones.lt" &&
			domain.match(/^s[0-9]*\.zmones\.lt/)) {
			// https://s1.zmones.lt/images/photos/2013/05/17/big/kristin-kreuk-4-5195f12f24f9f.jpg
			//   https://s1.zmones.lt/images/photos/2013/05/17/original/kristin-kreuk-4-5195f12f24f9f.jpg
			return src.replace(/(\/images\/photos\/[0-9]+\/[0-9]+\/[0-9]+\/)[a-z]+(\/[^/]*\.[^/.]*)$/, "$1original$2");
		}

		if (domain_nosub === "hsmedia.ru" ||
			// https://n1s1.elle.ru/6d/3f/56/6d3f56ef68895cbd27c169f998836eed/233x350_21_129e4cec96d3dc88c93fb2ca6f2cb0ca@1800x2700_0xc0a83945_15648249151372930841.jpg
			//   https://n1s1.elle.ru/6d/3f/56/6d3f56ef68895cbd27c169f998836eed/1800x2700_0xc0a83945_15648249151372930841.jpg
			domain_nosub === "elle.ru") {
			// http://n1s2.hsmedia.ru/b2/68/53/b268534296034073da54fe199e02fa60/440x660_1_6456fe81c89f61ae8f59b1e4c2c2b338@440x660_0xc0a839a2_10376472071471436248.jpeg
			//   http://n1s2.hsmedia.ru/b2/68/53/b268534296034073da54fe199e02fa60/440x660_0xc0a839a2_10376472071471436248.jpeg
			// http://n1s1.hsmedia.ru/3a/18/5b/3a185b9d81db36aaa6665378971dc501/235x142_21_727a7fd3ae01a11bedf6072aa3db308a@1732x1046_0x0a330ca2_9361423281533279737.jpeg
			//   http://n1s1.hsmedia.ru/3a/18/5b/3a185b9d81db36aaa6665378971dc501/1732x1046_0x0a330ca2_9361423281533279737.jpeg
			return src.replace(/(:\/\/[^/]*\/[0-9a-f]{2}\/[0-9a-f]{2}\/[0-9a-f]{2}\/[0-9a-f]+\/)[0-9]+x[0-9]+_[^/]*@([0-9]+x[0-9]+_[^/]*)$/, "$1$2");
		}

		if (domain_nowww === "starbeat.ru" &&
			string_indexof(src, "/gallery/") >= 0) {
			// http://starbeat.ru/gallery/kristin-kreuk/kristin-kreuk-cw-network-2013-upfront-in-nyc/small/kristin-kreuk---cw-network-2013-upfront-in-nyc--10_Starbeat.ru.jpg
			//   http://starbeat.ru/gallery/kristin-kreuk/kristin-kreuk-cw-network-2013-upfront-in-nyc/kristin-kreuk---cw-network-2013-upfront-in-nyc--10_Starbeat.ru.jpg
			// doesn't work for all:
			// https://starbeat.ru/gallery/kate-upton/kate-upton-2014-sports-illustrated-swimsuit-issue-2014-02-18/small/kate-upton-si-2014-sports-illustrated-swimsuit-issue--11_Starbeat.ru.jpg
			//   https://starbeat.ru/gallery/kate-upton/kate-upton-2014-sports-illustrated-swimsuit-issue-2014-02-18/kate-upton-si-2014-sports-illustrated-swimsuit-issue--11_Starbeat.ru.jpg
			//   article is down: https://starbeat.ru/47541/
			return src.replace(/\/(?:small|medium)\/([^/]*)$/, "/$1");
		}

		if ((domain === "image.kilimall.com" ||
			 // https://d2lpfujvrf17tu.cloudfront.net/uganda/shop/store/goods/788/2017/11/788_05649359385016211_240.jpg
			 domain === "d2lpfujvrf17tu.cloudfront.net") &&
			string_indexof(src, "/shop/store/") >= 0) {
			// https://image.kilimall.com/uganda/shop/store/goods/788/2017/11/788_05649359385016211_240.jpg
			//   https://image.kilimall.com/uganda/shop/store/goods/788/2017/11/788_05649359385016211.jpg
			// https://image.kilimall.com/uganda/shop/store/goods/1008/2018/06/1008_05821550736572452_240.jpg
			//   https://image.kilimall.com/uganda/shop/store/goods/1008/2018/06/1008_05821550736572452.jpg -- 403
			return src.replace(/(\/[0-9]+_[0-9]+)_[0-9]+(\.[^/.]*)$/, "$1$2");
		}

		if (domain_nowww === "zevenmart.com") {
			// https://zevenmart.com/images/stories/virtuemart/category/resized/hombre_0x660.jpg
			//   https://zevenmart.com/images/stories/virtuemart/category/hombre.jpg
			return src.replace(/\/resized\/([^/]*)_[0-9]+x[0-9]+(\.[^/.]*)$/, "/$1$2");
		}

		if (domain_nowww === "superherotv.net" ||
			// http://starsplanet.ru/photo/images_small/selena_gomez_photo_2010/selena_gomes_photo_2010_starsplanet.ru_034.jpg
			//   http://starsplanet.ru/photo/images_large/selena_gomez_photo_2010/selena_gomes_photo_2010_starsplanet.ru_034.jpg
			domain_nowww === "starsplanet.ru") {
			// http://www.superherotv.net/photo/images_small/lyndsy_fonseca/superherotv.net_lyndsy_fonseca_035.jpg -- 150x200
			//   http://www.superherotv.net/photo/images_large/lyndsy_fonseca/superherotv.net_lyndsy_fonseca_035.jpg -- 2809x3750
			return src.replace(/\/photo\/images_small\//, "/photo/images_large/");
		}

		if (domain_nowww === "xxx-photo.com") {
			// https://www.xxx-photo.com/m/photo/t/1704/06/608511/610496-daisy-ridley-wearing-a-green-dress_t.jpg
			//   https://www.xxx-photo.com/m/photo/i/1704/06/608511/610496-daisy-ridley-wearing-a-green-dress.jpg
			// https://www.xxx-photo.com/m/photo/t/1809/02/690000/691985-i-love-her-feet.jpg
			//   https://www.xxx-photo.com/m/photo/i/1809/02/690000/691985-i-love-her-feet.jpg
			return src.replace(/\/photo\/t\/(.*?)(?:_t)?(\.[^/.]*)$/, "/photo/i/$1$2");
		}

		if (domain_nowww === "div.bg" ||
			// https://jenite.bg/pictures/1377128_169_113.jpg
			//   https://jenite.bg/pictures/1377128.jpg
			domain_nowww === "jenite.bg") {
			// http://div.bg/pictures/1638721_886_.jpg
			//   http://div.bg/pictures/1638721.jpg
			return src.replace(/(\/pictures\/[0-9]+)_[0-9]*(?:_[0-9]*)?(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "cdn.hqsluts.com" ||
			// https://www.hqbabes.com/t/3p159968
			//   https://www.hqbabes.com/t/3c159968
			domain_nowww === "hqbabes.com" ||
			// https://c.xme.net/3p159968
			//   https://c.xme.net/3c159968
			domain === "c.xme.net") {
			// http://cdn.hqsluts.com/0p313268
			//   http://cdn.hqsluts.com/0c313268
			return src.replace(/(:\/\/[^/]*\/(?:t\/)?[0-9]+)[a-z]([0-9]+(?:\.[^/.]*)?)$/, "$1c$2");
		}

		if ((domain_nowww === "sensualgirls.org" ||
			 // https://www.deliciousbabes.org/media/pictures/2014-08-10-yui-kawagoe/01_thumb.jpg
			 //   https://www.deliciousbabes.org/media/pictures/2014-08-10-yui-kawagoe/01.jpg
			 domain_nowww === "deliciousbabes.org" ||
			 // https://www.girlsofdesire.org/media/pictures_new/2009/2009-12-07-leopard/03_thumb.jpg
			 //   https://www.girlsofdesire.org/media/pictures_new/2009/2009-12-07-leopard/03.jpg
			 domain_nowww === "girlsofdesire.org") &&
			src.match(/\/media\/pictures(?:_new)?\//)) {
			// https://www.sensualgirls.org/media/pictures/2016-12-05-young-beauty/01_thumb.jpg
			//   https://www.sensualgirls.org/media/pictures/2016-12-05-young-beauty/01.jpg
			return {
				url: src.replace(/(\/[^/.]*)_thumb(\.[^/.]*)$/, "$1$2"),
				headers: {
					Origin: "https://" + domain,
					Referer: "https://" + domain + "/"
				}
			};
		}

		if (domain_nowww === "littlemutt.com") {
			// http://www.littlemutt.com/hosted/kimberspeculum/05_thumb.jpg
			//   http://www.littlemutt.com/hosted/kimberspeculum/05.jpg
			return src.replace(/(\/hosted\/+[^/]+\/+[0-9]+)_thumb(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if ((domain_nosub === "mainbabes.com" && domain.match(/^content[0-9a-z]*\./)) ||
			// https://content4.livejasminbabes.net/zishy.com/0070/tn_01.jpg
			//   https://contenta.livejasminbabes.net/zishy.com/0070/01.jpg
			(domain_nosub === "livejasminbabes.net" && domain.match(/^content[0-9a-z]*\./)) ||
			// https://content8.babesandgirls.com/met-art/1073/tn_01.jpg
			//   https://contenta.babesandgirls.com/met-art/1073/01.jpg
			// https://contenta.babesandgirls.com/ftv-girls/1363/tn_04.jpg
			//   https://contenta.babesandgirls.com/ftv-girls/1363/04.jpg
			(domain_nosub === "babesandgirls.com" && domain.match(/^content[0-9a-z]*\./)) ||
			// https://content6.exgirlfriendmarket.com/digitaldesire.com/1157/tn_02.jpg
			// https://contenta.exgirlfriendmarket.com/digitaldesire.com/1157/tn_01.jpg
			(domain_nosub === "exgirlfriendmarket.com" && domain.match(/^content[0-9a-z]*\./)) ||
			// https://contenta.rossoporn.com/blacked.com/0117/tn_00.jpg
			//   https://contenta.rossoporn.com/blacked.com/0117/00.jpg
			(domain_nosub === "rossoporn.com" && domain.match(/^content[0-9a-z]*\./)) ||
			// https://content6.novostrong.com/vixens.com/0016/tn_02.jpg
			//   https://content6.novostrong.com/vixens.com/0016/02.jpg
			(domain_nosub === "novostrong.com" && domain.match(/^content[0-9a-z]*\./)) ||
			// https://content4.novoporn.com/vixens.com/0018/tn_02.jpg
			//   https://content4.novoporn.com/vixens.com/0018/02.jpg
			(domain_nosub === "novoporn.com" && domain.match(/^content[0-9a-z]*\./)) ||
			// https://content9.silkengirl.com/watch4beauty.com/9842/00.jpg
			(domain_nosub === "silkengirl.com" && /^content[0-9a-z]*\./.test(domain)) ||
			// https://content3.girlsofdesire.org/girlsofdesire.org/pictures_new/2014/2014-07-28-riding-the-anaconda/tn_00.jpg
			//   https://content3.girlsofdesire.org/girlsofdesire.org/pictures_new/2014/2014-07-28-riding-the-anaconda/00.jpg
			(domain_nosub === "girlsofdesire.org" && /^content[0-9a-z]*\./.test(domain)) ||
			// https://content9.babesbang.com/playboy.com/11163/tn_17.jpg
			(domain_nosub === "babesbang.com" && /^content[0-9a-z]*\./.test(domain)) ||
			// https://content4.chickteases.com/zishy.com/0704/tn_00.jpg
			//   https://content4.chickteases.com/zishy.com/0704/00.jpg
			//(domain_nosub === "chickteases.com" && domain.match(/^content[0-9a-z]*\./)) ||
			// https://content6.sexykittenporn.com/thisyearsmodel.com/0611/Aspen_Sucks_a_Lemon_tn_03.jpg
			//   https://content6.sexykittenporn.com/thisyearsmodel.com/0611/Aspen_Sucks_a_Lemon_03.jpg
			(domain && domain.match(/^content[0-9a-z]*\./) && src.match(/^[a-z]+:\/\/[^/]*\/[^/.]*(?:\.[^/.]*)?\/[0-9]{4,}\/(?:[^/]*_)?tn_[0-9]{2}\.[^/.]*(?:[?#].*)?$/)) ||
			// https://content4.thousandbabes.com/thousandbabes.com/penthouse.com/1966/tn_03.jpg
			//   https://content4.thousandbabes.com/thousandbabes.com/penthouse.com/1966/03.jpg
			(domain_nosub === "thousandbabes.com" && domain.match(/^content[0-9a-z]*\./)) ||
			// https://content6.morazzia.com/ftv-girls/0536/tn_01.jpg
			//   https://content6.morazzia.com/ftv-girls/0536/01.jpg
			(domain_nosub === "morazzia.com" && domain.match(/^content[0-9a-z]*\./)) ||
			// https://content6.babesmachine.com/babesmachine.com/mplstudios.com/0924/tn_00.jpg
			//   https://content6.babesmachine.com/babesmachine.com/mplstudios.com/0924/00.jpg
			(domain_nosub === "babesmachine.com" && domain.match(/^content[0-9a-z]*\./)) ||
			// https://content6.glam0ur.com/glam0ur.com/gals/celeste_star/38/tn_00.jpg
			//   https://content6.glam0ur.com/glam0ur.com/gals/celeste_star/38/00.jpg
			(domain_nosub === "glam0ur.com" && domain.match(/^content[0-9a-z]*\./)) ||
			// http://fhg.avidolz.com/Idol_Collection_Mio_Kanna/gravure/scene1a/avidolz_tn_01.jpg
			//   http://fhg.avidolz.com/Idol_Collection_Mio_Kanna/gravure/scene1a/avidolz_01.jpg
			domain_nosub === "avidolz.com" ||
			// https://ca.pbabes.com/ftvgirls/0757/tn_01.jpg
			//   https://ca.pbabes.com/ftvgirls/0757/01.jpg
			domain_nosub === "pbabes.com" ||
			// https://static.thenude.eu/admin/galleries/616166/tn_2.jpg?ver=1500657394
			//   https://static.thenude.eu/admin/galleries/616166/2.jpg?ver=1500657394
			(domain === "static.thenude.eu" && string_indexof(src, "/galleries/") >= 0) ||
			// https://eros-and-grace.net/galleries/cosmid/2016-06/eva-green/tn_01.jpg
			//   https://eros-and-grace.net/galleries/cosmid/2016-06/eva-green/01.jpg
			(domain_nowww === "eros-and-grace.net" && string_indexof(src, "/galleries/") >= 0) ||
			// http://gals.sextronix.com/slovakteensclub/pic/56/tn_01.jpg
			//   http://gals.sextronix.com/slovakteensclub/pic/56/01.jpg
			domain === "gals.sextronix.com" ||
			// https://fhg.baberotica.com/Nia_Nacci/03/hard/baberotica_tn_01.jpg
			//   https://fhg.baberotica.com/Nia_Nacci/03/hard/baberotica_01.jpg
			domain === "fhg.baberotica.com" ||
			// http://pornodontstop.com/gallery/fucasvz/7980/tn_002.jpg
			//   http://pornodontstop.com/gallery/fucasvz/7980/002.jpg
			domain_nosub === "pornodontstop.com") {
			// https://content8.mainbabes.com/amourangels.com/1122/tn_00.jpg
			//   https://content8.mainbabes.com/amourangels.com/1122/00.jpg
			newsrc = src.replace(/(\/(?:[^/]*_)?)tn_([0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1$2");
			if (newsrc !== src)
				return newsrc;

			if (domain_nosub === "novoporn.com" ||
				domain_nosub === "silkengirl.com" ||
				// https://content9.babesbang.com/playboy.com/11163/17.jpg -- 819x546
				//   https://content3.babesbang.com//playboy.com/11163/orig_17.jpg -- 1920x1280
				domain_nosub === "babesbang.com" ||
				// https://content3.morazzia.com/ftv-milfs/0528/00.jpg -- 681x1024
				//   https://content3.morazzia.com/ftv-milfs/0528/orig_00.jpg -- 1064x1600
				domain_nosub === "morazzia.com") {
				// thanks to jedikalimero on github: https://github.com/qsniyg/maxurl/issues/1095
				// https://content3.novoporn.com/met-art.com/48043/00.jpg -- 682x1024
				//   https://content3.novoporn.com/met-art.com/48043/orig_00.jpg -- 1363x2048
				// https://content3.novoporn.com/newsensations.com/4354/02.jpg -- 818x546
				//   https://content3.novoporn.com/newsensations.com/4354/orig_02.jpg -- 2500x1668
				// https://content9.silkengirl.com/watch4beauty.com/9842/00.jpg -- 1920x1280
				//   https://content3.silkengirl.com//watch4beauty.com/9842/orig_00.jpg -- 1920x1280
				// https://content3.silkengirl.com/rylskyart.com/4352/03.jpg -- 1024x704
				//   https://content3.silkengirl.com/rylskyart.com/4352/orig_03.jpg -- same
				return src.replace(/(\/[0-9]+\/+)([0-9]+\.)/, "$1orig_$2");
			}
		}

		if (domain_nowww === "phun.org") {
			// thanks to vscum on github: https://github.com/qsniyg/maxurl/issues/1166
			// https://www.phun.org/galleries/slut_tumblr/images/tn_yahoo_stock.jpg
			//   https://www.phun.org/galleries/slut_tumblr/images/yahoo_stock.jpg
			return src.replace(/(\/galleries\/.*\/images\/+)tn_/, "$1");
		}

		if (domain_nosub === "livejasminbabes.net" && domain.match(/^content[0-9]*\./)) {
			// https://content6.livejasminbabes.net/upload/main/tn/8/3603785.jpg
			//   https://content6.livejasminbabes.net/upload/main/8/3603785.jpg
			return src.replace(/\/upload\/main\/tn\//, "/upload/main/");
		}

		if (domain === "static.thenude.eu") {
			// https://static.thenude.eu/admin/covers/cosmid/16-01/thumbs/01-18.Eva-Green-in-Eva-Greens-First-Set.jpg
			//   https://static.thenude.eu/admin/covers/cosmid/16-01/01-18.Eva-Green-in-Eva-Greens-First-Set.jpg
			// https://static.thenude.eu/admin/covers/atkgalleria/16-11/medheads/11-05-5.Karlie-Brooks-in-BABES-SERIES-3.jpg
			//   https://static.thenude.eu/admin/covers/atkgalleria/16-11/11-05-5.Karlie-Brooks-in-BABES-SERIES-3.jpg
			return src.replace(/(\/admin\/+covers\/+.*\/+)(?:thumbs|medheads)\/+/, "$1");
		}

		if ((domain_nowww === "captaingoodlink.com" && string_indexof(src, "/celebrities/") >= 0) ||
			// http://nudecelebs-a-z.com/07/LilyAllen/tn_image2_extralarge_1389984877354.jpg
			//   http://nudecelebs-a-z.com/07/LilyAllen/image2_extralarge_1389984877354.jpg
			domain_nowww === "nudecelebs-a-z.com" ||
			// http://www.poseposter.com/arielrebel/bathtub/tn_pics01.jpg
			//   http://www.poseposter.com/arielrebel/bathtub/pics01.jpg
			domain_nowww === "poseposter.com" ||
			// https://cdn-w.tacamateurs.com/tgps/0028/28141/wet-look-cat-suit--heels/tn_pic06.jpg
			//   https://cdn-w.tacamateurs.com/tgps/0028/28141/wet-look-cat-suit--heels/pic06.jpg
			(domain_nosub === "tacamateurs.com" && domain.match(/^cdn(?:-[^/]*)?\./) && src.match(/\/tn_pic[0-9]+\./))) {
			// http://captaingoodlink.com/celebrities/emma_watson/tn_emma_watson_0062.jpg
			//   http://captaingoodlink.com/celebrities/emma_watson/emma_watson_0062.jpg
			return src.replace(/\/tn_([^/]*\.[^/.]*)(?:[?#].*)?$/, "/$1");
		}

		if (domain_nosub === "pornodontstop.com" ||
			// http://hosted.amourangels.com/sexyteenicecream/4064/th_99485.jpg
			//   http://hosted.amourangels.com/sexyteenicecream/4064/99485.jpg
			domain === "hosted.amourangels.com" ||
			// http://hornyteen.pro/g/3423bd/th_01.jpg
			//   http://hornyteen.pro/g/3423bd/01.jpg
			domain_nowww === "hornyteen.pro" ||
			// http://theasianpics.com/gallery/Mature_Korean_Lady/th_4.jpg
			//   http://theasianpics.com/gallery/Mature_Korean_Lady/4.jpg
			domain_nowww === "theasianpics.com" ||
			// http://www.teenporngallery.net/playful-girlfriends/5047/th_001.jpg
			//   http://www.teenporngallery.net/playful-girlfriends/5047/001.jpg
			domain_nowww === "teenporngallery.net" ||
			// http://asiangalleries.net/gallery/Korean_office_girl/th_12.jpg
			//   http://asiangalleries.net/gallery/Korean_office_girl/12.jpg
			domain_nowww === "asiangalleries.net" ||
			// http://chinesepornpics.com/gallery/Favorite_fap_pics./th_1.jpg
			//   http://chinesepornpics.com/gallery/Favorite_fap_pics./1.jpg
			domain_nowww === "chinesepornpics.com" ||
			// http://asianteenpictures.com/gallery/Sexy_Asian_Girls_2/th_31.jpg
			//   http://asianteenpictures.com/gallery/Sexy_Asian_Girls_2/31.jpg
			domain_nowww === "asianteenpictures.com" ||
			// http://japanesegirlspictures.com/gallery/Asian_Sensations_6/th_44.jpg
			//   http://japanesegirlspictures.com/gallery/Asian_Sensations_6/44.jpg
			domain_nowww === "japanesegirlspictures.com" ||
			// http://koreanpornpictures.com/gallery/ASIAN/th_43.jpg
			//   http://koreanpornpictures.com/gallery/ASIAN/43.jpg
			domain_nowww === "koreanpornpictures.com" ||
			// http://sexyasians.net/gallery/Asians752/th_27.jpg
			//   http://sexyasians.net/gallery/Asians752/27.jpg
			domain_nowww === "sexyasians.net" ||
			// http://www.maturexxxpics.net/images/00f6e6/th_01.jpg
			//   http://www.maturexxxpics.net/images/00f6e6/01.jpg
			domain_nowww === "maturexxxpics.net" ||
			// http://japxxx.pro/dt2/xxx/5e1970/th_06.jpg
			//   http://japxxx.pro/dt2/xxx/5e1970/06.jpg
			domain_nowww === "japxxx.pro" ||
			// http://girlsnudepussy.com/dt2/nude/787c05/th_01.jpg
			//   http://girlsnudepussy.com/dt2/nude/787c05/01.jpg
			domain_nowww === "girlsnudepussy.com" ||
			// http://hornybabepics.com/gallery/ade4e8/th_01.jpg
			//   http://hornybabepics.com/gallery/ade4e8/01.jpg
			domain_nowww === "hornybabepics.com" ||
			// http://hosted.showybeauty.com/nakedcutieheadphones/3449/th_001.jpg
			//   http://hosted.showybeauty.com/nakedcutieheadphones/3449/001.jpg
			domain === "hosted.showybeauty.com" ||
			// http://www.sexyhairyvagina.com/galleries/wah/03r/a83a43/th_01.jpg
			//   http://www.sexyhairyvagina.com/galleries/wah/03r/a83a43/01.jpg
			domain_nowww === "sexyhairyvagina.com" ||
			// http://pronpic.org/pic/2021/06/18/th_6688151.jpg
			//   http://pronpic.org/pic/2021/06/18/6688151.jpg
			domain_nowww === "pronpic.org" ||
			// http://teengalleries.mobi/g/d55bf2/th_02.jpg
			//   http://teengalleries.mobi/g/d55bf2/02.jpg
			domain_nowww === "teengalleries.mobi") {
			// http://pornodontstop.com/gallery/aangels/nelly-juicy-nude-body/th_002.jpg
			//   http://pornodontstop.com/gallery/aangels/nelly-juicy-nude-body/002.jpg
			return src.replace(/\/th_([0-9]+\.[^/.]*)$/, "/$1");
		}

		if (domain === "i.girlstop.info" ||
			// http://girlstop-extra.info/cat/posts/1tyo/thumbs/366px_p.jpg
			//   http://girlstop-extra.info/cat/posts/1tyo/p.jpg
			domain_nosub === "girlstop-extra.info" ||
			// http://www.girlstop.info/cat/posts/54a8ab7cb6dfd/thumbs/450px_3.jpg
			//   http://www.girlstop.info/cat/posts/54a8ab7cb6dfd/3.jpg
			domain_nosub === "girlstop.info") {
			// http://i.girlstop.info/cat/posts/58bfcf7f0e7eb9.60090633/thumbs/450px_1.jpg
			//   http://i.girlstop.info/cat/posts/58bfcf7f0e7eb9.60090633/1.jpg
			return src.replace(/\/thumbs\/+[0-9]+px_([^/]*)$/, "/$1");
		}

		if (domain === "photos.freeones.com") {
			// https://photos.freeones.com/v_various/FTV_Girls/Alex_Grey_001/Alex-Grey-nude-in-public(1).jpg
			//   https://photos.freeones.com/v_various/FTV_Girls/Alex_Grey_001/images/Alex-Grey-nude-in-public(1).jpg
			return src.replace(/(:\/\/[^/]*\/[^/]*_[^/]*\/+[^/]*\/+[^/]*\/+)([^/]*)(?:[?#].*)?$/, "$1images/$2");
		}

		if (domain === "cdn.freeones.com" ||
			// https://media.freeones.com/freeones-photo-generated/wC/Zx/w9oLy8nC6DBJfLZLQB/Hot-Erika-Devine-gets-plowed-by-a-big-black-Cock_003_preview.jpg
			//   https://media.freeones.com/freeones-photo-generated/wC/Zx/w9oLy8nC6DBJfLZLQB/Hot-Erika-Devine-gets-plowed-by-a-big-black-Cock_003_ultra.jpg
			domain === "media.freeones.com") {
			// https://cdn.freeones.com/photo-ce1/Ub/ky/oBeS2Yj7Jc2WaKMLge/Alina-Lopez-spreads-tight-wet-Pussy-for-hard-Cock_001_preview.jpg
			//   https://cdn.freeones.com/photo-ce1/Ub/ky/oBeS2Yj7Jc2WaKMLge/Alina-Lopez-spreads-tight-wet-Pussy-for-hard-Cock_001_big.jpg
			return src
				.replace(/(\/(?:photo-[^/]+|freeones-photo-generated)\/+.*)_big(\.[^/.]+)(?:[?#].*)?$/, "$1_ultra$2")
				.replace(/(\/(?:photo-[^/]+|freeones-photo-generated)\/+.*)_preview(\.[^/.]+)(?:[?#].*)?$/, "$1_big$2");
		}

		if (domain_nosub === "freeones.com" && /img\./.test(domain)) {
			// https://img.freeones.com/images/freeones/pinned_pictures/pin/0429/55117.gif
			//   https://img.freeones.com/images/freeones/pinned_pictures/original/0429/55117.gif
			newsrc = src.replace(/\/pinned_pictures\/pin\//, "/pinned_pictures/original/");
			if (newsrc !== src)
				return newsrc;

			match = src.match(/^[a-z]+:\/\/[^/]+\/+videos\/+([0-9]{3}\/+[0-9a-zA-Z]{2}\/+[0-9a-zA-Z]{2}\/+[^/]{10,}\/+)(?:poster)\/+/);
			if (match) {
				return [
					{
						url: "https://videolb.freeones.com/fo/" + match[1] + "list.smil/playlist.m3u8",
						video: "hls"
					},
					{
						url: "https://videolb.freeones.com/fo/" + match[1] + "list.smil/manifest.mpd",
						video: "dash"
					}
				];
			}

			// https://img.freeones.com/photos/001/7a/97/7A97R5ULZhkDdKwojfW9if/preview/7521debd-07a7-49ec-977d-94d878b59e1b.jpg
			//   https://img.freeones.com/photos/001/7a/97/7A97R5ULZhkDdKwojfW9if/big/7521debd-07a7-49ec-977d-94d878b59e1b.jpg
			// https://us-img.freeones.com/photos/001/ka/w7/kaw7RaL8Q2wKpTuLzDrU2Q/preview/68d794b5-3a4a-44bf-9cd3-c00eb6fc39fd.jpg
			//   https://us-img.freeones.com/photos/001/ka/w7/kaw7RaL8Q2wKpTuLzDrU2Q/big/68d794b5-3a4a-44bf-9cd3-c00eb6fc39fd.jpg
			// https://img.freeones.com/photos/001/j8/t2/j8T2X9wbtxh6uvWswMKKQT/teaser/b053d9ad-be0b-43c5-a42a-07f5ccc96f89.jpg
			//   https://img.freeones.com/photos/001/j8/t2/j8T2X9wbtxh6uvWswMKKQT/big/b053d9ad-be0b-43c5-a42a-07f5ccc96f89.jpg
			return src.replace(/(\/photos\/+[0-9]{3}\/+[0-9a-zA-Z]{2}\/+[0-9a-zA-Z]{2}\/+[^/]{10,}\/+)(?:preview|teaser)\/+/, "$1big/");
		}

		if (domain === "videolb.freeones.com") {
			// https://videolb.freeones.com/fo//003/yt/8n/yt8nwwAK3yudL5T2fzRJiW/trailerWebM.webm
			match = src.match(/^[a-z]+:\/\/[^/]+\/+fo\/+([0-9]{3}\/+[0-9a-zA-Z]{2}\/+[0-9a-zA-Z]{2}\/+[^/]{10,}\/+)(?:trailerWebM)\./);
			if (match) {
				return [
					{
						url: "https://videolb.freeones.com/fo/" + match[1] + "list.smil/playlist.m3u8",
						video: "hls"
					},
					{
						url: "https://videolb.freeones.com/fo/" + match[1] + "list.smil/manifest.mpd",
						video: "dash"
					}
				];
			}
		}

		if (domain_nowww === "freeones.com") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+video\/+([-a-z0-9]+)\/*(?:[?#].*)?$/,
				query_for_id: "https://www.freeones.com/video/${id}",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/loadFOPlayer\(.*?({\s*\n[\s\S]*?})\);\s*\n/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					var json_text = fixup_js_obj(match[1]);
					var json = JSON_parse(json_text);

					var urls = [];
					array_foreach(json.src, function(url) {
						var video:VideoProp = true;

						if (url.type === "application/x-mpegURL") {
							video = "hls";
						} else if (url.type === "application/dash+xml") {
							video = "dash";
						} else if (url.type === "video/mp4") {
							video = true;
						} else {
							console_warn(cache_key, "Unsupported video type", url);
							return;
						}

						urls.push({
							url: url.src,
							video: video
						});
					});

					urls.push(json.poster);

					var obj = {
						extra: {
							page: resp.finalUrl,
							caption: json.chromecast.metadata.title
						}
					};

					return done(fillobj_urls(urls, obj), 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (host_domain_nowww === "freeones.com") {
			newsrc = common_functions["get_pagelink_host_el_matching"](options, {
				url_match: /^[a-z]+:\/\/[^/]+\/+video\/+([-a-z0-9]+)\/*(?:[?#].*)?$/,
				el_match: function(x) {
					return x.tagName === "DIV" && x.classList.contains("player");
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "starspics.ru" ||
			// http://otherstars.ru/thumbs/2018-07/04/i4t4of06zdfa1un0t7vqsukf2.jpg
			//   http://otherstars.ru/img/2018-07/04/i4t4of06zdfa1un0t7vqsukf2.jpg
			domain_nowww === "otherstars.ru") {
			// http://starspics.ru/thumbs/2016-10/11/g4hd7ipoglpzy5tcitoip2fze.jpg
			//   http://starspics.ru/img/2016-10/11/g4hd7ipoglpzy5tcitoip2fze.jpg
			return src.replace(/(:\/\/[^/]*\/)thumbs\//, "$1img/");
		}

		if (domain === "images.apina.biz") {
			// https://images.apina.biz/thumbs/t_166714.jpg
			//   https://images.apina.biz/medium/m_166714.jpg
			//   https://images.apina.biz/full/166714.jpg
			return src.replace(/(:\/\/[^/]*\/)[a-z]+\/[a-z]+_([0-9]+\.[^/.]*)$/, "$1full/$2");
		}

		if (domain_nowww === "wallpaperaccess.com") {
			// thanks to anonymous for reporting:
			// https://wallpaperaccess.com/thumb/2518969.jpg
			//   https://wallpaperaccess.com/full/2518969.jpg
			return src.replace(/\/thumb\/+([0-9]+\.)/, "/full/$1");
		}

		if (domain_nowww === "pluska.sk" ||
			// http://www1.casopiszdravie.sk/thumb/images/gallery/fotoreportaz/2009/12/emma-watson/14z.jpg?w=240&h=1000
			//   http://www1.casopiszdravie.sk/images/gallery/fotoreportaz/2009/12/emma-watson/14z.jpg
			domain_nosub === "casopiszdravie.sk") {
			// https://www.pluska.sk/thumb/images/emma/krasna/emma-watson-zmenila-imidz-neuverite-co-spravila-so-svojimi-vlasmi/profimedia-0304405320.jpg?w=220&h=220&ip=6
			//   https://www.pluska.sk/images/emma/krasna/emma-watson-zmenila-imidz-neuverite-co-spravila-so-svojimi-vlasmi/profimedia-0304405320.jpg?w=220&h=220&ip=6
			//   https://www.pluska.sk/images/emma/krasna/emma-watson-zmenila-imidz-neuverite-co-spravila-so-svojimi-vlasmi/profimedia-0304405320.jpg
			return src.replace(/\/thumb\/images\/(.*?)(?:[?#].*)?$/, "/images/$1");
		}

		if (domain_nowww === "mad-movies.com") {
			// https://www.mad-movies.com/98-132-0-images/MM_PersonsPhotos/2DN3Hi8AxyiUClzCun7ANG3YBhS.jpg
			//   https://www.mad-movies.com/images/MM_PersonsPhotos/2DN3Hi8AxyiUClzCun7ANG3YBhS.jpg
			return src.replace(/(:\/\/[^/]*\/)[0-9]+-[0-9]+-[0-9]+-images\//, "$1images/");
		}

		if (domain === "assets.mycast.io") {
			// https://assets.mycast.io/actors/6730_tiny.jpg?1518685234
			//   https://assets.mycast.io/actors/6730_original.jpg?1518685234
			return src.replace(/(\/[0-9]+)_[a-z]+(\.[^/.]*)$/, "$1_original$2");
		}

		if (domain === "cdn.cinemur.fr") {
			// https://cdn.cinemur.fr/persons/cache/225x225_109475.jpg
			//   https://cdn.cinemur.fr/persons/original/109475.jpg
			// http://cdn.cinemur.fr/movies/blur/234885.jpg
			//   http://cdn.cinemur.fr/movies/original/234885.jpg
			return src.replace(/(?:\/cache\/[0-9]+x[0-9]+_|\/blur\/)([0-9]+\.[^/.]*)$/, "/original/$1");
		}

		if (domain_nowww === "farfarawaysite.com") {
			// http://www.farfarawaysite.com/temple/m-m/maisiesell/shoots1/hires/t/19.jpg
			//   http://www.farfarawaysite.com/temple/m-m/maisiesell/shoots1/hires/19.jpg
			return src.replace(/\/hires\/t\//, "/hires/");
		}

		if (domain === "movieplayer.net-cdn.it" ||
			// https://d17vsf20mehj1i.cloudfront.net/29665_20121009T184136_0_jpg_300x400_q85.jpg
			//   https://d17vsf20mehj1i.cloudfront.net/29665_20121009T184136_0.jpg
			domain === "d17vsf20mehj1i.cloudfront.net" ||
			// https://multiplayer.net-cdn.it/thumbs/images/2017/11/15/the-game-awards-2017-trailer-logo_jpg_1400x0_q85.jpg
			//   https://multiplayer.net-cdn.it/images/2017/11/15/the-game-awards-2017-trailer-logo.jpg
			// https://multiplayer.net-cdn.it/thumbs/images/2017/03/11/legow1_jpg_800x0_crop_upscale_q85.jpg
			//   https://multiplayer.net-cdn.it/images/2017/03/11/legow1.jpg
			domain === "multiplayer.net-cdn.it") {
			// https://movieplayer.net-cdn.it/t/images/2016/06/24/maisierichardsonse_3142640b_jpg_363x200_crop_q85.jpg
			//   https://movieplayer.net-cdn.it/images/2016/06/24/maisierichardsonse_3142640b.jpg
			return src.replace(/(?:\/(?:thumbs|t))?(\/+images\/.*?|:\/\/[^/]*\/[^/]*)_([a-z]+)_(?:[0-9]+x[0-9]+_)?(?:crop_)?(?:upscale_)?(?:q[0-9]+)?(\.[^/.]*)$/, "$1.$2");
		}

		if (domain === "u.livelib.ru") {
			// https://u.livelib.ru/album/1000007170/m/lggajq57/dbstatic.no-m.jpg
			//   https://u.livelib.ru/album/1000007170/o/lggajq57/o-o.jpeg
			return src
				.replace(/\/[a-z](\/[a-z0-9]+\/)[^/]*(\.[^/.]*)$/, "/o$1o-o$2")
				.replace(/\.jpg(\?.*)?$/, ".jpeg$1");
		}

		if (domain_nosub === "celebsnetworth.org") {
			// https://movies.celebsnetworth.org/main/thumbs/3918035_Zendaya.jpg
			//   https://movies.celebsnetworth.org/main/images/3918035_Zendaya.jpg
			return src.replace(/(:\/\/[^/]*\/main\/)thumbs\//, "$1images/");
		}

		if (domain === "file.hstatic.net") {
			// https://file.hstatic.net/1000162927/file/zendaya-feet-2287006_grande.jpg
			//   https://file.hstatic.net/1000162927/file/zendaya-feet-2287006.jpg
			return src.replace(/(\/file\/[^/]*-[0-9]+)_[a-z]+(\.[^/.]*)$/, "$1$2");
		}

		if (domain === "sm.askmen.com") {
			// https://sm.askmen.com/t/askmen_pt/photo/default/zendaya-mj_y5jx.640.jpg
			//   https://sm.askmen.com/askmen_pt/photo/default/zendaya-mj_y5jx.jpg
			return src.replace(/(:\/\/[^/]*\/)t\/(.*\/[^/]*)\.[0-9]+(\.[^/.]*)$/, "$1$2$3");
		}

		if (domain_nosub === "elsiglodetorreon.com.mx" && /^media[0-9]*\./.test(domain)) {
			// https://media22.elsiglodetorreon.com.mx/ni/2019/02/1147241.400.jpg
			//   https://www.elsiglodetorreon.com.mx/m/i/2019/02/1147241.jpeg
			newsrc = src.replace(/:\/\/[^/]*\/+(n?[a-z]\/+)/, "://www.elsiglodetorreon.com.mx/m/$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nowww === "elsiglodetorreon.com.mx" ||
			// https://www.siglo.mx/coahuila/m/ni/2019/02/876684.300.jpg
			//   https://www.siglo.mx/coahuila/m/i/2019/02/876684.jpeg
			domain_nowww === "siglo.mx") {
			// https://www.elsiglodetorreon.com.mx/m/ni/2018/08/1086642.300.jpg
			//   https://media22.elsiglodetorreon.com.mx/i/2018/08/1086642.jpeg
			//   https://www.elsiglodetorreon.com.mx/m/i/2018/08/1086642.jpeg
			// https://www.elsiglo.mx/m/ng/2017/05/27273259.800.jpg
			newsrc = src
				.replace(/(:\/\/[^/]*\/+(?:[^/]*\/+)?m\/+)ni\/+(.*\/[0-9]+)\.[0-9]+(\.[^/.]*)$/,
						 "$1i/$2$3");
			if (newsrc !== src)
				return newsrc
					//.replace(/:\/\/[^/]*elsiglodetorreon\.com\.mx\//, "://media22.elsiglodetorreon.com.mx/")
					.replace(/\.jpg(\?.*)?$/, ".jpeg$1");
		}

		if (domain_nowww === "elsiglo.mx") {
			// https://www.elsiglo.mx/m/g/2017/05/27273259_m.jpeg
			//   https://www.elsiglo.mx/m/g/2017/05/27273259.jpeg
			// https://www.elsiglo.mx/m/ng/2017/05/27273259.800.jpg
			//   https://www.elsiglo.mx/m/g/2017/05/27273259.jpeg
			return src
				.replace(/(:\/\/[^/]*\/m\/)n([a-z]\/.*\/[0-9]+)\.[0-9]+(\.[^/.]*)$/,
						 "$1$2$3")
				.replace(/(\/[0-9]+)_[a-z](\.[^/.]*)$/, "$1$2")
				.replace(/\.jpg(\?.*)?$/, ".jpeg$1");
		}

		if (domain === "img.richestcelebrities.org" ||
			// https://celebritypictures.wiki/thumbs/2851530/2851530_1.jpeg
			//   https://celebritypictures.wiki/images/2851530/2851530_1.jpeg
			domain_nowww === "celebritypictures.wiki" ||
			// https://img.networthpost.org/thumbs/282575_kim-floor/282575_kim-floor_1.jpeg
			//   https://img.networthpost.org/images/282575_kim-floor/282575_kim-floor_1.jpeg
			domain === "img.networthpost.org" ||
			// http://thefappeningpics.com/thumbs/Bella-Thorne-Sexy-1-1.jpg
			//   http://thefappeningpics.com/images/Bella-Thorne-Sexy-1-1.jpg
			domain_nowww === "thefappeningpics.com") {
			// http://img.richestcelebrities.org/thumbs/5154_lucy-liu/5154_lucy-liu_1.jpeg
			//   http://img.richestcelebrities.org/images/5154_lucy-liu/5154_lucy-liu_1.jpeg
			return src.replace(/(:\/\/[^/]*\/)thumbs\//, "$1images/");
		}

		if (domain_nowww === "fashionscene.nl") {
			// https://www.fashionscene.nl/ckfinder/userfiles/images/Fashionscene/Beelden%202014/juni/Tess%20Duinker(1)_thumb_743x743.jpg
			//   https://www.fashionscene.nl/ckfinder/userfiles/images/Fashionscene/Beelden%202014/juni/Tess%20Duinker(1).jpg
			return src.replace(/_thumb_[0-9]+x[0-9]+(\.[^/.]*)$/, "$1");
		}

		if (domain_nowww === "monitor.bg") {
			// https://www.monitor.bg/web/files/articles/94270/gallery/thumb_480x0_rihanna.jpg
			//   https://www.monitor.bg/web/files/articles/94270/gallery/rihanna.jpg
			return src.replace(/\/gallery\/thumb_[0-9]+x[0-9]+_([^/]*)$/, "/gallery/$1");
		}

		if (domain_nowww === "textilwirtschaft.de" ||
			// https://www.fashionmagazine.it/gallery/media/4383/166583-detailp.jpeg
			//   https://www.fashionmagazine.it/gallery/media/4383/166583.jpeg
			domain_nowww === "fashionmagazine.it") {
			// https://www.textilwirtschaft.de/gallery/media/9940/182251-detailp.jpeg
			//   https://www.textilwirtschaft.de/gallery/media/9940/182251.jpeg
			return src.replace(/(\/gallery\/media\/[0-9]+\/[0-9]+)-[a-z]+(\.[^/.]*)$/, "$1$2");
		}

		if (domain_nowww === "horizont.net" && string_indexof(src, "/media/") >= 0) {
			// https://www.horizont.net/news/media/9/--85650-detail.jpeg
			//   https://www.horizont.net/news/media/9/--85650.jpeg
			// https://www.horizont.net/news/media/9/Peter-Krause-Foto-Triplesense-88166-detail.jpeg
			//   https://www.horizont.net/news/media/9/Peter-Krause-Foto-Triplesense-88166.jpeg
			return src.replace(/(-[0-9]+)-[a-z]+(\.[^/.]*)$/, "$1$2");
		}

		if (domain === "twproxy.stiletto.fr") {
			// http://twproxy.stiletto.fr/2h319489/w600/www.stiletto.fr/uploads/pictures/2016/05/rihanna_red001.jpg
			//   http://www.stiletto.fr/uploads/pictures/2016/05/rihanna_red001.jpg
			return src.replace(/^[a-z]+:\/\/[^/]*\/[0-9a-z]+\/[wh][0-9]+\//, "http://");
		}

		if (domain_nowww === "we123.com") {
			// http://www.we123.com/img/p.php?p=http://mmbiz.qpic.cn/mmbiz_jpg/mic8pHL2lAewRjSSd4ZLYyNDXHVsgicPb1NGiap4iaBPmZgdxTn02bS0skuDDoIiaRJcNzfUj67gaKMqpvsVVdB6yJw/0?wx_fmt=jpeg -- text/html
			//   http://mmbiz.qpic.cn/mmbiz_jpg/mic8pHL2lAewRjSSd4ZLYyNDXHVsgicPb1NGiap4iaBPmZgdxTn02bS0skuDDoIiaRJcNzfUj67gaKMqpvsVVdB6yJw/0?wx_fmt=jpeg
			return decodeURIComponent(src.replace(/^[a-z]+:\/\/[^/]*\/img\/p\.php.*?[?&]p=([^&]*).*?$/, "$1"));
		}

		if (domain_nosub === "vagalume.com" && /^s[0-9]*\./.test(domain)) {
			// https://s2.vagalume.com/rihanna/images/112365w260.jpg
			//   https://s2.vagalume.com/rihanna/images/112365.jpg
			// https://s2.vagalume.com/selena-gomez/images/g121771w200.jpg
			//   https://s2.vagalume.com/selena-gomez/images/g121771.jpg
			return src.replace(/(\/images\/g?[0-9]+)[wh][0-9]+(\.[^/.]*)$/, "$1$2");
		}

		if (domain_nosub === "glanacion.com" && domain.match(/^bucket[0-9]*\./)) {
			// https://bucket1.glanacion.com/anexos/fotos/62/2834262w380.jpg
			//   https://bucket1.glanacion.com/anexos/fotos/62/2834262.jpg
			return src.replace(/(\/fotos\/+[0-9]+\/+[0-9]+)[wh][0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "storage.gra1.cloud.ovh.net" &&
			src.match(/\/Futurenet[^/]*Images\//)) {
			// https://storage.gra1.cloud.ovh.net/v1/AUTH_b28011873a5246aa8e71be0a276335cc/Futurenet%20Images/2d10134db57f7b765011bbf4b3014a3b56fedadd8f75c5e308bdc8ff6c0c6e9f1737426abafe9fceedbb1a66e0126acc464ec8c731c18ccc81851b5804e9c208/8fb6fffcf916c06919436c6395413119328e6cce21e1947aef33498a1be545cc47efaf0010ebbecacabfc992af77044b682703261564da50d15dcca5ee6ab6f1/ce10e6bd025ad8fbe55adb7cafe41dcfaa0b2815b7637689dae71dada276e6919feea97a7291a5dab16e69c6d1cea6b6f0d90d766696086ef185a79cb56ecad8/c57528adb699c3718764a51d6fe8f19d93f175ef299ac2508b12781b169c3aa6e5a1d9561771f63e2debb0a12c4c7769642d3113b61ad072b6db1bde9542e93a_640x480
			//   https://storage.gra1.cloud.ovh.net/v1/AUTH_b28011873a5246aa8e71be0a276335cc/Futurenet%20Images/2d10134db57f7b765011bbf4b3014a3b56fedadd8f75c5e308bdc8ff6c0c6e9f1737426abafe9fceedbb1a66e0126acc464ec8c731c18ccc81851b5804e9c208/8fb6fffcf916c06919436c6395413119328e6cce21e1947aef33498a1be545cc47efaf0010ebbecacabfc992af77044b682703261564da50d15dcca5ee6ab6f1/ce10e6bd025ad8fbe55adb7cafe41dcfaa0b2815b7637689dae71dada276e6919feea97a7291a5dab16e69c6d1cea6b6f0d90d766696086ef185a79cb56ecad8/c57528adb699c3718764a51d6fe8f19d93f175ef299ac2508b12781b169c3aa6e5a1d9561771f63e2debb0a12c4c7769642d3113b61ad072b6db1bde9542e93a -- 800x953
			return src.replace(/_[0-9]+x[0-9]+(\?.*)?$/, "$1");
		}

		if (domain === "iasbh.tmgrup.com.tr") {
			// https://iasbh.tmgrup.com.tr/4a8eed/0/0/0/0/0/0?u=http://i.sabah.com.tr/sb/fotohaber/magazin/rihanna-star-trekle-nasil-tanisti/19.jpg&mw=752&mh=700
			//   http://i.sabah.com.tr/sb/fotohaber/magazin/rihanna-star-trekle-nasil-tanisti/19.jpg
			return decodeURIComponent(src.replace(/^[a-z]+:\/\/[^/]*\/[0-9a-f]+\/(?:[0-9]+\/){5}[0-9]+.*?[?&]u=([^&]*).*?$/,"$1"));
		}

		if (domain === "i.sabah.com.tr") {
			// http://i.sabah.com.tr/sb/galeri/magazin/dunyanin-en-seksi-100-kadini-522832279730/73jamiechung_s.jpg
			//   http://i.sabah.com.tr/sb/galeri/magazin/dunyanin-en-seksi-100-kadini-522832279730/73jamiechung.jpg
			// http://i.sabah.com.tr/sb/fotohaber/magazin/ceyda-sabah-coskun-sabah-ayriliginin-nedeni-ortaya-cikti/1_d.jpg
			//   http://i.sabah.com.tr/sb/fotohaber/magazin/ceyda-sabah-coskun-sabah-ayriliginin-nedeni-ortaya-cikti/1.jpg
			return src.replace(/(\/sb\/+[^/]*\/+magazin\/+[^/]*\/+[^/]*)_[a-z](\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "bideew.com") {
			// https://www.bideew.com/photos/thumbnail/274324/large/
			//   https://www.bideew.com/photos/thumbnail/274324/master/
			return src.replace(/(\/photos\/thumbnail\/[0-9]+\/)[a-z]+(\/*)(\?.*)?$/, "$1master$2$3");
		}

		if (domain === "media.filfan.com") {
			// https://media.filfan.com/NewsPics/FilfanNew/medium/AMRFOUADE_181.jpg
			//   https://media.filfan.com/NewsPics/FilfanNew/original/AMRFOUADE_181.jpg
			return src.replace(/(\/NewsPics\/[^/]*\/)[a-z]+(\/[^/]*)$/, "$1original$2");
		}

		if (domain_nowww === "ana.rs") {
			// https://www.ana.rs/forum/thumbs/img.php?src=https%3A%2F%2Fencrypted-tbn2.gstatic.com%2Fimages%3Fq%3Dtbn%3AANd9GcR7sIQUM-nZmJnjBnexRoKN7rxXhU83mkzTQGym27u14gZLhAZR
			//   https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcR7sIQUM-nZmJnjBnexRoKN7rxXhU83mkzTQGym27u14gZLhAZR
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/forum\/thumbs\/img\.php.*?[?&]src=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nowww === "squa.re") {
			// https://squa.re/wp-content/themes/square22/img.php?w=960&src=/fimgs/734362.jpg
			//   https://squa.re/fimgs/734362.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/wp-content\/+themes\/+[^/]*\/+img\.php.*?[?&]src=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return urljoin(src, newsrc, true);
		}

		if (domain_nosub === "itvnet.lv" &&
			src.match(/\/upload[0-9]*\/articles\//)) {
			// https://spi3uk.itvnet.lv/upload2/articles/71/715723/thumbs/500Vai-zinaji-ka-sis-7-1.jpg
			//   https://spi3uk.itvnet.lv/upload2/articles/71/715723/images/Vai-zinaji-ka-sis-7-1.jpg
			//   https://spi3uk.itvnet.lv/upload2/articles/71/715723/images/_origin_Vai-zinaji-ka-sis-7-1.jpg
			// https://spi4uk.itvnet.lv/upload/articles/30/304098/images/T-257.jpg -- 830x518
			//   https://spi4uk.itvnet.lv/upload/articles/30/304098/images/_origin_T-257.jpg -- 1680x1050
			return src
				.replace(/\/thumbs\/[0-9]+([^/]*)$/, "/images/$1")
				.replace(/\/images\/([^_][^/]*)$/, "/images/_origin_$1");
		}

		if (domain_nowww === "connectgalaxy.com") {
			// https://www.connectgalaxy.com/gallery/icon/308734/taggable -- 376x550
			//   https://www.connectgalaxy.com/gallery/download/308734 -- 3600x5259
			return src.replace(/\/gallery\/icon\/([0-9]+)\/[a-z0-9]+(\?.*)?$/, "/gallery/download/$1");
		}

		// todo: merge _jcr_content rules
		if (domain === "nst.sky.it" ||
			// https://sydney.edu.au/dam/corporate/images/careers-centre/company-logos/Adobe-Logo-2.png/_jcr_content/renditions/cq5dam.web.1280.1280.png
			//   https://sydney.edu.au/dam/corporate/images/careers-centre/company-logos/Adobe-Logo-2.png
			domain === "sydney.edu.au" ||
			// thanks to DevWannabe-dot on github for reporting: https://github.com/qsniyg/maxurl/issues/856
			// https://www2.deloitte.com/content/dam/Deloitte/uk/Images/promo_images/Profiles/deloitte-uk-cherry-seaborn-updated.jpg/_jcr_content/renditions/cq5dam.web.231.231.desktop.jpeg
			//   https://www2.deloitte.com/content/dam/Deloitte/uk/Images/promo_images/Profiles/deloitte-uk-cherry-seaborn-updated.jpg
			// https://www2.deloitte.com/content/dam/Deloitte/uk/Images/promo_images/Profiles/deloitte-uk-dr-matthew-howard.jpg/_jcr_content/renditions/cq5dam.web.231.231.desktop.jpeg
			//   https://www2.deloitte.com/content/dam/Deloitte/uk/Images/promo_images/Profiles/deloitte-uk-dr-matthew-howard.jpg
			// https://www2.deloitte.com/content/dam/Deloitte/uk/Images/promo_images/Profiles/deloitte-uk-bruce-finch.png/_jcr_content/renditions/cq5dam.web.231.231.desktop.jpeg
			//   https://www2.deloitte.com/content/dam/Deloitte/uk/Images/promo_images/Profiles/deloitte-uk-bruce-finch.png
			// https://www2.deloitte.com/content/dam/Deloitte/uk/Images/promo_images/Profiles/deloitte-uk-ric-simes.jpg/_jcr_content/renditions/cq5dam.web.231.231.desktop.jpeg
			//   https://www2.deloitte.com/content/dam/Deloitte/uk/Images/promo_images/Profiles/deloitte-uk-ric-simes.jpg
			(domain_nosub === "deloitte.com" && /^www/.test(domain)) ||
			// https://about.hm.com/content/dam/hmabout/groupsite/images/article/Newsroom/2016/July/Kenzo-x-HM-article.jpg/_jcr_content/renditions/cq5dam.web.976.603.jpeg
			//   https://about.hm.com/content/dam/hmabout/groupsite/images/article/Newsroom/2016/July/Kenzo-x-HM-article.jpg
			domain === "about.hm.com" ||
			// thanks to anonymous for reporting:
			// https://www.prada.com/content/dam/pradanux/pradasphere/2024/campaing/ss24/mosaic_3/Card_2_DT.jpg/_jcr_content/renditions/cq5dam.web.1280.1280.webp
			//   https://www.prada.com/content/dam/pradanux/pradasphere/2024/campaing/ss24/mosaic_3/Card_2_DT.jpg
			domain_nowww === "prada.com" ||
			// https://www.hbo.com/content/dam/hbodata/documentaries/robin-williams-come-inside-my-mind/video-stills/trailer-68843906_PRO35_10.jpg/_jcr_content/renditions/cq5dam.web.1200.675.jpeg
			//   https://www.hbo.com/content/dam/hbodata/documentaries/robin-williams-come-inside-my-mind/video-stills/trailer-68843906_PRO35_10.jpg
			domain_nowww === "hbo.com") {
			// https://nst.sky.it/content/dam/static/contentimages/original/sezioni/cinema/news/2017/08/09/sharon-stone-posa/Emma_Watson_kika2859146.jpg/_jcr_content/renditions/cq5dam.web.393.462.jpeg
			//   https://nst.sky.it/content/dam/static/contentimages/original/sezioni/cinema/news/2017/08/09/sharon-stone-posa/Emma_Watson_kika2859146.jpg
			return src.replace(/(\/[^/]*\.[^/.]*)\/_jcr_content\/renditions\/.*/, "$1");
		}

		if (domain === "cdnimage.terbitsport.com") {
			// http://cdnimage.terbitsport.com/image.php?width=84&height=55&cropratio=2:1&image=http://cdnimage.terbitsport.com/imagebank/gallery/large/20170221_100743_harianterbit_emma.jpg
			//   http://cdnimage.terbitsport.com/imagebank/gallery/large/20170221_100743_harianterbit_emma.jpg
			return decodeURIComponent(src.replace(/^[a-z]+:\/\/[^/]*\/image\.php.*?[?&]image=([^&]*).*?$/, "$1"));
		}

		if (domain_nowww === "beimg.com") {
			// https://beimg.com/fangimg.php?url=http://mmbiz.qpic.cn/mmbiz_jpg/pAO4jjrWd1Ts86FYpT2FNVRSiciaZ9osic0icicRiaNnsaGyWVncxMF0YwhcMD4cb7lTMCLVgbx6a7LpOg7nes0YeoLA/0?
			//   http://mmbiz.qpic.cn/mmbiz_jpg/pAO4jjrWd1Ts86FYpT2FNVRSiciaZ9osic0icicRiaNnsaGyWVncxMF0YwhcMD4cb7lTMCLVgbx6a7LpOg7nes0YeoLA/0?
			return decodeURIComponent(src.replace(/^[a-z]+:\/\/[^/]*\/fangimg\.php.*?[?&]url=([^&]*).*?$/, "$1"));
		}

		if (domain_nowww === "que.es") {
			// http://www.que.es/archivos/201008/emma-watson-ancha-365xXx80.jpg
			//   http://www.que.es/archivos/201008/emma-watson-ancha.jpg
			return src.replace(/-[0-9X]+x[0-9X]+(?:x[0-9]+)?(\.[^/.]*)$/, "$1");
		}

		if (domain_nowww === "independent.com.mt") {
			// http://www.independent.com.mt/file.aspx?f=124066&width=630&height=340
			//   http://www.independent.com.mt/file.aspx?f=124066
			return src.replace(/(:\/\/[^/]*\/file\.aspx).*?[?&](f=[0-9]+).*?$/, "$1?$2");
		}

		if (domain === "img.selenka.pl") {
			// http://img.selenka.pl/walls/a36f0bc8643a5315/z.jpg
			//   http://img.selenka.pl/walls/a36f0bc8643a5315/o.jpg -- 1920x1200
			// http://img.selenka.pl/fbwalls/f592eda2469339fb/z.jpg
			//   http://img.selenka.pl/fbwalls/f592eda2469339fb/o.jpg
			// doesn't work for all:
			// http://img.selenka.pl/walls/7564da16c6dc0c20/z.jpg
			//   http://img.selenka.pl/walls/7564da16c6dc0c20/o.jpg -- 404
			return src.replace(/(\/(?:fb)?walls\/[0-9a-f]+\/)[a-z](\.[^/.]*)$/, "$1o$2");
		}

		if (domain === "ki.ill.in.ua") {
			// https://ki.ill.in.ua/m/670x450/24042127.jpg
			//   https://ki.ill.in.ua/m/0x0/24042127.jpg
			return src.replace(/\/[0-9]+x[0-9]+(\/[0-9]+\.[^/.]*)$/, "/0x0$1");
		}

		if (domain === "stg.pcg.space") {
			// http://stg.pcg.space/source/1/7/3/4/8/1734843/large.jpg
			//   http://stg.pcg.space/source/1/7/3/4/8/1734843/org.jpg
			// http://stg.pcg.space/source/1/0/8/5/8/1085844/wide.jpg
			//   http://stg.pcg.space/source/1/0/8/5/8/1085844/org.jpg
			// http://stg.pcg.space/source/2/0/2/3/8/2023806/medium.jpg
			//   http://stg.pcg.space/source/2/0/2/3/8/2023806/org.jpg
			return src.replace(/\/[a-z]+(\.[^/.]*)$/, "/org$1");
		}

		if (domain === "static.noticiasaominuto.com" ||
			// https://static.noticiasaominuto.com.br/stockimages/gallery/1920/naom_5a9c9a20cc942.jpg -- 720x1080
			//   https://static.noticiasaominuto.com.br/stockimages/hires_original/naom_5a9c9a20cc942.jpg -- 3446x5168
			//   https://media-manager.noticiasaominuto.com/naom_5a9c9a20cc942.jpg -- 3446x5168
			domain === "static.noticiasaominuto.com.br") {
			// https://static.noticiasaominuto.com/stockimages/gallery/1920/naom_590064d2d86e4.jpg -- stretched
			//   https://static.noticiasaominuto.com/stockimages/hires_original/naom_590064d2d86e4.jpg
			// https://static.noticiasaominuto.com/stockimages/1920/naom_5af00562d40f1.jpg -- 1920x1080
			//   https://static.noticiasaominuto.com/stockimages/hires_original/naom_5af00562d40f1.jpg -- 2800x1866
			//   https://media-manager.noticiasaominuto.com/naom_5af00562d40f1.jpg -- 2800x1866
			return src.replace(/(\/stockimages\/)(?:gallery\/)?[^/]*(\/[^/]*)$/, "$1hires_original$2");
		}

		if (domain === "media-manager.noticiasaominuto.com") {
			// https://media-manager.noticiasaominuto.com/naom_5b92574de01fd.jpg?&w=1920&t=gallery
			//   https://media-manager.noticiasaominuto.com/640/1501786113/naom_590a5951e913a.jpg
			//   https://media-manager.noticiasaominuto.com/naom_590a5951e913a.jpg
			return src
				.replace(/\?.*/, "")
				.replace(/(:\/\/[^/]*\/)[0-9]+\/+[0-9]+\/+(naom_)/, "$1$2");
		}

		// PHP-Fusion
		if (domain_nowww === "harry-potter.net.pl") {
			// http://www.harry-potter.net.pl/images/photoalbum/album_63/emma-watson-vogue-australia-8_t2.jpg
			//   http://www.harry-potter.net.pl/images/photoalbum/album_63/emma-watson-vogue-australia-8.jpg
			// http://www.harry-potter.net.pl/images/photoalbum/album_63/emma-watson-vogue-australia_t1.jpg
			//   http://www.harry-potter.net.pl/images/photoalbum/album_63/emma-watson-vogue-australia.jpg
			return src.replace(/(\/images\/photoalbum\/[^/]*\/[^/]*)_t[0-9](\.[^/.]*)$/, "$1$2");
		}

		if ((domain_nosub === "kanobu.ru" ||
			 // http://i06.kanobu.net/r/22d1e932549980bcf58a9fc6da48898e/1040x-/u.kanobu.ru/editor/images/73/6b94d681-534d-4e8d-9fae-aaa2055cee06.jpg
			 //   https://u.kanobu.ru/editor/images/73/6b94d681-534d-4e8d-9fae-aaa2055cee06.jpg
			 domain_nosub === "kanobu.net") &&
			domain.match(/^i[0-9]*\./)) {
			// https://i10.kanobu.ru/r/91faf8a08abc774080a581d5e93b3d27/1040x-/u.kanobu.ru/editor/images/50/fdefed64-bfc3-4c01-a84e-1e85ddf209c2.jpg
			//   https://u.kanobu.ru/editor/images/50/fdefed64-bfc3-4c01-a84e-1e85ddf209c2.jpg
			return src.replace(/:\/\/[^/]*\/r\/[0-9a-f]+\/[-0-9]+x[-0-9]+\//, "://");
		}

		if (domain_nowww === "tv3.lt" ||
			// https://static2.inspektorius.lt/usi/211x114/4/c5/12/05/c512057c1918ec48727c07836e237dd2.jpg?v=4.0.5.09&t=cr&s=211x114&m=4&f=/Uploads/UGallery/photos/ab/a5/a2/f3/aba5a2f332393e340c4d7fcf86adb835.jpg
			//   https://www.tv3.lt/Uploads/UGallery/photos/ab/a5/a2/f3/aba5a2f332393e340c4d7fcf86adb835.jpg
			domain_nosub === "inspektorius.lt") {
			// https://www.tv3.lt/usi/980x654/2/af/ae/be/afaebed980933add6f1c3de2d1870415.jpg?v=4.0.4.37&t=cr&s=980x654&m=2&f=/Uploads/UGallery/photos/6d/42/55/31/6d425531aca787350bbe5ab170abddff.jpg
			//   https://www.tv3.lt/Uploads/UGallery/photos/6d/42/55/31/6d425531aca787350bbe5ab170abddff.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+usi\/+[0-9]+x[0-9]+\/+.*?[?&]f=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return urljoin(src, decodeURIComponent(newsrc), true);
		}

		if (domain_nosub === "gallery.ru" &&
			domain.match(/^data[0-9]*\.(?:i\.)?gallery\.ru/)) {
			// http://data28.i.gallery.ru/albums/gallery/171772-3f95a-97183306-h200-u1bfa6.jpg
			//   http://data28.i.gallery.ru/albums/gallery/171772-3f95a-97183306-h999999999999-u1bfa6.jpg
			//   http://data28.i.gallery.ru/albums/gallery/171772-3f95a-97183306-.jpg
			// http://data12.gallery.ru/albums/gallery/393321-84bd6-79756659-m750x740-u59fad.jpg
			//   http://data12.gallery.ru/albums/gallery/393321-84bd6-79756659-.jpg
			// http://data12.gallery.ru/albums/gallery/229815--35971692-m750x740.jpg
			//   http://data12.gallery.ru/albums/gallery/229815--35971692-.jpg
			// http://data31.i.gallery.ru/albums/gallery/99613-84e79-106270413-200-ua0c4b.jpg
			//   http://data31.i.gallery.ru/albums/gallery/99613-84e79-106270413-.jpg
			// http://data32.i.gallery.ru/albums/gallery/99613-a420d-109105308-c300x200-ued55e.jpg
			//   http://data32.i.gallery.ru/albums/gallery/99613-a420d-109105308-.jpg
			//return src.replace(/(\/albums\/gallery\/[^/]*-)[wh][0-9]+(-[0-9a-z]+\.[^/.]*)$/, "$1h999999999999$2");
			return src.replace(/(\/albums\/gallery\/[^/]*-[0-9]{5,}-)[whmc]?[0-9]+(?:x[0-9]+)?(?:-[0-9a-z]+)?(\.[^/.]*)$/, "$1$2");
		}

		if (domain_nowww === "fotosdefamosas.tk") {
			// http://www.fotosdefamosas.tk/Fotos/Camren_Bicondova/miniaturas/TN_Camren_Bicondova_040.jpg
			//   http://www.fotosdefamosas.tk/Fotos/Camren_Bicondova/Camren_Bicondova_040.jpg
			return src.replace(/\/miniaturas\/TN_([^/]*)$/, "/$1");
		}

		if (domain_nowww === "starwiki.org") {
			// https://starwiki.org/thumbs/photos/women-halle-berry-grey/001-women-halle-berry-grey-starwiki.org.jpg
			//   https://starwiki.org/photos/women-halle-berry-grey/001-women-halle-berry-grey-starwiki.org.jpg
			return {
				url: src.replace(/\/thumbs\/photos\//, "/photos/"),
				head_wrong_contenttype: true
			};
		}

		if (domain_nowww === "postervdom.ru" && string_indexof(src, "/upload/") >= 0) {
			// http://postervdom.ru/upload/shop_3/3/1/6/item_3160/small_item_3160.jpg
			//   http://postervdom.ru/upload/shop_3/3/1/6/item_3160/item_3160.jpg
			return src.replace(/(\/item_[0-9]+\/)[a-z]+_(item_[0-9]+[^/]*)$/, "$1$2");
		}

		if ((domain_nosub === "fastpic.ru" || domain_nosub === "fastpic.org") &&
			domain.match(/^i[0-9]*\./)) {
			// http://i42.fastpic.ru/thumb/2012/0923/e8/f6e016d1ec53db2c82a762961f1051e8.jpeg
			//   http://i42.fastpic.ru/big/2012/0923/e8/f6e016d1ec53db2c82a762961f1051e8.jpg?noht=1
			return {
				url: src.replace(/(:\/\/[^/]*\/)thumb(\/.*\.)jpeg/, "$1big$2jpg?noht=1"),
				headers: {
					Referer: "https://" + domain_nosub + "/",
					"Sec-Fetch-Dest": "image",
					"Accept": "image/webp,image/apng,image/*,*/*;q=0.8"
				}
			};
		}

		if (domain === "i.nahraj.to") {
			// http://i.nahraj.to/t/1jzQ.jpg
			//   http://i.nahraj.to/f/1jzQ.jpg
			return src.replace(/(:\/\/[^/]*\/)[a-z](\/[^/]+\.[^/.]*)$/, "$1f$2");
		}

		if (domain === "skwww.plusden.sk") {
			// http://skwww.plusden.sk/thumb/images/gallery/fotoreportaz/2009/02/Halle-Berry/Halle_Berry_8.jpg?w=142&h=80&ip=6
			//   http://skwww.plusden.sk/images/gallery/fotoreportaz/2009/02/Halle-Berry/Halle_Berry_8.jpg
			return src.replace(/\/thumb(\/images\/gallery\/.*?)(?:\?.*)?$/, "$1");
		}

		if (domain_nowww === "admags.xyz" ||
			// http://hotmags.xyz/m/bjai/jg/d0or1w_tb/004.jpg
			//   http://hotmags.xyz/m/bjai/jg/d0or1w/004.jpg
			domain_nowww === "hotmags.xyz") {
			// http://admags.xyz/m/bjaa/jc/ucr9z7_tb/069.jpg
			//   http://admags.xyz/m/bjaa/jc/ucr9z7/069.jpg
			return src.replace(/_tb(\/[^/]*)$/, "$1");
		}

		if (false && domain === "img.topky.sk") {
			// http://img.topky.sk/vysetrenie//320px/1676317.jpg/vlasy--preplachovanie.jpg
			//   http://img.topky.sk/vysetrenie//big/1676317.jpg/vlasy--preplachovanie.jpg
			// downscales some:
			// https://img.topky.sk/podkapotou/1280px/1545107.jpg/Hostesky-autosalon-v-Bratislave-2015.jpg -- 1280x1920
			//   https://img.topky.sk/podkapotou/big/1545107.jpg/Hostesky-autosalon-v-Bratislave-2015.jpg -- 647x970
			newsrc = src.replace(/\/[0-9]+px\/([^/]*)(\/[^/]*)?$/, "/big/$1$2");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "img.topky.sk") {
			// http://img.topky.sk/dc/3/thumb/7644.jpg
			//   http://img.topky.sk/dc/3/7644.jpg
			return src.replace(/(\/dc\/+[0-9]+\/+)thumb\//, "$1");
		}

		if (domain_nowww === "kungahuset.org") {
			// http://kungahuset.org/uploads/thumb/100X100_inspiring-pin-by-amias-bakshi-on-hollywooed-actresses-picture-for-halle-berry-with-blonde-hair-style-and-concept_AFLK_23730.jpg
			//   http://kungahuset.org/uploads/inspiring-pin-by-amias-bakshi-on-hollywooed-actresses-picture-for-halle-berry-with-blonde-hair-style-and-concept_AFLK_23730.jpg
			return src.replace(/\/uploads\/thumb\/[0-9]+X[0-9]+_/, "/uploads/");
		}

		if (domain_nosub === "e-monsite.com") {
			// http://s2.e-monsite.com/2010/04/02/02/resize_128_128//Neree-Beauchemin.jpg
			//   http://s2.e-monsite.com/2010/04/02/02//Neree-Beauchemin.jpg
			// doesn't work for all:
			// http://s2.e-monsite.com/2009/11/11/10/resize_550_550//pochette-Supplice.jpg
			//   http://s2.e-monsite.com/2009/11/11/10//pochette-Supplice.jpg -- 404
			return src.replace(/\/resize_[0-9]+_[0-9]+\//, "/");
		}

		if (domain === "static.guide.supereva.it" ||
			// https://media.gossipblog.it/c/car/cara-delevingne-le-foto-piu-belle/thn_cara-delevingne-foto-155752915-10.jpg
			//   https://media.gossipblog.it/c/car/cara-delevingne-le-foto-piu-belle/cara-delevingne-foto-155752915-10.jpg -- 460x620
			//   https://media.gossipblog.it/c/car/cara-delevingne-le-foto-piu-belle/th/cara-delevingne-foto-155752915-10.jpg -- 892x1200
			domain === "media.gossipblog.it" ||
			// http://media.fashionblog.it/f/fes/festival-del-cinema-di-venezia-2011-look-madonna-e-asia-argento-01/thn_423.jpg
			//   http://media.fashionblog.it/f/fes/festival-del-cinema-di-venezia-2011-look-madonna-e-asia-argento-01/423.jpg
			domain === "media.fashionblog.it") {
			// http://static.guide.supereva.it/guide/guida_hollywood/halle-berry-la-donna-nera-piu-sexy/thn_halleberrysx7.jpg
			//   http://static.guide.supereva.it/guide/guida_hollywood/halle-berry-la-donna-nera-piu-sexy/halleberrysx7.jpg
			return src.replace(/\/thn_([^/]*)$/, "/$1");
		}

		if (domain_nowww === "xzone.to") {
			// thanks to anonymous for reporting:
			// https://www.xzone.to/patero/k06201/images/thn_001.jpg
			//   https://www.xzone.to/patero/k06201/images/001.jpg
			return src.replace(/(\/images\/+)thn_([0-9]+\.)/, "$1$2");
		}

		if (domain_nowww === "apachan.net" ||
			// http://prokote.info/thumbs/201707/14/myazqxb7300j.jpg
			//   http://prokote.info/images/201707/14/myazqxb7300j.jpg
			domain_nowww === "prokote.info") {
			// https://apachan.net/thumbs/201712/20/gnBNXuiEWIKV.png
			//   https://apachan.net/previews/201712/20/gnBNXuiEWIKV.png
			//   https://apachan.net/images/201712/20/gnBNXuiEWIKV.png
			return src.replace(/(:\/\/[^/]*\/)(?:thumbs|previews)\//, "$1images/");
		}

		if (domain === "imggaleri.hurriyet.com.tr" ||
			// http://imgkelebek.hurriyet.com.tr/LiveImages/G%C3%BCzelim/539/KATE%20MIDDLETON%20ZAYIFLI%C4%9EIYLA%20KORKUTTU/ThumbFolder/00.jpg
			//   http://imgkelebek.hurriyet.com.tr/LiveImages/G%C3%BCzelim/539/KATE%20MIDDLETON%20ZAYIFLI%C4%9EIYLA%20KORKUTTU/LargeFolder/00.jpg
			domain === "imgkelebek.hurriyet.com.tr") {
			// http://imggaleri.hurriyet.com.tr/LiveImages/Foto%20Haber/207/Hollywood%E2%80%99un%20en%20%C3%A7ok%20kazan%20akt%C3%B6rleri%20(2013)/ThumbFolder/0.jpg
			//   http://imggaleri.hurriyet.com.tr/LiveImages/Foto%20Haber/207/Hollywood%E2%80%99un%20en%20%C3%A7ok%20kazan%20akt%C3%B6rleri%20(2013)/0.jpg -- 371x520
			//   http://imggaleri.hurriyet.com.tr/LiveImages/Foto%20Haber/207/Hollywood%E2%80%99un%20en%20%C3%A7ok%20kazan%20akt%C3%B6rleri%20(2013)/LargeFolder/0.jpg -- 570x800
			return src.replace(/(\/+LiveImages\/+[^/]*\/+[0-9]+\/+[^/]*)(?:\/+ThumbFolder)?\/+([^/]*)$/, "$1/LargeFolder/$2");
		}

		if (domain_nowww === "army.mil") {
			// https://www.army.mil/e2/c/images/2018/04/03/512251/size1.jpg
			//   https://www.army.mil/e2/c/images/2018/04/03/512251/original.jpg
			return src.replace(/(\/e2\/c\/images\/)(.*\/)size[0-9]*(\.[^/.]*)$/, "$1$2original$3");
		}

		if (domain_nosub === "disquscdn.com") {
			// thanks to TristanWasTaken on github: https://github.com/qsniyg/maxurl/issues/1192
			// https://c.disquscdn.com/uploads/users/36733/2961/avatar36.jpg
			//   https://c.disquscdn.com/uploads/users/36733/2961/avatar128.jpg
			//   https://c.disquscdn.com/uploads/users/36733/2961/avatar200.jpg
			// other:
			// https://disqus.com/api/users/avatars/tristanwastaken.jpg
			regex = /(\/uploads\/+users\/+[0-9]+\/+[0-9]+\/+avatar)(?:36|92|128)\./;
			if (regex.test(src)) {
				return replace_sizes(src, [
					src.replace(regex, "$1200."),
					src.replace(regex, "$1128.")
				]);
			}

			// https://a.disquscdn.com/get?url=https%3A%2F%2Fwww.army.mil%2Fe2%2Fc%2Fimages%2F2018%2F01%2F25%2F504694%2Fsize1.jpg&key=Pqr8p2wdqsfS5mYS746GtQ
			//   https://www.army.mil/e2/c/images/2018/01/25/504694/original.jpg
			return decodeURIComponent(src.replace(/^[a-z]+:\/\/[^/]*\/get.*?[?&]url=([^&]*).*?$/, "$1"));
		}

		if (domain_nowww === "smore.com") {
			// https://www.smore.com/external_image?url=https://www.army.mil/e2/c/images/2017/10/02/494176/size2.jpg
			//   https://www.army.mil/e2/c/images/2017/10/02/494176/size2.jpg
			return decodeURIComponent(src.replace(/^[a-z]+:\/\/[^/]*\/external_image.*?[?&]url=([^&]*).*?$/, "$1"));
		}

		if (domain === "images.ctfassets.net") {
			// FIXME: why this instead of removing the query string altogether? can't seem to find a difference...
			// http://images.ctfassets.net/55tpbg0qcsp4/5zeVQCnhqowcwiIw4kM80S/f70edd51832e8640f72c375cb1d72b6b/nagative_farewell4.jpg?w=144&h=102
			//   http://images.ctfassets.net/55tpbg0qcsp4/5zeVQCnhqowcwiIw4kM80S/f70edd51832e8640f72c375cb1d72b6b/nagative_farewell4.jpg?h=4000
			// thanks to roi for reporting:
			// https://images.ctfassets.net/a826mlmnqk6u/5eWq7CmDq8jdFpxd3XzSZx/358f52d49edc4f7feb17c0d9e77cd68e/Nouver_Headshot_2020.jpg?h=100
			//   https://images.ctfassets.net/a826mlmnqk6u/5eWq7CmDq8jdFpxd3XzSZx/358f52d49edc4f7feb17c0d9e77cd68e/Nouver_Headshot_2020.jpg -- 4160x6240
			return src.replace(/\?.*$/, "");
		}

		if (domain_nosub === "okccdn.com") {
			// https://k2.okccdn.com/php/load_okc_image.php/images/0x0/806x806/0/13816000233260326780.webp?v=2
			//   https://k2.okccdn.com/php/load_okc_image.php/images/13816000233260326780.webp?v=2
			return src.replace(/(\/php\/load_okc_image\.php\/images\/)(?:[0-9]+(?:x[0-9]+)?\/){1,}([0-9]+\.[^/.]*)$/, "$1$2");
		}

		if (domain_nosub === "metapix.net" ||
			// thanks to Noodlers on discord:
			// https://inkbunny.net/s/879729
			// https://inkbunny.net/thumbnails/medium/1197/1197333_masa_whitetat_noncustom.jpg
			//   https://inkbunny.net/thumbnails/large/1197/1197333_masa_whitetat_noncustom.jpg
			//   https://inkbunny.net/files/preview/1197/1197333_masa_whitetat.jpg
			//   https://inkbunny.net/files/screen/1197/1197333_masa_whitetat.png
			//   https://inkbunny.net/files/full/1197/1197333_masa_whitetat.png
			// thanks to Noodlers on discord:
			// https://inkbunny.net/s/807019
			// https://inkbunny.net/thumbnails/medium/1092/1092340_comjuke_are_you_here_pg_6.jpg
			//   https://inkbunny.net/files/full/1092/1092340_comjuke_are_you_here_pg_6.png
			// thanks to Noodlers on discord:
			// https://inkbunny.net/masa
			// https://inkbunny.net/usericons/tiny/174/174131_masa_avatar_ecda94773cce_128.jpg -- 20x20
			//   https://inkbunny.net/usericons/small/174/174131_masa_avatar_ecda94773cce_128.jpg -- 50x50
			//   https://inkbunny.net/usericons/large/174/174131_masa_avatar_ecda94773cce_128.jpg -- 100x100
			domain_nowww === "inkbunny.net") {
			// https://wa.ib.metapix.net/thumbnails/medium/2391/2391802_Ero_eiko_noncustom.jpg
			//   https://tx.ib.metapix.net/files/full/2391/2391802_Ero_eiko.png
			// https://wa.ib.metapix.net/files/screen/2391/2391802_Ero_eiko.png
			//   https://tx.ib.metapix.net/files/full/2391/2391802_Ero_eiko.png
			// thanks to Noodlers on discord for the domain list:
			// 1:  inkbunny.net
			// 2:  nl.ib.metapix.net
			// 3:  us.ib.metapix.net
			// 4:  gb2.ib.metapix.net (duplicated by 10, 11, 13, 14, and 16)
			// 5:  au.ib.metapix.net
			// 6:  qc.ib.metapix.net
			// 7:  jp.ib.metapix.net
			// 8:  br.ib.metapix.net
			// 9:  va.ib.metapix.net
			// 12: tx.ib.metapix.net
			// 15: kr.ib.metapix.net
			// 17: za.ib.metapix.net
			// 18: hk.ib.metapix.net
			// 19: fl.ib.metapix.net
			newsrc = src.replace(/\/files\/[a-z]+\/([0-9]+\/[^/]*)$/, "/files/full/$1");
			if (newsrc === src)
				newsrc = src.replace(/\/thumbnails\/[a-z]*\/([0-9]+\/[0-9]+[^/]*?)(?:_noncustom)?(\.[^/.]*)$/, "/files/full/$1$2");

			if (newsrc !== src)
				return add_extensions(newsrc);

			return src.replace(/(\/usericons\/+)(?:tiny|small)\/+/, "$1large/");
		}

		if (domain === "cdn.furiffic.com") {
			// https://cdn.furiffic.com/thumbnails/142900.jpg
			//   https://cdn.furiffic.com/originals/142900.jpg
			// https://cdn.furiffic.com/thumbnails/126003.jpg
			//   https://cdn.furiffic.com/originals/126003.png
			return add_extensions(src.replace(/(:\/\/[^/]*\/)[a-z]+(\/[0-9]+\.[^/.]*)$/, "$1originals$2"));
		}

		if (domain === "d3gz42uwgl1r1y.cloudfront.net") {
			// https://d3gz42uwgl1r1y.cloudfront.net/br/braeburned/submission/2016/04/7bc5a92bca8a74e0ea1de0e661416d7a/315x315.jpg
			//   https://d3gz42uwgl1r1y.cloudfront.net/br/braeburned/submission/2016/04/7bc5a92bca8a74e0ea1de0e661416d7a.png
			return add_extensions(src.replace(/(\/submission\/[0-9]+\/[0-9]+\/[0-9a-f]+)\/[0-9]+x[0-9]+(\.[^/.]*)$/, "$1$2"));
		}

		if (domain_nosub === "route50.net") {
			// http://route50.net/data/gallery/submissions/248507fc33f079922aba925778ba4448_thumb.png
			//   http://route50.net/data/gallery/submissions/248507fc33f079922aba925778ba4448_full.png
			return src.replace(/(\/data\/gallery\/submissions\/[0-9a-f]+_)[a-z]+(\.[^/.]*)$/, "$1full$2");
		}

		if (domain === "img.luxusbenz.com" ||
			// http://img.bmwcase.com/medium/9ea653467179859c-cute-calla-flower-hd-wallpapers.jpg
			//   http://img.bmwcase.com/full/9ea653467179859c-cute-calla-flower-hd-wallpapers.jpg
			domain === "img.bmwcase.com" ||
			// http://img.benzspirit.com/medium/c620462ac0bc76ce-selena-gomez-cute.jpg
			//   http://img.benzspirit.com/full/c620462ac0bc76ce-selena-gomez-cute.jpg
			domain === "img.benzspirit.com") {
			// http://img.luxusbenz.com/medium/45309e796fb86b4c.jpg
			//   http://img.luxusbenz.com/full/45309e796fb86b4c.jpg
			return src.replace(/(:\/\/[^/]*\/)[a-z]+(\/[a-f0-9]+(?:-[^/]*)?\.[^/.]*)$/, "$1full$2");
		}

		if (domain === "dot.asahi.com") {
			// https://dot.asahi.com/S2000/upload/350_2017013000246_1.jpg?update=20170130201101
			//   https://dot.asahi.com/S2000/upload/2017013000246_1.jpg?update=20170130201101
			return src.replace(/\/upload\/[0-9]+_([0-9]{10,}_[0-9]+\.[^/.]*)$/, "/upload/$1");
		}

		if (domain === "p.potaufeu.asahi.com") {
			// thanks to fireattack on discord:
			// https://yorozoonews.jp/article/15182815?p=28303106
			// https://p.potaufeu.asahi.com/4b10-p/picture/28303106/a0dd0e64ca41730b5a959eb563974520_640px.jpg
			//   https://p.potaufeu.asahi.com/4b10-p/picture/28303106/a0dd0e64ca41730b5a959eb563974520.jpg
			return src.replace(/(\/picture\/+[0-9]+\/+[0-9a-f]{10,})_[0-9]+px\./, "$1.");
		}

		if (domain === "news-img.dwango.jp" ||
			// https://img-news-dwango-jp-prod.s3.amazonaws.com/uploads/medium/file/000/000/101/101/313d2cda0ee81c656052c169ee078149.jpg
			//   https://green-img-news-dwango-jp-prod.s3.amazonaws.com/uploads/medium/file/000/000/101/101/313d2cda0ee81c656052c169ee078149.jpg -- 404
			//   https://img-news-dwango-jp-prod.s3.amazonaws.com/uploads/medium/file/000/000/101/101/313d2cda0ee81c656052c169ee078149.jpg
			amazon_container === "img-news-dwango-jp-prod" ||
			// https://green-img-news-dwango-jp-prod.s3.amazonaws.com/uploads/medium/file/000/132/923/132923/sm_op3fl7mwxm9svdgo2do.jpg
			//   https://news-img.dwango.jp/uploads/medium/file/000/132/923/132923/op3fl7mwxm9svdgo2do.jpg -- 1280x1920
			//   https://green-img-news-dwango-jp-prod.s3.amazonaws.com/uploads/medium/file/000/132/923/132923/op3fl7mwxm9svdgo2do.jpg -- 4480x6270
			amazon_container === "green-img-news-dwango-jp-prod") {
			// https://news-img.dwango.jp/uploads/medium/file/000/031/265/31265/md_main_hiki_web.jpg
			//   https://news-img.dwango.jp/uploads/medium/file/000/031/265/31265/main_hiki_web.jpg -- 2756x1831
			//   https://green-img-news-dwango-jp-prod.s3.amazonaws.com/uploads/medium/file/000/031/265/31265/main_hiki_web.jpg -- same
			// thanks to nimbuz on discord:
			// https://news.dwango.jp/idol/56904-2012/photos/279232
			// https://news-img.dwango.jp/uploads/medium/file/000/279/232/279232/ob00g1x1g4egexzp4op.jpg -- 1280x1920
			//   https://green-img-news-dwango-jp-prod.s3.amazonaws.com/uploads/medium/file/000/279/232/279232/ob00g1x1g4egexzp4op.jpg -- 1414x2121
			newsrc = src.replace(/(\/uploads\/[a-z]+\/file\/.*\/)(?:md|sm|lg|xl)_([^/]*)$/, "$1$2");
			if (newsrc !== src)
				return newsrc;

			newsrc = src.replace(/:\/\/news-img\.dwango\.jp\//, "://green-img-news-dwango-jp-prod.s3.amazonaws.com/");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nowww === "getnews.jp") {
			// https://getnews.jp/thumb2/ext/http://px1img.getnews.jp/img/archives/2015/10/DO021.jpg
			//   https://getnews.jp/img/archives/2015/10/DO021.jpg
			// https://getnews.jp/thumb/ext/1613528
			//   http://s.okmusic.jp/news_images/images/2103004/large.jpg?1485745865
			return src.replace(/^[a-z]+:\/\/[^/]*\/thumb2\/ext\/([a-z]+:\/\/.*)$/, "$1");
		}

		// Piwigo
		if (domain_nowww === "amuro.fr" ||
			// http://freshfappening.com/_data/i/upload/2017/04/11/20170411233928-9bf884c0-th.png
			//   http://freshfappening.com/_data/i/upload/2017/04/11/20170411233928-9bf884c0-me.png
			// other:
			// https://freshfappening.com/upload/2017/05/14/20170514140923-51caa1ce.jpg -- no longer works
			domain_nowww === "freshfappening.com" ||
			// https://pornoplaatjes.nl/i.php?/upload/2019/05/14/20190514230022-e2981572-la.jpg
			//   https://pornoplaatjes.nl/upload/2019/05/14/20190514230022-e2981572.jpg
			domain_nowww === "pornoplaatjes.nl" ||
			// https://thefappening.sexy/albums/_data/i/upload/2018/10/17/20181017193654-05a46141-th.jpg
			//   https://thefappening.sexy/albums/upload/2018/10/17/20181017193654-05a46141.jpg
			domain_nowww === "thefappening.sexy" ||
			// https://thefappening.rocks/albums/_data/i/upload/2017/08/05/20170805192918-3a299da8-me.jpg
			//   https://thefappening.rocks/albums/upload/2017/08/05/20170805192918-3a299da8.jpg
			domain_nowww === "thefappening.rocks" ||
			// http://gallery.cyclegarden.com/GuzziGirls/_data/i/galleries/GuzziGirls/Evelin_Rain/rs7310-la.jpg
			//   http://gallery.cyclegarden.com/GuzziGirls/galleries/GuzziGirls/Evelin_Rain/rs7310.jpg
			domain === "gallery.cyclegarden.com" ||
			src.match(/\/_data\/+i\/+upload\/+/)) {
			// http://www.amuro.fr/_data/i/upload/2011/08/14/20110814075347-e08e571c-cu_s9999x160.jpg
			//   http://www.amuro.fr/upload/2011/08/14/20110814075347-e08e571c.jpg
			// http://www.amuro.fr/_data/i/upload/2013/09/11/20130911151431-507b3232-cu_s9999x160.jpg
			//   http://www.amuro.fr/upload/2013/09/11/20130911151431-507b3232.jpg
			newsrc = src.replace(/(\/_data\/+i\/+(?:upload|galleries)\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9]{10,}-[0-9a-f]+)-th\./, "$1-me.");
			if (newsrc !== src)
				return newsrc;

			newsrc = src.replace(/\/i\.php\?\/upload\/+/, "/_data/i/upload/");
			if (newsrc !== src)
				return newsrc;

			newsrc = src.replace(/\/_data\/+i(\/+(?:upload|galleries)\/+(?:[0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9]{10,}-[0-9a-f]+|[^/]+\/+[^/]+\/+[^/]+))-(?:[^/.]*|cu_s[0-9]+x[0-9]+)(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nosub === "cdn-news30.it") {
			// https://l43.cdn-news30.it/blobs/variants/f/7/b/8/f7b8ac9b-365a-49e4-b1c8-34d715851e8d_small.jpg?_636688952210324894
			//   https://l43.cdn-news30.it/blobs/full/f/7/b/8/f7b8ac9b-365a-49e4-b1c8-34d715851e8d.jpg?_636688952210324894
			return src.replace(/\/blobs\/variants\/((?:[a-f0-9]\/){4}[-0-9a-f]+)_[a-z]+(\.[^/.]*)$/, "/blobs/full/$1$2");
		}

		if (domain_nowww === "osobnosti.cz") {
			// https://www.osobnosti.cz/img/pic-hover.png
			if (/\/img\/+pic-hover\./.test(src))
				return {
					url: src,
					bad: "mask"
				};
		}

		if (domain === "imagebox.cz.osobnosti.cz" ||
			// https://img.osobnosti.cz/film/1262095-aquaman/T889560-8d29d.jpg
			domain === "img.osobnosti.cz") {
			// https://imagebox.cz.osobnosti.cz/foto/cara-delevingne/M746357-5736b.jpg -- 150x200
			//   https://imagebox.cz.osobnosti.cz/foto/cara-delevingne/O746357-5736b.jpg -- 2312x3080
			// https://imagebox.cz.osobnosti.cz/foto/rachel-mcadams/T52459-becc.jpg
			//   https://imagebox.cz.osobnosti.cz/foto/rachel-mcadams/O52459-becc.jpg
			// https://img.osobnosti.cz/film/1262095-aquaman/T889560-8d29d.jpg
			//   https://img.osobnosti.cz/film/1262095-aquaman/O889560-8d29d.jpg
			// https://imagebox.cz.osobnosti.cz/tapety/elisha-cuthbert/O83829-1440x900.jpg
			//   https://imagebox.cz.osobnosti.cz/tapety/elisha-cuthbert/O83829.jpg
			return src.replace(/\/[A-Z]([0-9]+)(?:-[0-9]+x[0-9]+)?(-[0-9a-z]+)?(\.[^/.]*)(?:[?#].*)?$/, "/O$1$2$3");
		}

		if (domain === "spicy.southdreamz.com") {
			// https://spicy.southdreamz.com/cache/the-hottest-swimsuit-models/cara-delevingne/the-very-hot-sexy-model-cara-delevingne-pictures-637_w220_h344_thumb.jpg
			//   https://spicy.southdreamz.com/cache/the-hottest-swimsuit-models/cara-delevingne/the-very-hot-sexy-model-cara-delevingne-pictures-637_650.jpg
			//   https://spicy.southdreamz.com/spicysource/the-hottest-swimsuit-models/cara-delevingne/the-very-hot-sexy-model-cara-delevingne-pictures-637.jpg
			return src.replace(/\/cache\/(.*?)(?:_[0-9]+|(?:(?:_[a-z][0-9]+){1,}(?:_thumb)?))(\.[^/.]*)$/, "/spicysource/$1$2");
		}

		if (domain === "img.miumag.pl") {
			// https://img.miumag.pl/0000/b8535.jpg
			// c, f, d, g, a, h, m, b, l, i, k, e
			return src.replace(/\/[a-z]([0-9]+\.[^/.]*)$/, "/c$1");
		}

		if (domain_nowww === "hotnews.bg") {
			// http://hotnews.bg/uploads/news/2015_07/thumb/00093561.jpg
			//   http://hotnews.bg/uploads/news/2015_07/images/00093561.jpg
			return src.replace(/(\/uploads\/news\/[^/]*\/)thumb(\/[0-9]+\.[^/.]*)$/, "$1images$2");
		}

		if (domain === "mediaproxy.salon.com" ||
			// thanks to anonymous for reporting:
			// https://mediaproxy.snopes.com/width/1200/https://media.snopes.com/2021/01/homework-krowemoh.png
			//   https://media.snopes.com/2021/01/homework-krowemoh.png
			domain === "mediaproxy.snopes.com") {
			// https://mediaproxy.salon.com/width/354/https://media.salon.com/2019/05/Game_Of_Thrones_Finale_Dany.jpg
			//   https://media.salon.com/2019/05/Game_Of_Thrones_Finale_Dany.jpg
			return src.replace(/^[a-z]+:\/\/[^/]+\/+[a-z]+\/+[0-9]+\/+(https?:\/\/)/, "$1");
		}

		if (domain_nosub === "cloudimg.io" ||
			// https://cdn2.furniture1.eu/v7/https://products.furniture1.eu/images/homepage/rooms/464x230-kitchen.jpg?force_format=webp&q=10
			//   https://products.furniture1.eu/images/homepage/rooms/464x230-kitchen.jpg
			(domain_nosub === "furniture1.eu" && /^cdn[0-9]*\./.test(domain))) {
			var get_orig_cloudimg_url = function(url) {
				// thanks to BLiTZ on discord
				// https://heise.cloudimg.io/width/400/q65.webp-lossy-65.foil1/_www-heise-de_/ct/imgs/04/1/1/3/8/0/2/9/b0ee5f5673ed1b5a.jpeg
				//   https://heise.cloudimg.io/cdno/n/n/_www-heise-de_/ct/imgs/04/1/1/3/8/0/2/9/b0ee5f5673ed1b5a.jpeg
				//   https://www.heise.de/ct/imgs/04/1/1/3/8/0/2/9/b0ee5f5673ed1b5a.jpeg
				// documentation:
				// https://docs.cloudimage.io/go/cloudimage-documentation-v7/en/domains-urls/origin-url-prefix
				// https://docs.cloudimage.io/go/cloudimage-documentation-v7/en/domains-urls/aliases
				var aliases = {};

				if (domain === "heise.cloudimg.io") {
					aliases["_www-heise-de_"] = "https://www.heise.de";
				}

				// https://cdm0lfbn.cloudimg.io/v7/_origin_/image_uploader/photos/75/original/midem--music-industry-conference-2020-cannes-cannes.jpg
				//   https://static1.seecannes.com/image_uploader/photos/75/original/midem--music-industry-conference-2020-cannes-cannes.jpg
				//   https://static2.chamonet.com/image_uploader/photos/75/original/midem--music-industry-conference-2020-cannes-cannes.jpg
				if (domain === "cdm0lfbn.cloudimg.io") {
					aliases["_origin_"] = "https://static1.seecannes.com";
				}

				// https://cdheefyn.cloudimg.io/s/width/960/--immosquare--/storeimmo/production/wysiwyg_asset/picture/9b28f454-f5fb-42e2-a955-222e32ae0c2b.png
				//   https://s3.amazonaws.com/storeimmo/production/wysiwyg_asset/picture/9b28f454-f5fb-42e2-a955-222e32ae0c2b.png
				if (domain === "cdheefyn.cloudimg.io") {
					aliases["--immosquare--"] = "https://s3.amazonaws.com";
				}

				var new_domain = url.replace(/^([^/]+)\/.*/, "$1");
				for (var alias in aliases) {
					if (new_domain === alias) {
						new_domain = aliases[new_domain];
						url = new_domain + url.replace(/^[^/]+\//, "/");
						break;
					}
				}

				// unknown alias, e.g. https://cdn2.furniture1.eu/v7/_v2_/390/390389.jpg
				if (string_indexof(new_domain, ".") < 0) {
					return null;
				}

				return add_http(url);
			};

			// https://docs.cloudimage.io/go/cloudimage-documentation-v7/en/introduction (thanks to https://github.com/qsniyg/maxurl/issues/312)
			// https://docs.cloudimage.io/go/cloudimage-documentation/en/operations (v6)
			// https://c6oxm85c.cloudimg.io/cdno/n/q10/https://az617363.vo.msecnd.net/imgmodels/models/MD30001282/gallery-1502272667-cara1a74d8ff2128d26eea7a6b74247a45669_thumb.jpg
			//   https://az617363.vo.msecnd.net/imgmodels/models/MD30001282/gallery-1502272667-cara1a74d8ff2128d26eea7a6b74247a45669_thumb.jpg
			// https://ce8737e8c.cloudimg.io/width/359/q90/https://twg-live.s3.amazonaws.com/artist_image/twg_11_1519846018_0.jpg
			//   https://twg-live.s3.amazonaws.com/artist_image/twg_11_1519846018_0.jpg
			// https://doc.cloudimg.io/v7/sample.li/paris.jpg?width=400&wat=1&wat_scale=35&wat_gravity=northeast&wat_pad=10&grey=1
			//   https://doc.cloudimg.io/v7/sample.li/paris.jpg
			// https://demo.cloudimg.io/cdn/n/n/http://sample.li/positionning-test-1.jpg
			//   http://sample.li/positionning-test-1.jpg
			// https://demo.cloudimg.io/crop_px/1000,0,1500,800-200/n/sample.li/girls.jpg
			//   http://sample.li/girls.jpg
			// https://demo.cloudimg.io/crop_px/2000,0,2500,800-x350/n/sample.li/girls.jpg
			//   http://sample.li/girls.jpg
			// https://demo.cloudimg.io/crop_px/1500,400,2000,1300-200x300/n/sample.li/girls.jpg
			//   http://sample.li/girls.jpg
			// https://demo.cloudimg.io/fit/200x180/c3498db/sample.li/tesla.jpg
			//   http://sample.li/tesla.jpg
			// https://demo.cloudimg.io/width/500/none/sample.li/frog.png
			//   http://sample.li/frog.png
			// https://demo.cloudimg.io/crop/400x340/n/sample.li/flat2.jpg?v&mark_url=http://sample.li/sothebys-blue.jpg&mark_height=58&mark_pos=southwest&mark_pad=10
			//   http://sample.li/flat2.jpg
			// https://heise.cloudimg.io/width/400/q65.webp-lossy-65.foil1/_www-heise-de_/ct/imgs/04/1/1/3/8/0/2/9/b0ee5f5673ed1b5a.jpeg
			//   https://www.heise.de/ct/imgs/04/1/1/3/8/0/2/9/b0ee5f5673ed1b5a.jpeg
			// https://aumejtoqen.cloudimg.io/cdn/n/n/https://scontent-iad3-1.xx.fbcdn.net/v/t1.0-9/s720x720/92469457_3362961973733346_3350175560050409472_o.jpg?_nc_cat=104&_nc_sid=8024bb&_nc_ohc=u-GISV-pOocAX9MS5mb&_nc_ht=scontent-iad3-1.xx&_nc_tp=7&oh=f08c73709b5ca63a17f23675cea57cd8&oe=5EBADDA2
			//   https://scontent-iad3-1.xx.fbcdn.net/v/t1.0-9/s720x720/92469457_3362961973733346_3350175560050409472_o.jpg?_nc_sid=8024bb&_nc_ohc=u-GISV-pOocAX9MS5mb&_nc_ht=scontent-iad3-1.xx&_nc_tp=7&oh=f08c73709b5ca63a17f23675cea57cd8&oe=5EBADDA2

			// v3 of the api has /s/(?:crop|width|height|resizeinbox|resizenp), according to https://api.portfolium.com/
			// https://evdo8pe.cloudimg.io/s/resizeinbox/400x400/https://www.cmprea.com/_client/visuels/articles/img/photo/SC28950_GLOBAL.jpg
			//   https://www.cmprea.com/_client/visuels/articles/img/photo/SC28950_GLOBAL.jpg
			// https://e2k9ube.cloudimg.io/s/cdn/x/https://ediewater.s3.amazonaws.com/news/images/full_34426.jpg -- /cdn/ is also an option
			//   https://ediewater.s3.amazonaws.com/news/images/full_34426.jpg
			// https://e2k9ube.cloudimg.io/s/fit/730x355/https://desalinationbiz.s3.amazonaws.com/products/images/full_3976.jpg?v=10/04/2018%2015:25:00
			//   https://desalinationbiz.s3.amazonaws.com/products/images/full_3976.jpg?v=10/04/2018%2015:25:00

			// https://docs.cloudimage.io/go/cloudimage-documentation/en/security/url-signature (@ in filters)
			newsrc = src.replace(/^([a-z]+:\/\/[^/]+\/+)(?:(?:cdn|cdno|fit|width|height|crop(?:_px)?|cover|fit|bound)\/(?:[0-9]+|[0-9]+(?:,[0-9]+){3}-[0-9]*x?[0-9]+|[0-9]+x[0-9]+|n(?:one)?)\/[^/@]+\/|s\/+(?:crop|width|height|resizeinbox|resizenp|cdn|fit)\/+[0-9]*(?:x[0-9]*)?\/+)/, "$1cdn/n/n/");
			if (newsrc !== src)
				return newsrc;

			// https://docs.cloudimage.io/go/cloudimage-documentation-v7/en/security/token-security/url-signature
			// https://abrgsyenen.cloudimg.io/v7/https://fi.bigshopper.com/logos/agradi.jpg?func=bound&force_format=webp&q=95&org_if_sml=1&ci_sign=12fdf6a4b3a9fc2518de55d0f6329aee22b35bac
			//   https://abrgsyenen.cloudimg.io/v7/https://fi.bigshopper.com/logos/agradi.jpg -- 401 unauthorized
			//   https://fi.bigshopper.com/logos/agradi.jpg
			// https://cdn2.furniture1.eu/v7/_v2_/390/390389.jpg?p=c250
			//   https://cdn2.furniture1.eu/v7/_v2_/390/390389.jpg
			if (/^[a-z]+:\/\/[^/]+\/+v7\//.test(src) && !/[?#]ci_sign=/.test(src)) {
				newsrc = src.replace(/\?.*/, "");
				if (newsrc !== src)
					return newsrc;
			}

			//newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/(?:cdn[a-z]?\/)?(?:(?:(?:width|height)\/[0-9]+|n|q[0-9]+|fit\/[0-9]+x[0-9]+\/+)\/)*((?:[a-z]+:\/\/)?[^/]+\.[^/.]+\/)/, "$1");
			// don't remove ? for the moment, though maybe later remove the following?
			// mark_text, mark_pos, mark_fontsize, mark_color, mark_font, mark_pad, mark_url, mark_alpha, mark_height, mark_width (according to dynamic watermark and text watermark from v6 doc)
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+(?:(?:cdn|cdno|fit|width|height|crop(?:_px)?|cover|fit|bound)\/(?:[0-9]+|[0-9]+(?:,[0-9]+){3}-[0-9]*x?[0-9]+|[0-9]+x[0-9]+|n(?:one)?)\/[^/]+\/|s\/+(?:crop|width|height|resizeinbox|resizenp|cdn|fit)\/+[0-9]*(?:x[0-9]*)?\/+)((?:[a-z]+:\/\/)?[^/]+\/.*?)$/, "$1");
			if (newsrc !== src)
				return get_orig_cloudimg_url(newsrc) || src;

			// https://abrgsyenen.cloudimg.io/v7/https://fi.bigshopper.com/logos/agradi.jpg?func=bound&force_format=webp&q=95&org_if_sml=1&ci_sign=12fdf6a4b3a9fc2518de55d0f6329aee22b35bac
			//   https://abrgsyenen.cloudimg.io/v7/https://fi.bigshopper.com/logos/agradi.jpg -- 401 unauthorized
			//   https://fi.bigshopper.com/logos/agradi.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+v7\/+(.*?)(?:[?#].*)?$/, "$1");
			if (newsrc !== src)
				return get_orig_cloudimg_url(newsrc) || src;
		}

		if (domain === "1.f.ix.de") {
			// https://1.f.ix.de/scale/geometry/743x453/q85/download/media/suche/tampermonkey-1_1-1-17.jpg
			// 	 https://www.heise.de/download/media/suche/tampermonkey-1_1-1-17.jpg
			return src.replace(/^[a-z]+:\/\/[^/]+\/+scale\/.*?\/q[0-9]+\/+/, "https://www.heise.de/");
		}

		if (domain_nowww === "cloudphoto.io" || domain === "cdn.cloudphoto.io") {
			// https://cloudphoto.io/en/docs/v1

			// https://cloudphoto.io/9038d9/fit/1170x500/none/https://s3.amazonaws.com/storeimmo/production/asset/picture/746008ca-6995-4984-9faa-4873092a5fd0.png
			// https://cdn.cloudphoto.io/9038d9/fit/1170x500/none/https://s3.amazonaws.com/storeimmo/production/asset/picture/746008ca-6995-4984-9faa-4873092a5fd0.png
			//   https://s3.amazonaws.com/storeimmo/production/asset/picture/746008ca-6995-4984-9faa-4873092a5fd0.png
			// https://cdn.cloudphoto.io/demo/width/300/none/https://samples-photos.com/tennis.jpg
			//   https://samples-photos.com/tennis.jpg
			// https://cdn.cloudphoto.io/demo/crop/900x700/gravityEast/https://samples-photos.com/tennis.jpg
			//   https://cdn.cloudphoto.io/demo/crop/900x700/gravityEast/https://samples-photos.com/tennis.jpg
			return src.replace(/^[a-z]+:\/\/[^/]+\/+[^/]+\/+(?:width|height|crop|cover|fit|bound|none)\/+[0-9]+(?:x[0-9]+)?\/+[^/]+\/+(https?:\/\/)/, "$1");
		}

		if (domain_nowww === "kinataka.ru") {
			// http://kinataka.ru/images_peolpe/4649/photos/240/kinataka.ru-4649-cara-delevingne_37.jpg
			//   http://kinataka.ru/images_peolpe/4649/photos/kinataka.ru-4649-cara-delevingne_37.jpg
			return src.replace(/\/photos\/[0-9]+\/([^/]*)$/, "/photos/$1");
		}

		if (domain === "easttouch.my-magazine.me") {
			// http://easttouch.my-magazine.me/main/upload/photoalbum/thumbnail/53d75489d55e5/07ddf08476c970ba690fd673c7561e74da8552a5.jpg
			//   http://easttouch.my-magazine.me/main/upload/photoalbum/original/53d75489d55e5/07ddf08476c970ba690fd673c7561e74da8552a5.jpg
			return src.replace(/(\/upload\/photoalbum\/)thumbnail(\/[0-9a-f]+\/[0-9a-f]+\.[^/.]*)$/, "$1original$2");
		}

		if (domain === "tvdaily.asiae.co.kr") {
			// http://tvdaily.asiae.co.kr/upimages/photoda/201501/1420040978_828039.jpg
			//   http://tvdaily.asiae.co.kr/upimages/gisaimg/201501/1420040978_828039.jpg
			// doesn't work with all:
			// http://tvdaily.asiae.co.kr/upimages/photoda/201508/955495.jpg
			// other:
			// http://tvdaily.asiae.co.kr/read.php3?aid=15616710001467999017
			// http://image.tvdaily.co.kr/upimages/files/201906/1467999-0.jpg
			// http://image.tvdaily.co.kr/upimages/files/201906/1467999-1.jpg
			// http://tvdaily.asiae.co.kr/upimages/thumb/sl1467999.png
			//   http://image.tvdaily.co.kr/upimages/gisaimg/201906/1561649680_1467999.jpg
			// http://mtvdaily.asiae.co.kr/article.php?aid=14908605451226106017
			//   http://image.tvdaily.co.kr/upimages/files//201703/1226106-2.jpg -- 2603x3911
			//   http://image.tvdaily.co.kr/upimages/files//201703/1226106-1.jpg -- 540x811
			// http://image.tvdaily.co.kr/upimages/gisaimg/201205/15326559.jpg -- 2312x3056
			//   http://mtvdaily.asiae.co.kr/article.php?aid=1337058132326559017
			//   http://tvdaily.asiae.co.kr/read.php3?aid=1337058132326559017
			return src.replace(/\/upimages\/+photoda\//, "/upimages/gisaimg/");
		}

		if (domain === "img.thefactjp.com" ||
			// http://img.thefact.tv/service/article/2017/03/02/thumb/ffbc8c882a3c62d0d489a1e5f999ce8f.jpg
			//   http://img.thefact.tv/service/article/2017/03/02/ffbc8c882a3c62d0d489a1e5f999ce8f.jpg
			domain === "img.thefact.tv") {
			// http://img.thefactjp.com/service/article/2016/12/01/200/7b310164d575f0b42546d9c02e36560f.jpg
			//   http://img.thefactjp.com/service/article/2016/12/01/7b310164d575f0b42546d9c02e36560f.jpg
			// http://img.thefactjp.com/service/article/2017/05/16/thumb/1d5feb31e4765b7cac63187e155e995e.jpg
			//   http://img.thefactjp.com/service/article/2017/05/16/1d5feb31e4765b7cac63187e155e995e.jpg
			return src.replace(/(\/service\/[a-z]+\/[0-9]+\/[0-9]+\/[0-9]+\/)(?:[0-9]+|thumb)\/([0-9a-f]+\.[^/.]*)$/, "$1$2");
		}

		if (domain === "rlv.zcache.co.nz" ||
			// https://rlv.zcache.ca/sarcastic_santa_squirrel_hit_of_holiday_parties_round_paper_coaster-r076e33e54e434c6bae79960b1948d5cb_z6j7x_261.jpg?rlvnet=1&rvtype=content
			//   https://rlv.zcache.ca/sarcastic_santa_squirrel_hit_of_holiday_parties_round_paper_coaster-r076e33e54e434c6bae79960b1948d5cb_z6j7x_999999999.jpg?rvtype=content -- slightly cropped
			domain === "rlv.zcache.ca" ||
			// https://rlv.zcache.com.br/almofada_beijo_do_coelho-r37098fa59ed7493895974ae56e2c6920_i52ni_8byvr_307.jpg?rvtype=content
			//   https://rlv.zcache.com.br/almofada_beijo_do_coelho-r37098fa59ed7493895974ae56e2c6920_i52ni_8byvr_999999999.jpg?rvtype=content -- 2048x2048 (stretched?)
			domain === "rlv.zcache.com.br") {
			// https://rlv.zcache.co.nz/avengers_infinity_war_infinity_war_theatrical_poster-rff80411530e241a289d322c575acd18c_qq1_8byvr_307.jpg?rvtype=content
			//   https://rlv.zcache.co.nz/avengers_infinity_war_infinity_war_theatrical_poster-rff80411530e241a289d322c575acd18c_qq1_8byvr_999999999.jpg?rvtype=content
			return src.replace(/(-r[0-9a-f]+(?:_[_0-9a-z]+)?)_[0-9]+(\.[^/.?]*)(?:\?.*?)?$/, "$1_999999999$2?rvtype=content");
		}

		if (domain_nowww === "empireposter.de") {
			// https://www.empireposter.de/bilder/bilder_k/795120.jpg -- 74x110
			//   https://www.empireposter.de/bilder/bilder_m/795120.jpg -- 181x270
			//   https://www.empireposter.de/bilder/bilder_t/795120.jpg -- 33x50
			//   https://www.empireposter.de/bilder/bilder_l/795120.jpg -- 321x480
			return src.replace(/\/bilder\/bilder_[a-z]\//, "/bilder/bilder_l/");
		}

		if (domain === "dg31sz3gwrwan.cloudfront.net") {
			// https://dg31sz3gwrwan.cloudfront.net/actor/336385/463016_medium-optimized-2.jpg
			//   https://dg31sz3gwrwan.cloudfront.net/actor/336385/463016.jpg
			return src.replace(/(\/[0-9]+\/[0-9]+)_[a-z]+(?:-optimized-[0-9]*)?(\.[^/.]*)$/, "$1$2");
		}

		if (domain === "img.mach-shiko.net") {
			// http://img.mach-shiko.net/images/21070418/08/s/025.jpg
			//   http://img.mach-shiko.net/images/21070418/08/025.jpg
			return src.replace(/(\/images\/[0-9]+\/[0-9]+\/)[a-z]\/([0-9]+\.[^/.]*)$/, "$1$2");
		}

		if (domain === "img.onvshen.com") {
			// https://img.onvshen.com:85/gallery/23764/21580/s/006.jpg
			//   https://img.onvshen.com:85/gallery/23764/21580/006.jpg
			return src.replace(/(\/gallery\/+[0-9]+\/+[0-9]+\/+)[a-z]\/+([0-9]+\.[^/.]*)$/, "$1$2");
		}

		if (domain === "img.geinou-img.com") {
			// http://img.geinou-img.com/daisuki/enta/2017_0729_05/s/27.jpg
			//   http://img.geinou-img.com/daisuki/enta/2017_0729_05/27.jpg
			return src.replace(/(\/[_0-9]+\/)[a-z]\/([0-9]+\.[^/.]*)$/, "$1$2");
		}

		if (domain_nowww === "showbiz.cz" ||
			// https://fotky.showbiz.cz/files/gallery/thumb/22/22ca762507ff9da78299c67075cd6fd41312526584.jpg
			//   https://fotky.showbiz.cz/files/gallery/22/22ca762507ff9da78299c67075cd6fd41312526584.jpg
			domain === "fotky.showbiz.cz") {
			// https://www.showbiz.cz/files/gallery/thumb/18/1825acb57fba5f41c83eb7d79f2cae02.jpg
			//   https://www.showbiz.cz/files/gallery/18/1825acb57fba5f41c83eb7d79f2cae02.jpg
			// http://www.showbiz.cz/public/files/gallery/thumb/28/28bcf43838114960246fe783148e323a1312573752_new.jpg
			//   https://www.showbiz.cz/files/gallery/28/28bcf43838114960246fe783148e323a1312573752.jpg
			return src.replace(/(?:\/public)?(\/+files\/+gallery\/+)thumb\/+([0-9a-f]+\/[0-9a-f]+)(?:_[a-z]+)?(\.[^/.]*)$/, "$1$2$3");
		}

		if (domain === "images.nudereviews.com") {
			// http://images.nudereviews.com/data/media/image/medium/r/ravenalexis.jpg
			//   http://images.nudereviews.com/data/media/image/original/r/ravenalexis.jpg -- larger, but large white space to the right
			return src.replace(/(\/data\/media\/image\/)[a-z]+\//, "$1original/");
		}

		if (domain_nowww === "thefamouspeople.com") {
			// https://www.thefamouspeople.com/profiles/thumbs/lady-gaga-3.jpg
			//   https://www.thefamouspeople.com/profiles/images/lady-gaga-3.jpg
			return src.replace(/\/profiles\/thumbs\//, "/profiles/images/");
		}

		if (domain === "i.trust.ua") {
			// http://i.trust.ua/files/photo/2/0000047814-Grammy-2015-krasnaya-dorozhka.jpg
			//   http://i.trust.ua/files/photo/source/0000047814-Grammy-2015-krasnaya-dorozhka.jpg
			return src.replace(/\/files\/photo\/[0-9]+\//, "/files/photo/source/");
		}

		if (domain === "media.beritagar.id") {
			// https://media.beritagar.id/lme-2015-02/3f1cec246337c8195f8c2e65408160fd_imresized.jpg
			//   https://media.beritagar.id/2015-02/3f1cec246337c8195f8c2e65408160fd.jpg
			// https://media.beritagar.id/lme-2015-02/915a1d8f42ba0a9d52b56f5d1fba9483.jpg
			//   https://media.beritagar.id/2015-02/915a1d8f42ba0a9d52b56f5d1fba9483.jpg
			// https://media.beritagar.id/lme-2015-02/original_700/3f1cec246337c8195f8c2e65408160fd_imresized.jpg
			//   https://media.beritagar.id/2015-02/3f1cec246337c8195f8c2e65408160fd.jpg
			// https://media.beritagar.id/2017-05/thumbnail_240/wd/adcf5a45398cd9e64a400482b078589b.jpg
			//   https://media.beritagar.id/2017-05/adcf5a45398cd9e64a400482b078589b.jpg
			// https://media.beritagar.id/2017-07/original_350/robert-downey-iron-man_1499411443.jpg
			//   https://media.beritagar.id/2017-07/robert-downey-iron-man_1499411443.jpg
			// other:
			// https://media.beritagar.id/2015-08/0_0_1200_674_cc815c07bba94bd83840e2d8375a80d16fd04cd5.jpg -- removing prefix 404s
			// https://media.beritagar.id/2019-02/1600x1119_a9ab424c585f05c027411f97bb4ca3fffeefc709.jpg -- same
			return src.replace(/\/(?:lme-)?([0-9]{4}-[0-9]{2}\/)(?:[a-z]+_[0-9]+\/)?(?:wd\/+)?((?:[0-9a-f]+|[^/]*_[0-9]{5,}))(?:_imresized)?(\.[^/.]*)(?:[?#].*)?$/,
							   "/$1$2$3");
			//return src.replace(/(:\/\/[^/]*\/[0-9]{4}-[0-9]{2}\/+)thumbnail_[0-9]+\/+wd\/+/, "$1");
		}

		if (domain === "imgs.ckcdn.com" ||
			// https://i.imgscc.com/img/aaaaaRXLo.jpg?_w=100
			//   https://i.imgscc.com/img/aaaaaRXLo.jpg
			domain === "i.imgscc.com") {
			// https://imgs.ckcdn.com/img/aaaaawcBB.jpg?_w=200
			//   https://imgs.ckcdn.com/img/aaaaawcBB.jpg
			return {
				url: src.replace(/\?.*$/, ""),//src.replace(/\?.*$/, "?_w=9999999999999"),
				headers: {
					Origin: null,
					Referer: null
				},
				can_head: false
			};
		}

		if (domain === "im.mtv.fi" ||
			// https://www.mz-web.de/image/31466946/max/600/450/56357b58b3fcd8e27d7c441458db5878/yR/rihanna-afp-neu.jpg
			//   https://www.mz-web.de/blob/31466946/81561d8dfe1cb59a89a6d2927b4faa43/rihanna-afp-neu-data.jpg
			domain_nowww === "mz-web.de" ||
			// thanks to meloner on discord for reporting:
			// https://im.mtvuutiset.fi/image/8488866/landscape16_9/496/279/aacdce57b35edd19bfc63d6061709b16/JR/sigrid.jpg
			//   http://im.mtvuutiset.fi/blob/8488866/5ebfc88f9bcbef272f9348d6e5f8bdf8/sigrid-data.jpg -- 2048x1365
			domain === "im.mtvuutiset.fi" ||
			// https://www.swissinfo.ch/image/44463288/3x2/305/203/741d49c894cb22ca5949075eadcb2af7/jY/image_doc-19w5nz.jpg
			//   https://www.swissinfo.ch/blob/44463288/a4e34c18602a9f8060fceff8fbeb3566/image_doc-19w5nz-data.jpg
			domain_nowww === "swissinfo.ch") {
			// https://im.mtv.fi/image/5623620/portrait/141/235/40c589ceaaeaf970c4a391aaef56d4b3/tG/8-17547236.jpg
			//   https://im.mtv.fi/blob/5623620/fb93162a902c736ae29d0a8afa61c23e/8-17547236-data.jpg
			// https://im.mtv.fi/image/5167372/landscape16_9/1024/576/cb77a43764a29a905a138b1d305d6f69/re/29786617.jpg
			//   https://im.mtv.fi/blob/5167372/a68604d83d0af13adcf36501c49a60fe/29786617-data.jpg
			// https://im.mtv.fi/image/6895610/landscape16_9/1024/576/cf17e8d70a8272b0879f93bb17fc4457/Ev/syksy-2018.png
			//   https://im.mtv.fi/blob/6895610/54dfa9ce35989df0140b88dfe4876442/syksy-2018-data.png
			// https://im.mtv.fi/image/5670670/landscape/515/309/a675b591cf893c84b3846370bc763d2c/LZ/1004672-5869.jpg
			//   https://im.mtv.fi/blob/5670670/8fba0e97adbc51ef7f74a60f6ec8d04c/1004672-5869-data.jpg
			// https://im.mtv.fi/image/4837600/landscape1_1/1024/1024/3140f045618e82e77a6247073d04bda7/iH/frendit-yleiskuva.jpg
			//   https://im.mtv.fi/blob/4837600/3b711cb8aa2acf63fe0a60cffce964d0/frendit-yleiskuva-data.jpg
			return src.replace(/\/image(\/[0-9]+\/)(?:(?:portrait|landscape[^/]*|3x2|max)\/[0-9]+\/[0-9]+\/)?([0-9a-f]+\/)[a-zA-Z0-9]{2}\/([^/.]+)(\.[^/.]*)$/,
							   "/blob$1$2$3-data$4");
		}

		if (domain_nowww === "katsomo.fi") {
			// https://www.katsomo.fi/mb/v3/static/svod/stripe_images/image-8552530-landscape16_9-496-279-9522907297acea1914b2e5e57cae0b41-ds-laliga-2022-betis.jpg
			//   http://im.mtvuutiset.fi/blob/8697208/381a3262f19105c51d70191d8f1afcfe/saksa-suomi-data.jpg
			// https://www.katsomo.fi/mb/v3/static/svod/stripe_images/image-8423292-landscape16_9-1600-900-ff0e40dd5a2229cbcaa5f1e25d910ec6-bD-mm-kiekko2022-keyart-new.jpg
			//   http://im.mtvuutiset.fi/blob/8423292/3fb01ca13966769203593092f8b8536e/mm-kiekko2022-keyart-new-data.jpg
			// https://www.katsomo.fi/mb/v3/static/svod/stripe_images/image-8552530-landscape16_9-496-279-9522907297acea1914b2e5e57cae0b41-ds-laliga-2022-betis.jpg
			//   http://im.mtvuutiset.fi/blob/8552530/27692d4bdf9008cdc92ccc9df0ef3aff/laliga-2022-betis-data.jpg
			// https://www.katsomo.fi/mb/v3/static/svod/images/image-8507304-landscape16_9-1600-900-838c2c6c9ab1961c84700a67dc3c16b0-mk-liiga-jyp-1.jpg
			//   https://im.mtvuutiset.fi/blob/8507304/02d993f20bb503bec17cb1c15362fe48/liiga-jyp-1-data.jpg
			// https://www.katsomo.fi/mb/v3/static/svod/images/image-8635742-landscape16_9-1600-900-3ae4df9efe4a05ff6d2fdba0866eb7a2-If-poromafiaxbergman-1600x900-2.jpg
			//   https://im.mtv.fi/blob/8635742/029978e60dc22d9c0813c19d2447c19d/poromafiaxbergman-1600x900-2-data.jpg
			return src.replace(/^.*\/static\/+[a-z]vod\/+(?:stripe_)?images\/+(image)-([0-9]+)-(portrait|landscape[^-/]*|3x2|max)-([0-9]+)-([0-9]+)-([0-9a-f]+)-([a-zA-Z0-9]{2})-([^/]+)$/,
				"https://im.mtv.fi/$1/$2/$3/$4/$5/$6/$7/$8");
		}

		if (domain_nowww === "imageweb.ws" ||
			// http://www.pezporn.com/media/thumbs_200/4/3644/171835.jpg
			// http://www.pezporn.com/media/images_640/4/vintage-pantyhose-sex/vintage-pantyhose-sex-171835.jpg
			domain_nowww === "pezporn.com" ||
			// http://www.hardcoreluv.com/media/images_640/2/pics-of-upskirt-sex/pics-of-upskirt-sex-119145.jpg
			//   http://www.hardcoreluv.com/media/images/2/pics-of-upskirt-sex/pics-of-upskirt-sex-119145.jpg
			domain_nowww === "hardcoreluv.com" ||
			// http://www.wildpictures.net/media/images_640/1/marry-queen/marry-queen-8783.jpg
			//   http://www.wildpictures.net/media/images/1/marry-queen/marry-queen-8783.jpg
			domain_nowww === "wildpictures.net" ||
			// http://cdn2.pussyspot.net/media/images_640/5/kelli-young/kelli-young-1154279.jpg
			//   http://www.pussyspot.net/media/images/5/kelli-young/kelli-young-1154279.jpg
			domain_nosub === "pussyspot.net") {
			// https://t.imageweb.ws/media/thumbs_200/13/12813/1435652.jpg
			// https://www.imageweb.ws/media/images_640/13/lydia-reed/lydia-reed-1435652.jpg
			//   https://www.imageweb.ws/media/images/13/lydia-reed/lydia-reed-1435652.jpg
			// http://www.pussyspot.net/media/images_640/1/mandy-tyler/mandy-tyler-317777.jpg
			//   http://www.pussyspot.net/media/images/1/mandy-tyler/mandy-tyler-317777.jpg
			newsrc = src.replace(/(:\/\/)cdn[0-9]*\.([^/]*\/+media\/+images)/, "$1www.$2");
			if (newsrc !== src)
				return newsrc;

			newsrc = src.replace(/\/media\/+images_[0-9]+\//, "/media/images/");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "t.imageweb.ws" ||
			// http://www.pezporn.com/media/thumbs_60x60/1/522/24060.jpg
			//   http://www.pezporn.com/media/images/1/black-gallery-porn/black-gallery-porn-24060.jpg
			domain_nowww === "pezporn.com" ||
			// http://cdn1.pussyspot.net/media/thumbs_200/1/526/317777.jpg
			//   http://www.pussyspot.net/media/images/1/mandy-tyler/mandy-tyler-317777.jpg
			domain_nosub === "pussyspot.net") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+[^/]+\/+([0-9]+)\.html(?:[?#].*)?$/,
				query_for_id: "http://www." + domain_nosub + "/a/${id}.html",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/href="(\/media\/images\/[^"]*)"/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

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

			// https://t.imageweb.ws/media/thumbs_200/12/11108/1181579.jpg
			//   https://www.imageweb.ws/media/images/12/bree-daniels/bree-daniels-1181579.jpg
			match = src.match(/\/media\/+[^/]*\/+[0-9]+\/+[0-9]+\/+([0-9]+)\.[^/.]*/);
			if (match) {
				var queryurl = "http://www." + domain_nosub + "/a/" + match[1] + ".html";
				return {
					url: queryurl,
					is_pagelink: true
				};
			}
		}

		if (domain_nosub === "vcg.com" &&
			domain.match(/goss[0-9]*\.vcg/)) {
			// https://goss.vcg.com/editorial/vcg/800/new/VCG111152795068.jpg
			//   https://goss.vcg.com/editorial/vcg/nowarter800/new/VCG111152795068.jpg
			// https://goss2.vcg.com/editorial/vcg/800/new/VCG111152804617.jpg
			//   https://goss2.vcg.com/editorial/vcg/nowarter800/new/VCG111152804617.jpg
			// https://goss1.vcg.com/editorial/bank9/img13/midimg/47644000/tmb47644467.jpg
			//   https://goss4.vcg.com/editorial/vcg/800/version23/VCG31433662363.jpg
			//   https://goss4.vcg.com/editorial/vcg/nowarter800/version23/VCG31433662363.jpg -- doesn't work
			return src.replace(/\/editorial\/vcg\/[0-9]+\//, "/editorial/vcg/nowarter800/");
		}

		if (domain_nosub === "renault-dacia.com.ua") {
			// http://www.renault-dacia.com.ua/im.php?image=/topicsfoto/web-ruslan/385c5841f5a8ac13dfe2da13f11cd619.jpg
			//   http://www.renault-dacia.com.ua/topicsfoto/web-ruslan/385c5841f5a8ac13dfe2da13f11cd619.jpg
			// http://m.renault-dacia.com.ua/im.php?image=/topicsfoto/Aleksandr17/c51b93d8fd16eaac11e4d84dad3ebd20.jpg
			//   http://www.renault-dacia.com.ua/topicsfoto/Aleksandr17/c51b93d8fd16eaac11e4d84dad3ebd20.jpg
			newsrc = urljoin("http://www.renault-dacia.com.ua/", decodeURIComponent(src.replace(/^[a-z]+:\/\/[^/]*\/im\.php.*?[?&]image=([^&]*).*?$/, "$1")), true);
			if (newsrc !== src)
				return newsrc;

			// http://www.renault-dacia.com.ua/pictgen/100/tuneyadets/5538f9fc896e15710648bba38f922a51.jpg
			//   http://www.renault-dacia.com.ua/topicsfoto/tuneyadets/5538f9fc896e15710648bba38f922a51.jpg
			return src.replace(/\/pictgen\/[0-9]+\//, "/topicsfoto/");
		}

		if (domain_nowww === "numberoneturk.com.tr" ||
			// http://www.fashionone.com.tr/photo_gallery/plog-content/thumbs/fashion-one-fotograf-galerisi/cara-delevinge/small/34622-cara-devine-fotograflari-18.jpg
			//   http://www.fashionone.com.tr/photo_gallery/plog-content/images/fashion-one-fotograf-galerisi/cara-delevinge/cara-devine-fotograflari-18.jpg
			domain_nowww === "fashionone.com.tr") {
			// http://www.numberoneturk.com.tr/fotogaleri/plog-content/thumbs/number1-t__rk/milla-jovovich/rss/7941-milla-jojovich-0030.jpg
			//   http://www.numberoneturk.com.tr/fotogaleri/plog-content/images/number1-t__rk/milla-jovovich/milla-jojovich-0030.jpg
			return src.replace(/(\/plog-content\/+)thumbs(\/+.*\/+)[a-z]+\/+[0-9]+-([^/]*)$/, "$1images$2$3");
		}

		if (domain === "prsize.allviki.com") {
			// http://prsize.allviki.com/resize_500x284/2018/3/1522137743507.jpg
			//   http://pic.allviki.com/2018/3/1522137743507.jpg
			return src.replace(/:\/\/[^/]*\/resize_[0-9]+(?:x[0-9]+)?\//, "://pic.allviki.com/");
		}

		if (domain_nowww === "celebritygalls.com") {
			// http://celebritygalls.com/cache/Bella-Hadid-goes-topless-and-poses-nude/adorable-bella-hadid-looks-perfectly_360_cw360_ch360_thumb.jpg
			//   http://celebritygalls.com/albums/Bella-Hadid-goes-topless-and-poses-nude/adorable-bella-hadid-looks-perfectly.jpg
			return src.replace(/\/cache\/(.*)_[0-9]+_cw[0-9]+_ch[0-9]+_thumb(\.[^/.]*)$/, "/albums/$1$2");
		}

		if (domain_nowww === "instantfap.com") {
			// http://instantfap.com/image/LERREOrb.jpg
			//   https://i.imgur.com/LERREOrb.jpg
			return src.replace(/:\/\/[^/]*\/image\/([^/]*)$/, "://i.imgur.com/$1");
		}

		if (domain_nowww === "agensite.com" ||
			// http://cdn.agensite.online/img/350x350/2/0/png/arquivos/1361/conteudo/posts/538920.png -- stretched
			//   http://cdn.agensite.online/temp/img/arquivos_1361_conteudo_posts_538920_png_original__0_0__png.png?1534834767
			domain === "cdn.agensite.online" ||
			// https://cdn.conexaohost.com.br/img/250x160/4/0/png/arquivos/1650/conteudo/posts/564664.jpg
			//   https://cdn.conexaohost.com.br/img/original/0/0/png/arquivos/1650/conteudo/posts/564664.jpg
			//   https://cdn.conexaohost.com.br/temp/img/arquivos_1650_conteudo_posts_564664_jpg_original__0_0__png.png?1526996294
			//   https://cdn.conexaohost.com.br/temp/img/arquivos_1650_conteudo_posts_564664_jpg_250_160_4_0__png.png?1526996294
			domain === "cdn.conexaohost.com.br") {
			// http://www.agensite.com/img/250x160/4/0/png/arquivos/34/conteudo/posts/773919.jpg -- redirects to
			//   http://www.agensite.com/temp/img/arquivos_34_conteudo_posts_773919_jpg_250_160_4_0__png.png?1532091479 (generated)
			//   http://www.agensite.com/temp/img/arquivos_34_conteudo_posts_773919_jpg_original__4_0__png.png?1532091479
			//   http://www.agensite.com/img/original/0/0/png/arquivos/34/conteudo/posts/773919.jpg
			//   http://www.agensite.com/temp/img/arquivos_34_conteudo_posts_773919_jpg_original__0_0__png.png?1534834452
			// http://www.agensite.com/imagizer_export.php?arquivos/1144/conteudo/posts/782392.jpg,,,1,0,,jpg,arquivos/1144/marca.png,3
			return {
				url: src
					.replace(/\/img\/[0-9]+x[0-9]+\//, "/img/original/")
					.replace(/\/temp\/img\/([0-9a-z]+)_([0-9]+)_([0-9a-z]+)_([0-9a-z]+)_([0-9]+)_([a-z]+)_[^/]*$/,
							 "/img/original/0/0/png/$1/$2/$3/$4/$5.$6")
					.replace(/\/imagizer_export\.php\?([^,]*).*/, "/img/original/0/0/png/$1"),
				//.replace(/_(jpg|JPG|jpeg|JPEG|gif|GIF|png|PNG|webp|WEBP)_[0-9]+_[0-9]+(_[^/]*)$/, "_$1_original_$2"); -- generated
				redirects: true
			};
		}

		if (domain === "images.mtvnn.com") {
			// http://images.mtvnn.com/3000418a5c6621bbd16f5bb0370b9ddc/960x540.jpg
			//   http://images.mtvnn.com/3000418a5c6621bbd16f5bb0370b9ddc/original.jpg
			// http://images.mtvnn.com/f8cc799282e945d1d7d931f8d76ec7b2/630x354_.jpg
			//   http://images.mtvnn.com/f8cc799282e945d1d7d931f8d76ec7b2/original.jpg
			// http://images.mtvnn.com/2d1e2df1c0f7d1e87c3194cfc842cec7/200?fallback_id=2edca9f206f1010355e380e7793b93d4
			//   http://images.mtvnn.com/2d1e2df1c0f7d1e87c3194cfc842cec7/original
			return src.replace(/(:\/\/[^/]*\/[0-9a-f]+\/)[0-9]+(?:x[0-9]+)?_?(\.[^/.?]*)?(?:[?#].*)?$/, "$1original$2");
		}

		if (domain === "assets.deutschlandfunk.de") {
			// thanks to roi:
			// https://assets.deutschlandfunk.de/e6eff2cc-c135-4111-be91-be34a12c68ad/1920x1080.jpg?t=1682409585932
			//   https://assets.deutschlandfunk.de/e6eff2cc-c135-4111-be91-be34a12c68ad/original.jpg?t=1682409585932 -- 4000x2667
			return src.replace(/(\/[-0-9a-f]{20,}\/+)[0-9]+x[0-9]+\./, "$1original.");
		}

		if (domain_nowww === "hipernoticias.com.br" ||
			// http://www.noticiamax.com.br/storage/webdisco/2019/04/06/610x358/374036e3f4339075c3b5adfc22e9e8af.jpg
			//   http://www.noticiamax.com.br/storage/webdisco/2019/04/06/original/374036e3f4339075c3b5adfc22e9e8af.jpg
			domain_nowww === "noticiamax.com.br") {
			// http://www.hipernoticias.com.br/storage/webdisco/2018/07/10/475x210/a3bb4540fc170ea691e32ca3dc628b5c.jpg
			//   http://www.hipernoticias.com.br/storage/webdisco/2018/07/10/original/a3bb4540fc170ea691e32ca3dc628b5c.jpg
			// http://www.hipernoticias.com.br/storage/webdisco/2018/08/19/capa/default/D1/f59685cf15fbf97f354c0896dc23b95b.jpg
			//   http://www.hipernoticias.com.br/storage/webdisco/2018/08/19/original/f59685cf15fbf97f354c0896dc23b95b.jpg
			return src.replace(/(\/storage\/+webdisco\/+[0-9]+\/+[0-9]+\/+[0-9]+\/).*(\/[0-9a-f]+\.[^/.]*)$/, "$1original$2");
		}

		if (domain_nowww === "bd-journal.com") {
			// http://www.bd-journal.com/image-contents/110x73x1/news-photos/2018/08/21/aW1hZ2UtNDEwNzctMTUzNDc5MDg1Ny5qcGc=
			//   http://www.bd-journal.com/assets/news_photos/2018/08/21/image-41077-1534790857.jpg
			match = src.match(/\/image-contents\/[0-9]+x[0-9]+x[0-9]+\/news-photos\/((?:[0-9]+\/){2,})([-0-9a-zA-Z_=+]+)(?:[?#].*)?$/);
			if (match) {
				return src.replace(/(:\/\/[^/]*\/).*/, "$1") + "assets/news_photos/" + match[1] + base64_decode(match[2]);
			}
		}

		if (domain_nowww === "myidol.com.vn") {
			// http://myidol.com.vn/pictures/picsmalls/2018/08/21/200/tke1534813396.jpg
			//   http://myidol.com.vn/pictures/picfullsizes//2018/08/21/tke1534813396.jpg
			return src.replace(/\/pictures\/pic[a-z]+(\/[0-9]+\/[0-9]+\/[0-9]+\/)[0-9]+\/([a-z]+[0-9]+\.[^/.]*)$/,
							   "/pictures/picfullsizes/$1$2");
		}

		if (domain_nowww === "dw.com") {
			// https://www.dw.com/image/45139812_301.jpg -- 220x124
			//   https://www.dw.com/image/45139812_7.jpg -- 4297x2419
			return src.replace(/(:\/\/[^/]*\/image\/[0-9]+_)[0-9]+(\.[^/.]*)$/, "$17$2");
		}

		if (domain_nowww === "finds.ir") {
			// http://www.finds.ir/img/tu/2018082037083715.jpg
			//   http://www.finds.ir/img/2018082037083715.jpg
			return src.replace(/\/img\/tu\//, "/img/");
		}

		if ((domain_nosub === "xuk.mobi" ||
			 // https://img5.xuk.one/images/photos/00/04/28/04/42804/big/835b4874507210df13d36a8b3e88e843.jpg
			 //   https://img5.xuk.one/images/photos/00/04/28/04/42804/origin/835b4874507210df13d36a8b3e88e843.jpg
			 domain_nosub === "xuk.one" ||
			 // https://img5.xuk.life/images/photos/00/01/93/11/19311/thumb/bd9deb75824b5b0bf77f56c97ca0e6c9.jpg
			 //   https://img5.xuk.life/images/photos/00/01/93/11/19311/origin/bd9deb75824b5b0bf77f56c97ca0e6c9.jpg
			 // https://img5.xuk.life/images/photos/00/02/43/19/24319/mini/898e859c7169b9d97d6982c61d1c4356.jpg
			 //   https://img5.xuk.life/images/photos/00/02/43/19/24319/origin/898e859c7169b9d97d6982c61d1c4356.jpg
			 domain_nosub === "xuk.life" ||
			 // https://img2.xuk.ooo/images/photos/00/04/23/60/42360/thumb/601109edfaf6992955ddcb7416433d62.jpg
			 //   https://img2.xuk.ooo/images/photos/00/04/23/60/42360/origin/601109edfaf6992955ddcb7416433d62.jpg
			 // https://img5.xuk.ooo/images/photos/00/04/28/04/42804/big/835b4874507210df13d36a8b3e88e843.jpg
			 //   https://img5.xuk.ooo/images/photos/00/04/28/04/42804/origin/835b4874507210df13d36a8b3e88e843.jpg
			 domain_nosub === "xuk.ooo") &&
			domain.match(/^img[0-9]*\./) &&
			string_indexof(src, "/images/photos/") >= 0) {
			// https://img1.xuk.mobi/images/photos/00/01/93/25/19325/thumb/6de0aa33ad9e5d5dbcd78a1153d6bb26.jpg
			//   https://img1.xuk.mobi/images/photos/00/01/93/25/19325/origin/6de0aa33ad9e5d5dbcd78a1153d6bb26.jpg
			return src.replace(/\/(?:thumb|big|mini)\/+([0-9a-f]+\.[^/.]*)$/, "/origin/$1");
		}

		if (domain === "s.filmsextv.com") {
			// http://s.filmsextv.com/022/123/02212354b3aa0053f52/thumbs/89156254b3aa0080293.jpg
			//   http://s.filmsextv.com/022/123/02212354b3aa0053f52/89156254b3aa0080293.jpg
			return src.replace(/(\/[0-9a-f]+\/)thumbs\/([0-9a-f]+\.[^/.]*)$/, "$1$2");
		}

		if (domain_nowww === "lanita.ru" &&
			string_indexof(src, "/images/offer/") >= 0) {
			// https://lanita.ru/images/offer/15494/9/3307559/3307559-thumb.jpg
			//   https://lanita.ru/images/offer/15494/9/3307559/3307559.jpg
			return src.replace(/(\/[0-9]+)-thumb(\.[^/.]*)$/, "$1$2");
		}

		if (domain_nowww === "backalleypics.net") {
			// http://backalleypics.net/asiaargento/images/5-19-2012/thumbs/asia-argento-5-19-2012-dracula-3d-photocall-cannes-film-festival-france-1.jpg
			//   http://backalleypics.net/asiaargento/images/5-19-2012/asia-argento-5-19-2012-dracula-3d-photocall-cannes-film-festival-france-1.jpg
			// https://backalleypics.net/vanessahudgens/images/photoshoots/thumbs/vanessa-hudgens-high-quality-photoshoots_mag-scans-pic-photoshoots-addition-jan-30-2016-0030.jpg
			//   https://backalleypics.net/vanessahudgens/images/photoshoots/vanessa-hudgens-high-quality-photoshoots_mag-scans-pic-photoshoots-addition-jan-30-2016-0030.jpg
			// https://backalleypics.net/images/rotator/j/jennymccarthy/jenny-mccarthy-2008-mgm-grand-opening-party-ledyard-connecticut.jpg
			return src.replace(/(\/images\/(?:[0-9]+-[0-9]+-[0-9]+|photoshoots)\/)thumbs\/([^/]*)$/, "$1$2");
		}

		if (domain_nowww === "turboimagehost.com") {
			// https://www.turboimagehost.com/p/11906711/Asia_2.jpg.html#
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+p\/+([0-9]+)\/+([^/?#]+\.html)(?:[?#].*)?$/,
				query_for_id: "https://www.turboimagehost.com/p/${1}/${2}",
				process: function(done, resp, cache_key) {
					var image = get_meta(resp.responseText, "og:image");
					if (!image) {
						console_error(cache_key, "Unable to find og:image from", resp);
						return done(null, false);
					}

					return done({
						url: image,
						is_original: true,
						extra: {
							page: resp.finalUrl
						}
					}, 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nosub === "turboimg.net" ||
			domain_nosub === "turboimagehost.com") {
			// http://s4d3.turboimg.net/t1/11906711_Asia_2.jpg
			// http://s4d3.turboimagehost.com/t1/11906711_Asia_2.jpg
			//   https://www.turboimagehost.com/p/11906711/Asia_2.jpg.html#
			// http://s5d3.turboimagehost.com/t1/22255196_Margot-Robbie-FocPr5.jpg
			//   http://s5d3.turboimg.net/sp/d00f885d238cb0ecea6f522e9af6b124/Margot-Robbie-FocPr5.jpg
			// https://s3d3.turboimg.net/t/9449152_Ana_Paula_Araujo3.jpg
			//   https://s3d3.turboimg.net/sp/e257b07c4d358b690d74a45bbd6396ab/Ana_Paula_Araujo3.jpg
			match = src.match(/\/t[0-9]*\/+([0-9]+)_([^/?#]+)(?:[?#].*)?$/);
			if (match) {
				return {
					url: "https://www.turboimagehost.com/p/" + match[1] + "/" + match[2] + ".html",
					is_pagelink: true
				};
			}
		}

		if (domain_nowww === "arhivach.cf" ||
			// http://arhivach.ng/storage2/t/b59148eb35153b67f4fd5f508d617246.jpg
			//   http://arhivach.ng/storage2/b/59/b59148eb35153b67f4fd5f508d617246.jpg
			domain_nowww === "arhivach.ng") {
			// http://arhivach.cf/storage2/t/4c1c0a8dd754497fa95deb73e843f697.jpg
			//   http://arhivach.cf/storage2/4/c1/4c1c0a8dd754497fa95deb73e843f697.jpg
			return src.replace(/(\/storage[0-9]*\/)t\/([0-9a-f])([0-9a-f]{2})([0-9a-f]+\.[^/.]*)$/, "$1$2/$3/$2$3$4");
		}

		if (domain === "content.wafflegirl.com" ||
			// https://cdnwg.youx.xxx/galleries/gthumb/3/918/3918216_20a9a01_320x_.jpg
			//   https://cdnwg.youx.xxx/galleries/content/3/918/3918216_20a9a01.jpg
			// https://cdnxw1.youx.xxx/gthumb/2/499/2499910_384d521_320x_.jpg
			//   https://cdnxw1.youx.xxx/content/2/499/2499910_384d521.jpg
			// https://cdnxw1.youx.xxx/gthumb/2/110/2110809_7e55865_1200x1200.jpg
			domain_nosub === "youx.xxx" ||
			// https://cdncontent.xxxwaffle.com/gthumb/1/812/1812867_9141b65_300x_.jpg
			//   https://cdncontent.xxxwaffle.com/content/1/812/1812867_9141b65.jpg
			domain_nosub === "xxxwaffle.com" ||
			// https://cdn.pornpictureshq.com/galleries/gthumb/5/608/5608634_a66a64b_2400x_.jpg -- stretched
			//   https://cdn.pornpictureshq.com/galleries/content/5/608/5608634_a66a64b.jpg
			domain === "cdn.pornpictureshq.com") {
			// https://content.wafflegirl.com/galleries/gthumb/4/372/4372786_feeb209__x180.jpg
			//   https://content.wafflegirl.com/galleries/content/4/372/4372786_feeb209.jpg
			return {
				url: src.replace(/\/gthumb\/(.*)(?:__x[0-9]+|_[0-9]+x(?:[0-9]+)?_?)(\.[^/.]*)$/, "/content/$1$2"),
				can_head: false // youx.xxx returns 404
			};
		}

		if (domain_nowww === "anawalls.com") {
			// http://www.anawalls.com/repic/image.php?src=http://www.anawalls.com/images/games/fallout-equipment-look-wall.jpg&h=960&w=1080
			//   http://www.anawalls.com/images/games/fallout-equipment-look-wall.jpg
			return decodeURIComponent(src.replace(/^[a-z]+:\/\/[^/]*\/repic\/image\.php.*?[?&]src=([^&]*).*?$/, "$1"));
		}

		// xenforo
		if (domain === "d3ofq03apmfb8c.cloudfront.net" ||
			// https://www.lipstickalley.com/data/avatars/s/316/316955.jpg?1534645550
			//   https://www.lipstickalley.com/data/avatars/l/316/316955.jpg?1534645550
			domain_nowww === "lipstickalley.com" ||
			// https://cdn1-hfboards.mandatory.com/data/avatars/m/10/10860.jpg?1511299989
			//   https://cdn1-hfboards.mandatory.com/data/avatars/l/10/10860.jpg?1511299989 -- o doesn't work
			(domain_nosub === "mandatory.com" && domain.match(/^cdn[0-9]*-hfboards\./)) ||
			// https://forum.purseblog.com/data/avatars/s/655/655544.jpg?1545947410
			//   https://forum.purseblog.com/data/avatars/l/655/655544.jpg?1545947410
			domain === "forum.purseblog.com" ||
			// https://www.behindbigbrother.com/forums/data/avatars/s/39/39205.jpg?1411198307
			//   https://www.behindbigbrother.com/forums/data/avatars/o/39/39205.jpg?1411198307
			(domain_nowww === "behindbigbrother.com" && string_indexof(src, "/forums/data/") >= 0) ||
			// http://lunime.com/data/avatars/l/5/5909.jpg?1488478491
			//   http://lunime.com/data/avatars/o/5/5909.jpg?1488478491 -- doesn't work
			//domain_nowww === "lunime.com" ||
			// https://ifud.ws/data/avatars/l/14/14317.jpg?1480286766
			//   https://ifud.ws/data/avatars/o/14/14317.jpg?1480286766 -- doesn't work
			//domain_nowww === "ifud.ws" ||
			// https://simsettlements.com/site/data/avatars/m/0/288.jpg?1521204948
			//   https://simsettlements.com/site/data/avatars/l/0/288.jpg?1521204948 -- o doesn't work
			domain_nowww === "simsettlements.com" ||
			// https://www.resetera.com/data/avatar/1508889945/s/0/28.jpg
			//   https://www.resetera.com/data/avatar/1508889945/o/0/28.jpg
			domain_nowww === "resetera.com" ||
			// thanks to anonymous for reporting:
			// https://data.voz.vn/avatars/s/1772/1772739.jpg?1635062338
			//   https://data.voz.vn/avatars/o/1772/1772739.jpg?1635062338
			domain === "data.voz.vn" ||
			// thanks to TristanWasTaken on github for reporting: https://github.com/qsniyg/maxurl/issues/1289
			// https://forums.mangadex.org/community/avatars/m/387/387489.jpg?1681789858
			//   https://forums.mangadex.org/community/avatars/l/387/387489.jpg?1681789858
			//   https://forums.mangadex.org/community/avatars/h/387/387489.jpg?1681789858
			//   https://forums.mangadex.org/community/avatars/o/387/387489.jpg?1681789858
			domain === "forums.mangadex.org" ||
			// https://www.skinnygossip.com/community/data/avatars/m/0/172.jpg?1559693885
			//   https://www.skinnygossip.com/community/data/avatars/o/0/172.jpg?1559693885
			// https://www.hairlosstalk.com/interact/data/avatars/m/145/145203.jpg?1582772356
			//   https://www.hairlosstalk.com/interact/data/avatars/o/145/145203.jpg?1582772356
			//src.match(/^[a-z]+:\/\/[^/]*\/+(?:(?:community|interact)\/+)?data\/+avatars\/+[sml]\/+[0-9]+\/+[0-9]+\.[a-z]+(?:\?[0-9]+)?$/) ||
			/\/avatars\/+[smlh]\/+[0-9]+\/+[0-9]+\.jpg\?[0-9]{10}$/.test(src)) {
			// https://d3ofq03apmfb8c.cloudfront.net/data/avatars/m/121/121702.jpg?1514486539
			//   https://d3ofq03apmfb8c.cloudfront.net/data/avatars/o/121/121702.jpg?1514486539
			regex = /(\/avatar(?:s|\/+[0-9]{5,}))\/+[a-z]\/+([0-9]+\/+[0-9]+\.[^/.]*)$/;
			if (regex.test(src)) {
				return [
					src.replace(regex, "$1/o/$2"),
					src.replace(regex, "$1/l/$2")
				];
			}
		}

		// xenforo attachments
		if (/\/data\/+attachments\/+[0-9]+\/+[0-9]+-[0-9a-f]{20,}\.[^/.]+(?:[?#].*)?$/.test(src) && options.element) {
			// thanks to gtumanyan on github: https://github.com/qsniyg/maxurl/issues/494
			// https://www.hairlosstalk.com/interact/threads/exploring-the-hormonal-route-hair-life.109288/page-529#post-1870713
			// https://www.hairlosstalk.com/interact/data/attachments/121/121924-e4363f187c363ce709ae7f30680cac94.jpg
			//   https://www.hairlosstalk.com/interact/attachments/fe597f5d-b6b5-470d-bfd4-92c2a4c7fcc6-jpeg.137056/
			//
			// https://www.hairlosstalk.com/interact/threads/exploring-the-hormonal-route-hair-life.109288/post-1872339
			// https://www.hairlosstalk.com/interact/data/attachments/122/122312-682aa7084ee228ba7dc3be9f11b87215.jpg
			//   https://www.hairlosstalk.com/interact/attachments/5b33eea3-3cb2-44ee-aecb-a7875220e3ae-jpeg.137444/
			if (options.element.parentElement && options.element.parentElement.tagName === "A") {
				var parent = options.element.parentElement;
				if (parent.classList.contains("js-lbImage") && /\/attachments\/+[-0-9a-f]{20,}-(?:jpeg|png)\.[0-9]+\/*(?:[?#].*)?$/.test(parent.href)) {
					return parent.href;
				}
			}
		}

		if (domain === "img-cache.cdn.gaiaonline.com") {
			// https://img-cache.cdn.gaiaonline.com/223686233997728eb65080b4a0361ad0/http://i885.photobucket.com/albums/ac52/iDeViLPsYcHo/Rp%20characters/ccf40aa911cf5800.jpg
			return src.replace(/^[a-z]+:\/\/[^/]*\/[0-9a-f]+\//, "");
		}

		if (domain === "y.zdmimg.com") {
			// https://y.zdmimg.com/201709/01/59a8ec69cb8149731.jpg_e600.jpg
			//   https://y.zdmimg.com/201709/01/59a8ec69cb8149731.jpg
			return src.replace(/(\/[0-9a-f]+\.[^/._]*)_[a-z][0-9]+\.[^/.]*$/, "$1");
		}

		if (domain_nosub === "oboi.ws") {
			// https://oboi.ws/wallpapers/23_11236_oboi_zastavka_fallout_3_960x800.jpg
			//   https://oboi.ws/originals/original_11236_oboi_zastavka_fallout_3_1920x1200.jpg
			//   https://oboi.ws/originals/original_11236_oboi_zastavka_fallout_3.jpg -- same as above
			// https://srcc.oboi.ws/wallpapers/a_12503_oboi_el_v_snegopad.jpg
			//   https://srcc.oboi.ws/originals/original_12503_oboi_el_v_snegopad.jpg -- 2560x1600
			return src.replace(/\/wallpapers\/(?:[0-9]+|[a-z])_([0-9]+_[^/]*)(?:_[0-9]+x[0-9]+)?(\.[^/.]*)$/, "/originals/original_$1$2");
		}

		if (domain_nowww === "wallpaperscraft.com") {
			// https://wallpaperscraft.com/wallpaper/building_architecture_minimalism_192598
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+(?:download|wallpaper)\/+((?:[^/]*_)?[0-9]+)(?:\/+[0-9]+x[0-9]+)?(?:[?#].*)?$/,
				query_for_id: "https://wallpaperscraft.com/wallpaper/${id}",
				process: function(done, resp, cache_key, match) {
					var id = match[1];

					match = resp.responseText.match(/<a[^>]*\/download\/[^>]*>\s*Original Resolution: *([0-9]+x[0-9]+)/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					return done("https://images.wallpaperscraft.com/image/" + id + "_" + match[1] + ".jpg", 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "images.wallpaperscraft.com") {
			// https://images.wallpaperscraft.com/image/fallout_3_enclave_armor_2055_1152x864.jpg
			//   https://wallpaperscraft.com/download/fallout_3_enclave_armor_2055/1152x864
			//   https://wallpaperscraft.com/wallpaper/fallout_3_enclave_armor_2055
			//   https://images.wallpaperscraft.com/image/fallout_3_enclave_armor_2055_1920x1080.jpg
			id = src.replace(/.*\/([^/]*)_[0-9]+x[0-9]+\.[^/.]*$/, "$1");
			if (id !== src) {
				return {
					url: "https://wallpaperscraft.com/wallpaper/" + id,
					is_pagelink: true
				};
			}
		}

		if (domain === "cdn.eso.org" ||
			domain_nowww === "eso.org") {
			// https://cdn.eso.org/images/thumb300y/eso9925a.jpg -- 314x300
			//   https://cdn.eso.org/images/screen/eso9925a.jpg -- 1280x1223
			//   https://cdn.eso.org/images/publicationjpg/eso9925a.jpg -- 4000x3823
			//   https://cdn.eso.org/images/large/eso9925a.jpg -- 8330x7961
			// https://www.eso.org/public/archives/postcards/screen/postcard_0040.jpg -- 1280x904
			//   https://www.eso.org/public/archives/postcards/large/postcard_0040.jpg -- 2007x1417
			return src.replace(/(\/images\/|\/archives\/postcards\/)[^/]*\/([^/.]*\.[^/.]*)$/, "$1large/$2");
		}

		if (domain_nowww === "galex.caltech.edu") {
			// http://www.galex.caltech.edu/media/images/glx2009-01f_img02_Sm.jpg
			//   http://www.galex.caltech.edu/media/images/glx2009-01f_img02.jpg -- 4402x4402
			// http://www.galex.caltech.edu/media/images/glx2007-04r_img07_small.jpg
			//   http://www.galex.caltech.edu/media/images/glx2007-04r_img07.jpg -- 1569x1600
			// http://www.galex.caltech.edu/media/videos/glx2012-02r_vid01_tn.jpg
			//   http://www.galex.caltech.edu/media/videos/glx2012-02r_vid01_shot.jpg
			return src
				.replace(/(_img[0-9]*)_(?:Sm|small)(\.[^/.]*)$/, "$1$2")
				.replace(/(_vid[0-9]*)_tn(\.[^/.]*)$/, "$1_shot$2");
		}

		if (domain_nowww === "astro-austral.cl") {
			// http://www.astro-austral.cl/imagenes/galaxies/NGC1097/med.jpg
			//   http://www.astro-austral.cl/imagenes/galaxies/NGC1097/max.jpg
			return src.replace(/(\/imagenes\/galaxies\/[^/]*\/)[a-z]+(\.[^/.]*)$/, "$1max$2");
		}

		if (domain_nowww === "buddhistdoor.net") {
			// https://www.buddhistdoor.net/upload/file/20180625/17459/b0a6f633cc339d290f66e17e38bc2143_715__2.jpg
			//   https://www.buddhistdoor.net/upload/file/20180625/17459/b0a6f633cc339d290f66e17e38bc2143.jpg
			return src.replace(/(\/upload\/file\/[0-9]+\/[0-9]+\/[0-9a-f]+)_[0-9]+(?:__[0-9]+)?(\.[^/.]*)$/, "$1$2");
		}

		if (domain_nowww === "agraroldal.hu") {
			// https://www.agraroldal.hu/nodepic/370x245/16243.png
			//   https://www.agraroldal.hu/kep/730x400/16243.jpg
			//   https://www.agraroldal.hu/upload/upimages/16243.jpg -- 680x382
			return add_extensions(src.replace(/\/[^/]*\/[0-9]+x[0-9]+\/([0-9]+\.[^/.]*)$/, "/upload/upimages/$1"));
		}

		if (domain === "media.lamsao.com") {
			// https://media.lamsao.com/Thumbnail/Cache//Data//quynhnx/13062016/cach_phong_va_dieu_tri_cac_benh_thuong_gap_o_tho(1)_410_240.gif
			//   https://media.lamsao.com//Data//quynhnx/13062016/cach_phong_va_dieu_tri_cac_benh_thuong_gap_o_tho(1).gif
			return src.replace(/\/Thumbnail\/Cache\/*Data\/(.*)_[0-9]+_[0-9]+(\.[^/.]*)$/, "/Data/$1$2");
		}

		if (domain === "tupian.aladd.net") {
			// http://tupian.aladd.net/2017/8/bizhitupian1717.jpg-400246
			//   http://tupian.aladd.net/2017/8/bizhitupian1717.jpg
			return src.replace(/(\.[^-/.]*)-[0-9]+(?:[?#]*)?$/, "$1");
		}

		if (domain === "uploadfile.huiyi8.com" ||
			// https://i.hexuexiao.cn/up/6e/36/7e/920576a87ec4a7734e8a4ef9577e366e.jpg.300.jpg
			//   https://i.hexuexiao.cn/up/6e/36/7e/920576a87ec4a7734e8a4ef9577e366e.jpg
			domain === "i.hexuexiao.cn" ||
			// http://www.popwindshop.com/dna/pics/ba1d11ab/30/d3d137aea9135bd9c91.jpg.320.jpg
			//   http://www.popwindshop.com/dna/pics/ba1d11ab/30/d3d137aea9135bd9c91.jpg
			(domain_nowww === "popwindshop.com" && string_indexof(src, "/pics/") >= 0)) {
			// https://uploadfile.huiyi8.com/2014/0528/20140528094437460.jpg.270.jpg
			//   https://uploadfile.huiyi8.com/2014/0528/20140528094437460.jpg
			return src.replace(/(\.[^/.]*)\.[0-9]+\.[^/.?#]*([?#].*)?$/, "$1$2");
		}

		if ((domain_nosub === "redocn.com" && domain.match(/^img[0-9]*\./)) ||
			// http://image.tupian114.com/20130531/03240989.jpg.238.jpg
			//   http://image.tupian114.com/20130531/03240989.jpg
			domain === "image.tupian114.com") {
			// http://img3.redocn.com/20130611/Redocn_2013060816204606.jpg.285.jpg
			//   http://img3.redocn.com/20130611/Redocn_2013060816204606.jpg
			// http://img3.redocn.com/tupian/20130611/chuanheiyongyisongjiandewaiguomeinv_2101315_small.jpg
			//   http://img3.redocn.com/tupian/20130611/chuanheiyongyisongjiandewaiguomeinv_2101315.jpg -- doesn't work
			//   http://img3.redocn.com/20130611/chuanheiyongyisongjiandewaiguomeinv_2101315.jpg -- doesn't work
			return {
				url: src.replace(/(\/[^/]*\.[^/.]*)\.[0-9]+\.[^/.]*$/, "$1"),
				problems: {
					watermark: true
				}
			};
		}

		if (domain_nosub === "mangadex.org" && /\/covers\/+[-0-9a-f]{20,}\/+[-0-9a-f]{20,}[^/]+(?:[?#].*)?$/.test(src)) {
			// thanks to Steamarino on github: https://github.com/qsniyg/maxurl/issues/1003
			// https://uploads.mangadex.org/covers/304ceac3-8cdb-4fe7-acf7-2b6ff7a60613/12158456-0511-468b-be37-8d2aa3772723.png.256.jpg
			//   https://uploads.mangadex.org/covers/304ceac3-8cdb-4fe7-acf7-2b6ff7a60613/12158456-0511-468b-be37-8d2aa3772723.png
			// https://s2.mangadex.org/covers/304ceac3-8cdb-4fe7-acf7-2b6ff7a60613/12158456-0511-468b-be37-8d2aa3772723.png.256.jpg
			//   https://s2.mangadex.org/covers/304ceac3-8cdb-4fe7-acf7-2b6ff7a60613/12158456-0511-468b-be37-8d2aa3772723.png
			return {
				url: src.replace(/(\.[^/.]*)\.[0-9]+\.[^/.?#]*([?#].*)?$/, "$1$2"),
				can_head: false // 404
			};
		}

		if (domain === "media.alienwarearena.com") {
			// https://media.alienwarearena.com/thumbnail_630x315/8c559ad4f9e3a06173ff22db75ac65c8.jpg
			//   https://media.alienwarearena.com/media/8c559ad4f9e3a06173ff22db75ac65c8.jpg
			// https://media.alienwarearena.com/thumb_720x405/250729179afb7d6fb923e45df7dd851b.jpg
			//   https://media.alienwarearena.com/media/250729179afb7d6fb923e45df7dd851b.jpg
			return src.replace(/\/thumb(?:nail)?_[0-9]+x[0-9]+\/+([0-9a-f]{10,}\.[^/.]*)$/, "/media/$1");
		}

		if (domain_nowww === "6asian.com") {
			// http://6asian.com/imglink/japanpic-thumb265x385/29/0000029503/001.jpg
			//   http://6asian.com/imglink/japanpic/29/0000029503/001.jpg
			return src.replace(/(\/imglink\/[a-z]+)-thumb[0-9]+x[0-9]+\//, "$1/");
		}

		if (domain === "music.fetnet.net") {
			// http://music.fetnet.net/img/album/1482127-202.jpg
			//   http://music.fetnet.net/img/album/1482127.jpg
			return src.replace(/(\/img\/album\/[0-9]+)-[0-9]+(\.[^/.]*)$/, "$1$2");
		}

		if (domain_nowww === "wallpaperscave.ru") {
			// https://wallpaperscave.ru/images/thumbs/category/355x200/17/11-15/fantasy-deer-401.jpg
			//   https://wallpaperscave.ru/images/thumbs/wp-preview/800x500/17/11-15/fantasy-deer-401.jpg
			//   https://wallpaperscave.ru/images/original/17/11-15/fantasy-deer-401.jpg
			return src.replace(/\/images\/thumbs\/[^/]*\/[0-9]+x[0-9]+\//, "/images/original/");
		}

		if (domain_nowww === "lilit.lv") {
			// http://lilit.lv/_mm/profiles/77501/180px_77560_9909613368.jpg
			//   http://lilit.lv/_mm/profiles/77501/full_77560_9909613368.jpg
			// http://lilit.lv/_mm/profiles/51501/48px_51853_57bf3c8383.jpg
			//   http://lilit.lv/_mm/profiles/51501/full_51853_57bf3c8383.jpg
			return src.replace(/\/[0-9]+px_([0-9]+_[0-9a-f]+\.[^/.]*)$/, "/full_$1");
		}

		if (domain === "img.kurocore.com") {
			// https://img.kurocore.com/thumbnail/p/46000000/46718000/46718715_0.png
			//   https://img.kurocore.com/p/46000000/46718000/46718715_0.png
			return src.replace(/(:\/\/[^/]*\/)thumbnail\/p\//, "$1p/");
		}

		if (domain_nowww === "mocah.org") {
			// https://mocah.org/thumbs/4600162-suspension-bridge-golden-gate-bridge-bridge-river.jpg
			//   https://mocah.org/uploads/posts/4600162-suspension-bridge-golden-gate-bridge-bridge-river.jpg -- 5332x3725
			return src.replace(/(:\/\/[^/]*\/)thumbs\/([0-9]+-[^/]*)$/, "$1uploads/posts/$2");
		}

		if (domain_nowww === "anime-zone.ru") {
			// http://www.anime-zone.ru/inc/goods_wallpapers/nagi_no_asukara/small/nagi_no_asukara12.jpg
			//   http://www.anime-zone.ru/inc/goods_wallpapers/nagi_no_asukara/nagi_no_asukara12.jpg
			return src.replace(/(\/inc\/goods_[a-z]+\/[^/]*\/)[a-z]+\/([^/]*)$/, "$1$2");
		}

		if (domain_nowww === "99px.ru") {
			// https://99px.ru/sstorage/53/2018/08/mid_234704_705818.jpg
			//   https://wallpapers.99px.ru/cms/mhost.php?tid=53&act=getimage&id=234704
			return src.replace(/:\/\/[^/]*\/sstorage\/[0-9]+\/[0-9]+\/[0-9]+\/[a-z]+_([0-9]+)_[0-9]+\.[^/.]*$/,
							   "://wallpapers.99px.ru/cms/mhost.php?tid=53&act=getimage&id=$1");
		}

		if (domain_nowww === "wall2born.com") {
			// http://wall2born.com/file/download/480x272/670/image-44639280-bleach-pictures-and-wallpaper-480x272.jpg
			//   http://wall2born.com/data/out/670/image-44639280-bleach-pictures-and-wallpaper.jpg
			return src.replace(/\/file\/download\/[0-9]+x[0-9]+\/([0-9]+\/[^/]*)-[0-9]+x[0-9]+(\.[^/.]*)$/,
							   "/data/out/$1$2");
		}

		if (domain_nowww === "wallpapersexpert.com") {
			// http://wallpapersexpert.com/images/file/9/400x300-3337148-selena-gomez-wallpapers.jpg
			//   http://wallpapersexpert.com/data/out/9/3337148-selena-gomez-wallpapers.jpg
			return src.replace(/\/images\/+file\/+([0-9]+\/+)[0-9]+x[0-9]+-([0-9]+-)/, "/data/out/$1$2");
		}

		if (amazon_container === "desktop-backgrounds-org") {
			// http://desktop-backgrounds-org.s3.amazonaws.com/iphone4-640x960/bleach-anime_0.jpg
			//   http://desktop-backgrounds-org.s3.amazonaws.com/400x300/bleach-anime_0.jpg
			//   http://desktop-backgrounds-org.s3.amazonaws.com/bleach-anime_0.jpg
			return src.replace(/\/(?:[^-/]*-)?[0-9]+x[0-9]+\/([^/]*\.[^/.]*)$/, "/$1");
		}

		if (domain_nowww === "oboi.cc" ||
			// http://oboik.ru/uploads_full/11_05_2013/view/201209/oboik.ru_28819.jpg
			//   http://oboik.ru/uploads/11_05_2013/view/201209/oboik.ru_28819.jpg
			domain_nowww === "oboik.ru") {
			// http://oboi.cc/uploads/11_05_2013/thrumb/201209/oboik.ru_28819.jpg
			//   http://oboi.cc/uploads/11_05_2013/view/201209/oboik.ru_28819.jpg
			// http://oboi.cc/uploads_full/11_05_2013/view/201209/oboik.ru_11834.jpg
			//   http://oboi.cc/640-960-100-uploads/11_05_2013/view/201209/oboik.ru_11834.jpg
			//   http://oboi.cc/uploads/11_05_2013/view/201209/oboik.ru_11834.jpg
			return src.replace(/\/(?:[-0-9]+)?uploads(?:_full)?(\/[0-9]+_[0-9]+_[0-9]+\/)[a-z]+(\/[0-9]+\/[^/]*)$/,
							   "/uploads$1view$2");
		}

		if (domain === "img.getbg.net") {
			// https://img.getbg.net/upload/thumbnail/8/thumbnail_373017_devushka_krasnye_1680x1050_(www.GetBg.net).jpg
			//   https://img.getbg.net/upload/full/8/373017_devushka_krasnye_1680x1050_(www.GetBg.net).jpg
			// https://img.getbg.net/upload/small/8/373053_devochka_kukla_nakidka_povyazka_forma_1680x1050_(www.GetBg.net).jpg
			//   https://img.getbg.net/upload/full/8/373053_devochka_kukla_nakidka_povyazka_forma_1680x1050_(www.GetBg.net).jpg
			// https://img.getbg.net/upload/thumbnail/14/thumbnail_www.GetBg.net_Girls_Models_Models_M_Mandy_Moore_033567_.jpg
			//   https://img.getbg.net/upload/full/14/www.GetBg.net_Girls_Models_Models_M_Mandy_Moore_033567_.jpg
			return src.replace(/\/upload\/[a-z]+\/([0-9]*\/)(?:thumbnail_)?([^/]*)$/,
							   "/upload/full/$1$2");
		}

		if ((domain_nosub === "fichub.com" ||
			 // https://scontent.ccdn.cloud/image/allsongs/8fa288f8-e322-4de4-a5df-9403982a45e7/selena-gomez-lookbook-3-maxw-250.jpg
			 //   https://scontent.ccdn.cloud/image/allsongs/8fa288f8-e322-4de4-a5df-9403982a45e7/selena-gomez-lookbook-3.jpg
			 domain === "scontent.ccdn.cloud")
			&& string_indexof(src, "/image/") >= 0) {
			// https://cc-media-foxit.fichub.com/image/fox-it-life/b468e9df-a238-476c-83c4-e6b279deb76f/anthony-bourdain-e-asia-argento-maxw-654.jpg
			//   https://cc-media-foxit.fichub.com/image/fox-it-life/b468e9df-a238-476c-83c4-e6b279deb76f/anthony-bourdain-e-asia-argento.jpg
			// https://cc-media-foxit.fichub.com/image/fox-it-life/ea0e5584-d47d-44b1-9afb-c3303787cefd/953895948-114x76.jpg
			//   https://cc-media-foxit.fichub.com/image/fox-it-life/ea0e5584-d47d-44b1-9afb-c3303787cefd/953895948.jpg
			// https://cc-media-foxit.fichub.com/image/fox-it-life/f106ec8d-7b94-461d-8a58-1956e84e11a4/max/390x506.jpg
			//   https://cc-media-foxit.fichub.com/image/fox-it-life/f106ec8d-7b94-461d-8a58-1956e84e11a4/max.jpg
			// https://cc-media-foxit.fichub.com/image/floptv/a58c431e-5c09-4ea2-a3b3-13def20c13d1/gta-4-copertina-216x122.jpg
			//   https://cc-media-foxit.fichub.com/image/floptv/a58c431e-5c09-4ea2-a3b3-13def20c13d1/gta-4-copertina.jpg
			return src.replace(/(\/image\/+[^/]+\/+[-0-9a-f]{30,}\/+[^/]+?)(?:-(?:maxw-[0-9]+|[0-9]+x[0-9]+))?(?:\/+[0-9]+x[0-9]+)?(\.[^/.]*)$/,
							   "$1$2");
		}

		if (domain_nowww === "nishinippon.co.jp" && string_indexof(src, "/import/") >= 0) {
			// https://www.nishinippon.co.jp/import/showbiz_news/20180821/201808210001_001_s.jpg?1534811525
			//   https://www.nishinippon.co.jp/import/showbiz_news/20180821/201808210001_001.jpg?1534811525
			return src.replace(/(\/[0-9]+\/[0-9]+_[0-9]+)_s(\.[^/.]*)$/, "$1$2");
		}

		if (domain_nowww === "nishinippon.co.jp") {
			// https://www.nishinippon.co.jp/uploads/image/242737/small_835e982344.jpg -- 120x110
			//   https://www.nishinippon.co.jp/uploads/image/242737/middle_835e982344.jpg -- 320x293
			//   https://www.nishinippon.co.jp/uploads/image/242737/large_835e982344.jpg -- 670x613
			//   https://www.nishinippon.co.jp/uploads/image/242737/835e982344.jpg -- 1000x915
			//   https://www.nishinippon.co.jp/uploads/image/242737/835e982344_org.jpg -- doesn't work
			// https://www.nishinippon.co.jp/uploads/image/137494/middle_e9e1befdc1_org.jpg
			//   https://www.nishinippon.co.jp/uploads/image/137494/e9e1befdc1_org.jpg -- 640x427
			//   https://www.nishinippon.co.jp/uploads/image/137494/e9e1befdc1.jpg -- doesn't work
			// other:
			// https://www.nishinippon.co.jp/uploads/image/139445/6d7f7acba6.jpg -- 1766x1719
			// https://www.nishinippon.co.jp/uploads/image/236462/0bca901503.jpg -- 4758x2595
			return src.replace(/(\/uploads\/+image\/+[0-9]+\/+)[a-z]+_([0-9a-f]{6,}(?:_org)?\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "resource.shuud.mn") {
			// http://resource.shuud.mn/shuud/image/2018/08/22/xeu7elkamwgwtpz9/01_t.jpg
			//   http://resource.shuud.mn/shuud/image/2018/08/22/xeu7elkamwgwtpz9/01.jpg
			return src.replace(/(\/[0-9]+)_t(\.[^/.]*)$/, "$1$2");
		}

		if (domain_nowww === "anime-fresh.ru") {
			// https://anime-fresh.ru/upload/anime/thumbs/Re__Zero_kara_Hajimeru_Isekai_Seikatsu.jpg
			//   https://anime-fresh.ru/upload/anime/Re__Zero_kara_Hajimeru_Isekai_Seikatsu.jpg
			return src.replace(/(\/upload\/[a-z]+\/)thumbs\/([^/]*)$/, "$1$2");
		}

		if (domain === "imgfiles.plaync.com") {
			// http://imgfiles.plaync.com/file/BladeNSoul/download_thumbnail/20160912221145-ry9tUQKyoplI1QVtfPJB0-v4
			//   http://imgfiles.plaync.com/file/BladeNSoul/download/20160912221145-ry9tUQKyoplI1QVtfPJB0-v4
			return src.replace(/\/download_thumbnail\/([^/]*)$/, "/download/$1");
		}

		if (domain_nowww === "jjdao.com") {
			// http://www.jjdao.com/wiki/uploads/201612/1481781787amEjHAln_s.jpg
			//   http://www.jjdao.com/wiki/uploads/201612/1481781787amEjHAln.jpg
			return src.replace(/(\/wiki\/uploads\/[0-9]+\/[0-9+][0-9a-zA-Z]+)_[a-z](\.[^/.]*)$/, "$1$2");
		}

		if (domain === "t.huv.kr") {
			// http://t.huv.kr/thumb_crop_resize.php?url=http://down.humoruniv.org//hwiparambbs/data/editor/thema2/e_4718647921_fdfa6592069e332859cc96ab65d89710621d1309.jpg?SIZE=540x431
			//   http://down.humoruniv.org//hwiparambbs/data/editor/thema2/e_4718647921_fdfa6592069e332859cc96ab65d89710621d1309.jpg
			return decodeURIComponent(src.replace(/^[a-z]+:\/\/[^/]*\/thumb_crop_resize\.php.*?[?&]url=([^&?]*).*?$/, "$1"));
		}

		if (domain === "down.humoruniv.org") {
			// http://down.humoruniv.org//hwiparambbs/data/editor/thema2/e_4718647921_fdfa6592069e332859cc96ab65d89710621d1309.jpg -- 403 if referer is wrong
			return {
				url: src,
				headers: {
					Referer: ""
				}
			};
		}

		if (domain_nosub === "pocoimg.cn" &&
			domain.match(/^img[0-9]*\./)) {
			// http://img1001.pocoimg.cn/image/poco/works/26/2014/0829/09/17334845920140829094638013_173348459_W120.jpg
			//   http://img1001.pocoimg.cn/image/poco/works/26/2014/0829/09/17334845920140829094638013_173348459.jpg
			return src.replace(/_[WH][0-9]+(\.[^/.]*)$/, "$1");
		}

		if (domain_nowww === "qcmt.bid") {
			// http://www.qcmt.bid/upload/?src=http://ww4.sinaimg.cn/mw690/81309c56jw1f03kbkfyyyj20hs0qowhm.jpg&w=250&h=380&q=90
			//   http://ww4.sinaimg.cn/mw690/81309c56jw1f03kbkfyyyj20hs0qowhm.jpg
			return decodeURIComponent(src.replace(/^[a-z]+:\/\/[^/]*\/upload\/.*?[?&]src=([^&]*).*?$/, "$1"));
		}

		if (domain === "pic.xiao4j.com") {
			// http://pic.xiao4j.com/upload/meinv/2017_1107/162158625.jpg_330_528.jpg
			//   http://pic.xiao4j.com/upload/meinv/2017_1107/162158625.jpg
			return src.replace(/(\/[0-9]+\.[^/._]*)_[0-9]+_[0-9]+\.[^/.]*$/, "$1");
		}

		if (domain === "img.mm29.com") {
			// http://img.mm29.com/images/2017/02/17/1487303840274.jpg/800.jpg -- 800x1200
			//   http://img.mm29.com/images/2017/02/17/1487303840274.jpg -- 800x1200, no watermark
			return src.replace(/(\/[0-9]+\.[^/.]*)\/[0-9]+\.[^/.]*$/, "$1");
		}

		if (domain_nosub === "2chmatome2.jp" &&
			domain.match(/^image[0-9]*\./)) {
			// http://image2.2chmatome2.jp/v2/thumb/app/700/700/?url=http%3A%2F%2Ffile.2chmatome2.jp%2Fhttp%25253A%25252F%25252Flivedoor.blogimg.jp%25252Frabitsokuhou%25252Fimgs%25252Fc%25252F9%25252Fc98c3133-s.jpg&page_url=http%3A%2F%2Frabitsokuhou.2chblog.jp%2Farchives%2F68718395.html&site_url=http%3A%2F%2Frabitsokuhou.2chblog.jp%2F
			//   http://file.2chmatome2.jp/http%253A%252F%252Flivedoor.blogimg.jp%252Frabitsokuhou%252Fimgs%252Fc%252F9%252Fc98c3133-s.jpg
			return decodeURIComponent(src.replace(/^[a-z]+:\/\/[^/]*\/v2\/thumb\/app\/[0-9]+\/[0-9]+\/.*?[?&]url=([^&]*).*?$/, "$1"));
		}

		if (domain === "file.2chmatome2.jp") {
			// http://file.2chmatome2.jp/http%253A%252F%252Flivedoor.blogimg.jp%252Frabitsokuhou%252Fimgs%252Fc%252F9%252Fc98c3133-s.jpg
			//   http://livedoor.blogimg.jp/rabitsokuhou/imgs/c/9/c98c3133.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/(http)/, "$1");
			if (newsrc !== src) {
				return decodeURIComponent(decodeURIComponent(newsrc));
			}
		}

		if (domain_nowww === "wnacg.net") {
			// https://www.wnacg.net/data/thumb/0329/27/053.jpg
			//   https://www.wnacg.net/data/0329/27/053.jpg -- 1200x1800
			return src.replace(/\/data\/thumb\//, "/data/");
		}

		if (domain === "rs.n1info.com") {
			// https://rs.n1info.com/Thumbnail/210745/jpeg/063_927262244.jpg -- 131x197
			//   https://rs.n1info.com/Picture/210745/jpeg/063_927262244.jpg -- 667x1000
			return src.replace(/\/Thumbnail(\/[0-9]+\/)/, "/Picture$1");
		}

		if (domain_nowww === "adevarul.ro" && string_indexof(src, "/MRImage/") >= 0) {
			// https://adevarul.ro/assets/adevarul.ro/MRImage/2018/03/05/5a9ce47ddf52022f75399776/978x0.jpg
			//   https://adevarul.ro/assets/adevarul.ro/MRImage/2018/03/05/5a9ce47ddf52022f75399776/orig.jpg -- 1000x1500
			return src.replace(/\/[0-9]+x[0-9]+(\.[^/.]*)$/, "/orig$1");
		}

		if (domain_nowww === "eva.bg") {
			// https://eva.bg/media_cache/blitz_photo/media/ZVEZDI/Novini/hijklmno/lupita_18_june1.jpg -- 400x601
			//   https://eva.bg/media/ZVEZDI/Novini/hijklmno/lupita_18_june1.jpg -- 740x1112
			return src.replace(/\/media_cache\/[^/]*\/media\//, "/media/");
		}

		if (domain === "data.kontrakty.ua") {
			// http://data.kontrakty.ua/cache/photo/1000/29977.jpg -- stretched
			//   http://data.kontrakty.ua/cache/photo/orig/29977.jpg -- 575x790
			// http://data.kontrakty.ua/cache/www/4500/images/stories/fotos/2010/04/1week/dollar100_new.jpg -- 4500x3370, stretched
			//   http://data.kontrakty.ua/cache/www/orig/images/stories/fotos/2010/04/1week/dollar100_new.jpg -- 450x337
			return src.replace(/(\/cache\/[a-z]+\/)[0-9]+\//, "$1orig/");
		}

		if (domain === "d3t543lkaz1xy.cloudfront.net") {
			// forces download
			// https://d3t543lkaz1xy.cloudfront.net/photo/5ae9d63898c1590e44a2fdb0_m -- 400x647
			//   https://d3t543lkaz1xy.cloudfront.net/photo/5ae9d63898c1590e44a2fdb0 -- 1000x1618
			return src.replace(/(\/photo\/[0-9a-f]+)_[a-z](?:[?#].*)?$/, "$1");
		}

		if (domain_nowww === "merokhabar.net") {
			// http://www.merokhabar.net/public/images/news/2015-07-31/thumbnail/thumbvtx1438282047fashion-show-2.jpg -- 67x100
			//   http://www.merokhabar.net/public/images/news/2015-07-31/original/orivtx1438282047fashion-show-2.jpg -- 1500x2254
			return src.replace(/\/thumbnail\/thumb([^/]*)$/, "/original/ori$1");
		}

		if (domain_nosub === "ali213.net" &&
			domain.match(/^img[0-9]*\./)) {
			// http://img2.ali213.net/picfile/News/2018/04/24/584_2018042415051896.jpg -- 584x945
			//   http://img2.ali213.net/picfile/News/2018/04/24/2018042415051896.jpg -- 741x1200
			return src.replace(/\/[0-9]+_([0-9]+\.[^/.]*)$/, "/$1");
		}

		if (domain === "cdn.magzter.com" ||
			// https://magztertemp.s3.amazonaws.com/1370943257/1456368547/images/thumb/thumb_1.jpg
			//   https://magztertemp.s3.amazonaws.com/1370943257/1456368547/images/original/large_1.jpg
			amazon_container === "magztertemp") {
			// http://cdn.magzter.com/1370943257/1456368547/images/thumb/thumb_1.jpg
			//   http://cdn.magzter.com/1370943257/1456368547/images/original/large_1.jpg
			newsrc = src.replace(/\/images\/+thumb\/+thumb_([0-9]+\.[^/.]+)(?:[?#].*)?$/, "/images/original/large_$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "reseuro.magzter.com" ||
			// https://rse.magzter.com/250x300/1462317978/1524856966/images/thumb/ebony-june-2018.jpg
			//   https://cdn.magzter.com/1462317978/1524856966/images/thumb/ebony-june-2018.jpg
			// https://cdn.magzter.com/1462317978/1524856966/images/thumb/390_thumb_1.jpg
			//   https://maghtml.magzter.com/data/13294/1524856966/jpg/1.jpg
			domain === "rse.magzter.com") {
			// https://reseuro.magzter.com/1843x2390/articles/1586/225398/59312259acd64/Sonam-Kapoor.jpg
			//   https://magarticles.magzter.com/articles/1586/225398/59312259acd64/Sonam-Kapoor.jpg
			return src
				.replace(/:\/\/[^/]*\/[0-9]+x[0-9]+\/articles\//, "://magarticles.magzter.com/articles/")
				.replace(/:\/\/rse\.[^/]*\/[0-9]+x[0-9]+\//, "://cdn.magzter.com/");
		}

		if (domain === "dev.magzter.com") {
			// https://dev.magzter.com/dynimage/thumb_news.php?src=http://www.dailyexcelsior.com/wp-content/uploads/2017/07/ZULFKAR-30.jpg&h=1787&w=4749&a=t&c=b
			//   https://dev.magzter.com/dynimage/thumb_news.php?src=http://www.dailyexcelsior.com/wp-content/uploads/2017/07/ZULFKAR-30.jpg&h=1787&w=4749&a=t&c=b
			return decodeURIComponent(src.replace(/^[a-z]+:\/\/[^/]*\/dynimage\/thumb_news\.php.*?[?&]src=([^&]*).*$/, "$1"));
		}

		if (domain === "content.haycdn.com" ||
			// https://images.hayneedle.com/mgen/dynimage.ms?img=inuse:TTLC652.jpg&w=540&h=648&zoom=1.4&posx=-40
			//   https://images.hayneedle.com/mgen/inuse:TTLC652.jpg
			domain === "images.hayneedle.com") {
			// https://content.haycdn.com/mgen/dynimage.ms?img=inuse:TTLC652.jpg&w=540&h=648&zoom=1.4&posx=-40
			//   https://content.haycdn.com/mgen/inuse:TTLC652.jpg
			// https://content.haycdn.com/mgen/master:TTLC652.jpg?is=600,600,0xffffff
			//   https://content.haycdn.com/mgen/master:TTLC652.jpg
			return src
				.replace(/\/dynimage\.ms\?(?:.*&)?img=([^&]+).*?$/, "/$1")
				.replace(/\?is=.*/, "");
		}

		if (domain === "img.bulawayo24.com") {
			// http://img.bulawayo24.com/articles/thumbs/187x105/danai_ebony.jpg
			//   http://img.bulawayo24.com/articles/danai_ebony.jpg
			return src.replace(/\/articles\/thumbs\/[0-9]+x[0-9]+\//, "/articles/");
		}

		if (domain === "static.eva.ro") {
			// https://static.eva.ro/img/auto_resized/db/article/161/215/472963l-1280x1280-b-b4a1c2c8.jpg
			//   https://static.eva.ro/img/db/article/161/215/472963l.jpg
			// https://static.eva.ro/img/auto_resized/db/article/075/429/737028l-640x0-w-3a540bf5.jpg -- 640x480
			//   https://static.eva.ro/img/db/article/075/429/737028l.jpg -- 875x657
			return src.replace(/\/img\/auto_resized\/db\/(.*)-[0-9]+x[0-9]+(?:-.-[0-9a-f]+)?(\.[^/.]*)$/, "/img/db/$1$2");
		}

		if (domain === "s-image.hnol.net") {
			// https://s-image.hnol.net/x/300x0/auto/http:/image.hnol.net/c/2014-01/07/10/201401071005511497-2381913.jpg
			//   http://image.hnol.net/c/2014-01/07/10/201401071005511497-2381913.jpg
			return src.replace(/^[a-z]+:\/\/[^/]*\/x\/[0-9]+x[0-9]+\/auto\/(https?):\/\/?/, "$1://");
		}

		if (domain === "cdn.tower.jp") {
			// http://cdn.tower.jp/za/m/92/791154050392.jpg -- 120x120
			//   http://cdn.tower.jp/za/o/92/791154050392.jpg -- 1624x1443
			// https://cdn.tower.jp/za/m/7W/zaP2_G2904027W.JPG
			//   https://cdn.tower.jp/za/o/7W/zaP2_G2904027W.JPG -- 300x300
			return src.replace(/(:\/\/[^/]*\/za\/)[a-z]\//, "$1o/");
		}

		if (domain_nowww === "gamers-onlineshop.jp" ||
			// https://www.animate-onlineshop.jp/resize_image.php?image=12251336_5a40804200b2d.jpg&width=364
			//   https://www.animate-onlineshop.jp/upload/save_image/12251336_5a40804200b2d.jpg -- 800x793
			domain_nowww === "animate-onlineshop.jp" ||
			// http://acoop-onlineshop.jp/resize_image.php?image=04281047_57216b9a96fc9.jpg&width=160&height=160
			//   http://acoop-onlineshop.jp/upload/save_image/04281047_57216b9a96fc9.jpg
			domain_nowww === "acoop-onlineshop.jp" ||
			// https://cdn.melonbooks.co.jp/user_data/packages/resize_image.php?image=213001022722.jpg
			//   https://cdn.melonbooks.co.jp/upload/save_image/213001022722.jpg
			domain === "cdn.melonbooks.co.jp" ||
			// https://www.melonbooks.co.jp/resize_image.php?image=213001018798.jpg&width=320&height=320
			//   https://www.melonbooks.co.jp/upload/save_image/213001018798.jpg
			domain_nowww === "melonbooks.co.jp" ||
			// https://jpstore.dwango.jp/resize_image.php?image=01311252_58900a1559f60.jpg&width=144&height=91
			//   https://jpstore.dwango.jp/upload/save_image/01311252_58900a1559f60.jpg
			domain === "jpstore.dwango.jp" ||
			// thanks to fireattack on discord:
			// https://www.gamers.co.jp/resize_image.php?image=01071102_5e13e6d0b80e3.jpg
			domain_nowww === "gamers.co.jp" ||
			// thanks to fireattack on discord:
			// https://tc-animate.techorus-cdn.com/resize_image/resize_image.php?image=09242110_614dc03b661cc.jpg&width=300&height=300&square=1
			//   https://tc-animate.techorus-cdn.com/resize_image/resize_image.php?image=09242110_614dc03b661cc.jpg
			//   https://tc-animate.techorus-cdn.com/upload/save_image/09242110_614dc03b661cc.jpg
			// https://tc-gamers.techorus-cdn.com/resize_image/resize_image.php?image=02040958_61fc7a223d623.jpg
			//   https://tc-gamers.techorus-cdn.com/upload/save_image/02040958_61fc7a223d623.jpg
			(domain_nosub === "techorus-cdn.com" && /^tc-/.test(domain)) ||
			// https://melonbooks.akamaized.net/user_data/packages/resize_image.php?image=216001013898.jpg&width=225&height=317&c=0&aa=0 -- 225x223
			//   https://melonbooks.akamaized.net/user_data/packages/resize_image.php?image=216001013898.jpg -- 700x694
			//   https://melonbooks.akamaized.net/upload/save_image/216001013898.jpg -- 700x694
			domain === "melonbooks.akamaized.net") {
			// https://www.gamers-onlineshop.jp/resize_image.php?image=01231144_5a66a18ea6340.jpg&width=165&height=165&age_limit=&sex_characteristic=&image_display_restriction=0&warning_restriction=0
			//   https://www.gamers-onlineshop.jp/upload/save_image/01231144_5a66a18ea6340.jpg -- 300x297
			return src.replace(/(:\/\/[^/]*\/)(?:(?:user_data\/packages|resize_image)\/)?resize_image\.php.*?[?&]image=([^&]*).*$/, "$1upload/save_image/$2");
			//return src.replace(/(\/user_data\/packages\/resize_image\.php).*?[?&]image=([^&]*).*?$/, "$1?image=$2");
		}

		if (domain_nowww === "hmv.com.hk") {
			// https://www.hmv.com.hk/data/upload/220/goods_photos/2018-04-11/5ace05b8b2637.jpg
			//   https://www.hmv.com.hk/data/upload/goods_photos/2018-04-11/5ace05b8b2637.jpg -- 500x496
			return src.replace(/\/data\/upload\/[0-9]+\//, "/data/upload/");
		}

		if (domain === "img.hmv.co.jp") {
			// thanks to Urkchar on discord
			// https://img.hmv.co.jp/image/backimage.gif
			if (/\/image\/+backimage\.gif(?:[?#].*)?$/.test(src))
				return {
					url: src,
					bad: "mask"
				};
		}

		if (domain_nowww === "buysmartjapan.com") {
			// https://www.buysmartjapan.com/images/a59a9d8e5bfb26d558780441a0ad1152?original=https%3A%2F%2Fmelonbooks.akamaized.net%2Fuser_data%2Fpackages%2Fresize_image.php%3Fimage%3D213001024963.jpg%26width%3D450%26height%3D450
			//   https://melonbooks.akamaized.net/user_data/packages/resize_image.php?image=213001024963.jpg&width=450&height=450
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/images\/[0-9a-f]+.*?[?&]original=([^&]*).*$/, "$1");
			if (newsrc !== src)
				return decodeURIComponent(newsrc);
		}

		if (domain_nowww === "sonymusic.co.jp") {
			// http://www.sonymusic.co.jp/adm_image/common/artist_image/70007000/70007036/jacket_image/164900__240_240_0.jpg -- 240x238
			//   http://www.sonymusic.co.jp/adm_image/common/artist_image/70007000/70007036/jacket_image/164900.jpg -- 600x595
			return src.replace(/(\/adm_image\/common\/.*)__[0-9]+_[0-9]+_[0-9]+(\.[^/.]*)$/, "$1$2");
		}

		if (domain_nosub === "imageban.ru" &&
			domain.match(/^i[0-9]*\./)) {
			// http://i5.imageban.ru/thumbs/2018.01.31/e4aa3be93fac2bdf3be5247651ff560c.jpg -- 400x397
			//   http://i5.imageban.ru/out/2018/01/31/e4aa3be93fac2bdf3be5247651ff560c.jpg -- 1000x992
			return src.replace(/(:\/\/[^/]*\/)thumbs\/([0-9]+)\.([0-9]+)\.([0-9]+)\/([0-9a-f]+\.[^/.]*)$/, "$1out/$2/$3/$4/$5");
		}

		if (domain === "image.hackadoll.com") {
			// http://image.hackadoll.com/thumbs?h=480&of=jpeg&u=https%3A%2F%2Fimages-na.ssl-images-amazon.com%2Fimages%2FI%2F81IgPIGF6KL._SX500_.jpg&w=480&s=251c265914eb90230ac4e8ee87c060ef&t=1516684897
			//   https://images-na.ssl-images-amazon.com/images/I/81IgPIGF6KL._SX500_.jpg
			return decodeURIComponent(src.replace(/^[a-z]+:\/\/[^/]*\/thumbs.*?[?&]u=([^&]*).*$/, "$1"));
		}

		if (domain === "images.niooz.fr") {
			// http://images.niooz.fr/safe_image.php?width=500&i=/cache/mediaid/2/5/1/8/7/2/25187296.jpg
			//   http://images.niooz.fr/cache/mediaid/2/5/1/8/7/2/25187296.jpg
			return urljoin(src, decodeURIComponent(src.replace(/^[a-z]+:\/\/[^/]*\/safe_image\.php.*?[?&]i=([^&]*).*$/, "$1")), true);
		}

		if (domain_nowww === "mengchongzhi.com") {
			// https://www.mengchongzhi.com/uploadfile/thumb/1f/0a869870.jpg
			//   https://www.mengchongzhi.com/uploadfile/1f/0a869870.jpg
			return src.replace(/\/uploadfile\/thumb\//, "/uploadfile/");
		}

		if (domain_nowww === "playground33.com") {
			// http://www.playground33.com/uploads/4/3/2/3/43233663/9781367.jpg -- 400x603
			//   http://www.playground33.com/uploads/4/3/2/3/43233663/9781367_orig.jpg -- 497x750
			return src.replace(/(\/uploads\/(?:[0-9]\/){4}[0-9]+\/[0-9]+)(\.[^/.]*)$/, "$1_orig$2");
		}

		if (domain_nosub === "trends.com.cn" &&
			domain.match(/^cdn[0-9]*\./)) {
			// http://cdn7.trends.com.cn/Fni7F2z66cOlb3SeBCiWk5Fbz7jU-tweb.album.jpeg -- 480x721
			//   http://cdn7.trends.com.cn/Fni7F2z66cOlb3SeBCiWk5Fbz7jU -- 1160x1742
			// http://cdn7.trends.com.cn/FoNOlkPcSWJtouTkWrxKl9GKBKhZ-tweb.list.jpeg -- 320x320
			//   http://cdn7.trends.com.cn/FoNOlkPcSWJtouTkWrxKl9GKBKhZ -- 462x347
			// http://cdn7.trends.com.cn/FgXqmQ9F9JEYQSDfgFwQt6Eum3hx-tweb.article -- watermark
			//   http://cdn7.trends.com.cn/FgXqmQ9F9JEYQSDfgFwQt6Eum3hx -- no watermark
			return src.replace(/-tweb\.[a-z]+(?:\.[^/.]*)?(?:[?#].*)?$/, "");
		}

		if (domain_nowww === "la-soubrette.fr") {
			// https://www.la-soubrette.fr/pornstars/thumbs-photo-nue/774221.jpg -- 112x165
			//   https://www.la-soubrette.fr/pornstars/photo-ps-nue/774221.jpg --1388x2048
			// https://www.la-soubrette.fr/photo-ps/briana-ray-17936.jpg
			//   https://www.la-soubrette.fr/photo-ps-grande/17936-briana-ray.jpg
			return src
				.replace(/\/photo-ps\/+([^/]*)-([0-9]+)\./, "/photo-ps-grande/$2-$1.")
				.replace(/\/thumbs-photo-nue\//, "/photo-ps-nue/");
		}

		if (domain === "static.feber.se" && string_indexof(src, "/article_images/") >= 0) {
			// https://static.feber.se/article_images/37/50/79/375079_1280.jpg -- 1280x1889
			//   https://static.feber.se/article_images/37/50/79/375079.jpg -- 1388x2048
			return src.replace(/(\/[0-9]+)_[0-9]+(\.[^/.]*)$/, "$1$2");
		}

		// portrix.net ceemes
		if (domain_nowww === "previiew.com" ||
			// https://lfi-online.de/ceemes/webfile/img/4717852/x=20/Dafydpressimage1Leonardo_web.jpg?x=600&y=400
			//   https://lfi-online.de/ceemes/webfile/img/4717852/Dafydpressimage1Leonardo_web.jpg
			// https://lfi-online.de/ceemes/webfile/img/1002350/YToxOntzOjE6IngiO3M6MzoiNjAwIjt9/cover.jpg
			//   atob: a:1:{s:1:"x";s:3:"600";}
			//   https://lfi-online.de/ceemes/webfile/img/1002350/cover.jpg
			domain_nowww === "lfi-online.de" ||
			// http://s-magazine.photography/ceemes/webfile/img/4625/GlamFreak-Mag_1A.jpg?y=1000
			//   http://s-magazine.photography/ceemes/webfile/img/4625/GlamFreak-Mag_1A.jpg
			domain_nowww === "s-magazine.photography" ||
			// http://m-magazine.photography/ceemes/webfile/img/222682/PAPEL-Cobelo-2.jpg?x=1920
			//   http://m-magazine.photography/ceemes/webfile/img/222682/PAPEL-Cobelo-2.jpg
			domain_nowww === "m-magazine.photography" ||
			// https://l-mount.com/webfile/img/532/LMount-Mount-FullFrame-Sensor-Leica-SL.jpg?x=1024
			//   https://l-mount.com/webfile/img/532/LMount-Mount-FullFrame-Sensor-Leica-SL.jpg
			domain_nowww === "l-mount.com" ||
			// https://bettinaschoenbach.com/ceemes/webfile/img/1060/x=1024/T-Shirt_ka_weiss_1.jpg
			//   https://bettinaschoenbach.com/ceemes/webfile/img/1060/T-Shirt_ka_weiss_1.jpg
			domain_nowww === "bettinaschoenbach.com" ||
			// https://portrix-ls.de/webfile/img/864/x=600/y=400/blog3.jpg
			//   https://portrix-ls.de/webfile/img/864/blog3.jpg
			domain_nowww === "portrix-ls.de" ||
			// https://glocon.eu/ceemes/webfile/img/1405/x=1000/grafik4c.jpg
			//   https://glocon.eu/ceemes/webfile/img/1405/grafik4c.jpg
			domain_nowww === "glocon.eu" ||
			// https://wow.olympus.eu/webfile/img/1632/x=1024/oly_testwow_stage.jpg
			//   https://wow.olympus.eu/webfile/img/1632/oly_testwow_stage.jpg
			domain_nosub === "olympus.eu") {
			// https://previiew.com/webfile/img/3217/x=500/y=600
			//   https://previiew.com/webfile/img/3217 -- 501 on head
			return {
				url: src.replace(/(\/webfile\/+img\/+[0-9]+)(?:\/+[xy]=[0-9]+)*(?:\/+[a-zA-Z0-9=]{10,})?(\/[^/]+\.[^/.?]+)?(?:[?#].*)?$/, "$1$2"),
				can_head: false
			};
		}

		if (domain === "d2e7nuz2r6mjca.cloudfront.net") {
			// https://d2e7nuz2r6mjca.cloudfront.net/2017/8/1502865807_n2-1280w.jpg -- stretched
			//   https://d2e7nuz2r6mjca.cloudfront.net/2017/8/1502865807_n2.jpg -- 796x532
			return src.replace(/-[0-9]+[wh](\.[^/.]*)$/, "$1");
		}

		if (domain_nowww === "vplate.ru" ||
			// http://wlooks.ru/images/article/cropped/220-308/2016/12/vechernie-tufli-y-goda.jpg
			//   http://wlooks.ru/images/article/orig/2016/12/vechernie-tufli-y-goda.jpg -- 1000x501
			domain_nowww === "wlooks.ru") {
			// http://www.vplate.ru/images/article/cropped/220-308/2017/02/zhenskie-vechernie-klatchi-93.jpg -- 220x308
			//   http://www.vplate.ru/images/article/orig/2017/02/zhenskie-vechernie-klatchi-93.jpg -- 480x720
			return src.replace(/\/images\/article\/cropped\/[0-9]+-[0-9]+\//, "/images/article/orig/");
		}

		if (domain === "media.vogue.com") {
			// http://media.vogue.com/r/h_660,w_440/2016/12/08/00-holding-jones.jpg
			//   http://media.vogue.com/r/original/2016/12/08/00-holding-jones.jpg
			//   https://assets.vogue.com/photos/589153bd97a3db337a249a68/original/original/00-holding-jones.jpg
			// http://media.vogue.com/r/pass/2016/05/12/11-margot-robbie-best-red-carpet-looks.jpg -- 2000x3000
			//   http://media.vogue.com/r/original/2016/05/12/11-margot-robbie-best-red-carpet-looks.jpg -- 2000x3000
			// http://media.vogue.com/r/c_1%2Ch_4000%2Cw_3280/2013/11/victorias-secret-2013-13_115333709600.jpg
			//   http://media.vogue.com/r/original/2013/11/victorias-secret-2013-13_115333709600.jpg
			return src.replace(/(:\/\/[^/]*\/)r\/[a-z]_[0-9]+(?:(?:,|%2C)[a-z]_[0-9]+)*\//, "$1r/original/");
		}

		if (domain_nosub === "efu.com.cn" &&
			domain.match(/^img[0-9]*\./)) {
			// http://img1.efu.com.cn/upfile/fashion/photo/small/36745/824909.jpg -- 100x151
			//   http://img1.efu.com.cn/upfile/fashion/photo/36745/824909.jpg -- 720x1086
			return src.replace(/(\/upfile\/[^/]*\/photo\/)[a-z]+\/([0-9]+\/[0-9]+\.[^/.]*)$/, "$1$2");
		}

		if (domain === "static.stopgame.ru") {
			// https://static.stopgame.ru/video/blank.mp4
			if (/\/video\/blank\./.test(src))
				return {
					url: src,
					bad: "mask"
				};
		}

		if (domain === "images.stopgame.ru" ||
			// https://stopga.me/images/video/2020/05/03/c192x108/Pk5Rvj7DmflYX7d42SKUIA/V8Q-3PmdO.jpg
			//   https://stopga.me/images/video/2020/05/03/V8Q-3PmdO.jpg
			domain_nowww === "stopga.me") {
			// https://images.stopgame.ru/articles/2018/08/28/c456x256/eMlTwGkFEIomrj50ODUKhQ/xDGn_Lq7.jpg -- 456x256
			//   https://images.stopgame.ru/articles/2018/08/28/xDGn_Lq7.jpg -- 1280x720
			// https://images.stopgame.ru/articles/2018/08/28/death_s_gambit_review_igry-1535467258-s.jpg
			//   https://images.stopgame.ru/articles/2018/08/28/death_s_gambit_review_igry-1535467258.jpg
			// https://images.stopgame.ru/uploads/images/386005/form/2018/03/13/normal_1520890359.jpg
			//   https://images.stopgame.ru/uploads/images/386005/form/2018/03/13/1520890359.jpg
			return src
				.replace(/(\/(?:articles|images\/+video)\/[0-9]+\/[0-9]+\/[0-9]+\/)c[0-9]+x[0-9]+\/[0-9a-zA-Z]+\/([^/]*)$/, "$1$2")
				.replace(/(\/articles\/[0-9]+\/[0-9]+\/[0-9]+\/[^/]*-[0-9]+)-s(\.[^/.]*)$/, "$1$2")
				.replace(/(\/uploads\/images\/[0-9]+\/[a-z]+\/[0-9]+\/[0-9]+\/[0-9]+\/)[a-z]+_([0-9]+\.[^/.]*)$/, "$1$2");
		}

		if (domain_nowww === "pure-nude-celebs.com" ||
			// http://www.celebsandstarsnude.com/celebbabes/rosie-huntington-whiteley1/pic-rosie-huntington-whiteley-015.jpg
			//   http://www.celebsandstarsnude.com/celebbabes/rosie-huntington-whiteley1/rosie-huntington-whiteley-015.jpg
			domain_nowww === "celebsandstarsnude.com" ||
			// http://www.celebsking.com/bannedbabe/dakota-johnson/pic-dakota-johnson-011.jpg
			//   http://www.celebsking.com/bannedbabe/dakota-johnson/dakota-johnson-011.jpg
			domain_nowww === "celebsking.com") {
			// http://www.pure-nude-celebs.com/celebsextape/felicity-jones/pic-felicity-jones-011.jpg
			//   http://www.pure-nude-celebs.com/celebsextape/felicity-jones/felicity-jones-011.jpg
			return src.replace(/\/pic-([^/]*)$/, "/$1");
		}

		if (domain_nowww === "pincelebs.net") {
			// https://www.pincelebs.net/thumbs/3/5/6/356e393056c304cf357fa6f81bd00943.jpg
			//   https://www.pincelebs.net/images/3/5/6/356e393056c304cf357fa6f81bd00943.jpg
			return src.replace(/\/thumbs(\/(?:[0-9a-f]\/){3}[0-9a-f]+\.[^/.]*)$/, "/images$1");
		}

		if (domain === "img.new2005.com") {
			// https://img.new2005.com/Article/20170114/97b85523ee6063831376bf1a15c5c8c0.jpeg_old -- 400x601, blurred
			//   https://img.new2005.com/Article/20170114/97b85523ee6063831376bf1a15c5c8c0.jpeg -- 640x961
			return src.replace(/(\/[0-9a-f]+\.[^/._]+)_old(?:[?#].*)?$/, "$1");
		}

		if (domain === "s.libertaddigital.com") {
			// https://s.libertaddigital.com/2016/12/19/1280/720/fit/gq.jpg -- 480x720
			//   https://s.libertaddigital.com/2016/12/19/gq.jpg -- 900x1350
			// https://s.libertaddigital.com/fotos/galerias/culos-famosas/244/0/eva-mendes.jpg
			//   https://s.libertaddigital.com/fotos/galerias/culos-famosas/eva-mendes.jpg
			// https://s.libertaddigital.com/fotos/noticias/375/225/pedro-sanchez-microfonos-1.jpg
			//   https://s.libertaddigital.com/fotos/noticias/pedro-sanchez-microfonos-1.jpg
			// https://s.libertaddigital.com/fotos/noticias/1920/1080/fit/megan-fox-transformers.jpg
			//   https://s.libertaddigital.com/fotos/noticias/megan-fox-transformers.jpg
			return src
				.replace(/(:\/\/[^/]*\/(?:(?:fotos\/+(?:galerias\/+[^/]*|[a-z]+))|(?:[0-9]{4}\/+[0-9]{2}\/+[0-9]{2}))\/+)[0-9]+\/+[0-9]+\/+(?:fit\/+)?([^/]*)(?:[?#].*)?$/,
						 "$1$2");
			//.replace(/(\/fotos\/(?:galerias\/[^/]*\/|[a-z]+\/))[0-9]+\/[0-9]+\/([^/]*)$/, "$1$2");
		}

		if (domain_nowww === "imgstudio.org" ||
			// https://imgadult.com/upload/small/2017/10/26/59f205b06c988.jpg
			//   https://imgadult.com/upload/big/2017/10/26/59f205b06c988.jpg
			// https://imgadult.com/upload/small-medium/2017/10/26/59f205b06c988.jpg
			//   https://imgadult.com/upload/big/2017/10/26/59f205b06c988.jpg
			domain_nowww === "imgadult.com" ||
			// http://imageboom.net/upload/small/2017/12/06/5a286662b7510.png
			//   http://imageboom.net/upload/big/2017/12/06/5a286662b7510.png
			domain_nowww === "imageboom.net" ||
			// https://acidimg.cc/upload/small/2017/08/15/59928f30677ee.jpg
			domain_nowww === "acidimg.cc" ||
			// http://imagedecode.com/upload/small/2015/03/19/550a7da5625c9.jpg
			//   http://imagedecode.com/upload/big/2015/03/19/550a7da5625c9.jpg
			domain_nowww === "imagedecode.com" ||
			// http://damimage.com/upload/small/2017/09/24/59c7e1d8623c1.jpg
			//   http://damimage.com/upload/big/2017/09/24/59c7e1d8623c1.jpg
			domain_nowww === "damimage.com" ||
			// http://imgcredit.xyz/upload/small/2017/07/25/5976cb96e01db.jpg
			//   http://imgcredit.xyz/upload/big/2017/07/25/5976cb96e01db.jpg
			// http://sr85.imgcredit.xyz/upload/small/2017/07/26/5978364c3cade.jpg
			//   http://sr85.imgcredit.xyz/upload/big/2017/07/26/5978364c3cade.jpg
			domain_nosub === "imgcredit.xyz" ||
			// https://imgwallet.com/images/small-medium/2018/08/09/5b6baf82cecf8.jpg
			//   https://imgwallet.com/images/big/2018/08/09/5b6baf82cecf8.jpg
			domain_nowww === "imgwallet.com" ||
			// https://imgdrive.net/images/small-medium/2018/08/09/5b6c2958dc37e.jpg
			//   https://imgdrive.net/images/big/2018/08/09/5b6c2958dc37e.jpg
			// https://imgdrive.net/images/small/2016/04/11/570b6d6587b1e.jpg
			//   https://imgdrive.net/images/big/2016/04/11/570b6d6587b1e.jpg
			domain_nowww === "imgdrive.net" ||
			// thanks to coolhealer: https://github.com/qsniyg/maxurl/issues/966
			domain_nowww === "imgaws.com" ||
			// https://imgtaxi.com/images/small-medium/2018/08/09/5b6c293ee9fb6.jpg
			//   https://imgtaxi.com/images/big/2018/08/09/5b6c293ee9fb6.jpg
			domain_nowww === "imgtaxi.com") {
			// https://imgtaxi.com/css/img/showcase.img.em.png
			if (/\/css\/+img\/+showcase\.img\./.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}

			if (domain_nowww === "imgaws.com") {
				newsrc = website_query({
					website_regex: /^[a-z]+:\/\/[^/]+\/+img-([0-9a-f]{5,})\.html(?:[?#].*)?$/,
					query_for_id: function(id) {
						return {
							method: "POST",
							url: "https://" + domain + "/img-" + id + ".html",
							imu_mode: "document",
							headers: {
								"content-type": "application/x-www-form-urlencoded",
								origin: "https://" + domain,
								Referer: "https://" + domain + "/img-" + id + ".html"
							},
							data: "imgContinue=Continue+to+image..."
						};
					},
					process: function(done, resp, cache_key) {
						var match = resp.responseText.match(/<a href='(https?:\/\/[^"']+\/upload\/+big\/+[^"']+)'/);
						if (!match) {
							console_error(cache_key, "Unable to find match for", resp);
							return done(null, false);
						}

						var url = decode_entities(match[1]);

						return done({
							url: url,
							extra: {
								page: resp.finalUrl
							}
						}, 6*60*60);
					}
				});
				if (newsrc) return newsrc;
			} else {
				newsrc = website_query({
					website_regex: /^[a-z]+:\/\/[^/]+\/+img-([0-9a-f]+)\.html(?:[?#].*)?$/,
					query_for_id: "https://" + domain + "/img-${id}.html",
					process: function(done, resp, cache_key) {
						var image = get_meta(resp.responseText, "og:image");
						// to be replaced with the rule below
						return done(image, 6*60*60);
					}
				});
				if (newsrc) return newsrc;
			}

			// http://imgstudio.org/upload/small/2017/05/13/59170f8f9877a.jpg
			//   http://imgstudio.org/upload/big/2017/05/13/59170f8f9877a.jpg
			return {
				url: src.replace(/\/(images|upload)\/+small(?:-medium)?\/+/, "/$1/big/"),
				headers: {
					//Origin: "https://" + domain, // why?
					Referer: "https://" + domain + "/"
				},
				referer_ok: {
					same_domain_nosub: true
				}
			};


			//newsrc = src.replace(/\/upload\/+[-a-z]+\//, "/upload/big/");
			//if (newsrc != src)
			//	return newsrc;

			//return {
			//	url: src,
			//	headers: {
			//		Referer: "http://" + domain_nosub + "/",
			//		Cookie: "showing=3"
			//	}
			//};
			//return src.replace(/(:\/\/[^/]*\/)images\/[a-z]+\//, "$1images/big/");
		}

		if (domain === "i.acidimg.cc") {
			// https://i.acidimg.cc/small/2017/08/15/59928f30677ee.jpg
			//   https://i.acidimg.cc/big/2017/08/15/59928f30677ee.jpg
			return src.replace(/(:\/\/[^/]*\/)[a-z]+\//, "$1big/");
		}

		if (domain === "img.depo.ua") {
			// https://img.depo.ua/745xX/Oct2017/309002.jpg -- stretched
			//   https://img.depo.ua/original/Oct2017/309002.jpg
			return src.replace(/(:\/\/[^/]*\/)[0-9X]+x[0-9X]+\//, "$1original/");
		}

		if ((domain_nowww === "elfagr.com" ||
			 // http://www.arabmubasher.com/upload/photo/news/11/7/500x282o/138.jpg?q=1
			 //   http://www.arabmubasher.com/upload/photo/news/11/7/138.jpg?q=1
			 domain_nowww === "arabmubasher.com" ||
			 // https://www.elbalad.news/upload/photo/news/391/6/270x140o/611.jpg
			 //   https://www.elbalad.news/upload/photo/news/391/6/611.jpg
			 domain_nowww === "elbalad.news" ||
			 // https://www.elmwatin.com/upload/photo/news/54/4/200x112o/777.jpg?q=1
			 //   https://www.elmwatin.com/upload/photo/news/54/4/777.jpg
			 domain_nowww === "elmwatin.com" ||
			 // https://www.dostor.org/upload/photo/news/265/7/160x90o/295.jpg?q=2
			 //   https://www.dostor.org/upload/photo/news/265/7/295.jpg
			 domain_nowww === "dostor.org" ||
			 // http://www.studio-dostor.org/upload/photo/news/1/8/400x225o/672.jpg?q=1
			 //   http://www.studio-dostor.org/upload/photo/news/1/8/672.jpg
			 domain_nowww === "studio-dostor.org" ||
			 // https://www.albawabhnews.com/upload/photo/news/261/9/600x338o/986.jpg?q=1
			 //   https://www.albawabhnews.com/upload/photo/news/261/9/986.jpg?q=1
			 //   https://www.albawabhnews.com/upload/photo/news/261/9/986.jpg
			 domain_nowww === "albawabhnews.com") &&
			/\/upload\/+photo\//.test(src)) {
			// http://www.elfagr.com/upload/photo/news/312/4/100x56o/85.jpg?q=2
			//   http://www.elfagr.com/upload/photo/news/312/4/200x113o/85.jpg?q=2
			//   http://www.elfagr.com/upload/photo/news/312/4/85.jpg?q=2
			return src.replace(/\/+[0-9]+x[0-9]+[a-z]?\/+([^/]*?)(?:[?#].*)?$/, "/$1");
		}

		if (domain_nowww === "cdnimpuls.com") {
			// https://cdnimpuls.com/www.tej.al/media3/-400-229-5af07701ee93a.png
			//   https://cdnimpuls.com/www.tej.al/media3/5af07701ee93a.png
			// https://cdnimpuls.com/v.xing.al/media3/-640-0-5b4c84a8d02f1.png
			//   https://cdnimpuls.com/v.xing.al/media3/5b4c84a8d02f1.png
			// https://cdnimpuls.com/o.anabel.al/media/-200-0-14165474411416509206938_image_galleryimage_santa_monica_ca_october_2.jpg
			//   https://cdnimpuls.com/o.anabel.al/media/14165474411416509206938_image_galleryimage_santa_monica_ca_october_2.jpg
			return src.replace(/\/-[0-9]+-[0-9]+-([0-9a-f]+(?:_[^/]*)?\.[^/.]*)$/, "/$1");
		}

		if (domain_nowww === "mshreqnews.net" ||
			// https://www.mykentfamily.co.uk/_media/img/750x0/Q6ATXFP2SELP8LXCIT2L.jpg
			//   https://www.mykentfamily.co.uk/_media/img/Q6ATXFP2SELP8LXCIT2L.jpg
			(domain_nowww === "mykentfamily.co.uk" && string_indexof(src, "/_media/") >= 0) ||
			// https://pdfkul.com/img/300x300/piper-perri-mofopdf_59c0cc2d1723dddc42c513a0.jpg
			//   https://pdfkul.com/img/piper-perri-mofopdf_59c0cc2d1723dddc42c513a0.jpg
			domain_nowww === "pdfkul.com") {
			// http://mshreqnews.net/img/2000x506/CsiPl.jpg -- stretched
			//   http://mshreqnews.net/img/CsiPl.jpg
			newsrc = src.replace(/\/img\/+[0-9]+x[0-9]+\/+([^/]*)(?:[?#].*)?$/, "/img/$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nowww === "choisirunfilm.fr") {
			// http://www.choisirunfilm.fr/persons/small/148328.jpg
			//   http://www.choisirunfilm.fr/persons/148328.jpg
			return src.replace(/\/persons\/small\/([0-9]+\.[^/.]*)$/, "/persons/$1");
		}

		if (domain_nosub === "gazetaexpress.com" ||
			// http://old.fishmedia.info/public/uploads/image/2017/08/645x430/auto-rihanna1502191454.jpg
			//   http://old.fishmedia.info/public/uploads/image/2017/08/auto-rihanna1502191454.jpg
			domain === "old.fishmedia.info") {
			// https://www.gazetaexpress.com/public/uploads/image/2017/09/145x80/ririiiii_1505314458-884629.jpg
			//   https://www.gazetaexpress.com/public/uploads/image/2017/09/ririiiii_1505314458-884629.jpg -- 2691x1725
			// https://m.gazetaexpress.com/public/uploads/image/2018/08/633x347/rihanna-2018-4k-de-2048x1152_1534258781-3654015.jpg
			//   https://m.gazetaexpress.com/public/uploads/image/2018/08/rihanna-2018-4k-de-2048x1152_1534258781-3654015.jpg
			return src.replace(/(\/public\/+uploads\/+image\/+[0-9]+\/+[0-9]+\/+)[0-9]+x[0-9]+\/+([^/]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "kosovapress.com") {
			// http://www.kosovapress.com/public/uploads/image/520x320/emma-watson-2013-wide.jpg
			//   http://www.kosovapress.com/public/uploads/image/emma-watson-2013-wide.jpg
			return src.replace(/(\/public\/+uploads\/+image\/+)[0-9]+x[0-9]+\/+/, "$1");
		}

		if (domain_nowww === "haynews.am") {
			// http://haynews.am/thumbs/150x/aE17BTVGoGcf21pQ7SnFc7wPNI.jpg
			//   http://haynews.am/images/aE17BTVGoGcf21pQ7SnFc7wPNI.jpg
			return src.replace(/\/thumbs\/[0-9]+x(?:[0-9]+)?\//, "/images/");
		}

		if (domain_nowww === "emlakkulisi.com") {
			// https://emlakkulisi.com/resim/thumb/ODc3OTI5MT-rihanna-cannesda-villa-aldi.jpg
			//   https://emlakkulisi.com/resim/orjinal/ODc3OTI5MT-rihanna-cannesda-villa-aldi.jpg
			return src.replace(/\/resim\/[a-z]+\//, "/resim/orjinal/");
		}

		if (domain_nowww === "aquarellefm.md" && string_indexof(src, "/storage/") >= 0) {
			// http://www.aquarellefm.md/storage/2018/08/01/1533131537_62137400_Fit_340x1000.jpg
			//   http://www.aquarellefm.md/storage/2018/08/01/1533131537_62137400.jpg
			return src.replace(/_Fit_[0-9]+x[0-9]+(\.[^/.]*)$/, "$1");
		}

		if (domain_nowww === "joy.hu" ||
			// https://static.marquardmedia.hu/data/cikk/232/232566-rihanna-enekesno.775x400.jpg
			//   https://static.marquardmedia.hu/data/cikk/232/232566.jpg -- doesn't work?
			// https://static.marquardmedia.hu/data/cgaleria/160/160377.layer.jpg
			//   https://static.marquardmedia.hu/data/cgaleria/160/160377.jpg
			// https://static.marquardmedia.hu/data/cgaleria/116/116356.w.jpg
			//   https://static.marquardmedia.hu/data/cgaleria/116/116356.jpg
			domain === "static.marquardmedia.hu") {
			// https://www.joy.hu/data/cikk/211/211260.340.jpg
			//   https://www.joy.hu/data/cikk/211/211260.jpg
			// https://www.joy.hu/data/cikk/232/232566-rihanna-enekesno.775x400.jpg
			//   https://www.joy.hu/data/cikk/232/232566.jpg
			// https://www.joy.hu/data/cgaleria/151/151339.340.jpg
			//   https://www.joy.hu/data/cgaleria/151/151339.jpg
			// doesn't work for all:
			// https://www.joy.hu/data/star/0/4.200.jpg
			return src.replace(/(\/data\/[^/]*\/[0-9]+\/[0-9]+)(?:-[^/.]*)?\.(?:[0-9]+(?:x[0-9]+)?|layer|w)(\.[^/.]*)$/, "$1$2");
			//return src.replace(/(\/data\/+cgaleria\/+[0-9]+\/+[0-9]+)\.w(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "ivoirematin.com") {
			// http://www.ivoirematin.com/content/news/images/01-2018/fb_bac6ce231671b57ea3d297719f4992f1a1423b52.jpg
			//   http://www.ivoirematin.com/content/news/images/01-2018/bac6ce231671b57ea3d297719f4992f1a1423b52.jpg
			return src.replace(/(\/images\/[0-9]+-[0-9]+\/)fb_([0-9a-f]+\.[^/.]*)$/, "$1$2");
		}

		if (domain === "img.theqoo.net") {
			// http://img.theqoo.net/proxy.php?url=i.imgur.com/z4DWTpG.jpg
			//   http://i.imgur.com/z4DWTpG.jpg
			// http://img.theqoo.net/proxy/http://i.imgur.com/z4DWTpG.jpg
			//   http://i.imgur.com/z4DWTpG.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/proxy\.php.*?[?&]url=([^&]*).*?$/, "$1");

			if (newsrc === src) {
				newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/proxy\/(.*)$/, "$1");
			}

			if (newsrc !== src) {
				if (!newsrc.match(/^[a-z]+:\/\//))
					newsrc = "http://" + newsrc;
				return newsrc;
			}
		}

		if (domain_nowww === "gpslifetime.com.br" && string_indexof(src, "/uploads/") >= 0) {
			// https://gpslifetime.com.br/uploads/content_manager/contents/48833/image/thumbs/marca-de-rihanna-faz-seu-debut-no-new-york-fashion-week-ba66.jpg
			//   https://gpslifetime.com.br/uploads/content_manager/contents/48833/image/marca-de-rihanna-faz-seu-debut-no-new-york-fashion-week-ba66.jpg
			return src.replace(/\/image\/thumbs\//, "/image/");
		}

		if (domain_nowww === "lasillarota.com" ||
			domain === "lasillarotarm.blob.core.windows.net.optimalcdn.com" ||
			// https://info7rm.blob.core.windows.net.optimalcdn.com/images/2018/02/22/ria-focus-0-0-600-315.jpg
			//   https://lasillarotarm.blob.core.windows.net.optimalcdn.com/images/2018/03/15/snapchatenproblemasporlanzarcampanadeviolenciacontrarihanna.jpg
			domain === "info7rm.blob.core.windows.net.optimalcdn.com") {
			// https://lasillarota.com/images/tnfocus/0/0/480/345/2018/03/15/snapchatenproblemasporlanzarcampanadeviolenciacontrarihanna.jpg
			//   https://lasillarotarm.blob.core.windows.net.optimalcdn.com/images/2018/03/15/snapchatenproblemasporlanzarcampanadeviolenciacontrarihanna.jpg
			// https://lasillarotarm.blob.core.windows.net.optimalcdn.com/images/2018/03/15/snapchatenproblemasporlanzarcampanadeviolenciacontrarihanna-focus-0-0-480-345.jpg
			//   https://lasillarotarm.blob.core.windows.net.optimalcdn.com/images/2018/03/15/snapchatenproblemasporlanzarcampanadeviolenciacontrarihanna.jpg
			//return src.replace(/\/images\/tnfocus\/(?:[0-9]+\/){4}([0-9]+\/[0-9]+\/[0-9]+\/[^/]*)$/, "/images/$1"); -- doesn't work
			return src
				.replace(/:\/\/[^/]*lasillarota\.com\/images\/tnfocus\/(?:[0-9]+\/){4}([0-9]+\/[0-9]+\/[0-9]+\/[^/]*)$/, "://lasillarotarm.blob.core.windows.net.optimalcdn.com/images/$1")
				.replace(/(\/images\/[0-9]+\/[0-9]+\/[0-9]+\/[^/]*)-focus(?:-[0-9]+){4}(\.[^/.]*)$/, "$1$2");
		}

		if (domain_nowww === "znaj.ua" ||
			// https://akcenty.com.ua/crops/ab3bea/150x100/2/0/2019/08/06/7Os48sjmcvYnsDqNFlDJl5cevM8hdtPrD5389GvY.jpeg
			//   https://akcenty.com.ua/images/2019/08/06/7Os48sjmcvYnsDqNFlDJl5cevM8hdtPrD5389GvY.jpeg
			domain_nowww === "akcenty.com.ua") {
			// https://znaj.ua/crops/aef15f/620x0/1/0/2017/11/47/rihanna.jpg
			//   https://znaj.ua/images/2017/11/47/rihanna.jpg
			return src.replace(/\/crops\/+[a-z0-9]+\/+[0-9]+x[0-9]+\/+[0-9]+\/+[0-9]+\/+([0-9]+\/+[0-9]+\/+[0-9]+\/+[^/]*)$/, "/images/$1");
		}

		if (domain_nowww === "raragente.com.br") {
			// http://www.raragente.com.br/imagem/noticia/750/4000/333660_170663_44226.jpg
			//   http://www.raragente.com.br/images/materias/333660_170663_44226.jpg -- doesn't seem to do anything
			return src.replace(/\/imagem\/noticia\/[0-9]+\/[0-9]+\//, "/images/materias/");
		}

		if (domain_nowww === "pastefs.com") {
			// http://www.pastefs.com/resource/preview/65/0/d5f142aaae66f7df532ae11fa85bac51/amy-acker-fashion-1-dvdbash-6.jpg -- 1200x1506
			//   http://www.pastefs.com/resource/files/65/0/d5f142aaae66f7df532ae11fa85bac51/amy-acker-fashion-1-dvdbash-6.jpg -- 1500x1882
			// {files, download}, preview, thumb
			return src.replace(/\/resource\/[a-z]+\//, "/resource/files/");
		}

		if (domain_nowww === "sigmalive.com") {
			// http://www.sigmalive.com/application/cache/default/images/news/900x450/rihannaFDDSFDFSDFS.jpg
			//   http://www.sigmalive.com/uploads/images/news/rihannaFDDSFDFSDFS.jpg
			return src.replace(/\/application\/cache\/[^/]*\/(images\/[^/]*\/)[0-9]+x[0-9]+\//, "/uploads/$1");
		}

		if (domain_nowww === "luna.ovh") {
			// https://www.luna.ovh/imgw/450px/Christian_Serratos_by_Gage_Skidmore.jpg
			//   https://www.luna.ovh/imgw/Christian_Serratos_by_Gage_Skidmore.jpg
			return src.replace(/\/imgw\/[0-9]+px\//, "/imgw/");
		}

		if (domain_nowww === "shalala.ru") {
			// http://shalala.ru/upload/artists/19149/medium/5916281_7531137.jpg
			//   http://shalala.ru/upload/artists/19149/5916281_7531137.jpg
			return src.replace(/(\/upload\/artists\/[0-9]+\/)[a-z]+\/([0-9]+_[0-9]+\.[^/.]*)$/, "$1$2");
		}

		if (domain_nowww === "fay3.com") {
			// https://www.fay3.com/assets/uploads/images_thumbs/45HT7t3V.jpg?1403510896 -- 800x987
			//   https://www.fay3.com/assets/uploads/images/45HT7t3V.jpg?1403510896 -- 961x1186
			// https://www.fay3.com/assets/uploads/thumbs/2z43ucFA.jpg?1403520485
			//   https://www.fay3.com/assets/uploads/images/2z43ucFA.jpg?1403520485
			return src.replace(/\/assets\/uploads\/(?:images_)?thumbs\//, "/assets/uploads/images/");
		}

		if (domain_nowww === "vijesti.ba" ||
			// https://m.novi.ba/storage/2018/09/11/thumbs/5b97e11f-8b4c-4f41-b7c6-6a650a0a0a67-selena3-previewOrg.jpg
			//   https://m.novi.ba/storage/2018/09/11/5b97e11f-8b4c-4f41-b7c6-6a650a0a0a67-selena3.jpg
			// https://m.novi.ba/storage/2018/09/11/thumbs/5b97e111-ec40-41e3-a490-69eb0a0a0a67-selena-690x480.png
			//   https://m.novi.ba/storage/2018/09/11/5b97e111-ec40-41e3-a490-69eb0a0a0a67-selena.png
			// https://novi.ba/storage/2019/04/30/thumbs/5cc813c3-e994-43b7-a16d-424b0a0a0a64-selena-gomez-we-day-april-25-2019-billboard-1548-preview.jpg
			//   https://novi.ba/storage/2019/04/30/5cc813c3-e994-43b7-a16d-424b0a0a0a64-selena-gomez-we-day-april-25-2019-billboard-1548.jpg
			domain_nosub === "novi.ba") {
			// https://vijesti.ba/storage/2016/03/12/thumbs/56e45307-12bc-497f-b9d9-21210a0a0a80-lopez-haljina-1-previewOrg.jpg
			//   https://vijesti.ba/storage/2016/03/12/56e45307-12bc-497f-b9d9-21210a0a0a80-lopez-haljina-1.jpg
			return src.replace(/(\/storage\/[0-9]+\/[0-9]+\/[0-9]+\/)thumbs\/([^/]*)-(?:preview(?:Org)?|[0-9]+x[0-9]+)(\.[^/.]*)$/, "$1$2$3");
			//return src.replace(/(\/storage\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2})thumbs\/+([^/]*)-preview(\.[^/.]*)(?:[?#].*)?$/, "$1$2$3");
		}

		if (domain === "m.smedata.sk") {
			// https://m.smedata.sk/api-media/media/image/sme/3/15/153563/153563_1000x.jpg?rev=1
			//   https://m.smedata.sk/api-media/media/image/sme/3/15/153563/153563.jpg?rev=1
			// thanks to anonymous for reporting:
			// https://m.smedata.sk/api-media/media/image/sme/5/21/212945/212945_970x647.jpg?rev=1
			//   https://m.smedata.sk/api-media/media/image/sme/5/21/212945/212945.jpg?rev=1
			return src.replace(/(\/api-media\/media\/image\/.*)_[0-9]+x[0-9]*(\.[^/.]*)$/, "$1$2");
		}

		if ((domain_nosub === "diariolibre.com" && domain.match(/estatico[0-9]*\.diariolibre\.com/)) ||
			// https://www.expreso.ec/binrepository/618x412/0c0/0d0/none/12113/VMQD/image_content_26442762_20181215203655.jpg
			//   https://www.expreso.ec/binrepository/image_content_26442762_20181215203655.jpg
			domain_nowww === "expreso.ec" ||
			// https://www.vanguardia.com/binrepository/716x477/0c0/0d0/none/12204/MUHT/web_vanessa_big_tp_VL301097_MG19836930.jpg
			//   https://www.vanguardia.com/binrepository/web_vanessa_big_tp_VL301097_MG19836930.jpg
			domain_nowww === "vanguardia.com" ||
			// https://www.thesundaily.my/binrepository/768x423/0c0/0d0/none/11808/RENN/2019-10-10t215847z-1984077980-rc12bd287fb0-rtrmadp-3-filmfestival-london-earthquake-bird_700740_20191011095053.jpg
			//   https://www.thesundaily.my/binrepository/2019-10-10t215847z-1984077980-rc12bd287fb0-rtrmadp-3-filmfestival-london-earthquake-bird_700740_20191011095053.jpg
			domain_nowww === "thesundaily.my" ||
			// https://www.canarias7.es/binrepository/300x169/0c0/0d0/none/11314/SDSB/1524696124-leslie-grace-colabora-con_4109175_20181011193330.jpg
			//   https://www.canarias7.es/binrepository/1524696124-leslie-grace-colabora-con_4109175_20181011193330.jpg
			domain_nowww === "canarias7.es") {
			// https://estatico2.diariolibre.com/binrepository/400x300/0c0/0d0/none/10904/QQUT/image_content_10068843_20180531145201.jpg
			//   https://estatico2.diariolibre.com/binrepository/image_content_10068843_20180531145201.jpg
			return src.replace(/\/binrepository\/[0-9]+x[0-9]+\/.*(\/[^/]*)(?:[?#].*)?$/, "/binrepository$1");
		}

		if (domain_nowww === "modelisto.com") {
			// https://modelisto.com/photoshoot/enji-night-model-75610@180.jpg
			//   https://modelisto.com/photoshoot/enji-night-model-75610.jpg
			return src.replace(/(-[0-9]+)@[0-9]+(\.[^/.]*)$/, "$1$2");
		}

		if (domain === "media.kg-portal.ru") {
			// https://media.kg-portal.ru/games/s/supermariobros/cosplay/supermariobros_3t.jpg
			//   https://media.kg-portal.ru/games/s/supermariobros/cosplay/supermariobros_3.jpg
			// https://media.kg-portal.ru/tv/g/gameofthrones/images/gameofthrones_714s.jpg
			//   https://media.kg-portal.ru/tv/g/gameofthrones/images/gameofthrones_714.jpg
			return src.replace(/(_[0-9]+)[st](\.[^/.]*)$/, "$1$2");
			//return src.replace(/(\/images\/+[^/]*_[0-9]+)s(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "desktopwallpaperhd.net") {
			// http://www.desktopwallpaperhd.net/thumbs/1/a/anime-wallpaper-17258.jpg
			//   http://www.desktopwallpaperhd.net/wallpapers/1/a/anime-wallpaper-17258.jpg
			return src.replace(/(:\/\/[^/]*\/)thumbs\//, "$1wallpapers/");
		}

		if (domain_nowww === "wallpaperplay.com") {
			// https://wallpaperplay.com/walls/small-retina/b/5/f/43064.jpg
			//   https://wallpaperplay.com/walls/full/b/5/f/43064.jpg
			return src.replace(/\/walls\/[^/]*\//, "/walls/full/");
		}

		if (domain_nosub === "pics.vc" &&
			domain.match(/^s[0-9]*\./)) {
			// http://s4.pics.vc/pics/s/369/7ed/eb1/39d/3697edeb139df8076edb3390ad8f91c4.jpg -- 300x449
			//   http://s4.pics.vc/pics/n/369/7ed/eb1/39d/3697edeb139df8076edb3390ad8f91c4.jpg -- 800x1199
			//   http://s4.pics.vc/pics/o/369/7ed/eb1/39d/3697edeb139df8076edb3390ad8f91c4.jpg -- 2815x4220
			return src.replace(/(:\/\/[^/]*\/pics\/)[a-z]\//, "$1o/");
		}

		if ((domain_nosub === "imageshack.us" ||
			 domain_nosub === "imageshack.com") &&
			domain.match(/^imagizer/)) {
			// http://imagizer-cv.imageshack.us/v2/0x500q90/922/2inlKT.jpg
			//   http://imagizer-cv.imageshack.us/v2/x/922/2inlKT.jpg
			// https://imagizer.imageshack.com/v2/1280x0q90/922/2inlKT.jpg
			//   https://imagizer.imageshack.com/v2/x/922/2inlKT.jpg
			return src.replace(/(:\/\/[^/]*\/v2\/)[^/]*\//, "$1x/");
		}

		if (domain_nowww === "girlofthehour.com") {
			// http://girlofthehour.com/IMG/poster_resized/AJE004x005.jpg
			//   http://girlofthehour.com/IMG/poster/AJE004x005.jpg
			return src.replace(/\/IMG\/poster_resized\//, "/IMG/poster/");
		}

		if (domain === "hwcdn.ddstatic.com") {
			// http://hwcdn.ddstatic.com/bp-content/tour/tour_photos/2013_04_30/11481/bree_daniels_11481_13-gal-150-jpg/0008.jpg
			//   http://hwcdn.ddstatic.com/bp-content/tour/tour_photos/2013_04_30/11481/bree_daniels_11481_13-gal-1600-jpg/0008.jpg
			// http://hwcdn.ddstatic.com/bp-content/fhg/fhg_desktops/2010_11_desk/gal-1680-jpg/0005.jpg
			regex = /(-gal-)[0-9]+(-[a-z]+\/[^/]*)$/;
			return [
				src.replace(regex, "$11600$2"),
				src.replace(regex, "$11024$2")
			];
		}

		if (false && domain === "img.sexpornpages.com") {
			// down
			// https://img.sexpornpages.com/converted/th/images01/image-169705.jpg
			//   https://img.sexpornpages.com/images01/image-169705.jpg
			// https://img.sexpornpages.com/converted/th/part03/j0/j010808.jpg
			//   https://img.sexpornpages.com/part03/j0/j010808.jpg
			return src.replace(/\/converted\/+[a-z]+\/+([a-z]+[0-9]*\/)/, "/$1");
		}

		if (false && domain === "static.hdw.eweb4.com" &&
			options && options.cb && options.do_request) {
			// down+hacked?
			// http://static.hdw.eweb4.com/media/thumbs/1/111/1104264.jpg
			//   http://hdw.eweb4.com/out/1104264.html
			//   http://static.hdw.eweb4.com/media/wallpapers_dl/1/111/1104264-mandy-moore.jpg
			//return src.replace(/\/media\/[^/]*\//, "/media/wallpapers_dl/");
			id = src.replace(/.*\/media\/thumbs\/.*\/([0-9]+)\.[^/.]*$/, "$1");
			if (id !== src) {
				options.do_request({
					url: "http://hdw.eweb4.com/out/" + id + ".html",
					method: "GET",
					onload: function(resp) {
						if (resp.readyState === 4) {
							var match = resp.responseText.match(/<meta *property="og:image" *content="([^"]*)"/);
							if (match) {
								options.cb(match[1]);
							} else {
								options.cb(null);
							}
						}
					}
				});

				return {
					waiting: true
				};
			}
		}

		if (domain_nowww === "wallpaperbackgrounds.com") {
			// http://wallpaperbackgrounds.com/Content/wallpapers/celebrity/mandy%20moore/thumb-108169-16695.jpg
			//   http://wallpaperbackgrounds.com/Content/wallpapers/celebrity/mandy%20moore/108169-16695.jpg
			return src.replace(/(\/Content\/wallpapers\/.*\/)thumb-([0-9]+-[0-9]+\.[^/.]*)$/, "$1$2");
		}

		if (domain_nosub === "barelist.com" && /^img[0-9]*\./.test(domain)) {
			// http://img.barelist.com/images/hosted/tgp/halle-von-051415/thumbs/Halle-Von-gives-a-sloppy-blowjob-in-the-kitchen-1.jpg
			//   http://img.barelist.com/images/hosted/tgp/halle-von-051415/pics/halle-von-gives-a-sloppy-blowjob-in-the-kitchen-1.jpg
			// https://img03.barelist.com/images/hosted/tgp/maserati-112713/thumbs/huge-tits-ebony-hottie-maserati-screws-the-photographer-3.jpg
			//   https://img03.barelist.com/images/hosted/tgp/maserati-112713/pics/huge-tits-ebony-hottie-maserati-screws-the-photographer-3.jpg
			// http://img02.barelist.com/images/gallery_100_150/Bree_Daniels_509412.jpg
			//   http://img02.barelist.com/images/gallery/Bree_Daniels_509412.jpg
			return src
				.replace(/(\/images\/+hosted\/+[^/]*\/+[^/]*\/+)thumbs\//, "$1pics/")
				.replace(/\/images\/+gallery_[0-9]+_[0-9]+\//, "/images/gallery/");
		}

		if (domain === "proxy.imgsmail.ru") {
			// https://proxy.imgsmail.ru/?h=muij44Zj9u9YAKrdkDnkBQ&e=1358400352&url717=s018.radikal.ru/i521/1301/32/a24fb200297f.jpg
			//   http://s018.radikal.ru/i521/1301/32/a24fb200297f.jpg
			return add_http(decodeURIComponent(src.replace(/^[a-z]+:\/\/[^/]*\/.*?[?&]url[0-9]*=([^&]*).*?$/, "$1")));
		}

		if (domain_nosub === "imgsmail.ru" &&
			domain.match(/^filapp[0-9]*\./)) {
			// https://filapp1.imgsmail.ru/pic?url=https%3A%2F%2Fd0.static.media.condenast.ru%2Fvogue%2Fcollection%2F58c37c3fe2998da8a0aaee327e56ffd9.jpg%2F2edd78a6%2Fo%2Fw2000&sig=2e63aa660f05e00217383dbb3d2e794d
			//   https://d0.static.media.condenast.ru/vogue/58c37c3fe2998da8a0aaee327e56ffd9.jpg/be1fc22c/o/w2000
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+pic.*?[?^]url=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nosub === "imgsmail.ru" && /^my[0-9]*\./.test(domain)) {
			// https://my2.imgsmail.ru/mail/ru/images/my/compass/static/video/backscreen/newsfeed_video-play_hover.png
			if (/\/mail\/+ru\/+images\/+my\/+compass\/+static\//.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}
		}

		if (domain === "go.imgsmail.ru") {
			// https://go.imgsmail.ru/imgpreview?key=101f6a14475921a3&mb=imgm_prv_62&h=120&w=90
			//   https://go.imgsmail.ru/imgpreview?key=101f6a14475921a3&mb=imgm_prv_62
			if (/\/imgpreview\?/.test(src)) {
				return remove_queries(src, ["h", "w"]);
			}
		}

		if (domain_nowww === "pornoonline.com.pl") {
			// http://www.pornoonline.com.pl/images/galerie/1849/small/small_4fdccc9ca7074.jpg
			//   http://www.pornoonline.com.pl/images/galerie/1849/4fdccc9ca7074.jpg
			return src.replace(/(\/images\/galerie\/[0-9]+\/)[a-z]+\/[a-z]+_([0-9a-f]+\.[^/.]*)$/, "$1$2");
		}

		if (domain === "img.cdn.pornzone.com") {
			// http://img.cdn.pornzone.com/galerie/3/25106/small_99aed7a494eadd21540ab7b727c5893e.jpg
			//   http://img.cdn.pornzone.com/galerie/3/25106/big_99aed7a494eadd21540ab7b727c5893e.jpg
			return src.replace(/(\/galerie\/+[0-9]+\/+[0-9]+\/+)small_([0-9a-f]{20,}\.)/, "$1big_$2");
		}

		if (domain_nowww === "photo-erotique.org") {
			// http://photo-erotique.org/girls/1378403247/thumb_3.jpg
			//   http://photo-erotique.org/girls/1378403247/3.jpg
			return src.replace(/(\/girls\/[0-9]+\/)thumb_([0-9]+\.[^/.]*)$/, "$1$2");
		}

		if (domain === "s.mediasole.ru") {
			// https://s.mediasole.ru/cache/preview/data/images/90/90939/237305_1000.jpg
			//   https://mediasole.ru/data/images/90/90939/237305_1000.jpg
			return src.replace(/:\/\/[^/]*\/cache\/preview\/data\//, "://mediasole.ru/data/");
		}

		if ((domain_nosub === "godsartnudes.com" ||
			 // http://pics7.godsartglam.com/4/3/3/10/pussy-many-72371_1_thumb.jpg
			 //   http://pics7.godsartglam.com/4/3/3/10/pussy-many-72371_1_big.jpg
			 domain_nosub === "godsartglam.com") &&
			domain.match(/^pics[0-9]*\./)) {
			// http://pics16.godsartnudes.com/4/3/2/3/bree-daniels-spreads-her-thighs-show-you-where-she-needs-attention--desire-digital-33091_4.jpg -- 110x150
			//   http://pics16.godsartnudes.com/4/3/2/3/bree-daniels-spreads-her-thighs-show-you-where-she-needs-attention--desire-digital-33091_4_thumb.jpg -- 198x281
			//   http://pics16.godsartnudes.com/4/3/2/3/bree-daniels-spreads-her-thighs-show-you-where-she-needs-attention--desire-digital-33091_4_big.jpg -- 638x1024
			return src.replace(/(-[0-9]+_[0-9]+)(?:_thumb)?(\.[^/.]*)$/, "$1_big$2");
		}

		if (domain_nowww === "gotgalleries.com") {
			// http://www.gotgalleries.com/pics/digitaldesire/61/bree-daniels-sexy-lith13.jpg
			//   http://www.gotgalleries.com/pics/digitaldesire/61/bree-daniels-sexy-li13.jpg
			return src.replace(/th([0-9]*\.[^/.]*)$/, "$1");
		}

		if ((domain_nosub === "perfectnaked.com" ||
			 // https://cdn.erocurves.com/galleries/28083/0_tn.jpg
			 //   https://cdn.erocurves.com/galleries/28083/0_big.jpg
			 domain === "cdn.erocurves.com")
			&& string_indexof(src, "/galleries/") >= 0) {
			// http://www.perfectnaked.com/galleries/bree-daniels-teasing-in-her-cute-pink-panties/3_tn.jpg
			//   http://www.perfectnaked.com/galleries/bree-daniels-teasing-in-her-cute-pink-panties/3_big.jpg
			// http://cdn.perfectnaked.com/galleries/75265/0_tn.jpg
			//   http://cdn.perfectnaked.com/galleries/75265/0_big.jpg
			return src.replace(/(\/[0-9]+)_tn(\.[^/.]*)$/, "$1_big$2");
		}

		if (domain_nowww === "facefuckingporn.com") {
			// https://www.facefuckingporn.com/galleries/ghetto-gaggers-4036/jayden_starr_3_ghetto_gaggers0_tn.jpg
			//   https://www.facefuckingporn.com/galleries/ghetto-gaggers-4036/jayden_starr_3_ghetto_gaggers0_big.jpg
			return src.replace(/(\/galleries\/+[^/]+\/+[^/]+)_tn(\.[^/.]+)(?:[?#].*)?$/, "$1_big$2");
		}

		if (domain_nowww === "eroticbeauties.net" ||
			domain === "blog.pinkworld.com") {
			var eb_info = {
				regex: /^[a-z]+:\/\/[^/]+\/+pics\/+[^/]*-([0-9]+)\.html(?:[?#].*)?$/,
				qfi: "https://" + domain + "/pics/-${id}.html",
				image_regex: /<img class='img-thumbnail\s+img-responsive\s+sharpen' src='(https?:\/\/[^/]+\/+content\/[^']+)'/,
				video_regex: /(<video id="fluidPlayer">[\s\S]+<\/video>)/
			};

			var pw_info = {
				regex: /^[a-z]+:\/\/[^/]+\/+[^/]*-([0-9]+)\.html(?:[?#].*)?$/,
				qfi: "https://" + domain + "/-${id}.html",
				image_regex: /<figure\s+class='gallery-thumb[^"']*'>\s*<a\s+(?:[^>]+\s+)?href='(https?:\/\/[^/]+\/+(?:[^"']+\/+)?content\/[^'"]+\/full\/[^'"]+)'/,
				video_regex: /(<video id="pinkworld_video"[\s\S]+<\/video>)/
			};

			var our_info = domain_nosub === "eroticbeauties.net" ? eb_info : pw_info;

			newsrc = website_query({
				// eb.net only
				website_regex: our_info.regex,
				query_for_id: our_info.qfi,
				override_cb: function(cb, data) {
					var id = "1";
					let imu_id = src.match(/#imu-id=(.*)/);
					if (imu_id)
						id = imu_id[1];

					common_functions["update_album_info_links"](data, function(x) {
						let x_id = x.replace(/.*\/(?:[^/?#.]+_)?([0-9]+\.)[a-z0-9]{3,4}(?:[?#].*)?$/i, "$1");
						return x_id === id;
					});

					cb(data);
				},
				process: function(done, resp, cache_key) {
					var matches = match_all(resp.responseText, our_info.image_regex);
					if (!matches) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					let images = [];

					let video_match = resp.responseText.match(our_info.video_regex);
					if (video_match) {
						var videosources = common_functions["get_videotag_sources"](video_match[1]);
						if (videosources && videosources.video.length) {
							for (let video of videosources.video) {
								images.push({
									url: video.url,
									headers: {
										Referer: "https://" + domain + "/"
									},
									video: true,
									is_current: false
								});

								// since this is an album, we only want the largest video
								break;
							}
						}
					}

					for (let i = 0; i < matches.length; i++) {
						images.push({
							url: decode_entities(matches[i][1]),
							is_current: i === 0
						});
					}

					return done({
						url: images[0].url,
						album_info: {
							type: "links",
							links: images
						},
						is_private: true
					}, 200); // pinkworld = 255 seconds?
				}
			});
			if (newsrc) return newsrc;
		}

		if ((host_domain_nowww === "eroticbeauties.net" ||
			host_domain === "blog.pinkworld.com") && options.element) {
			var fullimg = null;
			newsrc = common_functions["get_pagelink_host_el_matching"](options, {
				url_match: /^[a-z]+:\/\/[^/]+\/+(?:pics\/+)?[^/]*-[0-9]+\.html(?:[?#].*)?$/,
				el_match: function(x) {
					if ((x.tagName !== "IMG" || !x.classList.contains("img-responsive")) &&
						(x.tagName !== "SOURCE" && (!x.parentElement || x.parentElement.tagName !== "PICTURE")))
						return false;

					var current = x;
					while (current = current.parentElement) {
						if (current.tagName === "FIGURE" ||
							(current.tagName === "A" && current.classList.contains("pswp_open"))) {
							let alink = current;
							if (current.tagName !== "A")
								alink = current.querySelector("a");
							fullimg = alink.href;
							return true;
						}
					}

					return false;
				}
			});

			if (newsrc) {
				var urls = [];

				urls.push({
					url: options.host_url.replace(/[?#].*/, "") + "#imu-id=" + src.replace(/.*\/(?:[^/?#.]+_)?([0-9]+\.)[a-z0-9]{3,4}(?:[?#].*)?$/i, "$1"),
					is_pagelink: true
				});

				if (fullimg)
					urls.push(fullimg);

				if (urls.length)
					return urls;
			}
		}

		if (domain_nosub === "eroticbeauties.net" ||
			// http://cdn.hometownnudes.com/content/atk-galleria-ashley-stone-253374/auto/5/tn@1x/01.jpg
			//   http://cdn.hometownnudes.com/content/atk-galleria-ashley-stone-253374/full/01.jpg
			domain_nosub === "hometownnudes.com" ||
			// thanks to vscum on github for reporting: https://github.com/qsniyg/maxurl/issues/1166
			// https://cdn.eroticmetart.com/content/metart_ba45b9ea1e5d6/auto/7/main/01.webp
			//   https://cdn.eroticmetart.com/content/metart_ba45b9ea1e5d6/auto/7/main/01.jpg
			//   https://cdn.eroticmetart.com/content/metart_ba45b9ea1e5d6/full/01.jpg
			domain_nosub === "eroticmetart.com"
			// http://media.pinkworld.com/cms/content/povd_20151221130919_alex-grey-picnic-in-the-park/tn@1x/02.jpg
			//   http://media.pinkworld.com/cms/content/povd_20151221130919_alex-grey-picnic-in-the-park/full/02.jpg
			// http://media.pinkworld.com/cms/content/ftvgirls_20150908142022_alexia-a-fresh-nudist/1024/01.jpg
			//   http://media.pinkworld.com/cms/content/ftvgirls_20150908142022_alexia-a-fresh-nudist/full/01.jpg
			//domain_nosub === "pinkworld.com"
			) {
			// https://cdn.eroticbeauties.net/content/digital-desire-bree-daniels-11136-1/auto/3/tn@1x/04.jpg
			//   https://cdn.eroticbeauties.net/content/digital-desire-bree-daniels-11136-1/full/04.jpg
			//   https://cdn.eroticbeauties.net/content/digital-desire-bree-daniels-11136-1/full/test_04.jpg
			// thanks to vscum on github: https://github.com/qsniyg/maxurl/pull/1147/files
			// https://cdn.eroticbeauties.net/content/metart_20160107202957_blake-bartelli-mointa-by-charles-lightfoot/auto/3/tn@2x/01.webp
			//   https://cdn.eroticbeauties.net/content/metart_20160107202957_blake-bartelli-mointa-by-charles-lightfoot/full/01.jpg
			let baseobj = {
				headers: {
					Referer: "http://" + domain_nosub + "/"
				},
				referer_ok: {
					same_domain_nosub: true
				}
			};

			newsrc = src.replace(/\.webp([?#].*)?$/, ".jpg$1");
			if (newsrc !== src) {
				baseobj.url = newsrc;
				return baseobj;
			}

			newsrc = src.replace(/(\/content\/+[^/]*\/+)(?:[^/]*\/+[^/]*\/+)?(?:tn@[^/]*|[0-9]+|main)\/+((?:[^/.]+_)?[0-9]+\.[^/.]*)$/, "$1full/$2");
			if (newsrc !== src) {
				baseobj.url = newsrc;
				return baseobj;
			}
		}

		if (domain_nowww === "barahla.net") {
			// https://www.barahla.net/images/photo/2/20141209/5780838/141812085383385200.jpg
			//   https://www.barahla.net/images/photo/2/20141209/5780838/big/141812085383385200_big.jpg
			return src.replace(/(\/images\/photo\/[0-9]+\/[0-9]+\/[0-9]+\/)(?:[a-z]+\/)?([0-9]+)(?:_[a-z]+)?(\.[^/.]*)$/, "$1big/$2_big$3");
		}

		if (domain === "i.pipec.info") {
			// http://i.pipec.info/20180906/600px/53776596847438_mos_02.jpg
			//   http://i.pipec.info/20180906/600px/53776596847438_mos_02.jpg
			return src.replace(/\/[0-9]+px\/([^/]*)$/, "/$1");
		}

		if (domain_nosub === "hothag.com" && domain.match(/^cdn[0-9]*\./)) {
			// https://cdn1.hothag.com/media/galleries_160/1/1/755/24856.jpg
			//   https://cdn1.hothag.com/media/galleries/1/1/755/24856.jpg
			// https://cdn1.hothag.com/media/gifs_160/1/1/774.jpg
			//   https://cdn1.hothag.com/media/gifs//1/1/774.gif
			newsrc = src.replace(/(\/media\/+(?:galleries|images))_[0-9]+\//, "$1/");
			if (newsrc !== src)
				return add_full_extensions(newsrc);

			return src.replace(/(\/media\/+gifs)_[0-9]+(\/+[0-9/]+)\.[^/.]*(?:[?#].*)?$/, "$1/$2.gif");
		}

		if ((domain_nosub === "1zoom.ru" ||
			 // http://s1.1zoom.me/big0/733/363283-sepik.jpg
			 //   http://s1.1zoom.me/big3/733/363283-sepik.jpg
			 // https://s1.1zoom.me/prev2/610/Iceland_Crag_Canyon_609321_300x200.jpg -- 300x199
			 //   https://s1.1zoom.me/prev/610/Iceland_Crag_Canyon_609321_300x200.jpg -- 600x399
			 //   https://s1.1zoom.me/big3/207/Iceland_Crag_Canyon_609321_1280x853.jpg -- 3840x2559
			 domain_nosub === "1zoom.me") &&
			domain.match(/^s[0-9]*\./)) {
			// https://s1.1zoom.ru/big0/639/363168-commander06.jpg -- 1280x800
			//   https://s1.1zoom.ru/big3/639/363168-commander06.jpg -- 3000x1875
			// https://s1.1zoom.ru/b5050/363168-commander06_300x188.jpg -- 300x188
			return src
				.replace(/(:\/\/[^/]*\/)prev2\//, "$1prev/")
				.replace(/(:\/\/[^/]*\/)big[0-9]*\//, "$1big3/");
		}

		if (domain === "st-gdefon.gallery.world" ||
			// http://st.gde-fon.com/wallpapers_medium/413849_devushka_nagota_dlinnye-volosy_cvety_1680x1050_www.Gde-Fon.com.jpg
			//   http://st.gde-fon.com/wallpapers_original/413849_devushka_nagota_dlinnye-volosy_cvety_1680x1050_www.Gde-Fon.com.jpg
			domain === "st.gde-fon.com") {
			// http://st-gdefon.gallery.world/wallpapers_medium/780527_gallery.world.jpg
			//   http://st-gdefon.gallery.world/wallpapers_original/780527_gallery.world.jpg
			return src.replace(/\/wallpapers_[a-z]+(\/[0-9]+_[^/]*)$/, "/wallpapers_original$1");
		}

		if (domain_nowww === "boorp.com") {
			// https://www.boorp.com/sfondi_gratis_desktop_pc/sfondi_gratis/sfondi_anime_manga/miniature/anime_manga_libro_dei_sogni.jpg
			//   https://www.boorp.com/sfondi_gratis_desktop_pc/sfondi_gratis/sfondi_anime_manga/anime_manga_libro_dei_sogni.jpg
			return src.replace(/\/miniature(\/[^/]*)$/, "$1");
		}

		if (domain === "d2pptc4exyus09.cloudfront.net" ||
			// https://static.puzzlefactory.pl/puzzle/117/078/thumb.jpg
			//   https://static.puzzlefactory.pl/puzzle/117/078/original.jpg
			domain === "static.puzzlefactory.pl") {
			// https://d2pptc4exyus09.cloudfront.net/puzzle/128/127/thumb.jpg
			//   https://d2pptc4exyus09.cloudfront.net/puzzle/128/127/original.jpg
			return src.replace(/(\/puzzle\/[0-9]+\/[0-9]+\/)[a-z]+(\.[^/.]*)$/, "$1original$2");
		}

		if (domain_nowww === "sfondo.info") {
			// https://sfondo.info/i/small/4/c/1/13408.jpg
			//   https://sfondo.info/i/original/4/c/1/13408.jpg
			return src.replace(/\/i\/[a-z]+\//, "/i/original/");
		}

		if (domain_nosub === "yiihuu.com" &&
			domain.match(/^img[0-9]*\./)) {
			// http://img4.yiihuu.com/130X130/upimg/courses/2016/04/19/1-1461055933-335054.jpg?auto=h
			//   http://img4.yiihuu.com/upimg/courses/2016/04/19/1-1461055933-335054.jpg
			return src
				.replace(/\/[0-9]+X[0-9]+\/upimg\//, "/upimg/")
				.replace(/\?.*/, "");
		}

		if (domain_nowww === "superwall.us" ||
			// http://www.rex-fox.com/thumbnail/alexz-johnson/alexz-johnson-825.jpg
			//   http://www.rex-fox.com/wallpaper/alexz-johnson/alexz-johnson-825.jpg
			domain_nowww === "rex-fox.com") {
			// https://superwall.us/thumbnail/redjuice_pointy_ears_girl_blue_eyes_male-rABC.jpg
			//   https://superwall.us/wallpaper/redjuice_pointy_ears_girl_blue_eyes_male-rABC.jpg
			return src.replace(/(:\/\/[^/]*\/)thumbnail\//, "$1wallpaper/");
		}

		if (domain_nosub === "mangadrawing.net") {
			// http://mangadrawing.net/users/imagecache/display/image/19418-belt-black-hair-blonde-hair-blue-eyes-gloves.c40921ef095eaadb0bb668a193b1da3b.jpg
			//   http://mangadrawing.net/users/image/19418-belt-black-hair-blonde-hair-blue-eyes-gloves.c40921ef095eaadb0bb668a193b1da3b.jpg
			// http://static.mangadrawing.net/users/imagecache/display/image/19418-belt-black-hair-blonde-hair-blue-eyes-gloves.c40921ef095eaadb0bb668a193b1da3b.jpg
			//   http://static.mangadrawing.net/users/image/19418-belt-black-hair-blonde-hair-blue-eyes-gloves.c40921ef095eaadb0bb668a193b1da3b.jpg
			return src.replace(/\/imagecache\/display\/image\//, "/image/");
		}

		if (domain_nosub === "ucoz.ru" ||
			// http://intoclassics.net/_nw/222/s15806925.jpg
			//   http://intoclassics.net/_nw/222/15806925.jpg
			domain_nowww === "intoclassics.net" ||
			// http://zonemod.com/_pu/0/s38210375.jpg
			//   http://zonemod.com/_pu/0/38210375.jpg
			domain_nowww === "zonemod.com" ||
			// http://sarajean.ucoz.net/_ph/1/1/274840587.jpg?1570878684
			//   http://sarajean.ucoz.net/_ph/1/274840587.jpg?1570878684
			domain_nosub === "ucoz.net") {
			// http://nadinaderose.ucoz.ru/_ph/37/1/660567815.jpg?1535302566
			//   http://nadinaderose.ucoz.ru/_ph/37/660567815.jpg?1535302566
			// http://vampire-club.ucoz.ru/_nw/0/s35048683.jpg
			//   https://vampire-club.ucoz.ru/_nw/0/35048683.jpeg
			// https://kpop-lover.ucoz.ru/_pu/0/s78304637.jpg
			//   https://kpop-lover.ucoz.ru/_pu/0/78304637.jpg
			newsrc = src
				.replace(/(\/_ph\/+[0-9]+\/+)[0-9]+\/+([0-9]+\.[^/.]*)$/, "$1$2")
				.replace(/(\/_(?:nw|pu)\/+[0-9]+\/+)s([0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1$2");
			if (newsrc !== src)
				return add_extensions_jpeg(newsrc);
		}

		if (domain_nowww === "wallpapersdig.com") {
			// http://wallpapersdig.com/images/thumb/category/100x100/wolf-wallpaper-white-girl-soldier-anime-images-4k-full-hd-iphone-143018.jpg
			//    http://wallpapersdig.com/images/original/wolf-wallpaper-white-girl-soldier-anime-images-4k-full-hd-iphone-143018.jpg
			return src.replace(/\/images\/[a-z]+(?:\/.*)?(\/[^/]*-[0-9]+\.[^/.]*)$/, "/images/original$1");
		}

		if (domain === "img.hebus.com") {
			// https://img.hebus.com/hebus_2011/11/21/preview/111121161002_92.jpg
			//   https://img.hebus.com/hebus_2011/11/21/111121161002_92.jpg
			// https://img.hebus.com/hebus_2013/09/26/tn/b1380199789_87580.jpg
			//   https://img.hebus.com/hebus_2013/09/26/1380199789_87580.jpg
			return src.replace(/\/[a-z]+\/[a-z]?([0-9]+_[0-9]+\.[^/.]*)$/, "/$1");
		}

		if (domain === "content.eroo.pl") {
			// http://content.eroo.pl/87HpR8ufu8RBvC69xz15QM7885u4yUkG/2_mini.jpg
			//   http://content.eroo.pl/87HpR8ufu8RBvC69xz15QM7885u4yUkG/2.jpg
			return src.replace(/(\/[0-9]+)_[a-z]+(\.[^/.]*)$/, "$1$2");
		}

		if (domain_nowww === "timdir.com") {
			// http://timdir.com/ws/bree_daniels_babe_purple_top/bree_daniels_07.tn.jpg
			//   http://timdir.com/ws/bree_daniels_babe_purple_top/bree_daniels_07.jpg
			return src.replace(/\.tn(\.[^/.]*)$/, "$1");
		}

		if (domain_nowww === "live-stats.me") {
			// https://live-stats.me/pics/thumbs/104/372/12.jpg
			//   https://live-stats.me/pics/images/104/372/12.jpg
			return src.replace(/\/pics\/+thumbs\//, "/pics/images/");
		}

		if (domain_nowww === "plekoflady.ga") {
			// https://plekoflady.ga/media/thumbs/165/369/1.jpg
			//   https://plekoflady.ga/media/images/165/369/1.jpg
			return src.replace(/\/media\/+thumbs\/+/, "/media/images/");
		}

		if (domain_nowww === "celebcafe.net") {
			// http://www.celebcafe.net/blog/thumbs/aSelena%20Gomez%20%20At%20swimming%20pool%20in%20Miami%20-%20Oct%2028%2C%202013%20%2844%29.jpg
			//   http://www.celebcafe.net/blog/pics/aSelena%20Gomez%20%20At%20swimming%20pool%20in%20Miami%20-%20Oct%2028%2C%202013%20%2844%29.jpg
			newsrc = src.replace(/\/blog\/thumbs\//, "/blog/pics/");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nowww === "z-celebs.com" ||
			// https://www.celebcafe.net/k/katharine_mcphee_08/pics/thumbs/katharine_mcphee_03.jpg
			//   https://www.celebcafe.net/k/katharine_mcphee_08/pics/katharine_mcphee_03.jpg
			domain_nowww === "celebcafe.net" ||
			// http://www.neocelebs.com/fg/l/lena_gercke_03/pics/thumbs/lena_gercke_01.jpg
			//   http://www.neocelebs.com/fg/l/lena_gercke_03/pics/lena_gercke_01.jpg
			domain_nowww === "neocelebs.com" ||
			// http://www.starsmaster.com/j/julia_kijowska_01/pics/thumbs/julia_kijowska_12.jpg
			domain_nowww === "starsmaster.com" ||
			// https://www.starzhunter.com/a/aly_raisman_01/pics/thumbs/aly_raisman_03.jpg
			//   https://www.starzhunter.com/a/aly_raisman_01/pics/aly_raisman_03.jpg
			domain_nowww === "starzhunter.com" ||
			// http://www.easycelebritys.com/f/felicity_jones_02/pics/thumbs/felicity_jones_14.jpg
			//   http://www.easycelebritys.com/f/felicity_jones_02/pics/felicity_jones_14.jpg
			domain_nowww === "easycelebritys.com") {
			// https://www.z-celebs.com/a/ariana_grande_26/pics/thumbs/ariana_grande_09.jpg
			//   https://www.z-celebs.com/a/ariana_grande_26/pics/ariana_grande_09.jpg
			return src.replace(/\/pics\/+thumbs\/+/, "/pics/");
		}

		if (domain === "cdn.xpics.me" ||
			// http://cdn.pornpic.xxx/2/556/278704/1.jpg
			//   http://cdn.pornpic.xxx/0/556/278704/1.jpg
			domain === "cdn.pornpic.xxx" ||
			// http://cdn.pornpictures.today/2/556/278704/1.jpg
			//   http://cdn.pornpictures.today/0/556/278704/1.jpg
			domain === "cdn.pornpictures.today" ||
			// http://cdn.xnxxpics.top/2/556/278704/1.jpg
			//   http://cdn.xnxxpics.top/0/556/278704/1.jpg
			domain === "cdn.xnxxpics.top" ||
			// https://cdn.hdpornpics.net/1/231/115601/8.jpg
			//   https://cdn.hdpornpics.net/0/231/115601/8.jpg
			domain === "cdn.hdpornpics.net" ||
			// http://cdn.pussy-porn-pics.com/2/231/115601/5.jpg
			//   http://cdn.pussy-porn-pics.com/0/231/115601/5.jpg
			domain === "cdn.pussy-porn-pics.com") {
			// https://cdn.xpics.me/2/231/115601/8.jpg
			//   https://cdn.xpics.me/0/231/115601/8.jpg
			return src.replace(/(:\/\/[^/]*\/)[0-9]\//, "$10/");
		}

		if (domain_nowww === "nehuha.net" && string_indexof(src, "/data/photo/") >= 0) {
			// http://nehuha.net/data/photo/photo_0/bree_daniels_krasivaya_erotika_736/thumb.photo_1.jpg -- stretched
			//   http://nehuha.net/data/photo/photo_0/bree_daniels_krasivaya_erotika_736/photo_1.jpg
			return src.replace(/\/thumb\.([^/]*)$/, "/$1");
		}

		if (domain_nowww === "pornrice.com" ||
			// http://monocdn.com/thumbs/5/8/6/d/b/586dba47067df/1180x660/227.jpg
			//   http://monocdn.com/galleries/5/8/6/d/b/586dba47067df/227.jpg
			domain_nowww === "monocdn.com" ||
			// https://media.jpegworld.com/thumbs/5/8/a/0/d/58a0d8ef22c9a/300x400/3640-01.jpg
			//   https://media.jpegworld.com/galleries/5/8/a/0/d/58a0d8ef22c9a/3640-01.jpg
			domain === "media.jpegworld.com" ||
			// http://www.tokyoteenies.com/media/thumbs/5/9/c/a/3/59ca3d04d54c4/117x117/0.jpg
			//   http://www.tokyoteenies.com/media/galleries/5/9/c/a/3/59ca3d04d54c4/0.jpg
			domain_nowww === "tokyoteenies.com" ||
			// https://cdn.smutie.com/media/thumbs/5/8/1/8/8/58188eed70bea/1180x660/2706.jpg
			//   https://cdn.smutie.com/media/galleries/5/8/1/8/8/58188eed70bea/2706.jpg
			domain === "cdn.smutie.com" ||
			// http://sexthread.com:91/thumbs/5/6/7/a/c/567ac51f95271/117x117/3066.jpg
			//   http://sexthread.com:91/galleries/5/6/7/a/c/567ac51f95271/3066.jpg
			domain_nowww === "sexthread.com" ||
			// http://www.sugarnips.com/media/thumbs/5/7/4/5/6/57456fe90a17e/117x117/87.jpg
			//   http://www.sugarnips.com/media/galleries/5/7/4/5/6/57456fe90a17e/87.jpg
			domain_nowww === "sugarnips.com" ||
			// http://www.galleryportal.com/media/thumbs/5/7/d/5/2/57d5291f6faa3/117x117/47.jpg
			//   http://www.galleryportal.com/media/galleries/5/7/d/5/2/57d5291f6faa3/47.jpg
			domain_nowww === "galleryportal.com") {
			// https://pornrice.com/media/thumbs/5/6/3/c/a/563ca27211a80/236x355/10236.jpg
			//   https://pornrice.com/media/galleries/5/6/3/c/a/563ca27211a80/10236.jpg
			newsrc = src.replace(/(:\/\/[^/]*|\/media)\/+thumbs\/+((?:[0-9a-f]\/){5}[0-9a-f]+\/)[0-9]+x[0-9]+\//, "$1/galleries/$2");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nowww === "tokyoteenies.com") {
			// http://www.tokyoteenies.com/content/honoka-maki-is-bending-over-giving-a-little-japanese-upskirts-action/thumbs_01.jpg
			//   http://www.tokyoteenies.com/content/honoka-maki-is-bending-over-giving-a-little-japanese-upskirts-action/image_01.jpg
			return src.replace(/(\/content\/+[^/]*\/+)thumbs_([0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1image_$2");
		}

		if (domain === "wallpapers.jami.lt") {
			// http://wallpapers.jami.lt/wallpapers/Celebrities/Mandy-Moore/Mandy-Moore-37_big.jpg
			//   http://wallpapers.jami.lt/wallpapers/Celebrities/Mandy-Moore/Mandy-Moore-37.jpg
			return src.replace(/_big(\.[^/.]*)$/, "$1");
		}

		if (domain === "y.yarn.co") {
			// https://y.yarn.co/site/assets/images/black.png
			if (/\/site\/+assets\/+images\/+black\./.test(src))
				return {
					url: src,
					bad: "mask"
				};

			// https://y.yarn.co/0660ad5b-af07-4955-b979-4819b385ae57_thumb.jpg -- 273x114
			//   https://y.yarn.co/0660ad5b-af07-4955-b979-4819b385ae57_screenshot.jpg -- 1142x480
			// https://y.yarn.co/c8b6499c-40e3-435e-b5f2-c41e464144a6_100_h_6.gif
			obj = {
				url: src
			};

			match = src.match(/:\/\/[^/]*\/([-0-9a-f]+)(?:_.*?)(?:[?#].*)?$/);
			if (match) {
				obj.extra = {page: "https://yarn.co/yarn-clip/" + match[1]};
			}

			newsrc = src.replace(/(:\/\/[^/]*\/[-0-9a-f]+)_thumb(\.[^/.]*)$/, "$1_screenshot$2");
			if (newsrc !== src) {
				obj.url = newsrc;
				return obj;
			}

			newsrc = src.replace(/(:\/\/[^/]*\/[-0-9a-f]+)_[0-9]+_[wh]_[0-9]+\.gif(?:[?#].*)?$/, "$1.mp4");
			if (newsrc !== src) {
				obj.url = newsrc;
				obj.video = true;

				return obj;
			}
		}

		if (domain === "images.genius.com") {
			// https://images.genius.com/avatars/small/74258e95c84bfe31cfa588c5d6900e42
			//   https://images.genius.com/avatars/original/74258e95c84bfe31cfa588c5d6900e42
			return src.replace(/\/avatars\/[a-z]+\/([0-9a-f]+)(?:[?#].*)?$/, "/avatars/original/$1");
		}

		if (domain_nosub === "smcloud.net" &&
			domain.match(/^cdn[0-9]*\.thumbs\.common\./)) {
			// http://cdn4.thumbs.common.smcloud.net/common/R/U/s/RU2317200DQNu.jpg/ru-0-ra-104,104-n-RU2317200DQNu_human_behaviour.jpg
			//   http://static.common.smcloud.net/s/RU2317200DQNu.jpg
			return src.replace(/:\/\/[^/]*\/common\/.\/.\/s\/([^/]*\.[^/.]*)\/.*/, "://static.common.smcloud.net/s/$1");
		}

		if (domain_nowww === "recordeli.com") {
			// https://recordeli.com/items/1566/image_small
			//   https://recordeli.com/items/1566/image_big
			return src.replace(/(\/items\/[0-9]+\/image_)[a-z]+(?:[?#].*)?$/, "$1big");
		}

		if (domain_nosub === "liveinternet.ru" &&
			domain.match(/^img[0-9]*\./)) {
			// https://img1.liveinternet.ru/images/attach/d/1/130/383/130383339_preview_1.jpg
			//   https://img1.liveinternet.ru/images/attach/d/1/130/383/130383339_1.jpg
			return src.replace(/(\/[0-9]+)_[a-z]+(_+[0-9A-Za-z]+\.[^/.]*)$/, "$1$2");
		}

		if (domain === "assets.heart.co.uk" ||
			// https://assets.popbuzz.com/2018/06/millie-bobby-brown-maddie-ziegler-1518454562-view-0.jpg
			//   https://assets.popbuzz.com/2018/06/millie-bobby-brown-maddie-ziegler-1518454562.jpg
			domain === "assets.popbuzz.com") {
			// https://assets.heart.co.uk/2015/43/naomie-harris-attends-the-royal-world-premiere-after-party-of-spectre-at-the-british-museum-1445940762-view-0.jpg
			//   https://assets.heart.co.uk/2015/43/naomie-harris-attends-the-royal-world-premiere-after-party-of-spectre-at-the-british-museum-1445940762.jpg
			// https://assets.heart.co.uk/2018/23/holly-june-11-1528712447-herowidev4-0.jpg
			//   https://assets.heart.co.uk/2018/23/holly-june-11-1528712447.jpg
			return src.replace(/(-[0-9]+)-(?:view|herowidev[0-9]*)-[0-9]+(\.[^/.]*)$/, "$1$2");
		}

		if (domain === "kms.yawmiyati.com") {
			// http://kms.yawmiyati.com/Images/120x150xi/180219100537296~8.jpg -- 109x150
			//   http://kms.yawmiyati.com/content/uploads/Article/180219100537296~8.jpg -- 624x858
			// http://kms.yawmiyati.com/Images/613x307xo/170923100547235~job-yawmiyati.jpg
			//   http://kms.yawmiyati.com/content/uploads/Article/170923100547235~job-yawmiyati.jpg
			return src.replace(/\/Images\/[0-9io]+x[0-9io]+x[0-9io]+\//, "/content/uploads/Article/");
		}

		if (domain === "pic.chinasspp.com") {
			// http://pic.chinasspp.com/News/u/693191/image/201606/12124410_6647_s_605x455.jpg
			//   http://pic.chinasspp.com/News/u/693191/image/201606/12124410_6647.jpg
			return src.replace(/_s_[0-9]+x[0-9]+(\.[^/.]*)$/, "$1");
		}

		if (domain_nowww === "eveningecho.ie") {
			// https://www.eveningecho.ie/portalsuite/image//5513a649-667d-4265-bca2-eaa230f04405/mainMediaSize=MEDIUM_type=image_publish=true__image.jpg -- 601x1024
			//   https://www.eveningecho.ie/portalsuite/image//5513a649-667d-4265-bca2-eaa230f04405/mainMediaSize=FILE__image.jpg -- 1200x2044
			// https://www.eveningecho.ie/portalsuite/image//65d7f9a3-93db-48e7-8a2c-736530dd703a/mainMediaSize=FILE_type=image_x0=0_y0=0_x1=100_y1=88.03_alf_ticket=guest_format=1.778__image.jpg -- 4307x2780
			//   https://www.eveningecho.ie/portalsuite/image//65d7f9a3-93db-48e7-8a2c-736530dd703a/mainMediaSize=FILE__image.jpg -- 4307x2780
			return src.replace(/(\/portalsuite\/image\/+[-0-9a-f]+)\/+[^/]*(\.[^/.]*)$/,
							   "$1/mainMediaSize=FILE__image$2");
		}

		if (domain_nowww === "drunkenstepfather.com") {
			// https://drunkenstepfather.com/cms/ul/t-20080416-Aubrey_ODay_Nipples.jpg
			//   https://drunkenstepfather.com/cms/ul/20080416-Aubrey_ODay_Nipples.jpg
			return src.replace(/\/cms\/ul\/t-/, "/cms/ul/");
		}

		if (domain_nowww === "fraufluger.ru") {
			// http://www.fraufluger.ru/files/images/html_gallerys/cultura_gallery/ae2fee29363f533f30e796a30c2a52e5_560.jpg
			//   http://www.fraufluger.ru/files/images/html_gallerys/cultura_gallery/ae2fee29363f533f30e796a30c2a52e5_origin.jpg
			return src.replace(/(\/files\/images\/html_gallerys\/[^/]*\/[0-9a-f]+)_[0-9]+(\.[^/.]*)$/, "$1_origin$2");
		}

		if (domain_nowww === "alfacdn.com") {
			// http://alfacdn.com/2018/03/19/10/2552.jpg -- 200x100
			//   http://alfacdn.com/2018/03/19/10/2552h.jpg -- 270x150
			//   http://alfacdn.com/2018/03/19/10/2552m.jpg -- 600x450
			// open directory listing, even back to 2011, "m" is the largest size
			return src.replace(/(\/[0-9]+)h?(\.[^/.]*)/, "$1m$2");
		}

		if (domain === "s.img.mix.sina.com.cn") {
			// http://s.img.mix.sina.com.cn/auto/resize?img=http%3A%2F%2Fn.sinaimg.cn%2Fent%2F4_img%2Fupload%2F1edcbf7a%2F20171018%2FMW3e-fymvuyt3988351.jpg&size=100_100
			//   http://n.sinaimg.cn/ent/4_img/upload/1edcbf7a/20171018/MW3e-fymvuyt3988351.jpg -- forces download
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/auto\/resize.*?[?&]img=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeURIComponent(newsrc);
		}

		if (domain === "albums.timg.co.il") {
			// http://albums.timg.co.il/userFolders/211/3155441/small/315544120174711119762.jpg
			//   http://albums.timg.co.il/userFolders/211/3155441/315544120174711119762.jpg
			// http://albums.timg.co.il/userFolders/211/3155441/small/3155441201762513520249.jpg
			//   http://albums.timg.co.il/userFolders/211/3155441/3155441201762513520249.jpg
			return src.replace(/(\/userFolders\/[0-9]+\/[0-9]+\/)[a-z]+\/([0-9]+\.[^/.]*)$/, "$1$2");
		}

		if (domain_nowww === "aljanh.net") {
			// http://www.aljanh.net/data/archive/preview/img/2658161267.jpeg
			//   http://www.aljanh.net/data/archive/img/2658161267.jpeg
			return src.replace(/(\/data\/archive\/)[a-z]+\/(img\/[0-9]+\.[^/.]*)$/, "$1$2");
		}

		if (amazon_container === "files.d20.io") {
			// https://s3.amazonaws.com/files.d20.io/images/5100331/I7Z4uj0ryab6NZZqOZRYHw/thumb.jpg?1407651646450&size=100 -- 200x160
			//   https://s3.amazonaws.com/files.d20.io/images/5100331/I7Z4uj0ryab6NZZqOZRYHw/max.jpg -- 300x240
			return src.replace(/(\/images\/[0-9]+\/[^/]*\/)[a-z]+(\.[^/.?]*)(?:[?#].*)?$/, "$1max$2");
		}

		if (domain_nowww === "wallpaperdx.com") {
			// http://www.wallpaperdx.com/photo/jennifer-lawrence-in-black-dress-full-hd-wallpaper-178-101.jpg
			//   http://www.wallpaperdx.com/images/jennifer-lawrence-in-black-dress-full-hd-wallpaper.jpg
			return src.replace(/\/photo(\/[^/]*)-[0-9]+-[0-9]+(\.[^/.]*)$/, "/images$1$2");
		}

		if (domain_nowww === "patrasevents.gr") {
			// https://www.patrasevents.gr/imgsrv/f/188x/1783196.jpg
			//   https://www.patrasevents.gr/imgsrv/f/full/1783196.jpg
			// https://www.patrasevents.gr/imgsrv/f/365x243/3359317.jpg
			//   https://www.patrasevents.gr/imgsrv/f/full/3359317.jpg
			return src.replace(/(\/imgsrv\/+.\/+)[0-9]+x(?:[0-9]+)?\/+/, "$1full/");
		}

		if (domain_nowww === "alazmenah.com" ||
			// http://syria-in.com/thumb_photo//mots/jennifer_lawrence.jpg
			//   http://syria-in.com/photo//mots/jennifer_lawrence.jpg
			domain_nowww === "syria-in.com") {
			// http://alazmenah.com/thumb_photo//00/73/54.jpg
			//   http://alazmenah.com/photo//00/73/54.jpg
			return src.replace(/\/thumb_photo\//, "/photo/");
		}

		if (domain === "images.alwatanvoice.com") {
			// https://images.alwatanvoice.com/news/thumbs/9998658247.jpg
			//   https://images.alwatanvoice.com/news/large/9998658247.jpg
			return src.replace(/\/news\/thumbs\//, "/news/large/");
		}

		if (domain_nowww === "ammanalyoum.com") {
			// http://www.ammanalyoum.com/images/upload/p19ta6fqfi6co16dsveh19k616ku5.jpg/200/200/0
			//   http://www.ammanalyoum.com/images/upload/p19ta6fqfi6co16dsveh19k616ku5.jpg
			// seems to be running timthumb? ommitting /0 results in this error:
			// Query String : src=images/upload&h=p19ta6fqfi6co16dsveh19k616ku5.jpg&w=200&zc=200
			// TimThumb version : 2.8.11
			return {
				url: src.replace(/(\/images\/upload\/[^/]*\.[^/.]*)\/[0-9]+\/[0-9]+\/[0-9]+(?:[?#].*)?$/, "$1"),
				can_head: false // 403
			};
		}

		if (domain_nowww === "shitpostbot.com") {
			// https://www.shitpostbot.com/resize/250/250?img=%2Fimg%2Fsourceimages%2Fjennifer-lawrence-58d3fee56f6e9.jpeg
			//   https://www.shitpostbot.com/img/sourceimages/jennifer-lawrence-58d3fee56f6e9.jpeg
			newsrc = src.replace(/(:\/\/[^/]*\/)resize\/[0-9]+\/[0-9]+.*?[?&]img=([^&]*).*?$/, "$1$2");
			if (newsrc !== src) {
				return decodeURIComponent(newsrc).replace(/(:\/\/[^/]*)\/+/, "$1/");
			}
		}

		if (domain_nowww === "extremnews.com") {
			// https://www.extremnews.com/images/article_portrait-ddef435dbc734c7697b473434f18961e.jpg
			//   https://www.extremnews.com/images/full-ddef435dbc734c7697b473434f18961e.jpg
			return src.replace(/\/images\/[a-z_]+-([0-9a-f]+\.[^/.]*)$/, "/images/full-$1");
		}

		if (domain === "contestimg.wish.com") {
			// https://contestimg.wish.com/api/webimage/56a1c22c297b29182fa5d7e9-medium.jpg -- 200x300
			//   https://contestimg.wish.com/api/webimage/56a1c22c297b29182fa5d7e9-full.jpg -- 400x600
			//   https://contestimg.wish.com/api/webimage/56a1c22c297b29182fa5d7e9-original.jpg -- 400x600, text/html
			// https://contestimg.wish.com/api/webimage/56a1c22c297b29182fa5d7e9-large.jpg?cache_buster\u003d513b122f92896cc70053585f36900b84
			//   https://contestimg.wish.com/api/webimage/56a1c22c297b29182fa5d7e9-full.jpg
			// https://contestimg.wish.com/api/webimage/5908286fc0b6c4293245d792-11-large.jpg -- 600x600
			//   https://contestimg.wish.com/api/webimage/5908286fc0b6c4293245d792-11-full.jpg -- 800x800
			//   https://contestimg.wish.com/api/webimage/5908286fc0b6c4293245d792-11-original.jpg -- 800x800
			return {
				url: src.replace(/(\/api\/webimage\/[0-9a-f]+(?:-[0-9]+)?)-[a-z]+(\.[^/.?]*)(?:[?#].*)?$/, "$1-original$2"),
				head_wrong_contenttype: true
			};
		}

		if (domain === "image.phimmoi.net") {
			// http://image.phimmoi.net/profile/19210/medium.jpg
			//   http://image.phimmoi.net/profile/19210/full.jpg
			return src.replace(/(\/profile\/[0-9]+\/)[a-z]+(\.[^/.]*)$/, "$1full$2");
		}

		if (domain_nosub === "static-bluray.com" &&
			domain.match(/^images[0-9]*\./)) {
			// https://images3.static-bluray.com/products/22/76649_1_medium.jpg -- 136x204
			//   https://images3.static-bluray.com/products/22/76649_1_original.jpg -- 471x709
			// thanks to nimbuz on discord:
			// https://images.static-bluray.com/movies/covers/308327_small.jpg?t=1640990022
			//   https://images.static-bluray.com/movies/covers/308327_medium.jpg?t=1640990022
			//   https://images.static-bluray.com/movies/covers/308327_large.jpg?t=1640990022
			//   https://images.static-bluray.com/movies/covers/308327_front.jpg?t=1640990022
			// thanks to tathastu871 on github: https://github.com/qsniyg/maxurl/issues/1089
			// https://images.static-bluray.com/movies/macovers/8494_medium.jpg?t=1664952445
			//   https://images.static-bluray.com/movies/macovers/8494_front.jpg?t=1664952445 -- 2000x3000
			// https://images.static-bluray.com/movies/uvcovers/4000_small.jpg
			//   https://images.static-bluray.com/movies/uvcovers/4000_front.jpg -- 800x1200
			// thanks to tathastu871 on github: https://github.com/qsniyg/maxurl/issues/1089
			// https://images.static-bluray.com/reviews/26731_2_tn.jpg
			//   https://images.static-bluray.com/reviews/26731_2.jpg
			//   https://images.static-bluray.com/reviews/26731_2_large.jpg
			// thanks to tathastu871 on github: https://github.com/qsniyg/maxurl/issues/1089
			// https://images.static-bluray.com/htgallery/149823_tn.jpg
			//   https://images.static-bluray.com/htgallery/149823.jpg

			return src
				.replace(/(\/reviews\/+[0-9]+_[0-9]+)(?:_tn)?(\.[^/.]*)$/, "$1_large$2")
				.replace(/(\/htgallery\/+[0-9]+)_tn(\.[^/.]*)$/, "$1$2")
				.replace(/(\/products\/+[0-9]+\/+[0-9]+_[0-9]+_)[a-z]+(\.[^/.]*)$/, "$1original$2")
				.replace(/(\/movies\/+(?:ma|uv)?covers\/+[0-9]+_)(?:small|medium|large)\./, "$1front.");
		}

		if (domain_nowww === "titus.kz" ||
			// http://shymkent.kz/load_theme/files/201707011729015957877d7ce97.j_s.jpg
			//   http://shymkent.kz/load_theme/files/201707011729015957877d7ce97.jpg
			domain_nowww === "shymkent.kz") {
			// http://titus.kz/load_theme/files/2014092615075454252ceaef976.j_s.jpg
			//   http://titus.kz/load_theme/files/2014092615075454252ceaef976.jpg
			return src.replace(/(\/load_theme\/files\/[0-9a-f]+)\.[^/]*(\.[^/.]*)$/, "$1$2");
		}

		if (domain_nowww === "mfoxes.net") {
			// https://mfoxes.net/c/castimagethumb-1157358.jpg
			//   https://mfoxes.net/c/castimage-1157358.jpg
			// https://mfoxes.net/w,300,/gal/8675-t-poster-english/mfoxes-net-cover-english-11.jpg
			//   https://mfoxes.net/gal/8675-t-poster-english/mfoxes-net-cover-english-11.jpg
			return src
				.replace(/\/[a-z],[0-9]+,[^/]*\/gal\//, "/gal/")
				.replace(/\/castimagethumb-([0-9]+\.[^/.]*)$/, "/castimage-$1");
		}

		if (domain === "i.ucrazy.ru") {
			// http://i.ucrazy.ru/files/i/2012.11.10/thumbs/1352508738_k-54.jpg
			//   http://i.ucrazy.ru/files/i/2012.11.10/1352508738_k-54.jpg
			// https://i.ucrazy.ru/files/pics/2020.11/thumbs/photo16055400400.jpg
			//   https://i.ucrazy.ru/files/pics/2020.11/photo16055400400.jpg
			return src.replace(/(\/files\/+(?:i|pics)\/+[0-9]{4}\.[0-9]{1,2}(?:\.[0-9]{1,2})?\/)thumbs\//, "$1");
		}

		if (domain_nowww === "athinorama.gr") {
			// http://www.athinorama.gr/lmnts/articles/2523568/emilia%20.jpg.ashx?w=210
			//   http://www.athinorama.gr/lmnts/articles/2523568/emilia%20.jpg
			return src.replace(/(\/articles\/[0-9]+\/[^/.]*\.[^/.]*)\.ashx\?.*$/, "$1");
		}

		if (domain_nosub === "spiiky.com" && domain.match(/^img[0-9]*\./)) {
			// https://img1.spiiky.com/events/C/63798_0_0e50be763688487184865cb522ddd8ed.jpeg.ashx?format=jpg&quality=80&scale=both&crop=(0,286,1080,913)&width=270&height=159
			//   https://img1.spiiky.com/events/C/63798_0_0e50be763688487184865cb522ddd8ed.jpeg
			return src.replace(/\.ashx\?.*/, "");
		}

		if (domain_nowww === "murekkephaber.com") {
			// https://www.murekkephaber.com/images/haberler/2018/09/emilia-clarke-rol-alacagim-yapimlari-ince-eleyip-sik-dokuyacagim_t.jpg
			//   https://www.murekkephaber.com/images/haberler/2018/09/emilia-clarke-rol-alacagim-yapimlari-ince-eleyip-sik-dokuyacagim.jpg
			return src.replace(/(\/images\/[^/]*\/[0-9]+\/[0-9]+\/[^/]*)_t(\.[^/.]*)$/, "$1$2");
		}

		if (domain_nowww === "egehaber.com") {
			// https://www.egehaber.com/images/haberler/thumbs/2018/10/gigi-hadid-hamburgerle-kilo-almaya-calisiyor-gigi-hadid-kimdir_34fb1.jpg
			//   https://www.egehaber.com/images/haberler/2018/10/gigi-hadid-hamburgerle-kilo-almaya-calisiyor-gigi-hadid-kimdir_34fb1.jpg
			return src.replace(/\/images\/+haberler\/+thumbs\/+/, "/images/haberler/");
		}

		if (domain_nowww === "dienvienvietnam.vn" &&
			string_indexof(src, "/assets/img/") >= 0) {
			// https://dienvienvietnam.vn/assets/img/tall-all-1_1530277982_large.jpg
			//   https://dienvienvietnam.vn/assets/img/tall-all-1_1530277982_grande.jpg
			// tiny, small, medium (512), large (1024), grande (1280)
			return src.replace(/(_[0-9]+)_[a-z]+(\.[^/.]*)$/, "$1_grande$2");
		}

		if (amazon_container === "s3bucketvn") {
			// https://s3-sa-east-1.amazonaws.com/s3bucketvn/images/thumbs/medium/2da02f15db2cd72551d53a53757aab70016eb7f0.jpg
			//   https://s3-sa-east-1.amazonaws.com/s3bucketvn/images/2da02f15db2cd72551d53a53757aab70016eb7f0.jpg
			return src.replace(/\/images\/thumbs\/[a-z]+\/([0-9a-f]+\.[^/.]*)$/, "/images/$1");
		}

		if (domain_nosub === "gazeta.ua" &&
			domain.match(/^static[0-9]*\./)) {
			// https://static2.gazeta.ua/img2/cache/preview/858/858985_a_290_232.jpg?v=0
			//   https://static2.gazeta.ua/img2/original/preview/858/858985.jpg?v=0
			// https://static2.gazeta.ua/img2/cache/gallery/858/858985_3_w_1000.jpg?v=0 -- different image from above
			// https://static2.gazeta.ua/img2/cache/gallery/758/758623_1_w_1200.jpg?v=0
			//   https://static2.gazeta.ua/img2/original/gallery/758/758623.jpg?v=0 -- doesn't work
			//   https://static2.gazeta.ua/img2/original/preview/758/758623.jpg?v=0 -- works, similar but possibly different image?
			// https://static.gazeta.ua/img/cache/gallery/702/702376_1_w_570.jpg?v=0
			//   https://static.gazeta.ua/img/original/gallery/702/702376_1.jpg?v=0
			return src.replace(/(\/img2?\/+)[a-z]+\/+([a-z]+\/+[0-9]+\/+[0-9]+(?:_[0-9]+)?)_[^/]*(\.[^/.]*)$/, "$1original/$2$3");
			//return src.replace(/\/img\/+cache\/+([a-z]+\/+[0-9]+\/+[0-9]+(?:_[^/]*?)?)_[wh]_[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "/img/original/$1$2");
		}

		if (domain_nowww === "gazzettadiparma.it" ||
			// https://img.liberoquotidiano.it/resizer/-1/-1/true/1482833567358.JPG--.JPG?1482833575000
			//   https://img.liberoquotidiano.it/upload/1482833567358.JPG -- works, but displays as text
			domain === "img.liberoquotidiano.it" ||
			// https://www.dundalkdemocrat.ie/resizer/750/563/true/1515682498754.jpg--have_you_seen_this_beautiful_bird_of_prey_in_the_skies_above_dundalk_and_louth_.jpg?1515682499000
			//   https://www.dundalkdemocrat.ie/upload/1515682498754.jpg
			domain_nowww === "dundalkdemocrat.ie" ||
			// https://www.donegaldemocrat.ie/resizer/750/563/true/1512840769676_1512840806.jpg--new_social_media_must_be_embraced_but_also_monitored___donegal_pro_ed_byrne.jpg?1512840807000
			//   https://www.donegaldemocrat.ie/resizer/-1/-1/true/1512840769676_1512840806.jpg--new_social_media_must_be_embraced_but_also_monitored___donegal_pro_ed_byrne.jpg?1512840807000
			//   https://www.donegaldemocrat.ie/upload/1512840769676_1512840806.jpg
			domain_nowww === "donegaldemocrat.ie" ||
			// https://www.liberoquotidiano.it/resizer/610/-1/false/1472720861989.jpg--.jpg?1472720874000
			//   https://www.liberoquotidiano.it/resizer/-1/-1/false/1472720861989.jpg--.jpg?1472720874000
			//   https://www.liberoquotidiano.it/upload/1472720861989.jpg
			domain_nowww === "liberoquotidiano.it") {
			// https://www.gazzettadiparma.it/resizer/299/183/true/1536836112579.jpg--.jpg?1536836014000
			//   https://www.gazzettadiparma.it/resizer/-1/-1/false/1536836112579.jpg--.jpg?1536836014000
			//   https://www.gazzettadiparma.it/upload/1536836112579.jpg
			// https://www.gazzettadiparma.it/resizer_ext/300/-1/true/https%3A//pad.mymovies.it/filmclub/2017/04/227/locandina.jpg--.jpg
			//   https://pad.mymovies.it/filmclub/2017/04/227/locandina.jpg
			// true = ignore aspect ratio
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/resizer_ext\/[-0-9]+\/[-0-9]+\/[a-z]+\/(http)/, "$1");
			if (newsrc !== src)
				return decodeURIComponent(newsrc).replace(/--(\.[^/.]*)$/, "");

			//newsrc = src.replace(/\/resizer\/[-0-9]+\/[-0-9]+\/[a-z]+\//, "/resizer/-1/-1/false/");
			newsrc = src.replace(/\/resizer\/[-0-9]+\/[-0-9]+\/[a-z]+\/([0-9]+(?:_[0-9]+)?\.[^-/.]+)--.*/, "/upload/$1");
			if (newsrc !== src)
				return newsrc;

			newsrc = src.replace(/\/resizer\/+[-0-9]+\/+[-0-9]+\/+[a-z]+\//, "/resizer/-1/-1/true/");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "media.defense.gov") {
			// thanks to roi:
			// https://media.defense.gov/2023/Nov/09/2003338591/1280/1280/0/231108-F-VJ532-1955.JPG
			//   https://media.defense.gov/2023/Nov/09/2003338591/-1/-1/0/231108-F-VJ532-1955.JPG
			return src.replace(/\/[0-9]+\/+[0-9]+\/+[^/]+\/+([^/]+)(?:[?#].*)?$/, "/-1/-1/0/$1");
		}

		if (domain === "multimidia.correiodopovo.com.br") {
			// http://multimidia.correiodopovo.com.br/thumb.aspx?Caminho=multimidia/2016/11/19/407295.JPG&Tamanho=690
			//   http://multimidia.correiodopovo.com.br/multimidia/2016/11/19/407295.JPG
			return src.replace(/(:\/\/[^/]*\/)thumb\.aspx.*?Caminho=([^&]*).*?$/, "$1$2");
		}

		if (domain_nosub === "diziler.com" &&
			domain.match(/^s[0-9]*\./)) {
			// https://s01.diziler.com/img/300x170/18-05/16/siren-dizisi-yeni-sezon-onayi.jpg?0.36658649956594314
			//   https://s01.diziler.com/original/18-05/16/siren-dizisi-yeni-sezon-onayi.jpg?0.36658649956594314
			return src.replace(/(:\/\/[^/]*\/)img\/[0-9]+x[0-9]+\//, "$1original/");
		}

		if (domain === "g.denik.cz") {
			// https://g.denik.cz/56/15/eline-powell-twitter-nude1_sip-140up.jpg
			//   https://g.denik.cz/56/15/eline-powell-twitter-nude1.jpg
			return src.replace(/_sip-[0-9]+up(\.[^/.]*)$/, "$1");
		}

		if (domain_nowww === "imperiodefamosas.com") {
			// http://www.imperiodefamosas.com/image_cache.php?file=Fotos/Eline_Powell/Eline_Powell_018.jpg
			//   http://www.imperiodefamosas.com/Fotos/Eline_Powell/Eline_Powell_018.jpg
			return src.replace(/(:\/\/[^/]*\/)image_cache\.php.*?[?&]file=([^&]*).*?$/, "$1$2");
		}

		if (domain_nowww === "lostfilm.info") {
			// http://lostfilm.info/images/150photo_actor/69/2569792_689554.jpg
			//   http://lostfilm.info/images/photo_actor/69/2569792_689554.jpg
			// http://lostfilm.info/images/150poster/546/5456250.jpg
			//   http://lostfilm.info/images/poster/546/5456250.jpg
			return src.replace(/\/images\/+[0-9]+(photo|poster)/, "/images/$1");
		}

		if (domain_nowww === "hinhnenso1.com") {
			// http://hinhnenso1.com/images/blogs/2016/06/tiny/hinh-anh-cac-co-gai-cosplay-cuc-dep-1465867333.jpg
			// http://hinhnenso1.com/images/blogs/2016/06/original/hinh-anh-cac-co-gai-cosplay-cuc-dep-1465867333.jpg
			return src.replace(/(\/images\/blogs\/[0-9]+\/[0-9]+\/)[a-z]+\//, "$1original/");
		}

		if (domain_nowww === "avatarko.ru") {
			// https://avatarko.ru/img/preview/32/devushka_31031.jpg
			//   https://avatarko.ru/img/kartinka/32/devushka_31031.jpg
			return src.replace(/(:\/\/[^/]*\/img\/)[a-z]+\//, "$1kartinka/");
		}

		if (domain_nowww === "ppe.pl") {
			// https://www.ppe.pl/upload/news/88/83/10/normal_888310616.jpg
			//   https://www.ppe.pl/upload/news/88/83/10/888310616.jpg
			return src.replace(/(\/upload\/news\/(?:[0-9]+\/){3})[a-z]+_([0-9]+\.[^/.]*)$/, "$1$2");
		}

		if (domain === "storge.pic2.me") {
			// https://storge.pic2.me/c/560x350/211/57caf262ca47b.jpg
			//   https://storge.pic2.me/upload/211/57caf262ca47b.jpg
			// https://storge.pic2.me/cm/480x272/677/Animals%20Wallpapers%2070.jpg
			//   https://storge.pic2.me/upload/677/Animals%20Wallpapers%2070.jpg
			return src.replace(/\/cm?\/[0-9]+x[0-9]+\//, "/upload/");
		}

		if (domain_nowww === "serey.io") {
			// https://serey.io/imageproxy/100x100/https://serey.io/imageupload_data/7251e692d4e1c8295fce5ba38596a51478f2569d
			//   https://serey.io/imageupload_data/7251e692d4e1c8295fce5ba38596a51478f2569d
			return src.replace(/^[a-z]+:\/\/[^/]*\/imageproxy\/[0-9]+x[0-9]+\/(https?:\/\/)/, "$1");
		}

		if (domain === "static.pjmedia.com") {
			// https://static.pjmedia.com/trending/user-content/51/files/2016/06/shutterstock_335198975.sized-770x415xt.jpg
			//   https://static.pjmedia.com/trending/user-content/51/files/2016/06/shutterstock_335198975.jpg
			return src.replace(/\.sized-[0-9t]+x[0-9t]+x[0-9t]+(\.[^/.]*)$/, "$1");
		}

		if (domain === "file.nxing.cn" ||
			// http://upload.nxing.cn/uploads/uploads/2017/03/10/0000081/2017031015023731909f265-size2119x2991.jpeg
			//   http://upload.nxing.cn/uploads/uploads/2017/03/10/0000081/2017031015023731909f265.jpeg
			domain === "upload.nxing.cn") {
			// http://file.nxing.cn/uploads/uploads/2017/05/12/0000015/201705121104364104e5b14-size950x1330_thum_w260xh360xm0xf0xc1.jpeg
			//   http://file.nxing.cn/uploads/uploads/2017/05/12/0000015/201705121104364104e5b14.jpeg
			// http://file.nxing.cn/uploads/uploads/2016/10/17/0000000/20161017060127040585051-size666x1000.jpg
			//   http://file.nxing.cn/uploads/uploads/2016/10/17/0000000/20161017060127040585051.jpg
			return {
				url: src.replace(/(\/uploads\/uploads\/[0-9]+\/[0-9]+\/[0-9]+\/[0-9]+\/[0-9a-f]+)-size[0-9]+x[0-9]+(?:_[^/]*)?(\.[^/.]*)$/, "$1$2"),
				headers: {
					Referer: ""
				}
			};
		}

		// LookBooks
		if (amazon_container === "kateryan" ||
			// https://totalworld.s3.amazonaws.com/lg_51cafb88-bbf8-4942-ba24-63f80aa613db.jpg
			//   https://totalworld.s3.amazonaws.com/gxxl_51cafb88-bbf8-4942-ba24-63f80aa613db.jpg -- 2148x1440
			// thanks to Regis on discord:
			// https://totalworld.s3.amazonaws.com/lg_5f13e29a-3c50-44d7-83b9-0d06ac110003.jpg
			//   https://totalworld.s3.amazonaws.com/gxxl_5f13e29a-3c50-44d7-83b9-0d06ac110003.jpg -- 1080x1080
			amazon_container === "totalworld" ||
			// https://s3.amazonaws.com/lkbkspro/steve-giralt/video_5f15d293-3f60-4a6b-a47b-043dac110002.mp4
			//   https://s3.amazonaws.com/lkbkspro/steve-giralt/hd_5f15d293-3f60-4a6b-a47b-043dac110002.mp4
			//   https://s3.amazonaws.com/lkbkspro/steve-giralt/fullhd_5f15d293-3f60-4a6b-a47b-043dac110002.mp4
			amazon_container === "lkbkspro" ||
			// thanks to Regis on discord:
			// https://clmlkbks.s3.amazonaws.com/lg_5f0f5c52-f498-4935-a082-3b67ac110005.jpg
			//   https://clmlkbks.s3.amazonaws.com/gxxl_5f0f5c52-f498-4935-a082-3b67ac110005.jpg
			amazon_container === "clmlkbks" ||
			// https://defacto.s3.amazonaws.com/lg_5f10bb76-22ec-4802-9f4b-1035ac110006.jpg
			//   https://defacto.s3.amazonaws.com/gm_5f10bb76-22ec-4802-9f4b-1035ac110006.jpg
			//   https://defacto.s3.amazonaws.com/gl_5f10bb76-22ec-4802-9f4b-1035ac110006.jpg
			//   https://defacto.s3.amazonaws.com/gxxl_5f10bb76-22ec-4802-9f4b-1035ac110006.jpg
			amazon_container === "defacto" ||
			// https://apostrophelookbooks.s3.amazonaws.com/lg_5f10cb16-6490-406c-9ddd-1125ac110002.jpg
			//   https://apostrophelookbooks.s3.amazonaws.com/gxxl_5f10cb16-6490-406c-9ddd-1125ac110002.jpg
			amazon_container === "apostrophelookbooks" ||
			// https://thegardenparty.s3.amazonaws.com/lg_5e41cd99-480c-4510-9f0e-7e18ac110004.jpg
			//   https://thegardenparty.s3.amazonaws.com/gxxl_5e41cd99-480c-4510-9f0e-7e18ac110004.jpg
			amazon_container === "thegardenparty" ||
			// https://exposureny.s3.amazonaws.com/lg_5ef4ad67-3e34-4ab9-9e45-0bccac110006.jpg
			amazon_container === "exposureny" ||
			// https://atomo-management.s3.amazonaws.com/lg_5c9254e3-1248-4463-b3ba-001fac110005.jpg
			amazon_container === "atomo-management" ||
			// https://traceymattingly.s3.amazonaws.com/lg_5deaf7da-8d0c-453f-ad32-0bb4ac110008.jpg
			amazon_container === "traceymattingly" ||
			// https://jmireps.s3.amazonaws.com/lg_5ef3957e-68e8-4d79-b616-6725ac110003.jpg
			amazon_container === "jmireps" ||
			// https://assets.lookbookspro.com/streeters/gs_5ae394cf-be4c-4cfd-8257-764eac110002.jpg
			//   https://assets.lookbookspro.com/streeters/gxxl_5ae394cf-be4c-4cfd-8257-764eac110002.jpg
			// https://clmlkbks.assets.lookbookspro.com/gxl_5c59a9a9-17c4-4015-a8b6-0b07ac110004.jpg
			//   https://clmlkbks.assets.lookbookspro.com/gxxl_5c59a9a9-17c4-4015-a8b6-0b07ac110004.jpg
			(domain_nosub === "lookbookspro.com" && domain.match(/assets\.lookbookspro\.com$/))) {
			// https://kateryan.s3.amazonaws.com/lg_54c2cdfa-5a58-46c5-ba51-1a270a771fd0.jpg
			//   https://kateryan.s3.amazonaws.com/gxxl_54c2cdfa-5a58-46c5-ba51-1a270a771fd0.jpg
			// to find more sites: https://lookbooks.com/ (thanks to Regis on discord)
			if (/\/[a-z]+_[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}\.[^/.]+(?:[?#].*)?$/) {
				return src
					.replace(/\/(?:lg|g(?:[sm]|x?l))_([-0-9a-f]{20,}\.)/, "/gxxl_$1")
					.replace(/\/hd_([-0-9a-f]{20,}\.)/, "/fullhd_$1")
					.replace(/\/video_([-0-9a-f]{20,}\.)/, "/hd_$1");
			}
		}

		if (domain_nowww === "havepussy.com") {
			// https://havepussy.com/uploads/photos/previews/3576_havepussy_.jpg
			//   https://havepussy.com/0-0/3576_havepussy_.jpg
			return src.replace(/\/uploads\/photos\/previews\/([0-9]+_[^/]*)$/, "/0-0/$1");
		}

		if (domain === "news.walkerplus.com") {
			// https://news.walkerplus.com/article/118051/651728_615.jpg
			//   https://news.walkerplus.com/article/118051/651728.jpg
			return {
				url: src.replace(/(\/article\/[0-9]+\/[0-9]+)_[0-9]+(\.[^/.]*)$/, "$1$2"),
				can_head: false // 404
			};
		}

		if (domain === "movie.walkerplus.com" ||
			// thanks to nimbuz on discord for reporting:
			// https://moviewalker.jp/api/resizeimage/news/article/1046699/10436112?w=1400 -- 1400x933, upscaled
			//   https://news.walkerplus.com/article/1046699/10436112.jpg -- 1200x800
			domain_nowww === "moviewalker.jp") {
			// https://movie.walkerplus.com/api/resizeimage/content/46673?w=540
			//   https://movie.walkerplus.com/api/resizeimage/content/46673?w=
			newsrc = src.replace(/(\/api\/+resizeimage\/.*?)(?:[?#].*)?$/, "$1?w=");
			if (newsrc !== src)
				return newsrc;

			// https://movie.walkerplus.com/api/resizeimage/news/article/16919/64515?w=240
			newsrc = src.replace(/:\/\/[^/]+\/+api\/+resizeimage\/+news\/+(.*?)(?:[?#].*)?$/, "://news.walkerplus.com/$1.jpg");
			if (newsrc !== src)
				return add_extensions(newsrc);
		}

		if (domain === "img.jj20.com") {
			// http://img.jj20.com/up/allimg/mx01/06161QT509/1P6161T509-5-lpp.jpg
			//   http://img.jj20.com/up/allimg/mx01/06161QT509/1P6161T509-5.jpg
			//   http://pic.jj20.com/up/allimg/mx01/06161QT509/1P6161T509-5.jpg
			return src.replace(/(\/[0-9A-Z]+-[0-9]+)-[a-z]+(\.[^/.]*)$/, "$1$2");
		}

		if (domain === "i.iplsc.com") {
			// https://i.iplsc.com/-/0006NKP5448WTEJI-C105.jpg -- 120x180
			//   https://i.iplsc.com/-/0006NKP5448WTEJI-C0.jpg -- 2804x4213
			// https://i.iplsc.com/emma-watson-to-dopiero-poczatek/0004CKQ6GXCVEDM4-C322-F4.webp
			//   https://i.iplsc.com/emma-watson-to-dopiero-poczatek/0004CKQ6GXCVEDM4-C0.webp
			return src.replace(/(\/[0-9A-Z]+)-C[0-9]+(?:-F[0-9]+)?(\.[^/.]*)$/, "$1-C0$2");
		}

		if (domain === "s3.viva.pl") {
			// http://s3.viva.pl/newsy/emma-watson-w-sukni-kitx-418529-GALLERY_600.jpg -- 600x901
			//   http://s3.viva.pl/newsy/emma-watson-w-sukni-kitx-418529-GALLERY_BIG.jpg -- 820x1232
			return src.replace(/-GALLERY_[0-9]+(\.[^/.]*)$/, "-GALLERY_BIG$1");
		}

		if ((domain_nosub === "vogue.com.tr" && domain.match(/^cdn[0-9]*\./)) ||
			// http://cdn1.gq.com.tr/files/img/photo_gallery_b/15-08/24/_arc0047-640x960_1_0.jpg
			//   http://cdn1.gq.com.tr/files/original/15-08/24/_arc0047-640x960_1_0.jpg
			(domain_nosub === "gq.com.tr" && domain.match(/^cdn[0-9]*\./)) ||
			// https://wr3mii5n.rocketcdn.com/files/img/vertical_m/18-11/18/43637640_678324839231546_8356268133792514711_n.jpg?0.3649090460532951
			//   https://wr3mii5n.rocketcdn.com/files/original/18-11/18/43637640_678324839231546_8356268133792514711_n.jpg?0.3649090460532951
			domain === "wr3mii5n.rocketcdn.com" ||
			// https://voguecdn.blob.core.windows.net/files/img/article_detail/18-09/09/gettyimages-1027861520-1536442474.jpg
			//   https://voguecdn.blob.core.windows.net/files/original/18-09/09/gettyimages-1027861520-1536442474.jpg
			domain === "voguecdn.blob.core.windows.net") {
			// https://cdn1.vogue.com.tr/files/img/photo_gallery_m/17-05/08/emma-watson-gettyimages-680131122.jpg
			//   https://cdn1.vogue.com.tr/files/original/17-05/08/emma-watson-gettyimages-680131122.jpg
			// https://cdn1.vogue.com.tr/files/img/vertical_m/18-09/09/gettyimages-1027861520.jpg?0.02722366776135532
			//   https://cdn1.vogue.com.tr/files/img/vertical_m/18-09/09/gettyimages-1027861520.jpg?0.02722366776135532
			return src.replace(/\/files\/img\/[^/]*\//, "/files/original/");
		}

		if (domain_nosub === "clients-cdnnow.ru" ||
			// https://s.properm.ru/localStorage/news/2b/00/b6/27/2b00b627_resizedScaled_1020to499.jpg
			//   https://s.properm.ru/originalStorage/news/2b/00/b6/27/2b00b627.jpg
			domain === "s.properm.ru") {
			// https://user32265.clients-cdnnow.ru/localStorage/e4/d0/09/25/e4d00925_resizedScaled_740to1116.jpg -- 740x1116
			//   https://user32265.clients-cdnnow.ru/localStorage/e4/d0/09/25/e4d00925.jpg -- 960x1448
			// https://user32265.clients-cdnnow.ru/localStorage/post/bf/6c/45/84/bf6c4584_resizedScaled_740to493.jpg
			//   https://user32265.clients-cdnnow.ru/localStorage/post/bf/6c/45/84/bf6c4584.jpg
			// https://user32265.clients-cdnnow.ru/localStorage/post/ca/24/a0/3e/ca24a03e.jpg
			//   https://user32265.clients-cdnnow.ru/originalStorage/post/ca/24/a0/3e/ca24a03e.jpg
			return src
				.replace(/(\/[a-z]+Storage\/(?:(?:post|news)\/)?(?:[0-9a-f]{2}\/){1,}[0-9a-f]+)_resizedScaled_[0-9]+to[0-9]+(\.[^/.]*)$/, "$1$2")
				.replace(/(:\/\/[^/]*\/)[a-z]+Storage\/+/, "$1originalStorage/");
		}

		if (domain_nowww === "hollywoodtuna.com") {
			// http://www.hollywoodtuna.com/images3/cailin_russo_66_the_nice_4.jpg
			//   http://www.hollywoodtuna.com/images3/bigimages3/cailin_russo_66_the_nice_4.jpg -- 1456x2184
			return src.replace(/\/images([0-9])\/([^/]*)$/, "/images$1/bigimages$1/$2");
		}

		if (domain_nosub === "soupcdn.com" &&
			domain.match(/^asset-.\./)) {
			// http://asset-e.soupcdn.com/asset/8062/1434_eafb_500.jpeg
			//   http://asset-e.soupcdn.com/asset/8062/1434_eafb.jpeg
			return src.replace(/(\/asset\/[0-9]+\/[0-9]+_[0-9a-z]+)_[0-9]+(\.[^/.]*)$/, "$1$2");
		}

		if (domain_nosub === "qqmofasi.com" &&
			domain.match(/^pic[0-9]*\./)) {
			// http://pic4.qqmofasi.com/2014/08/29/127_eRSs6BrBJBjsU0033630_crop.jpg
			//   http://pic4.qqmofasi.com/2014/08/29/127_eRSs6BrBJBjsU0033630.jpg
			return src.replace(/_crop(\.[^/.]*)$/, "$1");
		}

		if (domain_nowww === "download-rooz.com" ||
			// https://day-download.com/img/600-900/cast/334-Megan-Fox-v1.jpg
			//   https://day-download.com/img/cast/334-Megan-Fox-v1.jpg -- upscaled
			domain_nowww === "day-download.com") {
			// https://download-rooz.com/img/600-900/cast/49015-Peyton-List-v1.jpg
			//   https://download-rooz.com/img/cast/49015-Peyton-List-v1.jpg
			return src.replace(/\/img\/+[0-9]+-[0-9]+\//, "/img/");
		}

		if (domain_nowww === "know.cf") {
			// https://www.know.cf/imgw/450px/Peyton_Roi_List.JPG
			//    https://www.know.cf/imgw/Peyton_Roi_List.JPG
			return src.replace(/\/imgw\/[0-9]+px\/([^/]*)$/, "/imgw/$1");
		}

		if (amazon_container === "timely-api-public") {
			// https://timely-api-public.s3.us-west-2.amazonaws.com/116743_phpg7Ixww_small.JPG
			//   https://timely-api-public.s3.us-west-2.amazonaws.com/116743_phpg7Ixww.JPG
			return src.replace(/(\/timely-api-public[^/]*\/[0-9]+_[0-9a-zA-Z]+)_[a-z]+(\.[^/.]*)$/, "$1$2");
		}

		if (domain_nowww === "image-share.com") {
			// http://image-share.com/upload/3439/222m.jpg
			//   http://image-share.com/upload/3439/222.jpg
			return src.replace(/(\/upload\/[0-9]+\/[0-9]+)m(\.[^/.]*)$/, "$1$2");
		}

		if (domain_nowww === "amando.it") {
			// https://www.amando.it/imagesdyn/gallery_plus/80x80/13/67/lok-fine-estate_136712.jpg
			//   https://www.amando.it/imagesdyn/gallery_plus/orig_660/13/67/lok-fine-estate_136712.jpg
			//   https://www.amando.it/imagesdyn/gallery_plus/orig/13/67/lok-fine-estate_136712.jpg
			return src.replace(/\/imagesdyn\/gallery_plus\/(?:[0-9]+x[0-9]+|orig_[0-9]+)\//,
							   "/imagesdyn/gallery_plus/orig/");
		}

		if (domain_nowww === "textureking.com") {
			// https://www.textureking.com/content/img/stock/DSC_4465.jpg
			//   https://www.textureking.com/content/img/stock/big/DSC_4465.JPG
			return add_extensions_upper(src.replace(/\/content\/img\/stock\/([^/]*)$/, "/content/img/stock/big/$1"));
		}

		if (domain_nowww === "textures.com") {
			// https://www.textures.com/system/gallery/photos/Floors/Herringbone/118323/FloorHerringbone0118_2_download600.jpg
			//   https://www.textures.com/system/gallery/photos/Floors/Herringbone/118323/FloorHerringbone0118_2_500.jpg
			//   https://www.textures.com/system/gallery/photos/Floors/Herringbone/118323/hotlink-ok/FloorHerringbone0118_2_shared.jpg
			// parts: https://www.textures.com/system/gallery/photos/Floors/Herringbone/118323/zoomed_preview/FloorHerringbone0118_2_z24.jpg 0-24 (for all images)
			// https://www.textures.com/system/gallery/photos/3D%20Scans/124536/3DScans0022_22_download600.jpg
			// https://www.textures.com/browse/getPhotoInfoAjax?id=118323
			// https://www.textures.com/system/gallery/photos/3D%20Scans/124536/3DScans0022_22_download600.jpg
			//   https://www.textures.com/system/gallery/photos/3D%20Scans/124536/hotlink-ok/3DScans0022_22_shared.jpg
			if (src.match(/\/system\/+gallery\/+photos\/+[^/]*\/+(?:[^/]*\/+)?[0-9]+\/+[^/]+(?:[?#].*)?$/)) {
				return {
					url: src.replace(/(\/[0-9]+\/+)([^/]*_)(?:download)?[0-9]+(\.[^/.]*)$/, "$1hotlink-ok/$2shared$3"),
					problems: {
						watermark: true
					}
				};
			}
		}

		if ((domain_nosub === "gmbox.ru" ||
			 // https://b1.vestifinance.ru/c/53285.200x250.jpg
			 //   https://b1.vestifinance.ru/c/53285.jpg
			 domain_nosub === "vestifinance.ru") &&
			domain.match(/^[a-z][0-9]*\./)) {
			// https://b1.gmbox.ru/c/160165.815x310c5020.jpg
			//   https://b1.gmbox.ru/c/160165.jpg
			// https://b1.gmbox.ru/c/161499.823x463.jpg
			//   https://b1.gmbox.ru/c/161499.jpg -- stretched? (2608x1392)
			// https://b1.gmbox.ru/c/160518.815x310c5020.jpg
			//   https://b1.gmbox.ru/c/160518.jpg -- stretched? (2608x1739)
			// https://b1.gmbox.ru/c/156676.jpg -- 1280x853 (not stretched)
			// https://b1.gmbox.ru/c/150458.815xp.jpg
			//   https://b1.gmbox.ru/c/150458.jpg
			return src.replace(/(\/c\/[0-9]+)\.[0-9]+x[0-9p]+(?:c[0-9]+)?(\.[^/.]*)$/, "$1$2");
		}

		if (domain_nosub === "game2day.ru") {
			// https://game2day.ru/images/made/7b4f3a1209326b54/2992239-1_600_400_c1.jpg
			//   https://game2day.ru/uploads/userfiles/images/2992239-1.jpg
			// https://game2day.ru//images/made/7b4f3a1209326b54/ciri_585_390_s_c1.jpg
			//   https://game2day.ru/uploads/userfiles/images/ciri.jpg -- doesn't work
			return src.replace(/\/images\/made\/[0-9a-f]+\/([0-9]+-[0-9]+)_[0-9]+_[0-9]+_(?:s_)?c[0-9]+(\.[^/.]*)$/,
							   "/uploads/userfiles/images/$1$2");
		}

		if (domain_nowww === "topcrochetpatterns.com") {
			// https://www.topcrochetpatterns.com/images/made/images/uploads/blog/Hailee_Steinfeld_625_939_64_c1.jpg
			//   https://www.topcrochetpatterns.com/images/uploads/blog/Hailee_Steinfeld.jpg
			return src.replace(/\/images\/+made\/+(images\/+uploads\/+blog\/+[^/]*?)_[0-9]+_[0-9]+_[0-9]+_c[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "/$1$2");
		}

		if (domain_nowww === "dangerousminds.net") {
			// https://dangerousminds.net/content/uploads/images/made/content/uploads/images/arrival-poster-venezuela_465_725_int.jpg
			//   https://dangerousminds.net/content/uploads/images/arrival-poster-venezuela.jpg
			return src.replace(/\/content\/+uploads\/+images\/+made\/+(content\/+uploads\/+images\/+[^/]+)_[0-9]+_[0-9]+_int(\.[^/.]*)(?:[?#].*)?$/, "/$1$2");
		}

		if (domain_nosub === "nupics.pro" ||
			// http://epicsoid.com/pics/1041/_real-teen-high-school-cheerleader.jpg
			//   http://epicsoid.com/pics/1041/real-teen-high-school-cheerleader.jpg
			domain_nowww === "epicsoid.com" ||
			// https://hotnupics.com/pics/1945/_chantelle-model-with-vitiligo.jpg
			//   https://hotnupics.com/pics/1945/chantelle-model-with-vitiligo.jpg
			domain_nowww === "xwetpics.com" ||
			// https://xsexpics.com/pics/2177/_sophie-monk-beach.jpg
			//   https://xsexpics.com/pics/2177/sophie-monk-beach.jpg
			domain_nowww === "xsexpics.com" ||
			// https://picsninja.club/pics/2581/_sophie-monk-wardrobe-malfunction.jpg
			//   https://picsninja.club/pics/2581/sophie-monk-wardrobe-malfunction.jpg
			domain_nowww === "picsninja.club" ||
			// https://hotnupics.com/pics/1186/_sophie-stuckey-nude.jpg
			//   https://hotnupics.com/pics/1186/sophie-stuckey-nude.jpg
			domain_nowww === "hotnupics.com" ||
			// https://ehotpics.com/pics/84/_hassan-shruti-hot-bikini.jpg
			//   https://ehotpics.com/pics/84/hassan-shruti-hot-bikini.jpg
			domain_nowww === "ehotpics.com" ||
			// https://picsegg.com/pics/3640/_kiran-rathod-hot.jpg
			//   https://picsegg.com/pics/3640/kiran-rathod-hot.jpg
			domain_nowww === "picsegg.com" ||
			// https://upicsz.com/pics/665/_emma-watson-bling-ring.jpg
			//   https://upicsz.com/pics/665/emma-watson-bling-ring.jpg
			domain_nowww === "upicsz.com" ||
			// http://xpicse.com/pics/3137/_hot-sexy-asian-cute-japanese-girl.jpg
			//   http://xpicse.com/pics/3137/hot-sexy-asian-cute-japanese-girl.jpg
			domain_nowww === "xpicse.com" ||
			// https://hdpicsx.com/pics/3276/_thick-curvy-asian-girls-self-shot.jpg
			//   https://hdpicsx.com/pics/3276/thick-curvy-asian-girls-self-shot.jpg
			domain_nowww === "hdpicsx.com" ||
			// https://picsninja.com/pics/2607/_leather-lingerie-and-gloves.jpg
			//   https://picsninja.com/pics/2607/leather-lingerie-and-gloves.jpg
			domain_nowww === "picsninja.com" ||
			// http://nuslut.com/pics/1207/_alyson-hannigan-boob-morphs.jpg
			//   http://nuslut.com/pics/1207/alyson-hannigan-boob-morphs.jpg
			domain_nowww === "nuslut.com" ||
			// https://repicsx.com/pics/1342/_steampunk-girl.jpg
			//   https://repicsx.com/pics/1342/steampunk-girl.jpg
			domain_nowww === "repicsx.com") {
			// https://nupics.pro/pics/2267/_keira-metz-witcher-3.jpg
			//   https://nupics.pro/pics/2267/keira-metz-witcher-3.jpg
			return src.replace(/(\/pics\/+[0-9]+\/+)_([^/]*)$/, "$1$2");
		}

		if (domain_nowww === "pornstarapex.com") {
			// http://pornstarapex.com/pics/32de56/th_02.jpg
			//   http://pornstarapex.com/pics/32de56/02.jpg
			return src.replace(/(\/pics\/+[0-9a-f]+\/+)th_([0-9]+\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nosub === "cloud.it" &&
			domain.match(/^ldm[0-9]*\.r1-it\.storage\./)) {
			// https://ldm.r1-it.storage.cloud.it/img/18/1/18/big/8440_5a5fe09abb8af3.57794750.jpg -- 640x426
			//   https://ldm.r1-it.storage.cloud.it/img/18/1/18/8440_5a5fe09abb8af3.57794750.jpg -- 1024x683
			// https://ldm.r1-it.storage.cloud.it/av/18/8/3/thumbs/5b63f8c783b74.png -- 50x50
			//   https://ldm.r1-it.storage.cloud.it/av/18/8/3/5b63f8c783b74.png -- 150x150
			// https://ldm2.r1-it.storage.cloud.it/av/18/9/16/thumbs/5b9e9e1052d09.jpg
			//   https://ldm2.r1-it.storage.cloud.it/av/18/9/16/5b9e9e1052d09.jpg
			// https://ldm.r1-it.storage.cloud.it/logo/16-9/9/thumbs/57d2ee9a28a46.png
			//   https://ldm.r1-it.storage.cloud.it/logo/16-9/9/57d2ee9a28a46.png
			return src
				.replace(/(\/img\/.*\/)big\/([0-9]+_[0-9a-f]+\.[0-9]+\.[^/.]*)$/, "$1$2")
				.replace(/(\/(?:av|logo)\/.*\/)thumbs\/([0-9a-f]+\.[^/.]*)$/, "$1$2");
		}

		if (domain_nosub === "cfimg.com" &&
			domain.match(/^i[0-9]*\./)) {
			// http://i2.cfimg.com/562411/4b16f553bb78d943s.jpg
			//   http://i2.cfimg.com/562411/4b16f553bb78d943.jpg -- same size (730x1095)
			return src.replace(/(:\/\/[^/]*\/[0-9]+\/[0-9a-f]+)s(\.[^/.]*)$/, "$1$2");
		}

		if (domain === "i.chzbgr.com") {
			// https://i.chzbgr.com/thumb400/9029115904/h545C0A2E/
			//   https://i.chzbgr.com/full/9029115904/h545C0A2E/ -- 600x899
			//   https://i.chzbgr.com/original/9029115904/h545C0A2E/ -- 600x899
			// https://i.chzbgr.com/full/8600201472/h54C40B07/
			//   https://i.chzbgr.com/original/8600201472/h54C40B07/
			newsrc = src.replace(/(:\/\/[^/]*\/+)(?:thumb[0-9]*|full)\/+/, "$1original/");
			if (newsrc !== src)
				return newsrc;

			// thanks to anonymous for reporting:
			// https://i.chzbgr.com/imagestore/2012/4/28/th_9b826e3c-1d4b-4cc8-8fb4-d96c230480e8.jpg
			//   https://i.chzbgr.com/imagestore/2012/4/28/9b826e3c-1d4b-4cc8-8fb4-d96c230480e8.jpg
			return src.replace(/(\/imagestore\/+[0-9]{4}\/+[0-9]+\/+[0-9]+\/+)th_/, "$1");
		}

		if (domain === "img.memecdn.com") {
			// https://img.memecdn.com/rogue-cosplay_t_3023679.webp
			//   https://img.memecdn.com/rogue-cosplay_o_3023679.webp
			// https://img.memecdn.com/d-n-a-of-p-l_fb_4605495.webp
			//   https://img.memecdn.com/d-n-a-of-p-l_o_4605495.gif
			return add_full_extensions(src.replace(/(:\/\/[^/]*\/[^/]*_)[a-z]+(_[0-9]+\.[^/.]*)(?:[?#].*)?$/,
											  "$1o$2"));
			//return src.replace(/_[a-z]_([0-9]+\.[^/.]*)$/, "_o_$1");
		}

		if (domain === "p.memecdn.com") {
			// https://p.memecdn.com/avatars/s_1485895_53daab9e04bdc.jpg
			//   https://p.memecdn.com/avatars/1485895_53daab9e04bdc.jpg
			return src.replace(/\/avatars\/+[a-z]+_([0-9]+_[0-9a-f]+\.[^/.]*)(?:[?#].*)?$/, "/avatars/$1");
		}

		if (domain_nosub === "123rf.com") {
			// https://previews.123rf.com/images/buchachon/buchachon1206/buchachon120600029/13974083-open-book-of-the-big-tree-fantacy.jpg
			//   https://us.123rf.com/450wm/buchachon/buchachon1206/buchachon120600029/13974083-open-book-of-the-big-tree-fantacy.jpg
			if (!src.match(/:\/\/[a-z]+cdn\./) &&
				src.match(/:\/\/[^/]*\/(?:images|[0-9]+wm)\//)) {
				var full = src.replace(/:\/\/[^/]*\/[^/]*\//, "://previews.123rf.com/images/");
				var small = src.replace(/:\/\/[^/]*\/[^/]*\//, "://us.123rf.com/450wm/");

				var urls = [
					{
						url: full,
						problems: {
							watermark: true
						}
					},
					{
						url: small,
						problems: {
							smaller: true
						}
					},
					src
				];

				let baseobj:BigImageInfoSObject = {};

				var match = src.match(/\/([0-9]+)-[^/]+\.[^/.]+(?:[?#].*)?$/);
				if (match) {
					id = match[1];
					baseobj.extra = {
						page: "https://www.123rf.com/photo_" + id + ".html"
					};

					if (options.do_request && options.cb) {
						api_query("123rf:" + id, {
							url: "https://www.123rf.com/photo_" + id + ".html",
						}, function(data) {
							if (data) {
								baseobj = data;
							}

							return options.cb(fillobj_urls(urls, baseobj));
						}, function(done, resp, cache_key) {
							var match = resp.responseText.match(/dataLayer\.push\({[\s\S]+?["']product_name["']:\s*["'](.*?)["'],/);
							baseobj.extra.page = resp.finalUrl;

							if (match) {
								baseobj.extra.caption = match[1];
							} else {
								console_warn(cache_key, "Unable to find match in", resp);
							}

							done(baseobj, 24*60*60);
						});

						return {
							waiting: true
						};
					}
				}

				return fillobj_urls(urls, baseobj);
			}
		}

		if (domain_nowww === "chenderroad.com") {
			// https://chenderroad.com/image.php?v=20180813&src=https%3A%2F%2Fi.imgur.com%2FQL25lgF.jpg
			//   https://i.imgur.com/QL25lgF.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/image\.php.*?[?&]src=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeURIComponent(newsrc);
		}

		if (domain_nosub === "estranky.cz" ||
			// http://www.kappa123.estranky.sk/img/mid/1/fb_img_1516053994463.jpg
			//   http://www.kappa123.estranky.sk/img/original/1/fb_img_1516053994463.jpg
			domain_nosub === "estranky.sk") {
			// http://www.karolinka-hola.estranky.cz/img/tiny/18.jpg
			//   http://www.karolinka-hola.estranky.cz/img/original/18/image.jpg
			// http://www.karolinka-hola.estranky.cz/img/mid/18/selena16.jpg -- stretched
			//   http://www.karolinka-hola.estranky.cz/img/original/18/image.jpg
			//
			// http://s3a.estranky.sk/img/d/1000000001/bg-header-rside.jpg -- doesn't work
			if (domain !== "s3a.estranky.sk") {
				return src
					.replace(/(:\/\/[^/]*\/img\/)[a-z]+\//, "$1original/")
					.replace(/(:\/\/[^/]*\/img\/original\/[0-9]+)(\.[^/.]*)/, "$1/image$2");
			}
		}

		if (domain_nowww === "stagelook.ru") {
			// http://stagelook.ru/images/tumbs/StageLook_post_2962.jpg
			return src.replace(/\/images\/tumbs\//, "/images/");
		}

		if (domain === "media.taaze.tw") {
			// https://media.taaze.tw/showProdImageByPK.html?pid=1004729762&width=100&height=150
			//   https://media.taaze.tw/showTakeLook/1004729762.jpg
			// https://media.taaze.tw/showLargeImage.html?sc=24100007066&width=289&height=386
			//   https://media.taaze.tw/showTakeLook/1004729760.jpg
			return src.replace(/\/showProdImageByPK\.html.*?[?&]pid=([0-9]+).*?$/, "/showTakeLook/$1.jpg");
		}

		if (domain === "st.cdjapan.co.jp") {
			// http://st.cdjapan.co.jp/pictures/s/13/48/NEOBK-2039626_ADD.jpg?v=1 -- 102x128
			//   http://st.cdjapan.co.jp/pictures/l/13/48/NEOBK-2039626_ADD.jpg?v=1 -- 400x500
			return src.replace(/\/pictures\/s\//, "/pictures/l/");
		}

		if (domain === "image.blozoo.info") {
			// http://image.blozoo.info/v2/thumb/163/133/?url=https%3A%2F%2Ferologz.com%2Fwp-content%2Fuploads%2F2018%2F09%2F7b35309a-1.jpg&page_url=https%3A%2F%2Ferologz.com%2F97621.html&site_url=http%3A%2F%2Ferologz.com%2F&title=%E3%83%86%E3%83%AC%E6%9C%9D%E3%83%BB%E6%A3%AE%E5%B7%9D%E5%A4%95%E8%B2%B4%E3%82%A2%E3%83%8A%E3%81%8C%E3%83%8E%E3%83%BC%E3%83%96%E3%83%A9%E3%81%A7%E5%A4%A9%E6%B0%97%E4%BA%88%E5%A0%B1%E3%81%97%E3%81%A6%E3%82%8B%E3%81%A8%E8%A9%B1%E9%A1%8C%E3%81%AB%E3%80%82
			//   https://erologz.com/wp-content/uploads/2018/09/7b35309a-1.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/v2\/thumb\/[0-9]+\/[0-9]+\/.*?[?&]url=(http[^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeURIComponent(newsrc);
		}

		if (domain === "img.suilengea.com") {
			// http://img.suilengea.com/img.php?tag=a&url=mmbiz.qpic.cn/mmbiz_jpg/TyNGUXnL4t0e7YCuyZubYhg0BrVZ3c0cFrt8bkmhwdKujZS6pLwv0GYnBcmoibQT04omHDg5Bic6Hic1pOmNicSVfA/640?
			//   http://mmbiz.qpic.cn/mmbiz_jpg/TyNGUXnL4t0e7YCuyZubYhg0BrVZ3c0cFrt8bkmhwdKujZS6pLwv0GYnBcmoibQT04omHDg5Bic6Hic1pOmNicSVfA/640
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/img\.php.*?[?&]url=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return add_http(decodeURIComponent(newsrc));
		}

		if (domain === "files.sirclocdn.xyz") {
			// https://files.sirclocdn.xyz/jkloop/products/_170715162210_Nogizaka46-Nigemizu-LEA.jpg
			//   https://files.sirclocdn.xyz/jkloop/products/_170715162210_Nogizaka46-Nigemizu-LEA_zoom.jpg
			//   https://files.sirclocdn.xyz/jkloop/products/_170715162210_Nogizaka46-Nigemizu-LEA_ori.jpg
			return src.replace(/(\/products\/_[0-9]+_[^/._]*)(?:_[a-z]+)?(\.[^/.]*)$/, "$1_ori$2");
		}

		if (domain === "s.tvp.pl") {
			// http://s.tvp.pl/images/4/2/3/uid_4232752c96d1f9e3bf91e7e116b2d8aa1303465175421_width_268_play_0_pos_3_gs_0.jpg
			//   http://s.tvp.pl/images/4/2/3/uid_4232752c96d1f9e3bf91e7e116b2d8aa1303465175421_width_9999999999999.jpg
			// http://s.tvp.pl/images2/8/d/8/uid_8d88e0204c8cf269ce0a38939f2428121537448809944_width_200_play_6_pos_5_gs_0_height_150.jpg
			//   http://s.tvp.pl/images2/8/d/8/uid_8d88e0204c8cf269ce0a38939f2428121537448809944_width_9999999999999.jpg -- stretched? (992x743)
			// http://s.tvp.pl/images2/4/f/7/uid_4f7200dfd11aa2f280c8e62aa23e31b91536341825746_width_600_play_0_pos_0_gs_0_height_450.jpg
			//   http://s.tvp.pl/images2/4/f/7/uid_4f7200dfd11aa2f280c8e62aa23e31b91536341825746_width_9999999999999.jpg -- 1280x959 (not stretched)
			return src.replace(/(\/images2?\/(?:[0-9a-f]\/){3})[-_a-zA-Z0-9]*(uid_[0-9a-f]+)[^/.]*?(\.[^/.]*)$/,"$1$2_width_9999999999999$3");
		}

		if (domain === "sf.be.com") {
			// http://sf.be.com/1/perso/elisez-beach-grand/photo/412412/13683751f7/elisez-beach-grand-berry-bikini-orange-p460.jpg -- 460x613 (stretched)
			//   http://sf.be.com/1/perso/elisez-beach-grand/photo/412412/13683751f7/elisez-beach-grand-berry-bikini-orange-img.jpg -- 368x500
			// http://sf.be.com/1/beaute/be_reserved-beaute/photo/013270013/1710563593/be_reserved-beaute-rhianna-preferez-voter-s220.jpg -- 220x220
			//   http://sf.be.com/1/beaute/be_reserved-beaute/photo/013270013/1710563593/be_reserved-beaute-rhianna-preferez-voter-img.jpg -- 400x400
			return src.replace(/(\/photo\/[0-9]+\/[0-9a-z]+\/[^/]*-)[a-z][0-9]+(\.[^/.]*)$/, "$1img$2");
		}

		if (domain_nowww === "fitwell.bg") {
			// http://fitwell.bg/pictures/1711680_500_.jpg -- stretched (499x759)
			//   http://fitwell.bg/pictures/1711680.jpg (316x480)
			return src.replace(/(\/pictures\/[0-9]+)_[0-9]+_*(\.[^/.]*)$/, "$1$2");
		}

		if (domain === "bilder.bild.de") {
			// https://bilder.bild.de/fotos-skaliert/halle-berry-in-stirb-an-einem-anderen-tag-155165-26537384/4,w=596,q=high,c=0.bild.jpg
			//   https://bilder.bild.de/fotos/halle-berry-in-stirb-an-einem-anderen-tag-155165-26537384/Bild/4.bild.jpg
			return src.replace(/\/fotos-skaliert(\/[^/]*\/)([0-9]+),[^/.]*(\.bild\.[^/.]*)$/, "/fotos$1Bild/$2$3");
		}

		if (domain === "galeria.cdn.divany.hu") {
			// https://galeria.cdn.divany.hu/tejbenvajban/2016/07/05/70_eves_a_bikini/12190389_32ac79914cd1607d4d558e9215c7367a_m.jpg -- 644x1000
			//   https://galeria.cdn.divany.hu/tejbenvajban/2016/07/05/70_eves_a_bikini/12190389_32ac79914cd1607d4d558e9215c7367a_y.jpg -- 1159x1800
			//   https://galeria.cdn.divany.hu/tejbenvajban/2016/07/05/70_eves_a_bikini/12190389_32ac79914cd1607d4d558e9215c7367a.jpg -- 2567x3986
			return src.replace(/(\/[0-9]+_[0-9a-f]+)_[a-z](\.[^/.]*)$/, "$1$2");
		}

		if (domain === "img.cncenter.cz") {
			// https://img.cncenter.cz/img/3/gsmall/2479246_.jpg
			//   https://img.cncenter.cz/img/3/full/2479246_.jpg
			return src.replace(/(\/img\/[0-9]+\/)[a-z]+(\/[^/]*)$/, "$1full$2");
		}

		if (domain_nowww === "cosmopolitan.de") {
			// https://www.cosmopolitan.de/bilder/300x300/2016/07/22/84841-dekollete-contouring-so-einfach-schminkst-du-deinen-busen-groesser.jpg?itok=uYfU4n5O
			//   http://www.cosmopolitan.de/bilder/610/2016/07/22/84841-dekollete-contouring-so-einfach-schminkst-du-deinen-busen-groesser.jpg?itok=z9s-r8pE
			//   https://www.cosmopolitan.de/assets/2016/07/22/84841-dekollete-contouring-so-einfach-schminkst-du-deinen-busen-groesser.jpg?itok=uYfU4n5O
			return src.replace(/\/bilder\/[0-9]+(?:x[0-9]+)?\//, "/assets/");
		}

		if (domain === "d1o73ibskzeirn.cloudfront.net") {
			// https://d1o73ibskzeirn.cloudfront.net/168x168/content/generic/1517912290.4027.gif
			//   https://d1o73ibskzeirn.cloudfront.net/0x0/content/generic/1517912290.4027.gif
			return src.replace(/(:\/\/[^/]*\/)[0-9]+x[0-9]+\/content\//, "$10x0/content/");
		}

		if (domain_nowww === "elle.co.za" ||
			// https://www.xgn.nl/images/articles/2018/201804/_360x202_crop_center-center_82_line/heel-veel-gta-muziek-verwijdert-uit-de-game-130674.jpg
			//   https://www.xgn.nl/images/articles/2018/201804/heel-veel-gta-muziek-verwijdert-uit-de-game-130674.jpg
			domain_nowww === "xgn.nl" ||
			// https://www.sandinyoureye.co.uk/files/gallery/_306x306_crop_Center-Center_80/professional-ice-sculpture_ice-carving_Bradford.jpg
			//   https://www.sandinyoureye.co.uk/files/gallery/professional-ice-sculpture_ice-carving_Bradford.jpg
			domain_nowww === "sandinyoureye.co.uk" ||
			// thanks to anonymous for reporting:
			// https://skitguys.com/media/images/motion/_400x225_crop_center-center_60_line/Easter-Sunday-1-Still_LSM-HD.jpg
			//   https://skitguys.com/media/images/motion/Easter-Sunday-1-Still_LSM-HD.jpg
			domain_nowww === "skitguys.com" ||
			// https://cache.wizardworld.com/files/wizard/_164xAUTO_fit_center-center_100/rampage-trailer-1-feature.png
			//   https://cache.wizardworld.com/files/wizard/rampage-trailer-1-feature.png
			domain === "cache.wizardworld.com") {
			// https://www.elle.co.za/uploads/files/_768xAUTO_crop_center-center/Screen-Shot-2018-03-09-at-11.17.38-AM.png
			//   https://www.elle.co.za/uploads/files/Screen-Shot-2018-03-09-at-11.17.38-AM.png
			return src.replace(/\/+_[0-9AUTO]+x[0-9AUTO]+_(?:crop|fit)_[^/]+\/+/, "/");
			//return src.replace(/(\/files\/+wizard\/+)_[AUTOx0-9]+_[^/]*\//, "$1");
			//return src.replace(/\/files\/+gallery\/+_[0-9]+x[0-9]+_[^/]*\/+/, "/files/gallery/");
		}

		if (domain === "assets-c3.propublica.org") {
			// thanks to Liz on discord:
			// https://assets-c3.propublica.org/images/articles/_threeTwo1600w/20200729-hurricane-erosion-3x2.jpg
			//   https://assets-c3.propublica.org/images/articles/20200729-hurricane-erosion-3x2.jpg
			return src.replace(/\/images\/+articles\/+_[^/]+\/+/, "/images/articles/");
		}

		if (domain_nowww === "kartinnay-galerey.ru") {
			// https://kartinnay-galerey.ru/uploads/posts/news_thumb/2018-05/romi-streyd-v-svadebnom-plate-horoshee-nastroenie_7.jpeg
			//   https://kartinnay-galerey.ru/uploads/posts/2018-05/romi-streyd-v-svadebnom-plate-horoshee-nastroenie_7.jpeg
			// doesn't work for all:
			// https://kartinnay-galerey.ru/uploads/posts/news_thumb/2016-12/84podborka-prikolnyh-foto-1521-107-foto-horoshee-nastroenie_72.jpeg
			return src.replace(/\/uploads\/posts\/news_thumb\//, "/uploads/posts/");
		}

		if (domain_nowww === "imhomir.com") {
			// http://imhomir.com/uploads/topics/preview/00/02/16/15/4941b45ad6_235.jpg -- 235x354
			//   http://imhomir.com/uploads/topics/preview/00/02/16/15/4941b45ad6.jpg -- 662x997
			return src.replace(/(\/uploads\/[a-z]+\/preview\/.*)_[0-9]+(\.[^/.]*)$/, "$1$2");
		}

		if (domain_nowww === "mumsnet.com") {
			// https://www.mumsnet.com/uploads/talk/201602/large-876231-margot-robbie-oscars-2016-red-carpet-vogue-28feb16-getty-b-592x888.jpg
			//   https://www.mumsnet.com/uploads/talk/201602/876231-margot-robbie-oscars-2016-red-carpet-vogue-28feb16-getty-b-592x888.jpg
			return src.replace(/(\/uploads\/talk\/[0-9]+\/)[a-z]+-([0-9]+-[^/]*)$/, "$1$2");
		}

		if (domain === "static.stylemagazin.hu") {
			// http://static.stylemagazin.hu/medias/87150/120x120/Oscar-ruha_594464b87fc78093ce253b95e3456ae0.jpg
			//   http://static.stylemagazin.hu/medias/87150/Oscar-ruha_594464b87fc78093ce253b95e3456ae0.jpg
			return src.replace(/(\/medias\/[0-9]+\/)[0-9]+x[0-9]+\//, "$1");
		}

		if (domain === "img.thoibao.today") {
			// http://img.thoibao.today/home/fetch?u=http%3A%2F%2Fk14.vcmedia.vn%2Fthumb_w%2F600%2F2016%2F15-1456708833735.jpg -- redirects to
			//   http://img.thoibao.today/Content/fetch/http___k14_vcmedia_vn_thumb_w_600_2016_15-1456708833735.jpg
			//   http://k14.vcmedia.vn/thumb_w/600/2016/15-1456708833735.jpg -- doesn't exist?
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/home\/fetch.*?[?&]u=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeURIComponent(newsrc);
		}

		if (amazon_container === "photo.elcinema.com" ||
			// thanks to anonymous for reporting:
			// https://media0047.elcinema.com/uploads/_320x_874fa3c0878af5277e18f43c647836a8c74ef634648d57bc8431b6eeb84667f3.jpg
			//   https://media0047.elcinema.com/uploads/874fa3c0878af5277e18f43c647836a8c74ef634648d57bc8431b6eeb84667f3.jpg
			(domain_nosub === "elcinema.com" && /^media[0-9]*\./.test(domain))) {
			// http://photo.elcinema.com.s3.amazonaws.com/uploads/_640x_aa64a53316b52d94e76da3981ad2e103d363612fbfb7210ca1c5a154c707d5b4.jpg
			//   http://photo.elcinema.com.s3.amazonaws.com/uploads/aa64a53316b52d94e76da3981ad2e103d363612fbfb7210ca1c5a154c707d5b4.jpg
			// http://photo.elcinema.com.s3.amazonaws.com/uploads/_315x420_95603e1b0b0ed02d0f8151643ccff9d5b9a4333ef78d928cd6c8df0d2d8ed9bc.jpg
			//   http://photo.elcinema.com.s3.amazonaws.com/uploads/95603e1b0b0ed02d0f8151643ccff9d5b9a4333ef78d928cd6c8df0d2d8ed9bc.jpg
			return src.replace(/\/uploads\/_[0-9]+x(?:[0-9]+)?_([0-9a-f]+\.[^/.]*)$/, "/uploads/$1");
		}

		if (domain_nowww === "colors.life") {
			// https://www.colors.life/upload/blogs/f6/1f/f61fbe46c12ba6d65f1928ffebda620c_RSZ_690.jpg
			//   https://www.colors.life/upload/blogs/f6/1f/f61fbe46c12ba6d65f1928ffebda620c.jpg
			return src.replace(/(\/upload\/blogs\/[0-9a-f]{2}\/[0-9a-f]{2}\/[0-9a-f]+)_RSZ_[0-9]+(\.[^/.]*)$/, "$1$2");
		}

		if (false && domain_nowww === "clickatlife.gr") {
			// https://www.clickatlife.gr/fu/p/119829/1200/100/0000000000589d8d/1/oscartime-2.jpg
			// high width stretches it, high height doesn't
			//return src.replace(/(\/p\/[0-9]+\/)[0-9]+\/[0-9]+\//, "$1999999999/999999999/");
		}

		if (domain_nosub === "tnews.ir" && domain.match(/^i[0-9]*\./)) {
			// https://i2.tnews.ir/2018/01/25/Thumbnail/104244481_129508645febef.jpg
			//   https://i2.tnews.ir/2018/01/25/104244481_129508645febef.jpg
			return src.replace(/(\/[0-9]+\/[0-9]+\/[0-9]+\/)Thumbnail\//, "$1");
		}

		if (domain === "multimedia.mmc.com.do") {
			// http://multimedia.mmc.com.do/multimedia/multimedia/2018/01/08/16e0ca7197cee4f803769eaa48b953bb_maxh_347x520.jpg
			//   http://multimedia.mmc.com.do/multimedia/multimedia/2018/01/08/16e0ca7197cee4f803769eaa48b953bb.jpg
			return src.replace(/(\/multimedia\/[0-9]+\/[0-9]+\/[0-9]+\/[0-9a-f]+)_max.?_[0-9]+x[0-9]+(\.[^/.]*)$/, "$1$2");
		}

		if (domain === "img.europapress.es") {
			// https://img.europapress.es/fotoweb/fotogaleriafamosos_185837_680.jpg
			//   https://img.europapress.es/fotoweb/fotogaleriafamosos_185837.jpg
			//   https://img.europapress.es/fotoweb/fotogaleriafamosos_185837_9999.jpg
			// http://img.europapress.es/fotoweb/fotonoticia_20140916184233-14091050029_800.jpg
			//   http://img.europapress.es/fotoweb/fotonoticia_20140916184233-14091050029_9999.jpg
			return src.replace(/(\/fotoweb\/[a-z]+_(?:[0-9]+-)?[0-9]+)(?:_[0-9]+)?(\.[^/.]*)$/, "$1_9999$2");
		}

		if (domain === "img.estadao.com.br") {
			// https://img.estadao.com.br/thumbs/940/resources/jpg/8/7/1515373465478.jpg
			//   https://img.estadao.com.br/resources/jpg/8/7/1515373465478.jpg
			return src.replace(/\/thumbs\/[0-9]+\/resources\//, "/resources/");
		}

		if (domain_nosub === "asianews.cc" &&
			domain.match(/^s[0-9]*\./)) {
			// https://s1.asianews.cc/201809/19dad57188b898e3445a8fd01a6b2f30_thum.jpg
			//   https://s1.asianews.cc/201809/19dad57188b898e3445a8fd01a6b2f30_orgn.jpg
			return src.replace(/(\/[0-9]+\/[0-9a-f]+)_[a-z]+(\.[^/.]*)$/, "$1_orgn$2");
		}

		if (domain_nosub === "wallpapermix.club" ||
			// http://wallpaper-planet.com/doc/wallpaper/img/s/elisha_cuthbert_sitting_on_the_sidewalk-1466857637.jpg
			//   http://wallpaper-planet.com/doc/wallpaper/img/l/elisha_cuthbert_sitting_on_the_sidewalk-1466857637.jpg
			domain_nosub === "wallpaper-planet.com") {
			// http://wallpapermix.club/shared/doc/wallpaper/img/s/actress_karen_gillian_photoshoot-1515118545.jpg -- 400x400
			//   http://wallpapermix.club/shared/doc/wallpaper/img/l/actress_karen_gillian_photoshoot-1515118545.jpg -- 1986x1986
			return src.replace(/(\/doc\/wallpaper\/img\/)[a-z]\//, "$1l/");
		}

		if (domain_nosub === "utaten.com" && string_indexof(src, "/uploads/images/") >= 0) {
			// https://cdn.utaten.com/uploads/images/news/8013/3/image_160x160.jpeg
			//   https://cdn.utaten.com/uploads/images/news/8013/3/image.jpeg
			// https://utaten.com/uploads/images/news/4943/2/image_l.jpeg
			//   https://utaten.com/uploads/images/news/4943/2/image.jpeg
			// https://utaten.com/uploads/images/news/18284/16ac19f8f5bfc99c2a56195a895e947fa165f3cf_100x100.jpeg
			//   https://utaten.com/uploads/images/news/18284/16ac19f8f5bfc99c2a56195a895e947fa165f3cf.jpeg
			// https://utaten.com/uploads/images/specialArticle/1420/thumbnail/0x1000/image.jpeg
			//   https://cdn.utaten.com/uploads/images/specialArticle/1420/image.jpeg
			return src
				.replace(/\/thumbnail\/+[0-9]+x[0-9]+\/+/, "/")
				.replace(/_(?:[a-z]|[0-9]+x[0-9]+)(\.[^/.]*)$/, "$1");
		}

		if (domain_nowww === "frostsnow.com") {
			// https://frostsnow.com/uploads/gossip/2016/07/15/360x225/xdid-you-know-what-cnn-election-analyst-jennifer-agiesta-did-before-starting-her-cnn-career.jpeg.pagespeed.ic.yCYobxBryF.jpg
			//   https://frostsnow.com/uploads/gossip/2016/07/15/did-you-know-what-cnn-election-analyst-jennifer-agiesta-did-before-starting-her-cnn-career.jpg
			// https://frostsnow.com/uploads/news/2017/05/26/xbaywatch-actress-priyanka-chopra-s-production-banner-announces-six-films-at-cannes-film-festival.jpg.pagespeed.ic.t6hWvA5aNx.jpg
			//   https://frostsnow.com/uploads/news/2017/05/26/baywatch-actress-priyanka-chopra-s-production-banner-announces-six-films-at-cannes-film-festival.jpg
			return add_extensions_with_jpeg(src
											.replace(/\/x([^/.]*\.[^/.]*)\.pagespeed\.[^/]*$/, "/$1")
											.replace(/\/[0-9]+x[0-9]+\/([^/]*)$/, "/$1"));
		}

		// LynxChan
		if (domain_nowww === "mewch.net" ||
			// https://kohlchan.net/.media/t_4362ba2e6de70ba8125df1fbb09be0325246db5d4ac4733f60d90d7c66080d14
			//   https://kohlchan.net/.media/4362ba2e6de70ba8125df1fbb09be0325246db5d4ac4733f60d90d7c66080d14.jpg
			// thanks to anonymous for reporting:
			// https://kohlchan.net/.media/t_fe2020b99a7af94696eba8d28efc42edbc82c4ac6c3bf88d2714efc8031b1ba7
			//   https://kohlchan.net/.media/fe2020b99a7af94696eba8d28efc42edbc82c4ac6c3bf88d2714efc8031b1ba7.png
			// https://kohlchan.net/.media/t_e13e54044ededa9faad1c1a8eec2c8a5bdef475edd3a35f9e3bd7705eb02abbe
			//   https://kohlchan.net/.media/e13e54044ededa9faad1c1a8eec2c8a5bdef475edd3a35f9e3bd7705eb02abbe.mp4
			domain_nowww === "kohlchan.net" ||
			// thanks to VS on discord for reporting:
			// https://anonib.al/.media/t_c8a097a0fd4f4a323af0bdb4d323cb28cc753245b5e0baccb5abcf44cf4e5525
			//   https://anonib.al/.media/c8a097a0fd4f4a323af0bdb4d323cb28cc753245b5e0baccb5abcf44cf4e5525.jpg
			domain_nowww === "anonib.al" ||
			// https://lynx.farted.net/.media/t_39b1529309a5d3927abbbd9a301a0624b07a5136b996f18e729495c002df21a4
			//   https://lynx.farted.net/.media/39b1529309a5d3927abbbd9a301a0624b07a5136b996f18e729495c002df21a4.gif
			domain === "lynx.farted.net" ||
			// https://cdn.incel.shop/.media/t_39b1529309a5d3927abbbd9a301a0624b07a5136b996f18e729495c002df21a4
			//   https://cdn.incel.shop/.media/39b1529309a5d3927abbbd9a301a0624b07a5136b996f18e729495c002df21a4.gif
			domain === "cdn.incel.shop" ||
			// https://endchan.net/.media/t_6f5844314aa95928051985f8c161c0c4-imagejpeg
			//   https://endchan.net/.media/6f5844314aa95928051985f8c161c0c4-imagejpeg.jpg
			// https://endchan.net/.media/t_2fdd7a2250a106cec0e513dec3b30a83-imagepng
			//   https://endchan.net/.media/2fdd7a2250a106cec0e513dec3b30a83-imagepng.png
			domain_nowww === "endchan.net" ||
			/:\/\/[^/]+\/+\.(?:media\/+t_[0-9a-f]{32,64}(?:-image[a-z]+)?|static\/+images\/+404-[0-9]+\.png)(?:[?#].*)?$/.test(src)) {
			// https://kohlchan.net/.static/images/404-200.png
			if (/\/\.static\/+images\/+404-/.test(src))
				return {
					url: src,
					bad: "true"
				};

			// https://mewch.net/.media/t_d2831e5aac58339eb9799388464fc9df-imagejpeg
			//   https://mewch.net/.media/d2831e5aac58339eb9799388464fc9df-imagejpeg.jpg
			newsrc = src
				.replace(/\/\.media\/+t_([0-9a-f]+-imagejpeg)(?:[?#].*)?$/, "/.media/$1.jpg")
				.replace(/\/\.media\/+t_([0-9a-f]+-imagepng)(?:[?#].*)?$/, "/.media/$1.png");
			if (newsrc !== src)
				return newsrc;

			newsrc = src.replace(/\/\.media\/+t_([0-9a-f]{20,})(?:[?#].*)?$/, "/.media/$1");
			if (newsrc !== src) {
				let urls = add_full_extensions2(newsrc + ".jpg", {extensions: ["jpg", "png", "mp4", "webm", "gif"]});
				urls.unshift(newsrc);
				return urls;
			}
		}

		if (domain === "media.mehrnews.com") {
			// https://media.mehrnews.com/old/Larg1/1393/01/24/IMG09484014.jpg
			//   https://media.mehrnews.com/old/Original/1393/01/24/IMG09484014.jpg
			return src.replace(/\/old\/[^/]*\/([0-9]+\/)/, "/old/Original/$1");
		}

		if (domain_nowww === "barking-moonbat.com") {
			// http://www.barking-moonbat.com/images/uploads/copper_mine_landslide_2_thumb.jpg
			//   http://www.barking-moonbat.com/images/uploads/copper_mine_landslide_2.jpg
			return src.replace(/(\/images\/uploads\/[^/]*)_thumb(\.[^/.]*)$/, "$1$2");
		}

		if (domain_nowww === "deseretnews.com") {
			// https://www.deseretnews.com/images/article/midres/1119476/1119476.jpg
			//   https://www.deseretnews.com/images/article/hires/1119476/1119476.jpg
			return src.replace(/\/images\/article\/[a-z]+res\//, "/images/article/hires/");
		}

		if (domain_nowww === "orsm.net") {
			// https://www.orsm.net/v/update20201029/i-dont-care-what-shes-selling-im-buying.mp4
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+v\/+(update[0-9]+\/+[^/]+\.[^/.?#]+)(?:[?#].*)?$/,
				query_for_id: "https://www.orsm.net/v/${id}",
				run: function(cb, match) {
					return cb({
						url: "https://grab.orsm.net/" + match[1],
						video: true
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "orsm.net") {
			// https://www.orsm.net/i/galleries/random-shite-2017-08-17/thumbnails/random-shite-2017-08-17-08.jpg
			//   https://www.orsm.net/i/galleries/random-shite-2017-08-17/random-shite-2017-08-17-08.jpg
			return src.replace(/(\/i\/galleries\/[^/]*\/)thumbnails\//, "$1");
		}

		if (domain_nowww === "niklife.com.ua") {
			// http://niklife.com.ua/680x510W/images/2013_12/40518_17_948x600.jpeg
			//   http://niklife.com.ua/images/2013_12/40518_17_948x600.jpeg
			return src.replace(/(:\/\/[^/]*\/)[0-9]+x[0-9]+[A-Z]?\/images\//, "$1images/");
		}

		if (domain === "img.ef43.com.cn") {
			// http://img.ef43.com.cn/newsImages/2013/5/25102842136small.jpg
			//   http://img.ef43.com.cn/newsImages/2013/5/25102842136.jpg
			return src.replace(/(\/newsImages\/[0-9]+\/[0-9]+\/[0-9]+)small(\.[^/.]*)$/, "$1$2");
		}

		if (domain === "st.clopotel.t1.ro") {
			// http://st.clopotel.t1.ro/_files/datafiles/vedete/poze/thumbs/1706.jpg
			//   http://st.clopotel.t1.ro/_files/datafiles/vedete/poze/1706.jpg
			return src.replace(/(\/_files\/datafiles\/.*\/)thumbs\/([0-9]+\.[^/.]*)$/, "$1$2");
		}

		if (domain_nosub === "akamaized.net" &&
			domain.match(/^cdn[0-9]*-production-images-kly\./)) {
			// https://cdn0-production-images-kly.akamaized.net/du9wg7rl9-EJ1nj2GU_SiJU_Sa4=/535x710/smart/filters:quality(75):strip_icc():format(jpeg)/kly-media-production/medias/1528771/original/fc327fd09a4441d25f6a49431da40f4370.jpg
			//   https://cdn-production-assets-kly.akamaized.net/medias/1528771/original/fc327fd09a4441d25f6a49431da40f4370.jpg
			//   https://cdn0-production-assets-kly.akamaized.net/medias/1528771/original/fc327fd09a4441d25f6a49431da40f4370.jpg
			// https://cdn1-production-images-kly.akamaized.net/b3twF7fVlOQqKXZ2Od6vJL80HFc=/673x379/smart/filters:quality(75):strip_icc():format(jpeg)/kly-media-production/thumbnails/1850982/original/050925300_1517330947-gadis-wonogiri-dipersunting-bule-ganteng-asal-selandia-baru-d27917.jpg
			//   https://cdn-production-assets-kly.akamaized.net/thumbnails/1850982/original/050925300_1517330947-gadis-wonogiri-dipersunting-bule-ganteng-asal-selandia-baru-d27917.jpg -- /medias/ doesn't work
			return src.replace(/:\/\/[^/]*\/.*?\/kly-media-production\/([a-z]+\/[0-9]+\/)/, "://cdn-production-assets-kly.akamaized.net/$1");
		}

		if ((domain_nosub === "akamaized.net" && domain.match(/^cdn[0-9]*-production-assets-kly\./)) ||
			// https://cdn1-a.production.liputan6.static6.com/medias/1168208/big-portrait/4c8e0ba83d6b26661ebee3755bba098c30.jpg
			//   https://cdn1-a.production.liputan6.static6.com/medias/1168208/original/4c8e0ba83d6b26661ebee3755bba098c30.jpg
			domain_nosub === "static6.com") {
			// https://cdn0-production-assets-kly.akamaized.net/medias/1183631/big-portrait/fdf7b649ee8de2f71a8358dce66a2dc9-084180200_1459064220-selenag.JPG
			//   https://cdn0-production-assets-kly.akamaized.net/medias/1183631/original/fdf7b649ee8de2f71a8358dce66a2dc9-084180200_1459064220-selenag.JPG
			return src.replace(/(\/medias\/+[0-9]+\/+)[^/]*\/+/, "$1original/");
		}

		if (domain === "cdn.xn--cumpleaosdefamosos-t0b.com") {
			// https://cdn.xn--cumpleaosdefamosos-t0b.com/gallery/2017/1/emmy-rossum/emmy-rossum-2014-jeff-vespa-el-arte-del-descubrimiento_thumb.jpg
			//   https://cdn.xn--cumpleaosdefamosos-t0b.com/gallery/2017/1/emmy-rossum/emmy-rossum-2014-jeff-vespa-el-arte-del-descubrimiento.jpg
			return src.replace(/(\/gallery\/[0-9]+\/[0-9]+\/[^/]*\/[^/]*)_thumb(\.[^/.]*)$/, "$1$2");
		}

		if (domain === "up.zhuoku.org" ||
			// http://up.padtu.com/pic_360/b3/63/2f/b3632fbe12a5b684106148ded6dc96f9.jpg
			//   http://up.padtu.com/pic/b3/63/2f/b3632fbe12a5b684106148ded6dc96f9.jpg
			domain === "up.padtu.com" ||
			// http://up.deskbus.com/pic_360/f1/d8/27/f1d827456bffe677aa5b2b44c3ef89a7.jpg
			//   http://up.deskbus.com/pic/f1/d8/27/f1d827456bffe677aa5b2b44c3ef89a7.jpg
			domain === "up.deskbus.com" ||
			// http://up.bizhitupian.com/pic_360/7f/35/f5/7f35f5122f64d4863b2543ab34599f6a.jpg
			//   http://up.bizhitupian.com/pic/7f/35/f5/7f35f5122f64d4863b2543ab34599f6a.jpg
			domain === "up.bizhitupian.com" ||
			// http://up.8desk.com/12/pic_360/fe/06/54/fe0654c871b4ea84ac99a4773542d3b1.jpg
			//   http://up.8desk.com/12/pic/fe/06/54/fe0654c871b4ea84ac99a4773542d3b1.jpg
			domain === "up.8desk.com") {
			// http://up.zhuoku.org/pic_360/6b/76/41/6b7641d45646cfffee39818463a57b92.jpg
			//   http://up.zhuoku.org/pic/6b/76/41/6b7641d45646cfffee39818463a57b92.jpg
			return src.replace(/\/pic_[0-9]+\//, "/pic/");
		}

		if (domain_nowww === "apherald.com" && string_indexof(src, "/ImageStore/images/") >= 0) {
			// https://www.apherald.com/ImageStore/images/movies/movies-actress/tn-Emmy-Rossum-Latest-Photoshoot-Stills19.jpg
			//   https://www.apherald.com/ImageStore/images/movies/movies-actress/Emmy-Rossum-Latest-Photoshoot-Stills19.jpg
			return src.replace(/\/tn-([^/]*)$/, "/$1");
		}

		if (domain_nowww === "luxo.co.za") {
			// http://www.luxo.co.za/system-files/small/selena-gomez-at-veni-1346868458.jpg
			//   http://www.luxo.co.za/system-files/selena-gomez-at-veni-1346868458.jpg
			return src.replace(/\/system-files\/[a-z]+\//, "/system-files/");
		}

		if (domain_nowww === "longroom.com") {
			// https://www.longroom.com/uploads/stock/hm_1100528.jpg
			//   https://www.longroom.com/uploads/stock/1100528.jpg
			return src.replace(/\/uploads\/stock\/[a-z]+_([0-9]+\.[^/.]*)$/, "/uploads/stock/$1");
		}

		if ((domain_nosub === "cennoticias.com" ||
			 // http://img.cdn.baca.co.id/c56c5357-aff8-4d14-b50a-28a79dc8f723_thumbnail
			 //   http://img.cdn.baca.co.id/c56c5357-aff8-4d14-b50a-28a79dc8f723
			 //   http://raw.cdn.baca.co.id/c56c5357-aff8-4d14-b50a-28a79dc8f723
			 domain_nosub === "baca.co.id") &&
			domain.match(/^img\.cdn\./)) {
			// https://img.cdn.cennoticias.com/bfc3eafa-9b40-4dc4-bfbe-499b13949b4d_thumbnail
			//   https://raw.cdn.cennoticias.com/bfc3eafa-9b40-4dc4-bfbe-499b13949b4d
			// http://img.cdn.cennoticias.com/67569b0b-476c-4e06-bf37-2ad80d8f5936?allowRedirect=true
			//   http://raw.cdn.cennoticias.com/67569b0b-476c-4e06-bf37-2ad80d8f5936
			return src.replace(/:\/\/img\.([^/]*)\/([-0-9a-f]+)(?:_thumbnail)?(?:[?#].*)?$/, "://raw.$1/$2");
			//return src.replace(/(:\/\/[^/]*\/[-0-9a-f]+)_thumbnail(?:[?#].*)?$/, "$1");
		}

		if (domain === "cdn-tehran.wisgoon.com") {
			// http://cdn-tehran.wisgoon.com/dlir-s3/1053500x625_1472821254218324.jpg -- 500x625
			//   http://cdn-tehran.wisgoon.com/dlir-s3/10531472821254218324.jpg
			//   http://cdn-tehran.wisgoon.com/dlir-s3/1472821254218324.jpg -- 404
			// http://cdn-tehran.wisgoon.com/dlir-s3/236x335_1534720001305721.jpg
			//   http://cdn-tehran.wisgoon.com/dlir-s3/1534720001305721.jpg
			return src.replace(/\/dlir-s3\/([0-9]+)?[0-9]{3}x[0-9]{3}_([0-9]+\.[^/.]*)$/, "/dlir-s3/$1$2");
		}

		if (domain === "s.stylemode.com") {
			// http://s.stylemode.com/uploads/article_desc/640x640/2016/08/05/20160805104319_65072.jpg -- 500x700, watermark
			//   http://s.stylemode.com/uploads/article_desc/deal/2016/08/05/20160805104319_65072.jpg -- same as above
			//   http://s.stylemode.com/uploads/article_desc/origin/2016/08/05/20160805104319_65072.jpg -- 500x700, no watermark
			// http://s.stylemode.com/uploads/blog_desc/640x640/2016/02/25/20160225070143_88064.jpg -- 640x426
			//   http://s.stylemode.com/uploads/blog_desc/origin/2016/02/25/20160225070143_88064.jpg -- 1843x1229
			// http://s.stylemode.com/uploads/album_detail/640x640/2015/02/20150226064643_64454.jpg -- 640x959, no watermark
			//   http://s.stylemode.com/uploads/album_detail/deal/2015/02/20150226064643_64454.jpg -- 1366x2048, watermark
			//   http://s.stylemode.com/uploads/album_detail/origin/2015/02/20150226064643_64454.jpg -- 1366x2048, no watermark
			// http://s.stylemode.com/uploads/article/382x480/2018/06/20180629072850_92505.jpg
			//   http://s.stylemode.com/uploads/article/origin/2018/06/20180629072850_92505.jpg
			// http://s.stylemode.com/uploads/recommend/deal/2018/09/20180907110017_19778.jpg
			//   http://s.stylemode.com/uploads/recommend/origin/2018/09/20180907110017_19778.jpg -- same as above
			return src.replace(/(\/uploads\/(?:(?:article|blog|album|recommend)(?:_desc|detail)?)\/)(?:[0-9]+x[0-9]+|deal)\//, "$1origin/");
		}

		if (domain_nosub === "akairan.com" && domain.match(/^cdn[0-9]*\./) &&
			string_indexof(src, "/files/images/") >= 0) {
			// https://cdn53.akairan.com/files/images/20186/19/20186191817112885728awaterM.jpg -- watermark
			//   https://cdn53.akairan.com/files/images/20186/19/20186191817112885728a.jpg -- no watermark
			return src.replace(/waterM(\.[^/.]*)$/, "$1");
		}

		if (domain === "cdn.idntimes.com" && string_indexof(src, "/content-images/") >= 0) {
			// https://cdn.idntimes.com/content-images/community/2017/08/6cdff28fa924ff873351ff744d0b5751-hair-and-makeup-beauty-makeup-2e2cd63689fd60e873cbd27ef9c1a342_600xauto.jpg
			//   https://cdn.idntimes.com/content-images/community/2017/08/6cdff28fa924ff873351ff744d0b5751-hair-and-makeup-beauty-makeup-2e2cd63689fd60e873cbd27ef9c1a342.jpg
			return src.replace(/_[0-9auto]+x[0-9auto]+(\.[^/.]*)$/, "$1");
		}

		if (domain_nowww === "comicsblog.fr") {
			// http://www.comicsblog.fr//images/galerie/smallimage/small_the-laughing-fish-batman-tas.jpg
			//   http://www.comicsblog.fr//images/galerie/bigimage/the-laughing-fish-batman-tas.jpg
			return src.replace(/\/images\/galerie\/[a-z]+image\/(?:small_)?/, "/images/galerie/bigimage/");
		}

		if (domain === "ent.sina.com.cn" ||
			// https://auto.sina.com.cn/n.sinaimg.cn/auto/transform/13/w488h325/20200210/e844-ipfprtp4789068.jpg
			//   http://n.sinaimg.cn/auto/transform/13/w488h325/20200210/e844-ipfprtp4789068.jpg
			domain === "auto.sina.com.cn") {
			// http://ent.sina.com.cn/n.sinaimg.cn/ent/transform/w446h299/20180308/TWeg-fysanuf7233873.jpg
			//   http://n.sinaimg.cn/ent/transform/w446h299/20180308/TWeg-fysanuf7233873.jpg
			return src.replace(/^[a-z]+:\/\/[^/]*\/([^/]*\.sinaimg\.cn\/)/, "http://$1");
		}

		if (domain_nowww === "analisadaily.com") {
			// http://analisadaily.com/assets/image/news/small/2018/08/elizabeth-banks-bintangi-queen-for-a-day-604270-1.jpg
			//   http://analisadaily.com/assets/image/news/big/2018/08/elizabeth-banks-bintangi-queen-for-a-day-604270-1.jpg
			return src.replace(/\/assets\/image\/news\/small\//, "/assets/image/news/big/");
		}

		if (domain === "fi.realself.com") {
			// https://fi.realself.com/small/0ceb0a64f3e0a74cbbfef9b42ce441bd/a/2/d/userimage-868845.jpg
			//   https://fi.realself.com/full/0ceb0a64f3e0a74cbbfef9b42ce441bd/a/2/d/userimage-868845.jpg
			return src.replace(/(:\/\/[^/]*\/)[a-z]+(\/[0-9a-f]+\/)/, "$1full$2");
		}

		if (domain_nosub === "babeimpact.com" && domain.match(/^content[0-9]*\./)) {
			// https://content4.babeimpact.com/celebmatrix.com/1604/Paula_Bulczynska_tn_09.jpg
			//   https://content4.babeimpact.com/celebmatrix.com/1604/Paula_Bulczynska_09.jpg
			return src.replace(/_tn(_[0-9]+\.[^/.]*)$/, "$1");
		}

		if (domain === "i.widelec.org") {
			// http://i.widelec.org/3nnj_s.jpg
			//   http://i.widelec.org/3nnj.jpg
			// http://i.widelec.org/zdjecia/4491/2017071812093810_c.jpg
			//   http://i.widelec.org/zdjecia/4491/2017071812093810.jpg
			return src.replace(/_[a-z](\.[^/.]*)$/, "$1");
		}

		if (domain === "image.kurier.at" ||
			// https://image.film.at/images/cfs_square_1232/3017091/november.jpg
			//   https://image.film.at/images/original/3017091/november.jpg
			domain === "image.film.at") {
			// https://image.kurier.at/images/cfs_616w/25149/08050907_ppsvie.jpg
			//   https://image.kurier.at/images/original/25149/08050907_ppsvie.jpg
			return src.replace(/\/images\/+[^/]*\/+([0-9]+\/)/, "/images/original/$1");
		}

		if (domain === "media.game8.vn") {
			// http://media.game8.vn/media2/game8/2015/09/23/c5-3.jpg.310.233.cache
			//   http://media.game8.vn/srv_thumb.ashx?w=jpg&h=310&f=/media2/game8/2015/09/23/c5-3
			//   http://media.game8.vn/srv_thumb.ashx?h=310&f=/media2/game8/2015/09/23/c5-3
			//   http://media.game8.vn/media2/game8/2015/09/23/c5-3 -- works, but has no content type (displays as text)
			//   http://media.game8.vn/media2/game8/2015/09/23/c5-3.jpg
			newsrc = src.replace(/\.[0-9]+\.(?:[0-9]+\.)?cache(?:[?#].*)?$/, "");
			if (newsrc !== src)
				return newsrc;

			if (string_indexof(src, "/srv_thumb.ashx") >= 0) {
				var queries = get_queries(src);
				var ext = queries.w || "jpg";
				return urljoin("http://media.game8.vn/", queries.f, true) + "." + ext;
			}
		}

		if (domain_nosub === "xiongyan.tv" &&
			domain.match(/^img[0-9]*\./)) {
			// http://img2.xiongyan.tv/Public/upload/gallery/51lol/other/half_58cf4bd6e9b4bP4B.jpg
			//   http://img2.xiongyan.tv/Public/upload/gallery/51lol/other/origin_58cf4bd6e9b4bP4B.jpg
			// http://img2.xiongyan.tv/Public/upload/gallery/51lol/other/half_58cf4bd6ca93cYee.jpg
			//   http://img2.xiongyan.tv/Public/upload/gallery/51lol/other/origin_58cf4bd6ca93cYee.jpg
			return src.replace(/\/[a-z]+_([0-9a-f]+[0-9A-Za-z]+\.[^/.]*)$/, "/origin_$1");
		}

		if (domain_nowww === "coffelt.me") {
			// https://coffelt.me/image?id=6461696c796d6f74696f6e2678366c32726d7a&q=http://s1.dmcdn.net/qkD1H.jpg
			//   http://s1.dmcdn.net/qkD1H.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/image.*?[?&]q=([^&]*)$/, "$1");
			if (newsrc !== src)
				return decodeURIComponent(newsrc);
		}

		if (domain === "kiev.segodnya.ua") {
			// https://kiev.segodnya.ua/img/gallery/5498/40/582407_tn.jpg
			//   https://kiev.segodnya.ua/img/gallery/5498/40/582407_main.jpg
			return src.replace(/(\/img\/gallery\/[0-9]+\/[0-9]+\/[0-9]+)_[a-z]+(\.[^/.]*)$/, "$1_main$2");
		}

		if (domain === "image.jjang0u.service.concdn.com" ||
			// http://pic.doctorteen.com/dt/sapphira_peeing/t_08.jpg
			//   http://pic.doctorteen.com/dt/sapphira_peeing/08.jpg
			domain === "pic.doctorteen.com" ||
			// http://pic.freeporn.hu/sapphira_peeing/t_06.jpg
			//   http://pic.freeporn.hu/sapphira_peeing/06.jpg
			// needs http://freeporn.hu/ referer
			domain === "pic.freeporn.hu" ||
			// http://www.hotxxxgirls.org/images/galleries/1/1236/t_1.jpg
			//  http://www.hotxxxgirls.org/images/galleries/1/1236/1.jpg
			(domain_nowww === "hotxxxgirls.org" && /\/images\/+galleries\/+/.test(src)) ||
			// https://content.brazz-girls.com/9490_-_The_Cocksuckers_Club/t_01.jpg
			//   https://content.brazz-girls.com/9490_-_The_Cocksuckers_Club/01.jpg
			domain === "content.brazz-girls.com" ||
			// http://pic.fineartteens.com/fineartteens/galleries/bethany_fancy_fashion/t_01.jpg
			//   http://pic.fineartteens.com/fineartteens/galleries/bethany_fancy_fashion/01.jpg
			domain === "pic.fineartteens.com" ||
			// thanks to vscum on github: https://github.com/qsniyg/maxurl/issues/1166
			// http://simplemetart.com/images/galleries/1/2185/t_5.jpg
			//   http://simplemetart.com/images/galleries/1/2185/5.jpg
			(domain_nowww === "simplemetart.com" && /\/images\/+galleries\//.test(src)) ||
			// thanks to vscum on github: https://github.com/qsniyg/maxurl/issues/1191
			// http://www.picsftv.com/images/galleries/1/618/t_8.jpg
			//   http://www.picsftv.com/images/galleries/1/618/8.jpg
			(domain_nowww === "picsftv.com" && /\/images\/+galleries\//.test(src)) ||
			// http://www.metartdb.com/images/galleries/1/1613/t_10.jpg
			//   http://www.metartdb.com/images/galleries/1/1613/10.jpg
			(domain_nowww === "metartdb.com" && string_indexof(src, "/images/galleries/") >= 0)) {
			// http://image.jjang0u.service.concdn.com/data3/chalkadak/162/201204/23/t_133516093835090.jpg
			//   http://image.jjang0u.service.concdn.com/data3/chalkadak/162/201204/23/133516093835090.jpg
			// http://image.jjang0u.service.concdn.com/data3/chalkadak/160/201909/11/t_156814968374034.jpg
			//   http://image.jjang0u.service.concdn.com/data3/chalkadak/160/201909/11/156814968374034.jpg
			newsrc = src.replace(/\/t_([0-9]+\.[^/.]*)$/, "/$1");
			if (newsrc !== src) {
				return newsrc;
			}
		}

		if (domain === "image.jjang0u.service.concdn.com") {
			return {
				url: src,
				headers: {
					Referer: "http://fun.jjang0u.com/"
				}
			};
		}

		if (domain_nowww === "fotoshoots.be") {
			// http://www.fotoshoots.be/images/fotografen/9891/thumbs//fotoshoots_be-fotograaf-9891-1-1500543888.JPG
			//   http://www.fotoshoots.be/images/fotografen/9891//fotoshoots_be-fotograaf-9891-1-1500543888.JPG
			return src.replace(/(\/images\/fotografen\/[0-9]+\/)thumbs\//, "$1");
		}

		if (domain_nosub === "tapatalk.com") {
			// https://www.tapatalk.com/groups/anthroscape/imageproxy.php?url=http://i300.photobucket.com/albums/nn24/ashleyvale/Sexy%20Steampunk%20Engineer%201_zps80aeq6tz.png
			//   http://i300.photobucket.com/albums/nn24/ashleyvale/Sexy%20Steampunk%20Engineer%201_zps80aeq6tz.png
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/groups\/[^/]*\/imageproxy\.php.*?[?&]url=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeURIComponent(newsrc);
		}

		if (domain === "dl.backbook.me") {
			// https://dl.backbook.me/preview_rect/9ef5ca80a6.jpg
			//   https://dl.backbook.me/full/9ef5ca80a6.jpg
			return src.replace(/(:\/\/[^/]*\/)[a-z_]+(\/[0-9a-f]+\.[^/.]*)$/, "$1full$2")

		}

		if (domain_nosub === "backbook.me" && /^[a-z]\./.test(domain)) {
			// https://d.backbook.me/file/2019/01/05/04/preview_rect_5258dc82d2.jpg
			//   https://d.backbook.me/file/2019/01/05/04/full_5258dc82d2.jpg
			return src
				.replace(/(\/file\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9a-f]{2}\/+)[a-z_]+_([0-9a-f]+\.[^/.]*)(?:[?#].*)?$/,
						 "$1full_$2");
		}

		if (domain === "nthumb.cyworld.com") {
			// http://nthumb.cyworld.com/thumb?width=810&url=http%3A%2F%2Fc2down.cyworld.co.kr%2Fdownload%3Ffid%3D642235ae2c277c8ce4e435bc8a41722a%26name%3D07.jpg
			//   http://c2down.cyworld.co.kr/download?fid=642235ae2c277c8ce4e435bc8a41722a&name=07.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/thumb.*?[?&]url=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeURIComponent(newsrc);
		}

		if (domain === "e.porosenka.net") {
			// https://e.porosenka.net/uploads/a/d/ad4341cf93c4e1e3de869903348e0708_small.jpg
			//   https://e.porosenka.net/uploads/a/d/ad4341cf93c4e1e3de869903348e0708.jpg
			return src.replace(/(\/uploads\/[0-9a-f]\/[0-9a-f]+\/[0-9a-f]+)_[a-z]+(\.[^/.]*)$/, "$1$2");
		}

		if ((domain_nosub === "qhimg.com" ||
			 // https://p1.ssl.qhmsg.com/dr/270_500_/t013a0c21d1411bf2e2.png
			 //   https://p1.ssl.qhmsg.com/t013a0c21d1411bf2e2.png
			 domain_nosub === "qhmsg.com") &&
			domain.match(/^p[0-9]*\./)) {
			// https://p1.ssl.qhimg.com/sdm/180_100_/t01c8a2e57eb3f030a5.png
			//   https://p1.ssl.qhimg.com/t01c8a2e57eb3f030a5.png
			return src.replace(/(:\/\/[^/]*\/+)[a-z]+\/+[0-9]+_[0-9]+_\/+/, "$1");
		}

		if (domain_nosub === "gamersky.com" && domain.match(/^img[0-9]*\./)) {
			// http://img1.gamersky.com/upimg/pic/2018/04/24/201804241437415526_tiny.jpg
			//   http://img1.gamersky.com/upimg/pic/2018/04/24/201804241437415526.jpg
			// http://img1.gamersky.com/upimg/users/2018/04/03/small_201804031127123136.jpg
			//   http://img1.gamersky.com/upimg/users/2018/04/03/origin_201804031127123136.jpg
			// http://img1.gamersky.com/image2018/07/20180719_zy_164_2/image008_S.jpg
			//   http://img1.gamersky.com/image2018/07/20180719_zy_164_2/image008.jpg
			// wip:
			// http://img1.gamersky.com/image2018/09/20180927_lr_176_1/gamersky_05small_10_201892710124AE.jpg
			//   http://img1.gamersky.com/image2018/09/20180927_lr_176_1/gamersky_05origin_09_2018927101216A.jpg
			return {
				url: src
					.replace(/(\/upimg\/pic\/[0-9]{4}\/[0-9]{2}\/[0-9]{2}\/[0-9]+)_[a-z]+(\.[^/.]*)$/, "$1$2")
					.replace(/(\/upimg\/users\/[0-9]{4}\/[0-9]{2}\/[0-9]{2}\/)[a-z]+_([^/]*)$/, "$1origin_$2")
					.replace(/(\/image[0-9]{4}\/+[0-9]{2}\/+[0-9]{8}_[a-z]{2}_[0-9]+_[0-9]+\/+[^/_.]*)_[A-Z](\.[^/.]*)(?:[?#].*)?$/, "$1$2"),
				headers: {
					Referer: ""
				},
				referer_ok: {
					same_domain_nosub: true
				}
			};
		}

		if (domain_nosub === "game234.com" && domain.match(/^webimg[0-9]*\./) ||
			// https://reho.st/https://img.izismile.com/img/img12/20190705/640/fine_examples_when_a_picture_says_more_than_just_a_thousand_words_640_38.jpg
			//   https://img.izismile.com/img/img12/20190705/640/fine_examples_when_a_picture_says_more_than_just_a_thousand_words_640_38.jpg
			// https://reho.st/s02.tcuniverse.com/vkmedia_store/2012/11/YbVg7sxObxiITQsb/sizes/clean/pic_106_clean_790.jpg
			//   https://s02.tcuniverse.com/vkmedia_store/2012/11/YbVg7sxObxiITQsb/sizes/clean/pic_106_clean_790.jpg
			domain_nowww === "reho.st") {
			// http://webimg1.game234.com/http://i-4.yxdown.com/2018/3/30/KDYwMHgp/a9be3ebb-50a7-4993-9cfb-c1a3ddc3ff61.png
			//   http://i-4-yxdown.715083.com/2018/3/30/a9be3ebb-50a7-4993-9cfb-c1a3ddc3ff61.png?imageView2/2/q/65/w/600 -- broken with referrer
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+((?:[a-z]+:\/\/)?[^/]+\.[^/.]+\/+)/, "$1");
			if (newsrc !== src)
				return add_http(newsrc);
		}

		if (domain === "img.izismile.com" ||
			// https://izismile.com/img/img12/20191007/640/new_york_comic_con_was_filled_with_fantastic_cosplay_640_39.jpg
			//   https://izismile.com/img/img12/20191007/1000/new_york_comic_con_was_filled_with_fantastic_cosplay_39.jpg
			domain_nowww === "izismile.com") {
			// https://img.izismile.com/img/img12/20191007/640/new_york_comic_con_was_filled_with_fantastic_cosplay_640_39.jpg
			//   https://img.izismile.com/img/img12/20191007/1000/new_york_comic_con_was_filled_with_fantastic_cosplay_39.jpg
			// other:
			// https://izismile.com/2010/02/05/mother_nature_in_all_its_glory_25_pics.html?fromt=yes
			// https://img.izismile.com/img/img3/20100205/beautiful_nature_l_06.jpg
			//   https://img.izismile.com/img/img3/20100205/beautiful_nature_06.jpg  -- 3900x2613
			// http://erooups.com/img/img3/20100624/erotic/daily_erotic_picdump_282_112_m.jpg?1277342630
			//   http://erooups.com/img/img3/20100624/erotic/daily_erotic_picdump_282_112.jpg?1277342630
			//   http://erooups.com/img/img3/20100624/erotic/daily_erotic_picdump_112.jpg?1277342630 -- doesn't work
			return src
				.replace(/(\/img[0-9]*\/+[0-9]{8}\/+)640\/+([^/]*_)640_(?:high_)?([0-9]+\.[^/.]*)(?:[?#].*)?$/, "$11000/$2$3")
				.replace(/(\/img[0-9]*\/+[0-9]{8}\/+[^/]*)_l(_[0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "cdn.snsimg.carview.co.jp") {
			// https://cdn.snsimg.carview.co.jp/minkara/blog/000/025/020/952/25020952/p1s.jpg
			//   https://cdn.snsimg.carview.co.jp/minkara/blog/000/025/020/952/25020952/p1.jpg
			return src.replace(/(\/blog\/(?:[0-9]+\/){5}[^/]*)[sm](\.[^/.]*)$/, "$1$2");
		}

		if (domain_nowww === "wallpapersontheweb.net") {
			// http://wallpapersontheweb.net/wallpapers/m/a-dog_looking_at_the_sea_animals_dog_sea-550.jpg
			//   http://wallpapersontheweb.net/wallpapers/b/3750x3000/3750x3000-dog_looking_at_the_sea_animals_dog_sea-550.jpg -- upscaled?
			//   http://wallpapersontheweb.net/wallpapers/l/dog_looking_at_the_sea_animals_dog_sea-550.jpg -- 1920x1200 (The original resolution that this wallpaper is uploaded : 1920x1200)
			// http://wallpapersontheweb.net/wallpapers/l/vica_kerekes_women_face-13576.jpg
			//   http://wallpapersontheweb.net/wallpapers/l/vica_kerekes_women_face-13576.jpg -- 4288x2848
			regex = /\/wallpapers\/[a-z]\/(?:(?:[0-9]+x[0-9]+)?\/)?(?:(?:[a-z]|[0-9]+x[0-9]+)-)?([^/]*)-([0-9]+)(\.[^/.]*)$/;
			return {
				url: src.replace(regex, "/wallpapers/l/$1-$2$3"),
				headers: {
					Referer: src.replace(regex, "/$2-$1/")
				}
			};
		}

		if (domain_nosub === "funon.cc" && domain.match(/^s[0-9]*\./)) {
			// https://s1.funon.cc/img/thumb/201510/29/56325fd18a79e.jpg
			//   https://s1.funon.cc/img/orig/201510/29/56325fd18a79e.jpg
			return src.replace(/(\/img\/)[a-z]+(\/[0-9]+\/)/, "$1orig$2");
		}

		if (domain === "img.joemonster.org") {
			// https://img.joemonster.org/upload/qnp/l_1299836adea5b70k.jpg
			//   https://img.joemonster.org/upload/qnp/1299836adea5b70k.jpg
			return src.replace(/(\/upload\/[^/]*\/)[a-z]_([0-9a-f]+[0-9a-z]+\.[^/.]*)$/, "$1$2");
		}

		if (domain === "mobimg.b-cdn.net") {
			// https://mobimg.b-cdn.net/pic/v2/gallery/111x185/aktery-devushki-ika_erekesh_vica_kerekes-lyudi-17894.jpg -- 111x185
			//   https://mobimg.b-cdn.net/pic/v2/gallery/preview/aktery-devushki-ika_erekesh_vica_kerekes-lyudi-17894.jpg -- 1120x700
			//   https://mobimg.b-cdn.net/pic/v2/gallery/real/aktery-devushki-ika_erekesh_vica_kerekes-lyudi-17894.jpg -- 1680x1050
			return src.replace(/\/pic\/v2\/gallery\/[^/]*\//, "/pic/v2/gallery/real/");
		}

		if (domain === "img.wanduorou.com") {
			// http://img.wanduorou.com/imgs/i.gbc.tw/gb_img/3840974l.jpg
			//   http://i.gbc.tw/gb_img/3840974l.jpg
			return src.replace(/^[a-z]+:\/\/[^/]*\/imgs\/([^/.]*\.[^/]*\/)/, "http://$1");
		}

		if (domain === "i.gbc.tw") {
			// http://i.gbc.tw/gb_img/3840974l.jpg -- 600x902
			//   http://i.gbc.tw/gb_img/3840974m.jpg -- 200x300
			//   http://i.gbc.tw/gb_img/3840974.jpg -- 624x939
			return src.replace(/(\/gb_img\/[0-9]+)[a-z](\.[^/.]*)$/, "$1$2");
		}

		if ((domain_nosub === "xuehuaimg.com" && domain.match(/^pic[0-9]*\./)) ||
			// https://cdn2.11street.my/proxy/http://image.gsshop.com//scm/1026290/2017033111/4ddb89e6-6673-43a5-9faa-3e05be0ba422.jpg
			//   http://image.gsshop.com//scm/1026290/2017033111/4ddb89e6-6673-43a5-9faa-3e05be0ba422.jpg
			(domain_nosub === "11street.my" && domain.match(/^cdn[0-9]*\./))) {
			// https://pic1.xuehuaimg.com/proxy/https://i.gbc.tw/gb_img/3840974l.jpg
			//   https://i.gbc.tw/gb_img/3840974l.jpg
			// https://pic1.xuehuaimg.com/proxy/baijia/https://f11.baidu.com/it/u=4022989636,212443463&fm=175&app=25&f=JPEG?w=640&h=960&s=BBB16085862241179D2CFCEA03006093&access=215967316
			//   https://f11.baidu.com/it/u=4022989636,212443463&fm=175&app=25&f=JPEG?w=640&h=960&s=BBB16085862241179D2CFCEA03006093&access=215967316
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/proxy\/+(?:[a-z]+\/+)?([a-z]+:\/\/)/, "$1");
			//newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+proxy\/+[a-z]+\/+(http.*)$/, "$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "img.tgchengzi.com") {
			// http://img.tgchengzi.com/Uploads/ueditor/php/upload/image/20180927/1538020617568109_l.jpg -- watermark
			//   http://img.tgchengzi.com/Uploads/ueditor/php/upload/image/20180927/1538020617568109.jpg -- no watermark
			return src.replace(/(\/Uploads\/ueditor\/php\/upload\/image\/[0-9]+\/[0-9]+)_[a-z](\.[^/.]*)$/, "$1$2");
		}

		if (domain_nosub === "doyo.cn" &&
			domain.match(/^s[0-9]*\./)) {
			// http://s1.doyo.cn/img/55/36/01c89e9e784a3e0001e4.jpg_news
			//   http://s1.doyo.cn/img/55/36/01c89e9e784a3e0001e4.jpg -- 650x433
			return src.replace(/(\/img\/(?:[0-9a-f]{2}\/){2}[0-9a-f]+\.[^/._]*)_[a-z]+(?:[?#].*)?$/, "$1");
		}

		if (domain === "newsimg.hankookilbo.com" ||
			// https://image.hankookilbo.com/level/2019/08/28/c1f537b0-2146-4554-98ea-2f20aa7059b7_t.jpg
			//   https://image.hankookilbo.com/level/2019/08/28/c1f537b0-2146-4554-98ea-2f20aa7059b7.jpg
			domain === "image.hankookilbo.com" ||
			// http://betaimage.hankookilbo.com/level/2018/10/10/516a1b8e-f0e2-49f2-b1be-9bc7a651fab3_t.jpg
			//   http://betaimage.hankookilbo.com/level/2018/10/10/516a1b8e-f0e2-49f2-b1be-9bc7a651fab3.jpg
			domain === "betaimage.hankookilbo.com") {
			// http://newsimg.hankookilbo.com/2018/10/10/201810101339781259_1_t.jpg -- 384x287
			//   http://newsimg.hankookilbo.com/2018/10/10/201810101339781259_1.jpg -- 640x479
			//   http://star.hankookilbo.com/News/Read/201810101339781259
			// http://star.hankookilbo.com/News/Read/201908052230730099
			//   http://newsimg.hankookilbo.com/2019/08/05/201908052230730099_1.jpg
			var extra = {};
			match = src.match(/^[a-z]+:\/\/[^/]*\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}([0-9]{8,})_[0-9]+(?:_[a-z])?\.[^/.]*(?:[?#].*)?$/);
			if (match) {
				extra.page = "http://star.hankookilbo.com/News/Read/" + match[1];
			}

			return {
				url: src.replace(/(\/[0-9]{4}\/[0-9]{2}\/[0-9]{2}\/(?:[0-9]+_[0-9]+|[-0-9a-f]+))_[a-z](\.[^/.]*)$/, "$1$2"),
				extra: extra
			};
		}

		if (domain === "dispatch.cdnser.be") {
			// https://dispatch.cdnser.be/dispatch_image/2013/12/24/2013122404539998anet_T1_59068.jpg -- 51x100
			//   https://dispatch.cdnser.be/dispatch_image/2013/12/24/2013122404539998anet_T5_59068.jpg -- 1642x3210
			return src.replace(/(\/[0-9]+[^-/_.]*_)T[0-9]*(_[0-9]+\.[^/.]*)$/, "$1T5$2");
		}

		if (domain === "cms.artandarchaeology.princeton.edu") {
			// https://cms.artandarchaeology.princeton.edu/media/thumbnails/jessicawomack.jpg?w=1630&h=1222&c=true&d=true -- upscaled
			//   https://cms.artandarchaeology.princeton.edu/media/files/jessicawomack.jpg
			return src.replace(/\/media\/thumbnails\/([^/?]*)\?.*$/, "/media/files/$1");
		}

		if (domain_nowww === "pronto.com.ar" ||
			// thanks to anonymous for reporting:
			// https://www.atalayar.com/asset/thumbnail,1280,720,center,center/media/atalayar/images/2024/06/21/2024062113534695479.jpg
			//   https://www.atalayar.com/media/atalayar/images/2024/06/21/2024062113534695479.jpg
			domain_nowww === "atalayar.com") {
			// https://www.pronto.com.ar/asset/thumbnail%252C998%252C540%252Ccenter%252Ccenter/media/prontoar/images/2018/09/18/2018091813104610387.png -- 333x540
			//   https://www.pronto.com.ar/media/prontoar/images/2018/09/18/2018091813104610387.png -- 882x1430
			return src.replace(/\/asset\/+thumbnail[,%][^/]*\/+media\//, "/media/");
		}

		if (domain === "cdn.thebest.gr") {
			// http://cdn.thebest.gr/media/images/thumbnail/wekkstmsor5bc22ca4898b6.jpg --140x105
			//   http://cdn.thebest.gr/media/images/original/wekkstmsor5bc22ca4898b6.jpg -- 960x655
			return src.replace(/\/media\/images\/[^/]*\//, "/media/images/original/");
		}

		if (domain_nowww === "glow.gr" ||
			// https://omegalive-sf.cdn.edgeport.net/portal-img/single_page_featured/23/handndn3.jpg
			//   https://omegalive-sf.cdn.edgeport.net/image/original/23/handndn3.jpg
			domain === "omegalive-sf.cdn.edgeport.net" ||
			// https://omegalive.com.cy/image/small/23/handndn3.jpg
			//   https://omegalive.com.cy/image/original/23/handndn3.jpg
			domain_nowww === "omegalive.com.cy") {
			// https://glow.gr/portal-img/featured-full/23/vraveia-emmy-2.jpg?crop=1280,647,0,37
			//   https://glow.gr/image/original/23/vraveia-emmy-2.jpg
			// https://glow.gr/portal-img/sq-list/25/vivian-van-singer-3fKcf.jpg
			//   https://glow.gr/image/original/25/vivian-van-singer-3fKcf.jpg
			return src.replace(/(:\/\/[^/]*\/)(?:image|[a-z]+-img)\/+[^/]+(\/+[0-9]+\/+[^/]*\.[^/.?#]*)(?:[?#].*)?$/,
							   "$1image/original$2");
		}

		if (domain_nowww === "scifi-forum.de" ||
			// https://www.phica.net/forums/filedata/fetch?id=12722938&type=thumb
			//   https://www.phica.net/forums/filedata/fetch?id=12722938
			domain_nowww === "phica.net") {
			// https://www.scifi-forum.de/filedata/fetch?id=4498608&d=1527659360&type=medium -- 216x330
			//   https://www.scifi-forum.de/filedata/fetch?id=4498608 -- 775x1186
			return src.replace(/\/filedata\/fetch.*?[?&](id=[0-9]+).*?$/, "/filedata/fetch?$1");
		}

		if (domain === "cache.net-a-porter.com") {
			// https://cache.net-a-porter.com/content/images/story-body-content-V1-2-1526635489420.jpeg/w1000_q10.jpeg
			//   https://assets.ynap-content.com/story-body-content-V1-2-1526635489420.jpeg
			// https://cache.net-a-porter.com/content/images/story-head-content-SUBBED-1518700752405.jpeg/w1900_q65.jpeg
			//   https://assets.ynap-content.com/story-head-content-SUBBED-1518700752405.jpeg
			// https://cache.net-a-porter.com/content/images/story-body-content-V1-0-1516806140638.jpeg/w1900_q65.jpeg
			//   https://assets.ynap-content.com/story-body-content-V1-0-1516806140638.jpeg
			return src.replace(/^[a-z]+:\/\/[^/]*\/content\/images\/(story-[^/]*\.[^/.]*)\/[^/]*$/, "https://assets.ynap-content.com/$1");
		}

		if (domain_nowww === "celluloidportraits.com" && string_indexof(src, "/img/") >= 0) {
			// http://www.celluloidportraits.com/img/Registiattori/imgREGISTIeATTORI21/Thandie%20Newton%2010_5816_S.jpg
			//    http://www.celluloidportraits.com/img/Registiattori/imgREGISTIeATTORI21/Thandie%20Newton%2010_5816_L.jpg
			// L, N, S
			return src.replace(/(_[0-9]+_)[A-Z](\.[^/.]*)$/, "$1L$2");
		}

		if (domain_nowww === "nowtoronto.com") {
			// https://nowtoronto.com/downloads/92683/download/Camila-Cabello.jpg?cb=13f90313ffbdd4175ade951c3fa6ce76&w=640
			//   https://nowtoronto.com/downloads/92683/download/Camila-Cabello.jpg?cb=13f90313ffbdd4175ade951c3fa6ce76
			return src.replace(/(\/downloads\/[0-9]+\/download\/[^/?#]*)(?:.*?[?&](cb=[0-9a-f]+).*?)?$/, "$1?$2");
		}

		if (domain === "cde.peru.com") {
			// https://cde.peru.com//ima/0/1/7/7/1/1771314/924x530/becky.jpg
			//   https://cde.peru.com//ima/0/1/7/7/1/1771314/becky.jpg
			// https://cde.peru.com//ima/0/1/7/7/1/thumb/1771314.jpg
			//   https://cde.peru.com//ima/0/1/7/7/1/1771314.jpg
			// http://cde.peru.com/ima/0/1/6/5/7/thumb/1657281.jpg
			//   http://cde.peru.com/ima/0/1/6/5/7/1657281.jpg
			return src.replace(/(\/ima\/(?:[0-9]\/){5}(?:[0-9]+\/)?)(?:[0-9]+x[0-9]+|thumb)\/([^/]*)$/, "$1$2");
		}

		if (domain === "cd.cinescape.com.pe") {
			// http://cd.cinescape.com.pe/cinescape-603x336-225096.jpg
			//   http://e.cinescape.americadigital.pe/ima/0/0/2/2/5/225096.jpg
			match = src.match(/^[a-z]+:\/\/[^/]*\/cinescape-[0-9]+x[0-9]+-([0-9]+)(\.[^/.]*)(?:[?#].*)?$/);
			if (match) {
				var digits = match[1].replace(/[0-9]{3}$/, "");
				var length = digits.length;
				for (i = length; i < 5; i++) {
					digits = "0" + digits;
				}
				return "http://e.cinescape.americadigital.pe/ima/"
					+ digits[0] + "/" + digits[1] + "/" + digits[2] + "/" + digits[3] + "/" + digits[4] + "/" + match[1] + match[2];
			}
		}

		if (domain_nowww === "celebritytalent.net") {
			// https://www.celebritytalent.net/sampletalent/photos/sm/43319126.jpg
			//   https://www.celebritytalent.net/sampletalent/photos/lg/43319126.jpg
			return src.replace(/\/photos\/[a-z]+\/([0-9]+\.[^/.]*)$/, "/photos/lg/$1");
		}

		if (domain === "img-ovh-cloud.zszywka.pl") {
			// https://img-ovh-cloud.zszywka.pl/1/0669/thb_0429.jpg
			//   https://img-ovh-cloud.zszywka.pl/1/0669/0429.jpg
			return src.replace(/\/thb_([0-9]+\.[^/.]*)$/, "/$1");
		}

		if (domain_nosub === "clickthecity.com" && domain.match(/^cdn[0-9]*\./)) {
			// https://cdn1.clickthecity.com/profiles/200/19229_1.jpg
			//   https://cdn1.clickthecity.com/profiles/19229_1.jpg
			return src.replace(/\/profiles\/[0-9]+(\/[0-9]+(?:_[0-9]+)?\.[^/.]*)$/, "/profiles$1");
		}

		if (domain_nowww === "lafactoriadelshow.com") {
			// https://www.lafactoriadelshow.com/small_5acc8d7fac603_1604661039882031028.jpg
			//   https://www.lafactoriadelshow.com/full_5acc8d7fac603_1604661039882031028.jpg
			return src.replace(/\/[a-z]+_([0-9a-f]+_[0-9]+\.[^/.]*)$/, "/full_$1");
		}

		if (domain_nowww === "elintra.com.ar" ||
			// http://www.diariorepublica.com.ar/u/fotografias/m/2017/8/17/f960x0-14705_14723_15.jpg -- upscaled?
			//   http://www.diariorepublica.com.ar/u/fotografias/fotosnoticias/2017/8/17/14705.jpg
			domain_nowww === "diariorepublica.com.ar" ||
			// https://www.minutoneuquen.com/u/fotografias/m/2019/1/10/f250x140-128657_133675_20.jpg
			//   https://www.minutoneuquen.com/u/fotografias/fotosnoticias/2019/1/10/128657.jpg
			// http://admin.minutoneuquen.com/u/fotografias/m/2019/1/10/f720x404-128657_170229_20.jpg
			//   http://admin.minutoneuquen.com/u/fotografias/fotosnoticias/2019/1/10/128657.jpg
			domain_nosub === "minutoneuquen.com" ||
			// https://www.abcdiario.com.ar/u/fotografias/m/2019/11/1/f800x450-16548_67994_14.jpg
			//   https://www.abcdiario.com.ar/u/fotografias/fotosnoticias/2019/11/1/16548.jpg
			domain_nowww === "abcdiario.com.ar" ||
			// https://www.gamesbras.com/u/fotografias/m/2019/7/19/f620x350-9733_40751_0.jpg
			//   https://www.gamesbras.com/u/fotografias/fotosnoticias/2019/7/19/9733.jpg
			domain_nowww === "gamesbras.com" ||
			// https://www.paginasiete.bo/u/fotografias/m/2018/11/10/f800x450-238307_289753_189.jpg
			//   https://www.paginasiete.bo/u/fotografias/fotosnoticias/2018/11/10/238307.jpg
			domain_nowww === "paginasiete.bo" ||
			// https://www.diariolaprovinciasj.com/u/fotografias/m/2019/8/19/f960x0-226904_226922_0.jpg
			//   https://www.diariolaprovinciasj.com/u/fotografias/fotosnoticias/2019/8/19/226904.jpg
			domain_nowww === "diariolaprovinciasj.com" ||
			// https://www.elintransigente.com/u/fotografias/m/2018/9/27/f800x450-477885_529331_176.jpg
			//   https://www.elintransigente.com/u/fotografias/fotosnoticias/2018/9/27/477885.jpg
			domain_nowww === "elintransigente.com" ||
			// https://www.tiempodesanjuan.com/u/fotografias/m/2013/12/5/f800x450-91246_142692_15.jpg
			//   https://www.tiempodesanjuan.com/u/fotografias/fotosnoticias/2013/12/5/91246.jpg
			/^[a-z]+:\/\/[^/]+\/+u\/+fotografias\/+m\/[0-9]{4}\/+[0-9]{1,2}\/+[0-9]{1,2}\/+f[0-9]+x[0-9]+-[0-9]+_/.test(src)) {
			// https://www.elintra.com.ar/u/fotografias/m/2018/8/25/f260x146-100007_105447_0.jpg
			//   https://www.elintra.com.ar/u/fotografias/fotosnoticias/2018/8/25/100007.jpg
			return src.replace(/\/fotografias\/m\/([0-9]{4}\/[0-9]+\/[0-9]+\/)f[0-9]+x[0-9]+-([0-9]+)_[0-9]+[^/]*(\.[^/.]*)$/,
							   "/fotografias/fotosnoticias/$1$2$3");
		}

		if (domain === "f.aukro.cz" ||
			// thanks to anonymous for reporting:
			// https://cdn.aukro.cz/images/sk1641125388951/730x548/wysoczanska-jadwiga-1927-2021-114781796.jpeg
			//   https://cdn.aukro.cz/images/sk1641125388951/wysoczanska-jadwiga-1927-2021-114781796.jpeg
			domain === "cdn.aukro.cz") {
			// https://f.aukro.cz/images/sk6914079582/400x300/787f902d-2dbc-4eb6-a1b6-402d85079b69
			//   https://f.aukro.cz/images/sk6914079582/787f902d-2dbc-4eb6-a1b6-402d85079b69 -- forces download
			return src.replace(/(\/images\/+sk[0-9]+\/+)[0-9]+x[0-9]+\/+/, "$1");
		}

		if (false && (domain_nowww === "wallpapershome.com" ||
					  domain_nowww === "wallpapershome.ru")) {
			// wip
			// https://wallpapershome.com/celebrities/leslie-grace-beauty-5k-16892.html
			// https://wallpapershome.com/images/pages/ico_v/16892.jpg -- 253x450
			// https://wallpapershome.com/images/pages/pic_h/16892.jpg -- 1920x1080
			// https://wallpapershome.com/images/pages/pic_v/16892.jpg -- 640x1138
			// https://wallpapershome.com/images/wallpapers/leslie-grace-5120x2880-beauty-5k-16892.jpg
			//   https://wallpapershome.com/images/wallpapers/a-5120x2880-16892.jpg -- also works
			//   https://wallpapershome.com/images/wallpapers/a-5880x5880-16892.jpg -- scales up
			//   https://wallpapershome.com/images/wallpapers/-5880x5880-16892.jpg -- doesn't work
			//   https://wallpapershome.com/images/wallpapers/5880x5880-16892.jpg -- doesn't work
			// https://wallpapershome.ru/images/pages/ico_hs/16892.jpg -- 800x450
			// https://wallpapershome.ru/images/pages/ico_h/16892.jpg -- identical to above
			// 0x0 is empty
			// Xx0 seems to return the last image done with the same name/tags, no matter X
		}

		if (domain_nowww === "wallpapershome.com" ||
			domain_nowww === "wallpapershome.ru") {
			// https://wallpapershome.com/images/pages/ico_h/16892.jpg
			//   https://wallpapershome.com/images/pages/pic_h/16892.jpg
			// https://wallpapershome.com/images/pages/ico_v/16892.jpg
			//   https://wallpapershome.com/images/pages/pic_v/16892.jpg
			return src.replace(/(\/images\/+pages\/+)ico_([hv]\/)/, "$1pic_$2");
		}

		if (domain === "envivoblog.estrellatv.com" ||
			// https://www.gamegrin.com/assets/Uploads/_resampled/resizedimage640360-Deus-Ex-Mankind-Divided-20161016143151.jpg
			//   https://www.gamegrin.com/assets/Uploads/Deus-Ex-Mankind-Divided-20161016143151.jpg
			domain_nowww === "gamegrin.com" ||
			// http://cdn.okjeok.hr/assets/Uploads/_resampled/SetWidth300-GettyImages-675604330.jpg
			//   http://cdn.okjeok.hr/assets/Uploads/GettyImages-675604330.jpg
			domain === "cdn.okjeok.hr") {
			// http://envivoblog.estrellatv.com/assets/envivoblog.estrellatv.com/articles/images/06-2018/_resampled/SetWidth360-1524696124-leslie-grace-colabora-con-super-junior.jpg
			//   http://envivoblog.estrellatv.com/assets/envivoblog.estrellatv.com/articles/images/06-2018/1524696124-leslie-grace-colabora-con-super-junior.jpg
			return src.replace(/\/_resampled\/(?:Set(?:Width|Height)|resizedimage)[0-9]+-([^/]*)$/, "/$1");
		}

		if (domain_nowww === "haltadefinizione.com") {
			// https://www.haltadefinizione.com/assets/Uploads/_resampled/ScaleWidthWyIxOTIwIl0/leo2.jpg
			//   https://www.haltadefinizione.com/assets/Uploads/leo2.jpg
			// https://www.haltadefinizione.com/assets/Uploads/_resampled/ScaleWidthWyIxOTIwIl0/88.jpg -- 1920x1157
			//   https://www.haltadefinizione.com/assets/Uploads/88.jpg -- 1440x868
			// todo:
			// thanks to anonymous for reporting:
			// https://www.haltadefinizione.com/visualizzatore/opera/annunciazione-leonardo-da-vinci
			// https://dam.haltadefinizione.com/images/viewers/dzi/?uuid=813c03cf-7399-4360-a93d-da51bd11597c (needs tiling)
			return src.replace(/\/_resampled\/+Scale(?:Width|Height)[^/]+\/+/, "/");
		}

		if (domain === "images.sex.com") {
			// https://images.sex.com/images/pinporn/2017/05/03/300/17715654.jpg
			//   https://images.sex.com/images/pinporn/2017/05/03/620/17715654.jpg -- no watermark
			// https://images.sex.com/images/pinporn/2017/11/03/300/18602164.jpg -- no watermark
			//   https://images.sex.com/images/pinporn/2017/11/03/620/18602164.jpg -- watermark
			// https://images.sex.com/images/pinporn/2014/10/03/460/8333897.jpg -- no watermark
			//   https://images.sex.com/images/pinporn/2014/10/03/620/8333897.jpg -- watermark
			// https://images.sex.com/images/pinporn/2018/10/09/126x126/20066749.jpg -- no watermark
			//   https://images.sex.com/images/pinporn/2018/10/09/620/20066749.jpg -- watermark
			match = src.match(/(\/images\/pinporn\/[0-9]{4}\/[0-9]{2}\/[0-9]{2}\/)[0-9]+(?:x[0-9]+)?\/([0-9]+\.[^/.?#]+)(?:[?#],*)?$/);
			if (match) {
				return "https://cdn.sex.com" + match[1] + match[2];
			}

			return {
				url: src.replace(/(\/images\/pinporn\/[0-9]{4}\/[0-9]{2}\/[0-9]{2}\/)(?:300|460|126x126)\//, "$1620/"),
				headers: {
					Referer: "https://www.sex.com/" // no referer doesn't work
				},
				referer_ok: {
					same_domain_nosub: true
				}
			};
		}

		if (domain === "cdn.sex.com") {
			// https://cdn.sex.com/images/pinporn/2019/02/28/20758139.jpg?width=300
			//   https://cdn.sex.com/images/pinporn/2019/02/28/20758139.jpg
			return {
				url: src.replace(/\?.*/, ""),
				headers: {
					Referer: "https://www.sex.com/" // no referer doesn't work
				}
			};
		}

		if (domain === "fotografias.antena3.com" ||
			// https://image.europafm.com/clipping/cmsimages01/2018/10/14/D4C3AFC5-9FF1-456D-9732-AC2F6234F48A/50.jpg -- 1024x400
			//   https://image.europafm.com/clipping/cmsimages01/2018/10/14/D4C3AFC5-9FF1-456D-9732-AC2F6234F48A/18.jpg -- 1408x864, looks stretched
			//   https://image.europafm.com/clipping/cmsimages01/2018/10/14/D4C3AFC5-9FF1-456D-9732-AC2F6234F48A/default.jpg -- 470x486
			domain === "image.europafm.com" ||
			// https://fotografias.atresmediacorporacion.com/clipping/cmsimages01/2018/04/16/9C0DCE85-092F-457C-873E-BB30D26656AF/63.jpg
			//   https://fotografias.atresmediacorporacion.com/clipping/cmsimages01/2018/04/16/9C0DCE85-092F-457C-873E-BB30D26656AF/default.jpg
			//   https://fotografias.atresmediacorporacion.com/2018/04/16/9C0DCE85-092F-457C-873E-BB30D26656AF/default.jpg
			src.match(/^[a-z]+:\/\/[^/]*\/clipping\/cmsimages[0-9]*\/[0-9]{4}\/[0-9]{2}\/[0-9]{2}\/[-0-9A-F]+\/[^/]*\.[^/.]*$/)) {
			// https://fotografias.antena3.com/clipping/cmsimages01/2018/06/25/B83EC976-8270-4642-99FB-3C2E69B63233/53.jpg -- 700x394
			// https://fotografias.antena3.com/clipping/cmsimages01/2018/06/25/B83EC976-8270-4642-99FB-3C2E69B63233/58.jpg -- 1000x567
			//   https://fotografias.antena3.com/2018/06/25/B83EC976-8270-4642-99FB-3C2E69B63233/58.jpg -- same, although non-numbers return 404 instead of a java error:
			// Se ha producido un error de tipo class org.springframework.web.client.HttpServerErrorException con la causa: 500 Internal Server Error al localizar el fichero /cmsimages01/2018/06/25/B83EC976-8270-4642-99FB-3C2E69B63233/0.jpg
			// Se ha producido un error de tipo class java.lang.NumberFormatException con la causa: For input string: "-" al localizar el fichero /cmsimages01/2018/06/25/B83EC976-8270-4642-99FB-3C2E69B63233/-.jpg
			// 18, 54, 57, 69, 67, 55, 16, 51, 22, 58, 4, 14
			// https://fotografias.antena3.com/clipping/cmsimages01/2018/06/25/B83EC976-8270-4642-99FB-3C2E69B63233/18.jpg -- 1407x854
			//   https://fotografias.antena3.com/clipping/cmsimages01/2018/06/25/B83EC976-8270-4642-99FB-3C2E69B63233/default.jpg -- 1920x1282
			newsrc = src.replace(/(\/clipping\/cmsimages[0-9]*\/[0-9]{4}\/[0-9]{2}\/[0-9]{2}\/[-0-9A-F]+\/)[^/]*(\.[^/.]*)$/,
								 "$1default$2");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nosub === "nickiswift.com" && domain.match(/^img[0-9]*\./)) {
			// https://img1.nickiswift.com/img/uploads/2018/01/Camila_Cabello_s_Not_So_Nice_Side-780x438_rev1.jpg
			//   https://img1.nickiswift.com/img/uploads/2018/01/Camila_Cabello_s_Not_So_Nice_Side.jpg
			return src.replace(/-[0-9]+x[0-9]+(?:_rev[0-9]*)?(\.[^/.]*)$/, "$1");
		}

		if (false && domain_nowww === "marieclaire.ru") {
			// wip, current rule is useless
			// http://www.marieclaire.ru/images/th/2086/6208/7c76/330@500@62087c76fe029aea49984ab5ecda1a89-OTk3YzNiYWVmNg.jpg?time=952
			//   http://www.marieclaire.ru/images/330/500/330@500@62087c76fe029aea49984ab5ecda1a89.jpg
			return src.replace(/\/images\/th\/[0-9a-f]+\/[0-9a-f]+\/[0-9a-f]+\/(([0-9]+)@([0-9]+)@[0-9a-f]+)-[^/.]*(\.[^/.?#]*)(?:[?#].*)?$/,
							   "/images/$2/$3/$1$4");
		}

		if (amazon_container === "sphm-female-site-production") {
			// http://sphm-female-site-production.s3.amazonaws.com/2015/05/want-lily-collins-flawless-skin-750px.jpg
			//   http://sphm-female-site-production.s3.amazonaws.com/2015/05/want-lily-collins-flawless-skin.jpg
			return src.replace(/-[0-9]+px(\.[^/.]*)$/, "$1");
		}

		if (domain_nowww === "maxpapendieck.com") {
			// http://www.maxpapendieck.com/app/webroot/upload/840/lily-collins-image-4-thumb.jpg -- 105x150
			//   http://www.maxpapendieck.com/app/webroot/upload/840/lily-collins-image-4-medium.jpg -- 337x480
			//   http://www.maxpapendieck.com/app/webroot/upload/840/lily-collins-image-4-large.jpg -- 843x1200
			//   http://www.maxpapendieck.com/app/webroot/upload/840/lily-collins-image-4.jpg -- 1406x2000
			return src.replace(/(\/app\/webroot\/upload\/[0-9]+\/[^/]*)-(?:large|medium|thumb)(\.[^/.]*)$/, "$1$2");
		}

		if (domain === "i.mdel.net") {
			// https://i.mdel.net/i/db/play-160.png
			// https://i.mdel.net/i/db/transBack.png
			if (/\/i\/+db\/+(?:play-[0-9]+|transBack)\./.test(src))
				return {
					url: src,
					bad: "mask"
				};

			// https://i.mdel.net/i/db/2017/1/635631/635631-500w.jpg
			//   https://i.mdel.net/i/db/2017/1/635631/635631-orig.jpg -- 883x1080
			// https://i.mdel.net/i/db/2016/10/599643/599643-80tn.jpg
			//   https://i.mdel.net/i/db/2016/10/599643/599643-orig.jpg
			return src.replace(/(\/i\/db\/[0-9]+\/[0-9]+\/[0-9]+\/[0-9]+)-[0-9]+[a-z]n?(\.[^/.]*)$/, "$1-orig$2");
		}

		if (domain === "cdn-img.fimfiction.net") {
			// https://cdn-img.fimfiction.net/story/rhzk-1432553346-172155-medium
			//   https://cdn-img.fimfiction.net/story/rhzk-1432553346-172155-full
			// https://cdn-img.fimfiction.net/user/z6pg-1431818522-935-160
			//   https://cdn-img.fimfiction.net/user/z6pg-1431818522-935-512
			return src
				.replace(/(\/story\/[^-/]*-[0-9]+-[0-9]+-)[a-z]+([?#].*)?$/, "$1full$2")
				.replace(/(\/user\/[^-/]*-[0-9]+-[0-9]+-)[0-9]+([?#].*)?$/, "$1512$2");
		}

		if (domain_nosub === "tv-happening.com" && domain.match(/^img(?:-[a-z]+)?[0-9]*\./)) {
			// http://img01.tv-happening.com/img_post/722/s/19.jpg -- 795x447
			//   http://img01.tv-happening.com/img_post/722/b/19.jpg -- 1600x900
			// http://img-fdc03.tv-happening.com/img_post/2230/s/14.jpg
			//   http://img-fdc03.tv-happening.com/img_post/2230/b/14.jpg
			return src.replace(/\/[a-z]\/([0-9]+\.[^/.]*)$/, "/b/$1");
		}

		if (domain_nowww === "kbbs.jp" ||
			// http://ibbs.info/fitimg/cache/corei7/9/w150ht1385397216crq60_corei7_52937be044ce1_9_84-3.jpg
			//   http://ibbs.info/data/corei7/img/corei7_52937be044ce1_9_84-3.jpg
			domain_nowww === "ibbs.info") {
			// http://kbbs.jp/fitimg/cache/cun/5/w720ht1539562482crq60_cun_UPD8U_5_75-5.jpg
			//   http://kbbs.jp/data/cun/img/cun_UPD8U_5_75-5.jpg
			return src.replace(/\/fitimg\/cache\/([^/]*)\/[0-9]+\/[^/_.]*_([^/]*)(?:[?#].*)?$/, "/data/$1/img/$2");
		}

		if (domain_nowww === "pzy.be") {
			// https://pzy.be/t/2/1000984_684906931534949_844139657_n.jpg
			//   https://pzy.be/i/2/1000984_684906931534949_844139657_n.jpg
			return src.replace(/(:\/\/[^/]*\/)t(\/[0-9]+\/[^/]*)$/, "$1i$2");
		}

		if ((domain_nosub === "blick.ch" && domain.match(/^f[0-9]*\./)) ||
			// https://static.pulse.ng/img/incoming/origs3982140/1970485862-w980-h640/Boris-Kodjoe.png
			//   https://static.pulse.ng/media/3982140/Boris-Kodjoe.png
			// https://static.pulse.ng/img/gist/origs3194543/2955564792-w644-h429/saeon-EP-1.jpg
			//   https://static.pulse.ng/media/3194543/saeon-EP-1.jpg
			// https://static.pulse.ng/img/gist/crop2729803/5934674216-chorizontal-w1200-h630/android.jpg
			//   https://static.pulse.ng/media/2729803/android.jpg
			// https://static.pulse.ng/img/finance/origs7762673/8080488404-w980-h640/5a37d8c67cc41ec8358b45c6.png
			//   https://static.pulse.ng/media/7762673/5a37d8c67cc41ec8358b45c6.png
			// https://static.pulse.ng/img/incoming/origs5267563/5549728609-w900-h600/ankara-dress-7.jpg?_ga=1.141366900.733172374.1446814233
			//   https://static.pulse.ng/media/5267563/ankara-dress-7.jpg
			domain === "static.pulse.ng" ||
			// https://img.bildderfrau.de/img/incoming/origs210102467/328335677-w800-h960-dc1/Der-Regisseur-Lars-Kraume-dreht-den-Film-Das-schweigende-Klassenzimmer-.jpg
			//   https://img.bildderfrau.de/media/210102467/Der-Regisseur-Lars-Kraume-dreht-den-Film-Das-schweigende-Klassenzimmer-.jpg -- doesn't work
			//domain === "img.bildderfrau.de" ||
			// https://img.abendblatt.de/img/incoming/origs205814601/4592947493-w800-h960/Pippis-geistige-Mutter-die-schwedische-Kinderbuchautorin-Astrid-Lindgren-1987-.jpg
			//   https://img.abendblatt.de/media/205814601/Pippis-geistige-Mutter-die-schwedische-Kinderbuchautorin-Astrid-Lindgren-1987-.jpg -- doesn't work
			//domain === "img.abendblatt.de" ||
			// https://bilder2.n-tv.de/img/incoming/crop20559669/377132103-cImg_16_9-w1200/Harley-Davidson-LiveWire.jpg
			//   https://bilder2.n-tv.de/media/20559669/Harley-Davidson-LiveWire.jpg -- doesn't work (zero length image)
			//(domain_nosub === "n-tv.de" && domain.match(/^bilder[0-9]*\./)) ||
			// https://static.pulselive.co.ke/img/incoming/origs7049829/1888631095-w980-h653-q70/FB-IMG-1501048439025.jpg
			//   https://static.pulselive.co.ke/media/7049829/FB-IMG-1501048439025.jpg
			domain === "static.pulselive.co.ke" ||
			// https://p5.focus.de/img/leben/origs10247064/8338434698-w1280-h960-q72-p4/compressed-c4595bcf-6000-4b32-a0e6-9b2a24220f3bcfa33f0afad38eacd27e7f9f8e6ab206.jpg
			//   https://p5.focus.de/media/10247064/compressed-c4595bcf-6000-4b32-a0e6-9b2a24220f3bcfa33f0afad38eacd27e7f9f8e6ab206.jpg
			(domain_nosub === "focus.de" && domain.match(/^p[0-9]*\./)) ||
			// https://static.pulse.com.gh/img/incoming/crop5437370/195799655-chorizontal-w980-q99/IMG-20160518-WA0003.jpg
			//   https://static.pulse.com.gh/media/5437370/IMG-20160518-WA0003.jpg
			domain === "static.pulse.com.gh") {
			// https://f3.blick.ch/img/incoming/origs2943461/0000147929-w980-h653/21287423.jpg -- 980x647
			//   https://f3.blick.ch/media/2943461--3106/21287423.jpg -- 3000x1982
			//   https://f3.blick.ch/media/2943461/21287423.jpg -- same
			// https://f3.blick.ch/img/incoming/origs5189144/3772535931-w1280-h960/BREXIT-Absurdistan1.jpg -- 661x960
			//   https://f3.blick.ch/media/5189144/BREXIT-Absurdistan1.jpg -- 2067x3000
			// https://f3.blick.ch/img/incoming/origs2941934/5770143486-w980-h653/7e6e2681-f4c3-5538-661d-80f649a659a9-.jpg
			//   https://f3.blick.ch/media/2941934/7e6e2681-f4c3-5538-661d-80f649a659a9-.jpg
			// http://f.blick.ch/img/incoming/origs2049415/009556218-w644-h429/MelanieOesch-90-P.jpg
			//   http://f.blick.ch/media/2049415/MelanieOesch-90-P.jpg
			return src.replace(/\/img\/[a-z]+\/(?:origs|crop)([0-9]*)\/[0-9]+(?:-[^/]*)?\/([^/?#]*\.[^/.?#]*)(?:[?#].*)?$/,
							   "/media/$1/$2");
		}

		if (domain === "img.blick.ch") {
			// https://img.blick.ch/incoming/7040030-v5-file6v0ev8lnk1h15jshehfk.jpg?imwidth=1000&ratio=FREE&x=0&y=0&width=541&height=800
			//   https://img.blick.ch/incoming/7040030-v5-file6v0ev8lnk1h15jshehfk.jpg?ratio=FREE
			// thanks to carozzz on github: https://github.com/qsniyg/maxurl/issues/194
			// https://img.blick.ch/incoming/2998379-v4-teaserbildenergyair.jpg?imwidth=1000&ratio=FREE&x=0&y=293&width=4256&height=2397
			//   https://img.blick.ch/incoming/2998379-v4-teaserbildenergyair.jpg?ratio=FREE -- 2000x1331
			//   https://img.blick.ch/incoming/2998379-v4-teaserbildenergyair.jpg?ratio=FREE&x=0&y=0 -- 4256x2832
			return src.replace(/\?.*/, "?ratio=FREE&x=0&y=0");
		}

		if (domain_nowww === "mixnews.lv") {
			// http://www.mixnews.lv/uploads/media/image/2013/02/07/20130207-heidi_11_medium.png
			//   http://www.mixnews.lv/uploads/media/image/2013/02/07/20130207-heidi_11.jpg
			// http://www.mixnews.lv/uploads/media/image/2012/05/15/greec_medium.png
			//   http://www.mixnews.lv/uploads/media/image/2012/05/15/greec.jpg
			return src.replace(/(\/uploads\/media\/image\/[0-9]{4}\/[0-9]{2}\/[0-9]{2}\/[^/]*)_medium\.png(?:[?#].*)?$/,
							   "$1.jpg");
		}

		if (domain_nosub === "promiflash.de" &&
			domain.match(/^content[0-9]*\./)) {
			// https://content5.promiflash.de/article-images/gallery1024/charlie-sheen-und-lindsay-lohan-posieren.jpg
			//   https://content5.promiflash.de/article-images/gallery2048/charlie-sheen-und-lindsay-lohan-posieren.jpg
			return src.replace(/\/article-images\/+gallery1024\//, "/article-images/gallery2048/");
		}

		if (domain_nowww === "mycharm.ru") {
			// https://www.mycharm.ru/data/cache/2016jul/28/45/257823_37157thumb650.jpg
			//   https://www.mycharm.ru/data/cache/2016jul/28/45/257823_37157.jpg
			return src.replace(/(\/data\/cache\/[0-9]{4}[a-z]+\/.*)thumb[0-9]+(\.[^/.]*)$/, "$1$2");
		}

		if (domain === "images.worthpoint.com") {
			// https://images.worthpoint.com/files/is/tn/auctionimages/4859/2983/4859_2983_27L0WNK2L.jpg
			//   https://images.worthpoint.com/files/is/auctionimages/4859/2983/4859_2983_27L0WNK2L.jpg
			// https://images.worthpoint.com/files/sloans/tn/full/360/116360.jpg
			//   https://images.worthpoint.com/files/sloans/full/360/116360.jpg
			return src.replace(/(\/files\/[^/]*\/)tn\//, "$1");
		}

		if (domain_nowww === "benishop.co" ||
			// https://cdn.benishop.co/imgcdn/3264/http/s3-media4.ak.yelpcdn.com/bphoto/3HvAJi8Zigwa6ZihY8SDjA/l.jpg_.jpg
			//   http://s3-media4.ak.yelpcdn.com/bphoto/3HvAJi8Zigwa6ZihY8SDjA/l.jpg
			domain === "cdn.benishop.co" ||
			// https://awanshop.co/imgcdn/9600/https/img1.wsimg.com/templates-vnext/homedecor-example-16-thumb.jpg_.jpg
			//   https://img1.wsimg.com/templates-vnext/homedecor-example-16-thumb.jpg
			domain_nowww === "awanshop.co") {
			// https://benishop.co/imgcdn/4096/https/img.auctiva.com/imgdata/1/1/2/0/0/4/7/webimg/621815239_o.jpg_.jpg
			//   https://img.auctiva.com/imgdata/1/1/2/0/0/4/7/webimg/621815239_o.jpg -- 1025x1023
			return src.replace(/^[a-z]+:\/\/[^/]*\/imgcdn\/[0-9]+\/([a-z]+)\/(.*)_\.[^/.]*$/, "$1://$2");
		}

		if (domain === "img.auctiva.com") {
			// https://img.auctiva.com/imgdata/1/7/6/4/9/0/5/webimg/993566635_tp.jpg -- 199x300
			//   https://img.auctiva.com/imgdata/1/7/6/4/9/0/5/webimg/993566635_o.jpg -- 350x525
			// doesn't work for all:
			// https://img.auctiva.com/imgdata/7/4/2/5/8/9/webimg/333726972_tp.gif -- 2560x1707
			//   https://img.auctiva.com/imgdata/7/4/2/5/8/9/webimg/333726972_o.gif -- 1024x682 (downscaled)
			return src.replace(/(\/[0-9]+_)[a-z]+(\.[^/.]*)$/, "$1o$2");
		}

		if (domain === "img.networthpost.com") {
			// https://img.networthpost.com/thumbs/3205512_rachel-riley/3205512_rachel-riley_1.jpeg
			//   https://img.networthpost.com/images/3205512_rachel-riley/3205512_rachel-riley_1.jpeg
			return src.replace(/\/thumbs\/([0-9]+_)/, "/images/$1");
		}

		if (domain === "img.static.butygirls.com") {
			// http://img.static.butygirls.com/resize/800/800/1/22278a8dd3f85a68c6daec086521fe56.png
			//   http://img.static.butygirls.com/22278a8dd3f85a68c6daec086521fe56.png
			return src.replace(/\/resize\/[0-9]+\/[0-9]+\/[0-9]+(\/[0-9a-f]+\.[^/.]*)$/, "$1");
		}

		if (domain_nowww === "wallpapersmug.com" ||
			// https://picstatio.com/wallpaper/download/1600x900/barbara-palvin-cute-face--m3kz3
			// https://picstatio.com/download/1600x900/-m3kz3/barbara-palvin-cute-face.jpg
			//   https://picstatio.com/u/-m3kz3/barbara-palvin-cute-face.jpg
			// https://picstatio.com/thumb/kmuj1w/beautiful-actress-model-Margot-Robbie.jpg
			//   https://picstatio.com/large/kmuj1w/beautiful-actress-model-Margot-Robbie.jpg
			//   https://picstatio.com/u/kmuj1w/beautiful-actress-model-Margot-Robbie.jpg
			domain_nowww === "picstatio.com") {
			// https://wallpapersmug.com/download/1224x1224/78d9e0/alejandra-guilmant-5k.jpg
			//   https://wallpapersmug.com/u/78d9e0/alejandra-guilmant-5k.jpg
			// https://wallpapersmug.com/thumb/b56a09/camila-queiroz-beautiful-celebrity.jpg
			//   https://wallpapersmug.com/u/b56a09/camila-queiroz-beautiful-celebrity.jpg
			// https://wallpapersmug.com/large/912787/barbara-palvin-cute-smiling.jpg
			//   https://wallpapersmug.com/u/912787/barbara-palvin-cute-smiling.jpg
			return src.replace(/\/(?:download\/+[0-9]+x[0-9]+|(?:thumb|large))\/+([-0-9a-z]+\/+[^/]*)(?:[?#].*)?$/, "/u/$1");
			//return src.replace(/(:\/\/[^/]*\/)(?:thumb|large)\//, "$1u/");
		}

		if (domain === "cp12.nevsepic.com.ua") {
			// http://cp12.nevsepic.com.ua/92/thumbs/1348495006-842567-alejandra_guilmant_24.jpg
			//   http://cp12.nevsepic.com.ua/92/1348495006-842567-alejandra_guilmant_24.jpg
			return src.replace(/(\/[0-9]+\/)thumbs\/([0-9]+-[0-9]+-[^/]*)$/, "$1$2");
		}

		if (domain === "itn.dmarge.com") {
			// https://itn.dmarge.com/313x190/2018/10/tudor2.jpg
			//   https://i.dmarge.com/2018/10/tudor2.jpg
			return src.replace(/:\/\/[^/]*\/[0-9]+x[0-9]+\//, "://i.dmarge.com/");
		}

		if (domain_nosub === "idnes.cz" && domain.match(/^img[0-9]*\./)) {
			// https://img30.rajce.idnes.cz/d3002/15/15141/15141025_b6576d288fb5a9cabf9341f6d52dd8bb/thumb/209625_50.jpg?ver=3
			//   https://img30.rajce.idnes.cz/d3002/15/15141/15141025_b6576d288fb5a9cabf9341f6d52dd8bb/images/209625_50.jpg?ver=3
			return src.replace(/\/thumb\//, "/images/");
		}

		if (domain_nowww === "funsubstance.com") {
			// https://funsubstance.com/uploads/preview/487/487309.jpg
			//   https://funsubstance.com/uploads/original/487/487309.jpg
			return src.replace(/\/uploads\/[a-z]+\//, "/uploads/original/");
		}

		if (domain === "global.unitednations.entermediadb.net") {
			// https://global.unitednations.entermediadb.net/assets/mediadb/services/module/asset/downloads/preset/assets/2014/07/19535/image1170x530cropped.jpg
			//   https://global.unitednations.entermediadb.net/assets/mediadb/services/module/asset/downloads/preset/assets/2014/07/19535/image.jpg
			//   https://global.unitednations.entermediadb.net/assets/mediadb/services/module/asset/downloads/preset/assets/2014/07/19535/image3000x3000.jpg -- doesn't exist
			// other:
			// https://global.unitednations.entermediadb.net/assets/mediadb/services/module/asset/downloads/preset/Libraries/Production+Library/29-11-2021-Dubai-Expo-opportunity-zone.JPEG/image770x420cropped.jpg
			//   https://global.unitednations.entermediadb.net/assets/mediadb/services/module/asset/downloads/preset/Libraries/Production+Library/29-11-2021-Dubai-Expo-opportunity-zone.JPEG/image3000x3000.jpg -- 2048x1536
			// https://global.unitednations.entermediadb.net/assets/mediadb/services/module/asset/downloads/preset/Libraries/Production+Library/10-12-2021_Mont-Blanc-02.jpg/image770x420cropped.jpg
			//   https://global.unitednations.entermediadb.net/assets/mediadb/services/module/asset/downloads/preset/Libraries/Production+Library/10-12-2021_Mont-Blanc-02.jpg/image3000x3000.jpg -- 2000x1125
			// https://global.unitednations.entermediadb.net/assets/mediadb/services/module/asset/downloads/preset/Libraries/Production+Library/5-11-2021-COP26-Glasgow-Youth-02.jpg/image770x420cropped.jpg
			// https://global.unitednations.entermediadb.net/assets/mediadb/services/module/asset/downloads/preset/Collections/Embargoed/11-11-2021-Haiti-FAO4.jpg/image770x420cropped.jpg
			//   https://global.unitednations.entermediadb.net/assets/mediadb/services/module/asset/downloads/preset/Collections/Embargoed/11-11-2021-Haiti-FAO4.jpg/image3000x3000.jpg -- 2000x1333
			// https://global.unitednations.entermediadb.net/assets/mediadb/services/module/asset/downloads/preset/Libraries/Graphics+Library/Human-Rights-Day-QuoteCard-Bachelet.png/image1024x768.jpg
			//   https://global.unitednations.entermediadb.net/assets/mediadb/services/module/asset/downloads/preset/Libraries/Graphics+Library/Human-Rights-Day-QuoteCard-Bachelet.png/image3000x3000.jpg -- 1941x3000
			// removing the last /image.* returns a text file containing the images available
			return src
				.replace(/(\/downloads\/+preset\/+[^/]+\/+[^/]+\/+[^/]+\.[a-zA-Z]{3,4}\/+)image[0-9]+x[0-9]+(?:cropped)?(\.[^/.]*)$/, "$1image3000x3000$2")
				.replace(/(\/downloads\/+preset\/+assets\/+[0-9]{4}\/+[0-9]{2}\/+[0-9]+\/+)image[0-9]+x[0-9]+(?:cropped)?(\.[^/.]*)$/, "$1image$2");
		}

		if (domain === "rimg.bookwalker.jp") {
			// thanks to NotLemon at https://github.com/qsniyg/maxurl/issues/17
			// https://rimg.bookwalker.jp/7759762/frDGCemG5kX9EBY8IrbThQ__.jpg
			//   https://c.bookwalker.jp/7759762/t_700x780.jpg
			// thanks to anonymous for reporting. wrong image:
			// https://global.bookwalker.jp/defa90cb2a-319e-4fc9-8cb5-5ee27d865c57/
			// https://rimg.bookwalker.jp/5585902/OWWPXNVne2Og5o9nA6tp3Q__.jpg
			//  https://c.bookwalker.jp/coverImage_2095854.jpg
			//return src.replace(/:\/\/[^/]*\/([0-9]+)\/[0-9a-zA-Z_]+(\.[^/.]*)$/, "://c.bookwalker.jp/$1/t_700x780$2");
			// thanks to neckothy on github: https://github.com/qsniyg/maxurl/issues/1255
			// https://rimg.bookwalker.jp/7f15ef05f2e9179c2b450fa9f583cc3/BM2j7K0aiKyzud2kfkni6g__.jpg
			//   https://c.bookwalker.jp/7f15ef05f2e9179c2b450fa9f583cc3/t_700x780.jpg
			// thanks to anonymous for reporting:
			// https://rimg.bookwalker.jp/f29ec27d2a5573bd314c1e68076f37e/eUnObgIVNjRTJtVUNQrbaQ__.jpg
			//   https://c.bookwalker.jp/f29ec27d2a5573bd314c1e68076f37e/t_700x780.jpg
			// https://rimg.bookwalker.jp/0e4eef97094418a15740146e31e11dc/OWWPXNVne2Og5o9nA6tp3Q__.jpg
			//   https://c.bookwalker.jp/0e4eef97094418a15740146e31e11dc/t_700x780.jpg
			// https://rimg.bookwalker.jp/81034a5f918ca2b2cb4aa40e304c81b/WYSt3oZAsOZeWLNOG6XDcw__.jpg
			//   https://c.bookwalker.jp/81034a5f918ca2b2cb4aa40e304c81b/t_700x780.jpg
			return src.replace(/:\/\/[^/]+\/+([0-9a-f]{30,}\/+)(?:BM2j7K0aiKyzud2kfkni6g__|eUnObgIVNjRTJtVUNQrbaQ__|OWWPXNVne2Og5o9nA6tp3Q__|WYSt3oZAsOZeWLNOG6XDcw__)\./, "://c.bookwalker.jp/$1t_700x780.");
		}

		if (domain === "c.bookwalker.jp") {
			// thanks to NotLemon at https://github.com/qsniyg/maxurl/issues/17
			// https://c.bookwalker.jp/7759762/t_700x780.jpg
			//   https://c.bookwalker.jp/coverImage_2679576.jpg
			// https://c.bookwalker.jp/2247491/t_700x780.jpg
			//   https://c.bookwalker.jp/coverImage_1947421.jpg
			match = src.match(/:\/\/[^/]*\/([0-9]+)\/[^/]*(?:[?#].*)?$/);
			if (match) {
				var number = match[1];
				var reversed_number = parseInt(reverse_str(number)) - 1;
				return "https://c.bookwalker.jp/coverImage_" + reversed_number + src.replace(/.*(\.[^/.?#]*)(?:[?#].*)?$/, "$1");
			}
		}

		if (domain === "taiwan-image.bookwalker.com.tw") {
			// thanks to Froktime on github: https://github.com/qsniyg/maxurl/issues/1285
			// https://taiwan-image.bookwalker.com.tw/product/189836/189836_1.jpg
			//   https://taiwan-image.bookwalker.com.tw/product/189836/189836.jpg
			// https://taiwan-image.bookwalker.com.tw/product/186041/186041_1_mask.jpg
			//   https://taiwan-image.bookwalker.com.tw/product/186041/186041.jpg
			return src.replace(/(\/product\/+[0-9]+\/+[0-9]+)_[0-9]+(?:_mask)?\./, "$1.");
		}

		if (domain === "images.cdn.circlesix.co") {
			// https://images.cdn.circlesix.co/image/1/700/0/uploads/articles/subaru_coloni_f1_03-54e4e95ecb141.jpg
			//   https://images.cdn.circlesix.co/image/uploads/articles/subaru_coloni_f1_03-54e4e95ecb141.jpg
			return src.replace(/\/image\/(?:[0-9]+\/){3}uploads\//, "/image/uploads/");
		}

		if (domain === "static.japanhdv.com") {
			// https://static.japanhdv.com/cache/actress/airi-tachibana.270x480.jpg
			//   https://static.japanhdv.com/actress/airi-tachibana.jpg
			return src.replace(/(:\/\/[^/]*\/)cache\/(.*)\.[0-9]+x[0-9]+(\.[^/.]*)$/, "$1$2$3");
		}

		if (domain === "image.gala.de") {
			// https://image.gala.de/v1/cms/zU/helene-kathrin-ge_7589848-portrait-article_4col_fix_width.jpg?v=9918049
			//   https://image.gala.de/v1/cms/zU/helene-kathrin-ge_7589848-original-lightbox.jpg?v=9918049
			// https://image.gala.de/21569996/uncropped-620-902/a8b54e6d93eca3571be4fb63ce5d2672/yU/margot-robbie-914624434.jpg
			//   https://www.gala.de/resource/blob/21569996/a8b54e6d93eca3571be4fb63ce5d2672/margot-robbie-914624434-data.jpg
			// https://image.gala.de/22036708/2x3-300-450/662fce616873c97e64415a69eeaa7604/XL/a91z4760-20190331121737047.jpg
			//   https://www.gala.de/resource/blob/22036708/662fce616873c97e64415a69eeaa7604/a91z4760-20190331121737047-data.jpg
			// https://image.gala.de/21968034/large1x1-300-300/9eaf47021176b4bb141998386e94146f/yV/nelly-furtado-teaser.jpg
			//   https://www.gala.de/resource/blob/21968034/9eaf47021176b4bb141998386e94146f/nelly-furtado-teaser-data.jpg
			// thanks to anonymous for reporting:
			// https://image.gala.de/22036884/t/-u/v4/w2048/r0.6667/-/goldene-kamera-katie-melua.jpg -- upscaled
			//   https://www.gala.de/resource/blob/22036884/-/goldene-kamera-katie-melua-data.jpg -- 1365x2048
			return src
				.replace(/(:\/\/[^/]*\/v[0-9]*\/cms\/[^/]*\/[^/]*_[0-9]+-)[a-z]+[-_][^/]*(\.[^/.]*)$/, "$1original-lightbox$2")
				.replace(/:\/\/[^/]*\/+([0-9]+)\/+(?:[a-z]+)?(?:uncropped|[0-9]+x[0-9]+)-[0-9]+-[0-9]+\/([0-9a-f]{20,})\/+[^/]*\/+([^/]*)(\.[^/.]*)(?:[?#].*)?$/, "://www.gala.de/resource/blob/$1/$2/$3-data$4")
				.replace(/:\/\/[^/]+\/+([0-9]+)\/+.*?\/+([0-9a-f]{10,}|-)\/+([^/.?#]+)(\.[^/]+)(?:[?#].*)?$/, "://www.gala.de/resource/blob/$1/$2/$3-data$4");
		}

		if (domain_nosub === "fashionwelike.com" &&
			domain.match(/^static[0-9]*\./)) {
			// http://static2.fashionwelike.com/interviews/photos/thumbnail/Pixie_Lott_2.jpg?1477838134
			//   http://static2.fashionwelike.com/interviews/photos/original/Pixie_Lott_2.jpg?1477838134
			return src.replace(/\/photos\/thumbnail\//, "/photos/original/");
		}

		if (domain === "images.metmuseum.org") {
			// https://images.metmuseum.org/CRDImages/rl/web-large/SLP0129.jpg
			//   https://images.metmuseum.org/CRDImages/rl/original/SLP0129.jpg
			return src.replace(/(\/CRDImages\/+[^/]*\/+)[^/]*\/+/, "$1original/");
		}

		if (domain === "images-assets.nasa.gov") {
			// https://images-assets.nasa.gov/image/PIA18139/PIA18139~thumb.jpg
			//   https://images-assets.nasa.gov/image/PIA18139/PIA18139~orig.jpg
			// doesn't work for all:
			// https://images-assets.nasa.gov/image/GRC-2019-C-11993/GRC-2019-C-11993~large.jpg
			//   https://images-assets.nasa.gov/image/GRC-2019-C-11993/GRC-2019-C-11993~orig.jpg -- 403
			return src.replace(/~[a-z]+(\.[^/.]*)$/, "~orig$1");
		}

		if (domain_nowww === "jpl.nasa.gov") {
			// https://www.jpl.nasa.gov/spaceimages/images/largesize/PIA18874_hires.jpg
			//   https://images-assets.nasa.gov/image/PIA18874/PIA18874~orig.jpg
			// https://www.jpl.nasa.gov/spaceimages/images/wallpaper/PIA23572-640x350.jpg
			//   https://photojournal.jpl.nasa.gov/jpeg/PIA23572.jpg
			// https://www.jpl.nasa.gov/spaceimages/images/wallpaper/PIA02821-1920x1200.jpg
			//   https://photojournal.jpl.nasa.gov/jpeg/PIA02821.jpg
			//return src.replace(/:\/\/[^/]+\/+spaceimages\/+images\/+[^/]+\/+(PIA[0-9]+)(?:_[^/]+|-[0-9]+x[0-9]+)(\.[^/.]*)(?:[?#].*)?$/,
			//				   "://images-assets.nasa.gov/image/$1/$1~orig$2");
			return src.replace(/:\/\/[^/]+\/+spaceimages\/+images\/+[^/]+\/+(PIA[0-9]+)(?:_[^/]+|-[0-9]+(?:x[0-9]+|[wh]))(\.(?:jpg|jpeg|JPG|JPEG))(?:[?#].*)?$/,
							   "://photojournal.jpl.nasa.gov/jpeg/$1$2");
		}

		if (domain === "imagecache.jpl.nasa.gov") {
			// https://imagecache.jpl.nasa.gov/images/640x350/PIA21642-16-640x350.jpg
			//   https://photojournal.jpl.nasa.gov/jpeg/PIA21642.jpg
			match = src.match(/:\/\/[^/]+\/+images\/+[0-9]+x[0-9]+\/+(?:pia|PIA)([0-9]+)-[0-9]+-[0-9]+x[0-9]+\./);
			if (match) {
				return "https://photojournal.jpl.nasa.gov/jpeg/PIA" + match[1] + ".jpg";
			}
		}

		if (domain === "solarsystem.nasa.gov") {
			// https://solarsystem.nasa.gov/system/resources/detail_files/17771_PIA21345-800w.jpg
			//   https://photojournal.jpl.nasa.gov/jpeg/PIA21345.jpg
			//   https://solarsystem.nasa.gov/resources/17771/so-far-from-home/
			//   https://solarsystem.nasa.gov/system/downloadable_items/2563_PIA21345-full.tif
			//   https://solarsystem.nasa.gov/system/resources/detail_files/17771_PIA21345-full.jpg -- doesn't work
			// https://solarsystem.nasa.gov/system/resources/detail_files/17813_PIA17218_figA_MAIN.jpg
			//   https://photojournal.jpl.nasa.gov/jpeg/PIA17218.jpg
			// https://solarsystem.nasa.gov/system/resources/detail_files/17823_PIA21897-full.jpeg
			//   https://photojournal.jpl.nasa.gov/jpeg/PIA21897.jpg
			// https://solarsystem.nasa.gov/system/resources/list_images/16120_PIA18295.jpg_320x240.png
			//   https://photojournal.jpl.nasa.gov/jpeg/PIA18295.jpg
			// https://solarsystem.nasa.gov/system/resources/detail_files/17678_PIA21448.jpg
			//   https://photojournal.jpl.nasa.gov/jpeg/PIA21448.jpg
			// https://solarsystem.nasa.gov/system/news_items/main_images/317_pia21977_short.jpg
			//   https://photojournal.jpl.nasa.gov/jpeg/PIA21977.jpg
			// other:
			// https://solarsystem.nasa.gov/system/resources/list_images/897_KSC-71P-0354_320.jpg
			//   https://solarsystem.nasa.gov/system/resources/detail_files/897_KSC-71P-0354.jpg
			//   https://solarsystem.nasa.gov/system/downloadable_items/1241_KSC-71P-0354.jpg
			//   https://solarsystem.nasa.gov/resources/897/mariner-9-launch/
			return src.replace(/:\/\/[^/]+\/+system\/+(?:resources|news_items)\/+(?:detail_files|(?:list|main)_images)\/+[0-9]+_(?:pia|PIA)([0-9]+)(?:_[a-z]+)?(?:\.[^/.]+_[^/]+|[-_][^/]+)?\.[^/.]+(?:[?#].*)?$/,
								"://photojournal.jpl.nasa.gov/jpeg/PIA$1.jpg");
		}

		if (domain === "photojournal.jpl.nasa.gov") {
			obj = {url: src};
			// https://photojournal.jpl.nasa.gov/jpeg/PIA23572.jpg
			//   https://www.jpl.nasa.gov/spaceimages/details.php?id=PIA23572
			id = src.replace(/.*\/(PIA[0-9]+)(?:_[^/]+)?\.[^/.]+(?:[?#].*)?$/, "$1");

			if (id !== src) {
				obj.extra = {
					page: "https://www.jpl.nasa.gov/spaceimages/details.php?id=" + id
				};
			}

			// https://photojournal.jpl.nasa.gov/jpegMod/PIA09352_modest.jpg
			//   https://photojournal.jpl.nasa.gov/jpeg/PIA09352.jpg
			newsrc = src.replace(/(:\/\/[^/]+\/+)jpegMod\/+([^/]+)_modest\./, "$1jpeg/$2.");
			if (newsrc !== src) {
				obj.url = newsrc;
				return obj;
			}

			// https://photojournal.jpl.nasa.gov/browse/PIA09352.jpg
			//   https://photojournal.jpl.nasa.gov/jpeg/PIA09352.jpg
			// https://photojournal.jpl.nasa.gov/thumb/PIA09352.jpg
			//   https://photojournal.jpl.nasa.gov/jpeg/PIA09352.jpg
			newsrc = src.replace(/(:\/\/[^/]+\/+)(?:browse|thumb)\/+/, "$1jpeg/");
			if (newsrc !== src) {
				obj.url = newsrc;
				return obj;
			}

			return obj;
		}

		if (domain === "nssdc.gsfc.nasa.gov") {
			obj = {url: src};

			// https://nssdc.gsfc.nasa.gov/imgcat/html/object_page/vg1_p21287.html
			id = src.match(/\/imgcat\/+[^/]+res\/+(vg[0-9]*_p[0-9]+)\./);
			if (id) {
				obj.extra = {page: "https://nssdc.gsfc.nasa.gov/imgcat/html/object_page/" + id[1] + ".html"};
			}

			// https://nssdc.gsfc.nasa.gov/imgcat/midres/vg1_p21287.gif
			//   https://nssdc.gsfc.nasa.gov/imgcat/hires/vg1_p21287.gif
			newsrc = src.replace(/(\/imgcat\/+)midres\/+/, "$1hires/");
			if (newsrc !== src) {
				obj.url = newsrc;
				return obj;
			}

			return obj;
		}

		if (amazon_container === "attachments.readmedia.com") {
			// https://s3.amazonaws.com/attachments.readmedia.com/files/99789/medium/13._Halina_Reijn_and_Jude_Law_in_Obsession_at_the_Barbican_Theatre._Photo_by_Jan_Versweyveld.jpg?1511195599
			//   https://s3.amazonaws.com/attachments.readmedia.com/files/99789/original/13._Halina_Reijn_and_Jude_Law_in_Obsession_at_the_Barbican_Theatre._Photo_by_Jan_Versweyveld.jpg?1511195599
			return src.replace(/(\/+files\/+[0-9]+\/+)[a-z]+\/+([^/]*)(?:[?#].*)?$/, "$1original/$2");
		}

		if (domain === "files.sexyandfunny.com") {
			// https://files.sexyandfunny.com/img_disp/2/img5b908dc1bbd17.jpg
			//   https://files.sexyandfunny.com/img_orig/2/img5b908dc1bbd17.jpg
			// https://files.sexyandfunny.com/gallery_thumbs/2/img5c707d6a61659.jpg
			//   https://files.sexyandfunny.com/img_orig/2/img5c707d6a61659.jpg
			return src.replace(/\/(?:img|gallery)_[a-z]+\//, "/img_orig/");
		}

		if (domain === "mb.cision.com") {
			// http://mb.cision.com/Public/56/2533153/95d7520c43d9bf6a_400x400ar.jpg
			//   http://mb.cision.com/Public/56/2533153/95d7520c43d9bf6a_org.jpg
			return src.replace(/(\/Public\/+[0-9]+\/+[0-9]+\/+[0-9a-f]+)_[^/_]*(\.[^/.]*)$/, "$1_org$2");
		}

		if (domain_nowww === "ftvmagic.com") {
			// https://ftvmagic.com/wp-content/grand-media/image/thumb/1005_5.jpg
			//   https://ftvmagic.com/wp-content/grand-media/image/1005_5.jpg
			// https://ftvmagic.com/post_pics/2018/06/03004-585x389.jpg
			//   https://ftvmagic.com/post_pics/2018/06/03004.jpg
			// http://ftvmagic.com/post_pics/2014/08/107_thumb.jpg
			//   http://ftvmagic.com/post_pics/2014/08/107.jpg
			return src
				.replace(/(\/+grand-media\/+image\/+)thumb\//, "$1")
				.replace(/-[0-9]+x[0-9]+(\.[^/.]*)$/, "$1")
				.replace(/(\/post_pics\/+[0-9]+\/+[0-9]+\/+[0-9]+)_thumb(\.[^/.]*)$/, "$1$2");
		}

		if (domain_nowww === "wdb.space" ||
			// https://onlythere.com/media/2018-9-26/wVWMCNcZ7Z_scale_500x1200.jpg
			//   https://onlythere.com/media/2018-9-26/wVWMCNcZ7Z.jpg
			domain_nowww === "onlythere.com") {
			// https://wdb.space/media/2016-6-7/_HpTtKNB2W_scale_300x500.jpg
			//   https://wdb.space/media/2016-6-7/_HpTtKNB2W.jpg
			return src.replace(/(\/media\/[^/]*\/[^/]*)_scale_[0-9]+x[0-9]+(\.[^/.]*)$/, "$1$2");
		}

		if (domain_nowww === "iphone8wallpapers.com" && string_indexof(src, "/media/uploads/") >= 0) {
			// https://iphone8wallpapers.com/media/uploads/2017/08/Barbara-Palvin-Dark-Model-Cute-300x533.jpg
			//   https://iphone8wallpapers.com/media/uploads/2017/08/Barbara-Palvin-Dark-Model-Cute.jpg
			return {
				url: src.replace(/-[0-9]+x[0-9]+(\.[^/.]*)$/, "$1"),
				headers: {
					Referer: src.replace(/(:\/\/[^/]*\/).*/, "$1") // works without, but adds a "click here full resolution, no hotlinking" watermark
				}
			};
		}

		if (domain === "upload.sanqin.com" ||
			// http://upload.mnw.cn/2016/0613/thumb_100__1465813162707.jpg
			domain === "upload.mnw.cn") {
			// http://upload.sanqin.com/2017/0103/thumb_228__1483406299511.jpg
			//   http://upload.sanqin.com/2017/0103/1483406299511.jpg
			return src.replace(/\/thumb_[0-9]+__([^/]*)(?:[?#]*.*)?$/, "/$1");
		}

		if (domain_nosub === "best-wallpaper.net") {
			// https://best-wallpaper.net/Barbara-Palvin-01_wallpapers.html
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+([^/?#]+)_wallpapers\.html(?:[?#].*)?$/,
				query_for_id: "https://best-wallpaper.net/${id}_wallpapers.html",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/<img ID="viewImg"[^>]*data-src="([^">]*)"/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

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

		if (domain_nosub === "best-wallpaper.net") {
			// https://best-wallpaper.net/Barbara-Palvin-01_wallpapers.html
			// https://best-wallpaper.net/wallpaper/m/1205/Barbara-Palvin-01_m.jpg
			//   https://best-wallpaper.net/wallpaper/1920x1200/1205/Barbara-Palvin-01_1920x1200.jpg
			// https://kr.best-wallpaper.net/wallpaper/m/1301/Girls-Generation-Taeyeon_m.jpg
			//   https://kr.best-wallpaper.net/wallpaper/1920x1200/1301/Girls-Generation-Taeyeon_1920x1200.jpg
			// https://kr.best-wallpaper.net/wallpaper/s/1301/The-forest-anime-girl-sitting-on-the-green-grass-red-dress_s.jpg
			//   https://kr.best-wallpaper.net/wallpaper/1920x1080/1301/The-forest-anime-girl-sitting-on-the-green-grass-red-dress_1920x1080.jpg
			match = src.match(/\/wallpaper\/+[^/]+\/[0-9]+\/([^/]*)_[^-_/.]+\.[^/.]*$/);
			if (match) {
				return {
					url: "https://best-wallpaper.net/" + match[1] + "_wallpapers.html",
					is_pagelink: true
				};
			}
		}

		if (domain_nosub === "trueart.com" &&
			domain.match(/^s[0-9]*\./)) {
			// http://s1.trueart.com/20161222/011726940_640.jpg
			//   http://s1.trueart.com/20161222/011726940.jpg
			return src.replace(/(\/[0-9]+)_[0-9]+(\.[^/.]*)$/, "$1$2");
		}

		if (domain_nowww === "atkfan.com") {
			// https://atkfan.com/atk-exotics/sasha/2010-07-07_f6a/thumbs/atk-exotics-sasha-bleu-007_140.jpg
			//   https://atkfan.com/atk-exotics/sasha/2010-07-07_f6a/set/atk-exotics-sasha-bleu-007.jpg
			return src.replace(/\/thumbs(\/[^/]*)_[0-9]+(\.[^/.]*)$/, "/set$1$2");
		}

		if (domain === "imbbsfile.imbc.com") {
			// http://imbbsfile.imbc.com/drama07/hideandseek_photo/201810/thnb_hideandseek_photo181026114501imbcdrama10.jpg
			//   http://imbbsfile.imbc.com/drama07/hideandseek_photo/201810/hideandseek_photo181026114501imbcdrama10.jpg
			return src.replace(/\/thnb_([^/]*\.[^/.]*)(?:[?#].*)?$/, "/$1");
		}

		if (domain_nowww === "hdwall.us") {
			// http://hdwall.us/thumbnail-small/jessica_stroup_desktop_1067x1600_hd-wallpaper-997205.jpg
			//   http://hdwall.us/wallpaper/jessica_stroup_desktop_1067x1600_hd-wallpaper-997205.jpg
			// works, but adds watermark, needs a correct cookie to bypass
			return {
				url: src.replace(/(:\/\/[^/]*\/+)(?:wallpaper|thumbnail)[^/]*\/+([^/]*\.[^/.]*)(?:[?#].*)?$/, "$1wallpaper/$2"),
				problems: {
					watermark: true
				}
			};
		}

		if (domain === "thmbs.baklol.com") {
			// https://thmbs.baklol.com/Tori-Black0842210141469530776.jpg
			//   https://images.baklol.com/Tori-Black0842210141469530776.jpg
			return src.replace(/:\/\/thmbs\./, "://images.");
		}

		if (domain_nowww === "svtstatic.se") {
			// thanks to TheLovinator1 on github: https://github.com/qsniyg/maxurl/issues/18
			// https://www.svtstatic.se/image/cinema/760/19912234/1541383772?quality=70&format=auto
			//   https://www.svtstatic.se/image/original/unscaled/19912234/1541383772.jpg?quality=10
			//   https://www.svtstatic.se/image/original/unscaled/19912234/1541383772.png
			return {
				url: src.replace(/\/image\/+[^/]*\/+[^/]*\/+([0-9]+\/+[0-9]+)(?:\.[^/?#]*)?(?:[?#].*)?$/,
								 "/image/original/unscaled/$1.png"),
								 //"/image/original/unscaled/$1?quality=100"),
				head_wrong_contentlength: true
			};
		}

		if (domain === "thmb.inkfrog.com" ||
			amazon_container === "thmb.inkfrog.com") {
			// https://thmb.inkfrog.com/thumbn/mcmotoparts/MC-OC-ALL.jpg=450
			//   https://s3.amazonaws.com/thmb.inkfrog.com/pix/mcmotoparts/MC-OC-ALL.jpg/450/0
			//   https://imgs.inkfrog.com/pix/mcmotoparts/MC-OC-ALL.jpg
			return src
				.replace(/^[a-z]+:\/\/.*\/+thumb[^/]*\/+([^/]*\/+[^/]*\.[^/.=]*)(?:=[0-9]+)?(?:[?#].*)?$/,
						 "https://imgs.inkfrog.com/pix/$1")
				.replace(/^[a-z]+:\/\/.*\/+pix\/+([^/]*\/+[^/]*\.[^/.]*)\/+[0-9]+\/+[0-9]+(?:[?#].*)?$/,
						 "https://imgs.inkfrog.com/pix/$1");
		}

		if (domain_nosub === "xnostars.com" &&
			domain.match(/^img[0-9]*\./)) {
			// https://img2.xnostars.com/fotos/bree-daniels-desnudandose-ensenando-conito/thumbs/bree-daniels-desnudandose-ensenando-conito-09.jpg
			//   https://img2.xnostars.com/fotos/bree-daniels-desnudandose-ensenando-conito/bree-daniels-desnudandose-ensenando-conito-09.jpg
			return src.replace(/(\/fotos\/+[^/]*)\/+thumbs\/+/, "$1/");
		}

		if (domain_nowww === "mobilmusic.ru") {
			// http://www.mobilmusic.ru/mfile/a2/2c/c0/1121995-320.jpg
			//   http://www.mobilmusic.ru/mfile/a2/2c/c0/1121995.jpg
			return src.replace(/(\/mfile\/+[0-9a-f]{2}\/+[0-9a-f]{2}\/+[0-9a-f]{2}\/+[0-9]+)-[0-9]+(\.[^/.]*)$/,
							   "$1$2");
		}

		if (domain === "pics.definebabe.com") {
			// http://pics.definebabe.com/66/3/2/5/5/6/2/thumbs/thumb_01.jpg
			//   http://pics.definebabe.com/66/3/2/5/5/6/2/01.jpg
			return src.replace(/\/thumbs\/+thumb_([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/$1");
		}

		if (domain_nosub === "definebabe.com" &&
			domain.match(/^cdn-i[0-9]+\./)) {
			// http://cdn-i30.definebabe.com/_idb/g/85/09/04/2f3d38b916/g300/01.jpg
			//   http://cdn-i30.definebabe.com/_idb/g/85/09/04/2f3d38b916/01.jpg
			// http://cdn-i30.definebabe.com/_idb/g/62/09/13/149ec29c7b/300/01.jpg
			//   http://cdn-i30.definebabe.com/_idb/g/62/09/13/149ec29c7b/01.jpg
			return src.replace(/(\/+[0-9a-f]+\/+)[a-z]?[0-9]+\/+((?:[^/]*-)?[0-9]+\.[^/.]*)$/, "$1$2");
		}

		if (amazon_container === "everipedia-storage") {
			// https://everipedia-storage.s3.amazonaws.com/NewlinkFiles/66307/2609275_250x250.png -- upscaled
			//   https://everipedia-storage.s3.amazonaws.com/NewlinkFiles/66307/2609275.jpg
			// https://everipedia-storage.s3.amazonaws.com/NewlinkFiles/370585/b0994f48-c/pp1_250x250.png
			//   https://everipedia-storage.s3.amazonaws.com/NewlinkFiles/370585/b0994f48-c/pp1.PNG
			return add_extensions_upper(src.replace(/(\/NewlinkFiles\/+[0-9]+\/+(?:[^/]*\/+)?[^/]+)_[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2"));
		}

		if (domain_nowww === "w-dog.pw" ||
			domain_nowww === "w-dog.net") {
			// https://w-dog.pw/img/256x160.png
			if (/:\/\/[^/]+\/+img\/+[0-9]+x[0-9]+.[^/.]+(?:[?#].*)?$/.test(src))
				return {
					url: src,
					bad: "mask"
				};

			// https://w-dog.pw/android-wallpapers/14/1/small/376931931759663.jpg
			//   https://w-dog.pw/android-wallpapers/14/1/376931931759663/girl-sexy-woman-elf-haneto.jpg
			// https://w-dog.net/wallpapers/4/6/small/410103763265343.jpg
			//   https://w-dog.net/wallpapers/4/6//410103763265343.jpg
			return src.replace(/(\/(?:android-)?wallpapers\/+[0-9]+\/+[0-9]+)\/+[a-z]+(\/[0-9]+\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain_nosub === "wsimg.com" &&	/^i(?:mg[0-9]*|steam)\./.test(domain)) {
			// thanks to rahidz on github: https://github.com/qsniyg/maxurl/issues/21
			// https://img1.wsimg.com/isteam/ip/84d1b722-4195-4c8a-993f-be0ddc84a927/4b9436b1-b3d3-4e13-9fba-533e632780d2.jpg/:/rs=w:400,h:500,cg:true,m/cr=w:800,h:500,a:cc
			//   https://img1.wsimg.com/isteam/ip/84d1b722-4195-4c8a-993f-be0ddc84a927/4b9436b1-b3d3-4e13-9fba-533e632780d2.jpg
			// https://img1.wsimg.com/isteam/ip/6094a1a0-2862-477f-b6f6-e2fafdfc712b/1f5bbd28-abc4-46ab-a7e1-76c7f5f34b1e.jpg/:/rs=w:400,h:500,cg:true,m/cr=w:800,h:500,a:cc
			//   https://img1.wsimg.com/isteam/ip/6094a1a0-2862-477f-b6f6-e2fafdfc712b/1f5bbd28-abc4-46ab-a7e1-76c7f5f34b1e.jpg
			//   https://img1.wsimg.com/isteam/ip/6094a1a0-2862-477f-b6f6-e2fafdfc712b/1f5bbd28-abc4-46ab-a7e1-76c7f5f34b1e.jpg/:/rs=w:9999,h:9999,cg:true,m/cr=w:9999,h:9999,a:cc -- stretched
			// thanks to anonymous for reporting:
			// http://isteam.wsimg.com/ip/c7221d30-bf96-4b46-a3ac-64d3401f6b75/ols/16939_original/:/rs=w:600,h:600
			//   http://isteam.wsimg.com/ip/c7221d30-bf96-4b46-a3ac-64d3401f6b75/ols/16939_original
			// thanks to anonymous for reporting:
			// https://img1.wsimg.com/isteam/stock/8038/:/rs=w:1300,h:800
			//   https://img1.wsimg.com/isteam/stock/8038
			// thanks to anonymous for reporting:
			// https://img1.wsimg.com/isteam/stock/yREJBbw/:/cr=t:12.47%25,l:0%25,w:100%25,h:75.06%25/rs=w:388,h:194,cg:true
			//   https://img1.wsimg.com/isteam/stock/yREJBbw
			return src.replace(/(\/+ip\/+[-0-9a-f]+\/+(?:ols\/+)?[^/]*|\/isteam\/+stock\/+[a-zA-Z0-9]+)(?:\/+:\/+.*)?(?:[?#].*)?$/, "$1");
		}

		if (domain === "img.lovpho.com") {
			// http://img.lovpho.com/anh/width248/2015/22-12/wallets-in-check-embossed-leather-autumn-winter-2014-accessories-accessories-womenfashion-women-s-handbags-burberry-wallets-2014-accessories-check-embossed-leather-haute-handbags-wallets-autumn-winter.jpg
			//   http://img.lovpho.com/anh/2015/22-12/wallets-in-check-embossed-leather-autumn-winter-2014-accessories-accessories-womenfashion-women-s-handbags-burberry-wallets-2014-accessories-check-embossed-leather-haute-handbags-wallets-autumn-winter.jpg
			return src.replace(/\/+anh\/+(?:width|height)[0-9]+\//, "/anh/");
		}

		if (domain_nowww === "divnil.com") {
			// https://divnil.com/wallpaper/iphone/img/app/m/o/mona-lisa-iphone-wallpaper_051a713a4196a915fe1c35aeaa7385ba_s.jpg
			//   https://divnil.com/wallpaper/iphone/img/app/m/o/mona-lisa-iphone-wallpaper_051a713a4196a915fe1c35aeaa7385ba_raw.jpg
			return src.replace(/(\/wallpaper\/.*_[0-9a-f]+_)[a-z]+(\.[^/.]*)$/, "$1raw$2");
		}

		if (domain === "images.dbnaked.com") {
			// http://images.dbnaked.com/general/zebragirls/123595_zebra-girls-free-porn-gallery-set-102/thumb_1.jpg
			//   http://images.dbnaked.com/general/zebragirls/123595_zebra-girls-free-porn-gallery-set-102/1.jpg
			return src.replace(/\/thumb_(?:[0-9]+x[0-9]+_)?([0-9]+\.[^/.]*)$/, "/$1");
		}

		if (domain === "img.iseephoto.com") {
			// http://img.iseephoto.com/files/photos/thumes/2016/07/beautiful-anime-art-1.jpg
			//   http://img.iseephoto.com/files/photos/2016/07/beautiful-anime-art-1.jpg
			return src.replace(/(\/+files\/+[^/]*\/+)thumes\/+/, "$1");
		}

		if (domain === "media.elle.gr") {
			// http://media.elle.gr/filesystem/images/20140925/engine/pegasus_LARGE_t_209761_105920824_type11490.jpg
			//   http://engine.numatek.netuse.gr/?imgid=105920824&srcid=209761&type=11491
			//   http://media.elle.gr/filesystem/images/20130211/low/pegasus_LARGE_t_209761_105920824.JPG
			//   http://engine.numatek.netuse.gr/?imgid=105920824&srcid=209761&type=2
			// http://media.elle.gr/filesystem/images/20130211/low/pegasus_LARGE_t_209761_105920856.JPG
			// http://media.elle.gr/filesystem/images/20180326/low/spl1675488-011_209761_107674428.JPG

			// doesn't work, date is different
			//return add_extensions_upper(src.replace(/(\/+filesystem\/+images\/+[0-9]{8}\/+)engine\/+([^/]*?)_type[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1low/$2$3"));
			return src.replace(/.*\/engine\/[^/]*?_([0-9]+)_([0-9]+)(?:_type[0-9]+)?\.[^/.]*(?:[?#].*)?$/,
							   "http://engine.numatek.netuse.gr/?imgid=$2&srcid=$1&type=2");
		}

		if (domain === "engine.numatek.netuse.gr") {
			// http://engine.numatek.netuse.gr/?imgid=107674428&srcid=209761&type=11490
			//   http://engine.numatek.netuse.gr/?imgid=107674428&srcid=209761&type=2
			var queries = get_queries(src);
			if (queries.imgid && queries.srcid) {
				return "http://engine.numatek.netuse.gr/?imgid=" + queries.imgid + "&srcid=" + queries.srcid + "&type=2";
			}
		}

		if (domain === "actualite.benchmark.fr") {
			// http://actualite.benchmark.fr/depeche/imaxtree/images/WOMEN_FW_13-14/NEW_YORK/FULL_LENGTH/DIANE_VON_FURSTENBERG/G/Von_Furstenberg_RF13_0929_diaporama_333x500.jpg
			//   http://actualite.benchmark.fr/depeche/imaxtree/images/WOMEN_FW_13-14/NEW_YORK/FULL_LENGTH/DIANE_VON_FURSTENBERG/G/Von_Furstenberg_RF13_0929.jpg
			return src.replace(/_diaporama_[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1");
		}

		if (domain_nowww === "showstudio.com") {
			// http://showstudio.com/img/images/83001-83200/83072_320n.jpg?1347043962
			//   http://showstudio.com/img/images/83001-83200/83072.jpg?1347043962
			return src.replace(/(\/+img\/+images\/+[0-9]+-[0-9]+\/+[0-9]+)_[^/]*(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "static.trendme.net") {
			// https://static.trendme.net/temp/thumbs/580-480-3-90/Valentino-Hanne-Gaby-Odiele_Catwalk-ValentinoSaab-full-11725-378738.jpg
			//   https://static.trendme.net/pictures/items/Valentino-Hanne-Gaby-Odiele_Catwalk-ValentinoSaab-full-11725-378738.jpg
			// https://static.trendme.net/showThumb.php?src=Valentino-Hanne-Gaby-Odiele_Catwalk-ValentinoSaab-full-11725-378738.jpg&h=132&w=99&zc=2
			//   https://static.trendme.net/showThumb.php?src=Valentino-Hanne-Gaby-Odiele_Catwalk-ValentinoSaab-full-11725-378738.jpg&h=99999999&height=99999999&zc=3 -- 400x600
			//   https://static.trendme.net/pictures/items/Valentino-Hanne-Gaby-Odiele_Catwalk-ValentinoSaab-full-11725-378738.jpg -- 467x700
			// zc = 1 stretches, zc = 2 adds white borders, zc = 3 doesn't crop larger than the image
			newsrc = src.replace(/\/showThumb\.php.*?[?&]src=([^&]*).*?$/, "/showThumb.php?src=$1&h=99999999&height=99999999&zc=3");
			if (newsrc !== src)
				return newsrc;

			return src
				.replace(/\/+temp\/+thumbs\/+[0-9]+-[0-9]+-[0-9]+-[0-9]+\/+/, "/pictures/items/")
				.replace(/\/showThumb\.php.*?[?&]src=([^&]*).*?$/, "/pictures/items/$1");
		}

		if (domain_nowww === "ifairer.com") {
			// http://www.ifairer.com/article_image/small300/ultimate-catwalk-queen-naomi-campbell-1-18073-pic1.jpg
			//   http://www.ifairer.com/article_image/ultimate-catwalk-queen-naomi-campbell-1-18073-pic1.jpg
			return src.replace(/\/+article_image\/+[a-z]+[0-9]+\/+/, "/article_image/");
		}

		if (amazon_container === "khaskhabar") {
			// https://s3-ap-southeast-1.amazonaws.com/khaskhabar/khaskhabarimages/smallimg/img300/cbi-69-1541680469-350402-khaskhabar.jpg
			//   https://s3-ap-southeast-1.amazonaws.com/khaskhabar/khaskhabarimages/img500/cbi-69-1541680469-350402-khaskhabar.jpg
			return src.replace(/\/+khaskhabarimages\/+[a-z]+img\/+img[0-9]+\/+/, "/khaskhabarimages/img500/");
		}

		if (domain === "i.infospesial.net") {
			// http://i.infospesial.net/300x/p/2014/09/4ae21-taeyeon-taetiseo-02.jpg
			//   http://media.infospesial.net/image/p/2014/09/4ae21-taeyeon-taetiseo-02.jpg
			return src.replace(/:\/\/[^/]*\/+[0-9]+x(?:[0-9]+)?\/+p\/+/, "://media.infospesial.net/image/p/");
		}

		if (domain === "nik.bot.nu") {
			// https://nik.bot.nu/t1734370.jpg
			//   https://nik.bot.nu/o1734370.jpg
			return src.replace(/(:\/\/[^/]*\/+)[a-z]([0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1o$2");
		}

		if (domain_nosub === "eyeem.com" &&
			domain.match(/^cdn[0-9]*\./)) {
			// https://cdn5.eyeem.com/thumb/cacfc80ea683d9c2173d93bad4ac8f8275708dee-1426991898/w/500
			// larger widths scale up
			return {
				url: src.replace(/(\/+thumb\/+[0-9a-f]+-[0-9]+\/+).*$/, "$1full"),
				problems: {
					watermark: true
				}
			};
		}

		if (domain === "3c1703fe8d.site.internapcdn.net" ||
			// https://phys.org/newman/csz/news/tmb/2013/jupiter.jpg
			//   https://phys.org/newman/gfx/news/hires/2013/jupiter.jpg
			domain_nowww === "phys.org") {
			// https://3c1703fe8d.site.internapcdn.net/newman/csz/news/800/2017/nasasfleetof.jpg
			//   https://3c1703fe8d.site.internapcdn.net/newman/gfx/news/hires/2017/nasasfleetof.jpg
			// https://3c1703fe8d.site.internapcdn.net/newman/gfx/news/2018/2-tropicalstor.jpg
			//   https://3c1703fe8d.site.internapcdn.net/newman/gfx/news/hires/2018/2-tropicalstor.jpg -- doesn't work
			// https://3c1703fe8d.site.internapcdn.net/newman/csz/news/800/2018/praguezookee.jpg
			//   https://3c1703fe8d.site.internapcdn.net/newman/gfx/news/2018/praguezookee.jpg
			// https://3c1703fe8d.site.internapcdn.net/newman/csz/news/tmb/2018/1-thisphotorel.jpg
			//   https://3c1703fe8d.site.internapcdn.net/newman/gfx/news/2018/1-thisphotorel.jpg
			newsrc = src.replace(/\/newman\/+csz\/+([^/]*)\/+[^/]*\/+([0-9]{4}\/+[^/]*)(?:[?#].*)?$/, "/newman/gfx/$1/$2");
			if (newsrc !== src)
				return newsrc;

			return newsrc.replace(/\/+newman\/+gfx\/+([^/]*)\/+([0-9]{4}\/+[^/]*)(?:[?#].*)?$/,
								  "/newman/gfx/$1/hires/$2");
		}

		if (domain_nowww === "sott.net") {
			// https://www.sott.net/image/s20/416844/large/Storm_Irma.jpg
			//   https://www.sott.net/image/s20/416844/full/Storm_Irma.jpg
			return src.replace(/(\/+image\/+s[0-9]+\/+[0-9]+\/+)[a-z]+\//, "$1full/");
		}

		if (domain_nowww === "fimgs.net") {
			// https://fimgs.net/mdimg/secundar/t.34184.jpg
			//   https://fimgs.net/images/secundar/o.34184.jpg
			// https://fimgs.net/mdimg/perfume/375x500.31629.jpg
			//   https://fimgs.net/images/perfume/o.31629.jpg
			return src.replace(/\/(?:images|mdimg)\/+([^/]*)\/+[^/.]*\.([0-9]+\.[^/.]*)(?:[?#].*)?$/,
							   "/images/$1/o.$2");
		}

		if ((domain_nosub === "ndsstatic.com" ||
			 // https://img.ohmymag.com/article/300/international/l-artiste-a-imagine-emma-watson-en-arielle-dr_e3530583f12d7db92f48f16a4b5040768938e02a.jpg
			 //   https://img.ohmymag.com/article/international/l-artiste-a-imagine-emma-watson-en-arielle-dr_e3530583f12d7db92f48f16a4b5040768938e02a.jpg
			 domain_nosub === "ohmymag.com" ||
			 // https://img.gentside.co.uk/article/480/viral/watch-this-model-s-hilarious-bikini-photoshoot-photobomb_4eabf90d8f61dbb21bd4bbdba9aef24831773340.jpg
			 //   https://img.gentside.co.uk/article/viral/watch-this-model-s-hilarious-bikini-photoshoot-photobomb_4eabf90d8f61dbb21bd4bbdba9aef24831773340.jpg
			 domain_nosub === "gentside.co.uk") &&
			domain.match(/^img[0-9]*\./)) {
			// http://img0.ndsstatic.com/article/620/mathilde-seigner/mathilde-seigner-va-jouer-avec-catherine-frot_c631aafa0dc8efdaf520fe8128ec2cd8e5590d28.jpg
			//   http://img0.ndsstatic.com/article/mathilde-seigner/mathilde-seigner-va-jouer-avec-catherine-frot_c631aafa0dc8efdaf520fe8128ec2cd8e5590d28.jpg
			return src.replace(/(:\/\/[^/]*\/+)article\/+[0-9]+\/+/, "$1article/");
		}

		if (domain_nowww === "stickpng.com") {
			// http://www.stickpng.com/assets/thumbs/580b585b2edbce24c47b25b8.png
			//   http://www.stickpng.com/assets/images/580b585b2edbce24c47b25b8.png
			return src.replace(/\/+assets\/+[a-z]+\/+([0-9a-f]+\.[^/.]*)(?:[?#].*)?$/,
							   "/assets/images/$1");
		}

		if (domain === "media.bizj.us") {
			// content security policy breaks the default chrome image viewer, and the popup
			// http://media.bizj.us/view/img/10161410/megan-fox-20162*300xx2000-2000-0-125.jpg
			//   http://media.bizj.us/view/img/10161410/megan-fox-20162.jpg
			// thanks to anonymous for reporting:
			// https://media.bizj.us/view/img/3768711/thomas-dave-wendys%2A100xx1600-1600-0-67.jpg
			//   https://media.bizj.us/view/img/3768711/thomas-dave-wendys.jpg
			return src.replace(/(\/view\/img\/[0-9]+\/[^/*]*)(?:\*|%2A)[^/.]*(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "assets.becomegorgeous.com") {
			// http://assets.becomegorgeous.com/assets/static.becomegorgeous.com/gallery/thumbs/thumb_isabellucashairstyles_curlyhairstylewithtwistedbraid.jpg
			//   http://static.becomegorgeous.com/gallery/thumbs/thumb_isabellucashairstyles_curlyhairstylewithtwistedbraid.jpg
			return src.replace(/:\/\/[^/]*\/+assets\/+(static\.becomegorgeous\.com\/)/, "://$1");
		}

		if (domain === "static.becomegorgeous.com") {
			// http://static.becomegorgeous.com/gallery/thumbs/thumb_isabellucashairstyles_curlyhairstylewithtwistedbraid.jpg
			//   http://static.becomegorgeous.com/gallery/pictures/isabellucashairstyles_curlyhairstylewithtwistedbraid.jpg
			return src.replace(/\/+gallery\/+thumbs\/+thumb_/, "/gallery/pictures/");
		}

		if (domain_nowww === "styleslum.com") {
			// http://styleslum.com/page/piper-perabo-dress-plays-with-convention-on-the-red-carpet/main_image_thumbs/piper-perabo-dress.jpg.thumb_60_width.jpg
			//   http://styleslum.com/page/piper-perabo-dress-plays-with-convention-on-the-red-carpet/main_image/piper-perabo-dress.jpg
			return src.replace(/\/+main_image_thumbs\/+([^/]*\.[^/.]*)\.thumb_[^/.]*\.[^/.]*(?:[?#].*)?$/, "/main_image/$1");
		}

		if (domain_nowww === "sideshowtoy.com") {
			// https://www.sideshowtoy.com/assets/products/200461-evil-lyn/th/masters-of-the-universe-evil-lyn-statue-200461-16.jpg
			//   https://www.sideshowtoy.com/assets/products/200461-evil-lyn/lg/masters-of-the-universe-evil-lyn-statue-200461-16.jpg
			return src.replace(/(\/+assets\/+products\/+[0-9]+-[^/]*\/+)[a-z]+\/+/, "$1lg/");
		}

		if (domain_nowww === "suwalls.com") {
			// https://suwalls.com/cars/top-view-of-a-2016-mercedes-benz-slc-300-with-open-doors-54147
			// https://suwalls.com/cars/top-view-of-a-2016-mercedes-benz-slc-300-with-open-doors
			// https://suwalls.com/54147
			newsrc = website_query({
				website_regex: [
					/^[a-z]+:\/\/[^/]+\/+([^/]+\/+[^/]+)\/*(?:[?#].*)?$/,
					/^[a-z]+:\/\/[^/]+\/+([0-9]+)(?:[?#].*)?$/
				],
				query_for_id: "https://suwalls.com/${id}",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/<a[^>]* href="(https?:\/\/cdn\.suwalls\.com\/+wallpapers\/+[^">]*)"[^>]*>\s*<img/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					return done(match[1], 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "cdn.suwalls.com") {
			// https://cdn.suwalls.com/_media/styles/default2/images/star1.png
			if (/\/_media\/+styles\/+default[0-9]*\/+images\/+star[0-9]*\./.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}

			// https://cdn.suwalls.com/_media/users_40x40/1/Lol_woW.jpg
			//   https://cdn.suwalls.com/_media/users/1/Lol_woW.jpg -- doesn't work anymore
			newsrc = src.replace(/\/+_media\/+users_[0-9]+x[0-9]+\/+/, "/_media/users/");
			if (false && newsrc !== src) return newsrc;

			// https://cdn.suwalls.com/wallpapers/cars/top-view-of-a-2016-mercedes-benz-slc-300-with-open-doors-54147-400x250.jpg
			//   https://cdn.suwalls.com/wallpapers/cars/top-view-of-a-2016-mercedes-benz-slc-300-with-open-doors-54147-3840x2160.jpg -- forces download
			match = src.match(/.*\/+wallpapers\/+[^/]+\/+[^/]*-([0-9]+)-[0-9]+x[0-9]+\.[^/.]*(?:[?#].*)?$/);
			if (match) {
				return {
					url: "https://suwalls.com/" + match[1],
					is_pagelink: true
				};
			}
		}

		if (domain_nowww === "japanator.com") {
			// https://www.japanator.com//ul/33041-/29-220x.jpg
			//   https://www.japanator.com//ul/33041-/29.jpg
			return src.replace(/(\/+ul\/+[0-9]+-\/+[0-9]+)-[0-9]+x(?:[0-9]+)?(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "cs.mg.co.za") {
			// https://cs.mg.co.za/crop/content/images/2018/11/15/HCZphjjRTqFZeCLv6PeR_Lufuno_Mphaphuli.jpg/500x281/
			//   https://cs.mg.co.za/content/images/2018/11/15/HCZphjjRTqFZeCLv6PeR_Lufuno_Mphaphuli.jpg
			return src.replace(/\/+crop\/+(content\/+images\/+[0-9]{4}\/+[0-9]{2}\/+[0-9]{2}\/+[^/]*\.[^/.]*)\/+[0-9]+x[0-9]+\/*(?:[?#].*)?$/,
							   "/$1");
		}

		if (domain_nowww === "drytickets.com.au") {
			// https://drytickets.com.au/assets/upload/750/450/10/celebrities/180-zarine-khan.jpg
			//   https://drytickets.com.au/assets/upload/celebrities/180-zarine-khan.jpg
			return src.replace(/\/+assets\/+upload\/+[0-9]+\/+[0-9]+\/+[0-9]+\/+/, "/assets/upload/");
		}

		if (domain_nosub === "filmibeat.com") {
			// https://www.filmibeat.com/ph-small/2011/09/1316175112269426.jpg
			//   https://www.filmibeat.com/ph-big/2011/09/1316175112269426.jpg
			// https://www.filmibeat.com/imgh/199x150/2018/05/shraddha-das_152655086100.jpg
			//   https://www.filmibeat.com/ph-big/2018/05/shraddha-das_152655086100.jpg
			// https://www.filmibeat.com/img/148x90x183/popcorn/profile_photos/felicity-jones-6910.jpg
			//   https://www.filmibeat.com/img/popcorn/profile_photos/felicity-jones-6910.jpg
			// https://telugu.filmibeat.com/img/150x90/2016/08/jen01-24-1472025024.jpg
			//   https://telugu.filmibeat.com/img/2016/08/jen01-24-1472025024.jpg
			// https://photos.filmibeat.com/imgm/237x80/2013/05/ishq-in-paris-press-meet_136746965027.jpg
			//   https://photos.filmibeat.com/ph-big/2013/05/ishq-in-paris-press-meet_136746965027.jpg
			// WxQxH
			newsrc = src
				.replace(/\/ph-[^/]*\/+/, "/ph-big/")
				.replace(/\/+img[hm]\/+[0-9]+x[0-9]+\/+/, "/ph-big/")
				.replace(/\/img\/+[0-9]+x[0-9]+(?:x[0-9]*)?\//, "/img/");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "g.ahan.in") {
			// http://g.ahan.in/telugu/Sakshi-Agarwal181116/thumbnails/Sakshi-Agarwal-(1).JPG
			//   http://g.ahan.in/telugu/Sakshi-Agarwal181116/Sakshi-Agarwal-(1).JPG
			return src.replace(/\/+thumbnails\/+([^/]*\.[^/.]*)(?:[?#].*)?$/, "/$1");
		}

		if (domain_nowww === "behindwoods.com") {
			// https://www.behindwoods.com/tamil-actress/sakshi-agarwal/thumbnails/sakshi-agarwal-stills-photos-pictures-256.jpg
			//   https://www.behindwoods.com/tamil-actress/sakshi-agarwal/sakshi-agarwal-stills-photos-pictures-256.jpg
			// other:
			// http://www.behindwoods.com/tamil-actress/mirnalini-ravi/thumbnails/mirnalini-ravi-stills-photos-pictures-338.jpg
			//  http://www.behindwoods.com/tamil-actress/mirnalini-ravi/mirnalini-ravi-stills-photos-pictures-338.jpg -- no watermark
			newsrc = src.replace(/\/+thumbnails\/+([^/]*\.[^/.]*)(?:[?#].*)?$/, "/$1");
			if (newsrc !== src) {
				return {
					url: newsrc,
					problems: {
						watermark: true
					}
				};
			}
		}

		if (domain === "gallery.123telugu.com") {
			// https://gallery.123telugu.com/content/slideshows/Actress/S/Sakshi-Agarwal2/thumbs/tn_Sakshi%20(4).jpg
			//   https://gallery.123telugu.com/content/slideshows/Actress/S/Sakshi-Agarwal2/images/Sakshi%20(4).jpg
			return src.replace(/\/+thumbs\/+tn_([^/]*)(?:[?#].*)?$/, "/images/$1");
		}

		if (domain === "images.gludy.com") {
			// https://images.gludy.com/photos/0/Nicole-kidman-sexy-wallpaper_950.jpg
			//   https://images.gludy.com/photos/0/Nicole-kidman-sexy-wallpaper.jpg
			// https://images.gludy.com/photos/0/Elisha-cuthbert-wallpaper_310.jpg
			//   https://images.gludy.com/photos/0/Elisha-cuthbert-wallpaper.jpg
			return src.replace(/(\/+photos\/+[0-9]+\/+[^/]*)_[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "static.az-cdn.ch") {
			// https://static.az-cdn.ch/__ip/ecp2MTZ_hBBITqu8znMxRDt5dpU/f2e0508f7bd8485acb4476aab59dd90fe7a3f8fd/n-avatar-1x1-far
			//   https://static.az-cdn.ch/__ip/ecp2MTZ_hBBITqu8znMxRDt5dpU/f2e0508f7bd8485acb4476aab59dd90fe7a3f8fd/n-full-fill -- slightly desaturated
			//   https://static.az-cdn.ch/__ip/ecp2MTZ_hBBITqu8znMxRDt5dpU/f2e0508f7bd8485acb4476aab59dd90fe7a3f8fd/teaser-goldbach -- same size
			// https://static.az-cdn.ch/__ip/A3NAQDVZZei8z_LDNbD3IHF9QUQ/66325d125e266b16394e5c59a46a3380c96c2a76/teaser-goldbach -- 3200x2134 (not stretched)
			//   https://static.az-cdn.ch/__ip/A3NAQDVZZei8z_LDNbD3IHF9QUQ/66325d125e266b16394e5c59a46a3380c96c2a76/n-full-fill -- 1080x720
			//return src.replace(/\/n-[^/]*(?:[?#].*)?$/, "/n-full-fill");
			return src.replace(/\/n-[^/]*(?:[?#].*)?$/, "/teaser-goldbach");
		}

		if (domain_nowww === "starchive.ru") {
			// http://www.starchive.ru/m/Madonna/thumbnails_foto/thumb_Madonna_285.jpg
			//   http://www.starchive.ru/m/Madonna/foto/Madonna_285.jpg
			return src.replace(/\/+thumbnails_foto\/+thumb_/, "/foto/");
		}

		if (domain === "pre.aichi.jp") {
			// https://pre.aichi.jp/archive/storage/thumb/865d4017df935a782a5ad542bf466eea4ab9a57d.jpg
			//   https://pre.aichi.jp/archive/storage/865d4017df935a782a5ad542bf466eea4ab9a57d.jpg
			return src.replace(/\/+archive\/+storage\/+thumb\/+/, "/archive/storage/");
		}

		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/");
		}

		if (domain_nowww === "4fzone.com") {
			// http://4fzone.com/uploads/images/clip_2902_1529474041_social.jpg
			//   http://4fzone.com/uploads/images/clip_2902_1529474041_poster.jpg
			return src.replace(/(\/+uploads\/+images\/+clip_[0-9]+_[0-9]+)_[a-z]+(\.[^/.]*)(?:[?#].*)?$/, "$1_poster$2");
		}

		if ((domain_nosub === "s1sf.com" ||
			 domain_nosub === "isanook.com") &&
			 domain.match(/^(?:s|p[0-9]+)\./)) {
			// https://www.sanook.com/sport/77629/gallery/68249/
			// https://s.isanook.com/sp/0/rp/r/w350/ya0xa0m1w0/aHR0cHM6Ly9zLmlzYW5vb2suY29tL3NwLzAvdWkvMTUvNzc2MjkvMzYuanBn.jpg
			//   https://s.isanook.com/sp/0/rp/r/w9999999/ya0xa0m1w0/aHR0cHM6Ly9zLmlzYW5vb2suY29tL3NwLzAvdWkvMTUvNzc2MjkvMzYuanBn.jpg
			//   https://s.isanook.com/sp/0/ui/15/77629/36.jpg
			// http://p3.isanook.com/wo/0/rp/r/w580/ya0xa0m1/aHR0cDovL3AzLnMxc2YuY29tL3dvLzAvdWkvMTIvNjA4NjUvc2VsZW5hX2dvbWV6X2luX2NvYWNoX2FuZF90aWZmYW55X2pld2VscnkuanBn.jpg
			//   http://p3.isanook.com/wo/0/rp/r/w9999999/ya0xa0m1/aHR0cDovL3AzLnMxc2YuY29tL3dvLzAvdWkvMTIvNjA4NjUvc2VsZW5hX2dvbWV6X2luX2NvYWNoX2FuZF90aWZmYW55X2pld2VscnkuanBn.jpg
			//   http://p3.isanook.com/wo/0/ui/12/60865/selena_gomez_in_coach_and_tiffany_jewelry.jpg
			// http://p3.s1sf.com/wo/0/rp/r/w580/ya0xa0m1/aHR0cDovL3AzLnMxc2YuY29tL3dvLzAvdWkvMTIvNjA4NjUvc2VsZW5hX2dvbWV6X2luX2NvYWNoX2FuZF90aWZmYW55X2pld2VscnkuanBn.jpg
			//   http://p3.isanook.com/wo/0/ui/12/60865/selena_gomez_in_coach_and_tiffany_jewelry.jpg
			newsrc = src.replace(/\/+rp\/+r\/+[wh][0-9]+\/+/, "/rp/r/w9999999/");
			if (newsrc !== src)
				return newsrc;

			newsrc = src.replace(/.*\/(aHR0c[^?#/.]+)\.[^/.]+(?:[?#].)?$/, "$1");
			if (newsrc !== src)
				return base64_decode(newsrc);
		}

		if (domain_nosub === "caping.co.id" &&
			domain.match(/^image[0-9]*\./)) {
			// https://image1.caping.co.id/news/20170123/3d/1156436851A750A501.jpg_480A0A1A80.webp
			//   https://image1.caping.co.id/news/20170123/3d/1156436851A750A501.jpg.webp
			//   https://image1.caping.co.id/news/20170123/3d/1156436851A750A501.jpg
			return src.replace(/(\.[^/._]+)_[0-9A-Z]+(\.[^/.]*)(?:[?#].*)?$/, "$1");
		}

		if (domain_nowww === "zozchat.com") {
			// https://zozchat.com/thumb-news/500/500/1-2018/co-dong-vien-han-quoc-xinh-dep-mac-mat-me-17.jpg -- watermark
			//   https://zozchat.com/images/uploads/images/1-2018/co-dong-vien-han-quoc-xinh-dep-mac-mat-me-17.jpg -- larger, no watermark
			return src.replace(/\/+thumb-news\/+[0-9]+\/+[0-9]+\/+/, "/images/uploads/images/");
		}

		if (domain === "media.tintuc.vn") {
			// https://media.tintuc.vn/uploads/medias/2016/11/29/550x500/3-bb-baaadkfiBg.jpg
			//   https://media.tintuc.vn/uploads/medias/2016/11/29/3-bb-baaadkfiBg.jpg
			return src.replace(/(\/+uploads\/+medias\/+[0-9]{4}\/+[0-9]{2}\/+[0-9]{2}\/+)[0-9]+x[0-9]+\//, "$1");
		}

		if (domain_nosub === "gigacircle.com") {
			// http://s6.gigacircle.com/media/700x300_s6_53b418a10249d.jpg
			//   http://s6.gigacircle.com/media/s6_53b418a10249d.jpg
			// http://s6.gigacircle.com/media/700x300_s6_53bbee923c628.jpg
			//   http://s6.gigacircle.com/media/s6_53bbee923c628.jpg
			return src.replace(/\/+media\/+[0-9]+x[0-9]+_/, "/media/");
		}

		if (domain_nowww === "ckywf.com") {
			// http://www.ckywf.com/data/m_photo_news/2014/06/865c0c0b4ab0e063e5caa3387c1a874111403224202_thumb.jpg
			//   http://www.ckywf.com/data/m_photo_news/2014/06/865c0c0b4ab0e063e5caa3387c1a874111403224202.jpg
			return {
				url: src.replace(/(\/+data\/+[^/]*\/+[0-9]{4}\/+[0-9]{2}\/[0-9a-f]+)_thumb(\.[^/.]*)$/, "$1$2"),
				head_wrong_contenttype: true
			};
		}

		if (domain_nowww === "hao.news") {
			// http://hao.news/Uploads/Picture/2015-10-27/976be9c2d3bb1dc95e32e8530f2c164673073694_360_243.jpg
			//   http://hao.news/Uploads/Picture/2015-10-27/976be9c2d3bb1dc95e32e8530f2c164673073694.jpg
			return src.replace(/(\/+Uploads\/+Picture\/+[0-9]{4}-[0-9]{2}-[0-9]{2}\/+[0-9a-f]+)_[0-9]+_[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "img.joinfo.ua") {
			// https://img.joinfo.ua/g/2014/09/150x117/562_542a95111e443.jpg
			//   https://img.joinfo.ua/g/2014/09/562_542a95111e443.jpg
			return src.replace(/(\/+g\/+[0-9]{4}\/+[0-9]{2}\/+)[0-9]+x[0-9]+\/+/, "$1");
		}

		if (domain_nosub === "hebeilong.com" &&
			domain.match(/^img/)) {
			// http://imgtt.hebeilong.com/img.php?http://inews.gtimg.com/newsapp_match/0/4126499952/0
			//   http://inews.gtimg.com/newsapp_match/0/4126499952/0
			// http://img88.hebeilong.com/img.php?http://image.uc.cn/s/wemedia/s/upload/2018/eeb8ebd0884cae236a8dc71c32a552a7x640x799x40.jpeg
			//   http://image.uc.cn/s/wemedia/s/upload/2018/eeb8ebd0884cae236a8dc71c32a552a7x640x799x40.jpeg
			return src.replace(/^[a-z]+:\/\/[^/]*\/+img\.php\?(http.*)$/, "$1");
		}

		if (domain === "cdn.blogimage2.crooz.jp") {
			// http://cdn.blogimage2.crooz.jp/usr/2016/06/01/pubupu/ototkkk/resource/smp_thum_5093ccf417995424f44b4d3580e97a997186b134.jpg
			//   http://cdn.blogimage2.crooz.jp/usr/2016/06/01/pubupu/ototkkk/resource/5093ccf417995424f44b4d3580e97a997186b134.jpg
			return src.replace(/\/smp_thum_([0-9a-f]+\.[^/.]*)(?:[?#].*)?$/, "/$1");
		}

		if (domain_nosub === "lockerdome.com" && domain.match(/^cdn[0-9]*\./)) {
			// https://cdn1.lockerdome.com/uploads/251ed7f5f2b318e7d05e3a8076e4da12075dc985f5018ad56f41de48efbd04af_small -- 415x623
			//   https://cdn1.lockerdome.com/uploads/251ed7f5f2b318e7d05e3a8076e4da12075dc985f5018ad56f41de48efbd04af_facebook -- 600x901
			// https://cdn1.lockerdome.com/uploads/53e56d2b058e011a1aa13ed011161832cae7d9735f8a1e9333b688fd7c66fdae_facebook
			//   https://cdn1.lockerdome.com/uploads/53e56d2b058e011a1aa13ed011161832cae7d9735f8a1e9333b688fd7c66fdae_:original
			// https://cdn1.lockerdome.com/uploads/7b55b7b64d31e9fe0a14959447c782a855745b7a1129025014c2badbacf82e19_facebook -- 3264x2448
			//   https://cdn1.lockerdome.com/uploads/7b55b7b64d31e9fe0a14959447c782a855745b7a1129025014c2badbacf82e19_:original -- 3264x2448
			// https://cdn1.lockerdome.com/uploads/c109b254721cc16258b9dfa563f91be385ca8815f55db22cd7e97c6ae0617bc8_thumb_medium
			//   https://cdn1.lockerdome.com/uploads/c109b254721cc16258b9dfa563f91be385ca8815f55db22cd7e97c6ae0617bc8_:original
			return src.replace(/(\/+uploads\/+[0-9a-f]+)_:?[_a-z]+(?:[?#].*)?$/, "$1_:original");
		}

		if (domain === "images.headlines.pw") {
			// https://images.headlines.pw/topnews-2017/imgs/1b/83/1b834a14603c814888a0283b92aeeed0194e4baf_640_960.jpg
			//   https://images.headlines.pw/topnews-2017/imgs/1b/83/1b834a14603c814888a0283b92aeeed0194e4baf.jpg
			return src.replace(/(\/[0-9a-f]+)_[0-9]+_[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "harianbernas.com") {
			// https://www.harianbernas.com/online/public/foto_news/image_news_535/01487922730gfriend.jpg
			//   https://www.harianbernas.com/online/public/foto_news/image_news/01487922730gfriend.jpg
			return src.replace(/\/image_news_[0-9]+\//, "/image_news/");
		}

		if (domain === "static.weloveshopping.com") {
			// http://static.weloveshopping.com/shop/SerieUpdate/OKI222_sma.jpg
			//   http://static.weloveshopping.com/shop/SerieUpdate/OKI222.jpg
			return src.replace(/(\/[^/_.]*)_[a-z]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nosub === "heykorean.com" &&
			domain.match(/^store[0-9]*\./)) {
			// http://store1.heykorean.com/board/54/173/thumb/IEPO6WJXM.jpg
			//   http://store1.heykorean.com/board/54/173/IEPO6WJXM.jpg
			return src.replace(/(\/+board\/+[0-9]+\/+[0-9]+\/+)thumb\//, "$1");
		}

		if (domain_nowww === "searx.info") {
			// https://searx.info/image_proxy?url=https%3A%2F%2Fpds.joins.com%2F%2Fnews%2Fcomponent%2Fhtmlphoto_mmdata%2F201711%2F29%2F3748599d-c5bf-417a-a50b-ae1178f53117.jpg&h=a633de4614f3352835f2a60cc03a77f7e3f2c99c8c42a3bbb6b498fd3ad3f768
			//   https://pds.joins.com//news/component/htmlphoto_mmdata/201711/29/3748599d-c5bf-417a-a50b-ae1178f53117.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+image_proxy.*?[?&]url=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeURIComponent(newsrc);
		}

		if (domain_nosub === "nocutnews.co.kr" && domain.match(/^file[0-9]*\./)) {
			// http://file2.nocutnews.co.kr/newsroom/image/2017/08/31/20170831120117486976_preview.jpg
			//   http://file2.nocutnews.co.kr/newsroom/image/2017/08/31/20170831120117486976.jpg
			// other:
			// https://www.nocutnews.co.kr/news/4979003
			//   https://file2.nocutnews.co.kr/newsroom/upload/image/2018/06/01/201806011636285046.jpg -- 3680x2456
			// http://file2.nocutnews.co.kr/news/reporter/2019/08/20/20190820140816533.jpg -- 2826x4238
			// https://file2.nocutnews.co.kr/nocut/news/meta/20190426193614.jpg -- 2850x1953
			// http://file2.nocutnews.co.kr/nocut/news/top1/headline/20190701060526.jpg -- 3833x2667
			// https://file2.nocutnews.co.kr/newsroom/image/2003/09/02092232000_60100020.jpg -- 3066x1402
			// https://file2.nocutnews.co.kr/newsroom/image/2003/12/06033629000_60500060.bmp -- 2288x1712
			// https://www.nocutnews.co.kr/common/popprint.aspx?index=4761310 (news id, but using this doesn't help)
			// https://www.nocutnews.co.kr/news/4761310
			//   https://file2.nocutnews.co.kr/newsroom/image/2017/04/03/201704031737527882.jpg -- 5184x3456
			// http://img.nocutnews.co.kr/mnocut/v3/story/disabled/img5_1_2.jpg -- 4030x2330
			// http://img.nocutnews.co.kr/mnocut/v2/story/img_160502.jpg -- 4999x3227
			// http://file2.nocutnews.co.kr/bsnocut/news/special/20190618174031.jpg -- 4032x3024
			// http://file2.nocutnews.co.kr/nocut/tv/video/20150722170936.jpg -- 5616x3744
			// https://file2.nocutnews.co.kr/nocut/news/timeline/20170531161019.jpg -- 1999x2354
			// https://www.nocutnews.co.kr/news/5204209
			//   https://file2.nocutnews.co.kr/newsroom/image/2019/08/27/20190827183910804787_8_450_254.jpg
			//     https://file2.nocutnews.co.kr/newsroom/image/2019/08/27/20190827183910804787_6_710_401.jpg
			return src.replace(/(\/[0-9]+)_preview(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nosub === "flixcart.com") {
			// https://rukminim1.flixcart.com/image/612/612/jiyvvrk0/physical-game/v/t/d/grand-theft-auto-grand-theft-auto-san-andreas-and-vice-city-pack-original-imaf6ncepvvb3gzh.jpeg?q=1
			//   https://rukminim1.flixcart.com/image/jiyvvrk0/physical-game/v/t/d/grand-theft-auto-grand-theft-auto-san-andreas-and-vice-city-pack-original-imaf6ncepvvb3gzh.jpeg
			// https://rukminim1.flixcart.com/image/832/832/poster/9/q/p/beautiful-birds-parrots-psu360000102-small-original-imaegcsejqkfdg3g.jpeg?q=70 -- upscaled?
			//   https://rukminim1.flixcart.com/image/poster/9/q/p/beautiful-birds-parrots-psu360000102-small-original-imaegcsejqkfdg3g.jpeg
			return src.replace(/(:\/\/[^/]*\/+image)\/+[0-9]+\/+[0-9]+\/+([0-9a-z]+\/+(?:[^/]*\/+)?.\/+.\/+.\/+[^/]*\.[^/.?]*)(?:[?#].*)?$/, "$1/$2");
		}

		if (domain === "conteudo.imguol.com.br") {
			// https://conteudo.imguol.com.br/c/entretenimento/2e/2018/05/17/gta-v-1526592838928_v2_1170x540.jpgx -- low quality
			//   https://conteudo.imguol.com.br/c/entretenimento/2e/2018/05/17/gta-v-1526592838928_v2_1170x540.jpg -- 1170x540
			//   https://conteudo.imguol.com.br/c/entretenimento/2e/2018/05/17/gta-v-1526592838928_v2_16x9.jpg -- 1280x720, less cropped
			//   https://conteudo.imguol.com.br/c/entretenimento/2e/2018/05/17/gta-v-1526592838928_v2_1280x1.jpg -- 1280x720
			// https://conteudo.imguol.com.br/c/entretenimento/4a/2018/05/14/na-classica-parceria-com-o-christopher-reeve-em-superman-1526329333424_v2_150x150.jpg
			//   https://conteudo.imguol.com.br/c/entretenimento/4a/2018/05/14/na-classica-parceria-com-o-christopher-reeve-em-superman-1526329333424_v2_1x1.jpg -- 999x1000
			//   https://conteudo.imguol.com.br/c/entretenimento/4a/2018/05/14/na-classica-parceria-com-o-christopher-reeve-em-superman-1526329333424_v2_1280x1.jpg -- 1280x876
			//   https://conteudo.imguol.com.br/c/entretenimento/4a/2018/05/14/na-classica-parceria-com-o-christopher-reeve-em-superman-1526329333424_v2_16x9.jpg -- 1459x821, cropped (from above) but not upscaled
			// some tests:
			// 1x1 = square, "1" means the side will be automatically filled, (max of 1500 on width, 1920 on height -- this is wrong?), 16x9, 4x3, 3x4, 1280x1
			// doesn't work: 0, omit, x, org, orig, origin, original, full
			// perhaps c = crop? possibly also conteudo
			// https://conteudo.imguol.com.br/c/entretenimento/8b/2018/10/23/a-varanda-deste-apartamento-em-aracaju-sergipe-foi-totalmente-envidracada-para-proteger-os-moveis-da-maresia-excessiva-do-nordeste-o-vidro-recebeu-em-seu-processo-de-fabricacao-um-choque-de-1540321458649_v2_16x9.jpg -- 3500x1968
			// https://conteudo.imguol.com.br/c/entretenimento/8b/2018/10/23/a-varanda-deste-apartamento-em-aracaju-sergipe-foi-totalmente-envidracada-para-proteger-os-moveis-da-maresia-excessiva-do-nordeste-o-vidro-recebeu-em-seu-processo-de-fabricacao-um-choque-de-1540321458649_v2_1x1.jpg -- 2272x2274
			// other:
			// https://conteudo.imguol.com.br/blogs/231/files/2018/09/Predator-Stadium-Spectral-Mode6.jpg
			// https://conteudo.imguol.com.br/cursosonline/apresentacao/images/34.jpg
			// https://conteudo.imguol.com.br/c/feed/podcast/na-grade-mma/3000.png -- 3000x3000
			// http://conteudo.imguol.com.br/c/estilo/podcasts/horoscopo/3000.png -- 3000x3000
			// https://conteudo.imguol.com.br/c/especiais/estilo/erika_bronze/lateral_jessica_600x800.jpg -- 1721x2295, "jpgx" exists
			return src
				.replace(/(-[0-9]{5,}_v2)_([0-9]+)x\2\./, "$1_1x1.")
				.replace(/(\/[^/]*\.[^/.?#]*)x(?:[?#].*)?$/, "$1");
		}

		if (domain === "images.gog.com") {
			// https://images.gog.com/93bc827005313cfb4cd9194f05f09fdc4d91e93d7730bda0ed9565c9b7361594_product_card_v2_thumbnail_271.jpg
			//   https://images.gog.com/93bc827005313cfb4cd9194f05f09fdc4d91e93d7730bda0ed9565c9b7361594.jpg
			return src.replace(/(:\/\/[^/]*\/+[0-9a-f]+)_[^/]*(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "imx.to") {
			newsrc = website_query({
				website_regex: [
					/^[a-z]+:\/\/[^/]+\/+img-([0-9a-f]{5,})\.html(?:[?#].*)?$/,
					/^[a-z]+:\/\/[^/]+\/+i\/+([0-9a-z]{5,})(?:[?#].*)?$/,
				],
				query_for_id: function(id, match) {
					let url = "https://imx.to/img-" + id + ".html";
					if (/:\/\/[^/]+\/+i\//.test(match[0]))
						url = "https://imx.to/i/" + id;
					return {
						method: "POST",
						url,
						imu_mode: "document",
						headers: {
							"content-type": "application/x-www-form-urlencoded",
							origin: "https://imx.to",
							Referer: url
						},
						data: "imgContinue=Continue+to+your+image..."
					};
				},
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/<a href="(https?:\/\/imx\.to\/+u\/+i\/+[^"]+)" title="([^"]+)"[^>]*><img class="[^"]+" src="https?:\/\/imx\.to\/+u\/+i\/+/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					var url = decode_entities(match[1]);
					var caption = decode_entities(match[2]);

					return done({
						url: url,
						extra: {
							page: resp.finalUrl,
							caption: caption
						}
					}, 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "imx.to") {
			// https://imx.to/u/t/2018/12/06/1whoss.jpg
			//   https://t.imx.to/t/2018/12/06/1whoss.jpg
			// https://imx.to/upload/small/2017/02/09/589ccf3f789ee.jpg
			//   https://imx.to/u/i/2017/02/09/589ccf3f789ee.jpg
			//   https://x001.imx.to/i/2017/02/09/589ccf3f789ee.jpg
			newsrc = src
				.replace(/(:\/\/[^/]+\/+u\/+)t\/+/, "$1i/")
				.replace(/(:\/\/[^/]+\/+)upload\/+[a-z]+\/+/, "$1u/i/");
			if (newsrc !== src)
				return newsrc;

			return src
				//.replace(/:\/\/[^/]*\/u\/t\//, "://t.imx.to/t/")
				.replace(/:\/\/[^/]*\/u\/t\//, "://imx.to/t/")
				.replace(/:\/\/[^/]*\/upload\/+[a-z]+\/+/, "://x001.imx.to/i/");
		}

		if (domain === "t.imx.to") {
			// https://t.imx.to/t/2018/12/06/1whoss.jpg
			//   https://i.imx.to/i/2018/12/06/1whoss.jpg
			return src.replace(/:\/\/[^/]*\/t\//, "://i.imx.to/i/");
		}

		if (domain_nosub === "imx.to" && domain.match(/^[xi][0-9]+\./)) {
			// https://x001.imx.to/t/2016/01/19/569e0e4e392e4.jpg
			//   https://x001.imx.to/i/2016/01/19/569e0e4e392e4.jpg
			// https://i002.imx.to/t/2019/04/05/20esya.jpg
			//   https://i002.imx.to/i/2019/04/05/20esya.jpg
			return src.replace(/:\/\/[^/]*\/t\//, "://imx.to/u/i/");
		}

		if (domain_nowww === "sisajb.com" ||
			// http://image.kbsm.net/data/newsThumb/1549957378ADD_thumb580.png
			//   http://image.kbsm.net/data/newsData/1549957378.png
			domain === "image.kbsm.net") {
			// http://www.sisajb.com/data/newsThumb/1526600214&&ADD.thumb580
			//    http://www.sisajb.com/data/newsData/1526600214&&.JPG
			// http://www.sisajb.com/data/newsThumb/1526600266&&ADD.thumb580
			//    http://www.sisajb.com/data/newsData/1526600266&&.jpg
			// http://www.sisajb.com/data/newsThumb/1353034731&&TITLE_IMG_.thumb90
			//   http://www.sisajb.com/data/newsThumb/1353034716&&ADD.thumb580
			//   http://www.sisajb.com/data/newsData/1353034716&&.jpg
			// this could be optimized to check for the extension (as long as it's not .thumbs[0-9]+)
			newsrc = src.replace(/\/data\/newsThumb\/([0-9]+(?:&&)?).*?$/, "/data/newsData/$1.jpg");
			if (newsrc !== src)
				return add_extensions_upper(newsrc);
		}

		if (domain === "assets.cdn.moviepilot.de") {
			// https://assets.cdn.moviepilot.de/files/0cb261dba5f21fe5e69afaaa61896d3d81ec1f9b24b173f3f504d0bf068c/limit/400/170/IronThroneReal-610x885.jpg
			//   https://assets.cdn.moviepilot.de/files/0cb261dba5f21fe5e69afaaa61896d3d81ec1f9b24b173f3f504d0bf068c/IronThroneReal-610x885.jpg
			// https://assets.cdn.moviepilot.de/files/cd8853bfebfe31230af91edc3f96c8d63b0894ee180f26e4c5cc716df64c/fill/390/234/transformers-die-rache.jpg
			//   https://assets.cdn.moviepilot.de/files/cd8853bfebfe31230af91edc3f96c8d63b0894ee180f26e4c5cc716df64c/transformers-die-rache.jpg
			return {
				url: src.replace(/(\/+files\/+[0-9a-f]+)\/+(?:limit|fill)\/+[0-9]+\/+[0-9]+\/+/, "$1/"),
				// thanks to dym-sh on github for reporting: https://github.com/qsniyg/maxurl/issues/480
				head_wrong_contentlength: true
			};
		}

		if (domain === "img.xuehi.cn") {
			// http://img.xuehi.cn/1/0/1/www.weituzhai.com%2Fuploads%2Fallimg%2F150320%2F00040233N-0.jpg!600.220x150.auto.jpg
			//   http://www.52rkl.cn/uploads/allimg/150320/00040233N-0.jpg
			// http://img.xuehi.cn/1/0/1/img3.doubanio.com%2Fview%2Fpresto%2Fmedium%2Fpublic%2F343664.jpg.780x0.auto.jpg
			//   http://img3.doubanio.com/pview/presto/raw/public/343664.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+(?:[0-9]\/+){3}([^/]*%2F.*?\.[^%]+?)[.!]([0-9]+\.)?[0-9]+x[0-9]+\.auto\.[^/.]+(?:[?#].*)?$/, "$1");
			if (newsrc !== src)
				return add_http(decodeURIComponent(newsrc));
		}

		if (domain_nowww === "infectedbyart.com" && string_indexof(src, "/Images/") >= 0) {
			// http://www.infectedbyart.com/Images/Category_39/subcat_43/thumbs/0904160023061.jpg
			//   http://www.infectedbyart.com/Images/Category_39/subcat_43/0904160023061.jpg
			return {
				url: src.replace(/\/+thumbs\/+/, "/"),
				problems: {
					watermark: true
				}
			};
		}

		if (domain === "static.doramatv.me") {
			// http://static.doramatv.me/uploads/pics/02/53/632.jpg
			//   http://static.doramatv.me/uploads/pics/02/53/632_o.jpg
			return src.replace(/(\/uploads\/+pics\/+.*\/[0-9]+)(\.[^/.]*)(?:[?#].*)?$/, "$1_o$2");
		}

		if (domain === "chi.gomtv.com") {
			// https://chi.gomtv.com/cgi-bin/imgview.cgi?nid=12740788&type=11 -- 853x480
			//   https://chi.gomtv.com/cgi-bin/imgview.cgi?nid=12740788&type=11 -- 1280x720
			// http://chi.gomtv.com/cgi-bin/imgview.cgi?nid=12211347&type=11 -- 857x480, looks stretched
			//   http://chi.gomtv.com/cgi-bin/imgview.cgi?nid=12211347&type=0 -- 720x403
			return src.replace(/\/imgview\.cgi.*?[?&]nid=([0-9]+).*?$/, "/imgview.cgi?nid=$1&type=0");
		}

		if (domain === "static-thechristianpost.netdna-ssl.com" ||
			// https://cdn.christianpost.com/files/cache/image/13/11/131143_w_450_630.jpg
			//   https://cdn.christianpost.com/files/original/image/13/11/131143.jpg
			// https://cdn.christianpost.com/files/cache/thumbnail/24/00/240021_a_130_72.jpg
			//   https://cdn.christianpost.com/files/original/thumbnail/24/00/240021.jpg
			domain === "cdn.christianpost.com") {
			// https://static-thechristianpost.netdna-ssl.com/files/cache/image/11/00/110088_w_700.jpg
			//   https://static-thechristianpost.netdna-ssl.com/files/original/image/11/00/110088.jpg
			// https://static-thechristianpost.netdna-ssl.com/files/cache/image/8/42/84293_w_725.jpg
			//   https://static-thechristianpost.netdna-ssl.com/files/original/image/8/42/84293.jpg
			// https://static-thechristianpost.netdna-ssl.com/files/cache/image/13/41/134118_a_963_642_195_156.jpg
			//   https://static-thechristianpost.netdna-ssl.com/files/original/image/13/41/134118.jpg
			// https://static-thechristianpost.netdna-ssl.com/image/6b88306ee34d.jpg?w=963&amp;s=w
			//   https://static-thechristianpost.netdna-ssl.com/image/6b88306ee34d.jpg
			// https://static-thechristianpost.netdna-ssl.com/image/sarah-jakes-roberts-toure-roberts.jpg?w=725&amp;s=w
			//   https://static-thechristianpost.netdna-ssl.com/image/sarah-jakes-roberts-toure-roberts.jpg
			return src
				.replace(/\/files\/+cache\/+(image|thumbnail)\/+([0-9]{1,2}\/+[0-9]{1,2}\/+[0-9]+)_(?:[wh]_[0-9]+(?:_[0-9]+)?|(?:a(?:_[0-9]+){2,4}))(\.[^/.]*)(?:[?#].*)?$/,
						 "/files/original/$1/$2$3")
				.replace(/(\/(?:image|thumbnail)\/+[^/]*\.[^/.?#]+)(?:[?#].*)?$/, "$1");
		}

		if (domain === "prnewswire2-a.akamaihd.net") {
			// https://photos.prnewswire.com/prnfull/20160901/403569?max=950 -- redirects to:
			//   https://prnewswire2-a.akamaihd.net/p/1893751/sp/189375100/thumbnail/entry_id/0_9y9ehgva/def_height/2700/def_width/2700/version/100012/type/1
			//   https://prnewswire2-a.akamaihd.net/p/1893751/sp/189375100/thumbnail/entry_id/0_9y9ehgva/def_height/0/def_width/0
			return src.replace(/(\/+entry_id\/+[0-9a-z]+_[0-9a-z]+\/+).*$/, "$1def_height/0/def_width/0");
		}

		if (domain_nosub === "eldarioncloud.com" &&
			domain.match(/^radiocms-images\./)) {
			// https://radiocms-images.us1.eldarioncloud.com/resize/750/https://storage.googleapis.com/media.mwcradio.com/mimesis/2018-08/30/tmp4w8s0O.jpg
			//   https://storage.googleapis.com/media.mwcradio.com/mimesis/2018-08/30/tmp4w8s0O.jpg
			return src.replace(/^[a-z]+:\/\/[^/]*\/+resize\/+[0-9]+\/+(https?:)/, "$1");
		}

		if (domain === "media.ntslive.co.uk") {
			// https://media.ntslive.co.uk/crop/770x770/d6ea1db7-05d8-4029-856f-cac87a481014_1532563200.png
			//   https://media.ntslive.co.uk/images/d6ea1db7-05d8-4029-856f-cac87a481014_1532563200.png
			// https://media.ntslive.co.uk/resize/800x800/6cc98c9e-aa13-4b8b-a71c-68a369a50545_1523923200.png
			//   https://media.ntslive.co.uk/images/6cc98c9e-aa13-4b8b-a71c-68a369a50545_1523923200.png
			return src.replace(/\/(?:crop|resize)\/+[0-9]+x[0-9]+\/+/, "/images/");
		}

		if (domain === "icdn.ensonhaber.com") {
			// thanks to anonymous for reporting:
			// https://icdn.ensonhaber.com/crop/114x65-90/resimler/diger/kok/2023/09/04/pasinyanin-rusya-pismanligi-stratejik-bir-hataydi_50dfb854.jpg
			//   https://icdn.ensonhaber.com/resimler/diger/kok/2023/09/04/pasinyanin-rusya-pismanligi-stratejik-bir-hataydi_50dfb854.jpg
			// https://icdn.ensonhaber.com/resize/114x65-90/resimler/diger/kok/2023/09/04/pasinyanin-rusya-pismanligi-stratejik-bir-hataydi_50dfb854.jpg
			//   https://icdn.ensonhaber.com/resimler/diger/kok/2023/09/04/pasinyanin-rusya-pismanligi-stratejik-bir-hataydi_50dfb854.jpg
			return src.replace(/\/(?:crop|resize)\/+[0-9]+x[0-9]+(?:-[0-9]+)?\/+resimler\/+/, "/resimler/");
		}

		if (domain_nosub === "tedsby.com" && domain.match(/^cdn[0-9]*\./)) {
			// https://cdn1.tedsby.com/tb/large/storage/4/4/9/44950/handmade-cat-scottish-fold-by-irina-kotelnikova.jpg
			//   https://cdn1.tedsby.com/storage/4/4/9/44950/handmade-cat-scottish-fold-by-irina-kotelnikova.jpg
			return src.replace(/\/tb\/+[a-z]+\/+storage\//, "/storage/");
		}

		if (domain_nosub === "cumicumi.com") {
			// http://www.cumicumi.com/uploads/public/5c2/4f0/34b/th_125x75_5c24f034b41c1320409400.jpg
			//   http://www.cumicumi.com/uploads/public/5c2/4f0/34b/5c24f034b41c1320409400.jpg
			// https://m.cumicumi.com/uploads/public/57b/593/5fe/th_350x200_57b5935fe1fae237927355.jpg
			//   https://m.cumicumi.com/uploads/public/57b/593/5fe/57b5935fe1fae237927355.jpg -- redirects to:
			//   https://www.cumicumi.com/uploads/public/57b/593/5fe/57b5935fe1fae237927355.jpg
			return src.replace(/(\/uploads\/+public\/+(?:[0-9a-f]+\/+){3})th_[0-9]+x[0-9]+_([0-9a-f]+\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "kanal247.com") {
			// https://www.kanal247.com/images/media/90x60/2018/12/26/24786.jpg
			//   https://www.kanal247.com/images/media/photo/2018/12/26/24786.jpg
			return src.replace(/\/images\/+media\/+[0-9]+x[0-9]+\/+/, "/images/media/photo/");
		}

		if (domain_nowww === "sportuvai.bg") {
			// http://sportuvai.bg/pictures/136734_909_.jpg -- 908x1251, stretched
			//   http://sportuvai.bg/pictures/136734__.jpg -- 409x563
			// http://sportuvai.bg/pictures/49050__63_1.jpg -- 112x63
			//   http://sportuvai.bg/pictures/49050___1.jpg -- 388x218
			// http://sportuvai.bg/pictures/136739_909_.jpg -- 908x1300, stretched
			//   http://sportuvai.bg/pictures/136739__.jpg -- 388x555
			return src.replace(/(\/pictures\/+[0-9]+_{1,2})[0-9]+(_+(?:[0-9]+)?)?(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2$3");
		}

		if ((domain_nosub === "thetimes.co.uk" ||
			 domain_nosub === "thetimes.com") && /\/imageserver\/+image\//.test(src)) {
			// https://www.thetimes.co.uk/imageserver/image/methode%2Ftimes%2Fprod%2Fweb%2Fbin%2F081a3bd8-fc5d-11e6-99c1-0f7da5c35c8f.jpg?crop=5022%2C2825%2C51%2C690&resize=685
			//   https://www.thetimes.co.uk/imageserver/image/methode%2Ftimes%2Fprod%2Fweb%2Fbin%2F081a3bd8-fc5d-11e6-99c1-0f7da5c35c8f.jpg?resize=999999999
			// https://www.thetimes.co.uk/imageserver/image/methode%2Fsundaytimes%2Fprodmigration%2Fweb%2Fbin%2F1ed9d88f-d652-4563-8d8b-fcbad22a1d0a.jpg?crop=1024%2C683%2C0%2C0&resize=685
			//   https://www.thetimes.co.uk/imageserver/image/methode%2Fsundaytimes%2Fprodmigration%2Fweb%2Fbin%2F1ed9d88f-d652-4563-8d8b-fcbad22a1d0a.jpg?resize=999999999
			// http://feeds.thetimes.co.uk/web/imageserver/imageserver/image/methode%2Ftimes%2Fprod%2Fweb%2Fbin%2F851fb466-202d-11e7-ba28-54204ca551ca.jpg?crop=1500,844,0,38
			//   http://feeds.thetimes.co.uk/web/imageserver/imageserver/image/methode%2Ftimes%2Fprod%2Fweb%2Fbin%2F851fb466-202d-11e7-ba28-54204ca551ca.jpg?resize=999999999
			// https://www.thetimes.com/imageserver/image/%2Fmethode%2Ftimes%2Fprod%2Fweb%2Fbin%2Fd31466da-f1b3-11e9-ba44-aad5db5172e7.jpg?crop=1441%2C811%2C66%2C394&resize=1200
			//   https://www.thetimes.com/imageserver/image/%2Fmethode%2Ftimes%2Fprod%2Fweb%2Fbin%2Fd31466da-f1b3-11e9-ba44-aad5db5172e7.jpg?resize=999999999
			return {
				url: src.replace(/(?:\?.*)?$/, "?resize=999999999"),
				head_wrong_contentlength: true
			};
		}

		if (domain === "cdn.celebyolo.com") {
			// https://cdn.celebyolo.com/thumbnails/olivia-wilde-38937-thumbnail.jpg
			//   https://cdn.celebyolo.com/olivia-wilde-38937-display.jpg
			//   https://cdn.celebyolo.com/olivia-wilde-38937.jpg
			return src.replace(/\/+(?:thumbnails\/+)?([^/]*-[0-9]+)-[a-z]+(\.[^/.]*)(?:[?#].*)?$/, "/$1$2");
		}

		if (domain_nowww === "voice.fi" ||
			// https://www.radionova.fi/files/media/image/5981/_r/59816_retinaarticle_1120.jpg
			//   https://www.radionova.fi/files/media/image/5981/_r/59816_retinaarticle.jpg
			// https://www.radionova.fi/files/media/image/2019/08/2019_08_02_5c5d865aaf9a9_1120.jpg
			//   https://www.radionova.fi/files/media/image/2019/08/2019_08_02_5c5d865aaf9a9.jpg
			domain_nowww === "radionova.fi") {
			// https://www.voice.fi/files/media/image/2017/24/2017_24_11_5a17d903efa2e_480.jpg
			//   https://www.voice.fi/files/media/image/2017/24/2017_24_11_5a17d903efa2e.jpg
			// https://www.voice.fi/files/media/image/p18v/at/p18v9at6s32ujg2b1ldqld4o4s5_480.jpg
			//   https://www.voice.fi/files/media/image/p18v/at/p18v9at6s32ujg2b1ldqld4o4s5.jpg
			return src.replace(/(\/+files\/+media\/+image\/+(?:[0-9]{4}\/+[0-9]{2}\/+[0-9]{4}_[0-9]{2}_[0-9]{2}_[0-9a-f]+|[0-9a-z]{4}\/+[0-9a-z]{2}\/+[0-9a-z]+|[0-9]+\/+_r\/+[0-9]+_retinaarticle))_[0-9]+(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain_nowww === "funtime.ge") {
			// https://funtime.ge/img/1500/uploaded/funtime/2017-03/201703021032281007624202_photo.jpg
			//   https://funtime.ge/uploaded/funtime/2017-03/201703021032281007624202.jpg
			return src
				.replace(/\/+img\/+[0-9]+\/+uploaded\/+/, "/uploaded/")
				.replace(/(\/+uploaded\/+[a-z]+\/+[0-9]{4}-[0-9]{2}\/+[0-9]+)_[a-z]+(\.[^/.]*)$/, "$1$2");
		}

		if (domain === "t.nhentai.net" ||
			// should this really be part of this rule?
			// https://i2.hentaifox.com/003/1533175/1t.jpg
			//   https://i2.hentaifox.com/003/1533175/1.jpg
			// https://i2.hentaifox.com/002/1500498/thumb.jpg
			//   https://i2.hentaifox.com/002/1500498/cover.jpg
			(domain_nosub === "hentaifox.com" && /^i[0-9]*\./.test(domain)) ||
			// https://images.asmhentai.com/009/277105/1t.jpg
			//   https://images.asmhentai.com/009/277105/1.jpg
			// https://images.asmhentai.com/009/277105/thumb.jpg
			//   https://images.asmhentai.com/009/277105/cover.jpg
			domain === "images.asmhentai.com" ||
			// https://t.nyahentai.net/galleries/1527796/1t.jpg
			//   https://i.nyahentai.net/galleries/1527796/1.jpg
			domain === "t.nyahentai.net") {
			// https://t.nhentai.net/galleries/1338652/2t.jpg
			//   https://i.nhentai.net/galleries/1338652/2.jpg
			// maybe this as well?
			// https://t.nhentai.net/galleries/1338533/thumb.jpg
			//   https://t.nhentai.net/galleries/1338533/cover.jpg
			//   https://t.nhentai.net/galleries/1338533/1t.jpg
			//   https://i.nhentai.net/galleries/1338533/1.jpg
			newsrc = src.replace(/(:\/\/[^/]+\/+(?:galleries|[0-9]+)\/+[0-9]+\/+[0-9]+)t(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
			if (newsrc !== src)
				return newsrc.replace(/:\/\/t\./, "://i.");

			return src.replace(/(:\/\/[^/]+\/+(?:galleries|[0-9]+)\/+[0-9]+\/)thumb(\.[^/.]*)(?:[?#].*)?$/, "$1cover$2");
		}

		if (domain_nosub === "hitomi.la") {
			// https://btn.hitomi.la/smalltn/1338767/p00.jpg.jpg
			//   https://ba.hitomi.la/galleries/1338767/p00.jpg
			// https://tn.hitomi.la/bigtn/1338767/p00.jpg.jpg
			//   https://ba.hitomi.la/galleries/1338767/p00.jpg
			// https://atn.hitomi.la/smalltn/1338760/1.jpg.jpg
			//   https://tn.hitomi.la/bigtn/1338760/1.jpg.jpg
			//   https://aa.hitomi.la/galleries/1338760/1.jpg
			// https://tn.hitomi.la/bigtn/1338763/1.jpg.jpg
			//   https://ba.hitomi.la/galleries/1338763/1.jpg
			// https://tn.hitomi.la/bigtn/1338738/0000.jpg.jpg
			//   https://aa.hitomi.la/galleries/1338738/0000.jpg
			// https://ctn.hitomi.la/smalltn/d/d4/993eba05ee978ab052c5c72cf9a623cf167e8d2e8fb89d069b0e3d5694de2d4d.jpg
			//   https://ca.hitomi.la/webp/d/d4/993eba05ee978ab052c5c72cf9a623cf167e8d2e8fb89d069b0e3d5694de2d4d.webp
			newsrc = src.replace(/:\/\/([a-z])tn\.hitomi\.la\/+(?:small|big)tn\/+([0-9a-f]\/+[0-9a-f]{2}\/+[0-9a-f]{20,})\.[^/.]+(?:[?#].*)?$/, "://$1a.hitomi.la/webp/$2.webp");
			if (newsrc !== src)
				return newsrc;

			regex = /:\/\/[a-z]?tn\.hitomi\.la\/+[a-z]+\/+([0-9]+\/+p?[0-9]+\.[^/.]*)\.[^/.]*(?:[?#].*)?$/;

			if (src.match(regex)) {
				return [
					src.replace(regex, "://aa.hitomi.la/galleries/$1"),
					src.replace(regex, "://ba.hitomi.la/galleries/$1"),
				];
			} else {
				var pageid = src.replace(/^[a-z]+:\/\/[^/]*\/+[a-z]+\/+([0-9]+)\/+.*/, "$1");
				if (src !== pageid) {
					var page = "https://hitomi.la/galleries/" + pageid + ".html";

					return {
						url: src,
						extra: { page: page }
					};
				}
			}
		}

		if (domain === "img.insight.co.kr") {
			// https://img.insight.co.kr/static/2018/12/29/300/6mbhe23vanmj1sz071d5.jpg
			//   https://img.insight.co.kr/static/2018/12/29/6mbhe23vanmj1sz071d5.jpg
			// https://img.insight.co.kr/static/2018/02/21/2000/dnh61047m543610j6zf2.jpg -- upscaled
			//   https://img.insight.co.kr/static/2018/02/21/dnh61047m543610j6zf2.jpg -- 700x450
			// doesn't work:
			// https://img.insight.co.kr/static/2018/12/29/700/edv548sos42ue7wp6u08.jpg
			//   https://img.insight.co.kr/static/2018/12/29/edv548sos42ue7wp6u08.jpg -- doesn't work
			return src.replace(/(\/static\/+[0-9]{4}\/+[0-9]{2}\/+[0-9]{2}\/+)[0-9]+\/+([0-9a-z]+\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "express.de") {
			// https://www.express.de/image/31679172/2x1/940/470/2275037049fb74b6fa44c4b55e066de6/cj/lena-meyer-landrut-im-bh.jpg
			//   https://www.express.de/blob/31679172/f0535c2c40e9d6290b7d6cf282bccb6b/lena-meyer-landrut-im-bh-data.jpg
			return src.replace(/\/+image\/+([0-9]+)\/+[0-9]+x[0-9]+\/+[0-9]+\/+[0-9]+\/+([0-9a-f]+)\/+..\/+([^/.]*)(\.[^/]*)(?:[?#].*)?$/,
							   "/blob/$1/$2/$3-data$4");
		}

		if (domain === "media.news.de") {
			// http://media.news.de/images/856454394/images/be/63/ee255ca42045c85b62175d9b5801/nopic/no_pic/672/395/-/1/-/-/1000/588/-/-/lena-meyer-landrut-vom-frechen-maedchen-zum-glamour-star_856454394_672x395_8b46f289607e7a047dbd72542e69f2ed.jpg
			//   http://www.media.news.de/resources/news.de/news.de/images/be/63/ee255ca42045c85b62175d9b5801.jpg
			//   http://www.news.de/resources/images/be/63/ee255ca42045c85b62175d9b5801.jpg
			//   http://media.news.de/resources/images/be/63/ee255ca42045c85b62175d9b5801.jpg
			// http://media.news.de/resources/thumbs/ef/c8/856261941_736x414/hat-andrea-kiewel-einen-behinderten-beleidigt-1523439569.jpg
			return src.replace(/:\/\/[^/]*\/(?:images\/+[0-9]+|resources)\/+images\/+([0-9a-f]{2}\/+[0-9a-f]{2}\/+)([0-9a-f]+)\/+.*(\.[^/.]*)(?:[?#].*)?$/,
							   "://media.news.de/resources/images/$1$2$3");
		}

		if (domain === "store.live.ksmobile.net") {
			// http://store.live.ksmobile.net/small/liveme/3b956963928ea65b4798bc8bb42e7907_icon.jpeg
			//   http://store.live.ksmobile.net/big/liveme/3b956963928ea65b4798bc8bb42e7907_icon.jpeg
			//   http://store.live.ksmobile.net/liveme/3b956963928ea65b4798bc8bb42e7907_icon.jpeg
			return src.replace(/(:\/\/[^/]*\/)[a-z]+\/+liveme\/+/, "$1liveme/");
		}

		if (domain === "c.fantia.jp") {
			// https://c.fantia.jp/uploads/fanclub/icon_image/1117/thumb_d937740b-1655-4cbd-854c-02076022988c.jpg
			//   https://c.fantia.jp/uploads/fanclub/icon_image/1117/d937740b-1655-4cbd-854c-02076022988c.jpg
			// https://c.fantia.jp/uploads/fanclub/cover_image/1117/main_f07365c9-7f7f-4496-affa-c53b007f6712.jpg
			//   https://c.fantia.jp/uploads/fanclub/cover_image/1117/f07365c9-7f7f-4496-affa-c53b007f6712.jpg
			// https://c.fantia.jp/uploads/plan/image/1422/thumb_108f0476-c541-4cc1-9fe9-938de0346f13.jpg
			//   https://c.fantia.jp/uploads/plan/image/1422/108f0476-c541-4cc1-9fe9-938de0346f13.jpg
			// https://c.fantia.jp/uploads/post/file/4103/main_b880d44f-5766-403b-92d0-60c1624bf5d4.jpg
			//   https://c.fantia.jp/uploads/post/file/4103/b880d44f-5766-403b-92d0-60c1624bf5d4.jpg
			return src.replace(/(\/uploads\/.*\/)[a-z]+_((?:[0-9a-f]+-){4}[0-9a-f]+\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "ehgt.org") {
			// https://ehgt.org/g/blank.gif
			if (/\/g\/+blank\.gif(?:[?#].*)?$/.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}
		}

		if (domain_nowww === "e-hentai.org") {
			// some info (from earlier)
			// https://github.com/tommy351/ehreader-android/wiki/E-Hentai-JSON-API
			// https://github.com/ccloli/E-Hentai-Downloader/wiki/E%E2%88%92Hentai-Image-Viewing-Limits
			// e-hentai.org/fullimg.php?gid=[GID]&page=[Page Number]&key=[Key]
			// gid is number, page is number, key is hex
			// https://e-hentai.org/s/485a375924/905277-99
			// https://e-hentai.org/fullimg.php?gid=882257&page=7&key=...
			//   http://114.33.249.224:18053/h/...-603051-1200-1743-jpg/keystamp=...-.../P099.jpg
			// https://gitee.com/anti/xehentai/blob/master/xeHentai.py
			//   http://exhentai.org/fullimg.php?gid=577354&page=2&key=...

			// thanks to nijaz-lab on github for reporting: https://github.com/qsniyg/maxurl/issues/569
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+(?:lofi\/+)?(s\/+[0-9a-f]+\/+[0-9]+-[0-9]+)(?:[?#].*)?$/,
				query_for_id: "https://e-hentai.org/${id}",
				process: function(done, resp, cache_key) {
					// sm = lofi
					// img = regular
					var match = resp.responseText.match(/<img id="(?:sm|img)" src="(https?:\/\/[^"]+)"/);
					if (!match) {
						console_error(cache_key, "Unable to find regular image match for", resp);
						return done(null, false);
					}

					var mainimage = match[1];

					match = null;
					if (options.rule_specific && options.rule_specific.ehentai_full_image)
						match = resp.responseText.match(/href=["'](https?:\/\/(?:www\.)?e-hentai\.org\/fullimg\.php.*?)["']/);

					if (match) {
						return done([decode_entities(match[1]), mainimage], 60*60);
					} else {
						return done(mainimage, 60*60);
					}
				}
			});
			if (newsrc) return newsrc;
		}

		if (host_domain_nowww === "e-hentai.org" &&	/:\/\/[^/]+\/+s\//.test(options.host_url) &&
			options.element && options.document &&
			options.rule_specific && options.rule_specific.ehentai_full_image) {
			if (options.element.tagName === "IMG" && options.element.id === "img" && options.element.src === src) {
				var els = options.document.getElementsByTagName("a");
				for (let i = 0; i < els.length; i++) {
					var el = els[i];

					if (!/^https?:\/\/(?:www\.)?e-hentai\.org\/fullimg\.php/.test(els[i].href))
						continue;

					return els[i].href;
				}
			}
		}

		if (host_domain_nowww === "e-hentai.org" && /:\/\/[^/]+\/+lofi\/+s\//.test(options.host_url) && options.element &&
			options.rule_specific && options.rule_specific.ehentai_full_image) {
			if (options.element.tagName === "IMG" && options.element.id === "sm" &&	options.element.src === src) {
				return {
					url: options.host_url,
					is_pagelink: true
				};
			}
		}

		if (host_domain_nowww === "e-hentai.org" &&	/:\/\/[^/]*\/+(?:lofi\/+)?g\//.test(options.host_url) && options.element) {
			newsrc = common_functions["get_pagelink_el_matching"](options.element, /^[a-z]+:\/\/[^/]+\/+(?:lofi\/+)?s\/+/);
			if (newsrc) return newsrc;

			// non-lofi will ignore the child el because it's blank.gif, and instead use the div above the a
			if (options.element.tagName === "DIV" && options.element.children.length === 1 && options.element.children[0].tagName === "A") {
				var childel = options.element.children[0];
				if (/^[a-z]+:\/\/[^/]+\/+(?:lofi\/+)?s\/+/.test(childel.href)) {
					return {
						url: childel.href,
						is_pagelink: true
					};
				}
			}
		}

		if (domain === "cdn.zenfolio.net" ||
			domain_nosub === "zenfolio.com") {
			// thanks to KyuJuEX099 for reporting
			// https://www.selfridgephotography.com/fashiongallery
			// https://www.selfridgephotography.com/blog/2013/3/1950s-crime-scene
			// https://cdn.zenfolio.com/zf/img/null.gif
			if (/\/zf\/+img\/+null\./.test(src))
				return {
					url: src,
					bad: "mask"
				};
		}

		if ((domain === "cdn.zenfolio.net" ||
			domain_nosub === "zenfolio.com") && /:\/\/[^/]+\/+cdn[0-9]*\/+pub\//.test(src)) {
			// https://davidbogener.zenfolio.com/img/s/v-3/p1424840861-6.jpg
			// https://davidbogener.zenfolio.com/
			// https://cdn.zenfolio.net/cdn2/pub/uvakqg1m3q3n/0/null/m/xo7hdbxpofq3fbmrsv9b/s/v-3/p3183306634-5.jpg?ts=6VH&tk=BkAA93losjpkbLgkF08hYIRJMPclGX8zGnZrgWoDKqCz7xKEDbCwS7OaJ890omcvn6Z6GhccpweHOtT-egQbvg==&v=2&visitor=3OneGBACzbr2ikINTN6tzRc7mmWaBbQ5myvvnFDbZ__q&auth=exp=1548028799~acl=%2Fcdn2%2Fpub%2Fuvakqg1m3q3n%2F%2A~hmac=5e4317d5c7aea3d4be4f4bb129fe62c1
			//   https://www.zenfolio.com/img/s/v-3/p3183306634-5.jpg
			// https://cdn.zenfolio.net/cdn2/pub/uvakqg1m3q3n/0/null/m/xo7hdbxpofq3fbmrsv9b/s/v-2/p3183306634-1.jpg?ts=6VH&tk=BkAA93losjpkbLgkF08hYIRJMPclGX8zGnZrgWoDKqCz7xKEDbCwS7OaJ890omcvn6Z6GhccpweHOtT-egQbvg==&v=2&visitor=3OneGBACzbr2ikINTN6tzRc7mmWaBbQ5myvvnFDbZ__q&auth=exp=1548028799~acl=%2Fcdn2%2Fpub%2Fuvakqg1m3q3n%2F%2A~hmac=5e4317d5c7aea3d4be4f4bb129fe62c1
			//   https://www.zenfolio.com/img/s/v-2/p3183306634-1.jpg
			// http://www.zenfolio.com/cdn/pub/6rhr1mgujado/0/null/m/kd9huj2ukkmjnzvx2t6y/s7/v165/p2381501363-3.jpg?ts=6VH&tk=33XfJjt33Doahj8eJht_fzXm2gP5K0kMoog0BqgEvkE=
			//   https://www.zenfolio.com/img/s7/v165/p2381501363-3.jpg
			return src.replace(/:\/\/[^/]*\/+cdn[0-9]*\/+pub\/+(?:[^?#]*?)(\/(?:s[0-9]*\/+)?[^/]*\/+p[0-9]+-[0-9]+\.[^/.?#]*)(?:[?#].*)?$/,
							   "://www.zenfolio.com/img$1");
		}

		if (domain_nosub === "zenfolio.com") {
			// if content-length == 3446 && last-modified == Thu, 25 Aug 2016 22:46:02 GMT, then bad (Content Protected by Owner)
			// || Wed, 29 Mar 2017 22:44:53 GMT || Wed, 29 Mar 2017 22:55:29 GMT || Sat, 18 Jun 2016 00:05:23 GMT

			// https://guildvt.zenfolio.com/img/s/v-3/p248503319-3.jpg
			//   https://guildvt.zenfolio.com/img/s/v-3/p248503319-5.jpg
			// http://33outlaw.zenfolio.com/img/s4/v68/p1133398554-3.jpg
			//   http://33outlaw.zenfolio.com/img/s4/v68/p1133398554.jpg
			//   http://33outlaw.zenfolio.com/img/v68/p1133398554.jpg -- 3264x2448 (same size as above)
			// http://mkackman.zenfolio.com/img/v1/p564700966-3.jpg
			//   http://mkackman.zenfolio.com/img/v1/p564700966.jpg
			// thanks to louthecute on discord for reporting:
			// https://www.zenfolio.com/img/s/v-10/p1770634835-2.jpg
			//   https://www.zenfolio.com/img/s/v-10/p1770634835-3.jpg

			regex = /(\/img\/+(?:s[0-9]*\/+)?v-?[0-9]+\/+p[0-9]+)-[0-9]+(\.[^/.?#]*)(?:[?#].*)?$/;
			return fillobj_urls([
				src.replace(regex, "$1$2"),
				src.replace(regex, "$1-7$2"),
				src.replace(regex, "$1-6$2"),
				src.replace(regex, "$1-5$2"),
				src.replace(regex, "$1-4$2"),
				src.replace(regex, "$1-3$2")
			], {
				bad_if: [{
					headers: {
						"content-length": "3446",
						"content-type": "image/png"
					}
				}],
				can_head: false // head only works sometimes, and returns odd last-modified
			});
		}

		if (domain === "gallery.greatandhra.com") {
			// http://gallery.greatandhra.com/upload/15942/thumbs/011533541254.jpg
			//   http://gallery.greatandhra.com/upload/15942/images/011533541254.jpg
			return src.replace(/(\/upload\/+[0-9]+\/+)[a-z]+\/+/, "$1images/");
		}

		if (domain_nowww === "fortstore.net" ||
			// thanks to elvisef on github for reporting: https://github.com/qsniyg/maxurl/issues/601
			// https://imgfrost.net/data_server_2/1421/small/small_VJ.jpg
			//   https://imgfrost.net/data_server_2/1421/big/VJ.jpg
			domain_nowww === "imgfrost.net" ||
			// thanks to elvisef on github for reporting: https://github.com/qsniyg/maxurl/issues/612#issuecomment-759608329
			domain_nowww === "imgblaze.net" ||
			domain_nowww === "imgair.net" ||
			// thanks to elvisef on github for reporting: https://github.com/qsniyg/maxurl/issues/632
			// https://iceimg.net/yteihxux
			domain_nowww === "iceimg.net" ||
			// thanks to elvisef on github for reporting: https://github.com/qsniyg/maxurl/issues/632
			// https://vestimage.site/lysaq
			domain_nowww === "vestimage.site" ||
			// thanks to elvisef on github for reporting: https://github.com/qsniyg/maxurl/issues/632
			// http://www.chaosimg.site/site/v/7166069#4&7166069
			//   https://prcf.fiyar.live/themes/latest/uploads3/pixsense/big/4/tcg-bonuslevel-02-001-21.jpg
			domain_nowww === "chaosimg.site" ||
			domain_nowww === "imgweng.xyz" ||
			domain_nowww === "imgkes.xyz" ||
			domain_nowww === "venpix.xyz" ||
			domain_nowww === "imgwew.xyz" ||
			domain_nowww === "imgvivo.xyz" ||
			domain_nowww === "imgkr.xyz" ||
			domain_nowww === "imgkoi.xyz" ||
			domain_nowww === "imgtigr.xyz" ||
			domain_nowww === "imgbird.xyz" ||
			domain_nowww === "imglin.xyz" ||
			// thanks to anonymous for reporting:
			domain_nowww === "pickjsn.cfd" ||
			domain_nowww === "imgcdfd.sbs" ||
			domain_nosub === "imgopaleno.site" ||
			domain_nowww === "pixsera.net" ||
			domain_nowww === "cloudgallery.net" ||
			// https://prcf.imgbig.xyz/data_server_new/2018/small/small_bot-0321_big01.jpg
			//   https://prcf.imgbig.xyz/data_server_new/2018/big/bot-0321_big01.jpg
			domain_nosub === "imgbig.xyz" ||
			// https://www.fiyar.live/data_server_2/2951/small/small_presenting1(3).jpg
			//   https://www.fiyar.live/data_server_2/2951/big/presenting1(3).jpg
			// thanks to elvisef on github for reporting: https://github.com/qsniyg/maxurl/issues/601#issuecomment-756033145
			// http://www.fiyar.live/data_server_new/2018/small/small_bot-0321_big01.jpg
			//   https://www.fiyar.live/data_server_new/2018/big/bot-0321_big01.jpg
			// http://prcf.fiyar.live/data_server_new/2018/small/small_bot-0321_big01.jpg
			//   https://prcf.fiyar.live/data_server_new/2018/big/bot-0321_big01.jpg
			domain_nosub === "fiyar.live") {
			// https://www.fortstore.net/data_server_2/3703/small/small_14(43).jpg
			//   https://www.fortstore.net/data_server_2/3703/big/14(43).jpg
			newsrc = src.replace(/(\/data_server_(?:[0-9]+|new)\/+[0-9]+\/+)[a-z]+\/+[a-z]+_([^/]*\.[^/.]*)(?:[?#].*)?$/,
								   "$1big/$2");
			if (newsrc !== src)
				return newsrc;

			// https://www.fiyar.live/themes/latest/ssd/small/170/small-78354911_72483519_56381ba9eac.jpg
			//   https://www.fiyar.live/themes/latest/uploads4/pixsense/big/170/78354911_72483519_56381ba9eac.jpg -- uploads1, 2, 3 doesn't work
			// https://www.fiyar.live/themes/latest/ssd/small/679/small-1495733_Cosmid.netEvaGreenEvaGreensFirstSetJan18,2016_004.jpg
			//   https://www.fiyar.live/themes/latest/uploads1/pixsense/big/679/1495733_Cosmid.netEvaGreenEvaGreensFirstSetJan18,2016_004.jpg -- uploads2 works too
			// https://www.fiyar.live/themes/latest/ssd/small/679/small-1495733_Cosmid.netEvaGreenEvaGreensFirstSetJan18,2016_003.jpg
			//   https://www.fiyar.live/themes/latest/uploads3/pixsense/big/679/1495733_Cosmid.netEvaGreenEvaGreensFirstSetJan18,2016_003.jpg
			regex = /\/themes\/+latest\/+ssd\/+small\/+([0-9]+)\/+small-/;

			if (regex.test(src)) {
				return [
					src.replace(regex, "/themes/latest/uploads4/pixsense/big/$1/"),
					src.replace(regex, "/themes/latest/uploads3/pixsense/big/$1/"),
					src.replace(regex, "/themes/latest/uploads2/pixsense/big/$1/")
				];
			}

			newsrc = src.replace(/\/themes\/+latest\/+ssd\/+small\/+small-/, "/themes/default/big/");
			if (newsrc !== src) return newsrc;

			// thanks to elvisef on github for reporting: https://github.com/qsniyg/maxurl/issues/612
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+([a-z0-9]{3,}|site\/+v\/+[0-9]+)(?:[?#].*)?$/,
				query_for_id: "http://" + domain + "/${id}",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/document\.location\.href="(https?:\/\/[^/]+\/+(?:data_server[^/]*\/+[0-9]+\/+big\/+|themes\/+latest\/+uploads[0-9]*\/+pixsense\/+big\/+[0-9]+\/+|themes\/+default\/+big\/+)[^"]+)"/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					return done(match[1], 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "static.jpg.pl") {
			// http://static.jpg.pl/static/photos/327/327982/ad1d9a42adc53a4b1a37f5dd04901e00_normal.jpg
			//   http://static.jpg.pl/static/photos/327/327982/ad1d9a42adc53a4b1a37f5dd04901e00_big.jpg
			//   http://static.jpg.pl/static/photos/327/327982/ad1d9a42adc53a4b1a37f5dd04901e00_original.jpg
			return src.replace(/(\/static\/+photos\/+[0-9a-f]+\/+[0-9a-f]+\/+[0-9a-f]+)_[a-z]+(\.[^/.]*)(?:[?#].*)?$/,
							   "$1_original$2");
		}

		if ((domain_nosub === "nevsepic.com.ua" ||
			 // http://co15.nevseoboi.com.ua/212/21193/thumbs/1460653854-3037898-nevseoboi.com.ua.jpg
			 //   http://co15.nevseoboi.com.ua/212/21193/1460653854-3037898-nevseoboi.com.ua.jpg
			 domain_nosub === "nevseoboi.com.ua") &&
			domain.match(/^c[po][0-9]*\./)) {
			// http://cp16.nevsepic.com.ua/274/27435/thumbs/1475127502-fd0017.jpg
			//   http://cp16.nevsepic.com.ua/274/27435/1475127502-fd0017.jpg
			return src.replace(/(\/[0-9]{3}\/+[0-9]+\/+)thumbs\//, "$1");
		}

		if (domain === "static.pulsk.com" ||
			// https://www.pulsk.com/images/2014/07/10/thumb_320_53be4a6874c28_53be4a6875bc5.jpg
			//   https://www.pulsk.com/images/2014/07/10/53be4a6874c28_53be4a6875bc5.jpg
			domain_nowww === "pulsk.com") {
			// http://static.pulsk.com/images/2018/06/04/thumb_80_15280853215b14bb4944ce3.jpg
			//   http://static.pulsk.com/images/2018/06/04/15280853215b14bb4944ce3.jpg
			return src.replace(/(\/images\/+[0-9]{4}\/+[0-9]{2}\/+[0-9]{2}\/+)thumb_[0-9]+_([^/]*\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain_nowww === "pornchampion.com") {
			// http://pornchampion.com/images/thumbnails/2016/03/08/208085-jpg-44960.jpg
			//   http://pornchampion.com/images/big_images/2016/03/08/208085-jpg-44960.jpg
			return src.replace(/\/images\/+[^/]*\/+([0-9]{4}\/+[0-9]{2}\/+[0-9]{2}\/)/, "/images/big_images/$1");
		}

		if (domain === "cdn.vthumbs.com") {
			// http://cdn.vthumbs.com/thumbs/300px/content/2013-07-12/108230_01.jpg
			//   https://content.pornpics.com/2013-07-12/108230_01.jpg
			return src.replace(/:\/\/[^/]*\/thumbs\/[0-9]+px\/content\//, "://content.pornpics.com/");
		}

		if (domain === "content.pornpics.com" ||
			// https://img.pornpics.com/2016-04-23/348258_01.jpg
			//   https://cdn.pornpics.com/pics1/2016-04-23/348258_01big.jpg
			// https://img.pornpics.com/460/2020-04-07/631822_01.jpg
			//   https://cdn.pornpics.com/pics1/2020-04-07/631822_01big.jpg
			domain === "img.pornpics.com") {
			// https://content.pornpics.com/2013-07-12/108230_01.jpg
			//   https://cdn.pornpics.com/pics/2013-07-12/108230_01big.jpg
			var folder = "pics";
			if (domain === "img.pornpics.com")
				folder = "pics1";
			return src.replace(/:\/\/[^/]*\/+(?:[0-9]+\/+)?([0-9]{4}-[0-9]{2}-[0-9]{2}\/+[0-9]+_[0-9]+)(\.[^/.]*)(?:[?#].*)?$/,
							   "://cdn.pornpics.com/" + folder + "/$1big$2");
		}

		if (domain === "images.pornpics.com" ||
			// http://cdni.shavedpics.com/300/5/238/48003706/48003706_001_c92f.jpg
			//   http://cdni.shavedpics.com/1280/5/238/48003706/48003706_001_c92f.jpg
			domain === "cdni.shavedpics.com" ||
			// thanks to anonymous for reporting:
			// https://cdni.hotnudegirls.net/460/7/272/40857805/40857805_001_4910.jpg
			//   https://cdni.hotnudegirls.net/1280/7/272/40857805/40857805_001_4910.jpg
			domain === "cdni.hotnudegirls.net" ||
			// thanks to vscum on github: https://github.com/qsniyg/maxurl/issues/1191
			// https://cdni.nakedpornpics.com/460/7/387/27743082/27743082_010_35d4.jpg
			//   https://cdni.nakedpornpics.com/1280/7/387/27743082/27743082_010_35d4.jpg
			domain === "cdni.nakedpornpics.com" ||
			// https://cdni.hotnakedwomen.com/460/7/387/27743082/27743082_010_35d4.jpg
			//   https://cdni.hotnakedwomen.com/1280/7/387/27743082/27743082_010_35d4.jpg
			domain === "cdni.hotnakedwomen.com" ||
			// https://cdni.pornpics.com/300/5/167/30752091/30752091_001_2e7f.jpg
			//   https://cdni.pornpics.com/1280/5/167/30752091/30752091_001_2e7f.jpg
			domain === "cdni.pornpics.com") {
			// https://images.pornpics.com/300/201801/16/9671015/9671015_002_9104.jpg
			//   https://images.pornpics.com/1280/201801/16/9671015/9671015_002_9104.jpg
			obj = {
				url: src
			};

			match = src.match(/\/([0-9]{5,})\/\1_[0-9]{3}_[0-9a-f]+\./);
			// doesn't work for all
			if (false && match) {
				obj.extra = {
					page: "https://www.pornpics.com/galleries/" + match[1] + "/"
				};
			}

			newsrc = src.replace(/(:\/\/[^/]*\/)(?:300|460)\/+/, "$11280/");
			if (newsrc !== src)
				obj.url = newsrc;

			return obj;
		}

		if (domain_nowww === "vipissy.com" ||
			// https://media.fistertwister.com/fhg/26289f49024be011b1b32fae4e825a84/thumbs/1.jpg
			//   https://media.fistertwister.com/fhg/26289f49024be011b1b32fae4e825a84/files/1.jpg
			domain === "media.fistertwister.com" ||
			// https://www.peeonher.com/media/fhg/032c423028c1db9d50064e88dc942d60/thumbs/1.jpg
			domain_nowww === "peeonher.com" ||
			// https://media.wetandpissy.com/fhg/fd6fd77a09f6490fa30f902b65123ae5/thumbs/1.jpg
			//   https://media.wetandpissy.com/fhg/fd6fd77a09f6490fa30f902b65123ae5/files/1.jpg
			domain === "media.wetandpissy.com" ||
			// https://media.puffynetwork.com/fhg/5d5e24cd82224dff6987e152fe0e54db/thumbs/1.jpg
			//   https://media.puffynetwork.com/fhg/5d5e24cd82224dff6987e152fe0e54db/files/1.jpg
			domain === "media.puffynetwork.com") {
			// https://www.vipissy.com/media/fhg/8408cd3ceddfa43466a37384c718dfe8/thumbs/1.jpg
			//   https://www.vipissy.com/media/fhg/8408cd3ceddfa43466a37384c718dfe8/files/1.jpg
			return src.replace(/(\/fhg\/+[0-9a-f]+\/+)thumbs\//, "$1files/");
		}

		if (domain_nosub === "explicithd.com" && /^static-cdn/.test(domain)) {
			// https://static-cdn-perfectgonzo.explicithd.com/content/fhg/bfb87c5d9ed25b043794bf0735fab0ea/thumbs/1.jpg
			//   https://static-cdn-perfectgonzo.explicithd.com/content/fhg/bfb87c5d9ed25b043794bf0735fab0ea/files/1.jpg
			return src.replace(/(\/content\/+[^/]*\/+[0-9a-f]{20,}\/+)thumbs\/+/, "$1files/");
		}

		if (domain === "images.porninspector.com") {
			// https://images.porninspector.com/v/vixen-com/gallery01/tmb_01.jpg
			//   https://images.porninspector.com/v/vixen-com/gallery01/01.jpg
			return src.replace(/\/tmb_([^/]*)(?:[?#].*)?$/, "/$1");
		}

		if (domain_nosub === "zoznam.sk") {
			// https://sportky.zoznam.sk/cacheImg/obr/292px/petra-kvitova-australian-open-486381.jpg
			//   https://static.sportky.zoznam.sk/292px/486381.jpg
			// https://feminity.zoznam.sk/cacheImg/obr/213px/jar-styl-inspiracia-jarne-190997.jpg
			//   https://static.feminity.zoznam.sk/original/190997.jpg -- 1250x830, upscaled?
			newsrc = src.replace(/:\/\/([^/.]*)\.[^/]*\/cacheImg\/[^/]*\/([0-9]+px)\/(?:[^/.]*-)?([0-9]+[^/]*)(?:[?#].*)?$/, "://static.$1.zoznam.sk/$2/$3");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "gamesite.zoznam.sk") {
			// https://gamesite.zoznam.sk/images/thumb.php?src=https://images.gamesite.sk/perex/201906/35853.jpg&w=159
			//   https://images.gamesite.sk/perex/201906/35853.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+images\/+thumb\.php\?(?:.*?&)?src=([^&]+).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);

			// why?
			return {
				url: src,
				headers: {
					Referer: ""
				}
			};
		}

		if (domain_nosub === "zoznam.sk") {
			// https://static.sportky.zoznam.sk/292px/486381.jpg
			//   https://static.sportky.zoznam.sk/original/486381.jpg -- upscaled?
			// https://sportky.zoznam.sk/cacheImg/obr/70px/miroslav-satan-slovensko-szlh-486305.jpg
			//   https://static.sportky.zoznam.sk/original/486305.jpg -- not upscaled
			// https://static.feminity.zoznam.sk/675px/71912.jpg
			//   https://static.feminity.zoznam.sk/original/71912.jpg -- not upscaled
			return src.replace(/(:\/\/[^/]*\/)[0-9]+px\//, "$1original/");
		}

		// 521 server is down
		if (domain_nowww === "wallhalla.com" &&
			options && options.cb && options.do_request) {
			// https://wallhalla.com/wallpaper/BLyranBfQGP
			// https://wallhalla.com/thumbs/small/b/BLyranBfQGP.jpg
			//   https://wallpapers.wallhalla.com/BLyranBfQGP_8aTNKy1_faa8d21f/aHR0cHM6Ly9hbHBoYS53YWxsaGF2ZW4uY2Mvd2FsbHBhcGVyLzU1NjYwMg==
			id = src.replace(/.*\/thumbs\/.*\/([^/.]*)[^/]*(?:[?#].*)?$/, "$1");
			if (id !== src) {
				options.do_request({
					url: "https://wallhalla.com/wallpaper/" + id,
					method: "GET",
					onload: function(resp) {
						// function too large for analysis
						// @ts-expect-error
						if (resp.readyState === 4) {
							var match = resp.responseText.match(/ data-wallurl=["']([^"']*)["']/);
							if (match) {
								options.cb(urljoin(src, match[1], true));
							} else {
								options.cb(null);
							}
						}
					}
				});

				return {
					waiting: true
				};
			}
		}

		if (domain_nowww === "artfile.ru") {
			// http://www.artfile.ru/i.php?i=1310644
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+i\.php\?(?:.*&)?i=([0-9]+)(?:[&#].*)?$/,
				query_for_id: "https://www.artfile.ru/i.php?i=${id}",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/top.location.href *= *["'](https?:\/\/i\.artfile\.ru\/[^"']*)["']/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					done({
						url: urljoin(src, match[1], true),
						extra: {
							page: resp.finalUrl
						}
					}, 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "i.artfile.ru") {
			// http://www.artfile.ru/i.php?i=1310644
			// http://i.artfile.ru/650x366_1310644_[www.ArtFile.ru].jpg
			//   http://i.artfile.ru/1920x1080_1310644_[www.ArtFile.ru].jpeg
			// http://i.artfile.ru/s/1199307_260717_39_ArtFile_ru.jpg
			//   http://i.artfile.ru/2048x1365_1199307_[www.ArtFile.ru].jpeg
			id = src.replace(/^[a-z]+:\/\/[^/]*\/[0-9]+x[0-9]+_([0-9]+)_.*$/, "$1");
			if (id === src) {
				id = src.replace(/^[a-z]+:\/\/[^/]*\/s\/+([0-9]+)_[0-9]+_[^/]*(?:[?#].*)?$/, "$1");
			}
			if (id !== src) {
				return {
					url: "http://www.artfile.ru/i.php?i=" + id,
					is_pagelink: true
				};
			}
		}

		if (domain_nowww === "relook.ru" ||
			domain === "st.relook.ru") {
			// https://www.relook.ru/data/cache/2015may/05/47/169514_65312nothumb500.jpg
			//   https://www.relook.ru/data/cache/2015may/05/47/169514_65312.jpg
			// https://st.relook.ru/data/cache/2015may/05/48/169517_24244-150x0.jpg
			//   https://st.relook.ru/data/cache/2015may/05/48/169517_24244.jpg
			return src.replace(/(\/data\/+cache\/+.*)(?:nothumb[0-9]+|-[0-9]+x[0-9]+)(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain_nowww === "izhevsk.ru") {
			// http://izhevsk.ru/forums/icons/forum_pictures/010235/thm/10235884.jpg
			//   http://izhevsk.ru/forums/icons/forum_pictures/010235/10235884.jpg
			return src.replace(/(\/forum_pictures\/+[^/]*\/+)thm\//, "$1");
		}

		if (domain === "img.navodayatimes.in") {
			// https://img.navodayatimes.in/default.aspx?img=http://static.navodayatimes.in/multimedia/15_32_207198549women-with-jewelry81-ll.jpg&width=360
			//   http://static.navodayatimes.in/multimedia/15_32_207198549women-with-jewelry81-ll.jpg
			return src.replace(/^[a-z]+:\/\/[^/]*\/default\.aspx.*?[?&]img=([^&]*).*?$/,
							   "$1");
		}

		if (domain_nowww === "wallmachine.pl") {
			// http://www.wallmachine.pl/media/ecommerce/products/product2797/380x370_false_5055dc478d459fotolia_26202285.jpg
			//   http://www.wallmachine.pl/media/ecommerce/products/product2797/5055dc478d459fotolia_26202285.jpg
			return src.replace(/(\/media\/+ecommerce\/+products\/+product[0-9]+\/+)[0-9]+x[0-9]+_(?:true|false)_/, "$1");
		}

		if (domain === "ds393qgzrxwzn.cloudfront.net") {
			// https://ds393qgzrxwzn.cloudfront.net/resize/m500x500/cat1/img/images/0/yQhZHYs4Za.jpg
			return src.replace(/\/resize\/m[0-9]+x[0-9]+\//, "/");
		}

		if (domain_nowww === "religionpeace.ru" ||
			// https://eurikacosmetics.ru/800/600/https/cdn.trinixy.ru/pics5/20161011/girl_in_hollywood_58.jpg
			//   https://cdn.trinixy.ru/pics5/20161011/girl_in_hollywood_58.jpg
			domain_nowww === "eurikacosmetics.ru") {
			// https://religionpeace.ru/800/600/http/fb.ru//media/i/1/0/5/3/7/6/i/105376_700x438.jpg
			//   http://fb.ru//media/i/1/0/5/3/7/6/i/105376_700x438.jpg
			return src.replace(/^[a-z]+:\/\/[^/]*\/[0-9]+\/+[0-9]+\/+(https?)\/(.*)$/, "$1://$2");
		}

		if (domain_nowww === "fb.ru") {
			// http://fb.ru/misc/i/thumb/n/4/6/1/2/7/8/i/461278.jpg
			//   http://fb.ru/media/i/4/6/1/2/7/8/i/461278.jpg
			// http://fb.ru/media/i/9/4/7/8/6/4/i/947864_240x120.jpg
			//   http://fb.ru/media/i/9/4/7/8/6/4/i/947864.jpg
			// http://fb.ru//media/i/1/0/5/3/7/6/i/105376_700x438.jpg
			//   http://fb.ru//media/i/1/0/5/3/7/6/i/105376.jpg
			return src
				.replace(/\/misc\/+i\/+thumb\/+[^/]*\/+/, "/media/i/")
				.replace(/(\/media\/+i\/+(?:[0-9]+\/+){1,}i\/+[0-9]+)_[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "specialone.co.kr") {
			// http://www.specialone.co.kr/alldata/news/thum_abJIzp.jpg
			//   http://www.specialone.co.kr/alldata/news/abJIzp.jpg
			return src.replace(/(\/alldata\/+[^/]*\/+)thum_([^/]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain === "static.mellbimbo.eu") {
			// http://static.mellbimbo.eu/thumb/2018/06/01/1fNeqSq.jpg.webp
			//   http://static.mellbimbo.eu/files/2018/06/01/1fNeqSq.jpg.webp
			// http://static.mellbimbo.eu//thumb/2014/02/13/1353086-20140213-KLlVo8.jpg
			//   http://static.mellbimbo.eu//files/2014/02/13/1353086-20140213-KLlVo8.jpg
			return {
				url: src.replace(/(:\/\/[^/]*\/+)thumb\//, "$1files/"),
				headers: {
					Origin: "http://mellbimbo.eu",
					Referer: "http://mellbimbo.eu"
				}
			};
		}

		if (domain_nowww === "8xxx.net") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+pictures\/+([0-9]+)(?:-[^/]+)?(?:\.html)?(?:[?#].*)?$/,
				query_for_id: "http://8xxx.net/pictures/${id}",
				process: function(done, resp, cache_key) {
					// TODO: improve?
					var match = resp.responseText.match(/<p><a href=["'](.*?)["']>https?:\/\//);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					return done(match[1], 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "8xxx.net") {
			// http://8xxx.net/pictures/1154721
			// http://8xxx.net/preview/0/115/1154721.jpg
			//   https://i.imgur.com/6e2k4Je.jpg
			// http://8xxx.net/preview/0/87/879802.jpg
			id = src.replace(/^[a-z]+:\/\/[^/]*\/preview\/+[0-9]\/+[0-9]+\/+([0-9]+)\.[^/.]*(?:[?#].*)?$/,
							 "$1");
			if (id !== src) {
				return {
					url: "http://8xxx.net/pictures/" + id,
					is_pagelink: true
				};
			}
		}

		if (domain === "i.frg.im") {
			// https://i.frg.im/rBx5uMgn/naomi-woods-2_600.jpg
			//   https://i.frg.im/rBx5uMgn/naomi-woods-2.jpg
			return src.replace(/_[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1");
		}

		if (domain_nowww === "thehshq.com") {
			// https://thehshq.com/d/239435-2/Rachel-Riley-0741.jpg
			//   https://thehshq.com/d/239434-2/Rachel-Riley-0741.jpg
			regex = /\/d\/+([0-9]+)(-[0-9]+\/+[^/]*)(?:[?#].*)?$/;
			match = src.match(regex);
			if (match) {
				let parsed = parseInt(match[1]);
				return [
					{
						url: src.replace(regex, "/d/" + (parsed - 2) + "$2"),
						norecurse: true
					},
					{
						url: src.replace(regex, "/d/" + (parsed - 1) + "$2"),
						norecurse: true
					}
				];
			}
		}

		// TEGNA
		// most of these domains come from https://github.com/yourduskquibbles/webannoyances
		// (provided by llacb47 on github: https://github.com/qsniyg/maxurl/issues/461)
		if (domain_nosub === "11alive.com" ||
			domain_nosub === "12news.com" ||
			domain_nosub === "12newsnow.com" ||
			domain_nosub === "13newsnow.com" ||
			domain_nosub === "13wmaz.com" ||
			domain_nosub === "9news.com" ||
			// https://media.abc10.com/assets/KXTV/images/03a0e506-918a-420b-acf4-96e5d7bef01b/03a0e506-918a-420b-acf4-96e5d7bef01b_750x422.jpg
			//   https://media.abc10.com/assets/KXTV/images/03a0e506-918a-420b-acf4-96e5d7bef01b/03a0e506-918a-420b-acf4-96e5d7bef01b.jpg
			domain_nosub === "abc10.com" ||
			// https://media.cbs8.com/assets/KFMB/images/7989a21b-212b-4cf2-b5ae-0e1798977c39/7989a21b-212b-4cf2-b5ae-0e1798977c39_750x422.jpg
			//   https://media.cbs8.com/assets/KFMB/images/7989a21b-212b-4cf2-b5ae-0e1798977c39/7989a21b-212b-4cf2-b5ae-0e1798977c39.jpg
			domain_nosub === "cbs8.com" ||
			domain_nosub === "cbs19.tv" ||
			domain_nosub === "firstcoastnews.com" ||
			domain_nosub === "kagstv.com" ||
			domain_nosub === "kare11.com" ||
			domain_nosub === "kcentv.com" ||
			domain_nosub === "kens5.com" ||
			domain_nosub === "kgw.com" ||
			domain_nosub === "khou.com" ||
			// https://media.kiiitv.com/assets/CCT/images/34502fd1-d500-40c7-946c-b09b7126b380/34502fd1-d500-40c7-946c-b09b7126b380_360x203.jpg
			//   https://media.kiiitv.com/assets/CCT/images/34502fd1-d500-40c7-946c-b09b7126b380/34502fd1-d500-40c7-946c-b09b7126b380.jpg
			domain_nosub === "kiiitv.com" ||
			domain_nosub === "king5.com" ||
			domain_nosub === "krem.com" ||
			domain_nosub === "ksdk.com" ||
			domain_nosub === "ktvb.com" ||
			domain_nosub === "kvue.com" ||
			domain_nosub === "myfoxzone.com" ||
			domain_nosub === "newscentermaine.com" ||
			domain_nosub === "thv11.com" ||
			domain_nosub === "wbir.com" ||
			domain_nosub === "wcnc.com" ||
			domain_nosub === "wfaa.com" ||
			domain_nosub === "wfmynews2.com" ||
			domain_nosub === "wgrz.com" ||
			domain_nosub === "whas11.com" ||
			domain_nosub === "wltx.com" ||
			domain_nosub === "wtsp.com" ||
			domain_nosub === "wusa9.com" ||
			domain_nosub === "wwltv.com" ||
			domain_nosub === "wzzm13.com") {
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/461
			// https://media.11alive.com/assets/WXIA/images/8497105c-2eaa-4c39-ad95-8d6a28edf5e3/8497105c-2eaa-4c39-ad95-8d6a28edf5e3_360x203.jpg
			//   https://media.11alive.com/assets/WXIA/images/8497105c-2eaa-4c39-ad95-8d6a28edf5e3/8497105c-2eaa-4c39-ad95-8d6a28edf5e3.jpg
			if (/^media\./.test(domain)) {
				return src.replace(/(\/assets\/+[A-Z]+\/+images\/+[-0-9a-f]{20,}\/+[-0-9a-f]{20,})_[0-9]+x[0-9]+(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
			}

			// https://www.wusa9.com/img/resize/content.wusa9.com/photo/2014/04/17/1397787532000-BlR0hBpCcAASCZn_4397010_ver1.0.jpg?mode=pad&bgcolor=000000&scale=both&width=360&height=203
			//   http://content.wusa9.com/photo/2014/04/17/1397787532000-BlR0hBpCcAASCZn_4397010_ver1.0.jpg
			// https://www.11alive.com/img/resize/content.11alive.com/photo/2016/12/13/GettyImages-628353178_1481633240721_7330683_ver1.0.jpg?mode=pad&bgcolor=000000&scale=both&width=1140&height=641
			//   http://content.11alive.com/photo/2016/12/13/GettyImages-628353178_1481633240721_7330683_ver1.0.jpg
			// https://www.wfmynews2.com/img/resize/media.wfmynews2.com/assets/WFMY/images/f472ad72-388e-42c0-9fce-5517164d6513/f472ad72-388e-42c0-9fce-5517164d6513.png?mode=pad&bgcolor=000000&scale=both&width=750&height=422
			//   http://media.wfmynews2.com/assets/WFMY/images/f472ad72-388e-42c0-9fce-5517164d6513/f472ad72-388e-42c0-9fce-5517164d6513.png
			if (domain_nowww === domain_nosub) {
				newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+img\/+resize\/+([^/]*\.[^/]*\/.*?)(?:[?#].*)?$/, "$1");
				if (newsrc !== src)
					return add_http(newsrc);
			}
		}

		if (domain_nowww === "celeb6free.com" ||
			// https://www.celeb-for-free.com/pics/celeb2432/pics/tn_rachel_bilson_01.jpg
			//   https://www.celeb-for-free.com/pics/celeb2432/pics/rachel_bilson_01.jpg
			domain_nowww === "celeb-for-free.com") {
			// http://www.celeb6free.com/pics/celeb6157/pics/tn_margot_robbie_01.jpg
			//   http://www.celeb6free.com/pics/celeb6157/pics/margot_robbie_01.jpg
			newsrc = src.replace(/\/pics\/+tn_([^/]*)(?:[?#].*)?$/, "/pics/$1");
			if (newsrc !== src) {
				return {
					url: newsrc,
					extra: {
						page: newsrc.replace(/\/pics\/[^/]*$/, "/")
					}
				};
			}
		}

		if (domain === "images.poms.omroep.nl") {
			// https://images.poms.omroep.nl/image/s265/c265x150/646699.png
			//   https://images.poms.omroep.nl/image/646699.png
			// http://images.poms.omroep.nl/image/s720x400/646699.jpg
			//   http://images.poms.omroep.nl/image/646699.jpg
			// relies on recursing
			return src.replace(/\/image\/+(?:s[0-9]+(?:x[0-9]+)?|c[0-9]+(?:x[0-9]+)?)\/+/, "/image/");
		}

		if (domain_nosub === "tvbuzer.com" &&
			domain.match(/^static[0-9]*\./)) {
			// https://static1.tvbuzer.com/images/persons/39/39542f512150331112fbacec904fac88-30022-117-174.jpg
			//   https://static1.tvbuzer.com/images/persons/sources/39/39542f512150331112fbacec904fac88-30022.jpg
			return src.replace(/(\/images\/+[a-z]+\/+)([0-9a-f]+\/+[0-9a-f]+-[0-9]+)-[0-9]+-[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1sources/$2$3");
		}

		if (domain_nosub === "mrskincdn.com" &&
			domain.match(/^assets[0-9]*\./)) {
			// https://assets05.mrskincdn.com/mrskin_data/title/000/000/059/108/close-de192def_featured_image_backdrop.jpg?1547826314
			//   https://assets05.mrskincdn.com/mrskin_data/title/000/000/059/108/close-de192def.jpg?1547826314
			// https://assets05.mrskincdn.com/mrskin_data/title/000/000/059/108/close-9126de63_boxcover.jpg?1547151591
			//   https://assets05.mrskincdn.com/mrskin_data/title/000/000/059/108/close-9126de63.jpg?1547151591
			return src.replace(/(\/[^/]*-[0-9a-f]+)_[a-z_]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nosub === "spankbang.com" &&
			domain.match(/^cdnthumb[0-9]*\./)) {
			// https://cdnthumb4.spankbang.com/200/4/4/4471728-t1.jpg
			//   https://cdnthumb4.spankbang.com/0/4/4/4471728-t1.jpg
			return src.replace(/(:\/\/[^/]*\/)[0-9]+\/+([0-9]\/+[0-9]\/+[0-9]+-t)/, "$10/$2");
		}

		if (domain === "static.spankbang.com") {
			// https://static.spankbang.com/pornstarimg/f/192-250.jpg
			//   https://static.spankbang.com/pornstarimg/f/192.jpg
			return src.replace(/(\/pornstarimg\/+f\/+[0-9]+)-[0-9]+(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nosub === "sb-cd.com" && /^tb[0-9]*\./.test(domain)) {
			// https://tb2.sb-cd.com/w:350/3/9/3906881-t2-s/aria+rebel+playboy+tv+intervie.jpg
			//   https://tb2.sb-cd.com/w:0/3/9/3906881-t2-s/aria+rebel+playboy+tv+intervie.jpg
			//   https://tb2.sb-cd.com/w:0/3/9/3906881-t2/aria+rebel+playboy+tv+intervie.jpg
			newsrc = src
				.replace(/(\/[0-9]+-t[0-9]+)-(?:s|enh)\/+/, "$1/")
				.replace(/(:\/\/[^/]+\/+)w:[0-9]+\/+/, "$1w:0/");
			if (newsrc !== src)
				return newsrc;
		}

		if ((domain_nosub === "sb-cd.com" && /^tbv?[0-9]*\./.test(domain)) ||
			(domain_nosub === "spankbang.com" && /^vcdn-[^-]+(?:-[0-9]+)?\./.test(domain))) {
			match = src.match(/:\/\/[^/]+\/+(?:w:[0-9]+\/+)?[0-9]\/+[0-9]\/+([0-9]+)-/);
			var vidid_numeric, vidid;
			if (match) {
				vidid_numeric = parseInt(match[1]);
				vidid = vidid_numeric.toString(36);

				obj = {
					url: src,
					extra: {page: "https://spankbang.com/" + vidid + "/video/"}
				};
			}

			if (options.cb && options.do_request && match) {
				var get_streamkey_for_vidid = function(vidid, cb) {
					var cache_key = "spankbang_streamkey:" + vidid;
					api_cache.fetch(cache_key, cb, function(done) {
						options.do_request({
							method: "GET",
							url: "https://spankbang.com/" + vidid + "/video/",
							onload: function(resp) {
								if (resp.readyState !== 4)
									return;

								if (resp.status !== 200) {
									console_error(resp);
									return done(null, false);
								}

								match = resp.responseText.match(/data-videoid=["'][0-9]+["']\s+data-streamkey=["']([^"']+)["']/);
								if (match) {
									return done(match[1], 24*60*60);
								} else {
									console_warn("Unable to find match", resp);
									return done(null, false);
								}
							}
						});
					});
				};

				var get_streamdata = function(streamkey, cb) {
					var cache_key = "spankbang_streamdata:" + streamkey;
					api_cache.fetch(cache_key, cb, function(done) {
						options.do_request({
							method: "POST",
							url: "https://spankbang.com/api/videos/stream",
							data: "id=" + streamkey + "&data=0",
							headers: {
								"Origin": "https://spankbang.com",
								"Referer": "https://spankbang.com/", // add /.../video?
								"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
								"X-Requested-With": "XMLHttpRequest"
							},
							onload: function(resp) {
								if (resp.readyState !== 4)
									return;

								if (resp.status !== 200) {
									console_error(resp);
									return done(null, false);
								}

								try {
									var response = JSON_parse(resp.responseText);
									return done(response, 6*60*60);
								} catch (e) {
									console_error(e, resp);
									return done(null, false);
								}
							}
						});
					});
				};

				var find_largest_from_streamdata = function(streamdata) {
					var sizes = [
						"4k",
						"1080p",
						"720p",
						"480p",
						"360p",
						"320p",
						"240p",
						"144p"
					];

					var largestsize = 100;

					for (var key in streamdata) {
						if (!streamdata[key] || streamdata[key].length === 0)
							continue;

						var ourindex = array_indexof(sizes, key);
						if (ourindex >= 0 && ourindex < largestsize)
							largestsize = ourindex;
					}

					if (largestsize < sizes.length) {
						return streamdata[sizes[largestsize]][0];
					}

					return null;
				};

				var get_norm_sb_url = function(url) {
					return url.replace(/.*\/([0-9]+-[0-9]+[a-z]+\.[^/.?]+)(?:[?#].*)?$/, "$1");
				};

				get_streamkey_for_vidid(vidid, function(streamkey) {
					// function too large for analysis
					// @ts-expect-error
					if (!streamkey)
						return options.cb(obj);

					get_streamdata(streamkey, function(streamdata) {
						if (!streamdata)
							return options.cb(obj);

						var largest = find_largest_from_streamdata(streamdata);

						if (get_norm_sb_url(largest) !== get_norm_sb_url(src)) {
							obj.url = largest;
						}

						options.cb(obj);
					});
				});

				return {
					waiting: true
				};
			} else if (match) {
				return options.cb(obj);
			}
		}

		if (domain_nowww === "kosova-sot.info" ||
			// https://www.botasot.info/media/botasot.info/images/2019/August/21/auto_beberexzha1566420677.jpg
			//   https://www.botasot.info/media/botasot.info/images/2019/August/21/beberexzha1566420677.jpg
			domain_nowww === "botasot.info" ||
			// https://www.syri.net/uploads/syri.net/images/2019/May/02/auto__106467110_bebe9761556781547.jpg
			//   https://www.syri.net/uploads/syri.net/images/2019/May/02/_106467110_bebe9761556781547.jpg
			domain_nowww === "syri.net") {
			// https://www.kosova-sot.info/uploads/images/2018/January/30/230x249_Camila-Cabello-In-Vivienne-Westwood-Couture-2018-Grammy-Awards1517299028.jpg
			//   http://www.kosova-sot.info/uploads/images/2018/January/30/auto_Camila-Cabello-In-Vivienne-Westwood-Couture-2018-Grammy-Awards1517299028.jpg
			//   https://www.kosova-sot.info/uploads/images/2018/January/30/thumb_Camila-Cabello-In-Vivienne-Westwood-Couture-2018-Grammy-Awards1517299028.jpg
			//   https://www.kosova-sot.info/uploads/images/2018/January/30/thumbauto_Camila-Cabello-In-Vivienne-Westwood-Couture-2018-Grammy-Awards1517299028.jpg
			//   https://www.kosova-sot.info/uploads/images/2018/January/30/Camila-Cabello-In-Vivienne-Westwood-Couture-2018-Grammy-Awards1517299028.jpg
			// https://www.kosova-sot.info/uploads/kosova-sot/images/2019/June/24/570x331__106467110_bebe9761561370397.jpg
			//   https://www.kosova-sot.info/uploads/kosova-sot/images/2019/June/24/_106467110_bebe9761561370397.jpg
			return src.replace(/(\/(?:uploads|media)\/+(?:[^/]+\/+)?images\/+[0-9]{4}\/+[A-Z][a-z]+\/+[0-9]+\/+)(?:auto|thumb|thumbauto|[0-9]+x[0-9]+)_([^/]*)(?:[?#].*)?$/, "$1$2");
			//return src.replace(/(\/uploads\/+[^/]+\/+images\/+[0-9]{4}\/+[A-Za-z]+\/+[0-9]{1,2}\/+)[0-9]+x[0-9]+__/, "$1auto__");
		}

		if (domain === "img.mako.co.il") {
			// https://img.mako.co.il/2018/01/29/GettyImages-911499216_c.jpg
			//   https://img.mako.co.il/2018/01/29/GettyImages-911499216.jpg
			// https://img.mako.co.il/2019/05/27/GoTfinale_6_i_reduced.jpg
			//   https://img.mako.co.il/2019/05/27/GoTfinale_6_i.jpg
			return src.replace(/(:\/\/[^/]*\/[0-9]{4}\/+[0-9]{2}\/+[0-9]{2}\/+[^/]*)_(?:[a-z]|reduced)?(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain_nosub === "okeinfo.net" &&
			domain.match(/^img(?:-[^.]*)?\./)) {
			// https://img.okeinfo.net/okz/500/content/2018/01/29/194/1851655/lady-gaga-hingga-camila-cabello-begini-para-seleb-menata-wajah-rambut-mereka-di-red-carpet-grammy-awards-2018-VKBiuESzS9.jpg
			//   https://img.okeinfo.net/content/2018/01/29/194/1851655/lady-gaga-hingga-camila-cabello-begini-para-seleb-menata-wajah-rambut-mereka-di-red-carpet-grammy-awards-2018-VKBiuESzS9.jpg
			// https://img-o.okeinfo.net/okz/500/content/2018/01/29/194/1851655/lady-gaga-hingga-camila-cabello-begini-para-seleb-menata-wajah-rambut-mereka-di-red-carpet-grammy-awards-2018-wn63KzS33f.jpg
			//   https://img-o.okeinfo.net/content/2018/01/29/194/1851655/lady-gaga-hingga-camila-cabello-begini-para-seleb-menata-wajah-rambut-mereka-di-red-carpet-grammy-awards-2018-wn63KzS33f.jpg
			// https://img-z.okeinfo.net/okz/500/library/images/2019/06/17/b5p02cc1e6voowlco7bt_14191.jpg
			//   https://img-z.okeinfo.net/library/images/2019/06/17/b5p02cc1e6voowlco7bt_14191.jpg
			return src.replace(/(:\/\/[^/]*\/)okz\/+[0-9]+\/+([a-z]+\/)/, "$1$2");
			//return src.replace(/\/okz\/+[0-9]+\/+library\/+/, "/library/");
		}

		if (domain_nowww === "freexcafe.com" ||
			// http://www.foxyporn.com/galleries/babes/a13bdtv7/img/3.jpg
			//   http://www.foxyporn.com/galleries/babes/a13bdtv7/pics/pics3.jpg
			domain_nowww === "foxyporn.com") {
			// https://www.freexcafe.com/erotica/metart/excl378q39/img/1.jpg
			//   https://www.freexcafe.com/erotica/metart/excl378q39/pics/pics1.jpg
			// https://www.freexcafe.com/erotica/anew-metart/16ag32fn2y3k/img/bdf266daa315f64275517f9d143d26c2-thumb160x220.jpg
			//   https://www.freexcafe.com/erotica/anew-metart/16ag32fn2y3k/pics/bdf266daa315f64275517f9d143d26c2.jpg
			return src
				.replace(/\/img\/([0-9]+)(\.[^/.]*)(?:[?#].*)?$/, "/pics/pics$1$2")
				.replace(/\/img\/([0-9a-f]+)-thumb[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "/pics/$1$2");
		}

		if (domain === "cdn-webimages.wimages.net") {
			// http://cdn-webimages.wimages.net/0515d01af3e3c0125312c9a852ff1adceba927-thumbnail.jpg
			//   http://cdn-webimages.wimages.net/0515d01af3e3c0125312c9a852ff1adceba927.jpg
			// http://cdn-webimages.wimages.net/0500f01de1cce241634c92ca5813e8ce2958d-retina-thumbnail-large.jpg?v=3
			//   http://cdn-webimages.wimages.net/0500f01de1cce241634c92ca5813e8ce2958d-wm.jpg?v=3 -- watermark
			//   http://cdn-webimages.wimages.net/0500f01de1cce241634c92ca5813e8ce2958d.jpg?v=3
			// http://cdn-webimages.wimages.net/0532bdb9eecbb577465761916eb01a71b87c5d-v5-wm.jpg
			//   http://cdn-webimages.wimages.net/0532bdb9eecbb577465761916eb01a71b87c5d.jpg
			return src.replace(/(:\/\/[^/]*\/[0-9a-f]+)(?:-(?:[a-z]+|v[0-9]+)){1,}(\.[^/.]*)$/,
							   "$1$2");
		}

		if (domain === "portal-images.azureedge.net") {
			// https://portal-images.azureedge.net/auctions-2016/srsum10026/images/59735223-7e9e-443a-d225-cab8185672e7.jpg?w=540&h=360
			//   https://portal-images.azureedge.net/auctions-2016/srsum10026/images/59735223-7e9e-443a-d225-cab8185672e7.jpg
			return src.replace(/\/images\/([-0-9a-f]+\.[^/.]*?)(?:[?#].*)?$/, "/images/$1");
		}

		if (domain === "img.goldlive.co.kr") {
			// http://img.goldlive.co.kr/resize_320x180/vod_thumbnail/ncast/20181120/145c5dbc5a77c11a60749bf490cd3b14.png
			//   http://img.goldlive.co.kr/vod_thumbnail/ncast/20181120/145c5dbc5a77c11a60749bf490cd3b14.png
			return src.replace(/\/resize_[0-9]+x[0-9]+\//, "/");
		}

		if (domain_nowww === "nicegirl.io" ||
			domain_nowww === "sexypic.org") {
			// https://nicegirl.io/album/album_012981/t_i_012981_0001.jpg
			//   https://nicegirl.io/album/album_012981/i_012981_0001.jpg
			// https://sexypic.org/album/album_008589/t_i_008589_0001.jpg
			//   https://sexypic.org/album/album_008589/i_008589_0001.jpg
			return src.replace(/(\/album_[0-9]+\/+)t_(i_[^/]*)(?:[?#].*)?$/, "$1$2");
			//return src.replace(/(\/album_[0-9]+\/+)t_i_/, "$1i_");
		}

		if ((domain_nosub === "35photo.ru" ||
			 domain_nosub === "35photo.pro") &&
			src.match(/:\/\/[^/]*\/photos_/)) {
			// https://35photo.ru/photos_col/r2/542/2710490_320r.jpg
			//   https://35photo.ru/photos_main/542/2710490.jpg
			// https://m1.35photo.pro/photos_temp/sizes/603/3018113_800n.jpg
			//   https://35photo.pro/photos_temp/sizes/603/3018113_800n.jpg
			//   https://35photo.pro/photos_main/603/3018113.jpg
			// https://35photo.pro/photos_main/897/4487668.jpg
			// thanks to anonymous for reporting:
			// https://c1.35photo.pro/photos_col/r2/1504/7522253.jpg
			//   https://c1.35photo.pro/photos_main/1504/7522253.jpg
			newsrc = src
				.replace(/:\/\/m[0-9]*\.35photo[^/]*\//, "://35photo.pro/")
				.replace(/\/photos_(?:col|temp)\/+(?:r[0-9]|sizes)\/+([0-9]+\/[0-9]+)(?:_[^/.]*)?(\.[^/.]*)(?:[?#].*)?$/,
							   "/photos_main/$1$2");

			if (newsrc !== src)
				return newsrc;

			match = src.match(/:\/\/[^/]+\/+photos_main\/+[0-9]+\/+([0-9]+)\./);
			if (match) {
				return {
					url: src,
					extra: {page: "https://35photo.pro/photo_" + match[1] + "/"}
				};
			}
		}

		if (domain_nowww === "artfile.me") {
			// https://artfile.me/wallpaper/avtomobili--unsort-apollo-intensa-emozio-1534168.html
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+wallpaper\/+((?:[^/?#]+-)?[0-9]+)\.[^/.]+(?:[?#].*)?$/,
				query_for_id: "https://artfile.me/wallpaper/${id}.html",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/<a href="\/download\/[^/]+\/([0-9]+x[0-9]+)"/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}
					var size = match[1];

					var image = get_meta(resp.responseText, "og:image");
					if (!image) {
						console_error(cache_key, "Unable to find image from", resp);
						return done(null, false);
					}

					image = urljoin(resp.finalUrl, image, true);

					image = image.replace(/\/[0-9]+x[0-9]+\//, "/" + size + "/")
								 .replace(/:\/\/pw\.artfile/, "://i.artfile");

					return done({
						url: image,
						extra: {
							page: resp.finalUrl
						}
					}, 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "pw.artfile.me" || domain === "i.artfile.me") {
			// https://i.artfile.me/wallpaper/19-12-2018/360x225/devushki--unsort--blondinki--svetlovolos-1423954.jpg
			//   https://i.artfile.me/wallpaper/19-12-2018/2560x1600/devushki--unsort--blondinki--svetlovolos-1423954.jpg
			// https://pw.artfile.me/wallpaper/01-02-2018/650x434/eda-kolbasnye-izdeliya-kolbasa-assorti-p-1299787.jpg
			//   https://i.artfile.me/wallpaper/01-02-2018/2560x1706/eda-kolbasnye-izdeliya-kolbasa-assorti-p-1299787.jpg
			id = src.replace(/.*\/wallpaper\/+[0-9]+-[0-9]+-[0-9]{4}\/+[0-9]+x[0-9]+\/+([^/.?#]*).*?$/, "$1");
			if (id !== src) {
				return {
					url: "https://artfile.me/wallpaper/" + id + ".html",
					is_pagelink: true
				};
			}
		}

		if (domain_nosub === "fotokto.ru" && domain.match(/^s[0-9]*\./)) {
			// http://s1.fotokto.ru/photo/large/589/5898195.jpg
			//   http://s1.fotokto.ru/photo/full/589/5898195.jpg
			return src.replace(/\/photo\/+[a-z]+\//, "/photo/full/");
		}

		if (domain_nowww === "500px.com") {
			/*
			PHOTO_GRID_IMAGE_SIZES: ["1", "2", "32", "31", "33", "34", "35", "36", "2048", "4", "14"],
			PHOTO_SIZES: {
				S3_IMG_SIZE_70: 1,
				S3_IMG_SIZE_140: 2,
				S3_IMG_GRID_300: 32,
				S3_IMG_GRID_450: 31,
				S3_IMG_GRID_600: 33,
				S3_IMG_WEB_1000: 34,
				S3_IMG_WEB_1500: 35,
				S3_IMG_WEB_2000: 36,
				S3_IMG_SIZE_XLARGE: 2048,
				S3_IMG_STORE_900: 14
			},
			*/
			// higher than 4096 (e.g. 8192) returns m=900
			let query_500px_api = function(url, cb) {
				var query_obj = {
					url: url,
					json: true
				};

				var do_query = function() {
					api_query("500px_api:" + url, query_obj, cb, function(done, resp, cache_key) {
						if (!resp) {
							return done(null, false);
						} else {
							return done(resp, 60*60);
						}
					});
				};

				if (options.get_cookies) {
					options.get_cookies(url, function(cookies) {
						if (cookies) {
							var cookies_dict = headers_list_to_dict(cookies);
							if (cookies_dict && cookies_dict["x-csrf-token"]) {
								query_obj.headers = {
									"x-csrf-token": cookies_dict["x-csrf-token"]
								};
							}
						}

						do_query();
					});
				} else {
					do_query();
				}
			};


			let query_500px_photo = function(id, cb) {
				let page = "https://500px.com/photo/" + id + "/";

				let query_url =
					"https://api.500px.com/v1/photos?image_size%5B%5D=1&image_size%5B%5D=2&image_size%5B%5D=32&image_size%5B%5D=31&image_size%5B%5D=33&image_size%5B%5D=34&image_size%5B%5D=35&image_size%5B%5D=36&image_size%5B%5D=2048&image_size%5B%5D=4096&image_size%5B%5D=4&image_size%5B%5D=14&expanded_user_info=true&include_tags=true&include_geo=true&include_equipment_info=true&vendor_photos=true&include_licensing=true&include_releases=true&liked_by=1&following_sample=100&ids=" + id
				query_500px_api(query_url, function(data) {
					var obj = {
						url: src,
						extra: {
							page: page
						}
					};

					var sizelist = [0, 1, 2, 32, 31, 33, 14, 34, 35, 36, 2048, 4096];
					var comparesizes = function(a, b) {
						var a_index = array_indexof(sizelist, a);
						if (a_index < 0)
							return false;

						var b_index = array_indexof(sizelist, b);
						if (b_index < 0)
							return false;

						return b_index > a_index;
					};

					try {
						var images = data.photos[id].images;
						page = urljoin(page, data.photos[id].url, true);
						obj.extra.page = page;
						obj.extra.caption = data.photos[id].name || data.photos[id].description;
						var largestsize = 0;
						var largesturl = null;

						for (var i = 0; i < images.length; i++) {
							if (comparesizes(largestsize, images[i].size)) {
								largestsize = images[i].size;
								largesturl = images[i].https_url;
							}
						}

						if (largesturl !== null)
							obj.url = largesturl;
					} catch (e) {
						console_error(e);
						return cb(null);
					}

					return cb(obj);
				});
			};

			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+photo\/+([0-9]+)(?:\/+[^/]*\/*)?(?:[?#].*)?$/,
				run: function(cb, match) {
					query_500px_photo(match[1], cb);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "drscdn.500px.org") {
			// https://drscdn.500px.org/photo/110928613/w%3D70_h%3D70/v2?webp=true&v=5&sig=44ba66ac19d9f5852e30c17e59f45a48c3fd8a00661cc83486506469823d81ad
			//   https://drscdn.500px.org/photo/110928613/q%3D80_m%3D2000/v2?webp=true&sig=2f634d5fb1e3fbdf40c4e7b2e3aa112eba72b7c6c5476f07306c25ff1459cf24
			// https://drscdn.500px.org/photo/155707683/m%3D900/102599ba6f6b6143d74b1f9e593d7559 -- original photo deleted
			// https://drscdn.500px.org/photo/1013960347/q%3D50_h%3D450/v2?sig=70fbcc659af581f0eda4751f12fd7d19a2cc837274c54d1a134aa7e094d2f1a1
			// old rule made some smaller (fixed now):
			// https://drscdn.500px.org/photo/176915829/m%3D2048/v2?webp=true&sig=8901652fb89d3d48171709f0656cbb9c06695375eb1149ba1281e5cba0dc4041 -- 2048x1489
			//   https://drscdn.500px.org/photo/176915829/q%3D80_m%3D2000/v2?webp=true&sig=40351336025465fc6f8fd94d0ac6ae8f8672038a90e5b0c17f138c987f2a05ad -- 2000x1454
			//   https://drscdn.500px.org/photo/176915829/m%3D4096/v2?sig=... -- 2938x2136

			id = src.replace(/^[a-z]+:\/\/[^/]*\/photo\/+([0-9]+)\/.*$/, "$1");
			if (id !== src) {
				return {
					url: "https://500px.com/photo/" + id + "/",
					is_pagelink: true
				};
			}
		}

		if (domain_nowww === "xportsnews.com" ||
			// http://image.xportsnews.com/contents/images/upload/article/2019/0325/thm_1553467878556277.jpg
			//   http://image.xportsnews.com/contents/images/upload/article/2019/0325/1553467878556277.jpg
			domain === "image.xportsnews.com") {
			// http://www.xportsnews.com/contents/images/upload/article/2018/0410/thm_1523320335801841.jpg
			//   http://www.xportsnews.com/contents/images/upload/article/2018/0410/1523320335801841.jpg
			return src.replace(/(\/contents\/+images\/+upload\/+.*\/)thm_/, "$1");
		}

		if (domain === "contents.innolife.net") {
			// http://contents.innolife.net/mobile/img/item/0_m.jpg
			//   http://contents.innolife.net/mobile/img/item/0_l.jpg
			return src.replace(/(\/mobile\/img\/item\/[0-9]+_)[a-z]+(\.[^/.]*)$/, "$1l$2");
		}

		if (domain === "mnews.imaeil.com" ||
			// http://news.imaeil.com/inc/photos/2019/03/25/2019032509044118412_s.jpg
			//   http://news.imaeil.com/inc/photos/2019/03/25/2019032509044118412_l.jpg
			domain === "news.imaeil.com") {
			// http://mnews.imaeil.com/inc/photos/2019/03/25/2019032509044118412_m.jpg
			//   http://mnews.imaeil.com/inc/photos/2019/03/25/2019032509044118412_l.jpg
			return src.replace(/(\/photos\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9]{5,})_[sm](\.[^/.]*)(?:[?#].*)?$/,
							   "$1_l$2");
		}

		if (domain_nowww === "blognews.am") {
			// https://blognews.am/static/news/s/2018/01/515487.jpg
			//   https://blognews.am/static/news/b/2018/01/515487.jpg
			return src.replace(/\/static\/+news\/+[a-z]\/+/, "/static/news/b/");
		}

		if (domain_nowww === "sasisa.ru") {
			// http://sasisa.ru/blog/content/1496810984/ae6861f84153a7cbe04f2fbd5d3d4371_220.jpg
			//   http://sasisa.ru/blog/content/1496810984/ae6861f84153a7cbe04f2fbd5d3d4371.jpg
			return src.replace(/(\/blog\/+content\/+[0-9]+\/+[0-9a-f]+)_[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "i.photographers.ua" ||
			domain_nowww === "photographers.ua") {
			// https://i.photographers.ua/thumbnails/pictures/16586/240x9032301_mal.jpg
			//   https://i.photographers.ua/images/pictures/16586/9032301_mal.jpg
			// https://photographers.ua/thumbnails/pictures/16586/800x627341rab.jpg
			//   https://i.photographers.ua/images/pictures/16586/627341rab.jpg
			// https://i.photographers.ua/thumbnails/users/16586/75xya_kvadrat_mal.jpg
			//   https://i.photographers.ua/images/users/16586/ya_kvadrat_mal.jpg
			// doesn't work for lenta:
			// https://i.photographers.ua/thumbnails/lenta/214/640x68214.jpg
			return src.replace(/\/thumbnails\/+((?:pictures|users)\/+[0-9]+)\/+[0-9]+x([^/.]*\.[^/.]*)(?:[?#].*)?$/,
							   "/images/$1/$2");
		}

		if (domain_nowww === "copia-di-arte.com" &&
			string_indexof(src, "/kunst/") >= 0) {
			// https://www.copia-di-arte.com/kunst/david_dubnitskiy/untitled-8_lo.jpg
			//   https://www.copia-di-arte.com/kunst/david_dubnitskiy/untitled-8.jpg
			return src.replace(/_lo(\.[^/.]*)(?:[?#].*)?$/, "$1");
		}

		if (domain_nowww === "kino-teatr.ru") {
			// https://www.kino-teatr.ru/movie/kadr/15906/pv_163183.jpg
			//   https://www.kino-teatr.ru/movie/kadr/15906/163183.jpg
			return src.replace(/(\/movie\/+kadr\/+[0-9]+\/+)pv_([0-9]+\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nosub === "photosight.ru" &&
			domain.match(/^prv-[0-9]{4}-[0-9]+\./)) {
			// http://prv-2003-12.photosight.ru/17/pv_368951.jpg
			//   http://img-2003-12.photosight.ru/17/368951.jpg
			return src.replace(/:\/\/prv(-.*\/)pv_([0-9]+\.[^/.]*)(?:[?#].*)?$/,
							   "://img$1$2");
		}

		if (domain === "cdn.photosight.ru") {
			// https://photosight.ru/photos/7021524/
			// https://cdn.photosight.ru/img/5/101/7021524_thumb.jpg
			//   https://cdn.photosight.ru/img/5/101/7021524_large.jpg
			//   https://cdn.photosight.ru/img/5/101/7021524_xlarge.jpg
			// https://cdn.photosight.ru/img/c/04c/7020586_mini.jpg?t=1583832066
			//   https://cdn.photosight.ru/img/c/04c/7020586_xlarge.jpg?t=1583832066
			newsrc = src.replace(/(\/img\/+[0-9a-f]\/+[0-9a-f]{3}\/+[0-9]+)_(?:thumb|large|mini)(\.[^/.]+)(?:[?#].*)?$/, "$1_xlarge$2");

			match = src.match(/\/img\/+[0-9a-f]\/+[0-9a-f]{3}\/+([0-9]+)(?:_[a-z]+)?\./);
			if (match) {
				return {
					url: newsrc,
					extra: {page: "https://photosight.ru/photos/" + match[1] + "/"}
				};
			} else {
				return newsrc;
			}
		}

		if (domain === "rs.kantie.org") {
			// https://rs.kantie.org/it/https://i5.hoopchina.com.cn/hupuapp/bbs/274/31712274/thread_31712274_20181229123609_s_80573_w_690_h_994_86382.jpg
			//   https://i5.hoopchina.com.cn/hupuapp/bbs/274/31712274/thread_31712274_20181229123609_s_80573_w_690_h_994_86382.jpg
			return src.replace(/^[a-z]+:\/\/[^/]*\/it\/(https?:)/, "$1");
		}

		if (domain_nowww === "zmut.com") {
			// http://zmut.com/uploads/cache/pins/2014/06/more-money-more-honey-91_213124562196401835-194x.jpeg
			//   http://zmut.com/uploads/pins/2014/06/more-money-more-honey-91_213124562196401835.jpeg
			return src.replace(/\/uploads\/cache\/(pins\/+[0-9]{4}\/+[0-9]{2}\/+[^/]*)-[0-9]+x(\.[^/.]*)(?:[?#].*)?$/,
							   "/uploads/$1$2");
		}

		if (domain_nosub === "2photo.ru" &&
			domain.match(/^i[0-9]*\./)) {
			// http://i2.2photo.ru/medium/3/s/559587.jpg
			//   http://i2.2photo.ru/3/s/559587.jpg
			return src.replace(/(:\/\/[^/]*)\/[a-z]+\/+(.\/+.\/+[0-9]+\.)/, "$1/$2");
		}

		if (domain === "m.salon24.pl") {
			// https://m.salon24.pl/553abc32dac438994478a43018fca202,750,0,0,0.jpg
			//   https://m.salon24.pl/553abc32dac438994478a43018fca202.jpg
			return src.replace(/(:\/\/[^/]*\/[0-9a-f]+)(?:,[0-9]+){4}(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "cdn.fishki.net" ||
			domain === "cdn-tn.fishki.net") {
			// https://cdn.fishki.net/upload/post/201508/05/1618865/tn/1396454981-559600-3500x2278.jpg
			//   https://cdn.fishki.net/upload/post/201508/05/1618865/1396454981-559600-3500x2278.jpg
			// https://cdn-tn.fishki.net/20/upload/post/201508/05/1618865/tn/1396454981-559600-3500x2278.jpg
			//   https://cdn.fishki.net/upload/post/201508/05/1618865/1396454981-559600-3500x2278.jpg
			// https://cdn.fishki.net/upload/post/2018/02/06/2504234/gallery/tn/mimoroli.jpg
			//   https://cdn.fishki.net/upload/post/2018/02/06/2504234/gallery/mimoroli.jpg
			// https://cdn.fishki.net/upload/post/2016/11/22/2142867/tn/mdrum-frog-conga-1-0.jpg
			//   https://cdn.fishki.net/upload/post/2016/11/22/2142867/mdrum-frog-conga-1-0.jpg
			return src
				.replace(/(\/upload\/+post\/+[0-9]{6}\/+[0-9]{2}\/+[0-9]+\/+)tn\/+/, "$1")
				.replace(/(\/upload\/+post\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9]+\/+(?:gallery\/+)?)tn\/+/, "$1")
				.replace(/:\/\/cdn-tn\.([^/]*\/)(?:[0-9]+\/+)?upload\//, "://cdn.$1upload/");
			//return src.replace(/(\/upload\/+post\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9]+\/+)tn\/+/, "$1");
		}

		if (domain_nowww === "ravshaniya.com") {
			// http://www.ravshaniya.com/uploads/photos/thumbs/800/2f8c01224e4481bc7f553f0f38a11fe5.jpg
			//   http://www.ravshaniya.com/uploads/photos/2f8c01224e4481bc7f553f0f38a11fe5.jpg
			return src.replace(/\/uploads\/+photos\/+thumbs\/+[0-9]+\/+/, "/uploads/photos/");
		}

		if (domain_nowww === "onlyhdwallpapers.com" ||
			// https://hdwallpapers.cat/thumbnail_small/zoe-saldana-actress-people-cool-model-fun-9Gb4.jpg
			domain_nowww === "hdwallpapers.cat") {
			// https://onlyhdwallpapers.com/thumbnail_small/woman-pornstars-kayden-kross-2cSU.jpg
			//   https://onlyhdwallpapers.com/wallpaper/woman-pornstars-kayden-kross-2cSU.jpg
			var cookie = null;
			var watermark = true;
			// TODO: get cookie from page
			if (options.document && options.document.cookie) {
				cookie = options.document.cookie;
				watermark = false;
			}

			return {
				url: src.replace(/(:\/\/[^/]*\/)thumbnail(?:_[a-z]+)?\/+/, "$1wallpaper/"),
				headers: {
					Origin: "https://" + domain,
					Referer: src,
					Cookie: cookie
				},
				problems: {
					watermark: true
				}
			};
		}

		if (domain === "cdn.slushe.com") {
			// https://cdn.slushe.com/thumbs/2/2/7/1/5/22715daf55d805772.mp4/22715daf55d805772.mp4-3.jpg
			newsrc = src.replace(/\/thumbs\/+((?:[0-9a-f]\/+){5}[0-9a-f]+\.mp4)\/+[^/]+(?:[?#].*)?$/, "/videos/$1");
			if (newsrc !== src) {
				return newsrc.replace(/:\/\/cdn\./, "://vcdn.");
			}
		}

		if (domain_nowww === "bestpornbabes.com" ||
			// https://cdn.shesfreaky.com/galleries/9439556937e05b9d47/thumbs/56937e10983fd.jpg
			//   https://cdn.shesfreaky.com/galleries/9439556937e05b9d47/56937e10983fd.jpg
			domain === "cdn.shesfreaky.com" ||
			// https://media.ruleporn.com/media/galleries/147455d77f2183501a/thumbs/5d77f2595879c.jpg
			//   https://media.ruleporn.com/media/galleries/147455d77f2183501a/5d77f2595879c.jpg
			domain === "media.ruleporn.com" ||
			// http://teenplanet.org/media/galleries/596256ebf206e/thumbs/14.PNG
			//   http://teenplanet.org/media/galleries/596256ebf206e/14.PNG
			domain_nowww === "teenplanet.org" ||
			// http://goodsexporn.org/media/galleries/58988fe0ca18e/thumbs/1.jpg
			//   http://goodsexporn.org/media/galleries/58988fe0ca18e/1.jpg
			domain_nowww === "goodsexporn.org" ||
			// https://cdn.slushe.com/galleries/185e24dcdf856fa/thumbs/5e24dd9421299.jpg
			//   https://cdn.slushe.com/galleries/185e24dcdf856fa/5e24dd9421299.jpg
			domain === "cdn.slushe.com" ||
			// thanks to MinuteAd8502 on github: https://github.com/qsniyg/maxurl/issues/850
			// https://media.theync.com/galleries/10993626102b6c998fb0/thumbs/6102b72d70d35.jpg
			//   https://media.theync.com/galleries/10993626102b6c998fb0/6102b72d70d35.jpg
			domain === "media.theync.com" ||
			// https://media.babesource.com/galleries/5cf63225e8fbe/thumbs/101353_005.jpg
			//   https://media.babesource.com/galleries/5cf63225e8fbe/101353_005.jpg
			domain === "media.babesource.com") {
			// http://www.bestpornbabes.com/media/galleries/5962daae49720/thumbs/5.jpg
			//   http://www.bestpornbabes.com/media/galleries/5962daae49720/5.jpg
			return src.replace(/(\/+galleries\/+(?:[0-9a-f]+|[0-9a-zA-Z]+)\/+)thumbs\/+(?:[0-9]+x[0-9]+\/+)?/, "$1");
		}

		if (domain === "cdn.brdmedia.com") {
			// thanks to vscum on github: https://github.com/qsniyg/maxurl/issues/1166
			// https://cdn.brdmedia.com/pinkseeker/galleries/watch-4-beauty/dulce-in-outside-and-inside-2304/thumbs/dulce-in-outside-and-inside-02.jpg
			//   https://cdn.brdmedia.com/pinkseeker/galleries/watch-4-beauty/dulce-in-outside-and-inside-2304/dulce-in-outside-and-inside-02.jpg
			return src.replace(/(\/galleries\/.*\/)thumbs\/+/, "$1");
		}

		if (domain === "staticpopopics.popopics.com") {
			// http://staticpopopics.popopics.com/uploads/thumb/elisha-cuthbert-370837.jpg
			//   http://staticpopopics.popopics.com/uploads/original/elisha-cuthbert-370837.jpg
			// http://staticpopopics.popopics.com/uploads/display/emmy_rossum_13-wallpaper-1920x1200.jpg
			//   http://staticpopopics.popopics.com/uploads/original/emmy_rossum_13-wallpaper-1920x1200.jpg
			return src.replace(/\/uploads\/(?:thumb|display)\//, "/uploads/original/");
		}

		if (domain_nowww === "stopga.me") {
			// https://stopga.me/images/uploads/images/152745/form/2015/09/30/normal_1443601214.jpg
			//   https://stopga.me/images/uploads/images/152745/form/2015/09/30/1443601214.jpg
			// https://stopga.me/images/news/2019/11/01/normal_P2CXecGhPDX893.jpg
			//   https://stopga.me/images/news/2019/11/01/P2CXecGhPDX893.jpg
			return src.replace(/(\/images\/+(?:uploads\/+images|news)\/+[0-9]+\/+.*\/)normal_([^/]+\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nosub === "foap.com" && domain.match(/^cdn[0-9]*\./)) {
			// https://cdn2.foap.com/images/0ebf30c3-52a5-4ebf-8586-229d11a24afe/w640.jpg?1517884767
			//   https://cdn2.foap.com/images/0ebf30c3-52a5-4ebf-8586-229d11a24afe/original.jpg?1517884767
			return src.replace(/(\/images\/+[-0-9a-f]+\/+)[wh][0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1original$2");
		}

		if (domain_nosub === "foap.com" && domain.match(/^images[0-9]*\./)) {
			// https://images01.foap.com/images/0ebf30c3-52a5-4ebf-8586-229d11a24afe/stil.jpg?filename=w1280&of=webp&dw=480
			//   https://cdn2.foap.com/images/0ebf30c3-52a5-4ebf-8586-229d11a24afe/original.jpg
			return src.replace(/:\/\/images[0-9]*(\.foap\.com\/images\/+[-0-9a-f]+\/+)[^/.]*(\.[^/.?#]*)(?:[?#].*)?$/,
							   "://cdn2$1original$2");
		}

		if (domain_nowww === "themepack.me" ||
			// thanks to anonymous for reporting:
			// https://motionbgs.com/i/c/364x205/media/5096/kakashi-hatake-naruto.jpg
			//   https://motionbgs.com/media/5096/kakashi-hatake-naruto.jpg
			domain_nowww === "motionbgs.com") {
			// https://themepack.me/i/c/749x468/media/g/379/elisha-cuthbert-theme-4.jpg
			//   https://themepack.me/media/g/379/elisha-cuthbert-theme-4.jpg
			return src.replace(/\/i\/+c\/+[0-9]+x[0-9]+\/+media\/+/, "/media/");
		}

		if (domain === "static.mycuteasian.com") {
			// https://static.mycuteasian.com/cache/content/pictures/S11208/mycuteasian_S11208_001.320x427.jpg
			//   https://static.mycuteasian.com/content/pictures/S11208/mycuteasian_S11208_001.jpg
			return src.replace(/\/cache\/+(content\/+pictures\/+.*)\.[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "/$1$2");
		}

		if (domain_nowww === "jiji.com") {
			// https://www.jiji.com/news/handmade/special/v4_photos/2017oguriyui_int/2017oguriyui_int-AH9J0057_s.jpg
			//   https://www.jiji.com/news/handmade/special/v4_photos/2017oguriyui_int/2017oguriyui_int-AH9J0057.jpg
			return src.replace(/(\/v[0-9]*_photos\/.*)_[sm](\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "storage.mantan-web.jp" ||
			// thanks to Broly and fireattack on discord:
			// https://storage.mainichikirei.jp/images/2022/06/12/20220612dog00m100000000c/001_size9.jpg
			//   https://storage.mainichikirei.jp/images/2022/06/12/20220612dog00m100000000c/001_size10.jpg
			domain === "storage.mainichikirei.jp") {
			// https://storage.mantan-web.jp/images/2018/01/16/20180116dog00m200019000c/001_size6.jpg
			//   https://storage.mantan-web.jp/images/2018/01/16/20180116dog00m200019000c/001_size10.jpg
			// https://storage.mantan-web.jp/images/2018/01/16/20180116dog00m200019000c/002_thumb.jpg
			//   https://storage.mantan-web.jp/images/2018/01/16/20180116dog00m200019000c/002_size10.jpg
			// https://storage.mantan-web.jp/images/2017/02/25/20170225dog00m200018000c/001_thumb2.jpg
			//   https://storage.mantan-web.jp/images/2017/02/25/20170225dog00m200018000c/001_size10.jpg
			// thanks to nimbuz on discord:
			// https://mantan-web.jp/article/20210613dog00m200016000c.html
			// https://storage.mantan-web.jp/images/2021/06/13/20210613dog00m200016000c/001_size6.jpg
			//   https://storage.mantan-web.jp/images/2021/06/13/20210613dog00m200016000c/001_size8.jpg -- size10 doesn't exist
			// https://mantan-web.jp/article/20201002dog00m200077000c.html
			// https://storage.mantan-web.jp/images/2021/06/11/20210611dog00m200000000c/003_size4.jpg
			//   https://storage.mantan-web.jp/images/2021/06/11/20210611dog00m200000000c/003_size6.jpg
			regex = /(\/[^/]*)_(?:size[0-9]*|thumb[0-9]*)(\.[^/.]*)(?:[?#].*)?$/;
			if (regex.test(src)) {
				return fillobj_urls(replace_sizes(src, [
					src.replace(regex, "$1_size10$2"),
					src.replace(regex, "$1_size9$2"),
					src.replace(regex, "$1_size8$2"),
					src.replace(regex, "$1_size7$2"),
					src.replace(regex, "$1_size6$2")
				]), {
					headers: {
						// without this header, it will return an inferior webp image
						Accept: '*/*'
					}
				});
			}
		}

		if (domain_nowww === "cinra.net") {
			// https://www.cinra.net/uploads/img/news/2018/20180601-majimurigakuen_panel.jpg
			//   https://www.cinra.net/uploads/img/news/2018/20180601-majimurigakuen_full.jpg
			// rule could be tightened
			return src.replace(/(\/uploads\/+img\/+.*)_[a-z]+(\.[^/.]*)(?:[?#].*)?$/, "$1_full$2");
		}

		if ((domain_nosub === "uecdn.es" && /^e00-[a-z]+\./.test(domain)) ||
			// http://estaticos.telva.com/albumes/2016/05/24/mechas-para-el-pelo-celebrities/411442075_extras_albumes_0_m.jpg
			//   http://estaticos.telva.com/albumes/2016/05/24/mechas-para-el-pelo-celebrities/411442075_extras_albumes_0.jpg
			domain === "estaticos.telva.com") {
			// https://e00-telva.uecdn.es/albumes/2016/02/09/almuerzo-de-nominados-a-los-oscar-2016/1773429946_extras_albumes_0_inc.jpg
			//   https://e00-telva.uecdn.es/albumes/2016/02/09/almuerzo-de-nominados-a-los-oscar-2016/1773429946_extras_albumes_0.jpg
			// https://e00-telva.uecdn.es/albumes/2016/02/09/almuerzo-de-nominados-a-los-oscar-2016/1773429946_extras_albumes_0_movil.jpg
			//   https://e00-telva.uecdn.es/albumes/2016/02/09/almuerzo-de-nominados-a-los-oscar-2016/1773429946_extras_albumes_0.jpg
			// https://e00-elmundo.uecdn.es/assets/multimedia/imagenes/2015/05/12/14314386920056_104x70.jpg
			//   https://e00-elmundo.uecdn.es/assets/multimedia/imagenes/2015/05/12/14314386920056.jpg
			return src.replace(/_(?:inc|movil|m|[0-9]+x[0-9]+)(\.[^/.]*)(?:[?#].*)?$/, "$1");
		}

		if (domain === "fs.kinomania.ru") {
			// http://fs.kinomania.ru/image/file/person_photo/0/47/047d92929da85bfba2a1e6dbf07b7098.240.301.jpeg
			//   http://fs.kinomania.ru/file/person_photo/0/47/047d92929da85bfba2a1e6dbf07b7098.jpeg
			return src.replace(/\/image(\/+file\/.*\/[0-9a-f]+)\.[0-9]+\.[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "notigape.com") {
			// https://www.notigape.com/thumburl/thumbnail/480x270/outbound/uploads/photos/YZIlsy2stuUoNZ5FKOuA.jpg
			//   https://www.notigape.com/uploads/photos/YZIlsy2stuUoNZ5FKOuA.jpg
			return src.replace(/\/thumburl\/+thumbnail\/+[0-9]+x[0-9]+\/+outbound\/+uploads\/+/, "/uploads/");
		}

		if (domain_nowww === "prdelinky.cz") {
			// http://prdelinky.cz/uploaded/gallery/thumb_1545412143231533_81.jpg
			//   http://prdelinky.cz/uploaded/gallery/1545412143231533_81.jpg
			return src.replace(/\/uploaded\/+gallery\/+thumb_/, "/uploaded/gallery/");
		}

		if (domain_nosub === "selfimg.com.cn" &&
			domain.match(/^img[0-9]*\./)) {
			// http://img0.selfimg.com.cn/vogue100w/2015/08/25/1440494103_6EPurB.jpg
			//   http://img0.selfimg.com.cn/uedvoguecms/2015/08/25/1440494103_6EPurB.jpg
			// http://img0.selfimg.com.cn/vogue210X210/2018/05/22/1527002594_MUbn8y.jpg
			//  http://img0.selfimg.com.cn/uedvoguecms/2018/05/22/1527002594_MUbn8y.jpg
			// http://img2.selfimg.com.cn/vogueminiImageSmall/2015/05/05/1430827381_1nLh65.jpg
			//  http://img2.selfimg.com.cn/uedvoguecms/2015/05/05/1430827381_1nLh65.jpg
			// http://img3.selfimg.com.cn/gq640hLRW/2016/06/22/1466567504_r1DrF6.jpg
			//   http://img3.selfimg.com.cn/GQgalleryNoWatermark/2016/06/22/1466567504_r1DrF6.jpg
			//   http://img3.selfimg.com.cn/uedgqcms/2016/06/22/1466567504_r1DrF6.jpg -- same size, no watermark
			// http://img2.selfimg.com.cn/gq800/2018/07/09/1531128764_oPMMng.jpg
			//   http://img2.selfimg.com.cn/uedgqcms/2018/07/09/1531128764_oPMMng.jpg -- 2000x1322
			//   http://img2.selfimg.com.cn/GQgalleryNoWatermark/2018/07/09/1531128764_oPMMng.jpg -- 2000x1322
			// http://img3.selfimg.com.cn/VOGUEgalleryNoWatermark/2018/09/17/1537198642_L6cIOa.jpg
			//   http://img3.selfimg.com.cn/uedvoguecms/2018/09/17/1537198642_L6cIOa.jpg
			return src
				//.replace(/(:\/\/[^/]*\/)gq[0-9]+[^/]*\/+/, "$1GQgalleryNoWatermark/")
				.replace(/(:\/\/[^/]*\/)gq[0-9]+[^/]*\/+/i, "$1uedgqcms/")
				.replace(/(:\/\/[^/]*\/)vogue[^/]*\//i, "$1uedvoguecms/");
		}

		if (domain === "hp.funrahi.com") {
			// http://hp.funrahi.com/2012/05/rachel-mcadams-leather-at-the-tonight-show-with-jay-leno-10th-february-2012/rachel-mcadams-leather-at-the-tonight-show-with-jay-leno-10th-february-2012-45648_t.jpg
			//   http://hp.funrahi.com/2012/05/rachel-mcadams-leather-at-the-tonight-show-with-jay-leno-10th-february-2012/rachel-mcadams-leather-at-the-tonight-show-with-jay-leno-10th-february-2012-45648.jpg
			// http://hp.funrahi.com/2012/05/rachel-mcadams-leather-at-the-tonight-show-with-jay-leno-10th-february-2012/rachel-mcadams-leather-at-the-tonight-show-with-jay-leno-10th-february-2012-45648_600.jpg
			//   http://hp.funrahi.com/2012/05/rachel-mcadams-leather-at-the-tonight-show-with-jay-leno-10th-february-2012/rachel-mcadams-leather-at-the-tonight-show-with-jay-leno-10th-february-2012-45648.jpg
			return src.replace(/(:\/\/[^/]*\/[0-9]{4}\/+[0-9]{2}\/+[^/]*\/+[^/]*)_(?:t|[0-9]+)(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain === "img.007shoes.com") {
			// http://img.007shoes.com/?img_url=http://pic38.nipic.com/20140216/5311590_183941216000_2.jpg
			//   http://pic38.nipic.com/20140216/5311590_183941216000_2.jpg
			return src.replace(/^[a-z]+:\/\/[^/]*\/\?img_url=(https?:)/, "$1");
		}

		if (domain_nowww === "cineol.net") {
			// https://www.cineol.net/galeria/fotos/thumb90_452_4500.jpg
			//   https://www.cineol.net/galeria/fotos/452_4500.jpg
			return src.replace(/\/fotos\/+thumb[0-9]+_/, "/fotos/");
		}

		if (domain_nowww === "nosolocine.es") {
			// http://www.nosolocine.es/images/galeria/thumbs/23617.jpg
			//   http://www.nosolocine.es/images/galeria/23617.jpg
			return src.replace(/\/images\/+galeria\/+thumbs\/+/, "/images/galeria/");
		}

		if (domain === "pics.filmaffinity.com") {
			// https://pics.filmaffinity.com/Chicas_pesadas-975261028-s200.jpg
			//   https://pics.filmaffinity.com/Chicas_pesadas-975261028-large.jpg
			// https://pics.filmaffinity.com/the_witches-245454819-msmall.jpg
			//   https://pics.filmaffinity.com/the_witches-245454819-mmed.jpg
			//   https://pics.filmaffinity.com/the_witches-245454819-large.jpg
			// https://pics.filmaffinity.com/Edge_of_the_World-359212903-main.jpg
			//   https://pics.filmaffinity.com/Edge_of_the_World-359212903-large.jpg
			// https://pics.filmaffinity.com/seven_kings_must_die-432329372-mtiny.jpg
			//   https://pics.filmaffinity.com/seven_kings_must_die-432329372-large.jpg
			// https://pics.filmaffinity.com/clark_gable-243857803934738-nm_200.jpg
			//   https://pics.filmaffinity.com/clark_gable-243857803934738-nm_large.jpg -- 1440x2160
			// other:
			// https://pics.filmaffinity.com/Uno_de_los_nuestros-978961-full.jpg -- 100x144
			// thanks to anonymous for reporting:
			// https://pics.filmaffinity.com/John_Mulaney_Baby_J_TV-226035658-small.jpg
			//   https://pics.filmaffinity.com/John_Mulaney_Baby_J_TV-226035658-large.jpg -- 810x1200
			return src
				.replace(/-nm_[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "-nm_large$1")
				.replace(/-(?:s[0-9]*|m(?:small|med|tiny)|small|main)(\.[^/.]*)(?:[?#].*)?$/, "-large$1");
		}

		if (domain === "fitsnews.files.wordpress.com") {
			// https://fitsnews.files.wordpress.com/2007/01/rachel-mcadams-sag-awards-2.thumbnail.jpg
			//   https://fitsnews.files.wordpress.com/2007/01/rachel-mcadams-sag-awards-2.jpg
			newsrc = src.replace(/\.thumbnail(\.[^/.]*)(?:[?#].*)?$/, "$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "data.okinny.heypo.net") {
			// http://data.okinny.heypo.net/image/thumb/8ce440263ef7d6c4996467be34ea8011.jpg
			//   http://data.okinny.heypo.net/image/large/8ce440263ef7d6c4996467be34ea8011.jpg
			// http://data.okinny.heypo.net/image/thumb/7ffaf71fd5f997e70d57861c5b097999.jpg
			//   http://data.okinny.heypo.net/image/large/7ffaf71fd5f997e70d57861c5b097999.jpg
			return {
				url: src.replace(/\/image\/+thumb\/+([0-9a-f]+\.[^/.]*)(?:[?#].*)?$/, "/image/large/$1"),
				headers: {
					Referer: "https://okinny.heypo.net/image/12345"
				}
			};
		}

		if (domain_nosub === "mgstage.com" &&
			domain.match(/^(?:spimg[0-9]*|image)\./)) {
			// https://spimg2.mgstage.com/images/shirouto/SIRO/3723/pb_t1_SIRO-3723.jpg
			//   https://image.mgstage.com/images/shirouto/siro/3723/pb_p_siro-3723.jpg
			//   https://image.mgstage.com/images/shirouto/siro/3723/pb_e_siro-3723.jpg
			// https://image.mgstage.com/images/shirouto/siro/3723/cap_t1_0_siro-3723.jpg
			//   https://image.mgstage.com/images/shirouto/siro/3723/cap_e_0_siro-3723.jpg
			return src.replace(/(\/[^/_]*_)[^/_]*(_[^/]*)(?:[?#].*)?$/, "$1e$2");
		}

		if (domain_nosub === "gettextbooks.com" &&
			domain.match(/^img[0-9]*\./)) {
			// https://img2.gettextbooks.com/pi/4921218943/150/400
			//   https://img2.gettextbooks.com/pi/4921218943/999999999/999999999
			return src.replace(/(\/pi\/+[0-9]+\/+)[-0-9]+\/+[-0-9]+(?:\/+)?(?:[?#].*)?$/, "$1999999999/999999999");
		}

		if ((domain_nosub === "y3600.cn" ||
			 // https://img1.y3600.cz/zcrop/160/160/d/file/p/2016/07/16/ffb67ed79a0f323baef2c02e193a384c.jpg
			 //   https://img1.y3600.cz/zresize/999999999999/999999999999/d/file/p/2016/07/16/ffb67ed79a0f323baef2c02e193a384c.jpg -- 600x399, upscaled?
			 //   https://img.y3600.cz/d/file/p/2016/07/16/ffb67ed79a0f323baef2c02e193a384c.jpg
			 domain_nosub === "y3600.cz") && /^img[0-9]*\./.test(domain)) {
			// https://img1.y3600.cn/zcrop/160/160/d/file/p/2016/07/16/ffb67ed79a0f323baef2c02e193a384c.jpg
			//   https://img1.y3600.cn/zresize/999999999999/999999999999/d/file/p/2016/07/16/ffb67ed79a0f323baef2c02e193a384c.jpg
			newsrc = src.replace(/\/z(?:resize|crop)?\/+[0-9]+\/+[0-9]+\//, "/zresize/999999999999/999999999999/");
			if (newsrc !== src)
				return newsrc;

			return src.replace(/:\/\/img[0-9]*\.([^/]+\/)z(?:resize|crop)\/+[0-9]+\/+[0-9]+\/+d\/+/, "://img.$1d/");
		}

		if (domain_nowww === "life.tw" ||
			// https://amazon.life.com.tw/proxy.php?url=https%3A%2F%2Fwww.beauty321.com%2Falbums_photo%2F8101-201812151852475670.jpg
			//   https://www.beauty321.com/albums_photo/8101-201812151852475670.jpg
			domain === "amazon.life.com.tw") {
			// https://life.tw/proxy.php?url=https%3A%2F%2Fwww.beauty321.com%2Falbums_photo%2F8101-201812151852475670.jpg
			//   https://www.beauty321.com/albums_photo/8101-201812151852475670.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/proxy\.php\?url=([^&]*).*?$/, "$1");
			if (newsrc !== src) {
				return decodeURIComponent(newsrc);
			}
		}

		if (domain === "public.onlyfans.com") {
			// https://public.onlyfans.com/files/thumbs/c144/m/mt/mtm/mtmo5goxrqv9ga5vccgeffrmvieqfb2h1588129171/avatar.jpg
			//   https://public.onlyfans.com/files/m/mt/mtm/mtmo5goxrqv9ga5vccgeffrmvieqfb2h1588129171/avatar.jpg
			// thanks to StarCrunchMuncher on reddit:
			// https://public.onlyfans.com/files/thumbs/w760/4/4c/4c1/4c1r07imdr6f7r6vn2pfdklrkeajf7m31569137937/header.jpg
			//   https://public.onlyfans.com/files/4/4c/4c1/4c1r07imdr6f7r6vn2pfdklrkeajf7m31569137937/header.jpg
			newsrc = src.replace(/\/files\/+thumbs\/+[wc][0-9]+\/+/, "/files/");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "thumbs.onlyfans.com") {
			// thanks to anonymous for reporting:
			// https://thumbs.onlyfans.com/public/files/thumbs/c144/a/au/auh/auhfdjr84ievanykemqluqjnptunqcsh1705101851/208521709/avatar.jpg
			//   https://public.onlyfans.com/files/a/au/auh/auhfdjr84ievanykemqluqjnptunqcsh1705101851/208521709/avatar.jpg
			newsrc = src.replace(/:\/\/[^/]+\/+public\/+files\/+thumbs\/+[wc][0-9]+\/+/, "://public.onlyfans.com/files/");
			if (newsrc !== src)
				return newsrc;
		}

		if (host_domain_nosub === "onlyfans.com" &&
			 (domain_nosub === "onlyfans.com" ||
			  domain === "media.onlyfans.com" ||
			  amazon_container === "of2media") && options && options.element && options.do_request && options.cb) {
			// https://onlyfans.com/files/thumbs/w760/1/15/154/154381d588ce8b86f8fa86325ef17efa/header.jpg
			//   https://s3.amazonaws.com/of2media/files/1/15/154/154381d588ce8b86f8fa86325ef17efa/header.jpg
			// doesn't work anymore, signed
			//return src.replace(/:\/\/[^/]*\/(?:of2media\/+)?files\/+thumbs\/+[wh][0-9]+\/+/, "://media.onlyfans.com/files/");

			var get_appkey = function(cb) {
				// TODO: parse https://static.cdn.onlyfans.com/theme/onlyfans/spa/app.js
				// h="onlyfans.com",g="[app-token]",v="https://".concat(h)
				return cb(base64_decode("Lj0zM2Q1N2FkZThjMDJkYmM1YTMzM2RiOTlmZjlhZTI2YQ==").substr(2));
			};

			var onlyfans_api_call = function(url, querystring, referer, cb) {
				get_appkey(function(appkey) {
					if (!appkey)
						return cb(null);

					url = urljoin("https://onlyfans.com/api2/v2", url, false);

					if (querystring) {
						url += "?" + querystring + "&app-token=" + appkey;
					} else {
						url += "?app-token=" + appkey;
					}

					options.do_request({
						url: url,
						method: "GET",
						headers: {
							Referer: referer,
							"Sec-Fetch-Site": "same-origin",
							"Accept": "application/json, text/plain, */*"
						},
						onload: function(result) {
							if (result.readyState !== 4)
								return;

							if (result.status !== 200) {
								console_error(result);
								return cb(null);
							}

							try {
								var json = JSON_parse(result.responseText);
								cb(json);
							} catch (e) {
								console_error(e, result);
								cb(null);
							}
						}
					});
				});
			};

			var get_user = function(username, cb) {
				api_cache.fetch("onlyfans_user:" + username, cb, function(done) {
					onlyfans_api_call("/users/" + username, null, "https://onlyfans.com/" + username, function(data) {
						if (data) {
							return done(data, 1*60*60);
						} else {
							return done(null, false);
						}
					});
				});
			};

			var get_avatar = function(username, cb) {
				get_user(username, function(data) {
					if (data) {
						return cb(data.avatar);
					} else {
						return cb(null);
					}
				});
			};

			var get_avatar_from_a = function(el, cb) {
				var match = el.href.match(/^https?:\/\/[^/]+\/+([^/]+)\/*(?:[?#].*)?$/);
				if (match) {
					get_avatar(match[1], cb);
					return true;
				}

				return false;
			};

			if (options.element.parentElement &&
				(options.element.parentElement.classList.contains("b-avatar") ||
				 options.element.parentElement.classList.contains("g-avatar"))) {
				var dparent = options.element.parentElement.parentElement;
				if (dparent.tagName === "A") {
					if (get_avatar_from_a(dparent, options.cb)) {
						return {
							waiting: true
						};
					}
				} else if (dparent.tagName === "DIV" && dparent.classList.contains("b-profile__user")) {
					// avatar at the top of a user's profile
					var link = dparent.querySelector("a.g-user-realname__wrapper");
					if (link && get_avatar_from_a(link, options.cb)) {
						return {
							waiting: true
						};
					}
				}
			}
		}

		if (domain === "img.mfcimg.com") {
			// https://img.mfcimg.com/photos2/196/19697097/553-495-541-526-10955468.80x80.jpg
			//   https://img.mfcimg.com/photos2/196/19697097/553-495-541-526-10955468.250.jpg
			//   https://img.mfcimg.com/photos2/196/19697097/553-495-541-526-10955468.jpg
			return src.replace(/(\/photos2\/+[0-9]+\/+[0-9]+\/+[-0-9]+)\.[0-9x]+(\.[^/.]*)$/, "$1$2");
		}

		if (domain_nowww === "webnewtype.com") {
			// thanks to fireattack on github (https://github.com/qsniyg/maxurl/issues/34)
			// https://webnewtype.com/rsz/S1/182540/1085543.jpg/w600h450
			//   https://webnewtype.com/rsz/S1/182540/1085543.jpg/w600h450/
			//   https://webnewtype.com/rsz/S1/182540/1085543.jpg
			// https://webnewtype.com/rsz/S1/182559/1085722.jpg/w600h450/
			//   https://webnewtype.com/rsz/S1/182559/1085722.jpg
			// https://webnewtype.com/rsz/S1/181785/1080355.jpg/h100/
			//   https://webnewtype.com/rsz/S1/181785/1080355.jpg
			// https://webnewtype.com/rsz/S1/182524/thumbnail.jpg/w120h120/
			//   https://webnewtype.com/rsz/S1/182524/thumbnail.jpg
			// thanks to fireattack on discord:
			// https://webnewtype.com/media/017/202309/mode2_w240_h240-20230615-%E3%82%BE%E3%83%B31000256_R.jpg
			//   https://webnewtype.com/media/017/202309/mode3_w620-20230615-%E3%82%BE%E3%83%B31000256_R.jpg
			//   https://webnewtype.com/media/017/202309/20230615-%E3%82%BE%E3%83%B31000256_R.jpg
			return {
				url: src
					.replace(/(\/media\/+[0-9]+\/+[0-9]+\/+)(?:_?(?:mode|[wh])[0-9]*)+-/, "$1")
					.replace(/(\/rsz\/+S[0-9]*\/+[0-9]+\/+[^/.]*\.[^/.?#]*)(?:\/[wh][0-9]+.*)?(?:[?#].*)?$/, "$1"),
				can_head: false // returns 404
			};
		}

		if (domain === "cdn.themis-media.com") {
			// http://cdn.themis-media.com/media/global/images/galleries/display/58/58351.jpg
			//   http://cdn.themis-media.com/media/global/images/galleries/full/58/58351.jpg
			return src.replace(/\/media\/+global\/+images\/+galleries\/+[a-z]+\/+/,
							   "/media/global/images/galleries/full/");
		}

		if (domain === "tn.nozomi.la") {
			// https://tn.nozomi.la/2/1e/c39b7b671ca03755ca5277a8fdef68187ca3df4b6392eb22cf4201925e0a11e2.png.jpg
			//   https://i.nozomi.la/2/1e/c39b7b671ca03755ca5277a8fdef68187ca3df4b6392eb22cf4201925e0a11e2.png
			newsrc = src.replace(/:\/\/tn\.([^/]*\/[0-9a-f]+\/+[0-9a-f]+\/+[0-9a-f]+)(\.[^/.]*)(?:\.[^/.]*)(?:[?#].*)?$/,
								 "://i.$1$2");
			if (newsrc !== src) {
				return {
					url: newsrc,
					headers: {
						Referer: "https://nozomi.la/"
					}
				};
			}
		}

		if (domain === "pic.baike.soso.com") {
			// https://pic.baike.soso.com/ugc/baikepic2/0/20181010142648-1675350549_jpeg_520_697_62443.jpg/300
			//   https://pic.baike.soso.com/ugc/baikepic2/0/20181010142648-1675350549_jpeg_520_697_62443.jpg/0
			return src.replace(/(\/baikepic[0-9]*\/+[^/]*\/+[^/]*\/+)[0-9]+(?:[?#].*)?$/, "$10");
		}

		if (domain_nosub === "jpopasia.com" && domain.match(/^i[0-9]*\./)) {
			// https://i1.jpopasia.com/assets/1/30523-kaede-ghig-t.jpg
			//   https://i1.jpopasia.com/assets/1/30523-kaede-ghig.png
			// http://i1.jpopasia.com/news/4/11835-im97idtonw-t.jpg
			//   http://i1.jpopasia.com/news/4/11835-im97idtonw.jpg
			// https://i1.jpopasia.com/albums/4/54155_6g6-t.jpg
			//   https://i1.jpopasia.com/albums/4/54155_6g6.jpg
			return add_extensions(src.replace(/(\/(?:assets|news|albums)\/+[0-9]+\/+[^/]*)-t(\.[^/.]*)(?:[?#].*)?$/, "$1$2"));
			//return src.replace(/(\/news\/+[0-9]+\/+[0-9]+-[0-9a-z]+)-t(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "jpgravure.com" ||
			// http://tiedvirgins.com/galleries/her-first-bondage/tn10.jpg
			//   http://tiedvirgins.com/galleries/her-first-bondage/10.jpg
			domain_nowww === "tiedvirgins.com" ||
			// http://www.hqjpporn.com/galleries/gangbang/miriya-hazuki-asian-spreads-labia-and-gets-vibrator-between-them/tn3.jpg
			//   http://www.hqjpporn.com/galleries/gangbang/miriya-hazuki-asian-spreads-labia-and-gets-vibrator-between-them/3.jpg
			domain_nowww === "hqjpporn.com" ||
			// http://www.thethaigirls.com/galleries/submit/beautiful-girlfriend-moy-strips-to-suck-dick-and-takes-a-huge-facial-and-loves-it/tn1.jpg
			//   http://www.thethaigirls.com/galleries/submit/beautiful-girlfriend-moy-strips-to-suck-dick-and-takes-a-huge-facial-and-loves-it/1.jpg
			domain_nowww === "thethaigirls.com") {
			// http://jpgravure.com/galleries/all-jp-model/yumiko-shaku-asian-in-cute-dress-learns-to-ride-the-new-bike/tn14.jpg
			//   http://jpgravure.com/galleries/all-jp-model/yumiko-shaku-asian-in-cute-dress-learns-to-ride-the-new-bike/14.jpg
			return src.replace(/(\/galleries\/.*\/)tn([0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "highasianporn.com") {
			// http://highasianporn.com/g/thai-girls/busty-thai-beach-slut/tn1.jpg
			//   http://highasianporn.com/g/thai-girls/busty-thai-beach-slut/1.jpg
			return src.replace(/(\/g\/.*\/)tn([0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "asianxxxpics.com" ||
			// https://japanfetishpics.com/japan-legs/pics-166/tn1.jpg
			//   https://japanfetishpics.com/japan-legs/pics-166/1.jpg
			domain_nowww === "japanfetishpics.com" ||
			// http://asianfuckpics.com/sj/000-59/tn1.jpg
			//   http://asianfuckpics.com/sj/000-59/1.jpg
			domain_nowww === "asianfuckpics.com" ||
			// http://www.asianteenpics.com/pics/southeast-asian/thai-beauty-with-hairy-meaty-pussy/tn1.jpg
			//   http://www.asianteenpics.com/pics/southeast-asian/thai-beauty-with-hairy-meaty-pussy/1.jpg
			domain_nowww === "asianteenpics.com" ||
			// http://nudejapangirls.com/girls/gnm-139/tn1.jpg
			//   http://nudejapangirls.com/girls/gnm-139/1.jpg
			domain_nowww === "nudejapangirls.com" ||
			// http://www.japaneseidols.org/cont/natural-look-and-sexy-body-of-an-angel-miyuki-yokoyama/tn10.jpg
			//   http://www.japaneseidols.org/cont/natural-look-and-sexy-body-of-an-angel-miyuki-yokoyama/10.jpg
			domain_nowww === "japaneseidols.org" ||
			// http://promo.spunkyangels.com/kaciejames-uloveme/tn001.jpg
			//   http://promo.spunkyangels.com/kaciejames-uloveme/001.jpg
			domain === "promo.spunkyangels.com") {
			// http://www.asianxxxpics.com/jp/sakurako-loves-to-tease-her-vagina/tn2.jpg
			//   http://www.asianxxxpics.com/jp/sakurako-loves-to-tease-her-vagina/2.jpg
			return src.replace(/\/tn([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/$1");
		}

		if (domain_nowww === "vintage-flash.com") {
			// http://vintage-flash.com/vfg/tammy4/tn01.jpg
			//   http://vintage-flash.com/vfg/tammy4/001.jpg
			return {
				url: src.replace(/(\/vfg\/+[^/]*\/+)tn([0-9]+\.[^/.]*)(?:[?#].*)?$/, "$10$2"),
				headers: {
					Referer: ""
				}
			};
		}

		if (domain_nowww === "1pondo.tv") {
			// https://www.1pondo.tv/assets/sample/032819_827/str_s.jpg
			//   https://www.1pondo.tv/assets/sample/032819_827/str.jpg
			// https://www.1pondo.tv/assets/sample/032819_827/thum_106/1.jpg
			//   https://www.1pondo.tv/assets/sample/032819_827/popu/1.jpg
			return src
				.replace(/(\/assets\/+sample\/+[0-9]+_[0-9]+\/+[^/]*)_s(\.[^/.]*)(?:[?#].*)?$/, "$1$2")
				.replace(/(\/assets\/+sample\/+[0-9]+_[0-9]+\/+)thum_[0-9]+(\/+[0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1popu$2");
		}

		if (host_domain_nosub === "javhd.com" && options.element) {
			if (options.element.tagName === "I" && options.element.classList.contains("border")) {
				return {
					url: origsrc,
					bad: "mask"
				};
			}
		}

		if (domain_nosub === "javhd.com" ||
			// http://cdn.pics.fhg.pussyav.com/33000/1t.jpg
			//   http://cdn.pics.fhg.pussyav.com/33000/1.jpg
			domain_nosub === "pussyav.com" ||
			// http://cdn.pics.fhg.ferame.com/5072/1t.jpg
			domain_nosub === "ferame.com" ||
			// http://cdn.pics.fhg.shiofuky.com/25763/1t.jpg
			//   http://cdn.pics.fhg.shiofuky.com/25763/1.jpg
			domain_nosub === "shiofuky.com" ||
			// http://cdn.pics.fhg.av69.tv/29015/10t.jpg
			domain_nosub === "av69.tv" ||
			// http://cdn.pics.fhg.lingerieav.com/42336/1t.jpg
			//   http://cdn.pics.fhg.lingerieav.com/42336/1.jpg
			// http://fhg.lingerieav.com/42336/1t.jpg
			domain_nosub === "lingerieav.com") {
			// http://fhg.ferame.com/images/th2-border.gif
			if (/\/images\/+th2-border\.gif/.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}

			// http://cdn.pics.fhg.javhd.com/5672/1t.jpg
			//   http://cdn.pics.fhg.javhd.com/5672/1.jpg
			return src.replace(/(\/[0-9]+\/+[0-9]+)t(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "galleries.allgravure.com") {
			// http://galleries.allgravure.com/14025/emi-hasekawa-anything-for-you1/1t.jpg
			//   http://galleries.allgravure.com/14025/emi-hasekawa-anything-for-you1/1.jpg
			return src.replace(/(\/[0-9]+\/+[^/]*\/+[0-9]+)t(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "bravoerotica.com") {
			// http://www.bravoerotica.com/all-gravure/shoko-hamada/tiny-shorts/01t.jpg
			//   http://www.bravoerotica.com/all-gravure/shoko-hamada/tiny-shorts/01.jpg
			return src.replace(/(\/[0-9]+)t(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "japanesepussyclub.com" ||
			// https://www.kabukicho-girls.com/fumino-mizutori/103018-782/thumbnails/Fumino-Mizutori_001_tn.jpg
			//   https://www.kabukicho-girls.com/fumino-mizutori/103018-782/images/Fumino-Mizutori_001.jpg
			domain_nowww === "kabukicho-girls.com") {
			// http://www.japanesepussyclub.com/gal/SKY-254_maki-hojo/thumbnails/IMG_8770_tn.JPG
			//   http://www.japanesepussyclub.com/gal/SKY-254_maki-hojo/images/IMG_8770.JPG
			return {
				url: src.replace(/(\/+[^/]*\/+)thumbnails\/+([^/]*)_tn(\.[^/.]*)(?:[?#].*)?$/, "$1images/$2$3"),
				headers: {
					Referer: "http://" + domain
				}
			};
		}

		if (domain_nowww === "asianthumbs.org") {
			// http://asianthumbs.org/gallery/heyzo/1641/tn/001.jpg
			//   http://asianthumbs.org/gallery/heyzo/1641/001.jpg
			// http://asianthumbs.org/gallery/r18/pppd00722/tn/pppd00722jp-10.jpg
			//   http://asianthumbs.org/gallery/r18/pppd00722/pppd00722jp-10.jpg
			return src.replace(/(\/gallery\/+.*\/+)tn\/+([^/]*\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "pics.r18.com" ||
			// https://pics.dmm.co.jp/digital/video/bgg00003/bgg00003-12.jpg
			//  https://pics.dmm.co.jp/digital/video/bgg00003/bgg00003jp-12.jpg
			// thanks to ggagagg on discord: https://github.com/qsniyg/maxurl/issues/963
			// https://pics.dmm.co.jp/digital/video/h_1575sgkx00009/h_1575sgkx00009-2.jpg
			//   https://pics.dmm.co.jp/digital/video/h_1575sgkx00009/h_1575sgkx00009jp-2.jpg
			domain === "pics.dmm.co.jp" ||
			// https://pics.avdmm.top/digital/video/bgg00003/bgg00003-12.jpg
			//   https://pics.avdmm.top/digital/video/bgg00003/bgg00003jp-12.jpg
			domain === "pics.avdmm.top") {
			// https://pics.r18.com/digital/video/118sksk00031/118sksk00031-1.jpg
			//   https://pics.r18.com/digital/video/118sksk00031/118sksk00031jp-1.jpg
			// https://pics.r18.com/digital/video/miaa00301/miaa00301-5.jpg
			//   https://pics.r18.com/digital/video/miaa00301/miaa00301jp-5.jpg
			// thanks to nimbuz on discord:
			// https://pics.r18.com/digital/video/1mane00046/1mane00046pt.jpg
			//   https://pics.r18.com/digital/video/1mane00046/1mane00046ps.jpg
			//   https://pics.r18.com/digital/video/1mane00046/1mane00046pl.jpg
			newsrc = src.replace(/(\/digital\/+video\/+[0-9a-z_]+[0-9]+\/+[0-9a-z_]+[0-9]+)(-[0-9]+\.[^/.]+)(?:[?#].*)?$/,
								"$1jp$2");
			if (newsrc !== src)
				return newsrc;

			newsrc = src.replace(/(\/digital\/+video\/+[0-9a-z_]+[0-9]+\/+[0-9a-z_]+[0-9]+p)[ts](\.[^/.]+)(?:[?#].*)?$/, "$1l$2");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "pics.dmm.com" ||
			domain === "pics.dmm.co.jp") {
			// http://pics.dmm.com/mono/movie/n_612fxbr80160r/n_612fxbr80160rps.jpg
			//   http://pics.dmm.com/mono/movie/n_612fxbr80160r/n_612fxbr80160rpl.jpg
			// https://pics.dmm.co.jp/livechat/00776976/profile_s.jpg
			return src.replace(/s(\.[^/.]*)$/, "l$1");
		}

		if (domain === "images.anilos.com" ||
			// http://images.nubiles.net/galleries2/dolly_spice/horny-babe/tn/01.jpg
			//   http://images.nubiles.net/galleries2/dolly_spice/horny-babe/01.jpg
			domain === "images.nubiles.net") {
			// http://images.anilos.com/galleries/vanessa_jordan/milf_teacher/tn/vanessa_jordan_s4-06.jpg
			//   http://images.anilos.com/galleries/vanessa_jordan/milf_teacher/vanessa_jordan_s4-06.jpg
			return src.replace(/\/tn\/+([^/]*)(?:[?#].*)?$/, "/$1");
		}

		if (domain_nosub === "cre.ma" && domain.match(/^assets[0-9]*\./)) {
			// http://assets3.cre.ma/p/shebeach-co-kr/reviews/00/00/02/20/96/image1/thumbnail_8ac4a8f36768aff0.jpg
			//   http://assets3.cre.ma/p/shebeach-co-kr/reviews/00/00/02/20/96/image1/8ac4a8f36768aff0.jpg
			return src.replace(/(\/image[0-9]*\/+)thumbnail_([0-9a-f]+\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "cdn.megacountry.livenation.com") {
			// http://cdn.megacountry.livenation.com/production/blog_entry-photo/12632/medium_52f3cf06.jpg
			//   http://cdn.megacountry.livenation.com/production/blog_entry-photo/12632/52f3cf06.jpg
			return src.replace(/(\/production\/+[^/]*-photo\/+[0-9]+\/+)[a-z]+_([0-9a-f]+\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "annangelxxx.com") {
			// http://annangelxxx.com/tgp/n/4/thumbnails/tn001.jpg
			//   http://annangelxxx.com/tgp/n/4/originalimages/001.jpg
			return src.replace(/(\/tgp\/+[^/]*\/+[0-9]+\/+)thumbnails\/+tn([0-9]+\.[^/.]*)(?:[?#].*)?$/,
							   "$1originalimages/$2");
		}

		if (domain_nosub === "coedcherry.com" && /^content[0-9]*\./.test(domain)) {
			// https://content7.coedcherry.com/ann-angel/72460/th270x360_4.jpg
			//   https://content7.coedcherry.com/ann-angel/72460/4.jpg
			// https://content4.coedcherry.com/rylsky-art/110346/th270x360_w_1DA5BBBC2F9AE8C4211C9B5EF893C707.jpg
			//   https://content4.coedcherry.com/rylsky-art/110346/w_1DA5BBBC2F9AE8C4211C9B5EF893C707.jpg
			// https://content7.coedcherry.com/passion-hd/217507/th270x360_a_savannah_sixx_02.jpg
			//   https://content7.coedcherry.com/passion-hd/217507/savannah_sixx_02.jpg
			return src
				.replace(/\/th[0-9]+x[0-9]+_(w_[0-9A-F]{10,}\.[^/.]+)(?:[?#].*)?$/, "/$1")
				.replace(/\/th[0-9]+x[0-9]+_(?:a_)?([^/]*?)(?:[?#].*)?$/, "/$1");
		}

		if (domain_nowww === "nicsgalleries.com") {
			// https://www.nicsgalleries.com/g/20/54/04/bdbdc859/thumbs/thumb_als-scan-alexis-crystal-02.jpg
			//   https://www.nicsgalleries.com/g/20/54/04/bdbdc859/als-scan-alexis-crystal-02.jpg
			return src.replace(/(\/g\/.*\/[0-9a-f]+\/+)thumbs\/+thumb_([^/]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "classypussy.com" ||
			// http://onlyhcore.com/gallery/000201_anya_ivy_-_supersize_my_tits/thumbs/thumbs_0440.jpg
			//   http://onlyhcore.com/gallery/000201_anya_ivy_-_supersize_my_tits/0440.jpg
			domain_nowww === "onlyhcore.com" ||
			// https://skankypussy.com/gallery/000080_backstage_with_angelica_heart/thumbs/thumbs_3446-009.jpg
			//   https://skankypussy.com/gallery/000080_backstage_with_angelica_heart/3446-009.jpg
			domain_nosub === "skankypussy.com") {
			// http://classypussy.com/gallery/000173_whitney_conroy_a_glass_dick_container/thumbs/thumbs_957_002.jpg
			//   http://classypussy.com/gallery/000173_whitney_conroy_a_glass_dick_container/957_002.jpg
			return src.replace(/\/thumbs\/+thumbs_/, "/");
		}

		if (domain_nowww === "airlinerphotos.com") {
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/396
			// https://www.airlinerphotos.com/gallery/zurich-2013/thumbs/thumbs_n171dn.jpg
			//   https://www.airlinerphotos.com/gallery/zurich-2013/n171dn.jpg
			newsrc = src.replace(/(:\/\/[^/]+\/+gallery\/+[^/]+\/+)thumbs\/+thumbs_/, "$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nowww === "hiqqu.xxx" ||
			// https://hiqqu.com/files/800x800/www.hiqqu.xxx-41cf2074e0b8855e8afe0af61993c4d418a35a7b.jpg
			//   https://hiqqu.com/files/www.hiqqu.xxx-41cf2074e0b8855e8afe0af61993c4d418a35a7b.jpg
			domain_nowww === "hiqqu.com") {
			// https://hiqqu.xxx/files/100x100/www.hiqqu.xxx-06c4b703d69d228092de100dd2d3a11e07821707.jpg
			//   https://hiqqu.xxx/files/www.hiqqu.xxx-06c4b703d69d228092de100dd2d3a11e07821707.jpg
			return src.replace(/\/files\/+[0-9]+x[0-9]+\/+/, "/files/");
		}

		if (domain === "img.chan4chan.com") {
			// http://img.chan4chan.com/img/2016-08-05/tn_article-0-1B0851C200000578-636_634x772.jpg
			//   http://img.chan4chan.com/img/2016-08-05/article-0-1B0851C200000578-636_634x772.jpg
			return {
				url: src.replace(/(\/img\/+[0-9]{4}-[0-9]{2}-[0-9]{2}\/+)tn_([^/]*)(?:[?#].*)?$/, "$1$2"),
				can_head: false // 404
			};
		}

		if (domain_nowww === "pissblog.com") {
			// http://www.pissblog.com/img/blackchick-pissing/tn01.jpg
			//   http://www.pissblog.com/img/blackchick-pissing/01.jpg
			return src.replace(/(\/img\/+[^/]+\/+)tn([0-9]+\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "haxprofiles.com") {
			// http://haxprofiles.com/gallery/caroline-wozniack-nude-new-hot/tnCaroline-Wozniacki-Nude-Sexy-TheFappeningBlog.com-31-624x780_150x270.jpg
			//   http://haxprofiles.com/gallery/caroline-wozniack-nude-new-hot/Caroline-Wozniacki-Nude-Sexy-TheFappeningBlog.com-31-624x780.jpg
			return src.replace(/(\/gallery\/+[^/]+\/+)tn([^/]*)_[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2$3");
		}

		if (domain_nowww === "drago99.com") {
			// http://www.drago99.com/TPG2019/LindseyVonn/tnLindseyVonn5Drago99.JPG
			//   http://www.drago99.com/TPG2019/LindseyVonn/LindseyVonn5Drago99.JPG
			return src.replace(/\/tn([^/]*\.[^/.]*)(?:[?#].*)?$/, "/$1");
		}

		if (domain === "img.indexxx.com") {
			// https://img.indexxx.com/images/thumbs/85x85/models/danniela-1241637.jpg
			//   https://img.indexxx.com/images/models/danniela-1241637.jpg
			return {
				url: src.replace(/\/images\/+thumbs\/+[0-9]+x[0-9]+\/+/, "/images/"),
				headers: {
					Referer: "https://www.indexxx.com/"
				}
			};
		}

		if (domain_nosub === "ero.today" ||
			// http://1by-day.oldax.com/17600/p/0300x0400_03.jpg
			//   http://1by-day.oldax.com/17600/m03.jpg
			domain_nosub === "oldax.com") {
			// http://atkgalleria.ero.today/uniforms/325977/p/0360x0480_02.jpg
			//   http://atkgalleria.ero.today/uniforms/325977/m02.jpg
			// http://atkexotics.ero.today/black-women/291542/p/0752x1004_01.jpg
			//   http://atkexotics.ero.today/black-women/291542/m01.jpg
			newsrc = src.replace(/\/p\/+[0-9]+x[0-9]+_([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/m$1");
			if (newsrc !== src) {
				return {
					url: newsrc,
					headers: {
						Referer: "http://www." + domain_nosub + "/"
					}
				};
			}
		}

		if (domain_nosub === "dreamercdn.com") {
			// https://ht-small.dreamercdn.com/media/14832/1625/300x300.jpg
			//   https://ht-small.dreamercdn.com/media/14832/1625/original.jpg
			return src.replace(/(\/media\/+[0-9]+\/+[0-9]+\/+)[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/,
							   "$1original$2");
		}

		if (amazon_container === "images.charitybuzz.com" ||
			domain === "images.charitybuzz.com") {
			// https://s3.amazonaws.com/images.charitybuzz.com/images/120540/detail.jpg?1389653020
			//   https://s3.amazonaws.com/images.charitybuzz.com/images/120540/original.jpg?1389653020
			return src.replace(/(\/images\/+[0-9]+\/+)[a-z]+(\.[^/.]*)(?:[?#].*)?$/, "$1original$2");
		}

		if (domain === "media.movieassets.com") {
			// https://media.movieassets.com/static/images/items/people/profiles/500/100/piper-perri-8c9da3f99cfc73a521d21e79a8abae69.jpg
			//   https://media.movieassets.com/static/images/items/people/profiles/8c9da3f99cfc73a521d21e79a8abae69.jpg
			return src.replace(/(\/static\/+images\/+.*\/)[0-9]+\/+[0-9]+\/+(?:[^/]*-)?([0-9a-f]{20,}\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2")
		}

		if (digitalocean_container === "movieassetsdigital") {
			// https://movieassetsdigital.sgp1.cdn.digitaloceanspaces.com/thumb/ca584e585152f32d7eeb9fb1837732ea5566d431
			//   https://movieassetsdigital.sgp1.cdn.digitaloceanspaces.com/original/ca584e585152f32d7eeb9fb1837732ea5566d431
			// https://sgp1.digitaloceanspaces.com/movieassetsdigital/thumb/ca584e585152f32d7eeb9fb1837732ea5566d431
			//   https://sgp1.digitaloceanspaces.com/movieassetsdigital/original/ca584e585152f32d7eeb9fb1837732ea5566d431
			return src.replace(/\/thumb\/+([0-9a-f]{20,})(?:[?#].*)?$/, "/original/$1");
		}

		if (domain_nosub === "happyhair.sk") {
			// https://ucesy-sk.happyhair.sk/celebrity_img/thumbsa/16roberts-2016-04-28-142827.jpg
			//   https://ucesy-sk.happyhair.sk/celebrity_img/16roberts-2016-04-28-142827.jpg
			return src.replace(/\/celebrity_img\/+thumbs[^/]*\/+/, "/celebrity_img/");
		}

		if (domain_nosub === "wn.com" &&
			domain.match(/^e?cdn[0-9]*\./)) {
			// http://cdn5.wn.com/ph/img/8e/bb/d92ffd8931411fff77efcbcf6713-small.jpg
			//   http://cdn5.wn.com/ph/img/8e/bb/d92ffd8931411fff77efcbcf6713-large.jpg
			// https://cdn9.wn.com/pd/ea/ec/aa2271cb084c409efbfaf426d528_small.jpg
			//   https://cdn9.wn.com/pd/ea/ec/aa2271cb084c409efbfaf426d528_large.jpg
			// https://ecdn7.wn.com/ph/img/c2/8c/87c67c08d194727b672adb0833d6-grande.jpg -- 458x374
			//   https://ecdn7.wn.com/ph/img/c2/8c/87c67c08d194727b672adb0833d6-large.jpg -- 2731x2230
			// http://cdn.wn.com/ph/img/12/79/7c18679b47a22f2a4b8c664648d2-small.jpg
			//   http://cdn.wn.com/ph/img/12/79/7c18679b47a22f2a4b8c664648d2-large.jpg
			// https://ecdn3.wn.com/ph/img/fb/82/ed766fb9313e5367a458822d34ad-medium.jpg
			//   https://ecdn3.wn.com/ph/img/fb/82/ed766fb9313e5367a458822d34ad-large.jpg
			// other:
			// https://ecdn9.wn.com/ar/i/bc/1d11442a63c592.jpg
			//   https://ecdn7.wn.com/o25/ph/img/c1/ec/96412bccd6f996894b631ca79e51-large.jpg
			//   https://article.wn.com/view/2006/10/28/Sanjay_Dutt_to_revive_his_banner_with_Beehad/
			//
			// http://cdn9.wn.com/o25/ar/i/12/4d1388cf3e70f2.jpg
			// http://cdn3.wn.com/o25/ar/i/a4/5e656a4221c8bd.jpg
			// http://cdn1.wn.com/o25/ar/i/59/4ee911a1e3ee6e.jpg
			// http://cdn9.wn.com/o25/ar/i/ce/739bc9b12c15a2.jpg
			return src.replace(/(\/[0-9a-f]{20,}[-_])(?:small|medium|grande)(\.[^/.]*)(?:[?#].*)?$/, "$1large$2");
		}

		if (domain_nowww === "atoananet.com.br") {
			// http://www.atoananet.com.br/links/2016/03/03/8-motivos-pelos-quais-amamos-piper-perri_300.jpg
			//   http://www.atoananet.com.br/links/2016/03/03/8-motivos-pelos-quais-amamos-piper-perri.jpg
			return src.replace(/(\/links\/+[0-9]{4}\/+[0-9]{2}\/+[0-9]{2}\/+[^/]*)_[0-9]+(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain === "img.ifcdn.com") {
			// http://img.ifcdn.com/images/ce1cd8af32d9062a15e53039f3f30f312cbbd26f697fff19542cba4a121be222_3.jpg -- 2160x3840
			regex = /(\/images\/+[0-9a-f]+_)[0-9]+(\.[^/.]*)(?:[?#].*)?$/;
			return [
				src.replace(regex, "$13$2"),
				{
					url: src.replace(regex, "$11$2"),
					problems: {
						watermark: true
					}
				}
			];
		}

		if (domain_nowww === "babeprofiles.com") {
			// http://babeprofiles.com/media/models/5/6/f/2/e/56f2ef80b9901/199x259/19.jpg
			//   http://babeprofiles.com/media/models/5/6/f/2/e/56f2ef80b9901/19.jpg
			return src.replace(/(\/media\/+models\/.*\/)[0-9]+x[0-9]+\/+([^/]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain_nosub === "meetmecdna.com") {
			// https://www.meetme.com/member/110794376
			// https://images.meetmecdna.com/thumb_userimages/2016/08/17/1706/thm_phpoVZzm3.jpg
			//   https://images.meetmecdna.com/userimages/2016/08/17/1706/phpoVZzm3.jpg
			// doesn't work for all:
			// http://content1.meetmecdna.com/thumb_userimages/2014/11/15/19/thm_phpZOraYs.jpg
			//   http://content1.meetmecdna.com/userimages/2014/11/15/19/phpZOraYs.jpg -- doesn't work
			// http://images.meetmecdna.com/thumb_userimages/2014/11/15/19/thm_phpZOraYs.jpg -- works
			//   http://images.meetmecdna.com/userimages/2014/11/15/19/phpZOraYs.jpg -- doesn't work
			return src.replace(/\/thumb_userimages(\/+.*\/)thm_/, "/userimages$1");
		}

		if (domain === "images.spicyadulttools.com") {
			// https://images.spicyadulttools.com/girls.twistys.com/preview/dailyupdates/2015/10/27/piperperri-32558/images/thumb/01.jpg
			//   https://images.spicyadulttools.com/girls.twistys.com/preview/dailyupdates/2015/10/27/piperperri-32558/images/full/01.jpg
			return src.replace(/\/images\/+thumb\/+([0-9]+\.[^/.]*)(?:[?#].*)?$/,
							   "/images/full/$1");
		}

		if (domain_nosub === "trafficdeposit.com" &&
			domain.match(/^[sb][0-9]*\./)) {
			// http://s10.trafficdeposit.com/blog/vid/57d2f694dd228/5a4114fc9056e/small.jpg
			//   http://s10.trafficdeposit.com/blog/vid/57d2f694dd228/5a4114fc9056e/full.jpg
			let baseobj = {
				url: src,
				extra: {}
			};

			urls = [];

			// thanks to anonymous for reporting:
			// https://b1.trafficdeposit.com/blog/1/1/img/5f3950a938042/65547dae0daa5/poster.jpg
			match = src.match(/^[a-z]+:\/\/[^/]+\/+blog\/+(?:[0-9]+\/+[0-9]+\/+)?(?:vid|img)\/+(?:[0-9a-f]+|porn-collection)\/+([0-9a-f]{10,})\/+[^/]+$/);
			if (match) {
				id = match[1];

				baseobj.extra.page = "https://sxyprn.com/post/" + id + ".html";
				urls.push({
					url: baseobj.extra.page,
					is_pagelink: true
				});
			}

			newsrc = src.replace(/(\/vid\/+[0-9a-f]+\/+[0-9a-f]+\/+)[a-z]+(\.[^/.]*)(?:[?#].*)?$/,
							   "$1full$2");
			if (newsrc !== src) {
				urls.push(newsrc);
			}

			urls.push(src);

			return fillobj_urls(urls, baseobj);
		}

		if (domain_nosub === "sxyprn.com") {
			match = src.match(/^[a-z]+:\/\/[^/]+\/+post\/+([0-9a-f]{10,})\.html/);
			if (match) {
				id = match[1];

				var get_url_from_sxyprn_vid = function(vid) {
					return "https://sxyprn.com/post/" + vid + ".html";
				};

				var query_sxyprn = function(vid, cb) {
					api_query("sxyprn:" + vid, {
						url: get_url_from_sxyprn_vid(vid)
					}, cb, function(done, resp, cache_key) {
						var match = resp.responseText.match(/data-vnfo='({"[0-9a-f]{10,}":"[^"}]+"})'>/);
						if (!match) {
							console_error(cache_key, "Unable to find match for", resp);
							return done(null, false);
						}

						var json_text = decode_entities(match[1]);
						var json = JSON_parse(json_text);

						if (!(vid in json)) {
							// https://sxyprn.com/post/5ef488825b5ae.html - has 5ef480be32b6a instead, same video though
							console_warn(cache_key, "Unable to find", vid, "in", json);
							vid = Object.keys(json)[0];
							//return done(null, false);
						}

						var get_added_num = function(str) {
							str = str.replace(/[^0-9]/g, "");

							var n = 0;
							for (var i = 0; i < str.length; i++) {
								n += parseInt(str[i]);
							}

							return n;
						};

						var splitted = json[vid].split("/");
						splitted[1] += "8"; // cdn8
						splitted[5] -= parseInt(get_added_num(splitted[6])) + parseInt(get_added_num(splitted[7]));

						var url = urljoin(resp.finalUrl, splitted.join("/"), true);
						return done({
							url: url,
							video: true,
							extra: {
								page: get_url_from_sxyprn_vid(vid)
							},
							headers: {
								Referer: resp.finalUrl
							}
						}, 60*60);
					});
				};

				page_nullobj = {
					url: src,
					is_pagelink: true
				};

				if (options.do_request && options.cb) {
					query_sxyprn(id, function(data) {
						if (!data)
							return options.cb(page_nullobj);

						return options.cb(data);
					});

					return {
						waiting: true
					};
				} else {
					return page_nullobj;
				}
			}
		}

		if (host_domain_nosub === "sxyprn.com" && options.element) {
			if (options.element.tagName === "SPAN" && options.element.classList.contains("player_icon")) {
				return {
					url: origsrc,
					bad: "mask"
				};
			}
		}

		if (domain_nowww === "fullporner.com") {
			// thanks to anonymous for reporting:
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+watch\/+([0-9a-f]{10,})(?:[?#].*)?$/,
				query_for_id: "https://fullporner.com/watch/${id}",
				process: function(done, resp, cache_key) {
					let match = resp.responseText.match(/<iframe[^>]*src="(\/\/[^/]+\/+videox\/+[0-9a-f]+)"/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					return done({url: "https:" + match[1], is_pagelink: true}, 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "xiaoshenke.net") {
			match = src.match(/\/videox\/+([0-9a-f]{10,})(?:[?#].*)?$/);
			if (match) {
				return {
					url: "https://sxyprn.com/post/" + match[1] + ".html",
					is_pagelink: true
				};
			}
		}

		if (domain_nowww === "babepedia.com") {
			// https://www.babepedia.com/galleries-thumbs/Twistys-PiperPerri-PetitePerri/01.jpg
			//   https://www.babepedia.com/galleries/Twistys-PiperPerri-PetitePerri/01.jpg
			// https://www.babepedia.com/pics/Marta%20Riesco_thumb.jpg
			//   https://www.babepedia.com/pics/Marta%20Riesco.jpg
			// https://www.babepedia.com/pics/Elly%20Stark_thumb3.jpg
			//   https://www.babepedia.com/pics/Elly%20Stark.jpg
			return src
				.replace(/\/galleries-thumbs\/+/, "/galleries/")
				.replace(/(\/pics\/+[^/]+)_thumb[0-9]*\./, "$1.");
		}

		if (domain_nowww === "yourdailygirls.com" ||
			// http://www.girlsfordays.com/galleries/ariel_rebel_hot_tub/ariel_rebel_hot_tub_1-tn.jpg
			//   http://www.girlsfordays.com/galleries/ariel_rebel_hot_tub/ariel_rebel_hot_tub_1.jpg
			domain_nowww === "girlsfordays.com" ||
			// https://www.girlznation.com/galleries/keira_croft_zishy/keira_croft_zishy_1-tn.jpg
			//   https://www.girlznation.com/galleries/keira_croft_zishy/keira_croft_zishy_1.jpg
			domain_nowww === "girlznation.com") {
			// http://www.yourdailygirls.com/galleries/ftv-girls/ftv-girls-nina-north-public-duo/ftv-girls-1-tn.jpg
			//   http://www.yourdailygirls.com/galleries/ftv-girls/ftv-girls-nina-north-public-duo/ftv-girls-1.jpg
			return src.replace(/(\/galleries\/.*\/[^/]*)-tn(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "static.ftvgirls.com" ||
			// https://static.ftvmilfs.com/galleries/rita-angelic-white-lace/10-thumb.jpg
			//   https://static.ftvmilfs.com/galleries/rita-angelic-white-lace/10.jpg
			domain === "static.ftvmilfs.com" ||
			domain === "promo.ftvgirls.com") {
			// https://static.ftvgirls.com/galleries/alex-and-nina-bi-kinis/15-thumb.jpg
			//   https://static.ftvgirls.com/galleries/alex-and-nina-bi-kinis/15.jpg
			// https://promo.ftvgirls.com/galleries/alex-and-nina-bi-kinis/15-thumb.jpg
			//   https://promo.ftvgirls.com/galleries/alex-and-nina-bi-kinis/15.jpg
			// https://static.ftvgirls.com/free/summer-all-dolled-up/8ad0f1cb/thumbnails/221x296_004.jpg
			//   https://static.ftvgirls.com/free/summer-all-dolled-up/8ad0f1cb/pictures/content_004.jpg
			return src
				.replace(/(\/galleries\/.*\/[0-9]+)-thumb(\.[^/.]*)(?:[?#].*)?$/, "$1$2")
				.replace(/\/thumbnails\/+[0-9]+x[0-9]+_/, "/pictures/content_");
		}

		if (domain_nosub === "femjoy.com" && /^n[0-9]*\./.test(domain)) {
			// http://n6.femjoy.com/free/114718_umh627_ujh337/thumbs/001.jpg
			//   http://n6.femjoy.com/free/114718_umh627_ujh337/pics/001.jpg
			return src.replace(/(\/free\/+[^/]+\/+)thumbs\/+([0-9]+\.[^/.]+)(?:[?#].*)?$/, "$1pics/$2");
		}

		if (domain_nowww === "candidsplash.com") {
			// http://www.candidsplash.com/candid-galleries-04/shinygf-1/thumbs/06.jpg
			//   http://www.candidsplash.com/candid-galleries-04/shinygf-1/pics/06.jpg
			return src.replace(/(\/candid-galleries-[0-9]+\/+[^/]+\/+)thumbs\/+([0-9]+\.[^/.]+)(?:[?#].*)?$/, "$1pics/$2");
		}

		if (domain === "image.istyle24.com") {
			// http://image.istyle24.com/upload/ProductImage//0000004552/20190325/12859891_M.jpg
			//   http://image.istyle24.com/upload/ProductImage//0000004552/20190325/12859891_L.jpg
			// XS/xs, S/s, M/m, L/l
			return src.replace(/(\/upload\/+ProductImage\/+[0-9]+\/+[0-9]+\/+[0-9]+_(?:[0-9]+_)?)[a-zA-Z]+(\.[^/.]*)(?:[?#].*)?$/,
							   "$1L$2");
		}

		if (domain === "zine.istyle24.com") {
			// http://zine.istyle24.com/App_Themes/FrontThemes/images/common/border_street.gif
			if (/\/App_Themes\/.*\/images\/+common\//.test(src))
				return {
					url: src,
					bad: "mask"
				};

			// http://zine.istyle24.com/FileUpload/Content/636797957602686250_058043.jpg
			//   http://zine.istyle24.com/FileUpload/Content/636797957602686250.jpg
			return src.replace(/(\/FileUpload\/+Content\/+[0-9]{10,})_[0-9]+(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "bbstar.kr") {
			// http://www.bbstar.kr/model/eunpa012s.jpg
			//   http://www.bbstar.kr/model/eunpa012.jpg
			return src.replace(/(\/model\/+[^/]*[0-9]+)s(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain_nosub === "asn.im" && domain.match(/^i[0-9]*\./)) {
			// http://i3.asn.im/Mmmm-_tnd4-b.jpg
			//   http://i3.asn.im/Mmmm-_tnd4.jpg
			// http://i3.asn.im/Thor-s-sister-_tdrq-c.jpg
			//   http://i3.asn.im/Thor-s-sister-_tdrq.jpg
			return src.replace(/(:\/\/[^/]*\/[^/]*)-[a-z](\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain_nowww === "bebzol.com") {
			// https://bebzol.com/thumbs?i=upload%2F%2Frk21_1%2Fcycki%2F%2Fchristina.jpg&nw=100&nh=80&lang=pl
			//   https://bebzol.com/upload//rk21_1/cycki//christina.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/thumbs.*?[?&]i=([^&]*).*?$/, "$1");
			if (newsrc !== src) {
				return urljoin(src, "/" + decodeURIComponent(newsrc), true);
			}
		}

		if (domain_nowww === "thecandidforum.com") {
			// https://www.thecandidforum.com/attachments/899646d1435018031t-20150622_144349_1_edited.jpg
			//   https://www.thecandidforum.com/attachments/899646d1435018031-20150622_144349_1_edited.jpg
			return src.replace(/(\/attachments\/+[0-9a-f]+)t(-[^/]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "hottystop.com" ||
			// https://d3m3u5a3.ssl.hwcdn.net/april-grantham-nature-calls-zishy/smallimage1.jpg
			//   https://d3m3u5a3.ssl.hwcdn.net/april-grantham-nature-calls-zishy/1.jpg
			domain === "d3m3u5a3.ssl.hwcdn.net" ||
			// http://www.nextdoortease.com/ariel-rebel-stockings/smallimage6.jpg
			//   http://www.nextdoortease.com/ariel-rebel-stockings/6.jpg
			domain_nowww === "nextdoortease.com" ||
			// https://www.foxhq.com/toni-lynn-sexy-pics-showgirlz/smallimage1.jpg
			//   https://www.foxhq.com/toni-lynn-sexy-pics-showgirlz/1.jpg
			domain_nowww === "foxhq.com" ||
			// thanks to vscum on github: https://github.com/qsniyg/maxurl/issues/1191
			// https://www.bunnylust.com/lily-chey-leather-jacket-bad-girl/smallimage1.jpg
			//   https://www.bunnylust.com/lily-chey-leather-jacket-bad-girl/1.jpg
			// https://cdn.bunnylust.com/lily-chey-leather-jacket-bad-girl/smallimage1.jpg
			//   https://cdn.bunnylust.com/lily-chey-leather-jacket-bad-girl/1.jpg
			domain_nosub === "bunnylust.com" ||
			// thanks to vscum on github: https://github.com/qsniyg/maxurl/issues/1191
			// https://f2h3f6e6.ssl.hwcdn.net/lily-chey-leather-jacket-bad-girl/smallimage1.jpg
			//   https://f2h3f6e6.ssl.hwcdn.net/lily-chey-leather-jacket-bad-girl/1.jpg
			domain === "f2h3f6e6.ssl.hwcdn.net" ||
			// https://a2w8r2x2.ssl.hwcdn.net/khyanna-song-cute-asian/smallimage1.jpg
			//   https://a2w8r2x2.ssl.hwcdn.net/khyanna-song-cute-asian/1.jpg
			domain === "a2w8r2x2.ssl.hwcdn.net") {
			// http://www.hottystop.com/hailey-leigh-sexy-sun-hat/smallimage3.jpg
			//   http://www.hottystop.com/hailey-leigh-sexy-sun-hat/3.jpg
			newsrc = src.replace(/\/smallimage([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "img.highviral.news") {
			// https://img.highviral.news/770x410/1531458246_5b4832c65c742.jpeg
			//   https://img.highviral.news/1531458246_5b4832c65c742.jpeg -- forces download
			return src.replace(/(:\/\/[^/]*\/)[0-9]+x[0-9]+\/+([0-9]+_[0-9a-f]+\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain === "mondrian.mashable.com") {
			// https://mondrian.mashable.com/uploads%252Fcard%252Fimage%252F192862%252FGettyImages-597565772.jpg%252F950x534__filters%253Aquality%252890%2529.jpg?signature=V4SmwROVetBUOolqpaVOTbpBH7M=&source=https%3A%2F%2Fblueprint-api-production.s3.amazonaws.com
			//   https://mondrian.mashable.com/uploads/card/image/192862/GettyImages-597565772.jpg/950x534__filters:quality(90).jpg
			//   https://admin.mashable.com/uploads/card/image/192862/GettyImages-597565772.jpg -- doesn't work
			// wip
			//   https://pgnpbhn8ce.execute-api.us-east-1.amazonaws.com/default/mondrianImages/create-image/uploads/card/image/192862/GettyImages-597565772.jpg
			// other:
			// https://mondrian.mashable.com/uploads%252Fstory%252Fthumbnail%252F117931%252F26961a4d-081f-4f81-911f-160cb5a1752e.jpg%252F390x219.jpg?signature=HZfx_gKsmTskbJ5ZUbWzM64Uy_g=&source=https%3A%2F%2Fblueprint-api-production.s3.amazonaws.com
			// source + base - [0-9]+x[0-9]+.jpg
			newsrc = src.replace(/(:\/\/[^/]*\/[^/?]*%252F[^/?]*)\?.*$/, "$1");
			if (newsrc !== src)
				return decodeURIComponent(decodeURIComponent(newsrc));

			// https://mondrian.mashable.com/wp-content/gallery/2016-grammy-awards-red-carpet/GettyImages-510433316.jpg/fit-in__850x850.jpg
			//   https://admin.mashable.com/wp-content/gallery/2016-grammy-awards-red-carpet/GettyImages-510433316.jpg
			newsrc = src.replace(/:\/\/[^/]*\/(wp-content\/+.*?\/[^/]*\.[^/.]*)\/[^/]*\.[^/.]*(?:[?#].*)?$/, "://admin.mashable.com/$1");
			if (newsrc !== src)
				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
			amazon_container === "image.wisetrail.com") {
			// http://image.wisetrail.com/bookmark53055242/rs_634x871-140728201735-alj_small.jpg
			//   http://image.wisetrail.com/bookmark53055242/rs_634x871-140728201735-alj.jpg
			return src.replace(/(\/bookmark[0-9]+\/+[^/]*)_small(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "internationallovescout.com") {
			// https://www.internationallovescout.com/images/sobipro/entries/307/thumb_cute-thai-lady-with-a-beautiful-smile.jpg
			//   https://www.internationallovescout.com/images/sobipro/entries/307/cute-thai-lady-with-a-beautiful-smile.jpg
			// https://www.internationallovescout.com/images/uploads/2013/01/Matika-Arthakornsiripho-11-144x150.jpg
			//   https://www.internationallovescout.com/images/uploads/2013/01/Matika-Arthakornsiripho-11.jpg
			return src
				.replace(/(\/entries\/+[0-9]+\/+)thumb_/, "$1")
				.replace(/(\/images\/+uploads\/.*)-[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain.match(/^images\.locanto\./)) {
			// https://images.locanto.co.kr/Sohot-tong/gallery_4374949857.jpg
			//   https://images.locanto.co.kr/Sohot-tong/4374949857.jpg
			// https://images.locanto.sg/test/gallery_3436192854.jpg
			//   https://images.locanto.sg/test/3436192854.jpg
			// https://images.locanto.sg/3436192854/good-news-from-huamulan-spa_3.jpg
			return src.replace(/(:\/\/[^/]*\/[^/]*\/+)[a-z]+_([0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "dailytravelphotos.com") {
			// http://www.dailytravelphotos.com/images/2011t/110330_thai_cute_girl_singer_stage_performance_king_holiday_pose_MG_9140_th.jpg
			//   http://www.dailytravelphotos.com/images/2011/110330_thai_cute_girl_singer_stage_performance_king_holiday_pose_MG_9140
			return src.replace(/(\/images\/+[0-9]+)t(\/[^/]*)_th(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "galleries.grooby.com") {
			// http://galleries.grooby.com/nats/aag/Jade_Seng2/tn-01.jpg
			//   http://galleries.grooby.com/nats/aag/Jade_Seng2/01.jpg
			return src.replace(/\/tn-([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/$1");
		}

		if ((domain_nosub === "adult-empire.com" ||
			// https://pbs.gigapron.com/129/12901/394/pics/thumbs/p1.jpg
			//   https://pbs.gigapron.com/129/12901/394/pics/p1.jpg
			domain_nosub === "gigapron.com" ||
			// https://pbs.bulkjerk.com/100/10083/308/pics/thumbs/p1.jpg
			//   https://pbs.bulkjerk.com/100/10083/308/pics/p1.jpg
			domain_nosub === "bulkjerk.com" ||
			// http://pbs.cozyxxx.com/95/9598/1455/pics/thumbs/p2.jpg
			//   http://pbs.cozyxxx.com/95/9598/1455/pics/p2.jpg
			domain_nosub === "cozyxxx.com") &&
			domain.match(/^pbs(?:-[0-9]+)?\./)) {
			// http://pbs-0.adult-empire.com/73/7356/a096/tns/tn4.jpg
			//   http://pbs-0.adult-empire.com/73/7356/a096/4.jpg
			// http://pbs-2.adult-empire.com/90/9090/251/thumb/001.jpg
			//   http://pbs-2.adult-empire.com/90/9090/251/pics/001.jpg
			// http://pbs-2.adult-empire.com/90/9009/062/pic/t8.jpg
			//   http://pbs-2.adult-empire.com/90/9009/062/pic/8.jpg
			// http://pbs-2.adult-empire.com/91/9145/086/thumbnails/6.jpg
			//   http://pbs-2.adult-empire.com/91/9145/086/6.jpg
			// http://pbs-0.adult-empire.com/75/7502/187/tm/002.jpg
			//   http://pbs-0.adult-empire.com/75/7502/187/002.jpg
			// http://pbs-0.adult-empire.com/74/7453/177/thumbs/003.jpg
			//   http://pbs-0.adult-empire.com/74/7453/177/pics/003.jpg
			// http://pbs-0.adult-empire.com/99/9981/0546/t/4.jpg
			//   http://pbs-0.adult-empire.com/99/9981/0546/p/4.jpg
			// http://pbs-0.adult-empire.com/62/6231/743/tumb/tumb01.jpg
			//   http://pbs-0.adult-empire.com/62/6231/743/pics/01.jpg
			// http://pbs-0.adult-empire.com/100/10083/306/pics/thumbs/p7.jpg
			//   http://pbs-0.adult-empire.com/100/10083/306/pics/p7.jpg
			// http://pbs-0.adult-empire.com/110/11025/448/2xxx.jpg
			//   http://pbs-0.adult-empire.com/110/11025/448/2.jpg
			// http://pbs-2.adult-empire.com/91/9160/3/th/thumbnails/tn2.jpg
			//   http://pbs-2.adult-empire.com/91/9160/3/2.jpg
			// http://pbs-2.adult-empire.com/96/9693/20v/3_resize.jpg
			//   http://pbs-2.adult-empire.com/96/9693/20v/3.jpg
			// http://pbs-1.adult-empire.com/64/6453/ab8/tnchicksandbeasts.com-099.jpg
			//   http://pbs-1.adult-empire.com/64/6453/ab8/www.chicksandbeasts.com-099.jpg
			// http://pbs-2.adult-empire.com/81/8126/066/th04.jpg
			//   http://pbs-2.adult-empire.com/81/8126/066/04.jpg
			// http://pbs-0.adult-empire.com/52/5209/5/74/9a.jpg
			//   http://pbs-0.adult-empire.com/52/5209/5/74/9.jpg
			// http://pbs-1.adult-empire.com/63/6396/0291/thumbs/thumb3.jpg
			//   http://pbs-1.adult-empire.com/63/6396/0291/pics/pic3.jpg
			// http://pbs-0.adult-empire.com/39/3946/fhg/07/thumbnails/tn047.jpg
			//   http://pbs-0.adult-empire.com/39/3946/fhg/07/images/047.jpg
			// http://pbs-1.adult-empire.com/114/11437/4762/thumbnails/tn9.jpg
			//   http://pbs-1.adult-empire.com/114/11437/4762/9.jpg
			// http://pbs-0.adult-empire.com/53/5328/010/tn9.jpg
			//   http://pbs-0.adult-empire.com/53/5328/010/9.jpg
			// http://pbs-2.adult-empire.com/88/8850/p499/tn_name3.jpg
			//   http://pbs-2.adult-empire.com/88/8850/p499/name3.jpg
			// http://pbs-2.adult-empire.com/95/9504/thumbnails/tn0330.JPG
			//   http://pbs-2.adult-empire.com/95/9504/images/0330.JPG
			// http://pbs-0.adult-empire.com/61/6147/cg_08_009/thumbs/tn_004.jpg
			//   http://pbs-0.adult-empire.com/61/6147/cg_08_009/004.jpg
			// http://pbs-0.adult-empire.com/105/10552/24/t04.jpg
			//   http://pbs-0.adult-empire.com/105/10552/24/i04.jpg
			newsrc = src
				.replace(/\/tns\/+tn([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/$1")
				.replace(/\/thumb\/+([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/pics/$1")
				.replace(/\/pic\/+t(?:n[0-9]*\/+)?([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/pic/$1")
				.replace(/\/(?:thumbnails|tm)\/+([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/$1")
				.replace(/\/thumbs\/+([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/pics/$1")
				.replace(/\/t\/+([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/p/$1")
				.replace(/\/tumb\/+tumb([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/pics/$1")
				.replace(/\/pics\/+thumbs\/+p([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/pics/p$1")
				.replace(/(\/[0-9]+)xxx(\.[^/.]*)(?:[?#].*)?$/, "$1$2")
				.replace(/\/th\/+thumbnails\/+tn([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/$1")
				.replace(/(\/[0-9]+)_resize(\.[^/.]*)(?:[?#].*)?$/, "$1$2")
				.replace(/\/tn(chicksandbeasts\.com-[0-9]+\.[^/.]*)(?:[?#].*)?$/, "/www.$1")
				.replace(/\/th([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/$1")
				.replace(/(\/[0-9]+)a(\.[^/.]*)(?:[?#].*)?$/, "$1$2")
				.replace(/\/thumbs\/+thumb([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/pics/pic$1")
				.replace(/(\/[0-9]+\/+[0-9]+\/+p[0-9]+\/+)tn_([^/]*)(?:[?#].*)?$/, "$1$2")
				.replace(/(\/[0-9]+\/+[0-9]+\/+)thumbnails\/+tn([0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1images/$2")
				.replace(/(\/[0-9]+\/+[0-9]+\/+cg_[0-9]+_[0-9]+\/+)thumbs\/+tn_([0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1$2")
				.replace(/(:\/\/[^/]*\/[^/]*\/+[^/]*\/+[^/]*\/+)tn([0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1$2")
				.replace(/(:\/\/[^/]*\/+[0-9]{3}\/+[0-9]+\/+[0-9]+\/+)t([0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1i$2");
			if (newsrc !== src)
				return newsrc;

			regex = /\/thumbnails\/+tn([0-9]+\.[^/.]*)(?:[?#].*)?$/;
			if (src.match(regex)) {
				return [
					src.replace(regex, "/images/$1"),
					src.replace(regex, "/$1")
				];
			}
		}

		if (domain_nowww === "exl.io") {
			// https://exl.io/adl/releases/40fc6033cd695468a7f336686f1840ff/tmd96b45f4d.jpg
			//   https://exl.io/adl/releases/40fc6033cd695468a7f336686f1840ff/96b45f4d.jpg
			return src.replace(/(\/[0-9a-f]{20,}\/+)tmd([0-9a-f]+\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "idols69.net") {
			// http://www.idols69.net/pictures/360-Hina-Kurumi/t01.jpg
			//   http://www.idols69.net/pictures/360-Hina-Kurumi/01.jpg
			return src.replace(/(\/pictures\/+[^/]*\/+)t([0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "fhg.mycuteasian.com" ||
			// http://fhg.avidolz.com/pics/051cv/picture/avidolz_t01.jpg
			//   http://fhg.avidolz.com/pics/051cv/picture/avidolz_01.jpg
			domain === "fhg.avidolz.com") {
			// https://fhg.mycuteasian.com/mixp/074um/picture/mycuteasian_t09.jpg
			//   https://fhg.mycuteasian.com/mixp/074um/picture/mycuteasian_09.jpg
			return src.replace(/(\/picture\/+[^/._]*_)t([0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "teenfilipina.net") {
			// http://www.teenfilipina.net/beer/thumbs/beer-1.jpg
			//   http://www.teenfilipina.net/beer/beer-1.jpg
			// http://www.teenfilipina.net/golden/filipinahardcore-1thumb.jpg
			//   http://www.teenfilipina.net/golden/filipinahardcore-1.jpg
			return src
				.replace(/\/thumbs\//, "/")
				.replace(/(-[0-9]+)thumb(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "rexxx.co") {
			// https://rexxx.co/200265070/0.jpg
			//   https://rexxx.co/200265070/0f.jpg
			return src.replace(/(:\/\/[^/]*\/[0-9]+\/[0-9]+)(\.[^/.]*)(?:[?#].*)?$/,
							   "$1f$2");
		}

		if (domain_nosub === "mobile9.com") {
			// http://sherly.mobile9.com/download/thumb/210/120/lovelove_jde54kn9.gif
			//   http://sherly.mobile9.com/download/media/210/lovelove_jde54kn9.gif
			return src.replace(/\/download\/+thumb\/+([0-9]+)\/+[0-9]+\/+([^/]*\.[^/.]*)(?:[?#].*)?$/,
							   "/download/media/$1/$2");
		}

		if (domain === "s.fap5.com" ||
			// https://s.mycosplayclub.com/036/546/03654654adf8d7903e5/thumbs/66907354adf8d988b1b.jpg
			//   https://s.mycosplayclub.com/036/546/03654654adf8d7903e5/66907354adf8d988b1b.jpg
			domain === "s.mycosplayclub.com") {
			// http://s.fap5.com/020/223/02022354b7a5e964786/thumbs/97401454b7a5ea273a1.jpg
			//   http://s.fap5.com/020/223/02022354b7a5e964786/97401454b7a5ea273a1.jpg
			return src.replace(/(\/[0-9a-f]{15,}\/+)thumbs\/+([0-9a-f]+\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain_nowww === "coolspotters.com") {
			// http://coolspotters.com/files/photos/1166605/felicity-jones-large.jpg?1393363579
			//   http://coolspotters.com/files/photos/1166605/felicity-jones-small.jpg?1393363579
			//   http://coolspotters.com/files/photos/1166605/felicity-jones-medium.jpg?1393363579
			//   http://coolspotters.com/files/photos/1166605/felicity-jones.jpg?1393363579
			// http://coolspotters.com/files/photos/1353785/zoe-saldana-micro.jpg?1493154681
			//   http://coolspotters.com/files/photos/1353785/zoe-saldana.jpg?1493154681
			// http://coolspotters.com/files/photos/632857/zoe-saldana-and-miu-miu-leather-hobo-bag-popover.jpg
			//   http://coolspotters.com/files/photos/632857/zoe-saldana-and-miu-miu-leather-hobo-bag.jpg
			// http://coolspotters.com/files/photos/964591/karlie-kloss-and-victorias-secret-fashion-show-2012-gallery.jpg
			//   http://coolspotters.com/files/photos/964591/karlie-kloss-and-victorias-secret-fashion-show-2012.jpg
			return src.replace(/(\/files\/+photos\/+[0-9]+\/+[^/]*)-(?:small|large|medium|micro|popover|gallery)(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "celebsdump.com" ||
			// http://nakedcelebs.top/posts/2019/03/524/thumbs/madison-beer-legs-and-cleavage-at-2019-iheartradio-music-awards-33.jpg
			//   http://nakedcelebs.top/posts/2019/03/524/images/madison-beer-legs-and-cleavage-at-2019-iheartradio-music-awards-33.jpg
			// http://nakedcelebs.top/posts/2019/07/638/images/gemma-chan-for-allure-magazine-usa-april-2019-9.jpg
			//   http://nakedcelebs.top/posts/2019/07/638/originals/gemma-chan-for-allure-magazine-usa-april-2019-9.jpg
			domain_nowww === "nakedcelebs.top") {
			// https://celebsdump.com/posts/2019/04/5397/thumbs/lais-ribeiro-sexy-topless-and-naked-for-gq-magazine-mexico-august-2016-3.jpg
			//   https://celebsdump.com/posts/2019/04/5397/images/lais-ribeiro-sexy-topless-and-naked-for-gq-magazine-mexico-august-2016-3.jpg
			// https://celebsdump.com/posts/2019/07/7719/featured/maia-mitchell-at-disney-s-the-lion-king-premiere-in-hollywood-july-09-2019-26.jpg
			//   https://celebsdump.com/posts/2019/07/7719/images/maia-mitchell-at-disney-s-the-lion-king-premiere-in-hollywood-july-09-2019-26.jpg
			//   https://celebsdump.com/posts/2019/07/7719/originals/maia-mitchell-at-disney-s-the-lion-king-premiere-in-hollywood-july-09-2019-26.jpg
			regex = /(\/posts\/+[0-9]{4}\/+[0-9]{2}\/+[0-9]+\/+)(?:thumbs|featured|images)\/+/;
			return [
				src.replace(regex, "$1originals/"),
				src.replace(regex, "$1images/")
			];
		}

		if (domain === "photos.laineygossip.com") {
			// https://photos.laineygossip.com/thumbs/tmb_144x138_felicity-jones-globes-12jan15-01.jpg
			//   https://photos.laineygossip.com/articles/felicity-jones-globes-12jan15-01.jpg
			return src.replace(/\/thumbs\/+tmb_[0-9]+x[0-9]+_/, "/articles/");
		}

		if (domain_nowww === "laineygossip.com") {
			// https://www.laineygossip.com/Thumbnail.axd?p=/Content/images/lifestyle/felicity+jones+11jan12+01.jpg&w=173&h=173
			//   https://www.laineygossip.com/Content/images/lifestyle/felicity%20jones%2011jan12%2001.jpg
			return urljoin(src, src
						   .replace(/^[a-z]+:\/\/[^/]*\/Thumbnail\.axd.*?[?&]p=([^&]*).*?$/, "$1")
						   .replace(/[+]/g, "%20"), true);
		}

		if (domain === "images.successstory.com") {
			// https://images.successstory.com/img_people/profile/100X50/Felicity-Jones_1476860182.jpg
			//   https://images.successstory.com/img_people/profile/Felicity-Jones_1476860182.jpg
			return src.replace(/(\/img_[a-z]+\/+[^/]*\/+)[0-9]+X[0-9]+\/+/, "$1");
		}

		if (domain_nosub === "flixster.com" &&
			domain.match(/^content[0-9]*\./)) {
			// http://content6.flixster.com/photo/14/05/18/14051812_tmb.jpg
			//   http://content6.flixster.com/photo/14/05/18/14051812_ori.jpg
			// http://content9.flixster.com/movie/11/16/67/11166787_800.jpg
			//   https://content9.flixster.com/movie/11/16/67/11166787_mob.jpg
			//   http://content9.flixster.com/movie/11/16/67/11166787_ori.jpg
			// http://content9.flixster.com/movie/25/06/250604_pro.jpg
			//   http://content9.flixster.com/movie/25/06/250604_ori.jpg
			// http://content9.flixster.com/photo/71/90/71/7190714_gal.jpg
			//   http://content9.flixster.com/photo/71/90/71/7190714_ori.jpg
			// http://content9.flixster.com/rtmovie/69/95/69955_gal.jpg
			//   http://content9.flixster.com/rtmovie/69/95/69955_ori.jpg
			// http://content9.flixster.com/rtactor/40/36/40363_pro.jpg
			//   http://content9.flixster.com/rtactor/40/36/40363_ori.jpg
			// http://content9.flixster.com/editorial/10/25/11/10251155_gal.jpg
			//   http://content9.flixster.com/editorial/10/25/11/10251155_ori.jpg
			// http://content9.flixster.com/site/10/24/32/10243271_tmb.jpg
			//   http://content9.flixster.com/site/10/24/32/10243271_ori.jpg
			// http://content9.flixster.com/tv/11/02/110267_det.jpg
			//   http://content9.flixster.com/tv/11/02/110267_ori.jpg
			// http://content9.flixster.com/quiz/52/5251_tmb.jpg
			//   http://content9.flixster.com/quiz/52/5251_std.jpg
			//   http://content9.flixster.com/quiz/52/5251_ori.jpg
			// http://content8.flixster.com/critic/22/2242_tmb.jpg
			//   http://content8.flixster.com/critic/22/2242_ori.jpg
			// http://content6.flixster.com/personality/45/4588_std.jpg
			//   http://content6.flixster.com/personality/45/4588_ori.jpg
			//
			// http://content8.flixster.com/question/68/16/23/6816238_tmb.jpg
			//   http://content8.flixster.com/question/68/16/23/6816238_std.jpg
			//   http://content8.flixster.com/question/68/16/23/6816238_ori.jpg -- doesn't work
			// http://content9.flixster.com/poll/44/82/44827_tmb.jpg
			//   http://content9.flixster.com/poll/44/82/44827_std.jpg
			// other:
			// https://content9.flixster.com/user/24/98/40/24984007_ori.jpg
			// https://content9.flixster.com/user/30/51/74/30517423_ori.gif
			//
			// mob = mobile
			// det = detailed
			// pro = profile
			// ori = original
			// tmb = thumbnail?
			// gal = gallery?
			return src
				.replace(/(\/(?:poll|question)\/+(?:[0-9]+\/+){1,3}[0-9]+_)tmb(\.[^/.]*)(?:[?#].*)?$/, "$1std$2")
				.replace(/(\/(?:photo|(?:rt)?movie|rtactor|editorial|site|tv|quiz|critic|personality)\/+(?:[0-9]+\/+){1,3}[0-9]+_)(?:[a-z]+|[0-9]+)(\.[^/.]*)(?:[?#].*)?$/, "$1ori$2");
		}

		if (domain === "resizing.flixster.com") {
			// https://resizing.flixster.com/m3sM1T5vFMbCvOXurBJ2d1wfSUs=/206x305/v1.bTsxMTE2Njc4NztqOzE4NDg5OzEyMDA7ODAwOzEyMDA
			//   http://content9.flixster.com/movie/11/16/67/11166787_ori.jpg
			// atob("bTsxMTE2Njc4NztqOzE4NDg5OzEyMDA7ODAwOzEyMDA")
			//  = "m;11166787;j;18489;1200;800;1200"
			// https://resizing.flixster.com/q6eOeI7bowm9qY2sFct7LpUh60k=/120x160/v1.bTsxMjMwNDQ4NDtqOzE4NDEyOzEyMDA7NjI2OzkyNA (m;12304484;j;18412;1200;626;924)
			//   https://content9.flixster.com/movie/12/30/44/12304484_ori.jpg
			// https://resizing.flixster.com/a83QBW_tq-PUpJpB7LnvwmxZplc=/fit-in/1152x864/v1.cDsxNDA1ODA0MztqOzE4NDc3OzEyMDA7NDU2OzY1Mg (p;14058043;j;18477;1200;456;652)
			//   https://content9.flixster.com/photo/14/05/80/14058043_ori.jpg
			// https://resizing.flixster.com/DkDVM7oqx4tJKZJDaIh88BqaYs0=/fit-in/300x533/v1.aDsxMzA5MTc7ajsxODQwNjsxMjAwOzIxMDA7MTE2MA (h;130917;j;18406;1200;2100;1160)
			//   https://content9.flixster.com/rtmovie/13/09/130917_ori.jpg
			// https://resizing.flixster.com/lK9XShXVeT-7o4SX8pPVPxAA-yM=/100x120/v1.cjs0MzMwOTtqOzE4NDA1OzEyMDA7MjIwOzE5Ng (r;43309;j;18405;1200;220;196)
			//   https://content9.flixster.com/rtactor/43/30/43309_ori.jpg -- interestingly, /personality/ also works, but is a completely different image
			// https://resizing.flixster.com/RxEbHudDxuOpys1eA435pUzW46Y=/206x156/v1.czsxMDI4MjEyNztqOzE4NDc5OzEyMDA7MjA2OzE1Ng (s;10282127;j;18479;1200;206;156)
			//   https://content9.flixster.com/site/10/28/21/10282127_ori.jpg
			// http://resizing.flixster.com/x0Lf-nt1zhVLUHx31ICE47vaQmg=/128x128/v1.YzsyOTYwO2o7MTg0MDU7MjA0ODs0MDA7NDAw (c;2960;j;18405;2048;400;400)
			//   https://content9.flixster.com/critic/29/2960_ori.jpg
			// https://resizing.flixster.com/EDTjzr0bL23_WyddUfFyFnWp9b8=/180x267/v1.dDs2NTE4MzI7ajsxODc3OTsyMDQ4OzE1MDA7MjIyMg (t;651832;j;18779;2048;1500;2222)
			//   https://content9.flixster.com/tv/65/18/651832_ori.jpg -- forces download, but not all do
			// doesn't work for all:
			// http://resizing.flixster.com/H0_jkS1hVYzGBFLobDXszJ64xh4=/128x128/v1.YzsyNDkwO2c7MTg0MDU7MjA0ODsxNTI7MTY4 ("c;2490;g;18405;2048;152;168")
			//   https://content9.flixster.com/critic/24/2490_ori.jpg -- doesn't work
			// http://resizing.flixster.com/PhT5ThIYHT8vdnBQLtTaeD2nm7g=/38x45/v1.YzsxNjU0O2c7MTg0MDU7MjA0ODszODs0NQ (c;1654;g;18405;2048;38;45)
			//   https://content9.flixster.com/critic/16/1654_ori.jpg -- /16/54/ doesn't work either

			// other:
			// https://resizing.flixster.com/hbkhXYovq-89hd70H-hYFOOiJ9c=/fit-in/1152x864/v1.bjsxNTE4MjEzO2o7MTg0Njc7MTIwMDsxOTIwOzEwODA (n;1518213;j;18467;1200;1920;1080)
			// https://resizing.flixster.com/fc0xzb6cYdAbcMeip2qPH6W-T-o=/fit-in/1152x864/v1.bjsxNTI3NTY3O2o7MTg0Njc7MTIwMDsyOTMxOzIwMDA (n;1527567;j;18467;1200;2931;2000)
			// https://resizing.flixster.com/t3LmsYcbnwy2eJ2EJsf2ud1hRrw=/fit-in/1152x864/v1.bjsyMzMxNDU1O2o7MTg0NzY7MTIwMDsxMjAwOzYwMA  (n;2331455;j;18476;1200;1200;600)
			// https://resizing.flixster.com/fmzRrcGq-uAe_6VI5NeMy7PNJIM=/fit-in/300x533/v1.aTsyNDU4NjtqOzE4NzY1OzEyMDA7MzAwMDsyMDAx     (i;24586;j;18765;1200;3000;2001)
			//   https://www.rottentomatoes.com/tv/siren/s01/pictures
			//   tried image/images/img/imgs
			// https://resizing.flixster.com/e3AVgt8zYkFEafo2yN9IrVt4egc=/100x120/v1.bjs3NjI5OTI7ajsxODQxMzsxMjAwOzU0MDs3MjA             (n;762992;j;18413;1200;540;720) - actor image:
			//   https://www.rottentomatoes.com/celebrity/matt_oleary
			// https://resizing.flixster.com/snpvybg_r1na6kT5fFS9Lz6FjJo=/ems.ZW1zLXByZC1hc3NldHMvbW92aWVzLzZhYTNjZDA3LTVjNjQtNGE4NC04MGNiLTU3YTJkODA0ZTQyZC53ZWJw (ems-prd-assets/movies/6aa3cd07-5c64-4a84-80cb-57a2d804e42d.webp)
			//   content9.flixster.com/ems-prd-assets doesn't exist, but s3.amazonaws.com/ems-prd-assets (/ems-prd-assets.s3.amazonaws.com) exists, but access denied?

			var match = src.match(/^[a-z]+:\/\/resizing\.flixster\.com\/.*\/v1\.([^-_/?#.]+)(?:[?#].*)?$/);
			if (match) {
				try {
					var decoded = base64_decode(match[1]);
					var newmatch = decoded.match(/^(?:.*?;)?([chmprst]);([0-9]+)/);
					if (newmatch) {
						var cat = newmatch[1];
						var id = newmatch[2];

						var folder = "";

						var cats = {
							"m": "movie",
							"p": "photo",
							"h": "rtmovie",
							"r": "rtactor",
							"c": "critic",
							"s": "site",
							"t": "tv"
						};

						folder = cats[cat];

						let base = "https://content9.flixster.com/" + folder + "/" + id.slice(0, 2);

						if (id.length > 4) {
							base += "/" + id.slice(2, 4);
						}

						if (id.length > 6) {
							base += "/" + id.slice(4, 6);
						}

						return base + "/" + id + "_ori.jpg";
					}
				} catch(e) {
					console_error(e);
				}
			}
		}

		if (domain_nosub === "tmsimg.com") {
			// https://flxt.tmsimg.com/https://flxt.tmsimg.com/assets/p12792395_p_v8_al.jpg
			//   https://flxt.tmsimg.com/assets/p12792395_p_v8_al.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+(https?:\/\/)/, "$1");
			if (newsrc !== src) return newsrc;

			// https://flxt.tmsimg.com/assets/p12792395_p_v5_al.jpg -- 240x360
			// https://flxt.tmsimg.com/assets/p12792395_p_v6_al.jpg -- 120x180
			// https://flxt.tmsimg.com/assets/p12792395_p_v7_al.jpg -- 480x720
			// https://flxt.tmsimg.com/assets/p12792395_p_v8_al.jpg -- 960x1440
			// https://flxt.tmsimg.com/assets/p12792395_p_v10_al.jpg -- 1536x2048
			// https://flxt.tmsimg.com/assets/p12792395_p_v10_aa.jpg -- different image
			// https://flxt.tmsimg.com/assets/p12792395_p_v10_ab.jpg -- different image
			// https://flxt.tmsimg.com/assets/p12792395_p_v10_ac.jpg -- different image...
			// doesn't work for all:
			// https://flxt.tmsimg.com/assets/p39312_p_v8_aa.jpg
			// https://flxt.tmsimg.com/assets/p39312_p_v9_aa.jpg -- different image
			// https://flxt.tmsimg.com/assets/p39312_p_v10_aa.jpg -- 404
			// other:
			// https://flxt.tmsimg.com/assets/p9410821_v_h9_aa.jpg -- 1440x1080
			// https://flxt.tmsimg.com/assets/p9410821_v_h10_aa.jpg -- 1920x1080
			// https://flxt.tmsimg.com/assets/p9410821_v_v9_aa.jpg -- 1080x1440
			// https://flxt.tmsimg.com/assets/p9410821_p_v9_aa.jpg -- 1080x1440 (v10 is 404)
			// other:
			// https://movies.tmsimg.com/assets/p18941504_v_v12_aa.jpg -- 1920x2880
			// http://zap2it.tmsimg.com/assets/p185254_b_h3_ae.jpg -- 360x720
			//   http://zap2it.tmsimg.com/assets/p185254_b_h12_ae.jpg -- 960x540, saturated, cropped
			// https://dlby.tmsimg.com/assets/p15586677_p_v7_az.jpg -- 480x720
			if (false) {
				var urls = [];
				match = src.match(/^([a-z]+:\/\/[^/]+\/+assets\/+p[0-9]+_[a-z]_[vh])([0-9]+)(_.*)$/);
				if (match) {
					let num = parseInt(match[2]);
					for (let i = num + 1; i <= 12; i++) {
						if (i === 9) continue;
						urls.push(match[1] + i + match[3]);
					}

					if (urls.length) return urls;
				}
			}
		}

		if (host_domain_nowww === "rottentomatoes.com" && options.element && domain === "resizing.flixster.com") {
			var get_thumborid_for_flixster = function(url) {
				if (url.match(/^v1\.[^/?#.]+$/)) {
					return url;
				}

				// thumborId is base64:
				// atob("aDsxMzA5MTc7ajsxODQwNjsxMjAwOzIxMDA7MTE2MA")
				//  = "h;130917;j;18406;1200;2100;1160"
				var match = url.match(/^[a-z]+:\/\/resizing\.flixster\.com\/.*\/(v1\.[^/?#]+)(?:[?#].*)?$/);
				if (!match)
					return null;

				return match[1];
			};

			// https://www.rottentomatoes.com/m/logan_2017/pictures
			var get_pictures_json = function() {
				var pictures_json = document.getElementById("pictures-json");
				if (!pictures_json)
					return null;

				try {
					var json = JSON_parse(pictures_json.innerHTML);
					return parse_pictures_json(json);
				} catch (e) {
					console_error(e);
					return null;
				}
			};

			var parse_pictures_json = function(json) {
				let images = [];

				for (let i = 0; i < json.length; i++) {
					let image:Record<string, string|null> = {};

					image.full = json[i].srcFull;
					image.id = get_thumborid_for_flixster(image.full);
					image.caption = json[i].caption || null;

					images.push(image);
				}

				return images;
			};

			// https://www.rottentomatoes.com/m/logan_2017 ("photos" section)
			var get_imagesjson = function() {
				var scripts = document.getElementsByTagName("script");
				for (var i = 0; i < scripts.length; i++) {
					var script_text = scripts[i].innerHTML;

					var match = script_text.match(/root\.RottenTomatoes\.context\.imagesJson\s*=\s*(\[.*?]);/);
					if (!match) {
						continue;
					}

					try {
						var json = JSON_parse(match[1]);
						return parse_imagesjson(json);
					} catch (e) {
						console_error(e);
						return null;
					}
				}

				return null;
			};

			var parse_imagesjson = function(json) {
				let images = [];

				for (let i = 0; i < json.length; i++) {
					let image:Record<string, string|null> = {};

					image.id = json[i].thumborId;
					image.full = json[i].urls.fullscreen;
					image.caption = json[i].caption || json[i].alt || null;

					images.push(image);
				}

				return images;
			};

			var get_full_flixster = function(url) {
				var id = get_thumborid_for_flixster(url);
				var cache_key = "flixster:" + id;

				if (api_cache.has(cache_key)) {
					return api_cache.get(cache_key);
				}

				var imagesjson = get_imagesjson();
				if (!imagesjson) {
					imagesjson = get_pictures_json();
				}

				if (!imagesjson) {
					return null;
				}

				for (var i = 0; i < imagesjson.length; i++) {
					api_cache.set("flixster:" + imagesjson[i].id, imagesjson[i], 24*60*60);
				}

				return api_cache.get(cache_key);
			};

			var full_picture = get_full_flixster(src);
			if (full_picture) {
				return {
					url: full_picture.full,
					extra: {
						caption: full_picture.caption
					}
				};
			}
		}

		if (amazon_container === "focusmicrosites") {
			// http://focusmicrosites.s3.amazonaws.com/assets/uploads/_tmp/1531760771_focus-features_on-the-basis-of-sex_felicity-jones_armie-hammer_justin-theroux_bio-1-148x157.jpg
			//   http://focusmicrosites.s3.amazonaws.com/assets/uploads/1531760771_focus-features_on-the-basis-of-sex_felicity-jones_armie-hammer_justin-theroux_bio-1.jpg
			return src.replace(/(\/assets\/+uploads\/+)_tmp\/+([^/]*)-[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2$3");
		}

		if (domain === "i.digiguide.tv") {
			// http://i.digiguide.tv/p/0812/tn-14140-FelicityJones-12300486720.jpg
			//   http://i.digiguide.tv/p/0812/14140-FelicityJones-12300486720.jpg
			return src.replace(/(\/p\/+[0-9]+\/+)tn-/, "$1");
		}

		if (domain_nowww === "azquotes.com") {
			// https://www.azquotes.com/public/pictures/authors/79/2e/792eb8aba76c7abc7f05feb3d3a473b6/c_5438e8fd116b5_felicity_jones_thumb.jpg
			//   https://www.azquotes.com/public/pictures/authors/79/2e/792eb8aba76c7abc7f05feb3d3a473b6/5438e8fd116b5_felicity_jones.jpg
			return src.replace(/(\/public\/+pictures\/+.*\/)c_([0-9a-f]+[^/]*)_thumb(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2$3");
		}

		if (domain_nowww === "newsarama.com" ||
			domain === "i.newsarama.com") {
			// http://www.newsarama.com/images/i/000/113/800/i300/Felicity-Jones.jpg?1379532266
			//   https://www.newsarama.com/images/i/000/113/800/original/Felicity-Jones.jpg?1379532266
			return src.replace(/(\/images\/+i\/+[0-9]+\/+[0-9]+\/+[0-9]+\/+)i[0-9]+\/+/,"$1original/");
		}

		if (domain_nowww === "moly.hu") {
			// https://moly.hu/system/pictures/small/pictures_234.jpg?1492707286
			//   https://moly.hu/system/pictures/original/pictures_234.jpg?1492707286
			// https://moly.hu/system/covers/normal/covers_490174.jpg?1525176613
			//   https://moly.hu/system/covers/big/covers_490174.jpg?1525176613
			// https://moly.hu/system/covers/normal/covers_403375.jpg?1468672000
			//   https://moly.hu/system/covers/original/covers_403375.jpg?1468672000
			// https://moly.hu/system/authors/173109/image_normal.jpg?1535120832
			//   https://moly.hu/system/authors/173109/image_original.jpg?1535120832
			newsrc = src.replace(/(\/system\/+authors\/+[0-9]+\/+image_)[a-z]+\./,
								 "$1original.");
			if (newsrc !== src)
				return newsrc;

			regex = /(\/system\/+[^/]*\/+)[a-z]+(\/+[a-z]+_[0-9]+\.)/;
			newsrc = src.replace(regex, "$1original$2");
			if (newsrc !== src)
				return [newsrc, src.replace(regex, "$1big$2")];
		}

		if (domain_nowww === "arasale.com") {
			// http://www.arasale.com/photo3/lily-collins/01_small.jpg
			//   http://www.arasale.com/photo3/lily-collins/01.jpg
			// http://www.arasale.com/photo/red-carpet/billboard-music-awards2019/sabrina-carpenter_small.jpg
			//   http://www.arasale.com/photo/red-carpet/billboard-music-awards2019/sabrina-carpenter.jpg
			// http://www.arasale.com/photo/red-carpet/billboard-music-awards2019/taylor-swift_small1.jpg
			//   http://www.arasale.com/photo/red-carpet/billboard-music-awards2019/taylor-swift.jpg
			return src.replace(/(\/photo[0-9]*\/.*)_small[0-9]*(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "imgth.com") {
			// http://imgth.com/thumbs/2012/08/12/lily-collins_1j721h6sesb.jpg
			//   http://imgth.com/images/2012/08/12/lily-collins_1j721h6sesb.jpg
			return src.replace(/\/thumbs\/+/, "/images/");
		}

		if (domain_nowww === "about.me") {
			// https://about.me/cdn-cgi/image/q=40,dpr=2,f=auto,fit=contain,w=1200,h=900/https://assets.about.me/background/goxonline_1315645314_59.jpg
			//   https://assets.about.me/background/goxonline_1315645314_59.jpg
			return src.replace(/^[a-z]+:\/\/[^/]+\/+cdn-cgi\/+image\/+[^/]+\/+(https?:\/\/)/, "$1");
		}

		if (domain_nowww === "intimatecelebs.com") {
			// http://intimatecelebs.com/celebs/lily_collins/lily_collins_nice_dress_lily_bleW578.jpg.icthumb.jpg
			//   http://intimatecelebs.com/celebs/lily_collins/lily_collins_nice_dress_lily_bleW578.jpg
			return src.replace(/(\.[^/.]*)\.icthumb\.[^/.]*(?:[?#].*)?$/, "$1");
		}

		if (domain_nowww === "celebriot.com") {
			// https://celebriot.com/celeb/22557/lily-collins.jpg.thumb_100x100.jpg
			//   https://celebriot.com/celeb/22557/lily-collins.jpg
			return src.replace(/(\.[^/.]*)\.thumb_[0-9]+x[0-9]+\.[^/.]*(?:[?#].*)?$/, "$1");
		}

		if (domain_nosub === "paheal.net" && options.do_request && options.cb) {
			// https://acacia.paheal.net/_thumbs/4434ac197cedcc25041959a082054c76/thumb.jpg
			//   http://heather.paheal.net/_images/4434ac197cedcc25041959a082054c76/thumb.jpg
			newsrc = src.replace(/(:\/\/[^/]*\/+)_thumbs\//, "$1_images/");
			if (string_indexof(src, "/_thumbs/") >= 0 && newsrc !== src) {
				common_functions["get_file_signature"](api_cache, options, newsrc, function(sig) {
					if (!sig) {
						return options.cb(newsrc);
					}

					let newfilename = newsrc.replace(/(\/[0-9a-f]{10,}\/+[^/]*?)(?:[.?#].*)?$/, "$1." + sig);
					if (sig === "mp4" || sig === "webm") {
						return options.cb({
							url: newfilename,
							video: true
						});
					} else {
						return options.cb(newfilename);
					}
				});
				return {
					waiting: true
				};
			}
		}

		if (domain_nowww === "rule34hentai.net") {
			return {
				url: src.replace(/(:\/\/[^/]*\/)_thumbs\//, "$1_images/"),
				head_wrong_contenttype: true,
				can_head: false
			};
		}

		if (domain_nosub === "lovethispic.com") {
			// https://cache.lovethispic.com/uploaded_images/thumbs/286682-Lily-Collins.jpg
			//   https://cache.lovethispic.com/uploaded_images/286682-Lily-Collins.jpg
			// https://www.lovethispic.com/uploaded_images/thumbs/139183-The-Beautiful-Angelina-Jolie.jpg
			//   https://www.lovethispic.com/uploaded_images/139183-The-Beautiful-Angelina-Jolie.jpg
			return src.replace(/\/uploaded_images\/+thumbs\/+/, "/uploaded_images/");
		}

		if (domain_nowww === "zwz.cz" &&
			options && options.do_request && options.cb) {
			// http://zwz.cz/obrmy.zwz/X1LPM3ND.jpg
			//   http://zwz.cz/Obrazky/Manga/(ZWZ)/Dejiko%20And%20Puchiko%20On%20A%20Stroll%20(ZWZ).jpg
			id = src.replace(/^[a-z]+:\/\/[^/]*\/o[^/]*\.zwz\/+([A-Z0-9]+)\.[^/.]*(?:[?#].*)?$/, "$1");
			if (id !== src) {
				options.do_request({
					url: "http://zwz.cz/f/" + id,
					method: "GET",
					headers: {
						Referer: "http://zwz.cz/",
						Cookie: "agree=yes"
					},
					onload: function(result) {
						if (result.readyState === 4) {
							if (result.status !== 200) {
								console_log(result);
								options.cb(null);
								return;
							}

							var match = result.responseText.match(/<img *id=['"]?pic["']? *class[^>]*?src=["']([^'"]*)['"]/);
							if (match) {
								options.cb({
									url: urljoin(src, match[1], true),
									headers: {
										Referer: "http://zwz.cz/",
										Cookie: "agree=yes"
									}
								});
							} else {
								options.cb(null);
							}
						}
					}
				});

				return {
					waiting: true
				};
			}
		}

		if (domain_nowww === "hockeygods.com") {
			// http://hockeygods.com/system/gallery_images/6819/normal.jpg?1309065354
			//   http://hockeygods.com/system/gallery_images/6819/original.jpg?1309065354
			return src.replace(/(\/system\/+gallery_images\/+[0-9]+\/+)[a-z]+(\.[^/.]*)(?:[?#].*)?$/,
							   "$1original$2");
		}

		if (domain === "galleries.cosmid.net") {
			// http://galleries.cosmid.net/2903//thumbs/01.jpg
			//   http://galleries.cosmid.net/2903/01.jpg
			return src.replace(/(:\/\/[^/]*\/[0-9]+)\/+thumbs\/+/, "$1/");
		}

		if (domain_nowww === "porn-star.com" ||
			// http://galleries5.ptclassic.com/3/spunky-angels-kacie-james-whipped-cream-fun/thumbs/1.jpg
			//   http://galleries5.ptclassic.com/3/spunky-angels-kacie-james-whipped-cream-fun/1.jpg
			(domain_nosub === "ptclassic.com" && /^galleries[0-9]*\./.test(domain))) {
			// https://www.porn-star.com/paisley-sleepover/thumbs/01.jpg
			//   https://www.porn-star.com/paisley-sleepover/01.jpg
			newsrc = src.replace(/\/thumbs\/+([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nowww === "suburbanamateurs.com") {
			// www.suburbanamateurs.com/galleries/samantha_3silk/thumbs/1002.jpg
			//   http://www.suburbanamateurs.com/galleries/samantha_3silk/highres/1002.jpg
			return {
				url: src.replace(/(\/galleries\/+[^/]*\/+)thumbs\/+/, "$1highres/"),
				headers: {
					Referer: "http://www.suburbanamateurs.com/"
				}
			};
		}

		if (domain === "video.soloteengirls.net") {
			// http://video.soloteengirls.net/210292958/materials/thumbs/1.jpg
			//   http://video.soloteengirls.net/210292958/materials/1.jpg
			return src.replace(/\/materials\/+thumbs\/+([0-9]+\.[^/.]*)(?:[?#].*)?$/,
							   "/materials/$1");
		}

		if (domain_nosub === "fantasti.cc" &&
			domain.match(/^cdn(?:-[a-z]+)?\./)) {
			// https://cdn-so.fantasti.cc/big/q/u/e/queenofkink/thumb/queenofkink_431876.jpg
			//   https://cdn-so.fantasti.cc/big/q/u/e/queenofkink/queenofkink_431876.jpg
			return src.replace(/\/thumb\/+([^/]*)(?:[?#].*)?$/, "/$1");
		}

		if (domain === "images.larepubliquedespyrenees.fr") {
			// http://images.larepubliquedespyrenees.fr/2019/04/11/5cb0a218a43f5e5805062a5f/golden/1000x625/une-grue-de-120-metres-emporte-une-des-16-statues-de-cuivre-qui-ornent-la-fleche-de-notre-dame-de-paris-le-11-avril-2019.jpg
			//   http://images.larepubliquedespyrenees.fr/2019/04/11/5cb0a218a43f5e5805062a5f/une-grue-de-120-metres-emporte-une-des-16-statues-de-cuivre-qui-ornent-la-fleche-de-notre-dame-de-paris-le-11-avril-2019.jpg
			// http://images.larepubliquedespyrenees.fr/2019/04/11/5cb0a218a43f5e7566062a62/golden/1000x625/vue-generale-de-paris-depuis-la-cathedrale-notre-dame-de-paris-le-11-avril-2019.jpg
			//   http://images.larepubliquedespyrenees.fr/2019/04/11/5cb0a218a43f5e7566062a62/vue-generale-de-paris-depuis-la-cathedrale-notre-dame-de-paris-le-11-avril-2019.jpg
			return src.replace(/(\/[0-9a-f]{20,}\/+)golden\/+[0-9]+x[0-9]+\/+/, "$1");
		}

		if (domain === "img.aws.la-croix.com") {
			// https://img.aws.la-croix.com/2017/05/18/1200848163/cathedrale-Paris-grand-besoin-restauration_0_729_486.jpg
			//   https://img.aws.la-croix.com/2017/05/18/1200848163/cathedrale-Paris-grand-besoin-restauration_0.jpg
			return src.replace(/_[0-9]+_[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1");
		}

		if (domain === "i.la-croix.com") {
			// thanks to anonymous for reporting:
			// https://i.la-croix.com/1400x933/smart/2021/12/16/1201190504/Marcel-Meys-doyen-Francais-112-6-octobre-2021_0.jpg
			//   https://img.aws.la-croix.com/2021/12/16/1201190504/Marcel-Meys-doyen-Francais-112-6-octobre-2021_0.jpg
			return src.replace(/^[a-z]+:\/\/[^/]+\/+.*?(\/[0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9]{5,}\/+.*)/, "https://img.aws.la-croix.com$1");
		}

		if (domain_nowww === "getty.edu") {
			// http://www.getty.edu/museum/media/images/web/enlarge/06253201.jpg
			//   http://www.getty.edu/museum/media/images/web/download/06253201.jpg
			return src.replace(/\/media\/+images\/+web\/+[^/]*\/+/, "/media/images/web/download/");
		}

		if (domain_nosub === "yelpcdn.com") {
			// http://s3-media4.ak.yelpcdn.com/bphoto/3HvAJi8Zigwa6ZihY8SDjA/1000s.jpg -- scaled
			//   http://s3-media4.ak.yelpcdn.com/bphoto/3HvAJi8Zigwa6ZihY8SDjA/o.jpg
			// https://s3-media2.fl.yelpcdn.com/bphoto/7jLx4f5B4asxBP2MX1Jx8A/l.jpg
			//   https://s3-media2.fl.yelpcdn.com/bphoto/7jLx4f5B4asxBP2MX1Jx8A/o.jpg
			// https://s3-media2.fl.yelpcdn.com/bphoto/7jLx4f5B4asxBP2MX1Jx8A/1000s.jpg -- upscaled?
			//   https://s3-media2.fl.yelpcdn.com/bphoto/7jLx4f5B4asxBP2MX1Jx8A/o.jpg
			// https://s3-media0.fl.yelpcdn.com/photo/yydu_auomtJtS1sUtf2O4Q/180s.jpg
			//   https://s3-media0.fl.yelpcdn.com/photo/yydu_auomtJtS1sUtf2O4Q/o.jpg
			return src.replace(/(\/b?photo\/+[^/]*\/+)(?:[0-9]+s|[a-z]+)(\.[^/.]*)(?:[?#].*)?$/,
							   "$1o$2");
		}

		if (domain_nosub === "rtbf.be" &&
			domain.match(/^(?:[^/]*\.)?static\./)) {
			// https://ds1.static.rtbf.be/article/image/370x208/9/9/d/2c558eb620568fd46b8389a716515716-1555355693.jpg
			//   https://ds1.static.rtbf.be/article/image/original/9/9/d/2c558eb620568fd46b8389a716515716-1555355693.jpg
			// https://ds1.static.rtbf.be/pictureGallery/album/23889/thumb/f9e31c7ff7d5ca38a36b0b127a888f73-1490188572.png
			//   https://ds1.static.rtbf.be/pictureGallery/album/23889/big/f9e31c7ff7d5ca38a36b0b127a888f73-1490188572.png -- 800x1136
			//   https://ds1.static.rtbf.be/pictureGallery/album/23889/f9e31c7ff7d5ca38a36b0b127a888f73-1490188572.png -- 839x1191
			// https://ds1.static.rtbf.be/pictureGallery/album/10646/16df544d2d7cc73b0fedef65d1f6b74e.jpg -- 2537x3800
			// thanks to anonymous for reporting:
			// https://ds.static.rtbf.be/article/image/770xAuto/2/0/0/f0f254331b4693742ea6cc1379b84e73-1573051205.jpg
			//   https://ds.static.rtbf.be/article/image/original/2/0/0/f0f254331b4693742ea6cc1379b84e73-1573051205.jpg
			// other:
			// https://ds1.static.rtbf.be/image/media/object/default/16x9/1248x702/b/7/d/b7d43072ff68bb791ed0813b56e7e498.jpg
			return src
				.replace(/\/article\/+image\/+[0-9Auto]+x[0-9Auto]+\/+/, "/article/image/original/")
				.replace(/(\/pictureGallery\/+album\/+[0-9]+\/+)(?:thumb|big)\/+/, "$1");
		}

		if (domain === "d5xydlzdo08s0.cloudfront.net") {
			// https://d5xydlzdo08s0.cloudfront.net/media/celebrities/3931/original_sabrina_carpenter_300_new_1__S.jpg
			//   https://d5xydlzdo08s0.cloudfront.net/media/celebrities/3931/original_sabrina_carpenter_300_new.jpg
			// https://d5xydlzdo08s0.cloudfront.net/media/celebrities/4010/products/fpc_race__S.jpg
			//   https://d5xydlzdo08s0.cloudfront.net/media/celebrities/4010/products/fpc_race.jpg
			return src.replace(/(\/media\/+[^/]*\/+[0-9]+\/+(?:[^/]*\/)?[^/]*)(?:__[A-Z]|_[0-9]+)(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain === "photos.geni.com") {
			// http://photos.geni.com/p13/49/ae/7d/4b/53444848ae42ab42/sabrina-carpenter-at-american-music-awards-2017-at-microsoft-theater-in-los-angeles-11-19-2017-6_large.jpg
			//   http://photos.geni.com/p13/49/ae/7d/4b/53444848ae42ab42/sabrina-carpenter-at-american-music-awards-2017-at-microsoft-theater-in-los-angeles-11-19-2017-6_original.jpg
			return src.replace(/_[a-z]+(\.[^/.]*)(?:[?#].*)?$/, "_original$1");
		}

		if (false && googlestorage_container === "dbc-wkzlfm") {
			// wip, doesn't work
			// https://1075kzl.com/photo-gallery/view/sabrina-carpenter-listener-lounge
			// https://storage.googleapis.com/dbc-wkzlfm/images/rendered/1a5b9b9ce202d712af888e33d7469594-1431_427x640.jpeg
			//   https://storage.googleapis.com/dbc-wkzlfm/images/raw/417d8f346edab557721cfb23175a1360-3264.jpeg
			//return src.replace(/\/images\/+rendered\/+([0-9a-f]+-[0-9]+)_[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/,
			//                   "/images/raw/$1$2");
		}

		if (domain === "cdn.hipwallpaper.com") {
			// https://cdn.hipwallpaper.com/m/36/54/QN0ZbC.jpg
			//   https://cdn.hipwallpaper.com/i/36/54/QN0ZbC.jpg
			return src.replace(/(:\/\/[^/]*\/)m\/+/, "$1i/");
		}

		if (domain === "photos.bandsintown.com" ||
			amazon_container === "bit-photos") {
			// https://photos.bandsintown.com/thumb/8453127.jpeg
			//   https://photos.bandsintown.com/large/8453127.jpeg
			// https://s3.amazonaws.com/bit-photos/thumb/8453127.jpeg
			//   https://s3.amazonaws.com/bit-photos/large/8453127.jpeg
			return src.replace(/\/thumb\/+([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/large/$1");
		}

		if (domain === "d1dojdv0rym6r6.cloudfront.net") {
			// https://d1dojdv0rym6r6.cloudfront.net/imgs/small/39043_pic11031702034358c3a8cf2d07e.jpg
			//   https://d1dojdv0rym6r6.cloudfront.net/imgs/large/39043_pic11031702034358c3a8cf2d07e.jpg
			return src.replace(/\/imgs\/+[a-z]+\/+([0-9]+_pic[0-9a-f]+\.[^/.]*)(?:[?#].*)?$/, "/imgs/large/$1")
		}

		if (domain_nowww === "mynetsit.ir") {
			// http://mynetsit.ir/?dt=9Z6T
			//   http://mynetsit.ir/?di=9Z6T
			return src.replace(/(:\/\/[^/]*\/).*?[?&]dt=([^/&]*).*?$/, "$1?di=$2");
		}

		if (domain === "cf.kizlarsoruyor.com" ||
			// https://cf.girlsaskguys.com/q3460394/0b8fdc59-937d-4194-9220-7a16a033498f-m.jpg
			//   https://cf.girlsaskguys.com/q3460394/0b8fdc59-937d-4194-9220-7a16a033498f.jpg
			domain === "cf.girlsaskguys.com") {
			// https://cf.kizlarsoruyor.com/q7037525/a8321218-31a5-4356-a684-fb4fe613ea7c-m.jpg
			//   https://cf.kizlarsoruyor.com/q7037525/a8321218-31a5-4356-a684-fb4fe613ea7c.jpg
			return src.replace(/(\/[a-z][0-9]+\/+[0-9a-f]+-[-0-9a-f]+)-m(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain === "static.framar.bg") {
			// https://static.framar.bg/thumbs/6/lifestyle/170529164459riana.jpg
			//   https://static.framar.bg/snimki/lstyle/170529164459riana.jpg
			return src.replace(/\/thumbs\/+[0-9]+\/+lifestyle\/+/,
							   "/snimki/lstyle/");
		}

		if (domain === "life.tert.am" ||
			// https://www.tert.am/cache_image/news_images/1022/3064817_3/f5d4825f2223b5_5d4825f222409-256x174.jpg
			//   https://www.tert.am/news_images/1022/3064817_3/f5d4825f2223b5_5d4825f222409.jpg
			domain_nowww === "tert.am" ||
			// https://xochuanime.online/assets/cache_image/assets/img/ataka-titanov-1_0x350_62b.webp
			//   https://xochuanime.online/assets/img/ataka-titanov-1.jpg
			domain_nowww === "xochuanime.online") {
			// https://life.tert.am/youth/cache_image/youth/news_images/12/34334_1/20170401_amber_post-770x510.jpg -- upscaled?
			//   https://life.tert.am/youth/news_images/12/34334_1/20170401_amber_post.jpg
			// https://life.tert.am/youth/cache_image/youth/news_images/12/34329_1/f167c8d489ef76440ca5cfabd2664af9-190x128.jpg
			//   https://life.tert.am/youth/news_images/12/34329_1/f167c8d489ef76440ca5cfabd2664af9.jpg
			return add_full_extensions(src.replace(/(:\/\/[^/]*\/)(?:[^/]*\/+)?cache_image\/+(.*)[-_][0-9]+x[0-9]+(?:_[0-9]+[a-z]*)?(\.[^/.]*)(?:[?#].*)?$/,
									   "$1$2$3"));
		}

		if (domain_nowww === "woman.at") {
			// https://www.woman.at/_storage/asset/3717139/storage/master/file/38655174/download/154187573.jpg
			//   https://www.woman.at/_storage/asset/3717139/storage/master/file/38655174/154187573.jpg
			// https://www.woman.at/_storage/asset/10336975/storage/womanat:key-visual/file/137190274/slick%20woods.jpg
			//   https://www.woman.at/_storage/asset/10336975/storage/master/file/137190274/slick%20woods.jpg
			return src
				.replace(/\/storage\/+[^/]*\/+file\/+/, "/storage/master/file/") // this doesn't seem to do any difference
				.replace(/(\/file\/+[0-9]+\/+)download\/+/, "$1"); // removes force-downloading
		}

		if (domain === "files.elfann.com") {
			// https://files.elfann.com/imagine/pictures_350/9494643_1537114793.jpg
			//   https://files.elfann.com/pictures/9494643_1537114793.jpg
			// https://files.elfann.com/imagine/pictures_229_135/2551592_1521573506.jpg
			//   https://files.elfann.com/pictures/2551592_1521573506.jpg
			return src.replace(/\/imagine\/+pictures_[0-9]+(?:_[0-9]+)?\/+/, "/pictures/");
		}

		if (domain === "cdn.axar.az") {
			// https://cdn.axar.az/2017/02/23/250/rihanna-anti.jpg
			//   https://cdn.axar.az/2017/02/23/rihanna-anti.jpg
			return src.replace(/(:\/\/[^/]*\/[0-9]{4}\/+[0-9]{2}\/+[0-9]{2}\/+)[0-9]+\/+([^/]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain === "media.milovana.com") {
			// https://media.milovana.com/timg/tb_s/5abeefba7314b21c56892cbf67ad390d260ab457.jpg
			//   https://media.milovana.com/timg/tb_l/5abeefba7314b21c56892cbf67ad390d260ab457.jpg
			// https://media.milovana.com/timg/44608/31403/tb_s/1424205836-selena-gomez-v-magazine-zoom.jpg
			//   https://media.milovana.com/timg/44608/31403/tb_l/1424205836-selena-gomez-v-magazine-zoom.jpg
			return src.replace(/(\/timg\/+(?:[0-9]+\/+[0-9]+\/+)?)tb_[a-z]+\/+/, "$1tb_l/");
		}

		if (domain === "uploads.spiritfanfiction.com") {
			// https://uploads.spiritfanfiction.com/fanfics/thumbs/201809/the-hope-of-genesis-14396185-260920181054.jpg
			//   https://uploads.spiritfanfiction.com/fanfics/historias/201809/the-hope-of-genesis-14396185-260920181054.jpg
			return src.replace(/\/fanfics\/+thumbs\/+/, "/fanfics/historias/");
		}

		if (domain_nosub === "homepornbay.com") {
			// https://pic.homepornbay.com/c/a/1/24/45974/2046024s.jpg
			//   https://pic.homepornbay.com/c/a/1/24/45974/2046024.jpg
			// thanks to vscum on github: https://github.com/qsniyg/maxurl/issues/1373
			// https://homepornbay.com/c/a/1/24/59161/3086207s.jpg
			//   https://homepornbay.com/c/a/1/24/59161/3086207.jpg
			return src.replace(/(\/[0-9]+\/+[0-9]+\/+[0-9]+\/+[0-9]+)s(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "cdn.funpic.us") {
			// https://cdn.funpic.us/tifa_final_fantasy_by_liz_katz-42-401655-fb.jpg
			//   https://cdn.funpic.us/tifa_final_fantasy_by_liz_katz-42-401655.jpg
			return src.replace(/(-[0-9]+)-[a-z]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "themanwiththehat.de") {
			// http://www.themanwiththehat.de/files/attachments/200/k82TZ1l5.jpg
			//   http://www.themanwiththehat.de/files/attachments/k82TZ1l5.jpg
			return src.replace(/\/files\/+attachments\/+[0-9]+\/+/, "/files/attachments/");
		}

		if (domain_nosub === "motorsport.com" &&
			domain.match(/^cdn(?:-[0-9]*)?\./)) {
			// https://cdn-1.motorsport.com/images/mgl/6zlWZOe2/s5/f1-hungarian-gp-2018-barbara-palvin-on-the-grid.jpg
			//   https://cdn-1.motorsport.com/images/mgl/6zlWZOe2/s9/f1-hungarian-gp-2018-barbara-palvin-on-the-grid.jpg
			//   https://cdn-1.motorsport.com/images/mgl/6zlWZOe2/s8/f1-hungarian-gp-2018-barbara-palvin-on-the-grid.jpg
			//   https://cdn-1.motorsport.com/images/mgl/6zlWZOe2/s7/f1-hungarian-gp-2018-barbara-palvin-on-the-grid.jpg -- 960x1440, watermark
			//   https://cdn-1.motorsport.com/images/mgl/6zlWZOe2/s10/f1-hungarian-gp-2018-barbara-palvin-on-the-grid.jpg -- 960x1440, no watermark
			return src.replace(/(\/images\/+[^/]*\/+[^/]*\/+)s[5897]\/+/, "$1s10/");
		}

		if (domain_nowww === "epicwallpapers.com" ||
			// http://freshwallpapers.net/file/10654/500x338/16:9/carbon-fiber_49258997.jpg
			//   http://freshwallpapers.net/file/10654/0x0/crop/carbon-fiber_49258997.jpg
			domain_nowww === "freshwallpapers.net" ||
			// http://alliswall.com/file/7893/2560x1600/crop/selena_gomez_on_green_field.jpg
			//   http://alliswall.com/file/7893/0x0/crop/selena_gomez_on_green_field.jpg
			// http://alliswall.com/file/7893/1920x1200/16:9/selena_gomez_on_green_field.jpg
			//   http://alliswall.com/file/7893/0x0/crop/selena_gomez_on_green_field.jpg
			domain_nowww === "alliswall.com") {
			// https://epicwallpapers.com/imagecache/thumbnails/48/1080x338.png
			//   https://epicwallpapers.com/file/48/0x0/crop/
			// https://epicwallpapers.com/file/48/1920x1080/crop/barbara-palvin-tucking-back-her-hair-with-a-cute-smile.jpg
			//   https://epicwallpapers.com/file/48/0x0/crop/barbara-palvin-tucking-back-her-hair-with-a-cute-smile.jpg
			return src
				.replace(/\/imagecache\/+thumbnails\/+([0-9]+)\/+[0-9]+x[0-9]+\.[^/.]*(?:[?#].*)?$/,
						 "/file/$1/0x0/crop/")
				.replace(/(\/file\/+[0-9]+)\/+[0-9]+x[0-9]+\/+(?:crop|[0-9]+:[0-9]+)\/+/, "$1/0x0/crop/");
		}

		if (domain === "kookbang.dema.mil.kr") {
			// http://kookbang.dema.mil.kr/newspaper/tmplat/upload/20190419/thumb1/2019041801000427600016221.jpg
			//   http://kookbang.dema.mil.kr/newspaper/tmplat/upload/20190419/2019041801000427600016221.jpg
			return src.replace(/(\/upload\/+[0-9]{8}\/+)thumb[0-9]*\/+/, "$1");
		}

		if (domain === "dyaaf063c1cms.cloudfront.net") {
			// https://dyaaf063c1cms.cloudfront.net/8f722f3be2646712c63b14eaecb10b8a/sq280_039.jpg?v=1475506717
			//   https://dyaaf063c1cms.cloudfront.net/8f722f3be2646712c63b14eaecb10b8a/medium_039.jpg?v=1475506717
			//   https://dyaaf063c1cms.cloudfront.net/8f722f3be2646712c63b14eaecb10b8a/large_039.jpg?v=1475506717
			return src.replace(/(:\/\/[^/]*\/[0-9a-f]+\/)(?:sq[0-9]+|medium)_/, "$1large_");
		}

		if (domain_nowww === "specialfruit.com" ||
			// thanks to anonymous for reporting:
			// https://studio100.com/thumbnail/inline/197765/small-k3b2-2023-004390-digitale-cover.jpg
			//   https://studio100.com/thumbnail/full/197765/small-k3b2-2023-004390-digitale-cover.jpg
			// https://studio100.com/thumbnail/character/3850/.png
			//   https://studio100.com/thumbnail/full/3850/.png
			// https://studio100.com/thumbnail/gallery/1704/K3-10000-luchtballonnen-backstage3.jpg -- 950x500
			//   https://studio100.com/thumbnail/full/1704/K3-10000-luchtballonnen-backstage3.jpg -- 1200x800
			// https://studio100.com/thumbnail/book-image/3692/K3-Jodelee_-546A2915.jpg -- 400x400
			//   https://studio100.com/thumbnail/full/3692/K3-Jodelee_-546A2915.jpg -- 400x400
			// https://studio100.com/thumbnail/hero-slider-image/1680/char-hero-image.png
			//   https://studio100.com/thumbnail/full/1680/char-hero-image.png
			// https://studio100.com/thumbnail/hero-slider-logo/3870/logo.png
			//   https://studio100.com/thumbnail/full/3870/logo.png
			// https://studio100.com/thumbnail/thumbnail/139/maya-eerste-vlucht.jpg
			//   https://studio100.com/thumbnail/full/139/maya-eerste-vlucht.jpg -- 749x668
			domain_nowww === "studio100.com" ||
			// https://images-3.schellywood.be/thumbnail/visual-16-9/186791/visual.jpg
			//   https://images-3.schellywood.be/thumbnail/full/186791/visual.jpg
			// https://images-4.schellywood.be/thumbnail/eyecatcher-image-big/198221/1untitled-2.png
			//   https://images-4.schellywood.be/thumbnail/full/198221/1untitled-2.png
			// https://images-2.schellywood.be/thumbnail/poster/165257/rsl-show-visual.jpg
			//   https://images-2.schellywood.be/thumbnail/full/165257/rsl-show-visual.jpg
			// https://images-3.schellywood.be/thumbnail/square-270/198403/tine-pruik.jpg
			//   https://images-3.schellywood.be/thumbnail/full/198403/tine-pruik.jpg
			// https://images-2.schellywood.be/thumbnail/hero-slider/181203/header-visual-gamekeepers.jpg -- 1700x800
			//   https://images-2.schellywood.be/thumbnail/full/181203/header-visual-gamekeepers.jpg -- 1200x565, downscaled
			// https://images-5.schellywood.be/thumbnail/badge/114748/gamekeepers.png
			//   https://images-5.schellywood.be/thumbnail/full/114748/gamekeepers.png
			// https://images-2.schellywood.be/thumbnail/tile-big/43399/.jpg
			//   https://images-2.schellywood.be/thumbnail/full/43399/.jpg - 1200x625
			// other:
			// https://images-5.schellywood.be/thumbnail/musical-gallery-large/190053/lesmisholland2023-enjolras-fotograaf-johan-persson.jpg -- 2573x1680
			(domain_nosub === "schellywood.be" && /^images-[0-9]*\./.test(domain))) {
			// https://www.specialfruit.com/en/thumbnail/productThumbBig/product-1422872366/lime.jpg
			//   https://www.specialfruit.com/en/thumbnail/productFull/product-1422872366/lime.jpg
			// https://www.specialfruit.com/en/thumbnail/inline/1953/120082fe07bda36bf6e573798a2faf26.jpg
			//   https://www.specialfruit.com/en/thumbnail/full/1953/120082fe07bda36bf6e573798a2faf26.jpg
			// full is not necessarily the largest size
			// todo: find cms
			return src
				.replace(/\/thumbnail\/+product[^/]*\/+/, "/thumbnail/productFull/")
				.replace(/\/thumbnail\/+(?:inline|character|book-image|gallery|poster|badge|hero-slider-[a-z]+|thumbnail|(?:visual|eyecatcher|square|tile)-[^/]+)\/+/, "/thumbnail/full/");
		}

		if (domain === "static.planetminecraft.com") {
			// https://static.planetminecraft.com/files/resource_media/screenshot/1323/adorable-anime-beautiful-blue-blue-eyes-Favimcom-351904_5646190_lrg.jpg
			//   https://static.planetminecraft.com/files/resource_media/screenshot/1323/adorable-anime-beautiful-blue-blue-eyes-Favimcom-351904_5646190_thumb.jpg
			//   https://static.planetminecraft.com/files/resource_media/screenshot/1323/adorable-anime-beautiful-blue-blue-eyes-Favimcom-351904_5646190.jpg
			// thanks to anonymous for reporting:
			// https://static.planetminecraft.com/files/image/minecraft/project/2023/017/16510297-scififlyingcarsvehiclesv-bymegaminerdl_s.webp
			//   https://static.planetminecraft.com/files/image/minecraft/project/2023/017/16510297-scififlyingcarsvehiclesv-bymegaminerdl_m.webp
			//   https://static.planetminecraft.com/files/image/minecraft/project/2023/017/16510297-scififlyingcarsvehiclesv-bymegaminerdl_l.webp
			//   https://static.planetminecraft.com/files/image/minecraft/project/2023/017/16510297-scififlyingcarsvehiclesv-bymegaminerdl_xl.webp
			return src
				.replace(/(\/files\/+image\/.*)_[sml](\.[^/.]+)(?:[?#].*)?$/, "$1_xl$2")
				.replace(/(\/files\/.*_[0-9]+)_[a-z]+(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain === "games.renpy.org") {
			// https://games.renpy.org/media/screenshot/small/Sc5.PNG.jpg
			//   https://games.renpy.org/media/screenshot/Sc5.PNG.jpg
			return src.replace(/\/media\/+screenshot\/+small\/+/, "/media/screenshot/");
		}

		if (domain_nowww === "700016.xyz") {
			// https://700016.xyz/files/glamistan/holly/megan_fox_greece_05_thumb.jpg
			//   https://700016.xyz/files/glamistan/holly/megan_fox_greece_05.jpg
			return src.replace(/(\/files\/.*)_thumb(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "mytinyphone.com") {
			// http://www.mytinyphone.com/uploads/users/kayla271/sm2/569107.jpg
			//   http://www.mytinyphone.com/uploads/users/kayla271/569107.jpg
			return src.replace(/(\/uploads\/.*\/)sm[0-9]*\/([0-9]+\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain_nowww === "wallcoo.net") {
			// http://www.wallcoo.net/flower/flower_jp_02/s/%5Bwallcoo_com%5D_0flowers_photograph_2831s.jpg
			//   http://www.wallcoo.net/flower/flower_jp_02/images/%5Bwallcoo_com%5D_0flowers_photograph_2831.jpg
			return src.replace(/\/s\/+([^/]*_[0-9]+)s(\.[^/.]*)(?:[?#].*)?$/, "/images/$1$2");
		}

		if (domain_nowww === "absfreepic.com") {
			// http://absfreepic.com/absolutely_free_photos/thumb_photos/beautiful-red-flower-in-sun-3328x2336_88548.jpg
			//   http://absfreepic.com/absolutely_free_photos/original_photos/beautiful-red-flower-in-sun-3328x2336_88548.jpg
			return src.replace(/\/[a-z]+_photos\/+([^/]*)(?:[?#].*)?$/, "/original_photos/$1");
		}

		if (domain_nowww === "gif-favicon.com") {
			// http://gif-favicon.com/images/download.php?image=flowers/flower-lotus-beautiful-transparent-background-0150-10027.gif
			//   http://gif-favicon.com/images/flowers/flower-lotus-beautiful-transparent-background-0150-10027.gif
			return src.replace(/\/images\/+download\.php.*?[?&]image=([^&]*).*?$/,
							   "/images/$1");
		}

		if (domain_nowww === "ametart.com") {
			// https://www.ametart.com/thumbs/1000/1224/280x_01.jpg
			//   https://www.ametart.com/photos/1000/1224/01.jpg
			return src.replace(/\/thumbs\/+([0-9]+\/+[0-9]+\/+)[0-9]+x_([^/]*)(?:[?#].*)?$/,
							   "/photos/$1$2");
		}

		if (domain_nowww === "nicepornphotos.com" ||
			// https://www.suzisporn.com/images/galleries/0488/35530/2cbb24c2117518080632edc155162984-t.jpg
			//   https://www.suzisporn.com/images/galleries/0488/35530/2cbb24c2117518080632edc155162984.jpg
			domain_nowww === "suzisporn.com" ||
			// https://www.youngporno.com/images/galleries/0786/56918/81c010fae412f7524b3cdd29e10052e3-t.jpg
			//   https://www.youngporno.com/images/galleries/0786/56918/81c010fae412f7524b3cdd29e10052e3.jpg
			domain_nowww === "youngporno.com" ||
			// https://www.hoodtube.com/images/galleries/0913/11158/0189d2e127c683b81b3db9c02f29c09b-t.jpg
			//   https://www.hoodtube.com/images/galleries/0913/11158/0189d2e127c683b81b3db9c02f29c09b.jpg
			domain_nowww === "hoodtube.com" ||
			// http://img1.swapsmut.com/images/galleries/0696/52494/f507af31248f0185645e3098e705879e-t.jpg
			//   http://img1.swapsmut.com/images/galleries/0696/52494/f507af31248f0185645e3098e705879e.jpg
			domain_nosub === "swapsmut.com" ||
			// https://cdn1.images.asianpornmovies.com/galleries/0905/73447/2f9c15636603082eab5608da897d62ee-t.jpg
			//   https://cdn1.images.asianpornmovies.com/galleries/0905/73447/2f9c15636603082eab5608da897d62ee.jpg
			domain_nosub === "asianpornmovies.com") {
			// http://nicepornphotos.com/images/galleries/0074/13783/ac6386623d87014ab9cdf9374a86ed05-t.jpg
			//   http://nicepornphotos.com/images/galleries/0074/13783/ac6386623d87014ab9cdf9374a86ed05.jpg
			return src.replace(/(\/galleries\/+[0-9]+\/+[0-9]+\/+[0-9a-f]{10,})-t(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain_nowww === "hostave2.net") {
			// http://hostave2.net/uc/fhg/photo/voyeur/426vcn/th/04.jpg
			//   http://hostave2.net/uc/fhg/photo/voyeur/426vcn/04.jpg
			return src.replace(/(\/photo\/+[^/]*\/+[^/]*\/+)th\/+([0-9]+\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain === "i.penisbot.com") {
			// http://i.penisbot.com/m/my-ebony-gf/6572378/tmb_13.jpg
			//   http://i.penisbot.com/m/my-ebony-gf/6572378/13.jpg
			return src.replace(/\/tmb_([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/$1");
		}

		if (domain_nowww === "erowall.com") {
			// https://erowall.com/wallpapers/thumb/28317.jpg
			//   https://erowall.com/w/28317/ -- original page
			//   https://erowall.com/wallpapers/original/28317.jpg
			// https://erowall.com/download_img.php?dimg=28317&raz=2560x1600
			newsrc = src
				.replace(/\/download_img\.php.*?[?&]dimg=([0-9]+).*?$/, "/wallpapers/original/$1.jpg")
				.replace(/\/wallpapers\/+[a-z]+\/+([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/wallpapers/original/$1");
			if (newsrc !== src)
				return newsrc;

			match = src.match(/\/wallpapers\/+[a-z]+\/+([0-9]+)\.[^/.]+(?:[?#].*)?$/);
			if (match)
				return {
					url: src,
					extra: {
						page: "https://erowall.com/w/" + match[1]
					}
				};
		}

		if (domain === "promo.mattsmodels.com" ||
			// http://www.nextdoortease.com/galleries/ariel_rebel/ariel_rebel_teasing_in_mexico_part_two/thumbs/ariel_rebel_teasing_in_mexico_part_two-5.jpg
			//   http://www.nextdoortease.com/galleries/ariel_rebel/ariel_rebel_teasing_in_mexico_part_two/ariel_rebel_teasing_in_mexico_part_two-5.jpg
			domain_nowww === "nextdoortease.com" ||
			// http://www.amateurindex.com/galleries/ftv-girls/high-heel-masturbation/thumbs/high-heel-masturbation-1.jpg
			//   http://www.amateurindex.com/galleries/ftv-girls/high-heel-masturbation/high-heel-masturbation-1.jpg
			domain_nowww === "amateurindex.com") {
			// http://promo.mattsmodels.com/galleries/Tyler-Stevenz/tyler-stevenz-b/thumbs/image-01.jpg
			//   http://promo.mattsmodels.com/galleries/Tyler-Stevenz/tyler-stevenz-b/image-01.jpg
			return src.replace(/(\/galleries\/+[^/]*\/+[^/]*\/+)thumbs\/+/, "$1");
		}

		if (domain === "ww3.aziani.com" ||
			// http://www.clubglamour.net/galleries/zishy-misty-lovelace-wet/thumbs/zishy-misty-lovelace-wet-1.jpg
			//   http://www.clubglamour.net/galleries/zishy-misty-lovelace-wet/zishy-misty-lovelace-wet-1.jpg
			domain_nowww === "clubglamour.net") {
			// http://ww3.aziani.com/galleries/0313-az_photos-12-jewelsjade-459/thumbs/1001.jpg
			//   http://ww3.aziani.com/galleries/0313-az_photos-12-jewelsjade-459/1001.jpg
			return src.replace(/(\/galleries\/+[^/]+\/+)thumbs\/+/, "$1");
		}

		if (domain === "galleries.allover30.com") {
			// http://galleries.allover30.com/mature/LizSophia/PtA93o/Z03/liz006002006106001.jpg
			//   http://galleries.allover30.com/mature/LizSophia/PtA93o/liz006002006106001.jpg
			// http://galleries.allover30.com/mature/melody-cummings-1524779951/mel007188221-thumb.jpg
			//   http://galleries.allover30.com/mature/melody-cummings-1524779951/mel007188221.jpg
			return src
				.replace(/(\/[^/]+-[0-9]+\/+[^/]+[0-9]+)-thumb(\.[^/.]+)(?:[?#].*)?$/, "$1$2")
				.replace(/\/Z[0-9]+\/+([^/]*)(?:[?#].*)?$/, "/$1");
		}

		if (domain === "images.sxx.com" ||
			// http://images.blazingmovies.com/pic_teasers/63412/5b107697dc/nude/01/thumbs/63412_01_tb.jpg
			//   http://images.blazingmovies.com/pic_teasers/63412/5b107697dc/nude/01/63412_01.jpg
			domain === "images.blazingmovies.com") {
			// http://images.sxx.com/pic_teasers/23105/5155f2f890/nude/01/thumbs/23105_01_tb.jpg
			//   http://images.sxx.com/pic_teasers/23105/5155f2f890/nude/01/23105_01.jpg
			return src.replace(/\/thumbs\/+([^/]*)_tb(\.[^/.]*)(?:[?#].*)?$/,
							   "/$1$2");
		}

		if (domain === "ww2.aziani.com") {
			// http://ww2.aziani.com/aziani/hannahhilton/2/t_hannahhilton2-001.jpg
			//   http://ww2.aziani.com/aziani/hannahhilton/2/hannahhilton2-001.jpg
			return src.replace(/\/t_([^/]*-[0-9]+\.[^/.]*)(?:[?#].*)?$/, "/$1");
		}

		if (domain === "fhg.karupsow.com" ||
			// https://fhg.karupsha.com/pictures/new-kha-photo-053/images/thumbs-matti/001.jpg
			//   https://fhg.karupsha.com/pictures/new-kha-photo-053/images/pics-matti/001.jpg
			domain === "fhg.karupsha.com") {
			// https://fhg.karupsow.com/pictures/new-kow-photo-052/images/thumbs-sindy/001.jpg
			//   https://fhg.karupsow.com/pictures/new-kow-photo-052/images/pics-sindy/001.jpg
			return src.replace(/\/images\/+thumbs(-[^/]*\/)/, "/images/pics$1");
		}

		if (domain_nowww === "stockingvideos.com") {
			// https://www.stockingvideos.com/leggycash/mm/jan3_17/images/thumbs/thumb2.jpg
			//   https://www.stockingvideos.com/leggycash/mm/jan3_17/images/full/full2.jpg
			return src.replace(/\/images\/thumbs\/thumb([0-9]+\.[^/.]*)(?:[?#].*)?$/,
							   "/images/full/full$1");
		}

		if (domain === "media.virbcdn.com") {
			// http://media.virbcdn.com/cdn_images/resize_500x500/7c/3b56197d6ad281fd-kstewfallon1.jpg
			return src.replace(/\/cdn_images\/+resize_[0-9]+x[0-9]+\/+/, "/images/");
		}

		if (domain === "images.yuku.com") {
			// http://images.yuku.com/image/jpg/5828aff47da105.06172354_t.jpg
			//   http://images.yuku.com/image/jpg/5828aff47da105.06172354.jpg
			// http://images.yuku.com/image/jpg/ce53ba5a4678441794f275ed2d6a3dbb_r.jpg
			//   http://images.yuku.com/image/jpg/ce53ba5a4678441794f275ed2d6a3dbb.jpg
			return src.replace(/(\/image\/+[^/]*\/+[0-9a-f]+(?:\.[0-9]+)?)_[^/.]*(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (host_domain_nosub === "kpopping.com" && domain_nowww === "kpopping.com" && options.element) {
			if (/\/uploads\/+documents\//.test(src)) {
				if (options.element.tagName === "IMG" && options.element.classList.contains("img-fluid")) {
					if (options.element.parentElement.tagName === "A" && options.element.parentElement.href && /\/uploads\/+documents\//.test(options.element.parentElement.href)) {
						return options.element.parentElement.href;
					}
				}
			}
		}

		if (domain_nowww === "kpopping.com") {
			// https://kpopping.com/bundles/app/img/like-anim/xnew-like-sprite.png.pagespeed.ic.4zz0kkaFTj.webp
			if (/\/bundles\/+app\/+img\//.test(src))
				return {
					url: src,
					bad: "mask"
				};

			// https://kpopping.com/uploads/documents/kpics_related-cropped/ro90108367_ori.jpeg
			//   https://kpopping.com/uploads/documents/kpics_gallery-kept/ro90108367_ori.jpeg
			//   https://kpopping.com/uploads/documents/ro90108367_ori.jpeg
			// https://kpopping.com/uploads/documents/gallery_thumbnail_small/ReneJingle-1207164667996426240-EMC12x_UcAAVpLo.jpeg.crop.fff.png
			//   https://kpopping.com/uploads/documents/ReneJingle-1207164667996426240-EMC12x_UcAAVpLo.jpeg
			// https://kpopping.com/uploads/documents/encyclopedia_body_team_big/xfirst_ATEEZ.png.keep.fff.png.pagespeed.ic.uMWjqUQB-G.webp
			//   https://kpopping.com/uploads/documents/first_ATEEZ.png
			// https://kpopping.com/uploads/documents/team_member_medium/xthird_thumbnail_bomb,281,29.png.keep.f1f6f9.png.pagespeed.ic.9qFB60QepA.webp
			//   https://kpopping.com/uploads/documents/third_thumbnail_bomb.png
			// https://kpopping.com/uploads/documents/activity_guide/88x65xthird_ateez_jongho2_540.png.keep.png.pagespeed.ic.zVZjnS2lfb.webp
			//   https://kpopping.com/uploads/documents/third_ateez_jongho2_540.png
			// https://kpopping.com/uploads/documents/cover_image/xcover_300x0w,2860,29.jpeg.keep.fff.png.pagespeed.ic.lBx56s5PPQ.webp
			// https://kpopping.com/uploads/documents/gallery_thumbnail_small/xoriginal_5,28122,29.jpeg.crop.fff.png.pagespeed.ic.SmZA5eU1kA.webp
			//   https://kpopping.com/uploads/documents/kpics_gallery/xoriginal_5,28122,29.jpeg.keep.fff.png.pagespeed.ic.9JVI1QJVyp.webp

			/*
			  seems like they changed something, again.
			  every time i update this script, it seems like a few days later, something changes in the way their site works, breaking the fix i did for this site.
			  they're aware of this script (they linked to it at one point), so it could very well be intentional on their part.
			*/
			if (false) {
				return src
					.replace(/\/uploads\/+documents\/+[^/]+\/+(?:[0-9]*x){0,2}([^/]+?)(?:,[0-9]+){0,}(\.[^/]+?)(?:\.(?:keep|crop)\..*)?(?:[?#].*)?$/, "/uploads/documents/$1$2");
			}

			// enabling without the ,[0-9]+,[0-9]+\. part
			return src
					.replace(/\/uploads\/+documents\/+[^/]+\/+(?:[0-9]*x){0,2}([^/]+?)(\.[^/]+?)(?:\.(?:keep|crop)\..*)?(?:[?#].*)?$/, "/uploads/documents/$1$2");
		}

		if (domain_nosub === "tin247.com" &&
			domain.match(/^image[0-9]*\./)) {
			// https://image2.tin247.com/pictures/picsmall/2019/05/05/200/rva1557052848.jpg
			//   https://image2.tin247.com/pictures/2019/05/05/rva1557052848.jpg
			return src.replace(/\/picsmall\/+([0-9]{4}\/+[0-9]{2}\/+[0-9]{2}\/+)[0-9]+\/+/,
							   "/$1");
		}

		if (domain === "assets.blogr.xxx" ||
			// https://assets-old.blogr.xxx/c872/6915/394d/d580/964a/bec4/e447/4945/posts/dashboard/2017/12/18/bhz74x90p9e8.jpg?85d0e81863ef8cf386496c523f73577c
			//   https://assets-old.blogr.xxx/c872/6915/394d/d580/964a/bec4/e447/4945/posts/large/2017/12/18/bhz74x90p9e8.jpg?85d0e81863ef8cf386496c523f73577c
			domain === "assets-old.blogr.xxx") {
			// https://assets.blogr.xxx/c872/6915/394d/d580/964a/bec4/e447/4945/posts/dashboard/2017/12/18/bhz74x90p9e8.jpg?85d0e81863ef8cf386496c523f73577c
			//   https://assets.blogr.xxx/c872/6915/394d/d580/964a/bec4/e447/4945/posts/large/2017/12/18/bhz74x90p9e8.jpg?85d0e81863ef8cf386496c523f73577c
			return src.replace(/\/posts\/+[^/]*\/+([0-9]{4}\/+[0-9]{2}\/+[0-9]{2}\/+)/, "/posts/large/$1");
		}

		if (domain_nowww === "internationalcelebrityfeet.com") {
			// http://www.internationalcelebrityfeet.com/thumbs/peyton00052thumb.jpg
			//   http://www.internationalcelebrityfeet.com/pics/peyton00052.jpg
			return src.replace(/\/thumbs\/([^/]*)thumb(\.[^/.]*)(?:[?#].*)?$/, "/pics/$1$2");
		}

		if (domain === "content.gulte.com") {
			// https://content.gulte.com/content/2017/05/photos/events/Priyanka%20Chopra%20Deepika%20Padukone%20Sizzles%20At%20Met%20Gala/thumb/Priyanka%20Chopra%20Deepika%20Padukone%20Sizzles%20At%20Met%20Gala_14.jpg
			//   https://content.gulte.com/content/2017/05/photos/events/Priyanka%20Chopra%20Deepika%20Padukone%20Sizzles%20At%20Met%20Gala/normal/Priyanka%20Chopra%20Deepika%20Padukone%20Sizzles%20At%20Met%20Gala_14.jpg
			return src.replace(/(\/content\/+[0-9]{4}\/+[0-9]{2}\/+photos\/+events\/+[^/]*\/+)thumb\/+([^/]*)(?:[?#].*)?$/,
							   "$1normal/$2");
		}

		if (domain_nowww === "moda.ru") {
			// http://www.moda.ru/files/user/03/15/23/content/41786/800x800x85_b06f86b5ea8cae147208623ba6bb9f58.jpg
			//   http://www.moda.ru/files/user/03/15/23/content/41786/b06f86b5ea8cae147208623ba6bb9f58.jpg
			return src.replace(/(\/files\/+user\/+(?:[0-9]{2}\/+){3}content\/+[0-9]+\/+)[0-9]+x[0-9]+x[0-9]+_([0-9a-f]+\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain_nosub === "sodonsolution.org" &&
			domain.match(/^resource[0-9]*\./)) {
			// https://resource3.sodonsolution.org//grandnews/images/2018/1/ecfaa3e0fb115a06a4156600d4b5249f/7cvahu1uohb83a85b603aba94v_s.JPG
			//   https://resource3.sodonsolution.org//grandnews/images/2018/1/ecfaa3e0fb115a06a4156600d4b5249f/7cvahu1uohb83a85b603aba94v.JPG
			return src.replace(/(\/images\/[0-9]{4}\/+[0-9]+\/+[0-9a-f]+\/+[0-9a-z]+)_[a-z](\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain === "youmediafanpage.akamaized.net") {
			// https://youmediafanpage.akamaized.net/gallery/58e65637e4b0acb1af692b21_58e6564fe4b0acb1af695105_p854x570.jpg
			//   https://youmediafanpage.akamaized.net/gallery/58e65637e4b0acb1af692b21_58e6564fe4b0acb1af695105_o.jpg
			return src.replace(/(\/gallery\/+[0-9a-f]+_[0-9a-f]+_)p[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/,
							   "$1o$2");
		}

		if (domain_nosub === "hayatapp.com" &&
			domain.match(/^cdn-media-[0-9]+\./)) {
			// https://cdn-media-01.hayatapp.com/period/production/uploads/backend_wysiwyg_asset/asset/primary_dd7f9e682513f900cda8d8a9c49d91fc.jpg
			//   https://cdn-media-01.hayatapp.com/period/production/uploads/backend_wysiwyg_asset/asset/dd7f9e682513f900cda8d8a9c49d91fc.jpg
			return src.replace(/(\/uploads\/+backend_wysiwyg_asset\/+asset\/+)[a-z]+_([0-9a-f]+\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain === "static.klix.ba") {
			// https://static.klix.ba/media/images/vijesti/151203036.5.jpg?v=1
			//   https://static.klix.ba/media/images/vijesti/151203036.5_mn.jpg?v=1
			// thanks to keophcp on github: https://github.com/qsniyg/maxurl/issues/492
			// mn often redirects to larger images: (there are a couple hundred results for `inurl:static.klix.ba -xxl`, islt:4mp, many still within <24hrs)
			// https://static.klix.ba/media/images/vijesti/200211180.9_mn.jpg?v=2 -- 3648x2432
			// https://static.klix.ba/media/images/vijesti/180301055.6_mn.jpg?v=1 -- 3088x2056
			//   https://static.klix.ba/media/images/vijesti/180301055.6_xxl.jpg?v=1 -- 1200x799
			// https://static.klix.ba/media/images/vijesti/201017106.8_mn.jpg?v=1 -- 2500x2333
			// https://static.klix.ba/media/images/vijesti/201020151.10_mn.jpg?v=1 -- 4230x2820
			// but not always:
			// https://static.klix.ba/media/images/vijesti/201020131.10_mn.jpg?v=1 -- 632x421
			//   https://static.klix.ba/media/images/vijesti/201020131.10_xl.jpg?v=1 -- 938x625
			//   https://static.klix.ba/media/images/vijesti/201020131.10_xxl.jpg?v=1 -- 1200x800 (not upscaled)
			// xxl doesn't always exist:
			// https://static.klix.ba/media/images/vijesti/161022053.11_mn.jpg?v=1
			//  https://static.klix.ba/media/images/vijesti/161022053.11_xl.jpg?v=1 -- 938x627

			// thanks to nijaz-lab on github: https://github.com/qsniyg/maxurl/issues/548
			// https://www.klix.ba/najnovije -- list of thumbnails
			// https://www.klix.ba/vijesti/bih/sjeca-sume-na-spornoj-granici-bih-i-hrvatske-vidljiva-iz-svemira/201203036 -- article
			// https://static.klix.ba/media/images/vijesti/m11_201203036.jpg?v=3 -- thumbnail
			//   https://static.klix.ba/media/images/vijesti/201203036.jpg?v=3 -- 1200x800, upscaled?
			newsrc = src.replace(/(\/media\/+images\/+vijesti\/+)m[0-9]+_([0-9]{8,}\.[^/.]+)(?:[?#].*)?$/, "$1$2");
			if (newsrc != src)
				return newsrc;

			// this will ensure the resulting image will always be larger than the current one, even if it isn't necessarily the largest
			// if no suffix, then redirect to xl first, and if not, mn (e.g. for https://static.klix.ba/media/images/vijesti/151203036.5.jpg?v=1 )
			regex = /(\/media\/+images\/+vijesti\/+[0-9]+\.[0-9]+)(\.[^/.]+)(?:[?#].*)?$/;
			if (regex.test(src)) {
				return [
					src.replace(regex, "$1_xl$2"),
					src.replace(regex, "$1_mn$2")
				];
			}

			regex = /(\/media\/+images\/+vijesti\/+[0-9]+\.[0-9]+_)[a-z]+(\.[^/.]+)(?:[?#].*)?$/;
			if (options.do_request && options.cb && regex.test(src)) {
				var images = [];
				array_foreach(["mn", "xxl", "xl"], function(size) {
					images.push(src.replace(regex, "$1" + size + "$2"));
				});

				common_functions["find_actual_largest_image"](src, images, options.cb, {
					check_length: true,
					api_cache: api_cache,
					do_request: options.do_request
				});

				return {
					waiting: true
				};
			}

			// https://static.klix.ba/media/images/vijesti/s11_201020058.jpg?v=1
			//   https://static.klix.ba/media/images/vijesti/b_201020058.jpg?v=1
			//   https://static.klix.ba/media/images/vijesti/201020058.jpg?v=1 -- 1200x800
			return src.replace(/(\/media\/+images\/+[^/]+\/+)(?:s[0-9]+|b)_([0-9]+\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (host_domain_nowww === "klix.ba" && options.element) {
			// thanks to AdClear247 on github for reporting: https://github.com/qsniyg/maxurl/issues/732
			// https://www.klix.ba/vijesti/bih/pravoslavni-vjernici-obiljezavaju-vaskrs-u-donjoj-sopotnici-kod-gorazda/210502013/galerija
			if (!src && options.element.tagName === "DIV" && options.element.classList.contains("galleria-thumbnails-container")) {
				return {
					url: origsrc,
					bad: "mask"
				};
			}
		}

		if (domain === "img.nga.178.com") {
			// https://img.nga.178.com/attachments/mon_201810/09/baQ5-57seXeZ3vT3cS2ms-1hc.jpg.thumb.jpg
			//   https://img.nga.178.com/attachments/mon_201810/09/baQ5-57seXeZ3vT3cS2ms-1hc.jpg
			// thanks to hentai lzno on greasyfork: https://greasyfork.org/zh-CN/forum/discussion/comment/86358#Comment_86358
			// https://img.nga.178.com/attachments/mon_202002/20/-zue37Q5-28zeZpT3cSnq-11x.jpg.medium.jpg
			//   https://img.nga.178.com/attachments/mon_202002/20/-zue37Q5-28zeZpT3cSnq-11x.jpg -- 403?
			// https://img.nga.178.com/attachments/mon_201912/30/-bqqbQ5-4xw1Z1hT3cS1jk-1jk.jpg.medium.jpg
			//   https://img.nga.178.com/attachments/mon_201912/30/-bqqbQ5-4xw1Z1hT3cS1jk-1jk.jpg
			// https://img.nga.178.com/attachments/mon_202003/03/-zue37Q5-jhdjZ2jT3cSvx-i3.png.thumb_s.jpg
			//   https://img.nga.178.com/attachments/mon_202003/03/-zue37Q5-jhdjZ2jT3cSvx-i3.png
			return {
				url: src.replace(/(\/attachments\/+[^/]*_[0-9]{6}\/+[0-9]+\/+[^/]*)\.(?:thumb|medium)(?:_[a-z])?\.[^/.]*(?:[?#].*)?$/, "$1"),
				headers: {
					Referer: null
				},
				referer_ok: {
					same_domain_nosub: true
				}
			};
		}

		if (domain_nowww === "livesport.ru" ||
			// https://cdn.livesport.ru/l/football/2019/08/10/5_tour_rpl/picture--510.jpg?1565438230
			//   https://cdn.livesport.ru/l/football/2019/08/10/5_tour_rpl/picture.jpg
			domain === "cdn.livesport.ru") {
			// https://www.livesport.ru/l/tips/hockey/2019/03/09/capitals_devils/picture--240.jpg?1551958561
			//   https://www.livesport.ru/l/tips/hockey/2019/03/09/capitals_devils/picture.jpg
			return src.replace(/\/picture--[0-9]+(\.[^/.]*)(?:[?#].*)$/, "/picture$1");
		}

		if (domain_nowww === "vseprosport.ru") {
			// https://www.vseprosport.ru/images/uploads2018/thumbs/800x450/51415.jpg?v=1554967978
			//   https://www.vseprosport.ru/images/uploads2018/51415.jpg?v=1554967978
			return src.replace(/(\/images\/+uploads[0-9]+\/+)thumbs\/+[0-9]+x[0-9]+\/+([0-9]+\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain_nowww === "evrimagaci.org") {
			// https://evrimagaci.org/public/content_media/200/5960e7fa3a372be09bb229ca2fc4ec4e.jpg
			//   https://evrimagaci.org/public/content_media/5960e7fa3a372be09bb229ca2fc4ec4e.jpg
			return src.replace(/\/public\/+content_media\/+[0-9]+\/+/, "/public/content_media/");
		}

		if (domain_nowww === "jagranimages.com") {
			// https://www.jagranimages.com/images/22_04_2018-22skh25100_m.jpg
			//   https://www.jagranimages.com/images/22_04_2018-22skh25100.jpg
			return src.replace(/(\/images\/+[0-9]{2}_[0-9]{2}_[0-9]{4}-[^-/_]+)_[a-z](\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain === "cdn.doctailieu.com") {
			// https://cdn.doctailieu.com/images/2019/04/18/thuyet-minh-vai-tro-cua-cay-coi-trong-viec-bao-ve-moi-truong-song-1-rs650.jpg
			//   https://cdn.doctailieu.com/images/2019/04/18/thuyet-minh-vai-tro-cua-cay-coi-trong-viec-bao-ve-moi-truong-song-1.jpg
			return src.replace(/(\/images\/+[0-9]{4}\/+[0-9]{2}\/+[0-9]{2}\/+[^/]*)-rs[0-9]+(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain_nosub === "cdn-redfin.com") {
			// https://ssl.cdn-redfin.com/photo/52/mbpaddedwide/296/genMid.72334296_3.jpg
			//   https://ssl.cdn-redfin.com/photo/ldpsprite/607/nsprite.84362607_5.jpg
			//   https://ssl.cdn-redfin.com/photo/52/bigphoto/296/72334296_3.jpg
			// https://ssl.cdn-redfin.com/photo/235/mbphoto/592/genMid.1000421592_O.jpg
			//   https://ssl.cdn-redfin.com/photo/235/bigphoto/592/1000421592_O.jpg
			// https://ssl.cdn-redfin.com/photo/45/mbphoto/497/genMid.PW19042497_0.jpg
			//   https://ssl.cdn-redfin.com/photo/45/bigphoto/497/PW19042497_0.jpg
			// https://ssl.cdn-redfin.com/photo/40/mbphoto/790/genMid.18-414790_1_6.jpg
			//   https://ssl.cdn-redfin.com/photo/40/bigphoto/790/18-414790_1_6.jpg
			return src.replace(/(\/photo\/+[0-9]+\/+)[^/]*\/+([0-9]+\/+)[^/.]*\.((?:[0-9A-Z]+-)?[0-9A-Z]+_[0-9A-Z]+(?:_[0-9A-Z]+)?\.[^/.]*)(?:[?#].*)?$/,
							   "$1bigphoto/$2$3");
		}

		if (domain === "images.estately.net") {
			// https://images.estately.net/39_72322660_0_1535292333_320x212a.jpg
			//   https://images.estately.net/39_72322660_0_1535292333.jpg
			return src.replace(/_[0-9]+x[0-9]+[a-z]?(\.[^/.]*)(?:[?#].*)?$/,
							   "$1");
		}

		if (domain_nowww === "mjolbybillack.se") {
			// http://www.mjolbybillack.se/img/media/s_trad-1477397768.jpg
			//   http://www.mjolbybillack.se/img/media/trad-1477397768.jpg
			return src.replace(/\/img\/+media\/+[sl]_/, "/img/media/");
		}

		if (domain_nowww === "mathworks.com") {
			// https://www.mathworks.com/responsive_image/150/0/0/0/0/cache/matlabcentral/profiles/13678460_1537989737540.png
			//   https://www.mathworks.com/matlabcentral/profiles/13678460_1537989737540.png
			return src.replace(/\/responsive_image\/+(?:[0-9]+\/+){5}cache\/+/, "/");
		}

		if (domain === "images.kz.prom.st") {
			// https://images.kz.prom.st/4536391_w100_h100_osina-prodazha.jpg
			//   https://images.kz.prom.st/4536391_osina-prodazha.jpg
			return src.replace(/(:\/\/[^/]*\/[0-9]+)(?:_[wh][0-9]+){1,}(_[^/]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain === "treesale.sccd.org") {
			// http://treesale.sccd.org/thumbnail.asp?file=assets/images/quakingaspenfallcolor_thumbnail.jpg&maxx=150&maxy=0
			//   http://treesale.sccd.org/assets/images/quakingaspenfallcolor_thumbnail.jpg
			// http://treesale.sccd.org/assets/images/quakingaspenfallcolor_thumbnail.jpg
			//   http://treesale.sccd.org/assets/images/quakingaspenfallcolor.jpg
			newsrc = urljoin(src, src.replace(/^[a-z]+:\/\/[^/]*\/thumbnail\.asp.*?[?&]file=([^&]*).*?$/,
											  "$1"), true);
			if (newsrc !== src)
				return newsrc;

			return src.replace(/(\/assets\/+images\/+[^/]+)_thumbnail(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain_nowww === "zive.cz") {
			// https://www.zive.cz/GetThumbNail.aspx?w=1600&h=1000&q=60&id_file=667305386
			//   https://www.zive.cz/GetFile.aspx?id_file=667305386
			return src.replace(/\/GetThumbNail\.aspx.*?[?&](id_file=[0-9]+).*?$/,
							   "/GetFile.aspx?$1");
		}

		if (domain === "hasbrouck.asu.edu") {
			// http://hasbrouck.asu.edu/imglib/seinet/ASU/ASU0024/ASU0024471_tn.jpg
			//   http://hasbrouck.asu.edu/imglib/seinet/ASU/ASU0024/ASU0024471_lg.jpg -- 3456x5184
			// http://hasbrouck.asu.edu/imglib/seinet/misc/201403/imgid-302663_tn.jpg
			//   http://hasbrouck.asu.edu/imglib/seinet/misc/201403/imgid-302663_web.jpg -- 1600x2131
			regex = /(\/imglib\/+.*)_[a-z]+(\.[^/.]*)(?:[?#].*)?$/;
			return [
				src.replace(regex, "$1_lg$2"),
				src.replace(regex, "$1_web$2")
			];
		}

		if (domain_nowww === "parsstock.ir") {
			// https://parsstock.ir/thumbs/10076/115561726-%DB%8C%D9%85%D9%86-%D8%A7%DA%98%D8%AF%D9%87%D8%A7-%D8%AF%D8%B1%D8%AE%D8%AA-%D8%B3%D9%82%D8%B7%D8%B1%D8%A7.jpg
			//   https://parsstock.ir/photos/10076/115561726-%DB%8C%D9%85%D9%86-%D8%A7%DA%98%D8%AF%D9%87%D8%A7-%D8%AF%D8%B1%D8%AE%D8%AA-%D8%B3%D9%82%D8%B7%D8%B1%D8%A7.jpg -- watermark
			return {
				url: src.replace(/(:\/\/[^/]*\/)thumbs\/+([0-9]+\/)/, "$1photos/$2"),
				problems: {
					watermark: true
				}
			};
		}

		if (domain === "img.pixers.pics") {
			// https://img.pixers.pics/pho_wat(s3:700/FO/45/82/21/27/700_FO45822127_5bceb806ea38b947cc5b513978c52b72.jpg,700,467,cms:2018/10/5bd1b6b8d04b8_220x50-watermark.png,over,480,417,jpg)/wall-murals-dragon-tree-socotra-island-yemen.jpg.jpg
			//   https://s3.pixers.pics/pixers/700/FO/45/82/21/27/700_FO45822127_5bceb806ea38b947cc5b513978c52b72.jpg
			// https://img.pixers.pics/pho_wat(cms:2018/10/5bd1b6b8d04b8_220x50-watermark.png,700,467,cms:2018/10/5bd1b6b8d04b8_220x50-watermark.png,over,480,417,jpg)/wall-murals-dragon-tree-socotra-island-yemen.jpg.jpg
			//   https://s3.pixers.pics/cms/2018/10/5bd1b6b8d04b8_220x50-watermark.png
			return src
				.replace(/:\/\/[^/]*\/pho_wat[(]s3:([^,)]*).*/, "://s3.pixers.pics/pixers/$1")
				.replace(/:\/\/[^/]*\/pho_wat[(]cms:([^,)]*).*/, "://s3.pixers.pics/cms/$1");
		}

		if (domain === "d7hftxdivxxvm.cloudfront.net") {
			// artsy.net
			// https://d7hftxdivxxvm.cloudfront.net/?resize_to=fit&width=430&height=640&quality=80&src=https%3A%2F%2Fd32dm0rphc51dk.cloudfront.net%2FRWSMPU07Uk_utF8h-uENMg%2Flarge.jpg
			//   https://d32dm0rphc51dk.cloudfront.net/RWSMPU07Uk_utF8h-uENMg/large.jpg
			return decodeURIComponent(src.replace(/^[a-z]+:\/\/[^/]*\/.*?[?&]src=([^&]*).*?$/, "$1"));
		}

		if (domain === "d32dm0rphc51dk.cloudfront.net") {
			// artsy.net
			// https://d32dm0rphc51dk.cloudfront.net/RWSMPU07Uk_utF8h-uENMg/large.jpg
			//   https://d32dm0rphc51dk.cloudfront.net/RWSMPU07Uk_utF8h-uENMg/larger.jpg
			//   https://d32dm0rphc51dk.cloudfront.net/RWSMPU07Uk_utF8h-uENMg/normalized.jpg -- 1907x2835
			// thanks to Johnny on discord
			// https://d32dm0rphc51dk.cloudfront.net/C5lzx8iv9A3BwiBsNXQG1A/larger.jpg -- 783x1024
			//   https://d32dm0rphc51dk.cloudfront.net/C5lzx8iv9A3BwiBsNXQG1A/normalized.jpg -- 3000x3922
			return src
				.replace(/\/larger(\.[^/.]*)(?:[?#].*)?$/, "/normalized$1")
				.replace(/\/(?:small|medium|large)(\.[^/.]*)(?:[?#].*)?$/, "/larger$1");
		}

		if (domain_nowww === "royalparks.org.uk") {
			// https://www.royalparks.org.uk/parks/bushy-park/things-to-see-and-do/waterhouse-woodland-garden/_gallery/Trees-in-the-Woodland-Gardens.jpg/w_1200.jpg
			//   https://www.royalparks.org.uk/parks/bushy-park/things-to-see-and-do/waterhouse-woodland-garden/_gallery/Trees-in-the-Woodland-Gardens.jpg
			return src.replace(/(\/_gallery\/+[^/]*\.[^/.]*)\/+[^/]*\.[^/.]*(?:[?#].*)?$/, "$1");
		}

		if (domain === "cdn.downtoearth.org.in") {
			// https://cdn.downtoearth.org.in/library/large/2018-02-15/0.58759300_1518676352_arjuna.jpg
			//   https://cdn.downtoearth.org.in/library/original/2018-02-15/0.58759300_1518676352_arjuna.jpg
			return src.replace(/\/library\/+[a-z]+\/+([0-9]{4}-[0-9]{2}-[0-9]{2}\/)/, "/library/original/$1");
		}

		if (domain_nowww === "arborday.org") {
			// https://www.arborday.org/images/hero/medium/hero-aerial-forest-evergreen-trees.jpg
			//   https://www.arborday.org/images/hero/hero-aerial-forest-evergreen-trees.jpg
			return src.replace(/(\/images\/+hero\/+)[a-z]+\/+/, "$1");
		}

		if (domain === "assets.publishing.service.gov.uk") {
			// https://assets.publishing.service.gov.uk/government/uploads/system/uploads/image_data/file/80291/s300_park_gov.uk.jpg
			//   https://assets.publishing.service.gov.uk/government/uploads/system/uploads/image_data/file/80291/park_gov.uk.jpg
			return src.replace(/(\/image_data\/+file\/+[0-9]+\/+)s[0-9]+_([^/]*)(?:[?#].*)?$/, "$1$2");
		}

		if (false && domain === "cf.ltkcdn.net") {
			// resulution is changed in url too
			// https://cf.ltkcdn.net/garden/images/std/204351-678x450-Cottonwood-Tree-in-Autumn.jpg
			//   https://cf.ltkcdn.net/garden/images/orig/204351-2125x1411-Cottonwood-Tree-in-Autumn.jpg
			//return src.replace(/\/images\/+[a-z]+\/+([0-9]+-)/, "/images/orig/$1");
		}

		if (domain === "media.swncdn.com") {
			// https://media.swncdn.com/cms/CW/faith/34851-tree-treeoflife-life.1200w.tn.jpg
			//   https://media.swncdn.com/cms/CW/faith/34851-tree-treeoflife-life.jpg
			return src.replace(/\.[0-9]+[wh]\.tn(\.[^/.]*)(?:[?#].*)?$/, "$1");
		}

		if (domain === "media.wnyc.org") {
			// https://media.wnyc.org/i/800/0/l/85/1/7650980706_652e5ab178_k.jpg
			//   https://media.wnyc.org/i/0/0/l/85/1/7650980706_652e5ab178_k.jpg
			//   https://media.wnyc.org/i/raw/1/7650980706_652e5ab178_k.jpg
			// https://media.wnyc.org/i/3000/1999/c/80/photologue/photos/obama_health_care_march21.jpg
			//   https://media.wnyc.org/i/raw/photologue/photos/obama_health_care_march21.jpg
			return src.replace(/(:\/\/[^/]*\/i)\/+[0-9]+\/+[0-9]+\/+(?:[cl]\/[0-9]+\/)?/, "$1/raw/");
		}

		if (domain_nowww === "tagbrand.com") {
			// http://tagbrand.com/uploads/359695/808b9f7172b28ca255a4de4992984344_b.jpg
			//   http://tagbrand.com/uploads/359695/808b9f7172b28ca255a4de4992984344.jpg
			return src.replace(/(\/uploads\/+[0-9]+\/+[0-9a-f]+)_[a-z](\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain_nosub === "7sur7.be" &&
			domain.match(/^static[0-9]*\./)) {
			// https://static1.7sur7.be/static/photo/2017/11/6/13/20170112090102/media_xll_9448198.jpg
			//   https://static1.7sur7.be/static/photo/2017/11/6/13/20170112090102/crop_9448198.jpg -- 1346x760
			// doesn't work for all:
			// https://static3.7sur7.be/static/photo/2017/10/0/6/20170112095407/media_xll_9448311.jpg -- 510x637
			//   https://static3.7sur7.be/static/photo/2017/10/0/6/20170112095407/crop_9448311.jpg -- doesn't work
			return src.replace(/\/media_[a-z]+_([0-9]+\.[^/.]*)(?:[?#].*)?$/,
							   "/crop_$1");
		}

		if (domain_nowww === "suryaa.com") {
			// https://suryaa.com/suryaa-images/cinema-english/thumbnail2/selena_7048.jpg
			//   https://suryaa.com/suryaa-images/cinema-english/selena_7048.jpg
			return src.replace(/\/thumbnail[0-9]*\/+([^/]*)(?:[?#].*)?$/, "/$1");
		}

		if (domain === "phapluatdansinh.phapluatxahoi.vn") {
			// http://phapluatdansinh.phapluatxahoi.vn/upload/zoom/420_272/nga-2018/15-1/587e79c5ca8423da7a95.jpg
			//   http://phapluatdansinh.phapluatxahoi.vn/upload/nga-2018/15-1/587e79c5ca8423da7a95.jpg
			return src.replace(/\/upload\/+zoom\/+[0-9]+_[0-9]+\/+/, "/upload/");
		}

		if (domain === "assets.sport.ro") {
			// https://assets.sport.ro/assets/protv/2018/06/28/image_galleries/58836/t_size2/thumb_selena-gomez-in-vacanta-cu-un-barbat-foarte-cunoscut-in-italia-cine-e-noua-ei-cucerire_2.jpg
			//   https://assets.sport.ro/assets/protv/2018/06/28/image_galleries/58836/selena-gomez-in-vacanta-cu-un-barbat-foarte-cunoscut-in-italia-cine-e-noua-ei-cucerire_2.jpg
			// https://assets.sport.ro/assets/protv/2018/06/28/image_galleries/58836/selena-gomez-in-vacanta-cu-un-barbat-foarte-cunoscut-in-italia-cine-e-noua-ei-cucerire_2_size23.jpg
			//   https://assets.sport.ro/assets/protv/2018/06/28/image_galleries/58836/selena-gomez-in-vacanta-cu-un-barbat-foarte-cunoscut-in-italia-cine-e-noua-ei-cucerire_2.jpg
			return src
				.replace(/\/t_size[0-9]*\/+thumb_/, "/")
				.replace(/_size[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1");
		}

		if (domain_nowww === "diarioarapiraca.com.br" ||
			// https://todosegundo.com.br/thumbs.php?imagem=uploads/image/noticias/21256/v.jpg&largura=640&altura=480&marca=false
			//   https://todosegundo.com.br/uploads/image/noticias/21256/v.jpg
			domain_nowww === "todosegundo.com.br") {
			// http://diarioarapiraca.com.br/thumbs.php?imagem=uploads/image/noticias/51693/201812192144_3ac738b849.jpg&largura=480&altura=320
			//   http://diarioarapiraca.com.br/uploads/image/noticias/51693/201812192144_3ac738b849.jpg
			return urljoin(src, decodeuri_ifneeded(src.replace(/^[a-z]+:\/\/[^/]*\/thumbs\.php.*?[?&]imagem=([^&]*).*?$/, "$1")), true);
		}

		if (domain === "static.ilike.com.vn") {
			// http://static.ilike.com.vn:8880/articles/thumb/s3/0/0/0/24232.jpg?v=1
			//   http://static.ilike.com.vn:8880/articles/thumb/origin/0/0/0/24232.jpg?v=1
			return src.replace(/\/thumb\/+s[0-9]+\//, "/thumb/origin/");
		}

		if (domain === "b.njus.me") {
			// https://b.njus.me/pr0/m_59268271.png
			//   https://b.njus.me/pr0/59268271.png
			return src.replace(/\/[a-z]_([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/$1");
		}

		if (domain_nowww === "wallpaperstream.com") {
			// https://wallpaperstream.com/wallpapers/thumbnails/selena-gomez/Selena-Gomez-Smile-Pretty-Girl_thumb.jpg
			//   https://wallpaperstream.com/wallpapers/full/selena-gomez/Selena-Gomez-Smile-Pretty-Girl.jpg
			return src.replace(/\/thumbnails\/(.*)_thumb(\.[^/.]*)(?:[?#].*)?$/,
							   "/full/$1$2");
		}

		if (domain_nowww === "wallpapersite.com") {
			// https://wallpapersite.com/love/couple-lovers-dream-fantasy-4k-17386.html
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+[a-z]+\/+[^/.?#]*-([0-9]+)\.html(?:[?#].*)?$/,
				query_for_id: "https://wallpapersite.com/anime/-${id}.html",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/<a\s+href=["'](\/images\/wallpapers\/[^'"]*)["']\s+class=["']?original/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

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

		if (domain_nowww === "wallpapersite.com" &&
			options && options.cb && options.do_request) {
			// https://wallpapersite.com/images/pages/ico_n/8355.jpg
			//   https://wallpapersite.com/images/pages/pic_w/8355.jpg
			//   https://wallpapersite.com/images/wallpapers/selena-gomez-2500x1406-instyle-uk-hd-8355.jpg -- forces download
			id = src.replace(/.*\/images\/+pages\/+[^/]*\/+([0-9]+)\.[^/.]*(?:[?#].*)?$/, "$1");
			if (id !== src) {
				return {
					url: "https://wallpapersite.com/anime/-" + id + ".html",
					is_pagelink: true
				};
			}
		}

		if (domain_nosub === "record.pt" ||
			// https://cdn5.flash.pt/images/2019-02/img_384x270$2019_02_24_17_26_19_186465.jpg
			//   https://cdn5.flash.pt/images/2019-02/OriginalSize$2019_02_24_17_26_19_186465.jpg
			domain_nosub === "flash.pt" ||
			// https://cdn.cmjornal.pt/images/2017-10/img_757x498$2017_10_24_09_49_21_679518.jpg
			//   https://cdn.cmjornal.pt/images/2017-10/OriginalSize$2017_10_24_09_49_21_679518.jpg
			domain_nosub === "cmjornal.pt" ||
			// https://cdn.destakjornal.com.br/images/2018-10/img_130x73$2018_10_19_14_31_14_34107.jpg
			//   https://cdn.destakjornal.com.br/images/2018-10/OriginalSize$2018_10_19_14_31_14_34107.jpg
			domain_nosub === "destakjornal.com.br" ||
			// https://cdn.maxima.pt/images/2018-03/img_974x632$2018_03_06_15_36_15_348763.jpg
			//   https://cdn.maxima.pt/images/2018-03/OriginalSize$2018_03_06_15_36_15_348763.jpg
			// http://cdn5.maxima.pt/images/2018-03/img_974x632$2018_03_06_15_36_15_348763.jpg
			//   http://cdn5.maxima.pt/images/2018-03/OriginalSize$2018_03_06_15_36_15_348763.jpg
			domain_nosub === "maxima.pt" ||
			src.match(/^[a-z]+:\/\/cdn[0-9]*\.[^/]*\/+images\/+[0-9]{4}-[0-9]{2}\/+img_[0-9]+x[0-9]+\$[0-9]{4}(?:_[0-9]{2}){5}_[0-9]+\.[^/.]*(?:[?#].*)?$/)) {
			// https://cdn.record.pt/images/2018-11/img_184x105$2018_11_01_23_39_25_1467338.jpg
			//   https://cdn.record.pt/images/2018-11/OriginalSize$2018_11_01_23_39_25_1467338.jpg
			return src.replace(/(\/images\/+[0-9]{4}-[0-9]{2}\/+)img_[0-9]+x[0-9]+[$]/, "$1OriginalSize$");
		}

		if (domain_nowww === "latestwall.com") {
			// http://www.latestwall.com/imagecache/thumbwallpaper/selena-gomez-155-1920x1080.jpg
			//   http://www.latestwall.com/imagecache/thumbimage/selena-gomez-155-1920x1080.jpg
			//   http://www.latestwall.com/images/wallpaper/selena-gomez-155-1920x1080.jpg
			// http://www.latestwall.com/main-image/cache/selena-gomez-155-1920x1080.jpg/800/500
			//   http://www.latestwall.com/images/wallpaper/selena-gomez-155-1920x1080.jpg
			// http://www.latestwall.com/download/1280~800~selena-gomez-155-1920x1080
			//   http://www.latestwall.com/images/wallpaper/selena-gomez-155-1920x1080.jpg
			newsrc = src
				.replace(/\/imagecache\/+thumb[a-z]+\/+/, "/images/wallpaper/")
				.replace(/\/main-image\/+cache\/+([^/]*)\/+[0-9]+(?:\/+[0-9]+)(?:[?#].*)?$/, "/images/wallpaper/$1");
			if (newsrc !== src)
				return newsrc;

			newsrc = src.replace(/\/download\/+[0-9]+~[0-9]+~([^/]*)(?:[?#].*)?$/, "/images/wallpaper/$1.jpg");
			if (newsrc !== src)
				return add_full_extensions(newsrc);
		}

		if (domain_nosub === "hdxwallpaper.com" && domain.match(/^orig[0-9]*\./)) {
			// https://orig0.hdxwallpaper.com/dl/hd/197/selena_gomez-(1974)-728x410.jpg
			//   https://orig0.hdxwallpaper.com/dl/hd/197/selena_gomez-(1974).jpg
			return {
				url: src.replace(/-[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1"),
				headers: {
					Referer: "https://hdxwallpaper.com"
				}
			};
		}

		if (domain === "cacheimg.bonsante.fr") {
			// https://cacheimg.bonsante.fr/i.php?img=http://media.fan2.fr/article-3460479-ratio_1080_610-f1490438294/selena-gomez-femme-fatale-ces-nouvelles-photos.jpg&key=72f830f974bcd74d3eeaf8075fd753f7
			//   https://media.fan2.fr/article-3460479-redim-f1490438294/selena-gomez-femme-fatale-ces-nouvelles-photos.jpg
			return decodeuri_ifneeded(src.replace(/^[a-z]+:\/\/[^/]*\/i\.php.*?[?&]img=([^&]*).*?$/, "$1"));
		}

		if (domain_nowww === "generations.fr") {
			// http://generations.fr/media/news/thumb/430x242_selena-gomez-string-couv-h.jpg
			//   http://generations.fr/media/news/selena-gomez-string-couv-h.jpg
			return src.replace(/\/thumb\/+[0-9]+x[0-9]+_([^/]*)(?:[?#].*)?$/, "/$1");
		}

		if (domain === "images.gsp.ro") {
			// https://images.gsp.ro/usr/thumbs/thumb_600_x_315/2017/12/11/868470-selena-gomez-1.jpg
			//   https://images.gsp.ro/usr/imagini/2017/12/11/868470-selena-gomez-1.jpg
			return src.replace(/\/thumbs\/+thumb_[0-9]+_x_[0-9]+\//, "/imagini/");
		}

		if (domain === "cacheimg.gsp.ro") {
			// thanks to Lerortle on greasyfork: https://greasyfork.org/en/forum/discussion/66137/could-you-add-support-for-website
			// https://cacheimg.gsp.ro/autocrop/smp-images-production/gsp.ro/18122019/1576654064659.jpg?width=924&height=600
			//   https://cacheimg.gsp.ro/autocrop/smp-images-production/gsp.ro/18122019/1576654064659.jpg?width=0&height=0
			// https://cacheimg.gsp.ro/autocrop/smp-images-production/gsp.ro/01122019/1575186509430.jpg?width=1200&height=0 -- 1200x1670, upscaled
			//   https://cacheimg.gsp.ro/autocrop/smp-images-production/gsp.ro/01122019/1575186509430.jpg?width=0&height=0 -- 690x690
			// https://cacheimg.gsp.ro/autocrop/smp-images-production/gsp.ro/18122019/1576703575633.jpg?width=1200&height=1200 -- 1200x1200, upscaled
			//   https://cacheimg.gsp.ro/autocrop/smp-images-production/gsp.ro/18122019/1576703575633.jpg?width=0&height=0 -- 924x600
			return src.replace(/(\/autocrop\/+.*?)(?:[?#].*)?$/, "$1?width=0&height=0");
		}

		if (domain === "tt.inf.ua") {
			// http://tt.inf.ua/files/upload/88/51/d6/8851d699fef9896504f3883ed3b11dd4.550x550.jpg
			//   http://tt.inf.ua/files/upload/88/51/d6/8851d699fef9896504f3883ed3b11dd4.jpg
			return src.replace(/(\/files\/+upload\/+(?:[0-9a-f]{2}\/+){3}[0-9a-f]+)\.[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain_nosub === "ckm.pl" ) {
			// https://static2.ckm.pl/files/2017_07/.thumbnails/617x352/glds-7429ef1878ac477695186e934867f717_dc03f0.jpg -- upscaled (nearest)
			//   https://static2.ckm.pl/files/2017_07/glds-7429ef1878ac477695186e934867f717_dc03f0.jpg
			// https://ckm.pl/files/2013_08/.thumbnails/400xX/a8b6e154fe9111e2a46122000a9f09e2-7-d25364a184223362008af3e6e7096288-1_f40a16.jpg
			//   https://ckm.pl/files/2013_08/a8b6e154fe9111e2a46122000a9f09e2-7-d25364a184223362008af3e6e7096288-1_f40a16.jpg
			return src.replace(/(\/files\/+[0-9]{4}_[0-9]{2}\/+)\.thumbnails\/+[0-9X]+x[0-9X]+\/+/, "$1");
		}

		if (domain_nowww === "zurnal.mk" ||
			// http://www.harpersbazaar.rs/image.php/05.jpg?width=372&height=660&cropratio=372:660&image=http://www.harpersbazaar.rs/chest/gallery/billboard-music-awards-2019-stajlinzi-sa-crvenog-tepiha/05.jpg
			//   http://www.harpersbazaar.rs/chest/gallery/billboard-music-awards-2019-stajlinzi-sa-crvenog-tepiha/05.jpg
			domain_nowww === "harpersbazaar.rs" ||
			// https://www.moviegoers.me/images/thumbs/image.php/image_1a452d1bf7b49881837cf6524cde4173.jpg?width=526&height=773&image=/public/images/movie_images/aquaman-duo2018-11-24-12-14-02.jpg
			//   https://www.moviegoers.me/public/images/movie_images/aquaman-duo2018-11-24-12-14-02.jpg
			domain_nowww === "moviegoers.me") {
			// http://www.zurnal.mk/image.php/selena_2.jpg?image=/data/news/selena_2.jpg&width=650
			//   http://www.zurnal.mk/data/news/selena_2.jpg
			return urljoin(src, decodeuri_ifneeded(src.replace(/^[a-z]+:\/\/[^/]*\/(?:images\/+thumbs\/+)?image\.php\/+[^/]*\?(?:.*?&)?image=([^&]*).*?$/, "$1")), true);
		}

		if (domain === "cde.laprensa.e3.pe") {
			// https://cde.laprensa.e3.pe/ima/0/0/1/4/7/147300/691x430.jpg
			//   https://cde.laprensa.e3.pe/ima/0/0/1/4/7/147300.jpg
			return src.replace(/(\/ima\/+(?:[0-9]\/+){5}[0-9]+)\/+[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nosub === "myclip.vn" && domain.match(/^static[0-9]*\./)) {
			// http://static3.myclip.vn/image1/2018/04/12/18/6c933778/6c933778-0261-4cea-9fb2-37596e11cf3c_640_360.jpg -- upscaled
			//   http://static3.myclip.vn/image1/2018/04/12/18/6c933778/6c933778-0261-4cea-9fb2-37596e11cf3c.jpg -- forces download
			return src.replace(/(\/image[0-9]*\/+[0-9]{4}\/+[0-9]{2}\/+[0-9]{2}\/+[0-9]{2}\/+[0-9a-f]+\/+[-0-9a-f]+)_[0-9]+_[0-9]+(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain_nowww === "elsalvadortimes.com") {
			// https://www.elsalvadortimes.com/asset/thumbnail,1160,740,center,center/media/elsalvadortimes/images/2016/09/28/2016092823473342871.jpg
			//   https://www.elsalvadortimes.com/media/elsalvadortimes/images/2016/09/28/2016092823473342871.jpg
			return src.replace(/\/asset\/+[^/]*\/+media\/+/, "/media/");
		}

		if (domain === "assets.media-platform.com") {
			// https://assets.media-platform.com/glitty/dist/images/2018/09/28/20180928_selena_gomez-w960.jpg -- upscaled
			//   https://assets.media-platform.com/glitty/dist/images/2018/09/28/20180928_selena_gomez.jpg
			return src.replace(/(\/images\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9]{8}_[^/]*)-[wh][0-9]+(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain_nowww === "noticiastudoaqui.com") {
			// https://noticiastudoaqui.com/tim.php?src=https://noticiastudoaqui.com/uploads/2018/12/2018D19uNq225c1b00da.jpg&w=800&h=627&q=80&zc=1
			//   https://noticiastudoaqui.com/uploads/2018/12/2018D19uNq225c1b00da.jpg
			return decodeuri_ifneeded(src.replace(/^[a-z]+:\/\/[^/]*\/tim\.php.*?[?&]src=([^&]*).*?$/, "$1"));
		}

		if (domain === "images.buzzerie.com") {
			// https://images.buzzerie.com/2016/07/25/s/selena-gomez-coca_580xh.jpg
			//   https://images.buzzerie.com/2016/07/25/s/selena-gomez-coca.jpg
			return src.replace(/_[0-9]+x[0-9wh]+(\.[^/.]*)(?:[?#].*)?$/, "$1");
		}

		if (domain_nowww === "cocacolabrasil.com.br") {
			// https://www.cocacolabrasil.com.br/content/dam/journey/br/pt/private/stories/2016/07/selena-gomez-instagram-2.rendition.584.728.jpg
			//   https://www.cocacolabrasil.com.br/content/dam/journey/br/pt/private/stories/2016/07/selena-gomez-instagram-2.jpg
			return src.replace(/\.rendition\.[0-9]+\.[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1");
		}

		if (domain === "img.uodoo.com") {
			// http://img.uodoo.com/o/mediana/s/intlnews/eee6fc68daa2d3e8b6946e79f6b2d27bx640x800x69.jpeg;,40,webp;3,588x
			//   http://img.uodoo.com/o/mediana/s/intlnews/eee6fc68daa2d3e8b6946e79f6b2d27bx640x800x69.jpeg
			return src.replace(/;,.*/, "");
		}

		if (domain_nowww === "bumm.sk") {
			// https://www.bumm.sk/uploads/news/168/161168/377x250/csak-ot-evet-kapott-a-selena-gomez-hacker_161168.jpg
			//   https://www.bumm.sk/uploads/news/168/161168/csak-ot-evet-kapott-a-selena-gomez-hacker_161168.jpg
			return src.replace(/(\/uploads\/+news\/+[0-9]+\/+[0-9]+\/+)[0-9]+x[0-9]+\/+/, "$1");
		}

		if (domain === "multimedia.larepublica.pe" ||
			// https://prod.media.wapa.pe/670x376/wapa/imagen/2016/09/05/Nota-12866-selena_en_rehabilitacion_por_depresion_y_uso_de_farmacos.jpg
			// doesn't work. x0 also just returns a blank image
			//domain === "prod.media.wapa.pe" ||
			// https://prod.media.larepublica.pe/337x190/larepublica/imagen/2017/11/02/noticia-selena.jpg
			//   https://prod.media.larepublica.pe/x/larepublica/imagen/2017/11/02/noticia-selena.jpg
			domain === "prod.media.larepublica.pe" ||
			// https://prod.presets.larepublica.pe/200x0/larepublica/imagen/2018/08/20/noticia-selena-gomez-instagram-tatuajes-significado-justin-bieber0011capa-1.png
			//   https://prod.presets.larepublica.pe/x/larepublica/imagen/2018/08/20/noticia-selena-gomez-instagram-tatuajes-significado-justin-bieber0011capa-1.png
			domain === "prod.presets.larepublica.pe") {
			// https://multimedia.larepublica.pe/660x392/larepublica/imagen/2018/08/20/noticia-selena-gomez-instagram-tatuajes-significado-justin-bieber0011capa-1.png
			//   https://prod.presets.larepublica.pe/x/larepublica/imagen/2018/08/20/noticia-selena-gomez-instagram-tatuajes-significado-justin-bieber0011capa-1.png
			// is this locked to 1000 width?
			return src.replace(/(:\/\/[^/]*\/)(?:[0-9]+)?x(?:[0-9]+)?\//, "$1x/");
		}

		if (domain_nowww === "wallpaperfm.com") {
			// https://wallpaperfm.com/img/sm/5/a/e/39032.jpg
			//   https://wallpaperfm.com/img/original/5/a/e/39032.jpg
			return src.replace(/\/img\/+[a-z]+\/+/, "/img/original/");
		}

		if (domain === "dux7id0k7hacn.cloudfront.net") {
			// https://dux7id0k7hacn.cloudfront.net/as/assets-mem-com/cmi/5/0/1/3/8263105/20190424_194834002_0_orig.jpg/-/cindy-nystrom-hanford-ca-obituary.jpg?maxwidth=650
			//   https://dux7id0k7hacn.cloudfront.net/as/assets-mem-com/cmi/5/0/1/3/8263105/20190424_194834002_0_orig.jpg
			return src.replace(/(\/cmi\/+(?:[0-9]\/+){4}[0-9]+\/+[^/]*\.[^/.]*)\/.*$/, "$1");
		}

		if (domain_nowww === "printel.biz" ||
			// http://steklozerkalo116.ru/thumb/2/xY58kKCGoOvYNcykPP4K1g/640r480/d/print0018_19.jpg
			//   http://steklozerkalo116.ru/d/print0018_19.jpg
			domain_nowww === "steklozerkalo116.ru" ||
			// http://studio-14.ru/thumb/2/ShlxbRSDgxEaM5zrkJkdNA/640r480/d/%28112%29_13.jpg
			//   http://studio-14.ru/d/%28112%29_13.jpg
			domain_nowww === "studio-14.ru") {
			// both are watermarked
			// http://printel.biz/thumb/2/r2TAy_cULqwtrJ6jSajVfA/640r480/d/0119011.jpg
			//   http://printel.biz/d/0119011.jpg
			return src.replace(/\/thumb\/.*(\/d\/+[^/]*\.[^/.]*)(?:[?#].*)?$/, "$1");
		}

		if (domain_nowww === "10wallpaper.com" &&
			options && options.cb && options.do_request) {
			// https://www.10wallpaper.com/wallpaper/medium/1312/blooming_flowers_plants_Macro_photography_wallpaper_08_medium.jpg
			//   https://www.10wallpaper.com/wallpaper/1920x1200/1312/blooming_flowers_plants_Macro_photography_wallpaper_08_1920x1200.jpg
			var id = src.replace(/.*\/wallpaper\/+[^/]*\/+[0-9]+\/+([^/]*)_[^./_]+\.[^/.]*(?:[?#].*)?$/, "$1");
			if (id !== src) {
				options.do_request({
					url: "https://www.10wallpaper.com/view/" + id + ".html",
					method: "GET",
					onload: function(resp) {
						if (resp.readyState === 4) {
							var match = resp.responseText.match(/>Original Resolution: <a\s+href=["'](\/wallpaper\/[^'"]+)/);
							if (match) {
								options.cb(urljoin(src, match[1], true));
							} else {
								options.cb(null);
							}
						}
					}
				});

				return {
					waiting: true
				};
			}
		}

		if (domain_nosub === "wallpapersok.com" && domain.match(/^cdn[0-9]*\./)) {
			// http://cdn2.wallpapersok.com/uploads/picture/669/332/332669/picture-332669.jpg?width=160&height=90&crop=true -- 403 for head (maybe? seems fine now)
			//   https://cdn3.wallpapersok.com/uploads/picture/669/332/332669/picture-332669.jpg
			// http://cdn3.wallpapersok.com/uploads/picture/148/108/108148/thumbs_cvety-krasivye-lepestki.jpg
			//   https://cdn3.wallpapersok.com/crop/uploads/picture/148/108/108148/cvety-krasivye-lepestki.jpg?width=8500&height=5666
			//   https://cdn3.wallpapersok.com/uploads/picture/148/108/108148/cvety-krasivye-lepestki.jpg
			return src.replace(/\/(?:crop\/+)?(uploads\/+picture\/+[0-9]{3}\/+[0-9]{3}\/+[0-9]+\/+)(?:thumbs_)?([^/?]*)(?:[?#].*)?$/,
							   "/$1$2");
		}

		if (domain_nowww === "woweiquan.com") {
			// http://www.woweiquan.com/Service/Img/wx?url=http://mmbiz.qpic.cn/mmbiz/6MNCByARShGr3MvvRY3Enr5qLdblcmST1xttic63z7OjN8fLh17yQU4srgykuNaDhkfriaLjCtHrF7x1b6F6Qe2g/0
			//   http://mmbiz.qpic.cn/mmbiz/6MNCByARShGr3MvvRY3Enr5qLdblcmST1xttic63z7OjN8fLh17yQU4srgykuNaDhkfriaLjCtHrF7x1b6F6Qe2g/0
			return decodeuri_ifneeded(src.replace(/^[a-z]+:\/\/[^/]*\/Service\/+Img\/+wx.*?[?&]url=([^&].*)?.*?$/, "$1"));
		}

		if (domain === "s.kaskus.id") {
			// https://s.kaskus.id/r100x100/images/2018/09/17/9931398_201809171255030543.jpg
			//   https://s.kaskus.id/images/2018/09/17/9931398_201809171255030543.jpg
			// https://s.kaskus.id/c150x150/user/avatar/2013/07/15/avatar5671610_13.gif
			//   https://s.kaskus.id/user/avatar/2013/07/15/avatar5671610_13.gif
			return {
				url: src.replace(/(:\/\/[^/]*\/+)[rc][0-9]+x[0-9]+\/+/, "$1"),
				headers: {
					Referer: "https://www.kaskus.co.id"
				}
			};
		}

		if (domain === "dl.kaskus.id") {
			// https://dl.kaskus.id/img256.imagevenue.com/loc253/th_47582_jamie_chung_randall_slavin_ps_001_122_253lo.jpg
			//   http://img2256.imagevenue.com/aAfkjfp01fo1i-17901/loc253/47582_jamie_chung_randall_slavin_ps_001_122_253lo.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+([^/]*\.[^/]*\/)/, "$1");
			if (newsrc !== src)
				return add_http(newsrc);

			return {
				url: src,
				headers: {
					Referer: ""
				}
			}
		}

		if (domain_nowww === "shofona.net") {
			// http://www.shofona.net/cached_uploads/resize/250/250/selena-gomez-20161468399149.jpg
			//   http://www.shofona.net/cached_uploads/full/selena-gomez-20161468399149.jpg
			return src.replace(/\/cached_uploads\/+resize\/+[0-9]+\/+[0-9]+\/+/, "/cached_uploads/full/");
		}

		if (domain_nowww === "bayanbox.ir") {
			// http://bayanbox.ir/preview/8934426984286590860/Selena-gomez-time-magazine-s-firsts-issue-september-2017.jpg
			//   http://bayanbox.ir/view/8934426984286590860/Selena-gomez-time-magazine-s-firsts-issue-september-2017.jpg
			return src.replace(/\/preview\/+([0-9]+)\/+/, "/view/$1/");
		}

		if (domain_nowww === "guiadasemana.com.br") {
			// https://www.guiadasemana.com.br/contentFiles/image/opt_w840h0/mississipi-pizza-bar-divulgacao-agencia-dots.jpg
			//   https://www.guiadasemana.com.br/contentFiles/image/mississipi-pizza-bar-divulgacao-agencia-dots.jpg
			// https://www.guiadasemana.com.br/contentFiles/system/pictures/2016/1/150773/cropped/09710035.jpg
			//   https://www.guiadasemana.com.br/contentFiles/system/pictures/2016/1/150773/original/09710035.jpg
			return src
				.replace(/(\/contentFiles\/+image\/+)opt_[^/]*\/+/, "$1")
				.replace(/(\/contentFiles\/+system\/+pictures\/+[0-9]{4}\/+[0-9]+\/+[0-9]+\/+)[a-z]+\/+/, "$1original/");
		}

		if (domain === "img.arabstoday.net") {
			// https://img.arabstoday.net/2019/05/small/Arabstoday-katy-perry.jpg
			//   https://img.arabstoday.net/2019/05/normal/Arabstoday-katy-perry.jpg
			// small, exlarge, normal
			return src.replace(/(\/[0-9]{4}\/+[0-9]{2}\/+)[a-z]+\/+/, "$1normal/");
		}

		if (domain_nowww === "nodud.com") {
			// https://nodud.com/u/sized/source/medias/1397/05/10/72gr0-crop-c0-5__0-5-640x360-75.jpg
			//   https://nodud.com/u/source/medias/1397/05/10/72gr0.jpg
			return src.replace(/\/sized\/+(source\/+.*\/[0-9a-z]+)-[^/]*(\.[^/.]*)(?:[?#].*)?$/, "/$1$2");
		}

		if (domain === "g.acdn.no") {
			// https://g.acdn.no/obscura/API/dynamic/r1/external/tr_380_5000_s_f/2001-01-01T01%3A01%3A01.000%2B0200/https%3A//smooth-storage.aptoma.no/users/drf-amedia/images/6698714.jpg%3FaccessToken%3Ddd18973b1a2af5ef453bae122a2c435f356eecb2d1d503e0ed8e45cf92a878bd?chk=091B46
			//   https://smooth-storage.aptoma.no/users/drf-amedia/images/6698714.jpg?accessToken=dd18973b1a2af5ef453bae122a2c435f356eecb2d1d503e0ed8e45cf92a878bd
			newsrc = src.replace(/.*?\/API\/+dynamic\/+r1\/+external\/+[^/]*\/+[^/]*\/+(https?.*?)(?:[?#].*)?$/, "$1");
			if (newsrc !== src)
				return decodeURIComponent(newsrc);
		}

		if (domain_nowww === "pensorosa.com") {
			// http://www.pensorosa.com/upload/smallthumbs/selena-gomez-abito-rosso-in-pizzo-94F1.jpg
			//   http://www.pensorosa.com/upload/images/selena-gomez-abito-rosso-in-pizzo-94F1.jpg
			return src.replace(/\/upload\/+[a-z]+\/+/, "/upload/images/");
		}

		if (domain === "smlycdn.akamaized.net") {
			// https://smlycdn.akamaized.net/products/270x270-fill/11ed80e2b3/3575561644dec31b07633edf26ffbd414af2a2b5.jpg
			//   https://smlycdn.akamaized.net/data/product2/2/3575561644dec31b07633edf26ffbd414af2a2b5_l.jpg
			return src.replace(/\/products\/+[^/]*\/+[0-9a-f]+\/+([0-9a-f]+)(\.[^/.]*)(?:[?#].*)?$/,
							   "/data/product2/2/$1_l$2");
		}

		if (domain === "cdn.aizel.ru") {
			// https://cdn.aizel.ru/i/244x366/718098.jpg
			//   https://cdn.aizel.ru/i/718098.jpg
			return src.replace(/\/i\/+[0-9]+x[0-9]+\/+([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/i/$1");
		}

		if (domain_nowww === "trelisecooperonline.com") {
			// https://www.trelisecooperonline.com/user/images/21621_560_840.jpg?t=1607061556
			//   https://www.trelisecooperonline.com/user/images/21621.jpg?t=1607061556
			return src.replace(/\/user\/+images\/+([0-9]+)_[0-9]+_[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "/user/images/$1$2");
		}

		if (domain_nowww === "thairomances.com") {
			// https://thairomances.com/userfiles/ProfilePhoto/12353/34081-200x200.2.jpg
			//   https://thairomances.com/userfiles/ProfilePhoto/12353/34081-full_size.2.jpg
			return src.replace(/(\/userfiles\/+[^/]*\/+[0-9]+\/+[0-9]+-)[0-9]+x[0-9]+\./, "$1full_size.");
		}

		if (domain === "cn.opendesktop.org" ||
			// https://cdn.pling.com/cache/85x85-crop/img/e/5/c/8/c4f7b851ffdc6b8ed65a36dba14ebe877b91.png
			//   https://cdn.pling.com/img/e/5/c/8/c4f7b851ffdc6b8ed65a36dba14ebe877b91.png
			domain === "cdn.pling.com") {
			// https://cn.opendesktop.org/cache/85x85-crop/img/a/9/8/d/3cfd377ef98337a694c5bf79dc93d6524005.png
			//   https://cn.opendesktop.org/img/a/9/8/d/3cfd377ef98337a694c5bf79dc93d6524005.png
			// https://cn.opendesktop.org/cache/200x200/img/7/9/5/f/a99d0af9e85271c8631c558eb56b3aa93991.png -- upscaled
			//   https://cn.opendesktop.org/img/7/9/5/f/a99d0af9e85271c8631c558eb56b3aa93991.png
			// https://cn.opendesktop.org/cache/167x167-0/img/2/b/f/9/d9ef08259a5aadd16e7cb7bfd828bc4c57ed.png
			//   https://cn.opendesktop.org/img/2/b/f/9/d9ef08259a5aadd16e7cb7bfd828bc4c57ed.png
			return src.replace(/\/cache\/+[0-9]+x[0-9]+(?:-[a-z0-9]+)?\/+img\/+/, "/img/");
		}

		if (domain === "cdn.ren.tv") {
			// thanks to roi
			// https://cdn.ren.tv/cache/448x252/media/img/6a/0f/6a0f018ccd4381980fb02f24cd8c4f421b1e65b3.jpg
			//   https://cdn.ren.tv/media/img/6a/0f/6a0f018ccd4381980fb02f24cd8c4f421b1e65b3.jpg
			return src.replace(/\/cache\/+[0-9]+x[0-9]+\/+media\/+/, "/media/");
		}

		if (domain_nowww === "3dnews.ru") {
			// https://3dnews.ru/assets/external/illustrations/2018/10/04/976375/sm.574A3720.750.JPG
			//   https://3dnews.ru/assets/external/illustrations/2018/10/04/976375/574A3720.JPG
			// https://3dnews.ru/z/ac:if/w:g/2018/10/04/5bb65922b4182e8a7b8b456e/03201c1e8ef2a60e47e3e82426ac26c4.png/400
			//   https://3dnews.ru/assets/external/galleries/2018/10/04/5bb65922b4182e8a7b8b456e/03201c1e8ef2a60e47e3e82426ac26c4.png
			return src
				.replace(/(\/assets\/.*\/)[a-z]+\.([0-9A-Z]+)\.[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2$3")
				.replace(/\/z\/.*?\/([0-9]{4}\/+[0-9]{2}\/+[0-9]{2}\/+[0-9a-f]+\/+[0-9a-fA-Z]+\.[^/.]*)(?:\/+[0-9]+)?(?:[?#].*)?$/,
						 "/assets/external/galleries/$1");
		}

		if (domain === "mix.tn.kz" ||
			// https://tengrinews.kz/userdata/news/2014/news_266860/thumb_b/photo_144147.jpg -- upscaled?
			//   https://tengrinews.kz/userdata/news/2014/news_266860/photo_144147.jpg -- more upscaled?
			domain === "tengrinews.kz") {
			// https://mix.tn.kz/userdata/news/2017/news_330445/thumb_b/photo_231398.jpg
			//   https://mix.tn.kz/userdata/news/2017/news_330445/photo_231398.jpg
			return src.replace(/\/thumb_[a-z]+\/+(photo_[0-9]+\.[^/.]*)(?:[?#].*)?$/,
							   "/$1");
		}

		if (domain_nowww === "overclockers.ru") {
			// thanks to anonymous for reporting:
			// https://overclockers.ru/st/r/100/-/images/lab/2015/07/25/1/101.jpg
			//   https://st.overclockers.ru/r/100/-/images/lab/2015/07/25/1/101.jpg
			return src.replace(/:\/\/[^/]+\/+st\/+(.*)$/, "://st." + domain_nosub + "/$1");
		}

		if (domain === "st.overclockers.ru") {
			// https://st.overclockers.ru/c/350/300//images/preview/gOYpTW9P4Cko6erw.jpg
			//   https://st.overclockers.ru/images/preview/gOYpTW9P4Cko6erw.jpg
			// https://st.overclockers.ru/r/100/-/images/lab/2015/07/25/1/101.jpg
			//   https://st.overclockers.ru/images/lab/2015/07/25/1/101.jpg
			//   https://st.overclockers.ru/images/lab/2015/07/25/1/101_big.jpg
			return src
				.replace(/(:\/\/[^/]+\/+images\/+lab\/+[0-9]{4}\/+[0-9]{2}\/+[0-9]{2}\/+[0-9]+\/+[0-9]+)\./, "$1_big.")
				.replace(/\/(?:c\/+[0-9]+\/+[0-9]+|r\/+[-0-9]+\/+[-0-9]+)\/+images\//, "/images/");
		}

		if (domain_nosub === "kpcdn.net" && /^s[0-9]*\.stc\.[a-z]+\./.test(domain)) {
			// https://s9.stc.all.kpcdn.net/share/i/12/10613751/inx960x640.jpg
			//   https://s9.stc.all.kpcdn.net/share/i/12/10613751/original.jpg
			//   https://kp.ru/share/i/12/10613751
			// https://s12.stc.all.kpcdn.net/share/i/4/1567725/wx1080.jpg
			//   https://s12.stc.all.kpcdn.net/share/i/4/1567725/original.jpg
			// https://s11.stc.all.kpcdn.net/share/i/12/10927164/wr-720.sh-18.jpg
			//   https://s11.stc.all.kpcdn.net/share/i/12/10927164/original.jpg
			//   https://kp.ru/share/i/12/10927164/
			//   https://kp.ru/share/i/12/10927164
			// thanks to roi:
			// https://s12.stc.yc.kpcdn.net/share/i/12/12995962/wr-750.webp
			//   https://www.kp.ru/share/i/12/12995962

			//return src.replace(/(\/share\/+i\/+[0-9]+\/+[0-9]+\/+)(?:(?:inx[0-9]+|[a-z]+)x[0-9]+|(?:(?:[wh]r|sh)-[0-9]+\.?){1,})(\.[^/.]*)(?:[?#].*)?$/,
			//                   "$1original$2");
			// not only is this rule simpler, it also preserves the numbers in the filename (instead of saving it as "original")
			return src.replace(/^[a-z]+:\/\/[^/]*\/(share\/+i\/+[0-9]+\/+[0-9]+)\/+(?:[^/]*\.[^/.]*)?(?:[?#].*)?$/, "https://kp.ru/$1");
		}

		if (domain_nowww === "kp.ru") {
			// https://kp.ru/share/i/12/10927164/wr-1200.sh-18.jpg
			//   https://kp.ru/share/i/12/10927164
			return src.replace(/^[a-z]+:\/\/[^/]*\/(share\/+i\/+[0-9]+\/+[0-9]+)\/+(?:[^/]*\.[^/.]*)?(?:[?#].*)?$/, "https://kp.ru/$1");
		}

		if (domain_nowww === "oplace.ru") {
			// https://oplace.ru/images/photos/medium/0758391fbcc1b394f9b1fd4ce35b66b7.jpg
			//   https://oplace.ru/images/photos/0758391fbcc1b394f9b1fd4ce35b66b7.jpg
			return src.replace(/\/images\/+photos\/+[a-z]+\/+([0-9a-f]+\.[^/.]*)(?:[?#].*)?$/, "/images/photos/$1");
		}

		if (domain_nosub === "rightinthebox.com" && domain.match(/^[ml]i/)) {
			// thanks to AdClear247 on github: https://github.com/qsniyg/maxurl/issues/697
			// https://li0.rightinthebox.com/images/64x84/201908/ifma1564742127689.jpg?fmt=webp&v=1 -- 64x84
			//   https://li0.rightinthebox.com/images/v/201908/ifma1564742127689.jpg?fmt=webp&v=1 -- 500x500 (watermarked)
			//   https://li0.rightinthebox.com/images/x/201908/ifma1564742127689.jpg?fmt=webp&v=1 -- 640x800 (no watermark)
			// https://li3.rightinthebox.com/images/384x384/201705/brry1494484108987.jpg
			//   https://li3.rightinthebox.com/images/x/201705/brry1494484108987.jpg -- 640x800, upscaled?
			// https://li0.rightinthebox.com/images/1500x1500/202002/anyn1582250110853.jpg -- 1140x1500 (watermarked)
			// https://li0.rightinthebox.com/images/1500x1500/201404/ylmlgf1397096777328.jpg
			//   https://li0.rightinthebox.com/images/x/201404/ylmlgf1397096777328.jpg -- edges are cut
			// https://li0.rightinthebox.com/images/x/201912/jteckn1576655791029.jpg
			//   https://li0.rightinthebox.com/images/1500x1500/201912/jteckn1576655791029.jpg -- edges are extended to white
			// other:
			// https://li0.rightinthebox.com/images/wholesale/202007/0e4f07c06ffbe719ed3891b1a6312731.jpg -- 1969x2048
			// https://li0.rightinthebox.com/images/wholesale/201908/8e232449da6a06bde66a53d017694114.jpg -- 2220x2125, upscaled
			// https://mi0.rightinthebox.com/images/avatar/202012/cmxf1608422355.jpg -- 2342x2342
			// https://li0.rightinthebox.com/images/dfp/201804/LITB_c1190_82892_9877_f606_en.jpg?33 -- 2481x3509
			// https://li0.rightinthebox.com/images/small_video_images/202103/bps/video/inc/cvijsg1614596518831.jpg -- 2000x2000
			// https://li0.rightinthebox.com/webp_desc_image/201908/rdkyry1564742529946.jpg?fmt=webp&com=1&v=1 -- 790x882, watermarked
			//   https://li0.rightinthebox.com/webp_desc_image/201908/rdkyry1564742529946.jpg?fmt=webp&v=1 -- 1500x1500, upscaled

			// c = 32x42
			// s = 42x42
			// d = 65x85
			// p = 85x85
			// e = 97x128
			// m = 128x128
			// f = 228x228
			// l = 280x280
			// a = 180x290
			// b = 237x382
			// w = 380x500 (watermarked, edges are still extended for brry)
			// v = 500x500 (watermarked)
			// x = 640x800

			regex = /(:\/\/[^/]*\/images\/+)(?:[0-9]+x[0-9]+|[a-z])\//;
			if (regex.test(src)) {
				src = remove_queries(src, ["fmt"]);
				return fillobj_urls([
					src.replace(regex, "$11500x1500/"),
					src.replace(regex, "$1x/")
				], {
					headers: {
						Origin: "https://www.lightinthebox.com",
						Referer: "https://www.lightinthebox.com/"
					},
					can_head: false // 403
				});
			}
		}

		if (domain === "img.esportnews.gg") {
			// https://img.esportnews.gg/pictures/content/29/29502_750.jpg
			//   https://img.esportnews.gg/pictures/content/29/29502.jpg
			return src.replace(/(\/pictures\/+content\/+[0-9]+\/+[0-9]+)_[0-9]+(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain === "img.tyt.by") {
			// https://img.tyt.by/720x720s/n/erchak/05/7/unicon_yerch_tutby_phsl_yyd_0506.jpg
			//   https://img.tyt.by/n/erchak/05/7/unicon_yerch_tutby_phsl_yyd_0506.jpg
			return src.replace(/(:\/\/[^/]*\/)[0-9]+x[0-9]+[a-z]\/+/, "$1");
		}

		if (domain === "vi.ill.in.ua") {
			// https://vi.ill.in.ua/m/625x469/1368651.jpg
			//   https://vi.ill.in.ua/m/0x0/1368651.jpg
			return src.replace(/(:\/\/[^/]*\/[a-z]\/+)[0-9]+x[0-9]+\/+/, "$10x0/");
		}

		if (domain_nowww === "vsco.co") {
			// https://vsco.co/vsco/media/5f75c19c8a52e342da6d7c4e
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+[^/]+\/+media\/+([0-9a-f]{10,})(?:[?#].*)?$/,
				query_for_id: "https://vsco.co/vsco/media/${id}",
				process: function(done, resp, cache_key, match) {
					var id = match[1];

					var obj:BigImageInfoSObject = {
						extra: {
							page: resp.finalUrl
						}
					};

					var match = resp.responseText.match(/window\.__PRELOADED_STATE__\s*=\s*({.*?});?\s*<\/script/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					var json = JSON_parse(match[1]);
					var media = json.medias.byId[id].media;
					//console_log(media);

					obj.extra.caption = media.description;
					// other options are captureDate, captureDateMs, imageStatus.time, and lastUpdated
					obj.extra.created_date = media.uploadDate;
					obj.extra.updated_date = media.lastUpdated;
					obj.extra.author_username = media.permaSubdomain; // or gridName

					let urls = [];

					if (media.videoUrl)
						urls.push({
							url: force_https(add_http(media.videoUrl)),
							video: true
						});

					urls.push(force_https(add_http(media.responsiveUrl)));

					return done(fillobj_urls(urls, obj), 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nosub === "vsco.co" && domain.match(/^image(?:-aws)?.*/) ||
			// https://im.vsco.co/aws-us-west-2/b68580/74476754/5c7624c5ef3068500ce138b2/vsco5c7624c5c4814.jpg
			// https://im.vsco.co/aws-us-west-2/c57038/3396531/5e23fa18f16df80b105598a9/vsco5e23fa23d502a.jpg?w=260
			domain === "im.vsco.co") {
			// https://im.vsco.co/aws-us-west-2/f7e1c6/20638915/5cc9a1ed32fea5392de5c0e7/vsco5cc9a1ee9e4b5.jpg?w=360 -- gets automatically redirected
			//   https://image-aws-us-west-2.vsco.co/f7e1c6/20638915/5cc9a1ed32fea5392de5c0e7/vsco5cc9a1ee9e4b5.jpg
			// thanks to modelfe on github: https://github.com/qsniyg/maxurl/issues/57
			// https://image-aws-us-west-2.vsco.co/00b02e/28967640/5cdace744c51282134f55d8c/735x1024/vsco5cdace96a2daa.jpg
			//   https://image-aws-us-west-2.vsco.co/00b02e/28967640/5cdace744c51282134f55d8c/vsco5cdace96a2daa.jpg
			// https://image.vsco.co/1/552f8734525d23396531/5603ae65d3dca50b0760e937/720x960/vsco_092415.jpg
			//   https://image.vsco.co/1/552f8734525d23396531/5603ae65d3dca50b0760e937/vsco_092415.jpg
			// https://image-aws-us-west-2.vsco.co/c69ba2/8053058/5c9d80d33722ba472b0dd822/105x105/92bb3b19587edeb604d5dde82167a9ac/vsco5c9d80d3bc610.jpg
			//   https://image-aws-us-west-2.vsco.co/c69ba2/8053058/5c9d80d33722ba472b0dd822/vsco5c9d80d3bc610.jpg
			newsrc = src
				.replace(/(vsco_?[0-9a-f]+\.[^/.?#]*)(?:[?#].*)?$/, "$1")
				.replace(/(\/[0-9a-f]{20,}\/+)[0-9]+x[0-9]+\/+(?:[0-9a-f]+\/+)?(vsco_?[0-9a-f]+\.[^/.?#]*)(?:[?#].*)?$/, "$1$2");
			if (newsrc !== src)
				return {
					url: newsrc,
					can_head: false
				};

			// thanks to remlap and Flame for reporting:
			// https://image-aws-us-west-2.vsco.co/derivative/5f64e7566a42a63298549df8?fit=crop&h=210&w=210
			// https://image-aws-us-west-2.vsco.co/derivative/c69ba2/8053058/5c9d80d33722ba472b0dd822/vsco5c9d80d3bc610.jpg
			match = src.match(/\/derivative\/+(?:[0-9a-f]+\/+[0-9]+\/+)?([0-9a-f]{20,})/);
			if (options.do_request && options.cb && match) {
				common_functions["get_redirect_url"](api_cache, options, "https://vsco.co/i/" + match[1], function(url) {
					options.cb({
						url: url,
						can_head: false
					});
				});

				return {
					waiting: true
				};
			}

			match = src.match(/^[a-z]+:\/\/[^/]+\/+(?:(?:aws-[^/]+\/+)?[0-9a-f]{6}\/+[0-9]+|[0-9]+\/+[0-9a-f]{10,})\/+([0-9a-f]{20,})\/+/);
			if (match && options.force_page) {
				return {
					url: "https://vsco.co/vsco/media/" + match[1],
					can_head: false,
					is_pagelink: true
				};
			}
		}

		if (domain === "i.vsco.co" && options.do_request && options.cb) {
			// thanks to remlap for reporting:
			// https://vsco.co/i/[0-9a-f]{6}
			if (/\/i\/+[0-9a-f]+$/.test(src)) {
				common_functions["get_redirect_url"](api_cache, options, {
					url: src,
					headers: {
						Referer: "https://vsco.co"
					}
				}, function(url) {
					options.cb({
						url: url,
						can_head: false
					});
				});
			}
		}

		if (domain_nowww === "screenbeauty.com") {
			// https://screenbeauty.com/image/compress/selena-gomez-actress-celebrity-118789.jpg
			//   https://screenbeauty.com/image/wallpapers/selena-gomez-actress-celebrity-118789.jpg -- mildly upscaled?
			// doesn't work for all:
			// https://screenbeauty.com/image/compress/selena-gomez-actress-singer-123164.jpg
			return src.replace(/\/image\/+compress\/+/, "/image/wallpapers/");
		}

		if (domain === "e.radio-studio92.io") {
			// https://e.radio-studio92.io/large/2018/09/04/030603_672758.jpg
			//   https://e.radio-studio92.io/xlarge/2018/09/04/030603_672758.jpg -- upscaled?
			// https://e.radio-studio92.io/medium/2014/09/09/1435649.jpg
			//   https://e.radio-studio92.io/xlarge/2014/09/09/1435649.jpg
			return src.replace(/(:\/\/[^/]*\/)[a-z]+\/+([0-9]{4}\/+[0-9]{2}\/+[0-9]{2}\/+[0-9]+(?:_[0-9]+)?\.[^/.]*)(?:[?#].*)?$/,
							   "$1xlarge/$2");
		}

		if (amazon_container === "topdesk") {
			// https://s3.amazonaws.com/topdesk/users/profile_photos/000/116/327/thumbnail/20185779926_6151dcf983_k.jpg?1438676831
			//   https://s3.amazonaws.com/topdesk/users/profile_photos/000/116/327/original/20185779926_6151dcf983_k.jpg?1438676831
			return src.replace(/\/((?:[0-9]{3}\/+){3})[a-z]+\/+([^/]*)(?:[?#].*)?$/, "/$1original/$2");
		}

		if (domain === "static.hdw.eweb4.com") {
			// http://static.hdw.eweb4.com/media/wp_400/1/2/10119.jpg
			//   http://static.hdw.eweb4.com/media/wallpapers/1/2/10119.jpg
			return src.replace(/\/media\/+wp_[0-9]+\/+/, "/media/wallpapers/");
		}

		if (domain_nowww === "sitioandino.com.ar") {
			// http://www.sitioandino.com.ar/files/image/124/124913/52a5c4da966ba_896_607!.jpg?s=4b20217a178de01dd773d7926817e735&d=1536027357
			//   http://www.sitioandino.com.ar/files/image/124/124913/52a5c4da966ba.jpg?s=4b20217a178de01dd773d7926817e735&d=1536027357
			return src.replace(/(\/files\/+image\/+[0-9]+\/+[0-9]+\/+[0-9a-f]+)_[0-9]+_[0-9]+!(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain === "demo.brainymore.com") {
			// http://demo.brainymore.com/joomla-extensions/images/entertaiment/thumbs/6_270x150.jpg
			//   http://demo.brainymore.com/joomla-extensions/images/entertaiment/6.jpg
			return src.replace(/\/thumbs\/+([0-9]+)_[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "/$1$2");
		}

		if (domain_nosub === "1freewallpapers.com" && domain.match(/^data[0-9]*\./)) {
			// https://data2.1freewallpapers.com/thumb/selena-gomez-dress-celebrity.jpg
			//   https://data2.1freewallpapers.com/original/selena-gomez-dress-celebrity.jpg
			// https://data2.1freewallpapers.com/download/selena-gomez-dress-celebrity-960x540.jpg
			//   https://data2.1freewallpapers.com/original/selena-gomez-dress-celebrity.jpg
			return src
				.replace(/(:\/\/[^/]*\/)download\/+([^/]+)-[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1original/$2$3")
				.replace(/(:\/\/[^/]*\/)[a-z]+\/+([^/]*\.[^/.]*)(?:[?#].*)?$/, "$1original/$2");
		}

		if (domain_nowww === "downloadwallpapers.info") {
			// https://www.downloadwallpapers.info/thumbs/2015/07/20/719020_selena-gomez_1920x1440_h.jpg
			//   https://www.downloadwallpapers.info/dl/o/2015/07/20/719020_selena-gomez_1920x1440_h.jpg
			// https://www.downloadwallpapers.info/dl/1400x1050//2015/09/11/761963_selena-gomez_1920x1440_h.jpg
			//   https://www.downloadwallpapers.info/dl/o/2015/09/11/761963_selena-gomez_1920x1440_h.jpg
			// https://www.downloadwallpapers.info/preview/2015/09/11/761963_selena-gomez_1920x1440_h.jpg
			//   https://www.downloadwallpapers.info/dl/o/2015/09/11/761963_selena-gomez_1920x1440_h.jpg
			return src.replace(/(:\/\/[^/]*\/)(?:thumbs|preview|dl\/+[^/]*)\/+([0-9]{4})\/+/, "$1dl/o/$2/");
		}

		if (domain_nowww === "miyanali.com") {
			// https://miyanali.com/patch2image.php?w=100&h=auto&patch=usr/farshid73/gal7.jpg&852180858
			//   https://miyanali.com/patch2image.php?patch=usr/farshid73/gal7.jpg&852180858
			//   https://miyanali.com/usr/farshid73/gal7.jpg
			return src.replace(/(:\/\/[^/]*\/)patch2image\.php.*?[?&]patch=(usr\/[^&]*).*?$/, "$1$2");
		}

		if (domain_nowww === "all4desktop.com") {
			// http://all4desktop.com/data_images/1024%20x%20768/4215851-selena-gomez-24-normal.jpg
			//   http://all4desktop.com/data_images/original/4215851-selena-gomez-24-normal.jpg
			return src.replace(/\/data_images\/+[0-9]+(?:%20|\s)*x(?:%20|\s)*[0-9]+\/+/, "/data_images/original/");
		}

		if (amazon_container === "hsdreams1") {
			// https://s3.ap-south-1.amazonaws.com/hsdreams1/pins/2019/05/medium/a1ef7be28cdfb28bf5e194fc6c6e263c.jpeg
			//   https://s3.ap-south-1.amazonaws.com/hsdreams1/pins/2019/05/big/a1ef7be28cdfb28bf5e194fc6c6e263c.jpeg -- upscaled?
			return src.replace(/(\/[0-9]{4}\/+[0-9]{2}\/+)[a-z]+(\/+[0-9a-f]+\.[^/.]*)(?:[?#].*)?$/, "$1big$2");
		}

		if (domain === "cdn.quotesgram.com") {
			// https://cdn.quotesgram.com/small/6/32/484504371-158059707_peyton-list-disneys-jessie-signed-8x10-photo-not-a-.jpg
			//   https://cdn.quotesgram.com/img/6/32/484504371-158059707_peyton-list-disneys-jessie-signed-8x10-photo-not-a-.jpg
			return src.replace(/(:\/\/[^/]*\/)[a-z]+\/+/, "$1img/");
		}

		if (domain_nowww === "razdachi.net" ||
			// http://www.wallpaperfuel.com/thumbnail/namie-amuro/namie-amuro-105017.jpg
			//   http://www.wallpaperfuel.com/wallpaper/namie-amuro/namie-amuro-105017.jpg
			domain_nowww === "wallpaperfuel.com") {
			// http://www.razdachi.net/thumbnail/emma-stone/emma-stone-57485.jpg
			//   http://www.razdachi.net/wallpaper/emma-stone/emma-stone-57485.jpg
			return src.replace(/(:\/\/[^/]*\/)thumbnail\/+/, "$1wallpaper/");
		}

		if (domain_nowww === "zazzybabes.com") {
			// https://zazzybabes.com/girls/emma-stone/thumb-emma-stone-red-head-24145.jpg
			//   https://zazzybabes.com/girls/emma-stone/emma-stone-red-head-24145.jpg
			return src.replace(/\/(girls)\/+([^/]*\/+)thumb-([^/]*\.[^/.]*)(?:[?#].*)?$/, "/$1/$2$3");
		}

		if (domain_nosub === "mtime.cn" && domain.match(/^img[0-9]*\./)) {
			// http://img21.mtime.cn/pi/2010/05/04/132834.62396121_220X220.jpg
			//   http://img21.mtime.cn/pi/2010/05/04/132834.62396121.jpg -- 500x799
			//   http://img21.mtime.cn/pi/2010/05/04/132834.62396121_0.jpg -- 959x1532
			// http://img5.mtime.cn/CMS/Gallery/2019/05/21/081157.95717482_1000.jpg
			//   http://img5.mtime.cn/CMS/Gallery/2019/05/21/081157.95717482_0.jpg
			// http://img31.mtime.cn/ph/2016/09/03/232731.47579434_1280X720X2.jpg
			return {
				url: src.replace(/(\.[0-9]+)(?:_[0-9]+(?:X[0-9]+){0,2})?(\.[^/.]*)(?:[?#].*)?$/, "$1_0$2"),
				head_wrong_contenttype: true
			};
		}

		if (domain === "images.gutefrage.net") {
			// https://images.gutefrage.net/media/fragen/bilder/welche-lieblings-schauspielerin-habt-ihr/0_big.jpg?v=1488126630000
			//   https://images.gutefrage.net/media/fragen/bilder/welche-lieblings-schauspielerin-habt-ihr/0_original.jpg?v=1488126630000
			return src.replace(/(\/bilder\/+[^/]*\/+[0-9]+_)[a-z]+(\.[^/.]*)(?:[?#].*)?$/, "$1original$2");
		}

		if (domain === "v.angel-porns.com" ||
			// http://www.sexgirlspics.com/pics/asians/ae/13444/0174-6-wn/tnsn001.jpg
			//   http://www.sexgirlspics.com/pics/asians/ae/13444/0174-6-wn/sn001.jpg
			domain_nowww === "sexgirlspics.com") {
			// http://v.angel-porns.com/pics/asians/pacificgirls/0559-rm/tnsn002.jpg
			//   http://v.angel-porns.com/pics/asians/pacificgirls/0559-rm/sn002.jpg
			// http://v.angel-porns.com/pics/asians/allgravure/3652-ae/tnxsn003.jpg
			//   http://v.angel-porns.com/pics/asians/allgravure/3652-ae/sn003.jpg
			return src.replace(/\/tnx?(sn[0-9]+\.[^/.]*)(?:[?#].*)?$/, "/$1");
		}

		if (domain === "cdn15764270.ahacdn.me" ||
			// http://pornopicshub.com/galleries/digitaldesire.com/5db0b3727a72776b59d08aa804a36380b31895f9/300x400/001.jpg
			//   http://pornopicshub.com/galleries/digitaldesire.com/5db0b3727a72776b59d08aa804a36380b31895f9/origin/001.jpg
			domain_nowww === "pornopicshub.com" ||
			// http://cdn.pornopicshub.com/galleries/digitaldesire.com/b5ebfbae9b858152f30c04c38dc90c6dd03f9dad/300x400/001.jpg
			//   http://cdn.pornopicshub.com/galleries/digitaldesire.com/b5ebfbae9b858152f30c04c38dc90c6dd03f9dad/origin/001.jpg
			domain === "cdn.pornopicshub.com" ||
			// http://cdn26375495.ahacdn.me/galleries/digitaldesire.com/5db0b3727a72776b59d08aa804a36380b31895f9/300x400/001.jpg
			//   http://cdn26375495.ahacdn.me/galleries/digitaldesire.com/5db0b3727a72776b59d08aa804a36380b31895f9/origin/001.jpg
			domain === "cdn26375495.ahacdn.me") {
			// https://cdn15764270.ahacdn.me/galleries/idols69.com/4f2d07becc91a9d0be33a26cd35da531d7ad7f7e/300x400/002.jpg
			//   https://cdn15764270.ahacdn.me/galleries/idols69.com/4f2d07becc91a9d0be33a26cd35da531d7ad7f7e/origin/002.jpg
			return src.replace(/(\/galleries\/+[^/]*\/+[0-9a-f]+\/+)[0-9]+x[0-9]+(\/+[^/]*\.[^/.]*)(?:[?#].*)?$/,
							   "$1origin$2");
		}

		if (domain === "images.nubilefilms.com") {
			// https://images.nubilefilms.com/films/anything_for_her_with_kate_rich/photos/tn/1.jpg
			//   https://images.nubilefilms.com/films/anything_for_her_with_kate_rich/photos/1.jpg
			return src.replace(/\/photos\/+tn\/+([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/photos/$1");
		}

		if (domain === "g.bnrslks.com" ||
			domain === "g.dombnrs.com" ||
			domain === "g.misslk.com" ||
			domain === "gallery.virtuagirl.com" ||
			domain === "gallery.virtuagirlhd.com") {
			// http://g.bnrslks.com/e0885/tn/VGI1190P04006.jpg
			//   http://g.bnrslks.com/e0885/full/VGI1190P04006.jpg
			return src.replace(/\/tn\/+([^/]*\.[^/.]*)(?:[?#].*)?$/, "/full/$1");
		}

		if (domain_nosub === "joymii.com" && domain.match(/^n[0-9]*\./)) {
			// http://n6.joymii.com/sets/8257904_xow484_skt448/thumbs-215x215/r_8929627.jpg
			//   http://n6.joymii.com/sets/8257904_xow484_skt448/fhg/r_8929627.jpg
			return src.replace(/\/thumbs-[0-9]+x[0-9]+\//, "/fhg/");
		}

		if (domain_nowww === "famechain.com") {
			// https://www.famechain.com/images/resized-image/saldana-zoe-3977440bq_130x173.jpg/891
			//   https://www.famechain.com/images/image/891
			return src.replace(/\/images\/+resized-image\/+[^/]*\/+([0-9]+)(?:[?#].*)?$/, "/images/image/$1");
		}

		if (domain_nosub === "autoevolution.com" &&
			domain.match(/^s[0-9]*\.cdn\./)) {
			// https://s1.cdn.autoevolution.com/images/news-gallery-130x/zoe-saldana-is-elegant-hot-in-a-mercedes-s-class-shooting-thumbnail_1.jpg
			//   https://s1.cdn.autoevolution.com/images/news/gallery/zoe-saldana-is-elegant-hot-in-a-mercedes-s-class-shooting_1.jpg
			return src.replace(/\/images\/+news-gallery-[0-9]+x\/+([^/]*)-thumbnail(_[0-9]+\.[^/.]*)(?:[?#].*)?$/,
							   "/images/news/gallery/$1$2");
		}

		if (domain === "pics.haircutshairstyles.com") {
			// http://pics.haircutshairstyles.com/img/photos/thumbs/2009-07/thumb_zoe_saldana_curly_updo369.jpg
			//   http://pics.haircutshairstyles.com/img/photos/full/2009-07/zoe_saldana_curly_updo369.jpg
			return src.replace(/\/img\/+photos\/+thumbs\/+([0-9]{4}-[0-9]{2})\/+thumb_/,
							   "/img/photos/full/$1/");
		}

		if (domain === "clzmovies.r.sizr.io") {
			// http://clzmovies.r.sizr.io/core/cast/small/fe/fe_1337_4_ZoeSaldana.jpg
			//   http://clzmovies.r.sizr.io/core/cast/original/fe/fe_1337_4_ZoeSaldana.jpg
			return src.replace(/(:\/\/[^/]*\/core\/+[a-z]+\/+)[a-z]+(\/+[0-9a-f]{2}\/+[0-9a-f]{2}_[^/]*)(?:[?#].*)?$/,
							   "$1original$2");
		}

		if (domain === "images.firstpost.com") {
			// https://images.firstpost.com/fpimages/80x60/fixed/jpg/2018/04/zoe-saldana-380.jpg
			//   https://images.firstpost.com/wp-content/uploads/2018/04/zoe-saldana-380.jpg
			return src.replace(/\/fpimages\/+[0-9]+x[0-9]+\/+[a-z]+\/+[a-z]+\/+([0-9]{4}\/+[0-9]{2}\/+)/,
							   "/wp-content/uploads/$1");
		}

		// todo: migrate with generic wordpress rule below for -scaled and -e[0-9]{8,}
		if ((domain_nowww === "hustlebunny.com" && string_indexof(src, "/content/") >= 0) ||
			// https://24.p3k.hu/app/uploads/2018/08/37917789_245179279451422_1933202043065860096_n-e1534658460612-1024x575.jpg
			//   https://24.p3k.hu/app/uploads/2018/08/37917789_245179279451422_1933202043065860096_n.jpg
			// https://24.p3k.hu/app/uploads/2017/02/emma-watson-1-e1488313731557_wm.jpg
			//   https://24.p3k.hu/app/uploads/2017/02/emma-watson-1.jpg
			(domain === "24.p3k.hu" && string_indexof(src, "/uploads/") >= 0) ||
			// http://static.soltana.ma/content/uploads/2017/01/south-korea-peace-sign-v-sign-e1484953950431-567x340.jpg
			//   http://static.soltana.ma/content/uploads/2017/01/south-korea-peace-sign-v-sign.jpg
			(domain === "static.soltana.ma" && string_indexof(src, "/uploads/") >= 0) ||
			// https://cosmopolitan.hu/app/uploads/2017/05/selena-gomez-met-gala-2017-cosmopolitan-e1495089370492-468x234.jpg
			//   https://cosmopolitan.hu/app/uploads/2017/05/selena-gomez-met-gala-2017-cosmopolitan.jpg
			(domain_nowww === "cosmopolitan.hu" && src.match(/\/app\/+uploads\//)) ||
			// https://static.hollywoodreporter.com/wp-content/uploads/2021/01/video-4124484-image-compressed.jpg
			//   https://static.hollywoodreporter.com/wp-content/uploads/2021/01/video-4124484-image.jpg
			// https://static.hollywoodreporter.com/sites/default/files/2020/04/final_fantasy_vii_remake_game_still-compressed.jpg
			//   https://static.hollywoodreporter.com/sites/default/files/2020/04/final_fantasy_vii_remake_game_still.jpg
			(domain === "static.hollywoodreporter.com" && /(?:\/wp-content\/+uploads\/|\/sites\/+default\/+files\/)/.test(src)) ||
			// thanks to anonymous for reporting:
			// https://www.destroylonely.net/files/2023/04/DESTROYLONELY_logo-300x161.png
			//   https://www.destroylonely.net/files/2023/04/DESTROYLONELY_logo.png
			// https://www.destroylonely.net/files/2023/04/DestroyLonely.IfLooksCouldKill.ED-1x1-1-compressed.jpg
			//   https://www.destroylonely.net/files/2023/04/DestroyLonely.IfLooksCouldKill.ED-1x1-1.jpg
			(domain_nowww === "destroylonely.net" && string_indexof(src, "/files/") >= 0) ||
			 // https://www.pedestrian.tv/content/uploads/2017/10/DNTXJ6jVwAAUNtC-e1509358138415-605x397.jpg
			 //   https://www.pedestrian.tv/content/uploads/2017/10/DNTXJ6jVwAAUNtC-e1509358138415.jpg
			 //   https://www.pedestrian.tv/content/uploads/2017/10/DNTXJ6jVwAAUNtC.jpg
			(domain_nowww === "pedestrian.tv" && string_indexof(src, "/content/") >= 0)) {
			// http://hustlebunny.com/content/2012/09/zoe-saldana-91-e1348967864573-120x180.jpg
			//   http://hustlebunny.com/content/2012/09/zoe-saldana-91.jpg
			return src
				.replace(/_wm(\.[^/.]*)(?:[?#].*)?$/, "$1")
				.replace(/-[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1")
				.replace(/-e[0-9]{8,}(\.[^/.]*)(?:[?#].*)?$/, "$1")
				.replace(/-compressed(\.[^/.]+)(?:[?#].*)?$/, "$1");
		}

		if (domain_nowww === "vanishingtattoo.com") {
			// http://www.vanishingtattoo.com/tattoo/images/celeb-saldana/saldana_thumbnails/zoe_saldana_th_004.jpg
			//   http://www.vanishingtattoo.com/tattoo/images/celeb-saldana/saldana_large/zoe_saldana_004.jpg
			return src.replace(/_thumbnails\/+([^/]*)_th(_[0-9]+\.[^/.]*)(?:[?#].*)?$/, "_large/$1$2");
		}

		if (domain_nowww === "wallpaperama.com") {
			// https://www.wallpaperama.com/post-images/wallpapers/movie/zoe-saldana-t2061.jpg
			//   https://www.wallpaperama.com/post-images/wallpapers/movie/zoe-saldana.jpg
			return src.replace(/(\/post-images\/+wallpapers\/+[a-z]+\/+[^/]*)-t[0-9]+(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain_nowww === "hashtaglegend.com") {
			// https://hashtaglegend.com/storage/app/media/cropped-images/zoe-saldana-guardians-galaxy1-18-0-400-447-1488288029.jpg
			//   https://hashtaglegend.com/storage/app/media/zoe-saldana-guardians-galaxy1.jpg
			return src.replace(/(\/storage\/+app\/+media\/+)cropped-images\/+([^/]*)(?:-[0-9]+){4}-[0-9]{8,}(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2$3");
		}

		if (domain_nowww === "anime-planet.com") {
			// https://www.anime-planet.com/images/characters/thumbs/izumi-marufuji-21323.jpg?t=1429317723
			//   https://www.anime-planet.com/images/characters/izumi-marufuji-21323.jpg?t=1429317723
			// https://www.anime-planet.com/images/anime/covers/thumbs/anohana-the-flower-we-saw-that-day-movie-5206.jpg?t=1448521225
			//   https://www.anime-planet.com/images/anime/covers/anohana-the-flower-we-saw-that-day-movie-5206.jpg?t=1448521225
			return src.replace(/(\/images\/+[a-z]+\/+(?:[a-z]+\/+)?)thumbs\/+/, "$1");
		}

		if (domain === "di2ponv0v5otw.cloudfront.net" ||
			// https://dtpmhvbsmffsz.cloudfront.net/posts/2017/11/22/5a157606d14d7bb3fc026155/s_5a157887bf6df50089025915.jpg
			//   https://dtpmhvbsmffsz.cloudfront.net/posts/2017/11/22/5a157606d14d7bb3fc026155/5a157887bf6df50089025915.jpg
			domain === "dtpmhvbsmffsz.cloudfront.net") {
			// https://di2ponv0v5otw.cloudfront.net/posts/2019/05/20/5ce2739e969d1f500884cec2/s_5ce27442d948a1ac7554c305.jpg
			//   https://di2ponv0v5otw.cloudfront.net/posts/2019/05/20/5ce2739e969d1f500884cec2/5ce27442d948a1ac7554c305.jpg
			// https://di2ponv0v5otw.cloudfront.net/users/2019/02/15/54d6bb3294d56838da0a0287/t_5c66f8b6c2e88ec45e9c1fe3.jpg
			//   https://di2ponv0v5otw.cloudfront.net/users/2019/02/15/54d6bb3294d56838da0a0287/5c66f8b6c2e88ec45e9c1fe3.jpg
			// thanks to remlap on discord for reporting:
			// https://di2ponv0v5otw.cloudfront.net/posts/2023/01/07/63b9efc683cbeced26d8d64c/s_wp_63b9f00983cbec7f16d8d890.webp
			//   https://di2ponv0v5otw.cloudfront.net/posts/2023/01/07/63b9efc683cbeced26d8d64c/63b9f00983cbec7f16d8d890.jpg
			newsrc = src.replace(/(\/[a-z]+\/+[0-9]{4}\/+[0-9]{2}\/+[0-9]{2}\/+[0-9a-f]+\/+)[a-z]_(?:wp_)?([0-9a-f]+\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
			if (newsrc !== src)
				return add_extensions(newsrc);
		}

		if ((domain_nosub === "freeasianpics.net" && domain.match(/^cdn[0-9]*\./)) ||
			// http://th.sexhotpictures.net/vj/o5e/_s_1.jpg
			//   http://th.sexhotpictures.net/vj/o5e/1.jpg
			domain === "th.sexhotpictures.net") {
			// http://cdn01.freeasianpics.net/galleries/vn/sxj/_s_1.jpg
			//   http://cdn01.freeasianpics.net/galleries/vn/sxj/1.jpg
			//   http://cdn01.freeasianpics.net/galleries/vn/sxj/n1.jpg -- slightly darker
			// http://cdn01.freeasianpics.net/galleries/ru/7dh/n1.jpg -- 599x800
			//   http://cdn01.freeasianpics.net/galleries/ru/7dh/1.jpg -- 1364x2048
			return src.replace(/\/(?:_[a-z]_|n)([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/$1");
		}

		if (amazon_container === "nudiez-production" ||
			// https://d2c4tvdc1w38dj.cloudfront.net/photos/photos/f68/d6d/a8-/medium/data?1586038934
			//   https://d2c4tvdc1w38dj.cloudfront.net/photos/photos/f68/d6d/a8-/original/data
			// https://d2c4tvdc1w38dj.cloudfront.net/photos/photos/18c/cc7/c4-/medium/IMG-3938-683x1024.jpeg?1578102185
			//   https://d2c4tvdc1w38dj.cloudfront.net/photos/photos/18c/cc7/c4-/original/IMG-3938-683x1024.jpeg
			domain === "d2c4tvdc1w38dj.cloudfront.net") {
			// https://nudiez-production.s3.amazonaws.com/photos/photos/070/714/04-/thumb/data?1551470312
			//   https://nudiez-production.s3.amazonaws.com/photos/photos/070/714/04-/original/data
			return src.replace(/(\/photos\/(?:[-0-9a-f]{3}\/+){3})[a-z]+\/+([^/?]+)(?:[?#].*)?$/, "$1original/$2");
		}

		if (domain_nosub === "avdbs.com" && /^i[0-9]*\./.test(domain)) {
			// https://i2.avdbs.com/actor/a03/3675_001_s.jpg
			//   https://s3.ap-northeast-2.amazonaws.com/img.avdbs.com/actor/a03/3675_001_o.jpg
			return src.replace(/^[a-z]+:\/\/[^/]*\//, "https://s3.ap-northeast-2.amazonaws.com/img.avdbs.com/");
		}

		if (amazon_container === "img.avdbs.com" ||
			domain === "img.avdbs.com" ||
			(domain_nosub === "avdbs.com" && /^i[0-9]*\./.test(domain))) {
			// https://i2.avdbs.com/actor/a03/3675_001_s.jpg
			//   https://i2.avdbs.com/actor/a03/3675_001_r.jpg
			// https://s3.ap-northeast-2.amazonaws.com/img.avdbs.com/actor/a02/2309_008_r.jpg
			//   http://img.avdbs.com/actor/a02/2309_008_o.jpg
			regex = /(\/[0-9]+_[0-9]+_)[sr](\.[^/.]*)(?:[?#].*)?$/;
			return [
				src.replace(regex, "$1o$2"),
				src.replace(regex, "$1r$2")
			];
		}

		if (domain === "cdn.lengmenjun.com") {
			// http://cdn.lengmenjun.com/post/5ce0041b0425de5bcd4c3d95.jpg!lengmenjun-640
			//   http://cdn.lengmenjun.com/post/5ce0041b0425de5bcd4c3d95.jpg!lengmenjun
			//   removing ! altogether returns an error: "Forbidden access to the original image."
			return src.replace(/!lengmenjun-[0-9]+(?:[?#].*)?$/, "!lengmenjun");
		}

		if (amazon_container === "gallerist" ||
			// https://assets.boomkat.com/spree/products/657705/product/5054429141849_T11_Image.jpg
			//   https://assets.boomkat.com/spree/products/657705/large/5054429141849_T11_Image.jpg
			//   https://assets.boomkat.com/spree/products/657705/original/5054429141849_T11_Image.jpg
			domain === "assets.boomkat.com" ||
			// https://fireflowergames.com/spree/products/1621/small/Whispering_Willows_DE_Boxart.jpg?1554613058
			//   https://fireflowergames.com/spree/products/1621/original/Whispering_Willows_DE_Boxart.jpg?1554613058
			domain_nowww === "fireflowergames.com") {
			// https://s3.amazonaws.com/gallerist/products/21820/large/beautiful-birds-2.jpg?1550739385
			//   https://s3.amazonaws.com/gallerist/products/21820/original/beautiful-birds-2.jpg?1550739385
			return src.replace(/(\/products\/+[0-9]+\/+)[a-z]+\/+([^/]*)(?:[?#].*)?$/, "$1original/$2");
		}

		if (domain === "dingo.care2.com") {
			// https://dingo.care2.com/pictures/petition_images/petition/475/963911-1554925586-wide.jpg
			//   https://dingo.care2.com/pictures/petition_images/petition/475/963911-1554925586-orig.jpg
			return src.replace(/(\/pictures\/+.*\/[0-9]+-[0-9]+-)[a-z]+(\.[^/.]*)(?:[?#].*)?$/, "$1orig$2");
		}

		if (domain === "newsinteractives.cbc.ca") {
			// https://newsinteractives.cbc.ca/craft-assets/images/lead/_medium/Northern-Parula_-copy.jpg
			//   https://newsinteractives.cbc.ca/craft-assets/images/lead/Northern-Parula_-copy.jpg
			return src.replace(/(\/images\/+[^/]*\/+)_[a-z]+\/+/, "$1");
		}

		if (domain_nowww === "clipartmax.com") {
			// https://www.clipartmax.com/png/middle/24-244947_tubes-oiseaux-birds-png-beautiful-birds-of-the-world.png
			//   https://www.clipartmax.com/png/full/24-244947_tubes-oiseaux-birds-png-beautiful-birds-of-the-world.png
			return src.replace(/(:\/\/[^/]*\/(?:png|jpg|jpeg|gif)\/+)[a-z]+\/+/, "$1full/");
		}

		if (domain_nowww === "createphotocalendars.com") {
			// https://www.createphotocalendars.com/studio/generatedjpgs/donnald73/thumbs/1611324236.jpg
			//   https://www.createphotocalendars.com/studio/generatedjpgs/donnald73//1611324236.jpg
			// https://www.createphotocalendars.com/Studio/GeneratedJpgs/donnald73/thumbs/1611324236.jpg
			//   https://www.createphotocalendars.com/Studio/GeneratedJpgs/donnald73//1611324236.jpg
			return src.replace(/(\/studio\/+generated[a-zA-Z]+\/+[^/]*\/+)thumbs\/+/i, "$1/");
		}

		if (domain_nowww === "larutadelsorigens.cat") {
			// http://www.larutadelsorigens.cat/filelook/small/75/752334/beautiful-birds-hd-wallpapers.jpg
			//   http://www.larutadelsorigens.cat/filelook/full/75/752334/beautiful-birds-hd-wallpapers.jpg
			return src.replace(/\/filelook\/+[a-z]+\/+/, "/filelook/full/");
		}

		if (domain === "wwcdn.weddingwire.com") {
			// https://wwcdn.weddingwire.com/wedding/7465001_7470000/7466543/thumbnails/1200x1200_1518281784-b4f79304f79420bd-FB9A7785.jpg
			//   https://wwcdn.weddingwire.com/wedding/7465001_7470000/7466543/1518281784-b4f79304f79420bd-FB9A7785.jpg
			// https://wwcdn.weddingwire.com/vendor/65001_70000/66649/thumbnails/600x600_1277388582247-LoveIceSculpture.jpg -- doesn't work for /vendor/
			//   (seems like it used to work though)
			return src.replace(/(\/wedding\/+[0-9]+_[0-9]+\/+[0-9]+\/+)thumbnails\/+[0-9]+x[0-9]+_/, "$1");
		}

		if (domain_nowww === "weddingandpartynetwork.com") {
			// http://www.weddingandpartynetwork.com/gallery/photos/thumb/6530
			//   http://www.weddingandpartynetwork.com/gallery/photos/6530
			return src.replace(/\/gallery\/+photos\/+thumb\/+([0-9]+)(?:[?#].*)?$/, "/gallery/photos/$1");
		}

		if (domain_nowww === "foto4ka.com") {
			// http://www.foto4ka.com/thumbnails/4/namie-amuro-photoshoot.jpg
			//   http://www.foto4ka.com/wallpapers/4/namie-amuro-photoshoot.jpg
			return src.replace(/(:\/\/[^/]*\/)thumbnails\/+([0-9]+\/+)/, "$1wallpapers/$2");
		}

		if (domain_nowww === "showwallpaper.com") {
			// http://www.showwallpaper.com/wallpaper/0912/tn_038735.jpg
			//   http://www.showwallpaper.com/wallpaper/0912/038735.jpg
			return src.replace(/(\/wallpaper\/+[0-9]+\/+)tn_([0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nosub === "cduniverse.ws" && domain.match(/^c[0-9]*\./)) {
			// https://c9.cduniverse.ws/resized/144x205/music/108/7380108.jpg
			//   https://c9.cduniverse.ws/resized/9000x9000/music/108/7380108.jpg
			// https://c9.cduniverse.ws/resizedb/9000x9000/movie/692/9464692.jpg -- b is different than without (back cover)
			return src.replace(/(\/resized[a-z]*\/+)[0-9]+x[0-9]+\/+/, "$19000x9000/");
		}

		if (domain === "img.mandarake.co.jp") {
			// thanks to fireattack on github: https://github.com/qsniyg/maxurl/issues/70
			// https://img.mandarake.co.jp/webshopimg/03/30/430/0330290430/s_03302904302.jpg
			//   https://img.mandarake.co.jp/webshopimg/03/30/430/0330290430/03302904302.jpg
			// https://img.mandarake.co.jp/webshopimg/01/00/142/0100518142/s_01005181425.jpg
			//   https://img.mandarake.co.jp/webshopimg/01/00/142/0100518142/01005181425.jpg -- 2130x2999
			return src.replace(/(\/webshopimg\/+[0-9]+\/+[0-9]+\/+[0-9]+\/+[0-9]+\/+)[a-z]_([0-9]+\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain === "d2adpaynhf6x63.cloudfront.net") {
			// https://d2adpaynhf6x63.cloudfront.net/php_uploads/profile/NatalieBrooksxxx/image/thumbs/thumb150_thumbnail_1536097986.jpg
			//   https://d2adpaynhf6x63.cloudfront.net/php_uploads/profile/NatalieBrooksxxx/image/thumbnail_1536097986.jpg
			return src.replace(/\/image\/+thumbs\/+thumb[0-9]+_/, "/image/");
		}

		if (domain === "static-cdn.jtvnw.net") {
			// https://static-cdn.jtvnw.net/jtv_user_pictures/99b83e5e-4c33-496b-a33a-40ea7c17ce14-profile_image-50x50.png
			//   https://static-cdn.jtvnw.net/jtv_user_pictures/99b83e5e-4c33-496b-a33a-40ea7c17ce14-profile_image-300x300.png
			// thanks to kernoeb on discord for reporting
			// https://static-cdn.jtvnw.net/jtv_user_pictures/99b83e5e-4c33-496b-a33a-40ea7c17ce14-profile_image-300x300.png
			newsrc = src.replace(/-300x300(\.[^/.]+)(?:[?#].*)?$/, "-600x600$1");
			if (newsrc !== src) {
				return {
					url: newsrc,
					problems: {
						possibly_upscaled: true
					}
				};
			}

			// thanks to Ox on discord for reporting
			// https://static-cdn.jtvnw.net/jtv_user_pictures/e3bf8782-a962-4829-afd0-6cc9c3853778-profile_image-70x70.png
			//   https://static-cdn.jtvnw.net/jtv_user_pictures/e3bf8782-a962-4829-afd0-6cc9c3853778-profile_image-300x300.png
			newsrc = src.replace(/-(?:50x50|70x70)(\.[^/.]+)(?:[?#].*)?$/, "-300x300$1");
			if (newsrc !== src) return newsrc;

			// thanks to Finbae on github: https://github.com/qsniyg/maxurl/issues/73
			// https://static-cdn.jtvnw.net/emoticons/v1/414579/1.0
			//   https://static-cdn.jtvnw.net/emoticons/v1/414579/3.0
			//
			// https://static-cdn.jtvnw.net/emoticons/v1/79710/1.0 -- 28x28
			//   https://static-cdn.jtvnw.net/emoticons/v1/79710/3.0 -- 1000x1000
			newsrc = src.replace(/(\/emoticons\/+v1\/+[0-9]+\/+)[012][0-9.]*(?:[?#].*)?$/, "$13.0");
			if (newsrc !== src) return newsrc;

			// thanks to Noodlers on discord:
			// https://static-cdn.jtvnw.net/emoticons/v2/303370420/default/dark/1.0
			//   https://static-cdn.jtvnw.net/emoticons/v2/303370420/default/dark/5.0
			// https://static-cdn.jtvnw.net/emoticons/v2/303370420/default/light/1.0
			//   https://static-cdn.jtvnw.net/emoticons/v2/303370420/default/light/5.0
			// https://static-cdn.jtvnw.net/emoticons/v2/emotesv2_b5dccea360284bab897d04a99197dcf2/default/dark/1.0
			//   https://static-cdn.jtvnw.net/emoticons/v2/emotesv2_b5dccea360284bab897d04a99197dcf2/default/dark/4.0
			regex = /(\/emoticons\/+v2\/+(?:[0-9]+|emotesv2_[0-9a-f]{10,})\/+[^/]+\/+[a-z]+\/+)[0-4][0-9.]*(?:[?#].*)?$/
			if (regex.test(src)) {
				return [
					src.replace(regex, "$15.0"),
					src.replace(regex, "$14.0"),
					src.replace(regex, "$13.0")
				];
			}

			// thanks to IZeeLikeEyeZee on github: https://github.com/qsniyg/maxurl/issues/1206
			// https://static-cdn.jtvnw.net/cf_vods/d1m7jfoe9zdc1j/04c620b026effc608615_izeeh_49191263485_1693287287//thumb/thumb0-640x360.jpg
			//   https://static-cdn.jtvnw.net/cf_vods/d1m7jfoe9zdc1j/04c620b026effc608615_izeeh_49191263485_1693287287//thumb/thumb0-1280x720.jpg
			//   https://static-cdn.jtvnw.net/cf_vods/d1m7jfoe9zdc1j/04c620b026effc608615_izeeh_49191263485_1693287287//thumb/thumb0-1920x1080.jpg -- upscaled
			//   https://static-cdn.jtvnw.net/cf_vods/d1m7jfoe9zdc1j/04c620b026effc608615_izeeh_49191263485_1693287287//thumb/thumb0-0x0.jpg -- 1280x720
			newsrc = src.replace(/(\/thumb\/+thumb[0-9]*-)[0-9]+x[0-9]+(\.[a-z]+)(?:[?#].*)?$/, "$10x0$2");
			if (newsrc !== src) return newsrc;

			// https://static-cdn.jtvnw.net/s3_vods/leansquad_/140652046/c72d3b49-5401-4df4-b22b-c8798f9cd2fc/thumb/custom0c0a29f5448f07b3-320x180.jpeg
			// https://static-cdn.jtvnw.net/previews-ttv/live_user_nightblue3-440x248.jpg
			// https://static-cdn.jtvnw.net/ttv-boxart/Apex%20Legends-188x250.jpg
			// https://static-cdn.jtvnw.net/jtv_user_pictures/f481f6da-c755-4be0-9e89-d1385c99adbd-channel_offline_image-1920x1080.png
			//   https://static-cdn.jtvnw.net/jtv_user_pictures/f481f6da-c755-4be0-9e89-d1385c99adbd-channel_offline_image.png
			return src.replace(/-[0-9]+x[0-9]+(\.[^/.]+)(?:[?#].*)?$/, "$1");
		}

		if (domain_nowww === "patch.com") {
			// https://patch.com/img/cdn/users/26955/2014/08/T800x600/53e96000807fb.png?width=705 -- upscaled?
			//   https://patch.com/img/cdn/users/26955/2014/08/53e96000807fb.png
			//   https://patch.com/img/cdn/users/26955/2014/08/raw/53e96000807fb.png -- no difference?
			// https://patch.com/img/cdn/users/26955/2014/08/53e96000807fb.png?width=200
			//   https://patch.com/img/cdn/users/26955/2014/08/53e96000807fb.png
			// https://patch.com/img/cdn20/users/722562/20170624/085326/styles/raw/public/article_images/1498308806-1498308806-849.jpg?width=705
			// other:
			// https://patch.com/img/cdn/users/22873889/2016/03/raw/20160356f1867bf2935.jpg -- without /raw/ it doesn't work
			newsrc = src.replace(/(\/img\/+cdn[0-9]*\/+.*\/+(?:[0-9]{4}\/+[0-9]{2}|[0-9]{8}\/+[0-9]+)\/+)(?:T[0-9]+x[0-9]+\/+)?((?:styles\/+[^/]+\/+public\/+[^/]+\/+)?[^/]*?)(?:[?#].*)?$/,
								 "$1$2");
			if (newsrc !== src)
				return newsrc;

			return src.replace(/(\/img\/+cdn\/+users\/+[0-9]+\/+[0-9]{4}\/+[0-9]{2}\/+)([^/]*)(?:[?#].*)?$/, "$1raw/$2");
		}

		if (domain_nowww === "wsws.org") {
			// https://www.wsws.org/asset/466e8907-fa57-48a4-a47e-5bf256cbc18I/image.jpg?rendition=image480
			//   https://www.wsws.org/asset/466e8907-fa57-48a4-a47e-5bf256cbc18I/image.jpg
			// https://www.wsws.org/asset/34762bf1-8e20-4de9-b0b2-ad9cb3e7434C/image.jpg?rendition=image480
			//   https://www.wsws.org/asset/34762bf1-8e20-4de9-b0b2-ad9cb3e7434C/image.jpg
			return src.replace(/(\/asset\/+[-0-9a-f]+[A-Z]?\/+[^/]*?)(?:[?#].*)?$/, "$1");
		}

		if (domain === "media.apnarm.net.au") {
			// https://media.apnarm.net.au/media/images/2018/03/13/b881269820z1_20180313095331_000gbq10sddb2-0-allsqsqvvzfor046xp2_fct2538x1887x1016_ct834x465.jpg
			//   https://media.apnarm.net.au/media/images/2018/03/13/b881269820z1_20180313095331_000gbq10sddb2-0-allsqsqvvzfor046xp2_fct2538x1887x1016.jpg
			// https://media.apnarm.net.au/media/images/2018/03/13/b881269820z1_20180313110521_000gbq10t6892-0-lochwjeq1d91jyg6xp2_fct779x584_t639.jpg
			//   https://media.apnarm.net.au/media/images/2018/03/13/b881269820z1_20180313110521_000gbq10t6892-0-lochwjeq1d91jyg6xp2_fct779x584.jpg
			// https://media.apnarm.net.au/media/images/2018/03/13/b881269820z1_20180313110521_000gbq10t6892-0-lochwjeq1d91jyg6xp2_fct779x584.jpg
			//   https://media.apnarm.net.au/media/images/2018/03/13/b881269820z1_20180313110521_000gbq10t6892-0-lochwjeq1d91jyg6xp2.jpg
			return src.replace(/(\/media\/+images\/+[0-9]{4}\/+[0-9]{2}\/+[0-9]{2}\/+[^/]*)_f?c?t[0-9]+(?:x[0-9]+)?(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain === "images.forwardcdn.com") {
			// https://images.forwardcdn.com/image/1090x480/center/images/cropped/bhh0g6kccaa3whj-1423584930.jpg
			//   https://images.forwardcdn.com/image/images/bhh0g6kccaa3whj-1423584930.jpg
			// https://images.forwardcdn.com/image/720x/center/top/images/cropped/ariana-grande-1531496074.jpg
			//   https://images.forwardcdn.com/image/images/ariana-grande-1531496074.jpg
			return src.replace(/\/image\/+[0-9]+x(?:[0-9]+)?\/+[a-z]+\/+(?:[a-z]+\/+)?images\/+(?:cropped\/+)?/, "/image/images/");
		}

		if (domain_nowww === "goodnet.org") {
			// https://www.goodnet.org/photos/620x0/22327.jpg
			//   https://www.goodnet.org/photos/22327.jpg
			return src.replace(/\/photos\/+[0-9]+x[0-9]+\/+([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/photos/$1");
		}

		if (domain_nowww === "pinknews.co.uk") {
			// https://pinknews.co.uk/images/2018/02/pexels-photo-596590-650x433.jpeg
			// https://www.pinknews.co.uk/images/2015/08/robin-williams_640x345_acf_cropped1.jpg
			//   https://www.pinknews.co.uk/images/2015/08/robin-williams.jpg
			return src.replace(/(\/images\/+[0-9]{4}\/+[0-9]{2}\/+[^/]*)[-_][0-9]+x[0-9]+(?:_[^/]*?)?(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain === "static-sothebys-production-2.gtsstatic.net") {
			// https://static-sothebys-production-2.gtsstatic.net/images/v_4_14_0_8/localimagereader.ashx?imageurl=https%3A%2F%2Fcf-images.us-east-1.prod.boltdns.net%2Fv1%2Fstatic%2F5699924528001%2F0239bc9d-11aa-4948-a927-a0893dc19a4f%2F95e81b5c-bd72-41ac-994b-86b2cacd276e%2F1280x720%2Fmatch%2Fimage.jpg&option=N&bypassglobalproxy=true&w=1024&permitphotoenlargement=false
			//   https://cf-images.us-east-1.prod.boltdns.net/v1/static/5699924528001/0239bc9d-11aa-4948-a927-a0893dc19a4f/95e81b5c-bd72-41ac-994b-86b2cacd276e/1280x720/match/image.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/images\/+v_[0-9_]+\/+localimagereader\.ashx.*?[?&]imageurl=([^&]*).*?$/,
								 "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "img.gtsstatic.net") {
			// https://img.gtsstatic.net/reno/imagereader.aspx?imageurl=https%3A%2F%2Fcf-images.us-east-1.prod.boltdns.net%2Fv1%2Fjit%2F5699924528001%2Fd2a2755a-3d15-421f-89fa-347360ce379b%2Fmain%2F1280x720%2F12s74ms%2Fmatch%2Fimage.jpg&option=N&w=1200&permitphotoenlargement=false&fallbackimageurl=https%3A%2F%2Fstatic-sothebys-production-2.gtsstatic.net%2Fresources%2F_responsive%2Fimages%2Fcommon%2Fnophoto%2Fdefault.jpg
			//   https://cf-images.us-east-1.prod.boltdns.net/v1/jit/5699924528001/d2a2755a-3d15-421f-89fa-347360ce379b/main/1280x720/12s74ms/match/image.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+reno\/+imagereader\.aspx\?(?:.*&)?imageurl=([^&]+).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "lc-imageresizer-live-s.legocdn.com") {
			// https://lc-imageresizer-live-s.legocdn.com/resize/list-06-thebattledroid?width=3200&imageUrl=https%3a%2f%2fwww.lego.com%2fr%2fwww%2fr%2fportals%2f-%2fmedia%2fcampaigns%2fkids%2fstar-wars%2fbuild-play-game%2flist-06-thebattledroid.jpg
			//   https://www.lego.com/r/www/r/portals/-/media/campaigns/kids/star-wars/build-play-game/list-06-thebattledroid.jpg
			newsrc = src.replace(/.*\/resize\/+[^/]*\?(?:.*&)?imageUrl=(http[^&]+)(?:[&#].)?$/, "$1");
			if (newsrc !== src)
				return {
					url: decodeuri_ifneeded(newsrc),
					// https://www.lego.com/r/www/r/portals/-/media/campaigns/kids/star-wars/build-play-game/list-02-wishlist.jpg
					head_wrong_contentlength: true
				};
		}

		if (domain_nosub === "boltdns.net" && domain.match(/^cf-images\./)) {
			// doesn't work anymore (width below the minimum)
			// https://cf-images.us-east-1.prod.boltdns.net/v1/static/1125911414/addcf159-48d5-40ee-a79a-042c17905091/b69cd6b4-82c8-4e82-a11b-a2a0963d697a/1280x720/match/image.jpg
			//   https://cf-images.us-east-1.prod.boltdns.net/v1/static/1125911414/addcf159-48d5-40ee-a79a-042c17905091/b69cd6b4-82c8-4e82-a11b-a2a0963d697a/-1x-1/match/image.jpg
			// larger sizes upscale, and 0x0 is also below the minimum
			// interestingly, forbes does link to 9999x9999 images:
			// https://www.forbes.com/sites/carolinehoward/2017/12/18/verge-genomics-founder-on-taking-the-guessing-game-out-of-drug-discovery/#2aac4589600c
			//   https://cf-images.us-east-1.prod.boltdns.net/v1/static/2097119709001/715b89fe-3e22-4575-b169-96880f185e16/819bb252-8f44-4901-9ac4-78fd6735cf2b/9999x9999/match/image.jpg
			//   https://blogs-images.forbes.com/carolinehoward/files/2017/12/Alice-Thumb.jpg
			// other:
			// https://cf-images.ap-southeast-1.prod.boltdns.net/v1/jit/5182475815001/9fd45fd7-fdd4-4835-b3bf-d2e2680c1684/main/720x405/1m43s780ms/match/image.jpg
			return {
				url: src,//.replace(/\/[-0-9]+x[-0-9]+\/+match\/+/, "/-1x-1/match/"),
				can_head: false // 405, method not allowed
			};
		}

		if (domain === "players.brightcove.net") {
			var query_brightcove_video_api = function(account_id, video_id, pk, cb) {
				api_query("brightcove_video_api:" + account_id + "/" + video_id, {
					url: "https://edge.api.brightcove.com/playback/v1/accounts/" + account_id + "/videos/" + video_id,
					headers: {
						"Accept": "application/json;pk=" + pk,
						Referer: "https://players.brightcove.net/"
					},
					json: true
				}, cb, function(done, resp, cache_key) {
					return done(resp, 60*60);
				});
			};

			// https://players.brightcove.net/4401740954001/default_default/index.html?videoId=6131665209001&autostart=0&disableads=0&disablenextvideo=0
			newsrc = website_query({
				website_regex: /^([a-z]+:\/\/[^/]+\/+([0-9]+)\/+[^/]+\/+index\.html\?(?:.*&)?videoId=([0-9]+)(?:&.*)?)(?:#.*)?$/,
				query_for_id: "${id}",
				process: function(done, resp, cache_key, match) {
					var account_id = match[2];
					var video_id = match[3];

					let imuhash = common_functions["parse_imu_hash"](src);
					let pk = null;

					if (imuhash && imuhash.pk)
						pk = imuhash.pk;

					var match = resp.responseText.match(/,policyKey:("[^"]+")}},/);
					if (!match) {
						if (!pk) {
							console_error(cache_key, "Unable to find policyKey match for", resp);
							return done(null, false);
						}
					} else {
						pk = JSON_parse(match[1]);
					}

					query_brightcove_video_api(account_id, video_id, pk, function(data) {
						var caption = data.name || data.description || data.long_description;
						var image = data.poster || data.thumbnail;

						var urls = [];
						array_foreach(data.sources, function(source) {
							// 2 sources per type, first is http, second is https
							if (/^http:\/\//.test(source.src))
								return;

							var video:VideoProp = true;
							if (source.type === "application/x-mpegURL")
								video = "hls";
							else if (source.type === "application/dash+xml")
								video = "dash";

							urls.push({
								url: source.src,
								video: video
							});
						});

						if (image)
							urls.push(image);

						var obj = {};

						if (caption)
							obj.extra = {caption: caption};

						return done(fillobj_urls(urls, obj), 60*60);
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "expo.advance.net") {
			// https://expo.advance.net/img/77b355f5b8/width960/aa0_ap506412746072.jpeg
			//   https://expo.advance.net/img/77b355f5b8/aa0_ap506412746072.jpeg
			//   https://expo.advance.net/img/77b355f5b8/orig/aa0_ap506412746072.jpeg
			// https://expo.advance.net/img/10fd4522c8/width960/9e6_ansah3.jpeg
			//   https://expo.advance.net/img/10fd4522c8/orig/9e6_ansah3.jpeg
			// https://expo.advance.net/img/b4ec5c8a56/width960/877_03strippermarch12.jpeg
			//   https://expo.advance.net/img/b4ec5c8a56/orig/877_03strippermarch12.jpeg
			return src.replace(/(\/img\/[0-9a-f]+\/+)(?:(?:height|width)[0-9]+\/+)?([a-z0-9]{3}_[^/.]+\.[^/.]*)(?:[?#].*)?$/, "$1orig/$2");
		}

		if (domain === "media.resources.festicket.com") {
			// https://media.resources.festicket.com/image/412x461/smart/filters:quality(70)/www/photos/CollectionsArianaGrande.jpg
			//   https://media.resources.festicket.com/image/www/photos/CollectionsArianaGrande.jpg
			// https://media.resources.festicket.com/image/300x300/center/top/filters:quality(70)/www/artists/CamillaCabello_A8wUiMF.jpg
			//   https://media.resources.festicket.com/image/www/artists/CamillaCabello_A8wUiMF.jpg
			//return src.replace(/\/image\/+[0-9]+x[0-9]+\/+smart\/+(?:filters:[^/]*)\/+www\/+/, "/image/www/");
			return src.replace(/\/image\/+.*?\/+www\/+/, "/image/www/");
		}

		if (domain === "static.getindiebill.com") {
			// https://static.getindiebill.com/iCupTY8-cSKVbELJVq1a5LnV-dQ=/240x240/smart/34b9a6b1-24da-4212-9a09-5f484ea3c4d7/avatar/585ccf8c-d7f1-48de-9b76-8383240c6736.jpg
			//   https://static.getindiebill.com/34b9a6b1-24da-4212-9a09-5f484ea3c4d7/avatar/585ccf8c-d7f1-48de-9b76-8383240c6736.jpg
			// https://static.getindiebill.com/OCpGrCgX4L7LqTBdx2I3jmKWA0g=/780x450/34b9a6b1-24da-4212-9a09-5f484ea3c4d7/sample/2c5d869f-ef0e-44eb-ba4b-90b2c8827c1c.jpg
			//   https://static.getindiebill.com/34b9a6b1-24da-4212-9a09-5f484ea3c4d7/sample/2c5d869f-ef0e-44eb-ba4b-90b2c8827c1c.jpg
			return src.replace(/(:\/\/[^/]*\/)[^/]*=\/[0-9]+x[0-9]+\/+(?:smart\/+)?([-0-9a-f]{10,}\/+)/, "$1$2");
		}

		if (domain_nowww === "seatgeek.com") {
			// https://seatgeek.com/images/performers-landscape/ariana-grande-8b565d/13852/1200x525.jpg
			//   https://seatgeek.com/images/performers-landscape/ariana-grande-8b565d/13852/0x0.jpg -- 2944x2944
			//   https://seatgeek.com/images/performers-landscape/ariana-grande-8b565d/13852/original.jpg -- different image (4000x3000)
			// https://seatgeek.com/images/performers-landscape/new-york-rangers-3f1ad0/2120/1200x525.jpg
			//   https://seatgeek.com/images/performers-landscape/new-york-rangers-3f1ad0/2120/0x0.jpg -- 2048x585
			// https://seatgeek.com/images/seatview/5fe0779c-9782-486c-8906-d96020672cc8/flat/640x480.jpg
			return src.replace(/(\/images\/+performers-landscape\/+[^/]*-[0-9a-f]+\/+[0-9]+\/+)[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$10x0$2");
		}

		if (domain === "vid.alarabiya.net") {
			// https://vid.alarabiya.net/images/2018/09/23/953649d0-6aca-4266-910e-657026424b81/953649d0-6aca-4266-910e-657026424b81_16x9_788x442.jpg
			//   https://vid.alarabiya.net/images/2018/09/23/953649d0-6aca-4266-910e-657026424b81/953649d0-6aca-4266-910e-657026424b81.jpg
			return src.replace(/(\/images\/+[0-9]{4}\/+[0-9]{2}\/+[0-9]{2}\/+[-0-9a-f]+\/+[-0-9a-f]+)_[^/]*_[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (((domain === "cdn.onebauer.media" ||
			 // https://media.planetradio.co.uk/one/radio-legacy/52/fd06b/a5054/18c3c/83efe/bd389/d74d2/nickhewer.png?quality=80&width=960&ratio=16-9&resizeStyle=aspectfill&format=jpg
			 //   https://media.planetradio.co.uk/one/radio-legacy/52/fd06b/a5054/18c3c/83efe/bd389/d74d2/nickhewer.png?resize=atrophy
			 domain === "media.planetradio.co.uk" ||
			 // https://cdn.graziadaily.co.uk/one/lifestyle-images/celebrity/58bbdf7709f46d350a06910e/GettyImages-647330302.jpg?quality=50&width=960&ratio=16-9&resizeStyle=aspectfill&format=jpg
			 //   https://cdn.graziadaily.co.uk/one/lifestyle-images/celebrity/58bbdf7709f46d350a06910e/GettyImages-647330302.jpg -- 1525x1024
			 //   https://cdn.graziadaily.co.uk/one/lifestyle-images/celebrity/58bbdf7709f46d350a06910e/GettyImages-647330302.jpg?resize=atrophy -- 4343x2916
			 domain === "cdn.graziadaily.co.uk" ||
			 // https://cdn.closeronline.co.uk/one/lifestyle-images/celebrity/57ea61548ec529f923122d89/holly-willoughby-this-morning-style.jpg.jpg?quality=10&amp;format=jpg
			 //   https://cdn.closeronline.co.uk/one/lifestyle-images/celebrity/57ea61548ec529f923122d89/holly-willoughby-this-morning-style.jpg.jpg?resize=atrophy
			 domain === "cdn.closeronline.co.uk" ||
			 // https://cdn.planetradio.co.uk/one/media/5d97/5567/c11f/b25b/e632/0950/camila-cabello.jpg?quality=80&format=jpg&width=320&ratio=16-9
			 //   https://cdn.planetradio.co.uk/one/media/5d97/5567/c11f/b25b/e632/0950/camila-cabello.jpg?resize=atrophy
			 domain === "cdn.planetradio.co.uk" ||
			 // https://cdn.heatworld.com/one/lifestyle-images/celebrity/58357d749f0e322331739515/Screen%20Shot%202016-10-06%20at%2014.43.52.png?quality=50&width=960&ratio=16-9&resizeStyle=aspectfill&format=jpg
			 //   https://cdn.heatworld.com/one/lifestyle-images/celebrity/58357d749f0e322331739515/Screen%20Shot%202016-10-06%20at%2014.43.52.png?resize=atrophy
			 domain === "cdn.heatworld.com") &&
			 src.match(/^[a-z]+:\/\/[^/]*\/+one\//)) ||
			// thanks to fyhtma on github: https://github.com/qsniyg/maxurl/issues/1351
			// https://images.bauerhosting.com/legacy/media/5fd0/a688/a673/6105/5180/9ad9/DEMI-rose-beauty-tips.jpg?ar=16%3A9&fit=crop&crop=top&auto=format&w=992&q=80
			//   https://images.bauerhosting.com/legacy/media/5fd0/a688/a673/6105/5180/9ad9/DEMI-rose-beauty-tips.jpg?resize=atrophy
			domain === "images.bauerhosting.com") {
			// https://cdn.onebauer.media/one/lifestyle-images/celebrity/58bab090a8511c6f037af92b/GettyImages-645662194.jpg?quality=80&width=1800&ratio=16-9&resizeStyle=aspectfill&format=jpg
			//   https://cdn.onebauer.media/one/lifestyle-images/celebrity/58bab090a8511c6f037af92b/GettyImages-645662194.jpg?resize=atrophy -- 4818x3437
			return src.replace(/(\/[^/?]*)(?:\?.*)?$/, "$1?resize=atrophy");
		}

		if (domain === "assets.planetradio.co.uk") {
			// https://assets.planetradio.co.uk/track/160x160/122961.jpg?ver=1541262115
			//   https://assets.planetradio.co.uk/track/122961.jpg?ver=1541262115
			return src.replace(/\/track\/+[0-9]+x[0-9]+\/+/, "/track/");
		}

		if (domain_nowww === "realestate.com.au") {
			// https://www.realestate.com.au/blog/images/3500x2333-fit,progressive/2019/05/21154645/6.-Kahalawai_38-Entry.jpg
			//   https://www.realestate.com.au/blog/wp-content/uploads/2019/05/21154645/6.-Kahalawai_38-Entry.jpg
			return src.replace(/\/blog\/+images\/+[^/]*\/+([0-9]{4})\/+/, "/blog/wp-content/uploads/$1/");
		}

		if (domain_nowww === "kanke365.com") {
			// https://www.kanke365.com/weixinpic/imgBridge.php?url=https://mmbiz.qpic.cn/mmbiz_jpg/XJqMBOBpJIyQxyGv4pyFib7eWPT1HIpYDibLPAcqxqqT6KvGMMOghPxysZnc4k61lHQ7YicCUFUJH9ye2NBZbPicfA/640
			//   https://mmbiz.qpic.cn/mmbiz_jpg/XJqMBOBpJIyQxyGv4pyFib7eWPT1HIpYDibLPAcqxqqT6KvGMMOghPxysZnc4k61lHQ7YicCUFUJH9ye2NBZbPicfA/0
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/[^/]*\/+imgBridge\.php.*?[?&]url=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "i.obozrevatel.com") {
			// https://i.obozrevatel.com/2017/8/17/gettyimages-628353178.jpg?size=900x600
			//   https://i.obozrevatel.com/gallery/2017/8/17/gettyimages-628353178.jpg -- 1024x682
			return src.replace(/(:\/\/[^/]*\/)([0-9]{4}\/+[0-9]{1,2}\/+[0-9]{1,2}\/+[^/?]*)(?:[?#].*)?$/,
							   "$1gallery/$2");
		}

		if (domain_nowww === "stuttgarter-nachrichten.de" ||
			// thanks to anonymous for reporting:
			// https://www.esslinger-zeitung.de/media.media.f04d1f85-d14c-4a63-9761-6357a087560f.original1024.jpg
			//   https://www.esslinger-zeitung.de/media.media.f04d1f85-d14c-4a63-9761-6357a087560f.original.jpg -- 800x600
			// https://www.esslinger-zeitung.de/media.media.782a74cc-3e0b-44cc-8f67-c1768b528cdc.original700.jpg
			//   https://www.esslinger-zeitung.de/media.media.782a74cc-3e0b-44cc-8f67-c1768b528cdc.original.jpg -- 1920x1080
			domain_nowww === "esslinger-zeitung.de" ||
			// thanks to anonymous for reporting:
			// https://www.schwarzwaelder-bote.de/media.media.1ac4de92-bb2b-47d1-bd37-26ee52b20944.original300.jpg
			//   https://www.schwarzwaelder-bote.de/media.media.1ac4de92-bb2b-47d1-bd37-26ee52b20944.original.jpg
			domain_nowww === "schwarzwaelder-bote.de") {
			// https://www.stuttgarter-nachrichten.de/media.media.bb463579-2879-4eba-a8d8-2f6d135dcaed.jpg
			//   https://www.stuttgarter-nachrichten.de/media.media.bb463579-2879-4eba-a8d8-2f6d135dcaed.original1024.jpg
			//   https://www.stuttgarter-nachrichten.de/media.media.bb463579-2879-4eba-a8d8-2f6d135dcaed.original.jpg
			return src.replace(/(:\/\/[^/]*\/media\.media\.[-0-9a-f]+\.)(?:[^/]*\.)?([^/.]*)(?:[?#].*)?$/,
							   "$1original.$2");
		}

		if (domain_nosub === "360buyimg.com" &&
			domain.match(/^(?:img[0-9]*|m)\./)) {
			// https://img20.360buyimg.com/babel/s590x470_jfs/t1/36565/1/10948/90118/5ced0965E13f170b4/4be2c2283874a108.jpg!q90!cc_590x470.webp
			//   https://img20.360buyimg.com/imgzone/jfs/t1/36565/1/10948/90118/5ced0965E13f170b4/4be2c2283874a108.jpg!q90!cc_590x470.webp
			//   https://img20.360buyimg.com/imgzone/jfs/t1/36565/1/10948/90118/5ced0965E13f170b4/4be2c2283874a108.jpg
			// http://img30.360buyimg.com/popWaterMark/jfs/t5791/116/8235632084/119621/34e9fb80/5978a009Ndc433ffe.jpg
			//   http://img30.360buyimg.com/imgzone/jfs/t5791/116/8235632084/119621/34e9fb80/5978a009Ndc433ffe.jpg
			// https://img10.360buyimg.com/n1/s520x520_jfs/t19831/306/1199093063/189548/eda46c/5b187d69N5b1335e2.jpg
			//   https://img10.360buyimg.com/imgzone/jfs/t19831/306/1199093063/189548/eda46c/5b187d69N5b1335e2.jpg
			// https://m.360buyimg.com/mobilecms/s750x750_jfs/t1/20657/6/14969/117054/5cac07b6E53926c38/f82ccaa652efce7d.jpg!q80.dpg
			//   https://m.360buyimg.com/imgzone/jfs/t1/20657/6/14969/117054/5cac07b6E53926c38/f82ccaa652efce7d.jpg
			// https://img10.360buyimg.com/mobilecms/s250x250_jfs/t28123/117/1600781998/77752/7017a358/5ce5ff01N1926170e.jpg
			//   https://img10.360buyimg.com/imgzone/jfs/t28123/117/1600781998/77752/7017a358/5ce5ff01N1926170e.jpg
			return src
				.replace(/(:\/\/[^/]*\/)(?:[a-z0-9]+\/+s[0-9]+x[0-9]+_jfs|popWaterMark\/+jfs)\//, "$1imgzone/jfs/")
				.replace(/![^/]*(?:[?#].*)?$/, "");
		}

		if (domain === "c.actve.net") {
			// https://c.actve.net/76157
			//   https://c.actve.net/76157/100
			//   https://c.actve.net/original/7/6/1/76157.jpg
			return src.replace(/(:\/\/[^/]*\/)([0-9])([0-9])([0-9])([0-9]+)(?:\/[^/]*)?(?:[?#].*)?$/,
							   "$1original/$2/$3/$4/$2$3$4$5.jpg");
		}

		if (domain === "resources.wimpmusic.com") {
			// https://resources.wimpmusic.com/images/a740f511/eba5/4d96/9e01/74349cd83631/160x160.jpg
			//   https://resources.wimpmusic.com/images/a740f511/eba5/4d96/9e01/74349cd83631/origin.jpg
			return src.replace(/(\/images\/.*\/)[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1origin$2");
		}

		if (domain === "improxy.starmakerstudios.com") {
			// https://improxy.starmakerstudios.com/tools/im/200/production/cover_img/ec2c0555a7414da9ef19626f64f347b7-640.jpg
			//   https://improxy.starmakerstudios.com/tools/im/0/production/cover_img/ec2c0555a7414da9ef19626f64f347b7-640.jpg
			return src.replace(/\/tools\/+im\/+[0-9]+\/+/, "/tools/im/0/");
		}

		if (domain === "pl.scdn.co") {
			// doesn't seem to do a difference in this case, but i.scdn.co can have much larger images
			// https://pl.scdn.co/images/pl/default/4bdf7dea1ef2dfdd7aeeae8814fbcecbd3f055a6
			//   https://i.scdn.co/image/4bdf7dea1ef2dfdd7aeeae8814fbcecbd3f055a6
			//   https://i.scdn.co/image/b081c48efb807fa1b448c5671d96323d6ae30665 -- real larger version
			return src.replace(/:\/\/[^/]*\/images\/+pl\/+default\/+([0-9a-f]+)(?:[?#].*)?$/,
							   "://i.scdn.co/image/$1");
		}

		if (domain === "dice-i-scdn-co.imgix.net") {
			// https://dice-i-scdn-co.imgix.net/image/ef9b0b5b8083cf68958daa46382e309bf771b39f
			//   https://i.scdn.co/image/ef9b0b5b8083cf68958daa46382e309bf771b39f -- 1000x1000
			return src.replace(/^[a-z]+:\/\/[^/]+\/+image\/+([0-9a-f]{10,})(?:[?#].*)?$/, "https://i.scdn.co/image/$1");
		}

		if (domain === "i.scdn.co") {
			// thanks to DevWannabe-dot on github: https://github.com/qsniyg/maxurl/issues/833
			// https://i.scdn.co/image/ab67616d00001e02f0e911d0e5aadefc431bf34a -- 300x300
			//   https://i.scdn.co/image/ab67616d0000b273f0e911d0e5aadefc431bf34a -- 640x640
			// https://i.scdn.co/image/ab6761610000f17812a2ef08d00dd7451a6dbed6 -- 160x160
			//   https://i.scdn.co/image/ab6761610000517412a2ef08d00dd7451a6dbed6 -- 320x320
			//   https://i.scdn.co/image/ab6761610000e5eb12a2ef08d00dd7451a6dbed6 -- 640x640
			// https://i.scdn.co/image/ab6761610000517468c557e281fc8f168f7d3219
			//   https://i.scdn.co/image/ab6761610000e5eb68c557e281fc8f168f7d3219 -- 448x640
			// https://i.scdn.co/image/ab67616d00004851df16d539f508603bfb1efe02
			//   https://i.scdn.co/image/ab67616d00001e02df16d539f508603bfb1efe02
			//   https://i.scdn.co/image/ab67616d0000b273df16d539f508603bfb1efe02
			// thanks to ItsProyal and lazybookwyrm on github: https://github.com/qsniyg/maxurl/issues/1329#issuecomment-2161072870
			// https://i.scdn.co/image/ab67616d0000b273f0e911d0e5aadefc431bf34a
			//   https://i.scdn.co/image/ab67616d000082c1f0e911d0e5aadefc431bf34a -- 1425x1425
			// https://i.scdn.co/image/ab6761860000660ea0dbecfa2aa77f59a3debf3a
			//   https://i.scdn.co/image/ab67618600001016a0dbecfa2aa77f59a3debf3a -- 2660x1440
			// https://i.scdn.co/image/ab6761670000ecd4cb99cfc3d47e59832136b38b
			//   https://i.scdn.co/image/ab676167000082e8cb99cfc3d47e59832136b38b -- 2027x1140
			// other:
			// https://artists.spotify.com/songwriter/7arD6PuSiBoEdX0wDowElH
			//   https://i.scdn.co/image/ab677762000056b8a4c0d4fbf52ab78e8db7db58 -- 1280x1280
			// https://artists.spotify.com/songwriter/3DOXWXpf7MlWHWglJ9PM0S
			//   https://i.scdn.co/image/ab677762000056b82ecf737162fd93b1d6ee3ee4 -- 1280x1280
			// https://i.scdn.co/image/b040846ceba13c3e9c125d68389491094e7f2982 -- 999x806
			// https://i.scdn.co/image/95304d1b161e3106d3ceef694acd2ce3e433f69a -- 2658x1140
			// https://i.scdn.co/image/af22b1ed38d1b21b28ef1f1610ef0a51a38a5028 -- 1000x953
			// https://i.scdn.co/image/5970f51046d76cbaba5a7de984e23ec24fbee9c2 -- 940x1000, upscaled
			return src
				// cover art
				.replace(/(\/image\/+ab67616d0000)(?:b273|d452)/, "$182c1")
				.replace(/(\/image\/+ab67616d0000)(?:1e02|f848|4851|745c|aa54|75a0|a426|e1a3|ab87|2d53|11eb|90d5|54be)/, "$1b273")
				// avatar
				.replace(/(\/image\/+ab6761610000)(?:5174|8ef1|86f7|939b|918b|101f|102f)/, "$1e5eb")
				.replace(/(\/image\/+ab6761610000)f178/, "$15174")
				// banner
				.replace(/(\/image\/+ab6761860000)(?:6fba|660e|c09f|0194|d7b3|9d80|3e24|eab1)/, "$11016")
				// gallery image
				.replace(/(\/image\/+ab6761670000)(?:e30a|d8f8|ecd4|e911|81f9|ea36|de4a|1217|6054)/, "$182e8");
		}

		if (domain === "mosaic.scdn.co") {
			// thanks to anonymous for reporting:
			// https://mosaic.scdn.co/60/ab67616d00001e022ee1ed1528255b32d4593571ab67616d00001e023c3acd23605ccd1a9fd038bdab67616d00001e024277da4c011dcc87f012bbabab67616d00001e02ac89ab9bfbeaebb9ded4ceba
			//   https://mosaic.scdn.co/300/ab67616d00001e022ee1ed1528255b32d4593571ab67616d00001e023c3acd23605ccd1a9fd038bdab67616d00001e024277da4c011dcc87f012bbabab67616d00001e02ac89ab9bfbeaebb9ded4ceba
			//   https://mosaic.scdn.co/640/ab67616d00001e022ee1ed1528255b32d4593571ab67616d00001e023c3acd23605ccd1a9fd038bdab67616d00001e024277da4c011dcc87f012bbabab67616d00001e02ac89ab9bfbeaebb9ded4ceba
			return src.replace(/(:\/\/[^/]+\/+)(?:300|60)\/+/, "$1640/");
		}

		if (domain === "s.mxmcdn.net") {
			// https://s.mxmcdn.net/images-storage/albums4/2/6/6/9/6/7/36769662_500_500.jpg
			//   https://s.mxmcdn.net/images-storage/albums4/2/6/6/9/6/7/36769662_800_800.jpg
			return src.replace(/(\/images-storage\/.*\/[0-9]+_)[0-7][0-9][0-9]_[0-7][0-9][0-9](\.[^/.]*)(?:[?#].*)?$/,
							   "$1800_800$2");
		}

		if (domain_nowww === "radiopotok.ru") {
			// https://radiopotok.ru/f/article/s_4318.jpg
			//   https://radiopotok.ru/f/article/4318.jpg
			return src.replace(/\/article\/+s_([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/article/$1");
		}

		if (domain_nowww === "becteroradio.com") {
			// https://becteroradio.com/resizeimage/index.php?w=700&url=http://becteroradio.com/2011/uploads/news/22378.jpg
			//   http://becteroradio.com/2011/uploads/news/22378.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/resizeimage\/+index\.php.*?[?&]url=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nowww === "electronicamx.net") {
			// https://www.electronicamx.net/images/2018/03/08/kygo_medium.jpg -- upscaled
			//   https://www.electronicamx.net/images/2018/03/08/kygo.jpg
			return src.replace(/(\/images\/+[0-9]{4}\/+[0-9]{2}\/+[0-9]{2}\/+[^/]*)_medium(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain_nowww === "tophit.ru") {
			// https://tophit.ru/ru/i/365x365/photo/63010.jpg
			//   https://tophit.ru/ru/i/photo/63010.jpg
			// https://tophit.ru/en/i/365x365/news/23193_l.jpg
			//   https://tophit.ru/en/i/365x365/news/23193_l.jpg
			return src.replace(/\/i\/+[0-9]+x[0-9]+\/+/, "/i/");
		}

		if (domain_nosub === "zvooq.com" && domain.match(/^cdn[0-9]*\./) &&
			src.match(/:\/\/[^/]*\/pic\?/)) {
			// http://cdn42.zvooq.com/pic?type=release&id=2869250&size=220x220&ext=jpg
			//   http://cdn42.zvooq.com/pic?type=release&id=2869250&size=0x0&ext=jpg
			return src.replace(/([?&]size=)[0-9]+x[0-9]+/, "$10x0");
		}

		if (domain === "d3us2i0tqwa7m7.cloudfront.net") {
			// https://d3us2i0tqwa7m7.cloudfront.net/pulses/16571782318210000/1459557823292_res_90x90.jpg
			//   https://d3us2i0tqwa7m7.cloudfront.net/pulses/16571782318210000/1459557823292_res_original.jpg
			return src.replace(/(\/[0-9]+_res_)[^/._]*(\.[^/.]*)(?:[?#].*)?$/, "$1original$2");
		}

		if (domain_nowww === "theaudiodb.com" && string_indexof(src, "/images/") >= 0) {
			// https://www.theaudiodb.com/images/media/track/thumb/twqvyt1471258799.jpg/preview
			//   https://www.theaudiodb.com/images/media/track/thumb/twqvyt1471258799.jpg
			// https://www.theaudiodb.com/images/media/album/thumbhq/sswssr1538931605.jpg/preview
			//   https://www.theaudiodb.com/images/media/album/thumbhq/sswssr1538931605.jpg
			// thanks to anonymous for reporting:
			// https://www.theaudiodb.com/images/media/album/thumb/gkls6m1640050808.jpg/preview
			//   https://www.theaudiodb.com/images/media/album/thumb/gkls6m1640050808.jpg
			return src.replace(/(\/[a-z0-9]+[0-9]{5,}\.[^/.]+)(?:\/[a-z]+)(?:[?#].*)?$/, "$1");
		}

		if (domain_nosub === "gaoshouyou.com" && domain.match(/^rs\.[0-9]*\./)) {
			// http://rs.0.gaoshouyou.com/gsy.php?img=http://rs.0.gaoshouyou.com/i/15/2b/8e15198dad2b39bf978df897efd56ebe.jpeg&w=400&h=300&iifqde=cfkdd2
			//   http://rs.0.gaoshouyou.com/i/15/2b/8e15198dad2b39bf978df897efd56ebe.jpeg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/gsy\.php.*?[?&]img=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nowww === "mirrormedia.com.tw") {
			// https://www.mirrormedia.com.tw/assets/images/20180507185531-4f6800c3b39710e242bef8724ee3186d-mobile.jpg
			//   https://www.mirrormedia.com.tw/assets/images/20180507185531-4f6800c3b39710e242bef8724ee3186d.jpg
			return src.replace(/(\/assets\/+images\/+[0-9]+-[0-9a-f]+)-mobile(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "twpriceget.com") {
			// https://twpriceget.com/img-ij8eK7akBlDXfTVG1Fl0k1ha2ViaWdtb25leQ==?url=https%3A%2F%2Fs.yimg.com%2Fzp%2FMerchandiseImages%2F14F97B63CD-SP-6504189.jpg
			//   https://s.yimg.com/zp/MerchandiseImages/14F97B63CD-SP-6504189.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/img-[^/]*.*?[?&]url=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nowww === "bestchinanews.com" ||
			// http://www.zhaizou.com/url.php?p=http://img.mp.itc.cn/upload/20160929/adce90598999492eaa78885da6fbf326_th.jpeg
			//   http://img.mp.itc.cn/upload/20160929/adce90598999492eaa78885da6fbf326_th.jpeg
			domain_nowww === "zhaizou.com") {
			// http://www.bestchinanews.com/url.php?p=http://img1.selfimg.com.cn/uedgqcms/2016/05/17/1463500317_SLRhtF.jpg
			//   http://img1.selfimg.com.cn/uedgqcms/2016/05/17/1463500317_SLRhtF.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/url\.php.*?[?&]p=(http[^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "img.com.link") {
			// http://img.com.link/f/2018/09/12/61beced9c5e02aaf_640o.jpg
			//   http://img.com.link/f/2018/09/12/61beced9c5e02aaf_640.jpg
			//   http://img.com.link/f/2018/09/12/61beced9c5e02aaf_l.jpg -- 748x1052
			return src.replace(/(\/[0-9a-f]+_)[0-9]+[a-z]?(\.[^/.]*)(?:[?#].*)?$/, "$1l$2");
		}

		if (domain_nowww === "europaplus.ru") {
			// http://www.europaplus.ru/upload/thumb/news_308/images/news/Untitled-1_1355402814.jpg
			//   http://www.europaplus.ru/images/news/Untitled-1_1355402814.jpg
			return src.replace(/\/upload\/+thumb\/+[^/]*\/+images\/+/, "/images/");
		}

		if (domain_nosub === "ozone.ru" && /^(?:cdn[0-9]*|ir(?:-[0-9]+)?)\./.test(domain)) {
			// https://cdn1.ozone.ru/multimedia/c1200/1022042796.jpg
			//   https://cdn1.ozone.ru/multimedia/1022042796.jpg
			// thanks to anonymous for reporting:
			// https://ir.ozone.ru/s3/multimedia-1-y/wc200/7016992726.jpg
			//   https://ir.ozone.ru/s3/multimedia-1-y/wc1000/7016992726.jpg
			//   https://ir.ozone.ru/s3/multimedia-1-y/7016992726.jpg
			// https://ir-2.ozone.ru/s3/multimedia-1-y/wc200/7016992726.jpg
			//   https://ir-2.ozone.ru/s3/multimedia-1-y/7016992726.jpg
			// thanks to ValiumBear on github: https://github.com/qsniyg/maxurl/issues/1347
			// https://ir.ozone.ru/s3/multimedia-1-5/wc1000/7080628361.jpg
			//   https://ir.ozone.ru/s3/multimedia-1-5/7080628361.jpg
			return src.replace(/(\/multimedia(?:-[^/]+)?\/+)w?c[0-9]+\/+/, "$1");
		}

		if (domain === "img.tsn.ua") {
			// https://img.tsn.ua/cached/1518092914/tsn-65e5f602e5840498ead47d2707d23e52/thumbs/1200x630/22/f5/14124ef20c0b1e5cb6053275da87f522.jpg
			//   https://img.tsn.ua/cached/1518092914/tsn-65e5f602e5840498ead47d2707d23e52/thumbs/x/22/f5/14124ef20c0b1e5cb6053275da87f522.jpg
			// https://img.tsn.ua/cached/1533899609/tsn-b1dbdb63bc95f28af7a3cee15a54ab72/thumbs/585xX/d6/0b/471e2c36125405c0039b027fce920bd6.jpeg
			//   https://img.tsn.ua/cached/1533899609/tsn-b1dbdb63bc95f28af7a3cee15a54ab72/thumbs/x/d6/0b/471e2c36125405c0039b027fce920bd6.jpeg
			return src.replace(/(\/cached\/+[0-9]+\/+tsn-[0-9a-f]+\/+thumbs\/+)[0-9X]*x[0-9X]*\/+/, "$1x/");
			//return src.replace(/\/thumbs\/+[0-9X]+x[0-9X]+\//, "/thumbs/x/");
		}

		if (domain_nowww === "ivi.ru") {
			// https://www.ivi.ru/titr/uploads/2015/06/25/d240c7501542f155058a9c56f55a71b7.jpg/1400x0
			//   https://www.ivi.ru/titr/uploads/2015/06/25/d240c7501542f155058a9c56f55a71b7.jpg
			return src.replace(/(\/uploads\/+[0-9]{4}\/+[0-9]{2}\/+[0-9]{2}\/+[0-9a-f]+\.[^/.]+)\/+[0-9]+x[0-9]+(?:[?#].*)?$/,
							   "$1");
		}

		if (domain === "aisvip-a.akamaihd.net" ||
			// thanks to roi:
			// https://ais-akamai.rtl.de/masters/1980965/200x0/nach-flop-in-kennenlernshow-krasse-steigerung-bei-julia-beautx.jpg
			//   https://ais-akamai.rtl.de/masters/1980965/nach-flop-in-kennenlernshow-krasse-steigerung-bei-julia-beautx.jpg
			domain === "ais-akamai.rtl.de") {
			// https://aisvip-a.akamaihd.net/masters/958690/200x200/typveraenderung-bei-emma-watson-die-schauspielerin-traegt-jetzt-pony.jpg
			//   https://aisvip-a.akamaihd.net/masters/958690/typveraenderung-bei-emma-watson-die-schauspielerin-traegt-jetzt-pony.jpg
			return {
				url: src.replace(/(\/[0-9]+\/+)[0-9]+x[0-9]+\/+([^/]*)(?:[?#].*)?$/, "$1$2"),
				head_wrong_contentlength: true
			};
		}

		if (domain_nowww === "my-hit.org") {
			// https://my-hit.org/storage/186167_500x800x250.jpg
			//   https://my-hit.org/storage/186167_99999x99999x99999.jpg -- 1885x3000
			// https://my-hit.org/storage/1778411_168x240x50x2.jpg
			//   https://my-hit.org/storage/1778411_99999x99999x99999.jpg

			regex = /(\/storage\/+[0-9]+_)[0-9]+x[0-9]+x[0-9]+(?:x[0-9]+)?(\.[^/.]*)(?:[?#].*)?$/;
			newsrc = src.replace(regex, "$199999x99999x99999$2");

			return {
				url: newsrc,
				can_head: false // otherwise it hangs (apparently due to different content-length from HEAD and GET)
			};
		}

		if (domain_nosub === "censor.net.ua" && domain.match(/^storage[0-9]*\./)) {
			// https://storage1.censor.net.ua/images/e/e/a/e/eeae96292c71632cc00e64da63b37cec/500x629.jpg
			//   https://storage1.censor.net.ua/images/e/e/a/e/eeae96292c71632cc00e64da63b37cec/original.jpg
			return {
				url: src.replace(/(\/images\/+(?:[0-9a-f]\/+){4}[0-9a-f]+\/+)[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/,
								 "$1original$2"),
				can_head: false // 503
			};
		}

		if (domain_nowww === "vokrug.tv") {
			// https://www.vokrug.tv/pic/person/4/6/0/0/medium_460091ff9c9e9bc09b593ab2ffd537f7.jpeg
			//   https://www.vokrug.tv/pic/person/4/6/0/0/460091ff9c9e9bc09b593ab2ffd537f7.jpeg
			return src.replace(/(\/pic\/+[^/]*\/+(?:.\/+){4})[a-z]+_([0-9a-f]+\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain_nowww === "mucche.mu") {
			// https://mucche.mu/t/bkiWOVkJuY?v=1
			//   https://mucche.mu/i/bkiWOVkJuY?v=1
			return src.replace(/(:\/\/[^/]*\/)t\/+([^/.]*)(?:[?#].*)?$/, "$1i/$2");
		}

		if (domain_nowww === "nudography.com") {
			// http://www.nudography.com/photos/news/2009_12/small/Zoe_Saldana_see-through-01.jpg
			//   http://www.nudography.com/photos/news/2009_12/original/Zoe_Saldana_see-through-01.jpg
			// http://www.nudography.com/photos/news/2009_3/small/Katy_Mixon_Eastbound_and_Down_S01E06_-008.jpg
			//   http://www.nudography.com/photos/news/2009_3/original/Katy_Mixon_Eastbound_and_Down_S01E06_-008.jpg
			return src.replace(/(\/photos\/+[^/]*\/+[0-9]{4}_[0-9]{1,2}\/+)[a-z]+\/+/, "$1original/");
			//return src.replace(/(\/news\/+[0-9]+_[0-9]+\/+)[a-z]+\/+/, "$1original/");
		}

		if (domain_nowww === "celebs-porno.com") {
			// http://www.celebs-porno.com/Zoe_Saldana/sm_Zoe_Saldana16.jpg
			//   http://www.celebs-porno.com/Zoe_Saldana/Zoe_Saldana16.jpg
			return src.replace(/(:\/\/[^/]*\/[^/]*\/+)[a-z]{2}_([^/]*\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (false && domain_nowww === "famousnipple.com") {
			// quite broken, not sure if it can be easily fixed
			// disabling because many urls don't work, which will spam the server because of add_full_extensions
			// http://famousnipple.com/images/260x200/zoe-saldana-nsfw_001-100108226020038383.jpg
			//   http://famousnipple.com/content/2019/03/zoe-saldana-nsfw_001.jpeg
			// http://famousnipple.com/images/260x200/gal-gadot-is-so-adorable_001-100108226020033002.jpg
			//   http://famousnipple.com/content/2019/01/gal-gadot-is-so-adorable_001.gif
			//   http://famousnipple.com/gal-gadot-is-so-adorable-33001/ (2019-01-19T05:00:16+00:00)
			// http://famousnipple.com/images/300x300/elizabeth-turner-is-red-hot_001-101008630030030104.jpg
			//   http://famousnipple.com/elizabeth-turner-is-red-hot-30103/ (2017-10-28T02:01:54+00:00)
			//   http://famousnipple.com/content/2017/10/elizabeth-turner-is-red-hot_001.jpeg
			// http://famousnipple.com/images/433x300/mckayla-maroney_001-100105043330017047.jpg
			//   http://famousnipple.com/mckayla-maroney-3-17046/ (2017-03-20T11:00:46+00:00)
			//   http://famousnipple.com/content/2017/03/mckayla-maroney_001.jpg
			// http://famousnipple.com/?p=54952 -- redirects to:
			//   http://famousnipple.com/margot-robbie-52-54952/
			//   http://famousnipple.com/images/260x200/margot-robbie_001-1-100108226020054953.jpg
			//   http://famousnipple.com/content/2019/09/margot-robbie_001-1.jpeg
			// doesn't work:
			// http://famousnipple.com/images/433x300/alessandra-ambrosio-100105043330027983.jpg
			// http://famousnipple.com/images/260x200/abigail-spencer_001-100108226020042933.jpg
			//   http://famousnipple.com/content/2019/05/abigail-spencer_001.jpeg -- tries /2019/04/
			//   http://famousnipple.com/abigail-spencer-2-42932/ (2019-05-03T13:00:14+00:00)
			var timestamp = src.replace(/.*\/images\/[0-9]+x[0-9]+\/+[^/]+-([0-9]{15,})\..*?$/, "$1");
			if (timestamp !== src) {
				var ticks = 880886;
				//var ticks = 900000;
				var offset = null;

				if (timestamp.slice(0, 10) === "1001082260") {
					offset = 100108226018275820;
					//offset = 100108226018313150; // gal gadot using new 15 minutes ticks
					//offset = 100105043328298110; // abigail spencer
				} else if (timestamp.slice(0, 10) === "1010086300") {
					offset = 101008630028316880;
				} else if (timestamp.slice(0, 10) === "1001050433") {
					offset = 100105043328325550;
				}

				if (offset !== null) {
					var date = new Date((timestamp - offset) * ticks);
					var month = date.getUTCMonth() + 1;

					// https://stackoverflow.com/a/3605248
					month = ("0" + month).slice(-2);
					return add_full_extensions({
						url: src.replace(/\/images\/+[0-9]+x[0-9]+\/+([^/]+)-[0-9]{15,}(\.[^/.]*)(?:[?#].*)?$/,
										 "/content/" + date.getUTCFullYear() + "/" + month + "/$1$2"),
						headers: {
							Referer: "http://famousnipple.com/"
						}
					});
				}
			}
		}

		if (domain_nowww === "famousnipple.com" ||
			// https://cosplayboobies.com/tifa-lockhart-by-kalinkafox-45460/
			//   https://cosplayboobies.com/images/260x200/tifa-lockhart-by-kalinkafox_001-100108226020045461.jpg
			// https://cosplayboobies.com/images/140x140/great-angle_001-101108214014031368.jpg
			//   http://fuckingtattoos.com/content/2018/01/great-angle_001.jpeg
			domain_nowww === "fuckingtattoos.com" ||
			domain_nowww === "pornwithtext.com" ||
			domain_nowww === "porngipfy.com" ||
			// http://femjoybabes.com/myla-brunette-tuture/ -- gallery_items album
			// http://femjoybabes.com/images/230x320/vika-p-jul-11-2017-kissable-femjoy-set-2-beautiful-nude-women-the-honky-tonk-beaver_004-101108023032024635.jpg
			// http://femjoybabes.com/images/100x100/vika-p-jul-11-2017-kissable-femjoy-set-2-beautiful-nude-women-the-honky-tonk-beaver_004-101108010010024635.jpg
			domain_nowww === "femjoybabes.com" ||
			// https://russianpuss.com/mikhail-nikolaevich-2-4910/ -- single page album
			domain_nowww === "russianpuss.com" ||
			domain_nowww === "gfycatporntube.com" ||
			// http://hardfacefuck.com/images/230x160/using-her-mouth-for-what-its-made-for-and-giving-her-an-extra-push_001-101008023016032876.jpg
			// http://hardfacefuck.com/using-her-mouth-for-what-its-made-for-and-giving-her-an-extra-push/
			domain_nowww === "hardfacefuck.com" ||
			domain_nowww === "filmnudes.com" ||
			// http://porngfy.com/images/300x200/hookuphotshot-baby-goth-anal_001-101108030020071797.jpg
			domain_nowww === "porngfy.com" ||
			// http://vanillababes.com/niemira-femjoy/
			domain_nowww === "vanillababes.com" ||
			domain_nowww === "brazzersbabes.com" ||
			// http://pussyexe.com/strip-in-wardrobe/ -- iframe
			domain_nowww === "pussyexe.com" ||
			domain_nowww === "rubberxxx.com" ||
			// http://pornartpics.com/angelomisterioso-sera-mann-by-christopher-von-steinbach-for-playboy-us-may-jun-2017/
			domain_nowww === "pornartpics.com" ||
			domain_nowww === "porn15s.com" ||
			// http://analsexgifs.com/analandcum-63/
			domain_nowww === "analsexgifs.com" ||
			// http://freakydeakygifs.com/adriana-chechik-and-karmen-karma/
			domain_nowww === "freakydeakygifs.com" ||
			// http://babesexpress.com/images/250x375/monica-kees-wants-to-stuff-your-christmas-stocking-set-three-of-several_001-101008025037510626.jpg
			// ?p doesn't work
			//domain_nowww === "babesexpress.com" ||
			domain_nowww === "holyasshole.com" ||
			domain_nowww === "xpornzo.com" ||
			domain_nowww === "nsfwgify.com" ||
			domain_nowww === "sexyfitbabes.com" ||
			domain_nowww === "mlfrgs.com" ||
			domain_nowww === "milfdp.com" ||
			domain_nowww === "lesboluvin.com" ||
			domain_nowww === "gingerbabes.com" ||
			domain_nowww === "cosplayboobies.com") {
			var norm_fn_thumb = function(thumb) {
				return thumb.replace(/.*\//, "").replace(/-[0-9]{13}([0-9]+)\..*$/, "-$1.");
			};

			// http://famousnipple.com/zoe-saldana-nsfw-38382/
			// http://famousnipple.com/margot-robbie-52-54952/
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+(?:\?(?:.*&)?p=|[-a-z0-9]+-)([0-9]+)(?:[/&#].*)?$/,
				query_for_id: "http://" + domain_nosub + "/?p=${id}",
				process: function(done, resp, cache_key, match, options) {
					var images = [];
					var main_image = 0;

					var extra = {
						page: resp.finalUrl
					};

					var imgmatch = resp.responseText.match(/<img src="https?:\/\/[^/]+\/+content\/+[0-9]{4}\/+[0-9]{2}\/.*>/g);
					if (!imgmatch || !imgmatch.length) {
						console_warn(cache_key, "Unable to find img match for", resp);
						imgmatch = null;
					}

					var thumburl = null;
					var thumbmatch = options.url.match(/#imu-thumb=(.*)$/);
					if (thumbmatch) thumburl = norm_fn_thumb(thumbmatch[1]);

					if (imgmatch) {
						array_foreach(imgmatch, function(imagetag) {
							var parsed = parse_tag_def(imagetag);
							if (!parsed.args.src) {
								console_warn(cache_key, "Unable to find src for", parsed, "in", resp);
								return;
							}

							if (parsed.args["data-pin-url"]) extra.page = parsed.args["data-pin-url"];
							if (parsed.args.alt) extra.caption = parsed.args.alt;

							images.push(parsed.args.src);
						});
					}

					// <video class="single-video"> is in porn15s.com
					// div class="single-video" is in holyasshole.com
					var videomatch = resp.responseText.match(/(?:<div (?:class="video-holder"|class="single-video" id="single-video")>\s*<video|<video class="single-video" )[\s\S]+?<\/video>/);
					if (videomatch) {
						var videosources = common_functions["get_videotag_sources"](videomatch[0]);
						if (videosources && videosources.video.length) {
							images.push(videosources.video[0].url);
						}
					}

					videomatch = resp.responseText.match(/<div class="video-holder">\s*(<iframe.*?>)<\/iframe>/);
					if (videomatch) {
						var parsed = parse_tag_def(videomatch[1]);
						images.push(parsed.args.src);
					}

					// vanillababes
					var simages_match = resp.responseText.match(/<div class="single-(?:images|gif)">\s*((?:<div class="single-image">\s*<a[\s\S]+?<\/a>\s*<\/div>|<a[\s\S]+?<\/a>)\s*)<\/div>/);
					if (simages_match) {
						var simages_matches = match_all(simages_match[1], /<a href="(https?:\/\/[^/]+\/+wp-content\/+uploads\/+[^"]+)"[^>]*>\s*<img src="(https?:\/\/[^/]+\/+(?:images|wp-content)\/+[^"]+)"/);
						if (simages_matches) {
							array_foreach(simages_matches, function(match) {
								var orig = decode_entities(match[1]);
								var thumb = decode_entities(match[2]);

								array_upush(images, orig);

								if (norm_fn_thumb(thumb) === thumburl) {
									main_image = array_indexof(images, orig);
								}
							});
						} else {
							console_warn(cache_key, "Unable to find single images in", resp);
						}
					}

					var gallery_items_match = resp.responseText.match(/<figure class="(?:[^"]+ )?gallery-item[\s\S]+?<\/figure>/g);
					if (gallery_items_match) {
						array_foreach(gallery_items_match, function(figure) {
							var a_match = figure.match(/<a (?:class="[^"]*" )?href="(https?:\/\/[^/]+\/content\/+[^"]+)"/);
							if (!a_match) {
								console_warn(cache_key, "Unable to find link match in gallery-item for", {figure: figure, resp: resp});
								return;
							}

							var link = decode_entities(a_match[1]);
							array_upush(images, link);

							if (!thumburl)
								return;

							var thumb_match = figure.match(/<img src="(https?:\/\/[^/]+\/+images\/+[^"]+)"/);
							if (!thumb_match) {
								console_warn(cache_key, "Unable to find thumbnail match for", {figure: figure, resp: resp});
								return;
							}

							var our_thumburl = decode_entities(thumb_match[1]);
							our_thumburl = norm_fn_thumb(our_thumburl);
							if (thumburl === our_thumburl) {
								// not i, in case of upush
								main_image = array_indexof(images, link);
							}
						});
					}

					if (!images.length) {
						console_error(cache_key, "Unable to find images in", resp);
						return done(null, false);
					}

					var obj:BigImageInfoSObject = {
						url: images[main_image],
						extra: extra,
						headers: {
							Referer: extra.page
						}
					};

					if (images.length > 1) {
						obj.album_info = {
							type: "links",
							links: []
						};

						array_foreach(images, function(image, i) {
							obj.album_info.links.push({
								url: image,
								is_current: i === main_image
							});
						});
					}

					return done(obj, 6*60*60);
				}
			});
			if (newsrc) return newsrc;

			// http://famousnipple.com/images/260x200/margot-robbie_001-1-100108226020054953.jpg
			//   http://famousnipple.com/content/2019/09/margot-robbie_001-1.jpeg
			// http://famousnipple.com/images/140x190/how-about-this-mera-by-evenink_cosplay_001-101108214019057262.jpg
			//   https://cosplayboobies.com/content/2019/01/how-about-this-mera-by-evenink_cosplay_001.jpeg
			// http://porngfy.com/images/300x200/brattysis-kate-bloom-lets-play-house_001-1011080300200117589.jpg -- 6
			// http://vanillababes.com/images/300x180/olivia-preston-jeans-10010823001805996.jpg -- 4
			// http://brazzersbabes.com/images/300x180/municipal-juggs-rides-dirty-in-the-sepatown-codi-bryant-big-tits-in-uniform_002-100108030018069950.jpg -- id should not be -1'd
			// http://pornartpics.com/images/360x0/angelomisterioso-sera-mann-by-christopher-von-steinbach-for-playboy-us-may-jun-2017_008-100108236009462.jpg -- 360x0 = 3600
			match = src.match(/^[a-z]+:\/\/[^/]+\/+images\/+([0-9]+x[0-9]+)\/+[^/]+-([0-9]+)\./);
			if (match) {
				var size = match[1].replace(/x/, "");
				var num = match[2].substr(7 + size.length);

				id = parseInt(num);
				if (domain_nowww !== "brazzersbabes.com") {
					id--;
				}

				return {
					url: "http://" + domain_nosub + "/?p=" + id + "#imu-thumb=" + src,
					is_pagelink: true
				};
			}
		}

		// vBulletin
		if (domain_nowww === "forumkinopoisk.ru" ||
			// https://forums.drom.ru/attachment.php?attachmentid=6496403&d=1502409622&thumb=1
			//   https://forums.drom.ru/attachment.php?attachmentid=6496403
			domain === "forums.drom.ru" ||
			// http://www.mexat.com/vb/attachment.php?attachmentid=2097481&stc=1&thumb=1&d=1443663271
			//   http://www.mexat.com/vb/attachment.php?attachmentid=2097481
			domain_nowww === "mexat.com") {
			// https://forumkinopoisk.ru/attachment.php?s=4f9f7cbc1d1c5983a18d5d81582b2cb8&attachmentid=545745&stc=1&thumb=1&d=1520234070
			//   https://forumkinopoisk.ru/attachment.php?attachmentid=545745
			return src.replace(/\/attachment\.php.*?[?&](attachmentid=[0-9]+).*?$/, "/attachment.php?$1");
		}

		if (domain_nowww === "chat1102.com") {
			// https://chat1102.com/cache-img/350/350/40/3-2018/tot-nghiep-dai-hoc-danh-tieng-emma-watson-lai-bi-che-cuoi-vi-xam-dong-chu-sai-chinh-ta-0.jpg
			//   https://chat1102.com/images/uploads/images/3-2018/tot-nghiep-dai-hoc-danh-tieng-emma-watson-lai-bi-che-cuoi-vi-xam-dong-chu-sai-chinh-ta-0.jpg
			// doesn't work for all:
			// https://chat1102.com/cache-img/300/300/10/37405555769_bocz.jpg
			//   originally: https://chat1102.com/thumb-pic/300/300/37405555769_bocz.jpg (broken)
			return src.replace(/\/cache-img\/+(?:[0-9]+\/+){3}/, "/images/uploads/images/");
		}

		if (domain_nowww === "sobaka.ru") {
			// http://www.sobaka.ru/images/image/00/95/07/07/_normal.jpg
			//   http://www.sobaka.ru/images/image/00/95/07/07/_origin.jpg
			//   http://www.sobaka.ru/images/image/00/95/07/07/_zoom.jpg -- 649x975
			// http://www.sobaka.ru/images/post/00/07/95/29/_origin.jpg -- 538x298
			//   http://www.sobaka.ru/images/post/00/07/95/29/_huge.jpg -- 640x520, cropped but not upscaled
			//   http://www.sobaka.ru/images/post/00/07/95/29/_zoom.jpg -- 936x520
			// doesn't work for all:
			// http://www.sobaka.ru/images/post/00/07/95/23/_huge.jpeg
			//   http://www.sobaka.ru/images/post/00/07/95/23/_zoom.jpeg -- jpg doesn't work either
			// other:
			// http://www.sobaka.ru/images/image/01/00/47/17/_zoom.jpg -- 2976x4464
			return src.replace(/(\/images\/+(?:image|post)\/+(?:[0-9]{2}\/+){4})_(?:normal|huge|origin)(\.[^/.]*)(?:[?#].*)?$/, "$1_zoom$2");
			//return src.replace(/\/images\/+post\/+(?:[0-9]{2}\/+){4}_(?:origin|huge)(\.[^/.]*)(?:[?#].*)?$/, "$1_zoom$2");
		}

		if (domain_nowww === "ziaruldeiasi.ro") {
			// https://www.ziaruldeiasi.ro/app/gethumb.details.php?id=326915&w=640&h=480
			//   https://www.ziaruldeiasi.ro/app/gethumb.details.php?id=326915&w=99999&h=99999
			return src.replace(/(\/gethumb(?:\.details)?\.php).*?[?&](id=[0-9]+).*?$/, "$1?$2&w=99999&h=99999");
		}

		if (domain_nowww === "jyii.com") {
			// http://www.jyii.com/showyixia.php?url=https://mmbiz.qpic.cn/mmbiz_png/xTWUlKsQegxW1JugBXKH4U9VPKS6GtF6UkAnfDJI8ogtdMtYxmRIPWJia9ibIR2VHNDRgUwW4UghSibmiaZTevriaQQ/640?wx_fmt=png
			//   https://mmbiz.qpic.cn/mmbiz_png/xTWUlKsQegxW1JugBXKH4U9VPKS6GtF6UkAnfDJI8ogtdMtYxmRIPWJia9ibIR2VHNDRgUwW4UghSibmiaZTevriaQQ/0
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/showyixia\.php.*?[?&]url=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nowww === "ishow.gr") {
			// https://www.ishow.gr/Thumbnail.ashx?url=files/archive/2013/9/3/2134779B-DD57-4D03-BEF7-1709FF39F1EF.jpg&x1=0&y1=0&x2=0&y2=0&width=110&height=156
			//   https://www.ishow.gr/files/archive/2013/9/3/2134779B-DD57-4D03-BEF7-1709FF39F1EF.jpg
			return src.replace(/(^[a-z]+:\/\/[^/]*\/)Thumbnail\.ashx.*?[?&]url=([^&]*).*?$/, "$1$2");
		}

		if (domain_nowww === "scienceleadership.org") {
			// https://scienceleadership.org/thumbnail/21241/1920x1920
			//   https://scienceleadership.org/media/open/21241
			return src.replace(/\/thumbnail\/+([0-9]+)\/+[0-9]+x[0-9]+(?:[?#].*)?$/, "/media/open/$1");
		}

		if (domain === "cdn.toomar.net") {
			// https://cdn.toomar.net/source/movies/person/thumbs/8742_x176.jpg
			//   https://cdn.toomar.net/source/movies/person/8742.jpg
			return src.replace(/\/thumbs\/+([0-9]+)_x[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "/$1$2");
		}

		if (domain_nowww === "looti.net") {
			// https://www.looti.net/shared_files/uploaded/590/141514318_1.jpg
			//   https://www.looti.net/index.php?action=downloadfile&topic=590&upfile=141514318&sub=1
			return src.replace(/\/shared_files\/+uploaded\/+([0-9]+)\/+([0-9]+)_([0-9]+)\.[^/.]*(?:[?#].*)?$/,
							   "/index.php?action=downloadfile&topic=$1&upfile=$2&sub=$3");
		}

		if (domain === "i.fokzine.net") {
			// https://i.fokzine.net/upload/12/08/120829_148689_megan_fox_transformers_movie_image_450_299.jpg
			//   https://i.fokzine.net/upload/12/08/120829_148689_megan_fox_transformers_movie_image.jpg
			return src.replace(/(\/upload\/+(?:[0-9]{2}\/+){2}[^/]*)_[0-9]+_[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "tr-osdcp.qunarzz.com") {
			// https://tr-osdcp.qunarzz.com/tr-osd-tr-space/img/52f18a97a55338e80b2e78874890cd23.jpg_480x320x95_6291d9bf.jpg
			//   https://tr-osdcp.qunarzz.com/tr-osd-tr-space/img/52f18a97a55338e80b2e78874890cd23.jpg
			// https://tr-osdcp.qunarzz.com/tr-osd-tr-space/img/52f18a97a55338e80b2e78874890cd23.jpg_r_640x426x70_b1440af3.jpg
			//   https://tr-osdcp.qunarzz.com/tr-osd-tr-space/img/52f18a97a55338e80b2e78874890cd23.jpg
			return src.replace(/(\/img\/+[0-9a-f]+\.[^/._]*)(?:_r)?_[0-9]+x[0-9]+x[0-9]+_[0-9a-f]+\.[^/.]*(?:[?#].*)?$/, "$1");
		}

		if (domain === "file.newswire.co.kr") {
			// http://file.newswire.co.kr/data/datafile2/thumb_480/2007/06/2007060811812693630.51402200.jpg
			//   http://file.newswire.co.kr/data/datafile2/data/2007/06/2007060811812693630.51402200.jpg
			return src.replace(/(\/data\/+datafile[0-9]+\/+)thumb_[0-9]+\/+/, "$1data/");
		}

		if (domain === "m.gadzetomania.pl") {
			// https://m.gadzetomania.pl/megan-fox-2d17b8b033e7815973b3b5,210,470,0,0.jpg
			//   https://m.gadzetomania.pl/megan-fox-2d17b8b033e7815973b3b5.jpg
			return src.replace(/(-[0-9a-f]+)(?:,[0-9]+){4}(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "mklr.pl") {
			// https://mklr.pl/uimages/services/motokiller/i18n/pl_PL/201302/1360245977_by_Szpilken_500.jpg
			//   https://mklr.pl/uimages/services/motokiller/i18n/pl_PL/201302/1360245977_by_Szpilken.jpg
			return src.replace(/(\/uimages\/+services\/+.*\/+[0-9]{6}\/+[^/]*)_[0-9]+(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain_nosub === "filmpro.ru" && domain.match(/^b[0-9]*\./)) {
			// https://b1.filmpro.ru/c/138092.600xp.jpg
			//   https://b1.filmpro.ru/c/138092.jpg
			return src.replace(/(\/c\/[0-9]+)\.[0-9]+x[0-9a-z]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "static.leiphone.com") {
			// http://static.leiphone.com/uploads/new/article/600_600/201409/54087bb6e4a2c.jpg
			//   http://static.leiphone.com/uploads/new/article/pic/201409/54087bb6e4a2c.jpg
			return src.replace(/\/uploads\/+new\/+article\/+[0-9]+_[0-9]+\/+/, "/uploads/new/article/pic/");
		}

		if (domain_nowww === "tolknews.ru") {
			// https://tolknews.ru/uploads/galleries_images/13954/12869/large.jpg?_=3131832613
			//   https://tolknews.ru/uploads/galleries_images/13954/12869/original.jpg?_=3131832613
			newsrc = src.replace(/(\/uploads\/+galleries_images\/+(?:[0-9]+\/+){2})[a-z]+(\.[^/.]*)(?:{?#].*)?$/,
							   "$1original$2");
			if (newsrc !== src)
				return newsrc;

			// thanks to roi:
			// https://tolknews.ru/picture/231630/700x400.webp
			//   https://tolknews.ru/picture/231630/0x.jpg -- 3239x2160
			return src
				.replace(/(\/picture\/+[0-9]+\/+0x\.)webp/, "$1jpg")
				.replace(/(\/picture\/+[0-9]+\/+)[0-9]*x[0-9]*\./, "$10x.");
		}

		if (domain === "s3.friday-magazine.ch") {
			// https://s3.friday-magazine.ch/Alte-Storys-Contao/_articleteaserl/meganfox.jpg?mtime=20180322124819
			//   https://s3.friday-magazine.ch/Alte-Storys-Contao/meganfox.jpg?mtime=20180322124819
			// https://s3.friday-magazine.ch/Alte-Storys-Contao/_1170xAUTO_fit_top-center_none/meganfox.jpg?mtime=20180322124819
			//   https://s3.friday-magazine.ch/Alte-Storys-Contao/meganfox.jpg
			return src.replace(/(:\/\/[^/]*\/[^/]*\/+)_[^/]+\/+([^/]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "m.tuniucdn.com") {
			// https://m.tuniucdn.com/fb2/t1/G5/M00/28/4F/Cii-slw25U2ITjJSAANIoVF0kZsAAS4owPkFzIAA0i5837_w800_h0_c0_t0.jpg
			//   https://m.tuniucdn.com/fb2/t1/G5/M00/28/4F/Cii-slw25U2ITjJSAANIoVF0kZsAAS4owPkFzIAA0i5837.jpg
			return src.replace(/(\/[^/_.]*)(?:_[a-z][0-9]+){1,}(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "stat.mozi24.hu") {
			// https://stat.mozi24.hu/images/pe/2101/210030_800x600.jpg
			//   https://stat.mozi24.hu/images/pe/2101/210030_0x0.jpg
			return src.replace(/(\/images\/+.*\/+[0-9]+_)[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/,
							   "$10x0$2");
		}

		if (domain_nosub === "autokopen.nl" && domain.match(/^media[0-9]*\./)) {
			// https://media2.autokopen.nl/afbeeldingen/220275-800.jpg
			//   https://media2.autokopen.nl/afbeeldingen/220275-original.jpg
			return src.replace(/(\/[0-9]+)-[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1-original$2");
		}

		if (domain === "vbmspic.video.friday.tw") {
			// https://vbmspic.video.friday.tw/STILL/35738/35738_2732470_M.jpg
			//   https://vbmspic.video.friday.tw/STILL/35738/35738_2732470.jpg
			return src.replace(/(\/[0-9]+_[0-9]+)_[A-Z](\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nosub === "hardware.fi" && domain.match(/^cdn[0-9]+[a-z]?\./)) {
			// https://cdn77b.hardware.fi/storage/pictures/1024/AMD-Intel-Nvidia-Seuraava_vuosikymmen_9.jpg
			//   https://cdn77b.hardware.fi/storage/pictures/AMD-Intel-Nvidia-Seuraava_vuosikymmen_9.jpg
			return src.replace(/\/storage\/+pictures\/+[0-9]+\/+/, "/storage/pictures/");
		}

		if (domain_nowww === "kinofuxy.tv") {
			// https://kinofuxy.tv/thumbs/uploads/posts/2017-11/1000_no_y_1510737217_mv5bota0nzmymte1m15bml5banbnxkftztcwntk2ntiymw__v1_sy1000_cr0015021000_al_.jpg
			//   https://kinofuxy.tv/uploads/posts/2017-11/1510737217_mv5bota0nzmymte1m15bml5banbnxkftztcwntk2ntiymw__v1_sy1000_cr0015021000_al_.jpg
			return src.replace(/\/thumbs\/+(uploads\/+posts\/+[0-9]{4}-[0-9]{2}\/+)[0-9]+_(?:no|y)_(?:no|y)_/, "/$1");
		}

		if (domain_nosub === "web.de" && domain.match(/^i[0-9]*\./)) {
			// https://i0.web.de/image/624/32958624,pd=4,f=lead-xl/megan-fox-transformers.jpg
			//   https://i0.web.de/image/624/32958624,pd=4/megan-fox-transformers.jpg
			// thanks to roi:
			// https://i0.web.de/image/624/32958624%2cpd=4%2cf=lead-xl/megan-fox-transformers.jpg
			// thanks to anonymous for reporting:
			// https://i0.web.de/image/576/38328576%2cpd=3%2cf=lead-m-2x.webp
			//   https://i0.web.de/image/576/38328576,pd=3/a.png
			return src
				.replace(/(\/image\/+[0-9]+\/+[0-9]+)[^/]*?((?:,|%2[cC])pd=[0-9]+)[^/]*(\/+.*)?$/, "$1$2$3")
				.replace(/(\/image\/+[0-9]+\/[^/]+)$/, "$1/a.png");
		}

		if (domain === "img.culturacolectiva.com" ||
			// https://www.daz3d.com/cdn-cgi/image/width=200,height=200,fit=cover/https://gcdn.daz3d.com/p/72725/i/fermion-racing-suit-for-genesis-8-males-01-daz3d.jpg
			//   https://gcdn.daz3d.com/p/72725/i/fermion-racing-suit-for-genesis-8-males-01-daz3d.jpg
			domain_nowww === "daz3d.com" ||
			// https://images.dailycaller.com/image/width=1280,height=549,fit=cover,f=auto/https://cdn01.dailycaller.com/wp-content/uploads/2020/11/Rural-Wisconsin-Lancscape-by-MarynaG.-Shutterstock.-scaled-e1605892062397.jpg
			//   https://cdn01.dailycaller.com/wp-content/uploads/2020/11/Rural-Wisconsin-Lancscape-by-MarynaG.-Shutterstock.-scaled-e1605892062397.jpg
			domain === "images.dailycaller.com" ||
			// thanks to dym-sh on github: https://github.com/qsniyg/maxurl/issues/638
			// https://envato.com/blog/ux-tips-from-envatos-design-team
			// https://blog.corp-site.envato.com/cdn-cgi/image/width=1200,quality=95,format=auto/uploads/2021/01/UX-Tips-from-Envatos-Newest-Recruits.jpg
			//   https://blog.corp-site.envato.com/uploads/2021/01/UX-Tips-from-Envatos-Newest-Recruits.jpg
			// https://envato.com/cdn-cgi/image/format=auto,fit=scale-down,width=690,quality=75/learn/video-marketing-guide-images/tools/Production-Tools.jpg
			//   https://envato.com/learn/video-marketing-guide-images/tools/Production-Tools.jpg
			domain_nosub === "envato.com" ||
			// thanks to fireattack on discord
			// https://contents.oricon.co.jp/cdn-cgi/image/width=750,quality=85,format=auto/upimg/news/20210419/2190937_202104190880286001618822232e.jpg
			//   https://contents.oricon.co.jp/upimg/news/20210419/2190937_202104190880286001618822232e.jpg
			domain === "contents.oricon.co.jp" ||
			// https://img.i-scmp.com/cdn-cgi/image/fit=contain,width=1098,format=auto/sites/default/files/d8/images/methode/2020/12/30/b8d299d4-4a74-11eb-9c55-93e83087d811_image_hires_202411.jpg
			//   https://img.i-scmp.com/sites/default/files/d8/images/methode/2020/12/30/b8d299d4-4a74-11eb-9c55-93e83087d811_image_hires_202411.jpg
			domain === "img.i-scmp.com" ||
			// thanks to cbadoud on discord for reporting:
			// https://media.fashionnetwork.com/cdn-cgi/image/fit=cover,width=208,height=208/m/8f6c/cd15/d620/6371/91b1/e5b7/5b5a/4e96/d59e/2304/2304.jpg
			//   https://media.fashionnetwork.com/m/8f6c/cd15/d620/6371/91b1/e5b7/5b5a/4e96/d59e/2304/2304.jpg
			domain_nosub === "fashionnetwork.com" ||
			// thanks to dym-sh on github: https://github.com/qsniyg/maxurl/issues/895
			// https://www.notion.so/cdn-cgi/image/w=3840,q=100/https://images.ctfassets.net/spoqsaf9291f/3W8spPYN3tFTRplzwg5LAW/883eebba0def38757f5c50eb5a414222/static-site-rfc.png
			//   https://images.ctfassets.net/spoqsaf9291f/3W8spPYN3tFTRplzwg5LAW/883eebba0def38757f5c50eb5a414222/static-site-rfc.png
			domain_nowww === "notion.so" ||
			// thanks to Liz on discord: https://github.com/qsniyg/maxurl/issues/953
			// https://kanopy.com/cdn-cgi/image/fit=cover,height=900,width=1600/https://static-assets.kanopy.com/video-images/ff4119f8-51ba-4469-8dae-ef0dacca5c44.jpg
			//   https://static-assets.kanopy.com/video-images/ff4119f8-51ba-4469-8dae-ef0dacca5c44.jpg
			domain_nowww === "kanopy.com" ||
			// thanks to cbadoud on github: https://github.com/qsniyg/maxurl/issues/1024
			// https://images.vestiairecollective.com/cdn-cgi/image/w=224,h=224,q=80,f=auto,/produit/white-plastic-le-pandorine-handbag-22225634-1_2.jpg
			//   https://images.vestiairecollective.com/produit/white-plastic-le-pandorine-handbag-22225634-1_2.jpg
			// https://images.vestiairecollective.com/cdn-cgi/image/w=60,h=undefined,q=80,f=auto,https://images.vestiairecollective.com/cdn-cgi/image//produit/green-leather-kelly-28-hermes-handbag-22157163-1_2.jpg
			//   https://images.vestiairecollective.com/images.vestiairecollective.com/cdn-cgi/image//produit/green-leather-kelly-28-hermes-handbag-22157163-1_2.jpg
			//   https://images.vestiairecollective.com/produit/green-leather-kelly-28-hermes-handbag-22157163-1_2.jpg
			domain === "images.vestiairecollective.com" ||
			// https://assets-cms.vestiairecollective.com/cdn-cgi/image/,f=auto,fit=contain,q=70,dpr=1,w=768,h=768/220331-hp-new-eg-streetwear-sneakers-desktop-1500x1288px_1647953845436.jpg
			//   https://assets-cms.vestiairecollective.com/220331-hp-new-eg-streetwear-sneakers-desktop-1500x1288px_1647953845436.jpg
			domain === "assets-cms.vestiairecollective.com" ||
			// thanks to JustLurkingHere on github for reporting: https://github.com/qsniyg/maxurl/issues/1164
			// https://image.static.bstage.in/cdn-cgi/image/metadata=none,dpr=2,width=640/newsjamm/14edb6f2-cd55-461e-bc00-ed4c4421c8d8/f9aa520f-b9cd-4f7d-8be7-f9d1cc565d20/ori.jpg
			//   https://image.static.bstage.in/newsjamm/14edb6f2-cd55-461e-bc00-ed4c4421c8d8/f9aa520f-b9cd-4f7d-8be7-f9d1cc565d20/ori.jpg
			domain === "image.static.bstage.in" ||
			// thanks to anonymous for reporting:
			// https://cdn.myfonts.net/cdn-cgi/image/width=720,height=360,fit=contain,format=auto/images/pim/10000/273152_29a00b3a4754f091a3605416e67e215b.png
			//   https://cdn.myfonts.net/images/pim/10000/273152_29a00b3a4754f091a3605416e67e215b.png -- 2000x1000
			domain === "cdn.myfonts.net" ||
			// https://www.theplan.it/cdn-cgi/image/fit=contain,width=400/images/hemsworthll11886.jpg
			//   https://www.theplan.it/images/hemsworthll11886.jpg
			domain_nowww === "theplan.it" ||
			// thanks to anonymous for reporting:
			// https://www.economist.com/cdn-cgi/image/width=1424,quality=80,format=auto/content-assets/images/20230805_LDD001.jpg
			//   https://www.economist.com/content-assets/images/20230805_LDD001.jpg -- forces download
			domain_nowww === "economist.com" ||
			// https://img.mylibrary.digital/cdn-cgi/image/fit=cover,format=auto,width=180,quality=75/https://img1.od-cdn.com/ImageType-200/0292-1/%7B7001398A-14E9-47B7-806B-82FF0459898E%7DImg200.jpg
			//   https://img1.od-cdn.com/ImageType-200/0292-1/%7B7001398A-14E9-47B7-806B-82FF0459898E%7DImg200.jpg
			domain === "img.mylibrary.digital" ||
			// https://images.psmcdn.net/cdn-cgi/image/width=205,quality=100//tsv4/model/profiles/luna_daniels.jpg
			//   https://images.psmcdn.net/tsv4/model/profiles/luna_daniels.jpg
			domain === "images.psmcdn.net" ||
			/^[a-z]+:\/\/[^/]+\/+cdn-cgi\/+image\/+[^/]*=[^/]*\//.test(src)) {
			// https://img.culturacolectiva.com/cdn-cgi/image/f=auto,w=auto,q=80,fit=contain/content_image/2019/8/27/1566916692259-los-mejores-looks-de-los-vma-de-mtv.jpg
			//   https://img.culturacolectiva.com/content_image/2019/8/27/1566916692259-los-mejores-looks-de-los-vma-de-mtv.jpg
			newsrc = src.replace(/^([a-z]+:\/\/[^/]+\/+(?:cdn-cgi\/+)?image\/+[^/]*=[^/]*),(https?:\/\/)/, "$1/$2");
			if (newsrc !== src)
				return newsrc;

			newsrc = urljoin("https://" + domain + "/", src.replace(/^[a-z]+:\/\/[^/]+\/+(?:cdn-cgi\/+)?image\/+[^/]*=[^/]*\/+/, ""), true);
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "d3ls91xgksobn.cloudfront.net") {
			// thanks to anonymous for reporting:
			// https://d3ls91xgksobn.cloudfront.net/5120x,q90,f=webp/etuovimedia/images/property/import/749/1938749/0e76b9541118d347871c0e0e51d244c4/e514bc941bdc717fe6796d9f56502c32/ORIGINAL.jpeg
			//   https://d3ls91xgksobn.cloudfront.net/q100/etuovimedia/images/property/import/749/1938749/0e76b9541118d347871c0e0e51d244c4/e514bc941bdc717fe6796d9f56502c32/ORIGINAL.jpeg
			return src.replace(/(:\/\/[^/]+\/+)[^/]+\/+([^/]+\/+images\/)/, "$1q100/$2");
		}

		if (domain === "storage.yandexcloud.net") {
			// thanks to roi:
			// https://storage.yandexcloud.net/imagesspletnikru/2024/01/23/YC6K/fit=cover,width=744,height=496.webp
			//   https://storage.yandexcloud.net/imagesspletnikru/2024/01/23/YC6K/original.webp
			newsrc = src.replace(/(\/imagesspletnikru\/+[0-9]{4}\/+[0-9]{2}\/+[0-9]{2}\/+[^/]+\/+)[^/]+(\.[a-z]+)(?:[?#].*)?$/, "$1original$2");
			if (newsrc !== src)
				return newsrc;

			// thanks to roi:
			// https://storage.yandexcloud.net/imagesspletnikru/2024/01/23/YC6K/original.webp
			//   https://storage.yandexcloud.net/imagesspletnikru/2024/01/23/YC6K/original.jpeg
			newsrc = src.replace(/(\/imagesspletnikru\/+[0-9]{4}\/+[0-9]{2}\/+[0-9]{2}\/+[^/]+\/+)original\.webp(?:[?#].*)?$/, "$1original.jpeg");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nowww === "cara.app") {
			let get_cara_imageid = function(url) {
				return url.replace(/.*\/posts\/+[-0-9a-f]{20,}\/[^-/.?#]+-([^-/.?#]+)-[^/]+(?:[?#].*)?$/, "$1");
			};

			// thanks to Anon_Ymou5 on reddit for reporting: https://www.reddit.com/r/MaxImage/comments/170nru5/image_max_url_2023100_is_released_130_new/k7vabt4/
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+post\/+([-0-9a-f]{20,})(?:[?#].*)?$/,
				query_for_id: {
					url: "https://cara.app/api/posts/${id}",
					headers: {
						"Accept": "application/json, text/plain, */*"
					},
					json: true,
					imu_mode: "xhr"
				},
				override_cb: function(cb, data) {
					if (!data) return cb(data);

					var queries = common_functions["parse_imu_hash"](src);
					let imageid = null;
					let found_imageid = -1;
					if (queries && queries.url) {
						imageid = get_cara_imageid(decodeuri_ifneeded(queries.url));
					}

					for (let link of data.album_info.links) {
						link.is_current = false;
					}

					let found = false;
					for (let link of data.album_info.links) {
						let link_id = get_cara_imageid(link.url);
						if (link_id === imageid) {
							found = true;
							link.is_current = true;
							data.url = link.url;
							break;
						}
					}

					if (!found) {
						data.url = data.album_info.links[0].url;
						data.album_info.links[0].is_current = true;
					}

					cb(data);
				},
				process: function(done, resp, cache_key) {
					let obj:BigImageInfoSObject = {
						album_info: {
							type: "links",
							links: []
						},
						extra: {
							created_date: new Date(resp.data.createdAt).getTime(),
							caption: resp.data.title,
							author_username: resp.data.slug,
							page: "https://cara.app/post/" + resp.data.id
						}
					};

					for (let image of resp.data.images) {
						if (image.isCoverImg)
							continue;

						obj.album_info.links.push({
							url: "https://cdn.cara.app/" + image.src,
							is_current: false
						});
					}

					done(obj, 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "cdn.cara.app") {
			// thanks to Anon_Ymou5 on reddit for reporting: https://www.reddit.com/r/MaxImage/comments/170nru5/image_max_url_2023100_is_released_130_new/k7vabt4/
			match = src.match(/\/production\/+posts\/+([-0-9a-f]{20,})\/+/);
			if (match) {
				return {
					url: "https://cara.app/post/" + match[1] + "#imu-url=" + encodeURIComponent(src),
					is_pagelink: true
				};
			}
		}

		if (domain_nosub === "fashionnetwork.com" && /^(?:[a-z]+\.)?media\./.test(domain)) {
			// http://media.fashionnetwork.com/m/2884/966d/1620/d702/c1de/b152/ad09/33fa/3832/bc32/487x272.72/bc32.jpg
			//   http://media.fashionnetwork.com/m/2884/966d/1620/d702/c1de/b152/ad09/33fa/3832/bc32/bc32.jpg
			// https://us.media.fashionnetwork.com/m/a9de/9ded/bf23/9609/2056/ccb9/3cc4/9940/cd0e/6956/650x1019.60/6956.jpg
			//   https://us.media.fashionnetwork.com/m/a9de/9ded/bf23/9609/2056/ccb9/3cc4/9940/cd0e/6956/6956.jpg
			// https://asia.media.fashionnetwork.com/m/81a2/11d8/cf0c/183b/4ce4/9418/8a63/354a/3dae/eb64/200x125/eb64.jpg
			//   https://asia.media.fashionnetwork.com/m/81a2/11d8/cf0c/183b/4ce4/9418/8a63/354a/3dae/eb64/eb64.jpg
			return src.replace(/(\/[a-f0-9]+\/+)[0-9]+x[0-9]+(?:\.[0-9]+)?\/+([a-f0-9]+\.[^/.]*)$/, "$1$2");
		}

		if (domain_nosub === "fashionnetwork.com") {
			// thanks to cbadoud on github for reporting: https://github.com/qsniyg/maxurl/issues/853#issuecomment-1086932000
			// https://ch.fashionnetwork.com/fashion_build/img/common/icons/star-3.png
			// https://ch.fashionnetwork.com/fashion_build/img/common/icons/star-2.75.png
			if (/\/img\/+common\/+icons\/+star-[0-9.]+\./.test(src))
				return {
					url: src,
					bad: "mask"
				};
		}

		if (domain_nowww === "movierj.com") {
			// https://www.movierj.com/cdn-cgi/image/q=75,f=auto/upmovies/upload/Shingeki_no_Kyojin-min.jpg
			//   https://www.movierj.com/upmovies/upload/Shingeki_no_Kyojin-min.jpg
			//   https://www.movierj.com/upmovies/upload/Shingeki_no_Kyojin.jpg
			return src
				.replace(/\/cdn-cgi\/+image\/+(?:.*?,)?f=[^/]*\/+(upmovies\/+[^,]*).*?$/, "/$1")
				.replace(/(\/upmovies\/+upload\/+[^/]*)-min(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "contents.oricon.co.jp") {
			// thanks to fireattack on discord
			// https://www.oricon.co.jp/news/2190937/photo/1/
			// https://contents.oricon.co.jp/images/news/20210419/2190937_202104190880286001618822232e-w1200_h667.jpg?LB=true
			//   https://contents.oricon.co.jp/upimg/news/20210419/2190937_202104190880286001618822232e.jpg
			newsrc = src.replace(/\/images\/+([^/]+\/+[^/]+\/+[^/?#]+)-w[0-9]+_h[0-9]+(\.[^/.?#]+)(?:[?#].*)?$/, "/upimg/$1$2");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nowww === "wegotthiscovered.com") {
			// https://wegotthiscovered.com/wp-content/themes/wgtc_v2/resizer/resizer.php?file=uploads/MeganFoxOutofTransformers-thumb-550x366-39215.jpg&height=798.54545454545&width=1200&action=resize -- upscaled
			//   https://wegotthiscovered.com/wp-content/uploads/MeganFoxOutofTransformers-thumb-550x366-39215.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/wp-content\/+themes\/+wgtc_v2\/+resizer\/+resizer\.php.*?[?&]file=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return urljoin(src, decodeuri_ifneeded(newsrc).replace(/^uploads\//, "/wp-content/uploads/"), true);
		}

		if (domain_nowww === "extra.cz") {
			// https://www.extra.cz/images/thumbs/a5/85/a5850d2-14321-profimedia-0098072335-2048x0-shrink.jpg
			//   https://www.extra.cz/images/thumbs/a5/85/a5850d2-14321-profimedia-0098072335-9999999x0-shrink.jpg
			// https://www.extra.cz/images/thumbs/fe/b5/feb5e49-91757-4-658x900-fit.jpg
			//   https://www.extra.cz/images/original/fe/b5/feb5e49-91757-4.jpg
			return src.replace(/\/images\/+thumbs\/+((?:[0-9a-f]{2}\/+){2}[^/]+)-[0-9]+x[0-9]+-(?:shrink|fit)(\.[^/.]*)(?:[?#].*)?$/, "/images/original/$1$2");
			//return src.replace(/(\/images\/+thumbs\/+(?:[0-9a-f]{2}\/+){2}[^/]*)-[0-9]+x[0-9]+-shrink(\.[^/.]*)(?:[?#].*)?$/, "$1-9999999x0-shrink$2");
		}

		if (domain === "media.services.cinergy.ch") {
			// https://media.services.cinergy.ch/media/box1024/860575b9a3a6ab7e6ae75aea030f3fa094e7af74.jpg -- upscaled
			//   https://media.services.cinergy.ch/media/raw/860575b9a3a6ab7e6ae75aea030f3fa094e7af74.jpg
			return src.replace(/\/media\/+[^/]*\/+/, "/media/raw/");
		}

		if (domain === "m.s1ar.cc") {
			// https://m.s1ar.cc/file/https://scontent-arn2-1.cdninstagram.com/vp/f5b7de98ee4312d76de57d4e9cad17d2/5D4C922B/t51.2885-15/sh0.08/e35/s640x640/54732238_2273063546274038_5465027906095804020_n.jpg?_nc_ht=scontent-arn2-1.cdninstagram.com
			//   https://scontent-arn2-1.cdninstagram.com/vp/f5b7de98ee4312d76de57d4e9cad17d2/5D4C922B/t51.2885-15/sh0.08/e35/s640x640/54732238_2273063546274038_5465027906095804020_n.jpg?_nc_ht=scontent-arn2-1.cdninstagram.com
			return src.replace(/^[a-z]+:\/\/[^/]*\/+file\/+(https?:\/\/)/, "$1");
		}

		if (domain === "i.joylada.net") {
			// https://i.joylada.net/18974204/profile-image/a93532ad-b405-499f-8c32-5af7b5d54a79.jpg/thumbnail?h=400
			//   https://i.joylada.net/18974204/profile-image/a93532ad-b405-499f-8c32-5af7b5d54a79.jpg
			return src.replace(/(\.[^/.]+)\/+thumbnail(?:[?#].*)?$/, "$1");
		}

		if (domain_nowww === "etoland.co.kr") {
			// http://www.etoland.co.kr//data/daumeditor02/190326/thumbnail3/18137015535645080.jpg
			//   http://www.etoland.co.kr//data/daumeditor02/190326/18137015535645080.jpg
			return {
				url: src.replace(/(\/data\/+daumeditor[0-9]*\/+[0-9]+\/+)thumbnail[0-9]*\/+/, "$1"),
				headers: {
					// thanks to Urkchar on discord for reporting
					Referer: ""
				},
				can_head: false // 403
			};
		}

		if (domain_nowww === "bomb01.com") {
			// https://www.bomb01.com/upload/news_cover/1200x630/51973.jpg
			//   https://www.bomb01.com/upload/news_cover/original/51973.jpg
			// https://www.bomb01.com/upload/news/original/20a30692c0cb10209e2b8698d7fa3b85.jpg
			return src.replace(/(\/upload\/+news(?:_cover)?\/+)[0-9]+x[0-9]+\/+/, "$1original/");
		}

		if (domain_nosub === "jfcdns.com") {
			// https://thumb22.jfcdns.com/thumb/up/2017-11/15101922487402113_460_380.jpg
			//   https://thumb22.jfcdns.com/up/2017-11/15101922487402113.jpg
			return src.replace(/\/thumb\/+((?:up\/+)?[0-9]{4}-[0-9]{2}\/+[0-9]+)_[0-9]+_[0-9]+(\.[^/.]*)(?:[?#].*)?$/,
							   "/$1$2");
		}

		if (domain_nosub === "mysnap.top" && domain.match(/^sv[0-9]*\./)) {
			// https://sv2.mysnap.top/thumb.php?src=nUE0pQbiY_ygLJqyYz5yq3ZkYzglY3A5p3EyoF9jnT90o3ZiZwNkBP8_YmR1YmZkAwV-BQpinTyanP5dpTpcXltbGKyDo3WhH_5upP50o3NcK_ucM_thnaOa&w=176&h=144
			//   https://sv2.mysnap.top/thumb.php?src=nUE0pQbiY_ygLJqyYz5yq3ZkYzglY3A5p3EyoF9jnT90o3ZiZwNkBP8_YmR1YmZkAwV-BQpinTyanP5dpTpcXltbGKyDo3WhH_5upP50o3NcK_ucM_thnaOa
			// https://sv1.mysnap.top/thumb.php?src=nUE0pQbiY_ygLJqyYz5yq3ZkYzglY3A5p3EyoF9jnT90o3ZiZwNkBP8_YmR1YmZkAwV-BQpio3WcM_yhLJjhnaOaXFfbXR15HT9loyAhLKNhqT9jXI9ipzyanJ5uoP5dpTp5v7P&w=176&h=144
			//   https://sv2.mysnap.top/thumb.php?src=nUE0pQbiY_ygLJqyYz5yq3ZkYzglY3A5p3EyoF9jnT90o3ZiZwNkBP8_YmR1YmZkAwV-BQpio3WcM_yhLJjhnaOaXFfbXR15HT9loyAhLKNhqT9jXI9ipzyanJ5uoP5dpTp5v7P -- sv1 redirects to homepage
			return src.replace(/:\/\/sv[0-9]*\.([^/]*\/)thumb\.php.*?[?&]src=([^&]*).*?$/, "://sv2.$1thumb.php?src=$2");
		}

		if (domain_nowww === "gttourkorea.com") {
			// http://gttourkorea.com/data/goods/6/617/yes24_com_20190524_120506.list.jpg
			//   http://gttourkorea.com/data/goods/6/617/yes24_com_20190524_120506.jpg
			// http://www.gttourkorea.com/data/goods/5/506/o_1d41f2lc3124gm6q299ekm13ot8.list.jpg
			//   http://www.gttourkorea.com/data/goods/5/506/o_1d41f2lc3124gm6q299ekm13ot8.jpg
			return src.replace(/(\/data\/+goods\/+[0-9]\/+[0-9]+\/+[^/]*)\.list(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain === "media.karousell.com") {
			// https://media.karousell.com/media/photos/products/2019/03/20/150723_218912279_thumbnail_progressive_thumbnail.jpg
			//   https://media.karousell.com/media/photos/products/2019/03/20/150723_218912279_thumbnail.jpg
			// https://media.karousell.com/media/photos/products/2019/04/24/163655_224532925_thumbnail_thumbnail.jpg
			//   https://media.karousell.com/media/photos/products/2019/04/24/163655_224532925_thumbnail.jpg
			// https://media.karousell.com/media/photos/products/2019/11/20/104647_263356538_thumbnail0_progressive_thumbnail
			//   https://media.karousell.com/media/photos/products/2019/11/20/104647_263356538_thumbnail0 -- upscaled?
			return src.replace(/(\/media\/+photos\/+products\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[^/]*?)(?:_progressive)?_thumbnail(\.[^/.]*)?(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain === "media.matamata.com") {
			// https://media.matamata.com/thumbs/2018/07/09/84423-taeyeon-instagram-attaeyeon-ss/745x489-img-84423-taeyeon-instagram-attaeyeon-ss.jpg
			//   https://media.matamata.com/thumbs/2018/07/09/84423-taeyeon-instagram-attaeyeon-ss/o-img-84423-taeyeon-instagram-attaeyeon-ss.jpg --596x745
			//   https://media.matamata.com/images/2018/07/09/84423-taeyeon-instagram-attaeyeon-ss.jpg -- 1080x1349
			return src.replace(/\/thumbs\/+([0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9]+-[^/]*)\/+[^/]*(\.[^/.]*)(?:[?#].*)?$/,
							   "/images/$1$2");
		}

		if (domain === "img.haihanxeng.com" ||
			// https://img.gurugamer.com/resize/740x-/2019/06/23/46252242-395546120985250-4065421605895718064-n-4790.jpg
			//   https://img.gurugamer.com/2019/06/23/46252242-395546120985250-4065421605895718064-n-4790.jpg
			domain === "img.gurugamer.com") {
			// https://img.haihanxeng.com/resize/800x-/2019/03/19/11/00/tinngan080648286247462.jpg
			//   https://img.haihanxeng.com/2019/03/19/11/00/tinngan080648286247462.jpg
			return src.replace(/(:\/\/[^/]*\/)resize\/+[-0-9]+x[-0-9]+\/+/, "$1");
		}

		if (domain === "static.appledaily.hk") {
			// https://static.appledaily.hk/images/e-paper/20181012/small/1539322994_ac31.jpg
			//   https://static.appledaily.hk/images/e-paper/20181012/large/1539322994_ac31.jpg
			return src.replace(/(\/images\/+[^/]*\/+[0-9]{8}\/+)[a-z]+\/+/, "$1large/");
		}

		if (domain_nowww === "jk6.cc") {
			// base64 is garbage
			// http://www.jk6.cc/api.php?url=http://mmbiz.qpic.cn/mmbiz_jpg/PuDibUcbbXrwJSjVCkJJ6bMiaXaXDHRKB1CEDGFKGoswtwcFynGQCcGseUrljzwtVj7pSM6uM11Gc2uPuILIp0dQ/0?wx_fmt=jpeg
			//   http://mmbiz.qpic.cn/mmbiz_jpg/PuDibUcbbXrwJSjVCkJJ6bMiaXaXDHRKB1CEDGFKGoswtwcFynGQCcGseUrljzwtVj7pSM6uM11Gc2uPuILIp0dQ/0
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/api\.php.*?[?&]url=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nowww === "meduza.io") {
			// https://meduza.io/image/attachments/images/003/958/556/small/x-iRkiJpTH_GrOTCnuH5BA.jpg
			//   https://meduza.io/image/attachments/images/003/958/556/original/x-iRkiJpTH_GrOTCnuH5BA.jpg
			newsrc = src.replace(/(\/images\/+(?:[0-9]{3}\/+){3})[a-z]+\/+/, "$1original/");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nowww === "popgun.ru") {
			// https://popgun.ru/files/g/12/thumbs/1637784.jpg
			//   https://popgun.ru/files/g/12/orig/1637784.jpg
			return src.replace(/(\/files\/+[^/]*\/+[0-9]+\/+)[a-z]+\/+/, "$1orig/");
		}

		if (domain_nowww === "rosphoto.com") {
			// https://rosphoto.com/rimg/300-200-c/images/u/articles/1905/na-glavnuyu.jpg
			//   https://rosphoto.com/images/u/articles/1905/na-glavnuyu.jpg
			return src.replace(/\/rimg\/+[0-9]+-[0-9]+(?:-[a-z])?\/+images\/+/, "/images/");
		}

		if (domain_nowww === "thevoicemag.ru") {
			// https://www.thevoicemag.ru/upload/verstka_io/3211947/172be52712af0d2b38339f386a5e3bf5_small.png
			//   https://www.thevoicemag.ru/upload/verstka_io/3211947/172be52712af0d2b38339f386a5e3bf5.png
			newsrc = src.replace(/(\/upload\/+[^/]+\/+[0-9]+\/+[0-9a-f]{10,})_[a-z]+\./, "$1.");
			if (newsrc !== src)
				return newsrc;
		}

		if ((domain_nosub === "popmeh.ru" && /^images[0-9]*\./.test(domain)) ||
			// https://www.thesymbol.ru/fashion/collections/novaya-seksualnost-bra-iz-ekokozhi-bryuki-s-vyrezami-na-bedrah-i-drugie-trendy-sezona-dlya-smelyh-modnic/
			// https://www.thesymbol.ru/upload/img_cache/46c/46c89a82859cb0cf24fca8512805459a_ce_2240x1244x0x0_cropped_2240x1240.jpg
			//   https://www.thesymbol.ru/upload/img_cache/46c/46c89a82859cb0cf24fca8512805459a_ce_2240x1244x0x0.jpg
			// https://www.thesymbol.ru/upload/verstka_io/M396123/9796c1cfddb9c8cdfd579e48f739345f.jpg
			domain_nowww === "thesymbol.ru" ||
			// thanks to anonymous for reporting:
			// https://www.pravilamag.ru/upload/img_cache/165/1655bc78b8a572c9d4c58b154f1ea5b9_ce_2000x2000x296x0_cropped_385x385.webp
			//   https://www.pravilamag.ru/upload/img_cache/165/1655bc78b8a572c9d4c58b154f1ea5b9_ce_2000x2000x296x0.jpg
			domain_nowww === "pravilamag.ru" ||
			// thanks to anonymous for reporting:
			// https://images11.esquire.ru/upload/img_cache/600/6006d2e3c1b2a4e455e26b857aa2c92d_cropped_1332x1666.jpg
			//(domain_nosub === "esquire.ru" && /^images[0-9]*\./.test(domain)) ||
			// thanks to roi:
			// https://images.thevoicemag.ru/upload/img_cache/ce5/ce5bd964905367ba7338d55c52e1d671_ce_2196x1464x239x451_cropped_666x444.webp
			//   https://images.thevoicemag.ru/upload/img_cache/ce5/ce5bd964905367ba7338d55c52e1d671_ce_2196x1464x239x451.jpg
			domain_nosub === "thevoicemag.ru" /*||
			// https://images11.graziamagazine.ru/upload/img_cache/ea3/ea3cd4e8879caf4ed60b9c8eea771943_cropped_740x740.jpeg
			// doesn't work
			domain_nosub === "graziamagazine.ru" ||
			// https://images11.bazaar.ru/upload/img_cache/b26/b267b8cc2b5cb3e0f3f19440fb59235e_fitted_1110x1800.jpg
			// doesn't work
			domain_nosub === "bazaar.ru"*/) {
			// https://images11.popmeh.ru/upload/img_cache/41f/41f8c3afe0a2611926c8682b7bf6e0a9_ce_1440x768x0x19_cropped_800x427.jpg
			//   https://images11.popmeh.ru/upload/img_cache/41f/41f8c3afe0a2611926c8682b7bf6e0a9_ce_1440x768x0x19.jpg
			return src
				.replace(/(\/upload\/+img_cache\/+[0-9a-f]{3}\/+[0-9a-f]+(?:_[^/_]+_[0-9]+x[0-9]+x[0-9]+x[0-9]+)?)_(?:cropped|fitted)_[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2")
				.replace(/(\/upload\/+img_cache\/.*)\.webp(?:[?#].*)?$/, "$1.jpg");
		}

		if (domain_nowww === "erohd.net") {
			// https://erohd.net/plugins/content/jw_sig/jw_sig/tmpl/Classic/images/magnify_48x48_24.png
			if (/\/plugins\/+content\/+jw_sig\/+jw_sig\/+tmpl\/+Classic\/+images\//.test(src))
				return {
					url: src,
					bad: "mask"
				};

			// https://erohd.net/foto-devushek/molodye/golaya-suchka-marga-e-na-vysokikh-kabluchkakh.html
			// https://erohd.net/images/news/2013/06/Marga_E_-_Lovespirit/img_cache/img_cache_marga_e_-_lovespirit_-_photo_44_www.erohd.net.jpg
			//   https://erohd.net/images/news/2013/06/Marga_E_-_Lovespirit/Marga_E_-_Lovespirit_-_Photo_44_www.erohd.net.jpg
			return src.replace(/(\/images\/+news\/+[0-9]{4}\/+[0-9]{2}\/+([^/]+)\/+)img_cache\/+img_cache_[^/.?#]+_-_photo_/, "$1$2_-_Photo_");
		}

		if (domain_nowww === "decoder.ru") {
			// http://www.decoder.ru/media/pic_middle/0/1920.jpg
			//   http://www.decoder.ru/media/pic_full/0/1920.jpg
			return src.replace(/\/media\/+pic_[a-z]+\/+/, "/media/pic_full/");
		}

		if (domain_nowww === "fotogora.ru") {
			// https://fotogora.ru/img/blog/big/2018/8/24/12413.jpg
			//   https://fotogora.ru/img/blog/or/2018/8/24/12413.jpg
			return src.replace(/\/img\/+blog\/+[a-z]+\/+/, "/img/blog/or/");
		}

		if (domain_nowww === "photosynthesis.bg") {
			// https://photosynthesis.bg/images/imagecache/640_360_8bd1b300ef55bcbc2a662ac99c07e0c8.jpg
			//   https://photosynthesis.bg/uploads/article_icons/8bd1b300ef55bcbc2a662ac99c07e0c8.jpg
			return src.replace(/\/images\/+imagecache\/+[0-9]+_[0-9]+_([0-9a-f]+\.[^/.]*)(?:[?#].*)?$/,
							   "/uploads/article_icons/$1");
		}

		if (amazon_container === "hobbydb-production") {
			// https://hobbydb-production.s3.amazonaws.com/processed_uploads/subject_photo/subject_photo/image/41642/1533674621-7820-1432/Emma_20Stone_large.jpg
			//   https://hobbydb-production.s3.amazonaws.com/processed_uploads/subject_photo/subject_photo/image/41642/1533674621-7820-1432/Emma_20Stone.jpg
			return src.replace(/(\/image\/+[0-9]+\/+[0-9]+-[0-9]+-[0-9]+\/+[^/]*)_large(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain === "d1kls9wq53whe1.cloudfront.net") {
			// https://d1kls9wq53whe1.cloudfront.net/articles/17374/410x618/ad590584acdd3d24c56caf18570dc0d8.jpg
			//   https://d1kls9wq53whe1.cloudfront.net/articles/17374/ORG/ad590584acdd3d24c56caf18570dc0d8.jpg
			return src.replace(/(\/articles\/+[0-9]+\/+)[0-9]+x[0-9]+\/+/, "$1ORG/");
		}

		if (domain === "images.animageplus.jp" ||
			// thanks to meloner on discord for reporting:
			// https://images.rollingstonejapan.com/articles/39000/39492/133x270/a17f8481812dac4141d897437c673230.jpg
			//   https://images.rollingstonejapan.com/articles/39000/39492/ORG/a17f8481812dac4141d897437c673230.jpg
			// other:
			// https://rollingstonejapan.com/articles/detail/39577
			// https://images.rollingstonejapan.com/articles/39000/39577/wysiwyg/9318ddc8549a27b84d6f98dafd4e79a9.jpg
			domain === "images.rollingstonejapan.com" ||
			// thanks to nimbuz on discord
			// https://images.entamenext.com/articles_photos/12000/12914/478x850/ceb1fea87395c9b42637932956999160.jpg
			//   https://images.entamenext.com/articles_photos/12000/12914/ORG/ceb1fea87395c9b42637932956999160.jpg -- 3121x4677
			domain === "images.entamenext.com") {
			// thanks to fireattack on github: https://github.com/qsniyg/maxurl/issues/610
			// https://animageplus.jp/articles/gallery/34894/62760
			// https://images.animageplus.jp/articles_photos/34000/34894/231x410/276f60fb5e84e158be6d6c818528d9c7.jpg
			//   https://images.animageplus.jp/articles_photos/34000/34894/478x850/276f60fb5e84e158be6d6c818528d9c7.jpg
			//   https://images.animageplus.jp/articles_photos/34000/34894/ORG/276f60fb5e84e158be6d6c818528d9c7.jpg
			// https://images.animageplus.jp/articles/34000/34879/231x410/f792273f96c22aa1828be8f08e0b86c5.jpg
			//   https://images.animageplus.jp/articles/34000/34879/ORG/f792273f96c22aa1828be8f08e0b86c5.jpg
			return src.replace(/(\/articles(?:_photos)?\/+[0-9]+\/+[0-9]+\/+)[0-9]+x[0-9]+\/+/, "$1ORG/");
		}

		if (domain === "2019.images.forbesjapan.media") {
			// https://2019.images.forbesjapan.media/articles/22000/22816/photos/compress/19aaa50825756fa220a9539697fc3604.jpg
			//   https://2019.images.forbesjapan.media/articles/22000/22816/photos/ORG/19aaa50825756fa220a9539697fc3604.jpg
			// https://2019.images.forbesjapan.media/articles/26000/26369/photos/ORG/dec61d12139d84a764918ec8da76f1bb.jpg
			//   == https://d1kls9wq53whe1.cloudfront.net/articles/26369/ORG/b37286fc1663999743f0bba4179239dd.jpg
			// other:
			// https://2019.images.forbesjapan.media/articles/22000/22816/wysiwyg/9da59e6c63b229fb669273ca9db41280.jpg
			return src.replace(/(\/articles\/+[0-9]+\/+[0-9]+\/+photos\/+)[^/]+\/+/, "$1ORG/");
		}

		if (domain === "images.vrt.be") {
			// https://images.vrt.be/width960/2017/05/17/b8f23e71-3b2d-11e7-9eb3-02b7b76bf47f.jpg
			//   https://images.vrt.be/orig/2017/05/17/b8f23e71-3b2d-11e7-9eb3-02b7b76bf47f.jpg
			// https://images.vrt.be/w480hx_j80/2020/12/10/0ce770e7-3b0d-11eb-aae0-02b7b76bf47f.jpg
			//   https://images.vrt.be/orig/2020/12/10/0ce770e7-3b0d-11eb-aae0-02b7b76bf47f.jpg
			// https://images.vrt.be/VV_16x9_800/2021/06/30/946b9e3d-d9b9-11eb-b07d-02b7b76bf47f.jpg
			//   https://images.vrt.be/orig/2021/06/30/946b9e3d-d9b9-11eb-b07d-02b7b76bf47f.jpg
			// https://images.vrt.be/vrtnws_share/2021/06/02/fcc1cb48-c39e-11eb-b07d-02b7b76bf47f.jpg
			//   https://images.vrt.be/orig/2021/06/02/fcc1cb48-c39e-11eb-b07d-02b7b76bf47f.jpg
			return src.replace(/(:\/\/[^/]+\/+)[^/]+\/+([0-9]{4}\/+)/, "$1orig/$2");
		}

		if (domain_nowww === "gramerkagoj.com") {
			// http://gramerkagoj.com/2017/08/17/1502979436_th.jpg
			//   http://gramerkagoj.com/2017/08/17/1502979436.jpg
			return src.replace(/(\/[0-9]+)_th(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "img.bisnis.com") {
			// https://img.bisnis.com/thumb/posts/2017/02/27/632122/emma1sah.jpg?w=285&h=190
			//   https://img.bisnis.com/posts/2017/02/27/632122/emma1sah.jpg
			return src.replace(/\/thumb(\/+posts\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9]+\/+[^/?#]*).*?$/, "$1");
		}

		if (domain_nosub === "news18.com" && domain.match(/^images\./)) {
			// https://images.hindi.news18.com/ibnkhabar/uploads/300x200/jpg/2017/08/Emma-Stone-fobe.jpg
			//   https://images.hindi.news18.com/ibnkhabar/uploads/2017/08/Emma-Stone-fobe.jpg
			newsrc = src.replace(/(:\/\/[^/]*\/+[^/]*\/+)uploads\/+[0-9]+x[0-9]+\/+[^/]*\/+([0-9]{4}\/+[0-9]{2}\/+)/,
							   "$1uploads/$2");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nosub === "dainikbhaskar.com" &&
			domain.match(/^i[0-9]*\./)) {
			// https://i7.dainikbhaskar.com/thumbnails/280x242/web2images/divyamarathi.bhaskar.com/2017/08/18/55a674b1fff2c16856a6bd9e_.jpg
			//   https://i7.dainikbhaskar.com/web2images/divyamarathi.bhaskar.com/2017/08/18/55a674b1fff2c16856a6bd9e_.jpg
			return src.replace(/(:\/\/[^/]*\/)thumbnails\/+[0-9]+x[0-9]+\/+/, "$1");
		}

		if (domain_nowww === "baocantho.com.vn") {
			// https://baocantho.com.vn/image/news/2017/20170416/thumbnail/510x286/27971498134331_61.jpg
			//   https://baocantho.com.vn/image/news/2017/20170416/fckimage/27971498134331_61.jpg
			return src.replace(/(\/image\/+news\/+[0-9]{4}\/+[0-9]{8}\/+)thumbnail\/+[0-9]+x[0-9]+\/+/,
							   "$1fckimage/");
		}

		if (domain_nowww === "akhbarus.com") {
			// http://www.akhbarus.com/thumbnaile/crop/492/330/news/082017/emma-stone-.jpg
			//   http://www.akhbarus.com/uploads/files/news/082017/emma-stone-.jpg
			return src.replace(/\/thumbnaile\/+[a-z]+\/+[0-9]+\/+[0-9]+\/+news\/+/, "/uploads/files/news/");
		}

		if (domain === "cdn-stylehaus-jp.akamaized.net") {
			// https://cdn-stylehaus-jp.akamaized.net/articles/4878/4878_normal.jpg?1487573660
			//   https://cdn-stylehaus-jp.akamaized.net/articles/4878/4878_original.jpg?1487573660
			// https://cdn-stylehaus-jp.akamaized.net/article_parts/17581/17581_normal.jpg?1435902363
			//   https://cdn-stylehaus-jp.akamaized.net/article_parts/17581/17581_original.jpg?1435902363
			return src.replace(/(\/article(?:s|_[a-z]+)\/+[0-9]+\/+[0-9]+_)[a-z]+(\.[^/.]*)(?:[?#].*)?$/, "$1original$2");
		}

		if (domain_nowww === "primetime.ge") {
			// https://primetime.ge/uploads/news/08-2017/674bbb56495e33d06ba74fc4672c7d5b_thumb.jpg
			//   https://primetime.ge/uploads/news/08-2017/674bbb56495e33d06ba74fc4672c7d5b.jpg
			return src.replace(/(\/uploads\/+[^/]+\/+[0-9]{2}-[0-9]{4}\/+[0-9a-f]{10,})_thumb(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain_nosub === "bnt.bg" && domain.match(/^nws[0-9]*\./)) {
			// http://nws2.bnt.bg/p/e/m/emma-stone-458595-810x0.jpg
			//   http://nws2.bnt.bg/p/e/m/emma-stone-458595-original.jpg
			return src.replace(/-[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "-original$1");
		}

		if (domain === "storage.face.ba" ||
			// https://storage.bljesak.info/article/209214/1280x880/emma-stone-lijepa.jpg -- upscaled
			//   https://storage.bljesak.info/article/209214/original/emma-stone-lijepa.jpg
			domain === "storage.bljesak.info" ||
			// https://storage.radiosarajevo.ba/image/428118/1180x732/B1_Aquaman_BIH_final.jpg
			//   https://storage.radiosarajevo.ba/image/428118/original/B1_Aquaman_BIH_final.jpg
			domain === "storage.radiosarajevo.ba") {
			// https://storage.face.ba/article/4086/1200x628/B1_Aquaman_BIH_final.jpg
			//   https://storage.face.ba/article/4086/original/B1_Aquaman_BIH_final.jpg
			return {
				url: src.replace(/(\/(?:article|image)\/+[0-9]+\/+)[0-9]+x[0-9]+\/+/, "$1original/"),
				headers: {
					Referer: src
				}
			};
			//return src.replace(/(\/article\/+[0-9]+\/+)[0-9]+x[0-9]+\/+/, "$1original/");
		}

		if (domain === "ii.cdn.tf") {
			// https://ii.cdn.tf/u108724614/r455x502/18:e4movy.jpg
			//   https://ii.cdn.tf/u108724614/original/18:e4movy.jpg
			return src.replace(/\/r[0-9]+x[0-9]+\//, "/original/");
		}

		if (domain_nowww === "blaxup.in") {
			// http://blaxup.in/upload/img/2017/02/mv5bmtuzotgwnjg0ov5bml5banbnxkftztgwntgymta1nje_v1_sy1000_cr006651000_al__2017-02-14-12:18:11_W125_H125.jpg
			//   http://blaxup.in/upload/img/2017/02/mv5bmtuzotgwnjg0ov5bml5banbnxkftztgwntgymta1nje_v1_sy1000_cr006651000_al__2017-02-14-12:18:11.jpg
			return src.replace(/(\/upload\/+img\/+[0-9]{4}\/+[0-9]{2}\/+[^/]*)(?:_[WH][0-9]+){1,}(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain_nowww === "harryweb.net") {
			// http://www.harryweb.net/modules/Galleria_Foto/plupload/uploads/906/thumb_p185l1lje814a1171bhti15qp1npob.jpg
			//   http://www.harryweb.net/modules/Galleria_Foto/plupload/uploads/906/p185l1lje814a1171bhti15qp1npob.jpg
			return src.replace(/(\/plupload\/+uploads\/+[0-9]+\/+)[a-z]+_([0-9a-z]+\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain === "m.baishixi.com") {
			// https://m.baishixi.com/p/img1.doubanio.com/view/photo/photo/public/p2162294139.jpg
			//   http://img1.doubanio.com/view/photo/photo/public/p2162294139.jpg
			return add_http(src.replace(/^[a-z]+:\/\/[^/]*\/p\/+([^/]*\.[^/]*\/)/, "$1"));
		}

		if (amazon_container === "otw-ao3-icons") {
			// https://s3.amazonaws.com/otw-ao3-icons/icons/295809/standard.jpg?1400643434
			//   https://s3.amazonaws.com/otw-ao3-icons/icons/295809/original.jpg?1400643434
			return src.replace(/(\/icons\/+[0-9]+\/+)[a-z]+(\.[^/.]*)(?:[?#].*)?$/, "$1original$2");
		}

		if (domain === "media.outnow.ch") {
			// https://media.outnow.ch/Movies/Bilder/2016/EdgeOfSeventeen/015_small.jpg
			//   https://media.outnow.ch/Movies/Bilder/2016/EdgeOfSeventeen/015.jpg
			// https://media.outnow.ch/Movies/Bilder/2012/Spider-Man4/movie.p/11_small.jpg
			//   https://media.outnow.ch/Movies/Bilder/2012/Spider-Man4/movie.p/11.jpg
			return src.replace(/(\/Bilder\/+[0-9]{4}\/+[^/]*\/+(?:[^/]*\/+)?[0-9]+)_[a-z]+(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain === "pics.kinokadr.ru") {
			// http://pics.kinokadr.ru/films/e/edgeofseventeen/gallery/thumb/07.jpg
			//   http://pics.kinokadr.ru/films/e/edgeofseventeen/gallery/07.jpg
			return src.replace(/\/gallery\/+thumb\/+([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/gallery/$1");
		}

		if (domain_nosub === "creativecirclemedia.com" && domain.match(/^cdn[0-9]*\./)) {
			// http://cdn1.creativecirclemedia.com/citypulse/thumbnail/20190324-142445-11426.jpg
			//   http://cdn1.creativecirclemedia.com/citypulse/original/20190324-142445-11426.jpg
			return src.replace(/\/[a-z]+\/+([0-9]{8}-[0-9]+-[0-9]+\.[^/.]*)(?:[?#].*)?$/,
							   "/original/$1");
		}

		if (domain_nowww === "middleburgfilm.org") {
			// https://middleburgfilm.org/img/upload/thumbnail/edge.jpg
			//   https://middleburgfilm.org/img/upload/original/edge.jpg
			return src.replace(/\/img\/+upload\/+[a-z]+\/+/, "/img/upload/original/");
		}

		if (domain_nowww === "gonet.cz") {
			// http://gonet.cz/~tri65dnigalerie/porad/250/e/e2f1e023b9b9838d1c602a7894e0e2ac.jpg
			//   http://gonet.cz/~tri65dnigalerie/porad/full/e/e2f1e023b9b9838d1c602a7894e0e2ac.jpg
			// http://gonet.cz/~tri65dnigalerie/osoba/250/d/d0c9bfc0283dd0a1d810d09d7ebd719c.jpg
			//   http://gonet.cz/~tri65dnigalerie/osoba/full/d/d0c9bfc0283dd0a1d810d09d7ebd719c.jpg
			return src.replace(/\/[0-9]+(\/+[0-9a-f]\/+[0-9a-f]{10,}\.[^/.]*)(?:[?#].*)?$/,
							   "/full$1");
		}

		if (domain === "media.port.hu") {
			// https://media.port.hu/images/000/965/254x170/434.jpg
			//   https://media.port.hu/images/000/965/434.jpg
			return src.replace(/(\/images\/+(?:[0-9]{3}\/+){2})[0-9]+x[0-9]+\/+/, "$1");
		}

		if (domain_nowww === "edb.co.il") {
			// https://www.edb.co.il/photos/139762016_publicity03.wdm.jpg
			//   https://www.edb.co.il/photos/139762016_publicity03.jpg
			//   https://www.edb.co.il/photos/139762016_publicity03.full.jpg
			return src.replace(/(\/photos\/+[0-9]+(?:_[^/.]*?)?)(?:\.[^/.]*)?(\.[^/.]*)(?:[?#].*)?$/,
							   "$1.full$2");
		}

		if (domain_nowww === "silenzioinsala.com" ||
			// http://olharalerta.com.br/class/phpThumb/phpThumb.php?src=http://img.youtube.com/vi/BQ0mxQXmLsk/0.jpg&w=343&h=192&zc=1
			//   https://img.youtube.com/vi/BQ0mxQXmLsk/maxresdefault.jpg
			domain_nowww === "olharalerta.com.br" ||
			// https://wikiquicky.com/backup/phpThumb/phpThumb.php?src=/uploads/singer/Yolandi%20Visser.jpg&w=500&h=500&iar=1
			//   https://wikiquicky.com/uploads/singer/Yolandi%20Visser.jpg
			domain_nowww === "wikiquicky.com" ||
			// http://dmbtattoo.com/modules/phpThumb/phpThumb.php?src=/images/tattoos/Sara%20(2).JPG&w=225&fltr[]=wmi|/images/watermark.png|BR|100
			//   http://dmbtattoo.com/images/tattoos/Sara%20(2).JPG
			domain_nowww === "dmbtattoo.com" ||
			// thanks to pointydev on github: https://github.com/qsniyg/maxurl/issues/1119
			// https://www.liveatc.net/phpthumb/phpThumb.php?src=/wx_radar/RAX/RAX-Feb-13-2023-0000Z-radar.png&w=75
			//   https://www.liveatc.net/wx_radar/RAX/RAX-Feb-13-2023-0000Z-radar.png
			domain_nowww === "liveatc.net" ||
			// https://joinsmediacanada.com/plugin/phpThumb/phpThumb.php?src=http%3A%2F%2Fimage.newsis.com%2F2015%2F09%2F23%2FNISI20150923_0005935978_web.jpg&w=130&h=110&zc=1&hash=d6c980fa0aa014e6aa91199b3805b778
			//   http://image.newsis.com/2015/09/23/NISI20150923_0005935978_web.jpg
			domain_nowww === "joinsmediacanada.com") {
			// https://www.silenzioinsala.com/thumbs/phpThumb.php?src=..%2Fphotos%2F3951%2F3951_1.jpeg&w=500&hash=d203ab10298197885dad3ebc08e1418e
			//   https://www.silenzioinsala.com/photos/3951/3951_1.jpeg
			newsrc = src.replace(/.*\/+phpThumb\.php\?(?:.*?&)?src=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return urljoin(src.replace(/\/+phpThumb\.php.*/, "/"), decodeURIComponent(newsrc), true);
		}

		if (domain === "img.fdb.cz") {
			// https://img.fdb.cz/galerie_ms/0/09db4d44a951aa56dedf607d7e31400.jpg
			//   https://img.fdb.cz/galerie/0/09db4d44a951aa56dedf607d7e31400.jpg
			// https://img.fdb.cz/obrazky_mb/0/0e40d65b8ae47113aadca96a5d.jpg
			//   https://img.fdb.cz/obrazky/0e40d65b8ae47113aadca96a5d.jpg -- downscaled?
			// https://img.fdb.cz/obrazky_ikony/9d4d22e3d8a0ab673a3ba0150d2bb3ec.jpg
			//   https://img.fdb.cz/obrazky/9d4d22e3d8a0ab673a3ba0150d2bb3ec.jpg
			return src
				.replace(/(\/galerie)_[a-z]+(\/+[0-9a-f]\/+[0-9a-f]{10,}\.[^/.]*)(?:[?#].*)?$/, "$1$2")
				//.replace(/(\/obrazky)_mb\/+[0-9a-f](\/+[0-9a-f]{10,}\.[^/.]*)(?:[?#].*)?$/, "$1$2")
				.replace(/(\/obrazky)_ikony(\/+[0-9a-f]{10,}\.[^/.]*)(?:[?#].*)?$/, "$1$2")
		}

		if ((domain_nosub === "wuaki.tv" ||
			 // thanks to anonymous for reporting:
			 // https://images-0.rakuten.tv/storage/snapshot/shot/7fb02775-540a-4392-8ab2-1a8f2450c8c7-snapshot-1590674105-width308-quality60.jpeg
			 //   https://images-0.rakuten.tv/storage/snapshot/shot/7fb02775-540a-4392-8ab2-1a8f2450c8c7-snapshot-1590674105.jpeg
			 domain_nosub === "rakuten.tv") &&
			/^images(?:-[0-9]*)\./.test(domain)) {
			// https://images-3.wuaki.tv/system/shots/75511/original/the-edge-of-seventeen-1488970948-height315-width600-quality80.jpeg
			//   https://images-3.wuaki.tv/system/shots/75511/original/the-edge-of-seventeen-1488970948.jpeg
			// https://images-1.wuaki.tv/system/photos/140774/original/teddy-chan-1525318724-width170-quality50.jpeg
			return {
				url: src.replace(/(?:-(?:width|height|quality)[0-9]+){1,}(\.[^/.]*)(?:[?#].*)?$/, "$1"),
				can_head: false // 415
			}
		}

		if (domain_nosub === "bebee.com" && domain.match(/^std[0-9]*\./)) {
			// https://std1.bebee.com/br/pb/47808/b821b869/900
			//   https://std1.bebee.com/bg/pb/47808/b821b869 -- 1280x1707
			// https://std1.bebee.com/bg/pb/68/d1fe173d -- 2592x1936
			return src.replace(/\/br(\/+pb\/+[0-9]+\/+[0-9a-f]+)\/+[0-9]+(?:[?#].*)?$/,
							   "/bg$1");
		}

		if (domain_nowww === "mosaically.com") {
			// https://mosaically.com/~/002/photo/600/2018/10/1/15/d1c561a8-05d2-4062-8ab4-53d19817c209.jpg
			//   https://mosaically.com/~/002/photo/full/2018/10/1/15/d1c561a8-05d2-4062-8ab4-53d19817c209.jpg
			return src.replace(/\/photo\/+[0-9]+\/+([0-9]{4}\/+)/, "/photo/full/$1");
		}

		if (domain === "img.ecartelera.com") {
			// https://img.ecartelera.com/noticias/39700/39776-q1.jpg
			//   https://img.ecartelera.com/noticias/39700/39776-m.jpg -- 1600x1600
			// https://img.ecartelera.com/noticias/52700/52754-m.jpg -- 2844x1992
			return src.replace(/(\/[0-9]+)(?:-[a-z0-9]+)?(\.[^/.]*)(?:[?#].*)?$/, "$1-m$2");
		}

		if (domain === "cdn.releases.com") {
			// https://cdn.releases.com/img/postattachments/404685/350
			//   https://cdn.releases.com/img/postattachments/404685 -- 1920x1080
			return src.replace(/(\/img\/+postattachments\/+[0-9]+)\/+[0-9]+(?:[?#].*)?$/, "$1");
		}

		if (domain_nowww === "4words.ru") {
			// http://www.4words.ru/photos/vanessahudgens/gallery/thumbs/260/www.4words.ru_vanessahudgens_7435.jpg
			//   http://www.4words.ru/photos/vanessahudgens/gallery/www.4words.ru_vanessahudgens_7435.jpg
			return src.replace(/\/gallery\/+thumbs\/+[0-9]+\/+/, "/gallery/");
		}

		if (domain_nosub === "myheimat.de" && domain.match(/^media[0-9]*\./)) {
			// https://media05.myheimat.de/2018/04/05/4298149_preview.jpg?1522938893
			//   https://media05.myheimat.de/2018/04/05/4298149_web.jpg?1522938893
			//   https://media05.myheimat.de/2018/04/05/4298149_orig.jpg?1522938893
			return src.replace(/(\/[0-9]+)_[a-z]+(\.[^/.]*)(?:[?#].*)?$/, "$1_orig$2");
		}

		if (domain_nowww === "cumonprintedpics.com") {
			// https://www.cumonprintedpics.com/download/file.php?id=5094843&t=1
			//   https://www.cumonprintedpics.com/download/file.php?id=5094843
			return src.replace(/\/download\/+file\.php.*?[?&](id=[0-9]+).*?$/, "/download/file.php?$1");
		}

		if (domain === "aws.revistavanityfair.es" ||
			// thanks to Regis on discord
			// https://aws.glamour.es/prod/designs/v1/assets/620x829/724035.jpg
			//   https://aws.glamour.es/prod/designs/v1/assets/original/724035.jpg
			domain === "aws.glamour.es" ||
			// https://aws.glamour.mx/prod/designs/v1/assets/666x1000/43238.jpg
			//   https://aws.glamour.mx/prod/designs/v1/assets/original/43238.jpg
			domain === "aws.glamour.mx") {
			// https://aws.revistavanityfair.es/prod/designs/v1/assets/290x240/156016.jpg
			//   https://aws.revistavanityfair.es/prod/designs/v1/assets/original/156016.jpg
			return src.replace(/\/assets\/+[0-9]+x[0-9]+\/+/, "/assets/original/");
		}

		if (domain === "sticker.bahuma.org") {
			// https://sticker.bahuma.org/thumbnail/300/gallery/ANd9GcQySBQGqiBS166RxjUU-A0iWQbDbGhpoH6rhGtu9g7O3bz4vfAA:https://media.beritagar.id/2016-02/0_0_1366_766_7f82ecf612cea2ca2d6530b296a295cfa9ffc7ee.jpg.jpg
			//   https://media.beritagar.id/2016-02/0_0_1366_766_7f82ecf612cea2ca2d6530b296a295cfa9ffc7ee.jpg
			return src.replace(/^[a-z]+:\/\/[^/]*\/thumbnail\/+[0-9]+\/+gallery\/+[-A-Za-z0-9]+:(https?:\/\/.*?)\.[^/.]*?$/,
							   "$1");
		}

		if (domain_nowww === "quizizz.com") {
			// https://quizizz.com/_media/quizzes/7ba7f6b8-81fe-427a-b455-eb5fabc60880_90_90
			//   https://quizizz.com/_media/quizzes/7ba7f6b8-81fe-427a-b455-eb5fabc60880
			return src.replace(/(\/_media\/+[^/]*\/+[-0-9a-f]+)_[0-9]+_[0-9]+(?:[?#].*)?$/, "$1");
		}

		if (domain === "news.cube-soft.jp") {
			// https://news.cube-soft.jp/prtimes/thumb/98163.jpg
			//   https://news.cube-soft.jp/prtimes/image/98163_0.jpg
			// https://news.cube-soft.jp/thumb/JI2019060500094.jpg
			//   https://news.cube-soft.jp/image/JI2019060500094.jpg
			return src
				.replace(/\/thumb\/+([0-9]+)(\.[^/.]*)(?:[?#].*)?$/, "/image/$1_0$2")
				.replace(/\/thumb\/+(JI[0-9]{10,}\.[^/.]*)(?:[?#].*)?$/, "/image/$1");
		}

		if (domain_nowww === "boutreview.com") {
			// http://www.boutreview.com/2/media/thumbnail/knockout_160912knockout-aoyama.jpg
			//   http://www.boutreview.com/2/media/knockout/160912knockout-aoyama.jpg
			return src.replace(/\/media\/+thumbnail\/+([a-z]+)_([0-9]{6})/, "/media/$1/$2");
		}

		if (domain_nowww === "bg.gg" ||
			// https://bgm.gg/i/fc5c360/resize_more -- 640x618
			//   https://bgm.gg/i/fc5c360 -- 640x618
			// https://bgm.gg/i/634c34b/resize -- 900x869
			//   https://bgm.gg/i/634c34b -- 1280x1236
			domain_nowww === "bgm.gg") {
			//https://bg.gg/i/0d505c1
			return {
				url: src.replace(/(:\/\/[^/]*\/i\/[0-9a-f]+)\/+resize(?:_[a-z]+)?(?:[?#].*)?$/, "$1"),
				headers: {
					Referer: "https://te31.com/bggg.php"
				}
			};
		}

		if (domain === "my.evilmilk.com") {
			// https://my.evilmilk.com/p/q/o/tz-qog36_t1.jpg
			//   https://my.evilmilk.com/p/tz-qog36_t3.jpg
			//   https://my.evilmilk.com/p/q/o/tz-qog36.jpg
			return src.replace(/(:\/\/[^/]*\/p)\/+.\/+.\/+([^/]*)_t[0-9]*(\.[^/.]*)(?:[?#].*)?$/,
							   "$1/$2$3");
		}

		if (domain_nowww === "bonnassesworld.com") {
			// http://www.bonnassesworld.com:8080/gals/99/29952/big_2.jpg
			//   http://www.bonnassesworld.com:8080/gals/99/29952/full_2.jpg
			return src.replace(/\/[a-z]+_([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/full_$1");
		}

		if (domain === "img.oppaisan.com" ||
			// http://megamich.com/lib/thumb300.php?p=L2hvbWUvb2ZsZXg5ODkxL3B1YmxpY19odG1sL19tZWdhbWkvd3AtY29udGVudC91cGxvYWRzL2ltZy9nZWlub3VfMjAxNzA4MDkvMjcuanBn&w=300&r=
			//   http://megamich.com/lib/thumb300.php?p=L2hvbWUvb2ZsZXg5ODkxL3B1YmxpY19odG1sL19tZWdhbWkvd3AtY29udGVudC91cGxvYWRzL2ltZy9nZWlub3VfMjAxNzA4MDkvMjcuanBn&w=-1
			//   http://megamich.com/wp-content/uploads/img/geinou_20170809/27.jpg
			// http://megamich.com/lib/bbs_thumb300.php?p=L2hvbWUvb2ZsZXg5ODkxL3B1YmxpY19odG1sL19tZWdhbWkvd3AtY29udGVudC91cGxvYWRzL2ltZy9nZWlub3VfMjAxNzA4MDkvMjcuanBn&w=300&r=
			//   http://megamich.com/lib/bbs_thumb300.php?p=L2hvbWUvb2ZsZXg5ODkxL3B1YmxpY19odG1sL19tZWdhbWkvd3AtY29udGVudC91cGxvYWRzL2ltZy9nZWlub3VfMjAxNzA4MDkvMjcuanBn&w=-1
			//   http://megamich.com/wp-content/uploads/img/geinou_20170809/27.jpg
			domain_nowww === "megamich.com" ||
			// http://img0.fightingirl.com/panchira/lib/thumb2.php?p=L2hvbWUvbGkxNTgyMTYyL3B1YmxpY19odG1sL19maWdodGluZ2lybC9wYW5jaGlyYS8vaW1nL3RhbGVudC9rLXBvcDAxLzAzOC5qcGc=&w=830&q=80
			//   atob: /home/li1582162/public_html/_fightingirl/panchira//img/talent/k-pop01/038.jpg
			//   http://img0.fightingirl.com/panchira//img/talent/k-pop01/038.jpg
			(domain_nosub === "fightingirl.com" && /^img[0-9]*\./.test(domain))) {
			// http://img.oppaisan.com/lib/thumb2.php?p=L2hvbWUvb2ZsZXg5NTMxL3B1YmxpY19odG1sL19vcHBhaTMvaW1nL2VudHJ5X2ltYWdlcy8yMDE5MDUwNi8wMDYuanBn
			//   http://img.oppaisan.com/lib/thumb2.php?p=L2hvbWUvb2ZsZXg5NTMxL3B1YmxpY19odG1sL19vcHBhaTMvaW1nL2VudHJ5X2ltYWdlcy8yMDE5MDUwNi8wMDYuanBn&w=-1
			newsrc = src.replace(/(\/lib\/+(?:bbs_)?thumb[0-9]+\.php).*?[?&](p=[^&]*).*?$/, "$1?$2&w=-1");
			if (newsrc !== src)
				return newsrc;

			match = src.match(/^[a-z]+:\/\/[^/]*\/+(?:[^/]+\/+)?lib\/+(?:bbs_)?thumb[0-9]+\.php\?(?:.*&)?p=([^&]+)/);
			if (match) {
				var path = base64_decode(match[1]);
				//console_log(path);
				var newpath = path.replace(/.*\/public_html\/+_[^/]+\/+/, "/");
				if (newpath !== path) {
					return urljoin(src, newpath, true);
				}
			}
		}

		if (domain_nowww === "517japan.com") {
			// https://www.517japan.com/rimg_800x800/attachments/uploads/temp/img/201701/15/4cb4d6e79246555f3dfe618fce3472dc.jpg
			//   https://www.517japan.com/attachments/uploads/temp/img/201701/15/4cb4d6e79246555f3dfe618fce3472dc.jpg
			return src.replace(/\/rimg_[0-9]+x[0-9]+\/+attachments\/+/, "/attachments/");
		}

		if (domain === "mpic.haiwainet.cn") {
			// http://mpic.haiwainet.cn/thumb/d/uploadfile/2016/0613/20160613092727197,w_480.jpg
			//   http://images.haiwainet.cn/2016/0613/20160613092727197.jpg
			// http://mpic.haiwainet.cn/thumb/d/uploadfile/20160715/1468549973612979,w_600.jpg
			//   http://images.haiwainet.cn/20160715/1468549973612979.jpg
			newsrc = src.replace(/:\/\/[^/]*\/thumb\/+.\/+uploadfile\/+([0-9]{4}\/*[0-9]{4}\/+[0-9]+)(?:,[wh]_[0-9]+)?(\.[^/.]*)(?:[?#].*)?$/,
								 "://images.haiwainet.cn/$1$2");
			return {
				url: newsrc,
				headers: {
					Referer: "http://m.haiwainet.cn/"
				}
			};
		}

		if (domain === "images.haiwainet.cn") {
			return {
				url: src,
				headers: {
					Referer: "http://news.haiwainet.cn/"
				}
			};
		}

		if (domain_nowww === "fotostate.ru") {
			// http://fotostate.ru/redirect.php?url=http://40.media.tumblr.com/4281a67277889603824a0fbf68c666e9/tumblr_ntq84aLxqg1rcilafo1_500.jpg
			//   http://66.media.tumblr.com/bc72760531744b44ae4f8ca67e8aff5f/tumblr_nwd11zNV3z1rcilafo1_500.jpg
			return src.replace(/^[a-z]+:\/\/[^/]*\/redirect\.php.*?[?&]url=(https?:\/\/[^&]*).*?$/, "$1");
		}

		if (domain === "static.apple.nextmedia.com") {
			// http://static.apple.nextmedia.com/images/e-paper/20170312/small/1489310572_9b2c.jpg
			//   http://static.apple.nextmedia.com/images/e-paper/20170312/large/1489310572_9b2c.jpg
			return src.replace(/(\/[0-9]{8}\/+)small\/+/, "$1large/");
		}

		if (domain_nowww === "share-ero.pics" ||
			// http://45.33.110.172/uploads/feed_image/image/22896/middle_resize_20160206191925.jpg
			//   http://45.33.110.172/uploads/feed_image/image/22896/20160206191925.jpg
			domain === "45.33.110.172" ||
			// http://panchira-news.net/uploads/feed_image/image/0/6629/middle_resize_0.jpg
			//   http://panchira-news.net/uploads/feed_image/image/0/6629/0.jpg
			domain_nowww === "panchira-news.net" ||
			// http://idol-gazoum.net/uploads/feed_image/image/9/90978/middle_resize_0.jpg
			//   http://idol-gazoum.net/uploads/feed_image/image/9/90978/0.jpg
			// http://idol-gazoum.net/uploads/feed_image/image/13/138755/middle_thumb_0.jpg
			//   http://idol-gazoum.net/uploads/feed_image/image/13/138755/0.jpg
			domain_nowww === "idol-gazoum.net") {
			// http://share-ero.pics/uploads/feed_image/image/47696/middle_resize_20181009094007.jpg -- 682x1024
			//   http://share-ero.pics/uploads/feed_image/image/47696/20181009094007.jpg -- 533x800
			return src.replace(/(\/uploads\/+[^/]*\/+image\/+(?:[0-9]+\/+)?[0-9]+\/+)[a-z]+_(?:resize|thumb)_/, "$1");
		}

		if (domain === "att2.citysbs.com") {
			// https://att2.citysbs.com/hangzhou/image1/2009/10/14-14/middle_20091014_651d44a09685101f05daUSv9Jj4UHszm.jpg
			//   https://att2.citysbs.com/hangzhou/image1/2009/10/14-14/20091014_651d44a09685101f05daUSv9Jj4UHszm.jpg
			// doesn't work for all:
			// https://www.19lou.com/forum-269-thread-7361569945484782-1-1.html
			//   https://att2.citysbs.com/hangzhou/2019/10/01/23/1024x1365-235802_v2_14711569945482146_6175ff5e712a4f3cbdeedb86df193c33.jpg
			//   https://att2.citysbs.com/hangzhou/2019/10/01/23/middle_1024x1365-235802_v2_14711569945482146_6175ff5e712a4f3cbdeedb86df193c33.jpg
			//   https://att3.citysbs.com/no/hangzhou/2019/10/01/23/1024x1365-235802_v2_14711569945482146_6175ff5e712a4f3cbdeedb86df193c33.jpg
			// http://att2.citysbs.com/hangzhou/2016/01/14/10/1306x2000-104217_v2_10931452739337531_907e8e8c06012c8adf42433004fc4f31.jpg
			return src.replace(/(\/image[0-9]*\/+[0-9]{4}\/+[0-9]{2}\/+[0-9]+-[0-9]+\/+)[a-z]+_([0-9]{8}_[0-9a-f]+[^/]*\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain === "d2l930y2yx77uc.cloudfront.net" ||
			// https://assets.st-note.com/production/uploads/images/17105324/square_middle_c647f6629bcfe2638e23924d96a7aae4.jpeg?fit=bounds&format=jpeg&quality=45&width=112
			//   https://assets.st-note.com/production/uploads/images/17105324/c647f6629bcfe2638e23924d96a7aae4.jpeg
			// thanks to anonymous for reporting:
			// https://assets.st-note.com/img/1678341336397-q0BVE8cBbf.png?width=200
			//   https://assets.st-note.com/img/1678341336397-q0BVE8cBbf.png
			domain === "assets.st-note.com") {
			// https://d2l930y2yx77uc.cloudfront.net/production/uploads/images/12067956/rectangle_large_type_2_8200ef2a10803a7a1e459aa2e826ab45.jpeg
			//   https://d2l930y2yx77uc.cloudfront.net/production/uploads/images/12067956/8200ef2a10803a7a1e459aa2e826ab45.jpeg
			// https://d2l930y2yx77uc.cloudfront.net/production/uploads/images/10285540/square_large_c3b393df5a71c337870778e4b7105cba.jpeg
			//   https://d2l930y2yx77uc.cloudfront.net/production/uploads/images/10285540/c3b393df5a71c337870778e4b7105cba.jpeg
			// https://d2l930y2yx77uc.cloudfront.net/production/uploads/images/7977673/profile_12649c6c2ef3d25897e5411185c287e3.jpg
			//   https://d2l930y2yx77uc.cloudfront.net/production/uploads/images/7977673/12649c6c2ef3d25897e5411185c287e3.jpg
			// https://d2l930y2yx77uc.cloudfront.net/production/uploads/images/7977672/wallpaper_landscape_4a29f6eba780ba8d288688a8bcbf3e2d.jpg
			//   https://d2l930y2yx77uc.cloudfront.net/production/uploads/images/7977672/4a29f6eba780ba8d288688a8bcbf3e2d.jpg
			return src
				.replace(/(:\/\/[^/]+\/+img\/+[0-9]+-[0-9a-zA-Z]+\.[a-z]+)(?:[?#].*)?$/, "$1")
				.replace(/(\/production\/+uploads\/+images\/+[0-9]+\/+)(?:[^/]*_)?([0-9a-f]+\.[^/.]*?)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "d1jo5b1m9v3ic.cloudfront.net") {
			// https://d1jo5b1m9v3ic.cloudfront.net/item/i716887/s823093fa7c4de9e39821d164c74c864b354c590-small.jpg
			//   https://d1jo5b1m9v3ic.cloudfront.net/item/i716887/s823093fa7c4de9e39821d164c74c864b354c590-large.jpg
			// https://d1jo5b1m9v3ic.cloudfront.net/poster/profile/p6507/d4b5f54dd4a2da05bfc469450ef8655f-small.jpg
			//   https://d1jo5b1m9v3ic.cloudfront.net/poster/profile/p6507/d4b5f54dd4a2da05bfc469450ef8655f-large.jpg
			// https://d1jo5b1m9v3ic.cloudfront.net/poster/profile/p6507/905a31e4aced3c442cac20c1e634e910-small.jpg
			//   https://d1jo5b1m9v3ic.cloudfront.net/poster/profile/p6507/905a31e4aced3c442cac20c1e634e910-large.jpg
			return src.replace(/(\/(?:item|profile)\/+[a-z][0-9]+\/+[a-z]?[0-9a-f]+)-[a-z]+(\.[^/.]*)(?:[?#].*)?$/, "$1-large$2");
		}

		if (domain === "oshiete.xgoo.jp") {
			// https://oshiete.xgoo.jp/_/bucket/oshietegoo/images/media/9/542213008_5c531c35e7af1/M.jpg
			//   https://oshiete.xgoo.jp/_/bucket/oshietegoo/images/media/9/542213008_5c531c35e7af1/ORG.jpg
			// https://oshiete.xgoo.jp/_/en/bucket/channel/images/article_main/2/10_58e1b5cf2d41e/L.jpg
			//   https://oshiete.xgoo.jp/_/en/bucket/channel/images/article_main/2/10_58e1b5cf2d41e/ORG.jpg
			// https://oshiete.xgoo.jp/_/en/bucket/channel/images/article_main/f/27_59433159715a5/L.jpg
			//   https://oshiete.xgoo.jp/_/en/bucket/channel/images/article_main/f/27_59433159715a5/ORG.jpg
			return src.replace(/(\/images\/+[^/]*\/+[0-9a-z]+\/+[0-9]+_[0-9a-f]+\/+)[A-Z]+(\.[^/.]*)(?:[?#].*)?$/,
							   "$1ORG$2");
		}

		if (domain === "p.mamastar.jp") {
			// http://p.mamastar.jp/s/2017-10/0/44cc9ecc0d44e129.jpg
			//   http://p.mamastar.jp/l/2017-10/0/44cc9ecc0d44e129.jpg
			//   http://p.mamastar.jp/2017-10/0/44cc9ecc0d44e129.jpg
			return src.replace(/(:\/\/[^/]*\/)[a-z]\/+([0-9]{4}-[0-9]{2}\/+)/, "$1$2");
		}

		if (domain === "image.gamechosun.co.kr") {
			// http://image.gamechosun.co.kr/wlwl_upload/dataroom/df/2016/09/28/thumb/315646_1475052903.jpg
			//   http://image.gamechosun.co.kr/wlwl_upload/dataroom/df/2016/09/28/315646_1475052903.jpg
			return src.replace(/(\/dataroom\/+[^/]*\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2})thumb\/+/, "$1");
		}

		if (domain_nowww === "ascii.jp") {
			// https://ascii.jp/elem/000/001/759/1759567/P1230135_800x1200_200x.jpg
			//   https://ascii.jp/elem/000/001/759/1759567/P1230135_800x1200.jpg
			// thanks to fireattack: https://github.com/qsniyg/maxurl/issues/1159
			// https://ascii.jp/img/2023/03/27/3512959/l/c597df955151a770.jpg
			//   https://ascii.jp/img/2023/03/27/3512959/o/c597df955151a770.jpg
			return src
				.replace(/(\/img\/.*\/)[a-z]\/+([0-9a-f]+\.)/, "$1o/$2")
				.replace(/(_[0-9]+x[0-9]+)_[0-9]+x(?:[0-9]+)?(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "yscore.co.kr" ||
			// https://data.bepick.net/bbs/2019/01/thumb/6b9ff636e343133861c2500047197714_331173936.jpg
			//   https://data.bepick.net/bbs/2019/01/6b9ff636e343133861c2500047197714_331173936.jpg
			domain === "data.bepick.net") {
			// https://yscore.co.kr/data/bbs/2019/04/thumb/ce86391f5167ddd073190ab5c07a40e9_2113126834.png
			//   https://yscore.co.kr/data/bbs/2019/04/ce86391f5167ddd073190ab5c07a40e9_2113126834.png
			return src.replace(/(\/bbs\/+[0-9]{4}\/+[0-9]{2}\/+)thumb\/+/, "$1");
		}

		if (domain === "img.tf.co.kr") {
			// http://img.tf.co.kr/article/home/2012/12/04/thumb/121204_50bd5845b00c7_200.jpg
			//   http://img.tf.co.kr/article/home/2012/12/04/121204_50bd5845b00c7.jpg
			// http://img.tf.co.kr/article/home/2016/07/06/thumb/201626111467762709_200.jpg
			//   http://img.tf.co.kr/article/home/2016/07/06/201626111467762709.jpg
			return src.replace(/\/thumb(\/+(?:[0-9]+_)?[0-9a-f]{5,})_[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "my.cdn.tokyo-hot.com") {
			// https://my.cdn.tokyo-hot.com/media/5303/scap/001/150x150_default.jpg
			//   https://my.cdn.tokyo-hot.com/media/5303/scap/001.jpg
			// https://my.cdn.tokyo-hot.com/media/RED-165/scap/001.origi/150x150_default.jpg
			//   https://my.cdn.tokyo-hot.com/media/RED-165/scap/001.origi.jpg
			return src
				.replace(/(\/media\/+(?:[-0-9a-z]+|[A-Z]+-[0-9]+)\/+(?:[sv]cap|list_image)\/+[^/]*)\/+[^/]*(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "tvdeav.com") {
			// http://tvdeav.com/media/banner/top/20160427111940/700x467_default.jpg
			//   http://tvdeav.com/media/banner/top/20160427111940.jpg
			// http://tvdeav.com/media/product/11120/scap/002.fixed/150x150_default.jpg
			//   http://tvdeav.com/media/product/11120/scap/002.fixed.jpg
			//   http://tvdeav.com/media/product/11120/scap/002.origi.jpg
			// http://tvdeav.com/media/product/n1343/list_image/_v/120x180_default.jpg
			//   http://tvdeav.com/media/product/n1343/list_image/_v.jpg
			// http://tvdeav.com/media/product/SKY-065/scap/SKY-065_00/150x150_default.jpg
			//   http://tvdeav.com/media/product/SKY-065/scap/SKY-065_00.jpg
			return src
				.replace(/(\/media\/+banner\/+top\/+[0-9]{10,})\/+[^/]*(\.[^/.]*)(?:[?#].*)?$/, "$1$2")
				.replace(/(\/media\/+product\/+(?:[a-z]?[0-9]+|[A-Z]+-[0-9]+)\/+(?:[sv]cap|list_image)\/+[^/]*)\/+[^/]*(\.[^/.]*)(?:[?#].*)?$/, "$1$2")
				.replace(/(\/media\/+product\/+[a-z]?[0-9]+\/+[sv]cap\/+[0-9]+\.)[a-z]+(\.[^/.]*)(?:[?#].*)?$/, "$1origi$2");
		}

		if (domain_nosub === "bakusai.com" && domain.match(/^img[0-9]*\./)) {
			// https://img2.bakusai.com/m/imagebbs/_nosync/271/938/11203739/240.jpeg
			//   https://img2.bakusai.com/m/imagebbs/_nosync/271/938/11203739/org.jpeg
			return src.replace(/(\/imagebbs\/+_nosync\/+[0-9]+\/+[0-9]+\/+[0-9]+\/+)[0-9]+(\.[^/.]*)(?:[?#].*)?$/,
							   "$1org$2");
		}

		if (domain === "storage.oxii.vn") {
			// https://storage.oxii.vn/Cache/Sites/OXII/Storage/Images/2019/6/4/728x436/yamaha-r15-v3-dan-dau-h2.jpg
			//   https://storage.oxii.vn/Sites/OXII/Storage/Images/2019/6/4/yamaha-r15-v3-dan-dau-h2.jpg -- upscaled?
			// https://storage.oxii.vn/thumbnail/OXII-128-2019-2-28/emi-harukaze-hot-idol-noi-dinh-dam-du-moi-20-tuoi-anh-6.jpg
			//   https://storage.oxii.vn/Sites/OXII/Storage/Images/2019/2/28/emi-harukaze-hot-idol-noi-dinh-dam-du-moi-20-tuoi-anh-6.jpg
			// https://storage.oxii.vn/thumbnail/OXII-728-436-2019-2-10/vn-15c2ace07b8e99a219ca5275t0966f4f7_4868_2921_22.jpg
			//   https://storage.oxii.vn/Sites/OXII/Storage/Images/2019/2/10/vn-15c2ace07b8e99a219ca5275t0966f4f7_4868_2921_22.jpg
			return src
				.replace(/\/Cache\/+(Sites\/+.*?\/)[0-9]+x[0-9]+\/+/, "/$1")
				.replace(/\/thumbnail\/([^-/]+)-[0-9]+(?:-[0-9]+)?-([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})\/+/,
						 "/Sites/$1/Storage/Images/$2/$3/$4/");
		}

		if (domain_nowww === "edna.cz") {
			// https://www.edna.cz/runtime/cache/images/listImages/series/game-of-thrones/14-659045c954b519c6e66d4805d42d23a3.jpg
			//   https://www.edna.cz/runtime/userfiles/series/game-of-thrones/14-659045c954b519c6e66d4805d42d23a3.jpg
			return src.replace(/\/runtime\/+cache\/+images\/+[^/]*\/+/, "/runtime/userfiles/");
		}

		if (domain_nowww === "dramaqueen.com.tw") {
			// https://www.dramaqueen.com.tw/images/news/small/2019052115121876125daaa43e37d0c3c45d31a4f47fa44d48.jpg
			//   https://www.dramaqueen.com.tw/images/news/2019052115121876125daaa43e37d0c3c45d31a4f47fa44d48.jpg
			return src.replace(/\/images\/+news\/+[a-z]+\/+/, "/images/news/");
		}

		if (domain_nowww === "smobserved.com") {
			// https://www.smobserved.com/home/cms_data/dfault/photos/stories/id/7/1/3971/.TEMP/s_topTEMP425x425-7946.jpeg
			//   https://www.smobserved.com/home/cms_data/dfault/photos/stories/id/7/1/3971/s_top
			return src.replace(/\/\.TEMP\/+([^/]*?)TEMP[0-9]+x[0-9]+-[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "/$1");
		}

		if (domain_nowww === "naftemporiki.gr" ||
			// http://ctrl.naftemporiki.gr/fu/t/1484356/180/999/0x0000000001647205/2/riana-i-plousioteri-tragoudistria-ston-kosmo.jpg
			//   https://www.naftemporiki.gr/fu/p/1484356/original/original/0x0000000001647205/2/riana-i-plousioteri-tragoudistria-ston-kosmo.jpg -- doesn't work
			domain === "ctrl.naftemporiki.gr") {
			// https://www.naftemporiki.gr/fu/p/1478494/100/10000/0x000000000162c6b1/1/game-of-thrones-finale-me-rekor-tiletheasis.jpg
			//   https://www.naftemporiki.gr/fu/p/1478494/original/10000/0x000000000162c6b1/1/game-of-thrones-finale-me-rekor-tiletheasis.jpg
			//   https://www.naftemporiki.gr/fu/p/1478494/original/original/0x000000000162c6b1/1/game-of-thrones-finale-me-rekor-tiletheasis.jpg
			// https://www.naftemporiki.gr/fu/t/1478494/100/10000/0x000000000162c6b1/1/game-of-thrones-finale-me-rekor-tiletheasis.jpg
			//   https://www.naftemporiki.gr/fu/p/1478494/original/original/0x000000000162c6b1/1/game-of-thrones-finale-me-rekor-tiletheasis.jpg
			// https://www.naftemporiki.gr/fu/p/1416181/430/268/0x000000000152649e/2/italia-europaiki-enosi-ee-simaies.jpg
			//   https://www.naftemporiki.gr/fu/p/1416181/original/original/0x000000000152649e/2/italia-europaiki-enosi-ee-simaies.jpg
			newsrc = src.replace(/\/fu\/+t\/+([0-9]+)\/+/, "/fu/p/$1/");
			if (false && newsrc !== src)
				return newsrc;

			return {
				url: src.replace(/(\/fu\/+p\/+[0-9]+\/+)(?:[0-9]+|original)\/+(?:[0-9]+|original)\/+/, "$1original/original/"),
				headers: {
					Referer: ""
				}
			};
		}

		if (false && domain === "m.naftemporiki.gr") {
			// https://m.naftemporiki.gr/thumb/1478494/706/10000/000000000162c6b1/1/game-of-thrones-finale-me-rekor-tiletheasis.jpg
			//   https://www.naftemporiki.gr/fu/p/1478494/original/original/000000000162c6b1/1/game-of-thrones-finale-me-rekor-tiletheasis.jpg
			// https://m.naftemporiki.gr/thumb/1484356/180/999/0x0000000001647205/2/riana-i-plousioteri-tragoudistria-ston-kosmo.jpg -- doesn't work
			return src.replace(/:\/\/[^/]+\/+thumb\/+([0-9]+\/+)/, "://www.naftemporiki.gr/fu/p/$1");
		}

		if (domain === "cdn.moar.exchange" ||
			domain === "cdn.viral.porn" ||
			// https://cdn.moar.network/media/38-749/conversions/5c4ba83ed2090-post_archive_thumb.jpg -- upscaled?
			//   https://cdn.moar.network/media/38-749/5c4ba83ed2090.jpeg
			// https://cdn.moar.network/media/115-20280/conversions/5e1b37e35656e7pLgp9945-post_archive_thumb.jpg
			//   https://cdn.moar.network/media/115-20280/5e1b37e35656e7pLgp9945.jpeg -- upscaled?
			domain === "cdn.moar.network" ||
			domain === "cdn.nsfw.exchange") {
			// https://cdn.moar.exchange/media/38-8310/conversions/5ce759d7db688-post_archive_thumb.jpg
			//   https://cdn.moar.exchange/media/38-8310/5ce759d7db688.jpeg
			return add_full_extensions(src.replace(/(\/media\/+[0-9]+-[0-9]+\/+)conversions\/+([0-9a-zA-Z]+)-[^-/.]*(\.[^/.]*)(?:[?#].*)?$/,
												   "$1$2$3"));
		}

		if (domain_nowww === "echosrecordbar.co.za" ||
			// thanks to anonymous for reporting:
			// https://echosrecordbar.s3.af-south-1.amazonaws.com/95383/conversions/103237-large.jpg
			//   https://echosrecordbar.s3.af-south-1.amazonaws.com/95383/103237.jpg
			// doesn't work for all:
			// https://echosrecordbar.s3.af-south-1.amazonaws.com/507281/conversions/539551-small.jpg
			amazon_container === "echosrecordbar") {
			// https://echosrecordbar.co.za/storage/62174/conversions/90832-small.jpg
			//   https://echosrecordbar.co.za/storage/62174/90832.jpg -- 1200x1200
			return src.replace(/(\/[0-9]+\/+)conversions\/+([0-9]+)-[a-z]+(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2$3");
		}

		if (domain === "m.blog.hu") {
			// https://m.blog.hu/ko/kotta/image/katy%20perry/thirteen/smnxs-_forum_ns4w_org_016.jpg
			//   https://m.blog.hu/ko/kotta/image/katy%20perry/thirteen/_forum_ns4w_org_016.jpg
			// https://m.blog.hu/ko/kotta/image/katy%20perry/thirteen/906419703sm.jpg
			//   https://m.blog.hu/ko/kotta/image/katy%20perry/thirteen/906419703.jpg
			// other urls:
			// https://m.blog.hu/ko/kotta/image/katy%20perry/thirteen/36233f62374057.gif
			//   https://m.blog.hu/ko/kotta/image/katy%20perry/thirteen/olivia_wilde_unknown_photoshoot_02.jpg
			return src.replace(/(\/image\/+[^/]*\/+[^/]*\/+)(?:smnxs-([^/]*)|([0-9]+)sm)(\.[^/.]*)(?:[?#].*)?$/, "$1$2$3$4");
		}

		if (domain_nowww === "gosee.de") {
			// https://www.gosee.de/prev/304x/images/content2/6f648d7e-2de4-45f1-9a54-f57d2a57814f.jpg
			//   https://www.gosee.de/images/content2/6f648d7e-2de4-45f1-9a54-f57d2a57814f.jpg
			// https://www.gosee.de/images/preview/5d/2000x2000-6f648d7e-2de4-45f1-9a54-f57d2a57814f.jpg
			//   https://www.gosee.de/images/content2/6f648d7e-2de4-45f1-9a54-f57d2a57814f.jpg
			return src
				.replace(/\/prev\/+[0-9]+x(?:[0-9]+)?\/+images\/+/, "/images/")
				.replace(/\/images\/+preview\/+[0-9a-f]+\/+[0-9]+x(?:[0-9]+)?-/, "/images/content2/");
		}

		if (domain_nowww === "uploadbeta.com" ||
			// thanks to anonymous for reporting:
			// https://rot47.net/_s/upload/2013/11/07/6ce7768ebb7d8d89deffeb9de95acbc1.jpg225.jpg
			//   https://rot47.net/_s/upload/2013/11/07/6ce7768ebb7d8d89deffeb9de95acbc1.jpg
			domain_nowww === "rot47.net") {
			// https://uploadbeta.com/_s/upload/2016/01/10/343ee2817ebb2861af1641ad8d5ed66f.jpg225.jpg
			//   https://uploadbeta.com/_s/upload/2016/01/10/343ee2817ebb2861af1641ad8d5ed66f.jpg
			return src.replace(/(\/_s\/+upload\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9a-f]+\.[a-zA-Z]+)[0-9]+\.[^/.]*(?:[?#].*)?$/,
							   "$1");
		}

		if (domain_nowww === "onlyasianpictures.com" ||
			// http://www.avidolpics.com/galleries/2016/04/an-nanba/thumbs/an-nanba-9.jpg
			//   http://www.avidolpics.com/galleries/2016/04/an-nanba/an-nanba-9.jpg
			domain_nowww === "avidolpics.com") {
			// http://www.onlyasianpictures.com/galleries/2016/11/hot-asian-chick-yui-ayana-teasing-her-vagina/thumbs/hot-asian-chick-yui-ayana-teasing-her-vagina-1.jpg
			//   http://www.onlyasianpictures.com/galleries/2016/11/hot-asian-chick-yui-ayana-teasing-her-vagina/hot-asian-chick-yui-ayana-teasing-her-vagina-1.jpg
			return src.replace(/(\/galleries\/+[0-9]{4}\/+[0-9]{2}\/+[^/]*\/+)thumbs\/+/, "$1");
		}

		if (domain_nowww === "caribbeancompr.com" ||
			// https://www.caribbeancom.com/moviepages/111913-482/images/s/001.jpg
			//   https://www.caribbeancom.com/moviepages/111913-482/images/l/001.jpg
			domain_nowww === "caribbeancom.com") {
			// https://www.caribbeancompr.com/moviepages/012619_002/images/s/001.jpg
			//   https://www.caribbeancompr.com/moviepages/012619_002/images/l/001.jpg
			return {
				url: src.replace(/\/images\/+s\/+([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/images/l/$1"),
				headers: {
					Referer: "https://" + domain + "/"
				},
				referer_ok: {
					same_domain_nosub: true
				}
			};
		}

		if (false && domain_nosub === "yupiii.gr" && domain.match(/^cdn[0-9]*\./)) {
			// not sure if this works, all images seem to be resized to 690 width
			// http://cdn.yupiii.gr/images/resized/3000_cb0bea989bcf2916c3327f2eeb67a627.jpg
			//   http://cdn.yupiii.gr/images/resized/0_cb0bea989bcf2916c3327f2eeb67a627.jpg
			// http://cdn.yupiii.gr/images/resized/fixed2_90x85_Keit___pton_for_Sports_Illustrated_Swimsuit_Edition_2014m__13_1_small.jpg
			//   http://cdn.yupiii.gr/images/resized/0_Keit___pton_for_Sports_Illustrated_Swimsuit_Edition_2014m__13_1_small.jpg
			// http://cdn2.yupiii.gr/images/resized/icemax_700_0a38a3276b31abc71644c6821da8b839.jpg?v=1
			//   http://cdn2.yupiii.gr/images/resized/icemax_0_0a38a3276b31abc71644c6821da8b839.jpg?v=1
			return src.replace(/\/images\/+resized\/+(?:fixed[0-9]*_)?(icemax_)?[0-9]+(?:x[0-9]+)?_/, "/images/resized/$10_");
		}

		if (domain_nowww === "ai-av.com") {
			// http://www.ai-av.com/carib/2011/031811-647/02s.jpg
			//   http://www.ai-av.com/carib/2011/031811-647/02.jpg
			return src.replace(/(\/[0-9]{4}\/+[0-9]+-[0-9]+\/+[0-9]+)s(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nosub === "blovcdn.com" && domain.match(/^cdn[0-9]*\./)) {
			// https://cdn2.blovcdn.com/bloglovin/aHR0cHMlM0ElMkYlMkZpMC53cC5jb20lMkZ3d3cubG92ZW9saWEuY29tJTJGd3AtY29udGVudCUyRnVwbG9hZHMlMkYyMDE4JTJGMTAlMkZEU0NfMzEwMC5qcGclM0ZyZXNpemUlM0QxMzAwJTI1MkMxMDQw?checksum=122165603b317bb84022b49894ed883d9b2e4af8&format=j
			//   https://cdn2.blovcdn.com/bloglovin/aHR0cHMlM0ElMkYlMkZpMC53cC5jb20lMkZ3d3cubG92ZW9saWEuY29tJTJGd3AtY29udGVudCUyRnVwbG9hZHMlMkYyMDE4JTJGMTAlMkZEU0NfMzEwMC5qcGclM0ZyZXNpemUlM0QxMzAwJTI1MkMxMDQw?checksum=122165603b317bb84022b49894ed883d9b2e4af8&format=s
			//   http://www.loveolia.com/wp-content/uploads/2018/10/DSC_3100.jpg
			// https://cdn3.blovcdn.com/bloglovin/aHR0cCUzQSUyRiUyRjIuYnAuYmxvZ3Nwb3QuY29tJTJGLUs4Wm10YXZvVERjJTJGVkhPcldiYmZEcEklMkZBQUFBQUFBQUNHYyUyRkUySjh2V180cnJjJTJGczE2MDAlMkZtbGxlLW1hZGVtb2lzZWxsZS1zcy0yMDE1LWNhaWxpbi1ydXNzby1ieS1oZW5yaWstcHVyaWVubmUtMTAuanBn?checksum=c449ce61d806860f88a385b1090aada8e1973925&format=o
			//   https://cdn3.blovcdn.com/bloglovin/aHR0cCUzQSUyRiUyRjIuYnAuYmxvZ3Nwb3QuY29tJTJGLUs4Wm10YXZvVERjJTJGVkhPcldiYmZEcEklMkZBQUFBQUFBQUNHYyUyRkUySjh2V180cnJjJTJGczE2MDAlMkZtbGxlLW1hZGVtb2lzZWxsZS1zcy0yMDE1LWNhaWxpbi1ydXNzby1ieS1oZW5yaWstcHVyaWVubmUtMTAuanBn?checksum=c449ce61d806860f88a385b1090aada8e1973925&format=s
			//   https://2.bp.blogspot.com/-K8ZmtavoTDc/VHOrWbbfDpI/AAAAAAAACGc/E2J8vW_4rrc/s0/mlle-mademoiselle-ss-2015-cailin-russo-by-henrik-purienne-10.jpg=s0?imgmax=0
			// https://cdn1.blovcdn.com/bloglovin/aHR0cHMlM0ElMkYlMkZzMy5hbWF6b25hd3MuY29tJTJGYmxvZ2xvdmluLXVzZXItaW1hZ2VzLXByb2QlMkZuYXRpdmUtcG9zdC1pbWctMS02MzgzNS01OTA2OGUyNDRiMGY1?checksum=0513b8a2e97721416b71352297e4acc1c93ce123&format=s
			//   https://s3.amazonaws.com/bloglovin-user-images-prod/native-post-img-1-63835-59068e244b0f5
			//   https://blog.bloglovin.com/blog/10-perfect-blush-shades-for-every-skin-tone
			// https://cdn3.blovcdn.com/bloglovin/aHR0cHMlM0ElMkYlMkZzMy5hbWF6b25hd3MuY29tJTJGYmxvZ2xvdmluLXVzZXItaW1hZ2VzLXByb2QlMkZuYXRpdmUtcG9zdC1pbWctMS01MzUxOS01OGY1ZjBlMmJiNzZj?checksum=ebc3a380aa9eb06e2295cbb0488670495b865279&format=s
			//   https://s3.amazonaws.com/bloglovin-user-images-prod/native-post-img-1-53519-58f5f0e2bb76c
			//   https://blog.bloglovin.com/blog/how-to-begin-to-love-mondays
			// s, q, t, r, j, h, d, n, l, o, c, g, f, m, i, e, b, p, k
			newsrc = src.replace(/([?&]format=)[^&]*/, "$1s");
			if (newsrc !== src)
				return newsrc;

			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+bloglovin\/+(aHR0c[^?#/.]+)(?:[?#].*)?$/, "$1");
			if (newsrc !== src)
				return decodeURIComponent(base64_decode(newsrc));
		}

		if (domain === "img.nimo.tv" ||
			// https://img-service.nimo.tv/t/201905301559185394034_1929512715480_avatar.png/w90_l0/img.jpg
			//   https://img-service.nimo.tv/t/201905301559185394034_1929512715480_avatar.png/full/img.jpg
			domain === "img-service.nimo.tv") {
			// https://img.nimo.tv/t/201905301559185394034_1929512715480_avatar.png/w90_l0/img.webp
			//   https://img.nimo.tv/t/201905301559185394034_1929512715480_avatar.png/full/img.webp
			return src.replace(/(:\/\/[^/]*\/t\/+[^/]*.[^/.]*)\/+[^/]*\/+([^/]*\.[^/.]*)(?:[?#].*)?$/,
							   "$1/full/$2");
		}

		if (domain === "wspicsa.vod.nimo.tv") {
			// https://wspicsa.vod.nimo.tv/live/338*190/su1899511810009rb79cd8f5324058b4a9dce20b6e11c5e6.jpg?t=1560298717432
			//   https://wspicsa.vod.nimo.tv/live/su1899511810009rb79cd8f5324058b4a9dce20b6e11c5e6.jpg?t=1560298717432
			return src.replace(/\/live\/+[0-9]+[*][0-9]+\/+/, "/live/");
		}

		if (domain === "cdn.lesilla.filoblu.com") {
			// https://cdn.lesilla.filoblu.com/media/contentmanager/content/resized/767x/contentmanager/content/HALLE-BERRY-CELEB-3-ok.jpg
			//   https://cdn.lesilla.filoblu.com/media/contentmanager/content/HALLE-BERRY-CELEB-3-ok.jpg
			return src.replace(/\/([a-z]+)\/+content\/+resized\/+[0-9]+x(?:[0-9]+)?\/+\1\/+/, "/$1/");
		}

		if (domain === "mimg.koreatimes.com") {
			// http://mimg.koreatimes.com/286/172/article/2019/04/03/201904032255515c1.jpg
			//   http://image.koreatimes.com/article/2019/04/03/201904032255515c1.jpg
			return src.replace(/:\/\/[^/]*\/[0-9]+\/+[0-9]+\/+article\/+/, "://image.koreatimes.com/article/");
		}

		if (domain === "d2360iq24ihnyn.cloudfront.net") {
			// https://d2360iq24ihnyn.cloudfront.net/image_4224d7d3d977cbfd57061d749a912211e5c2df7_small.jpg
			//   https://d2360iq24ihnyn.cloudfront.net/image_4224d7d3d977cbfd57061d749a912211e5c2df7_large.jpg
			return src.replace(/(\/image_[0-9a-f]{10,})_small(\.[^/.]*)(?:[?#].*)?$/,
							   "$1_large$2");
		}

		if (domain === "dingyue.ws.126.net") {
			// http://dingyue.ws.126.net/RSuwrB7Rtl6TfC42VqOKhk6c4HkFNREQzW2wRXUieG8m11557499804125compressflag.jpg
			//   http://dingyue.ws.126.net/RSuwrB7Rtl6TfC42VqOKhk6c4HkFNREQzW2wRXUieG8m11557499804125.jpg
			return src.replace(/compressflag(\.[^/.]*)(?:[?#].*)?$/, "$1");
		}

		if (domain === "times.hinet.net") {
			// https://times.hinet.net/news/cimages/22/40/22406000/s_296eea1f-b714-46c5-ad9f-7c953220e604.jpg
			//   https://times.hinet.net/news/cimages/22/40/22406000/296eea1f-b714-46c5-ad9f-7c953220e604.jpg
			return src.replace(/\/s_([0-9a-f]+(?:-[0-9a-f]+){3,}\.[^/.]*)(?:[?#].*)?$/, "/$1");
		}

		if (domain_nowww === "kpopdaily.co.kr" ||
			// http://www.ujnews.co.kr/news/data/20190311/p1065591978055877_117_h.jpg?2032 -- 315x444
			//   http://www.ujnews.co.kr/news/data/20190311/p1065591978055877_117_thum.jpg?2032 -- 700x987
			//   http://www.ujnews.co.kr/news/data/20190311/p1065591978055877_117.jpg?2032 -- 1156x1631 (404 now)
			domain_nowww === "ujnews.co.kr" ||
			// http://www.segyelocalnews.com/news/data/20190401/p1065598663206509_272_h.jpg
			//   http://www.segyelocalnews.com/news/data/20190401/p1065598663206509_272_thum.jpg
			// http://www.segyelocalnews.com/news/newsview.php?ncode=1065598663206509
			// http://www.segyelocalnews.com/news/data/20190911/p1065581565021106_108.jpg -- 2000x1335
			domain_nosub === "segyelocalnews.com" ||
			// https://www.upinews.kr/news/data/20190814/p1065589122046660_727_h.jpg -- 315x472
			//   https://www.upinews.kr/news/data/20190814/p1065589122046660_727_h2.jpg -- 679x1019
			//   https://www.upinews.kr/news/data/20190814/p1065589122046660_727_thum.jpg -- 679x1019
			//   https://www.upinews.kr/news/data/20190814/p1065589122046660_727_h3.jpg -- 1023x1535
			// https://www.upinews.kr/news/newsview.php?ncode=1065602821580462
			//   https://www.upinews.kr/news/data/20190822/p1065602821580462_683_h3.jpg
			// other:
			// https://www.upinews.kr/news/data/20190701/p1065589773349704_340_h3.png -- 6158x1944
			domain_nowww === "upinews.kr" ||
			// http://www.thedrive.co.kr/news/data/20191016/p1065587293279646_750_thum.jpg
			//   http://www.thedrive.co.kr/news/data/20191016/p1065587293279646_750.jpg
			domain_nowww === "thedrive.co.kr" ||
			// thanks to f2005 on discord:
			// https://k-odyssey.com/news/data/20220706/p1065602540064282_853_thum.JPG
			//   https://k-odyssey.com/news/data/20220706/p1065602540064282_853.JPG -- 4000x6000
			domain_nowww === "k-odyssey.com" ||
			// thanks to f005 on discord:
			// https://idsncdn.iwinv.biz/news/data/20230512/p1065579370554245_938_thum.jpg
			//   https://idsncdn.iwinv.biz/news/data/20230512/p1065579370554245_938.jpg
			domain === "idsncdn.iwinv.biz" ||
			// http://www.newswiz.kr/news/data/20190606/p1065589870763517_698_h.jpg -- 314x393
			//   http://www.newswiz.kr/news/data/20190606/p1065589870763517_698_thum.jpg -- 699x874
			//   http://www.newswiz.kr/news/data/20190606/p1065589870763517_698.jpg -- 745x931
			domain_nowww === "newswiz.kr") {
			// http://kpopdaily.co.kr/news/data/20190319/p1065597075569557_714_h.jpg
			//   http://kpopdaily.co.kr/news/data/20190319/p1065597075569557_714_thum.jpg -- 499x750
			//   http://kpopdaily.co.kr/news/data/20190319/p1065597075569557_714.jpg -- 499x750
			regex = /(\/news\/+data\/+[0-9]{8}\/+[a-z]*[0-9]+_[0-9]+)_(?:h[0-9]*|thum)(\.[^/.]*)(?:[?#].*)?$/;

			var extra = {};
			match = src.match(/\/news\/+data\/+[0-9]+\/+p([0-9]{10,})_/);
			if (match) {
				extra = {
					page: "http://www." + domain_nosub + "/news/newsview.php?ncode=" + match[1]
				};
			}

			var urls = [src];

			if (regex.test(src)) {
				urls.unshift(src.replace(regex, "$1_h2$2"));
				urls.unshift(src.replace(regex, "$1_thum$2"));
				urls.unshift(src.replace(regex, "$1_h3$2"));
				urls.unshift(src.replace(regex, "$1$2"));
			}

			return fillobj_urls(urls, {extra: extra});
		}

		if (domain === "image.newstomato.com") {
			// http://image.newstomato.com/newstong/2019/5/17/11/6581739/thum_c_1.jpg
			//   http://image.newstomato.com/newstong/2019/5/17/11/6581739/1.jpg
			return src.replace(/\/thum(?:_[a-z])?_([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/$1");
		}

		if ((domain_nosub === "nijie.info" ||
			 domain_nosub === "nijie.net") && domain.match(/^pic[0-9]*\./)) {
			// thanks to Kattus on github: https://github.com/qsniyg/maxurl/issues/82
			// https://pic02.nijie.info/__rs_l30x30/nijie_picture/498_20120828123910.jpg
			//   https://pic02.nijie.info/__rs_l300x300/nijie_picture/498_20120828123910.jpg
			//   https://pic02.nijie.info/nijie_picture/498_20120828123910.jpg
			//
			// http://pic02.nijie.info/__rs_l30x30/hina/main/1081_20181221234339.jpg
			//   http://pic02.nijie.info/hina/main/1081_20181221234339.jpg -- 2560x1920
			// https://pic01.nijie.info/__rs_l30x30/nijie_picture/diff/main/218856_1_236014_20170620101330.png
			//   https://pic01.nijie.info/nijie_picture/diff/main/218856_1_236014_20170620101330.png
			return src.replace(/\/__rs_[a-z]*[0-9]+x[0-9]+\/+/, "/");
		}

		if (domain === "cdn-img.jamendo.com" ||
			// https://images.jamendo.com/albums/s157/157706/covers/1.600.jpg?du=1459966188
			//   https://images.jamendo.com/albums/s157/157706/covers/1.0.jpg?du=1459966188 -- 1280x1280
			domain === "images.jamendo.com") {
			// https://cdn-img.jamendo.com/albums/s169/169979/covers/1.60.jpg
			//   https://cdn-img.jamendo.com/albums/s169/169979/covers/1.0.jpg
			return src.replace(/(\/s[0-9]+\/+[0-9]+\/+[a-z]+\/+[0-9]+\.)[0-9]+\./, "$10.");
			//return src.replace(/(\/[0-9]+\.)[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$10$2");
		}

		if (domain === "usercontent.jamendo.com") {
			// thanks to ROpdebee on github: https://github.com/qsniyg/maxurl/issues/985
			// https://usercontent.jamendo.com/?type=album&id=248857&width=600&trackid=1492900
			//   https://usercontent.jamendo.com/?type=album&id=248857&width=0&trackid=1492900 -- 1686x1686
			return src.replace(/(\?(?:.*&)?width=)[0-9]+([&#].*)?$/, "$10$2");
		}

		if (domain_nowww === "cdbaby.name") {
			// https://cdbaby.name/r/0/r0alb01561501_small.jpg
			//   https://cdbaby.name/r/0/r0alb01561501.jpg
			//   https://cdbaby.name/r/0/r0alb01561501_large.jpg
			return src.replace(/(\/[0-9a-z]+)(?:_[a-z]+)?(\.[^/.]*)(?:[?#].*)?$/, "$1_large$2");
		}

		if (domain_nowww === "livingelectro.com") {
			// http://www.livingelectro.com/files/images/s/117431/to-u_small.jpg
			//   http://www.livingelectro.com/files/images/s/117431/to-u_large.jpg
			return src.replace(/(\/files\/+images\/+[^/]*\/+[0-9]+\/+[^/]*)_small(\.[^/.]*)(?:[?#].*)?$/, "$1_large$2");
		}

		if (domain_nosub === "archive.org" && domain.match(/^ia[0-9]*\./)) {
			// https://ia800502.us.archive.org/0/items/mbid-dddbefc8-533e-4846-805e-d6d7561848c3/mbid-dddbefc8-533e-4846-805e-d6d7561848c3-6624650844_thumb250.jpg
			//   https://ia800502.us.archive.org/0/items/mbid-dddbefc8-533e-4846-805e-d6d7561848c3/mbid-dddbefc8-533e-4846-805e-d6d7561848c3-6624650844.jpg
			// https://ia801501.us.archive.org/29/items/mbid-e188608a-7002-42cd-9cee-d8e630e8fa99/mbid-e188608a-7002-42cd-9cee-d8e630e8fa99-23293843276_thumb250.jpg
			//   https://ia801501.us.archive.org/29/items/mbid-e188608a-7002-42cd-9cee-d8e630e8fa99/mbid-e188608a-7002-42cd-9cee-d8e630e8fa99-23293843276.png
			// https://archive.org/services/img/mbid-95211836-1141-407a-8c34-da3a11b34f68 -- 180x179
			//   https://archive.org/details/mbid-da9e3859-3d36-4542-935f-26b0d0c8643f
			//   https://ia801607.us.archive.org/19/items/mbid-da9e3859-3d36-4542-935f-26b0d0c8643f/mbid-da9e3859-3d36-4542-935f-26b0d0c8643f-16483612665_itemimage.jpg
			//   https://ia801607.us.archive.org/19/items/mbid-da9e3859-3d36-4542-935f-26b0d0c8643f/__ia_thumb.jpg
			//   https://ia801607.us.archive.org/19/items/mbid-da9e3859-3d36-4542-935f-26b0d0c8643f/mbid-da9e3859-3d36-4542-935f-26b0d0c8643f-16483612665.jpg -- 500x496
			newsrc = src.replace(/(\/items\/+mbid-[-0-9a-f]+\/+mbid-[-0-9a-f]+)_(?:thumb[0-9]+|itemimage)(\.[^/.]*)(?:[?#].*)?$/, "$1$2");

			if (newsrc !== src) {
				return add_extensions({
					url: newsrc,
					can_head: false
				});
			}
		}

		if (domain_nowww === "coverartarchive.org") {
			// https://coverartarchive.org/release/e188608a-7002-42cd-9cee-d8e630e8fa99/23293843276-250.jpg
			//   https://coverartarchive.org/release/e188608a-7002-42cd-9cee-d8e630e8fa99/23293843276.jpg
			//   https://ia801501.us.archive.org/29/items/mbid-e188608a-7002-42cd-9cee-d8e630e8fa99/mbid-e188608a-7002-42cd-9cee-d8e630e8fa99-23293843276.png
			return src.replace(/(\/[0-9]+)-[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "45cat.com") {
			// http://www.45cat.com/image/261/thumb/ian-wallace-the-gorilla-parlophone-t.jpg
			//   http://images.45cat.com/ian-wallace-the-gorilla-parlophone.jpg
			return src.replace(/:\/\/[^/]*\/image\/+[0-9]+\/+thumb\/+([^/]*)-t(\.[^/.]*)(?:[?#].*)?$/,
							   "://images.45cat.com/$1$2");
		}

		if (domain === "images.45cat.com") {
			// http://images.45cat.com/ian-wallace-the-gorilla-parlophone-s.jpg
			//   http://images.45cat.com/ian-wallace-the-gorilla-parlophone.jpg
			return src.replace(/-s(\.[^/.]*)(?:[?#].*)?$/, "$1");
		}

		if (domain === "images.45worlds.com" ||
			// http://images.45spaces.com/t/ple/north-shields-cliffords-fort-545-ple-t.jpg
			//   http://images.45spaces.com/f/ple/north-shields-cliffords-fort-545-ple.jpg
			// http://images.45spaces.com/t/asa/west-bromwich-albion-665-asa-t.jpg
			//   http://images.45spaces.com/f/asa/west-bromwich-albion-665-asa.jpg
			// http://images.45spaces.com/t/reg/none-541-2-reg-t.jpg
			//   http://images.45spaces.com/f/reg/none-541-2-reg.jpg
			// http://images.45spaces.com/f/sob/freeway-lemon-freeway-2-sob.jpg
			//   http://images.45spaces.com/f/sob/freeway-lemon-freeway-2-sob.jpg
			// http://images.45spaces.com/t/pol/bourtange-ned-herv-kerk-186-pol-t.jpg
			//   http://images.45spaces.com/f/pol/bourtange-ned-herv-kerk-186-pol.jpg
			// http://images.45spaces.com/t/pua/high-st-west-gateshead-the-gloucester-pua-t.jpg
			//   http://images.45spaces.com/f/pua/high-st-west-gateshead-the-gloucester-pua.jpg
			domain === "images.45spaces.com") {
			// http://images.45worlds.com/t/78/gracie-fields-intro-sing-as-we-go-i-never-cried-so-much-in-all-my-life-regal-zonophone-78-t.jpg
			//   http://images.45worlds.com/s/78/gracie-fields-intro-sing-as-we-go-i-never-cried-so-much-in-all-my-life-regal-zonophone-78-s.jpg
			//   http://images.45worlds.com/f/78/gracie-fields-intro-sing-as-we-go-i-never-cried-so-much-in-all-my-life-regal-zonophone-78.jpg
			// http://images.45worlds.com/t/bk/various-authors-buon-cento-toro-19061967-19682006-bk-t.jpg
			//   http://images.45worlds.com/f/bk/various-authors-buon-cento-toro-19061967-19682006-bk.jpg
			// http://images.45worlds.com/t/ci/curiosa469656-ci-t.jpg
			//   http://images.45worlds.com/f/ci/curiosa469656-ci.jpg
			// http://images.45worlds.com/t/ab/the-moody-blues-to-our-childrens-childrens-children-13-ab-t.jpg
			//   http://images.45worlds.com/f/ab/the-moody-blues-to-our-childrens-childrens-children-13-ab.jpg
			return src.replace(/(:\/\/[^/]+\/+)[st]\/+([0-9a-z]{2,3}\/+[^/]+-[0-9a-z]{2,3})-[st](\.[^/.]+)(?:[?#].*)?$/, "$1f/$2$3");
		}

		if (domain === "d16klsh1z1xre7.cloudfront.net") {
			// https://d16klsh1z1xre7.cloudfront.net/dorp/dorp/0/d9c7/ffd9/1004737915-size-exact-140x140.jpg
			//   https://d16klsh1z1xre7.cloudfront.net/dorp/dorp/0/d9c7/ffd9/1004737915-size-original.jpg
			return src.replace(/-size(?:-[a-z]+)?-[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "-size-original$1");
		}

		if (domain_nosub === "magnatune.com") {
			// http://magnatune.com/music/Lara%20St%20John/Vivaldi%20-%20The%20Four%20Seasons/cover_200.jpg
			//   http://magnatune.com/music/Lara%20St%20John/Vivaldi%20-%20The%20Four%20Seasons/cover.jpg
			// http://he3.magnatune.com/music/Lara%20St%20John/Vivaldi%20-%20The%20Four%20Seasons/cover_600.jpg
			//   http://he3.magnatune.com/music/Lara%20St%20John/Vivaldi%20-%20The%20Four%20Seasons/cover.jpg
			return src.replace(/(\/cover)_[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "fast.ilicensemusic.com") {
			// http://fast.ilicensemusic.com/music/Lara%20St%20John/Vivaldi%20-%20The%20Four%20Seasons/cover_300.jpg
			//   http://magnatune.com/music/Lara%20St%20John/Vivaldi%20-%20The%20Four%20Seasons/cover.jpg
			return src.replace(/:\/\/[^/]*\/music\//, "://magnatune.com/music/");
		}

		if (domain === "img.1ting.com") {
			// https://img.1ting.com/images/special/366/s300_57db06a8ad1b94b7e178fea4e4f57391.jpg
			//   https://img.1ting.com/images/special/366/57db06a8ad1b94b7e178fea4e4f57391.jpg
			return {
				url: src.replace(/\/s[0-9]+_([0-9a-f]+\.[^/.]*)(?:[?#].*)?$/, "/$1"),
				headers: {
					Referer: ""
				}
			};
		}

		if (domain === "omusic.friday.tw") {
			// https://omusic.friday.tw/img/album/1294229-202.jpg
			//   https://omusic.friday.tw/img/album/1294229.jpg -- 450x450
			return src.replace(/(\/img\/+album\/+[0-9]+)-[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "rocklyric.jp") {
			// https://rocklyric.jp/artistlist/ma/miwa/25_thum.jpg
			//   https://rocklyric.jp/artistlist/ma/miwa/25.jpg
			return src.replace(/_thum(\.[^/.]*)(?:[?#].*)?$/, "$1");
		}

		if (domain === "spice.eplus.jp") {
			// http://spice.eplus.jp/images/diIWK1VzOmvgqR6651kDu8rPTp0ddAEbyRURkuEorSKVMMU6L8tk2OZM6DLXjc3n/small
			//   http://spice.eplus.jp/images/diIWK1VzOmvgqR6651kDu8rPTp0ddAEbyRURkuEorSKVMMU6L8tk2OZM6DLXjc3n
			//   http://spice.eplus.jp/images/diIWK1VzOmvgqR6651kDu8rPTp0ddAEbyRURkuEorSKVMMU6L8tk2OZM6DLXjc3n/original
			return src.replace(/(\/images\/+[a-zA-Z0-9]{10,})(?:\/+[a-z]+)?(?:[?#].*)?$/, "$1/original");
		}

		if (domain_nowww === "earone.it") {
			// https://www.earone.it/newsimages/skrillex_diplo_to___feat_alunageorge.jpg___th_320_0.jpg
			//   https://www.earone.it/newsimages/skrillex_diplo_to___feat_alunageorge.jpg
			return src.replace(/(\.[^/._]+)___th_[0-9]+_[0-9]+\.[^/.]*(?:[?#].*)?$/, "$1");
		}

		if (domain === "n11scdn.akamaized.net") {
			// https://n11scdn.akamaized.net/a1/320/kitap-muzik-film-oyun/plaklar/skrillex-diplo-present-jack__1118924899900125.jpg
			//   https://n11scdn.akamaized.net/a1/org/kitap-muzik-film-oyun/plaklar/skrillex-diplo-present-jack__1118924899900125.jpg
			return src.replace(/(\/a1\/+)[0-9]+\/+/, "$1org/");
		}

		if (domain_nowww === "wmg.jp") {
			// https://wmg.jp/packages/15123/images/pi_320x320_wpcr000016447_LLL.jpg
			//   https://wmg.jp/packages/15123/images/wpcr000016447_LLL.jpg
			// https://wmg.jp/packages/17910/images/wpzl000031298_L.jpg
			//   https://wmg.jp/packages/17910/images/wpzl000031298_LLL.jpg
			return src.replace(/\/images\/+(?:pi_[0-9]+x[0-9]+_)?([a-z]+[0-9]+)_LL?\./, "/images/$1_LLL.");
		}

		if (domain_nowww === "bontonland.cz") {
			// https://www.bontonland.cz/image.php?image=/fotky/251/p-102748-full.jpg&width=375&height=375
			//   https://www.bontonland.cz/image.php?image=/fotky/251/p-102748-full.jpg
			return src.replace(/\/image\.php.*?[?&]image=([^&]*).*?$/, "/image.php?image=$1");
		}

		if (domain === "s12emagst.akamaized.net") {
			// https://s12emagst.akamaized.net/products/15399/15398222/images/res_43dea9471ce01e35267648510ad3521e_450x450_fmis.jpg
			//   https://s12emagst.akamaized.net/products/15399/15398222/images/res_43dea9471ce01e35267648510ad3521e.jpg
			return src.replace(/(\/images\/+res_[0-9a-f]{10,})_[0-9]+x[0-9]+(?:_[a-z]+)?(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (amazon_container === "img.iluria.com") {
			// http://s3.amazonaws.com/img.iluria.com/product/2FF10E/71D1AB/450xN.jpg
			//   http://s3.amazonaws.com/img.iluria.com/product/2FF10E/71D1AB/original.jpg
			return src.replace(/\/[0-9N]+x[0-9N]+(\.[^/.]*)(?:[?#].*)?$/, "/original$1");
		}

		if (domain_nosub === "m24.ru") {
			// https://b1.m24.ru/c/386142.483xp.jpg
			//   https://b1.m24.ru/c/386142.jpg
			return src.replace(/(\/[0-9]+)\.[0-9p]+x[0-9p]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "amoeba.com") {
			// https://www.amoeba.com/sized-images/max/500/500/uploads/albums/covers/other//075678669576.jpg
			//   https://www.amoeba.com/admin/uploads/albums/covers/other//075678669576.jpg
			return src.replace(/\/sized-images\/+[a-z]+\/+(?:[0-9]+\/+){2}uploads\/+/, "/admin/uploads/");
		}

		if (amazon_container === "groundctrl") {
			// http://groundctrl.s3.amazonaws.com/clients/nickiminaj/media/12/12/images/assets/medium.bnUdzyrB34mjfmYMUUC8xxiBiKhhJpCNYYjMjq_FL2k.jpg
			//   http://groundctrl.s3.amazonaws.com/clients/nickiminaj/media/12/12/images/assets/original.bnUdzyrB34mjfmYMUUC8xxiBiKhhJpCNYYjMjq_FL2k.jpg
			// https://groundctrl.s3.amazonaws.com/clients/taylorswift/media/00/03/small.g4ux53xk4qvp.jpg
			//   https://groundctrl.s3.amazonaws.com/clients/taylorswift/media/00/03/original.g4ux53xk4qvp.jpg
			return src.replace(/(\/media\/+[0-9]+\/+[0-9]+\/+(?:images\/+assets\/+)?)[a-z]+\.([0-9a-zA-Z_]+\.[^/.]*)(?:[?#].*)?$/, "$1original.$2");
		}

		if (domain === "img.manoramaonline.com" ||
			// https://www.theman.in/content/dam/theman/travel/2018/12/terra-2.jpg.image.732.824.jpg
			domain_nowww === "theman.in") {
			// https://img.manoramaonline.com/content/dam/mm/en/entertainment/music/images/2017/5/22/nicki-minaj-india.jpg.image.470.246.jpg
			//   https://img.manoramaonline.com/content/dam/mm/en/entertainment/music/images/2017/5/22/nicki-minaj-india.jpg
			return src.replace(/\.image\.[0-9]+\.[0-9]+\.[^/.]*(?:[?#].*)?$/, "");
		}

		if (domain_nowww === "washwasha.org") {
			// http://www.washwasha.org/upload/photo/gallery/5/1/630x1000/995.jpg
			//   http://www.washwasha.org/upload/photo/gallery/5/1/995.jpg
			return src.replace(/(\/upload\/+photo\/+gallery\/+[0-9]+\/+[0-9]+\/+)[0-9]+x[0-9]+\/+/, "$1");
		}

		if (domain === "images.mimint.co.kr") {
			// http://images.mimint.co.kr/star/thefact/bbs/2016/07/06/S20160706092209175r.jpg
			//   http://images.mimint.co.kr/star/thefact/bbs/2016/07/06/S20160706092209175.jpg
			return src.replace(/(\/[0-9]{4}\/+(?:[0-9]{2}\/+){2}S[0-9]{10,})[a-z](\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain_nosub === "mimint.co.kr") {
			// https://m.mimint.co.kr/article/thumbnail.asp?thumb=http%3A%2F%2Fimages%2Emimint%2Eco%2Ekr%2Fstar%2Fthefact%2Fbbs%2F2020%2F02%2F05%2FS20200205170414280%2Ejpg
			//   http://images.mimint.co.kr/star/thefact/bbs/2020/02/05/S20200205170414280.jpg
			newsrc = src.replace(/.*\/article\/+thumbnail\.asp\?(?:.*?&)?thumb=([^&]+).*?$/, "$1");
			if (newsrc !== src) {
				return decodeuri_ifneeded(newsrc);
			}
		}

		if (domain_nowww === "hrising.com") {
			// http://www.hrising.com/img/?p=hrising/attach/201606/20160623/GYvO7zlhcE7SbolD7E5f48wHN7Jh.jpg -- 800x1030
			//   http://www.hrising.com/data/hrising/attach/201606/20160623/GYvO7zlhcE7SbolD7E5f48wHN7Jh.jpg -- 800x1030
			// http://www.hrising.com/data/hrising/thumbnail/attach/201709/20170907/JLymUAvvnwelTGRc9R.jpg
			//   http://www.hrising.com/data/hrising/attach/201709/20170907/JLymUAvvnwelTGRc9R.jpg
			// http://www.hrising.com/data/www/thumbnail/attach/2012/LlzGhR2yKcbZ6bdHWQrVFQa2wG3C.jpg
			//   http://www.hrising.com/data/www/attach/2012/LlzGhR2yKcbZ6bdHWQrVFQa2wG3C.jpg
			return src
				.replace(/\/img\/.*?[?&]p=([^&]*).*?$/, "/data/$1")
				.replace(/(\/data\/+[^/]*\/+)thumbnail\/+attach\/+/, "$1attach/");
		}

		// https://cargo.site/ - website building tools
		if (domain === "freight.cargo.site" ||
			// thanks to jonestly on discord:
			// https://cortex.persona.co/w/750/i/04f82e42c5d0b714bbdf78cf8c66b6a7fc494634deb768abb57fee896cf12959/Delta---Front_HQ.jpeg
			//   https://cortex.persona.co/w/i/04f82e42c5d0b714bbdf78cf8c66b6a7fc494634deb768abb57fee896cf12959/Delta---Front_HQ.jpeg -- 3000x3019
			//   https://cortex.persona.co/w/t/original/i/04f82e42c5d0b714bbdf78cf8c66b6a7fc494634deb768abb57fee896cf12959/Delta---Front_HQ.jpeg
			//   https://cortex.persona.co/t/original/i/04f82e42c5d0b714bbdf78cf8c66b6a7fc494634deb768abb57fee896cf12959/Delta---Front_HQ.jpeg -- 3000x3019
			domain === "cortex.persona.co") {
			// https://freight.cargo.site/w/1200/i/020831581b4b569d22934ac3aff325b5998b16ee0bb9f5d5432902c058e4e2a9/KKC_0989_R1.jpg -- 1200x1545
			//   https://freight.cargo.site/t/original/i/020831581b4b569d22934ac3aff325b5998b16ee0bb9f5d5432902c058e4e2a9/KKC_0989_R1.jpg -- 1600x2060
			//   https://freight.cargo.site/i/020831581b4b569d22934ac3aff325b5998b16ee0bb9f5d5432902c058e4e2a9/KKC_0989_R1.jpg -- 1600x2060
			// https://freight.cargo.site/t/original/i/0c8caef327f35c2cca5dc1baf99a071de992cabdeb57850306a64776e8193cdc/KKC_0642_R3.jpg --1600x2060
			return src.replace(/(?:\/(?:[wh](?:\/+[0-9]+)?|t\/+[a-z]+))?\/+i\/+/, "/t/original/i/");
		}

		if (domain === "i.inswave.net" ||
			// http://f.xza.co.kr/f_img.php?p=http://www.starjn.com/data/starjn_com/mainimages/201611/2016110547552954.jpg?wdate=1566871068
			//   http://www.starjn.com/data/starjn_com/mainimages/201611/2016110547552954.jpg?wdate=1566871068
			domain === "f.xza.co.kr") {
			// http://i.inswave.net/img_s.php?u=http://www.yeowonnews.com/data/yeowonnews_com/facebook/8562_2018120235568505.png&w=600&h=398
			//   http://www.yeowonnews.com/data/yeowonnews_com/facebook/8562_2018120235568505.png
			// http://i.inswave.net/f_img.php?p=http://image.newsis.com/2013/03/20/NISI20130320_0007905303_web.jpg
			//   http://image.newsis.com/2013/03/20/NISI20130320_0007905303_web.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/(?:img_s|f_img)\.php\?(?:.*?&)?[up]=([^&]*).*?$/, "$1");
			//newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/f_img\.php\?(?:.*?&)?p=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nowww === "daejonilbo.com") {
			// http://www.daejonilbo.com/admin/news/news_photo/sImg/2017/09/26/20170926001280517.jpg?r_key=8860868177
			//   http://www.daejonilbo.com/admin/news/news_photo/mImg/2017/09/26/20170926001280517.jpg?r_key=8860868177
			//   http://www.daejonilbo.com/admin/news/news_photo/oImg/2017/09/26/20170926001280517.jpg?r_key=8860868177
			return src.replace(/\/news_photo\/+[a-z]Img\/+/, "/news_photo/oImg/");
		}

		if (domain_nowww === "staraz.co.kr") {
			// http://www.staraz.co.kr/Files/9/Images/201812/33991_8218_3441_s.jpg
			//   http://www.staraz.co.kr/Files/9/Images/201812/33991_8218_3441.jpg
			return src.replace(/(\/Files\/+[0-9]+\/+Images\/+[0-9]{6}\/+[0-9]+(?:_[0-9]+){2})_[a-z](\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain === "dy6g3i6a1660s.cloudfront.net") {
			// https://dy6g3i6a1660s.cloudfront.net/8Uz9oR4QQ39KpJJmoCOk9gG_Au4/cl.jpg
			//   https://dy6g3i6a1660s.cloudfront.net/8Uz9oR4QQ39KpJJmoCOk9gG_Au4/orig.jpg
			// https://dy6g3i6a1660s.cloudfront.net/wt5-IVeK2jMQgrGzWlf6WwEsAZA/bb_p.jpg
			//   https://dy6g3i6a1660s.cloudfront.net/wt5-IVeK2jMQgrGzWlf6WwEsAZA/orig.jpg
			// https://dy6g3i6a1660s.cloudfront.net/Crg9tcZzo0ksHCeivGkV2wOEBLA/tlw-9c/elizavetaart/hennalace-inspired-hand-body-paint.jpg
			//   https://dy6g3i6a1660s.cloudfront.net/Crg9tcZzo0ksHCeivGkV2wOEBLA/orig.jpg
			// https://dy6g3i6a1660s.cloudfront.net/iwVqvdz-8UEwr0xeGUtJ4g8ABcg/orig_1x.jpg -- 1920x740
			//   https://dy6g3i6a1660s.cloudfront.net/iwVqvdz-8UEwr0xeGUtJ4g8ABcg/orig.jpg -- 3840x1480
			// https://dy6g3i6a1660s.cloudfront.net/_S02wV9osxlY00whRfDWMQPUApQ/orig-72/pai-skincare.jpg
			//   https://dy6g3i6a1660s.cloudfront.net/_S02wV9osxlY00whRfDWMQPUApQ/orig.jpg
			return src
				.replace(/(:\/\/[^/]*\/[^/]{15,}\/+)[_a-z0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1orig$2")
				.replace(/(:\/\/[^/]*\/[^/]{15,}\/+)([_a-z0-9]+)(?:-[^/]*)?\/.*(\.[^/.]*)$/, "$1$2$3");
		}

		if (domain === "d3pxmkp5ez9u31.cloudfront.net") {
			// https://d3pxmkp5ez9u31.cloudfront.net/sticker/https%3A%2F%2Fdy6g3i6a1660s.cloudfront.net%2FY6UvI09eiv6_-iBaSjQXbQR-BH4%2Fzb_p.jpg
			//   https://dy6g3i6a1660s.cloudfront.net/Y6UvI09eiv6_-iBaSjQXbQR-BH4/orig.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/sticker\/+(http)/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nowww === "dontlinkthis.net") {
			// http://dontlinkthis.net/movies/hires/emmawatson11/thumbnails/Emma19.jpg
			//   http://dontlinkthis.net/movies/hires/emmawatson11/images/Emma19.jpg
			return src.replace(/\/thumbnails\//, "/images/");
		}

		if (domain_nowww === "reho.st") {
			// https://reho.st/thumb/dontlinkthis.net/movies/hires/emmawatson11/images/Emma19.jpg
			//   http://dontlinkthis.net/movies/hires/emmawatson11/images/Emma19.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/thumb\/([^/]*\.[^/]*)/, "$1");
			if (newsrc !== src)
				return add_http(newsrc);
		}

		if (domain_nowww === "funny-anekdot.ru") {
			// https://www.funny-anekdot.ru/up/photos/thumb_p1849.jpg
			//   https://www.funny-anekdot.ru/up/photos/p1849.jpg
			return src.replace(/\/photos\/+thumb_(p[0-9]+\.[^/.]*)(?:[?#].*)?$/, "/photos/$1");
		}

		if (domain === "imagenes.montevideo.com.uy") {
			// https://imagenes.montevideo.com.uy/imgnoticias/200907/_H400/243289.jpg
			//   https://imagenes.montevideo.com.uy/imgnoticias/200907/243289.jpg
			return src.replace(/\/_[WH][0-9]+\//, "/");
		}

		if (domain_nowww === "stars-photos.com") {
			// http://www.stars-photos.com/resize.php?id=2671
			//   http://www.stars-photos.com/image.php?id=2671
			return src.replace(/\/resize\.php.*?[?&](id=[0-9]+).*?$/, "/image.php?$1");
		}

		if (domain_nosub === "at.ua") {
			// https://uups.at.ua/_ph/5/1/542008544.jpg
			//   https://uups.at.ua/_ph/5/542008544.jpg
			// https://uups.at.ua/_ph/6/1/127778340.jpg
			//   https://uups.at.ua/_ph/6/2/127778340.jpg
			// https://girls-wallpaper.at.ua/_ph/8/1/315709145.jpg
			//   https://girls-wallpaper.at.ua/_ph/8/315709145.jpg
			regex = /(\/_ph\/+[0-9]\/+)[0-9]+\/+([0-9]+\.[^/.]*)(?:[?#].*)?$/;
			if (regex.test(src)) {
				return [
					src.replace(regex, "$1$2"),
					src.replace(regex, "$12/$2")
				];
			}
		}

		if (domain_nowww === "missero.ru") {
			// http://missero.ru/images/271838118.jpg
			//   http://missero.ru/photo_full/271838118.jpg
			return src.replace(/\/images\/+/, "/photo_full/");
		}

		if (domain_nosub === "oneniceapp.com" && domain.match(/^img[0-9]*\./)) {
			// http://img08.oneniceapp.com/upload/show/2016/05/29/0e87df6e4311f11ad89d1a7862ba3f1c-show.half.jpg
			//   http://img08.oneniceapp.com/upload/show/2016/05/29/0e87df6e4311f11ad89d1a7862ba3f1c-show.jpg
			return src.replace(/\.half(\.[^/.]*)(?:[?#].*)?$/, "$1");
		}

		if (domain_nowww === "expofashionmagazine.com") {
			// https://www.expofashionmagazine.com/uploads/fotos_noticias/w500px_5110-1394556993.jpg
			//   https://www.expofashionmagazine.com/uploads/fotos_noticias/5110-1394556993.jpg
			// https://www.expofashionmagazine.com/uploads/fotos_noticias/2016/09/w500px_13968-114605.jpg
			//   https://www.expofashionmagazine.com/uploads/fotos_noticias/2016/09/13968-114605.jpg
			return src.replace(/(\/uploads\/+[^/]*\/+(?:[0-9]{4}\/+[0-9]{2}\/+)?)[wh][0-9]+px_/, "$1");
		}

		if (domain_nowww === "maminka.cz") {
			// https://www.maminka.cz/getthumbnail.aspx?w=1600&h=1000&q=60&id_file=529858215
			//   https://www.maminka.cz/getthumbnail.aspx?w=100000&h=100000&q=100&id_file=529858215
			return src.replace(/\/getthumbnail\.aspx.*?[?&](id_file=[0-9]+).*?$/, "/getthumbnail.aspx?w=100000&h=100000&q=100&$1");
		}

		if (domain_nosub === "digitaltrends.com" && domain.match(/^icdn[0-9]*\./)) {
			// https://icdn4.digitaltrends.com/image/benedict-cumberbatch-2-1200x630-c-ar1.91.jpg
			//   https://icdn4.digitaltrends.com/image/benedict-cumberbatch-2.jpg
			// https://icdn2.digitaltrends.com/image/dragon-age-inquisition-multiplayer-header-720x720.jpg?ver=1.jpg
			//   https://icdn2.digitaltrends.com/image/dragon-age-inquisition-multiplayer-header.jpg?ver=1.jpg -- 1920x1080
			return src.replace(/-[0-9]+x[0-9]+(?:-c-ar[0-9.]+)?(\.[^/.]*)(?:[?#].*)?$/, "$1");
		}

		if (domain === "d26oc3sg82pgk3.cloudfront.net") {
			// https://d26oc3sg82pgk3.cloudfront.net/files/media/edit/image/1388/og_image.jpg -- 1200x630, upscaled
			//   https://d26oc3sg82pgk3.cloudfront.net/files/media/edit/image/1388/article_full%402x.jpg -- 1580x900, upscaled
			//   https://d26oc3sg82pgk3.cloudfront.net/files/media/edit/image/1388/large_thumb%403x.jpg -- 2025x1140, upscaled
			//   https://d26oc3sg82pgk3.cloudfront.net/files/media/edit/image/1388/original.jpg -- 970x546
			// https://d26oc3sg82pgk3.cloudfront.net/files/media/edit/image/30891/article_full@3x.jpg -- 2370x1350, upscaled
			//   https://d26oc3sg82pgk3.cloudfront.net/files/media/edit/image/30891/original.jpg -- 1200x800
			// http://d26oc3sg82pgk3.cloudfront.net/files/media/edit/image/30399/original.jpg -- 4210x4281
			return src.replace(/(\/image\/+[0-9]+\/+)[^/.]*(\.[^/.]*)(?:[?#].*)?$/, "$1original$2")
		}

		if (domain_nowww === "glow.pl") {
			// http://glow.pl/site_media/zdjecia/cache/mxT3k5oYCwItnz4E_display.jpg
			//   http://glow.pl/site_media/zdjecia/mxT3k5oYCwItnz4E.jpg
			return src.replace(/(\/site_media\/+[^/]*\/+)cache\/+([^/]*)_[a-z]+(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2$3");
		}

		if (domain_nosub === "qhimgs4.com" && domain.match(/^p[0-9]*\./)) {
			// http://p2.qhimgs4.com/bdr/640__/t019e183489ff01c5cd.jpg
			//   http://p2.qhimgs4.com/t019e183489ff01c5cd.jpg
			return src.replace(/\/bdr\/+[0-9]+__\/+/, "/");
		}

		if (false && domain === "vip.tietu.la") {
			// https://vip.tietu.la/getpic.php?imgsrc=http://images11.app.happyjuzi.com/content/201609/29/57ecde5e0d0c3.jpg
			//   http://images11.app.happyjuzi.com/content/201609/29/57ecde5e0d0c3.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/getpic\.php.*?[?&]imgsrc=(http[^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nosub === "publicbroadcasting.net") {
			// http://mediad.publicbroadcasting.net/p/shared/npr/styles/x_large/nprshared/201501/378856306.jpg
			//   http://mediad.publicbroadcasting.net/p/shared/npr/201501/378856306.jpg
			return {
				url: src.replace(/\/styles\/+[^/]*\/+[^/]*\/+([0-9]{6})\/+/, "/$1/"),
				head_wrong_contentlength: true
			};
		}

		if (domain_nowww === "rabstol.net" ||
			// https://vgtimes.ru/uploads/gallery/thumb/142547/1503408911_8025.jpeg
			//   https://vgtimes.ru/uploads/gallery/main/142547/1503408911_8025.jpeg
			domain_nowww === "vgtimes.ru" ||
			// http://www.youloveit.ru/uploads/gallery/thumb/549/youloveit_ru_selena_gomez_new_foto06.jpg
			//   http://www.youloveit.ru/uploads/gallery/main/549/youloveit_ru_selena_gomez_new_foto06.jpg
			domain_nowww === "youloveit.ru") {
			// http://www.rabstol.net/uploads/gallery/thumb/446/rabstol_net_the_imitation_game_04.jpg
			//   http://www.rabstol.net/uploads/gallery/main/446/rabstol_net_the_imitation_game_04.jpg
			return src.replace(/(\/uploads\/+gallery\/+)[a-z]+(\/+[0-9]+\/+)/, "$1main$2");
		}

		if (amazon_container === "reacho") {
			// https://s3-ap-southeast-1.amazonaws.com/reacho/contentimage/httpimages/260318/690/img_201807030326305ab89b423b991.jpg
			//   https://s3-ap-southeast-1.amazonaws.com/reacho/contentimage/httpimages/260318/img_201807030326305ab89b423b991.jpg
			return src.replace(/(\/httpimages\/+[0-9]+\/+)[0-9]+\/+(img_[0-9]+[0-9a-f]+\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain_nowww === "famavip.com") {
			// https://famavip.com/n/not_314170.jpg
			//   https://famavip.com/lg/not_314170.jpg
			//   https://famavip.com/xl/not_314170.jpg
			return src.replace(/(:\/\/[^/]*\/)(?:n|lg)\/+/, "$1xl/");
		}

		if (domain_nowww === "notifeed.net") {
			// https://notifeed.net/thumb?u=https://www.elintransigente.com/u/fotografias/m/2018/10/30/f800x450-484588_536034_0.jpg&s=3&w=800&h=480
			//   https://www.elintransigente.com/u/fotografias/m/2018/10/30/f800x450-484588_536034_0.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/thumb.*?[?&]u=(http[^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "atmag-static-timeout.netdna-ssl.com") {
			// https://atmag-static-timeout.netdna-ssl.com/media/2017/12/sizes/GettyImages-629416190_wo_500_598.jpg
			//   https://atmag-static-timeout.netdna-ssl.com/media/2017/12/GettyImages-629416190.jpg
			return src.replace(/(\/media\/+[0-9]{4}\/+[0-9]{2}\/+)sizes\/+([^/]*?)_wo_[0-9]+_[0-9]+(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2$3");
		}

		if (domain_nowww === "bliasak.bg") {
			// http://www.bliasak.bg/public-p/g/e/gettyimages-629416190-73902-636x0-98873-810x0.jpg
			//   http://www.bliasak.bg/public-p/g/e/gettyimages-629416190-73902-636x0-98873-original.jpg
			return src.replace(/-[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "-original$1");
		}

		if (domain === "news.data.bg") {
			// http://news.data.bg/storage/news/2017-05-03/856380_300x0.jpg -- 300x404, upscaled?
			//   http://news.data.bg/storage/news/2017-05-03/856380.jpg -- 290x391
			return src.replace(/(\/storage\/+news\/+[0-9]{4}(?:-[0-9]{2}){2}\/+[0-9]+)_[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain_nosub === "blogcu.com" && domain.match(/^img[0-9]*\./)) {
			// http://img04.blogcu.com/v2/images/big/l/i/f/lifedisney/lifedisney_1317543466.jpg
			//   http://img04.blogcu.com/v2/images/orj/l/i/f/lifedisney/lifedisney_1317543466.jpg -- doesn't work
			// http://img04.blogcu.com/v2/images/orj/m/i/l/millbeckylove2/millbeckylove2_132762362568.jpg
			// http://img04.blogcu.com/v2/images/big/s/a/n/sanal-dedikodu/sanal-dedikodu_134252742621.png
			//   http://img04.blogcu.com/v2/images/orj/s/a/n/sanal-dedikodu/sanal-dedikodu_134252742621.png
			return src.replace(/\/v2\/+images\/+[a-z]+\/+/, "/v2/images/orj/");
		}

		if (domain === "img.a9vg.com") {
			// http://img.a9vg.com//2017/03/10/1/s_f681d563783e5e7a15496654bfc10020.jpg
			//   http://img.a9vg.com//2017/03/10/1/f681d563783e5e7a15496654bfc10020.jpg
			return src.replace(/\/s_([0-9a-f]{20,}\.[^/.]*)(?:[?#].*)?$/, "/$1");
		}

		if (domain_nosub === "waikeung.info" && string_indexof(src, "id=ror_grab_ttkzm") >= 0) {
			// https://waikeung.info/plugin.php?id=ror_grab_ttkzm&act=pic&url=http%3A%2F%2Fweeblyimg.com%2Fattachment%2Fforum%2F201709%2F17%2F193154oqpjhpaq5aovjoov.jpg
			//   http://weeblyimg.com/attachment/forum/201709/17/193154oqpjhpaq5aovjoov.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/.*?[?&]url=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "tn.pooh.pw") {
			// http://tn.pooh.pw:81/?https://i.imgur.com/qy5Qrd6.jpg
			//   https://i.imgur.com/qy5Qrd6.jpg
			return src.replace(/^[a-z]+:\/\/[^/]*\/\?(http)/, "$1");
		}

		if (domain_nosub === "animeanime.jp") {
			// https://animeanime.jp/imgs/sq_sl/157389.jpg
			//   https://animeanime.jp/imgs/p/jtKDOVlKAvjRrNw8SXAVejagI61Nrq_oqaqr/157389.jpg -- 360x480
			//   https://animeanime.jp/imgs/p/rQC-FVStleeQ4uCDm4cdn6GgF60oy6_oqaqr/157389.jpg -- 533x709
			//   https://animeanime.jp/imgs/ogp_f/157389.jpg -- 600x798
			//   https://animeanime.jp/imgs/p/sQnw7oxGTTu4umdJ9vPIDqGgI6ytrq_oqaqr/157389.jpg -- 533x709
			// https://animeanime.jp/imgs/p/rQC-FVStleeQ4uCDm4cdn6GgF60oy6_oqaqr/189666.jpg -- 1333x2000
			//   https://animeanime.jp/imgs/ogp_f/189666.jpg -- 600x900
			// https://s.animeanime.jp/imgs/p/sQnw7oxGTTu4umdJ9vPIDqGgI6ytrq_oqaqr/230649.jpg -- 2048x2048
			//   https://s.animeanime.jp/imgs/p/rQC-FVStleeQ4uCDm4cdn6GgF60oy6_oqaqr/230649.jpg -- 1024x1024
			// https://animeanime.jp/imgs/slider/260061.png
			//   https://animeanime.jp/imgs/p/sQnw7oxGTTu4umdJ9vPIDqGgI6ytrq_oqaqr/260061.png
			// https://animeanime.jp/imgs/list_ml/265233.jpg
			//   https://animeanime.jp/imgs/p/sQnw7oxGTTu4umdJ9vPIDqGgI6ytrq_oqaqr/265233.jpg
			// https://animeanime.jp/imgs/p/F0wY7sTvXbM-zUyY3Ct0qjajM6ytrq_oqaqr/113500.jpg
			//   https://animeanime.jp/imgs/p/sQnw7oxGTTu4umdJ9vPIDqGgI6ytrq_oqaqr/113500.jpg
			// https://s.animeanime.jp/imgs/p/GAauWYP2lbxlzgJRQBgLncSmE68prq_oqaqr/183050.jpg
			//   https://s.animeanime.jp/imgs/p/sQnw7oxGTTu4umdJ9vPIDqGgI6ytrq_oqaqr/183050.jpg
			// https://s.animeanime.jp/imgs/p/qC3cX52_w9YJ28j7VPltKcSgI60Yrq_oqaqr/189365.jpg
			//   https://s.animeanime.jp/imgs/p/sQnw7oxGTTu4umdJ9vPIDqGgI6ytrq_oqaqr/189365.jpg
			// https://animeanime.jp/imgs/p/ypfYP8UGHHv1ocFz1cgmQGihmaytrq_oqaqr/150033.jpg
			//   https://animeanime.jp/imgs/p/sQnw7oxGTTu4umdJ9vPIDqGgI6ytrq_oqaqr/150033.jpg
			return src.replace(/\/imgs\/+(?:[^/]*|p\/+(?:jtKDOVlKAvjRrNw8SXAVejagI61Nrq|ypfYP8UGHHv1ocFz1cgmQGihmaytrq|qC3cX52_w9YJ28j7VPltKcSgI60Yrq|GAauWYP2lbxlzgJRQBgLncSmE68prq|F0wY7sTvXbM-zUyY3Ct0qjajM6ytrq|rQC-FVStleeQ4uCDm4cdn6GgF60oy6)_oqaqr)\/+([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/imgs/p/sQnw7oxGTTu4umdJ9vPIDqGgI6ytrq_oqaqr/$1");
		}

		if (domain_nosub === "response.jp" ||
			// https://s.inside-games.jp/imgs/p/1UNSdyJKsYSbpw0t-zkIAAoLiAcGBQQDAgEA/511356.jpg?thumbnailize=zoom -- 6016x4000
			// https://www.inside-games.jp/imgs/p/PseAHU_gq3GEwRLM5htwMwoLvAaDYAQDAgEA/416943.jpg -- 1152x864
			//   https://www.inside-games.jp/imgs/p/1UNSdyJKsYSbpw0t-zkIAAoLiAcGBQQDAgEA/416943.jpg -- 4608x3456
			// https://www.inside-games.jp/imgs/ogp_f/743773.jpg
			//   https://www.inside-games.jp/imgs/p/1UNSdyJKsYSbpw0t-zkIAAoLiAcGBQQDAgEA/743773.jpg
			domain_nosub === "inside-games.jp" ||
			// https://www.gamebusiness.jp/imgs/p/bo91TFR6ywNB2t2bceYnWYiJCoWEh4aBgIOC/40014.jpg?thumbnailize=zoom -- 4320x3240
			// https://www.gamebusiness.jp/imgs/ogp_f/69548.jpg
			//   https://www.gamebusiness.jp/imgs/p/bo91TFR6ywNB2t2bceYnWYiJCoWEh4aBgIOC/69548.jpg
			// https://www.gamebusiness.jp/imgs/p/jvknf3IEEkcTVcSof0Ss9buJCoTsh4aBgIOC/75928.jpg
			//   https://www.gamebusiness.jp/imgs/p/bo91TFR6ywNB2t2bceYnWYiJCoWEh4aBgIOC/75928.jpg
			domain_nosub === "gamebusiness.jp" ||
			// https://s.rbbtoday.com/imgs/p/O24ii8l5s579T1Z71xNOb0xNzkFAQ0JFREdG/381072.jpg?thumbnailize=zoom -- 7360x4912
			// https://s.rbbtoday.com/imgs/zoom/599903.jpg
			//   https://s.rbbtoday.com/imgs/p/O24ii8l5s579T1Z71xNOb0xNzkFAQ0JFREdG/599903.jpg
			// https://www.rbbtoday.com/imgs/ogp_f/647887.jpg
			//   https://www.rbbtoday.com/imgs/p/O24ii8l5s579T1Z71xNOb0xNzkFAQ0JFREdG/647887.jpg
			domain_nosub === "rbbtoday.com" ||
			// https://s.cyclestyle.net/imgs/p/SG6XwypJr-L-0cc0vCoMDigpqiUkJyYhICMi/28737.jpg?thumbnailize=zoom -- 3744x5616
			// http://cyclestyle.net/imgs/ogp_f/300191.jpg
			//   http://cyclestyle.net/imgs/p/SG6XwypJr-L-0cc0vCoMDigpqiUkJyYhICMi/300191.jpg
			domain_nosub === "cyclestyle.net" ||
			// https://s.resemom.jp/imgs/p/iznZhtjPh4xcpFmdtjU2rkRFxklIS0pNTE9O/85649.jpg?thumbnailize=zoom -- 6000x4000
			// https://resemom.jp/imgs/ogp_f/243379.jpg
			//   https://resemom.jp/imgs/p/iznZhtjPh4xcpFmdtjU2rkRFxklIS0pNTE9O/243379.jpg
			domain_nosub === "resemom.jp" ||
			// https://www.cinemacafe.net/imgs/std_l1/448352.jpg
			//   https://www.cinemacafe.net/imgs/p/JgD9AR1Ir8Z47f6Bz3cIbgIDgA8ODQwLCgkI/448352.jpg -- 2048x1668
			// https://www.cinemacafe.net/imgs/std_m1/444453.jpg
			//   https://www.cinemacafe.net/imgs/p/JgD9AR1Ir8Z47f6Bz3cIbgIDgA8ODQwLCgkI/444453.jpg
			// https://www.cinemacafe.net/imgs/thumb_h1/69950.jpg
			//   https://www.cinemacafe.net/imgs/p/JgD9AR1Ir8Z47f6Bz3cIbgIDgA8ODQwLCgkI/69950.jpg
			// https://www.cinemacafe.net/imgs/p/IdF3CXec7ZLwPC0QhNLSvQMCOg0oDQwLCgkI/448340.jpg
			//   https://www.cinemacafe.net/imgs/p/JgD9AR1Ir8Z47f6Bz3cIbgIDgA8ODQwLCgkI/448340.jpg
			// https://www.cinemacafe.net/imgs/p/5Fc34EuXLG5x2tdPmpNB1GcDWA6eDQwLCgkI/448334.jpg
			//   https://www.cinemacafe.net/imgs/p/JgD9AR1Ir8Z47f6Bz3cIbgIDgA8ODQwLCgkI/448334.jpg
			// https://s.cinemacafe.net/imgs/p/cj-SRmM3m7t9_NMtR4JzwmcFsAyKDQwLCgkI/195963.jpg
			//   https://s.cinemacafe.net/imgs/p/JgD9AR1Ir8Z47f6Bz3cIbgIDgA8ODQwLCgkI/195963.jpg
			// https://www.cinemacafe.net/imgs/p/ATDRThl-6oWF9fpps9341csCOg8ODQwLCgkI/447945.jpg
			//   https://www.cinemacafe.net/imgs/p/JgD9AR1Ir8Z47f6Bz3cIbgIDgA8ODQwLCgkI/447945.jpg
			// https://www.cinemacafe.net/imgs/p/teqw5JmZv-V68YYR3gF-gmcAmg4dDQwLCgkI/448809.jpg
			//   https://www.cinemacafe.net/imgs/p/JgD9AR1Ir8Z47f6Bz3cIbgIDgA8ODQwLCgkI/448809.jpg
			// https://s.cinemacafe.net/imgs/p/Qzvyd5pnwLoLt2fXuJAbsjEByA-GDQwLCgkI/11766.jpg
			//   https://s.cinemacafe.net/imgs/p/JgD9AR1Ir8Z47f6Bz3cIbgIDgA8ODQwLCgkI/11766.jpg
			// https://www.cinemacafe.net/imgs/p/FHVB2qV5ZZzNwK7ACSeDrgIDtA6LaAwLCgkI/121905.jpg
			//   https://www.cinemacafe.net/imgs/p/JgD9AR1Ir8Z47f6Bz3cIbgIDgA8ODQwLCgkI/121905.jpg
			// https://s.cinemacafe.net/imgs/p/BJtgHx1uckDhTMJk9wdIh5UDvA0DDQwLCgkI/418853.jpg
			//   https://s.cinemacafe.net/imgs/p/JgD9AR1Ir8Z47f6Bz3cIbgIDgA8ODQwLCgkI/418853.jpg
			// https://s.cinemacafe.net/imgs/p/NEpHt5A8X3pD8ze5AiAOOWcAdw4ODQwLCgkI/134164.jpg
			//   https://s.cinemacafe.net/imgs/p/JgD9AR1Ir8Z47f6Bz3cIbgIDgA8ODQwLCgkI/134164.jpg
			// https://www.cinemacafe.net/imgs/rel_m1/185213.jpg
			//   https://www.cinemacafe.net/imgs/p/JgD9AR1Ir8Z47f6Bz3cIbgIDgA8ODQwLCgkI/185213.jpg
			// https://s.cinemacafe.net/imgs/p/JgD9AR1Ir8Z47f6Bz3cIbgIDgA8ODQwLCgkI/120463.jpg?thumbnailize=zoom -- 7360x4912 (same without thumbnailize=zoom)
			domain_nosub === "cinemacafe.net" ||
			// https://www.gamespark.jp/imgs/ogp_f/307336.jpg
			//   https://www.gamespark.jp/imgs/p/PseAHU_gq3GEwRLM5htwMwoLvAaDYAQDAgEA/307336.jpg -- 1024x576
			// https://www.gamespark.jp/imgs/p/PseAHU_gq3GEwRLM5htwMwoLvAaDYAQDAgEA/83073.png -- 3050x2233
			// https://www.gamespark.jp/imgs/p/YqPw1SnBMRmYIkmrbU1O_DkImAYqBQQDAgEA/308568.jpg
			//   https://www.gamespark.jp/imgs/p/yFIzVel2FK9SeCSMtovYejkIJAfnBQQDAgEA/308568.jpg
			//   https://www.gamespark.jp/imgs/p/PseAHU_gq3GEwRLM5htwMwoLvAaDYAQDAgEA/308568.jpg
			// https://www.gamespark.jp/imgs/zoom/239382.png
			//   https://www.gamespark.jp/imgs/p/PseAHU_gq3GEwRLM5htwMwoLvAaDYAQDAgEA/239382.png
			// https://www.gamespark.jp/imgs/p/d19fJzDIFCH7XlqenqofxzkLiAatBQQDAgEA/331923.jpg
			//   https://www.gamespark.jp/imgs/p/PseAHU_gq3GEwRLM5htwMwoLvAaDYAQDAgEA/331923.jpg
			// https://www.gamespark.jp/imgs/p/w1yUNxfzLf6iwt3Eey88jjkI6AZGBQQDAgEA/325638.jpg
			//   https://www.gamespark.jp/imgs/p/PseAHU_gq3GEwRLM5htwMwoLvAaDYAQDAgEA/325638.jpg
			// https://www.gamespark.jp/imgs/p/XDbCbghKzVCeRs9WXItNCQoLUAcGBQQDAgEA/99589.jpg?zoom=spacing
			//   https://www.gamespark.jp/imgs/p/PseAHU_gq3GEwRLM5htwMwoLvAaDYAQDAgEA/99589.jpg?zoom=spacing
			// https://www.gamespark.jp/imgs/p/rKjJghwJABdtg-7FAeGmXzkJ1AejBQQDAgEA/331925.jpg
			//   https://www.gamespark.jp/imgs/p/PseAHU_gq3GEwRLM5htwMwoLvAaDYAQDAgEA/331925.jpg
			// https://www.gamespark.jp/imgs/p/Up2FUwfg_STscOmZfda3dm8NuASCBQQDAgEA/243604.jpg
			//   https://www.gamespark.jp/imgs/p/PseAHU_gq3GEwRLM5htwMwoLvAaDYAQDAgEA/243604.jpg
			// https://img.gamespark.jp/imgs/zoom/124504.jpg
			// https://s.gamespark.jp/imgs/p/DECG0YPrj3VfE9VDCfubi28LiAazBQQDAgEA/102286.jpg
			//   https://s.gamespark.jp/imgs/p/PseAHU_gq3GEwRLM5htwMwoLvAaDYAQDAgEA/102286.jpg
			// https://s.gamespark.jp/imgs/p/d8IRfSCmFXPaJb844BSE_jkJwAfOBQQDAgEA/28450.jpg
			//   https://s.gamespark.jp/imgs/p/PseAHU_gq3GEwRLM5htwMwoLvAaDYAQDAgEA/28450.jpg
			domain_nosub === "gamespark.jp" ||
			// thanks to fireattack on github: https://github.com/qsniyg/maxurl/issues/975
			// https://cho-animedia.jp/imgs/p/eA_jHH731ym-h0rZ1IS6nKjOWcBXwsPExcbH/321900.jpg
			//   https://cho-animedia.jp/imgs/p/Dybu1wcglzgN6YILHHa9fs3Ml8DBwsPExcbH/321900.jpg
			// https://cho-animedia.jp/imgs/p/eA_jHH731ym-h0rZ1IS6nKjOWcBXwsPExcbH/12527.jpg
			//   https://cho-animedia.jp/imgs/p/Dybu1wcglzgN6YILHHa9fs3Ml8DBwsPExcbH/12527.jpg -- 2500x1771
			domain_nowww === "cho-animedia.jp" ||
			// https://s.spyder7.com/imgs/p/X4UiqBKWADm8lT-ssAf7B9LTUN-e3dzb2tnY/134234.jpg?thumbnailize=zoom -- 2048x1365, no larger image found, so might not be orig
			// https://spyder7.com/imgs/p/6ctlLP6jpu3fsvWRdHSre9LTZN5buNzb2tnY/16841.jpg
			//   https://spyder7.com/imgs/p/X4UiqBKWADm8lT-ssAf7B9LTUN-e3dzb2tnY/16841.jpg
			domain_nosub === "spyder7.com") {
			// https://s.response.jp/imgs/p/szHjNsab8jnsrICkTcBeik1MF0BBQkNERUZH/730629.jpg?thumbnailize=zoom -- 5360x8136, 3827065
			// https://s.response.jp/imgs/p/zkztXxppQllf4-RUXYhKtU1Mz0BBQkNERUZH/730629.jpg?thumbnailize=zoom -- 5360x8135, 3827065
			// https://response.jp/imgs/p/jMij-aO9UgKPyct8JM4jSX5Oh0DXQkNERUZH/1456013.jpg
			//   https://response.jp/imgs/p/zkztXxppQllf4-RUXYhKtU1Mz0BBQkNERUZH/1456013.jpg --1600x1200
			// https://response.jp/imgs/ogp_f/1370333.jpg
			//   https://response.jp/imgs/p/zkztXxppQllf4-RUXYhKtU1Mz0BBQkNERUZH/1370333.jpg
			// https://s.response.jp/imgs/p/XHAW6qEKbkuCIphd0G23SChK-0PFQkNERUZH/888930.jpg
			//   https://s.response.jp/imgs/p/zkztXxppQllf4-RUXYhKtU1Mz0BBQkNERUZH/888930.jpg

			var orig = null;

			if (domain_nosub === "response.jp")
				orig = "zkztXxppQllf4-RUXYhKtU1Mz0BBQkNERUZH";
			else if (domain_nosub === "spyder7.com")
				orig = "X4UiqBKWADm8lT-ssAf7B9LTUN-e3dzb2tnY";
			else if (domain_nosub === "inside-games.jp")
				orig = "1UNSdyJKsYSbpw0t-zkIAAoLiAcGBQQDAgEA";
			else if (domain_nosub === "gamebusiness.jp")
				orig = "bo91TFR6ywNB2t2bceYnWYiJCoWEh4aBgIOC";
			else if (domain_nosub === "rbbtoday.com")
				orig = "O24ii8l5s579T1Z71xNOb0xNzkFAQ0JFREdG";
			else if (domain_nosub === "cyclestyle.net")
				orig = "SG6XwypJr-L-0cc0vCoMDigpqiUkJyYhICMi";
			else if (domain_nosub === "resemom.jp")
				orig = "iznZhtjPh4xcpFmdtjU2rkRFxklIS0pNTE9O";
			else if (domain_nosub === "cinemacafe.net")
				orig = "JgD9AR1Ir8Z47f6Bz3cIbgIDgA8ODQwLCgkI";
			else if (domain_nosub === "gamespark.jp")
				orig = "PseAHU_gq3GEwRLM5htwMwoLvAaDYAQDAgEA";
			else if (domain_nosub === "cho-animedia.jp")
				orig = "Dybu1wcglzgN6YILHHa9fs3Ml8DBwsPExcbH";

			return src.replace(/\/imgs\/+(?:[^/]*|p\/+[^/]{30,})\/+([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/imgs/p/" + orig + "/$1");
		}

		if (domain_nowww === "pixsell.hr") {
			// thanks to heptal on github (#85)
			// https://www.pixsell.hr/scripts/get_image.php?image_id=21859428&var_suff=640x640
			//   https://www.pixsell.hr/scripts/get_image.php?image_id=21859428 -- 1600x1067
			newsrc = src.replace(/\/scripts\/+get_image\.php.*?[?&](image_id=[0-9]+).*?$/, "/scripts/get_image.php?$1");
			if (newsrc !== src)
				return newsrc;

			if (src.match(/\/scripts\/+get_image\.php\?image_id=[0-9]+$/)) {
				return {
					url: src,
					filename: src.replace(/.*image_id=([0-9]+)$/, "$1")
				};
			}
		}

		if (domain_nowww === "sharecg.com") {
			// https://www.sharecg.com/images/thumb/175454.jpg
			//   https://sharecg.com/images/medium/175454.jpg
			//   https://sharecg.com/images/original/175454.jpg
			// https://sharecg.com/get_image.php?type=large&upload_image_id=175454
			//   https://sharecg.com/images/original/175454.jpg
			return src
				.replace(/\/images\/+[a-z]+\/+([0-9]+\.[^/.]+)(?:[?#].*)?$/, "/images/original/$1")
				.replace(/\/get_image\.php\?(?:.*&)?upload_image_id=([0-9]+).*?$/, "/images/original/$1.jpg");
		}

		if (domain_nowww === "softline.com.bd" ||
			// https://softline.uz/uploads/resizer/i/ab/66/f5/b1/66/62/0a/b7/1f/origin_png-mode2-198x89.png
			//   https://softline.uz/uploads/i/ab/66/f5/b1/66/62/0a/b7/1f/origin.png
			domain_nowww === "softline.uz") {
			// https://softline.com.bd/uploads/resizer/i/ec/77/95/b1/67/de/0e/c8/29/origin_png-mode2-170x80.png
			//   https://softline.com.bd/uploads/i/ec/77/95/b1/67/de/0e/c8/29/origin.png
			return src.replace(/\/uploads\/+resizer\/+i\/+((?:[0-9a-f]{2}\/+){8,}origin)_([a-z]+)-[^/]*(?:[?#].*)?$/,
							   "/uploads/i/$1.$2");
		}

		if (googlestorage_container === "wzukusers") {
			// https://storage.googleapis.com/wzukusers/user-25639118/images/5b5217fb4029aklDaWUQ/Adobe_logo_d200.png
			//   https://storage.googleapis.com/wzukusers/user-25639118/images/5b5217fb4029aklDaWUQ/Adobe_logo.png
			return src.replace(/(\/images\/+[0-9a-zA-Z]+\/+[^/]*)_d[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "mindmaps.ai-pharma.dka.global") {
			// https://mindmaps.ai-pharma.dka.global/storage/logos_100px/Adobe.png
			//   https://mindmaps.ai-pharma.dka.global/storage/logos/Adobe.png
			return src.replace(/(\/storage\/+[^/]*)_[0-9]+px\/+/, "$1/");
		}

		if (domain_nowww === "ibusiness.de") {
			// https://www.ibusiness.de/cgi-bin/resize/upload/bilder/584804grollmann.png?maxwidth=342&maxheight=142
			//   https://www.ibusiness.de/upload/bilder/584804grollmann.png
			return src.replace(/\/cgi-bin\/+resize\/+(upload\/+bilder\/+[^/]*?)(?:[?#].*)?$/, "/$1");
		}

		if (domain_nowww === "picadilist.fr") {
			// https://picadilist.fr/mini/img_390_250/adobe_logo.png
			//   https://picadilist.fr/images/upload_gen/adobe_logo.png
			return src.replace(/\/mini\/+img_[0-9]+_[0-9]+\/+/, "/images/upload_gen/");
		}

		if (domain_nowww === "mirrorlessreports.com" ||
			// https://www.canonnews.com/Portals/0/EasyDNNNews/1212/650650p953EDNmainimg-adobe-logo.png
			//   https://www.canonnews.com/Portals/0/EasyDNNNews/1212/img-adobe-logo.png
			domain_nowww === "canonnews.com") {
			// https://www.mirrorlessreports.com/Portals/0/EasyDNNNews/202/600600p407EDNmainimg-adobe-logo.png
			//   https://www.mirrorlessreports.com/Portals/0/EasyDNNNews/202/img-adobe-logo.png
			return src.replace(/\/[^-/.]*?(img-[^/]*\.[^/.]*)(?:[?#].*)?$/, "/$1");
		}

		if (domain === "d9j5qtehtodpj.cloudfront.net") {
			// https://d9j5qtehtodpj.cloudfront.net/thumbnail/?image=84fc5ae4578c11e89c4c12ac0e9facb0&maxWidth=800&fittedCrop=0&version=190109
			//   https://d9j5qtehtodpj.cloudfront.net/media/84fc5ae4578c11e89c4c12ac0e9facb0/image -- 2048x850
			// "image" could be anything, with any extension
			return src.replace(/\/thumbnail\/.*?[?&]image=([0-9a-f]+).*?$/, "/media/$1/image");
		}

		if (domain === "cdn.46graus.com") {
			// https://cdn.46graus.com/files/portfolio/9550/6cc87420-4837-44ed-92be-217f566c310d/600_965398fe-a919-498e-a206-d9e06a816d33.jpg
			//   https://cdn.46graus.com/files/portfolio/9550/6cc87420-4837-44ed-92be-217f566c310d/original_965398fe-a919-498e-a206-d9e06a816d33.jpg
			return src.replace(/(\/files\/+portfolio\/+[^/]*\/+[-0-9a-f]+\/+)[^/]*_([-0-9a-f]+\.[^/.]*)(?:[?#].*)?$/,
							   "$1original_$2");
		}

		if (domain_nowww === "spirig-schulungscenter.ch") {
			// https://www.spirig-schulungscenter.ch/uploads/JBro5WZT/737x0_2500x0/Adobe.png
			//   https://www.spirig-schulungscenter.ch/uploads/JBro5WZT/Adobe.png
			return src.replace(/(\/uploads\/+[^/]*\/+)[0-9]+x[0-9]+_[0-9]+x[0-9]+\/+/, "$1");
		}

		if (domain === "static.caravan.kz") {
			// https://static.caravan.kz/image/320/200/523066.jpg
			//   https://static.caravan.kz/image/523066.jpg
			return src.replace(/\/image\/+[0-9]+\/+[0-9]+\/+([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/image/$1");
		}

		if (domain_nosub === "crhoy.net" && domain.match(/^icdn[0-9]*\./)) {
			// this rule might need to be improved, it's quite strict
			// https://icdn2.crhoy.net/w/390/h/0/q/95/png/0/c/1/s/pull.crhoy.net/imagenes/2019/06/1-1-1.jpg
			//   http://pull.crhoy.net/imagenes/2019/06/1-1-1.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/(?:[whq]\/+[0-9]+\/+){1,}[a-z]+\/+[0-9]+\/+c\/+[0-9]+\/+s\/+([^/]*\.[^/]*\/+)/,
								 "$1");
			if (newsrc !== src)
				return add_http(newsrc);
		}

		if (domain_nosub === "ppstatic.pl") {
			// https://d-pt.ppstatic.pl/kadry/k/r/1/ec/34/5cfe1c641cc1a_o,size,445x270,q,71,h,b9f944.jpg
			//   https://d-pt.ppstatic.pl/kadry/k/r/1/ec/34/5cfe1c641cc1a_o.jpg -- 1920x1080
			return src.replace(/(\/[^/.,]*)(?:,(?:size|[whq]),[^/,.]*){1,}(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nosub === "uzone.id" && domain.match(/^cdn[0-9]*\./)) {
			// https://cdn4.uzone.id//assets/uploads/Uzone/Games/cyberpunk-2077-xbox-microsoft.png/600
			//   https://cdn4.uzone.id//assets/uploads/Uzone/Games/cyberpunk-2077-xbox-microsoft.png -- 843x471
			return src.replace(/(\/assets\/+uploads\/+.*?)\/+[0-9]+(?:[?#].*)?$/, "$1");
		}

		if (amazon_container === "fuckin.news") {
			// https://s3-eu-west-1.amazonaws.com/fuckin.news/posts/images/000/101/639/large/open-uri20190610-1-qdzjat?1560155811.jpeg
			//   https://s3-eu-west-1.amazonaws.com/fuckin.news/posts/images/000/101/639/original/open-uri20190610-1-qdzjat?1560155811.jpeg
			return src.replace(/(\/posts\/+images\/+(?:[0-9]{3}\/+){3})[a-z]+\/+/, "$1original/");
		}

		if (domain_nowww === "dengekionline.com") {
			// https://dengekionline.com/images/dVHE/A88R/u5xG/5Wdf/VIZPPG2bt6tsZSrVCbfZfqeDhnGXcfH8YvcDCWc2GTr9VjAzISio7lOfggYvNbQePJc8KUrumJRUg65e_main.jpg
			//   https://dengekionline.com/images/dVHE/A88R/u5xG/5Wdf/VIZPPG2bt6tsZSrVCbfZfqeDhnGXcfH8YvcDCWc2GTr9VjAzISio7lOfggYvNbQePJc8KUrumJRUg65e.jpg
			return src.replace(/(\/images\/+.*?)_main(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "hypnoweb.net") {
			// https://www.hypnoweb.net/photo/2/3691/mini/4-choup37.jpg
			//   https://www.hypnoweb.net/photo/2/3691/ok/4-choup37.jpg -- 290x450
			return src.replace(/(\/photo\/+[0-9]+\/+[^/]*\/+)mini\/+/, "$1ok/");
		}

		if (domain_nowww === "allbox.tv") {
			// https://allbox.tv/static/people/1/1313/f09696910bdd874a99cd74c8f05b5c44_small.jpg
			//   https://allbox.tv/static/people/1/1313/f09696910bdd874a99cd74c8f05b5c44.jpg
			return src.replace(/(\/[0-9a-f]+)_small(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "api.superguidatv.it") {
			// https://api.superguidatv.it/v1/actors/17445/profileImage?width=120
			//   https://api.superguidatv.it/v1/actors/17445/profileImage -- redirects to:
			//   https://api.superguidatv.it/v1/actors/17445/profileImage?width=360
			// https://api.superguidatv.it/v1/movies/8160/backdrops/1 -- redirects to:
			//   https://api.superguidatv.it/v1/movies/8160/backdrops/1?width=640
			return {
				url: src.replace(/\?.*/, ""),
				redirects: true
			}
		}

		if (domain === "cloud.filmfed.com") {
			// https://cloud.filmfed.com/people/avatars/s_b6bbb1f3-e610-4019-aebf-b38e4e304005.jpg -- 366x549
			//   https://cloud.filmfed.com/people/avatars/o_b6bbb1f3-e610-4019-aebf-b38e4e304005.jpg -- 1066x1600
			return src.replace(/\/[a-z]_([0-9a-f]+(?:-[0-9a-f]+){2,}\.[^/.]*)(?:[?#].*)?$/, "/o_$1");
		}

		if (domain === "images.hi67.cn") {
			// http://images.hi67.cn/hi67/1/cf75539369c523fa373ee9e221337c86_compress.jpg
			//   http://images.hi67.cn/hi67/cf75539369c523fa373ee9e221337c86.jpg -- doesn't work
			// http://images.hi67.cn/hi67/1/ce381764eb5b57db4e172d962f3696eb_compress.jpg -- 2560x1600
			// http://images.hi67.cn/hi67/7fec9463dbb82ffe62482393d823e1.jpg -- 2560x1600
			return {
				url: src,
				headers: {
					Referer: "",
					Origin: ""
				}
			};
		}

		if (domain === "midiastm.gazetaonline.com.br" ||
			// https://static.gazetaonline.com.br/_midias/jpg/2018/12/10/290x330/1_bruna_guio-5912648.jpg
			//   https://static.gazetaonline.com.br/_midias/jpg/2018/12/10/bruna_guio-5912648.jpg
			domain === "static.gazetaonline.com.br") {
			// https://midiastm.gazetaonline.com.br/_midias/jpg/2019/06/17/290x175/1_ratinho_e_silvio_santos-6193179.jpg
			//   https://midiastm.gazetaonline.com.br/_midias/jpg/2019/06/17/ratinho_e_silvio_santos-6193179.jpg
			return src.replace(/\/[0-9]+x[0-9]+\/+[0-9]+_([^/]*)(?:[?#].*)?$/, "/$1");
		}

		if (domain_nosub === "gifposter.com" && string_indexof(src, "/images/") >= 0) {
			// https://star.gifposter.com/images/Emma-Stone/wallpaper/s_5.jpg
			//   https://star.gifposter.com/images/Emma-Stone/wallpaper/m_5.jpg
			//   https://star.gifposter.com/images/Emma-Stone/wallpaper/p_5.jpg -- 1080x1596
			// https://star.gifposter.com/images/Michelle-Pfeiffer/poster/p_1.jpg -- 2283x3110
			// http://h2.gifposter.com/images/Emily-Blunt/wallpaper/p_11.jpg_ws
			//   http://h2.gifposter.com/images/Emily-Blunt/wallpaper/p_11.jpg
			return src.replace(/\/[a-z](_[0-9]+\.[^/.]*?)(?:_[a-z]+)?(?:[?#].*)?$/, "/p$1");
		}

		if (domain_nowww === "xiuren.org") {
			// http://www.xiuren.org/cover.php?src=http://www.xiuren.org//images/2019/09/1604043574.jpg
			//   http://www.xiuren.org//images/2019/09/1604043574.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+cover\.php\?(?:.*?&)?src=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);

			// http://www.xiuren.org/xiuren/XiuRen-N00001/Thum/Thum-XiuRen-N00001-Viki-0006.jpg
			//   http://www.xiuren.org/xiuren/XiuRen-N00001/XiuRen-N00001-Viki-0006.jpg
			return src.replace(/\/Thum\/+Thum-/, "/");
		}

		if (domain_nowww === "haipic.com") {
			// http://www.haipic.com/icon/s_2367e62d5909d.jpg
			//   http://www.haipic.com/icon/7e62d5909d.jpg
			return src.replace(/(\/icon\/+)[a-z]_[0-9]{3}([0-9a-f]+\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "photo.l99.com") {
			// http://photo.l99.com/bigger/23/1412094474230_1dt6uy.jpg
			//   http://photo.l99.com/source/23/1412094474230_1dt6uy.jpg
			return src.replace(/(:\/\/[^/]*\/)[a-z]+\/+/, "$1source/");
		}

		if (domain_nowww === "cinemapassion.com") {
			// http://www.cinemapassion.com/miniature2.php?pic=http://www.cinemapassion.com/lesaffiches/Ant-Man-et-la-Guepe-affiche-17207.jpg
			//   http://www.cinemapassion.com/lesaffiches/Ant-Man-et-la-Guepe-affiche-17207.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/miniature2\.php.*?[?&]pic=(http[^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (amazon_container === "abandomedia") {
			// https://s3-eu-west-1.amazonaws.com/abandomedia/db/poster_thumb/db_posters_44164.jpg
			//   https://s3-eu-west-1.amazonaws.com/abandomedia/db/poster/db_posters_44164.jpg
			// https://s3-eu-west-1.amazonaws.com/abandomedia/db/thumb/db_44389_9.jpg
			//   https://s3-eu-west-1.amazonaws.com/abandomedia/db/foto/db_44389_9.jpg
			return src
				.replace(/(\/db\/+)thumb\/+/, "$1foto/")
				.replace(/(\/db\/+[a-z]+)_thumb\/+/, "$1/");
		}

		if (domain_nowww === "arlingtonhotelgroup.com") {
			// http://arlingtonhotelgroup.com/ps/films/120@170._V2_5b509826b0ae6.jpg
			//   http://arlingtonhotelgroup.com/ps/films/@._V2_5b509826b0ae6.jpg -- 433x590
			return src.replace(/\/[0-9]+@[0-9]+\./, "/@.");
		}

		if (domain_nowww === "cine-vox.com" ||
			// https://www.cinemorvan.fr/evenement/300x1240/Ant-man___la_guepe.jpg
			//   https://www.cinemorvan.fr/evenement/Ant-man___la_guepe.jpg
			domain_nowww === "cinemorvan.fr") {
			// https://www.cine-vox.com/evenement/155x0/Ant-man_2.jpg
			//   https://www.cine-vox.com/evenement/Ant-man_2.jpg
			return src.replace(/(:\/\/[^/]*\/+[^/]*\/+)[0-9]+x[0-9]+\/+([^/]*\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "cdnscreenshot.xyz") {
			// http://cdnscreenshot.xyz/retail.php?src=http://fr.web.img5.acsta.net/pictures/18/06/08/14/35/0842353.jpg&h=214&w=160
			//   http://fr.web.img5.acsta.net/pictures/18/06/08/14/35/0842353.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/retail\.php.*?[?&]src=(http[^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nowww === "comic.systems") {
			// https://comic.systems/images/Disney/Marvel-AntManetlaGuepe/Marvel-AntManetlaGuepe-affiche-8791-thumb
			//   https://comic.systems/images/Disney/Marvel-AntManetlaGuepe/Marvel-AntManetlaGuepe-affiche-8791
			return src.replace(/(\/images\/.*?)-thumb(?:[?#].*)?$/, "$1");
		}

		if (domain_nosub === "gittigidiyor.net") {
			// https://mcdn01.gittigidiyor.net/40675/tn30/406751864_tn30_0.jpg
			//   https://mcdn01.gittigidiyor.net/40675/406751864_0.jpg
			return src.replace(/(\/[0-9]+\/+)tn[0-9]+\/+([0-9]+)_tn[0-9]+(_[0-9]+\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2$3");
		}

		if (domain_nowww === "impawards.com") {
			// http://www.impawards.com/2018/posters/med_antman_and_the_wasp_ver11.jpg
			//   http://www.impawards.com/2018/posters/antman_and_the_wasp_ver11_xxlg.jpg -- 1503x2048
			// thanks to anonymous for reporting:
			// http://www.impawards.com/2024/thumbs/daddio_ver2.jpg
			//   http://www.impawards.com/2024/posters/daddio_ver2_xxlg.jpg -- 1934x2866
			return {
				url: src
					.replace(/(\/(?:20|19)[0-9]{2}\/+)thumbs\/+/, "$1posters/")
					.replace(/\/med_([^/]*)(?:[?#].*)?$/, "/$1")
					.replace(/(?:_xx?lg)?(\.[^/.]*)(?:[?#].*)?$/, "_xxlg$1"),
				headers: {
					Referer: "",
					Origin: ""
				}
			};
		}

		if (domain_nowww === "lescinemasaixois.com") {
			// https://www.lescinemasaixois.com/films/affiche/affiche_12202.jpg&w=270&h=360&zc=1?ts=1532525716
			//   https://www.lescinemasaixois.com/films/affiche/affiche_12202.jpg?w=270&h=360&zc=1?ts=1532525716
			//   https://www.lescinemasaixois.com/films/affiche/affiche_12202.jpg
			return src.replace(/(\/affiche\/+affiche_[0-9]+\.[^/.?&#]*).*?$/, "$1");
		}

		if (domain_nowww === "sortiesdvd.com") {
			// https://www.sortiesdvd.com/affichethumb/8616.jpg
			//   https://www.sortiesdvd.com/affiche/8616.jpg
			return src.replace(/\/+affichethumb\/+/, "/affiche/");
		}

		if (domain_nowww === "cineswellington.com") {
			// https://www.cineswellington.com/images/film/zoom/zoom_180611025644.jpg
			//   https://www.cineswellington.com/images/film/180611025644.jpg
			return src.replace(/\/zoom\/+zoom_/, "/");
		}

		if (domain === "img.seriebox.com") {
			// https://img.seriebox.com/films/44/44582/_thumbs/315_0/affich_44582_4.jpg
			//   https://img.seriebox.com/films/44/44582/affich_44582_4.jpg
			return src.replace(/\/_thumbs\/+[0-9]+_[0-9]+\/+/, "/");
		}

		if (domain === "d3ewd3ysu1dfsj.cloudfront.net") {
			// https://d3ewd3ysu1dfsj.cloudfront.net/images/stories/large/46014.jpg?1532024172
			//   https://d3ewd3ysu1dfsj.cloudfront.net/images/stories/original/46014.jpg?1532024172
			return src.replace(/(\/images\/+stories\/+)[a-z]+\/+([0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1original/$2");
		}

		if (domain_nowww === "mairiedesamoens.fr") {
			// http://www.mairiedesamoens.fr/iso_upload/85831/t_418_570.jpg
			//   http://www.mairiedesamoens.fr/imageProvider.aspx?resource=85831&fn=85831.jpg
			return src.replace(/\/iso_upload\/+([0-9]+)\/+t_[0-9]+_[0-9]+(\.[^/.]*)(?:[?#].*)?$/,
							   "/imageProvider.aspx?resource=$1&fn=$1$2");
		}

		if (domain_nowww === "citizenkid.com") {
			// https://www.citizenkid.com/uploads/medias/cache/post_cover/rc/Xi4cuLIV//uploads/medias/d0/a3/d0a3e33c6619e1ab65bbcd6fbf7c97bd6779c796.jpeg
			//   https://www.citizenkid.com/uploads/medias/d0/a3/d0a3e33c6619e1ab65bbcd6fbf7c97bd6779c796.jpeg
			return src.replace(/\/uploads\/+medias\/+cache\/+[^/]*\/+[^/]*\/+[^/]*\/+uploads\/+medias\/+/, "/uploads/medias/");
		}

		if (amazon_container === "weclap-prodcluster") {
			// https://weclap-prodcluster.s3.amazonaws.com/images/show_items/images/11627/medium/e2c26fc22e1b810fadbb11395763a83a/image.jpg
			//   https://weclap-prodcluster.s3.amazonaws.com/images/show_items/images/11627/original/e2c26fc22e1b810fadbb11395763a83a/image.jpg
			return src.replace(/(\/images\/+[0-9]+\/+)[a-z]+\/+([0-9a-f]+\/+)/, "$1original/$2");
		}

		if (domain_nosub === "sogou.com") {
			// http://img01.store.sogou.com/net/a/04/link?appid=100520029&url=https://mmbiz.qpic.cn/mmbiz_jpg/OicUnYGicV66IjCDM7ezmhtfKyPsYGAtgxiaxR1eCOibkmlwiaXS4hUXyia9o87icQQ7VvX5Y0kaOSSayfbTuckQKGHyw/640?wx_fmt=jpeg
			//   https://mmbiz.qpic.cn/mmbiz_jpg/OicUnYGicV66IjCDM7ezmhtfKyPsYGAtgxiaxR1eCOibkmlwiaXS4hUXyia9o87icQQ7VvX5Y0kaOSSayfbTuckQKGHyw/0
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/net\/+.\/+[0-9]+\/+link.*?[?&]url=(http[^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nosub === "sogoucdn.com" && /^img[0-9]*\./.test(domain)) {
			// http://img02.sogoucdn.com/v2/thumb/resize/w/180/h/240?appid=100140019&url=https%3A%2F%2Fimg1.doubanio.com%2Fview%2Fphoto%2Fs_ratio_poster%2Fpublic%2Fp2524955059.jpg
			//   https://img1.doubanio.com/pview/photo/raw/public/p2524955059.jpg
			// https://img01.sogoucdn.com/v2/thumb/crop/xy/ai/x/0/y/0/w/218/h/160/iw/109/ih/80/t/0/ir/3/retype_exclude_gif/ext/auto/q/75?t=2&appid=200965&url=https%3A%2F%2Fimg.y3600.cz%2Fd%2Ffile%2Fp%2F2020%2F01%2F14%2Fc968e1e607ac298d9d6e910776bdbb12.jpg&referer=https%3A%2F%2Fy3600.cc%2Ftaiju%2F2020%2F775.html&sign=367d53a79fccf88cb26f9e73d703349e
			//   https://img.y3600.cz/d/file/p/2020/01/14/c968e1e607ac298d9d6e910776bdbb12.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+v2\/+thumb\/+.*?\?(?:.*&)?url=([^&]+).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nowww === "cinemapalace.ch") {
			// https://www.cinemapalace.ch/uploads/800_800_1GY6NONVlBant-man-et-la-guepe.jpg
			//   https://www.cinemapalace.ch/uploads/1GY6NONVlBant-man-et-la-guepe.jpg
			return src.replace(/\/uploads\/+[0-9]+_[0-9]+_/, "/uploads/");
		}

		if (domain === "cdn.simplesite.com") {
			// http://cdn.simplesite.com/i/2c/43/286260059424834348/i286260064352925660._szw1280h1280_.jpg
			//   http://cdn.simplesite.com/i/2c/43/286260059424834348/i286260064352925660.jpg
			return {
				url: src.replace(/\._sz(?:[wh][0-9]+){1,}_(\.[^/.]*)(?:[?#].*)?$/, "$1"),
				can_head: false // 404
			}
		}

		if (domain_nowww === "inews.bg") {
			// https://inews.bg/pictures/1496852__100.jpg -- 129x100
			//   https://inews.bg/pictures/1496852.jpg -- 1034x800
			// https://inews.bg/pictures/766448_630__1.jpg
			//   https://inews.bg/pictures/766448___1.jpg -- 960x539
			// https://inews.bg/pictures/2162855_375_282_4x3.jpg
			//   https://inews.bg/pictures/2162855.jpg -- 773x580
			// http://inews.bg/pictures/2106762_375_282_4x3.jpg
			//   https://inews.bg/pictures/2106762.jpg -- 4209x3196
			return src
				.replace(/(\/pictures\/+[0-9]+)_[0-9]*_[0-9]*(?:_[0-9]+x[0-9]+)?(\.[^/.]*)(?:[?#].*)?$/, "$1$2")
				.replace(/(\/pictures\/+[0-9]+)_[0-9]*_[0-9]*_([0-9]+)(\.[^/.]*)(?:[?#].*)?$/, "$1___$2$3");
		}

		if (domain_nosub === "starofservice.com" && domain.match(/^cdn-uploads[0-9]*\./)) {
			// https://cdn-uploads2.starofservice.com/uploads/pj/thumbs-small/starofservice_56920c09c9677e641fab65d7534802b355e14.jpg
			//   https://cdn-uploads2.starofservice.com/uploads/pj/starofservice_56920c09c9677e641fab65d7534802b355e14.jpg
			return src.replace(/(\/uploads\/+pj\/+)thumbs(?:-[a-z]+)?\/+/, "$1");
		}

		if (domain_nowww === "hayabusa.io" ||
			// thanks to nimbuz on discord:
			// https://abm.hayabusa.media/series/149-13/thumb.png%3Fversion%3D1616153049?background=000000&fit=fill&format=webp&height=144&quality=60&version=0&width=256
			//   https://abm.hayabusa.media/series/149-13/thumb.png%3Fversion%3D1616153049?q=100&quality=100
			domain === "abm.hayabusa.media") {
			// https://hayabusa.io/openrec-image/user/3322602/332260162.q95.w164.ttl604800.headercache0.v1540223173.png?format=png
			//   https://hayabusa.io/openrec-image/user/3322602/332260162.png?format=png
			// thanks to fireattack on github: https://github.com/qsniyg/maxurl/issues/98
			// https://hayabusa.io/abema/programs/386-48_s0_p25/thumb002.q85.w200.h114.v1534496588.webp
			//   https://hayabusa.io/abema/programs/386-48_s0_p25/thumb002.webp
			//   https://hayabusa.io/abema/programs/386-48_s0_p25/thumb002.webp?q=100&quality=100
			// https://hayabusa.io/adcross/adx/abm/2b9ad238-8730-4909-a55a-ad82ed28490b.png?w=484&h=272
			//   https://hayabusa.io/adcross/adx/abm/2b9ad238-8730-4909-a55a-ad82ed28490b.png
			// https://hayabusa.io/abema/programs/12-20_s0_p25/thumb002.png?w=242&h=136
			//   https://hayabusa.io/abema/programs/12-20_s0_p25/thumb002.png
			// https://hayabusa.io/abema/series/26-24agzukmebpc/thumb.v1557970510.png
			//   https://hayabusa.io/abema/series/26-24agzukmebpc/thumb.png
			// https://hayabusa.io/makuake/upload/temporary/2926/detail/detail_2926_1543415491.jpeg?width=640&quality=95&format=jpeg&ttl=31536000&force
			//   https://hayabusa.io/makuake/upload/temporary/2926/detail/detail_2926_1543415491.jpeg?q=100&quality=100
			// https://hayabusa.io/openrec-image/thumbnails/12009/1200829/origin/6/captured_5511.q95.w350.ttl604800.headercache300.jpeg?q=100&quality=100
			//   https://hayabusa.io/openrec-image/thumbnails/12009/1200829/origin/6/captured_5511.width100.height100.quality100.jpeg
			//   https://hayabusa.io/openrec-image/thumbnails/12009/1200829/origin/6/captured_5511.jpeg?q=100&quality=100
			// https://hayabusa.io/makuake/upload/project/4248/main_4248.fit-scale.jpeg?q=100&quality=100
			//   https://hayabusa.io/makuake/upload/project/4248/main_4248.jpeg?q=100&quality=100
			// thanks again to fireattack:
			// https://hayabusa.io/abema/programs/386-48_s0_p25/thumb001.webp
			//   https://hayabusa.io/abema/programs/386-48_s0_p25/thumb001.q100.webp -- is the same as:
			//   https://hayabusa.io/abema/programs/386-48_s0_p25/thumb001.webp?q=100
			// https://hayabusa.io/abema/programs/218-271_s0_p5/thumb001.v1604481062?width=640&height=360&quality=85&format=webp&version=1604481062&fit=fill&background=000000
			//   https://hayabusa.io/abema/programs/218-271_s0_p5/thumb001?q=100&quality=100&format=webp
			//   https://hayabusa.io/abema/programs/218-271_s0_p5/thumb001.v1604481062?q=100&quality=100
			//   https://hayabusa.io/abema/programs/218-271_s0_p5/thumb001?q=100&quality=100 -- png
			// http://hayabusa.io/test/doge.auto
			//   http://hayabusa.io/test/doge.auto?q=100&quality=100

			var queries = get_queries(src);
			var basename = src.replace(/.*\/([^/?#]+)(?:[?#].*)?$/, "$1");
			var splitted = basename.split(".");
			var newsplitted = [];

			array_foreach(splitted, function(x, i) {
				if (i === 0) {
					newsplitted.push(x);
					return;
				}

				if (i === splitted.length - 1) {
					if (/^(jpe?g|png|gif|webp|auto)$/.test(x)) {
						newsplitted.push(x);
						return;
					}
				}

				var kv = x.match(/^(width|height|quality|ttl|headercache|fit|background|format|[hwqv])-?([0-9a-z]+)$/);
				if (!kv) {
					newsplitted.push(x);
					return;
				}

				var key = kv[1];
				var value = kv[2];

				if (!(key in queries))
					queries[key] = value;
			});

			queries.q = 100;
			queries.quality = 100;

			if (queries.format === "webp")
				delete queries.format;

			newsrc = keep_queries(add_queries(src.replace(/\/[^/]+(?:[?#].*)?$/, "/" + newsplitted.join(".")), queries), ["q", "quality", "format"]);
			if (newsrc !== src)
				return newsrc;

			// thanks to nimbuz on discord for reporting
			// https://hayabusa.io/abema/programs/221-121_s1_p15/thumb002.q75.v1625982963?format=webp&height=143&quality=75&width=256
			//   https://hayabusa.io/abema/programs/221-121_s1_p15/thumb002.png
			// unfortunately, .png is significantly worse quality (seems to contain a form of dithering)
			//return src.replace(/(?:\.(?:png|jpe?g))?[?#].*$/i, ".png");

			//return src
			//	//.replace(/(\/[^/.]*)(?:\.[-a-z]+[0-9]*)*(\.[^/.]*)(?:[?#].*)?$/, "$1$2")
			//	.replace(/(\/[^/.]+)(?:\.(?:[hwqv]|width|height|quality|ttl|headercache|fit|background|format)-?[0-9a-z]+)*(\.(?:jpe?g|png|webp|gif))?([?#].*)?$/, "$1$2$3")
			//	//.replace(/(\.(?:jpe?g|png|webp|gif)|\/thumb[0-9]+\.v[0-9]+)(?:[?#].*)?$/, "$1?q=100&quality=100");
			//	.replace(/(:\/\/[^/]+\/+[^/]+\/+.*?)(?:[?#].*)?$/, "$1?q=100&quality=100");
			////.replace(/(\/adcross\/.*\/[-0-9a-f]{25,})(\.[^/.]*?)(?:[?#].*)?$/, "$1$2")
			//	//.replace(/\?[whq]=[0-9]+(?:&(.*))?$/, "?$1")
			//	//.replace(/&[whq]=[0-9]+(&.*)?$/, "$1")
			//	//.replace(/\?(?:width|height|quality)=[0-9]+(?:&(.*))?$/, "?$1")
			//	//.replace(/&(?:width|height|quality)=[0-9]+(&.*)?$/, "$1")
			//	//.replace(/\?$/, "")
			//	//.replace(/(\.(?:jpe?g|png|webp|gif))(?:\?.*)?/, "$1?q=100&quality=100");
		}

		if (domain === "d13krdvwknzmgv.cloudfront.net" ||
			// same as above:
			// https://d13krdvwknzmgv.cloudfront.net/files/topics/8627773_ext_col_03_2.jpg
			// https://times.abema.tv/files/topics/8627773_ext_col_03_2.jpg
			domain === "times.abema.tv") {
			// https://d13krdvwknzmgv.cloudfront.net/files/user/images/design/video-icon.png
			// https://d13krdvwknzmgv.cloudfront.net/files/user/images/design/play.png
			if (/\/files\/+user\/+images\/+design\/+(?:video-icon|play)\./.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}

			// thanks to fireattack on discord
			// https://times.abema.tv/news-article/8627773
			// https://d13krdvwknzmgv.cloudfront.net/files/rcms_conv_webp/files/topics/8627773_ext_col_03_0_1602124257.webp?v=1602126005
			//   https://d13krdvwknzmgv.cloudfront.net/files/topics/8627773_ext_col_03_0.jpg
			// https://times.abema.tv/news-article/8662573
			// https://d13krdvwknzmgv.cloudfront.net/files/rcms_conv_webp/files/topics/8662573_ext_col_03_0.jpg_1623792204.webp
			//   https://d13krdvwknzmgv.cloudfront.net/files/topics/8662573_ext_col_03_0.jpg
			// other:
			// https://d13krdvwknzmgv.cloudfront.net/files/temp/rcms_conv_webp/rcms_resize_img/84ba5fa57b2d7f889aa14e1d1bd9c8eb/0x338-1-1602124257_1602126087.webp?v=1602126430
			//   https://d13krdvwknzmgv.cloudfront.net/files/temp/rcms_resize_img/84ba5fa57b2d7f889aa14e1d1bd9c8eb/0x338-1-1602124257.jpg
			//   https://d13krdvwknzmgv.cloudfront.net/files/topics/8627773_ext_col_03_1.jpg
			return src.replace(/(\/files\/+(?:temp\/+)?)rcms_conv_webp\/+(?:files\/+)?(.*?)(?:\.jpg)?_[0-9]{5,}\.webp(?:[?#].*)?$/, "$1$2.jpg");
		}

		if (domain === "s.dou.ua") {
			// https://s.dou.ua/img/avatars/200x200_Anime_girl.jpeg
			//   https://s.dou.ua/img/avatars/Anime_girl.jpeg
			return src.replace(/(\/img\/+avatars\/+)[0-9]+x[0-9]+_/, "$1");
		}

		if (domain === "d3kq2xhl2rew87.cloudfront.net" ||
			// https://gfinity-img.s3.amazonaws.com/user/image/9/0/3/200x200-nc/792ce6c2bab94a8aec02257fc012c393_QGalEdd.jpg
			//   https://gfinity-img.s3.amazonaws.com/user/image/9/0/3/792ce6c2bab94a8aec02257fc012c393_QGalEdd.jpg
			amazon_container === "gfinity-img") {
			// https://d3kq2xhl2rew87.cloudfront.net/user/image/9/0/3/200x200-nc/792ce6c2bab94a8aec02257fc012c393_QGalEdd.jpg
			//   https://gfinity-img.s3.amazonaws.com/user/image/9/0/3/792ce6c2bab94a8aec02257fc012c393_QGalEdd.jpg
			return src.replace(/(\/user\/+image\/+(?:[0-9]\/+){3})[0-9]+x[0-9]+(?:-[a-z]+)?\/+/, "$1");
		}

		if (domain_nosub === "tokopedia.net") {
			// https://ecs7.tokopedia.net/img/cache/215-square/shops-1/2017/11/21/24775816/24775816_04989fcf-5375-4961-a4f2-660649006e24.jpg
			//   https://ecs7.tokopedia.net/img/shops-1/2017/11/21/24775816/24775816_04989fcf-5375-4961-a4f2-660649006e24.jpg
			// https://ecs7.tokopedia.net/img/cache/1190/shops-1/2018/10/21/2960567/2960567_be2b23d3-e5ed-4d8d-af72-551000c5eb4d
			//   https://ecs7.tokopedia.net/img/shops-1/2018/10/21/2960567/2960567_be2b23d3-e5ed-4d8d-af72-551000c5eb4d
			// https://ecs7.tokopedia.net/img/cache/260x200/attachment/2017/2/17/112/112_56935c82-6b9e-4f9a-bf8e-24690556597b.jpg.webp
			//   https://ecs7.tokopedia.net/img/attachment/2017/2/17/112/112_56935c82-6b9e-4f9a-bf8e-24690556597b.jpg
			// other:
			// https://ecs7.tokopedia.net/img/product-1/2020/1/12/5884427/5884427_bde6c941-bf35-432b-a567-0bcd6c5cd810_2048_2048
			return src.replace(/\/img\/+cache\/+[0-9]+(?:x[0-9]+)?(?:-[a-z]+)?\/+(.*?)(?:(\.[^/.]+)?\.webp)?(?:[?#].*)?$/, "/img/$1$2");
		}

		if (domain === "icdn.2cda.pl") {
			// https://icdn.2cda.pl/obr/thumbs/e9ac39c4b1aaa2202a6a25e28c1b48a2.jpg_oooooooooo_273x.jpg
			//   https://icdn.2cda.pl/obr/oryginalne/e9ac39c4b1aaa2202a6a25e28c1b48a2.jpg
			// http://icdn.2cda.pl/vid/thumbs/14013792859185-11.jpg_ooooxooxox_1280x720.jpg -- upscaled
			//   http://icdn.2cda.pl/vid/oryginalne/14013792859185-11.jpg
			// http://icdn.2cda.pl/vid/thumbs/e8544063d89fed7c4534f2fdb5ebae8a-91.jpg_ooooxooxox_1280x720.jpg
			//   http://icdn.2cda.pl/vid/oryginalne/e8544063d89fed7c4534f2fdb5ebae8a-91.jpg
			newsrc = src.replace(/\/thumbs\/+([0-9a-f]+(?:-[0-9]+)?\.[^/._]*)(?:_[^/]*)?(?:[?#].*)?$/, "/oryginalne/$1");
			if (newsrc !== src) return newsrc;
		}

		if (domain_nowww === "cda.pl") {
			var remove_cda_url_artifacts = function(str) {
				return str.replace(/_(?:XDDD|CDA|ADC|CXD|QWE|Q5|IKSDE)/g, "");
			};

			// switches both halves of the alphabet:
			// abcdefghijklm nopqrstuvwxyz
			// nopqrstuvwxyz abcdefghijklm
			// this is run twice (which invalidates the operation), so it's currently not needed
			var decipher_cda1 = function(str) {
				var out = "";

				for (var i = 0; i < str.length; i++) {
					var code = str.charCodeAt(i);

					var z;
					if (code >= 97 && code <= 122) {
						// lowercase
						z = 122;
					} else if (code >= 65 && code <= 90) {
						// uppercase
						z = 90;
					} else {
						out += str[i];
						continue;
					}

					if (z >= (code + 13)) {
						out += string_fromcharcode(code + 13);
					} else {
						out += string_fromcharcode(code - 13);
					}
				}

				return out;
			};

			var decipher_cda2 = function(str) {
				var out = "";

				for (var i = 0; i < str.length; i++) {
					var code = str.charCodeAt(i);

					if (code >= 33 && code <= 126) {
						out += string_fromcharcode(33 + (code + 14) % 94);
					} else {
						out += str[i];
					}
				}

				return out;
			};

			var fixup_cda_url = function(url) {
				url = url
					.replace(".cda.mp4", "")
					.replace(".2cda.pl", ".cda.pl")
					.replace(".3cda.pl", ".cda.pl");

				if (string_indexof(url, "/upstream") >= 0) {
					return "https://" + url.replace("/upstream", ".mp4/upstream");
				} else {
					return "https://" + url + ".mp4";
				}
			};

			var decipher_cda = function(url) {
				url = remove_cda_url_artifacts(url);
				url = decodeURIComponent(url);
				url = decipher_cda2(url);
				return fixup_cda_url(url);
			};

			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+video\/+([0-9]+[a-z]*)(?:\/+[^/]*)?(?:[?#].*)?$/,
				query_for_id: "https://www.cda.pl/video/${id}",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/<div id="mediaplayer[0-9a-z]+" player_data='({[^']+})'/);
					if (!match) {
						console_error(cache_key, "Unable to find player_data from", resp);
						return done(null, false);
					}

					var json = JSON_parse(decode_entities(match[1]));
					var video = json.video;

					var decoded_file = decipher_cda(video.file);
					var title = decodeURIComponent(video.title);
					var thumb = urljoin(resp.finalUrl, video.thumb, true);

					var urls = [];

					urls.push({
						url: decoded_file,
						video: true
					});
					urls.push(thumb);

					return done(fillobj_urls(urls, {
						extra: {
							page: resp.finalUrl,
							caption: title
						}
					}), 60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (host_domain_nowww === "cda.pl" && options.element) {
			newsrc = common_functions["get_pagelink_el_matching"](options.element, /^[a-z]+:\/\/(?:www\.)?cda\.pl\/+video\/+([0-9]+[a-z]*)(?:\/+[^/]*)?(?:[?#].*)?$/);
			if (newsrc) return newsrc;
		}

		if (domain === "i.imagesup.co") {
			// https://i.imagesup.co/sz/600x-/images/1234434_857_123443459593ec693dba.jpg
			//   https://i.imagesup.co/images/1234434_857_123443459593ec693dba.jpg
			return src.replace(/\/sz\/+[-0-9]+x[-0-9]+\/+images\/+/, "/images/");
		}

		if (domain_nosub === "kgimg.com" ||
			// thanks to anonymous for reporting:
			// https://imge.kugou.com/stdmusic/480/20201111/20201111182807516238.jpg
			//   https://imge.kugou.com/stdmusic/20201111/20201111182807516238.jpg
			domain === "imge.kugou.com" ||
			// thanks to tathastu871 on discord:
			// https://imgessl.kugou.com/custom/150/20230923/20230923205634287593.jpg
			//   https://imgessl.kugou.com/custom/20230923/20230923205634287593.jpg
			// https://imgessl.kugou.com/stdmusic/240/20240515/20240515183102515308.jpg
			//   https://imgessl.kugou.com/stdmusic/20240515/20240515183102515308.jpg
			domain === "imgessl.kugou.com") {
			// https://p3fx.kgimg.com/kugouicon/165/20190117/20190117073537290387.jpg
			//   https://p3fx.kgimg.com/kugouicon/20190117/20190117073537290387.jpg
			return src.replace(/(\/[a-z]+\/+)[0-9]+\/+([0-9]{8}\/+[0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "s.starladder.com") {
			// https://s.starladder.com/uploads/user_discipline_logo/5/d/7/6/thumb_270_41f06d6e47bfccf5adc2112d786acc25.jpg
			//   https://s.starladder.com/uploads/user_discipline_logo/5/d/7/6/41f06d6e47bfccf5adc2112d786acc25.jpg
			return src.replace(/(\/uploads\/.*\/)thumb_[0-9]+_([0-9a-f]{10,}\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "cilacila.com") {
			// https://www.cilacila.com/uploads/thumb/20190314/12/1552539080-jHvFTzVfJS_250_330_3.jpeg
			//   https://www.cilacila.com/uploads//20190314/12/1552539080-jHvFTzVfJS.jpeg
			return src.replace(/\/uploads\/+thumb(\/+[0-9]{8}\/+[0-9]+\/+[^/]*?)(?:_[0-9]+){3}(\.[^/.]*)(?:[?#].*)?$/,
							   "/uploads/$1$2");
		}

		if (domain === "vip.img.cdn.keeng.vn" ||
			// http://image.keeng.com.kh/images/images_thumb/video/2019/06/28/GpEhmWxaWfg5RUyDuhp05d15c797f2299_200_113.png
			//   http://image.keeng.com.kh/images/video/2019/06/28/GpEhmWxaWfg5RUyDuhp05d15c797f2299.png
			domain === "image.keeng.com.kh") {
			// http://vip.img.cdn.keeng.vn/sata11/images/images_thumb/f_sata11/singer/2017/04/26/1zB2mkBGWeOu3n4Q8Dns59006062ddac7_310_310.jpg
			//   http://vip.img.cdn.keeng.vn/sata11/singer/2017/04/26/1zB2mkBGWeOu3n4Q8Dns59006062ddac7.jpg
			regex = /\/images\/+images_thumb\/+(?:[^/]+\/+)?([^/]+\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[^/]+)_[0-9]+_[0-9]+(\.[^/.]*)(?:[?#].*)?$/;
			return [
				src.replace(regex, "/$1$2"),
				src.replace(regex, "/images/$1$2")
			];
		}

		if (domain_nowww === "highresaudio.com") {
			// https://www.highresaudio.com/imgcache/6b234d662140ac35b56c621209a0acd7/boq28s-dedicated-preview-m3_350x350.jpg
			//   https://www.highresaudio.com/imgcache/6b234d662140ac35b56c621209a0acd7/boq28s-dedicated-preview-m3.jpg
			return src.replace(/(\/imgcache\/+[0-9a-f]{20,}\/+[^/]*?)_[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "d1wtzzt4oxg683.cloudfront.net") {
			// https://d1wtzzt4oxg683.cloudfront.net/images/covers/large/141/177141.jpg
			//   https://d1wtzzt4oxg683.cloudfront.net/images/covers/141/177141.jpg
			return src.replace(/\/images\/+covers\/+[a-z]+\/+/, "/images/covers/");
		}

		if (domain_nowww === "nnmassets.cf") {
			// http://nnmassets.cf/forum/image.php?link=https://a.radikal.ru/a43/1905/cf/fad3cf67ebd6.jpg
			//   https://a.radikal.ru/a43/1905/cf/fad3cf67ebd6.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/forum\/+image\.php\?(?:.*?&)?link=(http[^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeURIComponent(newsrc);
		}

		if (domain_nosub === "jpc.de" && domain.match(/^media[0-9]*\./)) {
			// https://media1.jpc.de/image/w412/front/0/0602577649608.jpg
			//   https://media1.jpc.de/image/w999999/front/0/0602577649608.jpg -- 3000x3000
			//   https://media1.jpc.de/image/w999999/0/0602577649608.jpg
			// https://media1.jpc.de/image/h90/front/0/0825396079627.jpg
			//   https://media1.jpc.de/image/w999999/0/0825396079627.jpg -- 1500x1500
			return {
				url: src.replace(/\/image\/+[wh][0-9]+\/+(?:[a-z]+\/+)?/, "/image/w999999/"),
				can_head: false // 0
			};
		}

		if (domain_nowww === "mall.cz" ||
			// https://i.cdn.nrholding.net/42937466/500/500
			//   https://i.cdn.nrholding.net/42937466
			domain === "i.cdn.nrholding.net") {
			// https://www.mall.cz/i/42937466/450/450
			//   https://www.mall.cz/i/42937466
			// https://www.mall.cz/i/42937466/500/500/
			//   https://www.mall.cz/i/42937466
			return src.replace(/(:\/\/[^/]*\/(?:i\/+)?[0-9]+)\/+[0-9]+(?:\/+[0-9]+)?\/*(?:[?#].*)?$/, "$1");
		}

		if (domain === "eshop.fayaque.com.tw") {
			// https://eshop.fayaque.com.tw/img/450x0/product/2019051558232384.jpg
			//   https://eshop.fayaque.com.tw/img/original/product/2019051558232384.jpg -- 1280x1280, can be anything (not just original)
			return src.replace(/\/img\/+[0-9]+x[0-9]+\/+/, "/img/original/");
		}

		if (domain === "img.shoplineapp.com") {
			// https://img.shoplineapp.com/media/image_clips/5ce9566ceeda2e002c27375b/large.jpg?1558795883
			//   https://img.shoplineapp.com/media/image_clips/5ce9566ceeda2e002c27375b/source.jpg?1558795883 -- 750x750
			//   https://img.shoplineapp.com/media/image_clips/5ce9566ceeda2e002c27375b/original.jpg?1558795883 -- 1200x1200
			return src.replace(/(\/media\/+[^/]*\/+[0-9a-f]{8,}\/+)[a-z]+(\.[^/.]*)(?:[?#].*)?$/, "$1original$2");
		}

		if (domain === "media.blogto.com") {
			// https://media.blogto.com/articles/2018112-carly-rae-toronto.jpg?w=720&cmd=resize_then_crop&height=480&quality=70
			//   https://media.blogto.com/articles/2018112-carly-rae-toronto.jpg?w=-1
			//   https://s3.amazonaws.com/btoimage/prism-thumbnails/articles/2018112-carly-rae-toronto.jpg-resize-_opacity_100-frame_bg_color_FFF-preserve_ratio_true-gravity_center-w_-1_.jpg
			return src.replace(/\?.*/, "?w=-1");
		}

		if (domain === "hbb.afl.rakuten.co.jp") {
			// http://hbb.afl.rakuten.co.jp/hgb/?pc=http%3A%2F%2Fthumbnail.image.rakuten.co.jp%2F%400_mall%2Fponycanyon%2Fcabinet%2Fpccy%2Fpccy000001946.jpg%3F_ex%3D300x300&m=http%3A%2F%2Fthumbnail.image.rakuten.co.jp%2F%400_mall%2Fponycanyon%2Fcabinet%2Fpccy%2Fpccy000001946.jpg%3F_ex%3D80x80
			//   http://thumbnail.image.rakuten.co.jp/@0_mall/ponycanyon/cabinet/pccy/pccy000001946.jpg?_ex=300x300
			//   http://shop.r10s.jp/ponycanyon/cabinet/pccy/pccy000001946.jpg
			if (src.match(/^[a-z]+:\/\/[^/]*\/hgp\/+\?/)) {
				var queries = get_queries(src);
				newsrc = queries.pc || queries.m;
				if (newsrc)
					return decodeuri_ifneeded(newsrc);
			}
		}

		if (amazon_container === "broadtime_thumbnails") {
			// https://s3.amazonaws.com/broadtime_thumbnails/627/418460752627/418460752627%3A500.jpg
			//   https://s3.amazonaws.com/broadtime_photo/418460752627
			// https://broadtime_thumbnails.s3.amazonaws.com/627/418460752627/418460752627%3A500.jpg
			//   https://broadtime_photo.s3.amazonaws.com/418460752627
			return src.replace(/(:\/\/broadtime_|\.amazonaws\.com\/broadtime_)thumbnails([^/]*\.amazonaws\.com)?\/[0-9]+\/+([0-9]+)\/+[0-9]+(?:%3A|:)[0-9]+(\.[^/.]*)(?:[?#].*)?$/,
							   "$1photo$2/$3");
		}

		if (domain === "knihy.abz.cz") {
			// https://knihy.abz.cz/imgs/products/img_607795_thumb.jpg
			//   https://knihy.abz.cz/imgs/products/img_607795_orig.jpg
			return src.replace(/(\/imgs\/+[^/]*\/+img_[0-9]+_)[a-z]+(\.[^/.]*)(?:[?#].*)?$/, "$1orig$2");
		}

		if (domain_nowww === "readdork.com") {
			// https://www.readdork.com/images/_crop500x500/Carly-Rae-Jepsen-Too-Much.jpg
			//   https://www.readdork.com/images/Carly-Rae-Jepsen-Too-Much.jpg
			return src.replace(/\/images\/+_crop[0-9]+x[0-9]+\/+/, "/images/");
		}

		if (domain_nosub === "sueddeutsche.de") {
			// https://media-cdn.sueddeutsche.de/image/sz.1.4449065/560x560?cropRatios=0:0-BiGa-www&cropRatios=3:2&cropRatios=2:3&method=resize&v=1558023698
			//   https://media-cdn.sueddeutsche.de/image/sz.1.4449065
			// thanks to nimbuz on discord: https://github.com/qsniyg/maxurl/issues/949
			// https://www.sueddeutsche.de/image/sz.1.5437983/2000x840?v=1634059405000&format=webp
			//   https://www.sueddeutsche.de/image/sz.1.5437983
			// https://www.sueddeutsche.de/image/sz.1.5434756/1408x792?v=1633716337&format=webp
			//   https://www.sueddeutsche.de/image/sz.1.5434756
			return src.replace(/(\/image\/+sz\.[0-9]+\.[0-9]+)\/+.*$/, "$1");
		}

		if (domain_nowww === "swensonhomesolutions.com"
			// https://soundpark-club.casa/torrents/images/covers/264406.jpg
			//   https://soundpark-club.casa/torrents/images/realsize/264758.jpg
			//domain_nowww === "soundpark-club.casa"
			) {
			// http://swensonhomesolutions.com/torrents/images/covers/251619.jpg
			//   http://swensonhomesolutions.com/torrents/images/realsize/251619.jpg
			return src.replace(/\/images\/+covers\/+/, "/images/realsize/");
		}

		if (domain === "media.arkansasonline.com") {
			// https://media.arkansasonline.com/img/photos/2019/05/29/JEPSENCD__t1000.JPG?cc6fa094ad523b984325c7879220d3883a443e7f
			//   https://media.arkansasonline.com/img/photos/2019/05/29/JEPSENCD.JPG?cc6fa094ad523b984325c7879220d3883a443e7f
			return src.replace(/(\/img\/+photos\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[^/]*)__t[0-9]+(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain_nosub === "jintiankansha.me" && domain.match(/^img[0-9]*\./)) {
			// http://img2.jintiankansha.me/get?src=http://mmbiz.qpic.cn/mmbiz_jpg/HvCO9hyFZ6Fp5AwMcGIkibIWu3nUHQq4P9prIZr2ChrR7VLX3dmbeHCzjZ9QGbk5c8ERUWk47omDYLLJ8MmNMxw/640?wx_fmt=jpeg
			//   http://mmbiz.qpic.cn/mmbiz_jpg/HvCO9hyFZ6Fp5AwMcGIkibIWu3nUHQq4P9prIZr2ChrR7VLX3dmbeHCzjZ9QGbk5c8ERUWk47omDYLLJ8MmNMxw/0
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/get\?(?:.*?&)?src=(http[^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nowww === "cdjournal.com") {
			// https://www.cdjournal.com/image/jacket/100/411003/4110031771.jpg
			//   https://www.cdjournal.com/image/jacket/large/411003/4110031771.jpg -- 300x300
			return src.replace(/\/image\/+jacket\/+[0-9]+\/+/, "/image/jacket/large/");
		}

		if (domain_nowww === "redwallpapers.com") {
			// https://www.redwallpapers.com/public/redwallpapers-large-thumb/carly-rae-jepsen-brunette-singer-free-stock-photos-images-hd-wallpaper.jpg
			//   https://www.redwallpapers.com/download/original/carly-rae-jepsen-brunette-singer-free-stock-photos-images-hd-wallpaper.jpg
			return src.replace(/\/public\/+redwallpapers-[^/]*\//, "/download/original/");
		}

		if (domain_nowww === "show-biz.by") {
			// CRI: invalid image size - must be one of: xxsmall,xsmall,56,small,icon96,icon,medium,large,larger,xlarge,xxlarge,xxxlarge,1280,original
			// http://show-biz.by/gallery/image/gallery_image/18574/xxsmall/_v=7c4781547384861
			//   http://show-biz.by/gallery/image/gallery_image/18574/1280/_v=7c4781547384861 -- 1280x853, upscaled
			//   http://show-biz.by/gallery/image/gallery_image/18574/original/_v=7c4781547384861 -- 1024x683
			// http://show-biz.by/blog/image/blog_image/3582/large/_v=64d081521373425
			//   http://show-biz.by/blog/image/blog_image/3582/original/_v=64d081521373425
			//   http://show-biz.by/blog/image/blog_image/3582/original
			// http://show-biz.by/upimg/image/upimg_file/1907/800
			//   http://show-biz.by/upimg/image/upimg_file/1907/original
			return src.replace(/(\/(?:(?:gallery|blog)_image|upimg_file)\/+[0-9]+\/+)[^/]+(\/+_v=[0-9a-f]+)?(?:[?#].*)?$/, "$1original$2");
		}

		if (domain_nowww === "songtexte.co") {
			// https://songtexte.co/Images/Albums/Thumbs/brett-young-ticket-to-la-album-4883e1.jpg
			//   https://songtexte.co/Images/Albums/brett-young-ticket-to-la-album-4883e1.jpg
			return src.replace(/(\/Images\/+[^/]+\/+)Thumbs\/+/, "$1");
		}

		if (domain === "d2h1pu99sxkfvn.cloudfront.net") {
			// https://d2h1pu99sxkfvn.cloudfront.net/b0/6479437/503662872_4oRXGlUWQd/P4.jpg
			//   https://d2h1pu99sxkfvn.cloudfront.net/b0/6479437/503662872_4oRXGlUWQd/P0.jpg
			// https://d2h1pu99sxkfvn.cloudfront.net/b0/5409611/578689840_BT84w7ifLS/U1.jpg
			//   https://d2h1pu99sxkfvn.cloudfront.net/b0/5409611/578689840_BT84w7ifLS/U0.jpg
			newsrc = src.replace(/\/([PU])[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "/$10$2");
			if (newsrc !== src)
				return newsrc;
		}

		if (host_domain_nowww === "depop.com") {
			// FIXME: if depop's cloudfront domain, force non-data URL
			return {
				url: src,
				need_blob: true
			};
		}

		if (domain === "img.joomcdn.net") {
			// https://img.joomcdn.net/eb06b367f4be245a90f16960fd79251f660f2de5_400_400.jpeg
			//   https://img.joomcdn.net/eb06b367f4be245a90f16960fd79251f660f2de5_original.jpeg
			return src.replace(/(\/[0-9a-f]{20,})_[0-9]+_[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1_original$2");
		}

		if (domain_nowww === "fashionbay.gr") {
			// https://www.fashionbay.gr/thumber.php?img=Images/Products/119708.Color10.jpg&w=200&h=300
			//   https://www.fashionbay.gr/Images/Products/119708.Color10.jpg
			return src.replace(/\/thumber\.php\?(?:.*?&)?img=([^&]*).*?$/, "/$1");
		}

		if (domain_nowww === "ft.com") {
			// https://www.ft.com/__origami/service/image/v2/images/raw/https%3A%2F%2Fs3-ap-northeast-1.amazonaws.com%2Fpsh-ex-ftnikkei-3937bb4%2Fimages%2F9%2F7%2F1%2F4%2F16514179-1-eng-GB%2FIMG_2067.JPG?source=nar-cms
			//   https://www.ft.com/__origami/service/image/v2/images/raw/https%3A//s3-ap-northeast-1.amazonaws.com/psh-ex-ftnikkei-3937bb4/images/9/7/1/4/16514179-1-eng-GB/IMG_2067.JPG?source=nar-cms
			//   https://s3-ap-northeast-1.amazonaws.com/psh-ex-ftnikkei-3937bb4/images/9/7/1/4/16514179-1-eng-GB/IMG_2067.JPG
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/__origami\/+service\/+image\/+v2\/+images\/+[^/]*\/+(https?.*?)(?:[?#].*)?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);

			// thanks to roi:
			// https://www.ft.com/__origami/service/image/v2/images/raw/ftcms%3A78bebe8e-2504-40ea-b544-7e120484d39d?source=next-article&fit=scale-down&quality=highest&width=700&dpr=1
			//   https://d1e00ek4ebabms.cloudfront.net/production/78bebe8e-2504-40ea-b544-7e120484d39d.jpg
			match = src.match(/\/ftcms(?::|%3A)([-0-9a-f]{10,})/);
			if (match) {
				return "https://d1e00ek4ebabms.cloudfront.net/production/" + match[1] + ".jpg";
			}
		}

		if (domain === "cdnimg.rg.ru") {
			// https://cdnimg.rg.ru/img/content/166/03/74/2019-03-02T052221Z_450178624_RC1C0EAD7E20_RTRMADP_3_VIETNAM-NORTHKOREA_t_200x134.jpg
			//   https://cdnimg.rg.ru/img/content/166/03/74/2019-03-02T052221Z_450178624_RC1C0EAD7E20_RTRMADP_3_VIETNAM-NORTHKOREA.jpg
			return src.replace(/(\/img\/+content\/+.*)_t_[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "files.der-farang.com") {
			// https://files.der-farang.com/cache/700x0/1/0/files/000/000/00/03/page/60/1a/20/nordkorea-schickt-wieder-beamte-zum-verbindungsbuero-mit-suedkorea-ab8e.jpg
			//   https://files.der-farang.com/files/000/000/00/03/page/60/1a/20/nordkorea-schickt-wieder-beamte-zum-verbindungsbuero-mit-suedkorea-ab8e.jpg
			return src.replace(/\/cache\/+[0-9]+x[0-9]+\/+[0-9]+\/+[0-9]+\/+files\/+/, "/files/");
		}

		if (domain_nosub === "cdnvideo.ru" && domain.match(/^phototass[0-9]*\./)) {
			// https://phototass3.cdnvideo.ru/width/1020_b9261fa1/tass/m2/uploads/i/20190418/5020384.jpg
			//   https://phototass3.cdnvideo.ru/tass/m2/uploads/i/20190418/5020384.jpg
			return src.replace(/\/(?:width|height)\/+[0-9]+_[0-9a-f]+\/+tass\/+/, "/tass/");
		}

		if (domain_nosub === "cdnvideo.ru" && /^img[0-9]*tv\./.test(domain)) {
			// thanks to anonymous for reporting:
			// https://img5tv.cdnvideo.ru/webp/shared/files/202310/1_1821873.jpg
			//   https://img5tv.cdnvideo.ru/shared/files/202310/1_1821873.jpg
			return src.replace(/\/webp\/+shared\//, "/shared/");
		}

		if (domain_nowww === "duonao.tv") {
			// http://www.duonao.tv/upload/adult/201705292015391522730s.jpg
			//   http://www.duonao.tv/upload/adult/201705292015391522730.jpg
			return src.replace(/(\/upload\/+[^/]*\/+[0-9]{8,})s(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "independent.bbvms.com") {
			// https://independent.bbvms.com/mediaclip/2305843/pthumbnail/10/10.jpg
			//   https://independent.bbvms.com/mediaclip/2305843/pthumbnail/0/0.jpg
			return src.replace(/\/pthumbnail\/+[0-9]+\/+[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "/pthumbnail/0/0$1");
		}

		if (domain === "media-manager.starsinsider.com") {
			// https://media-manager.starsinsider.com/gallery/200/na_5afd47eb64b5f.jpg -- 200x300
			//   https://media-manager.starsinsider.com/gallery/1920/na_5afd47eb64b5f.jpg -- 667x1000
			//   https://media-manager.starsinsider.com/gallery/0/na_5afd47eb64b5f.jpg -- 2000x3000
			return src.replace(/\/gallery\/+[0-9]+\/+/, "/gallery/0/");
		}

		if (domain === "images.madame.de") {
			// https://images.madame.de/gettyimages-955862552,id=898ff47d,b=madame,w=200,rm=cp.jpeg
			//   https://images.madame.de/gettyimages-955862552,id=898ff47d,b=madame,rm=sk.jpeg
			// https://images.madame.de/blake,id=1e59f7db,b=madame,w=200,rm=sk
			//   https://images.madame.de/blake,id=1e59f7db,b=madame,rm=sk
			// https://images.madame.de/schuhtrend-bast-sommer-2019-aquazzura,id=a58f53da,b=madame,w=940,ca=0,28.88,100,85.13,rm=sk.webp
			//   https://images.madame.de/schuhtrend-bast-sommer-2019-aquazzura,id=a58f53da,b=madame,rm=sk.webp
			// b = brand:
			//   "The query parameter 'brand' [given value: 'madame'] must be one of [\"autozeitung\",\"billigflieger\",\"bravo\",\"cosmopolitan\",\"foodboard\",\"lecker\",\"praxisvita\",\"selbst\",\"tvmovie\",\"wunderweib\"]."
			// rm = resizeMode:
			//   "The query parameter 'resizeMode' must be one of these modes [\"cp\",\"ft\",\"dt\",\"fl\",\"sk\",\"en\"]."
			if (src.match(/^[a-z]+:\/\/[^/]*\/[^/.,]*(?:,[a-z]+=(?:[^,]+|[0-9.,]+)){1,}(?:\.[^/.]*)?(?:[?#].*)?$/)) {
				var filename = src.replace(/^[a-z]+:\/\/[^/]*\/+([^/.,]*).*?$/, "$1");
				var id = src.replace(/.*?,(id=[0-9a-z]+).*?$/, "$1");
				var brand = src.replace(/.*?,(b=[0-9a-z]+).*?$/, "$1");
				var ext = src.replace(/.*?(\.[^/.]*)(?:[?#].*)?$/, "$1");
				if (ext === src)
					ext = "";

				if (id !== src && brand !== src) {
					return {
						url: "https://images.madame.de/" + filename + "," + id + "," + brand + ",rm=sk" + ext,
						filename: filename + ext
					};
				}
			}
		}

		if (domain_nowww === "tportal.hr") {
			// https://www.tportal.hr/media/thumbnail/300x300/762082.jpeg?cropId=0
			//   https://www.tportal.hr/media/thumbnail/w1000/762082.jpeg?cropId=0
			return src.replace(/\/media\/+thumbnail\/+[0-9]+x[0-9]+\/+/, "/media/thumbnail/w1000/");
		}

		if (domain_nowww === "nudecelebs.world" ||
			// https://www.nudevideovixens.com/g/1508480364-natalie-jayne-roser-e-live-celebrity-beautiful-posing-hot-spa-winter-live-model/natalie-jayne-roser-e-live-celebrity-beautiful-posing-hot-spa-winter-live-model-2-640.jpg
			//   https://www.nudevideovixens.com/g/1508480364-natalie-jayne-roser-e-live-celebrity-beautiful-posing-hot-spa-winter-live-model/natalie-jayne-roser-e-live-celebrity-beautiful-posing-hot-spa-winter-live-model-2.jpg
			domain_nowww === "nudevideovixens.com" ||
			// https://www.hollywoodnude.club/g/1512803865-natalie-jayne-roser-celebrity-winter-posing-hot-babe-bikini-beautiful-model/natalie-jayne-roser-celebrity-winter-posing-hot-babe-bikini-beautiful-model-6-tn.jpg
			//   https://www.hollywoodnude.club/g/1512803865-natalie-jayne-roser-celebrity-winter-posing-hot-babe-bikini-beautiful-model/natalie-jayne-roser-celebrity-winter-posing-hot-babe-bikini-beautiful-model-6.jpg
			domain_nowww === "hollywoodnude.club" ||
			// https://www.nakedebonycelebs.com/g/1504678685-natalie-jayne-roser-celebrity-beautiful-hot-winter-babe-posing-hot-videos/natalie-jayne-roser-celebrity-beautiful-hot-winter-babe-posing-hot-videos-15-640.jpg
			//   https://www.nakedebonycelebs.com/g/1504678685-natalie-jayne-roser-celebrity-beautiful-hot-winter-babe-posing-hot-videos/natalie-jayne-roser-celebrity-beautiful-hot-winter-babe-posing-hot-videos-15.jpg
			domain_nowww === "nakedebonycelebs.com" ||
			// https://www.famousandnude.com/g/1525932821-natalie-jayne-roser-celebrity-beautiful-toples-babe-topless-beach-bus/natalie-jayne-roser-celebrity-beautiful-toples-babe-topless-beach-bus-4-640.jpg
			//   https://www.famousandnude.com/g/1525932821-natalie-jayne-roser-celebrity-beautiful-toples-babe-topless-beach-bus/natalie-jayne-roser-celebrity-beautiful-toples-babe-topless-beach-bus-4.jpg
			domain_nowww === "famousandnude.com" ||
			// https://www.famousandnude.net/g/1516434621-natalie-jayne-roser-celebrity-posing-hot-boobs-model-babe-beautiful-winter/natalie-jayne-roser-celebrity-posing-hot-boobs-model-babe-beautiful-winter-2-640.jpg
			//   https://www.famousandnude.net/g/1516434621-natalie-jayne-roser-celebrity-posing-hot-boobs-model-babe-beautiful-winter/natalie-jayne-roser-celebrity-posing-hot-boobs-model-babe-beautiful-winter-2.jpg
			domain_nowww === "famousandnude.net" ||
			// https://www.selenagomeznude.club/g/1522822771-natalie-jayne-roser-celebrity-posing-hot-beautiful-babe-winter-model/natalie-jayne-roser-celebrity-posing-hot-beautiful-babe-winter-model-3-640.jpg
			//   https://www.selenagomeznude.club/g/1522822771-natalie-jayne-roser-celebrity-posing-hot-beautiful-babe-winter-model/natalie-jayne-roser-celebrity-posing-hot-beautiful-babe-winter-model-3.jpg
			domain_nowww === "selenagomeznude.club" ||
			// https://www.nude-scene.net/g/1518247106-natalie-jayne-roser-american-crime-celebrity-babe-spa-model-daughter-slim-bus/natalie-jayne-roser-american-crime-celebrity-babe-spa-model-daughter-slim-bus-6-640.jpg
			//   https://www.nude-scene.net/g/1518247106-natalie-jayne-roser-american-crime-celebrity-babe-spa-model-daughter-slim-bus/natalie-jayne-roser-american-crime-celebrity-babe-spa-model-daughter-slim-bus-6.jpg
			domain_nowww === "nude-scene.net" ||
			// https://www.nudecelebrities.mobi/g/1522217939-natalie-jayne-roser-celebrity-magazine-beautiful-posing-hot-model-bikini-bar/natalie-jayne-roser-celebrity-magazine-beautiful-posing-hot-model-bikini-bar-6-tn.jpg
			//   https://www.nudecelebrities.mobi/g/1522217939-natalie-jayne-roser-celebrity-magazine-beautiful-posing-hot-model-bikini-bar/natalie-jayne-roser-celebrity-magazine-beautiful-posing-hot-model-bikini-bar-6.jpg
			domain_nowww === "nudecelebrities.mobi" ||
			// https://www.nudeasiancelebs.com/g/1527661018-natalie-jayne-roser-love-magazine-celebrity-summer-magazine-sex-posing-hot-barbados-rich/natalie-jayne-roser-love-magazine-celebrity-summer-magazine-sex-posing-hot-barbados-rich-2-640.jpg
			//   https://www.nudeasiancelebs.com/g/1527661018-natalie-jayne-roser-love-magazine-celebrity-summer-magazine-sex-posing-hot-barbados-rich/natalie-jayne-roser-love-magazine-celebrity-summer-magazine-sex-posing-hot-barbados-rich-2.jpg
			domain_nowww === "nudeasiancelebs.com" ||
			// https://www.bigtitscelebrities.com/g/1483637858-jasmin-walia-celebrity-asian-posing-hot-beautiful-babe-paparazzi-awards/jasmin-walia-celebrity-asian-posing-hot-beautiful-babe-paparazzi-awards-9-640.jpg
			//   https://www.bigtitscelebrities.com/g/1483637858-jasmin-walia-celebrity-asian-posing-hot-beautiful-babe-paparazzi-awards/jasmin-walia-celebrity-asian-posing-hot-beautiful-babe-paparazzi-awards-9.jpg
			domain_nowww === "bigtitscelebrities.com" ||
			// https://www.famousbombshells.com/g/1480045639-selena-gomez-celebrity-posing-hot-candids-babe-sexy-beautiful-swimsuit/selena-gomez-celebrity-posing-hot-candids-babe-sexy-beautiful-swimsuit-16-640.jpg
			//   https://www.famousbombshells.com/g/1480045639-selena-gomez-celebrity-posing-hot-candids-babe-sexy-beautiful-swimsuit/selena-gomez-celebrity-posing-hot-candids-babe-sexy-beautiful-swimsuit-16.jpg
			domain_nowww === "famousbombshells.com" ||
			// https://www.latinacelebrities.com/xhc/1562071462-crystal-reed-celebrity-babe-beautiful-posing-hot/crystal-reed-celebrity-babe-beautiful-posing-hot-1-tn.jpg
			//   https://www.latinacelebrities.com/xhc/1562071462-crystal-reed-celebrity-babe-beautiful-posing-hot/crystal-reed-celebrity-babe-beautiful-posing-hot-1.jpg
			domain_nowww === "latinacelebrities.com" ||
			// https://www.selenagomeznude.club/gals/1556902912-francia-raisa-almendarez-the-american-celebrity-posing-hot-cheerleader-beautiful-latina-latin-los-angeles/francia-raisa-almendarez-the-american-celebrity-posing-hot-cheerleader-beautiful-latina-latin-los-angeles-4-640.jpg
			//   https://www.selenagomeznude.club/gals/1556902912-francia-raisa-almendarez-the-american-celebrity-posing-hot-cheerleader-beautiful-latina-latin-los-angeles/francia-raisa-almendarez-the-american-celebrity-posing-hot-cheerleader-beautiful-latina-latin-los-angeles-4.jpg
			domain_nowww === "selenagomeznude.club" ||
			// https://www.xxxcelebscenes.com/g/1541577892-reply-los-angeles-celebrity-beautiful-famous-plus-size-babe-sex-model/reply-los-angeles-celebrity-beautiful-famous-plus-size-babe-sex-model-12-640.jpg
			//   https://www.xxxcelebscenes.com/g/1541577892-reply-los-angeles-celebrity-beautiful-famous-plus-size-babe-sex-model/reply-los-angeles-celebrity-beautiful-famous-plus-size-babe-sex-model-12.jpg
			domain_nowww === "xxxcelebscenes.com" ||
			// https://www.nicolekidmannudes.com/g/1530944167-natalie-jayne-roser-celebrity-bikini-babe-posing-hot-winter-beautiful/natalie-jayne-roser-celebrity-bikini-babe-posing-hot-winter-beautiful-9-640.jpg
			//   https://www.nicolekidmannudes.com/g/1530944167-natalie-jayne-roser-celebrity-bikini-babe-posing-hot-winter-beautiful/natalie-jayne-roser-celebrity-bikini-babe-posing-hot-winter-beautiful-9.jpg
			domain_nowww === "nicolekidmannudes.com") {
			// https://www.nudecelebs.world/g/1535696274-natalie-jayne-roser-las-vegas-celebrity-bus-beautiful-babe-posing-hot-photoshoot-sex/natalie-jayne-roser-las-vegas-celebrity-bus-beautiful-babe-posing-hot-photoshoot-sex-8-640.jpg
			//   https://www.nudecelebs.world/g/1535696274-natalie-jayne-roser-las-vegas-celebrity-bus-beautiful-babe-posing-hot-photoshoot-sex/natalie-jayne-roser-las-vegas-celebrity-bus-beautiful-babe-posing-hot-photoshoot-sex-8.jpg
			return src.replace(/(\/(?:g|gals|xhc)\/[0-9]{5,}-[^/]*\/[^/]*-[0-9]+)-(?:[0-9][0-9]+|tn)(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "kino.search.ch") {
			// https://kino.search.ch/movie/images/aq/aquaman_542_1_d24_m.jpg
			//   https://kino.search.ch/movie/images/aq/aquaman_542_1_d24.jpg
			return src.replace(/(\/images\/+..\/+[^/]*)_m(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "teluguone.com") {
			// http://teluguone.com/photos/uploadsExt/uploads/Aquaman%20Movie/Aquaman%20Movie%20Stills/Aquaman_Movie_Stills3_small.jpg
			//   http://teluguone.com/photos/uploadsExt/uploads/Aquaman%20Movie/Aquaman%20Movie%20Stills/Aquaman_Movie_Stills3.jpg
			return src.replace(/(\/uploadsExt\/+uploads\/+.*)_small(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "blog-news.it") {
			// https://www.blog-news.it/templates/onenews/images/news/tmb/2018/12/21/img-6019-1545360481.jpg
			//   https://www.blog-news.it/templates/onenews/images/news/big/2018/12/21/img-6019-1545360481.jpg
			return src.replace(/(\/images\/+[^/]*\/+)tmb\/+/, "$1big/");
		}

		if (domain_nowww === "polecamfilm.pl") {
			// http://www.polecamfilm.pl/obrazy/film/min/103873_s17.jpg
			//   http://www.polecamfilm.pl/obrazy/film/103873_s17.jpg
			return src.replace(/\/min(\/+[0-9]+_[a-z][0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1");
		}

		if (domain_nosub === "ltmcdn.com" && domain.match(/^t[0-9]*\.salir\./)) {
			// https://t2.salir.ltmcdn.com/es/movies/6/6/5/aquaman_2_250.jpg
			//   https://t2.salir.ltmcdn.com/es/movies/6/6/5/aquaman_2_orig.jpg
			return src.replace(/_[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "_orig$1");
		}

		if (domain === "images.curved.de") {
			// https://images.curved.de/article_teaser_md/2018/12/Aquaman_17.jpg
			//   https://images.curved.de/article_detail_xl/2018/12/Aquaman_17.jpg -- 1140x760
			return src.replace(/\/article_teaser_md\/+/, "/article_detail_xl/");
		}

		if (domain === "ocio.diariodeibiza.es") {
			// https://ocio.diariodeibiza.es/img_contenido/cine/17566/17566_frame_es_002__600x450.jpg
			//   https://ocio.diariodeibiza.es/img_contenido/cine/17566/17566_frame_es_002.jpg
			return src.replace(/__[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1");
		}

		if (domain === "img.movist.com") {
			// http://img.movist.com/?img=/x00/00/48/73_1s.jpg
			//   http://img.movist.com/?img=/x00/00/48%2F73_1s.jpg
			//   http://img.movist.com/data/imgroot/x00/00/48/73_1s.jpg
			newsrc = src.replace(/(:\/\/[^/]*\/)\?(?:.*?&)?img=([^&]*).*?$/, "$1data/imgroot$2");
			if (newsrc !== src)
				return decodeURIComponent(newsrc);
		}

		if (domain_nosub === "c-ctrip.com" && domain.match(/^youimg[0-9]*\./)) {
			// https://youimg1.c-ctrip.com/target/100412000000t4vx25142_R_1024_10000_Q90.jpg?proc=autoorient
			//   https://youimg1.c-ctrip.com/target/100412000000t4vx25142.jpg
			return src.replace(/(\/target\/+[0-9a-z]+)(?:_[A-Z0-9]+){1,}(\.[^/.?#]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nosub === "china.com.cn") {
			// http://images8.m.china.com.cn/mchina/img50/2018_12_11/11/fd34c92b13c7cda6b47158b388f43379c36ac31f25ab08d2_600_9999.jpg
			//   http://images8.m.china.com.cn/mchina/img50/2018_12_11/11/fd34c92b13c7cda6b47158b388f43379c36ac31f25ab08d2.jpg
			// http://images10.m.china.com.cn/newschina/oss/nimg/20190421/08/img_967e226909cb747b6264ff7287a2a901_720_370.jpg
			//   http://images10.m.china.com.cn/newschina/oss/nimg/20190421/08/img_967e226909cb747b6264ff7287a2a901.jpg
			return src.replace(/((?:\/img[0-9]*\/+[0-9]{4}(?:_[0-9]{2}){2}|nimg\/+[0-9]{8})\/+[0-9]+\/+(?:img_)?[0-9a-f]{20,})(?:_[0-9]+){2}(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain === "assets.jalantikus.com") {
			// https://assets.jalantikus.com/assets/cache/650/433/userfiles/2018/12/12/Aquaman-Inside-9fc65.jpg
			//   https://assets.jalantikus.com/assets/cache/0/0/userfiles/2018/12/12/Aquaman-Inside-9fc65.jpg
			return src.replace(/\/assets\/+cache\/+[0-9]+\/+[0-9]+\/+userfiles\/+/, "/assets/cache/0/0/userfiles/");
		}

		if (domain === "res.idollook.cn") {
			// https://res.idollook.cn/uploads/event/avatar/1490/thumb_0284dcc30b9a7a05f51f4bcb91701e91.jpg
			//   https://res.idollook.cn/uploads/event/avatar/1490/0284dcc30b9a7a05f51f4bcb91701e91.jpg
			// https://res.idollook.cn/uploads/event/avatar/1490/0284dcc30b9a7a05f51f4bcb91701e91.jpg!vmid
			//   https://res.idollook.cn/uploads/event/avatar/1490/0284dcc30b9a7a05f51f4bcb91701e91.jpg
			return src.replace(/(\/[0-9]+\/+)(?:thumb_)?([0-9a-f]{20,}\.[^/.!?#]*)(?:[?#!].*)?$/, "$1$2");
		}

		if (domain_nosub === "altervista.org" ||
			// http://3xcelebs.com/nudecelebs/cache/Rita-Ora-shows-nudity-and-goes-topless/0rita-ora-goes-naked-35_360_cw360_ch360_thumb.jpg
			//   http://3xcelebs.com/nudecelebs/albums/Rita-Ora-shows-nudity-and-goes-topless/0rita-ora-goes-naked-35.jpg
			(domain_nowww === "3xcelebs.com" && string_indexof(src, "/cache/") >= 0)) {
			// http://selenagomezfeet.altervista.org/gallery/cache/selena-gomez-s-butt/Selena-Gomez-Feet-801231_595.jpg
			//   http://selenagomezfeet.altervista.org/gallery/albums/selena-gomez-s-butt/Selena-Gomez-Feet-801231.jpg
			// http://selenagomezfeet.altervista.org/gallery/cache/selena-gomez-feet/it.pinterest.com01_100_cw85_ch85_thumb.jpg
			//   http://selenagomezfeet.altervista.org/gallery/albums/selena-gomez-feet/it.pinterest.com01.jpeg
			// http://selenagomezfeet.altervista.org/gallery/cache/selena-gomez-s-armpits/selena-gomez-in-be-magazine-photoshoot-november-2015-24_100_cw85_ch85_thumb.jpg
			//   http://selenagomezfeet.altervista.org/gallery/albums/selena-gomez-s-armpits/selena-gomez-in-be-magazine-photoshoot-november-2015-24.jpg
			newsrc = src.replace(/\/cache\/+(.*?)_[0-9]+(?:_c[wh][0-9]+)*(?:_thumb)?(\.[^/.]*)(?:[?#].*)?$/, "/albums/$1$2")
			if (newsrc !== src)
				return add_full_extensions(newsrc);
		}

		if (domain_nowww === "haberkonseyi.com") {
			// http://www.haberkonseyi.com/d/news_t/81946.jpg
			//   http://www.haberkonseyi.com/d/news/81946.jpg
			return src.replace(/\/news_t\/+/, "/news/");
		}

		if (domain_nowww === "snimai.com") {
			// https://snimai.com/images/media/photos/20150419/553335c1d2864/thumbs/553335c1d2864.jpg
			//   https://snimai.com/images/media/photos/20150419/553335c1d2864/553335c1d2864.jpg
			// https://snimai.com/images/media/photos/20180907/5b922bc8708e6_thumb.jpg
			//   https://snimai.com/images/media/photos/20180907/5b922bc8708e6.jpg
			return src
				.replace(/(\/photos\/+[0-9]{8}\/+[0-9a-z]+\/+)thumbs\/+/, "$1")
				.replace(/(\/photos\/+[0-9]{8}\/+[0-9a-f]+)_thumb(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "fem-img.herokuapp.com") {
			// https://fem-img.herokuapp.com/6288d0378135f5c40f943dc90f31bed23f025f02/?url=http%3A%2F%2Fi.imgur.com%2FjtajLwV.jpg
			//   http://i.imgur.com/jtajLwV.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/[0-9a-f]{20,}\/\?(?:.*&)?url=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nosub === "qunliao.info" && domain.match(/^img[0-9]*\./)) {
			// https://img1.qunliao.info/fastdfs4/M00/C8/7B/720x-/-/-/ChMf8Fx07TuAXTJDAASCuwgONIw600.jpg -- 720x603
			//   https://img1.qunliao.info/fastdfs4/M00/C8/7B/-x-/-/-/ChMf8Fx07TuAXTJDAASCuwgONIw600.jpg -- 1280x1072
			return src.replace(/\/[-0-9]+x[-0-9]+\/+/, "/-x-/");
		}

		if (domain_nosub === "phnx.pics") {
			// https://e1.am.phnx.pics/phnx/mport/75/81/95/758195/cf51b9f5dbed9ccdb85af5e151a48c26-quality_70Xresize_1Xallow_enlarge_0Xw_800Xh_600.jpg -- upscaled
			//   https://e1.am.phnx.pics/phnx/mport/75/81/95/758195/cf51b9f5dbed9ccdb85af5e151a48c26.jpg
			return src.replace(/-[a-z_]+_[0-9]+(?:X[a-z_]+_[0-9]+)*(\.[^/.]*)(?:[?#].*)?$/, "$1");
		}

		if (domain === "condenast-media.gcdn.co") {
			// https://condenast-media.gcdn.co/tatler/780214043b84f7f3b482df43df7232d6.jpg/71d575cc/c1279x959x0x0/w100
			//   https://condenast-media.gcdn.co/tatler/780214043b84f7f3b482df43df7232d6.jpg/71d575cc/c1279x959x0x0/w9999999999
			// https://condenast-media.gcdn.co/vogue/90fc1a51dc5262d9c6670ae756b5afdc.jpg/dadf22e9/o/t214x320
			//   https://condenast-media.gcdn.co/vogue/90fc1a51dc5262d9c6670ae756b5afdc.jpg/dadf22e9/o/w9999999999
			return src.replace(/\/[wht][-0-9]+(?:x[-0-9]+)?(?:[?#].*)?$/, "/w9999999999");
		}

		if (domain_nowww === "quvnoq.com") {
			// http://quvnoq.com/yangiliklar/post/small/quvnoq.com_9287_bc94d.jpg
			//   http://quvnoq.com/yangiliklar/post/original/quvnoq.com_9287_bc94d.jpg
			return src.replace(/\/post\/+[a-z]+\/+/, "/post/original/");
		}

		if (domain_nosub === "kontraband.com" && domain.match(/^cdn[0-9]*\./)) {
			// https://cdn1.kontraband.com/uploads/image/2019/2/26/preview_cbfc8136.jpeg
			//   https://cdn1.kontraband.com/uploads/image/2019/2/26/cbfc8136.jpeg
			return src.replace(/(\/uploads\/+image\/+[0-9]{4}\/+(?:[0-9]{1,2}\/+){2})[a-z]+_([0-9a-z]+\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain_nosub === "52shijing.com" && domain.match(/^pic[0-9]*\./)) {
			// http://pic1.52shijing.com/52shijing/mb/d/file/20181208/5adfe600e93e13a5c6c842d40ff7aa93_200_1000.jpg
			//   http://pic1.52shijing.com/52shijing/mb/d/file/20181208/5adfe600e93e13a5c6c842d40ff7aa93.jpg
			return src.replace(/(\/file\/+[0-9]{8}\/+[0-9a-f]+)(?:_[0-9]+){2}(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nosub === "qmde.de" && domain.match(/^pix[0-9]*\./)) {
			// http://pix4.qmde.de/www.quotenmeter.de/pics/gallery/1577_6175__w567xh400.jpg
			//   http://pix4.qmde.de/www.quotenmeter.de/pics/gallery/1577_6175.jpg
			return src.replace(/(\/pics\/+gallery\/+[^/]*)__w[0-9]+xh[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "nujhrcqkiwag1408085.cdn.ntruss.com") {
			// https://nujhrcqkiwag1408085.cdn.ntruss.com/static/upload/movie_poster_images/280x400/movie_67060_1542589356.jpg
			//   https://nujhrcqkiwag1408085.cdn.ntruss.com/static/upload/movie_poster_images/movie_67060_1542589356.jpg
			return src.replace(/(\/static\/+upload\/+[^/]*\/+)[0-9]+x[0-9]+\/+/, "$1");
		}

		if (domain_nowww === "chisholm-poster.com") {
			// https://www.chisholm-poster.com/small/CL75772.jpg -- 250x365
			//   https://www.chisholm-poster.com/large/CL75772.jpg -- 294x430
			return src.replace(/(:\/\/[^/]*\/)small\/+/, "$1large/");
		}

		if (domain_nowww === "doublage.qc.ca") {
			// http://www.doublage.qc.ca/pi.php?img=/modules%2Fimages_films%2Faquaman-vf.jpg&w=300&h=
			//   http://www.doublage.qc.ca/files/modules/images_films/aquaman-vf.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/pi\.php\?(?:.*?&)?img=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return urljoin(urljoin(src, "/files", true), decodeURIComponent(newsrc));
		}

		if (domain === "s3.bukalapak.com") {
			// https://s3.bukalapak.com/img/8136148674/w-300/terbaru_Poster_FIlm_AQUAMAN___original_Indonesian_one_sheet_.jpg
			//   https://s3.bukalapak.com/img/8136148674/original/terbaru_Poster_FIlm_AQUAMAN___original_Indonesian_one_sheet_.jpg
			return src.replace(/(\/img\/+[0-9]+\/+)[wh]-[0-9]+\/+/, "$1original/");
		}

		if (amazon_container === "mz-prod") {
			// https://mz-prod.s3.amazonaws.com/uploads/photo/file/345260/small_6a0e229d58c688e6c7b5f6260c0b14dd-Aquaman.jpg
			//   https://mz-prod.s3.amazonaws.com/uploads/photo/file/345260/6a0e229d58c688e6c7b5f6260c0b14dd-Aquaman.jpg
			return src.replace(/(\/uploads\/+photo\/+file\/+[0-9]+\/+)[a-z]+_([0-9a-f]{20,}[^/]*\.[^/.]*)(?:{?#].*)?$/, "$1$2");
		}

		if (domain === "capebreton.lokol.me") {
			// https://capebreton.lokol.me/remote.jpg.ashx?preset=article_full&urlb64=aHR0cHM6Ly9tZWRpYWZpbGVzLmNpbmVwbGV4LmNvbS9DZW50cmFsL0ZpbG0vUG9zdGVycy8yNDg5OV8zMjBfNDcwLmpwZw&hmac=-VMmCkf5j7Q
			//   https://mediafiles.cineplex.com/Central/Film/Posters/24899_320_470.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/remote\.jpg\.ashx\?(?:.*?&)?urlb64=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return base64_decode(newsrc);
		}

		if (domain === "i.moveek.com") {
			// https://i.moveek.com/media/resized/tall/5c0f47f158253520192716.jpg
			//   https://i.moveek.com/media/5c0f47f158253520192716.jpg
			return src.replace(/\/media\/+resized\/+[^/]*\/+/, "/media/");
		}

		if (domain === "i.ryt9.com" ||
			// https://ip.kolonmall.com/750x/https://images.kolonmall.com/cms/brandCollect/2023/08/bw-0356-copy-53a40f18-1b21-4dbb-b067-0c89a45c081b.jpg
			//   https://images.kolonmall.com/cms/brandCollect/2023/08/bw-0356-copy-53a40f18-1b21-4dbb-b067-0c89a45c081b.jpg
			domain === "ip.kolonmall.com" ||
			// https://imageproxy.haaartland.com/1000x/https://m2.nsimg.net/media/8/5/5/8551503.jpg
			//   https://m2.nsimg.net/media/8/5/5/8551503.jpg
			domain === "imageproxy.haaartland.com") {
			// https://i.ryt9.com/320x/https://img.ryt9.com/img/files/20181116/iq2b0a29fc8bdeac1c2d241f7fe2df8d62.jpg
			//   https://img.ryt9.com/img/files/20181116/iq2b0a29fc8bdeac1c2d241f7fe2df8d62.jpg
			return src.replace(/^[a-z]+:\/\/[^/]*\/[0-9]*x[0-9]*\/+http/, "http");
		}

		if (domain === "cinemas.nos.pt") {
			// http://cinemas.nos.pt/_layouts/15/Cinemas/Handlers/RenderImage.ashx?w=81&h=117&file=52025.JPG
			//   http://cinemas.nos.pt/_layouts/15/Cinemas/Handlers/RenderImage.ashx?file=52025.JPG
			return src.replace(/\/RenderImage\.ashx\?(?:.*?&)?file=([^&]*).*?$/, "/RenderImage.ashx?file=$1");
		}

		if (domain === "img.pooq.co.kr") {
			// https://img.pooq.co.kr/movieImg/MV_CD01/3/MV_CD01_WR0000011563_600.jpg
			//   https://img.pooq.co.kr/movieImg/MV_CD01/3/MV_CD01_WR0000011563.jpg
			return {
				url: src.replace(/(\/movieImg\/+.*?)_[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2"),
				can_head: false // 400
			};
		}

		if (domain === "i.toynewsi.com") {
			// https://i.toynewsi.com/g/generated/Aquaman-Movie/aquaman_ver11_xlg__scaled_600.jpg
			//   https://i.toynewsi.com/g/albums/Aquaman-Movie/aquaman_ver11_xlg.jpg -- 1012x1500
			return src.replace(/\/g\/+generated\/+(.*?)__scaled_[0-9]+(\.[^/.]*)(?:[?#].*)?$/,
							   "/g/albums/$1$2");
		}

		if (domain_nowww === "piletimaailm.com") {
			// https://www.piletimaailm.com/pictures/273718/medium
			//   https://www.piletimaailm.com/pictures/273718
			return src.replace(/(\/pictures\/+[0-9]+)\/+[a-z]+(?:[?#].*)?$/, "$1");
		}

		if (domain_nowww === "meowg.com") {
			// https://www.meowg.com/meowji/slidePhoto/2019/02/13/20190213102136_9bq2hw43n4m.jpeg-720.jpg
			//   https://www.meowg.com/meowji/slidePhoto/2019/02/13/20190213102136_9bq2hw43n4m.jpeg
			return src.replace(/(\.[a-z]+)-[0-9]+\.[^/.]*(?:[?#].*)?$/, "$1");
		}

		if (domain === "photos-epg.media-press.tv") {
			// http://photos-epg.media-press.tv/height1200/825bde6d92dac4b5899ec9117cf2969363f4686c.jpg
			//   http://photos-epg.media-press.tv/original/825bde6d92dac4b5899ec9117cf2969363f4686c.jpg
			return src.replace(/(:\/\/[^/]*\/)(?:width|height)[0-9]+\/+/, "$1original/");
		}

		if (domain === "blog.jinbo.net") {
			// http://blog.jinbo.net/thumbnail/3125/1230556702.w850-h1199.jpg
			//   http://blog.jinbo.net/attach/3125/1230556702.jpg
			return src.replace(/\/thumbnail\/+([0-9]+\/+[^/]*)\.w[0-9]+-h[0-9]+(\.[^/.]*)(?:[?#].*)?$/,
							   "/attach/$1$2");
		}

		if (domain === "cdnpuc.sinchew.com.my") {
			// https://cdnpuc.sinchew.com.my/pic/2019-06/06/t1_(22X9X581X414)b23ee290-1c48-45da-b0a1-a27782dae60f98d2e13e-9e87-47d7-8c55-84486d6d2d41.jpg
			//   https://cdnpuc.sinchew.com.my/pic/2019-06/06/b23ee290-1c48-45da-b0a1-a27782dae60f98d2e13e-9e87-47d7-8c55-84486d6d2d41.jpg
			return src.replace(/\/t[0-9]*_[(][0-9X]+[)]([-0-9a-f]{30,}\.[^/.]*)(?:[?#].*)?$/,
							   "/$1");
		}

		if (domain_nowww === "lebanonfiles.com") {
			// http://www.lebanonfiles.com/files/thumbs/08-06-19-rihanaaaa.jpg
			//   http://www.lebanonfiles.com/files/images/08-06-19-rihanaaaa.jpg
			return src.replace(/\/files\/+thumbs\/+/, "/files/images/");
		}

		if (domain_nowww === "tahrirnews.com" ||
			// https://img.eltahrer.com/Content/Upload/slider/11201871257237150056722.jpg
			//   https://img.eltahrer.com/Content/Upload/large/11201871257237150056722.jpg
			domain === "img.eltahrer.com") {
			// https://www.tahrirnews.com/Content/Upload/med/11201871257237150056722.jpg
			//   https://www.tahrirnews.com/Content/upload/large/11201871257237150056722.jpg
			return src.replace(/(\/Content\/+Upload\/+)(?:med|slider)\/+/i, "$1large/");
		}

		if (domain === "images.f2fcdn.net") {
			// https://images.f2fcdn.net/thumb/della/deldel/66028427-475307983241918-7158383069058056760-n.jpg?w=300&q=80
			//   https://images.f2fcdn.net/files/della/deldel/66028427-475307983241918-7158383069058056760-n.jpg
			return src.replace(/\/thumb\/+(.*?)(?:[?#].*)?$/, "/files/$1");
		}

		if (domain === "f.i.uol.com.br") {
			// https://f.i.uol.com.br/fotografia/2019/04/05/15544810115ca77f73b654e_1554481011_3x2_xs.jpg
			//   https://f.i.uol.com.br/fotografia/2019/04/05/15544810115ca77f73b654e_1554481011_3x2_rt.jpg -- 2400x1600
			// thanks to Shaggy on discord: https://github.com/qsniyg/maxurl/issues/934
			// https://f.i.uol.com.br/fotografia/2021/11/23/1637688183619d2377a18b3_1637688183_3x2_md.jpg
			//   https://f.i.uol.com.br/fotografia/2021/11/23/1637688183619d2377a18b3_1637688183_3x2_sm.jpg
			//   https://f.i.uol.com.br/fotografia/2021/11/23/1637688183619d2377a18b3_1637688183_3x2_lg.jpg
			//   https://f.i.uol.com.br/fotografia/2021/11/23/1637688183619d2377a18b3_1637688183_3x2_xl.jpg
			//   https://f.i.uol.com.br/fotografia/2021/11/23/1637688183619d2377a18b3_1637688183_3x2_rt.jpg
			return src.replace(/(\/fotografia\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9a-f]+_[0-9]+_[0-9]+x[0-9]+)_(?:xs|sm|md|lg|xl)(\.[^/.]*)(?:[?#].*)?$/,
							   "$1_rt$2");
		}

		if (domain === "image.thmeythmey.com") {
			// https://image.thmeythmey.com/pictures/2019/06/05/thumb1/000_1942gf_copy.jpg
			//   https://image.thmeythmey.com/pictures/2019/06/05/000_1942gf_copy.jpg
			return src.replace(/(\/pictures\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2})thumb[0-9]*\/+/, "$1");
		}

		if (domain_nowww === "galdump.com") {
			// http://galdump.com/images/websites/54/14281/thumb1/001.jpg
			//   http://galdump.com/images/websites/54/14281/001.jpg
			return {
				url: src.replace(/(\/images\/+websites\/+[0-9]+\/+[0-9]+\/+)thumb[0-9]*\/+([0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1$2"),
				headers: {
					Referer: "http://galdump.com/"
				}
			};
		}

		if (domain === "drp-images.nettavisen.no") {
			// https://drp-images.nettavisen.no/images/article/2019/06/11/3423696294/1/w400/7083280.jpg
			//   https://drp-images.nettavisen.no/images/article/2019/06/11/3423696294/1//7083280.jpg -- 5200x2600, double slashes are intentional
			return src.replace(/(\/images\/+article\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9]+\/+[0-9]+\/)[^/]*\/+([0-9]+\.[^/.]*)(?:[?#].*)?$/,
							   "$1/$2");
		}

		if (domain === "media.malaymail.com") {
			// https://media.malaymail.com/resize_cache/uploads/articles/2018/2018-09/rihanna_22092018-small.jpg
			//   https://media.malaymail.com/uploads/articles/2018/2018-09/rihanna_22092018.jpg
			// https://media.malaymail.com/resize_cache/uploads/articles/2018/2018-09/rihanna_22092018-seo.jpg
			//   https://media.malaymail.com/uploads/articles/2018/2018-09/rihanna_22092018.jpg
			return src.replace(/\/resize_cache\/+(uploads\/+.*)-(?:small|seo)(\.[^/.]*)(?:[?#].*)?$/, "/$1$2");
		}

		if (domain === "betassist.obs.ru-moscow-1.hc.sbercloud.ru") {
			// thanks to roi:
			// https://betassist.obs.ru-moscow-1.hc.sbercloud.ru/uploads/news/image/0/0/271/135844/%D0%B8%D0%B7%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5_2023-04-25_215406142-thumb.png
			//   https://betassist.obs.ru-moscow-1.hc.sbercloud.ru/uploads/news/image/0/0/271/135844/%D0%B8%D0%B7%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5_2023-04-25_215406142-seo.png
			//   https://betassist.obs.ru-moscow-1.hc.sbercloud.ru/uploads/news/image/0/0/271/135844/%D0%B8%D0%B7%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5_2023-04-25_215406142.png
			return src.replace(/(\/uploads\/+news\/+image\/.*)-(?:thumb|seo)(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "alaraby.co.uk" ||
			// https://www.almodon.com/File/GetImageCustom/b50e5858-0a48-4c50-9f5a-65226004a1d8/600/338
			//   https://www.almodon.com/File/Get/b50e5858-0a48-4c50-9f5a-65226004a1d8
			domain_nowww === "almodon.com") {
			// https://www.alaraby.co.uk/File/GetImageCustom/06c9f6a7-1a59-4a2c-bb4b-139a1879180a/600/338
			//   https://www.alaraby.co.uk/File/Get/06c9f6a7-1a59-4a2c-bb4b-139a1879180a
			return {
				url: src.replace(/\/File\/+GetImageCustom\/+([-0-9a-f]{20,})\/+[0-9]+(?:\/+[0-9]+)?(?:[?#].*)?$/i,
								 "/File/Get/$1"),
				can_head: false // 403
			};
		}

		if (domain === "media.doisonghonnhan.vn") {
			// http://media.doisonghonnhan.vn/resize_x580x/files/nhung-cau-noi-tam-trang-cua-sao-hollywood-khi-tinh-yeu-tan-vo-dshn-14.jpg
			//   http://media.doisonghonnhan.vn/files/nhung-cau-noi-tam-trang-cua-sao-hollywood-khi-tinh-yeu-tan-vo-dshn-14.jpg
			return src.replace(/\/resize_[0-9]*x[0-9]*x[0-9]*\/+files\/+/, "/files/");
		}

		if (domain_nowww === "from-ua.com") {
			// https://from-ua.com/upload/articles/2018/11/23/small/1542969011_5.jpeg
			//   https://from-ua.com/upload/articles/2018/11/23/original/1542969011_5.jpeg
			return src.replace(/(\/upload\/+articles\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2})[a-z]+\/+/, "$1original/");
		}

		if (domain_nosub === "onedio.com" && /^img/.test(domain)) {
			// https://img-s2.onedio.com/id-5d1e55486f056f962495dfb7/rev-0/w-460/h-260/f-jpg/s-8115c26772278ea122c8f0a1f439b53df73896df.jpg
			//   https://img-3.onedio.com/img/2r0/5d1e55486f056f962495dfb7.jpg
			//   https://img-3.onedio.com/img/5d1e55486f056f962495dfb7.jpg
			// https://img-3.onedio.com/img/200/bound/2r1/5d1e55486f056f962495dfb7.jpg
			//   https://img-3.onedio.com/img/2r0/5d1e55486f056f962495dfb7.jpg
			//   https://img-3.onedio.com/img/5d1e55486f056f962495dfb7.jpg
			// doesn't work for all:
			// https://img-s3.onedio.com/id-5bbd9ebdf526d1a1133f9132/rev-0/raw/s-30c00c91f2295a4c3a2047c0fb4ff312905aa11e.jpg
			// https://img-s2.onedio.com/id-57347c8f555365205339b2b0/rev-0/w-635/f-jpg-gif-webp-webm-mp4/s-b82ef0d1ffaa9f45602df3969ab5bbabce0e2b6f.gif
			// https://img-s3.onedio.com/id-585a889e06c369b8113badfd/rev-0/w-300/h-150/f-jpg/s-f960f9e49e60b5f39b3f64eca875f88654c8f622.jpg
			//   https://img-3.onedio.com/img/585a889e06c369b8113badfd.jpg -- 404, jpeg, JPG, png, gif don't work, -2 and -1 don't work either
			// other:
			// https://srv-cdn.onedio.com/twitter/avatar/DuniaGuluzada/original
			return src
				.replace(/:\/\/[^/]*\/id-([0-9a-f]+)\/.*?(\.[^/.]*)(?:[?#].*)?$/, "://img-3.onedio.com/img/$1$2")
				.replace(/\/img\/+(?:[0-9]+\/+bound\/+)?[0-9]*r[0-9]\/+/, "/img/");
		}

		if (domain_nowww === "sn.at") {
			// https://www.sn.at/rihanna-lehnte-offenbar-super-bowl-auftritt-ab-41-79411195.jpg/640x/49.371.649
			//   https://www.sn.at/rihanna-lehnte-offenbar-super-bowl-auftritt-ab-41-79411195.jpg/49.371.649
			return src.replace(/\/[0-9]*x[0-9]*(\/+[0-9]+\.[0-9]+\.[0-9]+)(?:[?#].*)?$/, "$1");
		}

		if (domain_nowww === "meninafm.com.br") {
			// http://www.meninafm.com.br/thumb_indice_noticias.php?img=fotos/15476436895c3f2b29661cb815328889.jpg
			//   http://www.meninafm.com.br/fotos/15476436895c3f2b29661cb815328889.jpg
			return src.replace(/\/thumb_indice_noticias\.php\?(?:.*&)?img=([^&]*).*?$/, "/$1");
		}

		if (domain === "img.lemde.fr") {
			// https://img.lemde.fr/2018/09/21/0/0/5203/3601/688/0/60/0/4fe60ea_5389858-01-06.jpg
			//   https://img.lemde.fr/2018/09/21/0/0/0/0/0/0/0/0/4fe60ea_5389858-01-06.jpg
			// thanks to anonymous for reporting:
			// https://img.lemde.fr/2023/04/12/434/0/2240/1493/1440/960/60/0/4252195_1681309483888-ifn-53140422-1.jpg
			//   https://img.lemde.fr/2023/04/12/0/0/0/0/0/0/0/0/4252195_1681309483888-ifn-53140422-1.jpg
			return src.replace(/(:\/\/[^/]*\/[0-9]{4}\/+(?:[0-9]{2}\/+){2})(?:[0-9]+\/+){8}([0-9a-f]+_[0-9]+-[^/.?#]+\.[^/.]*)(?:[?#].*)?$/,
							   "$10/0/0/0/0/0/0/0/$2");
		}

		if (domain_nowww === "christian-dogma.com") {
			// https://www.christian-dogma.com/im0photos/20190604/43a5c628cb83d64c44daa92448fb5348.jpg&w=100&q=90&.jpg
			//   https://www.christian-dogma.com/photos/20190604/43a5c628cb83d64c44daa92448fb5348.jpg
			return src.replace(/\/im[0-9]+photos\/+([0-9]{8}\/+[0-9a-f]+\.[^/.?&#]*).*?$/, "/photos/$1");
		}

		if (domain_nosub === "feedme.id" && domain.match(/^cdn[0-9]*\./)) {
			// https://cdn2.feedme.id/media/post/medium/54574-setelah-sekian-lama-akhirnya-rihanna-bakal-rilis-album-lagi-kapan-ya.jpg
			//   https://cdn2.feedme.id/media/post/54574-setelah-sekian-lama-akhirnya-rihanna-bakal-rilis-album-lagi-kapan-ya.jpg
			return src.replace(/\/media\/+post\/+[a-z]+\/+/, "/media/post/");
		}

		if (domain_nowww === "businessinsider.in") {
			// https://www.businessinsider.in/thumb/67800950/rosario-dawson-talks-about-her-upcoming-usa-series-from-the-creator-of-mr-robot-and-cory-bookers-2020-presidential-run.jpg?width=640&height=360&resizemode=4
			//   https://www.businessinsider.in/photo/67800950/rosario-dawson-talks-about-her-upcoming-usa-series-from-the-creator-of-mr-robot-and-cory-bookers-2020-presidential-run.jpg
			return src.replace(/\/thumb\/+([0-9]+\/+[^/?#]*)(?:[?#].*)?$/, "/photo/$1");
		}

		if (domain_nowww === "ucatx.cat") {
			// http://www.ucatx.cat/wallpic/small/0/88/girls-wallpaper.jpg
			//   http://www.ucatx.cat/wallpic/full/0/88/girls-wallpaper.jpg
			return src.replace(/\/wallpic\/+[a-z]+\/+/, "/wallpic/full/");
		}

		if (domain === "img.sosanhgia.com") {
			// https://img.sosanhgia.com/images/100x0/dcfb074cb9de4da3947cb407a90bdef3/combo-thuoc-nhuom-toc-cao-cap-mau-vang-anh-kim-cho-da-banh-mat-+-oxy-+-bot-tay.jpeg
			//   https://img.sosanhgia.com/images/dcfb074cb9de4da3947cb407a90bdef3/combo-thuoc-nhuom-toc-cao-cap-mau-vang-anh-kim-cho-da-banh-mat-+-oxy-+-bot-tay.jpeg
			return src.replace(/\/images\/+[0-9]+x[0-9]+\/+/, "/images/");
		}

		if (domain_nosub === "slatic.net") {
			// https://vn-test-11.slatic.net/p/c169d8229689a1777d46b40e81154be2.jpg_340x340q80.jpg_.webp
			//   https://vn-test-11.slatic.net/p/c169d8229689a1777d46b40e81154be2.jpg
			return src.replace(/(\/p\/+[0-9a-f]+\.[^/._]*)_[^/]*(?:[?#].*)?$/, "$1");
		}

		if (domain === "nrt.ysc123.com.cn") {
			// https://nrt.ysc123.com.cn/uploadImg//2018/1122/899154285415189951_490_0.jpg
			//   https://nrt.ysc123.com.cn/uploadImg//2018/1122/899154285415189951.jpg
			return src.replace(/(\/uploadImg\/+[0-9]{4}\/+[0-9]+\/+[0-9]+)_[0-9]+_[0-9]+(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain_nowww === "kpopnews.vn") {
			// https://www.kpopnews.vn/images/2019/4/2/5ca2c3469dc6d665a23ea997/494x300.jpg
			//   https://www.kpopnews.vn/images/2019/4/2/5ca2c3469dc6d665a23ea997/default.jpg
			return src.replace(/(\/images\/+[0-9]{4}\/+(?:[0-9]{1,2}\/+){2}[0-9a-f]{15,}\/+)[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/,
							   "$1default$2");
		}

		if (domain === "t.ylilauta.org") {
			// https://t.ylilauta.org/f0/5f1c59de.jpg
			//   https://i.ylilauta.org/f0/5f1c59de.jpg
			return src.replace(/:\/\/t(\.[^/]*\/)/, "://i$1");
		}

		if (domain === "static.esea.net") {
			// https://static.esea.net/global/images/users/1278607.1559599147_t.jpg
			//   https://static.esea.net/global/images/users/1278607.1559599147.jpg
			return src.replace(/(\/images\/+[^/]*\/+[0-9]+\.[0-9]+)_t(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "cdn.shazoo.ru") {
			// https://cdn.shazoo.ru/c60x60/328664_Kvr7O1reMW_40264243_1819939121435646_171710.jpg
			//   https://cdn.shazoo.ru/328664_Kvr7O1reMW_40264243_1819939121435646_171710.jpg
			return src.replace(/(:\/\/[^/]*\/)c[0-9]+x[0-9]+\/+/, "$1");
		}

		if (domain_nowww === "adultnode.com") {
			// https://adultnode.com/thumb.php?src=https://media.adultnode.com/uploads/photos/2019/03/adultnode_0ebe196fd61bc4d321b8ea51dd09528e.jpg&q=95&w=170&h=170
			//   https://media.adultnode.com/uploads/photos/2019/03/adultnode_0ebe196fd61bc4d321b8ea51dd09528e.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/thumb\.php\?(?:.*?&)?src=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "en.luxuretv.com") {
			// https://en.luxuretv.com/media/misc/thumb-5c0d65ac83831.jpg
			//   https://en.luxuretv.com/media/misc/5c0d65ac83831.jpg
			return src.replace(/(\/media\/+[^/]*\/+)thumb-([0-9a-f]+\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "image.bada.tv") {
			// https://image.bada.tv/files//crawling/2019/04/08/imgur/ah6EdI0.png
			//   https://i.imgur.com/ah6EdI0.png
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/files\/+crawling\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}imgur\/+([^/?#^]*)(?:[?#].*)?$/, "$1");
			if (newsrc !== src)
				return "https://i.imgur.com/" + newsrc;
		}

		if (domain_nowww === "fappenist.com") {
			// https://www.fappenist.com/Uploads/Media/Jan19/Tue29/469/m_131d389c.jpg
			//   https://www.fappenist.com/Uploads/Media/Jan19/Tue29/469/131d389c.jpg
			return src.replace(/(\/Uploads\/+Media\/+[^/]*\/+[^/]*\/+[0-9]+\/+)[a-z]_([0-9a-f]+\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain_nowww === "hitek.fr") {
			// https://hitek.fr/img/products/electronic-arts/electronic-arts-mirrors-edge/photos/w_thu-jun-9-12-33-16-utc-2b0200-2016.jpg
			//   https://hitek.fr/img/products/electronic-arts/electronic-arts-mirrors-edge/photos/thu-jun-9-12-33-16-utc-2b0200-2016.jpg
			return src.replace(/(\/img\/+products\/+.*?\/+photos\/+)w_([^/]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "cdn.dribbble.com") {
			// https://cdn.dribbble.com/users/1253590/screenshots/6744282/lampshades_1x.jpg
			//   https://cdn.dribbble.com/users/1253590/screenshots/6744282/lampshades.jpg
			// https://cdn.dribbble.com/users/2364195/screenshots/6776920/shot-cropped-1563007210060_teaser.png
			//   https://cdn.dribbble.com/users/2364195/screenshots/6776920/shot-cropped-1563007210060.png
			//   https://dribbble.com/shots/6776920 -- original page
			// thanks to anonymous for reporting:
			// https://cdn.dribbble.com/userupload/8252341/file/original-ca00d0d021230934b3589486fb33836f.png?compress=1&resize=100x
			//   https://cdn.dribbble.com/userupload/8252341/file/original-ca00d0d021230934b3589486fb33836f.png
			// other:
			// thanks to anonymous for reporting:
			// https://cdn.dribbble.com/users/3755817/screenshots/6699975/image.png
			newsrc = src.replace(/\?.*/, "");
			if (newsrc !== src)
				return newsrc;

			newsrc = src.replace(/(\/users\/+[0-9]+\/+screenshots\/+[0-9]+\/+[^/]+)_(?:[0-9]+x|teaser)(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
			obj = {
				url: newsrc
			};

			match = src.match(/\/screenshots\/+([0-9]+)\/+/);
			if (match) {
				obj.extra = {page: "https://dribbble.com/shots/" + match[1]};
			}

			return obj;
		}

		if (domain === "s.tmimgcdn.com") {
			// https://s.tmimgcdn.com/scr/52500/web-design-and-advertising-website-template_52537-big.jpg?width=768&height=859
			//   https://s.tmimgcdn.com/scr/52500/web-design-and-advertising-website-template_52537-original.jpg
			// https://s.tmimgcdn.com/scr/61200/61232-big.jpg
			//   https://s.tmimgcdn.com/scr/61200/61232-original.jpg
			// others:
			// https://s.tmimgcdn.com/scr/58600/58663-1300_01.png -- different from:
			//   https://s.tmimgcdn.com/scr/58600/58663-1300_02.png
			// https://s.tmimgcdn.com/scr/54900/54971-origin.jpg -- 1903x4403
			//   https://s.tmimgcdn.com/scr/54900/54971-original.jpg -- 1903x4403
			newsrc = src.replace(/[?#].*/, "");
			if (newsrc !== src)
				return newsrc;

			return src
				.replace(/(\/scr\/+[0-9]+\/+(?:[^/]*_)?[0-9]+)-big(\.[^/.]*)$/, "$1-original$2")
			// https://s.tmimgcdn.com/scr/67600/67674-1300_08.jpg
			//   https://s.tmimgcdn.com/scr/67600/67674-2560_08.jpg
				.replace(/(\/scr\/+[0-9]+\/+[0-9]+-)1300(_[0-9]+\.[^/.]*)(?:[?#].*)?$/, "$12560$2");
		}

		if (domain === "images.all-free-download.com") {
			// https://images.all-free-download.com/images/templates_medium/business_template_2477.jpg
			//   https://images.all-free-download.com/images/templates_large/best_webdesign_template_1920.jpg
			//   https://images.all-free-download.com/images/templates_original/best_webdesign_template_1920.jpg
			// https://images.all-free-download.com/images/graphicthumb/dark_flowers_608925.jpg
			//   https://images.all-free-download.com/images/graphiclarge/dark_flowers_608925.jpg
			//   https://images.all-free-download.com/images/graphicoriginal/dark_flowers_608925.jpg
			// https://images.all-free-download.com/images/footage_medium/night_sky_stars_universe_motion_1108.jpg
			//   https://images.all-free-download.com/images/footage_original/night_sky_stars_universe_motion_1108.jpg
			// https://images.all-free-download.com/images/wallpapers_thum/recore_hd_xbox_one_17495.jpg
			//   http://files.all-free-download.com//downloadfiles/wallpapers/1280_720/recore_hd_xbox_one_17495.jpg
			//   http://files.all-free-download.com/downloadfiles/wallpapers/original/recore_hd_xbox_one_17495.jpg
			newsrc = src.replace(/\/images\/+((?:templates|footage)_|graphic)(?:medium|large|thumb?)\/+/, "/images/$1original/");
			if (newsrc !== src)
				return newsrc;

			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/images\/+wallpapers_[a-z]+\/+/, "http://files.all-free-download.com/downloadfiles/wallpapers/original/");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "files.all-free-download.com") {
			// http://files.all-free-download.com//downloadfiles/wallpapers/1280_720/recore_hd_xbox_one_17495.jpg
			//   http://files.all-free-download.com//downloadfiles/wallpapers/original/recore_hd_xbox_one_17495.jpg
			return {
				url: src.replace(/\/downloadfiles\/+wallpapers\/+[^/]*\/+/, "/downloadfiles/wallpapers/original/"),
				headers: {
					Referer: "https://all-free-download.com/"
				}
			}
		}

		if (domain === "images.themevault.net") {
			// https://images.themevault.net/images/featured-207.png
			//   https://images.themevault.net/images/full-207.jpg
			// https://images.themevault.net/images/thumb-200.jpg
			//   https://images.themevault.net/images/full-200.jpg
			return add_extensions(src.replace(/\/images\/+[a-z]+(-[0-9]+\.[^/.]*)(?:[?#].*)?$/, "/images/full$1"));
		}

		if (domain_nowww === "templatemo.com") {
			// https://templatemo.com/thumbnails-360/tm-245-redox.jpg
			//   https://templatemo.com/screenshots/templatemo_245_redox.jpg
			// https://templatemo.com/thumbnails-360/tm-242-design-blog.jpg
			//   https://templatemo.com/screenshots/templatemo_242_design_blog.jpg
			newsrc = src.replace(/\/thumbnails-[0-9]+\/+tm-([0-9]+-[^/]*)(?:[?#].*)?$/, "/screenshots/templatemo_$1");
			if (newsrc !== src)
				return newsrc.replace(/-/g, "_");
		}

		if (domain === "cdn.pocket-lint.com") {
			// https://cdn.pocket-lint.com/r/s/970x/assets/images/137868-games-review-mirror%E2%80%99s-edge-catalyst-review-image2-ZAWaydrRM1.jpg
			//   https://cdn.pocket-lint.com/assets/images/137868-games-review-mirror%E2%80%99s-edge-catalyst-review-image2-ZAWaydrRM1.jpg
			return src.replace(/\/r\/+s\/+[0-9]*x[0-9]*\/+assets\/+/, "/assets/");
		}

		if (domain === "image.isu.pub") {
			// https://image.isu.pub/160928125247-06a09e58e22e37227bc6994a849e4183/jpg/page_1_thumb_large.jpg
			//   https://image.isu.pub/160928125247-06a09e58e22e37227bc6994a849e4183/jpg/page_1.jpg
			return src.replace(/(:\/\/[^/]*\/[0-9]+-[0-9a-f]{20,}\/+[^/]*\/+page_[0-9]+)_[_a-z]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "static.techspot.com") {
			// https://static.techspot.com/articles-info/1234/images/T_2016-08-23-image-3.jpg
			//   https://static.techspot.com/articles-info/1234/images/2016-08-23-image-3.jpg
			return src.replace(/(\/articles-info\/+[0-9]+\/+images\/+)T_([^/]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "mweb.co.za") {
			// https://www.mweb.co.za/DesktopModules/DigArticle/MediaHandler.ashx?portalid=20&moduleid=5259&mediaid=47052&width=800&height=600
			//   https://www.mweb.co.za/DesktopModules/DigArticle/MediaHandler.ashx?portalid=20&mediaid=47052&width=800&height=600
			//   https://www.mweb.co.za/DesktopModules/DigArticle/MediaHandler.ashx?portalid=20&moduleid=5259&mediaid=47052
			if (/\/MediaHandler\.ashx\?/.test(src)) {
				return keep_queries(src, ["portalid", "moduleid", "mediaid"], {required: ["portalid", "mediaid"]});
			}
		}

		if (domain_nowww === "gaminglives.com" ||
			// thanks to SakalliTavernaci on github: https://github.com/qsniyg/maxurl/issues/1304
			// https://www.dipsahaf.com/wp-content/plugins/dynpicwatermark/DynPicWaterMark_ImageViewer.php?path=2020/07/Untitled-7i.jpg
			//   https://www.dipsahaf.com/wp-content/uploads/2020/07/Untitled-7i.jpg
			domain_nowww === "dipsahaf.com") {
			// https://wordpress.org/plugins/dynpicwatermark/
			//
			// http://www.gaminglives.com/wp-content/plugins/dynpicwatermark/DynPicWaterMark_ImageViewer.php?path=mankind_01_enlrg.jpg
			//   http://www.gaminglives.com/wp-content/uploads/mankind_01_enlrg.jpg
			return src.replace(/\/wp-content\/+plugins\/+dynpicwatermark\/+DynPicWaterMark_ImageViewer\.php\?(?:.*?&)?path=([^&]*).*?$/,
							   "/wp-content/uploads/$1");
		}

		if (domain === "addons.cdn.mozilla.net") {
			// https://addons.cdn.mozilla.net/user-media/previews/thumbs/221/221934.png?modified=1562484071
			//   https://addons.cdn.mozilla.net/user-media/previews/full/221/221934.png?modified=1562484071
			return src.replace(/(\/user-media\/+previews\/+)[a-z]+\/+/, "$1full/");
		}

		if (domain_nosub === "zopix.net") {
			// https://de.zopix.net/image_upload/thumb/200h_143000.jpg
			//   https://de.zopix.net/image_upload/143000-landschaften-sunset-the-pacific.jpg
			return src.replace(/\/image_upload\/+thumb\/+(?:[0-9]+[wh]_)?/, "/image_upload/");
		}

		if (domain_nowww === "jooinn.com") {
			// https://jooinn.com/images350_/space-shuttle-endeavour-4.jpg
			//   https://jooinn.com/images/space-shuttle-endeavour-4.jpg
			return src.replace(/\/images[0-9]*_[0-9]*\/+/, "/images/");
		}

		if (domain === "prt.iza.ne.jp") {
			// thanks to Gyuri on discord
			// https://prt.iza.ne.jp/kiji/entertainments/images/190124/ent19012407330001-q1.jpg
			//   https://prt.iza.ne.jp/kiji/entertainments/images/190124/ent19012407330001-m1.jpg -- 519x720
			// m, p, o, n, q, g, r, s
			return src.replace(/(\/images\/+[0-9]{6}\/+ent[0-9]{10,}-)[a-z]([0-9]\.[^/.]*)(?:[?#].*)?$/,
							   "$1m$2");
		}

		if (domain_nosub === "plus613.net") {
			// http://www.plus613.net/images/thumbs/6/9/d/8/www_plus613_net_tmpTwisted.jpg
			//   http://www.plus613.net/images/6/9/d/8/www_plus613_net_tmpTwisted.jpg
			newsrc = src.replace(/\/images\/+thumbs\/+/, "/images/");
			if (newsrc !== src)
				return newsrc;

			newsrc = src.replace(/\/page\/+hotlink\?(?:.*?&)?action=([^&]*).*?$/, "/images/$1");
			if (newsrc !== src)
				return newsrc;

			return {
				url: src,
				headers: {
					Referer: "http://www.plus613.net/"
				}
			};
		}

		if (domain === "img.milanuncios.com") {
			// https://img.milanuncios.com/fp/2972/08/297208063_1.jpg?VersionId=pd1FVuF.0QgBzaKIyQ1n0QQUZJ9Bhl8r
			//   https://img.milanuncios.com/fg/2972/08/297208063_1.jpg?VersionId=pd1FVuF.0QgBzaKIyQ1n0QQUZJ9Bhl8r
			return src.replace(/(:\/\/[^/]*\/)fp\/+/, "$1fg/");
		}

		if (domain === "ssmscdn.yp.ca") {
			// https://ssmscdn.yp.ca/image/resize/781b4bfa-1bac-4d12-b6d6-0a91d5b90ced/ypui-d-mp-pic-gal-lg/ongles-regal-2.jpg -- upscaled
			//   https://ssmscdn.yp.ca/image/original/781b4bfa-1bac-4d12-b6d6-0a91d5b90ced/ongles-regal-2.jpg
			return src.replace(/\/image\/+resize\/+([-0-9a-f]{20,})\/+[^/]*\/+([^/]*)(?:[?#].*)?$/, "/image/original/$1/$2");
		}

		if (amazon_container === "oblok") {
			// https://oblok.s3.amazonaws.com/gallery_items/55654/panoramic/779F1CF278474D18AAE1664425B69A96.png?1534303035
			//   https://oblok.s3.amazonaws.com/gallery_items/55654/original/779F1CF278474D18AAE1664425B69A96.png?1534303035
			return src.replace(/(\/gallery_items\/+[0-9]+\/+)[^/]*\/+/, "$1original/");
		}

		if (domain_nowww === "salonfloris.ru") {
			// http://salonfloris.ru/thumb/YjsJ-yRLRzPMogx9rXRDMw/360r300/1689227/uo7gqu268jg.jpg
			//   http://salonfloris.ru/d/1689227/d/uo7gqu268jg.jpg
			return src.replace(/\/thumb\/+[^/]*\/+[0-9]+r[0-9]+\/+([0-9]+\/+)/, "/d/$1d/");
		}

		if (domain_nowww === "kmarket43.ru") {
			// http://kmarket43.ru/media/cache/160x180/offers/org-1313/c5/e9/c5e9fd4e-3692-11e9-b29e-d7e4bb69223d.jpg
			//   http://kmarket43.ru/media/offers/org-1313/c5/e9/c5e9fd4e-3692-11e9-b29e-d7e4bb69223d.jpg
			// http://kmarket43.ru/media/offers/org-1313/c5/e9/c5e9fd4e-3692-11e9-b29e-d7e4bb69223d.jpg.310x350_q85_upscale.jpg
			//   http://kmarket43.ru/media/offers/org-1313/c5/e9/c5e9fd4e-3692-11e9-b29e-d7e4bb69223d.jpg
			return src
				.replace(/\/media\/+cache\/+[0-9]+x[0-9]+\/+offers\/+/, "/media/offers/")
				.replace(/(\.[^/.]+)\.[^/.]+\.[^/.]+(?:[?#].*)?$/, "$1");
		}

		if (domain === "assets.perfecte.ro") {
			// https://assets.perfecte.ro/assets/perfecte/2019/07/10/image_galleries/52605/serena-williams-aparitie-indrazneata-pe-coperta-unei-reviste-imaginea-care-i-a-impartit-pe-fani-in-doua_size6.jpg
			//   https://assets.perfecte.ro/assets/perfecte/2019/07/10/image_galleries/52605/serena-williams-aparitie-indrazneata-pe-coperta-unei-reviste-imaginea-care-i-a-impartit-pe-fani-in-doua.jpg
			// https://assets.perfecte.ro/assets/perfecte/2019/07/10/image_galleries/52605/t_size2/thumb_serena-williams-aparitie-indrazneata-pe-coperta-unei-reviste-imaginea-care-i-a-impartit-pe-fani-in-doua.jpg
			//   https://assets.perfecte.ro/assets/perfecte/2019/07/10/image_galleries/52605/serena-williams-aparitie-indrazneata-pe-coperta-unei-reviste-imaginea-care-i-a-impartit-pe-fani-in-doua.jpg
			return src
				.replace(/(\/image_galleries\/+[0-9]+\/+[^/]*)_size[0-9]*(\.[^/.]*)(?:[?#].*)?$/, "$1$2")
				.replace(/(\/image_galleries\/+[0-9]+\/+)t_size[0-9]*\/+thumb_/, "$1");
		}

		if ((domain_nosub === "cuore.es" ||
			// https://img3.stilo.es/1f/4e/a0/selena-gomez-cantara-ozuna-640x388.jpg
			//   https://img3.stilo.es/1f/4e/a0/selena-gomez-cantara-ozuna.jpg
			domain_nosub === "stilo.es" ||
			// https://img1.woman.es/9c/1e/1a/selena-gomez-meghan-makle-comun-600.jpg
			//   https://img1.woman.es/9c/1e/1a/selena-gomez-meghan-makle-comun.jpg
			// https://img3.woman.es/9c/1e/1a/selena-gomez-meghan-makle-comun-640.jpg
			//   https://img3.woman.es/9c/1e/1a/selena-gomez-meghan-makle-comun.jpg
			domain_nosub === "woman.es")
			&& domain.match(/^img[0-9]*\./)) {
			// https://img1.cuore.es/c9/c6/89/rita-ora-posa-alfombra-roja-mtv-ema-2017-600.jpg
			//   https://img1.cuore.es/c9/c6/89/rita-ora-posa-alfombra-roja-mtv-ema-2017.jpg
			// not sure how to improve?
			return src.replace(/(\/(?:[0-9a-f]{2}\/+){3}[^/]*)-[0-9]+(?:x[0-9]+)?(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "100posto.hr") {
			// https://100posto.hr/datastore/imagestore/1440x620/1440x620_1510578109RitaOraOgrtac888.jpg?v=1510578428
			//   https://100posto.hr/datastore/imagestore/original/1510578109RitaOraOgrtac888.jpg?v=1510578428
			return src.replace(/\/datastore\/+imagestore\/+[0-9]+x[0-9]+\/+[0-9]+x[0-9]+_/, "/datastore/imagestore/original/");
		}

		if (domain_nowww === "hot-celebs.co") {
			// https://hot-celebs.co/image/200845/thumb
			//   https://hot-celebs.co/image/200845
			return src.replace(/(\/image\/+[0-9]+)\/+[^/]*(?:[?#].*)?$/, "$1");
		}

		if (domain_nowww === "findnudecelebs.com" ||
			domain_nowww === "searchcelebrityhd.com" ||
			domain_nowww === "pluscelebs.com" ||
			// http://imgtrend.com/free/selena-gomez-sexy-at-living-undocumented-screening-in-la/small/small-selena-gomez-sexy-at-living-undocumented-screening-in-la-1.jpg
			//   http://imgtrend.com/free/selena-gomez-sexy-at-living-undocumented-screening-in-la/selena-gomez-sexy-at-living-undocumented-screening-in-la-1.jpg
			domain_nowww === "imgtrend.com" ||
			// http://chopris.com/free/kendall-jenner-serious-nip-slip-while-out-shopping/small/small-kendall-jenner-serious-nip-slip-while-out-shopping-3.jpg
			//   http://chopris.com/free/kendall-jenner-serious-nip-slip-while-out-shopping/kendall-jenner-serious-nip-slip-while-out-shopping-3.jpg
			domain_nowww === "chopris.com" ||
			domain_nowww === "leadceleb.com" ||
			domain_nowww === "ultraceleb.com" ||
			domain_nowww === "freshfappening.com" ||
			domain_nowww === "allcelebs.club") {
			// http://findnudecelebs.com/free/emelie-jonsson-aniara-2/small/small-emelie-jonsson-aniara-2-1.jpg
			//   http://findnudecelebs.com/free/emelie-jonsson-aniara-2/emelie-jonsson-aniara-2-1.jpg
			newsrc = src.replace(/\/(small)\/+\1-([^/]+\.[^/.]*)(?:[?#].*)?$/, "/$2");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nowww === "celebritying.com") {
			// http://celebritying.com/pictures/jessica-alba-nude-body1/jessica-alba-tn-1.jpg
			//   http://celebritying.com/pictures/jessica-alba-nude-body1/jessica-alba-1.jpg
			// http://www.celebritying.com/9pics/images/barbara-palvin-nude-1-tn.jpg
			//   http://www.celebritying.com/9pics/images/barbara-palvin-nude-1.jpg
			return src
				.replace(/(\/pictures\/+[^/]*\/+[^/]*)-tn(-[0-9]+)?(\.[^/.]*)(?:[?#].*)?$/, "$1$2$3")
				.replace(/(\/images\/+[^/]*)-tn(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "daily-celebvideos.com") {
			// http://www.daily-celebvideos.com/nudecelebs/selena_gomez3/selena_gomez003.jpg
			//   http://www.daily-celebvideos.com/nudecelebs/selena_gomez3/selena_gomez3.jpg
			// todo: improve?
			return src.replace(/00([0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1");
		}

		if (domain_nowww === "nitrovideo.com") {
			// http://www.nitrovideo.com/nude-celebrities/_pgalleries/Winona_Ryder_nude_Autumn_in_New_York/thumbs/tn_Winona_Ryder_nude_Autumn_in_New_York_01.jpg
			//   http://www.nitrovideo.com/nude-celebrities/_pgalleries/Winona_Ryder_nude_Autumn_in_New_York/pictures/Winona_Ryder_nude_Autumn_in_New_York_01.jpg
			return src.replace(/\/thumbs\/+tn_/, "/pictures/");
		}

		if (domain_nowww === "isecretarylegs.com" ||
			// http://www.pussynclit.com/wet-pussy/als-scan/lilian-01-flexible-secretary-wet-pussy-ass-fingering/thumbs/tn_lilian-white-higheels-flexible-pussy-01.jpg
			//   http://www.pussynclit.com/wet-pussy/als-scan/lilian-01-flexible-secretary-wet-pussy-ass-fingering/lilian-white-higheels-flexible-pussy-01.jpg
			domain_nowww === "pussynclit.com" ||
			// http://www.ulingerie.com/babes-in-lingerie/foxes/CJ-Miles_-_Asian-Lady-in-Bustier-Big-Ass-n-Stockings/thumbs/tn_lingerie-foxes_406.jpg
			//    http://www.ulingerie.com/babes-in-lingerie/foxes/CJ-Miles_-_Asian-Lady-in-Bustier-Big-Ass-n-Stockings/lingerie-foxes_406.jpg
			domain_nowww === "ulingerie.com" ||
			// http://www.digitalminx.com/photos/actresses/g/gadot_gal/thumbs/tn_gadot0007.jpg
			//   http://www.digitalminx.com/photos/actresses/g/gadot_gal/gadot0007.jpg
			domain_nowww === "digitalminx.com" ||
			// http://www.vaginavulva.com/galleries/asian-women/claudia-02-a4y_landfrauen-mal-anders-in-strapsen-und-stoeckelschuhen/thumbs/tn_geiler-hintern-halterlose-struempfe_02.jpg
			//   http://www.vaginavulva.com/galleries/asian-women/claudia-02-a4y_landfrauen-mal-anders-in-strapsen-und-stoeckelschuhen/geiler-hintern-halterlose-struempfe_02.jpg
			domain_nowww === "vaginavulva.com") {
			// http://www.isecretarylegs.com/galleries/stmackenzies/November10_Candice_Collyer__Cat_O-Connell__Naomi_Raine_2/thumbs/tn_secretary-001.jpg
			//   http://www.isecretarylegs.com/galleries/stmackenzies/November10_Candice_Collyer__Cat_O-Connell__Naomi_Raine_2/secretary-001.jpg
			return src.replace(/\/thumbs\/+tn_([^/]+)(?:[?#].*)?$/, "/$1");
		}

		if (domain_nowww === "celebact.com") {
			// http://www.celebact.com/bust/43/celebrity-thump-02.jpg
			//   http://www.celebact.com/bust/43/naked-celebrity-02.jpg
			return src.replace(/\/celebrity-thump-/, "/naked-celebrity-");
		}

		if (domain_nowww === "nudecelebs-a-z.com") {
			// http://nudecelebs-a-z.com/pic/tn_KatyPerryIMG_8046.jpg
			//   http://nudecelebs-a-z.com/pic/KatyPerryIMG_8046.jpg
			return src.replace(/(:\/\/[^/]*\/[^/]*\/+)tn_/, "$1");
		}

		if (domain_nowww === "nudecelebspics.net") {
			// https://www.nudecelebspics.net/tour/kendra-sunderland/preview/01.jpg
			//   https://www.nudecelebspics.net/tour/kendra-sunderland/01.jpg
			return src.replace(/\/preview\/+([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/$1");
		}

		if (domain_nowww === "thephuketnews.com") {
			// https://www.thephuketnews.com/image-1.4.1/image.php?width=250&cropratio=4:3&image=https://www.thephuketnews.com/photo/listing/2019/1562825660_1-org.jpg
			//   https://www.thephuketnews.com/photo/listing/2019/1562825660_1-org.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/image-[.0-9]+\/+image\.php\?(?:.*?&)?image=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nosub === "naharnet.com" && domain.match(/^images[0-9]*\./)) {
			// http://images0.naharnet.com/images/217342/w460.jpg?1543904604
			//   http://images0.naharnet.com/images/217342/original.jpg?1543904604
			return src.replace(/(\/images\/+[0-9]+\/+)[wh][0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1original$2");
		}

		if (domain === "img.beritasatu.com") {
			// https://img.beritasatu.com/cache/jakartaglobe/960x620-4/2018/12/2018-11-27T130739Z_1904968908_RC148064D8D0_RTRMADP_3_GLOBAL-POY.jpg
			//   https://img.beritasatu.com/jakartaglobe/2018/12/2018-11-27T130739Z_1904968908_RC148064D8D0_RTRMADP_3_GLOBAL-POY.jpg
			return src.replace(/\/cache\/+([^/]*)\/+[0-9]+x[0-9]+-[0-9]+\/+/, "/$1/");
		}

		if (domain === "nnimgt-a.akamaihd.net" ||
			// https://www.illawarramercury.com.au/images/transform/v1/crop/frm/silverstone-feed-data/59393c2f-d099-44c8-8770-26fdeaf9aea6.jpg/r0_0_4288_2849_w1200_h678_fmax.jpg
			//   https://www.illawarramercury.com.au/images/transform/v1/resize/frm/silverstone-feed-data/59393c2f-d099-44c8-8770-26fdeaf9aea6.jpg/w0_h0_fscale.jpg
			domain_nowww === "illawarramercury.com.au" ||
			// thanks to dym-sh on github for reporting: https://github.com/qsniyg/maxurl/issues/842
			// https://www.thesenior.com.au/images/transform/v1/crop/frm/vuJmMAkyxKfBpiJqjiHTXS/6170b4c0-9085-4e3c-9a67-f7d0dba69ae6.jpg/r0_0_2291_1522_w1200_h678_fmax.jpg
			//   https://www.thesenior.com.au/images/transform/v1/resize/frm/vuJmMAkyxKfBpiJqjiHTXS/6170b4c0-9085-4e3c-9a67-f7d0dba69ae6.jpg/w0_h0_fscale.jpg
			domain_nowww === "thesenior.com.au" ||
			// thanks to dym-sh on github for reporting: https://github.com/qsniyg/maxurl/issues/842
			// https://www.canberratimes.com.au/images/transform/v1/crop/frm/vuJmMAkyxKfBpiJqjiHTXS/6170b4c0-9085-4e3c-9a67-f7d0dba69ae6.jpg/r0_0_2291_1522_w1200_h678_fmax.jpg
			//   https://www.canberratimes.com.au/images/transform/v1/resize/frm/vuJmMAkyxKfBpiJqjiHTXS/6170b4c0-9085-4e3c-9a67-f7d0dba69ae6.jpg/w0_h0_fscale.jpg
			domain_nowww === "canberratimes.com.au" ||
			// thanks to anonymous for reporting:
			// https://www.northerndailyleader.com.au/images/transform/v1/crop/frm/KUhQizDbwW8WqAyPP4x5yp/aad1e5ae-7b41-4011-ae8b-7f6e8cdb13cb.jpg/r0_8_3474_1959_w454_h255_fmax.jpg
			//   https://www.northerndailyleader.com.au/images/transform/v1/resize/frm/KUhQizDbwW8WqAyPP4x5yp/aad1e5ae-7b41-4011-ae8b-7f6e8cdb13cb.jpg/w0_h0_fscale.jpg
			domain_nowww === "northerndailyleader.com.au" ||
			// thanks to anonymous for reporting:
			// https://www.hawkesburygazette.com.au/images/transform/v1/crop/frm/silverstone-feed-data/83c69e9a-d532-4303-8db6-7d31db31d4cc.jpg/r0_0_800_600_w1200_h678_fmax.webp
			//   https://www.hawkesburygazette.com.au/images/transform/v1/resize/frm/silverstone-feed-data/83c69e9a-d532-4303-8db6-7d31db31d4cc.jpg/w0_h0_fscale.webp
			domain_nowww === "hawkesburygazette.com.au" ||
			// thanks to anonymous for reporting:
			// https://www.theleader.com.au/images/transform/v1/crop/frm/137578502/6e23b1ab-793d-48fb-b7c6-17cae54099bd.jpg
			//   https://www.theleader.com.au/images/transform/v1/resize/frm/137578502/6e23b1ab-793d-48fb-b7c6-17cae54099bd.jpg/w0_h0_fscale.jpg
			domain_nowww === "theleader.com.au" ||
			// thanks to anonymous for reporting:
			// https://www.examiner.com.au/images/transform/v1/crop/frm/storypad-C3fzmZSeE4zEq4PyG5Utt8/84d63f34-e4b0-400e-abb7-f02e54f9c253.jpg/r2_0_5182_2914_w1200_h678_fmax.jpg
			//   https://www.examiner.com.au/images/transform/v1/resize/frm/storypad-C3fzmZSeE4zEq4PyG5Utt8/84d63f34-e4b0-400e-abb7-f02e54f9c253.jpg/w0_h0_fscale.jpg
			domain_nowww === "examiner.com.au" ||
			// https://www.northweststar.com.au/images/transform/v1/crop/frm/Y5kUJ9Q7iPMNzBC9i5WqCU/a68e9967-e0cd-4818-a227-878719e98f65.jpg/r0_0_1200_677_w1200_h678_fmax.jpg
			//   https://www.northweststar.com.au/images/transform/v1/resize/frm/Y5kUJ9Q7iPMNzBC9i5WqCU/a68e9967-e0cd-4818-a227-878719e98f65.jpg/w0_h0_fscale.jpg
			domain_nowww === "northweststar.com.au") {
			// https://nnimgt-a.akamaihd.net/transform/v1/crop/frm/37uSWs3eyNM24fqefKJaatC/15f3290a-c825-48cd-a43d-8a924725bbb9.JPG/r7_0_3065_1728_w1200_h678_fmax.jpg
			//   https://nnimgt-a.akamaihd.net/transform/v1/resize/frm/37uSWs3eyNM24fqefKJaatC/15f3290a-c825-48cd-a43d-8a924725bbb9.JPG/w0_h0_fscale.jpg
			return src.replace(/\/transform\/+v1\/+[a-z]+\/+(frm\/+[^/]*\/+[^/]*\.[^/.]*)\/+[^/]*?(\.[^/.]*)?(?:[?#].*)?$/,
							   "/transform/v1/resize/$1/w0_h0_fscale$2");
		}

		if (domain_nosub === "productserve.com" && domain.match(/^images[0-9]*\./)) {
			// https://images2.productserve.com/?w=200&h=200&bg=white&trim=5&t=letterbox&url=ssl%3Abonprix.scene7.com%2Fis%2Fimage%2FOttoUK%2F800h%2Fdippy-hem-blouse~979903FRSP.jpg&feedId=3128&k=3fbca2e9eca2569c312999c0d75f192ec3955c37
			//   https://bonprix.scene7.com/is/image/OttoUK/800h/dippy-hem-blouse~979903FRSP.jpg
			// https://images2.productserve.com/?w=200&h=200&bg=white&trim=5&t=letterbox&url=images.eil.com%2Flarge_image%2FXXX-729160.jpg&feedId=1552&k=eaa4ffbf2838f57334fdd5781f2abe1577359ac2
			//   https://images.eil.com/product-size-custom/729160.jpg
			match = src.match(/^[a-z]+:\/\/[^/]*\/\?(?:.*?&)url=([^&]*).*?$/);
			if (match) {
				newsrc = match[1];
				match = newsrc.match(/^ssl(?::|%3[Aa])(.*)/)
				if (match) {
					return "https://" + decodeURIComponent(match[1]);
				} else {
					return add_http(decodeURIComponent(newsrc));
				}
			}
		}

		if (domain_nowww === "sunhome.ru" ||
			// https://i.sunhome.ru/wallpapers/191/selena-gomez-v15.l.jpg
			//   https://i.sunhome.ru/wallpapers/191/selena-gomez-v15.orig.jpg
			domain === "i.sunhome.ru") {
			// https://www.sunhome.ru/i/wallpapers/120/selena-gomez-v24.1024x600.jpg
			//   https://www.sunhome.ru/i/wallpapers/120/selena-gomez-v24.orig.jpg
			return src.replace(/(\/wallpapers\/+[0-9]+\/+[^/]*)\.(?:[0-9]+x[0-9]+|[a-z])(\.[^/.]*)(?:[?#].*)?$/,
							   "$1.orig$2");
		}

		if (domain_nowww === "i-gency.ru") {
			// http://i-gency.ru/news_images/2016/02/16/3023/first_59f935d0f4b22c353b9b9447edef4e29.jpg
			//   http://i-gency.ru/news_images/2016/02/16/3023/59f935d0f4b22c353b9b9447edef4e29.jpg
			return src.replace(/(\/[0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9]+\/+)first_([0-9a-f]{15,}\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain === "photos.stories-porno.net") {
			// https://photos.stories-porno.net/preview/34/3413/6tqullw3.jpg
			//   https://photos.stories-porno.net/photos/34/3413/6tqullw3.jpg
			return src.replace(/(:\/\/[^/]*\/)preview\/+/, "$1photos/");
		}

		if (domain_nowww === "bazos.sk") {
			// https://www.bazos.sk/img/1t/824/100830824.jpg?t=1563470898
			//   https://www.bazos.sk/img/1/824/100830824.jpg?t=1563470898
			return src.replace(/(\/img\/+[0-9]+)t\/+/, "$1/");
		}

		if (domain_nowww === "pegitboard.com") {
			// https://pegitboard.com/pics/t/s-318888.jpg
			//   https://pegitboard.com/pics/t/318888.jpg
			//   https://www.pegitboard.com/pics/318888.jpg
			// https://www.pegitboard.com/pics/t/365201.jpg
			//   https://www.pegitboard.com/pics/365201.jpg
			return src.replace(/(\/pics\/+)(?:[^/]*\/+)?(?:[a-z]-)?([0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "media.tio.ch") {
			// https://media.tio.ch/files/domains/tio.ch/images/thumb/4bsh/-selena-gomez-non-era-al-met-gala-ma-sta-bene-h352.jpg?v=1
			//   https://media.tio.ch/files/domains/tio.ch/images/4bsh/-selena-gomez-non-era-al-met-gala-ma-sta-bene-h352.jpg?v=1
			return src.replace(/\/images\/+thumb\/+/, "/images/");
		}

		if (domain === "cdn-images.oovvuu.com") {
			// https://cdn-images.oovvuu.com/200x0/BANG7049.jpg
			//   https://cdn-images.oovvuu.com/0x0/BANG7049.jpg -- 1000x650
			// -x0 actually flips the image, larger values upscale
			return src.replace(/(:\/\/[^/]*\/)[0-9]+x[0-9]+\/+/, "$10x0/");
		}

		if (domain_nowww === "noihirek.hu") {
			// http://noihirek.hu/kep.php?kep=pictures/celebvonal/hihetetlen_hogy_selena_gomez_kepes_volt_felvenni_ezt_az_ocsmany_cipot_1.jpg&x=1000&y=450px
			//   http://noihirek.hu/pictures/celebvonal/hihetetlen_hogy_selena_gomez_kepes_volt_felvenni_ezt_az_ocsmany_cipot_1.jpg
			// http://noihirek.hu/thumb_pictures/celebvonal/selena_gomez_ismet_a_regi_1.jpg
			//   http://noihirek.hu/pictures/celebvonal/selena_gomez_ismet_a_regi_1.jpg -- upscaled?
			return src
				.replace(/(:\/\/[^/]*\/)kep\.php\?(?:.*?&)?kep=([^&]*).*?$/, "$1$2")
				.replace(/(:\/\/[^/]*\/)thumb_pictures\/+/, "$1pictures/");
		}

		if (domain_nosub === "worldsex.com" && domain.match(/^cdn[0-9]*/)) {
			// https://cdn2-thumbs.worldsex.com/albums/14/13936/68a516f090530764ba572922b79ec046c0464060_001_240x.jpg
			//   https://cdn2-thumbs.worldsex.com/albums/14/13936/68a516f090530764ba572922b79ec046c0464060_001_240x@2x.jpg -- upscaled?
			//   https://cdn2-thumbs.worldsex.com/albums/14/13936/68a516f090530764ba572922b79ec046c0464060_001.jpg
			return src.replace(/_[0-9]+x(?:@[0-9]+x)?(\.[^/.]*)(?:[?#].*)?$/, "$1");
		}

		if (domain_nowww === "famitsu.com") {
			// thanks to fireattack on github: https://github.com/qsniyg/maxurl/issues/94
			// https://www.famitsu.com/images/000/180/011/t_5d33812449c74.jpg -- 100x56
			//   https://www.famitsu.com/images/000/180/011/l_5d33812449c74.jpg -- 640x360
			//   https://www.famitsu.com/images/000/180/011/y_5d33812449c74.jpg -- 1280x720
			//   https://www.famitsu.com/images/000/180/011/z_5d33812449c74.jpg -- 1920x1080
			// https://www.famitsu.com/images/000/124/494/t_5874c086779f9.jpg
			//   https://www.famitsu.com/images/000/124/494/5874c086779f9.jpg -- 250x140
			//   https://www.famitsu.com/images/000/124/494/l_5874c086779f9.jpg -- 640x360, y/z don't work
			// https://www.famitsu.com/images/000/181/637/5d5a8379e4e00.jpg
			//   https://www.famitsu.com/images/000/181/637/z_5d5a8379e4e00.jpg
			// https://www.famitsu.com//images/000/181/281/s_5d4d21c3a51d3.jpg
			//   https://www.famitsu.com//images/000/181/281/z_5d4d21c3a51d3.jpg
			// thanks to fireattack on github: https://github.com/qsniyg/maxurl/issues/364
			// https://www.famitsu.com/images/000/160/712/5b46f32b76a9a.jpg
			//   https://www.famitsu.com/images/000/160/712/z_5b46f32b76a9a.jpg
			// others:
			// https://www.famitsu.com/images/000/124/494/5874c0867b874.jpg -- 3000x4500
			//   https://www.famitsu.com/images/000/124/494/l_5874c0867b874.jpg -- 426x640

			// thanks to fireattack on discord:
			// https://www.famitsu.com/image/33211/s111_cBNJykxY6N2gvoN4dnMGiz5N72Mj9Bfa.jpg
			//   https://www.famitsu.com/image/33211/cBNJykxY6N2gvoN4dnMGiz5N72Mj9Bfa.jpg
			newsrc = src.replace(/(\/image\/+[0-9]+\/+)s[0-9]+_([^/.?#_]{10,}\.)/, "$1$2");
			if (newsrc !== src)
				return newsrc;

			regex = /(\/images\/+(?:[0-9]{3}\/+){3})(?:[stlyz]_)?([0-9a-f]+\.[^/.]*)(?:[?#].*)?$/;
			var get_larger_famitsu = function(src) {
				return [
					src.replace(regex, "$1z_$2"),
					src.replace(regex, "$1y_$2"),
					src.replace(regex, "$1l_$2")
				];
			};

			if (regex.test(src)) {
				var larger_urls = get_larger_famitsu(src);

				if (options.do_request && options.cb) {
					larger_urls.unshift(src.replace(regex, "$1$2"));

					common_functions["find_actual_largest_image"](src, larger_urls, options.cb, {
						check_length: true,
						api_cache: api_cache,
						do_request: options.do_request
					});

					return {
						waiting: true
					};
				} else {
					return get_larger_famitsu(src);
				}
			}

			// thanks again to fireattack:
			// https://www.famitsu.com/serial/gameiscool/201908/25181637.html
			//   https://www.famitsu.com/serial/gameiscool/images/s00000028s.jpg
			//   https://www.famitsu.com/serial/gameiscool/images/s00000028o.jpg
			// doesn't work:
			// https://www.famitsu.com/serial/gameiscool/images/s00000028a.jpg
			//   https://www.famitsu.com/serial/gameiscool/images/s00000028o.jpg -- different image
			return src.replace(/(\/images\/+s[0-9]{6,})s(\.[^/.]*)(?:[?#].*)?$/, "$1o$2");
		}

		if (domain_nowww === "sexiestpicture.com") {
			// https://www.sexiestpicture.com/upload/Pictures/thumbs/Selena-Gomez-sexy-selena-gomez-sexy-minidress-legs-paparazzi_big.jpg
			//   https://www.sexiestpicture.com/upload/Pictures/storage/Selena-Gomez-sexy-selena-gomez-sexy-minidress-legs-paparazzi.jpg
			return src.replace(/(\/upload\/+Pictures\/+)thumbs\/+([^/]+)_[a-z]+(\.[^/.]*)(?:[?#].*)?$/, "$1storage/$2$3");
		}

		if (domain_nowww === "woman-project.com") {
			// https://woman-project.com/uploads/1409605200/thumb/1b5ec07ef1842d.jpg
			//   https://woman-project.com/uploads/1409605200/1b5ec07ef1842d.jpg
			return src.replace(/(\/uploads\/+[0-9]+\/+)thumb\/+/, "$1");
		}

		if (domain_nowww === "hamaraphotos.com") {
			// thanks to anonymous for reporting:
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+(photo_-[0-9]+\.html)(?:[?#].*)?$/,
				query_for_id: "https://hamaraphotos.com/${id}",
				process: function(done, resp, cache_key) {
					let image = get_meta(resp.responseText, "og:image");
					if (!image) {
						console_error(cache_key, "Unable to find og:image from", resp);
						return done(null, false);
					}

					return done(image, 6*60*60);
				}
			});
			if (newsrc) return newsrc;

			// https://hamaraphotos.com/albums300/wpw-20110721/thumb_A%20model%20walks%20the%20runway%20at%20the%20Aguaclara%20show%20during%20Merecedes-Benz%20Fashion%20Week%20Swim%202012%20%20on%20July%2018%2C%202011%20in%20Miami%20Beach%2C%20United%20States%20%282%29.JPG
			//   https://hamaraphotos.com/albums300/wpw-20110721/fullsize_A%20model%20walks%20the%20runway%20at%20the%20Aguaclara%20show%20during%20Merecedes-Benz%20Fashion%20Week%20Swim%202012%20%20on%20July%2018%2C%202011%20in%20Miami%20Beach%2C%20United%20States%20%282%29.JPG
			// other:
			// https://hamaraphotos.com/albums300_2012/wpw-20190617/hpse_fullsize__1384302150_Anusha%20Dandekar%20at%20Rohini%20Iyyer_s%20party%20on%2016th%20June%202019%20%2810%29_5d0749e285c15.JPG
			newsrc = src.replace(/(\/albums300\/+wpw-[0-9]+\/+)thumb_/, "$1fullsize_");
			if (newsrc !== src) return newsrc;
		}

		if (host_domain_nowww === "hamaraphotos.com" && options.element) {
			if (options.element.tagName === "IMG") {
				let parent = common_functions["get_parent_el_matching"](options.element, x => x.tagName === "A" && /\/photo[^/]+-[0-9]+\.html/.test(x.href));
				if (parent) {
					return {
						url: parent.href,
						is_pagelink: true
					};
				}
			}
		}

		if (domain_nosub === "vetton.ru" && domain.match(/^img[0-9]*\./)) {
			// http://img2.vetton.ru//upl/1000/2/138/vetton_ru_koroganwallapack551.jpg
			//   http://img2.vetton.ru//upl/1000/2/vetton_ru_koroganwallapack551.jpg
			return src.replace(/(\/upl\/+[0-9]+\/+[0-9]+\/+)[0-9]+\/+/, "$1");
		}

		if (domain === "edu.glogster.com") {
			// https://edu.glogster.com/proxy?url=https%3A%2F%2Fcdn1.artstation.com%2Fp%2Fassets%2Fimages%2Fimages%2F000%2F520%2F217%2Flarge%2Frichard-luong-joker-1.jpg%3F1425443091
			//   https://cdn1.artstation.com/p/assets/images/images/000/520/217/large/richard-luong-joker-1.jpg?1425443091
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/proxy\?(?:.*?&)?url=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "images.toofab.com" ||
			// https://imagez.tmz.com/image/64/16by9/2019/07/07/6497b5e1c4104c3b9d974898f53651cf_lg.jpg
			//   https://imagez.tmz.com/image/64/16by9/2019/07/07/6497b5e1c4104c3b9d974898f53651cf_xl.jpg -- larger, upscaled?
			//   https://imagez.tmz.com/image/64/16by9/2019/07/07/6497b5e1c4104c3b9d974898f53651cf.jpg -- same size
			//   https://imagez.tmz.com/image/64/o/2019/07/07/6497b5e1c4104c3b9d974898f53651cf.jpg -- 2052x2429
			// https://imagez.tmz.com/image/c1/o/2017/05/12/c12e83ef1ec25e4d95c3d4113b342b77_lg.png -- upscaled
			//   https://imagez.tmz.com/image/c1/o/2017/05/12/c12e83ef1ec25e4d95c3d4113b342b77.png
			// https://imagez.tmz.com/image/94/o/2012/11/08/940572c1f4a853b59ac0eda452bc8ca2_lg.jpg -- probably upscaled
			//   https://imagez.tmz.com/image/94/o/2012/11/08/940572c1f4a853b59ac0eda452bc8ca2.jpg
			domain === "imagez.tmz.com") {
			// https://images.toofab.com/image/5f/16by9/2021/01/05/5f900c0cabae46c29887609d1b7d9389_xs.jpg -- 300x168
			//   https://images.toofab.com/image/5f/16by9/2021/01/05/5f900c0cabae46c29887609d1b7d9389.jpg -- 1140x641
			//   https://images.toofab.com/image/5f/o/2021/01/05/5f900c0cabae46c29887609d1b7d9389.jpg -- 1620x1164
			// https://images.toofab.com/image/44/4by3/2021/01/06/443de4d36fa94976b145eaba959d2fff_sm.jpg -- 420x315
			//   https://images.toofab.com/image/44/4by3/2021/01/06/443de4d36fa94976b145eaba959d2fff.jpg -- 1140x855
			//   https://images.toofab.com/image/44/o/2021/01/06/443de4d36fa94976b145eaba959d2fff.jpg -- 1620x1920
			// https://images.toofab.com/image/b3/o/2021/01/06/b3bc4dade59f4679aaa6fed39ca7944f_lg.jpg -- 1140x1710
			//   https://images.toofab.com/image/b3/o/2021/01/06/b3bc4dade59f4679aaa6fed39ca7944f.jpg -- 2103x3155
			// https://images.toofab.com/image/45/o/2019/02/12/45fafffbbf7f505f9e16f07b64d2b207_lg.jpg -- 1140x1140, upscaled
			//   https://images.toofab.com/image/45/o/2019/02/12/45fafffbbf7f505f9e16f07b64d2b207.jpg -- 640x640
			return src.replace(/(\/image\/+[0-9a-f]{2}\/+)(?:o|[0-9]+by[0-9]+)(\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9a-f]{10,})(?:_[a-z]{2})?(\.[^/.]+)(?:[?#].*)?$/, "$1o$2$3");
			//return src.replace(/(\/[0-9a-f]{30,})_[a-z]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nosub === "offnews.bg" && domain.match(/^i[0-9]*\./)) {
			// https://i2.offnews.bg//events/2016/11/24/640674/phpfkxdib_559x*.jpg
			//   https://i2.offnews.bg//events/2016/11/24/640674/phpfkxdib.jpg
			return src.replace(/(\/[^/._]+)_[*0-9]+x[*0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "slender-model.com") {
			// https://slender-model.com/images/homepeep/homepeep09s.jpg
			//   https://slender-model.com/images/homepeep/homepeep09.jpg
			return src.replace(/(\/images\/+[^/]*\/+[^/]*[0-9]+)s(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "24eropixel.net") {
			// https://24eropixel.net/uploads/images/00/055/467/55467/desktop_thumbs/1474409.jpg
			//   https://24eropixel.net/uploads/images/00/055/467/55467/140x200/1474409.jpg
			//   https://24eropixel.net/uploads/images/00/055/467/55467/original/1474409.jpg
			return src.replace(/(\/uploads\/+images\/+(?:[0-9]+\/+){3,})(?:[0-9]+x[0-9]+|desktop_thumbs)\/+/,
							   "$1original/");
		}

		if (domain_nowww === "xoxodigital.com") {
			// https://xoxodigital.com/content/post/15538/thumbs/ekran-resmi-2019-07-20-163412-medium.png
			//   https://xoxodigital.com/content/post/15538/ekran-resmi-2019-07-20-163412-medium.png
			return src.replace(/(\/content\/+post\/+[0-9]+\/+)thumbs\/+/, "$1");
		}

		if (domain_nosub === "xdn.vn" && /^[0-9]+\.mm\.baomoi\./.test(domain)) {
			// http://3.mm.baomoi.xdn.vn/w500_r1/b835503d3c78d5268c69.jpg
			//   http://3.mm.baomoi.xdn.vn/b835503d3c78d5268c69.jpg
			return src.replace(/(:\/\/[^/]*\/)[wh][0-9]+_r[0-9]*\/+/, "$1");
		}

		if (domain === "photo-resize-zmp3.zmdcdn.me") {
			// thanks to anonymous for reporting:
			// https://photo-resize-zmp3.zmdcdn.me/w240_r1x1_jpeg/covers/0/d/0d5b1c4c7f720f698946c7f6ab08f687_1425889433.jpg
			//   https://photo-zmp3.zmdcdn.me/covers/0/d/0d5b1c4c7f720f698946c7f6ab08f687_1425889433.jpg
			return src.replace(/:\/\/([^/]+)-resize(-[^/]+\.zmdcdn\.me\/+)[^/]+\/+/, "://$1$2");
		}

		if (domain_nosub === "meinbezirk.at" && /^media[0-9]*\./.test(domain)) {
			// https://media04.meinbezirk.at/article/2017/03/21/0/10080290_S.jpg
			//   https://media04.meinbezirk.at/article/2017/03/21/0/10080290_XXL.jpg -- stretched
			//   https://media04.meinbezirk.at/article/2017/03/21/0/10080290_NATIVE.jpg -- 635x900
			// other:
			// https://media04.meinbezirk.at/article/2019/05/26/4/19401024_NATIVE.jpg?1562353331 -- 4360x3261
			return src.replace(/(\/article\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9]+\/+[0-9]+)_[A-Z]+(\.[^/.]*)(?:[?#].*)?$/,
							   "$1_NATIVE$2");
		}

		if (domain_nowww === "elporvenir.mx") {
			// http://www.elporvenir.mx/imagenes/noticias/thumb/19/04/29/mini_190429_robert.jpg
			//   http://www.elporvenir.mx/imagenes/noticias/portada/19/04/29/190429_robert.jpg
			//   http://www.elporvenir.mx/imagenes/noticias/original/19/04/29/190429_robert.jpg
			newsrc = src.replace(/(\/imagenes\/+noticias\/+)thumb\/+((?:[0-9]{2}\/+){3})[a-z]+_([0-9]{6}_)/,
								 "$1original/$2$3");
			if (newsrc !== src)
				return newsrc;

			return src.replace(/\/imagenes\/+noticias\/+portada\/+/, "/imagenes/noticias/original/");
		}

		if (domain_nowww === "newsbeast.gr") {
			// https://www.newsbeast.gr/resizeme.php?src=https://s.nbst.gr/files/1/2017/08/Robert-Downey-Jr.-353x221.jpg&w=158&h=99
			//   https://s.nbst.gr/files/1/2017/08/Robert-Downey-Jr..jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/resizeme\.php\?(?:.*?&)?src=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "s.nbst.gr") {
			// https://s.nbst.gr/files/1/2013/04/20/bradley-cooper.thumbnail.jpg
			//   https://s.nbst.gr/files/1/2013/04/20/bradley-cooper.jpg
			return src.replace(/(\/files\/.*)\.thumbnail(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "image.newsis.com") {
			// http://image.newsis.com/2017/06/29/NISI20170629_0013153492_thm.jpg
			//   http://image.newsis.com/2017/06/29/NISI20170629_0013153492_web.jpg
			return src.replace(/(:\/\/[^/]*\/[0-9]{4}\/+(?:[0-9]{2}\/+){2}NISI[0-9]+_[0-9]+_)thm(\.[^/.]*)(?:[?#].*)?$/,
							   "$1web$2");
		}

		if (domain_nowww === "techpowerup.com" ||
			// thanks to anonymous for reporting:
			// https://tpucdn.com/review/amd-ryzen-5-7600x/images/arch5_small.jpg
			//   https://tpucdn.com/review/amd-ryzen-5-7600x/images/arch5.jpg
			domain_nowww === "tpucdn.com") {
			// https://www.techpowerup.com/img/CynraNCwRWsSI7wP_thm.jpg
			//   https://www.techpowerup.com/img/CynraNCwRWsSI7wP.jpg
			// https://www.techpowerup.com/review/amd-ryzen-5-7600x/images/arch5_small.jpg
			//   https://www.techpowerup.com/review/amd-ryzen-5-7600x/images/arch5.jpg
			// https://www.techpowerup.com/review/amd-ryzen-5-7600x/images/small@1x.png
			//   https://www.techpowerup.com/review/amd-ryzen-5-7600x/images/small.png
			return src
				.replace(/(\/images\/+[^/.]+)@1x(\.[^/.]+)(?:[?#].*)?$/, "$1$2")
				.replace(/(\/(?:img|images)\/+[^/]+)_(?:thm|small)(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "plaza.jp.rakuten-static.com") {
			// https://plaza.jp.rakuten-static.com/api/Proxy.php?a=http%3A%2F%2Fimage.newsis.com%2F2015%2F02%2F10%2FNISI20150210_0010612208_web.jpg&b=e35d2fdbdc32519e5d05e3f394efd6c8
			//   http://image.newsis.com/2015/02/10/NISI20150210_0010612208_web.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/api\/+Proxy\.php\?(?:.*?&)?a=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nowww === "5true.net") {
			// https://5true.net/img-prx.php?u=aHR0cHM6Ly93d3cuZGtuLnR2L3dwLWNvbnRlbnQvdXBsb2Fkcy8yMDE4LzEwLzE1Mzk3NjU4NjA4MDYtMzAxNl9VbnRpdGxlZC5qcGc=
			//   https://www.dkn.tv/wp-content/uploads/2018/10/1539765860806-3016_Untitled.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/img-prx\.php\?(?:.*?&)?u=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return base64_decode(newsrc);
		}

		if (domain === "musicglue-images-prod.global.ssl.fastly.net") {
			// thanks to nimbuz on discord for reporting
			// https://musicglue-images-prod.global.ssl.fastly.net/iron-maiden-global-merchandise-uk/product/maiden-remastered-maiden-japan-black-tee?u=aHR0cHM6Ly9tdXNpY2dsdWUtdXNlci1hcHAtcC02LXAuczMuYW1hem9uYXdzLmNvbS9vcmlnaW5hbHMvZTViZTljYmEtYmNkOC00MWYzLWI3ZTUtZWY0NTI1ZWE0M2Ey&width=1200&mode=contain
			//   https://musicglue-user-app-p-6-p.s3.amazonaws.com/originals/e5be9cba-bcd8-41f3-b7e5-ef4525ea43a2
			newsrc = remove_queries(src, ["width", "mode"]);
			if (newsrc !== src)
				return newsrc;

			newsrc = src.replace(/.*[?&]u=(aHR0c[^&]+)(?:[&#].*)?$/, "$1");
			if (newsrc !== src)
				return base64_decode(newsrc);
		}

		if (domain === "imb.veooz.com") {
			// https://imb.veooz.com/sO/~D/sOUkM~D-small.jpg
			//   https://imb.veooz.com/sO/~D/sOUkM~D-large.jpg
			return src.replace(/-small(\.[^/.]*)(?:[?#].*)?$/, "-large$1");
		}

		if (domain_nowww === "criturk.com") {
			// http://www.criturk.com/image/upload/2019/07/03/news_a2a2ff33b02eb8438c2bac63b4b9d196-750X422.jpg
			//   http://www.criturk.com/image/upload/2019/07/03/news_a2a2ff33b02eb8438c2bac63b4b9d196.jpg
			return src.replace(/(\/image\/+upload\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[a-z]+_[0-9a-f]{20,})-[0-9]+X[0-9]+(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain === "cdn.20m.es") {
			// https://cdn.20m.es/img2/recortes/2019/03/12/905165-943-646.jpg
			//   https://cdn.20m.es/img2/2019/03/12/905165.jpg
			return src.replace(/\/recortes\/+([0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9]+)(?:-[0-9]+){1,2}(\.[^/.]*)(?:[?#].*)?$/,
							   "/$1$2");
		}

		if (domain === "tgp.inthecrack.com" ||
			// http://crack-assets.com/assets/images/hosted/galleries/32f1093d-7a0b-4576-8b00-c2a5923261a0/346_001.jpg
			//   http://crack-assets.com/assets/images/hosted/galleries/full/32f1093d-7a0b-4576-8b00-c2a5923261a0/346_001.jpg
			domain_nowww === "crack-assets.com") {
			// http://tgp.inthecrack.com/assets/images/hosted/galleries/be39c045-168a-47aa-bb85-41f609a4a7e2/1080_005.jpg
			//   http://tgp.inthecrack.com/assets/images/hosted/galleries/full/be39c045-168a-47aa-bb85-41f609a4a7e2/1080_005.jpg
			// cloudflare protection, prevents it from working without the cookie
			return {
				url: src.replace(/\/assets\/+images\/+hosted\/+galleries\/+([-0-9a-f]{20,})/, "/assets/images/hosted/galleries/full/$1"),
			};
		}

		if (domain === "content.pornstarplatinum.com") {
			// http://content.pornstarplatinum.com/fhg/grx/pic/13/images/thumb1.jpg
			//   http://content.pornstarplatinum.com/fhg/grx/pic/13/images/pic1.jpg
			return src.replace(/\/images\/+thumb([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/images/pic$1");
		}

		if (domain === "t.auntmia.com" ||
			// http://t.sexywhitepussy.com/nthumbs//2013-08-26/2083542/2083542_00.jpg
			//   http://t.sexywhitepussy.com/nthumbs//2013-08-26/2083542/2083542_00b.jpg
			// doesn't work for all:
			// http://t.sexywhitepussy.com/thumbs/2017-06-08/446565_02.jpg
			domain === "t.sexywhitepussy.com") {
			// https://t.auntmia.com/nthumbs/2015-08-24/2827785/2827785_00.jpg
			//   https://t.auntmia.com/nthumbs/2015-08-24/2827785/2827785_00b.jpg
			return src.replace(/(\/[0-9]+_[0-9]+)(\.[^/.]*)(?:[?#].*)?$/, "$1b$2");
		}

		if (domain_nowww === "giveawayoftheday.com") {
			// https://giveawayoftheday.com/wp-content/uploads/2019/07/198126d62f2f74cf818434bce5caee87_250.jpeg
			//   https://giveawayoftheday.com/wp-content/uploads/2019/07/198126d62f2f74cf818434bce5caee87.jpeg
			return src.replace(/(\/wp-content\/+uploads\/+[0-9]{4}\/+[0-9]{2}\/+[0-9a-f]{20,})_[0-9]+(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (domain_nowww === "nato.int") {
			// https://www.nato.int/nato_static_fl2014/assets/pictures/2019_06_190612b-baltops19/20190617_190612b-001_rdax_200x133.jpg
			//   https://www.nato.int/nato_static_fl2014/assets/pictures/2019_06_190612b-baltops19/20190617_190612b-001.jpg
			newsrc = src.replace(/(\/assets\/+pictures\/+[^/]*\/+[^/]*)_rdax_[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
			if (newsrc !== src)
				return newsrc;

			// thanks to MinuteAd8502 on github: https://github.com/qsniyg/maxurl/issues/835
			// https://www.nato.int/sfor/indexinf/98/sfront.jpg
			//   https://www.nato.int/sfor/indexinf/98/bfront.jpg
			// https://www.nato.int/Sfor/indexinf/86/nopolmps/s000426a.jpg
			//   https://www.nato.int/Sfor/indexinf/86/nopolmps/b000426a.jpg
			return src.replace(/(\/sfor\/+indexinf\/+[0-9]+\/+(?:[^/]+\/+)?)s([^/]+?)(?:[?#].*)?$/i, "$1b$2");
		}

		if (domain_nowww === "pbase.com") {
			// https://pbase.com/image/106869910
			// https://pbase.com/image/106869910/original
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+image\/+([0-9]+)(?:\/+.*)(?:[?#].*)?$/,
				query_for_id: "https://pbase.com/image/${id}/original",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/<img\s+(?:oncontextmenu="[^"]+"\s+)?class=["']display\s*(?:[-\sa-z]+)?["']\s+src=["'](.*?)["']/i);
					if (!match) {
						console_error(cache_key, "Unable to find img match for", resp);
						return done(null, false);
					}

					return done(decode_entities(match[1]), 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nosub === "pbase.com" && /^a[0-9]*\./.test(domain)) {
			// https://a4.pbase.com/t1/69/28969/4/106869910.aZi0YI18.jpg
			//   https://pbase.com/image/106869910/original
			//   https://a4.pbase.com/o2/69/28969/1/106869910.fsqUf1Js.IMG_93344www.jpg
			var id = src.replace(/^[a-z]+:\/\/[^/]*\/[a-np-z][0-9]+\/+.*\/+([0-9]+)\.[^/.]+\.(?:[^/.]*\.)?[^/.]*(?:[?#].*)?$/, "$1");
			if (id !== src) {
				return {
					url: "https://pbase.com/image/" + id + "/original",
					is_pagelink: true
				};
			}
		}

		if (amazon_container === "photo-net-production-images" ||
			// https://d6d2h4gfvy8t8.cloudfront.net/18551694-orig.jpg
			domain === "d6d2h4gfvy8t8.cloudfront.net") {
			// https://photo-net-production-images.s3.amazonaws.com/18551694-lg.jpg -- upscaled?
			//   https://photo-net-production-images.s3.amazonaws.com/18551694-orig.jpg -- 600x800
			// https://d6d2h4gfvy8t8.cloudfront.net/18552096-orig.jpg -- 2816x2112
			return src.replace(/(\/[0-9]+)-[a-z]+(\.[^/.]*)(?:[?#].*)?$/, "$1-orig$2");
		}

		if (domain_nowww === "thoimoi.vn" ||
			// http://www.vir.com.vn/stores/news_dataimages/hung/022018/22/09/in_article/croped/fred-gives-shakhtar-edge-over-roma.jpg
			//   http://www.vir.com.vn/stores/news_dataimages/hung/022018/22/09/fred-gives-shakhtar-edge-over-roma.jpg
			domain_nowww === "vir.com.vn" ||
			// https://petrotimes.vn/stores/news_dataimages/vuongthanhtam/032016/07/11/thumbnail/ai-la-nu-nghe-si-quyen-luc-nhat-the-gioi.jpg
			//   https://petrotimes.vn/stores/news_dataimages/vuongthanhtam/032016/07/11/ai-la-nu-nghe-si-quyen-luc-nhat-the-gioi.jpg
			domain_nowww === "petrotimes.vn") {
			// https://thoimoi.vn/stores/news_dataimages/thuhuong/072019/29/22/in_article/5109_1.jpg
			//   https://thoimoi.vn/stores/news_dataimages/thuhuong/072019/29/22/5109_1.jpg
			// https://thoimoi.vn/stores/news_dataimages/thuhuong/042019/26/09/thumbnail/1603_selenagomezwedayapril252019billboard1548_thumb.jpg
			//   https://thoimoi.vn/stores/news_dataimages/thuhuong/042019/26/09/1603_selenagomezwedayapril252019billboard1548_thumb.jpg
			return src.replace(/(\/stores\/+news_dataimages\/+[^/]*\/+[0-9]{6}\/+[0-9]+\/+[0-9]+\/+)[a-z_]+\/+/, "$1");
			//return src
			//    .replace(/\/in_article\//, "/")
			//    .replace(/\/croped\//, "/");
		}

		if (domain_nosub === "energyfm.ru" && domain.match(/^(?:cdn[0-9]*|www)\./)) {
			// http://cdn0.energyfm.ru/proxy/vardata/modules/news/files/1/4136/news_file_4136_5cee57ea1309c.jpg?w=600&h=397&t=1559123946
			//   http://cdn0.energyfm.ru/proxy/vardata/modules/news/files/1/4136/news_file_4136_5cee57ea1309c.jpg?w=-
			//   http://www.energyfm.ru/vardata/modules/news/files/1/4136/news_file_4136_5cee57ea1309c.jpg
			// http://www.energyfm.ru/proxy/vardata/modules/news/files/1/3349/news_file_3349_5b910ccc9a5a4.jpg?w=600&h=338&t=1536232652
			//   http://www.energyfm.ru/vardata/modules/news/files/1/3349/news_file_3349_5b910ccc9a5a4.jpg
			// other:
			// http://cdn2.energyfm.ru/vardata/modules/news/files/1/3349/news_file_3349_5b910ccc9a5a4.jpg
			if (/\/proxy\/+vardata\//.test(src)) {
				return src.replace(/:\/\/[^/]*\/proxy\/+vardata\/+(.*?)(?:[?#].*)?$/, "://www.energyfm.ru/vardata/$1");
			}

			return src.replace(/(\/files\/+[0-9]+\/+[0-9]+\/+[^/]*?)\?.*/, "$1?w=-");
		}

		if (domain_nowww === "chacuncherchesonfilm.fr") {
			// https://www.chacuncherchesonfilm.fr/storage/personnes/5c/5cdd19803044d-_x185.png?token=dcce9646205dd65e76815fabb3053c36
			//   https://www.chacuncherchesonfilm.fr/storage/personnes/5c/5cdd19803044d.png?token=dcce9646205dd65e76815fabb3053c36
			return src.replace(/(\/storage\/+[^/]*\/+[0-9a-f]{2}\/+[0-9a-f]+)-[0-9_]+x[0-9_]+(\.[^/.]*(?:[?#].*)?)$/,
							   "$1$2");
		}

		if (domain === "structurecms-staging-psyclone.netdna-ssl.com") {
			// https://structurecms-staging-psyclone.netdna-ssl.com/client_assets/thehollywoodconservative_us/media/picture/5d1a/58ce/6970/2d06/be28/1700/thumb_Selena_Gomez_2016.png?1562007758
			//   https://structurecms-staging-psyclone.netdna-ssl.com/client_assets/thehollywoodconservative_us/media/picture/5d1a/58ce/6970/2d06/be28/1700/content_Selena_Gomez_2016.png?1562007758
			//   https://structurecms-staging-psyclone.netdna-ssl.com/client_assets/thehollywoodconservative_us/media/picture/5d1a/58ce/6970/2d06/be28/1700/original_Selena_Gomez_2016.png?1562007758
			return src.replace(/(\/media\/+picture\/+(?:[0-9a-f]{4}\/+){6})[a-z]+_/, "$1original_");
		}

		if (domain_nowww === "reforma.com" ||
			// https://www.mural.com/aplicacioneslibre/compartir/ImageTransformer.aspx?wm=1&img=https://img.gruporeforma.com/imagenes/960x640/5/476/4475398.jpg&ang=0
			//  https://img.gruporeforma.com/imagenes/960x640/5/476/4475398.jpg
			domain_nowww === "mural.com" ||
			// https://www.cancha.com/aplicacioneslibre/compartir/ImageTransformer.aspx?img=https://img.gruporeforma.com/imagenes/960x640/5/500/4499049.jpg&wm=1&ang=0&tipo=video
			//   https://img.gruporeforma.com/imagenes/960x640/5/500/4499049.jpg
			domain_nowww === "cancha.com" ||
			// https://www.elnorte.com/aplicacioneslibre/compartir/ImageTransformer.aspx?wm=1&img=https://img.gruporeforma.com/imagenes/960x640/4/685/3684095.jpg&ang=0
			//   https://img.gruporeforma.com/imagenes/960x640/4/685/3684095.jpg
			domain_nowww === "elnorte.com") {
			// https://www.reforma.com/aplicacioneslibre/compartir/ImageTransformer.aspx?wm=1&img=https://img.gruporeforma.com/imagenes/960x640/4/685/3684095.jpg&ang=0
			//   https://img.gruporeforma.com/imagenes/960x640/4/685/3684095.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/aplicacioneslibre\/+compartir\/+ImageTransformer.aspx\?(?:.*?&)?img=(http[^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nowww === "madtv.com.cy") {
			// https://www.madtv.com.cy/assets/modules/wnp/articles/201906/347/images/s_selena.jpg -- 400x260
			//   https://www.madtv.com.cy/assets/modules/wnp/articles/201906/347/images/m_selena.jpg -- 900x500
			//   https://www.madtv.com.cy/assets/modules/wnp/articles/201906/347/images/b_selena.jpg -- 900x600
			return src.replace(/(\/assets\/+modules\/+wnp\/+articles\/+[0-9]{6}\/+[0-9]+\/+images\/+)[ms]_([^/]*)(?:[?#].*)?$/,
							   "$1b_$2");
		}

		if (domain === "d15hng3vemx011.cloudfront.net") {
			// https://d15hng3vemx011.cloudfront.net/attachment/0km4rjtlcgwoguyynaps.medium
			//   https://d15hng3vemx011.cloudfront.net/attachment/0km4rjtlcgwoguyynaps
			// https://d15hng3vemx011.cloudfront.net/attachment/02559523568084830002.medium
			//   https://d15hng3vemx011.cloudfront.net/attachment/02559523568084830002.large
			if (src.match(/\/attachment\/+[^/.]*\.[a-z]+/)) {
				return [
					src.replace(/(\/attachment\/+[^/.]*)\.[a-z]+/, "$1"),
					src.replace(/(\/attachment\/+[^/.]*)\.[a-z]+/, "$1.large"),
				];
			}
		}

		if (domain === "static.flaixfm.cat") {
			// todo: improve?
			// https://static.flaixfm.cat/camila-cabello-havana-2.pw-640.jpg
			//   https://static.flaixfm.cat/camila-cabello-havana-2.pwh-2560-1440.jpg
			// https://static.flaixfm.cat/pw-640/concurs-maxiflaix-ok-2.png
			//   https://static.flaixfm.cat/pwh-2560-1440/concurs-maxiflaix-ok-2.png
			// https://static.flaixfm.cat/cwh-320-320/daddy-yankee-con-calma-web-flaixfm.png
			//   https://static.flaixfm.cat/pwh-2560-1440/daddy-yankee-con-calma-web-flaixfm.png
			// https://static.flaixfm.cat/pw-480/facebook-og-2019.png
			//   https://static.flaixfm.cat/pwh-2560-1440/facebook-og-2019.png
			// https://static.flaixfm.cat/cwh-160-160/1cb53b5707d67cee4097e4f424b502f2-1000x1000x1.jpg
			//   https://static.flaixfm.cat/pwh-2560-1440/1cb53b5707d67cee4097e4f424b502f2-1000x1000x1.jpg
			// doesn't work for all:
			// https://static.flaixfm.cat/top-10-2.pw-640-2.png -- same as:
			//   https://static.flaixfm.cat/top-10-2.pw-640.png
			//   https://static.flaixfm.cat/top-10-2.pwh-2560-1440.png -- doesn't work
			//   https://static.flaixfm.cat/top-10-2.pwh-2560-1440-2.png -- doesn't work
			// other:
			// https://static.flaixfm.cat/file/ezgif-com-video-to-gif.gif -- other urls don't seem to work with /file/
			return src.replace(/([./])(?:pw-(?:640|480)|cwh-(?:320-320|160-160))\1/, "$1pwh-2560-1440$1");
		}

		if (domain_nowww === "music.hu") {
			// http://www.music.hu/pictures/46/resized/23270_zene_w800_h600.jpeg
			//   http://www.music.hu/pictures/46/23270_zene.jpeg
			return src.replace(/(\/pictures\/+[0-9]+\/+)resized\/+([^/]*?)(?:_[wh][0-9]+)+(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2$3");
		}

		if (domain === "dspvdh6gst59b.cloudfront.net") {
			// https://dspvdh6gst59b.cloudfront.net/https%3A%2F%2Fhayabusa.io%2Fmakuake%2Fupload%2Fproject%2F3890%2Fdetail_3890_1519727224.png?w=630
			//   https://hayabusa.io/makuake/upload/project/3890/detail_3890_1519727224.png?q=100&quality=100
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/(http.*?)(?:[?#].*)?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nowww === "factnews.mn") {
			// http://factnews.mn/images/news/crop300/old/blue-dragon-2007-kim-tae-hee-05(1).jpg
			//   http://factnews.mn/images/news/old/blue-dragon-2007-kim-tae-hee-05(1).jpg -- smaller?
			//   http://factnews.mn/images/news/gallery/old/blue-dragon-2007-kim-tae-hee-05.jpg -- full
			return src.replace(/\/images\/+news\/+crop[0-9]+\/+/, "/images/news/");
		}

		if (domain_nowww === "videos-de-celebrites.com") {
			// http://www.videos-de-celebrites.com/galeries/toni_braxton/1/tn/tn_pic13.jpg
			//   http://www.videos-de-celebrites.com/galeries/toni_braxton/1/pic13.jpg
			return src.replace(/\/tn\/+tn_/, "/");
		}

		if (domain_nowww === "friends.kz") {
			// http://friends.kz/uploads/posts/thumbs/1150603550_the_van_01.jpg
			//   http://friends.kz/uploads/posts/1150603550_the_van_01.jpg
			return src.replace(/\/uploads\/+posts\/+thumbs\/+/, "/uploads/posts/");
		}

		if (domain_nowww === "sama-sama-sama.ru") {
			// http://www.sama-sama-sama.ru/starimp/000zw011/ps14.jpg
			//   http://www.sama-sama-sama.ru/starimp/000zw011/s14.jpg
			return src.replace(/(\/starimp\/+[^/]*\/+)p(s[0-9]+\.[^/.]*)/, "$1$2");
		}

		if (domain === "img.index.hu") {
			// https://img.index.hu/imgfrm/8/2/4/5/THM_0000938245.jpg
			//   https://img.index.hu/imgfrm/8/2/4/5/BIG_0000938245.jpg
			//   https://img.index.hu/imgfrm/8/2/4/5/IMG_0000938245.jpg
			// https://img.index.hu/imgfrm/5/0/7/4/BIG_0003105074.jpg
			//   https://img.index.hu/imgfrm/5/0/7/4/IMG_0003105074.jpg
			return src.replace(/(\/imgfrm\/+(?:.\/+){4})(?:THM|BIG|MED)_/, "$1IMG_");
		}

		if (domain_nowww === "eventpixx.org") {
			// http://www.eventpixx.org/image/4b6a1a9073caa_x137.jpg
			//   http://www.eventpixx.org/image/4b6a1a9073caa.jpg
			return src.replace(/(\/image\/+[0-9a-f]+)_[0-9]*x[0-9]*(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "images.hgmsites.net") {
			// https://images.hgmsites.net/sml/2018-toyota-camry_100650533_s.jpg
			//   https://images.hgmsites.net/hug/2018-toyota-camry_100650533_h.jpg -- 2999x1999
			// https://images.hgmsites.net/hug/tesla-ceo-elon-musk-introducing-model-y_100695335_h.jpg -- 3929x2211
			// doesn't work for all:
			// https://images.hgmsites.net/sml/jessica-alba_100319943_s.jpg
			return src.replace(/\/sml\/+([^/]*)_s(\.[^/.]*)(?:[?#].*)?$/, "/hug/$1_h$2");
		}

		if (domain === "cdn.lifebuzz.com") {
			// http://cdn.lifebuzz.com/images/254543/lifebuzz-f20592f8cd481b25fcfae047325d4a25-limit_2000.jpg
			//   http://cdn.lifebuzz.com/images/254543/lifebuzz-f20592f8cd481b25fcfae047325d4a25-original.jpg
			// http://cdn.lifebuzz.com/images/261979/lifebuzz-91133d1625e916bb93455e06d50ef296-thumb_800.jpg
			//   http://cdn.lifebuzz.com/images/261979/lifebuzz-91133d1625e916bb93455e06d50ef296-original.jpg
			// doesn't work for all:
			// http://cdn.lifebuzz.com/images/59108/lifebuzz-e01e7be7d8bb4365404836c302a6d694-thumb_800.jpg
			//   http://cdn.lifebuzz.com/images/59108/lifebuzz-e01e7be7d8bb4365404836c302a6d694-wide_1000.jpg
			//   http://cdn.lifebuzz.com/images/59108/lifebuzz-e01e7be7d8bb4365404836c302a6d694-original.jpg
			return src.replace(/(\/images\/+[0-9]+\/+lifebuzz-[0-9a-f]{20,})-[a-z]+_[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1-original$2");
		}

		if (domain === "jurnalul.antena3.ro") {
			// https://jurnalul.antena3.ro/thumbs/article/2017/07/21/nutritionista-jessicai-alba-vorbeste-despre-dieta-acesteia-18582670.jpg
			//   https://jurnalul.antena3.ro/pictures/2017/07/21/18582670.jpg
			return src.replace(/\/thumbs\/+[^/]*\/+([0-9]{4}\/+(?:[0-9]{2}\/+){2})[^/]*-([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/pictures/$1$2");
		}

		if (domain_nowww === "anime1.com") {
			// http://www.anime1.com/main/img/content/boku-wa-tomodachi-ga-sukunai-next/boku-wa-tomodachi-ga-sukunai-next-105.jpg
			//   http://www.anime1.com/main/img/content/boku-wa-tomodachi-ga-sukunai-next/boku-wa-tomodachi-ga-sukunai-next.jpg
			return src.replace(/(\/img\/+content\/+[^/]*\/+[^/]*)-[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "animetoon.org") {
			// http://www.animetoon.org/images/series/small/2315.jpg
			//   http://www.animetoon.org/images/series/big/2315.jpg
			return src.replace(/(\/images\/+[^/]*\/+)small\/+([0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1big/$2");
		}

		if (domain_nowww === "anime-tourism.jp") {
			// https://anime-tourism.jp/title_th/bokuhaganai.jpg
			//   https://anime-tourism.jp/title_image/bokuhaganai.jpg
			return src.replace(/\/title_th\/+/, "/title_image/");
		}

		if ((domain_nosub === "filmweb.pl" && /^(?:ssl-)?gfx\./.test(domain)) ||
			// https://fwcdn.pl/ppo/00/87/87/450015.2.jpg
			//   https://fwcdn.pl/ppo/00/87/87/450015.$.jpg -- 3333x5000
			// thanks to anonymous for reporting:
			// https://fwcdn.pl/fpo/20/02/432002/7555769_1.10.webp
			//   https://fwcdn.pl/fpo/20/02/432002/7555769_1.$.jpg
			domain_nosub === "fwcdn.pl") {
			// https://ssl-gfx.filmweb.pl/po/62/64/676264/7510826.1.jpg
			//   https://ssl-gfx.filmweb.pl/po/62/64/676264/7510826.$.jpg -- 319x450
			// http://gfx.filmweb.pl/an/1032473/5454.$.jpg -- 2400x3000
			// https://ssl-gfx.filmweb.pl/an/np/867323/2019/18811_1.8.jpg
			//   https://ssl-gfx.filmweb.pl/an/np/867323/2019/18811_1.$.jpg
			// others:
			// http://gfx.filmweb.pl/n/news.attachment.36554.jpg
			// $ doesn't work: (1 seems to be the largest?)
			// https://ssl-gfx.filmweb.pl/ph/57/70/625770/727190_1.3.jpg
			// https://ssl-gfx.filmweb.pl/ph/72/46/807246/798315_1.2.jpg
			// https://ssl-gfx.filmweb.pl/ph/71/41/717141/748509_1.3.jpg
			// http://1.fwcdn.pl/ph/57/70/625770/727190_1.2.jpg
			return src
				.replace(/(\.\$\.)webp$/, "$1jpg")
				.replace(/(\/[0-9]+(?:_[0-9]+)?\.)[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1$$$2");

			// old fwcdn rule:
			// http://1.fwcdn.pl/ph/73/52/737352/569269_1.2.jpg
			// http://1.fwcdn.pl/ph/73/52/737352/569269_1.jpg
			//   http://1.fwcdn.pl/ph/73/52/737352/569269_1.1.jpg
			// shrinks some:
			// http://1.fwcdn.pl/an/np/875720/2018/15046_1.9.jpg -- 320x180
			//   http://1.fwcdn.pl/an/np/875720/2018/15046_1.1.jpg -- 90x90
			//return src.replace(/(\/[^/.]*)(?:\.[0-9]*)?(\.[^/.]*)$/, "$1.1$2");
		}

		if (domain_nowww === "fantlab.ru") {
			// https://fantlab.ru/blogfiles/b28337/img/5_sm
			//   https://fantlab.ru/blogfiles/b28337/img/5
			return src.replace(/(\/blogfiles\/+b[0-9]+\/+img\/+[0-9]+)_sm(?:[?#].*)?$/, "$1");
		}

		if (domain_nowww === "animeyt.org") {
			// https://animeyt.org/uploads/animePicture/optimized/thumb/boku-wa-tomodachi-ga-sukunai-next.jpg
			//   https://animeyt.org/uploads/animePicture/boku-wa-tomodachi-ga-sukunai-next.jpg
			// https://animeyt.org/uploads/animePicture/optimized/boku-wa-tomodachi-ga-sukunai-next.jpg
			//   https://animeyt.org/uploads/animePicture/boku-wa-tomodachi-ga-sukunai-next.jpg
			return src.replace(/(\/uploads\/+[^/]*\/+)optimized\/+(?:thumb\/+)?/, "$1");
		}

		if (domain_nowww === "otakotaku.com") {
			// https://otakotaku.com/asset/img/anime/thumb/157x213/2015/10/boku-wa-tomodachi-ga-sukunai-next.jpg
			//   https://otakotaku.com/asset/img/anime/2015/10/boku-wa-tomodachi-ga-sukunai-next.jpg
			return src.replace(/(\/asset\/+img\/+[^/]*\/+)thumb\/+[0-9]+x[0-9]+\/+/, "$1");
		}

		if (domain === "img.topddl.net") {
			// https://img.topddl.net/images/d3a1ea8fe9ffb9b42ed4899e02e401ea.th.jpg
			//   https://img.topddl.net/images/d3a1ea8fe9ffb9b42ed4899e02e401ea.jpg
			return src.replace(/(\/images\/+[0-9a-f]{10,})\.th(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "monoschinos.com") {
			// are there non /serie/ urls that use /image/imagen/?
			// https://monoschinos.com/image/imagen/160/224/boku-wa-tomodachi-ga-sukunai-next.jpg
			//   https://monoschinos.com/assets/img/serie/imagen/boku-wa-tomodachi-ga-sukunai-next.jpg
			return src.replace(/\/image\/+imagen\/+[0-9]+\/+[0-9]+\/+/, "/assets/img/serie/imagen/");
		}

		if (domain === "a.atcdn.org") {
			// https://a.atcdn.org/c/mid_MxYnwEQK0q9rMo38qp7V.jpg -- 151x238
			//   https://a.atcdn.org/c/max_MxYnwEQK0q9rMo38qp7V.jpg -- 200x315
			//   https://a.atcdn.org/c/MxYnwEQK0q9rMo38qp7V.jpg -- 317x500
			return src.replace(/\/c\/+[a-z]+_([^/.]*\.[^/.]*)(?:[?#].*)?$/, "/c/$1");
		}

		if (domain === "m.atcdn.co.uk") {
			// https://m.atcdn.co.uk/a/media/w816h612pf7f7f5/0ebc06e72cbf4f9c99c3707fa5526820.jpg
			//   https://m.atcdn.co.uk/a/media/w800h600/0ebc06e72cbf4f9c99c3707fa5526820.jpg
			//   https://m.atcdn.co.uk/a/media/0ebc06e72cbf4f9c99c3707fa5526820.jpg
			return src.replace(/\/a\/media\/+(?:[wh][0-9]+|p[0-9a-f]{6}){1,}\/+/, "/a/media/");
		}

		if (domain_nowww === "you-anime.ru") {
			// https://you-anime.ru/anime-images/posters/preview/6231.jpg
			//   https://you-anime.ru/anime-images/posters/6231.jpg
			return src.replace(/\/anime-images\/+posters\/+preview\/+/, "/anime-images/posters/");
		}

		if (domain_nowww === "tapcuoi.com") {
			// http://tapcuoi.com/wp-content/anime/cover/tbn/0_2479_200x0.jpg
			//   http://tapcuoi.com/wp-content/anime/cover/0_2479.jpg
			return src.replace(/(\/wp-content\/+anime\/+cover\/+)tbn\/+([0-9]+_[0-9]+)_[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2$3");
		}

		if (domain_nowww === "komyulife.com") {
			// https://komyulife.com/media/anime/poster/315x210/7210.jpg
			//   https://komyulife.com/media/anime/poster/7210.jpg
			return src.replace(/(\/media\/+[^/]*\/+[^/]*\/+)[0-9]+x[0-9]+\/+/, "$1");
		}

		if (domain_nowww === "animeon.pl") {
			// https://animeon.pl/img/series/795/thumbs/1529577220.jpg
			//   https://animeon.pl/img/series/795/1529577220.jpg
			return src.replace(/(\/img\/+[^/]*\/+[0-9]+\/+)thumbs\/+/, "$1");
		}

		if (domain_nowww === "4icdn.com") {
			// https://4icdn.com/?src=img/animes/03Tf-large.jpg
			//   https://4icdn.com/img/animes/03Tf-large.jpg
			newsrc = src.replace(/^([a-z]+:\/\/[^/]*\/)\?(?:.*&)?src=([^&]*).*?$/, "$2");
			if (newsrc !== src)
				return urljoin(src, decodeuri_ifneeded(newsrc), true);
		}

		if (domain === "cdn.handjobjapan.com" ||
			// thanks to anonymous for reporting:
			domain === "img.spermmania.com" ||
			// thanks to anonymous for reporting:
			domain === "img.fellatiojapan.com" ||
			// thanks to anonymous for reporting:
			domain === "img.cospuri.com" ||
			// thanks to anonymous for reporting:
			domain === "img.tokyofacefuck.com") {
			// https://cdn.handjobjapan.com/preview/219wedt7/1s.jpg
			//   https://cdn.handjobjapan.com/preview/219wedt7/1.jpg
			newsrc = src.replace(/(\/preview\/+[^/]+\/+[0-9]+)s(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
			if (newsrc !== src) return newsrc;
		}

		if (domain === "cdn.legsjapan.com" ||
			// https://cdn.tokyofacefuck.com/fhg/data/2097_YumesakiKanon_81D7/TokyoFaceFuck-YumesakiKanon-2097-01s.jpg
			//   https://cdn.tokyofacefuck.com/fhg/data/2097_YumesakiKanon_81D7/TokyoFaceFuck-YumesakiKanon-2097-01.jpg
			domain === "cdn.tokyofacefuck.com" ||
			// https://cdn.spermmania.com/preview/258_Mizuki_B34V/SpermMania-Mizuki-258-01s.jpg
			//   https://cdn.spermmania.com/preview/258_Mizuki_B34V/SpermMania-Mizuki-258-01.jpg
			domain === "cdn.spermmania.com" ||
			// https://cdn.handjobjapan.com/fhg/data/1109_OnoMaria_3DB6/HandjobJapan-OnoMaria-1109-01s.jpg
			//   https://cdn.handjobjapan.com/fhg/data/1109_OnoMaria_3DB6/HandjobJapan-OnoMaria-1109-01.jpg
			domain === "cdn.handjobjapan.com" ||
			// https://cdn.fellatiojapan.com/preview/1045_OnoMaria_ED32/FellatioJapan-OnoMaria-085-01s.jpg
			//   https://cdn.fellatiojapan.com/preview/1045_OnoMaria_ED32/FellatioJapan-OnoMaria-085-01.jpg
			domain === "cdn.fellatiojapan.com" ||
			// https://cdn.uralesbian.com/fhg/308_Marie_AoiShino_12CA/UraLesbian-Marie-AoiShino-308-01s.jpg
			//   https://cdn.uralesbian.com/fhg/308_Marie_AoiShino_12CA/UraLesbian-Marie-AoiShino-308-01.jpg
			domain === "cdn.uralesbian.com") {
			// https://cdn.legsjapan.com/photo/data/126_KisakiAya_20B7/LegsJapan-AyaKisaki-126-01s.jpg
			//   https://cdn.legsjapan.com/photo/data/126_KisakiAya_20B7/LegsJapan-AyaKisaki-126-01.jpg
			return src.replace(/(\/(?:photo|fhg|preview)(?:\/+data)?\/+[^/]*\/+[^/]*-[0-9]+)s(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "lbfmaddiction.com" ||
			domain_nowww === "barfine2cash.com") {
			// http://www.lbfmaddiction.com/fhg/lbfm/tgpdp52/tida_redlingerie01_small.jpg
			//   http://www.lbfmaddiction.com/fhg/lbfm/tgpdp52/tida_redlingerie01.jpg
			return src.replace(/(\/fhg\/+[^/]*\/+[^/]*\/+[^/]*)_small(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "thaicuties.net") {
			// http://www.thaicuties.net/nats/090205_jupjang_bunrugsa_3/images/tn_thai_cuties_jupjang_bunrugsa_set3_02_jpg.jpg
			//   http://www.thaicuties.net/nats/090205_jupjang_bunrugsa_3/images/thai_cuties_jupjang_bunrugsa_set3_02.jpg
			return {
				url: src.replace(/\/images\/+tn_([^/]*)_([a-zA-Z]+)\.[^/.]*(?:[?#].*)?$/, "/images/$1.$2"),
				head_wrong_contenttype: true
			};
		}

		if (domain === "fhg.propertysex.com") {
			// http://fhg.propertysex.com/morgan-lee/t01.jpg
			//   http://fhg.propertysex.com/morgan-lee/01.jpg
			return src.replace(/(:\/\/[^/]*\/+[^/]*\/+)t([0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "cutegirlporn.com") {
			// thanks to vscum on github: https://github.com/qsniyg/maxurl/issues/1166
			// http://www.cutegirlporn.com/upload/gallery/19000/19932/t01.jpg
			//   http://www.cutegirlporn.com/upload/gallery/19000/19932/01.jpg
			return src.replace(/(\/upload\/+gallery\/+.*\/)t([0-9]+\.)/, "$1$2");
		}

		if (domain_nowww === "manga-news.com") {
			// https://www.manga-news.com/public/images/events/.anohana-grand-rex-mai-2016_s.jpg
			//   https://www.manga-news.com/public/images/events/.anohana-grand-rex-mai-2016_m.jpg
			//   https://www.manga-news.com/public/images/events/anohana-grand-rex-mai-2016.jpg
			// thanks to Froktime on github: https://github.com/qsniyg/maxurl/issues/1286
			// https://www.manga-news.com/public/images/vols/.Le_Palais_des_assassins_T01_-_Ki-oon_small.jpg
			//   https://www.manga-news.com/public/images/vols/.Le_Palais_des_assassins_T01_-_Ki-oon_large.jpg
			//   https://www.manga-news.com/public/images/vols/Le_Palais_des_assassins_T01_-_Ki-oon.jpg
			// https://www.manga-news.com/public/images/news/City_Hunter_Tenshi_no_Namida_movie_news.webp
			//   https://www.manga-news.com/public/images/news/City_Hunter_Tenshi_no_Namida_movie_news.jpg
			newsrc = src.replace(/(\/public\/+images\/+[^/]+\/+[^./?#][^/]+)\.webp(?:[?#].*)?/, "$1.jpg");
			if (newsrc !== src)
				return newsrc;

			return src.replace(/(\/public\/+images\/+(?:events|vols)\/+)\.([^/]*?)_(?:small|large|[sm])(\.[^/.]*)(?:[?#].*)?$/, "$1$2$3");
		}

		if (domain_nowww === "filmsomniac.com") {
			// https://www.filmsomniac.com/images/covers/films-new/100/9/42309.jpg
			//   https://www.filmsomniac.com/images/covers/films-new/9/42309.jpg
			return src.replace(/(\/images\/+covers\/+films-new\/+)[0-9]+\/+([0-9]+\/+[0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "film-download.club") {
			// https://film-download.club/uploads/https-dk--sl--sl-image-kr-tmdb-kr-org-sl-t-sl-p-sl-w185_and_h278_bestv2-sl-m8sCa24YbFIatKlElTMdiH18A5N-kr-jpg.jpg
			//   https://image.tmdb.org/t/p/original/m8sCa24YbFIatKlElTMdiH18A5N.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+uploads\/+(https?-dk-.*?)\.[^/]*(?:[?#].*)?$/, "$1");
			if (newsrc !== src) {
				// TODO: handle other characters too?
				return newsrc
					.replace(/-dk-/g, ":")
					.replace(/-sl-/g, "/")
					.replace(/-kr-/g, ".");
			}
		}

		if (domain_nowww === "thaishop.in.th") {
			// http://www.thaishop.in.th/thumb.php?id=73275889
			//   http://www.thaishop.in.th/image.php?id=73275889
			return src.replace(/(:\/\/[^/]*\/+)thumb\.php\?(?:.*?&)?(id=[0-9]+).*?$/, "$1image.php?$2");
		}

		if (domain_nowww === "animes-portal.info") {
			// https://animes-portal.info/thumbs/1/shingeki-no-kyojin-1556736539.jpg
			//   https://animes-portal.info/resources/shingeki-no-kyojin-1556736539.jpg
			return src.replace(/\/thumbs\/+[0-9]+\/+/, "/resources/");
		}

		if (domain === "cdn.staticaly.com") {
			// https://cdn.staticaly.com/img/1.bp.blogspot.com/-fjaUW8C9yNg/XGBAGbWGTjI/AAAAAAAACPs/6PYlPPtSFVQi4geYCUp7ISSu7GI77-pJQCLcBGAs/s320/%255BLotvers%255D%255BCover%255D%2BShingeki%2Bno%2BKyojin%2B%2528Attack%2Bon%2BTitan%2529.jpg
			//   http://1.bp.blogspot.com/-fjaUW8C9yNg/XGBAGbWGTjI/AAAAAAAACPs/6PYlPPtSFVQi4geYCUp7ISSu7GI77-pJQCLcBGAs/s0/%255BLotvers%255D%255BCover%255D%2BShingeki%2Bno%2BKyojin%2B%2528Attack%2Bon%2BTitan%2529.jpg=s0?imgmax=0
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+img\/+([^/]*\.[^/]*\/+)/, "$1");
			if (newsrc !== src)
				return add_http(newsrc);
		}

		if (domain === "assets.fireside.fm") {
			// https://assets.fireside.fm/file/fireside-images/podcasts/images/0/00e8a29c-7246-483a-b97b-a1a0bb8eb4a7/hosts/e/e76392c4-be56-4b86-babb-1efb6dd6071b/avatar_small.jpg
			//   https://assets.fireside.fm/file/fireside-images/podcasts/images/0/00e8a29c-7246-483a-b97b-a1a0bb8eb4a7/hosts/e/e76392c4-be56-4b86-babb-1efb6dd6071b/avatar.jpg
			// https://assets.fireside.fm/file/fireside-images/podcasts/images/0/00e8a29c-7246-483a-b97b-a1a0bb8eb4a7/header_small.jpg
			//   https://assets.fireside.fm/file/fireside-images/podcasts/images/0/00e8a29c-7246-483a-b97b-a1a0bb8eb4a7/header.jpg
			// https://assets.fireside.fm/file/fireside-images/podcasts/images/0/00e8a29c-7246-483a-b97b-a1a0bb8eb4a7/episodes/f/f3279128-e986-4542-a210-26aac05cbfb0/cover_medium.jpg
			//   https://assets.fireside.fm/file/fireside-images/podcasts/images/0/00e8a29c-7246-483a-b97b-a1a0bb8eb4a7/episodes/f/f3279128-e986-4542-a210-26aac05cbfb0/cover_thumb.jpg
			//   https://assets.fireside.fm/file/fireside-images/podcasts/images/0/00e8a29c-7246-483a-b97b-a1a0bb8eb4a7/episodes/f/f3279128-e986-4542-a210-26aac05cbfb0/cover.jpg
			return src.replace(/(\/images\/+[0-9a-f]\/+[-0-9a-f]{20,}\/+(?:[^/]*\/+[0-9a-f]\/+[-0-9a-f]{20,}\/+)?[^/]*)_(?:thumb|small|medium)(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "disk.mediaindonesia.com") {
			// https://disk.mediaindonesia.com/thumbs/120x80/news/2019/07/13412e0671ddcaea1697922c577673de.jpg
			//   https://disk.mediaindonesia.com/files/news/2019/07/13412e0671ddcaea1697922c577673de.jpg
			// https://disk.mediaindonesia.com/thumbs/1200x-/news/2019/05/52f92b4a31615f04dff83b825587bc0c.jpeg
			//   https://disk.mediaindonesia.com/files/news/2019/05/52f92b4a31615f04dff83b825587bc0c.jpeg
			return src.replace(/\/thumbs\/+[-0-9]+x[-0-9]+\/+/, "/files/");
		}

		if (domain === "images.lindependant.fr") {
			// https://images.lindependant.fr/api/v1/images/view/5d10ecfd8fe56f4cd526d17a/standard/image.jpg?v=1
			//   https://images.lindependant.fr/api/v1/images/view/5d10ecfd8fe56f4cd526d17a/image.jpg?v=1 -- replacing standard with orig/org works too
			return src.replace(/(\/api\/+v[0-9]+\/+images\/+view\/+[0-9a-f]{15,}\/+)[^/]*\/+/, "$1");
		}

		if (domain_nowww === "kurir.rs") {
			// https://www.kurir.rs/data/images/2019/07/12/17/1913857_profimedia0450884098_ls-s.jpg
			//   https://www.kurir.rs/data/images/2019/07/12/17/1913857_profimedia0450884098_ls.jpg
			//   https://www.kurir.rs/data/images/2019/07/12/17/1913857_profimedia0450884098.jpg
			// https://www.kurir.rs/data/images/2019/07/12/17/1913857_profimedia0450884098_ff.jpg
			//   https://www.kurir.rs/data/images/2019/07/12/17/1913857_profimedia0450884098.jpg
			// https://www.kurir.rs/data/images/2019/08/07/21/1940939_untitled1_ls-xs.jpg
			//   https://www.kurir.rs/data/images/2019/08/07/21/1940939_untitled1.jpg
			return src.replace(/(\/data\/+images\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9]+\/+[^/]*)_[a-z]{2}(?:-[a-z]+)?(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "reunion.orange.fr") {
			// https://reunion.orange.fr/images/225x250/actu/arton4168970.jpg?1530702940
			//   https://reunion.orange.fr/IMG/arton4168970.jpg?1530702940
			return src.replace(/\/images\/+[0-9]+x[0-9]+\/+actu\/+/, "/IMG/");
		}

		if (domain === "cdn.sahafahn.net" ||
			// https://cdn.pressbee.net/img/0-160/czo5MDoiaHR0cHM6Ly9zdGF0aWMuaW5kZXBlbmRlbnQuY28udWsvczNmcy1wdWJsaWMvdGh1bWJuYWlscy9pbWFnZS8yMDE4LzA5LzE1LzEyL2xpbHktYWxsZW4uanBnIjs=.jpg
			//   https://static.independent.co.uk/s3fs-public/thumbnails/image/2018/09/15/12/lily-allen.jpg
			domain === "cdn.pressbee.net" ||
			// https://cdn.24press.net/img-0-280/czo2NToiaHR0cHM6Ly93d3cuZWxiYWxhZC5uZXdzL3VwbG9hZC9waG90by9uZXdzLzM5MS82LzI3MHgxNDBvLzYxMS5qcGciOw==.jpeg
			//   https://www.elbalad.news/upload/photo/news/391/6/611.jpg
			domain === "cdn.24press.net") {
			// https://cdn.sahafahn.net/img-200-0/czo2NToiaHR0cHM6Ly93d3cuZWxiYWxhZC5uZXdzL3VwbG9hZC9waG90by9uZXdzLzM5MS82LzI3MHgxNDBvLzYxMS5qcGciOw==.jpg
			//   atob: s:65:"https://www.elbalad.news/upload/photo/news/391/6/270x140o/611.jpg";
			//   https://www.elbalad.news/upload/photo/news/391/6/270x140o/611.jpg
			match = src.match(/^[a-z]+:\/\/[^/]*\/img(?:-|\/+)[0-9]+-[0-9]+\/([^/]{10,})\.[^/.]*(?:[?#].*)?$/);
			if (match) {
				var str = base64_decode(match[1]);
				newsrc = str.replace(/.*?\"(https?:[^"]*).*?$/, "$1");
				if (newsrc !== str) {
					return newsrc;
				}
			}
		}

		if (domain_nosub === "keponews.com" && domain.match(/^scdn/)) {
			// https://scdn-ak.keponews.com/scontent/MjEwL2h0dHBzOi8vaW1nLXoub2tlaW5mby5uZXQvbGlicmFyeS9pbWFnZXMvMjAxOC8wOS8yNi9xdHhuYWZiZXdneDh6cDg1d2c5MF8xMjcwNi5qcGc=
			//   atob: 210/https://img-z.okeinfo.net/library/images/2018/09/26/qtxnafbewgx8zp85wg90_12706.jpg
			//   https://img-z.okeinfo.net/library/images/2018/09/26/qtxnafbewgx8zp85wg90_12706.jpg
			match = src.match(/^[a-z]+:\/\/[^/]*\/scontent\/+([^/.]{15,})(?:[?#].*)?$/);
			if (match) {
				var str = base64_decode(match[1]);
				newsrc = str.replace(/^[0-9]+\/+(https?:.*)$/, "$1");
				if (newsrc !== str) {
					return newsrc;
				}
			}
		}

		if (domain === "media.kleinezeitung.at" ||
			// https://media.diepresse.com/images/uploads_320/d/5/0/5639504/Pop-superstar-Rihanna-poses-in-a-pop-up-store-to-present-her-first-collection-with-LVMH-for-the-new-label-Fenty-in-Paris_1559723756797921.jpg
			//   https://media.diepresse.com/images/uploads/d/5/0/5639504/Pop-superstar-Rihanna-poses-in-a-pop-up-store-to-present-her-first-collection-with-LVMH-for-the-new-label-Fenty-in-Paris_1559723756797921.jpg
			// https://media.diepresse.com/images/uploads_h425/d/5/0/5639504/Pop-superstar-Rihanna-poses-in-a-pop-up-store-to-present-her-first-collection-with-LVMH-for-the-new-label-Fenty-in-Paris_1559723756797921.jpg
			//   https://media.diepresse.com/images/uploads/d/5/0/5639504/Pop-superstar-Rihanna-poses-in-a-pop-up-store-to-present-her-first-collection-with-LVMH-for-the-new-label-Fenty-in-Paris_1559723756797921.jpg
			domain === "media.diepresse.com") {
			// https://media.kleinezeitung.at/images/uploads_300/c/8/7/5516423/FILES-ENTERTAINMENT-US-MUSIC-POLITICS-RIHANA_1539969550411986_v0_h.jpg
			//   https://media.kleinezeitung.at/images/uploads/c/8/7/5516423/FILES-ENTERTAINMENT-US-MUSIC-POLITICS-RIHANA_1539969550411986_v0_h.jpg
			return src.replace(/\/images\/+uploads_[a-z]?[0-9]+\/+/, "/images/uploads/");
		}

		if (domain === "republic-imagekit.azureedge.net") {
			// https://republic-imagekit.azureedge.net/republic-prod/stories/promolarge/xxhdpi/tr:w-425,h-231/15598961225cfa203a35d25.jpeg
			//   https://republic-imagekit.azureedge.net/republic-prod/stories/promolarge/15598961225cfa203a35d25.jpeg
			return src.replace(/(\/republic-prod\/+stories\/+[^/]*\/+)[^/]*\/+tr:[^/]*\/+/, "$1");
		}

		if (domain_nowww === "newsstandhub.com") {
			// https://www.newsstandhub.com/files/le-monde-fr/images/rihanna-nommee-officiellement-ambassadrice-de-la-barbade/hdpi/42dc633f270b5d8ccabb54ea97aee88f.jpg
			//   https://www.newsstandhub.com/files/le-monde-fr/images/rihanna-nommee-officiellement-ambassadrice-de-la-barbade/42dc633f270b5d8ccabb54ea97aee88f.jpg
			return src.replace(/(\/files\/+[^/]*\/+images\/+[^/]*\/+)hdpi\/+/, "$1");
		}

		if (domain_nowww === "urbanhit.fr" ||
			// https://xplicitkontemp.com/upload/agenda/mini/5d3e228195e0e6.64034161.jpeg
			//   https://xplicitkontemp.com/upload/agenda/main/5d3e228195e0e6.64034161.jpeg
			//   https://xplicitkontemp.com/upload/agenda/original/5d3e228195e0e6.64034161.jpeg
			domain_nowww === "xplicitkontemp.com") {
			// https://www.urbanhit.fr/upload/news/normal/5c824b46520559.28198115.jpg
			//   https://www.urbanhit.fr/upload/news/original/5c824b46520559.28198115.jpg
			return src.replace(/(\/upload\/+[^/]*\/+)(?:normal|mini|main)\/+/, "$1original/");
		}

		if (domain_nowww === "choualbox.com") {
			// https://choualbox.com/mini.php?src=/Img/1418633811365.jpg&h=128&zc=1&q=100
			//   https://choualbox.com/Img/1418633811365.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+mini\.php\?(?:.*?&)?src=([^&]*).*?$/, "$1");
			if (newsrc !== src) {
				return urljoin(src, decodeURIComponent(newsrc), true);
			}
		}

		if (domain === "im.milliyet.com.tr") {
			// http://im.milliyet.com.tr/300/404/fotocdncube.gazetevatan.com-.-vatangalerifile-.-Detail-.-2014-.-09-.-27-.-cara-delevingne-850331.jpg.jpg
			//   http://fotocdncube.gazetevatan.com/vatangalerifile/Detail/2014/09/27/cara-delevingne-850331.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+[0-9]+\/+[0-9]+\/+([^/]*)\.[^/.]*(?:[?#].*)?$/, "$1");
			if (newsrc !== src) {
				return add_http(newsrc.replace(/-\.-/g, "/"));
			}
		}

		if (domain_nosub === "indiatvnews.com" && /^resize[0-9]*\./.test(domain)) {
			// https://resize6.indiatvnews.com/en/resize/oldbucket/210_-/entertainmenthollywood/IndiaTvbaca76_jennifer-lawrence.jpg
			//   https://resize6.indiatvnews.com/en/oldbucket/entertainmenthollywood/IndiaTvbaca76_jennifer-lawrence.jpg
			// thanks to anonymous for reporting:
			// https://resize.indiatvnews.com/en/resize/newbucket/290_-/2024/07/akb-march-1-1721464733.jpg
			//   https://resize.indiatvnews.com/en/newbucket/2024/07/akb-march-1-1721464733.jpg
			// https://resize.indiatvnews.com/en/resize/gallery/200_-/2020/07/107443887-709624106491608-2248982593069084529-n-1594363555.jpg
			//   https://resize.indiatvnews.com/en/newbucket/2020/07/107443887-709624106491608-2248982593069084529-n-1594363555.jpg
			return src
				.replace(/\/resize\/+((?:new|old)bucket)\/+[-0-9]+_[0-9]*-?\/+/, "/$1/")
				.replace(/\/resize\/+gallery\//, "/resize/newbucket/");
		}

		if (domain === "girabsas.demo.vincolo.com") {
			// http://girabsas.demo.vincolo.com/tools/image.php?id=9799&p=/files/image/9/9799/54d50e7633bee.jpg&w=314&h=176&s=f3f57a00bc8140c28911bd4470d1d16c&d=1423253713
			//   http://girabsas.demo.vincolo.com/files/image/9/9799/54d50e7633bee.jpg
			// http://girabsas.demo.vincolo.com/files/image/9/9799/54d50e7633bee_314_176!.jpg?s=f3f57a00bc8140c28911bd4470d1d16c&d=1423253713
			//   http://girabsas.demo.vincolo.com/files/image/9/9799/54d50e7633bee.jpg
			newsrc = src.replace(/.*\/tools\/+image\.php\?(?:.*?&)?p=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return urljoin(src, decodeURIComponent(newsrc), true);

				return src.replace(/(\/files\/+image\/+[0-9a-f]\/+[0-9a-f]+\/+[^/.]*)_[0-9]+_[0-9]+!(\.[^/.?#]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "seffafgazete.com") {
			// http://www.seffafgazete.com/site/1/uploads/sized/2016/10/3dd301661f72e32aa669acd926d825d3-500x9000.jpg
			//   http://www.seffafgazete.com/site/1/uploads/o/2016/10/3dd301661f72e32aa669acd926d825d3.jpg
			return src.replace(/\/uploads\/+sized\/+([0-9]{4}\/+[0-9]{2}\/+[0-9a-f]+)-[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "/uploads/o/$1$2");
		}

		if (domain === "cdn.posh24.se") {
			// http://cdn.posh24.se/images/:list/200e4a688fb9b60ae6682e00583669c26 -- 100x60
			//   http://cdn.posh24.se/images/:complete/200e4a688fb9b60ae6682e00583669c26 -- 548x545
			//   http://cdn.posh24.se/images/:original/200e4a688fb9b60ae6682e00583669c26 -- 590x587, can be anything, not just original
			// http://cdn.posh24.se/images/:complete/p/3234681/l/jennifer_lawrence/jennifer_lawrence_naken_med_en_orm.jpg
			//   http://cdn.posh24.se/images/:original/p/3234681/l/jennifer_lawrence/jennifer_lawrence_naken_med_en_orm.jpg
			//   http://cdn.posh24.se/images/:enlarge/p/3234681/l/jennifer_lawrence/jennifer_lawrence_naken_med_en_orm.jpg/jennifer_lawrence_naked_vanity_fair -- same size as above
			return src.replace(/\/images\/+:[a-z]+\/+/, "/images/:original/");
		}

		if (domain_nowww === "kinoafisha.ua") {
			// https://kinoafisha.ua/upload/2015/02/news/46697/fotos/medium/1423413108djennifer-lourens-v-pikantnoi-fotosessii.jpg
			//   https://kinoafisha.ua/upload/2015/02/news/46697/fotos/1423413108djennifer-lourens-v-pikantnoi-fotosessii.jpg
			//   https://kinoafisha.ua/upload/2015/02/news/46697/fotos/src_1423413108djennifer-lourens-v-pikantnoi-fotosessii.jpg
			// https://kinoafisha.ua/upload/2019/06/films/8738/fotos/1zniz37yvcsera.jpeg -- 650x365
			//   https://kinoafisha.ua/upload/2019/06/films/8738/fotos/src_1zniz37yvcsera.jpeg -- 3072x2049
			match = src.match(/(\/upload\/+[0-9]{4}\/+[0-9]{2}\/+[^/]*\/+[0-9]+\/+fotos\/+)/);
			if (match) {
				newsrc = src.replace(/(\/+fotos\/+)[a-z]+\/+([^/]*)(?:[?#].*)?$/, "$1$2");
				if (newsrc !== src)
					return newsrc;
				if (!/\/src_[^/]*(?:[?#].*)?$/.test(src))
					return src.replace(/(\/fotos\/+)([^/]*)(?:[?#].*)?$/, "$1src_$2");
			}
		}

		if ((domain_nosub === "akamaized.net" && /^cache[0-9]*-ebookjapan\./.test(domain)) ||
			// https://haishin.ebookjapan.jp/contents/thumb/m/SX277060.jpg
			//   https://haishin.ebookjapan.jp/contents/thumb/l/SX277060.jpg
			domain === "haishin.ebookjapan.jp") {
			// thanks to synthtech on github: https://github.com/qsniyg/maxurl/issues/101
			// https://cache2-ebookjapan.akamaized.net/contents/thumb/s/SX277060.jpg?1560846301000
			//   https://cache2-ebookjapan.akamaized.net/contents/thumb/l/SX277060.jpg?1560846301000
			return src.replace(/\/contents\/+thumb\/+[ms]\/+/, "/contents/thumb/l/");
		}

		if (domain === "aws-cf.imdoc.fr" ||
			// https://aws-cf.caradisiac.com/prod/photos/5/1/9/1758519/7607881/img-7607881c72.jpg?v=1
			//   https://aws-cf.caradisiac.com/prod/photos/5/1/9/1758519/7607881/big-7607881c72.jpg?v=1
			domain === "aws-cf.caradisiac.com") {
			// https://aws-cf.imdoc.fr/prod/photos/0/2/9/4511029/25763048/tns0-25763048b68.jpg?v=2
			//   https://aws-cf.imdoc.fr/prod/photos/0/2/9/4511029/25763048/big-25763048b68.jpg?v=2
			return src.replace(/(\/prod\/+photos\/+(?:[0-9]+\/+){5})(?:tns[0-9]*|img)-/, "$1big-");
		}

		if (domain === "asobokey.x.fc2.com") {
			// https://asobokey.x.fc2.com/archive/today/201908/20190806/image/2019001_thumb.jpg
			//   https://asobokey.x.fc2.com/archive/today/201908/20190806/image/2019001.jpg
			return src.replace(/(\/image\/+[0-9]{4,})_thumb(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "hbox.jp") {
			// https://hbox.jp/image3/content/233555/sp_thumbnail_cover.jpg
			//   https://hbox.jp/image3/content/233555/cover.jpg
			return src.replace(/(\/image[0-9]*\/+content\/+[0-9]+\/+)sp_thumbnail_/, "$1");
		}

		if (domain === "storage.ws.pho.to") {
			// https://storage.ws.pho.to/s2/075c4132b93000455fbb9f5955d4ff08695edf80_m.jpeg
			//   https://storage.ws.pho.to/s2/075c4132b93000455fbb9f5955d4ff08695edf80.jpeg
			return src.replace(/(\/[0-9a-f]{20,})_[a-z](\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "freakolla.com") {
			// http://freakolla.com/FTV/Amie_Naked_In_High_Heels/THG/02.jpg
			//   http://freakolla.com/FTV/Amie_Naked_In_High_Heels/IMG/02.jpg
			return src.replace(/\/THG\/+([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/IMG/$1");
		}

		if (domain_nosub === "breath-takers.com" ||
			// http://galleries.sophiassexylegwear.com/assets/images/affiliates/images/gallery/blue_dress_2/small/untitled0004.jpg
			//   http://galleries.sophiassexylegwear.com/assets/images/affiliates/images/gallery/blue_dress_2/orig/untitled0004.jpg
			domain === "galleries.sophiassexylegwear.com" ||
			// http://galleries.girlfolio.com/assets/images/affiliates/images/gallery/simone_simply_simone/small/simone_simply_simone_0015.jpg
			//   http://galleries.girlfolio.com/assets/images/affiliates/images/gallery/simone_simply_simone/orig/simone_simply_simone_0015.jpg
			domain_nosub === "girlfolio.com") {
			// http://www.breath-takers.com/assets/images/category/gallery/pippa_doll_muse/small/PREVIEW_2.jpg
			//   http://www.breath-takers.com/assets/images/category/gallery/pippa_doll_muse/orig/PREVIEW_2.jpg
			return src.replace(/(\/assets\/+images\/+.*\/)(?:small|medium|large)\/+/, "$1orig/");
		}

		if (domain_nosub === "thepluginz.com" && /^img\./.test(domain)) {
			// http://img.free4.thepluginz.com/999/photos/t8v6v1/tn_1100118131_1.jpg
			//   http://img.free4.thepluginz.com/999/photos/t8v6v1/1100118131_1.jpg
			return src.replace(/(\/photos\/+[^/]*\/+)tn_/, "$1");
		}

		if (domain === "galleries.gloryhole-initiations.com" ||
			// https://galleries.blacksonblondes.com/content/lexi_lore/pics/tn/02.jpg
			//   https://galleries.blacksonblondes.com/content/lexi_lore/pics/pic/02.jpg
			domain === "galleries.blacksonblondes.com" ||
			// https://galleries.zebragirls.com/content/kate_england_lisa_tiffian/pics/tn/01.jpg
			//   https://galleries.zebragirls.com/content/kate_england_lisa_tiffian/pics/pic/01.jpg
			domain === "galleries.zebragirls.com") {
			// https://galleries.gloryhole-initiations.com/content/nia_nacci/pics/tn/01.jpg
			//   https://galleries.gloryhole-initiations.com/content/nia_nacci/pics/pic/01.jpg
			return src.replace(/\/pics\/+tn\/+/, "/pics/pic/");
		}

		if (domain === "g.misslk.com") {
			// http://g.misslk.com/a0561/tn/VGI0551P020008.jpg
			//   http://g.misslk.com/a0561/full/VGI0551P020008.jpg
			return src.replace(/\/tn\/+/, "/full/");
		}

		if (domain_nosub === "radgalleries.com") {
			// http://caliteens01.radgalleries.com/j132b/thumbnails/t01.jpg
			//   http://caliteens01.radgalleries.com/j132b/01.jpg
			return src.replace(/\/thumbnails\/+t([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/$1");
		}

		if (domain === "img.maximummedia.ie" ||
			// https://img.resized.co/beaut/eyJkYXRhIjoie1widXJsXCI6XCJodHRwczpcXFwvXFxcL3MzLWV1LXdlc3QtMS5hbWF6b25hd3MuY29tXFxcL3N0b3JhZ2UucHVibGlzaGVycGx1cy5pZVxcXC9tZWRpYS5iZWF1dC5pZVxcXC91cGxvYWRzXFxcLzIwMTZcXFwvMDJcXFwvMTYwMDAwMDBcXFwvMjUwNjI1MTM3ODVfOTYzNDViYmE4NF9iLTY4MngxMDI0LmpwZ1wiLFwid2lkdGhcIjpudWxsLFwiaGVpZ2h0XCI6MTcyLFwiZGVmYXVsdFwiOlwiaHR0cHM6XFxcL1xcXC93d3cuYmVhdXQuaWVcXFwvaVxcXC9ub0ltYWdlLnBuZ1wifSIsImhhc2giOiI0ZTZkZmQwMmY4ZDQwYmQ1NDMxMDAxMDQzODkzZmM3NWE0MTAyODhiIn0=/604246543tm00006-the-58th-g.jpg
			//   https://s3-eu-west-1.amazonaws.com/storage.publisherplus.ie/media.beaut.ie/uploads/2016/02/16000000/25062513785_96345bba84_b-682x1024.jpg
			// https://img.resized.co/businesspost/eyJkYXRhIjoie1widXJsXCI6XCJodHRwczpcXFwvXFxcL2ltZW5naW5lLnB1YmxpYy5wcm9kLnNicC5pbmZvbWFrZXIuaW8_dXVpZD0xZjFjMDVmNy1lYjY0LTU3ZDMtYWQ3ZC1lZGI4NWI3ZDhkODAmdHlwZT1wcmV2aWV3JnE9ODAmaGVpZ2h0PTIzODUuNDA4NzcxOTI5OCZ3aWR0aD0zNTc5JmZ1bmN0aW9uPWNyb3ByZXNpemUmeD0wJnk9MC4wMzE1Nzg5NDczNjg0MjEwNTQmY3JvcF93PTAuOTk5OTk5OTkmY3JvcF9oPTAuOTM1MDg3NzA5Mjk4MjVcIixcIndpZHRoXCI6NzY1LFwiaGVpZ2h0XCI6NTEyLFwiZGVmYXVsdFwiOlwiaHR0cDpcXFwvXFxcL3MzLWV1LXdlc3QtMS5hbWF6b25hd3MuY29tXFxcL3N0b3JhZ2UucHVibGlzaGVycGx1cy5pZVxcXC9tZWRpYS5idXNpbmVzc3Bvc3QuaWVcXFwvc2JwLW5vLWltYWdlLnBuZ1wiLFwib3B0aW9uc1wiOltdfSIsImhhc2giOiIyYjllZGFhOTA3ZDE2NzE0YWQwMDFlNjJmNzZjYTExN2RmOThiMWFlIn0=/imengine-public-prod-sbp-infomaker-io-uuid-1f1c05f7-eb64-57d3-ad7d-edb85b7d8d80-type-.93508770929825
			//   https://imengine.public.prod.sbp.infomaker.io/?uuid=1f1c05f7-eb64-57d3-ad7d-edb85b7d8d80&type=preview&q=80&height=2385.4087719298&width=3579&function=cropresize&x=0&y=0.031578947368421054&crop_w=0.99999999&crop_h=0.93508770929825
			domain === "img.resized.co") {
			// https://img.maximummedia.ie/her_ie/eyJkYXRhIjoie1widXJsXCI6XCJodHRwOlxcXC9cXFwvbWVkaWEtaGVyLm1heGltdW1tZWRpYS5pZS5zMy5hbWF6b25hd3MuY29tXFxcL3dwLWNvbnRlbnRcXFwvdXBsb2Fkc1xcXC8yMDE3XFxcLzA5XFxcLzA3MTY0ODM0XFxcL2dvbWV6LWNvdmVyLmpwZ1wiLFwid2lkdGhcIjo3NjcsXCJoZWlnaHRcIjo0MzEsXCJkZWZhdWx0XCI6XCJodHRwczpcXFwvXFxcL3d3dy5oZXIuaWVcXFwvYXNzZXRzXFxcL2ltYWdlc1xcXC9oZXJcXFwvbm8taW1hZ2UucG5nP2lkPTBkMmQ2MjdjMDU5YjllZGNhYjBkXCIsXCJvcHRpb25zXCI6W119IiwiaGFzaCI6IjkyMjg4NTc5ZTNiMzU2MzhjZDlmZmExNjdhYzhlZDU5YzllYWFkOWIifQ==/gomez-cover.jpg
			//   atob: {"data":"{\"url\":\"http:\\\/\\\/media-her.maximummedia.ie.s3.amazonaws.com\\\/wp-content\\\/uploads\\\/2017\\\/09\\\/07164834\\\/gomez-cover.jpg\",\"width\":767,\"height\":431,\"default\":\"https:\\\/\\\/www.her.ie\\\/assets\\\/images\\\/her\\\/no-image.png?id=0d2d627c059b9edcab0d\",\"options\":[]}","hash":"92288579e3b35638cd9ffa167ac8ed59c9eaad9b"}
			//   http://media-her.maximummedia.ie.s3.amazonaws.com/wp-content/uploads/2017/09/07164834/gomez-cover.jpg
			// doesn't work for all:
			// https://img.maximummedia.ie/her_ie/eyJkYXRhIjoie1widXJsXCI6XCJodHRwOlxcXC9cXFwvbWVkaWEtaGVyLm1heGltdW1tZWRpYS5pZS5zMy5hbWF6b25hd3MuY29tXFxcL3dwLWNvbnRlbnRcXFwvdXBsb2Fkc1xcXC8yMDE4XFxcLzExXFxcLzA1MTExMjI0XFxcL1NjcmVlbi1TaG90LTIwMTgtMTEtMDUtYXQtMTEuMTEuNDgucG5nXCIsXCJ3aWR0aFwiOjc2NyxcImhlaWdodFwiOjQzMSxcImRlZmF1bHRcIjpcImh0dHBzOlxcXC9cXFwvd3d3Lmhlci5pZVxcXC9hc3NldHNcXFwvaW1hZ2VzXFxcL2hlclxcXC9uby1pbWFnZS5wbmc_aWQ9MGQyZDYyN2MwNTliOWVkY2FiMGRcIixcIm9wdGlvbnNcIjpbXX0iLCJoYXNoIjoiODRhODQ0MWM4OWFmM2FiNGMxODA3MTI1ZDkzYjNkN2VhZmFkYzgyNyJ9/screen-shot-2018-11-05-at-11-11-48.png
			// using http://www.utilities-online.info/base64/, it seems to get corrupted after the url is given, maybe we can implement a custom decoder?
			//   http://media-her.maximummedia.ie.s3.amazonaws.com/wp-content/uploads/2018/11/05111224/Screen-Shot-2018-11-05-at-11.11.48.png
			match = src.match(/^[a-z]+:\/\/[^/]*\/[^/]*\/+([^/]{50,})(?:\/+[^/]*)?(?:[?#].*)?$/);
			if (match) {
				var splitted = match[1].split("_");
				var json_text = [];
				array_foreach(splitted, function(x) {
					json_text.push(base64_decode(x));
				});
				var json = JSON_parse(json_text.join("?"));
				if (json.data) {
					var data = JSON_parse(json.data);
					if (data.url)
						return data.url;
				}
			}
		}

		if (domain === "imagevars.gulfnews.com") {
			// https://imagevars.gulfnews.com/2019/05/16/190516-Selena-Gomez_16ac08ce9b9_large.jpg
			//   https://imagevars.gulfnews.com/2019/05/16/190516-Selena-Gomez_16ac08ce9b9_original-ratio.jpg
			return src.replace(/(_[0-9a-f]{6,})_[-a-z]+(\.[^/.]*)(?:[?#].*)?$/, "$1_original-ratio$2");
		}

		if (domain === "az743702.vo.msecnd.net" ||
			// https://storage.ko-fi.com/cdn/useruploads/post/jpeg_kofi_fae75b09-be70-424f-925b-8c368393107de457b463-0bb8-4cc0-aca2-1895e0eecb7d.jpeg
			//   https://storage.ko-fi.com/cdn/useruploads/display/jpeg_kofi_fae75b09-be70-424f-925b-8c368393107de457b463-0bb8-4cc0-aca2-1895e0eecb7d.jpeg
			// https://storage.ko-fi.com/cdn/useruploads/jpeg_KoFi_d916702b-5a9f-4a87-98b1-305cd893f268E05FD454-3CF2-4AF8-8A44-D8EA2014088F_post.jpg
			domain === "storage.ko-fi.com" ||
			// https://cdn.ko-fi.com/cdn/useruploads/e53090ad-734d-4c1c-ab15-73215be79804_tiny.png
			//   https://cdn.ko-fi.com/cdn/useruploads/e53090ad-734d-4c1c-ab15-73215be79804.png
			// https://cdn.ko-fi.com/cdn/useruploads/jpg_b66ba568-a447-47f9-82bc-cb3c654f14b18ibBOS1CoRI_post.jpg
			domain === "cdn.ko-fi.com") {
			// https://az743702.vo.msecnd.net/cdn/useruploads/tiny_dfc72789-50bf-486f-9a87-81d05ee09437.jpg
			//   https://az743702.vo.msecnd.net/cdn/useruploads/dfc72789-50bf-486f-9a87-81d05ee09437.jpg
			// doesn't work for all:
			// https://az743702.vo.msecnd.net/cdn/useruploads/jpeg_577f9238-f040-4b13-8851-587909cbfb1ccover.jpeg?v=5e0bd932-2264-40a3-b2ce-8643b5b351a3
			newsrc = src.replace(/\/useruploads\/+post\/+/, "/useruploads/display/");
			if (newsrc !== src)
				return newsrc;

			newsrc = src.replace(/(\/useruploads\/+)((?:[a-z_]+_(?:KoFi_)?)?[-0-9a-f]{20,}(?:[^/.]+)?)_post(\.[^/.]*)(?:[?#].*)?$/, "$1$2_display$3");
			if (newsrc !== src)
				return add_extensions_jpeg(newsrc);

			return src.replace(/(\/useruploads\/+)(?:[a-z]+_)?([-0-9a-f]{20,}(?:[a-z]+)?)(?:_[a-z]+)?(\.[^/.]*)(?:[?#].*)?$/, "$1$2$3");
		}

		if (domain_nowww === "silviomessina.pw" ||
			// http://bevilacqua.me/images/491-best-anime-cosplay-images-on-pinterest-amazing__aHR0cHM6Ly9pLnBpbmltZy5jb20vNzM2eC9iMS9jZC83MC9iMWNkNzA0OTMzMWY1NWM1ODE5MTBmMTRhMmM0NjNiYS5qcGc=.jpg
			//   https://i.pinimg.com/originals/b1/cd/70/b1cd7049331f55c581910f14a2c463ba.jpg
			domain_nowww === "bevilacqua.me" ||
			// http://www.geodomehome.org/images/780-best-images-about-cosplay-on-pinterest__aHR0cHM6Ly9zLW1lZGlhLWNhY2hlLWFrMC5waW5pbWcuY29tLzczNngvMDQvYzEvNzEvMDRjMTcxNjVhMzM2ZDE0MDY2OTlmODg3MzgyMGZiZjgtLWN1dGUtY29zcGxheS1hbmltZS1jb3NwbGF5LmpwZw==.jpg
			//   https://i.pinimg.com/originals/04/c1/71/04c17165a336d1406699f8873820fbf8--cute-cosplay-anime-cosplay.jpg
			domain_nowww === "geodomehome.org" ||
			// http://www.soamasterclass.com/images/rainbow-s-jisook-is-the-sexy-cover-model-for-maxim__aHR0cHM6Ly9jZG4xLmxvY2tlcmRvbWUuY29tL3VwbG9hZHMvYjE5Mzc5YTJiM2M5NTc4ZTI1Zjg0MTA0Y2YyNjE2NDE0ZmQ3N2M5ZDlmMDNlMTM5MmExMmM1ZGVjNDA1YTU1Yl9sYXJnZQ==.jpg
			//   https://cdn1.lockerdome.com/uploads/b19379a2b3c9578e25f84104cf2616414fd77c9d9f03e1392a12c5dec405a55b_:original
			domain_nowww === "soamasterclass.com" ||
			// https://www.royal-city.com/images/miley-cyrus-short-hair__aHR0cDovLzEuYnAuYmxvZ3Nwb3QuY29tLy1yZHNZWVhaS3RDTS9VUVdGU0ppNW5QSS9BQUFBQUFBQUJKUS9fS2o0aHd1Tnpkdy9zNjQwL01pbGV5LUN5cnVzLUZlZXQtODk5NTg1LmpwZw==.jpg
			domain_nowww === "royal-city.com" ||
			// http://www.ulsterscotsacademy.org/images/beautiful-house-my-house-in-2018-pinterest-house__aHR0cHM6Ly9pLnBpbmltZy5jb20vb3JpZ2luYWxzLzBiLzdlLzhhLzBiN2U4YTAyZWQzYzJkMzYxMTY3NWY2NzhmZWNlYWQ5LmpwZw==.jpg
			//   https://i.pinimg.com/originals/0b/7e/8a/0b7e8a02ed3c2d3611675f678fecead9.jpg
			domain_nowww === "ulsterscotsacademy.org" ||
			// http://newkunci.co/images/casa-estilo-mediterr-225-neo-home-en-2019-y__aHR0cHM6Ly9pLnBpbmltZy5jb20vb3JpZ2luYWxzLzhjL2E5L2QwLzhjYTlkMDA4YjJhZWMzNjFjNDg1Y2RhY2IxN2Y5MWY3LmpwZw==.jpg
			//   https://i.pinimg.com/originals/8c/a9/d0/8ca9d008b2aec361c485cdacb17f91f7.jpg
			domain_nowww === "newkunci.co" ||
			// http://xianweizhu.com/images/casa-estilo-mediterr-225-neo-casas-pinterest-casa-estilo-estilo-y-casas__aHR0cHM6Ly9zLW1lZGlhLWNhY2hlLWFrMC5waW5pbWcuY29tL29yaWdpbmFscy84Yy9hOS9kMC84Y2E5ZDAwOGIyYWVjMzYxYzQ4NWNkYWNiMTdmOTFmNy5qcGc=.jpg
			//   https://s-media-cache-ak0.pinimg.com/originals/8c/a9/d0/8ca9d008b2aec361c485cdacb17f91f7.jpg
			domain_nowww === "xianweizhu.com" ||
			// http://www.edu.kustantiblogs.web.id/images/showing-porn-images-for-hisui-nightshade-porn-www__aHR0cHM6Ly9pLnBpbmltZy5jb20vb3JpZ2luYWxzL2M4LzI4L2QyL2M4MjhkMjBhODYwMjUyZjAwOGU3MjUyM2YwNGU2YWRiLmpwZw==.jpg
			//   https://i.pinimg.com/originals/c8/28/d2/c828d20a860252f008e72523f04e6adb.jpg
			domain === "www.edu.kustantiblogs.web.id") {
			// http://silviomessina.pw/images/best-25-lesley-ann-brandt-ideas-on-pinterest__aHR0cHM6Ly9zLW1lZGlhLWNhY2hlLWFrMC5waW5pbWcuY29tLzczNngvZDAvZTYvN2QvZDBlNjdkMTI2Mzg4NThkYmFkMTgwZWFhNmU5ZTQ0NjMtLWxlc2xleS1hbm4tYnJhbmR0LWdheS1jZWxlYnJpdGllcy5qcGc=.jpg
			//   https://s-media-cache-ak0.pinimg.com/736x/d0/e6/7d/d0e67d12638858dbad180eaa6e9e4463--lesley-ann-brandt-gay-celebrities.jpg
			//   https://i.pinimg.com/originals/d0/e6/7d/d0e67d12638858dbad180eaa6e9e4463.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+images\/+[^/]*__([^-/._]{30,})\.[^/.]*(?:[?#].*)?$/, "$1");
			if (newsrc !== src)
				return base64_decode(newsrc);
		}

		if (domain_nowww === "xxxsexy.xyz" ||
			// http://pornxxxbest.xyz/images/aHR0cDovL3RzZTMubW0uYmluZy5uZXQvdGg/aWQ9T0lQLmQ5TS1QNU9iVkxXWmF4aktGV1JOVlFIYUxPJmFtcDt3PTIzMCZhbXA7aD0xNzAmYW1wO3JzPTEmYW1wO3BjbD1kZGRkZGQmYW1wO289NSZhbXA7cGlkPTEuMQ==.jpg
			//   http://tse3.mm.bing.net/th?id=OIP.d9M-P5ObVLWZaxjKFWRNVQHaLO
			domain_nowww === "pornxxxbest.xyz") {
			// http://xxxsexy.xyz/images/aHR0cDovL3RzZTEubW0uYmluZy5uZXQvdGg/aWQ9T0lQLnZIemZ3cFBEMkZ0OGp1QzRXM0dKcHdIYUo0JmFtcDt3PTIzMCZhbXA7aD0xNzAmYW1wO3JzPTEmYW1wO3BjbD1kZGRkZGQmYW1wO289NSZhbXA7cGlkPTEuMQ==.jpg
			//   http://tse1.mm.bing.net/th?id=OIP.vHzfwpPD2Ft8juC4W3GJpwHaJ4
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+images\/+([^.]{50,})\.[^/.]*(?:[?#].*)?$/, "$1");
			if (newsrc !== src) {
				var splitted = newsrc.split("/");
				newsrc = base64_decode(splitted[0]);
				if (splitted.length > 1)
					newsrc += "?" + base64_decode(splitted[1]);
				return newsrc;
			}
		}

		if (domain_nosub === "soumeiwang.com" ||
			// http://m.shianwang.com/img/aHR0cDovL2ltZzAuaW1ndG4uYmRpbWcuY29tL2l0L3U9NDMxODU4MDc4LDIwMjQ2NzA5NzAmZm09MTUmZ3A9MC5qcGc=.jpg
			//   http://img0.imgtn.bdimg.com/it/u=431858078,2024670970&fm=15&gp=0.jpg
			domain_nosub === "shianwang.com" ||
			// http://www.baobaoyuer.com/img/aHR0cDovL2ltZzMuaW1ndG4uYmRpbWcuY29tL2l0L3U9Mjk0NzkxNTEyNSwzMDc5NDIzNDg2JmZtPTI2JmdwPTAuanBn.jpg
			//   http://img3.imgtn.bdimg.com/it/u=2947915125,3079423486&fm=26&gp=0.jpg
			domain_nosub === "baobaoyuer.com" ||
			// https://m.daguaw.com/img/aHR0cDovL2ltZzMuaW1ndG4uYmRpbWcuY29tL2l0L3U9OTQ2NDk4OTcyLDI3NjM4OTQ5NDEmZm09MjYmZ3A9MC5qcGc=.jpg
			//   http://img3.imgtn.bdimg.com/it/u=946498972,2763894941&fm=26&gp=0.jpg
			// https://daguaw.com/img/aHR0cDovL2ltZzIuaW1ndG4uYmRpbWcuY29tL2l0L3U9Mjg4NDcyNTE3NywzMTQxOTEwOTgzJmZtPTI2JmdwPTAuanBn.jpg
			domain_nosub === "daguaw.com" ||
			// https://www.ditiw.com/img/aHR0cDovL2ltZzAuaW1ndG4uYmRpbWcuY29tL2l0L3U9OTg4MjI3NzA5LDQwNDQ3NDYwNjEmZm09MjYmZ3A9MC5qcGc=.jpg
			//   http://img0.imgtn.bdimg.com/it/u=988227709,4044746061&fm=26&gp=0.jpg
			domain_nosub === "ditiw.com" ||
			// http://www.chudaowang.com/img/aHR0cDovL2ltZzAuaW1ndG4uYmRpbWcuY29tL2l0L3U9NDMxNjU2NTg3LDI2ODIxMjI0NjMmZm09MjYmZ3A9MC5qcGc=.jpg
			//   http://img0.imgtn.bdimg.com/it/u=431656587,2682122463&fm=26&gp=0.jpg
			domain_nosub === "chudaowang.com" ||
			// https://desangw.com/img/aHR0cDovL2ltZzQuaW1ndG4uYmRpbWcuY29tL2l0L3U9NDA4MTI5NzkyNSwxMzI5ODUxNjU1JmZtPTE1JmdwPTAuanBn.jpg
			//   http://img4.imgtn.bdimg.com/it/u=4081297925,1329851655&fm=15&gp=0.jpg
			domain_nosub === "desangw.com" ||
			// http://www.hbmygm.com/img/aHR0cDovL2ltZzAuaW1ndG4uYmRpbWcuY29tL2l0L3U9MzMxMjAxNDg1MiwxMzg2OTUyNTUwJmZtPTIzJmdwPTAuanBn.jpg
			//   http://img0.imgtn.bdimg.com/it/u=3312014852,1386952550&fm=23&gp=0.jpg
			domain_nowww === "hbmygm.com" ||
			// https://m.dalangw.com/img/aHR0cDovL2ltZzQuaW1ndG4uYmRpbWcuY29tL2l0L3U9Mzk1ODY3NTA2NCwzMzA0NzAxMzMwJmZtPTI2JmdwPTAuanBn.jpg
			//   http://img4.imgtn.bdimg.com/it/u=3958675064,3304701330&fm=26&gp=0.jpg
			domain_nosub === "dalangw.com") {
			// http://www.soumeiwang.com/img/aHR0cDovL2ltZzQuaW1ndG4uYmRpbWcuY29tL2l0L3U9OTUzMDIzNjAyLDM1ODIwMzU5MTgmZm09MTUmZ3A9MC5qcGc=.jpg
			//   http://img4.imgtn.bdimg.com/it/u=953023602,3582035918&fm=15&gp=0.jpg
			// http://m.soumeiwang.com/img/aHR0cDovL2ltZzAuaW1ndG4uYmRpbWcuY29tL2l0L3U9ODU2ODE4NzcxLDM5MDkyODQ5MTEmZm09MjYmZ3A9MC5qcGc=.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+img\/+([^-/._]{30,})\.[^/.]*(?:[?#].*)?$/, "$1");
			if (newsrc !== src)
				return base64_decode(newsrc);
		}

		if (domain_nowww === "kabelversand.info" ||
			// https://teamupforkansaskids.com/pics/aHR0cHM6Ly90c2U0Lm1tLmJpbmcubmV0L3RoP2lkPU9JUC5QMk5LLXI0dm1zZmctdUN4b0RiXzBnSGFGaiZ3PTUwMCZycz0xJnBpZD0xNS4x
			//   https://tse4.mm.bing.net/th?id=OIP.P2NK-r4vmsfg-uCxoDb_0gHaFj
			domain_nowww === "teamupforkansaskids.com" ||
			// https://gbracingpix.com/pics/aHR0cHM6Ly90c2UzLm1tLmJpbmcubmV0L3RoP2lkPU9JUC54anVCRW4xeXdkQVhoX2hoNExFbjNBSGFIYSZ3PTUwMCZycz0xJnBpZD0xNS4x
			//   https://tse3.mm.bing.net/th?id=OIP.xjuBEn1ywdAXh_hh4LEn3AHaHa
			domain_nowww === "gbracingpix.com" ||
			// https://kickin.info/pics/aHR0cHM6Ly90c2UzLm1tLmJpbmcubmV0L3RoP2lkPU9JUC41OE40dkNDVWw4WVlOUjlEUlptZ01nSGFFNyZycz0xJnBpZD0xNS4xJnc9MTAyNA==.jpg
			//   https://tse3.mm.bing.net/th?id=OIP.58N4vCCUl8YYNR9DRZmgMgHaE7
			domain_nowww === "kickin.info" ||
			// https://catmario.info/pics/aHR0cHM6Ly90c2UzLm1tLmJpbmcubmV0L3RoP2lkPU9JUC41OE40dkNDVWw4WVlOUjlEUlptZ01nSGFFNyZycz0xJnBpZD0xNS4xJnc9MTAyNA==.jpg
			//   https://tse3.mm.bing.net/th?id=OIP.58N4vCCUl8YYNR9DRZmgMgHaE7
			domain_nowww === "catmario.info" ||
			// https://greateasternwallgallery.com/pics/aHR0cHM6Ly90c2UzLm1tLmJpbmcubmV0L3RoP2lkPU9JUC41OE40dkNDVWw4WVlOUjlEUlptZ01nSGFFNyZycz0xJnBpZD0xNS4xJnc9MTAyNA==.jpg
			//   https://tse3.mm.bing.net/th?id=OIP.58N4vCCUl8YYNR9DRZmgMgHaE7
			domain_nowww === "greateasternwallgallery.com" ||
			// https://stepanakert.info/pics/aHR0cHM6Ly90c2UzLm1tLmJpbmcubmV0L3RoP2lkPU9JUC41OE40dkNDVWw4WVlOUjlEUlptZ01nSGFFNyZycz0xJnBpZD0xNS4xJnc9MTAyNA==.jpg
			//   https://tse3.mm.bing.net/th?id=OIP.58N4vCCUl8YYNR9DRZmgMgHaE7
			domain_nowww === "stepanakert.info" ||
			// https://modellini.info/pics/aHR0cHM6Ly90c2UzLm1tLmJpbmcubmV0L3RoP2lkPU9JUC5iM25jMjR5aEQ4WUo1TDJSeWZ2aFJRSGFGaiZycz0xJnBpZD0xNS4x.jpg
			//   https://tse3.mm.bing.net/th?id=OIP.b3nc24yhD8YJ5L2RyfvhRQHaFj
			domain_nowww === "modellini.info" ||
			// https://oboteen.com/pics/aHR0cHM6Ly9pbTAtdHViLXJ1LnlhbmRleC5uZXQvaT9pZD0wMDU0ODZkOTcxMTRmYWJlNWU2OWZkZDgzNmQzOGJlMC1sJm49MTM=.jpg
			//   https://im0-tub-ru.yandex.net/i?id=005486d97114fabe5e69fdd836d38be0-l&n=13 -- 1280x845
			domain_nowww === "oboteen.com" ||
			// https://carltonstaffing.info/pics/aHR0cHM6Ly90c2UzLm1tLmJpbmcubmV0L3RoP2lkPU9JUC41OE40dkNDVWw4WVlOUjlEUlptZ01nSGFFNyZycz0xJnBpZD0xNS4xJnc9MTAyNA==.jpg
			//   https://tse3.mm.bing.net/th?id=OIP.58N4vCCUl8YYNR9DRZmgMgHaE7
			domain_nowww === "carltonstaffing.info") {
			// https://kabelversand.info/pics/aHR0cHM6Ly90c2UyLm1tLmJpbmcubmV0L3RoP2lkPU9JUC5mX1BlNFo1aHBCTkF4V2tPckF3Q25BSGFGMyZycz0xJnBpZD0xNS4x
			//   https://tse2.mm.bing.net/th?id=OIP.f_Pe4Z5hpBNAxWkOrAwCnAHaF3
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+pics\/+([^-/._]{30,})(?:\.[^/.]*)?(?:[?#].*)?$/, "$1");
			if (newsrc !== src)
				return base64_decode(newsrc);
		}

		if (domain_nosub === "gaanacdn.com" && /^a[0-9]*\./.test(domain)) {
			// https://a10.gaanacdn.com/gn_img/artists/9MAWe97WyJ/MAWerpqJby/size_s_1558423579.jpg
			//   https://a10.gaanacdn.com/gn_img/artists/9MAWe97WyJ/MAWerpqJby/size_l_1558423579.jpg -- 400x400
			//   https://a10.gaanacdn.com/gn_img/artists/9MAWe97WyJ/MAWerpqJby/size_xl_1558423579.jpg -- 800x800
			// https://a10.gaanacdn.com/images/artists/58/831358/crop_480x480_831358.jpg
			// thanks to anonymous for reporting:
			// https://a10.gaanacdn.com/gn_img/albums/jBr3gybR1m/r3geldGZbR/size_l_1717509899.jpg
			//   https://a10.gaanacdn.com/gn_img/albums/jBr3gybR1m/r3geldGZbR/size_xxl_1717509899.jpg -- 1200x1200
			return src
				.replace(/(\/(?:artists|albums)\/+[^/]*\/+[^/]*\/+size_)xl_/, "$1xxl_")
				.replace(/(\/(?:artists|albums)\/+[^/]*\/+[^/]*\/+size_)l_/, "$1xl_")
				.replace(/(\/(?:artists|albums)\/+[^/]*\/+[^/]*\/+size_)[sm]_/, "$1l_");
		}

		if (domain_nosub === "baidu-img.cn" && /^cdn[0-9]*\./.test(domain)) {
			// http://cdn01.baidu-img.cn/timg?image_search&quality=80&size=b230_225&sec=1439724140&di=f88c67231a39b5dd9d998668fd43b622&imgtype=jpg&src=http://img4.imgtn.bdimg.com/it/u=927383797,1588378365&fm=21&gp=0.jpg
			//   http://img4.imgtn.bdimg.com/it/u=927383797,1588378365
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/timg\?(?:.*?&)?src=(http[^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "pic.yupoo.com") {
			// http://pic.yupoo.com/jpbeta/0284aba2/small.jpg
			//   http://pic.yupoo.com/jpbeta/0284aba2/large.jpg
			// thanks to 毅j on discord:
			// http://1024club.org/
			// https://pic.yupoo.com/peigen123_v/G3KsK729/small.jpg
			//   https://pic.yupoo.com/peigen123_v/G3KsK729/medish.jpg
			//   https://pic.yupoo.com/peigen123_v/G3KsK729/large.jpg
			// original versions are protected(?): https://pic.yupoo.com/peigen123_v/G3KsKKnz/kldgM.jpg
			// https://pic.yupoo.com/airmanbu6666/49b8fe8e/big.jpg -- 800x533
			//   https://pic.yupoo.com/airmanbu6666/49b8fe8e/large.jpg -- 1024x683
			// medium = 500x? max
			// medish = 640x? max
			// big = 800x? max
			// large = 1024x? max(?)
			return src.replace(/(:\/\/[^/]+\/+[^/]+\/+[0-9a-zA-Z]{6,}\/+)(?:small|medi(?:um|sh)|big)(\.[^/.]*)(?:[?#].*)?$/, "$1large$2");
		}

		if (domain === "img.popnroll.tv" ||
			// https://images.dappei.com/uploads/article_image/image/28904/medium_fa0845027647cd69.jpg
			//   https://images.dappei.com/uploads/article_image/image/28904/fa0845027647cd69.jpg
			domain === "images.dappei.com") {
			// https://img.popnroll.tv/uploads/news_item/image/3789/thumb_Liyuu%E3%82%A2%E3%83%BC%E5%86%99.jpg
			//   https://img.popnroll.tv/uploads/news_item/image/3789/medium_Liyuu%E3%82%A2%E3%83%BC%E5%86%99.jpg
			//   https://img.popnroll.tv/uploads/news_item/image/3789/large_Liyuu%E3%82%A2%E3%83%BC%E5%86%99.jpg -- upscaled?
			//   https://img.popnroll.tv/uploads/news_item/image/3789/Liyuu%E3%82%A2%E3%83%BC%E5%86%99.jpg
			return src.replace(/(\/uploads\/+[^/]*\/+image\/+[0-9]+\/+)(?:thumb|medium|large)_/, "$1");
		}

		if (domain_nosub === "adulttrade.net") {
			// http://ebony.adulttrade.net/ebony_pics_galleries/amateur-black-porn-fhg/499uf/tn_name5.jpg
			//   http://ebony.adulttrade.net/ebony_pics_galleries/amateur-black-porn-fhg/499uf/tn_name5.jpg
			return src.replace(/(_pics_galleries\/.*\/)tn_([^/]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "thepaysites.com") {
			// http://www.thepaysites.com/showybeauty/175983/blonde-with-wistfully-look-nude-russian-woman/thumb_12.jpg
			//   http://www.thepaysites.com/showybeauty/175983/blonde-with-wistfully-look-nude-russian-woman/12.jpg
			return src.replace(/(\/[0-9]+\/+[^/]+\/+)thumb_([0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "i.myass.ru") {
			// http://i.myass.ru/201312/17/m/20131252af63a4680d8.jpg
			//   http://i.myass.ru/201312/17/f/20131252af63a4680d8.jpg
			return src.replace(/(\/[0-9]{6}\/+[0-9]+\/+)[a-z]\/+([0-9]+[0-9a-f]+\.[^/.]*)(?:[?#].*)?$/, "$1f/$2");
		}

		if (domain === "img.cactusboy.com" ||
			// http://pictures.bigtittedteens.com/b/be/be53ee61104935234b174e62a07e53cf/tn_1.jpg
			//   http://pictures.bigtittedteens.com/b/be/be53ee61104935234b174e62a07e53cf/1.jpg
			domain === "pictures.bigtittedteens.com" ||
			// http://pictures.petitebabespics.com/e/ee/ee600797ef18eabe7f2ebb7d864a0df2/tn_1.jpg
			//   http://pictures.petitebabespics.com/e/ee/ee600797ef18eabe7f2ebb7d864a0df2/1.jpg
			domain === "pictures.petitebabespics.com") {
			// http://img.cactusboy.com/3/3e/3ed1be6891233bdf909b1290a1550ba9/tn_1.jpg
			//   http://img.cactusboy.com/3/3e/3ed1be6891233bdf909b1290a1550ba9/1.jpg
			return src.replace(/(\/[0-9a-f]\/+[0-9a-f]{2}\/+[0-9a-f]{10,}\/+)tn_([0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "images.eastbabes.com" ||
			// https://images.ebonygirls.sexy/p/hot_black_bikini-babes-myebonygf/th/7.jpg
			//   https://images.ebonygirls.sexy/p/hot_black_bikini-babes-myebonygf/7.jpg
			domain === "images.ebonygirls.sexy" ||
			// https://images.nakedjapanesegirls.photos/p/Yuu356/th/01.jpg
			//   https://images.nakedjapanesegirls.photos/p/Yuu356/01.jpg
			domain === "images.nakedjapanesegirls.photos" ||
			// https://images.nudejapanesemodels.sexy/p/handjobjapan75/th/01.jpg
			//   https://images.nudejapanesemodels.sexy/p/handjobjapan75/01.jpg
			domain === "images.nudejapanesemodels.sexy" ||
			// https://images.asianporn.photos/p/crazyasianGF_14/th/01.jpg
			//   https://images.asianporn.photos/p/crazyasianGF_14/01.jpg
			domain === "images.asianporn.photos" ||
			// https://images.latinababesfucking.com/p/-cynthia-bang-tail-shot-/th/cynthia.pick02.jpg
			//   https://images.latinababesfucking.com/p/-cynthia-bang-tail-shot-/cynthia.pick02.jpg
			domain === "images.latinababesfucking.com" ||
			// https://images.blackporn.photos/p/blackGFs_15/th/01.jpg
			//   https://images.blackporn.photos/p/blackGFs_15/01.jpg
			domain === "images.blackporn.photos" ||
			// https://images.nudeasians.pics/p/kumja_moon_TC44104/th/thai_cuties_kumja_moon_set1_01.jpg
			//   https://images.nudeasians.pics/p/kumja_moon_TC44104/thai_cuties_kumja_moon_set1_01.jpg
			domain === "images.nudeasians.pics" ||
			// https://images.nakedblackbabes.pics/p/roundbrown_7/th/01.jpg
			//   https://images.nakedblackbabes.pics/p/roundbrown_7/01.jpg
			domain === "images.nakedblackbabes.pics") {
			// https://images.eastbabes.com/p/cali_caramel_glory/th/01.jpg
			//   https://images.eastbabes.com/p/cali_caramel_glory/01.jpg
			return src.replace(/(\/p\/+[^/]*\/+)th\/+/, "$1");
		}

		if (domain_nowww === "erotikom.com") {
			// http://www.erotikom.com/StasyQ-Nude-Curves-in-2020/20200825/StasyQ-Nude-Models-20200825-01-th-01.jpg
			//   http://www.erotikom.com/StasyQ-Nude-Curves-in-2020/20200825/20200825-01-01.jpg
			// http://www.erotikom.com/StasyQ-Nude-Curves-in-2020/20200708/StasyQ-Nude-Models-20200708-01-th-00.jpg
			//   http://www.erotikom.com/StasyQ-Nude-Curves-in-2020/20200708/20200708-01-00.jpg
			return src.replace(/(\/[0-9]{8}\/+)[^/.?#]+-([0-9]{8}-[0-9]+)-th(-[0-9]+\.)/, "$1$2$3");
		}

		// Question2Answer
		if (((domain_nowww === "simdunyasi.com" ||
			 // https://gateoverflow.in/?qa=blob&qa_blobid=14382465908978628560
			 //   https://gateoverflow.in/?qa=image&qa_blobid=14382465908978628560
			 domain_nowww === "gateoverflow.in" ||
			 // https://fontid.co/?qa=image&qa_blobid=1248948277149109212&qa_size=200
			 //   https://fontid.co/?qa=image&qa_blobid=1248948277149109212
			 domain_nowww === "fontid.co")
			 && src.match(/[?&]qa_blobid=[0-9]+/)) ||
			/[?&]qa_blobid=[0-9]{10,}(?:[&#].*)?$/.test(src)) {
			// http://simdunyasi.com/soru-cevap/?qa=image&qa_blobid=8895462672868136868&qa_size=200
			//   http://simdunyasi.com/soru-cevap/?qa=image&qa_blobid=8895462672868136868
			return src.replace(/\?(?:.*&)?(qa_blobid=[0-9]+).*?$/, "?qa=image&$1");
		}

		if (domain === "image.tophinhanh.me" ||
			// http://image.buonchoai.club/rx/x1000/hinhnensamsung.com/hinh-nen/module_new/anime-girl_s697.jpg
			//   http://hinhnensamsung.com/hinh-nen/module_new/anime-girl_s697.jpg
			domain === "image.buonchoai.club") {
			// http://image.tophinhanh.me/rx/x500/file.vforum.vn/hinh/2016/10/avatar-anime-dang-yeu-cho-zalo-15.jpg
			//   http://file.vforum.vn/hinh/2016/10/avatar-anime-dang-yeu-cho-zalo-15.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+rx\/+[0-9]*x[0-9]*\/+([^/]*\.[^/]*\/)/, "$1");
			if (newsrc !== src)
				return add_http(newsrc);
		}

		if (domain_nowww === "artspace712.com" ||
			// http://dientumaytinh.com/uploads/large/WVVoU01HTklUVFpNZVRrelpETmpkVmx0YkhaYU0wcG9ZMGRvTlV4dFRuWmlVemgxWVZjeGFGb3lWWFprUmpsNllVZEdlVnBUT1U1V1JtdDVWR3hTU21Wck1UWlplbEpPVmtWcmVWUlZVazVPUlRGeFZGUlZkbVJ0YkhWWk1sWjFaRVk1TWxsWE5XWmFNamx1WVVZNWVscFhlRzFZTTBKMlkyNVNlVmxYYkRCWU0wSm9ZVmMxTUdGWE5XNVlNakV4WXpKV2JGZ3lVblpqYms1b1pWWTVNbUZYUm1aa01teHlZVmN4YkZwSGJHaFlNazUyWWxjeGRtSnVUbVpqU0VwMllsYzVjV05IWTNWaGJrSnU/vincient-van-gough-art-clip/paintings-quotes-death.jpg
			//   https://www.biography.com/.image/t_share/MTY2NTIzMzc4MTI2MDM4MjM5/vincent_van_gogh_self_portrait_painting_musee_dorsay_via_wikimedia_commons_promojpg.jpg
			domain_nowww === "dientumaytinh.com" ||
			// https://aihara-company.com/uploads/large/WVVoU01HTklUVFpNZVRsd1RHNUNjR0p0YkhSYWVUVnFZakl3ZG1JelNuQmFNbXgxV1ZkNGVreDZRbWxNZW1Sc1RIcG9hRXg2UW1sT01sVTBXVlJCZVZwWFVYcFpla3ByVFhwWmVFMVVXVE5PVjFreVRucG9iVnBYVG14WlYxRTFURzF3ZDFwMw/house-design-house-house-styles.jpg
			//   https://i.pinimg.com/originals/0b/7e/8a/0b7e8a02ed3c2d3611675f678fecead9.jpg
			domain_nowww === "aihara-company.com") {
			// https://artspace712.com/uploads/large/WVVoU01HTkViM1pNZWtsMVdXNUJkVmx0ZUhaYU0wNTNZak5SZFZreU9YUk1lVEZYVFVoS1FtTnJVazFoYWs1VlVsTTVWbFZJVm5aWU1rcGhVV2t3TkZOVE9VSlJWVVpDVVZWR1FsRlZTVEJUVXpnMFdtNWFWMUl6WkhOU2JtY3hVVk01ZWsxVVdYZE5RemxxWkZoU2JGZ3lSblZoVnpGc1dESmtjR050ZUdaWmJteG1Zek5XYzFwWWJIUlpWelZ2V1ZoYU1XVnBNV3RPVjBadVlsaHNiVXh0Y0hkYWR3/anime-and-manga/vocanime-crazy-shoujo-type.jpg
			//   http://2.bp.blogspot.com/-V0rArDLj3TE/UPuo_bZB-8I/AAAAAAAAB4I/8fvVGwlFx5A/s0/cute_anime_girl_by_suleymanhavuz-d5agmyf.jpg=s0?imgmax=0
			match = src.match(/^[a-z]+:\/\/[^/]*\/+uploads\/+[^/]*\/+([^/.]{60,})\/+.*(?:[?#].*)?$/);
			if (match) {
				return base64_decode(base64_decode(base64_decode(match[1])));
			}
		}

		if (domain_nosub === "lozi.vn") {
			// https://tea-3.lozi.vn/v1/images/resized/ban-quan-ao-1477607120-1048326-1477607120?w=480&type=o
			//   https://tea-3.lozi.vn/v1/images/original/ban-quan-ao-1477607120-1048326-1477607120
			return src.replace(/(\/v1\/+[^/]*\/+)resized\/+([^/]*?)(?:[?#].*)?$/, "$1original/$2");
		}

		if (domain_nosub === "ilikewallpaper.net") {
			// https://r1.ilikewallpaper.net/pic/201412/Cute_cartoon_girl_Wallpaper828x1792.jpg
			//   https://r1.ilikewallpaper.net/pic/201412/Cute_cartoon_girl_Wallpaper.jpg
			return src.replace(/(\/pic\/+[0-9]{6}\/+[^/]*?)[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nosub === "fatakat.com" && /^files[0-9]*\./.test(domain)) {
			// http://files2.fatakat.com/2018/1/user/small/1515436535_4651.jpg
			//   http://files2.fatakat.com/2018/1/user/1515436535_4651.jpg
			return src.replace(/(\/[0-9]{4}\/+[0-9]{1,2}\/+(?:[^/]*\/+)?)small\/+/, "$1");
		}

		if (domain_nowww === "oir.mobi") {
			// https://oir.mobi/src.php?src=https://oir.mobi/uploads/posts/2018-12/54549.jpg&w=300
			//   https://oir.mobi/uploads/posts/2018-12/54549.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+src\.php\?(?:.*&)?src=(http[^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "tn.smilevideo.jp") {
			// https://tn.smilevideo.jp/smile?i=24133677.M
			//   https://tn.smilevideo.jp/smile?i=24133677.L
			return {
				url: src.replace(/^([a-z]+:\/\/[^/]*\/+smile\?)(?:.*&)?(i=[0-9]+)(?:\.M)?(?:&.*)?$/, "$1$2.L"),
				can_head: false // 403
			};
		}

		if (domain_nowww === "wallpaperlayer.com") {
			// https://wallpaperlayer.com/img/2015/11/thumb/cute-anime-girl-hd-6282-6557-hd-wallpapers-thumb.jpg
			//   https://wallpaperlayer.com/img/2015/11/cute-anime-girl-hd-6282-6557-hd-wallpapers.jpg
			return src.replace(/(\/img\/+[0-9]{4}\/+[0-9]{2}\/+)thumb\/+([^/]*)-thumb(\.[^/.]*)(?:[?#].*)?$/, "$1$2$3");
		}

		if (domain === "str.your-pictionary.com") {
			// https://str.your-pictionary.com/2015/03/15/Anime_HD_Wallpaper_4K-68.md.jpg
			//   https://str.your-pictionary.com/2015/03/15/Anime_HD_Wallpaper_4K-68.jpg
			return src.replace(/\.md(\.[^/.]*)(?:[?#].*)?$/, "$1");
		}

		if (domain_nowww === "rin-city.com" ||
			// https://stylerotica.com/images/previews/Wild/thumb_01.jpg
			//   https://stylerotica.com/images/previews/Wild/full_01.jpg
			domain_nowww === "stylerotica.com") {
			// https://rin-city.com/images/previews/Immortal/thumb_Immortal_37.jpg
			//   https://rin-city.com/images/previews/Immortal/full_Immortal_37.jpg
			return src.replace(/(\/images\/+previews\/+[^/]*\/+)thumb_/, "$1full_");
		}

		if (domain_nowww === "mypornstarbook.net" ||
			// https://www.milf-pics.net/galleries/777/thumbnails/tn01.jpg
			//   https://www.milf-pics.net/galleries/777/images/01.jpg
			domain_nowww === "milf-pics.net") {
			// https://www.mypornstarbook.net/pornstars/b/black_sonja/gallery07/thumbnails/tn01.jpg
			//   https://www.mypornstarbook.net/pornstars/b/black_sonja/gallery07/images/01.jpg
			// https://www.mypornstarbook.net/pornstars/j/jewelz_blu/gallery19/images/thumbnails/tn02.jpg
			//   https://www.mypornstarbook.net/pornstars/j/jewelz_blu/gallery19/images/02.jpg
			return src.replace(/\/(?:images\/+)?thumbnails\/+tn([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/images/$1");
		}

		if (domain_nowww === "picgym.net") {
			// https://picgym.net/img/anime_lovers20056177077742.jpg?aHR0cHM6Ly9zY29udGVudC1mcnQzLTIuY2RuaW5zdGFncmFtLmNvbS92cC9iYzQwNzNhZjVlNmYyYTYzNGE2MTI4MjYyNWIwOWRkZi81RDlDNjU2OS90NTEuMjg4NS0xNS9lMzUvNDYxODI5MjZfMjUyNTMzMDM2NzUzOTYwNV8xODU0Mjg4ODQwNzQ0ODIwNDc2X24uanBnP19uY19odD1zY29udGVudC1mcnQzLTIuY2RuaW5zdGFncmFtLmNvbSZpZ19jYWNoZV9rZXk9TVRrek5qSXpOVGd5TXpVd05qazBNVEUxTkElM0QlM0QuMg==
			//   https://scontent-frt3-2.cdninstagram.com/vp/bc4073af5e6f2a634a61282625b09ddf/5D9C6569/t51.2885-15/e35/46182926_2525330367539605_1854288840744820476_n.jpg?_nc_ht=scontent-frt3-2.cdninstagram.com&ig_cache_key=MTkzNjIzNTgyMzUwNjk0MTE1NA%3D%3D.2
			match = src.match(/^[a-z]+:\/\/[^/]*\/+img\/+[^/?]*\?([^-/._]{30,})(?:#.*)?$/);
			if (match) {
				return base64_decode(match[1]);
			}
		}

		if (domain === "acgn-cdn.sunteorum.com") {
			// http://acgn-cdn.sunteorum.com/pixiv-img/2018/57bacfda8dec2df21c42e6d34af2ca3b.jpg_800w.jpg -- upscaled?
			//   http://acgn-cdn.sunteorum.com/pixiv-img/2018/57bacfda8dec2df21c42e6d34af2ca3b.jpg
			return src.replace(/(\.[A-Za-z0-9]+)_[0-9]+[wh]\.[^/.]*(?:[?#].*)?$/, "$1");
		}

		if (domain === "pratilipi.s.llnwi.net" && /\/pratilipi\/+(?:content\/+image|cover)\?/.test(src)) {
			// https://pratilipi.s.llnwi.net/pratilipi/content/image?pratilipiId=6755373519604062&name=26431a9c-70d2-4ff0-a492-508bc92fe6c4&width=720
			//   https://pratilipi.s.llnwi.net/pratilipi/content/image?pratilipiId=6755373519604062&name=26431a9c-70d2-4ff0-a492-508bc92fe6c4
			// https://pratilipi.s.llnwi.net/pratilipi/cover?pratilipiId=6755373519974408&version=aaae2367-de27-4ba9-a6c6-e2123fa615c6&width=620&enforceAspectRatio=false
			//   https://pratilipi.s.llnwi.net/pratilipi/cover?pratilipiId=6755373519974408&version=aaae2367-de27-4ba9-a6c6-e2123fa615c6
			// name and version can't be mixed
			return keep_queries(src, ["pratilipiId", "name", "version"], {required: ["pratilipiId"]});
		}

		if (domain_nowww === "forumhentai.net") {
			// http://forumhentai.net/imagehosting/thum_4442752bed1dcdb952.jpg
			//   http://forumhentai.net/imagehosting/4442752bed1dcdb952.jpg
			return src.replace(/\/imagehosting\/+thum_/, "/imagehosting/");
		}

		if (domain_nowww === "mfqqx.com") {
			// http://www.mfqqx.com/d/file/2015/03/smallc2f1e499db5e2ad389b113cbbb5532df1425434224.jpg
			//   http://www.mfqqx.com/d/file/2015/03/c2f1e499db5e2ad389b113cbbb5532df.jpg
			return src.replace(/(\/d\/+file\/+[0-9]{4}\/+[0-9]{2}\/+)small([0-9a-f]{32})[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2$3");
		}

		if (domain_nowww === "between-legs.com") {
			// http://www.between-legs.com/content/galleries/53/3453/thumbs/002.jpg
			//   http://www.between-legs.com/content/galleries/53/3453/full/002.jpg
			return src.replace(/(\/content\/+galleries\/+[0-9]+\/+[0-9]+\/+)thumbs\/+([0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1full/$2")
		}

		if (domain_nowww === "babeunion.com") {
			// http://www.babeunion.com/gallery/bree-daniels-on-x-art-looking-glamorous/thumbs/bree-daniels-on-x-art-looking-glamorous-001.jpg
			//   http://www.babeunion.com/gallery/bree-daniels-on-x-art-looking-glamorous/bree-daniels-on-x-art-looking-glamorous-001.jpg
			return src.replace(/(\/gallery\/+[^/]*\/+)thumbs\/+/, "$1");
		}

		if (domain_nowww === "bustyparade.com") {
			// http://www.bustyparade.com/thumbs/galls/1687823/2.jpg
			//   http://www.bustyparade.com/galls/1687823/2.jpg
			return src.replace(/\/thumbs\/+galls\//, "/galls/");
		}

		if (domain === "assets.marthastewart.com") {
			// https://assets.marthastewart.com/styles/wmax-1500/d24/cheese-bread-222-d113085/cheese-bread-222-d113085_horiz.jpg?itok=6TbcHXdZ
			//   https://assets.marthastewart.com/d24/cheese-bread-222-d113085/cheese-bread-222-d113085_horiz.jpg?itok=6TbcHXdZ
			return src.replace(/(:\/\/[^/]*\/+)styles\/+[^/]*\/+/, "$1");
		}

		if (domain === "images.plurk.com") {
			// https://images.plurk.com/mx_2e87RAOHZGnf8AxYTECQ6o.jpg
			//   https://images.plurk.com/2e87RAOHZGnf8AxYTECQ6o.jpg
			// thanks to Froktime on github: https://github.com/qsniyg/maxurl/issues/1262
			// https://images.plurk.com/mx_1enwpR3JJbhoAUUpcpKb9Q.jpg
			//   https://images.plurk.com/1enwpR3JJbhoAUUpcpKb9Q.png
			// thanksto Froktime on github: https://github.com/qsniyg/maxurl/issues/1330
			// https://images.plurk.com/mx_3Bf8xiLf27TXtb3xf4g4Dd.jpg
			//   https://images.plurk.com/3Bf8xiLf27TXtb3xf4g4Dd.gif
			newsrc = src.replace(/(^[a-z]+:\/\/[^/]*\/+)mx_([^/.]*\.[^/.]*)(?:[?#].*)?$/, "$1$2");
			if (newsrc !== src)
				return add_full_extensions(newsrc, ["jpg", "png", "jpeg", "gif"]);
		}

		if (domain === "imgs.plurk.com") {
			// https://imgs.plurk.com/Qwz/DVj/SBPzYpEOYaYHuBNedfU3lNdZnlW_tn.jpg
			//   https://imgs.plurk.com/Qwz/DVj/SBPzYpEOYaYHuBNedfU3lNdZnlW_lg.jpg -- 857x1200
			// other:
			// https://imgs.plurk.com/QuZ/6TS/5LaXHO9c9PxWD6ilTpS16UUDocq_lg.jpeg -- 3840x2160
			return src.replace(/(:\/\/[^/]*\/+[^/]{3}\/+[^/]{3}\/+[a-zA-Z0-9]{10,})_tn(\.[^/.]*)(?:[?#].*)?$/, "$1_lg$2");
		}

		if (domain === "avatars.plurk.com") {
			// https://avatars.plurk.com/4959900-small14885049.gif
			//   https://avatars.plurk.com/4959900-medium14885049.gif
			//   https://avatars.plurk.com/4959900-big14885049.jpg
			newsrc = src.replace(/(\/[0-9]+-)(?:medium|small)([0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1big$2");
			if (newsrc !== src)
				return add_full_extensions(newsrc);
		}

		if (domain === "cdnph.upi.com") {
			// https://cdnph.upi.com/topic/ph/9447/upi/5f28f5addc0bbe79fe39ee860993f933/Jennifer_Hudson_0.jpg -- unwatermarked,
			//   https://cdnph.upi.com/pv/upi/5f28f5addc0bbe79fe39ee860993f933/Jennifer_Hudson_0.jpg -- 650x981, watermarked
			// https://cdnph.upi.com/upi/e3fc292c31e799e184a8bc5f29d97d8a/Jennifer-Hudson-attends-Vanity-Fair-Oscar-Party-2019_14.jpg
			//   https://cdnph.upi.com/pv/upi/e3fc292c31e799e184a8bc5f29d97d8a/Jennifer-Hudson-attends-Vanity-Fair-Oscar-Party-2019_14.jpg -- 650x955, watermarked
			// https://cdnph.upi.com/ph/st/th/3361622386903/2021/upi/5129ee1381fb6e80fe1cd5acffc67b4c/v1.5/Quiet-Place-Part-II-tops-the-North-American-box-office-with-484M.jpg?rc=1
			//   https://cdnph.upi.com/ph/upi/5129ee1381fb6e80fe1cd5acffc67b4c/v1.5/Quiet-Place-Part-II-tops-the-North-American-box-office-with-484M.jpg?rc=1 -- 300x208, unwatermarked
			//   https://cdnph.upi.com/pv/upi/5129ee1381fb6e80fe1cd5acffc67b4c/v1.5/Quiet-Place-Part-II-tops-the-North-American-box-office-with-484M.jpg?rc=1 -- 650x452, watermarked
			// https://cdnph.upi.com/svc/sv/upi/4311614804553/2021/1/fc8ddacda34e1904d5257af8378cb31f/Secretary-of-State-Blinken-COVID-19-China-among-top-foreign-policy-concerns.jpg -- 975x651, unwatermarked
			//   https://cdnph.upi.com/sv/upi/4311614804553/2021/1/fc8ddacda34e1904d5257af8378cb31f/Secretary-of-State-Blinken-COVID-19-China-among-top-foreign-policy-concerns.jpg -- 300x199, unwatermarked
			// https://cdnph.upi.com/collection/fp/upi/12653/2cdada616a58b232bcf74725cc6b9e75/This-week-in-Major-League-Baseball_2_1.jpg -- 1000x808
			// seems like 300x* is used for incorrect, same as ://[^/]+/[0-9a-f]+/[^/]+$
			return src.replace(/(:\/\/[^/]*\/+)(?:topic\/+ph\/+[0-9]+\/+upi\/+|ph\/+st\/+th\/+[0-9]+\/+[0-9]{4}\/+upi\/+|upi\/+)/, "$1pv/upi/");
		}

		if (domain_nowww === "glamour.bg") {
			// https://glamour.bg/pictures/pic_small/pi_files/2018/04/17/13/GettyImages-926320646.jpg
			//   https://glamour.bg/pictures/pic_big/pi_files/2018/04/17/13/GettyImages-926320646.jpg
			return src.replace(/\/pictures\/+pic_small\/+/, "/pictures/pic_big/");
		}

		if (domain === "adminhonna.elwatannews.com" ||
			// https://honnaimg.elwatannews.com/image_archive/840x601/1628144221556819907.jpg
			//   https://honnaimg.elwatannews.com/image_archive/original/1628144221556819907.jpg
			domain === "honnaimg.elwatannews.com") {
			// https://adminhonna.elwatannews.com/uploads/image_archive/original_lower_quality/17177940351556819897.jpg
			//   https://adminhonna.elwatannews.com/uploads/image_archive/original/17177940351556819897.jpg
			return src.replace(/\/image_archive\/+(?:original_lower_quality|[0-9]+x[0-9]+)\/+/, "/image_archive/original/");
		}

		if (domain_nowww === "yeswedding.com.br") {
			// http://yeswedding.com.br/ctrl_public/arqs/2019/5/2/842453235_big.jpg
			//   http://yeswedding.com.br/ctrl_public/arqs/2019/5/2/842453235.jpg
			return src.replace(/(\/[0-9]+)_big(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (false && domain_nowww === "whatboyswant.com") {
			// requires visiting the original page, otherwise it'll get redirected to "access is denied to this object"
			// https://whatboyswant.com/picture/babe/2607581/thumb/th_2607581.jpg
			//   https://whatboyswant.com/picture/babe/2607581/full/2607581.jpg
			// https://whatboyswant.com/picture/babe/2607581/norm/9c7a51347d438d548d8e31f27c888bd2/2607581.jpg
			//   https://whatboyswant.com/picture/babe/2607581/full/9c7a51347d438d548d8e31f27c888bd2/2607581.jpg
			return src.replace(/\/(?:thumb\/+th_|(?:norm|tiny)\/+)/, "/full/");
		}

		if (domain_nosub === "adultempire.com" && /^imgs[0-9]*cdn\./.test(domain)) {
			// https://imgs1cdn.adultempire.com/galleries/39/718523038439562339_200.jpg
			//   https://imgs1cdn.adultempire.com/galleries/39/718523038439562339_9999.jpg
			return src.replace(/(\/galleries\/+[0-9]+\/+[0-9]{5,})_[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1_9999$2");
		}

		if (domain_nowww === "mixmag.com.tr") {
			// https://mixmag.com.tr/assets/uploads/images/_facebook/rihanna-june-19-1.jpg -- upscaled+cropped
			//   https://mixmag.com.tr/assets/uploads/images/rihanna-june-19-1.jpg
			return src.replace(/(\/assets\/+uploads\/+images\/+)_facebook\/+/, "$1");
		}

		if (domain_nowww === "harpersbazaar.co.id") {
			// https://www.harpersbazaar.co.id/lkgallery/teaser/resize/335x168/rihanna-concealer-1547802205_22_20190416155147WEO3mY.jpg
			//   https://www.harpersbazaar.co.id/lkgallery/teaser/rihanna-concealer-1547802205_22_20190416155147WEO3mY.jpg
			return src.replace(/(\/lkgallery\/+[^/]*\/+)resize\/+[0-9]+x[0-9]+\/+/, "$1");
		}

		if (domain_nosub === "mobify.com" && /^ir[0-9]*\./.test(domain)) {
			// https://ir0.mobify.com/180/https://i.iplsc.com/rihanna-potwierdza-dziewiata-plyta-w-przygotowaniu-r9/00083PJSNT8LCVHS-C307.jpg
			//   https://i.iplsc.com/rihanna-potwierdza-dziewiata-plyta-w-przygotowaniu-r9/00083PJSNT8LCVHS-C0.jpg
			return src.replace(/^[a-z]+:\/\/[^/]*\/+[0-9]+\/+http/, "http");
		}

		if (domain_nowww === "kanal24.az") {
			// https://kanal24.az/photo.php?w=300&h=200&zc=1&src=/upload//2018-03-16/1418017_s.jpg
			//   https://kanal24.az/upload//2018-03-16/1418017_s.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+photo\.php\?(?:.*&)?src=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return urljoin(src, decodeuri_ifneeded(newsrc), true);
		}

		if (domain_nowww === "aquarelle.md") {
			// https://www.aquarelle.md/uploads/cache/news/80401/600X400/640_103.jpg
			//   https://www.aquarelle.md/uploads/news/80401/640_103.jpg
			return src.replace(/\/uploads\/+cache\/+(news\/+[0-9]+\/+)[0-9]+X[0-9]+\/+/, "/uploads/$1");
		}

		if (domain === "img.meta.kz") {
			// http://img.meta.kz/?250x20014837.jpg
			//   http://img.meta.kz/?20014837.jpg
			return src.replace(/(:\/\/[^/]*\/+\?)[0-9]+x/, "$1");
		}

		if (domain === "img.rtvslo.si") {
			// https://img.rtvslo.si/_up/upload/2019/05/23/65587143_show.jpg
			//   https://img.rtvslo.si/_up/upload/2019/05/23/65587143.jpg
			return src.replace(/(\/upload\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9]+)_[a-z]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "i.stpl.gr") {
			// http://i.stpl.gr/image.ashx?m=Fit&f=L2ZpbGVzLzEvbmV3X2ltYWdlcy8yMDE5LTA1LTI0LzU0LzU2MzU3MzE2LmpwZw%3D%3D&t=636942794840000000&w=300&h=204
			//   atob: /files/1/new_images/2019-05-24/54/56357316.jpg
			//   http://i.stpl.gr/files/1/new_images/2019-05-24/54/56357316.jpg
			match = src.match(/^[a-z]+:\/\/[^/]*\/+image\.ashx\?(?:.*&)?f=([^&]*).*?$/);
			if (match) {
				return urljoin(src, base64_decode(decodeURIComponent(match[1])), true);
			}
		}

		if (domain_nowww === "marecipe.com") {
			// http://marecipe.com/image.ashx?u=https%3A%2F%2Ficmsstandart.blob.core.windows.net%2Ficms%2Fpf%2Fthumb%2Ff7a1dae4faf69ddd1040c045f6ecb75e.jpg
			//   https://icmsstandart.blob.core.windows.net/icms/pf/thumb/f7a1dae4faf69ddd1040c045f6ecb75e.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+image\.ashx\?(?:.*&)?u=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "cdn.akurat.co") {
			// https://cdn.akurat.co/images/uploads/images/medium/akurat_20190523022230_2KW910.jpg
			//   https://cdn.akurat.co/images/uploads/images/akurat_20190523022230_2KW910.jpg
			return src.replace(/(\/images\/+uploads\/+images\/+)[a-z]+\/+([^/]*\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "static.vesti.rs") {
			// http://static.vesti.rs/slike-4/tmb_Od-1-februara-nova-cena-kompleta-za-Nisville-2017.jpg
			//   http://static.vesti.rs/slike-4/Od-1-februara-nova-cena-kompleta-za-Nisville-2017.jpg
			return src.replace(/(\/slike-[0-9]+\/+)tmb_/, "$1");
		}

		if (domain_nowww === "al-mlab.com") {
			// http://al-mlab.com/Thumbnails/1906/933901/500/_107287587_24c84e55-d1af-42dd-ab29-a313b61eb22a.jpg
			//   http://al-mlab.com/ArticleImages/1906/933901/_107287587_24c84e55-d1af-42dd-ab29-a313b61eb22a.jpg
			return src.replace(/\/Thumbnails\/+([0-9]+\/+[0-9]+\/+)[0-9]+\/+([^/]*\.[^/.]*)(?:[?#].*)?$/, "/ArticleImages/$1$2");
		}

		if (domain_nowww === "govastileto.gr") {
			// https://www.govastileto.gr/assets/images/660x/331292.jpg
			//   https://www.govastileto.gr/assets/images/331292.jpg
			return src.replace(/\/assets\/+images\/+[0-9]*x[0-9]*\/+/, "/assets/images/");
		}

		if (amazon_container === "dotemirates-media") {
			// https://dotemirates-media.s3-eu-west-1.amazonaws.com/2019/07/medium-750a61ed9a6b676108ef8d7dbed0b10f.jpg
			//   https://dotemirates-media.s3-eu-west-1.amazonaws.com/2019/07/750a61ed9a6b676108ef8d7dbed0b10f.jpg
			return src.replace(/(\/[0-9]{4}\/+[0-9]{2}\/+)[a-z]+-([0-9a-f]{20,}\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "grazia.rs") {
			// https://www.grazia.rs/uploads/imagecache/400x533//storage/posts/cover/2018/Sep/2181/CTa2FKCIiyzUQvbH4Ir1CQdXIw0TcQyxDCBo0yq6.jpg
			//   https://www.grazia.rs/storage/posts/cover/2018/Sep/2181/CTa2FKCIiyzUQvbH4Ir1CQdXIw0TcQyxDCBo0yq6.jpg
			return src.replace(/\/uploads\/+imagecache\/+[0-9]+x[0-9]+\/+storage\/+/, "/storage/");
		}

		if (domain_nowww === "asian-amatuer.com") {
			// http://www.asian-amatuer.com/wp-content/vms_cache/images/content/jade2/1.220x350.jpg
			//   http://www.asian-amatuer.com/content/jade2/1.jpg
			return src.replace(/\/wp-content\/+vms_cache\/+images\/+(content\/+[^/]*\/+[^/]*)\.[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "/$1$2");
		}

		if (domain_nowww === "xxx69.net") {
			// http://www.xxx69.net/rts/347/tn_180_240_001.jpg
			//   http://www.xxx69.net/rts/347/001.jpg
			return src.replace(/\/tn_[0-9]+_[0-9]+_([^/.]*\.[^/.]*)(?:[?#].*)?$/, "/$1");
		}

		if (domain_nosub === "milffox.com" && /^(?:s[0-9]*|cdn)\./.test(domain)) {
			// https://cdn.milffox.com/milffox/p/1/3/8721/thumb1.jpg
			//   https://cdn.milffox.com/milffox/p/1/3/8721/pic1.jpg
			return src.replace(/\/thumb([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/pic$1");
		}

		if (domain_nowww === "milffox.com") {
			var query_milffox_video = function(vid, cb) {
				api_query("milffox_video:" + vid, {
					url: "https://www.milffox.com/player/config.php?id=" + vid,
					imu_mode: "xhr",
					headers: {
						Referer: "https://www.milffox.com/"
					},
					json: true
				}, cb, function(done, resp, cache_key) {
					var urls = [];

					var video_urls = [resp.video_alt_url, resp.video_url]; // alt = hd, other is sd

					array_foreach(video_urls, function(url) {
						if (!url) return;

						urls.push({
							url: url,
							video: true,
							is_private: true, // linked to ip
							headers: {
								Referer: "https://www.milffox.com/"
							}
						});
					});

					if (resp.preview_url) urls.push(resp.preview_url);

					return done(urls, 6*60*60);
				});
			};

			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+(porn-movies\/+[^/]+)\/*(?:[?#].*)?$/,
				query_for_id: "https://www.milffox.com/${id}/",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/<script[^>]*>get_player\(([0-9]+),/);
					if (!match) {
						console_error(cache_key, "Unable to find player ID match from", resp);
						return done(null, false);
					}

					query_milffox_video(match[1], function(data) {
						if (!data || !data.length) {
							return done(null, false);
						}

						return done(data, 60*60);
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if (host_domain_nowww === "milffox.com" && options.element) {
			newsrc = common_functions["get_pagelink_host_el_matching"](options, {
				url_match: /^[a-z]+:\/\/[^/]+\/+porn-movies\//,
				el_match: function(x) {
					return x.tagName === "DIV" && x.classList.contains("player")
				}
			});
			if (newsrc) return newsrc;
		}

		if ((domain_nosub === "footprint.net" && /^cdni-rt\./.test(domain)) ||
			// thanks to roi for reporting:
			// https://cdnimages.absatz.media/images/2022.10/original/720_63399844b09c601609483a7b.jpeg
			//   https://cdnimages.absatz.media/images/2022.10/original/9999_63399844b09c601609483a7b.jpeg -- 1920x1080
			//   https://cdnimages.absatz.media/images/2022.10/original/63399844b09c601609483a7b.jpeg -- 6000x4000
			domain === "cdnimages.absatz.media" ||
			// https://cdni.rbth.com/rbthmedia/images/2017.10/article/59d77be115e9f921763d0fd0.jpg
			//   https://cdni.rbth.com/rbthmedia/images/2017.10/original/59d77be115e9f921763d0fd0.jpg
			domain === "cdni.rbth.com") {
			// https://cdni-rt.secure2.footprint.net/rbthmedia/images/2017.10/article/59d77be115e9f921763d0fd0.jpg
			//   https://cdni-rt.secure2.footprint.net/rbthmedia/images/2017.10/original/59d77be115e9f921763d0fd0.jpg
			return src.replace(/(\/images\/+[0-9]{4}\.[0-9]{2}\/+)[a-z]+\/+(?:[0-9]+_)?([0-9a-f]{10,}\.)/, "$1original/$2");
		}

		if (domain_nowww === "tapchimypham.com.vn") {
			// http://www.tapchimypham.com.vn/ImageHandler.ashx?ThumbnailID=617504&Width=600
			//   http://www.tapchimypham.com.vn/ImageHandler.ashx?ThumbnailID=617504
			//   http://www.tapchimypham.com.vn/Cache/504/617504_2147483647.jpg
			return src.replace(/^([a-z]+:\/\/[^/]*\/+ImageHandler\.ashx\?)(?:.*?&)?(ThumbnailID=[0-9]+).*$/, "$1$2");
		}

		if (domain === "cdn.lipscosme.com") {
			// https://cdn.lipscosme.com/user/user1539003038-32189-small.png
			//   https://cdn.lipscosme.com/user/user1539003038-32189-thumb.png
			//   https://cdn.lipscosme.com/user/user1539003038-32189.png
			return src.replace(/(\/user\/+user[0-9]+-[0-9]+)-(?:small|thumb)(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nosub === "yesky.com" && /^[a-z]-pic-image\./.test(domain)) {
			// http://d-pic-image.yesky.com/480x-/uploadImages/2017/207/21/2R81A5H1NR13.jpg
			//   http://pic-image.yesky.com/uploadImages/2017/207/21/2R81A5H1NR13.jpg
			return src.replace(/^([a-z]+:\/\/)[^/]*\/[-0-9]+x[-0-9]+\/+uploadImages\/+/, "$1pic-image.yesky.com/uploadImages/");
		}

		if (domain === "img.gifmagazine.net") {
			// https://img.gifmagazine.net/gifmagazine/images/630393/180half_f.gif
			//   https://img.gifmagazine.net/gifmagazine/images/630393/original.gif -- mp4 works too
			return src.replace(/(\/images\/+[0-9]+\/+)[^/]*(\.gif)(?:[?#].*)?$/, "$1original$2");
		}

		if (domain === "mediaprocessor.websimages.com") {
			// https://mediaprocessor.websimages.com/width/416/crop/114,82,190x139/debmwaveart.webs.com/logowork-FINAL-OUTLINES%20(1).jpg
			//   https://mediaprocessor.websimages.com/debmwaveart.webs.com/logowork-FINAL-OUTLINES%20(1).jpg
			//   https://debmwaveart.webs.com/logowork-FINAL-OUTLINES%20(1).jpg -- also works
			return src.replace(/^([a-z]+:\/\/[^/]*\/+)(?:(?:width|height|crop)\/+[^/]*\/+){0,}([^/]*\.[^/]*\/+)/, "$1$2");
		}

		if (domain_nowww === "axtar.org") {
			// https://axtar.org/thumb.php?t=y&src=aHR0cHM6Ly9lbmNyeXB0ZWQtdGJuMC5nc3RhdGljLmNvbS9pbWFnZXM/cT10Ym46QU5kOUdjVG9uemdiRVBGay03aXZQbHFFZ093bkR4NVYzWGhFSWZIV3diVEdqZ0tWRjJHXzRWcEN2QQ==&w=205&h=205&q=75
			//   https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTonzgbEPFk-7ivPlqEgOwnDx5V3XhEIfHWwbTGjgKVF2G_4VpCvA
			// other:
			// https://axtar.org/thumb.php?t=v&src=VDj9Fm_g7F0rkM&w=350&h=&q=75
			match = src.match(/^[a-z]+:\/\/[^/]+\/+thumb\.php\?(?:.*&)?src=([^&]{50,}).*?$/, "$1");
			if (match) {
				var splitted = match[1].split("/");
				newsrc = base64_decode(splitted[0]);
				if (splitted[1]) {
					newsrc += "?" + base64_decode(splitted[1]);
				}

				return newsrc;
			}
		}

		if (domain_nosub === "popo8.com") {
			// https://www.popo8.com/host/data/cimages/2019/04/11/c_pic_155492370454991.jpg_b.jpg -- upscaled
			//   https://www.popo8.com/host/data/cimages/2019/04/11/c_pic_155492370454991.jpg
			// https://web.popo8.com/201809/14/0/1fac9342e0.jpg_b.jpg -- upscaled
			//   https://web.popo8.com/201809/14/0/1fac9342e0.jpg
			// https://www.popo8.com/host/data/201909/23/4/p1569223164_62432.jpg_b.jpg
			//   https://www.popo8.com/host/data/201909/23/4/p1569223164_62432.jpg
			return src
				.replace(/(\/data\/+cimages\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}c_pic_[0-9]{8,}\.[^/._]*)_[a-z]\.[^/.]*(?:[?#].*)?$/, "$1")
				.replace(/(\/[0-9]{6}\/+[0-9]{2}\/+[0-9a-f]\/+(?:[0-9a-f]+|p[0-9]+_[0-9]+)\.[^/._]+)_[a-z]\.[^/.]*(?:[?#].*)?$/, "$1");
		}

		if (domain_nowww === "navicdn.com") {
			// https://navicdn.com/nhacpro/149x84/images/2018/12/31/havana-camila-cabello-ft-young-thug-official-mv.jpg
			//   https://navicdn.com/nhacpro/images/2018/12/31/havana-camila-cabello-ft-young-thug-official-mv.jpg
			return src.replace(/\/nhacpro\/+[0-9]+x[0-9]+\/+images\/+/, "/nhacpro/images/");
		}

		if (domain_nowww === "needradio.fr") {
			// https://www.needradio.fr/upload/videos/mini/15c6290d350096.jpg -- upscaled?
			//   https://www.needradio.fr/upload/videos/original/15c6290d350096.jpg
			return src.replace(/(\/upload\/+videos\/+)[a-z]+\/+/, "$1original/");
		}

		if (domain === "assets.rebelmouse.io") {
			// https://assets.rebelmouse.io/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpbWFnZSI6Imh0dHBzOi8vYXNzZXRzLnJibC5tcy8xOTIwODY2MC8xMDYweDU1NS5qcGciLCJleHBpcmVzX2F0IjoxNTY2OTkxNzc1fQ.6Bq_MHak61nryEBaE6YRw4b789ZFu-4vSpY8HKRG5zE/img.jpg?width=1060&height=555
			//   atob: {"image":"https://assets.rbl.ms/19208660/1060x555.jpg","expires_at":1566991775}
			//   https://assets.rbl.ms/19208660/origin.jpg
			match = src.match(/^[a-z]+:\/\/[^/]*\/+[^-_/.]{20,}\.([^-_/.]{30,})\./);
			if (match) {
				var json = JSON_parse(base64_decode(match[1]));
				return json.image;
			}
		}

		if (domain_nowww === "issuedaily.com" ||
			// http://img.issuedaily.com/2017/thumb_image/new_main_water201710271509564056.jpg
			//   http://img.issuedaily.com/2017/thumb_image/main_water201710271509564056.jpg
			//   http://img.issuedaily.com/2017/thumb_image/thumb_water201710271509564056.jpg
			//   http://img.issuedaily.com/2017/news_image/water201710271509564056.jpg
			//   http://img.issuedaily.com/2017/news_image/201710271509564056.jpg -- doesn't work
			domain === "img.issuedaily.com") {
			// http://www.issuedaily.com/thumb_image/thumb_bl90k201207251745082217.jpg
			//   http://www.issuedaily.com/news_image/bl90k201207251745082217.jpg
			// other:
			// http://img.issuedaily.com/2016/news_gif_image/water201601211936196382.jpg
			return src.replace(/\/thumb_image\/+(?:(?:new_)?main|thumb)_/, "/news_image/");
		}

		if (false && domain_nowww === "frontiertimes.co.kr") {
			// doesn't work, different ID
			// http://www.frontiertimes.co.kr/upload/thumbnail/2018/01/style_20180116092727_8970.jpg
			//   http://www.frontiertimes.co.kr/upload/image/2018/01/20180116092436.jpg
			return src.replace(/\/upload\/+thumbnail\/+([0-9]{4}\/+[0-9]{2}\/+)[a-z]+_([0-9]{8,})_[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "/upload/image/$1$2$3");
		}

		if (domain_nowww === "newsshare.co.kr") {
			// http://www.newsshare.co.kr/data/newsshare_co_kr/mainimages/201906/170924_2019060608469772.jpg
			//   http://www.newsshare.co.kr/imgdata/newsshare_co_kr/201906/2019060608469772.jpg
			return src.replace(/\/data\/+([^/]+)\/+mainimages\/+([0-9]{6})\/+[0-9]{6}_/, "/imgdata/$1/$2/");
		}

		if (domain_nowww === "dosugbook.nl") {
			// https://dosugbook.nl/upfiles/photos/persons/2512/thumbs250/04.jpg
			//   https://dosugbook.nl/upfiles/photos/persons/2512/04.jpg
			return src.replace(/(\/upfiles\/+photos\/+persons\/+[0-9]+\/+)thumbs[0-9]+\/+/, "$1");
		}

		if (domain_nowww === "sexbahrain.club") {
			// https://sexbahrain.club/photos/600_0/callgirl_217_584556c930585_r.jpg -- upscaled, no watermark
			//   https://sexbahrain.club/photos/callgirl_217_584556c930585_r.jpg -- watermark
			// https://sexbahrain.club/photos/callgirl_146176_5a55b1728b5e4_r.jpg -- 1201x800
			return {
				url: src.replace(/\/photos\/+[0-9]+_[0-9]+\/+/, "/photos/"),
				problems: {
					watermark: true
				}
			};
		}

		if (domain === "img.vphotos.cn") {
			// https://img.vphotos.cn/download/460A0A8A81E07B7385EDAFABFDF5F1F4/postp/logosmall/vbox4180_IMG_9411_171919_small_v1.JPG
			//   https://img.vphotos.cn/460A0A8A81E07B7385EDAFABFDF5F1F4/postp/logosmall/vbox4180_IMG_9411_171919_small_v1.JPG
			newsrc = src.replace(/(:\/\/[^/]*\/+)download\/+([0-9A-F]{20,}\/+)/, "$1$2");
			if (newsrc !== src)
				return newsrc;

			// https://img.vphotos.cn/5529E4AD285919FB1E40ED935D000C28/postp/logolarge/vbox4017_1W0A0074_102800_small.JPG
			//   https://img.vphotos.cn/5529E4AD285919FB1E40ED935D000C28/postp/large/vbox4017_1W0A0074_102800_small.JPG
			// http://img.vphotos.cn/961D4CED4CA395B0C0D0407B4ADDF938/postp/logodouble/vbox4017__G5I5014_164919_small.JPG
			//   http://img.vphotos.cn/961D4CED4CA395B0C0D0407B4ADDF938/postp/double/vbox4017__G5I5014_164919_small.JPG
			// https://img.vphotos.cn/download/460A0A8A81E07B7385EDAFABFDF5F1F4/postp/logosmall/vbox4180_IMG_9411_171919_small_v1.JPG
			//   https://img.vphotos.cn/460A0A8A81E07B7385EDAFABFDF5F1F4/postp/small/vbox4180_IMG_9411_171919_small_v1.JPG
			// https://img.vphotos.cn/460A0A8A81E07B7385EDAFABFDF5F1F4/postp/logothumb/vbox4018_Y95B8146_170445_small.JPG
			//   https://img.vphotos.cn/460A0A8A81E07B7385EDAFABFDF5F1F4/postp/thumb/vbox4018_Y95B8146_170445_small.JPG
			newsrc = src.replace(/\/(postp|selected)\/+logo(large|double|small|1920|thumb)\/+/, "/$1/$2/");
			if (newsrc !== src)
				return newsrc;

			// thanks to @rEnr3n on github (https://github.com/qsniyg/maxurl/issues/112)
			// https://gallery.vphotos.cn/vphotosgallery/index.html?vphotowechatid=F4295EFD2FCAA1C66600D8C34D8AFEA7
			// https://img.vphotos.cn/79EC756DCFC5B72D354DC93D86D7B409/postp/thumbs/vbox3584_BS8A1492_184055_thumb.JPG
			//   https://img.vphotos.cn/79EC756DCFC5B72D354DC93D86D7B409/postp/logo1920/vbox3584_BS8A1492_184055_small.JPG -- watermark
			//   https://img.vphotos.cn/79EC756DCFC5B72D354DC93D86D7B409/postp/1920/vbox3584_BS8A1492_184055_small.JPG
			newsrc = src.replace(/\/(postp|selected)\/+thumbs\/+([^/]*)_thumb(\.[^/.]+)(?:[?#].*)?$/, "/$1/1920/$2_small$3");
			if (newsrc !== src)
				return newsrc;

			newsrc = src.replace(/\/(postp|selected)\/+(?:logo)?(?:large|double|small|1920|thumb)\/+/, "/$1/large/");
			if (newsrc !== src)
				return newsrc;

			// https://img.vphotos.cn/431F2F3E3C1ACA509AD1E1C7FD9F9164/selected/large/vbox7177__P0A1429_142922_small.JPG -- desaturated
			//   https://img.vphotos.cn/431F2F3E3C1ACA509AD1E1C7FD9F9164/postp/large/vbox7177__P0A1429_142922_small.JPG
			newsrc = src.replace(/(\/[0-9A-F]{20,}\/+)selected\/+/, "$1postp/");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nowww === "pauza.sk") {
			// http://www.pauza.sk/web_object/18202_s.jpg
			//   http://www.pauza.sk/web_object/18202_b.jpg
			return src.replace(/(\/web_object\/+[0-9]+)_[a-z](\.[^/.]*)(?:[?#].*)?$/, "$1_b$2");
		}

		if (domain === "d26672rfe314dk.cloudfront.net") {
			// https://d26672rfe314dk.cloudfront.net/73192/400/Margot-Robbie-H-Pie.jpeg
			//   https://d26672rfe314dk.cloudfront.net/73192/Margot-Robbie-H-Pie.jpeg
			return src.replace(/(:\/\/[^/]*\/+[0-9]+\/+)[0-9]+\/+([^/]*\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "roleplayhaven.net") {
			// http://www.roleplayhaven.net/gallery/thumb_1172416097490998.jpg
			//   http://www.roleplayhaven.net/gallery/1172416097490998.jpg
			return src.replace(/\/gallery\/+thumb_([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/gallery/$1");
		}

		if (domain === "images.ladbible.com") {
			// https://images.ladbible.com/thumbnail?type=jpeg&url=http://beta.ems.ladbiblegroup.com/s3/content/349dd1e35a56f90a693f029f8ffaa718.png&quality=70&width=648
			//   http://beta.ems.ladbiblegroup.com/s3/content/349dd1e35a56f90a693f029f8ffaa718.png
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+thumbnail\?(?:.*&)?url=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "file.starnnews.com") {
			// http://file.starnnews.com/news/fnstar/2019/0819/20190819232629_5d5ab195bc932_10.jpg
			//   http://file.starnnews.com/news/fnstar/2019/0819/20190819232629_5d5ab195bc932_1.jpg
			// http://file.starnnews.com/news/fnstar/2013/0619/20130619163423_51c15eff5d6b4_1.jpg -- 580x870, watermark
			//   http://file.starnnews.com/news/fnstar/2013/0619/20130619163423_51c15eff5d6b4_2.jpg -- 1200x1800, no watermark
			//   http://file.starnnews.com/news/fnstar/2013/0619/20130619163423_51c15eff5d6b4_10.jpg -- doesn't work
			// http://file.starnnews.com/news/fnstar/2019/0710/20190710181850_5d25ad79a1a57_2.jpg
			regex = /(\/[0-9]{8,}_[0-9a-f]+_)(?:10|1)(\.[^/.]*)(?:[?#].*)?$/;
			if (regex.test(src))
				return [
					src.replace(regex, "$12$2"),
					src.replace(regex, "$11$2")
				];
		}

		if (domain_nowww === "starjn.com") {
			// http://www.starjn.com/data/starjn_com/mainimages/201908/2019082638243858.jpg
			//   http://www.starjn.com/imgdata/starjn_com/201908/2019082638243858.jpg
			// doesn't work for all:
			// http://www.starjn.com/data/starjn_com/mainimages/201812/2018122025157897.jpg
			// http://www.starjn.com/data/starjn_com/mainimages/201908/2019082246537169.jpg
			//   http://www.starjn.com/imgdata/starjn_com/201908/2019082243424249.jpg
			// other:
			// http://www.starjn.com/data/starjn_com/facebook/83172_2016110547552954.jpg -- all "facebook" links are dead
			//   http://www.starjn.com/data/starjn_com/mainimages/201611/2016110547552954.jpg?wdate=1566871068 -- works
			//   http://www.starjn.com/imgdata/starjn_com/201611/2016110547151247.jpg -- works
			newsrc = src.replace(/\/data\/+starjn_com\/+facebook\/+[0-9]+_([0-9]{6})([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/data/starjn_com/mainimages/$1/$1$2");
			if (newsrc !== src)
				return newsrc;

			return src.replace(/\/data\/+starjn_com\/+mainimages\/+/, "/imgdata/starjn_com/");
		}

		if (domain === "ipx.image-gmkt.com") {
			// https://ipx.image-gmkt.com/imageproxy/?src=http%3A%2F%2Fi.011st.com%2FeditorImg%2F2019%2F05%2F03%2F53024025%2F2019050310530332871.jpg&scw=-1&remake=Y
			//   http://i.011st.com/editorImg/2019/05/03/53024025/2019050310530332871.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+imageproxy\/+\?(?:.*&)?src=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "i.011st.com") {
			// http://i.011st.com/ex_t/R/156x156/1/85/1/src/pd/19/8/2/9/3/5/7/qEgda/2521829357_B.jpg
			//   http://i.011st.com/ex_t/R/0x0/0/100/0/src/pd/19/8/2/9/3/5/7/qEgda/2521829357_B.jpg
			return src.replace(/\/ex_t\/+R\/+[0-9]+x[0-9]+\/+[0-9]+\/+[0-9]+\/+[0-9]+\/+src\/+/, "/ex_t/R/0x0/0/100/0/src/");
		}

		if (domain === "cdn.mydaily.co.kr") {
			// http://www.mydaily.co.kr/new_yk/html/read.php?newsid=201908271330779882
			//   http://cdn.mydaily.co.kr/FILES/201908/201908271330779882_1.jpg
			match = src.match(/\/FILES\/+[0-9]{6}\/+([0-9]+)_[0-9]+\.[^/.]*(?:[?#].*)?$/);

			var extra = {};
			if (match) {
				extra.page = "http://www.mydaily.co.kr/new_yk/html/read.php?newsid=" + match[1];
			}

			return {
				url: src,
				extra: extra
			};
		}

		if (domain_nosub === "iqiyipic.com") {
			// http://u8.iqiyipic.com/legopi/20160708/23/9d/legopi_577fa19714d4556dbddb239d_400_x.jpg
			//   http://u8.iqiyipic.com/legopi/20160708/23/9d/legopi_577fa19714d4556dbddb239d_xxx.jpg
			return src.replace(/(\/legopi_[0-9a-f]{20,}_)[0-9]+_x(\.[^/.]*)(?:[?#].*)?$/, "$1xxx$2");
		}

		if (domain_nowww === "stevens-media.com" ||
			// http://www.stecamsrl.it/page_id.php?getimage=aHR0cHM6Ly91cGxvYWQud2lraW1lZGlhLm9yZy93aWtpcGVkaWEvY29tbW9ucy90aHVtYi9iL2I1L0FkJUMzJUE4bGVfRXhhcmNob3BvdWxvc19DYW5uZXNfMjAxNC5qcGcvMjUwcHgtQWQlQzMlQThsZV9FeGFyY2hvcG91bG9zX0Nhbm5lc18yMDE0LmpwZw==
			//   https://upload.wikimedia.org/wikipedia/commons/b/b5/Ad%C3%A8le_Exarchopoulos_Cannes_2014.jpg
			domain_nowww === "stecamsrl.it") {
			// http://stevens-media.com/wp-content/wverrors.php?getimage=aHR0cDovL3RoZWZhcHBlbmluZzIwMTUuY29tL3dwLWNvbnRlbnQvdXBsb2Fkcy8yMDE3LzEyL0tyaXN0ZW4tSGFuY2hlcl90aGVmYXBwZW5pbmcyMDE1X2NvbS01LmpwZw==
			//   http://thefappening2015.com/wp-content/uploads/2017/12/Kristen-Hancher_thefappening2015_com-5.jpg
			match = src.match(/\/(?:wp-content\/+wverrors\.php|page_id\.php)\?(?:.*&)?getimage=([^&]*).*?$/);
			if (match) {
				return base64_decode(match[1]);
			}
		}

		if (domain_nosub === "famtimes.co.kr" && /^img[0-9]*\./.test(domain)) {
			// http://img.famtimes.co.kr/resources/2019/08/30/s_OVi1dEIxgaQAkUSq.jpg
			//   http://img.famtimes.co.kr/resources/2019/08/30/OVi1dEIxgaQAkUSq.jpg
			// other:
			// https://img1.famtimes.co.kr/public/img/20181206/m/909fe9f9c141d851114baba78069b248.jpg -- /m/ is used for thumbnails, /l/ for images, no difference (/asdf/ works too)
			return src.replace(/(\/resources\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2})[sl]_([^/]*\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (false && domain === "image.sportsseoul.com") {
			// wip
			// http://image.sportsseoul.com/2019/06/20/news/20190620090902_ma.jpg -- 2362x2953
			// http://www.sportsseoul.com/news/read/762497
			//   http://image.sportsseoul.com/2019/05/14/news/20190514080743_04.jpg -- 2130x3149
			// http://image.sportsseoul.com/2019/07/15/news/20190715153127_b2.jpg -- 1167x1750
			// http://www.sportsseoul.com/news/read/812656
			//   http://image.sportsseoul.com/2019/08/31/edit/20190831091040_1-5.jpg
			//   http://image.sportsseoul.com/2019/08/31/news/20190831085925_1-2.jpg
		}

		if (domain === "file.sportsseoul.com") {
			// thanks to xyliaa on discord:
			// https://file.sportsseoul.com/news/cms/2023/04/10/news-p.v1.20230410.02b88f7dcf134398b961d2e92b7a5adb_T1.jpg
			//   https://file.sportsseoul.com/news/cms/2023/04/10/news-p.v1.20230410.02b88f7dcf134398b961d2e92b7a5adb.jpg -- 2868x5232
			return src.replace(/(\/cms\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[^/]+)_[A-Z][0-9](\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "hosted.foxes.com" ||
			// http://hosted.dreamdolls.com/0-sites/DREAMDOLLS/fhgs/FM2RH9A8LN/t/Lola_01.jpg
			//   http://hosted.dreamdolls.com/0-sites/DREAMDOLLS/fhgs/FM2RH9A8LN/o/Lola_01.jpg
			domain === "hosted.dreamdolls.com" ||
			// http://promo.foxes.com/0-testdata/fhg/Ashley-Payton_-_Big-Breasts-Piano-Lesson-Naked/t_188x282/Ashley-Payton_01.jpg
			//   http://promo.foxes.com/0-testdata/fhg/Ashley-Payton_-_Big-Breasts-Piano-Lesson-Naked/o/Ashley-Payton_01.jpg
			domain === "promo.foxes.com") {
			// http://hosted.foxes.com/0-sites/FOXES/fhgs/FYMXQKZUO1/t/Noel-Monique_01.jpg
			//   http://hosted.foxes.com/0-sites/FOXES/fhgs/FYMXQKZUO1/o/Noel-Monique_01.jpg
			return src.replace(/(\/fhgs?\/+[^/]*\/+)t(?:_[0-9]+x[0-9]+)?\/+/, "$1o/");
		}

		if ((domain_nosub === "justjared.com" ||
			 // http://cdn01.cdn.justjaredjr.com/wp-content/uploads/2020/10/candice-victoria/thumbs/candice-patton-back-on-the-flash-set-filming-with-victoria-park-16.jpg
			 //   http://cdn01.cdn.justjaredjr.com/wp-content/uploads/2020/10/candice-victoria/candice-patton-back-on-the-flash-set-filming-with-victoria-park-16.jpg
			 domain_nosub === "justjaredjr.com") && /^cdn[0-9]*\.cdn\./.test(domain)) {
			// http://cdn02.cdn.justjared.com/wp-content/uploads/2019/08/palvin-vffsebergpremiere/thumbs/barbara-palvin-sara-sampaio-annabelle-wallis-slay-at-seberg-venice-premiere-01.jpg
			//   http://cdn02.cdn.justjared.com/wp-content/uploads/2019/08/palvin-vffsebergpremiere/barbara-palvin-sara-sampaio-annabelle-wallis-slay-at-seberg-venice-premiere-01.jpg
			return src.replace(/(\/wp-content\/+uploads\/+[0-9]{4}\/+[0-9]{2}\/+[^/]*\/+)thumbs\/+/, "$1");
		}

		if (domain_nosub === "thesupermodelsgallery.com" && /^cdn[0-9]*\./.test(domain)) {
			// http://cdn1.thesupermodelsgallery.com/2012/12/Barbara-Palvin/tn_Barbara_Palvin_1.jpg
			//   http://cdn1.thesupermodelsgallery.com/2012/12/Barbara-Palvin/Barbara_Palvin_1.jpg
			return src.replace(/(\/[0-9]{4}\/+[0-9]{2}\/+[^/]*\/+)tn_([^/]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "celebritymoviezone.com") {
			// http://www.celebritymoviezone.com/porn/barbara-palvin-0702/thumbs/barbara-palvin-0702-11.jpg
			//   http://www.celebritymoviezone.com/porn/barbara-palvin-0702/barbara-palvin-0702-11.jpg
			return src.replace(/\/thumbs\/+([^/]*\.[^/.]*)(?:[?#].*)?$/, "/$1");
		}

		if (domain_nowww === "supermodels-online.com") {
			// http://supermodels-online.com/models/barbara-palvin/photos/loreal/sublime-sm.jpg
			//   http://supermodels-online.com/models/barbara-palvin/photos/loreal/sublime.jpg -- adds border
			return src.replace(/(\/photos\/+[^/]*\/+[^/]*)-sm(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "hentai-foundry.com") {
			newsrc = website_query({
				website_regex: [
					/^[a-z]+:\/\/[^/]+\/+pictures\/+([0-9]+)\/*(?:[?#].*)?$/,
					/^[a-z]+:\/\/[^/]+\/+pictures\/+user\/+[^/]+\/+([0-9]+)(?:\/+[^/]*)?(?:[?#].*)?$/
				],
				query_for_id: "https://www.hentai-foundry.com/pictures/${id}/?enterAgree=1",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/<img[^>]*src=["']((?:https?:)?\/\/pictures\.hentai-foundry\.com\/[^'"]+).*?\/>/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					var tagdef = parse_tag_def(match[0]);

					var obj = {
						url: urljoin(src, tagdef.args.src, true),
						extra: {
							page: resp.finalUrl,
							caption: tagdef.args.alt // todo: remove "by ...", and move that to author instead?
						}
					};

					return done(obj, 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "thumbs.hentai-foundry.com") {
			// https://thumbs.hentai-foundry.com/thumb.php?pid=734467&size=350
			//   https://pictures.hentai-foundry.com/e/Emarine/734467/Emarine-734467-Kitty-Meow.jpg
			match = src.match(/^[a-z]+:\/\/[^/]*\/+thumb\.php\?(?:.*&)?pid=([0-9]+)/);
			if (match) {
				return {
					url: "https://www.hentai-foundry.com/pictures/" + match[1] + "/",
					is_pagelink: true
				};
			}
		}

		// cs-cart.com
		// list of websites can be found here: https://www.cs-cart.com/clients
		if (domain_nowww === "boutiquefonts.com" ||
			// thanks to nimbuz on discord:
			// https://www.elineupmall.com/c671/bd-moritaka-chisato-live2020-senko
			// https://cdn.elineupmall.com/images/thumbnails/280/280/detailed/144/cbc4cd312ae4b70b4b2b7e1089545e29.jpg
			//   https://cdn.elineupmall.com/images/detailed/144/cbc4cd312ae4b70b4b2b7e1089545e29.jpg
			// https://www.elineupmall.com/c182/c1872/morning-musume21-spring-a5e-pk57dih2/
			// https://cdn.elineupmall.com/images/thumbnails/280/280/detailed/144/be9fcc5f93944b100b2e76a7e4927df3.jpg
			//   https://cdn.elineupmall.com/images/detailed/144/be9fcc5f93944b100b2e76a7e4927df3.jpg
			// https://www.elineupmall.com/c671/c181/c197/c199/20-ver./
			// https://cdn.elineupmall.com/images/thumbnails/280/280/detailed/121/d947b67e8915c6fc4563499b6ee86909.jpg
			//   https://cdn.elineupmall.com/images/detailed/121/d947b67e8915c6fc4563499b6ee86909.jpg
			domain === "cdn.elineupmall.com" ||
			// https://cdn.nguyenkimmall.com/images/thumbnails/100/100/detailed/718/10048785-may-lanh-hitachi-1-5-hp-ras-ej13ckv-1.jpg
			//   https://cdn.nguyenkimmall.com/images/detailed/718/10048785-may-lanh-hitachi-1-5-hp-ras-ej13ckv-1.jpg
			domain === "cdn.nguyenkimmall.com" ||
			// https://www.maxbhi.com/images/thumbnails/150/150/detailed/4922/n95_mask_by_maxbhi.jpg
			//   https://www.maxbhi.com/images/detailed/4922/n95_mask_by_maxbhi.jpg
			domain_nowww === "maxbhi.com" ||
			// https://sklep.swiatkwiatow.pl/images/thumbnails/230/230/detailed/57/rzodkiewka-krakowianka_9i79-yn.jpg
			domain === "sklep.swiatkwiatow.pl" ||
			// https://www.houseofcb.com/faye-pistachio-satin-corset-midi-dress.html
			// https://d166chel5lrjm5.cloudfront.net/images/thumbnails/77/640/960/sb7014a-3a.jpg
			//   https://d166chel5lrjm5.cloudfront.net/images/detailed/77/sb7014a-3a.jpg
			domain === "d166chel5lrjm5.cloudfront.net" ||
			// https://www.animuk.co.uk/images/thumbnails/280/480/detailed/2/vocaloidhatsunemikucosplaytanktop.jpg?t=1445304178
			//   https://www.animuk.co.uk/images/detailed/2/vocaloidhatsunemikucosplaytanktop.jpg?t=1445304178
			domain_nowww === "animuk.co.uk" ||
			/\/images\/+thumbnails\/+[0-9]+\/+[0-9]+\/+detailed\/+[0-9]+\/+[^/]+\.[^/.]+(?:[?#].*)?$/.test(src)) {
			// https://cdn.nguyenkimmall.com/design/themes/responsive/media/images/lazy_img.jpg
			if (/\/design\/+themes\/+responsive\/+media\/+images\/+lazy_img\./.test(src))
				return {
					url: src,
					bad: "mask"
				};

			// https://boutiquefonts.com/images/thumbnails/170/170/detailed/2/Dance_Stars.PNG
			//   https://boutiquefonts.com/images/detailed/2/Dance_Stars.PNG
			return src
				.replace(/\/images\/+thumbnails\/+[0-9]+\/+[0-9]+\/+detailed\/+/, "/images/detailed/")
				.replace(/\/images\/+thumbnails\/+([0-9]+)\/+[0-9]+\/+[0-9]+\/+([^/]+)(?:[?#].*)?$/, "/images/detailed/$1/$2");
		}

		if (domain === "cdn.shopclues.com") {
			// https://cdn.shopclues.com/images1/thumbnails/95396/280/1/142857728-95396351-1544776684.jpg
			//   https://cdn.shopclues.com/images1/detailed/95396/142857728-95396351-1544776684.jpg
			// https://cdn.shopclues.com/images1/thumbnails/108468/320/1/150327886-108468489-1594816496.jpg
			//   https://cdn.shopclues.com/images1/detailed/108468/150327886-108468489-1594816496.jpg
			// doesn't work for all:
			// https://cdn.shopclues.com/images/thumbnails/81978/320/1/126511497FST20113420NAVY20BLUE11504243320.jpg
			// not part of the rule above because they seem to host images on different servers:
			// /images/ = nginx/1.10.3
			// images1,5 = nginx/1.8.1
			// images2,3,4,6,8 = nginx/1.0.15
			// images7,9 = nginx/0.8.55
			// thanks to anonymous:
			// https://cdn.shopclues.com/images/thumbnails/85429/320/320/12910342371506550143.jpg
			//   https://cdn.shopclues.com/images/detailed/85429/129103423_7_1506550143.jpg
			return src
				.replace(/(\/images\/+)thumbnails\/+([0-9]+\/+)[0-9]+\/+[0-9]+\/+([0-9]+)([0-9])([0-9]{10})\./, "$1detailed/$2$3_$4_$5.")
				.replace(/\/images([0-9]*)\/+thumbnails\/+([0-9]+)\/+[0-9]+\/+[0-9]+\/+([^/]+)(?:[?#].*)?$/, "/images$1/detailed/$2/$3");
		}

		if (domain_nosub === "userapi.com") {
			// https://sun6-14.userapi.com/impg/c200620/v200620345/27c83/89QyoQ7VCt8.jpg?size=200x0&quality=90&sign=e60754261191285d162c2466eddcc1a8
			//   https://sun6-14.userapi.com/c200620/v200620345/27c83/89QyoQ7VCt8.jpg
			newsrc = src.replace(/(:\/\/[^/]+\/+)imp[gf]\/+(.*?)(?:[?#].*)?$/, "$1$2");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nowww === "vk.com") {
			// https://vk.com/images/icons/video_play_small.png?1
			// https://vk.com/images/album_top_shadow.png
			if (/^[a-z]+:\/\/[^/]+\/+images\/+(?:icons\/+)?[a-z_]+\.png(?:[?#].*)?$/.test(src))
				return {
					url: src,
					bad: "mask"
				};
		}

		if (domain_nowww === "vk.com") {
			var vk_request_video = function(id, list, cb) {
				// payload[1][4].player.params[0].url720|hls(raw)?
				var cache_key = "vk_video:" + id;
				api_cache.fetch(cache_key, cb, function(done) {
					var listkey = "";
					if (list) {
						//listkey = "&list=" + list;
						listkey = "&playlist_id=" + list;
					} else {
						listkey = "&playlist_id=" + id.replace(/_[0-9]+$/, "_-2");
					}

					options.do_request({
						method: "POST",
						url: "https://vk.com/al_video.php?act=show",
						data: "act=show&al=1&module=direct" + listkey + "&video=" + id,
						imu_mode: "xhr",
						headers: {
							"Content-Type": "application/x-www-form-urlencoded",
							"X-Requested-With": "XMLHttpRequest",
							"Referer": "https://vk.com/",
							"Origin": "https://vk.com"
						},
						onload: function(result) {
							if (result.readyState !== 4)
								return;

							try {
								var json = JSON_parse(result.responseText);

								var params = json.payload[1][4].player;
								return done(params, 3*60*60);
							} catch (e) {
								console_error("vk_video", e, result);
							}

							return done(null, false);
						}
					});
				});
			};

			var vk_process_video = function(player) {
				// https://vk.com/video-19043_456244315 -- youtube video
				// https://vk.com/video-19043_456244349 -- non-youtube video
				var params = player.params[0];

				if (player.type === "youtube") {
					if (params.extra_data) {
						return "https://i.ytimg.com/vi/" + params.extra_data + "/mqdefault.jpg";
					}
				}

				var urls = [];

				if (params.hls_raw) {
					var hlsurl = "data:application/vnd.apple.mpegurl," + encodeURIComponent(params.hls_raw);
					urls.push({
						url: hlsurl,
						video: "hls"
					});
				}

				var maxsize = 0;
				for (var key in params) {
					var match = key.match(/^url([0-9]+)$/);
					if (match) {
						var size = parseInt(match[1]);
						if (size > maxsize)
							maxsize = size;
					}
				}

				if (maxsize !== 0) {
					urls.push({
						url: params["url" + maxsize],
						video: true
					});
				}

				if (urls.length >= 0) return urls;

				console_log("Unable to find video for", deepcopy(params));
				return null;
			};

			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+video(-?[0-9]+_[0-9]+)(?:[?#].*)?$/,
				run: function(cb, match) {
					var queries = common_functions["parse_imu_hash"](src);

					var list = null;
					if (queries) list = queries.playlist;

					vk_request_video(match[1], list, function(data) {
						if (!data) return cb(null);

						return cb(vk_process_video(data));
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "vk.com") {
			// thanks to anonymous for reporting:
			match = src.match(/:\/\/[^/]+\/+clips\/+[^/]+\?(?:.*&)?z=clip(-?[0-9]+_[0-9]+)(?:[&/%#].*)?$/);
			if (match) {
				return {
					url: "https://vk.com/video" + match[1],
					is_pagelink: true
				};
			}
		}

		if (domain === "m.vk.com") {
			// thanks to anonymous for reporting:
			match = src.match(/:\/\/[^/]+\/+video(-?[0-9]+_[0-9]+)(?:[?#].*)?$/);
			if (match) {
				return {
					url: "https://vk.com/video" + match[1],
					is_pagelink: true
				};
			}
		}

		if (domain_nosub === "userapi.com" &&
			host_domain_nosub === "vk.com" && options.element &&
			options.do_request && options.cb) {
			// https://vk.com/photo153162173_457261604?all=1
			// https://sun6-16.userapi.com/c855624/v855624788/9cf23/CQIxv7kEYOQ.jpg -- 1871x2160
			//   https://pp.userapi.com/c7005/v7005747/743e1/qht4X57c3UY.jpg -- 1871x2160
			//   o_: 130x150, p_: 200x231, q_: 320x370, r_: 510x589, w_: 1871x2160, x_: 523x604, y_: 699x807, z_: 935x1080
			// TODO: profile photos on other pages (some are /id012345, some are /special.name.
			//   requesting that will allow us to find <a id="profile_photo_link" href="/photo...">
			newsrc = (function() {
				var request_video = function(id, list, cb) {
					// payload[1][4].player.params[0].url720|hls(raw)?
					var cache_key = "vk_video:" + id;
					api_cache.fetch(cache_key, cb, function(done) {
						var listkey = "";
						if (list) {
							//listkey = "&list=" + list;
							listkey = "&playlist_id=" + list;
						} else {
							listkey = "&playlist_id=" + id.replace(/_[0-9]+$/, "_-2");
						}

						options.do_request({
							method: "POST",
							url: "https://vk.com/al_video.php?act=show",
							data: "act=show&al=1&al=1&module=direct&video=" + id + listkey,
							headers: {
								"Content-Type": "application/x-www-form-urlencoded",
								"X-Requested-With": "XMLHttpRequest",
								"Referer": "https://vk.com/",
								"Origin": "https://vk.com"
							},
							onload: function(result) {
								if (result.readyState !== 4)
									return;

								try {
									var json = JSON_parse(result.responseText);

									var params = json.payload[1][4].player;
									return done(params, 3*60*60);
								} catch (e) {
									console_error("vk_video", e);
								}

								return done(null, false);
							}
						});
					});
				};

				function request_photo(id, list, cb) {
					var listkey = "";
					if (list)
						listkey = "&list=" + list;

					api_query("vk_photo:" + id, {
						method: "POST",
						url: "https://vk.com/al_photos.php?act=show",
						data: "act=show&al=1&photo=" + id + listkey,
						imu_mode: "xhr",
						headers: {
							"Content-Type": "application/x-www-form-urlencoded",
							"X-Requested-With": "XMLHttpRequest"
						},
						json: true
					}, cb, function (done, json, cache_key) {
						var jsonarray = json.payload[1][3];
						var jsonobj = null;

						//console_log(jsonarray);

						for (var i = 0; i < jsonarray.length; i++) {
							if (!jsonarray[i].id)
								continue;

							api_cache.set("vk_photo:" + jsonarray[i].id, jsonarray[i], 3*60*60);

							if (jsonarray[i].id !== id)
								continue;

							jsonobj = jsonarray[i];
						}

						if (jsonobj !== null)
							done(jsonobj, 3*60*60);
						else
							done(null, false);
					});
				}

				function process_photo(jsonobj) {
					//console_log(jsonobj);

					var maxsize = 0;
					var maxurl = null;
					for (var key in jsonobj) {
						if (/^[a-z]_$/.test(key) && (key + "src") in jsonobj &&
							is_array(jsonobj[key]) && jsonobj[key].length === 3) {
							var size = jsonobj[key][1] * jsonobj[key][2];
							if (size > maxsize) {
								maxsize = size;
								maxurl = jsonobj[key + "src"];

								// fixme: for some reason this crashes, due to some conflict with the userapi rule above
								if (false && typeof maxurl === "string")
									maxurl = maxurl.replace(/(:\/\/[^/]+\/+)impg\/+(.*?)(?:[?#].*)?$/, "$1$2");
							}
						}
					}

					if (!maxurl) {
						console_log("Unable to find photo for", deepcopy(jsonobj));
					}

					return maxurl;
				}

				function process_video(player) {
					// https://vk.com/video-19043_456244315 -- youtube video
					// https://vk.com/video-19043_456244349 -- non-youtube video
					var params = player.params[0];

					var maxsize = 0;
					for (var key in params) {
						var match = key.match(/^url([0-9]+)$/);
						if (match) {
							var size = parseInt(match[1]);
							if (size > maxsize)
								maxsize = size;
						}
					}

					if (maxsize !== 0) {
						return params["url" + maxsize];
					}

					if (player.type === "youtube") {
						if (params.extra_data) {
							return "https://i.ytimg.com/vi/" + params.extra_data + "/mqdefault.jpg";
						}
					}

					console_log("Unable to find video for", deepcopy(params));

					return null;
				}

				function process_el(current) {
					if (current.tagName === "A") {
						var is_photo = true;

						var match = current.href.match(/^[a-z]+:\/\/(?:[^/]+\.)?vk\.com\/+photo(-?[0-9]+_[0-9]+)\/*(?:[?#].*)?$/);
						if (!match) {
							var onclick = current.getAttribute("onclick");
							if (onclick) {
								match = onclick.match(/^return\s+showPhoto\(["'](-?[0-9]+_[0-9]+)["']\s*,\s*["']([^'"]+)["']/);
								if (!match) {
									match = onclick.match(/^return\s+showVideo\(["'](-?[0-9]+_[0-9]+)["']\s*,\s*["']([^'"]+)["']/);
									if (match) {
										is_photo = false;
									}
								}
							}
						}

						if (match) {
							if (is_photo) {
								request_photo(match[1], match[2], function(obj) {
									if (!obj) {
										options.cb(null);
									} else {
										options.cb(process_photo(obj));
									}
								});
							} else {
								request_video(match[1], match[2], function(obj) {
									if (!obj) {
										options.cb(null);
									} else {
										options.cb(process_video(obj));
									}
								});
							}

							return true;
						}
					}

					return false;
				}

				var current = options.element;
				if (current.children && current.children.length === 1) {
					if (process_el(current.children[0])) {
						return {
							waiting: true
						};
					}
				}

				//current = options.element;
				while (current) {
					if (process_el(current)) {
						return {
							waiting: true
						};
					}

					current = current.parentElement;
				}

				return src;
			})();

			if (newsrc && newsrc !== src)
				return newsrc;
		}

		if (domain_nosub === "vkuservideo.net") {
			return {
				url: src,
				can_head: false,
				headers: {
					Origin: "https://vk.com",
					Referer: "https://vk.com",
					"Sec-Fetch-Site": "none",
					"Sec-Fetch-Dest": "document",
					"Sec-Fetch-Mode": "navigate",
					"Sec-Fetch-User": "?1",
					"Sec-Origin-Policy": "0"
				}
			};
		}

		if (domain_nowww === "free2music.com") {
			// https://free2music.com/images/thumb/singer/2019/04/03/selena-gomez_0.jpg,0,400.jpg
			//   https://free2music.com/images/singer/2019/04/03/selena-gomez_0.jpg
			return src.replace(/\/images\/+thumb\/+(.*\.[^/.,]+),[0-9]+(?:,[0-9]+)?\.[^/.]*(?:[?#].*)?$/, "/images/$1");
		}

		if (domain === "cdn.muabannhanh.com") {
			// https://cdn.muabannhanh.com/asset/frontend/img/gallery/thumbnail/2019/01/21/5c458bae2c8db_1548061614.jpg
			//   https://cdn.muabannhanh.com/asset/frontend/img/gallery/2019/01/21/5c458bae2c8db_1548061614.jpg -- watermark
			return {
				url: src.replace(/\/img\/+gallery\/+thumbnail\/+/, "/img/gallery/"),
				problems: {
					watermark: true
				}
			};
		}

		if (domain_nosub === "eski.mobi") {
			// https://pro2.eski.mobi/mobile/soccer365-ru/cache/img/q50/1536/https%3A%2F%2Fst1.soccer365.ru%2Fs1%2Fplayers%2F19_49_17%2F2230111_thumb.png
			//   https://st1.soccer365.ru/s1/players/19_49_17/2230111_thumb.png
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+mobile\/+[^/]*\/+cache\/+img\/+q[0-9]+\/+[0-9]+\/+(https?%)/, "$1");
			if (newsrc !== src)
				return decodeURIComponent(newsrc);
		}

		if (domain_nosub === "soccer365.ru" && /^st[0-9]*\./.test(domain)) {
			// https://st1.soccer365.ru/s1/players/19_49_17/2230111_thumb.png
			//   https://st1.soccer365.ru/s1/players/19_49_17/2230111.png
			// https://st1.soccer365.ru/s1/images/18_162_22/img_egA9AlR_600.jpg
			//   https://st1.soccer365.ru/s1/images/18_162_22/img_egA9AlR.jpg
			return src
				.replace(/(\/players\/+[0-9]+_[0-9]+_[0-9]+\/+[0-9]+)_thumb(\.[^/.]*)(?:[?#].*)?$/, "$1$2")
				.replace(/(\/images\/+[0-9]+_[0-9]+_[0-9]+\/+img_[^/._]+)_[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "static.grouple.co") {
			// https://static.grouple.co/uploads/pics/08/13/978_p.jpg
			//   https://static.grouple.co/uploads/pics/08/13/978.jpg
			// https://static.grouple.co/uploads/pics/10/94/373_p.jpg
			//   https://static.grouple.co/uploads/pics/10/94/373.jpg
			// other:
			// https://static.grouple.co/forum/images/auto/02/92/29294_2_1415281294114.jpg -- 3557x1370
			return src.replace(/(\/uploads\/+pics\/+[0-9]{2}\/+[0-9]{2}\/+[0-9]+)_p(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "vkpeople.ru") {
			// https://vkpeople.ru/_/%D0%98%D0%BC-%D0%A2%D1%85%D1%8D%D0%B5%D0%BD-%D1%84%D0%BE%D1%82%D0%BE?pp.userapi.com/c846420/v846420187/198625/69r2fPpcraw.jpg?ava=1
			//   https://pp.userapi.com/c846420/v846420187/198625/69r2fPpcraw.jpg?ava=1
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+_\/+[^/?]+\?([^/]+\.userapi\.com\/+)/, "$1");
			if (newsrc !== src)
				return add_http(newsrc);
		}

		if (domain_nowww === "edchomes.com") {
			// https://www.edchomes.com/CropUp/-x480/media/1087626/R-40.jpg
			//   https://www.edchomes.com/media/1087626/R-40.jpg
			return src.replace(/\/CropUp\/+[-0-9]+x[-0-9]+\/+media\/+/i, "/media/");
		}

		if (domain === "turntable.kagiso.io") {
			// https://turntable.kagiso.io/images/POPPIE_NONGENA_PR.width-800.jpg
			//   https://turntable.kagiso.io/images/POPPIE_NONGENA_PR.original.jpg
			// doesn't work for all:
			// https://turntable.kagiso.io/images/Screen_Shot_2018-03-07_at_10.45.28_AM.width-800.png
			//   https://turntable.kagiso.io/images/Screen_Shot_2018-03-07_at_10.45.28_AM.original.png -- doesn't work (jpg,jpeg,JPG,JPEG,PNG either)
			return src.replace(/(\/images\/+[^/]+)\.(?:width|height)-[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1.original$2");
		}

		if (domain_nowww === "furaffinity.net") {
			// https://www.furaffinity.net/full/21645783/
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+(?:view|full)\/+([0-9]+)\/*(?:[?#].*)?$/,
				query_for_id: {
					url: "https://www.furaffinity.net/full/${id}/",
					headers: {
						"Referer": "",
						"Origin": ""
					}
				},
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/<a\s+href=["']([^'"]+)["']\s*>Download(?: Submission)?<\/a>/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					return done({
						url: urljoin(src, match[1], true),
						extra: {
							page: resp.finalUrl,
							caption: get_meta(resp.responseText, "og:title") // todo: remove "by ..." and move to author
						}
					}, 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "t.facdn.net" ||
			// thanks to Noodlers on discord for reporting
			// https://t.furaffinity.net/41810755@200-1620581568.jpg
			//   https://d.furaffinity.net/art/yxithepixie/1620581568/1620581568.yxithepixie_20210509_182851.jpg
			domain === "t.furaffinity.net") {
			// https://t.facdn.net/21645783@400-1478448675.jpg
			match = src.match(/^[a-z]+:\/\/[^/]*\/+([0-9]+)@[0-9]+-[0-9]+\.[^/.]*(?:[?#].*)?$/);
			if (match) {
				return {
					url: "https://www.furaffinity.net/full/" + match[1] + "/",
					is_pagelink: true
				};
			}
		}

		if (domain_nosub === "aryion.com") {
			// https://static.aryion.com/g4/thumb/547402-73531-thumb.auto.jpg
			//   https://static.aryion.com/g4/thumb/547402-73531-thumb.auto.jpg/test.jpg
			//   https://static.aryion.com/g4/data/547402-73531.png
			//   https://aryion.com/g4/view/547402
			// https://static.aryion.com/g4/thumb/612844-88489-thumb.225-285-571-571.crop.jpg
			//   https://aryion.com/g4/derivative/612844-88489-1uxsl5a-preview.jpg
			//   https://aryion.com/g4/data/612844-88489-1uxsl5i.png/doomfister-612844-spitfire_spitroast.png
			// doesn't work for all:
			// https://static.aryion.com/g4/thumb/204167-29583-thumb.jpg
			//   https://aryion.com/g4/view/204167

			match = src.match(/\/(g[0-9]+)\/+(?:thumb|derivative)\/+([0-9]+)-[0-9]+/);
			if (match && options.do_request && options.cb) {
				var query_aryion = function(gn, id, cb) {
					api_query("aryion:" + gn + ":" + id, {
						url: "https://aryion.com/" + gn + "/view/" + id
					}, cb, function(done, resp, cache_key) {
						var match = resp.responseText.match(/var fullData\s*=\s*({.*?});/);
						if (!match) {
							console_error(cache_key, "Unable to find match for", resp);
							return done(null, false);
						}

						var json = JSON_parse(match[1]);

						if (!json.data_path) {
							console_error(cache_key, "Unable to find path in", json);
							return done(null, false);
						}

						var obj = {
							url: urljoin(resp.finalUrl, json.data_path, true),
							extra: {
								page: resp.finalUrl
							}
						};

						match = resp.responseText.match(/var itemTitle\s*=\s*(".*?");/);
						if (match) {
							try {
								obj.extra.caption = JSON_parse(match[1]);
							} catch (e) {
								console_error(cache_key, e);
							}
						}

						return done(obj, 24*60*60);
					});
				};

				query_aryion(match[1], match[2], options.cb);
				return {
					waiting: true
				};
			}

			newsrc = src.replace(/\/thumb\/+([0-9]+-[0-9]+)-thumb(?:\.[^/]*)?(\.[^/.]*)(\/+[^/]*)?(?:[?#].*)?$/, "/data/$1$2");
			if (newsrc !== src)
				return add_full_extensions(newsrc);

			match = src.match(/^[a-z]+:\/\/[^/]*\/+([^/]*)\/+(?:thumb|data\/+)([0-9]+)-/);
			if (match) {
				let obj = {
					url: src,
					extra: {
						page: "https://aryion.com/" + match[1] + "/view/" + match[2]
					}
				};

				return obj;
			}
		}

		if (domain === "ano.lolcathost.org") {
			// http://ano.lolcathost.org/thumbs//2017-12-14_22_56_04.jpg
			//   http://ano.lolcathost.org/pics/2017-12-14_22_56_04.jpg
			return src.replace(/(:\/\/[^/]*\/+)thumbs\/+/, "$1pics/");
		}

		if (domain_nowww === "okkisokuho.com") {
			// https://okkisokuho.com/wp-content/picture/2017/171126/a/171126a_as001tn.jpg
			//   https://okkisokuho.com/wp-content/picture/2017/171126/a/171126a_as001.jpg
			return src.replace(/(\/wp-content\/+picture\/+[0-9]{4}\/+[0-9]{6}\/+[^/]*\/+[^/]*_as[0-9]+)tn(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "pimg.togetter.com") {
			// https://pimg.togetter.com/1ac25d603c8ca6f205c7fbfb13f0413ed09017dc/68747470733a2f2f7062732e7477696d672e636f6d2f6d656469612f445536524d442d567741457a3969552e6a70673a6c61726765?w=1200&h=630&t=c
			//   https://pimg.togetter.com/1ac25d603c8ca6f205c7fbfb13f0413ed09017dc/68747470733a2f2f7062732e7477696d672e636f6d2f6d656469612f445536524d442d567741457a3969552e6a70673a6c61726765?w=o&h=o
			//   https://pbs.twimg.com/media/DU6RMD-VwAEz9iU.jpg?name=orig
			// https://pimg.togetter.com/77ffd4d31faa90f56ea0334c65ee33f78ff6775a/68747470733a2f2f6d656469612e696d6167652e696e666f7365656b2e636f2e6a702f69736e6577732f70686f746f732f6f7269636f6e2f6f7269636f6e5f323133383330305f302e6a7067
			//   https://pimg.togetter.com/77ffd4d31faa90f56ea0334c65ee33f78ff6775a/68747470733a2f2f6d656469612e696d6167652e696e666f7365656b2e636f2e6a702f69736e6577732f70686f746f732f6f7269636f6e2f6f7269636f6e5f323133383330305f302e6a7067?w=o&h=o -- 415
			newsrc = src.replace(/(?:\?.*)?$/, "?w=o&h=o");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "simg.userboard.org" ||
			// https://pimg.togetter.com/77ffd4d31faa90f56ea0334c65ee33f78ff6775a/68747470733a2f2f6d656469612e696d6167652e696e666f7365656b2e636f2e6a702f69736e6577732f70686f746f732f6f7269636f6e2f6f7269636f6e5f323133383330305f302e6a7067
			//   https://media.image.infoseek.co.jp/isnews/photos/oricon/oricon_2138300_0.jpg -- 404
			domain === "pimg.togetter.com") {
			// https://simg.userboard.org/1ef10b4b981baf7ec89ce2a0baa8fd1b4f786f79/687474703a2f2f69322e696d61676574776973742e636f6d2f74682f32313136392f627a6868363267396c6d37302e6a7067
			//   http://img161.imagetwist.com/th/19866/eekhw02yq2xy.jpg
			match = src.match(/^[a-z]+:\/\/[^/]*\/+[0-9a-f]{20,}\/+([0-9a-f]{16,})/);
			if (match) {
				return hex_to_ascii(match[1]);
			}
		}

		if (domain === "twpl.togetter.com") {
			// thanks to fireattack on discord:
			// https://togetter.com/li/945517
			// https://twpl.togetter.com/show/thumb/hWWWl
			//   https://twpl.togetter.com/show/large/hWWWl
			//   https://twpl.togetter.com/show/orig/hWWWl
			return src.replace(/(\/show\/+)(?:thumb|large)\/+/, "$1orig/");
		}

		if (domain_nowww === "hot.ag") {
			// http://hot.ag/BodyPainting/BodyPainting%20Thumbnails/World-Cup-Body-Paint.jpg
			//   http://hot.ag/BodyPainting/World-Cup-Body-Paint.jpg
			newsrc = src.replace(/\/([^/]+)\/+\1(?:%20| )Thumbnails\/+/, "/$1/");
			if (newsrc !== src)
				return add_full_extensions(newsrc);
		}

		if (domain_nowww === "finn-neo-admin.info" ||
			// https://finn-neo.com/newsimage/103966_pc_popup.jpg
			//   https://finn-neo.com/newsimage/103966.jpg
			domain_nowww === "finn-neo.com") {
			// https://finn-neo-admin.info/newsimage/102115_pc_thumb.jpg -- 400x283
			//   https://finn-neo-admin.info/newsimage/102115_pc_popup.jpg -- 500x354
			//   https://finn-neo-admin.info/newsimage/102115.jpg -- 844x597
			return src.replace(/(\/newsimage\/+[0-9]+)_pc_[a-z]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "freeaddon.com") {
			// https://freeaddon.com/wallpaper/nature/thumb444x250-02.jpg
			//   https://freeaddon.com/wallpaper/nature/bg-02.jpg -- 1920x1080
			return src.replace(/\/thumb[0-9]+x[0-9]+-/, "/bg-");
		}

		if (amazon_container === "classconnection") {
			// https://classconnection.s3.amazonaws.com/272/flashcards/1061272/jpg/selva_20110803_10636796041328847728849-thumb400.jpg
			//   https://classconnection.s3.amazonaws.com/272/flashcards/1061272/jpg/selva_20110803_10636796041328847728849.jpg
			return src.replace(/-thumb[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1");
		}

		if (false && (domain_nowww === "slideplayer.com.br" ||
			// https://slideplayer.info/8/2337452/big_thumb.jpg
			//   https://player.slideplayer.info/8/2337452/data/images/img0.jpg -- redirects to 404
			domain_nowww === "slideplayer.info" ||
			// https://slideplayer.com/27/9171393/big_thumb.jpg
			//   https://player.slideplayer.com/27/9171393/data/images/img0.jpg -- redirects to 404
			domain_nowww === "slideplayer.com" ||
			// https://slideplayer.es/47/11743789/big_thumb.jpg
			//   https://player.slideplayer.es/47/11743789/data/images/img0.jpg -- different
			domain_nowww === "slideplayer.es")) {
			// https://slideplayer.com.br/9/1796403/big_thumb.jpg
			//   https://player.slideplayer.com.br/9/1796403/data/images/img0.jpg
			return {
				url: src.replace(/:\/\/[^/]*(slideplayer\.[^/]*)\/+([0-9]+\/+[0-9]+\/+)big_thumb(\.[^/.]*)(?:[?#].*)?$/, "://player.$1/$2data/images/img0$3"),
				head_wrong_contenttype: true
			};
		}

		if (false && (domain_nosub === "agoravox.fr" ||
			// https://www.evous.fr/local/cache-vignettes/L350xH382/350gaul-2-38e5b.jpg?1524260316
			domain_nowww === "evous.fr")) {
			// https://mobile.agoravox.fr/IMG/jpg/La-Marianne-des-gilets-jaunes-est-l-artiste-Deborah-de-Robertis.jpg -- 2000x1332
			// https://mobile.agoravox.fr/local/cache-vignettes/L513xH383/P1000948JPG-f10f-ef1ce.jpg -- 1600x1200
			// https://mobile.agoravox.fr/local/cache-vignettes/L640xH1642/map_develop_f936-7cba8.png -- 3500x1642
			// https://www.agoravox.fr/IMG/jpg/22_mars.jpg -- 3307x2362 (interchangeable with mobile.)
			// thanks to anonymous for reporting:
			// www.monde-diplomatique.fr/local/cache-vignettes/L890xH664/679.hrmedias-37fb7.png
		}

		if (domain === "pictures.topspeed.com") {
			// https://pictures.topspeed.com/IMG/crop/202001/mercedes-vision-avtr-65_800x0w.jpg
			//   https://pictures.topspeed.com/IMG/jpg/202001/mercedes-vision-avtr-65.jpg
			return src.replace(/(\/IMG\/+)crop\/+([0-9]{6}\/+[^/]+)_[0-9]+x[0-9]+[wh](\.[^/.]+)(?:[?#].*)?$/, "$1jpg/$2$3");
		}

		if (domain === "monsite.woopic.com") {
			// https://monsite.woopic.com/383/f/500x/p/Roselyange/img/254891230c9211073de0b2ed7970d28f.jpg
			//   https://monsite.woopic.com/383/p/Roselyange/img/254891230c9211073de0b2ed7970d28f.jpg
			return src.replace(/(:\/\/[^/]*\/+[0-9]+\/+)f\/+[0-9]*x[0-9]*\/+p\/+/, "$1p/");
		}

		if (domain_nosub === "erome.com" && /^s[0-9]*\./.test(domain)) {
			// https://s2.erome.com/165/aToCOFkn/thumbs/of5tx2ym.jpeg
			//   https://s2.erome.com/165/aToCOFkn/of5tx2ym.jpeg
			return src.replace(/\/thumbs\/+([^/]*\.[^/.]*)(?:[?#].*)?$/, "/$1");
		}

		if (domain_nosub === "bdsmlr.com") {
			// https://cdn08.bdsmlr.com/uploads/photos/2019/09/74125/bdsmlr-74125-zXEarM4sh8.jpg
			//   https://cdn08.bdsmlr.com/uploads/photos/2019/09/74125/bdsmlr-74125-zXEarM4sh8-og.jpg
			// https://cdno07.bdsmlr.com/uploads/photos/2019/07/36606/bdsmlr-36606-hv4ns7ywrB.JPG
			//   https://cdno07.bdsmlr.com/uploads/photos/2019/07/36606/bdsmlr-36606-hv4ns7ywrB-og.JPG
			// https://cdn04.bdsmlr.com/uploads/photos/2019/03/16995/bdsmlr-16995-p1xblnflJS-og.jpg -- 4213x2290
			// some cdn numbers redirect endlessly, however, they are not interchangeable
			return src.replace(/(\/uploads\/+photos\/+[0-9]{4}\/+[0-9]{2}\/+[0-9]+\/+[^/]*-[0-9]+-[a-zA-Z0-9]+)(\.[^/.]*)(?:[?#].*)?$/, "$1-og$2");
		}

		if (domain_nowww === "sofurryfiles.com") {
			// https://www.sofurryfiles.com/std/thumb?page=1486058
			//   https://www.sofurryfiles.com/std/content?page=1486058 -- 1800x900
			//   https://www.sofurry.com/view/1486058
			newsrc = src.replace(/\/std\/+(?:thumb|preview)\?/, "/std/content?");
			if (newsrc !== src)
				return newsrc;

			match = src.match(/\/std\/+[a-z]+\?(?:.*&)?page=([0-9]+).*?$/);
			if (match) {
				obj = {
					url: src,
					extra: {
						page: "https://www.sofurry.com/view/" + match[1]
					}
				};

				return obj;
			}
		}

		if (amazon_container === "bw-1651cf0d2f737d7adeab84d339dbabd3-bcs") {
			// https://bw-1651cf0d2f737d7adeab84d339dbabd3-bcs.s3.amazonaws.com/products/product_126601/Thumb126601_35ed430c80e54f1d4f492b44a232cbc3.jpg
			//   https://bw-1651cf0d2f737d7adeab84d339dbabd3-bcs.s3.amazonaws.com/products/product_126601/Full126601_35ed430c80e54f1d4f492b44a232cbc3.jpg
			return src.replace(/(\/product_[0-9]+\/+)Thumb([0-9]+_[0-9a-f]+\.[^/.]*)(?:[?#].*)?$/, "$1Full$2");
		}

		if (domain === "static.myfigurecollection.net") {
			// https://static.myfigurecollection.net/pics/figure/444509.jpg?rev=1518788957 -- 60x60
			//   https://static.myfigurecollection.net/pics/figure/big/444509.jpg?rev=1518788957 -- 256x238
			//   https://static.myfigurecollection.net/pics/figure/large/444509.jpg?rev=1518788957 -- 600x557
			//   https://myfigurecollection.net/item/444509
			newsrc = src.replace(/\/pics\/+figure\/+(?:big\/+)?([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/pics/figure/large/$1");
			if (newsrc !== src)
				return newsrc;

			match = src.match(/\/pics\/+figure\/+(?:[a-z]+\/+)?([0-9]+)\.[^/.]+/);
			if (match) {
				return {
					url: src,
					extra: {
						page: "https://myfigurecollection.net/item/" + match[1]
					}
				};
			}

			// https://static.myfigurecollection.net/pics/encyclopedia/32/8652.jpg?rev=1438729314
			//   https://static.myfigurecollection.net/pics/encyclopedia/8652.jpg?rev=1438729314
			//   https://myfigurecollection.net/entry/8652
			// https://static.myfigurecollection.net/pics/group/64/675.jpg?rev=1318416599
			//   https://static.myfigurecollection.net/pics/group/675.jpg?rev=1318416599
			//   https://myfigurecollection.net/club/675
			newsrc = src.replace(/(\/pics\/+(?:encyclopedia|group)\/+)[0-9]+\/+([0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1$2");
			if (newsrc !== src)
				return newsrc;

			match = src.match(/\/pics\/+(encyclopedia|group)\/+(?:[0-9]+\/+)?([0-9]+)\.[^/.]+/);
			if (match) {
				var middle = "entry";
				if (match[1] === "group")
					middle = "club";

				return {
					url: src,
					extra: {
						page: "https://myfigurecollection.net/" + middle + "/" + match[2]
					}
				};
			}

			// https://static.myfigurecollection.net/image/thumbnails/neL1395446768.jpeg
			//   https://static.myfigurecollection.net/image/neL1395446768.jpeg
			//   https://myfigurecollection.net/item/193057
			return src.replace(/\/image\/+thumbnails\/+/, "/image/");
		}

		if (domain_nowww === "8muses.com") {
			// https://www.8muses.com/image/th/pwS7aQk-zMwJDawQMuoUauicwhmk55nZLsB5vM5dZBVOzpkFuazyVkhmuyqk6n1z3JSHoHKBM88eO1VWwPiOVXHC52YyDIWH9tlkODxeBXk+zpRLU3NS1Sb5JOaOKh78.jpg
			//   https://www.8muses.com/image/fl/pwS7aQk-zMwJDawQMuoUauicwhmk55nZLsB5vM5dZBVOzpkFuazyVkhmuyqk6n1z3JSHoHKBM88eO1VWwPiOVXHC52YyDIWH9tlkODxeBXk+zpRLU3NS1Sb5JOaOKh78.jpg
			return src.replace(/(:\/\/[^/]*\/+)image\/+th\/+/, "$1image/fl/");
		}

		if (domain === "stored-edge.slickpic.com") {
			// https://stored-edge.slickpic.com/NDk5MjNmYTc1MzU0MQ,,/20190806/MTYzMTY3NTU3N2Y1/pef/550/1966_VW_21_Window_Bus_A-GC.com-1.jpg
			//   https://stored-edge.slickpic.com/NDk5MjNmYTc1MzU0MQ,,/20190806/MTYzMTY3NTU3N2Y1/pef/-/1966_VW_21_Window_Bus_A-GC.com-1.jpg -- 2560x1707
			//   https://mattcrandall.slickpic.com/albums/Album-2019-08-06-1449/photos/16316755/1966-vw-21-window-bus-a-gc-com-1/
			// TODO: make stricter somehow. /p/ can be anything
			return {
				url: src.replace(/\/[0-9]+\/+([^/]*\.[^/.]*)(?:[?#].*)?$/, "/-/$1"),
				head_wrong_contentlength: true
			};
		}

		if (domain === "cdn.pururin.io") {
			// https://cdn.pururin.io/assets/images/data/40279/2t.jpg
			//   https://cdn.pururin.io/assets/images/data/40279/2.jpg
			//   https://pururin.io/read/40279/02/shiki-to-p
			newsrc = src.replace(/(\/assets\/+images\/+data\/+[0-9]+\/+[0-9]+)t(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
			if (newsrc !== src)
				return newsrc;

			match = src.match(/\/assets\/+images\/+data\/+([0-9]+)\/+([0-9]+|cover)t?\./);
			if (match) {
				let pageurl = "https://pururin.io/read/" + match[1];

				if (match[2] === "cover") {
					pageurl += "/a";
				} else {
					pageurl += "/" + zpadnum(match[2], 2) + "/a";
				}

				return {
					url: src,
					extra: {
						page: pageurl
					}
				};
			}
		}

		if (domain === "image.newdaily.co.kr") {
			// http://www.newdaily.co.kr/site/data/html/2010/04/25/2010042500038.html
			//   http://image.newdaily.co.kr/site/data/img/2010/04/25/2010042500038_0.jpg -- 3872x2592
			//   http://image.newdaily.co.kr/site/data/img/2010/04/25/2010042500038_1.jpg -- 580x388 (different image)
			// http://image.newdaily.co.kr/site/data/thumb/2019/11/08/2019110800093_0_thumb.jpg
			//   http://image.newdaily.co.kr/site/data/img/2019/11/08/2019110800093_0.jpg
			newsrc = src.replace(/(\/site\/+data\/+)thumb(\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9]{10,}_[0-9]+)_thumb\./, "$1img$2.")
			if (newsrc !== src)
				return newsrc;

			match = src.match(/\/site\/+data\/+img\/+([0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9]{10,})_[0-9]+\./);
			if (match) {
				return {
					url: src,
					extra: {
						page: "http://www.newdaily.co.kr/site/data/html/" + match[1] + ".html"
					}
				};
			}
		}

		if (domain === "img.stoo.com") {
			// http://img.stoo.com/upimages/gisaimg/201907/09_560590_81844.jpg -- 3720x2778
			//   http://stoo.asiae.co.kr/article.php?aid=56059081844
			// http://img.stoo.com/upimages/gisaimg/201905/545202-430.jpg -- 3712x5085
			//   http://mstoo.asiae.co.kr/article.php?aid=54520222344
			match = src.match(/\/upimages\/+gisaimg\/+[0-9]{6}\/+(?:[0-9]{2}_)?([0-9]+)_([0-9]+)\./);
			if (match) {
				return {
					url: src,
					extra: {
						page: "http://stoo.asiae.co.kr/article.php?aid=" + match[1] + match[2]
					}
				};
			}
		}

		if (domain_nowww === "freeseximages.com") {
			// https://freeseximages.com/static/thumbnail/84525.jpg
			//   https://freeseximages.com/static/source/84525.jpg
			return src.replace(/\/static\/+thumbnail\/+([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/static/source/$1");
		}

		if (domain_nosub === "ravelrycache.com" && /^images[0-9]*/.test(domain)) {
			// https://images4-e.ravelrycache.com/uploads/amyraDE/622698897/thetis-komplett_small.jpg
			//   https://images4-e.ravelrycache.com/uploads/amyraDE/622698897/thetis-komplett_small2.jpg
			//   https://images4-e.ravelrycache.com/uploads/amyraDE/622698897/thetis-komplett_medium2.jpg
			//   https://images4-e.ravelrycache.com/uploads/amyraDE/622698897/thetis-komplett.jpg -- 1000x750
			// https://images4-e.ravelrycache.com/uploads/amyraDE/479213139/alkmene_umgelegt1_square.jpg
			//   https://images4-e.ravelrycache.com/uploads/amyraDE/479213139/alkmene_umgelegt1.jpg
			// https://images4-b.ravelrycache.com/uploads/softsweater/489868171/IMG_9332.jpg -- 1067x1600
			//   https://www.ravelry.com/patterns/library/waiting-for-rain
			// https://images4-e.ravelrycache.com/uploads/softsweater/401022832/webp/IMG_3490_small2.webp
			//   https://images4-e.ravelrycache.com/uploads/softsweater/401022832/IMG_3490.jpg -- removing small2 with /webp/ doesn't work
			// other:
			// https://skitch2.ravelrycache.com/il_fullxfull.1320471158_heuv-1550264287.jpg -- 3000x3000
			newsrc = src.replace(/(\/[0-9]+\/+)webp\/+([^/]*)\.webp([?#].*)?$/, "$1$2.jpg");
			if (newsrc !== src)
				return add_full_extensions(newsrc);

			// https://images4-e.ravelrycache.com/flickr/2/5/1/25108855132/25108855132_n.jpg
			//   https://images4-e.ravelrycache.com/flickr/2/5/1/25108855132/25108855132.jpg
			//   https://images4-e.ravelrycache.com/flickr/2/5/1/25108855132/25108855132_b.jpg
			//   https://www.flickr.com/photos/63369864@N00/25108855132
			newsrc = src.replace(/(\/flickr\/+(?:[0-9]\/+){3}[0-9]+\/+[0-9]+)(?:_n)?(\.[^/.]*)(?:[?#].*)?$/, "$1_b$2");
			if (newsrc !== src)
				return newsrc;

			match = src.match(/\/flickr\/+(?:[0-9]\/+){3}[0-9]+\/+([0-9]+)(?:_[a-z])?\.[^/.]*(?:[?#].*)?$/);
			if (match) {
				return {
					url: "https://live.staticflickr.com/0000/" + match[1] + "_face_k.jpg",
					fake: true
				};
			}

			return src.replace(/(\/uploads\/+[^/]*\/+[0-9]+\/+[^/]*)_(?:small|medium|square)[0-9]*(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "fotorgia.com") {
			// http://www.fotorgia.com/wp-content/plugins/wp-o-matic/cache/0f9b1be272_dzawi3Q-1-180x240.jpg
			//   http://www.fotorgia.com/wp-content/plugins/wp-o-matic/cache/0f9b1be272_dzawi3Q.jpg
			return src.replace(/(\/wp-content\/+plugins\/+wp-o-matic\/+cache\/+[0-9a-f]+_[^/]+)-[0-9]-[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "bonjourlesmadames.fr") {
			// https://www.bonjourlesmadames.fr/static/files/2017/2017-07-23/200_bonjour-la-rousse.jpg
			//   https://www.bonjourlesmadames.fr/static/files/2017/2017-07-23/bonjour-la-rousse.jpg
			return src.replace(/(\/static\/+files\/+[0-9]{4}\/+[0-9]{4}-[0-9]{2}-[0-9]{2}\/+)[0-9]+_([^/]*\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "img.blesk.cz") {
			// https://img.blesk.cz/img/17/article/2043571/rihanna.jpg
			//   https://img.blesk.cz/img/17/origin/2043571/rihanna.jpg -- 1158x1600
			//   https://img.blesk.cz/img/17/origin/2043571.jpg -- works too
			//   https://img.blesk.cz/img/17/origin/2043571_.jpg
			//   https://img.blesk.cz/img/17/origin/2043571-.jpg
			// https://img.blesk.cz/img/33-origin-5163189.jpg -- 1920x1080
			// https://img.blesk.cz/img/17/full/1864477.jpg -- 978x1224, upscaled (maybe the image itself is upscaled?), origin doesn't work
			// https://img.blesk.cz/img/17/normal108/2002124_rihanna.jpg
			// https://img.blesk.cz/img/1-full-976650.jpg -- 320x240
			//   https://img.blesk.cz/img/1-origin-976650.jpg -- 320x240
			// other:
			// https://img.blesk.cz/static/images/1/upload_field/24_CPROMOBOX/1467/56/56272_b38fe9f3e3c20ca3e6cb60cd359ee86a.jpg
			return src.replace(/(\/img\/+[0-9]+(?:\/+|-))[^/]*((?:\/+|-)[0-9]+[^0-9])/, "$1origin$2");
		}

		if (domain === "img.ngfiles.com") {
			// https://img.ngfiles.com/icons/hovers/rankandrate.png?cached=1578181342
			if (/\/icons\/+hovers\/+[a-z]+\.png/.test(src))
				return {
					url: src,
					bad: "mask"
				};
		}

		if (domain === "uimg.ngfiles.com") {
			// https://uimg.ngfiles.com/icons/7097/7097354_small.png?f1547808730
			//   https://uimg.ngfiles.com/icons/7097/7097354_large.png?f1547808730
			// other:
			// https://art.ngfiles.com/thumbnails/1017000/1017695_full.png?f1567918106
			//   https://www.newgrounds.com/art/view/grillhou5e/jesus-quintana
			//   https://art.ngfiles.com/images/1017000/1017695_grillhou5e_jesus-quintana.png?f1567918067
			return src.replace(/(\/icons\/+[0-9]+\/+[0-9]+_)(?:small|medium)\./, "$1large.")
		}

		if (domain_nowww === "newgrounds.com") {
			// share page
			// https://www.newgrounds.com/content/share/779568/4
			newsrc = website_query({
				// first is the id, second is the type (4 = art?, 3 = audio)
				website_regex: /^[a-z]+:\/\/[^/]+\/+content\/+share\/+([0-9]+)\/+([0-9]+)(?:[?#].*)?$/,
				query_for_id: "https://www.newgrounds.com/content/share/${1}/${2}",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/<div\s+class=["']embed-link["'][\s\S]{10,100}<input\s+type="text"\s+value=["']([^"']+)/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					return done({
						url: decode_entities(match[1]),
						is_pagelink: true
					}, 12*60*60);
				}
			});
			if (newsrc) return newsrc;

			// https://www.newgrounds.com/art/view/incaseart/the-invitation-chapter-2-page-1
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+art\/+view\/+([^/]+)\/+([^/?#]+)(?:[?#].*)?$/,
				query_for_id: "https://www.newgrounds.com/art/view/${1}/${2}",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/PHP\.merge\(({.*?"full_image_text":.*?})\);/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					var obj:BigImageInfoSObject = {
						extra: {
							page: resp.finalUrl
						}
					};

					try {
						var json = JSON_parse(match[1]);
						var img = json.full_image_text;

						match = img.match(/src="([^"]+)"/);
						if (!match) {
							console_error(cache_key, "Unable to find img match for", img);
						} else {
							obj.url = decode_entities(match[1]);
							return done(obj, 12*60*60);
						}
					} catch (e) {
						console_error(cache_key, e);
					}

					return done(null, false);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "art.ngfiles.com") {
			// https://art.ngfiles.com/thumbnails/779000/779568_full.jpg?f1551377356
			//   https://art.ngfiles.com/images/779000/779568_incaseart_the-invitation-chapter-2-page-1.jpg?f1547047570

			newsrc = src.replace(/(\/thumbnails\/+[0-9]+\/+[0-9]+)\./, "$1_full.");
			if (newsrc !== src)
				return newsrc;

			match = src.match(/\/(?:thumbnails|images)\/+[0-9]+\/+([0-9]+)/);
			if (match) {
				return {
					url: "https://www.newgrounds.com/content/share/" + match[1] + "/4",
					is_pagelink: true
				};
			}
		}

		if (domain_nowww === "pinimg.icu") {
			// https://pinimg.icu/wall/200x200/south-korean-girls-pinterest-heyitsmesophia-asian-girl-korean-girl-cute-girls-korean-E4da4470ff0b1335d96e2d15858679d5e.jpg?t=5d7744985798c
			//   https://pinimg.icu/wall/0x0/south-korean-girls-pinterest-heyitsmesophia-asian-girl-korean-girl-cute-girls-korean-E4da4470ff0b1335d96e2d15858679d5e.jpg?t=5d7744985798c
			return src.replace(/\/wall\/+[0-9]+x[0-9]+\/+/, "/wall/0x0/");
		}

		if ((domain_nosub === "netnews.vn" && /\.media\./.test(domain)) ||
			domain === "mediaold.tiin.vn") {
			// http://mcnews2.media.netnews.vn/netnews/archive/images/2019090415/tinngan_034115_273110685_0wap_320.jpg
			//   http://mcnews2.media.netnews.vn/netnews/archive/images/2019090415/tinngan_034115_273110685_0.jpg
			// http://mediaold.tiin.vn:8080/media_old_2016//archive/images/2016/11/23/170654_9wap_320.jpg
			//   http://mediaold.tiin.vn:8080/media_old_2016//archive/images/2016/11/23/170654_9.jpg
			// other:
			// http://mcnews1.media.netnews.vn:8080/netnews/archive/images/2019080915/tinngan_034557_695485757_0.jpg -- 3000x2182
			return src.replace(/(_[0-9]+)wap_[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "d343xr8tqpm2fx.cloudfront.net") {
			// https://d343xr8tqpm2fx.cloudfront.net/mottokorea/userfiles/2019/06/15615151663802379s.jpg
			//   https://d343xr8tqpm2fx.cloudfront.net/mottokorea/userfiles/2019/06/15615151663802379.jpg
			// https://d343xr8tqpm2fx.cloudfront.net/mottokorea/userfiles/2019/06/15615897163803866s1.jpg
			//   https://d343xr8tqpm2fx.cloudfront.net/mottokorea/userfiles/2019/06/156158971638038661.jpg -- linked by article
			//   http://mottokorea.com/mottoKoreaW/FunJoy_list.do?bbsBasketType=R&seq=84462
			//   http://mottokorea.com/mottoKoreaW/FunJoy_list.do?bbsBasketType=R&seq=84530
			//   https://d343xr8tqpm2fx.cloudfront.net/mottokorea/userfiles/2019/06/15615897163803866.jpg -- same as above
			// doesn't work for all:
			// https://d343xr8tqpm2fx.cloudfront.net/mottokorea/userfiles/2019/09/15098481073088382s.jpg -- forces download
			//   https://d343xr8tqpm2fx.cloudfront.net/mottokorea/userfiles/2019/09/15098481073088382.jpg -- 403
			//   http://mottokorea.com/mottoKoreaW/Business_list.do?bbsBasketType=R&seq=86214
			return src.replace(/(\/userfiles\/+[0-9]{4}\/+[0-9]{2}\/+[0-9]{10,})s([0-9]*\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "nikkansports.com" ||
			// https://cache4.nipc.jp/baseball/column/analyst/news/img/202409220001984-w200_0.jpg
			//   https://cache4.nipc.jp/baseball/column/analyst/news/img/202409220001984-w1300_0.jpg
			(domain_nosub === "nipc.jp" && /^cache[0-9]*\./.test(domain))) {
			// thanks to fireattack on discord for reporting:
			// https://cache2.nipc.jp/mod2015/img/common/blank.gif
			// https://cache4.nipc.jp/mod/img/blank.gif
			if (/\/(?:img\/+common|mod\/+img)\/+blank\.gif(?:[?#].*)?$/.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}

			// wip
			// https://www.nikkansports.com/entertainment/news/img/201801300000608-nsogp_0.jpg -- 800x1067
			// https://www.nikkansports.com/entertainment/news/img/201903030000871-w1300_0.jpg -- 1300x1632
			// https://www.nikkansports.com/sports/special/icehockey/img/smilejapan_004_01.jpg -- 3780x2126
			// https://www.nikkansports.com/sports/special/sanno/2014/img/newsphoto-sanno_06.jpg -- 3744x3326
			//   https://www.nikkansports.com/sports/special/sanno/2014/news/news-sanno_06.html
			// https://www.nikkansports.com/battle/sumo/election/2016/img/kisenosato_01.jpg -- 1900x2436
			//   https://www.nikkansports.com/battle/sumo/election/2016/note/note-01.html
			// https://www.nikkansports.com/entertainment/news/1738732.html
			//   https://www.nikkansports.com/entertainment/news/img/et-su-161116darenoga-w300_0.jpg
			//   https://www.nikkansports.com/entertainment/news/img/et-su-161116darenoga-w1300_0.jpg -- upscaled?
			// https://www.nikkansports.com/m/area/jiyugaoka/img/25.jpg -- 2250x4000
			//   https://www.nikkansports.com/m/area/jiyugaoka/shop.html?no=25
			// https://p.nikkansports.com/goku-uma/photo/news/00000001/2020/02/12/202002120000257-1.jpg
			// https://www.nikkansports.com/univ/hosei/h-sc2003.koudai_01.jpg
			// https://www.nikkansports.com/battle/boxing/naoya-inoue/img/column02/20211112_5.jpg
			// https://www.nikkansports.com/olympic/rio2016/equestrian/special/img/talk/160808kojima_03.jpg
			// https://www.nikkansports.com/battle/boxing/naoya-inoue/img/profile.jpg
			// https://www.nikkansports.com/sports/athletics/hakone-ekiden/2021/img/21hakone_course.jpg?d=27901440
			// https://www.nikkansports.com/baseball/highschool/news/img/201711110000426-w300_0.jpg -- 2504x3056
			// https://www.nikkansports.com/sports/figure/hanyu/photo/article/img/105-20150530-hanew-ogp_0.jpg -- 474x500
			// https://www.nikkansports.com/entertainment/akb48/photo/article/img/akb-otm-2013090207-ns140.jpg -- 140x264
			// https://www.nikkansports.com/sports/athletics/seriku/2013/photo/article/img/seriku-hk130819-1-ns140.jpg -- 140x286
			//   https://www.nikkansports.com/sports/athletics/seriku/2013/photo/article/f-sp-tp0-20130819-1175731.html
			//   https://www.nikkansports.com/sports/athletics/seriku/2013/photo/article/img/seriku-hk130819-1-ns-big.jpg -- 245x500
			// thanks to anonymous for reporting:
			// https://www.nikkansports.com/entertainment/akb48/news/img/202304220001315-w1300_2.jpg

			// thanks to fireattack on discord:
			// https://www.nikkansports.com/entertainment/news/img/202409220001870-w500_0.jpg
			//   https://www.nikkansports.com/entertainment/news/img/202409220001870-w1300_0.jpg
			// https://www.nikkansports.com/entertainment/news/img/202409220001870-w200_4.jpg
			//   https://www.nikkansports.com/entertainment/news/img/202409220001870-w1300_4.jpg

			return src.replace(/(\/news\/+img\/+[0-9]+)-w[1-5]00_/, "$1-w1300_");
		}

		if (domain_nosub === "minkch.com" && /^imgs/.test(domain)) {
			// https://imgsb.minkch.com/imgs/minkch/i_20140121081405s.jpg
			//   https://imgsb.minkch.com/imgs/minkch/i_20140121081405.jpg
			return src.replace(/(\/imgs\/+[^/]+\/+i_[0-9]+)s(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "img.8kmm.com") {
			// http://img.8kmm.com/2014/1/201401220952378518_S.jpg
			//   http://img.8kmm.com/2014/1/201401220952378518.jpg
			return src.replace(/(\/[0-9]{4}\/+[0-9]{1,2}\/+[0-9]{8,})_S(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nosub === "kpopis.com" && /^cdn[0-9]*\./.test(domain)) {
			// http://cdn10.kpopis.com/ts/data/file/lib2/1/158_20140619171011_1.png_SM.png
			//   http://cdn10.kpopis.com/ts/data/file/lib2/1/158_20140619171011_1.png
			return src.replace(/(\/data\/+file\/+lib2\/+[0-9]+\/+[0-9]+_[0-9]+_[0-9]+\.[^/._]+)_SM\.[^/.]*(?:[?$].*)?$/, "$1");
		}

		if (domain_nosub === "vnecdn.net" && domain.match(/^(?:(?:vcdn|i)-[^.]*|(?:.*\.)?img)\./)) {
			// https://vcdn-ione.vnecdn.net/2018/02/04/topoppp-1681-1517742371_500x300.jpg
			//   https://vcdn-ione.vnecdn.net/2018/02/04/topoppp-1681-1517742371.jpg
			// https://vcdn-giaitri.vnecdn.net/2018/10/11/tiffany-young-tren-tham-do-american-music-awards-1539224433_1539233031_140x84.jpg
			//   https://vcdn-giaitri.vnecdn.net/2018/10/11/tiffany-young-tren-tham-do-american-music-awards-1539224433_1539233031.jpg
			// https://i-giaitri.vnecdn.net/2009/02/18/me2-1345649328_480x0.jpg
			// https://i-ngoisao.vnecdn.net/2012/11/26/10-585669-1376858787_500x0.jpg
			//   https://i-ngoisao.vnecdn.net/2012/11/26/10-585669-1376858787.jpg
			// https://i-ngoisao.vnecdn.net/2016/11/23/yura-7472-1479876568_m_460x0.jpg
			//   https://i-ngoisao.vnecdn.net/2016/11/23/yura-7472-1479876568.jpg
			// http://c0.f21.img.vnecdn.net/2014/07/22/selena17-4474-1406020916_m_460x0.jpg
			//   https://i-ngoisao.vnecdn.net/2014/07/22/selena17-4474-1406020916.jpg
			return src.replace(/(?:_m)?_[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1");
		}

		if (domain === "pocket.playxp.com") {
			// https://pocket.playxp.com/thumbs/728x/1285203?ada1752df875da28
			//   https://pocket.playxp.com/preview/1285203?ada1752df875da28
			//   https://pocket.playxp.com/download/1285203?ada1752df875da28
			return {
				url: src.replace(/(:\/\/[^/]+\/+)(?:thumbs\/+[0-9]*x[0-9]*|preview)\/+/, "$1download/"),
				head_wrong_contenttype: true,
				headers: {
					Referer: "https://www.playxp.com/community/funny/view.php?article_id=12345"
				}
			};
		}

		if (domain_nowww === "flash24.co.kr") {
			// http://flash24.co.kr/g4/m/thumb.php?w=300&bo_table=commu&img=2049238704_NApTRomD_IMG_0477.jpg
			//   http://flash24.co.kr/g4/m/thumb.php?bo_table=commu&img=2049238704_NApTRomD_IMG_0477.jpg -- max of 400 width, even if w=500
			if (/\/g[0-9]*\/+m\/+thumb\.php\?/.test(src)) {
				return keep_queries(src, ["bo_table", "img"], {required: true});
			}
		}

		// XImageSharing
		if ((domain_nowww === "imgbaron.com" ||
			 // thanks to elvisef on github: https://github.com/qsniyg/maxurl/issues/600
			 // https://kropic.com/i/00085/nr0zpbbk2ipw_t.jpg
			 // https://kropic.com/nr0zpbbk2ipw/.html
			 domain_nowww === "kropic.com" ||
			 // thanks to elvisef on github: https://github.com/qsniyg/maxurl/issues/600
			 // https://kvador.com/i/00073/wybpzfsx8qlc_t.jpg
			 domain_nowww === "kvador.com" ||
			 // thanks to elvisef on github: https://github.com/qsniyg/maxurl/issues/615
			 // https://imgsen.com/i/00004/c4mhjoef1g9b_t.jpg
			 domain_nowww === "imgsen.com" ||
			 // thanks to elvisef on github: https://github.com/qsniyg/maxurl/issues/624
			 // http://imgsto.com/i/00001/o3vdurulj6bi_t.jpg
			 domain_nowww === "imgsto.com" ||
			 // thanks to elvisef on github: https://github.com/qsniyg/maxurl/issues/628
			 // https://fotokiz.com/i/00001/ydnutqpmkl30_t.jpg
			 domain_nowww === "fotokiz.com" ||
			 // thanks to elvisef on github: https://github.com/qsniyg/maxurl/issues/628
			 domain_nowww === "silverpic.com" ||
			 // thanks to elvisef on github: https://github.com/qsniyg/maxurl/issues/628
			 domain_nowww === "picdollar.com" ||
			 // thanks to elvisef on github: https://github.com/qsniyg/maxurl/issues/628
			 // https://pics4you.net/i/00003/m3zpgb1scabj_t.jpg
			 domain_nowww === "pics4you.net" ||
			 // thanks to anonymous for reporting:
			 // https://barbit.net/i/00017/vdvi8tj8tedd_t.jpg
			 domain_nowww === "barbit.net" ||
			 // https://www.picbaron.com/i/00167/6mcldhdqwxwi_t.jpg
			 //   https://www.picbaron.com/img/uu5si5rhdliptxsqhap3eekotqhlfdh2r2iqvhsrsi/metart_loxima_elizabet_high_0040.jpg
			 domain_nowww === "picbaron.com")
			&& options.do_request && options.cb) {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+([a-z0-9]{5,})\/+[^/]*\.html(?:[?#].*)?$/,
				query_for_id: function(id) {
					return {
						method: "POST",
						url: "https://" + domain_nosub + "/" + id + "/.html",
						data: "op=view&id=" + id + "&pre=1&next=Continue+to+image...",
						headers: {
							Origin: "https://" + domain_nosub,
							Referer: pageurl,
							"Content-Type": "application/x-www-form-urlencoded"
						},
					};
				},
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/<img\s+src=["']((?:https?:)?\/\/[^/]+\/+img\/+[0-9a-z]{10,}\/+.*?)['"]\s+class=["']pic["']/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					return done({
						url: urljoin(url, match[1], true),
						is_original: true
					}, 60*60);
				}
			});
			if (newsrc) return newsrc;

			// other possible servers (from google)
			// imagebake.com pixes.ws dostore.xyz imgxxx.me
			// can't find any example images to test any of them
			//
			// https://imgbaron.com/i/00087/8r1hprs298m6_t.jpg
			//   https://imgbaron.com/8r1hprs298m6/.html
			//   https://imgbaron.com/img/zdnt43lf4uzsmgawy3zy6kfqp4smlrlag3lwb5bdjq/egh_0003.JPG
			match = src.match(/\/i\/+[0-9]+\/+([0-9a-z]+)_t\./);
			if (match) {
				return {
					url: "https://" + domain_nosub + "/" + match[1] + "/.html",
					is_pagelink: true
				};
			}
		}

		// can't be supported due to captcha
		if (false && (domain_nosub === "imgtown.net" ||
			 domain_nosub === "imgtown.pw") &&
			options && options.cb && options.do_request) {
			// https://it1.imgtown.net/i/00735/hm00jfc5ry20_t.jpg
			//   https://imgtown.net/hm00jfc5ry20/MetArt_Foina_Elizabet_high_0005.jpg.html
			//   https://imgtown.pw/wTZBlVBrPJdIAePl8XE7N8slVPVKtNeXlw.php
			//   https://it1.imgtown.net/img/znyc6gte7uyjo6od5ijyavmuhf4dbph252w4mgnlgi/MetArt_Foina_Elizabet_high_0005.jpg
			match = src.match(/\/i\/+[0-9]+\/+([0-9a-z]+)_t\./);
			if (match) {
				id = match[1];
				let pageurl = "https://" + domain_nosub + "/" + id + "/.html";
				options.do_request({
					method: "GET",
					url: pageurl,
					headers: {
						Referer: ""
					},
					onload: function(result) {
						if (result.readyState !== 4)
							return;

						if (result.status !== 200) {
							console_error("Bad response code for " + pageurl, result);
							return options.cb(null);
						}

						// First we need to find the encrypted URL
						var match = result.responseText.match(/((?:var _0x[0-9a-f]+=(?:"[-_A-Za-z0-9=]*"|(?:_0x[0-9a-f]+\+){1,}_0x[0-9a-f]+);){1,}var _0x[0-9a-f]+=atob\((?:_0x[0-9a-f]+\+){1,}_0x[0-9a-f]+\))/);
						if (!match) {
							console_error("Unable to find encrypted URL for " + pageurl, result);
							return options.cb(null);
						}

						var final = "";
						function parse_vartable(varstring) {
							var splitted = varstring.split(";");

							var vartable = {};
							for (var i = 0; i < splitted.length; i++) {
								splitted[i] = splitted[i].replace(/^\s*|\s*$/, "");
								if (splitted[i].length === 0)
									continue;

								var smatch = splitted[i].match(/^var (_0x[0-9a-f]+)=(.*)/);

								var varname = smatch[1];
								var varval = smatch[2];

								var vmatch = varval.match(/^["'](.*)["']/);
								if (vmatch) {
									vartable[varname] = vmatch[1];
								} else if ((vmatch = varval.match(/^_0x[0-9a-f]+\+/))) {
									var vsplitted = varval.split("+");
									varval = "";

									for (var j = 0; j < vsplitted.length; j++) {
										varval += vartable[vsplitted[j]];
									}

									vartable[varname] = varval;
								} else if ((vmatch = varval.match(/^atob/))) {
									var vsplitted = varval.replace(/^atob\((.*)\)$/, "$1").split("+");
									varval = "";

									for (var j = 0; j < vsplitted.length; j++) {
										varval += vartable[vsplitted[j]];
									}

									vartable[varname] = base64_decode(varval);
									final = vartable[varname];
								} else {
									console_log("Unknown varval type:" + splitted[i]);
								}
							}

							return vartable;
						}

						parse_vartable(match[1]);

						if (!final) {
							console_error("Unable to create vartable", result);
							return options.cb(null);
						}

						options.do_request({
							method: "GET",
							url: final,
							headers: {
								Referer: result.finalUrl
							},
							onload: function(result) {
								if (result.readyState !== 4)
									return;

								if (result.status !== 200) {
									return options.cb(null);
								}

								var varmatch = result.responseText.match(/{(?:var _0x[0-9a-f]+='[0-9a-z]*';){4,}/g);
								if (varmatch.length > 1 || varmatch.length === 0) {
									console_error("varmatches.length != 1", result);
									return options.cb(null);
								}

								var varsstr = varmatch[0].substr(1); // remove {
								var vartable = parse_vartable(varsstr);

								// Maybe check for a variable in vartable?
								var combinedmatch = result.responseText.match(/,((?:_0x[0-9a-f]+\+){4,}_0x[0-9a-f]+)\)/);
								if (!combinedmatch) {
									console_error("Unable to find variable combiner", result);
									return options.cb(null);
								}

								var combiner = combinedmatch[1].split("+");
								var hash = "";
								for (var i = 0; i < combiner.length; i++) {
									if (!(combiner[i] in vartable)) {
										console_error("Unable to find variable " + combiner[i] + " in vartable", vartable, result);
										return options.cb(null);
									}

									hash += vartable[combiner[i]];
								}

								options.do_request({
									method: "POST",
									url: result.finalUrl,
									headers: {
										Origin: result.finalUrl.replace(/^([a-z]+:\/\/[^/]+\/+).*/, "$1"),
										Referer: result.finalUrl,
										"Content-Type": "application/x-www-form-urlencoded"
									},
									data: "op=view&id=" + id + "&pre=1&hito=tm&" + hash + "=1",
									onload: function (result) {
										if (result.readyState !== 4) {
											return options.cb(null);
										}

										//console_log(result);
										if (result.status !== 200) {
											return options.cb(null);
										}

										var match = result.responseText.match(/<img\s+src=["']((?:https?:)?\/\/[^/]+\/+img\/+[0-9a-z]{10,}\/+.*?)['"]\s+class=['"]picview["']/);
										if (match) {
											return options.cb({
												url: urljoin(src, match[1], true),
												is_original: true
											});
										} else {
											return options.cb(null);
										}
									}
								});
							}
						});
					}
				});

				return {
					waiting: true
				};
			}
		}

		if (domain === "m.wdqyan.com") {
			// https://m.wdqyan.com/static/upload/thumbs/20190725/15640499319146.jpg
			//   https://m.wdqyan.com/static/upload/thumbs/20190725/15640499319146.jpg
			return src.replace(/\/static\/+upload\/+thumbs\/+/, "/static/upload/");
		}

		if (domain === "kan.china.com") {
			// https://kan.china.com/utuku/img0/240x0/m/20180906/f3dc54f3-6999-4a86-a821-edfe55fe0293.jpg
			//   https://kan.china.com/utuku/img0/0x0/m/20180906/f3dc54f3-6999-4a86-a821-edfe55fe0293.jpg
			return src.replace(/(\/utuku\/+img[0-9]*\/+)[0-9]+x[0-9]+\/+/, "$10x0/");
		}

		if (domain === "storage.enuri.info") {
			// http://storage.enuri.info/pic_upload/knowbox_rss/aHR0cDovL3d3dy56ZW5pdGhuZXdzLmNvbS9uZXdzL3Bob3RvLzIwMTgwNi8xMTY4NjhfMTA0MjYxXzQ1NDEucG5n
			//   http://www.zenithnews.com/news/photo/201806/116868_104261_4541.png
			match = src.match(/\/pic_upload\/+knowbox_rss\/+([^/.?#]+)(?:[?#].*)?$/);
			if (match) {
				return base64_decode(match[1]);
			}
		}

		if (domain === "img.mediapen.com") {
			// http://img.mediapen.com/news/201909/news_461542_1568165911_c.jpg -- 520x365
			//   http://img.mediapen.com/news/201909/news_461542_1568163469_m.jpg -- 600x338
			//   http://www.mediapen.com/news/view/461542
			// works for some:
			// http://img.mediapen.com/news/202103/news_610544_1616052989_c.jpg
			//   http://img.mediapen.com/news/202103/news_610544_1616052989_m.jpg
			match = src.match(/\/news\/+[0-9]{6}\/+news_([0-9]+)_[0-9]+_[a-z]\./);
			if (match) {
				return {
					url: src,
					extra: {
						page: "http://www.mediapen.com/news/view/" + match[1]
					}
				};
			}
		}

		if (domain === "cdnimage.dailian.co.kr") {
			// http://cdnimage.dailian.co.kr/news/icon/201910/news_1571709106_835910_c.jpg
			//   http://cdnimage.dailian.co.kr/news/201910/news_1571709106_835910_m_1.jpg
			//   http://www.dailian.co.kr/news/view/835910
			// other:
			// http://cdnimage.dailian.co.kr/news/201907/news_1561960369_807365_m_1.jpg -- 3648x2432
			newsrc = src.replace(/\/news\/+icon\/+([0-9]{6}\/+news_[0-9]+_[0-9]+)_c(\.[^/.]*)(?:[?#].*)?$/, "/news/$1_m_1$2");
			if (newsrc !== src)
				return newsrc;

			match = src.match(/\/news\/+(?:[a-z]+\/+)?[0-9]{6}\/+news_[0-9]+_([0-9]+)_[a-z](?:_[0-9]+)?\./);
			if (match) {
				return {
					url: src,
					extra: {
						page: "http://www.dailian.co.kr/news/view/" + match[1]
					}
				};
			}
		}

		if (domain_nowww === "teengirl-pics.com") {
			// http://teengirl-pics.com/aHR0cHM6Ly9zdGF0aWMtZmhnLm1ldGFydC5jb20vbWVkaWEvQTBEMkM0RDE3NDgyREEyNDE1N0YxNUJBNjAxMkNENjMvd3RfQUM5QkI0RURFRkNBMDcxNEE5RjQ0MjZGRENFOEZBQTYuanBn.jpg
			//   https://static-fhg.metart.com/media/A0D2C4D17482DA24157F15BA6012CD63/wt_AC9BB4EDEFCA0714A9F4426FDCE8FAA6.jpg
			// http://teengirl-pics.com/aHR0cDovL2Nkbi5neXJscy5jb20vd3AtY29udGVudC91cGxvYWRzLzIwMTkvMDIvMTYvbHVuYS1yaWRlcy1oZXItbmV3LXRveS0xLmpwZw%3D%3D.jpg
			//   http://cdn.gyrls.com/wp-content/uploads/2019/02/16/luna-rides-her-new-toy-1.jpg
			match = src.match(/^[a-z]+:\/\/[^/]+\/+([^/.]{50,})\.[^/.]*(?:[?#].*)?$/);
			if (match) {
				return base64_decode(decodeURIComponent(match[1]));
			}
		}

		if (domain === "static-fhg.metart.com" ||
			// https://static-fhg.rylskyart.com/media/C6130A457E32A4A4F96CA5E7F0EF5BAA/wt_6AF4B058DB42690481696C4DD0765E0F.jpg
			//   https://static-fhg.rylskyart.com/media/C6130A457E32A4A4F96CA5E7F0EF5BAA/w_6AF4B058DB42690481696C4DD0765E0F.jpg
			domain === "static-fhg.rylskyart.com" ||
			// http://static-fhg.met-art.com/media/595A60F2826F4B4445659F8AB347DBA3/wt_53476867D0B958B499A9CB1AC895C5EF.jpg
			//   http://static-fhg.met-art.com/media/595A60F2826F4B4445659F8AB347DBA3/w_53476867D0B958B499A9CB1AC895C5EF.jpg
			domain === "static-fhg.met-art.com" ||
			// https://static-fhg.sexart.com/media/647D21CE27B7B0243D7B9DA5E05A99D7/wt_CFE4B2A78D9E45340D5CF2BB29C9ABDF.jpg
			//   https://static-fhg.sexart.com/media/647D21CE27B7B0243D7B9DA5E05A99D7/w_CFE4B2A78D9E45340D5CF2BB29C9ABDF.jpg
			domain === "static-fhg.sexart.com" ||
			// https://static-fhg.vivthomas.com/media/FC524EEBF1F459E44155D774EE3D9A04/wt_B31410A1E3264AB45529DA67CD46852E.jpg
			//   https://static-fhg.vivthomas.com/media/FC524EEBF1F459E44155D774EE3D9A04/w_B31410A1E3264AB45529DA67CD46852E.jpg
			domain === "static-fhg.vivthomas.com" ||
			domain === "static-fhg.eternaldesire.com" ||
			domain === "static-fhg.eroticbeauty.com" ||
			// https://static-fhg.alsscan.com/media/5E5797E04DBD4244ADD5137FBFC994DB/wt_1A982EA10CA6DE846DAF3ED22CFF7708.jpg
			//   https://static-fhg.alsscan.com/media/5E5797E04DBD4244ADD5137FBFC994DB/w_1A982EA10CA6DE846DAF3ED22CFF7708.jpg
			domain === "static-fhg.alsscan.com") {
			// https://static-fhg.metart.com/media/A0D2C4D17482DA24157F15BA6012CD63/wt_AC9BB4EDEFCA0714A9F4426FDCE8FAA6.jpg
			//   https://static-fhg.metart.com/media/A0D2C4D17482DA24157F15BA6012CD63/w_AC9BB4EDEFCA0714A9F4426FDCE8FAA6.jpg
			newsrc = src.replace(/(\/media\/+[0-9A-F]{10,}\/+)wt_([0-9A-F]{10,}\.[^/.]+)(?:[?#].*)?$/, "$1w_$2");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "fhg.asiansexdiary.com" ||
			// https://hosted.trikepatrol.com/fhg/wp-content/uploads/kiana_set_1/kiana_set_1_th_01.jpg
			//   https://hosted.trikepatrol.com/fhg/wp-content/uploads/kiana_set_1/kiana_set_1_01.jpg
			domain === "hosted.trikepatrol.com" ||
			// https://trikepatrol.com/assets/fhg/april3/april3_th_01.jpg
			//   https://trikepatrol.com/assets/fhg/april3/april3_01.jpg
			domain_nowww === "trikepatrol.com") {
			// https://fhg.asiansexdiary.com/wp-content/uploads/menchie_set_3/menchie_set_3_th_04.jpg
			//   https://fhg.asiansexdiary.com/wp-content/uploads/menchie_set_3/menchie_set_3_04.jpg
			return src.replace(/(\/(?:wp-content\/+uploads|assets\/+fhg)\/+[^/]+\/+[^/]+_)th_([0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nosub === "tuktukpatrol.com") {
			// https://tuktukpatrol.com/free-galleries/assets/natalie_set_4/natalie_set_4_th_01.jpg
			//   https://tuktukpatrol.com/free-galleries/assets/natalie_set_4/natalie_set_4_01.jpg
			// https://hosted.tuktukpatrol.com/content/som_set_2/som_set_2_th_01.jpg
			//   https://hosted.tuktukpatrol.com/content/som_set_2/som_set_2_01.jpg
			return src.replace(/(\/(?:assets|content)\/+[^/]+\/+[^/]+_[0-9]+)_th(_[0-9]+\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "lesarchive.com") {
			// https://www.lesarchive.com/promo/pictures/22/veronikalisa/thumbs/1.jpg
			//   https://www.lesarchive.com/promo/pictures/22/veronikalisa/pics/1.jpg
			return src.replace(/(\/pictures\/+[0-9]+\/+[^/]+\/+)thumbs\/+/, "$1pics/");
		}

		if (domain === "images.hqseek.com" ||
			// https://images.bigboobsbeauties.com/pictures/pinupfiles_162/thumbs/01.jpg
			//   https://images.bigboobsbeauties.com/pictures/pinupfiles_162/01.jpg
			domain === "images.bigboobsbeauties.com") {
			// https://images.hqseek.com/pictures/legs9/thumbs/001.jpg
			//   https://images.hqseek.com/pictures/legs9/001.jpg
			return src.replace(/(\/pictures\/+[^/]+\/+)thumbs\/+/, "$1");
		}

		if (domain_nosub === "scoreuniverse.com") {
			// https://cdn77.scoreuniverse.com/18eighteen/gallys/images_content/AliceMarch_28734/01_tn.jpg
			//   https://cdn77.scoreuniverse.com/18eighteen/gallys/images_content/AliceMarch_28734/01.jpg
			// http://tsg.scoreuniverse.com/legsex/gallys/images_content/CarolinePierce_19299/12_tn.jpg
			//   http://tsg.scoreuniverse.com/legsex/gallys/images_content/CarolinePierce_19299/12.jpg
			return src.replace(/(\/images_content\/+[^/]*\/+[0-9]+)_tn(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "sexgrace.com") {
			// http://www.sexgrace.com/amateurs/tr/amateur_sexy_girl_00809.jpg
			//   http://www.sexgrace.com/amateurs/pics/amateur_sexy_girl_00809.jpg
			return {
				url: src.replace(/\/tr\/+/, "/pics/"),
				headers: {
					Referer: "http://www.sexgrace.com/"
				}
			};
		}

		if (domain_nowww === "idealbabes.net" ||
			// http://www.purescans.com/girls/mpl_tr/Ariel_3_01.jpg
			//   http://www.purescans.com/girls/mpl_pics/Ariel_3_01.jpg
			domain_nowww === "purescans.com") {
			// http://www.idealbabes.net/girls/femjoy_tr/Rena_4_01.jpg
			//   http://www.idealbabes.net/girls/femjoy_pics/Rena_4_01.jpg
			return src.replace(/_tr(\/+[^/]*\.[^/.]*)(?:[?#].*)?$/, "_pics$1");
		}

		if (domain === "imganuncios.mitula.net") {
			// https://imganuncios.mitula.net/small/3_bed_independent_ground_portion_1230070557493543252.jpg
			//   https://imganuncios.mitula.net/3_bed_independent_ground_portion_1230070557493543252.jpg
			// https://imganuncios.mitula.net/bmw_x5_4450128427590868488.jpg -- 1920x1440
			return src.replace(/(:\/\/[^/]*\/+)[a-z]+\/+([^/]+_[0-9]{10,}\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "recbook.com") {
			// https://recbook.com/storage/thumbs/1884627720_1554863223.png
			//   https://recbook.com/storage/uploads/1884627720_1554863223.png
			return src.replace(/\/storage\/+thumbs\/+/, "/storage/uploads/");
		}

		if (domain_nosub === "jdmagicbox.com" && /^content[0-9]*\./.test(domain)) {
			// https://content3.jdmagicbox.com/comp/delhi/l2/011pxx11.xx11.181201121520.n6l2/catalogue/guru-kirpa-gupta-properties-shastri-nagar-n-delhi-estate-agents-bhqcuqr44l-250.jpg
			//   https://content3.jdmagicbox.com/comp/delhi/l2/011pxx11.xx11.181201121520.n6l2/catalogue/guru-kirpa-gupta-properties-shastri-nagar-n-delhi-estate-agents-bhqcuqr44l.jpg
			// https://content1.jdmagicbox.com/comp/mumbai/g4/022pxx22.xx22.190430174247.q1g4/catalogue/blackpink-mumbai-hfcqwtwhyv.jpg?interpolation=lanczos-none&output-format=jpg&resize=1024:*&crop=1024:270px;*,*
			//   https://content1.jdmagicbox.com/comp/mumbai/g4/022pxx22.xx22.190430174247.q1g4/catalogue/blackpink-mumbai-hfcqwtwhyv.jpg
			return src.replace(/(\/catalogue\/+[^/?]*-[a-z0-9]{10,})(?:-[0-9]+)?(\.[^/.]*?)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "image.aladin.co.kr") {
			// https://image.aladin.co.kr/product/19928/0/coversum/k242635748_1.jpg -- 85x124
			//   https://image.aladin.co.kr/product/19928/0/cover500/k242635748_1.jpg -- 500x733
			// https://image.aladin.co.kr/product/18004/88/cover150/k892534639_1.jpg
			//   https://image.aladin.co.kr/product/18004/88/cover500/k892534639_1.jpg
			// thanks to Froktime on github: https://github.com/qsniyg/maxurl/issues/1344
			// https://image.aladin.co.kr/product/33894/48/cover100/k132930727_1.jpg
			//   https://image.aladin.co.kr/product/33894/48/cover200/k132930727_1.jpg
			//   https://image.aladin.co.kr/product/33894/48/cover500/k132930727_1.jpg
			//   https://image.aladin.co.kr/product/33894/48/letslook/k132930727_fl.jpg -- 2114x2433
			// https://image.aladin.co.kr/product/28728/13/letslook/8934967323_wbl.jpg?MW=750&
			//   https://image.aladin.co.kr/product/28728/13/letslook/8934967323_wbl.jpg
			// other:
			// https://image.aladin.co.kr/product/17719/20/cover500/4800292263_1.jpg -- 1500x2112
			return src
				.replace(/(\/product\/+[0-9]+\/+[0-9]+\/+.*?)(?:[?#].*)?$/, "$1")
				.replace(/(\/product\/+[0-9]+\/+[0-9]+\/+)cover500\/+(k[0-9]+_)1\./, "$1letslook/$2fl.")
				.replace(/(\/product\/+[0-9]+\/+[0-9]+\/+)cover(?:sum|1[50]0|200)\/+/, "$1cover500/");
		}

		if (domain === "book.interpark.com" ||
			// http://bimage.interpark.com/goods_image/7/3/5/0/300247350h.jpg
			//   http://bimage.interpark.com/goods_image/7/3/5/0/300247350g.jpg
			domain === "bimage.interpark.com") {
			// http://book.interpark.com/goods_image/7/3/5/0/300247350h.jpg
			//   http://book.interpark.com/goods_image/7/3/5/0/300247350s.jpg -- 201x280
			//   http://book.interpark.com/goods_image/7/3/5/0/300247350g.jpg -- 300x420
			// other:
			// http://book.interpark.com/goods_image/4/8/5/9/201314859s.jpg -- 3395x3248
			// g, s, o, h, i
			// s can be larger (probably a bug), so let's not replace it
			return src.replace(/(\/goods_image\/+(?:[0-9]\/+){4}[0-9]+)[hoi](\.[^/.]*)(?:[?#].*)?$/, "$1g$2");
		}

		if (domain === "mobile.kyobobook.co.kr") {
			// http://mobile.kyobobook.co.kr/common/image/resize?url=http://image.kyobobook.co.kr/images/book/large/089/l9791189320089.jpg
			//   http://image.kyobobook.co.kr/images/book/large/089/l9791189320089.jpg
			newsrc = src.replace(/.*\/common\/+image\/+resize\?(?:.*&)?url=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "image.kyobobook.co.kr") {
			// http://image.kyobobook.co.kr/images/book/large/089/l9791189320089.jpg
			//   http://image.kyobobook.co.kr/images/book/xlarge/089/x9791189320089.jpg
			// other:
			// https://manatong.com/data/item/image/x9791189320089.jpg -- different site, same filename, 1772x2480
			return src.replace(/\/images\/+book\/+large\/+([0-9]{3}\/+)l/, "/images/book/xlarge/$1x");
		}

		if (domain === "cdn.011st.com") {
			// http://cdn.011st.com/11dims/resize/300x300/quality/75/11src/pd/19/7/8/2/8/6/5/eMXwX/2304782865_B.jpg
			//   http://cdn.011st.com/pd/19/7/8/2/8/6/5/eMXwX/2304782865_B.jpg
			// http://cdn.011st.com/11dims/thumbnail/11src/editorImg/20190904/23565502/1567574523744_E.jpg
			//   http://cdn.011st.com/editorImg/20190904/23565502/1567574523744_E.jpg
			return src.replace(/\/+11dims\/.*?\/11src\/+/, "/");
		}

		if (domain_nowww === "comiczone.co.kr") {
			// http://www.comiczone.co.kr/shop/data/goods/t/1548727385567m0.jpg
			//   http://www.comiczone.co.kr/shop/data/goods/1548727385567m0.jpg
			return src.replace(/\/data\/+goods\/+t\/+/, "/data/goods/");
		}

		if (domain === "static.mangahub.ru") {
			// https://static.mangahub.ru/uploads/media/manga_cover/thumbnail/small/0018/78/1777080.jpeg
			//   https://static.mangahub.ru/uploads/media/manga_cover/thumbnail/big/0018/78/1777080.jpeg
			return src.replace(/\/uploads\/+media\/+manga_cover\/+thumbnail\/+small\/+/, "/uploads/media/manga_cover/thumbnail/big/");
		}

		if (false && domain_nosub === "imgant.com") {
			// wip:
			// http://t1.imgant.com/thumb/84e0343a04/c52d0949f0.png
			//   http://t1.imgant.com/tempImages/c52d0949f0051f99ad180c690.png
			//   c52d0949f0 = 846864140784
			//     reversing: 0f9490d25c = 66917028444
			//   84e0343a04 = 570697202180
			// http://imgant.com/img-329649.html
			//   http://imgant.com/imgview-329649.html
		}

		if (domain_nosub === "kn3.net" ||
			// https://img-9.poringa.net/poringa/posts/E/0/0/8/5/5/Momsile/161x121_714.jpg
			//   https://img-9.poringa.net/poringa/posts/E/0/0/8/5/5/Momsile/714.jpg
			(domain_nosub === "poringa.net" && /^img-[0-9]+\./.test(domain))) {
			// https://k61.kn3.net/taringa/2/7/6/8/4/7/96/drporn/c_147x147_46D.jpg
			//   https://k61.kn3.net/taringa/2/7/6/8/4/7/96/drporn/46D.jpg
			// https://t3.kn3.net/taringa/8/C/A/1/F/5/Theylor-/92x70_213.jpg
			//   https://t3.kn3.net/taringa/8/C/A/1/F/5/Theylor-/213.jpg
			// https://k62.kn3.net/taringa/4/2/C/5/8/C/UniversoGIA/c_115x85_610.jpg
			//  https://k62.kn3.net/taringa/4/2/C/5/8/C/UniversoGIA/610.jpg -- 2048x1152
			newsrc = src.replace(/(\/(?:posts|taringa)\/+(?:[A-Z0-9]\/+){6}(?:[0-9]+\/+)?[^/]+\/+)(?:c_)?[0-9]+x[0-9]+_([^/]+)(?:[?#].*)?$/, "$1$2");
			if (domain_nosub === "poringa.net") {
				// thanks to vscum on github for reporting: https://github.com/qsniyg/maxurl/issues/1309
				return {
					url: newsrc,
					headers: {
						Referer: "https://www.poringa.net/"
					}
				};
			} else {
				return newsrc;
			}
			//return src.replace(/\/(?:c_)?[0-9]+x[0-9]+_([0-9A-Z]*\.[^/.]*)$/, "/$1");
		}

		if (domain === "media.taringa.net") {
			// thanks to Art-2 on github: https://github.com/qsniyg/maxurl/issues/650
			// https://media.taringa.net/knn/fit:550/Z3M6Ly9rbjMvZGYxNzZiYzNkZTY1OTczODUxNDU0MDM2NjNjNjU5ODA
			//   https://media.taringa.net/knn/identity/Z3M6Ly9rbjMvZGYxNzZiYzNkZTY1OTczODUxNDU0MDM2NjNjNjU5ODA
			// atob = gs://kn3/df176bc3de6597385145403663c65980
			// https://media.taringa.net/knn/crop:150x115/Z3M6Ly9rbjMvMDAzYmMxZWMwYzhmMjUxMWUyNzMxMzQzMTNhMTgzMTk
			//   https://media.taringa.net/knn/identity/Z3M6Ly9rbjMvMDAzYmMxZWMwYzhmMjUxMWUyNzMxMzQzMTNhMTgzMTk
			return src.replace(/(:\/\/[^/]+\/+knn\/+)(?:fit|crop):[0-9]+(?:x[0-9]+)?\/+([^-/_.]+)(?:[?#].*)?$/, "$1identity/$2");
		}

		if (domain_nowww === "warashi-asian-pornstars.fr") {
			// http://warashi-asian-pornstars.fr/WAPdB-img/pornostars-f-galeries/25000/25462/mini/wapdb-kalina-ryu-pornostar-asiatique.warashi-asian-pornstars.fr-25462-001.jpg
			//    http://warashi-asian-pornstars.fr/WAPdB-img/pornostars-f-galeries/25000/25462/large/wapdb-kalina-ryu-pornostar-asiatique.warashi-asian-pornstars.fr-25462-001.jpg
			return src.replace(/(\/[^/]+-img\/+[^/]*\/+[0-9]+\/+[0-9]+\/+)mini\/+/, "$1large/");
		}

		if (domain_nosub === "kinghost.com" && /^www[0-9]*\./.test(domain)) {
			// http://www.kinghost.com/asian/manpe/pacific/594/s02.jpg
			//   http://www.kinghost.com/asian/manpe/pacific/594/02.jpg
			// http://www12.kinghost.com/asian/prettygirls/shavea/sa/thumbnails/tn206.jpg
			//   http://www12.kinghost.com/asian/prettygirls/shavea/sa/images/206.jpg
			return {
				url: src
					.replace(/\/thumbnails\/+tn([0-9]+\.(?:jpg|png))(?:[?#].*)?$/, "/images/$1")
					.replace(/\/(?:s|tn)([a-z]?[0-9]+(?:[a-z]{2})?\.(?:jpg|png))(?:[?#].*)?$/, "/$1"),
				headers: {
					Referer: "http://" + domain + "/asian/"
				},
				referer_ok: {
					same_domain: true
				}
			};
		}

		if (domain_nowww === "japanesegirl-4you.com") {
			// http://japanesegirl-4you.com/pacific/2011/0621/thumbs/002.jpg
			//   http://japanesegirl-4you.com/pacific/2011/0621/002.jpg
			return src.replace(/(\/[0-9]{4}\/+[0-9]{4}\/+)thumbs\/+/, "$1");
		}

		if (domain_nowww === "nsgalleries.com") {
			// http://www.nsgalleries.com/hosted2/_NATSHG/hrpics/sos-haveen_ora_ILoveBigToys40_HR/thumbs/001.jpg
			//   http://www.nsgalleries.com/hosted2/_NATSHG/hrpics/sos-haveen_ora_ILoveBigToys40_HR/001.jpg
			return src.replace(/(\/hosted2\/+[^/]+\/+hrpics\/+[^/]+\/+)thumbs\/+([0-9]+\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "sexygirlcity.com") {
			// http://sexygirlcity.com/gal/1213/02_tumba.jpg
			//   http://sexygirlcity.com/gal/1213/02.jpg
			return src.replace(/(\/gal\/+[0-9]+\/+[0-9]+)_tumb[a-z]?(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "image.pornyl.com") {
			// http://image.pornyl.com/content/3285-587/tn/3285-mycuteasian_08.jpg -- 690x920, upscaled
			//   http://image.pornyl.com/content/3285-587/3285-mycuteasian_08.jpg -- 480x640
			return src.replace(/(\/content\/+[0-9]+-[0-9]+\/+)tn\/+/, "$1");
		}

		// regex :(
		// maybe create a domain_notld variable?
		if (/^gettyimages\./.test(domain_nosub) && domain_nowww === domain_nosub) {
			let basedomain = "www.gettyimages.com";
			// needed for botwall, proper cookies don't get sent otherwise
			if (api_cache.has("gettyimages_domain"))
				basedomain = api_cache.get("gettyimages_domain");

			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+detail\/+[^/]+\/+[^/]+\/+([0-9]+)(?:[?#].*)?$/,
				query_for_id: "https://" + basedomain + "/detail/a/a/${id}",
				imu_mode: "document",
				process: function(done, resp, cache_key) {
					api_cache.set("gettyimages_domain", resp.finalUrl.replace(/^[a-z]+:\/\/([^/]+)\/+.*/, "$1"), 6*60*60);

					var obj:BigImageInfoSObject = {
						extra: {
							// remove country codes related to IP
							page: resp.finalUrl.replace(/(:\/\/www\.gettyimages\.)[^/]+\//, "://www.gettyimages.com/")
						},
						head_wrong_contenttype: true,
						head_wrong_contentlength: true
					};

					var description = get_meta(resp.responseText, "og:description");
					if (description)
						obj.extra.caption = description;

					var urls = [];

					var assetinfomatch = resp.responseText.match(/<script type="application\/json" data-component='AssetDetail'>\s*({.*})\s*<\/script>/);
					if (!assetinfomatch) {
						console_warn(cache_key, "Unable to find asset detail match for", resp);
					} else {
						let json = JSON_parse(assetinfomatch[1]);
						urls.push({
							url: json.asset.largeMainImageURL,
							problems: {
								watermark: true
							}
						});

						urls.push({
							url: json.asset.thumb612Url,
							problems: {
								smaller: true
							}
						});
					}

					// doesn't work anymore
					if (false) {
						var baseurl = get_meta(resp.responseText, "og:image");
						if (!baseurl) {
							console_error(cache_key, "Unable to find base image URL for", resp);
							return done(null, false);
						}

						baseurl = common_functions["getty_transform_url"](baseurl);

						var largerurl = baseurl.replace(/(-id[0-9]+)(?:[?#].*)?$/, "$1?s=2048x2048&w=5");
						urls.push({
							url: largerurl,
							problems: {
								watermark: true
							}
						});
					}

					// debugging tool, prints all image urls
					if (false) {
						let matched_urls = resp.responseText.match(/"(https?:\/\/media\.gettyimages\.com\/+[^"]+)"/g);
						if (matched_urls) {
							let processed_urls = [];
							for (let url of matched_urls) {
								processed_urls.push(decode_entities(JSON_parse(url)));
							}
							console_log(processed_urls);
						}
					}

					//var smallerurl = result.responseText.match(/<meta\s+content=["'](https:\/\/media\.gettyimages\.com\/+photos\/+[^/]*\?k=6.*?)["']\s+property=["']og:image["']\s*\/>/);
					// above is slightly smaller (594x594 instead of 612x612)
					//var smallerurl = resp.responseText.match(/"thumb612Url":\s*(["']https?:\/\/media\.gettyimages\.com\/+(?:photos|vectors|id)\/+[^/]*-id[0-9]+\?k=6.*?["'])/);
					let smallerurl = get_meta(resp.responseText, "thumbnailUrl");
					if (smallerurl && !/&w=/.test(smallerurl)) {
						urls.push({
							url: smallerurl,
							problems: {
								smaller: true
							}
						});
					}

					return done(fillobj_urls(urls, obj), 60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "istockphoto.com") {
			// thanks to anonymous for reporting:
			// https://www.istockphoto.com/de/foto/junger-mann-morgens-im-freien-laufen-gm1125038961-295587246
			match = src.match(/^[a-z]+:\/\/[^/]+\/+[^?#]+-gm([0-9]{5,})-[0-9]+(?:[?#].*)?$/);
			if (match)
				return {
					url: "https://www.gettyimages.com/detail/a/a/" + match[1],
					is_pagelink: true
				};
		}

		if (domain === "media.gettyimages.com" ||
			// thanks to anonymous for reporting:
			// https://media.istockphoto.com/id/1244986911/zh/%E5%90%91%E9%87%8F/%E6%B0%B4%E5%BD%A9%E8%8A%B1%E7%99%BD%E8%83%8C%E6%99%AF.jpg?s=1024x1024&w=is&k=20&c=...
			// https://media.istockphoto.com/id/1040315976/de/foto/frau-betrachten-aus-einer-h%C3%B6hle-von-matera-basilikata-italien.jpg?s=2048x2048&w=is&k=20&c=...
			// https://media.istockphoto.com/photos/dragon-tree-island-socotra-yemen-picture-id168737967?s=170x170
			domain === "media.istockphoto.com") {
			// https://media.gettyimages.com/photos/kristen-stewart-attends-the-chanel-parisnew-york-201819-metiers-dart-picture-id1152257105?k=6&m=1152257105&s=612x612&w=0&h=ldl1UENpuL1pgLlSO_GKwZTj0liOL4paEuFVjUCkv0E= -- no watermark
			// https://www.gettyimages.it/detail/fotografie-di-cronaca/kristen-stewart-attends-the-chanel-paris-new-fotografie-di-cronaca/1152257105
			// https://media.gettyimages.com/photos/kristen-stewart-attends-the-chanel-parisnew-york-201819-metiers-dart-picture-id1152257105
			//   https://media.gettyimages.com/photos/kristen-stewart-attends-the-chanel-parisnew-york-201819-metiers-dart-picture-id1152257105?s=2048x2048 -- 2048x1365 (watermark)
			// https://media.gettyimages.com/vectors/press-id-card-vector-id1061869092
			//   https://media.gettyimages.com/vectors/press-id-card-vector-id1061869092?s=2048x2048&w=5
			// &w=5 results in a smaller watermark (thanks to roi)
			// &w=6 looks similar, but seems to changes the image's colors slightly
			// todo: replace if !w=0 (no watermark) && s<2048
			// thanks to Broly on discord:
			// https://media.gettyimages.com/photos/-id641915860?s=2048x2048
			//   https://media.gettyimages.com/photos/silhouettes-of-concert-crowd-id641915860?s=2048x2048&w=5
			let imageinfo = common_functions["getty_image_info"](src);
			if (imageinfo) {
				// can't transform anymore
				if (false) {
				if (src.match(/\/(?:photos|vectors)\/+[^/?]*-id[0-9]+(?:[?#].*)?$/)) {
					let problems = undefined;
					if (!imageinfo["watermark"]) {
						problems = {watermark: true}
					}

					newsrc = src.replace(/(-id[0-9]+)(?:[?#].*)?$/, "$1?s=2048x2048&w=5");
					if (newsrc !== src) {
						return {
							url: newsrc,
							head_wrong_contenttype: true,
							head_wrong_contentlength: true,
							problems: problems
						}
					}
				}

				// thanks to roi:
				// https://media.gettyimages.com/id/1244039921/photo/gabon-accession-to-the-commonwealth.webp?s=2048x2048&w=gi&k=20&c=pEsfFAm-QC-M8QLeFF4tqMHKKrVP-zbC0kOzNEBcuK0=
				//   https://media.gettyimages.com/photos/gabon-accession-to-the-commonwealth-id1244039921?s=2048x2048&w=5
				newsrc = common_functions["getty_transform_url"](src);
				if (newsrc !== src) {
					if (!imageinfo["watermark"]) {
						return {
							url: newsrc,
							problems: {
								watermark: true
							}
						};
					} else {
						return newsrc;
					}
				}
				}

				return {
					url: "https://www.gettyimages.com/detail/a/a/" + imageinfo["id"],
					is_pagelink: true
				};
			}
		}

		if (domain_nowww === "distrowatch.com") {
			// https://distrowatch.com/images/screenshots/redcore-1908-dark-small.png
			//   https://distrowatch.com/images/screenshots/redcore-1908-dark.png
			// https://distrowatch.com/images/slinks/freebsd-small.png
			//   https://distrowatch.com/images/slinks/freebsd.png
			return src.replace(/(\/images\/+(?:screenshots|slinks)\/+[^/]*)-small(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "tengritravel.kz") {
			// https://tengritravel.kz/userdata/images/u281/resized/80c6efdda569780db808280a166818b7.jpg
			//   https://tengritravel.kz/userdata/images/u281/80c6efdda569780db808280a166818b7.jpg
			return src.replace(/(\/userdata\/+images\/+u[0-9]+\/+)resized\/+/, "$1");
		}

		if (domain === "tb.ziareromania.ro") {
			// http://tb.ziareromania.ro/In-ciuda-crizei-financiare--Dubaiul-organizeaza--petrecerea-deceniului-/8c55d1718d90b6914/327/0/1/70/In-ciuda-crizei-financiare--Dubaiul-organizeaza--petrecerea-deceniului-.jpg
			//   http://s1.ziareromania.ro/?mmid=8c55d1718d90b6914
			// other:
			// http://s2.ziareromania.ro/?mmid=2cb0755eacb4830cea -- 967x1055
			// http://s2.ziareromania.ro/?mmid=e8e424c149e0270e3 -- 3000x2086 (s1 is the same size)
			// http://s1.ziareromania.ro/?mmid=f00cc55fe8d4070c76 -- 1024x805
			return src.replace(/:\/\/tb\.([^/]*)\/+[^/]*\/+([0-9a-f]{15,})\/.*/, "://s1.$1/?mmid=$2");
		}

		if (domain_nowww === "povarenok.ru") {
			// https://www.povarenok.ru/images/users/30_11_09/small/238931.jpg
			//   https://www.povarenok.ru/images/users/30_11_09/238931.jpg
			return src.replace(/(\/images\/+[^/]*\/+[0-9]{2}_[0-9]{2}_[0-9]{2}\/+)[a-z]+\/+([0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "i.servimg.com") {
			// https://i.servimg.com/u/f43/11/43/57/21/tm/dubai-10.jpg
			//   https://i.servimg.com/u/f43/11/43/57/21/dubai-10.jpg
			return src.replace(/\/tm\/+([^/]*\.[^/.]*)(?:[?#].*)?$/, "/$1");
		}

		if (domain_nowww === "ammonnews.net") {
			// http://www.ammonnews.net/image.php?token=4c5c89246d62e1dd9dbb6a8d746e6b75&size=small
			//   http://www.ammonnews.net/image.php?token=4c5c89246d62e1dd9dbb6a8d746e6b75
			return src.replace(/\/image\.php\?(?:.*?&)?token=([0-9a-f]+).*?$/, "/image.php?token=$1");
		}

		if (domain === "f.mahmure.com") {
			// http://f.mahmure.com/images/galeri2/galeri_37790/thumbnail/110x165_selena_gomez_sxsw__2013_19.jpg
			//   http://f.mahmure.com/images/galeri2/galeri_37790/selena_gomez_sxsw__2013_19.jpg
			return src.replace(/(\/galeri2\/+galeri_[0-9]+\/+)thumbnail\/+[0-9]+x[0-9]+_([^/]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "img.eronrg.com" ||
			// http://eronrg.com/gallery/1967/small/siskegirls_ru_thumb_6.jpg
			//   http://eronrg.com/gallery/1967/big/siskegirls_ru_img_6.jpg
			domain_nowww === "eronrg.com") {
			// http://img.eronrg.com/gallery/2462/small/siskegirls_ru_thumb_1.jpg
			//   http://img.eronrg.com/gallery/2462/big/siskegirls_ru_img_1.jpg
			return src.replace(/(\/gallery\/+[0-9]+\/+)small\/+([^/]*_)thumb(_[0-9]+)(\.[^/.]*)(?:[?#].*)?$/, "$1big/$2img$3$4");
		}

		if (domain_nowww === "boobz.dk") {
			// http://www.boobz.dk/e/elizabeth_ann_hilden/th/140_small.jpg
			//   http://www.boobz.dk/e/elizabeth_ann_hilden/140.jpg
			return src.replace(/\/th\/+([0-9]+)_[a-z]+\./, "/$1.");
		}

		if (domain_nowww === "redbloodedthing.com") {
			// http://redbloodedthing.com/galleries/thumbs/oldgalleryc0d1c6fda555664eb44da0a397947118/250-default-01.jpg
			//   http://redbloodedthing.com/galleries/images/oldgalleryc0d1c6fda555664eb44da0a397947118/600-01.jpg
			return src.replace(/\/galleries\/+thumbs\/+(oldgallery[0-9a-f]{20,}\/+)[0-9]+(?:-[a-z]+)?-([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/galleries/images/$1600-$2");
		}

		if (domain_nowww === "b92.net") {
			// https://www.b92.net/news/pics/2017/11/29/16360697295a1ed1194c45d518464658_w640.jpg
			//   https://www.b92.net/news/pics/2017/11/29/16360697295a1ed1194c45d518464658_orig.jpg
			return src.replace(/(\/pics\/+[0-9]{4}\/+[0-9]{2}\/+[0-9]{2}\/+[0-9]+[0-9a-f]+[0-9]+)_[wh][0-9]+\./, "$1_orig.");
		}

		if (domain_nosub === "albumoftheyear.org" && /^cdn[0-9]*\./.test(domain)) {
			// https://cdn2.albumoftheyear.org/215x/album/164514-dsvii.jpg
			//   https://cdn2.albumoftheyear.org/album/thumbs/164514-dsvii.jpg
			//   https://cdn2.albumoftheyear.org/album/164514-dsvii.jpg
			// thanks to anonymous for reporting:
			// https://cdn.albumoftheyear.org/user/thumbs/kobeniscar_1651091712.jpg
			//   https://cdn.albumoftheyear.org/user/kobeniscar_1651091712.jpg
			return src.replace(/(:\/\/[^/]+\/+)(?:[0-9]+x\/+)?([a-z]+\/+)(?:thumbs\/+)?/, "$1$2");
		}

		if (domain_nowww === "rap4ever.org") {
			// https://www.rap4ever.org/uploads/albums/september2019/Sinead-Harnett-Lessons-in-Love300X300.jpg
			//   https://www.rap4ever.org/uploads/albums/september2019/Sinead-Harnett-Lessons-in-Love.jpg
			return src.replace(/(\/uploads\/+albums\/+[^/]*\/+[^/]*?)[0-9]+X[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "musicmeter.nl") {
			// https://www.musicmeter.nl/images/cover/763000/763511.300.jpg?cb=1565079210
			//   https://www.musicmeter.nl/images/cover/763000/763511.jpg?cb=1565079210
			return src.replace(/(\/images\/+cover\/+[0-9]+\/+[0-9]+\.)[0-9]+\.([^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "ecp.yusercontent.com") {
			// https://ecp.yusercontent.com/mail?url=https%3A%2F%2Fgallery.mailchimp.com%2Fb97af57acd7c0b54cc2e26fde%2Fimages%2Fd0f84ca8-53f4-475c-a953-44d5d36ced5b.jpeg&t=1564674507&ymreqid=c2542173-2c51-4fcd-2fdc-570035010000&sig=7uBqYrqYFnX3CzbiL6nawg--~C
			//   https://gallery.mailchimp.com/b97af57acd7c0b54cc2e26fde/images/d0f84ca8-53f4-475c-a953-44d5d36ced5b.jpeg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+mail\?(?:.*?&)?url=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "foto.sondakika.com") {
			// https://foto.sondakika.com/haber/2019/09/24/son-dakika-ankara-cumhuriyet-bassavciligi-sinav-12456401_5647_170.jpg
			//   https://foto.sondakika.com/haber/2019/09/24/son-dakika-ankara-cumhuriyet-bassavciligi-sinav-12456401_5647_osd.jpg
			return src.replace(/(\/haber\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[^/]*-[0-9]+_[0-9]+)_[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1_osd$2");
		}

		if (domain_nowww === "segre.to") {
			// https://segre.to/a/shouts/ZymQnbPnj3Rv7ZVAaye/VayAnVjj1nvJK44wAEE_hq.jpg
			//  https://segre.to/a/shouts/ZymQnbPnj3Rv7ZVAaye/VayAnVjj1nvJK44wAEE.jpg  -- 2000x2400
			return src.replace(/(\/shouts\/+[^/]*\/+[^/]*)_hq(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "img.fotodom.ru") {
			// http://img.fotodom.ru/QV04-2555.jpg?size=s
			obj = [];

			regex = /(:\/\/[^/]*\/+[^/?]*)(?:\?size=[sml])?(?:\#.*)?$/;
			newsrc = src.replace(regex, "$1?size=l");
			if (newsrc !== src)
				obj.push({
					url: newsrc,
					problems: {
						watermark: true
					}
				});

			newsrc = src.replace(regex, "$1?size=m");
			if (newsrc !== src)
				obj.push({
					url: newsrc,
					problems: {
						smaller: true
					}
				});

			return obj;
		}

		if (domain === "d3m2o2bzrl719s.cloudfront.net") {
			// https://d3m2o2bzrl719s.cloudfront.net/photos/2019/02/christian-siriano-fw19-runway-show/gallery_e01bb255-9c85-4da2-b0df-4156883ab2d5.JPG
			//   https://d3m2o2bzrl719s.cloudfront.net/photos/2019/02/christian-siriano-fw19-runway-show/lightbox_e01bb255-9c85-4da2-b0df-4156883ab2d5.JPG
			// other:
			// https://d3m2o2bzrl719s.cloudfront.net/photos/2018/02_February18/07/The_Blue_Jacket_Fashion_Show_Benefiting_Prostate_Cancer_Foundation/Selected/gallery_6365366598339006669054352_3_775108381NM091_The_Blue_Jac.JPG -- 3600x2400, no watermark
			//   https://d3m2o2bzrl719s.cloudfront.net/photos/2018/02_February18/07/The_Blue_Jacket_Fashion_Show_Benefiting_Prostate_Cancer_Foundation/Selected/lightbox_6365366598339006669054352_3_775108381NM091_The_Blue_Jac.JPG -- 713x475, watermarked
			// https://d3m2o2bzrl719s.cloudfront.net/sliders/4e072e65-a8cd-4e04-a38e-1a2d5d7a3ba9.JPG -- 1349x600, replacing with other guids doesn't work
			obj = [];

			regex = /(:\/\/[^/]*\/+photos\/+[0-9]{4}\/+[0-9]{2}\/+[^/]+\/+)(?:gallery|lightbox)_([-0-9a-f]{20,}\.)/;
			newsrc = src.replace(regex, "$1lightbox_$2");
			if (false && newsrc !== src) // disabling because too many images get smaller
				obj.push({
					url: newsrc,
					problems: {
						watermark: true
					}
				});

			newsrc = src.replace(regex, "$1gallery_$2");
			if (newsrc !== src)
				obj.push({
					url: newsrc,
					problems: {
						smaller: true
					}
				});

			return obj
		}

		if (domain_nowww === "secureservercdn.net") {
			// https://secureservercdn.net/45.40.148.106/oh4.a07.myftpupload.com/wp-content/uploads/2019-03-20_0172.jpg
			//   http://oh4.a07.myftpupload.com/wp-content/uploads/2019-03-20_0172.jpg
			return src.replace(/^[a-z]+:\/\/[^/]*\/+(?:[0-9]+\.){3}[0-9]+\/+([^/]*\.[^/]*\/)/, "http://$1");
		}

		if (false && domain === "api.netnoticias.mx") {
			// https://api.netnoticias.mx/media/2019/08/26/preview_a47f0386a7fe1b4696295097a566aede35d82402.jpg
			//   https://api.netnoticias.mx/media/2019/08/26/_hda47f0386a7fe1b4696295097a566aede35d82402.jpg -- 1280x853, stretched?
			// https://api.netnoticias.mx/media/2019/08/23/preview_7156fc0ef4fc82186c6dd44696dbfc182fac5a9f.JPG
			//   https://api.netnoticias.mx/media/2019/08/23/_hd7156fc0ef4fc82186c6dd44696dbfc182fac5a9f.JPG -- stretched?
			// other:
			// https://api.netnoticias.mx/images/2018/08/30/b1HQLIupUvfmm.JPG -- 3264x2448
			return src.replace(/(\/media\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2})preview_([0-9a-f]{20,}\.[^/.]*)(?:[?#].*)?$/, "$1_hd$2");
		}

		if (domain === "cdn-yotpo-images-production.yotpo.com") {
			// https://cdn-yotpo-images-production.yotpo.com/instagram/6/17957285275230906/low_resolution.jpg
			//   https://cdn-yotpo-images-production.yotpo.com/instagram/6/17957285275230906/standard_resolution.jpg -- 1536x1536
			// other:
			// https://cdn-yotpo-images-production.yotpo.com/Product/110770801/83715126/original.png?1558838082
			newsrc = src.replace(/\/low_resolution(\.[^/.]*)(?:[?#].*)?$/, "/standard_resolution$1");
			if (newsrc !== src)
				return newsrc;

			// https://cdn-yotpo-images-production.yotpo.com/Product/94816388/77914457/facebook.png?1564765419 -- stretched
			//   https://cdn-yotpo-images-production.yotpo.com/Product/94816388/77914457/original.png?1564765419
			// https://cdn-yotpo-images-production.yotpo.com/Review/124351182/94024713/medium_square.jpg?1567878815
			//   https://cdn-yotpo-images-production.yotpo.com/Review/124351182/94024713/original.jpg?1567878815
			// http://cdn-yotpo-images-production.yotpo.com/Account/278495/87773147/medium_square.jpg?1563232768
			//   http://cdn-yotpo-images-production.yotpo.com/Account/278495/87773147/original.jpg?1563232768
			return src.replace(/(\/(?:Product|Review|Account)\/+[0-9]+\/+[0-9]+\/+)[a-z_]+(\.[^/.]*)(?:[?#].*)?$/, "$1original$2");
		}

		if (domain_nowww === "maquillagecreation.ch") {
			// http://maquillagecreation.ch/img/content/dark/makeup/comic256x340.jpg
			//   http://maquillagecreation.ch/img/content/dark/makeup/comic.jpg
			// http://maquillagecreation.ch/img/content/dark/symbio/symbio3_m.jpg
			//   http://maquillagecreation.ch/img/content/dark/symbio/symbio3.jpg
			return src.replace(/(\/img\/+content\/+[^/]*\/+[^/]*\/+[^/]*?)(?:_m|[0-9]+x[0-9]+)(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "image.gamer.ne.jp") {
			// thanks to fireattack on github: https://github.com/qsniyg/maxurl/issues/142
			// https://image.gamer.ne.jp/news/2019/20190909/002727856d434cbc81bc398e8b20960824e2/m/19.jpg
			//   https://image.gamer.ne.jp/news/2019/20190909/002727856d434cbc81bc398e8b20960824e2/o/19.jpg
			// doesn't work for all:
			// https://image.gamer.ne.jp/news/2019/20190925/00031a89bc15fd390cbc9dfaf447d5f6d32a/x/i.jpg -- o doesn't work, numbers do work, but x doesn't work for the numbers
			return src.replace(/(\/news\/+[0-9]{4}\/+[0-9]{8}\/+[0-9a-f]{20,}\/+)[a-z]\/+([0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1o/$2");
		}

		if (domain_nowww === "moviemagik.in") {
			// http://www.moviemagik.in/files/actors/632/thumb/Margot-Robbie-25.jpg
			//   http://www.moviemagik.in/files/actors/632/Margot-Robbie-25.jpg
			return src.replace(/(\/files\/+[^/]*\/+[0-9]+\/+)thumb\/+/, "$1");
		}

		if (domain_nowww === "itedou.com") {
			// http://www.itedou.com/Uploads/star_tupian/10388/26755_s.jpg
			//   http://www.itedou.com/Uploads/star_tupian/10388/26755.jpg
			return src.replace(/(\/Uploads\/+[^/]*\/+[0-9]+\/+[0-9]+)_s(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "img.cnread.news") {
			// https://img.cnread.news/uploads/20170923/00/006F5C5BA993w750h999_600x600_s1.jpeg
			//   https://img.cnread.news/uploads/20170923/00/006F5C5BA993w750h999.jpeg
			return src.replace(/(\/uploads\/+[0-9]+\/+[0-9A-F]{2}\/+[0-9A-F]+w[0-9]+h[0-9]+)(?:_[0-9]+x[0-9]+)?(?:_s[0-9]*)?(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "filmitena.com") {
			// https://filmitena.com/img/Actor/Big/1173_bg.jpg
			//   https://filmitena.com/img/Actor/Original/1173_or.jpg
			// https://filmitena.com/img/ImageTmb/7125_Tmb.jpg
			//   https://filmitena.com/img/Image/7125_mv.jpg
			//   https://filmitena.com/img/big/7125_bg.jpg
			return src
				.replace(/(\/img\/+Actor\/+)[a-zA-Z]+\/+([0-9]+)_[a-z]+(\.[^/.]*)(?:[?#].*)?$/i, "$1Original/$2_or$3")
				.replace(/(\/img\/+)Image(?:Tmb)?\/+([0-9]+)_[a-zA-Z]+(\.[^/.]*)(?:[?#].*)?$/i, "$1big/$2_bg$3");
		}

		if (domain_nowww === "fandimefilmu.cz") {
			// https://www.fandimefilmu.cz/files/images/2016/11/14/gallery_main_xhxhts94tw4o7jnn.jpg
			//   https://www.fandimefilmu.cz/files/images/2016/11/14/xhxhts94tw4o7jnn.jpg
			return src.replace(/(\/files\/+images\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2})[a-z_]+_([a-z0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "fetcher-cdn.nullmu.com") {
			// https://fetcher-cdn.nullmu.com/social/1788a9feb08efcb9c5b4dd78a481f638.jpg?u=https%3A%2F%2F66.media.tumblr.com%2F446f5455cf1dad3762256b7538ed8eda%2Ftumblr_pd3kx6a1cA1tiq8ryo1_1280.jpg
			//   https://66.media.tumblr.com/446f5455cf1dad3762256b7538ed8eda/tumblr_pd3kx6a1cA1tiq8ryo1_1280.jpg
			// https://fetcher-cdn.nullmu.com/social_preview/5be262ce261019def359d4f6930fb814.webp?u=https%3A%2F%2F66.media.tumblr.com%2F9b2d16279b0c8b74cbba39ba34fc5ff8%2Ftumblr_pd3x08NLTe1tiq8ryo1_1280.jpg
			//   https://66.media.tumblr.com/9b2d16279b0c8b74cbba39ba34fc5ff8/tumblr_pd3x08NLTe1tiq8ryo1_1280.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+social(?:_preview)?\/+[0-9a-f]{20,}\.[^/.?]*\?(?:.*&)?u=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nowww === "bharatstudent.com") {
			// http://www.bharatstudent.com/ng7uvideo/bs/gallery/thumb/events/bw/2010/oct/pyaar-kii-ye-ek-kahaani-serial-launch/pyaar-kii-ye-ek-kahaani-serial-launch_002.jpg
			//   http://www.bharatstudent.com/ng7uvideo/bs/gallery/normal/events/bw/2010/oct/pyaar-kii-ye-ek-kahaani-serial-launch/pyaar-kii-ye-ek-kahaani-serial-launch_002.jpg
			// other:
			// http://www.bharatstudent.com/ng7uvideo/bs/news/1216/6814-Aditi%20Rao%20Hydari%20-%20Condenast%20Traveller.jpg -- upscaled?
			// http://www.bharatstudent.com/ng7uvideo/bs/gallery/normal/events/bw/2010/aug/iijw-2010-day-5/iijw-2010-day-5_029.jpg -- 2336x3504
			return src.replace(/\/gallery\/+thumb\/+events\/+/, "/gallery/normal/events/");
		}

		if (domain === "mimgs.sulekha.com") {
			// http://mimgs.sulekha.com/hindi/ishkq-in-paris/images/event-photos/ishkq-in-paris-press-conference/spot2/ishkq-in-paris-press-conference-pics034.jpg
			//   http://mimgs.sulekha.com/hindi/ishkq-in-paris/events/ishkq-in-paris-press-conference/ishkq-in-paris-press-conference-pics034.jpg -- watermark
			//   http://mimgs.sulekha.com/hindi/ishkq-in-paris/images/event-photos/ishkq-in-paris-press-conference/ishkq-in-paris-press-conference-pics034.jpg -- larger
			// http://mimgs.sulekha.com/juhi-chawla/images/event-photos/juhi-chawla-promotes-hum-hain-raahi-car-ke-at-india-s-best-dramebaaz-sets/juhi-chawla-promotes-hum-hain-raahi-car-ke-at-india-s-best-dramebaaz-sets-pics022.jpg -- 770x1167
			//   http://mimgs.sulekha.com/juhi-chawla/events/juhi-chawla-promotes-hum-hain-raahi-car-ke-at-india-s-best-dramebaaz-sets/juhi-chawla-promotes-hum-hain-raahi-car-ke-at-india-s-best-dramebaaz-sets-pics022.jpg -- 500x758
			// http://mimgs.sulekha.com/hindi/baazaar/images/stills/thumbnail/baazaar-stills-08.jpg
			//   http://mimgs.sulekha.com/hindi/baazaar/images/stills/baazaar-stills-08.jpg -- watermark
			// other:
			// http://mimgs.sulekha.com/tamil/dev/images/stills/dev-images-044.jpg -- 3840x5760, watermark
			newsrc = src
				.replace(/\/(?:images\/+event-photos|events)\/+([^/]*\/+)spot[0-9]*\/+/, "/images/event-photos/$1")
				.replace(/\/images\/+stills\/+thumbnail\/+/, "/images/stills/");
			if (newsrc !== src)
				return {
					url: newsrc,
					problems: {
						watermark: true
					}
				};
		}

		if (domain_nowww === "i.indiglamour.com") {
			// http://i.indiglamour.com/photogallery/hindi/actress/2013/May6/Juhi-Chawla/normal/Juhi-Chawla_19418thmb.jpg -- 135x205
			//   http://i.indiglamour.com/photogallery/hindi/actress/2013/May6/Juhi-Chawla/normal/Juhi-Chawla_19418rs.jpg -- 633x960
			//   http://i.indiglamour.com/photogallery/hindi/actress/2013/May6/Juhi-Chawla/normal/Juhi-Chawla_19418.jpg -- 2648x4016
			return src.replace(/(\/photogallery\/+.*\/normal\/+[^/]*_[0-9]+)(?:thmb|rs)(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "mom50.com") {
			// http://mom50.com/galleries/ath/2019/05/7EN2c6/01_nth_ne_sz.jpg
			//   http://mom50.com/galleries/ath/2019/05/7EN2c6/01.jpg
			return {
				url: src.replace(/(\/galleries\/+[^/]*\/+[0-9]{4}\/+[0-9]{2}\/+[^/]*\/+[0-9]+)(?:_[a-z]+){1,}(\.[^/.]*)(?:[?#].*)?$/, "$1$2"),
				headers: {
					Referer: ""
				}
			};
		}

		if (domain_nowww === "fastpics.eu") {
			// http://fastpics.eu/paysiteset/13_8886/tn_005.jpg
			//   http://fastpics.eu/paysiteset/13_8886/005.jpg
			return src.replace(/\/tn_([^/]*\.[^/.]*)(?:[?#].*)?$/, "/$1");
		}

		if (domain_nowww === "forbidden-dreams.com" ||
			// http://www.porn-service.us/7/idy2/001_ci.jpg
			//   http://www.porn-service.us/7/idy2/ci_001.jpg
			domain_nowww === "porn-service.us") {
			// http://www.forbidden-dreams.com/j/glu3/001_ci.jpg
			//   http://www.forbidden-dreams.com/j/glu3/ci_001.jpg
			return src.replace(/\/([0-9]+)_ci(\.[^/.]*)(?:[?#].*)?$/, "/ci_$1$2");
		}

		if (domain_nowww === "iie8.com" ||
			// http://vq50.com/cdn/i/b09f92c0a6e450a3bf41be298f05dc46/th-x250/1.jpg
			//   http://vq50.com/cdn/i/b09f92c0a6e450a3bf41be298f05dc46/1.jpg
			domain_nowww === "vq50.com" ||
			// http://e1nn.com/cdn/i/62fda71ec5f2660dbd303ae609305aaa/th-x250/9.jpg
			//   http://e1nn.com/cdn/i/62fda71ec5f2660dbd303ae609305aaa/9.jpg
			domain_nowww === "e1nn.com") {
			// http://iie8.com/cdn/i/752257dcd433ccce2e15fe4c3617c84c/th-x250/3.jpg
			//   http://iie8.com/cdn/i/752257dcd433ccce2e15fe4c3617c84c/3.jpg
			return src.replace(/(\/cdn\/+i\/+[0-9a-f]{10,}\/+)th-[0-9]*x[0-9]*\/+/, "$1");
		}

		if (domain_nowww === "lustfulmodels.com") {
			// http://www.lustfulmodels.com/k/kacie-james/ivwvt3/s_01.jpg
			//   http://www.lustfulmodels.com/k/kacie-james/ivwvt3/01.jpg
			return src.replace(/\/s_([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/$1");
		}

		if (domain_nowww === "tannerbucks.com") {
			// http://www.tannerbucks.com/cs/spunky_angels_kacie-james_daddy/index_files/tn001.jpg
			//   http://www.tannerbucks.com/cs/spunky_angels_kacie-james_daddy/001.jpg
			return src.replace(/\/index_files\/+tn([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/$1");
		}

		if (domain === "galleries.imctrck.com") {
			// http://galleries.imctrck.com/1/0/36875/tn/1.jpg
			//   http://galleries.imctrck.com/1/0/36875/images/1.jpg
			return src.replace(/\/tn\/+([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/images/$1");
		}

		if (domain_nowww === "boobgoddess.com") {
			// http://www.boobgoddess.com/thumbs4/tn_cosmid_evagreen01.jpg
			//   http://www.boobgoddess.com/pics4/cosmid_evagreen01.jpg
			return src.replace(/\/thumbs([0-9]*)\/+tn_/, "/pics$1/");
		}

		if (domain_nowww === "nextpicturez.com") {
			// http://www.nextpicturez.com/gallery/cosmid/evas-workout/thumbs/eva-green-01.jpg
			//   http://www.nextpicturez.com/gallery/cosmid/evas-workout/eva-green-01.jpg
			return src.replace(/(\/gallery\/.*\/)thumbs\/+/, "$1");
		}

		if (domain_nowww === "porngals4.com") {
			// https://www.porngals4.com/131714
			// https://www.porngals4.com/riley-anne-loves-your-attention-131714/
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+(?:[-a-z]+-)?([0-9]+)\/*(?:[?#].*)?$/,
				query_for_id: "https://www.porngals4.com/a-${id}/",
				override_cb: function(cb, data) {
					if (!data) return cb(data);

					var imu_id = src.match(/#imu-id=([0-9]+-[0-9]+)$/);
					if (!imu_id) return cb(data);

					imu_id = imu_id[1];

					array_foreach(data.album_info.links, function(link) {
						var link_id = link.url.match(/-([0-9]+-[0-9]+)\./)[1];
						if (link_id === imu_id) {
							data.url = link.url;
							data.album_info.links[0].is_current = false;
							link.is_current = true;
							return false;
						}
					});

					cb(data);
				},
				process: function(done, resp, cache_key, match) {
					var obj = {
						extra: {
							page: resp.finalUrl,
							caption: get_meta(resp.responseText, "og:title")
						}
					};

					var id = match[1];

					var gal_info = resp.responseText.match(/<div class="hide" id="gp">({.*?})<\/div>/);
					if (!gal_info) {
						console_error(cache_key, "Unable to find info div from", resp);
						return done(null, false);
					}

					gal_info = JSON_parse(gal_info[1]);
					var imagelist = gal_info.imgl;

					//var galleries_url = resp.responseText.match(/G\.b_b\s*=\s*'(https?:\/\/[^/]+\/+media\/+galleries\/)'/);
					var galleries_url = resp.responseText.match(/<a href="(https?:\/\/[a-z]\.[^/]+\/+media\/+galleries\/+)[0-9]+\/+[0-9]+\/+[0-9]+-[0-9]+\/+[^/]+-[0-9]+-[0-9]+\.[^/."]+?"/);
					if (!galleries_url) {
						console_error(cache_key, "Unable to find galleries URL from", resp);
						return done(null, false);
					}

					galleries_url = galleries_url[1];

					var images = [];
					array_foreach(imagelist, function(image) {
						images.push({
							url: galleries_url + image.gal.d1 + "/" + image.gal.d2 + "/" + image.gal_id + "-" + image.gal.serial + "/" + image.gal.url + "-" + image.image_id + "-" + image.serial + "." + image.ext,
							is_current: false
						});
					});

					images[0].is_current = true;

					return done({
						url: images[0].url,
						extra: obj.extra,
						album_info: {
							type: "links",
							links: images
						}
					}, 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nosub === "porngals4.com") {
			// https://b.porngals4.com/media/galleries_523x774/1/25/131714-4070946890/riley-anne-loves-your-attention-6308911-1012492388.jpg
			//   https://b.porngals4.com/media/galleries/1/25/131714-4070946890/riley-anne-loves-your-attention-6308911-1012492388.jpg
			// https://b.porngals4.com/media/galleries_700/1/26/135837-702760244/irene-rouse-relax-6374255-1237151828.jpg
			newsrc = src.replace(/\/media\/+galleries_[0-9]+(?:x[0-9]+)?\/+/, "/media/galleries/");
			if (newsrc !== src)
				return newsrc;

			// https://a.porngals4.com/media/gals_169x150/1/25/131714-4070946890/6308912-3994080388.jpg
			//   https://a.porngals4.com/media/galleries/1/25/131714-4070946890/riley-anne-loves-your-attention-6308912-3994080388.jpg
			//   https://b.porngals4.com/media/galleries/1/25/131714-4070946890/riley-anne-loves-your-attention-6308912-3994080388.jpg
			match = src.match(/^[a-z]+:\/\/[^/]*\/+media\/+(?:gals|galleries)(?:_[0-9]+(?:x[0-9]+)?)?\/+[0-9]+\/+[0-9]+\/+([0-9]+)-[0-9]+\/+(?:[-a-z]+)?([0-9]+-[0-9]+)\./);
			if (match) {
				return {
					url: "https://www.porngals4.com/" + match[1] + "/#imu-id=" + match[2],
					is_pagelink: true
				};
			}

			// https://a.porngals4.com/media/gals_300x210/1/27/138910-3254050071.jpg
			match = src.match(/^[a-z]+:\/\/[^/]*\/+media\/+gals_[0-9]+(?:x[0-9]+)?\/+[0-9]+\/+[0-9]+\/+([0-9]+)-[0-9]+\./);
			if (match) {
				return {
					url: "https://www.porngals4.com/" + match[1],
					is_pagelink: true
				};
			}
		}

		if (domain_nowww === "archivegalleries.net") {
			// http://archivegalleries.net/collection/aj/2017/12/r9TMoKs/01_ajsize.jpg
			//   http://archivegalleries.net/collection/aj/2017/12/r9TMoKs/01.jpg
			return {
				url: src.replace(/(\/collection\/.*\/[0-9]+)_[a-z]+size(\.[^/.]*)(?:[?#].*)?$/, "$1$2"),
				headers: {
					Referer: ""
				}
			};
		}

		if (domain_nosub === "alsscan.com" && /^(?:s|adv)[0-9]*\./.test(domain)) {
			// http://s4.alsscan.com/graphics/models/winterjade/sample04s.jpg
			//   http://s4.alsscan.com/graphics/models/winterjade/sample04.jpg
			return src.replace(/\/([a-z]*sample[0-9]+)s(\.[^/.]*)(?:[?#].*)?$/, "/$1$2");
		}

		if (domain_nowww === "mnvg.com") {
			// https://mnvg.com/gallery/265/1.jpg
			//   https://mnvg.com/gallery/265/1-full.jpg
			return src.replace(/(\/gallery\/+[0-9]+\/+[0-9]+)(\.[^/.]*)(?:[?#].*)?$/, "$1-full$2");
		}

		if (domain_nowww === "pornpaw.com") {
			// https://www.pornpaw.com/showthumb.php?thumblink=https://x1.fap.to/images/thumb/65/142/1422552308.jpg
			//   https://x.fap.to/images/full/65/142/1422552308.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+showthumb\.php\?(?:.*?&)?thumblink=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nosub === "newstracklive.com") {
			// https://www.newstracklive.com/uploads/entertainment-news/bollywood-news/Jun/20/med_thumb/arjun-kapoo_5d0b5dd3de74d.jpg
			//   https://www.newstracklive.com/uploads/entertainment-news/bollywood-news/Jun/20/big_thumb/arjun-kapoo_5d0b5dd3de74d.jpg
			// https://media.newstracklive.com/uploads/entertainment-news/bollywood-news/Jun/20/med_thumb/arjun-kapoo_5d0b5dd3de74d.jpg
			//   https://media.newstracklive.com/uploads/entertainment-news/bollywood-news/Jun/20/big_thumb/arjun-kapoo_5d0b5dd3de74d.jpg
			// other:
			// https://media.newstracklive.com/uploads/trending-viral-news/offbeat/Sep/09/big_thumb/flight2_5d75d43a18568.jpg -- 3035x675
			// https://media.newstracklive.com/uploads/ckeditor/1552719329.jpg -- 2136x3238
			return src.replace(/(\/uploads\/+.*\/+[0-9]{1,2}\/+)[a-z]+_thumb\/+/, "$1big_thumb/");
		}

		if (domain_nowww === "ap7am.com") {
			// https://www.ap7am.com/backimages/telugu-news/thumbs/tnews-0d2afa7999acb44a98431e061f7fabbd572618b9.jpg
			//   https://www.ap7am.com/backimages/telugu-news/bigimages/tnews-0d2afa7999acb44a98431e061f7fabbd572618b9.jpg
			// other:
			//   https://www.ap7am.com/backimages/froala-uploads/froala-691e4671e8b2d9298fc0d390273a108f1fde86f3.jpg
			return src.replace(/(\/backimages\/+telugu-news\/+)thumbs\/+(tnews-)/, "$1bigimages/$2");
		}

		if (domain === "api.parkseason.ru") {
			// https://api.parkseason.ru/images/styles/1080_720/68/fa/bca69c4e15a6824b18059f5db7b95d735cf4f2bf84675031190942.jpg
			//   https://api.parkseason.ru/images/68/fa/bca69c4e15a6824b18059f5db7b95d735cf4f2bf84675031190942.jpg
			return src.replace(/\/images\/+styles\/+[^/]*\/+/, "/images/");
		}

		if (domain === "s-cdn.sportbox.ru") {
			// thanks to roi
			// https://s-cdn.sportbox.ru/images/styles/500x280n/fp_fotos/87/56/f3be108cd045dbec14554b3b3eaf56a863f913b4c9b33192010649.jpg
			//   https://s-cdn.sportbox.ru/images/styles/upload/fp_fotos/87/56/f3be108cd045dbec14554b3b3eaf56a863f913b4c9b33192010649.jpg
			// https://s-cdn.sportbox.ru/images/styles/960_auto/fp_fotos/87/56/f3be108cd045dbec14554b3b3eaf56a863f913b4c9b33192010649.jpg
			//   https://s-cdn.sportbox.ru/images/styles/upload/fp_fotos/87/56/f3be108cd045dbec14554b3b3eaf56a863f913b4c9b33192010649.jpg
			return src.replace(/\/images\/+styles\/+[^/]+\/+/, "/images/styles/upload/");
		}

		if (domain_nowww === "vgamuseum.info") {
			// http://www.vgamuseum.info/images/tech/smart_thumbs/s3tcut_thumb_other200_0.jpg
			//   http://www.vgamuseum.info/images/tech/s3tcut.jpg
			return src.replace(/\/smart_thumbs\/+([^/]*?)_thumb_other[0-9]+_[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "/$1$2");
		}

		if (domain_nowww === "metager.org") {
			// https://metager.org/meta/picture?url=https%3A%2F%2Ftse1.mm.bing.net%2Fth%3Fid%3DOIP.Kl7SFnc-Bb9bFUcd_EN0gQHaML%26pid%3DApi
			//   https://tse1.mm.bing.net/th?id=OIP.Kl7SFnc-Bb9bFUcd_EN0gQHaML
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+meta\/+picture\?(?:.*&)?url=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "i.swisscows.ch") {
			// https://i.swisscows.ch/?link=http%3a%2f%2fcelebmafia.com%2fwp-content%2fuploads%2f2016%2f04%2fselena-gomez-we-day-california-2016-in-inglewood-4-7-2016-14.jpg
			//   https://celebmafia.com/wp-content/uploads/2016/04/selena-gomez-we-day-california-2016-in-inglewood-4-7-2016-14.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+\?link=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "cdn.swisscows.ch") {
			// https://cdn.swisscows.ch//https://tse1.mm.bing.net/th?id=OIP.Csk8M-_nU1zOLBhPhqp9SwHaDH&pid=Api
			//   https://tse1.mm.bing.net/th?id=OIP.Csk8M-_nU1zOLBhPhqp9SwHaDH
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+(https?:)/, "$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nowww === "mithaaprilia.com") {
			// https://www.mithaaprilia.com/image?id=6461696c796d6f74696f6e26783335396b776c&q=http://s1.dmcdn.net/N2uxj.jpg
			//   http://s1.dmcdn.net/N2uxj.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+image\?(?:.*?&)?q=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nowww === "proprofs.com") {
			// https://www.proprofs.com/games/puzzle/sliding/resize_image.php?image=https://proprofs-cdn.s3.amazonaws.com/images/games/user_images/misc/2141680024.jpg&new_width=223&new_height=176
			//   https://proprofs-cdn.s3.amazonaws.com/images/games/user_images/misc/2141680024.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+games\/+puzzle\/+sliding\/+resize_image\.php\?(?:.*?&)?image=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nowww === "sweetgirl.org") {
			// https://sweetgirl.org/files/sets/2017/09-24-jillisa-lynn-dancer-in-pink/thumb/jillisa-lynn-dancer-in-pink-001.jpg
			//   https://sweetgirl.org/files/sets/2017/09-24-jillisa-lynn-dancer-in-pink/jillisa-lynn-dancer-in-pink-001.jpg
			return src.replace(/(\/files\/+sets\/+[0-9]+\/+[^/]*\/+)thumb\/+/, "$1");
		}

		if (domain === "img.lady.ru") {
			// http://img.lady.ru/data/aphoto/7/2/3/85424/small/609305.jpg
			//   http://img.lady.ru/data/aphoto/7/2/3/85424/large/609305.jpg
			// other:
			// https://www.lady.ru/moda/%D0%A1%D0%B0%D1%80%D0%B0-%D0%A1%D0%B0%D0%BC%D0%BF%D0%B0%D0%B9%D0%BE/10-%D0%BD%D0%BE%D0%B2%D1%8B%D1%85-%D0%B0%D0%BD%D0%B3%D0%B5%D0%BB%D0%BE%D0%B2-Victoria%E2%80%99s-Secret-%D0%B2-%D0%BF%D1%80%D0%BE%D0%BC%D0%BE-%D1%84%D0%BE%D1%82%D0%BE%D1%81%D0%B5%D1%81%D1%81%D0%B8%D0%B8-%D0%B1%D0%B5%D0%BB%D1%8C%D1%8F-2015-Body-by-Victoria-%D0%BF%D0%B5%D1%80%D0%B2%D1%8B%D0%B5-%D0%BA%D0%B0%D0%B4%D1%80%D1%8B
			// http://img.lady.ru/data/aphoto/7/2/3/85424/large/609310.jpg
			//   http://img.lady.ru/data/aphoto/7/2/3/85424/main/40bb88334c807ff07b0cc5c3e9a7f765.jpg
			newsrc = src.replace(/(\/data\/+aphoto\/.*\/)small\/+/, "$1large/");
			if (newsrc !== src)
				return newsrc;

			// http://img.lady.ru/data/users/0/0/9700/small.jpg
			//   http://img.lady.ru/data/users/0/0/9700/large.jpg
			newsrc = src.replace(/(\/data\/+users\/.*\/)small(\.[^/.]*)(?:[?#].*)?$/, "$1large$2");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nowww === "cfake.com" ||
			// http://krishna24.ru/medias/thumbs/155538743247afe499_cfake.jpg
			//   http://krishna24.ru/medias/photos/155538743247afe499_cfake.jpg
			domain_nowww === "krishna24.ru" ||
			// http://lovedat.ru/medias/thumbs/139318625228d7e3bf_cfake.jpg
			//   http://lovedat.ru/medias/photos/139318625228d7e3bf_cfake.jpg
			domain_nowww === "lovedat.ru") {
			// http://cfake.com/medias/thumbs/15307934167f319894_cfake.jpg
			//   http://cfake.com/medias/photos/15307934167f319894_cfake.jpg
			//   http://cfake.com/medias/ophotos/15307934167f319894_cfake.jpg
			return src.replace(/\/medias\/+(?:thumbs|photos)\/+/, "/medias/ophotos/");
		}

		if (domain === "images.galleries.pornpros.com" ||
			domain === "videos.galleries.pornpros.com") {
			// http://images.galleries.pornpros.com/galleries.pornpros.com/htdocs/pb05/pb05_024/thumbs/girl1/01.jpg
			//   http://images.galleries.pornpros.com/galleries.pornpros.com/htdocs/pb05/pb05_024/content/girl1/01.jpg
			return src
				.replace(/(\/htdocs\/+[^/]+\/+[^/]+\/+content\/+)thumbs\/+([0-9]+\.[^/.]+)(?:[?#].*)?$/, "$1full/$2")
				.replace(/(\/htdocs\/+[^/]+\/+[^/]+\/+)thumbnails\/+([0-9]+\.[^/.]+)(?:[?#].*)?$/, "$1full/$2")
				.replace(/(\/htdocs\/+[^/]+\/+[^/]+\/+)thumbs\/+([^/]+\/+[0-9]+\.[^/.]+)(?:[?#].*)?$/, "$1content/$2");
		}

		if (domain_nosub === "pornpros.com" && /^images\.r[0-9]*\./.test(domain)) {
			// https://images.r1.cdn.pornpros.com/zFKGq1B3kDuOMl9cY7XQraFrwSQ=/475x268/center/middle/smart/content/videos/3/3/8/3383ca2d-710b-4e5b-9ab8-895f8478b78c/handtouched/019.jpg
			//   https://images.galleries.pornpros.com/content/videos/3/3/8/3383ca2d-710b-4e5b-9ab8-895f8478b78c/handtouched/019.jpg
			return src.replace(/:\/\/[^/]+\/+[^/]+\/+[0-9]+x[0-9]+\/+center\/+middle\/+smart\/+(content\/+)/, "://images.galleries.pornpros.com/$1");
		}

		if (domain_nowww === "sks-52.ru" ||
			// https://gals.kindgirls.com/d3/melena_10938/m6/melena_10938_1.jpg
			//   https://gals.kindgirls.com/d3/melena_10938/melena_10938_1.jpg
			domain === "gals.kindgirls.com") {
			// http://sks-52.ru/d3/tais_21_46792/m6/tais_21_46792_1.jpg
			//   http://sks-52.ru/d3/tais_21_46792/tais_21_46792_1.jpg
			return src.replace(/(\/d[0-9]+\/+[^/]*\/+)m[0-9]+\/+/, "$1");
		}

		if (domain === "abc.2008php.com") {
			// https://abc.2008php.com/2014_smallimg/2014-12-19/20141219222827.jpg
			//   https://abc.2008php.com/2014_Website_appreciate/2014-12-19/20141219222827.jpg
			return src.replace(/(\/[0-9]+_)smallimg\/+/, "$1Website_appreciate/");
		}

		if (domain === "pro.imgcdn2.com") {
			// http://pro.imgcdn2.com/?tag=a&url=mmbizz-zqpicz-zcn/mmbiz/cfoN9rDaic6yWlTR4upt9g39k8qqic3vPVKdN0GhqH7eMreGibx7IiajGib2hiaZTYH40dwRPjtYNCaCAJf7YWohDbQg/640?wx_fmt=other
			//   http://mmbiz.qpic.cn/mmbiz/cfoN9rDaic6yWlTR4upt9g39k8qqic3vPVKdN0GhqH7eMreGibx7IiajGib2hiaZTYH40dwRPjtYNCaCAJf7YWohDbQg/0
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+\?(?:.*&)?url=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return add_http(decodeuri_ifneeded(newsrc.replace(/z-z/g, ".")));
		}

		if (domain_nowww === "girlswithmuscle.com") {
			// https://www.girlswithmuscle.com/images/thumbs/61090.jpg
			//   https://www.girlswithmuscle.com/images/full/61090.jpg
			// https://www.girlswithmuscle.com/images/thumbs/1322758.jpg?2
			//   https://www.girlswithmuscle.com/images/full/1322758.mp4?2
			newsrc = src.replace(/\/images\/+thumbs\/+([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/images/full/$1");
			if (newsrc !== src) {
				return add_full_extensions(newsrc, ["mp4", "jpg"], true);
			}
		}

		if (domain === "img.jiahes.com") {
			// http://img.jiahes.com/upload/image/imagetv/68/c_2551.jpg -- 254x379
			//   http://img.jiahes.com/upload/image/imagetv/68/1.jpg
			// http://img.jiahes.com/upload/image/imagetv/3/c_3301.jpg -- 330x452
			//   http://img.jiahes.com/upload/image/imagetv/3/1.jpg
			return src.replace(/(\/upload\/+image\/+[^/]*\/+[0-9]+\/+)c_[0-9]{3}([0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "img.peta2.jp") {
			// https://img.peta2.jp/img/upload/th/0646000-0647000/0646775/co_143_1_thumb300.jpg?sel=
			//   https://img.peta2.jp/img/upload/th/0646000-0647000/0646775/co_143_1_240.jpg?sel=
			//   https://img.peta2.jp/img/upload/th/0646000-0647000/0646775/co_143_1_org.jpg?sel=
			return src.replace(/(\/img\/+upload\/+th\/+[0-9]+-[0-9]+\/+[0-9]+\/+[^/]*_[0-9]+_[0-9]+)_(?:thumb)?[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1_org$2");
		}

		if (domain_nowww === "fakty.ua") {
			// https://fakty.ua/photos/articles/18/9/18961w800h600zc0.jpg
			//   https://fakty.ua/photos/articles/18/9/18961.jpg
			return src.replace(/(\/photos\/+articles\/+[0-9]{2}\/+[0-9]\/+[0-9]+)(?:[a-z][0-9]*){1,}(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "metrosport.gr") {
			// http://www.metrosport.gr/images/thumbs_medium/ucJCjqoIlxuk7MOCf7A8.jpg -- upscaled?
			//   http://www.metrosport.gr/images/ucJCjqoIlxuk7MOCf7A8.jpg
			return src.replace(/\/images\/+thumbs_[a-z]+\/+/, "/images/");
		}

		if (domain_nowww === "boobieblog.com") {
			// https://www.boobieblog.com/img3/OliviaAustinRealRealityPM1_small.jpg
			//   https://www.boobieblog.com/img3/OliviaAustinRealRealityPM1.jpg
			return src.replace(/(\/img[0-9]*\/+[^/]*)_small(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nosub === "wearehairy.com" && /^cdn[0-9]*\./.test(domain)) {
			// http://cdn.wearehairy.com/models/Ocean_Sky/Ocean_Sky_is_rocking_and_rolling/th/OceanSky_LeopardLeggings_001.jpg
			//   http://cdn.wearehairy.com/models/Ocean_Sky/Ocean_Sky_is_rocking_and_rolling/img/OceanSky_LeopardLeggings_001.jpg
			// http://cdn10.wearehairy.com/models/Amber_S/Amber_S_shows_off_fall_all_natural_figure/th/AmberS_PinkStockingsPinkLingerie_001.jpg
			//   http://cdn10.wearehairy.com/models/Amber_S/Amber_S_shows_off_fall_all_natural_figure/img/AmberS_PinkStockingsPinkLingerie_001.jpg
			return src.replace(/\/th\/+([^/]*\.[^/.]*)(?:[?#].*)?$/, "/img/$1");
		}

		if (domain === "cdn.picson.mobi") {
			// http://cdn.picson.mobi/300/513/157009/1.jpg
			//   http://cdn.picson.mobi/original/513/157009/1.jpg
			return src.replace(/(:\/\/[^/]*\/+)[0-9]+\/+([0-9]+\/+[0-9]+\/+[0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1original/$2");
		}

		if (domain === "s.deviant.life" ||
			// https://s.pornpics.today/img/46/90/25/2a/w400px/814febf205b3499fb782405d.jpg
			//   https://s.pornpics.today/img/46/90/25/2a/814febf205b3499fb782405d.jpg
			domain === "s.pornpics.today" ||
			// https://s.hardcore.pink/img/d9/52/e6/c7/w400px/abf335392a0cce44dbea1eef.jpg
			//   https://s.hardcore.pink/img/d9/52/e6/c7/abf335392a0cce44dbea1eef.jpg
			domain === "s.hardcore.pink" ||
			// https://s.brunette.site/img/a0/a5/2c/a2/w400px/3a15f90306f7d7ed46a52cde.jpg
			//   https://s.brunette.site/img/a0/a5/2c/a2/3a15f90306f7d7ed46a52cde.jpg
			domain === "s.brunette.site" ||
			// https://s.nudepornpics.xyz/img/b5/92/50/3c/w300px/93665e71e8007be1176ffe30.jpg
			//   https://s.nudepornpics.xyz/img/b5/92/50/3c/93665e71e8007be1176ffe30.jpg
			domain === "s.nudepornpics.xyz" ||
			// https://s.picsofporn.club/img/ee/d1/69/30/w300px/74eb26baf7beb89ec3e2ec7b.jpg
			//   https://s.picsofporn.club/img/ee/d1/69/30/74eb26baf7beb89ec3e2ec7b.jpg
			domain === "s.picsofporn.club" ||
			// https://s.xpics.info/img/22/07/e4/ae/w300px/d1814ac16d6f09aa831bcfe8.jpg
			//   https://s.xpics.info/img/22/07/e4/ae/d1814ac16d6f09aa831bcfe8.jpg
			domain === "s.xpics.info" ||
			// https://s.sexoic.com/img/9c/93/b9/07/w300px/73623dcf900d44459c2eafb2.jpg
			//   https://s.sexoic.com/img/9c/93/b9/07/73623dcf900d44459c2eafb2.jpg
			domain === "s.sexoic.com" ||
			// https://s.pornphotos.space/img/92/d7/94/7f/w300px/38d201af694d2041181343f3.jpg
			//   https://s.pornphotos.space/img/92/d7/94/7f/38d201af694d2041181343f3.jpg
			domain === "s.pornphotos.space" ||
			// https://s.pornpictures.space/img/a0/1a/75/6f/w300px/1fff36567c3ae68d59cc5185.jpg
			//   https://s.pornpictures.space/img/a0/1a/75/6f/1fff36567c3ae68d59cc5185.jpg
			domain === "s.pornpictures.space" ||
			// https://s.teenpornpics.today/img/d0/21/50/81/w300px/024ca18507f0a337cccc738b.jpg
			//   https://s.teenpornpics.today/img/d0/21/50/81/024ca18507f0a337cccc738b.jpg
			domain === "s.teenpornpics.today" ||
			// https://s.pornphotos.pw/img/22/dd/69/d1/w300px/f9c6093a17ed184b761b64d3.jpg
			//   https://s.pornphotos.pw/img/22/dd/69/d1/f9c6093a17ed184b761b64d3.jpg
			domain === "s.pornphotos.pw" ||
			// https://s.pics.red/img/1d/0c/a8/bd/w300px/dcb7d81f71ad0ddcdf0943ce.jpg
			//   https://s.pics.red/img/1d/0c/a8/bd/dcb7d81f71ad0ddcdf0943ce.jpg
			domain === "s.pics.red" ||
			// https://s.softcore.life/img/09/fe/4a/dc/w400px/b04688d698821706c3f4c24e.jpg
			//   https://s.softcore.life/img/09/fe/4a/dc/b04688d698821706c3f4c24e.jpg -- rotated?
			domain === "s.softcore.life") {
			// https://s.deviant.life/img/fd/4d/2a/8c/w400px/7bf9d8803ef1d0056dd97fa5.jpg
			//   https://s.deviant.life/img/fd/4d/2a/8c/7bf9d8803ef1d0056dd97fa5.jpg
			return src.replace(/(\/img\/+(?:[0-9a-f]{2}\/+){4})[wh][0-9]+px\/+/, "$1");
		}

		if (domain === "d17c3xisf00oox.cloudfront.net") {
			// http://d17c3xisf00oox.cloudfront.net/api/image-loader.php?url=https%3A%2F%2Fupload.wikimedia.org%2Fwikipedia%2Fcommons%2F4%2F4e%2FL%25C3%25A9a_Seydoux_Cannes_2014_%2528cropped%2529.jpg&w=80&h=80&policy=maxFit
			//   https://upload.wikimedia.org/wikipedia/commons/4/4e/Léa_Seydoux_Cannes_2014_%28cropped%29.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+api\/+image-loader\.php\?(?:.*&)?url=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nowww === "darkmovie.info" ||
			// https://mihanfilm.live/upload/poster/tt6802400_small.jpg
			domain_nowww === "mihanfilm.live" ||
			// http://www.darkmovie.org/upload/poster/tt7550000_small.jpg
			//   http://www.darkmovie.org/upload/poster/tt7550000.jpg
			domain_nowww === "darkmovie.org") {
			// http://www.darkmovie.info/upload/cast/nm2244205_small.jpg -- upscaled
			//   http://www.darkmovie.info/upload/cast/nm2244205.jpg
			return src.replace(/(\/upload\/+(?:cast|poster)\/+(?:nm|tt)[0-9]+)_[a-z]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "shutterstock.com") {
			// https://www.shutterstock.com/editorial/image-editorial/jarel-zhang-runway-paris-fashion-week-women-ss-2020-france-01-oct-2019-10432664m
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+editorial\/+image-editorial\/+(?:[^/?#]+-)?([0-9]+[a-z]+)(?:[?#].*)?$/,
				query_for_id: "https://www.shutterstock.com/editorial/image-editorial/${id}",
				process: function(done, resp, cache_key) {
					var obj:BigImageInfoSObject = {
						extra: {
							page: resp.finalUrl
						}
					};

					var urls = [];

					var ogimage = get_meta(resp.responseText, "og:image");
					if (ogimage) {
						urls.push({
							url: ogimage,
							problems: { watermark: true }
						});
					}

					var match = resp.responseText.match(/<script\s+type=["']application\/ld\+json["']>\s*(\[.*?\])\s*<\/script>/);
					if (match) {
						try {
							var json_obj = JSON_parse(match[1]);

							var thumbnail = json_obj[1].thumbnail;
							if (thumbnail) {
								urls.push({
									url: thumbnail,
									problems: { smaller: true }
								});
							}

							if (json_obj[1].name || json_obj[1].description) {
								obj.extra.caption = json_obj[1].name || json_obj[1].description;
							}
						} catch (e) {
							console_error(cache_key, e);
						}
					}

					if (!urls.length)
						return done(null, false);

					return done(fillobj_urls(urls, obj), 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nosub === "shutterstock.com" && /^editorial[0-9]*\./.test(domain)) {
			// https://www.shutterstock.com/editorial/image-editorial/jarel-zhang-runway-paris-fashion-week-women-ss-2020-france-01-oct-2019-10432664m
			// https://editorial01.shutterstock.com/wm-preview-1500/10432664m/aeb26858/jarel-zhang-runway-paris-fashion-week-women-s-s-2020-france-shutterstock-editorial-10432664m.jpg
			id = src.replace(/^[a-z]+:\/\/[^/]*\/+[^/]*\/+([0-9]+[a-z])\/+.*/, "$1");
			if (id !== src) {
				return {
					url: "https://shutterstock.com/editorial/image-editorial/" + id,
					is_pagelink: true
				};
			}
		}

		if (domain === "images.vinted.net") {
			// https://images.vinted.net/thumbs/100x100/0398f_Ti3FPei9CZXXGoCezVghbTyp.jpeg?1539031837$a4c09184babcd5cfe9e35429eaf5f84e73a3a1cd
			//   https://images.vinted.net/thumbs/f800/0398f_Ti3FPei9CZXXGoCezVghbTyp.jpeg?1539031837$61db66833c013ab3feaa84022feb8397a86ded49
			//   https://images.vinted.net/thumbs/0398f_Ti3FPei9CZXXGoCezVghbTyp.jpeg?1539031837$a4c09184babcd5cfe9e35429eaf5f84e73a3a1cd -- 2012x2015
			return src.replace(/\/thumbs\/+(?:[0-9]+x[0-9]+|f[0-9]+)\/+/, "/thumbs/");
		}

		if (domain_nowww === "celebnakedness.com") {
			// http://www.celebnakedness.com/gallery4/tourgallery/thumbnails/Anne_Hathaway__-_Valentines_Day287.jpg
			//   http://www.celebnakedness.com/gallery4/tourgallery/Anne_Hathaway__-_Valentines_Day287.jpg
			// https://www.celebnakedness.com/tour/free/thumbs/january20112/20934_zorg_11984_Anne_HathawayLove_and_other_drugs_HD720p_01_avi_snapshot_00_39_2011_01_23_23_11_55_123_218lo.jpg
			//   https://www.celebnakedness.com/tour/20934_zorg_11984_Anne_HathawayLove_and_other_drugs_HD720p_01_avi_snapshot_00_39_2011_01_23_23_11_55_123_218lo.jpg
			return src
				.replace(/(\/gallery[0-9]*\/+tourgallery\/+)thumbnails\/+/, "$1")
				.replace(/(\/tour\/+)free\/+thumbs\/+[^/]+\/+/, "$1");
		}

		if (domain === "userimg.tellonym.me") {
			// thanks to DevWannabe-dot on github for reporting: https://github.com/qsniyg/maxurl/issues/1007
			// https://userimg.tellonym.me/thumb/1_1e9782237fa625a7798451b8cc054a14.jpg
			//   https://userimg.tellonym.me/xs/1_1e9782237fa625a7798451b8cc054a14.jpg
			//   https://userimg.tellonym.me/lg/1_1e9782237fa625a7798451b8cc054a14.jpg
			return {
				url: src.replace(/(:\/\/[^/]+\/+)(?:thumb|xs)\/+/, "$1lg/"),
				can_head: false // 403
			};
			// deprecated:
			// https://userimg.tellonym.me/xs/14963714_5e0b7c3e269dfb54fdb68c797c571cc9.jpg
			//   https://img.tellonym.me/14963714_5e0b7c3e269dfb54fdb68c797c571cc9.jpg
			//return src.replace(/:\/\/[^/]*\/+(?:thumb|xs)\/+/, "://img.tellonym.me/lg");
		}

		if (domain_nosub === "omni7.jp") {
			// https://7net-img.omni7.jp/co/common/images/material/noImage.png
			if (/\/common\/+images\/+material\/+noImage\./.test(src))
				return {
					url: src,
					bad: true
				};

			// https://img.omni7.jp/co/common/images/zoomImage.png
			if (/\/common\/+images\/+zoomImage\./.test(src))
				return {
					url: src,
					bad: "mask"
				};

			// https://img.omni7.jp/co/productimage/0001/product/39/1301355639/image/1301355639_main_s.jpg
			//   https://img.omni7.jp/co/productimage/0001/product/39/1301355639/image/1301355639.jpg
			//   https://7net-img.omni7.jp/co/productimage/0001/product/39/1301355639/image/1301355639.jpg
			// https://img.omni7.jp/co/productimage/0001/product/39/1301355639/image/1301355639_main_l.jpg
			//   https://img.omni7.jp/co/productimage/0001/product/39/1301355639/image/1301355639.jpg
			// thanks to fireattack on discord:
			// https://img.omni7.jp/co/productimage/0001/product/62/1107218262/image/1107218262_3_sub3_s.jpg
			//   https://img.omni7.jp/co/productimage/0001/product/62/1107218262/image/1107218262_3_sub3_l.jpg
			//   https://img.omni7.jp/co/productimage/0001/product/62/1107218262/image/1107218262_3.jpg
			// thanks to anonymous for reporting:
			// https://7net-img.omni7.jp/co/productimage/0001/product/63/1107305263/image/1107305263_main_l.jpg
			//   https://7net-img.omni7.jp/co/productimage/0001/product/63/1107305263/image/1107305263_main_el.jpg -- 500x500
			//   https://7net-img.omni7.jp/co/productimage/0001/product/63/1107305263/image/1107305263.jpg -- 317x500
			// https://7net-img.omni7.jp/co/productimage/0001/product/40/1301517240/image/1301517240.jpg -- 4200x4200
			// https://7net-img.omni7.jp/cm/0001/sc_image/inc/sp/special/000000ptribbons/kinkira_jac.jpg -- 3000x3000
			// https://7net-img.omni7.jp/co/productimage/0001/product/57/1107390357/image/1107390357_main_s.jpg -- 70x70
			//   https://7net-img.omni7.jp/co/productimage/0001/product/57/1107390357/image/1107390357_main_el.jpg -- 1200x1200
			// thanks to fireattack on discord for reporting:
			// https://7net-img.omni7.jp/co/productimage/0001/product/79/1252341079/image/1252341079_main_m.jpg -- 240x240
			//   https://7net-img.omni7.jp/co/productimage/0001/product/79/1252341079/image/1252341079_main_el.jpg -- 1000x1000
			return src
				.replace(/(\/product\/+[0-9]+\/+[0-9]+\/+image\/+[0-9]+(?:_[0-9]+)?)_(?:main|sub[0-9]*)_el(\.[^/.]*)(?:[?#].*)?$/, "$1$2")
				.replace(/(\/product\/+[0-9]+\/+[0-9]+\/+image\/+[0-9]+(?:_[0-9]+)?_(?:main|sub[0-9]*))_[sml](\.[^/.]*)(?:[?#].*)?$/, "$1_el$2");
		}

		if (domain === "d2jtsb989t238a.cloudfront.net") {
			// https://d2jtsb989t238a.cloudfront.net/p/10716761/1518689821/small
			//   https://d2jtsb989t238a.cloudfront.net/p/10716761/1518689821/normal -- 275x275
			// other:
			// https://d2jtsb989t238a.cloudfront.net/m/ttuv2oqmyr7w56a2hg9mepoxbbu3v1tc/thumb_normal
			//   https://d2jtsb989t238a.cloudfront.net/m/ttuv2oqmyr7w56a2hg9mepoxbbu3v1tc/movie.mp4
			return src.replace(/(\/p\/+[0-9]+\/+[0-9]+\/+)small(?:[?#].*)?$/, "$1normal");
		}

		if (domain === "ogre.natalie.mu" && string_indexof(src, "/media/") >= 0) {
			// thanks to nimbuz on discord:
			// https://ogre.natalie.mu/media/news/stage/2020/1030/tamurameimi_art.jpg?imwidth=468
			//   https://ogre.natalie.mu/media/news/stage/2020/1030/tamurameimi_art.jpg
			//   https://ogre.natalie.mu/media/news/stage/2020/1030/tamurameimi_art.jpg?impolicy=pp_image -- 504x672
			// https://ogre.natalie.mu/media/pp/static/music/sayashiriho/pc_header.jpg
			//   https://ogre.natalie.mu/media/pp/static/music/sayashiriho/pc_header.jpg?impolicy=pp_image -- 2120x1180
			// https://ogre.natalie.mu/media/pp/static/music/sayashiriho/photo01s.jpg
			//   https://ogre.natalie.mu/media/pp/static/music/sayashiriho/photo01.jpg?impolicy=pp_image -- 800x533
			return src
				.replace(/(?:[?#].*)?$/, "?impolicy=pp_image")
				.replace(/(\/photo[0-9]+)s\./, "$1.");
		}

		if (domain === "cdnx.natalie.mu") {
			// https://cdnx.natalie.mu/media/news/music/2019/0225/nishinonanase_art201902_fit_120x120.jpg
			//   https://cdnx.natalie.mu/media/news/music/2019/0225/nishinonanase_art201902_fixw_120.jpg
			//   https://cdnx.natalie.mu/media/news/music/2019/0225/nishinonanase_art201902_fixw_750_lt.jpg
			// https://cdnx.natalie.mu/media/news/comic/2018/1206/mix_key_fixw_640_hq.jpg
			//   https://cdnx.natalie.mu/media/news/comic/2018/1206/mix_key_fixw_750_lt.jpg -- 640x905 (same size)
			// https://cdnx.natalie.mu/media/news/music/2016/0914/dollelements_art201609_fixw_730_hq.jpg
			//   https://cdnx.natalie.mu/media/news/music/2016/0914/dollelements_art201609_fixw_750_lt.jpg
			// https://cdnx.natalie.mu/media/news/music/2016/0705/iRis_art20160705_fixw_234.jpg
			//   https://cdnx.natalie.mu/media/news/music/2016/0705/iRis_art20160705_fixw_750_lt.jpg
			newsrc = src.replace(/(?:_fixw_(?:120|234)|_fit_120x120|_fixw_(?:640|730)_hq)\./, "_fixw_750_lt.");
			if (newsrc !== src)
				return newsrc;

			// thanks to fireattack on discord:
			// https://cdnx.natalie.mu/media/offshot/2021/0804/sayashiriho_offshot0804_fixw_1080.jpg
			//   https://ogre.natalie.mu/media/offshot/2021/0804/sayashiriho_offshot0804.jpg?impolicy=pp_image
			// https://cdnx.natalie.mu/media/news/comic/2018/1206/mix_key_fixw_750_lt.jpg
			//   https://ogre.natalie.mu/media/news/comic/2018/1206/mix_key.jpg?impolicy=pp_image
			return src.replace(/^[a-z]+:\/\/[^/]+\/+(media\/+(?:[^/]+\/+)?[^/]+\/+[0-9]{4}\/+[0-9]{4}\/+[^/]+)_(?:fix[a-z]|fit)_[^/.?#]+\./, "https://ogre.natalie.mu/$1.");
		}

		if (domain_nowww === "gohong01.com") {
			// http://gohong01.com/img/7868/mini.jpg
			//   http://gohong01.com/img/7868/t.jpg
			return src.replace(/(\/img\/+[0-9]+\/+)mini(\.[^/.]*)(?:[?#].*)?$/, "$1t$2");
		}

		if (domain === "static.mercdn.net") {
			// https://static.mercdn.net/thumb/photos/m95828769342_1.jpg?1547988548
			//   https://static.mercdn.net/item/detail/orig/photos/m95828769342_1.jpg?1547988548
			// https://static.mercdn.net/thumb/members/179683160.jpg?1538204032
			//   https://static.mercdn.net/item/detail/orig/members/179683160.jpg?1538204032
			return src.replace(/\/thumb\/+([a-z]+)\/+/, "/item/detail/orig/$1/");
		}

		if ((domain_nosub === "readthis.one" && /^s[0-9]*\./.test(domain))) {
			// https://s2.readthis.one/yimg/eJwVxlEKgCAMANAbOTfJZbdZ6ihCDRwEnT56X-8wu-cG0Go5xb2163R5NLgGzGr9v7MHdAmYS2KMntaSRYV5J8HA5BOG9AF1VRaQ.jpg_240.jpg
			//   https://s2.readthis.one/yimg/eJwVxlEKgCAMANAbOTfJZbdZ6ihCDRwEnT56X-8wu-cG0Go5xb2163R5NLgGzGr9v7MHdAmYS2KMntaSRYV5J8HA5BOG9AF1VRaQ.jpg
			return src.replace(/(\/yimg\/+[^/]{50,}\.[^/._]+)_[0-9]+\.[^/.]*(?:[?#].*)?$/, "$1");
		}

		if (domain === "photos.fashiongroup.com") {
			// https://us.fashionnetwork.com/galeries/photos/Richard-Nicoll,8451,2.html
			// https://photos.fashiongroup.com/2011-09-18/1124438/thumbs_r_nicoll_wss12_001_m.jpg
			//   https://photos.fashiongroup.com/2011-09-18/1124438/r_nicoll_wss12_001_m.jpg
			//   https://photos.fashiongroup.com/2011-09-18/1124438/2048/r_nicoll_wss12_001_m.jpg -- 1363x2048
			// other:
			// https://photos.fashiongroup.com/2011-05-18/1060230/design_vision_austria_lobmeyr_basket_m.jpg -- 4923x4527
			// doesn't work for all:
			// https://photos.fashiongroup.com/2011-02-02/3000001094/_11%20Bonache%20002.jpg
			//   https://photos.fashiongroup.com/2011-02-02/3000001094/2048/_11%20Bonache%20002.jpg -- 404
			//   https://us.fashionnetwork.com/galeries/photos/Cardona-Bonache,11702.html -- same error in page
			newsrc = src.replace(/(\/[0-9]{4}-[0-9]{2}-[0-9]{2}\/+[0-9]+\/+)thumbs_([^/]*\.[^/.]*)(?:[?#].*)?$/, "$1$2");
			if (newsrc !== src)
				return newsrc;

			newsrc = src.replace(/(\/[0-9]{4}-[0-9]{2}-[0-9]{2}\/+[0-9]+\/+)([^/]*\.[^/.]*)(?:[?#].*)?$/, "$12048/$2");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nowww === "napiszar.com") {
			// http://www.napiszar.com/uploads/2019/10/03/eef93e03e676ced2966ca6b2fc2da0ba_thumb.jpg
			//   http://www.napiszar.com/uploads/2019/10/03/eef93e03e676ced2966ca6b2fc2da0ba_origi.jpg
			return src.replace(/(\/uploads\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9a-f]{30,})_thumb(\.[^/.]*)(?:[?#].*)?$/, "$1_origi$2");
		}

		if (domain_nowww === "incontri-passionali.com" ||
			// https://www.incontri-in-italia.com/images/annunci/med-3203036032-285.jpg
			//   https://www.incontri-in-italia.com/images/annunci/max-3203036032-285.jpg
			domain_nowww === "incontri-in-italia.com" ||
			// https://www.incontri-bakeka.com/images/annunci/med-3203036032-285.jpg
			//   https://www.incontri-bakeka.com/images/annunci/max-3203036032-285.jpg
			domain_nowww === "incontri-bakeka.com" ||
			// https://www.sesso-escort.com/images/annunci/med-3442353909-560.jpg
			//   https://www.sesso-escort.com/images/annunci/max-3442353909-560.jpg
			domain_nowww === "sesso-escort.com") {
			// https://www.incontri-passionali.com/images/annunci/med-3924887861-96.jpg
			//   https://www.incontri-passionali.com/images/annunci/max-3924887861-96.jpg
			return src.replace(/(\/images\/+[^/]+\/+)med-([0-9]+-[0-9]+\.)/, "$1max-$2");
		}

		if (domain_nowww === "filmyerotyczne.tv") {
			// http://filmyerotyczne.tv/gallery/LadyMargy/20180116_0708525167/medium/G8iXndx.png
			//   http://filmyerotyczne.tv/gallery/LadyMargy/20180116_0708525167/large/G8iXndx.png
			return src.replace(/(\/gallery\/+[^/]*\/+[0-9]+_[0-9]+\/+)medium\/+/, "$1large/");
		}

		if (domain_nowww === "idposter.com") {
			// https://idposter.com/img/smalls/852/s_id847393.jpg
			//   https://idposter.com/img/bigs/852/id847393.jpg
			return src.replace(/\/img\/+smalls\/+([0-9]+\/+)s_id/, "/img/bigs/$1id");
		}

		if (domain_nowww === "fappeningbook.com") {
			// https://fappeningbook.com/photos/s/e/selena-gomez/2000/1601t.jpg
			//   https://fappeningbook.com/photos/s/e/selena-gomez/2000/1601.jpg
			return src.replace(/(\/photos\/+.\/+.\/+[^/]*\/+[0-9]+\/+[0-9]+)t(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		// TinyWebGallery: http://www.tinywebgallery.com/
		// todo: make generic
		if (domain === "pics.hotsexygirls.eu" ||
			// http://www.johnrossballetgallery.co.uk/image.php?twg_album=William+Forsythe+-+A+Quiet+Evening+of+Dance&twg_type=small&twg_show=004+Riley+Watts%2C+Brigel+Gjorka+and+Ander+Zabala+Gomez.jpg&twg_rot=-1
			//   http://www.johnrossballetgallery.co.uk/image.php?twg_album=William+Forsythe+-+A+Quiet+Evening+of+Dance&twg_show=004+Riley+Watts%2C+Brigel+Gjorka+and+Ander+Zabala+Gomez.jpg -- "Download of this image not allowed."
			//    adding &twg_rot=-1 doesn't help
			//   http://www.johnrossballetgallery.co.uk/pictures/William%20Forsythe%20-%20A%20Quiet%20Evening%20of%20Dance/004%20Riley%20Watts%2C%20Brigel%20Gjorka%20and%20Ander%20Zabala%20Gomez.jpg
			domain_nowww === "johnrossballetgallery.co.uk" ||
			// http://www.chuchomerchan.com/english/gallery/image.php?twg_album=ANIMALISIM&twg_show=599030_10151490544936206_581299529_n.jpg&twg_type=fullscreen&twg_rot=-1
			//   http://www.chuchomerchan.com/english/gallery/pictures/ANIMALISIM/599030_10151490544936206_581299529_n.jpg
			domain_nowww === "chuchomerchan.com" ||
			// https://hhogc.org/gallery/image.php?twg_album=Misc&twg_show=danny_debbie.jpg&twg_type=fullscreen&twg_rot=-1
			//   https://hhogc.org/gallery/pictures/Misc/danny_debbie.jpg
			domain_nowww === "hhogc.org" ||
			// http://www.icann-online.org/gallery/image.php?twg_album=2019_ICANN_Conf&twg_show=T_076.JPG&twg_type=fullscreen&twg_rot=-1
			//   http://www.icann-online.org/gallery/pictures/2019_ICANN_Conf/T_076.JPG
			domain_nowww === "icann-online.org" ||
			// http://stanleys-haven.com/photos/image.php?twg_album=Gardens&twg_show=gardens3.jpg&twg_type=fullscreen&twg_rot=-1
			//   http://stanleys-haven.com/photos/pictures/Gardens/gardens3.jpg
			domain_nowww === "stanleys-haven.com" ||
			// http://www.tangovalley.com/twg/image.php?twg_album=Tangoweeks+2014&twg_show=P1080878.jpg&twg_type=fullscreen&twg_rot=-1
			//   http://www.tangovalley.com/twg/pictures/Tangoweeks%202014/P1080878.jpg
			domain_nowww === "tangovalley.com" ||
			// https://www.huffnpuffsfa.com/gallery/image.php?twg_album=Pickleball&twg_show=18222469_1307857015916780_1958176021190214041_n.jpg&twg_type=fullscreen&twg_rot=-1
			//   https://www.huffnpuffsfa.com/gallery/index.php?twg_album=Pickleball&twg_show=18222469_1307857015916780_1958176021190214041_n.jpg
			// https://www.huffnpuffsfa.com/gallery/cache/Pickleball_18222469_1307857015916780_1958176021190214041_n.jpg.small.jpg
			//   https://www.huffnpuffsfa.com/gallery/image.php?twg_album=Pickleball&twg_show=18222469_1307857015916780_1958176021190214041_n.jpg
			domain_nowww === "huffnpuffsfa.com") {
			// http://pics.hotsexygirls.eu/cache/Sexy%2BNude%2BGirls_women%2Band%2Bhorse.jpg.thumb.jpg
			//   http://pics.hotsexygirls.eu/cache/Sexy%2BNude%2BGirls_women%2Band%2Bhorse.jpg.small.jpg
			//   http://pics.hotsexygirls.eu/image.php?twg_album=Sexy+Nude+Girls&twg_show=women+and+horse.jpg -- 637x960, no watermark
			//   http://pics.hotsexygirls.eu/image.php?twg_album=Sexy+Nude+Girls&twg_show=women+and+horse.jpg&twg_type=fullscreen&twg_rot=-1 -- 654x986, watermark
			//   http://pics.hotsexygirls.eu/?twg_album=Sexy+Nude+Girls&twg_show=women+and+horse.jpg
			//   http://pics.hotsexygirls.eu/?twg_album=Sexy%20Nude%20Girls&twg_show=women%20and%20horse.jpg
			newsrc = src.replace(/\/cache\/+([^/]*\.[^/.]*)\.thumb(\.[^/.]+)(?:[?#].*)?$/, "/cache/$1.small$2");
			if (newsrc !== src)
				return newsrc;

			match = src.match(/\/cache\/+([^/_]+)_([^/]*\.[^/.]*)\.[a-z]+\.[^/.]*(?:[?#].*)?$/);
			if (match) {
				return src.replace(/\/cache\/+[^/]+(?:[?#].*)?$/, "/image.php?twg_album=" + match[1] + "&twg_show=" + match[2]);
			}

			match = src.match(/\/image\.php\?(.*?&)?twg_album=/);
			if (match) {
				obj = {
					extra: {
						page: keep_queries(src, ["twg_album", "twg_show"]).replace(/\/image\.php\?/, "/index.php?"),
					}
				};

				newsrc = keep_queries(src, ["twg_album", "twg_show"], {required: true});
				if (newsrc !== src)
					return fillobj_urls([newsrc], obj);

				var queries = get_queries(src);
				if (queries.twg_album && queries.twg_show) {
					var twg_album = queries.twg_album.replace(/\+/g, " ");
					var twg_show = queries.twg_show.replace(/\+/g, " ");
					return fillobj_urls([src.replace(/\/image\.php\?.*/, "/pictures/" + twg_album + "/" + twg_show)], obj);
				}
			}
		}

		if (domain === "mygalleries.allpornmodels.com") {
			// http://mygalleries.allpornmodels.com/xart-lesbians/small/01-xart-lesbians.jpg
			//   http://mygalleries.allpornmodels.com/xart-lesbians/01-xart-lesbians.jpg
			return src.replace(/(:\/\/[^/]*\/+[^/]*\/+)small\/+/, "$1");
		}

		if (domain === "forum.donanimhaber.com") {
			// https://forum.donanimhaber.com/cache/ImageThumbnail2.aspx?path=http://store.donanimhaber.com/2a/e6/64/2ae664221cfa992f6580b45112163b7c.jpg&t=108849866&size=1&bound=0&border=0&resolution=0
			//   https://store.donanimhaber.com/2a/e6/64/2ae664221cfa992f6580b45112163b7c.jpg
			newsrc = src.replace(/.*?\/cache\/+ImageThumbnail2\.aspx\?(?:.*&)?path=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nosub === "newtumbl.com") {
			// https://dn0.newtumbl.com/img/81100/14861971/1/21809496/nT_sei0rd05cpjcffzfr0pqaee7_300.jpg
			//   https://dn0.newtumbl.com/img/81100/14861971/1/21809496/nT_sei0rd05cpjcffzfr0pqaee7.jpg
			// https://dn0.newtumbl.com/img/82808/13699929/1/20114140/nT_gikzbtguejyr0gabqkn82gea_600.jpg
			//   https://dn0.newtumbl.com/img/82808/13699929/1/20114140/nT_gikzbtguejyr0gabqkn82gea.jpg
			obj = {
				url: src,
				headers: {
					Referer: ""
				},
				bad_if: [{
					headers: {
						"content-type": "image/jpg",
						"content-length": "688362"
					}
				}],
				referer_ok: {
					same_domain_nosub: true
				},
				can_head: false // completely wrong output
			};

			newsrc = src.replace(/(\/img\/+[0-9]+\/+[0-9]+\/+[0-9]+\/+[0-9]+\/+nT_[0-9a-z]{10,})_[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
			if (newsrc !== src) {
				obj.url = newsrc;
				return obj;
			}

			regex = /(\/img\/+[0-9]+\/+[0-9]+\/+[0-9]+\/+[0-9]+\/+nT_[0-9a-z]{10,})\.[^/.]+(?:[?#].*)?$/;

			// https://github.com/qsniyg/maxurl/issues/220
			if (regex.test(src) && options && options.do_request && options.cb) {
				var cachelink = src.replace(regex, "$1");
				api_cache.fetch("newtumbl:" + cachelink, function(url) {
					if (url) {
						obj.url = url;
					}

					options.cb(obj);
				}, function(done) {
					var req;

					var do_test = function(ext) {
						loaded = false;
						loading_ext = ext;
						var loadfunc = function(resp) {
							onload(resp, ext);
						};

						req = options.do_request({
							url: src.replace(regex, "$1." + ext),
							method: "GET",
							headers: {
								Referer: ""
							},
							onprogress: loadfunc,
							onload: loadfunc
						});
					};

					var loaded = false;
					var loading_ext;
					var onload = function(resp, current_ext) {
						if (loading_ext !== current_ext || loaded) {
							req.abort();
							return;
						}

						if (resp.readyState === 4 || resp.responseHeaders) {
							loaded = true;
							req.abort();
						}

						if (!loaded)
							return;

						if (resp.status !== 200) {
							return done(null, false);
						}

						var headers_list = parse_headers(resp.responseHeaders);
						var headers = headers_list_to_dict(headers_list);

						// todo: improve?
						var splitted = headers["content-type"].split("/");
						var mediatype = splitted[0];
						var ext = splitted[1];

						var newsrc = src.replace(regex, "$1." + ext);

						if (current_ext === "mp4") {
							if (mediatype === "video") {
								return done(newsrc, 24*60*60);
							} else {
								do_test("gif");
							}
						} else {
							return done(newsrc, 24*60*60);
						}
					};

					do_test("mp4");
				});

				return {
					waiting: true
				};
			}

			// https://dn2.newtumbl.com/img/520981/20720207/1/12312357/nT_nhur9hhheh63uqxj6ppjzst9_300.jpg
			//   https://dn2.newtumbl.com/img/520981/20720207/1/12312357/nT_nhur9hhheh63uqxj6ppjzst9.mp4
			// note that non-mp4's get turned into mp4's like this, but this isn't too bad because content-type isn't video/
			// gifs get broken though
			newsrc = src.replace(/(\/img\/+[0-9]+\/+[0-9]+\/+[0-9]+\/+[0-9]+\/+nT_[0-9a-z]{10,})\.(?:jpg|JPG|jpeg|JPEG|png|PNG|webp|WEBP)(?:[?#].*)?$/, "$1.mp4");
			if (newsrc !== src) {
				obj.url = newsrc;
				return obj;
			}
		}

		if (domain === "img.ohpolly.com") {
			// thumbor
			// https://img.ohpolly.com/u02beaOl1WZ2cvpQMUtXDYhwPIQ=/fit-in/666x999/catalog/product/2/3/2397_10_utopia-neon-lime-deep-v-zipped-collar-playsuit.jpg
			//   https://www.ohpolly.com/media/catalog/product/2/3/2397_10_utopia-neon-lime-deep-v-zipped-collar-playsuit.jpg
			return src.replace(/:\/\/[^/]*\/+[^/]*=\/+(?:.*?\/)?(catalog\/+product\/)/, "://www.ohpolly.com/media/$1");
		}

		if (domain_nowww === "brightvibes.com") {
			// https://brightvibes.com/file/php3LYbaT.jpeg/1200x675
			//   https://brightvibes.com/file/php3LYbaT.jpeg
			//   https://brightvibes.com/images/php3LYbaT.jpeg
			newsrc = src.replace(/(\/file\/+[^/]*)\/+[0-9]+x[0-9]+(?:[?#].*)?$/, "$1");
			if (newsrc !== src)
				return newsrc;

			// https://brightvibes.com/image-cache/1200x675-php3LYbaT.jpeg
			//   https://brightvibes.com/images/php3LYbaT.jpeg
			newsrc = src.replace(/\/image-cache\/+[0-9]+x[0-9]+-([^/]*\.[^/.]*)(?:[?#].*)?$/, "/images/$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "cdn.webshopapp.com" ||
			// https://cdn.shoplightspeed.com/shops/618877/files/16268922/800x1024x1/english-factory-checkered-white-h-line-miniskirt.jpg
			//   https://cdn.shoplightspeed.com/shops/618877/files/16268922/english-factory-checkered-white-h-line-miniskirt.jpg
			domain === "cdn.shoplightspeed.com") {
			// https://cdn.webshopapp.com/shops/72247/files/233281437/700x700x2/image.jpg
			//   https://cdn.webshopapp.com/shops/72247/files/233281437/image.jpg
			return src.replace(/(\/files\/+[0-9]+\/+)[0-9]+x[0-9]+(?:x[0-9])?\/+/, "$1");
		}

		if (domain_nowww === "hdnicewallpapers.com") {
			// http://www.hdnicewallpapers.com/Walls/Normal/Squirrel/Cutest_Squirrel_Baby_Photo.jpg
			//   http://www.hdnicewallpapers.com/Walls/Big/Squirrel/Cutest_Squirrel_Baby_Photo.jpg
			return src.replace(/(:\/\/[^/]*\/+)walls\/+[a-z]+\/+/i, "$1Walls/Big/");
		}

		if (domain === "img.theculturetrip.com") {
			// https://img.theculturetrip.com/450x/wp-content/uploads/2018/02/quokka--s--rohrlachflickr.jpg
			//   https://img.theculturetrip.com/wp-content/uploads/2018/02/quokka--s--rohrlachflickr.jpg
			return src.replace(/\/[0-9]*x[0-9]*\/+wp-content\/+/, "/wp-content/");
		}

		if (domain_nosub === "ning.com" && /^(?:st[0-9]*|storage)\./.test(domain)) {
			// https://st2.ning.com/topology/rest/1.0/file/get/3645963028?profile=RESIZE_48X48&width=32&height=32&crop=1:1
			//   https://st2.ning.com/topology/rest/1.0/file/get/3645963028?profile=original
			// http://storage.ning.com/topology/rest/1.0/file/get/3150267632?profile=RESIZE_48X48&width=32&height=32&crop=1:1
			//   https://st6.ning.com/topology/rest/1.0/file/get/3150267632?profile=original
			return src.replace(/(\/file\/+get\/+[0-9]+)\?.*$/, "$1?profile=original");
		}

		if (domain_nowww === "comedywildlifephoto.com") {
			// https://www.comedywildlifephoto.com/images/gallery/6/00000656_t.jpg
			//   https://www.comedywildlifephoto.com/images/gallery/6/00000656_p.jpg
			return src.replace(/(\/images\/+gallery\/+[0-9]+\/+[0-9]+)_t(\.[^/.]*)(?:[?#].*)?$/, "$1_p$2");
		}

		if (domain_nowww === "islam.kz") {
			// http://islam.kz/uploads/images/Z26/jvf/XQQubNtRW7H9WQdL-sm.jpg
			//   http://islam.kz/uploads/images/Z26/jvf/XQQubNtRW7H9WQdL-md.jpg
			//   http://islam.kz/uploads/images/Z26/jvf/XQQubNtRW7H9WQdL-lg.jpg
			return src.replace(/(\/uploads\/+images\/+(?:[^/]{3}\/+){2}[^/.]*)-(?:sm|md)(\.[^/.]*)(?:[?#].*)?$/, "$1-lg$2");
		}

		if (domain_nowww === "todofondos.com") {
			// http://todofondos.com/f/12874
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+f\/+([0-9]+(?:\/+[0-9]+x[0-9]+)?)(?:[?#].*)?$/,
				query_for_id: "http://todofondos.com/f/${id}",
				process: function(done, resp, cache_key) {
					// download link (/[0-9]+/[0-9]+x[0-9]+$)
					var match = resp.responseText.match(/<a href="([^"']*\/bin\/descargas\/.*?)"/);
					if (match) {
						return done({
							url: decode_entities(match[1]),
							extra: {
								page: resp.finalUrl
							}
						}, 6*60*60);
					}

					// index (/[0-9]+$)
					var match = resp.responseText.match(/<button[^>]*onclick="\s*javascript:location.href='(https?:\/\/todofondos\.com\/+f\/+[0-9]+\/+[0-9]+x[0-9]+)'"[^>]*>\s*<span[^>]*>\s*<\/span>\s*resoluci.n\s+original/);
					if (match) {
						return done({
							url: decode_entities(match[1]),
							is_pagelink: true
						}, 6*60*60);
					}

					console_log(cache_key, "Unable to find download or index match for", resp);
					return done(null, false);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "todofondos.com") {
			// http://todofondos.com/bin/fondos/01/28/74c.jpg
			//   http://todofondos.com/bin/descargas/33860012168527551150389631443677963064281133889904.jpg
			id = src.replace(/.*\/bin\/+fondos\/+((?:[0-9]{2}\/+){2}[0-9]+)[a-z]\.[^/.]*(?:[?#].*)?$/, "$1");
			if (id !== src) {
				return {
					url: "http://todofondos.com/f/" + id.replace(/\/+/g, "").replace(/^0*/, ""),
					is_pagelink: true
				};
			}
		}

		if (domain === "d2w9rnfcy7mm78.cloudfront.net") {
			// https://d2w9rnfcy7mm78.cloudfront.net/872026/large_4eba4e46757780caaa11c9284efdb74f.jpg?1486571063?bc=1
			//   https://d2w9rnfcy7mm78.cloudfront.net/872026/original_4eba4e46757780caaa11c9284efdb74f.jpg?1486571063?bc=1
			return src.replace(/(\/[0-9]+\/+)[a-z]+_([0-9a-f]{20,}\.[^/.]*)(?:[?#].*)?$/, "$1original_$2");
		}

		if (domain === "birkrdnawa.com") {
			// https://birkrdnawa.com/Content/SiteImages/Article/Thumb/551769355-690316059635782044529873345.jpg
			//   https://birkrdnawa.com/Content/SiteImages/article/551769355-690316059635782044529873345.jpg
			return src.replace(/(\/content\/+siteimages\/+[a-z]+\/+)thumb\/+/i, "$1");
		}

		if (domain === "media.bernardinai.lt") {
			// http://media.bernardinai.lt/o/cc98a635e9ae2313fa2c9a1c752936dfe864f4ce_article_scale.png
			//   http://media.bernardinai.lt/o/cc98a635e9ae2313fa2c9a1c752936dfe864f4ce.png
			return src.replace(/(\/o\/+[0-9a-f]{20,})_[_a-z]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "econet.ru") {
			// https://econet.ru/media/video_covers/12945/medium.jpg?1569350930
			//   https://econet.ru/media/video_covers/12945/original.jpg?1569350930
			return src.replace(/(\/media\/+video_covers\/+[0-9]+\/+)[a-z]+(\.[^/.]*)(?:[?#].*)?$/, "$1original$2");
		}

		if (domain_nowww === "displate.com") {
			// https://displate.com/displates/1080418/standard/2019-06-16/eb7d1bbe6641f6efd80e59ae5546f83f_606765ff02f7f7c2f8e6b93069155f79.jpg
			//   https://displate.com/displates/2019-06-16/eb7d1bbe6641f6efd80e59ae5546f83f_606765ff02f7f7c2f8e6b93069155f79.jpg?w=280
			//   https://displate.com/displates/2019-06-16/eb7d1bbe6641f6efd80e59ae5546f83f_606765ff02f7f7c2f8e6b93069155f79.jpg
			return src.replace(/\/displates\/+(?:[0-9]+\/+[a-z]+\/+)?([0-9]{4}-[0-9]{2}-[0-9]{2}\/+[^/]*?)(?:[?#].*)?$/, "/displates/$1");
		}

		if (domain_nowww === "lens2print.co.uk") {
			// https://lens2print.co.uk/cms/upload_area/images/152_processed/medium/uovzwgl1gbl617_30_01.jpg
			//   https://lens2print.co.uk/cms/upload_area/images/152_processed/crop/uovzwgl1gbl617_30_01.jpg -- 1100x734
			//   https://lens2print.co.uk/cms/upload_area/images/152_processed/large/uovzwgl1gbl617_30_01.jpg -- 1920x1281
			return src.replace(/(\/cms\/+upload_area\/+images\/+[0-9]+_processed\/+)(?:medium|crop)\/+/, "$1large/");
		}

		if (domain_nowww === "iqna.ir" ||
			// https://www.parsine.com//files/fa/news_albums/558075/3835/thumbnails/thm_703444_564.jpg
			//   https://www.parsine.com//files/fa/news_albums/558075/3835/resized/resized_703444_564.jpg
			domain_nowww === "parsine.com") {
			// https://iqna.ir/files/fa/news_albums/3844630/17110/thumbnails/thm_1468471_780.jpg
			//   https://iqna.ir/files/fa/news_albums/3844630/17110/resized/resized_1468471_780.jpg
			return src.replace(/(\/files\/+[^/]*\/+news_albums\/+[0-9]+\/+[0-9]+\/+)thumbnails\/+thm_/, "$1resized/resized_");
		}

		if (domain_nowww === "az-deteto.bg") {
			// http://az-deteto.bg/pic/article/logo/19459.jpg
			//   http://az-deteto.bg/pic/article/picture/19459.jpg
			return src.replace(/(\/pic\/+article\/+)logo\/+/, "$1picture/");
		}

		if (domain_nosub === "efreenews.com") {
			// http://chinese.efreenews.com/storage/posts/July2019/705a4b17bbd995e58f47389f684d9c3c-thumb.jpg
			//   http://chinese.efreenews.com/storage/posts/July2019/705a4b17bbd995e58f47389f684d9c3c.jpg
			return src.replace(/(\/storage\/+posts\/+[A-Za-z]+[0-9]{4}\/+[0-9a-f]{20,})-thumb(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "iziva.com") {
			// http://www.iziva.com/media/jact/medium/images/LES%20NUMERIQUES_le-comedy-wildlife-2019-revele-les-animaux-finalistes-avec-humour.jpg
			//   http://www.iziva.com/images/LES%20NUMERIQUES_le-comedy-wildlife-2019-revele-les-animaux-finalistes-avec-humour.jpg
			return {
				url: src.replace(/\/media\/+jact\/+[^/]*\/+images\/+/, "/images/"),
				headers: {
					Referer: ""
				},
				referer_ok: {
					same_domain: true
				}
			};
		}

		if ((domain_nosub === "viewbug.com" && /^cdnpt[0-9]*\./.test(domain)) ||
			// https://photo-viewbug.s3.amazonaws.com/media/mediafiles/2018/08/05/80406319_widepreview400.jpg
			//   https://photo-viewbug.s3.amazonaws.com/media/mediafiles/2018/08/05/80406319_large1300.jpg
			amazon_container === "photo-viewbug") {
			// https://cdnpt01.viewbug.com/media/mediafiles/2018/08/05/80406319_widepreview400.jpg
			//   https://cdnpt01.viewbug.com/media/mediafiles/2018/08/05/80406319_large1300.jpg
			return src.replace(/(\/media\/+mediafiles\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9]+)_widepreview400(\.[^/.]*)(?:[?#].*)?$/, "$1_large1300$2");
		}

		if (domain === "bilder.t-online.de") {
			// https://bilder.t-online.de/b/84/93/82/46/id_84938246/920/tid_da/eichhoernchen-geert-weggen-zeigt-die-welt-der-kleinen-nager-.jpg
			//   https://bilder.t-online.de/b/84/93/82/46/id_84938246/c_raw/tid_da/eichhoernchen-geert-weggen-zeigt-die-welt-der-kleinen-nager-.jpg
			// https://bilder.t-online.de/b/84/93/55/06/id_84935506/343h/c_raw/tid_da/dieser-nager-hat-etwas-zu-tief-in-die-pusteblume-geblickt-.jpg
			//   https://bilder.t-online.de/b/84/93/55/06/id_84935506/c_raw/tid_da/dieser-nager-hat-etwas-zu-tief-in-die-pusteblume-geblickt-.jpg
			// https://bilder.t-online.de/b/86/59/58/20/id_86595820/610_80/tid_da/trauer-in-halle-nach-dem-anschlag-hat-sich-eine-gespenstische-stille-ueber-die-stadt-gelegt-.jpg
			//   https://bilder.t-online.de/b/86/59/58/20/id_86595820/c_raw/tid_da/trauer-in-halle-nach-dem-anschlag-hat-sich-eine-gespenstische-stille-ueber-die-stadt-gelegt-.jpg
			return src.replace(/(\/id_[0-9]+\/+)(?:[0-9]+(?:_[0-9]+)?[wh]?\/+)?(?:c_[^/]*\/+)?tid_da\/+/, "$1c_raw/tid_da/");
		}

		if (domain_nowww === "khabarban.com") {
			// https://khabarban.com/NewsImage/640/aHR0cDovL3BhcnNpbmUuY29tLy9maWxlcy9mYS9uZXdzX2FsYnVtcy81NTgwNzUvMzgzNS90aHVtYm5haWxzL3RobV83MDM0NDRfNTY0LmpwZw==
			//   https://www.parsine.com//files/fa/news_albums/558075/3835/thumbnails/thm_703444_564.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+NewsImage\/+[0-9]+\/+([^/.]{50,})(?:[?#].*)?$/, "$1");
			if (newsrc !== src) {
				return base64_decode(newsrc);
			}
		}

		if ((domain_nosub === "imagecollect.com" && /^static[0-9]*\./.test(domain)) ||
			// http://live-imagecollect.s3.amazonaws.com/thumbnail/23343/424cdfa06d8a768
			//   http://live-imagecollect.s3.amazonaws.com/preview/23343/424cdfa06d8a768
			amazon_container === "live-imagecollect") {
			// https://static3.imagecollect.com/thumbnail/23343/424cdfa06d8a768
			//   https://static3.imagecollect.com/preview/23343/424cdfa06d8a768
			newsrc = src.replace(/\/thumbnail\/+([0-9]+\/+[0-9a-f]+)(?:[?#].*)?$/, "/preview/$1");
			if (newsrc !== src)
				return {
					url: newsrc,
					problems: {
						watermark: true
					}
				};
		}

		if (domain_nosub === "corriereobjects.it" && /^images[0-9]*\./.test(domain)) {
			// https://images2.corriereobjects.it/methode_image/2019/08/30/Spettacoli/Foto%20Gallery/LAPR0695_MGZOOM.JPG
			//   https://images2.corriereobjects.it/methode_image/2019/08/30/Spettacoli/Foto%20Gallery/LAPR0695.JPG -- 683x1024
			return src.replace(/_MGZOOM(\.[^/.]*)(?:[?#].*)?$/, "$1");
		}

		if (domain_nowww === "mojeek.com") {
			// https://www.mojeek.com/image?img=https://tse4.mm.bing.net/th?id=OIP.lCP89aMCgL4WOkfSgOjULwHaLJ&pid=Api&enf=jpeg
			//   https://tse4.mm.bing.net/th?id=OIP.lCP89aMCgL4WOkfSgOjULwHaLJ
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+image\?(?:.*&)?img=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "pic.templetons.com") {
			// https://pic.templetons.com/brad/photo/bm04/decomp/thumb/img_9158.jpg
			//   https://pic.templetons.com/brad/photo/bm04/decomp/img_9158.jpg
			return src.replace(/\/thumb\/+(img_[0-9]+\.[^/.]*)(?:[?#].*)?$/, "/$1");
		}

		if (domain === "assets.yandycdn.com") {
			// https://assets.yandycdn.com/t3-compressed/YL-83797_2.jpg?v=2019-02-22
			//   https://assets.yandycdn.com/Products/YL-83797_2.jpg
			//   https://assets.yandycdn.com/HiRez/YL-83797_2.jpg
			return src.replace(/\/(?:t[0-9]*(?:-compressed)?|Products)\/+/, "/HiRez/");
		}

		if (domain_nosub === "facciabuco.com" && /^cdn-img-[a-z]\./.test(domain)) {
			// https://cdn-img-n.facciabuco.com/73/zfcterwk7v-oxzfm_c.jpg
			//   https://cdn-img-n.facciabuco.com/73/zfcterwk7v-oxzfm_a.jpg
			//   https://cdn-img-n.facciabuco.com/73/zfcterwk7v-oxzfm_b.jpg
			return src.replace(/_[ac](\.[^/.]*)(?:[?#].*)?$/, "_b$1");
		}

		if (domain_nowww === "uskinfo.ba") {
			// http://www.uskinfo.ba/files/news_gallery/thumbs/58ad6aaeaf4e314.jpg
			//   http://www.uskinfo.ba/files/news_gallery/58ad6aaeaf4e314.jpg
			return src.replace(/(\/files\/+[^/]*\/+)thumbs\/+/, "$1");
		}

		if (domain_nowww === "drago99.com") {
			// http://www.drago99.com/Drago99/SaraJeanUnderwood17/tn28434891_227059267868071_7570589752869519360_n.jpg
			//   http://www.drago99.com/Drago99/SaraJeanUnderwood17/28434891_227059267868071_7570589752869519360_n.jpg
			return src.replace(/(\/Drago99\/+[^/]*\/+)tn([^/]*\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "galleries.justebonysex.com") {
			// http://galleries.justebonysex.com/photos/19/tp01.jpg
			//   http://galleries.justebonysex.com/photos/19/p01.jpg
			return src.replace(/(\/[0-9]+\/+)t(p[0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "intim-photos.ru") {
			// http://www.intim-photos.ru/photos/6/3238/thumb/intimnye_laski_temnokozhih_lesbi_1.jpg
			//   http://www.intim-photos.ru/photos/6/3238/intimnye_laski_temnokozhih_lesbi_1.jpg
			return src.replace(/(\/photos\/+[0-9]+\/+[0-9]+\/+)thumb\/+/, "$1");
		}

		if (domain === "hwnds.ddfstatic.com") {
			// https://hwnds.ddfstatic.com/ddfcash/content/ddf/659bj/thu/002.jpg
			//   https://hwnds.ddfstatic.com/ddfcash/content/ddf/659bj/fulm/002.jpg
			return src.replace(/(\/content\/.*\/)thu\/+([0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1fulm/$2");
		}

		if (domain_nosub === "mlo.me") {
			// https://www-s.mlo.me/upen/s/2018/201806/20180608/201806081154351718708.jpg
			//   https://www-s.mlo.me/upen/m/2018/201806/20180608/201806081154351718708.jpg
			//   https://www-s.mlo.me/upen/l/2018/201806/20180608/201806081154351718708.jpg
			//   https://www-s.mlo.me/upen/v/2018/201806/20180608/201806081154351718708.jpg -- watermark
			newsrc = src.replace(/(:\/\/[^/]*\/+upen\/+)[sm]\/+/, "$1l/");
			if (newsrc !== src) {
				return newsrc;
			}

			newsrc = src.replace(/(:\/\/[^/]+\/+upen\/+)l\/+/, "$1v/");
			if (newsrc !== src) {
				return {
					url: newsrc,
					problems: {
						watermark: true
					}
				};
			}
		}

		if (domain_nowww === "lilykoh.com") {
			// https://www.lilykoh.com/gb/fhg/content/lilysloungenon/125tn01.jpg
			//   https://www.lilykoh.com/gb/fhg/content/lilysloungenon/01.jpg
			return src.replace(/(\/content\/+[^/]*\/+)[0-9]+tn([0-9]+\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nosub === "utporn.com" && /^pics[0-9]*\./.test(domain)) {
			// https://pics1.utporn.com/albums/77/77532-gzupbtohqw/160x220/3.jpg
			//   https://pics1.utporn.com/albums/77/77532-gzupbtohqw/300/3.jpg
			//   https://pics1.utporn.com/albums/77/77532-gzupbtohqw/3.jpg
			return src.replace(/(\/albums\/+[0-9]+\/+[0-9]+-[^/]+\/+)[0-9]+(?:x[0-9]+)?\/+/, "$1");
		}

		if (domain_nowww === "girlsilove.net" ||
			// http://www.tight-clothed.com/galleries/zishy/victoria-voss/gets-the-hose-again/p-01-full__MG_8932.jpg
			//   http://www.tight-clothed.com/galleries/zishy/victoria-voss/gets-the-hose-again/01-full__MG_8932.jpg
			domain_nowww === "tight-clothed.com" ||
			// http://www.teen-angels.org/galleries/hegre-art/orsi/white/p-01-OrsiWhite_042208_001xxxl.jpg
			//   http://www.teen-angels.org/galleries/hegre-art/orsi/white/01-OrsiWhite_042208_001xxxl.jpg
			domain_nowww === "teen-angels.org" ||
			// http://www.nude-beauty.net/archive/abbywinters/d/dallas/01/p-01-dallas001.jpg
			//   http://www.nude-beauty.net/archive/abbywinters/d/dallas/01/01-dallas001.jpg
			domain_nowww === "nude-beauty.net" ||
			// http://www.rgsex.com/galleries/glamour-bikini/gallery163/p-02-kss-002.jpg
			//   http://www.rgsex.com/galleries/glamour-bikini/gallery163/02-kss-002.jpg
			domain_nowww === "rgsex.com") {
			// http://www.girlsilove.net/galleries/bikini-dare/bikini-dare-in-sant-josep/santjosep05/p-10-santjosep0430.jpg
			//   http://www.girlsilove.net/galleries/bikini-dare/bikini-dare-in-sant-josep/santjosep05/10-santjosep0430.jpg
			return src.replace(/(\/galleries\/+[^/]*\/+[^/]*\/+(?:[^/]*\/+)?|\/archive\/+[^/]*\/+.\/+[^/]*\/+[0-9]+\/+)p-([^/]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "easyhotpics.com") {
			// http://easyhotpics.com/tgp/phx/030411/t01.jpg
			//   http://easyhotpics.com/tgp/phx/030411/i01.jpg
			// http://easyhotpics.com/tgp/jerkoff/shay-laren-wants-give-you-learn-best-way-to/t1.jpg
			//   http://easyhotpics.com/tgp/jerkoff/shay-laren-wants-give-you-learn-best-way-to/1.jpg
			return src
				.replace(/(\/tgp\/+[^/]+\/+[0-9]+\/+)t([0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1i$2")
				.replace(/(\/tgp\/+[^/]*\/+[^/]*\/+)t([0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "cdn.pax6.com") {
			// https://cdn.pax6.com/galleries/2016/12/15/5738fd30b1ede72ff0152636/images/t06.jpg
			//   https://cdn.pax6.com/galleries/2016/12/15/5738fd30b1ede72ff0152636/images/i06.jpg
			return src.replace(/(\/galleries\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9a-f]{10,}\/+images\/+)t([0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1i$2");
		}

		if (domain === "promo.hollyrandall.com") {
			// https://promo.hollyrandall.com/hr-photo/exotic-dreams/img/tn-1.jpg
			//   https://promo.hollyrandall.com/hr-photo/exotic-dreams/img/img-1.jpg
			return src.replace(/\/img\/+tn-([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/img/img-$1");
		}

		if (domain_nowww === "bikinidream.net") {
			// http://www.bikinidream.net/gals/glam0078/th_01.jpg
			//   http://www.bikinidream.net/gals/glam0078/01.jpg
			return src.replace(/(\/gals\/+[^/]+\/+)th_([0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "cdnberry.com") {
			// https://cdnberry.com/posts/daeb0873/th_13.jpg
			//   https://cdnberry.com/posts/daeb0873/13.jpg
			return src.replace(/(\/posts\/+[^/]+\/+)th_([^/]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "nakedebonybabes.com") {
			// http://nakedebonybabes.com/dmx/ftr/1f5386/th_02.jpg
			//   http://nakedebonybabes.com/dmx/ftr/1f5386/02.jpg
			return src.replace(/(\/[0-9a-f]+\/+)th_([0-9]+\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "picua.org") {
			// https://picua.org/thumbs/2017-08/22/jbdy4v3oit757ebhguwhf4mrw.jpg
			//   https://picua.org/img/2017-08/22/jbdy4v3oit757ebhguwhf4mrw.jpg
			return src.replace(/(:\/\/[^/]*\/+)thumbs\/+([0-9]{4}-[0-9]{2}\/+)/, "$1img/$2");
		}

		if (domain_nowww === "mariuszlewandowski.pl" ||
			// https://voiceshop.pl/environment/cache/images/300_300_productGfx_23950/rare-b-iext56853906.jpg
			//   https://voiceshop.pl/userdata/gfx/23950/rare-b-iext56853906.jpg
			domain_nowww === "voiceshop.pl") {
			// https://www.mariuszlewandowski.pl/environment/cache/images/300_300_productGfx_217b8de435ff985c8893ff43f039aa77.jpg
			//   https://www.mariuszlewandowski.pl/userdata/gfx/217b8de435ff985c8893ff43f039aa77.jpg
			return src.replace(/\/environment\/+cache\/+images\/+[0-9]+_[0-9]+_productGfx_/, "/userdata/gfx/");
		}

		if (domain_nowww === "s5o.ru" ||
			// https://s5o.sports.ru/storage/simple/ru/ugc/e3/4d/88/ce/ruub165b83b43.113.150x300.jpg
			//   https://s5o.sports.ru/storage/simple/ru/ugc/e3/4d/88/ce/ruub165b83b43.jpg
			domain === "s5o.sports.ru") {
			// https://s5o.ru/storage/simple/ru/ugc/e3/4d/88/ce/ruub165b83b43.113.150x300.jpg
			//   https://s5o.ru/storage/simple/ru/ugc/e3/4d/88/ce/ruub165b83b43.jpg
			return src.replace(/(\/storage\/+simple\/.*\/[0-9a-z]+)\.[0-9]+\.[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "trunkarchive.com") {
			// https://www.trunkarchive.com/A.aspx?url=Assets/V2/YRlaU7ygN7s3h25FR2y6nxXkckLyqXzNuT9MHtr8ohyk1u1B4KusdjeWQTbYdIyp1Lv7b065Dv0uCOXtBsHLsgvrT3nOvajkRVEM6NrWK@8*/jD92.rIH.ciTmI.e/Io7DsxNrq3AZTPwb/TRU1808338.jpg
			//   https://www.trunkarchive.com/Assets/V2/YRlaU7ygN7s3h25FR2y6nxXkckLyqXzNuT9MHtr8ohyk1u1B4KusdjeWQTbYdIyp1Lv7b065Dv0uCOXtBsHLsgvrT3nOvajkRVEM6NrWK@8*/jD92.rIH.ciTmI.e/Io7DsxNrq3AZTPwb/TRU1808338.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+A\.aspx\?(?:.*?&)?url=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return urljoin(src, decodeuri_ifneeded(newsrc), true);
		}

		if (domain === "img.mbjuan.com") {
			// http://img.mbjuan.com/content/media/thumbs/p00478386_195.jpeg
			//   http://img.mbjuan.com/content/media/thumbs/p00478386.jpeg
			return src.replace(/(\/content\/+media\/+thumbs\/+p[0-9]+)_[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "ua.today") {
			// http://ua.today/resize_img/180x120/images/news/2017/%D0%B4%D0%B5%D0%BA%D0%B0%D0%B1%D1%80%D1%8C/14/zK_df6O3RlM.jpg
			//   http://ua.today/images/news/2017/%D0%B4%D0%B5%D0%BA%D0%B0%D0%B1%D1%80%D1%8C/14/zK_df6O3RlM.jpg
			return src.replace(/\/resize_img\/+[0-9]+x[0-9]+\/+images\/+/, "/images/");
		}

		if (domain_nowww === "nashaamerica.com") {
			// http://www.nashaamerica.com/files/news/2017/12/26/3-250-200/8753608c78c289fb24f1a4cb7ed29f08.jpg
			//   http://www.nashaamerica.com/files/news/2017/12/26/original/8753608c78c289fb24f1a4cb7ed29f08.jpg
			// http://www.nashaamerica.com/files/news/2016/12/05/w-650-/487ac0fc86693a496699853871fd7def.jpg
			//   http://www.nashaamerica.com/files/news/2016/12/05/original/487ac0fc86693a496699853871fd7def.jpg
			return src.replace(/(\/files\/+news\/+[0-9]{4}\/+[0-9]{2}\/+[0-9]{2}\/+)[^/]*\/+([0-9a-f]{10,}\.[^/.]*)(?:[?#].*)?$/, "$1original/$2");
		}

		if (domain_nowww === "bootysource.com") {
			// https://www.bootysource.com/img2/Rihanna2017BarbadosCarni4_small.jpg
			//   https://www.bootysource.com/img2/Rihanna2017BarbadosCarni4.jpg
			return src.replace(/(\/img2\/+[^/]*)_small(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "img.freshpopmusic.co") {
			// https://img.freshpopmusic.co/hsi/aHR0cHM6Ly8yLmJwLmJsb2dzcG90LmNvbS8tTlQ3TVdIbldJb0kvV1lsYV91eG9YSkkvQUFBQUFBQURkbEkvMGxVdWpzczc2ZUFPWHlNcVpvV3V6cXBYQm5KR0tVSWNRQ0xjQkdBcy9zMTYwMC9yaXJpMS5qcGc=/images/riri1.jpg
			//   https://2.bp.blogspot.com/-NT7MWHnWIoI/WYla_uxoXJI/AAAAAAADdlI/0lUujss76eAOXyMqZoWuzqpXBnJGKUIcQCLcBGAs/s0/riri1.jpg=s0?imgmax=0
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+hsi\/+([^/.]{50,})\/+.*/, "$1");
			if (newsrc !== src)
				return base64_decode(newsrc);
		}

		if (domain_nosub === "lifo.gr") {
			// https://m.lifo.gr/icache/440/652/1/1232675_riri3.jpg
			//   https://m.lifo.gr/uploads/image/1232675/riri3.jpg
			// https://www.lifo.gr/icache/440/318/1/1232692_%CE%B4%CE%B4%CE%B4%CF%83%CF%83.jpg
			//   https://www.lifo.gr/uploads/image/1232692/%CE%B4%CE%B4%CE%B4%CF%83%CF%83.jpg
			return src.replace(/\/icache\/+[0-9]+\/+[0-9]+\/+[0-9]\/+([0-9]+)_/, "/uploads/image/$1/");
		}

		if (domain_nowww === "epicenter.bg") {
			// http://epicenter.bg/images/news/82017/thumbs/sml_1502184904.jpg
			//   http://epicenter.bg/images/news/82017/pics/1502184904.jpg
			return src.replace(/(\/images\/+news\/+[0-9]+\/+)thumbs\/+[a-z]+_/, "$1pics/");
		}

		if (domain_nosub === "yokacdn.com") {
			// http://modp1.yokacdn.com/a.jpg?imageurl=http://modp1.yokacdn.com/pic/2017/08/08/14febbcd27044cccbf87754678fd6eda.jpg&width=350&cutdestheight=280
			//   http://modp1.yokacdn.com/pic/2017/08/08/14febbcd27044cccbf87754678fd6eda.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+a\.jpg\?(?:.*&)?imageurl=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (amazon_container === "stezor-img-res") {
			// http://stezor-img-res.s3-website.eu-central-1.amazonaws.com/600x0/0eefab17-aa8b-4f8e-9017-7b9442d1ee9e
			//   http://stezor-img-res.s3-website.eu-central-1.amazonaws.com/0eefab17-aa8b-4f8e-9017-7b9442d1ee9e
			return src.replace(/\/[0-9]+x[0-9]+\/+([-0-9a-f]{20,})(?:[?#].*)?$/, "/$1");
		}

		if (domain === "cdn.letrasdemusicas.fm") {
			// https://cdn.letrasdemusicas.fm/production/images/2014/10/cover_After%20School-ec171db9-48f1-45db-899a-1d9c9fd648ad.jpg
			//   https://cdn.letrasdemusicas.fm/production/images/2014/10/After%20School-ec171db9-48f1-45db-899a-1d9c9fd648ad.jpg
			return src.replace(/(\/production\/+images\/+[0-9]{4}\/+[0-9]{2}\/+)cover_([^/]*\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "img.erogazou.gallery" ||
			// http://img-fdc03.erogazounosuke.com/post3/4691/s/11.jpg
			//   http://img-fdc03.erogazounosuke.com/post3/4691/b/11.jpg
			domain_nosub === "erogazounosuke.com") {
			// https://img.erogazou.gallery/articles2/4777/s/29.jpg
			//   https://img.erogazou.gallery/articles2/4777/b/29.jpg
			// https://img.erogazou.gallery/articles/987/s/01.jpg
			//   https://img.erogazou.gallery/articles/987/b/01.jpg
			return src.replace(/(\/[a-z]+[0-9]*\/+[0-9]+\/+)s(\/+[0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1b$2");
		}

		if (domain === "screens.latestscreens.com") {
			// https://screens.latestscreens.com/screenshots/saintsrow2/thumbs/saints_row_04.jpg
			//   https://screens.latestscreens.com/screenshots/saintsrow2/saints_row_04.jpg
			return src.replace(/(\/screenshots\/+[^/]+\/+)thumbs\/+/, "$1");
		}

		if (domain_nowww === "perfect-girls-net.com") {
			// http://perfect-girls-net.com/victoria_justice/thumbs/victoria_justice_005.jpg
			//   http://perfect-girls-net.com/victoria_justice/victoria_justice_005.jpg
			return src.replace(/\/thumbs\/+([^/]+\.[^/.]*)(?:[?#].*)?$/, "/$1");
		}

		if (domain_nowww === "mobygames.com") {
			// https://www.mobygames.com/images/shots/s/352934-saints-row-2-windows-screenshot-saints-row-2-isn-t-for-pussies.jpg
			//   https://www.mobygames.com/images/shots/t/352934-saints-row-2-windows-screenshot-saints-row-2-isn-t-for-pussies.jpg
			//   https://www.mobygames.com/images/shots/l/352934-saints-row-2-windows-screenshot-saints-row-2-isn-t-for-pussies.jpg
			// https://www.mobygames.com/images/covers/s/376394-lost-eden-linux-front-cover.jpg
			//   https://www.mobygames.com/images/covers/l/376394-lost-eden-linux-front-cover.jpg
			return src.replace(/(\/images\/+(?:shots|covers)\/+)[st]\/+/, "$1l/");
		}

		if (domain === "img.bhs4.com") {
			// https://img.bhs4.com/aa/0/aa029164b7d2723af00e32f9960287b44362e909_small.jpg
			//   https://img.bhs4.com/aa/0/aa029164b7d2723af00e32f9960287b44362e909_orig.jpg
			return src.replace(/(\/[0-9a-f]{2}\/+[0-9a-f]\/+[0-9a-f]{20,})_[a-z]+(\.[^/.]*)(?:[?#].*)?$/, "$1_orig$2");
		}

		if (domain === "pisces.bbystatic.com") {
			// https://pisces.bbystatic.com/image2/BestBuy_US/images/products/8814/8814802_500x500_sa.jpg;maxHeight=150;maxWidth=200
			//   https://pisces.bbystatic.com/image2/BestBuy_US/images/products/8814/8814802_500x500_sa.jpg
			//   https://pisces.bbystatic.com/image2/BestBuy_US/images/products/8814/8814802.jpg -- 105x120
			return src.replace(/(\/images\/+products\/+[0-9]+\/+[0-9]+(?:_[^/.]*)\.[^/.;]+);.*/, "$1");
		}

		if (domain_nowww === "celebs101.com") {
			// https://www.celebs101.com/gallery/Selena_Gomez/412117/tn_Selena_Gomez_Picture.jpg
			//   https://www.celebs101.com/gallery/Selena_Gomez/412117/Selena_Gomez_Picture.jpg
			// http://www.celebs101.com/screen-savers/Keira-Knightley/tn_Keira%20Knightley%2017.jpg
			//   http://www.celebs101.com/screen-savers/Keira-Knightley/Keira%20Knightley%2017.jpg
			return src.replace(/(\/(?:gallery|screen-savers)\/+[^/]*\/+(?:[0-9]+\/+)?)tn_([^/]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "nnconnect.com") {
			// https://www.nnconnect.com/cum4k/jessie_saint/tn_jessie_saint-01.jpg
			//   https://www.nnconnect.com/cum4k/jessie_saint/jessie_saint-01.jpg
			newsrc = src.replace(/(:\/\/[^/]+\/[^/]+\/+[^/]+\/+)tn_([^/]+-[0-9]+\.[^/.]+)(?:[?#].*)?$/, "$1$2");
			if (newsrc !== src)
				return {
					url: newsrc,
					extra: {
						page: src.replace(/(:\/\/[^/]+\/+[^/]+\/+[^/]+)\/.*$/, "$1.html")
					}
				};
		}

		if (domain_nowww === "hq-celebrity.com") {
			// http://hq-celebrity.com/photos/selena-gomez-2011-12-09/tn_selena-gomez-6.jpg
			//   http://hq-celebrity.com/photos/selena-gomez-2011-12-09/selena-gomez-6.jpg
			newsrc = src.replace(/(\/photos\/+[^/]*\/+)tn_([^/]*)(?:[?#].*)?$/, "$1$2");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nowww === "hq-celebrity.com") {
			// http://hq-celebrity.com/wp-content/plugins/watermark-hotlinked-images/watermark.php?img=photos/selena-gomez-2011-12-09/tn_selena-gomez-22.jpg
			// http://hq-celebrity.com/wp-content/plugins/watermark-hotlinked-images/watermark.php?img=photos/selena-gomez-2011-12-09/tn_selena-gomez-6.jpg
			//   http://hq-celebrity.com/photos/selena-gomez-2011-12-09/tn_selena-gomez-6.jpg
			newsrc = src.replace(/\/wp-content\/+plugins\/+watermark-hotlinked-images\/+watermark\.php\?(?:.*&)?img=([^&]*).*?$/, "/$1");
			if (newsrc !== src)
				return newsrc;

			return {
				url: src,
				headers: {
					Referer: ""
				}
			};
		}

		if (domain === "d3bhdfps5qyllw.cloudfront.net") {
			// thanks to afterdelight on github: https://github.com/qsniyg/maxurl/issues/153
			// https://d3bhdfps5qyllw.cloudfront.net/sqr/0f/0fa3d6cb4776d9c8827ac13649fcd653_1080x1080_w.jpg
			//   https://d3bhdfps5qyllw.cloudfront.net/org/0f/0fa3d6cb4776d9c8827ac13649fcd653_1080x1080_w.jpg
			// https://d3bhdfps5qyllw.cloudfront.net/thm/c7/c75a7cac21082ac3a712804dc5615c9d_2480x2986_h.jpg
			//   https://d3bhdfps5qyllw.cloudfront.net/org/c7/c75a7cac21082ac3a712804dc5615c9d_2480x2986_h.jpg
			return src.replace(/(:\/\/[^/]*\/+)(?:sqr|thm)\/+/, "$1org/");
		}

		if (domain_nowww === "imageocd.com") {
			// http://imageocd.com//images/hairstyles/taylor-spreitler-hairstyles/main/taylor-spreitler-hairstyles.jpg.thumb_100_width.jpg
			//   http://imageocd.com//images/hairstyles/taylor-spreitler-hairstyles/taylor-spreitler-hairstyles.jpg
			// http://imageocd.com/u/1/m_t/1/taylor-lautner-hairstyles/taylor-lautner-hairstyles.jpg.thumb_100_width.jpg
			//   http://imageocd.com/u/1/i/1/taylor-lautner-hairstyles.jpg
			return src
				.replace(/(\/images\/+[^/]+\/+[^/]+\/+)main\/+([^/]*?\.[^/.]*)\.thumb_[0-9]+_[a-z]+\.[^/.]*(?:[?#].*)?$/, "$1$2")
				.replace(/(\/u\/+[0-9]+\/+)m_[a-z]\/+([0-9]+\/+)[^/]*\/+([^/]*?\.[^/.]*)\.thumb_[0-9]+_[a-z]+\.[^/.]*(?:[?#].*)?$/, "$1i/$2$3");
		}

		if (domain_nowww === "kickasspays.com") {
			// http://www.kickasspays.com/galleries/bree_olson/bree_olson_01_t.jpg
			//   http://www.kickasspays.com/galleries/bree_olson/bree_olson_01.jpg
			return src.replace(/(\/galleries\/+[^/]*\/+[^/]*)_t(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nosub === "kickass.com") {
			// http://delivery-f.kickass.com/kickasspays/fhgs/pics/content/9/18/01_t.jpg
			//   http://delivery-f.kickass.com/kickasspays/fhgs/pics/content/9/18/01_b.jpg
			return src.replace(/(\/fhgs\/+pics\/+content\/+[0-9]+\/+[0-9]+\/+[0-9]+)_t(\.[^/.]+)(?:[?#].*)?$/, "$1_b$2");
		}

		if (domain_nowww === "xnudehack.com") {
			// http://xnudehack.com/imgwp/t_selena_gomez_mouth.jpg
			//   http://xnudehack.com/imgcache/selena_gomez_mouth.jpg
			return src.replace(/\/imgwp\/+t_/, "/imgcache/");
		}

		if (domain === "media.karups.com" ||
			// https://media.boyfun.com/content/bfc/2018-02/photos/jerome_james-solo-2/lowres/thumbs/jerome_james_lowres_005.thumb.jpg
			//   https://media.boyfun.com/content/bfc/2018-02/photos/jerome_james-solo-2/highres/jerome_james_highres_005.jpg
			domain === "media.boyfun.com") {
			// https://media.karups.com/content/kha/2019-10/photos/carmella_santos-solo-1/lowres/thumbs/carmella_santos_lowres_009.thumb.jpg
			//   https://media.karups.com/content/kha/2019-10/photos/carmella_santos-solo-1/lowres/carmella_santos_lowres_009.jpg
			// other:
			// https://media.karups.com/content/kha/f/freya_von_doom/3-1500/lowres/freya_von_doom-3-1500-009.jpg
			newsrc = src.replace(/(\/lowres\/+)thumbs\/+([^/]*)\.thumb(\.[^/.]*)(?:[?#].*)?$/, "$1$2$3");
			if (newsrc !== src)
				return newsrc;

			// https://media.karups.com/content/kha/2019-10/photos/carmella_santos-solo-1/lowres/carmella_santos_lowres_009.jpg
			//   https://media.karups.com/content/kha/2019-10/photos/carmella_santos-solo-1/highres/carmella_santos_highres_009.jpg
			return src.replace(/\/lowres\/+([^/]*)_lowres(_[0-9]+\.[^/.]*)(?:[?#].*)?$/, "/highres/$1_highres$2");
		}

		if (domain_nowww === "freefeet4u.com") {
			// http://www.freefeet4u.com/nikki_brooks/exposing_wet_pink_pussy_and_feet/nikki_brooks_02_t.jpg
			//   http://www.freefeet4u.com/nikki_brooks/exposing_wet_pink_pussy_and_feet/nikki_brooks_02_b.jpg
			return src.replace(/(_[0-9]+)_t(\.[^/.]*)(?:[?#].*)?$/, "$1_b$2");
		}

		if (domain === "content.atkingdom.com") {
			// https://content.atkingdom.com/models/kar113/335205/160617/kar113JSP_335205001_tn.jpg
			//   https://content.atkingdom.com/models/kar113/335205/160617/kar113JSP_335205001.jpg
			return src.replace(/(\/models\/+[^/]*\/+[0-9]+\/+[0-9]+\/+[^/]*)_tn(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nosub === "atkingdom-network.com" && /^(?:cdn[0-9]*|content)\./.test(domain)) {
			// https://cdn90.atkingdom-network.com/secure/content/l/lea048/370590/thumbs/lea048ALP_370590001.jpg?h=26e510de1d785a5b87229a9ad0faa9f8&site=1003
			//   https://cdn90.atkingdom-network.com/secure/content/l/lea048/370590/lea048ALP_370590001.jpg
			//   https://cdn90.atkingdom-network.com/secure/content/l/lea048/370590/3000/lea048ALP_370590001.jpg -- 2001x3000
			// https://content.atkingdom-network.com/secure/content/a/ale171/375225/thumbs/ale171GBP_375225003.jpg?h=0884af4473d0b919edcbecd5466b45f5&site=1003
			//   https://content.atkingdom-network.com/secure/content/a/ale171/375225/3000/ale171GBP_375225003.jpg
			return src.replace(/(\/secure\/+content\/+.\/+[^/]+\/+[0-9]+\/+)(?:thumbs\/+)?([^/?]+)(?:[?#].*)?$/, "$13000/$2");
		}

		if (domain === "bl.definefetish.com") {
			// http://bl.definefetish.com/1/16/20861/thumb/01.jpg
			//   http://bl.definefetish.com/1/16/20861/01.jpg
			return src.replace(/\/thumb\/+([^/]+\.[^/.]*)(?:[?#].*)?$/, "/$1");
		}

		if (domain === "fileup.calobye.com") {
			// http://fileup.calobye.com/m_250/upload/gallery/201811/1541496480_66.jpg
			//   http://fileup.calobye.com/upload/gallery/201811/1541496480_66.jpg
			return src.replace(/\/m_[0-9]+\/+upload\/+/, "/upload/");
		}

		if (domain_nowww === "chyoa.com") {
			// https://chyoa.com/data/covers/s/6/6006.jpg?1473188430
			//   https://chyoa.com/data/covers/l/6/6006.jpg?1473188430
			return src.replace(/\/data\/+covers\/+[sm]\/+/, "/data/covers/l/");
		}

		if (domain_nowww === "m1sv.net") {
			// http://m1sv.net/000531/Resize/150623_13-58-05_018.jpg
			//   http://m1sv.net/000531/150623_13-58-05_018.jpg
			return src.replace(/(\/[0-9]+\/+)Resize\/+/, "$1");
		}

		if (domain === "image.i-bbs.sijex.net") {
			// http://image.i-bbs.sijex.net/bbs/nozomi99/1418562979555s.jpg
			//   http://image.i-bbs.sijex.net/bbs/nozomi99/1418562979555o.jpg
			return {
				url: src.replace(/(\/[0-9]{5,})[sm](\.[^/.]*)(?:[?#].*)?$/, "$1o$2"),
				headers: {
					Referer: ""
				}
			};
		}

		if (domain_nowww === "pic-b.com") {
			// http://pic-b.com/photo/3/251531/251531-110338-111-297605.jpg
			//   http://pic-b.com/photo/3/251531/251531-110338-111-297605-pc.jpg
			return src.replace(/(\/photo\/+[0-9]+\/+[0-9]+\/+[-0-9]{20,})(\.[^/.]*)(?:[?#].*)?$/, "$1-pc$2");
		}

		if (domain_nosub === "momogaki.com") {
			// http://m3.momogaki.com/bbs/jkseifuku30/img2/163529.jpg
			//   http://m3.momogaki.com/bbs/jkseifuku30/img/163529.jpg
			return src.replace(/\/img2\/+([0-9]+\.[^/.]*)(?:[?#].*)?$/, "/img/$1");
		}

		if (domain === "images.contentexchange.me") {
			// https://images.contentexchange.me/fit/magic/?url=http%3A%2F%2Fwww.gossip-tv.gr%2Fmedia%2Fcom_news%2Fgalleries%2F2018%2F03%2F28%2F104973%2Fphotos%2Fthumb%2F---2832018-21409-.jpg&size=300x300
			//   http://www.gossip-tv.gr/media/com_news/galleries/2018/03/28/104973/photos/thumb/---2832018-21409-.jpg
			newsrc = src.replace(/.*?(?:.*&)?url=(https?%[^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (false && domain === "thumbs.uloz.to") {
			// disabling because it has signatures now, would likely require a pagelink rule
			// https://ulozto.sk/file/8n5SQuAkGuN5/sexy-harley-quinn-2017-suicide-squad-1600x900-jpg
			// https://thumbs.uloz.to/2/d/9/2d91cf52c015bf9395769692bdd6258b.260x170.jpg?vt=1572476399&sg=XYxbphU_HKl9xG_v0aoHQw&bl=
			//   https://thumbs.uloz.to/2/d/9/2d91cf52c015bf9395769692bdd6258b.9999999999999x9999999999999.jpg
			return src.replace(/(\/[0-9a-f]\/+[0-9a-f]\/+[0-9a-f]\/+[0-9a-f]{20,})\.[0-9]+x[0-9]+(\.[^/.?]*)(?:[?#].*)?$/, "$1.9999999999999x9999999999999$2");
		}

		if (domain_nowww === "patreon.com") {
			// https://www.patreon.com/posts/citra-for-is-37421346
			var get_patreon_imagemeta = function(url) {
				var match = url.match(/\/patreon-media\/+p\/+post\/+([0-9]+)\/([0-9a-f]{20,})\/+([^/]+)\/+/);
				if (!match)
					return null;

				return {
					modifiers: match[3],
					postid: match[1],
					imagehash: match[2]
				};
			};

			var find_id_in_included = function(included, id) {
				for (var i = 0; i < included.length; i++) {
					if (included[i].id === id)
						return included[i];
				}

				return null;
			};

			var are_modifiers_original = function(modifiers) {
				try {
					var obj = JSON_parse(base64_decode(decodeURIComponent(modifiers)));
					var obj_string = JSON_stringify(obj);

					// FIXME: is the second correct?
					return obj_string === JSON_stringify({}) || obj_string === JSON_stringify({"p":1});
				} catch (e) {
					console_log(modifiers);
					console_error(e);
					return false;
				}
			};

			// TODO: campaigns, user pictures
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+posts\/+(?:[^/?#]+-)?([0-9]+)(?:[?#].*)?$/,
				// or: https://www.patreon.com/api/posts/${id}
				query_for_id: "https://www.patreon.com/posts/${id}",
				override_cb: function(cb, data) {
					if (!data) return cb(data);

					var imu_url = src.match(/#imu-url=(.*)$/);
					var imu_imgmeta = null;

					if (imu_url) {
						imu_url = imu_url[1];
						imu_imgmeta = get_patreon_imagemeta(imu_url);
					}

					if (!imu_imgmeta) {
						data.album_info.links[0].is_current = true;
					} else {
						array_foreach(data.album_info.links, function(link, i) {
							// todo: factor regex out of here
							var link_imgmeta = get_patreon_imagemeta(link.url);
							if (!link_imgmeta) {
								console_warn("Invalid match for", link);
								return;
							}

							if (link_imgmeta.imagehash === imu_imgmeta.imagehash) {
								link.is_current = true;

								if (link_imgmeta.modifiers === imu_imgmeta.modifiers) {
									// thanks to YaBoiBurner on github for reporting: https://github.com/qsniyg/maxurl/issues/524
									link.url = imu_url;
								}

								data.url = link.url;
								return false;
							}
						});
					}

					let dataurl_imgmeta = get_patreon_imagemeta(data.url);
					if (dataurl_imgmeta && are_modifiers_original(dataurl_imgmeta.modifiers)) {
						data.is_original = true;
					}

					cb(data);
				},
				process: function(done, resp, cache_key) {
					//var match = resp.responseText.match(/Object\.assign\s*\(\s*window\.patreon\.bootstrap\s*,\s*({[\s\S]*?})\);\s*Object\./);
					var match = resp.responseText.match(/window\.patreon\s*=\s*({.*?});\s/);
					if (!match) {
						match = resp.responseText.match(/<script id="__NEXT_DATA__" type="application\/json">({.*?})<\/script>/);
					}
					if (!match) {
						console_error(cache_key, "Unable to find bootstrap match for", resp);
						return done(null, false);
					}

					var json = JSON_parse(match[1]);
					// next_data
					if (json.props && json.props.pageProps) {
						json = json.props.pageProps.bootstrapEnvelope;
					}

					if (json.bootstrap)
						json = json.bootstrap;
					else if (json.pageBootstrap)
						json = json.pageBootstrap;
					else {
						console.warn(cache_key, "No boostrap in", json);
					}

					var post = json.post;
					var attributes = post.data.attributes;
					var metadata = attributes.post_metadata;
					var image_ids = [];
					if (metadata) image_ids = metadata.image_order;
					var included = post.included;

					var images = [];

					array_foreach(image_ids, function(image_id) {
						var image_data = find_id_in_included(included, image_id).attributes;

						var image_url;

						// for some reason blurred posts ({"b":1}) return {"b":1,"p":1} for "original" which is 404, but no download_url either
						if (image_data.image_urls.original) {
							image_url = image_data.image_urls.original;
						} else if (image_data.download_url) {
							image_url = image_data.image_urls.download_url;
						} else if (image_data.image_urls.default) {
							image_url = image_data.image_urls.default;
						}

						if (!image_url) {
							console_warn(cache_key, "Unable to find image URL in", image_data);
							return;
						}

						images.push({
							url: image_url,
							is_current: false
						});
					});

					if (!images.length) {
						if (attributes.image) {
							var imageobj = attributes.image;
							var imageurl = imageobj.large_url || imageobj.url;
							var imagemeta = get_patreon_imagemeta(imageurl);

							if (attributes.post_file) {
								var post_url = attributes.post_file.url;
								var posturl_meta = get_patreon_imagemeta(post_url);

								if (posturl_meta.imagehash === imagemeta.imagehash) imageurl = post_url;
							}

							if (imageurl) {
								images.push({
									url: imageurl,
									is_current: false
								});
							}
						}
					}

					if (!images.length)
						return done(null, false);

					var obj = {
						url: images[0].url,
						extra: {
							page: attributes.url || resp.finalUrl,
							caption: attributes.title
						},
						album_info: {
							type: "links",
							links: images
						}
					};

					return done(obj, 60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nosub === "patreonusercontent.com") {
			match = src.match( /\/([^/]*)\/+patreon-media\/+p\/+post\/+([0-9]+)\/([0-9a-f]{20,})\/+/);
			if (match) {
				//var modifiers = match[1];
				var posthash = match[3];
				var postid = match[2];

				return {
					url: "https://www.patreon.com/posts/" + postid + "#imu-url=" + src,
					is_pagelink: true
				};
			}
		}

		if (domain === "s3.dexerto.com") {
			// https://s3.dexerto.com/thumbnails/_thumbnailSmall/Apex-Legends-Binging-with-Babish-takes-on-Mirages-unpalatablerecipe.jpg
			//   https://s3.dexerto.com/thumbnails/_thumbnailLarge/Apex-Legends-Binging-with-Babish-takes-on-Mirages-unpalatablerecipe.jpg
			// other:
			// https://s3.dexerto.com/articles/brigitte_ow_5_smaller.jpg
			return src.replace(/\/thumbnails\/+_thumbnailSmall\/+/, "/thumbnails/_thumbnailLarge/");
		}

		if (domain === "scp.indiegames.us") {
			// http://scp.indiegames.us/scn/Star%20Wars%20Conversion/swinterdictor003308217ea_tn.jpg
			//   http://scp.indiegames.us/scn/Star%20Wars%20Conversion/swinterdictor003308217ea.jpg
			return src.replace(/(\/scn\/+[^/]*\/+[^/]+)_tn(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "content.ray-web.jp") {
			if (/\/photos\/+pictures\/+[0-9]+\/+original\/+[0-9a-f]{20,}\./.test(src))
				return {
					url: src,
					is_original: true
				};
		}

		if (domain_nowww === "ray-web.jp") {
			// thanks to vick2 on greasyfork: https://greasyfork.org/en/forum/discussion/65328/add-support-for-ray-web-jp
			// https://ray-web.jp/50370/photos/47668
			// https://content.ray-web.jp/photos/pictures/47668/medium/d51ee4a492a483a6606aa407015527ae1b9f986d.jpg?1550540662
			//   https://content.ray-web.jp/photos/pictures/47668/original/7c23b2b23bf40ec891feb577fdf69e0335545fe6.jpg?1550540662
			// other:
			// https://ray-web.jp/series/riho
			//   https://content.ray-web.jp/series/images/17/original/a2695c70afbe13d62003e7d8f38291247e853e64.png?1568888397
			newsrc = website_query({
				website_regex: /^([a-z]+:\/\/[^/]+\/+[0-9]+\/+photos\/+[0-9]+)(?:[?#].*)?$/,
				query_for_id: "${id}",
				process: function(done, resp, cache_key) {
					var url = get_meta(resp.responseText, "og:image");
					if (!url) {
						console_error(cache_key, "Unable to find og:image from", resp);
						return done(null, false);
					}

					return done(url, 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (host_domain_nowww === "ray-web.jp" && domain === "content.ray-web.jp" && options.element) {
			newsrc = common_functions["get_pagelink_el_matching"](options.element, /^[a-z]+:\/\/[^/]+\/+[0-9]+\/+photos\/+[0-9]+/);
			if (newsrc) return newsrc;

			if (options.element.tagName === "IMG" &&
				options.element.parentElement && options.element.parentElement.classList.contains("current_photo")) {
				var match = options.host_url.match(/\/([0-9]+)\/+photos\/+([0-9]+)/);
				if (match) {
					return {
						url: options.host_url,
						is_pagelink: true
					};
				}
			}
		}

		if (domain_nowww === "imgsrc.ru") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+([^/]+\/+[0-9]+)\.html(?:[?#].*)?$/,
				query_for_id: {
					url: "https://imgsrc.ru/${id}.html",
					headers: {
						Referer: ""
					}
				},
				process: function(done, resp, cache_key) {
					let matches = match_all(resp.responseText, /<source id='big-pic-[a-z]+' srcset='(\/\/b[0-9]+\.[^'"]+)'/);
					if (!matches) {
						console_error(cache_key, "Unable to find image match for", resp);
						return done(null, false);
					}

					let images = [];
					for (let match of matches) {
						images.push(urljoin(resp.finalUrl, decode_entities(match[1]), true));
					}

					images.sort((a, b) => {
						if (/\.webp$/.test(a))
							return 1;
						if (/\.webp$/.test(b))
							return -1;

						return 0;
					});

					let captionmatch = resp.responseText.match(/<img src='[^']+'[^>]* class='big'[^>]* alt='([^'"]+)'/);
					let caption = null
					if (!captionmatch) {
						console_warn(cache_key, "Unable to find caption match for", resp);
					} else {
						caption = decode_entities(captionmatch[1]);
					}

					let result = fillobj_urls(images, {
						extra: {
							caption,
							page: resp.finalUrl
						}
					});

					return done(result, 6*60*60);
				},
				// kept only for reference
				_process_old: function(done, resp, cache_key) {
					var match = resp.responseText.match(/<img class='big' src='(\/\/s[0-9]+\.[^'"]+)' alt='([^'"]+)'/);
					if (!match) {
						console_error(cache_key, "Unable to find image match for", resp);
						return done(null, false);
					}

					var imgsrc = urljoin(resp.finalUrl, decode_entities(match[1]), true);
					var caption = decode_entities(match[2]);

					match = resp.responseText.match(/<script(?:\s+type=["']text\/javascript["'])?>\s*?var\s+(\S+)\s*=\s*["'](.*?)["'][\s\S]*?["']\+(?:[a-z]\+)?((?:\1(?:\s*\.\s*charAt\s*\(\s*|\s*\[\s*)([0-9]+)\s*(?:\)|\])\s*\+\s*){1,})\s*['"][\s\S]*?<\/script>/);
					if (!match) {
						// todo: don't fail, fallback to imgsrc
						console_error(cache_key, "Unable to find cipher match for", resp);
						return done(null, false);
					}

					var splitted = match[3].split("+");
					var chars = "";
					for (var i = 0; i < splitted.length; i++) {
						var charid = splitted[i].replace(/.*(?:\[|\()\s*([0-9]+).*?$/, "$1");
						if (charid !== splitted[i])
							chars += string_charat(match[2], charid);
					}

					if (chars.length !== 3) {
						console_error(cache_key, "Invalid chars:", chars, resp);
						return done(null, false);
					}

					var newsrc = imgsrc.replace(/:\/\/s([0-9]+.*_[0-9]+)...(\.[^/.]*)(?:[?#].*)?$/, "://b$1" + chars + "$2");

					var obj = {
						extra: {
							page: resp.finalUrl,
							caption: caption
						}
					};

					var urls = [];

					if (newsrc) urls.push(newsrc);
					urls.push(imgsrc);

					console_log(urls);

					done(fillobj_urls(urls, obj), 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nosub === "icdn.ru") {
			// https://s8.us.icdn.ru/m/mocojopo/4/imgsrc.ru_65724094lHp.jpg
			//   https://b8.us.icdn.ru/m/mocojopo/4/imgsrc.ru_65724094lGa.jpg
			// https://s8.us.icdn.ru/m/mocojopo/6/65724076VkL.jpg
			//   https://b8.us.icdn.ru/m/mocojopo/6/imgsrc.ru_65724076XjG.jpg
			regex = /:\/\/s[0-9]+\.[^/]+\/+.\/+([^/]+)\/+[0-9]+\/+(?:imgsrc\.ru_)?([0-9]+)...(\.[^/.]*)(?:[?#].*)?$/;

			match = src.match(regex);
			if (match) {
				obj = {
					url: src,
					extra: {
						page: "https://imgsrc.ru/" + match[1] + "/" + match[2] + ".html"
					}
				};

				return [
					{
						url: obj.extra.page,
						is_pagelink: true
					},
					obj
				];
			}
		}

		if (domain === "rs.fairywigs.com") {
			// http://rs.fairywigs.com/images/pinfo/0/154/154173_1_s.jpg
			//   http://rs.fairywigs.com/images/pinfo/0/154/154173_1.jpg
			return src.replace(/(\/images\/.*\/[0-9]+\/+[0-9]+_[0-9]+)_s(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nosub === "epio.app" && /^cdn[0-9]*-images\./.test(domain)) {
			// https://cdn1-images.epio.app/image/download/aHR0cHM6Ly93d3cubXlteXBpYy5uZXQvZGF0YS9hdHRhY2htZW50L2ZvcnVtLzIwMTkxMC8yOC8yMjMxNTlrZzR4Y2NmZjZ4Z3puaXN4LmpwZy50aHVtYi5qcGc=/350X500
			//   https://www.mymypic.net/data/attachment/forum/201910/28/223159kg4xccff6xgznisx.jpg
			newsrc = src.replace(/.*?\/image\/+download\/+([^./]{40,})(?:\/+[0-9]+X[0-9]+)?(?:[?#].*)?$/, "$1");
			if (newsrc !== src)
				return base64_decode(newsrc);
		}

		if (domain === "giga-images-makeshop-jp.akamaized.net") {
			// https://giga-images-makeshop-jp.akamaized.net/crownk2009/shopimages/08/03/s1_000000000308.jpg?1572604703
			//   https://giga-images-makeshop-jp.akamaized.net/crownk2009/shopimages/08/03/1_000000000308.jpg?1572604703
			return src.replace(/(\/shopimages\/+[0-9]+\/+[0-9]+\/+)s([0-9]+_[0-9]+\.[^/.]*)(?:[?#].&)?$/, "$1$2");
		}

		if (domain === "cdn-uploads.gameblog.fr") {
			// http://cdn-uploads.gameblog.fr/images/jeux/tn/26683/RedDeadRedemptionII_PC_Editeur_025.jpg
			//   http://cdn-uploads.gameblog.fr/images/jeux/26683/RedDeadRedemptionII_PC_Editeur_025.jpg
			return src.replace(/(\/images\/+[^/]+\/+)tn\/+/, "$1");
		}

		if (domain_nowww === "guru3d.com") {
			// https://www.guru3d.com/index.php?ct=news&action=thumb&id=33953
			//   https://www.guru3d.com/index.php?ct=news&action=file&id=33953
			return src.replace(/(\/index\.php\?(?:.*?&)?action=)thumb(&.*)?$/, "$1file$2");
		}

		if (domain === "medialazy.vandalimg.com") {
			// https://medialazy.vandalimg.com/i/80x80/11-2019/201911112591165_1.jpg
			//   https://media.vandal.net/master/11-2019/201911112591165_1.jpg
			return src.replace(/:\/\/[^/]+\/+/, "://media.vandal.net/");
		}

		if (domain === "mediamaster.vandal.net" ||
			// https://media.vandalsports.com/m/7-2017/201776141624_1.jpg
			//   https://media.vandalsports.com/master/7-2017/201776141624_1.jpg
			domain === "media.vandalsports.com" ||
			// https://media.vandal.net/m/11-2019/201911112591165_17.jpg
			//   https://media.vandal.net/m/11-2019/201911112591165_17.jpg
			domain === "media.vandal.net") {
			// https://mediamaster.vandal.net/m/11-2019/201911112591165_1.jpg
			//   https://mediamaster.vandal.net/master/11-2019/201911112591165_1.jpg
			// https://media.vandal.net/i/600x300/11-2016/2016119162645_1.jpg
			//   https://media.vandal.net/i/99999999999x99999999999/11-2016/2016119162645_1.jpg
			//   https://media.vandal.net/master/11-2016/2016119162645_1.jpg
			return src.replace(/(:\/\/[^/]+\/+)(?:m|i\/+[0-9]+x[0-9]+)\/+/, "$1master/");
			//return src.replace(/\/i\/[0-9]+x[0-9]+\//, "/i/99999999999x99999999999/");
		}

		if (domain_nosub === "cgames.de" && /^[0-9]*images\./.test(domain)) {
			// https://10images.cgames.de/images/gamestar/204/highlightbild-der-erste-pc-trailer-von-red-dead-redemption-2-verspricht-fantastische-grafik_6081579.jpg
			//   https://10images.cgames.de/images/gamestar/4/highlightbild-der-erste-pc-trailer-von-red-dead-redemption-2-verspricht-fantastische-grafik_6081579.jpg
			// https://7images.cgames.de/images/gamestar/4/conan-exiles_6028086.jpg -- 6160x3530
			return src.replace(/(\/images\/+gamestar\/+)[0-9]+\/+/, "$14/");
		}

		if (domain === "assets.folhavitoria.com.br") {
			// https://assets.folhavitoria.com.br/images/16bb8340-9db3-0136-e3df-6231c35b6685--w116_h116_lx199_rx1127_ty0_by928.jpg
			//   https://assets.folhavitoria.com.br/images/16bb8340-9db3-0136-e3df-6231c35b6685.jpg
			// https://assets.folhavitoria.com.br/images/7f2969c0-7a59-0137-32e0-6231c35b6685--minified.jpg
			//   https://assets.folhavitoria.com.br/images/7f2969c0-7a59-0137-32e0-6231c35b6685.jpg
			return src.replace(/(\/images\/+[-0-9a-f]{30,})--(?:(?:[a-z][^-_/.]+_)*[a-z][^-_/.]+)(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "dnh0aphdpud22.cloudfront.net" ||
			// thanks to anonymous for reporting:
			// https://d320y51nxi12gs.cloudfront.net/sized/92f40b35d1f191-LIB5359683/med_thumbnail.jpg?1581640899
			//   https://d320y51nxi12gs.cloudfront.net/sized/92f40b35d1f191-LIB5359683/high_res.jpg?1581640899
			domain === "d320y51nxi12gs.cloudfront.net") {
			// https://dnh0aphdpud22.cloudfront.net/sized/be595e6188d754-LIB3195598/med_thumbnail.jpg?1567686958
			//   https://dnh0aphdpud22.cloudfront.net/sized/be595e6188d754-LIB3195598/high_res.jpg?1567686958 -- 960x960
			// other:
			// https://dnh0aphdpud22.cloudfront.net/originals/b711d45538272a-LE73560622.jpg -- 5061x3374
			// https://dnh0aphdpud22.cloudfront.net/originals/a1af8cc20d8c20-DA65783152.JPG -- 6000x3376
			// https://dnh0aphdpud22.cloudfront.net/originals/09079e2dff9c9d222c86acb6.jpg -- 640x360
			// https://dnh0aphdpud22.cloudfront.net/originals/168221d982c062-IO22183510.jpg -- 640x640
			// https://dnh0aphdpud22.cloudfront.net/linkinbio/22763c4ebf5d2e-LIB3290250.jpg -- 640x640
			// https://dnh0aphdpud22.cloudfront.net/instagram/9390396580af414265915e01.jpg?1504623771 -- 2160x2160
			// theory: linkinbio = high_res, LIB prefix is used for linkinbio and sized, but not for originals (originals is two [A-Z])
			return src.replace(/(\/sized\/+[0-9a-f]+-[A-Z]+[0-9]+\/+)med_thumbnail(\.[^/.]*)(?:[?#].*)?$/, "$1high_res$2");
		}

		if (domain_nowww === "iansphoto.in") {
			// http://iansphoto.in/web/photoimages_new/400/2018/08/03/06aa3e3ed3d7cfef662cb05eb6759132.jpg -- upscaled
			//   http://iansphoto.in/web/photoimages_new/2018/08/03/06aa3e3ed3d7cfef662cb05eb6759132.jpg
			// other:
			// http://iansphoto.in/web/photoimages_new/2014/08/05/0bb2c0fc573308847fd919a0ab7ddf53.jpg -- 2400x1759
			return src.replace(/(\/photoimages_new\/+)[0-9]+\/+([0-9]{4}\/+[0-9]{2}\/+[0-9]{2}\/+)/, "$1$2");
		}

		if (domain_nowww === "mamby.com") {
			// https://mamby.com/images/person-woman-clothing-22383_mediumres.jpg
			//   https://mamby.com/images/person-woman-clothing-22383_maxres.jpg
			return src.replace(/(\/images\/+[^/]*)_mediumres(\.[^/.]*)(?:[?#].*)?$/, "$1_maxres$2");
		}

		if (domain_nowww === "pixelup.net") {
			// http://pixelup.net/images/2011/03/04/d9091f563f5b19740068ca2fc91b687a/p.jpg
			//   http://pixelup.net/images/2011/03/04/d9091f563f5b19740068ca2fc91b687a/r.jpg
			return src.replace(/(\/images\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9a-f]{20,}\/+)p(\.[^/.]*)(?:[?#].*)?$/, "$1r$2");
		}

		if (domain_nowww === "tattoodaze.com") {
			// http://www.tattoodaze.com/images/373/th_rihanna-pictures-2014-pre-grammy-brunch-roc-nation-04-gotceleb-buuYif.jpg
			//   http://www.tattoodaze.com/tattoo-images/373/th_rihanna-pictures-2014-pre-grammy-brunch-roc-nation-04-gotceleb-buuYif.jpg
			return src.replace(/(:\/\/[^/]+\/+)images\/+/, "$1tattoo-images/");
		}

		if (domain_nowww === "ximg.pro") {
			// https://ximg.pro/?url=aHR0cHM6Ly93YWxscGFwZXJjYXZlLmNvbS93cC93cDIzNDIzNDYuanBn
			//   https://wallpapercave.com/wp/wp2342346.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+\?(?:.*&)?url=([^&/]{20,}).*?$/, "$1");
			if (newsrc !== src)
				return base64_decode(newsrc);
		}

		if (domain_nowww === "wallpapercave.com") {
			// https://wallpapercave.com/fwp/wp6977255.jpg
			//   https://wallpapercave.com/wp/wp6977255.jpg
			// https://wallpapercave.com/wpt/wp5213175.jpg
			//   https://wallpapercave.com/wp/wp5213175.jpg
			obj = {
				extra: {}
			};

			match = src.match(/\/wp([0-9]+)(?:\.[^/.]+)?(?:[?#].*)?$/);
			if (match)
				obj.extra.page = "https://wallpapercave.com/w/wp" + match[1];

			if (/:\/\/[^/]+\/+w\/+wp[0-9]+(?:[?#].*)?$/.test(src)) {
				page_nullobj = {
					url: src,
					is_pagelink: true
				};

				var urls = add_extensions(src.replace(/\/w\/+(wp[0-9]+)(?:[?#].*)?$/, "/wp/$1.jpg"));
				urls.push(page_nullobj);

				return fillobj_urls(urls, obj);
			}

			newsrc = src.replace(/\/(?:fwp|wpt)\/+(wp[0-9]+\.)/, "/wp/$1");
			obj.url = newsrc;

			return obj;
		}

		if (domain === "cdnimage.ebn.co.kr" ||
			// http://file.ebn.co.kr/news/201911/news_1573112213_1008380_thumbs.jpg
			//   http://file.ebn.co.kr/news/201911/news_1573112213_1008380_main1.jpg
			domain === "file.ebn.co.kr") {
			// http://cdnimage.ebn.co.kr/news/201911/news_1573112213_1008380_thumbs.jpg
			//   http://cdnimage.ebn.co.kr/news/201911/news_1573112213_1008380_main1.jpg
			// other:
			// http://www.ebn.co.kr/news/view/841565?kind=writer&key=284&shword=&page=&period=
			//   http://cdnimage.ebn.co.kr/news/201607/news_1468919238_841565_main1.jpg -- 3888x2592
			// https://www.ebn.co.kr/news/view/640367
			//   http://cdnimage.ebn.co.kr/news/201311/04_640367_1.jpg -- 4446x2502
			// doesn't work for all:
			// http://cdnimage.ebn.co.kr/news/201911/news_1572851811_1007745_thumbs.jpg
			//   http://cdnimage.ebn.co.kr/news/201911/news_1572850797_1007745_main1.jpg
			newsrc = src.replace(/(\/news\/+[0-9]{6}\/+news_[0-9]+_[0-9]+)_thumbs(\.[^/.]*)(?:[?#].*)?$/, "$1_main1$2");
			if (newsrc !== src)
				return newsrc;

			match = src.match(/\/news\/+[0-9]{6}\/+(?:news_[0-9]+|[0-9]{1,3})_([0-9]+)_/);
			if (match) {
				return {
					url: src,
					extra: {
						page: "https://www.ebn.co.kr/news/view/" + match[1]
					}
				};
			}
		}

		if (domain === "img.kbs.co.kr") {
			// https://img.kbs.co.kr/kbs/160/nsimg.kbs.co.kr/data/news/2017/04/25/3470061_ul7.jpg
			//   http://nsimg.kbs.co.kr/data/news/2017/04/25/3470061_ul7.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+kbs\/+[0-9]+\/+([^/]+\.[^/]+\/+)/, "$1");
			if (newsrc !== src)
				return add_http(newsrc);
		}

		if (domain_nowww === "kpop-today.com") {
			// https://www.kpop-today.com/img-small/medias/images/2016-03/15614.jpg
			//   https://www.kpop-today.com/img-large/medias/images/2016-03/15614.jpg -- upscaled
			//   https://www.kpop-today.com/medias/images/2016-03/15614.jpg
			return src.replace(/\/img-(?:small|large)\/+medias\/+/, "/medias/");
		}

		if (domain_nowww === "popnable.com") {
			// https://popnable.com/images/singers/small/kenshi_yonezu_japan_top_40_114.jpg
			//   https://popnable.com/images/singers/large/kenshi_yonezu_japan_top_40_114.jpg
			// https://popnable.com/images/songs/small/japan_top_50_spirits_of_the_sea_kenshi_yonezu_1561781279.jpg
			//   https://popnable.com/images/songs/original/japan_top_50_spirits_of_the_sea_kenshi_yonezu_1561781279.jpg
			newsrc = src.replace(/(\/images\/+[a-z]+\/+)small\/+/, "$1large/");
			if (newsrc !== src)
				return newsrc;

			return src.replace(/(\/images\/+[a-z]+\/+)(?:small|large)\/+/, "$1original/");
		}

		if (domain === "media.distractify.com") {
			// https://media.distractify.com/brand-img/HW7h6r69g/480x252/bebe-rexha-the-voice-1551206853311-1551206855317.jpg
			//   https://media.distractify.com/brand-img/HW7h6r69g/0x0/bebe-rexha-the-voice-1551206853311-1551206855317.jpg
			return {
				url: src.replace(/(\/brand-img\/+[^/]+\/+)[0-9]+x[0-9]+\/+/, "$10x0/"),
				can_head: false // 403
			};
		}

		if (domain_nosub === "unblocked-sites.pro" ||
			// https://fr.unblockweb.cc/?cdURL=https%3A%2F%2Fwww.elamigos-games.com%2Fstorage%2Fgames_tumbl%2Fthe-sojourn-cover-y6u.jpg
			//   https://www.elamigos-games.com/storage/games_tumbl/the-sojourn-cover-y6u.jpg
			domain_nosub === "unblockweb.cc" ||
			// https://fr.unblock-sites.info/?cdURL=http%3A%2F%2Fimg.kikurls.info%2Ffilms%2Fimages%2F2019%2Fstrange-but-true-2019-13428-thumbnail.jpg
			//   http://img.kikurls.info/films/images/2019/strange-but-true-2019-13428-thumbnail.jpg
			domain_nosub === "unblock-sites.info" ||
			// https://us.unblock.men/?cdURL=http%3A%2F%2Ftamilrockerrs.co%2Fuploads%2Fmonthly_05_2018%2Fpost-317411-0-06215200-1527176981.jpg
			//   http://tamilrockerrs.co/uploads/monthly_05_2018/post-317411-0-06215200-1527176981.jpg
			domain_nosub === "unblock.men" ||
			// https://lu.unblock.loan/?cdURL=http%3A%2F%2Fp30download.com%2Fagahi%2Ffiles%2Fa7b62e69754a667ddd4bdb0c9d051f7ed4f8faa7.jpg
			//   http://p30download.com/agahi/files/a7b62e69754a667ddd4bdb0c9d051f7ed4f8faa7.jpg
			domain_nosub === "unblock.loan" ||
			// https://gb.unblock.science/?cdURL=https%3A%2F%2Fww3.cineiz.io%2Fposter%2Ffilm%2Fstar-wars-les-derniers-jedi-4236.jpg
			//   https://ww3.cineiz.io/poster/film/star-wars-les-derniers-jedi-4236.jpg
			domain_nosub === "unblock.science" ||
			// https://gb.unblock-sites.xyz/?cdURL=http%3A%2F%2Fgaleri14.uludagsozluk.com%2F844%2Fsurvivor-2019_1750794_m.jpg
			//   http://galeri14.uludagsozluk.com/844/survivor-2019_1750794.jpg
			domain_nosub === "unblock-sites.xyz" ||
			// https://ro.unblock-proxy.xyz/?cdURL=https%3A%2F%2Fsound-park.club%2Ftorrents%2Fimages%2F246430.jpg
			//   https://sound-park.club/torrents/images/246430.jpg
			domain_nosub === "unblock-proxy.xyz" ||
			// https://fr.unblock.cricket/?cdURL=https%3A%2F%2Fflenix.tv%2Fuploads%2Fposts%2F2018-05%2F1527692476_34bdf3c5cea73d60112f22a237efb765.jpg
			//   https://flenix.tv/uploads/posts/2018-05/1527692476_34bdf3c5cea73d60112f22a237efb765.jpg
			domain_nosub === "unblock.cricket" ||
			// https://us.unblock.racing/?cdURL=https%3A%2F%2Fmedia-cdn.tripadvisor.com%2Fmedia%2Fphoto-o%2F0e%2Fcd%2F51%2Fc6%2Fethiopian-airlines.jpg
			//   https://media-cdn.tripadvisor.com/media/photo-o/0e/cd/51/c6/ethiopian-airlines.jpg
			domain_nosub === "unblock.racing" ||
			// https://fr.unblocked.nl/?cdURL=https%3A%2F%2Fcdn.junglecreations.com%2Fwp%2Fjunglecms%2F2019%2F08%2Ff9913daf-befunky-collage-2019-08-13t144831.527.jpg
			//   https://cdn.junglecreations.com/wp/junglecms/2019/08/f9913daf-befunky-collage-2019-08-13t144831.527.jpg
			domain_nosub === "unblocked.nl") {
			// https://fr.unblocked-sites.pro/?cdURL=https%3A%2F%2Fcdn.junglecreations.com%2Fwp%2Fjunglecms%2F2019%2F08%2Ff9913daf-befunky-collage-2019-08-13t144831.527.jpg
			//   https://cdn.junglecreations.com/wp/junglecms/2019/08/f9913daf-befunky-collage-2019-08-13t144831.527.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+\?(?:.*?&)?cdURL=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "cdn.btportail.0pb.org") {
			// http://cdn.btportail.0pb.org/d263e11db9ed620c8311d062680d31a5/127/480/200/1195892.jpg
			//   http://cdn.btportail.0pb.org/d263e11db9ed620c8311d062680d31a5/127/0/0/1195892.jpg
			return {
				url: src.replace(/(\/[0-9a-f]{20,}\/+[0-9]+\/+)[0-9]+\/+[0-9]+\/+([^/]+\.[^/.]*)(?:[?#].*)?$/, "$10/0/$2"),
				head_wrong_contentlength: true
			};
		}

		if (domain_nowww === "cosmopolitan.hr" ||
			// https://www.sensa.hr/repository/images/_variations/7/d/7d2aa47d48ab8922ab84bac818823c29_3784443798958e52d89f2b6f273222489f92d521_wall-1920x1200.jpg
			//   https://www.sensa.hr/repository/images/7/d/7d2aa47d48ab8922ab84bac818823c29.jpg
			domain_nowww === "sensa.hr" ||
			// https://www.lovesensa.rs/repository/images/_variations/d/2/d271e901388a4dfade2988e4407293e2_72598aeccbccdc92dae1cda34d0d66dffcf66ea6_wall-1920x1200.jpg
			//   https://www.lovesensa.rs/repository/images/d/2/d271e901388a4dfade2988e4407293e2.jpg
			domain_nowww === "lovesensa.rs" ||
			// https://www.naturacroatica.com/repository/images/_variations/d/f/dfc81195c279aa07ca9991538e1f61bc-rakija-travarica-aura-07l_content_zoom.jpg?v=6
			//   https://www.naturacroatica.com/repository/images/d/f/dfc81195c279aa07ca9991538e1f61bc-rakija-travarica-aura-07l.jpg?v=6
			/^[a-z]+:\/\/[^/]+\/+repository\/+images\/+_variations\/+[0-9a-f]\/+[0-9a-f]+\/+[0-9a-f]{20,}(?:-[^/]*?)?_[^/]+(\.[^/.]*)(?:[?#].*)?$/.test(src)) {
			// http://www.cosmopolitan.hr/repository/images/_variations/4/8/48f1f0ad29a4c9f1b35c2f36394dd4d080805623_articlemain.jpg
			//   http://www.cosmopolitan.hr/repository/images/4/8/48f1f0ad29a4c9f1b35c2f36394dd4d080805623.jpg
			// http://www.cosmopolitan.hr/repository/images/_variations/c/b/cb78429c71725693a473fa01fcd4c875_wall-1600x1200.jpg
			//   http://www.cosmopolitan.hr/repository/images/c/b/cb78429c71725693a473fa01fcd4c875.jpg
			return src.replace(/(\/repository\/+images\/+)_variations\/+([0-9a-f]\/+[0-9a-f]\/+[0-9a-f]{20,}(?:-[^/]*?)?)_[^/]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2$3");
		}

		if (amazon_container === "blogadda") {
			// https://blogadda.s3.amazonaws.com/images/posts/lily-allen-cancels-us-tour-1541138717-medium.jpg
			//   https://blogadda.s3.amazonaws.com/images/posts/lily-allen-cancels-us-tour-1541138717-large.jpg
			return src.replace(/(\/images\/+posts\/+[^/]+-[0-9]+)-medium(\.[^/.]*)(?:[?#].*)?$/, "$1-large$2");
		}

		if (domain_nosub === "muzmob.org" ||
			// https://en.muzmo.org/news/read.php?id=24332
			// https://en.muzmo.org/news/i/24332_150.jpg
			//   https://en.muzmo.org/news/i/24332.jpg
			// other:
			// https://en.muzmo.org/collection?id=10109
			// https://en.muzmo.org/collection_images/10109/s50.jpg
			//   https://en.muzmo.org/collection_images/10109/176x.jpg
			domain_nosub === "muzmo.org") {
			// https://ru.muzmob.org/news/i/21293_300.jpg
			//   https://ru.muzmob.org/news/i/21293.jpg
			return src.replace(/(\/news\/+i\/+[0-9]+)_[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "static.zone-adulte.com") {
			// https://static.zone-adulte.com/img/3118/320x180/22.jpg
			//   https://static.zone-adulte.com/img/3118/22.jpg
			return src.replace(/(\/img\/+[0-9]+\/+)[0-9]+x[0-9]+\/+/, "$1");
		}

		if (domain_nosub === "ujarani.com" && /^i[0-9]*\./.test(domain)) {
			// https://i1.ujarani.com/4/2/2a32JE.jpg
			//   https://i1.ujarani.com/3/2/2a32JE.jpg
			return src.replace(/(:\/\/[^/]+\/+)4\//, "$13/");
		}

		if (domain === "media.loupak.fun") {
			// https://media.loupak.fun/soubory/obrazky_t/_funny/2585/11415.jpg
			//   https://media.loupak.fun/soubory/obrazky_n/_funny/2585/11415.jpg
			//   https://media.loupak.fun/soubory/obrazky/_funny/2585/11415.jpg
			return src.replace(/\/obrazky_[tn]\//, "/obrazky/");
		}

		if (domain_nowww === "megalyrics.ru") {
			// http://www.megalyrics.ru/uploads/blog/cover/a0/4f3196a0c58c20fd560014dd/cs_crop_main_bbcb8f60ddbc15285b3dd11ac98ebc00.jpg
			//   http://www.megalyrics.ru/uploads/blog/cover/a0/4f3196a0c58c20fd560014dd/bbcb8f60ddbc15285b3dd11ac98ebc00.jpg
			return src.replace(/(\/uploads\/+blog\/+cover\/+[0-9a-f]{2}\/+[0-9a-f]{10,}\/+)cs_crop_main_([0-9a-f]{20,}\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (false && domain_nowww === "skachat-kartinki.ru") {
			// http://skachat-kartinki.ru/img/picture/Apr/15/3a3f9663a9428d8406c16a4c926f7742/mini_2.jpg
			//   http://skachat-kartinki.ru/img/picture/Apr/15/3a3f9663a9428d8406c16a4c926f7742/2.jpg -- cropped
			return src.replace(/(\/img\/+picture\/+[A-Za-z]+\/+[0-9]+\/+[0-9a-f]{20,}\/+)mini_([0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "uploads.bemparana.com.br") {
			// https://uploads.bemparana.com.br/upload/image/noticia/tb1/noticia_159235_img1_luladiscurso.jpg
			//   https://uploads.bemparana.com.br/upload/image/noticia/noticia_159235_img1_luladiscurso.jpg
			return src.replace(/(\/upload\/+image\/+noticia\/+)tb[0-9]*\/+/, "$1");
		}

		if (domain_nowww === "beicon.ru") {
			// https://www.beicon.ru/uploads/215268a418f8f2077936de06329b307f30ab_16_9_1040.jpg
			//   https://www.beicon.ru/uploads/215268a418f8f2077936de06329b307f30ab.jpg
			// https://www.beicon.ru/uploads/1570709393_1_1_352_exact.jpg
			//   https://www.beicon.ru/uploads/1570709393.jpg
			return src.replace(/(\/uploads\/+(?:[0-9a-f]{20,}|[0-9]{10,}))_(?:16_9_[0-9]+|[0-9]+_[0-9]+_[0-9]+_exact)(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "bigmenu.com.br") {
			// https://www.bigmenu.com.br/img/250x160/4/0/jpg/arquivos/34/conteudo/posts/789061.jpg
			//   https://www.bigmenu.com.br/arquivos/34/conteudo/posts/789061.jpg
			// https://www.bigmenu.com.br/temp/img/arquivos_34_conteudo_posts_789061_jpg_250_160_4_0__jpg.jpg
			//   https://www.bigmenu.com.br/arquivos/34/conteudo/posts/789061.jpg
			newsrc = src.replace(/\/temp\/+img\/+(arquivos)_([0-9]+)_(conteudo)_(posts)_([0-9]+)_([a-z]+)_[0-9]+_[0-9]+_[0-9]+_[0-9]+__[a-z]+\.[^/.]*(?:[?#].*)?$/, "/$1/$2/$3/$4/$5.$6");
			if (newsrc !== src)
				return newsrc;

			return src.replace(/\/img\/+[0-9]+x[0-9]+\/+[0-90]+\/+[0-9]+\/+[a-z]+\/+arquivos\/+/, "/arquivos/");
		}

		if (domain_nowww === "pixaap.com") {
			// https://www.pixaap.com/images/items_thumb/M-PIXAAP[DOT]COM-1524658277.jpg
			//   https://www.pixaap.com/images/items/PIXAAP[DOT]COM-1524658277.jpg
			return src.replace(/\/images\/+items_thumb\/+M-/, "/images/items/");
		}

		if (amazon_container === "theshonet-assets") {
			// https://theshonet-assets.s3.ap-southeast-1.amazonaws.com/filemanager/shared_480/d3d94468_rihanna-2018-4k-de.jpg
			//   https://theshonet-assets.s3.ap-southeast-1.amazonaws.com/filemanager/shared/d3d94468_rihanna-2018-4k-de.jpg
			return src.replace(/\/filemanager\/+shared_[0-9]+\/+/, "/filemanager/shared/");
		}

		if (domain === "media.lelombrik.net") {
			// https://media.lelombrik.net/t/9fd6df051ce13dde28f7e4019130c4a3/s/01.jpg
			//   https://media.lelombrik.net/t/9fd6df051ce13dde28f7e4019130c4a3/f/9fd6df051ce13dde28f7e4019130c4a3.jpg
			return src.replace(/\/t\/+([0-9a-f]{20,})\/+s\/+01(\.[^/.]*)(?:[?#].*)?$/, "/t/$1/f/$1$2");
		}

		if (domain_nowww === "funnymasti.com") {
			// https://www.funnymasti.com/files/resized/mid/files/preview/files/558/100%20Beautiful%20Girls%20-whatsappmasti.com%20(1).jpg.jpg
			//   https://www.funnymasti.com/files/preview/files/558/100%20Beautiful%20Girls%20-whatsappmasti.com%20(1).jpg.jpg
			return src.replace(/\/files\/+resized\/+[^/]+\/+files\/+/, "/files/");
		}

		if (domain === "proxy.zagon.pe") {
			// https://proxy.zagon.pe/proxify.php?q=aHR0cHM6Ly9wYnMudHdpbWcuY29tL3Byb2ZpbGVfaW1hZ2VzLzExNDU4MTI3MDk5NjA2NjcxMzYvWUY0Vm9QM2VfYmlnZ2VyLmpwZw
			//   https://pbs.twimg.com/profile_images/1145812709960667136/YF4VoP3e.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+proxify\.php\?(?:.*?&)?q=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return base64_decode(newsrc);
		}

		if (domain_nowww === "wikizeroo.org") {
			// https://www.wikizeroo.org/index.php?q=aHR0cHM6Ly91cGxvYWQud2lraW1lZGlhLm9yZy93aWtpcGVkaWEvY29tbW9ucy90aHVtYi84LzhjL0NyaXN0aWFub19Sb25hbGRvXzIwMTguanBnLzIyMHB4LUNyaXN0aWFub19Sb25hbGRvXzIwMTguanBn
			//   https://upload.wikimedia.org/wikipedia/commons/8/8c/Cristiano_Ronaldo_2018.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+index\.php\?(?:.*&)?q=([^&]{20,}).*?$/, "$1");
			if (newsrc !== src)
				return base64_decode(newsrc);
		}

		if (domain === "cachedimages.podchaser.com") {
			// https://cachedimages.podchaser.com/300x300/aHR0cHM6Ly9jcmVhdG9yLWltYWdlcy5wb2RjaGFzZXIuY29tLzI3ZTJhZmY0YjMyNjBhNDc2YmRkOTE3ODUzMDE3MjVlLmpwZWc%3D/aHR0cHM6Ly93d3cucG9kY2hhc2VyLmNvbS9pbWFnZXMvbWlzc2luZy1pbWFnZS5wbmc%3D
			//   https://creator-images.podchaser.com/27e2aff4b3260a476bdd91785301725e.jpeg
			match = src.match(/:\/\/[^/]+\/+[0-9]+x[0-9]+\/+([^/.]{30,})\/+/);
			if (match) {
				return base64_decode(decodeURIComponent(match[1]));
			}
		}

		if (domain === "ca.slack-edge.com") {
			// thanks to TheLastZombie on Github: https://github.com/qsniyg/maxurl/pull/162
			// https://ca.slack-edge.com/T81EQ2QNM-UDEDDF8AV-c0aac75e8652-72
			//   https://ca.slack-edge.com/T81EQ2QNM-UDEDDF8AV-c0aac75e8652-1024
			//   https://ca.slack-edge.com/T81EQ2QNM-UDEDDF8AV-c0aac75e8652-999999999999999
			return src.replace(/^([a-z]+:\/\/[^/]+\/+[^/]+-[0-9a-f]{8,})-\d+(?:[?#].*)?$/, "$1-999999999999999");
		}

		if (domain === "files.slack.com") {
			return src.replace(/\/files-tmb\/+([A-Z0-9]+-[A-Z0-9]+)-[0-9a-f]+\/+([^/]+)_[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "/files-pri/$1/$2$3");
		}

		if (domain_nowww === "chathour.com" ||
			// http://www.chathourmobile.com/photos/thumb/3907646_12_897e3a799f.jpg
			//   http://www.chathourmobile.com/photos/full/3907646_12_897e3a799f.jpg
			domain_nowww === "chathourmobile.com") {
			// http://www.chathour.com/photos/thumb/3907646_12_897e3a799f.jpg
			//   http://www.chathour.com/photos/full/3907646_12_897e3a799f.jpg
			return src.replace(/\/photos\/+thumb\//, "/photos/full/");
		}

		if (domain === "nimage.globaleconomic.co.kr") {
			// http://nimage.globaleconomic.co.kr/imagesphp/5/201504241142347589779_20150424114714_01.jpg
			//   http://nimage.globaleconomic.co.kr/phpwas/restmb_allidxmake.php?idx=999&simg=201504241142347589779_20150424114714_01.jpg
			newsrc = src.replace(/\/imagesphp\/+[0-9]+\/+([^/]+\.[^/.]*?)(?:[?#].*)?$/, "/phpwas/restmb_allidxmake.php?idx=999&simg=$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "photoresources.wtatennis.com") {
			// thanks to Lerortle on greasyfork: https://greasyfork.org/en/forum/discussion/66137/could-you-add-support-for-website
			// https://photoresources.wtatennis.com/photo-resources/2019/10/09/3e76c099-1d40-4084-a0d0-e97a7db2b969/PskuzqVH.jpg?width=1176&height=662
			//   https://photoresources.wtatennis.com/wta/photo/2019/10/09/3e76c099-1d40-4084-a0d0-e97a7db2b969/PskuzqVH.jpg
			// doesn't work for all:
			// https://www.wtatennis.com/news/1494869/-she-has-a-platform-to-inspire-us-all-billie-jean-king-hails-special-gauff
			//   https://photoresources.wtatennis.com/photo-resources/2019/10/10/2ad17fec-fad3-4553-ab51-c4b3bece5d0f/VTnZrljU.jpg?width=752&height=574
			//   https://photoresources.wtatennis.com/wta/photo/2019/10/10/2ad17fec-fad3-4553-ab51-c4b3bece5d0f/VTnZrljU.jpg -- 403
			// https://www.wtatennis.com/photos/1830671/in-pictures-the-story-of-rome-2020
			// https://photoresources.wtatennis.com/photo-resources/2020/09/14/a5c66c07-6bd3-4b30-b46d-0d0820471319/Daria_Kasatkina_-_2020_Internazionali_BNL_d_Italia_Qualifcations_Day_1_-DSC_1545_original.jpg?width=1176&height=662
			//   https://photoresources.wtatennis.com/wta/photo/2020/09/14/a5c66c07-6bd3-4b30-b46d-0d0820471319/Daria_Kasatkina_-_2020_Internazionali_BNL_d_Italia_Qualifcations_Day_1_-DSC_1545_original.jpg -- 403
			// but others in that time period work:
			// https://www.wtatennis.com/news/1495218/-the-more-you-have-the-less-predictable-you-are-fissette-explains-power-of-sap-patterns-of-play
			//   https://photoresources.wtatennis.com/wta/photo/2019/11/14/302c5af8-ed0f-44c3-8de2-e9e4cb98c383/DSC_4364_original.jpg
			// https://www.wtatennis.com/news/1494817/muguruza-summits-mount-kilimanjaro-the-highest-peak-in-africa-we-felt-alive-
			//   https://photoresources.wtatennis.com/wta/photo/2019/11/14/cd882318-8e58-4491-a8fa-e17b7f3c8927/klsdfajsdf.jpeg
			return src.replace(/\/photo-resources\/+([0-9]{4}\/+[0-9]{2}\/+[0-9]{2}\/+[-0-9a-f]{20,}\/+[^/]+\.[^/.?]*)(?:[?#].*)?$/, "/wta/photo/$1");
		}

		if (domain_nowww === "brdteengal.com") {
			// http://www.brdteengal.com/galleries/thumbs/5/d/c/d/2/5dcd2ac50f2bf/200x300/pooled-featuring-stasey-by-arkisi-3.jpg
			//   http://www.brdteengal.com/galleries/5/d/c/d/2/5dcd2ac50f2bf/pooled-featuring-stasey-by-arkisi-3.jpg
			return src.replace(/\/galleries\/+thumbs\/+((?:[0-9a-f]\/+){5}[0-9a-f]{10,}\/+)[0-9]+x[0-9]+\/+/, "/galleries/$1");
		}

		if (domain_nowww === "destacamos.com") {
			// http://www.destacamos.com/images/listings/2019-01/bigThmb/escort-en-ciudad-real-naomi-brasilena-en-valdepenas-1548072589-974-d_pic.jpg
			//   http://www.destacamos.com/images/listings/2019-01/escort-en-ciudad-real-naomi-brasilena-en-valdepenas-1548072589-974-d_pic.jpg
			return src.replace(/(\/images\/+listings\/+[0-9]{4}-[0-9]{2}\/+)(?:bigThmb|thmb)\/+/, "$1");
		}

		if (domain === "statici.behindthevoiceactors.com" ||
			// https://www.behindthevoiceactors.com/_img/actors/thumbs/selena-gomez-18.7_thumb.jpg
			//   https://www.behindthevoiceactors.com/_img/actors/selena-gomez-18.7.jpg
			domain_nowww === "behindthevoiceactors.com") {
			// http://statici.behindthevoiceactors.com/behindthevoiceactors/_img/movies/thumbs/movie_2452_thumb.jpg
			//   http://statici.behindthevoiceactors.com/behindthevoiceactors/_img/movies/movie_2452.jpg
			// https://statici.behindthevoiceactors.com/behindthevoiceactors/_img/chars/thumbs/ella-the-angry-birds-movie-2-4.65_thumb.jpg
			//   https://statici.behindthevoiceactors.com/behindthevoiceactors/_img/chars/ella-the-angry-birds-movie-2-4.65.jpg
			return {
				url: src.replace(/(\/_img\/+[^/]+\/+)thumbs\/+([^/]+)_thumb(\.[^/.]*)(?:[?#].*)?$/, "$1$2$3"),
				headers: {
					Referer: "https://www.behindthevoiceactors.com/"
				}
			};
		}

		if (domain_nowww === "schokkendnieuws.nl") {
			// https://www.schokkendnieuws.nl/images/multithumb_thumbs/b_100_0_16777215_00_images_stories_com_form2content_p1_f4764_regression_43008800_ps_1_s-low.jpg
			//   https://www.schokkendnieuws.nl/images/stories/com_form2content/p1/f4764/regression_43008800_ps_1_s-low.jpg
			// https://www.schokkendnieuws.nl/images/multithumb_thumbs/b_100_0_16777215_00_images_stories_com_form2content_p1_f4774_thumbs_Kristy.jpg
			//   https://www.schokkendnieuws.nl/images/stories/com_form2content/p1/f4774/Kristy.jpg
			return src.replace(/\/images\/+multithumb_thumbs\/+b_[0-9]+_[0-9]+_[0-9]+_[0-9]+_images_stories_com_form2content_(p[0-9]+)_(f[0-9]+)_(?:thumbs_)?([^/]*)(?:[?#].*)?$/,
								"/images/stories/com_form2content/$1/$2/$3");
		}

		if (domain_nowww === "biosagenda.nl") {
			// https://www.biosagenda.nl/poster/regression_20948_123_0_70.jpg
			//   https://www.biosagenda.nl/poster/regression_20948.jpg
			return src.replace(/(\/poster\/+[^/]+_[0-9]+)_[0-9]+_[0-9]+_[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "primewire.li" ||
			// http://primewire.unblocked.nu/poster/small/632049-regression-92bLQ.jpg
			//   http://primewire.unblocked.nu/poster/medium/632049-regression-92bLQ.jpg
			domain === "primewire.unblocked.nu") {
			// https://www.primewire.li/poster/small/44802-gemini-man-Z55L1.jpg
			//   https://www.primewire.li/poster/medium/44802-gemini-man-Z55L1.jpg
			return src.replace(/\/poster\/+small\/+/, "/poster/medium/");
		}

		if (domain_nowww === "moviemistakes.com") {
			// https://www.moviemistakes.com/images/titles/small/11249.jpg
			//   https://www.moviemistakes.com/images/titles/full/11249.jpg
			return src.replace(/(\/images\/+titles\/+)[a-z]+\/+/, "$1full/");
		}

		if (domain === "simg.chomikuj.pl") {
			// https://simg.chomikuj.pl/b76aa30c5db7a188fe89db5710d2ad52fc795074?url=https%3A%2F%2Fi1.fdbimg.pl%2Frj5mcfu1%2F400x580_nwvwgf.jpg
			//   https://i1.fdbimg.pl/rj5mcfu1/400x580_nwvwgf.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+[0-9a-f]{20,}\?(?:.*&)?url=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nosub === "ccnxs.cn" && /^img[0-9]*\./.test(domain)) {
			// http://img8.ccnxs.cn/uploadfile/hbase/201908/0816/HBC5D55E1FB8ACE6.jpeg_/fillcrop/150x106
			//   http://img8.ccnxs.cn/uploadfile/hbase/201908/0816/HBC5D55E1FB8ACE6.jpeg
			return src.replace(/(\/uploadfile\/+.*\/[^/]*\.[^/.]+)_\/+fillcrop\/+[0-9]+x[0-9]+(?:[?#].*)?$/, "$1");
		}

		if (domain_nowww === "puschkino.de") {
			// https://puschkino.de/cms/thumbs.php?src=/dat/cms0/images/movies/692/the_danish_girl145416709989.jpg&w=400
			//   https://puschkino.de/dat/cms0/images/movies/692/the_danish_girl145416709989.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+cms\/+thumbs\.php\?(?:.*&)?src=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return urljoin(src, decodeuri_ifneeded(newsrc), true);
		}

		if (domain === "d3d8y6yhucfd29.cloudfront.net") {
			// https://d3d8y6yhucfd29.cloudfront.net/sports-product-image/1-t9598351-500.jpg
			//   https://d3d8y6yhucfd29.cloudfront.net/sports-product-image/1-t9598351-.jpg
			return src.replace(/(\/1-t[0-9]+-)[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "prothinspo.com") {
			// http://www.prothinspo.com/sitebuilder/images/alicia-vikander-ballet-shoes-du-jour-03_1_-198x250.jpg
			//   http://www.prothinspo.com/images/alicia-vikander-ballet-shoes-du-jour-03_1_.jpg
			return src.replace(/\/sitebuilder\/+(images\/+[^/]+)-[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "/$1$2");
		}

		if (domain === "assets.yesstud.io") {
			// https://assets.yesstud.io/roscoproduction/cache/roscoproduction-2288-w1250-h1000-q90-rz3-b75.jpg
			//   https://assets.yesstud.io/roscoproduction/image/roscoproduction_2288.jpg
			// http://assets.yesstud.io/shotview/cache/shotview-67430-h1000-q90-rz3-b75.jpg
			//   http://assets.yesstud.io/shotview/image/shotview_67430.jpg
			return src.replace(/\/cache\/+([a-z]+)-([0-9]+)(?:-[whqrbxy][a-z]?[0-9]*){1,}(\.[^/.]*)(?:[?#].*)?$/, "/image/$1_$2$3");
		}

		if (domain === "light.sunphoto.ro") {
			// https://light.sunphoto.ro/photos/thumb_small/43460423_IRGWGVQJS.jpg
			//   https://light.sunphoto.ro/photos/normal/43460423_IRGWGVQJS.jpg
			// https://light.sunphoto.ro/photos/thumb/85973681_MPKAANP.jpg
			//   https://light.sunphoto.ro/photos/normal/85973681_MPKAANP.jpg
			newsrc = src.replace(/\/photos\/+thumb(?:_[a-z]+)?\/+/, "/photos/normal/");
			if (newsrc !== src)
				return newsrc;

			return {
				url: src,
				headers: {
					Referer: "https://sunphoto.ro/"
				},
				referer_ok: {
					same_domain_nosub: true
				}
			};
		}

		if (domain_nowww === "thesimsresource.com") {
			// https://www.thesimsresource.com/scaled/3073/w-293h-220-3073522.jpg
			//   https://www.thesimsresource.com/scaled/3073/3073522.jpg
			return {
				url: src.replace(/(\/scaled\/+[0-9]+\/+)[wh]-[0-9]+[hw]-[0-9]+-([0-9]+\.)/, "$1$2"),
				can_head: false // 403
			};
		}

		if (domain_nowww === "the-numbers.com") {
			// https://www.the-numbers.com/images/movies/opusdata/Arrival-(2016)-Thumbnail.jpg
			//   https://www.the-numbers.com/images/movies/opusdata/Arrival-(2016).jpg
			return src.replace(/(\/images\/+movies\/+.*)-Thumbnail(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "cinefish.bg") {
			// https://www.cinefish.bg/data/movies_images/269/p_269926_thumb.jpg
			//   https://www.cinefish.bg/data/movies_images/269/p_269926.jpg
			return src.replace(/(\/data\/+movies_images\/+[0-9]+\/+p_[0-9]+)_thumb(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "oneringtrailers.com") {
			// https://oneringtrailers.com/images/posters/thumb_10067824QORUOFFN.jpg
			//   https://oneringtrailers.com/images/posters/10067824QORUOFFN.jpg
			return src.replace(/(\/images\/+[a-z]+\/+)thumb_/, "$1");
		}

		if (domain_nowww === "boxofficeturkiye.com") {
			// https://boxofficeturkiye.com/images/haberler/430x670/NewsItem_636069708804223649_c_80.jpg
			//   https://boxofficeturkiye.com/images/haberler/buyuk/NewsItem_636069708804223649.jpg
			return src.replace(/(\/images\/+haberler\/+)[0-9]+x[0-9]+\/+([^/]+)_c_[0-9]+(\.[^/]*)(?:[?#].*)?$/, "$1buyuk/$2$3");
		}

		if (amazon_container === "trello-avatars") {
			// https://trello-avatars.s3.amazonaws.com/4f752093e3c5c5b77a868f79b9cff077/50.png
			//   https://trello-avatars.s3.amazonaws.com/4f752093e3c5c5b77a868f79b9cff077/original.png
			return src.replace(/(\/[0-9a-f]{20,}\/+)[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1original$2");
		}

		if (domain === "s.ebiografia.com") {
			// https://s.ebiografia.com/assets/img/authors/cr/is/cristiano-ronaldo-m.jpg
			//   https://s.ebiografia.com/assets/img/authors/cr/is/cristiano-ronaldo-o.jpg
			return src.replace(/(\/assets\/+img\/+authors\/+..\/+..\/+[^/]+)-[ml](\.[^/.]*)(?:[?#].*)?$/, "$1-o$2");
		}

		if (domain === "rrdsoa.appspot.com") {
			// http://rrdsoa.appspot.com/l/aHR0cHM6Ly91cGxvYWQud2lraW1lZGlhLm9yZy93aWtpcGVkaWEvY29tbW9ucy90aHVtYi84LzhjL0NyaXN0aWFub19Sb25hbGRvXzIwMTguanBnLzI1MHB4LUNyaXN0aWFub19Sb25hbGRvXzIwMTguanBn
			//   https://upload.wikimedia.org/wikipedia/commons/8/8c/Cristiano_Ronaldo_2018.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+l\/+([^/.?&]{30,})(?:[?#].*)?$/, "$1");
			if (newsrc !== src)
				return base64_decode(newsrc);
		}

		if (domain_nowww === "pinkfineart.com") {
			// https://www.pinkfineart.com/galleries/hot-legs-and-feet/9857-nikki_fox-sultry_sauna-082818/pthumbs/001.jpg
			//   https://www.pinkfineart.com/galleries/hot-legs-and-feet/9857-nikki_fox-sultry_sauna-082818/full/001.jpg
			return src.replace(/(\/galleries\/+.*\/)pthumbs\/+/, "$1full/");
		}

		if (domain === "galleries.manojob.com") {
			// http://galleries.manojob.com/scenes/rebecca_blue/tn/001.jpg
			//   http://galleries.manojob.com/scenes/rebecca_blue/full/001.jpg
			return src.replace(/(\/scenes\/+[^/]+\/+)tn\/+([0-9]+\.[^/.]+)(?:[?#].*)?$/, "$1full/$2");
		}

		if (domain_nosub === "x69.biz") {
			// https://footsiebabes.x69.biz/thumb/fb/v/2780.jpg
			//   https://footsiebabes.x69.biz/full/fb/v/2780.jpg
			return src.replace(/(:\/\/[^/]+\/+)thumb(\/+fb\/+v\/+[0-9]+\.[^/.]+)(?:[?#].*)?$/, "$1full$2")
		}

		if (domain_nowww === "dudepins.com") {
			// https://dudepins.com/images/socialpinboard/thumbnails/WxwSP4c.jpg
			//   https://dudepins.com/images/socialpinboard/WxwSP4c.jpg
			return src.replace(/(\/images\/+socialpinboard\/+)thumbnails\/+/, "$1");
		}

		if (domain_nosub === "s3c.es") {
			// https://s04.s3c.es/imag/_v0/2560x3931/6/6/0/880x_VictoriaJustice.jpg
			//   https://s04.s3c.es/imag/_v0/2560x3931/6/6/0/VictoriaJustice.jpg
			return src.replace(/(\/imag\/+_v[0-9]+\/+[0-9]+x[0-9]+\/+(?:[0-9]\/+){3})[0-9]+x_/, "$1");
		}

		if (domain_nowww === "playboyrussia.com") {
			// https://playboyrussia.com/premium/data/galleries/17000/4s.jpg
			//   https://playboyrussia.com/premium/data/galleries/17000/4.jpg
			return src.replace(/(\/data\/+galleries\/+[0-9]+\/+[0-9]+)s(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "animaldiversity.org") {
			// https://animaldiversity.org/collections/contributors/james_dowlinghealey/Redearedsliders/medium.jpg
			//   https://animaldiversity.org/collections/contributors/james_dowlinghealey/Redearedsliders/ -- original page
			//   https://animaldiversity.org/collections/contributors/james_dowlinghealey/Redearedsliders/large.jpg
			// https://animaldiversity.org/collections/contributors/phil_myers/odonata/Gomphidae-Gomphus/gomphus2319/small.jpg
			//   https://animaldiversity.org/collections/contributors/phil_myers/odonata/Gomphidae-Gomphus/gomphus2319/large.jpg
			newsrc = src.replace(/(\/collections\/+contributors\/+(?:[^/]+\/+){2,4})(?:small|medium)(\.[^/.]*)(?:[?#].*)?$/, "$1large$2");
			if (newsrc !== src)
				return newsrc;

			match = src.match(/\/collections\/+contributors\/+(?:[^/]+\/+){2,4}(?:small|medium|large)\.[^/.]*(?:[?#].*)?$/);
			if (match)
				return {
					url: src,
					extra: {
						page: src.replace(/\/[^/]+(?:[?#].*)?$/, "/")
					}
				};
		}

		if (domain === "api.creativecommons.engineering") {
			// https://api.creativecommons.engineering/t/http://capl.washjeff.edu/1/l/2985.jpg
			//   http://capl.washjeff.edu/1/l/2985.jpg
			return src.replace(/^[a-z]+:\/\/[^/]+\/+t\/+(https?:)/, "$1");
		}

		if (domain === "capl.washjeff.edu") {
			// http://capl.washjeff.edu/1/s/2985.jpg
			//   http://capl.washjeff.edu/browseresults.php?langID=1&photoID=2985 -- original page
			//   http://capl.washjeff.edu/1/l/2985.jpg
			newsrc = src.replace(/^([a-z]+:\/\/[^/]+\/+[0-9]+\/+)[sm](\/+[0-9]+\.[^/.]*)(?:[?#].*)?$/, "$1l$2");
			if (newsrc !== src)
				return newsrc;

			match = src.match(/^[a-z]+:\/\/[^/]+\/+([0-9]+)\/+([sml])\/+([0-9]+)\.[^/.]*(?:[?#].*)?$/);
			if (match) {
				return {
					url: src,
					extra: {
						page: "http://capl.washjeff.edu/browseresults.php?langID=" + match[1] + "&photoID=" + match[3] + "&size=" + match[2]
					}
				};
			}
		}

		if (domain === "openaccess-cdn.clevelandart.org") {
			// https://openaccess-cdn.clevelandart.org/1938.56/1938.56_web.jpg
			//   https://www.clevelandart.org/art/1938.56 -- original page
			//   https://openaccess-cdn.clevelandart.org/1938.56/1938.56_print.jpg
			// https://openaccess-cdn.clevelandart.org/1963.256.159.b/1963.256.159.b_web.jpg
			//   https://www.clevelandart.org/art/1963.256.159.b
			//   https://piction.clevelandart.org/cma/ump.di?e=4775B2A7B523789E3119B5487BBC26521198A654710B7E2F122B692DBF57BB4A&s=21&se=1331713318&v=&f=1963.256.159.b_o10.jpg
			newsrc = src.replace(/(\/[0-9.a-z]+)_web(\.[^/.]*)(?:[?#].*)?$/, "$1_print$2");
			if (newsrc !== src)
				return newsrc;

			match = src.match(/^[a-z]+:\/\/[^/]+\/+([0-9.a-z]+)\/+/);
			if (match) {
				return {
					url: src,
					extra: {
						page: "https://www.clevelandart.org/art/" + match[1]
					}
				};
			}
		}

		if (domain_nowww === "emovieposter.com") {
			// http://www.emovieposter.com/images/moviestars/AA191201/200/french_1p_batman_linen_WC22826_B.jpg
			//   http://www.emovieposter.com/images/moviestars/AA191201/french_1p_batman_linen_WC22826_B.jpg
			return src.replace(/(\/images\/+[^/]+\/+[A-Z0-9]+\/+)[0-9]+\/+([^/]+\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nosub === "dimu.org") {
			// https://dms-cf-08.dimu.org/image/012uMWqAqSiU
			//   https://dms-cf-08.dimu.org/image/012uMWqAqSiU?dimension=max
			//   https://digitaltmuseum.org/011015423354/fo207298dia -- original page
			//   https://dms-cf-08.dimu.org/image/012uMWqAqSiU?filename=Fo207298DIA.jpg&dimension=max -- forces download
			return src.replace(/^([a-z]+:\/\/[^/]+\/+image\/+[^/]+?)(?:[?#].*)?$/, "$1?dimension=max");
		}

		if (domain_nowww === "flora-on.pt") {
			// https://flora-on.pt/Galium-glaucum_low_pzHd.jpg -- no watermark
			//   https://flora-on.pt/Galium-glaucum_ori_pzHd.jpg -- watermark
			//   https://flora-on.pt/Galium-glaucum_pzHd.jpg -- smaller, watermark
			// https://flora-on.pt/Galium-glaucum-australe_JNyR.jpg
			newsrc = src.replace(/(:\/\/[^/]+\/+[^/]+?)(?:_(?:low|ori))?(_[a-zA-Z0-9]+)(\.jpg)(?:down)?(?:[?#].*)?$/, "$1_ori$2$3");
			if (newsrc !== src)
				return newsrc;

			match = src.match(/:\/\/[^/]+\/+[^/]+?(?:_(?:low|ori))?_([a-zA-Z0-9]+)\.jpg(?:down)?(?:[?#].*)?$/);
			if (match) {
				return {
					url: src,
					extra: {
						page: "https://flora-on.pt/#/h" + match[1]
					}
				};
			}
		}

		if (domain_nosub === "geograph.org.uk" && /^s[0-9]*\./.test(domain)) {
			// https://s0.geograph.org.uk/geophotos/02/57/05/2570540_07389d87.jpg
			//   https://www.geograph.org.uk/reuse.php?id=2570540&download=07389d87
			//   https://www.geograph.org.uk/photo/2570540 -- original page
			match = src.match(/^[a-z]+:\/\/[^/]+\/+geophotos\/+(?:[0-9]{2}\/+){3}([0-9]+)_([0-9a-f]+)\./);
			if (match) {
				return {
					url: "https://www.geograph.org.uk/reuse.php?id=" + match[1] + "&download=" + match[2],
					extra: {
						page: "https://www.geograph.org.uk/photo/" + match[1]
					}
				};
			}
		}

		if (domain === "collections.museumvictoria.com.au") {
			// https://collections.museumvictoria.com.au/content/media/7/67857-thumbnail.jpg
			//   https://collections.museumvictoria.com.au/content/media/7/67857-large.jpg
			return src.replace(/(\/content\/+media\/+[^/]+\/+[0-9]+-)(?:thumbnail|medium)(\.[^/.]*)(?:[?#].*)?$/, "$1large$2");
		}

		if (domain_nowww === "phylopic.org") {
			// http://phylopic.org/assets/images/submissions/71b7c167-ffd2-4748-889a-3ace8935424f.512.png
			//   http://phylopic.org/assets/images/submissions/71b7c167-ffd2-4748-889a-3ace8935424f.svg
			//   http://phylopic.org/image/71b7c167-ffd2-4748-889a-3ace8935424f/ -- original page
			newsrc = src.replace(/(\/assets\/+images\/+submissions\/+[-0-9a-f]{20,})\.[0-9]+\.png(?:[?#].*)?$/, "$1.svg");
			if (newsrc !== src)
				return newsrc;

			match = src.match(/\/assets\/+images\/+submissions\/+([-0-9a-f]{20,})\./);
			if (match) {
				return {
					url: src,
					extra: {
						page: "http://phylopic.org/image/" + match[1]
					}
				};
			}
		}

		if (domain_nowww === "svgsilh.com") {
			// https://svgsilh.com/png/2619140-9e9e9e.png
			//   https://svgsilh.com/svg/2619140-9e9e9e.svg
			//   https://svgsilh.com/9e9e9e/image/2619140.html -- original page
			newsrc = src.replace(/\/png\/+([0-9]+)-([0-9a-f]+)\.png(?:[?#].*)?$/, "/svg/$1-$2.svg");
			if (newsrc !== src)
				return newsrc;

			match = src.match(/:\/\/[^/]+\/+[a-z]+\/+([0-9]+)-([0-9a-f]+)\.[a-z]+(?:[?#].*)?$/);
			if (match) {
				return {
					url: src,
					extra: {
						page: "https://svgsilh.com/" + match[2] + "/image/" + match[1] + ".html"
					}
				};
			}
		}

		if (domain_nowww === "walldevil.co") {
			// https://www.walldevil.co/wallpapers/w10/thumb/dmitry-arhar-grey-shirt-blonde-women-katerina-shiryaeva-portrait-tiptoe-sitting-on-the-floor-looking-at-viewer-women-indoors-barefoot-couch.jpg
			//   https://www.walldevil.co/wallpapers/w10/dmitry-arhar-grey-shirt-blonde-women-katerina-shiryaeva-portrait-tiptoe-sitting-on-the-floor-looking-at-viewer-women-indoors-barefoot-couch.jpg
			return src.replace(/(\/wallpapers\/+w[0-9]+\/+)thumb\/+/, "$1");
		}

		if (domain === "cdni.rt.com") {
			// https://cdni.rt.com/files/2019.01/xxs/5c2f3dfadda4c8ad6b8b465c.jpg
			//   https://cdni.rt.com/files/2019.01/original/5c2f3dfadda4c8ad6b8b465c.jpg
			// doesn't work for all (the last numbers below increment/decrement):
			// https://cdni.rt.com/files/2018.12/xxs/5c221e1ffc7e9397018b4600.jpg
			//   https://cdni.rt.com/files/2018.12/xs/5c221e1ffc7e9397018b4601.jpg
			//   https://cdni.rt.com/files/2018.12/thumbnail/5c221e1ffc7e9397018b45ff.jpg
			//   https://cdni.rt.com/files/2018.12/m/5c221e1ffc7e9397018b4602.jpg
			//   https://cdni.rt.com/files/2018.12/l/5c221e1ffc7e9397018b4603.jpg
			//   https://cdni.rt.com/files/2018.12/article/5c221e1ffc7e9397018b45fe.jpg
			//   https://cdni.rt.com/files/2018.12/xxl/5c221e20fc7e9397018b4604.jpg
			return src.replace(/(\/files\/+[0-9]{4}\.[0-9]{2}\/+)[a-z]+\/+/, "$1original/");
		}

		if (domain === "api.97bike.com" ||
			// https://pic.qmglive.com/pic.php?url=https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2575911093.jpg
			//   https://img3.doubanio.com/pview/photo/raw/public/p2575911093.jpg
			domain === "pic.qmglive.com") {
			// https://api.97bike.com/pic.php?url=https://img3.doubanio.com/view/photo/l/public/p2573362745.jpg
			//   https://img3.doubanio.com/pview/photo/raw/public/p2573362745.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+pic\.php\?(?:.*?&)?url=([^&]+).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nowww === "hxyy56.com" ||
			// http://m.meijuxia.com/tu.php?pic=https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2570398360.jpg
			//   https://img3.doubanio.com/pview/photo/raw/public/p2570398360.jpg
			domain_nosub === "meijuxia.com" ||
			// http://zy.itono.cn/tu.php?pic=img3.doubanio.com/view/photo/s_ratio_poster/public/p597700664.jpg
			//   http://img3.doubanio.com/pview/photo/raw/public/p597700664.jpg
			domain === "zy.itono.cn") {
			// http://hxyy56.com/tu.php?url=https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2529882507.jpg
			//   https://img1.doubanio.com/pview/photo/raw/public/p2529882507.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+tu\.php\?(?:.*&)?(?:url|pic)=([^&]+).*?$/, "$1");
			if (newsrc !== src)
				return add_http(decodeuri_ifneeded(newsrc));
		}

		if (domain_nowww === "process-safety-lab.com") {
			// https://www.process-safety-lab.com/imges.php?src=https://img9.doubanio.com/view/subject/l/public/s11082126.jpg
			//   https://img9.doubanio.com/view/subject/raw/public/s11082126.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+imges\.php\?(?:.*&)?src=([^&]+).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nowww === "bvla.com") {
			// https://bvla.com/media/inventory/product/alt/1672_0.jpg
			//   https://bvla.com/media/inventory/product/full/1672_0.jpg
			return src.replace(/(\/media\/+inventory\/+product\/+)alt(\/+[0-9]+_[0-9]+\.[^/.]+)(?:[?#].*)?$/, "$1full$2");
		}

		if (domain === "vangogh.teespring.com") {
			// https://vangogh.teespring.com/static.jpg?height=570&image_url=https%3A%2F%2Fs3.amazonaws.com%2Fteespring-pub-custom%2F9f7_55491109_product_787_103458_front.png&padded=false&signature=f7ohWtC165tZtziN8cxIqs%2FOSWEgpuoTC3Cl8w9UoJQ%3D&version=2019-02-25-20-59&width=480
			//   https://s3.amazonaws.com/teespring-pub-custom/9f7_55491109_product_787_103458_front.png
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+static\.jpg\?(?:.*&)?image_url=([^&]+).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);

			// https://vangogh.teespring.com/opengraph.jpg?composition=%7B%22artwork%22%3A%7B%22url%22%3A%22https%3A%2F%2Fteespring-pri.s3.amazonaws.com%2F525_69186279_69425709_front.png%22%2C%22offset%22%3A%7B%22x%22%3A0%2C%22y%22%3A0%7D%7D%2C%22artwork_limit%22%3A%7B%7D%2C%22artwork_transform%22%3A%22FitToPrintableArea%22%2C%22artwork_orientation%22%3A%22Portrait%22%2C%22product_colors%22%3A%5B%7B%22hex%22%3A%22%23000000%22%7D%5D%2C%22product_image%22%3A%7B%22reference_point%22%3A%7B%22x%22%3A530%2C%22y%22%3A377%7D%2C%22printable_area%22%3A%7B%22x%22%3A86%2C%22y%22%3A60%2C%22width%22%3A888%2C%22height%22%3A634%7D%2C%22ppi%22%3A181.8%2C%22url%22%3A%22https%3A%2F%2Fteespring-product-images.s3.amazonaws.com%2F89_front_ghost.png%22%2C%22background_mask_url%22%3A%22https%3A%2F%2Fteespring-product-images.s3.amazonaws.com%2F89_front_mask.png%22%7D%7D&height=627&signature=hD7ZqFU4fSHtESugSbR41PrLSNF3JBSGGdgJvlVJN80%3D&version=2019-10-09-03-11&width=1200
			//   https://teespring-pri.s3.amazonaws.com/525_69186279_69425709_front.png -- 403
			//   https://teespring-pub-custom.s3.amazonaws.com/525_69186279_69425709_front.png -- 403 too
			// should this be kept then?
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+opengraph\.jpg\?(?:.*&)?composition=([^&]+).*?$/, "$1");
			if (newsrc !== src) {
				try {
					var json = JSON_parse(decodeURIComponent(newsrc));
					return json.artwork.url;
				} catch (e) {
					console_error(e);
					return src;
				}
			}

			// https://vangogh.teespring.com/v3/image/wVgPexQfKTNzxdgc3C-lEIQiLo8/480/560.jpg
			//   https://vangogh.teespring.com/v3/image/wVgPexQfKTNzxdgc3C-lEIQiLo8/999999/999999.jpg
			// https://vangogh.teespring.com/shirt_pic/37081712/37372743/266/6174/480x9999/front.jpg?v=2018-02-02-12-41
			//   https://vangogh.teespring.com/shirt_pic/37081712/37372743/266/6174/999999x999999/front.jpg?v=2018-02-02-12-41
			//   https://vangogh.teespring.com/shirt_pic/37081712/37372743/266/6173/999999x999999/front.jpg?v=2018-02-02-12-41 -- pink
			//   https://vangogh.teespring.com/shirt_pic/37081712/37372743/2/6173/999999x999999/front.jpg?v=2018-02-02-12-41 -- different shirt
			//   https://vangogh.teespring.com/og_pic/37081712/37372743/front.jpg?v=2018-02-02-12-41 -- cropped
			// https://vangogh.teespring.com/og_pic/87447110/12774606/front.jpg?v=2019-11-26-00-02&background-image=wood&effects=inner-glow
			return src
				.replace(/(\/v3\/+image\/+[^/]{10,}\/+)[0-9]+\/+[0-9]+(\.[^/.]+)(?:[?#].*)?$/, "$1999999/999999$2")
				.replace(/(\/shirt_pic\/+(?:[0-9]+\/+){4})[0-9]+x[0-9]+\/+([^/]+\.[^/.]+)(?:[?#].*)?$/, "$1999999x999999/$2");
		}

		if (domain_nosub === "lvme.me" && /^[a-z]\./.test(domain)) {
			// http://e.lvme.me/j4p3om9_2.jpg
			//   http://e.lvme.me/j4p3om9.jpg
			//   https://www.livememe.com/j4p3om9/ -- original page
			newsrc = src.replace(/(:\/\/[^/]+\/+[a-z0-9]+)_[0-9]+(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
			if (newsrc !== src)
				return newsrc;

			match = src.match(/^[a-z]+:\/\/[^/]+\/+([a-z0-9]+)\.[^/.]+(?:[?#].*)?$/);
			if (match)
				return {
					url: src,
					extra: {
						page: "https://www.livememe.com/" + match[1] + "/"
					}
				};
		}

		if (domain_nowww === "jmusicitalia.com" ||
			// https://static.jmusicitalia.com/artisti/tara/album/jewelry-box-cd.jpg
			//   https://static.jmusicitalia.com/artisti/tara/album/jewelry-box-cd-big.jpg
			domain === "static.jmusicitalia.com") {
			// https://www.jmusicitalia.com/artisti/tara/album/jewelry-box-cd.jpg
			//   https://www.jmusicitalia.com/artisti/tara/album/jewelry-box-cd-big.jpg
			return src.replace(/(\/artisti\/+[^/]+\/+album\/+[^/]+?)(?:-big)?(\.[^/.]+)(?:[?#].*)?$/, "$1-big$2");
		}

		if (domain_nowww === "cooltrack.co.kr") {
			// http://www.cooltrack.co.kr/shopimages/cooltrack/0010110013713.jpg
			//   http://www.cooltrack.co.kr/shopimages/cooltrack/001011001371.jpg
			return src.replace(/(\/shopimages\/+cooltrack\/+[0-9]{12})[0-9](\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nosub === "rakuten.com" && /^images\./.test(domain)) {
			// https://images.fr.shopping.rakuten.com/photo/927785641_M.jpg
			//   https://images.fr.shopping.rakuten.com/photo/927785641.jpg
			return src.replace(/(\/photo\/+[0-9]+)_[SML](\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "suruga-ya.jp" ||
			domain_nowww === "suruga-ya.com" ||
			// thanks to anonymous for reporting:
			// https://cdn.suruga-ya.jp/pics/boxart_m/211019151m.jpg
			//   https://cdn.suruga-ya.jp/database/pics/game/211019151.jpg
			domain === "cdn.suruga-ya.jp" ||
			domain === "cdn.suruga-ya.com") {
			// https://www.suruga-ya.jp/pics/boxart_m/211019151m.jpg
			//   https://www.suruga-ya.jp/database/pics/game/211019151.jpg
			// thanks to anonymous for reporting:
			// https://www.suruga-ya.jp/pics_light/boxart_m/251010927_1m.jpg
			//   https://www.suruga-ya.jp/database/pics/game/251010927.jpg -- incorrect
			//   https://www.suruga-ya.jp/database/pics/game/251010927_1.jpg
			// https://www.suruga-ya.jp/pics_light/boxart_m/220146867m.jpg
			//   https://www.suruga-ya.jp/database/pics/game/220146867.jpg
			// https://www.suruga-ya.jp/pics_light/boxart_ss/220290525ss.gif
			//   https://www.suruga-ya.jp/database/pics/game/220290525.jpg
			// https://www.suruga-ya.jp/database/pics_light/game/220146867.jpg
			//   https://www.suruga-ya.jp/database/pics/game/220146867.jpg
			// https://www.suruga-ya.jp/pics_webp/boxart_m/602236211m.jpg.webp
			//   https://www.suruga-ya.jp/database/pics/game/602236211.jpg
			// thanks to fireattack on discord:
			// https://www.suruga-ya.jp/pics_light/boxart_a/508922053_1.jpg?v=49a0a1c22aaae3834f5d
			//   https://www.suruga-ya.jp/database/pics/game/508922053_1.jpg
			// https://www.suruga-ya.jp/pics_webp/boxart_m/gg151512m.jpg.webp
			//   https://www.suruga-ya.jp/database/pics/game/gg151512.jpg
			return src.replace(/\/(?:database\/+)?pics(?:_(?:light|webp))?\/+(?:boxart_[a-z]+|game)\/+([a-z]*[0-9]+(?:_[0-9]+)?)[a-z]*\.[a-z]+(?:\.[a-z]+)?(?:[?#].*)?$/, "/database/pics/game/$1.jpg");
		}

		if (domain_nowww === "itsfun.com.tw") {
			// https://www.itsfun.com.tw/images/ef/b2/==wZwpmL2kzMkNGMmhDZ2kjZjFGMyEDM09yX4YjMfhjNy8CZmRXbk9SbvNmLnNXboFnL4A3LvoDc0RHa.jpg
			//   http://p8.qhmsg.com/t0120acf96d8f0cd396.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+images\/+(?:[0-9a-f]{2}\/+){2}([^/.]{30,})\.[^/.]+(?:[?#].*)?$/, "$1");
			if (newsrc !== src) {
				return base64_decode(reverse_str(newsrc));
			}
		}

		if (domain_nowww === "hot-sex-photos.com") {
			// https://www.hot-sex-photos.com/en/xxx-pics/karen-gillan-7.thumb.jpg
			//   https://www.hot-sex-photos.com/en/xxx-pics/karen-gillan-7.jpg
			return src.replace(/\.thumb(\.[^/.]+)(?:[?#].*)?$/, "$1");
		}

		if (domain === "s.io.ua") {
			// https://s.io.ua/img_aa/small/3613/30/36133095_0.jpg
			//   https://g.io.ua/img_aa/large/3613/30/36133095.jpg
			return {
				url: src.replace(/:\/\/s(\.[^/]+\/+img_aa\/+)small(\/+[0-9]+\/+[0-9]+\/+[0-9]+)_0(\.[^/.]+)(?:[?#].*)?$/, "://g$1large$2$3"),
				headers: {
					Referer: ""
				},
				referer_ok: {
					same_domain_nosub: true
				}
			};
		}

		if (domain_nosub === "io.ua") {
			obj = {
				url: src,
				headers: {
					Referer: ""
				},
				referer_ok: {
					same_domain_nosub: true
				}
			};

			match = src.match(/\/img_aa\/+[a-z]+\/+[0-9]+\/+[0-9]+\/+([0-9]+)(?:_[0-9]+)?\./);
			if (match) {
				obj.extra = { page: "https://io.ua/" + match[1] };
			}

			return obj;
		}

		if (domain_nowww === "sexylabia.net") {
			return {
				url: src.replace(/\/uploads\/+thumbnails\/+FileUpload\/+/, "/uploads/FileUpload/"),
				headers: {
					Referer: ""
				},
				referer_ok: {
					same_domain_nosub: true
				}
			};
		}

		if (domain_nowww === "labsporno.com") {
			// http://labsporno.com/images/7/758590399-t.jpg
			//   http://labsporno.com/images/7/758590399.jpg
			return src.replace(/(\/images\/+[0-9]\/+[0-9]+)-t(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "astro.cz") {
			// https://www.astro.cz/apod_data/2017/04/SaturnIR_CassiniKakitsev_960_detail.jpg
			//   https://www.astro.cz/apod_data/2017/04/SaturnIR_CassiniKakitsev_960.jpg
			return src.replace(/(\/apod_data\/+[0-9]{4}\/+[0-9]{2}\/+[^/]+)_detail(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "img.poliigon.com") {
			// https://img.poliigon.com/assets/WoodEngineeredGenerator/assets/small/sphere.jpg
			//   https://img.poliigon.com/assets/WoodEngineeredGenerator/assets/large/sphere.jpg
			return src.replace(/\/assets\/+small\/+([^/]+\.[^/.]+)(?:[?#].*)?$/, "/assets/large/$1");
		}

		if (domain_nosub === "cgtrader.com" && /^img/.test(domain)) {
			// https://img-new.cgtrader.com/items/977383/9c22362146/thumb/modern-wood-tiles-pbr-tileable-texture-3d-model-sbs-sbsar.jpg
			//   https://img2.cgtrader.com/items/977383/9c22362146/modern-wood-tiles-pbr-tileable-texture-3d-model-sbs-sbsar.jpg
			//   https://img-new.cgtrader.com/items/977383/9c22362146/modern-wood-tiles-pbr-tileable-texture-3d-model-sbs-sbsar.jpg
			return src.replace(/(\/items\/+[0-9]+\/+[0-9a-f]+\/+)thumb\/+/, "$1");
		}

		if (domain_nowww === "sketchuptextureclub.com") {
			// https://www.sketchuptextureclub.com/imgs/q.png
			if (/\/imgs\/+q\.png(?:[?#].*)?$/.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}

			// https://www.sketchuptextureclub.com/public/texture_m/0025-cork-texture-seamless.jpg
			//   https://www.sketchuptextureclub.com/public/texture/0025-cork-texture-seamless.jpg
			//   https://www.sketchuptextureclub.com/public/texture_d/0025-cork-texture-seamless.jpg -- smaller, no watermark, cropped
			newsrc = src.replace(/\/public\/+texture_m\/+([0-9]+-)/, "/public/texture/$1");
			if (newsrc !== src) {
				return {
					url: newsrc,
					problems: {
						watermark: true
					}
				};
			}
		}

		if (domain_nowww === "gamingonlinux.com" ||
			// https://uploads.golmedia.net/uploads/articles/article_media/thumbs/582056391597327409gol1.jpg
			//   https://uploads.golmedia.net/uploads/articles/article_media/582056391597327409gol1.jpg
			domain === "uploads.golmedia.net") {
			// https://www.gamingonlinux.com/uploads/articles/article_media/thumbs/4837050791576835482gol1.jpg
			//   https://www.gamingonlinux.com/uploads/articles/article_media/4837050791576835482gol1.jpg
			newsrc = src.replace(/(\/uploads\/+articles\/+article_media\/+)thumbs\/+/, "$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (host_domain_nowww === "gamingonlinux.com" && options.element) {
			if (options.element.tagName === "IMG" && options.element.parentElement && options.element.parentElement.tagName === "DIV") {
				var videoid = options.element.parentElement.getAttribute("data-video-id");
				if (videoid) {
					return "https://i.ytimg.com/vi/" + videoid + "/mqdefault.jpg";
				}
			}
		}

		if (domain === "img.karaoketexty.sk") {
			// https://img.karaoketexty.sk/img/artists/13343/thumb/thumb-selena-gomez-567033.jpg
			//   https://img.karaoketexty.sk/img/artists/13343/selena-gomez-567033.jpg
			// https://img.karaoketexty.sk/img//covers/756/75608/thumb/thumb-covers-53638.jpg
			//   https://img.karaoketexty.sk/img//covers/756/75608/covers-53638.jpg
			return src.replace(/(\/img\/+[^/]+\/+[0-9]+\/+(?:[0-9]+\/+)?)thumb\/+thumb-/, "$1");
		}

		if (domain === "img.buymeacoffee.com") {
			// https://img.buymeacoffee.com/api/?url=aHR0cHM6Ly9jZG4uYnV5bWVhY29mZmVlLmNvbS91cGxvYWRzL3Byb2ZpbGVfcGljdHVyZXMvMjAxOS8xMi9iZDdmYjgzZGQ2N2ZjMjk1NTk5ZTc1MGE0NjEyNDhkMy5qcGc=&size=300&name=Liam+Dawe+-+GamingOnLinux
			//   https://cdn.buymeacoffee.com/uploads/profile_pictures/2019/12/bd7fb83dd67fc295599e750a461248d3.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+api\/+\?(?:.*?&)?url=([^&]{20,}).*?$/, "$1");
			if (newsrc !== src)
				return base64_decode(newsrc);
		}

		if (domain === "cdn.buymeacoffee.com") {
			// https://cdn.buymeacoffee.com/uploads/rewards/2023-05-10/1/230738_5.png@600w_0e.png
			//   https://cdn.buymeacoffee.com/uploads/rewards/2023-05-10/1/230738_5.png -- forces download
			return src.replace(/@[^/]+(?:[?#].*)?$/, "");
		}

		if (domain_nowww === "gfycat.com") {
			let get_gfycat_temp_token_v1 = function(site, cb) {
				var cache_key = site + ":access_token_v1";

				api_query(cache_key, {
					url: "https://weblogin." + site + ".com/oauth/webtoken",
					method: "POST",
					headers: {
						Origin: "https://www." + site + ".com",
						Referer: "",
						"Content-Type": "text/plain;charset=UTF-8",
						"Accept": "*/*"
					},
					data: base64_decode('IHsiYWNjZXNzX2tleSI6IkFucjk2dXVxdDlFZGFtU0N3SzR0eEtQak1zZjJNOTVSZmE1RkxMaFBGdWN1OEg1SFR6ZXV0eUFhIn0=').substr(1),
					json: true
				}, cb, function(done, json, cache_key) {
					if (json.access_token) {
						return done(json.access_token, 60*60);
					} else {
						console_error("Unable to get temporary token for", site);
						return done(null, false);
					}
				});
			};

			let query_gfycat_v1 = function(site, id, cb) {
				var cache_key = site + ":v1:" + id;

				get_gfycat_temp_token_v1(site, function(token) {
					if (!token)
						return cb(null);

					let id_lower = id.toLowerCase();
					let pagelink = "https://www." + site + ".com/watch/" + id_lower;

					api_query(cache_key, {
						url: "https://api." + site + ".com/v1/gfycats/" + id_lower,
						method: "GET",
						headers: {
							Origin: "https://" + site + ".com",
							Referer: "",
							Cookie: "",
							"authorization": "Bearer " + token,
							"Accept": "*/*",
							"Sec-Fetch-Site": "same-site"
						},
						json: true
					}, cb, function(done, json, cache_key) {
						if (!json || !json.gfyItem) {
							return done(null, false);
						}

						json.gfyItem._referer = "https://www." + site + ".com";
						json.gfyItem._pagelink = pagelink;

						return done(json.gfyItem, 25*60); // URLs expire in 30 minutes
					});
				});
			};

			let query_gfycat_api = function(id, cb) {
				return query_gfycat_v1("gfycat", id, cb);
			};

			let query_gfycat = function(id, cb) {
				query_gfycat_api(id, function(data) {
					if (!data)
						return cb(null);

					let page = "https://www.gfycat.com/" + data.gfyName;

					return cb(fillobj_urls([
						{
							url: data.mp4Url,
							headers: {
								Referer: page
							},
							video: true
						},
						{
							url: data.gifUrl,
							headers: {
								Referer: page
							}
						},
						{
							url: data.posterUrl
						}
					], {
						extra: {
							page: "https://www.gfycat.com/" + data.gfyName,
							caption: data.title || data.description
						}
					}));
				});
			};

			// https://www.gfycat.com/ko/YellowTornCockatiel
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+(?:(?:[a-z]{2}|ifr)\/+)?(?:watch\/+)?([a-zA-Z]+)(?:[?#].*)?$/,
				run: function(cb, match) {
					query_gfycat(match[1], cb);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "redgifs.com") {
			let get_redgifs_token_localstorage = function(cb) {
				if (!get_localstorage)
					return cb(null);

				get_localstorage("https://www.redgifs.com/", ["session_data"], function(data) {
					if (data && data["session_data"]) {
						let sessdata = data["session_data"];
						let parsed = JSON_parse(sessdata);
						if (parsed && parsed.token) {
							return cb(parsed.token);
						}
					}

					return cb(null);
				});
			};

			let get_gfycat_access_token_cache_key = function(site) {
				return site + ":access_token_v2";
			};

			let get_gfycat_temp_token_v2 = function(site, cb) {
				var cache_key = get_gfycat_access_token_cache_key(site);

				get_redgifs_token_localstorage(function(token) {
					if (token&&false)
						return cb(token);

					api_query(cache_key, {
						url: "https://api." + site + ".com/v2/auth/temporary?session_id=" + get_random_text(18, true),
						method: "GET",
						headers: {
							Origin: "https://www." + site + ".com",
							Referer: "https://www." + site + ".com",
							"Content-Type": "application/json",
							"Accept": "application/json"
						},
						json: true
					}, cb, function(done, json, cache_key) {
						if (json.token) {
							return done(json.token, 60*60);
						} else {
							console_error("Unable to get temporary token for", site);
							return done(null, false);
						}
					});
				});
			};

			var query_gfycat_v2 = function(site, id, cb) {
				var cache_key = site + ":v2:" + id;

				get_gfycat_temp_token_v2(site, function(token) {
					if (!token)
						return cb(null);

					let id_lower = id.toLowerCase(); // API is now case-sensitive
					let pagelink = "https://www." + site + ".com/watch/" + id_lower;

					api_query(cache_key, {
						url: "https://api." + site + ".com/v2/gifs/" + id_lower + "?views=yes&users=yes&niches=yes",
						method: "GET",
						imu_mode: "xhr",
						non200_ok: true,
						headers: {
							Origin: "https://www." + site + ".com",
							//Priority: "u=1, i",
							Referer: "https://www." + site + ".com",
							"Authorization": "Bearer " + token,
							//"Content-Type": "application/json",
							"Accept": "application/json, text/plain, */*",
							//"Pragma": "no-cache",
							"Sec-Fetch-Dest": "empty",
							"Sec-Fetch-Mode": "cors",
							"Sec-Fetch-Site": "same-site"
							//"x-customheader": pagelink
						},
						json: true
					}, cb, function(done, json, cache_key) {
						try {
							if (json.error.code === "Unauthorized") {
								api_cache.remove(get_gfycat_access_token_cache_key(site));
								console_error(cache_key, "Unauthorized, try again", json);
								return done(null, false);
							}
						} catch (e) {}

						if (!json || !json.gif) {
							console_error(cache_key, "Unable to find json from", json);
							return done(null, false);
						}

						json.gif._referer = "https://www." + site + ".com/";
						json.gif._pagelink = pagelink;

						return done(json.gif, 25*60); // URLs expire in 30 minutes
					});
				});
			};

			let query_redgifs_api = function(id, cb) {
				return query_gfycat_v2("redgifs", id, cb);
			};

			let query_redgifs = function(id, cb) {
				query_redgifs_api(id, function(data) {
					if (!data)
						return cb(null);

					let tags = [];
					for (let tag of data.tags) {
						tags.push("#" + tag.replace(/\s+/g, "-"));
					}

					// TODO: support albums
					let is_video = data.duration !== null;

					return cb(fillobj_urls([
						{
							url: data.urls.hd,
							headers: {
								Referer: data._referer
							},
							can_head: false, // 403?
							private: true,
							video: is_video
						},
						{
							url: data.urls.sd, // sometimes hd doesn't work
							headers: {
								Referer: data._referer
							},
							can_head: false, // 403?
							private: true,
							video: is_video
						},
						{
							url: data.urls.thumbnail,
							private: true
						}
					], {
						extra: {
							page: data._pagelink,
							caption: tags.join(" ")
						}
					}));
				})
			};

			// always returns redgifs urls, even if it's gfycat
			var query_gdn = function(id, cb) {
				var cache_key = "gifdeliverynetwork:" + id;

				api_cache.fetch(cache_key, cb, function(done) {
					options.do_request({
						url: "https://www.gifdeliverynetwork.com/" + id,
						method: "GET",
						headers: {
							Referer: ""
						},
						onload: function(resp) {
							if (resp.status !== 200) {
								console_error(cache_key, resp);
								return done(null, false);
							}

							console.log(resp);

							try {
								var match = resp.responseText.match(/<script type="application\/ld\+json">([[]{.*?}])<\/script>/);
								if (match) {
									var json = JSON_parse(match[1]);

									for (var i = 0; i < json.length; i++) {
										if (json[i].thumbnailUrl)
											return done(json[i].thumbnailUrl[0], 24*60*60);
									}
								} else {
									console_error("Unable to find match for", resp);
								}
							} catch (e) {
								console_error(e);
							}

							return done(null, false);
						}
					});
				});
			};

			// https://www.gfycat.com/ko/YellowTornCockatiel
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+(?:(?:[a-z]{2}|ifr)\/+)?(?:watch\/+)?([a-zA-Z]+)(?:[?#].*)?$/,
				run: function(cb, match) {
					query_redgifs(match[1], cb);
				}
			});
			if (newsrc) return newsrc;
		}

		if (host_domain_nowww === "redgifs.com" && options.element && !src) {
			if (options.element.tagName === "VIDEO") {
				let parent = common_functions["get_parent_el_matching"](options.element, x => (x.classList.contains("Video") || x.classList.contains("GifPreview")));
				if (parent) {
					let poster = parent.querySelector("img.Video-Poster");
					if (!poster)
						poster = parent.querySelector("img.Player-Poster");
					if (poster) {
						return poster.src;
					}
				}
			}
		}

		if (domain_nowww === "gifdeliverynetwork.com") {
			return {
				url: src.replace(/:\/\/[^/]+\/+/, "://redgifs.com/"),
				is_pagelink: true
			};
		}

		if ((domain_nosub === "gfycat.com" || domain_nosub === "redgifs.com") && (/^(?:th(?:umbs|cf)[0-9]*|zippy|giant|files)\./.test(domain))) {
			match = src.match(/^[a-z]+:\/\/[^/]+\/+([^-./]+)[-.]/);
			if (match) {
				var watch = "/";
				if (domain_nosub === "redgifs.com") watch = "/watch/";
				return {
					url: "https://" + domain_nosub + watch + match[1],
					is_pagelink: true
				};
			}

			// https://thumbs.gfycat.com/YellowTornCockatiel-size_restricted.gif
			//   https://thumbs.gfycat.com/YellowTornCockatiel-mobile.mp4
			//   https://zippy.gfycat.com/YellowTornCockatiel.mp4
			newsrc = src
				.replace(/:\/\/zippy\.([^/]+\/+[^/]+)(?:-[^/.]+)?\.[^/.]+(?:[?#].*)?$/, "://giant.$1.mp4")
				.replace(/:\/\/th(?:umbs|cf)[0-9]*(\.gfycat\.[^/]+\/+[^-/]+)(?:[?#].*)?$/, "://zippy$1")
				.replace(/:\/\/(th(?:umbs|cf)[0-9]*\.[^/]+\/+[^/]+?)(?:-(?:(?:size_restricted|small)\.gif|mobile\.(?:webm|mp4)|(?:mobile|poster)\.jpg)|\.webp)(?:[?#].*)?$/, "://$1.mp4");
			obj = {
				url: newsrc
			};

			if (newsrc !== src) {
				obj.video = true;
			}

			match = src.match(/^[a-z]+:\/\/[^/]+\/+([^-./]+)[-.]/);
			if (match) {
				var watch = "/";
				if (domain_nosub === "redgifs.com") watch = "/watch/";
				obj.extra = {page: "https://" + domain_nosub + watch + match[1]};
			}

			return obj;
		}

		if (amazon_container === "blurbprod1000") {
			// http://blurbprod1000.s3.amazonaws.com/28b6660506634feeba18c6f00cb64ccf/5874d1e6-a34d-60e9-f94d-bb7ed3d9dcf4/M.jpeg
			//   http://blurbprod1000.s3.amazonaws.com/28b6660506634feeba18c6f00cb64ccf/5874d1e6-a34d-60e9-f94d-bb7ed3d9dcf4/O.jpeg
			return src.replace(/(\/[0-9a-f]{20,}\/+[-0-9a-f]{20,}\/+)[A-Z](\.[^/.]*)(?:[?#].*)?$/, "$1O$2");
		}

		if (domain === "bookshow.blurb.com") {
			// https://bookshow.blurb.com/bookshow/cache/P15139626/lw/cover_2.jpeg?access_key=9c182f68f23c916fd32d5be31fb0cab5
			//   https://bookshow.blurb.com/bookshow/cache/P15139626/md/cover_2.jpeg?access_key=9c182f68f23c916fd32d5be31fb0cab5
			return src.replace(/(\/bookshow\/+cache\/+[^/]+\/+)lw\/+/, "$1md/");
		}

		if (domain === "contents.sixshop.com") {
			// https://contents.sixshop.com/thumbnails/uploadedFiles/152/default/image_1489460747343_1000.png
			//   https://contents.sixshop.com/uploadedFiles/152/default/image_1489460747343.png
			return src.replace(/\/thumbnails\/+(uploadedFiles\/+[0-9]+\/+[^/]+\/+[^/]+)_[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "/$1$2");
		}

		if (domain_nosub === "gumroad.com" && /^static(?:-[0-9]+)\./.test(domain) ||
			// thanks to Brodly on discord for reporting
			// https://public-files.gumroad.com/variants/bqfxion7l0fdtslzjywibzxcxvnr/baaca0eb0e33dc4f9d45910b8c86623f0144cea0fe0c2093c546d17d535752eb
			//   https://public-files.gumroad.com/bqfxion7l0fdtslzjywibzxcxvnr
			domain === "public-files.gumroad.com") {
			// thanks to Broly on discord for reporting
			// https://static-2.gumroad.com/res/gumroad-public-storage/variants/bqfxion7l0fdtslzjywibzxcxvnr/baaca0eb0e33dc4f9d45910b8c86623f0144cea0fe0c2093c546d17d535752eb
			//   https://static-2.gumroad.com/res/gumroad-public-storage/bqfxion7l0fdtslzjywibzxcxvnr
			newsrc = src.replace(/(:\/\/[^/]+\/+|\/gumroad-public-storage\/+)variants\/+([0-9a-z]{10,})\/+[0-9a-f]{30,}(?:[?#].*)?$/, "$1$2");
			if (newsrc !== src)
				return newsrc;

			// https://static-2.gumroad.com/res/gumroad/8674105889771/asset_previews/4329e193b99c3d981b7261d21ba18047/retina/IMG_2173.jpg
			//   https://static-2.gumroad.com/res/gumroad/8674105889771/asset_previews/4329e193b99c3d981b7261d21ba18047/original/IMG_2173.jpg
			return src.replace(/(\/res\/+gumroad\/+[0-9]+\/+asset_previews\/+[0-9a-f]{10,}\/+)[a-z]+\/+/, "$1original/");
		}

		if (domain === "cdn.sharesome.com" ||
			domain === "cache.sharesome.com") {
			// https://cdn.sharesome.com/uploads/user-images/u573858/yzijng-b5qtztc8rt-m.webp
			//   https://cdn.sharesome.com/uploads/user-images/u573858/yzijng-b5qtztc8rt.webp
			//   https://cdn.sharesome.com/uploads/user-images/u573858/yzijng-b5qtztc8rt-lg.webp
			// https://cache.sharesome.com/file/sharesome/uploads/user-images/u363341/yfhyz5-wudjo22ido-lg.webp -- 332x528 (not upscaled)
			// {
			// "code": "not_found",
			// "message": "bucket sharesome does not have file: uploads/user-images/u363341/yfhyz5-wudjo22ido-o.webp",
			// "status": 404
			// }
			// https://cdn.sharesome.com/uploads/user-images/u428903/cqm7sz-tc5oeldjlh-xl.jpg -- 720x1480 (smaller than lg)
			//   https://cdn.sharesome.com/uploads/user-images/u428903/cqm7sz-tc5oeldjlh-o.jpg -- 1440x2960 (upscaled tho?)
			// -o is also a possibility
			// https://cdn.sharesome.com/uploads/user-images/u199204/owzsd4-gc35hvy9do-o.jpg -- hugely upscaled?
			// not hugely upscaled:
			// https://cdn.sharesome.com/uploads/user-images/u99655/cbbozs-jkrgksha9z-lg.jpg -- 1256x1132
			//   https://cdn.sharesome.com/uploads/user-images/u99655/cbbozs-jkrgksha9z-o.jpg -- 1919x1730
			regex = /(\/uploads\/+user-images\/+u[0-9]+\/+[^-/.]+-[^-/.]+)(?:-[smlp]|-(?:lg|xl))?(\.[^/.]+)(?:[?#].*)?$/;

			if (regex.test(src)) {
				return [
					src.replace(regex, "$1-o$2"),
					src.replace(regex, "$1-lg$2")
				];
			}
		}

		if (domain === "media.sharesome.com") {
			// https://media.sharesome.com/11651-1552580919-164/thumb-11651-1552580919-164.mp4.png
			//   https://media.sharesome.com/11651-1552580919-164/11651-1552580919-164.mp4
			// https://media.sharesome.com/ilt3kv1kaz/thumb-ilt3kv1kaz.mp4.png
			//   https://media.sharesome.com/ilt3kv1kaz/ilt3kv1kaz.mp4
			newsrc = src.replace(/\/thumb-((?:[0-9]+-[0-9]+-[0-9]+|[^-/.]+)\.(?:mp4|webm))\.[^/.]+(?:[?#].*)?$/, "/$1");
			if (newsrc !== src)
				return {
					url: newsrc,
					video: true
				};
		}

		if (domain_nowww === "nsfwalbum.com" && /\/pic\/+loading\.gif(?:[?#].*)?$/.test(src)) {
			// https://nsfwalbum.com/pic/loading.gif
			return {
				url: src,
				bad: true
			};
		}

		if (domain_nowww === "luciecline.com") {
			// http://www.luciecline.com/cdn-content/20190321/horny-all-the-time/0001/thumbs/img002.jpg
			//   http://www.luciecline.com/cdn-content/20190321/horny-all-the-time/0001/img002.jpg
			return src.replace(/(\/cdn-content\/+[0-9]+\/+[^/]+\/+[0-9]+\/+)thumbs\/+img/, "$1img");
		}

		if (domain_nosub === "wankerson.com" && /^(?:thumbs|pics)\./.test(domain)) {
			// http://thumbs.wankerson.com/free-porn/cosplay/cosplay-erotic-cosplay-5c7b89ec5df6f-3.jpg
			//   http://pics.wankerson.com/free-porn/cosplay/cosplay-erotic-cosplay-5c7b89ec5df6f-3.jpg
			newsrc = src.replace(/:\/\/thumbs\./, "://pics.");
			if (newsrc !== src)
				return newsrc;

			match = src.match(/^[a-z]+:\/\/[^/]+\/+(free-porn\/+.+-[0-9a-f]{10,}-[0-9]+\.)/);
			if (match) {
				return {
					url: src,
					extra: {
						page: "http://www.wankerson.com/porn/" + match[1] + "html"
					}
				};
			}
		}


		if (domain === "thumbs.oldgf.com" ||
			// https://thumbs.jerkoffer.com/free-porn/downblouse/downblouse-nasty-pages-5c7b08dd20214-1.jpg
			//   https://pics.jerkoffer.com/free-porn/downblouse/downblouse-nasty-pages-5c7b08dd20214-1.jpg
			domain === "thumbs.jerkoffer.com") {
			// http://thumbs.oldgf.com/pornstars/sunny-leone/sunny-leone-70039.jpg
			//   http://pics.oldgf.com/pornstars/sunny-leone/sunny-leone-70039.jpg
			return src.replace(/:\/\/[^/]+\/+/, "://pics." + domain_nosub + "/");
		}

		if (domain_nowww === "meituyuan.com") {
			// http://meituyuan.com/data/share/2013/08/28/2057521df3c9b8003_m.jpg
			//   http://meituyuan.com/data/share/2013/08/28/2057521df3c9b8003.jpg
			return src.replace(/(\/data\/+share\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9a-f]{10,})_[smb](\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "dto9r5vaiz7bu.cloudfront.net") {
			// https://dto9r5vaiz7bu.cloudfront.net/rw50fzhfrrkwl/bug_council_thumbnail.png
			//   https://dto9r5vaiz7bu.cloudfront.net/rw50fzhfrrkwl/source.png -- 1920x1080
			return src.replace(/^([a-z]+:\/\/[^/]+\/+[0-9a-z]{10,}\/+)[_a-z]+(\.[^/.]+)(?:[?#].*)?$/, "$1source$2");
		}

		if (domain_nowww === "robertsspaceindustries.com") {
			// https://robertsspaceindustries.com/rsi/static/images/bg-med-lines.png
			// https://robertsspaceindustries.com/rsi/static/images/gridbg_glow.png
			if (/^[a-z]+:\/\/[^/]+\/+rsi\/+static\/+images\/+/.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}

			// https://robertsspaceindustries.com/media/2pqqtblh82ujhr/heap_infobox/Thecaptain2.png
			//   https://robertsspaceindustries.com/media/2pqqtblh82ujhr/source/Thecaptain2.png
			return src.replace(/(\/media\/+[0-9a-z]{10,}\/+)[_a-z]+\/+/, "$1source/");
		}

		if (domain === "d111vui60acwyt.cloudfront.net") {
			// https://d111vui60acwyt.cloudfront.net/stores/avatars/1160574/medium/tracer_12.jpg?1528303720
			//   https://d111vui60acwyt.cloudfront.net/stores/avatars/1160574/original/tracer_12.jpg?1528303720
			newsrc = src.replace(/(\/stores\/+avatars\/+[0-9]+\/+)[a-z]+\/+/, "$1original/");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nosub === "fireworktv.com" && /^cdn[0-9]*\./.test(domain)) {
			// https://cdn1.fireworktv.com/medias/2019/8/21/1566402222-ajgwnxcr/540_960/datauser0com.loopnow.kaminocacheFireworkDownloadez46ig4u2t0y.jpg
			//   https://cdn1.fireworktv.com/medias/2019/8/21/1566402222-ajgwnxcr/original/datauser0com.loopnow.kaminocacheFireworkDownloadez46ig4u2t0y.jpg
			return src.replace(/(\/medias\/+[0-9]{4}\/+(?:[0-9]{1,2}\/+){2}[^/]+\/+)[0-9]+_[0-9]+\/+/, "$1original/");
		}

		if (domain_nosub === "highwebmedia.com" && /^(?:ssl-)?ccstatic\./.test(domain) ||
			// https://static-assets.highwebmedia.com/tsdefaultassets/gender_tab_bg.gif
			// https://static-assets.highwebmedia.com/images/bg-body.gif?588dc80f5af1
			domain === "static-assets.highwebmedia.com") {
			// https://ssl-ccstatic.highwebmedia.com/tsdefaultassets/locked_rectangle4.png
			if (/\/tsdefaultassets\/+locked_rectangle[0-9]*\./.test(src) ||
				/\/tsdefaultassets\/+[^/.]+\.gif/.test(src) ||
				/\/images\/+bg-body\.gif/.test(src))
				return {
					url: src,
					bad: "mask"
				};
		}

		if (domain === "roomimg.stream.highwebmedia.com") {
			// thanks to anonymous for reporting
			match = src.match(/\/riw\/+([^/.?#]+)\.jpg/);
			if (match) {
				return {
					url: "https://cbjpeg.stream.highwebmedia.com/stream?room=" + match[1],
					can_head: false // 404
				};
			}
		}

		if (domain_nowww === "chaturbate.com") {
			// thanks to anonymous for reporting
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+([^/]+)\/*(?:[?#].*)?$/,
				query_for_id: "https://chaturbate.com/${id}/",
				process: function(done, resp, cache_key) {
					let match = resp.responseText.match(/initialRoomDossier\s*=\s*("[^"]+");/);
					if (match) {
						let parsed = JSON_parse(JSON_parse(match[1]));
						return done({
							url: parsed.hls_source,
							media_info: {
								type: "video",
								delivery: "hls",
								is_live: true
							}
						}, 60);
					}
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "extension.zone") {
			// http://www.extension.zone/wp-content/uploads/2017/01/rathernice-90x60@2x.jpg
			//   http://www.extension.zone/wp-content/uploads/2017/01/rathernice.jpg
			return src.replace(/(\/wp-content\/+uploads\/+.*)-[0-9]+x[0-9]+@[0-9]+x(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nosub === "infcdn.net" && /^art/.test(domain)) {
			// https://art-u2.infcdn.net/articles_uploads/4/4550/thumb/MacBookSortcuts2-300x.png
			//   https://art-u2.infcdn.net/articles_uploads/4/4550/MacBookSortcuts2.png
			return src.replace(/(\/articles_uploads\/+[0-9]\/+[0-9]+\/+)thumb\/+([^/.]+)-[0-9]*x[0-9]*(\.[^/.]+)(?:[?#].*)?$/, "$1$2$3");
		}

		if (domain === "d2bq4ntp986cty.cloudfront.net") {
			// https://d2bq4ntp986cty.cloudfront.net/2017/21/napeb9/asst7n.fn6jef.im.lg.jpg
			//   https://d2bq4ntp986cty.cloudfront.net/2017/21/napeb9/asst7n.fn6jef.im.jpg
			// https://d2bq4ntp986cty.cloudfront.net/2019/29/7fwx5f/m6cat9.tlt87t.fb.ms.jpg
			//   https://d2bq4ntp986cty.cloudfront.net/2019/29/7fwx5f/m6cat9.tlt87t.fb.jpg
			// other:
			// https://d2bq4ntp986cty.cloudfront.net/2019/13/24adz5/2j2jzw.9xkhtf.fb.jpg
			// https://d2bq4ntp986cty.cloudfront.net/2019/13/24adz5/pcse48.9xkhtf.im.jpg -- same as above
			return src.replace(/(\/[0-9]{4}\/+[0-9]+\/+[^/]+\/+[^/]+\.(?:im|fb))\.(?:lg|ms)(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "freehostedpics.com") {
			// https://www.freehostedpics.com/hg/arielrebel/hotpinktop_nn/thumbs/tnpics03.jpg
			//   https://www.freehostedpics.com/hg/arielrebel/hotpinktop_nn/pics03.jpg
			return src.replace(/\/thumbs\/+tnpics([0-9]+\.)/, "/pics$1");
		}

		if (domain_nowww === "erotopper.nl") {
			// http://erotopper.nl/babes/images/2016/621/th-digital-desire01.jpg
			//   http://erotopper.nl/babes/images/2016/621/digital-desire01.jpg
			newsrc = src.replace(/(\/images\/+[0-9]{4}\/+[0-9]+\/+)th-/, "$1");

			match = src.match(/:\/\/[^/]+\/+([^/]+)\/+images\/+[0-9]{4}\/+([0-9]+)\/+[^/]+\.[^/.]+(?:[?#].*)?$/);
			if (match) {
				return {
					url: newsrc,
					extra: {
						page: "http://erotopper.nl/" + match[1] + "/gallery.php?id=" + match[2]
					}
				};
			} else {
				return newsrc;
			}
		}

		if (domain_nosub === "litmind.com") {
			// https://www.litmind.com/data/photos/1/8/8/2400881.profile_non_retina.jpg
			//   https://www.litmind.com/data/photos/1/8/8/2400881.huge.jpg -- 2670x4000
			//   https://www.litmind.com/data/photos/1/8/8/2400881.thumbnail.jpg
			//   https://www.litmind.com/data/photos/1/8/8/2400881.list_premium.jpg
			// https://www.litmind.com/data/photos/1/5/1/2436151.thumbnail.jpg?v=1 -- 3408x2499
			//   https://www.litmind.com/data/photos/1/5/1/2436151.huge.jpg?v=1 -- 4000x2666
			// https://www.litmind.com/data/logos/2/8/8/73882.profile_non_retina.jpg?v=20191219014236
			//   https://www.litmind.com/data/logos/2/8/8/73882.profile.jpg?v=20191219014236
			return src
				.replace(/(\/data\/+photos\/+(?:[0-9]\/+){3}[0-9]+)\.(?:thumbnail|profile(_non_retina)?|big|list_premium)\./, "$1.huge.")
				.replace(/(\/data\/+logos\/+(?:[0-9]\/+){3}[0-9]+)\.profile_non_retina\./, "$1.profile.");
		}

		if (domain_nowww === "kabe-uchiroom.com") {
			// https://kabe-uchiroom.com/upfile_image/3222820136/mObJpuY1eZVk.jpg?w=260
			//   https://kabe-uchiroom.com/accounts/upfile/6/3222820136/mObJpuY1eZVk.jpg
			// https://kabe-uchiroom.com/upfile_image/2749335571/zoAdJ1FkCVx9.png?w=260
			//   https://kabe-uchiroom.com/upfile_image/2749335571/zoAdJ1FkCVx9.png
			//   https://kabe-uchiroom.com/accounts/upfile/1/2749335571/zoAdJ1FkCVx9.png
			return src
				.replace(/\/upfile_image\/+([0-9]+)([0-9])(\/+[^/?]+\.[^/.?]+)$/, "/accounts/upfile/$2/$1$2/$3")
				.replace(/(\/upfile_image\/.*?)(?:[?#].*)?$/, "$1");
		}

		if (domain_nowww === "mangadex.cc") {
			// https://mangadex.cc/images/manga/16069.thumb.jpg
			//   https://mangadex.cc/images/manga/16069.jpg
			// https://mangadex.cc/images/manga/12152.thumb.jpg
			//   https://mangadex.cc/images/manga/12152.jpeg
			newsrc = src.replace(/(\/images\/+manga\/+[0-9]+)\.thumb(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
			if (newsrc !== src)
				return add_extensions_jpeg(newsrc);

			match = src.match(/\/images\/+manga\/+([0-9]+)\./);
			if (match) {
				return {
					url: src,
					extra: {
						page: "https://mangadex.cc/title/" + match[1] + "/"
					}
				};
			}
		}

		if (domain_nowww === "ipetgroup.com") {
			// https://ipetgroup.com/photo/99349_0_620.jpeg
			//   https://ipetgroup.com/photo/original/110/5cfc4ac9dd7d53eb39cb9a3e98cb1d61_0.jpeg -- automatically redirected to this link when using a large enough size
			return src.replace(/(\/photo\/+[0-9]+_[0-9]+)_[0-9]+(\.[^/.]+)(?:[?#].*)?$/, "$1_99999999$2");
		}

		if (domain === "cdn.aarp.net") {
			// https://cdn.aarp.net/content/dam/aarp/money/scams_fraud/2019/12/1140-puppy-sad.imgcache.rev0ad3bc014bcf8eff941546fd6e8204eb.web.500.285.jpg
			//   https://cdn.aarp.net/content/dam/aarp/money/scams_fraud/2019/12/1140-puppy-sad.jpg
			// https://cdn.aarp.net/content/dam/aarp/money/scams_fraud/2019/12/1140-puppy-sad-esp.imgcache.rev5b1e8438ce7d3f951ee007f24421585c.web.jpg
			//   https://cdn.aarp.net/content/dam/aarp/money/scams_fraud/2019/12/1140-puppy-sad-esp.jpg
			return src.replace(/\.imgcache\.rev[0-9a-f]{20,}\.web(?:\.[0-9]+\.[0-9]+)?(\.[^/.]+)(?:[?#].*)?$/, "$1");
		}

		if (domain === "img.particlenews.com") {
			// https://img.particlenews.com/image.php?type=thumbnail_512x288&url=2uDX2N_0NUw5eQ200
			//   https://img.particlenews.com/image.php?url=2uDX2N_0NUw5eQ200
			if (/\/image\.php\?/.test(src))
				return remove_queries(src, ["type"]);
		}

		if (domain_nowww === "joy.pl") {
			// https://www.joy.pl/u/ic/T10/u/g/16/02/56d3b319.jpeg
			//   https://www.joy.pl/u/g/16/02/56d3b319.jpeg
			return src.replace(/\/u\/+ic\/+T[0-9]+\/+u\/+/, "/u/");
		}

		if (domain_nowww === "dynasty-scans.com") {
			// https://dynasty-scans.com/assets/clear-0df7f28079049374c4363cb5a9bbe8ca.gif
			// https://dynasty-scans.com/assets/next-0febfb08a2f1ae2a4c8d8efbac649799.png
			if (/\/assets\/+(?:prev|next|clear)-[0-9a-f]{20,}\.(?:png|gif)/.test(src))
				return {
					url: src,
					bad: "mask"
				};
		}

		// FoOlSlide
		if (domain === "reader.kireicake.com" ||
			// https://kobato.hologfx.com/reader/content/comics/new_game_56cda9c5d5fcd/thumb_001_a.png
			//   https://kobato.hologfx.com/reader/content/comics/new_game_56cda9c5d5fcd/001_a.png
			domain === "kobato.hologfx.com" ||
			// http://sensescans.com/reader/content/comics/kingdom_5736e592da0a7/thumb_kingdom.png
			//   http://sensescans.com/reader/content/comics/kingdom_5736e592da0a7/kingdom.png
			domain_nowww === "sensescans.com" ||
			// http://www.slide.world-three.org/content/comics/its_not_my_fault_that_im_not_popular_541384160b1d5/thumb_001.jpg
			//   http://www.slide.world-three.org/content/comics/its_not_my_fault_that_im_not_popular_541384160b1d5/001.jpg
			(domain_nosub === "world-three.org" && string_indexof(domain, "slide.") >= 0) ||
			// https://jaiminisbox.com/reader/content/comics/skeleton-soldier-couldn-t-protect-the-dungeon_5cb6fec258817/thumb_28778.png
			//   https://jaiminisbox.com/reader/content/comics/skeleton-soldier-couldn-t-protect-the-dungeon_5cb6fec258817/28778.png
			domain_nowww === "jaiminisbox.com") {
			// https://reader.kireicake.com/content/comics/the_unqualified_student_of_demon_lord_academy_the_strongest_demon_lord_in_history_the_founder_attends_the_school_of_his_descendants_after_reincarnation_5d9175deda282/thumb_student_cover.jpg
			//   https://reader.kireicake.com/content/comics/the_unqualified_student_of_demon_lord_academy_the_strongest_demon_lord_in_history_the_founder_attends_the_school_of_his_descendants_after_reincarnation_5d9175deda282/student_cover.jpg
			return src.replace(/(\/content\/+.*_[0-9a-f]{10,}\/)thumb_([^/]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "piczel.tv") {
			// https://piczel.tv/static/uploads/gallery_image/35085/image/22396/thumb_26214504-dudeunderscoreart.jpeg
			//   https://piczel.tv/static/uploads/gallery_image/35085/image/22396/26214504-dudeunderscoreart.jpeg
			newsrc = src.replace(/(\/static\/+uploads\/+gallery_image\/+[0-9]+\/+image\/+[0-9]+\/+)thumb_/, "$1");

			obj = {
				url: newsrc
			};

			match = src.match(/\/gallery_image\/+[0-9]+\/image\/+([0-9]+)\/+[^/]+(?:[?#].*)?$/);
			if (match) {
				obj.extra = {page: "https://piczel.tv/gallery/image/" + match[1]};
			}

			return obj;
		}

		if (domain === "cdn.9hentai.com") {
			// https://cdn.9hentai.com/images/54560/cover-small.jpg
			//   https://cdn.9hentai.com/images/54560/cover.jpg
			// https://cdn.9hentai.com/images/54560/preview/1t.jpg
			//   https://cdn.9hentai.com/images/54560/1.jpg
			newsrc = src
				.replace(/(\/images\/+[0-9]+\/+)cover-small\./, "$1cover.")
				.replace(/(\/images\/+[0-9]+\/+)preview\/+([0-9]+)t(\.[^/.]+)(?:[?#].*)?$/, "$1$2$3");

			obj = {
				url: newsrc
			};

			match = src.match(/\/images\/+([0-9]+)\/+(?:cover|(?:preview\/+)?([0-9]+)t?\.)/);
			if (match) {
				obj.extra = {page: "https://9hentai.com/g/" + match[1] + "/" + (match[2] ? match[2] + "/" : "")};
			}

			return obj;
		}

		if (domain_nowww === "hentaishark.com") {
			// https://www.hentaishark.com/uploads/manga/283710/chapters/1/thumb_00001.jpg
			//   https://www.hentaishark.com/uploads/manga/283710/chapters/1/00001.jpg
			newsrc = src.replace(/(\/uploads\/+manga\/+[0-9]+\/+chapters\/+[0-9]+\/+)thumb_/, "$1");

			obj = {
				url: newsrc
			};

			match = src.match(/\/uploads\/+(manga)\/+([0-9]+)\/+chapters\/+([0-9]+)\/+(?:thumb_)?([0-9]+)\./);
			if (match) {
				let type = match[1];
				let typeid = match[2];
				let chapter = match[3];
				let page = parseInt(match[4]);

				obj.extra = {page: "https://www.hentaishark.com/" + type + "/" + typeid + "/" + chapter + "/" + page};
			}

			return obj;
		}

		if (domain === "i.hentaihand.com") {
			// https://i.hentaihand.com/comicsimages/kabukichou-daishuukai-25-kome-kyuujuu-kobaji-hotobori-gintama-english-1571521166/images/1t.jpg
			//   https://i.hentaihand.com/comicsimages/kabukichou-daishuukai-25-kome-kyuujuu-kobaji-hotobori-gintama-english-1571521166/images/full/1.jpg
			return src.replace(/(\/images\/+)([0-9]+)t(\.[^/.]+)(?:[?#].*)?$/, "$1full/$2$3");
		}

		if (domain_nosub === "sh-cdn.com") {
			// https://is1.sh-cdn.com/images/1/6/b/1/79509/thumb_916384ad.jpg
			//   https://is1.sh-cdn.com/images/1/6/b/1/79509/giant_thumb_916384ad.jpg
			//   https://is1.sh-cdn.com/images/1/6/b/1/79509/916384ad.jpg
			return src.replace(/(\/images\/+(?:[0-9a-f]\/+){4}[0-9]+\/+)(?:giant_)?thumb_([0-9a-f]+\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "static.showit.co") {
			// https://static.showit.co/200/A8ShtUACQF2MLeQacAvjlQ/81710/watercolor-artist-lifestyle-personal-branding-headshots-photography-session-nashville-photographers_3.jpg
			//   https://static.showit.co/99999999/A8ShtUACQF2MLeQacAvjlQ/81710/watercolor-artist-lifestyle-personal-branding-headshots-photography-session-nashville-photographers_3.jpg
			return src.replace(/(:\/\/[^/]+\/+)[0-9]+(\/+[^/]+\/+[0-9]+\/+)/, "$199999999$2");
		}

		if (domain === "d33veqcui7lu1w.cloudfront.net" ||
			// https://wasabi-files.lbstatic.nu/files/looks/medium/2021/03/03/5493109_C3C94392-5088-4F85-B80B-D2C2B1D7D64D.jpg
			//   https://wasabi-files.lbstatic.nu/files/looks/large/2021/03/03/5493109_C3C94392-5088-4F85-B80B-D2C2B1D7D64D.jpg
			domain_nowww === "wasabi-files.lbstatic.nu") {
			// https://lookbook.nu/market/items/195-mixed-pearls-gold-chains-halter-bra-chest-piece
			// https://d33veqcui7lu1w.cloudfront.net/files/neo_items/small_square/2014/06/11/205_DSC_0119.jpg
			//   https://d33veqcui7lu1w.cloudfront.net/files/neo_items/large/2014/06/11/205_DSC_0119.jpg
			//   https://d33veqcui7lu1w.cloudfront.net/files/neo_items/original/2014/06/11/205_DSC_0119.jpg
			// http://d33veqcui7lu1w.cloudfront.net/files/looks/medium/2014/01/30/3535656_SAM_3797.jpg?1391061481
			//   http://d33veqcui7lu1w.cloudfront.net/files/looks/large/2014/01/30/3535656_SAM_3797.jpg?1391061481
			//   http://d33veqcui7lu1w.cloudfront.net/files/looks/original/2014/01/30/3535656_SAM_3797.jpg?1391061481 -- doesn't work
			//   http://d33veqcui7lu1w.cloudfront.net/files/neo_items/large/2014/01/30/3535656_SAM_3797.jpg?1391061481 -- doesn't work
			regex = /(\/files\/+[^/]+\/+)[a-z_]+\/+/;
			if (regex.test(src)) {
				return [
					src.replace(regex, "$1original/"),
					src.replace(regex, "$1large/")
				];
			}
		}

		if (domain_nosub === "ymcart.com" && string_indexof(domain, "imgcdn.") >= 0) {
			// https://us03-imgcdn.ymcart.com/46175/thumb/60x60/2019/07/10/5/5/55c5d2e0f9fd06d6.jpg
			//   https://us03-imgcdn.ymcart.com/46175/2019/07/10/5/5/55c5d2e0f9fd06d6.jpg
			return src.replace(/\/([0-9]+)\/+thumb\/+[0-9]+x[0-9]+\/+/, "/$1/");
		}

		if (domain === "cdn.neow.in") {
			// https://cdn.neow.in/news/images/uploaded/2020/01/1578531519_w16_small.jpg
			//   https://cdn.neow.in/news/images/uploaded/2020/01/1578531519_w16_story.jpg
			//   https://cdn.neow.in/news/images/uploaded/2020/01/1578531519_w16.jpg
			return src.replace(/(\/images\/+uploaded\/+[0-9]{4}\/+[0-9]{2}\/+[^/]+)_(?:story|small)(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "gamereactor.no") {
			// https://www.gamereactor.no/media/35/_2003593_118x87.jpg
			//   https://www.gamereactor.no/media/35/_2003593t.jpg
			//   https://www.gamereactor.no/media/35/_2003593.jpg
			// https://www.gamereactor.no/media/79/grandtheftauto_77929t.jpg
			//   https://www.gamereactor.no/media/79/grandtheftauto_77929.jpg
			return src.replace(/(\/media\/+[0-9]+\/+[^/]*_[0-9]+)(?:t|_[0-9]+x[0-9]+)(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "fullyimportant.ru") {
			// https://fullyimportant.ru/thumbs/62801_1.jpeg
			//   https://fullyimportant.ru/cdn/1/62801.jpeg
			return src.replace(/\/thumbs\/+([0-9]+)_([0-9]+)(\.[^/.]+)(?:[?#].*)?$/, "/cdn/$2/$1$3");
		}

		if (domain === "az879543.vo.msecnd.net") {
			// should we keep this? seems rather haphazard

			// unhandled:
			// http://az879543.vo.msecnd.net/twice/DJAt0BvVwAEUIsG-orig-009.jpg
			//   http://az879543.vo.msecnd.net/twice/DJAt0BvVwAEUIsG-orig.jpg
			// https://az879543.vo.msecnd.net/twice/C8eo1szUMAE18pd-orig(1).jpg
			//   https://az879543.vo.msecnd.net/twice/C8eo1szUMAE18pd-orig.jpg

			// https://az879543.vo.msecnd.net/twice/21_20190422_s.jpg
			//   https://az879543.vo.msecnd.net/twice/21_20190422.jpg
			newsrc = src.replace(/(:\/\/[^/]+\/+[a-z]+\/+[^/]+)_s(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
			if (newsrc !== src)
				return newsrc;

			// https://az879543.vo.msecnd.net/twice/IMG_9046_.jpg
			//   https://az879543.vo.msecnd.net/twice/IMG_9046.JPG
			// https://az879543.vo.msecnd.net/twice/2-2_.jpg
			//   https://az879543.vo.msecnd.net/twice/2-2.jpg
			// https://az879543.vo.msecnd.net/twice/%ED%81%AC%EA%B8%B0%EB%B3%80%ED%99%98_IMG_7019_.jpg
			//   https://az879543.vo.msecnd.net/twice/IMG_7019.JPG
			// https://az879543.vo.msecnd.net/twice/%ED%81%AC%EA%B8%B0%EB%B3%80%ED%99%98_IMG_7048_(1).jpg
			//   https://az879543.vo.msecnd.net/twice/IMG_7048.JPG
			newsrc = src.replace(/(:\/\/[^/]+\/+[a-z]+\/+)(?:%ED%81%AC%EA%B8%B0%EB%B3%80%ED%99%98_|크기변환_)?([^/]+)_(?:\(1\))?(\.[^/.]+)(?:[?#].*)?$/, "$1$2$3");
			if (newsrc !== src)
				return add_extensions_upper(newsrc);
		}

		if (domain === "static-buyma-com.akamaized.net") {
			// https://static-buyma-com.akamaized.net/imgdata/item/171123/0032783382/129092058/090.jpg
			//   https://static-buyma-com.akamaized.net/imgdata/item/171123/0032783382/129092058/428.jpg
			//   https://static-buyma-com.akamaized.net/imgdata/item/171123/0032783382/129092058/org.jpg
			return src.replace(/(\/imgdata\/+item\/+[0-9]+\/+[0-9]+\/+[0-9]+\/+)[0-9]+(\.[^/.]+)(?:[?#].*)?$/, "$1org$2");
		}

		if (domain === "images.spoilertv.com") {
			// https://images.spoilertv.com/cache/ncis-los-angeles/Season%209/Promotional%20Episode%20Photos/Episode%209.09%20-%20Fool%20Me%20Twice/111215_0221b_180_cw180_ch180_thumb.jpg
			//   https://images.spoilertv.com/cache/ncis-los-angeles/Season%209/Promotional%20Episode%20Photos/Episode%209.09%20-%20Fool%20Me%20Twice/111215_0221b_FULL.jpg
			return src.replace(/(\/cache\/+.*\/[^/]+)_[0-9]+_cw[0-9]+_ch[0-9]+_thumb\./, "$1_FULL.");
		}

		if (domain_nosub === "itc.cn" && string_indexof(domain, ".biz.") >= 0) {
			// http://m3.biz.itc.cn/pic/new/s/74/87/Img8788774_s.jpg
			//   http://m3.biz.itc.cn/pic/new/f/74/87/Img8788774_f.jpg
			return src.replace(/(\/pic\/+[^/]+\/+)[sn](\/+(?:[0-9]{2}\/+){2}Img[0-9]+)_[sn](\.[^/.]+)(?:[?#].*)?$/, "$1f$2_f$3");
		}

		if (domain === "photo.isportskorea.com") {
			// http://photo.isportskorea.com/photo/thumbnail/2013/07/20130724184654274.jpg
			//   http://photo.isportskorea.com/photo/images/2013/07/20130724184654274.jpg
			newsrc = src.replace(/(\/photo\/+)thumbnail(\/+[0-9]{4}\/+[0-9]{2}\/+[0-9]+\.[^/.]+)(?:[?#].*)?$/, "$1images$2");
			obj = {
				url: newsrc
			};

			match = src.match(/\/photo\/+[^/]+\/+[0-9]{4}\/+[0-9]{2}\/+([0-9]+)\./);
			if (match) {
				obj.extra = {page: "http://www.isportskorea.com/mstory/?mode=view&no=" + match[1]};
			}

			return obj;
		}

		if (domain === "edc2.healthtap.com") {
			// https://edc2.healthtap.com/ht-staging/user_answer/reference_image/16764/large/78025379.jpeg?1386670285
			//   https://edc2.healthtap.com/ht-staging/user_answer/reference_image/16764/original/78025379.jpg
			// https://edc2.healthtap.com/ht-staging/user_answer/reference_image/59410/topic_large/Jennifer_Dufek_-_iStock-145849205.jpeg
			//   https://edc2.healthtap.com/ht-staging/user_answer/reference_image/59410/original/Jennifer_Dufek_-_iStock-145849205.jpg
			// https://edc2.healthtap.com/ht-staging/user_answer/reference_image/14349/xx_normal/allergies.jpeg?1386670866
			//   https://edc2.healthtap.com/ht-staging/user_answer/reference_image/14349/original/allergies.jpg
			// https://edc2.healthtap.com/ht-staging/user_answer/reference_image/5396/x_medium/Itch.jpeg?1386670743
			//   https://edc2.healthtap.com/ht-staging/user_answer/reference_image/5396/large/Itch.jpeg?1386670743
			//   https://edc2.healthtap.com/ht-staging/user_answer/reference_image/5396/topic_large/Itch.jpeg?1386670743 -- upscaled?
			//   https://edc2.healthtap.com/ht-staging/user_answer/reference_image/5396/original/Itch.jpg -- doesn't work
			// https://edc2.healthtap.com/ht-staging/user_answer/reference_image/3227/xx_normal/medication.jpeg?1386670144
			//   https://edc2.healthtap.com/ht-staging/user_answer/reference_image/3227/topic_large/medication.jpeg?1386670144
			// doesn't work for all:
			// https://edc2.healthtap.com/ht-staging/user_answer/avatars/365861/original/open-uri20120820-16677-1ct8q0j.jpeg?1386596719
			//   https://edc2.healthtap.com/ht-staging/user_answer/avatars/365861/topic_large/open-uri20120820-16677-1ct8q0j.jpeg?1386596719
			//   https://edc2.healthtap.com/ht-staging/user_answer/avatars/365861/original/open-uri20120820-16677-1ct8q0j.jpg
			return src
				.replace(/(\/user_answer\/+[^/]+\/+[0-9]+\/+)topic_large(\/+[^/]+)\.jpeg(?:[?#].*)?$/, "$1original$2.jpg")
				.replace(/(\/user_answer\/+[^/]+\/+[0-9]+\/+)(?:(?:topic|xx?)_)?(?:medium|normal|large)(\/+[^/]+\.[^/.]+)(?:[?#].*)?$/, "$1topic_large$2");
		}

		if (domain_nowww === "bomz.org") {
			// http://bomz.org/i/bomz/thumb_55168_2011.11.17_bomz.org_ssl1uiphwq0006.jpg
			//   http://bomz.org/i/bomz/55168_2011.11.17_bomz.org_ssl1uiphwq0006.jpg
			return src.replace(/(\/i\/+[^/]+\/+)thumb_([^/]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "gtainside.com") {
			// https://www.gtainside.com/includes/lightbox2/img/next.png
			if (/\/includes\/+lightbox2\/+img\//.test(src))
				return {
					url: src,
					bad: "mask"
				};

			// https://www.gtainside.com/downloads/picr/2017-06/thb_1497924934_enb%202017_06_18%2017_05_43_28.jpg
			//   https://www.gtainside.com/downloads/picr/2017-06/1497924934_enb%202017_06_18%2017_05_43_28.jpg
			return src.replace(/(\/downloads\/+picr\/+[0-9]{4}-[0-9]{2}\/+)thb_/, "$1");
		}

		if (domain_nowww === "gta.cz") {
			// https://www.gta.cz/download/image.php?soubor=2peds-rar&thumb=1&language=en
			//   https://www.gta.cz/download/image.php?soubor=2peds-rar&language=en
			if (/\/download\/+image\.php\?/.test(src)) {
				return remove_queries(src, ["thumb"]);
			}
		}

		if (domain_nowww === "feralinteractive.com") {
			// https://www.feralinteractive.com/images/games/bottom-frame.svg
			if (/\/images\/+games\/+bottom-frame\./.test(src))
				return {
					url: src,
					bad: "mask"
				};

			// https://www.feralinteractive.com/data/games/deusexmd/images/features/screenshots/thumbs/thumb1.jpg
			//   https://www.feralinteractive.com/data/games/deusexmd/images/features/screenshots/screen1.jpg
			return src.replace(/(\/screenshots\/+)thumbs\/+thumb([0-9]+\.[^/.]+)(?:[?#].*)?$/, "$1screen$2");
		}

		if (domain === "store.feralinteractive.com") {
			// https://store.feralinteractive.com/images/screenshots/threekingdomstwdlcaworldbetrayed/thumbs/screen2.jpg
			//   https://store.feralinteractive.com/images/screenshots/threekingdomstwdlcaworldbetrayed/screen2.jpg
			newsrc = src.replace(/(\/screenshots\/+[^/]+\/+)thumbs\/+(screen[0-9]+\.[^/.]+)(?:[?#].*)?$/, "$1$2");
			if (newsrc !== src)
				return newsrc;

			// https://store.feralinteractive.com/images/icons/180/riseofthetombraider.png
			//   https://store.feralinteractive.com/images/icons/360/riseofthetombraider.png
			// https://store.feralinteractive.com/images/icons/360/shadowofthetombraider.png -- upscaled
			return src.replace(/(\/images\/+icons\/+)(?:100|140|165|180)\/+/, "$1360/");
		}

		if (domain_nosub === "nsimg.net") {
			// https://m1.nsimg.net/biopic/160x120/50404138
			//   https://m1.nsimg.net/biopic/original4x3/50404138
			// https://m2.nsimg.net/biopic/320x240/41823401
			//   https://m2.nsimg.net/biopic/original4x3/41823401
			// http://m1.nsimg.net/biopic/200x150/81562362
			//   http://m1.nsimg.net/biopic/original4x3/81562362
			// https://m2.nsimg.net/biopic/240x180/19899373
			//   https://m2.nsimg.net/biopic/original4x3/19899373
			return src.replace(/(\/biopic\/+)(?:160x120|320x240|200x150|240x180)\/+/, "$1original4x3/");
		}

		if (domain === "photo.naiadmmm.com") {
			// https://photo.naiadmmm.com/fast_photo.php?type=thumbnail&hash=b362528fd4b1f26b6d1968e61235317729eb040553ed6d408c787a8a04140fbc6b4fdbbe6a91caf212cd31803f5b07a9ed681e94ad7c4754f82f6e02ba114599
			//   https://photo.naiadmmm.com/fast_photo.php?type=photo&hash=b362528fd4b1f26b6d1968e61235317729eb040553ed6d408c787a8a04140fbc6b4fdbbe6a91caf212cd31803f5b07a9ed681e94ad7c4754f82f6e02ba114599
			return src.replace(/(\/fast_photo\.php\?)(.*&)?type=thumbnail/, "$1$2type=photo");
		}

		if (domain === "prodimage.images-bn.com") {
			// http://prodimage.images-bn.com/pimages/0786936850291_p0_v1_s118x184.jpg
			//   http://prodimage.images-bn.com/pimages/0786936850291_p0_v1_s1200x630.jpg -- 352x496
			newsrc = src.replace(/_s[0-9]{3}x[0-9]{3}\./, "_s1200x630.");
			if (newsrc !== src) return newsrc;

			// http://prodimage.images-bn.com/pimages/9780739052204.jpg
			return {
				url: src,
				headers: {
					Referer: ""
				},
				can_head: false // doesn't return errors
			}
		}

		if (domain_nowww === "twitpic.com") {
			// https://twitpic.com/96mhds
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+([0-9a-z]+)(?:[?#].*)?$/,
				query_for_id: "https://twitpic.com/${id}",
				process: function(done, resp, cache_key) {
					var url = get_meta(resp.responseText, "twitter:image");
					if (!url) {
						console_error(cache_key, "Unable to find url for", resp);
					}

					var obj:BigImageInfoSObject = {
						url: url,
						extra: {
							page: resp.finalUrl
						}
					};

					var title = get_meta(resp.responseText, "twitter:title");
					if (title) {
						obj.extra.caption = title;
					}

					return done(obj, 60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "dn3pm25xmtlyu.cloudfront.net") {
			// https://dn3pm25xmtlyu.cloudfront.net/photos/thumb/555322240.gif?1333773919&Expires=1480264803&Signature=FfWz5yprJzJPkKnGj1PniS28A3cEc6CPohd8u2xWu013k71zXIczP~lXauNR7QbU583vN1VLGOw1y3vCjlIm~nsibhW-~FeJtQYxXnAGQz8eCm3B95s0yOp6wczpQbAS43bgiirrro8zct9K37Xsvuljl6P8fyTs4fk6GeaCLkw_&Key-Pair-Id=APKAIYVGSUJFNRFZBBTA
			match = src.match(/\/photos\/+[a-z]+\/+([0-9]+)\./);
			if (match) {
				var get_twitpic_page_from_id = function(id) {
					return "https://twitpic.com/" + parseInt(id).toString(36);
				};

				id = match[1];

				obj = {
					url: src,
					extra: { page: get_twitpic_page_from_id(id) },
				};

				return [{
					url: obj.extra.page,
					is_pagelink: true
				}, obj];
			}
		}

		if (domain === "media-ima002.globaltalentsystems.com") {
			// http://media-ima002.globaltalentsystems.com/25255/500/25255_000-6-13-2018-1311607066.jpg
			//   https://s3.amazonaws.com/media-ima002.globaltalentsystems.com/25255/500/25255_000-6-13-2018-1311607066.jpg
			return src.replace(/^[a-z]+:\/\/([^/]+)\/+/, "https://s3.amazonaws.com/$1/");
		}

		if (amazon_container === "media-ima002.globaltalentsystems.com") {
			// http://s3.amazonaws.com/media-ima002.globaltalentsystems.com/15950/500/15950_000-9-30-2014-18703.jpg
			//   http://s3.amazonaws.com/media-joined000.globaltalentsystems.com/2/15950/15950_000-9-30-2014-18703.jpg
			//   https://www.globaltalentsystems.com/main/15950/15950_000-9-30-2014-18703.jpg -- doesn't work
			// doesn't work for all:
			// http://media-ima002.globaltalentsystems.com/25255/500/25255_000-6-13-2018-1311607066.jpg
			//   http://www.globaltalentsystems.com/main/25255/25255_000-6-13-2018-1311607066.jpg
			return [
				src.replace(/.*\/media-ima002\.[^/]+\/+([0-9]+)\/+[0-9]+\/+([0-9]+_[^/]+\.[^/.]+)(?:[?#].*)?$/, "https://www.globaltalentsystems.com/main/$1/$2"),
				src.replace(/\/media-ima002\.([^/]+)\/+([0-9]+)\/+[0-9]+\/+([0-9]+_[^/]+\.[^/.]+)(?:[?#].*)?$/, "/media-joined000.$1/2/$2/$3")
			];
		}

		if (domain_nosub === "rbk.ru" && /^s[0-9]*\./.test(domain)) {
			// https://s0.rbk.ru/v6_top_pics/resized/240x120_crop/media/img/7/22/754823926108227.jpg
			//   https://s0.rbk.ru/v6_top_pics/media/img/7/22/754823926108227.jpg
			// https://s0.rbk.ru/v6_top_pics/resized/590xH/media/img/7/22/754823926108227.jpg
			//   https://s0.rbk.ru/v6_top_pics/media/img/7/22/754823926108227.jpg
			return src.replace(/\/resized\/+[0-9W]+x[0-9H]+(?:_crop)?\/+media\/+/, "/media/");
		}

		if (domain_nowww === "kazanfirst.ru") {
			// https://kazanfirst.ru/storage//post/August2017/X4rnjf58m2uhD2nIjv90-watermark.jpg
			//   https://kazanfirst.ru/storage//post/August2017/X4rnjf58m2uhD2nIjv90.jpg
			return src.replace(/(\/storage\/+post\/+[^/]+\/+[^/]+)-watermark(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "vgtour.ro") {
			// http://www.vgtour.ro/media/poze/unitati/65/thumbs/cazare-bulgaria-sozopol-hotel-selena-beach-e56.jpg
			newsrc = src.replace(/(\/media\/+poze\/+[^/]+\/+[^/]+\/+)thumbs\/+/, "$1");
			if (newsrc !== src)
				return newsrc;

			// http://www.vgtour.ro/watermark.php?source=unitati&id=65&nume=cazare-bulgaria-sozopol-hotel-selena-beach-e56.jpg
			//   http://www.vgtour.ro/media/poze/unitati/65/cazare-bulgaria-sozopol-hotel-selena-beach-e56.jpg
			if (/\/watermark\.php\?/.test(src)) {
				var queries = get_queries(src);
				return src.replace(/\/watermark\.php.*/, "/media/poze/" + queries.source + "/" + queries.id + "/" + queries.nume);
			}
		}

		if (domain_nowww === "maiolifruttiantichi.it") {
			// http://www.maiolifruttiantichi.it/upload/e-commerce/prodotti/img/watermark/20171025143303-Mela-Selena.jpg
			//   http://www.maiolifruttiantichi.it/upload/e-commerce/prodotti/img/20171025143303-Mela-Selena.jpg
			return src.replace(/(\/e-commerce\/+prodotti\/+img\/+)watermark\/+/, "$1");
		}

		if (domain === "photo.jpnn.com") {
			// https://photo.jpnn.com/arsip/watermark/2018/07/24/lisa-blackpink-foto-soompi.jpg
			//   https://photo.jpnn.com/arsip/normal/2018/07/24/lisa-blackpink-foto-soompi.jpg
			return src.replace(/\/arsip\/+watermark\/+/, "/arsip/normal/");
		}

		if (domain_nowww === "posterswholesale.com") {
			// http://www.posterswholesale.com/resize/Shared/Images/Product/Blackpink/53265.jpg?bw=1000&w=100&bh=1000&h=100
			//   http://www.posterswholesale.com/shared/Images/Product/Blackpink/53265.jpg
			return src.replace(/\/resize\/+(Shared\/+.*?)(?:[?#].*)?$/i, "/$1");
		}

		if (domain === "images.summitmedia-digital.com") {
			// https://images.summitmedia-digital.com/cosmo/resize/large/images/2020/01/06/blackpink-lisa-manoban-idol-producer-dance-mentor-1578274791.png
			//   https://images.summitmedia-digital.com/cosmo/images/2020/01/06/blackpink-lisa-manoban-idol-producer-dance-mentor-1578274791.png
			return src.replace(/\/resize\/+[^/]+\/+(images\/+)/, "/$1");
		}

		if ((domain_nosub === "hiclipart.com" ||
			 // https://w0.pngwave.com/png/272/404/park-chaeyoung-blackpink-house-k-pop-square-one-kpop-png-clip-art-thumbnail.png
			 //   https://w0.pngwave.com/png/272/404/park-chaeyoung-blackpink-house-k-pop-square-one-kpop-png-clip-art.png
			 domain_nosub === "pngwave.com" ||
			 // https://i1.pngguru.com/preview/431/523/793/rose-blackpink-180622-woman-holding-microphone-thumbnail.jpg
			 //   https://i1.pngguru.com/preview/431/523/793/rose-blackpink-180622-woman-holding-microphone.jpg
			 domain_nosub === "pngguru.com" ||
			 // https://f0.pngfuel.com/png/38/972/woman-in-black-cardigan-jennie-kim-blackpink-inkigayo-k-pop-girl-group-blackpink-jennie-png-clip-art-thumbnail.png
			 //   https://f0.pngfuel.com/png/38/972/woman-in-black-cardigan-jennie-kim-blackpink-inkigayo-k-pop-girl-group-blackpink-jennie-png-clip-art.png
			 // https://f1.pngfuel.com/png/154/201/248/park-sandara-park-south-korea-kpop-gotta-be-you-girl-group-blackpink-artist-png-clip-art-thumbnail.png
			 //   https://f1.pngfuel.com/png/154/201/248/park-sandara-park-south-korea-kpop-gotta-be-you-girl-group-blackpink-artist-png-clip-art.png
			 domain_nosub === "pngfuel.com")
			&& /^[a-z][0-9]*\./.test(domain)) {
			// https://p7.hiclipart.com/preview/1024/526/554/stock-photography-royalty-free-woman-surprised-girl-thumbnail.jpg
			//   https://p7.hiclipart.com/preview/1024/526/554/stock-photography-royalty-free-woman-surprised-girl.jpg
			return src.replace(/((?:\/preview\/+(?:[0-9]+\/+){3}|\/png\/+(?:[0-9]+\/+){2,3})[^/]+)-thumbnail(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "aerisdies.com") {
			// http://www.aerisdies.com/thumbnails/categories/4667/497590.gif
			//   http://www.aerisdies.com/images/categories/4667/497590.png
			newsrc = src.replace(/\/thumbnails(\/+categories\/+[0-9]+\/+[0-9]+\.)gif(?:[?#].*)?$/, "/images$1png");
			if (newsrc !== src)
				return add_extensions_gif(newsrc);
		}

		if (domain_nowww === "erofus.com") {
			// https://www.erofus.com/thumb/7110/5953af5adb0f86102866028.jpeg
			//   https://www.erofus.com/medium/7110/5953af5adb0f86102866028.jpeg
			return src.replace(/\/thumb(\/+[0-9]+\/+[0-9a-f]+\.)/, "/medium$1");
		}

		if (domain_nosub === "hentaicdn.com") {
			// https://hentaicdn.com/hentai/15652/1/thumbnails/hcdn0001tmb.jpg
			//   https://hentaicdn.com/hentai/15652/1/hcdn0001.jpg
			// https://img2.hentaicdn.com/hentai/cover/42/_S15652.jpg
			//   https://img2.hentaicdn.com/hentai/cover/_S15652.jpg
			return src
				.replace(/\/thumbnails\/+(hcdn[0-9]+)tmb(\.[^/.]+)(?:[?#].*)?$/, "/$1$2")
				.replace(/\/cover\/+[0-9]+\/+_S/, "/cover/_S");
		}

		if (domain_nowww === "hentaidude.com") {
			// https://hentaidude.com/wp-content/themes/awp/images/icon-play.png
			if (/\/wp-content\/+themes\/+awp\/+images\//.test(src))
				return {
					url: src,
					bad: "mask"
				};
		}

		if (domain_nowww === "theonemilano.com") {
			// thanks to cbadoud on github: https://github.com/qsniyg/maxurl/issues/203#issuecomment-578967505
			// https://www.theonemilano.com/wp-content/themes/the-one-milano-2017-brands/images/slide-prev.png
			if (/\/wp-content\/+themes\/+[^/]+\/+images\/+/.test(src))
				return {
					url: src,
					bad: "mask"
				};
		}

		if (domain_nowww === "jabarchives.com") {
			// http://jabarchives.com/main/media/2016images/images_Feb28th2016/FJDE145671683658162233561_thumb.jpg
			//   http://jabarchives.com/main/media/2016images/images_Feb28th2016/FJDE145671683658162233561_large.jpg
			obj = {
				url: src
			};

			match = src.match(/\/main\/+media\/+.*\/([A-Z0-9]{10,})1(?:_[a-z]+)\./);
			if (match)
				obj.extra = {page: "https://jabarchives.com/main/post/" + match[1]};

			newsrc = src.replace(/(\/main\/+media\/+.*)_(?:thumb|preview)\./, "$1_large.");
			if (newsrc !== src)
				obj.url = newsrc;

			return obj;
		}

		if (domain === "images.myhentaigrid.com") {
			// https://images.myhentaigrid.com/imagesgallery/images/Adventure%20Of%20My%20Dreams/thumbnail/001.jpg?20
			//   https://images.myhentaigrid.com/imagesgallery/images/Adventure%20Of%20My%20Dreams/original/001.jpg?20
			return src.replace(/(\/imagesgallery\/+images\/+[^/]+\/+)thumbnail\/+/, "$1original/");
		}

		if (domain_nowww === "tsumino.com") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+Read\/+Index\/+([0-9]+)(?:[?#].*)?$/,
				query_for_id: "https://www.tsumino.com/Read/Index/${id}",
				override_cb: function(cb, data) {
					var page:string|number = 1;
					var queries = get_queries(src);
					if (queries.page) page = queries.page + "";

					common_functions["update_album_info_links"](data, function(x) {
						var match = x.match(/\/[0-9]+\/+([0-9]+)\?/);
						if (!match) {
							console_warn("Unable to find page match");
							return false;
						}

						// == for string/int
						return match[1] == page;
					});

					cb(data);
				},
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/<div[^>]+data-cdn=["'](https:\/\/content\.tsumino[^'"]+\/\[PAGE\][^'"]+)["']/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					var baseurl = decode_entities(match[1]);

					match = resp.responseText.match(/<h1[^>]*>\s*Page\s*<span.*?\/span>\s*of\s+([0-9]+)\s*<\/h1>/);
					if (!match) {
						console_error(cache_key, "Unable to find total pages from", resp);
						return done(null, false);
					}

					var pagecount = match[1];

					var album_info = {
						type: "links",
						links: []
					};

					for (var i = 0; i < pagecount; i++) {
						album_info.links.push({
							url: baseurl.replace("[PAGE]", i + 1),
							is_current: false
						});
					}

					done({
						url: album_info.links[0].url,
						album_info: album_info,
						headers: {
							Referer: resp.finalUrl
						},
						extra: {
							page: resp.finalUrl
						}
					}, 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "content.tsumino.com") {
			// https://content.tsumino.com/thumbs/48158/2
			// https://content.tsumino.com/parts/48158/1?key=...
			match = src.match(/\/(?:thumbs|parts)\/+([0-9]+)\/+([0-9]+)(?:[?#].*)?$/);
			if (match) {
				return {
					url: "https://www.tsumino.com/Read/Index/" + match[1] + "?page=" + match[2],
					is_pagelink: true
				};
			}
		}

		if (domain_nowww === "2dgalleries.com") {
			// https://www.2dgalleries.com/planches/200H/2019/301/burns-out-of-the-blue-2sgb.jpg
			//   https://www.2dgalleries.com/planches/2019/301/burns-out-of-the-blue-2sgb.jpg
			return src.replace(/\/planches\/+[0-9]+[WH]\/+/, "/planches/");
		}

		if (domain === "img.tamindir.com") {
			// https://img.tamindir.com/resize/300x152/2020/01/472810/airbnb-ile-yeni-romeo-ve-juliet-siz-olabilirsiniz.jpg
			//   https://img.tamindir.com/2020/01/472810/airbnb-ile-yeni-romeo-ve-juliet-siz-olabilirsiniz.jpg
			return src.replace(/\/resize\/+[0-9]+x[0-9]+\/+([0-9]{4}\/+)/, "/$1");
		}

		if (domain === "data.yiff.party") {
			// https://data.yiff.party/avatars/patreon/thumb/6514828.jpg
			//   https://data.yiff.party/avatars/patreon/full/6514828.jpg
			newsrc = src.replace(/(\/avatars\/+[^/]+\/+)thumb\/+/, "$1full/");
			if (newsrc !== src)
				return newsrc;

			// https://data.yiff.party/patreon_inline/thumb/30521798/5d8f2e996389b1ac6e313b0b644ebfe66486e3a1.jpg
			//   https://data.yiff.party/patreon_inline/30521798/5d8f2e996389b1ac6e313b0b644ebfe66486e3a1.jpg
			// https://data.yiff.party/patreon_inline/thumb/32682463/eba0dd3cd28724ceefa1b9195b82b2f2b31a6884.jpg
			//   https://data.yiff.party/patreon_inline/32682463/eba0dd3cd28724ceefa1b9195b82b2f2b31a6884.gif
			newsrc = src.replace(/\/patreon_inline\/+thumb\/+/, "/patreon_inline/");
			if (newsrc !== src)
				return add_extensions_gif(newsrc);

			if (/\/patreon_data\/+[0-9]+\/+[0-9]+\/+thumb\./.test(src) && options && options.element) {
				var current = options.element;
				if (current.classList.contains("lazyloaded")) {
					var link = current.parentElement.parentElement.querySelector(".card-action > a");
					if (link && string_indexof(link.href, "/patreon_data/") >= 0) {
						return link.href;
					}
				}
			}
		}

		if (domain_nosub === "dlivecdn.com" && /^images-sihv[0-9]*\./.test(domain)) {
			// todo: thumbor really needs to be processed somewhere central, this is terrible
			// https://images-sihv2.prd.dlivecdn.com/fit-in/50x50/filters:quality(90)/avatar/12246e97-3bd7-11ea-9fd3-a272e850df75
			//   https://images.prd.dlivecdn.com/avatar/12246e97-3bd7-11ea-9fd3-a272e850df75
			// https://images-sihv2.prd.dlivecdn.com/fit-in/200x200/filters:quality(90)/category/qffytgkitnjvi1mo1n
			//   https://images.prd.dlivecdn.com/category/qffytgkitnjvi1mo1n
			// https://images-sihv2.prd.dlivecdn.com/fit-in/200x200/filters:quality(90)/category/all.png
			//   https://images.prd.dlivecdn.com/category/all.png
			// https://images-sihv2.prd.dlivecdn.com/fit-in/256x256/filters:quality(90)/live-thumbnail/6f1a060d-3d4b-11ea-9529-e2443572cd01
			//   https://images.prd.dlivecdn.com/live-thumbnail/6f1a060d-3d4b-11ea-9529-e2443572cd01
			return src.replace(/:\/\/images-[^/.]+\.prd\.dlivecdn\.com\/+fit-in\/+[0-9]+x[0-9]+\/+filters:[^/]+\/+([-a-z]+\/+[^/]+)(?:[?#].*)?$/, "://images.prd.dlivecdn.com/$1");
		}

		if (domain_nowww === "bitchute.com") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+(?:embed|video)\/+([a-zA-Z0-9]+)\/*(?:[?#].*)?$/,
				query_for_id: "https://www.bitchute.com/video/${id}/",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/<video id="player".*?>\s*<source src="(https?:\/\/seed[0-9]+\.bitchute\.com\/+[^/]+\/+[a-zA-Z0-9]+\.mp4)"/);
					if (!match) {
						console_error(cache_key, "Unable to find video player match for", resp);
						return done(null, false);
					}

					var videourl = match[1];

					var baseobj:BigImageInfoSObject = {
						extra: {
							page: resp.finalUrl
						}
					};

					var og_description = get_meta(resp.responseText, "og:description");
					if (og_description) {
						baseobj.extra.caption = og_description;
					}

					baseobj.url = videourl;
					baseobj.video = true;

					return done(baseobj, 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nosub === "bitchute.com" && /^static/.test(domain)) {
			// https://static-3.bitchute.com/live/channel_images/1T4G52B7I3Ox/lVnrpenvlHcQESeGbooLmeqY_small.jpg
			//   https://static-3.bitchute.com/live/channel_images/1T4G52B7I3Ox/lVnrpenvlHcQESeGbooLmeqY_large.jpg
			// https://static-3.bitchute.com/live/cover_images/dL5WGm6DIxkW/3AH6p6ewO6jgE2xbCrngaYUz_320x180.jpg
			//   https://static-3.bitchute.com/live/cover_images/dL5WGm6DIxkW/3AH6p6ewO6jgE2xbCrngaYUz_1280x720.jpg -- upscaled
			// https://static-3.bitchute.com/live/cover_images/dL5WGm6DIxkW/5rP9Kc5gjFqD_640x360.jpg -- not upscaled, 1280x720 doesn't work
			//   https://seed300.bitchute.com/dL5WGm6DIxkW/5rP9Kc5gjFqD.mp4
			// https://static-3.bitchute.com/live/cover_images/dL5WGm6DIxkW/umTAdzkfTW8fNvGRyIcoAsV4_1280x720.jpg
			//   original page: https://www.bitchute.com/video/PMlkY1L4vgOe/
			newsrc = src.replace(/(\/live\/+channel_images\/+.*)_(?:small|medium)(\.[^/.]+)(?:[?#].*)?$/, "$1_large$2");
			if (newsrc !== src)
				return newsrc;

			regex = /(\/live\/+cover_images\/+.*_)([0-9]+x[0-9]+)(\.[^/.]+)(?:[?#].*)?$/;
			match = src.match(regex);
			if (match) {
				let baseobj = {url:src};
				let idmatch = src.match(/\/live\/+cover_images\/+[^/]+\/+([^/_]{5,15})_/);
				if (idmatch) {
					baseobj.extra = {page: "https://www.bitchute.com/video/" + idmatch[1] + "/"};
				}

				var sizes = [
					"1280x720",
					"640x360",
					"320x180"
				];

				var sizetoint = function(size) {
					var match = size.match(/^([0-9]+)x([0-9]+)$/);
					return parseInt(match[1]) * parseInt(match[2]);
				};

				var urlsize = sizetoint(match[2]);
				var newurls = [];
				array_foreach(sizes, function(size) {
					if (urlsize < sizetoint(size)) {
						var obj = deepcopy(baseobj);
						obj.url = src.replace(regex, "$1" + size + "$3");

						newurls.push(obj);
					}
				});

				if (idmatch && baseobj.extra && baseobj.extra.page) {
					newurls.unshift({
						url: baseobj.extra.page,
						is_pagelink: true
					});
				}

				if (newurls.length > 0) {
					return newurls;
				}

				var videourl = src.replace(/^[a-z]+:\/\/static-([0-9])\.bitchute\.com\/+live\/+cover_images\/+([^/]+\/+[^/_]{5,15})_[0-9]+x[0-9]+\..*/, "https://seed$100.bitchute.com/$2.mp4");
				if (videourl !== src) {
					baseobj.url = videourl;
					return baseobj;
				}
			}
		}

		if (domain_nosub === "bitchute.com" && /^seed[0-9]*\./.test(domain)) {
			// https://seed300.bitchute.com/dL5WGm6DIxkW/5rP9Kc5gjFqD.mp4
			match = src.match(/^[a-z]+:\/\/[^/]+\/+[^/]+\/+([^/.]+)\./);
			if (match) {
				return {
					url: src,
					extra: {page: "https://www.bitchute.com/video/" + match[1] + "/"}
				};
			}
		}

		if (domain_nowww === "bitchute.com") {
			// https://www.bitchute.com/static/v103/images/play-button.png -- overlays videos, harder to find the image underneath
			if (/\/static\/+v[0-9]+\/+images\/+/.test(src))
				return {
					url: src,
					bad: "mask"
				};
		}

		if (domain_nowww === "platinum-celebs.com") {
			// https://www.platinum-celebs.com/news_pic/20057/tn_19July2017-dove_cameron_jeans_shirt_2.jpg
			//   https://www.platinum-celebs.com/news_pic/20057/big_19July2017-dove_cameron_jeans_shirt_2.jpg
			return src.replace(/(\/news_pic\/+[0-9]+\/+)tn_/, "$1big_");
		}

		if (domain === "video.like.video") {
			// https://video.like.video/eu_live/5ug/10PPly_4.mp4?crc=4192414585&type=5
			//   https://video.like.video/eu_live/5ug/10PPly.mp4?crc=4192414585&type=5
			// thanks to remlap on discord:
			// https://video.like.video/asia_live/7h3/M0A/4B/67/MPsbAF7J3mWEX_9uAAAAAFaIr-Q366_4.mp4?crc=2088457347&type=5
			//   https://video.like.video/asia_live/7h3/M0A/4B/67/MPsbAF7J3mWEX_9uAAAAAFaIr-Q366.mp4?crc=2088457347&type=5
			newsrc = src.replace(/(\/[-_0-9A-Za-z]+)_[0-9](\.[^/.]+)(?:[?#].*)?$/, "$1$2");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "videosnap.like.video") {
			// https://videosnap.like.video/eu_live/5u9/14RtQ1_4.jpg?wmk_sdk=1&type=8&dw=300&resize=21
			//   https://videosnap.like.video/eu_live/5u9/14RtQ1_4.jpg?wmk_sdk=1&type=8
			//   https://videosnap.like.video/eu_live/5u9/14RtQ1_4.jpg?type=8
			// not sure if wmk_sdk does anything
			newsrc = remove_queries(src, ["resize", "dw", "wmk_sdk"]);
			if (newsrc !== src)
				return newsrc;

			// http://videosnap.like.video//eu_live//5uu//1188r7_1.jpg?type=8
			//   http://videosnap.like.video//eu_live//5uu//1188r7_4.jpg?type=8
			newsrc = src.replace(/(\/[0-9A-Za-z]+)_[12](\.[^/.]+)(?:[?#].*)?$/, "$1_4$2");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nosub === "likee.video" || domain_nosub === "likee.com") {
			var get_json_from_likee = function(resp, cache_key) {
				var match = resp.responseText.match(/<script>\s*window\.data\s*=\s*({.*?})\s*;\s*<\/script/);
				if (!match) {
					console_error(cache_key, "Unable to find match for", resp);
					return null;
				}

				try {
					var json = JSON_parse(match[1]);
					return json;
				} catch (e) {
					console_error(cache_key, e);
					return null;
				}
			};

			var query_likee = function(yyuid, post_id, cb) {
				api_query("likee_api:" + yyuid + "/" + post_id, {
					url: "https://likee.video/@" + yyuid + "/video/" + post_id
				}, cb, function(done, resp, cache_key) {
					var json = get_json_from_likee(resp, cache_key);

					if (!json) {
						done(null, false);
					} else {
						done(json, 60*60);
					}
				});
			};

			var likee_json_to_obj = function(resp, json) {
				var obj:BigImageInfoSObject = {
					extra: {
						page: resp ? resp.finalUrl : null
					}
				};

				if (json.share_url) {
					if (!obj.extra.page)
						obj.extra.page = json.share_url;
				}

				if (json.post_yyuid && json.post_id) {
					obj.extra.page = "https://likee.com/@" + json.post_yyuid + "/video/" + json.post_id;

					var cache_key = "likee_api:" + json.post_yyuid + "/" + json.post_id;
					if (!api_cache.has(cache_key))
						api_cache.set(cache_key, json, 60*60);
				}

				if (json.msg_text)
					obj.extra.caption = json.msg_text;

				var urls = [];
				if (json.video_url) {
					urls.push({
						url: json.video_url.replace(/(\/[-_0-9A-Za-z]+)_[0-9](\.[^/.]+)(?:[?#].*)?$/, "$1$2"),
						video: true
					});
				}

				// image2 is the unwatermarked one
				if (json.image2) {
					urls.push(json.image2.replace(/(\/[0-9A-Za-z]+)_[12](\.[^/.?#]+)(?:[?#].*)?$/, "$1_4$2"));
				}

				return fillobj_urls(urls, obj);
			};

			// example url thanks to remlap on discord:
			// https://l.likee.video/v/J38TY0
			// https://likee.video/v/J38TY0
			// http://mobile.likee.video/s/88yy1FwVjrU
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+([sv]\/+[0-9a-zA-Z]+)(?:[?#].*)?$/,
				cache_key: "likee_share_api",
				query_for_id: "https://likee.video/${id}",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/<script>\s*window\.data\s*=\s*({.*?})\s*;\s*<\/script/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					var json = JSON_parse(match[1]);

					var obj = likee_json_to_obj(resp, json);
					if (!obj) {
						return done(null, false);
					} else {
						return done(obj, 6*60*60);
					}
				}
			});
			if (newsrc) return newsrc;

			// https://likee.com/@52791510/video/6830235012651511654
			match = src.match(/^[a-z]+:\/\/[^/]+\/+@([^/]+)\/+video\/+([0-9]+)(?:[?#].*)?$/);
			if (match) {
				page_nullobj = {
					url: src,
					is_pagelink: true
				};

				if (options.do_request && options.cb) {
					query_likee(match[1], match[2], function(json) {
						if (!json) {
							return options.cb(page_nullobj);
						}

						var obj = likee_json_to_obj(null, json);
						if (!obj) {
							return options.cb(page_nullobj);
						} else {
							obj.push(page_nullobj);
							return options.cb(obj);
						}
					});

					return {
						waiting: true
					};
				} else {
					return page_nullobj;
				}
			}
		}

		if (host_domain_nowww === "likee.com" && options && options.element && options.do_request && options.cb && !options.exclude_videos) {
			if (options.element.tagName === "A" && /:\/\/[^/]+\/+s\/+[0-9A-Za-z]+$/.test(options.element.href)) {
				var cache_key = "likee:" + options.element.href.replace(/.*\/([^/]+)$/, "$1");
				api_cache.fetch(cache_key, options.cb, function(done) {
					options.do_request({
						url: options.element.href,
						method: "GET",
						onload: function(resp) {
							if (resp.readyState < 4)
								return;

							if (resp.status !== 200) {
								return done(null, false);
							}

							var match = resp.responseText.match(/<script>\s*window\.data\s*=\s*({.*?})\s*;\s*<\/script/);
							if (!match) {
								console_error("Unable to find match", resp);
								return done(null, false);
							}

							try {
								var json = JSON_parse(match[1]);
								return done(json.video_url, 12*60*60);
							} catch (e) {
								console_error(e);
								return done(null, false);
							}
						}
					});
				});

				return {
					waiting: true
				};
			}
		}

		if (domain_nowww === "roleplay.me") {
			// https://www.roleplay.me/photos/19/70/m_9186562074792811826.jpg
			//   https://www.roleplay.me/photos/19/70/9186562074792811826.jpg
			return src.replace(/(\/photos\/+(?:[0-9]+\/+){2})[ms]_([0-9]+\.)/, "$1$2");
		}

		if (domain === "cdn.21buttons.com") {
			// https://cdn.21buttons.com/posts/1080x1350/014daf325fae4281a7da5ebed4aa8702_1080x1350.jpg
			//   https://cdn.21buttons.com/posts/014daf325fae4281a7da5ebed4aa8702_1080x1350.jpg
			// https://cdn.21buttons.com/users/ecbcd777c28147c084b960fe68fa899b.medium.jpg
			//   https://cdn.21buttons.com/users/ecbcd777c28147c084b960fe68fa899b.large.jpg -- 1080x1080
			//   https://cdn.21buttons.com/users/ecbcd777c28147c084b960fe68fa899b.jpg -- 1122x1122
			return src
				.replace(/(\/users\/+[0-9a-f]{20,})\.(?:small|medium|large)\./, "$1.")
				.replace(/\/posts\/+[0-9]+x[0-9]+\/+/, "/posts/");
		}

		if (domain === "cwh-cdn.21buttons.com") {
			// https://cwh-cdn.21buttons.com/e7b29323d8322d9169ba323beea50821c6e9ffdf.medium.jpg -- 640x640, borders
			//   https://cwh-cdn.21buttons.com/e7b29323d8322d9169ba323beea50821c6e9ffdf.smedium.jpg -- 480x720, no borders
			return src.replace(/(\/[0-9a-f]{20,}\.)(?:small|medium)\./, "$1smedium.");
		}

		if (domain_nosub === "porngo.com" && /^img[0-9]*\./.test(domain)) {
			// https://img11.porngo.com/173000/173646/small/1.jpg
			//   https://img11.porngo.com/173000/173646/medium@2x/1.jpg
			return src.replace(/\/(?:small|medium)(?:@2x)?\/+([0-9]+\.[^/.]+)(?:[?#].*)?$/, "/medium@2x/$1");
		}

		if (domain === "assets-jpcust.jwpsrv.com") {
			// https://assets-jpcust.jwpsrv.com/thumbnails/ere54hzk-320.jpg
			//   https://assets-jpcust.jwpsrv.com/thumbnails/ere54hzk.jpg
			newsrc = src.replace(/(\/thumb(?:nail)?s\/+[^-./]+)-[0-9]+(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
			match = src.match(/\/thumb(?:nail)?s\/+([a-zA-Z0-9]+)(?:-[0-9]+)?\./);
			if (match) {
				page = "https://content.jwplatform.com/players/" + match[1] + ".html";
				return [
					{
						url: page,
						is_pagelink: true
					},
					{
						url: newsrc,
						extra: {
							page: page
						}
					}
				];
			} else {
				return newsrc;
			}
		}

		if (domain === "videos-cloudflare.jwpsrv.com") {
			match = src.match(/\/content\/+conversions\/+[a-zA-Z0-9]+\/+videos\/+([a-zA-Z0-9]+)-[0-9]+\.mp4/);
			if (match) {
				return {
					url: "https://content.jwplatform.com/players/" + match[1] + ".html",
					is_pagelink: true
				};
			}
		}

		if (domain === "content.jwplatform.com") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+(?:players|previews)\/+([a-zA-Z0-9]+)(?:-[a-zA-Z0-9]+)?(?:\.html)?(?:[?#].*)?$/,
				query_for_id: "https://content.jwplatform.com/players/${id}.html",
				process: function(done, resp, cache_key, match) {
					var id = match[1];

					var title = get_meta(resp.responseText, "og:title");
					var thumb = get_meta(resp.responseText, "og:image");

					var obj = {
						extra: {
							caption: title,
							page: resp.finalUrl
						}
					};

					var urls = [];

					urls.push({
						url: "https://content.jwplatform.com/manifests/" + id + ".m3u8",
						headers: {
							Referer: src
						},
						video: "hls"
					});

					var video = get_meta(resp.responseText, "og:video");
					if (video) {
						urls.push({
							url: video,
							video: true,
							can_head: false // otherwise 400
						});
					}

					if (thumb) {
						var newthumb = thumb.replace(/(\/thumb(?:nail)?s\/+[^-./]+)-[0-9]+(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
						if (newthumb !== thumb) urls.push(newthumb);
						urls.push(thumb);
					}

					return done(fillobj_urls(urls, obj), 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "k2s.cc") {
			// note that this depends on the accessToken and refreshToken cookies, which are generated by javascript:
			// POST https://api.k2s.cc/v1/auth/token : {"grant_type":"client_credentials","client_id":"k2s_web_app","client_secret":"[...]"}
			// client_secret can be found via REACT_APP_API_CLIENT_SECRET in one of the chunk.js files
			// for the moment let's just avoid doing this as it'll work after opening the site
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+file\/+([0-9a-f]+)(?:[?#].*)?$/,
				run: function(cb, match) {
					var id = match[1];

					api_query("keep2share:" + id, {
						url: "https://api.k2s.cc/v1/files/" + id,
						imu_mode: "xhr",
						headers: {
							Referer: "https://k2s.cc/file/" + id,
							Accept: "application/json, text/plain, */*"
						},
						json: true
					}, cb, function(done, json) {
						var obj = {
							extra: {
								page: "https://k2s.cc/file/" + id + "/" + json.name,
								caption: json.name
							}
						};

						var urls = [];

						if (json.videoPreview) {
							if (json.videoPreview.video) {
								urls.push({
									url: json.videoPreview.video,
									headers: {
										Referer: obj.extra.page
									},
									video: true
								});
							}

							if (json.videoPreview.cover) {
								urls.push(json.videoPreview.cover);
							}
						}

						if (json.thumbnails && json.thumbnails.length > 0) {
							urls.push(json.thumbnails[0]);
						}

						return done(fillobj_urls(urls, obj), 60*60);
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nosub === "keep2share.cc" && /^prx-[0-9]+\./.test(domain)) {
			match = src.match(/\/video\/+[0-9a-f]+\/+[0-9a-f]+\/+alternative_resolution_[0-9a-f]+_.*\?(?:.*&)?uf=([0-9a-f]+)(?:&.*)?$/);
			if (match) {
				return {
					url: "https://k2s.cc/file/" + match[1],
					is_pagelink: true
				};
			}
		}

		if (domain_nowww === "notion.so" ||
			// thanks to kidonng on github: https://github.com/qsniyg/maxurl/pull/1157
			// https://notion.notion.site/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fd7273351-a2ab-4208-b67f-2067cbf78684%2FLOGO.jpg?table=block&id=6b035aa7-9bec-475f-9bca-29c4ae2c6eb1&width=80&cache=v2
			//   https://notion.notion.site/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fd7273351-a2ab-4208-b67f-2067cbf78684%2FLOGO.jpg?table=block&id=6b035aa7-9bec-475f-9bca-29c4ae2c6eb1&cache=v2
			domain_nosub === "notion.site") {
			// https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fd7273351-a2ab-4208-b67f-2067cbf78684%2FLOGO.jpg?table=block&id=6b035aa7-9bec-475f-9bca-29c4ae2c6eb1&width=80&cache=v2
			//   https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fd7273351-a2ab-4208-b67f-2067cbf78684%2FLOGO.jpg?table=block&id=6b035aa7-9bec-475f-9bca-29c4ae2c6eb1&cache=v2
			if (/^[a-z]+:\/\/[^/]+\/+image\/+https?.*\?/) {
				newsrc = remove_queries(src, ["width", "height"]);
				if (newsrc !== src)
					return newsrc;
			}

			// https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Feae258ee-d3ad-44e5-bd1d-789c51155436%2F.png?table=block&id=6b035aa7-9bec-475f-9bca-29c4ae2c6eb1&width=3830&cache=v2
			//   https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Feae258ee-d3ad-44e5-bd1d-789c51155436%2F.png?table=block&id=6b035aa7-9bec-475f-9bca-29c4ae2c6eb1&cache=v2
			//   https://s3-us-west-2.amazonaws.com/secure.notion-static.com/eae258ee-d3ad-44e5-bd1d-789c51155436/.png -- doesn't work
			// thanks to kidonng on github: https://github.com/qsniyg/maxurl/pull/1157
			// https://www.notion.so/image/https%3A%2F%2Fapi.iconify.design%2Flogos%2Fchrome.svg
			//   https://api.iconify.design/logos/chrome.svg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+image\/+(https?%3.*?)(?:[?#].*)?$/, "$1");
			if (newsrc !== src && !/secure\.notion-static\.com/.test(newsrc))
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "cdn.futura-sciences.com") {
			// https://cdn.futura-sciences.com/buildsv6/images/mediumoriginal/2/5/c/25ccdad9de_35653_11986-tableau-tel.gif
			//   https://cdn.futura-sciences.com/buildsv6/images/largeoriginal/5/7/3/573d54fd56_118006_john-young-apollo-nasa.jpg
			// https://cdn.futura-sciences.com/buildsv6/images/wide1920/5/7/3/573d54fd56_118006_john-young-apollo-nasa.jpg
			//   https://cdn.futura-sciences.com/buildsv6/images/largeoriginal/5/7/3/573d54fd56_118006_john-young-apollo-nasa.jpg
			// https://cdn.futura-sciences.com/buildsv6/images/smallsquare/0/b/9/0b9e66c73b_50008316_bing-20090601-130815-02.jpg
			//   https://cdn.futura-sciences.com/buildsv6/images/largeoriginal/0/b/9/0b9e66c73b_50008316_bing-20090601-130815-02.jpg
			// https://cdn.futura-sciences.com/buildsv6/images/largesquare/2/a/d/2ada6c4477_50140458_5-terre.jpg
			//   https://cdn.futura-sciences.com/buildsv6/images/largeoriginal/2/a/d/2ada6c4477_50140458_5-terre.jpg -- doesn't work
			// https://cdn.futura-sciences.com/buildsv6/images/wide640/1/4/7/1475202ffa_50148960_alma-voie-lactee-eso-y-beletsky.jpg
			//   https://cdn.futura-sciences.com/buildsv6/images/largeoriginal/1/4/7/1475202ffa_50148960_alma-voie-lactee-eso-y-beletsky.jpg
			// https://cdn.futura-sciences.com/buildsv6/images/midioriginal/5/f/0/5f00ad7076_50152720_mousson-sugitas-fotolia.jpg
			//   https://cdn.futura-sciences.com/buildsv6/images/largeoriginal/5/f/0/5f00ad7076_50152720_mousson-sugitas-fotolia.jpg
			// https://cdn.futura-sciences.com/buildsv6/images/wide1440/e/f/7/ef75495b32_50153524_territoires-durables-drong-fotoliacom.jpg
			//   https://cdn.futura-sciences.com/buildsv6/images/largeoriginal/e/f/7/ef75495b32_50153524_territoires-durables-drong-fotoliacom.jpg
			// https://cdn.futura-sciences.com/buildsv6/images/smallrectangle/6/b/7/6b70baebe2_50142421_diderot-1000.jpg
			//   https://cdn.futura-sciences.com/buildsv6/images/largeoriginal/6/b/7/6b70baebe2_50142421_diderot-1000.jpg
			// https://cdn.futura-sciences.com/buildsv6/images/smalloriginal/4/8/4/484ff37950_100940_18-avenir-jung.jpg
			//   https://cdn.futura-sciences.com/buildsv6/images/largeoriginal/4/8/4/484ff37950_100940_18-avenir-jung.jpg -- doesn't work
			// other:
			// https://cdn.futura-sciences.com/sources/mkt/qsn-data.jpg
			// https://cdn.futura-sciences.com/systeme/misc/eboutique/pedro-jarque-krebs-3.jpg
			return src.replace(/\/buildsv6\/+images\/+(?:(?:small|medium|midi)original|wide(?:640|1920|1440)|smallsquare|smallrectangle)\/+/, "/buildsv6/images/largeoriginal/");
		}

		if (domain === "6d4be195623157e28848-7697ece4918e0a73861de0eb37d08968.ssl.cf1.rackcdn.com") {
			// https://6d4be195623157e28848-7697ece4918e0a73861de0eb37d08968.ssl.cf1.rackcdn.com/175085_200w.jpg
			//   https://6d4be195623157e28848-7697ece4918e0a73861de0eb37d08968.ssl.cf1.rackcdn.com/175085_original.jpg
			return src.replace(/(:\/\/[^/]+\/+[0-9]+)_[0-9]+[wh](\.[^/.]+)(?:[?#].*)?$/, "$1_original$2");
		}

		if (domain_nosub === "editmysite.com" && /^cdn[0-9]*\./.test(domain)) {
			// https://cdn2.editmysite.com/images/blank.gif
			if (/:\/\/[^/]+\/+images\/+blank\.gif(?:[?#].*)?$/.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}
		}

		if (domain === "d1rw89lz12ur5s.cloudfront.net") {
			// https://d1rw89lz12ur5s.cloudfront.net/photo/themagiccardtrader/file/63fa31c0e35311e592516ba78e288a12/medium/kmc%20super%20silver%20(Custom).gif
			//   https://d1rw89lz12ur5s.cloudfront.net/photo/themagiccardtrader/file/63fa31c0e35311e592516ba78e288a12/kmc%20super%20silver%20(Custom).gif
			return src.replace(/(\/photo\/+[^/]+\/+file\/+[0-9a-f]{20,}\/+)(?:thumb|medium|large)\/+/, "$1");
		}

		if (domain_nowww === "howtogeek.com") {
			// https://www.howtogeek.com/thumbcache/300/200/a13952e55e89ccf67988cad6ea2633fa/wp-content/uploads/2020/01/lock-on-keyboard.jpg
			//   https://www.howtogeek.com/wp-content/uploads/2020/01/lock-on-keyboard.jpg
			return src.replace(/\/thumbcache\/+[0-9]+\/+[0-9]+\/+[0-9a-f]{20,}\/+/, "/");
		}

		if (domain === "cdnu.porndoe.com") {
			newsrc = src.replace(/\/image\/+movie\/+crop\/+[0-9]+x[0-9]+\/+((?:[0-9]\/+){1,}[^/]+)\.(?:jpg|webp)(?:[?#].*)?$/, "/image/movie/$1.jpg");
			if (newsrc !== src)
				return newsrc;

			// doesn't work anymore
			//return src.replace(/(\/movie\/+(?:[0-9]\/+){5,}[^/]+-)(?:preview|240p-400|480p-1000)\./, "$1720p-hd-2500.");
		}

		if (domain_nowww === "porndoe.com") {
			// thanks to anonymous for reporting:
			let query_porndoe = function(id, vid, cb) {
				let cache_key = "porndoe:" + id;
				api_query(cache_key, {
					url: "https://porndoe.com/service/index?device=desktop&page=channel&id=" + id,
					imu_mode: "xhr",
					json: true,
					headers: {
						Referer: "https://porndoe.com/watch/" + vid
					}
				}, cb, function(done, resp, cache_key) {
					if (!resp) {
						return done(null, false);
					}

					if (!resp.payload.player) {
						console_error(cache_key, "Unable to find player key in", resp);
						return done(null, false)
					}

					return done(resp.payload.player, 60*60);
				});
			};

			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+watch\/+([0-9a-z]+)(?:[?#].*)?$/,
				query_for_id: "https://porndoe.com/watch/${id}",
				process: function(done, resp, cache_key, match) {
					let idmatch = resp.responseText.match(/"id":\s*"([0-9]+)"\s/);
					if (!idmatch) {
						console_error(cache_key, "Unable to find video ID in", resp);
						return done(null, false);
					}

					let urlid = match[1]
					query_porndoe(idmatch[1], urlid, function(result) {
						if (!result)
							return done(null, false);

						let urls = [];

						let urlmap = {};
						for (let type in result.sources) {
							for (let src of result.sources[type]) {
								let link = src.link;
								if (/\/signup/.test(link))
									continue;

								urlmap[src.path] = src.link;
							}
						}

						let mp4s = result.sources.mp4.sort((a, b) => b.bitrate - a.bitrate);
						for (let mp4 of mp4s) {
							if (mp4.path in urlmap) {
								urls.push({
									url: urlmap[mp4.path],
									video: true,
									is_private: true,
									headers: {
										Referer: "https://porndoe.com/"
									}
								});
							}
						}

						urls.push("https://porndoe.com/" + result.poster);

						return done(fillobj_urls(urls, {
							extra: {
								page: "https://porndoe.com/watch/" + urlid
							}
						}), 60*60);
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "images.newsnowgr.com" ||
			// http://images.newsnowgreece.com/131/1316458/apisteftes-eikones-sti-venetia-stegnosan-ta-kanalia-tis-pics-1-124x78.jpg
			//   http://images.newsnowgreece.com/131/1316458/1.jpg
			domain === "images.newsnowgreece.com") {
			// http://images.newsnowgr.com/131/1316496/Stars-and-Dust-in-Corona-Australis-1-315x236.jpg
			//   http://images.newsnowgreece.com/131/1316496/1.jpg
			//   http://www.newsnowgr.com/photo/1316496/1/ -- todo: add original page
			newsrc = src.replace(/:\/\/[^/]+\/+([0-9]{3}\/+[0-9]+\/+)[^/]+-([0-9]+)-[0-9]+x[0-9]+(\.[^/.]+)(?:[?#].*)?$/, "://images.newsnowgreece.com/$1$2$3");
			obj = {
				url: newsrc
			};

			match = src.match(/:\/\/[^/]+\/+[0-9]{3}\/+([0-9]+)\/+(?:[^/]+-)?([0-9]+)(?:-[0-9]+x[0-9]+)?\.[^/.]+(?:[?#].*)?$/);
			if (match) {
				obj.extra = {page: "http://www.newsnowgr.com/photo/" + match[1] + "/" + match[2] + "/"};
			}

			return obj;
		}

		if (domain_nowww === "wallpapers.net") {
			// http://wallpapers.net/web/wallpapers/corona-australis-hd-wallpaper/thumbnail/md.jpg
			//   http://wallpapers.net/web/wallpapers/corona-australis-hd-wallpaper/2560x1600.jpg
			newsrc = src.replace(/(\/web\/+wallpapers\/+[^/]+\/+thumbnail\/+)(?:xs|sm|md)\./, "$1lg.");
			if (newsrc !== src)
				return newsrc;

			// http://wallpapers.net/corona-australis-hd-wallpaper/download/800x480.jpg
			//   http://wallpapers.net/web/wallpapers/corona-australis-hd-wallpaper/800x480.jpg
			newsrc = src.replace(/(:\/\/[^/]+\/+)([^/]+\/+)download\/+/, "$1web/wallpapers/$2");
			if (newsrc !== src)
				return newsrc;

			match = src.match(/\/web\/+wallpapers\/+([^/]+)\/+(?:[0-9]+x[0-9]+|thumbnail)/);
			if (match && options && options.do_request && options.cb) {
				var page = "https://wallpapers.net/" + match[1];

				cache_key = "wallpapers.net:" + page;
				api_cache.fetch(cache_key, options.cb, function(done) {
					options.do_request({
						url: page,
						method: "GET",
						headers: {
							"Accept-Language": "en;q=0.9"
						},
						onload: function(resp) {
							if (resp.readyState < 4)
								return;

							if (resp.status !== 200) {
								return done(null, false);
							}

							var match = resp.responseText.match(/<p class="small">Resolution:\s*<a href="\/[^"]+"\s*>([0-9]+x[0-9]+)<\/a>/);
							if (!match) {
								console_error("Unable to find match", resp);
								return done(null, false);
							}

							return done({
								url: src.replace(/(\/web\/+wallpapers\/+[^/]+\/+).*?(\.[^/.]+)(?:[?#].*)?$/, "$1" + match[1] + "$2"),
								extra: {
									page: resp.finalUrl
								}
							}, 12*60*60);
						}
					});
				});

				return {
					waiting: true
				};
			}
		}

		if (domain_nowww === "youngjump.jp") {
			// https://youngjump.jp/photobook/japanesegravure/images/tn02.jpg
			//   https://youngjump.jp/photobook/japanesegravure/images/photo02.jpg
			return src.replace(/(\/images\/+)tn([0-9]+\.[^/.]+)(?:[?#].*)?$/, "$1photo$2");
		}

		if (domain === "forums.auscelebs.net") {
			// https://forums.auscelebs.net/acnet-images/47493/thumbs/jessica-van-vonderen-351458.jpg
			//   https://forums.auscelebs.net/acnet-images/47493/jessica-van-vonderen-351458.jpg
			return src.replace(/(\/[0-9]+\/+)thumbs\/+([^/]+\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "dyncdn2.com" ||
			// https://dyncdn.me/mimages/342184/over_opt.jpg
			//   https://dyncdn.me/mimages/342184/poster.jpg
			//   https://dyncdn.me/mimages/342184/poster_opt.jpg
			domain_nowww === "dyncdn.me") {
			// https://dyncdn2.com/mimages/342184/over_opt.jpg
			//   https://dyncdn2.com/mimages/342184/poster_opt.jpg
			return src
				.replace(/(\/mimages\/+[0-9]+\/+)poster\./, "$1poster_opt.")
				.replace(/(\/mimages\/+[0-9]+\/+)over_opt\./, "$1poster_opt.");
		}

		if (domain_nosub === "1z2x1z.com") {
			// http://kr.1z2x1z.com/wp-content/plugins/use-your-drive/css/images/mag.png
			if (/\/wp-content\/+plugins\/+use-your-drive\/+css\/+images\//.test(src))
				return {
					url: src,
					bad: "mask"
				};
		}

		if (domain_nosub === "vercity.ru") {
			// https://auto.vercity.ru/gallery/img/automobiles/Mercedes-Benz/2020-01%20Mercedes-Benz%20VISION%20AVTR/150x/1579255494.jpg
			//   https://auto.vercity.ru/gallery/img/automobiles/Mercedes-Benz/2020-01%20Mercedes-Benz%20VISION%20AVTR/1579255494.jpg
			return src.replace(/(\/gallery\/+img\/+.*\/)[0-9]+x[0-9]*\/+([^/]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "auto.sk") {
			// https://auto.sk/static/gallery/2020/01/5e1d932bf30e5/5e1d93868bb22/14127-thumb.jpg
			//   https://auto.sk/static/gallery/2020/01/5e1d932bf30e5/5e1d93868bb22/14127.jpg
			return src.replace(/(\/static\/+gallery\/+[0-9]{4}\/+[0-9]{2}\/+[0-9a-f]{5,}\/+[0-9a-f]{5,}\/+[0-9]+)-thumb(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "imgs.firmenwagen.co.at") {
			// https://imgs.firmenwagen.co.at/m/4428_1_400-0-0_.jpg
			//   https://imgs.firmenwagen.co.at/m/4428_1.jpg
			return src.replace(/(:\/\/[^/]+\/+m\/+[0-9]+_[0-9]+)_[0-9]+-[0-9]+-[0-9]+_(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "s.car.info") {
			// http://s.car.info/image_files/360/0-849941.jpg
			//   https://s.car.info/image_files/orig/0-849941.jpg
			return src.replace(/(\/image_files\/+)[0-9]+\/+/, "$1orig/");
		}

		if (domain_nowww === "cryengine.com") {
			// https://www.cryengine.com/files/news/480/9b028f1114d8aca8d4600bfbaa3255583d52c390efd63fde86f062bc95528539.webp
			//   https://www.cryengine.com/files/news/9b028f1114d8aca8d4600bfbaa3255583d52c390efd63fde86f062bc95528539.webp
			// https://www.cryengine.com/files/carousel/768/c0dc875ae417c5a35dd2146f8b80fc34127da9ae0ee3daebfae74b92b973c319.webp
			//   https://www.cryengine.com/files/carousel/c0dc875ae417c5a35dd2146f8b80fc34127da9ae0ee3daebfae74b92b973c319.webp
			return src.replace(/(\/files\/+[a-z]+\/+)[0-9]+\/+([0-9a-f]{10,}\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "cdn-l-cyberpunk.cdprojektred.com") {
			// https://cdn-l-cyberpunk.cdprojektred.com/gallery/1080p/Cyberpunk2077-Arriving_at_destination-en.jpg
			//   https://cdn-l-cyberpunk.cdprojektred.com/gallery/2160p/Cyberpunk2077-Arriving_at_destination-en.jpg
			return src.replace(/\/gallery\/+1080p\/+/, "/gallery/2160p/");
		}

		if (domain_nowww === "romsmode.com" ||
			// https://romsmania.cc/statics/assets/covers/gamecube/hunter-the-reckoning-usa-gamecube_1486037702_mini.jpg
			//   https://romsmania.cc/statics/assets/covers/gamecube/hunter-the-reckoning-usa-gamecube_1486037702.jpg
			domain_nowww === "romsmania.cc") {
			// https://romsmode.com/statics/assets/covers/gamecube/legend-of-zelda-the-the-wind-waker-usa-gamecube_1485595101_mini.jpg
			//   https://romsmode.com/statics/assets/covers/gamecube/legend-of-zelda-the-the-wind-waker-usa-gamecube_1485595101.jpg
			return src.replace(/(\/statics\/+assets\/+covers\/+.*_[0-9]+)_mini(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "myabandonware.com") {
			// https://www.myabandonware.com/media/screenshots/0-9/007-nightfire-ilw/thumbs/007-nightfire_13.png
			//   https://www.myabandonware.com/media/screenshots/0-9/007-nightfire-ilw/007-nightfire_13.png
			// https://www.myabandonware.com/media/screenshots/m/max-payne-jig/thumbs/max-payne_1.png
			//   https://www.myabandonware.com/media/screenshots/m/max-payne-jig/max-payne_1.jpg
			// https://www.myabandonware.com/media/screenshots/s/strike-fleet-j2/thumbs/strike-fleet_1.png
			//   https://www.myabandonware.com/media/screenshots/s/strike-fleet-j2/strike-fleet_1.gif
			newsrc = src.replace(/(\/media\/+screenshots\/.*\/)thumbs\/+/, "$1");
			if (newsrc !== src)
				return add_full_extensions(newsrc, ["png", "jpg", "gif"]);
		}

		if (domain_nowww === "d-gram.co.kr") {
			// https://d-gram.co.kr/data/dgram/goods/asiha/small/api201912061553473471228.jpg
			//   https://d-gram.co.kr/data/dgram/goods/asiha/big/api201912061553473471228.jpg
			// https://d-gram.co.kr/data/dgram/goods/Ouimaisnon/small/300809957.jpg
			//   https://d-gram.co.kr/data/dgram/goods/Ouimaisnon/big/300809957.jpg
			return src.replace(/(\/data\/+dgram\/.*\/)small\/+([^/]+)(?:[?#].*)?$/, "$1big/$2");
		}

		if (domain_nosub === "sz-search.com") {
			// http://th.sz-search.com/t.html?ph=https%3A%2F%2Fencrypted-tbn0.gstatic.com%2Fimages%3Fq%3Dtbn%3AANd9GcQD2V2q2LpAxjuJHVG3fMBh5jZR7zZibnmjiz-B1siymZAznEvW%26s
			//   https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQD2V2q2LpAxjuJHVG3fMBh5jZR7zZibnmjiz-B1siymZAznEvW&s
			// http://it.sz-search.com/t.html?ph=https%3A%2F%2Fencrypted-tbn0.gstatic.com%2Fimages%3Fq%3Dtbn%3AANd9GcTWMG1jcS0qEJ3Ap9bbsG8j-KlqU2yWDKUQM0QliEIKrIkWfqux%26s
			//   https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTWMG1jcS0qEJ3Ap9bbsG8j-KlqU2yWDKUQM0QliEIKrIkWfqux&s
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+t.html\?(?:.*&)?ph=(http[^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nowww === "sanet.pics") {
			// https://sanet.pics/storage-6/0220/th_9igLbF8otrSYXTItNF7OC6IBGsmuJLOT.jpg
			//   https://sanet.pics/storage-6/0220/9igLbF8otrSYXTItNF7OC6IBGsmuJLOT.jpg
			return src.replace(/(\/storage-[0-9]+\/+[0-9]+\/+)th_([^/]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "uploads.cdn.triller.co") {
			// https://uploads.cdn.triller.co/v1/avatars/19138302/1552166799_avatar.jpg?q=80&w=420
			newsrc = src.replace(/(\/v1\/+avatars\/+[0-9]+\/+[0-9]+_avatar\.[^/.?#]+)(?:[?#].*)?$/, "$1");
			if (newsrc !== src) return newsrc;

			// https://v.triller.co/qyqyn
			// https://uploads.cdn.triller.co/v1/uploads/3450512/1518746092_thumbnail.jpg
			newsrc = src.replace(/(\/v1\/+uploads\/+[0-9]+\/+[0-9]+)_thumbnail\.[^/.?#]+(?:[?#].*)?$/, "$1_video.mp4");
			if (newsrc !== src) {
				return {
					url: newsrc,
					video: true
				};
			}
		}

		if (domain === "v.triller.co") {
			// new style: https://v.triller.co/eYmQq5
			// old style (+no description, only #trillerlife): https://v.triller.co/RA0J76
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+([a-zA-Z0-9]+)(?:[?#].*)?$/,
				query_for_id: "https://v.triller.co/${id}",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/<video\s+class="no-js"\s+controls\s+preload="metadata"\s+poster="(\/\/[^"]+)"\s+src="(\/\/[^"]+)"/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					var baseobj = {
						extra: {
							page: resp.finalUrl
						}
					};

					// TODO: caption (og:description??)

					var poster = urljoin(resp.finalUrl, decode_entities(match[1]), true);
					var video = urljoin(resp.finalUrl, decode_entities(match[2]), true);

					var urls = [{url: video, video: true}, poster];
					return done(fillobj_urls(urls, baseobj), 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "triller.co") {
			// thanks to remlap for reporting:
			// https://triller.co/@lexijayde/video/64043796
			// = https://v.triller.co/WWn2x2
			var query_triller = function(id, cb) {
				api_query("triller_api:" + id, {
					url: "https://social.triller.co/v1.5/api/videos/" + id,
					imu_mode: "xhr",
					headers: {
						Origin: "https://triller.co"
					},
					json: true
				}, cb, function(done, resp, cache_key) {
					var video = resp.videos[0];

					var obj = {
						extra: {
							page: "https://triller.co/@" + video.user.username + "/video/" + video.id,
							created_date: new Date(video.timestamp).getTime(),
							caption: video.description,
							id: video.id,
							author_username: video.user.username,
							//author_uid: video.user.user_id
						}
					};

					var urls = [];

					if (video.transcoded_url)
						urls.push({
							url: video.transcoded_url,
							video: "hls"
						});

					if (video.stream_url)
						urls.push({
							url: video.stream_url,
							video: true
						});

					if (video.og_sound && video.og_sound.sound_audio_url)
						urls.push({
							url: video.og_sound.sound_audio_url,
							media_info: {
								type: "audio"
							}
						});

					if (video.thumbnail_url)
						urls.push(video.thumbnail_url);

					return done(fillobj_urls(urls, obj), 6*60*60);
				});
			};

			// https://triller.co/@lexijayde/video/64043796
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+@[^/]+\/+video\/+([0-9]+|[-0-9a-f]{20,})(?:[?#].*)?$/,
				run: function(cb, match) {
					var id = match[1];
					query_triller(id, cb);
				}
			});
			if (newsrc) return newsrc;
		}

		if (host_domain_nowww === "triller.co") {
			newsrc = common_functions["get_pagelink_host_el_matching"](options, {
				url_match: /^[a-z]+:\/\/[^/]+\/+@[^/]+\/+video\/+([0-9]+|[-0-9a-f]{20,})(?:[?#].*)?$/,
				el_match: function(x) {
					return x.tagName.toLowerCase() === "halogen-ui-video-player"
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "kinolift.ru") {
			// https://kinolift.ru/media/users/23439/386876_s.jpg -- 341x512
			//   https://kinolift.ru/media/users/23439/386876_n.jpg -- 682x1024
			//   https://kinolift.ru/media/users/23439/386876_l.jpg -- 760x1141
			return src.replace(/(\/media\/+users\/+[0-9]+\/+[0-9]+)_[sn](\.[^/.]+)(?:[?#].*)?$/, "$1_l$2");
		}

		if (false && host_domain_nowww === "mega.nz" && options && options.do_request && options.cb && options.element) {
			// need to decrypt
			var get_file_id = function(current) {
				// <span class="block-view-file-type image file">
				if (current.parentElement && current.parentElement.tagName === "SPAN" && current.parentElement.classList.has("image")) {
					if (current.parentElement.parentElement.tagName === "A") {
						return current.parentElement.parentElement.id;
					}
				}

				return null;
			};

			var current = options.element;

			var get_header_params = function() {
				var localstorage = options.window.localStorage;
				if (!localstorage)
					return null;

				var sid = localstorage.sid;
				var lang = localstorage.lang;
				//var domain = meganz; // commenting out because meganz doesn't exist
				var id = "1"; // doesn't seem to matter? maybe a randomly generated number
				var ut = localstorage.apiut;

				if (sid && lang && ut) {
					return {
						sid: sid,
						lang: lang,
						domain: domain,
						id: id,
						ut: ut
					}
				} else {
					return null;
				}
			};

			var get_req_payload = function(id) {
				return [{
					"a": "g",
					g: 1,
					ssl: 2,
					v: 2,
					n: id
				}];
			};
		}

		if ((domain_nosub === "dropbox.com" || domain_nosub === "dropboxusercontent.com") && /previews\.dropbox/.test(domain)) {
			if (/\/p\/+thumb\/+[^/]{50,}\/+[^/]+(?:[?#].*)?$/.test(src)) {
				return src.replace(/(\/[^?#]+)(?:[?#].*)?$/, "$1?fv_content=true&size_mode=5");
			}
		}

		if (domain_nosub === "ddimg.cn") {
			// http://img3m0.ddimg.cn/76/26/1569316990-1_l_2.jpg
			//   http://img3m0.ddimg.cn/76/26/1569316990-1_o_2.jpg -- 800x800
			// o, u, e, k, w, h, b, l, {s, m, f, a}, t, p, x, v
			// http://img54.ddimg.cn/206620108363854_s.jpg
			//   http://img54.ddimg.cn/206620108363854.jpg
			// http://img57.ddimg.cn/206620117782667_y.jpg
			//   http://img57.ddimg.cn/206620117782667.jpg
			// other:
			// http://img60.ddimg.cn/upload_img/00271/1/0103-y-l-8-1577958567.jpg
			// http://img63.ddimg.cn/upload_img/00771/11/18249-1574755651.jpg
			// http://img60.ddimg.cn/upload_img/00802/1/8064-d-1578562138.jpg
			// http://img63.ddimg.cn/upload_img/00727/123/383x340-1570526824.jpg
			newsrc = src
				.replace(/(\/[0-9]{2}\/+[0-9]{2}\/+[0-9]+-[0-9]+)_[a-z]_([0-9]+\.[^/.]+)(?:[?#].*)?$/, "$1_o_$2")
				.replace(/(:\/\/[^/]+\/+[0-9]+)_[a-z](\.[^/.]+)(?:[?#].*)?$/, "$1$2");

			return {
				url: newsrc,
				can_head: false
			};
		}

		if (domain === "image.bitautoimg.com") {
			// https://image.bitautoimg.com/appimage-640-w1/mapi/media/2020/02/01/89f6ccd94eb843519f9f8e1b0d689098.jpeg
			//   https://image.bitautoimg.com/mapi/media/2020/02/01/89f6ccd94eb843519f9f8e1b0d689098.jpeg
			return src.replace(/\/appimage-[^/]+\/+mapi\/+media\/+/, "/mapi/media/");
		}

		if (amazon_container === "miscellaneous-content" ||
			domain === "d2qm30jidfbm96.cloudfront.net") {
			// thanks to anonymous
			// https://miscellaneous-content.s3.amazonaws.com/uploads/bfa/31033/4191388/thumb_31033_4191388.jpg
			//   https://miscellaneous-content.s3.amazonaws.com/uploads/bfa/31033/4191388/large_31033_4191388.jpg
			//   https://miscellaneous-content.s3.amazonaws.com/uploads/bfa/31033/4191388/original_31033_4191388.jpg
			regex = /(\/uploads\/+bfa\/+[0-9]+\/+([0-9]+)\/+)(?:thumb|large|wl|preview|original)_([0-9]+_[0-9]+\.[^/.]+)(?:[?#].*)?$/;
			match = src.match(regex);

			if (match) {
				page = "https://bfa.com/home/photo/" + match[2];

				obj = {
					url: src,
					extra: {
						page: page
					},
					headers: {
						Referer: page,
						"Sec-Fetch-Dest": "image",
						"Sec-Fetch-Mode": "same-origin",
						"Sec-Fetch-Site": "same-site"
					}
				};

				if (string_indexof(src, "/thumb_") >= 0 || string_indexof(src, "/large_") >= 0) {
					return fillobj_urls([
						src.replace(regex, "$1original_$3"),
						{
							url: src.replace(regex, "$1wl_$3"),
							problems: {
								watermark: true
							}
						},
						src.replace(regex, "$1large_$3")
					], obj);
				}

				if (string_indexof(src, "/wl_") >= 0 || string_indexof(src, "preview_") >= 0) {
					return fillobj_urls([
						src.replace(regex, "$1original_$3"),
						{
							url: src.replace(regex, "$1large_$3"),
							problems: {
								smaller: true
							}
						}
					], obj);
				}

				return obj;
			}
		}

		if (googlestorage_container === "inpock-link-media-storage") {
			// https://storage.googleapis.com/inpock-link-media-storage/deploy/media/images/2020/2/9/thumb@300_2020-02-09-966029.jpeg
			//   https://storage.googleapis.com/inpock-link-media-storage/deploy/media/images/2020/2/9/2020-02-09-966029.jpeg
			return src.replace(/(\/media\/+images\/+[0-9]{4}\/+[0-9]+\/+[0-9]+\/+)thumb@[0-9]+_/, "$1");
		}

		if (domain_nowww === "24cos.com" ||
			// https://imgs.diercun.com/hd1/2020/0207/14/m24mnorg_16.jpg
			domain === "imgs.diercun.com") {
			// https://www.24cos.com/upload/2020/0210/7/m24cos_52.jpg
			//   https://www.24cos.com/upload/2020/0210/7/24cos_52.jpg
			let referer = "https://" + domain_nosub + "/";
			if (domain_nosub === "diercun.com") {
				referer = "https://www.24mntp.com/";
			}

			return {
				url: src
					.replace(/:\/\/imgs(\.[^/]+\/+[^/]+\/+[0-9]{4}\/+[0-9]{4}\/+[0-9]+\/+)m(24[a-z]+_[0-9]+\.[^/.]+)(?:[?#].*)?$/, "://bimg$1$2")
					.replace(/(\/+[0-9]{4}\/+[0-9]{4}\/+[0-9]+\/+)m(24[a-z]+_[0-9]+\.[^/.]+)(?:[?#].*)?$/, "$1$2"),
				headers: {
					Referer: referer
				}
			};
		}

		if (domain === "img.xda-cdn.com") {
			// https://img.xda-cdn.com/2yNH6dILNmizNpEEABNKnqs64ys=/https%3A%2F%2Fdl2.pushbulletusercontent.com%2FnT071AMavA0jkluZaGwXx0wgtg23aWTS%2FScreenshot_20170216-140640.png
			//   https://dl2.pushbulletusercontent.com/nT071AMavA0jkluZaGwXx0wgtg23aWTS/Screenshot_20170216-140640.png
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+[^/]{10,}\/+(https?.*)/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "img.itch.zone" && host_domain_nosub === "itch.io" && options && options.element) {
			if (options.element.classList.contains("screenshot")) {
				if (options.element.parentElement.tagName === "A" && string_indexof(options.element.parentElement.href, "://img.itch.zone/") >= 0) {
					return options.element.parentElement.href;
				}
			}
		}

		if (domain === "im.camjaxx.com") {
			// https://im.camjaxx.com/5d141fedc95d8304e6d142cd/preview/preview.webm
			//   https://camjaxx.com/stream/5d141fedc95d8304e6d142cd
			return src.replace(/:\/\/[^/]+\/+([0-9a-f]{10,})\/+preview\/+.*/, "://camjaxx.com/stream/$1");
		}

		if (domain_nowww === "camjaxx.com") {
			// https://camjaxx.com/stream/5d141fedc95d8304e6d142cd
			if (/:\/\/[^/]+\/+stream\/+[0-9a-f]+\/*(?:[?#].*)?$/.test(src)) {
				return {
					url: src,
					video: true
				};
			}
		}

		if (domain === "ars.els-cdn.com") {
			// https://www.sciencedirect.com/science/article/abs/pii/S0097849399000291
			// https://ars.els-cdn.com/content/image/1-s2.0-S0097849399000291-gr6.sml
			//   https://ars.els-cdn.com/content/image/1-s2.0-S0097849399000291-gr6.jpg
			// https://ars.els-cdn.com/content/image/1-s2.0-S0097849399000291-gr1.sml
			//   https://ars.els-cdn.com/content/image/1-s2.0-S0097849399000291-gr1.gif
			newsrc = src.replace(/(\/content\/+image\/+[^/]+)\.sml(?:[?#].*)?$/, "$1.jpg");
			if (newsrc !== src)
				return add_extensions_gif(newsrc);
		}

		if (domain === "static.gearslutz.com") {
			// https://static.gearslutz.com/board/imgext.php?u=http%3A%2F%2Fdt7v1i9vyp3mf.cloudfront.net%2Fstyles%2Fnews_large%2Fs3%2Fimagelibrary%2FG%2FGainStaging-02.jpg%3F_eyvJd_9VLias8itikySOMcrnMIanelM%3D%26amp%3Bitok%3Dmlx6lSjQ&h=7b670fac2fd6de5327f8c2361c13ece3
			//   http://dt7v1i9vyp3mf.cloudfront.net/styles/news_large/s3/imagelibrary/G/GainStaging-02.jpg?_eyvJd_9VLias8itikySOMcrnMIanelM=&amp;itok=mlx6lSjQ
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+board\/+imgext\.php\?(?:.*&)?u=([^&]*).*?$/, "$1");
			if (newsrc !== src) {
				return decodeuri_ifneeded(newsrc);
			}
		}

		if ((domain_nosub === "hstatic.dk" ||
			 // https://sw12513.smartweb-static.com/upload_dir/pics/designere/nasa/34153-7070-AD.w293.h293.fill.jpg
			 //   https://sw12513.smartweb-static.com/upload_dir/pics/designere/nasa/34153-7070-AD.jpg
			 domain_nosub === "smartweb-static.com") && string_indexof(src, "/upload_dir/") >= 0) {
			// https://shop12157.hstatic.dk/upload_dir/shop/19833_34153.w293.h293.fill.jpg
			//   https://shop12157.hstatic.dk/upload_dir/shop/19833_34153.jpg
			return src.replace(/(\/[^/]+?)(?:\.(?:[wh][0-9]+|fill)){1,}(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (amazon_container === "planetary") {
			// https://www.planetary.org/multimedia/space-images/jupiter/callisto-from-voyager-1.html
			// https://planetary.s3.amazonaws.com/assets/images/5-jupiter/2015/20151019_CallistoV1m_f840.jpg
			//   https://planetary.s3.amazonaws.com/assets/images/5-jupiter/2015/20151019_CallistoV1m.jpg
			return src.replace(/(\/assets\/+images\/+.*)_f[0-9]+(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "pastebin.com") {
			// https://pastebin.com/i/t.gif
			if (/^[a-z]+:\/\/[^/]+\/+i\/+t\.gif(?:[?#].*)?$/.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}
		}

		if (domain_nowww === "davidrevoy.com") {
			// https://www.davidrevoy.com/plugins/vignette/plxthumbnailer.php?src=https://www.davidrevoy.com/data/images/blog/2020/2020-02-12_18h20_sketchpage_net.jpg&w=430&h=245&s=1&q=70
			//   https://www.davidrevoy.com/data/images/blog/2020/2020-02-12_18h20_sketchpage_net.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+plugins\/+vignette\/+plxthumbnailer\.php\?(?:.*&)?src=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "d2xkkdgjnsfvb0.cloudfront.net") {
			// https://d2xkkdgjnsfvb0.cloudfront.net/Vault/Thumb?VaultID=17372&Interlaced=1&Mode=R&ResX=960&OutputFormat=jpg&Quality=90&t=1557760266
			//   https://d2xkkdgjnsfvb0.cloudfront.net/Vault/VaultOutput?ID=17372
			return src.replace(/\/Vault\/+Thumb\?(?:.*&)?VaultID=([0-9]+).*$/, "/Vault/VaultOutput?ID=$1");
		}

		if (domain_nowww === "albumartexchange.com") {
			// https://www.albumartexchange.com/coverart/_tn/va/variousartists_kitsunsoleilmix_65el.jpg
			//   https://www.albumartexchange.com/coverart/gallery/va/variousartists_kitsunsoleilmix_65el.jpg
			return src.replace(/(\/coverart\/+)_tn\/+/, "$1gallery/");
		}

		if (amazon_container === "inteng-storage") {
			// https://inteng-storage.s3.amazonaws.com/img/iea/zBwgmajpGK/sizes/speed-test-tools_resize_md.jpg
			//   https://inteng-storage.s3.amazonaws.com/img/iea/zBwgmajpGK/speed-test-tools.jpg
			return src.replace(/\/sizes\/+([^/]+)_resize_[^/.]+(\.[^/.]+)(?:[?#].*)?$/, "/$1$2");
		}

		if (domain === "covers.vitalbook.com") {
			// https://covers.vitalbook.com/vbid/9780190650100/width/200
			//   https://covers.vitalbook.com/vbid/9780190650100
			return src.replace(/(\/vbid\/+[0-9]+)(?:\/+(?:height|width)\/+[0-9]+\/*)?(?:[?#].*)?$/, "$1");
		}

		if (domain_nosub === "subirimagenes.com" && /^s[0-9]*\./.test(domain)) {
			// http://s2.subirimagenes.com/privadas/previo/thump_2276535diggi.jpg
			//   http://s2.subirimagenes.com/privadas/2276535diggi.jpg
			return src.replace(/\/previo\/+thump_/, "/");
		}

		if (host_domain_nowww === "justfor.fans" && options && options.element) {
			if (options.element.parentElement && options.element.parentElement.classList.contains("video-thumbnail")) {
				var link = options.element.parentElement.parentElement;
				if (link.tagName === "A") {
					var match = link.href.match(/^javascript:MakeMovieHD\("[^"]+"\s*,\s*({.*?})\s*,/);
					if (match) {
						try {
							var json = JSON_parse(match[1]);
							var maxres = 0;
							var maxobj = null;

							for (var resolution in json) {
								var our_resolution = parseInt(resolution);
								if (our_resolution > maxres) {
									maxres = our_resolution;
									maxobj = json[resolution];
								}
							}

							if (maxobj) {
								return {
									url: maxobj,
									video: true,
									is_private: true // linked to ip
								};
							}
						} catch (e) {
							console_error(e);
						}
					}
				}
			}
		}

		if (domain === "d3373orltkomw3.cloudfront.net") {
			// https://d3373orltkomw3.cloudfront.net/565287/o1c6sb3hkn20a1h7415no1cuv1ktmc.mp4
			if (/\/[0-9]+\/+[0-9a-z]+\.mp4/.test(src)) {
				return {
					url: src,
					video: true
				};
			}
		}

		if (domain_nowww === "apclips.com") {
			// https://apclips.com/ui/img/model/rivergray/photo/d0fd82d3759b152a8be1bcb324b19de7_th.jpg
			//   https://apclips.com/ui/img/model/rivergray/photo/d0fd82d3759b152a8be1bcb324b19de7.jpg
			return src.replace(/(\/img\/+model\/+[^/]+\/+photo\/+[0-9a-f]{10,})_th(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "iwantclips.com") {
			// https://iwantclips.com/uploads/aboutme_previews/753097/480_f973db269576958e1b4d18ff0bb87711.jpg
			//   https://iwantclips.com/uploads/aboutme_previews/753097/f973db269576958e1b4d18ff0bb87711.jpg
			return src.replace(/(\/uploads\/+aboutme_previews\/+[0-9]+\/+)[0-9]+_/, "$1");
		}

		if (domain === "s.bellesa.co") {
			newsrc = src.replace(/(\/v\/+[0-9a-f]{10,}\/+)(?:preview_[0-9]+)(\.[^/.]+)(?:[?#].*)?$/, "$1360$2");
			if (newsrc !== src)
				return newsrc;

			// FIXME: is this necessary? only found up to 720 so far...
			let sizes = [2160, 1080, 720, 480, 360];

			regex = /(\/v\/+[0-9a-f]{10,}\/+)([0-9]+)(\.[^/.]+)(?:[?#].*)?$/;
			match = src.match(regex);
			if (match) {
				let obj = [];
				for (let i = 0; i < sizes.length; i++) {
					if (sizes[i] <= match[1])
						break;

					obj.push(src.replace(regex, "$1" + sizes[i] + "$3"));
				}

				return obj;
			}
		}

		if (domain_nowww === "censored.tv") {
			// https://www.censored.tv/images/censored-bug.png
			if (/\/images\/+censored-bug\.png(?:[?#].*)?$/.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}
		}

		if (domain === "imgs.ototoy.jp") {
			// https://imgs.ototoy.jp/imgs/jacket/0036/00121822.1375675376.146_320.jpg
			//   https://imgs.ototoy.jp/imgs/jacket/0036/00121822.1375675376.146orig.jpg
			// thanks to tathastu871 on github: https://github.com/qsniyg/maxurl/issues/1088
			// https://imgs.ototoy.jp/feature/image.php/2022101901/tobira.jpg?width=721
			//   https://imgs.ototoy.jp/feature/image.php/2022101901/tobira.jpg?width=999999 -- 7370x4913
			return src
				.replace(/(\/imgs\/+jacket\/+[0-9]+\/+[0-9]+\.[0-9]+\.[0-9]+)_[0-9]+(\.[^/.]+)(?:[?#].*)?$/, "$1orig$2")
				.replace(/(\/image\.php\/+[0-9]+\/+[^/?#]+)(?:[?#].*)?$/, "$1?width=999999");
		}

		if (domain === "gl.weburg.net") {
			// https://gl.weburg.net/00/albums/31/152012/66x66/605339.jpg
			//   https://gl.weburg.net/00/albums/31/152012/original/605339.jpg
			// https://gl.weburg.net/00/persons/5/20474/medium/472947.jpg
			//   https://gl.weburg.net/00/persons/5/20474/original/472947.jpg
			// https://gl.weburg.net/00/movies/1/261/66x98/403786.jpg
			//   https://gl.weburg.net/00/movies/1/261/original/403786.jpg
			// https://gl.weburg.net/00/objectannounce/5/21359/article/7507959.jpeg
			//   https://gl.weburg.net/00/objectannounce/5/21359/original/7507959.jpeg
			// https://gl.weburg.net/00/objectannounce/5/20529/wide/7503349.jpg
			//   https://gl.weburg.net/00/objectannounce/5/20529/original/7503349.jpg
			// https://gl.weburg.net/00/news/12/58903/newssame_new/7508208.jpg
			//   https://gl.weburg.net/00/news/12/58903/original/7508208.jpg
			return src.replace(/(\/(?:albums|persons|movies|objectannounce|news)\/+[0-9]+\/+[0-9]+\/+)[^/]+\/+([0-9]+\.)/, "$1original/$2");
		}

		if (domain_nowww === "vgmdownloads.com") {
			// https://vgmdownloads.com/soundtracks/tetris-effect-original-soundtrack-sampler/thumbs/Cover.png
			//   https://vgmdownloads.com/soundtracks/tetris-effect-original-soundtrack-sampler/Cover.png
			// https://vgmdownloads.com/soundtracks/metroid-prime-2-echoes/thumbs/3196-daqmtdngpe.jpg
			//   https://vgmdownloads.com/soundtracks/metroid-prime-2-echoes/3196-daqmtdngpe.jpg -- smaller
			return src.replace(/\/thumbs\/+([^/]+\.[^/.]+)(?:[?#].*)?$/, "/$1");
		}

		if (domain_nowww === "linuxgamepublishing.com") {
			// https://www.linuxgamepublishing.com/images/gamegraphics/40/image90.jpg
			//   https://www.linuxgamepublishing.com/images/gamegraphics/40/image.jpg
			// https://www.linuxgamepublishing.com/images/gamegraphics/40/thumbnail0.jpg
			//   https://www.linuxgamepublishing.com/images/gamegraphics/40/screenshot0.jpg
			return src
				.replace(/(\/images\/+gamegraphics\/+[0-9]+\/+image)[0-9]+(\.[^/.]+)(?:[?#].*)?$/, "$1$2")
				.replace(/(\/images\/+gamegraphics\/+[0-9]+\/+)thumbnail([0-9]+\.[^/.]+)(?:[?#].*)?$/, "$1screenshot$2")
		}

		if (domain_nowww === "kino-teatr.ua") {
			// https://kino-teatr.ua/public/main/persons/x2_photo_586dedfd79e22.jpg
			//   https://kino-teatr.ua/public/main/persons/photo_586dedfd79e22.jpg
			// https://kino-teatr.ua/public/main/films/2020-12/x4_poster_5fdb1aa78dd9e.jpg
			//   https://kino-teatr.ua/public/main/films/2020-12/poster_5fdb1aa78dd9e.jpg
			return src.replace(/(\/public\/+main\/+[^/]+\/+(?:[0-9]{4}-[0-9]{2}\/+)?)x[0-9]*_([a-z]+_[0-9a-f]{5,}\.)/, "$1$2");
		}

		if (domain === "images.findagrave.com") {
			// https://images.findagrave.com/photoThumbnails/photos/2005/226/5579756_112417300044.jpg
			//   https://images.findagrave.com/photos/2005/226/5579756_112417300044.jpg
			// https://images.findagrave.com/photos250/photos/2015/338/5579756_1449374172.jpg
			//   https://images.findagrave.com/photos/2015/338/5579756_1449374172.jpg
			obj = {
				url: src.replace(/\/photo(?:Thumbnails|s[0-9]+)\/+photos\/+/, "/photos/"),
				head_wrong_contentlength: true
			};

			match = src.match(/\/photos\/+[0-9]{4}\/+[0-9]+\/+([0-9]+)_[0-9]+\./);
			if (match) {
				obj.extra = {page: "https://www.findagrave.com/memorial/" + match[1]};
			}

			return obj;
		}

		if (domain_nosub === "watson.de") {
			// https://www.watson.de/imgdb/8fe6/Qx,B,0,0,2336,3504,973,1460,389,584/898171612648624
			//   https://www.watson.de/imgdb/8fe6/898171612648624
			// https://cdn1.watson.de/imgdb/8b65/Qx,E,0,0,6000,4000,2500,1666,1000,666/951439742847276
			//   https://cdn1.watson.de/imgdb/8b65/951439742847276
			return src.replace(/(\/imgdb\/+[0-9a-f]+\/+)[^/]+,[^/]+\/+([0-9]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "img.zvuqa.net") {
			// https://img.zvuqa.net/artist40x40/halsey.jpg
			//   https://img.zvuqa.net/artist-min/halsey.jpg
			return src.replace(/\/artist[0-9]+x[0-9]+\/+/, "/artist-min/");
		}

		if (domain_nowww === "xboxplay.games") {
			// https://xboxplay.games/imagenes/redimensionar2.php?imagen=https://respawnfirst.com/wp-content/uploads/2020/02/Wolcen-Primordial-Affinity.jpg&an=722&al=400
			//   https://respawnfirst.com/wp-content/uploads/2020/02/Wolcen-Primordial-Affinity.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+imagenes\/+redimensionar2\.php\?(?:.*&)?imagen=([^&]+).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "owo.lewd.ninja") {
			// https://owo.lewd.ninja/images/games/3810_1968aee2b8672a3554ce7eeebdc3e28c_thumb.jpg
			//   https://owo.lewd.ninja/images/games/3810_1968aee2b8672a3554ce7eeebdc3e28c.jpg
			// https://owo.lewd.ninja/images/games/b_7035_115f6ceba5cef5d5786aebf89d35248a.png
			//   https://owo.lewd.ninja/images/games/7035_115f6ceba5cef5d5786aebf89d35248a.png
			return src.replace(/(\/images\/+games\/+)(?:[a-z]_)?([0-9]+_[0-9a-f]{10,})(?:_thumb)?(\.[^/.]+)(?:[?#].*)?$/, "$1$2$3");
		}

		if (domain_nowww === "kinogo.by") {
			// https://kinogo.by/uploads/cache/8/8/0/3/6/3/2/7/d/1573951997-628938384-dzhumandzhi-novyy-uroven-KINOGO_BY-200x300.jpg
			//   https://kinogo.by/uploads/posts/2019-11/1573951997-628938384-dzhumandzhi-novyy-uroven-KINOGO_BY.jpg
			// https://kinogo.by/uploads/cache/c/a/8/3/4/b/a/b/4/261272-kinogo-by-200x300.jpg
			//   https://kinogo.by/uploads/posters/261272-kinogo-by.jpg
			match = src.match(/\/uploads\/+cache\/+(?:[0-9a-f]\/+){9}([0-9]+-[^/]+)-[0-9]+x[0-9]+(\.[^/.]+)(?:[?#].*)?$/);
			if (match) {
				obj = [];
				obj.push(src.replace(/\/uploads\/+.*/, "/uploads/posters/" + match[1] + match[2]));

				var match1 = match[1].match(/^([0-9]{10,})-[0-9]+-/);
				if (match1) {
					var date = new Date(parseInt(match1[1]) * 1000);
					obj.push(src.replace(/\/uploads\/.*/, "/uploads/posts/" + date.getUTCFullYear() + "-" + (date.getUTCMonth() + 1) + "/" + match[1] + match[2]));
				}

				return obj;
			}
		}

		if (domain === "ip.bitcointalk.org") {
			// https://ip.bitcointalk.org/?u=https%3A%2F%2Fcarbonmade-media.accelerator.net%2F36648513%3B1920x1080.png&t=610&c=u1C75FAk0XYcBg
			//   https://carbonmade-media.accelerator.net/36648513;1920x1080.png
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+\?(?:.*&)?u=([^&]+).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "cdn.minds.com") {
			// https://cdn.minds.com/api/v2/media/proxy?size=1920&src=https%3A%2F%2Fpbs.twimg.com%2Ftweet_video_thumb%2FERFEzNCWAAMToRx.jpg
			//   https://pbs.twimg.com/tweet_video_thumb/ERFEzNCWAAMToRx.png?name=orig
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+api\/+v2\/+media\/+proxy\?(?:.*&)?src=([^&]+).*?$/, "$1");
			if (newsrc !== src)
				return decodeURIComponent(newsrc);
		}

		if (domain === "carbonmade-media.accelerator.net" ||
			// https://carbon-media.accelerator.net/00000000001/lbPC7JlrUbCbBqxAIlu79M;960x540.mp4
			//   https://carbon-media.accelerator.net/00000000001/lbPC7JlrUbCbBqxAIlu79M;0x.mp4
			//   https://carbon-media.accelerator.net/00000000001/lbPC7JlrUbCbBqxAIlu79M;original.mp4
			domain === "carbon-media.accelerator.net") {
			// {"type":"UnsupportedCommandException","message":"\u0027full()\u0027 does not have an implementation.","stackTrace":"   at Borg.Processor.Canvas.Apply(ICommand command) in E:\\Processor\\src\\Borg.Processor\\Canvas\\Canvas.cs:line 135\r\n   at Borg.Processor.ProcessingController.ProcessInternal(Stream inputStream, MediaInfo source, Pipeline pipeline, Profiler profiler, IReadOnlyDictionary\u00602 sources) in E:\\Processor\\src\\Borg.Processor\\Controllers\\ProcessingController.cs:line 549\r\n   at Borg.Processor.ProcessingController.ProcessInternal(Uri inputUrl, String path, IReadOnlyDictionary\u00602 sources) in E:\\Processor\\src\\Borg.Processor\\Controllers\\ProcessingController.cs:line 371","programVersion":"2.0.0","properties":{"path":"pipe;full().png","source":{"key":"pipe","format":"png","":"Horizontal","width":8000,"height":4500,"frameCount":1},"pipeline":"blob#pipe|\u003Escale(8000,4500)|\u003Efull()|\u003EPNG::encode"}}
			// {"type":"UnsupportedCommandException","message":"\u0027original\u0027 does not have an implementation.","stackTrace":"   at Borg.Processor.Canvas.Apply(ICommand command) in E:\\Processor\\src\\Borg.Processor\\Canvas\\Canvas.cs:line 135\r\n   at Borg.Processor.ProcessingController.ProcessInternal(Stream inputStream, MediaInfo source, Pipeline pipeline, Profiler profiler, IReadOnlyDictionary\u00602 sources) in E:\\Processor\\src\\Borg.Processor\\Controllers\\ProcessingController.cs:line 549\r\n   at Borg.Processor.ProcessingController.ProcessInternal(Uri inputUrl, String path, IReadOnlyDictionary\u00602 sources) in E:\\Processor\\src\\Borg.Processor\\Controllers\\ProcessingController.cs:line 371","programVersion":"2.0.0","properties":{"path":"pipe;original/lossless.webp","source":{"key":"pipe","format":"png","":"Horizontal","width":3338,"height":1410,"frameCount":1},"pipeline":"blob#pipe|\u003Escale(3338,1410)|\u003Eoriginal|\u003EWebP::encode(quality:100)"}}
			// Invalid Pipeline
			//   36648513;.png
			//   May not be empty
			// Invalid Pipeline
			//   36648513;0.png
			//   Specified argument was out of the range of valid values.
			// https://carbonmade-media.accelerator.net/34754698;920x388/lossless.webp
			//   https://carbonmade-media.accelerator.net/34754698;0x0/lossless.webp -- possibly upscaled?
			//   https://carbonmade-media.accelerator.net/34754698;0x/lossless.webp -- 3338x1410
			//   https://carbonmade-media.accelerator.net/34754698;original.webp
			// https://carbonmade-media.accelerator.net/34467736;1280x807.png
			//   https://carbonmade-media.accelerator.net/34467736;0x0.png -- tiny
			//   https://carbonmade-media.accelerator.net/34467736;0x.png -- 1446x912
			//   https://carbonmade-media.accelerator.net/34467736;original.png
			// https://carbonmade-media.accelerator.net/36648513;1920x1080.png
			//   https://carbonmade-media.accelerator.net/36648513;0x.png
			//   https://carbonmade-media.accelerator.net/36648513;original.png
			return src.replace(/(:\/\/[^/]+\/+(?:[0-9]+\/+[^/.]+|[0-9]+));[0-9]*x[0-9]*(?:\/+[^/.]+)?(\.[^/.]+)(?:[?#].*)?$/, "$1;original$2");
		}

		if (domain_nowww === "streamja.com") {
			// https://streamja.com/img/play.png
			if (/\/img\/+play\.png(?:[?#].*)?$/.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}
		}

		if (domain === "img.thedonald.win" && host_domain_nowww === "thedonald.win" && options && options.element) {
			// post thumbnails (todo: implement with https://github.com/qsniyg/maxurl/issues/246)
			if (options.element.parentElement && options.element.parentElement.tagName === "A") {
				var parent = options.element.parentElement;
				var dparent = parent.parentElement;
				if (dparent && dparent.tagName === "DIV" && dparent.classList.contains("thumb")) {
					return parent.href;
				}
			}
		}

		if (host_domain_nowww === "derstandard.at" && options.element) {
			// https://www.derstandard.at/story/2000115095254/firefox-how-mozilla-wants-to-fight-against-googles-dominance
			if (options.element.tagName === "BUTTON" && options.element.classList.contains("figure-fullscreen-trigger")) {
				return {
					url: origsrc,
					bad: "mask"
				};
			}

			if (options.element.parentElement && options.element.parentElement.tagName === "PICTURE") {
				var fullscreen_img = options.element.parentElement.querySelector("img[data-fullscreen-src]");
				if (fullscreen_img) {
					return urljoin(src, fullscreen_img.getAttribute("data-fullscreen-src"), true);
				}
			}
		}

		if (domain === "cl.fame10.com") {
			// https://cl.fame10.com/image/upload/t_cn,f_auto,q_auto,$w_700/f10/2014/03/shutterstock_109340663-450x654.jpg
			//   https://cl.fame10.com/image/upload/f10/2014/03/shutterstock_109340663.jpg
			return src
				.replace(/(\/image\/+upload\/+f10\/+.*)-[0-9]+x[0-9]+(\.[^/.]+)(?:[?#].*)?$/, "$1$2")
				.replace(/\/image\/+upload\/+[^/]+\/+(f10\/+.*)$/, "/image/upload/$1");
		}

		if (domain_nowww === "photo-forum.net") {
			// https://photo-forum.net/imgs_thumbs_200/2020-01/1578941830_17_63.jpg
			//   https://photo-forum.net/imgs/2020-01/1578941830_17_63.jpg
			// https://photo-forum.net/imgs_medium/2020-01/1579624765__mg_1977.jpg
			//   https://photo-forum.net/imgs/2020-01/1579624765__mg_1977.jpg
			// https://photo-forum.net/imgs_thumbs_big/2020-03/1583667100__d7k8233sait.jpg
			//   https://photo-forum.net/imgs/2020-03/1583667100__d7k8233sait.jpg
			// https://photo-forum.net/static/monthlytheme/id125_small.jpg
			//   https://photo-forum.net/static/monthlytheme/id125.jpg
			// https://photo-forum.net/static/media/2020/markishky_lekcia-370px.jpg
			//   https://photo-forum.net/static/media/2020/markishky_lekcia.jpg
			return src
				.replace(/\/imgs_(?:thumbs_(?:[0-9]+|[a-z]+)|medium)\/+/, "/imgs/")
				.replace(/(\/static\/+monthlytheme\/+id[0-9]+)_small(\.[^/.]+)(?:[?#].*)?$/, "$1$2")
				.replace(/(\/static\/+media\/+[0-9]{4}\/+[^/]+)-[0-9]+px(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "photoforum.ru") {
			// https://www.photoforum.ru/photo/873742/index.en.html
			// https://www.photoforum.ru/f/photo.thsq/000/873/873742_50.thsq.jpg
			//   https://www.photoforum.ru/f/photo/000/873/873742_50.jpg
			// https://www.photoforum.ru/f/portr.th/000/039/39782_42.th.jpg
			//   https://www.photoforum.ru/f/portr/000/039/39782_42.jpg
			return src.replace(/(\/f\/+(?:photo|portr))\.([^/]+)(\/+[0-9]{3}\/+[0-9]{3}\/+[0-9]+_[0-9]+)\.\2(\.[^/.]+)(?:[?#].*)?$/, "$1$3$4");
		}

		if (domain_nowww === "clippituser.tv") {
			// https://www.clippituser.tv/static/2.16.0-345/images/small_play_btn.png
			if (/\/static\/+[^/]+\/+images\/+small_play_btn\./.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}
		}

		if (domain === "clips.clippit.tv") {
			// https://clips.clippit.tv/evmgm/thumbnail.jpg
			//   https://clips.clippit.tv/evmgm/360.mp4
			//   https://clips.clippit.tv/evmgm/720.mp4
			obj = {url: src};
			id = null;

			match = src.match(/:\/\/[^/]+\/+([^/]+)\/+/);
			if (match) {
				id = match[1];
				obj.extra = {page: "https://www.clippituser.tv/c/" + id};
			}

			if (/\/360\.mp4(?:[?#].*)?$/.test(src)) {
				obj.url = src.replace(/\/[0-9]+(\.[^/.]+)(?:[?#].*)?$/, "/720$1");
				return obj;
			}

			if (/\/thumbnail\.jpg(?:[?#].*)?$/.test(src)) {
				obj.url = src.replace(/\/thumbnail\.jpg(?:[?#].*)?$/, "/360.mp4");
				return obj;
			}

			return obj;
		}

		if (amazon_container === "clippit-prod") {
			// https://clippit-prod.s3.amazonaws.com/media/profiles/5515/1440115184.jpg.100x100_q85_crop-scale_upscale.jpg
			//   https://clippit-prod.s3.amazonaws.com/media/profiles/5515/1440115184.jpg
			return src.replace(/(\/media\/+profiles\/+[0-9]+\/+[0-9]+\.[^/.]+)(?:\.[^/]+\.[^/.]+)(?:[?#].*)?$/, "$1");
		}

		if (domain_nowww === "porntrex.com" ||
			// https://fapster.xxx/player/skin/img/play_white.png
			domain_nowww === "fapster.xxx" ||
			// https://fapality.com/player/skin/img/play_white.png
			domain_nowww === "fapality.com" ||
			// https://www.okporn.com/player/skin/img/play_white.png
			domain_nowww === "okporn.com" ||
			// http://storage.hegre.com/HegreAnnaSPorcelainDoll/skin/img/play_white.png
			domain === "storage.hegre.com" ||
			// https://www.pornalin.com/player/skin/img/play_white.png
			domain_nowww === "pornalin.com" ||
			// https://www.milffox.com/player/skin/img/play_white.png
			domain_nowww === "milffox.com" ||
			// https://www.pornrewind.com/player/skin/img/play_white.png
			domain_nowww === "pornrewind.com") {
			// https://www.porntrex.com/player/skin/img/play_white.png
			if (/\/skin\/+img\/+play_/.test(src))
				return {
					url: src,
					bad: "mask"
				};
		}

		if (domain === "cf-st.sc-cdn.net") {
			// https://cf-st.sc-cdn.net/aps/bolt/aHR0cHM6Ly9jZi1zdC5zYy1jZG4ubmV0L2JvbHQtcHJvZC1zMy11cy1lYXN0LTEvTTBlNTFuVmhfMHJGQkx3eWtBZ041ekxxbmpVUUNZ._RS0,90_FMjpeg
			//   https://cf-st.sc-cdn.net/bolt-prod-s3-us-east-1/M0e51nVh_0rFBLwykAgN5zLqnjUQCY
			// https://cf-st.sc-cdn.net/aps/bolt_web/aHR0cHM6Ly9j[...]._RS48,72_FMwebp
			// bolt-prod-s3-us-east-1 seems to be the name of the bucket itself (not bold-prod.s3...)
			match = src.match(/:\/\/[^/]+\/+aps\/+bolt(?:_web)?\/+(aHR0c[^/.]{20,})\.[^/.]+(?:[?#].*)?$/);
			if (match)
				return base64_decode(match[1]);
		}

		if (domain === "s.sc-cdn.net") {
			obj = {
				url: src
			};

			common_functions["snap_norm_obj"](obj);

			// awful hack but whatever
			if (host_domain_nosub === "snapchat.com")
				obj.need_blob = true;

			// https://s.sc-cdn.net/1d/feXwf0gm4YfDw_mUoddLXnEWB9n8Fo3vx94Zol9wxJc=/default/preview.jpg
			//   https://s.sc-cdn.net/1d/Pf3Qi0hkJmeUxsOnJRs777PbJnN_3cv4LMvMZ3FZ8Yc=/default/media.mp4
			// /default/preview_overlay.jpg exists, but media_overlay doesn't exist
			var out_fn = "media";
			if (options.rule_specific && !options.rule_specific.snapchat_orig_media) {
				out_fn = "embedded";
			}

			newsrc = src.replace(/\/default\/+(?:embedded|media|preview(?:_overlay)?)\.(?:jpg|mp4)(?:[?#].*)?$/, "/default/" + out_fn + ".mp4");
			if (newsrc !== src) {
				var full = add_full_extensions(newsrc, ["mp4", "jpg"], true);

				return fillobj_urls(full, obj);
			}

			// https://s.sc-cdn.net/1d/NTegWFoU9mC8cYucFvrJOx4Hn0e4TwTqiTRA97esETg=/default/overlay.png
			if (false && /\/default\/+overlay\.jpg(?:[?#].*)?$/.test(src)) {
				// best case would be if they were somehow merged or something
				return {
					url: src,
					bad: "mask"
				};
			}

			return obj;
		}

		if (host_domain_nosub === "snapchat.com" && options.do_request && options.cb && options.element) {
			// https://www.snapchat.com/add/jordynjones11
			// https://story.snapchat.com/s/jordynjones11
			var info = common_functions["get_snapchat_info_from_el"](options.element);
			if (info) {
				common_functions["get_obj_from_snap_info"](api_cache, options.do_request, info, options.cb);

				return {
					waiting: true
				};
			}

			if (!src && options.element.tagName === "VIDEO") {
				let source_els = options.element.querySelectorAll("source");
				let sources = [];
				for (let source of source_els) {
					array_upush(sources, source.getAttribute("src"));
				}
				if (sources[0]) {
					let is_hls = /\.m3u8/.test(sources[0]);
					return {
						url: sources[0],
						video: is_hls ? "hls" : true,
						need_blob: !is_hls
					};
				}
			}

			if (src && /\.mp4/.test(src)) {
				return {
					url: src,
					need_blob: true
				};
			} else {
				return null;
			}
		}

		if (domain === "soup.onerpm.com") {
			// thanks to nimuxoha on github: https://github.com/qsniyg/maxurl/issues/271
			// https://onerpm.com/disco/album?album_number=4838993301
			// https://soup.onerpm.com/web/user/images/1/aa/aaEQyKG8aZIjzBaQ6Q7D.200.jpg
			//   https://soup.onerpm.com/web/user/images/1/aa/aaEQyKG8aZIjzBaQ6Q7D.orig.jpg
			// https://soup.onerpm.com/web/user/content/1/aa/aaEQyKG8aZIjzBaQ6Q7D.200.jpg
			//   https://soup.onerpm.com/web/user/content/1/aa/aaEQyKG8aZIjzBaQ6Q7D.orig.jpg
			return src.replace(/(\/web\/+user\/+(?:images|content)\/+.\/+..\/+[^/]+\.)[0-9]+(\.[^/.]+)(?:[?#].*)?$/, "$1orig$2");
		}

		if (domain_nosub === "crank-in.net") {
			// thanks to fireattack on github: https://github.com/qsniyg/maxurl/issues/272
			// https://www.crank-in.net/news/75056/1
			// https://www.crank-in.net/img/db/1386421_150.jpg
			//   https://www.crank-in.net/img/db/1386421_650.jpg
			//   https://www.crank-in.net/img/db/1386421_1200.jpg
			// https://m.crank-in.net/img/db/1294425_150.jpg
			//   https://m.crank-in.net/img/db/1294425_1200.jpg -- upscaled
			// other:
			// https://m.crank-in.net/img/sp/images/_DSC0097.JPG
			// https://www.crank-in.net/img/sp/images/20120711_zaf_k03_064.jpg
			// https://www.crank-in.net/img/sp/images/KHolmes100512_14_X17.JPG
			newsrc = src.replace(/(\/img\/+db\/+[0-9]+)_(?:[0-9]{3}|1[01][0-9]{2})(\.[^/.]+)(?:[?#].*)?$/, "$1_1200$2");
			if (newsrc !== src) {
				return {
					url: newsrc,
					problems: {
						possibly_upscaled: true
					}
				};
			}
		}

		if (domain === "hs.mediadelivery.fi" ||
			// https://is.mediadelivery.fi/img/658/0fc78cb8a1474ec2b20d891a8e033b37.jpg
			// thanks to fyhtma on github: https://github.com/qsniyg/maxurl/issues/270
			// https://is.mediadelivery.fi/img/1920/0fc78cb8a1474ec2b20d891a8e033b37.jpg.webp
			//   https://is.mediadelivery.fi/img/1920/0fc78cb8a1474ec2b20d891a8e033b37.jpg
			domain === "is.mediadelivery.fi") {
			// thanks to thomas-ed on github: https://github.com/qsniyg/maxurl/issues/270
			// https://www.hs.fi/talous/art-2000006442426.html
			// https://hs.mediadelivery.fi/img/658/9121cba7d33948309c52ff5691581cec.jpg
			//   https://hs.mediadelivery.fi/img/1920/9121cba7d33948309c52ff5691581cec.jpg
			// https://www.is.fi/kotimaa/art-2000006441004.html
			//   https://is.mediadelivery.fi/img/658/0fc78cb8a1474ec2b20d891a8e033b37.jpg
			//   https://is.mediadelivery.fi/img/1920/0fc78cb8a1474ec2b20d891a8e033b37.jpg
			// https://hs.mediadelivery.fi/img/1440/adc2268f4e0442b2843abd5166ed8ed3.jpg
			//   https://hs.mediadelivery.fi/img/1920/adc2268f4e0442b2843abd5166ed8ed3.jpg -- upscaled
			// https://hs.mediadelivery.fi/img/square/1440/d279bcab15194b45b4654246d69adb25.jpg.webp
			//   https://hs.mediadelivery.fi/img/square/1920/d279bcab15194b45b4654246d69adb25.jpg.webp
			newsrc = src.replace(/(\/img\/+(?:square\/+)?)(?:[0-9]{3}|1[0-8][0-9]{2})\//, "$11920/");
			if (newsrc === src) {
				newsrc = src.replace(/(\.[a-z]+)\.webp(?:[?#].*)?$/, "$1");
				if (newsrc !== src)
					return newsrc;
			}
			if (newsrc !== src) {
				return {
					url: newsrc,
					problems: {
						possibly_upscaled: true
					}
				};
			}
		}

		if (domain === "cdn.cdkeys.com" ||
			// thanks to MinuteAd8502 on github: https://github.com/qsniyg/maxurl/issues/846
			// https://media.sssports.com/630x630/media/catalog/product/1/9/192564613144_1.jpg
			//   https://media.sssports.com/media/catalog/product/1/9/192564613144_1.jpg
			domain === "media.sssports.com") {
			// http://cdn.cdkeys.com/500x706/media/catalog/product/t/h/the_technomancer_cover_large.jpg -- upscaled?
			//   http://cdn.cdkeys.com/media/catalog/product/t/h/the_technomancer_cover_large.jpg
			return src.replace(/(:\/\/[^/]+\/+)[0-9]+x[0-9]+\/+media\//, "$1media/");
		}

		if (domain_nowww === "impericon.com") {
			// thanks to anonymous for reporting:
			// https://www.impericon.com/432x624x90/media/catalog/product/2/0/20180523_jeff_buckley_lp_lg.jpg
			//   https://www.impericon.com/media/catalog/product/2/0/20180523_jeff_buckley_lp_lg.jpg
			return src.replace(/(:\/\/[^/]+\/+)[0-9]+x[0-9]+x[0-9]+\/+media\//, "$1media/");
		}

		if (domain === "d1466nnw0ex81e.cloudfront.net") {
			// https://d1466nnw0ex81e.cloudfront.net/n_ii/1200/1326121.jpg
			//   https://d1466nnw0ex81e.cloudfront.net/n_ii/originalimage/1326121.jpg
			// other:
			// http://d1466nnw0ex81e.cloudfront.net/n_iv/600/3737195.jpg -- originalimage doesn't work, even when replacing n_iv to n_ii
			return src.replace(/\/n_ii\/+[0-9]+\/+/, "/n_ii/originalimage/");
		}

		if (domain === "assets.upflix.pl") {
			// https://assets.upflix.pl/media/zwiastun/2019/ad-astra-antenna-clip-20th-century-fox__177_119.jpg
			//   https://assets.upflix.pl/media/zwiastun/2019/ad-astra-antenna-clip-20th-century-fox.jpg
			return src.replace(/(\/media\/.*)__[0-9]+_[0-9]+(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "enfilme.com") {
			// https://enfilme.com/img/content/ad_astra_Enfilme_8021e_170_96.jpg
			//   https://enfilme.com/img/content/ad_astra_Enfilme_8021e.jpg
			return src.replace(/(\/img\/+content\/+[^/]+_[0-9a-f]+)_[0-9]+_[0-9]+(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "koha.net") {
			// https://www.koha.net/uploads/images/2019/September/22/250x140_Kino22shtator1569148891.jpg
			//   https://www.koha.net/uploads/images/2019/September/22/Kino22shtator1569148891.jpg
			return src.replace(/(\/uploads\/+images\/+[0-9]{4}\/+[A-Za-z]+\/+[0-9]+\/+)[0-9]+x[0-9]+_/, "$1");
		}

		if (domain_nowww === "nrwkino.de" ||
			// https://www.biograph.de/img/w230/upload/stills/ad-astra.jpg
			//   https://www.biograph.de/upload/stills/ad-astra.jpg
			domain_nowww === "biograph.de") {
			// https://nrwkino.de/img.php?src=/upload%2Fimages%2FLe+Tellier.jpg&width=500
			//   https://nrwkino.de/upload/images/Le%20Tellier.jpg
			// https://nrwkino.de/img/w230/upload/stills/die-perfekte-kandidatin.jpg
			//   https://nrwkino.de/upload/stills/die-perfekte-kandidatin.jpg
			newsrc = src.replace(/.*\/img\.php\?(?:.*&)?src=([^&]+).*?$/, "$1");
			if (newsrc !== src) {
				return urljoin(src, decodeURIComponent(newsrc.replace(/\+/g, "%20")), true);
			}

			return src.replace(/\/img\/+[wh][0-9]+\/+upload\/+/, "/upload/");
		}

		if (domain === "img.lap.recochoku.jp") {
			// thanks to fireattack on github: https://github.com/qsniyg/maxurl/issues/276
			// https://img.lap.recochoku.jp/imgicb?p=/common/store/img.gif
			// https://img.lap.recochoku.jp/imgicb?p=/common/store/boxa2_b.gif
			// https://img.lap.recochoku.jp/imgicb?p=/common/store_sp/b.png
			newsrc = decodeURIComponent(src);
			if (/common\/+store(?:_[^/]+)?\/+[^/]+\.(?:gif|png)(?:[?#].*)?$/.test(src))
				return {
					url: src,
					bad: "mask"
				};

			// some info:
			// type 例外レポート
			// メッセージ For input string: "999999999999"
			// 説明 The server encountered an internal error that prevented it from fulfilling this request.
			// 例外
			// java.lang.NumberFormatException: For input string: "999999999999"
			//	java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
			//	java.lang.Integer.parseInt(Integer.java:583)
			//	java.lang.Integer.parseInt(Integer.java:615)
			//	recochoku.fpgapp.user.servlet.FPGImageKpBinaryServlet.doGet(FPGImageKpBinaryServlet.java:111)
			//	javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
			//	javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
			//	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
			// 注意 原因のすべてのスタックトレースは、Apache Tomcat/8.0.24のログに記録されています

			// https://img.lap.recochoku.jp/p1/imgkp?p=%2F14%2F657%2F194657.jpg&f=736E79&FFh=300&FFw=300&h=4709E&option=FFenl%3Don
			//   https://img.lap.recochoku.jp/p1/imgkp?p=%2F14%2F657%2F194657.jpg&f=736E79&FFh=300&FFw=300
			//   https://img.lap.recochoku.jp/p1/imgkp?p=%2F14%2F657%2F194657.jpg&f=736E79&FFh=999999999&FFw=999999999
			// https://img.lap.recochoku.jp/p1/imgkp?p=%2F12%2F9512%2F157791228.jpg&f=736E79&FFh=300&FFw=300&h=258B7&option=FFenl%3Don
			//   https://img.lap.recochoku.jp/p1/imgkp?p=%2F12%2F9512%2F157791228.jpg&f=736E79&FFh=999999999&FFw=999999999
			// other:
			// https://resource.lap.recochoku.jp/e13/project/dc70fe2e-3395-4073-9155-19fa999ad161.jpg
			// https://resource.lap.recochoku.jp/e13/media/0044ac26-66e2-4dd5-ac95-812c28790d5c.jpg
			// https://recruit.recochoku.jp/images/interview405.jpg
			// https://club-pro-recochoku-jp-res.cloudinary.com/image/upload/UOEHsbBXZakqHcfvd_MavxzDthIKdBuiE1L83Qk3J2o1i67fUr6auvs4ETqZZwJD/sni872mjls7ruik6fu7j.jpg
			if (/\/p1\/+imgkp\?/.test(src)) {
				var queries = get_queries(keep_queries(src, ["f", "FFh", "FFw", "p"]));
				for (var query in queries) {
					if (query === "FFh" || query === "FFw") {
						queries[query] = "999999999";
					}
				}

				if (queries) {
					newsrc = src.replace(/\?.*/, "") + "?" + stringify_queries(queries);
					if (newsrc !== src)
						return newsrc;
				}
			}
		}

		if (domain === "s.akb48.co.jp") {
			// https://s.akb48.co.jp/sns240/29/a2b9312303bff8bed00d7d10f5d9a3fa.jpeg
			//   https://s.akb48.co.jp/sns/29/a2b9312303bff8bed00d7d10f5d9a3fa.jpeg
			// doesn't work for all:
			// https://www.akb48.co.jp/about/members/detail.php?mid=51
			// https://s.akb48.co.jp/sns240/51/f20715fc38f4887302ea21392e780f69.jpeg
			//   https://s.akb48.co.jp/sns/51/d4a7818f902ee067dbae15a36326d2df.jpeg
			// could be fixed by querying:
			// POST https://www.akb48.co.jp/public/api/snstimelines/
			// start=18&limit=9&members=51
			return src.replace(/(:\/\/[^/]+\/+)sns[0-9]+\/+/, "$1sns/");
		}

		if (domain_nowww === "16bit.pl") {
			// https://16bit.pl/download/games/screens/max-payne/t1.jpg
			//   https://16bit.pl/download/games/screens/max-payne/1.png
			newsrc = src.replace(/(\/download\/+games\/+screens\/+[^/]+\/+)t([0-9]+\.[^/.]+)(?:[?#].*)?$/, "$1$2");
			if (newsrc !== src)
				return add_extensions(newsrc);
		}

		if (domain_nowww === "beeg.com") {
			match = src.match(/^[a-z]+:\/\/[^/]+\/+([0-9]+)(?:[?#].*)?$/);
			if (match) {
				id = match[1];

				var get_params_from_beeg_url = function(url) {
					var match = url.match(/[?&]t=([0-9]+(?:-[0-9]+)?)/);
					if (!match) {
						return null;
					}

					splitted = match[1].split("-");
					params = {
						start: splitted[0],
						end: splitted[1]
					};

					return params;
				};

				var get_beeg_url = function(id, params) {
					var beeg_url = "https://beeg.com/" + id;

					if (params && params.start) {
						beeg_url += "?t=" + params.start;
						if (params.end) {
							beeg_url += "-" + params.end;
						}
					}

					return beeg_url;
				};

				var get_beeg_finalurl_for_src = function(src,  cb) {
					api_query("beeg_finalurl:" + src, {
						url: src
					}, cb, function(done, resp, cache_key) {
						api_cache.set("beeg_finalurl:" + resp.finalUrl, resp.finalUrl, 6*60*60);
						done(resp.finalUrl, 6*60*60);
					});
				}

				var query_beeg_api = function(id, params, cb) {
					var api_url = "https://beeg.com/api/v6/" + Date.now() + "/video/" + id + "?v=2";
					var referer_url = get_beeg_url(id, params);
					var cache_key = "beeg:" + id;

					if (params && params.start) {
						api_url += "&s=" + params.start;
						cache_key += "-" + params.start;
						if (params.end) {
							api_url += "&e=" + params.end;
							cache_key += "-" + params.end;
						}
					}

					api_query(cache_key, {
						url: api_url,
						headers: {
							Accept: "*/*",
							Referer: referer_url,
							"X-Requested-With": "XMLHttpRequest"
						},
						json: true
					}, cb, function(done, resp, cache_key) {
						done(resp, 60*60);
					});
				};

				page_nullobj = {
					url: src,
					is_pagelink: true
				};

				var get_obj_from_beeg = function(data) {
					if (!data)
						return page_nullobj;

					var baseobj = {
						extra: {
							page: get_beeg_url(data.id, data),
							caption: data.title
						}
					};

					baseobj.headers = {
						Referer: baseobj.extra.page,
						"Sec-Fetch-Dest": "video"
					};

					var base_urls = [];
					var data_markers = "data=pc_US__" + data.bundle_version + "_";
					for (var key in data) {
						if (!data[key] || string_indexof(data[key], "video.beeg.com") < 0)
							continue;

						var keymatch = key.match(/^([0-9]+)p$/);
						if (keymatch) {
							base_urls.push({
								size: parseInt(keymatch[1]),
								url: urljoin("https://beeg.com/", data[key].replace("{DATA_MARKERS}", data_markers), true)
							});
						}
					}

					base_urls.sort(function(a, b) {
						return b.size - a.size;
					});

					var urls = [];
					for (var i = 0; i < base_urls.length; i++) {
						urls.push(base_urls[i].url);
					}

					urls.push(page_nullobj);

					return fillobj_urls(urls, baseobj);
				}

				if (options.do_request && options.cb) {
					// https://beeg.com/1272648 redirects to https://beeg.com/1634136624?t=5-605
					get_beeg_finalurl_for_src(src, function(newsrc) {
						if (newsrc && newsrc !== src) {
							return options.cb({
								url: newsrc,
								is_pagelink: true
							});
						}

						query_beeg_api(id, null, function(data) {
							if (!data) {
								query_beeg_api(id, get_params_from_beeg_url(src), function(data) {
									return options.cb(get_obj_from_beeg(data));
								});
							} else {
								return options.cb(get_obj_from_beeg(data));
							}
						});
					});

					return {
						waiting: true
					};
				} else {
					return page_nullobj;
				}
			}
		}

		if (host_domain_nowww === "beeg.com" && domain === "img.beeg.com" && options.element) {
			newsrc = common_functions["get_pagelink_el_matching"](options.element, /^[a-z]+:\/\/(?:www\.)?beeg\.com\/+[0-9]+/);
			if (newsrc) return newsrc;
		}

		if (domain === "vp.beeg.com") {
			match = src.match(/:\/\/[^/]+\/+vp\/+[0-9]{2}\/+([0-9]+)_([0-9]+)_([0-9]+)\.mp4/);
			if (match) {
				id = match[1];
				var url = "https://www.beeg.com/" + match[1];

				if (match[2] !== "0") {
					url += "?t=" + match[2];

					if (match[3] !== "0") {
						url += "-" + match[3];
					}
				}

				return {
					url: url,
					is_pagelink: true
				};
			}
		}

		if (false && domain === "vp.beeg.com") {
			// https://img.beeg.com/264x198/4x3/99833-0075.jpg
			// https://vp.beeg.com/vp/19/1989513890_74_0.mp4
			// https://beeg.com/api/v6/[time]]/video/1989513890?v=2
			id = null;
			match = src.match(/:\/\/[^/]+\/+vp\/+[0-9]{2}\/+([0-9]+)_[0-9]+_[0-9]+\.mp4/);
			if (match) {
				id = match[1];
			}

			if (id && options.do_request && options.cb) {
				api_cache.fetch("beeg:" + id, options.cb, function(done) {
					options.do_request({
						url: "https://beeg.com/api/v6/" + Date.now() + "/video/" + id + "?v=2",
						method: "GET",
						headers: {
							Referer: "https://beeg.com/" + id,
							"X-Requested-With": "XMLHttpRequest"
						},
						onload: function(resp) {
							if (resp.readyState !== 4)
								return;

							if (resp.status !== 200) {
								console_error(resp);
								return done(null, false);
							}

							try {
								var json = JSON_parse(resp.responseText);
								var maxp = 0;
								var maxurl = null;
								for (var key in json) {
									var match = key.match(/^([0-9]+)p/);
									if (!match || !json[key])
										continue;

									var our_p = parseInt(match[1]);
									if (string_indexof(json[key], "//video.beeg.com/") < 0)
										continue;

									if (our_p > maxp) {
										maxp = our_p;
										maxurl = json[key];
									}
								}

								if (maxurl) {
									maxurl = maxurl.replace(/{DATA_MARKERS}/, "data=pc_US__" + Date.now() + "_");
									maxurl = urljoin("https://beeg.com/", maxurl, true);
									return done({
										url: maxurl,
										is_private: true,
										video: true
									}, 2*60*60); // expires in 3 hours
								} else {
									return done(null, false);
								}
							} catch (e) {
								console_error(e, resp);
								return done(null, false);
							}
						}
					});
				});

				return {
					waiting: true
				};
			}
		}

		if (host_domain_nowww === "dogpile.com" && domain_nosub === "bing.net" && /^ts[^.]+\.mm\./.test(domain) && options && options.element) {
			if (options.element.tagName === "IMG" && options.element.parentElement && options.element.parentElement.tagName === "A") {
				if (options.element.parentElement.classList.contains("link")) {
					var parent = options.element.parentElement;
					if (parent.parentElement && parent.parentElement.classList.contains("image")) {
						if (parent.href !== src)
							return parent.href;
					}
				}
			}
		}

		if (host_domain_nowww === "yippy.com" && domain_nosub === "bing.net" && /^ts[^.]+\.mm\./.test(domain) && options && options.element) {
			if (options.element.tagName === "IMG" && options.element.parentElement && options.element.parentElement.tagName === "DIV") {
				var parent = options.element.parentElement;
				if (parent.classList.contains("media-box-thumbnail-container") && parent.parentElement) {
					var dparent = parent.parentElement;
					newsrc = dparent.getAttribute("data-mfp-src");
					if (newsrc && newsrc !== src) {
						return newsrc;
					}
				}
			}
		}

		if (host_domain_nowww === "gigablast.com" && options && options.element) {
			if (options.element.tagName === "IMG" && options.element.parentElement && options.element.parentElement.tagName === "A") {
				var parent = options.element.parentElement;
				var current = parent;
				while ((current = current.parentElement)) {
					if (current.tagName === "TABLE" && current.classList.contains("image")) {
						if (parent.href !== origsrc) {
							return parent.href;
						} else {
							break;
						}
					}
				}
			}
		}

		if (host_domain_nowww === "ecosia.org" && options && options.element) {
			if (options.element.tagName === "IMG" && options.element.parentElement && options.element.parentElement.tagName === "A") {
				var parent = options.element.parentElement;
				if (parent.classList.contains("image-result")) {
					if (parent.href !== src) {
						return parent.href;
					}
				}
			}
		}

		if (domain === "spapi.searchencrypt.com") {
			// https://spapi.searchencrypt.com/image?path=https%3a%2f%2fassets.mocha.global%2fmobicast%2fimage%2ffetch%2fw_144%2cq_40%2fhttps%253A%252F%252Fr.kelkoo.com%252Fresize.php%253Fcountry%253Dde%2526merchantId%253D16240913%2526categoryId%253D134101%2526width%253D90%2526height%253D90%2526image%253Dhttps%25253A%25252F%25252Fstatic.shop-apotheke.com%25252Fimages%25252FD12391508-p1.jpg%2526sign%253DESE.mSGBandnnojBPJJ9hgnoooEByCwODsLQPH42iEY-
			//   https://assets.mocha.global/mobicast/image/fetch/w_144,q_40/https%3A%2F%2Fr.kelkoo.com%2Fresize.php%3Fcountry%3Dde%26merchantId%3D16240913%26categoryId%3D134101%26width%3D90%26height%3D90%26image%3Dhttps%253A%252F%252Fstatic.shop-apotheke.com%252Fimages%252FD12391508-p1.jpg%26sign%3DESE.mSGBandnnojBPJJ9hgnoooEByCwODsLQPH42iEY-
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+image\?(?:.*&)?path=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nowww === "boardreader.com") {
			// http://boardreader.com/img/placeholder.gif
			if (/\/img\/+placeholder\.gif/.test(src))
				return {
					url: src,
					bad: "mask"
				};
		}

		if (domain === "imgproxy.geocaching.com") {
			// https://imgproxy.geocaching.com/4a4effd23058f88035e11486566206eff8c7a450?url=http%3A%2F%2Fwww.wolframcdn.com%2Fwaimage%2Fhset004%2F9cd%2F9cd21927d7d18a362f52e341a5139439_v001ms.jpg
			//   https://www.wolframcdn.com/waimage/hset004/9cd/9cd21927d7d18a362f52e341a5139439_v001ms.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+[0-9a-f]{10,}\?(?:.*?&)?url=([^&]+).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nowww === "wolframcdn.com") {
			// https://www.wolframcdn.com/waimage/hset028/ee6/ee6999178a59095cc994a656ade3c1ec_v001s.jpg
			//   https://www.wolframcdn.com/waimage/hset028/ee6/ee6999178a59095cc994a656ade3c1ec_v001ms.jpg
			return src.replace(/(\/waimage\/.*_v[0-9]+)s(\.[^/.]+)(?:[?#].*)?$/, "$1ms$2");
		}

		if (domain_nowww === "allthetests.com") {
			// https://www.allthetests.com/quiz30/picture_thumb/pic_1364087542_1.jpg?1364087929
			return src.replace(/\/picture_thumb\/+pic_/, "/picture/pic_");
		}

		if (domain_nowww === "dicelacancion.com") {
			// https://www.dicelacancion.com/static/img/artistas/s/selena-gomez/selena-gomez_b.jpg
			//   https://www.dicelacancion.com/static/img/artistas/s/selena-gomez/selena-gomez_m.jpg
			//   https://www.dicelacancion.com/static/img/artistas/s/selena-gomez/selena-gomez_l.jpg -- 500x500
			//   https://www.dicelacancion.com/static/img/artistas/s/selena-gomez/selena-gomez_o.jpg -- 500x500
			// https://www.dicelacancion.com/static/img/artistas/f/farruko/farruko_o.jpg -- 600x600 (l is the same)
			// {o, l}, b, m
			return src.replace(/(\/static\/+img\/+[^/]+\/+.\/+[^/]+\/+[^/]+)_[lbm](\.[^/.]+)(?:[?#].*)?$/, "$1_o$2");
		}

		if (domain === "static.pressfrom.info") {
			// https://static.pressfrom.info/upload/images/small/2019/06/18/instagram-s-boss-says-he-s-disappointed-that-selena-gomez-deleted-the-app-from-her-phone__618261_.jpg
			//   https://static.pressfrom.info/upload/images/real/2019/06/18/instagram-s-boss-says-he-s-disappointed-that-selena-gomez-deleted-the-app-from-her-phone__618261_.jpg
			return src.replace(/\/upload\/+images\/+small\/+/, "/upload/images/real/");
		}

		if (domain_nowww === "shadestation.co.uk") {
			// http://www.shadestation.co.uk/media/thumbs/138x138/media/product_images/Cute-Selena-Gomez-Sunglasses-Designfw138fh138.jpg
			//   http://www.shadestation.co.uk/media/product_images/Cute-Selena-Gomez-Sunglasses-Design.jpg
			return src.replace(/\/media\/+thumbs\/+[0-9]+x[0-9]+\/+(media\/+product_images\/+[^/]+)fw[0-9]+fh[0-9]+(\.[^/.]+)(?:[?#].*)?$/, "/$1$2");
		}

		if (domain === "image.ceneostatic.pl") {
			// https://image.ceneostatic.pl/offercandidates/9QDgAGdodHRwczovL2ltZy1jbG91ZC5tZWdha3NpYXpraS5wbC80OTYxNzctbGFyZ2UvZDc3Yzg4MzhkMmYyY2E4OTE4NTRhYjViNmM3ZjQ3YmUvc2VsZW5hLWdvbWV6LXJhcmUtY2QuanBn
			//   https://img-cloud.megaksiazki.pl/496177-large/d77c8838d2f2ca891854ab5b6c7f47be/selena-gomez-rare-cd.jpg
			// https://image.ceneostatic.pl/offercandidates/9QDgAERodHRwczovL21lZGlhLm1lcmxpbi5wbC9tZWRpYS9vcmlnaW5hbC8wMDAvMDE2LzMzMy81ZTQ1NmI0OTAxYjc1LmpwZw%3D%3D
			//   https://media.merlin.pl/media/original/000/016/333/5e456b4901b75.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+offercandidates\/+([^/?#]{30,})(?:[?#].*)?$/, "$1");
			if (newsrc != src) {
				var decoded = base64_decode(decodeURIComponent(newsrc));
				// it begins with binary data
				newsrc = decoded.replace(/.*(https?:\/\/)/, "$1");
				if (newsrc.match(/^https?:\/\//)) {
					return newsrc;
				}
			}
		}

		if (domain === "img-cloud.megaksiazki.pl") {
			// https://img-cloud.megaksiazki.pl/496177-small/d77c8838d2f2ca891854ab5b6c7f47be/selena-gomez-rare-cd.jpg
			//   https://img-cloud.megaksiazki.pl/496177-large/d77c8838d2f2ca891854ab5b6c7f47be/selena-gomez-rare-cd.jpg
			//   https://img-cloud.megaksiazki.pl/496177-original/d77c8838d2f2ca891854ab5b6c7f47be/selena-gomez-rare-cd.jpg
			return src.replace(/(:\/\/[^/]+\/+[0-9]+-)[a-z]+\/+([0-9a-f]{10,}\/+)/, "$1original/$2");
		}

		if (domain_nowww === "e-onkyo.com") {
			// https://www.e-onkyo.com/image/jacket/s5/uml00602508682957.jpg -- 30x30
			//   https://www.e-onkyo.com/image/jacket/s0/uml00602508682957.jpg -- 600x600
			return src.replace(/\/image\/+jacket\/+s[1-5]\/+/, "/image/jacket/s0/");
		}

		if (domain_nowww === "ubuy.qa") {
			// https://www.ubuy.qa/productimg/?image=aHR0cHM6Ly9pLmViYXlpbWcuY29tL3RodW1icy9pbWFnZXMvZy9uWHdBQU9Td3RDTmVGRjNCL3MtbDIyNS5qcGc.jpg
			//   https://i.ebayimg.com/images/g/nXwAAOSwtCNeFF3B/s-l9999.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+productimg\/+\?(?:.*&)?image=([^&.]+)(?:\.[^/.&]+)?.*?$/, "$1");
			if (newsrc !== src)
				return base64_decode(decodeURIComponent(newsrc));
		}

		if (domain === "web.rds.it") {
			// https://web.rds.it/i/jpeg/?url=https://web.rds.it/m/i4376
			//   https://web.rds.it/m/i4376
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+i\/+[^/]+\/+\?(?:.*&)?url=([^&]+).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "media.loot.co.za") {
			// https://media.loot.co.za/images/x120/7756832250603179215.jpg
			//   https://media.loot.co.za/images/x400/7756832250603179215.jpg
			return src.replace(/(:\/\/[^/]+\/+images\/+)x(?:40|80|120|200)\/+/, "$1x400/");
		}

		if (domain === "img.ibs.it") {
			// https://img.ibs.it/images/0602508561719_0_240_0_0.jpg -- 240x240
			//   https://img.ibs.it/images/0602508561719_0_0_0_0.jpg -- 822x823
			// https://img.ibs.it/images/0051141998848_0_0_0_0.jpg -- 2832x2832
			return src.replace(/(:\/\/[^/]+\/+images\/+[0-9]{5,})(?:_[0-9]+){4}(\.[^/.]+)(?:[?#].*)?$/, "$1_0_0_0_0$2");
		}

		if (domain_nowww === "melodycenter.hu") {
			// https://melodycenter.hu/img/3857/MELA03626/250x250,r/MELA03626.jpg?time=1584216418
			//   https://melodycenter.hu/img/3857/MELA03626/250x250/MELA03626.jpg?time=1584216418
			//   https://melodycenter.hu/img/3857/MELA03626/MELA03626.jpg?time=1584216418 -- 300x300
			return src.replace(/(\/img\/+[0-9]+\/+[^/]+\/+)[0-9]+x[0-9]+(?:,[^/]+)?\/+/, "$1");
		}

		if (domain === "images.music-story.com") {
			// http://images.music-story.com/img/artiste_K_400/kenny-wayne-shepherd-151167.jpg
			//   http://images.music-story.com/img/artiste_K/kenny-wayne-shepherd-151167.jpg
			return src.replace(/(\/img\/+artiste_[A-Z])_[0-9]+\/+/, "$1/");
		}

		if (domain === "naslehiphop.com") {
			// http://naslehiphop.com/files//uploads/2020/1/235213523236523636346_thumbnail.jpeg
			//   http://naslehiphop.com/files//uploads/2020/1/235213523236523636346.jpeg
			return src.replace(/(\/files\/+uploads\/+[0-9]{4}\/+[0-9]+\/+[0-9]+)_thumbnail(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "pic.eslite.com") {
			// http://pic.eslite.com/Upload/Product/201912/s/637124293733590000.jpg
			//   http://pic.eslite.com/Upload/Product/201912/o/637124293733590000.jpg -- 1500x1500
			return src.replace(/(\/Upload\/+Product\/+[0-9]{6}\/+)[a-z]\/+/, "$1o/");
		}

		if (domain_nosub === "vibbidi-vid.com") {
			// https://aimg.vibbidi-vid.com/vibbidi-images/albums/img_DEE9F949241C46D8AE676F2B04810493.2019.12.30.07.15.16.256x.jpg
			//   https://aimg.vibbidi-vid.com/vibbidi-images/albums/img_DEE9F949241C46D8AE676F2B04810493.2019.12.30.07.15.16.jpg
			// https://aimg.vibbidi-vid.com/vibbidi-images/albums/930919079447277.128x.jpg
			//   https://aimg.vibbidi-vid.com/vibbidi-images/albums/930919079447277.jpg
			// https://audio.vibbidi-vid.com/vibbidi-us/audio/audio_A25EC35C1CA84EE6BD7DC3A965BCCA57.mp3.small.jpg
			//   https://audio.vibbidi-vid.com/vibbidi-us/audio/audio_A25EC35C1CA84EE6BD7DC3A965BCCA57.mp3.jpg -- removing jpg does indeed return an mp3
			// https://berserker5.vibbidi-vid.com/vibbidi-us/videos/video_53C0AF67624C45B5AFFCD19C7B515231.mp4.small.jpg
			//   https://berserker5.vibbidi-vid.com/vibbidi-us/videos/video_53C0AF67624C45B5AFFCD19C7B515231.mp4.jpg
			newsrc = src.replace(/(\/vibbidi-[a-z]+\/+(?:albums|audio|videos)\/+(?:(?:img|audio|video)_[A-F0-9]{10,}|[0-9]+)(?:\.(?:[0-9]+|mp3)){0,})\.(?:[0-9]*x[0-9]*|small)(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
			if (newsrc !== src)
				return newsrc;

			newsrc = src.replace(/(\/videos\/+video_[0-9A-F]{10,}\.mp4)(?:\..*)?(?:[?#].*)?$/, "$1");
			if (newsrc !== src)
				return {
					url: newsrc,
					video: true
				};

			if (/\/videos\/+video_[0-9A-F]{10,}\.mp4$/.test(src)) {
				return {
					url: src,
					video: true
				};
			}
		}

		if (domain_nowww === "vibbidi.net") {
			// https://www.vibbidi.net/static/img/no_3x3.png
			if (/\/static\/+img\/+no_[0-9]+x[0-9]+\./.test(src))
				return {
					url: src,
					bad: "mask"
				};
		}

		if (host_domain_nowww === "vibbidi.net" && options.element) {
			if (options.element.tagName.toLowerCase() === "svg") {
				if (options.element.classList.contains("IcoPlayMedium")) {
					return {
						url: origsrc,
						bad: "mask"
					};
				}
			}
		}

		if (domain_nowww === "puregrainaudio.com") {
			// https://puregrainaudio.com/images/blogimages/273s/38875.jpg
			//   https://puregrainaudio.com/images/blogimages/38875.jpg
			return src.replace(/(\/images\/+blogimages\/+)[0-9]+s\/+/, "$1");
		}

		if (domain_nowww === "mfmm.ru") {
			// http://mfmm.ru/_bd/8/s48492261.jpg
			//   http://mfmm.ru/_bd/8/48492261.jpg -- 1000x1000
			return src.replace(/(\/_bd\/+[0-9]+\/+)s([0-9]+\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nosub === "mlstatic.com") {
			// https://http2.mlstatic.com/cd-selena-gomez-rare-D_Q_NP_737185-MLA40516382913_012020-R.webp
			//   https://http2.mlstatic.com/cd-selena-gomez-rare-D_Q_NP_737185-MLA40516382913_012020-F.webp -- O is smaller
			// https://http2.mlstatic.com/D_Q_NP_770389-MLA41222249167_032020-E.jpg-O.webp
			//   https://http2.mlstatic.com/D_Q_NP_770389-MLA41222249167_032020-F.jpg
			return src.replace(/(:\/\/[^/]+\/+(?:[^/]+-)?D_[^/.]+)-[A-Z](\.[^/.]+)(?:-[A-Z]\.[^/.]+)?(?:[?#].*)?$/, "$1-F$2");
		}

		if (domain === "angartwork.akamaized.net") {
			// https://angartwork.akamaized.net/webp/?id=113873609&size=296
			//   https://angartwork.akamaized.net/webp/?id=113873609
			// https://angartwork.akamaized.net/?id=113873609&size=296
			//   https://angartwork.akamaized.net/?id=113873609
			return {
				url: keep_queries(src, ["id"], {required: true}),
				head_wrong_contentlength: true
			}
		}

		if (domain === "pimg.awa.io") {
			// https://pimg.awa.io/v2/jacket/744b4188bf6730137424.w300.h300.v1584608509.fitcrop.jpg
			//   https://pimg.awa.io/v2/jacket/744b4188bf6730137424.w9999999999.jpg
			return {
				url: src.replace(/(\/v2\/+[^/]+\/+[0-9a-f]{10,})(?:\.(?:[whv][0-9]+|fitcrop)){1,}(\.[^/.]+)(?:[?#].*)?$/, "$1.w9999999999$2"),
				can_head: false // 404
			};
		}

		if (domain_nosub === "hudobny.sk") {
			// https://m.hudobny.sk/images/middle/56382.jpg
			//   https://hudobny.sk/images/original/56382.jpg -- 1024x1024
			return src.replace(/\/images\/+[a-z]+\/+([0-9]+\.[^/.]+)(?:[?#].*)?$/, "/images/original/$1");
		}

		if (domain === "cdnimages01.azureedge.net") {
			// https://cdnimages01.azureedge.net/megahits/selenagomez_rare1104e89a_squarexs.jpg
			//   https://cdnimages01.azureedge.net/megahits/selenagomez_rare1104e89a.jpg
			return src.replace(/(\/megahits\/+[^/]+[0-9a-f]{8})_square[a-z]*(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "media.becteroradio.com") {
			// https://media.becteroradio.com/pix/single/36209_small.jpg
			//   https://media.becteroradio.com/pix/single/36209_medium.jpg
			//   https://media.becteroradio.com/pix/single/36209.jpg
			return src.replace(/(\/pix\/+[^/]+\/+[0-9]+)_[a-z]+(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (false && (domain === "cdnrockol-rockolcomsrl.netdna-ssl.com" ||
			// https://a6p8a2b3.stackpathcdn.com/SDdEdm_7dVS9L5rPtY9GMl0OZ74=/600x0/smart/filters:no_upscale()/rockol-img/img/foto/upload/rare-selena-gomez-cover-ts1576805435.jpg#direct
			domain === "a6p8a2b3.stackpathcdn.com")) {
			// https://cdnrockol-rockolcomsrl.netdna-ssl.com/rdMW-bcVsJ4__mrXPr6A75jzyy0=/300x300/smart/rockol-img/img/foto/upload/rare-selena-gomez-cover-ts1576805435.jpg
			//   https://www.rockol.it/img/foto/upload/rare-selena-gomez-cover-ts1576805435.jpg
			//   https://a6p8a2b3.stackpathcdn.com/SDdEdm_7dVS9L5rPtY9GMl0OZ74=/600x0/smart/filters:no_upscale()/rockol-img/img/foto/upload/rare-selena-gomez-cover-ts1576805435.jpg#direct
			// https://cdnrockol-rockolcomsrl.netdna-ssl.com/xhumGAFrcsVE0USbEQVs6X3ftPk=/x/smart/rockol-img/img/foto/upload/jovanotti-rockol-30.jpg -- 1200x...
			//   https://a6p8a2b3.stackpathcdn.com/cREyqQZHcCZ_X206n34-whBQ1mg=/600x0/smart/filters:no_upscale()/rockol-img/img/foto/upload/jovanotti-rockol-30.jpg#direct -- 600x...
			if (string_indexof(src, "#direct") < 0) {
				return {
					url: src.replace(/.*\/rockol-img\/+img\/+/, "https://www.rockol.it/img/"),
					redirects: true
				};
			}
		}

		if (domain_nowww === "saga-rian.com") {
			// https://saga-rian.com/common/image2.php?1=1&w=640&c=1&r=10,7&f=https%3A%2F%2Fexternal%2Dnrt1%2D1%2Exx%2Efbcdn%2Enet%2Fsafe%5Fimage%2Ephp%3Fd%3DAQA0Qrj3UrBqwph6%26w%3D540%26h%3D282%26url%3Dhttps%253A%252F%252Fcf%2Dimages%2Eap%2Dnortheast%2D1%2Eprod%2Eboltdns%2Enet%252Fv1%252Fstatic%252F5490902205001%252F11125029%2D995e%2D4552%2D94f7%2D6da055300145%252F305c21f2%2D9fb5%2D4d25%2Db219%2D5c3d061cf604%252F1280x720%252Fmatch%252Fimage%2Ejpg%26cfs%3D1%26upscale%3D1%26fallback%3Dnews%5Fd%5Fplaceholder%5Fpublisher%26%5Fnc%5Fhash%3DAQAdZJ%2DY%2DF2DTZhP
			//   https://external-nrt1-1.xx.fbcdn.net/safe_image.php?d=AQA0Qrj3UrBqwph6&w=540&h=282&url=https%3A%2F%2Fcf-images.ap-northeast-1.prod.boltdns.net%2Fv1%2Fstatic%2F5490902205001%2F11125029-995e-4552-94f7-6da055300145%2F305c21f2-9fb5-4d25-b219-5c3d061cf604%2F1280x720%2Fmatch%2Fimage.jpg&cfs=1&upscale=1&fallback=news_d_placeholder_publisher&_nc_hash=AQAdZJ-Y-F2DTZhP
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+common\/+image2\.php\?(?:.*&)?f=([^&]+).*?$/, "$1");
			if (newsrc !== src) {
				return decodeuri_ifneeded(newsrc);
			}
		}

		if (domain_nowww === "wigtypes.com") {
			// https://www.wigtypes.com/product_description/outre/outre_quick_weave_big_beautiful_hair_3c_whirly_dr2730_1_175.jpg
			//   https://www.wigtypes.com/product_description/outre/outre_quick_weave_big_beautiful_hair_3c_whirly_dr2730_1_600.jpg
			return src.replace(/(\/product_description\/+[^/]+\/+[^/]+)_175(\.[^/.]+)(?:[?#].*)?$/, "$1_600$2");
		}

		if (domain_nowww === "beautyhill.com") {
			// http://beautyhill.com/img/arts/2010/Sep/17/697/emohairstyle5_thumb.jpg
			//   http://beautyhill.com/img/arts/2010/Sep/17/697/emohairstyle5.jpg
			return src.replace(/(\/img\/+[^/]+\/+[0-9]{4}\/+.*)_thumb(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "she12.com") {
			// https://she12.com/wp-content/plugins/seo-alrp/php/thumb.php?src=http://she12.com/uploads/2012/09/Emo-Hairstyles-for-girls.jpg&h=90&w=114&q=90&zc=1
			//   https://she12.com/uploads/2012/09/Emo-Hairstyles-for-girls.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+wp-content\/+plugins\/+seo-alrp\/+php\/+thumb\.php\?(?:.*&)?src=([^&]+).*?$/, "$1");
			if (newsrc !== src) {
				return urljoin(src, decodeuri_ifneeded(newsrc), true);
			}
		}

		if (domain_nowww === "soemo.co.uk") {
			// https://www.soemo.co.uk/images/emo_guy26x.jpg
			//   https://www.soemo.co.uk/images/emo_guy26.jpg
			// https://www.soemo.co.uk/images/bless_the_fallx.jpg
			//   https://www.soemo.co.uk/images/bless_the_fall.jpg
			// doesn't work for all:
			// https://www.soemo.co.uk/images/emosx.jpg
			return src.replace(/(:\/\/[^/]+\/+images\/+[^/]+)x(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nosub === "tasior.com") {
			// http://fryzury.tasior.com/upload/foto/2/th13503396823.png
			//   http://fryzury.tasior.com/upload/foto/2/13503396823.png
			return src.replace(/(\/upload\/+foto\/+[0-9]+\/+)th([0-9]+\.)/, "$1$2");
		}

		if (domain_nosub === "blogerka.cz") {
			// http://emoanishka.blogerka.cz/obrazky/emoanishka.blogerka.cz/index.jpg.tn.jpg
			//   http://emoanishka.blogerka.cz/obrazky/emoanishka.blogerka.cz/index.jpg
			return src.replace(/(\/obrazky\/+[^/]+\/+[^/]+)\.tn\.[^/.]+(?:[?#].*)?$/, "$1");
		}

		if (domain_nowww === "worldsmostunique.com") {
			// http://www.worldsmostunique.com/images/thumbnails/Worlds-most-beautiful-scenes-grand-canyon_jpg.jpg
			//   http://www.worldsmostunique.com/images/images/Worlds-most-beautiful-scenes-grand-canyon.jpg
			return src.replace(/\/images\/+thumbnails\/+([^/]+)_[a-z]+(\.[^/.]+)(?:[?#].*)?$/, "/images/images/$1$2");
		}

		if (domain_nowww === "zarzarmodels.com") {
			// http://www.zarzarmodels.com/Images/Models/1291/Thumb/beautiful-blonde-fashion-model-kathryn-portrait.jpg
			//   http://www.zarzarmodels.com/Images/Models/1291/beautiful-blonde-fashion-model-kathryn-portrait.jpg
			return src.replace(/(\/images\/+models\/+[0-9]+\/+)thumb\/+/i, "$1");
		}

		if (domain === "d3ts7pb9ldoin4.cloudfront.net" ||
			// https://star-uploads.s3-us-west-2.amazonaws.com/uploads/users/9356/tier_covers/fb980420-356b-4db8-bc72-d281515c2551-120x120_1x0_616x616.jpg
			//   https://star-uploads.s3-us-west-2.amazonaws.com/uploads/users/9356/tier_covers/fb980420-356b-4db8-bc72-d281515c2551.jpg
			amazon_container === "star-uploads") {
			// https://d3ts7pb9ldoin4.cloudfront.net/uploads/users/9356/avatars/3fd19feb-8736-4d79-9815-095eb3423a78-380x380_0x0_833x833.jpg
			//   https://d3ts7pb9ldoin4.cloudfront.net/uploads/users/9356/avatars/3fd19feb-8736-4d79-9815-095eb3423a78.jpg
			// https://d3ts7pb9ldoin4.cloudfront.net/uploads/users/9356/tier_covers/fb980420-356b-4db8-bc72-d281515c2551-120x120_1x0_616x616.jpg
			//   https://d3ts7pb9ldoin4.cloudfront.net/uploads/users/9356/tier_covers/fb980420-356b-4db8-bc72-d281515c2551.jpg
			return src.replace(/(\/uploads\/+users\/+[0-9]+\/+[^/]+\/+[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12})-[0-9]+x[0-9]+(?:_[0-9]+x[0-9]+){2}(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (amazon_container === "static.e-junkie.com") {
			// https://s3.amazonaws.com/static.e-junkie.com/products/thumbnails/1595015.png
			//   https://shopdemo.e-junkie.com/product/1595015/Demo-eBook
			// https://s3.amazonaws.com/static.e-junkie.com/products/tiny-images/1595015-1.png
			//   https://s3.amazonaws.com/static.e-junkie.com/products/images/1595015-1.png
			return src.replace(/\/products\/+[a-z]+-images\/+/, "/products/images/");
		}

		if (domain === "api.europeana.eu") {
			// https://api.europeana.eu/api/v2/thumbnail-by-url.json?uri=http%3A%2F%2Fiiif.archivelab.org%2Fiiif%2F39002086306033.med.yale.edu%241%2Ffull%2Ffull%2F0%2Fdefault.jpg&type=TEXT
			//   http://iiif.archivelab.org/iiif/39002086306033.med.yale.edu$1/full/full/0/default.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+api\/+v2\/+thumbnail-by-url\.json\?(?:.*&)?uri=([^&]+).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nowww === "fanparty.ru") {
			// https://fanparty.ru/fanclubs/anne-hathaway/gallery/626206_anne_hathaway_medium.jpg
			//   https://fanparty.ru/fanclubs/anne-hathaway/gallery/626206_anne_hathaway_pic.jpg
			return src.replace(/(\/gallery\/+[0-9]+_[^/]+)_medium(\.[^/.]+)(?:[?#].*)?$/, "$1_pic$2");
		}

		if (domain_nowww === "metlifestadium.com") {
			// https://www.metlifestadium.com/images/default-source/photo-galleries/2013-galleries/taylor-swift-2013/wh1_0309.tmb-.jpg
			//   https://www.metlifestadium.com/images/default-source/photo-galleries/2013-galleries/taylor-swift-2013/wh1_0309.jpg
			return src.replace(/(\/images\/+.*)\.tmb-(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nosub === "fxinteractive.com") {
			// https://juegos.fxinteractive.com/fx/images/games/Sherlock_Holmes_4/screenshots/Sherlock_Holmes_4_thumbnail_3.jpg
			//   https://juegos.fxinteractive.com/fx/images/games/Sherlock_Holmes_4/screenshots/Sherlock_Holmes_4_screenshot_3.jpg
			return src.replace(/(\/images\/+games\/+[^/]+\/+screenshots\/+[^/]+)_thumbnail_([0-9]+\.[^/.]+)(?:[?#].*)?$/, "$1_screenshot_$2");
		}

		if (domain_nowww === "kinogallery.com") {
			// https://www.kinogallery.com/pimages/1256/kinogallery.com-pr-1256-369072.jpg
			//   https://www.kinogallery.com/pimages/1256/kinogallery.com-1256-369072.jpg
			return src.replace(/(\/pimages\/+[0-9]+\/+[^-/]+-)pr-/, "$1");
		}

		if (domain === "image.mux.com") {
			// https://image.mux.com/UZMwOY6MgmhFNXLbSFXAuPKlRPss5XNA/thumbnail.jpg?time=11
			//   https://stream.mux.com/UZMwOY6MgmhFNXLbSFXAuPKlRPss5XNA.m3u8
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+([^/.]{30,})\/+thumbnail\.[^/.]+(?:[?#].*)?$/, "https://stream.mux.com/$1.m3u8");
			if (newsrc !== src) {
				return {
					url: newsrc,
					video: "hls"
				};
			}
		}

		if (domain === "stream.mux.com") {
			if (/\.m3u8(?:[?#].*)?$/.test(src)) {
				return {
					url: src,
					video: "hls"
				};
			}
		}

		if (domain === "thumbnails.pcgamingwiki.com") {
			// https://thumbnails.pcgamingwiki.com/a/a4/Ryse_Son_of_Rome_cover.jpg/600px-Ryse_Son_of_Rome_cover.jpg
			//   https://images.pcgamingwiki.com/a/a4/Ryse_Son_of_Rome_cover.jpg
			return src.replace(/:\/\/[^/]+\/+(.)\/+(..)\/+([^/]*)\/+[0-9]+px-.*?$/, "://images.pcgamingwiki.com/$1/$2/$3");
		}

		if (domain_nowww === "filmix.co") {
			// https://filmix.co/uploads/frames/135461/f294444-film_dostat_nozhi_2019_small.jpg
			//   https://filmix.co/uploads/frames/135461/f294444-film_dostat_nozhi_2019_original.jpg
			return src.replace(/(\/uploads\/+frames\/+[0-9]+\/+[^/]+)_small(\.[^/.]+)(?:[?#].*)?$/, "$1_original$2");
		}

		if (domain === "thumbs.filmix.co" ||
			// thanks to anonymous for reporting:
			// https://thumbs.filmix.ac/posters/3706/thumbs/w160/podzemelya-i-drakony-chest-sredi-vorov-yax-2023_164933.jpg
			//   https://thumbs.filmix.ac/posters/3706/orig/podzemelya-i-drakony-chest-sredi-vorov-yax-2023_164933.jpg
			domain === "thumbs.filmix.ac") {
			// https://thumbs.filmix.co/posters/thumbs/w220/film_dostat_nozhi_2019_135461_0.jpg
			//   https://thumbs.filmix.co/posters/orig/film_dostat_nozhi_2019_135461_0.jpg
			return src.replace(/\/thumbs\/+[wh][0-9]+\/+/, "/orig/");
		}

		if (domain === "img.filmix.ac" ||
			// https://filmix.ac/uploads/frames/165433/f372803-durnaya-krov-diks-2022_small.jpg
			//   https://filmix.ac/uploads/frames/165433/f372803-durnaya-krov-diks-2022_original.jpg
			// https://filmix.ac/uploads/sliderPics/post_166188_slide_0_thumb.jpg
			//   https://filmix.ac/uploads/sliderPics/post_166188_slide_0.jpg
			domain_nowww === "filmix.ac") {
			// https://img.filmix.ac/posters/71934/p22528-osen-shayennov-cheyenne-autumn-1964_small.jpg
			//   https://img.filmix.ac/posters/71934/p22528-osen-shayennov-cheyenne-autumn-1964_original.jpg
			return src
				.replace(/(\/(?:posters|frames)\/+[0-9]+\/+[a-z][0-9]+-[^/]+)_small\./, "$1_original.")
				.replace(/(\/sliderPics\/+[^/]+)_thumb\./, "$1.");
		}

		if (domain_nowww === "5tv5.ru") {
			// http://5tv5.ru/smallposters/66372.jpg
			//   http://5tv5.ru/posters/66372.jpg
			// http://5tv5.ru/frames/2310/s0.jpg
			//   http://5tv5.ru/frames/2310/f0.jpg
			return src
				.replace(/\/smallposters\/+/, "/posters/")
				.replace(/(\/frames\/+[0-9]+\/+)s([0-9]+\.)/, "$1f$2");
		}

		if (domain === "thumbs.dfs.ivi.ru") {
			// https://thumbs.dfs.ivi.ru/storage31/contents/b/c/7cb648c2e98beb16b616d6740776e4.jpg/234x360/
			//   https://thumbs.dfs.ivi.ru/storage31/contents/b/c/7cb648c2e98beb16b616d6740776e4.jpg
			return src.replace(/(\/contents\/+[0-9a-f]\/+[0-9a-f]\/+[0-9a-f]{10,}\.[^/.]+)(?:\/+[0-9]+x[0-9]+\/*)(?:[?#].*)?$/, "$1");
		}

		if (false && domain === "i.postimg.cc" && options && options.do_request && options.cb) {
			// https://i.postimg.cc/s1W2ZvYC/Alina-Kim1-20190825-140824-mp4-20190826-215449-482.jpg
			match = src.match(/:\/\/[^/]*\/+([^/]+)\/+/);
			if (match) {
				options.do_request({
					url: "https://postimg.cc/" + match[1],
					method: "GET",
					headers: {
						Referer: null
					},
					onload: function(result) {
						if (result.readyState !== 4)
							return;

						if (result.status !== 200) {
							console_error(result);
							return options.cb(null);
						}

						var match = result.responseText.match(/<meta\s+property=["']og:image["']\s+content=["'](.*?)["']/);
						if (match) {
							return options.cb({
								url: decode_entities(match[1]),
								headers: {
									Referer: result.finalUrl
								},
								extra: {
									page: result.finalUrl
								}
							});
						} else {
							console_error("Unable to find og:image", result);
							return options.cb(null);
						}
					}
				});

				return {
					waiting: true
				};
			}
		}

		if (domain_nowww === "2img.net") {
			// https://2img.net/h/s30.postimg.cc/ee5pav001/20141101_210833_resized.jpg
			//   http://s30.postimg.cc/ee5pav001/20141101_210833_resized.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+h\/+([^/]+\.[^/]+\/)/, "http://$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nosub === "postimg.cc" && /^(i|s)[0-9]*\./.test(domain)) {
			// https://i.postimg.cc/pTvhW3cs/Instant-Star-Promos-alexz-johnson-1361011.jpg
			// https://postimg.cc/sBnDKHrW -- can be used on both postimg and pixxxels
			match = src.match(/:\/\/[^/]*\/+([^/]+)\/+/);
			if (match) {
				return {
					url: "https://pixxxels.cc/" + match[1],
					is_pagelink: true
				};
			}
		}

		if (domain_nowww === "pixxxels.cc" ||
			domain_nowww === "postimg.cc") {
			// https://pixxxels.cc/8jkzg5wM
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+([0-9a-zA-Z]+)(?:[?#].*)?$/,
				query_for_id: {
					url: "https://pixxxels.cc/${id}",
					headers: {
						Referer: ""
					}
				},
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/<a[^>]+href=["'](https?:\/\/i\.[a-z]+\.cc\/+[^"']+\?dl=1)["']/);
					if (!match) {
						console_error(cache_key, "Unable to find download link for", resp);
						return done(null, false);
					}

					var dllink = decode_entities(match[1]).replace(/[?#].*$/, "");

					var referer = resp.finalUrl;
					match = resp.responseText.match(/<link rel="canonical" href="(https?:\/\/[a-z]+\.cc\/[^"]+)"/);
					if (match) {
						referer = decode_entities(match[1]);
					}

					var obj = {
						url: dllink,
						headers: {
							Referer: referer
						},
						extra: {page: referer}
					};

					return done(obj, 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "i.pixxxels.cc") {
			// thanks to hosadokha on github: https://github.com/qsniyg/maxurl/issues/307
			// https://i.pixxxels.cc/yYcg93ZQ/tumblr-nyllgid-Soi1qi3bk1o1-raw.jpg
			//   https://i.pixxxels.cc/R9bckcVB/tumblr-nyllgid-Soi1qi3bk1o1-raw.jpg
			//   https://pixxxels.cc/8jkzg5wM
			match = src.match(/^[a-z]+:\/\/[^/]+\/+([^-_/.]+)\/+[^/]+(?:[?#].*)?$/);
			if (match) {
				return {
					url: "https://pixxxels.cc/" + match[1],
					is_pagelink: true
				};
			}
		}

		if (domain === "t.meadd.net") {
			// https://t.meadd.net/photos/0/67334965.jpg
			//   https://cdn.meadd.net/photos/full/67334965.jpg
			return src.replace(/:\/\/[^/]+\/+photos\/+[0-9]+\/+([0-9]+\.[^/.]+)(?:[?#].*)?$/, "://cdn.meadd.net/photos/full/$1");
		}

		if (domain === "s.uicdn.com") {
			// https://s.uicdn.com/3c-cdn/mail/client/wicket/resource/static-res/---/uic/img/themes/unified/mailcomblue/sprite-82a8c5d34e.png
			// https://s.uicdn.com/3c-cdn/mail/client/wicket/resource/static-res/---/mc/img/themes/densely/mailcomblue/sprite_systemMessage-8ea18368dc.png
			// FIXME: is this too far-reaching?
			return {
				url: src,
				bad: "mask"
			};
		}

		if (domain_nosub === "x-art.com" && /^(?:hosted|content[0-9]*)\./.test(domain)) {
			// https://content4.x-art.com/models/alex%20grey/x-art_alex%20grey-01-tn.jpg
			//   https://content4.x-art.com/models/alex%20grey/x-art_alex%20grey-01.jpg
			newsrc = src.replace(/(\/models\/+[^/]+\/+[^/]+)-tn(\.[^/.]+)(?:[/#].*)?$/, "$1$2");
			if (newsrc !== src)
				return newsrc;

			match = src.match(/^([a-z]+:\/\/[^/]+\/+galleries\/+[^/]+\/+[^/]+)-(l?tn|sml|med)(\.[^/.]+)(?:[?#].*)?$/);
			if (match) {
				// hosted.* only supports up to sml
				// http://hosted.x-art.com/galleries/russian_invasion/x-art_grace_linsay_nastia_russian_invasion-2-sml.jpg?rand=1587294491
				// content*. supports up to lrg:
				// https://content3.x-art.com/galleries/a_fucking_hot_threesome/x-art_veronica_rodriguez_alex_grey_logan_pierce_a_fucking_hot_threesome-30-lrg.jpg
				// hosted cannot be changed to content?
				var sizes = [
					"lrg",
					"med",
					"sml",
					"ltn",
					"tn"
				];

				var sizes_index = array_indexof(sizes, match[2]);
				var urls = [];
				if (sizes_index >= 0) {
					for (let i = 0; i < sizes_index; i++) {
						urls.push(match[1] + "-" + sizes[i] + match[3]);
					}

					return urls;
				}
			}
		}

		if (domain_nowww === "vkanketa.ru") {
			// http://vkanketa.ru/file.php?img=https://sun9-35.userapi.com/c848628/v848628170/15fb13/Jx7Qy-etg_Q.jpg
			//   https://sun9-35.userapi.com/c848628/v848628170/15fb13/Jx7Qy-etg_Q.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+file\.php\?(?:.*&)?img=(http[^&]+)(?:[#].*)?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "blob.freent.de") {
			// https://blob.freent.de/image/7755064/847x565/847/565/b0/dc2b1c591f5745af166d2888e7546f75/XX/imago0097248969h-jpg.jpg
			//   https://blob.freent.de/contentblob/7755064/original/imago0097248969h-jpg.jpg
			// https://blob.freent.de/image/7755964/630x421/630/421/b0/4be23d1bd34b90f65344192d8f652b62/UT/leipzig-urn-newsml-dpa-com-20090101-200420-99-763761.jpg
			//   https://blob.freent.de/contentblob/7755964/original/leipzig-urn-newsml-dpa-com-20090101-200420-99-763761.jpg
			// doesn't work for all:
			// https://blob.freent.de/image/5545356/1220x814/1220/814/b0/466626b2e20df8434dda170324d627fd/NH/sexy-em-fans--76--jpg.jpg -- /1/original/ doesn't wor keither
			// other:
			// https://blob.freent.de/contentblob/4495602/2/data/jan-sperlich.jpg
			// https://blob.freent.de/contentblob/754510/7/original/der-fitnesswahn-der-stars-13-zellweger.jpg
			//   https://blob.freent.de/contentblob/754510/7/teaserImg847x565/der-fitnesswahn-der-stars-13-zellweger.jpg -- same size
			return src.replace(/\/image\/+([0-9]+)\/+[0-9]+x[0-9]+\/+[0-9]+\/+[0-9]+\/+[0-9a-f]{2}\/+[0-9a-f]{10,}\/+[^/]+\/+([^/]+)(?:[?#].*)?$/,
								"/contentblob/$1/original/$2");
		}

		if (domain_nosub === "cdnsw.com" && /^mfs[0-9]*\./.test(domain)) {
			// http://mfs0.cdnsw.com/fs/Root/normal/9swke-katy_perry_est_ravissante_meme_quand_elle_grimace_30436_w460.jpg
			//   http://mfs0.cdnsw.com/fs/Root/9swke-katy_perry_est_ravissante_meme_quand_elle_grimace_30436_w460.jpg
			return src.replace(/\/fs\/+Root\/+[a-z]+\/+/, "/fs/Root/");
		}

		if (domain_nowww === "kupidon-rf.ru") {
			// http://kupidon-rf.ru/uploads/news-logo/2018/05/28/487/small-27a4847cf9.jpg
			//   http://kupidon-rf.ru/uploads/news-logo/2018/05/28/487/27a4847cf9.jpg
			return src.replace(/(\/uploads\/+[^/]+\/+[0-9]{4}\/+[0-9]{2}\/+[0-9]{2}\/+[0-9]+\/+)[a-z]+-([0-9a-f]{5,}\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "fondecranmagique.com") {
			// http://www.fondecranmagique.com/actrices/keiraknightley/min/29.jpg
			//   http://www.fondecranmagique.com/actrices/keiraknightley/29.jpg
			return src.replace(/\/min\/+([0-9]+\.[^/.]+)(?:[?#].*)?$/, "/$1");
		}

		if (domain_nowww === "photohost.ru") {
			// http://www.photohost.ru/t/180/180/204077.jpg
			//   http://www.photohost.ru/pictures/204077.jpg
			return src.replace(/\/t\/+[0-9]+\/+[0-9]+\/+/, "/pictures/");
		}

		if ((domain_nosub === "sat1.de" ||
			 // https://i3-img.7tv.de/pis/ezone/f763qgELB38wdEB0AB1fHPDQCtTDCJ4UYl_Ic-IXCoYylZ0mXaheiyCf8r-rAPqXoJhS5ccKE64i1AGkynIEgNRrQuckq_X56-sgnbOccDnOaLOVaIhyYo2PvKolkrhNQnKZU83RwqR6LJqcOYhLqGuu6Mi-xE5KM72QX-_DtlvAE9Jsb8bAYu_Z_fJsL2Jei-EvWUG4A44I0DPWJhBXsChlvJE_myRBozjcbFfjndSLFJeNUFXc-kw8FgLXKpkXu2jyHhAosdxuf5mab3j0YIUKAAp6Tw/profile:ezone-teaser620x348
			 //   https://i3-img.7tv.de/pis/ezone/f763qgELB38wdEB0AB1fHPDQCtTDCJ4UYl_Ic-IXCoYylZ0mXaheiyCf8r-rAPqXoJhS5ccKE64i1AGkynIEgNRrQuckq_X56-sgnbOccDnOaLOVaIhyYo2PvKolkrhNQnKZU83RwqR6LJqcOYhLqGuu6Mi-xE5KM72QX-_DtlvAE9Jsb8bAYu_Z_fJsL2Jei-EvWUG4A44I0DPWJhBXsChlvJE_myRBozjcbFfjndSLFJeNUFXc-kw8FgLXKpkXu2jyHhAosdxuf5mab3j0YIUKAAp6Tw/profile:original?source
			 domain_nosub === "7tv.de") && /^i[0-9]*-img\./.test(domain)) {
			// https://i3-img.sat1.de/pis/ezone/abcbqgELB38wdEB-ZftQHfHFPn4ON1n0D0sNVdu9-eaKOYcH3fC38cLwzxDoWvxer7dXH5GTyTa-ePfvcETmautfZZfzflW2ioM/profile:mag-maxwidth-1280?source
			//   https://i3-img.sat1.de/pis/ezone/abcbqgELB38wdEB-ZftQHfHFPn4ON1n0D0sNVdu9-eaKOYcH3fC38cLwzxDoWvxer7dXH5GTyTa-ePfvcETmautfZZfzflW2ioM/profile:original?source
			return {
				url: src.replace(/\/profile:[^/]+(?:[?#].*)?$/, "/profile:original?source"),
				can_head: false // 403
			};
		}

		if (domain === "m.gjcdn.net") {
			// https://m.gjcdn.net/screenshot-thumbnail/300x2000/828783-v4.jpg
			//   https://m.gjcdn.net/screenshot-thumbnail/999999999x999999999/828783-v4.jpg -- x999* isn't needed
			// https://m.gjcdn.net/game-header/2000/479495-crop0_63_1500_438-euam8zeu-v4.jpg
			//   https://m.gjcdn.net/game-header/999999999/479495-euam8zeu-v4.jpg
			// https://m.gjcdn.net/game-thumbnail/200/451063-crop464_491_1512_1080-cxiru8mh-v4.png
			//   https://m.gjcdn.net/game-thumbnail/999999999/451063-cxiru8mh-v4.png
			// https://m.gjcdn.net/game-screenshot/300/2262138-wj9ajney-v4.jpg
			//   https://m.gjcdn.net/game-screenshot/999999999/2262138-wj9ajney-v4.jpg
			// https://m.gjcdn.net/fireside-post-image/700/2979640-6cv5kbpp-v4.jpg
			//   https://m.gjcdn.net/fireside-post-image/999999999/2979640-6cv5kbpp-v4.jpg
			// https://m.gjcdn.net/content/1100/2979625-nqf5g48e-v4.jpg
			//   https://m.gjcdn.net/content/999999999/2979625-nqf5g48e-v4.jpg
			newsrc = src
				.replace(/\/screenshot-thumbnail\/+[0-9]+x[0-9]+\/+/, "/screenshot-thumbnail/999999999x999999999/")
				.replace(/\/(game-(?:header|thumbnail|screenshot)|fireside-post-image|content)\/+[0-9]+\/+([0-9]+-)(?:crop[0-9]+(?:_[0-9]+){3}-)?/, "/$1/999999999/$2");
			return {
				url: newsrc,
				head_wrong_contenttype: true
			};
		}

		if (domain_nowww === "crosti.ru") {
			// http://crosti.ru/patterns/00/11/40/4fc8aa7305/thumbnail.jpg
			//   http://crosti.ru/patterns/00/11/40/4fc8aa7305/picture.jpg
			return src.replace(/(\/patterns\/+(?:[0-9a-f]{2}\/+){3}[0-9a-f]{5,}\/+)thumbnail(\.[^/.]+)(?:[?#].*)?$/, "$1picture$2");
		}

		if (domain === "cdn.carbuzz.com") {
			// https://cdn.carbuzz.com/car-thumbnails/700x375/4000/400/4439.jpg
			//   https://cdn.carbuzz.com/car-thumbnails/original/4000/400/4439.jpg
			// https://cdn.carbuzz.com/gallery-images/300x200/700000/200/700215.jpg
			//   https://cdn.carbuzz.com/gallery-images/original/700000/200/700215.jpg
			// https://cdn.carbuzz.com/gallery-images/1600/698000/500/698549.jpg -- upscaled?
			//   https://cdn.carbuzz.com/gallery-images/original/698000/500/698549.jpg -- smaller
			return src.replace(/(\/(?:car-thumbnails|gallery-images)\/+)[0-9]+(?:x[0-9]+)?\/+/, "$1original/");
		}

		if (domain_nosub === "slideserve.com" && /^(?:image|cdn)[0-9]*\./.test(domain)) {
			// https://image4.slideserve.com/7745593/ana-de-armas-reuters-steve-marcus-t.jpg
			//   https://image4.slideserve.com/7745593/ana-de-armas-reuters-steve-marcus-n.jpg
			// https://cdn4.slideserve.com/7744549/governors-awards-red-carpet-t.jpg
			//   https://cdn4.slideserve.com/7744549/governors-awards-red-carpet-n.jpg
			return src.replace(/(\/[0-9]+\/+[^/]+)-t(\.[^/.]+)(?:[?#].*)?$/, "$1-n$2");
		}

		if (domain === "resizer.mujerhoy.com") {
			// https://resizer.mujerhoy.com/resizer/resizer.php?video_id=6031374753001&nuevoancho=177&nuevoalto=177&crop=1&medio=mujerhoy
			//   https://resizer.mujerhoy.com/resizer/resizer.php?video_id=6031374753001&medio=mujerhoy
			if (/\/resizer\/+resizer\.php\?/.test(src)) {
				return remove_queries(src, ["nuevoancho", "nuevoalto", "crop"]);
			}
		}

		if (domain_nowww === "lahiguera.net") {
			// https://www.lahiguera.net/cinemania/actores/ana_de_armas/fotos/14048/ana_de_armas-p.jpg
			//   https://www.lahiguera.net/cinemania/actores/ana_de_armas/fotos/14048/ana_de_armas.jpg
			return src.replace(/(\/fotos\/+[0-9]+\/+[^/]+)-p(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "camo.envatousercontent.com") {
			// https://camo.envatousercontent.com/09ba4b584488df33ca20c30ddad78f4ab0918aba/68747470733a2f2f7265732e636c6f7564696e6172792e636f6d2f6466683362707973662f696d6167652f75706c6f61642f76313537343336343230372f57616c66792f315f6868367364762e706e67
			//   https://res.cloudinary.com/dfh3bpysf/image/upload/Walfy/1_hh6sdv.png
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+[0-9a-f]+\/+([0-9a-f]{10,})(?:[?#].*)?$/, "$1");
			if (newsrc !== src)
				return hex_to_ascii(newsrc);
		}

		if (domain === "img.mnggo.net" ||
			// https://img.lady-first.me/frimage/md_/rROHYUm8aAXdjCzzW2GreZ5h2WDArkToUxd0kCcAO0ZXC8rQrroSUO9oDV6JW9wWDz5XPb7vUg-ugSGHnPyahvrkCW_W266WD8R.jpg
			//   https://img.lady-first.me/frimage/rROHYUm8aAXdjCzzW2GreZ5h2WDArkToUxd0kCcAO0ZXC8rQrroSUO9oDV6JW9wWDz5XPb7vUg-ugSGHnPyahvrkCW_W266WD8R.jpg
			domain === "img.lady-first.me") {
			// https://img.mnggo.net/frimage/md_/rROHYUm8aAXdjCzzW2GreZ5h2WDArkToUxd0kCcAO0ZXC8rQrroSUO9oDV6JW9wWDz5XPb7vUg-ugSGHnPyahvrkCW_W266WD8R.jpg
			//   https://img.mnggo.net/frimage/rROHYUm8aAXdjCzzW2GreZ5h2WDArkToUxd0kCcAO0ZXC8rQrroSUO9oDV6JW9wWDz5XPb7vUg-ugSGHnPyahvrkCW_W266WD8R.jpg
			return src.replace(/(:\/\/[^/]+\/+frimage\/+)md_\/+/, "$1");
		}

		if (domain_nowww === "hockeydb.com") {
			// https://www.hockeydb.com/ihdb/stats/program_img_tn.php?if=edmonton_oilers-1994-nhl.jpg
			//   https://www.hockeydb.com/ihdb/stats/program_img.php?if=edmonton_oilers-1994-nhl.jpg
			return src.replace(/\/program_img_tn\.php\?/, "/program_img.php?");
		}

		if (domain_nowww === "hahastop.com" ||
			// https://www.evilmilk.com/thumbs/Tongue_Out_Picdump_8_s.jpg
			//   https://www.evilmilk.com/pictures/Tongue_Out_Picdump_8.jpg
			domain_nowww === "evilmilk.com") {
			// http://www.hahastop.com/thumbs/Curled_Up_So_Cute_s.jpg
			//   http://www.hahastop.com/pictures/Curled_Up_So_Cute.jpg
			return src.replace(/\/thumbs\/+([^/]+)_s(\.[^/.]+)(?:[?#].*)?$/, "/pictures/$1$2");
		}

		if (domain_nowww === "celebshq.com") {
			// https://celebshq.com/pics/jessica-biel/celebshq_dot_com_-_jessica-biel-Y201804202223009453_smallthumb_.jpg
			//   https://celebshq.com/pics/jessica-biel/celebshq_dot_com_-_jessica-biel-Y201804202223009453.jpg
			// https://celebshq.com/pics/bella-thorne/celebshq_dot_com_-_bella-thorne-G201804202222002832_bigthumb_.jpg
			//   https://celebshq.com/pics/bella-thorne/celebshq_dot_com_-_bella-thorne-G201804202222002832.jpg
			return src.replace(/(\/pics\/+[^/]+\/+[^/]+)_(?:small|big)thumb_(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "images-ssl.gotinder.com" ||
			// https://preview.gotinder.com/5e9dd722c533de01009ff6dc/172x216_2730b2e9-608d-418a-8143-cb9bb7f59e76.jpg
			//   https://preview.gotinder.com/5e9dd722c533de01009ff6dc/original_2730b2e9-608d-418a-8143-cb9bb7f59e76.jpeg
			// https://preview.gotinder.com/a384e339-5285-4d41-a242-395bc53749b7/1080x1350_184d46b8-9466-41b8-853d-3540511caeaf.jpg
			//   https://preview.gotinder.com/a384e339-5285-4d41-a242-395bc53749b7/original_184d46b8-9466-41b8-853d-3540511caeaf.jpeg -- doesn't work
			domain === "preview.gotinder.com") {
			// thanks to 4-FLOSS-Free-Libre-Open-Source-Software on github: https://github.com/qsniyg/maxurl/issues/317
			// https://images-ssl.gotinder.com/5e9dd722c533de01009ff6dc/172x216_2730b2e9-608d-418a-8143-cb9bb7f59e76.jpg
			//   https://images-ssl.gotinder.com/5e9dd722c533de01009ff6dc/640x800_2730b2e9-608d-418a-8143-cb9bb7f59e76.jpg
			//   https://images-ssl.gotinder.com/5e9dd722c533de01009ff6dc/original_2730b2e9-608d-418a-8143-cb9bb7f59e76.jpeg -- uncropped
			// https://images-ssl.gotinder.com/5cf527471823e116007148a2/640x800_8299bd3d-0d6f-448b-8c7e-a64986d1132f.jpg
			//   https://images-ssl.gotinder.com/5cf527471823e116007148a2/1080x1350_8299bd3d-0d6f-448b-8c7e-a64986d1132f.jpg
			//   https://images-ssl.gotinder.com/5cf527471823e116007148a2/original_8299bd3d-0d6f-448b-8c7e-a64986d1132f.jpeg -- 3024x3780
			// https://images-ssl.gotinder.com/5e14c9b6a4ef3201009e86df/640x800_d6222096-0a14-4a1c-83e2-f4e3a73f5d79.jpg -- upscaled
			//   https://images-ssl.gotinder.com/5e56e7874136bd01007e48ea/original_938a4826-659d-4a9c-b330-3e16c2757c46.jpeg
			// https://images-ssl.gotinder.com/5cea505af8a44e16002268bb/640x800_75_68e33c6d-4c0a-46ca-85eb-33560103235a.webp
			//   https://images-ssl.gotinder.com/5cea505af8a44e16002268bb/original_68e33c6d-4c0a-46ca-85eb-33560103235a.jpeg -- 2470x3023
			// https://images-ssl.gotinder.com/54b1cb30a38bda4970451f45/320x400_39fac80e-f057-4265-a428-eff95083612a.jpg
			//   https://images-ssl.gotinder.com/54b1cb30a38bda4970451f45/original_39fac80e-f057-4265-a428-eff95083612a.jpeg
			// https://images-ssl.gotinder.com/546d72f55f2257a85f1b8538/320x400_b6314fba-2537-4fa9-8d6a-1ea19e940cb3.jpg -- original doesn't work, 640x800 and 1080x1350 does, but is upscaled
			// doesn't work for all (square):
			// https://images-ssl.gotinder.com/59fb90fe62dab66a0c554a33/172x172_415283a5-ae1d-4bfa-81a9-ae04f53130cd.jpg
			//   https://images-ssl.gotinder.com/59fb90fe62dab66a0c554a33/320x320_415283a5-ae1d-4bfa-81a9-ae04f53130cd.jpg
			//   https://images-ssl.gotinder.com/59fb90fe62dab66a0c554a33/640x640_415283a5-ae1d-4bfa-81a9-ae04f53130cd.jpg
			//   https://images-ssl.gotinder.com/59fb90fe62dab66a0c554a33/1080x1080_415283a5-ae1d-4bfa-81a9-ae04f53130cd.jpg -- original doesn't work
			// https://images-ssl.gotinder.com/5b01db0967c5a090092156b7/640x640_df9ecc9e-4c8d-4ae9-8aeb-4c78a37d1083.jpg
			//   https://images-ssl.gotinder.com/5b01db0967c5a090092156b7/1080x1080_df9ecc9e-4c8d-4ae9-8aeb-4c78a37d1083.jpg -- upscaled? original doesn't work
			// https://images-ssl.gotinder.com/577918a7bbf0334413f9724a/7cdbc5d9-0e5f-46c5-8467-d9f51cc189b4.jpg -- 320x320 works, 1080x1080 doesn't
			return src.replace(/(\/[-0-9a-f]{10,}\/+)(?:[0-9]+x[0-9]+_)?(?:[0-9]+_)?([0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12})\.[^/.]+(?:[?#].*)?$/,
								"$1original_$2.jpeg");
		}

		if (domain_nowww === "jpopsuki.eu") {
			// https://jpopsuki.eu/static/images/torrents/220699.th.jpg
			//   https://jpopsuki.eu/static/images/torrents/220699.jpg
			// https://jpopsuki.eu/static/images/artists/1358.th.jpg
			//   https://jpopsuki.eu/static/images/artists/1358.jpg
			return src.replace(/(\/static\/+images\/+[a-z]+\/+[0-9]+)\.th(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "spacefucker.com") {
			// https://www.spacefucker.com/data/xfmg/thumbnail/7/7617-124cd8cebdd9a91f41cfbc15b594652a.jpg?1524277244
			//   https://www.spacefucker.com/media/7617/full
			return src.replace(/\/data\/+xfmg\/+thumbnail\/+[0-9]+\/+([0-9]+)-[0-9a-f]{10,}\.[^/.]+(?:[?#].*)?$/, "/media/$1/full");
		}

		if (domain_nowww === "vikv.net" ||
			// https://gayles.tv/wp-content/themes/detube/images/icon-plus-24.png
			domain_nowww === "gayles.tv" ||
			// https://www.flixchimp.com/wp-content/themes/detube/images/icon-play-24.png
			domain_nowww === "flixchimp.com") {
			// https://vikv.net/wp-content/themes/detube/images/icon-play-24.png
			if (/\/wp-content\/+themes\/+detube\/+images\//.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}
		}

		if (domain_nowww === "milanparal.cz") {
			// https://www.milanparal.cz/static/_user/ilustrace/makita%20girls/Senorita%20Makita%202015/sm_2015_03_small.jpg
			//   https://www.milanparal.cz/static/_user/ilustrace/makita%20girls/Senorita%20Makita%202015/sm_2015_03.jpg
			return src.replace(/(\/static\/+_user\/+.*)_small(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "posterhd.ru") {
			// https://posterhd.ru/pictures/thumb_34885.jpg&t=3
			//   https://posterhd.ru/pictures/34885.jpg&t=0 -- without &t=0, it's equivalent to &t=1
			// -- &m=... is also an option, seems to be some kind of splicing?
			// https://posterhd.ru/pictures/thumb_34885.jpg&t=4&b=%D0%90-%D0%92110466&w=3&p=0&sw=23&sh=30
			//   https://posterhd.ru/pictures/34885.jpg&t=0
			// https://posterhd.ru/renderint.php?s=int_2.jpg&i=2&t=3&m=0&si=35309.jpg
			//   https://posterhd.ru/pictures/35309.jpg&t=0
			return src.replace(/(?:\/pictures\/+(?:thumb_)?|\/renderint\.php\?(?:.*&)?si=)([0-9]+\.[^/.?#&]+)(?:[?#&].*)?$/, "/pictures/$1&t=0");
		}

		if (domain_nowww === "tapetus.pl") {
			// https://www.tapetus.pl/img/adblock.png
			if (/\/img\/+adblock\.png/.test(src))
				return {
					url: src,
					bad: "mask"
				};
		}

		if (domain_nosub === "ali213.net") {
			// https://www.ali213.net/zt/images/bg06.png
			// https://0day.ali213.net/images/showbig_dt.png
			if (/\/zt\/+images\/+bg[0-9]+\./.test(src) ||
				/\/images\/+showbig_dt\./.test(src))
				return {
					url: src,
					bad: "mask"
				};
		}

		if (domain === "images.ali213.net") {
			// http://images.ali213.net/picfile/pic/2016/12/29/120X90_2016122955537639.jpg
			//   http://images.ali213.net/picfile/pic/2016/12/29/2016122955537639.jpg
			return src.replace(/\/picfile\/+pic\/+([0-9]{4}\/+[0-9]{2}\/+[0-9]{2}\/+)[0-9]+(?:X[0-9]+)?_/, "/picfile/pic/$1");
		}

		if (domain_nosub === "yx7088.com") {
			// http://5566.yx7088.com/images/top.png
			if (/\/images\/+top\./.test(src))
				return {
					url: src,
					bad: "mask"
				};
		}

		if (domain === "s.gamer-info.com") {
			// https://s.gamer-info.com/im/gameinfobgshadow-top.png
			// https://s.gamer-info.com/im/gameinfobgshadow-bottom.png
			if (/\/im\/+gameinfobgshadow-[a-z]+\./.test(src))
				return {
					url: src,
					bad: "mask"
				};

			// https://s.gamer-info.com/vd/2/4/3/3/24337_small_170_wide.jpg
			//   https://s.gamer-info.com/vd/2/4/3/3/24337.jpg
			return src.replace(/(\/vd\/+(?:[0-9]\/+){4}[0-9]+)_[^/.]+(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "iomoio.com") {
			// https://www.iomoio.com/img/cover-bg.png
			if (/\/img\/+cover-bg\./.test(src))
				return {
					url: src,
					bad: "mask"
				};

			// https://www.iomoio.com/covers/150/42/518942.jpg
			//   https://www.iomoio.com/covers/src/42/518942.jpg
			return src.replace(/\/covers\/+[0-9]+\/+/, "/covers/src/");
		}

		if (domain === "static.rogerebert.com") {
			// https://static.rogerebert.com/uploads/blog_post/primary_image/streaming/apple-tvs-trying-is-wholly-endearing/thumb_trying-image.jpg
			//   https://static.rogerebert.com/uploads/blog_post/primary_image/streaming/apple-tvs-trying-is-wholly-endearing/trying-image.jpg
			// https://static.rogerebert.com/redactor_assets/pictures/5eaaf156b8b50d059a5726a0/thumb_FF2.jpg
			//   https://static.rogerebert.com/redactor_assets/pictures/5eaaf156b8b50d059a5726a0/content_FF2.jpg
			//   https://static.rogerebert.com/redactor_assets/pictures/5eaaf156b8b50d059a5726a0/FF2.jpg
			return src.replace(/(\/(?:uploads\/+blog_post|redactor_assets\/+pictures)\/.*\/)(?:thumb|content)_([^/]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "cdn.adltimgcdn.com") {
			// https://cdn.adltimgcdn.com/user/300/2838761_44473_2020459e8233273c29b7b3e0ed5a414c.jpeg
			//   https://cdn.adltimgcdn.com/user/2838761_44473_2020459e8233273c29b7b3e0ed5a414c.jpeg
			return src.replace(/\/user\/+[0-9]+\/+/, "/user/");
		}

		// TODO: make generic
		if (domain_nowww === "ttgames.com" ||
			// http://www.digitalwhiplash.com/wp-content/uploads/2019/09/Stationery-Mockup-Free-Version60-biz2-thegem-portfolio-masonry-double.jpg
			//   http://www.digitalwhiplash.com/wp-content/uploads/2019/09/Stationery-Mockup-Free-Version60-biz2.jpg
			domain_nowww === "digitalwhiplash.com" ||
			// https://blog.yellowoctopus.com.au/wp-content/uploads/2019/09/yellow-octopus-aussie-christmas-songs2-thegem-portfolio-masonry-3x.jpg
			//   https://blog.yellowoctopus.com.au/wp-content/uploads/2019/09/yellow-octopus-aussie-christmas-songs2.jpg
			domain === "blog.yellowoctopus.com.au") {
			// https://www.ttgames.com/wp-content/uploads/2019/02/LEGOMovie2-thegem-portfolio-masonry-4x.png
			//   https://www.ttgames.com/wp-content/uploads/2019/02/LEGOMovie2.png
			// https://www.ttgames.com/wp-content/uploads/2019/12/Luke-5-thegem-blog-compact.jpg
			//   https://www.ttgames.com/wp-content/uploads/2019/12/Luke-5.jpg
			return src.replace(/(\/wp-content\/+uploads\/.*)-thegem-[^/.]+\./, "$1.");
		}

		if (domain === "assets.infowarsmedia.com") {
			// https://assets.infowarsmedia.com/images/2a1d8a8d-84c5-439a-a3ae-92e75fc72fe7-large.png
			//   https://assets.infowarsmedia.com/images/2a1d8a8d-84c5-439a-a3ae-92e75fc72fe7.png
			return src.replace(/(\/images\/+[-0-9a-f]{10,})-large(\.[^/.]+)(?:[?#].*)?/, "$1$2");
		}

		if (domain === "assets.infowars.com") {
			// TODO: move to -[0-9]+x[0-9]+ rule?
			// https://assets.infowars.com/2020/05/HomelessNYCGetty5420-380x218.jpg
			//   https://assets.infowars.com/2020/05/HomelessNYCGetty5420.jpg
			return src.replace(/(:\/\/[^/]+\/+[0-9]{4}\/+[0-9]{2}\/+[^/]+)-[0-9]+x[0-9]+(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "wallpapername.com") {
			// http://www.wallpapername.com/thumbnails/cover/20200422/5ea08f910f60f.jpg
			//   http://www.wallpapername.com/thumbnails/detail/20200422/5ea08f910f60f.jpg
			//   http://cdn.wallpapername.com/1920x1200/20200422/5ea08f910f60f.jpg
			//   http://www.wallpapername.com/Singers/Taylor_Swift/1920x1200_px_Anahi_babes_brunettes_eyes_face_females_Girls_Gonzales_models_sexy_swimsuit_swimwear_wo_77041
			return src.replace(/\/thumbnails\/+cover\/+/, "/thumbnails/detail/");
		}

		if (domain === "c.puzzcore.com") {
			// https://c.puzzcore.com//img_pzl/Z3S/Z3SBL88H/1210056OFN/thumb1.jpg
			//   https://c.puzzcore.com//img_pzl/Z3S/Z3SBL88H/1210056OFN/thumb2.jpg
			// https://c.puzzcore.com//img_pzl/NTK/NTKNC6XE/160109R0XC/thumb1.jpg
			//   https://c.puzzcore.com//img_pzl/NTK/NTKNC6XE/160109R0XC/thumb2.jpg
			//   https://c.puzzcore.com//img_pzl/NTK/NTKNC6XE/160109R0XC/thumb2.jpg
			//   https://www.puzzcore.com/pzl/160109R0XC
			return {
				url: src.replace(/(\/img_pzl\/.*\/thumb)1(\.[^/.]+)(?:[?#].*)?$/, "$12$2"),
				headers: {
					Referer: "https://www.puzzcore.com/"
				}
			};
		}

		if (domain === "img.faxingzhan.com") {
			// https://img.faxingzhan.com/151223/54-1512230U039592_220_130.jpg
			//   https://img.faxingzhan.com/151223/54-1512230U039592.jpg
			return src.replace(/(\/[0-9]+\/+[0-9]+-[0-9A-Z]+)_[0-9]+_[0-9]+(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "thumb.ex-cdn.com") {
			// https://thumb.ex-cdn.com/EXP/media.vntravellive.com/center/1903x700/files/news/2020/03/05/covid-19-epidemic-is-spreading-globally-141354.jpg
			//   https://thumb.ex-cdn.com/EXP/media.vntravellive.com/resize/99999999999x99999999999/files/news/2020/03/05/covid-19-epidemic-is-spreading-globally-141354.jpg
			//   https://media.ex-cdn.com/EXP/media.vntravellive.com/files/news/2020/03/05/covid-19-epidemic-is-spreading-globally-141354.jpg
			newsrc = src.replace(/^([a-z]+:\/\/[^/]+\/+EXP\/+[^/]+\/+)(?:resize|center)\/+[0-9]+x[0-9]+\/+/, "$1resize/99999999999x99999999999/");
			if (newsrc !== src)
				return newsrc;

			return src.replace(/^[a-z]+:\/\/[^/]+\/+(EXP\/+[^/]+\/+)(?:resize|center)\/+[0-9]+x[0-9]+\/+/, "https://media.ex-cdn.com/$1");
		}

		if (domain_nowww === "sweetandtalented.com") {
			// http://www.sweetandtalented.com/images/knightley/knightley_tm136.jpg
			//   http://www.sweetandtalented.com/images/knightley/knightley136.jpg
			return src.replace(/(\/images\/+[^/]+\/+[^/]+)_tm([0-9]+\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nosub === "scotsman.com" ||
			// thanks to roi:
			// https://www.yorkshirepost.co.uk/webimg/b25lY21zOjNmNTIzMTM5LWI0ZjEtNGI0ZS1hMzNiLTE2Mjk2ZGU0ZGM1MzowYWRhODI1MC1iZjUyLTQ0MWQtYjdlOC1hNjk0MzM5OTBkOWM=.jpg?quality=65&smart&width=640 -- 640x426
			// https://www.yorkshirepost.co.uk/webimg/b25lY21zOjNmNTIzMTM5LWI0ZjEtNGI0ZS1hMzNiLTE2Mjk2ZGU0ZGM1MzowYWRhODI1MC1iZjUyLTQ0MWQtYjdlOC1hNjk0MzM5OTBkOWM=.jpg -- 2000x1333
			//   https://www.yorkshirepost.co.uk/jp-ct.co.uk/image/onecms:3f523139-b4f1-4b4e-a33b-16296de4dc53:0ada8250-bf52-441d-b7e8-a69433990d9c/image.jpg -- 3500x2386
			domain_nowww === "yorkshirepost.co.uk" ||
			// thanks to anonymous for reporting:
			// https://www.wigantoday.net/webimg/b25lY21zOmE0NmZiMWEzLTI0ZGEtNGIzOC05OWJjLTFlNGQ2NDdkOTIxODplZDkwZDE5My1lMmJlLTQ1NmEtYWE4NC1kZDY0ZjUwMmE4ODM=.jpg?crop=3:2,smart&trim=&width=640&quality=65
			//   https://www.wigantoday.net/jp-ct.co.uk/image/onecms:a46fb1a3-24da-4b38-99bc-1e4d647d9218:ed90d193-e2be-456a-aa84-dd64f502a883/image.jpg
			domain_nowww === "wigantoday.net" ||
			// thanks to anonymous for reporting:
			// https://www.lep.co.uk/webimg/b25lY21zOjc3NjY4Yzc0LTZkNTEtNDA3YS1hNzRjLTg3YWQzZGI5OWJmNzoyZjBiZDhjYi04ZmExLTRhZjQtYTczMy02MDEzMWU0NDRiMmY=.jpg?crop=3:2,smart&trim=&width=640&quality=65
			//   https://www.lep.co.uk/jp-ct.co.uk/image/onecms:77668c74-6d51-407a-a74c-87ad3db99bf7:2f0bd8cb-8fa1-4af4-a733-60131e444b2f/image.jpg
			domain_nowww === "lep.co.uk") {
			// https://www.scotsman.com/jp-ct.co.uk/image/onecms:cb3ec9d1-b8cb-4ceb-9d41-3a01cacb749b:164d1d35-044a-44a9-a1be-2e631c213050/image.jpg
			//   https://jp-ct.co.uk/image/onecms:cb3ec9d1-b8cb-4ceb-9d41-3a01cacb749b:164d1d35-044a-44a9-a1be-2e631c213050/image.jpg
			// https://www.edinburghnews.scotsman.com/jp-ct.co.uk/image/onecms:52e335b9-ba0e-452f-bdb0-0d07d4e59215:677812b7-9d2a-47c2-975e-aeeaf6df63ab/image.jpg
			//   https://jp-ct.co.uk/image/onecms:52e335b9-ba0e-452f-bdb0-0d07d4e59215:677812b7-9d2a-47c2-975e-aeeaf6df63ab/image.jpg
			// https://www.edinburghnews.scotsman.com/jp-ct.co.uk/image/onecms:4b3333db-2c47-4618-adb8-620540546138:7e54dc7d-fc35-4140-a25e-11bf47337f58/image.jpg?width=640
			//   https://jp-ct.co.uk/image/onecms:4b3333db-2c47-4618-adb8-620540546138:7e54dc7d-fc35-4140-a25e-11bf47337f58/image.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+(jp-ct\.co\.uk\/.*?)(?:[?#].*)?$/, "https://$1");
			// no public access
			if (false && newsrc !== src)
				return newsrc;

			// https://www.scotsman.com/webimg/b25lY21zOmI1MGQ0NTk5LTIzYjItNDkxNC1hMDY2LTE5MWY5NDk4NDMzNDo0ZGUyMjZhMS0xYjgyLTQzN2QtOWZkYi1kZWFlZGQyNzEyNTI=.jpg?crop=61:45,smart&width=600
			//   https://jp-ct.co.uk/image/onecms:b50d4599-23b2-4914-a066-191f94984334:4de226a1-1b82-437d-9fdb-deaedd271252/image.jpg
			// https://www.scotsman.com/webimg/RUxNODYyNjA1NTY=.jpg?crop=61:45,smart&width=600
			//   https://www.scotsman.com/webimg/RUxNODYyNjA1NTY=.jpg
			match = src.match(/^[a-z]+:\/\/[^/]+\/+webimg\/+([^-_/.]+)(\.[^/.?#]+)?(?:[?#].*)?$/);
			if (match) {
				newsrc = src.replace(/[?#].*$/, "");
				if (newsrc !== src)
					return newsrc;

				try {
					// atob('b25lY21zOmI1MGQ0NTk5LTIzYjItNDkxNC1hMDY2LTE5MWY5NDk4NDMzNDo0ZGUyMjZhMS0xYjgyLTQzN2QtOWZkYi1kZWFlZGQyNzEyNTI')
					//  = onecms:b50d4599-23b2-4914-a066-191f94984334:4de226a1-1b82-437d-9fdb-deaedd271252
					var decoded = base64_decode(match[1]);

					if (/^onecms:([-0-9a-f]+:[-0-9a-f]+)$/.test(decoded))
						return "https://" + domain + "/jp-ct.co.uk/image/" + decoded + "/image" + (match[2] || ".jpg");
				} catch (e) {
					console_error(e);
				}
			}

			if (/\/(?:webimg|jp-ct\.co\.uk)\//.test(src)) {
				return {
					url: src,
					can_head: false // 404
				};
			}
		}

		if (domain === "nmbimg.fastmirror.org") {
			// https://nmbimg.fastmirror.org/thumb/2020-05-06/5eb2c36e37ea0.jpg
			//   https://nmbimg.fastmirror.org/image/2020-05-06/5eb2c36e37ea0.jpg
			return src.replace(/\/thumb\/+([0-9]{4}-[0-9]{2}-[0-9]{2}\/+[0-9a-f]+\.)/, "/image/$1");
		}

		if (domain_nowww === "supraphonline.cz") {
			// https://www.supraphonline.cz/assets/images/sexycover/lp_close.png
			if (/\/assets\/+images\/+sexycover\/+/.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}
		}

		if (domain_nowww === "mp3va.com") {
			// https://www.mp3va.com/img/cover-pt-3.png
			if (/\/img\/+cover-pt-[0-9]+\./.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}
		}

		if (domain === "d27t0qkxhe4r68.cloudfront.net") {
			// https://d27t0qkxhe4r68.cloudfront.net/sizedimages/composers/200/mozart.jpg?1491044400
			//   https://d27t0qkxhe4r68.cloudfront.net/images/composers/mozart.jpg?1491044400
			// https://d27t0qkxhe4r68.cloudfront.net/t_900/A10301A00038512959.jpg?1524739180
			// https://d27t0qkxhe4r68.cloudfront.net/sm/t/300/8661400.jpeg?1572018935
			//   https://d1iiivw74516uk.cloudfront.net/eyJidWNrZXQiOiJwcmVzdG8tY292ZXItaW1hZ2VzIiwia2V5IjoiODY2MTQwMC4xLmpwZyIsInRpbWVzdGFtcCI6MTU4NTIzNDk5NX0=
			// other:
			// https://d27t0qkxhe4r68.cloudfront.net/sm/t/orig/ISBN9783923051502.jpg?1580747809 -- no longer works
			// https://d27t0qkxhe4r68.cloudfront.net/sm/ft/orig/mds-IMC2656_2.jpg?1380721017 -- no longer works (404)
			return src
				.replace(/\/sizedimages\/+([^/]+\/+)[0-9]+\/+/, "/images/$1");
		}

		// https://github.com/lovell/sharp ?
		if (domain === "d1iiivw74516uk.cloudfront.net" ||
			// https://d27csu38upkiqd.cloudfront.net/eyJidWNrZXQiOiJmZGMtc2l0ZXB1YmxpYy1tZWRpYS1wcm9kIiwia2V5IjoidXBsb2Fkc1wvMjAyM1wvMDNcLzgwNDk0LmpwZyIsImVkaXRzIjp7InJlc2l6ZSI6eyJ3aWR0aCI6Mjk2LCJmaXQiOiJjb3ZlciJ9LCJ0b0Zvcm1hdCI6IndlYnAifX0=
			//   https://d27csu38upkiqd.cloudfront.net/eyJidWNrZXQiOiJmZGMtc2l0ZXB1YmxpYy1tZWRpYS1wcm9kIiwia2V5IjoidXBsb2Fkcy8yMDIzLzAzLzgwNDk0LmpwZyJ9
			// atob:
			//   = {"bucket":"fdc-sitepublic-media-prod","key":"uploads\/2023\/03\/80494.jpg","edits":{"resize":{"width":296,"fit":"cover"},"toFormat":"webp"}}
			domain === "d27csu38upkiqd.cloudfront.net" ||
			// thanks to anonymous for reporting:
			// https://images.are.na/eyJidWNrZXQiOiJhcmVuYV9pbWFnZXMiLCJrZXkiOiIyNzkwNDg2NC9vcmlnaW5hbF9iOGVjYWU4Zjc4ZTIzNWJmZWJjYzlhZTAxM2IwYTkwNy5qcGciLCJlZGl0cyI6eyJyZXNpemUiOnsid2lkdGgiOjI0MDAsImhlaWdodCI6MjQwMCwiZml0IjoiaW5zaWRlIiwid2l0aG91dEVubGFyZ2VtZW50Ijp0cnVlfSwid2VicCI6eyJxdWFsaXR5Ijo2NX0sImpwZWciOnsicXVhbGl0eSI6NjV9LCJyb3RhdGUiOm51bGx9fQ==
			//   https://images.are.na/eyJidWNrZXQiOiJhcmVuYV9pbWFnZXMiLCJrZXkiOiIyNzkwNDg2NC9vcmlnaW5hbF9iOGVjYWU4Zjc4ZTIzNWJmZWJjYzlhZTAxM2IwYTkwNy5qcGcifQ==
			// atob:
			//   = {"bucket":"arena_images","key":"27904864/original_b8ecae8f78e235bfebcc9ae013b0a907.jpg","edits":{"resize":{"width":2400,"height":2400,"fit":"inside","withoutEnlargement":true},"webp":{"quality":65},"jpeg":{"quality":65},"rotate":null}}
			domain === "images.are.na" ||
			// thanks to mantou on discord:
			// https://cdn.gamerch.com/resize/eyJidWNrZXQiOiJnYW1lcmNoLWltZy1jb250ZW50cyIsImtleSI6Indpa2lcLzM4MjNcL2VudHJ5XC8xNjQ3MzE0MDk2LmpwZyIsImVkaXRzIjp7IndlYnAiOnsicXVhbGl0eSI6ODV9LCJ0b0Zvcm1hdCI6IndlYnAiLCJyZXNpemUiOnsid2lkdGgiOjIwMCwiZml0IjoiY292ZXIifX19
			//   https://cdn.gamerch.com/resize/eyJidWNrZXQiOiJnYW1lcmNoLWltZy1jb250ZW50cyIsImtleSI6Indpa2kvMzgyMy9lbnRyeS8xNjQ3MzE0MDk2LmpwZyJ9
			//   https://gamerch-img-contents.s3.amazonaws.com/wiki/3823/entry/1647314096.jpg
			//   https://cdn.gamerch.com/contents/wiki/3823/entry/1647314096.jpg
			// atob:
			//   = {"bucket":"gamerch-img-contents","key":"wiki\/3823\/entry\/1647314096.jpg","edits":{"webp":{"quality":85},"toFormat":"webp","resize":{"width":200,"fit":"cover"}}}
			domain === "cdn.gamerch.com" ||
			// thanks to Froktime on github: https://github.com/qsniyg/maxurl/issues/1382
			// https://img.tumblbug.com/eyJidWNrZXQiOiJ0dW1ibGJ1Zy1pbWctYXNzZXRzIiwia2V5Ijoic3RvcnkvNGRjNWQzMjItZDRhMy00NGY3LWIwZmItNDhjZTFiNGVkMDk2LzMyMmIzMzlkLTc3YmEtNGJhZS1iYWI1LWFhMjcwNjE5MWJhZi5qcGciLCJlZGl0cyI6eyJyZXNpemUiOnsid2lkdGgiOjEyNDAsIndpdGhvdXRFbmxhcmdlbWVudCI6dHJ1ZX19fQ==
			//   https://img.tumblbug.com/eyJidWNrZXQiOiJ0dW1ibGJ1Zy1pbWctYXNzZXRzIiwia2V5Ijoic3RvcnkvNGRjNWQzMjItZDRhMy00NGY3LWIwZmItNDhjZTFiNGVkMDk2LzMyMmIzMzlkLTc3YmEtNGJhZS1iYWI1LWFhMjcwNjE5MWJhZi5qcGcifQ==
			//   https://img.tumblbug.com/story/4dc5d322-d4a3-44f7-b0fb-48ce1b4ed096/322b339d-77ba-4bae-bab5-aa2706191baf.jpg
			// atob:
			//   = {"bucket":"tumblbug-img-assets","key":"story/4dc5d322-d4a3-44f7-b0fb-48ce1b4ed096/322b339d-77ba-4bae-bab5-aa2706191baf.jpg","edits":{"resize":{"width":1240,"withoutEnlargement":true}}}
			domain === "img.tumblbug.com" ||
			// thanks to anonymous for reporting:
			// https://d193frjqb908ar.cloudfront.net/eyJidWNrZXQiOiJtaWxlc3BsaXQiLCJrZXkiOiJwaG90b3NcLzYyODg5XC9ub3JtYWxcLzQwOTQ5ODE1IiwiZWRpdHMiOnsicmVzaXplIjp7IndpZHRoIjozMDAsImZpdCI6ImNvdmVyIiwicG9zaXRpb24iOiJjZW50ZXIiLCJoZWlnaHQiOjE2OX19fQ==?Expires=...
			//   https://milesplit.s3.amazonaws.com/photos/62889/normal/40949815
			// atob:
			//   = {"bucket":"milesplit","key":"photos\/62889\/normal\/40949815","edits":{"resize":{"width":300,"fit":"cover","position":"center","height":169}}}
			// other:
			// https://d193frjqb908ar.cloudfront.net/eyJidWNrZXQiOiJmaWxlcy5taWxlc3BsaXQudXMiLCJrZXkiOiJhcnRpY2xlc1wvMzUwMDIzXC9pbWFnZXNcL2NvdmVyLTE3MjM4Mzg2MzMucG5nIiwiZWRpdHMiOnsicmVzaXplIjp7IndpZHRoIjoyMDAsImZpdCI6ImNvdmVyIiwicG9zaXRpb24iOiJjZW50ZXIiLCJoZWlnaHQiOjExM319fQ==?Expires=...
			//   https://milesplit.s3.amazonaws.com/articles/350023/images/cover-1723838633.png -- 403
			// atob:
			//   = {"bucket":"files.milesplit.us","key":"articles\\/350023\\/images\\/cover-1723838633.png","edits":{"resize":{"width":200,"fit":"cover","position":"center","height":113}}}
			domain === "d193frjqb908ar.cloudfront.net" ||
			// thanks to anonymous for reporting:
			// https://images.ams-prd.blv.cloud/eyJidWNrZXQiOiJpbWFnZXMtcHJkLTFvNHV6OXpieHd6cDF1Ym0iLCJrZXkiOiJkYTkwNjE5Yy0yOGVkLTRjMDYtOTkzNi03Y2EzNGE1NjI1MzQiLCJlZGl0cyI6eyJyZXNpemUiOnsid2lkdGgiOjM2MCwiaGVpZ2h0IjozNjB9fX0=
			//   https://images.ams-prd.blv.cloud/eyJidWNrZXQiOiJpbWFnZXMtcHJkLTFvNHV6OXpieHd6cDF1Ym0iLCJrZXkiOiJkYTkwNjE5Yy0yOGVkLTRjMDYtOTkzNi03Y2EzNGE1NjI1MzQifQ==
			// atob:
			//   = {"bucket":"images-prd-1o4uz9zbxwzp1ubm","key":"da90619c-28ed-4c06-9936-7ca34a562534"}
			domain === "images.ams-prd.blv.cloud") {
			// https://d1iiivw74516uk.cloudfront.net/eyJidWNrZXQiOiJwcmVzdG8tY292ZXItaW1hZ2VzIiwia2V5IjoiODE3OTQzMy4xLmpwZyIsImVkaXRzIjp7InJlc2l6ZSI6eyJ3aWR0aCI6MzAwfSwianBlZyI6eyJxdWFsaXR5Ijo2NX0sInRvRm9ybWF0IjoianBlZyJ9LCJ0aW1lc3RhbXAiOjE0NzYxMDUxMjR9
			//   https://d1iiivw74516uk.cloudfront.net/eyJidWNrZXQiOiJwcmVzdG8tY292ZXItaW1hZ2VzIiwia2V5IjoiODE3OTQzMy4xLmpwZyIsInRpbWVzdGFtcCI6MTQ3NjEwNTEyNH0=
			// atob:
			//   = {"bucket":"presto-cover-images","key":"8179433.1.jpg","edits":{"resize":{"width":300},"jpeg":{"quality":65},"toFormat":"jpeg"},"timestamp":1476105124}
			match = src.match(/^([a-z]+:\/\/[^/]+\/+(?:resize\/+)?)([^-_/.]{20,})(?:[?#].*)?$/);
			if (match) {
				let orig_map = {
					"cdn.gamerch.com/gamerch-img-contents": "https://cdn.gamerch.com/contents/",
					"img.tumblbug.com/tumblbug-img-assets": "https://img.tumblbug.com/",
					"d193frjqb908ar.cloudfront.net/milesplit": "https://milesplit.s3.amazonaws.com/"
					//"d193frjqb908ar.cloudfront.net/files.milesplit.us": ""
				};

				try {
					let host = match[1];
					let decoded = base64_decode(match[2]);
					var json = JSON_parse(decoded);

					delete json.edits;

					let urls = [];

					let domainbucket = domain + "/" + (json.bucket||"");
					if (domainbucket in orig_map) {
						urls.push(orig_map[domainbucket] + json.key);
					}

					if (!/[?&]Signature=/i.test(src))
						urls.push(host + base64_encode(JSON_stringify(json)));

					if (urls.length > 0)
						return urls;
				} catch (e) {
					console_error(e);
				}
			}
		}

		if (amazon_container === "milesplit") {
			// thanks to anonymous for reporting:
			// https://milesplit.s3.amazonaws.com/photos/62889/normal/40949815
			//   https://milesplit.s3.amazonaws.com/photos/62889/original/40949815
			return src.replace(/(\/photos\/+[0-9]+\/+)normal\/+/, "$1original/");
		}

		if (domain === "imagery.zoogletools.com" ||
			// https://s3.amazonaws.com/content.sitezoogle.com/u/243801/88f8a590bc091005ed1823c00dca5bc173e97c89/photo/rnr-interview.jpg
			//   https://s3.amazonaws.com/content.sitezoogle.com/u/243801/88f8a590bc091005ed1823c00dca5bc173e97c89/original/rnr-interview.jpg
			amazon_container === "content.sitezoogle.com" ||
			// http://content.sitezoogle.com/u/243801/88f8a590bc091005ed1823c00dca5bc173e97c89/photo/rnr-interview.jpg
			//   http://content.sitezoogle.com/u/243801/88f8a590bc091005ed1823c00dca5bc173e97c89/original/rnr-interview.jpg
			domain === "content.sitezoogle.com" ||
			// https://s3.amazonaws.com/zoogle-imager-production-2020/u/333257/1349c4b77893af624e4e8ca9650d49bfcdeac1ef/original/untitled-1.jpg/!!/b%3AW1siZXh0cmFjdCIseyJsZWZ0IjoxMDMsInRvcCI6NTMsIndpZHRoIjo1NzQ0LCJoZWlnaHQiOjI5NzZ9XSxbInJlc2l6ZSIsMTYwMF0sWyJtYXgiXSxbIndlIl1d.jpg
			//   https://s3.amazonaws.com/zoogle-imager-production-2020/u/333257/1349c4b77893af624e4e8ca9650d49bfcdeac1ef/original/untitled-1.jpg
			amazon_container === "zoogle-imager-production-2020") {
			// https://imagery.zoogletools.com/u/333257/1349c4b77893af624e4e8ca9650d49bfcdeac1ef/original/untitled-1.jpg/!!/b%3AW1siZXh0cmFjdCIseyJsZWZ0IjoxMDMsInRvcCI6NTMsIndpZHRoIjo1NzQ0LCJoZWlnaHQiOjI5NzZ9XSxbInJlc2l6ZSIsMTYwMF0sWyJtYXgiXSxbIndlIl1d.jpg
			//   https://s3.amazonaws.com/zoogle-imager-production-2020/u/333257/1349c4b77893af624e4e8ca9650d49bfcdeac1ef/original/untitled-1.jpg
			// atob("W1siZXh0cmFjdCIseyJsZWZ0IjoxMDMsInRvcCI6NTMsIndpZHRoIjo1NzQ0LCJoZWlnaHQiOjI5NzZ9XSxbInJlc2l6ZSIsMTYwMF0sWyJtYXgiXSxbIndlIl1d")
			//   = [["extract",{"left":103,"top":53,"width":5744,"height":2976}],["resize",1600],["max"],["we"]]
			// thanks to nimuxoha on github: https://github.com/qsniyg/maxurl/issues/363
			// https://imagery.zoogletools.com/u/243801/88f8a590bc091005ed1823c00dca5bc173e97c89/thumb/rnr-interview.jpg
			//   https://imagery.zoogletools.com/u/243801/88f8a590bc091005ed1823c00dca5bc173e97c89/thumbnail/rnr-interview.jpg
			//   https://imagery.zoogletools.com/u/243801/88f8a590bc091005ed1823c00dca5bc173e97c89/small/rnr-interview.jpg
			//   https://imagery.zoogletools.com/u/243801/88f8a590bc091005ed1823c00dca5bc173e97c89/medium/rnr-interview.jpg
			//   https://imagery.zoogletools.com/u/243801/88f8a590bc091005ed1823c00dca5bc173e97c89/large/rnr-interview.jpg
			//   https://imagery.zoogletools.com/u/243801/88f8a590bc091005ed1823c00dca5bc173e97c89/photo/rnr-interview.jpg
			//   https://imagery.zoogletools.com/u/243801/88f8a590bc091005ed1823c00dca5bc173e97c89/original/rnr-interview.jpg
			return {
				url: src
					.replace(/(\/u\/+[0-9]+\/+[0-9a-f]{10,}\/+)[a-z]+(\/+[^/]+\.[^/.]+)(?:[?#].*)?$/, "$1original$2")
					.replace(/(\/u\/+[0-9]+\/+[0-9a-f]{10,}\/+[^/]+\/+[^/]+)\/+!!\/.*/, "$1"),
				can_head: false // 403
			};
		}

		if (domain === "cache.willhaben.at") {
			// https://www.willhaben.at/iad/immobilien/d/haus-kaufen/wien/wien-1220-donaustadt/anleger-investoren-aufgepasst-360470932/
			// https://cache.willhaben.at/mmo/2/360/470/932_-1048381452_hoved.jpg
			//   https://cache.willhaben.at/mmo/2/360/470/932_-1048381452.jpg
			// https://cache.willhaben.at/mmo/logo/atz/19041691/boubeva_6703718727609813088_large.png
			//   https://cache.willhaben.at/mmo/logo/atz/19041691/boubeva_6703718727609813088.png
			// https://cache.willhaben.at/mmo/2/360/470/932_-718016830_thumb.jpg
			//   https://cache.willhaben.at/mmo/2/360/470/932_-718016830.jpg
			return src.replace(/(\/mmo\/.*[0-9]+)_(?:hoved|large|thumb)(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nosub === "img-dpreview.com") {
			// https://4.img-dpreview.com/resources/images/play-overlay-icon.png?v=5105
			if (/\/resources\/+images\/+play-overlay-icon\./.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}

			// https://4.img-dpreview.com/files/w/TC16x9S280x157?url=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fkd7wdYetKbY%2Fhqdefault.jpg&signature=dm28vBZUdFr6S2adlJT4X0Wj3Ak%3D&v=5105
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+files\/+w\/+[^/?]+\?(?:.*&)?url=([^&]+).*?$/, "$1");

			// thanks to doio on github: https://github.com/qsniyg/maxurl/issues/1064
			// https://1.img-dpreview.com/files/g/TS940x940~4245981.jpg -- via https://www.dpreview.com/forums/post/65771195
			//   https://1.img-dpreview.com/files/g/4245981.jpg
			// https://4.img-dpreview.com/files/g/TS940x940~4245993.jpg
			//   https://4.img-dpreview.com/files/g/4245993.jpg
			newsrc = src.replace(/(\/files\/g\/)TS\d+x\d+~(\d+\.)/, "$1$2");

			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);

			// https://1.img-dpreview.com/files/p/E~C0x160S1200x662T290x160~feature_blocks/e32d2f171ca24c79b1d7ac6864497d92.jpeg
			//   https://1.img-dpreview.com/files/p/E~feature_blocks/e32d2f171ca24c79b1d7ac6864497d92.jpeg
			//   https://1.img-dpreview.com/files/p/feature_blocks/e32d2f171ca24c79b1d7ac6864497d92.jpeg
			// https://2.img-dpreview.com/files/p/TC300x203S300x203~articles/3840039923/Stocksy_txpee513538L3y100_Small_1841215.jpeg?v=5105
			//   https://2.img-dpreview.com/files/p/articles/3840039923/Stocksy_txpee513538L3y100_Small_1841215.jpeg?v=5105
			// https://2.img-dpreview.com/files/p/articles/6295202045/DSCF0302.acr.jpeg -- 5500x3667
			return src.replace(/(\/files\/+p\/+)(?:E~)?[^/~]+~([^/~]+\/+)/, "$1$2");
		}

		if (domain_nowww === "artsphere.fr") {
			// https://www.artsphere.fr/cache/media/6/image/264x180_david_bellemere_artsphere_beauty_23.jpg
			//   https://www.artsphere.fr/cache/media/6/image/david_bellemere_artsphere_beauty_23.jpg
			return src.replace(/(\/cache\/+media\/+[0-9]+\/+image\/+)[0-9]+x[0-9]+_/, "$1");
		}

		if (domain === "p.zvezda.photo") {
			// https://p.zvezda.photo/contents/pics/458000/458548/300x300/1.jpg
			//   https://p.zvezda.photo/contents/pics/458000/458548/preview.jpg
			return src.replace(/(\/contents\/+pics\/+[0-9]+\/+[0-9]+\/+)[0-9]+x[0-9]+\/+1(\.[^/.]+)(?:[?#].*)?$/, "$1preview$2");
		}

		if (amazon_container === "speakerd") {
			// https://speakerd.s3.amazonaws.com/presentations/f8653c8c6ffc4f54bb4683daa8c1a284/preview_slide_67.jpg?513402
			//   https://speakerd.s3.amazonaws.com/presentations/f8653c8c6ffc4f54bb4683daa8c1a284/slide_67.jpg?513402
			return src.replace(/\/preview_(slide_[0-9]+\.[^/.]+)(?:[?#].*)?$/, "/$1");
		}

		// TODO: make this generic
		if (domain === "peertube.linuxrocks.online" ||
			// https://peertube.live/static/thumbnails/bcc1c74b-fefe-4092-aab7-17bb18cb09ab.jpg
			//   https://peertube.debian.social/static/webseed/bcc1c74b-fefe-4092-aab7-17bb18cb09ab-720.mp4
			domain_nowww === "peertube.live" ||
			// https://peertube.video/static/thumbnails/1cc6b4cd-ac16-4300-8adc-d9df3fb4f0af.jpg
			domain_nowww === "peertube.video" ||
			// https://peertube.nocturlab.fr/static/webseed/1cc6b4cd-ac16-4300-8adc-d9df3fb4f0af-720.mp4
			domain_nowww === "peertube.nocturlab.fr" ||
			// https://peertube.debian.social/static/webseed/1f31fce7-f2b2-48fd-9b58-f1404df7c60c-576.mp4
			domain === "peertube.debian.social" ||
			// https://bittube.video/static/webseed/64546964-fe85-4505-957b-bea15628e53e-480.mp4
			domain_nowww === "bittube.video" ||
			// https://toobnix.org/static/webseed/1f997b3c-00dc-4f7d-b2ce-74538c194fa7-1080.mp4
			domain_nowww === "toobnix.org" ||
			domain === "pt.pube.tk" ||
			// https://framatube.org/static/webseed/9c9de5e8-0a1e-484a-b099-e80766180a6d-1080.mp4
			domain_nowww === "framatube.org" ||
			// https://peertube.gegeweb.eu/static/webseed/755d0a1c-2fe8-4839-b802-912c9fd6fe83-360.mp4
			domain === "peertube.gegeweb.eu" ||
			// https://peer.hostux.social/static/webseed/7f0b04f7-1774-4597-95c3-47ad1e253027-1080.mp4
			domain === "peer.hostux.social" ||
			// https://banneddata.me/static/thumbnails/ab46d9b9-d9fd-4555-8d22-8d4b534867a8.jpg
			//   https://banneddata.me/static/webseed/ab46d9b9-d9fd-4555-8d22-8d4b534867a8-720.mp4
			domain_nowww === "banneddata.me" ||
			// https://tube.midov.pl/static/webseed/1bbc0138-209f-409e-92bd-bd832499e68e-480.mp4
			domain === "tube.midov.pl" ||
			// https://vault.mle.party/static/webseed/382a5983-9602-4249-a88d-65f8e0197535-720.mp4
			domain === "vault.mle.party" ||
			// https://skeptikon.fr/static/webseed/b49ddfaf-0ece-48ca-b41a-b0d798c76390-1080.mp4
			domain_nowww === "skeptikon.fr" ||
			// https://peertube.parleur.net/static/webseed/3cf3c055-61f1-4913-ad30-0e51ebe68d98-720.mp4
			domain_nowww === "peertube.parleur.net" ||
			// https://open.tube/static/thumbnails/0ef8384c-b732-4352-ae1b-52bb96d8e2ae.jpg
			domain_nowww === "open.tube" ||
			// https://peertube.umeahackerspace.se/static/thumbnails/0c8dc9fd-6243-4b04-b99c-64da0bb39ee8.jpg
			domain === "peertube.umeahackerspace.se" ||
			// https://tube.rebellion.global/static/thumbnails/758dc98c-a5d0-44e2-b92f-29448763d9d8.jpg
			domain === "tube.rebellion.global" ||
			// https://video.lewd.host/static/thumbnails/32902e72-c806-432f-abbe-93eef3c27c97.jpg
			domain === "video.lewd.host" ||
			// https://nocensoring.net/static/thumbnails/b2fe309e-ed4c-46ac-aad6-d9fda4f9ff9f.jpg
			domain_nowww === "nocensoring.net" ||
			// https://peertube.co.uk/static/thumbnails/a441bd81-dcde-4d41-a745-35068e084dbf.jpg
			domain_nowww === "peertube.co.uk" ||
			// https://tube.aquilenet.fr/static/thumbnails/a441bd81-dcde-4d41-a745-35068e084dbf.jpg
			domain === "tube.aquilenet.fr" ||
			// https://peertube.datagueule.tv/static/thumbnails/83b17112-d902-46a8-b1a6-95df8ac08888.jpg
			domain === "peertube.datagueule.tv" ||
			// https://video.antopie.org/static/thumbnails/b9991c48-1754-458d-899e-cd960d68ae21.jpg
			domain === "video.antopie.org" ||
			// https://pt.kircheneuenburg.de/static/thumbnails/afa99430-71cb-4366-9a7d-b857bad7e432.jpg
			domain === "pt.kircheneuenburg.de" ||
			// https://devtube.dev-wiki.de/static/thumbnails/c4bb5efe-9dac-4f5c-8953-ae706892cd72.jpg
			domain === "devtube.dev-wiki.de" ||
			// https://porntube.ddns.net/static/thumbnails/1f31fce7-f2b2-48fd-9b58-f1404df7c60c.jpg
			domain === "porntube.ddns.net" ||
			// https://peertube.su/static/thumbnails/9c9de5e8-0a1e-484a-b099-e80766180a6d.jpg
			domain_nowww === "peertube.su" ||
			// https://yt.is.nota.live/static/thumbnails/62706ca1-df7f-47d2-ad47-7989999266ee.jpg
			domain === "yt.is.nota.live" ||
			// https://viid.ga/static/thumbnails/0aeeddb3-c964-4636-9642-3d2cc3f91cce.jpg
			domain_nowww === "viid.ga" ||
			// https://diode.zone/static/thumbnails/b9991c48-1754-458d-899e-cd960d68ae21.jpg
			domain_nowww === "diode.zone" ||
			// https://scitech.video/static/thumbnails/79965d3d-f788-4cbf-9c05-66e1d39c8a74.jpg
			domain_nowww === "scitech.video" ||
			// https://greatview.video/static/thumbnails/4c65d46d-6260-43e1-8f7c-e7e23d71d1e6.jpg
			domain_nowww === "greatview.video" ||
			// https://peertube.iriseden.eu/static/thumbnails/76011c74-2a6c-4da0-b277-3568c4d0f2ad.jpg
			domain === "peertube.iriseden.eu" ||
			// https://tube.govital.net/static/thumbnails/bcc1c74b-fefe-4092-aab7-17bb18cb09ab.jpg
			domain === "tube.govital.net" ||
			// https://video.colibris-outilslibres.org/static/thumbnails/fe3fb11f-799b-4a0b-8b57-9472f85d8f6e.jpg
			domain === "video.colibris-outilslibres.org" ||
			// https://libre.tube/static/thumbnails/bf99b555-d91a-46fa-8578-6ed54fe238db.jpg
			domain_nowww === "libre.tube" ||
			// https://vidcommons.org/static/thumbnails/50c7204f-fd8e-4f5f-8535-b8a0020c05e3.jpg
			domain_nowww === "vidcommons.org" ||
			// https://spacepub.space/static/thumbnails/691f2bc1-d4bf-4051-a035-035388a059b0.jpg
			domain_nowww === "spacepub.space" ||
			// https://video.gafamfree.party/static/thumbnails/e251b01c-2098-426d-86b6-6c85f6602530.jpg
			domain === "video.gafamfree.party" ||
			// https://troo.tube/static/thumbnails/1427fcb7-a963-4c2c-b83d-9a04f3ad47b5.jpg
			domain_nowww === "troo.tube" ||
			// https://video.ploud.fr/static/thumbnails/1f31fce7-f2b2-48fd-9b58-f1404df7c60c.jpg
			domain === "video.ploud.fr" ||
			// https://tube.ac-lyon.fr/static/thumbnails/fa3081f4-e9c3-4d55-ad84-1335b78d8562.jpg
			domain === "tube.ac-lyon.fr" ||
			// https://peertube.librelabucm.org/static/thumbnails/cc55e615-d204-417c-9575-7b57674cc6f3.jpg
			domain === "peertube.librelabucm.org" ||
			// https://video.writeas.org/static/thumbnails/2b436442-4b18-49dd-831a-90ceb75d4e11.jpg
			domain === "video.writeas.org" ||
			// https://conf.tube/static/thumbnails/3137ea36-264b-43c8-929c-145fc48159e5.jpg
			domain_nowww === "conf.tube" ||
			// https://peertube.anarchmusicall.net/static/thumbnails/06131ffa-17ab-45dd-a1bf-265009b6a683.jpg
			domain === "peertube.anarchmusicall.net" ||
			// https://lostpod.space/static/thumbnails/9c9de5e8-0a1e-484a-b099-e80766180a6d.jpg
			domain_nowww === "lostpod.space" ||
			// https://peertube.alter-nativ-voll.de/static/thumbnails/06131ffa-17ab-45dd-a1bf-265009b6a683.jpg
			domain === "peertube.alter-nativ-voll.de" ||
			// https://videos.ac-nancy-metz.fr/static/thumbnails/14e9320f-2502-45c8-a4fa-c32e9b7ba76f.jpg
			domain === "videos.ac-nancy-metz.fr" ||
			// https://tube.fabrigli.fr/static/thumbnails/1c17f3e8-1013-43a0-acf3-3b69035345f9.jpg
			domain === "tube.fabrigli.fr" ||
			// https://videos.domainepublic.net/static/thumbnails/217eefeb-883d-45be-b7fc-a788ad8507d3.jpg
			domain === "videos.domainepublic.net" ||
			// https://videos.pueseso.club/static/thumbnails/2d2b48cb-6ac8-4476-8ae9-9b3f86a292b4.jpg
			domain === "videos.pueseso.club" ||
			// https://tube.azbyka.ru/static/thumbnails/febed00c-4591-4e70-9d58-50b83d1b3ce7.jpg
			domain === "tube.azbyka.ru" ||
			// https://videos.pair2jeux.tube/static/thumbnails/76011c74-2a6c-4da0-b277-3568c4d0f2ad.jpg
			domain === "videos.pair2jeux.tube" ||
			// https://www.yiny.org/static/thumbnails/b3e3de5f-7498-47fe-945f-d84a7f293c93.jpg
			domain_nowww === "yiny.org" ||
			// https://pony.tube/static/thumbnails/9f699b7c-8b8d-45f6-aa2c-37d9816b56e1.jpg
			domain_nowww === "pony.tube" ||
			// https://peertube.dsmouse.net/static/thumbnails/bc181d28-3284-4882-b7a3-314e27d0bdb2.jpg
			domain === "peertube.dsmouse.net" ||
			// https://tube-versailles.beta.education.fr/static/thumbnails/0ae974c5-ff91-4ea0-8612-f8088bde7843.jpg
			domain === "tube-versailles.beta.education.fr" ||
			// https://video.tedomum.net/static/thumbnails/6baca855-8799-4add-8158-663386f7ee4a.jpg
			domain === "video.tedomum.net" ||
			// https://peertube.lyceeconnecte.fr/static/thumbnails/8a121d63-49c7-49d9-aab0-5d823b44b11d.jpg
			domain === "peertube.lyceeconnecte.fr" ||
			domain_nowww === "xxxporn.co.uk" ||
			domain === "peertube.ricostrongxxx.com" ||
			// https://videos.upr.fr/static/thumbnails/f15b951a-1dbe-485d-beda-8dd2e5436d9f.jpg
			domain === "videos.upr.fr" ||
			// https://peertube.uno/static/thumbnails/a5bcc9ab-221c-4e25-afdb-88d837741b61.jpg
			domain_nowww === "peertube.uno" ||
			// https://alttube.fr/static/thumbnails/1cc6b4cd-ac16-4300-8adc-d9df3fb4f0af.jpg
			domain_nowww === "alttube.fr" ||
			// https://video.maga.host/static/thumbnails/c31362ba-39a9-48b4-8d39-f7b48b5e69c3.jpg
			domain === "video.maga.host" ||
			// https://video.hardlimit.com/w/uZGK12oU5FeSsy8CDLP4hD
			domain === "video.hardlimit.com" ||
			// https://peertube.cpy.re/static/thumbnails/da2b08d4-a242-4170-b32a-4ec8cbdca701.jpg
			//   https://peertube.cpy.re/static/webseed/da2b08d4-a242-4170-b32a-4ec8cbdca701-1044.mp4
			domain === "peertube.cpy.re") {
			// find instances here: https://instances.joinpeertube.org/instances

			// https://peertube.linuxrocks.online/static/previews/caeb68e7-120c-4db5-a44e-5945e09ceb92.jpg
			//   https://peertube.linuxrocks.online/static/webseed/caeb68e7-120c-4db5-a44e-5945e09ceb92-1080.mp4
			var query_peertube_api = function(api_url, referer_url, vidid, cb) {
				// FIXME: are video ids the same between peertube sites?
				var cache_key = "peertube:" + vidid;

				api_query(cache_key, {
					url: urljoin(api_url, "/videos/" + vidid, false),
					headers: {
						Accept: "application/json, text/plain, */*",
						Referer: referer_url
					},
					json: true
				}, cb, function(done, json, cache_key) {
					var obj:BigImageInfoSObject = {};

					obj.extra = {
						page: urljoin(api_url, json.embedPath,true),
						caption: json.name,
						created_date: new Date(json.createdAt).getTime(),
						updated_date: new Date(json.updatedAt).getTime()
					};

					var files = json.files;

					let urls = [];
					if (files.length === 0) {
						if ("streamingPlaylists" in json && json.streamingPlaylists.length > 0 && json.streamingPlaylists[0].files.length > 0) {
							files = json.streamingPlaylists[0].files;

							if (json.streamingPlaylists[0].playlistUrl) {
								urls.push({
									url: json.streamingPlaylists[0].playlistUrl,
									video: "hls"
								});
							}
						}
					}

					files.sort(function(a, b) {
						return b.size - a.size
					});

					for (let file of files) {
						urls.push({
							url: file.fileUrl, // or fileDownloadUrl?
							video: true
						});
					}

					if (json.thumbnailPath)
						urls.push(urljoin(api_url.replace(/\/api\/+v1\//, "/"), json.thumbnailPath));

					console_log(urls);

					if (urls.length) {
						// doesn't seem to have an expiry date
						return done(fillobj_urls(urls, obj), 6*60*60);
					} else {
						console_warn(cache_key, "Unable to find files from", json);
					}

					return done(null, false);
				});
			};

			var get_peertube_urlinfo = function(url) {
				var pagelink = false;
				var match = url.match(/(.*)\/static\/+(?:previews|thumbnails|webseed)\/+([0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12})(?:-[0-9]+)?\.[^/.]+(?:[?#].*)?$/);
				if (!match) {
					match = url.match(/(.*)\/videos\/+watch\/+([0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12})(?:[?#].*)?$/);
					pagelink = true;
				}
				if (!match) {
					match = url.match(/(.*)\/w\/+([0-9a-zA-Z]{22})(?:[?#].*)?$/);
					pagelink = true;
				}
				if (!match)
					return null;

				return {
					id: match[2],
					referer: match[1],
					api: match[1] + "/api/v1/",
					pagelink: pagelink
				};
			};

			var info = get_peertube_urlinfo(src);
			if (info) {
				var cb = function(data) {
					if (!data)
						return options.cb(data);

					if (info.pagelink) {
						data.push({url: src, is_pagelink: true});
					}

					return options.cb(data);
				};

				if (options.do_request && options.cb) {
					query_peertube_api(info.api, info.referer, info.id, cb);
					return {
						waiting: true
					};
				} else if (info.pagelink) {
					return {
						url: src,
						is_pagelink: true
					};
				}
			}
		}

		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
			// 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 = /(:\/\/[^/]+\/+(?:v2\/+)?[^/]+\/+(?:[0-9]{2}\/+){4})[0-9]+(_F_[0-9]+_[^/_.]+\.[^/.]+)(?:[?#].*)?$/;

				newsrc = src;

				// 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");
				}

				return {
					url: newsrc,
					extra: {
						page: "https://stock.adobe.com/" + id
					}
				};
			}
		}

		if (domain_nowww === "popoholic.com") {
			// http://popoholic.com/images6/katy-perry-rainbow-march-02.jpg
			//   http://popoholic.com/bigimages6/katy-perry-rainbow-march-02.jpg
			return src.replace(/(:\/\/[^/]+\/+)(images[0-9]+\/+)/, "$1big$2");
		}

		if (domain === "pictures.abebooks.com") {
			// https://pictures.abebooks.com/DESIGN/md/md22378955735.jpg
			//   https://pictures.abebooks.com/DESIGN/22378955735.jpg
			// thanks to anonymous for reporting:
			// https://pictures.abebooks.com/inventory/md/md31499144753.jpg
			//   https://pictures.abebooks.com/inventory/31499144753.jpg
			return src.replace(/(\/[^/]+\/+)md\/+md([0-9]+(?:_[0-9]+)?\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "content.ngv.vic.gov.au") {
			// 1920 scales to 1920 on the largest side (i.e. no side can be larger than 1920)
			// xxxl = 976 on the width
			// 1920, 1280, xxxl, xxl, xl, large, medium, small
			// numbers can't be applied to plain folders, which is why they have to be converted to api instead
			// https://content.ngv.vic.gov.au/col-images/xxxl/EXHI017454.jpg
			//   https://content.ngv.vic.gov.au/col-images/api-talks/EXHI017454/xxxl
			newsrc = src.replace(/\/col-images\/+([a-z]+)\/+([^/.]+)\.[^/.]+(?:[?#].*)?$/, "/col-images/api-talks/$2/$1");
			if (newsrc !== src)
				return newsrc;

			// https://content.ngv.vic.gov.au/col-images/api-talks/EXHI017454/small
			//   https://content.ngv.vic.gov.au/col-images/api-talks/EXHI017454/1920
			// https://content.ngv.vic.gov.au/col-images/api/EXHI020246/small
			//   https://content.ngv.vic.gov.au/col-images/api/EXHI020246/1920
			// https://content.ngv.vic.gov.au/col-images/api/PUPR015933/1920 -- 1280x853 (doesn't upscale)
			newsrc = src.replace(/(\/col-images\/+api(?:-talks)?\/+[^/]+)(?:\/+(?:1280|x{1,3}l|large|medium|small))?(?:[?#].*)?$/, "$1/1920");
			if (newsrc !== src)
				return newsrc;

			// https://content.ngv.vic.gov.au/retrieve.php?type=image&vernonID=2920
			//   https://content.ngv.vic.gov.au/retrieve.php?size=1280&type=image&vernonID=2920
			//   https://content.ngv.vic.gov.au/retrieve.php?size=1920&type=image&vernonID=2920
			// https://content.ngv.vic.gov.au/retrieve.php?type=promotional&imageID=EXHI051562&release=polly-borland-polyverse-2 -- requires authentication
			//   https://content.ngv.vic.gov.au/retrieve.php?type=image&imageID=EXHI051562&release=polly-borland-polyverse-2&size=1920 -- works
			// https://content.ngv.vic.gov.au/retrieve.php?type=image&imageID=EXHI017454&size=1920 -- works
			if (/^[a-z]+:\/\/[^/]+\/+retrieve.php\?/.test(src)) {
				var queries = get_queries(src);
				if (!queries.size || array_indexof(["1280", "xxxl", "xxl", "xl", "large", "medium", "small"], queries.size) >= 0)
					return add_queries(src, {"size": "1920"});
			}

			// image sources:
			// https://www.ngv.vic.gov.au/about/media/images-video/
			// https://www.ngv.vic.gov.au/media_release/polly-borland-polyverse-2/
		}

		if (domain_nowww === "ilmessaggero.it") {
			// https://www.ilmessaggero.it/photogallery_img/MED/13/54/101354_20150410_95078_w_baker_k_minogue.jpg
			//   https://www.ilmessaggero.it/photogallery_img/HIGH/13/54/101354_20150410_95078_w_baker_k_minogue.jpg
			// https://www.ilmessaggero.it/photos/MED/22/99/32299_LGG_20100115_8241_ba1.jpg
			//   https://www.ilmessaggero.it/photos/HIGH/22/99/32299_LGG_20100115_8241_ba1.jpg
			return src.replace(/(\/(?:photogallery_img|photos)\/+)MED\/+/, "$1HIGH/");
		}

		if (false && host_domain_nowww === "mercifans.com" && options.element && options.do_request && options.cb) {
			// disabled because mercifans.com has migrated to swame.com, website seems to be slightly different
			if (options.element.hasAttribute("data-open-medias-gallery")) {
				var query_mercifans = function(url, cb) {
					api_query("mercifans:" + url, {
						url: urljoin(options.host_url, url, true),
						imu_mode: "xhr",
						headers: {
							Referer: options.host_url,
							"x-requested-with": "XMLHttpRequest"
						},
						json: true
					}, cb, function(done, resp, cache_key) {
						return done(resp, 60*60);
					});
				};

				query_mercifans(options.element.getAttribute("data-open-medias-gallery"), function(data) {
					if (!data) {
						return options.cb(null);
					}

					var index = options.element.getAttribute("data-gallery-index");
					if (index) {
						index = parseInt(index) - 1;
					} else {
						index = 0;
					}

					// TODO: support gallery
					if (index >= data.size || index < 0) {
						console_error("Invalid index", index);
						return options.cb(null);
					}

					return options.cb(data[index].src);
				});

				return {
					waiting: true
				};
			}
		}

		if (false && domain_nowww === "mercinudes.com") {
			// snapchat-like site, basically:
			// POST https://mercinudes.com/api_front/ephemes/view
			// {id: "mediaid"} (/ephemes/..., /media/...)
			// but you can only do so once. to bypass this, we can remove the cookie, but then it overwrites the cookie
		}

		if (domain === "cdn.spinrilla.com") {
			// https://cdn.spinrilla.com/albums/217990/large/b11917568079a31c4697.JPEG?1589066250
			//   https://cdn.spinrilla.com/albums/217990/original/b11917568079a31c4697.JPEG?1589066250
			return src.replace(/(\/albums\/+[0-9]+\/+)[a-z]+\/+/, "$1original/");
		}

		if (domain === "community.amd.com") {
			// https://community.amd.com/servlet/JiveServlet/downloadImage/38-2363-167675/800-393/AMD+_GPUOpen_new_homepage_screensshot.jpg
			//   https://community.amd.com/servlet/JiveServlet/downloadImage/38-2363-167675/AMD+_GPUOpen_new_homepage_screensshot.jpg
			return src.replace(/(\/servlet\/+JiveServlet\/+downloadImage\/+[-0-9]+\/+)[0-9]+-[0-9]+\/+/, "$1");
		}

		if (domain === "logincdn.msauth.net") {
			// https://logincdn.msauth.net/16.000.28595.00/content/images/backgrounds/2_bc3d32a696895f78c19df6c717586a5d.svg
			if (/\/content\/+images\/+backgrounds\//.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}
		}

		if (domain_nowww === "dreamstime.com") {
			// https://www.dreamstime.com/stock-images-new-york-september-model-alessandra-ambrosio-poses-backstage-cipriani-restaurant-rock-republic-spring-summer-image30755744
			// https://www.dreamstime.com/30755744
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+[-a-z]*([0-9]+)(?:[?#].*)?$/,
				query_for_id: "https://www.dreamstime.com/${id}",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/<script type="application\/ld\+json">({.*?})<\/script>/);
					if (!match) {
						console_error(cache_key, "Unable to find match in", resp);
						return done(null, false);
					}

					var json = JSON_parse(match[1]);

					var obj = {
						extra: {
							page: resp.finalUrl,
							caption: json.description || json.name
						}
					};

					var urls = [];

					if (json.contentUrl || json.url) {
						urls.push({
							url: json.contentUrl || json.url,
							problems: {watermark: true}
						});
					}

					if (json.thumbnail) {
						urls.push({
							url: json.thumbnail,
							problems: {smaller: true}
						});
					}

					done(fillobj_urls(urls, obj), 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "thumbs.dreamstime.com") {
			// https://thumbs.dreamstime.com/z/%D0%BD%D1%8C%D1%8E-%D0%B9%D0%BE%D1%80%D0%BA-%D0%BE%D0%B5-%D1%81%D0%B5%D0%BD%D1%82%D1%8F%D0%B1%D1%80%D1%8F-%D0%BC%D0%BE-%D0%B5-%D1%8C%D0%BD%D1%8B%D0%B9-alessandra-ambrosio-%D0%BF%D1%80%D0%B5-%D1%81%D1%82%D0%B0%D0%B2-%D1%8F%D0%B5%D1%82-%D0%BA%D1%83-%D1%83%D0%B0%D1%80%D0%BD%D0%BE%D0%B5-30755744.jpg
			//   https://www.dreamstime.com/stock-images-new-york-september-model-alessandra-ambrosio-poses-backstage-cipriani-restaurant-rock-republic-spring-summer-image30755744
			match = src.match(/^[a-z]+:\/\/[^/]+\/+[a-z]\/+[^/]+-([0-9]+)\.[^/.]+(?:[?#].*)?$/);
			if (match) {
				return {
					url: "https://www.dreamstime.com/" + match[1],
					is_pagelink: true
				};
			}
		}

		if (domain_nosub === "vgm.io" && /^(?:thumb|medium)-media\./.test(domain)) {
			// https://thumb-media.vgm.io/albums/21/98912/98912-1589538670.png -- 100x100
			//   https://media.vgm.io/albums/21/98912/98912-1589538670.png -- 571x572
			// thanks to DesertStars on github: https://github.com/qsniyg/maxurl/issues/371
			// https://medium-media.vgm.io/albums/32/36823/36823-1357394776.jpg
			//   https://media.vgm.io/albums/32/36823/36823-1357394776.jpg
			return src.replace(/:\/\/[a-z]+-(media\.[^/]+\/+)/, "://$1");
		}

		if (domain_nowww === "vgmdb.net") {
			// https://vgmdb.net/db/img/vgmdbnav.png?0909
			if (/\/db\/+img\/+vgmdbnav\./.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}
		}

		if (domain_nowww === "old-games.ru") {
			// https://www.old-games.ru/games/pc/magic_carpet/thumbs/thumb_magiccarpet_03.gif
			//   https://www.old-games.ru/games/pc/magic_carpet/screenshots/magiccarpet_03.gif
			return src.replace(/\/thumbs\/+thumb_/, "/screenshots/");
		}

		if (domain === "cdn-prod.scalefast.com") {
			// https://cdn-prod.scalefast.com/resize/222x-/public/assets/user/123622/image/f9783754f715c56ef40cd6aeb12c0d1f.jpg
			//   https://cdn-prod.scalefast.com/public/assets/user/123622/image/f9783754f715c56ef40cd6aeb12c0d1f.jpg
			return src.replace(/(:\/\/[^/]+\/+)resize\/+[-0-9]+x[-0-9]+\/+(public\/+)/, "$1$2");
		}

		if (domain === "cdn.mp3-lemon.ru" ||
			// https://mp3cleo.ru/image/Z25wLmJiMDAxeDAwMS9ncGoucmV2b2MvZDViODM3OGNlMTAyLTQyMWUtOTRhOC1kOTE3LWVmZWVjOTVjL2VlL2M5LzVjLzR2LzMxMWNpc3VNL2JtdWh0L2VnYW1pL21vYy5jaXRhdHN6bS5sc3MtMnNpLy86c3B0dGg100x100bb.png
			//   https://is2-ssl.mzstatic.com/image/thumb/Music113/v4/c5/9c/ee/c59ceefe-719d-8a49-e124-201ec8738b5d/cover.jpg/999999999x0w-999.png
			domain_nowww === "mp3cleo.ru") {
			// https://cdn.mp3-lemon.ru/220/Z3BqLnRsdWFmZWRxbS9veC1iN2JnR1pLcS9pdi9tb2MuZ21pdHkuaS8vOnNwdHRo.jpg
			//   https://i.ytimg.com/vi/qKZGgb7b-xo/maxresdefault.jpg
			match = src.match(/^[a-z]+:\/\/[^/]+\/+(?:image|[0-9]+)\/+([^-_/.]{30,}?)\.[^/.]+(?:[?#].*)?$/);
			if (match) {
				try {
					newsrc = base64_decode(match[1]);
					newsrc = newsrc.replace(/(\/\/:s?ptth)[^/]{0,10}$/, "$1");
					return reverse_str(newsrc);
				} catch (e) {
					console_error(e);
				}
			}
		}

		if (domain_nowww === "banzaj.pl") {
			// http://www.banzaj.pl/pictures/celebrity/gwiazdy_zagraniczne/candice_swanepoel/candice_swanepoel_seksowna_sesja_w_bikini_sauvage/THUMBS/THUMB_candice_swanepoel_seksowna_sesja_w_bikini_sauvage_12.jpg
			//   http://www.banzaj.pl/pictures/celebrity/gwiazdy_zagraniczne/candice_swanepoel/candice_swanepoel_seksowna_sesja_w_bikini_sauvage/candice_swanepoel_seksowna_sesja_w_bikini_sauvage_12.jpg
			return src.replace(/(\/pictures\/.*\/)THUMBS\/+THUMB_/, "$1");
		}

		if (domain === "dyw7ncnq1en5l.cloudfront.net" ||
			// https://img2.lesnumeriques.com/optim/article/2225/beyond-two-souls__w800.jpg
			//   https://img2.lesnumeriques.com/article/2225/beyond-two-souls.jpg
			(domain_nosub === "lesnumeriques.com" && /^img[0-9]*\./.test(domain))) {
			// https://dyw7ncnq1en5l.cloudfront.net/optim/article/2225/beyond-two-souls__w800.webp
			//   https://dyw7ncnq1en5l.cloudfront.net/article/2225/beyond-two-souls.jpg
			// https://dyw7ncnq1en5l.cloudfront.net/optim/article/14/146359/6da6fbee-dr-kawashima-switch-life-is-strange-2-shovel-knight-king-of-cards-boneworks-les-meilleurs-jeux-du-mois_png__312_176__overflow.webp
			//   https://dyw7ncnq1en5l.cloudfront.net/article/14/146359/6da6fbee-dr-kawashima-switch-life-is-strange-2-shovel-knight-king-of-cards-boneworks-les-meilleurs-jeux-du-mois.png
			newsrc = src.replace(/\/optim\/+(article\/+[0-9/]+\/+[^/]+?)(?:_png)?__(?:w[0-9]+|[0-9]+_[0-9]+)(?:__overflow)?(\.[^/.]+)(?:[?#].*)?$/, "/$1$2");
			if (newsrc !== src)
				return add_full_extensions(newsrc);
		}

		if (domain === "dcg0nv7t7dovn.cloudfront.net" ||
			domain === "d6ijsqg8e9unz.cloudfront.net") {
			var parse_buybox_url = function(url) {
				// first folder is user id
				// second is buybox id
				var match = url.match(/\/userUploads\/+[^/]+\/+([^/]+)\/+(?:(?:[a-zA-Z]+Images|thumbnails)\/+)?(?:[a-z]_)?([0-9]{5,})-[^/.]+\.[^/.]+(?:[?#].*)?$/);
				if (match) {
					return {
						boxid: match[1],
						imgid: match[2] // incorrect
					};
				}

				return null;
			};

			var get_buybox_url_from_id = function(boxid) {
				return "https://bentbox.co/buybox_paysafe?" + boxid;
			};

			// https://dcg0nv7t7dovn.cloudfront.net/userUploads/2mkEn9AD/93VhcUj1/1590309218-M6t6Sgsq.jpg
			//   https://d6ijsqg8e9unz.cloudfront.net/userUploads/2mkEn9AD/93VhcUj1/mediumImages/1590309209-scdnmarklc000000.jpg
			// thumbnails that are also part of a buybox are also an issue, it's difficult to know if the image of the thumbnail or not
			// i.e. this isn't reliable
			var query_bentbox_buybox = function(boxid, imgid, cb) {
				// https://bentbox.co/buybox_paysafe?OO0AzGcy
				api_query("bentbox_buybox:" + boxid + ":" + imgid, {
					url: get_buybox_url_from_id(boxid)
				}, cb, function(done, resp, cache_key) {
					var match = resp.responseText.match(/<link rel="image_src" href="([^"]+)"/);
					if (match) {
						var newurl = match[1];
						var parsed = parse_buybox_url(newurl);
						if (parsed && parsed.boxid === boxid && parsed.imgid === imgid) {
							return done({
								url: newurl,
								extra: {
									page: resp.finalUrl
								}
							}, 60*60);
						} else {
							console_warn("Wrong image:", newurl);
						}
					} else {
						console_warn("Unable to find match for", resp);
					}

					return done(null, false);
				});
			};

			var parsed_url = parse_buybox_url(src);
			if (parsed_url) {
				if (false) {
					query_bentbox_buybox(parsed_url.boxid, parsed_url.imgid, options.cb);
					return {
						waiting: true
					};
				}

				return {
					url: src,
					extra: {
						page: get_buybox_url_from_id(parsed_url.boxid)
					}
				};
			}
		}

		if (host_domain_nowww === "nintendo.com" && options.element) {
			if (options.element.tagName.toLowerCase() === "svg" && options.element.classList.toString().match(/^icon-/)) {
				return {
					url: origsrc,
					bad: "mask"
				};
			}
		}

		if (domain_nosub === "vndb.org" && /^s[0-9]*\./.test(domain)) {
			// https://s2.vndb.org/st/65/81065.jpg
			//   https://s2.vndb.org/sf/65/81065.jpg
			return src.replace(/(:\/\/[^/]+\/+)st\/+/, "$1sf/");
		}

		if (domain_nowww === "gamefabrique.com") {
			// https://gamefabrique.com/images/video/the-last-of-us.mp4
			//   https://gamefabrique.com/images/video/original/the-last-of-us.mp4
			// https://gamefabrique.com/screenshots/ps3/the-last-of-us-02.jpg
			//   https://gamefabrique.com/storage/screenshots/ps3/the-last-of-us-02.png
			return src
				.replace(/(\/images\/+video\/+)([^/]+)(?:[?#].*)?$/, "$1original/$2")
				.replace(/(:\/\/[^/]+\/+)(screenshots\/.*)\.jpg(?:[?#].*)?$/, "$1storage/$2.png");
		}

		if (domain_nowww === "rorax.com") {
			// http://www.rorax.com/img/57/small/35173_selena_gomez08170803_122_158lo.jpg
			//   http://www.rorax.com/img/57/large/35173_selena_gomez08170803_122_158lo.jpg -- 541x748
			// http://www.rorax.com/img/57/large/35150_selena_gomez03011004_122_467lo.jpg -- 553x749, upscaled?
			// https://www.rorax.com/img/57/small/110470074_sg.jpg
			newsrc = src.replace(/(\/img\/+[0-9]+\/+)(?:small|medium)\/+/, "$1large/");
			if (newsrc !== src)
				return {
					url: newsrc,
					problems: {
						possibly_upscaled: true
					}
				};
		}

		if (domain === "img.5nd.com") {
			// http://img.5nd.com/150/Photo/singer/1/22146.jpg
			//   http://img.5nd.com/Photo/singer/1/22146.jpg
			return src.replace(/(:\/\/[^/]+\/+)[0-9]+\/+photo\/+/i, "$1Photo/");
		}

		if (domain === "d1bm3dmew779uf.cloudfront.net") {
			// https://d1bm3dmew779uf.cloudfront.net/small/c12fd48bef8c888cb855ccaab2234676.jpg
			//   https://d1bm3dmew779uf.cloudfront.net/original/c12fd48bef8c888cb855ccaab2234676.jpg
			return src.replace(/(:\/\/[^/]+\/+)(?:small|medium|large)\/+/, "$1original/");
		}

		if (domain === "cache.hkgolden.media") {
			// https://cache.hkgolden.media/compress/https://www.mypornhere.com/contents/videos_screenshots/74000/74255/preview.jpg
			//   https://www.mypornhere.com/contents/videos_screenshots/74000/74255/preview.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+compress\/+(https?:\/\/)/, "$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nowww === "hosted.mplstudios.com") {
			// http://www.hosted.mplstudios.com/galleries/15/kiki_come_enjoy/150/001.jpg
			//   http://hosted.mplstudios.com/galleries/15/kiki_come_enjoy/1200/001.jpg
			// http://www.hosted.mplstudios.com/galleries/09/anya_shoot_day_behind_the_scenes/150/001.jpg
			//   http://www.hosted.mplstudios.com/galleries/09/anya_shoot_day_behind_the_scenes/1024/001.jpg
			return [
				src.replace(/(\/galleries\/+[0-9]+\/+[^/]+\/+)(?:150|1024)\/+/, "$11200/"),
				src.replace(/(\/galleries\/+[0-9]+\/+[^/]+\/+)(?:150)\/+/, "$11024/")
			];
		}

		if (domain_nowww === "mplstudios.com") {
			// https://www.mplstudios.com/directory/models/425/samples/5296/sample/5296v1_200.jpg
			//   https://www.mplstudios.com/directory/models/425/samples/5296/sample/5296v1_1200.jpg
			//   https://www.mplstudios.com/directory/models/425/samples/5296/sample/5296v1_2000.jpg
			//   https://www.mplstudios.com/directory/models/425/samples/5296/sample/5296v1_3000.jpg
			return src.replace(/(\/models\/+[0-9]+\/+samples\/+[0-9]+\/+sample\/+[0-9]+(?:v[0-9]+)?)_[1-2]?[0-9]{3}\./, "$1_3000.");
		}

		if (domain_nowww === "alscash.com") {
			// http://www.alscash.com/FHGA/jamaicarema08/alstgpsample09s.jpg
			//   http://www.alscash.com/FHGA/jamaicarema08/alstgpsample09.jpg
			return src.replace(/(\/FHGA\/+[^/]+\/+[^/]+[0-9]+)s(\.[^?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "x18.xxx") {
			// https://www.x18.xxx/media/photos/tmb/5763.jpg
			//   https://www.x18.xxx/media/photos/5763.jpg
			return src.replace(/\/media\/+photos\/+tmb(?:_new)?\/+/, "/media/photos/");
		}

		if ((domain_nosub === "iceppsn.com" ||
			domain_nosub === "iceporn.com" ||

			domain_nosub === "nvdst.com" ||
			domain_nosub === "nuvid.com" ||

			domain_nosub === "tbnpsn.com" ||
			domain_nosub === "tubeon.com" ||

			// https://p2.drtst.com/media/photos/tmb_new/2764183.jpg
			//   https://p2.drtst.com/media/photos/2764183.jpg
			domain_nosub === "drtst.com" ||
			domain_nowww === "drtuber.com" ||

			domain_nosub === "hdpsn21.com" ||
			domain_nowww === "hd21.com" ||

			domain_nosub === "wnppsn.com" ||
			domain_nowww === "winporn.com" ||

			domain_nosub === "pornlib.com" ||
			domain_nosub === "plibcdn.com" ||

			// https://p3.vptpsn.com/media/videos/tmb/4117567/240_180/10.jpg
			domain_nosub === "vptpsn.com" ||
			domain_nosub === "viptube.com") && options.do_request && options.cb) {
			// https://p9.iceppsn.com/media/videos/tmb/3605717/220_135/11.jpg
			newsrc = src.replace(/\/media\/+photos\/+tmb(?:_new)?\/+/, "/media/photos/");
			if (newsrc !== src)
				return newsrc;

			var query_iceporn_vid = function(domain, aid, id, cb) {
				api_query(domain + ":" + id, {
					url: "https://www." + domain + "/player_config_json/?vid=" + id + "&aid=" + aid + "&domain_id=0&embed=0&ref=null&check_speed=0",
					headers: {
						Referer: "https://www." + domain + "/"
					}
				}, cb, function(done, resp, cache_key) {
					try {
						var json = JSON_parse(resp.responseText);
						done(json, 60*60);
					} catch (e) {
						console_error(cache_key, e);
						done(null, false);
					}
				});
			};

			var get_obj_from_iceporn_vid = function(vidobj) {
				var baseobj = {
					headers: {
						Referer: vidobj.url || "https://www.iceporn.com/"
					},
					extra: {}
				};
				var urls = [];

				if (vidobj.title) {
					baseobj.extra.caption = vidobj.title;
				}

				if (vidobj.url) {
					baseobj.extra.page  = vidobj.url;
				}

				if (vidobj.files) {
					if (vidobj.files.hq) {
						urls.push({
							url: vidobj.files.hq,
							video: true
						});
					} else if (vidobj.files.lq) {
						urls.push({
							url: vidobj.files.lq,
							video: true
						});
					}
				}

				if (vidobj.poster) {
					urls.push(vidobj.poster);
				}

				return fillobj_urls(urls, baseobj);
			};

			page_nullobj = null;
			var get_iceporn_id_from_url = function(url) {
				var match = url.match(/\/media\/+videos\/+tmb\/+([0-9]+)\/+/);
				if (match) {
					return match[1];
				}

				match = url.match(/^[a-z]+:\/\/[^/]+\/+(?:embed|video)\/+(?:[-a-z0-9]+-)?([0-9]+)(?:\/+[^/]*)?(?:[?#].*)?$/);
				if (match) {
					page_nullobj = {
						url: src,
						is_pagelink: true
					};

					return match[1];
				}

				return null;
			};

			var iceporn_domain, iceporn_aid;
			if (domain_nosub === "iceppsn.com" || domain_nosub === "iceporn.com") {
				iceporn_domain = "iceporn.com";
				iceporn_aid = 6;
			} else if (domain_nosub === "vptpsn.com" || domain_nosub === "viptube.com") {
				iceporn_domain = "viptube.com";
				iceporn_aid = 2;
			} else if (domain_nosub === "nvdst.com" || domain_nosub === "nuvid.com") {
				iceporn_domain = "nuvid.com";
				iceporn_aid = 2;
			} else if (domain_nosub === "tbnpsn.com" || domain_nosub === "tubeon.com") {
				iceporn_domain = "tubeon.com";
				iceporn_aid = 591;
			} else if (domain_nosub === "drtst.com" || domain_nosub === "drtuber.com") {
				iceporn_domain = "drtuber.com";
				iceporn_aid = 3029;
			} else if (domain_nosub === "hdpsn21.com" || domain_nosub === "hd21.com") {
				iceporn_domain = "hd21.com";
				iceporn_aid = 591;
			} else if (domain_nosub === "wnppsn.com" || domain_nosub === "winporn.com") {
				iceporn_domain = "winporn.com";
				iceporn_aid = 591;
			} else if (domain_nosub === "pornlib.com" || domain_nosub === "plibcdn.com") {
				iceporn_domain = "pornlib.com";
				iceporn_aid = 0;
			}

			id = get_iceporn_id_from_url(src);
			if (id) {
				query_iceporn_vid(iceporn_domain, iceporn_aid, id, function(data) {
					if (!data)
						return options.cb(page_nullobj);

					var obj = get_obj_from_iceporn_vid(data);
					if (!is_array(obj))
						obj = [obj];

					if (page_nullobj)
						obj.push(page_nullobj);

					return options.cb(obj);
				});

				return {
					waiting: true
				};
			}
		}

		if (false && domain_nowww === "fembed.com") {
			match = src.match(/^[a-z]+:\/\/[^/]+\/+v\/+([a-z0-9]{5,})(?:[?#].*)?$/);
			if (match) {
				id = match[1];

				var query_fembed_video = function(id, cb) {
					api_query("fembed:" + id, {
						method: "POST",
						url: "https://feurl.com/api/source/" + id,
						data: "r=https%3A%2F%2Fwww.fembed.com%2F&d=feurl.com",
						headers: {
							Accept: "*/*",
							Origin: "https://feurl.com",
							Referer: "https://feurl.com/v/" + id,
							"x-requested-with": "XMLHttpRequest"
						},
						json: true
					}, cb, function(done, json, cache_key) {
						var maxobj = null;
						var max = 0;

						for (var i = 0; i < json.data.length; i++) {
							var our_obj = json.data[i];
							var our_size = parseInt(our_obj.label);

							if (our_size > max) {
								max = our_size;
								maxobj = our_obj;
							}
						}

						if (maxobj) {
							done({
								url: maxobj.file,
								video: true,
								is_private: true
							}, 60*60);
						} else {
							done(null, false);
						}
					});
				};

				page_nullobj = {
					url: src,
					is_pagelink: true
				};

				if (options.do_request && options.cb) {
					query_fembed_video(id, function(obj) {
						if (!obj)
							return options.cb(page_nullobj);

						return options.cb([obj, page_nullobj]);
					});

					return {
						waiting: true
					};
				} else {
					return page_nullobj;
				}
			}
		}

		if (domain_nowww === "anime789.com" ||
			domain_nowww === "javto.stream" ||
			domain_nowww === "javcl.me" ||
			domain_nowww === "cdn-myhdjav.info" ||
			domain_nowww === "ffem.club" ||
			domain_nowww === "javhub.pro" ||
			domain_nowww === "javlove.club" ||
			domain_nowww === "mm9841.com" ||
			domain_nowww === "iframejav.com" ||
			domain_nowww === "xvideosrss.com"||
			domain_nowww === "fembed.com" ||
			domain_nowww === "femax20.com" ||
			domain === "thumb.fvs.io" ||
			domain_nowww === "feurl.com" ||
			domain_nowww === "luxubu.review" ||
			domain_nowww === "javlove.club" ||
			domain_nowww === "pelispng.online" ||
			domain_nowww === "sexhd.co" ||
			domain_nowww === "playvideo.best") {
			var base_domain = domain_nosub;
			if (domain_nowww === "fembed.com" ||
				domain === "thumb.fvs.io") {
				base_domain = "feurl.com";
			}

			var query_fvs_vid = function(id, cb) {
				api_query("fvs:" + id, {
					url: "https://" + base_domain + "/api/source/" + id,
					method: "POST",
					data: "r=&d=" + base_domain,
					headers: {
						Origin: "https://" + base_domain,
						Referer: "https://" + base_domain + "/"
					}
				}, cb, function(done, resp, cache_key) {
					try {
						var json = JSON_parse(resp.responseText);
						done(json, 60*60);
					} catch (e) {
						console_error(cache_key, e);
						done(null, false);
					}
				});
			};

			var get_obj_from_fvs = function(json) {
				if (!json || !json.data)
					return null;

				var max = 0;
				var maxobj = null;
				for (var i = 0; i < json.data.length; i++) {
					var ourdata = json.data[i];
					if (!ourdata.label || !ourdata.file)
						continue;

					var oursize = parseInt(ourdata.label);
					if (oursize > max) {
						max = oursize;
						maxobj = ourdata;
					}
				}

				if (maxobj) {
					return {
						url: maxobj.file,
						video: true,
						is_private: true // linked to ip range
					};
				} else {
					return null;
				}
			};

			newsrc = website_query({
				// is -_ necessary?
				website_regex: /^[a-z]+:\/\/[^/]+\/+v\/+([-_a-z0-9]{5,})(?:\.[^/.]+)?(?:[?#].*)?$/,
				run: function(cb, match) {
					var id = match[1];

					query_fvs_vid(id, function(data) {
						cb(get_obj_from_fvs(data));
					});
				}
			});
			if (newsrc) return newsrc;

			// . and .. are the first 2 chars of the id
			match = src.match(/^[a-z]+:\/\/[^/]+\/+asset\/+userdata\/+[0-9]+\/+poster\/+[^/]\/+[^/]{2}\/+([-_a-z0-9]{5,})(?:\.[^/.]+)?(?:[?#].*)?$/);
			if (match) {
				return {
					url: "https://" + base_domain + "/v/" + match[1],
					is_pagelink: true
				};
			}
		}

		if (domain_nowww === "dailymotion.com") {
			var query_dm_playermetadata = function(id, cb) {
				api_query("dailymotion:" + id, {
					url: "https://www.dailymotion.com/player/metadata/video/" + id,
					headers: {
						Referer: "https://www.dailymotion.com/video/" + id,
						Accept: "application/json, text/plain, */*"
					},
					json: true
				}, cb, function(done, resp) {
					return done(resp, 60*60);
				});
			};

			var get_obj_from_dm_playermeta = function(data) {
				if (!data)
					return page_nullobj;

				var obj = {extra: {}};
				var urls = [];

				if (data.title)
					obj.extra.caption = data.title;

				if (data.url)
					obj.extra.page = data.url;

				// FIXME?
				if (data.qualities && data.qualities.auto && data.qualities.auto[0] && data.qualities.auto[0].type === "application/x-mpegURL") {
					urls.push({
						url: data.qualities.auto[0].url,
						video: "hls",
						headers: {
							Referer: obj.extra.page
						}
					});
				}

				if (data.posters) {
					var max = 0;
					for (var size in data.posters) {
						if (size > max) {
							max = size;
						}
					}

					if (max in data.posters) {
						urls.push(data.posters[max]);
					}
				}

				return fillobj_urls(urls, obj);
			};

			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+video\/+([a-z0-9]+)(?:[?#].*)?$/,
				run: function(cb, match) {
					id = match[1];

					query_dm_playermetadata(id, function(data) {
						cb(get_obj_from_dm_playermeta(data));
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nosub === "dmcdn.net" && options.element) {
			newsrc = common_functions["get_pagelink_el_matching"](options.element, /^https?:\/\/(?:www\.)?dailymotion\.com\/+video\/+([a-z0-9]+)(?:[?#].*)?$/);
			if (newsrc) return newsrc;
		}

		if (host_domain_nowww === "dailymotion.com") {
			newsrc = common_functions["get_pagelink_host_el_matching"](options, {
				url_match: /^https?:\/\/(?:www\.)?dailymotion\.com\/+video\/+([a-z0-9]+)(?:[?#].*)?$/,
				el_match: function(x) {
					return x.id === "player-body"
				}
			});
			if (newsrc) return newsrc;
		}

		if (false && domain_nosub === "alternativeto.net" && /^d[0-9]*\./.test(domain)) {
			// this rule makes the images 16x16
			// https://d2.alternativeto.net/dist/s/gimp_469899_full.png?format=jpg&width=94&height=94&mode=crop
			//   https://d2.alternativeto.net/dist/s/gimp_469899_full.png?format=png
			// https://d2.alternativeto.net/dist/s/pconplanner_342379_full.jpg?format=jpg&width=94&height=94&mode=crop
			//   https://d2.alternativeto.net/dist/s/pconplanner_342379_full.jpg?format=jpg
			// https://d2.alternativeto.net/dist/icons/gimp_154706.png?width=64&height=64&mode=crop&upscale=false
			//   https://d2.alternativeto.net/dist/icons/gimp_154706.png?format=png
			// https://d2.alternativeto.net/dist/listheaders/list-21083-1605422357-cover.png?format=jpg&width=1200&height=630&mode=crop
			return src.replace(/(\/dist\/+[^/]+\/+[^/?#]+\.)([^/.#?]+)\?.*$/, "$1$2?format=$2&width=1999&mode=min");
			// other:
			// https://d4.alternativeto.net/SLWmzrwBcZWVgL4HwRt4HF47RWz5YRrhU1NJQTt9qjg/rs:fit:1200:1200:0/g:ce:0:0/YWJzOi8vZGlzdC9zL2JiOTQwM2RhLWQ2YWYtZTMxMS04YzU3LTAwMjU5MGEwNWY1Zl8yX2Z1bGwuanBn.jpg
			//   atob = abs://dist/s/bb9403da-d6af-e311-8c57-002590a05f5f_2_full.jpg
		}

		if (domain === "img.vxdn.net") {
			// https://img.vxdn.net/p-max/200/rise-of-the-black-bat-17275.jpg
			//   https://img.vxdn.net/p-max/0/rise-of-the-black-bat-17275.jpg
			// https://img.vxdn.net/c-max/100/rise-of-the-black-bat-17275.jpg
			//   https://img.vxdn.net/c-max/0/rise-of-the-black-bat-17275.jpg
			return src.replace(/(:\/\/[^/]+\/+[a-z]-max\/+)[0-9]+\/+/, "$10/");
		}

		if (domain === "content.adultwork.com") {
			// https://content.adultwork.com/ci/t/3341223_2.jpg
			//   https://content.adultwork.com/ci/i/3341223_2.jpg
			//   https://content.adultwork.com/ci/f/3341223_2.jpg
			return src.replace(/(:\/\/[^/]+\/+ci\/+)[ti]\/+/, "$1f/");
		}

		if (domain_nowww === "tunestream.net") {
			// 523
			match = src.match(/^[a-z]+:\/\/[^/]+\/+embed-([a-z0-9]{5,})\.html(?:[?#].*)?$/);
			if (match) {
				id = match[1];

				var query_jwplayer = function(url, cb) {
					api_query("jwplayer:" + url, {
						url: url
					}, cb, function(done, resp, cache_key) {
						var match = resp.responseText.match(/jwplayer\(.*?\)\.setup\({[\s\S]*?sources:\s*(\[.*?\]),/);
						if (!match) {
							console_error(cache_key, "Unable to find match for", resp);
							return done(null, false);
						}

						var json_text = match[1];
						json_text = json_text.replace(/([[{,])([a-z]+):/g, "$1\"$2\":");
						console_log(json_text);

						var json = JSON_parse(json_text);

						var urls = [];
						for (var i = 0; i < json.length; i++) {
							if (!json[i].file) {
								console_warn("Unable to process", json[i]);
								continue;
							}

							var our_obj = {
								url: json[i].file,
								headers: {
									Origin: "https://" + domain_nosub,
									Referer: url,
									"Sec-Fetch-Dest": "empty",
									"Sec-Fetch-Site": "same-site",
									"Sec-Fetch-Mode": "cors",
									"Accept": "*/*"
								}
							};

							if (json[i].label) {
								our_obj.size = parseInt(json[i].label) || 0;
							}

							if (/\.m3u8(?:[?#].*)?$/.test(json[i].file)) {
								our_obj.video = "hls";
							}

							urls.push(our_obj);
						}

						urls.sort(function(a, b) {
							if (a.size && b.size)
								return a.size - b.size;

							if (a.video === b.video)
								return 0;

							if (a.video === "hls")
								return 1;
							else if (b.video === "hls")
								return -1;

							return 0;
						});

						for (var i = 0; i < urls.length; i++) {
							delete urls[i].size;
						}

						urls.push({
							url: url,
							is_pagelink: true
						});

						done(urls, 60*60);
					});
				};

				page_nullobj = {
					url: src,
					is_pagelink: true
				};

				if (options.do_request && options.cb) {
					query_jwplayer(src, options.cb);
					return {
						waiting: true
					};
				} else {
					return page_nullobj;
				}
			}
		}

		// xfilesharing
		if (domain_nowww === "mightyupload.com" ||
			domain_nowww === "upstream.to" ||
			domain_nowww === "clicknplay.to" ||
			// has some custom encryption: https://github.com/vb6rocod/utils/blob/master/servere/tear_js.html (possibly a modification of TEA)
			//domain_nowww === "playtube.ws" ||
			domain_nowww === "streamsb.net") {
			// https://upstream.to/assets/images/bg-5.svg
			if (/\/assets\/+images\/+bg-[0-9]+\.svg(?:[?#].*)?$/.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}

			newsrc = website_query({
				website_regex: [
					/^[a-z]+:\/\/[^/]+\/+embed-([a-z0-9]{12})(?:-[0-9]+x[0-9]+)?\.html(?:[?#].*)?$/,
					/^[a-z]+:\/\/[^/]+\/+([a-z0-9]{12})(?:[?#].*)?$/,
				],
				query_for_id: "https://" + domain + "/embed-${id}.html",
				process: function(done, resp, cache_key) {
					var unpacked = common_functions["unpack_packer"](resp.responseText);
					if (!unpacked) {
						console_error(cache_key, "Unable to find packed data for", resp);
						return done(null, false);
					}

					var match = unpacked.match(/jwplayer\(.*?\)\.setup\({[\s\S]*?file:\s*"([^"]+)"[,}]/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp, unpacked);
						return done(null, false);
					}

					var videotype:VideoProp = true;
					var videourl = match[1];
					if (/\.m3u8/.test(videourl))
						videotype = "hls";

					return done({
						url: videourl,
						headers: {
							Origin: "https://" + domain,
							Referer: "https://" + domain + "/"
						},
						video: videotype
					}, 60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nosub === "upstreamcdn.co" && /^s[0-9]*\./.test(domain)) {
			match = src.match(/^[a-z]+:\/\/[^/]+\/+i\/+[0-9]{2}\/+[0-9]+\/+([0-9a-z]{12})\./);
			if (match)
				return {
					url: "https://upstream.to/embed-" + match[1] + ".html",
					is_pagelink: true
				};
		}

		if (domain_nowww === "youdbox.net") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+embed-([0-9a-z]{12})(?:-[0-9]+x[0-9]+)?\.html(?:[?#].*)?$/,
				query_for_id: "https://youdbox.net/embed-${id}.html",
				process: function(done, resp, cache_key) {
					match = resp.responseText.match(/var [0-9a-zA-Z]+ *= *\[("\\x3b"(?:,"\\x[0-9a-f]{2}")+)\]/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					var hex = match[1].replace(/[^0-9a-f]/g, "");
					var code = reverse_str(hex_to_ascii(hex));

					match = code.match(/<source src="([^"]+)"/);
					if (!match) {
						console_error(cache_key, "Unable to find source match for", {resp: resp, code: code});
						return done(null, false);
					}

					return done({
						url: match[1],
						video: true
					}, 60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nosub === "youdbox.net" && /^bin[0-9]*\./.test(domain)) {
			match = src.match(/^[a-z]+:\/\/[^/]+\/+i\/+[0-9]+\/+([0-9a-z]{12})\./);
			if (match)
				return {
					url: "https://youdbox.net/embed-" + match[1] + ".html",
					is_pagelink: true
				};
		}

		if (domain_nowww === "videyo.net") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+embed-([0-9a-z]{12})\.html(?:[?#].*)?$/,
				query_for_id: "https://videyo.net/embed-${id}.html",
				process: function(done, resp, cache_key) {
					var unpacked = common_functions["unpack_packer"](resp.responseText);
					if (!unpacked) {
						console_error(cache_key, "Unable to find packed data for", resp);
						return done(null, false);
					}

					var hola_sources = common_functions["get_holaplayer_sources"](unpacked);
					if (!hola_sources) {
						console_error(cache_key, "Unable to find sources for", resp, unpacked);
						return done(null, false);
					}

					var obj = common_functions["get_obj_from_videosources"](resp.finalUrl, hola_sources);
					return done(obj, 60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "i.videyo.net") {
			match = src.match(/^[a-z]+:\/\/[^/]+\/+([a-z0-9]{12})[0-9]{4}\.[^/.]+(?:[?#].*)?$/);
			if (match) {
				return {
					url: "https://videyo.net/embed-" + match[1] + ".html",
					is_pagelink: true
				};
			}
		}

		if (domain_nowww === "gounlimited.to") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+(?:embed-)?([0-9a-z]{5,})\.html(?:[?#].*)?$/,
				query_for_id: "https://gounlimited.to/embed-${id}.html",
				process: function(done, resp, cache_key) {
					var unpacked = common_functions["unpack_packer"](resp.responseText);
					if (!unpacked) {
						console_error(cache_key, "Unable to find packed data for", resp);
						return done(null, false);
					}

					var match = unpacked.match(/{player\.src\((\[{.*?}\])\)}/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp, unpacked);
						return done(null, false);
					}

					var json = JSON_parse(fixup_js_obj(match[1]));
					sort_by_key(json, "res");

					var baseobj = {
						headers: {
							Referer: resp.finalUrl
						}
					};

					var urls = [];
					for (var i = 0; i < json.length; i++) {
						urls.push({
							url: json[i].src,
							video: true
						});
					}

					return done(fillobj_urls(urls, baseobj), 60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "vidello.net") {
			// thanks to anonymous for reporting:
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+(?:embed-)?([0-9a-z]{5,})\.html(?:[?#].*)?$/,
				query_for_id: {
					url: "https://" + domain + "/embed-${id}.html",
					headers: {
						"Referer": "https://dirtyships.net/",
						"Sec-Fetch-Dest": "iframe",
						"Sec-Fetch-Mode": "navigate",
						"Sec-Fetch-Site": "cross-site"
					},
					imu_mode: "document"
				},
				process: function(done, resp, cache_key) {
					var unpacked = common_functions["unpack_packer"](resp.responseText);
					if (!unpacked) {
						console_error(cache_key, "Unable to find packed data for", resp);
						return done(null, false);
					}

					var match = unpacked.match(/sources:\[{src:("[^"]+")/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp, unpacked);
						return done(null, false);
					}

					var videourl = JSON_parse(match[1]);

					return done({
						url: videourl,
						video: "hls"
					}, 50*60); // expiry time is 3600
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "static.kritikustomeg.org") {
			// https://static.kritikustomeg.org/pix/tn200x1000/5c4/pa_138649_exbcngzm.jpg
			//   https://static.kritikustomeg.org/pix/orig/5c4/pa_138649_exbcngzm.jpg
			return src.replace(/\/pix\/+tn[0-9]+x[0-9]+\/+/, "/pix/orig/");
		}

		if (amazon_container === "kinorium-images") {
			// https://s3-eu-west-1.amazonaws.com/kinorium-images/web/blank.png
			if (/\/web\/+blank\./.test(src))
				return {
					url: src,
					bad: "mask"
				};
		}

		if (host_domain_nowww === "jizzbunker.com" && options.element) {
			if (protocol === "data" && options.element.tagName === "A") {
				return {
					url: origsrc,
					bad: "mask"
				};
			}
		}

		if (domain_nowww === "xxxdan.com" ||
			domain_nowww === "jizzbunker.com") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+([A-Za-z0-9]+)\/+[^/]+\.html(?:[?#].*)?$/,
				query_for_id: "https://www." + domain_nowww + "/${id}/a.html",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/sources\.push\({(?:.*,)?\s*src:\s*["']([^'"]+)["']/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					var url = match[1];

					var obj = {
						url: url,
						headers: {
							Referer: resp.finalUrl
						}
					};

					var our_regex = new RegExp("<a href=\"(https://[^/]+/+" + id + "/+[^/]+\\.html)\".*?title=\"([^\"]+)\"");
					var match1 = resp.responseText.match(our_regex);

					if (match1) {
						obj.extra = {
							page: match1[1],
							caption: match1[2]
						};
					}

					done(obj, 60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nosub === "cdn3x.com" && /^[tv][0-9]*\./.test(domain)) {
			// https://t0.cdn3x.com/xd/320x180/7PZGW/000.jpg
			// https://v0.cdn3x.com/xd/7PZGW/p_0003267577_240_25_10_1.mp4
			// https://v0.cdn3x.com/t/0003171037/p_0003171037_240_25_10_1.mp4
			match = src.match(/^[a-z]+:\/\/[^/]+\/+(xd|t)\/+(?:[0-9]+(?:x[0-9]+)?\/+)?([A-Za-z0-9]+)\/+[^/]+(?:[?#].*)?$/);
			if (match) {
				var site = match[1];
				id = match[2];

				var sites = {
					xd: "https://www.xxxdan.com/",
					t: "https://www.jizzbunker.com/"
				};

				return {
					url: sites[site] + id + "/a.html",
					is_pagelink: true
				};
			}
		}

		if (domain_nowww === "spankwire.com") {
			var query_spankwire = function(vid, cb) {
				api_query("spankwire:" + vid, {
					url: "https://www.spankwire.com/api/video/" + vid + ".json",
					headers: {
						"Accept": "application/json, text/plain, */*, image/webp",
						"Referer": "https://www.spankwire.com/EmbedPlayer.aspx/?ArticleId=" + vid + "&autostart=true"
					},
					json: true
				}, cb, function(done, resp, cache_key) {
					if (resp.HLS && resp.title && resp.videos)
						return done(resp, 60*60);

					console_log(cache_key, "Invalid json", resp);
					return done(null, false);
				});
			};

			var spankwire_to_obj = function(data) {
				if (!data) {
					return null;
				}

				var baseobj = {
					headers: {
						"Referer": "https://www.spankwire.com/"
					},
					extra: {}
				};

				if (data.url) {
					baseobj.extra.page = urljoin("https://www.spankwire.com/", data.url, true);
				}

				if (data.title) {
					baseobj.extra.caption = data.title;
				}

				var urls = [];
				if (data.HLS) {
					urls.push({
						url: data.HLS,
						video: "hls"
					});
				}

				if (data.videos) {
					var max = 0;
					var maxobj = null;

					for (var key in data.videos) {
						var key_match = key.match(/^quality_([0-9]+)p$/);
						if (!key_match)
							continue;

						var quality = parseInt(key_match[1]);
						if (quality > max) {
							max = quality;
							maxobj = data.videos[key];
						}
					}

					if (maxobj) {
						urls.push({
							url: maxobj,
							video: true
						});
					}
				}

				return fillobj_urls(urls, baseobj);
			};

			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+[^/]+\/+video([0-9]+)(?:\/.*)?(?:[?#].*)?$/,
				run: function(cb, match) {
					var id = match[1];

					query_spankwire(id, function(data) {
						cb(spankwire_to_obj(data));
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "keezmovies.com") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+video\/+(?:[^/?#.]+-)?([0-9]+)(?:[?#].*)?$/,
				query_for_id: "https://www.keezmovies.com/video/${id}",
				process: function(done, resp, cache_key) {
					var flashvars = resp.responseText.match(/window\.flashvars\s*=\s*({.*?});/);
					if (!flashvars) {
						console_error(cache_key, "Unable to find match", resp);
						return done(null, false);
					}

					var data = JSON_parse(flashvars[1]);

					var baseobj = {
						extra: {},
						headers: {
							"Referer": "https://www.keezmovies.com/"
						}
					};

					if (data.link_url) {
						baseobj.extra.page = data.link_url;
					}

					if (data.video_title) {
						baseobj.extra.caption = data.video_title;
					}

					var max = 0;
					var maxobj = null;
					for (var key in data) {
						var key_match = key.match(/^quality_([0-9]+)p$/);
						if (!key_match)
							continue;

						var quality = parseInt(key_match[1]);
						if (quality > max) {
							max = quality;
							maxobj = data[key];
						}
					}

					var urls = [];
					if (maxobj) {
						urls.push({
							url: maxobj,
							video: true
						});
					}

					if (data.image_url) {
						urls.push(data.image_url);
					}

					done(fillobj_urls(urls, baseobj), 60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nosub === "spankcdn.net") {
			// https://cdn4-image-spankwire.spankcdn.net/m=eaCaaBFnGw/201804/18/18534522/originals/2.jpg
			// https://cdn3-image-keezmovies.spankcdn.net/m=eaAaaEFnqv//201307/01/1243784/originals/1.jpg
			match = src.match(/\/[0-9]{6}\/+[0-9]{1,2}\/+([0-9]+)\/+originals\/+/);
			if (!match) {
				match = src.match(/:\/\/[^/]+\/+[0-9]{6}\/+[0-9]{2}\/+([0-9]+)\/+preview_[0-9]+\./);
			}

			if (match) {
				id = match[1];

				newsrc = null;
				if (/keezmovies\./.test(domain)) {
					newsrc = "https://www.keezmovies.com/video/" + id;
				} else if (/spankwire\./.test(domain)) {
					newsrc = "https://www.spankwire.com/a/video" + id + "/";
				}

				if (newsrc) {
					return {
						url: newsrc,
						is_pagelink: true
					};
				}
			}
		}

		if (domain_nowww === "fapxl.com") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+(?:view\/+movie\/+)?(?:embed|video)\/+([0-9]+)(?:\/+[^/]*)?(?:[?#].*)?$/,
				run: function(cb, match) {
					var vid = match[1];

					api_query("fapxl:" + vid, {
						url: "https://fapxl.com/view/movie/embedconfig/" + vid + "?ModPagespeed=off",
						headers: {
							Referer: "https://fapxl.com/"
						}
					}, cb, function(done, resp, cache_key) {
						var match = resp.responseText.match(/clip:\s*{\s*title:\s*("[^"]+"),\s*sources:\s*(\[[\s\S]+?\])\s*},/);
						if (!match) {
							console_error(cache_key, "Unable to find match for", resp);
							return done(null, false);
						}

						var title = JSON_parse(match[1]);
						var sources = match[2].replace(/\s([a-z]+)(:\s*")/g, " \"$1\"$2");

						var sources_json = JSON_parse(sources);

						done({
							url: sources_json[0].src,
							video: true,
							extra: {
								caption: title
							},
							headers: {
								Referer: "https://fapxl.com/"
							}
						}, 60*60);
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nosub === "fapxl.com" && /^thumbs[0-9]*\./.test(domain)) {
			// https://thumbs9.fapxl.com/media/3/8/7/6/4/3876421/thumb_medium_1.jpg
			match = src.match(/\/media\/+(?:[0-9]\/+){1,5}([0-9]+)\/+/);
			if (match) {
				return {
					url: "https://fapxl.com/video/" + match[1],
					is_pagelink: true
				};
			}
		}

		if (false && domain_nosub === "porntube.com" && /^cdn[0-9]*-thumbnails\./.test(domain)) {
			var query_porntube_video = function(id, cb) {
				var cache_key = "porntube:" + id;

				api_cache.fetch(cache_key, cb, function(done) {
					options.do_request({
						url: "https://token.porntube.com/" + id + "/desktop/2160+1080+720+480+360+240",
						method: "POST",
						headers: {
							Origin: "https://www.porntube.com",
							Referer: "https://www.porntube.com/",
							Accept: "application/json, text/plain, */*"
						},
						onload: function(resp) {
							if (resp.status !== 200) {
								console_error(cache_key, resp);
								return done(null, false);
							}

							try {
								var json = JSON_parse(resp.responseText);

								var max = 0;
								var maxobj = null;

								for (var key in json) {
									var num = parseInt(key);
									if (!num || isNaN(num) || json[key].status !== "success" || !json[key].token)
										continue;

									if (num > max) {
										max = num;
										maxobj = json[key];
									}
								}

								return done(maxobj.token, 60*60);
							} catch (e) {
								console_error(cache_key, e);
							}

							return done(null, false);
						}
					});
				});
			};

			var get_porntube_id = function(url) {
				match = src.match(/^[a-z]+:\/\/[^/]+\/+((?:[0-9]\/+){1,})(?:[0-9]+x[0-9]+|preview)\/+[0-9]+\./);
				if (match) {
					return match[1].replace(/\/+/g, "");
				}

				return null;
			};

			id = get_porntube_id(src);
			if (id && options.do_request && options.cb) {
				query_porntube_video(id, function(url) {
					if (!url) {
						return options.cb(null);
					}

					return options.cb({
						url: url,
						video: true
					});
				});

				return {
					waiting: true
				};
			}
		}

		if (domain_nosub === "pornerbros.com" ||
			domain_nosub === "porntube.com" ||
			domain_nosub === "fux.com" ||
			domain_nosub === "4tube.com") {
			id = null;
			page_nullobj = null;
			var is_embed = false;
			match = src.match(/^[a-z]+:\/\/cdn[^/]+\/+((?:[0-9]\/+){2,})(?:[0-9]+x[0-9]+|preview)\/+/);
			if (match) {
				id = match[1].replace(/\/+/g, "");
			} else {
				match = src.match(/^[a-z]+:\/\/[^/]+\/+embed\/+([0-9]+)(?:[?#].*)?$/);
				if (match) {
					id = match[1];
					page_nullobj = {
						url: src,
						is_pagelink: true
					};
					is_embed = true;
				}
			}

			if (id) {
				var cache_prefix = domain_nosub + ":";
				var token_domain = "token." + domain_nosub;

				var query_pornerbros_embed = function(vid, cb) {
					api_query(cache_prefix + id + "_embed", {
						url: "https://www." + domain_nosub + "/embed/" + vid
					}, cb, function(done, resp, cache_key) {
						var match = resp.responseText.match(/window\.INITIALSTATE = '(.*?)';/);
						if (!match) {
							console_error(cache_key, "Unable to find initialstate match for", resp);
							return done(null, false);
						}

						var b64_decoded = base64_decode(match[1]);
						var decoded = decodeURIComponent(b64_decoded);
						var json_decoded = JSON_parse(decoded);

						return done(json_decoded, 60*60);
					});
				};

				var query_pornerbros_url = function(vid, cb) {
					api_query(cache_prefix + id, {
						url: "https://" + token_domain + "/" + vid + "/embeds/240+360+480+720+1080+1440+2160",
						method: "POST",
						headers: {
							"Accept": "application/json, text/plain, */*",
							"origin": "https://www." + domain_nosub,
							"referer": "https://www." + domain_nosub + "/",
							"Content-Length": "0",
							"Sec-Fetch-Site": "same-site"
						},
						json: true
					}, cb, function(done, resp, cache_key) {
						var urls = [];

						for (var key in resp) {
							var our_obj = resp[key];
							if (our_obj.status !== "success" || !our_obj.token)
								continue;

							var size = parseInt(key);
							if (!isNaN(size) && size > 0) {
								urls.push({
									url: our_obj.token,
									size: size
								});
							}
						}

						// sometimes the largest size (1080p) doesn't work, but smaller (720p) does
						urls.sort(function(a, b) {
							return b.size - a.size;
						});

						for (var i = 0; i < urls.length; i++) {
							delete urls[i].size;
						}

						var baseobj = {
							headers: {
								Accept: "*/*",
								"Accept-Encoding": "identity;q=1, *;q=0",
								Referer: "https://www." + domain_nosub + "/",
								"Sec-Fetch-Dest": "video",
								"Sec-Fetch-Mode": "no-cors",
								"Sec-Fetch-Site": "same-site"
							},
							can_head: false
						};

						var newurls = fillobj_urls(urls, baseobj);
						if (page_nullobj)
							newurls.push(page_nullobj);

						return done(newurls, 60*60);
					});
				};

				if (options.do_request && options.cb) {
					// some embeds (porntube) have different video ids
					if (is_embed) {
						query_pornerbros_embed(id, function(data) {
							if (data && data.video && data.video.mediaId) {
								id = data.video.mediaId;
							}

							query_pornerbros_url(id, options.cb);
						});
					} else {
						query_pornerbros_url(id, options.cb);
					}

					return {
						waiting: true
					};
				} else if (page_nullobj) {
					return page_nullobj;
				}
			}
		}

		if (domain_nosub === "eporner.com" && domain.match(/static-(?:[a-z]+-)?cdn\.eporner\.com/)) {
			// https://static-us-cdn.eporner.com/photos/537995_296x1000.jpg
			// https://static-eu-cdn.eporner.com/photos/537995/test-296x1000.jpg
			//   https://static-eu-cdn.eporner.com/photos/537995/test.jpg
			// https://static-eu-cdn.eporner.com/gallery/FC/jz/NwLweyKjzFC/1212768-amateur-pics-3669-img-1_296x1000.jpg
			//   https://static-eu-cdn.eporner.com/gallery/FC/jz/NwLweyKjzFC/1212768-amateur-pics-3669-img-1.jpg
			newsrc = src
				.replace(/\/photos\/+([0-9]+)_[0-9]+x[0-9]+\./, "/photos/$1.")
				.replace(/\/photos\/+([0-9]+\/+[^/]+)-[0-9]+x[0-9]+\./, "/photos/$1.")
				.replace(/(\/gallery\/+(?:[^/]{2}\/+){2}[^/]+\/+[^/]+)_[0-9]+x[0-9]+\./, "$1.");
			if (newsrc !== src) return newsrc;
		}

		if (domain_nowww === "eporner.com") {
			match = src.match(/^[a-z]+:\/\/[^/]+\/+(?:(?:hd-porn|embed)\/+|video-)?([0-9a-zA-Z]+)(?:\/+.*)?(?:[?#].*)?$/);
			if (match) {
				id = match[1];

				var eporner_hash_mod = function(hash) {
					var output = "";

					for (var i = 0; i < 4; i++) {
						var section = hash.substring(i * 8, (i + 1) * 8);
						output += parseInt(section, 16).toString(36);
					}

					return output;
				};

				var query_eporner_api = function(data, cb) {
					if (!data) {
						return cb(page_nullobj);
					}

					api_query("eporner_api:" + data.vid, {
						url: "https://www.eporner.com/xhr/video/" + data.vid + "?hash=" + eporner_hash_mod(data.hash) + "&domain=www.eporner.com&fallback=false&embed=false&supportedFormats=dash,mp4",
						headers: {
							Referer: "https://www.eporner.com/",
							Accept: "*/*"
						},
						json: true
					}, cb, function(done, resp, cache_key) {
						if (resp.code !== 0 || resp.message) {
							console_error(cache_key, "Failed to load from eporner api", resp);
							return done(page_nullobj, false);
						}

						var baseobj = {
							headers: {
								Referer: "https://www.eporner.com/"
							}
						};

						urls = [];

						if (resp.sources.mp4) {
							var sources = resp.sources.mp4;
							var sources_urls = [];
							for (var key in sources) {
								if (!sources[key].src)
									continue;

								sources_urls.push({
									url: sources[key].src,
									quality: parseInt(key)
								});
							}

							sources_urls.sort(function(a, b) {
								return b.quality - a.quality;
							});

							for (var i = 0; i < sources_urls.length; i++) {
								delete sources_urls[i].quality;
								urls.push(sources_urls[i]);
							}
						}

						urls.push(page_nullobj);

						return done(fillobj_urls(urls, baseobj), 60*60);
					});
				};

				var query_eporner_site = function(vid, cb) {
					api_query("eporner_site:" + vid, {
						url: "https://www.eporner.com/hd-porn/" + vid + "/"
					}, cb, function(done, resp, cache_key) {
						//var match = resp.responseText.match(/hash: '([0-9a-f]{10,})',/);
						var match = resp.responseText.match(/EP\.video\.player\.hash = '([0-9a-f]{10,})';/);
						if (!match) {
							console_error(cache_key, "Unable to find hash for", resp);
							return done(null, false);
						}

						var hash = match[1];

						return done({
							hash: hash,
							vid: vid
						}, 10*60);
					});
				};

				page_nullobj = {
					url: src,
					is_pagelink: true
				};

				if (options.do_request && options.cb) {
					query_eporner_site(id, function(data) {
						query_eporner_api(data, options.cb);
					});

					return {
						waiting: true
					};
				} else {
					return page_nullobj;
				}
			}
		}

		if (host_domain_nowww === "eporner.com" && options.element) {
			newsrc = common_functions["get_pagelink_host_el_matching"](options, {
				url_match: /^[a-z]+:\/\/[^/]+\/+(?:hd-porn|embed)\/+([0-9a-zA-Z]+)(?:\/+.*)?(?:[?#].*)?$/,
				el_match: function (x) {
					return x.tagName === "DIV" && x.id === "EPvideo";
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "samplerinfos.de") {
			// thanks to nimuxoha on github: https://github.com/qsniyg/maxurl/issues/361
			// https://samplerinfos.de/covers/4050/th_40500010f.jpg?1487092251
			//   https://samplerinfos.de/covers/4050/40500010f.jpg?1487092251
			// https://samplerinfos.de/covers/4050/40502270b.jpg?1577984564
			//   https://samplerinfos.de/covers/4050/big_40502270b.jpg?1577984564
			// https://samplerinfos.de/online_images/artwork/artwork1590742468_small.jpg
			//   https://samplerinfos.de/online_images/artwork/artwork1590742468.jpg
			// https://samplerinfos.de/grafiken/spezial/fussballkult/th_az3-b.jpg
			//   https://samplerinfos.de/grafiken/spezial/fussballkult/az3-b.jpg
			// https://samplerinfos.de/grafiken/loveparade/th_2003s.jpg
			//   https://samplerinfos.de/grafiken/loveparade/2003s.jpg
			newsrc = src
				.replace(/(\/covers\/+[0-9]+\/+|grafiken\/+(?:spezial\/+)?[^/]+\/+)([^/_.]+\.[^/.]+(?:[?#].*)?)$/, "$1big_$2")
				.replace(/(\/covers\/+[0-9]+\/+|grafiken\/+(?:spezial\/+)?[^/]+\/+)th_([^/_.]+\.[^/.]+(?:[?#].*)?)$/, "$1$2")
				.replace(/(\/online_images\/+artwork\/+artwork[0-9]+)_small(\.[^/.]+(?:[?#].*)?)$/, "$1$2");

			return {
				url: newsrc,
				can_head: false // 403
			};
		}

		if (domain_nosub === "litres.ru") {
			// https://cv6.litres.ru/pub/c/elektronnaya-kniga/cover_200/18488161-anzhela-marsons-nemoy-krik-18488161.jpg
			//   https://cv6.litres.ru/pub/c/elektronnaya-kniga/cover_h190/18488161-anzhela-marsons-nemoy-krik-18488161.jpg
			//   https://cv6.litres.ru/pub/c/elektronnaya-kniga/cover/18488161-anzhela-marsons-nemoy-krik-18488161.jpg
			return src.replace(/\/cover_[wh]?[0-9]+\/+/, "/cover/");
		}

		if (domain === "d3el26csp1xekx.cloudfront.net" ||
			// https://starboard-media.s3.amazonaws.com/v/no-wm-thumb-XHRVi-XHP-00001.jpg
			//   https://starboard-media.s3.amazonaws.com/v/wm-XHRVi-XHP.mp4 -- watermarked
			//   https://starboard-media.s3.amazonaws.com/v/no-wm-XHRVi-XHP.mp4
			// https://starboard-media.s3.amazonaws.com/v/no-wm-thumb-lDOcM9sdH-00001.jpg
			//   https://starboard-media.s3.amazonaws.com/v/no-wm-lDOcM9sdH.mp4
			// https://starboard-media.s3.amazonaws.com/v/no-wm-thumb-iP0TmPq_Q-00001.jpg
			//   https://starboard-media.s3.amazonaws.com/v/no-wm-iP0TmPq_Q.mp4
			// https://starboard-media.s3.amazonaws.com/thumbnails/video-60514afcb48c54001d2510da-eDfj5suSW-0Jpblw0pj-no-wm-thumbnail.0000000.jpg
			//   https://starboard-media.s3.amazonaws.com/video/video-60514afcb48c54001d2510da-eDfj5suSW-0Jpblw0pj-no-wm.mp4
			// https://starboard-media.s3.amazonaws.com/video/video-60514afcb48c54001d2510da-eDfj5suSW-0Jpblw0pj-wm.mp4
			//   https://starboard-media.s3.amazonaws.com/video/video-60514afcb48c54001d2510da-eDfj5suSW-0Jpblw0pj-no-wm.mp4
			amazon_container === "starboard-media") {
			// thanks to remlap on discord (cameo.com)
			// https://d3el26csp1xekx.cloudfront.net/v/wm-o5WwywATT.mp4
			//   https://d3el26csp1xekx.cloudfront.net/v/no-wm-o5WwywATT.mp4
			// https://www.cameo.com/v/5d53255a3f9c0e0124646192
			// https://d3el26csp1xekx.cloudfront.net/v/no-wm-thumb-obyCY9NVZ-00001.jpg
			//   https://d3el26csp1xekx.cloudfront.net/v/no-wm-obyCY9NVZ.mp4
			return src
				.replace(/(\/v\/+)(wm-[-_a-zA-Z0-9]+\.mp4)/, "$1no-$2")
				.replace(/(\/v\/+)(?:no-)?wm-thumb-([-_a-zA-Z0-9]+)-[0-9]+\.jpg(?:[?#].*)?$/, "$1no-wm-$2.mp4")
				.replace(/\/+thumbnails\/+(video-[^/]+-(?:no-)?wm)-thumbnail\.[0-9]+\.jpg(?:[?#].*)?$/, "/video/$1.mp4")
				.replace(/(\/video\/+video-[0-9a-f]{10,}-[0-9a-zA-Z]+-[0-9a-zA-Z]+)-wm(\.[^/.]+)(?:[?#].*)?$/, "$1-no-wm$2");
			//return src.replace(/(\/v\/+)(wm-)/, "$1no-$2");
		}

		if (domain_nowww === "vidcloud9.com" ||
			domain_nowww === "vidnode.net") {
			match = src.match(/^[a-z]+:\/\/[^/]+\/+(?:streaming|load)\.php\?(?:.*&)?id=([^&]+).*?$/);
			if (match) {
				id = match[1];

				var query_vidcloud9 = function(vid, cb) {
					api_query("vidcloud9:" + vid, {
						url: "https://vidcloud9.com/ajax.php?id=" + vid,
						headers: {
							Referer: "https://vidcloud9.com/",
							"X-Requested-With": "XMLHttpRequest"
						},
						json: true
					}, cb, function(done, resp, cache_key) {
						var urls = [];

						var baseobj = {
							headers: {
								Referer: "https://vidcloud9.com/"
							}
						};

						// there's also source_bk (backup?), seems to be the same urls though
						for (var i = 0; i < resp.source.length; i++) {
							if (resp.source[i].type !== "hls")
								continue;

							urls.push({
								url: resp.source[i].file,
								video: "hls"
							});
						}

						return done(fillobj_urls(urls, baseobj), 60*60);
					});
				};

				page_nullobj = {
					url: src,
					is_pagelink: true
				};

				if (options.cb && options.do_request) {
					query_vidcloud9(id, function(urls) {
						if (!urls) {
							return options.cb(page_nullobj);
						} else {
							urls.push(page_nullobj);
							return options.cb(urls);
						}
					});

					return {
						waiting: true
					};
				} else {
					return page_nullobj;
				}
			}
		}

		if (domain_nowww === "gcloud.live") {
			match = src.match(/^[a-z]+:\/\/[^/]+\/+v\/+([-a-z0-9]+)(?:[?#].*)?$/);
			if (match) {
				id = match[1];

				var query_gcloud_live = function(vid, cb) {
					api_query("gcloud_live:" + vid, {
						url: "https://gcloud.live/api/source/" + vid,
						method: "POST",
						data: "r=https%3A%2F%2Fgcloud.live%2F&d=gcloud.live",
						headers: {
							Origin: "https://gcloud.live",
							"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
							"Referer": "https://gcloud.live/v/" + vid,
							"x-requested-with": "XMLHttpRequest",
							"Accept": "*/*"
						},
						json: true
					}, cb, function(done, resp, cache_key) {
						var urls = [];

						var baseobj = {
							headers: {
								Referer: "https://gcloud.live.com/"
							}
						};

						for (var i = 0; i < resp.data.length; i++) {
							if (!resp.data[i].file || resp.data[i].type !== "mp4")
								continue;

							urls.push({url: resp.data[i].file, quality: parseInt(resp.data[i].label)});
						}

						urls.sort(function(a, b) {
							return b.quality - a.quality;
						});

						for (var i = 0; i < urls.length; i++) {
							delete urls[i].quality;
						}

						return done(fillobj_urls(urls, baseobj), 60*60);
					});
				};

				page_nullobj = {
					url: src,
					is_pagelink: true
				};

				if (options.cb && options.do_request) {
					query_gcloud_live(id, function(urls) {
						if (!urls) {
							return options.cb(page_nullobj);
						} else {
							urls.push(page_nullobj);
							return options.cb(urls);
						}
					});

					return {
						waiting: true
					};
				} else {
					return page_nullobj;
				}
			}
		}

		if (domain_nowww === "streamvid.co") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+player\/+([A-Za-z0-9]+)\/*(?:[?#].*)?$/,
				query_for_id: "https://streamvid.co/player/${id}/",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/<div id="video_player">.*<script[^>]*>JuicyCodes\.Run\((\".*?\")\);<\/script>/);
					if (!match) {
						console_error(cache_key, "Unable to find JuicyCodes match for", resp);
						return done(null, false);
					}

					var encoded = match[1].replace(/[\s+"]/g, "");
					var decoded = base64_decode(encoded);

					var unpacked = common_functions["unpack_packer"](decoded);
					if (!unpacked) {
						console_error(cache_key, "Unable to unpack", decoded, "for", resp);
						return done(null, false);
					}

					match = unpacked.match(/sources:(\[{.*?}\]),/);
					if (!match) {
						console_error(cache_key, "Unable to find sources in", unpacked);
						return done(null, false);
					}

					var sources_json = JSON_parse(match[1]);

					for (var i = 0; i < sources_json.length; i++) {
						if (sources_json[i].type !== "application/x-mpegURL") {
							console_warn(cache_key, "Unknown type for", sources_json[i]);
							continue;
						}

						if (!sources_json[i].file) {
							continue;
						}

						return done([{
							url: sources_json[i].file,
							video: "hls",
							headers: {
								Origin: "https://streamvid.co",
								Referer: resp.finalUrl,
								Accept: "*/*"
							},
							can_head: false
						}], 60*60);
					}

					return done(null, false);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "blackporn.blacklust.com") {
			// http://blackporn.blacklust.com/113013-3/images/1.jpg
			//   http://blackporn.blacklust.com/113013-3/large/1.jpg
			return src.replace(/(:\/\/[^/]+\/+[0-9]+-[0-9]+\/+)images(\/+[0-9]+\.[^/.]+)(?:[?#].*)?$/, "$1large$2");
		}

		if (domain === "galleries.penthouse.com") {
			// http://galleries.penthouse.com/galleries/203929/03.jpg
			//   http://galleries.penthouse.com/galleries/203929/L/03.jpg
			return src.replace(/(\/galleries\/+[0-9]+\/+)([0-9]+\.[^/.]+)(?:[?#].*)?$/, "$1L/$2");
		}

		if (domain_nowww === "letmejerk.com") {
			match = src.match(/^[a-z]+:\/\/[^/]+\/+play\/+([0-9]+)\/+[^/]+\.html(?:[?#].*)?$/);
			if (match) {
				id = match[1];

				var query_letmejerk = function(vid, cb) {
					api_query("letmejerk:" + vid, {
						url: "https://www.letmejerk.com/play/" + vid + "/a.html"
					}, cb, function(done, resp, cache_key) {
						var match = resp.responseText.match(/<script src="[^"]+\/jerkplayer\..*?<\/script>\s*<script type="text\/javascript">\s*var a\s*=\s*\['replace','(.*?)','(.*?)','split'\];.*?\(b\('0x1'\),(0x[0-9a-f]+),(0x[0-9a-f]+),/);
						if (!match) {
							console_error(cache_key, "Unable to find match for", resp);
							return done(null, false);
						}

						var format = match[1];
						var table = match[2];
						var base = parseInt(match[3]);
						var table_len = parseInt(match[4]);

						var replace_hex = function(str) {
							return str.replace(/\\x[0-9a-f]{2}/g, function(x) {
								return string_fromcharcode(parseInt("0x" + x.substr(2)));
							}).replace(/\\'/g, "'");
						};

						format = replace_hex(format);
						table = replace_hex(table).split("|");

						var unpacked = common_functions["static_unpack_packer"](format, base, table_len, table);
						if (!unpacked) {
							var info = {
								format: format,
								table: table,
								table_len: table_len,
								base: base
							};

							console_error(cache_key, "Unable to unpack part 1", resp, match, info);
							return done(null, false);
						}

						var unpacked2 = common_functions["unpack_packer"](unpacked);
						if (!unpacked2) {
							console_error(cache_key, "Unable to unpack part 2", resp, match, unpacked);
							return done(null, false);
						}

						match = unpacked2.match(/loadLetMeJerkVideoPlayer\(([0-9]+),'(.*?)'\);/);
						if (!match) {
							console_error(cache_key, "Unable to find player code in", resp, unpacked2);
							return done(null, false);
						}

						return done({
							vid: match[1],
							key: match[2],
							url: resp.finalUrl
						}, 60*60);
					});
				};

				var query_letmejerk_video = function(data, cb) {
					api_query("letmejerk_video:" + data.vid + ":" + data.key, {
						url: "https://www.letmejerk.com/load/video/" + data.key + "/",
						method: "POST",
						data: "id=" + data.vid,
						headers: {
							Referer: data.url,
							Origin: "https://www.letmejerk.com",
							"x-requested-with": "XMLHttpRequest",
							"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
						}
					}, cb, function(done, resp, cache_key) {
						var match = resp.responseText.match(/<source src=\"(https?:\/\/lmjvideocdn[^"]+)"/);
						if (!match) {
							console_error(cache_key, "Unable to find source for", resp, data);
							return done(null, false);
						}

						return done({
							url: decode_entities(match[1]),
							headers: {
								Referer: data.url
							},
							extra: {
								page: data.url
							}
						}, 60*60);
					});
				};

				page_nullobj = {
					url: src,
					is_pagelink: true
				};

				if (options.cb && options.do_request) {
					query_letmejerk(id, function(data) {
						if (!data) {
							return options.cb(page_nullobj);
						}

						query_letmejerk_video(data, function(obj) {
							if (!obj) {
								return options.cb(page_nullobj);
							}

							return options.cb([obj, page_nullobj]);
						});
					});

					return {
						waiting: true
					};
				} else {
					return page_nullobj;
				}
			}
		}

		if (domain === "thumbs.letmejerk.com") {
			match = src.match(/^[a-z]+:\/\/[^/]+\/+[0-9]+\/+([0-9]+)\.[^/.]+(?:[?#].*)?$/);
			if (match) {
				return {
					url: "https://www.letmejerk.com/play/" + match[1] + "/a.html",
					is_pagelink: true
				};
			}
		}

		if (domain === "cdn.nakedgirls.xxx" ||
			// https://cdn.nudexxx.pics/content/galleries/83/4fbd7f0f5e013e5958f0e048914c28f2-1.jpg
			//   https://cdn.nudexxx.pics/content/galleries/83/4fbd7f0f5e013e5958f0e048914c28f2-1-full.jpg
			domain === "cdn.nudexxx.pics") {
			// https://cdn.nakedgirls.xxx/galleries/311/b34936569e79a64db532ef669a7d6bfb-1.jpg
			//   https://www.nakedgirls.xxx/content/galleries/311/b34936569e79a64db532ef669a7d6bfb-1-full.jpg
			// https://www.nakedgirls.xxx/content/galleries/45/de72e6bb4e702f2c6021cb0257266a48-1-full.jpg
			return src
				.replace(/(:\/\/[^/]+\/+content\/+galleries\/+[0-9]+\/+[0-9a-f]{20,}-[0-9]+)(\.[^/.]+)(?:[?#].*)?$/, "$1-full$2")
				.replace(/:\/\/cdn\.([^/]+)\/+(galleries\/+[0-9]+\/+[0-9a-f]{20,}-[0-9]+)(\.[^/.]+)(?:[?#].*)?$/, "://www.$1/content/$2-full$3");
		}

		if (domain === "proxy.topixcdn.com") {
			// https://proxy.topixcdn.com/ipicimg/26IMVMTK9MHNCGCQ-cp0x300x1200x1500-rsz232x232
			//   https://proxy.topixcdn.com/ipicimg/26IMVMTK9MHNCGCQ
			return src.replace(/(\/ipicimg\/+[0-9A-Z]+)(?:-(?:cp|rsz)[0-9x]+){0,}(?:[?#].*)?$/, "$1");
		}

		if (domain_nosub === "momapix.com" && /^d[0-9]*\./.test(domain)) {
			// https://d0.momapix.com/blaublutedition/Image505220.jpg?w=204&h=271
			//   https://d0.momapix.com/blaublutedition/Preview505220.jpg
			// https://d0.momapix.com/legionmedia/22fe2000727e686cde63e30a1829c9a0afd327c95f4d8581dd3b32d6f7f07e10ba/Image48267458.jpg
			//   https://d0.momapix.com/legionmedia/22fe2000727e686cde63e30a1829c9a0afd327c95f4d8581dd3b32d6f7f07e10ba/Preview48267458.jpg -- 889x1000
			// https://d0.momapix.com/legionmedia/22a7fc77f97fa9f25975f3a247626d3578f06236b0a47e47de43c33785b104b743/Image48883293.jpg/LGN48883293.jpg?v.0.aa68c75c4a77c87f97fb686b2f068676&w=924&h=531
			//   https://d0.momapix.com/legionmedia/22a7fc77f97fa9f25975f3a247626d3578f06236b0a47e47de43c33785b104b743/Preview48883293.jpg/LGN48883293.jpg
			return src.replace(/(:\/\/[^/]+\/+[a-z]+\/+(?:[0-9a-f]{20,}\/+)?)Image([0-9]+\.[^/.?#]+)(\/+[^/?#]+)?(?:[?#].*)?$/, "$1Preview$2$3");
		}

		if (domain === "galleries.tease-pics.com") {
			// https://galleries.tease-pics.com/onlysecretaries/2716r-p/images/01.jpg
			//   https://galleries.tease-pics.com/onlysecretaries/2716r-p/pics/01.jpg
			return src.replace(/(\/[0-9]+[a-z]-p\/+)images\/+/, "$1pics/");
		}

		if (domain_nosub === "lodef.net" && /^img[0-9]*\./.test(domain)) {
			// https://img2.lodef.net/imgs/e/7/5/d/e75d6c4f6081611b49889b222ca98172_s.jpg
			//   https://img2.lodef.net/imgs/e/7/5/d/e75d6c4f6081611b49889b222ca98172_f.jpg
			return src.replace(/(\/imgs\/+(?:[0-9a-f]\/+){1,}[0-9a-f]{10,})_s(\.[^/.]+)(?:[?#].*)?$/, "$1_f$2");
		}

		if (domain_nowww === "porn.com") {
			match = src.match(/^[a-z]+:\/\/[^/]+\/+out\/+[nt]\/+[^/]+\/+([^/]{30,})(?:\/+(?:[0-9]+|[^/]{30,})\/+(?:[0-9]+|[^/]{30,}))?(?:[?#].*)?$/);
			if (match) {
				var splitted = decodeURIComponent(match[1]).split("_");

				var splitted1 = [];
				for (let i = 0; i < splitted.length; i++) {
					splitted1.push(base64_decode(splitted[i]));
				}

				return {
					url: splitted1.join("?"),
					is_pagelink: true
				};
			}
		}

		if (host_domain_nowww === "porn.com" && domain_nosub === "porn.com" && /^media/.test(domain) && options.element) {
			newsrc = common_functions["get_pagelink_el_matching"](options.element, /porn\.com\/+out\//);
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "pandora.tv") {
			// http://www.pandora.tv/view/proshocker/60419315
			var query_pandora_site = function(uid, vid, cb) {
				api_query("pandora_site:" + uid + ":" + vid, {
					url: "http://www.pandora.tv/view/" + uid + "/" + vid
				}, cb, function(done, resp, cache_key) {
					var matches = match_all(resp.responseText, /var (str(?:ResolType|Fid|ChUserId|ResolArr)|n(?:PrgId|VodSvr|Info)|runtime)\s*= ([[0-9'].*?); *\r?\n/);
					if (!matches) {
						console_error(cache_key, "Unable to find vars for", resp);
						return done(null, false);
					}

					var vars = {
						"strResolArr": '["1","2","3","4","5"]',
						"strResolType": "'2'"
					};

					array_foreach(matches, function(match) {
						var varname = match[1];
						var varvalue = match[2];

						vars[varname] = varvalue.replace(/^'(.*)'$/, "$1");
					});

					return done(vars, 60*60);
				});
			};

			var query_pandora_vodurl = function(data, cb) {
				if (!data || !data.strFid || !data.strChUserId || !data.nPrgId || !data.nInfo) {
					console_error("Invalid data", data);
					return cb(null);
				}

				var resolutions = JSON_parse(data.nInfo);
				var resolution = resolutions.sort()[resolutions.length - 1];

				var queries = [
					"userId=" + data.strChUserId,
					"prgId=" + data.nPrgId,
					"fid=" + data.strFid,
					"resolType=" + data.strResolType,
					"resolArr=" + encodeURIComponent(data.strResolArr.replace(/[\]['"]/g, "")),
					"vodSvr=" + data.nVodSvr,
					"resol=" + resolution,
					"runtime=" + data.runtime,
					"tvbox=false",
					"defResol=false",
					"embed=false"
				];

				var referer = "http://www.pandora.tv/view/" + data.strChUserId + "/" + data.nPrgId;

				api_query("pandora_vodurl:" + data.strFid, {
					url: "http://www.pandora.tv/external/getExternalApi/getVodUrl/",
					method: "POST",
					headers: {
						"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
						Origin: "http://www.pandora.tv",
						Referer: referer
					},
					data: queries.join("&"),
					json: true
				}, cb, function(done, resp, cache_key) {
					if (!resp.src) {
						console_error(cache_key, "Unable to find src", resp);
						return done(null, false);
					}

					var obj = {
						url: resp.src,
						is_private: true
					};

					obj.extra = {
						page: referer
					};

					return done(obj, 60*60);
				});
			};

			newsrc = website_query({
				website_regex: /\/view\/+([^/]+)\/+([0-9]+)\/*(?:[?#].*)?$/,
				run: function(cb, match) {
					query_pandora_site(match[1], match[2], function(data) {
						query_pandora_vodurl(data, cb);
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nosub === "pandora.tv" && /^imguser[0-9]*\./.test(domain)) {
			// http://imguser2.pandora.tv/pandora/_channel_img_sm_temp/p/r/proshocker/15/vod_thumb_60419315.jpg
			// http://imguser2.pandora.tv/pandora/_channel_img_temp/a/n/animaxp/35/vod_thumb_60273235.jpg
			newsrc = src.replace(/\/_channel_img_sm_temp\//, "/_channel_img_temp/");
			if (newsrc !== src)
				return newsrc;

			match = src.match(/\/pandora\/+_channel_img_(?:sm_)?temp\/+.\/+.\/+([^/]+)\/+[0-9]+\/+vod_thumb_([0-9]+)\./);
			if (match) {
				return {
					url: "http://www.pandora.tv/view/" + match[1] + "/" + match[2],
					is_pagelink: true
				};
			}
		}

		if (domain_nowww === "imagefap.site" ||
			domain_nowww === "tube.bz" ||
			domain === "embed.mp4.center") {
			match = src.match(/^[a-z]+:\/\/[^/]+\/+(?:player(?:\/+(?:xvideos|goto))?|embed\/+mp4)\/+\?(?:.*&)?u=([^&]+).*?$/);
			if (match) {
				// TODO: maybe support thumbnail too? &t=...
				return {
					url: decodeURIComponent(match[1]),
					is_pagelink: true
				};
			}
		}

		if (domain_nowww === "porndex.com") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+(?:out\/+go|view_video)\.php\?(?:.*&)?go=([0-9]+).*?$/,
				query_for_id: "https://www.porndex.com/out/go.php?go=${id}",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/<meta\s+http-equiv="refresh"\s+content="[0-9]+;URL='([^'"]+)'"/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					return done({
						url: decode_entities(match[1]),
						is_pagelink: true
					}, 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "video.nudevista.com") {
			// https://video.nudevista.com/video/MTMxODIwNDAwMi0zLS8tMC1odHRwczovL2YxaXguY29tL3ZpZGVvcy8xMTM0OTkvdmVyeSN6b29tI2luI2FzcyNmdWNrI2FuYWwjc2V4I3Zlcnkjc21vb3RoI2FzcyNhbmQjbmljZSNwb3Yv-very-zoom-in-ass-fuck-anal-sex-very-smooth-ass-and-nice-pov.html
			// https://video.nudevista.com/video/MTE0OTk0NzIyLTE1LS8tMC1odHRwczovL3d3dy50dWJlOC5jb20vYW1hdGV1ci9zZXgjaW4jYW4jZWxldmF0b3IvMjM0NzI2MS8/dXRtX3NvdXJjZT1udWRldmlzdGEmdXRtX21lZGl1bT1QVCZ1dG1fY2FtcGFpZ249bnVkZXZpc3Rh-sex-in-an-elevator.html
			// https://video.nudevista.com/video/NzMwOTM4NjgyLTE1LS8/cT1hc2lhbiZzPXQtMC1odHRwOi8vamFwYW4jd2hvcmVzLmNvbS92aWRlb3MvMzA0NjM3L3QjcCNmdWxsI3BwcGQjMzM3I3NpbmNlI2Fic29sdXRlbHkjd2FzI2EjYmlnI3RpdHMjYW5kI3RvI3RoZSNvdGhlciNwYXJ0eSN0aGF0I3lvdSNkbyNub3QjZGFiI2hhLw==-tp-full-pppd-since-absolutely-was-a-big-tits-and-to-the-other-party-that-you-do-not-dab-ha.html
			match = src.match(/^[a-z]+:\/\/[^/]+\/+video\/+([^-/.]{10,})(?:\/+([^-/.]{10,})(?:\/+([^-/.]{10,}))?)?(?:-[^/]+)\./);
			if (match) {
				try {
					var strings = [];

					var decoded = base64_decode(match[1]);
					strings.push(decoded);

					if (match[2]) {
						var decoded2 = base64_decode(match[2]);
						strings.push(decoded2);
					}

					if (match[3]) {
						var decoded2 = base64_decode(match[3]);
						strings.push(decoded2);
					}

					let found = false;
					for (let i = 0; i < strings.length; i++) {
						strings[i] = strings[i].replace(/#/g, "-");
						var newsrc = strings[i].replace(/^.*?(https?:\/\/)/, "$1");
						if (newsrc !== strings[i]) {
							found = true;
							strings[i] = newsrc;

							if (i > 0) {
								strings.splice(0, i);
							}

							break;
						}
					}

					if (found && strings.length > 0) {
						return {
							url: strings.join("?"),
							is_pagelink: true
						};
					}
				} catch (e) {
					console_error(e);
				}
			}
		}

		if (domain_nosub === "nudevista.com") {
			// https://x99.nudevista.com/_/curr.gif
			if (/\/_\/+curr\.gif/.test(src))
				return {
					url: src,
					bad: "mask"
				};
		}

		if (domain_nosub === "streamable.com") {
			page_nullobj = null;
			match = src.match(/^[a-z]+:\/\/[^/]+\/+(?:image|video\/+mp4(?:-mobile))\/+([a-z0-9]+)(?:_first)?\./);
			if (match) {
				id = match[1];
			} else {
				match = src.match(/^[a-z]+:\/\/(?:www\.)?streamable\.com\/+([a-z0-9]+)(?:[?#].*)?$/);
				if (match) {
					page_nullobj = {
						url: src,
						is_pagelink: true
					};

					id = match[1];
				}
			}

			if (id) {
				let baseobj = {
					url: src,
					extra: {
						page: "https://www.streamable.com/" + id
					}
				};

				if (page_nullobj)
					page_nullobj.extra = baseobj.extra;

				var query_streamable = function(id, cb) {
					api_query("streamable:" + id, {
						url: "https://www.streamable.com/" + id
					}, cb, function(done, resp, cache_key) {
						var match = resp.responseText.match(/var videoObject\s*=\s*({.*?}); *\r?\n/);
						if (!match) {
							console_error(cache_key, "Unable to find match for", resp);
							return done(null, false);
						}

						var json = JSON_parse(match[1]);

						var title = json.title || json.reddit_title;
						if (title) {
							baseobj.extra.caption = title;
						}

						var urls = [];
						if (json.files) {
							var files = [];
							for (var key in json.files) {
								files.push(json.files[key]);
							}

							files.sort(function(a, b) {
								return b.bitrate - a.bitrate;
							});

							var src_noquery = src.replace(/[?#].*/, "");
							for (var i = 0; i < files.length; i++) {
								if (!files[i].url)
									continue;

								// to avoid infinite loops
								if (files[i].url.replace(/[?#].*/) === src_noquery) {
									files[i].url = src_noquery;
								}

								var videoobj = {
									url: urljoin(resp.finalUrl, files[i].url, true),
									headers: {
										Referer: resp.finalUrl
									},
									video: true
								};

								// fixme: might be a different extension
								if (false && json.original_name) {
									videoobj.filename = json.original_name;
								}

								urls.push(videoobj);
							}
						}

						var thumbnails = [
							json.poster_url,
							json.thumbnail_url,
							json.dynamic_thumbnail_url
						];

						for (var i = 0; i < thumbnails.length; i++) {
							if (thumbnails[i]) {
								urls.push(urljoin(resp.finalUrl, thumbnails[i], true).replace(/[?#].*/, ""));
							}
						}

						return done(urls, 60*60);
					});
				};

				if (options.cb && options.do_request) {
					query_streamable(id, function(obj) {
						if (!obj) {
							return options.cb(page_nullobj || baseobj);
						}

						if (!is_array(obj)) {
							obj = [obj];
						}

						if (page_nullobj)
							obj.push(page_nullobj);

						return options.cb(fillobj_urls(obj, baseobj));
					});

					return {
						waiting: true
					}
				} else {
					return page_nullobj || baseobj;
				}
			}
		}

		if (domain_nowww === "jacquieetmicheltv.net" ||
			domain_nowww === "jacquieetmicheltv2.net" ||
			domain_nowww === "jacquieetmichelelite.com" ||
			domain_nowww === "desinhibition.com" ||
			domain_nowww === "lavideodujourjetm.net" ||
			domain_nowww === "tonpornodujour.com" ||
			// https://www.tyjam.com/en/videos/64-its-time-for-the-double-penetration-for-claire-de-lune-x.html
			domain_nowww === "tyjam.com" ||
			domain_nowww === "colmax.com" ||
			domain_nowww === "hotvideo.fr" ||
			domain_nowww === "pornovoisines.com") {
			match = src.match(/^[a-z]+:\/\/[^/]+\/+(?:([a-z]{2})\/+)?(?:(?:videos\/+show|film-porno(?:\/+elite)?)\/+([0-9]+)(?:\/+[^/]*)|videos\/+([0-9]+)(?:-[^/]+)?)(?:[?#].*)?$/);
			if (match) {
				var lang = match[1] || null;
				id = match[2] || match[3];

				var basedomain = domain_nosub;

				var query_jacquieetmichel_json = function(jsonurl, cb) {
					var id = jsonurl.replace(/.*\/player\/([0-9a-f]{10,})\/\?.*/, "$1");
					if (id === jsonurl) {
						console_log("Unsupported URL", jsonurl);
						return cb(null);
					}

					api_query(basedomain + "_json:" + id, {
						url: jsonurl,
						headers: {
							Accept: "*/*",
							Origin: "https://www." + domain_nosub,
							Referer: "https://www." + domain_nosub + "/"
						},
						json: true
					}, cb, function(done, resp, cache_key) {
						var baseobj = {
							headers: {
								Referer: "https://www." + domain_nosub + "/"
							}
						};

						var urls = [];

						if (resp.sources.dash) {
							urls.push({
								url: resp.sources.dash,
								video: "dash"
							});
						}

						if (resp.sources.hls) {
							urls.push({
								url: resp.sources.hls,
								video: "hls"
							});
						}

						if (resp.sources.mp4) {
							resp.sources.mp4.sort(function(a, b) {
								return parseInt(b.label) - parseInt(a.label);
							});

							for (var i = 0; i < resp.sources.mp4.length; i++) {
								var ourlink = resp.sources.mp4[i];

								if (ourlink.file) {
									urls.push({
										url: ourlink.file,
										video: true
									});
								}
							}
						}

						return done(fillobj_urls(urls, baseobj), 60*60);
					});
				};

				var query_jacquieetmichel = function(id, cb) {
					var langurl = "";
					if (lang)
						langurl = lang + "/";

					if (domain_nosub === "tyjam.com" || domain_nosub === "colmax.com")
						langurl += "videos/";

					api_query(basedomain + ":" + id, {
						url: " https://www." + domain_nosub + "/" + langurl + "api/video/" + id + "/getplayerurl/",
						headers: {
							Referer: "https://www." + domain_nosub + "/",
							"Accept": "application/json, text/javascript, */*; q=0.01",
							"x-requested-with": "XMLHttpRequest"
						},
						json: true
					}, cb, function(done, resp, cache_key) {
						if (!resp.video_settings_url || !resp.video_settings_url.match(/^https?:\/\//)) {
							console_error(cache_key, "Unable to find video url in", resp);
							return done(null, false);
						}

						query_jacquieetmichel_json(resp.video_settings_url, function(data) {
							if (!data)
								return done(null, false);

							done(data, 60*60);
						});
					});
				};

				page_nullobj = {
					url: src,
					is_pagelink: true
				};

				if (options.do_request && options.cb) {
					query_jacquieetmichel(id, function(urls) {
						if (!urls) {
							return options.cb(page_nullobj);
						} else {
							urls.push(page_nullobj);

							return options.cb(urls);
						}
					});

					return {
						waiting: true
					};
				} else {
					return page_nullobj;
				}
			}
		}

		if (domain_nowww === "laracroftonline.com") {
			// https://laracroftonline.com/media_gallery/image/tr11/box-art/SOTTRDE_Boxshot_XB1-1-thumb.png
			//   https://laracroftonline.com/media_gallery/image/tr11/box-art/SOTTRDE_Boxshot_XB1-1.png
			return src.replace(/(\/media_gallery\/+image\/+.*\/[^/]+)-thumb(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "noble-caledonia.co.uk") {
			// https://www.noble-caledonia.co.uk/thumb.php?source_type=media_gallery&source_info=70425&action=A.1000.750
			//   https://www.noble-caledonia.co.uk/thumb.php?source_type=media_gallery&source_info=70425&action=A -- significantly desaturated
			if (/\/thumb\.php\?/.test(src)) {
				var queries = get_queries(src);
				if (queries.action) {
					queries.action = "A";
				}

				return src.replace(/[?#].*/, "?" + stringify_queries(queries));
			}
		}

		// atobiz cms (http://www.atobiz.com/)
		if (domain === "fundraise.globalbrigades.org" ||
			// http://hekkersmannen.nl/media_gallery/thumb/500/500/395_image.jpeg
			//   http://hekkersmannen.nl/media_gallery/thumb/0/0/395_image.jpeg
			domain_nowww === "hekkersmannen.nl" ||
			// https://www.4lazylegs.com/media_gallery/thumb/320/0/Foto_1.jpg
			//   https://www.4lazylegs.com/media_gallery/thumb/0/0/Foto_1.jpg
			domain_nowww === "4lazylegs.com" ||
			// http://www.hertoghendrik.com/media_gallery/thumb/320/0/M31224_29_voller_Einzug_1_komp.jpg
			//   http://www.hertoghendrik.com/media_gallery/thumb/0/0/M31224_29_voller_Einzug_1_komp.jpg
			domain_nowww === "hertoghendrik.com") {
			// https://fundraise.globalbrigades.org/media_gallery/thumb/320/0/CAM00348.jpg
			//   https://fundraise.globalbrigades.org/media_gallery/thumb/0/0/CAM00348.jpg
			return src.replace(/(\/media_gallery\/+thumb\/+)[0-9]+\/+[0-9]+\/+/, "$10/0/");
		}

		if (domain === "media.nonktube.com") {
			// https://media.nonktube.com/videos/tmb_2/109598/thumb.jpg
			match = src.match(/\/videos\/+tmb_[0-9]+\/+([0-9]+)\/+(?:thumb|default)\./);
			if (match) {
				id = match[1];

				return {
					url: "https://cdn.nonktube.com/" + id + ".mp4",
					headers: {
						Referer: "https://www.nonktube.com/"
					},
					video: true
				};
			}
		}

		if (domain_nowww === "nonktube.com") {
			match = src.match(/^[a-z]+:\/\/[^/]+\/+video\/+([0-9]+)(?:\/+[^/]*)?(?:[?#].*)?$/);
			if (match) {
				id = match[1];

				let page_nullobj = {
					url: src,
					is_pagelink: true
				};

				return [{
					url: "https://cdn.nonktube.com/" + id + ".mp4",
					headers: {
						Referer: "https://www.nonktube.com/"
					},
					video: true
				}, page_nullobj];
			}
		}

		if (domain === "snusercontent.global.ssl.fastly.net") {
			// https://snusercontent.global.ssl.fastly.net/member-headshot-square/63/1800363_9211532.jpg
			//   https://snusercontent.global.ssl.fastly.net/member-headshot-square-large/63/1800363_9211532.jpg
			//   https://snusercontent.global.ssl.fastly.net/member-profile-full/63/1800363_9211532.jpg
			// https://snusercontent.global.ssl.fastly.net/member-profile-thumbnail/63/1800363_10944747.jpg
			//   https://snusercontent.global.ssl.fastly.net/member-profile-featured/63/1800363_10944747.jpg
			//   https://snusercontent.global.ssl.fastly.net/member-profile-full/63/1800363_10944747.jpg
			return src.replace(/(:\/\/[^/]+\/+)(?:member-(?:headshot-square(?:-large)?|profile-(?:featured|thumbnail)))\/+/, "$1member-profile-full/");
		}

		if (domain_nowww === "gotporn.com") {
			match = src.match(/^[a-z]+:\/\/[^/]+\/+gvf\/+[^-_/.]{10,}\.([^-/.]{50,})\.$/);
			if (match) {
				try {
					var splitted = match[1].split("_");
					for (let i = 0; i < splitted.length; i++) {
						splitted[i] = base64_decode(splitted[i]);
					}

					var jsonstr = splitted.join("?");
					var json = JSON_parse(jsonstr);
					return {
						url: json.url,
						headers: {
							Referer: "https://www.gotporn.com/"
						},
						video: true
					};
				} catch (e) {
					console_error(e);
				}
			}
		}

		if (domain_nosub === "gotporn.com" && /^cdn[0-9]*-pic-cf\./.test(domain)) {
			// https://cdn2-pic-cf.gotporn.com/2018/09/24/9922426.1.240.180.jpg
			match = src.match(/^[a-z]+:\/\/[^/]+\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}([0-9]+)\./);
			if (match) {
				return {
					url: "https://www.gotporn.com/a/video-" + match[1],
					is_pagelink: true
				};
			}
		}

		if (domain_nowww === "gotporn.com") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+[^/]+\/+video-([0-9]+)(?:\/+[^/]*)?(?:[?#].*)?$/,
				query_for_id: function(id) {
					return {
						url: "https://www.gotporn.com/a/video-" + id
					}
				},
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/<div class="video-object-container">\s*<video.*?>\s<source\s*src="(https?:\/\/www\.gotporn\.com\/+gvf\/+[^"]+)"/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					var baseobj = {
						headers: {
							Referer: "https://www.gotporn.com/"
						},
						extra: {}
					};

					var canonical = resp.responseText.match(/<link rel="canonical" href="([^"]+)">/);
					if (canonical) {
						baseobj.extra.page = decode_entities(canonical[1]);
						baseobj.headers.Referer = baseobj.extra.page;
					}

					var url = {
						url: decode_entities(match[1]),
						video: true
					};

					return done(fillobj_urls([url], baseobj), 60*60);
				}
			});
			if (newsrc)
				return newsrc;
		}

		if (domain === "static.freedownloadmanager.org") {
			// programid_screenshotid_resolutionid
			// https://static.freedownloadmanager.org/s/3123/3123837_3_2.png
			//   https://static.freedownloadmanager.org/s/3123/3123837_3.png
			// https://static.freedownloadmanager.org/s/3123/3123837_2_2.png
			//   https://static.freedownloadmanager.org/s/3123/3123837_2.jpg
			obj = {
				url: src,
				bad_if: [{
					headers: {
						"last-modified": "Fri, 24 Aug 2018 10:15:51 GMT",
						"content-length": "5743",
						"content-type": "image/jpeg"
					}
				}]
			};

			newsrc = src.replace(/(\/s\/+[0-9]+\/+[0-9]+_[0-9]+)_[0-9](\.[^/.]+)(?:[?#].*)?$/, "$1$2");
			if (newsrc !== src) {
				return fillobj_urls(add_extensions(newsrc), obj);
			} else {
				return obj;
			}
		}

		if (domain_nowww === "nastyvideotube.com") {
			match = src.match(/^[a-z]+:\/\/[^/]+\/+o\.php\?(?:.*)?u=([^-&?#]{10,})/);
			if (match) {
				newsrc = match[1].replace(/~/g, "=");

				try {
					newsrc = base64_decode(newsrc);

					return {
						url: newsrc,
						is_pagelink: true
					};
				} catch (e) {
					console_error(e);
				}
			}
		}

		if (domain === "gallery.armyofselenagomez.com") {
			// http://gallery.armyofselenagomez.com/cache/Awards/24-November-2019-Selena-on-the-red-carpet-of-American-Music-Awards-2019-at-the-Microsoft-Theater-in-Los-Angeles-California/001_100_w100_h100_thumb.jpg?cached=1574844161
			//   http://gallery.armyofselenagomez.com/albums/Awards/24-November-2019-Selena-on-the-red-carpet-of-American-Music-Awards-2019-at-the-Microsoft-Theater-in-Los-Angeles-California/001.jpg?cached=1574844161
			return src.replace(/\/cache\/+([^/]+\/+[^/]+\/+[^/]+)_[0-9]+(?:_[wh][0-9]+){0,2}(?:_thumb)?(\.[^/.]+)(?:[?#].*)?$/, "/albums/$1$2");
		}

		if (domain === "d3rwyinxzcqr6y.cloudfront.net" ||
			// thanks to anonymous
			// https://www.yesstyle.com/en/hipper-set-long-sleeve-rash-guard-swim-pants/info.html/pid.1072691298
			// https://d1flfk77wl2xk4.cloudfront.net/Assets/GalleryImage/48/667/g0103566748.jpg
			//   https://d1flfk77wl2xk4.cloudfront.net/Assets/GalleryImage/48/667/L_g0103566748.jpg
			// other:
			// https://d1flfk77wl2xk4.cloudfront.net/Assets/47/667/L_p0103566747.jpg
			//   https://d1flfk77wl2xk4.cloudfront.net/Assets/GalleryImage/48/667/L_g0103566748.jpg
			domain === "d1flfk77wl2xk4.cloudfront.net") {
			// https://d3rwyinxzcqr6y.cloudfront.net/Assets/res/imgs/button/lightbox-btn-prev.gif
			// https://d3rwyinxzcqr6y.cloudfront.net/Assets/res/imgs/addonBar.png
			// https://d3rwyinxzcqr6y.cloudfront.net/Assets/res/imgs/creative/20wk30/rhs_1092826395.jpg -- not mask
			if (/\/Assets\/+res\/+imgs\/+(?:button\/+)?[^/]+\.(?:gif|png)(?:[?#].*)?$/.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}

			// thanks to Gyuri on discord:
			// https://www.yesasia.com/us/kara-star-collection-card-vol-2/1025029262-0-0-0-en/info.html
			// https://d3rwyinxzcqr6y.cloudfront.net/Assets/GalleryImage/36/852/g0017885236.jpg
			//   https://d3rwyinxzcqr6y.cloudfront.net/Assets/GalleryImage/36/852/L_g0017885236.jpg
			// https://d3rwyinxzcqr6y.cloudfront.net/Assets/31/852/p0017885231.jpg
			//   https://d3rwyinxzcqr6y.cloudfront.net/Assets/31/852/L_p0017885231.jpg
			// https://d3rwyinxzcqr6y.cloudfront.net/Assets/89/927/S_p0020492789.jpg
			//   https://d3rwyinxzcqr6y.cloudfront.net/Assets/89/927/L_p0020492789.jpg
			// doesn't work for all:
			// https://www.yesasia.com/us/kara-star-collection-card-10-pack-set-vol-1/1023742758-0-0-0-en/info.html
			// https://d3rwyinxzcqr6y.cloudfront.net/Assets/GalleryImage/79/430/g0014343079.jpg -- 140x1397
			//   https://d3rwyinxzcqr6y.cloudfront.net/Assets/GalleryImage/79/430/L_g0014343079.jpg -- 72x720
			newsrc = src.replace(/(\/Assets\/+(?:GalleryImage\/+)?[0-9]+\/+[0-9]+\/+)(?:S_)?([gp][0-9]+\.)/, "$1L_$2");
			if (newsrc !== src) {
				if (get_image_size && options.cb) {
					get_image_size(newsrc, function(x, y) {
						if (!x || !y)
							return options.cb(null);

						if (y === 720) {
							get_image_size(src, function(oldx, oldy) {
								if (oldx*oldy < x*y) {
									return options.cb(newsrc);
								} else {
									return options.cb(null);
								}
							});
						} else {
							return options.cb(newsrc);
						}
					});

					return {
						waiting: true
					};
				}
			}
		}

		if (domain_nowww === "youjizz.com") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+videos\/+[^/]*-([0-9]+)\.html(?:[?#].*)?$/,
				query_for_id: "https://www.youjizz.com/videos/-${id}.html",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/var dataEncodings\s*=\s*(\[{.*?}\]);\s*var encodings/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					var json = JSON_parse(match[1]);
					sort_by_key(json, "quality");

					var baseobj = {
						extra: {},
						headers: {
							Referer: resp.finalUrl
						}
					};

					var url = get_meta(resp.responseText, "og:url");
					if (url)
						baseobj.extra.page = url;

					var title = get_meta(resp.responseText, "og:title");
					if (title)
						baseobj.extra.caption = title;

					var urls = [];
					for (var i = 0; i < json.length; i++) {
						var newurl = urljoin(resp.finalUrl, json[i].filename, true);
						var obj = {url: newurl, video: true};

						if (string_indexof(newurl, "_hls") >= 0) {
							obj.video = "hls";
						}

						urls.push(obj);
					}

					return done(fillobj_urls(urls, baseobj), 60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (host_domain_nowww === "youjizz.com" && domain_nosub === "youjizz.com" && /^cdne-(?:pics|mobile)\./.test(domain) && options.element) {
			newsrc = common_functions["get_pagelink_el_matching"](options.element, /^[a-z]+:\/\/[^/]+\/+videos\/+[^/]*-([0-9]+)\.html(?:[?#].*)?$/);
			if (newsrc) return newsrc;
		}

		if (domain_nosub === "vporn.com" && /^vm[0-9]*\./.test(domain)) {
			// https://vm1.vporn.com/t/99/277135199/d3.jpg
			//   https://vm1.vporn.com/t/99/277135199/b3.jpg
			newsrc = src.replace(/(\/t\/+[0-9]+\/+[0-9]+\/+)d([0-9]+\.[^/.]+)(?:[?#].*)?$/, "$1b$2");
			if (newsrc !== src)
				return newsrc;

			match = src.match(/\/t\/+[0-9]+\/+([0-9]+)\/+/);
			if (match) {
				return {
					url: "https://pornone.com/machine/a/" + match[1] + "/",
					is_pagelink: true
				};
			}
		}

		if (domain_nowww === "dood.to" ||
			domain_nowww === "doods.pro" ||
			domain_nowww === "ds2play.com" ||
			domain_nowww === "do0od.com" ||
			domain_nowww === "doodstream.com") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+[de]\/+([0-9a-z]{10,})\/*(?:[?#].*)?$/,
				query_for_id: function(id) {
					let url = "https://" + domain + "/e/" + id;
					return {
						url: url,
						headers: {
							Referer: url,
							"Sec-Fetch-Dest": "document",
							"Sec-Fetch-Mode": "navigate",
							"Sec-Fetch-Site": "same-origin"
						},
						imu_mode: "document"
					};
				},
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/\$\.get\('(\/pass_md5\/[^']+)', function/);
					if (!match) {
						console_error(cache_key, "Unable to find pass_md5 match for", resp);
						return done(null, false);
					}

					var token = resp.responseText.match(/\?token=([0-9a-z]{10,})&expiry=/);
					if (!token) {
						console_error(cache_key, "Unable to find token for", resp);
						return done(null, false);
					} else {
						token = token[1];
					}

					var baseobj = {
						extra: {}
					};

					var title = get_meta(resp.responseText, "og:title");
					if (title) {
						baseobj.extra.caption = title;
					}

					baseobj.extra.page = resp.finalUrl;

					var md5_url = urljoin(resp.finalUrl, match[1], true);
					var get_videourl_from_md5url = function(md5url, cb) {
						api_query("dood.to_md5url:" + md5url, {
							url: md5url,
							headers: {
								Referer: resp.finalUrl,
								"x-requested-with": "XMLHttpRequest"
							}
						}, cb, function(done, resp, cache_key) {
							if (!resp.responseText.match(/^(https?:\/\/.*~)$/)) {
								console_error(cache_key, "Invalid URL for", resp);
								return done(null, false);
							}

							return done(resp.responseText, 60*60);
						});
					};

					get_videourl_from_md5url(md5_url, function(vidurl) {
						if (!vidurl) {
							return done(null, false);
						}

						var alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
						for (var i = 0; i < 10; i++) {
							vidurl += string_charat(alpha, Math_floor(Math_random() * alpha.length));
						}

						vidurl += "?token=" + token + "&expiry=" + Date.now();

						return done({
							url: vidurl,
							extra: baseobj.extra,
							headers: {
								Referer: vidurl.replace(/(:\/\/[^/]+\/+).*/, "$1"),
								"Accept": "*/*",
								"Accept-Encoding": "identity;q=1, *;q=0",
								"Sec-Fetch-Site": "cross-site",
								"Sec-Fetch-Mode": "no-cors",
								"Sec-Fetch-Dest": "video"
							},
							can_head: false,
							video: true
						}, 60*60);
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "img.ivsky.com") {
			// https://www.ivsky.com/bizhi/selena_gomez_v31607/pic_548615.html
			// https://img.ivsky.com/img/bizhi/t/201510/13/selena_gomez.jpg
			//   https://img.ivsky.com/img/bizhi/pre/201510/13/selena_gomez.jpg
			//   https://img.ivsky.com/img/bizhi/pic/201510/13/selena_gomez.jpg?download
			// https://img.ivsky.com/img/tupian/li/202003/02/yetu-017.jpg
			//   https://img.ivsky.com/img/tupian/co/202003/02/yetu-017.jpg
			//   https://img.ivsky.com/img/tupian/pre/202003/02/yetu-017.jpg
			// https://img.ivsky.com/img/tupian/slides/202002/28/daxiongmao-001.jpg
			//   https://img.ivsky.com/img/tupian/pre/202002/28/daxiongmao-001.jpg
			return src
				.replace(/\/img\/+([^/]+)\/+pre\/+([^?#]*)(?:[?#].*)?$/, "/img/$1/pic/$2?download")
				.replace(/\/img\/+([^/]+)\/+(?:[mt]|li|co|slides)\/+/, "/img/$1/pre/");
		}

		if (domain_nowww === "databasegdriveplayer.me" ||
			domain_nowww === "databasegdriveplayer.xyz" ||
			domain === "database.gdriveplayer.us") {
			newsrc = website_query({
				website_regex: /^([a-z]+:\/\/[^/]+\/+player\.php\?.*)$/,
				query_for_id: "${id}",
				process: function(done, resp, cache_key) {
					var unpacked1 = common_functions["unpack_packer"](resp.responseText);
					if (!unpacked1) {
						console_error(cache_key, "Unable to find packed data #1 for", resp);
						return done(null, false);
					}

					var data_match = unpacked1.match(/^var data='({.*?})';[[]'sojson\.v4'/);
					if (!data_match) {
						console_error(cache_key, "Unable to find data json for", resp, {unpacked1:unpacked1});
						return done(null, false);
					}

					var data_json = data_match[1];

					// to replace \\/ etc.
					// ugly but it works
					var data = JSON_parse(data_json);
					data.ct = JSON_parse('"' + data.ct + '"');
					data_json = JSON_stringify(data);

					var sojson_payload = unpacked1.match(/[[]'sojson\.v4'\].*?\(null,'([0-9a-zA-Z]{100,})'[[]/);
					if (!sojson_payload) {
						console_error(cache_key, "Unable to find sojson packed data for", resp, {unpacked1:unpacked1});
						return done(null, false);
					}

					var sojson_splitted = sojson_payload[1].split(/[a-zA-Z]{1,}/);
					var sojson_unpacked = string_fromcharcode.apply(null, sojson_splitted);

					var pass = sojson_unpacked.match(/var pass\s*=\s*"([^"]+)";/);
					if (!pass) {
						console_error(cache_key, "Unable to find AES key from", resp, {sojson_unpacked:sojson_unpacked});
						return done(null, false);
					} else {
						pass = pass[1];
					}

					//console_log(sojson_unpacked);

					get_library("cryptojs_aes", options, options.do_request, function(CryptoJS) {
						if (!CryptoJS) {
							console_error(cache_key, "Unable to fetch CryptoJS");
							return done(null, false);
						}

						var JsonFormatter = common_functions["get_jsonformatter_for_cryptojs"](CryptoJS);
						var decrypted_raw = CryptoJS.AES.decrypt(data_json, pass, {format: JsonFormatter});

						try {
							var decrypted = decrypted_raw.toString(CryptoJS.enc.Utf8);
						} catch (e) {
							console_error(cache_key, e, {
								decrypted_raw: decrypted_raw,
								data_json: data_json,
								pass: pass,
								format: JsonFormatter,
								CryptoJS: CryptoJS
							});

							return done(null, false);
						}

						var unpacked2 = common_functions["unpack_packer"](decrypted);
						if (!unpacked2) {
							console_error(cache_key, "Unable to find packed data #2 for", resp, {
								data_json: data_json,
								pass: pass,
								decrypted_raw: decrypted_raw,
								decrypted: decrypted,
								CryptoJS: CryptoJS,
								format: JsonFormatter
							});
							return done(null, false);
						}

						//console_log(unpacked2);

						// .*? is needed because there are actually two matches for this
						var sources_match = unpacked2.match(/{sources:(\[{.*?}\]),image:/);
						if (!sources_match) {
							console_error(cache_key, "Unable to find sources for", resp, {unpacked2:unpacked2});
							return done(null, false);
						}

						// to get rid of \"
						var sources_json = JSON_parse('"' + sources_match[1] + '"');
						var sources = JSON_parse(sources_json);

						// &res=original, &res=default, &res=360
						var sortorder = ["Original", "Default", "360p"];
						sources.sort(function(a, b) {
							var a_label = a.label;
							var b_label = b.label;

							var a_sortorder = array_indexof(sortorder, a_label);
							var b_sortorder = array_indexof(sortorder, b_label);

							if (a_sortorder >= 0) {
								if (b_sortorder >= 0) {
									return a_sortorder - b_sortorder;
								} else {
									return -1;
								}
							} else if (b_sortorder >= 0) {
								return 1;
							} else {
								return parseInt(b_label) - parseInt(a_label);
							}
						});

						// TODO: unshift one that replaces a url with &res=original (and deduplicate)
						var baseobj = {
							is_private: true,
							video: true
						};

						var urls = [];
						for (var i = 0; i < sources.length; i++) {
							urls.push(urljoin(resp.finalUrl, sources[i].file, true));
						}

						return done(fillobj_urls(urls, baseobj), 60*60);
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "free.cherrypimps.com") {
			// https://free.cherrypimps.com/s3/adrianachechik/14990/content/th01.jpg
			//   https://free.cherrypimps.com/s3/adrianachechik/14990/content/01.jpg
			return src.replace(/(\/[0-9]+\/+content\/+)th([0-9]+\.)/, "$1$2");
		}

		if (domain_nosub === "ftvcash.com" && /^galleries[0-9]*\./.test(domain)) {
			// http://galleries2.ftvcash.com/V20_gals/ftvgirlsphoto/294d/th1.jpg
			//   http://galleries2.ftvcash.com/V20_gals/ftvgirlsphoto/294d/1.jpg
			return src.replace(/(_gals\/+[^/]+\/+[^/]+\/+)th([0-9]+\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nosub === "modelmanagement.com" && /^asset[0-9]*\./.test(domain)) {
			// https://asset1.modelmanagement.com/mm-eyJ0Ijp7ImsiOnsibCI6/IjU1IiwiaCI6IjU1In19/LCJpZCI6Imk2OTAxNTA1/IiwiZiI6ImpwZyJ9.jpg
			//   https://asset1.modelmanagement.com/mm-eyJmIjoianBnIiwiaWQi/OiJpNjkwMTUwNSIsInQi/Ont9fQ.jpg
			match = src.match(/:\/\/[^/]+\/+mm-((?:[^/.?#]{15,}\/+){1,}[^/.?#;]+);*\.[^/.]+(?:[?#].*)?$/);
			if (match) {
				var splitted = match[1].split(/\/+/g);
				var splitted_dec = [];
				try {
					for (let i = 0; i < splitted.length; i++) {
						splitted_dec[i] = base64_decode(splitted[i]);
					}

					var json = JSON_parse(splitted_dec.join(""));
					console_log(json);

					// f: "jpg"
					// id: "i6901505"
					// t: {k: {l: "55", h: "55"}}
					var newjson = {f: json.f, id: json.id, t: {}};
					var newjson_str = JSON_stringify(newjson);

					splitted = [];
					while (newjson_str.length >= 15) {
						splitted.push(base64_encode(newjson_str.substr(0, 15)).replace(/=/g, ""));
						newjson_str = newjson_str.substring(15);
					}

					if (newjson_str.length > 0)
						splitted.push(base64_encode(newjson_str).replace(/=/g, ""));

					return {
						url: urljoin(src, "/mm-" + splitted.join("/") + "." + json.f, true),
						head_wrong_contenttype: true // actually, it has no content-type, either for get or head
					};
				} catch (e) {
					console_error(e);
				}
			}
		}

		if (domain_nowww === "terragame.com") {
			// http://www.terragame.com/downloadable/shooting/westward/thumb_1.gif
			//   http://www.terragame.com/downloadable/shooting/westward/screen_1.jpg
			return src.replace(/\/thumb_([0-9]+)\.gif(?:[?#].*)?$/, "/screen_$1.jpg");
		}

		if (domain_nowww === "oldgames.sk") {
			// https://www.oldgames.sk/images/oldgames/3d_action/No.One.Lives.Forever/.thumbs/_gallery_nolf-title.png
			//   https://www.oldgames.sk/images/oldgames/3d_action/No.One.Lives.Forever/nolf-title.png
			return src.replace(/(\/images\/.*\/)\.thumbs\/+_gallery_/, "$1");
		}

		if (domain === "static.gamersgate.com") {
			// https://static.gamersgate.com/media/products/product/14749964/screenshot_640_480_KNNYFPS.jpg/w122/
			//   https://static.gamersgate.com/media/products/product/14749964/screenshot_640_480_KNNYFPS.jpg
			return src.replace(/(\/media\/+products\/+product\/+[0-9]+\/+[^/]+)\/+[wh][0-9]+\/+(?:[?#].*)?$/, "$1");
		}

		if (domain_nowww === "ai-love.com") {
			// http://www.ai-love.com/avphoto/himekawa_rei/photo/02s2.jpg
			//   http://www.ai-love.com/avphoto/himekawa_rei/photo/02.jpg
			return src.replace(/(\/photo\/+[0-9]+)s[0-9]+(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "static.namethatporn.com") {
			// https://static.namethatporn.com/media/tinies/2019/09/24/9KBVK6R324BG4_anyone-know-the-video-or-the-name-of-these-japan-pornstar-squirting-on-her-bed.webp
			//   https://static.namethatporn.com/media/displays/2019/09/24/9KBVK6R324BG4_anyone-know-the-video-or-the-name-of-these-japan-pornstar-squirting-on-her-bed.webp
			//   https://static.namethatporn.com/media/displays/2019/09/24/9KBVK6R324BG4_anyone-know-the-video-or-the-name-of-these-japan-pornstar-squirting-on-her-bed.mp4
			newsrc = src.replace(/\/media\/+tinies\/+/, "/media/displays/");
			if (newsrc !== src)
				return newsrc;

			return add_full_extensions(src, ["mp4", "webp"], true);
		}

		if (domain === "tn.squirtingclips.com") {
			// http://tn.squirtingclips.com/img/25/all_bg.png
			if (/\/img\/+[0-9]+\/+all_bg\./.test(src))
				return {
					url: src,
					bad: "mask"
				};
		}

		if (domain_nowww === "kimcartoon.to") {
			// https://kimcartoon.to/Content/images/body_bg.gif
			if (/\/images\/+body_bg.gif(?:[?#].*)?$/.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}
		}

		if (domain_nowww === "asianpussyhub.com" ||
			domain_nowww === "wetjapaneseporn.com" ||
			// http://www.okasianxxxtube.com/hd.php?movie=asiantube/kaori-kirara-5-2.php&brick=NXgxNng1Mjg0OTU=
			domain_nowww === "okasianxxxtube.com") {
			match = src.match(/^[a-z]+:\/\/[^/]+\/+(?:play|(?:hd|s).php)\?(?:.*&)?(?:video|movie|select)=([^&]+).*?$/);
			if (match) {
				try {
					newsrc = match[1];

					if (string_indexof(newsrc, "/") < 0)
						newsrc = base64_decode(newsrc);

					return [
						{
							url: urljoin(src, newsrc, true),
							is_pagelink: true
						},
						{
							url: src,
							is_pagelink: true
						}
					];
				} catch (e) {
					console_error(e);
				}
			}

			newsrc = website_query({
				website_regex: /^([a-z]+:\/\/[^/]+\/+(?:asian(?:vids|tube)|movie)\/+[^/.?#]+\.(?:html|php)(?:[?#].*)?)$/,
				query_for_id: "${id}",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/<div class="video-holder">\s*<div class="player">[\s\S]*?<iframe\s+(?:(?:width|height)="[0-9]+"\s+){0,}src="(https?:\/\/[^"]+)"/);
					if (!match) {
						console_error(cache_key, "Unable to find embed match for", resp);
						return done(null, false);
					}

					return done(decode_entities(match[1]), 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "nakedsexyasians.com") {
			// http://www.nakedsexyasians.com/hph.php?naked=mov/ai-shinozaki-bikini-motor-vehicle-detersive.php&asian=5!1.4.2!636299
			match = src.match(/^[a-z]+:\/\/[^/]+\/+hph.php\?(?:.*&)?naked=([^&]+).*?$/);
			if (match) {
				try {
					newsrc = decodeURIComponent(match[1]);

					return [
						{
							url: urljoin(src, newsrc, true),
							is_pagelink: true
						},
						{
							url: src,
							is_pagelink: true
						}
					];
				} catch (e) {
					console_error(e);
				}
			}

			newsrc = website_query({
				website_regex: /^([a-z]+:\/\/[^/]+\/+mov\/+[^/.?#]+\.php(?:[?#].*)?)$/,
				query_for_id: "${id}",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/<div class="wrap_player">\s*<iframe\s+(?:(?:width|height)="[0-9]+"\s+){0,}src="(https?:\/\/[^"]+)"/);
					if (!match) {
						console_error(cache_key, "Unable to find embed match for", resp);
						return done(null, false);
					}

					return done(decode_entities(match[1]), 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "asiantubevid.com" ||
			domain_nowww === "alesbiansex.com" ||
			domain_nowww === "lezzietub.com" ||
			domain_nowww === "xxxfilm.pro") {
			newsrc = website_query({
				website_regex: /^([a-z]+:\/\/[^/]+\/+embed\/+[0-9a-z]+\?.*)$/,
				query_for_id: "${id}",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/<video [^>]+>\s*<source\s+src="(https?:\/\/[^"]+)"/);
					if (!match) {
						console_error(cache_key, "Unable to find video match for", resp);
						return done(null, false);
					}

					return done({
						url: decode_entities(match[1]),
						headers: {
							Referer: resp.finalUrl
						},
						video: true
					}, 60*60);
				}
			});
			if (newsrc) return newsrc;

			newsrc = website_query({
				website_regex: /^([a-z]+:\/\/[^/]+\/+(?:[a-z]+\/+)?(?:[0-9a-zA-Z]+\?.*|\?(?:[^&]*&)?(?:video|content|watch)=[0-9a-zA-Z]+(?:&.*)?))$/,
				query_for_id: "${id}",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/<div class='asg-hover'\s*style='[^']+'>.*?<iframe src='(\/embed\/+[^']+)'/);
					if (!match) {
						console_error(cache_key, "Unable to find embed match for", resp);
						return done(null, false);
					}

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

		if (domain_nowww === "dirtyships.net") {
			// thanks to anonymous for reporting:
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+video\/+([0-9]+)\/+/,
				query_for_id: "https://" + domain + "/video/${id}/",
				process: function(done, resp, cache_key) {
					let match = resp.responseText.match(/<div class=.video-embedded.>\s*<iframe[^>]*src="(https?:\/\/[^"]+)"/);
					if (!match) {
						console_error(cache_key, "Unable to find iframe match for", resp);
						return done(null, false);
					}

					return done({
						url: decode_entities(match[1]),
						is_pagelink: true
					}, 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "hdpornflix.com" ||
			domain_nowww === "pornstreams.co") {
			// thanks to anonymous for reporting:
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+([^/]+)\/*(?:[?#].*)?$/,
				query_for_id: "https://" + domain + "/${id}/",
				process: function(done, resp, cache_key) {
					let match = resp.responseText.match(/<div class=.responsive-player.>\s*<iframe[^>]*src="(https?:\/\/[^"]+)"/);
					if (!match) {
						console_error(cache_key, "Unable to find iframe match for", resp);
						return done(null, false);
					}

					return done({
						url: decode_entities(match[1]),
						is_pagelink: true
					}, 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "cdn.17app.co") {
			// https://cdn.17app.co/THUMBNAIL_DDAB5683-917F-48FD-BE96-DC80838E7752.jpg
			//   https://cdn.17app.co/DDAB5683-917F-48FD-BE96-DC80838E7752.jpg
			return src.replace(/(:\/\/[^/]+\/+)THUMBNAIL_/, "$1");
		}

		if (domain_nowww === "porn-gif.net") {
			// http://porn-gif.net/img/bunnyblondy/bunnyblondy_1mini.gif
			//   http://porn-gif.net/img/bunnyblondy/bunnyblondy_1miniki.gif
			//   http://porn-gif.net/img/bunnyblondy/bunnyblondy_1.gif
			return src.replace(/(\/img\/+[^/]+\/+[^/]+_[0-9]+)mini(?:ki)?(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "xofeed.com") {
			// http://xofeed.com/content/models/savannah-sixx/pictures/passionhd/seduction-of-a-tutor/thumbs/SeductionOfATutor_PHD-01.jpg
			//   http://xofeed.com/content/models/savannah-sixx/pictures/passionhd/seduction-of-a-tutor/preview/SeductionOfATutor_PHD-01.jpg
			return src.replace(/(\/content\/.*\/pictures\/.*\/)thumbs\/+/, "$1preview/");
		}

		if (domain_nowww === "omny.fm") {
			// https://omny.fm/shows/douse/ep173
			// https://omny.fm/shows/the-alan-jones-breakfast-show/british-author-douglas-murray
			var query_omny_api = function(showname, clipname, cb) {
				api_query("omny:" + showname + "/" + clipname, {
					url: "https://omny.fm/api/embed/shows/" + showname + "/clip/" + clipname,
					imu_mode: "xhr",
					headers: {
						Accept: "application/json, text/plain, */*",
						Referer: "https://omny.fm/shows/" + showname + "/" + clipname + "/embed?source=omnyfm&size=square&style=cover"
					},
					json: true
				}, cb, function(done, resp, cache_key) {
					done(resp, 6*60*60);
				});
			};

			newsrc = website_query({
				website_regex: {
					regex: /^[a-z]+:\/\/[^/]+\/+shows\/+([^/]+)\/+([^/?#.]+)(?:\/+embed)?(?:[?#].*)?$/,
					groups: ["showname", "clipname"]
				},
				run: function(cb, match) {
					query_omny_api(match.groups.showname, match.groups.clipname, function(data) {
						if (!data) return cb(null);

						var obj = {
							extra: {
								page: data.OmnyShareUrl,
								caption: data.Title
							}
						};

						var urls = [];

						urls.push({
							url: "https://traffic.omny.fm/d/clips/" + data.OrganizationId + "/" + data.ProgramId + "/" + data.Id + "/audio.mp3?requestSource=Widget&utm_source=OmnyFM&embeddedUrl=" + encodeURIComponent(src) + "&source=omnyfm",
							media_info: {
								type: "audio"
							}
						});

						urls.push(data.Images.Original);

						return cb(fillobj_urls(urls, obj));
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "omny.fm" ||
			// thanks to fireattack on github: https://github.com/qsniyg/maxurl/issues/386#issuecomment-1454663911
			// https://www.omnycontent.com/d/programs/67122501-9b17-4d77-84bd-a93d00dc791e/e9c977c0-eb88-4444-b8d6-ab7600454421/image.jpg?t=1584608243&size=small
			//   https://www.omnycontent.com/d/programs/67122501-9b17-4d77-84bd-a93d00dc791e/e9c977c0-eb88-4444-b8d6-ab7600454421/image.jpg?t=1584608243&size=Original
			domain_nowww === "omnycontent.com") {
			// thanks to fireattack on github: https://github.com/qsniyg/maxurl/issues/386
			// https://omny.fm/shows/douse/ep-153/image.jpg?t=1596591781&size=Small -- 256x256
			//   https://omny.fm/shows/douse/ep-153/image.jpg?t=1596591781 -- 1080x1080
			//   https://omny.fm/shows/douse/ep-153/image.jpg?t=1596591781&size=Original -- 1080x1080
			// https://omny.fm/shows/the-kieno-kammies-show/saa-to-appoint-ceo-by-end-march/image.jpg?t=1490334380&size=Large -- 2048x2048, upscaled
			//   https://omny.fm/shows/the-kieno-kammies-show/saa-to-appoint-ceo-by-end-march/image.jpg?t=1490334380&size=Original -- 150x200
			// https://omny.fm/shows/am640-the-morning-show/image.jpg?t=1544205962 -- 3000x3000
			return src.replace(/([?&]size=)[^&]+/, "$1Original");
		}

		if (domain === "st.pussyspace.com") {
			// https://st.pussyspace.com/style/01/img/bg.png
			if (/\/style\/+[0-9]+\/+img\/+bg\./.test(src))
				return {
					url: src,
					bad: "mask"
				};
		}

		if (domain_nowww === "pussyspace.com") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+vid-([0-9]+)/,
				query_for_id: "https://www.pussyspace.com/vid-${id}",
				process: function(done, resp, cache_key) {
					var unpacked = common_functions["unpack_packer"](resp.responseText);
					if (!unpacked) {
						console_error(cache_key, "Unable to find packed data for", resp);
						return done(null, false);
					}

					var query_pussyspace = function(id, endpoint, cb) {
						var cache_key = "pussyspace:" + endpoint + ":" + id;
						api_query(cache_key, {
							url: "https://www.pussyspace.com/get/player/" + endpoint + "/",
							method: "POST",
							headers: {
								Accept: "*/*",
								"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
								Origin: "https://www.pussyspace.com",
								Referer: resp.finalUrl,
								"X-Requested-With": "XMLHttpRequest"
							},
							data: "id=" + id
						}, cb, function(done, resp, cache_key) {
							var match = resp.responseText.match(/pipi\['file'\]\s*=\s*'(https?%3A[^']+)';/);
							if (!match) {
								console_error(cache_key, "Unable to find match for", resp);
								return done(null, false);
							}

							return done(decodeURIComponent(match[1]), 60*60);
						});
					};

					var match = unpacked.match(/multiShowPlayer\('([^']+)','([^']+)'\);/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", {resp: resp, unpacked: unpacked});
						return done(null, false);
					}

					query_pussyspace(match[1], match[2], function(url) {
						if (!url) {
							return done(null, false);
						}

						return done({
							url: url,
							extra: {
								page: resp.finalUrl
							}
						});
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "unselfishporn.com") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+player\/+([0-9]+)\/+/,
				query_for_id: "http://www.unselfishporn.com/player/${id}/a/",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/var url_encoded\s*=\s*'([^']+)';/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					return done({
						url: base64_decode(match[1]),
						is_pagelink: true
					}, 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "pic.unselfishporn.com") {
			// http://pic.unselfishporn.com/thumbs/r/rsg/671783.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+thumbs\/+.\/+.{3}\/+([0-9]+)\.[^/.]+(?:[?#].*)?$/, "https://www.unselfishporn.com/player/$1/a/");
			if (newsrc !== src) {
				return {
					url: newsrc,
					is_pagelink: true
				};
			}
		}

		if (domain_nosub === "tgstat.ru" && /^static[0-9]*\./.test(domain)) {
			// https://static10.tgstat.ru/channels/_100/14/1419befbfcf2b239e3bde2f144e0d707.jpg
			//   https://static10.tgstat.ru/channels/_0/14/1419befbfcf2b239e3bde2f144e0d707.jpg
			return src.replace(/\/channels\/+_[0-9]+\//, "/channels/_0/");
		}

		if (domain === "fhg.houseoftaboo.com" ||
			// http://fhg.handsonhardcore.com/tpls/fhg3/images/show.png
			domain === "fhg.handsonhardcore.com" ||
			// http://fhg.1by-day.com/tpls/fhg3/images/show.png
			domain === "fhg.1by-day.com") {
			// http://fhg.houseoftaboo.com/tpls/fhg3/images/show.png
			if (/\/images\/+show\.png(?:[?#].*)?$/.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}
		}

		if (domain_nosub === "shbdn.com" && /^s[0-9]*\./.test(domain)) {
			// thanks to esdemirei on reddit for reporting: https://www.reddit.com/r/MaxImage/comments/i6uriw/suggestion/
			// https://s0.shbdn.com/assets/images/right-arrow:[hex].png
			if (/\/assets\/+images\/+[a-z]+-arrow:[0-9a-f]{10,}\./.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}
		}

		if (domain_nosub === "shbdn.com" && /^i[0-9]*\./.test(domain)) {
			// https://i0.shbdn.com/photos/65/48/13/837654813rm5.jpg -- watermark
			//   https://i0.shbdn.com/photos/65/48/13/x16_837654813rm5.jpg -- watermark
			// https://i0.shbdn.com/photos/65/48/13/x16_83765481330w.jpg -- 1600x1200
			// https://i0.shbdn.com/photos/65/48/13/x16_837654813rir.jpg -- 900x1200
			// https://i0.shbdn.com/photos/65/48/13/x16_837654813src.jpg -- 1600x1079
			// https://i0.shbdn.com/photos/58/72/35/x5_838587235pm5.jpg -- 528x396
			//   https://i0.shbdn.com/photos/58/72/35/big_838587235pm5.jpg -- 800x600, not upscaled
			//   x16 doesn't work
			match = src.match(/^([a-z]+:\/\/[^/]+\/+photos\/+(?:[0-9]{2}\/+){3})(?:[a-z0-9]+_)?([0-9]{4,}[a-z0-9]{3}\.[^/.]+)(?:[?#].*)?$/);
			if (match) {
				return replace_sizes(src, [
					{url: match[1] + "x16_" + match[2], problems: {watermark: true, possibly_upscaled: true}},
					{url: match[1] + "big_" + match[2], problems: {watermark: true, possibly_upscaled: true}},
					{url: match[1] + "x5_" + match[2], problems: {watermark: true, possibly_upscaled: true}},
					{url: match[1] + match[2], problems: {watermark: true}},
					{url: match[1] + "lthmb_" + match[2], problems: {smaller: true}},
					{url: match[1] + "thmb_" + match[2], problems: {smaller: true}}
				]);
			}
		}

		if (amazon_container === "orebtvnsretjvneokqmefoiunm") {
			// https://orebtvnsretjvneokqmefoiunm.s3.amazonaws.com/uploads/img-tiny/community-featured-mask-v2-114d76.png
			// https://orebtvnsretjvneokqmefoiunm.s3.amazonaws.com/uploads/img/60prc/community-article-mask-v2-3940f5.png
			if (/\/uploads\/+img(?:-[a-z]+)?\/+(?:[0-9]+prc\/+)?community-(?:featured|article)-mask-v2/.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}

			// https://orebtvnsretjvneokqmefoiunm.s3.amazonaws.com/uploads/img/40prc/image07-1f92bf.jpg
			//   https://orebtvnsretjvneokqmefoiunm.s3.amazonaws.com/uploads/img/image07-1f92bf.jpg
			// https://orebtvnsretjvneokqmefoiunm.s3.amazonaws.com/uploads/img-tiny/aurora-interior-small-dc18c1.png
			//   https://orebtvnsretjvneokqmefoiunm.s3.amazonaws.com/uploads/img/aurora-interior-small-dc18c1.png
			newsrc = src.replace(/(\/uploads\/+img)(?:-[a-z]+)?\/+(?:[0-9]+prc\/+)?/, "$1/");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nowww === "asiansister.com") {
			// thanks to Urkchar on discord
			// https://asiansister.com/images/items/67/2011_0_svPZVtOlE0n9BUIv3Mo2_t.jpg
			//   https://asiansister.com/images/items/67/2011_0_svPZVtOlE0n9BUIv3Mo2.jpg
			obj = {
				extra: {}
			};

			match = src.match(/\/images\/+items\/+[0-9]+\/+([0-9]+)_([0-9]+)_[^/]+$/);
			if (match) {
				obj.extra.page = "https://asiansister.com/viewImg.php?code=" + match[1] + "&id=" + match[2];
			}

			var urls = [src];
			newsrc = src.replace(/(\/images\/+items\/+[0-9]+\/+[0-9]+_[0-9]+_[0-9a-zA-Z]+)_t(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
			if (newsrc !== src)
				urls = add_extensions(newsrc);

			return fillobj_urls(urls, obj);
		}

		if (host_domain_nosub === "sankakucomplex.com" && options.element) {
			var el = common_functions["get_link_el_matching"](options.element, function(el) {
				// thanks to Rainy on discord for reporting:
				// https://chan.sankakucomplex.com/es/post/show/22773670
				// https://chan.sankakucomplex.com/post/show/22773670
				if (/:\/\/[^/]+\/+(?:[a-z]+\/+)?post(?:\/+show|s)\/+[0-9a-f]+(?:[?#].*)?$/.test(el.href)) {
					return true;
				}
			});

			if (el && el.href !== src) {
				return {
					url: el.href,
					is_pagelink: true
				};
			}

			// return full version for sample images
			if (/\/data\/+sample\//.test(src) && options.element.tagName === "IMG") {
				el = common_functions["get_link_el_matching"](options.element, function(el) {
					if (/^(?:[a-z]+:)?\/\/[^/]+\/+data\/+[0-9a-f]{2}\/+/.test(el.href)) {
						return true;
					}
				});

				if (el) {
					return el.href;
				}
			}
		}

		if (domain === "is.sankakucomplex.com" ||
			domain === "s.sankakucomplex.com" ||
			domain === "v.sankakucomplex.com") {
			let base = {
				url: src,
				headers: {
					Referer: "https://www.sankakucomplex.com/" // or ""
				}
			};

			match = src.match(/\/data\/+(?:preview|sample)\/+[0-9a-f]{2}\/+[0-9a-f]{2}\/+([0-9a-f]{10,})\./);
			if (match) {
				return [
					{
						url: "https://chan.sankakucomplex.com/posts/" + match[1],
						is_pagelink: true
					},
					base
				];
			} else {
				return base;
			}
		}

		if (domain_nosub === "sankakucomplex.com") {
			newsrc = website_query({
				website_regex: /^([a-z]+:\/\/[^/]+\/+(?:[a-z]+\/+)?post(?:\/+show|s)\/+[0-9a-f]+)(?:[?#].)?$/,
				query_for_id: "${id}",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/<a id=image-link class=sample href="(\/\/(?:[^/]+\.)?sankakucomplex\.com\/[^"]+)"/);
					if (!match) {
						match = resp.responseText.match(/<video id=image (?:(?:width|height)=[0-9]+\s+){0,}src="(\/\/(?:[^/]+\.)?sankakucomplex\.com\/[^"]+)"/);
					}
					if (!match) {
						match = resp.responseText.match(/<a id=image-link class=full>\s*<img[^>]+ src="(\/\/(?:[^/]+\.)?sankakucomplex\.com\/[^"]+)"/);
					}
					if (!match) {
						match = resp.responseText.match(/<a href="(\/\/(?:[^/]+\.)?sankakucomplex\.com\/[^"]+)" id=highres itemprop=contentUrl/);
					}
					if (!match) {
						match = resp.responseText.match(/<a id="highres" itemprop="contentUrl"[^>]* href="(\/\/(?:[^/]+\.)?sankakucomplex\.com\/[^"]+)"/);
					}

					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					var newsrc = urljoin(resp.finalUrl, decode_entities(match[1]), true);
					done({
						url: newsrc,
						extra: {
							page: resp.finalUrl
						},
						headers: {
							Referer: resp.finalUrl
						}
					}, 60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "vid.dobbyporn.com") {
			// http://vid.dobbyporn.com/s/thumbs/d/djp/31228046.jpg
			newsrc = src.replace(/:\/\/[^/]+\/+s\/+thumbs\/+[^/]\/+[^/]{3}\/+([0-9]+)\.[^/.]+(?:[?#].*)?$/, "://dobbyporn.com/video/$1.html");
			if (newsrc)
				return {
					url: newsrc,
					is_pagelink: true
				};
		}

		if (domain_nowww === "dobbyporn.com" ||
			domain_nowww === "colliderporn.com") {
			// http://dobbyporn.com/video/31228046.html -> http://dobbyporn.com/best/shoes/?video=31228046
			newsrc = src.replace(/^([a-z]+:\/\/[^/]+\/+)video\/+([0-9]+)\.html(?:[?&#].*)?$/, "$1best/babe/?video=$2");
			if (false && newsrc !== src) {
				return {
					url: newsrc,
					is_pagelink: true
				};
			}

			match = src.match(/^([a-z]+:\/\/[^/]+\/+video\/+[0-9]+\.html)(?:[?&#].*)?$/);
			if (false && match && !/[?&]rand=/.test(src)) {
				return {
					url: src.replace(/(\.html)(?:[?#].*)?$/, "$1&rand=" + get_random_text(10)),
					is_pagelink: true
				};
			}

			newsrc = website_query({
				website_regex: [
					/^([a-z]+:\/\/[^/]+\/+v\/+[0-9]+\.html)(?:[?#].*)?$/,
					/^([a-z]+:\/\/[^/]+\/+video\/+[0-9]+\.html(?:[?&#].*)?)$/
				],
				query_for_id: function(id) {
					return {
						url: id,
						imu_mode: "document",
						headers: {
							Referer: id
						}
					};
				},
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/window\.open\("\/video\/[0-9]+\.html&rand=/);
					// it needs to be queried twice
					if (match && !/&rand=/.test(resp.finalUrl)) {
						return done({
							url: resp.finalUrl + "&rand=" + get_random_text(10),
							is_pagelink: true
						}, false);
					}

					match = resp.responseText.match(/window\.location\.href = "(\/[^"]+\?video=[0-9]+)";/);
					if (!match) {
						console_error(cache_key, "Unable to find redirect match for", resp);
						return done(null, false);
					}

					return done({
						url: urljoin(resp.finalUrl, match[1], true),
						is_pagelink: true
					}, 60);
				}
			});
			if (newsrc) return newsrc;

			newsrc = website_query({
				website_regex: [
					/^([a-z]+:\/\/[^/]+\/+[a-z]+\/+[a-z]+\/+\?(?:.*&)?video=[0-9]+.*?)$/
				],
				query_for_id: function(id) {
					return {
						url: id,
						imu_mode: "document",
						headers: {
							Referer: id
						}
					};
				},
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/<iframe id="extvidx" src="(?:javascript:window\.location\.replace\(')?(https?:\/\/[^"']+)(?:'\))?"/);
					if (!match) {
						console_error(cache_key, "Unable to find iframe match for", resp);
						return done(null, false);
					}

					return done({
						url: decode_entities(match[1]),
						is_pagelink: true
					}, 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "freedroid.org") {
			// https://www.freedroid.org/images/screenshots/underground.thumb_default_w320h180q85.png
			//   https://www.freedroid.org/images/screenshots/underground.png
			return src.replace(/(\/images\/+screenshots\/+[^/]+)\.thumb_default_(?:[whq][0-9]+){1,}\./, "$1.");
		}

		if (domain === "shop.new-art.nl") {
			// thanks to anonyno on github: https://github.com/qsniyg/maxurl/issues/390
			// https://shop.new-art.nl/assets/image.php?width=800&image=/content/img/new_products_queue/1581692709.jpg
			//   https://shop.new-art.nl/content/img/new_products_queue/1581692709.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+assets\/+image\.php\?(?:.*&)?image=([^&]+)(?:[&#].*)?$/, "$1");
			if (newsrc !== src) {
				return urljoin("https://shop.new-art.nl/", decodeURIComponent(newsrc), false);
			}
		}

		if (domain_nowww === "asianpussy.fun" ||
			domain_nowww === "teencumpot.com" ||
			domain_nowww === "babesxcam.com" ||
			domain_nowww === "collegehdsex.com" ||
			domain_nowww === "18girlssex.com" ||
			domain_nowww === "xxx-hd-tube.com" ||
			domain_nowww === "nakedteens.fun" ||
			domain_nowww === "xxx-porn.video" ||
			domain_nowww === "asianporn.life" ||
			domain_nowww === "teenporn19.com") {
			// https://18girlssex.com/d/[...]_gs.png
			if (/^[a-z]+:\/\/[^/]+\/+d\/+[0-9a-z]{8}_gs\.png(?:[?#].*)?$/.test(src))
				return {
					url: src,
					bad: "mask"
				};

			// https://asianpussy.fun/flplayer.php?id=293498
			newsrc = website_query({
				website_regex: /^([a-z]+:\/\/[^/]+\/+flplayer\.php\?id=[0-9]+)/,
				query_for_id: function(id) {
					return {
						url: id,
						headers: {
							"Sec-Fetch-Dest": "iframe",
							"Sec-Fetch-Mode": "navigate",
							"Sec-Fetch-Site": "cross-site",
							"Referer": "https://" + domain + "/"
						}
					};
				},
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/document\.write\(atob\(atob\("([^"]+)"\)\)\);/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					var decoded = base64_decode(base64_decode(match[1]));
					match = decoded.match(/<source src="([^"]+)" type="([^"]+)"/);
					if (!match) {
						console_error("Unable to find source match from", {resp: resp, decoded: decoded});
						return done(null, false);
					}

					var video;
					if (match[2] === "video/mp4") {
						video = true;
					} else if (match[2] === "application/x-mpegURL") {
						video = "hls";
					} else {
						console_error("Unknown video type", {resp: resp, decoded: decoded, match: match});
						return done(null, false);
					}

					return done({
						url: match[1],
						video: video
					}, 60*60);
				}
			});
			if (newsrc) return newsrc;

			// https://asianpussy.fun/gallery/malayalam-kambikatha-peculiarity-pottikkal-narrated.html
			newsrc = website_query({
				website_regex: /^([a-z]+:\/\/[^/]+\/+(?:gallery|teen(?:video)?s|(?:hd)?videos?)\/+[^/.]*(?:\/+index)?\.html)(?:[?#].*)?$/,
				query_for_id: "${id}",
				process: function(done, resp, cache_key) {
					// contentId is used in teencumpot
					var match = resp.responseText.match(/document\.write\(atob\([^)]+\)\.replace\('#+',\s*(?:'([0-9]+)'|(contentId))\)/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					var content_id = match[1];
					if (!content_id && match[2]) {
						var varname = match[2];
						match = resp.responseText.match(new RegExp("var " + varname + " = ([0-9]+);"));
						if (!match) {
							console_error(cache_key, "Unable to find varname match for", {resp: resp, varname: varname});
							return done(null, false);
						}

						content_id = match[1];
					}

					var subdomain = domain;
					if (domain_nosub === "teenporn19.com" ||
						domain_nosub === "18girlssex.com" ||
						domain_nosub === "xxx-hd-tube.com" ||
						domain_nosub === "collegehdsex.com") {
						subdomain = "teencumpot.com";
					}

					return done({
						url: "https://" + subdomain + "/flplayer.php?id=" + content_id,
						is_pagelink: true
					}, 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "cdn.photos.sparkplatform.com") {
			// https://cdn.photos.sparkplatform.com/cbr/20200812210527098392000000.jpg
			//   https://cdn.photos.sparkplatform.com/cbr/20200812210527098392000000-t.jpg
			//   https://cdn.photos.sparkplatform.com/cbr/20200812210527098392000000-o.jpg
			return src.replace(/(\/cbr\/+[0-9]{10,})(?:-t)?(\.[^/.]+)(?:[?#].*)?$/, "$1-o$2");
		}

		if (domain === "cdn.resize.sparkplatform.com") {
			// https://cdn.resize.sparkplatform.com/cbr/1280x1024/true/20200812210527098392000000-o.jpg
			//   https://cdn.photos.sparkplatform.com/cbr/20200812210527098392000000-o.jpg
			return src.replace(/:\/\/[^/]+\/+cbr\/+[0-9]+x[0-9]+\/+[a-z]+\/+([0-9]{10,}(?:-[a-z])?\.[^/.]+)(?:[?#].*)?$/, "://cdn.photos.sparkplatform.com/cbr/$1");
		}

		if (domain_nowww === "jetphotos.com") {
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/396
			// https://www.jetphotos.com/api/json/heroimg.php?src=https://cdn.jetphotos.com/full/5/74588_1596711927.jpg&width=882
			//   https://cdn.jetphotos.com/full/5/74588_1596711927.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+api\/+json\/+heroimg\.php\?(?:.*&)?src=([^&]+).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "cdn.jetphotos.com") {
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/396
			// https://cdn.jetphotos.com/400/1/56183_1200233430.jpg
			//   https://cdn.jetphotos.com/full/1/56183_1200233430.jpg
			// https://cdn.jetphotos.com/400/6/72480_1565399439.jpg
			//   https://cdn.jetphotos.com/full/6/72480_1565399439.jpg
			return src.replace(/(:\/\/[^/]+\/+)[0-9]+(\/+[0-9]+\/+[0-9]+_[0-9]+\.[^/.]+)(?:[?#].*)?$/, "$1full$2");
		}

		if (domain === "cdn.airplane-pictures.net") {
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/396
			// https://cdn.airplane-pictures.net/images/uploaded-images/2020/7/2/1322296mm.jpg
			//   https://cdn.airplane-pictures.net/images/uploaded-images/2020/7/2/1322296.jpg
			// https://cdn.airplane-pictures.net/images/uploaded-images/2020/7/27/1328206m.jpg
			//   https://cdn.airplane-pictures.net/images/uploaded-images/2020/7/27/1328206.jpg
			// https://cdn.airplane-pictures.net/images/uploaded-images/2020/8/9/1331456s.jpg
			//   https://cdn.airplane-pictures.net/images/uploaded-images/2020/8/9/1331456.jpg
			return src.replace(/(\/images\/+uploaded-images\/+[0-9]{4}\/+(?:[0-9]{1,2}\/+){2}[0-9]+)[ms]+(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "airteamimages.com") {
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/396
			// https://www.airteamimages.com/pics/366/366481_200.jpg
			//   https://www.airteamimages.com/pics/366/366481_big.jpg
			// https://www.airteamimages.com/pics/366/366353_800.jpg
			//   https://www.airteamimages.com/pics/366/366353_big.jpg
			return src.replace(/(\/pics\/+[0-9]+\/+[0-9]+)_[0-9]+(\.[^/.]+)(?:[?#].*)?$/, "$1_big$2");
		}

		if (domain === "freighter.flyteam.jp") {
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/396
			// https://freighter.flyteam.jp/photo/3124509/260x260.jpg
			//   https://freighter.flyteam.jp/photo/3124509/960x960.jpg
			//   https://freighter.flyteam.jp/photo/3124509/src.jpg
			// https://freighter.flyteam.jp/newsphoto/39129/w1200.jpg
			//   https://freighter.flyteam.jp/newsphoto/39129/src.jpg
			return src.replace(/(\/(?:news)?photo\/+[0-9]+\/+)(?:[0-9]+x[0-9]+|[wh][0-9]+)(\.[^/.]+)(?:[?#].*)?$/, "$1src$2");
		}

		if (domain_nowww === "game-ost.com") {
			// https://www.game-ost.com/static/covers_soundtracks/1/6/16383_444203_small.jpg
			//   https://www.game-ost.com/static/covers_soundtracks/1/6/16383_444203_thumb.jpg
			//   https://www.game-ost.com/static/covers_soundtracks/1/6/16383_444203_medium.jpg
			//   https://www.game-ost.com/static/covers_soundtracks/1/6/16383_444203.jpg
			return src.replace(/(\/static\/+[^/]+\/+[0-9]\/+[0-9]\/+[0-9]+_[0-9]+)_(?:thumb|small|medium)(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "imgdist.net") {
			// https://imgdist.net/p/w300/673/ab6/940/69c9bdb57b99494695ae24c.jpg
			//   https://imgdist.net/p/1280/673/ab6/940/69c9bdb57b99494695ae24c.jpg
			return src.replace(/(\/p\/+)w300\/+/, "$11280/");
		}

		if (domain_nowww === "gamersgallery.com") {
			// https://gamersgallery.com/gallery/showphoto.php/photo/44381/size/big/cat/
			// https://gamersgallery.com/gallery/data/6071/thumbs/wallpaper2lg.jpg
			//   https://gamersgallery.com/gallery/data/6071/wallpaper2lg.jpg
			//   https://gamersgallery.com/gallery/watermark.php?file=44381
			return src.replace(/(\/gallery\/+data\/+[0-9]+\/+)thumbs\/+/, "$1");
		}

		if (domain_nowww === "defunctgames.com") {
			// http://www.defunctgames.com/includes/shows/reviewimage.php?i=/pic/reviewpics/reviewc1477-2.jpg&w=175&h=131
			//   http://www.defunctgames.com/pic/reviewpics/reviewc1477-2.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+includes\/+shows\/+reviewimage\.php\?(?:.*&)?i=([^&]+)(?:[&#].*)?$/, "$1");
			if (newsrc !== src)
				return urljoin(src, decodeURIComponent(newsrc), true);
		}

		if (domain === "forum.donanimhaber.com") {
			// thanks to esdemirei on reddit: https://www.reddit.com/r/MaxImage/comments/ihfe5x/suggestion/
			// https://forum.donanimhaber.com/cache-v2/?path=http%3a%2f%2fstore.donanimhaber.com%2f10%2fa3%2f6f%2f10a36f8023decd4b1dedb1af7f76a1da.jpeg&t=145239983&width=240&text=1
			//   https://store.donanimhaber.com/10/a3/6f/10a36f8023decd4b1dedb1af7f76a1da.jpeg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+cache-v2\/+\?(?:.*&)?path=([^&]+)(?:[&#].*)?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "static-cdn.qmov.com") {
			// https://static-cdn.qmov.com/content/movies/this-is-a-true-deep-anal-romance/photos_thumbs/this-is-a-true-deep-anal-romance_pic2.jpg
			//   https://static-cdn.qmov.com/content/movies/this-is-a-true-deep-anal-romance/photos/this-is-a-true-deep-anal-romance_pic2.jpg
			return src.replace(/\/photos_thumbs\//, "/photos/");
		}

		if (domain === "m.sprashivalka.com") {
			// https://m.sprashivalka.com/128x128/136/5c4/21d/8b967.jpg
			//   https://m.sprashivalka.com/orig/136/5c4/21d/8b967.jpg
			return src.replace(/(:\/\/[^/]+\/+)[0-9]+x[0-9]+(\/+(?:[0-9a-f]{3}\/+){3})/, "$1orig$2");
		}

		if (domain_nowww === "babesjoy.com") {
			// http://www.babesjoy.com/galleries/metart-x/thumbs/kay-j-by-alex-lynn-in-quiet-passion-1/1th.jpg
			//   http://www.babesjoy.com/galleries/metart-x/thumbs/kay-j-by-alex-lynn-in-quiet-passion-1/1.jpg
			return src.replace(/(\/galleries\/+[^/]+\/+thumbs\/+[^/]+\/+[0-9]+)th(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "izlesene.com") {
			// https://www.izlesene.com/video/irem-derici-yazsin-bana/10473966
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+video\/+(?:[^/]+\/+)?([0-9]+).*$/,
				query_for_id: "https://www.izlesene.com/video/${id}",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/window\._videoObj = ({.*});/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					var json = JSON_parse(match[1]);
					var levels = json.media.level;
					levels.sort(function(a, b) {
						return parseInt(b.value) - parseInt(a.value);
					});

					var obj = {
						extra: {}
					};

					if (json.videoTitle)
						obj.extra.caption = json.videoTitle;

					if (json.videoPageURL)
						obj.extra.page = json.videoPageURL;

					var urls = [];
					urls.push({
						url: levels[0].source,
						video: true,
						headers: {
							Referer: resp.finalUrl
						}
					});

					// todo: maybe use the /data/ rule below?
					if (false && json.posterURL)
						urls.push(json.posterURL);

					return done(fillobj_urls(urls, obj), 60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (false && domain_nosub === "imgiz.com" && /^i[0-9]*\./.test(domain)) {
			// https://i1.imgiz.com/ramazan/camiler/bayburt.jpg -- 3264x2448
			// https://i1.imgiz.com/data/videoshots/7164/7164388-91520.jpg -- 2730x1536
			// https://i1.imgiz.com/rshots/8444/dusbaz-yuregim-yanginlarda_8444102-27150_640x360.jpg -- /data/ works too, but removing _640x360 doesn't, even if text before id is removed
		}

		if (domain_nosub === "imgiz.com" && /^i[0-9]*\./.test(domain)) {
			// https://i1.imgiz.com/rshots/8444/dusbaz-yuregim-yanginlarda_8444102-27150_640x360.jpg
			//   https://i1.imgiz.com/data/videoshots/8444/8444102-27150.jpg
			// https://i1.imgiz.com/rshots/10470/serdar-ortac-biz-istemezsek_10470082-1330_100x62.jpg

			newsrc = src.replace(/\/rshots\/+([0-9]+)\/+[^/]+_([0-9]+-[0-9]+)_[0-9]+x[0-9]+(\.[^/.]+)(?:[?#].*)?$/, "/data/videoshots/$1/$2$3");
			if (newsrc !== src)
				return newsrc;

			match = src.match(/\/rshots\/+[0-9]+\/+[^/]+_([0-9]+)-[0-9]+_[0-9]+x[0-9]+\.[^/.]+(?:[?#].*)?$/);
			if (!match)
				match = src.match(/\/data\/+videoshots\/+[0-9]+\/+([0-9]+)-[0-9]+\.[^/.]+(?:[?#].*)?$/);
			if (match) {
				return {
					url: "https://www.izlesene.com/video/" + match[1],
					is_pagelink: true
				};
			}
		}

		if (domain === "cloudimagesstg.storyfire.com") {
			// https://cloudimagesstg.storyfire.com/?url=https%3A%2F%2Fweb-stories.s3.us-west-2.amazonaws.com%2F1C8p44rA7NWFX680vxDxi1PWRY83%2F5f499c8cd0c16b81b4346ef1%2FstoryImage_4f4b1d9b-00b9-4144-87fb-ee5063709799.jpg&type=webp&height=322
			//   https://web-stories.s3.us-west-2.amazonaws.com/1C8p44rA7NWFX680vxDxi1PWRY83/5f499c8cd0c16b81b4346ef1/storyImage_4f4b1d9b-00b9-4144-87fb-ee5063709799.jpg
			//   https://storyfire.com/video-details/5f499c8cd0c16b81b4346ef1
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+\?(?:.*&)?url=([^&]+).*/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "s.ecrater.com") {
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/428
			// https://s.ecrater.com/stores/50746/50e104b29b24b_50746f.jpg
			//   https://s.ecrater.com/stores/50746/50e104b29b24b_50746b.jpg -- 1123x1500
			// https://s.ecrater.com/stores/403772/5a02f8870538a_403772s.jpg
			//   https://s.ecrater.com/stores/403772/5a02f8870538a_403772b.jpg -- 920x1280
			// other:
			// https://s.ecrater.com/stores/50746/47af50b4789de_50746.jpg
			//   https://s.ecrater.com/stores/50746/47af4f97172b4_50746b.jpg
			return src.replace(/(\/stores\/+[0-9]+\/+[0-9a-f]{5,}_[0-9]+)[a-z](\.[^/.]+)(?:[?#].*)?$/, "$1b$2");
		}

		if (host_domain_nowww === "discogs.com" && options.element) {
			// some urls:
			// https://discogs-images.imgix.net/R-10588166-1500550892-3224.jpeg?auto=compress&blur=0&fit=max&fm=jpg&h=480&q=90&w=480&s=51d210de6d73b770a2e43b31a167d91c -- doesn't exist anymore
			// https://discogslabs.imgix.net/gear/5af248f4c323b00027b53282.jpg?auto=compress%2Cformat&blur=0&dpr=2&fit=max&fm=jpg&h=265&w=265&s=3a6b252d9ca50f13300ff5838c40eb2c -- still works
			// https://discogs-images.discogs.com/R-6256808-1452276132-7922.jpeg?expiry=2021-02-17T18%3A41%3A19.792997&fit=contain&format=auto&height=100&quality=40&width=100&signature=SeWKxVZ%2BTP7JOXFzCCOTavo4ebOkTH0lNXwVeVnc93U%3D
			// https://discogs-images.s3.amazonaws.com/ exists, and is referenced by i.discogs.com (bucket=...)

			if (options.element.tagName === "IMG") {
				var current = options.element;
				while (current = current.parentElement) {
					if (current.tagName === "DIV" && current.hasAttribute("data-images")) {
						var images = JSON_parse(current.getAttribute("data-images"));
						var found_image = false;
						array_foreach(images, function(image) {
							if (!image.full) return;

							var full_basename = url_basename(image.full).replace(/\..*/, "");
							var src_basename = url_basename(src).replace(/\..*/, "");

							if (full_basename === src_basename) {
								found_image = image.full;
								return false;
							}
						});

						if (found_image && found_image !== src) return found_image;
					}
				}
			}
		}

		if (domain === "img.discogs.com") {
			// thanks to Gertcha on github: https://github.com/qsniyg/maxurl/issues/429
			// https://img.discogs.com/MjmbFRJJih89NH1vTPzlL4hV-8Q=/fit-in/600x600/filters:strip_icc():format(jpeg):mode_rgb():quality(90)/discogs-images/R-12801670-1542565929-6791.jpeg.jpg
			//   https://www.discogs.com/image/R-12801670-1542565929-6791.jpeg
			return src.replace(/^[a-z]+:\/\/[^/]+\/[^/]+=\/.*\/discogs-images\/([^/?#]+)\.[^/.]+(?:[?#].*)?$/, "https://www.discogs.com/image/$1");
		}

		if (domain === "i.discogs.com") {
			// thanks to PatPanacea on github: https://github.com/qsniyg/maxurl/issues/684
			// https://i.discogs.com/R-13554835-1556420557-2178.jpeg?bucket=discogs-images&expiry=1615299242411.438&fit=contain&format=auto&height=600&quality=90&width=600&signature=8Lx3HgK378Y0Kw5TP3GU5CzvRMlqPBk38HGhappLonI%3D
			return src.replace(/^[a-z]+:\/\/[^/]+\/+([-A-Z0-9]+\.[^/.?#]+)\?.*$/, "https://www.discogs.com/image/$1");
		}

		if (domain_nowww === "discogs.com" && options.do_request && options.cb) {
			match = src.match(/\/image\/+([AR])-([0-9]+)-/);
			if (match) {
				var type = match[1];
				if (type === "A") type = "artist";
				else if (type === "R") type = "release";

				var discogs_id = match[2];
				common_functions["query_discogs_images"](options, type, discogs_id, function(images) {
					if (!images || !images.length) return options.cb(null);

					var found_image = null;

					array_foreach(images, function(image) {
						var image_basename = url_basename(image).replace(/\..*/, "");
						var src_basename = url_basename(src).replace(/\..*/, "");

						if (image_basename === src_basename) {
							found_image = image;
							return false;
						}
					});

					if (!found_image) {
						console_warn("Unable to find image from", images);
						return options.cb(null);
					}

					return options.cb([
						// prefer the /image/ src, in case it ever works again
						// bug: without {url:}, it crashes for some reason. need to fix bigimage_recursive
						{url: src},
						{url: found_image}
					]);
				});

				return {
					waiting: true
				};
			}
		}

		if (domain === "geo-media.beatsource.com") {
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/439
			// https://geo-media.beatsource.com/image_size/500x500/8/c/6/8c608f85-4018-4657-91c6-8037169ec9b3.jpg
			//   https://geo-media.beatsource.com/8/c/6/8c608f85-4018-4657-91c6-8037169ec9b3.jpg -- 1400x1400
			// https://geo-media.beatsource.com/image_size/500x500/0/9/f/09f5cedc-496a-4058-a383-a7f6916fea3b.jpg
			//   https://geo-media.beatsource.com/0/9/f/09f5cedc-496a-4058-a383-a7f6916fea3b.jpg -- 1400x1400 (upscaled?)
			// https://geo-media.beatsource.com/image_size/500x500/f/9/5/f95bcc58-f2f3-4acb-959d-44caffa08444.jpg
			//   https://geo-media.beatsource.com/f/9/5/f95bcc58-f2f3-4acb-959d-44caffa08444.jpg -- 1400x1400
			// https://geo-media.beatsource.com/image_size/2160x864/4/8/6/486b594c-eb2d-4f64-980c-7bd53bd55c04.jpg
			//   https://geo-media.beatsource.com/4/8/6/486b594c-eb2d-4f64-980c-7bd53bd55c04.jpg -- 2160x864
			return src.replace(/\/image_size\/+[0-9]+x[0-9]+\/+/, "/");
		}

		if (domain_nowww === "meijer.com") {
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/439
			// https://www.meijer.com/content/dam/meijer/product/0007/04/7000/30/0007047000300_2_A1C1_0200.png
			//   https://www.meijer.com/content/dam/meijer/product/0007/04/7000/30/0007047000300_2_A1C1_1200.png
			// https://www.meijer.com/content/dam/meijer/product/0071/37/3301/85/0071373301850_4_A1C1_0600.png
			//   https://www.meijer.com/content/dam/meijer/product/0071/37/3301/85/0071373301850_4_A1C1_1200.png
			return src.replace(/(\/content\/+dam\/+[^/]+\/+product\/+.*?\/[0-9]+_[0-9]+_[0-9A-Z]+_)(?:0[0-9]{3}|11[0-9]{2})\./, "$11200.");
		}

		if (domain_nowww === "kroger.com") {
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/439
			// https://www.kroger.com/product/images/thumbnail/left/0003338320027
			//   https://www.kroger.com/product/images/xlarge/left/0003338320027
			// https://www.kroger.com/product/images/medium/front/0004900000044
			//   https://www.kroger.com/product/images/xlarge/front/0004900000044
			// https://www.kroger.com/product/images/small/back/0003800019904
			//   https://www.kroger.com/product/images/xlarge/back/0003800019904
			// https://www.kroger.com/product/images/large/right/0008768400095
			//   https://www.kroger.com/product/images/xlarge/right/0008768400095
			// xlarge doesn't upscale:
			// https://www.kroger.com/product/images/medium/front/0003338320027
			//   https://www.kroger.com/product/images/xlarge/front/0003338320027 -- same size
			return src.replace(/(\/product\/+images\/+)(?:thumbnail|medium|small|large)(\/+[a-z]+\/+[0-9]+)(?:[?#].*)?$/, "$1xlarge$2");
		}

		if (domain_nosub === "tn-cloud.net" && /^wpcdn\./.test(domain)) {
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/439
			// https://wpcdn.us-east-1.vip.tn-cloud.net/www.channel3000.com/content/uploads/2020/09/Drink-1024x576.jpg
			//   https://www.channel3000.com/content/uploads/2020/09/Drink-1024x576.jpg
			// https://wpcdn.us-midwest-1.vip.tn-cloud.net/www.9and10news.com/content/uploads/2020/07/BOAT-3-553x360.jpg
			//   https://www.9and10news.com/content/uploads/2020/07/BOAT-3-553x360.jpg
			// https://wpcdn.us-east-1.vip.tn-cloud.net/www.wbbjtv.com/content/uploads/2020/03/MGN_1280x960_00321B00-INZQY-1024x768.jpg
			//   https://www.wbbjtv.com/content/uploads/2020/03/MGN_1280x960_00321B00-INZQY-1024x768.jpg
			// https://wpcdn.us-east-1.vip.tn-cloud.net/www.kxly.com/content/uploads/2020/09/computer-keyboard-Cropped-1024x576-640x360.jpg
			//   https://www.kxly.com/content/uploads/2020/09/computer-keyboard-Cropped-1024x576-640x360.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+([^/]+\.[^/]+\/+content\/+uploads\/)/, "https://$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nowww === "imago-images.de" ||
			// thanks to anonymous for reporting:
			// https://cdn.imago-images.com/bild/st/0308184537/m.jpg
			//   https://cdn.imago-images.com/bild/st/0308184537/w.jpg
			domain === "cdn.imago-images.com") {
			// https://www.imago-images.de/st/0104162664
			// https://www.imago-images.de/bild/st/0104162664/l.jpg -- 128x192
			//   https://www.imago-images.de/bild/st/0104162664/s.jpg -- 280x420
			//   https://www.imago-images.de/bild/st/0104162664/w.jpg -- 667x1000 (h == w, m redirects to w)
			// https://www.imago-images.de/bild/st/0104175382/w.jpg -- 1000x667
			//   https://www.imago-images.de/bild/st/0104175382/h.jpg -- 1000x667

			match = src.match(/^[a-z]+:\/\/[^/]+\/+st\/+([0-9]+)(?:[?#].*)?$/);
			if (match) {
				return [
					"https://" + domain + "/bild/st/" + match[1] + "/s.jpg",
					{url: src, is_pagelink: true}
				];
			}

			// this intentionally excludes ?
			match = src.match(/^[a-z]+:\/\/[^/]+\/+bild\/+st\/+([0-9]+)\/+([slwmh])(\.[^/.?#]+)(?:#.*)?$/);
			if (match) {
				var prefix = "https://" + domain + "/bild/st/" + match[1] + "/";
				var ext = match[3];
				var oururl = prefix + match[2] + ext;
				var images = {
					smaller: [
						prefix + "s" + ext,
						prefix + "l" + ext
					],
					watermark: [
						prefix + "w" + ext,
						{url: prefix + "m" + ext, hidden: true},
						{url: prefix + "h" + ext, hidden: true}
					]
				};

				// todo: make generic for other sites like this
				var objs = {};
				for (var key in images) {
					var our_images = images[key];
					var our_obj = [];

					var problemobj = {};
					problemobj[key] = true;

					array_foreach(our_images, function(image, i) {
						if (typeof image === "string") {
							our_images[i] = {url: image};
							image = our_images[i];
						}

						if (image.url === oururl) {
							// add earlier urls as non-problematic
							for (var j = 0; j < i; j++) {
								if (!our_images[j].hidden)
									our_obj.push(our_images[j].url);
							}


							our_obj.push({
								url: our_images[i].url,
								problems: deepcopy(problemobj)
							});

							return false;
						}
					});

					if (our_obj.length === 0) {
						array_foreach(our_images, function(image) {
							if (!image.hidden) {
								our_obj.push({
									url: image.url,
									problems: deepcopy(problemobj)
								});

								return false;
							}
						});
					}

					objs[key] = our_obj;
				}

				var urls = [];
				array_extend(urls, objs.watermark);
				array_extend(urls, objs.smaller);

				let baseobj = {
					extra: {
						page: "https://www.imago-images.de/st/" + match[1]
					}
				};

				return fillobj_urls(urls, baseobj);
			}
		}

		if (domain_nowww === "banned.video" ||
			domain === "api.banned.video") {
			// this is copied from the website
			var getvideo_query = "query GetVideo($id: String!) {\n  getVideo(id: $id) {\n    ...DisplayVideoFields\n    streamUrl\n    directUrl\n    audio\n    unlisted\n    live\n    tags {\n      _id\n      name\n      __typename\n    }\n    sale {\n      _id\n      text\n      __typename\n    }\n    __typename\n  }\n}\n\nfragment DisplayVideoFields on Video {\n  _id\n  title\n  summary\n  playCount\n  largeImage\n  embedUrl\n  published\n  videoDuration\n  channel {\n    _id\n    title\n    avatar\n    __typename\n  }\n  createdAt\n  __typename\n}\n";
			var getvideo_opname = "GetVideo";

			var query_banned_graphql = function(opname, query, vars, cb) {
				api_query("banned_graphql:" + opname + ":" + JSON_stringify(vars), {
					method: "POST",
					url: "https://api.banned.video/graphql",
					imu_mode: "xhr",
					headers: {
						"Content-Type": "application/json",
						"Origin": "https://banned.video",
						"Referer": "https://banned.video/",
						"apollographql-client-name": "banned-web",
						"apollographql-client-version": "1.3"
					},
					json: true,
					data: JSON_stringify({
						operationName: opname,
						query: query,
						variables: vars
					})
				}, cb, function(done, resp) {
					done(resp, 60*60);
				});
			};

			newsrc = website_query({
				website_regex: [
					/^[a-z]+:\/\/[^/]+\/+watch\?(?:.*&)?id=([0-9a-f]{10,})/,
					/^[a-z]+:\/\/[^/]+\/+embed\/+([0-9a-f]{10,})(?:[?#].*)?$/
				],
				run: function(cb, match) {
					var id = match[1];

					query_banned_graphql(getvideo_opname, getvideo_query, {id: id}, function(data) {
						if (!data) {
							return cb(null);
						}

						data = data.data.getVideo;

						var urls = [];

						if (data.streamUrl) {
							urls.push({
								url: data.streamUrl,
								video: "hls"
							});
						}

						if (data.directUrl) {
							urls.push({
								url: data.directUrl,
								video: true
							});
						}

						if (data.largeImage) {
							urls.push({
								url: data.largeImage
							});
						}

						var baseobj = {
							extra: {}
						};

						if (data.title || data.summary) {
							baseobj.extra.caption = data.tile || data.summary
						}

						baseobj.extra.page = "https://banned.video/watch?id=" + id;

						return cb(fillobj_urls(urls, baseobj));
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "auntjudys.com") {
			// Thanks to an anonymous tip
			// https://www.auntjudys.com/tour/content//upload/a/and100/20191010001//thumbs/abc_4578.jpg -- 370x460
			//   https://www.auntjudys.com/tour/content//upload/a/and100/20191010001//fullwatermarked/abc_4578.jpg -- 4912x7360
			// https://auntjudys.com/content/r/reb033/20200319004/0.jpg
			//   https://auntjudys.com/content/r/reb033/20200319004/0-large.jpg
			return src
				.replace(/(\/tour\/+content\/+upload\/.*\/)thumbs\/+/, "$1fullwatermarked/")
				.replace(/(:\/\/[^/]+\/+content\/+[a-z]\/+[a-z]{3}[0-9]{3}\/+[0-9]+\/+[0-9]+)(\.[^/.]+)(?:[?#].*)?$/, "$1-large$2");
		}

		if (domain === "d2eehagpk5cl65.cloudfront.net" ||
			domain_nowww === "reason.com") {
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/445
			// https://d2eehagpk5cl65.cloudfront.net/img/c2400x1350-w2400-q60/uploads/2020/09/rtrltwelve189314-2400x1350.jpg
			//   https://d2eehagpk5cl65.cloudfront.net/wp-content/uploads/2020/09/rtrltwelve189314.jpg
			// https://d2eehagpk5cl65.cloudfront.net/img/c331x186-w331-q60/uploads/2020/09/reason-wolf-331x186.jpg
			//   https://d2eehagpk5cl65.cloudfront.net/wp-content/uploads/2020/09/reason-wolf.jpg
			// https://d2eehagpk5cl65.cloudfront.net/img/q60/uploads/2020/05/COVIDvaccineDreamstime-600x338.jpg
			//   https://d2eehagpk5cl65.cloudfront.net/wp-content/uploads/2020/05/COVIDvaccineDreamstime.jpg
			// thanks to roi:
			// https://d2eehagpk5cl65.cloudfront.net/img/c331x186-w331-q60/uploads/2023/03/Joe-Biden-3-14-23-Newscom-scaled-e1678835619284-331x186.jpg.webp
			//   https://d2eehagpk5cl65.cloudfront.net/wp-content/uploads/2023/03/Joe-Biden-3-14-23-Newscom-scaled-e1678835619284.jpg
			//   https://d2eehagpk5cl65.cloudfront.net/wp-content/uploads/2023/03/Joe-Biden-3-14-23-Newscom.jpg
			// d2eehagpk5cl65.cloudfront.net = reason.com
			newsrc = src
				.replace(/(:\/\/[^/]+\/+wp-content\/+uploads\/.*?\.jpe?g)\.webp(?:[?#].*)?$/i, "$1")
				.replace(/(:\/\/[^/]+\/+)img\/+(?:-?(?:c[0-9]+x[0-9]+|[whq][0-9]+))+\/+uploads\/+/, "$1wp-content/uploads/");
			// fall down to wordpress rule
			if (newsrc !== src)
				return newsrc;
		}

		if (amazon_container === "reasonmagazine-covers") {
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/445
			// https://reasonmagazine-covers.s3.amazonaws.com/2019-12-01_sm.jpg
			//   https://reasonmagazine-covers.s3.amazonaws.com/2019-12-01.jpg -- 2400x3150
			// https://reasonmagazine-covers.s3.amazonaws.com/2020-10-01_sm.jpg
			//   https://reasonmagazine-covers.s3.amazonaws.com/2020-10-01.jpg -- 2400x3150
			return src.replace(/(:\/\/[^/]+\/+[0-9]{4}-[0-9]{2}-[0-9]{2})_[a-z]+(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "d2d8wwwkmhfcva.cloudfront.net") {
			// instacart
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/445
			// some sort of thumbor modification, looks to be more trouble than it's worth to integrate it with the main thumbor rule
			// https://d2d8wwwkmhfcva.cloudfront.net/155x/filters:fill(FFF,true):format(jpg)/d2lnr5mha7bycj.cloudfront.net/product-image/file/large_e2b5f1e8-39c2-410a-a00c-84d9cb908f5b.jpeg
			//   https://d2lnr5mha7bycj.cloudfront.net/product-image/file/large_e2b5f1e8-39c2-410a-a00c-84d9cb908f5b.jpeg
			//   https://d2lnr5mha7bycj.cloudfront.net/product-image/file/e2b5f1e8-39c2-410a-a00c-84d9cb908f5b.jpeg
			// https://d2d8wwwkmhfcva.cloudfront.net/391x/d2lnr5mha7bycj.cloudfront.net/warehouse/background_image/299/fd799186-32d2-47d1-ac44-3e97093c1f79.jpg
			//   https://d2lnr5mha7bycj.cloudfront.net/warehouse/background_image/299/fd799186-32d2-47d1-ac44-3e97093c1f79.jpg
			// https://d2d8wwwkmhfcva.cloudfront.net/1920x/filters:quality(50)/d2lnr5mha7bycj.cloudfront.net/warehouse/background_image/57/97ed02ba-fabe-4b88-9682-c29262597f28.jpg
			//   https://d2lnr5mha7bycj.cloudfront.net/warehouse/background_image/57/97ed02ba-fabe-4b88-9682-c29262597f28.jpg
			return add_http(src.replace(/^[a-z]+:\/\/[^/]+\/+[0-9]+x[0-9]*\/+(?:filters:[^/]+\/+)?([^/]+\.[^/]+\/+)/, "$1"));
		}

		if (domain === "d2lnr5mha7bycj.cloudfront.net") {
			// instacart
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/445
			// https://d2lnr5mha7bycj.cloudfront.net/product-image/file/primary_f337ef80-c5a5-4698-bbbb-160ab6f1db7a.jpg
			//   https://d2lnr5mha7bycj.cloudfront.net/product-image/file/large_f337ef80-c5a5-4698-bbbb-160ab6f1db7a.jpg
			//   https://d2lnr5mha7bycj.cloudfront.net/product-image/file/f337ef80-c5a5-4698-bbbb-160ab6f1db7a.jpg
			newsrc = src.replace(/(\/product-image\/+file\/+)[a-z]+_/, "$1");
			// hack because of the previous rule returning http
			return force_https(newsrc);
		}

		if (domain_nowww === "hizliresim.com") {
			// thanks to esdemirei on reddit: https://www.reddit.com/r/MaxImage/comments/itfp91/suggestion/
			// https://hizliresim.com/yueXLm
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+([a-zA-Z]+)(?:[?#].*)?$/,
				query_for_id: "https://hizliresim.com/${id}",
				process: function(done, resp, cache_key) {
					var imagelink = resp.responseText.match(/<a class="fancybox"[\s\S]*?<img src="(https?:\/\/i\.hizliresim\.com\/[^"/]+\.[^/."]+)"/);
					if (!imagelink) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}
					imagelink = decode_entities(imagelink[1]);

					var obj = {
						url: imagelink,
						extra: {
							page: resp.finalUrl
						}
					};

					var caption = get_meta(resp.responseText, "description");
					if (caption)
						obj.extra.caption = caption;

					return done(obj, 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "eksisozluk.com" ||
			// https://eksisozluk1923.com/img/kdqxjmy6
			domain_nowww === "eksisozluk1923.com" ||
			// thanks to anonymous for reporting:
			// https://eksisozluk1999.com/img/dkvhydq4
			domain_nowww === "eksisozluk1999.com") {
			// thanks to esdemirei on reddit: https://www.reddit.com/r/MaxImage/comments/itfp91/suggestion/
			// https://eksisozluk.com/img/kdqxjmy6
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+img\/+([a-zA-Z0-9]+)(?:[?#].*)?$/,
				query_for_id: {
					url: "https://eksisozluk.com/img/${id}",
					non200_ok: true
				},
				process: function(done, resp, cache_key) {
					var imagelink = resp.responseText.match(/<a id="image-zoom"[^>]* href="(https?:\/\/cdn\.eksisozluk.com\/[^"]+)"/);
					if (!imagelink) {
						imagelink = get_meta(resp.responseText, "og:image");
						if (imagelink)
							imagelink = [null, imagelink]; // hack
					}
					if (!imagelink) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}
					imagelink = decode_entities(imagelink[1]);

					var obj = {
						url: imagelink,
						extra: {
							page: resp.finalUrl
						}
					};

					return done(obj, 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "soz.lk") {
			// https://soz.lk/i/kdqxjmy6
			match = src.match(/\/i\/+([0-9a-zA-Z]+)(?:[?#].*)?$/);
			if (match) {
				return {
					url: "https://eksisozluk1923.com/img/" + match[1],
					is_pagelink: true
				};
			}
		}

		if (domain_nowww === "feet9.com") {
			var parse_source_from_ciphered_json = function(CryptoJS, json) {
				var JsonFormatter = common_functions["get_jsonformatter_for_cryptojs"](CryptoJS);

				json = JSON_parse(json);
				json.ct = reverse_str(json.ct);
				var stringified = JSON_stringify(json);
				var source = JSON_parse(CryptoJS.AES.decrypt(stringified, "0x23", {
					'format': JsonFormatter
				}).toString(CryptoJS.enc.Utf8));

				return source;
			};

			var get_source_from_ciphered_json = function(cache_key, json, cb) {
				get_library("cryptojs_aes", options, options.do_request, function(CryptoJS) {
					if (!CryptoJS) {
						console_error(cache_key, "Unable to fetch CryptoJS");
						return cb(null);
					}

					var source;
					try {
						source = parse_source_from_ciphered_json(CryptoJS, json);
					} catch (e) {
						console_error(cache_key, e);
						return cb(null);
					}

					return cb(source);
				});
			};

			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+([0-9]+)(?:\/+(?:[^/]+\/*)?)?(?:[?#].*)?$/,
				query_for_id: "https://www.feet9.com/${id}",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/inivideo\('[0-9]+','({".*?"})',/);
					if (!match) {
						console_error(cache_key, "Unable to find inivideo match for", resp);
						return done(null, false);
					}

					var title = get_meta(resp.responseText, "og:title");

					get_source_from_ciphered_json(cache_key, match[1], function(source) {
						if (!source)
							return done(null, false);

						var obj = {
							url: source,
							extra: {
								page: resp.finalUrl
							},
							headers: {
								Accept: "*/*",
								Referer: "https://www." + domain_nosub + "/",
								"Sec-Fetch-Dest": "video",
								"Sec-Fetch-Mode": "no-cors",
								"Sec-Fetch-Site": "same-site"
							},
							video: true
						};

						if (title)
							obj.extra.caption = title;

						return done(obj, 60*60);
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "10363-2.s.cdn13.com") {
			match = src.match(/^[a-z]+:\/\/[^/]+\/+media\/+videos\/+tmb\/+((?:[0-9]+\/+){3})/);
			if (match) {
				id = match[1].replace(/\//g, "");
				return {url: "https://www.feet9.com/" + id, is_pagelink: true};
			}
		}

		if (domain_nowww === "absolugirl.com") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+video([0-9]*-[0-9a-zA-Z]+)\.html(?:[?#].*)?$/,
				query_for_id: "http://www.absolugirl.com/video${id}.html",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/<script[\s\S]+?servervideo = '([^']+)';\s*path = '([^']+)';\s*repp = codage\('([^']+)'\);\s*filee = '([^']+)';/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					var servervideo = match[1];
					var path = match[2];
					var repp = match[3];
					var filee = match[4];

					common_functions.get_md5(options, repp, function(repp) {
						if (!repp)
							return done(null, false);

						var obj = {
							url: servervideo + path + repp + filee,
							headers: {
								Referer: "http://www.absolugirl.com/"
							},
							video: true
						};

						return done(obj, 6*60*60);
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "api.tipeee.com") {
			// https://api.tipeee.com/cache/20200212132453/media/100/100/zoom/1630961/237ca4af27fe10e5685d45633c237fa51e7380dd.jpg
			//   https://api.tipeee.com/cache/20200212132453/media/1630961/237ca4af27fe10e5685d45633c237fa51e7380dd.jpg -- upscaled?
			return src.replace(/(\/cache\/+[0-9]+\/+media\/+)[0-9]+\/+[0-9]+\/+zoom\/+([0-9]+\/+[0-9a-f]{20,}\.)/, "$1$2");
		}

		if (amazon_container === "games.med") {
			// https://s3-eu-west-1.amazonaws.com/games.med/6566/74223-TombRaider.jpg
			//   https://s3-eu-west-1.amazonaws.com/games.snapshot/6566/74223-TombRaider.jpg
			// http://games.med.s3-eu-west-1.amazonaws.com/6566/74223-TombRaider.jpg
			//   http://games.snapshot.s3-eu-west-1.amazonaws.com/6566/74223-TombRaider.jpg
			return src.replace(/(:\/\/(?:[^/]+\/+)?)games\.med([/.])/, "$1games.snapshot$2");
		}

		if (domain_nosub === "appleinsider.com" && /^photos[0-9]*\./.test(domain)) {
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/447
			// https://photos5.appleinsider.com/gallery/37669-70867-not-ergonomic-pexels-s.jpg
			//   https://photos5.appleinsider.com/gallery/37669-70867-not-ergonomic-pexels-o.jpg
			// https://photos5.appleinsider.com/gallery/37771-71194-50066003407_6e30474576_k-m.jpg
			//   https://photos5.appleinsider.com/gallery/37771-71194-50066003407_6e30474576_k-o.jpg
			// https://photos5.appleinsider.com/gallery/37756-71156-200917-India-l.jpg
			//   https://photos5.appleinsider.com/gallery/37756-71156-200917-India-xl.jpg
			//   https://photos5.appleinsider.com/gallery/37756-71156-200917-India-o.jpg
			// https://photos5.appleinsider.com/gallery/26602-38131-apple-maps-sports-building-parking-xl.jpg
			//   https://photos5.appleinsider.com/gallery/26602-38131-apple-maps-sports-building-parking-o.jpg
			return src.replace(/(\/gallery\/+[0-9]+-[0-9]+-[^/]+)-(?:[sml]|xl)(\.[^/.]+)(?:[?#].*)?$/, "$1-o$2");
		}

		if (domain === "file.veryzhun.com") {
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/448
			// https://file.veryzhun.com/buckets/adsb-dm/keys/20190913-151152-ni4u68qrkgf3ic1j.jpg!600!480
			//   https://file.veryzhun.com/buckets/adsb-dm/keys/20190913-151152-ni4u68qrkgf3ic1j.jpg
			// https://file.veryzhun.com/buckets/adsb-dm/keys/20181219-213832-85035c1a49d88a527.JPG!400!300
			//   https://file.veryzhun.com/buckets/adsb-dm/keys/20181219-213832-85035c1a49d88a527.JPG
			// https://file.veryzhun.com/buckets/wxapp/keys/20181018-163004-e9c11x9dcs48onts.jpg!400!300
			//   https://file.veryzhun.com/buckets/wxapp/keys/20181018-163004-e9c11x9dcs48onts.jpg
			return src.replace(/(\/buckets\/+[^/]+\/+keys\/+[0-9]{8}-[0-9]+-[a-zA-Z0-9]+\.[^/.!?#]+)(?:[!?#].*)?$/, "$1");
		}

		if (domain === "attachments.f95zone.to") {
			// https://attachments.f95zone.to/2019/10/thumb/433195_wiab-01.gif
			//   https://attachments.f95zone.to/2019/10/433195_wiab-01.gif
			return src.replace(/(:\/\/[^/]+\/+[0-9]{4}\/+[0-9]{2}\/+)thumb\/+/, "$1");
		}

		if (domain === "coubsecure-s.akamaihd.net" ||
			// https://coub-attachments.akamaized.net/coub_storage/coub/simple/cw_image/8d4cf4af141/44ec9a423c8e47769a6bf/med_1677761814_00027.jpg
			domain === "coub-attachments.akamaized.net" ||
			// thanks to GoblinLegislator on github: https://github.com/qsniyg/maxurl/issues/653
			// https://coub-anubis-a.akamaized.net/coub_storage/coub/simple/cw_timeline_pic/e3605a26794/a3db5373a4aa697080b28/med_1494630110_image.jpg
			//   https://coub-anubis-a.akamaized.net/coub_storage/coub/simple/cw_timeline_pic/e3605a26794/a3db5373a4aa697080b28/1494630110_image.jpg
			domain === "coub-anubis-a.akamaized.net") {
			// https://coubsecure-s.akamaihd.net/get/b172/p/coub/simple/cw_timeline_pic/17b16f52a33/6c1b462c16515880e38f7/med_1497507210_image.jpg
			//   https://coubsecure-s.akamaihd.net/get/b172/p/coub/simple/cw_timeline_pic/17b16f52a33/6c1b462c16515880e38f7/1497507210_image.jpg
			// https://coubsecure-s.akamaihd.net/get/b154/p/channel/cw_avatar/b544dc94156/b059f02253677b1fcb5b0/profile_pic_new_1483487821_devushka-sci-fi-kostyum-gorod.jpg
			//   https://coubsecure-s.akamaihd.net/get/b154/p/channel/cw_avatar/b544dc94156/b059f02253677b1fcb5b0/1483487821_devushka-sci-fi-kostyum-gorod.jpg
			// https://coubsecure-s.akamaihd.net/get/b122/p/background/cw_banner_image/56450746aaf/17158e9712920bacd00cc/big_channel_1592499919_1xfy750_1585770187_00032.jpg
			//   https://coubsecure-s.akamaihd.net/get/b122/p/background/cw_banner_image/56450746aaf/17158e9712920bacd00cc/1592499919_1xfy750_1585770187_00032.jpg
			// https://coubsecure-s.akamaihd.net/get/b155/p/coub/simple/cw_image/07a039f24cc/847b9cef49a7c61176524/tiny_1600150101_00032.jpg
			//   https://coubsecure-s.akamaihd.net/get/b155/p/coub/simple/cw_image/07a039f24cc/847b9cef49a7c61176524/1600150101_00032.jpg
			return src.replace(/(\/cw_[^/]+\/+(?:[0-9a-f]{10,}\/+){1,2})(?:(?:[a-z]+|[0-9]+x)_){1,}([0-9]+_[^/]+)(?:[?#].*)?$/, "$1$2");
			//return src.replace(/\/[a-z]+_([0-9]+_image\.[^/.]*)$/, "/$1");
		}

		if (domain_nowww === "coub.com") {
			var query_coub_api = function(csrf, vid, cb) {
				api_query("coub_video:" + vid, {
					url: "https://coub.com/api/v2/coubs/" + vid,
					imu_mode: "xhr",
					headers: {
						Referer: "https://coub.com/view/" + vid,
						"X-Requested-With": "XMLHttpRequest",
						"X-CSRF-Token": csrf
					},
					json: true
				}, cb, function(done, resp, cache_key) {
					return done(resp, 60*60);
				});
			};

			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+view\/+([0-9a-z]+)(?:[?#].*)?$/,
				query_for_id: "https://coub.com/view/${id}",
				process: function(done, resp, cache_key, match) {
					var csrf_token = get_meta(resp.responseText, "csrf-token");
					if (!csrf_token) {
						console_error(cache_key, "Unable to get CSRF token from", resp);
						return done(null, false);
					}

					var vid = match[1];

					query_coub_api(csrf_token, vid, function(data) {
						if (!data)
							return done(null, false);

						//console_log(data);

						var obj = {
							extra: {
								page: "https://coub.com/view/" + vid,
								caption: data.title
							}
						};

						var urls = [];

						if (data.file_versions.share && data.file_versions.share.default)
							urls.push({
								url: data.file_versions.share.default,
								video: true
							});

						// todo: make larger
						if (data.picture)
							urls.push(data.picture);

						if (data.file_versions.html5) {
							var dash = {
								duration: data.duration,
								audios: [],
								videos: []
							};

							var versions = data.file_versions.html5;
							var formats = [];

							for (var key in versions.audio) {
								formats.push({
									bandwidth: versions.audio[key].size,
									url: versions.audio[key].url,
									type: "audio",
									id: "audio_" + key
								});
							}

							for (var key in versions.video) {
								formats.push({
									bandwidth: versions.video[key].size,
									url: versions.video[key].url,
									type: "video",
									id: "video_" + key
								});
							}

							// FIXME: This doesn't work for the popup, because shaka needs the sidx atom (https://github.com/shaka-project/shaka-player/issues/1088)
							// coub plays the audio file separately from the video, it may be longer or shorter. Both loop at different rates.
							common_functions["process_formats"](api_cache, options, formats, function() {
								array_foreach(formats, function(format) {
									if (format.type === "video") {
										dash.videos.push(format);
									} else if (format.type === "audio") {
										dash.audios.push(format);
									}
								});

								var dash_stream = common_functions["create_dash_stream"](dash);

								urls.unshift({
									url: "data:application/dash+xml," + encodeURIComponent(dash_stream),
									video: "dash"
								});

								return done(fillobj_urls(urls, obj), 60*60);
							});
						} else {
							return done(fillobj_urls(urls, obj), 60*60);
						}
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "18qt.com") {
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+go\/+\?(?:.*&)?url=([^&]+).*?$/, "$1");
			if (newsrc !== src)
				return {
					url: decodeURIComponent(newsrc),
					is_pagelink: true
				};
		}

		if (host_domain_nowww === "18qt.com") {
			var newsrc = common_functions["get_pagelink_el_matching"](options.element, /^[a-z]+:\/\/(?:www\.)?18qt\.com\/+go\/+\?(?:.*&)?url=/);
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "neongalleries.com") {
			// http://neongalleries.com/ftv/sophia-knight-dress/TN_06.jpg
			//   http://neongalleries.com/ftv/sophia-knight-dress/06.jpg
			return {
				url: src.replace(/\/TN_([0-9]+\.[^/.]+)(?:[?#].*)?$/, "/$1"),
				headers: {
					Referer: ""
				},
				referer_ok: {
					same_domain_nosub: true
				}
			};
		}

		if (domain === "images.sexy-beauties.com" ||
			// https://images.gorgeousbeauties.pics/pics/inthecrack666/thumbs/01.jpg
			//   https://images.gorgeousbeauties.pics/pics/inthecrack666/01.jpg
			domain === "images.gorgeousbeauties.pics" ||
			// https://images.sexynudeparadise.com/pics/digitaldesire_113/thumbs/06.jpg
			//   https://images.sexynudeparadise.com/pics/digitaldesire_113/06.jpg
			domain === "images.sexynudeparadise.com" ||
			// https://images.nakedbigtitspics.com/pics/inthecrack859/thumbs/01.jpg
			//   https://images.nakedbigtitspics.com/pics/inthecrack859/01.jpg
			domain === "images.nakedbigtitspics.com") {
			// https://images.sexy-beauties.com/pics/ftvgirls201/thumbs/01.jpg
			//   https://images.sexy-beauties.com/pics/ftvgirls201/01.jpg
			return src.replace(/(\/pics\/+[^/]+\/+)thumbs\/+([0-9]+\.)/, "$1$2");
		}

		if (domain_nowww === "watch4beauty.com") {
			newsrc = src.replace(/(:\/\/[^/]+\/+api\/+[^/]+\/+[0-9]{8}-[^/.?#]+-[0-9]+-[0-9]{3})-(?:480|640|960|1280|1920)(\.[^/.?#]+)(?:[?#].*)?$/, "$1-2560$2");
			if (newsrc !== src) return newsrc;
		}

		if (host_domain_nowww === "watch4beauty.com" && domain === "f3b4x6b2.ssl.hwcdn.net") {
			var get_preloaded_state = function() {
				var scripts = document.getElementsByTagName("script");
				var state = null;
				array_foreach(scripts, function(script) {
					var match = script.innerHTML.match(/^\s*window\.__PRELOADED_STATE__\s*=\s*({.*});\s*$/);
					if (!match)
						return;

					try {
						state = JSON_parse(match[1]);
					} catch (e) {
						console_error(e);
						return false;
					}
				});
				return state;
			};

			var get_album_id_from_state = function(state) {
				return state.watch.issues.currentIssueDetail.id;
			};

			var get_album_info = function(state, id) {
				return state.watch.issues.magazinesMergeTitle[id];
			};

			match = src.match(/^[a-z]+:\/\/[^/]+\/+production\/+([0-9]{8}-[^/.?#]+)-(?:480|640|960|1280|1920)(\.[^/.?#]+)(?:[?#].*)?$/);
			if (match) {
				obj = {
					headers: {
						Referer: "https://www.watch4beauty.com/"
					},
					redirects: true,
					can_head: false
				};

				var state = get_preloaded_state();
				if (state) {
					try {
						var album_id = get_album_id_from_state(state);
						var album_info = get_album_info(state, album_id);
						var album_size = zpadnum(album_info.issue_size, 3);
					} catch (e) {
						console_error(e, state);
					}

					obj.url = "https://www.watch4beauty.com/api" + base64_decode("LzRqR2RUR1kyMHZreVZjeC8=") + match[1] + "-" + album_size + "-2560" + match[2];
				}
			}
		}

		if (domain_nowww === "streamye.com") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+([a-z0-9]+)(?:[?#].*)?$/,
				query_for_id: "https://www.streamye.com/${id}",
				process: function(done, resp) {
					var sources = common_functions["get_videotag_sources"](resp.responseText);
					if (!sources)
						return done(null, false);

					return done({
						// https://streamye.b-cdn.net./media/video/-{timestamp}.mp4
						// or:
						// ./media/video/-{timestamp}.mp4
						url: norm_url(urljoin(resp.finalUrl, sources.video[0].url, true)),
						extra: {
							page: resp.finalUrl
						},
						headers: {
							Referer: resp.finalUrl
						},
						video: true
					}, 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "galleries.cdn.homemoviestube.com") {
			// https://galleries.cdn.homemoviestube.com/2404965f5cc43ad5b31/thumbs/5f5cc4735cd12.jpg
			//   https://galleries.cdn.homemoviestube.com/2404965f5cc43ad5b31/5f5cc4735cd12.jpg
			return src.replace(/(:\/\/[^/]+\/+[0-9a-f]{5,}\/+)thumbs\/+([0-9a-f]{5,}\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "homemoviestube.com") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+videos\/+([0-9]+)\/+[^/?#]*\.html/,
				query_for_id: "https://www.homemoviestube.com/videos/${id}/.html",
				process: function(done, resp) {
					var obj = common_functions["get_videotag_obj"](resp);
					done(obj, obj ? 60*60 : false);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "youramateurporn.com") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+video\/+[^/]+-([0-9]+)\.html/,
				query_for_id: "https://www.youramateurporn.com/video/a-${id}.html",
				process: function(done, resp) {
					var obj = common_functions["get_videotag_obj"](resp);
					done(obj, obj ? 60*60 : false);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "pornone.com") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+[a-z]+\/+[^/]+\/+([0-9]+)\/*(?:[?#].*)?$/,
				query_for_id: "https://pornone.com/machine/a/${id}/",
				process: function(done, resp) {
					var obj = common_functions["get_videotag_obj"](resp);
					done(obj, obj ? 60*60 : false);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "perfectgirls.net") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+gal\/+([0-9]+)(?:\/+[^/]*\/*)?(?:[?#].*)?$/,
				query_for_id: "https://perfectgirls.net/gal/${id}",
				process: function(done, resp) {
					var obj = common_functions["get_videotag_obj"](resp);
					done(obj, obj ? 60*60 : false);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nosub === "perfectgirls.net" && /^cdn-[a-z][0-9]*\./.test(domain)) {
			// http://cdn-z1.perfectgirls.net/thumbs/750/595/thumb8.1.jpg
			match = src.match(/\/thumbs\/+([0-9]+)\/+([0-9]+)\/+thumb/);
			if (match) {
				id = match[1] + match[2];
				return {
					url: "https://perfectgirls.net/gal/" + id + "/",
					is_pagelink: true
				};
			}
		}

		if (domain_nosub === "perfectgirls.net" && /^(?:[a-f0-9]+-)?cloud\./.test(domain)) {
			// we could also match non-th, but this would require checking the end url to avoid endless redirects
			match = src.match(/\/a\/+[^/]+\/+[0-9]+\/+[0-9]+\/+([0-9]+)-th\./);
			if (match) {
				return {
					url: "https://perfectgirls.net/gal/" + match[1] + "/",
					is_pagelink: true
				};
			}
		}

		if (domain_nowww === "lovehomeporn.com" ||
			domain_nowww === "fuqer.com") {
			var query_lovehomeporn_config = function(site, vid, cb) {
				var baseurl = "";
				if (site === "lovehomeporn.com")
					baseurl = "https://lovehomeporn.com/media/nuevo/config.php";
				else if (site === "fuqer.com")
					baseurl = "https://www.fuqer.com/nuevo/player/config5.php";

				api_query("lovehomeporn_video:" + vid, {
					url: baseurl + "?key=" + vid,
					imu_mode: "xhr",
					headers: {
						Referer: "https://www." + site + "/"
					}
				}, cb, function(done, resp, cache_key) {
					var get_xml = function(tag) {
						var regex = new RegExp("<" + tag + ">(.*?)</" + tag + ">");
						var match = resp.responseText.match(regex);
						if (!match)
							return null;

						return decode_entities(match[1]);
					};

					var file = get_xml("file");
					var filehd = get_xml("filehd");
					// <![CDATA[can&#039;t]]>
					var title = decode_entities(get_xml("title"));
					var thumb = get_xml("thumb");
					var image = get_xml("image");
					var url = get_xml("url");

					if (!thumb)	thumb = image;

					var urls = [];

					if (filehd) {
						urls.push({
							url: filehd,
							video: true
						});
					}

					if (file) {
						urls.push({
							url: file,
							video: true
						});
					}

					if (thumb) {
						urls.push(thumb);
					}

					var obj = {
						headers: {
							Referer: url
						},
						extra: {
							page: url,
							caption: title
						}
					};

					return done(fillobj_urls(urls, obj), 60*60);
				});
			};

			newsrc = website_query({
				website_regex: [
					/^[a-z]+:\/\/[^/]+\/+video\/+([0-9]+)(?:\/+[^/]+)?(?:[?#].*)?$/,
					// fuqer.com
					/^[a-z]+:\/\/[^/]+\/+videos\/+[^/?#.]+-([0-9]+)\.html(?:[?#].*)?$/,
					/^[a-z]+:\/\/[^/]+\/+nuevo\/+player\/+embed\.php\?(?:.*&)?key=([0-9]+)/
				],
				run: function(cb, match) {
					query_lovehomeporn_config(domain_nosub, match[1], cb);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "fuqer.com") {
			// https://www.fuqer.com/templates/default/images/content.gif
			if (/\/templates\/+default\/+images\/+/.test(src))
				return {
					url: src,
					bad: "mask"
				};
		}

		if (domain === "cdn.static.lovehomeporn.com" || domain_nowww === "lovehomeporn.com") {
			// https://cdn.static.lovehomeporn.com/templates/frontend/purple/new_images/player-panel.gif
			if (/\/templates\/+frontend\/+purple\/+new_images\//.test(src))
				return {
					url: src,
					bad: "mask"
				};

			// https://cdn.static.lovehomeporn.com/media/videos/main_thumbs/260%D1%85195/{id0..2}/{id}/??.webp
			// https://lovehomeporn.com/media/videos/tmb/{id}/??.jpg
			match = src.match(/\/media\/+videos\/+(?:main_thumbs\/+[^/]+\/+[0-9]{2}|tmb)\/+([0-9]+)\/+[0-9]+\.[^/.]+(?:[?#].*)?$/);
			if (match)
				return {
					url: "https://www.lovehomeporn.com/video/" + match[1],
					is_pagelink: true
				};
		}

		if (domain_nowww === "wilddream.net") {
			// http://wilddream.net/art/view/16007
			// todo: http://wilddream.net/art/view/3367 (no fullview available, maybe just stick with artwork_img_full?)
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+art\/+view\/+([0-9]+)(?:[?#].*)?$/i,
				query_for_id: "https://wilddream.net/art/view/${id}",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/onClick="fullview\('([0-9]+_[0-9]+\.[a-zA-Z0-9]+)'\);?"/i);
					if (!match) {
						console_error(cache_key, "Unable to find filename match for", resp);
						return done(null, false);
					}

					var filename = match[1];

					match = resp.responseText.match(/\s\.attr\("src", "(\/Public\/uploads\/artwork\/[0-9]+\/full\/)"/i);
					if (!match) {
						console_error(cache_key, "Unable to find path match for", resp);
						return done(null, false);
					}

					var path = match[1];

					var obj = {
						extra: {
							page: resp.finalUrl
						}
					};

					var description = get_meta(resp.responseText, "description");
					if (description) obj.extra.caption = description;

					var final = urljoin(urljoin(resp.finalUrl, path, true), filename);
					obj.url = final;

					return done(obj, 6*60*60);
				}
			});
			if (newsrc) return newsrc;

			// http://wilddream.net/Public/uploads/artwork/3367/thumb/16007.jpg
			//   http://wilddream.net/Public/uploads/artwork/3367/preview/16007.jpg
			newsrc = src.replace(/\/Public\/+uploads\/+artwork\/+([0-9]+)\/+thumb\/+([0-9]+\.[^/.]+(?:[?#].*)?)$/i,
				"/Public/uploads/artwork/$1/preview/$2");
			if (newsrc !== src)
				return newsrc;

			match = src.match(/\/Public\/+uploads\/+artwork\/+[0-9]+\/+(?:thumb|preview)\/+([0-9]+)\.[^/.]+(?:[?#].*)?$/i);
			if (match) {
				return {
					url: "http://wilddream.net/art/view/" + match[1],
					is_pagelink: true
				};
			}
		}

		if (domain === "img.monaffy.jp") {
			// https://monappy.jp/picture_places/view/41872
			// https://img.monaffy.jp/img/picture_place/normal/41872.png
			//   https://img.monaffy.jp/img/picture_place/original/41872.png
			// https://img.monaffy.jp/img/profile/small/19178.png?1600876068
			//   https://img.monaffy.jp/img/profile/original/19178.png?1600876068
			let obj = {
				url: src.replace(/(\/img\/+(?:picture_place|profile)\/+)[a-z]+\/+([0-9]+\.)/, "$1original/$2")
			};

			match = src.match(/\/img\/+picture_place\/+[a-z]+\/+([0-9]+)\./);
			if (match) obj.extra = {page: "https://monappy.jp/picture_places/view/" + match[1]};

			return obj;
		}

		if (domain === "i.iheart.com") {
			// https://i.iheart.com/v3/re/new_assets/5a91863a79b810a683361620?ops=fit(770%2C385)
			//   https://i.iheart.com/v3/re/new_assets/5a91863a79b810a683361620
			newsrc = src.replace(/(:\/\/[^/]+\/+v3\/+[^?#]*?)(?:[?#].*)?$/, "$1");
			if (newsrc !== src && !/[?&]sn=/.test(src))
				return newsrc;

			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/456
			// https://i.iheart.com/v3/url/aHR0cHM6Ly9kM3dvNXdvanZ1djdsLmNsb3VkZnJvbnQubmV0L3RfcnNzX2l0dW5lc19zcXVhcmVfMTQwMC9pbWFnZXMuc3ByZWFrZXIuY29tL29yaWdpbmFsLzc2ZjIwODk3MDQyN2M1MDEwOTkwMjBlYmVmMTg3Yjg0LmpwZw?ops=fit(240%2C240)
			//   https://d3wo5wojvuv7l.cloudfront.net/t_rss_itunes_square_1400/images.spreaker.com/original/76f208970427c501099020ebef187b84.jpg
			// https://i.iheart.com/v3/url/aHR0cDovL2ltYWdlLmloZWFydC5jb20vYmVsbC1pbmdlc3Rpb24tcGlwZWxpbmUtcHJvZHVjdGlvbi11bWcvZnVsbC8wMDYwMjUwODk4NzIzNl8yMDIwMDgwMjE2NTA1Mjc4MS8yMFVNR0lNMjExNjZfVDFfY3ZyYXJ0LmpwZw==
			//   http://image.iheart.com/bell-ingestion-pipeline-production-umg/full/00602508987236_20200802165052781/20UMGIM21166_T1_cvrart.jpg
			// https://i.iheart.com/v3/url/aHR0cDovL2ltYWdlLmloZWFydC5jb20vU0JNRzcvVGh1bWJfQ29udGVudC9GdWxsX1BDL1NCTUcvQXByMTQvMDQxNDE0L0ExMDMwMUEwMDAzMTMxNjM0WV8yMDE0MDQxMTE3NDkzNTM5NC9yZXNvdXJjZXMvQTEwMzAxQTAwMDMxMzE2MzRZX1QtMTAyMDJfSW1hZ2UuanBn
			//   http://image.iheart.com/SBMG7/Thumb_Content/Full_PC/SBMG/Apr14/041414/A10301A0003131634Y_20140411174935394/resources/A10301A0003131634Y_T-10202_Image.jpg
			// https://i.iheart.com/v3/url/aHR0cCUzQSUyRiUyRmltYWdlLmloZWFydC5jb20lMkZpaHItaW5nZXN0aW9uLXBpcGVsaW5lLXByb2R1Y3Rpb24td21nJTJGbmV3X3JlbGVhc2UlMkYyMDIwMDczMTIwMzI1MjY4MiUyRjA3NTY3OTgwNTQxNiUyRnJlc291cmNlcyUyRjA3NTY3OTgwNTQxNi5qcGc=
			//   http://image.iheart.com/ihr-ingestion-pipeline-production-wmg/new_release/20200731203252682/075679805416/resources/075679805416.jpg
			// https://i.iheart.com/v3/surl/aHR0cDovL2ltYWdlLmloZWFydC5jb20vY29udGVudC9tdXNpYy9wcm9kL1dNRzQvVGh1bWJfQ29udGVudC9GdWxsX1BDL1dNRy9TZXAxNS8wOTE3MTUvODE0OTA4MDIwMjAyL3Jlc291cmNlcy84MTQ5MDgwMjAyMDIuanBn?ops=fit%2875%2C75%29&sn=eGtleWJhc2UyMDIxMTExMDpZ68wLlqYG4ddD8laW_OxG5Dhkug04Me0Ak8U65_7iDQ%3D%3D&surrogate=1cOXl179JY-syhxYSCX6Q0O_JMGiBKwf7UslJDIRJEsSokWCM3NHgICEbRjKslIKm-S3yl67xkE6shDSqTadRdH6Yr-bGPSCVHtNgC9ah49g_ap7L1ug8YYTKki-VreBJyMZEjjAoegtojIoUnnlkyR1VzvwWLiyLFlU_v8yawNz_Qnn-8ONRnC62wcsOVEhzkU5LwCe4NAsgMzfiN552wY3ABm46QoZA5vjzFWTSraPG-tCKy903v84DTSVmkz9ZUHe-5PK5SDE5IJRUo7IGDf41-dzGNsORNZSUtJaYlxwuoL1keVg-BFeVL6Xg4mMpglJzjhrAQ%3D%3D
			//   http://image.iheart.com/content/music/prod/WMG4/Thumb_Content/Full_PC/WMG/Sep15/091715/814908020202/resources/814908020202.jpg
			match = src.match(/^[a-z]+:\/\/[^/]+\/+v3\/+s?url\/+(aHR0[^?#]+)(?:[?#].*)?$/);
			if (match) {
				return decodeuri_ifneeded(base64_decode(match[1]));
			}
		}

		if (domain === "images.megaphone.fm") {
			// https://images.megaphone.fm/l9SUB21ESw1g9IZ6RTvH-v5FSIeeufR5InNvp-XcGUw/plain/s3://megaphone-prod/podcasts/144201f8-6a13-11ea-8e44-f71225786a87/image/uploads_2F1585663470202-n8c3qinzfls-1b4da18ed361ee2f20ea55bb810945a4_2F5E8DD4C3-8555-45D5-9F6B-4D2E63B7DA7C.png
			//   https://s3.amazonaws.com/megaphone-prod/podcasts/144201f8-6a13-11ea-8e44-f71225786a87/image/uploads_2F1585663470202-n8c3qinzfls-1b4da18ed361ee2f20ea55bb810945a4_2F5E8DD4C3-8555-45D5-9F6B-4D2E63B7DA7C.png
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+[^/]+\/+[^/]+\/+s3:\/\//, "https://s3.amazonaws.com/");
			if (newsrc !== src) return newsrc;
		}

		if (domain === "img.jvid.com") {
			// https://img.jvid.com/rescale_avatar/1568711641962_143894/2019/09/17/edb31e32a626d7e15dd96171fa082da6e702723c9bf3ac18edf051fb7a94ebcd_large.jpg
			//   https://img.jvid.com/avatar/1568711641962_143894/2019/09/17/edb31e32a626d7e15dd96171fa082da6e702723c9bf3ac18edf051fb7a94ebcd.jpg
			// https://img.jvid.com/video_thumbnail/1598426239887_221840/2020/08/26/640/5fc4cfe6ce85c2d1b5442fa1b8c97f14bd24668d273575fa733099f6f4eb219f.jpg
			//   https://img.jvid.com/video_thumbnail/1598426239887_221840/2020/08/26/5fc4cfe6ce85c2d1b5442fa1b8c97f14bd24668d273575fa733099f6f4eb219f.jpg
			//   https://img.jvid.com/marked_preview_video/1598954031242_221840/2020/09/01/70852995daca2ad9bad00416716373c1c7cb6d15f0060c657eeeb92b48af50f6.mp4
			// https://img.jvid.com/minify_image/300/1597656540042_140527/2020/08/17/ed1623cf1ed3555cf8a6ab1cfcf6a73f4e2d7e0fdc4198784f9a7aa139fdc582.jpg
			//   https://img.jvid.com/minify_image/1600/3/1597656540042_140527/2020/08/17/ed1623cf1ed3555cf8a6ab1cfcf6a73f4e2d7e0fdc4198784f9a7aa139fdc582.jpg
			//   https://img.jvid.com/original_image/1597656540042_140527/2020/08/17/ed1623cf1ed3555cf8a6ab1cfcf6a73f4e2d7e0fdc4198784f9a7aa139fdc582.jpg -- exists, but 403?
			newsrc = src
				.replace(/(:\/\/[^/]+\/+minify_image\/+)300(\/+[0-9]{5,}_[0-9]+\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9a-f]{30,}\.[^/.]+)(?:[?#].*)?$/, "$11600/3$2")
				.replace(/(:\/\/[^/]+\/+)rescale_([a-z]+\/+[0-9]{5,}_[0-9]+\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9a-f]{30,})_[a-z]+(\.[^/.]+)(?:[?#].*)?$/, "$1$2$3")
				.replace(/(:\/\/[^/]+\/+video_thumbnail\/+[0-9]{5,}_[0-9]+\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2})[0-9]{2,5}\/+([0-9a-f]{30,}\.[^/.]+)(?:[?#].*)?$/, "$1$2")
			if (newsrc !== src)
				return newsrc;

			newsrc = src.replace(/(:\/\/[^/]+\/+)video_thumbnail(\/+[0-9]{5,}_[0-9]+\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9a-f]{30,})\.[^/.]+(?:[?#].*)?$/, "$1marked_preview_video$2.mp4");
			if (newsrc !== src)
				return {
					url: newsrc,
					video: true
				};
		}

		if (domain_nowww === "mixdrop.co") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+e\/+([0-9a-z]{5,})(?:[?#].*)?$/,
				query_for_id: "https://mixdrop.co/e/${id}",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/<script>\s*MDCore\.[\s\S]+?eval\(function\(p,.*\s*<\/script>\s*(?:<div class="title|<video)/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					var unpacked = common_functions["unpack_packer"](match[0]);
					if (!unpacked) {
						console_error(cache_key, "Unable to unpack", match[0], "in", resp);
						return done(null, false);
					}

					var urls = [];

					match = unpacked.match(/MDCore\.wurl=("[^"]+");/);
					if (match) {
						urls.push({
							url: urljoin(resp.finalUrl, JSON_parse(match[1]), true),
							video: true,
							headers: {
								Origin: "https://mixdrop.co",
								Referer: "https://mixdrop.co/"
							}
						});
					}

					match = unpacked.match(/MDCore\.poster=("[^"]+");/);
					if (match) {
						urls.push(urljoin(resp.finalUrl, JSON_parse(match[1]), true));
					}

					if (!urls.length) {
						console_error(cache_key, "Unable to find urls in", unpacked, "from", resp);
						return done(null, false);
					}

					return done(urls, 60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "videobin.co" ||
			domain_nowww === "vidlox.me") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+([0-9a-z]{10,})\.html(?:[?#].*)?$/,
				query_for_id: "https://" + domain_nosub + "/${id}.html",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/new Clappr\.Player\({\s*sources: (\[".*?"\]),\s*poster: ("https?:[^"]+"),/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					var sources = JSON_parse(match[1]);
					var poster = JSON_parse(match[2]);

					var urls = [];

					array_foreach(sources, function(source) {
						var video:VideoProp = true;
						if (/\.m3u8/.test(source)) {
							video = "hls";
						}

						urls.push({
							url: source,
							video: video
						});
					});

					urls.push(poster);

					return done(urls, 60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if ((domain_nosub === "videobin.co" ||
			 domain_nosub === "vidlox.me") && /^c[0-9]*\./.test(domain)) {
			// https://c3.videobin.co/i/{zpad_num:2}/{zpad_num:5}/{id}_x?t.jpg
			// x = frame screenshots, t = single screenshot
			match = src.match(/^[a-z]+:\/\/[^/]+\/+i\/+[0-9]{2}\/+[0-9]{5}\/+([a-z0-9]{10,})_x?t\.[^/.]+(?:[?#].*)?$/);
			if (match) {
				return {
					url: "https://" + domain_nosub + "/" + match[1] + ".html",
					is_pagelink: true
				};
			}
		}

		if (domain_nowww === "vidoza.net" ||
			// not the exact same (uses hola_player instead of pData), but close enough
			// also uses cloudflare
			domain_nowww === "clipwatching.com" ||
			// videojs
			domain_nowww === "aparat.cam") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+([0-9a-z]{10,})\.html(?:[?#].*)?$/,
				query_for_id: "https://" + domain_nosub + "/${id}.html",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/(?:window\.(?:pData = |hola_player\()| = videojs\('[a-z]+',\s*)({[\s\S]+?)<\/script>/);
					if (!match) {
						console_error(cache_key, "Unable to find object match for", resp);
						return done(null, false);
					}

					var objtext = match[1];

					match = objtext.match(/^{[\s\S]*?sources(?:Code)?: (\[{.*?}\]),/);
					if (!match) {
						console_error(cache_key, "Unable to find sources match for", resp);
						return done(null, false);
					}

					var sources = JSON_parse(fixup_js_obj(match[1]));

					var poster = null;
					match = objtext.match(/^{[\s\S]*?poster: ["'](https?:\/\/[^"']+)["'],/);
					if (!match) {
						console_warn(cache_key, "Unable to find poster match for", resp);
						return done(null, false);
					} else {
						poster = match[1];
					}

					var urls = [];

					array_foreach(sources, function(source) {
						var video:VideoProp = true;
						if (/\.m3u8/.test(source.src)) {
							video = "hls";
						}

						urls.push({
							url: source.src,
							video: video
						});
					});

					if (poster)
						urls.push(poster);

					return done(urls, 60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if ((domain_nosub === "vidoza.net" ||
			 domain_nosub === "clipwatching.com" ||
			 domain_nosub === "aparat.cam") && /^s(?:tr)?[0-9]*\./.test(domain)) {
			// https://str03.vidoza.net/i/{zpad:2}/{zpad:5}/{id}.jpg?v={timestamp}
			match = src.match(/^[a-z]+:\/\/[^/]+\/+i\/+[0-9]{2}\/+[0-9]{5}\/+([a-z0-9]{10,})\.[^/.]+(?:[?#].*)?$/);
			if (match) {
				return {
					url: "https://" + domain_nosub + "/" + match[1] + ".html",
					is_pagelink: true
				};
			}
		}

		if (domain_nowww === "streamtape.com" ||
			domain_nowww === "streamtape.to") {
			// e = embed, v = video page
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+[ev]\/+([0-9a-zA-Z]{5,})\/*(?:[?#].*)?$/,
				query_for_id: "https://streamtape.com/e/${id}",
				process: function(done, resp, cache_key) {
					var baseobj = {
						extra: {
							page: resp.finalUrl
						}
					};

					var urls = [];

					var ogtitle = get_meta(resp.responseText, "og:title");
					var ogimage = get_meta(resp.responseText, "og:image");

					if (ogtitle)
						baseobj.extra.caption = ogtitle;

					let matches = match_all(resp.responseText, /document\.getElementById\('(.*?)'\)\.innerHTML *= *(["'](\/\/*s.*?));/);
					let match = null;
					if (matches) {
						for (let m of matches) {
							if (m[1] === "botlink")
								match = m;
						}
					}

					if (!match) {
						console_error(cache_key, "Unable to find match for", resp, matches);
					} else {
						let url1 = match[2].replace(/\('([^']+)'\)((?:\.substring\([0-9]+\))+)/, function(_, base, substrs) {
							let nums = match_all(substrs, /\(([0-9]+)\)/);
							for (let num of nums) {
								base = base.substring(num[1]|0);
							}
							return "'" + base + "'";
						});

						while (true) {
							let newurl = url1.replace(/(["'])\s*\+\s*'([^']+)'/g, "$2$1");
							if (newurl === url1) {
								url1 = newurl;
								break;
							} else {
								url1 = newurl;
								continue;
							}
						}
						let url = url1
							.replace(/['"+ ]/g, "")
							.replace(/^\/(stream)/, "//$1");
						url = urljoin(resp.finalUrl, url + "&stream=1", true);

						urls.push({
							url: url,
							video: true,
							headers: {
								Referer: "https://" + domain + "/",
								"Sec-Fetch-Dest": "video",
								"Sec-Fetch-Mode": "cors",
								"Sec-Fetch-Site": "cross-site"
							}
						});
					}

					if (ogimage)
						urls.push(ogimage);

					if (!urls.length)
						return done(null, false);

					return done(fillobj_urls(urls, baseobj), 60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "thumb.tapecontent.net") {
			match = src.match(/:\/\/[^/]+\/+thumb\/+([0-9a-zA-Z]{5,})\/+[^/]+\./);
			if (match)
				return {
					url: "https://streamtape.com/e/" + match[1],
					is_pagelink: true
				};
		}

		if (domain_nowww === "ninjastream.to") {
			var query_ninjastream = function(vid, xsrf, cb) {
				api_query("ninjastream:" + vid, {
					url: "https://ninjastream.to/api/video/get",
					method: "POST",
					imu_mode: "xhr",
					data: '{"id":"' + vid + '"}',
					headers: {
						"x-requested-with": "XMLHttpRequest",
						"referer": "https://ninjastream.to/watch/" + vid,
						"content-type": "application/json;charset=UTF-8",
						"accept": "application/json, text/plain, */*",
						"x-xsrf-token": xsrf,
						//"x-csrf-token": ???
					},
					json: true
				}, cb, function(done, resp, cache_key) {
					if (!resp.result.playlist) {
						console_error(cache_key, "Unable to find playlist from", resp);
						return done(null, false);
					}

					return done({
						url: resp.result.playlist,
						video: "hls",
						headers: {
							Referer: "https://ninjastream.to/watch/" + vid
						}
					}, 60*60);
				});
			};

			var get_ninjastream_csrf = function(cb) {
				if (!options.get_cookies) {
					console_error("Cookies not enabled");
					return cb(null);
				}

				options.get_cookies("https://ninjastream.to/api/video/get", function(cookies) {
					if (!cookies) {
						console_error("Unable to get cookies for ninjastream");
						return cb(null);
					}

					cookies = headers_list_to_dict(cookies);

					if (!cookies["xsrf-token"]) {
						console_error("Unable to find xsrf-token cookie in", cookies);
						return cb(null);
					}

					return cb(cookies["xsrf-token"]);
				});
			}

			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/ninjastream\.to\/+watch\/+([0-9A-Za-z]{5,})(?:[?#].*)?$/,
				run: function(cb, match) {
					var vid = match[1];
					get_ninjastream_csrf(function(xsrf) {
						if (!xsrf)
							return cb(null);

						query_ninjastream(vid, xsrf, cb);
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "streamz.ws") {
			newsrc = website_query({
				// /y{id}
				website_regex: /^[a-z]+:\/\/[^/]+\/+[a-z]([0-9a-f]{10,})(?:[?#].*)?$/,
				run: function(cb, match) {
					var id = match[1];
					return cb({
						url: "https://streamz.ws/getlink-" + id + ".dll",
						video: true,
						headers: {
							Referer: "https://streamz.ws/"
						}
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nosub === "0dayporno.com" && /^s[0-9]*\./.test(domain)) {
			// http://s3.0dayporno.com/photos/19204/3435317_300.jpg -- 300x450
			//   http://s3.0dayporno.com/photos/19204/3435317_o.jpg -- 3744x5616
			// http://s3.0dayporno.com/video_images/35821/1059173.jpg -- 176x99
			//   http://s3.0dayporno.com/video_images/35821/1059173_o.jpg -- 852x480
			// http://s3.0dayporno.com/videos/35821_vga.mp4
			//   http://s3.0dayporno.com/videos/35821.mp4
			return src
				.replace(/(\/videos\/+[0-9]+)_vga(\.[^/.]+)(?:[?#].*)?$/, "$1$2")
				.replace(/(\/(?:photos|video_images)\/+[0-9]+\/+[0-9]+)(?:_[0-9]+)?(\.[^/.]+)(?:[?#].*)?$/, "$1_o$2");
		}

		if (domain === "bigfishgames-a.akamaihd.net") {
			// https://bigfishgames-a.akamaihd.net/en_mystery-case-files-broken-hour/th_screen1.jpg
			//   https://bigfishgames-a.akamaihd.net/en_mystery-case-files-broken-hour/screen1.jpg
			return src.replace(/\/th_(screen[0-9]+\.[^/.]+)(?:[?#].*)?$/, "/$1");
		}

		if (domain_nowww === "theplancollection.com") {
			// https://www.theplancollection.com/Upload/Designers/142/1162/Plan1421162MainImage_14_9_2016_13_891_593.jpg
			//   https://www.theplancollection.com/Upload/Designers/142/1162/Plan1421162MainImage_14_9_2016_13.jpg
			// https://www.theplancollection.com/Upload/Designers/142/1162/Plan1421162Image_14_9_2016_1336_35_891_593.jpg
			//   https://www.theplancollection.com/Upload/Designers/142/1162/Plan1421162Image_14_9_2016_1336_35.jpg
			// https://www.theplancollection.com/Upload/Designers/141/1148/Plan1411148MainImage_2_11_2017_12_267_241.jpg
			//   https://www.theplancollection.com/Upload/Designers/141/1148/Plan1411148MainImage_2_11_2017_12.jpg
			// https://www.theplancollection.com/Upload/Designers/142/1168/Plan1421168MainImage_9_1_2017_10_381_251.jpg
			//   https://www.theplancollection.com/Upload/Designers/142/1168/Plan1421168MainImage_9_1_2017_10.jpg
			// https://www.theplancollection.com/Upload/Designers/141/1316/Plan1411316Image_31_3_2019_1911_35_467_200.jpg
			//   https://www.theplancollection.com/Upload/Designers/141/1316/Plan1411316Image_31_3_2019_1911_35.jpg
			return src.replace(/(\/upload\/+designers\/+[0-9]+\/+[0-9]+\/+[^/.]+_[0-9]{4}(?:_[0-9_]+)?)_(?:891_593|267_241|381_251|467_200)(\.[^/.]+)(?:[?#].*)?$/i, "$1$2");
		}

		if (domain === "assets.architecturaldesigns.com") {
			// https://assets.architecturaldesigns.com/plan_assets/83868/thumb/83868jw_1480366559.jpg?1506332446
			//   https://assets.architecturaldesigns.com/plan_assets/83868/large/83868jw_1480366559.jpg?1506332446
			//   https://assets.architecturaldesigns.com/plan_assets/83868/original/83868jw_1480366559.jpg?1506332446
			return src.replace(/(\/plan_assets\/+[0-9]+\/+)[a-z]+\/+/, "$1original/");
		}

		if (domain === "ajax.googleapis.com") {
			// https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/themes/base/images/ui-bg_flat_0_aaaaaa_40x100.png
			if (/\/ajax\/+libs\/+jqueryui\/+[^/]+\/+themes\/+base\/+images\/+ui-bg_flat_0_[a-z]+_[0-9]+x[0-9]+\./.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}
		}

		if (domain_nowww === "camclips.to" ||
			domain_nowww === "camclips.cc") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+video\/+([0-9a-zA-Z]+)(?:[?#].*)?$/,
				query_for_id: "https://" + domain + "/video/${id}",
				process: function(done, resp, cache_key) {
					var initialstate = resp.responseText.match(/window\.__INITIAL_STATE__=({.*?});\(function/);
					if (!initialstate) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					var json = JSON_parse(initialstate[1]);

					var ssrData = json.ssrData;
					var sources = ssrData.ssrVideoSources;

					sources = sort_by_key(sources, "size").reverse();
					var urls = [];

					array_foreach(sources, function(source) {
						urls.push(source.src);
					});

					var title = ssrData["Player-Video"].video.title;
					var obj = {
						extra: {
							caption: title,
							page: resp.finalUrl
						}
					};

					return done(fillobj_urls(urls, obj), 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "imgproxy.camclips.to" ||
			domain === "imgproxy.camclips.cc") {
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+preset\/+[^/]+\/+([^-?#/.]+)(?:[?#].*)?$/, "$1");
			if (newsrc !== src) {
				return urljoin("https://img." + domain_nosub + "/", base64_decode(newsrc), true);
			}
		}

		if (domain === "img.camclips.to" ||
			domain === "img.camclips.cc") {
			match = src.match(/^[a-z]+:\/\/[^/]+\/+(?:thumb\/+[A-Za-z0-9]{2}|preview)\/+([a-zA-Z0-9]+)\.[^/.]+/);
			if (match) {
				return {
					url: "https://" + domain_nosub + "/video/" + match[1],
					is_pagelink: true
				};
			}
		}

		if (domain === "media.fstatic.com") {
			// thumbor
			// https://media.fstatic.com/_0sJfI7w0dHrHe-XuEkO2ZwmTQg=/120x160/smart/media/artists/avatar/2012/10/johnny-depp_a14853_2.jpg
			//   https://cdn.fstatic.com/media/artists/avatar/2012/10/johnny-depp_a14853_2.jpg
			return urljoin("https://cdn.fstatic.com/", src.replace(/^[a-z]+:\/\/[^/]+\/+[^/]+=\/+.*?(\/media\/.*)$/, "$1"), true);
		}

		if (domain === "static.tvmaze.com") {
			// https://static.tvmaze.com/uploads/images/medium_portrait/218/546078.jpg
			//   https://static.tvmaze.com/uploads/images/original_untouched/218/546078.jpg
			return src.replace(/(\/uploads\/+images\/+)[^/]+\/+([0-9]+\/+[0-9]+\.)/, "$1original_untouched/$2");
		}

		if (domain_nosub === "allafrica.com" && /^cdn[0-9]*\./.test(domain)) {
			// thanks to dym-sh on github: https://github.com/qsniyg/maxurl/issues/480
			// https://allafrica.com/view/group/main/main/id/00075054.html
			// https://cdn04.allafrica.com/download/pic/main/main/csiid/00570148:ed06278f4617fca6d5e004136f6b4fc6:arc614x376:w614:us1.jpg
			//   https://cdn04.allafrica.com/download/pic/main/main/csiid/00570148:ed06278f4617fca6d5e004136f6b4fc6.jpg
			// https://cdn02.allafrica.com/download/pic/main/main/csiid/00570312:12138ddf232ba212277f3f8a1b4eca63:arc614x376:w1080:us1.jpg -- 1080x661, upscaled
			//   https://cdn02.allafrica.com/download/pic/main/main/csiid/00570312:12138ddf232ba212277f3f8a1b4eca63.jpg -- 614x373
			return src.replace(/(\/download\/+pic\/+main\/+main\/+csiid\/+[0-9]+:[0-9a-f]{10,}):[^/?#]+(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "toledoblade.com" ||
			// https://liber.post-gazette.com/image/2014/04/24/1140x_a10-7_ctc/campbell-s-by-andy-warhol-1985.jpg
			//   https://liber.post-gazette.com/image/2014/04/24/campbell-s-by-andy-warhol-1985.jpg
			domain === "liber.post-gazette.com") {
			// https://www.toledoblade.com/image/2020/10/14/1140x_a10-7_cTC/ROV-earlyvote14-5.jpg
			//   https://www.toledoblade.com/image/2020/10/14/a10-7_cTC/ROV-earlyvote14-5.jpg
			//   https://www.toledoblade.com/image/2020/10/14/7_cTC/ROV-earlyvote14-5.jpg
			//   https://www.toledoblade.com/image/2020/10/14/asdf/ROV-earlyvote14-5.jpg
			//   https://www.toledoblade.com/image/2020/10/14/ROV-earlyvote14-5.jpg
			// https://www.toledoblade.com/image/2020/05/10/270x_q80_a1-1_cMC/CTY-CovidTesting-2
			//   https://www.toledoblade.com/image/2020/05/10/CTY-CovidTesting-2
			return src.replace(/(\/image\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2})[^/]+\/+([^/]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "9b16f79ca967fd0708d1-2713572fef44aa49ec323e813b06d2d9.ssl.cf2.rackcdn.com") {
			// thanks to anonymous for reporting:
			// https://9b16f79ca967fd0708d1-2713572fef44aa49ec323e813b06d2d9.ssl.cf2.rackcdn.com/1140x_a10-7_cTC/NCAA-Championships-Wrestling-3-1647744470.jpg
			//   https://9b16f79ca967fd0708d1-2713572fef44aa49ec323e813b06d2d9.ssl.cf2.rackcdn.com/1200x/NCAA-Championships-Wrestling-3-1647744470.jpg
			// https://9b16f79ca967fd0708d1-2713572fef44aa49ec323e813b06d2d9.ssl.cf2.rackcdn.com/origin/NCAA-Championships-Wrestling-3-1647744470.jpg -- 403
			// https://9b16f79ca967fd0708d1-2713572fef44aa49ec323e813b06d2d9.ssl.cf2.rackcdn.com/600x_a4-3_cTC/IMG-7944-1-1671655245.jpg
			//   https://9b16f79ca967fd0708d1-2713572fef44aa49ec323e813b06d2d9.ssl.cf2.rackcdn.com/1200x/IMG-7944-1-1671655245.jpg
			// https://9b16f79ca967fd0708d1-2713572fef44aa49ec323e813b06d2d9.ssl.cf2.rackcdn.com/300x_a1-1_cTC/CDC-GUIDELINES-ORIGIN-3-1600726765.jpg
			//   https://9b16f79ca967fd0708d1-2713572fef44aa49ec323e813b06d2d9.ssl.cf2.rackcdn.com/1200x/CDC-GUIDELINES-ORIGIN-3-1600726765.jpg
			return src.replace(/\/[0-9]+x_[^/]+\/([^/]+)(?:[?#].*)?$/, "/1200x/$1");
		}

		if (domain_nowww === "kstp.com") {
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/484
			// https://kstp.com/kstpImages/repositoryThumbs/2020-10/800JudgeCahillCourtroomSketch.jpg
			//   https://kstp.com/kstpImages/repository/2020-10/800JudgeCahillCourtroomSketch.jpg
			// https://kstp.com/kstpImages/repositoryThumbs/2020-10/35Wprojectconstructionmilestone.jpg
			//   https://kstp.com/kstpImages/repository/2020-10/35Wprojectconstructionmilestone.jpg
			return src.replace(/(\/kstpImages\/+repository)Thumbs\/+/, "$1/");
		}

		if (domain_nosub === "wallpapers76.com" && /^im[0-9]*\./.test(domain)) {
			// http://im01.wallpapers76.com/wallpapers/1/190/thumb/140_taylor-swift-on-good-morning-america--018.jpg
			//   http://im01.wallpapers76.com/wallpapers/1/190/taylor-swift-on-good-morning-america--018.jpg
			return src.replace(/(\/wallpapers\/+[0-9]+\/+[0-9]+\/+)thumb\/+[0-9]+_/, "$1");
		}

		if (domain_nosub === "caricos.com" && /^img[0-9]*\./.test(domain)) {
			// https://www.caricos.com/cars/p/porsche/2017_porsche_911_rsr/
			// https://www.caricos.com/cars/p/porsche/2017_porsche_911_rsr/images/1.html
			// https://img3.caricos.com/2017_porsche_911_rsr_1_1920x1080.jpg
			//   https://images.caricos.com/p/porsche/2017_porsche_911_rsr/images/1920x1080/2017_porsche_911_rsr_1_1920x1080.jpg
			// https://img3.caricos.com/2017_porsche_911_rsr_10_1920x1080.jpg
			//   https://images.caricos.com/p/porsche/2017_porsche_911_rsr/images/1920x1080/2017_porsche_911_rsr_10_1920x1080.jpg
			return src.replace(/^[a-z]+:\/\/[^/]+\/+(([0-9]+_(([a-z])[a-z]+)_[^/]+)_[0-9]+_([0-9]+x[0-9]+)\.[^/.]+)(?:[?#].*)?$/, "https://images.caricos.com/$4/$3/$2/images/$5/$1");
		}

		if (domain_nowww === "webcamrips.com") {
			match = src.match(/^[a-z]+:\/\/[^/]+\/+embed\/+\?(aHR.*)$/);
			if (match) {
				return {
					url: base64_decode(decodeURIComponent(match[1])),
					is_pagelink: true
				};
			}
		}

		if (domain === "img.srgcdn.com") {
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/485
			// https://theblast.com/
			// https://img.srgcdn.com/e/w:1000/RERrSzVLbHhPOWhHVkZBa05hcjIucG5n.jpg -- atob: DDkK5KlxO9hGVFAkNar2.png
			//   https://img.srgcdn.com/e/RERrSzVLbHhPOWhHVkZBa05hcjIucG5n.jpg
			// https://img.srgcdn.com/e/h:626/VTI0WVY4dXh6UW5zbkxYS1lHVHUuanBn.jpg -- atob: U24YV8uxzQnsnLXKYGTu.jpg
			//   https://img.srgcdn.com/e/VTI0WVY4dXh6UW5zbkxYS1lHVHUuanBn.jpg
			// https://img.srgcdn.com/e/w:750/a2k5aWVsaVdJaktoZHhXYUJxNXYuanBn.jpg -- atob: ki9ieliWIjKhdxWaBq5v.jpg
			//   https://img.srgcdn.com/e/a2k5aWVsaVdJaktoZHhXYUJxNXYuanBn.jpg
			newsrc = src.replace(/(\/e\/+)[wh]:[0-9]+\/+/, "$1");
			if (newsrc !== src)
				return newsrc;

			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/485#issuecomment-710685443
			// https://img.srgcdn.com/e/RERrSzVLbHhPOWhHVkZBa05hcjIucG5n.jpg
			//   https://storage.googleapis.com/dystribute-media/DDkK5KlxO9hGVFAkNar2.png
			// https://img.srgcdn.com/e/VTI0WVY4dXh6UW5zbkxYS1lHVHUuanBn.jpg
			//   https://storage.googleapis.com/dystribute-media/U24YV8uxzQnsnLXKYGTu.jpg
			// https://img.srgcdn.com/e/w:750/a2k5aWVsaVdJaktoZHhXYUJxNXYuanBn.jpg
			//   https://storage.googleapis.com/dystribute-media/ki9ieliWIjKhdxWaBq5v.jpg
			match = src.match(/^[a-z]+:\/\/[^/]+\/+e\/+([-_a-zA-Z0-9=]{10,})\.[^/.]+(?:[?#].*)?$/);
			if (match) {
				return "https://storage.googleapis.com/dystribute-media/" + base64_decode(match[1]);
			}
		}

		if (domain === "write-img.srgcdn.com") {
			// https://write-img.srgcdn.com/e/plain/https%3A%2F%2Fs.gravatar.com%2Favatar%2Fcfc06a774d223912a3bfd9da7e7dab5c%3Fs%3D480%26r%3Dpg%26d%3Dhttps%253A%252F%252Fcdn.auth0.com%252Favatars%252Fer.png
			//   https://s.gravatar.com/avatar/cfc06a774d223912a3bfd9da7e7dab5c?s=480&r=pg&d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Fer.png
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+e\/+[^/]+\/+(https?.*)$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "r.testifier.nl") {
			// thanks to roi:
			// https://r.testifier.nl/Acbs8526SDKI/resizing_type:fill/watermark:TPN/width:1200/height:900/plain/https%3A%2F%2Fs3-newsifier.ams3.digitaloceanspaces.com%2Ftennisinfinitycom%2Fimages%2F2023-04%2Fandreeva-mirra-madrid23-tpn-644bd5f0b97d8.jpg
			//   https://s3-newsifier.ams3.digitaloceanspaces.com/tennisinfinitycom/images/2023-04/andreeva-mirra-madrid23-tpn-644bd5f0b97d8.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+.*?\/(https?(?:%3A|:).*)$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "xcdn.next.co.uk") {
			// thanks to keophcp on github: https://github.com/qsniyg/maxurl/issues/487
			// https://xcdn.next.co.uk/COMMON/Items/Default/Default/Publications/G81/shotview/8063/294-900s.jpg
			//   https://xcdn.next.co.uk/COMMON/Items/Default/Default/Publications/G81/shotzoom/8063/294-900s.jpg
			// https://xcdn.next.co.uk/common/items/default/default/publications/g81/minishot/8063/294-900s2.jpg
			//   https://xcdn.next.co.uk/common/items/default/default/publications/g81/shotzoom/8063/294-900s2.jpg
			// https://xcdn.next.co.uk/Common/Items/Default/Default/ItemImages/Search/224x336/294900.jpg
			//   https://xcdn.next.co.uk/Common/Items/Default/Default/ItemImages/Search/294900.jpg
			//   https://xcdn.next.co.uk/Common/Items/Default/Default/ItemImages/Search/676/294900.jpg
			// https://xcdn.next.co.uk/Common/Items/Default/Default/ItemImages/AltItemShot/315x472/207949s.jpg
			//   https://xcdn.next.co.uk/Common/Items/Default/Default/ItemImages/AltItemZoom/207949s.jpg
			// https://xcdn.next.co.uk/Common/Items/Default/Default/ItemImages/altitemshot/207949s2.jpg
			//   https://xcdn.next.co.uk/Common/Items/Default/Default/ItemImages/AltItemZoom/207949s2.jpg
			// https://xcdn.next.co.uk/Common/Items/Default/Default/ItemImages/Search/224x336/R51707.jpg?X56
			//   https://xcdn.next.co.uk/Common/Items/Default/Default/ItemImages/Search/676/R51707.jpg?X56
			//   https://xcdn.next.co.uk/Common/Items/Default/Default/ItemImages/NoBrand/Search/R51707.jpg?X56 -- same image, without watermark, 676x1014
			// thanks to GoblinLegislator on github: https://github.com/qsniyg/maxurl/issues/636
			// https://xcdn.next.co.uk/common/Items/Default/Default/Publications/G27/shotview-315x472/968/267-312s.jpg
			//   https://xcdn.next.co.uk/common/Items/Default/Default/Publications/G27/shotzoom/968/267-312s.jpg
			// other:
			// https://xcdn.next.co.uk/Common/Items/Default/Default/ItemImages/NoBrand/Search/912209.jpg -- 1800x2700
			//   https://xcdn.next.co.uk/Common/Items/Default/Default/ItemImages/NoBrand/AltItemSearch/912209.jpg -- 404
			//   https://xcdn.next.co.uk/Common/Items/Default/Default/ItemImages/Search/912209.jpg -- 114x214, different image
			// https://xcdn.next.co.uk/Common/Items/Default/Default/ItemImages/Search/676/911665.jpg -- 676x1014
			// https://xcdn.next.co.uk/Common/Items/Default/Default/ItemImages/AltItemSearch/919218.jpg -- 114x216, same image as /search/, but doesn't support 676/224x336
			return src
				.replace(/\/(?:shotview|minishot)(?:-[0-9]+x[0-9]+)?\/+([0-9]+\/+[0-9]+-[0-9]+(?:s[0-9]*)?\.)/i, "/shotzoom/$1")
				.replace(/(\/itemimages\/+search\/+)(?:224x336\/+)?([A-Z]?[0-9]+\.[^/.]+)(?:[?#].*)?$/i, "$1676/$2")
				.replace(/\/altitemshot\/+(?:[0-9]+x[0-9]+\/+)?([0-9]+(?:s[0-9]*)?\.)/i, "/AltItemZoom/$1");
		}

		if (domain === "ik.imagekit.io") {
			// https://ik.imagekit.io/sqhmihmlh/https://xcdn.next.co.uk/Common/Items/Default/Default/ItemImages/NoBrand/Search/593076.jpg?ik-sdk-version=javascript-1.0.3&tr=c-limit%2Cw-500%2Ch-%2Cdefault+image-https%3A%2F%2Fik.imagekit.io%2Fsqhmihmlh%2Fmissing_image.jpg
			//   https://xcdn.next.co.uk/Common/Items/Default/Default/ItemImages/NoBrand/Search/593076.jpg
			// thanks to StarCrunchMuncher on reddit:
			// https://curtsyapp.com/item/jordan-1/ABbHybG5e4
			// https://ik.imagekit.io/pi9lsweb7gk/tr:f-jpg,pr-true,w-1230,h-902/0fbbf9c6b4df6b7c45927e87c7685a99_photo.jpeg
			//   https://ik.imagekit.io/pi9lsweb7gk/0fbbf9c6b4df6b7c45927e87c7685a99_photo.jpeg -- 2000x1468
			// https://ik.imagekit.io/pi9lsweb7gk/tr:w-64,h-64/622f3bb04753f1b672c67b76bccc539e_avatar.png
			//   https://ik.imagekit.io/pi9lsweb7gk/622f3bb04753f1b672c67b76bccc539e_avatar.png -- 90x90
			// https://ik.imagekit.io/pi9lsweb7gk/tr:w-160,h-160/fbfb36a5f17c5032f0dadd3d6cdf1f88_profilepic.png
			//   https://ik.imagekit.io/pi9lsweb7gk/fbfb36a5f17c5032f0dadd3d6cdf1f88_profilepic.png
			// https://ik.imagekit.io/pi9lsweb7gk/tr:f-jpg,pr-true,w-296,h-340/48de16324b94f45c5975ffe8365b3581_image-0.jpeg
			//   https://ik.imagekit.io/pi9lsweb7gk/48de16324b94f45c5975ffe8365b3581_image-0.jpeg
			// https://ik.imagekit.io/pi9lsweb7gk/tr:w-495,h-495,c-at_max/8e7c0c86c063904b93552041b1a9d160_photo.jpeg
			//   https://ik.imagekit.io/pi9lsweb7gk/8e7c0c86c063904b93552041b1a9d160_photo.jpeg -- 2000x1700
			// thanks to roi:
			// https://ik.imagekit.io/uwaknajbdrm/https:/img.vt.co/2022/12/TimeFI.jpg?ik-sdk-version=react-1.0.9&tr=f-webp,w-500
			//   https://img.vt.co/2022/12/TimeFI.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+[^/]+\/+(https?):\/\/?([^?#]+)(?:[?#].*)?$/, "$1://$2");
			if (newsrc !== src)
				return newsrc;

			// thanks to anonymous for reporting:
			// https://ik.imagekit.io/ikmedia/site_graphics/customers/logos/Cred_120_45_smnVWQmxd.png?tr=w-20,dpr-2
			//   https://ik.imagekit.io/ikmedia/site_graphics/customers/logos/Cred_120_45_smnVWQmxd.png
			newsrc = src.replace(/(\/ikmedia\/+.*?)(?:[?#].*)?$/, "$1");
			if (newsrc !== src)
				return newsrc;

			newsrc = src.replace(/(:\/\/[^/]+\/+[^/]+\/+)tr:[^/]+\/+/, "$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nowww === "twitch.tv") {
			var fetch_twitch_access_token = function(vid, cb) {
				api_query("twitch_access:" + vid, {
					url: "https://api.twitch.tv/api/vods/" + vid + "/access_token?oauth_token=undefined&need_https=true&platform=_&player_type=site&player_backend=mediaplayer",
					imu_mode: "xhr",
					headers: {
						"accept": "application/vnd.twitchtv.v5+json; charset=UTF-8",
						"client-id": base64_decode("IGtpbW5lNzhreDNuY3g2YnJnbzRtdjZ3a2k1aDFrbw==").substr(1),
						"content-type": "application/json; charset=UTF-8",
						origin: "https://www.twitch.tv",
						referer: "https://www.twitch.tv/",
						"x-requested-with": "XMLHttpRequest"
					},
					json: true
				}, cb, function(done, resp, cache_key) {
					if (!resp.sig && !resp.token) {
						console_error(cache_key, "Unexpected result", resp);
						return done(null, false);
					}

					done(resp, 60*60);
				});
			};

			var get_vod_url = function(vid, token) {
				return "https://usher.ttvnw.net/vod/" + vid + ".m3u8?" + stringify_queries({
					allow_source: "true",
					player_backend: "mediaplayer",
					playlist_include_framerate: "true",
					reassignments_supported: "true",
					sig: token.sig,
					token: encodeURIComponent(token.token)
				});
			};

			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+videos\/+([0-9]+)(?:[?#].*)?$/,
				run: function(cb, match) {
					var id = match[1];

					fetch_twitch_access_token(id, function(token) {
						if (!token)
							return cb(null);

						var page = "https://www.twitch.tv/videos/" + id;

						return cb({
							url: get_vod_url(id, token),
							headers: {
								Referer: page
							},
							extra: {
								page: page
							},
							video: "hls"
						});
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "simsday.com") {
			// https://www.simsday.com/media/448544664ad923f50e4e4ae00742a81f7ecd410d_small
			//   https://www.simsday.com/media/448544664ad923f50e4e4ae00742a81f7ecd410d_original
			return src.replace(/(\/media\/+[0-9a-f]{10,})_(?:[a-z]+)(?:[?#].*)?$/, "$1_original");
		}

		if (domain_nowww === "avalon.red" ||
			// https://www.profimedia.com/564465851
			domain_nowww === "profimedia.com") {
			// the referer/origin (checks both i think?) are important
			var query_profimedia = function(id, domain, cb) {
				api_query("profimedia_" + domain + ":" + id, {
					url: "https://api.solwee.com/api/v1/product/" + id,
					imu_mode: "xhr",
					headers: {
						origin: "https://" + domain,
						referer: "https://" + domain + "/"
					},
					json: true
				}, cb, function(done, resp, cache_key) {
					if (resp.status && resp.status === "error") {
						console_log(cache_key, resp);
						return done(null, false);
					}

					return done(resp, 6*60*60);
				});
			};

			var profimedia_to_obj = function(data, domain) {
				var obj = {
					extra: {
						page: "https://" + domain + "/" + data.productID,
						caption: data.title
					},
					headers: {
						Referer: "https://" + domain + "/",
						Origin: "https://" + domain
					}
				};

				if (/\.{5,}$/.test(data.title)) {
					obj.extra.caption = data.description;
				}

				var urls = [];

				if (data.largeDownloadUrl || data.largePreviewPath) {
					var url = data.largeDownloadUrl || data.largePreviewPath;
					urls.push({
						url: url,
						problems: {
							watermark: true
						}
					});
				}

				if (data.thumbPath) {
					urls.push({
						url: data.thumbPath,
						problems: {
							smaller: true
						}
					});
				}

				return fillobj_urls(urls, obj);
			};

			// thanks to remlap on discord for the link
			// https://www.avalon.red/535869587
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+([0-9]+)(?:[?#].*)?$/,
				run: function(cb, match) {
					var id = match[1];

					query_profimedia(id, domain, function(data) {
						if (!data) return cb(null);

						cb(profimedia_to_obj(data, domain));
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "alternate.nl") {
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/491
			// https://www.alternate.nl/p/120x120/8/9/Thunderstorm_by_Alternate_AMD_RTX_3080_iCue_gaming_pc@@1676898_30.jpg
			//   https://www.alternate.nl/p/o/8/9/Thunderstorm_by_Alternate_AMD_RTX_3080_iCue_gaming_pc@@1676898_30.jpg
			// https://www.alternate.nl/p/120x120/t/SilverStone_SST_FAB1B_RGB_tower_behuizing@@tqxid5.jpg
			//   https://www.alternate.nl/p/o/t/SilverStone_SST_FAB1B_RGB_tower_behuizing@@tqxid5.jpg
			// https://www.alternate.nl/p/120x120/n/Logitech_MX_Keys_Advanced_Wireless_Illuminated_Keyboard@@ntzlzav1_30.jpg
			//   https://www.alternate.nl/p/o/n/Logitech_MX_Keys_Advanced_Wireless_Illuminated_Keyboard@@ntzlzav1_30.jpg
			// https://www.alternate.nl/p/80x80/3/1/razer_blackwidow_v3_pro_gaming_toetsenbord@@1679913_30.jpg
			//   https://www.alternate.nl/p/o/3/1/razer_blackwidow_v3_pro_gaming_toetsenbord@@1679913_30.jpg
			// https://www.alternate.nl/p/80x80/k/razer_razer_kraken_x_for_console____________bk_gaming_headset@@kh-re9.jpg
			//   https://www.alternate.nl/p/o/k/razer_razer_kraken_x_for_console____________bk_gaming_headset@@kh-re9.jpg
			// https://www.alternate.nl/p/80x80/2/4/Razer_DeathAdder_V2_gaming_muis@@1610742.jpg
			//   https://www.alternate.nl/p/o/2/4/Razer_DeathAdder_V2_gaming_muis@@1610742.jpg
			return src.replace(/(:\/\/[^/]+\/+p\/+)[0-9]+x[0-9]+\/+/, "$1o/");
		}

		if (domain_nosub === "pik.ba" && /^s[0-9]*\./.test(domain)) {
			// thanks to keophcp on github: https://github.com/qsniyg/maxurl/issues/492
			// https://s5.pik.ba/galerija/2019-08/14/09/slika-1068915-5d5467db0c8bb-thumb.jpg -- 100x75
			//   https://s5.pik.ba/galerija/2019-08/14/09/slika-1068915-5d5467db0c8bb-default.jpg -- 222x300
			//   https://s5.pik.ba/galerija/2019-08/14/09/slika-1068915-5d5467db0c8bb-velika.jpg -- 800x1079
			return src.replace(/(\/galerija\/+[0-9]{4}-[0-9]{2}\/+(?:[0-9]{2}\/+){2}[a-z]+-[0-9]+-[0-9a-f]{10,})-(?:default|thumb)(\.[^/.]+)(?:[?#].*)?$/, "$1-velika$2");
		}

		if (domain_nowww === "olx.ba") {
			// https://www.olx.ba/common/dizajn/js/fancybox/source/blank.gif
			if (/\/common\/+dizajn\/+js\/+fancybox\/+source\/+blank\.gif(?:[?#].*)?$/.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}
		}

		// Storenvy
		if ((domain_nosub === "storenvy.com" && /^assets[0-9]*\./.test(domain)) ||
			// http://d2a2wjuuf1c30f.cloudfront.net/product_photos/52139630/2118646912_1845346882_original_original_medium.jpg
			//   http://d2a2wjuuf1c30f.cloudfront.net/product_photos/52139630/2118646912_1845346882_original_original_original.jpg
			domain === "d2a2wjuuf1c30f.cloudfront.net" ||
			// http://dlp2gfjvaz867.cloudfront.net/product_photos/62536200/file_e5a4ce5fa4_medium.jpg
			//   http://dlp2gfjvaz867.cloudfront.net/product_photos/62536200/file_e5a4ce5fa4_original.jpg
			// https://dlp2gfjvaz867.cloudfront.net/product_photos/27061005/Opticpus_color2_sm_600w.jpg
			//   https://dlp2gfjvaz867.cloudfront.net/product_photos/27061005/Opticpus_color2_sm_original.jpg
			domain === "dlp2gfjvaz867.cloudfront.net" ||
			// https://d310a9hpolx59w.cloudfront.net/product_photos/83773183/file_c48ee21fff_600w.jpg
			//   https://d310a9hpolx59w.cloudfront.net/product_photos/83773183/file_c48ee21fff_original.jpg
			domain === "d310a9hpolx59w.cloudfront.net" ||
			// https://d111vui60acwyt.cloudfront.net/product_photos/83761585/file_18cff6ef7d_600w.jpg
			//   https://d111vui60acwyt.cloudfront.net/product_photos/83761585/file_18cff6ef7d_600w.jpg
			domain === "d111vui60acwyt.cloudfront.net" ||
			// https://dzasv7x7a867v.cloudfront.net/product_photos/83572984/file_da9fc872a4_600w.jpg
			//   https://dzasv7x7a867v.cloudfront.net/product_photos/83572984/file_da9fc872a4_original.jpg
			//   http://assets.storenvy.com/product_photos/83572984/file_da9fc872a4_original.jpg
			domain === "dzasv7x7a867v.cloudfront.net" ||
			// https://dpegb9ebondhq.cloudfront.net/product_photos/67257984/file_b5631fdaf8_400w.jpg
			///  https://dpegb9ebondhq.cloudfront.net/product_photos/67257984/file_b5631fdaf8_original.jpg
			domain === "dpegb9ebondhq.cloudfront.net" ||
			// https://dpegb9ebondhq.cloudfront.net/product_photos/85727956/file_d0103ea44d_400sq.jpg
			//   https://dpegb9ebondhq.cloudfront.net/product_photos/85727956/file_d0103ea44d_original.jpg
			domain === "dpegb9ebondhq.cloudfront.net" ||
			// https://d1nr5wevwcuzuv.cloudfront.net/product_photos/79753243/file_e813f7a8de_600w.jpg
			//   https://d1nr5wevwcuzuv.cloudfront.net/product_photos/79753243/file_e813f7a8de_original.jpg
			domain === "d1nr5wevwcuzuv.cloudfront.net") {
			// http://assets2.storenvy.com/product_photos/21936/300_small.jpg
			//   http://assets2.storenvy.com/product_photos/21936/300_large.jpg
			//   http://assets2.storenvy.com/product_photos/21936/300_original.jpg
			return src.replace(/(\/product_photos\/[0-9]+\/[^/]*)_(?:small|medium|large|[0-9]+(?:[wh]|sq))(\.[^/.]*)$/, "$1_original$2");
		}

		if (domain_nowww === "drivespark.com") {
			// https://www.drivespark.com/wallimg/660x90/photos/2020-hyundai-palisade/2020-hyundai-palisade-suv-01.jpg
			//   https://www.drivespark.com/wallimg/photos/2020-hyundai-palisade/2020-hyundai-palisade-suv-01.jpg
			return src.replace(/\/wallimg\/+[0-9]+x[0-9]+\/+photos\/+/, "/wallimg/photos/");
		}

		if (domain_nowww === "favcars.com") {
			// https://www.favcars.com/tmp/resize/images_nissan_350z_2002_1_b_r.jpg
			//   https://img.favcars.com/nissan/350z/images_nissan_350z_2002_1.jpg
			// https://www.favcars.com/tmp/resize/honda_hr-v_2001_pictures_1_b_r.jpg
			//   https://www.favcars.com/tmp/resize/honda_hr-v_2001_pictures_1_b.jpg -- 575x400
			//   https://img.favcars.com/honda/hr-v/honda_hr-v_2001_pictures_1_b.jpg -- 575x400
			//   https://img.favcars.com/honda/hr-v/honda_hr-v_2001_pictures_1.jpg
			return src.replace(/^[a-z]+:\/\/[^/]+\/+tmp\/+resize\/+((?:images_)?([^/._]+)_([^/._]+)_[0-9]{4}(?:_pictures)?_[0-9]+)_b(?:_r)?(\.[^/.]+)(?:[?#].*)?$/, "https://img.favcars.com/$2/$3/$1$4");
		}

		if (domain === "img.favcars.com") {
			// https://img.favcars.com/honda/hr-v/honda_hr-v_2001_pictures_1_b.jpg
			//   https://img.favcars.com/honda/hr-v/honda_hr-v_2001_pictures_1.jpg
			return src.replace(/(:\/\/[^/]+\/+[^/]+\/+[^/]+\/+[^/]+)_b(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nosub === "fextralife.com" && /\.wiki\./.test(domain)) {
			// https://theouterworlds.wiki.fextralife.com/file/The-Outer-Worlds/peril-on-gorgon-screenshot2-the-outer-worlds-wiki-guide-small.jpg
			//   https://theouterworlds.wiki.fextralife.com/file/The-Outer-Worlds/peril-on-gorgon-screenshot2-the-outer-worlds-wiki-guide-large.jpg
			return src.replace(/(\/file\/+[^/]+\/+[^/]+-)small(\.[^/.]+)(?:[?#].*)?$/, "$1large$2");
		}

		if (domain === "upload.voxed.net") {
			// https://upload.voxed.net/thumb_VFJ23IFCV2PJ0uiZ9zRC.jpg
			//   https://upload.voxed.net/thumb_VFJ23IFCV2PJ0uiZ9zRC_r.jpg
			//   https://upload.voxed.net/VFJ23IFCV2PJ0uiZ9zRC.jpg
			// https://upload.voxed.net/thumb_JENNZXW_r.jpg -- comment (https://www.voxed.net/a/a0FkheW43PVJtebX9jDF)
			//   https://upload.voxed.net/JENNZXW.png
			// https://upload.voxed.net/thumb_a0FkheW43PVJtebX9jDF.jpg -- can't find an end result, link to yt vid
			newsrc = src.replace(/(:\/\/[^/]+\/+)thumb_([a-zA-Z0-9]+)(?:_r)?(\.[^/.]+)(?:[?#].*)?$/, "$1$2$3");
			if (newsrc !== src)
				return add_extensions(newsrc);
		}

		if (domain_nowww === "vidlii.com") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+(?:watch|embed)\?(?:.*&)?v=([^&]+)/,
				query_for_id: "https://www.vidlii.com/watch?v=${id}",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/viValues\s*=\s*{([\s\S]*?)};\s*for/);
					if (!match) {
						console_error(cache_key, "Unable to find match in", resp);
						return done(null, false);
					}

					var jsobj = match[1];

					var matches = match_all(jsobj, /(?:hd)?src: "(https?:\/\/www\.vidlii\.com\/+usfi\/+v\/+[^"]+)",/);
					if (!matches) {
						console_error(cache_key, "Unable to find sources in", resp, jsobj);
						return done(null, false);
					}

					var urls = [];

					array_foreach(matches, function(match) {
						var url = match[1];

						var urlmatch = url.match(/\/([^/.?#]+)\.([^/.?#]+)\.(?:([0-9]+)\.)?[^/.]+(?:[?#].*)?$/);
						if (!urlmatch) {
							console_error(cache_key, "Unknown url", url);
							return false;
						}

						var quality = urlmatch[3];
						if (!quality) {
							quality = "360";
						}

						urls.push({
							url: url,
							quality: parseInt(quality),
							video: true
						});
					});

					urls = sort_by_key(urls, "quality").reverse();

					// the largest quality may not work
					array_foreach(urls, function(url) {
						delete url.quality;
					});

					var img = get_meta(resp.responseText, "twitter:image");
					if (img) {
						urls.push(img);
					}

					var obj = {
						extra: {
							page: resp.finalUrl
							// todo: caption (meta title, - VidLii?)
						}
					};

					return done(fillobj_urls(urls, obj), 60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "vidlii.com") {
			match = src.match(/\/usfi\/+(?:thmp|prvw)\/+([^/.?#]+)\./);
			if (match) {
				return {
					url: "https://www.vidlii.com/watch?v=" + match[1],
					is_pagelink: true
				};
			}
		}

		if (domain === "cdn-contents-web.weverse.io") {
			// thanks to f2005 on discord
			// https://cdn-contents-web.weverse.io/user/f908599f1d3f4be09741e7774b93d0e8671.jpg?d=xl&download=weverse_moment_f908599f1d3f4be09741e7774b93d0e8671.jpg
			//   https://cdn-contents-web.weverse.io/user/f908599f1d3f4be09741e7774b93d0e8671.jpg
			// thanks to AhnNhan on github: https://github.com/qsniyg/maxurl/pull/504
			// https://cdn-contents-web.weverse.io/user/xlx2048/jpg/878fb1108a4047c4996faa2fca578798148.jpg
			//   https://cdn-contents-web.weverse.io/user/2048x1024/jpg/878fb1108a4047c4996faa2fca578798148.jpg
			//   https://cdn-contents-web.weverse.io/user/878fb1108a4047c4996faa2fca578798148.jpg
			// https://cdn-contents-web.weverse.io/admin/1024x1024/jpg/70ccb991e2e042de88f63f0b2e7656ca055.jpg
			//   https://cdn-contents-web.weverse.io/admin/70ccb991e2e042de88f63f0b2e7656ca055.jpg
			return src
				.replace(/\/(user|admin)\/[0-9a-z]+x[0-9a-z]+\/(?:jpg|png|gif)\//, "/$1/")
				.replace(/[?#].*/, "");
		}

		if (domain_nowww === "efukt.com") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+([0-9]+_[^/]+\.html)(?:[?#].*)?$/,
				query_for_id: "https://efukt.com/${id}",
				process: function(done, resp, cache_key) {
					var sources = common_functions["get_videotag_sources"](resp.responseText);
					if (!sources)
						return done(null, false);

					return done({
						url: sources.video[0].url,
						extra: {
							page: resp.finalUrl
						},
						headers: {
							Referer: resp.finalUrl
						},
						video: true
					}, 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "x17online.com") {
			// https://www.x17online.com/gallery/view/x17_justin_bieber_tahoe_exc_061120
			// https://www.x17online.com/gallery/galleries/2020/06/x17_justin_bieber_tahoe_exc_061120/thumb/x17_justin_bieber_tahoe_exc_061120_01.jpg
			//   https://www.x17online.com/gallery/galleries/2020/06/x17_justin_bieber_tahoe_exc_061120/full/x17_justin_bieber_tahoe_exc_061120_01.jpg
			// https://www.x17online.com/gallery/galleries/2020/06/x17_justin_bieber_tahoe_exc_061120/thumbnail.jpg
			// https://www.x17online.com/gallery/galleries/beiber013111_X17/thumb/beiber013111_01.jpg
			//   https://www.x17online.com/gallery/galleries/beiber013111_X17/full/beiber013111_01.jpg
			return src.replace(/(\/gallery\/+galleries\/+(?:[0-9]{4}\/+[0-9]{2}\/+)?[^/]+\/+)thumb\/+/, "$1full/");
		}

		if (domain_nowww === "tonikawa.com") {
			// thanks to jloqfjgk on github: https://github.com/qsniyg/maxurl/issues/520
			// http://tonikawa.com/assets/images/common/story/ep04/img_2.jpg
			//   http://tonikawa.com/assets/images/common/story/ep04/img_2_l.jpg
			// http://tonikawa.com/assets/images/common/story/ep06/img_5.jpg
			//   http://tonikawa.com/assets/images/common/story/ep06/img_5_l.jpg
			// http://tonikawa.com/assets/images/common/story/ep06/img_10.jpg
			//   http://tonikawa.com/assets/images/common/story/ep06/img_10_l.jpg
			return src.replace(/(\/assets\/+images\/+common\/+story\/+ep[0-9]+\/+img_[0-9]+)(\.[^/.]+)(?:[?#].*)?$/, "$1_l$2");
		}

		if (domain === "static.vaf.be") {
			// https://static.vaf.be/storage/files/7772/crop-263-175-n/TheTie_still_giraffes_at_tree.jpg
			//   https://static.vaf.be/storage/files/7772/resize-2000-2000-n/TheTie_still_giraffes_at_tree.jpg
			//   https://static.vaf.be/storage/files/7772/original/TheTie_still_giraffes_at_tree.jpg
			return src.replace(/(\/storage\/+files\/+[0-9]+\/+)(?:crop|resize)-[^/]+\/+/, "$1original/");
		}

		if (domain_nowww === "cineuropa.org") {
			// https://cineuropa.org/imgCache/2015/08/04/1438697074187_0210x0147_0x1x1283x898_1573331304607.jpg
			//   https://cineuropa.org/imgCache/2015/08/04/1438697074187_1283x0900_0x0x0x0_1573407084823.jpg
			//   https://cineuropa.org/Files/2015/08/04/1438697074187.jpg
			// https://cineuropa.org/en/film/364267/
			// https://cineuropa.org/Galleries/364/267/poster.jpg?1549881979566
			//   https://cineuropa.org/Galleries/364/267/poster_big.jpg?1549881979566
			// https://cineuropa.org/Galleries/364/267/photo3.jpg?1599489704597
			//   https://cineuropa.org/Galleries/364/267/photo3_big.jpg?1599489704597
			// https://cineuropa.org/Galleries/283/424/poster1_en.jpg?1455185809198
			//   https://cineuropa.org/Galleries/283/424/poster1_en_big.jpg?1455185809198
			// https://www.cineuropa.org/Galleries/296/266/poster1.jpg?1443007385535
			//   https://www.cineuropa.org/Galleries/296/266/poster1_big.jpg?1443007385535
			return src
				.replace(/\/imgcache\/+([0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9]+)_[0-9]+x[0-9]+_[0-9]+(?:x[0-9]+){3}_[0-9]+(\.[^/.]+)(?:[?#].*)?$/i, "/Files/$1$2")
				.replace(/(\/galleries\/+[0-9]+\/+[0-9]+\/+(?:poster[0-9]*(?:_[a-z]{2})?|photo[0-9]+))(\.[^/.]+)(?:[?#].*)?$/i, "$1_big$2");
		}

		if (domain === "staticimg.spicyonion.com") {
			// https://staticimg.spicyonion.com/cache/images/profile/title/mookuthi-amman/mookuthi-amman240x320.jpg
			//   https://staticimg.spicyonion.com/images/profile/title/mookuthi-amman/mookuthi-amman.jpg
			return src.replace(/\/cache(\/+images\/+.*?)-?[0-9]+x[0-9]+(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "images.mubicdn.net" ||
			// https://assets.mubicdn.net/images/cast_member/39283/image-w240.jpg?1478101707
			//  https://assets.mubicdn.net/images/cast_member/39283/image-w240.jpg
			//  https://assets.mubicdn.net/images/cast_member/39283/image-original.jpg -- doesn't work
			// https://assets.mubicdn.net/images/notebook/post_spotlight_images/8231/images-w690.jpg
			//   https://assets.mubicdn.net/images/notebook/post_spotlight_images/8231/images-original.jpg -- looks oddly upscaled
			// https://assets.mubicdn.net/images/notebook/post_spotlight_images/8824/images-original.png -- 1438x597, not upscaled
			// https://assets.mubicdn.net/images/cast_member/523655/image-w240.jpg
			//   https://assets.mubicdn.net/images/cast_member/523655/image-original.jpg
			domain === "assets.mubicdn.net") {
			// https://images.mubicdn.net/images/film/77584/cache-87167-1445943264/image-w1280.jpg?size=1200x
			//   https://images.mubicdn.net/images/film/77584/cache-87167-1445943264/image-original.jpg
			// https://images.mubicdn.net/images/film/186296/image-w1280.jpg?size=740x
			//   https://images.mubicdn.net/images/film/186296/image-w1280.jpg -- -original doesn't work
			// https://images.mubicdn.net/images/film/301931/cache-866219-1689863880/image-w1280.jpg -- 1280x720
			//   https://images.mubicdn.net/images/film/301931/image-original.jpeg

			// different: https://github.com/qsniyg/maxurl/issues/675 (thanks to TheLastZombie for reporting)
			// https://images.mubicdn.net/images/film/781/cache-47795-1605261679/image-w1280.jpg
			//   https://images.mubicdn.net/images/film/781/cache-47795-1605261679/image-original.jpg
			// https://images.mubicdn.net/images/film/781/image-w1280.jpg
			//   https://images.mubicdn.net/images/film/781/image-original.jpg
			// https://images.mubicdn.net/images/film/603/cache-33536-1578611751/image-w1280.jpg
			//   https://images.mubicdn.net/images/film/603/cache-33536-1578611751/image-original.jpg
			newsrc = src.replace(/[?#].*$/, "");
			if (newsrc !== src) return newsrc;

			// thanks to anonymous for reporting:
			// https://images.mubicdn.net/images/cast_member/64528/cache-279867-1510739650/image-w856.jpg -- 1280x1519
			//   https://images.mubicdn.net/images/cast_member/64528/image-w856.jpg
			//   https://images.mubicdn.net/images/cast_member/64528/image-original.jpg -- 1280x977 - uncropped, but smaller
			newsrc = src.replace(/\/cache-[0-9]+-[0-9]+\//, "/");
			if (newsrc !== src) return newsrc;

			newsrc = src.replace(/(\/images\/+(?:[^/]+\/+)?(?:[0-9]+\/+[^/]+|[^/]+\/+[0-9]+)\/+images?-)[wh][0-9]+(\.[^/.]+)$/, "$1original$2");
			if (newsrc !== src) {
				return fillobj_urls(add_extensions_jpeg(newsrc), {
					problems: {possibly_different: true}
				});
			}
		}

		if (domain === "d2t8nixuow17vt.cloudfront.net") {
			// https://d2t8nixuow17vt.cloudfront.net/web/blank.png
			if (/\/web\/+blank\.png(?:[?#].*)?$/.test(src))
				return {
					url: src,
					bad: "mask"
				};
		}

		if (domain_nosub === "simkl.in") {
			// https://us.simkl.in/img_tv/tv_avatar_sun_blur.png
			// https://eu.simkl.in/img_tv/tv_avatar_sun_blur.png
			if (/\/img_tv\/+tv_avatar_sun_blur\.png(?:[?#].*)?$/.test(src))
				return {
					url: src,
					bad: "mask"
				};

			// https://simkl.in/posters/10/104284781e58c10816_ca.webp
			//   https://simkl.in/posters/10/104284781e58c10816_0.jpg
			return src.replace(/(\/posters\/+[0-9a-f]{2}\/+[0-9a-f]{10,})_[a-z]+\.(?:jpg|webp)(?:[?#].*)?$/, "$1_0.jpg");
		}

		if (host_domain_nosub === "simkl.ru" && options.element) {
			var current = options.element;
			do {
				if (current.classList.contains("SimklTVPosterImgLargeHover") ||
					current.classList.contains("SimklTVMovieDetailTrailerBorder")) {
					return {
						url: origsrc,
						bad: "mask"
					};
				}
			} while (current = current.parentElement);
		}

		if (domain_nowww === "skeb.jp") {
			// https://skeb.jp/@Kusi_zaki/works/7
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+(@[^/]+)\/+works\/+([0-9]+)(?:[?#].*)?$/,
				query_for_id: "https://skeb.jp/${1}/works/${2}",
				process: function(done, resp, cache_key, match) {
					var match = resp.responseText.match(/<div class="image"[^>]+><img src="(https?:\/\/skeb\.imgix\.[^"]+)"/);
					if (!match) {
						console_error(cache_key, "Unable to find image match for", resp);
						return done(null, false);
					}

					var imgsrc = decode_entities(match[1]);

					var description = null;
					var ld_json = resp.responseText.match(/<script[^>]+ data-hid="ld\+json:Article" type="application\/ld\+json">\s*({.*?})\s*<\/script>/);
					if (ld_json) {
						var json = JSON_parse(ld_json[1]);
						description = json.headline;
					}

					var obj = {
						extra: {
							page: resp.finalUrl,
							caption: description || void 0
						},
						url: imgsrc
					};

					return done(obj, 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (host_domain_nowww === "skeb.jp") {
			var newsrc = common_functions["get_pagelink_el_matching"](options.element, /^[a-z]+:\/\/(?:www\.)?skeb\.jp\/+@[^/]+\/+works\/+[0-9]+(?:[?#].*)?$/);
			if (newsrc) return newsrc;
		}

		if (host_domain_nowww === "apprentus.com" && options.element) {
			if (!src && origsrc && options.element.tagName === "DIV" && options.element.classList.contains("photo-area-photo")) {
				return {
					url: origsrc,
					bad: "mask"
				};
			}
		}

		if (domain_nowww === "kinonews.ru") {
			// https://www.kinonews.ru/insimgs/2019/poster/thumbs/poster89526_1.jpg
			//   https://www.kinonews.ru/insimgs/2019/poster/poster89526_1.jpg
			// https://www.kinonews.ru/insimgs/2019/trailer/thumbs/trailer91022.jpg
			//   https://www.kinonews.ru/insimgs/2019/trailer/trailer91022.jpg
			// https://www.kinonews.ru/insimgs/2020/newsimg/newsimg94786p.jpg
			//   https://www.kinonews.ru/insimgs/2020/newsimg/newsimg94786.jpg
			// https://www.kinonews.ru/insimgs/2020/artimg/artimg92036p.jpg
			//   https://www.kinonews.ru/insimgs/2020/artimg/artimg92036.jpg
			// https://www.kinonews.ru/insimgs/poster/thumbs/poster3136_3.jpg
			//   https://www.kinonews.ru/insimgs/poster/poster3136_3.jpg
			return src
				.replace(/(\/insimgs\/+(?:[0-9]+\/+)?[a-z]+\/+)thumbs\/+([a-z]+[0-9]+)/, "$1$2")
				.replace(/(\/insimgs\/+(?:[0-9]+\/+)?[a-z]+\/+[a-z]+[0-9]+)p(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "hk.on.cc") {
			// https://hk.on.cc/hk/bkn/cnt/entertainment/20150805/photo/bkn-20150805155943017-0805_00862_001_01s.jpg?20150805162339
			//   https://hk.on.cc/hk/bkn/cnt/entertainment/20150805/photo/bkn-20150805155943017-0805_00862_001_01b.jpg?20150805162339 -- 750x1125
			// https://hk.on.cc/hk/bkn/cnt/news/20200714/photo/bkn-20200714040021023-0714_00822_001_01p.jpg?20200714064909 -- 608x435
			//   https://hk.on.cc/hk/bkn/cnt/news/20200714/photo/bkn-20200714040021023-0714_00822_001_01b.jpg?20200714064909 -- 780x558
			// https://hk.on.cc/hk/bkn/cnt/entertainment/20170402/photo/bkn-20170402180002743-0402_00862_001_04p.jpg?20170402180614 -- 608x1706
			//   https://hk.on.cc/hk/bkn/cnt/entertainment/20170402/photo/bkn-20170402180002743-0402_00862_001_04b.jpg?20170402180614 -- 780x2188
			// b is largest, p is smaller, n == p (but sometimes without watermark), s is smallest
			return src.replace(/(\/photo\/+bkn-[0-9]{10,}-[0-9]+_[0-9]+_[0-9]+_[0-9]+)[sp](\.[^/.]+(?:[?#].*)?)$/, "$1b$2");
		}

		if (domain === "thumb.pr0gramm.com" ||
			// thanks to Lumbago1337 on github: https://github.com/qsniyg/maxurl/issues/924
			// https://img.pr0gramm.com/2021/10/29/490200ed6617876e.jpg -- 1052x1402
			//   https://full.pr0gramm.com/2021/10/29/490200ed6617876e.jpg -- 2976x3968
			domain === "img.pr0gramm.com") {
			// https://thumb.pr0gramm.com/2020/11/13/57c423d54cd89e20.jpg
			//   https://img.pr0gramm.com/2020/11/13/57c423d54cd89e20.png
			newsrc = src.replace(/^[a-z]+:\/\/thumb(\.[^/]+\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9a-f]{10,}\.[^/.]+)(?:[?#].*)?$/, "https://img$1");
			if (newsrc !== src)
				return add_extensions(newsrc);

			newsrc = src.replace(/^[a-z]+:\/\/img(\.[^/]+\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9a-f]{10,}\.[^/.]+)(?:[?#].*)?$/, "https://full$1");
			if (newsrc !== src)
				return add_extensions(newsrc);
		}

		if (domain_nowww === "pr0gramm.com") {
			// https://pr0gramm.com/top/4236533
			// https://pr0gramm.com/new/4236533
			var query_pr0gramm = function(id, cb) {
				api_query("pr0gramm:" + id, {
					url: "https://pr0gramm.com/api/items/get?id=" + id + "&flags=1",
					imu_mode: "xhr",
					headers: {
						"Accept": "application/json, text/javascript, */*; q=0.01",
						"x-requested-with": "XMLHttpRequest",
						"Referer": "https://pr0gramm.com/new/" + id
					},
					json: true
				}, cb, function(done, resp, cache_key) {
					var items = resp.items;
					var found = false;

					array_foreach(items, function(item) {
						// == is intentional for string/int comparison
						if (item.id != id) {
							return;
						}

						// maybe check item.source too?
						var image = urljoin("https://img.pr0gramm.com/", item.image, true);

						done(image, 6*60*60);
						found = true;
						return false;
					});

					if (!found) return done(null, false);
				});
			}
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+(?:top|new)\/+([0-9]+)(?:[?#].*)?$/,
				run: function(cb, match) {
					var id = match[1];

					query_pr0gramm(id, cb);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "i.jeded.com") {
			// https://i.jeded.com/i/soorarai-pottru.135-195974.jpg
			//   https://i.jeded.com/i/soorarai-pottru.195974.jpg
			return src.replace(/(\/i\/+[^/]+\.)[0-9]+-([0-9]+\.)/, "$1$2");
		}

		if (false && domain === "article-image-ix.nikkei.com") {
			// imgix?
			// https://article-image-ix.nikkei.com/https%3A%2F%2Fimgix-proxy.n8s.jp%2FDSXMZO6618349013112020FFE001-2.jpg?w=900&h=600&auto=format%2Ccompress&ch=Width%2CDPR&q=45&fit=crop&crop=faces%2Cedges&txtfont=Hiragino%20Kaku%20Gothic%20StdN&txtpad=8&txtsize=12&txtclr=FFFFFF&txtlineclr=000000&txtshad=4&txt=%E3%83%AD%E3%82%A4%E3%82%BF%E3%83%BC&txtalign=left%2C%20bottom&ixlib=js-1.4.1&s=bdcf9221e376398e45215ad131f44db0
			//   https://imgix-proxy.n8s.jp/DSXMZO6618349013112020FFE001-2.jpg -- 403
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+(https?%3A[^?#]+)(?:[?#].*)?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		// https://demo.ghost.io/
		// https://github.com/TryGhost/Ghost/blob/34d2cc1b0b022895c621aeb8e26ad48bf8f81357/core/server/web/site/middleware/handle-image-sizes.js
		if (domain === "blog.froggi.es" ||
			// thanks to anonymous for reporting:
			// https://itsfoss.com/content/images/size/w100/format/webp/2024/05/esssential-linux-commands-for-malware-analysis.png
			//   https://itsfoss.com/content/images/2024/05/esssential-linux-commands-for-malware-analysis.png
			domain_nowww === "itsfoss.com" ||
			// thanks to Noodlers on discord:
			// https://blog.emojipedia.org/content/images/size/w300/2021/04/new-twemoji-2021-emojipedia.jpg
			//   https://blog.emojipedia.org/content/images/size/w2000/2021/04/new-twemoji-2021-emojipedia.jpg
			//   https://blog.emojipedia.org/content/images/2021/04/new-twemoji-2021-emojipedia.jpg -- 2000x942
			domain === "blog.emojipedia.org") {
			// https://blog.froggi.es/content/images/size/w1000/2020/11/image-6.png
			//   https://blog.froggi.es/content/images/2020/11/image-6.png
			// https://blog.froggi.es/content/images/size/w2400/2020/11/image-2.png -- 2402x1390
			//   https://blog.froggi.es/content/images/2020/11/image-2.png -- 2000x1157, downscaled
			// /size/original/ redirects to /content/images/, but is not the original size for the control trace
			//return src.replace(/(\/content\/+images\/+)size\/+[wh](?:1?[0-9]{1,3}|2000)\/+/, "$1");
			return src.replace(/(\/content\/+images\/+)(?:(?:size|format)\/+[^/]+\/+)+/, "$1");
		}

		if (domain === "em-content.zobj.net") {
			// thanks to ljcool2006 on github: https://github.com/qsniyg/maxurl/issues/1178
			// https://em-content.zobj.net/thumbs/120/apple/354/television_1f4fa.png
			//   https://em-content.zobj.net/source/apple/354/television_1f4fa.png
			return src.replace(/\/thumbs\/+[0-9]+\/+/, "/source/");
		}

		if (domain_nowww === "indeed.com") {
			// https://www.indeed.com/cmp/_s/photos/7438312c6b0b23ee-s-1dm7bpdgt5ndt800 -- 64x48
			//   https://www.indeed.com/cmp/_s/photos/7438312c6b0b23ee-t-1dm7bpdgt5ndt800 -- 136x102
			//   https://www.indeed.com/cmp/_s/photos/7438312c6b0b23ee-sqt-1dm7bpdgt5ndt800 -- 156x156
			//   https://www.indeed.com/cmp/_s/photos/7438312c6b0b23ee-l-1dm7bpdgt5ndt800 -- 604x453
			return src.replace(/(\/cmp\/+_s\/+photos\/+[0-9a-f]+)-[stq]+-/, "$1-l-");
		}

		if (domain === "data.pixiz.com") {
			// https://data.pixiz.com/output/user/frame/preview/130x130/3/5/4/6/3506453_eb00c.jpg
			//   https://data.pixiz.com/output/user/frame/preview/api/big/3/5/4/6/3506453_eb00c.jpg
			return src.replace(/(\/output\/+user\/+frame\/+preview\/+)[0-9]+x[0-9]+\/+/, "$1api/big/");
		}

		if (domain === "embed.indavideo.hu") {
			var query_indavideo = function(id, cb) {
				var jqcb = common_functions["gen_jquery_callback"]();
				var now = Date.now() + 1;
				api_query("indavideo:" + id, {
					// /hash/12/md5(videopassword?)/userdata.psid?//?hosted&...
					url: "https://amfphp.indavideo.hu/SYm0json.php/player.playerHandler.getVideoData/" + id + "/12////?directlink&callback=" + jqcb + "&_=" + now,
					headers: {
						Accept: "*/*",
						Referer: "https://embed.indavideo.hu/",
						"Sec-Fetch-Dest": "script",
						"Sec-Fetch-Mode": "no-cors",
						"Sec-Fetch-Site": "same-site"
					},
					jsonp: true
				}, cb, function(done, resp, cache_key) {
					console_log(resp);
					var data = resp.data;

					var videos = [];

					var resolutions = {};
					var maxresolution = 0;
					array_foreach(data.video_files, function(vid) {
						var resmatch = vid.match(/.*\/[^/]+\.([0-9]+)\.mp4(?:[?#].*)?$/, "$1");
						if (!resmatch) {
							console_error(cache_key, "Unable to find resolution for", vid);
							return;
						}

						var res = parseInt(resmatch[1]);
						if (!(res in data.filesh)) {
							console_error(cache_key, "Hash not found for resolution", res);
							return;
						}

						var newurl = vid + "&token=" + data.filesh[resmatch[1]];

						videos.push(newurl);
						resolutions[res] = newurl;

						if (res > maxresolution) {
							maxresolution = res;
						}
					});

					var baseobj = {
						extra: {
							page: urljoin("https://indavideo.hu/", data.video_url, true),
							caption: data.title
						}
					};

					var urls = [];

					var maxurl = resolutions[maxresolution];
					if (maxurl) {
						urls.push({
							url: maxurl,
							video: true
						});
					}

					if (data.video_img) {
						urls.push(data.video_img);
					}

					return done(fillobj_urls(urls, baseobj), 6*60*60);
				});
			};

			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+player\/+video\/+([0-9a-f]+)\/*(?:[?#].*)?$/,
				run: function(cb, match) {
					var id = match[1];
					query_indavideo(id, cb);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nosub === "indavideo.hu") {
			// https://assets.indavideo.hu/images/default/video_box/hungary.jpg
			if (/\/images\/+default\/+video_box\/+hungary\.jpg/.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}

			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+video\/+([^/.?#]+)(?:[?#].*)?$/,
				query_for_id: "https://" + domain + "/video/${id}",
				process: function(done, resp, cache_key) {
					var embedurl = get_meta(resp.responseText, "og:video:secure_url");
					if (!embedurl) {
						console_error(cache_key, "Unable to find embed URL for", resp);
						return done(null, false);
					}

					return done({
						url: embedurl,
						is_pagelink: true
					}, 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "a.simbi.com") {
			// thanks to fedesk on discord
			// https://a.simbi.com/images/188975/images/medium-41d5f0cf74bd74cf209ef2be512b8738.jpg
			//   https://a.simbi.com/images/188975/images/original-41d5f0cf74bd74cf209ef2be512b8738.jpg -- 3456x2730
			// https://a.simbi.com/images/26359/images/medium-ab92b787c8fce35c1061255e96d9f57a.jpg
			//   https://a.simbi.com/images/26359/images/original-ab92b787c8fce35c1061255e96d9f57a.jpeg
			// https://a.simbi.com/users/7465/avatars/thumb-13816d69bbad69c2ad900c70b68a8a7a.jpg?1588774740
			//   https://a.simbi.com/users/7465/avatars/original-13816d69bbad69c2ad900c70b68a8a7a.jpg?1588774740
			newsrc = src.replace(/(\/(?:images|users)\/+[0-9]+\/+(?:images|avatars)\/+)[a-z]+-([0-9a-f]{20,}\.[^/.]+)(?:[?#].*)?$/, "$1original-$2");
			if (newsrc !== src)
				return add_full_extensions(newsrc);
		}

		if (domain_nowww === "vlive.tv") {
			var vlive_token = base64_decode("IDhjNmNjN2I0NWQyNTY4ZmI2NjhiZTZlMDViNmU1YTNi").substr(1);
			var get_vlive_inkey = function(vid, cb) {
				api_query("vlive_inkey:" + vid, {
					url: "https://www.vlive.tv/globalv-web/vam-web/video/v1.0/vod/" + vid + "/inkey?appId=" + vlive_token + "&platformType=PC",
					imu_mode: "xhr",
					json: true,
					headers: {
						Accept: "application/json, text/plain, */*",
						Referer: "https://www.vlive.tv/video/" + vid
					}
				}, cb, function(done, resp, cache_key) {
					if (!resp.inkey) {
						console_error(cache_key, "Unable to find inkey for", vid);
						return done(null, false);
					}

					return done(resp.inkey, 60*60);
				});
			};

			var get_vlive_vodinfo = function(inkey, vid, cb) {
				var url = "https://apis.naver.com/rmcnmv/rmcnmv/vod/play/v2.0/";
				url += vid;
				url += "?key=" + inkey;
				url += "&ver=2.0&devt=html5_mo&doct=json&ptc=https&sptc=https&cpt=vtt";
				url += "&videoId=" + vid;

				api_query("vlive_inkey:" + vid, {
					url: url,
					imu_mode: "xhr",
					json: true,
					headers: {
						Accept: "*/*",
						Origin: "https://www.vlive.tv",
						Referer: "https://www.vlive.tv/",
						"sec-fetch-site": "cross-site"
					}
				}, cb, function(done, resp, cache_key) {
					var vids = resp.videos.list;

					vids.sort(function(a, b) {
						return b.bitrate.video - a.bitrate.video;
					});

					var urls = [];

					var obj = {
						extra: {
							page: resp.meta.url
						}
					};

					array_foreach(vids, function(vid) {
						urls.push({
							url: vid.source,
							height: vid.encodingOption.height,
							width: vid.encodingOption.width,
							video: true
						});
					});

					return done(fillobj_urls(urls, obj), 60*60);
				});
			};

			var get_vlive_vidinfo_from_url = function(url, cb) {
				api_query("vlive_vidinfo:" + url, {
					url: url,
					imu_mode: "document"
				}, cb, function(done, resp, cache_key) {
					var match = resp.responseText.match(/<script type="text\/javascript">window\.__PRELOADED_STATE__=({.*?})<\/script>/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					var json = JSON_parse(match[1]);
					var vidinfo = json.postDetail.post.officialVideo;

					if (!vidinfo) {
						console_error(cache_key, "Unable to find video info in", json);
						return done(null, false);
					}

					return done(vidinfo, 60*60);
				});
			};

			var get_vlive_vodid_from_vid = function(vid, cb) {
				api_cache.fetch("vlive_vodid:" + vid, cb, function(done) {
					get_vlive_vidinfo_from_url("https://www.vlive.tv/video/" + vid, function(vidinfo) {
						var vodid = vidinfo.vodId;
						return done(vodid, 6*60*60);
					});
				});
			};

			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+video\/+([0-9]+)(?:[?#].*)?$/,
				run: function(cb, match) {
					var vid = match[1];

					get_vlive_vodid_from_vid(vid, function(vodid) {
						if (!vodid) return cb(null);

						get_vlive_inkey(vid, function(key) {
							if (!key) return cb(null);

							get_vlive_vodinfo(key, vodid, cb);
						});
					});
				}
			});
			if (newsrc) return newsrc;

			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+post\/+([0-9]+-[0-9]+)(?:[?#].*)?$/,
				run: function(cb, match) {
					var postid = match[1];

					get_vlive_vidinfo_from_url("https://www.vlive.tv/post/" + postid, function(vidinfo) {
						if (!vidinfo) return cb(null);

						var vid = vidinfo.videoSeq;
						var vodid = vidinfo.vodId;

						get_vlive_inkey(vid, function(key) {
							if (!key) return cb(null);

							get_vlive_vodinfo(key, vodid, cb);
						});
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "img.marieclairekorea.com") {
			// http://img.marieclairekorea.com/2018/03/mck_5a9de416ee7a4-570x381.jpg
			//   http://img.marieclairekorea.com/2018/03/mck_5a9de416ee7a4.jpg
			// thanks to rEnr3n on github: https://github.com/qsniyg/maxurl/issues/530
			// https://img.marieclairekorea.com/2020/11/mck_5fb36322aa3c3-scaled.jpg -- 1920x1516
			//   https://img.marieclairekorea.com/2020/11/mck_5fb36322aa3c3.jpg -- 2244x1772
			return src.replace(/(\/mck_[0-9a-f]+)-(?:[0-9]+x[0-9]+|scaled)(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "nrk.no" ||
			domain === "static.nrk.no") {
			// thanks to fedesk on discord for reporting
			// https://www.nrk.no/video/regjeringa-aatvarar-mot-framtidige-pensjonskostnader_69e67b21-79ba-4973-a86a-65a246813bf1
			// https://static.nrk.no/ludo/latest/video-embed.html#id=143167&referrer=https%3A%2F%2Fp3.no%2Fmusikk%2Fchristine-live-sigrid-raabe%2F
			// https://www.nrk.no/video/aapning-byscene-aalesund_205824
			var query_nrk = function(vid, cb) {
				api_query("nrk:" + vid, {
					url: "https://psapi.nrk.no/playback/manifest/clip/" + vid,
					imu_mode: "xhr",
					headers: {
						Accept: "application/vnd.nrk.psapi+json; version=9; ludo-client=true; psapi=snapshot",
						Referer: "https://www.nrk.no/"
					},
					json: true
				}, cb, function(done, resp, cache_key) {
					var asset = resp.playable.assets[0];
					if (asset.format !== "HLS") {
						console_error(cache_key, "Unknown format for", asset);
						return done(null, false);
					}

					return done({
						url: asset.url,
						video: "hls"
					}, 70*60);
				});
			};

			newsrc = website_query({
				website_regex: [
					// video/{embed,musikk}/
					/^[a-z]+:\/\/[^/]+\/+video\/+(?:[a-z]+\/+)?(?:[^/.?#]+_)?([-0-9a-f]{20,}|[0-9]+)(?:[?#].*)?$/,
					/^[a-z]+:\/\/[^/]+\/+[^/]+\/+[^/]+\/+video-embed\.html#(?:.*&)?id=([0-9]+)(?:&.*)?$/
				],
				run: function(cb, match) {
					query_nrk(match[1], cb);
				}
			});
			if (newsrc) return newsrc;
		}

		if (host_domain_nowww === "nrk.no" && options.element) {
			// https://www.nrk.no/norge/regjeringa-har-rekna-pa-pensjonsforslag-_-atvarar-om-milliardrekning-1.15251156
			if (options.element.tagName === "VIDEO" && !src) {
				var current = options.element;
				while (current = current.parentElement) {
					if (current.tagName === "FIGURE" && current.hasAttribute("data-canonical-url")) {
						return {
							url: current.getAttribute("data-canonical-url"),
							is_pagelink: true
						};
					}
				}

				if (/^[a-z]+:\/\/[^/]+\/+video\/+(?:[a-z]+\/+)?(?:[^/.?#]+_)?([-0-9a-f]{20,}|[0-9]+)(?:[?#].*)?$/.test(options.host_url)) {
					return {
						url: options.host_url,
						is_pagelink: true
					};
				}
			}

			if (domain === "gfx.nrk.no" && options.element.tagName === "IMG") {
				regex = /^([0-9]+\.[0-9]+)\.[0-9a-f]+$/;
				var el = common_functions["get_parent_el_matching"](options.element, function(x) {
					return x.tagName === "FIGURE";
				});

				id = null;
				if (el) {
					while (el = el.previousSibling) {
						if (el.nodeName === "#comment") {
							var text = el.textContent;
							var match = text.match(/\/render\?(?:.*&amp;)?id=([0-9]+\.[0-9]+)/);
							if (match) {
								id = match[1];
								break;
							}
						}
					}
				}

				if (id && options.do_request && options.cb) {
					api_query("nrk:" + id, {
						url: "https://www.nrk.no/serum/api/imagecrop/" + id,
						method: "HEAD"
					}, options.cb, function(done, resp, cache_key) {
						return done(resp.finalUrl, 6*60*60);
					});

					return {
						waiting: true
					};
				}
			}
		}

		if (domain_nowww === "local12.com" ||
			// https://static-23.sinclairstoryline.com/resources/media/2e3255e9-6ac3-487b-84a4-cd179d2879b8-smallScale_AP18127829228703.jpg?1525740565492
			//   https://static-23.sinclairstoryline.com/resources/media/2e3255e9-6ac3-487b-84a4-cd179d2879b8-AP18127829228703.jpg?1525740565492
			// other urls:
			// http://static-14.sinclairstoryline.com/resources/media/9f010684-84f8-4607-a03c-43b92bc593e4-smallScale_antman_and_the_wasp_ver11_xlg.jpg?1530294970204
			//   https://static-35.sinclairstoryline.com/resources/media/5db35fc1-3731-45d0-a6f0-d5c554e98fb5-antman_and_the_wasp_ver11_xlg.jpg
			(domain_nosub === "sinclairstoryline.com" && domain.match(/^static-[0-9]*\./)) ||
			// thanks to roi:
			// https://nbc16.com/resources/media2/36x25/full/372/center/80/59d5d1e6-1b1f-4976-8218-635f47aaf384-jumbo36x25_8OregonvsWashington_.jpg
			//   https://nbc16.com/resources/media/59d5d1e6-1b1f-4976-8218-635f47aaf384-jumbo36x25_8OregonvsWashington_.jpg
			//   https://nbc16.com/resources/media/59d5d1e6-1b1f-4976-8218-635f47aaf384-8OregonvsWashington_.jpg
			domain_nowww === "nbc16.com" ||
			// thanks to anonymous for reporting:
			// https://nbcmontana.com/resources/media2/16x9/full/1015/center/80/c3c31627-bdf3-457c-b9a0-b8135fe3bc9f-large16x9_ScottStreetDevelopmentCeremonyMap.jpg
			//   https://nbcmontana.com/resources/media/c3c31627-bdf3-457c-b9a0-b8135fe3bc9f-ScottStreetDevelopmentCeremonyMap.jpg
			domain_nowww === "nbcmontana.com" ||
			// thanks to roi:
			// https://bakersfieldnow.com/resources/media2/16x9/full/1015/center/80/76d4eb14-462d-4a31-85c1-961a36c4f0cd-large16x9_poster_9e85cfbac04f4757a6544b28e4450ec4.png
			//   https://bakersfieldnow.com/resources/media/76d4eb14-462d-4a31-85c1-961a36c4f0cd-large16x9_poster_9e85cfbac04f4757a6544b28e4450ec4.png
			//   https://bakersfieldnow.com/resources/media/76d4eb14-462d-4a31-85c1-961a36c4f0cd-poster_9e85cfbac04f4757a6544b28e4450ec4.png
			// https://bakersfieldnow.com/resources/media/8693d77c-c3ba-42d5-88ba-2cf3867e23d6-large16x9_SWO2.jpg
			//   https://bakersfieldnow.com/resources/media/8693d77c-c3ba-42d5-88ba-2cf3867e23d6-SWO2.jpg
			// https://bakersfieldnow.com/resources/media/8693d77c-c3ba-42d5-88ba-2cf3867e23d6-small16x9_SWO2.jpg
			//   https://bakersfieldnow.com/resources/media/8693d77c-c3ba-42d5-88ba-2cf3867e23d6-SWO2.jpg
			domain_nowww === "bakersfieldnow.com") {
			// https://local12.com/news/offbeat/his-majesty-thats-how-a-wisconsin-woman-describes-her-backyard-find
			// https://local12.com/resources/media/7e597db3-ce7a-4025-a79e-5006e40343d1-large16x9_126412251_196313765281768_6827705181190257430_n.jpg?1605799649079
			// {
			// 	"type": "Image",
			// 	"uuid": "47da78b3-fa25-473c-9892-174a4d54b03d",
			// 	"title": "Albino buck",
			// 	"updatedBy": "Sarah Caviness",
			// 	"created": 1605827986000,
			// 	"version": 4,
			// 	"caption": "Albino buck spotted in Boulder Junction Nov. 15, 2020 (Courtesy: Tracy Weese)",
			// 	"description": "126412251_196313765281768_6827705181190257430_n.jpg",
			// 	"externalId": "8461145b-937b-4ff7-b37e-6c92dced040a",
			// 	"versionSetUuid": "7e597db3-ce7a-4025-a79e-5006e40343d1",
			// 	"alt": "126412251_196313765281768_6827705181190257430_n.jpg",
			// 	"original": "false",
			// 	"metadata": "{}",
			// 	"orderNumber": 1,
			// 	"brandUuid": "544d6128-f11b-471c-b0b9-00124fc30856",
			// 	"originalUrl": "/resources/media/8461145b-937b-4ff7-b37e-6c92dced040a-126412251_196313765281768_6827705181190257430_n.jpg",
			// 	"height": 4032,
			// 	"width": 3024,
			// 	"large16x9Url": "/resources/media/7e597db3-ce7a-4025-a79e-5006e40343d1-large16x9_126412251_196313765281768_6827705181190257430_n.jpg?1605799649079",
			// 	"medium16x9Url": "/resources/media/7e597db3-ce7a-4025-a79e-5006e40343d1-medium16x9_126412251_196313765281768_6827705181190257430_n.jpg?1605799657244",
			// 	"small16x9Url": "/resources/media/7e597db3-ce7a-4025-a79e-5006e40343d1-small16x9_126412251_196313765281768_6827705181190257430_n.jpg?1605799648960",
			// 	"large36x25Url": "/resources/media/7e597db3-ce7a-4025-a79e-5006e40343d1-large36x25_126412251_196313765281768_6827705181190257430_n.jpg?1605799649708",
			// 	"medium36x25Url": "/resources/media/7e597db3-ce7a-4025-a79e-5006e40343d1-medium36x25_126412251_196313765281768_6827705181190257430_n.jpg?1605799655467",
			// 	"small36x25Url": "/resources/media/7e597db3-ce7a-4025-a79e-5006e40343d1-small36x25_126412251_196313765281768_6827705181190257430_n.jpg?1605799651823",
			// 	"large1x1Url": "/resources/media/7e597db3-ce7a-4025-a79e-5006e40343d1-large1x1_126412251_196313765281768_6827705181190257430_n.jpg?1605799651943",
			// 	"medium1x1Url": "/resources/media/7e597db3-ce7a-4025-a79e-5006e40343d1-medium1x1_126412251_196313765281768_6827705181190257430_n.jpg?1605799654043",
			// 	"small1x1Url": "/resources/media/7e597db3-ce7a-4025-a79e-5006e40343d1-small1x1_126412251_196313765281768_6827705181190257430_n.jpg?1605799652323",
			// 	"largeScaleUrl": "/resources/media/7e597db3-ce7a-4025-a79e-5006e40343d1-largeScale_126412251_196313765281768_6827705181190257430_n.jpg?1605799654043",
			// 	"smallScaleUrl": "/resources/media/7e597db3-ce7a-4025-a79e-5006e40343d1-smallScale_126412251_196313765281768_6827705181190257430_n.jpg?1605799652738",
			// 	"originalBlurUrl": "/resources/media/7e597db3-ce7a-4025-a79e-5006e40343d1-originalBlur_126412251_196313765281768_6827705181190257430_n.jpg?1605799668392",
			// 	"largeBlurUrl": "/resources/media/7e597db3-ce7a-4025-a79e-5006e40343d1-largeBlur_126412251_196313765281768_6827705181190257430_n.jpg?1605799655023",
			// 	"smallBlurUrl": "/resources/media/7e597db3-ce7a-4025-a79e-5006e40343d1-smallBlur_126412251_196313765281768_6827705181190257430_n.jpg?1605799656623",
			// 	"isGif": false,
			// 	"jumbo16x9Url": "/resources/media/7e597db3-ce7a-4025-a79e-5006e40343d1-jumbo16x9_126412251_196313765281768_6827705181190257430_n.jpg?1605799649120",
			// 	"jumbo36x25Url": "/resources/media/7e597db3-ce7a-4025-a79e-5006e40343d1-jumbo36x25_126412251_196313765281768_6827705181190257430_n.jpg?1605799651139",
			// 	"large3x4Url": "/resources/media/7e597db3-ce7a-4025-a79e-5006e40343d1-large3x4_126412251_196313765281768_6827705181190257430_n.jpg?1605799649834"
			// }
			// https://local12.com/resources/media/5442c3b7-3e36-4aa8-9e28-5fec812dae57-large16x9_genericfirenightCROSBYFIRE.transfer_frame_2149.png?1605906079889
			//   https://local12.com/resources/media/5442c3b7-3e36-4aa8-9e28-5fec812dae57-genericfirenightCROSBYFIRE.transfer_frame_2149.png?1605906079889
			newsrc = src
				.replace(/(\/resources\/+media\/+[-0-9a-f]{20,})-(?:large|medium|small|jumbo)(?:[0-9]+x[0-9]+|Blur|Scale)_/, "$1-")
				//.replace(/(\/resources\/+media\/+[-0-9a-f]{10,})-(?:[a-z]+Scale|(?:small|large)[0-9]+x[0-9]+)_([^/]+)(?:[?#].*)?$/, "$1-$2")
				.replace(/\/resources\/+media2\/+.*?\/+([-0-9a-f]{10,}-[^/]+)(?:[?#].*)?$/, "/resources/media/$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (host_domain_nowww === "local12.com") {
			var get_info_from_local12_text = function(text) {
				var match = text.match(/\nsinclairDigital\.pageData = ({.*});\r?\n/);
				if (!match) return null;

				try {
					var json = JSON_parse(match[1]);
					return json;
				} catch (e) {
					console_error(e);
				}

				return null;
			};

			var get_info_from_local12_url = function(url, cb) {
				url = url.replace(/[?#].*/, "");

				api_cache.fetch("local12:" + url, cb, function(done) {
					if (url === options.host_url.replace(/[?#].*/, "")) {
						return done(get_info_from_local12_text(document.documentElement.innerHTML), 60*60);
					} else {
						options.do_request({
							url: url,
							method: "GET",
							imu_mode: "document",
							onload: function(resp) {
								if (resp.status !== 200) {
									console_error(cache_key, resp);
									return done(null, false);
								}

								return done(get_info_from_local12_text(resp.responseText), 60*60);
							}
						});
					}
				});
			};

			var get_id_from_local12_url = function(url) {
				var match = url.match(/\/resources\/+media\/+([0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12})-/);
				if (!match) return null;

				return match[1].toLowerCase();
			};

			var info_matches_local12_id = function(id, info) {
				// so far i've only seen externalId and versionSetUuid used
				var keys = ["brandUuid", "externalId", "uuid", "versionSetUuid"];

				var found = false;
				array_foreach(keys, function(key) {
					if (!(key in info)) return;

					if (info[key].toLowerCase() === id) {
						found = true;
						return false;
					}
				});

				return found;
			};

			var get_id_in_local12_info = function(id, info) {
				var infos = [];

				if (info.story.images) array_extend(infos, info.story.images);
				if (info.story.videos) array_extend(infos, info.story.videos);

				var foundobj = null;
				array_foreach(infos, function(info) {
					if (info_matches_local12_id(id, info)) {
						foundobj = info;
						return false;
					}
				});

				return foundobj;
			};

			var get_obj_for_local12_info = function(info) {
				if (!info) return null;

				var urls = [];

				var baseobj = {
					extra: {}
				};

				if (info.created) {
					baseobj.extra.created_date = info.created;
				}

				baseobj.extra.caption = info.caption || info.title;

				baseobj.filename = info.alt || info.description;

				if (info.type === "Video") {
					if (info.url) {
						urls.push({
							url: info.url,
							video: "hls" // fixme?
						});
					}

					if (info.mp4Url) {
						urls.push({
							url: info.mp4Url,
							video: true
						});
					}

					if (info.thumbUrl) {
						urls.push(info.thumbUrl);
					}
				} else if (info.type === "Image") {
					if (info.originalUrl) urls.push(info.originalUrl);
				}

				return fillobj_urls(urls, baseobj);
			};

			if ((!src || host_domain_nowww === domain_nosub) && options.do_request && options.cb) {
				get_info_from_local12_url(options.host_url, function(our_info) {
					if (!our_info) return options.cb(null);

					var id = get_id_from_local12_url(src);
					if (id) {
						var info_obj = get_id_in_local12_info(id, our_info);
						if (info_obj) {
							return options.cb(get_obj_for_local12_info(info_obj));
						} else {
							return options.cb(null);
						}
					} else if (!src && options.element && options.element.tagName === "VIDEO") {
						return options.cb(get_obj_for_local12_info(our_info.story.videos[0]));
					}
				});

				return {
					waiting: true
				};
			}
		}

		if (domain_nowww === "scanpix.no") {
			// https://scanpix.no/spWebApp/images/icons_2015/moreInfoWhite.png
			if (/\/images\/+icons_[0-9]+\/+moreInfo/.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}

			// thanks to fedesk on discord for the links
			// https://scanpix.no/spWebApp/search.action?search.searchString=sigrid%20raabe&search.mainGroup=editorial
			// https://scanpix.no/spWebApp/preview/editorial/WmNeC9ojnno
			// https://scanpix.no/spWebApp/preview/editorial/_-JSO1SGk9Q
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+spWebApp\/+preview\/+editorial\/+([-_a-zA-Z0-9]+)(?:[?#].*)?$/,
				query_for_id: {
					url: "https://scanpix.no/spWebApp/preview/editorial/${id}?json=",
					imu_mode: "xhr",
					json: true,
					headers: {
						"X-Requested-With": "XMLHttpRequest",
						"X-SpAjaxRequest": "true"
					}
				},
				process: function(done, resp, cache_key) {
					var previewobj = {};

					array_foreach(resp.previewList, function(x) {
						previewobj[x.type] = x.url;
					});

					urls = [];

					// 1024x*, watermark
					if (previewobj.preview_big) {
						urls.push({
							url: previewobj.preview_big,
							problems: {watermark: true}
						});
					}

					// 512x*, no watermark
					if (resp.previewLocation) {
						urls.push(resp.previewLocation);
					}

					// 512x*, watermark
					if (previewobj.preview) {
						urls.push({
							url: previewobj.preview,
							problems: {watermark: true}
						});
					}

					var obj = {
						extra: {
							caption: resp.headline || resp.caption
						}
					};

					return done(fillobj_urls(urls, obj), 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "preview.sdl.no") {
			// https://preview.sdl.no/v1/no/UQAr--xcEFV0-UMsjk7G7A/WmNeC9ojnno
			match = src.match(/\/v1\/+[^/]+\/+[^/]+\/+([-_a-zA-Z0-9]+)(?:[?#].*)?$/);
			if (match) {
				return {
					url: "https://scanpix.no/spWebApp/preview/editorial/" + match[1],
					is_pagelink: true
				};
			}
		}

		if (domain_nowww === "celebritongue.com") {
			// https://www.celebritongue.com/album/adele/thumbnail/adele-5a5b2a3b93510312-thumbnail.jpg
			//   https://www.celebritongue.com/album/adele/medium-photo/adele-5a5b2a3b93510312-medium.jpg
			//   https://www.celebritongue.com/album/adele/photo/adele-5a5b2a3b93510312.jpg
			return src.replace(/(\/album\/+[^/]+\/+)(?:thumbnail|medium-photo)\/+([^/]+-[0-9a-f]{10,})-(?:thumbnail|medium)(\.[^/.]+)(?:[?#].*)?$/, "$1photo/$2$3");
		}

		if (domain === "extra-images.akamaized.net") {
			// https://extra-images.akamaized.net/image/10/o/2013/08/27/102cd8242fba5aea90360adfcf883267_sm.jpg -- 420x651
			//   https://extra-images.akamaized.net/image/10/o/2013/08/27/102cd8242fba5aea90360adfcf883267_md.jpg -- 825x1279
			//   https://extra-images.akamaized.net/image/10/o/2013/08/27/102cd8242fba5aea90360adfcf883267_lg.jpg -- 1140x1768
			//   https://extra-images.akamaized.net/image/10/o/2013/08/27/102cd8242fba5aea90360adfcf883267.jpg -- 2874x4456
			return src.replace(/(\/[0-9a-f]{20,})_(?:md|lg)(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "ok.ru") {
			// https://ok.ru/video/2791229033146
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+video\/+([0-9]+)(?:[?#].*)?$/,
				query_for_id: "https://ok.ru/video/${id}",
				process: function(done, resp, cache_key) {
					var vidmeta = resp.responseText.match(/<div data-module="OKVideo" data-options="({[^"]+?})"/);
					if (!vidmeta) {
						console_error(cache_key, "Unable to find video metadata for", resp);
						return done(null, false);
					}

					vidmeta = decode_entities(vidmeta[1]);
					var json = JSON_parse(vidmeta);

					var flmeta = JSON_parse(json.flashvars.metadata);
					var movie = flmeta.movie;

					var obj = {
						extra: {
							page: movie.url || resp.finalUrl,
							caption: movie.title
						},
						headers: {
							Referer: resp.finalUrl
						}
					};

					var urls = [];

					if (flmeta.hlsManifestUrl) {
						urls.push({
							url: flmeta.hlsManifestUrl,
							video: "hls",
							is_private: true // linked to ip
						});
					}

					// fixme?
					var qualityindex = ["hd", "sd", "low", "lowest", "mobile"];

					sort_by_key(flmeta.videos, "name", function(x) {
						return array_indexof(qualityindex, x);
					});

					array_foreach(flmeta.videos, function(video) {
						urls.push({
							url: video.url,
							video: true,
							is_private: true // linked to ip
						});
					});

					if (movie.poster) {
						urls.push(movie.poster);
					}

					return done(fillobj_urls(urls, obj), 60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (host_domain_nowww === "ok.ru") {
			newsrc = common_functions["get_pagelink_host_el_matching"](options, {
				url_match: /^https?:\/\/(?:www\.)?ok\.ru\/+video\/+([0-9]+)(?:[?#].*)?$/,
				el_match: function(x) {
					return x.classList.contains("vp_video");
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "chartsinfrance.net") {
			// http://www.chartsinfrance.net/covers/aHR0cHM6Ly9pLnNjZG4uY28vaW1hZ2UvYWI2NzYxNmQwMDAwMWUwMjNjMzg0ZDBmZTIzNzdiOThiZjY0Y2NhOA==.jpg
			//   https://i.scdn.co/image/ab67616d00001e023c384d0fe2377b98bf64cca8
			match = src.match(/\/covers\/+(aHR0[^/.]+)\./);
			if (match) {
				return base64_decode(match[1]);
			}
		}

		if (domain_nowww === "laut.de") {
			// https://www.laut.de/bilder/__100,100/wortlaut/artists/g/gomez_selena/artist-image,131180.jpg
			//   https://www.laut.de/bilder/wortlaut/artists/g/gomez_selena/artist-image,131180.jpg
			// https://www.laut.de/bilder/__100,0/lautstark/artikel/cdreview/60204/cover,180104.jpg
			//   https://www.laut.de/bilder/lautstark/artikel/cdreview/60204/cover,180104.jpg
			return src.replace(/\/bilder\/+__[0-9]+,[0-9]+\/+/, "/bilder/");
		}

		if (domain === "d28hgpri8am2if.cloudfront.net") {
			// https://d28hgpri8am2if.cloudfront.net/book_images/onix/cvr9781982171865/let-us-dream-9781982171865.jpg -- 163x250
			//   https://d28hgpri8am2if.cloudfront.net/book_images/onix/cvr9781982171865/let-us-dream-9781982171865_th.jpg -- 65x100
			//   https://d28hgpri8am2if.cloudfront.net/book_images/onix/cvr9781982171865/let-us-dream-9781982171865_lg.jpg -- 261x400
			//   https://d28hgpri8am2if.cloudfront.net/book_images/onix/cvr9781982171865/let-us-dream-9781982171865_xlg.jpg -- 587x900
			//   https://d28hgpri8am2if.cloudfront.net/book_images/onix/cvr9781982171865/let-us-dream-9781982171865_hr.jpg -- 1400x2146
			// https://d28hgpri8am2if.cloudfront.net/book_images/cvr9780684853949_9780684853949.jpg -- 161x250
			//   https://d28hgpri8am2if.cloudfront.net/book_images/cvr9780684853949_9780684853949_hr.jpg -- 1633x2524
			return {
				url: src.replace(/(\/book_images\/+(?:onix\/+cvr[0-9]+\/+[^/.]+-[0-9]+|cvr[0-9]+_[0-9]+))(?:_(?:th|lg|xlg))?(\.[^/.]+)(?:[?#].*)?$/, "$1_hr$2"),
				head_wrong_contenttype: true // no content-type
			};
		}

		if (domain_nosub === "vgc.no") {
			// thanks to fedesk on discord
			// https://premium.vgc.no/v2/images/4362fd6b-64f1-400d-9def-d67ae02e756b?fit=crop&h=2850&w=1900&s=5f2e1878c250f84722a89392f9a37f78dda52fc7
			//   https://premium.vgc.no/ap/images/4362fd6b-64f1-400d-9def-d67ae02e756b
			// https://akamai.vgc.no/v2/images/4ee79914-d4d3-47f6-86a8-92b03e8dc448?fit=crop&h=1200&tight=true&w=1600&s=d78bfa0e19bc8dc98b41c4b33751769412ba4357
			//   https://premium.vgc.no/ap/images/4ee79914-d4d3-47f6-86a8-92b03e8dc448
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+v2(\/+images\/+[-0-9a-f]{20,})(?:[?#].*)?$/, "https://premium.vgc.no/ap$1");
			if (newsrc !== src) {
				return {
					url: newsrc,
					head_wrong_contentlength: true
				};
			}
		}

		if (domain === "assets.website-files.com" ||
			// https://assets-global.website-files.com/5bc63f5a577d83657b247707/5f4564dc5710e4bdb176147a_hero-image%20(1)-p-1600.jpeg
			domain === "assets-global.website-files.com") {
			// thanks to dym-sh on github: https://github.com/qsniyg/maxurl/issues/544
			// https://paper.bywetransfer.com/
			// https://assets.website-files.com/5bc63f5a577d83657b247707/5f4564dc5710e4bdb176147a_hero-image%20(1)-p-1600.jpeg -- 1600x1199
			//   https://assets.website-files.com/5bc63f5a577d83657b247707/5f4564dc5710e4bdb176147a_hero-image%20(1).jpeg -- 2732x2048
			return src.replace(/(\/[0-9a-f]{10,}\/+[^/]+)-p-[0-9]+(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "4gamer.net") {
			// https://www.4gamer.net/games/000/G000000/20080223004/TN/002.jpg
			//   https://www.4gamer.net/games/000/G000000/20080223004/SS/002.jpg
			return src.replace(/(\/[0-9]{8,}\/+)TN(\/+[0-9]+\.[^/.]+)(?:[?#].*)?$/, "$1SS$2");
		}

		if (domain_nowww === "bibliogram.art") {
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+imageproxy\?(?:.*&)?url=(http[^&#]+)(?:[&#].*)?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (host_domain_nowww === "biqle.com" && options.element) {
			if (!src && options.element.classList.contains("video-play")) {
				return {
					url: origsrc,
					bad: "mask"
				};
			}
		}

		if (domain_nowww === "biqle.com" ||
			domain_nowww === "daftsex.com") {
			// https://biqle.com/img/no-image.png
			if (/\/img\/+no-image\./.test(src))
				return {
					url: src,
					bad: "mask"
				};

			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+watch\/+(-?[0-9]+_[0-9]+)(?:[?#].*)?$/,
				query_for_id: "https://" + domain_nosub + "/watch/${id}",
				process: function(done, resp, cache_key) {
					var iframeurl = null;

					var match = resp.responseText.match(/<iframe[^>]* src="(https:\/\/(?:dxb.to|daxab.com)\/+player\/+[^/".]+)"/);
					if (match) {
						iframeurl = decode_entities(match[1]);
					} else {
						// daftsex
						match = resp.responseText.match(/\s+hash: "([^"]{20,})",/);
						if (match) {
							iframeurl = "https://daxab.com/player/" + match[1];
						}
					}

					if (!iframeurl) {
						console_error(cache_key, "Unable to find iframe url for", resp);
						return done(null, false);
					}

					return done({
						url: iframeurl + "#imu-referer=" + resp.finalUrl.replace(/(:\/\/[^/]+\/).*$/, "$1"),
						is_pagelink: true
					}, 60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "dxb.to" ||
			domain_nowww === "daxab.com") {
			var query_daxab = function(data, cb) {
				// reliable servers: psv82, psv85, psv69, psv134, psv113
				// unreliable: psv83, psv84, psv60, psv138 (410), psv145 (no files), psv120 (421), psv127/psv129 (no files)
				var server = data.server;
				var sub = server.replace(/\..*/, "");
				var fp = sub.replace(/-.*/, "");
				if (fp === "psv83" || fp === "psv84") {
					sub = "psv85-3";
				} else if (fp === "psv60") {
					sub = "psv69-4";
				} else if (fp === "psv138" || fp === "psv145") {
					sub = "psv134-1";
				}
				server = server.replace(/^[^.]+\./, sub + ".");

				api_query(domain_nowww + ":" + data.id, {
					url: "https://" + server + "/method/video.get/" + data.id + "?token=" + data.token + "&videos=" + data.id + "&ckey=" + data.ckey + "&credentials=" + data.credentials,
					imu_mode: "xhr",
					headers: {
						Accept: "application/json, text/javascript, */*; q=0.01",
						Origin: "https://" + domain_nowww,
						Referer: "https://" + domain_nowww + "/",
						Cookie: "",
						"sec-fetch-site": "same-site"
					},
					json: true
				}, cb, function(done, resp, cache_key) {
					var item = resp.response.items[0];

					var photos = {};
					var largest_photo = null;
					for (var key in item) {
						var match = key.match(/^photo_([0-9]+)$/);
						if (!match) continue;

						var our_size = parseInt(match[1]);
						if (!largest_photo || our_size > largest_photo) largest_photo = our_size;
						photos[our_size] = item[key];
					}

					var urls = [];

					var files = Object.keys(item.files);
					files.sort(function(a, b) {
						// mp4_(144|240|360|480|720)
						var a_match = a.match(/_([0-9]+)$/);
						var b_match = b.match(/_([0-9]+)$/);

						if (!a_match || !b_match) return 0;

						return b_match[1] - a_match[1];
					});

					array_foreach(files, function(key) {
						var file = item.files[key];
						file = file.replace(/:\/\/(vkvd[0-9]*\.mycdn\.me\/)/, "://" + server + "/$1");
						// todo: check key
						urls.push({
							url: file,
							video: true,
							can_head: false
						});
					});

					if (largest_photo) {
						urls.push(photos[largest_photo]);
					}

					return done(urls, 60*60);
				});
			};

			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+player\/+([^/.#]+)(?:#.*)?$/,
				query_for_id: function(id) {
					var referer = "https://biqle.com/";
					var queries = common_functions["parse_imu_hash"](src);
					if (queries && queries.referer) referer = queries.referer;

					return {
						url: "https://" + domain_nowww + "/player/" + id,
						imu_mode: "iframe",
						headers: {
							Referer: referer
						}
					};
				},
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/window\.globParams\s*=\s*({[\s\S]+?});\s*<\/script>/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					var fixedup = fixup_js_obj(match[1]);
					//var fixedup = fixup_js_obj_proper(match[1]);

					var urls = [];

					var json = JSON_parse(fixedup);
					//console_log(json);
					var server = base64_decode(reverse_str(json.server));
					var id = json.video.cdn_id || json.video.id; // mp4 has both cdn_id and id (same?), hls only has id

					var waiting = false;

					// mp4
					if (json.video.cdn_files) {
						var splitted_id = id.split("_");
						var headpath = "https://" + server + "/videos/" + splitted_id[0] + "/" + splitted_id[1] + "/";

						var resolutions = [];
						var resolutions_map = {};

						obj_foreach(json.video.cdn_files, function(key, baseurl) {
							var splitted_key = key.split("_");

							var ext = splitted_key[0];
							var res = splitted_key[1];
							array_upush(resolutions, res);

							if (!(res in resolutions_map)) {
								resolutions_map[res] = [];
							}
							resolutions_map[res].push(key);

							baseurl = baseurl.replace(/\./, "." + ext + "?extra=");
							var url = headpath + baseurl;
							json.video.cdn_files[key] = url;
						});

						resolutions = resolutions.sort().reverse();

						array_foreach(resolutions, function(res) {
							array_foreach(resolutions_map[res], function(key) {
								urls.push({
									url: json.video.cdn_files[key],
									video: true
								});
							});
						});
					} else if (json.video.partial) { // partial isn't needed, it seems to be the same as cdn_files, but it's only on hls
						query_daxab({
							id: id,
							server: server,
							token: json.video.access_token,
							ckey: json.c_key,
							credentials: json.video.credentials
						}, function(urls) {
							final(urls);
						});
						waiting = true;
					}

					var final = function(urls) {
						if (!urls) {
							return done(null, false);
						}

						var baseobj = {
							headers: {
								"accept": "*/*",
								"accept-encoding": "identity;q=1, *;q=0",
								Referer: "https://" + domain_nowww + "/",
								"sec-fetch-dest": "video",
								"sec-fetch-mode": "no-cors",
								"sec-fetch-site": "same-site"
							}
						};

						console_log(urls, json);

						return done(fillobj_urls(urls, baseobj), 60*60);
					};

					if (!waiting) {
						// mp4
						if (json.video.thumb) {
							var thumb = urljoin(resp.finalUrl, base64_decode(json.video.thumb), true);
							urls.push(thumb);
						}

						final(urls);
					}
				}
			});
			if (newsrc) return newsrc;
		}

		if (common_functions["multidomain__teddit"](domain, domain_nowww)) {
			// thanks to fedesk on discord
			// https://teddit.net/pics/thumb_w:108_uq5gnxvnqs361.jpg
			//   https://teddit.net/pics/w:null_uq5gnxvnqs361.jpg
			//   https://i.redd.it/u9g6jpmius361.jpg
			// https://teddit.net/pics/thumb_w:108_TyFbSc02uNCcXU-iN0wAKCM0KFEE3MavzwhTxDSwk-A.png
			//   https://teddit.net/pics/w:null_TyFbSc02uNCcXU-iN0wAKCM0KFEE3MavzwhTxDSwk-A.png
			// needs to be fetched first through the html page, otherwise 404
			// thanks to 07416 on github: https://github.com/qsniyg/maxurl/issues/910
			// https://teddit.net/r/PixelArt/comments/praia7/some_icons/
			// https://teddit.net/pics/thumbs/thumb_w:108_2n1mfzpreho71.png
			//   https://teddit.net/pics/w:null_2n1mfzpreho71.png
			// other:
			// https://teddit.net/r/HiTMAN/comments/if2esr/just_in_case_you_missed_it_in_bangkok_after_using/
			// https://teddit.net/pics/w:108_ruttjk79xqi51.png
			//   https://teddit.net/pics/w:1080_tssjj35hvqi51.png
			//   https://teddit.net/pics/w:1366_tssjj35hvqi51.png
			//   https://teddit.net/pics/w:null_tssjj35hvqi51.png -- doesn't work
			newsrc = src.replace(/(\/pics\/+)(?:thumbs\/+)?thumb_[wh]:[0-9]+_/, "$1w:null_");
			if (newsrc !== src) return newsrc;

			if (options.rule_specific && options.rule_specific.teddit_redirect_reddit) {
				newsrc = src
					.replace(/^[a-z]+:\/\/[^/]+\/+pics\/+(?:thumb_)?(?:[wh]:[^/._]+_)?([a-z0-9]{10,15}\.[^/.]+)(?:[?#].*)?$/, "https://i.redd.it/$1")
					.replace(/^[a-z]+:\/\/[^/]+\/+vids\/+([0-9a-z]{10,15}\.gif)\.mp4(?:[?#].*)?$/, "https://i.redd.it/$1");
				if (newsrc !== src) {
					if (host_domain_nowww === "teddit.net") {
						return {
							url: newsrc,
							// CSP: img-src 'self' data:
							need_data_url: true
						};
					} else {
						return newsrc;
					}
				}
			}
		}

		if (common_functions["multidomain__teddit"](host_domain, host_domain_nowww) && options.element && host_domain === domain) {
			// Teddit galleries:
			// https://teddit.net/r/HiTMAN/comments/if2esr/just_in_case_you_missed_it_in_bangkok_after_using/
			let itemdiv = common_functions["get_parent_el_matching"](options.element, function(el) {
				return el.tagName === "DIV" && el.classList.contains("item");
			});

			if (itemdiv) {
				let sourcelink = itemdiv.querySelector("a.source-link[href]");
				if (sourcelink) {
					return sourcelink.href;
				}
			}
		}

		if (common_functions["multidomain__teddit"](host_domain, host_domain_nowww) && options.element && options.do_request && options.cb) {
			if (host_domain === domain && /\/pics\//.test(src)) {
				var linkdiv = common_functions["get_parent_el_matching"](options.element, function(el) {
					return el.tagName === "DIV" && el.classList.contains("link");
				});

				if (linkdiv) {
					var link = linkdiv.querySelector("div.links > a.comments");

					// the purpose of this is to fetch the document to cache the media
					// unless it's a video, we don't care about the document itself
					if (link) {
						api_query("teddit:" + link.href, {
							url: link.href,
							imu_mode: "document"
						}, function(url) { options.cb(url || src); }, function(done, resp, cache_key) {
							let match = resp.responseText.match(/<a href="(\/vids\/[^"/]+\.mp4)">\[media\]<\/a><\/div><div class="comments-info"/);
							if (!match) {
								return done(null, 60);
							}

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

						return {
							waiting: true
						};
					}
				}
			}
		}

		if (domain_nowww === "rumble.com") {
			// https://rumble.com/vbn97p-dog-clears-box-from-his-bed-with-a-kick.html -- not the video id
			// https://rumble.com/embed/v91311/ -- actual video id

			// separate to avoid re-querying
			var get_rumble_page = function(url, cb) {
				api_query("rumble:" + url, {
					url: url,
					method: "GET",
					imu_mode: "document"
				}, cb, function(done, resp, cache_key) {
					return done(resp, 10*60);
				});
			}

			var get_rumble_embedjs_path = function(url, cb) {
				api_cache.fetch("rumble_embedjs", cb, function(done) {
					get_rumble_page(url, function(resp) {
						if (!resp) {
							return done(null, false);
						}

						var match = resp.responseText.match(/"(\/embedJS\/[a-z0-9]{2,})"[,;]/);
						if (!match) {
							console_error(cache_key, "Unable to find embedJS path from", resp);
							return done(null, false);
						}

						return done(urljoin("https://rumble.com/", match[1], true), 60*60);
					});
				});
			};

			var rumble_normalize_url = function(url) {
				var match = url.match(/^[a-z]+:\/\/[^/]+\/+([a-z0-9]+)-[^/?#.]*\.html(?:[?#].*)?$/);
				if (match) {
					return "https://rumble.com/" + match[1] + "-.html";
				}

				return url;
			};

			var rumble_url_to_videoid = function(url, cb) {
				var match = url.match(/^[a-z]+:\/\/[^/]+\/+embed\/+v([0-9a-z]+)\/*(?:[?#].*)?$/);
				if (match) {
					return cb(match[1]);
				}

				api_cache.fetch("rumble_url_videoid:" + url, cb, function(done) {
					get_rumble_page(url, function(resp) {
						if (!resp) return done(null, false);

						var match = resp.responseText.match(/Rumble\("play", {.*?"video":"v([0-9a-z]+)"/);
						if (!match) {
							console_error(cache_key, "Unable to find video id from", resp);
							return done(null, false);
						}

						return done(match[1], 6*60*60);
					});
				});
			};

			var query_rumble = function(vid, embedjs, cb) {
				// info is also in /embed/ link, we don't necessarily need to use the api
				api_query("rumble_api:" + vid, {
					url: embedjs + "/?request=video&v=v" + vid + "&ext=%7B%22ad_count%22%3Anull%7D",
					imu_mode: "xhr",
					referer: "https://rumble.com/embed/v" + vid + "/",
					json: true
				}, cb, function(done, resp, cache_key) {
					var obj:BigImageInfoSObject = {
						extra: {
							page: "https://rumble.com/embed/v" + vid + "/"
						}
					};

					if (resp.l) {
						obj.extra.page = urljoin("https://rumble.com/", resp.l, true);
					}

					if (resp.title) obj.extra.caption = resp.title;
					if (resp.author) obj.extra.author_username = resp.author.name;
					if (resp.pubDate) obj.extra.created_date = new Date(resp.pubDate).getTime();

					var urls = [];

					var keys = Object.keys(resp.ua);
					keys.sort();
					array_foreach(keys, function(key) {
						urls.push({
							url: resp.ua[key][0],
							video: true,
							//height: key
						});
					});

					if (resp.i) {
						urls.push(resp.i);
					}

					return done(fillobj_urls(urls, obj), 6*60*60);
				});
			};

			newsrc = website_query({
				website_regex: [
					/^[a-z]+:\/\/[^/]+\/+([a-z0-9]+)-[^/?#.]*\.html(?:[?#].*)?$/,
					/^[a-z]+:\/\/[^/]+\/+embed\/+v([0-9a-z]+)\/*(?:[?#].*)?$/
				],
				run: function(cb, match) {
					var vurl = rumble_normalize_url(src);

					rumble_url_to_videoid(vurl, function(vid) {
						if (!vid) {
							return cb(null);
						}

						get_rumble_embedjs_path(vurl, function(embedjs) {
							if (!embedjs) {
								return cb(null);
							}

							query_rumble(vid, embedjs, cb);
						});
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "images.parler.com") {
			// https://images.parler.com/c57e1807949d4c269a5dbcf7d311f702_32
			//   https://images.parler.com/c57e1807949d4c269a5dbcf7d311f702 -- 512x512
			// https://images.parler.com/ca7aba70bd07480eb20e60060352550e_1200 -- 1200x400
			//   https://images.parler.com/ca7aba70bd07480eb20e60060352550e -- 1800x600
			// https://images.parler.com/zRnzfRm8n2fts1CnquH5XTAw4YayAjNn -- 1200x1200 (atob is garbage)
			return src.replace(/^([a-z]+:\/\/[^/]+\/+[a-f0-9]{10,})_[0-9]+(?:[?#].*)?$/, "$1");
		}

		if (domain_nowww === "blaqsbi.com") {
			// https://www.blaqsbi.com/social/file/file/getremoteimage/url/https%253A%252F%252Fwww.thesprucepets.com%252Fthmb%252Fc1ovZ1reH_To3vU8q3rhcYTo32I%253D%252F2000x1500%252Ffilters%253Afill%2528auto%252C1%2529%252FGettyImages-686801347-599df88322fa3a0011fd61e1.jpg
			//   https://www.thesprucepets.com/thmb/c1ovZ1reH_To3vU8q3rhcYTo32I=/2000x1500/filters:fill(auto,1)/GettyImages-686801347-599df88322fa3a0011fd61e1.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+social\/+file\/+file\/+getremoteimage\/+url\/+(https?[^/]+)(?:[?#].*)?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);

			// https://www.blaqsbi.com/social/site/viewheaderimage?folder=profile_image&tstamp=1597863437&filename=da78808b-619b-423a-b82c-797129c2d7d9.jpg -- 140x140
			//   https://www.blaqsbi.com/social/site/viewheaderimage?folder=profile_image&tstamp=1597863437&filename=da78808b-619b-423a-b82c-797129c2d7d9_org.jpg -- 400x400
			newsrc = src.replace(/(\/social\/+site\/+viewheaderimage\?(?:.*&)?filename=)([-a-z0-9]{20,})(\.[^/.?&#]+)/, "$1$2_org$3");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "imshopping.rediff.com") {
			// thanks to nijaz-lab on github: https://github.com/qsniyg/maxurl/issues/564
			// https://shopping.rediff.com/product/set-of-2-polyester-spandex-beautiful-flower-and-girl-print-jeans-code-2jegging-/24839195
			// https://imshopping.rediff.com/imgshop/300-400/shopping/pixs/16284/u/untitled_5c514820cdbb6._set-of-2-polyester-spandex-beautiful-flower-and-girl-print-jeans-code-2jegging-.jpg
			//   https://imshopping.rediff.com/imgshop/-/shopping/pixs/16284/u/untitled_5c514820cdbb6._set-of-2-polyester-spandex-beautiful-flower-and-girl-print-jeans-code-2jegging-.jpg -- 491x492
			// http://imshopping.rediff.com/imgshop/800-1280/shopping/pixs/31925/1/1_5e4a7666bb368._limited-edition-cotton-silk-regular-fit-self-design-kurta-pajama-code-akakkuset114-.jpg
			//   http://imshopping.rediff.com/imgshop/-/shopping/pixs/31925/1/1_5e4a7666bb368._limited-edition-cotton-silk-regular-fit-self-design-kurta-pajama-code-akakkuset114-.jpg -- 2799x3734
			return {
				url: src.replace(/\/imgshop\/+[0-9]*-[0-9]*\/+/, "/imgshop/-/"),
				head_wrong_contentlength: true
			};
		}

		if (domain_nowww === "neoprenesupplier.com") {
			// thanks to nijaz-lab on github: https://github.com/qsniyg/maxurl/issues/566
			// https://www.neoprenesupplier.com/uploads/201922494/small/surf-rash-guard-women03541753336.jpg
			//   https://www.neoprenesupplier.com/uploads/201922494/surf-rash-guard-women03541753336.jpg
			return src.replace(/(\/uploads\/+[0-9]{4,}\/+)small\/+/, "$1");
		}

		if (domain_nowww === "bergen.kommune.no") {
			// thanks to fedesk on discord
			// https://www.bergen.kommune.no/hvaskjer/tema/publikasjoner/bergenseren/reportasjer/nervositeten-forsvant-da-jeg-kom-pa-scenen
			// https://www.bergen.kommune.no/publisering/api/bilder/T537319885?scaleWidth=1400
			//   https://www.bergen.kommune.no/publisering/api/bilder/T537319885 -- 2400x1352
			// doesn't work for all:
			// https://www.bergen.kommune.no/publisering/api/bilder/T537319873?scaleWidth=950
			//   https://www.bergen.kommune.no/publisering/api/bilder/T537319873 -- 404
			// https://www.bergen.kommune.no/publisering/api/bilder/T537319879?scaleWidth=550
			//   https://www.bergen.kommune.no/publisering/api/bilder/T537319879
			return src.replace(/(\/publisering\/+api\/+bilder\/+[^?#]+)\?scaleWidth=.*$/, "$1");
		}

		if ((domain_nosub === "infomaker.io" ||
			// https://imengine.public.prod.sci.navigacloud.com/?uuid=6668ad61-cc2c-5128-8634-9e780b1730a8&type=preview&function=square&width=1024&q=80
			//   https://imengine.public.prod.sci.navigacloud.com/?uuid=6668ad61-cc2c-5128-8634-9e780b1730a8&function=original&type=primary&source=true&q=100
			domain_nosub === "navigacloud.com") &&
			/^imengine(?:\.public)?\.prod/.test(domain)) {
			// thanks to fedesk on discord
			// https://imengine.public.prod.agp.infomaker.io/?uuid=353417b3-76d4-406b-a79b-a07f6a9c7e86&function=hardcrop&type=preview&source=false&q=75&width=1500&height=844
			//   https://imengine.public.prod.agp.infomaker.io/?uuid=353417b3-76d4-406b-a79b-a07f6a9c7e86&function=original&type=preview&source=true&q=100 -- 1200x1600
			//   https://imengine.public.prod.agp.infomaker.io/?uuid=353417b3-76d4-406b-a79b-a07f6a9c7e86&function=original&type=primary&source=true&q=100 -- 700x933
			// https://imengine.public.prod.agp.infomaker.io/?uuid=7979b959-2118-51e0-b12d-17a897c051ea&type=preview&source=true
			//   https://imengine.public.prod.agp.infomaker.io/?uuid=7979b959-2118-51e0-b12d-17a897c051ea&function=original&type=preview&source=true&q=100 -- 1600x1007
			//   https://imengine.public.prod.agp.infomaker.io/?uuid=7979b959-2118-51e0-b12d-17a897c051ea&function=original&type=primary&source=true&q=100 -- 2033x1280
			// https://imengine.public.prod.agp.infomaker.io/?uuid=e92e8134-299a-55b2-969d-90b7a4ef7624&function=cropresize&type=preview&source=false&q=75&crop_w=0.99999&crop_h=0.75&width=1200&height=675&x=1.0E-5&y=0.21667
			//   https://imengine.public.prod.agp.infomaker.io/?uuid=e92e8134-299a-55b2-969d-90b7a4ef7624&function=original&type=preview&source=true&q=100 -- 1600x1200
			//   https://imengine.public.prod.agp.infomaker.io/?uuid=e92e8134-299a-55b2-969d-90b7a4ef7624&function=original&type=primary&source=true&q=100 -- 1181x886
			// https://imengine.public.prod.agp.infomaker.io/?uuid=b9f678d7-6f38-58f5-bb05-81ef4204f42c&function=original&type=preview&source=true&q=100 -- 1280x960
			//   https://imengine.public.prod.agp.infomaker.io/?uuid=b9f678d7-6f38-58f5-bb05-81ef4204f42c&function=original&type=primary&source=true&q=100 -- 1632x1224
			// https://imengine.public.prod.agp.infomaker.io/?uuid=70885e88-2f55-5cd6-998d-93bbada19b10&function=original&type=preview&source=true&q=100 -- 3000x1996
			//   https://imengine.public.prod.agp.infomaker.io/?uuid=70885e88-2f55-5cd6-998d-93bbada19b10&function=original&type=primary&source=true&q=100 -- 3000x1996
			// https://imengine.public.prod.agp.infomaker.io/?uuid=e7ff5df0-abde-553c-a9c8-9903a5953958&function=original&type=preview&source=true&q=100 -- 3000x1933
			//   https://imengine.public.prod.agp.infomaker.io/?uuid=e7ff5df0-abde-553c-a9c8-9903a5953958&function=original&type=primary&source=true&q=100 -- 3000x1933
			// https://imengine.public.prod.agp.infomaker.io/?uuid=5d353315-0a7f-5801-a865-018061fb929b&function=original&type=preview&source=true&q=100 -- 3000x1924
			//   https://imengine.public.prod.agp.infomaker.io/?uuid=5d353315-0a7f-5801-a865-018061fb929b&function=original&type=primary&source=true&q=100 -- 3000x1924
			// https://imengine.public.prod.sbp.infomaker.io/?uuid=1f1c05f7-eb64-57d3-ad7d-edb85b7d8d80&type=preview&q=80&height=2385.4087719298&width=3579&function=original&x=0&y=0.031578947368421054&crop_w=0.99999999&crop_h=0.93508770929825 -- 1600x1140
			//   https://imengine.public.prod.sbp.infomaker.io/?uuid=1f1c05f7-eb64-57d3-ad7d-edb85b7d8d80&function=original&type=primary&source=true&q=100 -- 3579x2551
			// https://imengine.prod.ltn.infomaker.io/?uuid=9045B98A-FB98-415F-A4D3-577EC71C9214&function=fit&type=preview
			//   https://imengine.prod.ltn.infomaker.io/?uuid=9045B98A-FB98-415F-A4D3-577EC71C9214&function=original&type=primary&source=true&q=100 -- 399x265
			// https://imengine.public.prod.cmg.infomaker.io/?uuid=87bad76c-64c3-5e3e-b113-8ac445a49d8e&function=original&type=primary&source=true&q=100 -- 5029x3456
			// doesn't work for all:
			// https://imengine.ewtest.infomaker.io/?uuid=361d606d-c915-5037-b32f-a53793af3c6c&function=thumbnail&type=preview&source=false&q=80&width=767&height=432&format=jpg
			//   https://imengine.ewtest.infomaker.io/?uuid=361d606d-c915-5037-b32f-a53793af3c6c&function=original&type=primary&source=true&q=100 -- doesn't work, but 200
			newsrc = add_queries(src, {"function": "original", "q": "100", "source": "true", "type": "primary"});
			newsrc = keep_queries(newsrc, ["uuid", "function", "type", "source", "q"]);
			return newsrc;
		}

		if (domain === "d3rm30gbu5aixc.cloudfront.net") {
			// https://www.drb.no/aktuelt/manover-fagdag-og-fest-takk-for-denne-gang/
			// thanks to fedesk on discord
			// https://d3rm30gbu5aixc.cloudfront.net/media/rc/536x358/1480284022/manoever-fagdag-2015-c-cecilie-bannow-2015-web-68.jpg
			//   https://d3rm30gbu5aixc.cloudfront.net/media/1480284022/manoever-fagdag-2015-c-cecilie-bannow-2015-web-68.jpg
			// https://d3rm30gbu5aixc.cloudfront.net/media/l/407x278/1480284029/manoever-fagdag-2015-c-cecilie-bannow-2015-web-8.jpg?src=1920w
			//   https://d3rm30gbu5aixc.cloudfront.net/media/1480284029/manoever-fagdag-2015-c-cecilie-bannow-2015-web-8.jpg
			// not similar to purch despite /rc/ (resize crop?), e.g. "/media/abcdefg/" will also return the original image
			return src
				.replace(/(\/media\/+)(?:rc|l)\/+[0-9]+x[0-9]+\/+/, "$1")
				.replace(/\?.*/, "");
		}

		if (domain === "img.hotcelebzz.com") {
			// https://img.hotcelebzz.com/photos/josephine-skriver/188854-josephine-skriver-for-victorias-secret-april-2020-1395-thumbnail.jpg
			//   https://img.hotcelebzz.com/photos/josephine-skriver/188854-josephine-skriver-for-victorias-secret-april-2020-1.jpg
			// https://img.hotcelebzz.com/photos/josephine-skriver/188854-josephine-skriver-for-victorias-secret-april-2020-11744-thumbnail.jpg
			//   https://img.hotcelebzz.com/photos/josephine-skriver/188854-josephine-skriver-for-victorias-secret-april-2020-11.jpg
			// https://img.hotcelebzz.com/thumbnails/josephine-skriver/josephine-skriver-for-victorias-secret-april-2020-300w-1595018663.jpg
			//   https://img.hotcelebzz.com/thumbnails/josephine-skriver/josephine-skriver-for-victorias-secret-april-2020-zip-1595018663.jpg
			return src
				.replace(/(\/photos\/+.*-[0-9]+)[0-9]{3}-thumbnail(\.[^/.]+)(?:[?#].*)?$/, "$1$2")
				.replace(/(\/thumbnails\/.*)-300w-([0-9]{8,}\.[^/.]+)(?:[?#].*)?$/, "$1-zip-$2");
		}

		if (domain_nowww === "rule34.xyz") {
			// thanks to nijaz-lab on github: https://github.com/qsniyg/maxurl/issues/574
			// https://rule34.xyz/files/thumbnail/3131/3131092.jpg
			//   https://rule34.xyz/files/3131/3131092.jpg
			// some also redirect to jpeg
			newsrc = src.replace(/(\/files\/+)thumbnail\/+/, "$1");
			if (newsrc !== src) {
				return add_extensions_jpeg(newsrc);
			}
		}

		if (domain_nosub === "brazzers.com" && /^stage[0-9]*\./.test(domain)) {
			// http://stage4.brazzers.com/assets/compiledAssets/build/Brazzers/BrazzersCom/Tour/assets/pages/img/spritesmith/scenes-sprite-1580910363725.png
			if (/\/assets\/+compiledAssets\/+build\/+Brazzers\/+BrazzersCom\/+Tour\/+assets\/+pages\/+img\/+spritesmith\//.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}

			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+scenes\/+view\/+id\/+([0-9]+)(?:\/+[^/]*\/*)?(?:[?#].*)?$/,
				query_for_id: "https://" + domain + "/scenes/view/id/${id}/",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/,\s+streams\s*:\s*({"stream_info".*}),/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					var json = JSON_parse(match[1]);
					var stream_info = json.stream_info;

					var paths = {};

					if (stream_info.downloadHttp.paths) {
						paths = deepcopy(stream_info.downloadHttp.paths);
					}

					if (stream_info.http.paths) {
						paths = obj_extend(paths, stream_info.http.paths);
					}

					var keys = Object.keys(paths);
					keys.sort(function(a, b) {
						// format_resolution_bitrate
						var a_match = a.match(/^[a-z0-9]+_[0-9]+_([0-9]+)$/);
						var b_match = b.match(/^[a-z0-9]+_[0-9]+_([0-9]+)$/);

						if (!a_match || !b_match) {
							return b.localeCompare(a);
						}

						return parseInt(b_match[1]) - parseInt(a_match[1]);
					});

					var urls = [];
					array_foreach(keys, function(key) {
						console_log(key);
						var path = paths[key];

						urls.push({
							url: urljoin(resp.finalUrl, path, true),
							video: true
						});
					});

					urls.push(urljoin(resp.finalUrl, json.poster, true));

					var obj = {
						extra: {
							page: resp.finalUrl
						}
					};

					match = resp.responseText.match(/<h1 class="scene-title"[^>]*>\s*([^<]+?)\s*</);
					if (match) {
						obj.extra.caption = decode_entities(match[1]);
					}

					// valid for 28000 seconds (/60/60 = 7.777 hours)
					return done(fillobj_urls(urls, obj), 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "static-vz.brazzerscontent.com") {
			obj = {
				url: src,
				extra: {}
			};

			match = src.match(/:\/\/[^/]+\/+scenes\/+([0-9]+)\/+/);
			// https://static-vz.brazzerscontent.com/bzv2/brazzerscom/landing/assets/pages/img/tgp5/gallery/jpg/...-1.jpg
			if (!match) {
				match = src.match(/\/bzv2\/+brazzerscom\/+landing\/+assets\/+pages\/+img\/+tgp5\/+gallery\/+jpg\/+([0-9]+)-[0-9]+\./);
			}
			if (match) {
				obj.extra.page = "https://stage4.brazzers.com/scenes/view/id/" + match[1] + "/";
			}
			// thanks to nijaz-lab on github: https://github.com/qsniyg/maxurl/issues/576
			// https://static-vz.brazzerscontent.com/scenes/2646/preview/thm/01.jpg -- 130x195
			//   https://static-vz.brazzerscontent.com/scenes/2646/preview/img/01.jpg -- 683x1024
			newsrc = src.replace(/(\/scenes\/+[0-9]+\/+preview\/+)thm\/+([0-9]+\.[^/.]+)(?:[?#].*)?$/, "$1img/$2");
			if (newsrc !== src) {
				obj.url = newsrc;
				return obj;
			}

			// http://static-vz.brazzerscontent.com/scenes/3377780/975x548.jpg
			if (obj.extra.page && /\/scenes\/+[0-9]+\/+[0-9]+x[0-9]+\./.test(src)) {
				return {
					url: obj.extra.page,
					is_pagelink: true
				};
			}

			return obj;
		}

		if (domain_nowww === "pinkqueen.com") {
			// thanks to nijaz-lab on github: https://github.com/qsniyg/maxurl/issues/577
			// https://www.pinkqueen.com/upload/thumb/180x250/goodsimport/2019-09/PCC0788RE_1.jpg
			//   https://www.pinkqueen.com/upload/goodsimport/2019-09/PCC0788RE_1.jpg
			return src.replace(/\/upload\/+thumb\/+[0-9]+x[0-9]+\/+/, "/upload/");
		}

		if (host_domain_nowww === "fig.co" && options.element) {
			// .media-box__selector__selector-thumbnail_video .media-box__selector__selector-thumbnail__overlay
			if (options.element.classList.contains("media-box__selector__selector-thumbnail__overlay")) {
				return {
					url: origsrc,
					bad: "mask"
				};
			}
		}

		if (domain === "cdn.locals.com") {
			// https://cdn.locals.com/images/avatars/11677/11677_e4fnt5kloqprl2k_thumb.jpeg
			//   https://cdn.locals.com/images/avatars/11677/11677_e4fnt5kloqprl2k_full.jpeg
			//   https://cdn.locals.com/images/avatars/originals/11677/11677_e4fnt5kloqprl2k.jpeg -- 3977x5937
			// https://cdn.locals.com/images/posts/11677/11677_c4uvdmomo5xj6so_thumb.jpeg
			//   https://cdn.locals.com/images/posts/11677/11677_c4uvdmomo5xj6so_full.jpeg
			//   https://cdn.locals.com/images/posts/originals/11677/11677_c4uvdmomo5xj6so.jpeg -- 3024x4032
			// https://cdn.locals.com/images/groups/58351/58351_jsro8mkyyd8ktly_big.jpeg
			//   https://cdn.locals.com/images/groups/originals/58351/58351_jsro8mkyyd8ktly.jpeg
			return src
				.replace(/(\/images\/+(?:avatars|posts|groups)\/+)([0-9]+\/+[0-9]+_[0-9a-z]+)_full(\.[^/.]+)(?:[?#].*)?$/, "$1originals/$2$3")
				.replace(/(\/images\/+(?:avatars|posts|groups)\/+[0-9]+\/+[0-9]+_[0-9a-z]+_)(?:thumb|big)(\.[^/.]+)(?:[?#].*)?$/, "$1full$2");
		}

		if (domain === "matrix-client.matrix.org") {
			// https://matrix-client.matrix.org/_matrix/media/r0/thumbnail/matrix.org/...?width=200&height=573&method=scale
			//   https://matrix-client.matrix.org/_matrix/media/r0/download/matrix.org/...
			// thanks to Noodlers on discord:
			// https://matrix-client.matrix.org/_matrix/media/r0/thumbnail/matrix.org/2021-05-19_hcVvTKCeROYgekNO?width=100&height=100&method=scale
			//   https://matrix-client.matrix.org/_matrix/media/r0/download/matrix.org/2021-05-19_hcVvTKCeROYgekNO
			// thanks to anonymous for reporting:
			// https://matrix-client.matrix.org/_matrix/media/v3/thumbnail/matrix.org/cuiuRlBNwdRvVArdiJxgHRgY?width=4096&height=4096&method=crop
			//   https://matrix-client.matrix.org/_matrix/media/v3/download/matrix.org/cuiuRlBNwdRvVArdiJxgHRgY
			return src.replace(/(\/_matrix\/+media\/+(?:r[0-9]+|v3)\/+)thumbnail\/+([^/]+\/+[-_a-zA-Z0-9]+)\?.*$/, "$1download/$2");
		}

		if (domain_nowww === "liztube.com" ||
			// thanks to anonymous for reporting:
			domain_nowww === "xpaja.net" ||
			domain_nowww === "lechetube.com" ||
			domain_nowww === "darkero.com" ||
			domain_nowww === "xleche.com") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+([-0-9a-zA-Z]+)\/*(?:[?#].*)?$/,
				query_for_id: "https://" + domain + "/${id}/",
				process: function(done, resp, cache_key) {
					var obj = common_functions["get_videotag_obj"](resp);
					done(obj, obj ? 60*60 : false);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "pornssd.com" ||
			// thanks to anonymous for reporting:
			domain_nowww === "baddielatina.com" ||
			domain_nowww === "baddieass.com" ||
			domain_nowww === "baddieslut.com" ||
			domain_nowww === "baddietube.com") {
			newsrc = website_query({
				website_regex: /\/wp-content\/+plugins\/+clean-tube-player\/+public\/+player-x\.php\?q=([^&]{50,})/,
				run: function(cb, match) {
					var decoded = base64_decode(match[1]);
					var queries = get_queries("?" + decoded);

					let decoded_html = decodeURIComponent(queries.tag);

					if (/<iframe/.test(decoded_html)) {
						// <iframe src="..."
						return cb(parse_tag_def(decoded_html).args.src);
					} else {
						let obj = common_functions["get_videotag_obj"]({
							responseText: decoded_html,
							finalUrl: src
						});
						return cb(obj);
					}
				}
			});
			if (newsrc) return newsrc;

			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+([^/]+)\/*(?:[?#].*)?$/,
				query_for_id: "https://" + domain + "/${id}/",
				process: function(done, resp, cache_key) {
					let match = resp.responseText.match(/<iframe[^>]*src=[^>]*\/clean-tube-player\/+[^>]+>/);
					if (!match) {
						console_error(cache_key, "Unable to find iframe match for", resp);
						return done(null, false);
					}

					let iframe = parse_tag_def(match[0]);
					return done({
						url: iframe.args.src,
						is_pagelink: true
					}, 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "pornedup.com") {
			// https://pornedup.com/media/pics/thumbs_sm/drinking-cum-from-condom-16445.jpg
			//   https://pornedup.com/media/pics/orig/drinking-cum-from-condom-16445.jpg
			return src.replace(/\/media\/+pics\/+thumbs_[a-z]+\/+/, "/media/pics/orig/");
		}

		if (domain === "media.mstdn.io") {
			// https://media.mstdn.io/mstdn-media/cache/media_attachments/files/105/406/571/218/907/737/small/de548926bb1b2047.png
			//   https://media.mstdn.io/mstdn-media/cache/media_attachments/files/105/406/571/218/907/737/original/de548926bb1b2047.png
			return src.replace(/(\/mstdn-media\/+cache\/+media_attachments\/+files\/+(?:[0-9]{3}\/+)+)[a-z]+\/+/, "$1original/");
		}

		if (domain_nosub === "avaz.ba") {
			// thanks to nijaz-lab on github: https://github.com/qsniyg/maxurl/issues/579

			// 837 = 738, likely a typo on their side.
			// https://avaz.ba/media/2020/12/17/1395334/thumbs/873x400.jpg -- 738x415
			//   https://avaz.ba/media/2020/12/17/1395334/thumbs/w873.jpg -- 738x520
			//   https://avaz.ba/media/2020/12/17/1395334/thumbs/1200x700.jpg -- 1000x700, empty space around image
			newsrc = src.replace(/(\/media\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9]+\/+thumbs\/+)873x400(\.[^/.]+)(?:[?#].*)?$/, "$1w873$2");
			if (newsrc !== src) return newsrc;

			newsrc = src
				// https://avaz.ba/media/2020/12/20/1397496/thumbs/cover_small.jpg -- 306x427
				//   https://avaz.ba/media/2020/12/20/1397496/thumbs/cover_big.jpg -- 800x1116, upscaled
				.replace(/(\/media\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9]+\/+thumbs\/+)cover_small(\.[^/.]+)(?:[?#].*)?$/, "$1cover_big$2")
				// https://avaz.ba/media/2020/12/17/1395333/thumbs/240x225.jpg
				//   https://avaz.ba/media/2020/12/17/1395333/thumbs/873x400.jpg -- 750x465
				.replace(/(\/media\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9]+\/+thumbs\/+)240x225(\.[^/.]+)(?:[?#].*)?$/, "$1873x400$2");
			if (newsrc !== src) {
				return {
					url: newsrc,
					problems: {
						possibly_upscaled: true
					}
				};
			}

			regex = /(\/media\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9]+\/+thumbs\/+)(?:[0-9]+x[0-9]+|[wh][0-9]+)(\.[^/.]+)(?:[?#].*)?$/;
			if (regex && options.do_request && options.cb && !problem_excluded("possibly_upscaled")) {
				var larger_urls = [
					src.replace(regex, "$11200x700$2"),
					// https://sport.avaz.ba/media/2019/10/21/1083827/thumbs/1005x635.jpg
					src.replace(regex, "$11005x635$2"),
					// https://avaz.ba/media/2018/07/13/650140/thumbs/h550.jpg -- upscaled
					//   https://avaz.ba/media/2018/07/13/650140/thumbs/800x450.jpg -- 2152x720, even more upscaled
					src.replace(regex, "$1h550$2"),
					// https://avaz.ba/media/2020/12/15/1394018/thumbs/800x450.jpg -- 1280x720
					// https://avaz.ba/media/2018/04/04/562555/thumbs/800x450.jpg -- 1480x720
					src.replace(regex, "$1800x450$2"),
					src.replace(regex, "$1w873$2"),
					src.replace(regex, "$1873x400$2")
				];

				array_upush(larger_urls, src);

				common_functions["find_actual_largest_image"](src, larger_urls, function(src) {
					return options.cb({
						url: src,
						problems: {
							possibly_upscaled: true
						}
					});
				}, {
					check_length: true,
					api_cache: api_cache,
					do_request: options.do_request
				});

				return {
					waiting: true
				};
			}
		}

		if (domain === "cdn.firstshowing.net") {
			// https://cdn.firstshowing.net/firstshowing/images/cornerBR-playarrowcircle-goodv2.png
			if (/\/firstshowing\/+images\/+cornerBR-playarrowcircle-/.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}
		}

		if (domain_nowww === "22pixx.xyz") {
			// https://22pixx.xyz/os/2020/07/07/5f03f67fb1de7.jpeg
			//   https://22pixx.xyz/o/2020/07/07/5f03f67fb1de7.jpeg
			return src.replace(/(:\/\/[^/]+\/+)os\/+([0-9]{4}\/+)/, "$1o/$2");
		}

		if (domain === "i.prphotos.com" ||
			// http://www.prphotos.com/mas_assets/prphotos/images/cat-thumb.png
			domain_nowww === "prphotos.com") {
			// http://i.prphotos.com/mas_assets/prphotos/images/cat-thumb.png
			if (/\/mas_assets\/+prphotos\/+images\/+cat-thumb\.png/.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}

			// http://www.prphotos.com/p/GPR-146243/pete-buttigieg-at-celebrity-sightings-in-los-angeles-on-march-11-2020.html?&ps=3&x-start=2

			// http://i.prphotos.com/mas_assets/thumb/6243/GPR-146243.jpg -- 166x250, no watermark
			//   http://i.prphotos.com/mas_assets/full/6243/GPR-146243.jpg -- 399x600, watermark
			match = src.match(/^([a-z]+:\/\/[^/]+\/+mas_assets\/+)(?:thumb|full)(\/+[0-9]+\/+([A-Z]{3}-[0-9]+)\.[^/.]+)(?:[?#].*)?$/);
			if (match) {
				page = "https://www.prphotos.com/p/" + match[3] + "/";
				return fillobj_urls(replace_sizes(src, [
					{url: match[1] + "full" + match[2], problems: {watermark: true}},
					{url: match[1] + "thumb" + match[2], problems: {smaller: true}}
				], true), {extra: {page: page}});
			}

			// http://i.prphotos.com/t/6243/GPR-146243/Pete-Buttigieg-Celebrity-Sightings-in-Los-Angeles-on-March-11,-2020.jpg -- 166x250, no watermark
			//   http://i.prphotos.com/f/6243/GPR-146243/Pete-Buttigieg-Celebrity-Sightings-in-Los-Angeles-on-March-11,-2020.jpg -- 399x600, watermark
			match = src.match(/^([a-z]+:\/\/[^/]+\/+)[tf](\/+[0-9]+\/+([A-Z]{3}-[0-9]+)\/+[^/]+\.[^/.]+)(?:[?#].*)?$/);
			if (match) {
				page = "https://www.prphotos.com/p/" + match[3] + "/";
				return fillobj_urls(replace_sizes(src, [
					{url: match[1] + "f" + match[2], problems: {watermark: true}},
					{url: match[1] + "t" + match[2], problems: {smaller: true}}
				], true), {extra: {page: page}});
			}
		}

		if (amazon_container === "nrk-urort-prod") {
			// thanks to fedesk on discord
			// https://urort.p3.no/artist/SigridRaabe
			// https://nrk-urort-prod.s3.amazonaws.com/620x349/0047b218-f4fd-4632-817d-1cea877ffff7.jpg
			//   https://nrk-urort-prod.s3.amazonaws.com/images/0047b218-f4fd-4632-817d-1cea877ffff7.jpg
			return src.replace(/\/[0-9]+x[0-9]+\/+([-0-9a-f]{20,}\.[^/.]+)(?:[?#].*)?$/, "/images/$1");
		}

		if (domain === "d33mzpnc91f49u.cloudfront.net") {
			// https://d33mzpnc91f49u.cloudfront.net/620x349/https://nrk-urort-prod.s3.amazonaws.com/images/0047b218-f4fd-4632-817d-1cea877ffff7.jpg
			//   https://nrk-urort-prod.s3.amazonaws.com/images/0047b218-f4fd-4632-817d-1cea877ffff7.jpg
			return src.replace(/^[a-z]+:\/\/[^/]+\/+[0-9]+x[0-9]+\/+([a-z]+:\/\/)/, "$1");
		}

		if (domain_nowww === "imgcarry.com" ||
			// https://www.freebunker.com/tn/t84578/pic.jpg
			//   https://www.freebunker.com/tn/i84578/pic.jpg
			domain_nowww === "freebunker.com" ||
			domain_nowww === "imagefruit.com") {
			// https://www.imgcarry.com/tn/t20879/pic.jpg?id=a251b88c987c8390383732333437
			//   https://www.imgcarry.com/tn/i20879/pic.jpg?id=a251b88c987c8390383732333437
			return src.replace(/\/tn\/+t([0-9]+\/+)/, "/tn/i$1");
		}

		if (domain === "d10ukrc8bht4o0.cloudfront.net") {
			// https://d10ukrc8bht4o0.cloudfront.net/images/iva-img/7de8caf6847c9072b15248ae20296fef/source.jpg?width=240
			return {
				url: src.replace(/(\/images\/+iva-img\/.*?)\?.*$/, "$1"),
				headers: {
					Referer: "" // otherwise 400
				},
				can_head: false // 404
			};
		}

		if (domain_nosub === "redbubble.net" && /^ih[0-9]*\./.test(domain)) {
			// https://ih1.redbubble.net/image.253408870.4196/gptr,1400x,front,black-c,188,133,1000,1000-bg,f8f8f8.jpg - 1000x1000
			//   https://ih1.redbubble.net/image.253408870.4196/gptr,1400x,front,black-bg,f8f8f8.jpg -- 1400x2061
			//   https://ih1.redbubble.net/image.253408870.4196/gptr,x0,front,black-bg,f8f8f8.jpg -- 2109x3104
			//   https://ih1.redbubble.net/image.253408870.4196/bg,transparent.png -- 805x1000 (upscaled?)
			// https://ih1.redbubble.net/image.224306753.5509/drawstring_bag,x1400-bg,f8f8f8.jpg
			// https://ih1.redbubble.net/image.253408874.4196/ssrco,slim_fit_t_shirt,two_model,fafafa:ca443f4786,front,tall_portrait,750x1000.u9.jpg
			//   https://ih1.redbubble.net/image.253408874.4196/ssrco,slim_fit_t_shirt,two_model,fafafa:ca443f4786,front,tall_portrait,750x1000.jpg
			// https://ih0.redbubble.net/image.189891298.6563/ra,unisex_tshirt,x3104,e0e1dd:064437a66d,front-c,650,630,900,975-bg,f8f8f8.u2.jpg
			//   https://ih0.redbubble.net/image.189891298.6563/ra,unisex_tshirt,x3104,e0e1dd:064437a66d,front-bg,f8f8f8.jpg
			// https://ih1.redbubble.net/image.33299708.3043/poster,840x830,f8f8f8-pad,1000x1000,f8f8f8.u3.jpg
			//   https://ih1.redbubble.net/image.33299708.3043/poster,840x830,f8f8f8-bg,f8f8f8.jpg
			// https://ih0.redbubble.net/image.569660154.4250/flat,1000x1000,075,f.u3.jpg
			//   https://ih0.redbubble.net/image.569660154.4250/flat,1000x1000,075,f.jpg
			// https://ih1.redbubble.net/image.1455624340.2446/bg,f8f8f8-flat,750x,075,f-bg,f8f8f8.jpg
			//   https://ih1.redbubble.net/image.1455624340.2446/bg,f8f8f8.jpg -- 823x240
			// https://ih1.redbubble.net/image.33299708.3043/poster,840x830,f8f8f8-bg,f8f8f8.jpg
			//   https://ih1.redbubble.net/image.33299708.3043/bg,transparent.png
			// https://ih0.redbubble.net/image.726218132.3118/st,small,215x235-bg,f8f8f8.lite-1u1.jpg
			//   https://ih0.redbubble.net/image.726218132.3118/bg,transparent.png -- 806x1000
			// https://ih3.redbubble.net/image.5191888.8853/flat,550x550,075,f.jpg
			//   https://ih3.redbubble.net/image.5191888.8853/bg,transparent.png -- 1000x1000
			// https://ih0.redbubble.net/image.420938826.6391/ap,550x550,12x12,1,transparent,t.png
			//   https://ih0.redbubble.net/image.420938826.6391/bg,transparent.png -- 1000x1000, upscaled?
			// thanks to Noodlers on discord:
			// https://www.redbubble.com/shop/ap/25363838
			// https://ih1.redbubble.net/image.332651033.3838/st,small,507x507-pad,600x600,f8f8f8.jpg
			//   https://ih1.redbubble.net/image.332651033.3838/st,small,507x507-bg,f8f8f8.jpg
			//   https://ih1.redbubble.net/image.332651033.3838/tst,small,845x845-pad,1000x1000,f8f8f8.u6.jpg -- transparent sticker
			//   https://ih1.redbubble.net/image.332651033.3838/mo,small,flatlay,product_square,1000x1000.u6.jpg -- magnet
			//   https://ih1.redbubble.net/image.332651033.3838/bg,transparent.png -- 937x900

			var basename = url_basename(src);
			var newbn;

			let obj = {
				url: src,
				can_head: false,
				head_wrong_contentlength: true
			};

			var get_rb_obj = function() {
				obj.url = urljoin(src, newbn, true);
				return obj;
			};

			// thanks to anonymous for reporting:
			// https://ih1.redbubble.net/image.2940258874.1093/tsss,small,product,750x1000.webp
			//   https://ih1.redbubble.net/image.2940258874.1093/tsss,small,product,750x1000.png
			newbn = basename.replace(/\.webp(?:[?#].*)?$/, ".png");
			if (newbn !== basename) return get_rb_obj();

			// https://ih0.redbubble.net/image.726218132.3118/st%2Csmall%2C215x235-pad%2C210x230%2Cf8f8f8.lite-1u1.jpg
			//   https://ih0.redbubble.net/image.726218132.3118/st,small,215x235-bg,f8f8f8.lite-1u1.jpg
			newbn = decodeURIComponent(basename);
			if (newbn !== basename) return get_rb_obj();

			// crop
			newbn = basename.replace(/-c(?:,[0-9]+){4}/, "");
			if (newbn !== basename) return get_rb_obj();

			// this will crop the image to the specified size if it's larger, so replace it with "-bg" instead to keep the background
			newbn = basename.replace(/-pad,[0-9]+x[0-9]+,([0-9a-f]{6})/, "-bg,$1");
			if (newbn !== basename) return get_rb_obj();

			newbn = basename.replace(/\.u[0-9]*\./, ".");
			if (newbn !== basename) return get_rb_obj();

			// doesn't work anymore
			if (false&&/\/image\.[0-9]+\.[0-9]+\//.test(src)) {
				newbn = "bg,transparent.png"
				return get_rb_obj();
			}

			// thanks to Noodlers on discord
			// https://ih0.redbubble.net/work.2681935.2.fig,army,womens,fbfbfb.lindisfarne-st-johns-knot-grunge-v3.jpg
			//   https://ih0.redbubble.net/work.2681935.2.bg,transparent.jpg
			// https://ih3.redbubble.net/work.7038169.1.flat,550x550,075,f.333-collins-st-melbourne-australia.jpg
			//   https://ih3.redbubble.net/work.7038169.1.bg,transparent.jpg
			if (/^work\.[0-9]+\.[0-9]+\./.test(basename)) {
				newbn = basename.replace(/^(work\.[0-9]+\.[0-9]+\.).*?(\.[^/.]+)(?:[?#].*)?$/, "$1bg,transparent$2");
				return get_rb_obj();
			}

			return obj;
		}

		if (domain === "res.booklive.jp") {
			// thanks to fireattack on github: https://github.com/qsniyg/maxurl/issues/587
			// https://res.booklive.jp/883771/001/thumbnail/S.jpg -- 77x109
			//   https://res.booklive.jp/883771/001/thumbnail/M.jpg -- 130x184
			//   https://res.booklive.jp/883771/001/thumbnail/L.jpg -- 180x255, looks upscaled or compressed
			//   https://res.booklive.jp/883771/001/thumbnail/2L.jpg -- 240x339, looks upscaled or compressed
			//   https://res.booklive.jp/883771/001/thumbnail/X.jpg -- 1768x2500, unscaled
			newsrc = src.replace(/(\/thumbnail\/+)2?[SML](\.[^/.]+)(?:[?#].*)?$/, "$1X$2");
			if (newsrc !== src) {
				return {
					url: newsrc,
					head_wrong_contenttype: true
				};
			}
		}

		if (domain_nowww === "viviancruz.net") {
			// https://www.viviancruz.net/files/page0-1002-thumb.jpg
			//   https://www.viviancruz.net/files/page0-1002-full.jpg
			return src.replace(/(\/files\/+page[0-9]+-[0-9]+-)thumb(\.[^/.]+)(?:[?#].*)?$/, "$1full$2");
		}

		if (domain_nowww === "newtube.app") {
			match = src.match(/\/uploads\/+([^/]+)\/+([a-zA-Z0-9]+)\.jpg(?:[?#].*)?$/);
			if (match) {
				return {
					url: "https://newtube.app/uploads/" + match[1] + "/" + match[2] + ".mp4",
					video: true
				};
			}

			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+([^/]+)\/+([a-zA-Z0-9]+)(?:[?#].*)?$/,
				run: function(cb, match) {
					cb([
						{
							url: "https://newtube.app/uploads/" + match[1] + "/" + match[2] + ".mp4",
							video: true
						},
						"https://newtube.app/uploads/" + match[1] + "/" + match[2] + ".jpg"
					]);
				}
			});
			if (newsrc) return newsrc;
		}

		if (amazon_container === "fans-s3-18hhz4pv58rts-contentsbucket-llfrgay54iyy") {
			// https://fans-s3-18hhz4pv58rts-contentsbucket-llfrgay54iyy.s3.amazonaws.com/uploads/artist/key_visual/5247/resize_510_7df4ae62a0
			//   https://fans-s3-18hhz4pv58rts-contentsbucket-llfrgay54iyy.s3.amazonaws.com/uploads/artist/key_visual/5247/7df4ae62a0 -- 4608x3072
			// https://fans-s3-18hhz4pv58rts-contentsbucket-llfrgay54iyy.s3.amazonaws.com/uploads/artist/cover_image/5247/resize_1125_2e9f789ca8 -- 1125x483
			//   https://fans-s3-18hhz4pv58rts-contentsbucket-llfrgay54iyy.s3.amazonaws.com/uploads/artist/cover_image/5247/2e9f789ca8 -- 1855x796
			// https://fans-s3-18hhz4pv58rts-contentsbucket-llfrgay54iyy.s3.amazonaws.com/uploads/media/file/5e3baf819c3807225b30a8a5/resize_2560_bb4912e84e -- 1920x2560
			//   https://fans-s3-18hhz4pv58rts-contentsbucket-llfrgay54iyy.s3.amazonaws.com/uploads/media/file/5e3baf819c3807225b30a8a5/bb4912e84e -- 3024x4032
			//   https://www.fansnet.jp/resources/5e3baf819c3807225b30a8a5/file -- same as this
			// https://fans-s3-18hhz4pv58rts-contentsbucket-llfrgay54iyy.s3.amazonaws.com/uploads/media/file/5f103fb8ac107065180a0bd0/resize_horizontal_1250_4b510850c2
			//   https://fans-s3-18hhz4pv58rts-contentsbucket-llfrgay54iyy.s3.amazonaws.com/uploads/media/file/5f103fb8ac107065180a0bd0/4b510850c2
			return src.replace(/(\/uploads\/+(?:artist\/+[^/]+\/+[0-9]+\/+|media\/+file\/+[0-9a-f]{10,}\/+|video_media\/+thumbnail\/+[0-9a-f]{10,}\/+))(?:resize_(?:horizontal_)?[0-9]+|convert_blur)?_([0-9a-f]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "fansnet.jp") {
			// https://www.fansnet.jp/resources/5ee2f62a276ede0d36e5fa06/resize_744
			//   https://www.fansnet.jp/resources/5ee2f62a276ede0d36e5fa06/file -- 512x1050
			// filename can be anything, but resize_[0-9]+ and blur are supported
			// https://www.fansnet.jp/takuya1986/posts/5e3baf869c3807225b30a8a7
			// https://www.fansnet.jp/resources/5e3baf819c3807225b30a8a5/resize_744
			//   https://www.fansnet.jp/resources/5e3baf819c3807225b30a8a5/file -- 3024x4032
			return src.replace(/(\/resources\/+[0-9a-f]{10,}\/+)resize_(?:horizontal_)?[0-9]+(?:[?#].*)?$/, "$1file");
		}

		if (domain_nosub === "fotki.com" && /^images[0-9]*\./.test(domain)) {
			// https://images54.fotki.com/v1642/photos/4/134844/13058623/IMG_0336Adjusted-th.jpg
			//   https://images54.fotki.com/v1642/photos/4/134844/13058623/IMG_0336Adjusted-vi.jpg
			return src.replace(/(\/photos\/+[0-9]+\/+[0-9]+\/+[0-9]+\/+[^/]*)-th(\.[^/.]+)(?:[?#].*)?$/, "$1-vi$2");
		}

		if (domain_nowww === "sendvid.com") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+(?:embed\/+)?([a-z0-9]{5,})(?:[?#].*)?$/,
				query_for_id: "https://sendvid.com/${id}",
				process: function(done, resp, cache_key) {
					var title = get_meta(resp.responseText, "og:title");
					var video = get_meta(resp.responseText, "og:video:secure_url");
					var thumb = get_meta(resp.responseText, "og:image");
					var url = get_meta(resp.responseText, "og:url") || resp.finalUrl;

					var obj = {
						extra: {
							caption: title,
							page: url
						}
					};

					var urls = [];

					urls.push({
						url: video,
						video: "hls",
						is_private: true // linked to ip
					});

					urls.push(thumb);

					return done(fillobj_urls(urls, obj), 60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nosub === "sendvid.com" && /^thumbs[0-9]*\./.test(domain)) {
			match = src.match(/^[a-z]+:\/\/[^/]+\/+[0-9]{2}\/+[0-9]{2}\/+([0-9a-z]{5,})\./);
			if (match) {
				return {
					url: "https://sendvid.com/" + match[1],
					is_pagelink: true
				};
			}
		}

		if (domain === "imageproxy.viewbook.com") {
			// https://imageproxy.viewbook.com/a22ab14f4e2f7c3ddbe8fc6b48cde6d6_hd.jpg?fit=max&dpr=1&w=200
			//   https://imageproxy.viewbook.com/a22ab14f4e2f7c3ddbe8fc6b48cde6d6_hd.jpg -- 576x800
			//   https://imageproxy.viewbook.com/a22ab14f4e2f7c3ddbe8fc6b48cde6d6.jpg -- 403
			// https://imageproxy.viewbook.com/8fae981922243d35e7591d2c151b6b3c_hd.jpg -- 1655x1080
			//   https://imageproxy.viewbook.com/8fae981922243d35e7591d2c151b6b3c.jpg -- 1968x1284
			return {
				url: src
					.replace(/_hd(\.[^/.?#]+)$/, "$1")
					.replace(/\?.*/, ""),
				head_wrong_contenttype: true
			};
		}

		if (domain_nowww === "nintendo64ever.com") {
			// thanks to CetaceanNation on github: https://github.com/qsniyg/maxurl/issues/590
			// http://www.nintendo64ever.com/scans/boites/thumbnails/007--Le-Monde-ne-Suffit-pas-4-scan-boite-avant_178x127.jpg
			//   http://www.nintendo64ever.com/scans/boites/007--Le-Monde-ne-Suffit-pas-4-scan-boite-avant.jpg
			return src.replace(/\/thumbnails\/+([^/]+)_[0-9]+x[0-9]+(\.[^/.]+)(?:[?#].*)?$/, "/$1$2");
		}

		if (googlestorage_container === "studio-design-assets" ||
			// thanks to fireattack on discord:
			// https://storage.googleapis.com/studio-design-asset-files/projects/VGOKxnDGqn/s-1500x700_v-fms_webp_214a2ec7-3bfc-486e-9517-6d5af1dd61e1_small.webp
			//   https://storage.googleapis.com/studio-design-asset-files/projects/VGOKxnDGqn/s-1500x700_v-fms_webp_214a2ec7-3bfc-486e-9517-6d5af1dd61e1.webp-- 1500x700
			googlestorage_container === "studio-design-asset-files") {
			// thanks to dym-sh on github: https://github.com/qsniyg/maxurl/issues/599
			// https://tomeinohito.studio.site/Gallery
			// https://storage.googleapis.com/studio-design-assets/projects/1YWjpXEbqm/s-2400x1600_v-frms_webp_b0e6503f-600c-4e62-902b-da03866ec997_small.webp
			//   https://storage.googleapis.com/studio-design-assets/projects/1YWjpXEbqm/s-2400x1600_v-frms_webp_b0e6503f-600c-4e62-902b-da03866ec997.webp
			return src.replace(/(\/projects\/+[^/]+\/+s-[0-9]+x[0-9]+_[^/.]+_[-0-9a-f]{10,})_small(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "arkiv.klassekampen.no") {
			// thanks to fedesk on discord
			// https://arkiv.klassekampen.no/storyimage/KK/20170130/PLUSS/170139939/AR/0/AR-170139939.jpg&MaxW=860
			//   https://arkiv.klassekampen.no/storyimage/KK/20170130/PLUSS/170139939/AR/0/AR-170139939.jpg
			// https://arkiv.klassekampen.no/storyimage/KK/20170130/PLUSS/170139939/AR/0/AR-170139939.jpg?MaxW=860
			//   https://arkiv.klassekampen.no/storyimage/KK/20170130/PLUSS/170139939/AR/0/AR-170139939.jpg -- 3741x5612
			return {
				url: src.replace(/(\/storyimage\/.*?)[?&#].*/, "$1"),
				head_wrong_contenttype: true
			};
		}

		if (domain_nowww === "remnant-tv.com") {
			// https://www.remnant-tv.com/view/img/loading-gif.png
			if (/\/view\/+img\/+loading-gif\./.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}

			// https://www.remnant-tv.com/video/52/remnant-tv?page=1&channelName=RemnantTV
			// https://www.remnant-tv.com/videoEmbeded/52?autoplay=0&controls=1&loop=0&mute=0&t=0
			newsrc = website_query({
				website_regex: [
					/^[a-z]+:\/\/[^/]+\/+video\/+([0-9]+)\/+([^/?#]+)(?:[?#].*)?$/,
					/^[a-z]+:\/\/[^/]+\/+videoEmbeded\/+([0-9]+)(?:[?#].*)?$/
				],
				query_for_id: "https://www.remnant-tv.com/videoEmbeded/${id}",
				process: function(done, resp, cache_key) {
					var obj = common_functions["get_videotag_obj"](resp);
					if (obj) {
						array_foreach(obj, function(single) {
							if (single.extra.caption)
								single.extra.caption = single.extra.caption.replace(/\s*-\s*Remnant TV\s*$/, "");
						});
					}

					done(obj, obj ? 60*60 : false);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "tv.gab.com") {
			newsrc = website_query({
				website_regex: {
					regex: /^[a-z]+:\/\/[^/]+\/+channel\/+([^/]+)\/+(?:embed|view)\/+([^/?#]+-[0-9a-f]{10,})(?:[?#].*)?$/,
					groups: ["channel", "id"]
				},
				query_for_id: "https://tv.gab.com/channel/${channel}/embed/${id}",
				process: function(done, resp, cache_key, match) {
					var channel = match.groups.channel;
					var fullid = match.groups.id;

					match = resp.responseText.match(/<div[^>]+\sid="tv-player"[^>]+>/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					var info = parse_tag_def(match[0]);
					var title = info.args["data-episode-title"];
					var id = info.args["data-episode-id"];
					var viewkey = info.args["data-view-key"];

					var extra = {
						caption: title,
						author_username: channel,
						page: "https://tv.gab.com/channel/" + channel + "/view/" + fullid
					};

					var urls = [];

					urls.push({
						url: "https://tv.gab.com/media/" + id + "?viewKey=" + viewkey,
						imu_mode: "video",
						headers: {
							Referer: extra.page,
						},
						cookie_url: "https://tv.gab.com/", // hack, it requires cookies. browser refuses to load cookies for that site if embedded
						video: true
					});

					var thumbnail = get_meta(resp.responseText, "og:image");
					urls.push(thumbnail);

					return done(fillobj_urls(urls, {extra: extra}), 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "nhm.ac.uk") {
			// https://www.nhm.ac.uk/content/dam/nhmwww/discover/wpy-2020-winning-images/wpy-winning-image-full-width.jpg.thumb.1160.1160.jpg
			//   https://www.nhm.ac.uk/content/dam/nhmwww/discover/wpy-2020-winning-images/wpy-winning-image-full-width.jpg
			// https://www.nhm.ac.uk/content/dam/nhmwww/visit/virtual-museum/gac-nhm-360-tour-hti-double.jpg.thumb.768.768.jpg
			//   https://www.nhm.ac.uk/content/dam/nhmwww/visit/virtual-museum/gac-nhm-360-tour-hti-double.jpg
			newsrc = src.replace(/(\/content\/+dam\/+.*\.[^/.]+)\.thumb\.[0-9]+\.[0-9]+\.[^/.]+(?:[?#].*)?$/, "$1");
			if (newsrc !== src) return newsrc;

			// thanks to arovane on github: https://github.com/qsniyg/maxurl/issues/605
			// https://www.nhm.ac.uk/resources/visit/wpy/2019/small/webp/19.webp
			//   https://www.nhm.ac.uk/resources/visit/wpy/2019/large/webp/19.webp
			//   https://www.nhm.ac.uk/resources/visit/wpy/2019/large/19.jpg -- 2560x1292
			// https://www.nhm.ac.uk/resources/visit/wpy/2020/peoples-choice/medium/b4849a58-81a6-46d5-b232-e8056123416d.jpg
			//   https://www.nhm.ac.uk/resources/visit/wpy/2020/peoples-choice/large/b4849a58-81a6-46d5-b232-e8056123416d.jpg -- 1536x1682
			// https://www.nhm.ac.uk/resources/visit/wpy/2015/peoples-choice/large/6.jpg -- 2560x1523
			// all /large/ appear to be scaled down to 2560x* width
			return src
				.replace(/(\/resources\/+visit\/+wpy\/+[0-9]{4}\/+(?:[^/]+\/+)?large\/+)webp\/+([^/.]+)\.webp(?:[?#].*)?$/, "$1$2.jpg")
				.replace(/(\/resources\/+visit\/+wpy\/+[0-9]{4}\/+(?:[^/]+\/+)?)(?:small|medium)\/+/, "$1large/");
		}

		if (domain_nowww === "bear-family.com" && host_domain_nowww === "bear-family.com" && options.element) {
			// thanks to nimuxoha on github: https://github.com/qsniyg/maxurl/issues/608
			// https://www.bear-family.com/various-james-dean-birthday-celebration-cd.html
			// https://www.bear-family.com/various-talking-on-the-telephone-rock-n-roll-and-teen-pop-cd.html
			if (options.element.tagName === "IMG") {
				var parent = options.element.parentElement;
				if (parent && parent.tagName === "SPAN" && parent.classList.contains("image--media")) {
					var dparent = parent.parentElement;
					if (dparent && dparent.tagName === "SPAN" && dparent.classList.contains("image--element")) {
						if (dparent.hasAttribute("data-img-original")) newsrc = dparent.getAttribute("data-img-original");
						else if (dparent.hasAttribute("data-img-large")) return dparent.getAttribute("data-img-large");

						if (newsrc !== src) return newsrc;
					}
				} else if (parent && parent.tagName === "A" && /\/media\/+image\//.test(parent.href)) {
					// thumbnails
					newsrc = parent.href;
					if (newsrc !== src) return newsrc;
				}
			}
		}

		if (digitalocean_container === "production-2") {
			// https://production-2.nyc3.cdn.digitaloceanspaces.com/playlog_image/thumbnail_large/image-128456679379456000.jpg
			//   https://production-2.nyc3.cdn.digitaloceanspaces.com/playlog_image/image-128456679379456000.jpg
			// https://production-2.nyc3.cdn.digitaloceanspaces.com/playlog_card/thumbnail_medium/playlog-z4u0xa3iznk.jpg
			//   https://production-2.nyc3.cdn.digitaloceanspaces.com/playlog_card/thumbnail_large/playlog-z4u0xa3iznk.jpg
			//   https://production-2.nyc3.cdn.digitaloceanspaces.com/playlog_card/card/playlog-z4u0xa3iznk.jpg -- 720x540
			//   https://production-2.nyc3.cdn.digitaloceanspaces.com/playlog_card/thumbnail_xlarge/playlog-z4u0xa3iznk.jpg -- 1080x810 (not upscaled)
			return src
				.replace(/(\/playlog_image\/+)thumbnail(?:_[a-z]+)?\/+/, "$1");
		}

		if (domain_nowww === "playlog.com") {
			var query_playlog_csrf = function(cb) {
				api_query("playlog_csrf", {
					url: "https://playlog.com"
				}, cb, function(done, resp, cache_key) {
					var csrf_token = get_meta(resp.responseText, "csrf-token");
					if (!csrf_token) {
						console_error(cache_key, "Unable to find CSRF token for", resp);
						return done(null, false);
					}

					return done(csrf_token, 60*60);
				});
			};

			var query_playlog_xsrf = function(cb) {
				if (!options.get_cookies) {
					console_warn("No cookie support");
					return cb(null);
				}

				options.get_cookies("https://playlog.com/api/", function(cookies) {
					if (!cookies) {
						console_error("Unable to get cookies for playlog");
						return cb(null);
					}

					cookies = headers_list_to_dict(cookies);
					var xsrf = cookies["xsrf-token"];

					cb(xsrf);
				});
			};

			var query_playlog_csrf_xsrf = function(cb) {
				// do xsrf first as it doesn't require any requests
				query_playlog_xsrf(function(xsrf) {
					if (!xsrf) return cb(null);

					query_playlog_csrf(function(csrf) {
						if (!csrf) return cb(null);

						return cb({
							xsrf: xsrf,
							csrf: csrf
						});
					});
				});
			};

			var query_playlog_api = function(token, url, cb) {
				api_query("playlog_api:" + url, {
					url: url,
					imu_mode: "xhr",
					headers: {
						"Referer": src.replace(/#.*/, ""),
						"x-api-version": "v2",
						"x-csrf-token": token.csrf,
						"x-requested-with": "XMLHttpRequest",
						"x-resource-version": "new",
						"x-xsrf-token": token.xsrf
					},
					json: true
				}, cb, function(done, resp, cache_key) {
					if (resp.return_code !== 0) {
						console_error(cache_key, resp);
						return done(null, false);
					}

					return done(resp, 60*60);
				});
			};

			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+playlogs\/+([a-z0-9]{5,})(?:[?#].*)?$/,
				override_cb: function(cb, data) {
					var wanted_image = null;

					var queries = common_functions["parse_imu_hash"](src);
					if (queries && queries.image) wanted_image = queries.image;

					if (!wanted_image) return cb(data);

					wanted_image = url_basename(wanted_image);

					common_functions["update_album_info_links"](data, function(x) {
						return url_basename(x) === wanted_image;
					});

					cb(data);
				},
				run: function(cb, match) {
					var id = match[1];

					query_playlog_csrf_xsrf(function(token) {
						if (!token) return cb(null);

						query_playlog_api(token, "https://playlog.com/api/playlogs/" + id, function(data) {
							if (!data) return cb(null);

							var playlog = data.data.playlog;

							// todo: get audio
							var obj = {
								extra: {
									page: "https://playlog.com/playlogs/" + id,
									caption: playlog.description,
									created_date: playlog.uploaded_at * 1000,
									author_username: playlog.user.name
									// uid = playlog.user.id
								}
							};

							var links = [];

							// there's also visual_frames
							array_foreach(playlog.image_frames, function(image) {
								// todo: maybe filename?
								links.push({
									url: image.image.url,
									is_current: false
								});
							});

							obj.album_info = {
								type: "links",
								links: links
							};

							links[0].is_current = true;

							return cb(fillobj_urls([links[0].url], obj));
						});
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if ((domain_nosub === "amplience.net" && /^i[0-9]*\./.test(domain)) ||
			// https://cdn.media.amplience.net/i/jpl/220426-NY-blog-upgrade-your-horse-riding-clothes-brogini-ostuni-v2-riding-boots-2?qlt=80&w=794&h=794&sm=c
			//   https://cdn.media.amplience.net/i/jpl/220426-NY-blog-upgrade-your-horse-riding-clothes-brogini-ostuni-v2-riding-boots-2
			domain === "cdn.media.amplience.net" ||
			// thanks to MinuteAd8502 on github: https://github.com/qsniyg/maxurl/issues/844
			// https://media.finishline.com/i/finishline/1360835_100_M1?$default$&w=671&&h=671&bg=rgb(237,237,237)
			//   https://media.finishline.com/i/finishline/1360835_100_M1
			domain === "media.finishline.com" ||
			// thanks to Slugman336 on github: https://github.com/qsniyg/maxurl/issues/476
			// https://media.jdsports.com/i/jdsports/1361945_001_M4?$default$&w=1000&h=1000&bg=rgb(237,237,237)
			domain === "media.jdsports.com") {
			// thanks to SlugMan336 on github: https://github.com/qsniyg/maxurl/issues/475
			// https://i8.amplience.net/i/jpl/jd_146327_b?qlt=92&w=600&h=765&v=1
			//   https://i8.amplience.net/i/jpl/jd_146327_b

			// thanks to GoblinLegislator on github: https://github.com/qsniyg/maxurl/issues/613
			// https://i8.amplience.net/t/jpl/jd_product_list?plu=jd_146327_bl&qlt=92&w=363&h=363&v=1&fmt=webp
			//   https://i8.amplience.net/i/jpl/jd_146327_bl
			if (/\/t\/+jpl\/+jd_product_list\?/.test(src)) {
				var queries = get_queries(src);
				if (queries.plu) {
					return urljoin(src, "/i/jpl/" + queries.plu, true);
				}
			} else if (/\/i\/+jpl\//.test(src)) {
				return src.replace(/\?.*/, "");
			}
		}

		if (domain === "cdn.media.amplience.net") {
			// https://cdn.media.amplience.net/i/harryrosen/20096712053_large.webp
			let obj = {
				url: src,
				bad_if: [{
					headers: {
						"x-amp-published": "Sat, 13 Aug 2022 04:11:19 GMT",
						"x-amp-source-height": "1031",
						"x-amp-source-width": "1280",
						"content-length": "11185"
					}
				}]
			};

			// thanks to anonymous for reporting:
			// https://cdn.media.amplience.net/s/hottopic/17903850_hi_large.jpg
			// https://cdn.media.amplience.net/s/hottopic/20784856_hi?$productMainDesktop$
			//   https://cdn.media.amplience.net/s/hottopic/20784856_hi -- 4800x7200
			// https://cdn.media.amplience.net/i/harryrosen/20096712053_large.webp
			//   https://cdn.media.amplience.net/i/harryrosen/20096712053 -- 3370x4000
			// other:
			// https://cdn.media.amplience.net/i/frasersdev/62443469_o.jpg?v=230331172020 -- 2000x2000
			obj.url = src
				.replace(/(\/i\/+harryrosen\/+[0-9]+)_[a-z]+(?:\.[a-z]+)?(?:[?#].*)?$/, "$1")
				.replace(/(\/s\/+hottopic\/+[0-9]+_hi)(?:_[a-z]+)?(?:\.[a-z]+)?(?:[?#].*)?$/, "$1");

			return obj;
		}

		if (domain_nowww === "indigowhitetv.com") {
			// https://indigowhitetv.com/assets/heart-circle-pink.PNG
			if (/\/assets\/+heart-circle-pink\./.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}
		}

		if (domain_nosub === "dgtle.com" && /^s[0-9]*\./.test(domain)) {
			// thanks to doio on github: https://github.com/qsniyg/maxurl/issues/620
			// https://www.dgtle.com/sale-1626897-1.html
			// http://s1.dgtle.com/dgtle_img/sale/2021/01/15e2d26202101151330153356_1800_500.jpeg
			//   http://s1.dgtle.com/dgtle_img/sale/2021/01/15e2d26202101151330153356.jpeg -- 1808x2997
			// http://s1.dgtle.com/dgtle_img/sale/2021/01/15b8bd5202101151330571350_1800_500.jpeg
			//   http://s1.dgtle.com/dgtle_img/sale/2021/01/15b8bd5202101151330571350.jpeg -- 3011x1528
			// https://www.dgtle.com/sale-1694544-1.html
			// http://s1.dgtle.com/dgtle_img/sale/2022/03/01/2661F202203011232056988_1800_500_w.jpeg
			//   http://s1.dgtle.com/dgtle_img/sale/2022/03/01/2661F202203011232056988.jpeg
			return src.replace(/(\/dgtle_img\/+[^/]+\/+[0-9]{4}\/+(?:[0-9]{2}\/+){1,2}[0-9a-fA-F]{20,})_[0-9]+_[0-9]+(?:_w)?(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		// orange image hosting script
		if (domain_nowww === "trumbhost.com" ||
			// thanks to MinuteAd8502 on github: https://github.com/qsniyg/maxurl/issues/791
			// http://crazyimg.com/images/2016/07/t2qs4ie6xwhg6o2r7rel_tn.jpg
			//   http://crazyimg.com/images/2016/07/t2qs4ie6xwhg6o2r7rel.jpg
			domain_nowww === "crazyimg.com") {
			// https://trumbhost.com/images/2019/12/qm1dqgbgzwcuo26n4cl0_tn.jpg
			//   https://trumbhost.com/images/2019/12/qm1dqgbgzwcuo26n4cl0.jpg
			return src.replace(/(\/images\/+[0-9]{4}\/+[0-9]{2}\/+[0-9a-z]{10,})_tn(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "brandnewtube.com") {
			// https://brandnewtube.com/watch/glass-sky-sun-reflects-off-dome_zf29CMpLJON4WJD.html
			// https://brandnewtube.com/embed/zf29CMpLJON4WJD
			newsrc = website_query({
				website_regex: [
					/^[a-z]+:\/\/[^/]+\/+watch\/+(?:[^/._?#]+)?_([a-zA-Z0-9]{10,})\.html(?:[?#].*)?$/,
					/^[a-z]+:\/\/[^/]+\/+embed\/+([a-zA-Z0-9]{10,})(?:[?#].*)?$/
				],
				query_for_id: "https://brandnewtube.com/watch/_${id}.html",
				process: function(done, resp, cache_key) {
					var obj = common_functions["get_videotag_obj"](resp);
					done(obj, obj ? 60*60 : false);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "onevsp.com") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+watch\/+([0-9a-zA-Z]+)\/*(?:[?#].*)?$/,
				query_for_id: "https://onevsp.com/watch/${id}",
				process: function(done, resp, cache_key) {
					var obj = common_functions["get_videotag_obj"](resp);
					done(obj, obj ? 60*60 : false);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "cdn.betterttv.net") {
			// thanks to Ox on discord
			// https://cdn.betterttv.net/emote/566c9fc265dbbdab32ec053b/1x
			//   https://cdn.betterttv.net/emote/566c9fc265dbbdab32ec053b/3x
			return src.replace(/(\/emote\/+[0-9a-f]{10,}\/+)[12]x(?:[?#].*)?$/, "$13x");
		}

		if (domain === "cdn.frankerfacez.com") {
			// thanks to Ox on discord
			// https://cdn.frankerfacez.com/emote/227992/1 -- 32x32
			//   https://cdn.frankerfacez.com/emote/227992/2 -- 64x64
			//   https://cdn.frankerfacez.com/emote/227992/3 -- {"status":400,"error":"Bad Request","message":"params.scale should be equal to one of the allowed values"}
			//   https://cdn.frankerfacez.com/emote/227992/4 -- 128x128
			// 8 is also 400
			return src.replace(/(\/emote\/+[0-9]+\/+)[12](?:[?#].*)?$/, "$14");
		}

		if (domain_nowww === "wsgf.org") {
			// https://www.wsgf.org/f/u/imagecache/ingame_screenshot_normal/contrib/dr/27648/ingame_4x3.png
			//   https://www.wsgf.org/f/u/imagecache/node-gallery-display/contrib/dr/27648/ingame_4x3.png
			// https://www.wsgf.org/f/u/imagecache/ingame_screenshot_wide/contrib/dr/27648/ingame_16x9.png
			//   https://www.wsgf.org/f/u/imagecache/node-gallery-display/contrib/dr/27648/ingame_16x9.png
			return src.replace(/(\/f\/+u\/+imagecache\/+)ingame_screenshot_(?:normal|wide)\/+/, "$1node-gallery-display/");
		}

		if (domain_nowww === "hotarena.net") {
			// https://hotarena.net/userfiles/content/64539/555/skandal-v-igri-na-voliata-globiavat-todor-jeliazkov-sas-100-bona-perata-ot-rijite-skochi-go-zashtitava-video-1.jpg
			//   https://hotarena.net/userfiles/content/64539/original/skandal-v-igri-na-voliata-globiavat-todor-jeliazkov-sas-100-bona-perata-ot-rijite-skochi-go-zashtitava-video-1.jpg
			return src.replace(/(\/userfiles\/+content\/+[0-9]+\/+)[0-9]+\/+/, "$1original/");
		}

		if (domain === "i.gifer.com") {
			// https://i.gifer.com/origin/51/517d45dfa6f1ade73e8968e8c9a86e6b_w200.gif
			//   https://i.gifer.com/origin/51/517d45dfa6f1ade73e8968e8c9a86e6b.gif
			// https://i.gifer.com/origin/51/517d45dfa6f1ade73e8968e8c9a86e6b_w200.webp
			//   https://i.gifer.com/origin/51/517d45dfa6f1ade73e8968e8c9a86e6b.webp
			// https://i.gifer.com/origin/51/517d45dfa6f1ade73e8968e8c9a86e6b_mob.gif
			//   https://i.gifer.com/origin/51/517d45dfa6f1ade73e8968e8c9a86e6b.gif
			newsrc = src.replace(/(\/origin\/+[0-9a-f]{2}\/+[0-9a-f]{10,})_(?:w[0-9]+|mob)(\.(?:gif|webp))(?:[?#].*)?$/, "$1$2");
			if (newsrc !== src) return newsrc;

			// https://i.gifer.com/origin/51/517d45dfa6f1ade73e8968e8c9a86e6b.gif
			//   https://i.gifer.com/origin/51/517d45dfa6f1ade73e8968e8c9a86e6b.webp
			//   https://i.gifer.com/origin/51/517d45dfa6f1ade73e8968e8c9a86e6b.mp4 -- upscaled
			newsrc = src.replace(/(\/origin\/+[0-9a-f]{2}\/+[0-9a-f]{10,})\.(?:gif|webp)(?:[?#].*)?$/, "$1.mp4");
			if (false && newsrc !== src) {
				return {
					url: newsrc,
					video: true
				};
			}

			// concat function:
			//
			// function urlconcat(server, path, ext, info) {
			//   var params = [];
			//   var url = server;
			//
			//   if (info.width) params.push(info.width);
			//   if (info.height) params.push(info.height);
			//
			//   if (params.length) {
			//     params.push("preview");
			//     url += "/fetch/" + params.join("-") + "/";
			//   } else if (info.preset) {
			//     url += "/preset/" + info.preset + "/";
			//   } else {
			//     url += "/origin/";
			//   }
			//
			//   url += path + "." + ext;
			//
			//   if (info.addHttp && !/^http/.test(url)) {
			//     url = "https:" + url;
			//   }
			//
			//   return url;
			// }
			//
			// valid presets: facebook_play, vk_play, ok_play, twitter_play
			// servers can be found with: https://i.gifer.com/servers ({"1":"https://i.gifer.com"})

			// https://i.gifer.com/fetch/w300-preview/51/517d45dfa6f1ade73e8968e8c9a86e6b.gif
			//   https://i.gifer.com/origin/51/517d45dfa6f1ade73e8968e8c9a86e6b.gif
			// https://i.gifer.com/preset/vk_play/51/517d45dfa6f1ade73e8968e8c9a86e6b.gif
			newsrc = src.replace(/\/(?:fetch|preset)\/+[^/]+\/+([0-9a-f]{2}\/+[0-9a-f]{10,})\.[^/.]+(?:[?#].*)?$/, "/origin/$1.gif");
			if (newsrc !== src) return newsrc;

			// https://i.gifer.com/6L0E.gif
			// https://i.gifer.com/6L0E.mp4
			// https://i.gifer.com/6L0E.webp
			match = src.match(/^[a-z]+:\/\/[^/]+\/+([A-Z0-9]+)\.[^/.]+(?:[?#].*)?$/);
			if (match) {
				return {
					url: "https://gifer.com/" + match[1],
					is_pagelink: true
				};
			}
		}

		if (domain_nowww === "gifer.com") {
			var query_gifer_media = function(id, cb) {
				api_query("gifer:" + id, {
					url: "https://gifer.com/api/media/" + id + "?include=creator,tags.tag",
					imu_mode: "xhr",
					headers: {
						"ab": "b",
						"accept": "*/*",
						"accept-language": "en", // or *
						"content-type": "application/json",
						referer: "https://gifer.com/en/" + id
					},
					json: true
				}, cb, function(done, resp, cache_key) {
					if (!resp.file || !resp.file.formats) {
						console_error(cache_key, "Unable to find formats in", resp);
						return done(null, false);
					}
					return done(resp, 6*60*60);
				});
			};

			var gifer_media_to_obj = function(data) {
				// todo: maybe get servers? currently there's only one server
				var extra = {};

				// iso + z
				if (data.createdAt) extra.created_date = new Date(data.createdAt).getTime();

				if (data.creator) {
					if (data.creator.username) extra.author_username = data.creator.username;
					//if (data.creator.id) extra.author_uid = data.creator.id; //(string)
				}

				extra.page = "https://gifer.com/" + data.id;
				// todo: maybe turn tags into caption?

				var obj = {extra: extra};

				var urls = [];
				var base = "https://i.gifer.com/origin/" + data.file.path;

				// upscaled?
				if (false && array_indexof(data.file.formats, "mp4") >= 0) {
					urls.push({
						url: base + ".mp4",
						video: true
					});
				}

				urls.push(base + ".gif");
				urls.push(base + ".webp");

				return fillobj_urls(urls, obj);
			};

			// https://gifer.com/en/6L0E
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+(?:[a-z]{2}\/+)?([A-Z0-9]+)(?:[?#].*)?$/,
				run: function(cb, match) {
					var id = match[1];
					query_gifer_media(id, function(data) {
						if (!data) cb(null);

						cb(gifer_media_to_obj(data));
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "cdn.nivoli.com") {
			// https://cdn.nivoli.com/adventuregamers/images/screenshots/34911/u4r8tq5__small.png
			//   https://cdn.nivoli.com/adventuregamers/images/screenshots/34911/u4r8tq5__medium.png
			//   https://cdn.nivoli.com/adventuregamers/images/screenshots/34911/u4r8tq5__large.png
			//   https://cdn.nivoli.com/adventuregamers/images/screenshots/34911/u4r8tq5.png
			return src.replace(/(\/adventuregamers\/+images\/+screenshots\/+[0-9]+\/+[^/]+)__(?:small|medium|large)(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "rusfap.com") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+video\/+([^/]+)\/*(?:[?#].*)?$/,
				query_for_id: "https://rusfap.com/video/${id}/",
				process: function(done, resp, cache_key) {
					var obj = common_functions["get_videotag_obj"](resp, {
						videotag: false,
						ogvideo: true
					});
					done(obj, obj ? 60*60 : false);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "media.oboobs.ru" ||
			// http://media.obutts.ru/butts_preview/08398.jpg
			//   http://media.obutts.ru/butts/08398.jpg -- 712x1000
			domain === "media.obutts.ru") {
			// https://media.oboobs.ru/boobs_preview/15631.jpg
			//   https://media.oboobs.ru/boobs/15631.jpg -- 800x600
			return src.replace(/\/(boobs|butts)_preview\/+/, "/$1/");
		}

		if (domain_nowww === "veoh.com") {
			// video id/permalinkId is "v(videoId)hash" (hash is [a-zA-Z0-9])
			// thumbnail is "th(videoId)"
			var get_veoh_csrf_from_resp = function(resp) {
				var match = resp.responseText.match(/\s+csrfToken:\s+"([a-zA-Z0-9]{20,})",/);
				if (!match) {
					console_error("Unable to find csrf token from", resp);
					return null;
				}

				return match[1];
			};

			var get_veoh_csrf = function(cb) {
				api_query("veoh_csrf", {
					url: "https://www.veoh.com/",
					imu_mode: "document"
				}, cb, function(done, resp, cache_key) {
					return done(get_veoh_csrf_from_resp(resp), 60*60);
				});
			};

			var query_veoh_video_with_csrf = function(csrf, vid, cb) {
				api_query("veoh:" + vid, {
					url: "https://www.veoh.com/watch/getVideo/" + vid,
					imu_mode: "xhr",
					headers: {
						referer: "https://www.veoh.com/watch/" + vid,
						accept: "application/json, text/plain, */*",
						"access-control-allow-origin": "*",
						"x-csrf-token": csrf,
						"x-requested-with": "XMLHttpRequest"
					},
					json: true
				}, cb, function(done, resp, cache_key) {
					if (!resp.success || !resp.video || !resp.video.src) {
						console_error(cache_key, "Error querying video", vid, resp);
						return done(null, false);
					}

					return done(resp, 6*60*60);
				});
			};

			var veoh_video_to_obj = function(data) {
				if (!data || !data.video || !data.video.src) return null;

				var video = data.video;

				var obj = {extra: {}};
				obj.extra.page = "https://www.veoh.com/watch/" + video.permalinkId;
				obj.extra.caption = video.title;

				obj.extra.author_username = video.author.nickname;
				//obj.extra.author_uid = video.author.userId; // string

				var urls = [];

				if (video.src.HQ) {
					urls.push({
						url: video.src.HQ,
						video: true
					});
				}

				if (video.src.Regular) {
					urls.push({
						url: video.src.Regular,
						video: true
					});
				}

				urls = fillobj_urls(urls, {
					headers: {
						accept: "*/*",
						"accept-encoding": "identity;q=1, *;q=0",
						referer: "https://www.veoh.com/",
						"sec-fetch-dest": "video",
						"sec-fetch-mode": "no-cors",
						"sec-fetch-site": "same-site"
					},
					can_head: false // seems to be the important one to avoid 403?
				});

				if (video.src.poster) {
					urls.push(video.src.poster);
				}

				return fillobj_urls(urls, obj);
			};

			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+watch\/+(v[0-9]+[a-zA-Z0-9]+)(?:[?#].*)?$/,
				run: function(cb, match) {
					var vid = match[1];
					get_veoh_csrf(function(csrf) {
						if (!csrf) return cb(null);

						query_veoh_video_with_csrf(csrf, vid, function(data) {
							cb(veoh_video_to_obj(data));
						});
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if (host_domain_nowww === "veoh.com") {
			newsrc = common_functions["get_pagelink_host_el_matching"](options, {
				url_match: /^https?:\/\/(?:www\.)?veoh\.com\/+watch\/+([0-9a-zA-Z]+)(?:[?#].*)?$/,
				el_match: function(x) {
					return x.tagName === "FIGURE" && x.classList.contains("video-container");
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "tutorialspoint.com") {
			// https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg
			//   https://www.tutorialspoint.com/assets/profiles/13514/profile/83486-1512649303.jpg
			return src.replace(/(\/assets\/+profiles\/+[0-9]+\/+profile\/+)[0-9]+_/, "$1");
		}

		if (domain === "img.gigapic.com" ||
			// http://pics.hmporn.net/photos/0/4/184/9221/180-240_228e9259cba5a3f631741851ebdbf1e4.jpg
			//   http://pics.hmporn.net/photos/0/4/184/9221/pic_228e9259cba5a3f631741851ebdbf1e4.jpg
			domain === "pics.hmporn.net") {
			// http://img.gigapic.com/galleries/0/3/167/150-200_21889c085036d92851f71b14a43fbfae.jpg
			//   http://img.gigapic.com/galleries/0/3/167/pic_21889c085036d92851f71b14a43fbfae.jpg
			return src.replace(/(\/(?:galleries|photos)\/+(?:[0-9]\/+){2}(?:[0-9]+\/+){1,2})[0-9]+-[0-9]+_([0-9a-f]{20,}\.)/, "$1pic_$2");
		}

		if (domain === "akm-img-a-in.tosshub.com") {
			// https://akm-img-a-in.tosshub.com/indiatoday/images/story/201804/fLIPKART_FB-88x50.jpeg?7aUorT.AyYkITen3_QwmsIcFMHwg032p
			//   https://akm-img-a-in.tosshub.com/indiatoday/images/story/201804/fLIPKART_FB.jpeg
			// thanks to fedesk on discord: https://www.aajtak.in/
			// https://akm-img-a-in.tosshub.com/aajtak/images/story/202102/union_budget_2021_-sixteen_nine.jpg?size=100:58
			//   https://akm-img-a-in.tosshub.com/aajtak/images/story/202102/union_budget_2021_-sixteen_nine.jpg
			//   https://akm-img-a-in.tosshub.com/aajtak/images/story/202102/union_budget_2021_.jpg
			return {
				url: src
					.replace(/(\/images\/+story\/+[0-9]{6}\/+[^/]+)-(?:[0-9]+x[0-9]+|sixteen_nine)(\.[^/.?#]+)$/, "$1$2")
					.replace(/(\/images\/+story\/[^?#]+)(?:[?#].*)?$/, "$1"),
				can_head: false
			};
		}

		if (domain === "cdn-s3.sidereel.com") {
			// https://cdn-s3.sidereel.com/tv_shows/93663/small/starwarslando.jpg
			//   https://cdn-s3.sidereel.com/tv_shows/93663/medium/starwarslando.jpg
			//   https://cdn-s3.sidereel.com/tv_shows/93663/large/starwarslando.jpg
			//   https://cdn-s3.sidereel.com/tv_shows/93663/giant_2x/starwarslando.jpg
			//   https://cdn-s3.sidereel.com/tv_shows/93663/original/starwarslando.jpg
			// doesn't work for all
			// https://cdn-s3.sidereel.com/tv_shows/51961/giant_2x/a.JPG (.jpg works too)
			//   https://cdn-s3.sidereel.com/tv_shows/51961/giant/a.jpg -- 404
			//   https://cdn-s3.sidereel.com/tv_shows/51961/original/a.jpg -- 404
			return src.replace(/(\/tv_shows\/+[0-9]+\/+)(?:small|medium|large|giant)(?:_[0-9]+x)?\/+/, "$1original/");
		}

		if (domain_nowww === "vergewiki.com") {
			// https://vergewiki.com/uploads/resize-small/biography/2019/10/1/Daphne%20Joy-1569953458567.jpg
			//   https://vergewiki.com/uploads/resize-medium/biography/2019/10/1/Daphne%20Joy-1569953458567.jpg
			//   https://vergewiki.com/uploads/biography/2019/10/1/Daphne%20Joy-1569953458567.jpg -- 640x433
			return src.replace(/(\/uploads\/+)resize-[a-z]+\/+/, "$1");
		}

		if (domain === "img.mm52.com") {
			// https://img.mm52.com/a/anya_taylor_joy/anya_taylor_joy_0379_128px.jpg
			//   https://img.mm52.com/a/anya_taylor_joy/anya_taylor_joy_0379_620px.jpg
			return src.replace(/_128px(\.[^/.]+)$/, "_620px$1");
		}

		if (domain === "image.noelshack.com") {
			// https://image.noelshack.com/minis/2020/50/7/1607832854-85781422.png
			//   https://image.noelshack.com/fichiers/2020/50/7/1607832854-85781422.jpg
			newsrc = src.replace(/\/minis\/+([0-9]{4}\/+)/, "/fichiers/$1");
			if (newsrc !== src) {
				return add_extensions(newsrc);
			}
		}

		if (domain === "static.lostfilm.run") {
			// https://static.lostfilm.run/Gallery/8/0/e/t_80ed3425f945a35265368d26604341c7.jpg
			//   https://static.lostfilm.run/Gallery/8/0/e/80ed3425f945a35265368d26604341c7.jpg
			return src.replace(/(\/Gallery\/+(?:[0-9a-f]\/+){3})t_/, "$1");
		}

		if (domain === "bi.im-g.pl") {
			// https://bi.im-g.pl/im/64/33/19/z26424420F,-Gambit-Krolowej---Marcin-Dorocinski-i-Anya-Taylor.jpg
			//   https://bi.im-g.pl/im/64/33/19/z26424420II,-Gambit-Krolowej---Marcin-Dorocinski-i-Anya-Taylor.jpg
			//   https://bi.im-g.pl/im/64/33/19/z26424420V,-Gambit-Krolowej---Marcin-Dorocinski-i-Anya-Taylor.jpg -- 940x640
			//   https://bi.im-g.pl/im/64/33/19/z26424420O,-Gambit-Krolowej---Marcin-Dorocinski-i-Anya-Taylor.jpg -- 3600x2400
			// https://bi.im-g.pl/im/3f/7d/19/z26726463O,Program-TV---Biala-krolowa-.jpg -- 3000x2000
			// https://bi.im-g.pl/im/dc/7d/19/z26726876O,-Jezioro-marzen-.jpg -- 1538x1097
			// https://bi.im-g.pl/im/e3/7b/19/z26720227J.jpg?r=479
			//   https://bi.im-g.pl/im/e3/7b/19/z26720227O.jpg?r=479 -- 3861x2574
			// https://bi.im-g.pl/im/ef/83/19/z26753519IF.jpg?r=702
			//   https://bi.im-g.pl/im/ef/83/19/z26753519O.jpg?r=702
			return src.replace(/(\/im\/+(?:[0-9a-f]{2}\/+){3}z[0-9]+)(?:[FJV]|I[IF])([,.])/, "$1O$2");
		}

		if (domain === "images.macrumors.com") {
			// thanks to dym-sh on github: https://github.com/qsniyg/maxurl/issues/637
			// https://www.macrumors.com/2021/02/03/apple-car-kia-investment/
			// https://images.macrumors.com/t/hiI0bzxHHRVRKFxXTNfAQJIYyXs=/1600x0/filters:quality(90)/article-new/2020/12/Apple-car-wheel-icon-feature-triad.jpg
			//   https://images.macrumors.com/article-new/2020/12/Apple-car-wheel-icon-feature-triad.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+t\/+/, "/");
			if (newsrc !== src) {
				return urljoin("https://images.macrumors.com/", common_functions["get_thumbor_url"](newsrc), false);
			}
		}

		if (false && domain_nosub === "hemtrevligt.se" && /^cdn[0-9]*\./.test(domain)) {
			// wip
			// https://cdn1.hemtrevligt.se/YTo2OntzOjI6ImlkIjtpOjE3MDI2MjY7czoxOiJ3IjtpOjEwMjA7czoxOiJoIjtpOjYxMjtzOjE6ImMiO2k6MDtzOjE6InMiO2k6MDtzOjE6ImsiO3M6NDA6IjhmYmE0NTMxNTJmMWUyNWY5MDgzZmE1ZjQ5MTk5ZjI4ZGY0ZWM1MTUiO30=
			// atob: a:6:{s:2:"id";i:1702626;s:1:"w";i:1020;s:1:"h";i:612;s:1:"c";i:0;s:1:"s";i:0;s:1:"k";s:40:"8fba453152f1e25f9083fa5f49199f28df4ec515";}
			// kv[6] {"id": 1702626, "w": 1020, "h": 612, "c": 0, "s": 0, "k": "8fba453152f1e25f9083fa5f49199f28df4ec515"}
			// if changing to invalid (e.g. without "k"), it redirects to:
			// http://bildgenerator.egmont.se/404/...
			// if using valid, such as:
			// http://bildgenerator.egmont.se/404/YTo2OntzOjI6ImlkIjtpOjE3MDI2MjY7czoxOiJ3IjtpOjEwMjA7czoxOiJoIjtpOjYxMjtzOjE6ImMiO2k6MDtzOjE6InMiO2k6MDtzOjE6ImsiO3M6NDA6IjhmYmE0NTMxNTJmMWUyNWY5MDgzZmE1ZjQ5MTk5ZjI4ZGY0ZWM1MTUiO30=
			// to:
			// https://image-cache.s3-eu-west-1.amazonaws.com/YTo2OntzOjI6ImlkIjtpOjE3MDI2MjY7czoxOiJ3IjtpOjEwMjA7czoxOiJoIjtpOjYxMjtzOjE6ImMiO2k6MDtzOjE6InMiO2k6MDtzOjE6ImsiO3M6NDA6IjhmYmE0NTMxNTJmMWUyNWY5MDgzZmE1ZjQ5MTk5ZjI4ZGY0ZWM1MTUiO30%3D
			// other image-cache urls:
			// https://image-cache.s3-eu-west-1.amazonaws.com/c52a5199fcde54291e8e400671b66b28356d8cc2 -- 600x390 (https://sharaarc.weebly.com/blog/yugioh-the-duelist-of-the-roses-isotretinoin)
			// https://image-cache.s3-eu-west-1.amazonaws.com/75643d6763b77c7361bdda0b2f6fd483f55bb6a2 -- 600x404
			// https://image-cache.s3-eu-west-1.amazonaws.com/009b52553647da2c0eb2faf6d372dfe1257b46c6 -- 640x363 (https://teslaclubsweden.se/forum/viewtopic.php?f=27&t=20340&start=10)
			// https://image-cache.s3-eu-west-1.amazonaws.com/YTo2OntzOjI6ImlkIjtpOjE2MTk0MDM7czoxOiJ3IjtpOjMyMDA7czoxOiJoIjtpOjMyMDA7czoxOiJjIjtpOjA7czoxOiJzIjtpOjA7czoxOiJrIjtzOjQwOiIzYjExZjIxMDI2ZTQxMDkzYzI3ZGNlZmJiZmNhMzVjYjYyYjFmZTk1Ijt9
			// using the "k" for image-cache doesn't work
		}

		if (domain_nowww === "playvids.com") {
			newsrc = website_query({
				website_regex: [
					/^[a-z]+:\/\/[^/]+\/+([0-9a-zA-Z_]{10,12})\/+/,
					/^[a-z]+:\/\/[^/]+\/+embed\/+([0-9a-zA-Z_]{10,12})(?:[?#].*)?$/
				],
				query_for_id: "https://www.playvids.com/embed/${id}",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/<video[^>]+\s+data-dash-src="(https?:\/\/[^"]+)"/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					// todo: thumbnail, title
					return done({
						extra: {
							page: resp.finalUrl
						},
						url: decode_entities(match[1]),
						video: "dash"
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "ugetube.com") {
			// https://ugetube.com/watch/queen-size-bed-frame-diy_BD9LGycB9zQNpCF.html
			// https://ugetube.com/embed/BD9LGycB9zQNpCF
			newsrc = website_query({
				website_regex: [
					/^[a-z]+:\/\/[^/]+\/+watch\/+[^/.?#]*_([a-zA-Z0-9]{10,})\.html(?:[?#].*)?$/,
					/^[a-z]+:\/\/[^/]+\/+embed\/+([a-zA-Z0-9]{10,})(?:[?#].*)?$/
				],
				query_for_id: "https://ugetube.com/watch/_${id}.html",
				process: function(done, resp, cache_key) {
					var title = get_meta(resp.responseText, "og:title");
					var page = get_meta(resp.responseText, "og:url");
					var image = get_meta(resp.responseText, "og:image");

					var obj = {
						extra: {
							caption: title,
							page: page
						}
					};

					var urls = [];

					var match = resp.responseText.match(/sources:\s*\[\s*{\s*"file":\s*("https?:[^"]+"),/);
					if (!match) {
						console_error(cache_key, "Unable to find video match from", resp);
						return done(null, false);
					}

					// todo: is it only mp4? or is there hls too?
					urls.push({
						url: JSON_parse(match[1]),
						cookie_url: "https://ugetube.com/", // cloudflare
						headers: {
							Referer: "https://ugetube.com/",
							"sec-fetch-dest": "video",
							"sec-fetch-mode": "no-cors",
							"sec-fetch-site": "same-site"
						},
						video: true
					});

					urls.push(image);

					return done(fillobj_urls(urls, obj), 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (host_domain_nowww === "ugetube.com" && options.element) {
			newsrc = common_functions["get_pagelink_host_el_matching"](options, {
				url_match: /^[a-z]+:\/\/(?:www\.)?ugetube.com\/+watch\/+[^/.?#]*_([a-zA-Z0-9]{10,})\.html(?:[?#].*)?$/,
				el_match: function(x) {
					return x.tagName === "VIDEO" && x.classList.contains("jw-video");
				}
			});
			if (newsrc) return newsrc;
		}

		if ((domain_nosub === "optimole.com" && /^[a-z0-9]+\.i\./.test(domain))) {
			// thanks to dym-sh on github: https://github.com/qsniyg/maxurl/issues/648
			// https://oioi.gg/project/lush-the-perfume-library
			// https://mltr5l57ke57.i.optimole.com/RDDCmdI.6weG~523aa/w:372/h:372/q:82/dpr:1.5/https://oioi.gg/wp-content/uploads/2021/01/oioi_lushperfumelibrary6.jpg
			//   https://oioi.gg/wp-content/uploads/2021/01/oioi_lushperfumelibrary6.jpg
			// https://mlvoslivyghz.i.optimole.com/V6bZ01k-K3qZJUKC/rs:fill:800:800/g:ce/bl:0/sh:0/pix:0/br:0/co:1/sa:1/https://optimole.com/wp-content/uploads/2020/07/fp.jpeg
			//   https://optimole.com/wp-content/uploads/2020/07/fp.jpeg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+[^/]+\/+(?:[a-z]{1,3}(?::(?:[a-z]+|[0-9.]+))+\/+)*(https?:\/\/)/, "$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "bordalo.observador.pt") {
			// thanks to anonymous for reporting:
			// https://bordalo.observador.pt/v2/q:84/rs:fill:1300:730/c:1300:730:nowe:0:243/plain/https://s3.observador.pt/wp-content/uploads/2022/08/24145618/81714-1.jpg
			//   https://s3.observador.pt/wp-content/uploads/2022/08/24145618/81714-1.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+v2\/+.*?\/+(https?:\/\/)/, "$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nosub === "podbean.com" && /^pbcdn[0-9]*\./.test(domain)) {
			// https://pbcdn1.podbean.com/imglogo/image-logo/3736165/Bible_Recap_2_300x300.png
			//   https://pbcdn1.podbean.com/imglogo/image-logo/3736165/Bible_Recap_2.png
			return src.replace(/(\/imglogo\/+image-logo\/+[0-9]+\/+[^/]+)_[0-9]+x[0-9]+(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "podbean.com") {
			// https://www.podbean.com/media/player/mini?media=https%3A%2F%2Fmcdn.podbean.com%2Fmf%2Fweb%2Fhbdrgp%2FTBR_041_2020_Edit_-_11_29_20_522_PMaa85w.mp3&skin=1&p=...&e=...&t=...&f=u&et=Day+041+%28Exodus+33-35%29+-+Year+3&pt=The+Bible+Recap&au=D-Group&l=%2F%2Fpbcdn1.podbean.com%2Fimglogo%2Fimage-logo%2F3736165%2FBible_Recap_2.png&s=...
			// todo: not async
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+media\/+player\/+mini\?(?:.*&)?media=(https?[^&]+)(?:[&#].*)?$/,
				run: function(cb) {
					var queries = get_queries(src);

					var urls = [];
					urls.push({
						url: decodeuri_ifneeded(queries.media),
						media_info: {
							type: "audio"
						}
					});

					if (queries.l) {
						urls.push(decodeuri_ifneeded(queries.l));
					}

					return cb(urls);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "turkcealtyazi.org") {
			// https://turkcealtyazi.org/film/148/10793644.jpg
			//   https://turkcealtyazi.org/images/poster/10793644.jpg
			// https://turkcealtyazi.org/film/mthumb/9251798.jpg
			//   https://turkcealtyazi.org/images/poster/9251798.jpg
			// https://turkcealtyazi.org/resimler/prs/8184025/t-david-alexander-sjholt-1ivj2.jpg
			//   https://turkcealtyazi.org/resimler/prs/8184025/m-david-alexander-sjholt-1ivj2.jpg
			//   https://turkcealtyazi.org/resimler/prs/8184025/l-david-alexander-sjholt-1ivj2.jpg
			// https://turkcealtyazi.org/resimler/film/12261776/t-65-1j4b4.jpg
			//   https://turkcealtyazi.org/resimler/film/12261776/l-65-1j4b4.jpg
			// https://turkcealtyazi.org/film/nmmid/nm8184025.jpg
			//   https://turkcealtyazi.org/film/nmbig/nm8184025.jpg
			// https://turkcealtyazi.org/film/images/nm1525807.jpg
			//   https://turkcealtyazi.org/film/nmbig/nm1525807.jpg
			// https://turkcealtyazi.org/images/avatars_thumb/5045926876179a4e0ad68d.jpg
			//   https://turkcealtyazi.org/images/avatars/5045926876179a4e0ad68d.jpg
			return src
				.replace(/\/film\/+[0-9]+\/+([0-9]+\.)/, "/images/poster/$1")
				.replace(/\/film\/+mthumb\/+([0-9]+\.)/, "/images/poster/$1")
				.replace(/\/film\/+nmmid\/+/, "/film/nmbig/")
				.replace(/\/film\/+images\/+(nm[0-9]+\.)/, "/film/nmbig/$1")
				.replace(/\/images\/+avatars_thumb\/+/, "/images/avatars/")
				.replace(/(\/resimler\/+[^/]+\/+[0-9]+\/+)[tm]-/, "$1l-");
		}

		if (domain_nowww === "planetdp.org") {
			// https://planetdp.org//covers/mid/dp119949.jpg
			//   https://planetdp.org//covers/big/dp119949.jpg
			// https://www.planetdp.org/titleimgs/thumb/greyzone-5b5a7ca72a1fd.jpg
			//   https://www.planetdp.org/titleimgs/big/greyzone-5b5a7ca72a1fd.jpg
			return src.replace(/\/(covers|titleimgs)\/+(?:mid|thumb)\/+((?:dp[0-9]+|[^/.]+-[0-9a-f]+)\.)/, "/$1/big/$2");
		}

		if (domain_nosub === "jegy.hu" && /^pb[0-9]*\./.test(domain)) {
			// https://pb2.jegy.hu/imgs/system-4/program/000/121/496/szergej-polunyin-raszputyin-tancdrama-222-131-165171.jpg
			//   https://pb2.jegy.hu/imgs/system-4/program/000/121/496/szergej-polunyin-raszputyin-tancdrama-original-165171.jpg
			return src.replace(/(\/imgs\/+.*)-[0-9]+-[0-9]+(-[0-9]+\.)/, "$1-original$2");
		}

		if (domain_nowww === "wonderwall.com") {
			// https://www.wonderwall.com/wp-content/themes/wonderwall/assets/images/download.png
			if (/\/wp-content\/+themes\/+[^/]+\/+assets\/+images\/+download\./.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}
		}

		if (domain === "outgoing.prod.mozaws.net") {
			// https://outgoing.prod.mozaws.net/v1/.../https%3A//pbs.twimg.com/media/DlOC3mOWsAEi1ld.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+v1\/+[0-9a-f]{20,}\/+(http)/, "$1");
			if (newsrc !== src) {
				return decodeuri_ifneeded(newsrc);
			}
		}

		if (domain_nowww === "hlamer.ru" ||
			// https://zloekino.su/video/552124-Bolshoiy_Bak-Treiyler
			domain_nowww === "zloekino.su") {
			// https://hlamer.ru/video/1012613-Revolyushn
			newsrc = website_query({
				website_regex: [
					/^[a-z]+:\/\/[^/]+\/+video\/+([0-9]+)(?:-[^/]+)(?:[?#].*)?$/,
					/^[a-z]+:\/\/[^/]+\/+embed\/+([0-9]+)(?:[?#].*)?$/
				],
				query_for_id: "https://" + domain + "/video/${id}",
				process: function(done, resp, cache_key) {
					var match = resp.responseText.match(/video_Init\('([^']+)', /);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					var decoded = base64_decode(match[1]);
					var json = JSON_parse(decoded);

					var obj = {
						extra: {
							id: json.v_id,
							caption: get_meta(resp.responseText, "og:title"),
							page: resp.finalUrl
						}
					};

					match = resp.responseText.match(/<meta itemprop='uploadDate' content='([^']+)'/);
					if (match) {
						obj.extra.created_date = new Date(match[1]).getTime();
					}

					var videourls = [];
					obj_foreach(json, function(key, value) {
						if (!/^url/.test(key)) return;

						var video:VideoProp = true;
						var ext = url_basename(value, {split_ext: true})[1];
						if (ext === "mpd") {
							video = "dash";
						}

						videourls.push({
							url: value,
							video: video
						});
					});

					var urls = [];
					array_extend(urls, fillobj_urls(videourls, {
						headers: {
							Referer: "https://" + domain + "/"
						}
					}));

					urls.push(json.image);

					return done(fillobj_urls(urls, obj), 6*60*60);
				}
			});
			if (newsrc) return newsrc;

			// https://zloekino.su/resource/image/layout/bg-block-content.png
			if (/\/resource\/+image\/+layout\/+bg-/.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}
		}

		if (domain_nosub === "krasview.ru" && /^cdn[0-9]*\./.test(domain)) {
			// https://cdn1.krasview.ru/user/106/106609/784ee57628e30ff4_96.jpg
			//   https://cdn1.krasview.ru/user/106/106609/784ee57628e30ff4.jpg
			// https://cdn1.krasview.ru/user/0/854/7d60a970516069a4_96.jpg
			//   https://cdn1.krasview.ru/user/0/854/7d60a970516069a4.jpg
			// downscales some:
			// https://cdn1.krasview.ru/set/33/d35a7177e7219cd0_360.jpg -- 360x360
			//   https://cdn1.krasview.ru/set/33/d35a7177e7219cd0.jpg -- 270x358
			// https://cdn1.krasview.ru/set/46/8adbd2cb208d9e4d_360.jpg -- 360x360
			//   https://cdn1.krasview.ru/set/46/8adbd2cb208d9e4d.jpg -- 270x270
			return src.replace(/(\/user\/+(?:[0-9]+\/+){1,2}[0-9a-f]+)_[0-9]+(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "image.krasview.ru") {
			// https://image.krasview.ru/video/47a0a80488ab3fb/160.jpg
			//   https://image.krasview.ru/video/47a0a80488ab3fb/_.jpg
			return src.replace(/(\/video\/+[0-9a-f]+\/+)[0-9]+\./, "$1_.");
		}

		if (domain_nowww === "topwam.com") {
			// https://topwam.com/uploaded/celebrities/thumbnails/85/sbb_200901_Heidi_Klum_03_150.jpg
			//   https://topwam.com/uploaded/celebrities/thumbnails/85/sbb_200901_Heidi_Klum_03_450.jpg
			// other: http://topwam.com/getcelebrity.php?picid=7982
			return src.replace(/(\/uploaded\/+celebrities\/+thumbnails\/+[0-9]+\/+sbb_[0-9]{6}_[^/.]+)_150(\.[^/.]+)(?:[?#].*)?$/, "$1_450$2");
		}

		if (domain === "static.starity.hu") {
			// https://static.starity.hu/images/gallery/120x120/20180704/img-5825_1530685543.jpg
			//   https://static.starity.hu/images/gallery/1920x1282/20180704/img-5825_1530685543.jpg -- 1920x1280
			// https://static.starity.hu/images/gallery/120x120/20190716/efott-2019-001_1563285294.jpg
			//   https://static.starity.hu/images/gallery/1920x1282/20190716/efott-2019-001_1563285294.jpg -- 868x1282
			// https://static.starity.hu/images/gallery/345x230/20180704/img-7035_1530686390.jpg
			//   https://static.starity.hu/images/gallery/1920x1282/20180704/img-7035_1530686390.jpg
			return src.replace(/(\/images\/+gallery\/+)(?:120x120|345x230)\/+/, "$11920x1282/");
		}

		if (domain_nowww === "keptarolo.hu") {
			// http://keptarolo.hu/s16307345/98.jfif
			//   http://keptarolo.hu/kep/s16307345/98.jfif
			newsrc = website_query({
				// !async
				website_regex: /^[a-z]+:\/\/[^/]+\/+(s[0-9]+\/+[^/?#]+\.[^/.?#]+)(?:[?#].*)?$/,
				run: function(cb, match) {
					return cb("http://keptarolo.hu/kep/" + match[1]);
				}
			});
			if (newsrc) return newsrc;

			// http://keptarolo.hu/images/thumbnail/2021/02/08/270554/161276301639.jfif -- ts: Mon, 08 Feb 2021 05:43:36 GMT
			//   http://keptarolo.hu/s16285318/14.jfif -- diff(trunc) = 157688, ts: Mon, 09 Aug 2021 17:56:40 GMT
			// http://keptarolo.hu/images/thumbnail/2021/02/08/270554/161276301786.jfif -- ts: Mon, 08 Feb 2021 05:43:37 GMT
			//   http://keptarolo.hu/s16285319/15.jfif -- diff(trunc) = 157689

			// hacky but works for forums
			if (/\/images\/+thumbnail\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}/.test(src) && options.element) {
				newsrc = common_functions["get_pagelink_el_matching"](options.element, /^[a-z]+:\/\/keptarolo.hu\/+s[0-9]+\/+/);
				if (newsrc) return newsrc;
			}
		}

		if (amazon_container === "soundstripe-production") {
			// https://soundstripe-production.s3.amazonaws.com/uploads/artist/132/pic/thumb_andrew_stanton_disciple.jpg?NaN
			//   https://soundstripe-production.s3.amazonaws.com/uploads/artist/132/pic/standard_andrew_stanton_disciple.jpg?NaN
			//   https://soundstripe-production.s3.amazonaws.com/uploads/artist/132/pic/andrew_stanton_disciple.jpg?NaN -- 1067x1067, upscaled?
			// https://soundstripe-production.s3.amazonaws.com/uploads/artist/265/pic/standard_emorie-placeholder.jpeg?NaN
			//   https://soundstripe-production.s3.amazonaws.com/uploads/artist/265/pic/emorie-placeholder.jpeg?NaN -- 1200x1200
			return src.replace(/(\/uploads\/+[a-z]+\/+[0-9]+\/+pic\/+)(?:standard|thumb)_/, "$1");
		}

		if (domain_nowww === "dolphin-emu.org") {
			// https://dolphin-emu.org/m/user/blog/state-of-android-2018/GameCubeTouch_thumb.jpg
			//   https://dolphin-emu.org/m/user/blog/state-of-android-2018/GameCubeTouch.png
			newsrc = src.replace(/(\/user\/+blog\/+[^/]+\/+[^/]+)_thumb(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
			if (newsrc !== src) {
				return add_extensions(newsrc);
			}
		}

		if (domain_nosub === "tvtome.com" && /^img[0-9]*\./.test(domain)) {
			// the "size" field can be anything, unknown = original
			// http://img2.tvtome.com/i/tvc/gq/105190.jpg
			//   http://img2.tvtome.com/i/tvc/vL/105190.jpg
			//   http://img2.tvtome.com/i/tvc/105190.jpg
			// http://img2.tvtome.com/i/u/gq/a4be1381c16d483cc817beb2f9aa40dc.png
			//   http://img2.tvtome.com/i/u/a4be1381c16d483cc817beb2f9aa40dc.png
			return src.replace(/(\/i\/+(?:u|tvc)\/+)[^/]+\/+([0-9]+|[0-9a-f]{20,})\./, "$1$2.");
		}

		if (domain === "d2z1w4aiblvrwu.cloudfront.net") {
			// https://d2z1w4aiblvrwu.cloudfront.net/ad/tvZI/jergens-ultra-healing-elbows-sweet-citrus-featuring-leslie-mann-maude-apatow-small-2.jpg
			//   https://d2z1w4aiblvrwu.cloudfront.net/ad/tvZI/jergens-ultra-healing-elbows-sweet-citrus-featuring-leslie-mann-maude-apatow-large-2.jpg -- upscaled?
			return src.replace(/(\/ad\/+[a-zA-Z0-9]+\/+[^/]+-)small(-[0-9]+\.)/, "$1large$2");
		}

		if (domain === "uploads.xrel.to") {
			// https://uploads.xrel.to/attachments/thumb_387869923-capsule_616x353.jpg
			//   https://uploads.xrel.to/attachments/387869923-capsule_616x353.jpg
			// https://uploads.xrel.to/img_cover/movie200647-5f0d8a96.JPG
			//   https://uploads.xrel.to/img_cover/movie200647-5f0d8a96-full.JPG
			// https://uploads.xrel.to/img_mediathek_thumb/movie2880-496b4ccc.JPG
			//   https://uploads.xrel.to/img_mediathek/movie2880-496b4ccc.JPG
			// https://uploads.xrel.to/img_mediathek_thumb/game75451-5038d565.JPG
			//   https://uploads.xrel.to/img_mediathek/game75451-5038d565.JPG
			// https://uploads.xrel.to/img_mediathek_thumb/console75452-4ffeedac.PNG
			//   https://uploads.xrel.to/img_mediathek/console75452-4ffeedac.PNG
			return src
				.replace(/(\/attachments\/+)thumb_([0-9]+)/, "$1$2")
				.replace(/(\/img_cover\/+(?:movie|game|console)[0-9]+-[0-9a-f]+)(\.[^/.]+)/, "$1-full$2")
				.replace(/(\/img_mediathek)_thumb\/+((?:movie|game|console)[0-9]+-)/, "$1/$2");
		}

		if (domain_nowww === "javteentube.com") {
			if (/^[a-z]+:\/\/[^/]+\/+jtt\/+[a-z]+-[0-9a-z]{4}\.png(?:[?#].*)?$/.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}
		}

		if (domain === "pics.pornwatchers.com") {
			// https://pics.pornwatchers.com/media/thumbs/6/0/0/a/a/600aae41c3a7e-tube-projectk-emma-watson.mp4/600aae41c3a7e-tube-projectk-emma-watson.mp4-7b.jpg
			//   https://cdn.pornwatchers.com/media/videos/6/0/0/a/a/600aae41c3a7e-tube-projectk-emma-watson.mp4
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+media\/+thumbs\/+((?:[0-9a-f]\/+){5}[0-9a-f]+(?:-[^/.]+)?)(?:\.mp4)?\/+[0-9a-f]+.*/, "https://cdn.pornwatchers.com/media/videos/$1.mp4");
			if (newsrc !== src) {
				return {
					url: newsrc,
					video: true
				};
			}
		}

		if (domain_nowww === "pornwatchers.com") {
			// https://www.pornwatchers.com/video/leaked-nudes-of-celeb-hottie-emma-watson-131551.html
			newsrc = website_query({
				website_regex: [
					/^[a-z]+:\/\/[^/]+\/+video\/+[^/.]*-([0-9]+)\.html(?:[?#].*)?$/,
					/^[a-z]+:\/\/[^/]+\/+embed\/+([0-9]+)(?:[?#].*)?$/
				],
				query_for_id: "https://www.pornwatchers.com/video/-${id}.html",
				process: function(done, resp, cache_key) {
					var thumbnail = get_meta(resp.responseText, "thumbnailUrl");
					var video = strip_whitespace(get_meta(resp.responseText, "contentURL"));

					var name = get_meta(resp.responseText, "name");
					var description = get_meta(resp.responseText, "description");

					var urls = [];

					if (video) urls.push({url: video, video: true});
					if (thumbnail) urls.push(thumbnail);

					var obj = {
						extra: {
							caption: name || description,
							page: resp.finalUrl
						}
					};

					done(fillobj_urls(urls, obj), 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "alohatube.com") {
			match = src.match(/^[a-z]+:\/\/[^/]+\/+ktm\/+view\.cgi\?(?:.*&)?u=(https?:\/\/[^&]+)(?:[?&#].*)?$/);
			if (match) {
				return {
					url: match[1],
					is_pagelink: true
				}
			}
		}

		if (domain === "d29ef90wiiaj1a.cloudfront.net") {
			// https://www.reelhouse.org/posingproductions/climbing-blind
			// https://d29ef90wiiaj1a.cloudfront.net/user_54bfbd7197e0ef0900000a81_project_poster_tall_482563080.220x326.jpeg
			//   https://d29ef90wiiaj1a.cloudfront.net/user_54bfbd7197e0ef0900000a81_project_poster_tall_482563080.jpeg
			return src.replace(/(\/user_[0-9a-f]{10,}_[^/.]+\.)[0-9]+x[0-9]+\./, "$1");
		}

		if (domain_nowww === "asexypanties.com" ||
			// thanks to vscum on github: https://github.com/qsniyg/maxurl/issues/1166
			// https://www.twistyscafe.com/galleries/twistys/t0030/twistys-sky_bee-sexy_senorita/01tn.jpg
			//   https://www.twistyscafe.com/galleries/twistys/t0030/twistys-sky_bee-sexy_senorita/01.jpg
			domain_nowww === "twistyscafe.com" ||
			// https://pantiespics.net/galleries/blonde-princess-strips-on-the-bed-uncovering-her-delicious-pussy/01tn.jpg
			//   https://pantiespics.net/galleries/blonde-princess-strips-on-the-bed-uncovering-her-delicious-pussy/01.jpg
			domain_nowww === "pantiespics.net") {
			// https://asexypanties.com/galleries/such-a-slender-and-beautiful-secretary-in-fishnets/01tn.jpg
			//   https://asexypanties.com/galleries/such-a-slender-and-beautiful-secretary-in-fishnets/01.jpg
			return src.replace(/(\/galleries\/+(?:[^/]+\/+[a-z][0-9]+\/+)?[^/]+\/+[0-9]+)tn(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "panty-porn.com") {
			// https://panty-porn.com/pictures/dick-eager-blondie-unclothing-exploring-delicious-legs-and-moist-twat/p01t.jpg
			//   https://panty-porn.com/pictures/dick-eager-blondie-unclothing-exploring-delicious-legs-and-moist-twat/p01.jpg
			return src.replace(/(\/pictures\/+[^/]+\/+p[0-9]+)t(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "pornstarsluv.com") {
			// http://www.pornstarsluv.com/media/images_640/8/gigi-jewel-porn/gigi-jewel-porn-60306.jpg
			//   http://www.pornstarsluv.com/media/images/8/gigi-jewel-porn/gigi-jewel-porn-60306.jpg
			return src.replace(/(\/media\/+images)_[0-9]+\/+/, "$1/");
		}

		if (domain === "mk0movieguide99l7786.kinstacdn.com") {
			// https://mk0movieguide99l7786.kinstacdn.com/wp-content/plugins/movieguide/images/overlay_article.png
			// https://mk0movieguide99l7786.kinstacdn.com/wp-content/plugins/movieguide/images/overlay_video.png
			if (/\/wp-content\/+plugins\/+movieguide\/+images\/+overlay_[a-z]+\./.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}
		}

		if (amazon_container === "booker-small-2-fk") {
			// thanks to Regis on discord
			// http://www.katemossagency.com/esme-creed-miles
			// https://booker-small-2-fk.s3.amazonaws.com/library/16/20201126_141557851.jpg
			//   https://booker-small-2-fk.s3.amazonaws.com/library/16/20201126_141557851_M.JPG
			newsrc = src.replace(/(\/library\/+[0-9]+\/+[0-9]+_[0-9]+)(\.[^/.]+)(?:[?#].*)?$/, "$1_M$2");
			if (newsrc !== src) {
				return add_extensions_upper(newsrc);
			}
		}

		if (domain === "d1231c29xbpffx.cloudfront.net" &&
			host_domain_nowww === "blendermarket.com" && options.element) {
			// thanks to fedesk on discord for reporting
			regex = /\/store\/+product(?:image)?\/+([0-9]+)\/+image\/+/;
			match = src.match(regex);
			if (match) {
				id = match[1];
				var current = options.element;
				while (current = current.parentElement) {
					if (current.tagName === "DIV" && current.classList.contains("slideshow-wrap")) {
						var a_els = current.querySelectorAll("li > a[data-data-featherlight=\"image\"]");
						let newhref = null;
						array_foreach(a_els, function(el) {
							var el_match = el.href.match(regex);
							if (!el_match) return;

							if (el_match[1] === id) {
								newhref = el.href;
								return false;
							}
						});

						if (newhref) return newhref;
					}
				}
			}
		}

		if (domain_nowww === "powells.com") {
			// https://www.powells.com/images/zoomImage.png
			if (/\/images\/+zoomImage\./.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}
		}

		if (domain === "d3525k1ryd2155.cloudfront.net") {
			// https://biblio.co.nz/book/zurich-zurichsee/d/1315380183
			// x, l, m, b, s
			// https://d3525k1ryd2155.cloudfront.net/h/183/380/1315380183.0.m.jpg
			//   https://d3525k1ryd2155.cloudfront.net/h/183/380/1315380183.0.x.jpg -- 1112x830
			regex = /(\/[0-9]{5,}\.[0-9]+\.)[blmsx](\.[^/.]+(?:[?#].*)?)$/;
			if (regex.test(src)) {
				return [
					src.replace(regex, "$1x$2"),
					src.replace(regex, "$1l$2"),
					src.replace(regex, "$1m$2"),
					src.replace(regex, "$1b$2"),
					src.replace(regex, "$1s$2")
				];
			}
		}

		if (domain_nosub === "booksamillion.com" && /^covers[0-9]*\./.test(domain)) {
			// https://covers4.booksamillion.com/covers/bam/1/63/326/165/1633261654_b.jpg
			//   https://covers4.booksamillion.com/covers/bam/1/63/326/165/1633261654.jpg -- 900x1159 (200kb)
			//   https://covers4.booksamillion.com/covers/bam/1/63/326/165/1633261654_o.jpg -- 900x1159 (800kb)
			// unknown = 400x515
			return src.replace(/(\/covers\/+bam\/+(?:[0-9]+\/+)+[0-9]+)(?:_[wmbxst])?(\.[^/.]+)(?:[?#].*)?$/, "$1_o$2");
		}

		if (domain === "cropper.watch.aetnd.com") {
			// https://cropper.watch.aetnd.com/cdn.watch.aetnd.com/sites/5/2017/03/jodi.jpg?w=548
			//   http://cdn.watch.aetnd.com/sites/5/2017/03/jodi.jpg
			newsrc = src.replace(/\?.*/, "");
			if (newsrc !== src) return newsrc;

			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+([^/]+\.[^/]+\/.*)$/, "$1");
			if (newsrc !== src) return add_http(newsrc);
		}

		if (domain_nowww === "zdnet.com") {
			// https://www.zdnet.com/a/img/resize/a2ac8f443e693da9311f70e8b27d41b3633714a8/2023/04/23/eadf6b96-ec3c-4ef5-9589-579bf6544690/img-3017.jpg?auto=webp&fit=crop&frame=1&height=128&width=128
			//   https://www.zdnet.com/a/img/2023/04/23/eadf6b96-ec3c-4ef5-9589-579bf6544690/img-3017.jpg
			return src.replace(/(\/a\/+img\/+)resize\/+[0-9a-f]{10,}\/+(.*?)\?.*$/, "$1$2");
		}

		if (domain_nowww === "cnet.com") {
			// thanks to roi:
			// https://www.cnet.com/a/img/resize/6f9e9048071ad8ff056012d9b11ae58e126417ea/hub/2023/02/04/8e548baa-d5bc-4f99-a398-a4b9e2ad518a/screen-shot-2023-02-03-at-7-54-52-pm.png?auto=webp&fit=crop&height=1293&precrop=2924,1642,x0,y32&width=2300
			//   https://www.cnet.com/a/img/6f9e9048071ad8ff056012d9b11ae58e126417ea/hub/2023/02/04/8e548baa-d5bc-4f99-a398-a4b9e2ad518a/screen-shot-2023-02-03-at-7-54-52-pm.png
			newsrc = src.replace(/(\/a\/+img\/+)resize\/+(.*?)\?.*$/, "$1$2");
			if (newsrc !== src)
				return newsrc;

			// https://www.cnet.com/a/img/_mAcM99nnRP-AG0yB46gNdN9kv8=/1092x0/2021/03/18/a6b32702-a47b-4475-9e2b-9f926842f63b/8ddf7dd0c0bbc3c6fe008734962d6fc5-4096x2730-38cdbde8.jpg
			//   https://www.cnet.com/a/2021/03/18/a6b32702-a47b-4475-9e2b-9f926842f63b/8ddf7dd0c0bbc3c6fe008734962d6fc5-4096x2730-38cdbde8.jpg
			// https://www.cnet.com/a/img/r_4zUzKeDdh16YGo5b4Sx529HPQ=/1092x0/filters:gifv()/2019/04/26/0d76509f-f1e7-4632-8adf-cb898fd43ea0/into-the-spoilers-we-go.gif
			//   https://www.cnet.com/a/2019/04/26/0d76509f-f1e7-4632-8adf-cb898fd43ea0/into-the-spoilers-we-go.gif
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+a\/+img\/+/, "/");
			if (newsrc) {
				return urljoin("https://" + domain + "/a/", common_functions["get_thumbor_url"](newsrc), true);
			}
		}

		if (domain === "japan.cnet.com") {
			// https://japan.cnet.com/storage/2020/07/08/1f79967b19bf9c52ac5616153c8e278c/t/584/438/d/smartphone_native.jpg
			//   https://japan.cnet.com/storage/2020/07/08/1f79967b19bf9c52ac5616153c8e278c/smartphone_native.jpg
			return src.replace(/(\/storage\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9a-f]{30,}\/+)t\/+[0-9]+\/+[0-9]+\/+d\/+([^/]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "rei.com") {
			// thanks to AdClear247 on github: https://github.com/qsniyg/maxurl/issues/705
			// https://www.rei.com/product/173720/hoka-one-one-stinson-atr-6-trail-running-shoes-womens
			// https://www.rei.com/media/2e6cf0fb-6058-41b7-b36c-3816161f4abd?size=120x90 -- 110x90
			//   https://www.rei.com/media/2e6cf0fb-6058-41b7-b36c-3816161f4abd -- 440x359
			//   https://www.rei.com/media/2e6cf0fb-6058-41b7-b36c-3816161f4abd?size=784x588 -- 720x588
			//   https://www.rei.com/media/2e6cf0fb-6058-41b7-b36c-3816161f4abd?size=999999 -- 1500x1225
			// https://www.rei.com/media/product/1738320080?size=32
			//   https://www.rei.com/media/product/1738320080?size=999999 -- 1936x1019
			// https://www.rei.com/media/e003e697-8bb5-4167-a760-b44cb87d746f?size=999999 -- 2000x865
			return src.replace(/(\/media\/+(?:product\/+[0-9]+|[-0-9a-f]{10,}))(?:[?#].*)?$/, "$1?size=999999");
		}

		if (domain === "images.internetstores.de") {
			// thanks to AdClear247 on github: https://github.com/qsniyg/maxurl/issues/706
			// https://images.internetstores.de/products//1204816/02/7dfc07/Hoka_One_One_Stinson_ATR_6_Laufschuhe_Herren_frost_gray_bright_marigold%5B640x480%5D.jpg?forceSize=true&forceAspectRatio=true&useTrim=true
			//   https://images.internetstores.de/products//1204816/02/7dfc07/Hoka_One_One_Stinson_ATR_6_Laufschuhe_Herren_frost_gray_bright_marigold%5B280x280%5D.jpg?forceSize=true&forceAspectRatio=true&useTrim=true
			//   https://images.internetstores.de/products//1204816/02/7dfc07/Hoka_One_One_Stinson_ATR_6_Laufschuhe_Herren_frost_gray_bright_marigold%5B640x480%5D%5B640x480%5D.jpg?forceSize=true&forceAspectRatio=true&useTrim=true?forceSize=true&forceAspectRatio=true&useTrim=true
			//   https://images.internetstores.de/products//1204816/02/7dfc07/Hoka_One_One_Stinson_ATR_6_Laufschuhe_Herren_frost_gray_bright_marigold%5B640x480%5D%5B640x480%5D.jpg
			//   https://images.internetstores.de/products//1204816/02/7dfc07/Hoka_One_One_Stinson_ATR_6_Laufschuhe_Herren_frost_gray_bright_marigold.jpg
			return src.replace(/(\/products\/+[0-9]+\/+.*\/[^/.?#]+?)(?:(?:\[|%5[bB])[0-9]+x[0-9]+(?:\]|%5[dD]))*(\.[^/.?#]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "icheckmovies.com") {
			// https://www.icheckmovies.com/images/dvdCover.png
			if (/\/images\/+dvdCover\.png/.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}

			// https://www.icheckmovies.com/var/posters/medium/4000/4000263.jpg
			//   https://www.icheckmovies.com/var/posters/original/4000/4000263.jpg
			// other:
			// https://www.icheckmovies.com/var/avatar/small/206/206421.jpg -- original = 404
			return src.replace(/(\/var\/+posters\/+)(?:small|medium)\/+/, "$1original/");
		}

		if (domain_nowww === "mojtv.hr") {
			// https://mojtv.hr/thumb.ashx?path=/images/2021-04/e05f5cfb-41f3-4790-8a9e-0bf401.jpg&w=491&h=250
			//   https://mojtv.hr/images/2021-04/e05f5cfb-41f3-4790-8a9e-0bf401.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+thumb\.ashx\?(?:.*&)?path=([^&]+).*$/, "$1");
			if (newsrc !== src) {
				return urljoin("https://" + domain + "/", newsrc, true);
			}
		}

		if (domain_nosub === "picstate.com" && /^s[0-9]*\./.test(domain)) {
			// https://s4.picstate.com/sm/e9a/b96d97da226025063c803cc5ec3daf90.jpg
			//   https://s4.picstate.com/fl/e9a/b96d97da226025063c803cc5ec3daf90.jpg
			return src.replace(/\/[a-z]{2}\/+([0-9a-f]{3}\/+[0-9a-f]{20,}\.)/, "/fl/$1");
		}

		if (domain_nowww === "picstate.com") {
			// http://picstate.com/thumbs/small/3503563_7cwtf/4214124.jpg
			//   http://picstate.com/files/3503563_7cwtf/4214124.jpg
			return src.replace(/\/thumbs\/+[a-z]+\/+/, "/files/");
		}

		if (domain_nowww === "laden.to") {
			// https://laden.to/data/mini/4c5c379de8cf47a40a3937767f99acf7.jpg
			//   https://laden.to/data/poster/4c5c379de8cf47a40a3937767f99acf7.jpg
			return src.replace(/\/data\/+mini\/+/, "/data/poster/");
		}

		if (domain === "images.universal-music.de") {
			// thanks to fedesk on discord for reporting
			// https://images.universal-music.de/img/assets/504/504862/4/800/das-werk-meines-lebens.jpg
			//   https://static.universal-music.de/asset_new/504862/195/view/das-werk-meines-lebens.jpg
			// /195/ seems to be the same for all images
			return src.replace(/^[a-z]+:\/\/[^/]+\/+img\/+assets\/+[0-9]{3}\/+([0-9]+)\/+[0-9]+\/+[0-9]+\/+([^/?#]+)(?:[?#].*)?$/, "https://static.universal-music.de/asset_new/$1/195/view/$2");
		}

		if (domain === "cdn-shop.adafruit.com") {
			// https://cdn-shop.adafruit.com/480x360/4956-00.jpg
			//   https://cdn-shop.adafruit.com/original/4956-00.jpg
			return src.replace(/(:\/\/[^/]+\/+)[0-9]+x[0-9]+\/+/, "$1original/");
		}

		if (domain_nowww === "dilangwyn.com") {
			// thanks to elvisef on github: https://github.com/qsniyg/maxurl/issues/713
			// http://dilangwyn.com/gallery
			// http://dilangwyn.com/images/04-DilanThmb.jpg
			//   http://dilangwyn.com/images/04-Dilan.jpg -- 1800x1200, upscaled
			// http://dilangwyn.com/images/02-DilanThmb.jpg -- 500x500
			//   http://dilangwyn.com/images/02-Dilan.jpg -- 900x1200, not upscaled
			return src.replace(/(\/images\/+[0-9]+-[^/.]+)Thmb(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "embed.videodelivery.net") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+embed\/+iframe\.[^/.]+\.[0-9a-f]+\.html\?(?:.*&)?videoId=([0-9a-f]{10,})(?:[?&#].*)?$/,
				run: function(cb, match) {
					var vid = match[1];

					var urls = [];

					urls.push({
						url: "https://videodelivery.net/" + match[1] + "/manifest/video.mpd",
						headers: {
							origin: "",
							referer: ""
						},
						video: "dash"
					});

					urls.push("https://videodelivery.net/" + vid + "/thumbnails/thumbnail.jpg?width=2000");

					return cb(urls);
				}
			});
			if (newsrc) return newsrc;
		}

		if (amazon_container === "diy-magazine") {
			// thanks to fedesk on discord
			// https://diymag.com/features/p44
			// https://diy-magazine.s3.amazonaws.com/d/diy/Artists/S/Sigrid/Class-Of-2018/_square/Sigrid-class-of-hi-res-_MIK2573.jpg
			//   https://diy-magazine.s3.amazonaws.com/d/diy/Artists/S/Sigrid/Class-Of-2018/Sigrid-class-of-hi-res-_MIK2573.jpg
			// https://diy-magazine.s3.amazonaws.com/d/diy/Artists/N/Nils-Frahm/_landscape/NILS_FRAHM_All_Melody_credit_Alexander_Schneider_small-1600x1194.jpg
			//   https://diy-magazine.s3.amazonaws.com/d/diy/Artists/N/Nils-Frahm/NILS_FRAHM_All_Melody_credit_Alexander_Schneider_small-1600x1194.jpg
			// https://diy-magazine.s3.amazonaws.com/d/diy/Artists/S/Sigrid/_1500x1000_crop_center-center_none/Credit-Holly-Whitaker.jpg
			//   https://diy-magazine.s3.amazonaws.com/d/diy/Artists/S/Sigrid/Credit-Holly-Whitaker.jpg
			return src.replace(/\/_(?:square|landscape|[0-9]+x[0-9]+)(?:_[^/]+)?\/+([^/]+)(?:[?#].*)?$/, "/$1");
		}

		if (domain_nowww === "photosex.biz") {
			// http://photosex.biz/imager/w_400/h_400/cc89f05bf1ac4ad9d11933ab318e189d.jpg
			//   http://photosex.biz/pic_b/cc89f05bf1ac4ad9d11933ab318e189d.jpg
			newsrc = src.replace(/\/imager\/+(?:[wh]_[0-9]+\/+)*/, "/pic_b/");
			if (newsrc !== src)
				return {
					url: newsrc,
					headers: {
						Referer: "http://photosex.biz/v.php?id=" + src.replace(/.*\/([0-9a-f]{10,})\.[^/]+(?:[?#].*)?$/, "$1")
					}
				};
		}

		if ((domain_nosub === "gmx.ch" ||
			// thanks to roi:
			// https://i0.gmx.net/image/916/37697916%2cpd=1%2cf=responsive1610-w116/handball-wm-frankreich-polen.webp
			//   https://i0.gmx.net/image/916/37697916,pd=1/handball-wm-frankreich-polen.png
			domain_nosub === "gmx.net") && /^i[0-9]*\./.test(domain)) {
			// https://i0.gmx.ch/image/678/35770678%2cpd=4%2cf=responsive169-w450/netflix-amazon-prime-video-streaming-filme-serien-.webp
			//   https://i0.gmx.ch/image/678/35770678%2cpd=0/netflix-amazon-prime-video-streaming-filme-serien-.webp
			//   https://i0.gmx.ch/image/678/35770678%2cpd=0/netflix-amazon-prime-video-streaming-filme-serien-.png -- jpg, but better quality than webp
			// https://i0.gmx.ch/image/332/35770332%2cpd=1%2cf=responsive169-w450.webp
			//   https://i0.gmx.ch/image/332/35770332%2cpd=0.png
			// https://i0.gmx.ch/image/932/35770932,pd=2,f=lead-l/lets-dance-joachim-llambi-rtl-tanzen-ausgeschieden.jpg
			//   https://i0.gmx.ch/image/932/35770932,pd=0/lets-dance-joachim-llambi-rtl-tanzen-ausgeschieden.jpg
			// https://i0.gmx.ch/image/870/38143870,pd=1,h=300,w=530/bachmut.jpg
			//   https://i0.gmx.ch/image/870/38143870,pd=1/bachmut.jpg -- 3000x1999
			newsrc = src.replace(/(\/image\/+[0-9]+\/+[0-9]+)(?:,|%2c)[^/]*([/.])/i, "$1,pd=1$2");
			if (newsrc !== src)
				return newsrc;

			return src.replace(/(\/image\/+[0-9]+\/+[^/]+(?:\/+[^/]*)?)\.webp(?:[?#].*)?$/i, "$1.png");
		}

		if ((domain_nosub === "amomama.xyz" && /^imgproxy/.test(domain)) ||
			// thanks to eightyy8 on github for reporting: https://github.com/qsniyg/maxurl/issues/1110
			// https://images.apkeasy.me/hidden-settings-banner/fill/640/360/no/1/aHR0cHM6Ly9saDMuZ29vZ2xldXNlcmNvbnRlbnQuY29tLzRlTE5oeFZHTXp2eExOVDV2RkVWcGZlTmIyUHNyU0FSR2tJYVFtNVByOXloUWRfZVgxWXhsMkJKVDd6eUdUNUxiSk1DPXcxMDAw) {
			//   https://lh3.googleusercontent.com/4eLNhxVGMzvxLNT5vFEVpfeNb2PsrSARGkIaQm5Pr9yhQd_eX1Yxl2BJT7zyGT5LbJMC=s0?imgmax=0
			domain === "images.apkeasy.me" ||
			// thanks to eightyy8 on github for reporting: https://github.com/qsniyg/maxurl/issues/1110
			// https://img.apkeasy.com/screenshot-0/fill/0/620/no/1/aHR0cHM6Ly9wbGF5LWxoLmdvb2dsZXVzZXJjb250ZW50LmNvbS9JbVdZQmN6SFNlbVhXa2hVNmpBc2lFREpNbWFjY2wtYnRXcnpMT1c2VXktOUhhQmY2S3dxbDYwR1dTal9pM0MxZmc9dzE0NDAtaDYyMA==.webp
			//   https://play-lh.googleusercontent.com/ImWYBczHSemXWkhU6jAsiEDJMmaccl-btWrzLOW6Uy-9HaBf6Kwql60GWSj_i3C1fg=s0?imgmax=0
			domain === "img.apkeasy.com") {
			// https://imgproxy-ohio.amomama.xyz/brwJ1xz5mYQfzLSZf7daImiRnlDL0nWHyI2VU0XFaaA/fill/992/0/no/1/aHR0cHM6Ly9jZG4uYW1vbWFtYS5jb20vMjFhYzIzODViYWY0MWYzZDM1NTRkODU3MzY1YjYyYjMuanBnP3dpZHRoPTEyMDAmaGVpZ2h0PTUwMA.webp
			//   https://cdn.amomama.com/21ac2385baf41f3d3554d857365b62b3.jpg
			match = src.match(/\/(aHR0c[^/.?#]+)(?:\..*)?$/);
			if (match)
				return base64_decode(match[1]);
		}

		if (domain_nosub === "gravatar.com") {
			// thanks to C4illin on github for reporting: https://github.com/qsniyg/maxurl/issues/733
			// https://s.gravatar.com/avatar/cf0bd1f2e1e14a98358c37ccf31ccd32?r=pg&d=404 -- 80x80
			// https://s.gravatar.com/avatar/cf0bd1f2e1e14a98358c37ccf31ccd32?r=pg&s=128&d=404 -- 128x128
			// https://s.gravatar.com/avatar/cf0bd1f2e1e14a98358c37ccf31ccd32?r=pg&s=2048&d=404 -- 2048x2048, upscaled
			// thanks to Noodlers on discord:
			// https://www.gravatar.com/avatar/2c6016bea22b2a323c65876ae0f74186?s=32&d=identicon&r=PG
			//   https://www.gravatar.com/avatar/2c6016bea22b2a323c65876ae0f74186?s=9999&d=identicon&r=PG
			// thanks to TheLastZombie on github: https://github.com/qsniyg/maxurl/pull/1027
			// https://www.gravatar.com/blavatar/0f1d01958fea5d461d6b3b617c64b35b?s=32
			//   https://www.gravatar.com/blavatar/0f1d01958fea5d461d6b3b617c64b35b?s=9999
			// there doesn't appear to be a way to get the original, non-upscaled image
			// thanks to kidonng on github: https://github.com/qsniyg/maxurl/pull/1156
			// https://www.gravatar.com/avatar/2c6016bea22b2a323c65876ae0f74186?s=9999&d=identicon&r=PG&size=32
			//   https://www.gravatar.com/avatar/2c6016bea22b2a323c65876ae0f74186?s=9999&d=identicon&r=PG

			if (/\/(bl)?avatar\/+[0-9a-f]{10,}/.test(src)) {
				newsrc = remove_queries(add_queries(src, {"s": "9999"}), ["size"]);
				if (newsrc !== src) {
					return {
						url: newsrc,
						problems: {
							possibly_upscaled: true
						}
					};
				}
			}
		}

		if (domain === "cdn.v2ex.com") {
			// thanks to n0099 on github: https://github.com/qsniyg/maxurl/issues/1342
			// https://cdn.v2ex.com/gravatar/0eb707f53a1c4d96f2d8cac61702a27c?s=48&d=retro
			//   https://www.gravatar.com/avatar/0eb707f53a1c4d96f2d8cac61702a27c?s=9999&d=retro
			return src.replace(/^[a-z]+:\/\/[^/]+\/+gravatar\/+([0-9a-f]+(?:\?.*)?)$/, "https://www.gravatar.com/avatar/$1");
		}

		if (domain_nowww === "jeansgetwet.com" ||
			// https://www.jeanslezdom.com/updates/a/attika_jenny/01/jeanslezdom-attika_jenny-1s.jpg
			//   https://www.jeanslezdom.com/updates/a/attika_jenny/01/jeanslezdom-attika_jenny-1.jpg
			domain_nowww === "jeanslezdom.com" ||
			// https://www.jeansorgasm.com/updates/d/drea/01/jeansorgasm-drea-1s.jpg
			//   https://www.jeansorgasm.com/updates/d/drea/01/jeansorgasm-drea-1.jpg
			domain_nowww === "jeansorgasm.com" ||
			// https://www.jeanstease.com/updates/o/olesya/01/jeanstease-olesya-2s.jpg
			//   https://www.jeanstease.com/updates/o/olesya/01/jeanstease-olesya-2.jpg
			domain_nowww === "jeanstease.com" ||
			// https://www.jeansverytight.com/updates/g/genya/01/jeansverytight-genya-3s.jpg
			//   https://www.jeansverytight.com/updates/g/genya/01/jeansverytight-genya-3.jpg
			domain_nowww === "jeansverytight.com" ||
			// https://www.jeansbabes.com/updates/j/jenny/04/jeansbabes-jenny-04-1s.jpg
			//   https://www.jeansbabes.com/updates/j/jenny/04/jeansbabes-jenny-04-1.jpg
			domain_nowww === "jeansbabes.com" ||
			// https://www.jeanslesbians.com/updates/j/jay-dee_taissia/01/jeanslesbians-jay-dee_taissia-1s.jpg
			//   https://www.jeanslesbians.com/updates/j/jay-dee_taissia/01/jeanslesbians-jay-dee_taissia-1.jpg
			domain_nowww === "jeanslesbians.com") {
			// thanks to AdClear247 on github: https://github.com/qsniyg/maxurl/issues/734
			// https://www.jeansgetwet.com/updates/m/mandy/01/jeansgetwet-mandy-1s.jpg
			//   https://www.jeansgetwet.com/updates/m/mandy/01/jeansgetwet-mandy-1.jpg
			return src.replace(/(\/updates\/+[a-z]\/+[a-z-_]+\/+[0-9]+\/+[^/]+-[0-9]+)s(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nosub === "cdn-outlet.com") {
			// thanks to AdClear247 on github for reporting: https://github.com/qsniyg/maxurl/issues/735
			// https://photos.cdn-outlet.com/photos/alternate/261x294/8191402/8191402-63302-1A-261x294.jpg
			//   https://photos.cdn-outlet.com/photos/options/8191402-63302-1A.jpg -- 444x500
			//   https://photos.cdn-outlet.com/photos/options/8191402-63302-1A-zoomin.jpg -- 1044x1176, upscaled?
			// https://photos.cdn-outlet.com/photos/SOResource/options/8149493-48720-259x292-AUTO.jpg
			//   https://photos.cdn-outlet.com/photos/options/8149493-48720.jpg -- 444x500
			// https://photos.cdn-outlet.com/photos/7543-2-zoomin.jpg -- 1044x1176, upscaled
			// https://www.cdn-outlet.com/photos/SOResource/49130-2T-134x151-AUTO.jpg
			//   https://www.cdn-outlet.com/photos/49130-2T.jpg -- 261x294
			//   https://www.cdn-outlet.com/photos/49130-2T-zoomin.jpg -- 1044x1176
			//   https://photos.cdn-outlet.com/photos/options/8116678-10852-1A-zoomin.jpg
			// page: https://www.swimoutlet.com/p/body-glove-womens-loose-fit-long-sleeve-rashguard-8116678/
			// other:
			// https://photos.cdn-outlet.com/photos/homepage/M7_Tri_m@2x_02022020_190504.jpg
			// https://photos.cdn-outlet.com/photos/homepage/m4@2x_04072021_155658.jpg
			// https://photos.cdn-outlet.com/photos/homepage/M8_m@2x_06042020_181406.jpg
			// https://photos.cdn-outlet.com/photos/cms/images/DIRECT_PG52-7929-2020-03-06-14-11-29-843.jpg -- 691x461
			// https://photos.cdn-outlet.com/photos/cms/images/_63A0100-2100x1378-f2bfd1f2-9f3e-4148-b22b-027d0311ae4f.jpg -- 1600x1050
			// https://photos.cdn-outlet.com/photos/cms/images/iStock-157531506.jpg -- 1600x1065
			// https://photos.cdn-outlet.com/photos/cms/images/BL8K310_ORC_2.jpg -- 761x1143
			// https://photos.cdn-outlet.com/photos/cms/images/Finis%20Onyx%20Full.jpg -- 200x276
			// https://photos.cdn-outlet.com/photos/options/8169655-57230-1A.jpg -- 1044x1176
			//   https://photos.cdn-outlet.com/photos/options/8169655-57230-1A-zoomin.jpg -- 1044x1176
			// https://photos.cdn-outlet.com/photos/8162190-2.jpg -- 1044x1176
			// https://photos.cdn-outlet.com/yo-images/userfiles/guide/image/yogapose.jpg -- 5616x3744
			// https://photos.cdn-outlet.com/yo-images/userfiles/Guide/image/BRETT/yoga_mats/Screen%20Shot%202015-08-31%20at%203_58_11%20PM.png -- 1915x1075
			newsrc = src
				.replace(/\/photos\/+alternate\/+[0-9]+x[0-9]+\/+[0-9]+\/+([0-9]+-[0-9]+(?:-[0-9]+[A-Z])?)-[0-9]+x[0-9]+\./, "/photos/options/$1.")
				.replace(/\/photos\/+SOResource\/+((?:options\/+)?[0-9]+(?:-[0-9]+)?(?:-[0-9]+[A-Z])?)-[0-9]+x[0-9]+-AUTO\./, "/photos/$1.");

			if (newsrc !== src)
				return newsrc;

			newsrc = src.replace(/(\/photos\/+(?:options\/+)?[0-9]+(?:-[0-9]+)?(?:-[0-9]+[A-Z])?)\./, "$1-zoomin.");
			if (newsrc !== src) {
				return {
					url: newsrc,
					problems: {
						possibly_upscaled: true
					}
				};
			}
		}

		if (domain_nowww === "leisurepro.com") {
			// thanks to AdClear246 on github: https://github.com/qsniyg/maxurl/issues/736
			// https://www.leisurepro.com/image/Product/Small/CSBRGWSSBA.jpg -- 55x55
			//   https://www.leisurepro.com/image/Product/Medium/CSBRGWSSBA.jpg -- 100x100
			//   https://www.leisurepro.com/image/Product/Full/CSBRGWSSBA.jpg -- 221x221
			//   https://www.leisurepro.com/image/Product/Large/CSBRGWSSBA.jpg -- 500x500
			//   https://www.leisurepro.com/image/Product/XLarge/CSBRGWSSBA.jpg -- 1200x1200
			// https://www.leisurepro.com/Image/Product/Thumb/CSBSALF_2.jpg -- 50x50
			//   https://www.leisurepro.com/Image/Product/XLarge/CSBSALF_2.jpg
			// other:
			// https://www.leisurepro.com/image/product/ebay/OTSSFMBL.jpg -- 4022x3016, dead
			// https://www.leisurepro.com/image/product/ebay/OTSSFM.jpg -- 3387x2540, dead
			// https://www.leisurepro.com/adminImages/cms/CUbtyhnn.png -- 3275x3350
			//   https://www.leisurepro.com/p-csbsalf/cressi-65mm-shaft-for-apache-and-apache-lion-fish-spear-gun
			//   https://www.leisurepro.com/Image/Product/Large/CSBSALF.jpg
			return src.replace(/(\/image\/+product\/+)(?:thumb|small|medium|full|large)\/+/i, "$1XLarge/");
		}

		if (domain_nowww === "jcrew.com") {
			// thanks to AdClear247 on github: https://github.com/qsniyg/maxurl/issues/741
			// https://www.jcrew.com/s7-video-facade/AY843_NA6966_v_sm.mp4
			//   https://www.jcrew.com/s7-video-facade/AY843_NA6966_v.mp4
			// https://www.jcrew.com/s7-img-facade/AY843_BK0001?fmt=jpeg&qlt=90,0&resMode=sharp&op_usm=.1,0,0,0&crop=0,0,0,0&wid=480&hei=480
			//   https://www.jcrew.com/s7-img-facade/AY843_BK0001
			// other: https://www.jcrew.com/s7-img-facade/AY843_BK0001_d2
			// https://www.jcrew.com/s7-img-facade/E8726_PK5652?fmt=jpeg&qlt=90,0&resMode=sharp&op_usm=.1,0,0,0&crop=0,0,0,0&wid=160&hei=160
			//   https://www.jcrew.com/s7-img-facade/E8726_PK5652?fmt=jpeg&qlt=90,0&resMode=sharp&op_usm=.1,0,0,0&crop=0,0,0,0&wid=2000&hei=2000
			//   https://www.jcrew.com/s7-img-facade/E8726_PK5652 -- less sharp? could be post-processing on the url above
			return {
				url: src
					.replace(/(-img-facade\/+[A-Za-z0-9_]+)(?:[?#].*)?$/, "$1")
					.replace(/(-video-facade\/+[^/]+)_sm\./, "$1."),
				bad_if: [{
					headers: {
						"last-modified": "Thu, 15 Oct 2020 22:15:14 GMT",
						"content-length": "21110",
						"content-type": "image/webp"
					}
				}]
			};
		}

		if (domain_nowww === "onlinescuba.com") {
			// thanks to AdClear247 on github: https://github.com/qsniyg/maxurl/issues/740
			// http://www.onlinescuba.com/Assets/ProductImages/AL100286black_t.png
			//   http://www.onlinescuba.com/Assets/ProductImages/AL100286black.png
			// https://www.onlinescuba.com/Assets/ProductImages/4701_t.png
			//   https://www.onlinescuba.com/Assets/ProductImages/4701.png
			return src.replace(/(\/assets\/+productimages\/+[^/]+)_t\./i, "$1.");
		}

		if (domain_nosub === "azbro.com" && /^image[0-9]*\./.test(domain)) {
			// thanks to AdClear247 on github: https://github.com/qsniyg/maxurl/issues/742
			// http://image23.azbro.com/o_img/2016/09/23/207766-10105846-category/women-s-2-piece-long-sleeve-cropped-rash-guard.jpg
			//   http://image23.azbro.com/o_img/2016/09/23/207766-10105846/women-s-2-piece-long-sleeve-cropped-rash-guard.jpg -- upscaled
			newsrc = src.replace(/(\/o_img\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9]+-[0-9]+)-category\/+/, "$1/");
			if (newsrc !== src) {
				return {
					url: newsrc,
					problems: {
						possibly_upscaled: true
					}
				};
			}
		}

		if (domain === "foto.samfundet.no") {
			// thanks to fedesk on discord:
			// https://foto.samfundet.no/media/alle/thumb/DIGFQ/digfq0775.jpg -- 300x300
			//   https://foto.samfundet.no/media/alle/web/DIGFQ/digfq0775.jpg -- 665x1000
			// other:
			// https://foto.samfundet.no/media/alle/web/DIGFO/fg_gruppebilde.jpg -- 5691x3798
			// https://foto.samfundet.no/media/alle/fg_profile_images/digfa2542.jpg -- 4928x3280
			return src.replace(/(\/media\/+alle\/+)thumb\/+/, "$1web/");
		}

		if (domain_nowww === "gamaniak.com" ||
			// https://mediagamaniak.cdn.re/gal/vrac-115/tn_profil-face-une-photo.jpg
			//   https://mediagamaniak.cdn.re/gal/vrac-115/profil-face-une-photo.jpg
			domain === "mediagamaniak.cdn.re") {
			// https://www.gamaniak.com/media/gal/vrac-103/tn_mug-constellations.jpg
			//   https://www.gamaniak.com/media/gal/vrac-103/mug-constellations.jpg
			// https://www.gamaniak.com/media/gal/vrac-104/papaella.jpg
			//   https://www.gamaniak.com/media/gal/vrac-104/full_papaella.jpg -- 824x710
			return src
				.replace(/(\/gal\/+[^/]+\/+)(?:full_)?([^_/]+)$/, "$1full_$2")
				.replace(/(\/gal\/+[^/]+\/+)tn_/, "$1");
		}

		if (domain === "images.tori.fi") {
			// thanks to thomas-ed on github: https://github.com/qsniyg/maxurl/issues/759
			// https://www.tori.fi/uusimaa/Iciw_uusi_vaatepaketti_84145688.htm
			// https://www.tori.fi/kaikki_kuvat.htm?id=84145688
			// https://images.tori.fi/api/v1/imagestori/images/5994569715.jpg?rule=adwatches -- 120x90
			//   https://images.tori.fi/api/v1/imagestori/images/5994569715.jpg?rule=medium_660 -- 660x495
			//   https://images.tori.fi/api/v1/imagestori/images/5994569715.jpg?rule=medium -- 720x540
			//   https://images.tori.fi/api/v1/imagestori/images/5968999758.jpg?rule=thumbs -- 45x60
			//   https://images.tori.fi/api/v1/imagestori/images/5994569715.jpg?rule=big -- 980x735
			//   https://images.tori.fi/api/v1/imagestori/images/5994569715.jpg?rule=original -- 1280x960
			return src.replace(/(\/api\/+v1\/+imagestori\/+images\/+[0-9]+\.[a-z]+)(?:[?#].*)?$/, "$1?rule=original");
		}

		if (domain_nosub === "discountdance.com" && /^cdn[0-9]*\./.test(domain)) {
			// thanks to AdClear247 on github: https://github.com/qsniyg/maxurl/issues/760
			// https://www.discountdance.com/dancewear/style_A001AL.html
			// https://cdn1.discountdance.com/image/70x93/a001al_1.jpg
			//   https://cdn1.discountdance.com/image/165x220/a001al_1.jpg
			//   https://cdn1.discountdance.com/image/207x275/a001al_1.jpg
			//   https://cdn1.discountdance.com/image/300x399m/a001al_1.jpg
			//   https://cdn1.discountdance.com/image/395x526/a001al_1.jpg
			//   https://cdn1.discountdance.com/image/448x597/a001al_1.jpg
			//   https://cdn1.discountdance.com/image/600x800m/a001al_1.jpg
			//   https://cdn1.discountdance.com/image/1000x1333m/a001al_1.jpg
			//   https://cdn1.discountdance.com/image/1395x1860/a001al_1.jpg
			return src.replace(/(\/image\/+)(?:[0-9]{1,3}x[0-9]{1,3}m?|1000x1333m)\/+/, "$11395x1860/");
		}

		if (domain === "i.rtings.com") {
			// thanks to Liz™ on discord
			// https://i.rtings.com/assets/products/t90JF7wr/lg-48-cx-oled/design-small.jpg -- 693x390
			//   https://i.rtings.com/assets/products/t90JF7wr/lg-48-cx-oled/design-medium.jpg -- 1778x1000
			//   https://i.rtings.com/assets/products/t90JF7wr/lg-48-cx-oled/design-large.jpg -- 5189x2919
			// https://i.rtings.com/assets/pages/gjZEc8Xt/best-mirrorless-cameras-for-travel-medium.jpg
			//   https://i.rtings.com/assets/pages/gjZEc8Xt/best-mirrorless-cameras-for-travel-large.jpg
			return src.replace(/(\/assets\/+[^/]+\/+[A-Za-z0-9]{5,10}\/+(?:[^/]+\/+)?[^/]+)-(?:small|medium)\./, "$1-large.");
		}

		if (domain === "img.yts.mx") {
			// thanks to Art-2 on github: https://github.com/qsniyg/maxurl/issues/762
			// https://img.yts.mx/assets/images/movies/the_golem_1920/medium-cover.jpg
			//   https://img.yts.mx/assets/images/movies/the_golem_1920/original-cover.jpg
			return src.replace(/(\/assets\/+images\/+movies\/+[^/]+\/+)[a-z]+(-cover\.)/, "$1original$2");
		}

		if (domain_nowww === "radikal.ru") {
			// thanks to elvisef on github for reporting: https://github.com/qsniyg/maxurl/issues/755
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+lfp\/+([^/]*\.radikal\.ru.*?\.[^/.]+)\/htm(?:[?#].*)?$/,
				run: function(cb, match) {
					return cb({
						url: "https://" + match[1],
						headers: {
							Referer: "https://radikal.ru/"
						}
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nosub === "radikal.ru" && /^s[0-9]*\./.test(domain)) {
			// https://s015.radikal.ru/i332/1510/7a/0c5e1696a973x.jpg
			return {
				url: src.replace(/(\/i[0-9]+\/.*\/[0-9a-f]{5,})x?\./, "$1."),
				headers: {
					Referer: "https://radikal.ru/"
				}
			};
		}

		if (domain_nosub === "radikal.ru" && /^[a-b]\./.test(domain)) {
			// https://b.radikal.ru/b22/2104/86/c1ed4f7be0cct.jpg
			//   https://b.radikal.ru/b22/2104/86/c1ed4f7be0cc.png
			newsrc = src.replace(/(\/[0-9a-f]{4}\/+[0-9a-f]{2}\/+[0-9a-f]{5,})t\./, "$1.");
			if (newsrc !== src)
				return add_extensions(newsrc, {
					headers: {
						Referer: "https://radikal.ru/"
					}
				});
		}

		if (domain_nowww === "freemusicarchive.org") {
			// https://freemusicarchive.org/image?file=images%2Falbums%2FTeleg_-_teleg_EP_-_20150603123810008.jpg&width=155&height=155&type=image
			//   https://files.freemusicarchive.org/storage-freemusicarchive-org/images/albums/Teleg_-_teleg_EP_-_20150603123810008.jpg
			newsrc = src.replace(/.*\/image\?(?:.*&)?file=([^&]+).*$/, "$1");
			if (newsrc !== src)
				return "https://files.freemusicarchive.org/storage-freemusicarchive-org/" + decodeURIComponent(newsrc);
		}

		if (amazon_container === "emojipedia-us") {
			// thanks to Noodlers on discord
			// https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/60/twitter/281/slightly-smiling-face_1f642.png
			//   https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/72/twitter/281/slightly-smiling-face_1f642.png
			//   https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/120/twitter/281/slightly-smiling-face_1f642.png
			//   https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/150/twitter/281/slightly-smiling-face_1f642.png
			//   https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/160/twitter/281/slightly-smiling-face_1f642.png
			//   https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/240/twitter/281/slightly-smiling-face_1f642.png
			//   https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/320/twitter/281/slightly-smiling-face_1f642.png
			// other: https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/socialmedia/twitter/281/slightly-smiling-face_1f642.png -- 560x300, blue bg
			return src.replace(/\/thumbs\/+(?:[0-9]{1,2}|[12][0-9]{2})\/+/, "/thumbs/320/");
		}

		if (domain_nosub === "disney.com" && /^cdn[0-9]*\./.test(domain)) {
			// thanks to VJ on discord
			// https://cdn1.parksmedia.wdprapps.disney.com/resize/mwImage/1/434/244/75/dam/disneyland/destinations/disneyland/snow-white-16x9.jpg -- 450x253
			//   https://cdn1.parksmedia.wdprapps.disney.com/dam/disneyland/destinations/disneyland/snow-white-16x9.jpg -- 2700x1519
			// first one can be 1-3
			// last one doesn't appear to do anything (0-??). 75 looks like quality, but doesn't appear to affect the image
			return src.replace(/\/resize\/+mwImage\/+[0-9]+\/+(?:[0-9]+\/+){2}[0-9]+\/+dam\/+/, "/dam/");
		}

		if (amazon_container === "duolingo-images") {
			// thanks to Noodlers on discord
			// https://duolingo-images.s3.amazonaws.com/avatars/10234758/6SYgP3xmyQ/small
			//   https://duolingo-images.s3.amazonaws.com/avatars/10234758/6SYgP3xmyQ/xlarge -- 200x200
			//   https://duolingo-images.s3.amazonaws.com/avatars/10234758/6SYgP3xmyQ/xxlarge -- 1000x1000, upscaled
			newsrc = src.replace(/(\/avatars\/+[0-9]+\/+[^/]+\/+)(?:small|medium|large)(?:[?#].*)?$/, "$1xlarge");
			if (newsrc !== src)
				return newsrc;

			newsrc = src.replace(/(\/avatars\/+[0-9]+\/+[^/]+\/+)xlarge(?:[?#].*)?$/, "$1xxlarge");
			if (newsrc !== src) {
				return {
					url: newsrc,
					problems: {
						possibly_upscaled: true
					}
				};
			}
		}

		if (domain === "wl-brightside.cf.tsp.li") {
			// https://wl-brightside.cf.tsp.li/resize/336x177/jpg/2e6/d91/8f964f549cb9c0ad1deb6723d0.jpg
			//   https://wl-brightside.cf.tsp.li/compressed/2e6/d91/8f964f549cb9c0ad1deb6723d0.jpg
			return src
				//.replace(/\/compressed\/+/, "/") // doesn't work
				.replace(/\/resize\/+[0-9]*x[0-9]*\/+(?:jpg|png)\/+/, "/compressed/")
				// thanks to anonymous for reporting:
				// https://wl-brightside.cf.tsp.li/resize/728x/webp/a22/cc8/826c6c5bce95d41eb5ae225a2e.jpg.webp
				//   https://wl-brightside.cf.tsp.li/compressed/a22/cc8/826c6c5bce95d41eb5ae225a2e.jpg
				.replace(/\/resize\/+[0-9]*x[0-9]*\/+webp\/+(.*?\.[a-z]+)\.webp(?:[?#].*)?$/, "/compressed/$1");
		}

		if (domain_nowww === "means.tv") {
			// https://github.com/ytdl-org/youtube-dl/issues/29070
			var get_csrf_token = function(url, cb) {
				api_query("means.tv:csrf:" + url, {
					url: url,
					imu_mode: "document"
				}, cb, function(done, resp, cache_key) {
					var csrf_token = get_meta(resp.responseText, "csrf-token");
					if (!csrf_token) {
						console_error(cache_key, "Unable to find CSRF token from", resp);
						return done(null, false);
					}

					return done({
						token: csrf_token,
						pageurl: url
					}, 60*60);
				});
			};

			var query_means_api = function(tokenobj, url, cb) {
				api_query("means.tv:" + url, {
					url: url,
					headers: {
						Referer: tokenobj.pageurl,
						"X-CSRF-Token": tokenobj.token
					},
					json: true
				}, cb, function(done, resp, cache_key) {
					done(resp, 60*60);
				});
			};

			var query_means_program_by_name = function(tokenobj, name, cb) {
				query_means_api(tokenobj, "https://means.tv/api/contents/" + name, cb);
			};

			var query_means_episodes = function(tokenobj, id, cb) {
				query_means_api(tokenobj, "https://means.tv/api/chapters?content_id=" + id, cb);
			};

			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+programs\/+([^/?#]+)(?:[?#].*)?$/,
				run: function(cb, match) {
					var programname = match[1];
					var pageurl = "https://means.tv/programs/" + programname;

					var epid = null;
					var queries = get_queries(src);
					if (queries && queries.cid) {
						epid = queries.cid;
					}

					get_csrf_token(pageurl, function(tokenobj) {
						if (!tokenobj) return cb(null);

						query_means_program_by_name(tokenobj, match[1], function(data) {
							if (!data) return cb(null);

							var id = data.id;

							query_means_episodes(tokenobj, id, function(eps) {
								if (!eps) return cb(null);
								if (!eps.length) {
									console_error("No episodes", eps);
									return cb(null);
								}

								var album_links = [];
								var current_ep = null;
								array_foreach(eps, function(ep) {
									// intentional == due to string/int check
									var is_current = !current_ep && (!epid || ep.id == epid);

									album_links.push({
										url: pageurl + "?cid=" + ep.id,
										is_current: is_current
									});

									if (is_current) {
										current_ep = ep;
									}
								});

								if (!current_ep) {
									console_error("Unable to find episode", epid, "from", eps);
									return cb(null);
								}

								var urls = [];

								var versions = current_ep.subject && current_ep.subject.versions;
								if (versions && versions.hls) {
									urls.push({
										url: versions.hls,
										video: "hls"
									});
								}

								urls.push(current_ep.preview_image);

								return cb(fillobj_urls(urls, {
									extra: {
										caption: current_ep.title,
										page: pageurl + "?cid=" + current_ep.id,
										created_at: current_ep.created_at
									},
									album_info: {
										type: "links",
										links: album_links
									}
								}));
							});
						});
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if (host_domain_nowww === "means.tv" && options.element) {
			if (options.element.tagName === "VIDEO" && options.element.id) {
				match = options.element.id.match(/^video([0-9]+)$/);
				if (match) {
					return {
						url: options.host_url.replace(/[?#].*$/, "") + "?cid=" + match[1],
						is_pagelink: true
					};
				}
			}
		}

		if (domain === "img.ardmediathek.de") {
			// thanks to kellnerd on github for reporting: https://github.com/qsniyg/maxurl/issues/770
			// 9999 redirects to 4992
			// the -1774185891 component can be anything, including 0 or asdf, but must exist
			// https://img.ardmediathek.de/standard/00/86/73/27/62/-1774185891/1x1/448?mandant=ard
			//   https://img.ardmediathek.de/standard/00/86/73/27/62/-1774185891/0x0/4992 -- 1600x900
			// https://img.ardmediathek.de/standard/00/89/49/17/14/-1774185891/16x9/1280?mandant=ard -- 1280x720
			//   https://img.ardmediathek.de/standard/00/89/49/17/14/-1774185891/0x0/4992 -- 1280x720
			// https://img.ardmediathek.de/standard/00/71/97/58/06/-1852531467/16x9/1920?mandant=ard -- 1920x1080, upscaled
			//   https://img.ardmediathek.de/standard/00/71/97/58/06/-1852531467/0x0/4992 -- 1280x720, not upscaled
			return {
				url: src.replace(/(\/standard\/+.*\/)[0-9]+x[0-9]+\/+[0-9]+(?:[?#].*)?$/, "$10x0/4992"),
				head_wrong_contenttype: true // no content-type for head or get
			};
		}

		if (domain === "content.backcountry.com") {
			// thanks to AdClear247 on github: https://github.com/qsniyg/maxurl/issues/739
			// https://content.backcountry.com/images/items/small/BCC/BCC00AO/BKANWHTOGO.jpg -- 100x100
			//   https://content.backcountry.com/images/items/160/BCC/BCC00AO/BKANWHTOGO.jpg -- 160x160
			//   https://content.backcountry.com/images/items/medium/BCC/BCC00AO/BKANWHTOGO.jpg -- 300x300
			//   https://content.backcountry.com/images/items/large/BCC/BCC00AO/BKANWHTOGO.jpg -- 440x440
			//   https://content.backcountry.com/images/items/detail_large/BCC/BCC00AO/BKANWHTOGO.jpg -- 440x400
			//   https://content.backcountry.com/images/items/900/BCC/BCC00AO/BKANWHTOGO.jpg -- 900x900
			//   https://content.backcountry.com/images/items/1200/BCC/BCC00AO/BKANWHTOGO.jpg -- 1200x1200
			// https://content.backcountry.com/images/items/1200/BCA/BCA000C/ONECOL.jpg -- 1200x1200, upscaled
			// other:
			// https://content.backcountry.com/images/items/portrait/REI/REIE033/BLA.jpg -- != 1200 (different photo)
			// https://content.backcountry.com/images/items/portrait/BCC/BCCZ24J/ANT_D4.jpg -- same photo as 1200 (portrait is cropped)
			// https://content.backcountry.com/images/items/portrait/MHW/MHW01EV/DARSTO.jpg -- same photo as 1200
			// detail_ appears to exist for all, not sure what the difference is
			newsrc = src.replace(/(\/images\/+items\/+)(?:detail_)?(?:small|160|medium|large|900)\/+/, "$11200/");
			if (newsrc !== src)
				return {
					url: newsrc,
					problems: {
						possibly_upscaled: true
					}
				};
		}

		if (domain_nowww === "imgprime.com") {
			return src.replace(/\/uploads\/+small\/+/, "/uploads/big/");
		}

		if (domain === "dam-p-dfi.pqcloud.eu") {
			// https://dam-p-dfi.pqcloud.eu/preview/8hQz8t4nqoeB7zOFb8BUXK/previews/maxWidth_800_maxHeight_800.jpg/*/8hQz8t4nqoeB7zOFb8BUXK_micr.jpg?authcred=...
			// https://dam-p-dfi.pqcloud.eu/preview/8hQz8t4nqoeB7zOFb8BUXK/previews/maxWidth_800_maxHeight_800.jpg?authcred=...
			//   https://dam-p-dfi.pqcloud.eu/preview/8hQz8t4nqoeB7zOFb8BUXK/previews/maxWidth_999999.jpg?authcred=... -- 1984x2835
			return {
				url: src.replace(/(\/preview\/+[^/]+\/+previews\/+)[^/]*(\.jpg)(\/.*?)?([?#].*)?$/, "$1maxWidth_999999$2$3$4"),
				head_wrong_contentlength: true
			};
		}

		if (domain === "cdn.sonyselect.com.cn") {
			// thanks to nimuxoha on github: https://github.com/qsniyg/maxurl/issues/774
			// https://hi-resmusic.sonyselect.kuke.com/page/album.html?id=1052
			// http://cdn.sonyselect.com.cn/Hi-Res/flacs_20170628/Covers/a-lin_512.jpg
			//   http://cdn.sonyselect.com.cn/Hi-Res/flacs_20170628/Covers/a-lin.jpg -- 3000x3000 (not upscaled, top-left corner is clear)
			// https://hi-resmusic.sonyselect.kuke.com/page/album.html?id=565
			// http://cdn.sonyselect.com.cn/Hi-Res/flacs_20160920/Covers/mh_512.jpg
			//   http://cdn.sonyselect.com.cn/Hi-Res/flacs_20160920/Covers/mh.jpg -- 4725x4725
			// doesn't work for all:
			// https://hi-resmusic.sonyselect.kuke.com/page/album.html?id=252
			// http://cdn.sonyselect.com.cn/Hi-Res/flacs_20160518/Covers/cd_512.jpg
			//   http://cdn.sonyselect.com.cn/Hi-Res/flacs_20160518/Covers/cd.jpg -- 404
			// other:
			// https://hi-resmusic.sonyselect.kuke.com/page/album.html?id=29
			// http://cdn.sonyselect.com.cn/Hi-Res/flacs_20150115/covers/7432435_2007-mlib_1500x1500_300dpi_RGB_100Q.jpg
			return src.replace(/(\/covers\/+[^/]+)_512(\.[^/.]+)(?:[?#].*)?$/i, "$1$2");
		}

		if (host_domain_nowww === "asiantolick.com" && options.element) {
			if (options.element.tagName === "IMG" && /\/img\/+loading[0-9]*\./.test(src) && options.element.hasAttribute("data-src")) {
				return options.element.getAttribute("data-src");
			}
		}

		if (domain_nowww === "asiantolick.com") {
			// https://asiantolick.com/img/loading4.png
			if (/\/img\/+loading[0-9]*\.png(?:[?#].*)?$/.test(src))
				return {
					url: src,
					bad: "mask"
				};

			// https://asiantolick.com/down/3_100/thumb/7_9223372036854775807.jpg
			//   https://asiantolick.com/down/3_100/7_9223372036854775807.jpg
			newsrc = src.replace(/(\/down\/+[^/]+\/+)thumb\/+/, "$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "static.kino.de") {
			// https://static.kino.de/wp-content/uploads/2016/05/Godzilla-vs-Kong-Poster-2021-rcm160x226u.jpg
			//   https://static.kino.de/wp-content/uploads/2016/05/Godzilla-vs-Kong-Poster-2021.jpg
			// https://static.kino.de/wp-content/gallery/godzilla-vs-kong-2021/godzilla-vs-kong-1-rct415x260u.jpg
			//   https://static.kino.de/wp-content/gallery/godzilla-vs-kong-2021/godzilla-vs-kong-1.jpg
			// https://static.kino.de/wp-content/gallery/godzilla-vs-kong-2021/godzilla-vs-kong-1-rcm950x0.jpg
			//   https://static.kino.de/wp-content/gallery/godzilla-vs-kong-2021/godzilla-vs-kong-1.jpg
			return src.replace(/(\/wp-content\/+(?:uploads|gallery)\/+.*)-rc[mt][0-9]+x[0-9]+u?\./, "$1.");
		}

		if (domain === "ec56229aec51f1baff1d-185c3068e22352c56024573e929788ff.ssl.cf1.rackcdn.com") {
			// https://ec56229aec51f1baff1d-185c3068e22352c56024573e929788ff.ssl.cf1.rackcdn.com/attachments/small/1/5/4/008307154.jpg
			//   https://ec56229aec51f1baff1d-185c3068e22352c56024573e929788ff.ssl.cf1.rackcdn.com/attachments/medium/1/5/4/008307154.jpg
			//   https://ec56229aec51f1baff1d-185c3068e22352c56024573e929788ff.ssl.cf1.rackcdn.com/attachments/large/1/5/4/008307154.jpg -- 506x800
			//   https://ec56229aec51f1baff1d-185c3068e22352c56024573e929788ff.ssl.cf1.rackcdn.com/attachments/original/1/5/4/008307154.jpg -- 551x871
			return src.replace(/\/attachments\/+(?:small|medium|large)\/+/, "/attachments/original/");
		}

		if (domain === "artworks.thetvdb.com") {
			// https://artworks.thetvdb.com/banners/v4/series/366527/posters/609add211c828_t.jpg
			//   https://artworks.thetvdb.com/banners/v4/series/366527/posters/609add211c828.jpg
			return src.replace(/(\/[^/?#._]+)_t(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if ((host_domain_nowww === "serienfans.org" ||
			host_domain_nowww === "filmfans.org") && options.element) {
			if (options.element.tagName === "I" && !src && /^data:image\/+svg\+xml;/.test(origsrc)) {
				return {
					url: origsrc,
					bad: "mask"
				};
			}
		}

		if (domain_nowww === "serienfans.org" ||
			// https://filmfans.org/media/510945118029/155/233
			//   https://filmfans.org/media/510945118029
			domain_nowww === "filmfans.org") {
			// https://serienfans.org/media/2411684260560/155/233
			//   https://serienfans.org/media/2411684260560
			return src.replace(/(\/media\/+[0-9]+)\/+[0-9]+\/+[0-9]+(?:[?#].*)?$/, "$1");
		}

		if (domain === "cdn.ok.de") {
			// https://cdn.ok.de/cdn/ff/3J4jNBTZ8jJxPl84e2RoWEdMFZP89qFS6Am9gsp-VMM/1622821216/public/styles/news_xl/public/news/2021-06/210604-99-865849-v2-s2048.jpeg?itok=qz7v0sX3
			//   https://cdn.ok.de/sites/default/files/news/2021-06/210604-99-865849-v2-s2048.jpeg
			return src.replace(/\/cdn\/+[^/]+\/+[^/]+\/+[0-9]{5,}\/+public\/+/, "/sites/default/files/");
		}

		if (domain_nowww === "crossfire.nu") {
			// https://www.crossfire.nu/_cache/media/users/33w47-c1696f872a1455f47c55c8e7d43f6495_180x240.jpg
			//   https://www.crossfire.nu/media/users/33w47-c1696f872a1455f47c55c8e7d43f6495.jpg
			return src.replace(/\/_cache\/+(media\/+.*)_[0-9]+x[0-9]+\./, "/$1.");
		}

		if (domain_nowww === "austrianfilms.com") {
			// http://www.austrianfilms.com/jart/pub-prc/img.jart?base=/prj3/afc-new&img=/images/img-db/1481033163103.jpg&mode=version&v=FilmDetaill&rnd=0.7495274706743658 -- automatically redirects to /cache/
			if (/\/jart\/+pub-prc\/+img\.jart\?/.test(src)) {
				newsrc = keep_queries(src, ["base", "img"]);
				if (newsrc !== src)
					return newsrc;

				var queries = get_queries(src);
				if (queries.img && queries.base) {
					return urljoin(urljoin("https://www.austrianfilms.com/jart/", queries.base), queries.img);
				}
			}
		}

		if (domain_nowww === "tagesspiegel.de" ||
			// thanks to roi:
			// https://www.handelsblatt.com/images/riesenaquarium/28873036/2-format2020.jpg
			//   https://www.handelsblatt.com/images/riesenaquarium/28873036/2-formatOriginal.jpg
			domain_nowww === "handelsblatt.com") {
			// https://www.tagesspiegel.de/images/corona-auf-diese-punkte-sollten-sie-beim-test-anbieter-achten/27258606/1-format3002.jpg
			//   https://www.tagesspiegel.de/images/corona-auf-diese-punkte-sollten-sie-beim-test-anbieter-achten/27258606/1-formatOriginal.jpg
			return src.replace(/-format[a-zA-Z0-9]+\./, "-formatOriginal.");
		}

		if (domain_nowww === "hello-online.org") {
			// http://www.hello-online.org/res/picboardimg/alt2/202106/img20210606151324s.jpg
			//   http://www.hello-online.org/res/picboardimg/202106/img20210606151324.jpg
			return src.replace(/(\/picboardimg\/+)alt2\/+([0-9]{6}\/+img[0-9]+)s\./, "$1$2.");
		}

		if (domain === "exlibris.azureedge.net") {
			// https://exlibris.azureedge.net/covers/9783/4424/9266/4/9783442492664s.jpg -- 68x104
			//   https://exlibris.azureedge.net/covers/9783/4424/9266/4/9783442492664m.jpg -- 120x183
			//   https://exlibris.azureedge.net/covers/9783/4424/9266/4/9783442492664l.jpg -- 160x244
			//   https://exlibris.azureedge.net/covers/9783/4424/9266/4/9783442492664xl.jpg -- 260x397
			//   https://exlibris.azureedge.net/covers/9783/4424/9266/4/9783442492664xxl.jpg -- 800x1221
			// other:
			// https://exlibris.azureedge.net/cms/7279/Portrait%20Blanca%20Imboden.jpg -- 7360x4912
			// https://exlibris.azureedge.net/cms/4896/Bild_3AUF30.jpg -- 2238x2082
			// https://exlibris.azureedge.net/cms/5092/11+12.jpg -- 2480x1754
			return src.replace(/(\/covers\/+.*\/[0-9]{5,})(?:x?l|[ms])\./, "$1xxl.");
		}

		if (domain === "c.imgz.jp") {
			// thanks to nimbuz on discord:
			// https://zozo.jp/shop/zozomarket/goods/54947341/?did=91253776&rid=1523
			// https://c.imgz.jp/341/55947341/55947341b_b_68_35.jpg
			//   https://c.imgz.jp/341/55947341/55947341b_b_68_500.jpg
			//   https://o.imgz.jp/341/55947341/55947341b_b_68.jpg
			newsrc = src.replace(/_[1-4]?[0-9]{2}(\.[^/.]+)(?:[?#].*)?$/, "_500$1");
			if (newsrc !== src)
				return newsrc;

			return src.replace(/:\/\/[^/]+\/+([0-9]+\/+[0-9]+\/+[^/]+)_[0-9]+(\.[^/.]+)(?:[?#].*)?$/, "://o.imgz.jp/$1$2");
		}

		if (domain === "cdn.wimg.jp") {
			// https://cdn.wimg.jp/coordinate/x3s5ee/20210519013200235/20210519013200235_125.jpg
			//   https://cdn.wimg.jp/coordinate/x3s5ee/20210519013200235/20210519013200235_276.jpg
			//   https://cdn.wimg.jp/coordinate/x3s5ee/20210519013200235/20210519013200235_500.jpg
			//   https://cdn.wimg.jp/coordinate/x3s5ee/20210519013200235/20210519013200235_1000.jpg -- 1000x1334
			newsrc = src.replace(/(:\/\/[^/]+\/+coordinate\/+[^/]+\/+[0-9]{5,}\/+[0-9]{5,})_[0-9]{2,3}\./, "$1_1000.");
			if (newsrc !== src)
				return newsrc;

			// https://cdn.wimg.jp/coordinate/x3s5ee/20210519013200235/20210519013200235_1000.jpg
			//   https://cdn.wimg.jp/o/coordinate/x3s5ee/20210519013200235/20210519013200235.jpg -- 1500x2000
			// other:
			// https://cdn.wimg.jp/o/coordinate/4xef5t/20210325191554561/20210325191554561.jpg -- 1500x2000, upscaled
			newsrc = src.replace(/(:\/\/[^/]+\/+)(coordinate\/+.*\/[0-9]{5,})_[0-9]+\./, "$1o/$2.");
			if (newsrc !== src)
				return {
					url: newsrc,
					problems: {
						possibly_upscaled: true
					}
				};
		}

		if (domain === "evelyn.tokyo.jp") {
			// thanks to nimbuz on discord
			// https://evelyn.tokyo.jp/photo/21SS/ANE-095/s-ANE-095_92-1.jpg
			//   https://evelyn.tokyo.jp/photo/21SS/ANE-095/z-ANE-095_92-1.jpg
			return src.replace(/(\/photo\/.*\/)s-([^/]+)(?:[?#].*)?$/, "$1z-$2");
		}

		if (domain === "itemimg-rcw.runway-webstore.net") {
			// thanks to nimbuz on discord:
			// https://runway-webstore.com/ap/item/i/m/0021304001?aid3=md_210521_sayumi_01_list
			// https://itemimg-rcw.runway-webstore.net/itemimg/MK000/A0MK0000APWQ/01_000_RCW-750.jpg
			//   https://itemimg-rcw.runway-webstore.net/itemimg/MK000/A0MK0000APWQ/01_000_RCW.jpg -- 1500x2000
			return src.replace(/(\/itemimg\/.*)-[0-9]+(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "i.stpost.com") {
			// thanks to MinuteAd8502 on github for reporting: https://github.com/qsniyg/maxurl/issues/786
			// https://www.sierra.com/
			// https://i.stpost.com/dakine-flow-snug-fit-surf-shirt-upf-50-plus--short-sleeve-for-women~a~36gvv_2~1500.1.jpg
			//   https://i.stpost.com/dakine-flow-snug-fit-surf-shirt-upf-50-plus--short-sleeve-for-women~a~36gvv_2~9999.jpg -- 1313x1313
			//   https://i.stpost.com/alt/36g/36gvv_2.jpg -- 1313x1313
			// https://i.stpost.com/dakine-flow-snug-fit-surf-shirt-upf-50-plus--short-sleeve-for-women-in-black~p~36gvv_02~460.1490.jpg
			//   https://i.stpost.com/dakine-flow-snug-fit-surf-shirt-upf-50-plus--short-sleeve-for-women-in-black~p~36gvv_02~1500.1490.jpg -- 1500x1500 different image, likely a cache error (see issue)
			//   https://i.stpost.com/dakine-flow-snug-fit-surf-shirt-upf-50-plus--short-sleeve-for-women-in-black~p~36gvv_02~1500.1.jpg -- 1388x1388
			//   https://i.stpost.com/sku/36g/36gvv_02.jpg -- 1388x1388
			// https://i.stpost.com/product~p~1803G_01~1500.1.jpg
			//   https://i.stpost.com/sku/180/1803G_01.jpg
			// https://i.stpost.com/product~p~92398_70~1500~10.1.jpg -- last is quality
			//   https://i.stpost.com/sku/923/92398_70.jpg

			newsrc = src.replace(/(:\/\/[^/]+\/+[^/.?#]*~[a-z]~[A-Za-z0-9]+_[0-9]+)~[0-9]+(?:~[0-9]+)?\.(?:[0-9]+\.)?/, "$1~9999.");
			if (newsrc !== src)
				return newsrc;

			match = src.match(/:\/\/[^/]+\/+[^/.?#]*~([ap])~(([A-Za-z0-9]{3})[A-Za-z0-9]+_[0-9]+)~[0-9]+\.([a-z]+)(?:[?#].*)?$/);
			if (match) {
				var folders = {
					a: "alt",
					p: "sku"
				};

				return "https://i.stpost.com/" + folders[match[1]] + "/" + match[3] + "/" + match[2] + "." + match[4]; //.ashx?
			}
		}

		if (domain === "static.displate.com") {
			// thanks to snec on discord for reporting:
			// https://displate.com/displate/4063761
			// https://static.displate.com/857x1200/displate/2020-11-23/10c0471ffa9b3112305222d285b5ec39_af34f252fc8440f341e4b84b0b00931f.jpg
			//   https://www.displate.com/images/displate/2020-11-23/10c0471ffa9b3112305222d285b5ec39_af34f252fc8440f341e4b84b0b00931f.jpg -- 1690x2366
			// all images seem to be locked to 1690x2366
			// thanks to snec on discord for discovering:
			// https://static.displate.com/avatars/2019-07-30/29a5b18dcdfe53c4dd7d079c9ecc29fa.jpg
			//   https://www.displate.com/avatars/2019-07-30/29a5b18dcdfe53c4dd7d079c9ecc29fa.jpg -- not images/avatars
			// https://static.displate.com/covers/2020-11-23/7501309da43eb1d43a99f07cc40ee4cd.jpg
			//   https://www.displate.com/covers/2020-11-23/7501309da43eb1d43a99f07cc40ee4cd.jpg
			// other:
			// https://09516ztsjd.execute-api.eu-west-1.amazonaws.com/prod/PROD-ImageResize?key=asdf/displate/2020-11-23/10c0471ffa9b3112305222d285b5ec39_af34f252fc8440f341e4b84b0b00931f.jpg
			// https://static.displate.com/1200x1200/limited/2021-04-07/48fc515e4a665088f211e3e2be2cdd02_1bcf52a17f69fe6dcd9e9063f6af2f87.jpg
			//   https://www.displate.com/images/limited/2021-04-07/48fc515e4a665088f211e3e2be2cdd02_1bcf52a17f69fe6dcd9e9063f6af2f87.jpg -- 404
			match = src.match(/^[a-z]+:\/\/[^/]+\/+(?:[0-9]+x[0-9]+\/+)?(avatars|covers|displate)(\/+[0-9]{4}(?:-[0-9]{2}){2}\/+.*)/);
			if (match) {
				let folders = {
					avatars: "avatars",
					covers: "covers",
					displate: "images/displate"
				};

				return "https://www.displate.com/" + folders[match[1]] + match[2];
			}
		}

		if (domain_nosub === "namshicdn.com") {
			// thanks to MinuteAd8502 on github: https://github.com/qsniyg/maxurl/issues/793
			// https://pa.namshicdn.com/product/A4/01068W/1-cart.jpg -- 75x109
			//   https://pa.namshicdn.com/product/A4/01068W/1-mobile-web-cart.jpg -- 76x110
			//   https://pa.namshicdn.com/product/A4/01068W/1-catalog.jpg -- 176x255
			//   https://pa.namshicdn.com/product/A4/01068W/1-desktop-web-catalog.jpg -- 255x368
			//   https://pa.namshicdn.com/product/A4/01068W/1-product.jpg -- 277x400
			//   https://pa.namshicdn.com/product/A4/01068W/1-mobile-web-catalog.jpg -- 309x440
			//   https://pa.namshicdn.com/product/A4/01068W/1-web-desktop-product.jpg -- 416x600
			//   https://pa.namshicdn.com/product/A4/01068W/1-zoom-mobile.jpg -- 640x924
			//   https://pa.namshicdn.com/product/A4/01068W/1-mobile-web-zoom.jpg -- 762x1100
			//   https://pa.namshicdn.com/product/A4/01068W/1-zoom.jpg -- 762x1100
			//   https://pa.namshicdn.com/product/A4/01068W/1-zoom-desktop.jpg -- 1220x1760
			//   https://a.namshicdn.com/product/A4/01068W/1.jpg -- 1524x2200, forces download
			//   https://b.namshicdn.com/product/A4/01068W/1.jpg -- same
			// https://pa.namshicdn.com/product/54/6203/v1/1-zoom.jpg
			//   https://pa.namshicdn.com/product/54/6203/v1/1-zoom-desktop.jpg
			// https://b.namshicdn.com/product/62/468/2-zoom.jpg
			//   https://b.namshicdn.com/product/62/468/2.jpg -- 1524x2200, upscaled
			//   https://a.namshicdn.com/product/62/468/2.jpg -- same
			// other:
			// https://a.namshicdn.com/cms/large/women/blog/20190710/module_01.jpg
			// https://a.namshicdn.com/cms/large/blog/20210418/module_01_en.jpg
			if (/^p[a-z]+\./.test(domain)) {
				newsrc = src.replace(/(\/product\/+[^/]+\/+[^/]+\/+(?:v[0-9]+\/+)?[0-9]+)-(?:(?:(?:desktop|mobile)-web-|web-desktop-)?(?:cart|catalog|product|zoom)|zoom-mobile)\./, "$1-zoom-desktop.");
				if (newsrc !== src)
					return newsrc;
			}

			return src.replace(/^[a-z]+:\/\/p?([a-z]+\.[^/]+\/+product\/+[^/]+\/+[^/]+\/+)(?:v[0-9]+\/+)?([0-9]+)-[^/]+\./, "https://$1$2.");
		}

		if (domain_nowww === "theedge-sports.com") {
			// thanks to MinuteAd8502 on github: https://github.com/qsniyg/maxurl/issues/794
			// https://www.theedge-sports.com/images/adidas-response-longsleeve-tee-womens-shock-pink-p15811-95561_related.jpg -- 254x254
			//   https://www.theedge-sports.com/images/adidas-response-longsleeve-tee-womens-shock-pink-p15811-95561_medium.jpg -- 665x665
			//   https://www.theedge-sports.com/images/adidas-response-longsleeve-tee-womens-shock-pink-p15811-95561_image.jpg -- 1000x1000
			//   https://www.theedge-sports.com/images/adidas-response-longsleeve-tee-womens-shock-pink-p15811-95561_zoom.jpg -- 2000x2000
			return src.replace(/(\/images\/+[^/]+)_(?:related|medium|image)\./, "$1_zoom.");
		}

		if (domain === "cdn.dsmcdn.com" ||
			// https://img-majestic-live.mncdn.com/mnresize/400/400/Content/Images/Originals/0035333_0.jpeg
			//   https://img-majestic-live.mncdn.com/Content/Images/Originals/0035333_0.jpeg
			domain === "img-majestic-live.mncdn.com" ||
			// https://img-incommerce-yargici.mncdn.com/mnresize/400/-/Content/Images/Thumbs/22167314_yesil-triko-bluz-23yktr2033x089.jpeg
			//   https://img-incommerce-yargici.mncdn.com/Content/Images/Thumbs/22167314_yesil-triko-bluz-23yktr2033x089.jpeg
			domain === "img-incommerce-yargici.mncdn.com" ||
			// https://img-dagi.mncdn.com/mnpadding/466/699/FFFFFF/media/catalog/product/c/7/c7d6aaa7cb13138f40dc4bb036f36eb99cfecf8f28028e585b80b6913b37a059.jpeg
			//   https://img-dagi.mncdn.com/media/catalog/product/c/7/c7d6aaa7cb13138f40dc4bb036f36eb99cfecf8f28028e585b80b6913b37a059.jpeg
			domain === "img-dagi.mncdn.com" ||
			// https://img-lcwaikiki.mncdn.com/mnresize/480/-/pim/productimages/20231/6423857/v1/l_20231-s3fp63z4-h9u_a.jpg
			//   https://img-lcwaikiki.mncdn.com/pim/productimages/20231/6423857/v1/l_20231-s3fp63z4-h9u_a.jpg
			domain === "img-lcwaikiki.mncdn.com" ||
			// https://img-swarovski.mncdn.com/Content/Images/Thumbs/0048180_octea-nova-saat-m5650033112-6560.jpeg
			//   https://img-swarovski.mncdn.com/Content/Images/Originals/0048180_0.jpeg
			// https://img-yatas.mncdn.com/Content/Images/Thumbs/0072165_octo-bej-pike-bej-42346.jpeg
			//   https://img-yatas.mncdn.com/Content/Images/Originals/0072165_0.jpeg
			// https://cdn-linens.mncdn.com/Content/Images/Thumbs/0056242.jpeg
			//   https://cdn-linens.mncdn.com/Content/Images/Originals/0056242_0.jpeg
			(domain_nosub === "mncdn.com" && /^(?:img|cdn)-/.test(domain))) {
			// thanks to MinuteAd8502 on github: https://github.com/qsniyg/maxurl/issues/795
			// https://cdn.dsmcdn.com/mnresize/415/622/ty89/product/media/images/20210403/07/f1e9d4b3/15462282/1/1_org_zoom.jpg
			//   https://cdn.dsmcdn.com/ty89/product/media/images/20210403/07/f1e9d4b3/15462282/1/1_org_zoom.jpg
			// other:
			// https://cdn.dsmcdn.com/ty48/product/media/html-images/20210107/11/4328524/82ce0f54-a0ff-42ec-83f5-e95a66a479a0.jpg -- 2000x2000, upscaled
			// https://cdn.dsmcdn.com/ty18/product/other/87a8cc62-d9fb-4e89-be0d-d13b26881922.png -- 3583x2016
			// https://st-adidas-isr.mncdn.com/content/images/thumbs/0006625_u_path-run-shoes_eg5332_side-medial-center-view.jpeg
			// thanks to anonymous for reporting:
			// https://resizer-ketebe.mncdn.com/?w=490&h=0&url=L2tldGViZS9maWxlLzVjN2I0NTEzLTk1NTUtNGJiNS04NmQyLTNhNjg5NDVkMTYzZC5qcGc=&appId=1
			//   /ketebe/file/5c7b4513-9555-4bb5-86d2-3a68945d163d.jpg
			// https://resizer-ketebe.mncdn.com/?w=490&h=0&url=L2tldGViZS9maWxlLzhlMjhkOTE0LTY2ZDgtNGQ1ZS1hMTQzLTRmZjE1NTM1ZWJlYS5qcGc=&appId=1
			//   /ketebe/file/8e28d914-66d8-4d5e-a143-4ff15535ebea.jpg
			newsrc = src
				.replace(/\/mnresize\/+[-0-9]+\/+[-0-9]+\/+/, "/")
				.replace(/\/mnpadding\/+[-0-9]+\/+[-0-9]+\/+[0-9A-F]{6}\/+/, "/");
			if (newsrc !== src)
				return newsrc;

			// https://img-incommerce-yargici.mncdn.com/Content/Images/Thumbs/22167314_yesil-triko-bluz-23yktr2033x089.jpeg -- 1650x1920
			//   https://img-incommerce-yargici.mncdn.com/Content/Images/Originals/22167314_0.jpeg -- 1650x1920
			// https://img-incommerce-yargici.mncdn.com/Content/Images/Thumbs/22164636.jpeg
			//   https://img-incommerce-yargici.mncdn.com/Content/Images/Originals/22164636_0.jpeg
			newsrc = src.replace(/\/Content\/+Images\/+Thumbs\/+([0-9]+)(?:_[^/.?#]+)?(\.[^/.]+)(?:[?#].*)?$/, "/Content/Images/Originals/$1_0$2");
			if (newsrc !== src)
				return newsrc;

			// https://cdn.dsmcdn.com/ty89/product/media/images/20210403/07/f1e9d4b3/15462282/1/1_org.jpg
			//   https://cdn.dsmcdn.com/ty89/product/media/images/20210403/07/f1e9d4b3/15462282/1/1_org_zoom.jpg -- 1200x1800
			return src.replace(/(\/product\/+media\/+images\/+.*\/[0-9]+)_org\./, "$1_org_zoom.");
		}

		if (domain_nowww === "bodytalk.com") {
			// thanks to MinuteAd8502 on github for reporting: https://github.com/qsniyg/maxurl/issues/796
			// lightbox: https://www.bodytalk.com/en/media/workout-photos/#images-1
			// https://www.bodytalk.com/uploads/resources/121434/photos-thumb.jpg -- 100x75
			//   https://www.bodytalk.com/uploads/resources/121434/photos-enlarge.jpg -- 720x540
			//   https://www.bodytalk.com/uploads/resources/121434/photos-medianormal.jpg -- 600x750
			//   https://www.bodytalk.com/uploads/resources/121434/photos-normal.jpg -- 920x900
			//   https://www.bodytalk.com/uploads/resources/121434/photos-huge.jpg -- 404
			//   https://www.bodytalk.com/uploads/resources/121434/photos-mediafancybox.jpg -- 1600x2000
			// product:
			// https://www.bodytalk.com/uploads/resources/119687/gynaikeio-psilomeso-kolan-my-tie-list.jpg -- 540x810, cropped to content
			//   https://www.bodytalk.com/uploads/resources/119687/gynaikeio-psilomeso-kolan-my-tie-normal.jpg -- 980x980
			//   https://www.bodytalk.com/uploads/resources/119687/gynaikeio-psilomeso-kolan-my-tie-huge.jpg -- 1300x1300
			// product ids don't tie to resource ids:
			// https://www.bodytalk.com/el/get-the-look/gynaika/fantabulous-collection_517015/
			//   https://www.bodytalk.com/uploads/resources/119544/gynaikeia-amaniki-zaketa-fantabulous-list.jpg
			//   https://www.bodytalk.com/uploads/resources/119544/gynaikeia-amaniki-zaketa-fantabulous-enlarge.jpg -- 1300x1300, has padding
			//   https://www.bodytalk.com/uploads/resources/119544/gynaikeia-amaniki-zaketa-fantabulous-huge.jpg -- same
			regex = /(\/uploads\/+resources\/+[0-9]+\/+[^/.?#]+)-(?:thumb|medianormal|list|normal|huge|enlarge)\./;
			if (regex.test(src)) {
				return [
					src.replace(regex, "$1-mediafancybox."),
					src.replace(regex, "$1-huge."),
					src.replace(regex, "$1-normal."),
					src.replace(regex, "$1-enlarge.")
				];
			}
		}

		// custom magento?
		if (domain_nowww === "seprun.com") {
			// thanks to MinuteAd8502 on github: https://github.com/qsniyg/maxurl/issues/801
			// https://www.seprun.com/media/x70/Nike_Lifestyle_Shoes/Nike_Cortez/Nike_Cortez_Basic_Nylon_Prem_Long_Beach_Blue_White_Royal_Gold_Metallic_902804-400_P1.jpg
			//   https://www.seprun.com/uploads/Nike_Lifestyle_Shoes/Nike_Cortez/Nike_Cortez_Basic_Nylon_Prem_Long_Beach_Blue_White_Royal_Gold_Metallic_902804-400_P1.jpg
			return src.replace(/\/media\/+[0-9]*x[0-9]+\/+/, "/uploads/");
		}

		if (domain === "df0a04043ae3b0be60ce-0769ebb99367e103e6cc409064fb3339.ssl.cf2.rackcdn.com") {
			// thanks to MinuteAd8502 on github: https://github.com/qsniyg/maxurl/issues/802
			// https://www.sportitude.com.au/p/nike-hyperfuel-bpa-free-sport-water-bottle-946ml-clear-black-hyper-magenta
			// https://df0a04043ae3b0be60ce-0769ebb99367e103e6cc409064fb3339.ssl.cf2.rackcdn.com/21197a38-5103-40fa-9f58-1dfc6e320aea.jpg
			//   https://df0a04043ae3b0be60ce-0769ebb99367e103e6cc409064fb3339.ssl.cf2.rackcdn.com/21197a38-5103-40fa-9f58-1dfc6e320aea__L.jpg -- 719x719
			// https://df0a04043ae3b0be60ce-0769ebb99367e103e6cc409064fb3339.ssl.cf2.rackcdn.com/bdc4b344-82aa-48a2-b49d-6eac2a5671c1.jpg
			//   https://df0a04043ae3b0be60ce-0769ebb99367e103e6cc409064fb3339.ssl.cf2.rackcdn.com/bdc4b344-82aa-48a2-b49d-6eac2a5671c1__L.jpg -- 1500x1500, upscaled
			// https://df0a04043ae3b0be60ce-0769ebb99367e103e6cc409064fb3339.ssl.cf2.rackcdn.com/429c795b-24ed-4c19-b49a-fbb4a2d4c920__S.jpg
			//   https://df0a04043ae3b0be60ce-0769ebb99367e103e6cc409064fb3339.ssl.cf2.rackcdn.com/429c795b-24ed-4c19-b49a-fbb4a2d4c920__L.jpg
			return src.replace(/(:\/\/[^/]+\/+[-0-9a-f]{10,})(?:__S)?\./, "$1__L.");
		}

		if (domain === "fdn.gsmarena.com") {
			// thanks to fedesk on discord for reporting:
			// https://fdn.gsmarena.com/imgroot/reviews/21/samsung-galaxy-a32-5g/-728x314/gsmarena_002.jpg
			//   https://fdn.gsmarena.com/imgroot/reviews/21/samsung-galaxy-a32-5g/gsmarena_002.jpg
			// https://fdn.gsmarena.com/imgroot/reviews/21/samsung-galaxy-a72/sshots/-216x216m/gsmarena_017.jpg
			//   https://fdn.gsmarena.com/imgroot/reviews/21/samsung-galaxy-a72/sshots/gsmarena_017.jpg
			// https://fdn.gsmarena.com/imgroot/reviews/21/samsung-galaxy-a32-5g/lifestyle/-1200w5/gsmarena_017.jpg
			//   https://fdn.gsmarena.com/imgroot/reviews/21/samsung-galaxy-a32-5g/lifestyle/gsmarena_017.jpg
			// thanks to anonymous for reporting:
			// https://fdn.gsmarena.com/imgroot/news/23/07/one-ui-6-beta-launch-date/inline/-1200/gsmarena_001.jpg
			//   https://fdn.gsmarena.com/imgroot/news/23/07/one-ui-6-beta-launch-date/inline/gsmarena_001.jpg
			return src.replace(/\/-[0-9]+(?:x[0-9]+m?|w[0-9]+)?(\/+[^/]+)(?:[?#].*)?$/, "$1");
		}

		if (domain === "cvxf2z6hud.user-space.cdn.idcfcloud.net") {
			// thanks to nimbuz on discord for reporting:
			// https://cvxf2z6hud.user-space.cdn.idcfcloud.net/book/753/0/14331_1620292865162/06A0000000000331290E.jpg?auto=webp&width=300
			return {
				url: src.replace(/\?.*/, ""),
				headers: {
					Referer: "https://yanmaga.jp"
				}
			};
		}

		if (domain === "dfocupmdlnlkc.cloudfront.net") {
			// thanks to sn3akyb3ar on github: https://github.com/qsniyg/maxurl/issues/818
			// https://kavyar.com/works/jihprmkkjk7w
			// https://dfocupmdlnlkc.cloudfront.net/original/974e2500-8f48-44d6-90a3-2ed20967771f_1200x1200.jpg
			//   https://dfocupmdlnlkc.cloudfront.net/original/974e2500-8f48-44d6-90a3-2ed20967771f_99999x99999.jpg -- 3832x5759
			// https://dfocupmdlnlkc.cloudfront.net/original/634e934c-7665-4892-903a-b394f51aab7e_1500x3000q75_jpg.webp
			//   https://dfocupmdlnlkc.cloudfront.net/original/634e934c-7665-4892-903a-b394f51aab7e_1500x3000q75.jpg
			//   https://dfocupmdlnlkc.cloudfront.net/original/634e934c-7665-4892-903a-b394f51aab7e_99999x99999.jpg
			return src
				.replace(/(\/original\/+[-0-9a-f]{10,})_[0-9]+x[0-9]+(?:q[0-9]+)?\./, "$1_99999x99999.")
				.replace(/_(jpg)\.webp(?:[?#].*)?$/, ".$1");
		}

		if (domain_nowww === "akcijeikatalozi.ba") {
			// thanks to MinuteAd8502 on github: https://github.com/qsniyg/maxurl/issues/820
			// https://www.akcijeikatalozi.ba/media/katalog/200/p/r/prodex-gorica-akcija-odlicne-kupovine-jun-6873-2021-06-16-2021-06-30.png
			//   https://www.akcijeikatalozi.ba/media/katalog/p/r/prodex-gorica-akcija-odlicne-kupovine-jun-6873-2021-06-16-2021-06-30.png
			// https://www.akcijeikatalozi.ba/media/strana/600/6873/6873-prodex-gorica-akcija-odlicne-kupovine-jun-page-00001-tM9E8.jpg
			//   https://www.akcijeikatalozi.ba/media/strana/6873/6873-prodex-gorica-akcija-odlicne-kupovine-jun-page-00001-tM9E8.jpg
			return src.replace(/(\/media\/+[^/]+\/+)[0-9]+\/+/, "$1");
		}

		if (domain === "static.pantaflix.com" ||
			amazon_container === "static.pantaflix.com") {
			// https://static.pantaflix.com/v2/width(256)-height(384)-crop(true)/p/pro/1277/a29f7e0cd31558b3fe6496ab71c76782.jpeg.webp
			//   https://s3-eu-west-1.amazonaws.com/static.pantaflix.com/v2/p/pro/1277/a29f7e0cd31558b3fe6496ab71c76782.jpeg.webp
			//   https://s3-eu-west-1.amazonaws.com/static.pantaflix.com/v2/p/pro/1277/a29f7e0cd31558b3fe6496ab71c76782.jpeg
			return src
				.replace(/\/v2\/+[^/]+\/+p\/+pro\//, "/v2/p/pro/")
				.replace(/\.jpeg\.webp(?:[?#].*)?$/, ".jpeg");
		}

		if (domain === "dam.nmhmedia.sk") {
			// https://dam.nmhmedia.sk/image/7419b77d-637c-4a66-9b99-228c3ee59032_phpfgipba.jpg/1024/0 -- upscaled
			//   https://dam.nmhmedia.sk/image/7419b77d-637c-4a66-9b99-228c3ee59032_phpfgipba.jpg/0
			return {
				url: src.replace(/(\/image\/+[^/]+\.[^/.]+)\/[0-9]+\/[0-9]+(?:[?#].*)?$/, "$1/0"),
				headers: {
					Referer: "https://magazin.pluska.sk/"
				}
			};
		}

		if (domain === "static.slickdealscdn.com") {
			// https://static.slickdealscdn.com/attachment/2/1/5/9/2/1/2/0/50x50/10128016.thumb
			//   https://static.slickdealscdn.com/attachment/2/1/5/9/2/1/2/0/10128016.attach
			return src.replace(/(\/attachment\/+(?:[0-9]+\/+)+)[0-9]+x[0-9]+\/+([0-9]+)\.thumb(?:[?#].*)?$/, "$1$2.attach");
		}

		if (domain_nowww === "cine.com") {
			// https://www.cine.com/peliculas5/124663/cartel/124663_cartel_200.jpg
			//   https://www.cine.com/peliculas5/124663/124663_0.jpg
			return src.replace(/(\/peliculas[0-9]*\/+[0-9]+\/+)cartel\/+([0-9]+)_cartel_[0-9]+\./, "$1$2_0.");
		}

		if (domain_nowww === "silhcdn.com") {
			// https://www.silhcdn.com/3/i/shapes/sm/0/6/d9160.jpg
			//   https://www.silhcdn.com/3/i/shapes/md/0/6/d9160.jpg
			//   https://www.silhcdn.com/3/i/shapes/lg/0/6/d9160.jpg
			return src.replace(/\/shapes\/+(?:sm|md)\/+/, "/shapes/lg/");
		}

		if (domain === "cdn.notonthehighstreet.com") {
			// https://cdn.notonthehighstreet.com/fs/7e/a6/145e-1153-4265-b3d3-dbe914b260ef/thumb_set-of-three-chinese-lanterns.jpg
			//   https://cdn.notonthehighstreet.com/fs/7e/a6/145e-1153-4265-b3d3-dbe914b260ef/preview_set-of-three-chinese-lanterns.jpg
			//   https://cdn.notonthehighstreet.com/fs/7e/a6/145e-1153-4265-b3d3-dbe914b260ef/normal_set-of-three-chinese-lanterns.jpg
			//   https://cdn.notonthehighstreet.com/fs/7e/a6/145e-1153-4265-b3d3-dbe914b260ef/original_set-of-three-chinese-lanterns.jpg
			return src.replace(/(\/fs\/.*\/)(?:preview|normal|thumb)_([^/]+)(?:[?#].*)?$/, "$1original_$2");
		}

		if (domain_nowww === "isubtitles.org") {
			// https://isubtitles.org/img/poster/1965/12/24/zatoichi-and-the-chess-expert.jpg;widh=200;height=300;crop=auto;format=webp
			//   https://isubtitles.org/img/poster/1965/12/24/zatoichi-and-the-chess-expert.jpg
			return src.replace(/(\/img\/+poster\/.*\.[^/.?#;]+)(?:[?#;].*)?$/, "$1");
		}

		if (domain === "i.natgeofe.com") {
			// thanks to ayunami2000 on github: https://github.com/qsniyg/maxurl/issues/830
			// https://i.natgeofe.com/k/a2a738a9-e019-4911-98e6-17f31c45ac88/milky-way-2.jpg?w=795&h=447.5
			//   https://i.natgeofe.com/k/a2a738a9-e019-4911-98e6-17f31c45ac88/milky-way-2.jpg
			// https://i.natgeofe.com/n/bfec083e-ac57-4c17-8af1-3e8b322df8e0/NGM%20Ballesta%20Underwater-1.jpg?w=1200
			//   https://i.natgeofe.com/n/bfec083e-ac57-4c17-8af1-3e8b322df8e0/NGM%20Ballesta%20Underwater-1.jpg
			newsrc = src.replace(/(:\/\/[^/]+\/+[a-z]\/+[-0-9a-f]{10,}\/+[^/?#]+)(?:[?#].*)?$/, "$1");
			if (newsrc !== src)
				return newsrc;

			// thanks to anonymous for reporting:
			// https://i.natgeofe.com/n/1c613e49-a7e5-4c9f-8417-74a40c1ee272/02-typhoid-mary_square.jpg
			//   https://i.natgeofe.com/n/1c613e49-a7e5-4c9f-8417-74a40c1ee272/02-typhoid-mary.jpg
			return src.replace(/(:\/\/[^/]+\/+[a-z]\/+[-0-9a-f]{10,}\/+[^/?#]+?)_square(\.[a-z]+)$/, "$1$2");
		}

		if (domain === "imgr.search.brave.com" ||
			// thanks to anonymous for reporting:
			// https://imgs.search.brave.com/[...]/rs:fit:500:0:0/g:ce/aHR0cHM6Ly90My5m/dGNkbi5uZXQvanBn/LzA1Lzk4Lzc5LzM2/LzM2MF9GXzU5ODc5/MzY4Nl9jWXZ4Tk15/VWJCRUFuTnZSTURP/Um8yQ2x4Y3d6eXJC/QS5qcGc
			//   https://t3.ftcdn.net/jpg/05/98/79/36/360_F_598793686_cYvxNMyUbBEAnNvRMDORo2ClxcwzyrBA.jpg
			domain === "imgs.search.brave.com" ||
			// thanks to anonymous for reporting:
			// https://meduza.io/impro/VoxfM8o2icttGT1B5ftz_P56JbJaXXN7KDTChuHBjy4/resizing_type:fit/width:980/height:0/enlarge:1/quality:80/aHR0cHM6Ly9tZWR1/emEuaW8vaW1hZ2Uv/YXR0YWNobWVudHMv/aW1hZ2VzLzAxMC82/OTUvOTMxL29yaWdp/bmFsLzVHbUVsVjI2/Ukt3MWI3R1dPRjRi/ekE.webp
			//   https://meduza.io/image/attachments/images/010/695/931/original/5GmElV26RKw1b7GWOF4bzA
			domain_nowww === "meduza.io") {
			// thanks to fedesk on discord for reporting
			// 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[^?#.]+)(?:[.?#].*)?$/);
			if (match) {
				var splitted = match[1].split("/");
				array_foreach(splitted, function(x, i) {
					splitted[i] = base64_decode_urlsafe(x);
				});

				return splitted.join("");
			}
		}

		if (domain === "image.youtv.de") {
			// https://image.youtv.de/tv-bilder/normal/thumb/2043776.jpg
			//   https://image.youtv.de/tv-bilder/normal/medium/2043776.jpg -- 640x426
			//   https://image.youtv.de/tv-bilder/normal/original/2043776.jpg -- 1280x853
			return src.replace(/(\/tv-bilder\/+normal\/+)[a-z]+\/+/, "$1original/");
		}

		if (domain === "ssl.ofdb.de") {
			// https://ssl.ofdb.de/thumbnail.php?cover=images%2Ffassung%2F259%2F259694_f.jpg&size=5
			//   https://ssl.ofdb.de/images/fassung/259/259694_f.jpg
			if (/\/thumbnail\.php\?/.test(src)) {
				var queries = get_queries(src, {decode: true});
				if (queries.cover)
					return "https://ssl.ofdb.de/" + queries.cover;
			}
		}

		if (domain === "cdn.cinematerial.com" ||
			// thanks to anonymous for reporting:
			// https://media-cache.cinematerial.com/p/297x/baxylkbs/ein-sonntagskind-das-manchmal-spinnt-polish-movie-poster.jpg?v=1456530022
			//   https://media-cache.cinematerial.com/p/500x/baxylkbs/ein-sonntagskind-das-manchmal-spinnt-polish-movie-poster.jpg?v=1456530022
			domain === "media-cache.cinematerial.com") {
			// https://cdn.cinematerial.com/p/297x/m5vu9del/druzya-druzey-ukrainian-movie-poster.jpg
			//   https://cdn.cinematerial.com/p/500x/m5vu9del/druzya-druzey-ukrainian-movie-poster.jpg
			// filename can be anything
			return src.replace(/\/p\/+(?:60|136|297)x\/+/, "/p/500x/");
		}

		if (domain === "oldies-cdn.freetls.fastly.net") {
			// https://oldies-cdn.freetls.fastly.net/i/boxart/w85/a-z/n/newl6929d.jpg?v=3
			//   https://oldies-cdn.freetls.fastly.net/i/boxart/original/a-z/n/newl6929d.jpg?v=3 -- 348x500
			// https://oldies-cdn.freetls.fastly.net/i/boxart/original/52/52/044006525228.jpg?v=3 -- 931x918
			// https://oldies-cdn.freetls.fastly.net/i/boxart/original/11/09/631595110999.jpg?v=3 -- 315x450
			return src.replace(/\/i\/+boxart\/+[wh][0-9]+\/+/, "/i/boxart/original/");
		}

		if (amazon_container === "talentsoup") {
			// https://s3.amazonaws.com/talentsoup/32327/323272937201972-express.jpg
			//   https://s3.amazonaws.com/talentsoup/32327/323272937201972-large.jpg
			//   https://s3.amazonaws.com/talentsoup/32327/323272937201972.jpg -- 766x1080
			// https://s3.amazonaws.com/talentsoup/32357/32357295220200.jpg -- 4912x7360
			return src.replace(/(\/[0-9]{5}\/+[0-9]{10,})-[a-z]+\./, "$1.");
		}

		if (domain === "img.neirong.plus") {
			// thanks to nimbuz on discord
			// https://nakanishikana.fensi.plus/page/blogs/541612238474052411
			// https://img.neirong.plus/960x540/o/5b/10/5b10df10dc0d11eb874c411417e9f524.jpg
			//   https://img.neirong.plus/o/5b/10/5b10df10dc0d11eb874c411417e9f524.jpg -- 2130x1198
			// https://img.neirong.plus/960x540/o/41/35/4135cc20d89a11eb8eeda3d39e4ca93d.jpg
			//   https://img.neirong.plus/o/41/35/4135cc20d89a11eb8eeda3d39e4ca93d.jpg -- 2160x1215
			return src.replace(/(:\/\/[^/]+\/+)[0-9]+x[0-9]+\/+o\/+/, "$1o/");
		}

		if (domain === "image.pmgstatic.com") {
			// https://www.csfd.cz/tvurce/138879-vladimir-zerebcov/galerie/
			// https://image.pmgstatic.com/cache/resized/w100h132crop/files/images/creator/photos/162/328/162328974_5e187e.jpg
			//   https://image.pmgstatic.com/files/images/creator/photos/162/328/162328974_5e187e.jpg
			return src.replace(/\/cache\/+resized\/+[^/]+\/+files\/+/, "/files/");
		}

		if (domain_nowww === "solvay.com") {
			// thanks to Liz on discord
			// https://www.solvay.com/sites/g/files/srpend221/files/styles/header/https/media.solvay.com/medias/domain1446/media1015/155098-a1pcjmkgm4.png?itok=7zuj3ADJ
			//   https://media.solvay.com/medias/domain1446/media1015/155098-a1pcjmkgm4.png
			return src.replace(/^[a-z]+:\/\/[^/]+\/+sites\/+[^/]+\/+files\/+[^/]+\/+files\/+styles\/+[^/]+\/+(https?)\/+(.*?)(?:[?#].*)?$/, "$1://$2");
		}

		if (domain === "i.legendas.tv") {
			// http://i.legendas.tv/sprite_1.png
			if (/:\/\/[^/]+\/+sprite_[0-9]+\.png(?:[?#].*)?$/.test(src))
				return {
					url: src,
					bad: "mask"
				};

			// http://i.legendas.tv/poster/214x317/legendas_tv_20210512121635.jpg
			//   http://i.legendas.tv/poster/legendas_tv_20210512121635.jpg
			return src.replace(/\/poster\/+[0-9]+x[0-9]+\/+/, "/poster/");
		}

		if (domain_nowww === "techrepublic.com") {
			// thanks to Liz on discord
			// https://www.techrepublic.com/a/hub/i/r/2013/09/25/92ccee33-ff41-441e-846f-0966efc880ab/resize/1200x/be099b4eeb019c9bc04480150483ff07/d_two_qt_file_exp_mkaelin.png
			//   https://www.techrepublic.com/a/hub/i/r/2013/09/25/92ccee33-ff41-441e-846f-0966efc880ab/be099b4eeb019c9bc04480150483ff07/d_two_qt_file_exp_mkaelin.png
			return src.replace(/(\/i\/+r\/+[0-9]{4}\/(?:[0-9]{2}\/+){2}[-0-9a-f]{10,}\/+)resize\/+[0-9]*x[0-9]*\/+/, "$1");
		}

		if (domain === "img.tennis-warehouse.com") {
			// thanks to MinuteAd8502 on github: https://github.com/qsniyg/maxurl/issues/841
			// https://img.tennis-warehouse.com/watermark/rs.php?path=AWG8SCS-1.jpg&nw=700
			//   https://img.tennis-warehouse.com/watermark/rs.php?path=AWG8SCS-1.jpg - 1067x800
			//   https://img.tennis-warehouse.com/new_big/AWG8SCS-1.jpg -- 1067x800
			if (/\/watermark\/+rs\.php\?/.test(src)) {
				newsrc = keep_queries(src, ["path"]);
				if (newsrc !== src)
					return newsrc;
			}

			// https://img.tennis-warehouse.com/cache/200/TWBPB-1.jpg
			//   https://img.tennis-warehouse.com/new_product/TWBPB-1.jpg -- different image
			//   https://img.tennis-warehouse.com/watermark/rs.php?path=TWBPB-1.jpg
			//   https://img.tennis-warehouse.com/new_big/TWBPB-1.jpg -- 1800x2400
			return src
				.replace(/\/watermark\/+rs\.php\?path=([^&]+)$/, "/new_big/$1")
				.replace(/\/cache\/+[0-9]+\/+/, "/watermark/rs.php?path=");
		}

		if (domain_nowww === "6mature9.com") {
			// http://6mature9.com/galleries/ftvm/2019/01/Y26DhqZ3/03_ftvml_69_szn.jpg
			//   http://6mature9.com/galleries/ftvm/2019/01/Y26DhqZ3/03.jpg
			return src.replace(/(\/galleries\/+[^/]+\/+[0-9]{4}\/+[0-9]{2}\/+[^/]+\/+[0-9]+)_[^/_.]+_69_sz[a-z]\./, "$1.");
		}

		if (domain === "web.xdcdn.net") {
			// thanks to KyuJuEX099 for reporting, and Liz for the rule
			// https://ro.com/ep6/
			// https://web.xdcdn.net/game/ro/imgs/ep6/p3/front/dzj@1x.png
			//   https://web.xdcdn.net/game/ro/imgs/ep6/p3/front/dzj@2x.png
			// https://web.xdcdn.net/game/ro/imgs/ep6/p3/card/dzj@1x.png
			//   https://web.xdcdn.net/game/ro/imgs/ep6/p3/card/dzj@2x.png
			// https://web.xdcdn.net/game/ro/imgs/ep6/p4/1/base@1x.png
			//   https://web.xdcdn.net/game/ro/imgs/ep6/p4/1/base@2x.png
			// https://web.xdcdn.net/game/ro/imgs/ep6/p1/d1@1x.png
			//   https://web.xdcdn.net/game/ro/imgs/ep6/p1/d1@2x.png?v=1551959463
			return src.replace(/(\/game\/+[^/]+\/+imgs\/+.*@)1x\./, "$12x.");
		}

		if (domain === "images.gids.tv") {
			// https://images.gids.tv/video-thumbnail.jpg?url=https%3A%2F%2Fimages.npo.nl%2Ftile%2F1280x720%2F1563535.jpg
			//   https://images.npo.nl/tile/1280x720/1563535.jpg
			// https://images.gids.tv/image?button=false&url=https%3A%2F%2Fimages.npo.nl%2Ftile%2F1280x720%2F1590332.jpg
			//   https://images.npo.nl/tile/1280x720/1590332.jpg
			newsrc = src.replace(/.*\/(?:video-thumbnail\.jpg|image)\?(?:.*&)?url=([^&]+)(?:&.*)?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "images.npo.nl") {
			// https://images.npo.nl/tile/1280x720/1563535.jpg
			//   https://images.npo.nl/tile/original/1563535.jpg -- 1920x1080
			// https://images.npo.nl/header/2560x1440/1373073.jpg -- 2560x1440, upscaled
			//   https://images.npo.nl/header/original/1373073.jpg -- 2000x1125
			return src.replace(/(\/(?:tile|header)\/+)[0-9]+x[0-9]+\/+/, "$1original/");
		}

		if (domain === "radio-images.npo.nl") {
			// cloudinary
			// https://radio-images.npo.nl/w_640,h_640,c_north/16890f1a-7efb-4acd-a0cc-0ef971c4ed00/bf706b21-c0fb-4cee-b4d0-3b565d330621.jpg
			//   https://radio-images.npo.nl/c_limit/16890f1a-7efb-4acd-a0cc-0ef971c4ed00/bf706b21-c0fb-4cee-b4d0-3b565d330621.jpg
			// https://radio-images.npo.nl/%7Bformat%7D/34e8df87-0f33-45c6-bd1a-f2528ff87626/e984a48f-975d-4b56-996b-9f2bbfaa970e.png
			//   https://radio-images.npo.nl/%7Bformat%7D/34e8df87-0f33-45c6-bd1a-f2528ff87626/e984a48f-975d-4b56-996b-9f2bbfaa970e.png
			return src.replace(/(:\/\/[^/]+\/+)[^/]+\/+([-0-9a-f]{20,})\/+/, "$1c_limit/$2/");
		}

		if (domain === "dmdlnu87i51n1.cloudfront.net") {
			// thumbor?
			// thanks to Liz on discord
			// https://dmdlnu87i51n1.cloudfront.net/v1/uk/ckrlpxghf000u3h5qjmabvoqt/0x0:2000x1333/960x960/4beirut_glass_project_display_case_before_explosion.jpg
			//   https://dmdlnu87i51n1.cloudfront.net/v1/uk/ckrlpxghf000u3h5qjmabvoqt/4beirut_glass_project_display_case_before_explosion.jpg
			return src.replace(/(\/v1\/+[^/]+\/+[^/]+\/+)[0-9]+x[0-9]+:[0-9]+x[0-9]+\/+[0-9]+x[0-9]+\/+/, "$1");
		}

		if (domain === "img.kitapyurdu.com") {
			// thanks to esdemirei on reddit: https://www.reddit.com/r/MaxImage/comments/o1w3qv/image_max_url_0193_is_released_8000_websites/h3lkd90/
			// https://img.kitapyurdu.com/v1/getImage/fn:11419468/wi:122/wh:62ddd10e9
			//   https://img.kitapyurdu.com/v1/getImage/fn:11419468/wh:62ddd10e9 -- 800x800
			//   https://img.kitapyurdu.com/v1/getImage/fn:11419468 -- watermarked
			// https://img.kitapyurdu.com/v1/getImage/fn:11407623/wi:100/wh:true
			//   https://img.kitapyurdu.com/v1/getImage/fn:11407623/wh:true -- 633x987
			// https://img.kitapyurdu.com/v1/getImage/fn:8092685/wh:true -- 1280x1188
			// wh:[signed? hex] seems to be the way that watermarks are removed. probably stands for "watermark hash"?
			if (/\/v1\/+getImage\//.test(src)) {
				return src.replace(/\/wi:[^/]+(\/.*)?$/g, "$1");
			}
		}

		if (domain_nosub === "rbxcdn.com") {
			// t0-7, perhaps half of hex?
			// images below found from google images
			// can't find a pattern
			// https://t0.rbxcdn.com/045bca7eac44649511029a4c449ed1d0
			// https://t0.rbxcdn.com/0efe2d023ae561d008fc9e824dc18a8d
			// https://t0.rbxcdn.com/18a2355dfeb014d3bbaa54b23e0b4909
			// https://t0.rbxcdn.com/2bf7082d2332584ad95d30583e244f44
			// https://t0.rbxcdn.com/4bed7fd54653a0178e9c1baf45fa0327
			// https://t0.rbxcdn.com/85cce6f078b6f9598d32c51e014b3b06
			// https://t0.rbxcdn.com/a1129318ab6a7995842332969c2e8dc0
			// https://t0.rbxcdn.com/a9faf2b77615595f8b4e56c1c563d2d0
			// https://t0.rbxcdn.com/acd49ccc267e9c7ed8d270af4364d309
			// https://t0.rbxcdn.com/d6ff4dce576f73edc8cc68d78ca47641
			// https://t0.rbxcdn.com/f54f1cde5d2bcf069df0ec6d1f763dd5
			// https://t0.rbxcdn.com/fdfa5edb93a9081e3c153f693b5096b5
			// https://t1.rbxcdn.com/daf9125e9cd1ed400975d9019772afce
			// https://t1.rbxcdn.com/1b23774d79e34e8e9fb9758df8b930d8
			// https://t3.rbxcdn.com/96128359b725dde9f253ac19dc284190
			// https://t4.rbxcdn.com/ab4d9ab2c17b7d02a9d53fc0a3054ae6
			// https://t4.rbxcdn.com/abfd2d9ccc9515239f752bc50bc14008
			// https://t4.rbxcdn.com/ea61acaa7984918ac043e8bff8ac9fb5
			// https://t5.rbxcdn.com/6a7eceb534c161e4d24e73a3eb3d331e
			// https://t5.rbxcdn.com/d777f64770377675419ba77f4f4a6cd5
			// https://t5.rbxcdn.com/e38245b0bea9b58b6a239b985171022a
			// https://t6.rbxcdn.com/f1aab56a2469dd1c749bc3c4cb33d27b
			// https://t7.rbxcdn.com/296f3de73096630f100a49e5bd43f07d
			// https://t7.rbxcdn.com/fc8303d6f1920a91748ae92dbae3a790
			// https://t7.rbxcdn.com/d51a9852d0978bf6602b2312e972e906
		}

		if (domain === "c.stocksy.com") {
			// https://c.stocksy.com/a/6UyG00/za/4045754.jpg
			//   https://c.stocksy.com/a/6UyG00/z9/4045754.jpg
			// 7. 6. 2. 4, 5, 1, 3, 8, a, 0, 9
			return src.replace(/(\/a\/+[^/]+\/+z)[a0-8]\/+([0-9]+\.)/, "$19/$2");
		}

		if (domain === "crowdin-static.downloads.crowdin.com") {
			// thanks to Noodlers on discord: https://github.com/qsniyg/maxurl/issues/860
			// https://crowdin.com/profile/haiwx
			// https://crowdin-static.downloads.crowdin.com/avatar/13572153/small/3eae892bb5401533229584f1ad5e8ce9.jpg
			//   https://crowdin-static.downloads.crowdin.com/avatar/13572153/large/3eae892bb5401533229584f1ad5e8ce9.jpg
			//   https://crowdin-static.downloads.crowdin.com/avatar/13572153/original/3eae892bb5401533229584f1ad5e8ce9.jpg
			return src.replace(/(\/avatar\/+[0-9]+\/+)[a-z]+\/+/, "$1original/");
		}

		if (amazon_container === "trello-members") {
			// thanks to DevWannabe-dot on github for reporting: https://github.com/qsniyg/maxurl/issues/857
			// https://trello-members.s3.amazonaws.com/4fc4d72349e99e8263d01008/395811491a3c65958796290887fc0e6a/30.png
			//   https://trello-members.s3.amazonaws.com/4fc4d72349e99e8263d01008/395811491a3c65958796290887fc0e6a/170.png
			//   https://trello-members.s3.amazonaws.com/4fc4d72349e99e8263d01008/395811491a3c65958796290887fc0e6a/original.png -- 256x256
			// https://trello-members.s3.amazonaws.com/59ef06ebe3e8d1f89c440c1f/27aa4b25c28403300d58a357b67d21cb/30.png
			//   https://trello-members.s3.amazonaws.com/59ef06ebe3e8d1f89c440c1f/27aa4b25c28403300d58a357b67d21cb/170.png -- 128x128
			//   https://trello-members.s3.amazonaws.com/59ef06ebe3e8d1f89c440c1f/27aa4b25c28403300d58a357b67d21cb/original.png -- 128x128
			// https://trello-members.s3.amazonaws.com/60023aa7bab3ba503d3caf7e/4b2ad1cd09e30218991a583553c22599/30.png
			//   https://trello-members.s3.amazonaws.com/60023aa7bab3ba503d3caf7e/4b2ad1cd09e30218991a583553c22599/170.png -- 128x128
			//   https://trello-members.s3.amazonaws.com/60023aa7bab3ba503d3caf7e/4b2ad1cd09e30218991a583553c22599/original.png -- 128x128
			return src.replace(/(\/[0-9a-f]{20,}\/+)[0-9]+(\.[^/.]+)(?:[?#].*)?$/, "$1original$2");
		}

		if (domain_nowww === "schauspielervideos.de") {
			// https://www.schauspielervideos.de/web/res/img/t.png
			if (/\/web\/+res\/+img\/+t\./.test(src))
				return {
					url: src,
					bad: "mask"
				};

			// https://www.schauspielervideos.de/FM/fotos/32/32997/kf1634645_kl_2.jpg
			//   https://www.schauspielervideos.de/FM/fotos/32/32997/kf1634645_gr_1024.jpg -- 1536x1024
			//   https://www.schauspielervideos.de/FM/fotos/32/32997/kf1634645.jpg -- 1800x1200
			return src.replace(/(\/fotos\/+[0-9]{2}\/+[0-9]+\/+[a-z]{2}[0-9]+)_[a-z]{2}_[0-9]+\./, "$1.");
		}

		if (domain_nowww === "agentur-scenario.de") {
			// https://www.agentur-scenario.de/wp-content/themes/scenario-wp-template/imageresize/resize.php?w=400&h=400&src=https://www.agentur-scenario.de/wp-content/uploads/2020/08/Christina-Athensta%CC%88dt-Nils-Schwarz_Christina-Athensta%CC%88dt-Nils-Schwarz__MG_7143-e1627291753513.jpg
			//   https://www.agentur-scenario.de/wp-content/uploads/2020/08/Christina-Athensta%CC%88dt-Nils-Schwarz_Christina-Athensta%CC%88dt-Nils-Schwarz__MG_7143.jpg
			newsrc = src.replace(/.*\/scenario-wp-template\/+imageresize\/+resize\.php\?(?:.*&)?src=([^&]+)(?:[&#].*)?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);

			// https://www.agentur-scenario.de/wp-content/uploads/2020/08/Christina-Athensta%CC%88dt-Nils-Schwarz_Christina-Athensta%CC%88dt-Nils-Schwarz__MG_6270_1200x700_acf_cropped.jpg
			//   https://www.agentur-scenario.de/wp-content/uploads/2020/08/Christina-Athensta%CC%88dt-Nils-Schwarz_Christina-Athensta%CC%88dt-Nils-Schwarz__MG_6270.jpg
			return src.replace(/(\/wp-content\/+uploads\/+[0-9]{4}\/+[0-9]{2}\/+[^/]+)_[0-9]+x[0-9]+_acf_cropped\./, "$1.");
		}

		if (domain === "cdn.mydukaan.io") {
			// thanks to MinuteAd8502 on github: https://github.com/qsniyg/maxurl/issues/862
			// https://cdn.mydukaan.io/app/image/700x700/?url=https://mydukaan.s3.amazonaws.com/3316895/6767e99d-4f39-4b07-b7a2-d29e1ef879e7/1612323272568.jpeg
			//   https://mydukaan.s3.amazonaws.com/3316895/6767e99d-4f39-4b07-b7a2-d29e1ef879e7/1612323272568.jpeg
			// mydukaan s3 container isn't synonymous with cdn.mydukaan.io
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+app\/+image\/+[0-9]+x[0-9]+\/+\?(?:.*&)?url=([^&]+).*$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nosub === "dial4trade.com") {
			// thanks to MinuteAd8502 on github: https://github.com/qsniyg/maxurl/issues/863
			// https://www.dial4trade.com/uploaded_files/product_images/silver-sport-diamond-jeggings-1846699492419.jpg -- 250x250
			//   https://www.dial4trade.com/uploaded_files/product_images/thumbs/silver-sport-diamond-jeggings-1846699492419.jpg -- 500x500, mildly upscaled?
			// https://www.dial4trade.com/uploaded_files/product_images/500-gm-laminated-pouch-agarbatti-u-49119867132992847.jpg -- 250x358
			//   https://www.dial4trade.com/uploaded_files/product_images/thumbs/500-gm-laminated-pouch-agarbatti-u-49119867132992847.jpg -- 381x500
			// https://www.dial4trade.com/uploaded_files/product_images/small-amp-large-green-cardamom-u-491167710640254815.jpg -- 250x250
			//   https://www.dial4trade.com/uploaded_files/product_images/thumbs/small-amp-large-green-cardamom-u-491167710640254815.jpg -- 500x500
			// https://www.dial4trade.com/uploaded_files/product_images/cordyceps-militaris-u-204013459462107.jpg -- 250x333
			//   https://www.dial4trade.com/uploaded_files/product_images/thumbs/cordyceps-militaris-u-204013459462107.jpg -- 500x666
			// opposite:
			// https://www.dial4trade.com/uploaded_files/product_images/thumbs/ac-stabilizer-249402294504.png -- 200x171
			//   https://www.dial4trade.com/uploaded_files/product_images/ac-stabilizer-249402294504.png -- 2753x2361
			// https://www.dial4trade.com/uploaded_files/product_images/thumbs/christmas-cushion-1100585103598.png -- 200x200
			//   https://www.dial4trade.com/uploaded_files/product_images/christmas-cushion-1100585103598.png -- 983x983
			// other:
			// https://uae.dial4trade.com/uploaded_files/product_images/norco-u-38124487204602111.jpg -- 225x225
			//   https://uae.dial4trade.com/uploaded_files/product_images/thumbs/norco-u-38124487204602111.jpg -- 225x225 (probably because orig is <250?)
			let idmatch = src.match(/\/uploaded_files\/+product_images\/+(?:thumbs\/+)?[^/]+-([0-9]{5,})\./);
			if (idmatch) {
				let id = parse_int(idmatch[1]);

				// fixme: improve precision
				if (id >= 1846699492419) {
					return src.replace(/(\/product_images\/+)([^/]+)(?:[?#].*)?$/, "$1thumbs/$2");
				} else {
					return src.replace(/(\/product_images\/+)thumbs\/+([^/]+)(?:[?#].*)?$/, "$1$2");
				}
			}
		}

		if (domain === "cdn.sportsshoes.com") {
			// thanks to MinuteAd8502 on github: https://github.com/qsniyg/maxurl/issues/866
			// https://cdn.sportsshoes.com/product/A/ASI10055/ASI10055_400_1.jpg
			//   https://cdn.sportsshoes.com/product/A/ASI10055/ASI10055_1000_1.jpg
			// https://cdn.sportsshoes.com/product/M/MIZ4624/MIZ4624_400_3.jpg
			//   https://cdn.sportsshoes.com/product/M/MIZ4624/MIZ4624_2500_3.jpg
			// https://cdn.sportsshoes.com/product/R/REE3493/REE3493_100_8.jpg
			//   https://cdn.sportsshoes.com/product/R/REE3493/REE3493_2500_8.jpg
			regex = /(\/product\/+[A-Z0-9]\/+[A-Z0-9]+\/+[A-Z0-9]+)_(?:10|25|[1-48])00_([0-9]+\.)/;
			if (regex.test(src)) {
				return [
					src.replace(regex, "$1_2500_$2"),
					src.replace(regex, "$1_1000_$2"),
					src.replace(regex, "$1_800_$2")
				];
			}
		}

		if (domain === "guide-images.cdn.ifixit.com") {
			// thanks to fedesk on discord
			// https://www.ifixit.com/Teardown/iPhone+12+and+12+Pro+Teardown/137669
			// https://guide-images.cdn.ifixit.com/igi/B3SZCe6BXEROplhd.thumbnail
			//   https://guide-images.cdn.ifixit.com/igi/B3SZCe6BXEROplhd.medium
			//   https://guide-images.cdn.ifixit.com/igi/B3SZCe6BXEROplhd.large
			//   https://guide-images.cdn.ifixit.com/igi/B3SZCe6BXEROplhd.full -- 2756x2067
			return src.replace(/(\/igi\/+[a-zA-Z0-9]+\.)(?:thumbnail|medium|large)(?:[?#].*)?$/, "$1full")
		}

		if (domain_nowww === "miccostumes.com") {
			// thanks to Liz on discord
			// https://www.miccostumes.com/images/path-products/image-Seraph_C_8.jpg/&width=456&height=668
			//   https://www.miccostumes.com/images/path-products/image-Seraph_C_8.jpg/&width=0&height=0 -- 600x880
			// ?width=0&height=0 is invalid, and &width=0 by itself is also invalid
			return src.replace(/(\/images\/+[^?&#]+)(?:[?&#].*)?$/, "$1&width=0&height=0");
		}

		if (domain === "images.adsttc.com") {
			// http://images.adsttc.com/media/images/5223/dd02/e8e4/4eee/f900/00d3/large_jpg/cinema_6.jpg -- 2000x1331
			//   http://images.adsttc.com/media/images/5223/dd02/e8e4/4eee/f900/00d3/original/cinema_6.jpg -- 2880x1916
			return src.replace(/(\/media\/+images\/+(?:[0-9a-f]{4}\/+){6})[^/]+\/([^/]+)(?:[?#].*)?$/, "$1original/$2");
		}

		if (domain === "imgs.xkcd.com") {
			// thanks to Qwerty on discord:
			// https://xkcd.com/2503
			// https://imgs.xkcd.com/comics/memo_spike_connector.png
			//   https://imgs.xkcd.com/comics/memo_spike_connector_2x.png
			return src.replace(/(\/comics\/+[^/.]+?)(?:_2x)?(\.[^/.]+)(?:[?#].*)?$/, "$1_2x$2");
		}

		if (domain === "store.udiscover-music.de") {
			// thanks to nimbuz on discord:
			// https://store.udiscover-music.de/p30-i2310/metallica/
			// https://store.udiscover-music.de/p51-i0602508507076/metallica/metallica-the-black-album-remastered-ltd-deluxe-box-set/index.html
			// https://store.udiscover-music.de/assets/asset_480x480/P0602508507076_1.png
			//   https://store.udiscover-music.de/assets/asset_300x300/P0602508507076_1.png -- 2000x2000
			// https://store.udiscover-music.de/assets/asset_480x480/P0602577471063_1.png
			//   https://store.udiscover-music.de/assets/asset_300x300/P0602577471063_1.png -- 2000x2000
			// asset_300x300 seems to consistently return 2000x2000
			return src.replace(/\/assets\/+asset_480x480\/+/, "/assets/asset_300x300/");
		}

		if (domain === "shop.rammstein.de") {
			// thanks to nimbuz on discord for reporting:
			// https://shop.rammstein.de/img/katalog/2139/1905/lindemann-lim-lp-3dps-rshop.jpg.webp -- 1905x1905
			//   https://shop.rammstein.de/img/katalog/2139/3000/lindemann-lim-lp-3dps-rshop.jpg.webp -- 2048x2048
			//   https://shop.rammstein.de/img/katalog/2139/0/lindemann-lim-lp-3dps-rshop.jpg.webp -- 3016x3016
			return src.replace(/(\/img\/+katalog\/+[0-9]+\/+)[0-9]+\/+/, "$10/");
		}

		if (domain_nowww === "gayeroticvideoindex.com") {
			// thanks to waldens on github: https://github.com/qsniyg/maxurl/issues/877
			// https://www.gayeroticvideoindex.com/images/Covers/Icons/4/video54894.jpg
			//   https://www.gayeroticvideoindex.com/images/Covers/4/video54894.jpg
			return src.replace(/(\/images\/+[^/]+\/+)Icons\/+/, "$1");
		}

		if (domain_nowww === "essentialapparel.com") {
			// thanks to MinuteAd8502 on github: https://github.com/qsniyg/maxurl/issues/881
			// https://www.essentialapparel.com/content/products/1/1258568/s_1258568_black-twistmetallic-silver__1.jpg
			//   https://www.essentialapparel.com/content/products/1/1258568/m_1258568_black-twistmetallic-silver__1.jpg -- 790x960
			//   https://www.essentialapparel.com/content/products/1/1258568/l_1258568_black-twistmetallic-silver__1.jpg -- 893x1190
			// https://www.essentialapparel.com/content/products/h/h5590/s_h5590_gold__0.jpg
			//   https://www.essentialapparel.com/content/products/h/h5590/l_h5590_gold__0.jpg -- 1245x1659
			return src.replace(/(\/content\/+products\/+.\/+[a-z0-9]+\/+)[sm]_([a-z0-9]+_[^/]+)(?:[?#].*)?$/, "$1l_$2");
		}

		if (domain_nowww === "nuclearblast.de") {
			// thanks to nimbuz on discord
			// https://www.nuclearblast.de/de/produkte/tontraeger/cd/3cd/metallica-metallica-black-album-remastered.html
			// https://www.nuclearblast.de/static/articles/304/304137.jpg/250x250.jpg
			//   https://www.nuclearblast.de/static/articles/304/304137.jpg/2000x2000.jpg -- redirects to:
			//   https://www.nuclearblast.de/static/articles/304/304137.jpg/1000x1000.jpg -- 1000x1000
			//   https://www.nuclearblast.de/static/articles/304/304137.jpg/0x0.jpg -- 1000x1000
			return src.replace(/(\/static\/+[^/]+\/+[0-9]+\/+[0-9]+\.[^/.]+\/+)[0-9]+x[0-9]+\./, "$10x0.");
		}

		if (domain === "images.pixieset.com") {
			// https://images.pixieset.com/7571033/2aba32831aa829a871b71c2db18faa14-thumb.JPG
			//   https://images.pixieset.com/7571033/2aba32831aa829a871b71c2db18faa14-small.JPG
			//   https://images.pixieset.com/7571033/2aba32831aa829a871b71c2db18faa14-medium.JPG
			//   https://images.pixieset.com/7571033/2aba32831aa829a871b71c2db18faa14-large.JPG
			//   https://images.pixieset.com/7571033/2aba32831aa829a871b71c2db18faa14-xlarge.JPG
			//   https://images.pixieset.com/7571033/2aba32831aa829a871b71c2db18faa14-xxlarge.JPG -- 1600x2184
			// https://images.pixieset.com/7571033/d5a8b378cc6aea636f3ad049aadbbe1a-cover.JPG -- 1600x1061
			//   https://images.pixieset.com/7571033/d5a8b378cc6aea636f3ad049aadbbe1a-cover-large.JPG -- 3089x2048
			return src
				.replace(/(\/[0-9]+\/+[0-9a-f]{20,})-(?:thumb|small|medium|x?large)\./, "$1-xxlarge.")
				.replace(/(\/[0-9]+\/+[0-9a-f]{20,})-cover\./, "$1-cover-large.");
		}

		if (domain_nowww === "lullidancewear.com") {
			// https://www.lullidancewear.com/SiteFiles/SmallProducts/LUB309M_2-lulli-lub309m-mens-microfiber-short-sleeve-dance-top-ferdinand.jpg
			//   https://www.lullidancewear.com/SiteFiles/Products_/LUB309M_2-lulli-lub309m-mens-microfiber-short-sleeve-dance-top-ferdinand.jpg
			// https://www.lullidancewear.com/SiteFiles/Products_/LUB309M_2-lulli-lub309m-mens-microfiber-short-sleeve-dance-top-ferdinand.jpg?width=100
			//   https://www.lullidancewear.com/SiteFiles/Products_/LUB309M_2-lulli-lub309m-mens-microfiber-short-sleeve-dance-top-ferdinand.jpg
			return src
				.replace(/(\/Products_\/.*)[?#].*$/, "$1")
				.replace(/\/SiteFiles\/+SmallProducts\/+/i, "/SiteFiles/Products_/");
		}

		if (domain === "r8zlusvr.rocketcdn.com") {
			// https://r8zlusvr.rocketcdn.com/images/ac_product_images/product_image_data/resizeandpad:1500:2250/313146.jpg -- 1500x2250
			//   https://r8zlusvr.rocketcdn.com/images/ac_product_images/product_image_data/313146.jpg -- 2000x3000
			return src.replace(/(\/product_image_data\/+)resizeandpad:[0-9:]+\/+/, "$1");
		}

		if (domain_nosub === "prplcdn.com") {
			// https://1.prplcdn.com/i/p/63/tn/6326-483090815.jpg
			//   https://1.prplcdn.com/i/p/63/6326-483090815.jpg
			return src.replace(/(\/i\/+p\/+[0-9]+\/+)tn\/+/, "$1");
		}

		if (domain === "static.picdeno.com") {
			// https://static.picdeno.com/p/pt_6814253424206017466043_0_de13bae5c23b36ec394289ddf7c68fae.jpg?u=https%3A%2F%2Fscontent-mxp1-1.cdninstagram.com%2Fv%2Ft51.2885-15%2Fe35%2Fs320x320%2F155976180_257843809252513_7148649778010288727_n.jpg%3F_nc_ht%3Dscontent-mxp1-1.cdninstagram.com%26_nc_cat%3D101%26_nc_ohc%3DdxOhqs0GFXgAX8Vnzwf%26edm%3DAPU89FABAAAA%26ccb%3D7-4%26oh%3D1545f4b01399252f684594baa2d4aa21%26oe%3D612BAC10%26_nc_sid%3D86f79a&h=717c01ba9164d89ab0a5c88d5d739ed6
			//   https://scontent-mxp1-1.cdninstagram.com/v/t51.2885-15/e35/s320x320/155976180_257843809252513_7148649778010288727_n.jpg?_nc_ht=scontent-mxp1-1.cdninstagram.com&_nc_cat=101&_nc_ohc=dxOhqs0GFXgAX8Vnzwf&edm=APU89FABAAAA&ccb=7-4&oh=1545f4b01399252f684594baa2d4aa21&oe=612BAC10&_nc_sid=86f79a
			newsrc = src.replace(/.*[?&]u=(http[^&]+)(?:[&#].*)?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nosub === "dumpor.com" && /^cdn[0-9]*\./.test(domain)) {
			// https://cdn1.dumpor.com/view?q=%3DEWO3YmN40DZpN3Xj52XmczNGdDRyEjN9U2bmAjN0E2NzQTO1MDZkljMiRWNjVGMwczMxITY4ImMxczY9g2bmQTL30jYjNmJBFUQBJUQGlDOVBVQ90GZlZyZKtkWm1CWBdGWGdEMzFHaPhHZ9MGav91Yu9lJx0DdhN2Xj52Xm02bj5SbhJ3ZhR3culmbkNmLx0SM3F2dtQnblRnbvN2c9QHafNmbf9zZwpmLu91NycDO4IDMxADO3cTO0YDO0EzNfNTM1ITNykDM4MDN4cTNy8FM4EjN3kTN1EzLwgDMxgHM4ATMz9SNzU2L1ETL1gDOy4SM1Q3L29SbvNmLtFmcnFGdz5WauR2YuETLxcXY31CduVGdu92Yz9yL6MHc0RHa
			//   https://scontent-waw1-1.cdninstagram.com/v/t51.2885-15/e35/s1080x1080/155976180_257843809252513_7148649778010288727_n.jpg?_nc_ht=scontent-waw1-1.cdninstagram.com&_nc_cat=1&_nc_ohc=dxOhqs0GFXgAX-fZKJg&edm=APU89FABAAAA&ccb=7-4&oh=c712b8a213700ec5db29dd359437a460&oe=612D7F77&_nc_sid=86f79a
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+view\?(?:.*&)?q=([^&]+)(?:[&#].*)?$/, "$1");
			if (newsrc !== src)
				return base64_decode(reverse_str(decodeURIComponent(newsrc)));
		}

		if (domain === "cdn.inflact.com" ||
			// thanks to DevWannabe-dot on github: https://github.com/qsniyg/maxurl/issues/885
			// https://v1.padlet.pics/3/image.webp?t=c_thumb%2Cdpr_1%2Cg_auto%2Ch_36%2Cw_36&url=https%3A%2F%2Flh3.googleusercontent.com%2Fa-%2FAOh14Gg7LD8KUhj2W4tFRSoSxI2EFzSDjhaJvKZgWTvA%3Ds96-c
			//   https://lh3.googleusercontent.com/a-/AOh14Gg7LD8KUhj2W4tFRSoSxI2EFzSDjhaJvKZgWTvA=s0?imgmax=0
			(domain_nosub === "padlet.pics" && /^v[0-9]*\./.test(domain))) {
			// https://cdn.inflact.com/media/240394960_205692211580533_9129470086410865262_n.jpg?url=https%3A%2F%2Fscontent.cdninstagram.com%2Fv%2Ft51.2885-15%2Fe35%2Fp1080x1080%2F240394960_205692211580533_9129470086410865262_n.jpg%3F_nc_ht%3Dinstagram.fala4-2.fna.fbcdn.net%26_nc_cat%3D1%26_nc_ohc%3DUBIkiiZcVUwAX_1AyRM%26edm%3DAPU89FABAAAA%26ccb%3D7-4%26oh%3Dbabcdc7c96bcffbd62f63f29092ed946%26oe%3D612C2BF4%26_nc_sid%3D86f79a&time=1629882000&key=f60299ad59057355d44f731dee7f8d40
			//   https://scontent.cdninstagram.com/v/t51.2885-15/e35/p1080x1080/240394960_205692211580533_9129470086410865262_n.jpg?_nc_ht=instagram.fala4-2.fna.fbcdn.net&_nc_cat=1&_nc_ohc=UBIkiiZcVUwAX_1AyRM&edm=APU89FABAAAA&ccb=7-4&oh=babcdc7c96bcffbd62f63f29092ed946&oe=612C2BF4&_nc_sid=86f79a
			newsrc = src.replace(/.*[?&]url=(http[^&]+)(?:[&#].*)?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nowww === "instatory.net") {
			// https://instastory.net/gimages/url=https%3A%7C%7C%7C%7Cinstagram.fiev22-1.fna.fbcdn.net%7C%7Cv%7C%7Ct51.2885-15%7C%7Ce35%7C%7Cc0.180.1440.1440a%7C%7Cs320x320%7C%7C240394960_205692211580533_9129470086410865262_n.jpg%3F_nc_ht%3Dinstagram.fiev22-1.fna.fbcdn.net%26_nc_cat%3D1%26_nc_ohc%3DUBIkiiZcVUwAX_ut88L%26edm%3DABfd0MgBAAAA%26ccb%3D7-4%26oh%3Db42aa3d20d9c2d3d496e1b663f1c6cc8%26oe%3D612C22E0%26_nc_sid%3D7bff83
			newsrc = src.replace(/.*[?&]url=(http[^&]+)(?:[&#].*)?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc).replace(/\|\|/g, "/");
		}

		if (domain === "media.prod-v2.mym.fans") {
			// thanks to JoshuaCalvert on discord for reporting
			return {
				url: src,
				can_head: false // 403
			};
		}

		if (host_domain_nowww === "mym.fans" && options.element) {
			// thanks to JoshuaCalvert on discord for reporting
			if (options.element.tagName === "VIDEO") {
				let url = options.element.getAttribute("data-url");
				if (url) {
					if (/\.m3u8(?:[?#].*)?$/i.test(url)) {
						return {
							url: url,
							can_head: false,
							video: "hls"
						};
					} else {
						return {
							url: url,
							can_head: false,
							video: true
						};
					}
				}
			}
		}

		if (domain === "discografia.dds.it") {
			// thanks to loucasal on github: https://github.com/qsniyg/maxurl/issues/887
			// http://discografia.dds.it/display_full_imma.php?imma=./immagini/labelgallery/fossaticanzpopolmaxi1w.jpg
			//   http://discografia.dds.it/display_full_imma.php?imma=./immagini/labelgallery/fossaticanzpopolmaxi1w.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+display_full_imma\.php\?(?:.*?&)?imma=([^&]+)(?:[&#].*)?$/, "$1");
			if (newsrc !== src)
				return urljoin("http://discografia.dds.it/", decodeURIComponent(newsrc).replace(/^\.\/+/, "/"), true);

			// http://discografia.dds.it/immagini/labelgallery/ico_fossaticanzpopolmaxi1w.jpg -- 100x100
			//   http://discografia.dds.it/immagini/labelgallery/scheda_fossaticanzpopolmaxi1w.jpg -- 300x300
			//   http://discografia.dds.it/immagini/labelgallery/fossaticanzpopolmaxi1w.jpg -- 1000x1000
			return src.replace(/(\/immagini\/+[^/]+\/+)(?:ico|scheda)_/, "$1");
		}

		if (domain === "logo.uai.com.br") {
			// redirects if redirect headers are incorrect
			// https://logo.uai.com.br/uai.jpg
			if (/:\/\/[^/]+\/+uai\.jpg(?:[?#].*)?$/.test(src))
				return {
					url: src,
					bad: true
				};
		}

		if (domain === "img.guildedcdn.com") {
			// thanks to 0x464e on github: https://github.com/qsniyg/maxurl/pull/891
		    // https://img.guildedcdn.com/ContentMedia/1033269f0c5e5b46aafcb309aadeeb76-Preview.webp -- Preview size 1285x1440
		    //   https://img.guildedcdn.com/ContentMedia/1033269f0c5e5b46aafcb309aadeeb76-Full.webp -- Full size 3427x3840
		    return remove_queries(src.replace(/(\/ContentMedia\/+[^/?#]+-)Preview(\.[^/.]+(?:[?#].*)?)$/, "$1Full$2"), ["w", "h"]);
		}

		if (domain === "cdn.tatlerasia.com") {
			// thanks to Shaggy on discord
			// https://cdn.tatlerasia.com/tatlerasia/i/2021/09/03192304-richard-hemming-mw-2020-portrait-copy_cover_1200x1800.jpg
			//   https://cdn.tatlerasia.com/tatlerasia/i/2021/09/03192304-richard-hemming-mw-2020-portrait-copy.jpg
			return src.replace(/_cover_[0-9]+x[0-9]+(\.[^/.]+)(?:[?#].*)?$/, "$1");
		}

		if (domain_nowww === "feriasbrasil.com.br") {
			// xg, g, mob, m, p
			// thanks to DevWannabe-dot on github: https://github.com/qsniyg/maxurl/issues/898
			// https://www.feriasbrasil.com.br/fotosfb/909105248-p.jpg
			//   https://www.feriasbrasil.com.br/fotosfb/909105248-m.jpg
			//   https://www.feriasbrasil.com.br/fotosfb/909105248-MOB.jpg
			//   https://www.feriasbrasil.com.br/fotosfb/909105248-g.jpg
			//   https://www.feriasbrasil.com.br/fotosfb/909105248-XG.jpg -- 720x460
			return src.replace(/(\/fotosfb\/+[0-9]+)-(?:p|m|mob|g)\./i,"$1-XG.");
		}

		if (domain_nosub === "jumia.is") {
			// thanks to MinuteAd8502 and ayunami2000 on github: https://github.com/qsniyg/maxurl/issues/867
			// https://za.jumia.is/unsafe/fit-in/150x150/filters:fill(white)/product/09/25131/1.jpg?6470
			//   https://za.jumia.is/unsafe/fit-in/9999x9999/product/09/25131/1.jpg?6470 -- 1000x1000, upscaled
			// https://za.jumia.is/unsafe/fit-in/300x300/filters:fill(white)/product/49/4978/1.jpg
			//   https://za.jumia.is/unsafe/fit-in/9999x9999/product/49/4978/1.jpg -- 800x800, not upscaled
			// https://za.jumia.is/unsafe/fit-in/300x300/filters:fill(white)/product/84/69821/1.jpg
			//   https://za.jumia.is/unsafe/fit-in/9999x9999/product/84/69821/1.jpg -- 500x500, not upscaled
			// https://ke.jumia.is/unsafe/fit-in/680x680/filters:fill(white)/product/52/609441/1.jpg?3848
			//   https://ke.jumia.is/unsafe/fit-in/9999x9999/product/52/609441/1.jpg?3848
			return src.replace(/\/unsafe\/+fit-in\/+[0-9]+x[0-9]+\/+(?:filters:[^/]+\/+)?product\/+/, "/unsafe/fit-in/9999x9999/product/");
		}

		if (domain_nosub === "umd.net") {
			// thanks to anonymous:
			// https://umd.net/media/downloads_teasers/70/wet-dirty-total-athletic-wear-clothing/thumbs/wet-dirty-total-athletic-wear-clothing_12.jpg
			//   https://umd.net/media/downloads_teasers/70/wet-dirty-total-athletic-wear-clothing/mediums/wet-dirty-total-athletic-wear-clothing_12.jpg
			//   https://umd.net/media/downloads_teasers/70/wet-dirty-total-athletic-wear-clothing/wet-dirty-total-athletic-wear-clothing_12.jpg -- 1920x1080
			// https://umd.net/media/user_icons/8_19/mediums/lrmexport2068287858236982_1566696699_uid_55313_74805.jpeg
			//   https://umd.net/media/user_icons/8_19/lrmexport2068287858236982_1566696699_uid_55313_74805.jpeg -- 1080x1620
			// http://ariel.umd.net/media/downloads_teasers/70/levis-jeans-and-white-jeans-in-the-poo/larges/levis-jeans-and-white-jeans-in-the-poo_main.jpg
			//   http://ariel.umd.net/media/downloads_teasers/70/levis-jeans-and-white-jeans-in-the-poo/larges/levis-jeans-and-white-jeans-in-the-poo_main.jpg -- 1920x1080
			// http://saturationhall.umd.net/media/downloads_teasers/4749/blue-jeans-bristol-mud/larges/blue-jeans-bristol-mud_main.jpg
			//   http://saturationhall.umd.net/media/downloads_teasers/4749/blue-jeans-bristol-mud/blue-jeans-bristol-mud_main.jpg -- 3313x2200
			// https://umd.net/media/photos/10_20/thumbs/fbimg1602703988477_1602704178_uid_93705_20786.jpg
			//   https://umd.net/media/photos/10_20/fbimg1602703988477_1602704178_uid_93705_20786.jpg
			// https://umd.net/media/forum_uploads/3_21/thumbs/episode1britwinstheslimeincontest324_uid_77710_161483914778525.jpg
			//   https://umd.net/media/forum_uploads/3_21/episode1britwinstheslimeincontest324_uid_77710_161483914778525.jpg
			// https://umd.net/media/subtracts/9_14/mediums/screenshot20140907at12212_1410106999_uid_8349_42005.png
			//   https://umd.net/media/subtracts/9_14/screenshot20140907at12212_1410106999_uid_8349_42005.png
			// https://umd.net/media/store_logos/1_21/mediums/screenshot20210118at125347pm_uid_81333_161099244824853.png
			//   https://umd.net/media/store_logos/1_21/screenshot20210118at125347pm_uid_81333_161099244824853.png
			// https://umd.net/media/models/thumbs/dsc6335_1429063731_uid_38847_31318.jpg
			//   https://umd.net/media/models/dsc6335_1429063731_uid_38847_31318.jpg
			return src
				.replace(/(\/media\/+(?:downloads_teasers\/+[0-9]+\/+[^/]+|(?:user_icons|photos|forum_uploads|subtracts|store_logos)\/+[0-9]+_[0-9]+|models)\/+)(?:thumbs|mediums|larges)\/+/, "$1");
		}

		if (domain_nowww === "drenchme.com") {
			// thanks to anonymous:
			// https://drenchme.com/images/vdo-349-0357/scene1/t-vdo-349-0357-30.jpg
			//   https://drenchme.com/images/vdo-349-0357/scene1/vdo-349-0357-30.jpg
			return src.replace(/(\/images\/+vdo-[0-9]+-[0-9]+\/+scene[0-9]+\/+)t-([^/]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "images.perthnow.com.au") {
			// https://images.perthnow.com.au/publication/C-3803742/58387c44af486efc5a26b39ff4a2efd0d6e14c67-16x9-x0y0w1280h720.jpg
			//   https://images.perthnow.com.au/publication/C-3803742/58387c44af486efc5a26b39ff4a2efd0d6e14c67.jpg
			// thanks to anonymous for reporting:
			// https://images.perthnow.com.au/publication/C-14821277/ad14bd4dfda7c6d05c849ff217e4a304f69a9e9d-161x229-x0y0w2583h3674.jpg
			//   https://images.perthnow.com.au/publication/C-14821277/ad14bd4dfda7c6d05c849ff217e4a304f69a9e9d.jpg
			return src.replace(/-[0-9]+x[0-9]+-x[0-9]+y[0-9]+w[0-9]+h[0-9]+\./, ".");
		}

		if (domain === "static.metacritic.com") {
			// thanks to DevWannabe-dot on github: https://github.com/qsniyg/maxurl/issues/906
			// https://static.metacritic.com/images/products/music/9/679a9b797240b0b1772b8d8b5aeea862-98.jpg
			//   https://static.metacritic.com/images/products/music/9/679a9b797240b0b1772b8d8b5aeea862.jpg -- 840x840
			// https://static.metacritic.com/images/products/movies/7/c3bc8e9e12d20563ee08f95b3baced93-98.jpg
			//   https://static.metacritic.com/images/products/movies/7/c3bc8e9e12d20563ee08f95b3baced93.jpg -- 800x1185
			// https://static.metacritic.com/images/avatars/000kai_1570835677_sml.jpg -- 30x30
			//   https://static.metacritic.com/images/avatars/000kai_1570835677_med.jpg -- 90x90
			//   https://static.metacritic.com/images/avatars/000kai_1570835677_lrg.jpg -- 300x300
			return src
				.replace(/(\/images\/+products\/+.+?\/+[0-9a-f]\/+[0-9a-f]{20,})-[0-9]+\./, "$1.")
				.replace(/(\/images\/+avatars\/+[^/]+)_(?:sml|med)\./, "$1_lrg.");
		}

		if (domain === "ak.picdn.net") {
			// 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
			// 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") {
			// thanks to anonymous:
			// https://covers.zlibcdn2.com/covers100/books/b6/1d/46/b61d4615c1783003dc41aba3952f4306.jpg
			//   https://covers.zlibcdn2.com/covers299/books/b6/1d/46/b61d4615c1783003dc41aba3952f4306.jpg
			//   https://covers.zlibcdn2.com/covers/books/b6/1d/46/b61d4615c1783003dc41aba3952f4306.jpg -- 399x500
			return src.replace(/(:\/\/[^/]+\/+covers)[0-9]+\/+/, "$1/");
		}

		if (domain === "news-img.cdn.nimg.jp") {
			// thanks to fireattack on discord:
			// https://news.nicovideo.jp/watch/nw1444914
			// https://news-img.cdn.nimg.jp/s/articles/images/1444914/1273178l.jpg/b650x400l.webp?key=9635615f24acdaba5b88ff1d7cd6d935f3b40891160d85ac650039dbc21867cb
			//   https://news.cdn.nimg.jp/articles/images/1444914/1273178l.jpg
			return src.replace(/:\/\/news-img\.[^/]+\/+s\/+(articles\/+images\/+[0-9]+\/+[^/]+\.[^/]+)\/+.*/, "://news.cdn.nimg.jp/$1");
		}

		if (domain_nowww === "physicaleditions.com") {
			// thanks to jonestly on discord for reporting
			// https://www.physicaleditions.com/?Type/Picture/4469/File:,Maximum_Width=470
			//   https://www.physicaleditions.com/?Type/Picture/4469/File:
			return src.replace(/\?.*?(Type\/+Picture\/+[0-9]+\/+File:).*?$/, "?$1");
		}

		if (domain === "c.officialstore.jp") {
			// thanks to nimbuz on discord for reporting:
			// https://teichiku-shop.com/products/detail/TES0001B9Y
			// https://c.officialstore.jp/img//product_image/teichiku-shop.com/174134/1/1/w300_h300.P5_G8526030W.JPG
			//   https://c.officialstore.jp/img//product_image/teichiku-shop.com/174134/1/1/w0_h0.P5_G8526030W.JPG -- 500x500
			return src.replace(/(\/img\/+product_image\/+teichiku-shop\.com\/.*\/)w[0-4][0-9]{2}_h[0-4][0-9]{2}\./, "$1w0_h0.");
		}

		if (domain === "cdn-thumbshot-ie.pearltrees.com") {
			// http://www.pearltrees.com/wipenew/item85630130
			// https://cdn-thumbshot-ie.pearltrees.com/a6/cb/a6cbd2bf328703d3682f9ce1f54bb6ec-pearlsquare.jpg
			//   https://cdn-media-ie.pearltrees.com/a6/cb/d2/a6cbd2bf328703d3682f9ce1f54bb6ec-l.jpg
			return src.replace(/:\/\/[^/]+\/+((?:[0-9a-f]{2}\/+){2})([0-9a-f]{4}([0-9a-f]{2})[0-9a-f]{10,})(?:-[a-z]+)?\./, "://cdn-media-ie.pearltrees.com/$1$3/$2-l.");
		}

		if (domain === "img.animatetimes.com" ||
			// https://www.animatetimes.com/news/visual/2014/1416755526_1_1_e9ca0f898270b02dd98d481e79a1dd67_thumb.jpg
			//   https://www.animatetimes.com/news/visual/2014/1416755526_1_1_e9ca0f898270b02dd98d481e79a1dd67.jpg
			domain_nowww === "animatetimes.com") {
			// thanks to fireattack on discord:
			// https://img.animatetimes.com/news/visual/2014/1416755526_1_1_e9ca0f898270b02dd98d481e79a1dd67_thumb.jpg
			//   https://img.animatetimes.com/news/visual/2014/1416755526_1_1_e9ca0f898270b02dd98d481e79a1dd67.jpg
			// https://img.animatetimes.com/news/visual/2014/1416755526_1_1_e9ca0f898270b02dd98d481e79a1dd67_thumb2.jpg
			//   https://img.animatetimes.com/news/visual/2014/1416755526_1_1_e9ca0f898270b02dd98d481e79a1dd67.jpg
			return src.replace(/(\/news\/+[^/]+\/+[0-9]{4}\/+[^/]+)_thumb2?(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "images.scawaiiweb.com") {
			// thanks to nimbuz on discord for reporting:
			// https://images.scawaiiweb.com/articles/50000/50846/478x850/d7df0b65f6b294df7b8cba35d5e43587.jpg -- 718x478
			//   https://images.scawaiiweb.com/articles/50000/50846/OG/d7df0b65f6b294df7b8cba35d5e43587.jpg -- 1568x1044
			// https://images.scawaiiweb.com/articles/50000/50610/OG/21baf34cc6ed304f5a9d147c6568cc34.jpg -- 1200x675
			// https://images.scawaiiweb.com/articles/20000/20494/OG/5756cdfdf619e51520c138edec023650c09e8c52.png -- 640x360
			// https://images.scawaiiweb.com/articles/50000/50637/OG/85042974abae8e63fb8674c2674d6e15.jpg -- 1548x870, upscaled?
			// thanks to nimbuz:
			// https://scawaiiweb.com/articles/gallery/50630/12734
			// doesn't work for all:
			// https://images.scawaiiweb.com/articles_photos/50000/50630/231x410/c5f1a2a84e540bdc0cf3fcd65d43018d.jpg
			//   https://images.scawaiiweb.com/articles_photos/50000/50630/OG/c5f1a2a84e540bdc0cf3fcd65d43018d.jpg -- doesn't work
			// https://images.scawaiiweb.com/articles/50000/50630/wysiwyg/d4562b4ebae5475dbebe7216157f3c7b.jpg
			//   https://images.scawaiiweb.com/articles/50000/50630/OG/d4562b4ebae5475dbebe7216157f3c7b.jpg -- doesn't work
			return src.replace(/(\/articles\/+[0-9]+\/+[0-9]+\/+)[0-9]+x[0-9]+\/+/, "$1OG/");
		}

		if (domain === "i.pcmag.com") {
			// thanks to ayunami2000: https://github.com/qsniyg/maxurl/issues/927
			// https://i.pcmag.com/imagery/reviews/008OGfwLSBtH9BnVnnUN0G9-5.1569479530.fit_lim.size_1200x630.jpg
			//   https://i.pcmag.com/imagery/reviews/008OGfwLSBtH9BnVnnUN0G9-5.1569479530.jpg
			//   https://i.pcmag.com/imagery/reviews/008OGfwLSBtH9BnVnnUN0G9-5.jpg
			// https://i.pcmag.com/imagery/reviews/01LG7X66NKFgNRZSIDI1qsc-3..v1635091908.jpg
			//   https://i.pcmag.com/imagery/reviews/01LG7X66NKFgNRZSIDI1qsc-3.jpg
			// https://i.pcmag.com/imagery/reviews/03J6CWwKPjxtSTrbEzXWvz8-1.fit_scale.size_760x427.v1620319451.png
			//   https://i.pcmag.com/imagery/reviews/03J6CWwKPjxtSTrbEzXWvz8-1.png
			// thanks to anonymous for reporting:
			// https://i.pcmag.com/imagery/articles/01RFCmjWG934ohNRfD3Kewt-1.fit_lim.size_900x600.v1692284730.jpg
			//   https://i.pcmag.com/imagery/articles/01RFCmjWG934ohNRfD3Kewt-1.jpg
			return src.replace(/(\/imagery\/+[^/]+\/+[^/.]+)\.+(?:(?:(?:fit|size)_[^/.]+|v?[0-9]{10})\.+)+([^/.]+)(?:[?#].*)?$/, "$1.$2");
		}

		if (domain_nowww === "geoguessr.com") {
			// thanks to DevWannabe-dot: https://github.com/qsniyg/maxurl/issues/929
			// https://www.geoguessr.com/images/auto/48/48/ce/0/plain/map/3f950f0318b9086b1b9ec591206dfdd8.jpg
			//   https://www.geoguessr.com/images/auto/0/0/ce/0/plain/map/3f950f0318b9086b1b9ec591206dfdd8.jpg
			// https://www.geoguessr.com/images/fit/288/162/ce/1/plain/block/2436e207839647f7fba719c71a258967.png
			//   https://www.geoguessr.com/images/auto/0/0/ce/1/plain/block/2436e207839647f7fba719c71a258967.png
			return {
				url: src.replace(/\/images\/+[^/]+\/+[0-9]+\/+[0-9]+\/+/, "/images/auto/0/0/"),
				can_head: false // 404
			};
		}

		if (domain === "pricespy-75b8.kxcdn.com") {
			// thanks to KnifeFed on github: https://github.com/qsniyg/maxurl/issues/930
			// https://pricespy-75b8.kxcdn.com/product/standard/140/5727009.jpg
			//   https://pricespy-75b8.kxcdn.com/product/standard/800/5727009.jpg
			// https://pricespy-75b8.kxcdn.com/product/front/280/4277132.jpg
			//   https://pricespy-75b8.kxcdn.com/product/front/800/4277132.jpg
			// https://pricespy-75b8.kxcdn.com/product/inside/280/4967689.jpg
			//   https://pricespy-75b8.kxcdn.com/product/inside/280/4967689.jpg
			return src.replace(/(\/product\/+[^/]+\/+)(?:140|280)\/+/, "$1800/");
		}

		if (domain === "cdn.amuse.io") {
			// thanks to jonestly on discord: https://github.com/qsniyg/maxurl/issues/950
			// https://cdn.amuse.io/170ff806-580e-40c8-9870-d3b842ab2055.400x400.jpg
			//   https://cdn.amuse.io/170ff806-580e-40c8-9870-d3b842ab2055.jpg
			return src.replace(/(:\/\/[^/]+\/+[-0-9a-f]{20,})\.[0-9]+x[0-9]+\./, "$1.");
		}

		if (domain === "artwork-cdn.7static.com") {
			// thanks to ROpdebee on github: https://github.com/qsniyg/maxurl/issues/922
			// https://docs.7digital.com/reference#image-sizes
			// https://artwork-cdn.7static.com/static/img/sleeveart/00/143/859/0014385941_33.jpg
			//   https://artwork-cdn.7static.com/static/img/sleeveart/00/143/859/0014385941_800.jpg
			let regex = /(:\/\/[^/]+\/+static\/+img\/+[^/]+\/+[0-9]{2}\/+[0-9]{3}\/+[0-9]{3}\/+[0-9]+_)[0-9]+\./;
			if (regex.test(src)) {
				return replace_sizes(src, [
					src.replace(regex, "$1800."),
					src.replace(regex, "$1500."),
					src.replace(regex, "$1350."),
					src.replace(regex, "$1200.")
				]);
			}
		}
		if (domain_nosub === "plex.direct" && /.*\..*\.plex\.direct(:[\d]{0,5})?\/.*\/transcode/gm.test(src)) {
			// thanks to Jabster28 on github: https://github.com/qsniyg/maxurl/pull/987
			// https://url.plex.direct:32400/photo/:/transcode?width=720&height=720&minSize=1&upscale=1&url=%2Flibrary%2Fmetadata%2F15362%2Fthumb%2F1641679236%3FX-Plex-Token%3Dt0K3ng0Esh3rE
			//   https://url.plex.direct:32400/library/metadata/15362/thumb/1641679236?X-Plex-Token=t0K3ng0Esh3rE
			return (decodeuri_ifneeded(get_queries(src).url));
		}

		if (domain_nowww === "donationcoder.com" ||
			// thanks to anonymous for reporting:
			// https://www.coni.it/images/igallery/resized/attilio-pavesi-2008/pavesiattilio1_20221202_1477010967-1600-1000-80.jpg
			//   https://www.coni.it/images/igallery/original/attilio-pavesi-2008/pavesiattilio1_20221202_1477010967.jpg
			domain_nowww === "coni.it") {
			// thanks to DevWannabe-dot on github for reporting: https://github.com/qsniyg/maxurl/issues/858
			// https://www.donationcoder.com/images/igallery/resized/301-400/mmb4_01-378-120-90-95-c.png
			//   https://www.donationcoder.com/images/igallery/original/301-400/mmb4_01-378.png
			// https://www.donationcoder.com/images/igallery/resized/201-300/urlsnoop_Screenshot_main-289-600-300-95.gif
			//   https://www.donationcoder.com/images/igallery/original/201-300/urlsnoop_Screenshot_main-289.gif
			newsrc = src.replace(/(\/images\/+igallery\/+)resized\/+([^/]+\/+[^/]+)-[0-9]+-[0-9]+-[0-9]{1,3}(?:-c)?\./, "$1original/$2.");
			if (newsrc !== src)
				return newsrc;

			// https://www.donationcoder.com/forum/index.php?action=dlattach;topic=50231.0;attach=111806;image
			//   https://www.donationcoder.com/forum/index.php?action=dlattach;topic=50231.0;attach=111805;image -- 1605x1008
			// https://www.donationcoder.com/forum/index.php?action=dlattach;topic=51544.0;attach=113904;image;image
			//   https://www.donationcoder.com/forum/index.php?action=dlattach;topic=51544.0;attach=113903;image;image -- 640x443
			newsrc = src.replace(/(\/forum\/+index\.php\?(?:.*;)?attach=)([0-9]+)(;.*)$/, function(_, prefix, id, suffix) {
				return prefix + (parse_int(id) - 1) + suffix;
			});
			if (newsrc !== src)
				return {
					url: newsrc,
					norecurse: true, // it should only decrement the id once
					problems: {
						possibly_different: true
					}
				};
		}

		if (domain === "d2rxqglyhdohqf.cloudfront.net" ||
			// https://s3.amazonaws.com/img.shootproof.com/ph/43319daed7d17b750558c19cb8b08913/2x/683400886.jpg
			amazon_container === "img.shootproof.com") {
			// thanks to Nguyen on discord:
			// https://andrewcraigphotography.shootproof.com/gallery/5141055/photo/683400886
			// https://d2rxqglyhdohqf.cloudfront.net/ph/43319daed7d17b750558c19cb8b08913/m/683400886.jpg -- 499x334
			//   https://d2rxqglyhdohqf.cloudfront.net/ph/43319daed7d17b750558c19cb8b08913/l/683400886.jpg -- 999x668
			//   https://d2rxqglyhdohqf.cloudfront.net/ph/43319daed7d17b750558c19cb8b08913/xl/683400886.jpg -- 1498x1001
			//   https://d2rxqglyhdohqf.cloudfront.net/ph/43319daed7d17b750558c19cb8b08913/2x/683400886.jpg -- 1999x1335
			//   https://d2rxqglyhdohqf.cloudfront.net/ph/43319daed7d17b750558c19cb8b08913/3x/683400886.jpg -- 3000x2003
			let regex = /(\/ph\/+[0-9a-f]{30,}\/+)(?:m|l|xl|2x|3x)\/+/
			let match = src.match(regex);
			if (match) {
				return replace_sizes(src, [
					src.replace(regex, "$13x/"),
					src.replace(regex, "$12x/"),
					src.replace(regex, "$1xl/"),
					src.replace(regex, "$1l/"),
					src.replace(regex, "$1m/")
				]);
			}
		}

		if (domain_nowww === "g4u.to") {
			// https://g4u.to/images/screenshots/14679/s_8.jpg
			//   https://g4u.to/images/screenshots/14679/b_8.jpg
			return src.replace(/(\/images\/+screenshots\/+[0-9]+\/+)s_/, "$1b_");
		}

		if (domain === "s.uvlist.net") {
			// https://s.uvlist.net/gfx/frame_60x45.png
			if (/\/gfx\/+frame_[0-9]+x[0-9]+\./.test(src))
				return {
					url: src,
					bad: "mask"
				};
		}

		if (domain === "cdn.rebrickable.com") {
			// https://cdn.rebrickable.com/media/thumbs/mocs/moc-99324.jpg/180x144c.jpg?1643031038.69082
			//   https://cdn.rebrickable.com/media/mocs/moc-99324.jpg
			// https://cdn.rebrickable.com/media/thumbs/sets/21036-1/12061.jpg/180x180p.jpg?1641910003.9025092
			//   https://cdn.rebrickable.com/media/sets/21036-1/12061.jpg
			return src.replace(/\/media\/+thumbs(\/+.*\/+[^/]+\.[^/.]+)\/+[^/]+\.[^/.]+(?:[?#].*)?$/, "/media$1");
		}

		if (domain_nowww === "bricksafe.com") {
			// https://bricksafe.com/files/Ervin200/dune-spice-harvester/Dune%20Spice%20Harvester1_4.png/130x130.png
			//   https://bricksafe.com/files/Ervin200/dune-spice-harvester/Dune%20Spice%20Harvester1_4.png
			return src.replace(/(\/files\/+[^/]+\/+[^/]+\/+[^/]+\.[a-z]+)\/+[0-9]+x[0-9]+\.[a-z]+(?:[?#].*)?$/, "$1");
		}

		if (host_domain === "addons.mozilla.org" && options.element) {
			// thanks to decembre on github for reporting: https://github.com/qsniyg/maxurl/issues/993
			if (!src && options.element.tagName === "BUTTON") {
				return {
					url: origsrc,
					bad: "mask"
				};
			}
		}

		if (domain === "addons.mozilla.org") {
			// thanks to anonymous for reporting:
			// https://addons.mozilla.org/user-media/addon_icons/2711/2711005-32.png?modified=14a6443d
			//   https://addons.mozilla.org/user-media/addon_icons/2711/2711005-128.png?modified=14a6443d
			// thanks to oifj34f34f on github: https://github.com/qsniyg/maxurl/issues/1223
			// https://addons.mozilla.org/user-media/previews/thumbs/281/281762.jpg
			//   https://addons.mozilla.org/user-media/previews/full/281/281762.png

			newsrc = src.replace(/(\/user-media\/+addon_icons\/+[0-9]+\/+[0-9]+-)(?:16|32|64)\./, "$1128.");
			if (newsrc !== src)
				return newsrc;

			newsrc = src.replace(/(\/user-media\/+previews\/+)thumbs(\/+[0-9]+\/+)/, "$1full$2");
			if (newsrc !== src)
				return add_extensions(newsrc);
		}

		if (domain === "d348imysud55la.cloudfront.net" ||
			domain === "files.vrchat.cloud") {
			// thanks to CetaceanNation on github: https://github.com/qsniyg/maxurl/issues/995
			// https://api.vrchat.cloud/api/1/image/file_2e032059-5c01-4955-98c7-245079d603cb/1/256
			//   https://d348imysud55la.cloudfront.net/thumbnails/file_2e032059-5c01-4955-98c7-245079d603cb.a8d2f0f76f2b0a0d9fbeb8455e25a44c70cbe91ca0b10431cd89d54d87f88ca9.1.thumbnail-256.png
			// https://api.vrchat.cloud/api/1/file/file_2e032059-5c01-4955-98c7-245079d603cb/1
			//   https://d348imysud55la.cloudfront.net/World-Nijisanji-Express-Image-20.file_2e032059-5c01-4955-98c7-245079d603cb.1.png
			//   https://files.vrchat.cloud/World-Nijisanji-Express-Image-20.file_2e032059-5c01-4955-98c7-245079d603cb.1.png
			// other:
			// https://d348imysud55la.cloudfront.net/thumbnails/1362051420.thumbnail-500.png
			//   https://api.vrchat.cloud/api/1/file/file_99ec2ba7-7efd-47df-811d-502a5ae1a3dd/1/file
			let match = src.match(/\/thumbnails\/+(file_[-0-9a-f]{20,})\.[0-9a-f]{30,}\.([0-9]+)\./);
			if (match)
				return "https://api.vrchat.cloud/api/1/file/" + match[1] + "/" + match[2] + "/file";
		}

		if (domain === "api.vrchat.cloud") {
			// thanks to CetaceanNation on github: https://github.com/qsniyg/maxurl/issues/995
			// https://api.vrchat.cloud/api/1/image/file_2e032059-5c01-4955-98c7-245079d603cb/1/256
			//   https://api.vrchat.cloud/api/1/file/file_2e032059-5c01-4955-98c7-245079d603cb/1
			// other:
			// https://api.vrchat.cloud/api/1/file/file_45f1f26f-a741-47f6-b973-a5c14e9da1f2/24/file
			//   https://d348imysud55la.cloudfront.net/World-Angela's-Avatar-World-Imag.file_45f1f26f-a741-47f6-b973-a5c14e9da1f2.24.png
			// https://api.vrchat.cloud/api/1/file/file_45f1f26f-a741-47f6-b973-a5c14e9da1f2/24
			//   https://d348imysud55la.cloudfront.net/World-Angela's-Avatar-World-Imag.file_45f1f26f-a741-47f6-b973-a5c14e9da1f2.24.png
			// https://api.vrchat.cloud/api/1/file/file_45f1f26f-a741-47f6-b973-a5c14e9da1f2/24/a
			//   {"mimeType":"image/png","extension":".png","ownerId":"usr_c083b956-df80-4618-8200-833152f21feb"}
			return src.replace(/\/image\/+(file_[-0-9a-f]{20,}\/+[0-9]+)\/+[0-9]+(?:[?#].*)?$/, "/file/$1/file");
		}

		if (domain === "static.ow.ly") {
			// thanks to fireattack on discord: https://github.com/qsniyg/maxurl/issues/990
			// http://ow.ly/i/1B5FQ
			// https://static.ow.ly/photos/thumb/1B5FQ.jpg
			//   https://static.ow.ly/photos/normal/1B5FQ.jpg
			//   https://static.ow.ly/photos/original/1B5FQ.jpg
			return src.replace(/\/photos\/+[a-z]+\/+/, "/photos/original/");
		}

		if (domain_nowww === "ow.ly") {
			// http://ow.ly/i/1ceGd
			let match = src.match(/\/i\/+([A-Za-z0-9]+)(?:[?#].*)?$/);
			if (match) {
				return [
					{ url: "https://static.ow.ly/photos/original/" + match[1] + ".jpg" },
					{ url: src, is_pagelink: true }
				]
			}
		}

		if (domain === "d2ufj6gm1gtdrc.cloudfront.net" ||
			// https://d3mcojo3jv0dbr.cloudfront.net/2021/05/31/00/29/98a076768c061a674c51d4e4de2d702f.jpeg?w=280&q=65
			//   https://d2ufj6gm1gtdrc.cloudfront.net/2021/05/31/00/29/98a076768c061a674c51d4e4de2d702f.jpeg
			domain === "d3mcojo3jv0dbr.cloudfront.net") {
			// thanks to contextnerror on github: https://github.com/qsniyg/maxurl/issues/980
			// https://fruitsnoir.postype.com/post/2454609
			// https://d2ufj6gm1gtdrc.cloudfront.net/2018/09/10/22/49/e91aea7d82404cdfcb12ecbc99ef856f.jpg?w=1200&q=90
			//   https://d2ufj6gm1gtdrc.cloudfront.net/2018/09/10/22/49/e91aea7d82404cdfcb12ecbc99ef856f.jpg
			if (/:\/\/[^/]+\/+[0-9]{4}\/+[0-9]{2}\/+/.test(src)) {
				return {
					url: src
						.replace(/:\/\/[^/]+\/+/, "://d2ufj6gm1gtdrc.cloudfront.net/") // d3mcojo3jv0dbr.cloudfront.net returns 403
						.replace(/[?#].*$/, ""),
					headers: {
						Referer: "https://www.postype.com/",
						"Sec-Fetch-Dest": "image",
						"Sec-Fetch-Mode": "no-cors",
						"Sec-Fetch-Site": "cross-site"
					}
				};
			}
		}

		if (domain === "static.fnac-static.com") {
			// https://static.fnac-static.com/multimedia/Images/FR/NR/5c/c6/d5/14009948/1541-1/tsp20220207061748/Bleak.jpg
			//   https://static.fnac-static.com/multimedia/Images/FR/NR/5c/c6/d5/14009948/1520-1/tsp20220207061748/Bleak.jpg
			return src
				.replace(/(\/multimedia\/+Images\/+.*\/+15)(?:01|02|08|33|35|39|40|45)(-[0-9]+\/)/, "$107$2")
				.replace(/(\/multimedia\/+Images\/+.*\/+15)(?:41|43)(-[0-9]+\/)/, "$120$2");
		}

		if (domain === "img.photoreco.com") {
			// thanks to nimbuz on discord for reporting:
			// https://img.photoreco.com/web/pc/free/images/css/common/icon_big.png
			// https://img.photoreco.com/web/pc/free/images/css/common/bg_opa-black_60.png
			if (/\/images\/+css\/+common\/+(?:icon_big|bg_opa-black_[0-9]+)\./.test(src))
				return {
					url: src,
					bad: "mask"
				};
		}

		if (domain === "docimg.immanens.com") {
			// thanks to nimbuz on discord:
			// https://docimg.immanens.com/phxaf/getcover/logistic-code/PVN1/l-pub-id/1745/l-doc-id/1230646/doc-version/2/profile/cover-small.jpg -- 160x211
			//   https://docimg.immanens.com/phxaf/getcover/logistic-code/PVN1/l-pub-id/1745/l-doc-id/1230646/doc-version/2/profile/cover-medium.jpg -- 320x422
			//   https://docimg.immanens.com/phxaf/getcover/logistic-code/PVN1/l-pub-id/1745/l-doc-id/1230646/doc-version/2/profile/cover-large.jpg -- 700x925
			// any unknown text == large
			return src.replace(/(\/getcover\/+.*\/cover-)(?:small|medium)\./, "$1large.");
		}

		if (domain_nowww === "pearlygates.net") {
			// thanks to srinac on github for reporting: https://github.com/qsniyg/maxurl/issues/1008
			// https://www.pearlygates.net/catalogue/2022sp/index.html
			// https://www.pearlygates.net/catalogue/2022sp/contents/index.xml.js
			// https://www.pearlygates.net/catalogue/2022sp/contents/pages/100/h1.jpg
			//   https://www.pearlygates.net/catalogue/2022sp/contents/pages/200/h1.jpg -- 1383x1800
			return src.replace(/(\/contents\/+pages\/+)100\/+/, "$1200/");
		}

		if (domain_nowww === "snizenja.ba") {
			// thanks to anonymous
			// https://www.snizenja.ba/images/mnwallimages/190x270/images/mercator/BA_Mercator_tematski_katalog_130106022022_Page_1.jpg
			//   https://www.snizenja.ba/images/mercator/BA_Mercator_tematski_katalog_130106022022_Page_1.jpg
			return src.replace(/\/images\/+mnwallimages\/+[0-9]+x[0-9]+\/+images\/+/, "/images/");
		}

		if (domain === "assets.fanart.tv") {
			// thanks to TheLastZombie on github: https://github.com/qsniyg/maxurl/pull/1012
			// https://assets.fanart.tv/preview/movies/145220/hdmovielogo/muppets-most-wanted-53c1385817504.png
			//   https://assets.fanart.tv/fanart/movies/145220/hdmovielogo/muppets-most-wanted-53c1385817504.png -- via https://fanarttv.docs.apiary.io/#introduction/image-preview
			// https://assets.fanart.tv/preview/tv/75682/clearlogo/Bones-75682.png
			//   https://assets.fanart.tv/fanart/tv/75682/clearlogo/Bones-75682.png -- via https://fanarttv.docs.apiary.io/#reference/tv/get-show/get-images-for-show
			// https://assets.fanart.tv/preview/music/f4a31f0a-51dd-4fa7-986d-3095c40c5ed9/artistbackground/evanescence-4dc7198199ccd.jpg
			//   https://assets.fanart.tv/fanart/music/f4a31f0a-51dd-4fa7-986d-3095c40c5ed9/artistbackground/evanescence-4dc7198199ccd.jpg -- via https://fanarttv.docs.apiary.io/#reference/music/get-artist/get-images-for-artist
			//   https://assets.fanart.tv/fanart/zzz/zzz-nonexistent-id-zzz/zzz/evanescence-4dc7198199ccd.jpg -- cannot restrict further as most parameters don't seem to actually matter
			return src.replace(/\/+preview\/+/, "/fanart/");
		}

		if (domain === "cdn.app.c-rayon.com") {
			// thanks to anonymous
			// https://cdn.app.c-rayon.com/cloudfront/sirup/editor_images/cc1d8787-a703-4a1d-91d9-6ee6149343c6.jpeg.1200.jpg?response-content-disposition=filename%2A%3DUTF-8%27%27211205_SIRUP0328.jpg -- 1200x801
			//   https://cdn.app.c-rayon.com/cloudfront/sirup/editor_images/cc1d8787-a703-4a1d-91d9-6ee6149343c6.jpeg.nop?response-content-disposition=filename%2A%3DUTF-8%27%27211205_SIRUP0328.jpg -- 7705x5140
			return src.replace(/(\.[a-z]+)\.[0-9]+\.[a-z]+([?#].*)?$/, "$1.nop$2");
		}

		if (domain_nowww === "old-games.com") {
			// https://www.old-games.com/screenshot/t1139-1-adventures-of-robin-hood.jpg
			//   https://www.old-games.com/screenshot/1139-1-adventures-of-robin-hood.jpg
			return src.replace(/(\/screenshot\/+)t([0-9]+-)/, "$1$2");
		}

		if (domain_nowww === "hochi.news") {
			// thanks to fireattack on discord:
			// https://hochi.news/images/2022/03/17/20220317-OHT1I51307-T.jpg
			//   https://hochi.news/images/2022/03/17/20220317-OHT1I51307-L.jpg -- 671x2000
			return src.replace(/(\/images\/+[0-9]{4}\/.*)-T\./, "$1-L.");
		}

		if (domain === "ebookstore.sony.jp") {
			// thanks to fireattack on discord:
			// https://ebookstore.sony.jp/cms-assets/images/63/635cda43ea7f394bafec3f01070ad47a7cb54dc3_s.jpg
			//   https://ebookstore.sony.jp/cms-assets/images/63/635cda43ea7f394bafec3f01070ad47a7cb54dc3_l.jpg
			//   https://ebookstore.sony.jp/cms-assets/images/63/635cda43ea7f394bafec3f01070ad47a7cb54dc3_original.jpg
			// thanks to anonymous for reporting:
			// https://ebookstore.sony.jp/photo/LT00018895/LT000188953001995712_LARGE.jpg
			//   https://ebookstore.sony.jp/photo/LT00018895/LT000188953001995712_XLARGE.jpg
			return src
				.replace(/(\/images\/+[0-9a-f]{2}\/+[0-9a-f]{20,})_[a-z]+\./, "$1_original.")
				.replace(/(\/photo\/+[A-Z]*[0-9]+\/+[A-Z]*[0-9]+)_(?:SMALL|LARGE)\./, "$1_XLARGE.");
		}

		if (domain === "prod-ripcut-delivery.disney-plus.net") {
			// thanks to nimbuz on discord:
			// https://prod-ripcut-delivery.disney-plus.net/v1/variant/disney/40268BDEE1202C6E8546645CD33FABCC9EDB5FEE46DC6D15F188B2E01717DF50/scale?width=400&aspectRatio=1.78&format=jpeg
			//   https://prod-ripcut-delivery.disney-plus.net/v1/variant/disney/40268BDEE1202C6E8546645CD33FABCC9EDB5FEE46DC6D15F188B2E01717DF50
			return src.replace(/\/scale(?:[?#].*)?$/, "");
		}

		if (domain === "misc.socialbladeshow.com") {
			// thanks to Qwerty on discord:
			// https://misc.socialbladeshow.com/afd/screenshots/20220116-t.jpg
			//   https://misc.socialbladeshow.com/afd/screenshots/20220116-l.jpg
			//   https://misc.socialbladeshow.com/afd/screenshots/20220116-o.png
			newsrc = src.replace(/(\/afd\/+screenshots\/+[^/.]+)-[a-z]\./, "$1-o.");
			if (newsrc !== src)
				return add_extensions(newsrc);
		}

		if (domain === "thumbnails.odycdn.com") {
			// thanks to ayunami2000 on github: https://github.com/qsniyg/maxurl/issues/1025
			// https://thumbnails.odycdn.com/optimize/s:200:0/quality:95/plain/https://thumbnails.lbry.com/UC7YOGHUfC1Tb6E4pudI9STA
			//   https://thumbnails.lbry.com/UC7YOGHUfC1Tb6E4pudI9STA
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+optimize\/+.*?\/+(https?:\/\/)/, "$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nosub === "it4profit.com" && /^cdn[0-9]*\./.test(domain)) {
			// thanks to karpuzikov on github: https://github.com/qsniyg/maxurl/issues/1131
			// https://cdn0.it4profit.com/s3size/rt:fill/w:100/h:100/g:no/el:1/f:webp/plain/s3://cms/canyon/4d/b9/4db91b0dde37751a5ceaa0ddd9796d36/58794.png
			//   https://cdn0.it4profit.com/s3size/plain/s3://cms/canyon/4d/b9/4db91b0dde37751a5ceaa0ddd9796d36/58794.png
			return {
				url: src.replace(/\/s3size\/.*\/plain\//, "/s3size/plain/"),
				head_wrong_contenttype: true // no content-type
			};
		}

		if (domain === "imgproxy.fourthwall.com") {
			// thanks to jonestly on discord:
			// https://imgproxy.fourthwall.com/sEfWMOWL6dbnibEGgyk_95klTVDV4SG1t1xAeb9ox7s/w:900/plain/https://storage.googleapis.com/cdn.fourthwall.com/customization/sh_028c0a4d-a3f2-40c5-8a68-c25d442b55e1/81860bcf-f173-4d54-b466-ca643b82e7b8.jpeg
			//   https://storage.googleapis.com/cdn.fourthwall.com/customization/sh_028c0a4d-a3f2-40c5-8a68-c25d442b55e1/81860bcf-f173-4d54-b466-ca643b82e7b8.jpeg
			return src.replace(/^[a-z]+:\/\/[^/]+\/+[^/]+\/+(?:(?:w:[0-9]+|plain)\/+)+(https?:\/\/)/, "$1");
		}

		if (googlestorage_container === "cdn.fourthwall.com") {
			// thanks to jonestly on discord:
			// https://storage.googleapis.com/cdn.fourthwall.com/customization/sh_028c0a4d-a3f2-40c5-8a68-c25d442b55e1/81860bcf-f173-4d54-b466-ca643b82e7b8.jpeg
			//   https://cdn.fourthwall.com/customization/sh_028c0a4d-a3f2-40c5-8a68-c25d442b55e1/81860bcf-f173-4d54-b466-ca643b82e7b8.jpeg
			return src.replace(/.*?\/cdn\.fourthwall\.com\//, "https://cdn.fourthwall.com/");
		}

		if (domain === "img.fujisan.co.jp") {
			// thanks to fireattack on discord:
			// https://img.fujisan.co.jp/images/products/backnumbers/2211879_p.jpg
			//   https://img.fujisan.co.jp/images/products/backnumbers/2211879_o.jpg
			return src.replace(/(\/images\/+products\/+backnumbers\/+[0-9]+_)[tsmlp]\./, "$1o.");
		}

		if (domain === "gvimage.zype.com") {
			// https://gvimage.zype.com/53c0457a69702d4d66040000/60aaaa35fef3a40001e9ccde/custom_thumbnail/480.jpg
			//   https://gvimage.zype.com/53c0457a69702d4d66040000/60aaaa35fef3a40001e9ccde/custom_thumbnail/original.jpg
			return src.replace(/(\/custom_thumbnail\/+)[0-9]+\./, "$1original.");
		}

		if (domain === "asset.wsj.net" ||
			// https://images.wsj.net/im-20887?width=1260&aspect_ratio=1.5
			//   https://images.wsj.net/im-20887?width=0 -- 3000x2070
			// thanks to Liz on discord for reporting:
			// https://images.wsj.net/im-544027/?width=1260&size=1.5&pixel_ratio=2 -- 2520x1680
			//   https://images.wsj.net/im-544027?width=0 -- 5000x3333
			domain === "images.wsj.net") {
			return src.replace(/(\/im-[0-9]+)\/*(?:[?#].*)?$/, "$1?width=0");
		}

		if (domain_nowww === "acplasticsinc.com") {
			// thanks to ayunami2000 on github: https://github.com/qsniyg/maxurl/issues/1030
			// https://www.acplasticsinc.com/image?filename=good-things-about-plasic.jpg&width=100&height=100
			//   https://www.acplasticsinc.com/image?filename=good-things-about-plasic.jpg
			if (/\/image\?/.test(src)) {
				return keep_queries(src, "filename");
			}
		}

		if (domain_nosub === "storyblok.com") {
			// thanks to dym-sh on github: https://github.com/qsniyg/maxurl/issues/1031
			// https://www.storyblok.com/developers
			// https://www.storyblok.com/docs/image-service
			// https://a.storyblok.com/f/88751/1456x1094/5801a20855/visual-editor-ui.jpg/m/1000x0/
			//   https://a.storyblok.com/f/88751/1456x1094/5801a20855/visual-editor-ui.jpg/m/1000x0
			//   https://a.storyblok.com/f/88751/1456x1094/5801a20855/visual-editor-ui.jpg
			// https://a.storyblok.com/f/39898/3310x2192/e4ec08624e/demo-image.jpeg/m/200x0/filters:format(png)
			//   https://a.storyblok.com/f/39898/3310x2192/e4ec08624e/demo-image.jpeg
			return src.replace(/(\/f\/+[0-9]+\/.*\/[^/]+\.[^/.]+)\/m(?:\/+.*)?(?:[?#].*)?$/, "$1");
		}

		if (domain_nowww === "sq-lab.com" ||
			// https://heicko.de/out/pictures/generated/product/1/390_245_75/2022_hr_60.jpg
			//   https://heicko.de/out/pictures/master/product/1/2022_hr_60.jpg
			domain_nowww === "heicko.de") {
			// thanks to TheLastZombie on github: https://github.com/qsniyg/maxurl/issues/1034
			// https://www.sq-lab.com/out/pictures/generated/product/1/390_195_75/sqlab.sattel.6ox.infinergy.ergowave.active.2.1.main.jpg
			//   https://www.sq-lab.com/out/pictures/master/product/1/sqlab.sattel.6ox.infinergy.ergowave.active.2.1.main.jpg
			// https://www.sq-lab.com/modules/ajaxzoom/ajaxzoom/pic/zoomthumb/s/q/sqlab.sattel.6ox.infinergy.ergowave.active.2.1.main_1200x1200.jpg
			//   https://www.sq-lab.com/out/pictures/master/product/1/sqlab.sattel.6ox.infinergy.ergowave.active.2.1.main.jpg
			return src
				.replace(/\/out\/+pictures\/+generated\/+(product\/+[0-9]+)\/+[0-9]+_[0-9]+_[0-9]+\/+/, "/out/pictures/master/$1/")
				.replace(/\/modules\/+ajaxzoom\/+ajaxzoom\/+pic\/+zoomthumb\/+.\/+.\/+([^/]+?)(?:_[0-9]+x[0-9]+)(\.[^/.]+)(?:[?#].*)?$/, "/out/pictures/master/product/1/$1$2");
		}

		if (domain === "i.im.cz") {
			// thanks to ayunami2000 on github: https://github.com/qsniyg/maxurl/issues/1041
			// https://i.im.cz/a/c3B3aWxsaWFtc2lhbUBnbWFpbC5jb20AYXl1bmFtaTIwMDAA/40?r2=0.4934940655797597
			return src.replace(/(:\/\/[^/]+\/+a\/+[^/]+)\/[0-9]+(?:[?#].*)?$/, "$1");
		}

		if (domain === "content.minetest.net") {
			// https://content.minetest.net/thumbnails/2/98f8467549.jpg
			//   https://content.minetest.net/uploads/98f8467549.jpg
			return src.replace(/\/thumbnails\/+[0-9]+\/+/, "/uploads/");
		}

		if (domain === "img.freepik.com") {
			// https://img.freepik.com/free-vector/wrinkled-paper-texture_1100-12.jpg?size=158c&ext=jpg
			//   https://img.freepik.com/free-vector/wrinkled-paper-texture_1100-12.jpg?w=5000
			// thanks to Vuccala on discord for reporting:
			// https://img.freepik.com/free-photo/bigeared-fox-zoo_477814-3565.jpg -- 626x418
			//   https://img.freepik.com/free-photo/bigeared-fox-zoo_477814-3565.jpg?w=973 -- 973x649, not watermarked
			//   https://img.freepik.com/free-photo/bigeared-fox-zoo_477814-3565.jpg?w=5000 -- 2000x1334, watermarked
			// https://img.freepik.com/fotos-kostenlos/group-of-friends-dancing-outside-in-the-city_23-2149295713.jpg?w=974 -- 974x649, not watermarked, but 975(x650) is

			return [
				{
					// todo: check if image is wider or taller and use the opposite
					url: src.replace(/^([^?]+)(?:\?.*)?$/, "$1?h=5000"),
					problems: {
						watermark: true
					}
				},
				{
					url: src.replace(/^([^?]+)(?:\?.*)?$/, "$1?h=649"),
					problems: {
						// todo: check image dimensions
						smaller: true
					}
				}
			];
		}

		if (domain === "cdn-icons-png.freepik.com") {
			// thanks to anonymous for reporting:
			// https://cdn-icons-png.freepik.com/256/4173/4173082.png?semt=ais_hybrid
			//   https://cdn-icons-png.freepik.com/512/4173/4173082.png?semt=ais_hybrid
			return src.replace(/(:\/\/[^/]+\/+)(?:16|32|64|128|256)\/+/, "$1512/");
		}

		if (domain === "img.poipiku.com") {
			// thanks to contextnerror on github: https://github.com/qsniyg/maxurl/issues/1043
			// https://poipiku.com/1730391/6923507.html
			// https://img.poipiku.com/user_img03/001730391/006923507_LCCtJd0Fq.jpeg_640.jpg
			//   https://img-org.poipiku.com/user_img03/001730391/006923507_LCCtJd0Fq.jpeg
			newsrc = src.replace(/:\/\/[^/]+\/+(.*\.[^/._?#]+)_[0-9]+\.[^/.?#]+(?:[?#].*)?$/, "://img-org.poipiku.com/$1");
			if (newsrc !== src) {
				let pagematch = src.match(/\/user_img[0-9]+\/([0-9]+)\/+([0-9]+)_/);
				let page = null;
				if (pagematch)
					page = "https://poipiku.com/" + pagematch[1].replace(/^0+/, "") + "/" + pagematch[2].replace(/^0+/, "") + ".html";

				return {
					url: newsrc,
					headers: {
						Referer: page || "https://poipiku.com/1234567/7654321.html" // id doesn't matter, but this url pattern is needed
					},
					extra: {
						page: page
					}
				}
			}
		}

		if (domain_nosub === "amazonaws.com" && /^(?:cnt(?:-[0-9]+)?\.)?content(?:-[a-z]+)?\.drive\./.test(domain)) {
			// thanks to Dasbnow on discord for reporting:
			// https://www.amazon.es/photos/share/yyKtwNXeM8WJO0z0zcuTyM1tANUzzb3HGHgImw1bIHX/gallery/YToYn9R3Rx6VSYg6QFXSTg
			// https://cnt-02.content-eu.drive.amazonaws.com/cdproxy/templink/3EEF6AIRxlpmYN0KneT-fcATUWUPQECtNP2NyiupKI4eJxFPc?viewBox=1962%2C1308
			//   https://cnt-02.content-eu.drive.amazonaws.com/cdproxy/templink/3EEF6AIRxlpmYN0KneT-fcATUWUPQECtNP2NyiupKI4eJxFPc?viewBox=9999999 -- 5019x3346
			// https://content-na.drive.amazonaws.com/cdproxy/templink/tgpJAPrWo8NYjeCguw91mBZvFCGCnfS41ovXJT8Y_8cLAYspN/alt/thumb?viewBox=950
			return {
				url: src.replace(/(\/cdproxy\/+templink\/+[^/?#]+)(?:\/+alt\/+.*)?(?:[?#].*)?$/, "$1?viewBox=9999999"),
				can_head: false // 404
			};
		}

		if (domain_nosub === "anilist.co") {
			// https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx20987-9Tq7kZTeJPMo.jpg
			//   https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx20987-9Tq7kZTeJPMo.jpg
			//   https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx20987-9Tq7kZTeJPMo.jpg -- https://anilist.co/graphiql?query=%7B%0A%20%20Media(id%3A%2020987)%20%7B%0A%20%20%20%20coverImage%0A%20%20%7D%0A%7D%0A
			// https://s4.anilist.co/file/anilistcdn/media/manga/cover/small/bx80133-vfN4b7MXgHKC.png
			//   https://s4.anilist.co/file/anilistcdn/media/manga/cover/medium/bx80133-vfN4b7MXgHKC.png
			//   https://s4.anilist.co/file/anilistcdn/media/manga/cover/large/bx80133-vfN4b7MXgHKC.png -- https://anilist.co/graphiql?query=%7B%0A%20%20Media(id%3A%2080133)%20%7B%0A%20%20%20%20coverImage%0A%20%20%7D%0A%7D%0A
			// https://s4.anilist.co/file/anilistcdn/character/medium/b89019-sH6Zg8rpfPWD.png
			//   https://s4.anilist.co/file/anilistcdn/character/large/b89019-sH6Zg8rpfPWD.png -- https://anilist.co/graphiql?query=%7B%0A%20%20Character(id%3A%2089019)%20%7B%0A%20%20%20%20image%0A%20%20%7D%0A%7D%0A
			// https://s4.anilist.co/file/anilistcdn/staff/medium/n117229-szUrpjBEsjb5.jpg
			//   https://s4.anilist.co/file/anilistcdn/staff/large/n117229-szUrpjBEsjb5.jpg -- https://anilist.co/graphiql?query=%7B%0A%20%20Staff(id%3A%20117229)%20%7B%0A%20%20%20%20image%0A%20%20%7D%0A%7D%0A
			// https://s4.anilist.co/file/anilistcdn/user/avatar/medium/b132095-IBgYH9q60E43.png
			//   https://s4.anilist.co/file/anilistcdn/user/avatar/large/b132095-IBgYH9q60E43.png -- https://anilist.co/graphiql?query=%7B%0A%20%20User(id%3A%20132095)%20%7B%0A%20%20%20%20avatar%0A%20%20%7D%0A%7D%0A
			return src.replace(/(\/file\/anilistcdn\/.+)(?:small|medium)(\/)/, "$1large$2");
		}

		if (domain_nowww === "bldimg.com" || domain === "static.blued.com") {
			// thanks to doio on github: https://github.com/qsniyg/maxurl/issues/1054
			// https://static.blued.com/ingfiles/003/089/774/3089774_48822_1574212212.png
			//   https://static.blued.com/ingfiles/003/089/774/3089774_48822_1574212212.png!100x100.png
			//   https://static.blued.com/ingfiles/003/089/774/3089774_48822_1574212212.png!o.png -- appended !o.png can also be !original.png
			// https://static.blued.com/userfiles/010/783/863/56836!Head.jpg
			//   https://static.blued.com/userfiles/010/783/863/56836!Head.jpg!100x100.png
			//   https://static.blued.com/userfiles/010/783/863/56836!Head.jpg!o.png
			// https://www.bldimg.com/ingfiles/003/089/774/3089774_48822_1574212212.png -- https://www.bldimg.com/ and https://static.blued.com/ are interchangeable
			//   https://www.bldimg.com/ingfiles/003/089/774/3089774_48822_1574212212.png!100x100.png
			//   https://www.bldimg.com/ingfiles/003/089/774/3089774_48822_1574212212.png!o.png
			// https://www.bldimg.com/userfiles/010/783/863/56836!Head.jpg
			//   https://www.bldimg.com/userfiles/010/783/863/56836!Head.jpg!100x100.png
			//   https://www.bldimg.com/userfiles/010/783/863/56836!Head.jpg!o.png
			if (!/!o\.png$/.test(src)) {
				return src.replace(/(?:!\d+x\d+\.png)?$/, "!o.png");
			}
		}

		if (domain_nosub === "hhv.de") {
			// https://i4.cdn.hhv.de/catalog/475x475/00929/929409_2.jpg
			//   https://i4.cdn.hhv.de/catalog/shop_detail_zoom/00929/929409_2.jpg
			// thanks to anonymous for reporting:
			// https://a1.cdn.hhv.de/items/images/generated/475x475/01089/1089573/1-secteur-a-best-of-secteur-a.webp
			//   https://a1.cdn.hhv.de/items/images/generated/970x970/01089/1089573/1-secteur-a-best-of-secteur-a.webp
			return src
				.replace(/(\/catalog\/)(?:\d+x\d+)(\/\d+\/)/, "$1shop_detail_zoom$2")
				.replace(/(\/items\/+images\/+generated\/+)475x475\/+/, "$1970x970/");
		}

		if (domain === "d7qztf2ityad6.cloudfront.net") {
			// thanks to karpuzikov on github: https://github.com/qsniyg/maxurl/issues/1067
			// https://d7qztf2ityad6.cloudfront.net/23245/23245_pictures_product_visual_2.png?f=RB91,91
			//   https://d7qztf2ityad6.cloudfront.net/23245/23245_pictures_product_visual_2.png
			return remove_queries(src, "f");
		}

		if (domain === "img.ebay-kleinanzeigen.de") {
			// thanks to ABCFE on discord: https://github.com/qsniyg/maxurl/issues/1068
			// https://img.ebay-kleinanzeigen.de/api/v1/prod-ads/images/86/86687f14-c485-41ea-a0fe-8afd446babe9?rule=$_59.JPG -- https://www.ebay-kleinanzeigen.de/s-anzeige/canon-imagerunner-drucker/2211175347-225-3120
			//   https://img.ebay-kleinanzeigen.de/api/v1/prod-ads/images/86/86687f14-c485-41ea-a0fe-8afd446babe9?rule=$_57.JPG
			var queries = get_queries(src);
			queries.rule = queries.rule.replace(/\d+/, "57");
			return add_queries(src, queries);
		}

		if (domain === "img.bntnews.co.kr") {
			// thanks to f2005 on discord:
			// https://img.bntnews.co.kr/data/bnt/cache/2022/08/08/bnt202208080055.680x.9.jpg
			//   https://www.bntnews.co.kr/data/bnt/image/2022/08/08/bnt202208080055.jpg
			// thanks to anonymous for reporting:
			// https://img.bntnews.co.kr/data/bnt/image/2024/01/31/bnt202401310141.680x.9.jpg
			//   https://www.bntnews.co.kr/data/bnt/image/2024/01/31/bnt202401310141.jpg
			return src.replace(/^[a-z]+:\/\/[^/]+\/+(data\/+bnt\/+)(?:cache|image)\/+([0-9]{4}\/+[0-9]{2}\/+[0-9]{2}\/+bnt[0-9]{5,})\.[0-9]+x\.[0-9]+\./, "https://www.bntnews.co.kr/$1image/$2.");
		}

		if (domain === "a4tech.ua") {
			// thanks to karpuzikov on github: https://github.com/qsniyg/maxurl/issues/1072
			// https://a4tech.ua/media/catalog/product/cache/bd7365459ccd834b58cb6186a94ce68f/0602/0602063/04.jpg
			//   https://a4tech.ua/media/catalog/product/0602/0602063/04.jpg
			return src.replace(/\/cache\/[0-9a-f]+\//, "/");
		}

		if (domain === "cdn.coolermaster.com") {
			// thanks to karpuzikov on github: https://github.com/qsniyg/maxurl/issues/1074
			// https://cdn.coolermaster.com/media/assets/1023/ergostand-air-gallery-1-small.png -- resized
			//   https://cdn.coolermaster.com/media/assets/1023/ergostand-air-gallery-1-zoom.png -- upscaled
			//   https://cdn.coolermaster.com/media/assets/1023/ergostand-air-gallery-1.png -- original
			return src.replace(/-(?:bannerdesktop|bannermobile|column|desktop|hover|imageleftorright|intro|mobile|small|zoom)(\.)/, "$1");
		}

		if (domain_nowww === "westerndigital.com") {
			// thanks to karpuzikov on github: https://github.com/qsniyg/maxurl/issues/1075
			// https://www.westerndigital.com/content/dam/store/en-us/assets/products/usb-flash-drives/ultra-luxe-usb-3-1/gallery/ultra-luxe-usb-3-1-angle-down-left.png.wdthumb.319.319.webp
			//   https://www.westerndigital.com/content/dam/store/en-us/assets/products/usb-flash-drives/ultra-luxe-usb-3-1/gallery/ultra-luxe-usb-3-1-angle-down-left.png
			return src.replace(/\.wdthumb\.\d+\.\d+\.\w+/, "");
		}

		if (domain === "content.rozetka.com.ua") {
			// thanks to karpuzikov on github: https://github.com/qsniyg/maxurl/issues/1076
			// https://content.rozetka.com.ua/goods/images/preview/130983141.jpg
			//   https://content.rozetka.com.ua/goods/images/big/130983141.jpg
			//   https://content.rozetka.com.ua/goods/images/original/130983141.jpg
			return src.replace(/(\/images\/)(?:preview|big)(\/)/, "$1original$2");
		}

		if (domain_nowww === "verbatim-marcom.com") {
			// thanks to karpuzikov on github: https://github.com/qsniyg/maxurl/issues/1077
			// https://www.verbatim-marcom.com/view-product-image-id/png-thumbnail_6/335472
			//   https://www.verbatim-marcom.com/view-product-image-id/335472 -- larger, but not transparent
			return src.replace(/(\/view-product-image-id)\/png-thumbnail_\d+(\/\d+)/, "$1$2");
		}

		if (domain === "static.bhphoto.com") {
			// thanks to karpuzikov on github: https://github.com/qsniyg/maxurl/issues/1083
			// https://static.bhphoto.com/images/images150x150/1547727640_1453015.jpg
			//   https://static.bhphoto.com/images/images2500x2500/1547727640_1453015.jpg
			// other:
			// https://static.bhphoto.com/images/multiple_images/images500x500/1664354722_IMG_1847915.jpg -- 2500x2500 doesn't work, only 1000x1000
			// https://static.bhphoto.com/images/multiple_images/images2500x2500/1486481459000_IMG_747607.jpg
			return src.replace(/(\/images\/+images)[0-9]+x[0-9]+\//, "$12500x2500/");
		}

		if (domain === "cdnstatic.rg.ru") {
			// thanks to roi:
			// https://cdnstatic.rg.ru/crop300x200/uploads/images/2022/10/25/11p_niz-1_c44.jpg
			//   https://cdnstatic.rg.ru/uploads/images/2022/10/25/11p_niz-1_c44.jpg
			// https://cdnstatic.rg.ru/resize925x617/uploads/images/2022/10/25/11p_niz-1_c44.jpg
			//   https://cdnstatic.rg.ru/uploads/images/2022/10/25/11p_niz-1_c44.jpg
			return src.replace(/\/(?:resize|crop)[0-9]+x[0-9]+\/+uploads\/+/, "/uploads/");
		}

		if (domain_nowww === "sport24.gr") {
			// https://www.sport24.gr/img/5368/9807002/390000/wsq100/100/xavi-barcelona.jpg
			//   https://www.sport24.gr/img/3615/9807002/390000/we1200/1200/xavi-barcelona.jpg
			//   https://www.sport24.gr/img/app/9807002/0/o/0/0/xavi-barcelona.jpg -- 1200x800
			// https://www.sport24.gr/img/7753/9777137/843000/we720/720/sterling.jpg
			//   https://www.sport24.gr/img/app/9777137/0/o/0/0/sterling.jpg
			// https://www.sport24.gr/img/1746/8274244/951000/o/480/0/untitled_7.jpg -- 440x4752
			//   https://www.sport24.gr/img/app/8274244/0/o/0/0/untitled_7.jpg -- 440x4752
			return src.replace(/\/img\/+[0-9]+\/+([0-9]+)\/+[0-9]+\/+[a-z]+[0-9]*\/+[0-9]+\/+(?:[0-9]+\/+)?([^/]+(?:[?#].*)?)$/, "/img/app/$1/0/o/0/0/$2");
		}

		if (domain === "s74794.cdn.ngenix.net" ||
			// thanks to roi:
			// https://cdn-m.sport24.ru/m/d54b/2951/2a34/49a1/aa9e/6605/9d2c/0732/600_600_max.jpeg
			//   https://cdn-m.sport24.ru/m/d54b/2951/2a34/49a1/aa9e/6605/9d2c/0732.jpeg
			domain === "cdn-m.sport24.ru") {
			// thanks to roi:
			// https://sport24.ru/
			// https://s74794.cdn.ngenix.net/m/d54b/2951/2a34/49a1/aa9e/6605/9d2c/0732/600_600_max.jpeg
			//   https://s74794.cdn.ngenix.net/m/d54b/2951/2a34/49a1/aa9e/6605/9d2c/0732/600_600.jpeg
			//   https://s74794.cdn.ngenix.net/m/d54b/2951/2a34/49a1/aa9e/6605/9d2c/0732.jpeg -- 1600x900
			// https://s74794.cdn.ngenix.net/m/3ebb/55d5/6145/47cb/8a21/847d/49c5/b398/3009_2334.jpeg(spartak.ru)!p(infographics).%20!c16c/f22c/23fe/4889/b345/562e/c3cf/9829/3009_2334.jpeg(spartak.ru)!p(infographics).%20!e4ad/e53f/dfea/41cc/b95b/6857/9449/a331/300_300_max.jpeg(spartak
			//   https://s74794.cdn.ngenix.net/m/3ebb/55d5/6145/47cb/8a21/847d/49c5/b398.jpeg -- 3009x2334
			return src.replace(/\/m((?:\/+[0-9a-f]{4}){8})\/[^/]*?(\.[^/.?#()!%]+?)(?:[?#()!%].*)?$/, "/m$1$2");
		}

		if (domain === "static.news.ru") {
			// thanks to roi:
			// https://static.news.ru/photo/e225937e-5484-11ed-8ac6-02420a0000c9_760.jpg
			//   https://static.news.ru/photo/e225937e-5484-11ed-8ac6-02420a0000c9.jpg -- 1600x1067
			return src.replace(/(\/photo\/+[-0-9a-f]{20,})_[0-9]+\./, "$1.");
		}

		if (domain === "images.sportschau.de") {
			// thanks to roi:
			// https://images.sportschau.de/image/b7c90d9a-7ca0-4595-a2ec-1ac31a2df6d8/AAABhA9yWBc/AAABg8tMRzY/20x9-1280/hr-die-mittelfeldspieler-sebastian-rode-daichi-kamada-mario-goetze-und-djibril-sow-glaenzen-bei-der-eintracht-100.jpg
			//   https://images.sportschau.de/image/b7c90d9a-7ca0-4595-a2ec-1ac31a2df6d8/AAABhA9yWBc/AAABg8tMRzY/original/hr-die-mittelfeldspieler-sebastian-rode-daichi-kamada-mario-goetze-und-djibril-sow-glaenzen-bei-der-eintracht-100.jpg -- 3240x2160
			// https://images.sportschau.de/image/81c6438d-78ba-483c-9446-17175da28a2c/AAABg6LfHlc/AAABg8tMTgI/1x1-256.jpg
			//   https://images.sportschau.de/image/81c6438d-78ba-483c-9446-17175da28a2c/AAABg6LfHlc/AAABg8tMTgI/original.jpg -- 2048x1365
			return src.replace(/(\/image\/+[-0-9a-f]{20,}\/+[^/]+\/+[^/]+\/+)[0-9]+x[0-9]+-[0-9]+([/.])/, "$1original$2");
		}

		if (domain_nowww === "induna.com") {
			// thanks to tathastu871 on github: https://github.com/qsniyg/maxurl/issues/1084
			// https://www.induna.com/uploaded_images/dvd_vcd_master/thumbnails/01_07_00_dvd%2024.jpg
			//   https://www.induna.com/uploaded_images/dvd_vcd_master/original/01_07_00_dvd%2024.jpg
			return src.replace(/(\/uploaded_images\/+[^/]+\/+)[a-z]+\/+/, "$1original/");
		}

		if (domain_nowww === "shadeddog.com") {
			// thanks to tathastu871 on github: https://github.com/qsniyg/maxurl/issues/1086
			// https://www.shadeddog.com/images/rca_lsc-1806_thumb.jpg
			//   https://www.shadeddog.com/images/rca_lsc-1806_small.jpg
			//   http://www.shadeddog.com/images/rca_lsc-1806.jpg
			return src.replace(/(\/images\/+[^/]+)_(?:thumb|small)\./, "$1.");
		}

		if (domain === "i.maniadb.com") {
			// thanks to tathastu871 on github: https://github.com/qsniyg/maxurl/issues/1087
			// http://i.maniadb.com/images/album_t/80/968/968531_1_f.jpg
			//   https://i.maniadb.com/image.php?path=/images/album_t/80/968/968531_1_f.jpg
			//   http://i.maniadb.com/image.php?path=/images/album/968/968531_1_f.jpg -- 800x800
			// http://i.maniadb.com/images/artist_t/120/112/112817.jpg
			//   http://i.maniadb.com/images/artist/112/112817.jpg
			return src.replace(/\/images\/+(album|artist)_t\/+[0-9]+\/+/, "/images/$1/");
		}

		if (domain === "furry34.com" ||
			// thanks to Drflash55 on discord:
			// https://furry34com.b-cdn.net/posts/242/242373/242373.pic256avif.avif
			//   https://furry34com.b-cdn.net/posts/242/242373/242373.pic.jpg
			domain === "furry34com.b-cdn.net" ||
			// thanks to anonymous for reporting:
			// https://rule34storage.b-cdn.net/posts/240/240032/240032.pic256avif.avif
			//   https://rule34storage.b-cdn.net/posts/240/240032/240032.pic.jpg
			domain === "rule34storage.b-cdn.net" ||
			domain_nowww === "rule34.world") {
			// thanks to Drflash55 on discord:
			// https://furry34.com/posts/242/242373/242373.pic256avif.avif
			//   https://furry34.com/posts/242/242373/242373.picsmall.jpg
			//   https://furry34.com/posts/242/242373/242373.pic.jpg
			newsrc = src.replace(/(:\/\/[^/]+\/+posts\/+[0-9]+\/+[0-9]+\/+[0-9]+)\.[^/.]+(\.[^/.]+)(?:[?#].*)?$/, "$1.pic$2");
			if (newsrc !== src) {
				return fillobj_urls(add_extensions(newsrc), {
					headers: {
						Referer: "https://" + domain + "/"
					},
					referer_ok: {
						same_domain: true
					}
				});
			}
		}

		if (domain_nosub === "kemono.party" ||
			// thanks to beeznutsonly on github: https://github.com/qsniyg/maxurl/issues/1275
			domain_nosub === "kemono.su" ||
			// thanks to vscum on github: https://github.com/qsniyg/maxurl/pull/1137
			domain_nosub === "coomer.party" ||
			// thanks to beeznutsonly on github: https://github.com/qsniyg/maxurl/issues/1276
			domain_nosub === "coomer.su" ||
			// thanks to anonymous for reporting:
			domain_nosub === "nekohouse.su") {
			// thanks to BrandonKMLee on github: https://github.com/qsniyg/maxurl/issues/1093
			// https://kemono.party/thumbnail/data/30/34/3034877e08c6b13c03db53879464858ae4a4f8f2360c7755d16a241a2613e12c.png
			//   https://data65.kemono.party/data/30/34/3034877e08c6b13c03db53879464858ae4a4f8f2360c7755d16a241a2613e12c.png
			// https://img.kemono.party/thumbnail/data/30/34/3034877e08c6b13c03db53879464858ae4a4f8f2360c7755d16a241a2613e12c.png
			//   https://c6.kemono.party/data/30/34/3034877e08c6b13c03db53879464858ae4a4f8f2360c7755d16a241a2613e12c.png
			newsrc = src.replace(/\/thumbnail\/+data\/+/, "/data/");
			if (newsrc !== src)
				return newsrc.replace(/:\/\/img\./, "://c1.");
		}

		if (domain === "assistant.gloria.tv") {
			// https://assistant.gloria.tv/1z94gyaCTBei3D8MsGrYwjE6j/0mjj3brlc4t0hkd7ahx704m0o8sih0ewktgkect.webp?secure=[...]&expires=[...]&scale=256&webp=on -- 256x178
			//   https://assistant.gloria.tv/1z94gyaCTBei3D8MsGrYwjE6j/0mjj3brlc4t0hkd7ahx704m0o8sih0ewktgkect.webp?secure=[...]&expires=[...] -- 1739x1209
			newsrc = keep_queries(src, ["secure", "expires"]);
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nowww === "gloria.tv") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+post\/+([a-zA-Z0-9]{10,})(?:\/.*)?(?:[?#].*)?$/,
				query_for_id: "https://gloria.tv/post/${id}",
				process: function(done, resp, cache_key) {
					var sources = common_functions["get_videotag_sources"](resp.responseText);
					if (!sources || !sources.video) {
						console_error(cache_key, "Unable to find sources in", resp);
						return done(null, false);
					}

					sources.video.sort((a, b) => {
						if (a.args.type === "application/x-mpegurl")
							return -1;
						if (b.args.type === "application/x-mpegurl")
							return 1;

						var a_quality_str = a.args["data-quality"];
						var b_quality_str = b.args["data-quality"];

						if (!a_quality_str || !b_quality_str) {
							console_warn(cache_key, "Unable to find data-quality in", a, b);
							return 0;
						}

						var a_quality = JSON_parse(a_quality_str);
						var b_quality = JSON_parse(b_quality_str);

						return b_quality.bitrate - a_quality.bitrate;
					});

					var extra = {};

					var datetime_match = resp.responseText.match(/<a href="[^"]+\/replies".*<time datetime="([^"]+)"/);
					if (datetime_match)
						extra.created_date = new Date(datetime_match[1]).getTime();

					var title = get_meta(resp.responseText, "og:title");
					if (title)
						extra.caption = title;
					extra.page = resp.finalUrl;

					var urls = [];
					array_extend(urls, array_map(sources.video, value => {
						var url = value.url;
						var video:VideoProp = true;
						var can_head = true;
						if (value.args.type === "application/x-mpegurl") {
							video = "hls";
							can_head = false; // 405
						}

						return {
							url: urljoin(resp.finalUrl, url, true),
							headers: {
								Referer: resp.finalUrl
							},
							can_head,
							video
						};
					}));
					array_extend(urls, sources.image);

					return done(fillobj_urls(urls, {extra}), 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (host_domain_nowww === "gloria.tv") {
			if (options.element && options.do_request && options.cb) {
				let element = common_functions["get_parent_el_matching"](options.element, function(x) {
					return x.hasAttribute("data-notify");
				});

				if (element) {
					try {
						let media = JSON_parse(element.getAttribute("data-notify"));
						if (media.id) {
							return {
								url: "https://gloria.tv/post/" + media.id,
								is_pagelink: true
							};
						}
					} catch (e) {
						console_error(e);
					}
				} else if (options.host_url && options.element.tagName === "VIDEO" && options.element.matches("div.leading > header > figure.video > video")) {
					return {
						url: options.host_url,
						is_pagelink: true
					};
				}
			}

			if (!src && origsrc && options.element && options.element.classList.contains("play")) {
				return {
					url: origsrc,
					bad: "mask"
				};
			}
		}

		if (domain === "images.plex.tv") {
			// https://images.plex.tv/photo?size=medium-360&scale=1&url=https%3A%2F%2Fimage.tmdb.org%2Ft%2Fp%2Foriginal%2FfCJx7cCXKOEkmCVIIyP8qk0Pb7Y.jpg
			//   https://image.tmdb.org/t/p/original/fCJx7cCXKOEkmCVIIyP8qk0Pb7Y.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+photo\?(?:.*&)?url=([^&]+).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nowww === "govdeals.com") {
			// thanks to Luke-L on github: https://github.com/qsniyg/maxurl/pull/1116
			// https://www.govdeals.com/photos/6794/Thumbnails/6794_3402_1-1.jpg
			//   https://www.govdeals.com/photos/6794/6794_3402_1-1.jpg
			// https://www.govdeals.com/photos/19968/thumbnails/19968_311_1.jpg
			//   https://www.govdeals.com/photos/19968/19968_311_1.jpg
			// https://www.govdeals.com/photos/19968/Thumbs/19968_311_1.jpg
			//   https://www.govdeals.com/photos/19968/19968_311_1.jpg
			return src.replace(/(\/photos\/+\d+\/+)thumb(?:nail)?s\/+(.*)/i, "$1$2");
		}

		if (domain_nowww === "isplus.com") {
			// thanks to f2005 on discord:
			// https://isplus.com/data/isp/image/2023/01/16/isp20230116000164.600x.8.jpg
			//   https://isplus.com/data/isp/image/2023/01/16/isp20230116000164.jpg -- 3388x2000
			return src.replace(/(\/data\/+isp\/+image\/+.*)\.[0-9]+x\.[0-9]+(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "cdn.aniplaylist.com") {
			// thanks to jonestly on discord:
			// https://cdn.aniplaylist.com/thumbnails/879e32b73bf3c27809afcfeec69b5cf91a609fd4@2xl.jpg
			//   https://cdn.aniplaylist.com/thumbnails/879e32b73bf3c27809afcfeec69b5cf91a609fd4.jpg -- 3000x2670
			return src.replace(/(\/thumbnails\/+[0-9a-f]+)@[0-9a-z]+\./, "$1.");
		}

		if (domain === "statics.tver.jp") {
			// thanks to nimbuz on discord:
			// https://statics.tver.jp/images/content/thumbnail/episode/small/epck7hqdbe.jpg?v=5
			//   https://statics.tver.jp/images/content/thumbnail/episode/xlarge/epck7hqdbe.jpg?v=5
			// https://statics.tver.jp/images/content/thumbnail/episode/medium/epck7hqdbe.jpg?v=5
			//   https://statics.tver.jp/images/content/thumbnail/episode/xlarge/epck7hqdbe.jpg?v=5
			// https://statics.tver.jp/images/content/thumbnail/episode/large/epck7hqdbe.jpg?v=5
			//   https://statics.tver.jp/images/content/thumbnail/episode/xlarge/epck7hqdbe.jpg?v=5
			return src.replace(/(\/images\/+content\/+thumbnail\/+[^/]+\/+)(?:small|medium|large)\/+/, "$1xlarge/");
		}

		if (domain_nowww === "tver.jp") {
			// thanks to nimbuz for reporting:
			let query_tver_episode = function(id, cb) {
				api_query("tver:" + id, {
					url: "https://statics.tver.jp/content/episode/" + id + ".json?v=3",
					imu_mode: "xhr",
					headers: {
						Origin: "https://tver.jp",
						Referer: "https://tver.jp/",
						"Sec-Fetch-Dest": "empty",
						"Sec-Fetch-Mode": "cors",
						"Sec-Fetch-Site": "same-site"
					},
					json: true
				}, cb, function(done, resp, cache_key) {
					if (!resp) {
						return done(null, false);
					}

					let accountid = resp.video.accountID;
					let videoid = resp.video.videoID;

					let url = "https://players.brightcove.net/" + accountid + "/default_default/index.html?videoId=" + videoid;
					done(url, 6*60*60);
				});
			};

			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+episodes\/+([0-9a-z]+)(?:[?#].*)?$/,
				run(cb, match) {
					let ep = match[1];
					query_tver_episode(ep, function(url) {
						if (!url) {
							return cb(null);
						}

						return cb({
							url: url,
							is_pagelink: true
						});
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "ais-cf.tvnow.de") {
			// thanks to nimbuz on discord:
			// https://ais-cf.tvnow.de/tvnow/format/19445_03artwork/1400x0/eine-schrecklich-nette-familie.jpg
			//   https://ais-cf.tvnow.de/tvnow/format/19445_03artwork/eine-schrecklich-nette-familie.jpg
			return src.replace(/\/[0-9]+x[0-9]+\/+([^/]+)(?:[?#].*)?$/, "/$1");
		}

		if (domain === "images.fanseven.com") {
			// thanks to Broly on discord:
			// https://images.fanseven.com/?t=squaredown&bg=%23eeeeee&w=400&url=fan7.s3.eu-west-1.amazonaws.com%2Flittleprincess%2F1621c41d91520077
			//   http://fan7.s3.eu-west-1.amazonaws.com/littleprincess/1621c41d91520077
			let queries = get_queries(src);
			if (queries.url) {
				return add_http(decodeURIComponent(queries.url));
			}
		}

		if (domain === "static.harpersbazaar.de") {
			// thanks to sn3akyb3ar on github for reporting: https://github.com/qsniyg/maxurl/issues/1126
			// https://static.harpersbazaar.de/fit/2756x2756/images/2023-02/o5a4227.jpg -- 2756x2756
			//   https://static.harpersbazaar.de/fit/0x0/images/2023-02/o5a4227.jpg -- 2756x4134
			return src.replace(/\/fit\/+[0-9]+x[0-9]+\/+/, "/fit/0x0/");
		}

		if (domain === "img.gazeta.ru") {
			// thanks to roi:
			// https://img.gazeta.ru/files3/713/15638713/upload-8T4A0710-pic4_zoom-1500x1500-39398.jpg
			//   https://img.gazeta.ru/files3/713/15638713/upload-8T4A0710.jpg
			// `https://img.gazeta.ru/files3/827/15917827/upload-RIA_8335999.HR.-pic_32ratio_900x600-900x600-66422.jpg`
			//   https://img.gazeta.ru/files3/827/15917827/upload-RIA_8335999.HR..jpg
			// https://img.gazeta.ru/files3/784/13456784/AP_21025219541639-pic905-895x505-37993.jpg
			//   https://img.gazeta.ru/files3/784/13456784/AP_21025219541639.jpg
			return src.replace(/(\/files[0-9]*\/+[0-9]+\/+[0-9]+\/+[^/]+)-pic[0-9]*(?:_[0-9a-z_]+)?-[0-9]+x[0-9]+-[0-9]+\./, "$1.");
		}

		if (domain === "cdn.iportal.ru") {
			// thanks to roi:
			// https://cdn.iportal.ru/news/2015/99/preview/56c27638f8ce6de8e388982c4212baf3093210ce_727.jpg.webp-portal
			//   https://cdn.iportal.ru/news/2015/99/preview/56c27638f8ce6de8e388982c4212baf3093210ce.jpg
			return src
				.replace(/\.webp-portal(?:[?#].*)?$/, "")
				.replace(/(\/preview\/+[0-9a-f]+)_[0-9]+\./, "$1.");
		}

		if (domain === "imaginary.abcmedia.no" ||
			// thanks to roi:
			// https://images.ladbible.com/resize?type=webp&quality=70&width=308&fit=contain&gravity=auto&dpr=1&url=https://eu-images.contentstack.com/v3/assets/bltcd74acc1d0a99f3a/bltb138a72b94fa54cb/63f8f8007999c411d98ab1ab/paul_mescal.png
			//   https://eu-images.contentstack.com/v3/assets/bltcd74acc1d0a99f3a/bltb138a72b94fa54cb/63f8f8007999c411d98ab1ab/paul_mescal.png
			domain === "images.ladbible.com") {
			// thanks to roi:
			// https://imaginary.abcmedia.no/resize?force=false&width=1024&aspectratio=16:9&nocrop=false&interlace=true&url=https://abcnyheter.drpublish.aptoma.no/out/images/article//2022/02/15/195825177/1/original/59442916.jpg
			//   https://abcnyheter.drpublish.aptoma.no/out/images/article//2022/02/15/195825177/1/original/59442916.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+resize\?(?:.*&)?url=([^&#]+).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "storage.tele-sport.ru") {
			// thanks to roi:
			// https://storage.tele-sport.ru/files/filter/992_auto/default/upload/d991/62eb/d99162ebeec7eb7751d583ef7888c6c8.jpg.webp
			//   https://storage.tele-sport.ru/files/default/upload/d991/62eb/d99162ebeec7eb7751d583ef7888c6c8.jpg
			return src
				.replace(/(\.[a-z]+)\.webp(?:[?#].*)?$/, "$1")
				.replace(/\/files\/+filter\/+[^/]+\/+/, "/files/");
		}

		if (domain_nowww === "wabe.org") {
			// thanks to roi:
			// https://www.wabe.org/app/uploads/2022/02/AP22038166751600-scaled.jpg-1440x810-1644272631.jpg
			//   https://www.wabe.org/app/uploads/2022/02/AP22038166751600-scaled.jpg
			//   https://www.wabe.org/app/uploads/2022/02/AP22038166751600.jpg
			// https://www.wabe.org/app/uploads/news/npr-stories/gettyimages-1369056979-70d6746912be299bdc3f896599f043156c971136-1440x810.jpg
			//   https://www.wabe.org/app/uploads/news/npr-stories/gettyimages-1369056979-70d6746912be299bdc3f896599f043156c971136.jpg
			// https://www.wabe.org/app/uploads/2023/02/20230223SB63GALeg-415-416x234.jpg
			//   https://www.wabe.org/app/uploads/2023/02/20230223SB63GALeg-415.jpg
			return src
				.replace(/-[0-9]+x[0-9]+(\.[^-/.]+)(?:[?#].*)?$/, "$1")
				.replace(/-scaled(\.[^-/.]+)(?:[?#].*)?$/, "$1")
				.replace(/(\.[a-z]+)-[0-9]+x[0-9]+-[0-9]{9,}\.[^/.]+(?:[?#].*)?$/, "$1");
		}

		if (domain === "s.france24.com" ||
			// thanks to roi:
			// https://s.rfi.fr/media/display/69c85e18-b44a-11ed-88cc-005056a90284/w:720/p:16x9/2023-02-24T124016Z_178152957_RC2OHZ9CZGW1_RTRMADP_3_G20-INDIA-FRANCE.webp
			//   https://s.rfi.fr/media/display/69c85e18-b44a-11ed-88cc-005056a90284/2023-02-24T124016Z_178152957_RC2OHZ9CZGW1_RTRMADP_3_G20-INDIA-FRANCE.jpg
			domain === "s.rfi.fr") {
			// thanks to roi:
			// https://s.france24.com/media/display/69819f26-91a7-11ec-85a0-005056a90284/w:1024/p:16x9/000_323F444.webp
			//   https://s.france24.com/media/display/69819f26-91a7-11ec-85a0-005056a90284/000_323F444.jpg
			return {
				url: src
					.replace(/\.webp(?:[?#].*)?$/, ".jpg")
					.replace(/(\/media\/+display\/+[-0-9a-f]+\/+)(?:[wp]:[^/]+\/+)+/, "$1"),
				head_wrong_contentlength: true
			};
		}

		if (domain === "s3-images.sportnews.bz") {
			// thanks to roi:
			// https://s3-images.sportnews.bz/_images/fit/759x427/img/2023/02/thomas-mitterer-beendet-seine-karriere.jpg
			//   https://s3-images.sportnews.bz/img/2023/02/thomas-mitterer-beendet-seine-karriere.jpg
			return src.replace(/\/_images\/+.*?\/+img\//, "/img/");
		}

		if (domain_nowww === "vmcdn.ca") {
			// thanks to roi:
			// https://www.vmcdn.ca/f/files/richmondnews/images/sports/amy-yang.jpg;w=960;h=640;bgcolor=000000
			//   https://www.vmcdn.ca/f/files/richmondnews/images/sports/amy-yang.jpg
			return src.replace(/(\/f\/+files\/+.*)(?:;[a-z]+=[^;]+)+([?&#].*)?$/, "$1");
		}

		if (domain === "img.myslo.ru") {
			// thanks to roi:
			// https://img.myslo.ru/Photogallery/b0/ab/b0ab2c32-10db-402f-86ca-d48dcd033678_b.jpg
			//   https://img.myslo.ru/Photogallery/b0/ab/b0ab2c32-10db-402f-86ca-d48dcd033678_o.jpg
			// https://img.myslo.ru/Photogallery/34/16/3416e81c-b0be-4b3f-9b12-146a2217d23a_b.jpg
			//   https://img.myslo.ru/Photogallery/34/16/3416e81c-b0be-4b3f-9b12-146a2217d23a_o.jpg
			// other:
			// https://img.myslo.ru/Contents/10/5f/432d-74b8-492f-b343-ecf58f68a8ee/43bf69d5-5516-4ff5-832b-e2b25a0fedd9.jpg
			// https://img.myslo.ru/NewsImage/2e/6b/2e6b4abf-a5e8-48f6-9363-19be44cd5e13_1.jpg
			// https://img.myslo.ru/CityImage/02/a6/02a6aab8-5f59-4161-bbbd-e4bf6f5a961b_1.jpg
			// https://img.myslo.ru/Pressa/Image/86/99/8699b4c2-daa0-447f-a6d2-c64744c958c2_1.jpg
			return src.replace(/(\/photogallery\/+(?:[0-9a-f]{2}\/+){2}[-0-9a-f]{10,})_[a-z]\./i, "$1_o.");
		}

		if (domain === "img.tsargrad.tv") {
			// thanks to roi:
			// https://img.tsargrad.tv/cache/2/d/Interview_baranec_240223.jpg/w627h353fill.jpg
			//   https://img.tsargrad.tv/2/d/Interview_baranec_240223.jpg
			return src.replace(/\/cache\/+((?:[0-9a-f]\/+){2}[^/]+)\/+.*/, "/$1");
		}

		if (domain === "cdnlv.redkassa.ru") {
			// thanks to roi:
			// https://cdnlv.redkassa.ru/live/sitenew/picture/31399dd8-58db-44ad-8eb5-625faf00c083/418/246/false
			//   https://cdnlv.redkassa.ru/live/sitenew/picture/31399dd8-58db-44ad-8eb5-625faf00c083
			return src.replace(/(\/picture\/+[-0-9a-f]{20,})\/+[0-9]+\/+[0-9]+\/+[a-z]+(?:[?#].*)?$/, "$1");
		}

		if (domain_nowww === "wa.de" ||
			// thanks to roi for reporting:
			// https://www.ovb-online.de/bilder/2023/04/25/92235424/31215891-es-gehen-wohl-die-lichter-aus-karstadt-in-rosenheim-steht-auf-der-streichliste-xSG.jpg
			//   https://www.ovb-online.de/bilder/2023/04/25/92235424/31215891-es-gehen-wohl-die-lichter-aus-karstadt-in-rosenheim-steht-auf-der-streichliste.jpg
			// https://www.ovb-online.de/bilder/2023/04/25/92235194/31530382-im-bereich-des-soccer-feldes-hinter-dem-haus-des-buches-hintergrund-kam-es-am-montag-24-april-zu-einem-versuchten-ueberfall-1wSG.jpg
			//   https://www.ovb-online.de/bilder/2023/04/25/92235194/31530382-im-bereich-des-soccer-feldes-hinter-dem-haus-des-buches-hintergrund-kam-es-am-montag-24-april-zu-einem-versuchten-ueberfall.jpg
			// https://www.ovb-online.de/images/ovb-online-de/img/rose_maria_478x478-20201008202706-OoUI.jpg
			//   https://www.ovb-online.de/images/ovb-online-de/img/rose_maria_478x478-20201008202706.jpg -- 478x478
			// https://www.ovb-online.de/bilder/2023/04/25/92235452/31530775-die-geplanten-warnstreiks-im-oepnv-koennten-auch-auswirkungen-auf-die-beginnenden-abiturpruefungen-in-bayern-haben-4770.jpg
			//   https://www.ovb-online.de/bilder/2023/04/25/92235452/31530775-die-geplanten-warnstreiks-im-oepnv-koennten-auch-auswirkungen-auf-die-beginnenden-abiturpruefungen-in-bayern-haben.jpg
			// https://www.ovb-online.de/bilder/2023/04/19/92222082/31483794-ein-braunbaer-sorgt-fuer-unbehagen-im-bereich-wildbarren-und-bichler-see-spuren-im-schnee-vor-der-felix-alm-z75.jpg
			//   https://www.ovb-online.de/bilder/2023/04/19/92222082/31483794-ein-braunbaer-sorgt-fuer-unbehagen-im-bereich-wildbarren-und-bichler-see-spuren-im-schnee-vor-der-felix-alm.jpg
			// https://www.ovb-online.de/bilder/2023/04/25/92235634/31530226-der-20-jaehrige-ryan-gravenberch-ist-meist-nur-reservespieler-beim-fc-bayern-2n2d34BEro73.jpg
			//   https://www.ovb-online.de/bilder/2023/04/25/92235634/31530226-der-20-jaehrige-ryan-gravenberch-ist-meist-nur-reservespieler-beim-fc-bayern.jpg
			// https://www.ovb-online.de/bilder/2023/04/25/92235634/31530226-der-20-jaehrige-ryan-gravenberch-ist-meist-nur-reservespieler-beim-fc-bayern-2n2d34BEroa7.jpg
			//   https://www.ovb-online.de/bilder/2023/04/25/92235634/31530226-der-20-jaehrige-ryan-gravenberch-ist-meist-nur-reservespieler-beim-fc-bayern.jpg
			domain_nowww === "ovb-online.de") {
			// thanks to roi for reporting:
			// https://www.wa.de/bilder/2023/02/24/92107515/30890240-muellabfuhr-streik-in-muenster-betroffen-im-hintergrund-liegen-volle-muellsaecke-auf-der-strasse-2jTsMIjTBGVI.jpg -- 334x188
			//   https://www.wa.de/bilder/2023/02/24/92107515/30890240-muellabfuhr-streik-in-muenster-betroffen-im-hintergrund-liegen-volle-muellsaecke-auf-der-strasse.jpg -- 1920x1080
			// https://www.wa.de/bilder/2023/02/24/92108789/30993785-nuss-produkte-bei-aldi-sued-und-aldi-nord-sind-von-einem-rueckruf-betroffen-1iVI.jpg -- 334x188
			//   https://www.wa.de/bilder/2023/02/24/92108789/30993785-nuss-produkte-bei-aldi-sued-und-aldi-nord-sind-von-einem-rueckruf-betroffen.jpg -- 3200x2160
			// https://www.wa.de/bilder/2023/02/23/92107665/30987941-sky-kommentator-marcus-lindemann-bei-einem-bundesligaspiel-in-moenchengaldbach-2Bll4sLLwoVI.jpg -- 334x188
			//   https://www.wa.de/bilder/2023/02/23/92107665/30987941-sky-kommentator-marcus-lindemann-bei-einem-bundesligaspiel-in-moenchengaldbach-2Bll4sLLwo70.jpg -- 758x432
			//   https://www.wa.de/bilder/2023/02/23/92107665/30987941-sky-kommentator-marcus-lindemann-bei-einem-bundesligaspiel-in-moenchengaldbach.jpg -- 4252x2835
			// https://www.wa.de/bilder/2023/02/24/92108789/30994945-das-bild-zeigt-fuenf-die-jeweils-100-grammpackungen-der-zurueckgerufenen-pistazienkerne-1hEvTm08TW73.jpg -- 768x586
			return {
				url: src.replace(/((?:\/bilder\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9]+\/+[0-9]+-[^/]+|\/images\/+[^/]+\/+img\/+[^/]*-[0-9]{10,}))-[0-9a-zA-Z]+(?:[UV]I|SG|[0-9a-f]{2})\./, "$1."),
				norecurse: true
			};
		}

		if (domain === "cdn.schweizer-illustrierte.ch") {
			// thanks to roi:
			// https://cdn.schweizer-illustrierte.ch/fp/1155/770/320/203/sites/default/files/media/field_image/2022-11/denise_bielmann_1.jpg
			//   https://cdn.schweizer-illustrierte.ch/sites/default/files/media/field_image/2022-11/denise_bielmann_1.jpg
			return src.replace(/\/fp\/+(?:[0-9]+\/+){4}/, "/");
		}

		if ((domain_nowww === "oxfordmail.co.uk" ||
			// http://www.heraldscotland.com/resources/images/5792318.jpg?display=1&htype=0&type=responsive-gallery
			// http://heraldscotland.com/resources/images/5792318.jpg?display=1&htype=0&type=responsive-gallery
			//   https://www.heraldscotland.com/resources/images/5792318.jpg
			domain_nowww === "heraldscotland.com" ||
			// https://www.theboltonnews.co.uk/resources/images/6984626/?type=responsive-gallery-fullscreen
			domain_nowww === "theboltonnews.co.uk" ||
			// http://www.thenorthernecho.co.uk/resources/images/7672541.jpg?display=1&htype=0&type=responsive-gallery
			domain_nowww === "thenorthernecho.co.uk" ||
			// thanks to roi for reporting:
			// https://www.glasgowtimes.co.uk/resources/images/813x457/1x/0/16492837.jpg
			domain_nowww === "glasgowtimes.co.uk" ||
			// https://www.theargus.co.uk/resources/images/10117461.jpg?htype=0&type=mc2
			domain_nowww === "theargus.co.uk") && /\/resources\/+images\//.test(src)) {
			// http://www.oxfordmail.co.uk/resources/images/4817793.jpg?display=1&htype=0&type=responsive-gallery
			//   https://www.oxfordmail.co.uk/resources/images/4817793.jpg
			// https://www.oxfordmail.co.uk/resources/images/813x457/1x/0/4817793.jpg
			//   https://www.oxfordmail.co.uk/resources/images/4817793.jpg
			return src
				.replace(/\/images\/+[0-9]+x[0-9]+\/+[0-9]+x\/+[0-9]+\/+([0-9]+\.)/, "/images/$1")
				.replace(/\?.*/, "");
		}

		if (domain === "austin.culturemap.com" ||
			// thanks to anonymous for reporting:
			// https://www.indy100.com/media-library/indy100-is-the-site-where-you-decide-the-news-agenda.jpg?id=28853671&width=1245&height=700&quality=85&coordinates=0%2C172%2C0%2C172
			//   https://www.indy100.com/media-library/indy100-is-the-site-where-you-decide-the-news-agenda.jpg?id=28853671
			domain_nowww === "indy100.com" ||
			// https://assets.rebelmouse.io/media-library/image.jpg?id=32842742&width=413&height=275&quality=80&coordinates=0%2C0%2C0%2C0
			//   https://assets.rebelmouse.io/media-library/image.jpg?id=32842742
			domain === "assets.rebelmouse.io" ||
			// https://blackbeltmag.com/media-library/image.jpg?id=28278048&width=1245&height=700&quality=85&coordinates=0%2C529%2C0%2C528
			//   https://blackbeltmag.com/media-library/image.jpg?id=28278048
			domain_nowww === "blackbeltmag.com") {
			// thanks to roi:
			// https://austin.culturemap.com/media-library/ice-skating.jpg?id=32372452&width=2000&height=1500&quality=85&coordinates=0%2C313%2C0%2C1247
			//   https://austin.culturemap.com/media-library/ice-skating.jpg?id=32372452
			match = src.match(/\/media-library\/+[^/]*?[?&]id=([0-9]+)/);
			if (match) {
				return src.replace(/[?#].*/, "?id=" + match[1]);
			}
		}

		if (domain_nowww === "out.com" ||
			// thanks to sn3akyb3ar and tathastu871 on github: https://github.com/qsniyg/maxurl/issues/1325
			// https://coveteur.com/media-library/image.jpg?id=52237495&width=980
			//   https://coveteur.com/media-library/image.jpg?id=52237495&quality=100
			domain_nowww === "coveteur.com") {
			// thanks to anonymous for reporting:
			// https://www.out.com/media-library/image.jpg?id=43524876&height=784&quality=85
			//   https://www.out.com/media-library/image.jpg?id=43524876&quality=100
			return src.replace(/(\/media-library\/+.*\?)(?:.*&)?(id=[0-9]+).*?$/, "$1$2&quality=100");
		}

		if (domain_nowww === "figureskating-online.com") {
			// thanks to roi:
			// http://figureskating-online.com/ce_photo/html/image.html?imageUrl=../..//mediapool/50/505569/images/Saison_22_23/DM/321844708_2981902172118785_2171735178698403583_n.jpg&width=1020&height=680&bgSoundUrl=../../&bgSoundLoop=true&soundPath=../../sound
			newsrc = website_query({
				website_regex: /\/ce_photo\/+html\/+image\.html\?(?:.*&)?imageUrl=([^&]+)/,
				run: function(cb, match) {
					let joined = urljoin(src, match[1], true);
					return cb(joined);
				}
			});
			if (newsrc) return newsrc;
		}

		if (host_domain_nowww === "figureskating-online.com" && /\/thumb_[0-9]+\./.test(src) && options.element) {
			if (options.element.tagName === "IMG" && options.element.parentElement && options.element.parentElement.tagName === "A") {
				let parent_onclick = options.element.parentElement.getAttribute("onclick");
				if (parent_onclick) {
					let match = parent_onclick.match(/displaySingleImage\('([^']+)'/);
					if (match) {
						return match[1].replace(/^.*?mediapool/, "/mediapool");
					}
				}
			}
		}

		if (domain === "assets-cms.thescore.com") {
			// thanks to roi:
			// https://assets-cms.thescore.com/uploads/image/file/486892/w640xh480_GettyImages-1236335963.jpg?ts=1639430055
			//   https://assets-cms.thescore.com/uploads/image/file/486892/GettyImages-1236335963.jpg?ts=1639430055
			return src.replace(/(\/image\/+file\/+[0-9]+\/+)w[0-9]+xh[0-9]+_/, "$1");
		}

		if (domain === "cdn.7days.ru") {
			// https://cdn.7days.ru/pic/750/71BC83C06B22A4F9432586D200505CDE/1257911/86.jpg -- 1286x858, upscaled
			//   https://cdn.7days.ru/pic/750/71BC83C06B22A4F9432586D200505CDE/1257911.jpg -- 590x393
			// https://cdn.7days.ru/pic/1b6/987088/1476397.webp -- upscaled?
			// other:
			// https://cdn.7days.ru/upload/iblock/bd3/e2dq9s1h5pofg5vnwtktpfg5pp9axjcv/or1.jpg
			// https://cdn.7days.ru/upload/images/747/093b4d1ee8d4b6a96bf62e130d297.jpg
			newsrc = src.replace(/(\/[0-9]+)\.webp(?:[?#].*)?$/, "$1.jpg");
			if (newsrc !== src)
				return newsrc;

			return {
				url: src.replace(/(\/pic\/.*\/[0-9]+)\/[0-9]+(\.[a-z]+)(?:[?#].*)?$/, "$1$2"),
				norecurse: true
			};
		}

		if (domain === "dthezntil550i.cloudfront.net") {
			// thanks to contextnerror on github: https://github.com/qsniyg/maxurl/issues/1101
			// https://medibang.com/picture/4b2112261505098280008769655/
			// https://dthezntil550i.cloudfront.net/4b/latest/4b2112261505098280008769655/1280_960/d5b22a94-4864-45d5-96e7-cbca9e0043f4.png
			//   https://dthezntil550i.cloudfront.net/4b/latest/4b2112261505098280008769655/d5b22a94-4864-45d5-96e7-cbca9e0043f4.png
			// https://dthezntil550i.cloudfront.net/mc/latest/mc2201180726215920008769655/440_330/a4b13098-2685-4346-b48a-1ebce125c6b0.png
			//   https://dthezntil550i.cloudfront.net/mc/latest/mc2201180726215920008769655/a4b13098-2685-4346-b48a-1ebce125c6b0.png
			let match = src.match(/\/[0-9a-z]{2}\/+[a-z]+\/+([0-9a-z]{2}[0-9]+)\//);
			let extra = null;
			if (match) {
				extra = {
					page: "https://medibang.com/picture/" + match[1] + "/"
				};
			}

			return {
				url: src.replace(/\/[0-9]+_[0-9]+\/+([-0-9a-f]{20,}\.)/, "/$1"),
				extra
			};
		}

		if (domain === "dlcdnwebimgs.asus.com") {
			// thanks to karpuzikov on github: https://github.com/qsniyg/maxurl/issues/1090
			// https://dlcdnwebimgs.asus.com/gain/4008fdce-f050-4a02-980c-299cdd100c20/w80/fwebp
			//   https://dlcdnwebimgs.asus.com/gain/4008fdce-f050-4a02-980c-299cdd100c20/
			// https://dlcdnwebimgs.asus.com/gain/442388A8-C91B-4EC5-952F-4AC5931A09A1/w717/h525/w292
			//   https://dlcdnwebimgs.asus.com/gain/442388A8-C91B-4EC5-952F-4AC5931A09A1/
			return src.replace(/(\/gain\/+[-0-9a-fA-F]{20,})\/.*/, "$1/");
		}

		if (googlestorage_container === "mediaslide-us") {
			// thanks to allr8 for reporting
			// https://mediaslide-us.storage.googleapis.com/industry/news_pictures/2023/02/large-1675800787-d12eb989747d295d6bb2d7ff39297267.jpg -- 800x576
			//   https://mediaslide-us.storage.googleapis.com/industry/news_pictures/2023/02/1675800787-d12eb989747d295d6bb2d7ff39297267.jpg -- 800x576
			// https://mediaslide-us.storage.googleapis.com/industry/pictures/2044/8276/large-1675447254-adb09a765f6427ec63ab0dd0152d0ea0.jpg -- 819x1000
			//   https://mediaslide-us.storage.googleapis.com/industry/pictures/2044/8276/1675447254-adb09a765f6427ec63ab0dd0152d0ea0.jpg -- 3354x4096
			// https://mediaslide-us.storage.googleapis.com/imgmodels/pictures/6350/96185/profile-1669921880-e0b594168c7917d21b8bd0c1c19321b3.jpg -- 375x500
			//   https://mediaslide-us.storage.googleapis.com/imgmodels/pictures/6350/96185/1669921880-e0b594168c7917d21b8bd0c1c19321b3.jpg -- 750x933
			// https://mediaslide-us.storage.googleapis.com/spot6/pictures/1124/7468/square-1651157929-243298f0f99f832ec642bf11963986dc.jpg
			//   https://mediaslide-us.storage.googleapis.com/spot6/pictures/1124/7468/1651157929-243298f0f99f832ec642bf11963986dc.jpg -- 2700x3499
			// https://mediaslide-us.storage.googleapis.com/heroes/pictures/138/474/square-1537373279-dda0614e930656427d6f50bbfe9a03fc.jpg -- 146x200
			//   https://mediaslide-us.storage.googleapis.com/heroes/pictures/138/474/1537373279-dda0614e930656427d6f50bbfe9a03fc.jpg
			// https://mediaslide-us.storage.googleapis.com/kollektiv/pictures/1/289/large-1634147843-66f52fd8069ccc19ea82e815c949880d.jpg -- 692x1000
			//   https://mediaslide-us.storage.googleapis.com/kollektiv/pictures/1/289/1634147843-66f52fd8069ccc19ea82e815c949880d.jpg
			// https://mediaslide-us.storage.googleapis.com/freedom/pictures/715/6050/large-1635266818-37997344f2ecd5b37e95d03279a0640f.jpg
			//   https://mediaslide-us.storage.googleapis.com/freedom/pictures/715/6050/1635266818-37997344f2ecd5b37e95d03279a0640f.jpg
			newsrc = src.replace(/(\/(?:news_)?pictures\/+[0-9]+\/+[0-9]+\/+)(?:large|profile|square)-/, "$1");
			if (newsrc !== src)
				return newsrc;

			// https://mediaslide-us.storage.googleapis.com/industry/videos/1638/1667489370-a9c37e5f80782b0b74d4e8e29d2eb3b8.jpg
			newsrc = src.replace(/(\/videos\/+[0-9]+\/+[0-9]+-[0-9a-f]+)\.jpg(?:[?#].*)?$/, "$1.mp4");
			if (newsrc !== src)
				return {
					url: newsrc,
					video: true
				};
		}

		if (domain_nowww === "modemodels.com") {
			// thanks to anonymous for reporting:
			// https://www.modemodels.com/images/grey.gif
			if (/\/images\/+grey\.gif(?:[?#].*)?$/.test(src))
				return {
					url: src,
					bad: "mask"
				};
		}

		if (domain === "images.craigslist.org") {
			// thanks to vscum on github: https://github.com/qsniyg/maxurl/pull/1137
			// https://images.craigslist.org/00Z0Z_kMMO8QqcvvJz_0fu0bC_300x300.jpg
			//   https://images.craigslist.org/00Z0Z_kMMO8QqcvvJz_0fu0bC_1200x900.jpg
			// https://images.craigslist.org/00g0g_dz7QS1Y7wSM_0CI0t2_600x450.jpg
			//   https://images.craigslist.org/00g0g_dz7QS1Y7wSM_0CI0t2_1200x900.jpg
			// https://images.craigslist.org/00Q0Q_7pbndx4AEcXz_0sG0CI_1200x900.jpg -- 667x900
			return src.replace(/(\/[^/]+)_(?:300x300|600x450)\./, "$1_1200x900.");
		}

		if (domain === "images.rawpixel.com") {
			// thanks to eightyy8 on github for reporting: https://github.com/qsniyg/maxurl/issues/1128
			// https://images.rawpixel.com/image_png_social_square/czNmcy1wcml2YXRlL3Jhd3BpeGVsX2ltYWdlcy93ZWJzaXRlX2NvbnRlbnQvbHIvcGRmbG93ZXJzZXQxNWJhdGNoMi10YW5nLTE0Yi5wbmc.png
			// https://images.rawpixel.com/dark_image_png_social_square/czNmcy1wcml2YXRlL3Jhd3BpeGVsX2ltYWdlcy93ZWJzaXRlX2NvbnRlbnQvbHIvcGRmbG93ZXJzZXQxNWJhdGNoMi10YW5nLTE0Yi5wbmc.png
			//   https://images.rawpixel.com/image_1300/czNmcy1wcml2YXRlL3Jhd3BpeGVsX2ltYWdlcy93ZWJzaXRlX2NvbnRlbnQvcGRmbG93ZXJzZXQxNWJhdGNoMi10YW5nLTE0Yi5wbmc=.png
			// other:
			// from: https://github.com/webcompat/web-bugs/issues/73146
			// https://rawpixel-dam-prod.s3-accelerate.amazonaws.com/s3fs-private/rawpixel_files/website_content/v247-binn-bitcoin-01.eps?response-content-disposition=attachment%3B%20filename%3Dimage-from-rawpixel-id-504860-original.eps -- doesn't work
			// rawpixel.s3.amazonaws.com exists
			// https://img.rawpixel.com/s3fs-private/rawpixel_images/website_content/pf-s107-td-17045_1.jpg?w=800&dpr=1&fit=default&crop=default&q=65&vib=3&con=3&usm=15&bg=F4F4F3&ixlib=js-2.2.1&s=1e434b6e02b8dc3b0bbff0799db7f7a7
			newsrc = src
				.replace(/[?#].*$/, "")
				//.replace(/(:\/\/[^/]+\/+)(?:dark_)?image_png_/, "$1image_")
				.replace(/_(?:social_(?:square|landscape|portrait)|[1-9]00|1000)\//, "_1300/");
			if (newsrc !== src)
				return newsrc;

			try {
				// czNmcy1wcml2YXRlL3Jhd3BpeGVsX2ltYWdlcy93ZWJzaXRlX2NvbnRlbnQvbHIvcGRmbG93ZXJzZXQxNWJhdGNoMi10YW5nLTE0Yi5wbmc
				// = s3fs-private/rawpixel_images/website_content/lr/pdflowerset15batch2-tang-14b.png
				let internal_url_match = src.match(/:\/\/[^/]+\/+[^/]+\/+([^/.?#]{20,})\./);
				if (internal_url_match) {
					let internal_url = internal_url_match[1];
					let decoded = base64_decode(internal_url);

					// s3fs-private/rawpixel_images/website_content/lr/pdflowerset15batch2-tang-14b.png
					//   s3fs-private/rawpixel_images/website_content/pdflowerset15batch2-tang-14b.png -- resolution doesn't change, but the quality improves slightly
					decoded = decoded.replace(/\/website_content\/+lr\/+/, "/website_content/");
					let encoded = base64_encode(decoded);
					return src.replace(/(:\/\/[^/]+\/+[^/]+\/+)[^/.?#]{20,}\./, "$1" + encoded + ".");
				}
			} catch (e) {
				console_error(e);
			}
		}

		if (domain_nosub === "carsforsale.com" && /^cdn[0-9]*\./.test(domain)) {
			// thanks to ayunami2000 on github: https://github.com/qsniyg/maxurl/issues/1028
			// https://cdn05.carsforsale.com/0096bb1668db544d4a92cc811efffda00a/800x600/2017-smart-fortwo-passion-2dr-hatchback.jpg
			//   https://cdn05.carsforsale.com/0096bb1668db544d4a92cc811efffda00a/1280x960/2017-smart-fortwo-passion-2dr-hatchback.jpg
			newsrc = src.replace(/(\/[0-9a-f]{20,}\/+)[0-9]+x[0-9]+\/+/, "$1original/");
			if (newsrc !== src) {
				common_functions["get_redirect_url"](api_cache, options, newsrc, options.cb);
				return {
					waiting: true
				};
			}
		}

		if (domain === "assets.shueisha.online") {
			// thanks to Andy8r0X on github for reporting: https://github.com/qsniyg/maxurl/issues/1091
			// https://assets.shueisha.online/image/2022/05/16083443333424/800/0374_009.jpg
			//   https://assets.shueisha.online/image/-/2022/05/16083443333424/0/0374_009.jpg -- 3871x2582
			return src.replace(/\/image\/+([0-9]{4}\/+[0-9]{2}\/+[0-9]+\/+)[0-9]+\/+([^/]+)(?:[?#].*)?$/, "/image/-/$10/$2");
		}

		if (domain_nowww === "panasonic.com") {
			// thanks to karpuzikov on github: https://github.com/qsniyg/maxurl/issues/1080
			// https://www.panasonic.com/content/dam/pim/ua/uk/en/eneloo/eneloop%20pro/ast-1198632.png.pub.thumb.644.644.png
			//   https://www.panasonic.com/content/dam/pim/ua/uk/en/eneloo/eneloop%20pro/ast-1198632.png
			return src.replace(/(\/content\/+dam\/.*\.[a-z]+)\.pub\.thumb\.[0-9]+\.[0-9]+\.[a-z]+(?:[?#].*)?$/, "$1");
		}

		if (domain_nowww === "coloring-pages.info") {
			// https://coloring-pages.info/images/minicovers/1452799043teenage-ninja-mutant-free-superhero-s4eb1.jpg
			//   https://coloring-pages.info/images/ccovers/1452799043teenage-ninja-mutant-free-superhero-s4eb1.jpg
			//   https://coloring-pages.info/images/svg/1452799043teenage-ninja-mutant-free-superhero-s4eb1.svg
			return src
				.replace(/(\/images\/+)ccovers\/+([^/.]+)\.[a-z]+(?:[?#].*)?$/, "$1svg/$2.svg")
				.replace(/\/images\/+minicovers\/+/, "/images/ccovers/");
		}

		if (domain_nowww === "coloringhome.com") {
			// https://coloringhome.com/thumbnail/E6c/pzB/E6cpzBgTE.gif
			//   https://coloringhome.com/coloring/E6c/pzB/E6cpzBgTE.gif
			return src.replace(/\/thumbnail\//, "/coloring/");
		}

		if (domain_nowww === "drawdoo.com") {
			// http://drawdoo.com/wp-content/themes/blogfolio/themify/img.php?src=http://drawdoo.com/wp-content/uploads/tutorials/FamousActors/lesson40/step_00.png&w=150&h=150&zc=1&q=60&a=t
			//   http://drawdoo.com/wp-content/uploads/tutorials/FamousActors/lesson40/step_00.png
			newsrc = src.replace(/.*?\/wp-content\/+themes\/+blogfolio\/+themify\/+img\.php\?(?:.*&)?src=([^&]+).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nosub === "olxcdn.com" ||
			// https://apollo-virginia.akamaized.net/v1/files/cmgwghqdmduk3-GT/image%3Bp%3Dthumb
			//   https://apollo-virginia.akamaized.net/v1/files/cmgwghqdmduk3-GT/image;s=0x0;f=png
			domain === "apollo-virginia.akamaized.net" ||
			// https://apollo-frankfurt.akamaized.net/v1/files/5lwmg93wkg212-KZ/image;s=261x203
			domain === "apollo-frankfurt.akamaized.net" ||
			// https://apollo-singapore.akamaized.net/v1/files/0ana1bwntjfc1-IN/image;s=300x600;q=60
			//   https://apollo-singapore.akamaized.net/v1/files/0ana1bwntjfc1-IN/image;s=0x0;f=png
			// https://apollo-singapore.akamaized.net/v1/files/0ana1bwntjfc1-IN/image%3bs=99x99
			//   https://apollo-singapore.akamaized.net/v1/files/0ana1bwntjfc1-IN/image;s=0x0;f=png
			// https://apollo-singapore.akamaized.net/v1/files/jbyitvgly1na-PK/image;s=272x0
			domain === "apollo-singapore.akamaized.net" ||
			// https://apollo-ireland.akamaized.net/v1/files/7a4ysqoowqvx1-OLXAUTOTR/image;s=300x600;q=60
			//   https://apollo-ireland.akamaized.net/v1/files/7a4ysqoowqvx1-OLXAUTOTR/image;s=0x0;f=png -- 1280x873
			domain === "apollo-ireland.akamaized.net") {
			// thanks to karpuzikov and talizea on github: https://github.com/qsniyg/maxurl/issues/1079
			// https://ireland.apollo.olxcdn.com/v1/files/6dxjbzpofcc23-UA/image;s=100x100
			//   https://ireland.apollo.olxcdn.com/v1/files/6dxjbzpofcc23-UA/image;s=0x0;f=png -- 3000x2250
			// without ;f=png, it redirects to a webp image
			// https://ireland.apollo.olxcdn.com/v1/files/6dxjbzpofcc23-UA/image;s=9999x9999
			//   https://ireland.apollo.olxcdn.com/v1/files/6dxjbzpofcc23-UA/image;s=0x0;f=png
			// https://frankfurt.apollo.olxcdn.com/v1/files/iu7vefztbgp32-BG/image;s=1600x738
			//   https://frankfurt.apollo.olxcdn.com/v1/files/iu7vefztbgp32-BG/image;s=0x0;f=png
			return src
				.replace(/%3[Bb]/g, ";")
				.replace(/(\/files\/+[^/]+\/+[^/?#;]+?)(?:[;?#].*)?$/, "$1;s=0x0;f=png");
		}

		if (domain === "d2t6nqpqpe59g5.cloudfront.net") {
			// https://d2t6nqpqpe59g5.cloudfront.net/768x768xwebp/main-page/header-mobile.png
			//   https://d2t6nqpqpe59g5.cloudfront.net/768x768xjpg/main-page/header-mobile.png
			//   https://d2t6nqpqpe59g5.cloudfront.net/768x768xpng/main-page/header-mobile.png
			//   https://d2t6nqpqpe59g5.cloudfront.net/main-page/header-mobile.png
			return src.replace(/(:\/\/[^/]+\/+)[0-9]+x[0-9]+x[a-z]+\/+/, "$1");
		}

		if (domain === "images.prop24.com" ||
			// https://img.autotrader.co.za/22296736/Crop120x72
			//   https://img.autotrader.co.za/22296736
			domain === "img.autotrader.co.za") {
			// https://images.prop24.com/295454573/Crop525x350
			//   https://images.prop24.com/295454573
			return {
				url: src.replace(/(:\/\/[^/]+\/+[0-9]+)(?:\/+.*)?$/, "$1"),
				can_head: false // 500
			};
		}

		if (domain === "imgcdn.powr-media.com") {
			// https://imgcdn.powr-media.com/extend:1:ce/enlarge:1/resize:fill/w:240/h:360/gravity:ce/czM6Ly91bnJlZWxtZWRpYS9wcm9kL3NhbGVtbm93L3Bvc3RlcnMvYTYyMTg3ZTItMTExNi00ZWIzLWI4YmEtMjgzMDJkMWI2MTcx
			//   s3://unreelmedia/prod/salemnow/posters/a62187e2-1116-4eb3-b8ba-28302d1b6171
			//   https://unreelmedia.s3.amazonaws.com/prod/salemnow/posters/a62187e2-1116-4eb3-b8ba-28302d1b6171 -- 2000x2999
			let match = src.match(/:\/\/[^/]+\/+(?:[a-z]+:[^/]+\/+)*([^/.?#]{20,})/);
			if (match) {
				try {
					let decoded = base64_decode(match[1]);
					let match1 = decoded.match(/^s3:\/\/([a-z]+)\/+(prod\/.*)$/);
					if (match1) {
						return "https://" + match1[1] + ".s3.amazonaws.com/" + match1[2];
					}
				} catch (e) {
					console_error(e);
				}
			}
		}

		if (domain === "static.thcdn.com") {
			// https://static.thcdn.com/images/large/webp//productimg/1600/1600/13977773-1264991052005904.jpg
			//   https://static.thcdn.com/productimg/original/13977773-1264991052005904.jpg
			return src
				.replace(/(:\/\/[^/]+\/+productimg\/+).*\/([^/?#]+)(?:[?#].*)?$/, "$1original/$2")
				.replace(/\/images\/+[^/]+\/+[^/]+\/+productimg\//, "/productimg/");
		}

		if (domain === "media.kingston.com") {
			// thanks to karpuzikov on github: https://github.com/qsniyg/maxurl/issues/1149
			// https://media.kingston.com/kingston/product/ktc-product-ssd-sedc1000b-240gb-1-tn.png
			//   https://media.kingston.com/kingston/product/ktc-product-ssd-sedc1000b-240gb-1-lg.jpg
			//   https://media.kingston.com/kingston/product/ktc-product-ssd-sedc1000b-240gb-1-zm-lg.jpg -- 1024x1024
			// https://media.kingston.com/kingston/product/ktc-product-hub-nucleum-other-4-zm-lg.jpg -- 3480x3480
			newsrc = src.replace(/(\/kingston\/+product\/+[^/]+?-[0-9]+)-(?:tn|lg)\./, "$1-zm-lg.");
			if (newsrc !== src)
				return add_extensions(newsrc);
		}

		if (domain === "cdn.7tv.app") {
			// thanks to pointydev on github: https://github.com/qsniyg/maxurl/issues/1146
			// https://cdn.7tv.app/emote/6040a8bccf6746000db10348/1x.avif
			//   https://cdn.7tv.app/emote/6040a8bccf6746000db10348/2x.webp
			//   https://cdn.7tv.app/emote/6040a8bccf6746000db10348/3x.gif
			//   https://cdn.7tv.app/emote/6040a8bccf6746000db10348/4x.avif
			// https://cdn.7tv.app/emote/60ae8d9ff39a7552b658b60d/1x.png
			//   https://cdn.7tv.app/emote/60ae8d9ff39a7552b658b60d/4x.png
			return {
				url: src.replace(/(\/emote\/+[0-9a-f]+\/+)[1-3]x\./, "$14x."),
				head_wrong_contenttype: true
			};
		}

		if (domain_nosub === "hpplus.jp" && /^cdn-/.test(domain)) {
			// thanks to billkewl on github: https://github.com/qsniyg/maxurl/issues/1365
			// https://cdn-baila.hpplus.jp/image/00/0009813f-20da-46c4-ae46-ce117e786423-1280x1096.jpg
			//   https://cdn-baila.hpplus.jp/image/00/0009813f-20da-46c4-ae46-ce117e786423.jpg
			// doesn't work for all:
			// https://cdn-baila.hpplus.jp/image/d1/d17274ad-f5be-4e78-bc5c-53fab5ded54d-1280x1096.jpg
			//   https://cdn-baila.hpplus.jp/image/d1/d17274ad-f5be-4e78-bc5c-53fab5ded54d.jpg -- 404?
			return src.replace(/(\/image\/+[0-9a-f]{2}\/+[-0-9a-f]{10,})-[0-9]+x[0-9]+\./, "$1.");
		}

		if (domain === "img-baila.hpplus.jp" ||
			// thanks to fireattack on discord:
			// https://img-maquia.hpplus.jp/common/large/image/bf/bfe6887f-3f9f-4dd6-aa6c-acebf605f285-3000x2000.jpg
			//   https://img-maquia.hpplus.jp/image/bf/bfe6887f-3f9f-4dd6-aa6c-acebf605f285-3000x2000.jpg
			//   https://cdn-maquia.hpplus.jp/image/bf/bfe6887f-3f9f-4dd6-aa6c-acebf605f285-3000x2000.jpg
			// https://img-maquia.hpplus.jp/o/common/large/image/28/28979411-2852-4a75-bedd-1bc58afe5638-1200x1571.jpg
			//   https://cdn-maquia.hpplus.jp/image/28/28979411-2852-4a75-bedd-1bc58afe5638-1200x1571.jpg
			// https://img-maquia.hpplus.jp/quality/image/fd/fd1e66fe-ada0-4ea8-94b1-d2407423239e.jpg
			//   https://cdn-maquia.hpplus.jp/image/fd/fd1e66fe-ada0-4ea8-94b1-d2407423239e.jpg
			// https://img-maquia.hpplus.jp/common/large/image/b5/b5964929-097f-49a9-93a5-e1b6dcd5d3dd-772.89787946429x772.89787946429.jpg
			//   https://cdn-maquia.hpplus.jp/image/b5/b5964929-097f-49a9-93a5-e1b6dcd5d3dd-772.89787946429x772.89787946429.jpg
			domain === "img-maquia.hpplus.jp"// ||
			//domain === "cdn-baila.hpplus.jp" ||
			// https://s3.ap-northeast-1.amazonaws.com/cdn-baila.hpplus.jp/image/a0/a0bb2278-f824-4b89-9b62-fb27a0874bb6.jpg
			//amazon_container === "cdn-baila.hpplus.jp"
			) {
			// thanks to nimbuz on discord:
			// https://img-baila.hpplus.jp/s/small/image/a0/a0bb2278-f824-4b89-9b62-fb27a0874bb6.jpg -- 173x260
			//   https://img-baila.hpplus.jp/common/large/image/a0/a0bb2278-f824-4b89-9b62-fb27a0874bb6.jpg -- 750x1125
			//   https://img-baila.hpplus.jp/image/a0/a0bb2278-f824-4b89-9b62-fb27a0874bb6.jpg -- 1308x1961
			//   https://cdn-baila.hpplus.jp/image/a0/a0bb2278-f824-4b89-9b62-fb27a0874bb6.jpg -- 1580x2369
			return src
				.replace(/:\/\/img-([^/]+\/+image\/.*)$/, "://cdn-$1")
				.replace(/(:\/\/[^/]+\/+).*?\/+(image\/+[0-9a-f]{2}\/+)/, "$1$2");
			//return src.replace(/:\/\/img-([^/]+)\/+.*?(\/image\/+[0-9a-f]{2}\/+[-0-9a-f]{10,}(?:-[0-9]+x[0-9]+)?)\.[a-z]+)(?:[?#].*)?$/, "://cdn-$1$2");
		}

		if (domain === "gather.fandalism.com" ||
			// https://s3.amazonaws.com/gather.fandalism.com/800x800-2487035--D21FE795-9EC1-43D4-B8D423AB34D241A2--0--4287084--cover4.jpg
			//   https://s3.amazonaws.com/gather.fandalism.com/2487035--D21FE795-9EC1-43D4-B8D423AB34D241A2--0--4287084--cover4.jpg
			amazon_container === "gather.fandalism.com") {
			// thanks to jonestly on discord:
			// http://gather.fandalism.com/800x800-2487035--D21FE795-9EC1-43D4-B8D423AB34D241A2--0--4287084--cover4.jpg
			//   http://gather.fandalism.com/2487035--D21FE795-9EC1-43D4-B8D423AB34D241A2--0--4287084--cover4.jpg
			return src.replace(/(\.com\/+)[0-9]+x[0-9]+-/, "$1");
		}

		if (domain_nowww === "anigala-rew.jp") {
			// thanks to fireattack on github: https://github.com/qsniyg/maxurl/issues/1160
			// https://anigala-rew.jp/wp-content/uploads/photo-gallery/ske48nomura/DSC_0120.jpg
			//   https://anigala-rew.jp/wp-content/uploads/DSC_0120.jpg -- 5053x4000
			return src.replace(/(\/wp-content\/+uploads\/+)photo-gallery\/+[^/]+\/+/, "$1");
		}

		if (domain_nowww === "zip2img.com") {
			// thanks to vscum on github: https://github.com/qsniyg/maxurl/issues/1166
			// https://zip2img.com/i/?tf=Motivation_x509n2.jpg
			//   https://zip2img.com/i/?f=Motivation_x509n2.jpg
			return src.replace(/(:\/\/[^/]+\/+i\/+\?)(?:.*&)?t(f=[^&]+)/, "$1$2");
		}

		if (domain_nosub === "pornstar-scenes.com") {
			// thanks to vscum on github: https://github.com/qsniyg/maxurl/issues/1166
			// https://girlsway.pornstar-scenes.com/Emma_Hix-Encyclezpedia_Clitannica/Emma-Hix-Girlsway-Encyclezpedia-Clitannica-2019-11-10-001_thumb.webp
			// https://content-nubiles.pornstar-scenes.com/Scarlett_Hampton-Down_For_The_Ride/Scarlett-Hampton-Nubiles-Down-For-The-Ride-2023-04-12-001_thumb.avif
			return src.replace(/(:\/\/[^/]+\/+[^/]+\/+[^/]+)_thumb\.(?:webp|avif)(?:[?#].*)?$/, "$1_1500.webp");
		}

		if (domain_nowww === "thotsbay.tv") {
			// thanks to vscum on github: https://github.com/qsniyg/maxurl/issues/1166
			// https://thotsbay.tv/storage/images/24385/10850955/9ae4eb628cafdf2aa0842b0a31cb8851_300.jpg
			//   https://thotsbay.tv/storage/images/24385/10850955/9ae4eb628cafdf2aa0842b0a31cb8851.jpg
			return src.replace(/(\/storage\/+images\/.*)_[0-9]+\./, "$1.");
		}

		if (domain_nowww === "fashionsnap-assets.com") {
			// thanks to Broly on discord
			// https://fashionsnap-assets.com/asset/format=auto,width=1680/article/images/2023/04/gap-popup-230417-006.jpg
			//   https://fashionsnap-assets.com/article/images/2023/04/gap-popup-230417-006.jpg
			// thanks to James Joint on discord:
			// https://fashionsnap-assets.com/asset/format=auto,width=1088/streetstyle/images/2019/11/11-26-19-40-01-004.jpg
			//   https://fashionsnap-assets.com/streetstyle/images/2019/11/11-26-19-40-01-004.jpg
			return src.replace(/(:\/\/[^/]+\/+)asset\/+[^/]+=[^/]+\/+/, "$1");
		}

		if (domain_nowww === "streamin.me" ||
			// https://streamin.one/v/dcc5ffa9
			domain_nowww === "streamin.one") {
			// https://streamin.me/v/dcc5ffa9
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+v\/+([0-9a-f]+)(?:[?#].*)?$/,
				query_for_id: "https://streamin.me/v/${id}",
				process: function(done, resp, cache_key) {
					let obj = common_functions["get_videotag_obj"](resp);
					if (!obj)
						return done(null, false);

					for (let sobj of obj) {
						if (sobj.video) {
							// referer = "" doesn't work
							sobj.headers.Referer = null;
							sobj.headers["Accept-Encoding"] = "identity;q=1, *;q=0";
							sobj.headers["Sec-Fetch-Dest"] = "video";
							sobj.headers["Sec-Fetch-Mode"] = "no-cors";
							sobj.headers["Sec-Fetch-Site"] = "cross-site";
							sobj.can_head = false;
						}
					}

					done(obj, 60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "shorpy.com") {
			// https://www.shorpy.com/files/images/SHORPY-4a55220a.preview.jpg
			//   https://www.shorpy.com/files/images/SHORPY-4a55220a.jpg -- 2000x2502
			return src.replace(/(\/files\/+images\/+[^/]+)\.preview\./, "$1.");
		}

		if (domain_nowww === "bellesa.co") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+videos\/+([0-9]+)\/+/,
				query_for_id: "https://www.bellesa.co/videos/${id}/",
				process: function(done, resp, cache_key) {
					let match = resp.responseText.match(/window\.__INITIAL_DATA__\s*=\s*({.*?});<\/script/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					let json = JSON_parse(match[1]).video;

					let resolutions = json.resolutions.split(",").sort((a, b) => {
						return parse_int(b) - parse_int(a);
					});

					return done(fillobj_urls([
						{
							url: "https://s.bellesa.co/v/" + json.source + "/" + resolutions[0] + ".mp4",
							video: true
						},
						json.image
					], {
						extra: {
							page: resp.finalUrl,
							caption: json.title
						}
					}), 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "media.kinoheld.de") {
			if (/:\/\/[^/]+\/+[^/]+=\//.test(src)) {
				// thanks to anonymous for reporting:
				// https://media.kinoheld.de/TFk3RunVpHdiKhVyoBIClLhYSGs=/480x270/images%2Ffilm%2Fsuzume-41805-7.v1.jpg
				//   https://media.kinoheld.de/images/film/suzume-41805-7.v1.jpg
				newsrc = common_functions["get_thumbor_url"](src.replace(/^[a-z]+:\/\/[^/]+\/+/));
				if (newsrc) {
					return "https://media.kinoheld.de/" + decodeURIComponent(newsrc);
				}
			}
		}

		if (domain === "dosbg3xlm0x1t.cloudfront.net") {
			// thanks to anonymous for reporting:
			// https://dosbg3xlm0x1t.cloudfront.net/images/items/9784088921587/240/9784088921587.jpg
			//   https://dosbg3xlm0x1t.cloudfront.net/images/items/9784088921587/500/9784088921587.jpg
			//   https://dosbg3xlm0x1t.cloudfront.net/images/items/9784088921587/1200/9784088921587.jpg -- 842x1200
			return src.replace(/(\/images\/+items\/+[0-9]+\/+)(?:500|240)\/+/, "$11200/");
		}

		if (false && domain === "img.honto.jp") {
			// wip
			// thanks to anonymous for reporting:
			// https://img.honto.jp/item/1/0/999/31713326_1.jpg -- upscaled
			// https://img.honto.jp/item/1/0/0/31713326_1.jpg -- doesn't work
			// https://img.honto.jp/item/8/a1a1a1/180/240/30675248_1.jpg
			// first folder appears to be the mode
			// https://img.honto.jp/item/1/999/50/31713326_1.jpg -- left side
			// https://img.honto.jp/item/2/999/50/31713326_1.jpg -- middle
			// https://img.honto.jp/item/3/999/50/31713326_1.jpg -- right
			// https://img.honto.jp/item/4/50/999/31713326_1.jpg -- vertical middle
			// https://img.honto.jp/item/7/50/999/31713326_1.jpg -- bottom
			// https://img.honto.jp/item/8/50/999/31713326_1.jpg -- bottom
		}

		if (domain === "thumb.viva.id") {
			// thanks to anonymous for reporting:
			// https://thumb.viva.id/vivabandung/1265x711/2023/01/12/63bf89b9cd688-norma-risma_bandung.jpg
			//   https://thumbs.vdvc.id/bandung/images/original/2023/01/12/63bf89b9cd688-norma-risma_bandung.jpg
			// other:
			// https://thumb.intipseleb.com/media/frontend/thumbs3/2023/04/08/6430ef6e49e9d-pernikahan-lee-seung-gi-dan-lee-da-in_325_183.jpeg
			// https://thumb.viva.co.id/media/frontend/thumbs3/2023/04/19/643f8b7abb502-jalanan-jakarta-rabu-19-april-2023_1265_711.jpg
			//   https://thumb.viva.co.id/media/frontend/thumbs3/2023/04/19/643f8b7abb502-jalanan-jakarta-rabu-19-april-2023_665_374.jpg
			// https://thumb.viva.id/antvklik/665x374/2023/04/05/642d7d39f3a13-timnas-indonesia-masuk-grup-a-sea-games-2023-erick-thohir-bismillah_antvklik.jpg
			// https://thumbs.vdvc.id/olret/images/original/2022/08/07/62efb68ea2414-ohm-nanon_olret.jpg
			// https://thumbs.vdvc.id/gadget/images/original/2023/03/03/6401d4ca9ca6a-ilustrasi-jam-tangan-pintar_gadget.jpg
			// https://thumbs.vdvc.id/gorontalo/images/original/2023/04/18/643e7d690668e-alikusu_gorontalo.jpg
			return src.replace(/:\/\/[^/]+\/+viva([a-z]+)\/+[0-9]+x[0-9]+\/+/, "://thumbs.vdvc.id/$1/images/original/");
		}

		if (domain === "img.inews.co.id") {
			// thanks to anonymous for reporting:
			// https://img.inews.co.id/media/600/files/inews_new/2018/06/12/tol_cikampek.jpg
			//   https://img.inews.co.id/files/inews_new/2018/06/12/tol_cikampek.jpg -- 822x548
			return src.replace(/\/media\/+[0-9]+\/+files\//, "/files/");
		}

		if (domain === "kbimages1-a.akamaihd.net") {
			// thanks to anonymous for reporting:
			// https://kbimages1-a.akamaihd.net/056a02fc-7028-4bfe-87c9-4ef6c7953f2e/1200/1200/False/norwegian-wood-16.jpg
			//   https://kbimages1-a.akamaihd.net/056a02fc-7028-4bfe-87c9-4ef6c7953f2e/1200/1200/true/norwegian-wood-16.jpg
			//   https://kbimages1-a.akamaihd.net/056a02fc-7028-4bfe-87c9-4ef6c7953f2e/norwegian-wood-16.jpg -- 3000x3000
			return src.replace(/(\/[-0-9a-f]{20,}\/+)[0-9]+\/+[0-9]+\/+(?:true|false)\/+/i, "$1");
		}

		if (domain_nosub === "radiozet.pl" && /^gfx\./.test(domain)) {
			// thanks to roi:
			// https://gfx.wiadomosci.radiozet.pl/var/radiozetwiadomosci/storage/images/polska/polityka/burzliwe-obrady-komisji-w-sejmie-ws-ustawy-o-sn-wprowadza-chaos-i-anarchie/22182580-1-pol-PL/Burzliwe-obrady-komisji-w-Sejmie.-Rozwiazania-wprowadza-chaos-i-anarchie_size_574x562.webp
			//   https://gfx.wiadomosci.radiozet.pl/var/radiozetwiadomosci/storage/images/polska/polityka/burzliwe-obrady-komisji-w-sejmie-ws-ustawy-o-sn-wprowadza-chaos-i-anarchie/22182580-1-pol-PL/Burzliwe-obrady-komisji-w-Sejmie.-Rozwiazania-wprowadza-chaos-i-anarchie.webp
			//   https://gfx.wiadomosci.radiozet.pl/var/radiozetwiadomosci/storage/images/polska/polityka/burzliwe-obrady-komisji-w-sejmie-ws-ustawy-o-sn-wprowadza-chaos-i-anarchie/22182580-1-pol-PL/Burzliwe-obrady-komisji-w-Sejmie.-Rozwiazania-wprowadza-chaos-i-anarchie.jpg
			// https://gfx.sport.radiozet.pl/var/g3-radiozetsport/storage/images/pilka-nozna/euro-2024/polska-niemcy-bilety-ceny-ile-kosztuja-wejsciowki-na-mecz-towarzyski/8389425-1-pol-PL/Szalone-ceny-biletow-na-sparing-z-Niemcami.-Kibice-moga-byc-zawiedzeni_size_308x175.webp
			//   https://gfx.sport.radiozet.pl/var/g3-radiozetsport/storage/images/pilka-nozna/euro-2024/polska-niemcy-bilety-ceny-ile-kosztuja-wejsciowki-na-mecz-towarzyski/8389425-1-pol-PL/Szalone-ceny-biletow-na-sparing-z-Niemcami.-Kibice-moga-byc-zawiedzeni.jpg
			// https://gfx.sport.radiozet.pl/var/g3-radiozetsport/storage/images/pilka-nozna/la-liga/rayo-vallecano-barcelona-2604-na-zywo-relacja-live-online-i-wynik-meczu/8390541-1-pol-PL/Barcelona-przyblizy-sie-do-tytulu-Na-jej-drodze-kolejna-ekipa-z-Madrytu_size_286x161_north.webp
			//   https://gfx.sport.radiozet.pl/var/g3-radiozetsport/storage/images/pilka-nozna/la-liga/rayo-vallecano-barcelona-2604-na-zywo-relacja-live-online-i-wynik-meczu/8390541-1-pol-PL/Barcelona-przyblizy-sie-do-tytulu-Na-jej-drodze-kolejna-ekipa-z-Madrytu.jpg
			// https://gfx.sport.radiozet.pl/var/g3-radiozetsport/storage/images/pilka-nozna/la-liga/transmisja-meczu-girona-real-madryt-gdzie-obejrzec-spotkanie/8389053-1-pol-PL/Transmisja-meczu-Girona-Real-Madryt.-Gdzie-obejrzec-spotkanie_article_north.jpg
			//   https://gfx.sport.radiozet.pl/var/g3-radiozetsport/storage/images/pilka-nozna/la-liga/transmisja-meczu-girona-real-madryt-gdzie-obejrzec-spotkanie/8389053-1-pol-PL/Transmisja-meczu-Girona-Real-Madryt.-Gdzie-obejrzec-spotkanie_article.jpg
			//   https://gfx.sport.radiozet.pl/var/g3-radiozetsport/storage/images/pilka-nozna/la-liga/transmisja-meczu-girona-real-madryt-gdzie-obejrzec-spotkanie/8389053-1-pol-PL/Transmisja-meczu-Girona-Real-Madryt.-Gdzie-obejrzec-spotkanie.jpg
			// https://gfx.sport.radiozet.pl/var/g3-radiozetsport/storage/images/tenis/sabalenka-chciala-rozbic-szybe-w-porsche-igi-swiatek-wideo/8382591-1-pol-PL/Sabalenka-chciala-zniszczyc-porsche-Igi-Swiatek-Wszystko-nagraly-kamery_size_120x90_south.webp
			//   https://gfx.sport.radiozet.pl/var/g3-radiozetsport/storage/images/tenis/sabalenka-chciala-rozbic-szybe-w-porsche-igi-swiatek-wideo/8382591-1-pol-PL/Sabalenka-chciala-zniszczyc-porsche-Igi-Swiatek-Wszystko-nagraly-kamery.jpg
			// https://gfx.sport.radiozet.pl/var/g3-radiozetsport/storage/images/tenis/nie-tylko-swiatek-i-linette-frech-trzecia-tenisistka-w-turnieju-w-madrycie/8391099-1-pol-PL/Nie-tylko-Swiatek-i-Linette.-Mamy-trzecia-tenisistke-w-turnieju-WTA-w-Madrycie_size-120x90_north.webp
			//   https://gfx.sport.radiozet.pl/var/g3-radiozetsport/storage/images/tenis/nie-tylko-swiatek-i-linette-frech-trzecia-tenisistka-w-turnieju-w-madrycie/8391099-1-pol-PL/Nie-tylko-Swiatek-i-Linette.-Mamy-trzecia-tenisistke-w-turnieju-WTA-w-Madrycie.jpg
			newsrc = src.replace(/_(?:size[-_][0-9]+x[0-9]+|article)(?:_(?:north|south))?(\.[a-z]+)(?:[?#].*)?$/, "$1")
			if (newsrc !== src)
				return newsrc;

			return src.replace(/(\/storage\/+images\/.*)\.webp(?:[?#].*)?$/, "$1.jpg");
		}

		if (domain === "img.prosports.kz") {
			// thanks to roi:
			// https://img.prosports.kz/news/content//202301/28_d1da971b84530936568d4f7e62a60b9c.webp
			//   https://img.prosports.kz/news/original//202301/28_d1da971b84530936568d4f7e62a60b9c.webp
			//   https://img.prosports.kz/news/original//202301/28_d1da971b84530936568d4f7e62a60b9c.jpg -- 4528x3016
			return src
				.replace(/(\/news\/+original\/.*)\.webp(?:[?#].*)?$/, "$1.jpg")
				.replace(/(\/news\/+)content\//, "$1original/");
		}

		if (domain === "ic-cdn.flipboard.com") {
			// https://ic-cdn.flipboard.com/vice.com/2cbd68f8f0ff5b326419c46160f32faf1f0c8148/_medium.webp
			//   https://ic-cdn.flipboard.com/vice.com/2cbd68f8f0ff5b326419c46160f32faf1f0c8148/original.jpg -- 1920x1080
			// https://ic-cdn.flipboard.com/stadtlandmama.de/ef0d5a4cbe907569f370139cc597b9766acde955/_xlarge.webp -- 1511x999
			//   https://ic-cdn.flipboard.com/stadtlandmama.de/ef0d5a4cbe907569f370139cc597b9766acde955/original.jpg -- doesn't work
			// https://ic-cdn.flipboard.com/usatoday.com/bdac8ab1bafe1911f1ed5fcb6f3437a8852dda3f/_small.webp
			//   https://ic-cdn.flipboard.com/usatoday.com/bdac8ab1bafe1911f1ed5fcb6f3437a8852dda3f/original.jpg
			return src
				.replace(/\/_xlarge\.webp/, "/original.jpg")
				.replace(/\/_(?:small|medium|large)\./, "/_xlarge.");
		}

		if (domain === "dms-api.ntm.eu") {
			// thanks to roi:
			// https://dms-api.ntm.eu/api/v1/images/lw1y72wr/smart/width/664/height/374/as/webp
			//   https://dms-api.ntm.eu/api/v1/images/lw1y72wr
			return src.replace(/(\/api\/+v1\/+images\/+[a-z0-9]+)\/.*/, "$1");
		}

		if (domain_nowww === "tatar-inform.ru" ||
			// thanks to roi:
			// https://intertat.tatar/resize/shd/images/uploads/news/2023/4/24/67c459b01ff18fd5f10a2dbbdcd66892.JPG
			//   https://intertat.tatar/images/uploads/news/2023/4/24/67c459b01ff18fd5f10a2dbbdcd66892.JPG
			domain_nowww === "intertat.tatar") {
			// thanks to roi:
			// https://www.tatar-inform.ru/resize/shd/images/uploads/news/2023/4/25/50fe6e15e489bca3f24ff71e35e5d08b.jpg
			//   https://www.tatar-inform.ru/images/uploads/news/2023/4/25/50fe6e15e489bca3f24ff71e35e5d08b.jpg
			return src.replace(/\/resize\/+[^/]+\/+images\//, "/images/");
		}

		if (domain === "img.chmedia.ch" ||
			// thanks to roi:
			// https://img.luzernerzeitung.ch/2023/04/25/a4cd3c5c-351d-49e6-9104-7491f4c3623a.jpeg?quality=100
			domain === "img.luzernerzeitung.ch") {
			// thanks to roi:
			// https://img.chmedia.ch/2023/04/25/a4cd3c5c-351d-49e6-9104-7491f4c3623a.jpeg?width=1440&height=814&fit=bounds&quality=75&auto=webp&crop=2357,1332,x1625,y0
			//   https://img.chmedia.ch/2023/04/25/a4cd3c5c-351d-49e6-9104-7491f4c3623a.jpeg?quality=100
			return src.replace(/\?.*/, "?quality=100");
		}

		if (domain_nowww === "ots.at" ||
			// thanks to roi:
			// https://www.tourismuspresse.at/anhang/2023/04/25/TPB/TPB_20230425_TPB0007_bildblock.jpg
			//   https://www.tourismuspresse.at/anhang/2023/04/25/TPB/TPB_20230425_TPB0007.jpg
			domain_nowww === "tourismuspresse.at") {
			// thanks to roi:
			// https://www.ots.at/anhang/2023/01/19/OBS/OBS_20230119_OBS0055_liste.jpg
			//   https://www.ots.at/anhang/2023/01/19/OBS/OBS_20230119_OBS0055.jpg
			// https://www.ots.at/anhang/2023/01/19/OBS/OBS_20230119_OBS0055_galerie.jpg
			//   https://www.ots.at/anhang/2023/01/19/OBS/OBS_20230119_OBS0055.jpg
			// https://www.ots.at/anhang/2023/01/19/OBS/OBS_20230119_OBS0055.layout.jpg
			//   https://www.ots.at/anhang/2023/01/19/OBS/OBS_20230119_OBS0055.jpg
			return src.replace(/(?:_(?:liste|galerie|bildblock)|\.layout)(\.[^/.]+)(?:[?#].*)?$/, "$1");
		}

		if (domain === "image.puls24.at") {
			// thanks to roi:
			// https://image.puls24.at/images/hera_dyn_1344w_756h/3840383/klenk_nrl.jpg
			//   https://image.puls24.at/images/original/3840383/klenk_nrl.jpg
			return src.replace(/(\/images\/+)hera_dyn_[^/]+\/+/, "$1original/");
		}

		if ((domain_nowww === "lalibre.be" ||
			 // https://www.lavenir.net/resizer/l0bVTqSLjQfgmFWR08YZEhC4k1c=/arc-photo-ipmgroup/eu-central-1-prod/public/X6PHCAGZBJEEVKCFYUY33ATBGA.jpg
			 //   https://cloudfront-eu-central-1.images.arcpublishing.com/ipmgroup/X6PHCAGZBJEEVKCFYUY33ATBGA.jpg
			 domain_nowww === "lavenir.net" ||
			 // https://www.parismatch.be/resizer/R4fD9Xyyr6i_zRxq4buzCJAHPoE=/arc-photo-ipmgroup/eu-central-1-prod/public/VG27HT7KLFDUJOYBFPXZS3XQ6U.jpg
			 //   https://cloudfront-eu-central-1.images.arcpublishing.com/ipmgroup/VG27HT7KLFDUJOYBFPXZS3XQ6U.jpg
			 domain_nowww === "parismatch.be" ||
			 // thanks to roi:
			 // https://www.dhnet.be/resizer/kQDLTXbYWZ7XcseRXy-9ywhRNXI=/arc-photo-ipmgroup/eu-central-1-prod/public/KMX22IZTAFDARGNSHPB35WVVWQ.jpg
			 //   https://cloudfront-eu-central-1.images.arcpublishing.com/ipmgroup/KMX22IZTAFDARGNSHPB35WVVWQ.jpg
			 domain_nowww === "dhnet.be") &&
			/:\/\/[^/]+\/+resizer\/.*\/arc-photo-ipmgroup\//.test(src)) {
			// thanks to roi:
			// https://www.lalibre.be/resizer/I8v0qHSDXcywqmtDHSfSyL8EgmE=/arc-photo-ipmgroup/eu-central-1-prod/public/ABXG3M6GIVCHJHUNGKBXTKQZY4.png
			//   https://cloudfront-eu-central-1.images.arcpublishing.com/ipmgroup/ABXG3M6GIVCHJHUNGKBXTKQZY4.png
			return src.replace(/.*\/arc-photo-ipmgroup\/+([^/]+)-prod\/+public\/+([^/]+)(?:[?#].*)?$/, "https://cloudfront-$1.images.arcpublishing.com/ipmgroup/$2");
		}

		if (domain_nowww === "leparisien.fr") {
			// thanks to roi:
			// https://www.leparisien.fr/resizer/9hAi8XJfgKznLUHslXM6XFHRJwQ=/arc-anglerfish-eu-central-1-prod-leparisien/public/INPJCBLRFBB47L3KDPDDIFLRNQ.jpg
			//   https://cloudfront-eu-central-1.images.arcpublishing.com/leparisien/INPJCBLRFBB47L3KDPDDIFLRNQ.jpg
			// thanks to anonymous for reporting:
			// https://www.leparisien.fr/resizer/sDkSebGhfs2bRpSIfh4dt2McTdQ=/932x582/cloudfront-eu-central-1.images.arcpublishing.com/leparisien/RZYJLHQX2NDXZAQRBG3AC45VRY.jpg
			//   https://cloudfront-eu-central-1.images.arcpublishing.com/leparisien/RZYJLHQX2NDXZAQRBG3AC45VRY.jpg
			return src
				.replace(/^[a-z]+:\/\/[^/]+\/+resizer\/+[^/]+=\/+(?:.*?\/)?(cloudfront-[^/]+\.images\.arcpublishing\.com\/.*)/, "https://$1")
				.replace(/^[a-z]+:\/\/[^/]+\/+resizer\/+[^/]+=\/+arc-anglerfish-([^/]+)-prod-([^/]+)\/+public\/+/, "https://cloudfront-$1.images.arcpublishing.com/$2/");
		}

		if (domain_nosub === "arcpublishing.com" && /\.cdn\./.test(domain)) {
			// thanks to roi:
			// https://dmn-dallas-news-prod.cdn.arcpublishing.com/resizer/v2/H25GPQMSJBGOHI3MYI6L2IGOPM.jpg?auth=3ff15b216d05fb4ee1eb3492c7110beb3882ae0b407e9e4b674230b67446d282&height=1107&width=1660&smart=true
			//   https://cloudfront-us-east-1.images.arcpublishing.com/dmn/H25GPQMSJBGOHI3MYI6L2IGOPM.jpg
			// https://gray-wbtv-prod.cdn.arcpublishing.com/resizer/v2/BLGJNHKSQZBLHO5LNX43UVGOLE.png?auth=b684392fc943c9a746d319cc0179e13c972f3e5664260b9019cc86c27e371e31&width=800&height=450&smart=true
			//   https://cloudfront-us-east-1.images.arcpublishing.com/gray/BLGJNHKSQZBLHO5LNX43UVGOLE.png
			// https://gray-ktvf-prod.cdn.arcpublishing.com/resizer/v2/UEZDQLVFH5GITL2FAPZUF23TPU.jpg?auth=cf9402eceff1e544f6f2fb421b1a506dceac8a07fb9aba2938c729cc665c4e5a&width=980&height=551&smart=true
			//   https://cloudfront-us-east-1.images.arcpublishing.com/gray/UEZDQLVFH5GITL2FAPZUF23TPU.jpg
			// https://gray-wndu-prod.cdn.arcpublishing.com/resizer/v2/VYOQYEV74VDZTG6NUKF6YBRZGU.jpg?auth=fb5a8b47738196b479797299808f679d4bfb72ec99129b7c0c138b06deb507bb&width=800&height=450&smart=true
			//   https://cloudfront-us-east-1.images.arcpublishing.com/gray/VYOQYEV74VDZTG6NUKF6YBRZGU.jpg
			let subdomain = domain.replace(/\.cdn\.arcpublishing\.com$/, "");
			let folder = subdomain.replace(/^([a-z]+)-.*/, "$1");

			let loc = "us-east-1";
			if (folder === "thenational")
				// thanks to roi:
				// https://thenational-the-national-prod.cdn.arcpublishing.com/resizer/v2/M4J7Z42T6RFJHIOK6C7ST2AOYQ.jpg?smart=true&auth=f1af8e4b5ce5cc75585098baad7a855d471b304c2c47c9df522dd53529d57f0c&width=600&height=337
				//   https://cloudfront-eu-central-1.images.arcpublishing.com/thenational/M4J7Z42T6RFJHIOK6C7ST2AOYQ.jpg
				loc = "eu-central-1";

			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+resizer\/+v2\/+([^?#/]+)(?:[?#].*)?$/, "https://cloudfront-" + loc + ".images.arcpublishing.com/" + folder + "/$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nosub === "arcpublishing.com" && /^cloudfront-[^/]+\.images\./.test(domain)) {
			// thanks to roi:
			// https://cloudfront-us-east-2.images.arcpublishing.com/reuters/https%3A%2F%2Fcloudfront-us-east-2.images.arcpublishing.com%2Freuters%2FCYOLQ4HWSBALBLGSUYZVVJOMR4.JPG
			//   https://cloudfront-us-east-2.images.arcpublishing.com/reuters/CYOLQ4HWSBALBLGSUYZVVJOMR4.JPG
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+[^/]+\/+(https?(?::|%3A).*)$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nowww === "nzherald.co.nz" ||
			// thanks to roi:
			// https://www.reuters.com/resizer/v2/CEEOQZWGZRK3NBZAWIEUB2WMPU.jpg?auth=3dd3003638276b10fe50b1fae382cb9ffe6db7eae25bf58e6e5920b9fca5eead&width=960&quality=80
			//   https://cloudfront-us-east-2.images.arcpublishing.com/reuters/CEEOQZWGZRK3NBZAWIEUB2WMPU.jpg
			// https://www.reuters.com/resizer/v2/https%3A%2F%2Fcloudfront-us-east-2.images.arcpublishing.com%2Freuters%2FCYOLQ4HWSBALBLGSUYZVVJOMR4.JPG?auth=13b9a416c2001d7684d4a72c0c9ebc72c75541cebce462625cc8bd03261fc48d&width=1200&quality=80
			//   https://cloudfront-us-east-2.images.arcpublishing.com/reuters/CYOLQ4HWSBALBLGSUYZVVJOMR4.JPG
			domain_nowww === "reuters.com" ||
			// thanks to roi:
			// https://www.masslive.com/resizer/v2/BLNXJJL3RJBOTJMHUZVO3F2GHE.jpg?auth=7360c30742429c3c7eaa24a1b24e5355b9951c80b41e582d0a0d4abd0d60afb8&width=1280&quality=90
			//   https://cloudfront-us-east-1.images.arcpublishing.com/advancelocal/BLNXJJL3RJBOTJMHUZVO3F2GHE.jpg
			domain_nowww === "masslive.com" ||
			// thanks to roi:
			// https://imagenes.elpais.com/resizer/v2/Q65QV6AOQFD67GSRGNODWVDEEQ.jpg?auth=a24d3386f30004dcad48575ed42b4cf3b3cb913397bb4e1485760a34b967b66c&width=828&height=466&smart=true
			//   https://cloudfront-eu-central-1.images.arcpublishing.com/prisa/Q65QV6AOQFD67GSRGNODWVDEEQ.jpg
			domain === "imagenes.elpais.com" ||
			// thanks to anonymous for reporting:
			// https://www.shropshirestar.com/resizer/v2/ANHB4KU4BRDX3P4JJYZ66FCWM4.jpg?auth=14ad374e17db437d9a7b335e256dfd7619c5f68c106ad6d11e27e85a489e0296&width=1200&height=900
			//   https://cloudfront-us-east-1.images.arcpublishing.com/mna/ANHB4KU4BRDX3P4JJYZ66FCWM4.jpg
			domain_nowww === "shropshirestar.com" ||
			// thanks to liamengland1 on github: https://github.com/qsniyg/maxurl/issues/1370
			// https://gray-wctv-prod.gtv-cdn.com/resizer/v2/QV5S634SSVDPLFDC7TJKQIQUHU.jfif?auth=cb16b69204edd60a484b3a0c753cde1f8f12fe5cf505d0bcc740f76e2069ef29&width=1200&height=800&smart=true
			//   https://cloudfront-us-east-1.images.arcpublishing.com/gray/QV5S634SSVDPLFDC7TJKQIQUHU.jfif
			// https://gray-wdbj-prod.gtv-cdn.com/resizer/v2/IRGMGZ7VQNAWBH6PPN2G4ZTKAU.jpg?auth=4e91ac97e4bce4a88e2b6b7f0c58447faf270c570efc5ddffea6d7c90d3e62b8&width=1600&height=900&smart=true
			//   https://cloudfront-us-east-1.images.arcpublishing.com/gray/IRGMGZ7VQNAWBH6PPN2G4ZTKAU.jpg
			// https://gray-wvir-prod.gtv-cdn.com/resizer/v2/UIAONGT3WVDQNMHDRYDSCJQCT4.jpeg?auth=bd8e6e45bdf0b0800ae321d2d916aca8c2e9909bdca44bc82c302246bc6db428&width=1300&height=975&smart=true -- upscaled?
			//   https://cloudfront-us-east-1.images.arcpublishing.com/gray/UIAONGT3WVDQNMHDRYDSCJQCT4.jpeg
			// https://gray-kvly-prod.gtv-cdn.com/resizer/v2/https%3A%2F%2Fcloudfront-us-east-1.images.arcpublishing.com%2Fgray%2FALWQDT5MIREGTGOVBMOKZYHJBY.jpg?auth=696f1c074052f5d043f46b46b3072587d5b47b7e8ee5356c6c91968a79843a53&width=980&smart=false
			//   https://cloudfront-us-east-1.images.arcpublishing.com/gray/ALWQDT5MIREGTGOVBMOKZYHJBY.jpg
			domain_nosub === "gtv-cdn.com" ||
			// thanks to liamengland1 on github: https://github.com/qsniyg/maxurl/issues/1375
			// https://www.ajc.com/resizer/v2/SK2DBT6OQZRKZMFLNQXDW3ONJM.jpg?auth=852f70ce395b0017a080c454b8600d84c15f9d8625ab106a1ed17a1762b5dd07&width=1600&height=900&smart=true
			//   https://cloudfront-us-east-1.images.arcpublishing.com/ajc/SK2DBT6OQZRKZMFLNQXDW3ONJM.jpg
			// https://www.ajc.com/resizer/v2/2NQ42HBDE5KMVK7YD3IDJKTDTI.jpg?auth=806c87c71561e3ee70b1bfb39a869c585603a23c1f55db0a17cc084d6a465baf&width=1600&height=900&smart=true
			//   https://cloudfront-us-east-1.images.arcpublishing.com/ajc/2NQ42HBDE5KMVK7YD3IDJKTDTI.jpg
			domain_nowww === "ajc.com" ||
			// https://www.dawgnation.com/resizer/v2/E45ES2YKKR7DUEE2XIFUI2LBHQ.jpg?auth=8c7e97d43df8e6604fa388c83a6c1e39250ce7fa1ec745d8b6c96cf22fcda236&width=150&height=150&focal=1724,675
			//   https://cloudfront-us-east-1.images.arcpublishing.com/ajc/E45ES2YKKR7DUEE2XIFUI2LBHQ.jpg
			domain_nowww === "dawgnation.com" ||
			// thanks to liamengland1 on github: https://github.com/qsniyg/maxurl/issues/1375
			// https://www.nj.com/resizer/v2/NKR3FPARHRDGNNBHG6X3TXV2J4.jpg?auth=c9d4d180304d4d024ac5498d54e550c1a244b4783ab3432446502f296536c664&width=600&height=450&smart=true
			//   https://cloudfront-us-east-1.images.arcpublishing.com/advancelocal/NKR3FPARHRDGNNBHG6X3TXV2J4.jpg
			domain_nowww === "nj.com" ||
			// thanks to anonymous for reporting:
			// https://www.kn-online.de/resizer/v2/YZRQ522MIFBHHEXIXWIVDXMXSU.jpg?auth=9d78f3115256d353fc0c0bc16ad676dbb71436e299176f76d43f41009a93c845&quality=70&width=596&height=396&smart=true
			//   https://cloudfront-eu-central-1.images.arcpublishing.com/madsack/YZRQ522MIFBHHEXIXWIVDXMXSU.jpg
			domain_nowww === "kn-online.de" ||
			// thanks to anonymous for reporting:
			// https://www.thedailybeast.com/resizer/v2/NFAHP52BEBG7VL6IYQ76BDMEYY.jpg?smart=true&auth=3018549faff46342fa5420fa6a0902487f7d5ee0ad2ca1ef28483608180b29b7&width=1600&height=899
			//   https://cloudfront-us-east-1.images.arcpublishing.com/thedailybeast/NFAHP52BEBG7VL6IYQ76BDMEYY.jpg
			domain_nowww === "thedailybeast.com" ||
			// thanks to anonymous for reporting:
			// https://resizer.glanacion.com/resizer/v2/paro-de-intergargo-y-aeronauticos-en-aeroparque-FB64XC5PU5BN3KY4CFCTDPSUHU.JPG?auth=1459d2883fad3b16fd9b543ece73a6543b65a72af93608350e9f9efb3bac4be1&width=302&height=201&quality=70&smart=true
			//   https://cloudfront-us-east-1.images.arcpublishing.com/lanacionar/paro-de-intergargo-y-aeronauticos-en-aeroparque-FB64XC5PU5BN3KY4CFCTDPSUHU.JPG
			domain === "resizer.glanacion.com" ||
			// thanks to anonymous for reporting:
			// https://www.lanacion.com.ar/resizer/v2/donald-trump-y-javier-UJQQYMO6VRE3JFUC7GYRSMLRGU.jpeg?auth=6fa75a9d093929ba457fd50da953b7be7b43d0b889d74b36a387944b9f382274&width=488&height=325&quality=70&smart=true
			//   https://cloudfront-us-east-1.images.arcpublishing.com/lanacionar/donald-trump-y-javier-UJQQYMO6VRE3JFUC7GYRSMLRGU.jpeg
			domain_nowww === "lanacion.com.ar" ||
			// thanks to anonymous for reporting:
			// https://www.oregonlive.com/resizer/v2/ET6KPTM4OJBNHH4CMZVOD6QSXY.jpg?auth=bfd2d714d208d3b6d065127f2ae5d7caeae30d47591b7989b456f2124f696c0d&width=500&quality=90
			//   https://cloudfront-us-east-1.images.arcpublishing.com/advancelocal/ET6KPTM4OJBNHH4CMZVOD6QSXY.jpg
			domain_nowww === "oregonlive.com" ||
			// thanks to anonymous for reporting:
			// https://www.ln-online.de/resizer/v2/V65QYIXUVHMFR6OTPLZT3V76LU.jpg?auth=9c2b99ff49ffdbae9d7d604a799e3d0e32358548a82a9390714552d7c0442b7f&quality=70&width=1441&height=1441&smart=true
			//   https://cloudfront-eu-central-1.images.arcpublishing.com/madsack/V65QYIXUVHMFR6OTPLZT3V76LU.jpg
			domain_nowww === "ln-online.de" ||
			// thanks to anonymous for reporting:
			// https://www.estadao.com.br/resizer/v2/CGTWQPIB2RGGXKG6ABE74R2VFY.jpg?quality=80&auth=9024e28b84d92ec28de196e743cb353157a40e99ce5891e900469b519854444b&width=360&height=202&smart=true
			//   https://cloudfront-us-east-1.images.arcpublishing.com/estadao/CGTWQPIB2RGGXKG6ABE74R2VFY.jpg
			domain_nowww === "estadao.com.br" ||
			// thanks to anonymous for reporting:
			// https://www.irishnews.com/resizer/v2/VLCFZ6K2KNLSFASOFLP5ELPX24.jpg?auth=1c8c4abb9b9fe1046ea4071c63b4085fe28e599cc37414dedc5aa515d3dd224c&width=1440&height=959
			//   https://cloudfront-eu-central-1.images.arcpublishing.com/irishnews/VLCFZ6K2KNLSFASOFLP5ELPX24.jpg
			domain_nowww === "irishnews.com" ||
			// thanks to anonymous for reporting:
			// https://www.chosun.com/resizer/v2/LBWQMMKOPU3FOOU7AHHKXOUR7A.jpg?auth=4c1e3e585ef4b85292596e1096ee52c493d1eb8cc5fb1aec90ca107c7eebd61d&width=530&height=742&smart=true
			//   https://cloudfront-ap-northeast-1.images.arcpublishing.com/chosun/LBWQMMKOPU3FOOU7AHHKXOUR7A.jpg
			domain_nowww === "chosun.com" ||
			// thanks to roi:
			// https://www.theglobeandmail.com/resizer/v2/MIMBGW3UORBLZMMTL2GASZ75JE.JPG?auth=c570680e25c89027c795085ce398d06291485e026f2830e996db3e2d9a71d3d8&width=900&quality=80
			//   https://cloudfront-us-east-1.images.arcpublishing.com/tgam/MIMBGW3UORBLZMMTL2GASZ75JE.JPG
			domain_nowww === "theglobeandmail.com") {
			// thanks to anonymous for reporting:
			// https://www.nzherald.co.nz/resizer/v2/65XCPLTDZMDJ4ETPGQSD7N5WNY.jpg?auth=845c2b3d0286c0d98e103c70b57a9fd65117bbe22938fd846df62440949479b0&width=1440&height=1795&quality=70&smart=true
			//   https://cloudfront-ap-southeast-2.images.arcpublishing.com/nzme/65XCPLTDZMDJ4ETPGQSD7N5WNY.jpg
			let info = {folder: "", loc: ""};

			if (domain_nowww === "nzherald.co.nz")
				info = {folder: "nzme", loc: "ap-southeast-2"};
			else if (domain_nowww === "reuters.com")
				info = {folder: "reuters", loc: "us-east-2"};
			else if (domain_nowww === "masslive.com" ||
					 domain_nowww === "nj.com" ||
					 domain_nowww === "oregonlive.com")
				info = {folder: "advancelocal", loc: "us-east-1"};
			else if (domain_nowww === "theglobeandmail.com")
				info = {folder: "tgam", loc: "us-east-1"};
			else if (domain === "imagenes.elpais.com")
				info = {folder: "prisa", loc: "eu-central-1"};
			else if (domain_nowww === "shropshirestar.com")
				info = {folder: "mna", loc: "us-east-1"};
			else if (domain_nosub === "gtv-cdn.com")
				info = {folder: "gray", loc: "us-east-1"};
			else if (domain_nowww === "ajc.com" ||
				     domain_nowww === "dawgnation.com")
				info = {folder: "ajc", loc: "us-east-1"};
			else if (domain_nowww === "kn-online.de" ||
					 domain_nowww === "ln-online.de")
				info = {folder: "madsack", loc: "eu-central-1"};
			else if (domain_nowww === "thedailybeast.com")
				info = {folder: "thedailybeast", loc: "us-east-1"};
			else if (domain_nosub === "glanacion.com" ||
					 domain_nowww === "lanacion.com.ar")
				info = {folder: "lanacionar", loc: "us-east-1"};
			else if (domain_nowww === "estadao.com.br")
				info = {folder: "estadao", loc: "us-east-1"};
			else if (domain_nowww === "irishnews.com")
				info = {folder: "irishnews", loc: "eu-central-1"};
			else if (domain_nowww === "chosun.com")
				info = {folder: "chosun", loc: "ap-northeast-1"};

			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+resizer\/+v2\/+([^?#/]+)(?:[?#].*)?$/, "https://cloudfront-" + info.loc + ".images.arcpublishing.com/" + info.folder + "/$1");
			if (newsrc !== src)
				return newsrc;

			// https://gray-wvir-prod.gtv-cdn.com/resizer/-rzLIYFvpWLGCV9x_yiPNKQVS0Q=/arc-photo-gray/arc3-prod/public/HM5GPD4PQZHRZL2ANO3YXUXC6A.png
			//   https://cloudfront-us-east-1.images.arcpublishing.com/gray/HM5GPD4PQZHRZL2ANO3YXUXC6A.png
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+resizer\/+.*?\/arc3-prod\/+public\/+([^?#/]+)(?:[?#].*)?$/, "https://cloudfront-" + info.loc + ".images.arcpublishing.com/" + info.folder + "/$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nowww === "lqj.ch") {
			// thanks to roi:
			// https://www.lqj.ch/media/image/15/large_3_2/67b663ae-ee6b-4f64-b324-96392949a20e.jpg.webp
			//   https://www.lqj.ch/media/image/15/67b663ae-ee6b-4f64-b324-96392949a20e.jpg -- 3832x2554
			return src.replace(/(\/media\/+image\/+[0-9]+\/+)[^/]+\/+([-0-9a-f]{20,}\.[^/.]+)(?:\.webp)?(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "interfax-russia.ru") {
			// thanks to roi:
			// https://www.interfax-russia.ru/storage/images_cache/240x158/news/2023/01/30/2d3c38b03e2748736ed200e85277dc1d.jpg
			//   https://www.interfax-russia.ru/storage/news/2023/01/30/2d3c38b03e2748736ed200e85277dc1d.jpg
			return src.replace(/\/images_cache\/+[0-9]+x[0-9]+\/+/, "/");
		}

		if (domain === "images.wunderweib.de") {
			// thanks to roi:
			// https://images.wunderweib.de/weise-sneaker-reinigen,id=8bd4b9ec,b=wunderweib,w=340,ca=0,0,100,84.3,rm=sk.webp
			//   https://images.wunderweib.de/weise-sneaker-reinigen,id=8bd4b9ec,b=wunderweib,w=2000.png
			// https://images.wunderweib.de/id=8bd4b9ec,b=wunderweib,w=340,ca=0,0,100,84.3,rm=sk.webp
			//   https://images.wunderweib.de/,id=8bd4b9ec,b=wunderweib,w=2000.png
			match = src.match(/^[a-z]+:\/\/[^/]+\/+([^/?#]+?)(?:\.[a-z]+)?(?:[?#].*)?$/);
			if (match) {
				let base = match[1];

				let filename = "";
				if (!/^[a-z]+=/.test(base)) {
					filename = base.replace(/^([^,]*),.*/, "$1");
				}

				let id_match = base.match(/^(?:.*,)?id=([^,]+)/);
				let brand_match = base.match(/^(?:.*,)?b=([^,]+)/) || [null, "wunderweib"];

				if (id_match) {
					return "https://images.wunderweib.de/" + filename + ",id=" + id_match[1] + ",b=" + brand_match[1] + ",w=2000.png";
				}
			}
		}

		if (domain_nowww === "baseljetzt.ch") {
			// https://www.baseljetzt.ch/2023/04/My-project-1-15-edited-1-rte_p49587_6-4_1024w.jpg -- 1024x682
			//   https://www.baseljetzt.ch/2023/04/My-project-1-15-edited-1-rte_p49587_6-4_fullw.jpg -- 1355x903
			// https://www.baseljetzt.ch/2023/04/509122325_highres-scaled-rte_p49469_6-4_fullw.jpg -- 2560x1706
			// https://www.baseljetzt.ch/2023/04/564596170_highres-1024x683.jpg
			//   https://www.baseljetzt.ch/2023/04/564596170_highres.jpg -- 3720x2480
			return {
				url: src
					.replace(/(\/[0-9]{4}\/+[0-9]{2}\/+[^/]+)_[0-9]+w\./, "$1_fullw.")
					.replace(/(\/[0-9]{4}\/+[0-9]{2}\/+[^/]+)-[0-9]+x[0-9]+\./, "$1."),
				can_head: false // 404
			};
		}

		if (domain_nowww === "stuttgart.de") {
			// thanks to roi:
			// https://www.stuttgart.de/service/aktuelle-meldungen/april-2023/oeffentliche-veranstaltung-zur-leonhardsvorstadt.php.media/360462/Grafik-Leonhardsvorstadt-2.jpg.scaled/156702cc38a68ea2363b24d80a4aef37.jpg
			//   https://www.stuttgart.de/service/aktuelle-meldungen/april-2023/oeffentliche-veranstaltung-zur-leonhardsvorstadt.php.media/360462/Grafik-Leonhardsvorstadt-2.jpg
			// https://www.stuttgart.de/leben/sport/sportstaetten/waldau.php.media/209026/Sport-und-Erholungsgebiet_Luftaufnahme_Thilo-Hesser_Rechte-LHS6.JPG.scaled/5d0209647a6a17f176109baf6c3167be.jpg
			//   https://www.stuttgart.de/leben/sport/sportstaetten/waldau.php.media/209026/Sport-und-Erholungsgebiet_Luftaufnahme_Thilo-Hesser_Rechte-LHS6.JPG
			baseobj = {};
			match = src.match(/^(.*\.php)\.media\//);
			if (match) {
				baseobj = {
					extra: {
						page: match[1]
					}
				};
			}

			baseobj.url = src.replace(/(\.php\.media\/.*\.[a-zA-Z]+)\.scaled\/+[^/]+(?:[?#].*)?$/, "$1");
			return baseobj;
		}

		if (domain === "img-s-msn-com.akamaized.net" ||
			// https://img.s-msn.com/tenant/amp/entityid/AA17NHRg.img?h=328&w=270&m=6&q=60&o=f&l=f&x=277&y=235
			//   https://img.s-msn.com/tenant/amp/entityid/AA17NHRg.jpg
			domain === "img.s-msn.com") {
			// thanks to roi for reporting:
			// https://img-s-msn-com.akamaized.net/tenant/amp/entityid/AA17NHRg.img?w=768&h=384&m=6&x=747&y=143&s=99&d=99
			//   https://img-s-msn-com.akamaized.net/tenant/amp/entityid/AA17NHRg.jpg -- 2000x1000
			// https://img-s-msn-com.akamaized.net/tenant/amp/entityid/AAtV5nt.img?h=328&w=270&m=6&q=60&o=f&l=f&x=277&y=235
			return {
				url: src
					.replace(/\.img$/, ".jpg")
					.replace(/\?.*/, ""),
				head_wrong_contentlength: true
			};
		}

		if (domain === "static.tvtropes.org") {
			// thanks to ljcool2006 on github: https://github.com/qsniyg/maxurl/issues/1170
			// https://static.tvtropes.org/pmwiki/pub/images/tvt_blue.png -- webp
			//   https://tvtropes.org/pmwiki/pub/images/tvt_blue.png -- png
			return src.replace(/:\/\/static\.([^/]+\/+pmwiki\/+pub\/+images\/)/, "://$1");
		}

		if (domain_nosub === "cddbp.net" && /\.cdn\./.test(domain)) {
			// thanks to anonymous for reporting:
			// http://akamai-b.cdn.cddbp.net/cds/2.0/image-artist/0907/CA7C/7B5E/3CF8_300x300_front.jpg
			//   http://akamai-b.cdn.cddbp.net/cds/2.0/image-artist/0907/CA7C/7B5E/3CF8_thumb_front.jpg
			//   http://akamai-b.cdn.cddbp.net/cds/2.0/image-artist/0907/CA7C/7B5E/3CF8_small_front.jpg
			//   http://akamai-b.cdn.cddbp.net/cds/2.0/image-artist/0907/CA7C/7B5E/3CF8_medium_front.jpg
			//   http://akamai-b.cdn.cddbp.net/cds/2.0/image-artist/0907/CA7C/7B5E/3CF8_large_front.jpg
			//   http://akamai-b.cdn.cddbp.net/cds/2.0/image-artist/0907/CA7C/7B5E/3CF8_xlarge_front.jpg
			// https://akamai-b.cdn.cddbp.net/cds/2.0/image-artist/0907/CA7C/7B5E/3CF8_small.jpg
			//   https://akamai-b.cdn.cddbp.net/cds/2.0/image-artist/0907/CA7C/7B5E/3CF8_xlarge.jpg
			return src.replace(/(\/[0-9A-F]{4}_)(?:[0-9]+x[0-9]+|thumb|small|medium|large)((?:_[^/]+)?\.[^/.]+)(?:[?#].*)?$/, "$1xlarge$2");
		}

		if (domain === "artwork.anghcdn.co") {
			// thanks to anonymous for reporting:
			// https://artwork.anghcdn.co/cover/1572723/300
			//   https://artwork.anghcdn.co/?id=1572723&size=-1 -- 1024x1024
			newsrc = src.replace(/\/cover\/+([0-9]+)\/+([0-9]+)(?:[?#].*)?$/, "?id=$1&size=$2");
			if (newsrc !== src)
				return newsrc;

			id = src.replace(/^[a-z]+:\/\/[^/]+\/+\?(?:.*&)?id=([0-9]+)(?:[&#].*)?$/, "$1");
			if (id !== src) {
				return "https://artwork.anghcdn.co/?id=" + id + "&size=-1";
			}
		}

		if (domain === "images.bonanzastatic.com") {
			// thanks to anonymous for reporting:
			// https://images.bonanzastatic.com/afu/images/789d/bee7/a267_12264093419/s-l1600_thumb200.jpg
			//   https://images.bonanzastatic.com/afu/images/789d/bee7/a267_12264093419/s-l1600.jpg
			// https://images.bonanzastatic.com/afu/images/fba9/8907/4a35_9890073896/Sassy_Chic_Makeup_Remover_25_Wipes2_thumb200.jpeg
			//   https://images.bonanzastatic.com/afu/images/fba9/8907/4a35_9890073896/Sassy_Chic_Makeup_Remover_25_Wipes2.jpeg
			return src.replace(/(\/images\/+[0-9a-f]{4}\/.*)_thumb[0-9]+\./, "$1.");
		}

		if (domain === "static-cdn.nextapple.tw") {
			// thanks to anonymous for reporting:
			// https://static-cdn.nextapple.tw/prod/2023-04/447EA34392468E00B414C2B0964EC0AC/a6ad5676c3663b837a6652a426dc81dd_750.jpeg
			//   https://static-cdn.nextapple.tw/prod/2023-04/447EA34392468E00B414C2B0964EC0AC/a6ad5676c3663b837a6652a426dc81dd_750.webp
			//   https://static-cdn.nextapple.tw/prod/2023-04/447EA34392468E00B414C2B0964EC0AC/a6ad5676c3663b837a6652a426dc81dd_1280.webp -- 960x653
			// https://static-cdn.nextapple.tw/prod/2022-10/1C5EEA05015428EB457D7C32B7B5574C/a4dc56bc3235d9edc82c61573f47a4b1_750.jpeg -- 456x49920
			//   https://static-cdn.nextapple.tw/prod/2022-10/1C5EEA05015428EB457D7C32B7B5574C/a4dc56bc3235d9edc82c61573f47a4b1_1280.webp -- 426x240, animated
			return src.replace(/_750\.(?:jpeg|webp)(?:[?#].*)?$/, "_1280.webp");
		}

		if (domain_nowww === "artmajeur.com") {
			// thanks to anonymous for reporting:
			// https://www.artmajeur.com/medias/mini/v/i/vidalfranck1/artwork/16721086_fama-et-ses-trompettes-rumeur-et-renommee.jpg
			// https://www.artmajeur.com/marco-dales/en/artworks/16234609/les-seychelles
			// https://www.artmajeur.com/medias/mini/m/a/marco-dales/artwork/16234609_no-4.jpg -- no watermark
			//   https://www.artmajeur.com/medias/standard/m/a/marco-dales/artwork/16234609_no-4.jpg -- watermark
			//   https://www.artmajeur.com/medias/hd/m/a/marco-dales/artwork/16234609_no-4.jpg -- watermark
			// https://www.artmajeur.com/medias/profile_thumb/m/a/marco-dales/profile/profile_98133367-161679692042706-3089052556454789120-o-161679688709373.jpg
			// other:
			// https://www.artmajeur.com/en/magazine/8-artist-portraits/daria-kolosova-a-combination-of-realism-and-picturesque/332650
			//   https://www.artmajeur.com/attachment-preview/98b7672b-45f1-47b8-8acf-d54b61380a45 -- 3053x4000
			// https://www.artmajeur.com/medias/standard/a/d/administrator/blog/3c9446f0-54c0-409a-b137-6e2973c3706e.jpg -- 720x599
			//   /hd/ doesn't work
			//   https://www.artmajeur.com/attachment-preview/3c9446f0-54c0-409a-b137-6e2973c3706e -- 2049x1705
			newsrc = src
				.replace(/\/medias\/+standard\/+/, "/medias/hd/")
				.replace(/\/medias\/+profile_thumb\/+/, "/medias/profile/");
			if (newsrc !== src)
				return newsrc;

			// https://www.artmajeur.com/medias/standard/a/d/administrator/blog/3c9446f0-54c0-409a-b137-6e2973c3706e.jpg
			//   https://www.artmajeur.com/attachment-preview/3c9446f0-54c0-409a-b137-6e2973c3706e
			// other:
			// https://www.artmajeur.com/media/cache/resolve/standard/a/d/administrator/blog/5a52a528-7fa1-4a47-a64d-0a237e9ff0d7.jpeg
			//   https://www.artmajeur.com/medias/standard/a/d/administrator/blog/5a52a528-7fa1-4a47-a64d-0a237e9ff0d7.jpg
			//   https://www.artmajeur.com/attachment-preview/5a52a528-7fa1-4a47-a64d-0a237e9ff0d7 -- doesn't work
			match = src.match(/\/medias\/.*\/blog\/+([-0-9a-f]{36})\./);
			if (match) {
				return "https://www.artmajeur.com/attachment-preview/" + match[1];
			}

			newsrc = src.replace(/\/medias\/+mini\/+/, "/medias/standard/");
			if (newsrc !== src) {
				return [
					{
						url: newsrc,
						problems: {
							watermark: true
						}
					},
					{
						url: src,
						problems: {
							smaller: true
						}
					}
				];
			}
		}

		if (domain_nowww === "artelaguna.world") {
			// https://artelaguna.world/reserved/1/upload/url_immagine_1/10/w410/10737_BACK%20TO%20WONDERLAND%20_1.jpg
			//   https://artelaguna.world/reserved/1/upload/url_immagine_1/10/10737_BACK%20TO%20WONDERLAND%20_1.jpg -- 2100x1400
			return src.replace(/(\/upload\/+url_immagine_[0-9]+\/+[0-9]+\/+)w[0-9]+\/+/, "$1");
		}

		if (domain_nowww === "recordshopx.com") {
			// thanks to anonymous for reporting:
			// https://www.recordshopx.com/cover/width_100/8/81/818130.jpg?lp
			//   https://www.recordshopx.com/cover/normal/8/81/818130.jpg?lp
			//   https://www.recordshopx.com/cover/big/8/81/818130.jpg?lp
			// thanks to anonymous for reporting:
			// https://www.recordshopx.com/cover/thumb/6/64/644605.jpg?lp
			//   https://www.recordshopx.com/cover/normal/6/64/644605.jpg?lp
			//   https://www.recordshopx.com/cover/big/6/64/644605.jpg?lp
			return src.replace(/\/cover\/+(?:width_[0-9]+|thumb|normal)\/+/, "/cover/big/");
		}

		if (domain_nowww === "hcn.org") {
			// thanks to anonymous for reporting:
			// https://www.hcn.org/articles/what-citizen-science-can-tell-us-about-the-deaths-of-seabirds/bigimage_large -- 768x369
			//   https://www.hcn.org/articles/what-citizen-science-can-tell-us-about-the-deaths-of-seabirds/bigimage -- 2500x1202
			// https://www.hcn.org/articles/what-citizen-science-can-tell-us-about-the-deaths-of-seabirds/image_large -- 768x512
			//   https://www.hcn.org/articles/what-citizen-science-can-tell-us-about-the-deaths-of-seabirds/image_thumb -- 128x85
			//   https://www.hcn.org/articles/what-citizen-science-can-tell-us-about-the-deaths-of-seabirds/image -- 1000x667
			// https://www.hcn.org/articles/what-citizen-science-can-tell-us-about-the-deaths-of-seabirds/walking-coasst-jpg/@@images/347d4b28-5785-4e51-bdee-ef9025cd3ba4.jpeg -- 768x576
			//   https://www.hcn.org/articles/what-citizen-science-can-tell-us-about-the-deaths-of-seabirds/walking-coasst-jpg/image -- 2500x1875
			// https://www.hcn.org/issues/48.10/when-water-turns-to-dust/image_preview -- 400x266
			//   https://www.hcn.org/issues/48.10/when-water-turns-to-dust/image -- 1500x1000
			// https://www.hcn.org/events/autry_2.jpg/@@images/0920f46c-196f-4522-ad37-cc819001514a.jpeg -- 533x400
			return {
				url: src
					.replace(/(\/(?:big)?image)_(?:large|thumb|preview)(?:[?#].*)?$/, "$1")
					.replace(/\/@@images\/.*/, "/image"),
				can_head: false
			};
		}

		if (domain === "geo-static.traxsource.com") {
			// thanks to anonymous for reporting:
			// https://geo-static.traxsource.com/scripts/image.php/52x52/56ffda54e4b1be530ffa56cbd8bb75a6.jpg
			//   https://geo-static.traxsource.com/files/images/56ffda54e4b1be530ffa56cbd8bb75a6.jpg -- 175x175
			return src.replace(/\/scripts\/+image\.php\/+[0-9]+x[0-9]+\/+([0-9a-f]+)\./, "/files/images/$1.");
		}

		if (domain === "imgproxy.ra.co") {
			// thanks to anonymous for reporting:
			// https://imgproxy.ra.co/_/quality:66/w:1500/rt:fill/aHR0cHM6Ly9zdGF0aWMucmEuY28vaW1hZ2VzL2V2ZW50cy9mbHllci8yMDE4LzUvZGUtMDUyNi0xMDk5NDcwLTExMTM5MTEtYmFjay5qcGc_ZGF0ZVVwZGF0ZWQ9MTUyNDA1NDA1Mjg2Mw
			//   https://static.ra.co/images/events/flyer/2018/5/de-0526-1099470-1113911-back.jpg
			//   dateUpdated=1524054052863
			//   https://static.ra.co/images/events/flyer/2018/5/de-0526-1099470-1113911-back.jpg?dateUpdated=1524054052863
			match = src.match(/\/(aHR0c[^?#]+)(?:[?#].*)?$/);
			if (match) {
				let split = match[1].split("_");
				newsrc = base64_decode(split[0]);
				if (split[1])
					newsrc += "?" + base64_decode(split[1]);
				return newsrc;
			}
		}

		if (domain_nowww === "ad93.ltd") {
			// thanks to anonymous for reporting:
			// https://ad93.ltd/media/pages/releases/whyt064/85f5ec20d8-1681896540/064-a-copy-2-800x-q100.jpg
			//   https://ad93.ltd/media/pages/releases/whyt064/85f5ec20d8-1681896540/064-a-copy-2.jpg -- 4000x4000
			//   https://minorscience.bandcamp.com/album/064
			//     https://f4.bcbits.com/img/a0599144123_0.jpg
			//     https://f4.bcbits.com/img/0030806574_0.jpg
			// other:
			// ad93.ltd/media/pages/releases/26-05-18/2d6540ba41-1648544116/26-05-18-800x-q100.jpg
			//   https://ad93.ltd/media/pages/releases/26-05-18/2d6540ba41-1648544116/26-05-18.jpg -- doesn't work
			return src.replace(/-[0-9]+x-q[0-9]+(\.[^/.]+)(?:[?#].*)?$/, "$1");
		}

		if (domain === "img.karaoketexty.cz") {
			// thanks to anonymous for reporting:
			// https://img.karaoketexty.cz/img/artists/41585/thumb/kid-ink-491900-w200.jpg
			//   https://img.karaoketexty.cz/img/artists/41585/kid-ink-491900.jpg
			return src.replace(/\/thumb\/+([^/]+)-w[0-9]+\./, "/$1.");
		}

		// LibreX
		if (domain === "search.pabloferreiro.es" ||
			// https://librex.zzls.xyz/image_proxy.php?url=https%3A%2F%2Fs1.qwant.com%2Fthumbr%2F474x237%2F0%2F3%2F6ab12651843bb245d5612b53a275749c11eb2880321ea075ea193641b51167%2Fth.jpg%3Fu%3Dhttps%253A%252F%252Ftse.mm.bing.net%252Fth%253Fid%253DOIP.BzptUGozcsz4w_aPHtL40AHaDt%2526pid%253DApi%26q%3D0%26b%3D1%26p%3D0%26a%3D0
			domain === "librex.zzls.xyz" ||
			domain_nowww === "librex.me" ||
			domain === "librex.mikata.ru" ||
			domain === "search.ahwx.org" ||
			domain === "search.davidovski.xyz" ||
			domain === "search.madreyk.xyz" ||
			domain === "librex.pufe.org" ||
			domain === "librex.ratakor.com" ||
			domain === "search.tildevarsh.in" ||
			domain === "librex.myroware.eu" ||
			domain === "librex.bloatcat.tk" ||
			domain === "librex.retro-hax.net" ||
			domain === "search.funami.tech" ||
			domain === "search.zeroish.xyz" ||
			domain === "librex.baczek.me" ||
			domain === "librex.yogeshlamichhane.com.np" ||
			domain === "search.spaceint.fr" ||
			// thanks to anonymous for reporting:
			// https://binternet.ahwx.org/image_proxy.php?url=https://i.pinimg.com/236x/04/f9/b0/04f9b09899bcdf57a816b7e59a5c4142.jpg
			//   https://i.pinimg.com/originals/04/f9/b0/04f9b09899bcdf57a816b7e59a5c4142.jpg
			domain === "binternet.ahwx.org" ||
			domain === "lx.benike.monster") {
			// list of domains: https://github.com/hnhx/librex
			// thanks to anonymous for reporting:
			// https://search.pabloferreiro.es/image_proxy.php?url=https%3A%2F%2Fs2.qwant.com%2Fthumbr%2F474x316%2Fe%2F1%2F23ff2131ca13dee06d3c6b20d175bf14025d339e374726b99db5184d77f547%2Fth.jpg%3Fu%3Dhttps%253A%252F%252Ftse.mm.bing.net%252Fth%253Fid%253DOIP.sldsThi-4O7viMDMp527cgHaE8%2526pid%253DApi%26q%3D0%26b%3D1%26p%3D0%26a%3D0
			//   https://tse.mm.bing.net/th?id=OIP.sldsThi-4O7viMDMp527cgHaE8
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+image_proxy\.php\?(?:.*&)?url=([^&]+).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		// ochre
		if (domain === "d1rgjmn2wmqeif.cloudfront.net") {
			// thanks to anonymous for reporting:
			// https://d1rgjmn2wmqeif.cloudfront.net/r/g/195669.jpg -- 500x500
			//   https://d1rgjmn2wmqeif.cloudfront.net/r/b/195669.jpg -- 1000x1000
			//   https://d1rgjmn2wmqeif.cloudfront.net/r/2000/195669.jpg -- 2000x2000
			//   https://d1rgjmn2wmqeif.cloudfront.net/r/195669.jpg -- 4000x4000
			// https://d1rgjmn2wmqeif.cloudfront.net/extra/2000/ReleaseFormat-577015-166382.jpg
			//   https://d1rgjmn2wmqeif.cloudfront.net/extra/ReleaseFormat-577015-166382.jpg
			// https://d1rgjmn2wmqeif.cloudfront.net/f/b/421395.jpg -- 1000x1000
			//   https://d1rgjmn2wmqeif.cloudfront.net/f/421395.jpg -- 4000x4000
			return src.replace(/(\/(?:[fr]|extra)\/+)(?:[gb]|[0-9]+)\/+/, "$1");
		}

		if (domain === "mapi.associatedpress.com") {
			// thanks to louthecute on discord:
			// https://mapi.associatedpress.com/v1/items/c227c7aba6344edfa84faf9fe30359bb/preview/AP22243491081907.jpg?wm=api&tag=app_id=1,user_id=undefined,org_id=undefined
			//   https://mapi.associatedpress.com/v1/items/c227c7aba6344edfa84faf9fe30359bb/preview/AP22243491081907.jpg
			// https://mapi.associatedpress.com/v1/items/c227c7aba6344edfa84faf9fe30359bb/thumbnail/thumb.jpg?tag=app_id=1
			//   https://mapi.associatedpress.com/v1/items/c227c7aba6344edfa84faf9fe30359bb/preview/thumb.jpg?tag=app_id=1 -- 1024x683
			// https://mapi.associatedpress.com/v1/items/c7492b31ac674259ad755571186f6c40.0/preview/preview.jpg
			// other:
			// https://mapi.associatedpress.com/89cfb057a0484d9da60c097f192677ad/components/versions/secured/main-v01.jpg
			// https://mapi.associatedpress.com/8d8151397b7d4b0eaefab991c6b3ef0c/components/1024-preview.jpg?tag=app_id%3D1%2Cuser_id%3D724788%2Corg_id%3D50823&Expires=1554210698&Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cHM6Ly9tYXBpLmFzc29jaWF0ZWRwcmVzcy5jb20vOGQ4MTUxMzk3YjdkNGIwZWFlZmFiOTkxYzZiM2VmMGMvY29tcG9uZW50cy8xMDI0LXByZXZpZXcuanBnP3RhZz1hcHBfaWQlM0QxJTJDdXNlcl9pZCUzRDcyNDc4OCUyQ29yZ19pZCUzRDUwODIzIiwiQ29uZGl0aW9uIjp7IkRhdGVMZXNzVGhhbiI6eyJBV1M6RXBvY2hUaW1lIjoxNTU0MjEwNjk4fX19XX0_&Signature=FHXH5zV~REg8zBMoU7Bhhk7hIYqQJNJxuNdB6yVJWbBJQ4UaBby5wJG0tLVjIfTVZumTqj4cdTALSopFLIosYFfvVo7WyiChpxYHE6Dp~8SGSQWT6FsSeVTDdICWiq8rMhWPPiCAaEhj3KmojiMOYj6tJU34S2GpdRDUKeUOcb8lavCFjmb2ftGeNfL7AVuVBCAgghn8jH2rizPtqOFzjCKQpftNIDIbx9ve6VCuT~WKr5PqUqR1yIdVDRZN0MhKgHRBW4A1tysESyt-iYAFnpY1-PqbCJ8dizshQBp~WFLXaxsgxpeabz6~vY5~AbwK4Wa6IHbW-ABwICHyfomsVg__&Key-Pair-Id=APKAJR53DZCPTOMINFRQ
			//   https://mapi.associatedpress.com/8d8151397b7d4b0eaefab991c6b3ef0c/components/1024-preview.jpg
			//   https://mapi.associatedpress.com/8d8151397b7d4b0eaefab991c6b3ef0c/components/thumbnail.jpg -- 1024x707
			return src
				.replace(/(\/[0-9a-f.]+\/+components\/+)thumbnail\./, "$11024-preview.")
				.replace(/(\/v1\/+items\/+[0-9a-f.]+\/+)thumbnail\/+/, "$1preview/")
				.replace(/(\/v1\/+items\/+[0-9a-f.]+\/+[a-z]+\/+[^/.?#]+\.[^/.?#]+)(?:[?#].*)?$/, "$1");
		}

		if (domain === "view.publitas.com") {
			// https://view.publitas.com/images?src=https%3A%2F%2Fproduction-revolution-publitas-com.s3-eu-west-1.amazonaws.com%2F78ba13e4-908d-4a6f-ad1e-6b51fe24d391&s=188145fbfda77eb8a70bb09b96581c45a724417d3eb17be205aeb261857d7efd
			//   https://production-revolution-publitas-com.s3-eu-west-1.amazonaws.com/78ba13e4-908d-4a6f-ad1e-6b51fe24d391
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+images\?(?:.*&)?src=(http[^&#]+)(?:[?&#].*)?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);

			// thanks to meloner on discord for reporting:
			// https://view.publitas.com/24563/1474563/pages/68b40331-c599-4f3a-b15e-dfe431eba6d2-at800.jpg
			//   https://view.publitas.com/24563/1474563/pages/68b40331-c599-4f3a-b15e-dfe431eba6d2-at2400.jpg -- 2110x2731
			// https://view.publitas.com/1198/9805/pages/f9955fe78eccb394c013b9ec702b46b727da69c2-at200.jpg
			//   https://view.publitas.com/1198/9805/pages/f9955fe78eccb394c013b9ec702b46b727da69c2-at600.jpg
			//   https://view.publitas.com/1198/9805/pages/f9955fe78eccb394c013b9ec702b46b727da69c2-at1000.jpg
			//   https://view.publitas.com/1198/9805/pages/f9955fe78eccb394c013b9ec702b46b727da69c2-at1600.jpg
			//   https://view.publitas.com/1198/9805/pages/f9955fe78eccb394c013b9ec702b46b727da69c2-original.jpg -- 2522x3567
			// other:
			// https://view.publitas.com/1078/11850/pages/64ad74ad18fc993827ef7965b6556d1e31a59ba7-original.jpg -- 2633x3417
			return src
				.replace(/(\/pages\/+[0-9a-f]+)-at2400\./, "$1-original.")
				.replace(/(\/pages\/+[-0-9a-f]+)-at2000\./, "$1-at2400.")
				.replace(/(\/pages\/+[-0-9a-f]+)-at1600\./, "$1-at2000.")
				.replace(/(\/pages\/+[-0-9a-f]+)-at(?:200|600|800|1000)\./, "$1-at1600.");
		}

		if (domain_nosub === "hosting-media.net") {
			// thanks to anonymous for reporting:
			// https://covers-ng1.hosting-media.net/jpgr120/u0196871065412.jpg
			//   https://covers-ng1.hosting-media.net/jpgr99999/u0196871065412.jpg -- 1000x1000
			return src.replace(/\/jpgr[0-9]+\/+/, "/jpgr99999/");
		}

		if (domain === "img.mymusic.net.tw") {
			// thanks to anonymous for reporting:
			// https://img.mymusic.net.tw/mms/album/M/348/11009348.jpg
			//   https://img.mymusic.net.tw/mms/album/L/348/11009348.jpg -- 320x320
			return src.replace(/(\/mms\/+album\/+)M\/+/, "$1L/");
		}

		if (domain_nosub === "files.fail" && /^v2-thumbs-/.test(domain)) {
			// https://v2-thumbs-tiktok.files.fail/jpg/3b935ebe7ba2f78742238eb565350105.jpg
			//   https://v2-videos-tiktok.files.fail/3b935ebe7ba2f78742238eb565350105.mp4
			newsrc = src.replace(/(:\/\/v2-)thumbs(-[^/]+\/+)jpg\/+([0-9a-f]{10,})\.jpg(?:[?#].*)?$/, "$1videos$2$3.mp4");
			if (newsrc !== src)
				return {
					url: newsrc,
					Referer: "https://tik.fail/",
					video: true
				};
		}

		if (domain === "img.abcdinamo.com") {
			// thanks to anonymous for reporting:
			// https://img.abcdinamo.com/eyJidWNrZXQiOiJwcm9kdWN0aW9uLWFiY2RpbmFtbyIsImtleSI6Im1lZGlhXC9UeXBlZmFjZXNcL01vbnVtZW50LUdyb3Rlc2tcL0RpbmFtb19Nb251bWVudEdyb3Rlc2tfMjQ1NTU5MTMwXzMwMzY3NDU5Nzg2MjUyMl8zMTQ0Mjg0MDA5MjIzMjQwNTE2X24uanBnIiwiZWRpdHMiOnsicmVzaXplIjp7ImZpdCI6ImNvbnRhaW4iLCJ3aWR0aCI6MTAyNH0sInRvRm9ybWF0IjoianBnIiwianBlZyI6eyJxdWFsaXR5Ijo5MH0sInJvdGF0ZSI6MH0sInZlcnNpb24iOjE2MzQ2NTQ1NjJ9
			//   https://production-abcdinamo.s3.amazonaws.com/media/Typefaces/Monument-Grotesk/Dinamo_MonumentGrotesk_245559130_303674597862522_3144284009223240516_n.jpg
			match = src.match(/^[a-z]+:\/\/[^/]+\/+(eyJ[^/?#]+)(?:[?#].*)?$/);
			if (match) {
				let decoded = base64_decode(match[1]);
				let json = JSON_parse(decoded);

				if (json.bucket && json.key)
					return "https://" + json.bucket + ".s3.amazonaws.com/" + json.key;
			}
		}

		if (domain_nowww === "society6.com") {
			// https://society6.com/cdn/0011/p/3317372_11083960_b.jpg
			//   https://society6.com/cdn/0011/p/3317372_11083960_i.jpg -- 524x800
			// i, l, b, lz, m, a, j, f, p, h, z, r, k, d, t, s, c, g, n
			// other:
			// https://ctl.s6img.com/cdn/0025/p/9915823_12818099_hres-937a08658aa2c03520888eb1784d7cb5fa13138a281c21b6901fc11ba6363715.jpg -- 1200x658, upscaled?
			return src.replace(/(\/cdn\/+[0-9]+\/+p\/+[0-9]+_[0-9]+_)(?:[a-z]|lz)\./, "$1i.");
		}

		if (domain_nowww === "jazzmusicarchives.com") {
			// thanks to anonymous for reporting:
			// https://www.jazzmusicarchives.com/images/covers/thumbnails/ron-carter-all-alone-20161124143938_140.jpg
			//   https://www.jazzmusicarchives.com/images/covers/thumbnails/ron-carter-all-alone-20161124143938_140.jpg
			return src.replace(/(\/images\/+[^/]+\/+)thumbnails\/+([^/]+)_[0-9]+\./, "$1$2.");
		}

		if (domain === "central.bac-lac.gc.ca") {
			// thanks to anonymous for reporting:
			// https://central.bac-lac.gc.ca/.item?app=fondsandcol&op=thumb&height=150&id=e011044199-v8&lang=eng
			//   https://central.bac-lac.gc.ca/.item?app=fondsandcol&id=e011044199-v8&lang=eng -- 1000x804
			if (/^[a-z]+:\/\/[^/]+\/+\.item\?(?:.*&)?id=/.test(src)) {
				return {
					url: remove_queries(src, ["op", "width", "height"]),
					can_head: false // 415
				};
			}
		}

		if (domain === "img.broadtime.com") {
			// thanks to anonymous for reporting:
			// https://img.broadtime.com/Photo/418467231820:800 -- 800x800
			//   https://img.broadtime.com/Photo/418467231820 -- 2000x2000
			// other:
			// https://img.broadtime.com/Photo/418466438486 -- 2592x1944
			return src.replace(/(\/Photo\/+[0-9]+):[0-9]+(?:[?#].*)?$/, "$1");
		}

		if (domain === "cdn.twibooru.org") {
			// thanks to anonymous for reporting:
			// https://cdn.twibooru.org/img/2020/7/9/25/thumb.webp
			//   https://cdn.twibooru.org/img/2020/7/9/25/small.webp
			//   https://cdn.twibooru.org/img/2020/7/9/25/medium.png
			//   https://cdn.twibooru.org/img/2020/7/9/25/large.png
			//   https://cdn.twibooru.org/img/2020/7/9/25/full.png -- 1980x1238
			// https://cdn.twibooru.org/img/2023/5/17/2976635/thumb.webp
			//   https://cdn.twibooru.org/img/2023/5/17/2976635/full.jpeg -- 1419x2048
			// other:
			// https://cdn.twibooru.org/img/2023/5/17/2976626/full.png -- 3400x2180
			newsrc = src.replace(/(\/img\/+[0-9]{4}\/+(?:[0-9]{1,2}\/+){2}[0-9]+\/+)(?:thumb|small|medium|large)\./, "$1full.");
			if (newsrc !== src)
				return add_extensions_with_jpeg(newsrc);
		}

		if (domain === "media.forgecdn.net") {
			// thanks to anonymous for reporting:
			// https://media.forgecdn.net/avatars/thumbnails/32/621/64/64/635883348390460005.jpeg
			//   https://media.forgecdn.net/avatars/32/621/635883348390460005.jpeg
			return src.replace(/(\/avatars\/+)thumbnails\/+([0-9]+\/+[0-9]+\/+)[0-9]+\/+[0-9]+\/+/, "$1$2");
		}

		if (domain_nowww === "alamy.com") {
			// thanks to anonymous for reporting
			// https://www.alamy.com/aggregator-api/download/?url=https%3A%2F%2Fc7.alamy.com%2Fcomp%2FT75KY8%2Fleon-iloilo-philippines-isolated-view-of-a-statue-of-mother-mary-mater-dolorosa-at-a-good-friday-procession-around-the-church-T75KY8.jpg
			//   https://c7.alamy.com/comp/T75KY8/leon-iloilo-philippines-isolated-view-of-a-statue-of-mother-mary-mater-dolorosa-at-a-good-friday-procession-around-the-church-T75KY8.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+aggregator-api\/+download\/+\?(?:.*&)?url=(http[^&]+)(?:[&#].*)?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);

			// thanks to anonymous for reporting:
			// https://www.alamy.com/chinese-actress-liu-yan-poses-at-the-opening-ceremony-for-taipingyuan-international-furniture-expo-mall-in-chengdu-city-southwest-chinas-sichuan-pro-image263490474.html
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+[^/]+-image([0-9]+)\.html(?:[?#].*)?$/,
				query_for_id: "https://www.alamy.com/a-image${id}.html",
				process: function(done, resp, cache_key) {
					let match = resp.responseText.match(/<script id="__NEXT_DATA__"[^>]*>({.*?})<\/script>/);
					if (!match) {
						console_error(cache_key, "Unable to find NEXT_DATA in", resp);
						return done(null, false);
					}

					let json = JSON_parse(match[1]);
					let product = json.props.pageProps.product;

					let extra:InfoExtraObject = {
						page: product.uri,
						caption: product.meta.mediatitle,
						created_date: new Date(product.firstcreated).getTime() // firstcreated < uploaddate
					};

					let urls = [];
					urls.push(product.renditions.zoom.href.replace(/\/zooms\/+[0-9]+\/+/, "/zooms/15/"));

					return done(fillobj_urls(urls, {extra: extra}), 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nosub === "alamy.com" && /^c[0-9]*\./.test(domain)) {
			// thanks to anonymous for reporting:
			// https://c7.alamy.com/zooms/9/dfd36a5c74a94701bb37c2f3c3538c0c/f31txt.jpg
			//   https://c7.alamy.com/zooms/15/dfd36a5c74a94701bb37c2f3c3538c0c/f31txt.jpg -- 1300x957
			// other:
			// https://l450v.alamy.com/450vfr/g7dh3n/le-chanteur-peter-andre-et-le-mannequin-jordan-posent-pour-les-photographes-lors-d-une-seance-photo-au-stand-bravado-de-leurs-agents-de-licence-au-salon-des-licences-de-marques-a-earls-court-a-l-ouest-de-londres-le-couple-de-celebrites-explore-les-possibilites-de-license-leur-propre-marque-puissante-g7dh3n.jpg
			return src.replace(/\/zooms\/+(?:[0-9]|10)\/+/, "/zooms/15/");
		}

		if (host_domain_nowww === "alamy.com" && options.element) {
			if (options.element.tagName.toUpperCase() === "SVG") {
				let img = options.element.querySelector("image");
				if (img) {
					return img.getAttribute("href");
				}
			}
		}

		if (domain_nowww === "snapxcdn.com") {
			// thanks to anonymous for reporting:
			// https://snapxcdn.com/v2/?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1cmwiOiJodHRwczovL3Njb250ZW50LmNkbmluc3RhZ3JhbS5jb20vdi90NTEuMjg4NS0xNS8zNDA2NzIxNjBfNzQ4NjQ1MzcwMjY3NjYzXzg0NDkxNDU5Njc4MjgzNDYyMzlfbi5qcGc_c3RwPWRzdC1qcGdfZTE1Jl9uY19odD1zY29udGVudC5jZG5pbnN0YWdyYW0uY29tJl9uY19jYXQ9MTExJl9uY19vaGM9UjJham5VQ1FVZ1FBWDlqMjNVNSZlZG09QVBzMTdDVUJBQUFBJmNjYj03LTUmb2g9MDBfQWZCSi0yNUlUcmU2bmlOTkItS2ZweFJkYUMzT2JZYUotV1A1SUFRNFpYZVN4ZyZvZT02NDY4RkREQyZfbmNfc2lkPWRmMDQ0ZiIsImZpbGVuYW1lIjoiU25hcGluc3RhLmFwcF90aHVtYl8zNDA2NzIxNjBfNzQ4NjQ1MzcwMjY3NjYzXzg0NDkxNDU5Njc4MjgzNDYyMzlfbi5qcGcifQ._0zHuJCQNGPiXKYTllH2BAUISM3qtEZNBA9QR5olDmU
			//   https://scontent.cdninstagram.com/v/t51.2885-15/340672160_748645370267663_8449145967828346239_n.jpg?stp=dst-jpg_e15&_nc_ht=scontent.cdninstagram.com&_nc_cat=111&_nc_ohc=R2ajnUCQUgQAX9j23U5&edm=APs17CUBAAAA&ccb=7-5&oh=00_AfBJ-25ITre6niNNB-KfpxRdaC3ObYaJ-WP5IAQ4ZXeSxg&oe=6468FDDC&_nc_sid=df044f
			match = src.match(/[?&]token=eyJ[^.&]+\.(eyJ[^.&]+)\./);
			if (match) {
				let splitted = match[1].split("_");
				let jsonstr = base64_decode(splitted[0]);
				if (splitted[1])
					jsonstr += "?" + base64_decode(splitted[1]);
				let json = JSON_parse(jsonstr);
				return json.url;
			}
		}

		if (domain_nowww === "pictures.immobilienscout24.de") {
			// thanks to TheLastZombie on github:
			// https://pictures.immobilienscout24.de/listings/5cbb91ee-1de8-4d53-9f8e-3abeccb722d6-1621011989.jpg/ORIG/resize/1106x830%3E/format/webp/quality/73
			//   https://pictures.immobilienscout24.de/listings/5cbb91ee-1de8-4d53-9f8e-3abeccb722d6-1621011989.jpg/resize/1106x830%3E/format/webp/quality/73
			//   https://pictures.immobilienscout24.de/listings/5cbb91ee-1de8-4d53-9f8e-3abeccb722d6-1621011989.jpg
			return src.replace(/(\/listings\/+[-0-9a-f]+-[0-9]+\.[^/.]+)\/.*$/, "$1");
		}

		if (domain === "cdn.nettiauto.com") {
			// thanks to anonymous for reporting:
			// https://cdn.nettiauto.com/live/2023/05/14/64d0cbfbd5e888cf-medium.jpg
			//   https://cdn.nettiauto.com/live/2023/05/14/64d0cbfbd5e888cf.jpg
			return src.replace(/(\/[0-9]{4}\/+(?:[0-9]{2}\/+){2}[0-9a-f]+)-[a-z]+\./, "$1.");
		}

		if (domain === "cdn.80sdb.com") {
			// thanks to anonymous for reporting:
			// https://cdn.80sdb.com/small/5/9/59fdf27c.webp
			//   https://cdn.80sdb.com/preview/5/9/59fdf27c.webp -- 600x600
			// https://cdn.80sdb.com/preview/c/c/cc01f55d.webp -- 2000x850
			return src.replace(/\/(?:small|medium)\/+/, "/preview/");
		}

		if ((domain_nosub === "liveauctioneers.com" && /^p[0-9]\./.test(domain)) ||
			// https://images.liveauctioneers.com/3283/281411/148550351_1_x.jpg
			//   https://images.liveauctioneers.com/3283/281411/148550351_1_x.jpg?quality=100
			domain === "images.liveauctioneers.com") {
			// thanks to anonymous for reporting:
			// https://images.liveauctioneers.com/3283/281411/148550351_1_l.jpg
			//   https://p1.liveauctioneers.com/3283/281411/148550351_1_x.jpg?quality=80&version=1678743823
			//   https://p1.liveauctioneers.com/3283/281411/148550351_1_x.jpg?quality=100
			// x, m, l, t, c
			// other:
			// https://images.liveauctioneers.com/previews/prod/4708/38659.jpg
			return src
				.replace(/(:\/\/[^/]+\/+[0-9]+\/+[0-9]+\/+[0-9]+_[0-9]+_x\.[^/.?#]+)(?:[?#].*)?$/, "$1?quality=100")
				.replace(/(:\/\/[^/]+\/+[0-9]+\/+[0-9]+\/+[0-9]+_[0-9]+_)[a-z]+\./, "$1x.");
		}

		if (domain === "d2i8ejbvsgsqtt.cloudfront.net") {
			// thanks to louthecute on discord for reporting:
			// https://d2i8ejbvsgsqtt.cloudfront.net/gallery/indy/2023/20230528-phurley/med/_4PH2347.jpg
			//   https://d2i8ejbvsgsqtt.cloudfront.net/gallery/indy/2023/20230528-phurley/thumbnails/_4PH2347.jpg
			//   https://d2i8ejbvsgsqtt.cloudfront.net/gallery/indy/2023/20230528-phurley/hires/_4PH2347.jpg
			return src.replace(/(\/gallery\/.*\/)(?:med|thumbnails)(\/+[^/]+)(?:[?#].*)?$/, "$1hires$2");
		}

		if (domain_nosub === "tapas.io" ||
			// https://d30womf5coomej.cloudfront.net/sa/f1/e50af48f-7bd6-433c-b3ae-4737b720d1bb_z.jpg
			//   https://d30womf5coomej.cloudfront.net/sa/f1/e50af48f-7bd6-433c-b3ae-4737b720d1bb.jpg
			domain === "d30womf5coomej.cloudfront.net") {
			// thanks to TristanWasTaken on github: https://github.com/qsniyg/maxurl/issues/1182
			// https://us-a.tapas.io/sa/f1/e50af48f-7bd6-433c-b3ae-4737b720d1bb_z.jpg
			//   https://us-a.tapas.io/sa/f1/e50af48f-7bd6-433c-b3ae-4737b720d1bb.jpg
			return src.replace(/(\/[a-z]{2}\/+[0-9a-f]{2}\/+[-0-9a-f]{10,})_[a-z]\./, "$1.");
		}

		if (domain_nowww === "jokejive.com") {
			// thanks to anonymous for reporting:
			// https://www.jokejive.com/images/jokejive/s_74/7457ace0a8c068727814333dddf7b421.png
			//   https://www.jokejive.com/images/jokejive/74/7457ace0a8c068727814333dddf7b421.png
			return src.replace(/(\/images\/+jokejive\/+)s_([0-9]+\/+)/, "$1$2");
		}

		if (amazon_container === "brandarmy-prod") {
			// thanks to anonymous for reporting:
			// https://brandarmy-prod.s3-accelerate.amazonaws.com/bmemqjx88g2/images/thumbs/9o0y8njyx6l9t4qqwnr0.jpeg
			//   https://brandarmy-prod.s3-accelerate.amazonaws.com/bmemqjx88g2/images/9o0y8njyx6l9t4qqwnr0.jpeg
			return src.replace(/(\/[0-9a-z]+\/+images\/+)thumbs\/+/, "$1");
		}

		if (domain === "am-a.akamaihd.net") {
			// thanks to anonymous for reporting:
			// https://am-a.akamaihd.net/image?resize=60:&f=http%3A%2F%2Fstatic.lolesports.com%2Fleagues%2FSL21-V-white.png
			//   https://static.lolesports.com/leagues/SL21-V-white.png
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+image\?(?:.*&)?f=(http[^&]+)(?:[&#].*)?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "bnkr.b-cdn.net") {
			// https://bnkr.b-cdn.net/maintenance.mp4
			if (/:\/\/[^/]+\/+maintenance.mp4(?:[?#].*)?$/.test(src)) {
				return {
					url: src,
					bad: true
				};
			}
		}

		if (domain_nosub === "bunkr.ru" && /^(?:i[0-9]*|[-a-z]+-[0-9]*img|i-[a-z]+)\./.test(domain)) {
			// https://i8.bunkr.ru/404-file-video-not-found-OiF5LGXg.jpg
			if (/\/404-file-video-not-found-OiF5LGXg\./.test(src))
				return {
					url: src,
					bad: true
				};

			// https://i11.bunkr.ru/thumbs/002-YACPEm3Q.png
			//   https://i11.bunkr.ru/002-YACPEm3Q.jpg
			newsrc = src.replace(/\/thumbs\/+/, "/");
			if (newsrc !== src) {
				// thanks to anonymous for reporting:
				// https://i-milkshake.bunkr.ru/thumbs/2_918-I2v4dD1g.png
				//   https://i-milkshake.bunkr.ru/2_918-I2v4dD1g.jpeg
				let newsrcs = add_full_extensions(newsrc, ["png", "jpg", "jpeg"]);
				let videosrc = newsrc.replace(/^[a-z]+:\/\/i([0-9]*)\.[^/]+\/+([^/]+)\.[a-z]+$/, "https://media-files$1.bunkr.la/$2.mp4");
				if (videosrc !== newsrc) {
					let match = parse_int(videosrc.match(/:\/\/media-files([0-9]*)\./)[1]);
					if (match < 12 || isNaN(match)) {
						videosrc = videosrc.replace(/\.bunkr\.la\//, ".bunkr.ru/");
					}

					newsrcs.unshift({
						url: videosrc,
						video: true
					});
				}

				return newsrcs;
			}
		}

		if (domain_nowww === "cyberdrop.me") {
			// thanks to anonymous for reporting:
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+f\/+([0-9a-zA-Z]+)(?:[?#].*)?$/,
				query_for_id(id) {
					let url = "https://" + domain + "/f/" + id;
					return {
						url: "https://" + domain + "/api/f/" + id,
						imu_mode: "xhr",
						headers: {
							Accept: "application/json, text/plain, */*",
							Referer: url
						},
						json: true
					};
				},
				process(done, resp, cache_key) {
					if (!resp.url) {
						console_error(cache_key, "Unable to find URL from", resp);
						return done(null, false);
					}

					let obj:BigImageInfoSObject = {
						url: resp.url
					};

					if (resp.type && /^video\//.test(resp.type))
						obj.video = true;

					return done(obj, 50*60); // expires in 60 minutes
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nosub === "cyberdrop.cloud" && host_domain_nowww === "cyberdrop.me" && options.element) {
			var link_el = common_functions["get_link_el_matching"](options.element.parentElement, el => el.href && /\/f\/+[a-zA-Z0-9]+$/.test(el.href));

			if (link_el) {
				return {
					url: link_el.href,
					is_pagelink: true
				};
			}
		}

		if (domain_nowww === "webm.red") {
			// https://webm.red/thumb/uTXw.jpg
			//   https://webm.red/uTXw.webm
			// https://webm.red/thumb/tme6.jpg
			//   https://webm.red/tme6.webm
			newsrc = src.replace(/\/thumb\/+([a-zA-Z0-9]+)\.jpg(?:[?#].*)?$/, "/view/$1");
			if (newsrc !== src) {
				return {
					url: newsrc,
					is_pagelink: true
				};
			}

			newsrc = src.replace(/\/view\/+([a-zA-Z0-9]+)(?:\.webm)?(?:[?#].*)?$/, "/$1.webm");
			if (newsrc !== src) {
				return {
					url: newsrc,
					video: true
				};
			}
		}

		if (domain_nowww === "wolfstream.tv") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+([0-9a-z]+)\/+[^/]+\.html(?:[?#].*)?$/,
				query_for_id: "https://wolfstream.tv/${id}/.html",
				process: function(done, resp, cache_key) {
					let match = resp.responseText.match(/sources: \[{file:("[^"]+")}\],\s*image: ("[^"]+"),/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					let videofile = JSON_parse(match[1]);
					let imagefile = JSON_parse(match[2]);

					return done([
						{
							url: videofile,
							video: "hls",
							headers: {
								Origin: "https://wolfstream.tv",
								Referer: "https://wolfstream.tv/",
								"Sec-Fetch-Dest": "empty",
								"Sec-Fetch-Mode": "cors",
								"Sec-Fetch-Site": "same-site"
							}
						},
						imagefile
					], 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "beam-images.warnermediacdn.com") {
			// thanks to anonymous for reporting:
			// https://beam-images.warnermediacdn.com/BEAM_LWM_DELIVERABLES/d86dcb48-688a-4985-ae39-9f84e4e03776/da2fba31548f7ec4101c190037b02645e9ae7fb0.png?host=wbd-images.prod-vod.h264.io&w=100
			return remove_queries(src, "w");
		}

		if (domain_nowww === "dior.com") {
			// thanks to anonymous for reporting:
			// https://www.dior.com/couture/var/dior/storage/images/horizon/fragrance-and-beauty/la-collection-privee-giftsets/eden-roc-gift-set/eden-roc-gift-set-image/29503097-1-eng-GB/eden-roc-gift-set-image_1440_1200.jpg?imwidth=200
			//   https://www.dior.com/couture/var/dior/storage/images/horizon/fragrance-and-beauty/la-collection-privee-giftsets/eden-roc-gift-set/eden-roc-gift-set-image/29503097-1-eng-GB/eden-roc-gift-set-image.jpg
			newsrc = src.replace(/(\/var\/+[^/]+\/+storage\/+images\/.*?\.[^/.?#]+)(?:[?#].*)?$/, "$1");
			if (newsrc !== src)
				return newsrc;
			return src.replace(/(\/var\/+[^/]+\/+storage\/+images\/.*?)_[0-9]+_[0-9]+(\.[^/.?#]+)$/, "$1$2")
		}

		if (domain === "mediacache.wax.io") {
			// thanks to jonestly on discord:
			// https://mediacache.wax.io/QmdfYQy7DKm3GgHWD2UXio5RnfSSZcdnPrUtEowc3kabfy/533x300
			//   https://mediacache.wax.io/QmdfYQy7DKm3GgHWD2UXio5RnfSSZcdnPrUtEowc3kabfy
			return src.replace(/(:\/\/[^/]+\/+[0-9a-zA-Z]+)\/+[0-9]+x[0-9]+(?:[?#].*)?$/, "$1");
		}

		if (domain_nowww === "dominomusic.com") {
			// thanks to jonestly on discord:
			// https://www.dominomusic.com/res/PzNl/650_650/2191.png
			//   https://www.dominomusic.com/res/PzNl/2191.png
			return src.replace(/(\/res\/+[^/]+\/+)[0-9]+_[0-9]+\//, "$1");
		}

		if (domain_nowww === "delcampe.net") {
			// thanks to anonymous for reporting:
			// https://www.delcampe.net/static/img_small/auction/001/530/457/030_001.jpg
			//   https://www.delcampe.net/static/img_thumb/auction/001/530/457/030_001.jpg
			//   https://www.delcampe.net/static/img_large/auction/001/530/457/030_001.jpg
			return src.replace(/\/img_(?:small|thumb)\/+/, "/img_large/");
		}

		if (domain === "cdn.hmv.com") {
			// thanks to anonymous for reporting:
			// https://cdn.hmv.com/r/w-1280/p-webp/hmv/files/e9/e9346824-4fb7-4fdd-b5df-9462dcc78294.jpg
			//   https://cdn.hmv.com/r/p-webp/hmv/files/e9/e9346824-4fb7-4fdd-b5df-9462dcc78294.jpg
			//   https://hmv.com/getattachment/e9346824-4fb7-4fdd-b5df-9462dcc78294/a.jpg
			// https://cdn.hmv.com/r/w-640/hmv/files/54/54d69aea-c9ac-4e77-8ba2-7be88708a8d2.jpg
			//   https://hmv.com/getattachment/54d69aea-c9ac-4e77-8ba2-7be88708a8d2/a.jpg
			// other:
			// https://hmv.com/getmedia/61842e9a-0208-4d00-96a6-cf5cef8382b8/KENJI-30-Coupon_feature_panel.jpg
			return src.replace(/^[a-z]+:\/\/[^/]+\/+r\/.*?\/hmv\/+files\/+[0-9a-f]{2}\/+([-0-9a-f]{10,})(\.[a-z]+)(?:[?#].*)?$/, "https://hmv.com/getattachment/$1/a$2");
			//return src.replace(/\/r\/+.*?\/+(p-[a-z]+)\/+/, "/r/$1/");
		}

		if (domain_nowww === "ososedki.com" ||
			// thanks to anonymous for reporting:
			// https://cosplaythots.com/images/a/604/-166908530/259321137/456373847.jpg
			//   https://cosplaythots.com/images/a/1280/-166908530/259321137/456373847.jpg
			domain_nowww === "cosplaythots.com") {
			// thanks to vscum on github: https://github.com/qsniyg/maxurl/issues/1191
			// https://ososedki.com/images/a/604/-166908530/292789896/457655229.jpg
			//   https://ososedki.com/images/a/1280/-166908530/292789896/457655229.jpg
			return src.replace(/\/images\/+a\/+604\/+/, "/images/a/1280/");
		}

		if (digitalocean_container === "immub-space") {
			// thanks to anonymous for reporting:
			// https://immub-space.nyc3.digitaloceanspaces.com/capas/9443/thumbnails/t_9443ca.jpg
			//   https://immub-space.nyc3.digitaloceanspaces.com/capas/9443/9443ca.jpg
			return src.replace(/\/thumbnails\/+t_/, "/");
		}

		if (domain === "d1o6h00a1h5k7q.cloudfront.net") {
			// thanks to anonymous for reporting:
			// https://d1o6h00a1h5k7q.cloudfront.net/imagens/img_p/17789/8561328.jpg
			//   https://d1o6h00a1h5k7q.cloudfront.net/imagens/img_g/17789/8561328.jpg
			return src.replace(/(\/imagens\/+img_)[pm]\/+/, "$1g/");
		}

		if (domain_nowww === "newspapers.com") {
			newsrc = website_query({
				website_regex: /:\/\/[^/]+\/+image\/+([0-9]+)\/*([?#].*)?$/,
				query_for_id: {
					url: "https://www.newspapers.com/image/${id}/${2}",
					imu_mode: "document"
				},
				process: function(done, resp, cache_key) {
					let match = resp.responseText.match(/var page\s*=\s*({.*?});\s*<\/script>/);
					if (!match) {
						console_error(cache_key, "Unable to find page match for", resp);
						return done(null, false);
					}

					let json = JSON_parse(match[1]);

					if (!json.iat) {
						console_error(cache_key, "No IAT for", resp, json);
						return done(null, false);
					}

					let queries = {
						id: json.image.imageId,
						width: json.image.width,
						height: json.image.height,
						crop: "0,0," + json.image.width + "," + json.image.height,
						brightness: 0,
						contrast: 0,
						invert: 0,
						ts: 1,
						cacheable: 1,
						iat: json.iat
					};

					return done({
						url: "https://img.newspapers.com/img/img?" + stringify_queries(queries, true)
					}, 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "img.newspapers.com") {
			// thanks to anonymous for reporting:
			// https://img.newspapers.com/img/img?user=10480897&id=231388705&clippingId=55445062&width=820&height=723&crop=35_3310_3660_3229&rotation=0
			//   https://img.newspapers.com/img/img?clippingId=55445062
			return src.replace(/\/img\/+img\?(?:.*&)?(clippingId=[0-9]+)(?:&.*)?$/, "/img/img?$1");
		}

		if (domain_nowww === "devkis.club") {
			// thanks to anonymous for reporting:
			// https://devkis.club/pict.php?src=https://devkis.club/uploads/posts/2014-12/thumbs/1418284824_b00.jpg&w=260&h=347&zc=1
			//   https://devkis.club/uploads/posts/2014-12/1418284824_b00.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+pict\.php\?(?:.*&)?src=(http[^&]+)(?:[&#].*)?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "community.adobe.com") {
			// thanks to anonymous for reporting:
			// https://community.adobe.com/t5/image/serverpage/image-id/555618i473DCB71671F71CC/image-dimensions/150x150/image-coordinates/0%2C0%2C1024%2C1024/constrain-image/false?v=v2
			//   https://community.adobe.com/t5/image/serverpage/image-id/555618i473DCB71671F71CC/
			return src.replace(/(\/image-id\/+[0-9]+i[0-9A-F]{16}\/+).*/, "$1");
		}

		if (domain === "d1u0ygfig6vnfa.cloudfront.net") {
			// thanks to anonymous for reporting:
			// https://d1u0ygfig6vnfa.cloudfront.net/gallery-artwork/_galleryThumb/ldbth156.jpg
			//   https://d1u0ygfig6vnfa.cloudfront.net/gallery-artwork/ldbth156.jpg
			return src.replace(/(\/gallery-artwork\/+)_galleryThumb\/+/, "$1");
		}

		if (domain_nowww === "vgmsite.com") {
			// thanks to anonymous for reporting:
			// https://vgmsite.com/soundtracks/not-for-broadcast-original-soundtrack-2020/thumbs/album.jpg
			//   https://vgmsite.com/soundtracks/not-for-broadcast-original-soundtrack-2020/album.jpg
			return src.replace(/\/thumbs\/+([^/]+)(?:[?#].*)?$/, "/$1");
		}

		if (domain === "statics.indozone.news") {
			// thanks to anonymous for reporting:
			// https://statics.indozone.news/content/2022/11/20/8Jsam0N/kisah-hidup-unik-hercules-manusia-setengah-dewa-hasil-dari-perselingkuhan-zeus36_700.jpg
			//   https://statics.indozone.news/content/2022/11/20/8Jsam0N/kisah-hidup-unik-hercules-manusia-setengah-dewa-hasil-dari-perselingkuhan-zeus36.jpg
			return src.replace(/(\/content\/+[0-9]{4}\/+.*)_[0-9]+(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "atomgallery.co.uk") {
			// thanks to anonymous for reporting:
			// https://www.atomgallery.co.uk/images/resize.php?src=%2Fuser%2Fproducts%2FGROWUP_bullshit2_01.jpg&xy=50
			//   https://www.atomgallery.co.uk/user/products/GROWUP_bullshit2_01.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+images\/+resize\.php\?(?:.*&)?src=([^&]+)(?:[&#].*)?$/, "$1");
			if (newsrc !== src)
				return urljoin(src, decodeuri_ifneeded(newsrc), true);
		}

		if (domain === "img.tineye.com") {
			// thanks to anonymous for reporting:
			// https://img.tineye.com/result/65fb3226b395da68b61a47427e3f7c59852eb20fdcf035b5437cc97d333d4ff2-4?size=160
			//   https://img.tineye.com/result/65fb3226b395da68b61a47427e3f7c59852eb20fdcf035b5437cc97d333d4ff2-4?size=9999
			return {
				url: src.replace(/(\/result\/+[0-9a-f]+-[0-9]+)(?:[?#].*)?$/, "$1?size=9999"),
				head_wrong_contenttype: true
			};
		}

		if (domain === "bu.azureedge.net") {
			// thanks to povpsycho on discord for reporting:
			// https://bu.azureedge.net/m2img/small_image/P/U/PUZZ290310_3.jpg
			//   https://bu.azureedge.net/m2img/image/P/U/PUZZ290310_3.jpg
			return src.replace(/(\/m2img\/+)(?:small_)?image\//, "$1image/");
		}

		if (domain_nowww === "threads.net" && options && options.do_request && options.cb) {
			let threads_get_csrf = function(cb) {
				if (!options.get_cookies) {
					console_error("No cookie support");
					return cb(null);
				}

				options.get_cookies("https://www.threads.net/", function(cookies) {
					if (!cookies) {
						console_error("Unable to get cookies for threads");
						return cb(null);
					}

					cookies = headers_list_to_dict(cookies);
					if (!("csrftoken" in cookies)) {
						console_error("csrftoken doesn't exist, try visiting threads.net");
						return cb(null);
					}

					cb(cookies["csrftoken"] || null);
				});
			};

			let threads_get_lsd_token = function(cb) {
				api_query("threads:lsd", {
					url: "https://www.threads.net/"
				}, cb, function(done, resp, cache_key) {
					let lsdmatch = resp.responseText.match(/\["LSD",\[\],{"token":("[^"]+")}/);
					if (!lsdmatch) {
						console_error(cache_key, "Unable to find LSD token match", resp);
						return done(null, false);
					}

					let token = JSON_parse(lsdmatch[1]);
					return done(token, 60*60);
				});
			};

			let threads_get_tokens = function(cb) {
				threads_get_csrf(csrf => {
					if (!csrf)
						return cb(null);

					threads_get_lsd_token(token => {
						cb({csrf, lsd: token});
					});
				});
			};

			let threads_get_best_image = function(candidates) {
				var has_nonsquare = false;

				for (let candidate of candidates) {
					if (candidate.width !== candidate.height)
						has_nonsquare = true;
				}

				let new_candidates = shallowcopy(candidates);
				new_candidates.sort(function(a, b) {
					let a_total = a.width * a.height;
					let b_total = b.width * b.height;

					return b_total - a_total;
				});

				for (let candidate of new_candidates) {
					if (has_nonsquare && candidate.width === candidate.height)
						continue;

					return candidate;
				}

				return candidates[0];
			};

			let threads_apicall = function(query, cb) {
				threads_get_tokens(function(tokens) {
					if (!tokens)
						return cb(null);

					if (!query.lsd)
						query.lsd = tokens.lsd;
					if (!("server_timestamps" in query))
						query.server_timestamps = "true";
					if (!query.fb_api_caller_class)
						query.fb_api_caller_class = "RelayModern";

					if (query.variables && typeof query.variables !== "string") {
						query.variables = JSON_stringify(query.variables);
					}

					options.do_request({
						url: "https://www.threads.net/api/graphql",
						method: "POST",
						data: stringify_queries(query),
						imu_mode: "xhr",
						headers: {
							Accept: "*/*",
							"Content-Type": "application/x-www-form-urlencoded",
							Origin: "https://www.threads.net",
							Referer: "https://www.threads.net/",
							"Sec-Fetch-Dest": "empty",
							"Sec-Fetch-Mode": "cors",
							"Sec-Fetch-Site": "same-origin",
							"X-Asbd-Id": "129477",
							"X-Csrftoken": tokens.csrf,
							"X-Fb-Friendly-Name": query.fb_api_req_friendly_name,
							"X-Fb-Lsd": tokens.lsd,
							"X-Ig-App-Id": "238260118697367"
						},
						onload: function(resp) {
							if (resp.status !== 200) {
								console_error("threads: Unable to query", query, resp);
								return cb(null);
							}

							let json = null;
							try {
								json = JSON_parse(resp.responseText);
							} catch (e) {
								console_error("threads: Unable to parse JSON for", resp, query);
								return cb(null);
							}

							return cb(json);
						}
					});
				});
			};

			let threads_query_post = function(postid, cb) {
				let cache_key = "threads:post:" + postid;
				api_cache.fetch(cache_key, cb, function(done) {
					threads_apicall({
						fb_api_req_friendly_name: "BarcelonaPostPageQuery",
						doc_id: "7074652575968011",
						variables: {
							"postID": postid,
							"__relay_internal__pv__BarcelonaIsLoggedInrelayprovider": false,
							"__relay_internal__pv__BarcelonaIsOriginalPostPillEnabledrelayprovider": false,
							"__relay_internal__pv__BarcelonaIsThreadContextHeaderEnabledrelayprovider": false,
							"__relay_internal__pv__BarcelonaShouldShowFediverseM1Featuresrelayprovider": false,
							"__relay_internal__pv__BarcelonaIsInlineReelsEnabledrelayprovider": false,
							"__relay_internal__pv__BarcelonaUseCometVideoPlaybackEnginerelayprovider": false,
							"__relay_internal__pv__BarcelonaOptionalCookiesEnabledrelayprovider": true,
							"__relay_internal__pv__BarcelonaShouldShowFediverseM075Featuresrelayprovider": false
						}
					}, function(data) {
						if (!data) {
							return done(null, false);
						}

						let thread_items = data.data.data.edges[0].node.thread_items;
						//let thread_items = data.data.data.containing_thread.thread_items;
						for (let item of thread_items) {
							if (item.post.pk === postid) {
								return done(item.post, 60*60);
							}
						}

						return done(null, false);
					});
				});
			};

			let threads_query_post_by_shortcode = function(shortcode, cb) {
				common_functions["instagram_shortcode_to_id"](shortcode, function(id) {
					threads_query_post(id, cb);
				});
			};

			newsrc = website_query({
				website_regex: /^https?:\/\/[^/]+\/+(?:t\/+|@[^/]+\/+post\/+)([-_A-Za-z0-9]+)\/*(?:[?#].*)?$/,
				run: function(cb, match) {
					threads_query_post_by_shortcode(match[1], function(result) {
						let baseobj = {
							extra: {
								page: "https://www.threads.net/t/" + result.code,
								caption: result.caption.text,
								created_date: result.taken_at * 1000
							},
							headers: {
								Referer: "https://www.threads.net/"
							}
						};

						let best_image_obj = threads_get_best_image(result.image_versions2.candidates);

						let urls = [];

						if (result.video_versions && is_array(result.video_versions) && result.video_versions.length > 0)
							urls.push({
								url: result.video_versions[0].url, // FIXME: Is [0] the best quality?
								video: true
							});

						if (best_image_obj)
							urls.push(best_image_obj.url);

						return cb(fillobj_urls(urls, baseobj));
					})
				}
			});
			if (newsrc) return newsrc;
		}

		if (host_domain_nowww === "threads.net" && options.element && options.do_request && options.cb) {
			let threads_el_is_miniavatar = function(el) {
				if (el.tagName !== "IMG")
					return false;

				let height = el.getAttribute("height");
				if (!height)
					return false;

				return parse_int(height) <= 20;
			};

			let threads_get_post_root_el = function(el) {
				let current = el;

				while (current = current.parentElement) {
					if (current.tagName === "DIV" && current.getAttribute("data-pressable-container"))
						return current;
				}

				return null;
			}

			if (!threads_el_is_miniavatar(options.element)) {
				// check for post profile images
				if (options.element.tagName === "IMG" &&
					options.element.parentElement && options.element.parentElement.tagName === "DIV" &&
					options.element.parentElement.parentElement && options.element.parentElement.parentElement.tagName === "A") {
					let dblparent = options.element.parentElement.parentElement;
					let href = dblparent.href;
					if (/\/@[^/]+\/*(?:[?#].*)?$/.test(href)) {
						return {
							url: dblparent.href,
							is_pagelink: true
						};
					}
				}

				let post_root = threads_get_post_root_el(options.element);
				if (post_root) {
					let thread_a = post_root.querySelector('a[href*="/t/"]');
					if (!thread_a)
						thread_a = post_root.querySelector('a[href*="/post/"]');
					console_log(options.element, post_root, thread_a);
					if (thread_a) {
						return {
							url: thread_a.href,
							is_pagelink: true
						};
					}
				}
			}
		}

		if (domain_nowww === "toolboxrecords.com") {
			// thanks to anonymous for reporting:
			// https://www.toolboxrecords.com/public/images/products/1/6/f/32305/small.jpg
			//   https://www.toolboxrecords.com/public/images/products/1/6/f/32305/big.jpg -- 600x600
			// other:
			// https://www.toolboxrecords.com/public/images/products/b/9/f/40433/big.jpg -- 2085x2085
			return src.replace(/(\/public\/+images\/.*\/)(?:small|medium|large)\./, "$1big.");
		}

		if (domain === "api.roughtrade.com") {
			// thanks to anonymous for reporting:
			// https://api.roughtrade.com/media/thumbnails/products/20000000217298_b66a02e0_thumbnail_1024.webp
			return src.replace(/\/media\/+thumbnails\/+(products\/+[0-9]+_[0-9a-f]+)_thumbnail_[0-9]+\.webp(?:[?#].*)?$/, "/media/$1.jpg");
		}

		if (domain === "linkstorage.linkfire.com") {
			// thanks to fireattack on github: https://github.com/qsniyg/maxurl/issues/453
			// https://linkstorage.linkfire.com/medialinks/images/875d8b6d-5238-4f5c-8b71-4599cd3030c0/artwork-440x440.jpg
			//   https://linkstorage.linkfire.com/medialinks/images/875d8b6d-5238-4f5c-8b71-4599cd3030c0/artwork.jpg -- 2250x2250
			// thanks to remlap:
			// https://linkstorage.linkfire.com/medialinks/images/f86b9fa1-2e64-41cb-a78e-4f629363ef01/artwork-600x315.jpg
			//   https://linkstorage.linkfire.com/medialinks/images/f86b9fa1-2e64-41cb-a78e-4f629363ef01/artwork -- 550x550
			match = src.match(/^([a-z]+:\/\/[^/]+\/+medialinks\/+images\/+[^/]+\/+[^/]+)-[0-9]+x[0-9]+(\.[^/.?#]+)(?:[?#].*)?$/);
			if (match) {
				return [
					match[1] + match[2],
					match[1]
				];
			}
		}

		if (domain === "i.jpgjet.com") {
			// https://i.jpgjet.com/cache.php?url=https://thumbs.onlyfans.com/public/files/thumbs/w760/8/8q/8ql/8qlbtcz3e3cujd4idzokrcrlnh4x5obs1668807782/250044285/header.jpg
			//   https://thumbs.onlyfans.com/public/files/thumbs/w760/8/8q/8ql/8qlbtcz3e3cujd4idzokrcrlnh4x5obs1668807782/250044285/header.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+cache\.php\?(?:.*&)?url=([^&#]+)(?:[&#].*)?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "vp.nyt.com") {
			// thanks to anonymous for reporting:
			// https://vp.nyt.com/video/2023/07/11/109938_1_00sci-lightning-north_wg_360p.mp4
			//   https://vp.nyt.com/video/2023/07/11/109938_1_00sci-lightning-north_wg_1080p.mp4
			match = src.match(/^([a-z]+:\/\/[^/]+\/+video\/+[0-9]{4}\/+(?:[0-9]{2}\/+){2}[^/]+)_[0-9]+p(\.mp4)(?:[?#].*)?$/);
			if (match) {
				return fillobj_urls(replace_sizes(src, [
					match[1] + "_2160p" + match[2],
					match[1] + "_1440p" + match[2],
					match[1] + "_1080p" + match[2],
					match[1] + "_720p" + match[2],
					match[1] + "_480p" + match[2],
					match[1] + "_360p" + match[2],
					match[1] + "_240p" + match[2]
				]), {
					video: true
				});
			}
		}

		if (domain === "static-cdn.strpst.com") {
			// thanks to anonymous for reporting:
			// https://static-cdn.strpst.com/avatars/c/3/e/c3e8931e8298e3ff44f664a86a0ffc75-thumb -- 100x100
			//   https://static-cdn.strpst.com/avatars/c/3/e/c3e8931e8298e3ff44f664a86a0ffc75-full -- 200x200
			//   https://static-cdn.strpst.com/avatars/c/3/e/c3e8931e8298e3ff44f664a86a0ffc75 -- 800x800
			// thanks to anonymous for reporting:
			// https://static-cdn.strpst.com/photos/f/e/8/fe81e63a426acaf293851102f2ef0c96-preview -- 1200x1600
			//   https://static-cdn.strpst.com/photos/f/e/8/fe81e63a426acaf293851102f2ef0c96-full -- 1920x2560
			//   https://static-cdn.strpst.com/photos/f/e/8/fe81e63a426acaf293851102f2ef0c96 -- 2316x3088
			// thanks to anonymous for reporting:
			// https://static-cdn.strpst.com/previews/0/8/2/082a048ad87a6e24660a6c64e572f950-thumb-big -- 400x663
			//   https://static-cdn.strpst.com/previews/0/8/2/082a048ad87a6e24660a6c64e572f950
			return src.replace(/(\/(?:avatars|photos|intro|previews)\/+(?:[0-9a-f]\/+){3}[0-9a-f]{10,})-[a-z]+(?:-[a-z]+)?(?:[?#].*)?$/, "$1");
		}

		if (domain === "media.e-talenta.eu") {
			// https://media.e-talenta.eu/foto/165/0/1643384.jpg?token=[jwt]
			//   https://media.e-talenta.eu/foto/1643384.jpg?token=[jwt]
			return src.replace(/\/foto\/+[0-9]+\/+[0-9]+\/+/, "/foto/");
		}

		if (domain === "cdn.chili.com") {
			// https://cdn.chili.com/images/public/cms/f0/4c/e9/d8/f04ce9d8-74fe-4b11-be9c-8c38fb19aea1.jpg?width=370&wm=h_avodadvs_it
			//   https://cdn.chili.com/images/public/cms/f0/4c/e9/d8/f04ce9d8-74fe-4b11-be9c-8c38fb19aea1.jpg?width=0
			return src.replace(/(\/images\/+public\/+cms\/.*?)(?:[?#].*)?$/, "$1?width=0");
		}

		if (domain === "img-cdn-p.ekstrabladet.dk") {
			// thanks to fyhtma on github: https://github.com/qsniyg/maxurl/issues/1197
			// https://img-cdn-p.ekstrabladet.dk/image/ekstrabladet/3963023/p730/?at=4ee714990ce3e23a25b8328317de2d1d
			//   https://img-cdn-p.ekstrabladet.dk/image/ekstrabladet/3963023/p910/?at=4ee714990ce3e23a25b8328317de2d1d
			//   https://img-cdn-p.ekstrabladet.dk/image/ekstrabladet/3963023/relationBig_910/?at=4ee714990ce3e23a25b8328317de2d1d
			//   https://img-cdn-p.ekstrabladet.dk/image/ekstrabladet/3963023/original/?at=4ee714990ce3e23a25b8328317de2d1d
			return src.replace(/(\/image\/+[^/]+\/+[0-9]+\/+)[a-zA-Z]+_?[0-9]+\/+/, "$1original/");
		}

		if (domain === "cdn.v2ex.com") {
			// thanks to n0099 on github: https://github.com/qsniyg/maxurl/issues/1187
			// https://cdn.v2ex.com/avatar/b0f5/edea/608064_normal.png?m=1682942036
			//   https://cdn.v2ex.com/avatar/b0f5/edea/608064_large.png?m=1682942036
			//   https://cdn.v2ex.com/avatar/b0f5/edea/608064_xlarge.png?m=1682942036
			//   https://cdn.v2ex.com/avatar/b0f5/edea/608064_xxlarge.png?m=1682942036
			//   https://cdn.v2ex.com/avatar/b0f5/edea/608064_xxxlarge.png?m=1682942036 -- 512x512
			return src.replace(/(\/avatar\/.*)_(?:normal|x{0,2}large)(\.[^/.]+(?:[?#].*)?)$/, "$1_xxxlarge$2");
		}

		if (domain === "meo.comick.pictures") {
			// thanks to anonymous for reporting:
			// https://meo.comick.pictures/jomx0X-s.jpg
			//   https://meo.comick.pictures/jomx0X-m.jpg
			//   https://meo.comick.pictures/jomx0X.jpg
			return src.replace(/(:\/\/[^/]+\/+[^/]+)-[sm]\./, "$1.");
		}

		if (domain_nosub === "wb.ru" && /^basket-[0-9]*\./.test(domain)) {
			// thanks to anonymous for reporting:
			// https://basket-01.wb.ru/vol65/part6596/6596809/images/c516x688/1.jpg
			//   https://basket-01.wb.ru/vol65/part6596/6596809/images/tm/1.jpg
			//   https://basket-01.wb.ru/vol65/part6596/6596809/images/big/1.jpg
			// https://basket-01.wb.ru/vol65/part6596/6596809/images/big/1.webp
			//   https://basket-01.wb.ru/vol65/part6596/6596809/images/big/1.jpg
			return src
				.replace(/(\/images\/+big\/+[^/]+\.)webp(?:[?#].*)?$/, "$1jpg")
				.replace(/\/images\/+(?:c[0-9]+x[0-9]+|tm)\/+/, "/images/big/");
		}

		if (domain === "cdn.store-tsutaya.tsite.jp") {
			// thanks to anonymous for reporting:
			// https://cdn.store-tsutaya.tsite.jp/images/jacket/11237/4534530092250_1S.jpg
			//   https://cdn.store-tsutaya.tsite.jp/images/jacket/11237/4534530092250_1L.jpg
			return src.replace(/(\/images\/+jacket\/+[0-9]+\/+[0-9]+_[0-9]+)[SM]\./, "$1L.");
		}

		if (domain === "cdn.marvel.com") {
			// thanks to anonymous for reporting:
			// https://cdn.marvel.com/content/1x/loki_card.png
			//   https://cdn.marvel.com/content/2x/loki_card.png
			// https://cdn.marvel.com/u/prod/marvel/i/mg/7/70/65f9a38967f2b/portrait_uncanny.jpg
			//   https://cdn.marvel.com/u/prod/marvel/i/mg/7/70/65f9a38967f2b/clean.jpg
			return src
				.replace(/\/content\/+1x\/+/, "/content/2x/")
				.replace(/(\/u\/+prod\/+marvel\/+.*\/[0-9a-f]{5,}\/+)portrait_uncanny\./, "$1clean.");
		}

		if (domain === "cdn1.mmwst.ru") {
			// thanks to anonymous for reporting:
			// https://cdn1.mmwst.ru/6704981f3a822c51b6c7272082b57136/8f38be2b310011ee8536ac1f6b270637.webp
			//   https://cdn2.mmwst.ru/files/8f/8f38be2b310011ee8536ac1f6b270637.jpg
			return src
				.replace(/\.webp(?:[?#].*)?$/, ".jpg")
				.replace(/:\/\/[^/]+\/+[0-9a-f]+\/+([0-9a-f]{2})([0-9a-f]+\.)/, "://cdn2.mmwst.ru/files/$1/$1$2");
		}

		if (domain === "img.atlasobscura.com") {
			// thanks to anonymous for reporting:
			// https://img.atlasobscura.com/Bc4PDJicX5faaBSYeZkjqmRELD3pDifsRD4BDjsn2CU/rt:fit/w:1280/q:81/sm:1/scp:1/ar:1/aHR0cHM6Ly9hdGxh/cy1kZXYuczMuYW1h/em9uYXdzLmNvbS91/cGxvYWRzL2Fzc2V0/cy81Mzg2Mjg2NjU1/YWU0ZjAxOWRfVHJh/aXRvcnMgYW5kIFR5/cmFudHMgTWFwLmpw/ZWc.jpg
			//   https://atlas-dev.s3.amazonaws.com/uploads/assets/5386286655ae4f019d_Traitors%20and%20Tyrants%20Map.jpeg
			newsrc = src.replace(/.*?\/(aHR0c[^.?#]+?)(?:[?#.].*)?$/, "$1");
			if (newsrc !== src) {
				let splitted = newsrc.split("/");
				let decoded = [];
				for (let s of splitted) {
					decoded.push(base64_decode(s));
				}
				return decoded.join("");
			}
		}

		if (domain_nowww === "bildbyran.se") {
			// thanks to anonymous for reporting:
			// https://bildbyran.se/getjpeg?id=230806MB072&size=537x358&wtag=1 -- 537x358, watermark
			//   https://bildbyran.se/thumbnails/2308/06MB/BB230806MB072.jpg -- 537x358, no watermark
			//   https://bildbyran.se/getjpeg?id=230806MB072&size=950x632&wtag=1 -- 1920x1280, watermark
			newsrc = src.replace(/(\/getjpeg\?(?:.*&)?size=)537x358([&#].*)?$/, "$1950x632$2");
			if (newsrc !== src)
				return newsrc;

			// fixme: it's the same size as 537x358
			newsrc = src.replace(/\/getjpeg\?(?:.*&)?id=([0-9]{4})([0-9]{2})([A-Z]{2})([0-9]{3})(?:[&#].*)?$/, "/thumbnails/$1/$2$3/BB$1$2$3$4.jpg");
			if (newsrc !== src)
				return {
					url: newsrc,
					problems: {smaller: true}
				};

			newsrc = src.replace(/\/thumbnails\/+[0-9]{4}\/+[0-9]{2}[A-Z]{2}\/+[A-Z]{2}([0-9A-Z]+)\.[^/]+(?:[?#].*)?$/, "/getjpeg?id=$1&size=950x632");
			if (newsrc !== src)
				return {
					url: newsrc,
					problems: {watermark: true}
				};
		}

		if (domain === "img.peliplat.com") {
			// https://img.peliplat.com/api/resize/v1?imagePath=std/202302/a/e/ae7c10d2599165a8f59e0b88bc673046.jpg&mode=FILL&width=192&height=288&limit=false&c=1.jpg
			//   https://img.peliplat.com/api/resize/v1?imagePath=std/202302/a/e/ae7c10d2599165a8f59e0b88bc673046.jpg
			if (/\/api\/+resize\/+v1\?/.test(src)) {
				return keep_queries(src, "imagePath");
			}
		}

		if (domain === "u.livechart.me") {
			// thanks to anonymous for reporting:
			// https://u.livechart.me/anime/11115/poster_image/c972ab2d4efec6743bd89203644dadf5.webp/small.jpg
			//   https://u.livechart.me/anime/11115/poster_image/c972ab2d4efec6743bd89203644dadf5.webp/large.jpg
			// original or removing (/small.jpg) requires authorization
			return src.replace(/(\/poster_image\/+[^/]+\.[^/]+\/+)small\./, "$1large.");
		}

		if (domain === "d10j3mvrs1suex.cloudfront.net") {
			// https://d10j3mvrs1suex.cloudfront.net/u/36925/47e174c3e47555397a298c38929e169424ad4a59/original/ludic-115-resize.jpg/!!/undefined/b:W1sic2l6ZSIsIm1lZGl1bSJdXQ==.jpg
			//   https://d10j3mvrs1suex.cloudfront.net/u/36925/47e174c3e47555397a298c38929e169424ad4a59/original/ludic-115-resize.jpg
			return src.replace(/\/!!\/.*/, "");
		}

		if (domain === "c758759.ssl.cf2.rackcdn.com") {
			// https://c758759.ssl.cf2.rackcdn.com/small/75137.jpg -- 100x75
			//   https://c758759.ssl.cf2.rackcdn.com/large/75137.jpg
			//   https://c758759.ssl.cf2.rackcdn.com/original/75137.jpg -- 800x600
			// https://c758759.ssl.cf2.rackcdn.com/large/76807.jpg -- 1200x800
			return src.replace(/(:\/\/[^/]+\/+)(?:small|large)\/+/, "$1original/");
		}

		if (domain_nowww === "4kwallpapers.com") {
			// thanks to anonymous for reporting:
			// https://4kwallpapers.com/images/walls/thumbs_2t/11451.jpg
			//   https://4kwallpapers.com/images/wallpapers/-11451.jpg -- forces download
			return src.replace(/\/images\/+walls\/+[^/]+\/+([0-9]+\.)/, "/images/wallpapers/-$1");
		}

		if (domain === "seccdn.libravatar.org") {
			// thanks to anonymous for reporting:
			// https://seccdn.libravatar.org/avatar/48d4207afd9e1242959a2abfa1ee1417?s=48&forcedefault=y&default=identicon
			//   https://seccdn.libravatar.org/avatar/48d4207afd9e1242959a2abfa1ee1417?s=512&forcedefault=y&default=identicon
			// documentation:
			// https://wiki.libravatar.org/api/
			if (/\/avatar\/+[0-9a-f]+/.test(src))
				return add_queries(src, {"s": "512"});
		}

		if (domain_nowww === "40konline.com") {
			// thanks to anonymous for reporting:
			// https://www.40konline.com/proxy.php?request=http%3A%2F%2Fwww.kk.org%2Fstreetuse%2Fied.jpg&hash=dde253e55ce757063cc9fe15f92a06ab06f3023f
			//   https://kk.org/mt-files/streetuse-mt/ied.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+proxy\.php\?(?:.*&)?request=([^&]+)(?:[&#].*)?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nowww === "militaryfactory.com") {
			// thanks to anonymous for reporting:
			// https://www.militaryfactory.com/smallarms/imgs/sml/ied.jpg
			//   https://www.militaryfactory.com/smallarms/imgs/lrg/ied.jpg
			return src.replace(/\/imgs\/+(?:sml|med)\/+/, "/imgs/lrg/");
		}

		if (domain_nowww === "shoplineimg.com") {
			// thanks to anonymous for reporting:
			// https://shoplineimg.com/5ae29b268d1db9dde9005d08/64915771086f3c0014fee8f5/800x.webp
			//   https://d31xv78q8gnfco.cloudfront.net/media/image_clips/64915771086f3c0014fee8f5/original.jpg -- 3500x3500
			// https://shoplineimg.com/5b4e1b5d4e22a64cb1001930/6138b216da36eb0035aef84a/800x.webp?source_format=png
			//   https://d31xv78q8gnfco.cloudfront.net/media/image_clips/6138b216da36eb0035aef84a/original.png -- 2048x2048
			// https://shoplineimg.com/60ef94e4aaa7480023dfcb7f/61263af88a8961002c7b71e6/2600x.webp?source_format=jpeg
			//   https://d31xv78q8gnfco.cloudfront.net/media/image_clips/61263af88a8961002c7b71e6/original.jpeg
			// https://shoplineimg.com/5cf48b18c4efc60001a5ff68/5ee1cd8be9b96a003099163a/2800x.webp?source_format=PNG
			//   https://d31xv78q8gnfco.cloudfront.net/media/image_clips/5ee1cd8be9b96a003099163a/original.PNG
			newsrc = src.replace(/(\/[0-9a-f]+\/+)[0-9]+x(\.[a-z]+)(?:[?#].*)?$/, "$1original$2");
			if (newsrc !== src) {
				return add_full_extensions(newsrc);
			}
		}

		if (domain_nowww === "absolutearts.com") {
			// thanks to anonymous for reporting:
			// https://www.absolutearts.com/portfolio3/l/lonvig/V_for_Venice-1058737172st.jpg
			//   https://www.absolutearts.com/portfolio3/l/lonvig/V_for_Venice-1058737172m.jpg -- 640x419, upscaled?
			//   https://www.absolutearts.com/portfolio3/l/lonvig/V_for_Venice-1058737172l.jpg -- 500x327
			// https://www.absolutearts.com/portfolio3/j/johnsojt/deject__Selected_as_Best_in_show-1687291708l.jpg - 1557x1376
			return src.replace(/(\/portfolio3\/+.\/+[^/]+\/+[^/.]+-[0-9]{5,})(?:st|mt?|lt)?\./, "$1l.");
		}

		if (domain === "img.allzip.org") {
			// thanks to anonymous for reporting:
			// https://img.allzip.org/g/3/thumbs/32166303_28076.jpg
			//   https://img.allzip.org/g/3/orig/32166303_28076.jpg
			return src.replace(/\/thumbs\/+([0-9]+(?:_[0-9]+)?\.)/, "/orig/$1");
		}

		if (domain_nowww === "arthive.net") {
			// thanks to anonymous for reporting:
			// https://arthive.net/res/media/img/oy400/work/29f/9228036.jpg
			//   https://arthive.net/res/media/img/oy400/work/29f/9228036@2x.jpg
			//   https://arthive.net/res/media/img/oy1200/work/29f/9228036.jpg -- 1200x1200
			// https://arthive.net/res/media/img/oy1200/work/29f/9228036@2x.jpg -- 2400x2400, upscaled
			// https://arthive.net/res/media/img/oy1200/work/2a2/392425.jpg -- 5418x1200
			//   https://arthive.net/res/media/img/oy1200/work/2a2/392425@2x.jpg -- 10836x2400, upscaled
			// https://arthive.net/res/media/img/oy1400/work/5a4/8849505.jpg -- 1112x1400
			//   https://arthive.net/res/media/img/ox1400/work/5a4/8849505.jpg -- 1400x1762
			// other:
			// https://arthive.net/res/instances/og_img/audience_artists_en.jpg
			//return src.replace(/(\/res\/+media\/+img\/+[^/]+\/+work\/+[^/]+\/+[0-9]+)(\.)/, "$1@2x$2");
			newsrc = src
				.replace(/(\/res\/+media\/+img\/.*)\.webp(?:[?#].*)?$/, "$1.jpg")
				.replace(/(\/res\/+media\/+img\/+o[xy]1400\/+work\/+[^/]+\/+[0-9]+)@2x\./, "$1.")
				.replace(/(\/res\/+media\/+img\/+o[xy])(?:400|800|1000|1200)\/+/, "$11400/");
			if (newsrc !== src)
				return newsrc;

			if (options && options.cb && get_image_size && /\/res\/+media\/+img\/+o[xy][0-9]+\//.test(src)) {
				get_image_size(src, function(x, y) {
					if (x > y) {
						return options.cb(src.replace(/(\/res\/+media\/+img\/+o)[xy]([0-9]+\/+)/, "$1y$2"));
					} else {
						return options.cb(src.replace(/(\/res\/+media\/+img\/+o)[xy]([0-9]+\/+)/, "$1x$2"));
					}
				});

				return {
					waiting: true
				};
			}
		}

		if (domain === "img-cdn.dnes.bg") {
			// thanks to anonymous for reporting:
			// https://img-cdn.dnes.bg/d/images/photos/0146/0000146262-lifestyle.jpg
			//   https://img-cdn.dnes.bg/d/images/photos/0146/0000146262-lifestyle3.jpg -- 569x365, zoomed in
			// https://img-cdn.dnes.bg/d/images/photos/0146/0000146262-exclusive.jpg -- 600x331
			// other:
			// https://img-cdn.dnes.bg/d/images/photos/0526/0000526132-article2.jpg -- 8076x5387
			return src.replace(/(\/images\/+photos\/+[^/]+\/+[0-9]+)-(?:lifestyle3?|article2|developing|fbh|middle|category)\./, "$1-exclusive.");
		}

		if (domain_nowww === "oldbookillustrations.com") {
			// https://www.oldbookillustrations.com/site/assets/files/12883/redcliffe-windows.220x220.jpg
			//   https://www.oldbookillustrations.com/site/assets/files/12883/redcliffe-windows.jpg
			return src.replace(/(\/site\/+assets\/+files\/+[0-9]+\/+[^/.]+\.)[0-9]+x[0-9]+\./, "$1");
		}

		if (domain === "imageprocessor.digital.vistaprint.com") {
			// thanks to anonymous for reporting:
			// https://imageprocessor.digital.vistaprint.com/crop/0,127,5928x3330/maxWidth/2000/https://stockservice.digital.vistaprint.com/6392d2223ee2fff77d1f06a4683be009.jpg
			//   https://stockservice.digital.vistaprint.com/6392d2223ee2fff77d1f06a4683be009.jpg
			// https://imageprocessor.digital.vistaprint.com/crop/0,127,5928x3330/maxWidth/2000/stockservice.digital.vistaprint.com/6392d2223ee2fff77d1f06a4683be009.jpg
			//   https://imageprocessor.digital.vistaprint.com/stockservice.digital.vistaprint.com/6392d2223ee2fff77d1f06a4683be009.jpg
			//   https://stockservice.digital.vistaprint.com/6392d2223ee2fff77d1f06a4683be009.jpg
			// https://imageprocessor.digital.vistaprint.com/png/https://uploads.documents.cimpress.io/v1/uploads/8dd1e024-4df7-457e-b059-2511d296aba4~110/original?tenant=vbu-digital
			//   https://imageprocessor.digital.vistaprint.com/https://uploads.documents.cimpress.io/v1/uploads/8dd1e024-4df7-457e-b059-2511d296aba4~110/original?tenant=vbu-digital
			//   https://c-cluster-110.uploads.documents.cimpress.io/v1/uploads/8dd1e024-4df7-457e-b059-2511d296aba4~110/original?tenant=vbu-digital
			return src
				.replace(/^[a-z]+:\/\/[^/]+\/+([a-z]+:\/\/.*)/, "$1")
				.replace(/^[a-z]+:\/\/[^/]+\/+(stockservice\.digital\.vistaprint\.com\/)/, "https://$1")
				.replace(/^([a-z]+:\/\/[^/]+\/+)(?:(?:crop|width|height|max(?:Width|Height))\/+[^/]+|png)\/+/, "$1");
		}

		if (domain_nosub === "carrd.co") {
			// https://sangkuning.carrd.co/assets/images/gallery02/7e422559.jpg?v=a1603e62
			//   https://sangkuning.carrd.co/assets/images/gallery02/7e422559_original.jpg?v=a1603e62
			return src.replace(/(\/assets\/+images\/+gallery02\/+[0-9a-f]+)\./, "$1_original.");
		}

		if (domain_nowww === "goodillustration.com") {
			// https://www.goodillustration.com/_upload/images/153745189566893199.jpg
			//   https://www.goodillustration.com/_upload/images/original_153745189566893199.jpg
			newsrc = src.replace(/(\/images\/+)([0-9]+\.)/, "$1original_$2");
			if (newsrc !== src)
				return newsrc;

			// currently unused
			// let query_goodillustration = function(imageid, cb) {
			// 	let cache_key = "goodillustration:" + imageid;
			// 	api_query(cache_key, {
			// 		url: "https://www.goodillustration.com/ajax/?get_image&sid=" + Math.random(),
			// 		method: "POST",
			// 		data: "id=" + imageid + "&type=0"
			// 	}, cb, function(done, resp, cache_key) {
			// 	});
			// };

			// https://www.goodillustration.com/show-picture/id=8162/
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+show-picture\/+id=([0-9]+)\/*(?:[?#].*)?$/,
				query_for_id: "https://www.goodillustration.com/show-picture/id=${id}/",
				process(done, resp, cache_key) {
					let match = resp.responseText.match(/<img src="([^"]+_upload\/+images\/+(?:original_)?[0-9]+[^"]+)"/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					return done(match[1], 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (host_domain_nowww === "goodillustration.com" && options.element) {
			if (options.element.tagName === "IMG" &&
				options.element.parentElement && options.element.parentElement.tagName === "A" && options.element.parentElement.id) {
				let match = options.element.parentElement.id.match(/^gallery-photo-([0-9]+)$/);
				if (match) {
					return {
						url: "https://www.goodillustration.com/show-picture/id=" + match[1] + "/",
						is_pagelink: true
					};
				}
			}
		}

		if (domain_nowww === "egmo.org") {
			// https://www.egmo.org/people/person996/photo7-t200.jpg
			//   https://www.egmo.org/people/person996/photo7.jpg
			// https://www.egmo.org/people/person996/photo12-t200.jpg
			//   https://www.egmo.org/people/person996/photo12.png
			newsrc = src.replace(/(\/people\/+person[0-9]+\/+photo[0-9]+)-t[0-9]+\./, "$1.");
			if (newsrc !== src)
				return add_extensions(newsrc);
		}

		if (host_domain_nowww === "picnob.com" && options.element && domain_nosub === "picnob.com") {
			if (options.element.tagName === "IMG" && options.element.parentElement && options.element.parentElement.tagName === "A") {
				let parent = options.element.parentElement;
				let parent_href = parent.href || "";
				if (/^[a-z]+:\/\/[^/]*\.cdninstagram\.com\//.test(parent_href)) {
					return common_functions["set_cdninstagram_obj"](parent_href);
				}
			}
		}

		if (digitalocean_container === "warframe-web-assets") {
			// thanks to Freso on github: https://github.com/qsniyg/maxurl/pull/1205
			// https://warframe-web-assets.nyc3.cdn.digitaloceanspaces.com/uploads/thumbnails/5bfdf272bdb52e0ec103206919671b6a_800x450.png
			//   https://warframe-web-assets.nyc3.cdn.digitaloceanspaces.com/uploads/5bfdf272bdb52e0ec103206919671b6a.jpg
			newsrc = src.replace(/\/+thumbnails\/+([a-zA-Z0-9]+)(?:_[0-9]+x[0-9]+)?\./, "/$1.");
			if (newsrc !== src)
				return add_extensions(newsrc);
		}

		if (domain === "media.comikey.com") {
			// thanks to TristanWasTaken on github: https://github.com/qsniyg/maxurl/issues/1207
			// https://media.comikey.com/gazo/960/avif/comics/jk2qoZ/6b126ff8ef45.jpg
			//   https://comikey.com/media/comics/jk2qoZ/6b126ff8ef45.jpg
			return src.replace(/:\/\/[^/]+\/+gazo\/+[0-9]+\/+[a-z]+\/+/, "://comikey.com/media/");
		}

		if (domain_nowww === "wright20.com") {
			// thanks to anonymous for reporting:
			// https://www.wright20.com/items/index/1400/198_2_dieter_rams_the_jf_chen_collection_july_2018_reinhold_weiss_and_hartwig_kahlcke_ht_2_toaster_and_htb_6_bun_warmer__wright_auction.jpg?t=1593726746
			//   https://www.wright20.com/items/index/0/198_2_dieter_rams_the_jf_chen_collection_july_2018_reinhold_weiss_and_hartwig_kahlcke_ht_2_toaster_and_htb_6_bun_warmer__wright_auction.jpg?t=1593726746
			return src.replace(/\/items\/+index\/+[0-9]+\/+/, "/items/index/0/");
		}

		if (domain === "image.civitai.com") {
			// https://image.civitai.com/[...]/[...]/width=450/26072158-132340247-8k%20portrait%20of%20beautiful%20cyborg%20with%20brown%20hair,%20intricate,%20elegant,%20highly%20detailed,%20majestic,%20digital%20photography,%20art%20by%20artg_ed.jpeg
			//   https://image.civitai.com/[...]/[...]/width=0/26072158-132340247-8k%20portrait%20of%20beautiful%20cyborg%20with%20brown%20hair,%20intricate,%20elegant,%20highly%20detailed,%20majestic,%20digital%20photography,%20art%20by%20artg_ed.jpeg
			// thanks to aslian on github: https://github.com/qsniyg/maxurl/issues/1265
			//   https://image.civitai.com/[...]/[...]/original=true/26072158-132340247-8k%20portrait%20of%20beautiful%20cyborg%20with%20brown%20hair,%20intricate,%20elegant,%20highly%20detailed,%20majestic,%20digital%20photography,%20art%20by%20artg_ed.jpeg
			return src.replace(/^([a-z]+:\/\/[^/]+\/+[^/]+\/+[^/]+\/+)(?:width|height|original)=[^/]+\/+/, "$1original=true/");
		}

		if (domain_nowww === "vxxx.com" && options.do_request && options.cb) {
			// thanks to anonymous for reporting
			let vxxx_b64 = function(e) {
				return base64_decode(e
						.replace(/А/g, "A")
						.replace(/В/g, "B")
						.replace(/С/g, "C")
						.replace(/Е/g, "E")
						.replace(/М/g, "M")
						.replace(/\./g, "+")
						.replace(/,/g, "/")
						.replace(/~/g, "=")
				);
			};

			let get_vxxx_video = function(id, cb) {
				api_query("vxxx:" + id, {
					url: "https://vxxx.com/api/videofile.php?video_id=" + id + "&lifetime=8640000",
					imu_mode: "xhr"
				}, cb, function(done, resp, cache_key) {
					let json = JSON_parse(resp.responseText);
					if (!json || !is_array(json)) {
						console_error(cache_key, "Invalid response", resp, json);
						return done(null, false);
					}

					let formats = ["_hd.mp4", "_sd.mp4"];
					json.sort((a, b) => {
						let a_f = a.format;
						let b_f = b.format;

						if (!a_f || !b_f)
							return 0;

						return array_indexof(formats, a_f) - array_indexof(formats, b_f);
					});

					let urls = [];
					for (let obj of json) {
						urls.push({
							url: urljoin("https://" + domain + "/", vxxx_b64(obj.video_url), true),
							video: true
						});
					}

					return done(urls, 12*60*60);
				});
			};

			let get_vxxx_meta = function(id, cb) {
				api_query("vxxx_meta:" + id, {
					url: "https://vxxx.com/api/json/video/86400/0/" + ((id/1000)|0) + "/" + id + ".json",
					imu_mode: "xhr",
					json: true
				}, cb, function(done, resp, cache_key) {
					let extra = {
						caption: resp.video.title,
						author_username: resp.video.user.username,
						created_date: new Date(resp.video.post_date).getTime(),
						page: "https://vxxx.com/video-" + id + "/"
					};

					return done(extra, 6*60*60);
				});
			};

			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+video-([0-9]+)\/*(?:[?#].*)?$/,
				run: function(cb, match) {
					get_vxxx_video(match[1], function(resp) {
						if (!resp)
							return cb(null);

						let baseobj = {
							extra: {
								page: "https://vxxx.com/video-" + match[1] + "/"
							}
						};

						if (options.force_page) {
							get_vxxx_meta(match[1], function(extra) {
								if (extra)
									baseobj.extra = extra;

								return cb(fillobj_urls(resp, baseobj));
							})
						} else {
							return cb(fillobj_urls(resp, baseobj));
						}
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "pv.vxxx.com" ||
			domain === "tn.vxxx.com") {
			match = src.match(/\/videos(?:_screenshots)?\/+[0-9]+\/+([0-9]+)\/+(?:[0-9]+_tr\.|[0-9]+x[0-9]+\/)/);
			if (match) {
				return {
					url: "https://vxxx.com/video-" + match[1],
					is_pagelink: true
				};
			}
		}

		if (domain === "assets.privy.com") {
			// thanks to anonymous for reporting:
			// https://assets.privy.com/picture_photos/3247793/medium/4da8dec71ecc468d873c162005106ef0?1686117149
			//   https://assets.privy.com/picture_photos/3247793/original/4da8dec71ecc468d873c162005106ef0?1686117149
			return src.replace(/(\/picture_photos\/+[0-9]+\/+)[a-z]+\/+/, "$1original/");
		}

		if (domain_nowww === "produce101.jp") {
			// thanks to anonymous for reporting:
			// https://produce101.jp/static/produce101s3/download/Fv4BWpHPcDWMaUvvNw/thumbnail/085_fujimotoayaka_2.jpg
			//   https://produce101.jp/static/produce101s3/download/Fv4BWpHPcDWMaUvvNw/download/085_fujimotoayaka_2.jpg
			return src.replace(/(\/static\/+produce101s3\/+)([^/]+)(\/+[^/]+\/+)thumbnail\/+/, "$1$2$3$2/");
		}

		if (domain_nowww === "fapello.com") {
			// thanks to anonymous for reporting:
			// https://fapello.com/content/r/i/rina-toeda/1000/rina-toeda_0412_300px.jpg
			//   https://fapello.com/content/r/i/rina-toeda/1000/rina-toeda_0412.jpg
			return src.replace(/(\/content\/+.*)_[0-9]+px\./, "$1.");
		}

		if (domain === "api-cdn.arte.tv") {
			// thanks to anonymous for reporting:
			// https://api-cdn.arte.tv/img/v2/image/PDPD38JJatfgKaUqn5wzW6/400x225
			//   https://api-cdn.arte.tv/img/v2/image/PDPD38JJatfgKaUqn5wzW6/0x0
			return src.replace(/(\/img\/+v2\/+image\/+[^/]+\/+)[0-9]+x[0-9]+(?:[?#].*)?$/, "$10x0");
		}

		if (domain_nowww === "androidauthority.com") {
			// thanks to anonymous for reporting:
			// https://www.androidauthority.com/wp-content/uploads/2023/06/Pixel-8-and-Pixel-8-Pro-camera-leak-image-1200w-675h.png.webp
			//   https://www.androidauthority.com/wp-content/uploads/2023/06/Pixel-8-and-Pixel-8-Pro-camera-leak-image.png
			// https://www.androidauthority.com/wp-content/uploads/2023/05/google-pixel-7a-camera-interface-scaled-1200w-675h.jpg.webp
			//   https://www.androidauthority.com/wp-content/uploads/2023/05/google-pixel-7a-camera-interface-scaled.jpg, 1920x1080, no watermark
			//   https://www.androidauthority.com/wp-content/uploads/2023/05/google-pixel-7a-camera-interface.jpg -- 1920x1080, watermark
			return src
				.replace(/(\.(?:jpe?g|png))\.webp(?:[?#].*)?$/i, "$1")
				.replace(/(\/wp-content\/+uploads\/.*)-[0-9]+w-[0-9]+h\./, "$1.");
		}

		if (domain_nowww === "normanrecords.com") {
			// thanks to anonymous for reporting:
			// https://www.normanrecords.com/artwork/small/122/199122-marja-ahti-tender-membranes.jpg
			//   https://www.normanrecords.com/artwork/large/122/199122-marja-ahti-tender-membranes.jpg
			return src.replace(/\/artwork\/+(?:small|medium)\/+/, "/artwork/large/");
		}

		if (domain === "ic.od-cdn.com") {
			// thanks to anonymous for reporting:
			// https://ic.od-cdn.com/resize?type=auto&url=%2FImageType-100%2F5835-1%2F%257BE3756F7C-77E4-4746-BD83-01F25FAC4B35%257DImg100.jpg&stripmeta=true&width=220
			//   https://img1.od-cdn.com/ImageType-100/5835-1/%7BE3756F7C-77E4-4746-BD83-01F25FAC4B35%7DImg100.jpg
			match = src.match(/\/resize\?(?:.*&)?url=([^&]+)(?:[&#].*)?$/);
			if (match) {
				return urljoin("https://img1.od-cdn.com/", decodeURIComponent(match[1]), true);
			}
		}

		if (domain_nosub === "od-cdn.com" && /^img[0-9]*\./.test(domain)) {
			// thanks to anonymous for reporting:
			// https://img1.od-cdn.com/ImageType-150/0211-1/%7BF88564FC-3820-442F-8558-BC1893C13208%7DIMG150.JPG
			//   https://img1.od-cdn.com/ImageType-100/0211-1/%7BF88564FC-3820-442F-8558-BC1893C13208%7DIMG100.JPG -- 510x680
			// https://img1.od-cdn.com/ImageType-200/0292-1/%7B7001398A-14E9-47B7-806B-82FF0459898E%7DImg200.jpg
			//   https://img1.od-cdn.com/ImageType-100/0292-1/%7B7001398A-14E9-47B7-806B-82FF0459898E%7DIMG100.jpg -- 510x680
			// https://img1.od-cdn.com/ImageType-400/2849-1/%7BE7257F4B-9156-4B84-BA6B-EF34AFF517B6%7DIMG400.JPG -- 300x400
			//   https://img1.od-cdn.com/ImageType-100/2849-1/%7BE7257F4B-9156-4B84-BA6B-EF34AFF517B6%7DIMG100.JPG -- 510x680
			// other:
			// https://img1.od-cdn.com/ImageType-100/2814-1/%7B468CB5A9-F2B5-453C-B718-9FF4E4B9F9B1%7DImg100.jpg -- 2480x3508
			return src.replace(/\/ImageType-(?:150|[24]00)(\/.*)IMG(?:150|[24]00)\./i, "/ImageType-100$1IMG100.");
		}

		if (domain_nosub === "pic-upload.de") {
			// thanks to anonymous for reporting:
			// http://www2.pic-upload.de/thumb/28688084/image.jpg
			//   http://www2.pic-upload.de/img/28688084/image.jpg
			// other:
			// http://www10.pic-upload.de/thumb/19.02.13/qlkpcxzsfj94.jpg
			//   https://www11.pic-upload.de/img/18206827/infantry-brit.jpg
			//   https://www.pic-upload.de/view-18206827/infantry-brit.jpg.html
			return src.replace(/\/thumb\/+([0-9]+)\/+/, "/img/$1/");
		}

		if (domain === "cdn.dol.com.br") {
			// thanks to anonymous for reporting:
			// https://cdn.dol.com.br/img/Artigo-Destaque/820000/1200x0/SONZA1_00825719_0_-3.webp?fallback=https%3A%2F%2Fcdn.dol.com.br%2Fimg%2FArtigo-Destaque%2F820000%2FSONZA1_00825719_0_.jpg%3Fxid%3D2715991&xid=2715991
			//   https://cdn.dol.com.br/img/Artigo-Destaque/820000/SONZA1_00825719_0_.jpg?xid=2715991
			return src.replace(/(\/img\/+[^/]+\/+[0-9]+\/+)[0-9]+x[0-9]+\/+/, "$1");
		}

		if (domain_nowww === "xappie.com") {
			// https://www.xappie.com/image.php?width=100&height=150&image=./uploads/movies/tech_2081578.jpg
			//   https://www.xappie.com/uploads/movies/tech_2081578.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+image\.php\?(?:.*&)?image=([^&]+)(?:[&#].*)?$/, "$1");
			if (newsrc !== src)
				return urljoin(src, decodeURIComponent(newsrc).replace(/^\.\//, "/"), true);
		}

		if (domain_nosub === "3hentai.net" && /^s[0-9]*\./.test(domain)) {
			// thanks to anonymous for reporting:
			// https://s2.3hentai.net/d437862/4t.jpg
			//   https://s2.3hentai.net/d437862/4.jpg
			return src.replace(/(\/d[0-9]+\/+[0-9]+)t\./, "$1.");
		}

		if (domain_nosub === "rule34.dev" && /^proxy[0-9]*\./.test(domain)) {
			// thanks to anonymous for reporting:
			// https://proxy5.rule34.dev/convert?q=https://cdn.donmai.us/180x180/d9/a1/d9a17e50c4db2233c559bc24b2e0f933.jpg
			//   https://cdn.donmai.us/original/d9/a1/d9a17e50c4db2233c559bc24b2e0f933.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+convert\?(?:.*&)?q=([^&]+)(?:[&#].*)?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nowww === "itaku.ee") {
			// https://itaku.ee/api/media/gallery_imgs/CuteDoggo_LGJX4nY/lg.jpg
			//   https://itaku.ee/api/media/gallery_imgs/CuteDoggo_LGJX4nY/xl.jpg
			//   https://itaku.ee/api/media/gallery_imgs/CuteDoggo_LGJX4nY.png
			// https://itaku.ee/api/media/gallery_imgs/half_Aki-rain_web_ui5QthD/lg.jpg
			//   https://itaku.ee/api/media/gallery_imgs/half_Aki-rain_web_ui5QthD.jpg
			// https://itaku.ee/api/media/gallery_imgs/RioluSneeze_W6qXSX0/sm_X2YcYI5.gif
			//   https://itaku.ee/api/media/gallery_imgs/RioluSneeze_W6qXSX0.gif
			newsrc = src.replace(/(\/api\/+media\/+gallery_imgs\/+[^/]+)\/+[a-z]{2}(?:_[A-Za-z0-9]+)?(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
			if (newsrc !== src)
				return add_extensions(newsrc);

			let query_itaku_api = function(id, cb) {
				let cache_key = "itaku:" + id;
				api_query(cache_key, {
					url: "https://itaku.ee/api/galleries/images/" + id + "/",
					imu_mode: "xhr",
					headers: {
						Accept: "application/json, text/plain, */*"
					},
					json: true
				}, cb, function(done, resp, cache_key) {
					let extra = {
						page: "https://itaku.ee/images/" + id,
						caption: resp.title || resp.description,
						created_date: new Date(resp.date_added).getTime(),
						id: id,
						author_username: resp.owner_username
					};

					let urls = [];
					if (resp.video) {
						urls.push({
							url: resp.video.video,
							video: true
						});
					}

					urls.push(resp.image);

					return done(fillobj_urls(urls, {extra}), 6*60*60);
				});
			};

			// https://itaku.ee/images/367071
			//   https://itaku.ee/api/media/gallery_imgs/Pec_flexing_extend_1VFTUjh.jpg
			//   https://itaku.ee/api/media/gallery_vids/Pec_flexing_extend_F9sRWtE.mp4
			if (options.do_request && options.cb) {
				newsrc = website_query({
					website_regex: /^[a-z]+:\/\/[^/]+\/+images\/+([0-9]+)\/*(?:[?#].*)?$/,
					run(cb, match) {
						query_itaku_api(match[1], cb);
					}
				});
				if (newsrc) return newsrc;
			}
		}

		if (host_domain_nowww === "itaku.ee" && options.element) {
			let parent = common_functions["get_parent_el_matching"](options.element, function(el) {
				return el.tagName === "A" && el.classList.contains("img-link") && el.href && /\/images\/+[0-9]+/.test(el.href);
			});
			if (parent) {
				return {
					url: parent.href,
					is_pagelink: true
				};
			}
		}

		if (domain_nosub === "loyalfans.com" && /^public-cdn[0-9]*\./.test(domain)) {
			// thanks to anonymous for reporting:
			// https://public-cdn2.loyalfans.com/images/MhtnF2T4zrcXbOnfa3Z0TWwYtjEY3Yt9xcY6WgMUNDw/timeline/0_16631100_1691533391_20230808222311_680__pmd.jpg
			//   https://public-cdn2.loyalfans.com/images/MhtnF2T4zrcXbOnfa3Z0TWwYtjEY3Yt9xcY6WgMUNDw/timeline/0_16631100_1691533391_20230808222311.jpg
			// https://public-cdn2.loyalfans.com/images/MhtnF2T4zrcXbOnfa3Z0TWwYtjEY3Yt9xcY6WgMUNDw/profile/0_89135100_1693412111_20230830161511_475_475_sq.jpg
			//   https://public-cdn2.loyalfans.com/images/MhtnF2T4zrcXbOnfa3Z0TWwYtjEY3Yt9xcY6WgMUNDw/profile/0_89135100_1693412111_20230830161511.jpg
			return src.replace(/(\/images\/+[^/]+\/+(?:timeline|profile)\/+[0-9]+_[0-9]+_[0-9]+_[0-9]+)_[^/.?#]+(\.[^/.]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain === "saint-laurent.dam.kering.com") {
			// thanks to anonymous for reporting:
			// https://saint-laurent.dam.kering.com/m/1180f5f4973c04bf/Thumbnail-7428282R20W1000_A.jpg?v=8
			//   https://saint-laurent.dam.kering.com/m/1180f5f4973c04bf/eCom-7428282R20W1000_A.jpg?v=8
			return src.replace(/(\/m\/+[0-9a-f]+\/+)(?:Thumbnail|Small)-/i, "$1eCom-");
		}

		if (domain_nowww === "igcdn.xyz") {
			// thanks to anonymous for reporting:
			// https://igcdn.xyz/?token=...&time=...&file=...
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+\?(?:.*&)?file=([^&]+)(?:[&#].*)?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "assets.armadamusic.com") {
			// thanks to anonymous:
			// https://assets.armadamusic.com/eyJidWNrZXQiOiJhcm1hZGFmdWdhIiwia2V5IjoiaXZ5dWdqbnJobnRtdXltcHp2aGdndXN5dWphbGhxd3UuanBnIiwiZWRpdHMiOnsianBlZyI6eyJxdWFsaXR5IjoxMDAsInByb2dyZXNzaXZlIjp0cnVlLCJ0cmVsbGlzUXVhbnRpc2F0aW9uIjp0cnVlLCJvdmVyc2hvb3REZXJpbmdpbmciOnRydWUsIm9wdGltaXplU2NhbnMiOnRydWV9LCJyZXNpemUiOnsid2lkdGgiOjQ4MCwiaGVpZ2h0Ijo0ODAsImZpdCI6ImNvdmVyIn19fQ==
			//   https://assets.armadamusic.com/eyJidWNrZXQiOiJhcm1hZGFmdWdhIiwia2V5IjoiaXZ5dWdqbnJobnRtdXltcHp2aGdndXN5dWphbGhxd3UuanBnIn0= -- 3000x3000
			//   https://assets.armadamusic.com/ivyugjnrhntmuympzvhggusyujalhqwu.jpg -- 3000x3000
			// other:
			// https://s3.eu-central-1.amazonaws.com/armadafuga/adhplcacbzxlqllrbpvrqbecbodbzmqi.jpg -- 403
			match = src.match(/\/(eyJid[^/?#.]{10,})(?:[?#].*)?$/);
			if (match) {
				try {
					let decoded = JSON_parse(base64_decode(match[1]));
					let encoded = base64_encode(JSON_stringify({
						bucket: decoded["bucket"], // armadafuga
						key: decoded["key"]
					}));

					newsrc = src.replace(/\/eyJid.*/, "/" + encoded);
					if (newsrc !== src) {
						return {
							url: src.replace(/\/eyJid.*/, "/" + encoded),
							filename: decoded["key"]
						};
					} else {
						return src.replace(/\/eyJid.*/, "/" + decoded["key"]);
					}
				} catch (e) {
					console_error(e);
				}
			}
		}

		if (domain === "ac.namu.la" ||
			domain === "ac-p.namu.la") {
			// thanks to fireattack on discord:
			// https://arca.live/b/mltd/53297868
			newsrc = src.replace(/:\/\/ac\./, "://ac-p.");
			if (newsrc !== src)
				return {
					url: newsrc,
					headers: {
						Referer: "https://arca.live/"
					}
				};

			if (/:\/\/ac-p\./.test(src))
				return {
					url: add_queries(src, {type:"orig"}),
					headers: {
						Referer: "https://arca.live/"
					}
				};
		}

		if (domain_nosub === "focus.bg" && /^cdn[0-9]*\./.test(domain)) {
			// thanks to ValiumBear on github: https://github.com/qsniyg/maxurl/issues/1214
			// https://cdn5.focus.bg/bazar/00/pics/008a407e34f9238e4b88ce57068581dd.jpg
			//   https://cdn5.focus.bg/bazar/00/large/008a407e34f9238e4b88ce57068581dd.jpg
			//   https://cdn5.focus.bg/bazar/00/original/008a407e34f9238e4b88ce57068581dd.jpg
			return src.replace(/(\/[0-9a-f]{2}\/+)(?:pics|large)\/+/, "$1original/");
		}

		if (domain === "lovestories.xcdn.nl") {
			// thanks to sn3akyb3ar on github: https://github.com/qsniyg/maxurl/issues/1215
			// https://lovestories.xcdn.nl/OQ75_RM1200,1200,255,255,255/-/catalog/product/l/L2370865400_P1.jpg
			//   https://lovestories.xcdn.nl/-/-/catalog/product/l/L2370865400_P1.jpg
			return src.replace(/(:\/\/[^/]+\/+)[^/]+\/+[^/]+\/+(catalog\/+product\/)/, "$1-/-/$2");
		}

		if (domain_nosub === "kkmh.com" && /^tn[0-9]*-f[0-9]*\./.test(domain)) {
			// thanks to TristanWasTaken on github: https://github.com/qsniyg/maxurl/issues/1183
			// https://tn1-f2.kkmh.com/image/221107/QPyXEZYLe.webp-t.w207.jpg.h.p
			//   https://tn1-f2.kkmh.com/image/221107/QPyXEZYLe.webp
			return src.replace(/(\/image\/+[0-9]+\/+[^/.?#]+\.[a-z]+)-[^/]+(?:[?#].*)?$/, "$1");
		}

		if (domain_nowww === "tweakers.net") {
			// thanks to karpuzikov on github: https://github.com/qsniyg/maxurl/issues/1185
			// https://tweakers.net/i/iuMupMRu66cQap-kQMvC38Dj0_U=/fit-in/188x141/filters:strip_icc():fill(white):strip_exif()/i/2003264188.jpeg?f=thumblarge
			//   https://tweakers.net/ext/i/2003264188.jpeg
			match = src.match(/(\/i\/+[0-9]+\.[a-z]+)(?:[?#].*)?$/);
			if (match) {
				return "https://tweakers.net/ext" + match[1];
			}
		}

		if (domain_nowww === "dilvin.com.tr" ||
			// https://kvyfm6d9dll6.merlincdn.net/productimages/126913/big/101a90155_lacivert.jpg
			//   https://kvyfm6d9dll6.merlincdn.net/productimages/126913/original/101a90155_lacivert.jpg
			domain === "kvyfm6d9dll6.merlincdn.net") {
			// https://www.dilvin.com.tr/productimages/126913/big/101a90155_lacivert.jpg
			//   https://www.dilvin.com.tr/productimages/126913/original/101a90155_lacivert.jpg
			return src.replace(/(\/productimages\/+[0-9]+\/+)[a-z]+\/+/, "$1original/");
		}

		if (domain_nowww === "evbazaaravm.com") {
			// https://www.evbazaaravm.com/public/assets/images/products/thumb/apple-iphone-14-pro-128gb-gumus-cep-telefonu-mq023tu-a-apple-turkiye-garantili-63d55d961510a.webp
			//   https://www.evbazaaravm.com/public/assets/images/products/large/apple-iphone-14-pro-128gb-gumus-cep-telefonu-mq023tu-a-apple-turkiye-garantili-63d55d961510a.webp
			return src.replace(/(\/assets\/+images\/+products\/+)thumb\/+/, "$1large/");
		}

		if (domain === "ffo3gv1cf3ir.merlincdn.net") {
			// https://ffo3gv1cf3ir.merlincdn.net/SiteAssets/pasaj/crop/cg/1663938988851/1-1663938977442/1-1663938977442_250x188.png?1773534948063
			//   https://ffo3gv1cf3ir.merlincdn.net/SiteAssets/pasaj/crop/cg/1663938988851/1-1663938977442.png
			return {
				url: src.replace(/(\/SiteAssets\/.*\/crop\/+cg\/+[^/]+\/+[0-9]+-[0-9]+)\/+[^/.]+(\.[a-z]+)(?:[?#].*)?$/, "$1$2"),
				head_wrong_contenttype: true // text/html
			};
		}

		if (domain === "qpzgjzffeg4d.merlincdn.net") {
			// https://qpzgjzffeg4d.merlincdn.net/i/s/007/0073111.jpeg
			//   https://qpzgjzffeg4d.merlincdn.net/i/l/007/0073111.jpeg
			return src.replace(/(\/i\/+)[sm](\/+[0-9]+\/+)/, "$1l$2");
		}

		if (domain === "images.gamebanana.com") {
			// thanks to jonestly on discord:
			// https://images.gamebanana.com/img/ss/mods/530-90_65038aaa0770c.jpg
			//   https://images.gamebanana.com/img/ss/mods/65038aaa0770c.jpg
			return src.replace(/(\/img\/+ss\/+[^/]+\/+)[0-9]+-[0-9]+_([0-9a-f]+\.)/, "$1$2");
		}

		if (host_domain_nowww === "sfmoma.org" && options.element) {
			// thanks to anonymous for reporting:
			// https://www.sfmoma.org/artwork/2007.207/
			if (options.element.tagName === "CANVAS" && options.element.matches("#artworkimage > .openseadragon-container .openseadragon-canvas > canvas")) {
				let parent = common_functions["get_parent_el_matching"](options.element, function(x) { return x.matches("#artworkimage") });
				if (parent) {
					let imgel = parent.querySelector("img.artworksingleimage-image");
					if (imgel)
						return imgel.src;
				}
			}
		}

		if (domain_nowww === "sexkontakt.net") {
			// thanks to anonymous for reporting:
			// https://sexkontakt.net/pictures/360/betty%20cool-56935.webp
			//   https://sexkontakt.net/pictures/360/betty%20cool-56935.jpg
			//   https://sexkontakt.net/pictures/1920/betty%20cool-56935.jpg -- 800x600
			return src
				.replace(/\.webp(?:[?#].*)?$/, ".jpg")
				.replace(/(\/pictures\/+)360\/+/, "$11920/");
		}

		if (domain_nowww === "kika.de") {
			// thanks to anonymous for reporting:
			// https://www.kika.de/kika-live/sendungen/bilder/bild266690-resimage_v-tlarge169_w-768.jpg?version=7447
			//   https://www.kika.de/kika-live/sendungen/bilder/bild266690-resimage_v-tlarge169.jpg?version=7447
			return src.replace(/(-resimage_v-[a-z0-9]+)_w-[0-9]+\./, "$1.");
		}

		if (domain === "embed-ssl.wistia.com") {
			// https://embed-ssl.wistia.com/deliveries/ef54989537a789c96f5c65c402732b3f.jpg?image_crop_resized=200x200
			//   https://embed-ssl.wistia.com/deliveries/ef54989537a789c96f5c65c402732b3f.jpg
			return {
				url: src.replace(/(\/deliveries\/+[0-9a-f]+\.[a-z]+)[?#].*/, "$1"),
				head_wrong_contenttype: true
			};
		}

		if (domain === "fast.wistia.net") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+embed\/+iframe\/+([a-z0-9]+)(?:[?#].*)?$/,
				query_for_id: "https://fast.wistia.net/embed/iframe/${id}",
				process: function(done, resp, cache_key) {
					let match = resp.responseText.match(/iframeInit\(({.*}),\s*{}\);/);
					if (!match) {
						console_error(cache_key, "Unable to find match for", resp);
						return done(null, false);
					}

					let json = JSON_parse(match[1]);
					let urls = [];
					let thumbnail = null;

					let captions = [];
					for (let caption of json.captions) {
						if (caption.language) {
							captions.push({
								url: "https://fast.wistia.net/embed/captions/" + json.hashedId + ".vtt?language=" + caption.language,
								language_code: caption.language,
								mime: "text/vtt"
							});
						}
					}

					for (let asset of json.assets) {
						if (asset.type === "original") {
							urls.push({
								url: asset.url,
								video: true,
								subtitles: deepcopy(captions)
							});
						} else if (asset.type === "still_image" && !thumbnail) {
							thumbnail = asset.url;
						}
					}

					urls.push({
						url: "https://fast.wistia.com/embed/medias/" + json.hashedId + ".m3u8",
						video: "hls"
					});

					if (thumbnail)
						urls.push(thumbnail);

					return done(urls, 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (host_domain_nowww === "jamanetwork.com" && options.element) {
			// thanks to anonymous for reporting:
			// https://jamanetwork.com/journals/jamainternalmedicine/fullarticle/2804120
			if (options.element.tagName === "IMG" && options.element.parentElement && options.element.parentElement.tagName === "A" &&
				options.element.parentElement.getAttribute("path-from-xml") === options.element.getAttribute("path-from-xml")) {
				return options.element.parentElement.href;
			}
		}

		if (domain === "media.radaronline.com") {
			// thanks to anonymous for reporting:
			// https://media.radaronline.com/brand-img/oHwz0aEVq/333x500/2013/05/420.jpg
			//   https://media.radaronline.com/brand-img/oHwz0aEVq/0x0/2013/05/420.jpg -- 400x600
			return {
				url: src.replace(/(\/brand-img\/+[^/]+\/+)[0-9]+x[0-9]+\/+/, "$10x0/"),
				can_head: false // 403
			};
		}

		if (domain_nowww === "hakes.com") {
			// thanks to anonymous for reporting:
			// https://www.hakes.com/Image/LowRes/281196/1/image.jpg
			//   https://www.hakes.com/Image/HighRes/281196/1/image.jpg
			return src.replace(/\/Image\/+LowRes\/+/, "/Image/HighRes/");
		}

		if (domain_nosub === "imgporn.xyz" && /^ip[0-9]*\./.test(domain)) {
			// thanks to anonymous for reporting:
			// https://ip1.imgporn.xyz/core/cache/plugins/imageviewer/122809/3d2055dcaaa49b6843cfd14d070e3dc05931d01f5262791435e4b3151d2d91e3/280x280_middle.jpg
			match = src.match(/\/cache\/+plugins\/+imageviewer\/+([0-9]+)\/+([0-9a-f]{30,})\/+/);
			if (match) {
				return {
					url: "https://" + domain_nosub + "/page/direct_download.php?fileId=" + match[1] + "&fileHash=" + match[2],
					headers: {
						Referer: "https://" + domain_nosub + "/"
					}
				};
			}

			match = src.match(/:\/\/[^/]+\/+thumb\/+([0-9A-Za-z]+)\/+/);
			if (match) {
				return {
					url: "https://imgporn.xyz/" + match[1] + "/",
					is_pagelink: true
				};
			}
		}

		if (domain_nowww === "imgporn.xyz" && options.do_request && options.cb) {
			if (!/\/(?:page|browse)\//.test(src)) {
				newsrc = website_query({
					website_regex: /^[a-z]+:\/\/[^/]+\/+([0-9A-Za-z]+)\/+[^/]*(?:[?#].*)?$/,
					query_for_id: "https://imgporn.xyz/${id}/",
					process: function(done, resp, cache_key) {
						return done(get_meta(resp.responseText, "og:image"), 60*60);
					}
				});
				if (newsrc) return newsrc;
			}
		}

		if (domain === "d3ltyosstobbfh.cloudfront.net") {
			// thanks to anonymous for reporting:
			// https://d3ltyosstobbfh.cloudfront.net/20230913021252_H6QcJ9maXY/1694538772_cc9a92eb4766d9977791_thumb.jpeg
			//   https://d3ltyosstobbfh.cloudfront.net/20230913021252_H6QcJ9maXY/1694538772_cc9a92eb4766d9977791.jpeg
			return src.replace(/(\/202[0-9]+_[^/]+\/+[0-9]+_[0-9a-f]+)_thumb\./, "$1.");
		}

		if (domain === "cdn.drouot.com") {
			// thanks to anonymous for reporting:
			// https://cdn.drouot.com/d/image/lot?size=fullHD&path=32/26563/143.jpg
			//   https://cdn.drouot.com/d/image/lot?size=src&path=32/26563/143.jpg
			// https://cdn.drouot.com/d/image/vente?size=fsquare&path=1161/136954/e451c9d31e6930733ce932fba8793178
			//   https://cdn.drouot.com/d/image/vente?size=fullHD&path=1161/136954/e451c9d31e6930733ce932fba8793178
			//   https://cdn.drouot.com/d/image/vente?size=src&path=1161/136954/e451c9d31e6930733ce932fba8793178
			// https://cdn.drouot.com/d/image/lot?size=fullHD&path=2060/132169/d9c892015cfcff5c58af510f01023bcf -- 1277x1920
			//   https://cdn.drouot.com/d/image/lot?size=src&path=2060/132169/d9c892015cfcff5c58af510f01023bcf -- 2000x3008
			// https://cdn.drouot.com/d/image/lot?size=src&path=78/112259/ceff55483e6a7a4a61bb422a194056e3 -- 5760x3840
			// other:
			// https://cdn.drouot.com/d/uploads/322/uploads/Image/DSC_0733copie.jpg
			// https://cdn.drouot.com/d/uploads/322/uploads/Image/92300-3.jpg -- 3510x4706
			return src.replace(/(\/d\/+image\/+[a-z]+\?(?:.*&)?size=)[^&#]+([&#].*)?$/, "$1src$2");
		}

		if (domain === "aws-br-pic.kwai.net" ||
			// https://ak-br-pic.kwai.net/kimg/EKzM1y8qmQEKAnMzEg1waG90by1vdmVyc2VhGoMBdXBpYy8yMDIzLzA3LzE3LzA0L0JNakF5TXpBM01UY3dORFEwTVRkZk1UVXdNREF3TWpJMk5ESTBOekV4WHpFMU1ERXdNelE0TURZNU9EZzJPVjh5WHpNPV9vdXVfQmExYzVmZTM3NWRiYjIwY2E1NTk3ZDlhMTFjNmRlY2YyLndlYnA.webp
			//   https://ak-br-pic.kwai.net/upic/2023/07/17/04/BMjAyMzA3MTcwNDQ0MTdfMTUwMDAwMjI2NDI0NzExXzE1MDEwMzQ4MDY5ODg2OV8yXzM=_ouu_Ba1c5fe375dbb20ca5597d9a11c6decf2.webp
			domain === "ak-br-pic.kwai.net" ||
			// https://tx-br-pic.kwai.net/kimg/EKzM1y8qmQEKAnMzEg1waG90by1vdmVyc2VhGoMBdXBpYy8yMDIzLzA3LzE3LzA0L0JNakF5TXpBM01UY3dORFEwTVRkZk1UVXdNREF3TWpJMk5ESTBOekV4WHpFMU1ERXdNelE0TURZNU9EZzJPVjh5WHpNPV9vdXVfQmExYzVmZTM3NWRiYjIwY2E1NTk3ZDlhMTFjNmRlY2YyLndlYnA.webp
			//   https://tx-br-pic.kwai.net/upic/2023/07/17/04/BMjAyMzA3MTcwNDQ0MTdfMTUwMDAwMjI2NDI0NzExXzE1MDEwMzQ4MDY5ODg2OV8yXzM=_ouu_Ba1c5fe375dbb20ca5597d9a11c6decf2.webp
			domain === "tx-br-pic.kwai.net") {
			// https://aws-br-pic.kwai.net/kimg/EKzM1y8qmQEKAnMzEg1waG90by1vdmVyc2VhGoMBdXBpYy8yMDIzLzA3LzE3LzA0L0JNakF5TXpBM01UY3dORFEwTVRkZk1UVXdNREF3TWpJMk5ESTBOekV4WHpFMU1ERXdNelE0TURZNU9EZzJPVjh5WHpNPV9vdXVfQmExYzVmZTM3NWRiYjIwY2E1NTk3ZDlhMTFjNmRlY2YyLndlYnA.webp
			//   https://aws-br-pic.kwai.net/upic/2023/07/17/04/BMjAyMzA3MTcwNDQ0MTdfMTUwMDAwMjI2NDI0NzExXzE1MDEwMzQ4MDY5ODg2OV8yXzM=_ouu_Ba1c5fe375dbb20ca5597d9a11c6decf2.webp
			// aws forces download
			match = src.match(/\/kimg\/+([^/.?#]{30,})\./);
			if (match) {
				try {
					let decoded = base64_decode(match[1]);
					let newstr = null;
					for (let i = 1; i < decoded.length; i++) {
						if (decoded[i] === "u" && decoded.charCodeAt(i-1) === 1) {
							newstr = decoded.substr(i);
							if (/^upic\//.test(newstr))
								break;

							newstr = null;
						}
					}

					return "https://" + domain + "/" + newstr;
				} catch (e) {
					console_error(e);
				}
			}
		}

		if (domain_nowww === "kwai.com") {
			let query_kwai = function(id, cb) {
				let cache_key = "kwai:" + id;
				api_query(cache_key, {
					url: "https://www.kwai.com/rest/o/w/pwa/photo/get",
					headers: {
						Accept: "application/json, text/plain, */*",
						"Cache-Control": "no-cache",
						"Content-Type": "application/json",
						Origin: "https://www.kwai.com",
						Pragma: "no-cache",
						Referer: "https://www.kwai.com/",
						"Sec-Fetch-Dest": "empty",
						"Sec-Fetch-Mode": "cors",
						"Sec-Fetch-Site": "same-site"
					},
					imu_mode: "xhr",
					method: "POST",
					data: '{"photoId":"' + id + '"}',
					json: true
				}, cb, function(done, resp, cache_key) {
					if (!resp || !resp.feeds || !resp.feeds[0]) {
						console_error(cache_key, "Unable to query", id, resp);
						return done(null, false);
					}

					let feed = resp.feeds[0];

					let extra:InfoExtraObject = {
						created_date: feed.timestamp,
						author_username: feed.kwai_id,
						id: feed.photo_id_str,
						caption: feed.caption
					};

					let urls = [];

					if (feed.main_mv_urls_rate) {
						feed.main_mv_urls_rate.sort(function(a, b) {
							return b.rate - a.rate;
						});

						let biggest = feed.main_mv_urls_rate[0];
						let codec = null;
						if (/_265$/.test(biggest.level)) {
							codec = "hevc";
						}

						urls.push({
							url: biggest.urls[0].url,
							media_info: {
								type: "video",
								codec
							}
						});
					}

					if (feed.main_mv_urls) {
						urls.push({
							url: feed.main_mv_urls[0].url,
							video: true
						});
					}

					if (feed.cover_thumbnail_urls) {
						urls.push(feed.cover_thumbnail_urls[0].url);
					}

					return done(fillobj_urls(urls, {extra}), 60*60);
				});
			};

			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+@[^/]+\/+video\/+([0-9]+)(?:[?#].*)?$/,
				run: function(cb, match) {
					query_kwai(match[1], cb);
				}
			});
			if (newsrc) return newsrc;
		}

		if (host_domain_nowww === "kwai.com" && options.element) {
			if (options.element.tagName === "IMG" && options.element.parentElement && options.element.parentElement.tagName === "A" &&
				options.element.parentElement.href && /^[a-z]+:\/\/[^/]+\/+@[^/]+\/+video\/+[0-9]+/.test(options.element.parentElement.href)) {
				return {
					url: options.element.parentElement.href,
					is_pagelink: true
				};
			}
		}

		if (domain_nowww === "minecraft.wiki") {
			// thanks to anonymous for reporting:
			// https://minecraft.wiki/images/thumb/Minecraft_brewing_en.png/300px-Minecraft_brewing_en.png?0be9b
			//   https://minecraft.wiki/images/Minecraft_brewing_en.png
			return src.replace(/(\/images\/+)thumb\/+([^/]+)\/+[^/]+(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nowww === "musik-sammler.de") {
			// https://www.musik-sammler.de/cover/1540000/1539691_1635313476_75.jpg
			//   https://www.musik-sammler.de/cover/1540000/1539691_1635313476_300.jpg
			//   https://www.musik-sammler.de/cover/1540000/1539691_1635313476.jpg
			return src.replace(/(\/cover\/+[0-9]+\/+[0-9]+_[0-9]+)_[0-9]+\./, "$1.");
		}

		if (domain === "cdn.cimri.io") {
			// thanks to anonymous for reporting:
			// https://cdn.cimri.io/image/1000x1000/samsunggalaxytabasmxgbinkoyugriwifitabletpc_661449112.jpg
			//   https://cdn.cimri.io/image/0x0/samsunggalaxytabasmxgbinkoyugriwifitabletpc_661449112.jpg
			return {
				url: src.replace(/(\/image\/+)[0-9]+x[0-9]+\/+/, "$10x0/"),
				head_wrong_contenttype: true
			};
		}

		if (domain_nowww === "rssso.com") {
			// thanks to anonymous for reporting:
			// http://www.rssso.com/Files/SrcImg/?url=https://pics5.baidu.com/feed/5fdf8db1cb13495425890cb1b5cc5253d3094ada.jpeg@f_auto?token=87cce86ae4f92f9445cdeb9c28b22a4c
			//   https://pics5.baidu.com/feed/5fdf8db1cb13495425890cb1b5cc5253d3094ada.jpeg
			newsrc = src.replace(/^.*?\/Files\/+SrcImg\/+\?(?:.*&)?url=(.*)/i, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nowww === "guforecords.com") {
			// thanks to anonymous for reporting:
			// http://www.guforecords.com/imgApp/thumbs/1511106574_350x350.png
			//   http://www.guforecords.com/imgApp/1511106574.png
			return src.replace(/(\/imgApp\/+)thumbs\/+([0-9]+)_[0-9]+x[0-9]+\./, "$1$2.");
		}

		if (domain === "cdn.kdkw.jp") {
			// thanks to anonymous for reporting:
			// https://cdn.kdkw.jp/cover_b/201111/201111000501.jpg
			//   https://cdn.kdkw.jp/cover_500/201111/201111000501.jpg
			//   https://cdn.kdkw.jp/cover_1000/201111/201111000501.jpg
			return src.replace(/\/cover_(?:b|500)\/+/, "/cover_1000/");
		}

		if (domain === "phantom-elmundo.unidadeditorial.es") {
			// thanks to sn3akyb3ar on github: https://github.com/qsniyg/maxurl/issues/1222
			// https://www.elmundo.es/yodona/moda/2023/10/06/651d76ffe85ece75048b45c6.html
			// https://phantom-elmundo.unidadeditorial.es/adbb169d7cffb61dcb0c976c949bf9e7/crop/80x7/1408x1778/resize/1280/f/webp/assets/multimedia/imagenes/2023/10/04/16964302641590.jpg
			//   https://e00-elmundo.uecdn.es/assets/multimedia/imagenes/2023/10/04/16964302641590.jpg
			return src.replace(/:\/\/phantom-([^/.]+)\.[^/]+\/+[0-9a-f]{10,}\/+.*?\/(assets\/+multimedia\/+)/, "://e00-$1.uecdn.es/$2");
		}

		if (domain_nosub === "youla.io") {
			// thanks to anonymous for reporting:
			// https://cache3.youla.io/files/images/780_780/58/58/5858042628c4aa0b56053e46.jpg
			//   https://cache3.youla.io/files/images/orig/58/58/5858042628c4aa0b56053e46.jpg
			// https://cdn0.youla.io/files/images/720_720_out/61/7e/617e7900195b997ec6474b50-1.jpg
			//   https://cdn0.youla.io/files/images/orig/61/7e/617e7900195b997ec6474b50-1.jpg
			return src.replace(/(\/files\/+images\/+)[0-9]+_[0-9]+(?:_[^/]+)?\/+((?:[0-9a-f]{2}\/+){2}[0-9a-f]{10,})/, "$1orig/$2");
		}

		if (domain === "i.hinnavaatlus.ee") {
			// thanks to anonymous for reporting:
			// https://i.hinnavaatlus.ee/p/1200/05/54/flow02.png
			//   https://i.hinnavaatlus.ee/p/full/05/54/flow02.png
			// https://i.hinnavaatlus.ee/p/1200x630f/46/29/digital_ixus_95_is_hobedane__9c49.jpg
			//   https://i.hinnavaatlus.ee/p/full/46/29/digital_ixus_95_is_hobedane__9c49.jpg
			return src.replace(/(\/p\/+)[0-9]+(?:x[0-9]+[a-z])?\/+/, "$1full/");
		}

		if (domain_nosub === "avito.st" && /^[0-9]+\.img\./.test(domain)) {
			// thanks to anonymous for reporting:
			// https://20.img.avito.st/640x480/8548299620.jpg
			//   https://20.img.avito.st/1280x960/8548299620.jpg
			// https://03.img.avito.st/432x324/5486224803.jpg
			//   https://03.img.avito.st/1280x960/5486224803.jpg
			// other:
			// https://94.img.avito.st/image/1/r8HEUra_Ayiy9_EulmSDtlzxBSJ6MQfadvEBLnz3AShwtw
			return src.replace(/\/(?:432x324|640x480)\/+/, "/1280x960/");
		}

		if (domain_nowww === "ugra.ru") {
			// thanks to anonymous for reporting:
			// https://ugra.ru/pics-91.img.avito.st/640x480/4456849291.jpg
			//   https://91.img.avito.st/1280x960/4456849291.jpg
			return src.replace(/^[a-z]+:\/\/[^/]+\/+pics-([0-9]+\.img\.avito\.st\/)/, "https://$1");
		}

		if (domain_nowww === "xanimu.com") {
			// thanks to anonymous for reporting:
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+([0-9]+-[^/]+)\/*(?:[?#].*)?$/,
				query_for_id: "https://xanimu.com/${id}",
				process: function(done, resp, cache_key) {
					let urls = [];

					let baseobj:BigImageInfoSObject = {
						extra: {}
					};

					let match = resp.responseText.match(/<script type="application\/ld\+json" class="yoast-schema-graph">({.*?})<\/script>/);
					if (match) {
						let json = JSON_parse(match[1]);
						for (let graph of json["@graph"]) {
							if (graph["@type"] !== "Article")
								continue;

							baseobj.extra.caption = decode_entities(graph.headline);
							baseobj.extra.created_date = new Date(graph.datePublished).getTime();
							baseobj.extra.updated_date = new Date(graph.dateModified).getTime();
							baseobj.extra.page = resp.finalUrl;
							break;
						}
					}

					match = resp.responseText.match(/var videoHigh\s*=\s*"([^"]+)";/);
					if (match) {
						urls.push({
							url: match[1],
							video: true
						});
					}

					match = resp.responseText.match(/var videoLow\s*=\s*"([^"]+)";/);
					if (match) {
						urls.push({
							url: match[1],
							video: true
						});
					}

					match = resp.responseText.match(/var poster\s*=\s*"([^"]+)";/);
					if (match) {
						urls.push(match[1]);
					}

					return done(fillobj_urls(urls, baseobj), 60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "pornkai.com") {
			// thanks to anonymous for reporting:
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+view\?(?:.*&)?key=([a-z]{2}[0-9a-z]+)(?:[?&].*)?$/,
				run: function(cb, match, cache_key) {
					let submatch = match[1].match(/^(ph|xv|xh)([0-9a-z]+)$/);
					if (!submatch) {
						console_error(cache_key, "Unhandled video ID:", match[1]);
						return cb(null);
					}

					if (submatch[1] === "xv") {
						return cb({
							url: "https://www.xvideos.com/embedframe/" + submatch[2],
							is_pagelink: true
						});
					} else if (submatch[1] === "ph") {
						return cb({
							url: "https://www.pornhub.com/view_video.php?viewkey=" + match[1],
							is_pagelink: true
						});
					} else if (submatch[1] === "xh") {
						return cb({
							url: "https://www.xhamster.com/videos/" + match[1],
							is_pagelink: true
						});
					}
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "cdn.bsky.app") {
			// thanks to Rotes! on discord:
			// https://cdn.bsky.app/img/feed_thumbnail/plain/did:plc:z72i7hdynmk6r22z27h6tvur/bafkreibcbd5rfa62bzdinv7z4r336a4ybsmkars2s3ukmurebycuxsa7ca@jpeg
			//   https://cdn.bsky.app/img/feed_fullsize/plain/did:plc:z72i7hdynmk6r22z27h6tvur/bafkreibcbd5rfa62bzdinv7z4r336a4ybsmkars2s3ukmurebycuxsa7ca@jpeg
			return src.replace(/(\/img\/+)feed_thumbnail\/+/, "$1feed_fullsize/");
		}

		if (domain_nosub === "24chasa.bg" && /^cache[0-9]*\./.test(domain)) {
			// thanks to ValiumBear on github: https://github.com/qsniyg/maxurl/issues/1227
			// https://cache1.24chasa.bg/Images/Cache/893/Image_15975893_40_0.jpg
			//   https://cache1.24chasa.bg/Images/Cache/893/Image_15975893_0_0.jpg
			return src.replace(/(\/Images\/+Cache\/+[0-9]+\/+Image_[0-9]+_)[0-9]+_[0-9]+\./, "$10_0.");
		}

		if (domain === "images.livemint.com") {
			// thanks to anonymous for reporting:
			// https://images.livemint.com/img/2022/11/18/1600x900/lead_1668785396496_1668785471862_1668785471862.jpg
			//   https://images.livemint.com/img/2022/11/18/original/lead_1668785396496.jpg
			// https://images.livemint.com/img/2020/07/24/1600x900/Speaker_new_3_(1)_1595600142903_1595600161111.jpg
			//   https://images.livemint.com/img/2020/07/24/original/Speaker_new_3_(1)_1595600142903.jpg
			return src.replace(/(\/img\/+[0-9]{4}\/+[0-9]{2}\/+[0-9]{2}\/+)[0-9]+x[0-9]+\/+([^/.?#]+?_[0-9]{13})(?:_[0-9]{13}){1,}\./, "$1original/$2.");
		}

		if (domain_nowww === "livemint.com") {
			// thanks to anonymous for reporting:
			// https://www.livemint.com/lm-img/img/2023/07/30/600x338/RUSSIA-AFRICA-FORUM-26_1690679007893_1690679024560.JPG
			//   https://images.livemint.com/img/2023/07/30/original/RUSSIA-AFRICA-FORUM-26_1690679007893.JPG
			// https://www.livemint.com/lm-img/img/2023/09/16/1600x900/reference_1682688938522_1694833529967.png
			//   https://images.livemint.com/img/2023/09/16/1600x900/reference_1682688938522_1694833529967.png
			return src.replace(/:\/\/[^/]+\/+lm-img\/+img\//, "://images.livemint.com/img/");
		}

		if (domain === "i.jauns.lv") {
			// thanks to anonymous for reporting:
			// https://i.jauns.lv/t/2016/12/09/63008/1000x620.jpg?v=1486094328
			//   https://i.jauns.lv/o/2016/12/09/63008.jpg?v=1486094328
			return src.replace(/\/t\/+([0-9]{4}\/+[0-9]{2}\/+[0-9]{2}\/+[0-9]+)\/+[0-9]+x[0-9]+\./, "/o/$1.");
		}

		if (domain === "static.kinorium.com") {
			// https://static.kinorium.com/img/blank100.png
			if (/\/img\/+blank100\./.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}
		}

		if (domain === "images.kinorium.com" ||
			// thanks to anonymous for reporting:
			// https://images-s.kinorium.com/movie/shot/90483/h280_902025.jpg
			//   https://images-s.kinorium.com/movie/shot/90483/original_902025.jpg
			domain === "images-s.kinorium.com" ||
			// https://en-images.kinorium.com/movie/1080/234571.jpg?1613719646
			//   https://en-images.kinorium.com/movie/original/234571.jpg?1613719646 -- 2764x4096
			domain === "en-images.kinorium.com") {
			// thanks to puddyplexer on github for reporting: https://github.com/qsniyg/maxurl/issues/1230
			// https://images.kinorium.com/movie/shot/90483/h280_902025.jpg
			//   https://images.kinorium.com/movie/shot/90483/w1500_902025.jpg
			// https://images.kinorium.com/movie/poster/90483/h280_39038026.jpg
			//   https://images.kinorium.com/movie/poster/90483/original_39038026.jpg
			// https://images.kinorium.com/movie/backstage/90483/h280_49774877.jpg
			//   https://images.kinorium.com/movie/backstage/90483/original_49774877.jpg -- 3860x2576
			// https://images.kinorium.com/movie/promo/90483/h280_50128627.jpg
			//   https://images.kinorium.com/movie/promo/90483/w1500_50128627.jpg
			//   https://images.kinorium.com/movie/promo/90483/original_50128627.jpg -- doesn't work
			// https://images.kinorium.com/movie/cover/90483/h280_37648326.jpg
			//   https://images.kinorium.com/movie/cover/90483/w1500_37648326.jpg
			// https://images.kinorium.com/movie/fanart/90483/h280_44866117.jpg
			//   https://images.kinorium.com/movie/fanart/90483/w1500_44866117.jpg
			// https://images.kinorium.com/movie/1080/80494.jpg?1578672009
			//   https://images.kinorium.com/movie/original/80494.jpg?1578672009
			// https://images.kinorium.com/persona/300/779193.jpg
			//   https://images.kinorium.com/persona/original/779193.jpg
			// https://images.kinorium.com/movie/cast/2857527/w150_779193.jpg
			//   https://images.kinorium.com/movie/cast/2857527/original_779193.jpg
			return src
				.replace(/(\/(?:movie|persona)\/+)(?:300|1080)\/+([0-9]+\.)/, "$1original/$2")
				.replace(/(\/movie\/+[^/]+\/+[0-9]+\/+)w1500?_/, "$1original_")
				.replace(/(\/movie\/+[^/]+\/+[0-9]+\/+)h280_/, "$1w1500_")
		}

		if (domain === "images.eil.com") {
			// thanks to anonymous for reporting:
			// https://images.eil.com/product-size-custom/817924.jpg?d=400x400 -- 400x397
			//   https://images.eil.com/product-size-custom/817924.jpg -- 1280x1271
			// https://images.eil.com/large_image/ALTERED_IMAGES_THE%2BRETURN%2BOF%2BTHE%2BTEENAGE%2BPOPSTAR%2B-%2BRSD%2B2022-793208.jpg
			//   https://images.eil.com/product-size-custom/793208.jpg -- 1280x1272
			// https://images.eil.com/large_image/BOB_DYLAN_ANOTHER%2BSIDE%2BOF%2BBOB%2BDYLAN%2B-%2B1ST%2B-%2BPASTED%2B-%2BVG-575485.jpg
			//   https://images.eil.com/product-size-custom/575485.jpg
			return src
				.replace(/(\/product-size-custom\/+[0-9]+\.[a-z]+)(?:[?#].*)?$/, "$1")
				.replace(/\/large_image\/+[^/]+-([0-9]+\.[a-z]+)(?:[?#].*)?$/, "/product-size-custom/$1");
		}

		if (domain_nowww === "trunkarchive.com") {
			// thanks to anonymous for reporting:
			// https://www.trunkarchive.com/ClientFiles/COR/Images/transparent_pixel.png
			if (/\/ClientFiles\/+COR\/+Images\/+transparent_pixel\./.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}
		}

		if (domain_nowww === "executivespeakers.com") {
			// thanks to anonymous for reporting:
			// https://www.executivespeakers.com/images/speakers/dan%20buettner/2020304145522dan-buettner-905v-cropped.jpg -- 2560x2560
			//   https://www.executivespeakers.com/images/speakers/dan%20buettner/2020304145522dan-buettner-905v.jpg -- 2560x3840
			return src.replace(/(\/images\/+.*)-cropped\./, "$1.");
		}

		if (domain_nowww === "julienslive.com") {
			// thanks to anonymous for reporting:
			// https://www.julienslive.com/images/lot/5983/598364_s.jpg
			//   https://www.julienslive.com/images/lot/5983/598364_xl.jpg -- 1000x667
			// https://www.julienslive.com/images/auction/696_l.jpg -- 617x800
			//   https://www.julienslive.com/images/auction/696_xl.jpg -- 1542x2000
			return src.replace(/(\/images\/+(?:lot\/+[0-9]+|auction)\/+[0-9]+)_[sml]\./, "$1_xl.");
		}

		if (domain === "st.violity.com") {
			// thanks to anonymous for reporting:
			// https://st.violity.com/auction/small/auctions/13/75/23/9/137523999.jpg
			//   https://st.violity.com/auction/view/auctions/13/75/23/9/137523999.jpg
			//   https://st.violity.com/auction/big/auctions/13/75/23/9/137523999.jpg
			return src.replace(/(\/auction\/+)(?:small|view)(\/+auctions\/+)/, "$1big$2");
		}

		if (domain === "media.springernature.com" ||
			// thanks to roi:
			// https://media.nature.com/lw767/magazine-assets/d41586-024-01223-0/d41586-024-01223-0_27010832.jpg?as=webp
			//   https://media.nature.com/full/magazine-assets/d41586-024-01223-0/d41586-024-01223-0_27010832.jpg
			// https://media.nature.com/w140h79/springer-static/image/art%3A10.1038%2Fs41586-024-07339-7/MediaObjects/41586_2024_7339_Fig1_HTML.png
			//   https://media.nature.com/full/springer-static/image/art%3A10.1038%2Fs41586-024-07339-7/MediaObjects/41586_2024_7339_Fig1_HTML.png
			domain === "media.nature.com" ||
			// thanks to roi:
			// https://images.nature.com/w140h79/magazine-assets/d41586-024-01167-5/d41586-024-01167-5_27002754.jpg
			//   https://images.nature.com/full/magazine-assets/d41586-024-01167-5/d41586-024-01167-5_27002754.jpg
			domain === "images.nature.com") {
			// thanks to anonymous for reporting:
			// https://media.springernature.com/w300/springer-static/image/art%3A10.1038%2Fs41565-019-0561-4/MediaObjects/41565_2019_561_Figa_HTML.jpg?as=webp
			//   https://media.springernature.com/full/springer-static/image/art%3A10.1038%2Fs41565-019-0561-4/MediaObjects/41565_2019_561_Figa_HTML.jpg
			// thanks to roi:
			// https://media.springernature.com/lw685/springer-static/image/art%3A10.1038%2Fs41467-024-46846-z/MediaObjects/41467_2024_46846_Fig1_HTML.png?as=webp
			//   https://media.springernature.com/full/springer-static/image/art%3A10.1038%2Fs41467-024-46846-z/MediaObjects/41467_2024_46846_Fig1_HTML.png
			//return src.replace(/(:\/\/[^/]+\/+)[wh][0-9]+\/+(.*?)(?:[?#].*)?$/, "$1full/$2");
			return remove_queries(src.replace(/(:\/\/[^/]+\/+)(?:l?w[0-9]+|w[0-9]+h[0-9]+)\//, "$1full/"), ["as"]);
		}
		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/");
		}

		if (domain === "images.collection.cooperhewitt.org") {
			// thanks to anonymous for reporting:
			// https://collection.cooperhewitt.org/objects/18155189/
			// https://images.collection.cooperhewitt.org/376026_262ee7c69a82ced3_z.jpg
			//   https://images.collection.cooperhewitt.org/376026_262ee7c69a82ced3_k.jpg -- 2048x1481
			// x (different hash), k, b, n ,z
			return src.replace(/^([a-z]+:\/\/[^/]+\/+[0-9]+_[0-9a-f]{10,}_)[bnz]\./, "$1k.");
		}

		if (domain_nowww === "foto-kurier.pl") {
			// thanks to anonymous for reporting:
			// https://www.foto-kurier.pl/users/galleries/e644e4178b47ac69e502a86dc4949fff_m.jpg
			//   https://www.foto-kurier.pl/users/galleries/e644e4178b47ac69e502a86dc4949fff_280.jpg
			//   https://www.foto-kurier.pl/users/galleries/e644e4178b47ac69e502a86dc4949fff_p.jpg -- 1200x717
			return src.replace(/(\/users\/+galleries\/+[0-9a-f]{20,})(?:_(?:280|m))?(\.)/, "$1_p$2");
		}

		if (domain === "media.c5n.com") {
			// thanks to anonymous for reporting:
			// https://media.c5n.com/p/eb70ff1c9392f51ac5d6e10c26c11b3d/adjuntos/326/imagenes/000/228/0000228362/790x0/smart/taylor-swift-argentina.jpg
			//   https://media.c5n.com/adjuntos/326/imagenes/000/228/0000228362.jpg
			// https://media.c5n.com/p/a79c98cade1214e0ae61440d3c3c326c/adjuntos/326/imagenes/000/003/0000003863/meta-mark-zuckerberg.jfif
			//   https://media.c5n.com/adjuntos/326/imagenes/000/003/0000003863.jfif
			return src.replace(/\/p\/+[0-9a-f]{20,}\/+(adjuntos\/+[0-9]+\/+imagenes\/+[0-9]{3}\/+[0-9]{3}\/+[0-9]+)\/.*?(\.[a-z]+)(?:[?#].*)?$/, "/$1$2");
		}

		if (domain_nosub === "hket.com" && /^static[0-9]*\./.test(domain)) {
			// thanks to anonymous for reporting:
			// https://static04.hket.com/res/v3/image/content/3640000/3642758/viutv20231031_01_1024.JPG
			//   https://static04.hket.com/res/v3/image/content/3640000/3642758/viutv20231031_01_1200.JPG
			return src.replace(/(\/res\/+v3\/+image\/+content\/+[0-9]+\/+[0-9]+\/+[^/]+)_1024\./, "$1_1200.");
		}

		if (domain === "cdn.80.lv") {
			// thanks to anonymous for reporting:
			// https://cdn.80.lv/api/upload/content/e1/images/6542113906abc/widen_920x0.jpg
			//   https://cdn.80.lv/api/upload/content/e1/6542113906abc.jpg
			// https://cdn.80.lv/api/upload/person/5/images/626fc1ad8122c/cover_60x60.jpeg
			//   https://cdn.80.lv/api/upload/person/5/626fc1ad8122c.jpeg
			// https://cdn.80.lv/api/upload/post/24538/images/6555fa32f0929/crop_cd5f3b6c_400x360.jpg
			//   https://cdn.80.lv/api/upload/post/24538/6555fa32f0929.jpg
			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
			// thanks to byjrg on github: https://github.com/qsniyg/maxurl/issues/1383
			// https://imagedelivery.net/qQuMkbHJ-0s6rwu8vup_5w/7268a63b-9a30-4adf-566f-25e75f2cc800/2x
			//   https://imagedelivery.net/qQuMkbHJ-0s6rwu8vup_5w/7268a63b-9a30-4adf-566f-25e75f2cc800/original -- 1083x1673
			// 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",
				"qQuMkbHJ-0s6rwu8vup_5w": "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
			// thanks to karpuzikov on github: https://github.com/qsniyg/maxurl/issues/1241
			// https://i01.appmifile.com/v1/MI_18455B3E4DA706226CF7535A58E875F0267/pms_1536382068.06398947!200x200!85.jpg
			//   https://i01.appmifile.com/v1/MI_18455B3E4DA706226CF7535A58E875F0267/pms_1536382068.06398947.jpg
			return {
				url: src.replace(/(\/[^/?#!]+)(?:[!][^/.?#]+)+\./, "$1."),
				can_head: false // 403
			};
		}

		if (domain === "d2qu5xmcgmzxnb.cloudfront.net") {
			// thanks to anonymous for reporting:
			// https://d2qu5xmcgmzxnb.cloudfront.net/ewogICAgICAgICAgICAgICAgICAgICAgICAiYnVja2V0IjogImZpbGVzLmxici5jbG91ZCIsCiAgICAgICAgICAgICAgICAgICAgICAgICJrZXkiOiAicHVibGljLzIwMjItMDEvaGFubmVtYW5uX21hcmstcGhvdG8tNDYyeDU4OC5qcGciLAogICAgICAgICAgICAgICAgICAgICAgICAiZWRpdHMiOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgInJlc2l6ZSI6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICJ3aWR0aCI6IDIzMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICJoZWlnaHQiOiAyNzksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAiZml0IjogImNvdmVyIgogICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0=
			//   https://files.lbr.cloud/public/2022-01/hannemann_mark-photo-462x588.jpg
			// https://d2qu5xmcgmzxnb.cloudfront.net/ewogICAgICAgICAgICAgICAgICAgICAgICAiYnVja2V0IjogImZpbGVzLmxici5jbG91ZCIsCiAgICAgICAgICAgICAgICAgICAgICAgICJrZXkiOiAicHVibGljLzIwMjEtMTEvU29mdEJhbmsuanBnIiwKICAgICAgICAgICAgICAgICAgICAgICAgImVkaXRzIjogewogICAgICAgICAgICAgICAgICAgICAgICAgICJyZXNpemUiOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAid2lkdGgiOiA5NDUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAiaGVpZ2h0IjogNTI2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgImZpdCI6ICJjb3ZlciIKICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9
			//   https://files.lbr.cloud/public/2021-11/SoftBank.jpg
			match = src.match(/^[a-z]+:\/\/[^/]+\/+(ewog[^/?#]+)(?:[?#].*)?$/);
			if (match) {
				let parsed = JSON_parse(base64_decode(match[1]));
				return "http://" + parsed.bucket + "/" + parsed.key;
			}
		}

		if (domain === "kuvat.huuto.net") {
			// thanks to anonymous for reporting:
			// https://kuvat.huuto.net/v1/c026/1d43294aac58f20e7ff11105728/511967992-m.jpg
			//   https://kuvat.huuto.net/v1/c026/1d43294aac58f20e7ff11105728/511967992-orig.jpg
			return src.replace(/(\/[0-9]+)-[ms](\.[^/.]+)(?:[?#].*)?$/, "$1-orig$2");
		}

		if (domain_nosub === "awork.com") {
			// awork is a project management tool and uploaded assets are private. The URLs in the below example won't work but are still included for illustration purposes.
			// https://name-of-workspace.awork.com/api/v1/files/85ee1659-f903-4163-9361-bedf2b242ef9/download?crop=false&width=1024&height=1024&enlarge=false&v=1701093812740
			//   https://name-of-workspace.awork.com/api/v1/files/85ee1659-f903-4163-9361-bedf2b242ef9/download?crop=false&enlarge=false&v=1701093812740
			match = src.match(/\/api\/v1\/files\/[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}\/download\?/);
			if (match) {
				return remove_queries(src, ["width", "height"]);
			}
		}

		if (domain_nowww === "thetv.jp") {
			// https://thetv.jp/assets/v3/img/lemon_quarter.svg
			if (/\/assets\/+v3\/+img\/+lemon_quarter\./.test(src))
				return {
					url: src,
					bad: "mask"
				};

			// thanks to nimbuz on discord:
			// https://thetv.jp/i/nw/1071545/10684734.jpg?w=615
			//   https://thetv.jp/i/nw/1071545/10684734.jpg?w=99999
			// https://thetv.jp/i/nw/1169415/12418305.jpg
			//   https://thetv.jp/i/nw/1169415/12418305.jpg?w=99999
			return src.replace(/(\/i\/+nw\/+[0-9]+\/+[0-9]+\.[a-z]+)(?:[?#].*)?$/, "$1?w=99999");
		}

		if (domain_nowww === "svbtleusercontent.com") {
			// https://svbtleusercontent.com/dvwQxNxkr6FKLVsDTBoqwm0xspap_small.png
			//   https://svbtleusercontent.com/dvwQxNxkr6FKLVsDTBoqwm0xspap.png
			return src.replace(/(:\/\/[^/]+\/+[^/.?#_]+)_small\./, "$1.");
		}

		if (domain_nowww === "kinopavasaris.lt") {
			// https://kinopavasaris.lt/img/rte/2024/I%C5%A1ankstiniai/576xAuto/576xAuto_1200x628_cover.png
			//   https://kinopavasaris.lt/img/rte/2024/I%C5%A1ankstiniai/1200x628_cover.png
			return src.replace(/\/[0-9Auto]+x[0-9Auto]+\/+[0-9Auto]+x[0-9Auto]+_/, "/");
		}

		if (domain === "thumbnails.yayimages.com") {
			// https://thumbnails.yayimages.com/10/960/10960752.jpg
			//   https://thumbnails.yayimages.com/1600/10/960/10960752.jpg
			//   https://thumbnails.yayimages.com/neutral/10/960/10960752.jpg
			return src.replace(/(:\/\/[^/]+\/+)(?:1600\/+)?([0-9a-f]+\/+[0-9a-f]{3}\/+[^/]+\.)/, "$1neutral/$2");
		}

		if (domain === "media-cloud.corcoranlabs.com") {
			// thanks to anonymous for reporting:
			// https://media-cloud.corcoranlabs.com/filters:format(webp)/fit-in/500x500/AgentApi/NewTaxi/22140/mediarouting.vestahub.com/Media/116633508
			//   https://media-cloud.corcoranlabs.com/AgentApi/NewTaxi/22140/mediarouting.vestahub.com/Media/116633508
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+/, "/");
			if (newsrc !== src) {
				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.");
		}

		if (domain === "manhua.acimg.cn") {
			// thanks to anonymous for reporting:
			// https://manhua.acimg.cn/vertical/0/30_19_15_325982f153d0f3d4b52d617a579da96e_1640862941502.jpg/420
			//   https://manhua.acimg.cn/vertical/0/30_19_15_325982f153d0f3d4b52d617a579da96e_1640862941502.jpg/0
			return {
				url: src.replace(/(\/(?:vertical|horizontal)\/.*\/)[0-9]+(?:[?#].*)?$/, "$10"),
				headers: {
					Referer: ""
				}
			};
		}

		if (domain_nowww === "mvd.cloud") {
			// thanks to anonymous for reporting:
			// https://mvd.cloud/images/DR10005.jpg -- 216x216
			//   https://mvd.cloud/300dpi/DR10005.jpg -- 3000x3000
			return src.replace(/(:\/\/[^/]+\/+)images\/+/, "$1300dpi/");
		}

		if (domain === "content-jp.umgi.net") {
			// thanks to anonymous for reporting:
			// https://content-jp.umgi.net/products/ui/UICY-79658_MBe_large.jpg
			//   https://content-jp.umgi.net/products/ui/UICY-79658_MBe_extralarge.jpg
			//   https://content-jp.umgi.net/products/ui/UICY-79658_MBe.jpg
			return src.replace(/(\/products\/+ui\/+[^/.?#]+)_(?:large|extralarge)\./, "$1.");
		}

		if (domain === "cdn.passes.com") {
			// thanks to newuser999 on discord for reporting:
			// https://cdn.passes.com/profile/media/61bbf5f7-871e-41ef-809d-9aff2391a1af/profile-thumbnail.jpeg
			//   https://cdn.passes.com/profile/media/61bbf5f7-871e-41ef-809d-9aff2391a1af/profile-image.jpeg
			return src.replace(/(\/profile\/+media\/+[-0-9a-f]{10,}\/+profile)-thumbnail\./, "$1-image.");
		}

		if (domain_nowww === "weaudition.com") {
			// thanks to anonymous for reporting:
			// https://www.weaudition.com/upload/userprofiles/thumbnail/wr_139167_1677278650.jpeg
			//   https://www.weaudition.com/upload/userprofiles/wr_139167_1677278650.jpeg -- 1024x1280
			// doesn't work for all:
			// https://www.weaudition.com/upload/userprofiles/thumbnail/wr_168664_1643141754.jpg -- 3126x3126
			//   https://www.weaudition.com/upload/userprofiles/wr_168664_1643141754.jpg -- 404
			return src.replace(/(\/upload\/+userprofiles\/+)thumbnail\/+/, "$1");
		}

		if (domain === "cdn.administrace.tv") {
			// thanks to anonymous for reporting:
			// https://cdn.administrace.tv/2023/12/10/medium_169/bae2bf69f930f4ad5d8dcb299b87696d.jpg
			//   https://cdn.administrace.tv/2023/12/10/hd/bae2bf69f930f4ad5d8dcb299b87696d.jpg
			//   https://cdn.administrace.tv/2023/12/10/bae2bf69f930f4ad5d8dcb299b87696d.jpg -- 4000x2667
			// https://cdn.administrace.tv/2023/12/15/small_169/a7df7d6089a346833715abf6a1dffe94.jpg
			//   https://cdn.administrace.tv/2023/12/15/a7df7d6089a346833715abf6a1dffe94.jpg
			return src.replace(/(\/[0-9]{4}\/+[0-9]{2}\/+[0-9]{2}\/+)[^/]+\/+([0-9a-f]{10,}\.)/, "$1$2");
		}

		if (domain === "catalogo.biblio.unc.edu.ar") {
			// thanks to anonymous for reporting:
			// https://catalogo.biblio.unc.edu.ar/Cover/Show?author=Mariani%2C+Ana&callnumber=&size=small&title=La+vida+por+delante&isbn=9875561444
			//   https://catalogo.biblio.unc.edu.ar/Cover/show?author=Mariani%2C+Ana&callnumber=&size=medium&title=La+vida+por+delante&isbn=9875561444
			//   https://catalogo.biblio.unc.edu.ar/Cover/show?author=Mariani%2C+Ana&callnumber=&size=large&title=La+vida+por+delante&isbn=9875561444
			if (/\/Cover\/+Show\?/i.test(src)) {
				return src.replace(/([?&]size=)(?:small|medium)([&#].*)?$/, "$1large$2");
			}
		}

		if (domain === "im.autopilot.ru") {
			// thanks to Harmony on discord for reporting:
			// https://im.autopilot.ru/Issues.photo/AUTO_Site/2023/007/KAV_001111_02572_1_t250_093335.jpg
			//   https://im.autopilot.ru/Issues.photo/AUTO_Site/2023/007/KAV_001111_02572_1_t241_093335.jpg
			// https://im.autopilot.ru/Issues.photo/AUTO_Site/2023/007/KAV_001111_02572_1_t241_093335.webp
			//   https://im.autopilot.ru/Issues.photo/AUTO_Site/2023/007/KAV_001111_02572_1_t241_093335.jpg
			newsrc = src.replace(/(:\/\/[^/]+\/+Issues\.photo\/+[^/]+\/+[0-9]{4}\/+[^/]+\/+[^/]+_t)2(?:[0-3][0-9]|[45]0)(_[0-9]+\.)/, "$1241$2");
			if (newsrc !== src)
				return newsrc;
			return src.replace(/\.webp(?:[?#].*)?$/, ".jpg");
		}

		if (amazon_container === "fesapp-bucket") {
			// thanks to nimbuz on discord for reporting:
			// https://fesapp-bucket.s3.amazonaws.com/uploads/article_images/image/67954/width:800/text_image20231229-19303-1rzrttw.jpg
			//   https://fesapp-bucket.s3.amazonaws.com/uploads/article_images/image/67954/default/text_image20231229-19303-1rzrttw.jpg -- default doesn't exist until api call
			match = src.match(/\/article_images\/+image\/+([0-9]+)\/+width:/);
			if (match) {
				common_functions["get_redirect_url"](api_cache, options, "https://api.fesapp.jp/images/article/" + match[1] + "/default", options.cb);
				return {
					waiting: true
				};
			}
		}

		if (domain_nowww === "imgtraffic.com") {
			// thanks to anonymous for reporting:
			// https://imgtraffic.com/1s/2023/12/05/656f9d1d50a1a.jpeg
			//   https://imgtraffic.com/1/2023/12/05/656f9d1d50a1a.jpeg
			return src.replace(/(\/[0-9]+)s\/+([0-9]{4}\/+[0-9]{2}\/+[0-9]{2}\/+[0-9a-f]+\.)/, "$1/$2");
		}

		if (domain === "s.movieinsider.com") {
			// thanks to anonymous for reporting:
			// https://s.movieinsider.com/images/p/150/738003_m1695914144.png
			//   https://s.movieinsider.com/images/p/738003_m1695914144.png
			return src.replace(/(\/images\/+p\/+)[0-9]+\/+/, "$1");
		}

		if (domain_nosub === "filmfreeway.com") {
			// thanks to anonymous for reporting:
			// https://filmfreeway-production-storage-01-storage.filmfreeway.com/assets/public/001/028/045/d37f36c4b5d73430a6bf41cee185e5582d662636/thumb/StillphotoperTheSixValuesofourSociety.jpg?1694706355
			//   https://filmfreeway-production-storage-01-storage.filmfreeway.com/assets/public/001/028/045/d37f36c4b5d73430a6bf41cee185e5582d662636/original/StillphotoperTheSixValuesofourSociety.jpg?1694706355
			newsrc = src.replace(/(\/(?:[0-9]{3}\/+){3}[0-9a-f]{10,}\/+)thumb\/+/, "$1original/");
			if (newsrc !== src) return newsrc;
		}

		if (domain_nowww === "8muses.io") {
			// thanks to anonymous for reporting:
			// https://8muses.io/img/data/th_000000014229.jpg
			//   https://8muses.io/img/data/full_000000014229.jpg
			return src.replace(/(\/img\/+data\/+)th_([0-9]+\.)/, "$1full_$2");
		}

		if (domain === "img.vivantiscdn.net") {
			// https://img.vivantiscdn.net/photos/w600_h600_fN/p/_orig/PR/paco-rabanne-lady-million-edp_14087559111257.jpg
			//   https://img.vivantiscdn.net/photos/p/_orig/PR/paco-rabanne-lady-million-edp_14087559111257.jpg
			return src.replace(/\/photos\/+w[0-9N]+_h[0-9N]+_f[^/]+\/+/, "/photos/");
		}

		if (domain === "static.eldorado.ru") {
			// thanks to anonymous for reporting:
			// https://static.eldorado.ru/img1/b/bb3/063774001.jpg/resize/360x360/
			//   https://static.eldorado.ru/img1/b/bb3/063774001.jpg
			return src.replace(/(\/img[0-9]+\/+[0-9a-f]\/+[0-9a-f]{3}\/+[0-9]+\.[a-z]+)\/+.*/, "$1");
		}

		if (domain === "g.pggcdn.net") {
			// thanks to anonymous for reporting:
			// https://g.pggcdn.net/product/1593914686481238364/w880/Meditations-Marcus-Aurelius.jpg
			//   https://g.pggcdn.net/product/1593914686481238364/Meditations-Marcus-Aurelius.jpg -- 1896x3073
			return src.replace(/(\/product\/+[0-9]+\/+)w[0-9]+\/+/, "$1");
		}

		if (domain_nowww === "holod.ru") {
			// thanks to anonymous for reporting:
			// https://holod.ru/pics/watermark/medium/14/714814_0.jpg
			//   https://holod.ru/pics/watermark/big/14/714814_0.jpg
			// https://holod.ru/pics/clean/medium/73/746373_2.jpg
			//   https://holod.ru/pics/clean/big/73/746373_2.jpg
			// https://holod.ru/pics/infoicon/medium/73/746373_0.jpg
			//   https://holod.ru/pics/infoicon/big/73/746373_0.jpg
			return src.replace(/(\/pics\/+[^/]+\/+)(?:[0-9]+x[0-9]+|medium)\/+/, "$1big/");
		}

		if (domain === "shopgoodwillimages.azureedge.net") {
			// thanks to anonymous for reporting:
			// https://shopgoodwillimages.azureedge.net/production/32/Items/12-27-2023/b2c6d3d2-4bce-4160-982a-07d01cc3c06crown_1227t1.jpeg
			//   https://shopgoodwillimages.azureedge.net/production/32/Items/12-27-2023/b2c6d3d2-4bce-4160-982a-07d01cc3c06crown_12271.png
			return src.replace(/(\/production\/+[0-9]+\/+Items\/+[0-9]{1,2}-[0-9]{1,2}-[0-9]{4}\/+[-0-9a-f]{10,}[^/.?#]+_[0-9]+)t([0-9]+)\.jpeg(?:[?#].*)?$/, "$1$2.png");
		}

		if (domain_nosub === "photoblog.pl" && /^f[0-9]*\./.test(domain)) {
			// thanks to anonymous for reporting:
			// https://f2.photoblog.pl/w300/fbl-2014/201406/168041167/3.jpg
			//   https://f2.photoblog.pl/fbl-2014/201406/168041167.jpg
			// https://f2.photoblog.pl/w300/fbl-2014/201406/168041167.jpg
			//   https://f2.photoblog.pl/fbl-2014/201406/168041167.jpg
			return src.replace(/\/w[0-9]+\/+(fbl-[0-9]+\/+[0-9]+\/+[0-9]+)(?:\/+[^/?#]+)?(\.[^/?#]+)(?:[?#].*)?$/, "/$1$2");
		}

		if (domain === "catalog.shm.ru" && options && options.do_request && options.cb) {
			// thanks to anonymous for reporting:
			// https://catalog.shm.ru/entity/OBJECT/1771968
			let query_shm_info = function(id, cb) {
				api_query("shm_info:" + id, {
					url: "https://catalog.shm.ru/api/spf/" + id + ".json",
					imu_mode: "xhr",
					json: true
				}, cb, function(done, resp, cache_key) {
					if (!resp) {
						console_error(cache_key, "Unable to get info from", resp);
						return done(null, false);
					}

					done({
						width: resp.width,
						height: resp.height
					}, 6*60*60);
				});
			};

			match = src.match(/\/api\/+spf\/+([^/.?#]+)\.[a-z]+(?:[?#].*)?$/);
			if (match) {
				query_shm_info(match[1], function(info) {
					if (!info)
						return options.cb(null);

					return options.cb("https://catalog.shm.ru/api/spf/" + match[1] + ".jpg?w=" + info.width + "&h=" + info.height);
				});

				return {
					waiting: true
				};
			}
		}

		if (domain === "main-cdn.sbermegamarket.ru") {
			// thanks to anonymous for reporting:
			// https://main-cdn.sbermegamarket.ru/mid9/hlr-system/-10/805/385/728/212/22/100023360695b1.jpg
			//   https://main-cdn.sbermegamarket.ru/big2/hlr-system/-10/805/385/728/212/22/100023360695b1.jpg
			//   https://main-cdn.sbermegamarket.ru/hlr-system/-10/805/385/728/212/22/100023360695b1.jpg -- 3000x3000
			// https://main-cdn.sbermegamarket.ru/hlr-system/149/296/091/166/194/100023423643b1.jpg -- 930x3469
			return src.replace(/(:\/\/[^/]+\/+)(?:mid|big)[0-9]*\/+(hlr-system\/+)/, "$1$2");
		}

		if (domain === "cdn.create.vista.com") {
			// thanks to anonymous for reporting:
			// https://cdn.create.vista.com/api/media/small/270823308/stock-vector-vector-set-of-vintage-floral
			//   https://cdn.create.vista.com/api/media/medium/270823308/stock-vector-vector-set-of-vintage-floral
			// https://cdn.create.vista.com/api/media/small/626622382/stock-photo-pretty-woman-jacket-looking-away-while-sitting-couch-home
			//   https://cdn.create.vista.com/api/media/medium/626622382/stock-photo-pretty-woman-jacket-looking-away-while-sitting-couch-home -- forces download
			// https://cdn.create.vista.com/downloads/37bf7831-a040-4d96-928d-8d9bfbae4b65_360.jpeg
			//   https://cdn.create.vista.com/downloads/37bf7831-a040-4d96-928d-8d9bfbae4b65.jpeg -- forces download
			return src
				.replace(/(\/api\/+media\/+)small\/+/, "$1medium/")
				.replace(/(\/downloads\/+[-0-9a-f]{10,})_[0-9]+\./, "$1.");
		}

		if (domain === "image.alza.cz") {
			// thanks to jonestly on discord:
			// https://image.alza.cz/products/INTZ003d1/INTZ003d1.jpg?width=190&height=190
			return {
				url: src.replace(/\?.*/, ""),
				headers: {
					Referer: "https://www.alza.cz/"
				}
			};
		}

		if (domain_nowww === "pornhoarder.pictures") {
			// thanks to anonymous for reporting:
			// https://pornhoarder.pictures/img/small/42/425726597ca7bd6c52_1.jpg
			//   https://pornhoarder.pictures/img/large/42/425726597ca7bd6c52_1.jpg
			return src.replace(/\/img\/+small\/+/, "/img/large/");
		}

		if (domain_nowww === "pornhoarder.net") {
			// thanks to anonymous for reporting:
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+player\.php\?(?:.*&)?video=([^&]+)(?:[?&].*)?$/,
				query_for_id: function(id) {
					let url = "https://pornhoarder.net/player.php?video=" + id;
					return {
						url: url,
						method: "POST",
						data: "play=",
						headers: {
							Referer: url,
							"Sec-Fetch-Dest": "document",
							"Sec-Fetch-Mode": "navigate",
							"Sec-Fetch-Site": "same-origin",
							"Content-Type": "application/x-www-form-urlencoded"
						}
					}
				},
				process: function(done, resp, cache_key) {
					let match = resp.responseText.match(/<iframe src="(https?:\/\/[^"]+)".*?allowfullscreen/);
					if (!match) {
						console_error(cache_key, "Unable to find iframe match for", resp);
						return done(null, false);
					}

					return done({
						url: decode_entities(match[1]),
						is_pagelink: true
					}, 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nosub === "pornhoarder.tv") {
			// thanks to anonymous for reporting:
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+video\/+[^/]+\/+([^/.?#]{10,})(?:[?#].*)?$/,
				query_for_id: "https://" + domain + "/video/a-a/${id}",
				process: function(done, resp, cache_key) {
					let match = resp.responseText.match(/<iframe src="(https?:\/\/[^"]+)".*?allowfullscreen/);
					if (!match) {
						console_error(cache_key, "Unable to find iframe match for", resp);
						return done(null, false);
					}

					return done({
						url: decode_entities(match[1]),
						is_pagelink: true
					}, 6*60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "media.posterlounge.com") {
			// thanks to anonymous for reporting:
			// https://media.posterlounge.com/img/products/710000/703337/703337_poster_m.jpg
			//   https://media.posterlounge.com/img/products/710000/703337/703337_poster_l.jpg
			//   https://media.posterlounge.com/img/products/710000/703337/703337_poster.jpg
			// https://media.posterlounge.com/img/products/710000/707752/707752_poster_room_movies_m.jpg
			//   https://media.posterlounge.com/img/products/710000/707752/707752_poster_room_movies.jpg
			// https://media.posterlounge.com/img/products/710000/707752/707752_poster_pds_m.jpg
			//   https://media.posterlounge.com/img/products/710000/707752/707752_poster_pds.jpg
			// thanks to snek on discord:
			// https://www.posterlounge.pt/p/707752.html#paid=19198
			// https://media.posterlounge.com/img/products/710000/707752/707752_poster.jpg
			//   https://media.posterlounge.com/img/products/710000/707752/707752.jpg
			return src
				.replace(/(\/img\/+products\/+[0-9]+\/+[0-9]+\/+[0-9]+)_poster\./, "$1.")
				.replace(/(\/img\/+products\/+[0-9]+\/+[0-9]+\/+[0-9]+_poster(?:_(?:room_movies|pds))?)(?:_[ml])\./, "$1.");
		}

		if (domain_nowww === "fapopedia.net") {
			// thanks to vscum on github: https://github.com/qsniyg/maxurl/issues/1252
			// https://fapopedia.net/photos/s/k/skillsawww/1000//t_0369.jpg
			//   https://fapopedia.net/photos/s/k/skillsawww/1000//0369.jpg
			return src.replace(/(\/photos\/+.\/+.\/+[^/]+\/+[0-9]+\/+)t_/, "$1");
		}

		if (domain_nowww === "archived.moe") {
			// thanks to vscum on github: https://github.com/qsniyg/maxurl/issues/1253

			const archive_map = {
				// https://archived.moe/files/b/thumb/1704/81/1704817981404742s.jpg
				"b": "thebarchive",
				// https://archived.moe/files/bant/thumb/1704/66/1704665929725547s.jpg
				"bant": "thebarchive",
				// https://archived.moe/files/cm/thumb/1704/66/1704667072520561s.jpg
				"cm": "fireden",
				"h": "archiveofsins",
				"hc": "archiveofsins",
				"hm": "archiveofsins",
				"i": "archiveofsins",
				"lgbt": "archiveofsins",
				"r": "archiveofsins",
				"s": "archiveofsins",
				"soc": "archiveofsins",
				"t": "archiveofsins",
				"u": "archiveofsins",
				"y": "fireden"
			};

			match = src.match(/\/files\/+([^/]+)\/+thumb\/+[0-9]+\/+[0-9]+\/+([0-9]+)s\./);
			if (match) {
				let board = match[1];
				let picid = match[2];
				let picid_4 = picid.match(/^([0-9]{4})/)[1];
				let picid_2 = picid.match(/^[0-9]{4}([0-9]{2})/)[1];

				let urls = [];

				if (board in archive_map) {
					let provider = archive_map[board];

					if (provider === "thebarchive") {
						urls.push("https://thebarchive.com/data/" + board + "/thumb/" + picid_4 + "/" + picid_2 + "/" + picid + "s.jpg")
					} else if (provider === "fireden") {
						urls.push("https://img-lb.fireden.net/" + board + "/thumb/" + picid_4 + "/" + picid_2 + "/" + picid + "s.jpg")
					} else if (provider === "archiveofsins") {
						urls.push("https://archiveofsins.com/data/" + board + "/thumb/" + picid_4 + "/" + picid_2 + "/" + picid + "s.jpg")
					}
				}

				urls.push("https://i.4cdn.org/" + board + "/" + picid + "s.jpg");

				return urls;
			}
		}

		if (domain_nowww === "masterfap.net") {
			// thanks to anonymous for reporting:
			// https://www.masterfap.net/profile/corinna-kopf/photos/kdj0b3xmU2/corinna-kopf-thumbnail.webp
			//   https://www.masterfap.net/profile/corinna-kopf/photos/kdj0b3xmU2/corinna-kopf.webp
			newsrc = src.replace(/(\/photos\/+[^/]+\/+[^/]+)-thumbnail\./, "$1.");
			if (newsrc) {
				return {
					url: newsrc,
					problems: {
						watermark: true
					}
				};
			}
		}

		if (amazon_container === "iibawards-prod") {
			// thanks to anonymous for reporting:
			// https://iibawards-prod.s3.amazonaws.com/projects/images/000/000/838/medium.jpg
			//   https://iibawards-prod.s3.amazonaws.com/projects/images/000/000/838/original.jpg
			return src.replace(/(\/images\/+(?:[0-9]{3}\/+){3})[a-z]+\./, "$1original.");
		}

		if (domain === "shop.miniscience.com") {
			// thanks to anonymous for reporting:
			// https://shop.miniscience.com/images/medium/UVCLMN.jpg
			//   https://shop.miniscience.com/images/large/UVCLMN.jpg
			return src.replace(/(\/images\/+)medium\/+/, "$1large/");
		}

		if (domain_nosub === "svdcdn.com" && /\.transforms\./.test(domain)) {
			// https://best-fit.transforms.svdcdn.com/production/images/Copy-of-GN_23_T_Borchardt_file-1.jpg?w=768&q=100&auto=format&fit=crop&dm=...&s=...
			//   https://best-fit.files.svdcdn.com/production/images/Copy-of-GN_23_T_Borchardt_file-1.jpg
			return src.replace(/(:\/\/[^/]+)\.transforms(\.svdcdn\.com\/+[^?#].*?)(?:[?#].*)?$/, "$1.files$2");
		}

		if (domain === "images.vs-static.com") {
			// thanks to anonymous for reporting:
			// https://images.vs-static.com/yfr09nm8pH3P694LHLLivqhMRDg=/0x314:2999x2001/1900x0/Getty_Images_1330811041_046fcd0f40/Getty_Images_1330811041_046fcd0f40.jpg
			//   https://static.voguescandinavia.com/Getty_Images_1330811041_046fcd0f40/Getty_Images_1330811041_046fcd0f40.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+/, "/");
			if (newsrc !== src) {
				return "https://static.voguescandinavia.com/" + common_functions["get_thumbor_url"](newsrc);
			}
		}

		if (domain_nosub === "bitchesgirls.com" && /^cdn[0-9]*\./.test(domain)) {
			// thanks to anonymous for reporting:
			// https://cdn1.bitchesgirls.com/file/julia-burch-juliaaburch-julia-burch-december-4-2023/43099954595716302364556136863468566729_thumbnail.jpg
			//   https://cdn1.bitchesgirls.com/file/julia-burch-juliaaburch-julia-burch-december-4-2023/43099954595716302364556136863468566729.jpg
			newsrc = src.replace(/(\/file\/+[^/]+\/+[^/]+)_thumbnail\./, "$1.");
			if (newsrc !== src)
				return add_full_extensions(newsrc, ["mp4", "jpg"]);
		}

		if (domain_nowww === "trenton.com.au") {
			// thanks to anonymous for reporting:
			// https://www.trenton.com.au/product-images/crockery/art-de-cuisine/future-care/adc---future-care---round---plate/image-thumb__15855__trentonCategoryProducts/9904826_website.jpeg
			//   https://www.trenton.com.au/product-images/crockery/art-de-cuisine/future-care/adc---future-care---round---plate/image-thumb__15855__trentonProductImagesMain/9904826_website.webp
			//   https://www.trenton.com.au/product-images/crockery/art-de-cuisine/future-care/adc---future-care---round---plate/image-thumb__15855__trentonProductImagesFull/9904826_website.jpeg
			// https://www.trenton.com.au/product-images/crockery/art-de-cuisine/art-de-cuisine---igneous/adc-igneous-oval-plate/image-thumb__15771__trentonCategoryProducts/9907135_website.jpeg
			//   https://www.trenton.com.au/product-images/crockery/art-de-cuisine/art-de-cuisine---igneous/adc-igneous-oval-plate/image-thumb__15771__trentonProductImagesFull/9907135_website.jpeg
			return src.replace(/(\/product-images\/+.*\/image-thumb__[0-9]+__)[^/]+\//, "$1trentonProductImagesFull/");
		}

		if (host_domain_nowww === "directfromlourdes.com" && options.element) {
			// thanks to anonymous for reporting:
			if (options.element.tagName === "DIV" && options.element.classList.contains("mousetrap")) {
				return {
					url: src,
					bad: "mask"
				};
			}
		}

		if (domain === "img.ridicdn.net") {
			// thanks to Froktime and neckothy on github: https://github.com/qsniyg/maxurl/issues/1257
			// https://img.ridicdn.net/cover/4851000001
			//   https://img.ridicdn.net/cover/4851000001/large
			//   https://img.ridicdn.net/cover/4851000001/xxlarge?dpi=xxxhdpi&format=png
			return src.replace(/(\/cover\/+[0-9]+)(?:\/.*)?(?:[?#].*)?$/, "$1/xxlarge?dpi=xxxhdpi&format=png");
		}

		if (domain === "i.crepe.land") {
			// thanks to Froktime on github: https://github.com/qsniyg/maxurl/issues/1315
			// https://i.crepe.land/https://crepe.land/portfolio/h/ht/ht7tw8xcih435lphickqr5powq4mhokw_dasflas2_%25EB%258B%25892.png?h=75&t=i&v=3a&w=75&x=2
			//   https://i.crepe.land/https://crepe.land/portfolio/h/ht/ht7tw8xcih435lphickqr5powq4mhokw_dasflas2_%25EB%258B%25892.png?t=i
			newsrc = src.replace(/\?.*/, "?t=i");
			if (newsrc !== src)
				return newsrc;

			// thanks to Froktime on github: https://github.com/qsniyg/maxurl/issues/1259
			// https://i.crepe.land/https://crepe.land/portfolio/0/0t/0tfibilw6uaf2k1n3mrwml6va2s8ap29_%EC%8A%A4%ED%8B%B4%ED%82%B9.png?q=100&t=i&v=3a&w=800&x=1
			//   https://crepe.land/portfolio/0/0t/0tfibilw6uaf2k1n3mrwml6va2s8ap29_%EC%8A%A4%ED%8B%B4%ED%82%B9.png
			return src.replace(/^[a-z]+:\/\/[^/]+\/+(https?:\/\/.*?)(?:[?#].*)?$/, "$1");
		}

		if (domain === "imaging.broadway.com") {
			// thanks to Harmony on discord for reporting:
			// https://imaging.broadway.com/images/custom/w5500/106726-23.jpg
			//   https://imaging.broadway.com/images/custom/106726-23.jpg
			// https://imaging.broadway.com/images/custom/125108-13.jpg -- 7360x4912
			return src.replace(/(\/images\/+)[^/]+\/+[^/]+\/+([0-9]+-[0-9]+\.)/, "$1custom/$2");
		}

		if (domain === "cdn.kobo.com") {
			// thanks to watatomo on github: https://github.com/qsniyg/maxurl/issues/1260
			// https://cdn.kobo.com/book-images/41fad862-39aa-4cdf-87c4-dbebd44ea06a/140/215/60/False/w2J-LihtQ0-sOCN20tLu1A.jpg
			//   https://cdn.kobo.com/book-images/41fad862-39aa-4cdf-87c4-dbebd44ea06a/w2J-LihtQ0-sOCN20tLu1A.jpg
			return src.replace(/(\/book-images\/+[-0-9a-f]{10,}\/+)[0-9]+\/+[0-9]+\/+[0-9]+\/+(?:true|false)\/+/i, "$1");
		}

		if (domain_nowww === "gofile.io" && options.do_request && options.cb) {
			// thanks to anonymous for reporting:
			let get_gofile_website_token = function(cb) {
				let cache_key = "gofile_website_token";
				api_query(cache_key, {
					url: "https://gofile.io/dist/js/alljs.js"
				}, cb, function(done, resp, cache_key) {
					//let match = resp.responseText.match(/websiteToken\s*=\s*"([0-9a-z]{5,})"/);
					let match = resp.responseText.match(/wt:\s*"([0-9a-z]{5,})"/);
					if (!match) {
						console_error(cache_key, "Unable to find websiteToken match for", resp);
						return done(null, false);
					}

					return done(match[1], 6*60*60);
				});
			};

			let get_gofile_token = function(cb) {
				if (!options.get_cookies) {
					console_error("No cookie support");
					return cb(null);
				}

				options.get_cookies("https://www.gofile.io/", function(cookies) {
					if (!cookies) {
						console_error("Unable to get cookies for gofile");
						return cb(null);
					}

					cookies = headers_list_to_dict(cookies);
					if (!("accounttoken" in cookies)) {
						console_error("accountToken doesn't exist, try visiting gofile.io");
						return cb(null);
					}

					cb(cookies["accounttoken"] || null);
				});
			};

			let query_gofile_content = function(id, cb) {
				get_gofile_token(function(token) {
					if (!token)
						return cb(null);

					get_gofile_website_token(function (websitetoken) {
						if (!websitetoken)
							return cb(null);

						let cache_key = "gofile_content:" + id;
						api_query(id, {
							url: "https://api.gofile.io/contents/" + id + "?wt=" + websitetoken,
							imu_mode: "xhr",
							headers: {
								Accept: "*/*",
								Authorization: "Bearer " + token,
								Origin: "https://gofile.io",
								Referer: "https://gofile.io/"
							},
							json: true
						}, cb, function(done, resp, cache_key) {
							if (!resp) {
								return done(null, false);
							}

							if (resp.status !== "ok" || !resp.data) {
								console_error(cache_key, "Invalid response", resp);
								return done(null, false);
							}

							return done(resp.data, 6*60*60);
						});
					});
				});
			};

			newsrc = website_query({
				website_regex: /^https:\/\/(?:www\.)?gofile\.io\/+d\/+([^?#]+)(?:[?#].*)?$/,
				run: function(cb, match) {
					query_gofile_content(match[1], function(content) {
						if (!content) {
							return cb(null);
						}

						let id = null;
						let queries = common_functions["parse_imu_hash"](src);
						if (queries && queries.id) id = queries.id;

						let items = [];
						let chosenitem = null;
						for (let itemid in content.children) {
							let item = content.children[itemid];
							let obj:BigImageInfoSObject = {
								url: item.link,
								headers: {
									Referer: "https://gofile.io/"
								},
								extra: {
									page: "https://gofile.io/d/" + content.code,
									created_date: content.createTime * 1000,
									id: item.id,
									caption: item.name
								},
								filename: item.name
							};

							let mime = item.mimetype || "";
							if (/^video\//.test(mime))
								obj.video = true;
							else if (!/^(?:image|audio)\//.test(mime)) {
								console_warn("Skipping", item, "due to mime:", mime);
								continue;
							}

							items.push(obj);

							if (itemid === id)
								chosenitem = obj;
						}

						if (chosenitem) {
							return cb(chosenitem);
						}

						if (!items.length) {
							console_warn("No items found for", content);
							return cb(null);
						}

						items.sort(function(a, b) {
							return a.filename.localeCompare(b.filename);
						});
						chosenitem = items[0];

						let newobj:BigImageInfoSObject = {};

						let links = [];
						for (let item of items) {
							let is_current = item == chosenitem;
							let url = "https://gofile.io/d/" + content.code + "#imu-id=" + item.extra.id;
							links.push({
								url,
								is_current
							});

							if (is_current)
								newobj.url = url;
						}

						if (!newobj.url) {
							console_error("Unable to get URL from", chosenitem, items);
							return cb(null);
						}

						newobj.album_info = {
							type: "links",
							links: links
						};

						cb(newobj);
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if (host_domain_nowww === "gofile.io" && options.element) {
			// thanks to anonymous for reporting:
			if ((options.element.tagName === "A" && options.element.classList.contains("contentLink")) ||
				(options.element.tagName === "IMG" || options.element.tagName === "VIDEO") ||
				(options.element.tagName === "DIV" && options.element.classList.contains("plyr__poster"))) {
				let contentid_container = common_functions["get_parent_el_matching"](options.element, x => x.hasAttribute("data-contentid"));
				if (contentid_container) {
					return {
						url: options.host_url.replace(/\/*(?:[?#].*)?$/, "#imu-id=" + contentid_container.getAttribute("data-contentid")),
						is_pagelink: true
					};
				}
			}
		}

		if (domain === "images.bubbleup.com") {
			// thanks to anonymous for reporting:
			// https://images.bubbleup.com/width1920/quality35/kelseaballerini/1-default/2-kelsea-ballerini/gallery-media/rolling-up-the-welcome-mat.00-01-15-02.still138-b-1-2-6810-1690930847.jpg
			//   https://images.bubbleup.com/kelseaballerini/1-default/2-kelsea-ballerini/gallery-media/rolling-up-the-welcome-mat.00-01-15-02.still138-b-1-2-6810-1690930847.jpg
			return src.replace(/(:\/\/[^/]+\/+)(?:width|quality)[0-9]+\/+/, "$1");
		}

		if (domain_nowww === "lemmy.world" ||
			// thanks to anonymous for reporting:
			domain_nowww === "lemmynsfw.com" ||
			// https://sopuli.xyz/pictrs/image/9250571e-5e5c-4324-bb3f-ce2d5edc4624.webp?format=webp&thumbnail=256
			//   https://sopuli.xyz/pictrs/image/9250571e-5e5c-4324-bb3f-ce2d5edc4624.webp
			domain_nowww === "sopuli.xyz" ||
			// https://lemmy.ml/pictrs/image/de0d44c4-f082-45f2-b0a3-111a985be9cd.jpeg?format=webp&thumbnail=256
			//   https://lemmy.ml/pictrs/image/de0d44c4-f082-45f2-b0a3-111a985be9cd.jpeg
			domain_nowww === "lemmy.ml") {
			// https://lemmy.world/pictrs/image/54d5e64c-05e2-4c09-913e-b5fb66f58f6a.webp?format=webp&thumbnail=256
			//   https://lemmy.world/pictrs/image/54d5e64c-05e2-4c09-913e-b5fb66f58f6a.webp
			if (/\/pictrs\/+image\/+[-0-9a-f]{10,}\./.test(src)) {
				return {
					url: remove_queries(src, ["thumbnail"]).replace(/([?&])format=webp/, "$1").replace(/[?&]$/, ""),
					head_wrong_contenttype: true,
					head_wrong_contentlength: true
				};
			}
		}

		if (domain_nowww === "cache.pressmailing.net") {
			// thanks to anonymous for reporting:
			// https://cache.pressmailing.net/thumbnail/story_hires/edb1e82a-d985-461a-ba0c-e6f2261bc3b9/image.jpg
			//   https://cache.pressmailing.net/content/edb1e82a-d985-461a-ba0c-e6f2261bc3b9/image.jpg
			newsrc = src.replace(/\/thumbnail\/+[^/]+\/+([-0-9a-f]{10,}\/+)/, "/content/$1");
			if (newsrc !== src) {
				return {
					url: newsrc,
					can_head: false
				};
			}
		}

		if (amazon_container === "breakdownservices") {
			// thanks to anonymous for reporting:
			// https://breakdownservices.s3.amazonaws.com/media/photos/20225/1933769/small/BC728FF1-1B7E-41B0-A80AE5B0734A1AC4.jpg
			//   https://breakdownservices.s3.amazonaws.com/media/photos/20225/1933769/BC728FF1-1B7E-41B0-A80AE5B0734A1AC4.jpg
			//   https://breakdownservices.s3.amazonaws.com/media/photos/20225/1933769/print/BC728FF1-1B7E-41B0-A80AE5B0734A1AC4.jpg
			return {
				url: src.replace(/(\/media\/+photos\/+[0-9]+\/+[0-9]+\/+)(?:small\/+)?([-0-9A-F]{10,}\.)/, "$1print/$2"),
				head_wrong_contenttype: true
			};
		}

		if (domain === "cdn.youpic.com") {
			// thanks to anonymous for reporting:
			// https://cdn.youpic.com/large/2630293_cof61mnhhhpuce4n60ctt7e1ts_317626.jpg
			//   https://cdn.youpic.com/link/2630293_cof61mnhhhpuce4n60ctt7e1ts_317626.jpg
			//   https://cdn.youpic.com/full/2630293_cof61mnhhhpuce4n60ctt7e1ts_317626.jpg -- 2300x2875
			return {
				url: src.replace(/(:\/\/[^/]+\/+)(?:large|huge|link)\/+/, "$1full/"),
				head_wrong_contenttype: true
			};
		}

		if (domain_nowww === "youpic.com") {
			// thanks to anonymous for reporting:
			// https://youpic.com/y/large/b41408c4767660fa660ccc8d9e31a2f40799a7d3ffff0500000000003d3d3d00
			//   https://youpic.com/y/full/b41408c4767660fa660ccc8d9e31a2f40799a7d3ffff0500000000003d3d3d00
			// other:
			// https://youpic.com/i/f563e1ad3af1bb5717f1876d2509a5f06eab1b91feff01000000000050505000000271 -- 1785x2500
			return src.replace(/\/y\/+(?:large|huge|link)\/+/, "/y/full/");
		}

		if (domain === "edge.99images.com") {
			// thanks to anonymous for reporting:
			// https://edge.99images.com/photos/celebrities/lahari-shari/md/lahari-shari-hot-hd-photos-wallpapers-for-mobile-1080p-cajk.jpg
			//   https://edge.99images.com/photos/celebrities/lahari-shari/lahari-shari-hot-hd-photos-wallpapers-for-mobile-1080p-cajk.jpg
			return src.replace(/\/md\/+([^/]+)(?:[?#].*)?$/, "/$1");
		}

		if (domain === "akamai.sscdn.co") {
			// thanks to anonymous for reporting:
			// https://akamai.sscdn.co/uploadfile/letras/fotos/7/1/e/0/71e05beee49302b0017d051878a6d163-tb6.jpg
			//   https://akamai.sscdn.co/uploadfile/letras/fotos/7/1/e/0/71e05beee49302b0017d051878a6d163.jpg
			return src.replace(/(\/uploadfile\/+letras\/+fotos\/.*)-tb[0-9]+\./, "$1.");
		}

		if (domain_nowww === "virtual-history.com") {
			// thanks to anonymous for reporting:
			// https://www.virtual-history.com/movie/card/16/thumb/genia_nikolaieva_014.jpg
			//   https://www.virtual-history.com/movie/card/16/large/genia_nikolaieva_014.jpg
			return src.replace(/(\/movie\/+card\/+[0-9]+\/+)thumb\/+([^/]+)(?:[?#].*)?$/, "$1large/$2");
		}

		if (domain_nowww === "kick.com") {
			let query_kick_video_api = function(vidid, cb) {
				let cache_key = "kick_video:" + vidid;
				api_query(cache_key, {
					url: "https://kick.com/api/v1/video/" + vidid,
					imu_mode: "xhr",
					json: true
				}, cb, function(done, resp, cache_key) {
					if (!resp)
						return done(null, false);

					let obj:BigImageInfoSObject = {
						url: resp.source,
						video: "hls",
						extra: {
							created_date: new Date(resp.livestream.start_time).getTime(),
							page: "https://kick.com/video/" + vidid,
							caption: resp.livestream.session_title
						}
					};

					return done(obj, 6*60*60);
				});
			};

			// thanks to anonymous for reporting:
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+video\/+([-0-9a-f]{10,})(?:[?#].*)?$/,
				run: function(cb, match) {
					query_kick_video_api(match[1], cb);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "img.thecollector.io") {
			// https://img.thecollector.io/f/122649/2000x1500/0fae5dbef2/71799.png/m/fit-in/400x400/filters:fill(ffffff),quality(50)
			//   https://img.thecollector.io/f/122649/2000x1500/0fae5dbef2/71799.png
			return src.replace(/(\/f\/+[0-9]+\/+.*?\.[a-z]+)\/+m\/.*/, "$1");
		}

		if (domain === "cdn.verk.net") {
			// thanks to anonymous for reporting:
			// https://cdn.verk.net/kuvastin/w:816/h:510/rt:fit/q:80/sh:0.5/plain/images/99/2_898681-1920x1080.jpeg
			//   https://cdn.verk.net/kuvastin/plain/images/99/2_898681-1920x1080.jpeg
			return src.replace(/\/(?:[whq]|rt|sh):[^/]+\/+(plain\/+images\/)/, "/$1");
		}

		if (domain === "image-cdn.spatialest.com") {
			// thanks to anonymous for reporting:
			// https://property.spatialest.com/nc/pitt#/
			// https://image-cdn.spatialest.com/image/nc-pitt-images/sml/photos/.../....jpg
			//   https://image-cdn.spatialest.com/image/nc-pitt-images/lrg/photos/.../....jpg
			return src.replace(/(\/image\/+[^/]+\/+)(?:sml|med)\/+/, "$1lrg/");
		}

		if (domain === "api.spatialest.com") {
			// thanks to anonymous for reporting:
			// https://api.spatialest.com/v1/nc/pitt/images-api?id=...&type=photo&size=med
			//   https://api.spatialest.com/v1/nc/pitt/images-api?size=lrg&id=...&type=photo
			if (/\/images-api\?/.test(src)) {
				return keep_queries(src, ["size", "id", "type"], {overwrite: {
					"size": "lrg"
				}});
			}
		}

		if (domain === "images.comico.io") {
			// thanks to uwuceo on github: https://github.com/qsniyg/maxurl/issues/1250
			// https://images.comico.io/content/en/.../.../.../....jpg/dims/crop/x2000+0+0/optimize?Policy=...&Signature=...&Key-Pair-Id=...
			return src.replace(/\/dims\/+[^?#]*([?#].*)?$/, "$1");
		}

		if (domain === "photos.eruce.com") {
			// thanks to anonymous for reporting:
			// https://photos.eruce.com/thumbs/1cd/295/d35/295/ec5/d35/6a3d0d460bb36567d2aab9d37391834a_500x500.webp
			//   https://photos.eruce.com/1cd/295/d35/295/ec5/d35/6a3d0d460bb36567d2aab9d37391834a.jpg
			return src
				.replace(/\/thumbs\/+(.*?)_[0-9]+x[0-9]+(\.jpg)(?:[?#].*)?$/, "/$1$2")
				.replace(/\.webp(?:[?#].*)?$/, ".jpg");
		}

		if (domain === "img.rgstatic.com") {
			// thanks to anonymous for reporting:
			// https://img.rgstatic.com/content/movie/48e374b5-08ed-49bd-a920-71fd74a71f85/backdrop-1920.jpg
			//   https://img.rgstatic.com/content/movie/48e374b5-08ed-49bd-a920-71fd74a71f85/backdrop-original.jpg -- 2000x1125
			// https://img.rgstatic.com/content/movie/fe1688d1-3d8f-493f-8ec4-8b5d28fe6e14/poster-780.jpg
			//   https://img.rgstatic.com/content/movie/fe1688d1-3d8f-493f-8ec4-8b5d28fe6e14/poster-original.jpg
			return src.replace(/(\/content\/+[^/]+\/+[-0-9a-f]{10,}\/+[^/?#.]+-)[0-9]+\./, "$1original.");
		}

		if (domain === "an.arbum.art") {
			// thanks to Froktime on github: https://github.com/qsniyg/maxurl/issues/1267
			// https://an.arbum.art/i/[guid].png?preset=ArtworkPreview&size=200&ratio=1
			//   https://an.arbum.art/i/[guid].png
			return {
				url: src.replace(/\/[ip]\/+([-0-9a-f]{10,}\.[a-z]+)(?:[?#].*)?$/, "/i/$1"),
				headers: {
					Referer: "https://arbum.art"
				},
				can_head: false // 500
			};
		}

		if (domain_nowww === "pastvu.com") {
			// thanks to anonymous for reporting:
			// https://pastvu.com/_p/x/e/b/9/eb99h08uv9jmffmfad.jpg
			//   https://pastvu.com/_p/a/e/b/9/eb99h08uv9jmffmfad.jpg -- 2303x1565
			// a, d, h, m, q, s, x
			return src.replace(/(:\/\/[^/]+\/+_p\/+)[a-z]\/+/, "$1a/");
		}

		if (domain === "img.fotokonkurs.ru") {
			// thanks to anonymous for reporting:
			// https://img.fotokonkurs.ru/cache/photo_500w/photos/2024/01/9/b316d0304772beb6c559e96dff67669d/5033161e769b698ef545350f4f9c9097.jpeg
			//   https://img.fotokonkurs.ru/cache/original/photos/2024/01/9/b316d0304772beb6c559e96dff67669d/5033161e769b698ef545350f4f9c9097.jpeg
			return src.replace(/(\/cache\/+)[^/]+\/+(photos\/+)/, "$1original/$2");
		}

		if (domain === "img.championat.com") {
			// thanks to anonymous for reporting:
			// https://img.championat.com/s/735x490/news/big/b/b/anna-pogorilaja_14602722361049245269.jpg
			//   https://img.championat.com/news/big/b/b/anna-pogorilaja_14602722361049245269.jpg
			// https://img.championat.com/c/1200x900/news/big/y/r/anna-pogorilaja-samaja-gorjachaja-figuristka-rossii_16035392891022242366.jpg
			//   https://img.championat.com/news/big/y/r/anna-pogorilaja-samaja-gorjachaja-figuristka-rossii_16035392891022242366.jpg
			return src.replace(/\/[sc]\/+[0-9]+x[0-9]+\/+/, "/");
		}

		if (domain === "img.dni.ru") {
			// thanks to anonymous for reporting:
			// https://img.dni.ru/binaries/v3_main/528013.jpg -- 685x400
			//   https://img.dni.ru/binaries/social/528013.jpg -- 1370x799
			// other:
			// https://img.dni.ru/files/orig/n/d/9/nd9l5ri7t3w2buo.jpg
			return src.replace(/(\/binaries\/+)v3_main\//, "$1social/");
		}

		if (domain_nowww === "mylittlewallpaper.com") {
			// thanks to anonymous for reporting:
			// https://www.mylittlewallpaper.com/images/r2_657b378964b445.18663503.jpg
			//   https://www.mylittlewallpaper.com/images/o_657b378964b445.18663503.jpg
			return src.replace(/(\/images\/+)r[0-9]+_/, "$1o_");
		}

		if (domain_nowww === "sr.de") {
			// thanks to nimbuz on discord: https://github.com/qsniyg/maxurl/issues/942
			// https://www.sr.de/sr/home/nachrichten/politik_wirtschaft/lieferengpaesse_kosten_einzelhandel_saarland_100.html
			// https://www.sr.de/sr/254042504_ebike_fahrrad_100~_v-sr__169__900.jpg
			//   https://www.sr.de/sr/254042504_ebike_fahrrad_100~_v.jpg
			// https://www.sr.de/sr/442681900_wirth_afd_dpa_100~_v-sr__169__300.jpg
			//   https://www.sr.de/sr/442681900_wirth_afd_dpa_100~_v.jpg
			// https://www.sr.de/sr/baeckerei_heil_saarbruecken_foto_sebastian_knoebber_100~_v-sr__169__313.jpg
			//   https://www.sr.de/sr/baeckerei_heil_saarbruecken_foto_sebastian_knoebber_100~_v.jpg
			return {
				url: src.replace(/(\/sr\/+[^/]+100~_v)-sr__[^/.]+\./, "$1."),
				head_wrong_contentlength: true
			};
		}

		if (domain_nowww === "ndr.de") {
			// thanks to nimbuz on discord: https://github.com/qsniyg/maxurl/issues/947
			// https://www.ndr.de/nachrichten/hamburg/Weltpremiere-Frachtdrohne-absolviert-Erstflug-in-Hamburg,drohne718.html
			// https://www.ndr.de/nachrichten/hamburg/drohne714_v-contentklein.jpg
			//   https://www.ndr.de/nachrichten/hamburg/drohne714_v-contentgross.jpg
			//   https://www.ndr.de/nachrichten/hamburg/drohne714_v-contentxl.jpg
			//   https://www.ndr.de/nachrichten/hamburg/drohne714_v-fullhd.jpg
			return src.replace(/(_v-)content(?:klein|gross|xl)\./, "$1fullhd.");
		}

		if (domain_nowww === "cdn.mdr.de") {
			// thanks to nimbuz on discord: https://github.com/qsniyg/maxurl/issues/945
			// https://cdn.mdr.de/nachrichten/thueringen/mitte-thueringen/erfurt/feuerwehr-azmannsdorf-104-resimage_v-variantBig24x9_w-1024.jpg?version=22298
			//   https://cdn.mdr.de/nachrichten/thueringen/mitte-thueringen/erfurt/feuerwehr-azmannsdorf-104-resimage_v-variantBig1xN.jpg?version=22298
			// https://cdn.mdr.de/nachrichten/sachsen/flugzeug-abfertiger-102-resimage_v-variantSmall16x9_w-256.jpg
			//   https://cdn.mdr.de/nachrichten/sachsen/flugzeug-abfertiger-102-resimage_v-variantBig1xN.jpg
			return src.replace(/(_v-variant)[^/.]+\./, "$1Big1xN.");
		}

		if (amazon_container === "acmi-website-media-prod") {
			// thanks to anonymous for reporting:
			// https://acmi-website-media-prod.s3.ap-southeast-2.amazonaws.com/media/images/181205-0452-ACMI_Cleverman.2e16d0ba.fill-846x476.jpg
			//   https://acmi-website-media-prod.s3.ap-southeast-2.amazonaws.com/media/original_images/181205-0452-ACMI_Cleverman.jpg
			// https://acmi-website-media-prod.s3.ap-southeast-2.amazonaws.com/media/images/AI_and_Art_talk_-_web.width-2880.jpg
			//   https://acmi-website-media-prod.s3.ap-southeast-2.amazonaws.com/media/original_images/AI_and_Art_talk_-_web.jpg
			// https://acmi-website-media-prod.s3.ap-southeast-2.amazonaws.com/media/images/Shannon_McGrath_BKK_ACMI_smg_0174.max-525x525.jpg
			//   https://acmi-website-media-prod.s3.ap-southeast-2.amazonaws.com/media/original_images/Shannon_McGrath_BKK_ACMI_smg_0174.jpg
			// doesn't work for all:
			// https://acmi-website-media-prod.s3.ap-southeast-2.amazonaws.com/media/images/Peacock_magic_lantern_slide_projec.2e16d0ba.fill-846x476.jpg
			//   https://acmi-website-media-prod.s3.ap-southeast-2.amazonaws.com/media/original_images/Peacock_magic_lantern_slide_projec.jpg -- 403
			// https://acmi-website-media-prod.s3.ap-southeast-2.amazonaws.com/media/images/grad_hp_-_Evolver_by_Marshmallow_Laser_Feast_Wo.original.jpg
			//   https://acmi-website-media-prod.s3.ap-southeast-2.amazonaws.com/media/original_images/grad_hp_-_Evolver_by_Marshmallow_Laser_Feast_Wo.jpg -- 403
			// other:
			// https://acmi-website-media-prod.s3.ap-southeast-2.amazonaws.com/media/images/Film_over_lightbox_-_hero_image.original.jpg -- 2160x1023
			//   https://acmi-website-media-prod.s3.ap-southeast-2.amazonaws.com/media/original_images/Film_over_lightbox_-_hero_image.jpg -- 2160x1023, more saturated
			return src.replace(/(\/media\/+)images\/+([^/]+?)(?:\.(?:2e16d0ba|(?:fill|max)-[0-9]+x[0-9]+|width-[0-9]+))+\./, "$1original_images/$2.");
		}

		if (host_domain_nosub === "finalfantasyxiv.com" && options.element) {
			// thanks to anonymous for reporting:
			// https://na.finalfantasyxiv.com/dawntrail/media/#artworks
			if (options.element.tagName === "IMG" && options.element.hasAttribute("data-original") &&
				options.element.parentElement && options.element.parentElement.tagName === "A" && options.element.parentElement.classList.contains("js__media")) {
				return options.element.parentElement.href;
			}
		}

		if (domain === "sites.wrk.ru" ||
			// http://www.balancer.ru/cache/sites/w/w/www.ljplus.ru/img4/v/l/vladlend/128x128(up,crop)/konkurentiA.jpg
			//   https://www.ljplus.ru/img4/v/l/vladlend/konkurentiA.jpg
			domain_nowww === "balancer.ru") {
			// https://sites.wrk.ru/cache/sites/w/w/www.ljplus.ru/img/f/i/first_nah/128x128(up,crop)/debaty.JPG
			//   https://www.ljplus.ru/img/f/i/first_nah/debaty.JPG
			// https://sites.wrk.ru/cache/sites/w/w/www.ljplus.ru/img4/i/_/i_korotchenko/128x128-crop/RLS_1_.jpg
			//   https://www.ljplus.ru/img4/i/_/i_korotchenko/RLS_1_.jpg
			// https://sites.wrk.ru/cache/sites/r/u/russianplanes.net/images/to36000/640x/035589.jpg
			//   https://russianplanes.net/images/to36000/035589.jpg
			// http://balancer.ru/cache/sites/l/j/ljplus.ru/img/m/u/muxel/468x468/5V61.jpg
			//   https://ljplus.ru/img/m/u/muxel/5V61.jpg
			return src.replace(/^[a-z]+:\/\/[^/]+\/+cache\/+sites\/+.\/+.\/+([^/]+\.[^/]+\/.*?)\/[0-9]+x[0-9]*(?:\([^/]+\)|-[a-z]+)?\/+([^/]+)(?:[?#].*)?$/, "http://$1/$2");
		}

		if (domain_nowww === "bilibili.com") {
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+video\/+([A-Za-z0-9]+)\/*(?:[?#].*)?$/,
				query_for_id: "https://www.bilibili.com/video/${id}/",
				process: function(done, resp, cache_key) {
					let match = resp.responseText.match(/__playinfo__\s*=\s*({.*?})<\/script/);
					if (!match) {
						console_error(cache_key, "Unable to find playinfo match for", resp);
						return done(null, false);
					}

					let json = JSON_parse(match[1]);
					let dashsource = json.data.dash;

					let dashdata = {mimes: {}};

					let add_source = function(src) {
						let formatdash = {
							url: src.baseUrl,
							width: src.width,
							height: src.height,
							bandwidth: src.bandwidth,
							id: src.id,
							init_range: src.SegmentBase.Initialization,
							index_range: src.SegmentBase.indexRange,
							mime: src.mime_type,
							codecs: src.codecs,
							start_with_sap: src.startWithSap,
							frame_rate: src.frameRate,
							sar: src.sar
						};

						if (!(src.mime_type in dashdata.mimes)) {
							dashdata.mimes[src.mime_type] = [];
						}

						dashdata.mimes[src.mime_type].push(formatdash);
					};

					for (let src of dashsource.video) {
						add_source(src);
					}

					for (let src of dashsource.audio) {
						add_source(src);
					}

					dashdata.duration = dashsource.duration;
					dashdata.min_buffer_time = dashsource.minBufferTime;

					let dash = common_functions["create_dash_stream"](dashdata);
					let dashurl = "data:application/dash+xml," + encodeURIComponent(dash);

					return done({
						url: dashurl,
						video: "dash"
					}, 60*60);
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain_nowww === "parismatch.com") {
			// thanks to anonymous for reporting:
			// https://www.parismatch.com/lmnr/f/webp/r/960,640,FFFFFF,forcex,center-middle/img/var/pm/public/styles/paysage/public/media/image/2022/03/02/08/Margot-Robbie-Je-fais-partie-d-une-generation-de-femmes-qui-veulent-tout-avoir-dans-la-vie.jpg
			//   https://www.parismatch.com/lmnr/img/var/pm/public/styles/paysage/public/media/image/2022/03/02/08/Margot-Robbie-Je-fais-partie-d-une-generation-de-femmes-qui-veulent-tout-avoir-dans-la-vie.jpg
			return src.replace(/(\/lmnr\/+)(?:[fr]\/+[^/]+\/+)+(img\/+)/, "$1$2");
		}

		if (digitalocean_container === "ostagram1") {
			// thanks to happysurf on github for reporting: https://github.com/qsniyg/maxurl/issues/1272
			// https://ostagram1.ams3.cdn.digitaloceanspaces.com/uploads/content/image/2922200/thumb_img_aaa0f64068.jpg
			//   https://ostagram1.ams3.cdn.digitaloceanspaces.com/uploads/content/image/2922200/img_aaa0f64068.jpg
			// https://ostagram1.ams3.cdn.digitaloceanspaces.com/uploads/pimage/imageurl/5624305/thumb_img5416824_4dfad540c009da9e.jpg
			//   https://ostagram1.ams3.cdn.digitaloceanspaces.com/uploads/pimage/imageurl/5624305/thumb_img5416824_4dfad540c009da9e.jpg
			// https://ostagram1.ams3.cdn.digitaloceanspaces.com/uploads/client/avatar/162973/avatar100_img.jpg
			//   https://ostagram1.ams3.cdn.digitaloceanspaces.com/uploads/client/avatar/162973/img.jpg
			return src
				.replace(/(\/image\/+[0-9]+\/+)thumb_/, "$1")
				.replace(/(\/client\/+avatar\/+[0-9]+\/+)avatar[0-9]+_/, "$1");
		}

		if (domain_nowww === "ostagram.me") {
			// thanks to happysurf on github for reporting: https://github.com/qsniyg/maxurl/issues/1272
			// https://www.ostagram.me/assets/lightbox/next-15b869b02c6fbaa8c6c26445a2dd2d9bad80fd27b1409f8179e5dd89dc89d90a.png
			if (/\/assets\/+lightbox\/+[^/]+\.png(?:[?#].*)?$/.test(src))
				return {
					url: src,
					bad: "mask"
				};
		}

		if (domain === "cdn-icons-png.flaticon.com") {
			// thanks to anonymous for reporting:
			// https://cdn-icons-png.flaticon.com/128/12766/12766209.png?fd=1 -- forces download
			newsrc = remove_queries(src, ["fd"]);
			if (newsrc !== src)
				return newsrc;

			// https://cdn-icons-png.flaticon.com/128/12766/12766209.png
			//   https://cdn-icons-png.flaticon.com/512/12766/12766209.png
			return src.replace(/\/(?:32|64|128|256)\/+([0-9]+\/+[0-9]+\.)/, "/512/$1");
		}

		if (domain === "gaffa.blob.core.windows.net") {
			// thanks to anonymous for reporting:
			// https://gaffa.blob.core.windows.net/gaffa-media/media/62a39bf4-be8a-4272-94e9-319d8cd7555b/NytgaffaStativDkCopy1-SMALL.webp
			//   https://gaffa.blob.core.windows.net/gaffa-media/media/62a39bf4-be8a-4272-94e9-319d8cd7555b/NytgaffaStativDkCopy1-default.webp -- 1340x1832
			return src.replace(/(\/gaffa-media\/+media\/+[-0-9a-f]{10,}\/+[^/]+-)(?:SMALL|MEDIUM|LARGE)\./, "$1default.");
		}

		if (domain === "ccdn.lezhin.com") {
			// thanks to Froktime on github: https://github.com/qsniyg/maxurl/issues/1273
			// https://ccdn.lezhin.com/v2/inventory_items/4514079591694336/media/upperBannerMobile.webp?updated=1675058642000&width=688
			//   https://ccdn.lezhin.com/v2/inventory_items/4514079591694336/media/upperBannerMobile
			// https://ccdn.lezhin.com/v2/comics/6626593178189824/images/tall.webp?updated=1678868634586&width=354
			//   https://ccdn.lezhin.com/v2/comics/6626593178189824/images/tall
			// https://ccdn.lezhin.com/v2/comics/6626593178189824/images/wide.webp?updated=1678868634586&width=800
			//   https://ccdn.lezhin.com/v2/comics/6626593178189824/images/wide
			return src.replace(/(\/[0-9]+\/+(?:media|images)\/+[^/.?#]+)(?:\.[a-zA-Z0-9]+)?(?:[?#].*)?$/, "$1");
		}

		if (domain === "image.balcony.studio") {
			// thanks to Froktime on github: https://github.com/qsniyg/maxurl/issues/1273
			// https://image.balcony.studio/LEZHIN_ES/banner/2024/1706679627760.webp
			//   https://image.balcony.studio/LEZHIN_ES/banner/2024/1706679627760.png
			// https://image.balcony.studio/es/co_thumbnail/daf_1000741/1706673426120.webp
			//   https://image.balcony.studio/es/co_thumbnail/daf_1000741/1706673426120.jpeg
			// https://image.balcony.studio/es/co_thumbnail/LZ_3000041/1631786095698.webp
			//   https://image.balcony.studio/es/co_thumbnail/LZ_3000041/1631786095698.jpg
			// doesn't work for all:
			// https://image.balcony.studio/es/co_thumbnail/daf_1000741/1706673425903.webp
			newsrc = src.replace(/(\/[0-9]+\.)webp(?:[?#].*)?$/, "$1jpg");
			if (newsrc !== src)
				return add_full_extensions(newsrc, ["png", "jpg", "jpeg"], true);
		}

		if (domain === "img.lazcdn.com") {
			// thanks to anonymous for reporting:
			// https://img.lazcdn.com/g/p/dcc3581291f8d221e56b9c8e361d7751.jpg_720x720q80.jpg
			//   https://img.lazcdn.com/g/p/dcc3581291f8d221e56b9c8e361d7751.jpg
			// https://img.lazcdn.com/g/p/f2c625a82e687339fc5247be1e87c95d.jpg_720x720q80.jpg_.webp
			//   https://img.lazcdn.com/g/p/f2c625a82e687339fc5247be1e87c95d.jpg
			return src.replace(/(\/p\/+[^/]+?\.[^_?#/]+)_[^/.?#]*\.[^/.?#]+(?:[?#].*)?$/, "$1");
		}

		if (domain === "covers.audiobooks.com") {
			// thanks to anonymous for reporting:
			// https://covers.audiobooks.com/images/covers/large/9781549114830.jpg
			//   https://covers.audiobooks.com/images/covers/full/9781549114830.jpg
			// other:
			// https://covers.audiobooks.com/images/thumbs/9788491298496.jpg
			return src.replace(/(\/images\/+covers\/+)large\/+/, "$1full/");
		}

		if (domain === "smedia.alkemics.com") {
			// thanks to nimbuz on discord for reporting: https://github.com/qsniyg/maxurl/issues/938
			// https://smedia.alkemics.com/product/picture/exportable/833a487d-83a6-4082-8b26-d445448a36c8/512x512.jpg
			//   https://smedia.alkemics.com/product/picture/833a487d-83a6-4082-8b26-d445448a36c8.png
			newsrc = src.replace(/(\/product\/+picture\/+)exportable\/+([-0-9a-f]{10,})\/+[0-9]+x[0-9]+\./, "$1$2.");
			if (newsrc !== src)
				return add_extensions(newsrc);
		}

		if (domain_nowww === "rbb24.de") {
			// thanks to nimbuz on discord: https://github.com/qsniyg/maxurl/issues/941
			// https://www.rbb24.de/content/dam/rbb/rbb/rbb24/2021/2021_10/dpa-account/108452692.jpg.jpg/size=708x398.jpg
			//   https://www.rbb24.de/content/dam/rbb/rbb/rbb24/2021/2021_10/dpa-account/108452692.jpg
			return src.replace(/(\/content\/+dam\/+.*?)\.[a-z]+\/+size=[^/]+(?:[?#].*)?$/, "$1");
		}

		if (domain === "d38fgd7fmrcuct.cloudfront.net" ||
			// https://media.zaiko.io/bw_200/1_43qec3h34l2mj66p6i1fh
			//   https://media.zaiko.io/1_43qec3h34l2mj66p6i1fh
			domain === "media.zaiko.io") {
			// thanks to nimbuz on discord: https://github.com/qsniyg/maxurl/issues/940
			// https://d38fgd7fmrcuct.cloudfront.net/bw_200/1_3xj7j5i5kaauoas0el6ye
			//   https://d38fgd7fmrcuct.cloudfront.net/1_3xj7j5i5kaauoas0el6ye
			// https://d38fgd7fmrcuct.cloudfront.net/bh_200/1_3xj7j5i5kaauoas0el6ye
			//   https://d38fgd7fmrcuct.cloudfront.net/1_3xj7j5i5kaauoas0el6ye
			return src.replace(/\/b[wh]_[0-9]+\/+([^/]+)(?:[?#].*)?$/, "/$1");
		}

		if (domain_nowww === "wallpapers.com") {
			// thanks to anonymous for reporting:
			// https://wallpapers.com/images/thumbnail/aesthetic-simple-bathroom-interior-design-kbvt8bek9oihslv6.webp
			//   https://wallpapers.com/images/high/aesthetic-simple-bathroom-interior-design-kbvt8bek9oihslv6.webp
			//   https://wallpapers.com/images/hd/aesthetic-simple-bathroom-interior-design-kbvt8bek9oihslv6.webp -- 1298x1920
			//   https://wallpapers.com/images/hd4/aesthetic-simple-bathroom-interior-design-kbvt8bek9oihslv6.jpg -- 3309x4896
			//   https://wallpapers.com/images/file/aesthetic-simple-bathroom-interior-design-kbvt8bek9oihslv6.jpg -- 3309x4896
			return src
				.replace(/(\/images\/+file\/+[^/]+)\.webp(?:[?#].*)?$/, "$1.jpg")
				.replace(/(\/images\/+)(?:thumb(?:nail)?|high|hd4?)\/+/, "$1file/");
		}

		if (domain === "images.kolonmall.com") {
			// thanks to f2005 on discord:
			// https://images.kolonmall.com/Prod_Img/CR/2024/LM25/RCBTX24153BRD_LM25.jpg
			//   https://images.kolonmall.com/Prod_Img/CR/2024/LZ25/RCBTX24153BRD_LZ25.jpg -- 1500x2250
			// https://images.kolonmall.com/Prod_Img/CO/2023/LS1/ZIJAW23001GYD_LS1.jpg -- 1500x2250
			//   https://images.kolonmall.com/Prod_Img/CO/2023/LZ1/ZIJAW23001GYD_LZ1.jpg -- 1500x2250
			// https://images.kolonmall.com/Prod_Img/LC/2024/LM5/LXEAM24860XXX_LM5.jpg
			//   https://images.kolonmall.com/Prod_Img/LC/2024/LZ5/LXEAM24860XXX_LZ5.jpg
			return src.replace(/(\/Prod_Img\/+[^/]+\/+[0-9]{4}\/+L)[SML]([0-9]+\/+[^/]+_L)[SML]([0-9]+\.)/, "$1Z$2Z$3");
		}

		if (domain_nowww === "lookandlearn.com") {
			// thanks to anonymous for reporting:
			// https://www.lookandlearn.com/history-images/thumbnail/YSA/YSA004/YSA004505.jpg
			//   https://www.lookandlearn.com/history-images/preview/YSA/YSA004/YSA004505.jpg
			return src.replace(/(\/history-images\/+)thumbnail\/+/, "$1preview/");
		}

		if (domain === "storage.pubble.nl") {
			// thanks to anonymous for reporting:
			// https://storage.pubble.nl/350eaab2/content/2023/1/f4b4e7f3-af5e-4500-948e-69b3920589b4_thumb1920.webp
			//   https://storage.pubble.nl/350eaab2/content/2023/1/f4b4e7f3-af5e-4500-948e-69b3920589b4.jpg
			newsrc = src.replace(/(\/content\/.*)\.webp$/, "$1.jpg");
			if (newsrc !== src)
				return newsrc;

			// https://storage.pubble.nl/350eaab2/content/2023/1/f4b4e7f3-af5e-4500-948e-69b3920589b4_thumb1920.jpg
			//   https://storage.pubble.nl/350eaab2/content/2023/1/f4b4e7f3-af5e-4500-948e-69b3920589b4.jpg
			return src.replace(/(\/content\/.*)_thumb[0-9]+\./, "$1.");
		}

		if (domain_nowww === "univision.com") {
			// thanks to roi:
			// https://www.univision.com/proxy/api/cached/picture?href=https%3A%2F%2Fst1.uvnimg.com%2F81%2F89%2F872474e84c81b91f0f0db777ae0d%2Fed2afbfc7f624c91badc0037c0d06e81&width=1524&height=857&ratio_width=300&ratio_height=300&resize_option=Fill%20Area&format=webp
			//   https://st1.uvnimg.com/81/89/872474e84c81b91f0f0db777ae0d/ed2afbfc7f624c91badc0037c0d06e81
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+proxy\/+api\/+cached\/+picture\?(?:.*&)?href=([^&]+)(?:[&#].*)?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nowww === "oblgazeta.ru") {
			// thanks to roi:
			// https://oblgazeta.ru/wp-content/uploads/2023/11/xPAV_4423-768x512.jpg.pagespeed.ic.cWi7guEQO7.webp
			//   https://oblgazeta.ru/wp-content/uploads/2023/11/PAV_4423.jpg
			newsrc = src.replace(/\/x([^/?#]+)\.pagespeed\.ic\.[-_0-9a-zA-Z]+\.webp$/, "/$1");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain_nowww === "stereoboard.com") {
			// thanks to anonymous for reporting:
			// https://www.stereoboard.com/images/stories/2013/images/2021%20A-Z/A/600x427xariana_grande_js_160224.jpg.pagespeed.ic.M_OTqmoCia.webp
			//   https://www.stereoboard.com/images/stories/2013/images/2021%20A-Z/A/ariana_grande_js_160224.jpg
			return src.replace(/\/[0-9]+x[0-9]+x([^/?#]+)\.pagespeed\.ic\.[-_0-9a-zA-Z]+\.webp$/, "/$1");
		}

		if (domain === "eu.gogo.mn") {
			// thanks to roi:
			// https://eu.gogo.mn/newsn/thumbnail/1000/images/c/2022/01/289353-09012022-1641728248-1213177364-1.jpg
			//   https://eu.gogo.mn/newsn/images/c/2022/01/289353-09012022-1641728248-1213177364-1.jpg
			return src.replace(/\/thumbnail\/+[0-9]+\/+images\/+/, "/images/");
		}

		if (domain === "static.legalcdn.org") {
			// thanks to roi:
			// https://static.legalcdn.org/lbimg/post-card/51/24/5cbd5703ca2c7_1555912451.png
			//   https://static.legalcdn.org/51/24/5cbd5703ca2c7_1555912451.png
			return src.replace(/\/lbimg\/+post-[^/]+\/+/, "/");
		}

		if (domain === "cdn.saam.media") {
			// thanks to roi:
			// https://cdn.saam.media/w7sDMY6bJ1Pz8zt-QJKBaK6y1U4/640/0/center/cover/jpg/https%3A%2F%2Fd3ec1vt3scx7rr.cloudfront.net%2Ffiles%2Fartwork%2Fimages%2FSAAM-1964.1.15_2.jpg
			//   https://d3ec1vt3scx7rr.cloudfront.net/files/artwork/images/SAAM-1964.1.15_2.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+[^/]+\/+[0-9]+\/+[0-9]+\/+[^/]+\/+[^/]+\/+[^/]+\/+(https?[%:].*)$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "img.kyodonews.net") {
			// thanks to roi:
			// https://img.kyodonews.net/english/public/images/posts/3cafd72ebcfe7417f57192ed1a1ee835/photo_s.jpg
			//   https://img.kyodonews.net/english/public/images/posts/3cafd72ebcfe7417f57192ed1a1ee835/photo_m.jpg
			//   https://img.kyodonews.net/english/public/images/posts/3cafd72ebcfe7417f57192ed1a1ee835/photo_l.jpg
			//   https://img.kyodonews.net/english/public/images/posts/3cafd72ebcfe7417f57192ed1a1ee835/photo.jpg
			return src.replace(/(\/images\/+[^/]+\/+[0-9a-f]{10,}\/+photo)_[sml]\./, "$1.");
		}

		if (domain_nowww === "tulup.ru") {
			// thanks to roi:
			// https://tulup.ru/photo/media/galleries/2023-12-05.isu_grand_prix_final_2023/05_dec_arrival/normal/4P1A5971.JPG
			//   https://tulup.ru/photo/media/galleries/2023-12-05.isu_grand_prix_final_2023/05_dec_arrival/big/4P1A5971.JPG
			// doesn't work for all:
			// https://www.tulup.ru/photo/media/galleries/2017-01-28.universiade/3_feb_men_training/big/DSC04235.JPG -- 404
			return src.replace(/(\/photo\/+media\/+galleries\/+[^/]+\/+[^/]+\/+)normal\/+/, "$1big/");
		}

		if (domain_nowww === "caps-a-holic.com") {
			// thanks to nimbuz on discord for reporting:
			// https://caps-a-holic.com/c_image.php?max_height=1080&s=89274&a=1&x=451&y=176&l=0
			//   https://caps-a-holic.com/c_image.php?max_height=2160&s=89274&a=0&x=0&y=0&l=1
			// l = lossless
			// a = crop
			if (/\/c_image\.php\?/.test(src)) {
				newsrc = keep_queries(src, ["max_height", "s"]) + "&a=0&x=0&y=0&l=1";
				if (newsrc !== src)
					return newsrc;

				return newsrc.replace(/([?&]max_height=)[0-9]+/, "$12160");
			}
		}

		if (domain === "resource.lap.recochoku.jp") {
			// thanks to fireattack on discord for reporting:
			// https://recochoku.jp/artist/2000240013
			// https://resource.lap.recochoku.jp/rc-p1/front/common/b.png
			if (/\/front\/+common\/+b\.png(?:[?#].*)?$/.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}
		}

		if (domain === "static.thenounproject.com") {
			// thanks to anonymous for reporting:
			// https://static.thenounproject.com/avatars/10343109/resized/150/150/b4e846cf7be3d55e23902e8de6493622.png
			//   https://static.thenounproject.com/avatars/10343109/b4e846cf7be3d55e23902e8de6493622.png
			// https://static.thenounproject.com/png/5857500-84.png
			//   https://static.thenounproject.com/png/5857500-200.png
			//   https://static.thenounproject.com/attribution/5857500-600.png
			newsrc = src.replace(/\/png\/+([0-9]+)-200\./, "/attribution/$1-600.");
			if (newsrc !== src) {
				return {
					url: newsrc,
					problems: {watermark: true}
				};
			}

			return src
				.replace(/(\/png\/+[0-9]+-)84\./, "$1200.")
				.replace(/\/resized\/+[0-9]+\/+[0-9]+\/+/, "/");
		}

		if (domain === "cdn.cms.prod.nypr.digital") {
			// thanks to anonymous for reporting:
			// https://cdn.cms.prod.nypr.digital/images/KarazishiBotanRamen_Cu9ECX4.width-1000.jpg
			//   https://cdn.cms.prod.nypr.digital/original_images/KarazishiBotanRamen_Cu9ECX4.jpg
			// https://cdn.cms.prod.nypr.digital/images/MidtownLogoFinalRED.2e16d0ba.fill-634x368.jpg
			//   https://cdn.cms.prod.nypr.digital/original_images/MidtownLogoFinalRED.jpg
			// other:
			// https://cdn.cms.prod.nypr.digital/images/535186.2e16d0ba.fill-700x467.format-webp.webpquality-70.webp
			// https://cdn.cms.prod.nypr.digital/images/fort-jah-coin-hunting-front.2e16d0ba.fill-634x606.jpg
			// https://cdn.cms.prod.nypr.digital/images/a78be6a.2e16d0ba.fill-640x426.format-jpeg.jpegquality-80.jpg
			// redirects to different image:
			// https://cdn.cms.prod.nypr.digital/images/640x426.2e16d0ba.fill-450x300.jpg
			//   https://cdn.cms.prod.nypr.digital/original_images/640x426.jpg
			return src.replace(/\/images\/+([^/?#]+)(?:\.width-[0-9]+|\.2e16d0ba\.fill-[0-9]+x[0-9]+)(\.[^/.]+)(?:[?#].*)?$/, "/original_images/$1$2");
		}

		if (domain === "sns-webpic-qc.xhscdn.com") {
			// thanks to f2005 on discord:
			// https://sns-webpic-qc.xhscdn.com/202402221900/499bd03e0b4fe044851a62d276f82558/1040g00830vflhn67m02g5n611lp4htlo5mc6cso!nd_dft_wgth_webp_3
			return {
				url: src.replace(/:\/\/[^/]+(\.xhscdn.com\/+)[0-9]+\/+[0-9a-f]{10,}\/+([^/.?#!]+)(?:[?#!].*)?$/, "://sns-img-al$1$2"),
				headers: {
					Referer: ""
				}
			};
		}

		if (domain_nowww === "musescore.com" && string_indexof(src, "/static/")) {
			// thanks to anonymous for reporting:
			// https://musescore.com/static/musescore/scoredata/g/3465a8257739d30d3733d59be428888756e356fa/score_0.png@240x336?no-cache=1610714686&bgclr=ffffff&fmt=webp&qlt=80
			//   https://musescore.com/static/musescore/scoredata/g/3465a8257739d30d3733d59be428888756e356fa/score_0.png
			return src
				.replace(/@[0-9]+x[0-9]+$/, "")
				.replace(/\?.*/, "");
		}

		if (domain_nowww === "ticketfairy.com") {
			// thanks to anonymous for reporting:
			// https://www.ticketfairy.com/uploaded/thumbnails/db_file_img_8761_300xauto.jpg
			//   https://www.ticketfairy.com/uploaded/thumbnails/db_file_img_8761_600xauto.jpg
			//   https://www.ticketfairy.com/uploaded/thumbnails/db_file_img_8761_1024xauto.jpg
			return src.replace(/(\/uploaded\/+thumbnails\/+[^/]+)_(?:300|600)xauto\./, "$1_1024xauto.");
		}

		if (domain === "media.deichmann.com") {
			// thanks to anonymous for reporting:
			// https://media.deichmann.com/asset/deichmann/product-h6-list/p_mosaic_pl/--2278291_HL1.jpg
			//   https://media.deichmann.com/asset/deichmann/product-h6-thumbnail/p_mosaic_thumbnail/--2278291_H1.jpg
			//   https://media.deichmann.com/asset/deichmann/product-h6/p_mosaic_pd/--2278291_H1.jpg
			//   https://media.deichmann.com/asset/deichmann/product-h6/--2278291_H1.jpg
			return src.replace(/(\/product-h6)(?:-[a-z]+)?\/+(?:p_[^/]+\/+)?/, "$1/");
		}

		if (domain === "admin.itsnicethat.com") {
			// thanks to anonymous for reporting:
			// https://admin.itsnicethat.com/images/d49Mx9QwerDXpak3v_mI5Jb2KxQ=/250101/format-webp%7Cwidth-2880/pablo-delcan-prompt-brush-digital-itsnicethat-13.jpg
			//   https://media.itsnicethat.com/original_images/pablo-delcan-prompt-brush-digital-itsnicethat-13.jpg
			match = src.match(/\/images\/+[^/]+=\/+.*\/([^/?#]+)(?:[?#].*)?$/);
			if (match) {
				return "https://media.itsnicethat.com/original_images/" + match[1];
			}
		}

		if (domain === "i.abcnewsfe.com") {
			// thanks to anonymous for reporting:
			// https://i.abcnewsfe.com/a/05d9cf51-9e8f-4d60-8beb-4797a43e1338/los-angeles-fire-freeway-gty-jt-231118_1700338149821_hpMain_16x9.jpg?w=992
			//   https://i.abcnewsfe.com/a/05d9cf51-9e8f-4d60-8beb-4797a43e1338/los-angeles-fire-freeway-gty-jt-231118_1700338149821_hpMain.jpg
			// doesn't work for all:
			// https://i.abcnewsfe.com/a/2ef67605-50c6-4a88-a49b-f1729f6fcb8c/220904_tw_besser_hpMain_16x9.jpg
			return src
				.replace(/_16x9(\.[a-z]+)$/, "$1")
				.replace(/\?.*/, "");
		}

		if (domain_nosub === "pandora.com" && /^mediaserver-cont-/.test(domain) ||
			// https://content-images.p-cdn.com/images/e8/7f/16/b3/7e284d42a62cd2211f288590/640W_640H.jpg
			//   https://content-images.p-cdn.com/images/e8/7f/16/b3/7e284d42a62cd2211f288590/1080W_1080H.jpg
			domain === "content-images.p-cdn.com") {
			// thanks to anonymous for reporting:
			// https://mediaserver-cont-sv5-2-v4v6.pandora.com/images/d5/05/53/e6/288f49f9baf53e7216ab383b/640W_640H.jpg
			//   https://mediaserver-cont-sv5-2-v4v6.pandora.com/images/d5/05/53/e6/288f49f9baf53e7216ab383b/1080W_1080H.jpg
			newsrc = src.replace(/(\/images\/+.*\/)_?[0-9]{3}W_[0-9]{3}H\./, "$11080W_1080H.");
			if (newsrc !== src) {
				return {
					url: newsrc,
					problems: {possibly_upscaled: true}
				};
			}
		}

		if (domain === "websvc.afi-sa.net") {
			// thanks to anonymous for reporting:
			// https://websvc.afi-sa.net/afi_opac_services/images/jaquettes/8/8/8/7/thumbs/8887104.jpeg -- 248x400
			//   https://websvc.afi-sa.net/afi_opac_services/images/jaquettes/8/8/8/7/big/8887104.jpeg
			return src.replace(/(\/images\/+jaquettes\/+(?:[0-9]\/+)+)thumbs\/+/, "$1big/");
		}

		if (domain === "d3d00swyhr67nd.cloudfront.net") {
			// thanks to anonymous for reporting:
			// artuk.org
			// https://d3d00swyhr67nd.cloudfront.net/w944h944/img-20210819-131421-adjusted-1.jpg
			//   https://d3d00swyhr67nd.cloudfront.net/_source/img-20210819-131421-adjusted-1.jpg
			return src.replace(/(:\/\/[^/]+\/+)w[0-9]+h[0-9]+\/+/, "$1_source/");
		}

		if (domain === "static.insales-cdn.com") {
			// thanks to anonymous for reporting:
			// https://static.insales-cdn.com/images/products/1/1634/778290786/large_5_03.jpg
			//   https://static.insales-cdn.com/images/products/1/1634/778290786/medium_5_03.jpg
			//   https://static.insales-cdn.com/images/products/1/1634/778290786/5_03.jpg
			// https://static.insales-cdn.com/r/LJvMCb4fFA8/rs:fit:600:0:1/q:100/plain/images/products/1/7086/825179054/%D0%BF%D0%BB%D0%BE%D1%85%D0%BE%D0%B9_%D0%BF%D0%B0%D1%80%D0%B5%D0%BD%D1%8C_9.png@png
			//   https://static.insales-cdn.com/images/products/1/7086/825179054/%D0%BF%D0%BB%D0%BE%D1%85%D0%BE%D0%B9_%D0%BF%D0%B0%D1%80%D0%B5%D0%BD%D1%8C_9.png
			// https://static.insales-cdn.com/images/articles/1/4277/1708213/large_1.jpg
			//   https://static.insales-cdn.com/images/articles/1/4277/1708213/1.jpg
			return src
				.replace(/(:\/\/[^/]+\/+images\/+[a-z]+\/+[0-9]+\/+[0-9]+\/+[0-9]+\/+)(?:large|medium)_/, "$1")
				.replace(/\/r\/+.*?\/(images\/+[a-z]+\/+.*)(?:@[a-z]+)(?:[?#].*)?$/, "/$1");
		}

		if (domain === "img.audiofanzine.com") {
			// thanks to anonymous for reporting:
			// https://img.audiofanzine.com/img/product/normal/2/0/20039.jpg?fm=webp&w=300&h=218&fit=max&s=8ebdb40d38fde7162fda030e62cc70b3
			//   https://img.audiofanzine.com/images/u/product/normal/20039.jpg
			// https://img.audiofanzine.com/img/fr/article/cover/5538.jpg?fm=pjpg&w=280&s=c8ba1cc6ec1da2b6bae298d019e86126
			//   https://img.audiofanzine.com/images/u/fr/article/cover/5538.jpg
			// https://img.audiofanzine.com/img/en/article/cover/1270.jpg?fm=pjpg&w=704&h=396&fit=fill&s=2e6f7b0fe9a82ed20342025e32476ef6
			//   https://img.audiofanzine.com/images/u/en/article/cover/1270.jpg
			// https://img.audiofanzine.com/img/fr/news/cover/72189.jpg?fm=pjpg&w=334&h=243&fit=contain&s=a394e0ed7e912fb32330c24a9204b92c
			//   https://img.audiofanzine.com/images/u/fr/news/cover/72189.jpg
			// other:
			// https://medias.audiofanzine.com/img/pictures/normal/6/0/6012310.jpg?fm=webp&w=288&h=144&fit=crop&s=ad8ddd5326b7871d188b4e0bd841d7c8
			return src
				.replace(/\/img\/+(product\/+[^/]+\/+)[0-9]+\/+[0-9]+\/+([0-9]+\.[a-z]+)(?:[?#].*)?$/, "/images/u/$1$2")
				.replace(/\/img\/+(.*[0-9]+\.[a-z]+)(?:[?#].*)?$/, "/images/u/$1");
		}

		if ((domain_nosub === "pimeyes.com" && /^jsc[0-9]*\./.test(domain)) ||
			domain === "94.130.187.81" ||
			domain === "94.130.99.222") {
			// thanks to anonymous for reporting:
			// https://jsc7.pimeyes.com/proxy/7b2275...
			match = src.match(/\/proxy\/+(7b2275[0-9a-f]+)(?:[?#].*)?$/i);
			if (match) {
				let ascii = hex_to_ascii(match[1]);
				let json = JSON_parse(ascii);
				return json.url;
			}
		}

		if (domain_nowww === "gallerix.co.uk") {
			// thanks to anonymous for reporting:
			// https://gallerix.co.uk/gallery/6/9/3/3/44367-300.webp
			//   https://gallerix.co.uk/gallery/6/9/3/3/44367-800.webp
			//   https://gallerix.co.uk/gallery/6/9/3/3/44367-800.jpg
			// https://gallerix.co.uk/gallery/5/7/9/2/37561-300.webp
			return src
				.replace(/(\/gallery\/+(?:[0-9]+\/+)+[0-9]+-800)\.webp(?:[?#].*)?/, "$1.jpg")
				.replace(/(\/gallery\/+(?:[0-9]+\/+)+[0-9]+-)300\./, "$1800.");
		}

		if (domain_nowww === "itemimg.com") {
			// thanks to anonymous for reporting:
			// https://itemimg.com/i/283569783.0.208x208.jpg
			//   https://itemimg.com/i/283569783.0.jpg
			return src.replace(/(\/i\/+[0-9]+\.[0-9]+)\.[0-9]+x[0-9]+\./, "$1.");
		}

		if (domain_nosub === "wbbasket.ru") {
			// thanks to anonymous for reporting:
			// https://basket-03.wbbasket.ru/vol368/part36873/36873970/images/tm/3.jpg
			//   https://basket-03.wbbasket.ru/vol368/part36873/36873970/images/c246x328/3.jpg
			//   https://basket-03.wbbasket.ru/vol368/part36873/36873970/images/big/3.jpg
			return src.replace(/(\/images\/+)(?:c[0-9]+x[0-9]+|tm)\/+/, "$1big/");
		}

		if (domain === "pressi.universalmusic.fi") {
			// thanks to anonymous for reporting:
			// https://pressi.universalmusic.fi/kuvat/Kotimainen/ARPPA/ARPPA.B%C3%84NDI.VALERIA.ByAndre_pressi.jpg?img=img2048
			//   https://pressi.universalmusic.fi/kuvat/Kotimainen/ARPPA/ARPPA.B%C3%84NDI.VALERIA.ByAndre_pressi.jpg?img=full -- 2835x2268
			return src.replace(/([?&]img=)[^&#]+/, "$1full");
		}

		if (domain_nosub === "kuvat.fi" && /^ts[0-9]*\./.test(domain)) {
			// thanks to anonymous for reporting:
			// https://pressi.universalmusic.fi/kuvat/Ulkomainen/Ariana+Grande/Ariana+Grande+-+Album+2+-+Credit+Katia+Temkin.jpg
			// https://ts2.kuvat.fi/tt/?size=thumb560nocrop.webp&hash=...&d=pressi.universalmusic.fi&f=%2Fkuvat%2FUlkomainen%2FAriana%2520Grande%2FAriana%2520Grande%2520-%2520Album%25202%2520-%2520Credit%2520Katia%2520Temkin.jpg&key=...
			//   https://pressi.universalmusic.fi//kuvat/Ulkomainen/Ariana%20Grande/Ariana%20Grande%20-%20Album%202%20-%20Credit%20Katia%20Temkin.jpg?img=full
			// https://ts1.kuvat.fi/tt/?size=thumb560nocrop.webp&hash=...&d=pressi.universalmusic.fi&f=%2Fkuvat%2FUlkomainen%2FHAILEE%2520STEINFELD%2F200309_SM_HS_I_LOVE_YOUS_0327_re_pressi.jpg&key=...
			// todo: download links
			if (/\/tt\/+\?/.test(src)) {
				let queries = get_queries(src);
				if (queries["d"] === "pressi.universalmusic.fi" && queries["f"]) {
					return "https://pressi.universalmusic.fi/" + decodeURIComponent(queries["f"]).replace(/^\/+/, "") + "?img=full";
				}
			}
		}

		if (domain_nosub === "d-cd.net") {
			// thanks to anonymous for reporting:
			// https://a.d-cd.net/U4J7fT15K2vDgCCmtnatb6cnz-Y-1280.jpg
			//   https://a.d-cd.net/U4J7fT15K2vDgCCmtnatb6cnz-Y-1920.jpg
			// https://a.d-cd.net/Ulpm3rSOsxIQbfDGA2GbYAsiMH4-100.jpg
			//   https://a.d-cd.net/Ulpm3rSOsxIQbfDGA2GbYAsiMH4-200.jpg
			// https://a.d-cd.net/yBggzNJjBsKl09ml9LqCJC6B0jM-240.jpg
			//   https://a.d-cd.net/yBggzNJjBsKl09ml9LqCJC6B0jM-1920.jpg
			return src
				.replace(/(:\/\/[^/]+\/+[^/]+)-100\./, "$1-200.")
				.replace(/(:\/\/[^/]+\/+[^/]+)-(?:240|480|960|1280)\./, "$1-1920.");
		}

		if (domain === "static.auction.ru") {
			// thanks to anonymous for reporting:
			// https://static.auction.ru/offer_images/rd48/2021/06/15/03/small/J/Ju6TyTYOqiq/shakhmaty_dorozhnye_maljutka_komplekt_gruzija_sssr.jpg
			//   https://static.auction.ru/offer_images/rd48/2021/06/15/03/big/J/Ju6TyTYOqiq/shakhmaty_dorozhnye_maljutka_komplekt_gruzija_sssr.jpg
			newsrc = src.replace(/(\/offer_images\/+[^/]+\/+[0-9]{4}\/+[0-9]{2}\/+[0-9]{2}\/+[0-9]+\/+)small\/+/, "$1big/");
			if (newsrc !== src) {
				return {
					url: newsrc,
					problems: {watermark: true}
				}
			}
		}

		if (domain === "collectionimages.npg.org.uk") {
			// https://collectionimages.npg.org.uk/std/mw251176/Pet-Shop-Boys-Chris-Lowe-Neil-Tennant.jpg
			//   https://collectionimages.npg.org.uk/popover/mw251176/Pet-Shop-Boys-Chris-Lowe-Neil-Tennant.jpg -- 427x430
			//   https://collectionimages.npg.org.uk/large/mw251176/Pet-Shop-Boys-Chris-Lowe-Neil-Tennant.jpg
			//   https://collectionimages.npg.org.uk/long/mw251176/Pet-Shop-Boys-Chris-Lowe-Neil-Tennant.jpg
			return src.replace(/(:\/\/[^/]+\/+)(?:std|large|popover)\/+/, "$1long/");
		}

		if (domain === "pictime7eus1public-m.azureedge.net" ||
			// thanks to anonymous for reporting:
			// https://pictime6eus1public-m.azureedge.net/pictures/41/491/41491469/lmxi2viidgd9vn18uz/smallres/9975607399.jpg
			//   https://pictime6eus1public-m.azureedge.net/pictures/41/491/41491469/lmxi2viidgd9vn18uz/lowres/9975607399.jpg
			domain === "pictime6eus1public-m.azureedge.net" ||
			// https://pictimecloudaf-m.azureedge.net/pictures/15/26/15026606/thumbres/899471260.jpg
			domain === "pictimecloudaf-m.azureedge.net") {
			// thanks to anonymous for reporting:
			// https://pictime7eus1public-m.azureedge.net/pictures/36/533/36533274/mz1dgy669ac7/thumbres/9068224570.jpg
			//   https://pictime7eus1public-m.azureedge.net/pictures/36/533/36533274/mz1dgy669ac7/smallres/9068224570.jpg
			//   https://pictime7eus1public-m.azureedge.net/pictures/36/533/36533274/mz1dgy669ac7/lowres/9068224570.jpg
			return src.replace(/(\/pictures\/+[0-9]+\/+[0-9]+\/+[0-9]+\/+[0-9a-z]+\/+)(?:thumb|small)res\/+/, "$1lowres/");
		}

		if (domain === "static.pepper.ru") {
			// thanks to anonymous for reporting:
			// https://static.pepper.ru/threads/raw/K5okG/459525_1/re/300x300/qt/60/459525_1.jpg
			//   https://static.pepper.ru/threads/raw/K5okG/459525_1/459525_1.jpg
			return src.replace(/\/(?:re\/+[0-9]+x[0-9]+|qt\/+[0-9]+)(\/+[^/]+)(?:[?#].*)?$/, "$1");
		}

		if (domain === "goods-photos.static1-sima-land.com") {
			// thanks to anonymous for reporting:
			// https://goods-photos.static1-sima-land.com/items/1003031/0/140.jpg?v=1660817204
			//   https://goods-photos.static1-sima-land.com/items/1003031/0/280.jpg?v=1660817204
			//   https://goods-photos.static1-sima-land.com/items/1003031/0/400.jpg?v=1660817204
			//   https://goods-photos.static1-sima-land.com/items/1003031/0/1600.jpg?v=1660817204
			return src.replace(/(\/items\/+[0-9]+\/+[0-9]+\/+)(?:140|280|400|700)\./, "$11600.");
		}

		if (domain === "media.obi.ru") {
			// thanks to anonymous for reporting:
			// https://media.obi.ru/resize/191x191/media/catalog/product/4/2/4250080_1_3e59.jpg?store=moscow&image-type=small_image
			//   https://media.obi.ru/media/catalog/product/4/2/4250080_1_3e59.jpg?store=moscow&image-type=small_image -- 4104x3744
			return src.replace(/\/resize\/+[0-9]+x[0-9]+\/+media\/+/, "/media/");
		}

		if (domain_nowww === "unc.ua") {
			// thanks to anonymous for reporting:
			// https://unc.ua/i2/49/thumbs/medium_fantik-ot-konfet-50-60g-g-kurortnaya-harkov_108172.jpeg
			//   https://unc.ua/i2/49/thumbs/big_fantik-ot-konfet-50-60g-g-kurortnaya-harkov_108172.jpeg
			return src.replace(/\/thumbs\/+(?:medium|large)_/, "/thumbs/big_");
		}

		if (domain === "squat.telequebec.tv") {
			// thanks to anonymous for reporting:
			let query_mnmedias_api = function(id, cb) {
				api_query("telequebec_mnmedias:" + id, {
					url: "https://mnmedias.api.telequebec.tv/api/v4/player/" + id,
					imu_mode: "xhr",
					headers: {
						Origin: "https://squat.telequebec.tv",
						Referer: "https://squat.telequebec.tv/",
						"Sec-Fetch-Dest": "empty",
						"Sec-Fetch-Mode": "cors",
						"Sec-Fetch-Site": "same-site"
					},
					json: true
				}, cb, function(done, resp, cache_key) {
					if (!resp)
						return done(null, false);

					for (let source of resp.streamInfos) {
						if (source.source !== "Brightcove")
							continue;

						let pk = base64_decode("IEJDcGtBRGF3cU0zbEJ6MDdmZFY2UV9fWjhqTTZSZW5Bck1mYU04WW94eUlCZXh6dFAybExCdlh3MlBsa255WGJuS18xTU1TbVh3N3FLcU9NOW1QSS1kb0t2bXFleXdUSjN3S1Z6aGRKU1FOOEp0aGhobXJVVDV6VmlrTVU4T3ZRRUdpclItZTdlN2lxbVpTQw").slice(1);
						return done("https://players.brightcove.net/6150020952001/default_default/index.html?videoId=" + source.sourceId + "#imu-pk=" + pk, 6*60*60);
					}

					console_warn(cache_key, "Unable to find source from", resp);
					return done(null, false);
				});
			};

			let query_squat_api = function(id, cb) {
				api_query("telequebec_squat:" + id, {
					url: "https://squat.api.telequebec.tv/v1/videos/" + id,
					imu_mode: "xhr",
					headers: {
						Origin: "https://squat.telequebec.tv",
						Referer: "https://squat.telequebec.tv/",
						"Sec-Fetch-Dest": "empty",
						"Sec-Fetch-Mode": "cors",
						"Sec-Fetch-Site": "same-site"
					},
					json: true
				}, cb, function(done, resp, cache_key) {
					if (!resp)
						return done(null, false);

					if (resp.source !== "mnMedias") {
						console_warn(cache_key, "Unknown source for", resp);
						return done(null, false);
					}

					query_mnmedias_api(resp.sourceId, function(url) {
						if (!url)
							return done(null, false);

						return done(url, 6*60*60);
					});
				});
			};

			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+videos\/+([0-9]+)(?:[?#].*)?$/,
				run(cb, match) {
					query_squat_api(match[1], function(url) {
						if (!url)
							return cb(null);

						return cb({
							url: url,
							is_pagelink: true
						});
					})
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "baseec-img-mng.akamaized.net") {
			// thanks to nimbuz on discord for reporting:
			// https://baseec-img-mng.akamaized.net/images/item/origin/386e956dfcddb55efd9fc6e0da58a59e.jpg?imformat=generic&q=90&im=Resize,width=174,type=normal
			//   https://baseec-img-mng.akamaized.net/images/item/origin/386e956dfcddb55efd9fc6e0da58a59e.jpg?imformat=generic
			return src.replace(/(\/images\/+item\/+[^/]+\/+[^/?#]*)(?:[?#].*)?$/, "$1?imformat=generic");
		}

		if (domain_nowww === "ffkm.ru") {
			// thanks to anonymous for reporting:
			// http://ffkm.ru/images/gallery/2024-03-13_Show//thumbs/A3567.jpg
			//   http://ffkm.ru/images/gallery/2024-03-13_Show//A3567.jpg
			return src.replace(/(\/images\/+gallery\/+[^/]+\/+)thumbs\/+/, "$1");
		}

		if (domain_nosub === "seaart.ai" && /^image\./.test(domain)) {
			// thanks to anonymous for reporting:
			// https://image.cdn2.seaart.ai/static/07168af6cb0ef9f78dae15739dd73255/20230628/ad96860506afb9995cb3f368996a2b6d_low.webp
			//   https://image.cdn2.seaart.ai/static/07168af6cb0ef9f78dae15739dd73255/20230628/ad96860506afb9995cb3f368996a2b6d_high.webp
			return src.replace(/(\/static\/+.*?)_low(\.[a-z]+)(?:[?#].*)?$/, "$1_high$2");
		}

		if (domain_nosub === "lnwfile.com") {
			// thanks to Froktime on github: https://github.com/qsniyg/maxurl/issues/1301
			// https://cp.lnwfile.com/_/cp/_fit/300/400/mb/j8/vx.jpg
			//   https://cp.lnwfile.com/_/cp/_raw/mb/j8/vx.jpg
			// https://ff.lnwfile.com/_/ff/_resize/300/400/x5/3v/ui.jpg
			//   https://ff.lnwfile.com/_/ff/_raw/x5/3v/ui.jpg
			// https://dt.lnwfile.com/_/dt/_fit/600/600/jj/kl/tv.webp
			//   https://dt.lnwfile.com/_/dt/_raw/jj/kl/tv.webp
			return src.replace(/(:\/\/[^/]+\/+_\/+[^/]+\/+)_(?:fit|resize)\/+[0-9]+\/+[0-9]+\/+/, "$1_raw/");
		}

		if (domain_nosub === "photobiz.com" && /^image[0-9]*\./.test(domain)) {
			// thanks to anonymous for reporting:
			// https://image14.photobiz.com/10152/29_20230316093412_7400470_small.jpg
			//   https://image14.photobiz.com/10152/29_20230316093412_7400470_xlarge.jpg
			// other:
			// https://image5.photobiz.com/8910/20201203103456_328317.jpg -- 3000x2067
			// https://image13.photobiz.com/10309/20210908161325_357316.PNG -- 4096x2730
			// https://image12.photobiz.com/6406/20200810091614_317566.jpg -- 2667x2667
			return src.replace(/_(?:small|large)(\.[^/.]+)(?:[?#].*)?$/, "_xlarge$1");
		}

		if (domain === "media.imagepost.com") {
			// thanks to anonymous for reporting:
			// https://media.imagepost.com/net_girl/ellie_returns_on_net_girl_b6aba6/3-thumb.jpg
			//   https://media.imagepost.com/net_girl/ellie_returns_on_net_girl_b6aba6/3.jpg
			return src.replace(/-thumb(\.[^/.]+)(?:[?#].*)?$/, "$1");
		}

		if (domain === "cdn.viewing.nyc") {
			// thanks to anonymous for reporting:
			// https://cdn.viewing.nyc/assets/media/9bca633fc54bc0ef9dd0dfccf087c99e/elements/57c322b96d46ed5681859b4ecd1e0a70/xl/49ba65e7-1a4d-4114-800b-62e0450480b5_2x.jpg -- upscaled
			//   https://cdn.viewing.nyc/assets/media/9bca633fc54bc0ef9dd0dfccf087c99e/elements/57c322b96d46ed5681859b4ecd1e0a70/49ba65e7-1a4d-4114-800b-62e0450480b5.jpg
			// https://cdn.viewing.nyc/assets/media/e9ddb205f5e1cda2b59e0ab5051f027a/elements/d2133844dada56490a0ec62ad98cb04b/xl/1f2c8d5c-f3f7-4617-b76a-a2149426d2fa_2x.jpg
			//   https://cdn.viewing.nyc/assets/media/e9ddb205f5e1cda2b59e0ab5051f027a/elements/d2133844dada56490a0ec62ad98cb04b/1f2c8d5c-f3f7-4617-b76a-a2149426d2fa.jpg -- 6000x4000
			return src.replace(/(\/assets\/+media\/+[0-9a-f]+\/+elements\/+[0-9a-f]+\/+)[a-z]+\/+([-0-9a-f]+)(?:_[0-9]+x)?\./, "$1$2.");
		}

		if (domain === "media.kijiji.ca") {
			// thanks to anonymous for reporting:
			// https://media.kijiji.ca/api/v1/autos-prod-ads/images/a1/a10f4f69-7049-4019-a728-7d1d032d7dbc?rule=kijijica-640-jpg
			//   https://media.kijiji.ca/api/v1/autos-prod-ads/images/a1/a10f4f69-7049-4019-a728-7d1d032d7dbc?rule=kijijica-1600-jpg
			// https://media.kijiji.ca/api/v1/autos-prod-ads/images/a1/a10f4f69-7049-4019-a728-7d1d032d7dbc?rule=kijijica-1600-webp -- lower quality
			//   https://media.kijiji.ca/api/v1/autos-prod-ads/images/a1/a10f4f69-7049-4019-a728-7d1d032d7dbc?rule=kijijica-1600-jpg
			// other:
			// //   https://media.kijiji.ca/api/v1/autos-prod-ads/images/a1/a10f4f69-7049-4019-a728-7d1d032d7dbc?rule=kijijica-1600-png -- same quality as jpg
			return src.replace(/(\/api\/+v1\/+[^/]+\/+images\/+[0-9a-f]{2}\/+[-0-9a-f]{10,})\?rule=kijijica-(?:[0-9]{2,3}|1024|1200|1600)-[a-z]+$/, "$1?rule=kijijica-1600-jpg");
		}

		if (domain_nowww === "vogue.com.tr") {
			// thanks to SakalliTavernaci on github: https://github.com/qsniyg/maxurl/issues/1304
			// https://vogue.com.tr/static/img/content/24-03/08/mceu_13134132821709899008762.jpg
			//   https://vogue.com.tr/static/original/24-03/08/mceu_13134132821709899008762.jpg
			// https://vogue.com.tr/static/img/article_detail/22-02/14/cdior-12_v_5apr12_rex_b.jpg
			//   https://vogue.com.tr/static/original/22-02/14/cdior-12_v_5apr12_rex_b.jpg
			return src.replace(/(\/static\/+)img\/+[^/]+\/+/, "$1original/");
		}

		if (domain_nowww === "cartier.jp") {
			// thanks to anonymous for reporting:
			// https://www.cartier.jp/content/dam/cartier_dam/catalogue_assets/manhattan-update/1-jewelry/clp/trinity/slide/slide_01_trinity_24_clp.jpg.scale.2560.high.jpg
			//   https://www.cartier.jp/content/dam/cartier_dam/catalogue_assets/manhattan-update/1-jewelry/clp/trinity/slide/slide_01_trinity_24_clp.jpg
			return src.replace(/(\/content\/+dam\/+.*\.[a-z]+)\.scale\.[0-9]+\.[a-z]+\.[a-z]+(?:[?#].*)?$/, "$1");
		}

		if (domain === "storage.onecloudpro.com") {
			// thanks to anonymous for reporting:
			// https://docs.imagizer.com/
			// https://storage.onecloudpro.com/gallerySettings/files/180f25b7-58d4-48e8-9717-da872c8fb81c.jpeg?dpr=1&format=jpeg&quality=80&sharp_amount=27&sharp_radius=2&w=2400&h=1260&crop=fit&upscale=false
			//   https://storage.onecloudpro.com/gallerySettings/files/180f25b7-58d4-48e8-9717-da872c8fb81c.jpeg
			return {
				url: src.replace(/\?.*/, ""),
				can_head: false
			};
		}

		if (domain === "imageflow.rausgegangen.de") {
			// thanks to TheLastZombie on github:
			// https://imageflow.rausgegangen.de/url/https%3A//s3.eu-central-1.amazonaws.com/rausgegangen/KBEXIUNKRoqU9HgdGk5z_marz-11png?width=1200&height=900&mode=crop
			//   https://s3.eu-central-1.amazonaws.com/rausgegangen/KBEXIUNKRoqU9HgdGk5z_marz-11png
			// https://imageflow.rausgegangen.de/url/https%3A%2F%2Fs3.eu-central-1.amazonaws.com%2Frausgegangen%2FKBEXIUNKRoqU9HgdGk5z_marz-11png%3Fwidth%3D100?width=1200&height=900&mode=crop
			//   https://s3.eu-central-1.amazonaws.com/rausgegangen/KBEXIUNKRoqU9HgdGk5z_marz-11png?width=100

			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+url\/(.*?)(?:[?#].*)?$/, "$1");
			if (newsrc !== src)
				return decodeURIComponent(newsrc);
		}

		if (domain === "cdn.mpcautofill.com") {
			// thanks to Solus on discord:
			// https://cdn.mpcautofill.com/images/google_drive/small/1BuWUP0momWanMnej1PxpGWa60FMw8uh4.jpg
			//   https://cdn.mpcautofill.com/images/google_drive/large/1BuWUP0momWanMnej1PxpGWa60FMw8uh4.jpg
			// https://cdn.mpcautofill.com/images/google_drive/small/13ogr4MIpI7csAJwEE1RvkpYYRlWTnqhB.jpg
			//   https://cdn.mpcautofill.com/images/google_drive/large/13ogr4MIpI7csAJwEE1RvkpYYRlWTnqhB.jpg
			return {
				url: src.replace(/(\/images\/+[^/]+\/+)small\/+/, "$1large/"),
				can_head: false // 400
			};
		}

		if (domain === "img.mpcautofill.com") {
			// thanks to Solus on discord:
			// https://img.mpcautofill.com/1mMQhf11RBNVBRvEYKPlMiRqgovuSDT2l-small-google_drive
			//   https://img.mpcautofill.com/1mMQhf11RBNVBRvEYKPlMiRqgovuSDT2l-large-google_drive
			return src.replace(/(\/[0-9a-zA-Z]+-)small(-google_drive)(?:[?#].*)?$/, "$1large$2");
		}

		if (domain_nowww === "azertag.az") {
			// thanks to anonymous for reporting:
			// https://azertag.az/files/2022/1/1200x630/1648649183590816801_1200x630.jpg
			//   https://azertag.az/files/2022/1/1648649183590816801.jpg
			return src.replace(/(\/files\/+[0-9]{4}\/+[0-9]+\/+)[0-9]+x[0-9]+\/+([0-9]+)_[0-9]+x[0-9]+\./, "$1$2.");
		}

		if (googlestorage_container === "image-ichiba2") {
			// thanks to nimbuz on discord:
			// https://storage.googleapis.com/image-ichiba2/prod/froala/projects/710/ubgoe/ncpdUqbSBMtLLwnE6h-xWA_w900.jpg
			//   https://storage.googleapis.com/image-ichiba2/prod/froala/projects/710/ubgoe/ncpdUqbSBMtLLwnE6h-xWA.jpg
			return src.replace(/(\/prod\/+[^/]+\/+projects\/+[0-9]+\/+[^/]+\/+[^/]+)_w[0-9]+\./, "$1.");
		}

		if (domain === "img.chil-chil.net") {
			// thanks to Froktime on github: https://github.com/qsniyg/maxurl/issues/1306
			// https://img.chil-chil.net/goods_img/L/00140048_L.jpg
			//   https://img.chil-chil.net/goods_img/XXL/00140048_XXL.jpg -- 640x909
			return {
				url: src.replace(/(\/goods_img\/+)X?[ML]\/+([0-9]+)_X?[ML]\./, "$1XXL/$2_XXL."),
				problems: {possibly_upscaled: true}
			}
		}

		if (domain === "images.mnstatic.com") {
			// thanks to anonymous for reporting:
			// https://images.mnstatic.com/3e/f2/3ef2707ef405e4f31f95453f4217c23c.jpg?quality=86&format=pjpg&fit=crop&width=236&height=190&aspect_ratio=236%3A190
			//   https://images.mnstatic.com/3e/f2/3ef2707ef405e4f31f95453f4217c23c.jpg?quality=100&format=png
			return src.replace(/(?:\?.*)?$/, "?quality=100&format=png");
		}

		if (domain_nosub === "mnstatic.com" && /^photo[0-9]+x[0-9]+\./.test(domain)) {
			// thanks to anonymous for reporting:
			// https://photo620x400.mnstatic.com/3ef2707ef405e4f31f95453f4217c23c/abbaye-du-mont_saint_michel.jpg?quality=70&format=pjpg
			//   https://images.mnstatic.com/3e/f2/3ef2707ef405e4f31f95453f4217c23c.jpg?quality=100&format=png
			match = src.match(/:\/\/[^/]+\/+([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{10,})\/+/);
			if (match) {
				return "https://images.mnstatic.com/" + match[1] + "/" + match[2] + "/" + match[1] + match[2] + match[3] + ".jpg?quality=100";
			}
		}

		if (domain_nowww === "esprit-photo.com") {
			// thanks to anonymous for reporting:
			// https://esprit-photo.com/render/w640/02.celebrations/03.paques/081.chemin-de-croix-virtuel/EX15-0001_Expo-Chemin-de-Croix-G-SCHILLING-WEB_03_Copyright_N.JUNG_Photographie.Pro.jpg
			//   https://esprit-photo.com/content/02.celebrations/03.paques/081.chemin-de-croix-virtuel/EX15-0001_Expo-Chemin-de-Croix-G-SCHILLING-WEB_03_Copyright_N.JUNG_Photographie.Pro.jpg
			// other:
			// 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) {
					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;
		}

		if (domain === "kaupokalda.com") {
			// thanks to anonymous for reporting:
			// https://kaupokalda.com/storage/cache/6d/2f/d9/kaupokalda-com-20220821-135537-dji-0847-pano.thumb432.webp?t=f2660d
			//   https://kaupokalda.com/storage/cache/6d/2f/d9/kaupokalda-com-20220821-135537-dji-0847-pano.jpg?t=f2660d
			return src.replace(/(\/storage\/+cache\/+.*?)\.thumb[0-9]+\.webp/, "$1.jpg");
		}

		if (domain === "app.fanfix.io") {
			// thanks to remlap for reporting:
			// https://app.fanfix.io/static/images/circular_window_white.png
			if (/\/static\/+images\/+circular_window_white\./.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}
		}

		if (domain === "cms.rsa-media.de") {
			// thanks to anonymous for reporting:
			// https://cms.rsa-media.de/uploads/large_09_rsamgmt_Patrick_fcec455cc6.jpeg
			//   https://cms.rsa-media.de/uploads/09_rsamgmt_Patrick_fcec455cc6.jpeg -- 3100x2067
			return src.replace(/(\/uploads\/+)(?:small|medium|large)_([^/]+)(?:[?#].*)?$/, "$1$2");
		}

		if (domain_nosub === "lemmecheck.com" && /^cdn[0-9]*\./.test(domain)) {
			// thanks to anonymous for reporting:
			// https://cdn2.lemmecheck.com/lmccom/uploads/2023/05/princess-alice-in-presenting-princess-alice-by-mytro-for-metart-5-300x450.jpg
			//   https://cdn2.lemmecheck.com/lmccom/uploads/2023/05/princess-alice-in-presenting-princess-alice-by-mytro-for-metart-5.jpg
			return {
				url: src.replace(/-[0-9]+x[0-9]+(\.[^/.]+)(?:[?#].*)?$/, "$1"),
				headers: {
					Referer: "https://www.lemmecheck.com/"
				}
			};
		}

		if (domain_nowww === "irrgangfinearts.de") {
			// thanks to anonymous for reporting:
			// https://www.irrgangfinearts.de/media/image/product/21044/lg/l202200335.webp
			//   https://www.irrgangfinearts.de/media/image/product/21044/xl/l202200335.webp
			//   https://www.irrgangfinearts.de/media/image/product/21044/xl/l202200335.png
			return src
				.replace(/(\/xl\/+l[0-9]+\.)(?:webp|jpg)(?:[?#].*)?$/, "$1png")
				.replace(/(\/media\/+image\/+product\/+[0-9]+\/+)(?:sm|md|lg)\/+/, "$1xl/");
		}

		if (domain === "photos.psychologytoday.com") {
			// thanks to anonymous for reporting:
			// https://photos.psychologytoday.com/3b72b3f7-46cd-11ea-a6ad-06142c356176/6/320x400.jpeg
			//   https://photos.psychologytoday.com/3b72b3f7-46cd-11ea-a6ad-06142c356176/6/original.jpeg
			return src.replace(/(\/[-0-9a-f]{10,}\/+[0-9a-f]+\/+)[0-9]+x[0-9]+\./, "$1original.");
		}

		if (domain_nowww === "lddb.com") {
			// thanks to CetaceanNation on github: https://github.com/qsniyg/maxurl/issues/1320
			// https://www.lddb.com/laserdisc/37544/SF098-1168/Back-to-the-Future
			// https://www.lddb.com/cover/ld/37501-37600/thumb/37544.jpg
			//   https://www.lddb.com/cover/ld/37501-37600/37544.jpg
			return src.replace(/(\/cover\/+ld\/+[0-9]+-[0-9]+\/+)thumb\/+/, "$1");
		}

		if (domain === "img.dlsite.jp") {
			// thanks to Froktime on github: https://github.com/qsniyg/maxurl/issues/1312
			// https://img.dlsite.jp/resize/images2/work/books/BJ617000/BJ616372_img_main_240x240.jpg
			//   https://img.dlsite.jp/modpub/images2/work/books/BJ617000/BJ616372_img_main.jpg
			// https://img.dlsite.jp/modpub/images2/work/doujin/RJ438000/RJ437590_img_smp4.webp
			//   https://img.dlsite.jp/modpub/images2/work/doujin/RJ438000/RJ437590_img_smp4.jpg
			return src
				.replace(/(\/modpub\/.*)\.webp(?:[?#].*)?$/, "$1.jpg")
				.replace(/\/resize\/+(.*?)_[0-9]+x[0-9]+(\.[a-z]+)(?:[?#].*)?$/, "/modpub/$1$2");
		}

		if (domain === "files.structurae.net") {
			// thanks to anonymous for reporting:
			// https://files.structurae.net/files/300x200/1/219-jauntal-2-2000.jpg
			//   https://files.structurae.net/files/350high/1/219-jauntal-2-2000.jpg
			//   https://files.structurae.net/files/photos/1/219-jauntal-2-2000.jpg
			return src.replace(/(\/files\/+)[0-9]+(?:x[0-9]+|high)\/+/, "$1photos/");
		}

		if (domain === "i.daily.jp") {
			// https://i.daily.jp/horse/2016/12/14/Images/09750568.jpg -- 447x450
			//   https://i.daily.jp/horse/2016/12/14/Images/f_09750568.jpg
			// thanks to nimbuz on discord:
			// https://i.daily.jp/gossip/2024/11/09/Images/b_18323608.jpg
			//   https://i.daily.jp/gossip/2024/11/09/Images/f_18323608.jpg -- 427x960
			return src.replace(/(\/Images\/+)(?:b_)?([0-9]+\.[a-z]+)(?:[?#].*)?$/, "$1f_$2");
		}

		if (domain_nowww === "dr-johanna-budwig.de") {
			// thanks to anonymous for reporting:
			// https://www.dr-johanna-budwig.de/cdn/thumbnail/ef/33/9f/1604563448/dr-johanna-budwig_1_800x800.jpg
			//   https://www.dr-johanna-budwig.de/cdn/media/ef/33/9f/1604563448/dr-johanna-budwig_1.jpg
			return src.replace(/(\/cdn\/+)thumbnail\/+(.*?)_[0-9]+x[0-9]+(\.[a-z]+)(?:[?#].*)?$/, "$1media/$2$3");
		}

		if (domain_nowww === "otakurepublic.com") {
			// thanks to anonymous for reporting:
			// https://otakurepublic.com/media/binary/008/579/851/8579851.jpg.l_thumbnail.webp
			//   https://otakurepublic.com/media/binary/008/579/851/8579851.jpg
			return src.replace(/(\/media\/+binary\/+.*?\.[a-z]+)\.[^/.]+\.webp(?:[?#].*)?$/, "$1");
		}

		if (domain === "scout.wgimager.com") {
			// thanks to anonymous for reporting:
			// https://scout.wgimager.com/w_280/h_218/q_90/f_webp/https://static.wgplayground.com/9c4ff820045f60da93b33777fd8bc8ec/wgplayground/c2d948d1ead59940f7af2e9331c86867.jpg
			//   https://static.wgplayground.com/9c4ff820045f60da93b33777fd8bc8ec/wgplayground/c2d948d1ead59940f7af2e9331c86867.jpg
			return src.replace(/^[a-z]+:\/\/[^/]+\/+(?:[whqf]_[^/]+\/+)+(https?:\/\/)/, "$1");
		}

		if (domain_nowww === "trustnordisk.com") {
			// thanks to anonymous for reporting:
			// https://trustnordisk.com/fileadmin/_processed_/f/8/csm_Hovedstill_Mr._Freeman_Zentropa_Foto_Christian_Geisnaes__2000x1200__d8dd7379aa.jpg
			//   https://trustnordisk.com/fileadmin/user_upload/Hovedstill_Mr._Freeman_Zentropa_Foto_Christian_Geisnaes__2000x1200_.jpg
			// doesn't work for all:
			// thanks to anonymous for reporting:
			// https://www.aidlingen.de/fileadmin/_processed_/3/1/csm_RathausPlatz_20b9fa4b72.jpg
			//   https://www.aidlingen.de/fileadmin/user_upload/RathausPlatz.jpg -- 404
			return src.replace(/(\/fileadmin\/+)_processed_\/+(?:[0-9a-f]\/+){2}csm_([^/]+)_[0-9a-f]+\./, "$1user_upload/$2.");
		}

		if (domain_nowww === "cinemacrush.com") {
			// https://cinemacrush.com/assets/play.png
			if (/\/assets\/+play\.png(?:[?#].*)?$/.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}

			// thanks to anonymous for reporting:
			// https://cinemacrush.com/media/the-end-of-summer/w185/A6UFgNyH35qsIEiqIc6o2xmkRQa.jpg
			//   https://cinemacrush.com/media/the-end-of-summer/original/A6UFgNyH35qsIEiqIc6o2xmkRQa.jpg
			return src.replace(/(\/media\/+[^/]+\/+)[wh][0-9]+\/+/, "$1original/");
		}

		if (domain_nowww === "characterai.io") {
			// https://characterai.io/i/80/static/avatars/uploaded/2022/10/6/igor/socrates.webp?webp=true&anim=0
			//   https://characterai.io/i/200/static/avatars/uploaded/2022/10/6/igor/socrates.webp?webp=true&anim=0
			newsrc = src.replace(/\/i\/+80\/+/, "/i/200/");
			if (newsrc !== src)
				return newsrc;

			if (!/\/static\/+avatars\/+uploaded\//.test(src)) {
				// thanks to anonymous for reporting:
				// https://characterai.io/i/80/static/avatars/TextAdventure3.png?webp=true&anim=0
				//   https://characterai.io/static/avatars/TextAdventure3.png
				// doesn't work for all:
				// https://characterai.io/i/80/static/avatars/uploaded/2022/10/6/igor/socrates.webp?webp=true&anim=0
				return src.replace(/\/i\/+[0-9]+\/+static\/+(.*?)(?:[?#].*)?$/, "/static/$1");
			}
		}

		if (domain === "cache.legacy.net") {
			// thanks to anonymous for reporting:
			// https://cache.legacy.net/legacy/images/cobrands/latimes/photos/photo_202617_7602624_1_Photo1_cropped_20190715.jpgx?w=200&h=200&option=3
			//   https://cache.legacy.net/legacy/images/cobrands/latimes/photos/photo_202617_7602624_1_Photo1_cropped_20190715.jpg
			return src.replace(/(\/images\/.*?\.jpg)x\?.*/, "$1");
		}

		if (domain_nosub === "gloria-jeans.ru" && /^storage-cdn[0-9]*\./.test(domain)) {
			// thanks to anonymous for reporting:
			// https://storage-cdn10.gloria-jeans.ru/pictures/Haki-sorty-Chino-fit_BSH007490-1_01_1200Wx1200H.jpeg?q=634724
			//   https://storage-cdn10.gloria-jeans.ru/pictures/Haki-sorty-Chino-fit_BSH007490-1_01_WxH.jpeg - 1885x2399
			return src.replace(/(\/pictures\/+[^/]+_)[0-9]*Wx[0-9]*H(\.[a-z]+)(?:[?#].*)?$/, "$1WxH$2");
		}

		if (domain_nowww === "codingtube.tech") {
			// thanks to anonymous for reporting:
			// https://codingtube.tech/webimage2/aHR0cHM6Ly9jb2Rpbmd0dWJlLnRlY2gvbmV3c3VybC9pbWd1cGxvYWRzLzE3MDY4MDMyMDguanBn/900/1600/Jackie-Robinson%3A-Breaking-Barriers-and-Paving-the-Way.jpg
			//   https://codingtube.tech/newsurl/imguploads/1706803208.jpg
			// https://codingtube.tech/biography/ogimage/aHR0cHM6Ly9pbWFnZS50bWRiLm9yZy90L3AvdzUwMC8vbVRkQUNtaXRkcndvcjBOcnY1c3IwdTEyM3ZaLmpwZw==/Image.png
			//   https://image.tmdb.org/t/p/original/mTdACmitdrwor0Nrv5sr0u123vZ.jpg
			match = src.match(/\/(aHR0c[^/]+)\//);
			if (match) {
				return base64_decode(match[1]);
			}
		}

		if (domain === "cdn-s-www.ledauphine.com" ||
			// thanks to anonymous for reporting:
			// https://cdn-s-www.leprogres.fr/images/B76EBF51-6ACF-4C83-9310-BD5200B8A82D/MF_contenu/marcel-meys-photo-archives-ldl-francois-le-fur-1639591778.jpg
			//   https://cdn-s-www.leprogres.fr/images/B76EBF51-6ACF-4C83-9310-BD5200B8A82D/NW_raw/marcel-meys-photo-archives-ldl-francois-le-fur-1639591778.jpg
			domain === "cdn-s-www.leprogres.fr" ||
			// thanks to anonymous for reporting:
			// https://cdn-s-www.estrepublicain.fr/images/9BBE89D2-D164-40E0-A2EE-329173BE1A79/MF_contenu/marcel-meys-110-ans-est-le-nouveau-doyen-des-francais-1571164479.jpg
			//   https://cdn-s-www.estrepublicain.fr/images/9BBE89D2-D164-40E0-A2EE-329173BE1A79/NW_raw/marcel-meys-110-ans-est-le-nouveau-doyen-des-francais-1571164479.jpg
			domain === "cdn-s-www.estrepublicain.fr") {
			// thanks to anonymous for reporting:
			// https://cdn-s-www.ledauphine.com/images/0E8D91A2-B8AA-4A9F-928B-2C19852E74C9/MF_contenu/marcel-meys-110-ans-le-nouveau-doyen-des-francais-est-iserois-1571126499.jpg
			//   https://cdn-s-www.ledauphine.com/images/0E8D91A2-B8AA-4A9F-928B-2C19852E74C9/NW_raw/marcel-meys-110-ans-le-nouveau-doyen-des-francais-est-iserois-1571126499.jpg
			return src.replace(/(\/images\/+[-0-9A-F]{10,}\/+)[^/]+\/+/, "$1NW_raw/");
		}

		if (domain === "cdn.tukioswebsites.com") {
			// thanks to anonymous for reporting:
			// https://cdn.tukioswebsites.com/obituary_profile_photo/md/08fa1fc4-b7e1-4750-87ec-4fc8e5aa9d2e
			//   https://cdn.tukioswebsites.com/obituary_profile_photo/xl/08fa1fc4-b7e1-4750-87ec-4fc8e5aa9d2e
			return src.replace(/(\/obituary_profile_photo\/+)(?:sm|md|lg)\/+/, "$1xl/");
		}

		if (domain_nowww === "girlsnews.tv") {
			// thanks to nimbuz on discord for reporting:
			// https://www.girlsnews.tv/reimage/y2024/m05/w288/img240520_IMG_0019.jpg
			//   https://www.girlsnews.tv/reimage/y2024/m05/w0/img240520_IMG_0019.jpg
			// thanks to tathastu871 on discord for reporting:
			// https://girlsnews.tv/reimage/y2024/m05/w0/h100/1/1/img240515_IMG_0299.jpg
			//   https://girlsnews.tv/reimage/y2024/m05/w0/img240515_IMG_0299.jpg
			return src.replace(/(\/reimage\/+y[0-9]+\/+m[0-9]+\/+)w[0-9]+\/+(?:[^?#]*\/)?/, "$1w0/");
		}

		if (domain === "bilder.deutschlandfunk.de") {
			// https://bilder.deutschlandfunk.de/FI/LE/_3/9f/FILE_39f95da8969cf6784012813800601e77/59631676-jpg-100-1280xauto.jpg
			//   https://bilder.deutschlandfunk.de/FI/LE/_3/9f/FILE_39f95da8969cf6784012813800601e77/59631676-jpg-100-original.jpg
			return src.replace(/-100-[auto0-9]+x[auto0-9]+\./, "-100-original.");
		}

		if (domain === "cdn.arabsstock.com") {
			// thanks to anonymous for reporting:
			// https://cdn.arabsstock.com/uploads/images/37980/image-37980-saudi-gulf-man-inside-tourist-hotel-holding-mobile-phone-thumbnail.webp
			//   https://cdn.arabsstock.com/uploads/images/37980/image-37980-saudi-gulf-man-inside-tourist-hotel-holding-mobile-phone-thumbnail.jpg
			newsrc = src.replace(/(\/uploads\/+images\/+[0-9]+\/+image-[0-9]+-[^/?#.]+-thumbnail\.)webp(?:[?#].*)?$/, "$1jpg");
			if (newsrc !== src)
				return newsrc;

			// https://cdn.arabsstock.com/uploads/images/37980/image-37980-saudi-gulf-man-inside-tourist-hotel-holding-mobile-phone-preview.jpg
			if (/\/uploads\/+images\/+[0-9]+\/+image-[0-9]+-[^/?#.]+-(?:preview|thumbnail)\./.test(src)) {
				return [
					{
						url: src.replace(/-[a-z]+(\.[a-z]+)(?:[?#].*)?$/, "-preview$1"),
						problems: {watermark: true}
					},
					{
						url: src.replace(/-[a-z]+(\.[a-z]+)(?:[?#].*)?$/, "-thumbnail$1"),
						problems: {smaller: true}
					}
				]
			}
		}

		if (domain_nowww === "4get.ca") {
			// thanks to anonymous for reporting:
			// https://4get.ca/proxy?i=https%3A%2F%2Fencrypted-tbn0.gstatic.com%2Fimages%3Fq%3Dtbn%3AANd9GcQ9V8otZMfGWJ0eqaPirEhKOLtpslxwS5Gb8e9kqoKYZaYQMw%26s&s=thumb
			//   https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQ9V8otZMfGWJ0eqaPirEhKOLtpslxwS5Gb8e9kqoKYZaYQMw&s
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+proxy\?(?:.*&)?i=([^&#]+)(?:[&#].*)?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (host_domain_nowww === "4get.ca" && options.element) {
			if (options.element.tagName === "IMG" && options.element.parentElement &&
				options.element.parentElement.tagName === "A" && options.element.parentElement.classList.contains("thumb")) {
				return options.element.parentElement.href;
			}
		}

		if (domain === "img.fruugo.com") {
			// thanks to anonymous for reporting:
			// https://img.fruugo.com/product/9/23/1286615239_0340_0340.jpg
			//   https://img.fruugo.com/product/9/23/1286615239_max.jpg
			return src.replace(/(\/product\/+[0-9]+\/+[0-9]+\/+[0-9]+)_[0-9]+_[0-9]+\./, "$1_max.");
		}

		if (domain_nowww === "chicos.com" && /\/Product_Images\//i.test(src)) {
			// thanks to anonymous for reporting:
			// https://www.chicos.com/Product_Images/570366113_791.jpg?imgPolicy=productSmall
			//   https://www.chicos.com/Product_Images/570366113_791_large.jpg
			newsrc = src.replace(/[?#].*/, "");
			if (newsrc !== src)
				return newsrc;

			return src.replace(/(\/Product_Images\/+[0-9]+_[0-9]+)(\.[a-z]+)$/i, "$1_large$2");
		}

		if (domain === "static.zara.net") {
			// thanks to anonymous for reporting:
			// https://static.zara.net/assets/public/9e67/ed99/6229482faa83/8f197844cd8c/02553498800-200-e1/02553498800-200-e1.jpg?ts=1710949632815&w=422
			//   https://static.zara.net/assets/public/9e67/ed99/6229482faa83/8f197844cd8c/02553498800-200-e1/02553498800-200-e1.jpg
			return src.replace(/(\/assets\/+public\/+.*?)(?:[?#].*)?$/, "$1");
		}

		if (domain_nowww === "diaart.org") {
			// thanks to anonymous for reporting:
			// https://www.diaart.org/media/w330h330/pressimages/beacon-exterior-shot-15-photo-bill-jacobson-june-2016.jpg
			//   https://www.diaart.org/media/_source/pressimages/beacon-exterior-shot-15-photo-bill-jacobson-june-2016.jpg
			// https://diaart.org/media/w1050h700/webimages/bourgeois%2018.jpg
			//   https://diaart.org/media/_source/webimages/bourgeois%2018.jpg
			return src.replace(/(\/media\/+)[^/]+\/+([a-z]+images\/+)/, "$1_source/$2");
		}

		if (domain === "imageservice.disco.peacocktv.com") {
			// thanks to anonymous for reporting:
			// https://imageservice.disco.peacocktv.com/uuid/ff8fab29-7d11-3812-a58b-be4b64f6fc5e/LAND_16_9/400?language=eng&territory=US&version=47eb3ad9-46f2-314d-8919-5d69acd4962d&image-format=webp&image-quality=7&image-format=webp
			//   https://imageservice.disco.peacocktv.com/uuid/ff8fab29-7d11-3812-a58b-be4b64f6fc5e/LAND_16_9/400?language=eng&territory=US&version=47eb3ad9-46f2-314d-8919-5d69acd4962d&image-format=png
			newsrc = add_queries(remove_queries(src, ["image-format", "image-quality"]), {"image-format": "png"});
			if (newsrc !== src)
				return newsrc;

			// https://imageservice.disco.peacocktv.com/uuid/ff8fab29-7d11-3812-a58b-be4b64f6fc5e/LAND_16_9/400?language=eng&territory=US&version=47eb3ad9-46f2-314d-8919-5d69acd4962d&image-format=png
			//   https://imageservice.disco.peacocktv.com/uuid/ff8fab29-7d11-3812-a58b-be4b64f6fc5e/LAND_16_9/0?language=eng&territory=US&version=47eb3ad9-46f2-314d-8919-5d69acd4962d&image-format=png -- 1920x1080
			// https://imageservice.disco.peacocktv.com/uuid/314e8aac-d98e-3627-bce8-d23baadbd15d/TITLE_ART_3_4/414/552?language=eng&territory=US&proposition=NBCUOTT&version=b335f386-88cc-3e60-a874-2acb42a05402
			//   https://imageservice.disco.peacocktv.com/uuid/314e8aac-d98e-3627-bce8-d23baadbd15d/TITLE_ART_3_4/0?language=eng&territory=US&proposition=NBCUOTT&version=b335f386-88cc-3e60-a874-2acb42a05402&image-format=png -- 2160x2880
			// https://imageservice.disco.peacocktv.com/pcms/232f6028-1399-11ef-afbb-3bc20e2d170b/LAND_16_9/640/480?proposition=NBCUOTT&language=eng&versionId=bfb8ca13-2c6f-54b7-a7ea-7da001a7cd62&territory=US&image-format=png
			//   https://imageservice.disco.peacocktv.com/pcms/232f6028-1399-11ef-afbb-3bc20e2d170b/LAND_16_9/0?proposition=NBCUOTT&language=eng&versionId=bfb8ca13-2c6f-54b7-a7ea-7da001a7cd62&territory=US&image-format=png -- 3840x2160
			//   https://imageservice.disco.peacocktv.com/pcms/232f6028-1399-11ef-afbb-3bc20e2d170b/LAND_16_9?proposition=NBCUOTT&language=eng&versionId=bfb8ca13-2c6f-54b7-a7ea-7da001a7cd62&territory=US&image-format=png -- 3840x2160
			// todo:
			// https://imageservice.disco.peacocktv.com/logo/skychb_6559054711524489117_darknow/LOGO_NON_PADDED/600/208?proposition=NBCUOTT&territory=US&image-format=png
			newsrc = src.replace(/(\/(?:uuid|pcms)\/+[-0-9a-f]{10,}\/+[^/]+\/+)[0-9]+(?:\/+[0-9]+)?(\?.*)$/, "$10$2");
			if (newsrc !== src)
				return newsrc;

			// other:
			// https://imageservice.disco.peacocktv.com/uuid/144e7f31-a4cb-392d-b405-98052713903f/16-9?sid=6979268080554005117&language=eng&territory=US&version=92f05219-7e27-3578-9e96-b2435fab1e5f&image-format=png
			// https://imageservice.disco.peacocktv.com/uuid/7efb7c40-42fe-35e6-a94b-a0c58e912d73/TITLE_TREATMENT?language=eng&territory=US&proposition=NBCUOTT&version=de62b65e-457c-3d3f-9e0b-5828889fc3fe&image-format=png
		}

		if (host_domain === "muzeum.sanok.pl" && domain === "muzeum.sanok.pl" && options.element) {
			// thanks to anonymous for reporting:
			// https://muzeum.sanok.pl/en/zbiory/zdzislaw-beksinski/malarstwo
			// https://muzeum.sanok.pl/images/multithumb_thumbs/b_175_0_16777215_00_images_stories_Beksinski_malarstwo_AA72_1972.jpg
			//   https://muzeum.sanok.pl/images/stories/Beksinski/malarstwo/AA72%201972.jpg
			if (/\/images\/+multithumb_thumbs\/+[^/.?#]+_images_stories_/.test(src) && options.element.parentElement &&
			    options.element.parentElement.tagName === "A" && options.element.parentElement.href &&
				/\/images\/+stories\//.test(options.element.parentElement.href)) {
				return options.element.parentElement.href;
			}
		}

		if (domain_nowww === "minecraft.net") {
			// thanks to anonymous for reporting:
			// https://www.minecraft.net/content/dam/games/minecraft/merch/15Days_Day5_1170x500%20D.jpg.transform/minecraft-image-large/image.jpg
			//   https://www.minecraft.net/content/dam/games/minecraft/merch/15Days_Day5_1170x500%20D.jpg
			return src.replace(/(\/content\/+dam\/+.*?)\.transform\/[^/]+\/+[^/]+\.[a-z]+(?:[?#].*)?$/, "$1");
		}

		if (domain === "garden.spoonflower.com") {
			// thanks to anonymous for reporting:
			// https://garden.spoonflower.com/c/2558660/p/f/s/PAFqo1h4G_3z26u9fYDLZdkFpdWL6p-GIY6tEf_cs1QDt6VVXppFUMWQ/Strange%20Encounters.jpg
			//   https://garden.spoonflower.com/c/2558660/p/f/l/PAFqo1h4G_3z26u9fYDLZdkFpdWL6p-GIY6tEf_cs1QDt6VVXppFUMWQ/Strange%20Encounters.jpg
			// https://garden.spoonflower.com/c/14401951/i/xs/g4JEVfgPqb2EfYqHtkY6EVRZLjEn-SazeacYwiuBmqDTv7PMoVplbQ/14401951-annie-s-french-parrot-tulips-yellow-by-thehousethatlarsbuilt.jpg
			newsrc = src.replace(/(\/c\/+[0-9]+\/+.\/+(?:.\/+)?)(?:[sm]|xs)\//, "$1l/");
			if (newsrc !== src)
				return newsrc;

			// https://garden.spoonflower.com/?designs=14401951&size=s&formula=wallpaper_on_white
			//   https://garden.spoonflower.com/?designs=14401951&size=l&formula=wallpaper_on_white
			// other:
			// https://garden.spoonflower.com/?designs=14518633&size=l&formula=wallpaper_wall_front
			if (/\?(?:.*&)?designs=[0-9]+/.test(src)) {
				return src.replace(/([?&]size=)(?:[sm]|xs)([&#].*)?$/, "$1l$2");
			}

			// other:
			// https://s3.amazonaws.com/spoonflower/public/design_thumbnails/1440/1951/rAnnies_French_Parrot_Tulips_shop_thumb.png
			// https://spoonflower.s3.amazonaws.com/mugshots/335145/37B1D90E-94EE-4394-8B2F-F3B93A9E437E_preview.jpeg
		}

		if (domain === "store.unigine.com") {
			// thanks to anonymous for reporting:
			// https://store.unigine.com/api/media-files/91807191-f38f-4430-9a07-86d554d161d0?isPreview=1
			//   https://store.unigine.com/api/media-files/91807191-f38f-4430-9a07-86d554d161d0 -- 610x382
			if (/\/api\/+media-files\/+[-0-9a-f]{10,}/.test(src)) {
				return remove_queries(src, "isPreview");
			}
		}

		if (domain_nowww === "swissiceskating.ch") {
			// thanks to roi:
			// https://www.swissiceskating.ch/_default_upload_bucket/image-thumb__4794__uebersichtListe/speed-quebec.jpg
			//   https://www.swissiceskating.ch/_default_upload_bucket/speed-quebec.jpeg
			newsrc = src.replace(/(\/_default_upload_bucket\/+)image-thumb__[^/]+\/+/, "$1");
			if (newsrc !== src)
				return add_extensions_jpeg(newsrc);

			// thanks to roi:
			// https://www.swissiceskating.ch/_default_upload_bucket/schweizer-frauen-team-pursuit4_16-9.jpeg
			//   https://www.swissiceskating.ch/_default_upload_bucket/schweizer-frauen-team-pursuit4.jpeg
			return src.replace(/(\/_default_upload_bucket\/+[^/]+)_16-9(\.[a-z]+)(?:[?#].*)?$/, "$1$2")
		}

		if (domain === "mim.p7s1.io") {
			// thanks to roi:
			// https://mim.p7s1.io/pis/mw/1a4ajq5FgV8h73OMk30hSmQ3ksnTujGLThfZrJTemL4yREOdH4xmFMinlxemkCY1nZ8eOvuOHXqT69lkeQx2EfPTgCBdofDvzF6jm54Oi70UOg/profile:ezone-teaser940x528
			//   https://mim.p7s1.io/pis/mw/1a4ajq5FgV8h73OMk30hSmQ3ksnTujGLThfZrJTemL4yREOdH4xmFMinlxemkCY1nZ8eOvuOHXqT69lkeQx2EfPTgCBdofDvzF6jm54Oi70UOg/profile:original
			// https://mim.p7s1.io/pis/ld/e9e8zChLCVyZ-c1vEwXZAanB-DJ78rnq2V2gRWTHzVV6NywNWMSJCEGmZ4YSENP-WRL0b9lo2z_IfR63zTDrzZgVPU1C_Bs-q1UyOtErtP7vQ66yLAURn7F9Qzy_2jxg4stqAOah-GU/profile:original?w=1200&rect=643%2C0%2C3859%2C2894
			//   https://mim.p7s1.io/pis/ld/e9e8zChLCVyZ-c1vEwXZAanB-DJ78rnq2V2gRWTHzVV6NywNWMSJCEGmZ4YSENP-WRL0b9lo2z_IfR63zTDrzZgVPU1C_Bs-q1UyOtErtP7vQ66yLAURn7F9Qzy_2jxg4stqAOah-GU/profile:original
			return src.replace(/(\/pis\/+[^/]+\/+[^/]+\/+)profile[^/?#]+(?:[?#].*)?$/, "$1profile:original");
		}

		if (domain === "storage.fest2024.com") {
			// thanks to roi:
			// https://storage.fest2024.com/image/photo/images/F92D6E449EE1487C9F0F01D4C8D37B2D/410x280/f=webp
			//   https://storage.fest2024.com/image/photo/images/F92D6E449EE1487C9F0F01D4C8D37B2D
			// https://storage.fest2024.com/image/photo/images/F92D6E449EE1487C9F0F01D4C8D37B2D/410x280/m=crop
			//   https://storage.fest2024.com/image/photo/images/F92D6E449EE1487C9F0F01D4C8D37B2D
			return {
				url: src.replace(/(\/image\/+photo\/+images\/+[0-9A-F]{10,})\/.*/, "$1"),
				head_wrong_contenttype: true
			};
		}

		if (domain_nowww === "super.ru") {
			// https://super.ru/image/rs::3840:::/quality:5/plain/s3://super-static/prod/62a05d755c72ff4871ebd2ff-1900x.jpeg
			//   https://super.ru/image/rs:::::/quality:100/plain/s3://super-static/prod/62a05d755c72ff4871ebd2ff-1900x.jpeg
			// other:
			// https://api.eric.s3storage.ru/super-static/prod/61d88522853cde454af96efa-150x.webp
			return src.replace(/\/image\/+.*?s3:\/\//, "/image/rs:::::/quality:100/plain/s3://");
		}

		if (domain === "images.sr.roku.com") {
			// thanks to anonymous for reporting:
			// https://images.sr.roku.com/idType/roku/context/trc/id/220909ed519650ecb34e43aa34c276e2/images/gracenote/person/v4/AllPhotos/448398/448398_v4_bc.jpg/magic/fit-in/600x600
			//   https://images.sr.roku.com/idType/roku/context/trc/id/220909ed519650ecb34e43aa34c276e2/images/gracenote/person/v4/AllPhotos/448398/448398_v4_bc.jpg
			return src.replace(/(\.[a-z]+)\/+magic\/+fit-in\/+[0-9]+x[0-9]+(?:[?#].*)?$/, "$1");
		}

		if (domain === "cdn.directvelo.com") {
			// thanks to anonymous for reporting:
			// https://cdn.directvelo.com/mediacache/photo/uploads/media/photos/6653917c8ad56_thumb.JPG
			//   https://cdn.directvelo.com/uploads/media/photos/6653917c8ad56.JPG
			return src.replace(/\/mediacache\/+photo\/+(uploads\/.*?)_thumb\./, "/$1.");
		}

		if (domain_nowww === "usnews.com" && /\/object\/+image\//.test(src)) {
			obj = {
				url: src,
				can_head: false
			};

			// thanks to roi:
			// https://www.usnews.com/object/image/0000018d-cd8c-d59b-ad8d-eddecde50001/feb21-ukraine-01.jpg?update-time=1708550742040&size=responsiveGallery
			//   https://www.usnews.com/object/image/0000018d-cd8c-d59b-ad8d-eddecde50001/feb21-ukraine-01.jpg
			newsrc = src.replace(/\?.*$/, "");
			if (newsrc !== src) {
				obj.url = newsrc;
				return obj;
			}

			// thanks to Liz on discord:
			// https://www.usnews.com/object/image/0000015a-1a11-d479-a9df-9b35f2580000/bs17-michigan-crop-editorial.jpg?update-time=1487082026880&size=responsiveGallery
			//   https://www.usnews.com/object/image/0000015a-1a11-d479-a9df-9b35f2580000/bs17-michigan.jpg
			// https://www.usnews.com/object/image/0000015a-19ff-d479-a9df-99ff4ea90000/bs17-alabama-crop.jpg?update-time=1487082241162&size=responsiveGallery
			//   https://www.usnews.com/object/image/0000015a-19ff-d479-a9df-99ff4ea90000/bs17-alabama.jpg
			newsrc = src.replace(/-crop(?:-editorial)?(\.[a-z]+)$/, "$1");
			if (newsrc !== src) {
				obj.url = newsrc;
				return obj;
			}

			return obj;
		}

		if (domain === "rehost.diberie.com") {
			// thanks to Machou on github: https://github.com/qsniyg/maxurl/pull/1336
			// https://rehost.diberie.com/Picture/Get/t/293961
			//   https://rehost.diberie.com/Picture/Get/m/293961
			//   https://rehost.diberie.com/Picture/Get/f/293961 -- 4178x2350
			return src.replace(/(\/Picture\/+Get\/+)[rtm]\/+/, "$1f/");
		}

		if (domain === "images.sidearmdev.com") {
			// thanks to anonymous for reporting:
			// https://images.sidearmdev.com/crop?url=https%3A%2F%2Fdxbhsrqyrr690.cloudfront.net%2Fsidearm.nextgen.sites%2Ffsuni.sidearmsports.com%2Fimages%2F2023%2F7%2F5%2FSeminole_-_full_color_on_white_background.jpg&width=100&height=100&gravity=north&type=webp
			//   https://dxbhsrqyrr690.cloudfront.net/sidearm.nextgen.sites/fsuni.sidearmsports.com/images/2023/7/5/Seminole_-_full_color_on_white_background.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+crop\?(?:.*&)?url=([^&]+)(?:[&#].*)?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nosub === "twic.pics") {
			// thanks to anonymous for reporting:
			// https://numero.twic.pics/images/article/homepage/full/push-cover-andre3000-numero-magazine.jpg?twic=v1/quality=83/truecolor=true/output=jpeg/focus=800x395/cover=11:5/resize=1680
			//   https://numero.twic.pics/images/article/homepage/full/push-cover-andre3000-numero-magazine.jpg
			// https://saywho.twic.pics/https://saywho.fr/app/uploads/2019/06/20190627_06272019_VillaNoailles_Toulon-J1_269-1365x2048.jpg?twic=v1/cover=1365:2048/resize=370/max=1440
			//   https://saywho.twic.pics/https://saywho.fr/app/uploads/2019/06/20190627_06272019_VillaNoailles_Toulon-J1_269.jpg
			newsrc = remove_queries(src, "twic");
			if (newsrc !== src)
				return newsrc;

			return src.replace(/-[0-9]+x[0-9]+(\.[a-z]+)$/, "$1");
		}

		if ((domain_nowww === "4pda.to" ||
			 domain === "i.4pda.ws") && /:\/\/[^/]+\/+s\//.test(src)) {
			// thanks to anonymous for reporting:
			// https://4pda.to/s/as6yfz1IksFlRyBDvGH8dcO.gif
			if (/\/s\/+as6yfz1IksFlRyBDvGH8dcO\./.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}
		}

		if (domain_nowww === "pogd.es") {
			// thanks to anonymous for reporting:
			// https://pogd.es/assets/episodes/Douglas-Is-Cancelled/Douglas-Is-Cancelled-S01E04-0fcbb57ad109337707c3e8d36b847cc0-thumb.jpg
			//   https://pogd.es/assets/episodes/Douglas-Is-Cancelled/Douglas-Is-Cancelled-S01E04-0fcbb57ad109337707c3e8d36b847cc0-full.jpg
			return src.replace(/(\/assets\/+.*?-[0-9a-f]{10,})-thumb\./, "$1-full.");
		}

		if (domain === "cdn.moviestillsdb.com") {
			// thanks to anonymous for reporting:
			// https://cdn.moviestillsdb.com/images/spacer.png
			if (/\/images\/+spacer\.png/.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}

			// https://cdn.moviestillsdb.com/i/160x/4ycwvv3e/mary-poppins-sm.jpg
			//   https://cdn.moviestillsdb.com/i/500x/4ycwvv3e/mary-poppins-sm.jpg
			return src.replace(/\/i\/+160x\/+/, "/i/500x/");
		}

		if (domain === "renginiai.kasvyksta.lt") {
			// thanks to anonymous for reporting:
			// https://renginiai.kasvyksta.lt/uploads/events/131316/medthumb/la_mer_2024_ventoji.jpg
			//   https://renginiai.kasvyksta.lt/uploads/events/131316/la_mer_2024_ventoji.jpg
			// https://renginiai.kasvyksta.lt/uploads/events/131382/thumb/448174230_899653408842705_7479100982827670299_n_1.jpg
			//   https://renginiai.kasvyksta.lt/uploads/events/131382/448174230_899653408842705_7479100982827670299_n_1.jpg
			return src.replace(/(\/uploads\/+[^/]+\/+[0-9]+\/+)(?:med)?thumb\/+/, "$1");
		}

		if (domain_nosub === "scrolller.com") {
			// https://yocto.scrolller.com/doug-at-sunset-9cy1fpzekr-1626x1080.jpg
			// https://images.scrolller.com/yocto/doug-at-sunset-9cy1fpzekr.webp
			//   https://images.scrolller.com/yocto/doug-at-sunset-9cy1fpzekr.jpg
			if (/-[0-9a-z]{5,}-[0-9]+x[0-9]+\./.test(src)) {
				newsrc = src.replace(/-[0-9]+x[0-9]+(\.[a-z]+)(?:[?#].*)?$/, "$1");
				if (newsrc !== src)
					return newsrc;
			}

			newsrc = src.replace(/\.webp(?:[?#].*)?$/, ".jpg");
			if (newsrc !== src)
				return newsrc;

			newsrc = src.replace(/-(?:poster|mobile)\.[a-z0-9]+(?:[?#].*)?$/, ".mp4");
			if (newsrc === src)
				newsrc = src.replace(/:\/\/images\.scrolller\.com\/+yocto\/+([^/]+-[a-z0-9]{5,})\.jpg$/, "://zepto.scrolller.com/$1.mp4");
			if (newsrc !== src)
				return {
					url: newsrc.replace(/:\/\/images\.scrolller\.com\/+([^/]+)\/+/, "://$1.scrolller.com/"),
					video: true
				};
		}

		if (domain === "cdn.rockislandauction.com") {
			// thanks to anonymous for reporting:
			// https://cdn.rockislandauction.com/dev_cdn/88/thumbs/1220.jpg?cachebust=2023-04-05T19:36:32.000Z
			//   https://cdn.rockislandauction.com/dev_cdn/88/1220.jpg?cachebust=2023-04-05T19:36:32.000Z
			return src.replace(/(\/dev_cdn\/+[0-9]+\/+)thumbs\/+/, "$1");
		}

		if (domain === "assets.playbill.com") {
			// thanks to anonymous for reporting:
			// https://assets.playbill.com/editorial/_enhancementPortrait/91161ff7e0c3a7d3eeb709e828246c72-kiss-me-kate-broadway-kelli-ohara-amanda-green-feature-shoot-2018-08-hr.jpg
			//   https://assets.playbill.com/editorial/91161ff7e0c3a7d3eeb709e828246c72-kiss-me-kate-broadway-kelli-ohara-amanda-green-feature-shoot-2018-08-hr.jpg
			return src.replace(/(\/editorial\/+)_enhancementPortrait\/+/, "$1");
		}

		if (domain === "cdn.s-cloud.fi") {
			// thanks to anonymous for reporting:
			// https://cdn.s-cloud.fi/v1/w384_h384_q75/assets/dam-id/9HD-GtG6a4N8Lgp_kDMq2J.jpg
			//   https://cdn.s-cloud.fi/v1/assets/dam-id/9HD-GtG6a4N8Lgp_kDMq2J.jpg
			return src.replace(/(\/v1\/+)[^/]+\/+assets\/+/, "$1assets/");
		}

		if (domain_nowww === "likey.me") {
			// thanks to Broly on discord for reporting

			let get_likey_device_id = function(cb) {
				get_localstorage("https://likey.me/", ["deviceUUID"], function(data) {
					if (data && data["deviceUUID"]) {
						return cb(data["deviceUUID"]);
					}

					return cb(null);
				});
			};

			let get_likey_distinct_id = function(cb) {
				if (!options.get_cookies) {
					return cb(null);
				}

				options.get_cookies("https://likey.me/", function(cookies) {
					if (!cookies) {
						console_error("Unable to get cookies for likey.me");
						return cb(null);
					}

					cookies = headers_list_to_dict(cookies);
					if (!("MIXPANEL_UUID" in cookies)) {
						console_error("MIXPANEL_UUID doesn't exist, try visiting likey.me");
						return cb(null);
					}

					cb(cookies["MIXPANEL_UUID"] || null);
				});
			};

			let query_likey_api = function(url, cb) {
				get_likey_device_id(function(deviceid) {
					get_likey_distinct_id(function(distinctid) {
						// TODO: if !deviceid/!distinctid, generate random UUIDs

						let headers = {
							Accept: "application/json, text/plain, */*",
							Origin: "https://likey.me",
							Referer: "https://likey.me/",
							"Sec-Fetch-Dest": "empty",
							"Sec-Fetch-Mode": "cors",
							"Sec-Fetch-Site": "same-site"
						};

						if (deviceid && distinctid) {
							headers["X-Distinct-Id"] = distinctid;
							headers["X-Likey-Platform"] = "web; version=6.54.0; device=" + deviceid;
						}

						api_query("likey:" + url, {
							url: url,
							headers: headers,
							imu_mode: "xhr",
							json: true
						}, cb, function(done, resp, cache_key) {
							if (!resp)
								return done(null, false);

							done(resp, 60*60);
						})
					});
				});
			}

			let query_likey_post = function(id, cb) {
				query_likey_api("https://api.likey.me/api/post/" + id, cb);
			};

			let get_likey_imageid = function(url) {
				let match = url.match(/\/media\/+[0-9]+\/+([a-z]+_[0-9]+_[0-9]+)_[0-9a-f]{10,}/);
				if (!match)
					return null;
				return match[1];
			};

			let query_likey_post_imu = function(id, cb) {
				query_likey_post(id, function(data) {
					if (!data)
						return cb(null);

					let base = {
						extra: {
							page: "https://likey.me/post/" + id,
							caption: data.post.content,
							created_date: new Date(data.post.createdAt).getTime(),
							updated_date: new Date(data.post.updatedAt).getTime()
						}
					};

					let links = [];

					let i = 0;
					for (let attach of data.post.attachments) {
						if (attach.mediaType !== "image") {
							console.warn("mediaType != image, unhandled");
							continue;
						}

						let ids = [];
						ids.push(i);
						ids.push(get_likey_imageid(attach.url));
						if (attach.thumbnailUrl)
							ids.push(get_likey_imageid(attach.thumbnailUrl));

						links.push({
							url: base.extra.page + "#imu-i=" + i,
							real_url: attach.url,
							x_id: ids.join("|"),
							is_current: false
						});

						i++;
					}

					links[0].is_current = true;

					base.album_info = {
						type: "links",
						links: links
					};

					base.url = links[0].real_url;

					cb(base);
				});
			};

			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+post\/+([0-9]+)(?:[?#].*)?$/,
				run: function(cb, match) {
					query_likey_post_imu(match[1], function(obj) {
						if (!obj)
							return cb(null);

						let imu_imageid = null;
						let imu_i = null;
						var queries = common_functions["parse_imu_hash"](src);
						if (queries) {
							if (queries.image) {
								imu_imageid = get_likey_imageid(decodeURIComponent(queries.image));
							}

							if (queries.i)
								imu_i = queries.i;
						}

						if (imu_imageid !== null) {
							common_functions["update_album_info_links"](obj, function(x) {
								let ids = x.split("|");
								for (let i of ids) {
									if (imu_imageid === i)
										return true;
								}

								return false;
							});
						}

						if (imu_i !== null) {
							common_functions["update_album_info_links"](obj, function(x) {
								let ids = x.split("|");
								return ids[0] === imu_i;
							});
						}

						cb(obj);
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if (host_domain_nowww === "likey.me" && domain === "static.likeycontents.xyz" && options.element) {
			if (options.host_url && /\/post\/+[0-9]+/.test(options.host_url)) {
				let parent = common_functions["get_parent_el_matching"](options.element, x => {
					return x.tagName === "DIV" && x.classList.contains("attachment");
				});

				if (parent) {
					return {
						url: options.host_url + "#imu-image=" + encodeURIComponent(src),
						is_pagelink: true
					};
				}
			}
		}

		if (domain_nowww === "gameuidatabase.com") {
			// thanks to anonymous for reporting:
			// https://www.gameuidatabase.com/uploads/Pacific-Drive03112024-061804-15631_thumb.jpg
			//   https://www.gameuidatabase.com/uploads/Pacific-Drive03112024-061804-15631.jpg
			return src.replace(/(\/uploads\/+[^/]+)_thumb\./, "$1.");
		}

		if (domain === "images-ng.pixai.art") {
			// thanks to Broly on discord:
			// https://images-ng.pixai.art/images/stillThumb/1279d38b-2106-49b4-8f0f-d5efd0da9ac7
			//   https://images-ng.pixai.art/images/orig/1279d38b-2106-49b4-8f0f-d5efd0da9ac7
			return src.replace(/(\/images\/+)stillThumb\/+/, "$1orig/");
		}

		if (domain_nowww === "gazetapress.com") {
			// thanks to anonymous for reporting:
			// https://www.gazetapress.com/assets/img/zoom-ico.png
			if (/\/assets\/+img\/+zoom-ico\./.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}

			// https://old.gazetapress.com/v.php?1:2097231:3 -- no watermark
			// https://old.gazetapress.com/v.php?1:2097231:6 -- larger with watermark
		}

		if (domain_nosub === "bdnodes.net" && /^blockdaemon-audius-content/.test(domain)) {
			// thanks to siloricity on discord:
			// https://blockdaemon-audius-content-07.bdnodes.net/content/01J4WQW2KK0DSVWJG461AVD7ZH/1000x1000.jpg
			//   https://blockdaemon-audius-content-07.bdnodes.net/content/01J4WQW2KK0DSVWJG461AVD7ZH/original.jpg
			return src.replace(/(\/content\/+[0-9A-Z]+\/+)[0-9]+x[0-9]+\./, "$1original.");
		}

		if (domain === "cdn-image.zvuk.com") {
			// thanks to karpuzikov on github: https://github.com/qsniyg/maxurl/issues/1348
			// https://cdn-image.zvuk.com/pic?type=release&id=2040642&size=1920x1920&hash=...
			//   https://cdn-image.zvuk.com/pic?type=release&id=2040642
			if (/:\/\/[^/]+\/+pic\?/.test(src)) {
				return keep_queries(src, ["type", "id"]);
			}
		}

		if (domain === "files.magzter.com") {
			// thanks to anonymous for reporting:
			// https://files.magzter.com/resize/magazine/1658834503/1722600547/thumb/3.jpg
			//   https://files.magzter.com/resize/magazine/1658834503/1722600547/view/3.jpg
			//   https://files.magzter.com/resize/magazine/1658834503/1722600547/view/4.jpg -- 1280x1706
			// https://files.magzter.com/1658834503/1722600547/svg/1/thumb.jpg
			//   https://files.magzter.com/resize/magazine/1658834503/1722600547/view/1.jpg
			//   https://files.magzter.com/resize/magazine/1658834503/1722600547/view/4.jpg
			// https://files.magzter.com/resize/magazine/1603054202/1710958596/view/1.jpg
			//   https://files.magzter.com/resize/magazine/1603054202/1710958596/view/3.jpg -- 960x1288
			//   https://files.magzter.com/resize/magazine/1603054202/1710958596/view/4.jpg -- 403
			// https://x3na3ivqdj.execute-api.eu-west-1.amazonaws.com/prod/resize?src=magztereuro&region=eu-west-1&dest=magztereuroresized&key=/magazine/1603054202/1710958596/view/5.jpg -- {"message":"Invaid image size 5"}
			return src
				.replace(/(\/resize\/+.*\/view\/+)3\./, "$14.")
				.replace(/(\/resize\/+.*\/view\/+)[1-2]\./, "$13.")
				.replace(/(\/resize\/+[^/]+\/+[0-9]+\/+[0-9]+\/+)thumb\//, "$1view/")
				.replace(/(:\/\/[^/]+\/+)([0-9]+\/+[0-9]+\/+)svg\/+([0-9]+)\/+thumb\./, "$1resize/magazine/$2thumb/$3.");
		}

		if (domain_nosub === "c01.co" && /^file[0-9]+\./.test(domain)) {
			// thanks to leoli1110 on github: https://github.com/qsniyg/maxurl/issues/1337
			// https://file01.es.c01.co/upload/E9E55B4EDD33C8E0/202402/4768047368473278140.jpg_120x160.ashx
			//   https://file01.es.c01.co/upload/E9E55B4EDD33C8E0/202402/4768047368473278140.jpg -- 3750x5000
			return src.replace(/(\/upload\/+[0-9A-F]+\/+[0-9]{6}\/+[^/?#]+\.[a-z]+)_[0-9]+x[0-9]+\.ashx(?:[?#].*)?$/, "$1");
		}

		if (domain_nosub === "berapt.com" && /^cdn[0-9]*\./.test(domain)) {
			// thanks to Froktime on github: https://github.com/qsniyg/maxurl/issues/1350
			if (/\/i\/+[^/]+\/+[0-9a-f/]+\//.test(src)) {
				return add_queries(keep_queries(src, ["h", "p", "s"]), {"size": "origin"});
			}
		}

		if (amazon_container === "kirja") {
			// thanks to fyhtma on github: https://github.com/qsniyg/maxurl/issues/1353
			// https://kirja.s3.amazonaws.com/prod/9789520425715_frontcover_final_medium.jpg
			//   https://kirja.s3.amazonaws.com/prod/9789520425715_frontcover_final_large.jpg
			//   https://kirja.s3.amazonaws.com/prod/9789520425715_frontcover_final_original.jpg -- 1642x2610
			return src.replace(/(\/prod\/+[0-9]+_[_a-z]+_)(?:small|medium|large)\./, "$1original.");
		}

		if (domain === "img.edilportale.com") {
			// thanks to anonymous for reporting:
			// https://img.edilportale.com/product-thumbs/b_FLETCHER-Laskasas-570394-rel672028f4.jpg
			//   https://img.edilportale.com/products/FLETCHER-Laskasas-570394-rel672028f4.jpg
			return src.replace(/\/product-thumbs\/+[a-z]_/, "/products/");
		}

		if (domain_nowww === "arts-crafts.ca") {
			// thanks to anonymous for reporting:
			// https://arts-crafts.ca/filesthumbs500//files/covers/b9dde17c46593bc29d54a904b885277a6326.jpg
			//   https://arts-crafts.ca/files/covers/b9dde17c46593bc29d54a904b885277a6326.jpg
			return src.replace(/(:\/\/[^/]+\/+)filesthumbs[0-9]+\/+files\//, "$1files/");
		}

		if (domain_nowww === "quto.ru") {
			// thanks to anonymous for reporting:
			// https://quto.ru/thumb/0x88/filters:quality(75):no_upscale()/imgs/2024/08/23/10/6571279/3fb09a3ad148105104943ce7bc3f438b99571ea0.jpg
			//   https://quto.ru/imgs/2024/08/23/10/6571279/3fb09a3ad148105104943ce7bc3f438b99571ea0.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+thumb\/+/, "/");
			if (newsrc !== src)
				return "https://" + domain + "/" + common_functions["get_thumbor_url"](newsrc);
		}

		if (domain_nowww === "thespiderawards.com") {
			// thanks to remlap for reporting:
			// https://www.thespiderawards.com/gallery//magicimage.php?img=/home/thespiderawards/public_html/uploads/1679466/20/1679466_Paul_06041666431_Grayscale.jpg&img_size=580
			//   https://www.thespiderawards.com/uploads/1679466/20/1679466_Paul_06041666431_Grayscale.jpg
			// https://www.thespiderawards.com/gallery/scripts/optimize_image.php?img=/home/thespiderawards/public_html/uploads/571691/16/571691_senior_jeremy_cathedralcove.jpg&img_size=400
			//   https://www.thespiderawards.com/uploads/571691/16/571691_senior_jeremy_cathedralcove.jpg
			match = src.match(/\/gallery\/.*[?&]img=\/home\/+thespiderawards\/+public_html\/+(uploads\/.*?)(?:[&#].*)?$/);
			if (match)
				return "https://" + domain + "/" + decodeURIComponent(match[1]);
		}

		if (domain === "d34okl4jnxrvy2.cloudfront.net") {
			// thanks to anonymous for reporting:
			// https://medina-gazette.com/news/348855/commentary-year-away-from-the-game-might-have-given-ravens-wr-odell-beckham-jr-a-new-perspective/
			// https://d34okl4jnxrvy2.cloudfront.net/MTS_Beta_Elyria/0/0/0/0/292/868/292868_1
			//   https://d34okl4jnxrvy2.cloudfront.net/MTS_Beta_Elyria/0/0/0/0/292/868/292868
			return src.replace(/(\/(?:[0-9]+\/+){6}[0-9]+)(?:_[01])(?:[?#].*)?$/, "$1");
		}

		if (domain_nowww === "ffish.asia") {
			// thanks to anonymous for reporting:
			// https://ffish.asia/_file/small/72/OYK176-W03_080309_n061_NEF.jpg
			//   https://ffish.asia/_file/large/72/OYK176-W03_080309_n061_NEF.jpg
			return src.replace(/(\/_file\/+)small\/+/, "$1large/");
		}

		if (domain === "contents.kyobobook.co.kr") {
			// thanks to Froktime on github: https://github.com/qsniyg/maxurl/issues/1360
			// https://contents.kyobobook.co.kr/sih/fit-in/458x0/pdt/9791193638361.jpg
			//   https://contents.kyobobook.co.kr/pdt/9791193638361.jpg
			// https://contents.kyobobook.co.kr/sih/filters:format(webp)/fit-in/380x590/pdt/480D240616840.jpg
			//   https://contents.kyobobook.co.kr/pdt/480D240616840.jpg
			return src.replace(/\/sih\/.*\/pdt\/+/, "/pdt/");
		}

		if (domain === "d1rig8ldkblbsy.cloudfront.net") {
			// thanks to anonymous for reporting:
			// https://d1rig8ldkblbsy.cloudfront.net/app/uploads/2024/09/06123104/gettyimages-2169330625-crop-1725628081-1920x1080.jpg
			//   https://d1rig8ldkblbsy.cloudfront.net/app/uploads/2024/09/06123104/gettyimages-2169330625.jpg
			return src.replace(/(\/app\/+uploads\/+[0-9]{4}\/+[0-9]{2}\/+[0-9]+\/+[^/]+)-crop-[0-9]+-[0-9]+x[0-9]+\./, "$1.");
		}

		if (domain === "media-img.lucyinthesky.com") {
			// thanks to anonymous for reporting:
			// https://media-img.lucyinthesky.com/data/Sep24/760xAUTO/21bf7e8d-581e-44a8-bceb-af944c272f07.jpg
			//   https://media-img.lucyinthesky.com/data/Sep24/21bf7e8d-581e-44a8-bceb-af944c272f07.jpg
			// https://media-img.lucyinthesky.com/1700xAUTO/b0996b6c-0ac5-4021-9173-7a537dd1b516.jpg
			//   https://media-img.lucyinthesky.com/b0996b6c-0ac5-4021-9173-7a537dd1b516.jpg
			return src.replace(/(:\/\/[^/]+\/+(?:data\/+[^/]+\/+)?)[0-9AUTO]+x[0-9AUTO]+\/+/, "$1");
		}

		if (domain === "bilder.tragant.de") {
			// thanks to fyhtma on github: https://github.com/qsniyg/maxurl/issues/1362
			// https://bilder.tragant.de/produkte/leiste/6185535ddfc404.16360188.jpg -- 50x38
			//   https://bilder.tragant.de/produkte/orig/6185535ddfc404.16360188.jpg -- 700x530
			//   https://bilder.tragant.de/produkte/hoch/6185535ddfc404.16360188.jpg -- 2000x1514
			return src
				.replace(/(\/produkte\/+)orig\/+/, "$1hoch/")
				.replace(/(\/produkte\/+)leiste\/+/, "$1orig/");
		}

		if (amazon_container === "media.kompakt.fm" ||
			// http://media.kompakt.fm/01/assets/releases/fitted/ext016-pshal_p_shaw.jpg?v=1
			//   http://media.kompakt.fm/01/assets/releases/original/ext016-pshal_p_shaw.jpg?v=1
			domain === "media.kompakt.fm") {
			// thanks to acidzab on github: https://github.com/qsniyg/maxurl/issues/1357
			// https://s3.amazonaws.com/media.kompakt.fm/01/assets/releases/fitted/ext016-pshal_p_shaw.jpg?v=1
			//   https://s3.amazonaws.com/media.kompakt.fm/01/assets/releases/original/ext016-pshal_p_shaw.jpg?v=1
			return src.replace(/(\/assets\/+releases\/+)fitted\/+/, "$1original/");
		}

		if (domain_nowww === "px-monkey.com" ||
			// thanks to fyhtma on github: https://github.com/qsniyg/maxurl/issues/1335
			// http://cdn.myshoptet.com/usr/www.px-monkey.com/user/shop/related/13020-1_nam-the-vietnam-experience-1965-1975-vol--1-2.jpg?63efb864
			//   https://cdn.myshoptet.com/usr/www.px-monkey.com/user/shop/orig/13020-1_nam-the-vietnam-experience-1965-1975-vol--1-2.jpg?63efb864
			(domain === "cdn.myshoptet.com" && /\.px-monkey\.com\//.test(src))) {
			// https://www.px-monkey.com/user/shop/related/13020-1_nam-the-vietnam-experience-1965-1975-vol--1-2.jpg?63efb864
			//   https://www.px-monkey.com/user/shop/orig/13020-1_nam-the-vietnam-experience-1965-1975-vol--1-2.jpg?63efb864
			return src.replace(/(\/user\/+shop\/+)(?:related|big)\/+/, "$1orig/");
		}

		if (domain === "static.esquire.de") {
			// thanks to sn3akyb3ar on github: https://github.com/qsniyg/maxurl/issues/1334
			// https://static.esquire.de/3000x4286/focal_1500x1500:1501x1501/images/2022-07/au2357226-1730ff54f3c-1171671-2.jpg
			//   https://backend.esquire.de/sites/esquire.de/files/images/2022-07/au2357226-1730ff54f3c-1171671-2.jpg -- 4912x7360
			return src.replace(/:\/\/[^/]+\/+[0-9]+x[0-9]+\/+.*?\/+images\//, "://backend.esquire.de/sites/esquire.de/files/images/");
		}

		if (domain === "resize.cdn.otakumode.com") {
			// thanks to anonymous for reporting:
			// https://resize.cdn.otakumode.com/ex/700.466/shop/product/182fb47cd62b4f25b5f432a862367fd9.jpg.webp
			//   https://resize.cdn.otakumode.com/full/shop/product/182fb47cd62b4f25b5f432a862367fd9.jpg
			// https://resize.cdn.otakumode.com/ex/240.240/248.88.461.462/shop/product/2d070aed31de478b855b0ff843d191ca.jpg.webp
			//   https://resize.cdn.otakumode.com/full/shop/product/2d070aed31de478b855b0ff843d191ca.jpg
			return {
				url: src
					.replace(/(\.[a-z]+)\.webp(?:[?#].*)?$/, "$1")
					.replace(/\/ex\/+.*?\/+shop\//, "/full/shop/"),
				can_head: false // 415
			};
		}

		if (domain_nowww === "dsreps.com") {
			// thanks to anonymous for reporting:
			// https://www.dsreps.com/images/pics/500/Jhxe0c_nike_trail_fa24_tour-du-mont-blanc_social_post_01ejpeg.jpg
			//   https://www.dsreps.com/images/pics/Jhxe0c_nike_trail_fa24_tour-du-mont-blanc_social_post_01ejpeg.jpg
			return src.replace(/(\/images\/+pics\/+)[0-9]+\/+/, "$1");
		}

		if (domain === "img.hdseries.cc" ||
			// https://img.goku.sx/xxrz/250x400/576/07/68/0768fd5ee5450a60532270c3a2eb06e8/0768fd5ee5450a60532270c3a2eb06e8.jpg
			//   https://img.goku.sx/xxrz/99999x99999/100/07/68/0768fd5ee5450a60532270c3a2eb06e8/0768fd5ee5450a60532270c3a2eb06e8.jpg
			domain === "img.goku.sx" ||
			// https://img.curiousanimal.tv/xxrz/250x400/1117/3b/23/3b23b68886b33f8881de82da4b5241db/3b23b68886b33f8881de82da4b5241db.jpg
			//   https://img.curiousanimal.tv/xxrz/99999x99999/100/3b/23/3b23b68886b33f8881de82da4b5241db/3b23b68886b33f8881de82da4b5241db.jpg
			domain === "img.curiousanimal.tv" ||
			// https://img.myflixerz.to/xxrz/250x400/201/14/1e/141e0669171ded5ede579b4f3fe21835/141e0669171ded5ede579b4f3fe21835.jpg
			//   https://img.myflixerz.to/xxrz/99999x99999/100/14/1e/141e0669171ded5ede579b4f3fe21835/141e0669171ded5ede579b4f3fe21835.jpg
			domain === "img.myflixerz.to") {
			// thanks to anonymous for reporting:
			// https://img.hdseries.cc/xxrz/1280x720/100/83/b4/83b4c8018dd42da223242fb8b34d5c56/83b4c8018dd42da223242fb8b34d5c56.jpg
			//   https://img.hdseries.cc/xxrz/99999x99999/100/83/b4/83b4c8018dd42da223242fb8b34d5c56/83b4c8018dd42da223242fb8b34d5c56.jpg
			return src.replace(/\/xxrz\/+[0-9]+x[0-9]+\/+[0-9]+\/+/, "/xxrz/99999x99999/100/");
		}

		if (domain === "lirp.cdn-website.com") {
			// thanks to remlap:
			// https://lirp.cdn-website.com/15061b4e/dms3rep/multi/opt/57408_05-1920w.jpg
			//   https://irp.cdn-website.com/15061b4e/dms3rep/multi/57408_05.jpg
			return src.replace(/(:\/\/)l(.*)\/opt\/+([^/]+)-[0-9]+w\./, "$1$2/$3.")
		}

		if (domain === "c.fotka.com") {
			// thanks to anonymous for reporting:
			// https://c.fotka.com/a.fotka.pl/140/932/140932490_300_s.1726826522.jpg
			//   https://c.fotka.com/a.fotka.pl/140/932/140932490_1350_s.1726826522.jpg
			return src.replace(/(\/[0-9]+)_300_s(\.[0-9]+\.[a-z]+)(?:[?#].*)?$/, "$1_1350_s$2");
		}

		if (domain_nowww === "brookenipar.com") {
			// thanks to anonymous for reporting:
			// https://brookenipar.com/media/pages/index/kyra-sedgwick/d7d9e9d7a4-1626404415/210303-people-kyra-0421-v1-1000x.jpg
			//   https://brookenipar.com/media/pages/index/kyra-sedgwick/d7d9e9d7a4-1626404415/210303-people-kyra-0421-v1-3000x.jpg -- 1580x2370
			// https://brookenipar.com/media/pages/home/ba5d101b60-1682398026/2304011-yara-b0201-2000x.jpg
			//   https://brookenipar.com/media/pages/home/ba5d101b60-1682398026/2304011-yara-b0201-3000x.jpg
			// https://brookenipar.com/media/pages/home/d4f36e8f7c-1684354875/080222-florence-triplebounce-2163-copy-1500x.jpg
			//   https://brookenipar.com/media/pages/home/d4f36e8f7c-1684354875/080222-florence-triplebounce-2163-copy-3000x.jpg
			// https://brookenipar.com/media/pages/index/christen-2/aaa0a1e06e-1682402184/christen-02-0278-portra400-400x.jpg
			//   https://brookenipar.com/media/pages/index/christen-2/aaa0a1e06e-1682402184/christen-02-0278-portra400-3000x.jpg
			return src
				.replace(/(\/media\/+pages\/+.*-)2000x(\.[a-z]+)(?:[?#].*)?$/, "$13000x$2")
				.replace(/(\/media\/+pages\/+.*-)1500x(\.[a-z]+)(?:[?#].*)?$/, "$12000x$2")
				.replace(/(\/media\/+pages\/+.*-)1000x(\.[a-z]+)(?:[?#].*)?$/, "$11500x$2")
				.replace(/(\/media\/+pages\/+.*-)[1-9]00x(\.[a-z]+)(?:[?#].*)?$/, "$11000x$2");
		}

		if (domain_nowww === "publicdomainpictures.net") {
			// thanks to anonymous for reporting:
			// https://publicdomainpictures.net/pictures/370000/t2/travel-paris-france-poster-1596965769Q8C.jpg
			//   https://publicdomainpictures.net/pictures/370000/velka/travel-paris-france-poster-1596965769Q8C.jpg
			return src.replace(/(\/pictures\/+[0-9]+\/+)t2?\/+/, "$1velka/");
		}

		if (domain === "img.alice-books.com") {
			// thanks to anonymous for reporting:
			// https://img.alice-books.com/images/d5285ec9bd1cd3d5679e66ccb9ea20c62324c-s.jpg
			//   https://img.alice-books.com/images/d5285ec9bd1cd3d5679e66ccb9ea20c62324c-h.jpg
			return src.replace(/(\/images\/+[0-9a-f]{10,})-[sl]\./, "$1-h.");
		}

		if (domain_nowww === "pakartot.lt") {
			// thanks to anonymous for reporting:
			// https://www.pakartot.lt/assets/upload/images/19/180x180/1727704693-41819.jpg -- 180x180
			//   https://www.pakartot.lt/assets/upload/images/19/348x348/1727704693-41819.jpg -- 348x348
			//   https://www.pakartot.lt/assets/upload/images/19/1727704693-41819.jpg -- 3456x3456
			return src.replace(/(\/upload\/+images\/+[0-9]+\/+)[0-9]+x[0-9]+\/+/, "$1");
		}

		if (domain === "pics.videospace.fi") {
			// thanks to fyhtma on github: https://github.com/qsniyg/maxurl/issues/1372
			// https://pics.videospace.fi/xs-front-3418-1499357223-128.jpeg
			//   https://pics.videospace.fi/sm-front-3418-1499357223-128.jpeg
			//   https://pics.videospace.fi/md-front-3418-1499357223-128.jpeg
			//   https://pics.videospace.fi/lg-front-3418-1499357223-128.jpeg
			return src.replace(/(:\/\/[^/]+\/+)(?:xs|sm|md)-/, "$1lg-");
		}

		if (domain === "lain.bgm.tv") {
			// thanks to anonymous for reporting
			// https://lain.bgm.tv/r/400/pic/cover/l/be/b4/313495_oVVzV.jpg
			//   https://lain.bgm.tv/pic/cover/l/be/b4/313495_oVVzV.jpg
			// https://lain.bgm.tv/pic/cover/s/be/b4/313495_oVVzV.jpg
			//   https://lain.bgm.tv/pic/cover/l/be/b4/313495_oVVzV.jpg
			// https://lain.bgm.tv/r/100x100/pic/cover/l/19/08/513530_Tj6ZC.jpg
			//   https://lain.bgm.tv/pic/cover/l/19/08/513530_Tj6ZC.jpg
			return src
				.replace(/(:\/\/[^/]+\/+pic\/+cover\/+)[sm]\/+/, "$1l/")
				.replace(/(:\/\/[^/]+\/+)r\/+[0-9]+(?:x[0-9]+)?\/+/, "$1");
		}

		if (domain === "7e976cce9a89fb6e94ae-41f429bd6382725167ffe9004a84287b.ssl.cf1.rackcdn.com") {
			// thanks to anonymous for reporting:
			// https://7e976cce9a89fb6e94ae-41f429bd6382725167ffe9004a84287b.ssl.cf1.rackcdn.com/dxthm1000.LT_091118_2149Double.jpg
			//   https://7e976cce9a89fb6e94ae-41f429bd6382725167ffe9004a84287b.ssl.cf1.rackcdn.com/LT_091118_2149Double.jpg
			return src.replace(/\/dxthm[0-9]+\.([^/]+)(?:[?#].*)?$/, "/$1");
		}

		if (domain_nowww === "bit192.info") {
			// thanks to siloricity on discord:
			// https://bit192.info/labs/images/ts_wp/wp_haunteddance2_thumb.jpg
			//   https://bit192.info/labs/images/ts_wp/wp_haunteddance2.jpg
			return src.replace(/(\/images\/+ts_wp\/+[^/]+)_thumb\./, "$1.");
		}

		if (domain_nowww === "asahicom.jp") {
			// thanks to fireattack on discord:
			// https://www.asahicom.jp/imgopt/img/85c304f88d/hd640/AS20241008003992.jpg -- 640x425
			//   https://www.asahicom.jp/imgopt/img/85c304f88d/comm_L/AS20241008003992.jpg -- 300x200
			//   https://www.asahicom.jp/imgopt/img/85c304f88d/comm/AS20241008003992.jpg -- 2000x1330
			// other:
			// https://www.asahicom.jp/articles/images/AS20241008003992_comm.jpg -- 640x425
			//   https://www.asahicom.jp/articles/images/AS20241008003992_comm.jpg?iref=pc_extlink -- 2000x1330
			return {
				url: src
					.replace(/(\/articles\/+images\/+AS[0-9]+_comm\.[a-z]+)$/, "$1?iref=pc_extlink")
					.replace(/(\/imgopt\/+img\/+[0-9a-f]+\/+)(?:hd640|comm_L)\/+/, "$1comm/"),
				can_head: false // 403
			};
		}

		if (domain === "blutv-images.mncdn.com") {
			// thanks to anonymous for reporting:
			// https://blutv-images.mncdn.com/q/t/i/bluv2/10/480x740/6384d3e1866ac308c06aecff
			//   https://blutv-images.mncdn.com/q/t/i/bluv2/100/0x0/6384d3e1866ac308c06aecff
			return src.replace(/(\/bluv2\/+)[0-9]+\/+[0-9]+x[0-9]+\/+/, "$1100/0x0/");
		}

		if (domain === "img.imageboss.me") {
			// thanks to anonymous for reporting:
			// https://imageboss.me/docs/operations/cover
			// https://img.imageboss.me/rinse-fm/cover:smart/1200x1200/format:webp/HANNAH_DIAMOND_PRESSIMAGES-Harriet-Hall.jpeg
			//   https://img.imageboss.me/rinse-fm/cdn/HANNAH_DIAMOND_PRESSIMAGES-Harriet-Hall.jpeg -- 2000x1333
			// https://img.imageboss.me/imperialgroup/width/371/format:webp,dpr:2/site/Category-Page-Main-Images/2019-United-Way-Day-of-Caring-2.jpg
			//   https://img.imageboss.me/imperialgroup/width/371/format:webp,dpr:2/site/Category-Page-Main-Images/2019-United-Way-Day-of-Caring-2.jpg
			if (!/[?&]bossToken=/.test(src))
				return src.replace(/(:\/\/[^/]+\/+[^/]+\/+)(?:(?:cover(?::[^/]+)?\/+[0-9]+x[0-9]+|[-a-z]+:[^/]+|(?:width|height)\/+[0-9]+)\/+)+/, "$1cdn/");
		}

		if (domain === "apicms.thestar.com.my") {
			// thanks to anonymous for reporting:
			// https://apicms.thestar.com.my/uploads/images/2024/10/29/thumbs/700/2991943.webp
			//   https://apicms.thestar.com.my/uploads/images/2024/10/29/2991943.webp
			return src.replace(/(\/uploads\/+images\/+.*\/+)thumbs\/+[0-9]+\/+/, "$1");
		}

		if (domain_nowww === "theimagefile.com") {
			// thanks to anonymous for reporting:
			// https://www.theimagefile.com/v/nr/i/t.png
			if (/\/v\/+nr\/+i\/+t\.png(?:[?#].*)?$/.test(src)) {
				return {
					url: src,
					bad: "mask"
				};
			}
		}

		if (domain === "cdn.thingiverse.com") {
			// thanks to anonymous for reporting:
			// https://cdn.thingiverse.com/renders/fe/06/a2/99/e1/0424a65ac06ce95bbb33f469a589c14c_preview_small.jpg
			//   https://cdn.thingiverse.com/renders/fe/06/a2/99/e1/0424a65ac06ce95bbb33f469a589c14c_preview_large.jpg
			//   https://cdn.thingiverse.com/renders/fe/06/a2/99/e1/0424a65ac06ce95bbb33f469a589c14c_display_large.jpg
			// https://cdn.thingiverse.com/renders/4b/2a/87/2a/80/c7fba093e122e5827c5c08ca4cdd6ebb_preview_card.jpg
			//   https://cdn.thingiverse.com/renders/4b/2a/87/2a/80/c7fba093e122e5827c5c08ca4cdd6ebb_display_large.jpg
			// other:
			// https://cdn.thingiverse.com/assets/41/0a/be/8c/aa/medium_preview_IMG_0823.JPEG
			//   https://cdn.thingiverse.com/assets/a6/4c/1c/91/1d/large_display_IMG_0823.JPEG
			return {
				url: src
					.replace(/(\/renders\/+(?:[0-9a-f]{2}\/+)+[0-9a-f]{10,}_)preview_large\./, "$1display_large.")
					.replace(/(\/renders\/+(?:[0-9a-f]{2}\/+)+[0-9a-f]{10,}_(?:display|preview)_)(?:small|medium|card)\./, "$1large."),
				can_head: false // 403
			};
		}

		if (domain_nowww === "thepeninsulaqatar.com") {
			// thanks to anonymous for reporting:
			// https://thepeninsulaqatar.com/get/image/20241109_1731135227-619-thumb_big_590.jpg
			//   https://thepeninsulaqatar.com/get/maximage/20241109_1731135227-619.jpg
			return src.replace(/(\/get\/+)image\/+([^/?#]+)-thumb_[^/.?#]+\./, "$1maximage/$2.");
		}

		if (domain === "cdn.aznudefeet.com") {
			// thanks to anonymous for reporting:
			// https://cdn.aznudefeet.com/celeb_pictures/37952/a14bbcd1-1553-4933-9774-64d386442e44_thumb.jpg
			//   https://cdn.aznudefeet.com/celeb_pictures/37952/a14bbcd1-1553-4933-9774-64d386442e44_logo.jpg
			//   https://cdn.aznudefeet.com/celeb_pictures/37952/a14bbcd1-1553-4933-9774-64d386442e44.jpg
			return src.replace(/(\/[0-9]+\/+[-0-9a-f]{10,})_(?:thumb|logo)\./, "$1.");
		}

		if (domain === "cdn-official-web.peropero.net") {
			// thanks to siloricity on discord:
			// https://cdn-official-web.peropero.net/covers_tmp/525eac574598b408-1649918303117.jpg
			//   https://cdn-official-web.peropero.net/covers/525eac574598b408-1649918303117.png
			newsrc = src.replace(/\/covers_tmp\/+([0-9a-f]{10,}-[0-9]+\.)/, "/covers/$1");
			if (newsrc !== src)
				return add_extensions(newsrc);
		}

		if (false && domain_nowww === "delo.si") {
			// wip
			// thanks to anonymous for reporting:
			// https://www.delo.si/media/images/20241110/1876333.max-1280x1280.jpg?rev=1
			// https://www.delo.si/media/images/20241112/1878248.max-1280x1280.jpg?rev=1
			// https://cms.dpc.delo.si/media/dcgjab5t/_vi_0764.jpg -- 6000x4000
			// https://www.delo.si/media/original_images/se/kviz/135/anketa.jpg?v=1731110400626 -- 4919x2395
			// https://www.delo.si/media/original_images/se/kviz/127/anketa2.jpg?v=1730851200440
			// https://www.delo.si/media/images/20230926/1530759.2e16d0ba.fill-1280x720.format-webp.webp
			// https://deloindom.delo.si/uploads/old/781941/strojno_oljenje2.jpg
			// https://deloindom.delo.si/uploads/11688/superform3-foto-miran-kambic.jpg
			// https://deloindom.delo.si/uploads/29224/shutterstock-102755909.jpg
		}

		if (domain === "images.igdb.com") {
			// thanks to DoomTay on github: https://github.com/qsniyg/maxurl/issues/1377
			// https://api-docs.igdb.com/#images
			// https://images.igdb.com/igdb/image/upload/t_cover_big/co1re9.webp
			//   https://images.igdb.com/igdb/image/upload/t_original/co1re9.webp
			return src.replace(/(\/image\/+upload\/+)t_[^/]+\/+/, "$1t_original/");
		}

		if (domain_nowww === "arnbook.com") {
			// thanks to Froktime on github: https://github.com/qsniyg/maxurl/issues/1369
			// https://arnbook.com/images/thumbs/0016682_360.png
			//   https://arnbook.com/images/thumbs/0016682.png
			return src.replace(/(\/images\/+thumbs\/+[0-9]+)_[0-9]+\./, "$1.")
		}

		if (domain === "torontolife.mblycdn.com") {
			// thanks to anonymous for reporting:
			// https://torontolife.mblycdn.com/tl/resized/2024/11/w2560/image1.jpeg
			//   https://torontolife.mblycdn.com/uploads/tl/2024/11/image1.jpeg
			return src.replace(/(:\/\/[^/]+\/+)([^/]+\/+)resized\/+([0-9]{4}\/+[0-9]{1,2}\/+)w[0-9]+\/+/, "$1uploads/$2$3");
		}

		if (domain === "img.elele.com.tr") {
			// thanks to anonymous:
			// https://img.elele.com.tr/rcman/Cw700h886q95gc/storage/files/images/2023/11/28/hazal-subasi4-q3rp.jpg
			//   https://i.elele.com.tr/storage/files/images/2023/11/28/hazal-subasi4-q3rp.jpg
			return src.replace(/^[a-z]+:\/\/[^/]+\/+.*(\/storage\/)/, "https://i.elele.com.tr$1");
		}

		if (domain === "media-cdn.erohive.com" ||
			// https://cdn.erocdn.co/[hex],[timestamp]/[...]/image/[.]/[.]/[...]/thumb.webp
			//   https://cdn.erocdn.co/[hex],[timestamp]/[...]/image/[.]/[.]/[...]/media.webp
			domain === "cdn.erocdn.co") {
			// thanks to anonymous for reporting:
			// https://media-cdn.erohive.com/[...],[...]/s/image/[...]/thumb.webp
			return src.replace(/(:\/\/[^/]+\/+[^/]+\/+[^/]+\/+image)\/+(.*?\/+)thumb\./, "$1/$2media.");
		}

		if (domain === "t.prcdn.co") {
			// thanks to anonymous for reporting:
			// https://t.prcdn.co/img?file=36532024112700000000001001&page=62&scale=99 -- 617x805
			//   https://t.prcdn.co/img?file=36532024112700000000001001&page=62 -- 623x813
			// https://t.prcdn.co/img?file=36532024112700000000001001&page=63&scale=39
			//   https://t.prcdn.co/img?file=36532024112700000000001001&page=63 -- 623x813
			if (/\/img\?(?:.*&)?file=[0-9]+/.test(src))
				return remove_queries(src, ["scale"]);
		}

		if (domain === "prod-api.mediaexpert.pl") {
			// thanks to anonymous for reporting:
			// https://prod-api.mediaexpert.pl/api/images/gallery_290_300/thumbnails/images/60/6087978/LEGO-10321-ICONS-Corvette1-tyl.jpg
			//   https://prod-api.mediaexpert.pl/api/images/gallery/thumbnails/images/60/6087978/LEGO-10321-ICONS-Corvette1-tyl.jpg
			return src.replace(/(\/api\/+images\/+gallery)_[^/]+\/+/, "$1/");
		}

		if (domain_nowww === "mediaexpert.pl") {
			// thanks to anonymous for reporting:
			// https://www.mediaexpert.pl/media/cache/resolve/gallery_xml/images/37/3738626/Kuweta-PETKIT-PetKit-Pura-Max-front.jpg
			//   https://prod-api.mediaexpert.pl/api/images/gallery/thumbnails/images/37/3738626/Kuweta-PETKIT-PetKit-Pura-Max-front.jpg
			return src.replace(/.*\/gallery_xml\/+images\/+([0-9]{2}\/+[0-9]+\/+[^/]+)(?:[?#].*)?$/, "https://prod-api.mediaexpert.pl/api/images/gallery/thumbnails/images/$1");
		}

		if (domain === "imagescdn.junodownload.com") {
			// thanks to anonymous for reporting:
			// https://imagescdn.junodownload.com/300/CS6880155-02A-MED.jpg
			//   https://imagescdn.junodownload.com/full/CS6880155-02A-BIG.jpg
			// https://imagescdn.junodownload.com/75/CS2592868-02A-TN.jpg
			//   https://imagescdn.junodownload.com/full/CS2592868-02A-BIG.jpg
			// https://imagescdn.junodownload.com/150/CS6624355-02A.jpg
			//   https://imagescdn.junodownload.com/full/CS6624355-02A-BIG.jpg
			return src.replace(/(:\/\/[^/]+\/+)[0-9]+\/+([A-Z]+[0-9]+-[0-9A-Z]+)(?:-(?:MED|TN))?(\.[a-z]+)(?:[?#].*)?$/, "$1full/$2-BIG$3");
		}

		if (domain_nowww === "lindadress.com") {
			// thanks to anonymous for reporting:
			// https://www.lindadress.com/content/res/thumbs/s87/0008722_pink_long_sleeve_v_neck_a_line_lace_embellished_short_homecoming_dress_80.jpeg
			//   https://www.lindadress.com/content/res/thumbs/s87/0008722_pink_long_sleeve_v_neck_a_line_lace_embellished_short_homecoming_dress_600.jpeg
			//   https://www.lindadress.com/content/res/large/l87/0008722_pink_long_sleeve_v_neck_a_line_lace_embellished_short_homecoming_dress_wm.jpeg
			return src
				.replace(/(\/res\/+)thumbs\/+s([0-9]+\/+[^/]+)_600\./, "$1large/l$2_wm.")
				.replace(/(\/res\/+thumbs\/+s[0-9]+\/+[^/]+)_80\./, "$1_600.");
		}

		if (domain === "media.davidrumsey.com") {
			// thanks to anonymous for reporting:
			// https://media.davidrumsey.com/MediaManager/srvr?mediafile=/Size0/D5005/4587108.jpg
			//   https://media.davidrumsey.com/MediaManager/srvr?mediafile=/Size4/D5005/4587108.jpg -- 1392x1536
			// other:
			// https://media.davidrumsey.com/rumsey/Size4/D9003/5694201.jpg -- 3528x2254
			return src
				.replace(/([?&]mediafile=\/+Size)3\/+/, "$14/")
				.replace(/([?&]mediafile=\/+Size)2\/+/, "$13/")
				.replace(/([?&]mediafile=\/+Size)1\/+/, "$12/")
				.replace(/([?&]mediafile=\/+Size)0\/+/, "$11/");
		}

		if (domain === "static.nonograms.ru" ||
			// https://static.nonograms.org/files/nonograms/small/ribachok3_1_1.png
			//   https://static.nonograms.org/files/nonograms/large/ribachok3_12_1_1p.png
			domain === "static.nonograms.org") {
			// thanks to anonymous for reporting:
			// https://static.nonograms.ru/files/nonograms/small/ribachok3_1_1.png
			//   https://static.nonograms.ru/files/nonograms/large/ribachok3_12_1_1p.png
			// https://static.nonograms.ru/files/nonograms/small/kozlyonok2_1_1.png
			//   https://static.nonograms.ru/files/nonograms/large/kozlyonok2_12_1_1p.png
			// https://static.nonograms.ru/files/nonograms/small/ponchiki_1_1.png
			//   https://static.nonograms.ru/files/nonograms/large/ponchiki_12_1_1p.png
			return src.replace(/(\/files\/+nonograms\/+)small\/+([^/]+)_(1_1)(\.)/, "$1large/$2_12_$3p$4");
		}

		if (domain === "profiles.skyprivate.com") {
			// thanks to anonymous for reporting:
			// https://profiles.skyprivate.com/videos/view/aHR0c.../
			newsrc = website_query({
				website_regex: /^[a-z]+:\/\/[^/]+\/+videos\/+view\/+(aHR0c[^/]+)/,
				run: function(cb, match) {
					let splitted = match[1].split("-");
					// splitted[0] = .m3u8
					// splitted[1] = thumbnail.jpg
					let url = base64_decode(splitted[0]);
					if (!/\.(?:m3u8|mp4)(?:[?#].*)?$/.test(url)) {
						console_error("Unknown URL", url);
						return cb(null);
					}

					return cb({
						url: url,
						headers: {
							Referer: "https://profiles.skyprivate.com/"
						},
						video: /\.m3u8(?:[?#].*)?$/.test(url) ? "hls" : true
					});
				}
			});
			if (newsrc) return newsrc;
		}

		if (domain === "images.skyprivate.com") {
			// thanks to anonymous for reporting:
			// https://images.skyprivate.com/images/public/307x307/11735858-sarahleksy.jpeg
			//   https://images.skyprivate.com/images/public/1600x1200xoptimal/11735858-sarahleksy.jpeg
			//   https://images.skyprivate.com/images/public/orig/11735858-sarahleksy.jpeg
			return src.replace(/(\/images\/+(?:public\/+)?)(?:[0-9autooptimal]+x)+[0-9autooptimal]+\/+/, "$1orig/");
		}

		if (domain === "customer-391zfg3puc82o4vr.cloudflarestream.com") {
			// thanks to anonymous for reporting:
			// https://customer-391zfg3puc82o4vr.cloudflarestream.com/[hex]/thumbnails/thumbnail.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+([0-9a-f]{10,})\/+thumbnails\/+[^/]+(?:[?#].*)?$/, "https://cloudflare.videos.skyprivate.com/$1/manifest/video.m3u8");
			if (newsrc !== src)
				return {
					url: newsrc,
					headers: {
						Referer: "https://profiles.skyprivate.com/"
					},
					video: "hls"
				};
		}

		if (domain === "s3aws.payperminute.live") {
			// thanks to anonymous for reporting:
			// https://s3aws.payperminute.live/avatars/converted/thumbs/[0-9a-z]+.jpg
			newsrc = src.replace(/(\/avatars\/+converted\/+)thumbs\/+([0-9a-z]{10,})\.jpg(?:[?#].*)?$/, "$1$2.mp4");
			if (newsrc !== src)
				return {
					url: newsrc,
					headers: {
						Referer: "https://profiles.skyprivate.com/"
					},
					video: true
				};
		}



















































































































































































		// -- 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
			//   http://www.lookalikes.info/media/97522/nick%20hewer%20-%20mark%20brown.jpeg
			return urljoin(src, src.replace(/.*\/ImageGen\.ashx.*?image=([^&]*).*/, "$1"));
		}

		// coppermine
		if (domain === "i.pinger.pl" ||
			// thanks to anonymous for reporting:
			// https://hamaraphotos.com/albums300/userpics/Actresses/easwari_rao/big/thumb_15.jpg
			//   https://hamaraphotos.com/albums300/userpics/Actresses/easwari_rao/big/15.jpg
			domain_nowww === "hamaraphotos.com" ||
			src.search(/(?::\/\/[^/]*\/(gallery|photos|photogallery)|:\/\/gallery\.[^/]*)?\/albums\/+[^/]*(?:\/+.*)?\/+(normal|thumb|userpics)_[^/.]*\.[^/.]*$/) >= 0) {
			// http://emma-w.net/photos/albums/Events/2017/MARCH13/001/thumb_001.jpg
			//   http://emma-w.net/photos/albums/Events/2017/MARCH13/001/001.jpg
			// http://emilia-clarke.net/gallery/albums/Photoshoots/Session031/thumb_2013_10_12.jpg
			//   http://emilia-clarke.net/gallery/albums/Photoshoots/Session031/2013_10_12.jpg
			// http://emilia-clarke.com/gallery/albums/ModelingPromos/DolceGabbana/2018-Campaign/20180204-Dolce%20and%20Gabbana%20Set%20in%20Rome%20Italy/normal_012.jpg
			//   http://emilia-clarke.com/gallery/albums/ModelingPromos/DolceGabbana/2018-Campaign/20180204-Dolce%20and%20Gabbana%20Set%20in%20Rome%20Italy/012.jpg
			// https://gallery.mileycyrusworld.net/albums/userpics/10001/thumb_007~55.jpg
			//   https://gallery.mileycyrusworld.net/albums/userpics/10001/007~55.jpg
			// http://emmawatson.cz/photogallery/albums/userpics/10001/thumb_peterlindbergh17-001.jpg
			//   http://emmawatson.cz/photogallery/albums/userpics/10001/peterlindbergh17-001.jpg
			// http://thewalking-dead.sosugary.com/albums/userpics/10001/normal_danai4318_282329.jpg
			//   http://thewalking-dead.sosugary.com/albums/userpics/10001/danai4318_282329.jpg
			// https://sabrinacarpenter.org/gallery/albums/Instagram/thumb_SCORG00656.jpg
			//   https://sabrinacarpenter.org/gallery/albums/Instagram/SCORG00656.jpg
			// http://i.pinger.pl/pgr473/d1187d3e0009772553242703/normal_005~25.jpg
			//   http://i.pinger.pl/pgr473/d1187d3e0009772553242703/005~25.jpg
			// https://fotki.ykt.ru/albums/userpics/2014/04-04/normal_f210e8d33c71591981896d738d47e4b5.jpg
			//   https://fotki.ykt.ru/albums/userpics/2014/04-04/f210e8d33c71591981896d738d47e4b5.jpg
			newsrc = src.replace(/\/[a-z]*_([^/.]*\.[^/.]*)$/, "/$1");
			if (newsrc !== src) {
				if (/\.JPG(?:[?#].*)?$/.test(newsrc))
					return [newsrc, newsrc.replace(/\.JPG/, ".jpg")];

				return newsrc;
			}
		}

		// gnuboard
		// /data/editor/...
		// /data/file/...
		// /data/works/...
		if (domain_nowww === "torrenthaja.com" ||
			src.match(/\/data\/[^/]*\/[^/]*\/(?:_thumb\/[^/]*\/|thumbs\/)?[^/]*$/)) {
			// https://threppa.com/data/editor/1803/_thumb/750x0_90/20180307005201_f0940271b9a94b4a3544733c05ae638b_yeno.jpg
			//   https://threppa.com/data/editor/1803/20180307005201_f0940271b9a94b4a3544733c05ae638b_yeno.jpg
			// https://img.livescore.co.kr/data/editor/1705/thumbs/50767677f98fec9f75b88045e3cb75a1_1494565305_7576.jpg
			//   https://img.livescore.co.kr/data/editor/1705/50767677f98fec9f75b88045e3cb75a1_1494565305_7576.jpg
			// https://torrenthaja.com/data/editor/2019/03/thumb-d2210cf7-3cf0-4610-8b02-5cf786ef3d3d_600x0.jpg
			//   https://torrenthaja.com/data/editor/2019/03/d2210cf7-3cf0-4610-8b02-5cf786ef3d3d.jpg
			newsrc = src
				.replace(/\/thumb-([^/]*)_[0-9]+x[0-9]+(\.[^/.]*)(?:[?#].*)?$/, "/$1$2")
				.replace(/(\/data\/[^/]*\/[0-9]+\/)_thumb\/[0-9]+x[0-9]_[0-9]+\//, "$1")
				.replace(/(\/data\/[^/]*\/[0-9]+\/)thumbs\//, "$1");

			if (newsrc !== src)
				return add_full_extensions(newsrc);
		}

		// various korean news sites (heraldpop etc.)
		// test:
		// http://cgeimage.commutil.kr/phpwas/restmb_allidxmake.php?idx=1&simg=2017111113495301086f97ee432d6203243244.jpg
		// http://res.heraldm.com/phpwas/restmb_jhidxmake.php?idx=999&simg=201712220654304807972_20171222065329_01.jpg
		// http://cgeimage.commutil.kr/phpwas/restmb_setimgmake.php?w=90&h=60&m=1&simg=201712231138280443342246731f35814122117.jpg
		//   http://cgeimage.commutil.kr/phpwas/restmb_allidxmake.php?idx=999&simg=201712231138280443342246731f35814122117.jpg
		// http://res.heraldm.com/phpwas/restmb_jhidxmake.php?idx=5&simg=201507120010285799190_20150712001052_01.jpg
		// http://nimage.globaleconomic.co.kr/phpwas/restmb_allidxmake.php?idx=5&simg=201403241833510093084_00.jpg
		//   http://nimage.globaleconomic.co.kr/phpwas/restmb_allidxmake.php?idx=999&simg=201403241833510093084_00.jpg -- same size
		// doesn't work:
		// http://cliimage.commutil.kr/phpwas/restmb_setimgmake.php?w=550&h=412&m=5&simg=2018030210280201075d307c1aeb0121131233211.jpg
		//   http://cliimage.commutil.kr/phpwas/restmb_setimgmake.php?idx=999&simg=2018030210280201075d307c1aeb0121131233211.jpg
		//   error: nIdx null
		//   http://cliimage.commutil.kr/phpwas/restmb_allidxmake.php?idx=999&simg=2018030210280201075d307c1aeb0121131233211.jpg - works
		if (src.search(/\/phpwas\/restmb_[a-z]*make\.php\?/) >= 0) {
			if (domain === "cgeimage.commutil.kr" ||
				domain === "cliimage.commutil.kr") {
				src = src.replace(/\/phpwas\/restmb_[a-z]*make\.php/, "/phpwas/restmb_allidxmake.php");
			}

			if (string_indexof(domain, "nimage.") === 0) {
				// http://nimage.newsway.kr/phpwas/restmb_idxmake.php?idx=200&simg=20180202000058_1024.jpg
				//   http://nimage.newsway.kr/photo/2018/02/02/20180202000058_1024.jpg
				// http://nimage.dailygame.co.kr/phpwas/restmb_idxmake.php?idx=3&simg=2015120515361257066_20151205153842_1.jpg
				//   http://nimage.dailygame.co.kr/photo/2015/12/05/2015120515361257066_20151205153842_1.jpg
				// doesn't work for all: (so keep to restmb_idxmake for now)
				// http://nimage.globaleconomic.co.kr/phpwas/restmb_allidxmake.php?idx=999&simg=201403241833510093084_00.jpg
				//   http://nimage.globaleconomic.co.kr/photo/2014/03/24/201403241833510093084_00.jpg -- doesn't work
				newsrc = src.replace(/\/phpwas\/restmb_idxmake\.php.*?simg=([0-9]{4})([0-9]{2})([0-9]{2})([^&]*).*?$/, "/photo/$1/$2/$3/$1$2$3$4");
				if (newsrc !== src)
					return newsrc;
			}

			if (domain === "res.heraldm.com" &&
				decodeURIComponent(src.match(/simg=([^&]*)/)[1])[0] === "/") {
				// http://res.heraldm.com/phpwas/restmb_idxmake.php?idx=999&simg=%2Fcontent%2Fimage%2F2015%2F07%2F13%2F20150713001359_0.jpg
				//   http://res.heraldm.com/content/image/2015/07/13/20150713001359_0.jpg
				// http://res.heraldm.com/phpwas/restmb_idxmake.php?idx=999&simg=/content/image/2018/02/02/20180202000714_0.jpg
				//   http://res.heraldm.com/content/image/2018/02/02/20180202000714_0.jpg
				// http://res.heraldm.com/phpwas/restmb_idxmake.php?idx=140&simg=/content/image/2019/08/30/20190830000445_p.jpg
				//   http://res.heraldm.com/content/image/2019/08/30/20190830000445_p.jpg
				return urljoin(src, decodeURIComponent(src.match(/simg=([^&]*)/)[1]), true);
			}

			//return src.replace(/\/phpwas\/restmb_[a-z]*make\.php\?.*(simg=[^&]*)/, "/phpwas/restmb_allidxmake.php?idx=999&$1");
			return src.replace(/(\/phpwas\/restmb_[a-z]*make\.php)\?.*(simg=[^&]*)/, "$1?idx=999&$2");
		}

		if (src.match(/.*?\/timthumb(?:\/index)?\.php\?(?:.*&)?src=/)) {
			// http://dublinfilms.fr/wp-content/themes/purity/includes/timthumb.php?src=http://dublinfilms.fr/wp-content/uploads/2014/06/Actu-bandeau-bis.jpg&h=260&w=662&zc=1
			//   http://dublinfilms.fr/wp-content/uploads/2014/06/Actu-bandeau-bis.jpg
			// http://www.hcwd.com.tw/template/corporate_site/fk1/timthumb.php?src=http://www.hcwd.com.tw/snlev801/product/bimg/_MG_8893(001).jpg&w=410&s=1
			//   http://www.hcwd.com.tw/snlev801/product/bimg/_MG_8893(001).jpg
			// http://www.moviehotties.com/timthumb.php?src=/moviehotties/images/news-gallery/orig/Em-Rat-Met-G_1.jpg&w=85&h=85&q=100
			//   http://www.moviehotties.com/moviehotties/images/news-gallery/orig/Em-Rat-Met-G_1.jpg
			// https://www.wordonfire.org/wof-core/libraries/timthumb/timthumb.php?zc=1&w=1328&h=598&src=https://www.wordonfire.org/wof-site/media/brchristianitycrucifixion.jpg
			//   https://www.wordonfire.org/wof-site/media/brchristianitycrucifixion.jpg
			// http://imagecache.blastro.com/timthumb.php/src=http%3A%2F%2Fimages.blastro.com%2Fimages%2Fartist_images%2Ffull%2Ffull_booty_luv_artist_photo1.jpg&w=610&h=457&zc=2&a=T
			//   http://images.blastro.com/images/artist_images/full/full_booty_luv_artist_photo1.jpg
			// http://lauradaluna.com/timthumb.php?src=image/gallery/141441178010306.jpg&zc=2&w=314
			//   http://lauradaluna.com/image/gallery/141441178010306.jpg
			// http://www.articlelike.com/timthumb/index.php?src=https://www.articlelike.com/manage/0/product/17589/334/17589_0.jpg
			//   https://www.articlelike.com/manage/0/product/17589/334/17589_0.jpg
			// https://api.sextpanther.com/public/timthumb.php?w=300&h=300&a=t&zc=1&src=https://api.sextpanther.com/pre?fk=https://media.sextpanther.com/images/lrg_images/1581196066_7RCAO.jpeg
			//   https://api.sextpanther.com/pre?fk=https://media.sextpanther.com/images/lrg_images/1581196066_7RCAO.jpeg -- doesn't work
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/446
			// https://www.foundation-media.com/wp-content/themes/minuet/functions/timthumb.php?src=wp-content/uploads/2020/09/rayven.jpg&w=432&h=432&zc=1&q=90
			//   https://www.foundation-media.com/wp-content/uploads/2020/09/rayven.jpg
			var baseurl = src;
			if (domain_nowww === "foundation-media.com")
				baseurl = "https://www.foundation-media.com/";

			newsrc = src.replace(/.*\/timthumb(?:\/index)?\.php\?(?:.*&)?src=([^&]+).*$/, "$1");
			if (newsrc !== src) {
				return urljoin(baseurl, decodeURIComponent(newsrc), true);
			}
		}

		if (src.match(/\/fotogallery\/[0-9]+X[0-9]+\//)) {
			// http://static.pourfemme.it/pfcoppia/fotogallery/1200X0/11285/solene-rigot-e-zacharie-chasseriaud.jpg
			//   http://static.pourfemme.it/pfcoppia/fotogallery/99999999999X0/11285/solene-rigot-e-zacharie-chasseriaud.jpg
			// http://static.stylosophy.it/stshoes/fotogallery/1200X0/183603/decolletes-gioiello-gedebe-gialle.jpg
			//   http://static.stylosophy.it/stshoes/fotogallery/9999999999X0/183603/decolletes-gioiello-gedebe-gialle.jpg
			// http://static.qnm.it/www/fotogallery/1200X0/110767/martina-stella-bikini.jpg
			//   http://static.qnm.it/www/fotogallery/9999999999X0/110767/martina-stella-bikini.jpg
			// http://static.myluxury.it/myluxury/fotogallery/1200X0/119923/uovo-zen-by-nobu.jpg
			//   http://static.myluxury.it/myluxury/fotogallery/9999999999X0/119923/uovo-zen-by-nobu.jpg
			// http://static.derapate.it/derapate/fotogallery/1200X0/64729/grid-girls-motogp-le-ragazze-del-paddock-4.jpg
			//   http://static.derapate.it/derapate/fotogallery/9999999999X0/64729/grid-girls-motogp-le-ragazze-del-paddock-4.jpg
			return src.replace(/\/fotogallery\/[0-9]+X[0-9]+\//, "/fotogallery/9999999999X0/");
		}

		if (string_indexof(src, "/redim_recadre_photo.php") >= 0) {
			// probably the only site with this?
			// http://diffusionph.cccommunication.biz/jpgok/redim_recadre_photo.php?path_url=http://diffusionvid.cccommunication.biz/thumbnail_embed/46408.jpg&width=480&height=320
			//   http://diffusionvid.cccommunication.biz/thumbnail_embed/46408.jpg
			return src.replace(/.*\/redim_recadre_photo\.php\?.*?path_url=([^&]*).*/, "$1");
		}

		if (src.match(/\/dynimage\/[^/]*\/[0-9]*\/[^/]*$/)) {
			// https://www.yield247.com/dynimage/imagesize10/1301/image.jpg
			// https://www.kyphimalta.com/dynimage/imagesize10/541/image.png
			// http://www.hitradingltd.com/dynimage/imagesize10/514/image.png
			return src.replace(/\/dynimage\/[^/]*\//, "/dynimage/original/"); // can be anything
		}

		if (src.match(/\/phocagallery\/.*\/thumbs\/[^/]*$/)) {
			// https://www.beautybybeccy.com.au/images/phocagallery/photoshoot/Promo%20Model%20shoot/thumbs/phoca_thumb_m_DSC09589-edit.jpg
			//   https://www.beautybybeccy.com.au/images/phocagallery/photoshoot/Promo%20Model%20shoot/DSC09589-edit.jpg
			return src.replace(/\/thumbs\/phoca_thumb_[^/._]*_/, "/");
		}

		if (src.match(/\/sfc\/servlet\.shepherd\/version\/renditionDownload/)) {
			// wip, need way to disable downloading?
			// sources:
			// https://salesforce.stackexchange.com/questions/171149/lightning-component-using-renditiondownload-to-view-files-img-doc-xlxs-etc
			// https://forum.bigcommerce.com/s/question/0D51B00003zftI0SAI/hide-the-bigcommerce-cdn-image-path-on-image-mouseover-product-detail-page
			// https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_resources_files_rendition.htm
			// https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_resources_files_preview_format.htm
			//
			// https://forum.bigcommerce.com/sfc/servlet.shepherd/version/renditionDownload?rendition=THUMB720BY480&versionId=0681B0000064R3r&operationContext=CHATTER&contentId=05T1B00000GDv1i&page=0
			//   https://forum.bigcommerce.com/sfc/servlet.shepherd/version/renditionDownload?rendition=ORIGINAL_Png&versionId=0681B0000064R3r&operationContext=CHATTER&contentId=05T1B00000GDv1i
			//   https://forum.bigcommerce.com/sfc/servlet.shepherd/version/download/0681B0000064R3r (versionId, works, but requires download)
			// https://support.bigcommerce.com/servlet/rtaImage?eid=ka61B000000ClUi&feoid=00N1300000BR3CT&refid=0EM130000018Xoh
			//
			// doesn't work:
			// https://forum.bigcommerce.com/sfc/servlet.shepherd/version/renditionDownload?rendition=THUMB720BY480&versionId=06813000005iizB&operationContext=CHATTER&contentId=05T1300000FCL6J
			//   https://forum.bigcommerce.com/sfc/servlet.shepherd/version/renditionDownload?rendition=ORIGINAL_Jpg&versionId=06813000005iizB&operationContext=CHATTER&contentId=05T1300000FCL6J -- works
			//return src.replace(/(\/renditionDownload.*?[?&]rendition=)[^&]*/, "$1ORIGINAL_Png");
			return src.replace(/\/renditionDownload.*?[?&]versionId=([^&]*).*/, "/download/$1");
		}

		if (domain === "cdn.ome.lt") {
			// https://cdn.ome.lt/0gFXoqAQm38hc0iNSj6p0vA1Uas=/fit-in/1070x750/smart/filer_public/ff/27/ff27f835-1db5-4623-a776-353bca6daa9d/vingadoresguerrainfinitamondo-02.jpeg
			//   https://cdn.ome.lt/filer_public/ff/27/ff27f835-1db5-4623-a776-353bca6daa9d/vingadoresguerrainfinitamondo-02.jpeg
			return src.replace(/(:\/\/[^/]*\/)[-_A-Za-z0-9]+=\/(?:(?:full-)?fit-in\/)?(?:[0-9x:]+\/)?(?:[0-9x:]+\/)?(?:(?:top|center|middle)\/)?(?:(?:smart|top|center|middle)\/)?(?:filters:[^/]*\/)?/, "$1");
		}

		if ((domain_nosub === "vox-cdn.com" && string_indexof(domain, "cdn.vox-cdn.com") >= 0) ||
			domain === "thumbnails.trvl-media.com" ||
			domain === "thumbor-static.factorymedia.com" ||
			// https://cdnrockol-rockolcomsrl.netdna-ssl.com/Q3UJZHxl455fWTe78h_5zbtv-WY=/700x0/smart/http%3A%2F%2Fs.mxmcdn.net%2Fimages-storage%2Falbums%2F4%2F5%2F4%2F7%2F6%2F0%2F12067454_800_800.jpg
			//   http://s.mxmcdn.net/images-storage/albums/4/5/4/7/6/0/12067454_800_800.jpg
			domain === "cdnrockol-rockolcomsrl.netdna-ssl.com" ||
			// https://thumbor-titelmediaug.netdna-ssl.com/kY004Q5cCawBfZZWcm4g9MjPrtw=/480x320/filters:strip_icc()/http%3A%2F%2Fwhatdropsnow.s3.amazonaws.com%2Fproduct_images%2Fimages%2F46237%2Fe22a12e352862c818b75c15d150ef49f3458aaac.jpeg
			//   http://whatdropsnow.s3.amazonaws.com/product_images/images/46237/e22a12e352862c818b75c15d150ef49f3458aaac.jpeg
			domain === "thumbor-titelmediaug.netdna-ssl.com" ||
			// https://www.infobae.com/new-resizer/jfCQ7-AjnQyNdmWHdFGYvzYmVx4=/600x0/filters:quality(100)/arc-anglerfish-arc2-prod-infobae.s3.amazonaws.com/public/4IOFEV5GJVES3DVJ2XHDFXA2TE
			domain_nowww === "infobae.com" ||
			// http://s2.glbimg.com/i7GBoDhq8XYOfFinAMZv0YYZdPY=/e.glbimg.com/og/ed/f/original/2016/12/26/eb8.jpg
			//   http://e.glbimg.com/og/ed/f/original/2016/12/26/eb8.jpg
			// https://s2.glbimg.com/guJ0REQ3RhF8RtD-dacV89xdGQI=/140x111/e.glbimg.com/og/ed/f/original/2015/02/12/nicole_scherzinger.jpg
			//   http://e.glbimg.com/og/ed/f/original/2015/02/12/nicole_scherzinger.jpg
			// http://s2.glbimg.com/ItD12-q38NBBvxkw1cEHaNjZVYQT-0uANSHHRhD3QUNIoz-HdGixxa_8qOZvMp3w/e.glbimg.com/og/ed/f/original/2013/02/07/lilo.jpg
			//   http://e.glbimg.com/og/ed/f/original/2013/02/07/lilo.jpg
			// other:
			// thanks to anonymous for reporting:
			// http://s2-g1.glbimg.com/fubp6FYLOZeBVYztCNc41Rn43tU=/0x0:1000x663/924x0/smart/filters:strip_icc()/i.s3.glbimg.com/v1/AUTH_59edd422c0c84a879bd37670ae4f538a/internal_photos/bs/2022/6/E/zcnswkRpeKAea9Br0GAw/julia-mestre-analogicas-bianca-baker-8.jpg
			//   http://i.s3.glbimg.com/v1/AUTH_59edd422c0c84a879bd37670ae4f538a/internal_photos/bs/2022/6/E/zcnswkRpeKAea9Br0GAw/julia-mestre-analogicas-bianca-baker-8.jpg -- timeout
			// https://s3.glbimg.com/v1/AUTH_35862ca5c6ab48b992baf1f1b4f7062e/extra-globo-com/incoming/23692053-008-29d/w480h720-PROP/39932577_1502.2000simone-marinhoext-sxgretchen345352000021520280952.jpg
			(domain_nosub === "glbimg.com" && /^s[0-9]*\./.test(domain)) ||
			// https://i.amz.mshcdn.com/vWTWthC534bzcGDk15NwrBy-dd4=/fit-in/1200x9600/https%3A%2F%2Fblueprint-api-production.s3.amazonaws.com%2Fuploads%2Fcard%2Fimage%2F54484%2FGettyImages-520238014.jpg
			//   https://blueprint-api-production.s3.amazonaws.com/uploads/card/image/54484/GettyImages-520238014.jpg
			// https://i.amz.mshcdn.com/PC46KosYMRbypJ2kdGk4E2mk_0s=/1200x627/2015%2F04%2F02%2F73%2Fsiabiggirls.4cf8f.jpg
			// https://i.amz.mshcdn.com/yAgniOpdgD8cHVN-R6qzAaA71fQ=/fit-in/1200x9600/http%3A%2F%2Fmashable.com%2Fwp-content%2Fuploads%2F2015%2F08%2FQueen_firing_rifle.jpg
			//   https://admin.mashable.com/wp-content/uploads/2015/08/Queen_firing_rifle.jpg
			domain === "i.amz.mshcdn.com" ||
			// https://img.ilcdn.fi/64wZEcZPDqMNu7XwxW5cDqWKPYQ=/full-fit-in/612x/img-s3.ilcdn.fi/e36990bb042d3364aa4c91d8105889fc29941e7ae97600defb8f12cbb87e55c6.jpg
			//   https://img.ilcdn.fi/64wZEcZPDqMNu7XwxW5cDqWKPYQ=/full-fit-in/612x/img-s3.ilcdn.fi/e36990bb042d3364aa4c91d8105889fc29941e7ae97600defb8f12cbb87e55c6.jpg -- 403
			domain === "img.ilcdn.fi" ||
			// https://img.fstatic.com/JOPw9nZjrfLTo9avaG2aY1drkko=/full-fit-in/640x480/https://cdn.fstatic.com/media/artists/avatar/2017/05/christopher-nolan_a8719.jpg
			//   https://cdn.fstatic.com/media/artists/avatar/2017/05/christopher-nolan_a8719.jpg
			domain === "img.fstatic.com" ||
			// https://img.mthcdn.com/ksCA14bSIxTz78rH3WvCXR9ZdkU=/798x1197/picpost.mthai.com/pic/2017/01/2025222.jpg
			//   https://picpost.mthai.com/pic/2017/01/2025222.jpg
			domain === "img.mthcdn.com" ||
			// https://images.thestar.com/U9Ew-rkVyhtmv0u2Rjox3G637AA=/0x0:1200x675/93x52/smart/filters:cb(1530307526313)/https://www.thestar.com/content/dam/thestar/news/gta/2018/06/28/in-one-hour-we-watched-toronto-drivers-block-this-downtown-intersection-at-virtually-every-red-light/blocked_box_main.jpg
			//   https://www.thestar.com/content/dam/thestar/news/gta/2018/06/28/in-one-hour-we-watched-toronto-drivers-block-this-downtown-intersection-at-virtually-every-red-light/blocked_box_main.jpg
			// https://images.thestar.com/-ZOPF3_-dhsPDK5diZsl7k2AWyE=/1086x724/smart/filters:cb(1533380883140)/https://www.thestar.com/content/dam/thestar/opinion/contributors/2018/08/02/mall-is-wrong-about-use-of-captured-images/rpjeatoncameras04.jpg
			//   https://www.thestar.com/content/dam/thestar/opinion/contributors/2018/08/02/mall-is-wrong-about-use-of-captured-images/rpjeatoncameras04.jpg
			domain === "images.thestar.com" ||
			// https://thumb2.holidaypirates.com/xU1qXNGnGgXc2Du6ukUPcdDpBRg=/657x300/https://media.mv.urlaubspiraten.de/images/2016/08/57a4ddb17986a419264487wv9gugyx.jpg
			//   https://media.mv.urlaubspiraten.de/images/2016/08/57a4ddb17986a419264487wv9gugyx.jpg
			(domain_nosub === "holidaypirates.com" && domain.match(/thumb[0-9]*\.holidaypirates\.com/)) ||
			// https://img.yasmina.com/UoZCII39qwhfihSDsCZ845tCp_Y=/0x0/smart/http://harmony-assets-live.s3.amazonaws.com/image_source/7d/5f/7d5fc9007db632d8ce71fe01f00429732b3dad80.jpg
			domain === "img.yasmina.com" ||
			// https://s2.glbimg.com/OHrR1QoyTUJ2TZmqGkRumRkr0lQ=/540x304/top/smart/https://i.s3.glbimg.com/v1/AUTH_59edd422c0c84a879bd37670ae4f538a/internal_photos/bs/2018/T/0/N2V0VIRCKjVb81zquEMA/iceberg.jpg
			//   https://i.s3.glbimg.com/v1/AUTH_59edd422c0c84a879bd37670ae4f538a/internal_photos/bs/2018/T/0/N2V0VIRCKjVb81zquEMA/iceberg.jpg -- keeps loading
			// thanks to anonymous for reporting:
			// https://s2-quem.glbimg.com/Gg7CjgH0uVRMM_Z-Jrk1V2NLLh8=/0x0:1200x678/888x0/smart/filters:strip_icc()/i.s3.glbimg.com/v1/AUTH_b0f0e84207c948ab8b8777be5a6a4395/internal_photos/bs/2023/I/0/kB4UbQTXABV1a2RyRq9Q/fotojet-75-.jpg
			//   http://i.s3.glbimg.com/v1/AUTH_b0f0e84207c948ab8b8777be5a6a4395/internal_photos/bs/2023/I/0/kB4UbQTXABV1a2RyRq9Q/fotojet-75-.jpg -- keeps loading
			//domain_nosub === "glbimg.com" ||
			// http://resize.abcradio.net.au/46VfqasBbN7ydth1Lt3R6jMlyqY=/100x100/center/middle/http://www.abc.net.au/triplej/albums/56918/covers/original.jpg
			//   http://www.abc.net.au/triplej/albums/56918/covers/original.jpg
			domain === "resize.abcradio.net.au" ||
			// http://th.pinkblog.it/fc6UonR3mdccWeikfHzJWGarjyQ=/fit-in/655x437/http://media.pinkblog.it/a/att/attrici-con-belle-gambe/20.jpg
			//   http://media.pinkblog.it/a/att/attrici-con-belle-gambe/20.jpg
			domain === "th.pinkblog.it" ||
			// http://th.blogosfere.it/plCtg4gdnF39TsBttt7YKsZbq-4=/fit-in/655x437/http://media-s3.blogosfere.it/styleandfashion/5/525/rihanna_red.jpg
			//   http://media-s3.blogosfere.it/styleandfashion/5/525/rihanna_red.jpg
			domain === "th.blogosfere.it" ||
			// http://th.fashionblog.it/zKoiw2TNqiEHlEeyzcp3EXepM18=/fit-in/655x437/http://media.fashionblog.it/6/620/rihanna-occhiali-dior-2.jpg
			//   http://media.fashionblog.it/6/620/rihanna-occhiali-dior-2.jpg
			domain === "th.fashionblog.it" ||
			// http://images.jovempanfm.uol.com.br/uxStmg4HPCcgXXvjwfGvutRAAgM=/0x420/top/media.jovempanfm.uol.com.br/archives/2015/10/13/1700269713-rihanna-estampa-capa-de-revista-e-comenta-sobre-racismo-isso-nunca-tem-fim.jpg
			//   http://media.jovempanfm.uol.com.br/archives/2015/10/13/1700269713-rihanna-estampa-capa-de-revista-e-comenta-sobre-racismo-isso-nunca-tem-fim.jpg
			domain === "images.jovempanfm.uol.com.br" ||
			// https://img.atyabtabkha.com/tAdkSxuvDctdbq1cdEqaL0dVc7g=/640x360/smart/http://harmony-assets-live.s3.amazonaws.com/image_source/31/35/31352be7d3b4eb37c687b43924647d69b824f232.jpg
			//   http://harmony-assets-live.s3.amazonaws.com/image_source/31/35/31352be7d3b4eb37c687b43924647d69b824f232.jpg
			domain === "img.atyabtabkha.com" ||
			// https://imageresizer.static9.net.au/O8cJcEACaHhMxDRZ4cBZ8S24CQc=/1396x785/http%3A%2F%2Fprod.static9.net.au%2F_%2Fmedia%2F2018%2F08%2F24%2F15%2F31%2F2408_jt_ENV.jpg
			//   http://prod.static9.net.au/_/media/2018/08/24/15/31/2408_jt_ENV.jpg
			domain === "imageresizer.static9.net.au" ||
			// https://img-ha.mthcdn.com/JvqkBfjJ5ffdeenRYJFr8wwNUq8=/300x375/picpost.mthai.com/pic/2017/02/2055783.jpg
			domain === "img-ha.mthcdn.com" ||
			// http://imagenes.milenio.com/PlgEwrqNd1MJG5_6x7VjGPQ4DFw=/0x530/smart/http://www.milenio.com/uploads/media/2018/06/19/luz-blanchet-juan-carlos-bautista.jpg
			//   http://www.milenio.com/uploads/media/2018/06/19/luz-blanchet-juan-carlos-bautista.jpg
			domain === "imagenes.milenio.com" ||
			// https://dyn.media.titanbooks.com/QhAZD6toTjeDw1071wW9x7nSAzs=/fit-in/600x600/https://media.titanbooks.com/catalog/products/asscreedodysjkt_8gPJPbE.jpg
			//   https://media.titanbooks.com/catalog/products/asscreedodysjkt_8gPJPbE.jpg
			domain_nowww === "dyn.media.titanbooks.com" ||
			// https://i.osvigaristas.net.br/hrGT0cYu3YwgnHYYLjNBjOE4gp8=/584x0/filters:format(jpeg):quality(70):strip_icc()/s3.amazonaws.com%2Fuploads.osvigaristas.com.br%2F12254.jpg%3Fv%3D2
			//   http://s3.amazonaws.com/uploads.osvigaristas.com.br/12254.jpg?v=2
			domain === "i.osvigaristas.net.br" ||
			// https://dynamic.zacdn.com/q_wecptGV-iTBeTgtkXgYzZjcFs=/fit-in/346x500/filters:quality(95):fill(ffffff)/http://static.hk.zalora.net/p/lycka-7305-6550105-1.jpg
			//   http://static.hk.zalora.net/p/lycka-7305-6550105-1.jpg
			//   http://zalora-media-live-hk.s3.amazonaws.com/product/65/50105/1.jpg
			domain === "dynamic.zacdn.com" ||
			// https://svirtus.cdnvideo.ru/SiKm8kkIMgQGtrH5xZMqM_Dud60=/0x0:898x600/573x325/filters:quality(100)/https://hb.bizmrg.com/cybersportru-media/27/27e379a1682185e31d372633c5574f31.jpg?m=6123ea480c1838d9760e182cb163fc15
			//   https://hb.bizmrg.com/cybersportru-media/27/27e379a1682185e31d372633c5574f31.jpg?m=6123ea480c1838d9760e182cb163fc15
			domain === "svirtus.cdnvideo.ru" ||
			// https://t.jwwb.nl/uSa9XgKrENybp74WbEYP6i64fMU=/0x100/f.jwwb.nl%2Fpublic%2Fu%2Fn%2Fy%2Ftemp-jkkktmxtzvbywrttecqp%2Flueb0z%2Fadobe-logo.png
			//   https://f.jwwb.nl/public/u/n/y/temp-jkkktmxtzvbywrttecqp/lueb0z/adobe-logo.png
			domain === "t.jwwb.nl" ||
			// https://thumbs.videogamer.com/y5waciSTBpbBrgWPF0_LyiPtANs=/320x180/smart/filters:no_upscale()/https://s.videogamer.com/meta/1089/4aa1fb82-6f5c-4531-b178-6f0dbf7b1473_Keanu_Cyberpunk.PNG
			//   https://s.videogamer.com/meta/1089/4aa1fb82-6f5c-4531-b178-6f0dbf7b1473_Keanu_Cyberpunk.PNG
			domain === "thumbs.videogamer.com" ||
			// https://th.gossipblog.it/0Rz-WpcEpaLroC6K0lYFrW8FfLE=/fit-in/600x400/http://media.gossipblog.it/c/car/cara-delevingne-le-foto-piu-belle/th/cara-delevingne-foto-155752915-10.jpg
			//   https://media.gossipblog.it/c/car/cara-delevingne-le-foto-piu-belle/th/cara-delevingne-foto-155752915-10.jpg
			domain === "th.gossipblog.it" ||
			// https://th.cineblog.it/h75SqpcjC6zmBnzgVBp1jV-ULrs=/170x170/filters:quality(20)/media.cineblog.it/th/terms/cat_119.jpg
			//   http://media.cineblog.it/th/terms/cat_119.jpg
			domain === "th.cineblog.it" ||
			// https://images.news18.com/optimize/-HuDBEieUX2r8KZ73vzd0sz9vSM=/402x0/images.news18.com/ibnlive/uploads/402x0/jpg/2018/09/Radhika-Apte1.jpg
			domain === "images.news18.com" ||
			// https://static.telugu.news18.com/optimize/Uo3LUvvuhDZ9Vl5fzqzn2mJrjmA=/0x0/static.telugu.news18.com/telugu/uploads/2018/09/13Radhika-Apte1.jpg
			//   http://static.telugu.news18.com/telugu/uploads/2018/09/13Radhika-Apte1.jpg
			domain === "static.telugu.news18.com" ||
			// https://th.clickblog.it/8IYGXWhZUsRHGseuFvNTAO60he4=/fit-in/600x400/https://media.clickblog.it/4/47d/geert-weggen_squirrel-wishes_00003677.jpg
			//   https://media.clickblog.it/4/47d/geert-weggen_squirrel-wishes_00003677.jpg
			domain === "th.clickblog.it" ||
			// https://thumbor.forbes.com/thumbor/711x356/https://blogs-images.forbes.com/robertanaas/files/2017/04/Rihanna-wearing-the-RIHANNA-LOVES-CHOPARD-Joaillerie-collection-copy-1200x601.jpg?width=960
			//   https://blogs-images.forbes.com/robertanaas/files/2017/04/Rihanna-wearing-the-RIHANNA-LOVES-CHOPARD-Joaillerie-collection-copy.jpg
			// https://thumbor.forbes.com/thumbor/960x0/https%3A%2F%2Fblogs-images.forbes.com%2Fjoresablount%2Ffiles%2F2019%2F05%2Fhitesh-choudhary-666985-unsplash-1200x675.jpg
			//   https://blogs-images.forbes.com/joresablount/files/2019/05/hitesh-choudhary-666985-unsplash-1200x675.jpg
			// https://thumbor.forbes.com/thumbor/fit-in/1200x0/filters%3Aformat%28jpg%29/https%3A%2F%2Fspecials-images.forbesimg.com%2Fimageserve%2F5f1ada1a4fd1b15858011d07%2F0x0.jpg
			//   https://specials-images.forbesimg.com/imageserve/5f1ada1a4fd1b15858011d07/0x0.jpg
			domain === "thumbor.forbes.com" ||
			// https://thumbor.f3.cool/BGpVZveO6bAVctCZ7aGCsL3-iPA=/360x360/smart/profile0.f3.cool/xRGcA9JA/KRpUDdn7_360x360.jpg
			//   http://profile0.f3.cool/xRGcA9JA/KRpUDdn7_360x360.jpg
			domain === "thumbor.f3.cool" ||
			// http://dw8stlw9qt0iz.cloudfront.net/mQPnCmXmqNYQo57GciDCvFLPgAo=/fit-in/800x450/filters:format(jpeg):quality(75)/curiosity-data.s3.amazonaws.com/images/content/landscape/standard/9c8fb438-27d4-4694-ba65-1a98e8ffd426.png
			//   http://curiosity-data.s3.amazonaws.com/images/content/landscape/standard/9c8fb438-27d4-4694-ba65-1a98e8ffd426.png
			domain === "dw8stlw9qt0iz.cloudfront.net" ||
			// https://img.nrj.fr/QOZGn6LPf8gqvFptuUlEPQNXdtw=/250x250/smart/http%3A%2F%2Fimages.music-story.com%2Fimg%2Falbum_S%2Fselena-gomez-rare.jpg
			//   http://images.music-story.com/img/album_S/selena-gomez-rare.jpg
			domain === "img.nrj.fr" ||
			// https://img.wynk.in/unsafe/275x275/filters:no_upscale():format(jpg)/http://s3-ap-south-1.amazonaws.com/wynk-music-cms/srch_universalmusic/music/1578588471/srch_universalmusic_00602508682988-USUM71923484.jpg
			//   http://s3-ap-south-1.amazonaws.com/wynk-music-cms/srch_universalmusic/music/1578588471/srch_universalmusic_00602508682988-USUM71923484.jpg
			domain === "img.wynk.in" ||
			// https://images.adrise.tv/VcGv7kP97DPd9mKXEAkCpJyNVLI=/400x574/smart/img.adrise.tv/aa6d4d27-82d0-4b1d-8cb4-7566928a0389.jpg
			//   http://img.adrise.tv/aa6d4d27-82d0-4b1d-8cb4-7566928a0389.jpg
			domain === "images.adrise.tv" ||
			// https://www.nydailynews.com/resizer/GaeyAldzSu-KRls2MdKl427zxhQ=/arc-anglerfish-arc2-prod-tronc.s3.amazonaws.com/public/DN2NVNA5MCYD7PCBVYBE5WCQJ4.jpg
			//   https://arc-anglerfish-arc2-prod-tronc.s3.amazonaws.com/public/DN2NVNA5MCYD7PCBVYBE5WCQJ4.jpg
			domain_nowww === "nydailynews.com" ||
			// https://resizing.flixster.com/IaXbRF4gIPh9jireK_4VCPNfdKc=/300x0/v2/https://flxt.tmsimg.com/assets/p17871471_p_v10_aa.jpg
			//   https://flxt.tmsimg.com/assets/p17871471_p_v10_aa.jpg
			// https://resizing.flixster.com/QY2Nv1VP-J7ZVbUl4N-erO_rqO0=/300x300/v2/https://resizing.flixster.com/snpvybg_r1na6kT5fFS9Lz6FjJo=/ems.ZW1zLXByZC1hc3NldHMvbW92aWVzLzZhYTNjZDA3LTVjNjQtNGE4NC04MGNiLTU3YTJkODA0ZTQyZC53ZWJw
			//   https://resizing.flixster.com/snpvybg_r1na6kT5fFS9Lz6FjJo=/ems.ZW1zLXByZC1hc3NldHMvbW92aWVzLzZhYTNjZDA3LTVjNjQtNGE4NC04MGNiLTU3YTJkODA0ZTQyZC53ZWJw
			(domain === "resizing.flixster.com" && /\/https?:\/\//.test(src)) ||
			// https://thumborcdn.acast.com/d8tlFFORdMw5lXAJgMLoGb-5Ypo=/3000x3000/https://mediacdn.acast.com/assets/8f9c2622-921e-4f71-bcad-043c26db5c97/cover-image-k8tyecor-gpww.jpg
			//   https://mediacdn.acast.com/assets/8f9c2622-921e-4f71-bcad-043c26db5c97/cover-image-k8tyecor-gpww.jpg
			domain === "thumborcdn.acast.com" ||
			// https://canvas-bridge.tubitv.com/Av2W6OlULP6V1WQLGUWPqP6xQ4Y=/400x574/smart/img.adrise.tv/645476a8-f140-414a-85ee-b5f1883fbfb2.jpg
			//   http://img.adrise.tv/645476a8-f140-414a-85ee-b5f1883fbfb2.jpg
			// https://canvas-bridge02.tubitv.com/3aK622OtdubAPkGLG10S_b_W8Uc=/0x0:3000x1111/1920x676/smart/img.adrise.tv/93ce5dfe-ac5f-404a-9d90-d4ad99ece321.jpg
			//   http://img.adrise.tv/93ce5dfe-ac5f-404a-9d90-d4ad99ece321.jpg
			(domain_nosub === "tubitv.com" && /^canvas-bridge[0-9]*\./.test(domain)) ||
			// https://tcdn.couchsurfing.com/f5Zrw-e1cOqBKOK0fZEXDr-9Pkw=/200x200/smart/https://s3.amazonaws.com/images.couchsurfing.us/LVDN3RK/12303307_l_6c9bbb28ff499cac870b4a9e9f58c618.jpg
			//   https://s3.amazonaws.com/images.couchsurfing.us/LVDN3RK/12303307_l_6c9bbb28ff499cac870b4a9e9f58c618.jpg
			domain === "tcdn.couchsurfing.com" ||
			// https://dyn.media.forbiddenplanet.com/_k-r4_QqqHsO2hkzbxuzwoJvmno=/fit-in/600x600/filters:format(webp):fill(white)/https://media.forbiddenplanet.com/products/20/9c/781b87caf25189d66f6f0014dfdc77bdb045.jpg
			//   https://media.forbiddenplanet.com/products/20/9c/781b87caf25189d66f6f0014dfdc77bdb045.jpg
			domain === "dyn.media.forbiddenplanet.com" ||
			// https://image.goxip.com/eesuNX6sp_mHWuneSBPYOWHqRcI=/fit-in/400x400/filters:fill(white):format(jpeg):quality(80)/https:%2F%2Fi8.amplience.net%2Fi%2Foffice%2F3173008293_sd1.jpg%3F$newpicture$
			//   https://i8.amplience.net/i/office/3173008293_sd1.jpg
			domain === "image.goxip.com" ||
			// https://img.betaseries.com/vg0aCHABxAMwa3qu9piJ6EYX958=/600x900/smart/https%3A%2F%2Fpictures.betaseries.com%2Ffonds%2Fposter%2Fbea491f2795b639a162a260a27453fc2.jpg
			//   https://pictures.betaseries.com/fonds/poster/bea491f2795b639a162a260a27453fc2.jpg
			domain === "img.betaseries.com" ||
			// https://cdn.pinkblog.it/E1RftzoLqeuh7IOqFMEXge5g_Mo=/1920x1280/smart/http://media.fashionblog.it/f/f04/gettyimages-686905852_master.jpg
			//   https://media.fashionblog.it/f/f04/gettyimages-686905852_master.jpg
			domain === "cdn.pinkblog.it" ||
			// thanks to ayunami2000 on github: https://github.com/qsniyg/maxurl/issues/708
			// https://studio.cults3d.com/_LdsGq3tDmC9t74XP-t7baGjUYQ=/516x516/filters:format(webp)/https://files.cults3d.com/uploaders/14440021/illustration-file/e81b3e8e-019c-47f1-aea5-556c2fd7daaf/2.JPG
			//   https://files.cults3d.com/uploaders/14440021/illustration-file/e81b3e8e-019c-47f1-aea5-556c2fd7daaf/2.JPG
			domain === "studio.cults3d.com" ||
			// thanks to Liz on discord
			// https://www.reuters.com/resizer/SdCHS81RJfV9zPqiUlC6xIHRL1U=/1200x628/smart/cloudfront-us-east-2.images.arcpublishing.com/reuters/MO6VHRUXIJKJBIL4TB42NR4DYA.jpg
			//   https://cloudfront-us-east-2.images.arcpublishing.com/reuters/MO6VHRUXIJKJBIL4TB42NR4DYA.jpg
			(domain_nowww === "reuters.com" && string_indexof(src, "/resizer/") >= 0) ||
			// https://image.over-blog.com/TRnO4owbyo-tYCC8mOBtnRbdQqA=/400x400/smart/filters:no_upscale()/http%3A%2F%2Fds1.static.rtbf.be%2Fmedia%2Fprogram%2Fimage%2Fng_16f77a4b0462f166bb12-original.jpg
			//   http://ds1.static.rtbf.be/media/program/image/ng_16f77a4b0462f166bb12-original.jpg
			domain === "image.over-blog.com" ||
			// thanks to Liz on discord for reporting:
			// https://www.tampabay.com/resizer//Tzr1PlPGkMAogS1Kl90DR9VXrTM=/1600x900/smart/cloudfront-us-east-1.images.arcpublishing.com/tbt/3T54ZALEIC37ZE24AFN6DNGVGM.jpg
			//   https://cloudfront-us-east-1.images.arcpublishing.com/tbt/3T54ZALEIC37ZE24AFN6DNGVGM.jpg
			domain_nowww === "tampabay.com" ||
			// thanks to nimbuz on discord:
			// https://www.sanspo.com/article/20210811-53H3GWSCJVLETJN5UE576UULDA/
			// https://www.sanspo.com/resizer/plRt29JSoBn-LLmwBQStvSsRuqA=/0x768/smart/cloudfront-ap-northeast-1.images.arcpublishing.com/sankei/HLUZPQWCQVK7JNILWPVRKHZCBI.jpg
			//   https://www.sanspo.com/resizer/Atu0GIH3YtDhhS2sWLbwN6e3Xwc=/972x648/filters:focal(2046x839:2056x849)/cloudfront-ap-northeast-1.images.arcpublishing.com/sankei/3SO7JFZK5RK5XEHI5REIJ63QVI.jpg
			//   https://www.sanspo.com/resizer/axD5RFG7IsqW0MaFEKQAJViyqu8=/768x512/filters:focal(2046x839:2056x849)/cloudfront-ap-northeast-1.images.arcpublishing.com/sankei/3SO7JFZK5RK5XEHI5REIJ63QVI.jpg
			//   https://www.sanspo.com/resizer/NvG4oJOuHC35iR1DJIveku5Qj88=/730x0/filters:focal(2046x839:2056x849)/cloudfront-ap-northeast-1.images.arcpublishing.com/sankei/3SO7JFZK5RK5XEHI5REIJ63QVI.jpg
			//   https://cloudfront-ap-northeast-1.images.arcpublishing.com/sankei/HLUZPQWCQVK7JNILWPVRKHZCBI.jpg
			domain_nowww === "sanspo.com" ||
			// thanks to DevWannabe-dot on github: https://github.com/qsniyg/maxurl/issues/888
			// https://i.em.com.br/727sLRr_lrFKjNybpJe9-2NoyKg=/100x66/smart/imgsapp2.uai.com.br/app/da_conteudo_147034442637/2016/10/28/12/20161028112752931152e.jpg
			//   http://imgsapp2.uai.com.br/app/da_conteudo_147034442637/2016/10/28/12/20161028112752931152e.jpg
			// https://i.em.com.br/uPkgj3UhfZ4gk8VUYSugAgxuckY=/100x66/smart/imgsapp2.uai.com.br/app/da_conteudo_147034442637/2016/11/09/21/20170904114344416906o.jpg
			//   http://imgsapp2.uai.com.br/app/da_conteudo_147034442637/2016/11/09/21/20170904114344416906o.jpg
			// https://i.em.com.br/WAaCBWxpHqBY1PDAeh6eQ_7uKqA=/330x220/smart/imgsapp.em.com.br/portlet/523/22262/20210829095155428851a.jpg -- 1x1
			//   https://imgsapp.em.com.br/portlet/523/22262/20210829095155428851a.jpg -- 404
			domain === "i.em.com.br" ||
			// thanks to Liz on discord
			// https://images.gofundme.com/jsjw6aOpW3FsJZU2j10YbkQ0CVY=/720x405/https://d2g8igdw686xgo.cloudfront.net/59742119_1630767439120440_r.png
			//   https://d2g8igdw686xgo.cloudfront.net/59742119_1630767439120440_r.png
			domain === "images.gofundme.com" ||
			// thanks to WmeLuna on github: https://github.com/qsniyg/maxurl/issues/967
			// https://images.cults3d.com/Kolaywaa0oegyFxo6moObRFdB1A=/516x516/filters:format(webp)/https://files.cults3d.com/uploaders/17345056/illustration-file/c1985272-65c9-4405-802d-880e3372f3f6/IMG_20200321_205956.jpg
			//   https://files.cults3d.com/uploaders/17345056/illustration-file/c1985272-65c9-4405-802d-880e3372f3f6/IMG_20200321_205956.jpg
			domain === "images.cults3d.com" ||
			// thanks to roi:
			// https://thumb.spokesman.com/xjrxLhX0W4uM5rg5c5WGkxsLX9k=/1170x0/smart/media.spokesman.com/photos/2023/02/24/63f9419ac8234.hires.jpg
			//   https://media.spokesman.com/photos/2023/02/24/63f9419ac8234.hires.jpg
			domain === "thumb.spokesman.com" ||
			// thanks to roi:
			// https://th-thumbnailer.cdn-si-edu.com/FxfcNVz4Bw3jloH5ijVBQVEaRuU=/fit-in/1072x0/https://tf-cmsv2-smithsonianmag-media.s3.amazonaws.com/filer/1e/44/1e445a58-f803-436f-883d-5d07e13a45d8/dkwx7b.jpg
			//   https://tf-cmsv2-smithsonianmag-media.s3.amazonaws.com/filer/1e/44/1e445a58-f803-436f-883d-5d07e13a45d8/dkwx7b.jpg
			domain === "th-thumbnailer.cdn-si-edu.com" ||
			// https://scalethumb.leparking.fr/unsafe/331x248/smart/https%3A%2F%2Fimages.craigslist.org%2F00202_bzcGuyYH49n_0CI0t2_600x450.jpg
			//   https://images.craigslist.org/00202_bzcGuyYH49n_0CI0t2_1200x900.jpg
			domain === "scalethumb.leparking.fr" ||
			// thanks to roi:
			// https://img.gva.be/bBe8JRVsumx6YyZ0oBrb1lCi85k=/0x0:0x0/640x427/smart/https%3A%2F%2Fstatic.gva.be%2FAssets%2FImages_Upload%2F2023%2F04%2F25%2F1f61b72f-504f-4727-b35f-71192b892250.jpg
			//   https://static.gva.be/Assets/Images_Upload/2023/04/25/1f61b72f-504f-4727-b35f-71192b892250.jpg
			domain === "img.gva.be" ||
			// thanks to roi:
			// https://img.hbvl.be/wOdzhcX53meFpwYs46DNnCBhl6Y=/1280x853/smart/https%3A%2F%2Fstatic.hbvl.be%2FAssets%2FImages_Upload%2F2023%2F04%2F25%2F2c3f88d0-bc83-42ce-b873-11c429e73cb8.jpg
			//   https://static.hbvl.be/Assets/Images_Upload/2023/04/25/2c3f88d0-bc83-42ce-b873-11c429e73cb8.jpg
			domain === "img.hbvl.be" ||
			// thanks to roi:
			// https://img.nieuwsblad.be/d2aZFZDuYzldB5YlCNeWxY1-I20=/0x0:0x0/640x427/smart/https%3A%2F%2Fstatic.nieuwsblad.be%2FAssets%2FImages_Upload%2F2023%2F04%2F25%2Fsqdfqsd.jpg
			//   https://static.nieuwsblad.be/Assets/Images_Upload/2023/04/25/sqdfqsd.jpg
			domain === "img.nieuwsblad.be" ||
			// thanks to anonymous for reporting:
			// https://media.customon.com/unsafe/600x600/img.customon.com/img/26934547/93026,14,2,0,12,173,237,28.45,0,703c4a14441fbc231fdd3e63276d2ab7/merchantimagenew/tiktok-haters-men-s-t-shirt-black.jpg
			//   https://img.customon.com/img/26934547/93026,14,2,0,12,173,237,28.45,0,703c4a14441fbc231fdd3e63276d2ab7/merchantimagenew/tiktok-haters-men-s-t-shirt-black.jpg
			domain === "media.customon.com" ||
			// thanks to sn3akyb3ar on github: https://github.com/qsniyg/maxurl/issues/1256
			// https://images.ecestaticos.com/9cgcsvmkyC8-YZ1q-gpt7oYLlmQ=/0x326:2275x3307/1440x1920/filters:fill(white):format(jpg)/f.elconfidencial.com%2Foriginal%2F16b%2Fde7%2F19e%2F16bde719e1cdf5bf5b75916dd34b02b7.jpg
			//   https://f.elconfidencial.com/original/16b/de7/19e/16bde719e1cdf5bf5b75916dd34b02b7.jpg
			domain === "images.ecestaticos.com" ||
			// thanks to roi:
			// https://img.leidschdagblad.nl/kOT9C7BzOHdG-xtbrT7CHaa0WZo=/640x360/smart/https%3A%2F%2Fcdn-kiosk-api.telegraaf.nl%2Ff56290f0-c921-11ee-a090-0217670beecd.jpg
			//   https://cdn-kiosk-api.telegraaf.nl/f56290f0-c921-11ee-a090-0217670beecd.jpg
			domain === "img.leidschdagblad.nl" ||
			src.match(/:\/\/[^/]*\/thumbor\/[^/]*=\//) ||
			// https://www.orlandosentinel.com/resizer/tREpzmUU7LJX1cbkAN-unm7wL0Y=/fit-in/800x600/top/filters:fill(black)/arc-anglerfish-arc2-prod-tronc.s3.amazonaws.com/public/XC6HBG2I4VHTJGGCOYVPLBGVSM.jpg
			//   http://arc-anglerfish-arc2-prod-tronc.s3.amazonaws.com/public/XC6HBG2I4VHTJGGCOYVPLBGVSM.jpg
			src.match(/:\/\/[^/]*\/resizer\/[^/]*=\/(?:fit-in\/+)?[0-9]+x[0-9]+(?::[^/]*\/[0-9]+x[0-9]+)?\/(?:filters:[^/]*\/)?/)) {
			// https://cdn.vox-cdn.com/thumbor/ta2xdyUViVrBXCLGapdwLY7is_s=/0x0:3000x2355/1200x800/filters:focal(1116x773:1596x1253)/cdn.vox-cdn.com/uploads/chorus_image/image/55856727/815434448.0.jpg
			//   https://cdn.vox-cdn.com/uploads/chorus_image/image/55856727/815434448.0.jpg
			// https://cdn.vox-cdn.com/thumbor/dXu99BQwBagCavae7oYNG0uBfxQ=/0x46:1100x779/1200x800/filters:focal(0x46:1100x779)/cdn.vox-cdn.com/assets/1763547/Screenshot_2012.11.12_10.39.10.jpg
			// https://cdn.vox-cdn.com/thumbor/iTJF1PhWPiR3-LoITuXxS2u8su0=/1200x0/filters:no_upscale()/cdn.vox-cdn.com/uploads/chorus_asset/file/4998263/keenan_2010.0.jpg
			// https://dotesports-cdn-prod-tqgiyve.stackpathdns.com/thumbor/baiRf8sOE9flXNjU5cHytZ9fqwA=/1200x0/filters:no_upscale()/https://dotesports-cdn-prod-tqgiyve.stackpathdns.com/article/ee3f5018-0e8b-4e5f-b040-c466c8979315.png
			//   https://dotesports-cdn-prod-tqgiyve.stackpathdns.com/article/ee3f5018-0e8b-4e5f-b040-c466c8979315.png
			// https://www.armytimes.com/resizer/M5qc8PYkbDFYKpOg0Bt-5rxWMXE=/1200x0/filters:quality(100)/arc-anglerfish-arc2-prod-mco.s3.amazonaws.com/public/QRMIMUNV7ZDDJFOLI5FJSYZKQI.jpg
			//   http://arc-anglerfish-arc2-prod-mco.s3.amazonaws.com/public/QRMIMUNV7ZDDJFOLI5FJSYZKQI.jpg
			// http://www.latimes.com/resizer/S-IaQvJtBOga26puDEgDkHihCqE=/1400x0/arc-anglerfish-arc2-prod-tronc.s3.amazonaws.com/public/TQAY2PZTVBAQVBCFEMZRY57HSE.jpg
			//   http://arc-anglerfish-arc2-prod-tronc.s3.amazonaws.com/public/TQAY2PZTVBAQVBCFEMZRY57HSE.jpg
			// https://thumbnails.trvl-media.com/8ngGMfPTsqKt4MGmUrf-ErVrGm4=/a.travel-assets.com/mediavault.le/media/9eed34ce4955bc445d38357fa3eb076400431778.jpeg
			//   http://a.travel-assets.com/mediavault.le/media/9eed34ce4955bc445d38357fa3eb076400431778.jpeg
			// https://thumbnails.trvl-media.com/cPqnei5uS1AEzRn7k5XzNoUjFuo=/534x356/images.trvl-media.com/hotels/1000000/30000/22100/22046/22046_358_y.jpg
			// https://www.theglobeandmail.com/resizer/fyZn3o3OC1db2M-zd1Vkc0Z-O8I=/0x80:5738x3906/400x0/filters:quality(80)/arc-anglerfish-tgam-prod-tgam.s3.amazonaws.com/public/GVZVQCEPZFKPHG4UAE2AEI3PQU.jpg
			//   http://arc-anglerfish-tgam-prod-tgam.s3.amazonaws.com/public/GVZVQCEPZFKPHG4UAE2AEI3PQU.jpg
			// https://thumbor-static.factorymedia.com/qBeNkBSFgEWpq0AbpElby6YyNTs=/1920x1080/smart/http%3A%2F%2Fcoresites-cdn.factorymedia.com%2Fmpora_new%2Fwp-content%2Fuploads%2F2015%2F12%2FSea-Life-Aquariums-Animal-Captivity-Beluga-Whale.jpg
			//   http://coresites-cdn.factorymedia.com/mpora_new/wp-content/uploads/2015/12/Sea-Life-Aquariums-Animal-Captivity-Beluga-Whale.jpg
			//return src.replace(/.*\/thumbor\/.*?\/([^/]*\..*)/, "http://$1");
			newsrc = src.replace(/.*?\/(?:thumb(?:or)?|(?:new-)?resizer)\/.*?\/(?:filters(?::|%3A)[^/]*\/)?([a-z]*(?::|%3A)(?:\/|%2F){2}.*)/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);

			newsrc = src.replace(/.*?\/(?:thumb(?:or)?|(?:new-)?resizer)\/.*?\/(?:filters(?::|%3A)[^/]*\/)?([^%/]*\..*)/, "http://$1");
			if (newsrc !== src)
				return newsrc;

			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/[-_A-Za-z0-9]{64}\/([^%/]*\.[^/]*\/)/, "http://$1");
			if (newsrc !== src)
				return newsrc;

			newsrc = src.replace(/^[a-z]+:\/\/[^/]+\/+thumbor\/+[0-9]+x[0-9]+\/+http/, "http");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);

			newsrc = src.replace(/.*?\/(?:[-_A-Za-z0-9]+=|unsafe)\/(?:(?:full-)?fit-in\/)?(?:[0-9x:]+\/)?(?:[0-9x:]+\/)?(?:(?:smart|top|center|middle)\/)?(?:(?:smart|top|center|middle)\/)?(?:filters(?::|%3A)[^/]*\/)?(?:v[0-9]+\/)?((?:https?(?::|%3[aA])(?:\/\/|%2[fF]%2[fF]))?[^/%]*\..*)/, "$1");
			if (newsrc.match(/^[^/]*%2/))
				newsrc = decodeURIComponent(newsrc);

			if (string_indexof(newsrc, "http") !== 0) {
				newsrc = "http://" + newsrc;
			}

			if (newsrc.match(/^[a-z]*%3/) && false)
				newsrc = decodeURIComponent(newsrc);
			return newsrc;
		}

		if (src.match(/:\/\/[^/]*\/astronaut\/uploads\/[a-z]_[^/]*$/)) {
			// http://zoodydesign.com/astronaut/uploads/m_dt8a0843-1.jpg
			// http://astronaut-project.com/astronaut/uploads/s_scenes-1.jpg
			// http://coffeemegane.com/astronaut/uploads/s_buttertoast3.jpg
			// m, s, t
			return src.replace(/\/[a-z]_([^/]*)$/, "/$1");
		}

		if (src.match(/\/spree\/images\/attachments\/[0-9]+\/[0-9]+\/[0-9]+\//) ||
			domain === "d3on60wtl1ot7i.cloudfront.net") {
			// https://static-assets.glossier.com/production/spree/images/attachments/000/001/802/square_tiny/1.jpg?1518217843
			//   https://static-assets.glossier.com/production/spree/images/attachments/000/001/802/original/1.jpg?1518217843
			// http://d3on60wtl1ot7i.cloudfront.net/system/topics/covers/000/000/122/medium/Sfondo-test-j-law.jpg?1460719638
			//   http://d3on60wtl1ot7i.cloudfront.net/system/topics/covers/000/000/122/big/Sfondo-test-j-law.jpg?1460719638
			return src.replace(/(\/[0-9]+\/[0-9]+\/[0-9]+\/)[^/]*\/([^/?]*)[^/]*?$/, "$1original/$2");
		}

		if (src.match(/\/applications\/core\/interface\/imageproxy\/imageproxy\.php/)) {
			// https://www.gfsquad.com/forums/applications/core/interface/imageproxy/imageproxy.php?img=http%3A%2F%2Fpds.joins.com%2Fnews%2Fcomponent%2Filgan_isplus%2F201701%2F13%2F2017011315392489300.jpeg&key=6b519f95396e21199c45a761bfe54fadbb09cf562c31b39591a14f25386ea26c
			//   http://pds.joins.com/news/component/ilgan_isplus/201701/13/2017011315392489300.jpeg
			return decodeURIComponent(src.replace(/.*\/imageproxy\/imageproxy\.php.*?[&?]img=([^&]*).*?$/, "$1"));
		}

		if (src.match(/\/dims[0-9]*\/.*?\/(?:(?:(?:thumbnail|resize)\/[0-9>%A-F]+[xX][0-9>%A-F!+]*[^/]*\/)|(?:crop\/[0-9]+[xX][0-9+]+)).*?(?:\/https?:\/\/|\?url=https?(?:%3A|:))/)) {
			// https://www.usnews.com/dims4/USNEWS/b09d13c/2147483647/thumbnail/970x647/quality/85/?url=http%3A%2F%2Fmedia.beam.usnews.com%2Fd0%2F686a3b584a63500605362dd3a1da31%2Ftag%3Areuters.com%2C2018%3Anewsml_LYNXNPEE25072%3A12018-03-06T044537Z_1_LYNXNPEE25072_RTROPTP_3_THAILAND-POLITICS.JPG
			// https://www.usnews.com/dims4/USNEWS/f128de1/2147483647/thumbnail/640x420/quality/85/?url=http%3A%2F%2Fmedia.beam.usnews.com%2Fbd%2F0cf00f10ccd3788e7b9a42f1717e9d%2Ftag%3Areuters.com%2C2018%3Anewsml_LYNXNPEE1R088%3A12018-02-28T035131Z_1_LYNXNPEE1R088_RTROPTP_3_NORTHKOREA-SOUTHKOREA.JPG
			// https://assets.sourcemedia.com/dims4/default/80669dd/2147483647/thumbnail/1200x630%3E/quality/90/?url=https%3A%2F%2Fassets.sourcemedia.com%2Fd9%2Fdf%2Fdf39cfb641848cd34eb997e96dc1%2Ffp-hockey-thumbnail-3-7-18.jpg
			// http://cdn.expansion.mx/dims4/default/5227468/2147483647/thumbnail/850x478%5E/quality/75/?url=https%3A%2F%2Fcdn.expansion.mx%2Fmedia%2F2010%2F06%2F08%2Fobreros-chinos-trabajadores-china.jpg
			// https://static.politico.com/dims4/default/cf5f5c0/2147483647/thumbnail/1160x629%5E/quality/90/?url=https%3A%2F%2Fstatic.politico.com%2F0f%2F99%2F94afe4ce45b9ab5aae5bab68ba12%2F23-donald-trump-145-gty-1160.jpg
			// https://cdn.peopleewnetwork.com/dims4/default/120c6ea/2147483647/thumbnail/1200x630/quality/90/?url=http%3A%2F%2Fpmd369713tn.download.theplatform.com.edgesuite.net%2FTime_Inc._-_OTT_-_Production%2F938%2F485%2Foscars-red-carpet-live-2018-thumbnail.jpg
			// https://d1nwosmzpc2sru.cloudfront.net/dims4/GG/54de7b9/2147483647/thumbnail/1350x580/quality/90/?url=https%3A%2F%2Fd1nwosmzpc2sru.cloudfront.net%2F27%2Fa8%2Ff64376a04a1babb29fe2f46c651c%2Fdp-bcg54217-online-store-generic-dl.png
			// http://cdn2.uvnimg.com/dims4/default/2fc4182/2147483647/thumbnail/400x250%3E/quality/75/?url=http%3A%2F%2Fcdn4.uvnimg.com%2F18%2F9e%2F0bc507aa44d6a563d06d223a647c%2Funtitled-1.jpg
			// https://cdn.video.nationalgeographic.com/dims4/default/8efd9cf/2147483647/thumbnail/354x199%3E/quality/90/?url=http%3A%2F%2Fcdn.video.nationalgeographic.com%2F6b%2F61%2F546ff7344acaac17399cd281fcef%2Fnw-seo-srt-013-nobel-prize-thumbnail-final.jpg
			//   http://cdn.video.nationalgeographic.com/6b/61/546ff7344acaac17399cd281fcef/nw-seo-srt-013-nobel-prize-thumbnail-final.jpg
			// https://mediadc.brightspotcdn.com/dims4/default/2a5e0c0/2147483647/strip/true/crop/2300x1302+0+16/resize/1060x600!/quality/90/?url=https%3A%2F%2Fmediadc.brightspotcdn.com%2F02%2F1d%2Fbbc21ecf48179b92cc23616443d3%2Fsun.jpg
			//   https://mediadc.brightspotcdn.com/02/1d/bbc21ecf48179b92cc23616443d3/sun.jpg
			// https://static.politico.com/dims4/default/b45191a/2147483647/resize/1160x%3E/quality/90/?url=https%3A%2F%2Fstatic.politico.com%2F85%2Fd5%2F3ffa5d764ae681f97ad70be2eecc%2F171205-mag-taylor-swift-ap-2-1160.jpg
			//   https://static.politico.com/85/d5/3ffa5d764ae681f97ad70be2eecc/171205-mag-taylor-swift-ap-2-1160.jpg
			// https://static.politico.com/dims4/default/20a0af6/2147483647/resize/1920x/quality/90/?url=https%3A%2F%2Fstatic.politico.com%2Fb0%2F1e%2F5ea5a2df4d03aedee69906c04b64%2Fap21131551475985-1.jpg
			//   https://static.politico.com/b0/1e/5ea5a2df4d03aedee69906c04b64/ap21131551475985-1.jpg
			// thanks to anonymous for reporting:
			// https://ca-times.brightspotcdn.com/dims4/default/d52190d/2147483647/strip/true/crop/1600x900+0+0/resize/1200x675!/quality/75/?url=https://california-times-brightspot.s3.amazonaws.com/0d/64/57fe28ae4f0faac1a2549bb47809/957f288a34a2553c782902b890edd230.jpeg
			//   https://california-times-brightspot.s3.amazonaws.com/0d/64/57fe28ae4f0faac1a2549bb47809/957f288a34a2553c782902b890edd230.jpeg
			//
			// https://d33ljpvc0tflz5.cloudfront.net/dims3/MMH/thumbnail/620x392/quality/75/?url=https%3A%2F%2Fd26ua9paks4zq.cloudfront.net%2F68%2F8d%2F197eef2a45cb84795efda4607102%2Fendoscopy-738x399-s1-stk-119373043.jpg
			//   https://d26ua9paks4zq.cloudfront.net/68/8d/197eef2a45cb84795efda4607102/endoscopy-738x399-s1-stk-119373043.jpg
			// http://o.aolcdn.com/dims-shared/dims3/MUSIC/thumbnail/280X390/quality/90/http://o.aolcdn.com/os/music/artist/wikipedia/the-platters-1970.jpg
			// http://o.aolcdn.com/dims-shared/dims3/MUSIC/thumbnail/280X390/http://o.aolcdn.com/os/music/artist/wikipedia/the-platters-1970.jpg
			//   http://o.aolcdn.com/os/music/artist/wikipedia/the-platters-1970.jpg
			// https://s.aolcdn.com/dims-shared/dims3/GLOB/crop/2039x3000+0+0/resize/630x927!/format/jpg/quality/85/https://s.aolcdn.com/hss/storage/midas/4d5ea3524916327c5b9a2d8b7b75dad6/205490598/cara-delevingne-attends-the-premiere-of-europacorp-and-stx-valerian-picture-id817090276
			//   https://s.aolcdn.com/hss/storage/midas/4d5ea3524916327c5b9a2d8b7b75dad6/205490598/cara-delevingne-attends-the-premiere-of-europacorp-and-stx-valerian-picture-id817090276
			newsrc = src.replace(/.*\/(?:thumbnail|crop|resize)\/.*?\/(https?:\/\/.*)/, "$1");
			if (newsrc !== src)
				return newsrc;
			newsrc = src.replace(/.*\/(?:thumbnail|crop|resize)\/.*?\/\?url=(https?.*)/, "$1");
			if (newsrc !== src)
				return decodeURIComponent(newsrc);
		}

		if (src.match(/\/dims\/CSFF\/[0-9]+\/[-0-9]+\/[-0-9]+\/[-0-9]+\/https?:\/\//)) {
			// https://o.aolcdn.com/dims/CSFF/1/90/-/75/http://wppd-images.web.aol.com/fotosrch/0/AFP_19J74A_GTY.jpg
			//   http://wppd-images.web.aol.com/fotosrch/0/AFP_19J74A_GTY.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/dims\/CSFF\/[0-9]+\/[-0-9]+\/[-0-9]+\/[-0-9]+\/(https?:\/\/)/, "$1");
			if (newsrc !== src)
				return newsrc;
		}

		// joomla
		if (src.match(/\/media\/k2\/items\/cache\/[^/]*_[^/]*\.[^/.]*$/)) {
			// http://www.truth-out.org/media/k2/items/cache/3393b2ec8c305f926fd19b07e9a77e2a_L.jpg
			//   http://www.truth-out.org/media/k2/items/src/3393b2ec8c305f926fd19b07e9a77e2a.jpg
			// http://www.frankie.com.au/media/k2/items/cache/d3a6ffb9fa95acd07ae12a9b3648acf3_M.jpg
			//   http://www.frankie.com.au/media/k2/items/src/d3a6ffb9fa95acd07ae12a9b3648acf3.jpg
			return src.replace(/\/cache\/([^/]*)_[^/._]*?(\.[^/.]*)$/, "/src/$1$2");
		}

		// JoomGallery
		// https://github.com/JoomGallery/JoomGallery/tree/master/components/com_joomgallery
		if (src.match(/^[a-z]+:\/\/[^/]*\/index\.php\?.*=com_joomgallery/) ||
			src.match(/^[a-z]+:\/\/[^/]*\/component\/+joomgallery\/+image\./)) {
			// http://www.fotonastenu.ru/index.php?view=image&format=raw&type=thumb&id=2340&option=com_joomgallery
			//   http://www.fotonastenu.ru/index.php?id=2340&format=raw&view=image&option=com_joomgallery&type=orig
			//   http://www.fotonastenu.ru/component/joomgallery/image.raw?view=image&type=orig&format=raw&option=com_joomgallery&id=2340
			// https://life-instyle.com/component/joomgallery/image.raw?view=image&type=orig&id=31914&Itemid=219
			// https://life-instyle.com/index.php?option=com_joomgallery&view=image&format=raw&id=31914&type=img
			// https://life-instyle.com/component/joomgallery/image.raw?view=image&type=img&id=31914

			//id = src.replace(/.*\/index\.php.*?[?&]id=([0-9]+).*?$/, "$1");
			//if (id !== src) {
			//    return src.replace(/\/index\.php.*/, "/index.php?id=" + id + "&format=raw&view=image&option=com_joomgallery&type=orig");
			//}

			if (src.match(/:\/\/[^/]*\/index\.php\?/)) {
				var queries = get_queries(src);

				if (queries.option === "com_joomgallery" && queries.view === "image" && queries.id) {
					return src.replace(/(:\/\/[^/]*\/).*/, "$1component/joomgallery/image.raw?view=image&type=orig&format=raw&option=com_joomgallery&id=" + queries.id);
				}
			}

			if (/\/component\/+joomgallery\/+image\./.test(src)) {
				return keep_queries(src, ["id", "view", "type", "format", "option"], {
					overwrite: {
						"view": "image",
						"type": "orig",
						"format": "raw",
						"option": "com_joomgallery"
					}
				});
			}
		}

		// xenforo
		if (src.match(/:\/\/[^/]*\/+(?:(?:vb|forum)\/+)?proxy\.php\?(?:.*?&)?image=http/) ||
			// // https://www.sat-expert.com/xforum/proxy.php?image=http%3A%2F%2Fr01.imgrock.net%2Fi%2F00001%2Ft4mw4sk35ce3_t.jpg&hash=c1ecc94d810ae45421fc8e96dbed1035
			domain_nowww === "sat-expert.com") {
			// https://defense-arab.com/vb/proxy.php?image=http%3A%2F%2Fimage.newsis.com%2F2016%2F07%2F28%2FNISI20160728_0011966708_web.jpg&hash=43eb7bb12419f7af61c1b6fd2d29232b
			//   http://image.newsis.com/2016/07/28/NISI20160728_0011966708_web.jpg
			// https://www.htforum.com/forum/proxy.php?image=https%3A%2F%2Fteaser-trailer.com%2Fwp-content%2Fuploads%2FArrival-Movie-Poster-9.jpg&hash=a4e1362477802c6871d7d61f4e6be059
			//   https://teaser-trailer.com/wp-content/uploads/Arrival-Movie-Poster-9.jpg
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+(?:[a-z]+\/+)?proxy\.php\?(?:.*?&)?image=(http[^&]*).*?$/, "$1")
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		// django-photologue
		if (/\/media\/+photologue\/+photos\/+cache\//.test(src)) {
			// http://www.thewesternstar.com/media/photologue/photos/cache/EDM113447235_large.jpg
			//   http://www.thewesternstar.com/media/photologue/photos/EDM113447235.jpg
			// http://www.django-photologue.net/media/photologue/photos/cache/312960255_85e378833b_o_thumbnail.jpg
			//   http://www.django-photologue.net/media/photologue/photos/312960255_85e378833b_o.jpg
			return src.replace(/\/cache\/+([^/]*)_[a-z]+(\.[^/.]*(?:[?#].*)?)$/, "/$1$2");
		}

		if (/\/\.evocache\/+([^/]*\.[^/]*)\/+fit-[0-9]+x[0-9]+\.[^/.]*(?:[?#].*)?$/.test(src)) {
			// http://look.onemonkey.org/.evocache/LondonBUR.png/fit-80x80.png
			// https://www.urbanrealm.com/blogs/media/blogs/pauls/.evocache/IMG_0494.JPG/fit-720x500.JPG?mtime=1530381418
			//   https://www.urbanrealm.com/blogs/media/blogs/pauls/IMG_0494.JPG
			return src.replace(/\/\.evocache\/+([^/]*\.[^/]*)\/+[^/]*(?:[?#].*)?$/, "/$1");
		}

		if (src.match(/:\/\/[^/]*\/yahoo_site_admin[0-9]*\/assets\/images\//)) {
			// http://www.asthedj.com/yahoo_site_admin2/assets/images/IMG_5618.13210131_large.JPG
			//   http://www.asthedj.com/yahoo_site_admin2/assets/images/IMG_5618.13210131.JPG
			// http://gio-ott.com/yahoo_site_admin2/assets/images/_MG_9380.20591513_large.jpg
			//   http://gio-ott.com/yahoo_site_admin2/assets/images/_MG_9380.20591513.jpg
			// http://www.spiritwalkministry.com/yahoo_site_admin2/assets/images/stonehenge-full-moon-night.27260345_std.jpg
			//   http://www.spiritwalkministry.com/yahoo_site_admin2/assets/images/stonehenge-full-moon-night.27260345.jpg
			// http://www.merrickartgallery.org/yahoo_site_admin2/assets/images/Merrick_Masters_Cover.12375349_std.jpg
			//   http://www.merrickartgallery.org/yahoo_site_admin2/assets/images/Merrick_Masters_Cover.12375349.jpg
			return src.replace(/(\.[0-9]+)_[a-z]+(\.[^/.]*)$/, "$1$2");
		}

		if (domain_nowww === "dvdprime.com" ||
			// https://mania.kr/dvdprime/public_html/g2/data/file/comm/view_thumbnail/1536714695_eB0A3D7s_05.jpg
			//   https://mania.kr/dvdprime/public_html/g2/data/file/comm/1536714695_eB0A3D7s_05.jpg
			domain_nowww === "mania.kr" ||
			// https://hiphopplaya.com/g2/data/cheditor5/1806/view_thumbnail/mania-done-20180621001609_mduiyalw.jpg
			//   https://hiphopplaya.com/g2/data/cheditor5/1806/mania-done-20180621001609_mduiyalw.jpg
			src.match(/\/data\/+cheditor[0-9]*\/+[0-9]+\/+view_thumbnail\/+[^/]+(?:[?#].*)?$/)) {
			// https://dvdprime.com/g2/data/cheditor5/1806/view_thumbnail/mania-done-20180618175156_aftmezvl.jpg
			//   https://dvdprime.com/g2/data/cheditor5/1806/mania-done-20180618175156_aftmezvl.jpg
			// https://dvdprime.com/g2//data/file/comm/view_thumbnail/135924_201180154028029.jpg
			//   https://dvdprime.com/g2//data/file/comm/135924_201180154028029.jpg
			return src.replace(/\/view_thumbnail\/([^/]*)$/, "/$1");
		}

		if (src.match(/\/images\/easyblog_articles\/[0-9]+\/b2ap3_[^/]*$/)) {
			// http://veetbox.ru/images/easyblog_articles/1747/b2ap3_small_36.jpg
			//   http://veetbox.ru/images/easyblog_articles/1747/36.jpg
			// http://hcesd9.org/images/easyblog_articles/6/b2ap3_small_IMG_8444.JPG
			//   http://hcesd9.org/images/easyblog_articles/6/IMG_8444.JPG
			// large, medium, small, icon, thumbnail
			return src.replace(/\/b2ap3_[a-z]+_([^/]*)$/, "/$1");
		}

		if (src.match(/\/wp-content\/plugins\/BdSGallery\//)) {
			// https://blogdesuperheroes.es/wp-content/plugins/BdSGallery/BdSGaleria/69235_medium.jpg
			//   https://blogdesuperheroes.es/wp-content/plugins/BdSGallery/BdSGaleria/69235.jpg
			return src.replace(/(\/BdSGallery\/BdSGaleria\/[0-9]+)_[a-z]+(\.[^/.]*)$/, "$1$2");
		}

		if ((((domain_nosub === "fbcdn.net" && domain.match(/^external[-.].*\.fbcdn\.net/)) ||
			  // https://img.globuya.com/2/safe_image.php?d=AQCqGACH61FCb4Jm&url=http%3A%2F%2Fmtdata.ru%2Fu18%2Fphoto2F2D%2F20511034205-0%2Foriginal.jpg&_nc_hash=AQChQHo04N9q7EES
			  //   http://mtdata.ru/u18/photo2F2D/20511034205-0/original.jpg
			  domain === "img.globuya.com" ||
			  // https://img.gluseum.com/2/safe_image.php?d=AQCxf7NZReZYk3Rh&url=https%3A%2F%2Fwww.army.mil%2Fe2%2Fc%2Fimages%2F2017%2F07%2F30%2F487195%2Fsize2.jpg&_nc_hash=AQA7FsCtw6bphTLG
			  //   https://www.army.mil/e2/c/images/2017/07/30/487195/size2.jpg
			  domain === "img.gluseum.com" ||
			  // https://img.govserv.org/2/safe_image.php?d=AQCG0Wjodv3cqn93&url=https%3A%2F%2Fwww.army.mil%2Fe2%2Fc%2Fimages%2F2017%2F07%2F04%2F484198%2Fsize2.jpg&_nc_hash=AQCKXvmTRivEICKk
			  //   https://www.army.mil/e2/c/images/2017/07/04/484198/size2.jpg
			  domain === "img.govserv.org" ||
			  // https://img.gleauty.com/2/safe_image.php?d=AQChuRdGJPcVKNPt&url=http%3A%2F%2Fstatic.ounousa.com%2Fcontent%2Fuploads%2FArticle%2F160914105046133.jpg&_nc_hash=AQDsb3aUh7VMOuHy
			  //   http://static.ounousa.com/content/uploads/Article/160914105046133.jpg
			  domain === "img.gleauty.com") || (
				  src.match(/^[a-z]+:\/\/[^/]*\/2\/safe_image\.php.*?[?&]url=http/)
			  )) && string_indexof(src, "/safe_image.php?") >= 0) {
			// https://external.xx.fbcdn.net/safe_image.php?d=AQAWoxh_q3ft0f3S&w=130&h=130&url=https%3A%2F%2Fi2.wp.com%2Fblog.native-instruments.com%2Fwp-content%2Fuploads%2F2018%2F01%2Fnative-summit-at-namm-collaborating-on-the-future-of-sound-hero.jpg%3Ffit%3D1920%252C880%26ssl%3D1&cfs=1&sx=257&sy=0&sw=880&sh=880&_nc_hash=AQCDl7GN-wkuS3BX
			//   http://blog.native-instruments.com/wp-content/uploads/2018/01/native-summit-at-namm-collaborating-on-the-future-of-sound-hero.jpg
			// https://external.fyvr3-1.fna.fbcdn.net/safe_image.php?d=AQAReTYxnQTQOpsB&w=147&h=147&url=https%3A%2F%2Fi.ytimg.com%2Fvi%2FxTo02rvrMXE%2Fhqdefault.jpg&cfs=1&upscale=1&fallback=news_d_placeholder_publisher&sx=120&sy=0&sw=360&sh=360&_nc_eui2=AeGEb7UCGGY2knZiITvwfUugt_JGWM192SmN_z8mNrwGcVY5H1PaPbuXuA21koF5ehdVgERy7WFFxu1GcWy4TKrhpVjj9d-tyHC8Jv-Qn3GT9A&_nc_hash=AQDxVA0hfYftm3Fv
			//   https://i.ytimg.com/vi/xTo02rvrMXE/hqdefault.jpg
			// https://external-nrt1-1.xx.fbcdn.net/safe_image.php?d=AQA0Qrj3UrBqwph6&w=540&h=282&url=https%3A%2F%2Fcf-images.ap-northeast-1.prod.boltdns.net%2Fv1%2Fstatic%2F5490902205001%2F11125029-995e-4552-94f7-6da055300145%2F305c21f2-9fb5-4d25-b219-5c3d061cf604%2F1280x720%2Fmatch%2Fimage.jpg&cfs=1&upscale=1&fallback=news_d_placeholder_publisher&_nc_hash=AQAdZJ-Y-F2DTZhP
			//   https://cf-images.ap-northeast-1.prod.boltdns.net/v1/static/5490902205001/11125029-995e-4552-94f7-6da055300145/305c21f2-9fb5-4d25-b219-5c3d061cf604/1280x720/match/image.jpg
			newsrc = src.replace(/.*\/safe_image\.php\?(?:.*&)?url=([^&]+).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain_nowww === "beckygworld.com" ||
			// http://mariahsworld.com/public/img/posts/photos/81_c8989ab5702aa4f3851726aae479eb20_l.jpg
			//   http://mariahsworld.com/public/img/posts/photos/81_c8989ab5702aa4f3851726aae479eb20.jpg
			domain_nowww === "mariahsworld.com" ||
			// http://nferaclub.com/public/img/posts/photos/11_2f0c94c62faa8007f9052d36a19725c5_l.jpg
			//   http://nferaclub.com/public/img/posts/photos/11_2f0c94c62faa8007f9052d36a19725c5.jpg
			domain_nowww === "nferaclub.com" ||
			// http://www.tdjakes.com/public/img/posts/photos/226_71724cada4d8cc8a13e5d6e61e2047c2_l.jpg
			//   http://www.tdjakes.com/public/img/posts/photos/226_71724cada4d8cc8a13e5d6e61e2047c2.jpg
			domain_nowww === "tdjakes.com" ||
			src.match(/^[a-z]+:\/\/[^/]*\/public\/img\/posts\/photos\/[0-9]+_[0-9a-f]+_[a-z]\.[^/.]*$/)) {
			// http://beckygworld.com/public/img/posts/photos/146_3f719931b900b94fd25153b75723ca63_l.jpg
			//   http://beckygworld.com/public/img/posts/photos/146_3f719931b900b94fd25153b75723ca63.jpg
			return src.replace(/(\/img\/posts\/photos\/[0-9]+_[0-9a-f]+)_[a-z](\.[^/.]*)$/, "$1$2");
		}

		if (domain_nowww === "airlinerphotos.com" ||
			src.match(/\/wp-content\/+(?:uploads\/(?:.*?\/)?nggallery|[gG]allery)\/(?:.*?\/)?(?:cache|dynamic)\/+[^/]+\.[^-_/.]*-nggid[0-9]+-ngg0dyn-[^/]*$/)) {
			// https://ojp8zqasz32qat8n13om56p4-wpengine.netdna-ssl.com/wp-content/uploads/sites/1/nggallery/billboard-music-awards-2018/dynamic/NUP_183094_0909.JPG-nggid0515516-ngg0dyn-100x150x100-00f0w010c011r110f110r010t010.JPG
			//   https://ojp8zqasz32qat8n13om56p4-wpengine.netdna-ssl.com/wp-content/uploads/sites/1/nggallery/billboard-music-awards-2018/NUP_183094_0909.JPG
			// http://bndasupamark.com/wp-content/gallery/review-of-beccas-knockout-secret-v/cache/FWR-BECCAS-KNOCKOUT-SECRET-V-23.jpg-nggid06191421-ngg0dyn-160x90x100-00f0w010c011r110f110r010t010.jpg
			//   http://bndasupamark.com/wp-content/gallery/review-of-beccas-knockout-secret-v/FWR-BECCAS-KNOCKOUT-SECRET-V-23.jpg
			// http://www.boobjunkie.com/wp-content/gallery/ariel-rebel-natural-light/cache/Natural_Light-100-lg.jpg-nggid0510921-ngg0dyn-181x150x100-00f0w010c011r110f110r010t010.jpg
			//   http://www.boobjunkie.com/wp-content/gallery/ariel-rebel-natural-light/Natural_Light-100-lg.jpg
			// http://paparazzioops.com/wp-content/Gallery/amanda-seyfried-photoshoot-in-miami/dynamic/Amanda-Seyfried-38.JPG-nggid046093-ngg0dyn-250x250x100-00f0w010c011r110f110r010t010.JPG
			//   http://paparazzioops.com/wp-content/Gallery/amanda-seyfried-photoshoot-in-miami/Amanda-Seyfried-38.JPG
			// thanks to llacb47 on github: https://github.com/qsniyg/maxurl/issues/396
			// https://www.airlinerphotos.com/gallery/photo-blog-2020/cache/TC-SNU_9.jpg-nggid046820-ngg0dyn-0x250-00f0w010c010r110f110r010t010.jpg
			//   https://www.airlinerphotos.com/gallery/photo-blog-2020/TC-SNU_9.jpg
			return src.replace(/\/(?:cache|dynamic)(\/+[^/]+\.[^-_/.]+)-[^/]*$/, "$1");
			//return src.replace(/(\/wp-content\/+gallery\/+[^/]+\/+)(?:cache|dynamic)\/+([^/]*?\.[^/.-]+)-[^/]*\.[^/.]*(?:[?#].*)?$/, "$1$2");
		}

		// foogallery
		if (src.match(/\/+wp-content\/+uploads\/+cache\/+[0-9]{4}\/+[0-9]{2}\/+[^/]*\/+[0-9]+\.[^/.]*(?:[?#].*)?$/)) {
			// https://dbkpop.com/wp-content/uploads/cache/2016/12/momoland_ahin-2/3583950332.jpg
			//   https://dbkpop.com/wp-content/uploads/2016/12/momoland_ahin-2.jpg
			// https://foo.gallery/wp-content/uploads/cache/2014/07/Jetty_On_A_Lake/2105777814.jpg
			//   https://foo.gallery/wp-content/uploads/2014/07/Jetty_On_A_Lake.jpg
			return src.replace(/\/+wp-content\/+uploads\/+cache\/+([0-9]{4}\/+[0-9]{2}\/+[^/]*)\/+[0-9]+(\.[^/.]*)([?#].*)?$/,
							   "/wp-content/uploads/$1$2$3");
		}

		// NextGEN gallery
		if (domain_nowww === "mywhere.it" ||
			// https://www.radiowebitalia.it/wp-content/flagallery/lea-seydoux/thumbs/thumbs_lea-seydoux-3.jpg
			//   https://www.radiowebitalia.it/wp-content/flagallery/lea-seydoux/lea-seydoux-3.jpg
			// https://www.radiowebitalia.it/wp-content/flagallery/lea-seydoux/webview/lea-seydoux-3.jpg
			//   https://www.radiowebitalia.it/wp-content/flagallery/lea-seydoux/lea-seydoux-3.jpg
			domain_nowww === "radiowebitalia.it" ||
			src.match(/\/+wp-content\/+gallery\/+[^/]*\/+thumbs\/+thumbs_([^/]*\.[^/.]*)(?:[?#].*)?$/)) {
			// http://www.exquisitecutandfashion.com/wp-content/gallery/remix_gallery/thumbs/thumbs_catwalk1a_orig1.jpg
			//   http://www.exquisitecutandfashion.com/wp-content/gallery/remix_gallery/catwalk1a_orig1.jpg
			// https://www.imagely.com/wp-content/gallery/landscapes/thumbs/thumbs_A-Landscapes-107.JPG
			//   https://www.imagely.com/wp-content/gallery/landscapes/A-Landscapes-107.JPG
			// https://www.mywhere.it/wp-content/flagallery/007-spectre/thumbs/thumbs_lea_seydoux_cannes_2014_cropped.jpg
			//   https://www.mywhere.it/wp-content/flagallery/007-spectre/lea_seydoux_cannes_2014_cropped.jpg
			return src.replace(/(\/+wp-content\/+[^/]*\/+[^/]*\/+)(?:thumbs\/+thumbs_|webview\/+)([^/]*\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		if (src.match(/\/+wp-content\/+plugins\/+doptg\/+uploads\/+thumbs\/+/)) {
			// https://cleancut.fashion/wp-content/plugins/doptg/uploads/thumbs/HFAA5YPGhasjgh7CtBdFe86sTxrdxWBKDCXSZ8xskWzLOm6xd46WQ23nWS6segHd4.jpg
			//   https://cleancut.fashion/wp-content/plugins/doptg/uploads/HFAA5YPGhasjgh7CtBdFe86sTxrdxWBKDCXSZ8xskWzLOm6xd46WQ23nWS6segHd4.jpg
			return src.replace(/\/+wp-content\/+plugins\/+doptg\/+uploads\/+thumbs\/+/, "/wp-content/plugins/doptg/uploads/");
		}

		if (src.match(/\/wp-content\/+plugins\/+phastpress\/+phast\.php\/+/)) {
			// http://kleinburd.ru/news/wp-content/plugins/phastpress/phast.php/http-3A-2F-2Fkleinburd.ru-2Fnews-2Fwp-2Dcontent-2Fuploads-2F2017-2F03-2Fzhenskaya-2Dkrasota-2Di-2Docharovanie-2Dna-2Dfoto-2Ddavida-2Ddubnickogo-2D1-2D2.jpg/service=images/cacheMarker=1490624451-2D109216/token=17cda995d3429bf9/__p__.jpg
			//   http://kleinburd.ru/news/wp-content/uploads/2017/03/zhenskaya-krasota-i-ocharovanie-na-foto-davida-dubnickogo-1-2.jpg
			newsrc = src.replace(/.*\/wp-content\/+plugins\/+phastpress\/+phast\.php\/+([^/]*)\/.*?$/, "$1");
			if (newsrc !== src) {
				return newsrc.replace(/(-[0-9A-F][0-9A-F])/g, function(x){return decodeURIComponent(x.replace(/^-/, "%"));});
			}
		}

		// bitrix
		if (domain_nowww === "krauzer.ru" ||
			// https://kino.tricolor.tv/upload/resize_cache/iblock/dc0/800_800_1/bf1603d051ab8d4e2c0e8865885685d2740702740b52d7b809d1f848dd80e68e-1024x1024.jpg
			//   https://kino.tricolor.tv/upload/iblock/dc0/bf1603d051ab8d4e2c0e8865885685d2740702740b52d7b809d1f848dd80e68e-1024x1024.jpg
			domain === "kino.tricolor.tv" ||
			// https://msk3.prostitutki.today/upload/resize_cache/iblock/1af/500_271_1bef11cd7ae2ac42a866dde02fb269503/25024345_1592405487517223_8556521503078744064_n.jpg
			//   https://msk3.prostitutki.today/upload/iblock/1af/25024345_1592405487517223_8556521503078744064_n.jpg
			domain_nosub === "prostitutki.today" ||
			// http://www.menslife.com/upload/resize_cache/iblock/4c0/300_225_1/Rachel_McAdams_The_T-212.jpg?1546325110bx_3966226736_22780
			//   http://www.menslife.com/upload/iblock/4c0/Rachel_McAdams_The_T-212.jpg?1546325110bx_3966226736_22780
			domain_nowww === "menslife.com" ||
			// http://www.sncmedia.ru/upload/resize_cache/iblock/9f4/400_1000_1/9f4f08d742e2118787bd6e5ee83a5980.jpg
			//   http://www.sncmedia.ru/upload/iblock/9f4/9f4f08d742e2118787bd6e5ee83a5980.jpg
			// http://www.sncmedia.ru/upload/iblock/2d7/2d7149f15733665522b9be9e7ab72694_w877_h500_crp.jpg
			//   http://www.sncmedia.ru/upload/iblock/2d7/2d7149f15733665522b9be9e7ab72694.jpg
			domain_nowww === "sncmedia.ru" ||
			// http://www.fashiontime.ru/upload/iblock/c4e/c4e2c768f02d71ce016c2457d0788280w250.jpg
			//   http://www.fashiontime.ru/upload/iblock/c4e/c4e2c768f02d71ce016c2457d0788280.jpg
			domain_nowww === "fashiontime.ru" ||
			// https://www.hi-fi.ru/upload/resize_cache/medialibrary/63c/513_700_1/63c463e12aecb85b4c25f02e6dab630d.jpg
			//   https://www.hi-fi.ru/upload/medialibrary/63c/63c463e12aecb85b4c25f02e6dab630d.jpg
			domain_nowww === "hi-fi.ru" ||
			// http://super.ru/upload/iblock/4ca/4cad0d094ca6ff449fc32e0d63c1c97f_w749_h905_nocrp.jpg
			//   http://super.ru/upload/iblock/4ca/4cad0d094ca6ff449fc32e0d63c1c97f.jpg
			domain_nowww === "super.ru" ||
			// thanks to roi:
			// https://fclm-new.hb.bizmrg.com/resize_cache/201349/c0d027c4b3631823a744cb4d5a9c8473/iblock/611/6111faf9165398abe897323f648231cf/3b3f534b241a3fea2c87b4ef4801c9b6.jpg
			//   https://fclm-new.hb.bizmrg.com/iblock/611/6111faf9165398abe897323f648231cf/3b3f534b241a3fea2c87b4ef4801c9b6.jpg
			domain === "fclm-new.hb.bizmrg.com" ||
			// thanks to roi:
			// https://media-1obl-ru.storage.yandexcloud.net/resize_cache/689506/83132dad08c79bfbcc1d891fdcdbb658/iblock/804/8046cc6d9e9460d4cdbe5fe28f63d5ef.jpg
			//   https://media-1obl-ru.storage.yandexcloud.net/iblock/804/8046cc6d9e9460d4cdbe5fe28f63d5ef.jpg
			domain === "media-1obl-ru.storage.yandexcloud.net" ||
			// thanks to roi:
			// https://icearenamsk.ru/upload/resize_cache/iblock/ef3/2hfictpoiiz0nrekjj6rkbwql841lzn6/775_500_2/1.jpg
			//   https://icearenamsk.ru/upload/iblock/ef3/2hfictpoiiz0nrekjj6rkbwql841lzn6/1.jpg
			domain_nowww === "icearenamsk.ru" ||
			// thanks to anonymous for reporting:
			// https://spb.office-plus.ru/upload/webp/iblock/3b7/4d1tp9e0tkf2s4ld7ir465ej1y0gdua8/ofisnaya_mebel_layt_photo_01.webp
			//   https://spb.office-plus.ru/upload/iblock/3b7/4d1tp9e0tkf2s4ld7ir465ej1y0gdua8/ofisnaya-mebel-layt-photo-01.jpg
			//domain === "spb.office-plus.ru" ||
			// thanks to anonymous for reporting:
			// https://ru.viomi.com/upload/resize_cache/iblock/afc/3yj9jd912hjxilml8zuxdbfgs9eni9jn/940_940_1/Viomi_V5_Pro_Black_Gallery_03.jpg
			//   https://ru.viomi.com/upload/iblock/afc/3yj9jd912hjxilml8zuxdbfgs9eni9jn/Viomi_V5_Pro_Black_Gallery_03.jpg
			domain === "ru.viomi.com" ||
			// https://www.sb.by/upload/resize_cache/slam.image/iblock/2bb/855_2000_1/2bb028a9c7ce97a07fc667b3bd54f00c.JPG
			//   https://www.sb.by/upload/iblock/2bb/2bb028a9c7ce97a07fc667b3bd54f00c.JPG
			src.match(/:\/\/[^/]*\/upload\/+resize_cache\/+(?:[^/]*\/+)?iblock\/+[0-9a-f]{3}\/+[0-9]+_[0-9]+_/) ||
			// https://static.tatler.ru/resize_cache_imm/iblock/c30/ff92/326x489_Quality100_c30b71eb02b082af52e89d51d6146db8.jpg
			//   https://static.tatler.ru/iblock/c30/c30b71eb02b082af52e89d51d6146db8.jpg
			src.match(/:\/\/[^/]*\/(?:upload\/+)?resize_cache_imm\/+iblock\/+[0-9a-f]{3}\/+[0-9a-f]{4}\/+[0-9]+x[0-9]+_Quality[0-9]+_[0-9a-f]+\./)) {
			// https://spb.office-plus.ru/upload/webp/iblock/3b7/4d1tp9e0tkf2s4ld7ir465ej1y0gdua8/ofisnaya_mebel_layt_photo_01.webp
			//   https://spb.office-plus.ru/upload/iblock/3b7/4d1tp9e0tkf2s4ld7ir465ej1y0gdua8/ofisnaya-mebel-layt-photo-01.jpg
			//   https://spb.office-plus.ru/upload/iblock/3b7/4d1tp9e0tkf2s4ld7ir465ej1y0gdua8/ofisnaya_mebel_layt_photo_01.jpg -- 404
			/*newsrc = src.replace(/(\/upload\/+)webp\/+(iblock\/+[0-9a-f]{3}\/+[0-9a-z]{10,}\/+[^/]+\.)webp(?:[?#].*)?$/, "$1$2jpg");
			if (newsrc !== src)
				return newsrc;*/

			// http://krauzer.ru/upload/resize_cache/iblock/edf/600_600_1/edfdf59938b3ed07d5bad9c3da49e852.jpg
			//   http://krauzer.ru/upload/iblock/edf/edfdf59938b3ed07d5bad9c3da49e852.jpg
			newsrc = src
				.replace(/\/resize_cache(?:\/+[^/]*)?(\/+[^/]*\/+...\/+)[0-9]+_[0-9]+_[0-9]+\/([0-9a-f]+(?:-[0-9]+x[0-9]+)?\.[^/.]*)$/, "$1$2")
				.replace(/\/resize_cache(?:\/+[^/]*)?(\/+[^/]*\/+...\/+(?:[0-9a-z]{20,}\/+)?)[0-9]+_[0-9]+_[0-9a-f]+\/([^\.]+(?:-[0-9]+x[0-9]+)?\.[^/.]*)$/, "$1$2")
				.replace(/\/resize_cache_imm\/+(iblock\/+[0-9a-f]{3}\/+)[0-9a-f]{4}\/+[0-9]+x[0-9]+_Quality[0-9]+_([0-9a-f]+\.[^/.]*)(?:[?#].*)?$/, "/$1$2")
				.replace(/\/resize_cache\/.*?\/(iblock\/+[0-9a-f]{3}\/)/, "/$1");
			if (newsrc !== src)
				return newsrc;

			newsrc = src
				.replace(/(\/iblock\/+[0-9a-f]{3}\/+[0-9a-f]+)(?:_[a-z][0-9]+){1,}(?:_[a-z]+)(\.[^/.]*)(?:[?#].*)?$/, "$1$2")
				.replace(/(\/iblock\/+[0-9a-f]{3}\/+[0-9a-f]+)[wh][0-9]+(\.[^/.]*)(?:[?#].*)?$/, "$1$2");
			if (newsrc !== src)
				return newsrc;
		}

		// https://storage.journaldemontreal.com/v1/dynamic_resize/sws_path/jdx-prod-images/cc417dc4-919a-4fa9-b7eb-d28f406dc442_JDX-2x1_WEB.jpg?quality=80&size=1200x&version=1
		//   https://storage.journaldemontreal.com/v1/jdx-prod-images/cc417dc4-919a-4fa9-b7eb-d28f406dc442_JDX-2x1_WEB.jpg
		//   https://storage.journaldemontreal.com/v1/jdx-prod-images/cc417dc4-919a-4fa9-b7eb-d28f406dc442_ORIGINAL.jpg
		if (domain === "storage.journaldemontreal.com" ||
			// http://storage.torontosun.com/v1/dynamic_resize/sws_path/suns-prod-images/1297848560868_ORIGINAL.jpg?size=520x
			//   http://storage.torontosun.com/v1/suns-prod-images/1297848560868_ORIGINAL.jpg
			// http://storage.torontosun.com/v1/suns-prod-images/1297953142311_LARGE_BOX.jpg?quality=80&stmp=1494378455559
			//   http://storage.torontosun.com/v1/suns-prod-images/1297953142311_ORIGINAL.jpg
			domain === "storage.torontosun.com" ||
			// http://storage.ottawasun.com/v1/dynamic_resize/sws_path/suns-prod-images/1297804218043_ORIGINAL.jpg?size=520x
			domain === "storage.ottawasun.com" ||
			// http://storage.chathamthisweek.com/v1/dynamic_resize/sws_path/suns-prod-images/-143866_ORIGINAL.jpg?quality=80&size=650x&stmp=1336623589647
			//   http://storage.chathamthisweek.com/v1/suns-prod-images/-143866_ORIGINAL.jpg
			domain === "storage.chathamthisweek.com" ||
			// http://storage.journaldequebec.com/v1/dynamic_resize/sws_path/jdx-prod-images/e3b49bbd-ba13-4f0e-99e4-e0d0ee77bbfe_ORIGINAL.jpg?quality=80&size=700x&version=1
			domain === "storage.journaldequebec.com" ||
			// http://storage.journaldemontreal.com/v1/dynamic_resize/sws_path/jdx-prod-images/b618335b-9523-4599-9f42-e7e394ceee77_ORIGINAL.jpg?quality=80&size=640x&version=7
			domain === "storage.journaldemontreal.com" ||
			// http://storage.canoe.com/v1/dynamic_resize/?size=298&quality=80&src=http%3A%2F%2Fstorage.ottawasun.com%2Fv1%2Fsuns-prod-images%2F1297947551736_ORIGINAL.jpg%3Fquality%3D80
			//   http://storage.ottawasun.com/v1/suns-prod-images/1297947551736_ORIGINAL.jpg
			domain === "storage.canoe.com" ||
			// http://storage-cube.quebecormedia.com/v1/dynamic_resize?quality=75&size=400x400&src=http%3A%2F%2Fstorage-cube.quebecormedia.com%2Fv1%2Fellequebec_prod%2Felle_quebec%2F2849ba1cbafd6e4f65f25dd54ea9466a3a4c95eb%2FCouples-MET-Gala-2017.jpg
			//   http://storage-cube.quebecormedia.com/v1/ellequebec_prod/elle_quebec/2849ba1cbafd6e4f65f25dd54ea9466a3a4c95eb/Couples-MET-Gala-2017.jpg
			domain === "storage-cube.quebecormedia.com" ||
			// http://www.stylosophy.it/img/Trucco-rosso-occhi-verdi.jpg
			domain_nowww === "stylosophy.it" ||
			// http://donna.nanopress.it/img/Rita-Ora-agli-MTV-EMA-2017.jpg
			domain_nosub === "nanopress.it" ||
			// https://storage.quebecormedia.com/v1/dynamic_resize/sws_path/jdx-prod-images/9a148e1e-f868-4af7-a859-a15f58d10e62_ORIGINAL.jpg?quality=80&version=1&size=200
			src.match(/^[a-z]+:\/\/storage\.[^/]*\/+v[0-9]*\/+dynamic_resize\/+sws_path\//)) {
			//return src.replace(/(\/dynamic_resize\/.*)\?[^/]*$/, "$1?size=99999999");
			newsrc = src.replace(/^[a-z]+:\/\/[^/]*\/+v[0-9]*\/+dynamic_resize\/*.*?[?&]src=([^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeURIComponent(newsrc);

			newsrc = src
				.replace(/\/dynamic_resize\/+sws_path\//, "/")
				.replace(/_(?:JDX-[0-9]+x[0-9]+_[A-Z]+|LARGE_BOX)(\.[^/.]*)$/, "_ORIGINAL$1")
				.replace(/\?.*$/, "");
			if (newsrc !== src)
				return {
					url: newsrc,
					head_wrong_contenttype: true
				};

			return {
				url: src,
				head_wrong_contenttype: true
			};
		}

		// MediaWiki
		// https://upload.wikimedia.org/wikipedia/commons/thumb/8/83/Bundesarchiv_-_Wikimedia_Deutschland_-_Pressekonferenz_%285999%29.jpg/220px-Bundesarchiv_-_Wikimedia_Deutschland_-_Pressekonferenz_%285999%29.jpg
		//   https://upload.wikimedia.org/wikipedia/commons/8/83/Bundesarchiv_-_Wikimedia_Deutschland_-_Pressekonferenz_%285999%29.jpg
		// https://upload.wikimedia.org/wikipedia/commons/thumb/archive/a/a0/20131028161436%21Pumpkipedia-47.jpg
		//   https://upload.wikimedia.org/wikipedia/commons/archive/a/a0/20131028161436%21Pumpkipedia-47.jpg
		// thanks to ayunami2000 on github for reporting: https://github.com/qsniyg/maxurl/issues/868
		// https://upload.wikimedia.org/wikipedia/commons/thumb/c/ce/United_States_Congressional_Districts_in_North_Carolina%2C_2021_-_2023.tif/lossless-page1-400px-United_States_Congressional_Districts_in_North_Carolina%2C_2021_-_2023.tif.png
		//   https://upload.wikimedia.org/wikipedia/commons/c/ce/United_States_Congressional_Districts_in_North_Carolina%2C_2021_-_2023.tif
		if (domain === "upload.wikimedia.org" ||
			// https://www.generasia.com/w/images/thumb/4/4d/aiko_-_Shimetta_Natsu_no_Hajimari_promo.jpg/500px-aiko_-_Shimetta_Natsu_no_Hajimari_promo.jpg
			//   https://www.generasia.com/w/images/4/4d/aiko_-_Shimetta_Natsu_no_Hajimari_promo.jpg
			domain_nowww === "generasia.com" ||
			// https://cdn.wikimg.net/strategywiki/images/thumb/0/01/PW_JFA_Official_Artwork.jpg/350px-PW_JFA_Official_Artwork.jpg
			//   https://cdn.wikimg.net/strategywiki/images/0/01/PW_JFA_Official_Artwork.jpg
			domain === "cdn.wikimg.net" ||
			// http://liquipedia.net/commons/images/thumb/d/df/Tossgirl_2008_stx081014.jpg/269px-Tossgirl_2008_stx081014.jpg
			//   http://liquipedia.net/commons/images/d/df/Tossgirl_2008_stx081014.jpg
			domain_nowww === "liquipedia.net" ||
			// https://i.know.cf/imgwi/f/f8/Peyton_Roi_List.JPG/240px-Peyton_Roi_List.JPG
			//   https://i.know.cf/imgwi/f/f8/Peyton_Roi_List.JPG
			domain === "i.know.cf" ||
			// http://oyster.ignimgs.com/mediawiki/apis.ign.com/best-of-2017-awards/thumb/8/86/Anime.jpg/610px-Anime.jpg
			//   http://oyster.ignimgs.com/mediawiki/apis.ign.com/best-of-2017-awards/8/86/Anime.jpg
			src.match(/\/thumb\/+[0-9a-f]\/+[0-9a-f]{2}\/+[^/]*\.[^/]*\/+(?:lossless-page[0-9]+-)?[0-9]+px-[^/]*(?:[?#].*)?$/)) {
			newsrc = src.replace(/\/(?:thumb\/+(archive\/+)?)?(.)\/+(..)\/+([^/]*)\/+(?:lossless-page[0-9]+-)?[0-9]+px-.*?$/, "/$1$2/$3/$4");
			if (newsrc !== src)
				return newsrc;
		}

		if (domain === "upload.wikimedia.org") {
			// other:
			// https://upload.wikimedia.org/wikipedia/en/a/ae/Flag_of_the_United_Kingdom.svg
			//   https://commons.wikimedia.org/wiki/File:Flag_of_the_United_Kingdom.svg
			match = src.match(/\/commons\/+[0-9a-f]\/+[0-9a-f]{2}\/+([^/]+\.[^/.]+)(?:[?#].*)?$/);
			if (match) {
				return {
					url: src,
					is_original: true,
					extra: {
						page: "https://commons.wikimedia.org/wiki/File:" + match[1]
					}
				};
			}
		}

		if (domain_nosub === "wiki.gallery" && /:\/\/[^/]+\/+images\/+[0-9a-f]\/+[0-9a-f]{2}\/+/.test(src)) {
			// thanks to siloricity on github: (format=original is needed to not use webp)
			// https://mario.wiki.gallery/images/c/c8/Wwt.jpg
			//   https://mario.wiki.gallery/images/c/c8/Wwt.jpg?format=original
			return add_queries(src, {"format": "original"})
		}

		// Dokuwiki
		if (src.match(/\/lib\/+exe\/+fetch\.php.*?[?&]media=[^&]*.*?$/)) {
			// http://www.substech.com/dokuwiki/lib/exe/fetch.php?w=&h=&cache=cache&media=electron_microscope.png
			//   http://www.substech.com/dokuwiki/lib/exe/fetch.php?media=electron_microscope.png
			// http://www.wikitoes.com/lib/exe/fetch.php?w=120&h=120&tok=00c541&media=emma_watson:emma_watson_004.jpg
			//   http://www.wikitoes.com/lib/exe/fetch.php?media=emma_watson:emma_watson_004.jpg
			// http://www.bundysoft.com/wiki/lib/exe/fetch.php?w=450&media=reviews:dokuwiki:admin1.png
			//   http://www.bundysoft.com/wiki/lib/exe/fetch.php?media=reviews:dokuwiki:admin1.png
			// https://www.dokuwiki.org/lib/exe/fetch.php?tok=f05a08&media=http%3A%2F%2Fm3.notomorrow.de%2Fpublic%2Frepos%2Fdokuwiki%2Fplugins%2Fdokuwiki-plugin-templateconfhelper-example.png
			//   https://www.dokuwiki.org/lib/exe/fetch.php?media=http%3A%2F%2Fm3.notomorrow.de%2Fpublic%2Frepos%2Fdokuwiki%2Fplugins%2Fdokuwiki-plugin-templateconfhelper-example.png -- 412
			//   http://m3.notomorrow.de/public/repos/dokuwiki/plugins/dokuwiki-plugin-templateconfhelper-example.png -- 404
			// http://wiki.metalforge.net/lib/exe/fetch.php/server:14_win10_maps-destination.png
			newsrc = keep_queries(src, ["media"]);
			if (newsrc !== src)
				return newsrc;

			newsrc = src.replace(/.*\/fetch\.php\?(?:.*&)?media=([^&]+).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		if (domain === "cdn.himalaya.com" ||
			// https://i.linkeddb.com/person2/bc2b/4ac6/d18db22f165a63046031cbb9.jpg?x-oss-process=image/resize,m_fill,w_170,h_230
			domain === "i.linkeddb.com" ||
			// https://img.heypik.com/58pic/25/83/54/5872c645a652e_1024.jpg?x-oss-process=image/resize,w_230/crop,w_230,h_230/sharpen,100/quality,q_70
			domain === "img.heypik.com" ||
			// https://club-img.kdslife.com/attach/1k2/pl/2j/pb7sqn-sxw.jpg?x-oss-process=image/resize,m_lfit,w_600/quality,Q_90
			domain === "club-img.kdslife.com" ||
			// https://img5.ofashion.com.cn/goods_collection/20160512/193454_1114125733f50485293.jpg?x-oss-process=image/resize,w_640
			(domain_nosub === "ofashion.com.cn" && domain.match(/^img[0-9]*\.ofashion.com.cn/)) ||
			// https://kanfaimage.oss-cn-beijing.aliyuncs.com/20180715/focus_153163480295909.jpg?x-oss-process=image/resize,m_fill,w_600,h_300
			domain === "kanfaimage.oss-cn-beijing.aliyuncs.com" ||
			// http://s1.mioreport.com/file/fushi/xiuchang/2017-06-02/98c2cd2e90cf206b5bcf3490e3a56d0e.jpg?x-oss-process=style/sty1
			(domain_nosub === "mioreport.com" && domain.match(/^s[0-9]*\./)) ||
			// https://image-demo.oss-cn-hangzhou.aliyuncs.com/example.jpg?x-oss-process=style/style-example
			(domain_nosub === "aliyuncs.com" && domain.match(/[./]oss-cn-/)) ||
			// https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20190416/1555417964547824.png?x-oss-process=style/w10
			domain === "rmrbcmsonline.peopleapp.com" ||
			// http://img.fxe0898.com/upload/meifangzhuzhan/content/image/20190219/1550569034182349.png?x-oss-process=style/meifangzhuzhan
			domain === "img.fxe0898.com" ||
			// http://img.xiumi.us/xmi/ua/YjLn/i/8e5ce7b31a8e1ca11f4f7a459fd14dab-sz_1319512.jpg?x-oss-process=style/xmorient
			domain === "img.xiumi.us" ||
			// https://s.oneroof.co.nz/image/a6/a5/a6a56b4ee371be1ca8298f4ace92fe82.png?x-oss-process=image/quality,q_80/resize,w_1200
			domain === "s.oneroof.co.nz" ||
			// https://c1.hoopchina.com.cn/uploads/star/event/images/180215/bmiddle-5e8c9e13a07a397579c89590685b479db07ff6b8.png?x-oss-process=image/resize,w_800/format,webp
			(domain_nosub === "hoopchina.com.cn" && domain.match(/[ci][0-9]*\.hoopchina\.com\.cn/)) ||
			// thanks to nimuxoha on github: https://github.com/qsniyg/maxurl/issues/775
			// https://bkimg.cdn.bcebos.com/pic/3b87e950352ac65c1038460fc9b9a5119313b07e1c3e?x-bce-process=image/resize,m_lfit,h_250,limit_1/format,f_auto
			//   https://bkimg.cdn.bcebos.com/pic/3b87e950352ac65c1038460fc9b9a5119313b07e1c3e
			// https://bkimg.cdn.bcebos.com/pic/4d086e061d950a7b0208ada7389a75d9f2d3572c6336?x-bce-process=image/watermark,image_d2F0ZXIvYmFpa2UxMTY=,g_7,xp_5,yp_5/format,f_auto
			//   https://bkimg.cdn.bcebos.com/pic/4d086e061d950a7b0208ada7389a75d9f2d3572c6336
			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?
			// 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");
			var replacement = "";
			if (authkey !== src)
				replacement = "?auth_key=" + authkey;

			if (src.match(/[?&]x-(?:oss|bce)-process=/)) {
				newsrc = src.replace(/[?#].*/, replacement);
				if (newsrc !== src)
					return newsrc;
			}
		}

		// Discourse
		if (domain === "tfk.thefreekick.com" ||
			// https://discourse-cdn-sjc1.com/helloforos/uploads/default/optimized/4X/5/7/a/57aa3f914365bb39e7db1e85a15f1e4a61e62edc_1_666x1000.jpg
			//   https://discourse-cdn-sjc1.com/helloforos/uploads/default/original/4X/5/7/a/57aa3f914365bb39e7db1e85a15f1e4a61e62edc.jpg
			domain_nowww === "discourse-cdn-sjc1.com" ||
			// http://swagup.co.kr/uploads/default/optimized/2X/7/729996eeedbcc6eb835c108234590b94f3298f4a_1_375x500.jpg
			//   http://www.swagup.co.kr/uploads/default/original/2X/7/729996eeedbcc6eb835c108234590b94f3298f4a.jpg
			domain_nowww === "swagup.co.kr" ||
			// https://pixls-discuss.s3.dualstack.us-east-1.amazonaws.com/optimized/3X/0/5/0530ef1424b7bace746cd10d2bc26b5cd58d5e27_2_690x388.png
			//   https://pixls-discuss.s3.dualstack.us-east-1.amazonaws.com/original/3X/0/5/0530ef1424b7bace746cd10d2bc26b5cd58d5e27.png
			amazon_container === "pixls-discuss" ||
			// https://forums.lutris.net/uploads/default/optimized/2X/6/65fe45ffb69a0382ec70b423d22fac4b9c31ce70_2_690x388.png
			//   https://forums.lutris.net/uploads/default/original/2X/6/65fe45ffb69a0382ec70b423d22fac4b9c31ce70.png
			domain === "forums.lutris.net" ||
			// https://forum.combustionpunks.co.uk/uploads/default/optimized/2X/5/5d734122d237c0ac1a7961f8d536db660c891c77_1_690x413.jpg
			//   https://forum.combustionpunks.co.uk/uploads/default/original/2X/5/5d734122d237c0ac1a7961f8d536db660c891c77.jpg
			domain === "forum.combustionpunks.co.uk" ||
			// https://discourse-cdn-aws1.com/mcneel/uploads/default/optimized/3X/0/7/0701fad93a0caef03b3052dccb6a9dd4fa69a707_2_690x357.jpeg
			//   https://discourse-cdn-aws1.com/mcneel/uploads/default/original/3X/0/7/0701fad93a0caef03b3052dccb6a9dd4fa69a707.jpeg
			domain_nowww === "discourse-cdn-aws1.com" ||
			// https://sjc1.discourse-cdn.com/business6/uploads/nodered/optimized/2X/7/719d994618fbc893b598b29787eb173b8a76f815_2_690x389.png
			//   https://sjc1.discourse-cdn.com/business6/uploads/nodered/original/2X/7/719d994618fbc893b598b29787eb173b8a76f815.png
			domain_nosub === "discourse-cdn.com" ||
			// https://www.simscale.com/forum/uploads/default/optimized/3X/0/0/009574ea5f0fd86a45f87905d18aa2cadad29935_1_690x381.jpg
			//   https://www.simscale.com/forum/uploads/default/original/3X/0/0/009574ea5f0fd86a45f87905d18aa2cadad29935.jpg
			// https://www.realmeye.com/forum/uploads/default/optimized/2X/9/91078197dc30b8b935ea418612aae8feca762cf2_1_281x500.png
			//   https://www.realmeye.com/forum/uploads/default/original/2X/9/91078197dc30b8b935ea418612aae8feca762cf2.png
			// http://controllerforum.elationlighting.com/uploads/default/optimized/1X/2f9351018d62a9e1226d166b8b0d22de48618e3b_1_574x500.png
			//   http://controllerforum.elationlighting.com/uploads/default/original/1X/2f9351018d62a9e1226d166b8b0d22de48618e3b.png
			src.match(/^[a-z]+:\/\/[^/]*\/(?:(?:forum\/+)?uploads\/+[a-z]+\/+)?(?:optimized|original)\/+[0-9]X\/+(?:[0-9a-f]\/+)*[0-9a-f]{10,}_[0-9]+_[0-9]+x[0-9]+\.[^/.]*(?:[?#].*)?$/)) {
			// https://tfk.thefreekick.com/uploads/default/optimized/2X/9/9c9755f8dcbd5d1427c7e9f4ac86eee3383b7366_1_333x500.jpeg
			//   https://tfk.thefreekick.com/uploads/default/original/2X/9/9c9755f8dcbd5d1427c7e9f4ac86eee3383b7366.jpeg
			return src.replace(/(:\/\/[^/]*\/|\/uploads\/[a-z]+\/)?optimized(\/.*\/[0-9a-f]+)_[0-9]+_[0-9]+x[0-9]+(\.[^/.]*)$/,
							   "$1original$2$3");
		}

		// Invision community
		if (domain_nowww === "myproana.com" ||
			// https://static.nulled.to/uploads/profile/photo-thumb-2154301.jpg?_r=1562273198
			//   https://static.nulled.to/uploads/profile/photo-2154301.jpg?_r=1562273198
			domain === "static.nulled.to" ||
			// http://tesall.ru/uploads/gallery/category_82/sml_gallery_304485_82_403628.jpeg
			//   http://tesall.ru/uploads/gallery/category_82/gallery_304485_82_403628.jpeg
			// http://tesall.ru/uploads/profile/photo-thumb-304485.png?_r=1482876452
			//   http://tesall.ru/uploads/profile/photo-304485.png?_r=1482876452
			domain_nowww === "tesall.ru" ||
			src.match(/^[a-z]+:\/\/[^/]+\/+uploads\/+profile\/+photo-thumb-[0-9]+\.[^/.]*(?:[?#].*)?$/) ||
			// https://static.loverslab.com/uploads/monthly_01_2015/post-134589-0-36427300-1422215053_thumb.jpg
			//   https://static.loverslab.com/uploads/monthly_01_2015/post-134589-0-36427300-1422215053.jpg
			// http://diesel.elcat.kg/uploads/monthly_06_2011/post-122325-1309335397_thumb.jpg
			//   http://diesel.elcat.kg/uploads/monthly_06_2011/post-122325-1309335397.jpg
			src.match(/^[a-z]+:\/\/[^/]+\/+uploads\/+monthly_[0-9]{2}_[0-9]{4}\/+post-[0-9]+-[0-9]+(?:-[0-9]+-[0-9]+)?(?:_thumb)\.[^/]*(?:[?#].*)?/) ||
			src.match(/^[a-z]+:\/\/[^/]+\/+uploads\/+gallery\/+(?:album|category)_[0-9]+\/+[a-z]+_(?:gallery_[0-9]+_[0-9]+_[0-9]+)\.[^/.]*(?:[?#].*)?$/)) {
			// http://www.myproana.com/uploads/gallery/album_28122/med_gallery_463850_28122_30414.jpg
			//   https://www.myproana.com/uploads/gallery/album_28122/gallery_463850_28122_30414.jpg
			// https://www.myproana.com/uploads/gallery/album_56930/sml_gallery_970690_56930_32825.jpg
			//   https://www.myproana.com/uploads/gallery/album_56930/gallery_970690_56930_32825.jpg
			//return src.replace(/\/med_([^/]*)$/, "/$1");
			return src
				.replace(/(\/uploads\/+gallery\/+(?:album|category)_[0-9]+\/)[a-z]+_(gallery_[0-9]+[^/]*\.[^/.]*)$/, "$1$2")
				.replace(/(\/uploads\/+profile\/+photo-)thumb-([0-9]+\.[^/.]*)$/, "$1$2")
				.replace(/(\/uploads\/+monthly_[0-9]{2}_[0-9]{4}\/+post-[0-9]+-[0-9]+(?:-[0-9]+-[0-9]+)?)_thumb(\.[^/.]*)(?:[?#].*)?$/,
							   "$1$2");
		}

		// Mastodon
		if (domain === "files.mastodon.social" ||
			// https://cf.mastohost.com/v1/AUTH_91eb37814936490c95da7b85993cc2ff/koreadoncom/media_attachments/files/000/042/944/small/0f617bb21390c8e9.jpg
			//   https://cf.mastohost.com/v1/AUTH_91eb37814936490c95da7b85993cc2ff/koreadoncom/media_attachments/files/000/042/944/original/0f617bb21390c8e9.jpg
			domain === "cf.mastohost.com" ||
			// thanks to anonymous for reporting:
			// https://filmfreeway-production-storage-01-storage.filmfreeway.com/attachments/files/007/021/817/thumb/juno_closeup_1.1.16.jpg?1679458413
			//   https://filmfreeway-production-storage-01-storage.filmfreeway.com/attachments/files/007/021/817/original/juno_closeup_1.1.16.jpg?1679458413
			(domain_nosub === "filmfreeway.com" && /\/attachments\/+files\//.test(src)) ||
			src.match(/\/media_attachments\/+files\/+(?:[0-9]{3}\/+){3,6}[a-z]+\/+[0-9a-f]{16}\.[^/.]*(?:[?#].*)?$/)) {
			// https://files.mastodon.social/media_attachments/files/000/272/420/small/70972b69912d1e4d.png
			//   https://files.mastodon.social/media_attachments/files/000/272/420/original/70972b69912d1e4d.png
			return src.replace(/((?:[0-9]{3}\/+){3,6})[a-z]+\/([^/?#]+\.[^/.]*)(?:[?#].*)?$/, "$1original/$2");
		}

		// project diaspora
		if (domain_nowww === "diasp.org" ||
			// https://pod.libreplanetbr.org/uploads/images/thumb_large_43339b48adc592fe35e2.png
			//   https://pod.libreplanetbr.org/uploads/images/thumb_small_43339b48adc592fe35e2.png
			//   https://pod.libreplanetbr.org/uploads/images/43339b48adc592fe35e2.png
			//domain === "pod.libreplanetbr.org" ||
			// https://diasp.eu/uploads/images/thumb_large_213fd176442b8fa6fc12.jpg
			//   https://diasp.eu/uploads/images/213fd176442b8fa6fc12.jpg
			domain_nowww === "diasp.eu" ||
			// https://joindiaspora.com/uploads/images/scaled_full_0e37bb478a688e0d87bd.jpg
			/^[a-z]+:\/\/[^/]+\/+uploads\/+images\/+(?:thumb|scaled)_(?:large|small|full)_[0-9a-f]{20}\.[^/.]+(?:[?#].*)?$/.test(src)) {
			// https://diasp.org/uploads/images/scaled_full_0aa2bc73c57545c2a222.jpg
			//   https://diasp.org/uploads/images/0aa2bc73c57545c2a222.jpg
			return src.replace(/\/uploads\/+images\/+[a-z_]+_([0-9a-f]{10,}\.[^/.]*)(?:[?#].*)?$/, "/uploads/images/$1");
		}

		if (/\/wp-content\/+themes\/+[^/]+\/+functions\/+resize_ext\.php\?(?:.*&)?image=http/.test(src)) {
			// https://buholmen.no/wp-content/themes/buholmen/functions/resize_ext.php?image=https://images.finncdn.no/mmo/2016/12/vertical-4/07/9/785/970/49_1045558554_xl.jpg&width=1140
			//   https://images.finncdn.no/dynamic/900x600d/2016/12/vertical-4/07/9/785/970/49_1045558554.jpg
			newsrc = src.replace(/.*\/wp-content\/+themes\/+[^/]+\/+functions\/+resize_ext\.php\?(?:.*&)?image=(http[^&]*).*?$/, "$1");
			if (newsrc !== src)
				return decodeuri_ifneeded(newsrc);
		}

		// Moodle?
		if (domain_nowww === "12andus.com" ||
			// https://vln.school.nz/mod/file/thumbnail.php?file_guid=690703&size=large&icontime=1338202040
			//   https://vln.school.nz/mod/file/thumbnail.php?file_guid=690703&size=original
			domain === "vln.school.nz" ||
			// http://www.ict-21.ch/l4d/mod/file/thumbnail.php?file_guid=908703&size=large
			//   http://www.ict-21.ch/l4d/mod/file/thumbnail.php?file_guid=908703&size=original
			domain_nowww === "ict-21.ch" ||
			/\/mod\/+file\/+thumbnail\.php\?(?:.*&)?file_guid=[0-9]+(?:&.*)?$/.test(src)) {
			// https://12andus.com/mod/file/thumbnail.php?file_guid=14980&size=medium&icontime=1489916398
			//   https://12andus.com/mod/file/thumbnail.php?file_guid=14980&size=original
			return src.replace(/(\/mod\/+file\/+thumbnail\.php\?)(?:.*&)?(file_guid=[0-9]+).*$/, "$1$2&size=original");
		}

		// Invision Community
		if (/\/monthly_[0-9]{4}_[0-9]{2}\/[^/]+\./.test(src) && options && options.element) {
			// https://www.loverslab.com/files/file/9860-sugarlife-100-july-31-2019/ -- screenshots
			if (options.element.tagName === "SPAN" && options.element.hasAttribute("data-ipslightbox") && options.element.getAttribute("data-fullurl")) {
				return options.element.getAttribute("data-fullurl");
			}

			var get_gallery_image = function(url, cb) {
				var cache_key = "invision_gallery_image:" + url.replace(/^[a-z]+:\/\//, "://").replace(/[?#].*/, "");
				api_cache.fetch(cache_key, cb, function(done) {
					options.do_request({
						url: url,
						method: "GET",
						onload: function(resp) {
							if (resp.readyState < 4)
								return;

							if (resp.status !== 200)
								return done(null, false);

							var match = resp.responseText.match(/<meta\s+property=["']og:image["']\s+content=["']([^'"]+)["']/);
							if (match) {
								return done(decode_entities(match[1]), 12*60*60);
							} else {
								console_warn("Unable to find match", resp);
								return done(null, false);
							}
						}
					});
				});
			};

			// http://tiaradiadem.com/forums/gallery/album/2825-jiyeon-for-naver-x-dispatch-012019/
			// http://tiaradiadem.com/forums/gallery/category/39-behind-the-scenes/
			if ((options.element.tagName === "IMG" || options.element.tagName === "LI") && options.do_request && options.cb) {
				var ael = options.element.parentElement;
				if (ael.tagName !== "A" && options.element.children.length === 1) {
					ael = options.element.children[0];
				}

				if (ael.tagName === "A" && ael.hasAttribute("data-imagelightbox")) {
					get_gallery_image(ael.href, function(url) {
						if (url) {
							options.cb(url);
						} else {
							options.cb(null);
						}
					});

					return {
						waiting: true
					};
				}
			}

			// https://curvage.org/forum/index.php?/forums/topic/35423-dua-lipa/
			// https://curvage.org/forum/uploads/monthly_2018_08/84af223b7f5e57d5f5807a956865fb18.thumb.jpg.07133ce329191e4717203643c9817ff7.jpg
			//   https://curvage.org/forum/uploads/monthly_2018_08/84af223b7f5e57d5f5807a956865fb18.jpg.ff660afa3d0109c087f24b598c6ba91c.jpg
			// https://curvage.org/forum/uploads/monthly_2018_08/00000016443.thumb.jpg.a7e3317efb815629622b59c86972aa28.jpg
			//   https://curvage.org/forum/uploads/monthly_2018_08/00000016443.jpg.2532e57b26f0426644f569f97abebd6a.jpg
			if (/\/[^/?#]+\.thumb\.[^/.]+\.[0-9a-f]{20,}\./.test(src) && options.element.tagName === "IMG") {
				var ael = options.element.parentElement;
				if (ael && ael.tagName === "A" && /\/monthly_[0-9]{4}_[0-9]{2}\/+[^/?#]+\.[^/.]+\.[0-9a-f]{20,}\.[^/.]+$/.test(ael.href)) {
					return ael.href;
				}
			}
		}

		// IIIF
		if (domain === "lakeimagesweb.artic.edu" ||
			// https://cdm15878.contentdm.oclc.org/digital/iiif/p15878coll9/104/0,0,1024,1024/256,256/0/default.jpg
			//   https://cdm15878.contentdm.oclc.org/digital/iiif/p15878coll9/104/full/full/0/default.jpg
			(domain_nosub === "oclc.org" && domain.match(/\.contentdm\./)) ||
			// https://stor.artstor.org/iiif/fpx/amico/dallas/dma_.1969.7.fpx/0,1024,1024,976/1024,/0/default.jpg
			//   https://stor.artstor.org/iiif/fpx/amico/dallas/dma_.1969.7.fpx/full/full/0/default.jpg
			domain === "stor.artstor.org" ||
			// https://ids.lib.harvard.edu/ids/iiif/25286607/full/500,/0/native.jpg
			//   https://ids.lib.harvard.edu/ids/iiif/25286607/full/full/0/native.jpg
			domain === "ids.lib.harvard.edu" ||
			// https://digitalcollections.lib.washington.edu/digital/iiif/pioneerlife/26138/full/full/10/default.jpg
			//   https://digitalcollections.lib.washington.edu/digital/iiif/pioneerlife/26138/full/full/0/default.jpg
			domain === "digitalcollections.lib.washington.edu" ||
			// https://mtmemory.org/digital/iiif/p16013coll87/2209/full/full/10/default.jpg
			//   https://mtmemory.org/digital/iiif/p16013coll87/2209/full/full/0/default.jpg
			domain_nowww === "mtmemory.org" ||
			// https://ids.si.edu/ids/iiif/SIA-2004-41356/full/400,/0/default.jpg
			//   https://ids.si.edu/ids/iiif/SIA-2004-41356/full/full/0/default.jpg
			domain === "ids.si.edu" ||
			// https://stacks.stanford.edu/image/iiif/hg676jb4964%2F0380_796-44/2317,1510,799,799/full/0/default.jpg
			//   https://stacks.stanford.edu/image/iiif/hg676jb4964%2F0380_796-44/full/full/0/default.jpg
			domain === "stacks.stanford.edu" ||
			// https://images.britishart.yale.edu/iiif/a866e10e-5a6f-4b87-b4ec-6f0488940796/full/500,/0/native.jpg
			//   https://images.britishart.yale.edu/iiif/a866e10e-5a6f-4b87-b4ec-6f0488940796/full/full/0/native.jpg
			domain === "images.britishart.yale.edu" ||
			// http://iiif.archivelab.org/iiif/39002086306033.med.yale.edu$1/full/500,/0/default.jpg
			//   http://iiif.archivelab.org/iiif/39002086306033.med.yale.edu$1/full/full/0/default.jpg
			domain === "iiif.archivelab.org" ||
			// http://cplorg.cdmhost.com/digital/iiif/p4014coll16/420/full/400,/0/default.jpg
			//   http://cplorg.cdmhost.com/digital/iiif/p4014coll16/420/full/full/0/default.jpg
			domain === "cplorg.cdmhost.com" ||
			// https://iiif.lib.ncsu.edu/iiif/segPap_021/full/400,/0/default.jpg
			//   https://iiif.lib.ncsu.edu/iiif/segPap_021/full/full/0/default.jpg
			domain === "iiif.lib.ncsu.edu" ||
			// https://iiif.eluxemburgensia.lu/iiif/2/ark:%2F70795%2F1drtkj%2Fpages%2F3/full/500,/0/default.jpg
			//   https://iiif.eluxemburgensia.lu/iiif/2/ark:%2F70795%2F1drtkj%2Fpages%2F3/full/full/0/default.jpg
			domain === "iiif.eluxemburgensia.lu" ||
			// https://archives.norwich.edu/digital/iiif/p16663coll8/206/full/500,/0/default.jpg
			//   https://archives.norwich.edu/digital/iiif/p16663coll8/206/full/full/0/default.jpg
			domain === "archives.norwich.edu" ||
			// https://iiif.library.ubc.ca/image/cdm.tokugawa.1-0167752.0000/full/1600,900/0/default.png
			//   https://iiif.library.ubc.ca/image/cdm.tokugawa.1-0167752.0000/full/full/0/default.png
			domain === "iiif.library.ubc.ca" ||
			// https://iiif.library.utoronto.ca/image/v2/anatomia:RBAI035_0001/full/512,/0/default.jpg
			//   https://iiif.library.utoronto.ca/image/v2/anatomia:RBAI035_0001/full/full/0/default.jpg
			domain === "iiif.library.utoronto.ca" ||
			// https://iiif.bodleian.ox.ac.uk/iiif/image/b83fe9b4-3ffb-4890-aa3f-7d551dfd8b38/full/256,/0/default.jpg
			//   https://iiif.bodleian.ox.ac.uk/iiif/image/b83fe9b4-3ffb-4890-aa3f-7d551dfd8b38/full/full/0/default.jpg
			domain === "iiif.bodleian.ox.ac.uk" ||
			// https://iiif.lib.utexas.edu/iiif/2/utldams_utlgs_19be477d-741c-4254-bbaa-6b4fa9a9df52.jp2/full/500,/0/default.jpg
			//   https://iiif.lib.utexas.edu/iiif/2/utldams_utlgs_19be477d-741c-4254-bbaa-6b4fa9a9df52.jp2/full/full/0/default.jpg
			domain === "iiif.lib.utexas.edu" ||
			// https://digital.library.unt.edu/iiif/ark:/67531/metadc66369/m1/16/full/500,/0/default.jpg
			//   https://digital.library.unt.edu/iiif/ark:/67531/metadc66369/m1/16/full/full/0/default.jpg
			domain === "digital.library.unt.edu" ||
			// https://texashistory.unt.edu/iiif/ark:/67531/metapth16124/m1/74/full/500,/0/default.jpg
			//   https://texashistory.unt.edu/iiif/ark:/67531/metapth16124/m1/74/full/full/0/default.jpg
			domain === "texashistory.unt.edu" ||
			// https://media.ng-london.org.uk/iiif/009-0039-0000/full/512,/0/default.jpg
			//   https://media.ng-london.org.uk/iiif/009-0039-0000/full/full/0/default.jpg
			domain === "media.ng-london.org.uk" ||
			// https://iiif.ucd.ie/loris/ivrla:439/full/600,/0/default.jpg
			//   https://iiif.ucd.ie/loris/ivrla:439/full/full/0/default.jpg
			domain === "iiif.ucd.ie" ||
			// https://www.e-codices.unifr.ch/loris/fmb/fmb-cb-0025/fmb-cb-0025_001r.jp2/full/pct:12.5/0/default.jpg
			//   https://www.e-codices.unifr.ch/loris/fmb/fmb-cb-0025/fmb-cb-0025_001r.jp2/full/full/0/default.jpg
			(domain_nosub === "unifr.ch" && string_indexof(src, "/loris/") >= 0) ||
			// https://iiif.irht.cnrs.fr/iiif/France/Arras/Bibliotheque_municipale/620416201_MS0001_0561/DEPOT/620416201_MS0001_0561_0003A/full/200,/0/default.jpg
			//   https://iiif.irht.cnrs.fr/iiif/France/Arras/Bibliotheque_municipale/620416201_MS0001_0561/DEPOT/620416201_MS0001_0561_0003A/full/full/0/default.jpg
			domain === "iiif.irht.cnrs.fr" ||
			domain === "gallica.bnf.fr" ||
			// thanks to anonymous for reporting:
			// https://iiif.wellcomecollection.org/image/L0026932/full/300,/0/default.jpg
			//   https://iiif.wellcomecollection.org/image/L0026932/full/full/0/default.jpg
			domain === "iiif.wellcomecollection.org" ||
			// thanks to anonymous for reporting:
			// https://framemark.vam.ac.uk/collections/2019LJ4813/full/220,/0/default.jpg
			//   https://framemark.vam.ac.uk/collections/2019LJ4813/full/full/0/default.jpg
			domain === "framemark.vam.ac.uk" ||
			// thanks to FreemenMuaddib for a ton of information regarding IIIF: https://greasyfork.org/en/forum/discussion/74977/support-for-iiif-zoomable-images
			/\/(?:iiif|loris)\/+(?:.*\/)?[^/]+\/+(?:full|square|(?:pct:)?[0-9.]+(?:,[0-9.]+){3})\/+(?:full|max|[0-9.]+,|,[0-9.]+|!?[0-9.]+,[0-9.]+|pct:[0-9.]+)\/+!?[0-9.]+\/+(?:color|gray|bitonal|default|native)\.(?:jpg|tif|png|gif|jp2|pdf|webp)(?:[?#].*)?$/.test(src)) {
			// first is region:
			// java.lang.IllegalArgumentException: Invalid region
			//   at edu.illinois.library.cantaloupe.resource.iiif.v2.Region.fromUri(Region.java:56)
			//   at edu.illinois.library.cantaloupe.resource.iiif.v2.Parameters.(Parameters.java:78)
			//   at edu.illinois.library.cantaloupe.resource.iiif.v2.ImageResource.doGet(ImageResource.java:62)
			// second is size:
			// java.lang.IllegalArgumentException: Invalid size
			//   at edu.illinois.library.cantaloupe.resource.iiif.v2.Size.fromUri(Size.java:80)
			//   at edu.illinois.library.cantaloupe.resource.iiif.v2.Parameters.(Parameters.java:80)
			//   at edu.illinois.library.cantaloupe.resource.iiif.v2.ImageResource.doGet(ImageResource.java:62)
			// last is rotation:
			// java.lang.IllegalArgumentException: Invalid rotation
			//   at edu.illinois.library.cantaloupe.resource.iiif.v2.Rotation.fromUri(Rotation.java:29)
			//   at edu.illinois.library.cantaloupe.resource.iiif.v2.Parameters.(Parameters.java:79)
			//   at edu.illinois.library.cantaloupe.resource.iiif.v2.ImageResource.doGet(ImageResource.java:62)
			//   at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)

			obj = {
				url: src
			};

			// https://gallica.bnf.fr/ark:/12148/bpt6k1510890t/f9.lowres
			//   https://gallica.bnf.fr/ark:/12148/bpt6k1510890t/f9.highres
			// https://gallica.bnf.fr/ark:/12148/bpt6k6582746n.thumbnail
			//   https://gallica.bnf.fr/ark:/12148/bpt6k6582746n.highres
			newsrc = src.replace(/(\/ark:\/+[0-9]+\/+[^/]+(?:\/+f[0-9])?)\.(?:thumbnail|lowres)(?:[?#].*)?$/, "$1.highres");
			if (newsrc !== src)
				return newsrc;

			// https://lakeimagesweb.artic.edu/iiif/2/08baefe5-1f78-bc4b-db7b-4f53d2edcc29/full/!800,800/0/default.jpg
			//   https://lakeimagesweb.artic.edu/iiif/2/08baefe5-1f78-bc4b-db7b-4f53d2edcc29/full/full/0/default.jpg
			// http://gallica.bnf.fr/iiif/ark:/12148/btv1b6000531z/f1/0,0,1024,1024/256,256/0/native.jpg
			//   http://gallica.bnf.fr/iiif/ark:/12148/btv1b6000531z/f1/full/full/0/native.jpg
			var prefix = "(?:iiif|loris)";
			if (domain === "iiif.library.ubc.ca" || domain === "iiif.library.utoronto.ca" || domain === "iiif.wellcomecollection.org") {
				obj.head_wrong_contenttype = true; // text/html
				prefix = "image";
			} else if (domain === "framemark.vam.ac.uk") {
				prefix = "collections";
			}

			regex = new RegExp("(/" + prefix + "/.*?/)[^/]+/[^/]+/[^/]+/([^/]+\\.[^/.]*)$");
			newsrc = src.replace(regex, "$1full/full/0/$2");
			if (newsrc !== src)
				return fillobj_urls([newsrc], obj);
		}

		if (domain_nowww === "seigura.com" ||
			// https://nhssf.org/wp-content/uploads/2019/12/IMG_1587-scaled.jpg
			domain_nowww === "nhssf.org" ||
			// http://www.larochette-hotel.fr/wp-content/uploads/2020/02/article-dna-001-scaled.jpg
			domain_nowww === "larochette-hotel.fr" ||
			// http://cfglobal01.mundotkm.com/2017/07/147114_MP1_1318-e1500065093615.jpg
			//   http://cfglobal01.mundotkm.com/2017/07/147114_MP1_1318.jpg
			domain_nosub === "mundotkm.com" ||
			// thanks to Liz on discord
			// https://www.androidpolice.com/wp-content/uploads/2021/03/22/OnePlus-9-Pro-3_Bc6T6saYiDVA-scaled.jpg
			//   https://www.androidpolice.com/wp-content/uploads/2021/03/22/OnePlus-9-Pro-3_Bc6T6saYiDVA.jpg
			domain_nowww === "androidpolice.com" ||
			// thanks to rEnr3n on github: https://github.com/qsniyg/maxurl/issues/875
			// https://www.elle.vn/wp-content/uploads/2021/08/14/446014/tap-chi-phai-dep-elle-thang-8-2021-Jennie-scaled.jpg
			//   https://www.elle.vn/wp-content/uploads/2021/08/14/446014/tap-chi-phai-dep-elle-thang-8-2021-Jennie.jpg
			domain_nowww === "elle.vn" ||
			// thanks to sn3akyb3ar on github: https://github.com/qsniyg/maxurl/issues/1127
			// https://media.wonderlandmagazine.com/uploads/2023/02/SOPHIA-SHOP-scaled.jpg
			domain === "media.wonderlandmagazine.com" ||
			// thanks to roi:
			// https://cdn.mopo.de/uploads/sites/4/2022/02/imago1009927687h-scaled.jpg
			//   https://cdn.mopo.de/uploads/sites/4/2022/02/imago1009927687h.jpg
			domain === "cdn.mopo.de" ||
			// thanks to roi:
			// https://www.newscenter1.tv/content/uploads/2022/06/r/p/img-3457-1-scaled.jpeg
			domain_nowww === "newscenter1.tv" ||
			// thanks to roi:
			// https://cdn.nba.com/manage/2022/12/GettyImages-1357956308-scaled-e1671225650160-784x454.jpg
			//   https://cdn.nba.com/manage/2022/12/GettyImages-1357956308.jpg
			(domain === "cdn.nba.com" && /\/manage\//.test(src)) ||
			// thanks to roi:
			// https://media.socastsrm.com/wordpress/wp-content/blogs.dir/2775/files/2022/12/1QKC4PqKXzE-scaled.jpg
			//   https://media.socastsrm.com/wordpress/wp-content/blogs.dir/2775/files/2022/12/1QKC4PqKXzE.jpg
			(domain === "media.socastsrm.com" && /\/wp-content\//.test(src)) ||
			// thanks to roi:
			// https://img.vt.co/2023/02/DFM94P-scaled.jpg
			//   https://img.vt.co/2023/02/DFM94P.jpg -- 5000x3333
			domain === "img.vt.co" ||
			// thanks to roi:
			// https://static.gazetaesportiva.com/uploads/imagem/2020/06/27/000_1U70B3-scaled.jpg
			//   https://static.gazetaesportiva.com/uploads/imagem/2020/06/27/000_1U70B3.jpg
			// https://static.gazetaesportiva.com/uploads/imagem/2023/02/24/52709195964_87879c0a95_o-1024x576.jpg
			//   https://static.gazetaesportiva.com/uploads/imagem/2023/02/24/52709195964_87879c0a95_o.jpg
			(domain === "static.gazetaesportiva.com" && /\/uploads\/+imagem\//.test(src)) ||
			// thanks to roi:
			// https://dx8um8x08u61i.cloudfront.net/uploads/sites/4/2021/07/Tim-Walter-beim-Training-1024x600.png
			//   https://dx8um8x08u61i.cloudfront.net/uploads/sites/4/2021/07/Tim-Walter-beim-Training.png
			// https://dx8um8x08u61i.cloudfront.net/uploads/sites/4/2021/10/urn_binary_dpa_com_20090101_211023-99-709686-FILED-scaled.jpeg?resize=800%2C552&crop_strategy=smart
			//   https://dx8um8x08u61i.cloudfront.net/uploads/sites/4/2021/10/urn_binary_dpa_com_20090101_211023-99-709686-FILED.jpeg
			(domain === "dx8um8x08u61i.cloudfront.net" && /\/uploads\/+sites\//.test(src)) ||
			// https://cms3.ots.at/ots/files/2023/04/20230424_PD1295.HR_-scaled-e1682331194269-950x296.jpg
			//   https://cms3.ots.at/ots/files/2023/04/20230424_PD1295.HR_.jpg
			(domain === "cms3.ots.at" && /\/ots\/+files\//.test(src)) ||
			// thanks to roi:
			// https://media.socastsrm.com/wordpress/wp-content/blogs.dir/653/files/2023/02/blades-lisowsky-e1676701185836.jpeg
			//   https://media.socastsrm.com/wordpress/wp-content/blogs.dir/653/files/2023/02/blades-lisowsky.jpeg
			domain == "media.socastsrm.com" ||
			// thanks to roi:
			// https://sports.inquirer.net/files/2023/02/rhenz-abando-anyang-kbl-e1676212385698.jpeg
			//   https://sports.inquirer.net/files/2023/02/rhenz-abando-anyang-kbl.jpeg
			domain === "sports.inquirer.net" ||
			// thanks to sn3akyb3ar on github: https://github.com/qsniyg/maxurl/issues/1208
			// https://saywhofr.fra1.cdn.digitaloceanspaces.com/app/uploads/2023/07/DJI_0953-scaled.jpg
			//   https://saywhofr.fra1.cdn.digitaloceanspaces.com/app/uploads/2023/07/DJI_0953.jpg
			// https://saywhofr.fra1.cdn.digitaloceanspaces.com/app/uploads/2023/09/armani_prive_02092024_lidovica_arcero_50.jpg-1500x1000.jpeg
			//   https://saywhofr.fra1.cdn.digitaloceanspaces.com/app/uploads/2023/09/armani_prive_02092024_lidovica_arcero_50.jpg.jpeg
			digitalocean_container === "saywhofr" ||
			// thanks to anonymous for reporting:
			// https://sfmoma-media-dev.s3.us-west-1.amazonaws.com/www-media/2018/08/03012116/4__The_new_SFMOMA_view_from_Yerba_Buena_Gardens__photo_Jon_McNeal-1024x700.jpg
			//   https://sfmoma-media-dev.s3.us-west-1.amazonaws.com/www-media/2018/08/03012116/4__The_new_SFMOMA_view_from_Yerba_Buena_Gardens__photo_Jon_McNeal.jpg
			// https://sfmoma-media-dev.s3.us-west-1.amazonaws.com/www-media/2018/08/25195225/2007.207_01_b02-Large-TIFF_4000-pixels-long-scaled.jpg
			//   https://sfmoma-media-dev.s3.us-west-1.amazonaws.com/www-media/2018/08/25195225/2007.207_01_b02-Large-TIFF_4000-pixels-long.jpg
			// https://sfmoma-media-dev.s3.us-west-1.amazonaws.com/www-media/2018/08/25195225/2007.207_01_b02-Large-TIFF_4000-pixels-long-300x125.jpg
			//   https://sfmoma-media-dev.s3.us-west-1.amazonaws.com/www-media/2018/08/25195225/2007.207_01_b02-Large-TIFF_4000-pixels-long.jpg
			(amazon_container === "sfmoma-media-dev" && string_indexof(src, "/www-media/") >= 0) ||
			// thanks to fireattack on discord:
			// https://animefestival.asia/singapore19/wp-content/uploads/sites/16/2019/12/Minori-Chihara-2-scaled.jpg
			//   https://animefestival.asia/singapore19/wp-content/uploads/sites/16/2019/12/Minori-Chihara-2.jpg
			// thanks to fireattack on github: https://github.com/qsniyg/maxurl/issues/1108
			// https://eeo.today/media/wp-content/uploads/2023/01/06102936/IMGP2490-scaled.jpeg
			//   https://eeo.today/media/wp-content/uploads/2023/01/06102936/IMGP2490.jpeg
			// thanks to fireattack on discord:
			// https://www.e-komachi.com/wp-content/uploads/%E3%82%A8%E3%83%B3%E3%82%BF%E3%83%A1_%E3%83%A1%E3%82%A4%E3%83%B3_%E3%82%A6%E3%82%A7%E3%83%96-scaled.jpg
			//   https://www.e-komachi.com/wp-content/uploads/%E3%82%A8%E3%83%B3%E3%82%BF%E3%83%A1_%E3%83%A1%E3%82%A4%E3%83%B3_%E3%82%A6%E3%82%A7%E3%83%96.jpg
			// thanks to nimbuz on discord:
			// https://rihosayashi.jp/_apps/wp-content/uploads/GYXi8CFaUAA8m1t-scaled.jpg
			//   https://rihosayashi.jp/_apps/wp-content/uploads/GYXi8CFaUAA8m1t.jpg
			/(\/wp-content\/+uploads\/+(?:sites\/+[0-9]+\/+)?(?:[0-9]{4}\/+[0-9]{2}\/+)?.*)-(?:scaled|e[0-9]{10,})(\.[^/.]+)(?:[?#].*)?$/.test(src)) {
			// thanks to fireattack on discord
			// https://seigura.com/wp-content/uploads/2020/05/461979a205baaa10d281de33cc7d2c01-scaled.jpg
			//   https://seigura.com/wp-content/uploads/2020/05/461979a205baaa10d281de33cc7d2c01.jpg
			// thanks to nimbuz on discord:
			// https://www.just-pro.jp/wp-content/uploads/2020/08/bce5a0e402d7dcefe6769c91602231c9-e1597301134874.jpg
			//   https://www.just-pro.jp/wp-content/uploads/2020/08/bce5a0e402d7dcefe6769c91602231c9.jpg
			// https://www.just-pro.jp/wp-content/uploads/2021/06/21c4961113d0c5ac12c2c1ca9f5c1497-scaled-e1623983146323.jpg
			//   https://www.just-pro.jp/wp-content/uploads/2021/06/21c4961113d0c5ac12c2c1ca9f5c1497.jpg
			newsrc = src.replace(/((?:(?:\/wp-content)?\/+uploads(?:\/+sites\/+[0-9]+)?)?\/+[0-9]{4}\/+[0-9]{2}\/+[^?#]*?|\/wp-content\/+uploads(?:\/+sites\/+[0-9]+)?\/+[^?#]*?)(?:-(?:scaled|e[0-9]{10,}|[0-9]+x[0-9]+))*(\.[^/.?]+)(?:[?#].*)?$/, "$1$2");
			if (newsrc !== src) {
				let urls = [newsrc];
				// thanks to roi:
				// https://vseznaika.press/wp-content/uploads/2023/05/%D0%90%D0%BB%D0%B5%D0%BA%D1%81%D0%B0%D0%BD%D0%B4%D1%80-%D0%AD%D0%BD%D0%B1%D0%B5%D1%80%D1%822-scaled.webp
				//   https://vseznaika.press/wp-content/uploads/2023/05/%D0%90%D0%BB%D0%B5%D0%BA%D1%81%D0%B0%D0%BD%D0%B4%D1%80-%D0%AD%D0%BD%D0%B1%D0%B5%D1%80%D1%822.jpg
				let newsrc1 = newsrc.replace(/\.webp([?#].*)?$/, ".jpg$1");
				if (newsrc1 !== newsrc)
					urls.unshift(newsrc1);
				return urls
			}
		}

		if (options.rule_specific && options.rule_specific.linked_image && options.element && options.element.parentElement) {
			var link_el = common_functions["get_link_el_matching"](options.element.parentElement, function(el) {
				if (el.href && el.href !== origsrc && looks_like_valid_link(el.href, el))
					return true;
			});

			if (link_el)
				return link_el.href;
		}

		// pixelfed
		if (/^[a-z]+:\/\/[^/]+\/+storage\/+m\/+_v2\/+[0-9]{5,}\/+[0-9a-f]+-[0-9a-f]+\/+[0-9a-zA-Z]+\/+[0-9a-zA-Z]+_thumb\./.test(src)) {
			// https://pixelfed.social/storage/m/_v2/195250919699517440/a2741f614-ed245b/kbiQMoyVaiJ4/ecnytiPRcW3dgNpLx208NLfWbDXQ9MdxggCs2yjm_thumb.jpeg
			//   https://pixelfed.social/storage/m/_v2/195250919699517440/a2741f614-ed245b/kbiQMoyVaiJ4/ecnytiPRcW3dgNpLx208NLfWbDXQ9MdxggCs2yjm.jpeg
			return src.replace(/(\/storage\/+m\/+_v2\/+[0-9]{5,}\/+[0-9a-f]+-[0-9a-f]+\/+[0-9a-zA-Z]+\/+[0-9a-zA-Z]+)_thumb\./, "$1.");
		}

		// zencart?
		if (/^[a-z]+:\/\/[^/]+\/+send_imgs\.php\?(?:.*&)?img=abe91d36bea45a343609fca197da54079/.test(src)) {
			// thanks to nijaz-lab on github for reporting: https://github.com/qsniyg/maxurl/issues/554
			// https://www.jusvegank.com/send_imgs.php?img=abe91d36bea45a343609fca197da54079HR0cDovL2be91d36bea45a343609fca197da54079kuZWJheWltZy5jb20vaW1hZ2VzL2cvTWtrQUFPU3dwcDlheU56MC9zLWwzMDAucG5n
			//   http://i.ebayimg.com/images/g/MkkAAOSwpp9ayNz0/s-l300.png
			// https://www.etopwear.com/send_imgs.php?img=abe91d36bea45a343609fca197da54079HR0cDovL2be91d36bea45a343609fca197da54079kuZWJheWltZy5jb20vaW1hZ2VzL2cvb2lZQUFPU3dOMzVjd3REZy9zLWwzMDAucG5n
			//   http://i.ebayimg.com/images/g/oiYAAOSwN35cwtDg/s-l300.png
			// seems to always be the same hex value, no matter the site
			match = src.match(/^[a-z]+:\/\/[^/]+\/+send_imgs\.php\?(?:.*&)?img=([^&]+)/);
			if (match) {
				newsrc = match[1].replace(/be91d36bea45a343609fca197da54079/g, "");
				return base64_decode(newsrc);
			}
		}

		// a polish? cms system, can't find info about it
		if (/\/files\/+pl\/+mini\/+([^/]+)(?:[?#].*)?$/.test(src)) {
			// thanks to elvisef on github for reporting: https://github.com/qsniyg/maxurl/issues/836
			// https://katowice.ap.gov.pl/cms/files/pl/mini/xhist-kat-2,P20-,P20Kopia,P20-,P20Kopia,P20-,P20Kopia,P20-,P20Kopia,P20-,P20Kopia,P20-,P20Kopia,P20-,P20Kopia.jpg.pagespeed.ic.q7cOJ2gb_u.webp
			//   https://katowice.ap.gov.pl/cms/files/pl/xhist-kat-2,P20-,P20Kopia,P20-,P20Kopia,P20-,P20Kopia,P20-,P20Kopia,P20-,P20Kopia,P20-,P20Kopia,P20-,P20Kopia.jpg.pagespeed.ic.q7cOJ2gb_u.webp
			// https://katowice.ap.gov.pl/cms/files/pl/mini/xlogo-AP-KATOWICE-PL-poziom-CMYK,P20970x.jpg.pagespeed.ic.MvHpbjYrB5.webp
			//   https://katowice.ap.gov.pl/cms/files/pl/xlogo-AP-KATOWICE-PL-poziom-CMYK,P20970x.jpg.pagespeed.ic.MvHpbjYrB5.webp
			// http://www.urazowka.piekary.pl/english/files/pl/mini/806pomnik.jpg
			//   http://www.urazowka.piekary.pl/english/files/pl/806pomnik.jpg
			// http://lcm-luban.pl/lsks/files/pl/mini/x20180217-130441.jpg.pagespeed.ic.WLRZAtXS3O.webp
			//   http://lcm-luban.pl/lsks/files/pl/x20180217-130441.jpg.pagespeed.ic.WLRZAtXS3O.webp
			// https://subkowy.pl/new/files/pl/mini/loteria-losowania-NSP-1536x1033-1622805460.jpg
			//   https://subkowy.pl/new/files/pl/loteria-losowania-NSP-1536x1033-1622805460.jpg
			return src.replace(/\/files\/+pl\/+mini\/+/, "/files/pl/");
		}

		// seems to only work for the one image, most images don't have the 1-24-2018 prefix
		if (false && /\/wp-content\/+uploads\/+elementor\/+thumbs\//.test(src)) {
			// https://geneticliteracyproject.org/wp-content/uploads/elementor/thumbs/1-24-2018-husky-white-blue-eyes-dog-photograph-blue-eyes-nkv3sxkvz75yxsi87febzlal06xkjmnj8z2p990vjy.jpg
			//   https://geneticliteracyproject.org/wp-content/uploads/2018/01/1-24-2018-husky-white-blue-eyes-dog-photograph-blue-eyes.jpg
			match = src.match(/\/elementor\/+thumbs\/+(([0-9]{1,2})-[0-9]{1,2}-([0-9]{4})-[^/]+)-[a-z0-9]{10,}\./);
			if (match) {
				let year = match[3];
				let month = zpadnum(match[2], 2);
				let filename = match[1];

				return src.replace(/\/wp-content\/+uploads\/+elementor\/+thumbs\/+[^/]+\./, "/wp-content/uploads/" + year + "/" + month + "/" + filename + ".");
			}
		}

		// joomgallery
		if (/\/images\/+joomgallery\//.test(src)) {
			// http://www.bestfon.info/images/joomgallery/thumbnails/chicas_24/jennifer_lawrence_2016_20161009_1500650344.jpg
			//   http://www.bestfon.info/images/joomgallery/originals/chicas_24/jennifer_lawrence_2016_20161009_1500650344.jpg
			// https://www.fotoclub-schwyz.ch/cms33/images/joomgallery/thumbnails/anlaesse_17/der_rote_mond_27072018_61/beni_20180727-dsc_2208-45_20180729_2093836422.jpg
			//   https://www.fotoclub-schwyz.ch/cms33/images/joomgallery/originals/anlaesse_17/der_rote_mond_27072018_61/beni_20180727-dsc_2208-45_20180729_2093836422.jpg
			// https://www.heimatlexikon-thaleischweiler-froeschen.de/images/joomgallery/details/saufels_9/saufels_9_20151017_1146603215.jpg
			// other:
			// https://www.mrcuesbilliards.com/images/jsn_is_thumbs/images/joomgallery/new_york_yankees_17/new_york_yankees_table_1_20140806_1481010356.jpg
			//   http://site2016.mrcuesbilliards.com/images/joomgallery/new_york_yankees_17/new_york_yankees_table_1_20140806_1540176238.jpg
			// https://alumni-augsburg.net/images/joomgallery/Fotos/Ersti-Huette/AUStA/2018/AUStA_Htte_2018_0067.jpg -- can't find thumbnail variant
			// http://www.huesede.de/images/Joomgallery/impressionen/thumbs/Impressionen-1.jpg
			//   http://www.huesede.de/images/Joomgallery/impressionen/Impressionen-1.jpg
			return src.replace(/\/images\/+joomgallery\/+(?:thumbnails|details)\/+([^/]+\/+(?:.*\/)?[^/]+)(?:[?#].*)?$/, "/images/joomgallery/originals/$1");
		}

		// next.js
		if ((/\/_next\/+image\/*\?/.test(src)) ||
			/\/_next\/+image\/*\?(?:.*&)?url=/.test(src)) {
			// thanks to dym-sh on github: https://github.com/qsniyg/maxurl/issues/894
			// https://egghead.io/_next/image?url=https%3A%2F%2Fd2eip9sf3oo6c2.cloudfront.net%2Fplaylists%2Fsquare_covers%2F000%2F487%2F059%2Ffull%2FPrisma_TS.png&w=750&q=100
			//   https://d2eip9sf3oo6c2.cloudfront.net/playlists/square_covers/000/487/059/full/Prisma_TS.png
			// https://egghead.io/_next/image?url=https%3A%2F%2Fres.cloudinary.com%2Fdg3gyk0gu%2Fimage%2Fupload%2Fv1607523756%2Fegghead-next-ebombs%2Farticle-illustrations%2Fcodemods.png&w=3840&q=100
			//   https://res.cloudinary.com/dg3gyk0gu/image/upload/egghead-next-ebombs/article-illustrations/codemods.png
			// thanks to nimbuz and Liz on discord: https://github.com/qsniyg/maxurl/issues/961
			// https://song.link/_next/image?url=https%3A%2F%2Fis3-ssl.mzstatic.com%2Fimage%2Fthumb%2FMusic115%2Fv4%2Fd3%2F83%2Fff%2Fd383ff79-4ad4-450b-c252-b648b31e0d45%2Fsource%2F512x512bb.jpg&w=1920&q=75
			//   https://is3-ssl.mzstatic.com/image/thumb/Music115/v4/d3/83/ff/d383ff79-4ad4-450b-c252-b648b31e0d45/source/999999999x0w-999.png
			// thanks to dym-sh on github: https://github.com/qsniyg/maxurl/issues/893
			// https://www.courier.com/_next/image?url=%2Fimages%2Fpages%2Fhome%2Fworkflows%2Fworkflows.png&w=1080&q=75
			//   https://www.courier.com/images/pages/home/workflows/workflows.png
			// thanks to dym-sh on github: https://github.com/qsniyg/maxurl/issues/763
			// https://nextjs.org/docs/api-reference/next/image
			// https://opencollective.com/_next/image?url=%2Fstatic%2Fimages%2Fhome%2FcelebrateSupporters-screenshot.png&w=1920&q=75
			//   https://opencollective.com/static/images/home/celebrateSupporters-screenshot.png
			// thanks to anonymous for reporting:
			// https://alternativeto.net/_next/image/?url=https%3A%2F%2Fd2.alternativeto.net%2Fdist%2Flistheaders%2Flist-21083-1605422357-cover.png%3Fformat%3Djpg%26width%3D1200%26height%3D630%26mode%3Dcrop&w=3840&q=75
			//   https://d2.alternativeto.net/dist/listheaders/list-21083-1605422357-cover.png?format=jpg&width=1200&height=630&mode=crop
			var queries = get_queries(src);
			if (queries && queries.url)
				return urljoin(src.replace(/\/_next\/.*/, ""), decodeURIComponent(queries.url), false);
		}

		// Discuz!X
		if (/\/uc_server\/+data\/+avatar\/+[0-9]{3}\/+[0-9]{2}\/+[0-9]{2}\/+[0-9]{2}_avatar(?:_[0-9a-f]+)?_[a-z]+\.[^/.]+(?:[?#].*)?$/.test(src)) {
			// thanks to n0099 on github: https://github.com/qsniyg/maxurl/issues/1172
			// https://github.com/codersclub/DiscuzX/blob/5d23e9684bd91a71de36ac5c237c1ed6a074f026/upload/uc_server/avatar.php#L66
			// https://forum33.djicdn.com/uc_server/data/avatar/005/99/45/14_avatar_7969b9c2bff2ef96dc4429d49778be80_middle.jpg
			//   https://forum33.djicdn.com/uc_server/data/avatar/005/99/45/14_avatar_7969b9c2bff2ef96dc4429d49778be80_big.jpg
			// https://community.cisco.com/legacyfs/online/avatars/uc_server/data/avatar/000/07/85/92_avatar_small.jpg
			//   https://community.cisco.com/legacyfs/online/avatars/uc_server/data/avatar/000/07/85/92_avatar_big.jpg
			// https://www.ipaiji.com/uc_server/data/avatar/001/70/73/19_avatar_middle.jpg
			//   https://www.ipaiji.com/uc_server/data/avatar/001/70/73/19_avatar_big.jpg
			// https://www.marioforever.net/uc_server/data/avatar/000/00/00/47_avatar_small.jpg
			//   https://www.marioforever.net/uc_server/data/avatar/000/00/00/47_avatar_big.jpg
			// doesn't work for all:
			// https://imgs.tecno.com/us/uc_server/data/avatar/000/55/49/15_avatar_middle.jpg?v=1664728103 -- 1584x1471
			//   https://imgs.tecno.com/us/uc_server/data/avatar/000/55/49/15_avatar_big.jpg?v=1664728103 -- doesn't work
			// other:
			//  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") {
			let images = options.element.querySelectorAll("image");
			if (images.length === 1) {
				let image = images[0];
				let href = image.getAttribute("href");
				if (!href) {
					href = image.getAttribute("xlink:href");
				}

				if (href) {
					return urljoin(options.host_url, href, true);
				}
			}
		}


















		// -- info rules -- (rules that explain server limitations, but don't actually modify the URL)

		if (domain === "blogs-images.forbes.com" ||
			// http://images-origin.playboy.com/ogz4nxetbde6/3CJdCBvUEU2qaE6E00CYQU/a8277fb2808ea265a219036c150c4ffe/24_Dodger.jpg
			domain === "images-origin.playboy.com" ||
			// http://images.kpopstarz.com/data/images/full/87676/roy-kim-says-he-is-sorry-that-his-song-spring-spring-spring-bom-bom-bom-has-drawn-plagiarism-accusations.jpg
			domain === "images.kpopstarz.com" ||
			// https://etimg.etb2bimg.com/photo/62837430.cms
			domain === "etimg.etb2bimg.com" ||
			// http://feeds.thetimes.co.uk/web/imageserver/imageserver/image/methode%2Ftimes%2Fprod%2Fweb%2Fbin%2F851fb466-202d-11e7-ba28-54204ca551ca.jpg?crop=1500,844,0,38
			domain_nosub === "thetimes.co.uk" ||
			// http://mediaresources.idiva.com/media/photogallery/2011/May/isabel_lucas_india_inspired_320x240.jpg
			domain === "mediaresources.idiva.com" ||
			// https://telugu.samayam.com/photo/65304761.cms
			domain === "telugu.samayam.com" ||
			// https://i3.cpcache.com/product/1940586465/Elegant_Floral_Abstract_Decorative_Shower_Curtain_300x300.jpg?height=300&width=300&qv=90&side=front&Filters=[{%22name%22:%22background%22,%22value%22:%22ddddde%22,%22sequence%22:2}]
			(domain_nosub === "cpcache.com" && domain.match(/^i[0-9]*\./)) ||
			// https://www.filmibeat.com/ph-big/2018/05/shraddha-das_152655086100.jpg
			// https://photos.filmibeat.com/ph-big/2013/05/ishq-in-paris-press-meet_136746965027.jpg
			domain_nosub === "filmibeat.com" ||
			// http://www.cdn.tv2.no/images?imageId=8999096&height=-1
			domain === "www.cdn.tv2.no" ||
			// https://photo.voici.fr/upload/slideshow/madonna-fesses-a-l-air-nicki-minaj-ultra-decolletee-aux-grammy-awards-9582/nicki-minaj-toujours-aussi-en-formes-168851.jpg
			domain === "photo.voici.fr" ||
			// https://www.essexstudent.com/asset/Event/6006/aquaman-original.jpg?thumbnail_width=595&thumbnail_height=883&resize_type=CropToFit
			domain_nowww === "essexstudent.com" ||
			// https://th.thgim.com/life-and-style/htvob7/article27371367.ece/BINARY/Aakash-landscape-1
			domain === "th.thgim.com" ||
			// https://m.timesofindia.com/photo/69414219.cms
			domain_nosub === "timesofindia.com" ||
			// https://static.langimg.com/thumb/msid-69234694,resizemode-4,width-250,height-172/%E0%B2%88%E0%B2%97%E0%B2%B2%E0%B3%87-%E0%B2%AC%E0%B2%95%E0%B3%8D%E0%B2%95%E0%B2%A4%E0%B2%B2%E0%B3%86-%E0%B2%86%E0%B2%97%E0%B2%BF%E0%B2%A6%E0%B3%86,-%E0%B2%87%E0%B2%A8%E0%B3%8D%E0%B2%A8%E0%B3%81-%E0%B2%AE%E0%B2%A6%E0%B3%81%E0%B2%B5%E0%B3%86-%E0%B2%AF%E0%B2%BE%E0%B2%95%E0%B3%86-%E0%B2%8E%E0%B2%82%E0%B2%A6-%E0%B2%85%E0%B2%B0%E0%B3%8D%E0%B2%9C%E0%B3%81%E0%B2%A8%E0%B3%8D-%E0%B2%95%E0%B2%AA%E0%B3%82%E0%B2%B0%E0%B3%8D.jpg
			domain === "static.langimg.com" ||
			// https://vijaykarnataka.indiatimes.com/thumb/msid-69234694,width-300,height-200,resizemode-4/pic.jpg
			domain_nosub === "indiatimes.com" ||
			// https://www.thehindu.com/migration_catalog/article14926809.ece/alternates/FREE_660/30MPSQUIRREL
			domain_nosub === "thehindu.com" ||
			// https://api.kauri.io/ipfs/QmX5RCZWSMc4Xj3XcnwfyLVv7Ym2nWeeSSggu2i3urLDTC
			// https://api.beta.kauri.io:443/ipfs/QmXqLJc3qp8vkHqifRCjbZApg758kdgBrgZVibkMDDFCqZ
			(domain_nosub === "kauri.io" && /^api\./.test(domain) && string_indexof(src, "/ipfs/") >= 0) ||
			// http://images.contentful.com/l7es9q9kzr9z/KVC2bUAzyUkW6KaMgGkeA/2f45f07b331a60fc360ff8d641a29d7a/778_KimberlyMcArthur_15.jpg
			domain === "images.contentful.com") {
			return {
				url: src,
				head_wrong_contentlength: true
			};
		}

		if (domain === "cdn.marketplaceimages.windowsphone.com" ||
			// https://img.br.de/64705972-8ec2-4b41-96c6-7a36cecbe0f5.jpeg?q=80&rect=0%2C385%2C2644%2C1488&w=2000
			domain === "img.br.de") {
			// http://cdn.marketplaceimages.windowsphone.com/v8/images/c8268cdc-ac27-4a03-bd9b-f2c3645e5387?imageType=ws_icon_large
			return {
				url: src,
				head_wrong_contentlength: true,
				head_wrong_contenttype: true
			};
		}

		if ((domain_nosub === "appspot.com" && domain.match(/^wixmp-[0-9a-f]+\./)) ||
			(domain_nosub === "wixmp.com" && domain.match(/^api-da(?:.*)?\./) && string_indexof(src, "/download/file") >= 0)) {
			// https://wixmp-ed30a86b8c4ca887773594c2.appspot.com/_api/download/file?downloadToken=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1cm46YXBwOjdlMGQxODg5ODIyNjQzNzNhNWYwZDQxNWVhMGQyNmUwIiwiaXNzIjoidXJuOmFwcDo3ZTBkMTg4OTgyMjY0MzczYTVmMGQ0MTVlYTBkMjZlMCIsImV4cCI6MTU0MTMwNDIwMSwiaWF0IjoxNTQxMzAzNTkxLCJqdGkiOiI1YmRlNmQzMTkzZjgzIiwib2JqIjpudWxsLCJhdWQiOlsidXJuOnNlcnZpY2U6ZmlsZS5kb3dubG9hZCJdLCJwYXlsb2FkIjp7InBhdGgiOiJcL2ZcL2JjMTFhNWJkLWM4NWEtNGUwNy1hODkwLWE4M2NlMjg2Y2ZlZVwvZGNxamJvbS01YjQyMzA4Yi0xODFjLTRiYjYtOTEwOC01Y2UzNTA4OTg2ZTQuanBnIn19.AoP-jqpFXSX1QmZ1fmrsKDKKU1dRZoNqVShSh5De92I
			// https://api-da-b.wixmp.com/_api/download/file?downloadToken=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1cm46YXBwOjdlMGQxODg5ODIyNjQzNzNhNWYwZDQxNWVhMGQyNmUwIiwiaXNzIjoidXJuOmFwcDo3ZTBkMTg4OTgyMjY0MzczYTVmMGQ0MTVlYTBkMjZlMCIsImV4cCI6MTU1NTk3OTE4NCwiaWF0IjoxNTU1OTc4NTc0LCJqdGkiOiI1Y2JlNTk1ODI0NjRlIiwib2JqIjpudWxsLCJhdWQiOlsidXJuOnNlcnZpY2U6ZmlsZS5kb3dubG9hZCJdLCJwYXlsb2FkIjp7InBhdGgiOiJcL2ZcLzQ0MjgyNWY3LWI4YjMtNDdiNS04OWY0LWE1ZTcyZDU0MTEzNFwvZGN3ZzVydS03MWU1ZTA3Ni1hOGNiLTRhZDgtYWE3OC1lMWNhNjcxZGEyOGYuanBnIiwiYXR0YWNobWVudCI6eyJmaWxlbmFtZSI6ImRlbHRhX3RzdW5kZXJlXzAyX2J5X2ZsaWNrZXJfc2hvd19kY3dnNXJ1LmpwZyJ9fX0.ByzVq1EkN7qpSfYuBOx5IcH13vCy4E7lsl68KIcZLEs
			// https://api-da.wixmp.com/_api/download/file?downloadToken=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1cm46YXBwOjdlMGQxODg5ODIyNjQzNzNhNWYwZDQxNWVhMGQyNmUwIiwiaXNzIjoidXJuOmFwcDo3ZTBkMTg4OTgyMjY0MzczYTVmMGQ0MTVlYTBkMjZlMCIsImV4cCI6MTU3MTAyMzQxMCwiaWF0IjoxNTcxMDIyODAwLCJqdGkiOiI1ZGEzZTdkYTMxNDAwIiwib2JqIjpudWxsLCJhdWQiOlsidXJuOnNlcnZpY2U6ZmlsZS5kb3dubG9hZCJdLCJwYXlsb2FkIjp7InBhdGgiOiJcL2ZcLzU1ODQzZjBjLWY3NzMtNGIxMS1iOGIxLTg5ZWQ1NWMwYjI0M1wvZGRpOTJ4OC03NmM5ODNjNS00OTY4LTQwNTgtYmU1ZS1hODQ0MmM0ZjY5YTgucG5nIiwiYXR0YWNobWVudCI6eyJmaWxlbmFtZSI6ImNvbHRfeF9ib19uc2Z3X2J5X2luZmxhbWVkdXJldGhyYV9kZGk5Mng4LnBuZyJ9fX0.wvhxioHPp1X92bEriVOJkRUUr4nNaLLZF55sYGlEzNU
			return {
				url: src,
				head_wrong_contentlength: true,
				head_wrong_contenttype: true,
				forces_download: true,
				is_private: true
			};
		}

		if (domain_nowww === "ozanyerli.com" ||
			domain === "gallica.bnf.fr" ||
			// https://dieta.pourfemme.it/img/2010/07/dieta-vegana-8-420x260.jpg
			domain === "dieta.pourfemme.it" ||
			// http://www.ellahoy.es/img/Rihanna-y-Chopard-lanzan-coleccion-de-joyas.jpg
			domain_nowww === "ellahoy.es" ||
			// https://www.allgirlannihilation.net/wp-content/uploads/2016/08/dyked_aurora_and_tali_115.jpg
			domain_nowww === "allgirlannihilation.net" ||
			// https://stockservice.digital.vistaprint.com/6392d2223ee2fff77d1f06a4683be009.jpg
			domain === "stockservice.digital.vistaprint.com" ||
			// https://cdn.akb48.co.jp/cache/image/?path=%2Fmembers%2Fprofile%2Fteam_8_png%2Foguri_yui.png
			domain === "cdn.akb48.co.jp") {
			// http://www.ozanyerli.com/uploadfile/2016/0411/thumb_240_0_20160411034324215.jpg
			return {
				url: src,
				head_wrong_contenttype: true
			};
		}

		if ((domain === "images.thestar.com" && string_indexof(src, "/content/dam/") >= 0) ||
			// https://www.thestar.com/content/dam/thestar/news/world/2018/12/27/new-york-transformer-explosion-lights-sky-knocks-power/ny_plant_explosion_1.jpg -- 403 on head
			(domain_nowww === "thestar.com" && string_indexof(src, "/content/dam/") >= 0) ||
			// https://steamuserimages-a.akamaihd.net/ugc/957477541351011744/4E72325356B57289FA6632774F1A3E4DEB324F6B/?imw=2048&imh=1152&ima=fit&impolicy=Letterbox&imcolor=%23000000&letterbox=true
			(domain_nosub === "akamaihd.net" && domain.match(/^steamuserimages-[a-z]\./)) ||
			// https://www.kansascity.com/entertainment/movies-news-reviews/14x5cd/picture115119338/BINARY/edge%20of%20seventeen(2)
			domain_nowww === "kansascity.com" ||
			// https://www.sanluisobispo.com/entertainment/movies-news-reviews/i9fla8/picture189785229/BINARY/COVER%201%20Zac%20Efron
			domain_nowww === "sanluisobispo.com" ||
			// https://iichan.hk/c/src/1483306651580.jpg
			domain_nowww === "iichan.hk" || // 403
			// https://pdfkul.com/img/piper-perri-mofopdf_59c0cc2d1723dddc42c513a0.jpg
			domain_nowww === "pdfkul.com" ||
			// http://user-images.strikinglycdn.com/res/hrscywv4p/image/upload/1515559/534889_633117.jpg
			domain_nosub === "strikinglycdn.com" || // 403
			// https://images.boosty.to/user/23212/avatar?change_time=1566827978&croped=1&mh=560&mw=450
			domain === "images.boosty.to" || // 400
			// https://www.snopes.com/tachyon/2021/01/mcdonalds-curved-glass.jpg?resize=1200,630&quality=65
			domain_nowww === "snopes.com" || // 403
			// thanks to sn3akyb3ar: https://github.com/qsniyg/maxurl/issues/931
			domain_nowww === "contentmode.com" ||
			// thanks to roi:
			// https://www.newschainonline.com/bsp-static/image/2023/02/24/17/6c80929b56e560f2b6de552320959da0Y29udGVudHNlYXJjaGFwaSwxNjc3MzQ2Mzk3-2.68826944.jpg?crop=61:45,smart&quality=50&auto=webp&width=955
			(domain_nowww === "newschainonline.com" && /\/bsp-static\/+image\//.test(src)) ||
			// thanks to Melih Şirin on discord
			(domain_nosub === "sanalsinif.marmara.edu.tr" && /\/iapi\/+files\//.test(src)) || // 404 for recorded videos
			// thanks to anonymous for reporting:
			// https://res.garmin.com/transform/image/upload/b_rgb:FFFFFF,c_pad,dpr_1.0,f_auto,h_520,q_auto,w_520/c_pad,h_520,w_520/v1/Product_Images/en/products/010-02627-11/v/cf-xl-1cee6511-d508-4f9b-9f75-9d9650717fd8?pgw=1&pgwact=1
			domain === "res.garmin.com" ||
			// thanks to anonymous for reporting:
			domain === "cbjpeg.stream.highwebmedia.com" ||
			// thanks to anonymous for reporting:
			domain === "images.moviesanywhere.com" ||
			(domain_nosub === "irishmirror.ie" && domain.match(/i[0-9]*(?:-prod)?\./))) {
			return {
				url: src,
				can_head: false
			};
		}

		if (//(domain_nosub === "radikal.ru" && domain.match(/^s[0-9]*\./)) ||
			// http://www.atkmodels.com/hairy/img/content/190526_7.jpg
			domain_nowww === "atkmodels.com" ||
			// https://akibatan.com/wp-content/uploads/2017/06/music-theatre-2017-live-report-09.jpg?ssl=1
			domain_nowww === "akibatan.com" ||
			// thanks to DevWannabe-dot on github for reporting: https://github.com/qsniyg/maxurl/issues/888
			// https://imgsapp2.uai.com.br/app/da_conteudo_147034442637/2016/10/28/12/20161028112752931152e.jpg
			(domain_nosub === "uai.com.br" && /^imgsapp[0-9]*\./.test(domain)) ||
			// https://www.n3rdabl3.com/wp-content/images/uploads/2015/04/FPS_Enix_DeusEX-720x423-720x423.jpg
			domain_nowww === "n3rdabl3.com") {
			// http://s018.radikal.ru/i521/1301/32/a24fb200297f.jpg
			return {
				url: src,
				headers: {
					Referer: ""
				}
			};
		}

		if (domain_nowww === "image.fomos.kr" ||
			// http://www.onlifezone.com/files/attach/images/2688285/230/488/010/3.jpg
			domain_nowww === "onlifezone.com" ||
			domain === "cdn.anime-planet.com" ||
			domain === "write.dcinside.com") {
			return {
				url: src,
				can_head: false,
				headers: {
					Referer: ""
				}
			};
		}

		if (domain_nowww === "1in.am" ||
			// http://file1-1.bobaedream.co.kr/multi_image/strange/2016/06/24/14/AAg576cc87160200.jpg
			(domain_nosub === "bobaedream.co.kr" && /^file[-0-9]+\./.test(domain)) ||
			domain_nowww === "dogdrip.net") {
			// https://www.1in.am/assets/uploads/2019/01/02-56-540x360.jpg
			return {
				url: src,
				headers: {
					Referer: src
				}
			};
		}

		if (host_domain_nowww === "discordapp.com" || host_domain_nowww === "discord.com") {
			return {
				url: src,
				need_data_url: true
			};
		}











		if (options.null_if_no_change) {
			if (src !== origsrc)
				return src;
			return null;
		}

		return src;
	}
	// -- end bigimage --

	var get_helpers = function(options) {
		var host_domain = "";
		var host_domain_nowww = "";
		var host_domain_nosub = "";
		if (options.host_url) {
			host_domain = options.host_url.replace(/^[a-z]+:\/\/([^/]*)(?:\/.*)?$/,"$1");

			host_domain_nowww = host_domain.replace(/^www\./, "");
			host_domain_nosub = host_domain.replace(/^.*\.([^.]*\.[^.]*)$/, "$1");
			if (host_domain_nosub.match(/^co\.[a-z]{2}$/)) {
				host_domain_nosub = host_domain.replace(/^.*\.([^.]*\.[^.]*\.[^.]*)$/, "$1");
			}
		}

		try {
			if (options.document)
				document = options.document;
			if (options.window)
				window = options.window;
		} catch (e) {
			//console_warn("Failed to set document/window", e);
		}


		var new_image = function(src) {
			var img = document_createElement("img");
			img.src = src;
			return img;
		};

		var new_video = function(src) {
			var video = document_createElement("video");
			video.src = src;
			return video;
		};

		var new_media = function(src, is_video) {
			if (is_video)
				return new_video(src);
			else
				return new_image(src);
		};

		var get_nextprev_el = function(el, nextprev) {
			if (nextprev) {
				return el.nextElementSibling;
			} else {
				return el.previousElementSibling;
			}
		};

		var get_nextprev_from_list = function(el, list, nextprev) {
			var el_src = get_img_src(el);
			var index = -1;
			for (var i = 0; i < list.length; i++) {
				if (typeof list[i] === "string") {
					if (el_src === list[i]) {
						index = i;
						break;
					}
				} else {
					if (el === list[i]) {
						index = i;
						break;
					}
				}
			}

			if (index === -1)
				return null;

			if (nextprev) {
				if ((index+1) >= list.length)
					return null;
				else
					return list[index + 1];
			} else {
				if ((index-1) < 0)
					return null;
				else
					return list[index - 1];
			}
		};

		var get_nextprev_from_tree = function(el, nextprev, tree, selector) {
			var current = el;
			for (var i = 0; i < tree.length; i++) {
				if (tree[i].tagName !== current.tagName)
					return "default";

				if (tree[i].classList) {
					for (const cls of tree[i].classList) {
						if (!current.classList.contains(cls)) {
							return "default";
						}
					}
				}

				if (tree[i].attrs) {
					for (let attr in tree[i].attrs) {
						if (current.getAttribute(attr) !== tree[i].attrs[attr])
							return "default";
					}
				}

				current = current.parentElement;
			}

			let items = current.querySelectorAll(selector);
			return get_nextprev_from_list(el, items, nextprev);
		}

		var get_nextprev_from_thumbs = function(el, nextprev, options) {
			if (!options.compare_els) {
				if (!options.compare_urls) {
					if (options.id_for_url) {
						if (typeof options.id_for_url !== "function") {
							var id_for_url = options.id_for_url;
							options.id_for_url = function(x) {
								var match = x.match(id_for_url);
								if (!match)
									return null;

								return match[1];
							};
						}

						options.compare_urls = function(a, b) {
							if (!a || !b)
								return false;

							return options.id_for_url(a) === options.id_for_url(b);
						}
					}
				}

				// e.g. for picture elements with source.srcset
				if (!options.get_img_src) {
					options.get_img_src = get_img_src;
				}

				if (options.compare_urls) {
					options.compare_els = function(a, b) {
						if (!a || !b)
							return false;

						return options.compare_urls(options.get_img_src(a), options.get_img_src(b));
					};
				}
			}

			if (!options.compare_els) {
				console_error("compare_els/compare_urls/id_for_url not present");
				return false;
			}

			var thumbs_el = null;
			if (!options.thumbs_selector_global) {
				var current = el;
				while (current = current.parentElement) {
					thumbs_el = current.querySelector(options.thumbs_selector);
					if (thumbs_el)
						break;
				}
			} else {
				thumbs_el = document.querySelector(options.thumbs_selector);
			}

			if (!thumbs_el) {
				console_error("Unable to find thumbs element for", el);
				return false;
			}

			var thumbs = thumbs_el.querySelectorAll(options.thumb_selector);
			if (!thumbs) {
				console_error("No thumbs for", thumbs_el);
				return false;
			}

			var thumb = null;
			array_foreach(thumbs, function(thumb_el) {
				if (options.compare_els(el, thumb_el)) {
					thumb = thumb_el;
					return false;
				}
			});

			if (!thumb) {
				console_error("Unable to find thumb for", el, "in", thumbs_el);
				return false;
			}

			return get_next_in_gallery(thumb, nextprev);
		};


		if (host_domain_nosub === "imgur.com" && host_domain !== "i.imgur.com") {
			return {
				gallery: function(el, nextprev) {
					if (!el)
						return "default";

					var find_from_el = function() {
						if (options.host_url.match(/\/a\/+[^/]+\/+embed/)) {
							return "default";
						}

						var current = el;
						while ((current = current.parentElement)) {
							if (current.tagName === "DIV" &&
								current.classList && current.classList.contains("post-image-container")) {
								while (current) {
									var next = current.nextElementSibling;
									if (!nextprev)
										next = current.previousElementSibling;

									current = next;
									if (!current)
										return "default";

									var img = current.querySelector("img");
									if (img) {
										return img;
									}
								}
							}
						}

						return "default";
					};

					// "default" isn't used here because it's only used as find_from_api ||
					var find_from_api = function(images) {
						var big = bigimage_recursive(el.src, {
							fill_object: true,
							use_cache: false,
							rule_specific: {imgur_source: false}
						});

						var current_hash = big[0].url.replace(/.*\/([^/._]+?)(?:_[^/]+)?\.[^/.]*?(?:[?#].*)?$/, "$1");
						if (current_hash !== el.src) {
							for (var i = 0; i < images.length; i++) {
								if (images[i].hash === current_hash) {
									var image_id;
									if (nextprev) {
										if (i + 1 >= images.length)
											return null;

										image_id = i + 1;
									} else {
										if (i - 1 < 0)
											return null;

										image_id = i - 1;
									}

									var ext = images[image_id].ext;
									if (options.exclude_videos && (ext === ".mp4" || ext === ".webm"))
										ext = ".jpg";

									var newel = document_createElement("img");
									newel.src = "https://i.imgur.com/" + images[image_id].hash + ext;
									return newel;
								}
							}
						}

						return null;
					};

					var find_from_both = function(images) {
						return find_from_api(images) || find_from_el();
					};

					if (!options.window.runSlots && options.do_request) {
						common_functions["fetch_imgur_webpage"](options.do_request, real_api_cache, void 0, options.host_url, function(data) {
							if (!data || !data.imageinfo || data.bad) {
								return options.cb(find_from_el());
							}

							try {
								return options.cb(find_from_both(data.imageinfo.album_images.images));
							} catch (e) {
								console_error(e);
								return options.cb(find_from_el());
							}
						});

						return "waiting";
					} else {
						try {
							return find_from_both(options.window.runSlots.item.album_images.images);
						} catch (e) {
							console_error(e);
							return find_from_el();
						}
					}
				}
			};
		}

		if (host_domain_nosub === "instagram.com") {
			return {
				// FIXME: is this even needed anymore?
				element_ok: function(el) {
					// TODO: improve
					if (el.tagName === "VIDEO") {
						return true;
					}

					return "default";
				},
				gallery: function(el, nextprev) {
					// disabling this section entirely due to https://github.com/qsniyg/maxurl/issues/726
					// it should be redundant with album_info
					if (!el || true)
						return "default";

					var query_el = el;
					if (!el.parentElement) { // check if it's a fake element returned by this function
						query_el = options.element;
					}

					var info = common_functions["instagram_find_el_info"](document, query_el, options.host_url);
					var can_apply = false;
					var use_default_after = false;
					for (var i = 0; i < info.length; i++) {
						if ((info[i].type === "post" && (info[i].subtype === "popup" || info[i].subtype === "page" || info[i].subtype === "home" || (info[i].subtype === "link" && options.rule_specific.instagram_gallery_postlink && !options.is_counting))) ||
							 info[i].type === "story") {
							info[i].all = true;
							can_apply = true;

							if (info[i].type === "post" && info[i].subtype === "link")
								use_default_after = true;
						}
					}

					if (can_apply) {
						var imageid_el = common_functions["instagram_get_el_for_imageid"](el);
						var imageid_el_src = common_functions["instagram_get_image_src_from_el"](imageid_el);
						var our_imageid = common_functions["instagram_get_imageid"](imageid_el_src);
						var add = nextprev ? 1 : -1;
						common_functions["instagram_parse_el_info"](real_api_cache, options.do_request, options.rule_specific.instagram_use_app_api, options.rule_specific.instagram_dont_use_web, options.rule_specific.instagram_prefer_video_quality, info, options.host_url, function(data) {
							if (!data) {
								return options.cb("default");
							}

							for (var i = nextprev ? 0 : 1; i < data.length - (nextprev ? 1 : 0); i++) {
								var current_imageid = common_functions["instagram_get_imageid"](data[i].src);
								var current_videoid = "null";
								if (data[i].video) {
									current_videoid = common_functions["instagram_get_imageid"](data[i].video);
								}

								if (our_imageid === current_imageid || our_imageid === current_videoid) {
									var our_data = data[i + add];

									var cb_media = new_media(our_data.video || our_data.src, our_data.video);
									cb_media.setAttribute("data-imu-info", JSON_stringify(deepcopy(info, {json: true})));
									cb_media.setAttribute("data-imu-data", JSON_stringify(deepcopy(our_data, {json: true})));

									return options.cb(cb_media);
								}
							}

							if (!use_default_after)
								return options.cb(null);
							else
								return options.cb(get_next_in_gallery(options.element, nextprev));
						});

						return "waiting";
					}

					return "default";
				}
			};
		}

		if (host_domain_nosub === "tiktok.com") {
			return {
				gallery: function(el, nextprev) {
					if (el.tagName === "VIDEO" && el.parentElement && el.parentElement.parentElement) {
						if (el.parentElement.classList.contains("video-card") &&
							el.parentElement.parentElement.classList.contains("image-card")) {
							return get_next_in_gallery(el.parentElement.parentElement, nextprev);
						}
					}

					return "default";
				}
			};
		}

		if (host_domain_nowww === "twitter.com" ||
			host_domain_nowww === "x.com") {
			return {
				gallery: function(el, nextprev) {
					var is_photo_a = function(el) {
						return el.tagName === "A" && el.href && /\/status\/+[0-9]+\/+photo\/+/.test(el.href);
					};

					var get_img_from_photo_a = function(el) {
						var imgel = el.querySelector("img");
						if (imgel) {
							// don't return the <img> element because opacity: 0
							var prev = imgel.previousElementSibling;
							if (prev && prev.tagName === "DIV" && prev.style.backgroundImage)
								return prev;
						}

						return imgel;
					}

					var get_nextprev = function(el) {
						if (nextprev) {
							return el.nextElementSibling;
						} else {
							return el.previousElementSibling;
						}
					};

					var get_photoel_from_photo_container = function(nextel) {
						if (nextel.tagName === "A") {
							return get_img_from_photo_a(nextel);
						} else if (nextel.tagName === "DIV") {
							var childid = nextprev ? 0 : (nextel.children.length - 1);

							if (nextel.children.length > 0 && is_photo_a(nextel.children[childid])) {
								return get_img_from_photo_a(nextel.children[childid]);
							}
						} else {
							return "default";
						}
					};

					// tweet albums: https://twitter.com/phoronix/status/1229117085432926209
					var current = el;
					while ((current = current.parentElement)) {
						if (is_photo_a(current)) {
							var nextel = get_nextprev(current);

							if (nextel) {
								return get_photoel_from_photo_container(nextel);
							} else {
								var parent = current.parentElement;
								var sibling = get_nextprev(parent);

								if (sibling) {
									return get_photoel_from_photo_container(sibling);
								}
							}

							return null;
						}
					}

					return "default";
				},
				element_ok: function(el) {
					//var tweet = common_functions["get_twitter_video_tweet"](el, window);
					if (el.tagName === "VIDEO") {
						var tweet = common_functions["get_twitter_tweet_link"](el);
						if (tweet) {
							return true;
						}
					}

					return "default";
				}
			};
		}

		if (host_domain_nowww === "500px.com") {
			return {
				element_ok: function(el) {
					if (el.tagName === "A" && el.classList.contains("photo_link") && el.querySelector("div.nsfw_placeholder_content")) {
						return true;
					}

					return "default";
				}
			};
		}

		if (host_domain_nosub === "snapchat.com") {
			return {
				gallery: function(el, nextprev) {
					// useless because get_snapchat_info_from_el does this check for us
					if (false && el.tagName !== "VIDEO" && el.tagName !== "IMG")
						return "default";

					var info = common_functions["get_snapchat_info_from_el"](el);
					if (info) {
						common_functions["get_snapchat_storysharing"](real_api_cache, options.do_request, info.username, function(data) {
							if (!data) {
								return options.cb(null);
							}

							if (!("pos" in info) || info.pos === -1) {
								for (var i = 0; i < data.snaps.length; i++) {
									if (data.snaps[i].media.mediaUrl === info.url) {
										info.pos = i;
										break;
									}
								}
							}

							// mirroring to get_obj_from_snap_info
							if (info.pos === -1) {
								info.pos = data.snaps.length - 1;
							}

							if (!("pos" in info)) {
								return options.cb(null);
							}

							var diff = nextprev ? 1 : -1;
							var newpos = info.pos + diff;

							if (newpos < 0 || newpos >= data.snaps.length)
								return options.cb(null);

							var url = data.snaps[newpos].media.mediaUrl;
							var mediael = new_media(url, /\.mp4(?:[?#].*)?$/.test(url) && false);
							mediael.setAttribute("data-username", info.username);
							mediael.setAttribute("data-pos", newpos);
							mediael.setAttribute("data-url", url);
							mediael.setAttribute("data-imu", "true");

							return options.cb(mediael);
						});

						return "waiting";
					}

					return "default";
				},
				element_ok: function(el) {
					if (el.tagName === "VIDEO") {
						return true;
					}

					if (el.tagName === "DIV" && el.children.length === 1 && el.children[0].tagName === "VIDEO") {
						// to fix the pointer-events: none issue (thanks to remlap on discord for reporting)
						return el.children[0];
					}

					return "default";
				}
			};
		}

		if (host_domain_nosub === "allmusic.com") {
			return {
				gallery: function(el, nextprev) {
					// thanks to nimuxoha on github: https://github.com/qsniyg/maxurl/issues/279
					// https://www.allmusic.com/album/release/mr0002329530
					// https://www.allmusic.com/album/release/mr0002781134 -- no gallery
					// https://www.allmusic.com/album/release/mr0000570239
					// https://www.allmusic.com/album/release/mr0001144566 -- no gallery

					if (el.tagName !== "IMG" || !el.parentElement)
						return "default";

					if (!el.classList.contains("gallery-main-image"))
						return "default";

					var carousel_img = el.parentElement.querySelector("#carousel > ul > li.thumb-img > img.highlight-on");
					if (!carousel_img) {
						console_warn("Unable to find carousel thumbnail image");
						return "default";
					}

					var valid_or_null = function(el) {
						if (!el.classList.contains("thumb-img"))
							return null;
						return el.querySelector("img");
					}

					var li = carousel_img.parentElement;
					if (nextprev) {
						return valid_or_null(li.nextElementSibling);
					} else {
						return valid_or_null(li.previousElementSibling);
					}
				}
			};
		}

		if (host_domain_nosub === "flickr.com") {
			return {
				element_ok: function(el) {
					if (el.tagName === "DIV" && el.classList.contains("photo-well-media-scrappy-view")) {
						return true;
					}

					var current = el;
					while ((current = current.parentElement)) {
						if (current.tagName === "DIV" && current.classList.contains("restricted-interstitial")) {
							return true;
						}
					}

					return "default";
				}
			};
		}

		if (host_domain_nosub === "modelmayhem.com") {
			return {
				element_ok: function(el) {
					var current = el;
					while ((current = current.parentElement)) {
						// https://www.modelmayhem.com/portfolio/pic/45372959
						if (current.tagName === "DIV" && current.id === "viewpic") {
							return true;
						}
					}

					return "default";
				}
			};
		}

		if (host_domain_nowww === "imagefap.com" && /\/photo\/+[0-9]+\//.test(options.host_url)) {
			return {
				gallery: function(el, nextprev) {
					if (el.tagName !== "IMG" || !options.do_request)
						return "default";

					var is_navigation = false;
					var current = el.parentElement;
					if (!current && el.hasAttribute("data-imu-imagefap-album")) {
						is_navigation = true;
					} else {
						while ((current = current.parentElement)) {
							if ((current.tagName === "DIV" && current.id === "navigation") ||
								// main image
								current.tagName === "DIV" && current.classList.contains("image-wrapper")) {
								is_navigation = true;
								break;
							}
						}
					}

					if (!is_navigation)
						return "default";

					var query_imagefap_album = function(id, cb) {
						var cache_key = "imagefap_album:" + id;

						real_api_cache.fetch(cache_key, cb, function(done) {
							options.do_request({
								url: "https://www.imagefap.com/photo/" + id + "/",
								method: "GET",
								onload: function(resp) {
									if (resp.status !== 200) {
										console_error(cache_key, resp);
										return done(null, false);
									}

									var matches = match_all(resp.responseText, /<li>\s*<a href=\"https:\/\/[^/.]+\.imagefap\.com\/+images\/[^"]+".*?>\s*<img border=0 src2="(https:\/\/[^/.]+\.imagefap\.com\/[^"]+)"/);
									if (!matches) {
										console_warn(cache_key, "Unable to find album matches for", resp);
										return done(null, false);
									}

									var albumentries = [];
									array_foreach(matches, function(match) {
										albumentries.push(decode_entities(match[1]));
									});

									return done(albumentries, 60*60);
								}
							});
						});
					};

					var get_imagefap_photo_id = function(url) {
						var id = url.replace(/.*\/images\/+.*\/([0-9]+)\.[^/.]+(?:[?#].*)?$/, "$1");
						if (id !== url)
							return id;

						return null;
					};

					var our_photo_id = get_imagefap_photo_id(el.src);
					if (!our_photo_id)
						return "default";

					var our_album_id = options.host_url.match(/\/photo\/+([0-9]+)\//);
					our_album_id = our_album_id[1];

					query_imagefap_album(our_album_id, function(data) {
						if (!data) {
							return options.cb("default");
						}

						for (var i = 0; i < data.length; i++) {
							var data_id = get_imagefap_photo_id(data[i]);

							if (our_photo_id === data_id) {
								var nexti = i + (nextprev ? 1 : -1);
								if (nexti < 0 || nexti >= data.length) {
									return options.cb(null);
								} else {
									var our_el = new_image(data[nexti]);
									our_el.setAttribute("data-imu-imagefap-album", "true");
									return options.cb(our_el);
								}
							}
						}

						return options.cb("default");
					});

					return "waiting";
				}
			};
		}

		if (host_domain_nowww === "gog.com") {
			// https://www.gog.com/game/virtuaverse
			return {
				gallery: function(el, nextprev) {
					var current = el;

					while ((current = current.parentElement)) {
						if (current.tagName === "DIV" && current.classList.contains("productcard-thumbnails-slider__slide-item")) {
							var next_container = get_nextprev_el(current, nextprev);
							if (!next_container) {
								if (!current.parentElement.classList.contains("productcard-thumbnails-slider__slide")) {
									return null;
								}

								next_container = get_nextprev_el(current.parentElement, nextprev);
								if (!next_container)
									return null;

								if (!nextprev) {
									next_container = next_container.children[next_container.children.length - 1];
								} else {
									next_container = next_container.children[0];
								}

								if (!next_container)
									return null;
							}

							return next_container.querySelector("picture, img");
						}
					}

					return "default";
				}
			};
		}

		if (host_domain_nosub === "booth.pm") {
			return {
				element_ok: function(el) {
					// https://hawawa-temple.booth.pm/
					// thumbnails on https://hawawa-temple.booth.pm/items/1219489
					if (el.tagName === "DIV" && (el.classList.contains("swap-image") || el.classList.contains("thumb")) && el.children.length > 0 && el.children[0].tagName === "IMG") {
						return el.children[0];
					}

					return "default";
				}
			};
		}

		// no longer necessary due to blob being supported
		if (false && (common_functions["is_pinterest_domain"](host_domain) ||
			common_functions["multidomain__nitter"](host_domain, host_domain_nowww) ||
			host_domain_nowww === "nrk.no" ||
			host_domain_nowww === "local12.com" ||
			host_domain_nowww === "dailymotion.com" ||
			host_domain_nowww === "ok.ru")) {
			return {
				element_ok: function(el) {
					if (el.tagName === "VIDEO")
						return true;
				}
			};
		}

		if (host_domain_nosub === "instyle.com") {
			// thanks to remlap on discord for reporting: https://www.instyle.com/celebrity/zendaya-september-2020-cover
			return {
				element_ok: function(el) {
					if (el.tagName === "DIV" && el.classList.contains("lazy-image"))
						return el.querySelector(".image-overlay > img");
				}
			};
		}

		if (host_domain_nosub === "asiansister.com") {
			// thanks to Urkchar on discord for reporting
			return {
				element_ok: function(el) {
					if (el.tagName === "DIV" && el.id === "myModal") {
						return el.querySelector("img.modalTest-content");
					}
				}
			};
		}

		if (host_domain_nosub === "naver.com" && /\/viewer\/+postView\.nhn\?/.test(options.host_url)) {
			// thanks to Urkchar on discord for reporting
			return {
				gallery: function(el, nextprev) {
					var current = el;

					if (current.tagName === "IMG" && current.classList.contains("se_mediaImage")) {
						while ((current = current.parentElement)) {
							if (current.tagName === "DIV" && current.classList.contains("sect_dsc")) {
								var all_els = current.querySelectorAll("img.se_mediaImage");

								var nextprev_el = get_nextprev_from_list(el, all_els, nextprev);
								if (nextprev_el !== null) {
									return nextprev_el || null;
								}
							}
						}
					}

					return "default";
				}
			};
		}

		if (host_domain_nosub === "fetlife.com") {
			return {
				element_ok: function(el) {
					// a = profile link (image)
					if (el.tagName === "DIV" || el.tagName === "A") {
						for (var i = 0; i < el.children.length; i++) {
							var child = el.children[i];
							// .fl-disable-interaction is used for the profile pic when on the profile
							if (child.tagName === "IMG" && (child.classList.contains("ipp") || child.classList.contains("fl-disable-interaction"))) {
								return el.children[i];
							}
						}
					}
				}
			};
		}

		if (host_domain_nosub === "youtube.com") {
			return {
				element_ok: function(el) {
					// thanks to ambler on discord for reporting
					if (el.tagName === "DIV" && el.id === "background") {
						var newel = el.querySelector("div#backgroundFrontLayer");
						if (newel)
							return newel;
					}
				}
			};
		}

		if (host_domain_nowww === "ray-web.jp") {
			return {
				element_ok: function(el) {
					if (!el.children)
						return;

					var imgchild = null;
					array_foreach(el.children, function(child) {
						// all imgs are pointer-events: none
						if (child.tagName === "IMG") {
							imgchild = child;
							return false;
						}
					});

					if (imgchild)
						return imgchild;
				}
			};
		}

		if (host_domain_nowww === "klix.ba") {
			return {
				gallery: function(el, nextprev) {
					// thanks to AdClear247 on github for reporting: https://github.com/qsniyg/maxurl/issues/732
					var next_el = get_nextprev_from_thumbs(el, nextprev, {
						id_for_url: /.*\/([0-9]+\.[0-9]+)(?:_[^/.]+)?\.[a-z]+(?:[?#].*)?$/i,
						thumbs_selector: "div.galleria-thumbnails",
						thumb_selector: ".galleria-image > img"
					});
					return next_el !== false ? next_el : "default";
				}
			};
		}

		if (host_domain_nowww === "olx.ba") {
			return {
				gallery: function(el, nextprev) {
					// thanks to AdClear247 on github for reporting: https://github.com/qsniyg/maxurl/issues/732
					var next_el = get_nextprev_from_thumbs(el, nextprev, {
						id_for_url: /.*\/slika-([0-9]+-[0-9a-f]{5,})-[a-z]+\./i,
						thumbs_selector: "#fancybox-thumbs",
						thumbs_selector_global: true,
						thumb_selector: "li > a > img"
					});
					return next_el !== false ? next_el : "default";
				}
			};
		}

		if (host_domain_nowww === "asics.com") {
			return {
				gallery: function(el, nextprev) {
					var get_source_src = function(el) {
						if (el.tagName === "PICTURE") {
							var sourceel = el.querySelector("source");
							if (sourceel)
								return get_source_src(sourceel);
						} else if (el.tagName === "SOURCE") {
							return el.srcset;
						}

						return get_img_src(el);
					};

					// thanks to MinuteAd8502 on github for reporting: https://github.com/qsniyg/maxurl/issues/790
					var next_el = get_nextprev_from_thumbs(el, nextprev, {
						id_for_url: /.*\/is\/+image\/+asics\/+([^/.?#]+)(?:\.[^/]+?)?(?:[?#].*)?$/,
						get_img_src: get_source_src,
						thumbs_selector: "#thumbnails > ul div.slick-track",
						thumbs_selector_global: true,
						thumb_selector: "li.thumb > a > picture"
					});
					return next_el !== false ? next_el : "default";
				}
			};
		}

		if (host_domain_nowww === "bcy.net") {
			return {
				gallery: function(el, nextprev) {
					if (!el || el.tagName !== "IMG") {
						return "default";
					}

					// thanks to contextnerror on github for reporting: https://github.com/qsniyg/maxurl/issues/972
					// post page: https://bcy.net/item/detail/7021519360804002846?_source_page=
					// 10 images: https://bcy.net/item/detail/7042569063217765412?_source_page=

					var get_postpage_gallery = function() {
						return get_nextprev_from_tree(el, nextprev,
								[
									{tagName: "IMG"},
									{tagName: "DIV", classList: ["img-wrap-inner"]},
									{tagName: "DIV", classList: ["img-wrap"]},
									{tagName: "DIV", classList: ["inner-container"]}
								],
								".inner-container > .img-wrap > .img-wrap-inner > img");
					};

					var get_profilepage_gallery = function() {
						return get_nextprev_from_list(el, document.querySelectorAll("li.li_item_box a.img_box img"), nextprev);
					};

					var value = get_postpage_gallery();
					if (value !== "default")
						return value;
					value = get_profilepage_gallery();
					if (value !== "default")
						return value;

					return "default";
				}
			};
		}

		if (host_domain_nowww === "sfmoma.org") {
			return {
				element_ok: function(el) {
					if (el.tagName === "CANVAS")
						return true;
				}
			}
		}

		if (host_domain_nowww === "behance.net") {
			return {
				element_replace: function(el) {
					if (el.matches("span.grid__item-filler") && el.previousElementSibling) {
						let prev = el.previousElementSibling;
						if (prev.matches("img.grid__item-image")) {
							return prev;
						}
					}
				}
			}
		}

		if (host_domain_nowww === "alamy.com") {
			return {
				element_ok: function(el) {
					if (el.tagName.toUpperCase() === "SVG")
						return true;
				}
			}
		}

		if (host_domain_nosub === "reddit.com") {
			return {
				gallery: function(el, nextprev) {
					if (el.tagName.toUpperCase() === "A" && el.parentElement &&
					el.parentElement.tagName.toUpperCase() === "P" && el.parentElement.classList.contains("title")) {
						return get_nextprev_from_tree(el, nextprev,
							[
								{tagName: "A"},
								{tagName: "P", classList: ["p.title"]},
								{tagName: "DIV", classList: ["top-matter"]},
								{tagName: "DIV", classList: ["entry"]},
								{tagName: "DIV", classList: ["thing"]},
							],
							".thing > .entry > .top-matter > p.title > a");
					}
				}
			}
		}

		if (host_domain_nowww === "gofile.io") {
			return {
				element_ok: function(el) {
					// FIXME: this disregards the mouseover_links setting
					if (el.tagName.toUpperCase() === "A" && el.classList.contains("contentLink"))
						return true;
				},
				gallery: function(el, nextprev) {
					if (el.tagName.toUpperCase() === "A" && el.classList.contains("contentLink")) {
						return get_nextprev_from_tree(el, nextprev,
							[
								{tagName: "A", attrs: {class: el.getAttribute("class")}},
								{tagName: "DIV"},
								{tagName: "DIV", classList: ["contentId"]}
							],
							".contentId > div > a[class=\"" + el.getAttribute("class") + "\"]");
					}
				}
			}
		}

		if (host_domain_nosub === "cnn.com") {
			return {
				element_ok: function(el) {
					if (el.tagName.toUpperCase() === "BUTTON" && (
						el.classList.contains("gallery-inline__next-overlay") ||
						el.classList.contains("gallery-inline__prev-overlay")
					)) {
						let parent = el.parentElement;
						if (parent.classList.contains("gallery-inline__container")) {
							let slides = parent.querySelector(".gallery-inline__slides");
							return {
								el: slides,
								search: true
							};
						}
					}
				}
			}
		}

		// myportfolio
		if (host_domain_nowww === "kalyanyasaswi.com") {
			// thanks to anonymous for reporting:
			return {
				element_ok: function(el) {
					if (el.tagName.toUpperCase() === "SPAN" && el.classList.contains("grid__item-filler")) {
						let prev = el.previousElementSibling;
						if (prev && prev.tagName.toUpperCase() === "IMG" && prev.classList.contains("grid__item-image"))
							return prev;
					}
				}
			}
		}

		if (host_domain === "open.spotify.com") {
			// thanks to anonymous for reporting:
			// public lists on spotify user profiles
			return {
				element_ok: function(el) {
					if (el.getAttribute("data-testid") === "card-click-handler") {
						let prev = el.previousElementSibling;
						if (prev)
							prev = prev.previousElementSibling;
						if (prev && prev.tagName === "DIV") {
							return {
								el: prev,
								search: true
							};
						}
					}
				}
			}
		}

		return null;
	};

	var _get_album_info_gallery = function(album_info, el, nextprev) {
		if (album_info.type === "links") {
			var current_link_id = -1;

			array_foreach(album_info.links, function(link, i) {
				if (link.is_current) {
					current_link_id = i;
					return false;
				}
			});

			// unable to find current link
			if (current_link_id < 0)
				return null;

			for (var i = 0; i < album_info.links.length; i++) {
				delete album_info.links[i].is_current;
			}

			current_link_id += nextprev ? 1 : -1;
			if (current_link_id < 0 || current_link_id >= album_info.links.length)
				return false; // or null if we want to be able to move past the current gallery

			album_info.links[current_link_id].is_current = true;

			return album_info.links[current_link_id].url;
		}

		// unsupported type
		return null;
	};

	var get_album_info_gallery = function(popup_obj, el, nextprev) {
		var album_info;

		if (popup_obj)
			album_info = popup_obj.album_info;

		if (el) {
			var album_info_json = el.getAttribute("imu-album-info");
			if (album_info_json) {
				try {
					album_info = JSON_parse(album_info_json);
				} catch (e) {
					console_error(e);
				}
			}
		}

		if (!album_info)
			return null;

		album_info = deepcopy(album_info);
		var result = _get_album_info_gallery(album_info, el, nextprev);
		if (!result)
			return result;

		if (typeof result === "string") {
			var url = result;

			result = document_createElement("img");
			// don't set src, because otherwise the browser will try to load it
			result.setAttribute("data-imu-fake-src", url);
		}

		if (!result.hasAttribute("imu-album-info")) {
			// album_info can be modified by _get_album_info_gallery, so we must re-stringify it
			result.setAttribute("imu-album-info", JSON_stringify(album_info));
		}

		return result;
	};

	var get_next_in_gallery = null;

	var fullurl_obj = function(currenturl, obj) {
		if (!obj)
			return obj;

		if (!is_array(obj)) {
			obj = [obj];
		}

		var newobj = [];
		array_foreach(obj, function(url) {
			if (typeof(url) === "string") {
				newobj.push(fullurl(currenturl, url));
			} else {
				if (url.url) {
					if (is_array(url.url)) {
						for (var i = 0; i < url.url.length; i++) {
							url.url[i] = fullurl(currenturl, url.url[i]);
						}
					} else {
						url.url = fullurl(currenturl, url.url);
					}
				}
				newobj.push(url);
			}
		});

		return newobj;
	};

	var same_url = function(url, obj) {
		obj = fillobj(obj);

		if (obj[0] && obj[0].url === url)
			return true;

		return false;
	};

	var remove_webarchive_proxy = function(url) {
		return url.replace(/^[a-z]+:\/\/[^/]+\/+web\/+[0-9*]+\/+(https?:\/\/)/, "$1");
	};

	var get_bigimage_extoptions_first = function(options) {
		var our_settings = [
			"allow_thirdparty",
			"allow_apicalls",
			"allow_thirdparty_libs",
			"allow_thirdparty_code",
			{
				our: "process_format",
				settings: "process_format",
				obj: true
			}
		];

		for (var i = 0; i < our_settings.length; i++) {
			var our_setting_obj = our_settings[i];

			var our_setting;
			var settings_setting;
			var is_obj = false;
			if (typeof our_setting_obj === "string") {
				our_setting = our_setting_obj;
				settings_setting = our_setting;
			} else {
				our_setting = our_setting_obj.our;
				settings_setting = our_setting_obj.settings;
				is_obj = !!our_setting_obj.obj;
			}

			if (!is_obj) {
				if (!(our_setting in options)) {
					options[our_setting] = (settings[settings_setting] + "") === "true";
				}
			} else {
				if (!(our_setting in options)) {
					options[our_setting] = {};
				}

				obj_foreach(settings[settings_setting], function(key, value) {
					if (!(key in options[our_setting])) {
						options[our_setting][key] = value;
					}
				});
			}
		}

		return options;
	};

	var get_bigimage_extoptions = function(options) {
		if ("exclude_problems" in options) {
			for (var option in settings) {
				if (option in option_to_problems) {
					var problem = option_to_problems[option];
					var index = array_indexof(options.exclude_problems, problem);

					if (settings[option]) {
						if (index >= 0)
							options.exclude_problems.splice(index, 1);
					} else {
						if (index < 0)
							options.exclude_problems.push(problem);
					}
				}
			}
		}

		if (!options.allow_apicalls) {
			options.do_request = null;
		}

		if ("rule_specific" in options) {
			var rule_specific_map = {
				"deviantart_prefer_size": true,
				"deviantart_support_download": true,
				"ehentai_full_image": true,
				"imgur_filename": true,
				"imgur_source": true,
				"instagram_use_app_api": true,
				"instagram_dont_use_web": true,
				"instagram_prefer_video_quality": true,
				"instagram_gallery_postlink": true,
				"snapchat_orig_media": true,
				teddit_redirect_reddit: true,
				"tiktok_app_api": true,
				"tiktok_no_watermarks": true,
				"tiktok_thirdparty": true,
				"tumblr_api_key": true,
				"twitter_use_ext": true,
				"youtube_replace_n": true,
				"mouseover_linked_image": "linked_image"
			};

			for (var rule_specific in rule_specific_map) {
				var rule_specific_value = rule_specific_map[rule_specific];

				if (rule_specific_value === true) {
					rule_specific_value = rule_specific;
				}

				options.rule_specific[rule_specific_value] = settings[rule_specific];
			}
		}

		// Doing this here breaks things like Imgur, which will redirect to an image if a video was opened in a new tab
		if (false && !settings.allow_video) {
			options.exclude_videos = true;
		} else {
			options.exclude_videos = false;
		}

		if (settings.allow_webarchive) {
			if (options.host_url) {
				options.host_url = remove_webarchive_proxy(options.host_url);
			}
		}

		return options;
	};

	var bigimage_recursive = function(url, options?:BigImageOptions) {
		// breaks element_ok on elements without sources
		if (false && !url)
			return url;

		if (!options)
			options = {};

		if (is_userscript || is_extension) {
			get_bigimage_extoptions_first(options);
		}

		for (var option in bigimage_recursive.default_options) {
			if (!(option in options)) {
				options[option] = deepcopy(bigimage_recursive.default_options[option]);
				continue;
			}

			if (is_iterable_object(options[option])) {
				for (var rsoption in bigimage_recursive.default_options[option]) {
					if (!(rsoption in options[option])) {
						options[option][rsoption] = deepcopy(bigimage_recursive.default_options[option][rsoption]);
					}
				}
			}
		}

		if (is_userscript || is_extension) {
			get_bigimage_extoptions(options);

			if (settings.allow_webarchive && typeof url === "string") {
				url = remove_webarchive_proxy(url);
			}
		}

		var waiting = false;
		var forcerecurse = false;

		var url_is_data = false;
		var origurl = url;
		if (typeof url === "string" && /^(?:data|blob):/.test(url)) {
			url_is_data = true;
		}

		var newhref = url;
		var endhref;
		var currenthref = url;
		var pasthrefs = [url];
		//var lastobj = fillobj(newhref);
		//var lastobj = newhref;
		var pastobjs = [];
		var currentobj = null;
		var used_cache = false;
		var loop_i = 0;

		// for tests
		var our_bigimage = options._internal_bigimage || bigimage;

		var do_cache = function() {
			nir_debug("bigimage_recursive", "do_cache (endhref, currentobj):", deepcopy(endhref), deepcopy(currentobj));

			if (!endhref)
				return;

			if (!get_currenthref(endhref))
				return;

			var cache_endhref = fillobj(endhref, currentobj);

			if (!cache_endhref || !cache_endhref.can_cache) {
				nir_debug("bigimage_recursive", "do_cache: skipping cache because cache_endhref.can_cache == false");
				return;
			}

			currenthref = get_currenthref(cache_endhref);
			if (!currenthref)
				return;

			if (!used_cache && (options.use_cache === true) && !waiting) {
				for (var i = 0; i < pasthrefs.length; i++) {
					var href = pasthrefs[i];

					if (href) {
						nir_debug("bigimage_recursive", "do_cache:", href, "=", deepcopy(cache_endhref));

						url_cache.set(href, deepcopy(cache_endhref), options.urlcache_time);
					}
				}
			}
		};

		var get_currenthref = function(objified) {
			if (!objified) {
				return objified;
			}

			if (is_array(objified)) {
				objified = objified[0];
			}

			if (!objified) {
				return objified;
			}

			if (is_array(objified.url))
				currenthref = objified.url[0];
			else
				currenthref = objified.url;
			return currenthref;
		};

		var prop_in_objified = function(prop, objified) {
			if (!is_array(objified)) {
				objified = [objified];
			}

			var found_prop = false;
			array_foreach(objified, function(obj) {
				if (typeof obj !== "object") return;

				if (prop in obj) {
					found_prop = true;
					return false;
				}
			});

			return found_prop;
		}

		var parse_bigimage = function(big) {
			nir_debug("bigimage_recursive", "parse_bigimage (big)", deepcopy(big));

			if (!big) {
				if (newhref === url && options.null_if_no_change)
					newhref = big;
				return false;
			}

			var newhref1 = fullurl_obj(currenthref, big);
			nir_debug("bigimage_recursive", "parse_bigimage (newhref1)", deepcopy(newhref1));

			if (!newhref1) {
				return false;
			}

			var copy_props = ["extra", "album_info"];

			// Copy important old properties
			var important_properties = {};
			if (pastobjs.length > 0) {
				if (pastobjs[0].likely_broken)
					important_properties.likely_broken = pastobjs[0].likely_broken;
				if (pastobjs[0].fake)
					important_properties.fake = pastobjs[0].fake;

				array_foreach(copy_props, function(prop) {
					//console_log(prop, deepcopy(pastobjs[0]));
					if (prop in pastobjs[0] && pastobjs[0][prop]) {
						important_properties[prop] = deepcopy(pastobjs[0][prop]);
					}
				});
			}

			var objified = fillobj(deepcopy(newhref1), important_properties);
			nir_debug("bigimage_recursive", "parse_bigimage (objified)", deepcopy(objified));

			for (var i = 0; i < objified.length; i++) {
				objified[i] = deepcopy(objified[i]); // ensure no references are kept between objects
				var obj = objified[i];

				var remove_obj = function() {
					nir_debug("bigimage_recursive", "parse_bigimage (removing obj)");
					objified.splice(i, 1);
					if (is_array(newhref1)) {
						newhref1.splice(i, 1);
					}

					i--;
				};

				// Remove null URLs
				if (obj.url === null && !obj.waiting) {
					remove_obj();
					continue;
				}

				if (obj.url === "" && url_is_data) {
					obj.url = origurl;
				}

				// Remove problems in exclude_problems
				for (var problem in obj.problems) {
					if (obj.problems[problem] &&
						array_indexof(options.exclude_problems, problem) >= 0) {
						nir_debug("bigimage_recursive", "Removing problematic:", obj.url, "because of", problem);
						remove_obj();
						continue;
					}
				}

				if (obj.url && options.filter && !options.filter(obj.url)) {
					console_log("Blacklisted:", obj.url);
					remove_obj();
					continue;
				}

				if (options.exclude_videos && obj.media_info.type === "video") {
					remove_obj();
					continue;
				}

				if (pastobjs[0]) {
					if (obj._copy_old_props) {
						for (var j = 0; j < obj._copy_old_props.length; j++) {
							var prop = obj._copy_old_props[j];
							obj[prop] = deepcopy(pastobjs[0][prop]);
						}
					}
				}
			}

			nir_debug("bigimage_recursive", "parse_bigimage (objified, processed)", deepcopy(objified));

			if (objified.length === 0) {
				nir_debug("bigimage_recursive", "parse_bigimage: objified.length == 0");
				return false;
			}

			waiting = false;
			forcerecurse = false;
			var temp_newhref1 = newhref1;
			if (is_array(newhref1))
				temp_newhref1 = newhref1[0];
			if (typeof(temp_newhref1) === "object") {
				currentobj = newhref1;
				if (temp_newhref1.waiting) {
					waiting = true;
					if (!temp_newhref1.url) {
						newhref = newhref1;
						return false;
					}
				}

				if (temp_newhref1.forcerecurse) {
					forcerecurse = true;
				}
			} else {
				currentobj = null;
			}

			// check if objified (our object) has the same url/href as the last url (currenthref)
			if (same_url(currenthref, objified) && !forcerecurse) {
				nir_debug("bigimage_recursive", "parse_bigimage: sameurl(currenthref, objified) == true (newhref, nh1, pastobjs)", deepcopy(currenthref), deepcopy(objified), deepcopy(newhref), deepcopy(newhref1), deepcopy(pastobjs));

				// FIXME: this is a terrible hack
				try {
					var cond = !options.fill_object || (newhref[0].waiting === true && !objified[0].waiting);
					if (cond) {
						newhref = objified;
					} else if (pastobjs.length) {
						// TODO: refactor
						var _apply = function(newobj) {
							array_foreach(basic_fillobj(newobj), function(sobj, i) {
								sobj = deepcopy(sobj);

								// FIXME? untested (url should resolve to the one right below it)
								if (!sobj.url) {
									sobj.url = currenthref;
								}

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

										break;
									}
								}
							});
						};

						_apply(newhref);
						// strikinglycdn needs newhref1 to be applied, because it has two rules, the cloudinary one, then the {url: src, can_head: false} one
						// the second one is only set in newhref1, not newhref
						_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];
					}

					if (false) {
						if (!cond) {
							array_foreach(copy_props, function(prop) {
								// using newhref1 instead of objified because otherwise it'll always be true (objified is the filled object, all props are in it)
								// the prop_in_objified check breaks facebook albums
								// [photo.php, post] -> [url+extra, photo.php] (album_info is missing because url is just a url, doesn't have album_info)
								//   but newhref = [url+extra, photo.php]
								//   we don't want to disregard newhref, as it contains new information (extra)
								//   newhref1 = [url]
								// but removing it breaks normal photos, e.g. mixdrop:
								// mp4(+headers) -> return src (.mp4 without headers)
								if (!(prop in newhref[0]) && (prop in important_properties) /*&& prop_in_objified(prop, newhref1)*/) {
									cond = true;
									return false;
								}
							});
						}

						if (cond)
							newhref = objified;
					}
				} catch (e) {}

				return false;
			} else {
				if (!forcerecurse) {
					for (var i = 0; i < pasthrefs.length; i++) {
						if (same_url(pasthrefs[i], objified)) {
							nir_debug("bigimage_recursive", "parse_bigimage: sameurl(pasthrefs[" + i + "], objified) == true", deepcopy(pasthrefs[i]), deepcopy(objified), deepcopy(newhref));

							// TODO: copy changes above here, or better yet, refactor
							//   copied over the newhref = objified code, hopefully this doesn't break anything
							//   this is needed for klix.ba when a largest _xxl.jpg is opened in a popup, reported here: https://github.com/qsniyg/maxurl/issues/732
							// FIXME: is this even correct?
							var cond = false;
							if (false && newhref && newhref.length) {
								array_foreach(copy_props, function(prop) {
									// using newhref1 instead of objified because otherwise it'll always be true? (objified is the filled object, all props are in it)
									if (!(typeof newhref[0] === "object" && (prop in newhref[0])) && (prop in important_properties) && prop_in_objified(prop, newhref1)) {
										cond = true;
										return false;
									}
								});
							}

							if (cond || true)
								newhref = objified;

							return false;
						}
					}
				}

				nir_debug("bigimage_recursive", "parse_bigimage: setting currenthref and newhref");
				currenthref = get_currenthref(objified);
				newhref = newhref1;
			}

			pasthrefs.push(currenthref);

			// Prepend objified to pastobjs
			var current_pastobjs = [];
			array_extend(current_pastobjs, objified);
			array_extend(current_pastobjs, pastobjs);

			pastobjs = current_pastobjs;

			if (false && !waiting) {
				// lastobj isn't used
				// commenting out because lastobj doesn't exist
				//lastobj = newhref;
			}

			if (objified[0].norecurse)
				return false;

			if (_nir_debug_ && _nir_debug_.no_recurse) {
				return false;
			}

			return true;
		};

		var do_bigimage = function() {
			nir_debug("bigimage_recursive", "do_bigimage", currenthref, deepcopy(options));

			if (options.use_cache && url_cache.has(currenthref) && !forcerecurse) {
				nir_debug("bigimage_recursive", "do_bigimage: newhref = url_cache[" + currenthref + "]", deepcopy(url_cache.get(currenthref)));

				newhref = url_cache.get(currenthref);
				used_cache = true;
				return false;
			}

			if (options.filter) {
				if (!options.filter(currenthref)) {
					console_log("Blacklisted: " + currenthref);
					return false;
				}
			}

			var big;

			if (options.catch_errors) {
				try {
					big = our_bigimage(currenthref, options);
				} catch(e) {
					console_error(e);
					console_error(e.stack);
				}
			} else {
				big = our_bigimage(currenthref, options);
			}

			return parse_bigimage(big);
		};

		var finalize = function() {
			if (options.fill_object) {
				nir_debug("bigimage_recursive", "finalize (fillobj(newhref, currentobj), pastobjs)", deepcopy(newhref), deepcopy(currentobj), deepcopy(pastobjs));

				// why the used_cache check? this breaks e.g. twitter api, where it returns multiple urls [orig, large, etc.] with extra, but the original one (from the twimg) rule doesn't have it
				// reason why is because fillobj will only look at the first entry from currentobj
				if (/*used_cache &&*/ newhref === null) {
					// for some reason, after the TS rewrite, currentobj is not an array. we need to basic_fillobj it
					endhref = basic_fillobj(deepcopy(currentobj));
				} else {
					// the reason for using fillobj(..., currentobj) is for objects that add to the last object (e.g. {url: src, head_wrong_contentlength: true})
					endhref = fillobj(deepcopy(newhref), currentobj);
				}

				if (options.include_pastobjs) {
					for (var i = 0; i < pastobjs.length; i++) {
						if (obj_indexOf(endhref, pastobjs[i].url) < 0 && !pastobjs[i].fake)
							endhref.push(deepcopy(pastobjs[i]));
					}
				}
			} else {
				nir_debug("bigimage_recursive", "finalize (newhref)", deepcopy(newhref));
				endhref = deepcopy(newhref);
			}

			nir_debug("bigimage_recursive", "endhref =", deepcopy(endhref));
		};

		var cb = null;
		if (options.cb) {
			var orig_cb = options.cb;
			options.cb = function(x) {
				// Is this needed?
				if (false) {
					for (var i = 0; i < pastobjs.length; i++) {
						if (pastobjs[i].url === null && pastobjs[i].waiting) {
							pastobjs.splice(i, 1);
							i--;
						}
					};
				}

				nir_debug("bigimage_recursive", "options.cb", deepcopy(x));

				var do_end = function() {
					nir_debug("bigimage_recursive", "do_end");

					finalize();
					do_cache();

					var blankurl = null;
					if (!options.null_if_no_change)
						blankurl = pasthrefs[pasthrefs.length - 1];

					if (!endhref || (is_array(endhref) && !endhref[0])) {
						endhref = blankurl;
					} else if (typeof endhref === "string") {
						endhref = blankurl;
					} else if (is_array(endhref) && typeof endhref[0] === "string") {
						endhref[0] = blankurl;
					} else if (is_array(endhref) && endhref[0] && !endhref[0].url) {
						endhref[0].url = blankurl;
					}

					// hacky workaround for https://github.com/qsniyg/maxurl/issues/583
					// fails with fill_object, but that option hasn't worked properly for a very long time anyways
					if (!is_array(endhref)) {
						endhref = [endhref];
					}

					nir_debug("bigimage_recursive", "do_end (endhref, pasthrefs, pastobjs)", deepcopy(endhref), deepcopy(pasthrefs), deepcopy(pastobjs));

					orig_cb(endhref);
				};

				var parseresult = parse_bigimage(x);
				if ((!parseresult || (loop_i + 1) >= options.iterations) && !forcerecurse) {
					do_end();
				} else {
					for (; loop_i < options.iterations; loop_i++) {
						if (!do_bigimage()) {
							break;
						}
					}

					if (!waiting) {
						do_end();
					}
				}
			};
		}

		options._internal_info = {};

		for (loop_i = 0; loop_i < options.iterations; loop_i++) {
			if (!do_bigimage())
				break;
		}

		nir_debug("bigimage_recursive", "return finalize");

		finalize();
		do_cache();

		newhref = null;

		if (options.cb && !waiting) {
			options.cb(endhref);
		}

		return deepcopy(endhref);
	};
	(bigimage_recursive as any).default_options = default_options;

	(bigimage_recursive as any).internal = {
		settings: settings,
		settings_meta: settings_meta,
		strings: strings
	};

	function is_internet_url(url) {
		if (!url || typeof url !== "string")
			return false;

		if (!/^https?:\/\//.test(url))
			return false;

		// local addresses (IPv4)
		if (/^[a-z]+:\/\/(127\.0\.0\.1|192\.168\.[0-9]+\.[0-9]+|10\.[0-9]+\.[0-9]+\.[0-9]+|172\.(?:1[6-9]|2[0-9]|3[01])\.[0-9]+\.[0-9]+|localhost|[^/.]+)\//.test(url))
			return false;

		// IPv6 (TODO: implement)
		if (/^[a-z]+:\/\/(?:[0-9a-f]*\:){1,}\//.test(url))
			return false;

		return true;
	}
	(bigimage_recursive as any).is_internet_url = is_internet_url;

	function clear_all_caches() {
		url_cache.clear();
		real_api_cache.clear();
		cookie_cache.clear();
	}
	(bigimage_recursive as any).clear_caches = clear_all_caches;

	// tests
	if (false) {
		var fake_bigimage = function(src, options) {
			var origsrc = src;
			var nodomain = src.replace(/^[a-z]+:\/\/[^/]+\/+/, "");

			if (nodomain === "test1") {
				return "out_test1"; // should return https://www.example.com/out_test1
			}

			if (options.null_if_no_change) {
				if (src !== origsrc)
					return src;
				return null;
			}
		};
	}

	var obj_to_simplelist = function(obj) {
		var out = [];
		for (var i = 0; i < obj.length; i++) {
			out.push(obj[i].url);
		}
		return out;
	};

	var obj_indexOf = function(obj, url) {
		return array_indexof(obj_to_simplelist(obj), url);
	};

	var obj_merge = function(newobj, oldobj) {
		var newobj_simple = obj_to_simplelist(newobj);

		for (var i = 0; i < oldobj.length; i++) {
			var index = array_indexof(newobj_simple, oldobj[i].url);
			if (index >= 0) {
				for (var key in oldobj[i]) {
					var old_value = oldobj[i][key];
					var new_value = newobj[index][key];

					// e.g. for headers, extra, etc.
					if (new_value !== old_value && JSON_stringify(new_value) === JSON_stringify(default_object[key])) {
						newobj[index][key]= old_value;
					}
				}

				continue;
			}
			newobj.push(oldobj[i]);
		}

		return newobj;
	}

	type BRLTriedUrl = {
		url: string,
		data: any,
		newurl: string,
		newobj: BigImageInfoObject,
		redirects_to_bad: boolean
	}
	type BRLFineUrl = {
		url: string,
		data: any
	}
	type BRLState = {
		fine_urls: Array<BRLFineUrl>,
		tried_urls: Array<BRLTriedUrl>,
		oldobj: Array<any>,
		tried_imus: Array<string>,
		redirect_map: Record<string, string>
	}
	var bigimage_recursive_loop = function(url, options, query, state?:BRLState) {
		var newoptions:any = {};

		if (!state) {
			state = {
				fine_urls: [],
				tried_urls: [],
				oldobj: [],
				tried_imus: [],
				redirect_map: {} // FIXME: is this needed?
			};
		}

		let fine_urls = state.fine_urls;
		let tried_urls = state.tried_urls;
		let oldobj = state.oldobj;

		let already_tried_url = false;
		let already_tried_nonbad_url = false;
		for (let tried_url of state.tried_imus) {
			if (tried_url === url) {
				already_tried_url = true;

				for (let t_url of state.tried_urls) {
					if (t_url.url !== tried_url)
						continue

					if (!t_url.redirects_to_bad) {
						already_tried_nonbad_url = true;
						break;
					}
				}
			}
		}
		state.tried_imus.push(url);

		for (var option in options) {
			if (option === "cb") {
				newoptions.cb = function(obj) {
					if (_nir_debug_) {
						console_log("bigimage_recursive_loop's cb: obj:", deepcopy(obj));
						console_log("bigimage_recursive_loop's cb: oldobj:", deepcopy(oldobj));
					}

					obj = obj_merge(obj, oldobj);
					var image_urls = obj_to_simplelist(obj);

					for (let i = 0; i < obj.length; i++) {
						// TODO: also remove bad_if
						if (obj[i].bad) {
							let bad_url = obj[i].url;

							obj.splice(i, 1);
							image_urls.splice(i, 1);
							i--;

							for (let j = 0; j < tried_urls.length; j++) {
								if (tried_urls[j].newurl === bad_url) {
									let orig_url = tried_urls[j].newobj.url;
									let index = array_indexof(image_urls, orig_url);
									tried_urls[j].redirects_to_bad = true;

									if (already_tried_nonbad_url && bad_url === url)
										already_tried_nonbad_url = false;

									if (index >= 0) {
										obj.splice(index, 1);
										image_urls.splice(index, 1);

										if (index < i)
											i -= 2;
										else if (index === i)
											i--;

										break;
									}
								}
							}
						}

						// FIXME: is this needed?
						if (false && obj[i].url in state.redirect_map) {
							let to = state.redirect_map[obj[i].url];
							let j;
							for (j = i + 1; j < obj.length; j++) {
								if (obj[j].url === to) {
									obj.splice(i, j - i);
									image_urls.splice(i, j - i);
									break;
								}
							}

							i -= 1;
						}
					}

					if (_nir_debug_) {
						console_log("bigimage_recursive_loop's cb: obj after:", deepcopy(obj));
						console_log("bigimage_recursive_loop's cb: image_urls after:", deepcopy(image_urls));
						console_log("bigimage_recursive_loop's cb: fine_urls:", deepcopy(fine_urls));
						console_log("bigimage_recursive_loop's cb: tried_urls:", deepcopy(tried_urls));
					}

					for (let i = 0; i < fine_urls.length; i++) {
						let index = array_indexof(image_urls, fine_urls[i].url);
						if (index >= 0) {
							obj = [obj[index]];
							if (_nir_debug_) {
								console_log("bigimage_recursive_loop's cb: returning fine_url", deepcopy(obj), deepcopy(fine_urls[i]));
							}
							return options.cb(obj, fine_urls[i].data);
						}
					}

					var try_any = false;
					for (let i = 0; i < tried_urls.length; i++) {
						if (tried_urls[i].url === url || try_any) {
							if (tried_urls[i].redirects_to_bad === true) {
								try_any = true;
								continue;
							}

							let index = array_indexof(image_urls, tried_urls[i].newurl);
							if (index >= 0) {
								obj = [obj[index]];
								if (_nir_debug_) {
									console_log("bigimage_recursive_loop's cb: returning tried_url", deepcopy(obj), deepcopy(tried_urls[i]), try_any);
								}
								return options.cb(obj, tried_urls[i].data);
							} else {
								if (_nir_debug_) {
									console_log("bigimage_recursive_loop's cb: returning null tried_url", deepcopy(tried_urls[i]), try_any);
								}
								return options.cb(null, tried_urls[i].data);
							}
						}
					}

					if (_nir_debug_) {
						console_log("bigimage_recursive_loop: about to query", deepcopy(obj));
					}

					query(obj, function (newurl, newobj, data) {
						if (_nir_debug_) {
							console_log("bigimage_recursive_loop (query: newurl, newobj, data):", deepcopy(newurl), deepcopy(newobj), data);
						}

						if (!newurl) {
							if (_nir_debug_) {
								console_log("bigimage_recursive_loop (query): returning null", data);
							}
							return options.cb(null, data);
						}

						fine_urls.push({
							url: newurl,
							data: data
						});

						tried_urls.push({
							url: url,
							data: data,
							newurl: newurl,
							newobj: deepcopy(newobj),
							redirects_to_bad: false
						});

						state.redirect_map[url] = newurl;

						//if (array_indexof(image_urls, newurl) < 0 && newurl !== url || true) {
						var newurl_index = array_indexof(image_urls, newurl);
						if (newurl_index < 0 && already_tried_nonbad_url) {
							if (_nir_debug_) {
								console_log("bigimage_recursive_loop (query): already tried url", newurl, image_urls, deepcopy(state));
							}
							return options.cb(null, data);
						}

						if (newurl_index < 0 || !obj[newurl_index].norecurse) {
							state.oldobj = obj;
							bigimage_recursive_loop(newurl, options, query, state);
						} else {
							//obj = obj.slice(array_indexof(image_urls, newurl));
							obj = [obj[newurl_index]];

							if (_nir_debug_) {
								console_log("bigimage_recursive_loop (query): returning", deepcopy(obj), data);
							}
							options.cb(obj, data);
						}
					});
				};
			} else {
				newoptions[option] = options[option];
			}
		}

		if (_nir_debug_) {
			console_log("bigimage_recursive_loop", url, deepcopy(options), query, deepcopy(state));
		}

		return bigimage_recursive(url, newoptions);
	};
	(bigimage_recursive as any).loop = bigimage_recursive_loop;

	var get_tagname = function(el) {
		return el.tagName.toUpperCase();
	};

	var get_computed_style = function(el) {
		return el.currentStyle || window.getComputedStyle(el);
	};

	var get_svg_src = function(el) {
		var remove_attributes = [
			"class",
			"id",
			"tabindex",
			"style"
		];

		var newel = document.createElementNS("http://www.w3.org/2000/svg", "svg");
		newel.innerHTML = el.innerHTML;

		newel.setAttribute("xmlns", "http://www.w3.org/2000/svg");

		var attrs = el.attributes;
		for (var i = 0; i < attrs.length; i++) {
			var attr_name = attrs[i].name;

			if (array_indexof(remove_attributes, attr_name) >= 0 || /^on/.test(attr_name) || /^aria-/.test(attr_name)) {
				continue;
			}

			newel.setAttribute(attr_name, attrs[i].value);
		}


		var computed_style = get_computed_style(el);
		var fillval = el.getAttribute("fill") || computed_style.fill;
		if (fillval) {
			newel.setAttribute("fill", fillval);
		}

		//var header = '<?xml version="1.0" encoding="UTF-8" standalone="no" ?>\n';
		var header = ""; // unneeded
		var svgdoc = header + newel.outerHTML;

		// thanks to Rnksts on discord for these test images (base64 encode didn't work for unicode characters)
		// https://codepen.io/Rnksts/full/KKdJWvq
		return "data:image/svg+xml," + encodeURIComponent(svgdoc);
	};

	var get_canvas_src = function(el, format) {
		try {
			return el.toDataURL(format);
		} catch (e) {
			console_error(e);
			// "Tainted canvases may not be exported", CORS error in some pages
			return;
		}
	};

	var is_valid_src = function(src, isvideo) {
		// FIXME for audio
		return src && (!(/^blob:/.test(src)) || !isvideo);
	};

	var get_img_src = function(el) {
		if (typeof el === "string")
			return el;

		var el_tagname = get_tagname(el);

		if (el_tagname === "A")
			return el.href;

		if (el_tagname === "IFRAME") {
			return el.src.replace(/^javascript:window\.location\.replace\(["']([^"']+)["']\)$/, "$1");
		}

		if (el_tagname === "CANVAS") {
			return get_canvas_src(el, "image/png");
		}

		if (el_tagname === "SVG") {
			if (settings.mouseover_allow_svg_el) {
				return get_svg_src(el);
			} else {
				return null;
			}
		}

		if (el_tagname === "VIDEO") {
			return el.currentSrc || el.src || el.poster;
		}

		if (el_tagname === "AUDIO") {
			return el.currentSrc || el.src;
		}

		if (el_tagname === "SOURCE") {
			if (el.parentElement) {
				var newsrc = get_img_src(el.parentElement);
				// avoid adding blob url, e.g. reddit.com videos
				if (newsrc && is_valid_src(newsrc, true))
					return newsrc;
			}

			return el.currentSrc || el.src;
		}

		if (el_tagname === "IMAGE") {
			var xlink_href = el.getAttribute("xlink:href");

			if (xlink_href) {
				return xlink_href;
			} else {
				return null;
			}
		}

		// IMG or IFRAME
		// currentSrc is used if another image is used in the srcset
		var src = el.currentSrc || el.src;
		if (!src && el.tagName === "IMG") {
			// fake-src is used to avoid loading the image
			var fake_src = el.getAttribute("data-imu-fake-src");
			if (fake_src)
				return fake_src;
		}

		return src;
	};

	var check_highlightimgs_supported_image = function(el) {
		var src = get_img_src(el);

		var options = {
			fill_object: true,
			exclude_problems: [], // todo: use settings' exclude_problems instead
			use_cache: "read",
			//use_cache: false,
			use_api_cache: false,
			cb: function() {},
			do_request: function() {}
		};

		if (is_interactive) {
			options.host_url = window.location.href;
			options.element = el;
			options.document = document;
			options.window = window;
		}

		var imu_output = bigimage_recursive(src, options);

		// TODO: consolidate into its own routine
		if (imu_output.length !== 1)
			return true;

		var imu_obj = imu_output[0];
		if (imu_obj.url !== src)
			return true;

		for (var key in imu_obj) {
			if (key === "url")
				continue;

			if (!(key in default_object))
				return true;

			// e.g. for []
			if (JSON_stringify(default_object[key]) !== JSON_stringify(imu_obj[key]))
				return true;
		}

		return false;
	};

	var send_redirect = function(obj, cb, tabId) {
		if (is_extension) {
			extension_send_message({
				type: "redirect",
				data: {
					obj: obj,
					tabId: tabId
				}
			}, function() {
				cb();
			});
		} else {
			cb();
		}
	};

	var redirect = function(url, obj) {
		if (_nir_debug_) {
			console_log("redirect", url, obj);
		}

		if (_nir_debug_ && _nir_debug_.no_redirect)
			return;

		if (url === window.location.href)
			return;

		// wrap in try/catch due to nano defender
		try {
			// avoid downloading more before redirecting
			window.stop();
		} catch (e) {
		}

		send_redirect(obj, function() {
			if (settings.redirect_history) {
				window.location.assign(url);
			} else {
				window.location.replace(url);
			}
		});
	};

	// these functions can run before the document has loaded
	var cursor_wait = function() {
		if (document.documentElement)
			document.documentElement.style.cursor = "wait";
	};

	var cursor_default = function() {
		if (document.documentElement)
			document.documentElement.style.cursor = "default";
	};


	var infobox_timer = null;
	var show_image_infobox = function(text) {
		var div = document_createElement("div");
		div.style.backgroundColor = "#fffabb";
		// apparently this can be white in some cases: https://github.com/qsniyg/maxurl/issues/849#issuecomment-888695580 (thanks to ayunami2000 for reporting)
		div.style.color = "#000";
		div.style.position = "absolute";
		div.style.top = "0px";
		div.style.left = "0px";
		div.style.padding = ".3em .8em";
		div.style.boxShadow = "0px 0px 20px rgba(0,0,0,.6)";
		div.style.margin = ".8em";
		div.style.lineHeight = "1.5em";

		div.innerHTML = text;

		div.onclick = function() {
			document.body.removeChild(div);

			if (infobox_timer) {
				clearTimeout(infobox_timer);
				infobox_timer = null;
			}
		};

		document.body.appendChild(div);

		var do_timeout = function() {
			if (infobox_timer || settings.redirect_infobox_timeout <= 0)
				return;

			infobox_timer = setTimeout(function() {
				document.body.removeChild(div);
			}, settings.redirect_infobox_timeout * 1000);
		};

		if (document.hasFocus()) {
			do_timeout();
		} else {
			document.onfocus = function() {
				do_timeout();
				document.onfocus = null;
			};

			window.onfocus = function() {
				do_timeout();
				window.onfocus = null;
			};
		}
	};

	var check_ok_error = function(ok_errors, error) {
		if (ok_errors && is_array(ok_errors)) {
			for (var i = 0; i < ok_errors.length; i++) {
				if (error.toString() === ok_errors[i].toString()) {
					return true;
				}
			}

			return false;
		}

		return null;
	};

	var get_single_trigger_key_text = function(list) {
		list = list.sort(function(a, b) {
			if (a === b)
				return 0;

			if (a === "ctrl")
				return -1;
			if (b === "ctrl")
				return 1;
			if (a === "shift")
				return -1;
			if (b === "shift")
				return 1;
			if (a === "super")
				return -1;
			if (b === "super")
				return 1;
			if (a === "alt")
				return -1;
			if (b === "alt")
				return 1;
			if (a < b)
				return -1;
			if (b > a)
				return 1;
		});

		var newlist = [];
		for (var i = 0; i < list.length; i++) {
			var capitalized = string_charat(list[i], 0).toUpperCase() + list[i].slice(1);
			if (list.length === 1 && (capitalized === "Left" || capitalized === "Right" || capitalized === "Up" || capitalized === "Down")) {
				capitalized += " Arrow";
			}

			newlist.push(_(capitalized));
		}

		return newlist.join("+");
	};

	var get_trigger_key_texts = function(list) {
		if (!is_array(list[0])) {
			list = [list];
		}

		var result = [];

		for (var i = 0; i < list.length; i++) {
			result.push(get_single_trigger_key_text(list[i]));
		}

		return result;
	};

	var get_trigger_key_text = function(list) {
		return get_trigger_key_texts(list).join(" / ");
	};

	var truncate_with_ellipsis = function(text, maxchars) {
		var truncate_regex = new RegExp("^((?:.{" + maxchars + "}|.{0," + maxchars + "}[\\r\\n]))[\\s\\S]+?$");
		// "$1…"
		return text.replace(truncate_regex, decodeURIComponent("%241%E2%80%A6"));
	};

	var size_to_text = function(size) {
		var sizes = ["", "K", "M", "G", "T", "P"];

		while (size > 1024 && sizes.length > 1) {
			size /= 1024.;
			sizes.shift();
		}

		return size.toFixed(2).replace(/\.00$/, "") + sizes[0] + "B";
	};

	var check_image = function(obj, page_url, err_cb, ok_cb, no_infobox) {
		if (_nir_debug_)
			console_log("check_image", deepcopy(obj), page_url, no_infobox);

		if (is_array(obj)) {
			obj = obj[0];
		}

		if (!obj || !obj.url) {
			ok_cb(obj);
			return;
		}

		var print_orig = function() {
			if (obj && obj.extra) {
				if (obj.extra.page) {
					console_log("Original page: " + obj.extra.page);
				}

				if (obj.extra.caption) {
					console_log("Caption: " + obj.extra.caption);
				}

				if (obj.extra.created_date) {
					console_log("Created date: " + new Date(obj.extra.created_date));
				}

				if (obj.extra.updated_date) {
					console_log("Updated date: " + new Date(obj.extra.updated_date));
				}
			}
		};

		var url = obj.url;
		var err_txt;

		if (url === page_url) {
			print_orig();

			if (_nir_debug_)
				console_log("(check_image) url == page_url", url, page_url);

			ok_cb(url);
		} else  {
			var headers = obj.headers;
			console_log(obj.url);

			print_orig();

			if (obj) {
				if (obj.bad) {
					err_txt = "Bad image";
				} else if (obj.media_info.type === "video" && obj.media_info.delivery) {
					err_txt = "Can't redirect to streaming video type " + JSON_stringify(obj.media_info.delivery);
				} else if (obj.is_pagelink) {
					err_txt = "Can't redirect to page";
				}

				if (err_txt) {
					if (err_cb) {
						err_cb(err_txt);
					} else {
						console_error(err_txt);
					}
					return;
				}
			}

			var mouseover_text = function(reason) {
				if (!is_interactive)
					return;

				if (no_infobox) {
					return err_cb(reason, true);
				}

				if (!settings.redirect_enable_infobox)
					return;

				var trigger_behavior = get_single_setting("mouseover_trigger_behavior");

				var mouseover;
				if (!settings.mouseover) {
					mouseover = "disabled";
				} else if (trigger_behavior === "keyboard") {
					// todo: maybe _t2 etc. too?
					mouseover = get_trigger_key_text(settings.mouseover_trigger_key);
				} else if (trigger_behavior === "mouse") {
					mouseover = "delay " + settings.mouseover_trigger_delay + "s";
				}

				// TODO: another option could be to allow it whenever the image can be imu'd
				imagetab_ok_override = true;

				var trigger_options_link = "<a style='color:blue; font-weight:bold' href='" + options_page + "' target='_blank' rel='noreferrer'>" + mouseover + "</a>";
				var infobox_text = _("Mouseover popup (%%1) is needed to display the original version", trigger_options_link) + " (" + _(reason) + ")";

				if (settings.redirect_infobox_url) {
					var link = document_createElement("a");
					link.href = url;
					link.innerText = truncate_with_ellipsis(url, 80);
					link.setAttribute("target", "_blank");

					infobox_text += "<br />" + link.outerHTML;
				}

				try {
					show_image_infobox(infobox_text);
				} catch (e) {
					console_error(e);
				}
			};

			if (!_nir_debug_ || !_nir_debug_.no_request) {
				if (is_interactive)
					cursor_wait();

				var url_domain = url.replace(/^([a-z]+:\/\/[^/]*).*?$/, "$1");

				var origheaders = deepcopy(headers);

				var customheaders = true;
				if (!headers || Object.keys(headers).length === 0) {
					headers = {};
					customheaders = false;
				}

				var specified_headers = new_set();
				for (var header in headers) {
					set_add(specified_headers, header.toLowerCase());
				}

				var base_headers = {
					// Origin is not often added by the browser, and doesn't work for some sites
					//"origin": url_domain,
					"referer": page_url,
					// e.g. for Tumblr URLs, this is sent by the browser when redirecting
					"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
					"sec-fetch-dest": "document",
					"sec-fetch-mode": "navigate",
					"sec-fetch-site": "cross-site"
				};

				for (var header in base_headers) {
					if (!set_has(specified_headers, header)) {
						headers[header] = base_headers[header];
					}
				}

				if (customheaders && Object.keys(origheaders).length === 1 && ("Referer" in origheaders)) {
					var domain = page_url;
					domain = domain.replace(/^[a-z]+:\/\/([^/]*).*?$/, "$1");
					var url_domain = url.replace(/^[a-z]+:\/\/([^/]*).*?$/, "$1");

					if (obj.referer_ok.same_domain && domain === url_domain) {
						customheaders = false;
					} else if (obj.referer_ok.same_domain_nosub && get_domain_nosub(domain) === get_domain_nosub(url_domain)) {
						customheaders = false;
					}
				}

				if (customheaders && !is_extension) {
					document.documentElement.style.cursor = "default";
					console_log("Custom headers needed, currently unhandled");

					mouseover_text("custom headers");
					return;
				}

				if (_nir_debug_)
					console_log("(check_image) headers", headers);

				if (obj.always_ok ||
					(!obj.can_head && !settings.canhead_get)) {
					if (_nir_debug_) {
						console_log("(check_image) always_ok || !can_head", url, deepcopy(obj));
					}

					return ok_cb(url);
				}

				var method = "HEAD";
				if (!obj.can_head && settings.canhead_get) {
					if (_nir_debug_)
						console_log("Trying GET");
					method = "GET";
				}

				var handled = false;

				var onload_cb = function(resp) {
					if (handled)
						return;

					handled = true;

					if (_nir_debug_)
						console_log("(check_image) resp", resp);

					// FireMonkey returns null when tracking protection blocks a URL
					if (is_userscript && userscript_manager === "FireMonkey" && !resp) {
						err_txt = "Error: resp == null (tracking protection blocked, FireMonkey bug)";
						if (err_cb) {
							err_cb(err_txt);
						} else {
							console_error(err_txt);
						}

						return;
					}

					// nano defender removes this.DONE
					if (resp.readyState < 2) {
						return;
					}

					if (is_userscript && !resp.status && resp.readyState < 4) {
						// Tampermonkey and Greasemonkey have a bug where status isn't set for onprogress events
						// Tampermonkey issue: https://github.com/Tampermonkey/tampermonkey/issues/857
						// Greasemonkey issue: https://github.com/greasemonkey/greasemonkey/issues/3068
						handled = false;
						return;
					}

					if (resp.readyState < 4) {
						if (req && req.abort)
							req.abort();
					}

					if (resp.status === 0 ||
						check_tracking_blocked(resp)) {
						// error loading image (IP doesn't exist, etc.), ignore
						err_txt = "Error: status == 0";
						if (err_cb) {
							err_cb(err_txt);
						} else {
							console_error(err_txt);
						}

						return;
					}

					cursor_default();

					if (resp.finalUrl === page_url) {
						console_log(resp.finalUrl);
						console_log("Same URL");
						return;
					}

					var headers_list = parse_headers(resp.responseHeaders);
					var headers = headers_list_to_dict(headers_list);

					if (_nir_debug_)
						console_log("(check_image) resp headers", headers);


					var digit = resp.status.toString()[0];

					var ok_error = check_ok_error(obj.head_ok_errors, resp.status);

					if (((digit === "4" || digit === "5") &&
						resp.status !== 405) &&
						ok_error !== true) {
						err_txt = "Error: " + resp.status;
						if (err_cb) {
							err_cb(err_txt);
						} else {
							console_error(err_txt);
						}

						return;
					}

					var content_type = headers["content-type"];
					if (!content_type)
						content_type = "";
					content_type = content_type.toLowerCase();

					// https://1.f.ix.de/scale/crop/3840x2160/q75/se/ct/motive/image/4291/ct-motiv-07-2019_3840x2160.jpg
					//   https://www.heise.de/ct/motive/image/4291/ct-motiv-07-2019_3840x2160.jpg -- no content-type header
					if ((content_type.match(/text\/html/) || !content_type) && !obj.head_wrong_contenttype &&
						ok_error !== true) {
						var err_txt = "Error: Not an image: " + (content_type || "(no content-type)");
						if (err_cb) {
							err_cb(err_txt);
						} else {
							console_error(err_txt);
						}

						return;
					}

					if (!is_extension || settings.redirect_disable_for_responseheader) {
						if (obj.forces_download || (
							(content_type.match(/(?:binary|application|multipart|text)\//) ||
								content_type === "image/tiff" ||
								content_type === "image/lsr" ||
								// such as [image/png] (server bug)
								content_type.match(/^ *\[/)) && !obj.head_wrong_contenttype) ||
							(headers["content-disposition"] &&
								headers["content-disposition"].toLowerCase().match(/^ *attachment/))) {
							console_error("Forces download");
							mouseover_text("forces download");
							return;
						}
					}

					if (headers["content-length"] && headers["content-length"] == "0" && !obj.head_wrong_contentlength) {
						console_error("Zero-length image");
						return;
					}

					if (check_bad_if(obj.bad_if, resp)) {
						console_error("Bad image (bad_if)", obj.bad_if, resp);
						return err_cb("bad image");
					}

					if (!customheaders || is_extension) {
						if (_nir_debug_) {
							console_log("(check_image) finalUrl", resp.finalUrl || url, resp, deepcopy(obj));
						}

						ok_cb(resp.finalUrl || url);
					} else {
						console_log("Custom headers needed, currently unhandled");
					}
				};

				var req = do_request({
					method: method,
					url: url,
					headers: headers,
					trackingprotection_failsafe: true,
					onprogress: function(resp) {
						// 2 = HEADERS_RECEIVED
						if (resp.readyState >= 2 && resp.responseHeaders) {
							onload_cb(resp);
						}
					},
					onload: onload_cb
				});
			}
		}
	};

	function do_export() {
		$$IMU_EXPORT$$ = bigimage_recursive;

		if (is_node) {
			module.exports = bigimage_recursive;
		} else if (is_scripttag) {
			imu_variable = bigimage_recursive;
		}
	}

	function contenttype_can_be_redirected(contentType) {
		// disable redirecting if redirecting to/from audio/video is disabled
		if (/^video\//.test(contentType))
			return !!settings.redirect_video;

		if (/^audio\//.test(contentType))
			return !!settings.redirect_audio;

		// amazonaws's error page are application/xml
		// fixme: why not search for image/ or video/ instead?
		return !(/^(?:text|application)\//.test(contentType));
	}

	function currenttab_is_image() {
		return contenttype_can_be_redirected(document.contentType);
	}

	function do_redirect_sub(page_url, force_page, redirect) {
		var bigimage_obj:BigImageOptions = {
			fill_object: true,
			force_page: force_page,
			cb: function(newhref) {
				if (_nir_debug_) {
					console_log("do_redirect (final)", newhref);
				}

				cursor_default();

				if (!newhref) {
					return;
				}

				if (is_interactive && settings.print_imu_obj)
					console_log(newhref);

				var newurl = newhref[0].url;

				if (false && newhref[0].extra && newhref[0].extra.page) {
					console_log("Original page: " + newhref[0].extra.page);
				}

				if (newurl === page_url)
					return;

				if (!newurl)
					return;

				if (_nir_debug_)
					console_log("redirect (recursive loop)", newhref);

				redirect(newurl, newhref);
			}
		};

		if (is_interactive) {
			bigimage_obj.document = document;
			bigimage_obj.window = get_window();
		}

		bigimage_recursive_loop(page_url, bigimage_obj, function(newhref, real_finalcb) {
			if (_nir_debug_) {
				console_log("do_redirect", newhref);
			}

			var currentobj = null;
			var finalcb = function(newurl, data, newobj?) {
				real_finalcb(newurl, newobj || currentobj, data);
			};

			if (false && (!newhref[0].can_head || newhref[0].always_ok)) {
				var newurl = newhref[0].url;

				if (newurl === window.location.href) {
					cursor_default();
					return;
				}

				if (_nir_debug_) {
					console_log("Not checking due to can_head == false || always_ok == true");
				}

				finalcb(newurl);
				return;
			}

			var new_newhref = [];
			for (var i = 0; i < newhref.length; i++) {
				// is_probably_video and is_probably_audio have some overlap, so check them both

				if (!settings.redirect_video && is_probably_video(newhref[i]) &&
					!(settings.redirect_audio && is_probably_audio(newhref[i]))) {
					continue;
				}

				if (!settings.redirect_audio && is_probably_audio(newhref[i]) &&
					!(settings.redirect_video && is_probably_video(newhref[i]))) {
					continue;
				}

				new_newhref.push(newhref[i]);
			}

			var no_infobox = settings.redirect_to_no_infobox;
			var infobox_urls = [];
			var use_infobox = false;

			// TODO: avoid requesting again for second round after no_infobox (e.g. for force_download errors)
			var index = 0;
			var cb = function(err_txt, is_infobox) {
				if (_nir_debug_) {
					console_log("do_redirect_sub's err_cb:", err_txt, is_infobox);
				}

				if (is_infobox)
					infobox_urls.push(new_newhref[index]);

				index++;

				var array = new_newhref;
				if (use_infobox)
					array = infobox_urls;

				if (index >= array.length) {
					if (no_infobox && infobox_urls.length > 0) {
						use_infobox = true;
						no_infobox = false;
						index = 0;
					} else {
						cursor_default();
						console_error(err_txt);
						return;
					}
				}

				// FIXME: deduplicate
				if (same_url(window.location.href, array[index]) && no_infobox && infobox_urls.length > 0) {
					use_infobox = true;
					no_infobox = false;
					index = 0;
				}

				currentobj = array[index];
				check_image(currentobj, page_url, cb, finalcb, no_infobox);
			};
			currentobj = new_newhref[0];
			check_image(currentobj, page_url, cb, finalcb, no_infobox);
		});
	}

	function do_redirect() {
		if (!currenttab_is_image()) {
			if (!settings.redirect_host_html)
				return;

			if (!host_html_filter(window.location.href))
				return;
		}

		cursor_wait();

		var force_page = false;
		if ((settings["redirect_force_page"] + "") === "true")
			force_page = true;

		do_redirect_sub(window.location.href, force_page, redirect);
	}

	function onload(cb) {
		if (document.readyState === "complete" ||
			document.readyState === "interactive") {
			cb();
		} else {
			var state_cb = function() {
				if (document.readyState === "complete" ||
					document.readyState === "interactive") {
					cb();

					our_removeEventListener(document, "readystatechange", state_cb);
				}
			};

			our_addEventListener(document, "readystatechange", state_cb);
		}
	}

	function get_keystrs_map(event, value) {
		var keys = {};

		if (event.ctrlKey) {
			keys["ctrl"] = true;
		} else {
			keys["ctrl"] = false;
		}

		/*if (event.metaKey) {
			keys["super"] = true;
		} else {
			keys["super"] = false;
		}*/

		if (event.altKey) {
			keys["alt"] = true;
		} else {
			keys["alt"] = false;
		}

		if (event.shiftKey) {
			keys["shift"] = true;
		} else {
			keys["shift"] = false;
		}

		if (event.buttons !== void 0) {
			var buttonnames = ["button1", "button2", "button3", "button4", "button5"];
			var buttons = event.buttons;
			while (buttonnames.length > 0) {
				if (buttons & 1) {
					keys[buttonnames[0]] = true;
				} else {
					keys[buttonnames[0]] = false;
				}

				buttons >>= 1;
				buttonnames.shift();
			}
		}

		if (event.type === "wheel") {
			if (event.deltaY < 0) {
				keys["wheelUp"] = true;
			} else if (event.deltaY > 0) {
				keys["wheelDown"] = true;
			}

			if (event.deltaX < 0) {
				keys["wheelLeft"] = true;
			} else if (event.deltaX > 0) {
				keys["wheelRight"] = true;
			}
		}

		var str = keycode_to_str(event);
		if (str === void 0) {
			return keys;
		}

		keys[str] = value;
		return keys;
	}

	var keystr_is_wheel = function(keystr) {
		return /^wheel/.test(keystr);
	};

	var keystr_is_button12 = function(keystr) {
		// allow rebinding right click
		// todo: maybe add a warning if done globally (e.g. trigger key)?
		return keystr === "button1";// || keystr === "button2";
	}

	var chord_is_only_wheel = function(chord) {
		for (var i = 0; i < chord.length; i++) {
			if (!keystr_is_wheel(chord[i]) && !keystr_is_button12(chord[i])) {
				return false;
			}
		}

		return true;
	};

	var keysequence_bad = function(keyseq) {
		if (chord_is_only_wheel(keyseq))
			return true;

		if (keyseq.length !== 1)
			return false;

		return keystr_is_button12(keyseq[0]);
	};

	var keysequence_valid = function(keyseq) {
		if (keyseq.length === 0)
			return false;

		if (keysequence_bad(keyseq))
			return false;

		if (keyseq.length > 1)
			return true;

		return true;
	};

	var prefers_dark_mode = function() {
		try {
			return window.matchMedia("(prefers-color-scheme: dark)").matches;
		} catch (e) {
			return false;
		}
	};

	function update_dark_mode() {
		if (!is_maxurl_website && !is_options_page) {
			return;
		}

		if (prefers_dark_mode()) {
			set_default_value("dark_mode", true);
		}

		if (settings.dark_mode) {
			document.documentElement.classList.add("dark");
		} else {
			document.documentElement.classList.remove("dark");
		}
	}

	var request_permission = function(permission, cb) {
		if (!is_extension)
			return cb(false);

		// This has to be done in the content script under firefox: https://github.com/qsniyg/maxurl/issues/254
		if (true) {
			try {
				chrome.permissions.request({
					permissions: [permission]
				}, function(granted) {
					if (granted) {
						extension_send_message({
							type: "permission_handler",
							data: {
								permission: permission
							}
						});
					}

					cb(granted);
				});
			} catch(e) {
				console_error(e);
				cb(false);
			}
		} else {
			extension_send_message({
				type: "permission",
				data: {
					permission: permission
				}
			}, function(result) {
				cb(result.data.granted);
			});
		}
	};

	var current_options_tab = "general";
	if (is_interactive) {
		var hash = window.location.hash;
		if (hash) {
			var hashmatch = hash.match(/^#?cat(?:_fake)?_(.*)$/);
			if (hashmatch) {
				current_options_tab = hashmatch[1];
			}
		}
	}

	function do_options() {
		update_dark_mode();

		var recording_keys:false|(()=>void) = false;
		var options_chord = [];
		var current_options_chord = [];

		function update_options_chord(event, value) {
			if (!recording_keys)
				return;

			var map = get_keystrs_map(event, value);

			if ((keycode_to_str(event) || event.type === "mousedown") &&
				current_options_chord.length === 0) {
				// Don't clear the options chord for either left or right mouse buttons
				if (event.button !== 0 && event.button !== 2)
					options_chord = [];
			}

			var old_options_chord = deepcopy(options_chord);
			for (var key in map) {
				update_options_chord_sub(key, map[key]);
			}

			if (keysequence_bad(options_chord))
				options_chord = old_options_chord;

			recording_keys();
		}

		function update_options_chord_sub(str, value) {
			if (value) {
				if (array_indexof(options_chord, str) < 0) {
					options_chord.push(str);
				}

				if (array_indexof(current_options_chord, str) < 0) {
					current_options_chord.push(str);
				}
			} else {
				if (array_indexof(current_options_chord, str) >= 0) {
					current_options_chord.splice(array_indexof(current_options_chord, str), 1);
				}
			}
		}

		document.addEventListener('keydown', function(event) {
			update_options_chord(event, true);

			if (recording_keys) {
				event.preventDefault();
				return false;
			}
		});

		document.addEventListener('mousedown', function(event) {
			update_options_chord(event, true);

			if (recording_keys) {
				event.preventDefault();
				//event.stopImmediatePropagation();
				return false;
			}
		});

		document.addEventListener('wheel', function(event) {
			update_options_chord(event, true);

			if (recording_keys) {
				event.preventDefault();
				event.stopImmediatePropagation();
				event.stopPropagation();
				return false;
			}
		}, {
			capture: true,
			passive: false
		});

		document.addEventListener("contextmenu", function(event) {
			if (recording_keys) {
				event.preventDefault();
				event.stopImmediatePropagation();
				return false;
			}
		});

		document.addEventListener('keyup', function(event) {
			update_options_chord(event, false);

			if (recording_keys) {
				event.preventDefault();
				return false;
			}
		});

		document.addEventListener('mouseup', function(event) {
			if (event.button === 1)
				return;

			update_options_chord(event, false);

			if (recording_keys) {
				event.preventDefault();
				event.stopImmediatePropagation();
				return false;
			}
		});

		var options_el_real = document.getElementById("options");
		options_el_real.textContent = "";

		var options_el = document.createDocumentFragment();

		if (!is_extension_options_page) {
			var options_header_el = document_createElement("h1");
			options_header_el.textContent = _("options_header");
			options_el.appendChild(options_header_el);
		}

		var saved_el = document.getElementById("saved");
		if (!saved_el) {
			saved_el = document_createElement("div");
			saved_el.style.visibility = "hidden";
			saved_el.id = "saved";
			saved_el.classList.add("topsaved");
		}

		var get_default_saved_text = function(meta?:SettingMeta) {
			var text = "Saved! Refresh the target page for changes to take effect";
			if (meta && meta.needrefresh)
				return text;

			if (is_extension || typeof GM_addValueChangeListener !== "undefined") {
				text = "Saved!";
			}

			return text;
		};

		var set_saved_text = function(id) {
			var p_el = document_createElement("p");
			p_el.textContent = _(id);

			saved_el.textContent = "";
			saved_el.appendChild(p_el);
		};

		set_saved_text(get_default_saved_text());
		//saved_el.style.pointer_events = "none";
		//saved_el.style.textAlign = "center";
		//saved_el.style.paddingTop = "1em";
		//saved_el.style.fontStyle = "italic";
		//saved_el.style.color = "#0af";
		var saved_timeout = null;

		var create_update_available = function() {
			var update_available_el = document_createElement("div");
			update_available_el.classList.add("update-available");
			update_available_el.innerHTML = "Update available: v" + current_version + " -&gt; ";

			var link = get_update_url();

			if (link) {
				update_available_el.innerHTML += "<a href=\"" + link + "\" target=\"_blank\" rel=\"noreferer\">v" + settings.last_update_version + "</a>";
			} else {
				update_available_el.innerHTML += "v" + settings.last_update_version;
			}

			return update_available_el;
		};

		if (settings.check_updates && version_compare(current_version, settings.last_update_version) === 1) {
			options_el.appendChild(create_update_available());
		}

		var rules_failed_el = document.createElement("p");
		if (set_require_rules_failed_el(rules_failed_el)) {
			options_el.appendChild(rules_failed_el);
		}

		var topbtns_holder = document_createElement("div");
		topbtns_holder.id = "topbtns";
		options_el.appendChild(topbtns_holder);

		var importexport_ocontainer = document_createElement("div");
		importexport_ocontainer.id = "importexport";
		importexport_ocontainer.classList.add("center-outer");
		importexport_ocontainer.style.display = "none";
		options_el.appendChild(importexport_ocontainer);

		var importexport_container = document_createElement("div");
		importexport_container.classList.add("center-inner");
		importexport_ocontainer.appendChild(importexport_container);

		var importexport_text = document_createElement("textarea");
		importexport_container.appendChild(importexport_text);

		var safe_import_json = function(json) {
			json = strip_whitespace_simple(json);

			var append = false;
			if (json[0] === "+") {
				append = true;
				json = json.substring(1);
			}

			var value = null;
			try {
				value = JSON_parse(json);
			} catch (e) {
				console_error(e);
			}

			return {
				value: value,
				append: append
			};
		}

		var fetch_import_json = function(import_text, cb) {
			if (/^https?:\/\//.test(import_text)) {
				do_request({
					method: "GET",
					url: import_text,
					onload: function(resp) {
						if (resp.status !== 200) {
							console.error(resp);
							return cb(null);
						}

						cb(safe_import_json(resp.responseText));
					}
				});
			} else {
				cb(safe_import_json(import_text));
			}
		};

		var real_import_btn = document_createElement("button");
		real_import_btn.innerText = _("Import");
		real_import_btn.onclick = function() {
			if (real_import_btn.classList.contains("disabled"))
				return;

			real_import_btn.classList.add("disabled");

			var import_text = importexport_text.value;
			import_text = strip_whitespace_simple(import_text);

			fetch_import_json(import_text, function(data) {
				if (!data || !data.value) {
					importexport_text.value = "Error!";
					real_import_btn.classList.remove("disabled");
					return;
				}

				var value = data.value;
				var append = data.append;

				var changed = false;

				var current_settings = deepcopy(settings);

				var new_settings;
				if (!append)
					new_settings = deepcopy(orig_settings);
				else
					new_settings = deepcopy(settings);

				var settings_version;
				for (var key in value) {
					if (!(key in settings)) {
						if (key === "settings_version") {
							settings_version = value[key];
							continue;
						} else {
							console_warn("Unknown key in imported settings:", key);
						}
					}

					new_settings[key] = value[key];
				}

				for (var key in new_settings) {
					if (JSON_stringify(new_settings[key]) !== JSON_stringify(current_settings[key])) {
						settings[key] = new_settings[key];
						set_value(key, new_settings[key]);
						changed = true;
					}
				}

				if (settings_version === void 0) {
					settings_version = 1;
				}

				upgrade_settings_with_version(settings_version, new_settings, function(new_changed) {
					real_import_btn.classList.remove("disabled");

					if (changed || new_changed) {
						console_log("Settings imported");

						setTimeout(function() {
							do_options();
						}, 1);
					} else {
						console_log("No settings changed");
					}

					show_importexport(false);
				});
			});
		};
		importexport_container.appendChild(real_import_btn);

		var export_container = document_createElement("div");

		var export_txt_btn = document_createElement("button");
		export_txt_btn.innerText = _("Save");
		export_txt_btn.onclick = function() {
			var data = importexport_text.value;
			var url = "data:text/plain," + encodeURIComponent(data);

			var obj = {
				url: url,
				filename: "settings.txt"
			};

			do_download(obj, obj.filename, data.length);
		};
		export_container.appendChild(export_txt_btn);

		importexport_container.appendChild(export_container);

		var show_importexport = function(show, importexport) {
			if (show) {
				importexport_ocontainer.style.display = "block";
			} else {
				importexport_state = null;

				importexport_ocontainer.style.display = "none";
			}

			if (importexport) {
				if (show)
					importexport_state = "import";

				real_import_btn.style.display = "inline-block";
				export_container.style.display = "none";
			} else {
				if (show)
					importexport_state = "export";

				real_import_btn.style.display = "none";
				export_container.style.display = "block";
			}
		};

		var importexport_state = null;

		var import_btn = document_createElement("button");
		import_btn.id = "importbtn";
		import_btn.innerText = _("Import");
		import_btn.title = _("Import settings");
		import_btn.onclick = function() {
			if (importexport_state === "import")
				return show_importexport(false);

			importexport_text.value = "";

			show_importexport(true, true);
		};
		topbtns_holder.appendChild(import_btn);

		var export_btn = document_createElement("button");
		export_btn.id = "exportbtn";
		export_btn.innerText = _("Export");
		export_btn.title = _("Export settings");
		export_btn.onclick = function() {
			if (importexport_state === "export")
				return show_importexport(false);

			var newsettings = deepcopy(settings);
			get_value("settings_version", function(value) {
				if (value !== void 0)
					newsettings.settings_version = value;
				importexport_text.value = JSON_stringify(newsettings);

				show_importexport(true, false);
			});
		};
		topbtns_holder.appendChild(export_btn);

		var enabled_map = {};
		var reason_map = {};

		var check_sub_option = function(meta:SettingMeta, reason?) {
			if (typeof reason === "undefined") {
				reason = {};
			}

			var enabled = true;

			var prepare_array = function(value) {
				var result = deepcopy(value);
				if (!result) {
					return null;
				}

				if (typeof result === "string") {
					result = deepcopy(settings_conditions[result]);
				}

				if (!is_array(result)) {
					result = [result];
				}

				var newresult = [];
				array_foreach(result, function(single) {
					if (single._condition) {
						var cond = deepcopy(settings_conditions[single._condition]);
						if (!is_array(cond)) cond = [cond];

						array_foreach(cond, function(scond) {
							obj_foreach(single, function(key, value) {
								if (key === "_condition") return;
								scond[key] = value;
							});

							newresult.push(scond);
						});
					} else {
						newresult.push(single);
					}
				});

				// add profiled keys, e.g.
				// [{mouseover_open_behavior: "popup"}] -> [{"mouseover_open_behavior": "popup"}, {"mouseover_open_behavior_t2": "popup"}]
				result = [];
				array_foreach(newresult, function(single) {
					result.push(single);

					var profiled_keys = [];
					obj_foreach(single, function(key, value) {
						var meta = settings_meta[key];
						if (!meta) return;

						if (meta.profiled) {
							profiled_keys.push(key);
						}
					});

					if (profiled_keys.length) {
						for (var i = 0; i < num_profiles; i++) {
							var new_single = deepcopy(single);
							array_foreach(profiled_keys, function(key) {
								var profiled_key = "t" + (i + 2) + "_" + key;
								new_single[profiled_key] = new_single[key];
								delete new_single[key];
							});

							new_single._auto = true;

							result.push(new_single);
						}
					}
				});

				return result;
			}

			var requires = prepare_array(meta.requires);
			var disabled_if = prepare_array(meta.disabled_if);

			if (!meta.imu_enabled_exempt) {
				if (!settings.imu_enabled) {
					enabled = false;
				}
			}

			reason.good = [];
			reason.bad = [];
			if (enabled && requires) {
				enabled = check_validity(requires, reason);
				reason.good = [];
			}

			if (enabled && disabled_if) {
				reason.good = [];
				reason.bad = [];

				enabled = !check_validity(disabled_if, reason);
				reason.bad = [];
			}

			return enabled;
		};

		var check_option = function(setting) {
			var meta = settings_meta[setting];

			enabled_map[setting] = "processing";
			reason_map[setting] = {};
			var enabled = check_sub_option(meta, reason_map[setting]);
			enabled_map[setting] = enabled;

			return enabled;
		};

		var check_validity = function(array, reason) {
			for (var i = 0; i < array.length; i++) {
				var current = array[i];
				var current_valid = true;

				var good_reason, bad_reason;

				if (typeof reason !== "undefined") {
					good_reason = [];
					bad_reason = [];
				}

				for (var required_setting in current) {
					if (required_setting[0] === "_")
						continue;

					var required_value = current[required_setting];

					var value = settings[required_setting];
					if (is_array(value) && !is_array(required_value))
						value = value[0];

					if (!(required_setting in enabled_map)) {
						check_option(required_setting);
					}

					if (enabled_map[required_setting] === "processing") {
						console_error("Dependency cycle detected for:", current, ",", required_setting);
						return;
					}

					var current_reason = {
						setting: required_setting,
						required_value: required_value,
						current_value: value,
						enabled: enabled_map[required_setting],
						auto: !!current._auto
					};

					var value_is_required = value === required_value;
					if (!value_is_required && settings_meta[required_setting].type === "keysequence" && required_value === true) {
						// value can be undefined because value = value[0] above
						value_is_required = value && !!value.length;
					}

					if (enabled_map[required_setting] && value_is_required) {
						//current_valid = true;
						if (typeof good_reason !== "undefined") {
							good_reason.push(current_reason);
						}
					} else {
						current_valid = false;

						if (typeof bad_reason !== "undefined") {
							bad_reason.push(current_reason);
						}
					}

					if (!current_valid && typeof reason === "undefined") {
						break;
					}
				}

				if (typeof reason !== "undefined") {
					reason.good.push(good_reason);
					reason.bad.push(bad_reason);
				}

				if (current_valid) {
					return true;
				}
			}

			return false;
		};

		var get_option_from_options = function(options, option) {
			if (option in options)
				return options[option];

			for (var option_name in options) {
				if (/^_group/.test(option_name)) {
					return get_option_from_options(options[option_name], option);
				}
			}

			return null;
		};

		var is_nonempty_reason = function(goodbad) {
			for (var i = 0; i < goodbad.length; i++) {
				if (goodbad[i].length !== 0)
					return true;
			}

			return false;
		};

		var is_reason_goodbad = function(reason) {
			if (is_nonempty_reason(reason.good))
				return "good";

			if (is_nonempty_reason(reason.bad))
				return "bad";

			return null;
		};

		var fill_requirements = function(reason, div) {
			div.textContent = "";

			if (!settings.settings_show_requirements)
				return;

			var goodbad = is_reason_goodbad(reason);
			if (!goodbad)
				return;

			var requires_p = document_createElement("p");
			requires_p.innerText = _("Requires:");
			div.appendChild(requires_p);

			var els = [];

			var array = reason[goodbad];
			for (var i = 0; i < array.length; i++) {
				if (array[i].length === 0)
					continue;

				var ul = document_createElement("ul");
				var ul_valid = false;

				for (var j = 0; j < array[i].length; j++) {
					var single_reason = array[i][j];

					if (single_reason.auto) continue;

					var option_meta = null;
					var option_name = single_reason.setting;
					var option_cat = null;
					if (single_reason.setting in settings_meta) {
						option_meta = settings_meta[single_reason.setting];
						option_name = _(option_meta.name);

						option_cat = option_meta.category || null;
						if (option_cat) {
							option_cat = _(categories[option_cat]);
						}
					}

					var cat_prefix = "";
					// TODO: don't check label_texts, this doesn't work with tabs. Instead, do proper parsing
					//var wanted_value_el = document.querySelector("label[for=\"input_" + single_reason.setting + "_" + single_reason.required_value + "\"]");
					var wanted_value = single_reason.required_value;
					var input_id = "input_" + single_reason.setting + "_" + single_reason.required_value;
					if (input_id in label_texts) {
						wanted_value = label_texts[input_id];
					} else if (option_cat) { // FIXME: really hacky check to see if in same tab or not
						cat_prefix = "(" + option_cat + ") ";
					}

					var equals = "=";
					if (goodbad === "good")
						equals = "!=";

					var li = document_createElement("li");
					li.innerText = cat_prefix + option_name + " " + equals + " " + wanted_value;
					ul.appendChild(li);
					ul_valid = true;
				}

				if (ul_valid) els.push(ul);
			}

			var newels = [];
			for (var i = 0; i < els.length - 1; i++) {
				newels.push(els[i]);

				// FIXME: this should be 'and' for disabled_if
				var or_p = document_createElement("p");
				or_p.innerText = _("Or:");

				newels.push(or_p);
			}

			newels.push(els[els.length-1]);

			for (var i = 0; i < newels.length; i++) {
				div.appendChild(newels[i]);
			}
		};

		function check_disabled_options() {
			var options = options_el.querySelectorAll("div.option");

			enabled_map = {};

			for (var i = 0; i < options.length; i++) {
				var setting = options[i].id.replace(/^option_/, "");

				var enabled = check_option(setting);

				if (enabled) {
					options[i].classList.remove("disabled");
					options[i].classList.remove("disabled-hidden");

					options[i].getElementsByClassName("requirements")[0].classList.add("hidden");

					var meta = settings_meta[setting];
					var meta_options = meta.options;
					var regexp = new RegExp("^input_" + setting + "_");

					var els = options[i].querySelectorAll("input, textarea, button, select, option");
					for (var j = 0; j < els.length; j++) {
						let input = els[j] as HTMLInputElement;

						input.disabled = false;

						if (meta_options) {
							var option_name = input.id.replace(regexp, "");
							if (option_name !== input.id) {
								var option_value = get_option_from_options(meta_options, option_name);
								if (option_value) {
									if (!check_sub_option(option_value)) {
										input.disabled = true;
									}
								}
							}
						}
					}
				} else {
					options[i].classList.add("disabled");

					if (!settings.settings_show_disabled) {
						options[i].classList.add("disabled-hidden");
					} else if (!settings.settings_show_disabled_profiles && /^t[0-9]+_/.test(setting)) {
						var trigger_value = settings["mouseover_trigger_key_" + setting.replace(/^(t[0-9]+)_.*/, "$1")];
						if (trigger_value.length <= 0) {
							options[i].classList.add("disabled-hidden");
						}
					}

					var els = options[i].querySelectorAll("input, textarea, button, select");
					for (var j = 0; j < els.length; j++) {
						let input = els[j] as HTMLInputElement;
						input.disabled = true;
					}

					var requirements_div = options[i].getElementsByClassName("requirements")[0];
					//requirements_div.style.display = "block";
					requirements_div.classList.remove("hidden");
					fill_requirements(reason_map[setting], requirements_div);
				}
			}
		}

		function show_warnings() {
			var options = options_el.querySelectorAll("div.option");
			for (var i = 0; i < options.length; i++) {
				var setting = options[i].id.replace(/^option_/, "");

				var meta = settings_meta[setting];
				if (meta.warning) {
					var warning = meta.warning[settings[setting] + ""];
					var el = options[i].querySelector(".warning") as HTMLElement|null;
					if (!el)
						continue;

					if (warning) {
						el.innerText = warning;
						el.style.display = "block";
					} else {
						el.style.display = "none";
					}
				}
			}
		}

		function show_saved_message(meta:SettingMeta) {
			set_saved_text(get_default_saved_text(meta));

			saved_el.setAttribute("style", "");
			saved_el.classList.remove("fadeout");

			if (saved_timeout)
				clearTimeout(saved_timeout);

			saved_timeout = setTimeout(function() {
				saved_el.classList.add("fadeout");
			}, 2000);
		}

		function md_to_html(parent, text) {
			var current_el = null;
			var current_text = "";
			var current_tag = null;

			var apply_tag = function() {
				if (current_text.length === 0)
					return;

				if (current_tag === "`") {
					current_el = document_createElement("code");
				} else {
					current_el = document_createElement("span");
				}

				current_el.innerText = current_text;
				current_text = "";
				parent.appendChild(current_el);
			}

			// fast path
			if (string_indexof(text, "`") < 0 && string_indexof(text, "\n") < 0) {
				current_text = text;
				apply_tag();
				return;
			}

			for (var i = 0; i < text.length; i++) {
				if (text[i] === current_tag) {
					apply_tag();
					current_tag = null;
					continue;
				}

				if (text[i] === "`") {
					apply_tag();
					current_tag = text[i];
					continue;
				}

				if (text[i] === "\n") {
					apply_tag();
					parent.appendChild(document_createElement("br"));
					continue;
				}

				current_text += text[i];
			}

			apply_tag();
		}

		var tabscontainer;
		if (settings.settings_tabs) {
			tabscontainer = document_createElement("div");
			tabscontainer.id = "tabs";
			options_el.appendChild(tabscontainer);
		}

		var category_els = {};
		var subcategory_els = {};

		if (!(current_options_tab in categories)) {
			current_options_tab = "general";
		}

		for (var category in categories) {
			var catname = _(categories[category]);

			var div = document_createElement("div");
			div.id = "cat_" + category;
			div.classList.add("category");

			category_els[category] = [div];

			if (settings.settings_tabs) {
				div.classList.add("tabbed");

				var tab = document_createElement("span");
				tab.classList.add("tab");
				//tab.href = "#cat_" + category;
				tab.id = "tab_cat_" + category;
				tab.innerText = catname;

				(function(category) {
					tab.onclick = function() {
						current_options_tab = category;
						window.location.hash = "cat_fake_" + category;
						do_options();
					};
				})(category);

				if (category === current_options_tab) {
					tab.classList.add("active");
				} else {
					div.style.display = "none";
				}

				category_els[category].push(tab);

				tabscontainer.appendChild(tab);
			} else {
				var h2 = document_createElement("h2");
				h2.innerText = catname;
				div.appendChild(h2);
			}

			var subdiv = document_createElement("div");
			subdiv.id = "subcat_" + category;
			subdiv.classList.add("subcat");
			subdiv.classList.add("frame");
			div.appendChild(subdiv);
			subcategory_els[category] = subdiv;

			if (category in subcategories) {
				for (var subcat in subcategories[category]) {
					var newsubdiv = document_createElement("div");
					var subcat_full = category + "_" + subcat;
					newsubdiv.id = "subcat_" + subcat_full;
					newsubdiv.classList.add("subcat");
					newsubdiv.classList.add("frame");

					var h3 = document_createElement("h3");
					h3.innerText = _(subcategories[category][subcat]);
					newsubdiv.appendChild(h3);

					div.appendChild(newsubdiv);
					subcategory_els[subcat_full] = newsubdiv;
				}
			}

			options_el.appendChild(div);
		}

		var show_advanced = settings.advanced_options;

		var normalize_value = function(value) {
			if (is_array(value) && value.length === 1) {
				return JSON_stringify(value[0]);
			}

			return JSON_stringify(value);
		};

		var category_settings = {};
		var label_texts = {};

		var add_setting_dom = function(setting) {
			var meta = settings_meta[setting];
			if (!meta) {
				return;
			}

			if (!(setting in orig_settings))
				return;

			var value = settings[setting];
			var orig_value = orig_settings[setting];

			if (meta.hidden)
				return;

			if (meta.userscript_only && !is_userscript)
				return;

			if (meta.extension_only && !is_extension)
				return;

			if (meta.advanced && !show_advanced)
				return;

			category_settings[meta.category] = true;
			if (settings.settings_tabs && meta.category !== current_options_tab)
				return;

			var option = document_createElement("div");
			option.classList.add("option");
			option.id = "option_" + setting;

			if (/^t[0-9]+_/.test(setting) || /_t[0-9]+$/.test(setting)) {
				option.classList.add("trigger_profile");
			}

			var table = document_createElement("table");
			table.classList.add("option-table");

			var tr = document_createElement("tr");
			table.appendChild(tr);

			var name = document_createElement("strong");
			md_to_html(name, _(meta.name));

			var description = _(meta.description);
			if (meta.description_userscript && is_userscript)
				description = _(meta.description_userscript);

			if (description) {
				name.title = description;
			} else {
				name.classList.add("no-title");
			}

			var name_td = document_createElement("td");
			name_td.classList.add("name_td");
			name_td.classList.add("name_td_va_middle");

			var revert_btn = document.createElement("button");
			// \u2b8c = ⮌
			revert_btn.innerText = "\u2b8c";
			revert_btn.classList.add("revert-button");
			revert_btn.title = _("Revert");

			revert_btn.onclick = function() {
				if (revert_btn.disabled) return;

				do_update_setting(setting, orig_value, meta);

				run_soon(do_options);
			};

			var check_value_orig_different = function(value) {
				var value_norm = normalize_value(value);
				var orig_norm = normalize_value(orig_value);

				if (meta.type === "keysequence") {
					value_norm = JSON_stringify(normalize_keychord(value));
					orig_norm = JSON_stringify(normalize_keychord(orig_value));
				}

				var value_orig_different = value_norm !== orig_norm;
				if (value_orig_different) {
					name_td.classList.add("value_modified");
					name_td.appendChild(revert_btn);
				} else {
					name_td.classList.remove("value_modified");

					if (revert_btn.parentElement === name_td)
						name_td.removeChild(revert_btn);
				}
			};

			var do_update_setting_real = function(setting, new_value, meta) {
				update_setting(setting, new_value);

				run_soon(function() {
					check_value_orig_different(new_value);
				});

				show_saved_message(meta);
			};

			var do_update_setting = function(setting, new_value, meta) {
				if (is_extension && meta.required_permission) {
					request_permission(meta.required_permission, function(granted) {
						if (granted) {
							do_update_setting_real(setting, new_value, meta);
						} else {
							do_options();
						}
					});
				} else {
					do_update_setting_real(setting, new_value, meta);
				}
			};

			name_td.appendChild(name);
			check_value_orig_different(value);
			tr.appendChild(name_td);

			var value_td = document_createElement("td");
			value_td.classList.add("value_td");

			var type = "options";
			var option_list = {};

			if (typeof orig_value === "boolean") {
				type = "options";
				option_list["true"] = {name: _("yes")};
				option_list["false"] = {name: _("no")};
				if (value)
					option_list["true"].checked = true;
				else
					option_list["false"].checked = true;
			} else if (meta.options) {
				if (meta.options._randomize) {
					var keys = Object.keys(meta.options);

					var new_options = {};
					// prepend options that do need to be properly sorted
					for (var option_name in meta.options) {
						if (option_name[0] == "_" || meta.options[option_name].is_null) {
							new_options[option_name] = meta.options[option_name];
						}
					}

					keys.sort(function() {
						return (Math_floor(Math_random() * 2) ? 1 : -1);
					});

					for (var i = 0; i < keys.length; i++) {
						if (keys[i] in new_options)
							continue;

						new_options[keys[i]] = meta.options[keys[i]];
					}

					meta.options = new_options;
				}

				if (meta.options._type === "combo") {
					type = "combo";
				} else {
					type = "options";
					option_list = deepcopy(meta.options);

					var check_optionlist = function (val, list) {
						if (val in list) {
							list[val].checked = true;
						} else {
							for (var item in list) {
								if (item.match(/^_group/)) {
									check_optionlist(val, list[item]);
								}
							}
						}
					};

					if (is_array(value)) {
						array_foreach(value, function(val) {
							check_optionlist(val, option_list);
						});
					} else {
						check_optionlist(value, option_list);
					}
				}
			} else if (meta.type) {
				if (meta.type === "textarea" ||
					meta.type === "keysequence" ||
					meta.type === "number" ||
					meta.type === "lineedit")
					type = meta.type
			}

			if (type === "options") {
				var option_type = option_list._type;
				if (!option_type)
					option_type = "or";

				var add_setting = function(parent, op, val, option_type, group, group_type) {
					var id = "input_" + setting + "_" + op;
					var name = setting;
					if (group && group_type === "and")
						name += "_" + group;

					var input = document_createElement("input");
					if (option_type === "or" && false)
						input.setAttribute("type", "radio");
					else if (option_type === "and" || true)
						input.setAttribute("type", "checkbox");
					input.name = name;
					input.value = op;
					input.id = id;
					if (val.checked)
						input.setAttribute("checked", "true");

					input.addEventListener("change", function(event) {
						var value = this.value;

						if (value === "true") {
							value = true;
						}

						if (value === "false")
							value = false;

						if (this.checked) {
							if (group && group_type === "or") {
								for (var child_i = 0; child_i < value_td.children.length; child_i++) {
									var child = value_td.children[child_i];
									if (child.id !== (setting + group)) {
										for (var subchild_i = 0; subchild_i < child.children.length; subchild_i++) {
											var subchild = child.children[subchild_i];
											if (subchild.tagName === "INPUT") {
												subchild.checked = false;
											}
										}
									}
								}
							}

							if (option_type === "or") {
								for (var child_i = 0; child_i < parent.children.length; child_i++) {
									var child = parent.children[child_i];
									if (child.tagName === "INPUT" && child.id != input.id) {
										child.checked = false;
									}
								}
							}
						} else {
							var onechecked = false;
							for (var child_i = 0; child_i < value_td.children.length; child_i++) {
								var child = value_td.children[child_i];
								for (var subchild_i = 0; subchild_i < child.children.length; subchild_i++) {
									var subchild = child.children[subchild_i];
									if (subchild.tagName === "INPUT") {
										if (subchild.checked) {
											onechecked = true;
											break;
										}
									}
								}
								if (onechecked)
									break;
							}

							if (!onechecked) {
								this.checked = true;
							}
						}

						var new_value = value;
						if (group || option_type !== "or") {
							var out_value = [];

							var inputs = value_td.getElementsByTagName("input");
							for (var child_i = 0; child_i < inputs.length; child_i++) {
								var child = inputs[child_i];
								if (child.checked) {
									out_value.push(child.value);
								}
							}

							new_value = out_value;
							do_update_setting(setting, new_value, meta);
						} else {
							do_update_setting(setting, value, meta);
						}

						//settings[setting] = new_value;
						check_disabled_options();
						show_warnings();
					});

					parent.appendChild(input);

					var label = document_createElement("label");
					label.setAttribute("for", id);

					label_texts[id] = _(val.name);
					if (label_texts[id]) {
						label.innerText = label_texts[id];
					} else {
						label.innerHTML = "&nbsp;"
					}

					if (val.description) {
						label.title = _(val.description);
					}

					parent.appendChild(label);
				};

				for (var op in option_list) {
					if (option_list[op].extension_only && !is_extension)
						continue;

					if (op.match(/^_group/)) {
						var option_type1 = option_list[op]._type;
						if (!option_type1)
							option_type1 = "or";

						var sub = document_createElement("div");
						sub.classList.add("group");
						sub.id = setting + op;
						for (var op1 in option_list[op]) {
							if (!op1.match(/^_/))
								add_setting(sub, op1, option_list[op][op1], option_type1, op, option_type);
						}
						value_td.appendChild(sub);
					} else if (!op.match(/^_/)) {
						add_setting(value_td, op, option_list[op], option_type);
					}
				}
			} else if (type === "textarea") {
				var sub = document_createElement("table");
				var sub_tr = document_createElement("tr");
				var sub_ta_td = document_createElement("td");
				sub_ta_td.style.verticalAlign = "middle";
				//sub_ta_td.style.height = "1px";
				var sub_button_tr = document_createElement("tr");
				var sub_button_td = document_createElement("td");
				sub_button_td.style.textAlign = "center";
				//sub_button_td.style.verticalAlign = "middle";
				//sub_button_td.style.height = "1px";
				var textarea = document_createElement("textarea");
				textarea.style.height = "5em";
				textarea.style.width = "20em";
				if (value)
					textarea.value = value;
				var savebutton = document_createElement("button");
				savebutton.innerText = _("save");
				savebutton.onclick = function() {
					do_update_setting(setting, textarea.value, meta);

					// Background CSS style unlocks Background fade
					check_disabled_options();
					//settings[setting] = textarea.value;
				};

				sub_ta_td.appendChild(textarea);
				sub_button_td.appendChild(savebutton);
				sub_button_tr.appendChild(sub_button_td);
				sub_tr.appendChild(sub_ta_td);
				sub.appendChild(sub_tr);
				sub.appendChild(sub_button_tr);

				value_td.appendChild(sub);
			} else if (type === "number" || type === "lineedit") {
				var sub = document_createElement("table");
				var sub_tr = document_createElement("tr");
				var sub_in_td = document_createElement("td");
				sub_in_td.style = "display:inline";
				var input = document_createElement("input");

				if (false && type === "number") {
					// doesn't work properly on Waterfox, most of the functionality is implemented here anyways
					// thanks to decembre on github for reporting: https://github.com/qsniyg/maxurl/issues/14#issuecomment-531080061
					input.type = "number";
				} else {
					input.type = "text";
				}

				input.setAttribute("spellcheck", false);

				if (type === "number") {
					input.style = "text-align:right";
					if (meta.number_max !== void 0)
						input.setAttribute("max", meta.number_max.toString());
					if (meta.number_min !== void 0)
						input.setAttribute("min", meta.number_min.toString());
					if (meta.number_int)
						input.setAttribute("step", "1");
				}

				if (value !== void 0)
					input.value = value;

				input.oninput = input.onblur = function(e) {
					var need_correct = false;
					var do_update = true;
					if (e.type === "blur") {
						need_correct = true;
						do_update = false;
					}

					var value = input.value.toString();

					if (type === "number") {
						value = parseFloat(value);
						var orig_value = value;

						if (isNaN(value)) {
							if (!need_correct)
								return;

							value = 0;
						}

						if (meta.number_int) {
							value = parseInt(value);
						}

						if (meta.number_max !== void 0)
							value = Math_min(value, meta.number_max);
						if (meta.number_min !== void 0)
							value = Math_max(value, meta.number_min);

						if (isNaN(value)) {
							console_error("Error: number is NaN after min/max");
							return;
						}

						if (meta.number_int || value !== orig_value)
							input.value = value;

						value = parseFloat(value);

						if (e.type === "blur" && value !== orig_value) {
							do_update = true;
						}
					}

					if (do_update)
						do_update_setting(setting, value, meta);
				}

				var sub_units_td = document_createElement("td");
				//sub_units_td.style = "display:inline";
				sub_units_td.classList.add("number_units");
				if (meta.number_unit)
					sub_units_td.innerText = _(meta.number_unit);

				sub_tr.appendChild(input);
				sub_tr.appendChild(sub_units_td);
				sub.appendChild(sub_tr);
				value_td.appendChild(sub);
			} else if (type === "keysequence") {
				var sub = document_createElement("table");

				var values = deepcopy(value);

				if (values.length > 0 && !is_array(values[0]))
					values = [values];

				var indices = [];
				for (var i = 0; i < values.length; i++) {
					indices.push(i);
				}

				var is_only_keyseq = function() {
					var active_indices = 0;
					for (var i = 0; i < indices.length; i++) {
						if (indices[i] >= 0)
							active_indices++;
					}

					return active_indices < 2;
				};

				var update_keyseq_setting = function() {
					var result = [];

					for (var i = 0; i < indices.length; i++) {
						if (indices[i] >= 0 && values[i].length > 0) {
							result.push(values[i]);
						}
					}

					do_update_setting(setting, result, meta);
					check_disabled_options();
				};

				var recalculate_removebtns = function() {
					var do_remove = !meta.keyseq_allow_none && is_only_keyseq();

					for (var i = 0; i < sub.children.length; i++) {
						var child = sub.children[i];

						var removebtns = child.getElementsByClassName("removebtn");
						if (removebtns.length > 0) {
							if (do_remove) {
								removebtns[0].style.display = "none";
							} else {
								removebtns[0].style.display = "initial";
							}
						}
					}
				};

				var add_keyseq_tr = function(index, start_recording) {
					var sub_tr = document_createElement("tr");
					sub_tr.classList.add("keyseq");

					var sub_key_td = document_createElement("td");
					//sub_key_td.style = "display:inline;font-family:monospace";
					sub_key_td.classList.add("record_keybinding");
					if (value) {
						sub_key_td.innerText = get_trigger_key_texts(values)[index];
					}

					var sub_record_td = document_createElement("td");
					sub_record_td.style = "display:inline";

					var sub_record_btn = document_createElement("button");
					sub_record_btn.innerText = _("Record");

					var do_record = function() {
						if (recording_keys) {
							if (keysequence_valid(options_chord)) {
								values[index] = options_chord;
								update_keyseq_setting();
								//do_update_setting(setting, options_chord, meta);
								//settings[setting] = options_chord;

								do_cancel();
							}
						} else {
							options_chord = [];
							current_options_chord = [];
							recording_keys = function() {
								var our_chord = options_chord;
								if (our_chord.length === 0)
									our_chord = values[index];

								sub_key_td.innerText = get_trigger_key_texts(our_chord);

								if (keysequence_valid(options_chord)) {
									sub_record_btn.classList.remove("disabled");
								} else {
									sub_record_btn.classList.add("disabled");
								}
							};
							sub_record_btn.innerText = _("save");
							sub_cancel_btn.style = "display:inline-block";
						}
					};
					sub_record_btn.onmousedown = do_record;

					var sub_cancel_btn = document_createElement("button");
					sub_cancel_btn.innerText = _("Cancel");
					sub_cancel_btn.style = "display:none";

					var do_cancel = function() {
						recording_keys = false;
						sub_record_btn.innerText = _("Record");
						sub_record_btn.classList.remove("disabled");
						sub_cancel_btn.style = "display:none";
						sub_key_td.innerText = get_trigger_key_texts(values)[index];
					};
					sub_cancel_btn.onmousedown = do_cancel;

					var sub_remove_btn = document_createElement("button");
					//sub_remove_btn.innerText = "—";
					sub_remove_btn.innerText = "\xD7";
					sub_remove_btn.title = _("Remove");
					sub_remove_btn.classList.add("removebtn");
					sub_remove_btn.classList.add("small");

					if (!meta.keyseq_allow_none && is_only_keyseq()) {
						sub_remove_btn.style = "display:none";
					}

					sub_remove_btn.onclick = function() {
						if (!meta.keyseq_allow_none && is_only_keyseq())
							return;

						recording_keys = false;

						indices[index] = -1;
						for (var i = index + 1; i < indices.length; i++) {
							indices[i]--;
						}

						sub_tr.parentElement.removeChild(sub_tr);
						recalculate_removebtns();

						update_keyseq_setting();
					};

					sub_tr.appendChild(sub_key_td);
					sub_record_td.appendChild(sub_record_btn);
					sub_record_td.appendChild(sub_cancel_btn);
					sub_record_td.appendChild(sub_remove_btn);
					sub_tr.appendChild(sub_record_td);

					if (start_recording)
						do_record();

					return sub_tr;
				};

				for (var i = 0; i < indices.length; i++) {
					sub.appendChild(add_keyseq_tr(i));
				}

				var sub_add_tr = document_createElement("tr");
				var sub_add_td = document_createElement("td");
				var sub_add_btn = document_createElement("button");
				sub_add_btn.innerText = "+";
				sub_add_btn.title = _("Add keybinding");
				sub_add_btn.classList.add("small");
				sub_add_btn.onclick = function() {
					var last_index = -1;

					for (var i = indices.length - 1; i >= 0; i--) {
						if (indices[i] >= 0) {
							last_index = indices[i];
							break;
						}
					}

					indices.push(last_index + 1);
					values.push([]);

					sub.insertBefore(add_keyseq_tr(indices.length - 1, true), sub_add_tr);
					recalculate_removebtns();
				};
				sub_add_td.appendChild(sub_add_btn);
				sub_add_tr.appendChild(sub_add_td);

				sub.appendChild(sub_add_tr);
				value_td.appendChild(sub);
			} else if (type === "combo") {
				var sub = document_createElement("select");

				var null_option = null;
				for (var coption in meta.options) {
					if (!coption || coption[0] === '_')
						continue;

					var coption_obj = meta.options[coption];

					var trans_name = coption_obj.name;
					if (!("name_gettext" in coption_obj) || coption_obj.name_gettext) {
						trans_name = _(trans_name);
					}
					var optionid = "input_" + setting + "_" + coption;
					label_texts[optionid] = trans_name;

					var optionel = document_createElement("option");
					optionel.innerText = trans_name;
					optionel.value = coption;
					optionel.id = optionid;

					if (coption_obj.description) {
						optionel.title = _(coption_obj.description);
					}

					if (coption_obj.is_null)
						null_option = coption;

					sub.appendChild(optionel);
				}

				var sub_value = settings[setting];
				if (sub_value === null && null_option) {
					sub_value = null_option;
				}
				sub.value = sub_value;

				sub.onchange = function() {
					var value = sub.value;
					if (value in meta.options && meta.options[value].is_null) {
						value = null;
					}

					do_update_setting(setting, value, meta);

					check_disabled_options();
					show_warnings();
				};

				value_td.appendChild(sub);
			}

			tr.appendChild(value_td);

			option.appendChild(table);

			if (description && settings.settings_visible_description) {
				var description_el = document_createElement("p");
				md_to_html(description_el, description);
				//description_el.innerText = description;
				description_el.classList.add("description");

				option.appendChild(description_el);
			}

			if (meta.warning) {
				var warning = document_createElement("p");
				warning.style.display = "none";
				warning.classList.add("warning");

				option.appendChild(warning);
			}

			var requirements = document_createElement("div");
			//requirements.style.display = "none";
			requirements.classList.add("requirements");
			requirements.classList.add("hidden");
			option.appendChild(requirements);

			if (meta.example_websites) {
				var examples = document_createElement("ul");
				examples.classList.add("examples");
				for (var example_i = 0; example_i < meta.example_websites.length; example_i++) {
					var example_text = meta.example_websites[example_i];
					var example_el = document_createElement("li");
					example_el.innerText = _(example_text);
					examples.appendChild(example_el);
				}

				option.appendChild(examples);
			}

			if (meta.documentation) {
				var get_title = function(expanded) {
					// ⯈
					var arrow = "%E2%AF%88";
					if (expanded) {
						// ⯆
						arrow = "%E2%AF%86";
					}

					return decodeURIComponent(arrow) + " " + _(meta.documentation.title);
				};

				var text = get_title(false);

				var spoiler_title = document_createElement("span");
				spoiler_title.classList.add("spoiler-title");
				spoiler_title.innerText = text;

				var expanded = false;
				spoiler_title.onclick = function() {
					expanded = !expanded;

					if (expanded) {
						spoiler_contents.style.display = "block";
					} else {
						spoiler_contents.style.display = "none";
					}

					spoiler_title.innerText = get_title(expanded);
				};

				var spoiler_contents = document_createElement("div");
				spoiler_contents.classList.add("spoiler-contents");
				spoiler_contents.style.display = "none";
				spoiler_contents.innerHTML = meta.documentation.value;

				option.appendChild(spoiler_title);
				option.appendChild(spoiler_contents);
			}

			var errordiv = document_createElement("div");
			errordiv.classList.add("error");
			errordiv.classList.add("hidden");
			option.appendChild(errordiv);

			if (meta.category) {
				var subcat = meta.category;
				if (meta.subcategory)
					subcat += "_" + meta.subcategory;

				subcategory_els[subcat].appendChild(option);
			} else {
				options_el.appendChild(option);
			}
		};

		var settingslist = Object.keys(settings);
		if (settings.settings_alphabetical_order) {
			settingslist.sort(function(a, b) {
				var a_meta = settings_meta[a];
				var b_meta = settings_meta[b];

				if (!a_meta || !b_meta || !a_meta.name || !b_meta.name) {
					return a.localeCompare(b);
				}

				return _(a_meta.name).localeCompare(_(b_meta.name));
			});
		}

		for (var i = 0; i < settingslist.length; i++) {
			add_setting_dom(settingslist[i]);
		}

		check_disabled_options();
		show_warnings();

		for (var category in category_els) {
			var our_els = category_els[category]

			if (!(category in category_settings)) {
				for (var i = 0; i < our_els.length; i++) {
					our_els[i].parentNode.removeChild(our_els[i])
				}
			}
		}

		for (var subcategory in subcategory_els) {
			var our_el = subcategory_els[subcategory];

			if (our_el.querySelectorAll(".option").length === 0) {
				our_el.parentNode.removeChild(our_el);
			}
		}

		document.body.appendChild(saved_el);
		options_el_real.appendChild(options_el);
		options_el = options_el_real as any as DocumentFragment;
	}

	function get_single_setting_raw(value) {
		if (is_array(value))
			return value[0];
		return value;
	}

	function get_single_setting(setting) {
		return get_single_setting_raw(settings[setting]);
	}

	function parse_value(value) {
		try {
			// undefined (void 0), "true" and "false" are the most common ones, let's avoid calling JSON_parse unless necessary
			// this improves performance
			if (value === void 0) {
				return value;
			} else if (value === "true") {
				return true;
			} else if (value === "false") {
				return false;
			}

			return JSON_parse(value);
		} catch (e) {
			return value;
		}
	}

	function serialize_value(value) {
		return JSON_stringify(value);
	}

	// needed for guerillajs (pale moon)
	var gm_nonexistent_is_null = null;
	function gm_check_nonexistent() {
		if (gm_nonexistent_is_null !== null)
			return gm_nonexistent_is_null;

		gm_nonexistent_is_null = GM_getValue("nonexistent_value_abcdefg", void 0) === null;
		return gm_nonexistent_is_null;
	}

	function gm_getvalue_wrap(key) {
		var value = GM_getValue(key, void 0);
		if (value === null && gm_check_nonexistent())
			value = void 0;
		return value;
	}

	function get_values(keys, cb) {
		if (is_extension) {
			extension_send_message({
				type: "getvalue",
				data: keys
			}, function(response) {
				response = response.data;

				obj_foreach(response, function(key, value) {
					response[key] = parse_value(value);
				});

				cb(response);
			});
		} else if (typeof GM_getValue !== "undefined" &&
				   // Unfortunately FireMonkey currently implements GM_getValue as a mapping to GM.getValue for some reason
				   //   https://github.com/erosman/support/issues/98
				   // Until this is fixed, we cannot use GM_getValue for FireMonkey
				   userscript_manager !== "FireMonkey") {
			var response = {};
			array_foreach(keys, function(key) {
				response[key] = parse_value(gm_getvalue_wrap(key));
			});

			return cb(response);
		} else if (typeof GM !== "undefined" && GM.getValue) {
			var total_keys = 0;
			var response = {};

			array_foreach(keys, function(key) {
				GM.getValue(key, void 0).then(function(value) {
					response[key] = parse_value(value);

					if (++total_keys >= keys.length) {
						cb(response);
					}
				}, function(error) {
					console_error(error);

					if (++total_keys >= keys.length) {
						cb(response);
					}
				});
			});
		} else {
			cb({});
		}
	}

	function get_value(key, cb) {
		return get_values([key], function(data) {
			return cb(data[key]);
		});
	}

	var updating_options = 0;
	function set_value(key, value, cb?:()=>void) {
		if (key in settings_meta && settings_meta[key].onedit) {
			settings_meta[key].onedit(value);
		}

		value = serialize_value(value);
		//console_log("Setting " + key + " = " + value);

		if (is_extension) {
			var kv = {};
			kv[key] = value;
			//chrome.storage.sync.set(kv, function() {});
			updating_options++;
			extension_send_message({
				type: "setvalue",
				data: kv
			}, function() {
				updating_options--;

				cb && cb();
			});
		} else if (typeof GM_setValue !== "undefined") {
			GM_setValue(key, value);

			cb && cb();
		} else if (typeof GM !== "undefined" && GM.setValue) {
			GM.setValue(key, value).then(function() {
				cb && cb();
			});
		} else {
			cb && cb();
		}
	}

	function update_setting(key, value) {
		if (value === settings[key])
			return false;

		value = deepcopy(value);
		settings[key] = value;

		if (is_extension) {
			if (!(key in settings_history))
				settings_history[key] = [];

			settings_history[key].push(value);
		}

		set_value(key, value);
		return true;
	}

	function set_default_value(key, value) {
		if (!(key in user_defined_settings)) {
			settings[key] = value;
		}
	}

	function settings_updated_cb(changes) {
		if (!settings.allow_live_settings_reload)
			return;

		//console_log(message);
		var changed = false;

		for (var key in changes) {
			if (changes[key].newValue === void 0)
				continue;

			//console_log("Setting " + key + " = " + changes[key].newValue);
			var newvalue = JSON_parse(changes[key].newValue);
			if (key in settings_history) {
				var index = array_indexof(settings_history[key], newvalue);

				var pass = false
				if (index >= 0 && index < settings_history[key].length - 1) {
					pass = true;
				}

				settings_history[key].splice(index, 1);

				if (pass)
					continue;
			}

			var setting_updated = update_setting_from_host(key, newvalue);
			changed = setting_updated || changed;

			if (setting_updated && key in settings_meta && "onupdate" in settings_meta[key]) {
				settings_meta[key].onupdate();
			}
		}

		if (changed && updating_options <= 0 && is_options_page) {
			//console_log("Refreshing options");
			do_options();
		}
	};

	function upgrade_settings_with_version(version, new_settings, cb) {
		if (!version) {
			version = 0;
		} else if (typeof version !== "number") {
			version = parseInt(version);
			if (isNaN(version))
				version = 0;
		}

		if (new_settings === void 0)
			new_settings = settings;

		var changed = false;

		if (version === 0) {
			if (new_settings.mouseover_trigger) {
				var trigger_keys = [];
				for (var i = 0; i < new_settings.mouseover_trigger.length; i++) {
					var trigger = new_settings.mouseover_trigger[i];
					if (trigger.match(/^delay_[0-9]+/)) {
						var delay:number|false = parse_int(new_settings.mouseover_trigger[i].replace(/^delay_([0-9]+).*?$/, "$1"));
						if (delay <= 0 || isNaN(delay))
							delay = false;
						if (typeof delay === "number" && delay >= 10)
							delay = 10;
						update_setting("mouseover_trigger_delay", delay);
						continue;
					}

					trigger_keys.push(trigger);
				}

				if (trigger_keys.length === 0) {
					update_setting("mouseover_trigger_key", orig_settings["mouseover_trigger_key"]);
					update_setting("mouseover_trigger_behavior", "mouse");
				} else {
					update_setting("mouseover_trigger_key", trigger_keys);
					update_setting("mouseover_trigger_behavior", "keyboard");
				}
			}

			update_setting("settings_version", 1);
			changed = true;

			version = 1;
		}

		if (version === 1) {
			var partial_setting = "none";
			var partial_setting_set = new_settings.mouseover_use_fully_loaded_video !== void 0 ||
									  new_settings.mouseover_use_fully_loaded_image !== void 0;

			if (partial_setting_set) {
				if (new_settings.mouseover_use_fully_loaded_video === false ||
					new_settings.mouseover_use_fully_loaded_video === void 0) {
					partial_setting = "video";
				}

				if (new_settings.mouseover_use_fully_loaded_image === void 0) {
					if (!(orig_settings as any).mouseover_use_fully_loaded_image) {
						partial_setting = "media";
					}
				} else if (new_settings.mouseover_use_fully_loaded_image === false) {
					partial_setting = "media";
				}

				update_setting("mouseover_allow_partial", partial_setting);
			}

			update_setting("settings_version", 2);
			changed = true;

			version = 2;
		}

		if (version === 2) {
			if ("mouseover_close_on_leave_el" in new_settings) {
				var policy;

				if (new_settings.mouseover_close_on_leave_el) {
					policy = "both";
				} else {
					policy = "popup";
				}

				update_setting("mouseover_close_el_policy", policy);
			}

			update_setting("settings_version", 3);
			changed = true;

			version = 3;
		}

		if (version === 3) {
			if ("mouseover_scroll_behavior" in new_settings) {
				if (get_single_setting_raw(new_settings.mouseover_scroll_behavior) !== "zoom") {
					update_setting("mouseover_scrollx_behavior", new_settings.mouseover_scroll_behavior);
				}

				update_setting("mouseover_scrolly_behavior", new_settings.mouseover_scroll_behavior);
			}

			update_setting("settings_version", 4);
			changed = true;

			version = 4;
		}

		if (version === 4) {
			if ("mouseover_mask_styles" in new_settings && new_settings.mouseover_mask_styles) {
				update_setting("mouseover_mask_styles2", new_settings.mouseover_mask_styles);
				update_setting("mouseover_enable_mask_styles", true);
			}

			update_setting("settings_version", 5);
			changed = true;

			version = 5;
		}

		if (version === 5) {
			if ("mouseover_video_seek_vertical_scroll" in new_settings && new_settings.mouseover_video_seek_vertical_scroll) {
				update_setting("mouseover_scrolly_video_behavior", "seek");
			}

			if ("mouseover_video_seek_horizontal_scroll" in new_settings && new_settings.mouseover_video_seek_horizontal_scroll) {
				update_setting("mouseover_scrollx_video_behavior", "seek");
			}

			update_setting("settings_version", 6);
			changed = true;

			version = 6;
		}

		if (version === 6) {
			if ("mouseover_support_pointerevents_none" in new_settings && new_settings.mouseover_support_pointerevents_none) {
				update_setting("mouseover_find_els_mode", "full");
			}

			update_setting("settings_version", 7);
			changed = true;

			version = 7;
		}

		if (version === 7) {
			if ("mouseover_enable_mask_styles" in new_settings && new_settings.mouseover_enable_mask_styles) {
				update_setting("mouseover_enable_mask_styles2", "always");
			}

			update_setting("settings_version", 8);
			changed = true;

			version = 8;
		}

		if (version === 8) {
			if ("allow_video" in new_settings && !new_settings.allow_video) {
				update_setting("mouseover_allow_video", false);
				for (var i = 0; i < num_profiles; i++) {
					update_setting("t" + (i + 2) + "_mouseover_allow_video", false);
				}
				update_setting("redirect_video", false);
			}

			update_setting("settings_version", 9);
			changed = true;

			version = 9;
		}

		if (version === 9) {
			if ("allow_audio" in new_settings && new_settings.allow_audio) {
				update_setting("mouseover_allow_audio", true);
				for (var i = 0; i < num_profiles; i++) {
					update_setting("t" + (i + 2) + "_mouseover_allow_audio", true);
				}
				update_setting("redirect_audio", true);
			}

			update_setting("settings_version", 10);
			changed = true;

			version = 10;
		}

		if (version === 10) {
			if ("replaceimgs_remove_size_constraints" in new_settings && new_settings.replaceimgs_remove_size_constraints) {
				update_setting("replaceimgs_size_constraints", "remove");
			}

			update_setting("settings_version", 11);
			changed = true;

			version = 11;
		}

		cb(changed);
	}

	function upgrade_settings(cb) {
		try {
			create_blacklist_regexes();
			create_host_blacklist_regexes();
			create_host_html_blacklist_regexes();
		} catch(e) {
			console_error(e);
		}

		if (!settings.last_update_check) {
			update_setting("last_update_check", Date.now());
		}

		check_updates_if_needed();

		// TODO: merge this get_value in do_config for performance
		get_value("settings_version", function(version) {
			upgrade_settings_with_version(version, settings, cb);
		});
	}

	function update_setting_from_host(setting, value) {
		if (value !== void 0) {
			if (typeof settings[setting] === "number") {
				value = parseFloat(value);
			}

			user_defined_settings[setting] = value;

			if (value !== settings[setting]) {
				settings[setting] = value;
				return true;
			}
		}

		return false;
	}

	function do_config() {
		if (_nir_debug_) {
			console_log("do_config");
		}

		if (is_userscript || is_extension) {
			var settings_done = 0;
			var total_settings = Object.keys(settings).length + old_settings_keys.length;

			var add_value_change_listeners = function(cb) {
				if (typeof GM_addValueChangeListener === "undefined") {
					return cb();
				}

				// run in timeout to prevent this from further delaying initial page load times
				// takes ~2-3ms. not huge, but still significant
				setTimeout(function() {
					for (var setting in settings) {
						GM_addValueChangeListener(setting, function(name, oldValue, newValue, remote) {
							if (remote === false)
								return;

							var updated = {};
							updated[name] = {newValue: newValue};
							settings_updated_cb(updated);
						});
					}
				}, 1);

				cb();
			};

			var process_settings = function(settings) {
				get_values(settings, function(values) {
					// not Object.keys(values).length, because it may be smaller
					settings_done += settings.length;

					obj_foreach(values, function(key, value) {
						update_setting_from_host(key, value);
					});

					if (settings_done >= total_settings) {
						upgrade_settings(function(value) {
							add_value_change_listeners(function() {
								start(/*value*/); // commenting out because start doesn't need any arguments
							});
						});
					}
				});
			};

			process_settings(Object.keys(settings));
			process_settings(old_settings_keys);
		} else {
			start();
		}
	}

	var can_use_subzindex = true;

	try {
		// uBlock Origin: div > div[style*="z-index:"]
		if (/^[a-z]+:\/\/[^/]*txxx\.com\//.test(window.location.href)) {
			can_use_subzindex = false;
		}
	} catch (e) {}

	function set_el_all_initial(el) {
		if (can_use_subzindex) {
			el.style.all = "initial";
		} // removing zIndex doesn't work if all = "initial";

		// Under Waterfox, if offsetInlineStart is set to anything (even unset), it'll set the left to 0
		// Thanks to decembre on github for reporting this: https://github.com/qsniyg/maxurl/issues/14#issuecomment-531080061
		el.style.removeProperty("offset-inline-start");

		// https://developer.chrome.com/en/blog/tablesng/ breaks without this with reduced-motion, thanks to Noodlers for reporting
		el.style.setProperty("transition-duration", "0s", "important");
	}

	function check_bad_if(badif, resp) {
		if (_nir_debug_)
			console_log("check_bad_if", badif, resp);

		if (!badif || !is_array(badif) || badif.length === 0) {
			if (_nir_debug_)
				console_log("check_bad_if (!badif)");
			return false;
		}

		var headers = parse_headers(resp.responseHeaders);

		var check_single_badif = function(badif) {
			if (badif.headers) {
				for (var header in badif.headers) {
					var header_lower = header.toLowerCase();

					var found = false;
					for (var i = 0; i < headers.length; i++) {
						if (headers[i].name.toLowerCase() === header_lower) {
							if (typeof (badif.headers[header]) === "function") {
								found = badif.headers[header](headers[i].value);
							} else if (typeof (badif.headers[header]) === "string") {
								found = headers[i].value === badif.headers[header];
							}

							if (found) {
								break;
							} else {
								return false;
							}
						}
					}

					if (!found)
						return false;
				}
			}

			return true;
		};

		for (var j = 0; j < badif.length; j++) {
			if (check_single_badif(badif[j]))
				return true;
		}

		return false;
	}
	(bigimage_recursive as any).check_bad_if = check_bad_if;

	var mediadelivery_support = {};

	var is_probably_video = function(obj) {
		//console_log(obj);
		if (obj.media_info && obj.media_info.type === "video")
			return true;

		if (/\.(?:mp4|webm|mkv|mpg|ogv|wmv|m3u8|mpd)(?:[?#].*)?$/i.test(obj.url))
			return true;

		return false;
	};

	var is_probably_audio = function(obj) {
		//console_log(obj);
		if (obj.media_info && obj.media_info.type === "audio")
			return true;

		if (/\.(?:mp3|m4a|oga|mkv|wma|mp4|ogg)(?:[?#].*)?$/i.test(obj.url))
			return true;

		return false;
	};

	var is_probably_stream = function(obj) {
		return is_probably_video(obj) || is_probably_audio(obj);
	};

	var get_delivery_from_url = function(url) {
		var split_ext = url_basename(url, {split_ext: true});

		if (split_ext[1] === "mpd")
			return "dash";

		if (split_ext[1] === "m3u8")
			return "hls";

		return null;
	}

	var get_mediainfo_from_contenttype = function(contenttype) {
		contenttype = contenttype.replace(/^\s*\[?\s*(.*?)\s*\]?\s*$/, "$1");

		var mediainfo = {
			type: null,
			delivery: null
		};

		if (/^audio\//.test(contenttype)) mediainfo.type = "audio";
		if (/^video\//.test(contenttype)) mediainfo.type = "video";
		if (contenttype === "application/oga") mediainfo.type = "audio";
		if (contenttype === "application/ogv") mediainfo.type = "video";
		if (contenttype === "application/ogg") mediainfo.type = "video"; // FIXME?
		if (contenttype === "application/x-mpegurl") {
			mediainfo.type = "video"; // FIXME?
			mediainfo.delivery = "hls";
		}

		return mediainfo.type ? mediainfo : null;
	};

	var is_media_type_supported = function(media_info:InfoMediaInfo, processing) {
		if (!media_info) {
			console_error("is_media_type_supported called without media_info");
			return true;
		}

		if (media_info.type !== "image" && media_info.type !== "video" && media_info.type !== "audio") {
			return false;
		}

		if (media_info.type === "video" && processing.deny_video) {
			return false;
		}

		if (media_info.type === "audio" && processing.deny_audio) {
			return false;
		}

		if (media_info.codec === "hevc") {
			if (!processing.browser_viewable)
				return true;

			// TODO: check for HEVC support
			return false;
		}

		if (!media_info.delivery) {
			return true;
		}

		if (media_info.need_custom_xhr) {
			if (!settings.custom_xhr_for_lib)
				return false;
		}

		if (media_info.delivery) {
			if (media_info.delivery in mediadelivery_support) {
				if (mediadelivery_support[media_info.delivery].active()) {
					return true;
				}
			}
		}

		return false;
	};

	function get_event_error(e) {
		// https://stackoverflow.com/a/46064096
		var error = e;

		if (e.path && e.path[0]) {
			error = e.path[0].error;
		}

		if (e.originalTarget) {
			error = e.originalTarget.error;
		}

		return error;
	}

	var trigger_gallery;

	var override_request = function(data, obj) {
		if (!data.method) data.method = "GET";

		if (!data.headers) data.headers = {};

		if (obj.headers) {
			for (var header in obj.headers) {
				headerobj_set(data.headers, header, obj.headers[header]);
			}
		}

		if (data.url === obj.url) {
			if (!obj.can_head && data.method === "HEAD") {
				data.method = "GET";
			}
		}

		//console_log(data);

		return data;
	};

	var set_common_el_properties = function(el, obj) {
		if (settings.popup_use_anonymous_crossorigin || (obj && !obj.need_credentials)) {
			el.setAttribute("crossorigin", "anonymous");
		}
	};

	function serialize_img(img) {
		var obj = {
			tag: img.tagName.toLowerCase(),
			src: img.src,
			autoplay: img.getAttribute("autoplay"),
			controls: img.getAttribute("controls"),
			loop: img.getAttribute("loop"),
			muted: img.muted,
			volume: img.volume
		};

		if (img.hasAttribute("crossorigin")) {
			obj["crossorigin"] = img.getAttribute("crossorigin");
		}

		return obj;
	}

	function deserialize_img(obj, cb) {
		var el = document_createElement(obj.tag);

		if (obj.tag === "video" || obj.tag === "audio") {
			if (obj.autoplay) el.setAttribute("autoplay", obj.autoplay);
			if (obj.controls) el.setAttribute("controls", obj.controls);
			if (obj.loop) el.setAttribute("loop", obj.loop)
			if (obj.muted) el.muted = obj.muted;
			if (obj.volume !== void 0) el.volume = obj.volume;

			el.onloadedmetadata = function() {
				cb(el);
			};
		}

		if (obj.crossorigin) el.setAttribute("crossorigin", obj.crossorigin);

		el.src = obj.src;

		if (obj.tag !== "video" && obj.tag !== "audio") {
			cb(el);
		}
	}

	var get_image_dims = function(image:HTMLImageElement) {
		let dims = {
			height: image.naturalHeight,
			width: image.naturalWidth
		};

		if (!image.complete || (dims.height && dims.width)) {
			return dims;
		}

		// Firefox returns a width of 0 for SVGs (https://github.com/qsniyg/maxurl/issues/1243)
		let newimg = new Image();
		set_el_all_initial(newimg);
		newimg.style.margin = "0";
		newimg.style.padding = "0";
		newimg.style.visibility = "hidden";

		newimg.src = image.src;

		document.documentElement.appendChild(newimg);
		dims = {
			width: newimg.offsetWidth,
			height: newimg.offsetHeight
		};
		document.documentElement.removeChild(newimg);

		return dims;
	};

	var get_window_url = function() {
		return native_URL;// || window.URL || window.webkitURL;
	};

	var create_dataurl = function(blob, cb) {
		var a = new FileReader();
		a.onload = function(e) {
			try {
				cb(e.target.result);
			} catch (e) {
				console_error(e);
				console_error(e.stack);
				cb(null);
			}
		};
		a.readAsDataURL(blob);
	};

	var create_objecturl = function(blob) {
		return get_window_url().createObjectURL(blob);
	};

	var revoke_objecturl = function(objecturl) {
		if (is_element(objecturl))
			objecturl = objecturl.src;

		return get_window_url().revokeObjectURL(objecturl);
	};

	var is_video_el = function(el) {
		if (el.tagName === "VIDEO")
			return true;

		if (el.tagName !== "SOURCE")
			return false;

		if (el.parentElement && el.parentElement.tagName === "VIDEO")
			return true;
		return false;
	};

	var el_media_type_single = function(el) {
		if (!el) return null;

		var tagname = get_tagname(el);

		if (tagname === "VIDEO") return "video";
		if (tagname === "AUDIO") return "audio";
		if (tagname === "PICTURE" || tagname === "IMG") return "image";

		return null;
	};

	var el_media_type = function(el) {
		var single = el_media_type_single(el);
		if (single) return single;

		if (get_tagname(el) === "SOURCE") return el_media_type_single(el.parentElement);

		return null;
	}

	var destroy_image = function(image) {
		if (_nir_debug_)
			console_log("destroy_image", image);

		// TODO: maybe check to make sure it's a blob? according to the spec, this will silently fail, but browsers may print an error
		revoke_objecturl(image.src);
		image.setAttribute("imu-destroyed", "true");
	};

	let preprocess_subtitles = function(subtitles) {
		let newsubs = deepcopy(subtitles);

		// https://en.wikipedia.org/wiki/IETF_language_tag
		const langcodemap = {
			"arabic": "ar",
			"العربية": "ar",
			"bengali": "bn",
			"বাংলা": "bn",
			"german": "de",
			"deutsch": "de",
			"english": "en",
			"spanish": "es",
			"español": "es",
			"espanol": "es",
			"french": "fr",
			"français": "fr",
			"francais": "fr",
			"hindi": "hi",
			"हिंदी": "hi",
			"italian": "it",
			"italiano": "it",
			"korean": "ko",
			"한국어": "ko",
			"polish": "pl",
			"polski": "pl",
			"portuguese": "pt",
			"português": "pt",
			"portugues": "pt",
			"russian": "ru",
			"русский": "ru",
			"thai": "th",
			"ไทย": "th",
			"turkish": "tr",
			"türkçe": "tr",
			"turkce": "tr",
			"chinese": "zh",
			"中文": "zh"
		};

		for (let sub of newsubs) {
			if (!sub.language_code && sub.title) {
				let title = strip_whitespace(sub.title.toLowerCase());
				if (!(title in langcodemap)) {
					title = strip_whitespace(title.replace(/[ (].*$/, ""));
				}

				if (title in langcodemap) {
					sub.language_code = langcodemap[title];
				}
			}

			if (sub.language_code)
				sub.simple_language_code = sub.language_code.replace(/-.*/, "");
		}

		let user_langs = ["en"];

		// in case of anti-fingerprinting?
		try {
			user_langs = deepcopy(navigator.languages);
		} catch (e) {
			console_error(e);
		}

		for (let i = 0; i < user_langs.length; i++) {
			user_langs[i] = user_langs[i].replace(/-.*/, "");
		}

		let best_subs = shallowcopy_array(newsubs).sort(function(a, b) {
			let ai = array_indexof(user_langs, a.simple_language_code);
			let bi = array_indexof(user_langs, b.simple_language_code);

			if (ai < 0) ai = 9999;
			if (bi < 0) bi = 9999;

			return ai - bi;
		});

		console_log(user_langs, best_subs);

		if (best_subs.length > 0 && best_subs[0].simple_language_code === user_langs[0]) {
			best_subs[0].default = true;
		}

		return newsubs;
	};

	var create_streaming_el = function(obj, type, processing, good_cb, err_cb) {
		var video = document_createElement(type);

		set_common_el_properties(video, obj);

		if (settings.mouseover_video_autoplay)
			video.setAttribute("autoplay", "autoplay");

		if (settings.mouseover_video_controls || type === "audio")
			video.setAttribute("controls", "controls");

		if (settings.mouseover_video_loop && !settings.mouseover_gallery_move_after_video)
			video.setAttribute("loop", true);

		var volume = parseInt(settings.mouseover_video_volume);
		volume = Math_max(Math_min(volume, 100), 0);
		video.volume = volume / 100.;

		if (settings.mouseover_video_muted) {
			video.muted = true;
		}

		var remove_loaded_metadata_listener = function() {
			video.onloadedmetadata = null;
			video.removeEventListener("loadedmetadata", loaded_metadata_listener);
		};

		var errorhandler = function(e) {
			console_error("Error loading video", get_event_error(e));

			remove_loaded_metadata_listener();
			err_cb();
		};

		var ran_loadedmetadata_listener = false;
		var loaded_metadata_listener = function() {
			if (!ran_loadedmetadata_listener) {
				ran_loadedmetadata_listener = true;
			} else {
				return;
			}

			video.removeEventListener("error", errorhandler, true);
			remove_loaded_metadata_listener();

			if (!processing.running) {
				return err_cb(true);
			}

			if (obj.subtitles) {
				let subs = preprocess_subtitles(obj.subtitles);
				for (let sub of subs) {
					let trackel = document_createElement("track");
					trackel.setAttribute("kind", "captions");
					trackel.setAttribute("src", sub.url);
					if (sub.language_code)
						trackel.setAttribute("srclang", sub.language_code);
					trackel.setAttribute("label", sub.title);
					video.appendChild(trackel);
					if (sub.default) {
						trackel.setAttribute("default", "default");
					}
				}
			}

			if (video.hasAttribute("loop")) {
				if (settings.mouseover_video_autoloop_max && settings.mouseover_video_autoloop_max < video.duration)
					video.removeAttribute("loop");
			}

			var source_video = null;

			if (processing.source && processing.source.el) {
				var source_el = processing.source.el;

				if (source_el.tagName === "SOURCE") {
					source_el = source_el.parentElement;
				}

				if (source_el.tagName === "VIDEO") {
					source_video = source_el;
				}
			}

			if (settings.mouseover_video_resume_from_source && source_video && source_video.currentTime) {
				// https://github.com/qsniyg/maxurl/issues/256
				if (settings.mouseover_video_resume_if_different ||
					Math_abs(source_video.duration - video.duration) < 1 || Math_abs(1 - (source_video.duration / video.duration)) < 0.01) {
					video.currentTime = source_video.currentTime;
				}
			}

			if (settings.mouseover_video_pause_source && source_video) {
				source_video.pause();
			}

			run_soon(function() {
				good_cb(video)
			});
		};

		video.onloadedmetadata = loaded_metadata_listener;
		video.addEventListener("loadedmetadata", loaded_metadata_listener);

		video.onended = function() {
			if (settings.mouseover_enable_gallery && settings.mouseover_gallery_move_after_video) {
				trigger_gallery(1);
			}
		};

		video.addEventListener("error", errorhandler, true);

		return video;
	};

	var create_image_el = function(obj, good_cb, err_cb) {
		var img = document_createElement("img");
		set_common_el_properties(img, obj);

		var end_cbs = function () {
			clearInterval(height_interval);
			img.onload = null;
			img.onerror = null;
		};

		img.onload = function () {
			end_cbs();

			let dims = get_image_dims(img);
			if (dims.width === 0 || dims.height === 0) {
				if (_nir_debug_)
					console_log("naturalWidth or naturalHeight == 0", img);

				return err_cb();
			}

			good_cb(img);
		};

		img.onerror = function (e) {
			if (_nir_debug_)
				console_log("Error loading image", img, e);

			end_cbs();
			err_cb();
		};

		var height_interval = setInterval(function () {
			if (img.naturalWidth !== 0 && img.naturalHeight !== 0) {
				end_cbs();
				good_cb(img);
			}
		}, 15);

		return img;
	};

	var set_direct_src = function(el, src, info_obj) {
		if (!el) return;

		var set_src = function(el, src) {
			el.src = src;
		};

		var is_incomplete = typeof src === "string" && /^https?:\/\//i.test(src);

		if (is_extension && is_incomplete) {
			extension_send_message({
				type: "override_next_headers",
				data: {
					url: src,
					method: "GET",
					headers: info_obj.headers,
					anonymous: el.getAttribute("crossorigin") === "anonymous",
					content_type: info_obj.content_type || null
				}
			}, function() {
				set_src(el, src);
			});
		} else {
			set_src(el, src);
		}
	};

	var create_media_el = function(obj, type, processing, good_cb, err_cb) {
		if (type === "image") {
			return create_image_el(obj, good_cb, err_cb);
		} else if (type === "video" || type === "audio") {
			return create_streaming_el(obj, type, processing, good_cb, err_cb);
		} else {
			console_error("Currently unsupported media type", type);
			err_cb();
			return null;
		}
	};

	// TODO: maybe move to a generic reference class, like Cache?
	var check_image_refs = new_map();
	var check_image_ref = function(image) {
		if (map_has(check_image_refs, image)) {
			var refs = map_get(check_image_refs, image);
			refs++;
			map_set(check_image_refs, image, refs);
		} else {
			map_set(check_image_refs, image, 1);
		}
	};

	var check_image_unref = function(image) {
		if (!map_has(check_image_refs, image))
			return;

		var refs = map_get(check_image_refs, image);
		refs--;

		if (refs <= 0) {
			destroy_image(image);
			map_remove(check_image_refs, image);
		} else {
			map_set(check_image_refs, image, refs);
		}
	};

	var check_image_cache = null;
	var check_image_cbs = {};
	function check_image_get(obj, cb, processing) {
		nir_debug("check_image_get", "check_image_get", deepcopy(obj), cb, deepcopy(processing));

		if (!obj || !obj[0] || !obj[0].url) {
			return cb(null);
		}

		if (!processing.running) {
			return cb(null);
		}

		var err_cb_real = function(_no_propagate?) {
			revoke_objecturl(last_objecturl);
			obj.shift();

			nir_debug("check_image_get", "check_image_get(err_cb):", obj, processing);

			return check_image_get(obj, cb, processing);
		};
		var err_cb = err_cb_real;

		if (processing.set_cache || processing.use_cache) {
			if (!check_image_cache) {
				var maximum_items = settings.popup_cache_itemlimit;
				if (maximum_items <= 0)
					maximum_items = null;

				check_image_cache = new IMUCache({
					max_keys: maximum_items,
					destructor: function(key, value) {
						if (value && value.img)
							check_image_unref(value.img);
					}
				});
			}
		}

		// this happens for waiting: true images, such as private Flickr images (thanks to fireattack for reporting)
		// FIXME: a better fix would be to always fillobj, including for waiting: true
		if (!obj[0].media_info) {
			console_warn("No media info", obj[0]);
			obj[0].media_info = deepcopy(default_object.media_info);
			//return err_cb();
		}

		// do this before cache, in case settings change
		if (!is_media_type_supported(obj[0].media_info, processing)) {
			console_warn("Media type", obj[0].media_info, "is not supported");
			return err_cb();
		}

		if (processing.use_cache) {
			if (check_image_cache.has(obj[0].url)) {
				var cached_result = check_image_cache.get(obj[0].url);

				nir_debug("check_image_get", "check_image_get(cached):", cached_result.img, cached_result.resp, obj[0]);

				var img = cached_result.img;
				var destroyed = false;
				if (img) {
					if ((img.tagName === "VIDEO" || img.tagName === "AUDIO") && !settings.popup_cache_resume_video) {
						img.currentTime = cached_result.currentTime || 0;
					}

					if (img.hasAttribute("imu-destroyed"))
						destroyed = true;
				}

				if (!destroyed) {
					if (cached_result.filesize && !obj[0].filesize) {
						obj[0].filesize = cached_result.filesize;
					}

					if (processing.head) {
						cb(cached_result.resp, obj[0]);
					} else {
						cb(cached_result.img, cached_result.resp.finalUrl, obj[0], cached_result.resp);
					}

					return;
				}
			}
		}

		var method = "GET";
		var responseType = "blob";
		var last_objecturl = null;

		var obj_is_probably_video = is_probably_video(obj[0]);
		var obj_is_probably_stream = is_probably_stream(obj[0]);
		var incomplete_request = false;
		if (processing.incomplete_image || (obj_is_probably_stream && processing.incomplete_video) || processing.head)
			incomplete_request = true;

		if (obj[0].need_blob || obj[0].need_data_url)
			incomplete_request = false;

		if (obj_is_probably_stream && !obj[0].media_info.delivery) {
			obj[0].media_info.delivery = get_delivery_from_url(obj[0].url);
		}

		if (processing.head || incomplete_request) {
			if (incomplete_request && !obj[0].can_head) {
				method = "GET";
			} else {
				method = "HEAD";
			}

			responseType = void 0;
		}

		if (obj[0].url.match(/^data:/) && !obj[0].media_info.delivery) {
			var img = document_createElement("img");
			set_common_el_properties(img, obj[0]);
			img.src = obj[0].url;
			img.onload = function() {
				cb(img, obj[0].url, obj[0]);
			};
			img.onerror = function(e) {
				console_log("Error loading image", e);
				err_cb();
			};
			return;
		}

		var run_cbs = function(our_this, args, no_propagate) {
			if (no_propagate) {
				return final_cb.apply(our_this, args);
			}

			//console_log("Running cbs for", our_this, args, cb_key);
			var cbs = check_image_cbs[cb_key];
			if (!cbs) {
				console_error("Already ran cbs?", our_this, args, cb_key);
				return;
			}

			delete check_image_cbs[cb_key];
			array_foreach(cbs, function(cb) {
				cb(our_this, args);
			});
		};

		var final_cb = cb;

		var url = obj[0].url;

		console_log("Trying " + url);

		// commenting out because allow_video is no longer in settings
		/*if (false) {
			var video_allowed = settings.allow_video && !processing.deny_video;

			if (obj[0] && obj[0].media_info.type === "video") {
				if (!video_allowed) {
					console_log("Video, skipping due to user setting");
					return err_cb();
				}
			}
		}*/

		if (obj[0].url && /^blob:/.test(obj[0].url)) {
			console_log("Blob URL");
			return err_cb();
		}

		if (obj[0].bad) {
			console_log("Bad image");
			return err_cb();
		}

		if (obj[0].is_pagelink) {
			console_log("Page link");
			return err_cb();
		}

		if (is_invalid_url(obj[0].url)) {
			console_log("Invalid URL");
			return err_cb();
		}

		var url_domain = url.replace(/^([a-z]+:\/\/[^/]*).*?$/, "$1");

		var headers = obj[0].headers;

		if (!headers || Object.keys(headers).length === 0) {
			var referer_host = window.location.href;
			if (!/^https?:\/\//.test(referer_host)) // e.g. file://
				referer_host = "";

			headers = {
				//"Origin": url_domain,
				"Referer": referer_host
			};
		} else if (!headers.Origin && !headers.origin) {
			//headers.Origin = url_domain;
		}

		var handled = false;
		var onload_cb = function(resp) {
			if (handled) {
				return;
			}

			handled = true;

			if (!processing.running) {
				return final_cb(null);
			}

			if (false && resp.readyState !== 4) return;

			nir_debug("check_image_get", "check_image_get(onload)", deepcopy(resp), resp.readyState);

			var digit = resp.status.toString()[0];

			var ok_error = check_ok_error(obj[0].head_ok_errors, resp.status);

			if ((digit === "4" || digit === "5") &&
				resp.status !== 405 && ok_error !== true) {
				if (err_cb) {
					console_log("Bad status: " + resp.status + " ( " + url + " )");
					err_cb();
				} else {
					console_error("Error: " + resp.status);
				}

				return;
			}

			if (check_bad_if(obj[0].bad_if, resp)) {
				console_log("Bad image (bad_if)", resp, obj[0].bad_if);
				return err_cb();
			}

			if (processing.head) {
				final_cb(resp, obj[0]);
				return;
			}

			var parsed_headers = headers_list_to_dict(parse_headers(resp.responseHeaders));
			var media_info = obj[0].media_info;

			// TODO: improve
			if (media_info.type === "image" && parsed_headers["content-type"]) {
				var detected_mediainfo = get_mediainfo_from_contenttype(parsed_headers["content-type"]);
				if (detected_mediainfo) {
					media_info.type = detected_mediainfo.type;

					if (detected_mediainfo.delivery)
						media_info.delivery = detected_mediainfo.delivery;
				}
			}

			if (false) {
				// commenting out because video_allowed doesn't exist
				/*if (media_info.type === "video" && !video_allowed) {
					console_log("Video, skipping due to user setting");
					return err_cb();
				}*/
			}

			if (!is_media_type_supported(media_info, processing)) {
				console_warn("Media type", media_info, "is not supported");
				return err_cb();
			}

			if (settings.mouseover_matching_media_types && processing && processing.source && processing.source.el) {
				var source_mediatype = el_media_type(processing.source.el);

				if (source_mediatype) {
					if (source_mediatype !== media_info.type) {
						console_log("Source was ", source_mediatype, ", this is", media_info.type, "skipping");
						return err_cb();
					}
				}
			}

			var good_cb = function(img) {
				nir_debug("check_image_get", "check_image_get(good_cb):", img, resp.finalUrl, obj[0], resp);

				if (processing.set_cache) {
					var cache_obj = {
						img: img,
						resp: resp,
						filesize: obj[0].filesize
					};

					if (img.tagName === "VIDEO" || img.tagName === "AUDIO")
						cache_obj.currentTime = img.currentTime;

					check_image_cache.set(obj[0].url, cache_obj, (parseFloat(settings.popup_cache_duration) || 0) * 60);
				}

				if (img)
					check_image_ref(img);

				final_cb(img, resp.finalUrl, obj[0], resp);
			};

			if (parsed_headers["content-length"] && parseInt(parsed_headers["content-length"]) > 100) {
				obj[0].filesize = parseInt(parsed_headers["content-length"]);
			}

			var set_src = function(el, src) {
				let delivery = media_info.delivery + "";
				if (media_info.type !== "image" && !processing.deny_nondirect_delivery && delivery in mediadelivery_support) {
					var module = mediadelivery_support[delivery];

					if (module.active()) {
						module.el_init({
							success: function() {}, // todo?
							fail: err_cb,
							info_obj: obj[0],
							el: el,
							src: src
						});
						return;
					}
				} else {
					set_direct_src(el, src, obj[0]);
				}
			};

			var create_media = function(src, mediatype) {
				var our_err_cb = err_cb;

				// https://github.com/qsniyg/maxurl/issues/672
				if (!mediatype && obj[0].head_wrong_contenttype && media_info.type !== "audio") {
					our_err_cb = function() {
						var all_mediatypes = ["video", "image"];
						all_mediatypes.splice(array_indexof(all_mediatypes, media_info.type), 1);
						create_media(src, all_mediatypes[0]);
					};
				}

				if (!mediatype) mediatype = media_info.type;

				var el = create_media_el(obj[0], mediatype, processing, good_cb, our_err_cb);
				set_src(el, src);

				return el;
			};

			if (incomplete_request) {
				create_media(resp.finalUrl);
				return;
			}

			if (!resp.response) {
				err_cb();
				return;
			}

			var loadcb = function(urldata) {
				if (_nir_debug_) {
					console_log("check_image_get's loadcb", urldata, media_info);
				}

				last_objecturl = urldata;

				if (!urldata) {
					return err_cb();
				}

				create_media(urldata);
			};

			if (obj[0].need_data_url || (!settings.mouseover_use_blob_over_data && !obj[0].need_blob)) {
				create_dataurl(resp.response, loadcb);
			} else {
				var objecturl = create_objecturl(resp.response);
				loadcb(objecturl);
			}
		};

		var req = null;

		if ((!obj[0].can_multiple_request || settings.mouseover_partial_avoid_head) && incomplete_request
			&& (!obj[0].bad_if || obj[0].bad_if.length === 0)) {
			onload_cb({
				status: 200,
				responseHeaders: "Content-Type: " + (obj_is_probably_video ? "video/mp4" : "image/jpeg"),
				readyState: 3,
				finalUrl: obj[0].url
			});

			return;
		}

		var cb_key = method + " " + incomplete_request + " " + url;
		//console_log(cb_key);
		err_cb = function(no_propagate?) {
			run_cbs(null, null, no_propagate);
		};
		final_cb = function() {
			run_cbs(this, arguments);
		};

		if (!(cb_key in check_image_cbs)) check_image_cbs[cb_key] = [];
		check_image_cbs[cb_key].push(function(our_this, args) {
			if (!args && !our_this) {
				return err_cb_real();
			}

			return cb.apply(our_this, args);
		});

		// avoid multiple requests to the same image at the same time (e.g. for replace images)
		if (check_image_cbs[cb_key].length > 1) return;

		var start_req = function() {
			req = do_request({
				method: method,
				url: url,
				responseType: responseType,
				headers: headers,
				trackingprotection_failsafe: true,
				need_blob_response: method == "GET",
				retry_503: true,
				onprogress: function(resp) {
					var do_abort = function() {
						if (!req || !req.abort) {
							console_warn("Unable to abort request");
							return;
						}

						req.abort();
					};

					if (!processing.running) {
						do_abort();
					}

					if (processing.progress_cb && resp.lengthComputable && resp.loaded && resp.total) {
						processing.progress_cb({
							total: resp.total,
							loaded: resp.loaded
						});
					}

					if (incomplete_request && resp.readyState >= 2 && resp.responseHeaders) {
						do_abort();
						onload_cb(resp);
					}
				},
				onload: onload_cb
			});
		};

		if (obj[0].cookie_url && get_cookies) {
			get_cookies(obj[0].cookie_url, function(cookies) {
				if (!cookies) {
					return start_req();
				}

				headerobj_set(headers, "cookie", cookies_to_httpheader(cookies));
				start_req();
			}, {need_full: true});
		} else {
			start_req();
		}
	}

	var str_to_keycode_table = {
		backspace: 8,
		enter: 13,
		shift: 16,
		ctrl: 17,
		alt: 18,
		esc: 27,
		space: 32,
		left: 37,
		up: 38,
		right: 39,
		down: 40,
		//"super": 91,
		";": 186,
		"=": 187,
		",": 188,
		"-": 189,
		".": 190,
		"/": 191,
		"`": 192,
		"[": 219,
		"\\": 220,
		"]": 221,
		"'": 222
	};

	var keycode_to_str_table = {
		8: "backspace",
		13: "enter",
		16: "shift",
		17: "ctrl",
		18: "alt",
		19: "pause",
		27: "esc",
		32: "space",

		37: "left",
		38: "up",
		39: "right",
		40: "down",

		44: "prntscreen",

		//91: "super",

		// numpad
		97: "1",
		98: "2",
		99: "3",
		100: "4",
		101: "5",
		102: "6",
		103: "7",
		104: "8",
		105: "9",
		111: "/",
		106: "*",
		107: "+",
		109: "-",
		110: ".",

		145: "scrlock",

		186: ";",
		187: "=",
		188: ",",
		189: "-",
		190: ".",
		191: "/",
		192: "`",
		219: "[",
		220: "\\",
		221: "]",
		222: "'",
		226: "\\" // IntlBackslash, VK_OEM_102 (thanks to Noodlers for reporting)
	};

	//var maxzindex = 2147483647;
	// some sites have z-index: 99999999999999 (http://www.topstarnews.net/)
	// this gets scaled down to 2147483647 in the elements panel, but it gets seen as higher than 9999* by the browser
	// Number.MAX_VALUE doesn't work at all (z-index doesn't get set)
	var MAX_SAFE_INTEGER = 9007199254740991; // Number.MAX_SAFE_INTEGER
	var maxzindex = MAX_SAFE_INTEGER;
	// sites like topstarnews under Firefox somehow change sans-serif as the default font
	var sans_serif_font = '"Noto Sans", Arial, Helvetica, sans-serif';

	var get_safe_glyph = function(font, glyphs) {
		if (settings.mouseover_ui_use_safe_glyphs)
			return glyphs[glyphs.length - 1];

		try {
			for (var i = 0; i < glyphs.length; i++) {
				if (document.fonts.check(font, glyphs[i]))
					return glyphs[i];
			}
		} catch (e) {
			console_error(e);
		}

		return glyphs[glyphs.length - 1];
	};

	function keycode_to_str(event) {
		var x = event.which;

		if (event.code) {
			// when pressing Shift
			var match = event.code.match(/^Numpad([0-9]+)$/);
			if (match) {
				return match[1];
			};
		}

		if (x in keycode_to_str_table) {
			return keycode_to_str_table[x];
		}

		if (!((x >= 65 && x <= 90) ||
			  // numbers
			  (x >= 48 && x <= 57))) {
			return;
		}

		return string_fromcharcode(x).toLowerCase();
	}

	function str_to_keycode(x) {
		if (x in str_to_keycode_table) {
			return str_to_keycode_table[x];
		}
		return x.toUpperCase().charCodeAt(0);
	}

	function normalize_keychord(keychord) {
		if (keychord.length === 0)
			return [[]];

		if (!is_array(keychord[0]))
			return [keychord];

		return keychord;
	}

	function general_extension_message_handler(message, sender, respond) {
		if (_nir_debug_) {
			console_log("general_extension_message_handler", message);
		}

		if (message.type === "settings_update") {
			//console_log(message);
			settings_updated_cb(message.data.changes);
		} else if (message.type === "request") {
			var response = message.data;

			if (!(response.id in extension_requests)) {
				// this happens when there's more than one frame per tab
				if (_nir_debug_) {
					console_log("Request ID " + response.id + " not in extension_requests");
				}

				return;
			}

			var request_final = function() {
				var reqdata = extension_requests[response.id].data;

				var events = [
					"onload",
					"onerror",
					"onprogress",
					"onabort",
					"ontimeout"
				];

				var handled = false;
				for (var i = 0; i < events.length; i++) {
					var event = events[i];

					if (response.event === event && reqdata[event]) {
						if (_nir_debug_) {
							console_log("Running " + event + " for response", response);
						}

						reqdata[event](response.data);
						handled = true;
					}
				}

				if (_nir_debug_ && !handled) {
					console_warn("No event handler for", response);
				}

				if (response.final) {
					delete extension_requests[response.id];
				}
			};

			if (response.data && response.data.responseType === "blob") {
				var enc = response.data._responseEncoded;

				if (enc) {
					var wanted_responseType = "blob";
					if (response.data._wanted_responseType === "arraybuffer")
						wanted_responseType = "arraybuffer";

					if (enc.value) {
						var value_array = new Uint8Array(enc.value.length);
						for (var i = 0; i < enc.value.length; i++) {
							value_array[i] = enc.value.charCodeAt(i);
						}

						if (wanted_responseType === "blob") {
							try {
								response.data.response = new native_blob([value_array.buffer], { type: enc.type });
							} catch(e) {
								console_error(e);
								response.data.response = null;
							}
						} else {
							response.data.response = value_array.buffer;
						}
					} else if (enc.objurl) {
						// based on https://stackoverflow.com/a/23856573/13255485
						var xhr = new XMLHttpRequest();
						xhr.open("GET", enc.objurl);
						xhr.responseType = wanted_responseType as XMLHttpRequestResponseType;
						xhr.onload = function() {
							revoke_objecturl(enc.objurl);

							response.data.response = xhr.response;
							request_final();
						};
						xhr.onerror = function() {
							revoke_objecturl(enc.objurl);

							console_error("Unable to load blob for", enc, xhr);
							response.data.response = null;
							request_final();
						};

						xhr.send();
						return;
					}
				} else {
					response.data.response = null;
				}
			} else if (response.data && response.data.responseText && !response.data.response) {
				response.data.response = response.data.responseText;
			}

			request_final();
		} else if (message.type === "bg_redirect") {
			if (settings.redirect && settings.redirect_extension && settings.imu_enabled) {
				try {
					var headers = headers_list_to_dict(message.data.responseHeaders);
					if (headers["content-type"] && contenttype_can_be_redirected(headers["content-type"])) {
						do_redirect_sub(message.data.url, false, function(newurl, obj) {
							send_redirect(obj, function() {
								chrome.tabs.update(message.data.tabId, {
									url: newurl
								});
							}, message.data.tabId);
						});
					}
				} catch (e) {
					console_error(e);
				}
			}
		} else if (message.type === "get_localstorage") {
			if (_localstorage_check_origin(message.data.url)) {
				respond(_localstorage_get_items(message.data.keys, message.data.options));
			} else {
				respond(null);
			}
		}
	}

	var stackoverflow_guard = function(func, i, count) {
		if (i % count !== (count - 1)) {
			func();
		} else {
			setTimeout(func, 0);
		}
	};

	function do_mouseover() {
		if (_nir_debug_)
			console_log("do_mouseover ran");

		var mouseover_base_enabled = function() {
			if (!settings.imu_enabled) return false;

			if (!host_filter(window.location.href))
				return false;

			return true;
		};

		var mouseover_enabled = function() {
			return mouseover_base_enabled() && settings.mouseover;
		};

		var mouseover_mouse_enabled = function() {
			return mouseover_enabled() && delay !== false && typeof delay === "number" && delay_mouseonly;
		};

		var mousepos_initialized = false;

		var mouseX = 0;
		var mouseY = 0;
		var mouseAbsX = 0;
		var mouseAbsY = 0;
		var mouse_frame_id = "top";

		var mouseContextX = null;
		var mouseContextY = null;
		var mouseAbsContextX = 0;
		var mouseAbsContextY = 0;

		var mouse_in_image_yet = false;
		var mouseDelayX = 0;
		var mouseDelayY = 0;

		var lastX = 0;
		var lastY = 0;

		var processing_list = [];
		var popups = [];
		var trigger_id = null;
		var mask_el = null;
		var popup_obj = null;
		var previous_album_links = null;
		var override_album = null;
		var popup_contentlength = null;
		var popup_el = null;
		var popup_el_mediatype = null;
		var popup_el_is_stream = false;
		var popup_orig_url = null;
		var resetpopup_timeout = null;
		var real_popup_el = null;
		var next_popup_el = null;
		var last_popup_el = null;
		var popup_orig_el = null;
		var popup_el_automatic = false;
		var popup_el_remote = false;
		var popups_active = false;
		var popup_trigger_reason = null;
		var can_close_popup = [false, false];
		var popup_hold = false;
		var popup_hold_func = common_functions["nullfunc"];
		var popup_zoom_func = common_functions["nullfunc"];
		var popup_createui_func = common_functions["nullfunc"];
		var popup_wheel_cb = null;
		var popup_update_pos_func = null;
		var popup_update_zoom_func = null;
		var popup_hidecursor_func = common_functions["nullfunc"];
		var popup_hidecursor_timer = null;
		var popup_cursorjitterX = 0;
		var popup_cursorjitterY = 0;
		var popup_is_fullscreen = false;
		var popup_last_zoom = null;
		var popup_client_rect_cache = null;
		var last_popup_client_rect_cache = 0;
		var popup_media_client_rect_cache = null;
		var last_popup_media_client_rect_cache = 0;
		var dragstart = false;
		var dragstartX = null;
		var dragstartY = null;
		var dragoffsetX = null;
		var dragoffsetY = null;
		var popupOpenX = null;
		var popupOpenY = null;
		var popupOpenLastX = null;
		var popupOpenLastY = null;
		var dragged = false;
		var waiting = false;

		var waitingel = null;
		var waitingstyleel = null;
		var waitingel_cursor = null;
		var elwaitingstyleclass = null;
		var elwaitingstyleel = null;
		var waitingsize = 200;

		var current_chord = [];
		var current_chord_timeout = {};
		var release_ignore = [];
		var editing_text = false;

		var host_location = window_location;
		var host_domain = get_domain_from_url(host_location);
		var host_domain_nosub = get_domain_nosub(host_domain);

		function resetifout(e) {
			// doesn't work, as e doesn't contain ctrlKey etc.
			if (!trigger_complete(settings.mouseover_trigger_key)) {
				//current_chord = [];
				stop_waiting();
				resetpopups();
			}
		}

		// runs on every focusout, not just window
		/*document.addEventListener("focusout", resetifout);
		  document.addEventListener("blur", resetifout);
		  unsafeWindow.addEventListener("focusout", resetifout);
		  unsafeWindow.addEventListener("blur", resetifout);*/

		if (false) {
			var disable_click = false;
			document.addEventListener("click", function(e) {
				if (disable_click && popups_active && false) {
					e.stopPropagation();
					e.stopImmediatePropagation();

					return true;
					//return false;
				}
			}, true);
		}

		var delay:number|false = false;
		var delay_handle = null;
		var delay_handle_triggering = false;
		var delay_mouseonly = true;
		var delay_el = null;

		function get_tprofile_setting_name(setting_name) {
			if (trigger_id) {
				var new_settingname = "t" + trigger_id + "_" + setting_name;
				if (new_settingname in settings)
					setting_name = new_settingname;
			}

			return setting_name;
		}

		function get_tprofile_setting(setting_name) {
			return settings[get_tprofile_setting_name(setting_name)];
		}

		function get_tprofile_single_setting(setting) {
			return get_single_setting_raw(get_tprofile_setting(setting));
		}

		function update_waiting() {
			if (!waitingel)
				return;

			var x = mouseX;//mouseAbsX;
			var y = mouseY;//mouseAbsY;
			waitingel.style.left = (x - (waitingsize / 2)) + "px";
			waitingel.style.top = (y - (waitingsize / 2)) + "px";
		}

		var start_waiting = function(el, cursor?:string) {
			if (!cursor)
				cursor = "wait";

			waitingel_cursor = cursor;

			waiting = true;

			if (!settings.mouseover_wait_use_el) {
				if (waitingstyleel) {
					stop_waiting();
				}

				waitingstyleel = document_createElement("style");
				waitingstyleel.innerText = "*,a,img,video {cursor: " + cursor + "!important}";
				document.documentElement.appendChild(waitingstyleel);
				return;
			}

			if (!waitingel) {
				waitingel = document_createElement("div");
				set_el_all_initial(waitingel);
				waitingel.style.zIndex = maxzindex;
				waitingel.style.cursor = cursor;
				waitingel.style.width = waitingsize + "px";
				waitingel.style.height = waitingsize + "px";
				//waitingel.style.pointerEvents = "none"; // works, but defeats the purpose, because the cursor isn't changed
				waitingel.style.position = "fixed";//"absolute";

				var simevent = function(e, eventtype) {
					waitingel.style.display = "none";
					document.elementFromPoint(e.clientX, e.clientY).dispatchEvent(new MouseEvent(eventtype, e));
					waitingel.style.display = "block";
				};

				our_addEventListener(waitingel, "click", function(e) {
					return simevent(e, "click");
				});

				our_addEventListener(waitingel, "contextmenu", function(e) {
					return simevent(e, "contextmenu");
				});

				document.documentElement.appendChild(waitingel);
			}

			waitingel.style.cursor = cursor;
			waitingel.style.display = "block";

			update_waiting();
		};

		function start_progress(el) {
			start_waiting(el, "progress");
		}

		var stop_waiting = function() {
			if (_nir_debug_) {
				console_log("stop_waiting");
			}

			waiting = false;

			if (!settings.mouseover_wait_use_el) {
				if (waitingstyleel) {
					waitingstyleel.parentElement.removeChild(waitingstyleel);
					waitingstyleel = null;
				}
			}

			if (waitingel)
				waitingel.style.display = "none";
		};

		// camhub.cc (ublock origin blocks any setTimeout'd function with 'stop' in the name)
		function dont_wait_anymore() {
			stop_waiting();
		}

		var not_allowed_timer = null;
		function cursor_not_allowed() {
			if (_nir_debug_) {
				console_log("cursor_not_allowed");
			}

			start_waiting(void 0, "not-allowed");

			if (not_allowed_timer) {
				clearTimeout(not_allowed_timer);
			}

			not_allowed_timer = setTimeout(function() {
				not_allowed_timer = null;

				if (waitingel_cursor === "not-allowed")
					dont_wait_anymore();
			}, settings.mouseover_notallowed_duration);
		}

		function stop_waiting_cant_load() {
			if (settings.mouseover_enable_notallowed_cant_load) {
				cursor_not_allowed();
			} else {
				stop_waiting();
			}
		}

		function in_clientrect(mouseX, mouseY, rect, border?) {
			if (isNaN(border) || border === void 0)
				border = 0;

			if (mouseX >= (rect.left - border) && mouseX <= (rect.right + border) &&
				mouseY >= (rect.top - border) && mouseY <= (rect.bottom + border)) {
				return true;
			} else {
				return false;
			}
		}

		function stop_processing() {
			for (var i = 0; i < processing_list.length; i++) {
				processing_list[i].running = false;
			}
		}

		var clear_resetpopup_timeout = function() {
			if (resetpopup_timeout) {
				clearTimeout(resetpopup_timeout);
				resetpopup_timeout = null;
			}
		};

		var add_resetpopup_timeout = function() {
			if (!settings.mouseover_auto_close_popup || !settings.mouseover_auto_close_popup_time)
				return;

			clear_resetpopup_timeout();

			resetpopup_timeout = setTimeout(resetpopups, settings.mouseover_auto_close_popup_time * 1000);
		};

		var removepopups_timer = null;
		function removepopups() {
			array_foreach(popups, function(popup) {
				var els = popup.querySelectorAll("img, video, audio");
				for (var i = 0; i < els.length; i++) {
					if (els[i].tagName === "VIDEO" || els[i].tagName === "AUDIO")
						els[i].pause();

					check_image_unref(els[i]);
				}

				if (popup.parentNode)
					popup.parentNode.removeChild(popup);

				var index = array_indexof(popups, popup);
				if (index > -1) {
					popups.splice(index, 1);
				}
			});

			if (removepopups_timer) {
				clearTimeout(removepopups_timer);
				removepopups_timer = null;
			}
		}

		var remove_mask = function() {
			if (mask_el) {
				if (mask_el.parentElement)
					mask_el.parentElement.removeChild(mask_el);
				mask_el = null;
			}

			if (removemask_timer) {
				clearTimeout(removemask_timer);
				removemask_timer = null;
			}
		};

		var removemask_timer = null;

		type ResetPopupsOptions = {
			from_remote?:boolean,
			automatic?:boolean,
			new_popup?:boolean
		};
		function resetpopups(options?:ResetPopupsOptions) {
			if (_nir_debug_) {
				console_log("resetpopups(", options, ")");
			}

			if (!options) {
				options = {};
			}

			var from_remote = !!options.from_remote;

			array_foreach(popups, function(popup) {
				if (settings.mouseover_fade_time > 0 && (settings.mouseover_enable_fade || settings.mouseover_enable_zoom_effect)) {
					if (settings.mouseover_enable_fade) {
						popup.style.opacity = 0;
					}

					if (settings.mouseover_enable_zoom_effect) {
						popup.style.transform = "scale(0)";
					}

					if (!removepopups_timer) {
						removepopups_timer = setTimeout(removepopups, settings.mouseover_fade_time);
					}
				} else {
					// FIXME: this is called for each popup
					removepopups();
				}
			});

			if (mask_el) {
				set_important_style(mask_el, "pointer-events", "none");

				if (settings.mouseover_mask_fade_time > 0) {
					set_important_style(mask_el, "opacity", 0);

					if (!removemask_timer) {
						removemask_timer = setTimeout(remove_mask, settings.mouseover_mask_fade_time);
					}
				} else {
					remove_mask();
				}
			}

			if (!from_remote && can_use_remote()) {
				if (is_in_iframe) {
					remote_send_message("top", {type: "resetpopups"});
				} else if (popup_el_remote) {
					remote_send_message(popup_el_remote, {type: "resetpopups"});
				}
			}

			disable_click = false;
			popups_active = false;
			delay_handle_triggering = false;

			clear_resetpopup_timeout();

			next_popup_el = null;
			if (popup_el)
				last_popup_el = popup_el;
			popup_el = null;
			real_popup_el = null;
			popup_el_automatic = false;
			popup_el_remote = false;
			popup_el_mediatype = null;
			popup_el_is_stream = false;
			popup_orig_url = null;
			popup_hold_func = common_functions["nullfunc"];
			popup_zoom_func = common_functions["nullfunc"];
			popup_createui_func = common_functions["nullfunc"];
			popup_wheel_cb = null;
			popup_update_pos_func = null;
			popup_update_zoom_func = null;
			popup_client_rect_cache = null;
			popup_is_fullscreen = false;
			last_popup_client_rect_cache = 0;
			popup_media_client_rect_cache = null;
			last_popup_media_client_rect_cache = 0;

			if (!options.automatic) {
				popup_hold = false;
				override_album = null;
			}

			if (!options.new_popup) {
				can_close_popup = [false, false];
			}

			stop_processing();

			if (!options.new_popup || settings.mouseover_wait_use_el) {
				// don't recalculate style until after the popup is open
				stop_waiting();
			}

			if (!delay_mouseonly && delay_handle) {
				clearTimeout(delay_handle);
				delay_handle = null;
			}
		}
		termination_hooks.push(resetpopups);

		function get_viewport() {
			if (window.visualViewport) {
				return [
					window.visualViewport.width,
					window.visualViewport.height
				];
			} else {
				return [
					window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth,
					window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight
				];
			}
		}

		var get_download_urls_from_infoobj;
		(function() {
			var parse_stream = function(delivery, text, url, cb) {
				get_library("stream_parser", settings, do_request, function(sp) {
					if (!sp) return cb(null);

					var parser_obj = sp[delivery];
					var parse;

					if (delivery === "dash") {
						parse = parser_obj.parse;
					} else if (delivery === "hls") {
						parse = function(text) {
							var parser = new parser_obj.Parser();
							parser.push(text);
							parser.end();
							return parser.manifest;
						};
					}

					try {
						var parsed = parse(text, url);
					} catch (e) {
						console_error(e);
						return cb(null);
					}

					return cb(parsed);
				});
			};

			// todo: cache, because it's possible more than one has the same url?
			var request_parsed_stream = function(info_obj, manifest_url, cb) {
				var requestobj = override_request({
					url: manifest_url,
					onload: function(resp) {
						if (resp.status !== 200) {
							console_error("Unable to load", resp);
							return cb(null);
						}

						parse_stream(info_obj.media_info.delivery, resp.responseText, resp.finalUrl || manifest_url, function(data) {
							cb(data);
						});
					}
				}, info_obj);

				do_request(requestobj);
			};

			// prefers bandwidth over resolution
			// fixme: is this even correct? this might choose inefficient formats over more efficient ones
			var sort_playlists = function(playlists) {
				return playlists.sort(function(a_obj, b_obj) {
					var a = a_obj.attributes;
					var b = b_obj.attributes;

					if (a.BANDWIDTH && b.BANDWIDTH) {
						return b.BANDWIDTH - a.BANDWIDTH;
					}

					if (a.RESOLUTION && b.RESOLUTION) {
						var a_res = a.RESOLUTION.width * a.RESOLUTION.height;
						var b_res = b.RESOLUTION.width * b.RESOLUTION.height;
						return b_res - a_res;
					}

					// todo: FRAME-RATE?

					return 0;
				});
			};

			var get_actual_best_playlist = function(info_obj, playlists, cb) {
				if (!is_array(playlists)) playlists = [playlists];

				sort_playlists(playlists);

				var resolve_uri = function(uri) {
					return urljoin(info_obj.url, uri, true);
				};

				var resolve_playlist = function(playlist, cb) {
					if (playlist.uri) {
						playlist.uri = resolve_uri(playlist.uri);

						var uri = playlist.uri;

						//console_log("Requesting", playlist.uri);
						request_parsed_stream(info_obj, uri, function(data) {
							if (!data) return cb(null);

							var origattrs = playlist.attributes;

							// should return just a playlist (not a manifest) object for m3u8
							obj_extend(playlist, data);

							// fixme: is this necessary?
							if (origattrs) playlist.attributes = origattrs;

							playlist.base_uri = uri;
							playlist.uri = null; // to avoid possible re-requests
							cb(playlist);
						});
					} else {
						cb(playlist);
					}
				};

				var do_process = function(playlist_id, cb) {
					var playlist = playlists[playlist_id];
					if (!playlist) return cb(null);

					resolve_playlist(playlist, function(new_playlist) {
						if (!new_playlist) return do_process(playlist_id + 1, cb);
						return cb(new_playlist);
					});
				};

				do_process(0, cb);
			};

			var get_downloadable_playlists = function(info_obj, manifest, cb) {
				get_actual_best_playlist(info_obj, manifest.playlists, function(playlist) {
					if (!playlist) return cb(null);

					var audio = playlist.attributes.AUDIO;
					if (audio && audio in manifest.mediaGroups.AUDIO) {
						audio = manifest.mediaGroups.AUDIO[audio];
						// todo: somehow add an option to select this
						audio = audio[Object.keys(audio)[0]];
					} else {
						audio = null;
					}

					var retobj = {
						video: playlist
					};

					if (!audio) return cb(retobj);

					get_actual_best_playlist(info_obj, audio.playlists || audio, function(audio_pl) {
						if (!audio_pl) return cb(null);

						retobj.audio = audio_pl;
						return cb(retobj);
					});
				});
			};

			var get_download_urls_from_playlist = function(info_obj, playlist) {
				var resolve_uri = function(uri) {
					return urljoin(playlist.base_uri || info_obj.url, uri, true);
				};

				// todo
				if (false && playlist.attributes) {
					// dailymotion
					var progressive = playlist.attributes["PROGRESSIVE-URI"];
					if (progressive) return [resolve_uri(progressive)];
				}

				var urls = [];

				var push_url = function(url) {
					if (!url) return;
					url = resolve_uri(url);
					array_upush(urls, url);
				};

				var push_segment = function(segment) {
					if (segment.map) {
						// only resolvedUri is present for youtube urls
						push_url(segment.map.uri || segment.map.resolvedUri);
					}

					push_url(segment.uri || segment.resolvedUri);
				};

				// youtube
				if (playlist.sidx) {
					push_segment(playlist.sidx);
				}

				array_foreach(playlist.segments, push_segment);

				return urls;
			};

			var get_download_urls_from_playlists = function(info_obj, playlists) {
				var newobj = {};

				obj_foreach(playlists, function(key, value) {
					newobj[key] = get_download_urls_from_playlist(info_obj, value);
				});

				return newobj;
			};

			get_download_urls_from_infoobj = function(info_obj, cb) {
				request_parsed_stream(info_obj, info_obj.url, function(manifest) {
					if (!manifest) return cb(null);

					get_downloadable_playlists(info_obj, manifest, function(playlists) {
						if (!playlists) return cb(null);

						//console_log("playlists", playlists);

						var urls = get_download_urls_from_playlists(info_obj, playlists);
						//console_log("urls", urls);

						return cb(urls);
					});
				});
			};
		})();

		var check_sharedarraybuffer;
		(function() {
			var check_sharedarraybuffer_inner = function(cb) {
				if (typeof SharedArrayBuffer !== "function") {
					console_warn("SharedArrayBuffer doesn't exist");
					return cb(false);
				}

				try {
					var sab = new SharedArrayBuffer(1);
					var array = new Uint8Array(sab);
					array[0] = 30;

					var workersource = "self.addEventListener('message', function(m) {try {var a = new Uint8Array(m.data); postMessage(a[0] === 30);} catch (e) {postMessage(false);}});";
					new_blob(workersource, function(blob) {
						if (!blob) {
							console_warn("Unable to create blob");
							return cb(false);
						}

						var objurl = create_objecturl(blob);
						var worker = new Worker(objurl);
						worker.onmessage = function(m) {
							cb(!!m.data);
						};
						worker.postMessage(sab);

						setTimeout(function() {
							revoke_objecturl(objurl);
						}, 10);
					});
				} catch (e) {
					console_error(e);
					return cb(false);
				}
			};

			// todo: timeout?
			var cached_sab_success = null;
			check_sharedarraybuffer = function(cb) {
				if (cached_sab_success !== null) return cb(cached_sab_success);

				check_sharedarraybuffer_inner(function(success) {
					cached_sab_success = success;
					cb(success);
				});
			};
		})();

		var ffmpeg_progress_cb = null;
		var get_ffmpeg_inner = function(cb) {
			get_library("ffmpeg", settings, do_request, function(ffmpeg_lib) {
				if (!ffmpeg_lib) return cb(null);
				if (ffmpeg_lib._imu_failed_loading) return cb(null);

				var ffmpeg;

				if (!ffmpeg_lib._imu_instance) {
					if (ffmpeg_lib.overridden_xhr) {
						ffmpeg_lib.xhr.do_request = function(req) {
							//console_log("overriding", req);

							req = override_request(req, {
								headers: {
									Referer: "",
									Origin: ""
								}
							});

							//console_log("requesting", req.url);

							// no need to query this as it's been patched in
							if (/\/ffmpeg-core(?:\.worker)?\.js$/.test(req.url)) {
								req.url = "data:application/javascript,void%200"
							} else if (false&&/\/ffmpeg-core\.wasm$/.test(req.url)) {
								//console.trace();

								req.responseType = "blob";

								// somehow helps avoid cache misses
								// no, it seems to work fine without, this also sets Accept-Encoding: identity, which more than doubles the size
								//req.headers = { Range: "bytes=0-" };
								if (true) {
									return do_request(req);
								}

								request_chunked(req, {
									onload: function(data, resp) {
										console_log("onload", data, resp);
										if (!data) {
											resp.status = 500;
											resp.response = null;
											return req.onload(resp);
										}

										resp.response = data.data;
										return req.onload(resp);
									}
								});

								return;
							}

							return do_request(req);
						};
					}

					ffmpeg = ffmpeg_lib.lib.createFFmpeg({
						log: true,
						progress: function(progress) {
							//console_log(progress.ratio);
							if (ffmpeg_progress_cb) {
								ffmpeg_progress_cb(progress.ratio);
							}
						}
					});
					ffmpeg_lib._imu_instance = ffmpeg;
				} else {
					ffmpeg = ffmpeg_lib._imu_instance;
				}

				if (!ffmpeg.isLoaded()) {
					ffmpeg.load().then(
						function() {
							cb(ffmpeg);
						},
						function(err) {
							console_error(err);

							// since compilation takes 100% cpu for a few seconds, we really don't want to run it more than once if it continually fails
							ffmpeg_lib._imu_failed_loading = true; // untested

							cb(null);
						}
					);
				} else {
					cb(ffmpeg)
				}
			});
		};

		var get_ffmpeg = function(cb) {
			if (!has_ffmpeg_lib) {
				console_error("Unable to load FFmpeg library: disabled for this build");
				return cb(null);
			}

			check_sharedarraybuffer(function(success) {
				// if we don't check for this, ffmpeg will hang under firefox
				if (!success) {
					console_error("Unable to load FFmpeg library: SharedArrayBuffer is missing or unusable");
					return cb(null);
				}

				get_ffmpeg_inner(cb);
			});
		}

		var ffmpeg_join;
		(function() {
			var ffmpeg_ops = [];
			var ffmpeg_running = false;

			var ffmpeg_run_single = function(ffmpeg) {
				var opobj = ffmpeg_ops.shift();

				var end = function(no_ops) {
					ffmpeg_progress_cb = null;
					ffmpeg_running = false;

					if (ffmpeg_ops.length) {
						if (!no_ops) {
							ffmpeg_run_single(ffmpeg);
						} else {
							array_foreach(ffmpeg_ops, function(op) {
								run_soon(op.fail);
							});
						}
					}
				};

				ffmpeg_progress_cb = function(percent) {
					if (percent > 1) percent = 1;
					opobj.progress(percent);
				};
				ffmpeg_running = true;

				var promise = null;
				try {
					promise = ffmpeg.run.apply(this, opobj.op);
				} catch (e) {
					console_error(e);

					end(true);
					opobj.fail(false);

					return;
				}

				promise.then(
					function(data) {
						end();
						opobj.success(data);
					},
					function(data) {
						end(true);
						opobj.fail(false);
					}
				);
			};

			var ffmpeg_run = function(ffmpeg, op, progress, success, fail) {
				ffmpeg_ops.push({
					op: op,
					progress: progress,
					success: success,
					fail: fail
				});

				if (ffmpeg_running) return;
				ffmpeg_run_single(ffmpeg);
			};

			// prefix in case multiple ops are running
			var get_ffmpeg_prefix = function(prefix) {
				return prefix + "_" + get_random_text(10) + "_";
			};

			// files = array of {data: uint8array, mime: ...}, not filenames
			var ffmpeg_concat = function(ffmpeg, files, cb) {
				if (true) {
					var total_size = 0;
					array_foreach(files, function(file) {
						total_size += file.data.byteLength;
					});
					var out = new Uint8Array(total_size);
					var current_size = 0;
					array_foreach(files, function(file) {
						out.set(file.data, current_size)
						current_size += file.data.byteLength;
					});
					var ourfilename = get_ffmpeg_prefix("concat");
					ffmpeg.FS("writeFile", ourfilename, out);
					return cb(ourfilename);
				} else {
					if (!ffmpeg) cb(null);

					var prefix = get_ffmpeg_prefix("concat");

					var files_txt_filename = prefix + "files.txt";
					var files_txt_files = [];

					var filenames = [];
					array_foreach(files, function(file, i) {
						// todo: file extensions? are they even necessary?
						var filename = prefix + i;

						if (file.mime) {
							filename += file.mime.replace(/.*\//, ".");
						}

						filenames.push(filename);
						files_txt_files.push("file '" + filename + "'");

						ffmpeg.FS("writeFile", filename, file.data);
					});

					ffmpeg.FS("writeFile", files_txt_filename, files_txt_files.join("\n"));

					var out_filename = prefix + "out";

					var cleanup = function(out) {
						array_foreach(filenames, function(filename) {
							ffmpeg.FS("unlink", filename);
						});
						ffmpeg.FS("unlink", files_txt_filename);

						if (out) {
							try {
								// this can fail if ffmpeg failed to create the out file entirely
								ffmpeg.FS("unlink", out_filename);
							} catch (e) {}
						}
					};

					ffmpeg_run(ffmpeg, ["-f", "concat", "-safe", "0", "-i", files_txt_filename, "-c", "copy", out_filename], null,
						function() {
							cleanup();
							cb(out_filename);
						},
						function(err) {
							console_error(err);
							cleanup(true);
							cb(null);
						}
					);
				}
			};

			var ffmpeg_fs_size = function(ffmpeg, file) {
				try {
					var stat = ffmpeg.FS("stat", file);
					if (!stat) return null;
					return stat.size;
				} catch (e) {
					//console_error(e);
					return null;
				};
			};

			var ffmpeg_mux_single = function(ffmpeg, video_file, audio_file, out_filename, progress, success, fail) {
				var failfunc = function(err) {
					try {
						ffmpeg.FS("unlink", out_filename);
					} catch (e) {}
					fail(err);
				};

				var args = [];

				if (video_file) args.push("-i", video_file);
				if (audio_file) args.push("-i", audio_file);
				args.push("-c", "copy", out_filename);

				ffmpeg_run(ffmpeg, args, progress,
					function(data) {
						// it'll always succeed, so this is needed to check if it actually wrote the file
						if (!ffmpeg_fs_size(ffmpeg, out_filename)) {
							return failfunc();
						}

						success(data);
					}, failfunc);
			};

			var ffmpeg_mux = function(ffmpeg, video_file, audio_file, progress, cb) {
				if (!ffmpeg) return cb(null);

				var prefix = get_ffmpeg_prefix("out");

				var mux_final = function() {
					ffmpeg_mux_single(ffmpeg, video_file, audio_file, prefix + ".mkv", progress,
						function() {cb(prefix + ".mkv");},
						function(err) {
							console_error("Error muxing into .mkv", err);
							cb(null);
						}
					);
				}

				if (settings.stream_mux_mp4_over_mkv) {
					var mp4_filename = prefix + ".mp4";
					ffmpeg_mux_single(ffmpeg, video_file, audio_file, mp4_filename,
						function(ratio) {
							if (ratio >= 0.95) ratio = 0.95; // hack to avoid removing the progress element on error
							progress(ratio);
						},
						function() {cb(mp4_filename);},
						function(err) {
							// this means ffmpeg can't be run
							if (err === false) {
								return cb(null);
							}

							//if (err) console_error(err);
							mux_final();
						}
					);
				} else {
					mux_final();
				}
			};

			ffmpeg_join = function(ffmpeg, datas, progress, cb) {
				var streams = [];
				if (datas.video) streams.push(datas.video);
				if (datas.audio) streams.push(datas.audio);

				if (!streams.length) return cb(null);

				var files = [];
				var prefix = get_ffmpeg_prefix("join");

				var cleanup = function() {
					array_foreach(files, function(filename) {
						ffmpeg.FS("unlink", filename);
					});
					progress(1);
				};

				var err = function() {
					cleanup();
					cb(null);
				};

				var process_stream = function(i) {
					if (i >= streams.length) {
						return mux_files();
					} else {
						progress((i / streams.length) * 0.5);
					}

					var stream = streams[i];

					if (!stream.length) {
						// shouldn't happen?
						console_warn("No stream data for", i);

						process_stream(i + 1);
					} else if (stream.length === 1) {
						// no need to concat

						var filename = prefix + "stream" + i;
						ffmpeg.FS("writeFile", filename, stream[0].data);
						files.push(filename);

						process_stream(i + 1);
					} else {
						// todo: progress
						ffmpeg_concat(ffmpeg, stream, function(filename) {
							if (!filename) return err();
							files.push(filename);

							process_stream(i + 1);
						});
					}
				};

				var mux_files = function() {
					progress(0.5);

					if (!files.length) {
						console_warn("No files");
						return err();
					}

					// disabling this is inefficient, but otherwise we don't get a file extension
					if (false && files.length === 1) {
						// don't cleanup because it'll delete the file
						return cb(files[0]);
					}

					if (files.length > 2) {
						console_error("Unknown extra file(s)", files);
						return err();
					}

					ffmpeg_mux(ffmpeg, files[0], files[1], function(percent) {
						progress(0.5 + (percent * 0.5));
					 }, function(out_file) {
						if (!out_file) return err();

						cleanup();
						return cb(out_file);
					});
				};

				process_stream(0);
			};
		})();

		var download_playlist_urls;
		(function() {
			var download_single_urls = function(info_obj, single_urls, progress, cb) {
				// for testing
				//single_urls = single_urls.slice(0, 2);

				var ip = new ImpreciseProgress({
					elements_num: single_urls.length,
					cb: progress
				});

				var urls_data = {};

				var max_run = Math_min(3, single_urls.length);
				var chunks = Math_max(1, ((max_run / 3) * 5) | 0);
				var chunk_size = 2*1024*1024;

				if (info_obj.max_chunks)
					chunks = Math_min(chunks, info_obj.max_chunks);

				if (chunks === 1)
					chunk_size = 0;

				var running = 0;
				var current_url_i = 0;
				var finished = 0;
				var do_stop = false;

				var request_url = function(url, cb) {
					running++;

					//console_log("requesting", url);
					request_chunked({
						url: url,
						headers: info_obj.headers,
						can_head: info_obj.can_head,
						head_wrong_contentlength: info_obj.head_wrong_contentlength
					}, {
						chunks: chunks,
						chunk_size: chunk_size,
						onload: function(data) {
							running--;

							//console_log("got", url, data);
							if (!data) cb(false);

							urls_data[url] = data;
							cb(true);
						},
						onprogress: function(progobj) {
							ip.update_progobj(url, progobj);
						}
					});
				};

				var stop = function() {
					// todo: abort requests
					do_stop = true;
				};

				var run = function() {
					if (do_stop) return;

					if (finished >= single_urls.length) {
						var out_urls = [];

						array_foreach(single_urls, function(url) {
							out_urls.push(urls_data[url]);
						});

						return cb(out_urls);
					} else if (current_url_i >= single_urls.length) {
						return;
					}

					for (var i = running; i < max_run; i++) {
						request_url(single_urls[current_url_i++], function(succeeded) {
							finished++;

							if (do_stop) return;

							if (!succeeded) {
								stop();
								return cb(null);
							} else {
								run();
							}
						});
					}
				};

				run();

				return {
					abort: stop
				};
			};

			download_playlist_urls = function(info_obj, urls, progress, cb) {
				var ip = new ImpreciseProgress({
					elements_num: Object.keys(urls).length,
					cb: progress
				});

				var final_data = {};
				var handles = {};

				var do_stop = false;

				var stop = function() {
					do_stop = true;
					obj_foreach(handles, function(k, obj) {
						obj.abort();
					});
				};

				obj_foreach(urls, function(type, single_urls) {
					handles[type] = download_single_urls(info_obj, single_urls, function(progobj) {
						ip.update_progobj(type, progobj);
					}, function(urls_data) {
						if (do_stop) return;

						if (!urls_data) {
							stop();
							return cb(null);
						}

						final_data[type] = urls_data;

						// todo: improve check?
						if (Object.keys(final_data).length === Object.keys(urls).length) {
							cb(final_data);
						}
					});
				});
			};
		})();

		var shaka_module = function() {
			var get_max_video_quality = function() {
				var max_video_quality = get_single_setting("max_video_quality");
				if (max_video_quality) {
					max_video_quality = parseInt(max_video_quality.substr(1));
				}

				return max_video_quality;
			};

			var get_variant_within_max_quality = function(variants, max_video_quality) {
				var wanted_variant = -1;
				array_foreach(variants, function(variant, i) {
					if (variant.height === max_video_quality) {
						wanted_variant = i;
						return false;
					}

					if (variant.height > max_video_quality) {
						if (i === 0) {
							wanted_variant = i;
						} else {
							wanted_variant = i - 1;
						}

						return false;
					}
				});

				return wanted_variant;
			};

			var add_xhr_hook = function(lib, info_obj:BigImageInfoSObject) {
				if (lib.overridden_xhr) {
					lib.xhr.do_request = function(data) {
						do_request(override_request(data, info_obj));
					};
				}
			};

			var create_shaka = function(info_obj:BigImageInfoSObject, el, src, success, fail) {
				get_library("shaka", settings, do_request, function(_shaka) {
					if (!_shaka) return fail();

					var shaka = _shaka.lib;

					if (true) {
						shaka.log.setLevel(shaka.log.Level.ERROR);
					} else {
						shaka.log.setLevel(shaka.log.Level.DEBUG);
					}

					//shaka.polyfill.installAll();
					if (!shaka.Player.isBrowserSupported()) {
						console_warn("Unsupported browser for Shaka");
						return fail();
					}

					add_xhr_hook(_shaka, info_obj);

					var player = new shaka.Player(el);

					var shaka_error_handler = function(e) {
						console_error(e);
						return fail();
					};

					player.addEventListener("error", shaka_error_handler);

					let need_buffer = false;
					let ran_success = false;
					player.addEventListener("buffering", function() {
						if (need_buffer && !ran_success) {
							// if this buffering event isn't added, the stream will wait for ~5 seconds before playing if a manual variant is selected
							el.currentTime = el.currentTime - 0.001; // FIXME: is -0.001 needed? it's added to force a manual playback change
							need_buffer = false;
							ran_success = true;
							success();
						}
					});

					player.load(src).then(function() {
						let subs = null;
						if (info_obj.subtitles) {
							let selected = false;

							subs = preprocess_subtitles(info_obj.subtitles);
							for (let subtitle of subs) {
								let kind = "subtitle";
								let language = subtitle.language_code || "en";
								let title = subtitle.title || null;
								let mime = subtitle.mime || void 0;
								let forced = false;
								player.addTextTrackAsync(subtitle.url, language, kind, mime, undefined, title, forced);
							}
						}

						var text_tracks = player.getTextTracks();
						if (text_tracks && text_tracks.length) {
							player.selectTextTrack(text_tracks[0]); // TODO
						}

						player.setTextTrackVisibility(!!settings.popup_enable_subtitles);

						var variants = player.getVariantTracks();

						if (settings.hls_dash_use_max) {
							variants.sort(function(a, b) {
								return b.bandwidth - a.bandwidth;
							});
							//console_log(variants);

							player.configure("abr.enabled", false);
							player.selectVariantTrack(variants[0], true, 0);
							need_buffer = true;
						}

						var max_video_quality = get_max_video_quality();
						if (max_video_quality) {
							variants.sort(function(a, b) {
								var diff = a.height - b.height;
								if (diff) return diff;

								return a.bandwidth - b.bandwidth;
							});

							var wanted_variant = get_variant_within_max_quality(variants, max_video_quality);

							if (wanted_variant >= 0) {
								player.configure("abr.enabled", false);
								player.selectVariantTrack(variants[wanted_variant], true, 0);
								need_buffer = true;
							}
						}

						if (!need_buffer) {
							ran_success = true;
							return success();
						} else {
							// in case the buffering event doesn't run
							setTimeout(function() {
								if (ran_success)
									return;

								ran_success = true;
								success();
							}, 5*1000);
						}
					}, shaka_error_handler);
				});
			};

			var shaka_info = {
				el_init: function(info) {
					create_shaka(info.info_obj, info.el, info.src, info.success, info.fail);
				},
				active: function() {
					return settings.allow_thirdparty_libs && get_tprofile_setting("mouseover_allow_hlsdash");
				}
			};

			mediadelivery_support.dash = shaka_info;
			mediadelivery_support.hls = shaka_info;
		};
		shaka_module();

		var parse_styles = function(str, multi) {
			if (typeof str !== "string")
				return;

			str = strip_whitespace(str);
			if (!str)
				return;

			var blocks = {};
			var current_block = "default";

			var splitted = str.split("\n");
			for (var i = 0; i < splitted.length; i++) {
				var current = strip_whitespace(splitted[i]);
				if (!current)
					continue;

				// note: c/css multiline comments (/* */) aren't supported yet
				// c++-style comments
				if (/^\/\//.test(current))
					continue;

				var match = current.match(/^(#[-a-zA-Z0-9]+(?:\s*,\s*#[-a-zA-Z0-9]+){0,})\s*{/);
				if (match) {
					if (current_block !== "default") {
						console_error("Nested blocks aren't supported");
						return;
					}

					current_block = match[1].split(/\s*,\s*/);
					splitted[i--] = current.substr(match[0].length);
					continue;
				}

				if (current[0] === "}") {
					if (current_block === "default") {
						console_error("No block to escape from");
						return;
					}

					current_block = "default";
					continue;
				}

				if (string_indexof(current, ":") < 0)
					continue;

				var next_block = current_block;
				if (current_block !== "default" && /}$/.test(current)) {
					current = strip_whitespace(current.replace(/}$/, ""));
					next_block = "default";
				}

				var property = strip_whitespace(current.replace(/^(.*?)\s*:.*/, "$1"));
				var value = strip_whitespace(current.replace(/^.*?:\s*(.*)$/, "$1"));

				// FIXME: this is extremely hacky in order to avoid writing a better parser
				// doesn't support escapes like \"
				var scolon_pos = string_indexof(value, ";");
				if (scolon_pos >= 0) {
					var quote_pos = value.search(/['"]/);
					if (quote_pos < 0) {
						splitted[i--] = value.substr(scolon_pos+1);
						value = strip_whitespace(value.substr(0, scolon_pos));
					} else {
						var new_quote_pos = value.substr(quote_pos+1).search(/['"]/) + quote_pos + 1;
						scolon_pos = string_indexof(value.substr(new_quote_pos + 1), ";");
						if (scolon_pos >= 0) {
							scolon_pos += new_quote_pos + 1;
							splitted[i--] = value.substr(scolon_pos+1);
							value = strip_whitespace(value.substr(0, scolon_pos));
						}
					}
				}

				var important = false;
				if (value.match(/!important$/)) {
					important = true;
					value = strip_whitespace(value.replace(/!important$/, ""));
				}

				var c_blocks = current_block;
				if (!is_array(c_blocks)) c_blocks = [c_blocks];

				array_foreach(c_blocks, function(block) {
					var prop_obj = {property: property, value: value, important: important};

					if (!(block in blocks))
						blocks[block] = {};

					if (multi) {
						if (!(property in blocks[block]))
							blocks[block][property] = [];

						blocks[block][property].push(prop_obj);
					} else {
						blocks[block][property] = prop_obj;
					}
				});

				current_block = next_block;
			}

			return blocks;
		};

		function get_processed_styles(str) {
			if (!str || typeof str !== "string" || !strip_whitespace(str))
				return;

			var styles = {};
			var splitted = str.split(/[;\n]/);
			for (var i = 0; i < splitted.length; i++) {
				var current = strip_whitespace(splitted[i]);
				if (!current)
					continue;

				if (string_indexof(current, ":") < 0)
					continue;

				if (/^\s*\/\//.test(current))
					continue;

				var property = strip_whitespace(current.replace(/^(.*?)\s*:.*/, "$1"));
				var value = strip_whitespace(current.replace(/^.*?:\s*(.*)$/, "$1"));

				var important = false;
				if (value.match(/!important$/)) {
					important = true;
					value = strip_whitespace(value.replace(/!important$/, ""));
				}

				styles[property] = {value: value, important: important};
			}

			return styles;
		}

		function get_styletag_styles(str) {
			// TODO: use parse_styles instead
			var styles = get_processed_styles(str);
			if (!styles)
				return;

			var styles_array = [];
			for (var property in styles) {
				var current = property + ": " + styles[property].value;
				if (styles[property].important || true) {
					current += " !important"
				}

				styles_array.push(current);
			}

			return styles_array.join("; ");
		}

		function apply_styles(el, str, options) {
			var style_blocks = parse_styles(str, true);
			if (!style_blocks)
				return;

			// currently unused because revert_styles isn't used anywhere
			if (options.allow_revert) {
				var oldstyle = el.getAttribute("style"); // this can be expensive for `all: initial` styles
				if (oldstyle) {
					el.setAttribute("data-imu-oldstyle", oldstyle);
				}
			}

			var styles = {};

			if ("default" in style_blocks)
				styles = style_blocks["default"];

			if (options.id && ("#" + options.id) in style_blocks) {
				var block = style_blocks["#" + options.id];
				for (var property in block) {
					if (!(property in styles)) styles[property] = [];
					array_extend(styles[property], block[property]);
				}
			}

			// avoid modifying the source object if format_string adds new variables
			var format_vars = shallowcopy(options.format_vars);

			var iter = function(property, obj) {
				var value = obj.value;

				// todo: maybe handle escape sequences with JSON_parse?
				if (value.match(/^['"].*['"]$/)) {
					value = value.replace(/^["'](.*)["']$/, "$1");
				}

				if (options.old_variables) {
					for (var variable in options.old_variables) {
						value = string_replaceall(value, variable, options.old_variables[variable]);
					}
				}

				if (options.format_vars) {
					var formatted = format_string_single(value, format_vars);
					if (!formatted) return;
					value = formatted;
				}

				if (options.properties) {
					if (property in options.properties) {
						options.properties[property](value, property);
					}
				}

				if (obj.important || options.force_important) {
					el.style.setProperty(property, value, "important");
				} else {
					el.style.setProperty(property, value);
				}

				el.setAttribute("data-imu-newstyle", true);
			};

			for (var property in styles) {
				array_foreach(styles[property], function(obj) {
					iter(property, obj);
				});
			}
		}

		function revert_styles(el) {
			var oldstyle = el.getAttribute("data-imu-oldstyle");

			if (oldstyle) {
				el.setAttribute("style", oldstyle);
				el.removeAttribute("data-imu-oldstyle");
			} else if (el.getAttribute("style") && el.getAttribute("data-imu-newstyle")) {
				el.removeAttribute("style");
			}

			el.removeAttribute("data-imu-newstyle");
		}

		function set_important_style(el, property, value) {
			el.style.setProperty(property, value, "important");
		}

		function get_caption(obj, el) {
			if (obj && obj.extra && obj.extra.caption) {
				return strip_whitespace(obj.extra.caption);
			}

			if (el) {
				do {
					// don't use el.title/el.alt because if the element is <form>, it refers to form > input[name="title"]
					var el_title = el.getAttribute("title");
					var el_alt = el.getAttribute("alt");

					if (el_title || el_alt) {
						var caption = el_title || el_alt;

						// When opening an image in a new tab in Firefox, alt is set to the src
						if (caption === el.src)
							return null;

						return strip_whitespace(caption);
					}
				} while ((el = el.parentElement));
			}

			return null;
		}

		function get_el_dimensions(el) {
			var el_tagname = get_tagname(el);

			if (el_tagname === "VIDEO") {
				return [
					el.videoWidth,
					el.videoHeight
				];
			} else if (el_tagname === "CANVAS") {
				return [
					el.width,
					el.height
				];
			} else if (el_tagname === "SVG") {
				return [
					el.width.animVal.value,
					el.height.animVal.value
				];
			} else if (el_tagname === "IMG") {
				let dims = get_image_dims(el);
				return [
					dims.width,
					dims.height
				]
			} else if (el_tagname === "IMG" || el_tagname === "PICTURE") {
				return [
					el.naturalWidth,
					el.naturalHeight
				]
			} else { // e.g. <audio>
				return [
					// .style. is a hack in order to get the dimensions before the element is created
					el.offsetWidth || getUnit(el.style.width),
					el.offsetHeight || getUnit(el.style.height)
				]
			}
		}

		function add_link_to_history(link) {
			if (is_extension) {
				extension_send_message({
					type: "add_to_history",
					data: {
						url: link
					}
				});
			}
		}

		// {}-based
		var parse_format = function(formatstr) {
			var segments = [];

			var push_segment = function() {
				if (!current.length) return;

				if (in_bracket) {
					segments.push({text: current, type: "var"});
				} else {
					segments.push(current);
				}

				current = "";
			};

			var current = "";
			var in_bracket = false;
			var escape = false;
			for (var i = 0; i < formatstr.length; i++) {
				var c = formatstr[i];

				if (c === '\\') {
					if (escape) {
						current += '\\';
					} else {
						escape = true;
					}

					continue;
				}

				if (escape) {
					current += c;
					continue;
				}

				if (c === '{') {
					if (!in_bracket) {
						push_segment();

						in_bracket = true;
						continue;
					}
				} else if (c === '}') {
					if (in_bracket) {
						push_segment();

						in_bracket = false;
						continue;
					}
				}

				current += c;
			}

			push_segment();
			return segments;
		};

		var format_string_single = function(formatstr, vars) {
			// don't need to care about anything after // because / shouldn't be in the filename anyways
			formatstr = formatstr.replace(/\/\/.*/, "");
			formatstr = strip_whitespace(formatstr);
			if (!formatstr) return null;

			var parsed = parse_format(formatstr);
			var str = "";

			for (var i = 0; i < parsed.length; i++) {
				if (typeof parsed[i] === "string") {
					str += parsed[i];
				} else {
					var varname = parsed[i].text;
					var default_value = null;
					var compare_value = null;
					var compare_not = false;
					var op = null;
					var compare_flags = [];

					var match = varname.match(/^([^?]+)[?](.*)$/);
					if (match) {
						varname = match[1];
						default_value = match[2];
					}

					match = varname.match(/^([^!/:=]+)([!=]=)(.*)$/);
					if (match) {
						varname = match[1];
						compare_value = match[3];
						compare_not = match[2] === "!=";
						op = "eq";
					}

					match = varname.match(/^([^!/:=]+)(!)?\/([rc]{0,2})=(.*)$/);
					if (match) {
						varname = match[1];
						compare_value = match[4];
						compare_not = match[2] === "!";
						op = "contains";
						var flags = match[3];
						if (string_indexof(flags, "r") >= 0)
							compare_flags.push("regex");
						if (string_indexof(flags, "c") >= 0)
							compare_flags.push("nicase");
					}

					match = varname.match(/^([^!/:=]+):=(.*)$/);
					if (match) {
						varname = match[1];
						compare_value = match[2];
						op = "set";
					}

					var varvalue = vars[varname];

					var match = varname.match(/^(.*?):([0-9]+)(\.)?$/);
					if (match) {
						varvalue = vars[match[1]];
						if (varvalue) {
							var newvalue = varvalue.substr(0, parseInt(match[2]));
							if (match[3]) {
								if (newvalue !== varvalue) {
									// …
									newvalue += "\u2026";
								}
							}
							varvalue = newvalue;
						}
					}

					var usevar = !!varvalue;

					if (varvalue && typeof varvalue === "object") {
						var varobj = varvalue;
						varvalue = "";

						if ("usable" in varobj) {
							usevar = varobj.usable;
						}

						if ("value" in varobj) {
							varvalue = varobj.value;
						}
					}

					if (op) {
						if (usevar) {
							if (op === "eq") {
								usevar = varvalue === compare_value;
							} else if (op === "contains") {
								if (array_indexof(compare_flags, "nicase") < 0) {
									varvalue = varvalue.toLowerCase();
									compare_value = compare_value.toLowerCase(); // fixme: this might not be good for regex
								}

								if (array_indexof(compare_flags, "regex") >= 0) {
									usevar = (new RegExp(compare_value)).test(varvalue);
								} else {
									usevar = string_indexof(varvalue, compare_value) >= 0;
								}
							}
						}

						// not in the usevar block because it may not exist
						if (op === "set") {
							vars[varname] = compare_value;
							usevar = true;
						}

						if (compare_not)
							usevar = !usevar;

						varvalue = "";
					}

					if (!usevar) {
						if (typeof default_value === "string") {
							varvalue = default_value;
						} else {
							return null;
						}
					}

					str += varvalue;
				}
			}

			// if it's a {x==y}{var:=value} rule, this should return a falsey value
			return strip_whitespace(str);
		};

		var pluralify = function(number, forms) {
			if (number === 1) {
				return forms[0];
			} else {
				return forms[1];
			}
		};

		var format_ago = function(delta, max_units) {
			if (!max_units) max_units = 2;

			// we don't care about milliseconds
			delta = (delta / 1000)|0;

			// fixme: this isn't really accurate due to averages
			var units = {
				seconds: delta % 60,
				minutes: ((delta / 60)|0) % 60,
				hours  : ((delta / 60 / 60)|0) % 24,
				days   : ((delta / 60 / 60 / 24)|0),
				//weeks: ((delta / 60 / 60 / 24 / 7)|0), // is this really needed?
				months : ((delta / 60 / 60 / 24 / 30.4375)|0), // (365 * 3 + 366) / (12 * 4)
				years  : ((delta / 60 / 60 / 24 / 365.25)|0) // (365 * 3 + 366) / 4
			};

			var mod_units = {
				months_years: 12,
				days_years: 365.25,
				days_months: 30.4375,
				days_weeks: 7
			};

			var unit_names = {
				seconds: "second",
				minutes: "minute",
				hours: "hour",
				days: "day",
				weeks: "week",
				months: "month",
				years: "year"
			};

			var unit_keys = Object.keys(units).reverse();
			var valid_units = [];

			array_foreach(unit_keys, function(unit) {
				if (valid_units.length >= max_units) return false;

				var value = units[unit];

				var last_valid = valid_units[valid_units.length - 1];
				if (last_valid) {
					var mod = mod_units[unit + "_" + last_valid[0]];
					if (mod) {
						value = (value % mod)|0;
					}
				}

				if (!value) {
					// "1 year and 1 day ago" is interesting, but hardly useful. makes the leap year average problem more noticeable
					if (valid_units.length) return false;
					return;
				}

				valid_units.push([unit, value]);
			});

			if (!valid_units.length) {
				return null;
			}

			var formatted_units = [];
			array_foreach(valid_units, function(unit_value) {
				var unit = unit_value[0];
				var value = unit_value[1];
				var unit_name = unit_names[unit];

				var proper_name = pluralify(value, [unit_name, unit_name + "s"]);
				formatted_units.push(value + " " + proper_name);
			});

			// fixme for 3 or more
			return formatted_units.join(" and ") + " ago";
		};

		var format_string = function(formatstrs, vars) {
			if (!is_array(formatstrs)) formatstrs = formatstrs.split("\n");

			for (var i = 0; i < formatstrs.length; i++) {
				var formatted = format_string_single(formatstrs[i], vars);
				if (formatted) return formatted;
			}

			return null;
		};

		var fill_obj_filename = function(newobj, url, respdata) {
			if (typeof newobj.filename !== "string")
				newobj.filename = "";

			var modified_date = null;

			var contenttype_ext = null;
			var orig_filename = null;
			var wanted_ext = null;
			if (respdata) {
				try {
					var headers = parse_headers(respdata.responseHeaders);
					for (var h_i = 0; h_i < headers.length; h_i++) {
						var header_name = headers[h_i].name.toLowerCase();
						var header_value = headers[h_i].value;

						if (header_name === "content-disposition") {
							// http://cfile7.uf.tistory.com/original/227CF24E57ABEC701869E7
							// Content-Disposition: inline; filename="160731 LA Kcon stage - 15 copy.jpg"; filename*=UTF-8''160731%20LA%20Kcon%20stage%20-%2015%20copy.jpg
							var loops = 0;
							while (loops < 100 && typeof header_value === "string" && header_value.length > 0) {
								var current_value = header_value.replace(/^\s*([^;]*?)\s*(?:;.*)?$/, "$1");
								//header_value = header_value.replace(/^[^;]*(?:;\s*(.*))?$/, "$1");

								var attr = current_value.replace(/^\s*([^=;]*?)\s*(?:[=;].*)?$/, "$1").toLowerCase();
								var a_match = header_value.match(/^[^=;]*(?:(?:=\s*(?:(?:["']([^'"]*?)["'])|([^;]*?))\s*(;.*)?\s*)|;\s*(.*))?$/);
								if (!a_match) {
									console_error("Header value does not match pattern:", header_value);
									break;
								}
								var a_value = a_match[1] || a_match[2];

								// TODO: implement properly
								/*if (attr === "filename*") {
									newobj.filename = a_value;
								}*/

								if (newobj.filename.length === 0 && attr === "filename" && typeof a_value === "string" && a_value.length > 0) {
									newobj.filename = a_value;
								}

								header_value = a_match[3] || a_match[4];
								loops++;
							}
						} else if (header_name === "content-type") {
							contenttype_ext = get_ext_from_contenttype(header_value);
						} else if (header_name === "last-modified") {
							modified_date = new Date(header_value);
							if (isNaN(modified_date.getTime())) modified_date = null;
						}

						if (newobj.filename.length > 0 && contenttype_ext && modified_date) {
							// we found everything we're looking for
							break;
						}
					}
				} catch (e) {
					console_error(e);
				}

				var is_data = /^data:/.test(url);

				if (is_data) newobj.filename = "";

				var found_filename_from_url = false;
				if (newobj.filename.length === 0 && !is_data) {
					newobj.filename = url.replace(/.*\/([^?#/]*)(?:[?#].*)?$/, "$1");
					found_filename_from_url = true;

					// Disable as there's no use for this
					if (false && (newobj.filename.split(".").length - 1) === 1) {
						newobj.filename = newobj.filename.replace(/(.*)\.[^.]*?$/, "$1");
					}
				}

				// thanks to fireattack on discord for reporting.
				// test: https://hiyoko-bunko.com/specials/h0xmtix1pv/
				// https://images.microcms-assets.io/protected/ap-northeast-1:92243b3c-cb7c-44e8-9c84-28ba954120c5/service/hiyoko-bunko/media/hb_sns_%E3%82%A4%E3%83%98%E3%82%99%E3%83%B3%E3%83%88%E5%BD%93%E6%97%A5_200831.jpg
				if (found_filename_from_url) {
					newobj.filename = decodeURIComponent(newobj.filename);
				}

				orig_filename = newobj.filename;

				// e.g. for /?...
				if (newobj.filename.length === 0) {
					newobj.filename = "download";
				}

				var filename_split = url_basename(newobj.filename, {
					split_ext: true,
					known_ext: true
				});

				if (contenttype_ext && !filename_split[1]) {
					if (orig_filename.length)
						orig_filename += "." + contenttype_ext;
					newobj.filename += "." + contenttype_ext;
				}

				filename_split = url_basename(newobj.filename, {
					split_ext: true,
					known_ext: true
				});
				if (filename_split[1])
					wanted_ext = filename_split[1];
			}

			// to avoid formatting the filename multiple times
			if (!("_orig_filename" in newobj)) newobj._orig_filename = orig_filename;

			var format_vars = {
				filename: newobj._orig_filename
			};

			format_vars.host_url = window_location;

			format_vars.host_domain = get_domain_from_url(window_location);
			format_vars.host_domain_nosub = get_domain_nosub(format_vars.host_domain);

			try {
				format_vars.host_title = document.title;
			} catch (e) {
				// only available for browser versions
			}

			if (newobj.url && /^https?:\/\//i.test(newobj.url)) {
				format_vars.url = newobj.url;

				format_vars.domain = get_domain_from_url(newobj.url);
				format_vars.domain_nosub = get_domain_nosub(format_vars.domain);
			}

			// todo: only create when needed
			var create_date = function(name, date) {
				var map = {
					"year": "FullYear",
					"month": "Month",
					"day": "Date",
					"hours": "Hours",
					"minutes": "Minutes",
					"seconds": "Seconds"
				};

				var values = [];

				for (var x in map) {
					var local_value = date["get" + map[x]]();
					var utc_value = date["getUTC" + map[x]]();

					if (x === "month") {
						local_value++;
						utc_value++;
					}

					local_value = zpadnum(local_value, 2);
					utc_value = zpadnum(utc_value, 2);

					values[x] = local_value;
					values[x + "_utc"] = utc_value;
					format_vars[name + "_" + x] = local_value;
					format_vars[name + "_" + x + "_utc"] = utc_value;
				}

				format_vars[name + "_iso"] = values.year + "-" + values.month + "-" + values.day + "T" + values.hours + "-" + values.minutes + "-" + values.seconds;
				format_vars[name + "_iso_utc"] = values.year_utc + "-" + values.month_utc + "-" + values.day_utc + "T" + values.hours_utc + "-" + values.minutes_utc + "-" + values.seconds_utc;

				format_vars[name + "_yyyymmdd"] = values.year + values.month + values.day;
				format_vars[name + "_yyyymmdd_utc"] = values.year_utc + values.month_utc + values.day_utc;
				format_vars[name + "_hhmmss"] = values.hours + values.minutes + values.seconds;
				format_vars[name + "_hhmmss_utc"] = values.hours_utc + values.minutes_utc + values.seconds_utc;

				var ago;
				if (name !== "download" && (ago = format_ago(Date.now() - date.getTime()))) {
					format_vars[name + "_ago"] = ago;
				}

				format_vars[name + "_unix_ms"] = date.getTime();
				format_vars[name + "_unix"] = (date.getTime() / 1000)|0;
			};

			var created_date = null;
			var updated_date = null;
			var download_date = new Date();
			if (newobj.extra) {
				var extra_copy = [
					"caption",
					"author_username",
					"id"
				];

				array_foreach(extra_copy, function(prop) {
					format_vars[prop] = newobj.extra[prop];
				});

				if (newobj.extra.created_date)
					created_date = new Date(newobj.extra.created_date)

				if (newobj.extra.updated_date)
					updated_date = new Date(newobj.extra.updated_date);
			}

			if (!updated_date && modified_date)
				updated_date = modified_date;

			if (created_date) create_date("created", created_date);
			if (updated_date || created_date) create_date("updated", updated_date || created_date);
			if (download_date) create_date("download", download_date);

			if (created_date || updated_date) create_date("date", created_date || updated_date);

			if (format_vars.filename) {
				var ext_split = url_basename(format_vars.filename, {
					split_ext: true,
					known_ext: true
				});
				format_vars.filename_noext = ext_split[0];
				if (wanted_ext)
					format_vars.ext = "." + wanted_ext;
			}

			newobj.format_vars = shallowcopy(format_vars);

			var new_filename = get_filename_from_format(settings.filename_format, format_vars);
			if (new_filename) {
				newobj.filename = new_filename;
			} else {
				newobj.filename = add_filename_ext(newobj.filename, format_vars);
			}
		};

		var format_string_post = function(str, vars) {
			if (str) {
				if (vars.prefix)
					str = vars.prefix + str;

				if (vars.suffix)
					str += vars.suffix;
			}

			return str;
		};

		var add_filename_ext = function(filename, format_vars) {
			filename = format_string_post(filename, format_vars);

			var filename_split = url_basename(filename, {
				split_ext: true,
				known_ext: true
			});

			if (!filename_split[1] && format_vars.ext) {
				filename += format_vars.ext;
			}

			return filename;
		};

		var get_filename_from_format = function(format, format_vars) {
			var formatted = format_string(format, format_vars);
			if (!formatted) return null;

			return add_filename_ext(formatted, format_vars);
		};

		function makePopup(obj, orig_url, processing, data) {
			if (_nir_debug_) {
				console_log("makePopup", obj, orig_url, processing, data);
			}

			if (settings.mouseover_add_to_history) {
				add_link_to_history(data.data.obj.url);
			}

			if (orig_url && settings.mouseover_add_thumbnail_to_history) {
				add_link_to_history(orig_url);
			}

			var openb = get_tprofile_single_setting("mouseover_open_behavior");
			if (openb === "newtab" || openb ==="newtab_bg" || openb === "download" || openb === "copylink" || openb === "replace") {
				stop_waiting();

				var theobj = data.data.obj;

				// TODO: improve fix (for data: urls)
				if (typeof theobj === "string") {
					theobj = {url: theobj};
				}

				var resp = data.data.resp || data.data.respdata;
				if (resp.finalUrl)
					theobj.url = resp.finalUrl;

				fill_obj_filename(theobj, theobj.url, resp);
				popup_obj = theobj;

				if (openb === "newtab" || openb === "newtab_bg") {
					open_in_tab_imu(theobj, openb === "newtab_bg");
				} else if (openb === "download") {
					download_popup_media();
				} else if (openb === "copylink") {
					clipboard_write_link(theobj.url);
				} else if (openb === "replace") {
					// todo: use popup options instead of replace images options
					var replace_options = get_replace_images_options();
					replace_single_media(replace_options, {el: popup_el}, data, common_functions["nullfunc"]);
				}

				return;
			}

			//var x = mouseX;//mouseAbsX;
			//var y = mouseY;//mouseAbsY;
			var x = data.x;
			var y = data.y;

			if (x === null || x === void 0) {
				x = lastX;
			}

			if (y === null || y === void 0) {
				y = lastY;
			}

			dragged = false;
			dragstart = false;
			var seekstart = false;

			function cb(img, url) {
				if (!img) {
					delay_handle_triggering = false;

					if (processing.running) {
						stop_waiting_cant_load();
					}
					return;
				}

				var is_video = img.tagName === "VIDEO";
				var is_audio = img.tagName === "AUDIO";
				var is_stream = is_video || is_audio;

				var newobj = data.data.obj;

				if (!newobj)
					newobj = {};

				popup_obj = newobj;

				var estop = function(e) {
					e.stopPropagation();
					e.stopImmediatePropagation();
					return true;
				};

				var estop_pd = function(e) {
					e.preventDefault();
					estop(e);
					return true;
				};

				lastX = x;
				lastY = y;

				popupOpenX = x;
				popupOpenY = y;
				popupOpenLastX = x;
				popupOpenLastY = y;

				var initial_zoom_behavior = get_single_setting("mouseover_zoom_behavior");

				var last_zoom_behavior = get_single_setting("mouseover_zoom_use_last");
				var use_last_zoom = false;
				if (popup_last_zoom && (last_zoom_behavior === "always" ||
					(last_zoom_behavior === "gallery" && popup_el_automatic))) {
					use_last_zoom = true;
				}

				//img.onclick = estop;
				//img.onmousedown = estop;
				//img.addEventListener("click", estop, true);
				//img.addEventListener("mousedown", estop, true);

				var bgcolor = "#333";
				var fgcolor = "#fff";
				var textcolor = "#fff";
				var shadowcolor = "rgba(0,0,0,.5)";

				var enable_mask_styles = get_single_setting("mouseover_enable_mask_styles2");
				var old_mask_opacity = 1;

				var setup_mask_el = function(mask) {
					set_el_all_initial(mask);

					set_important_style(mask, "opacity", 1);

					if (enable_mask_styles !== "never") {
						apply_styles(mask, settings.mouseover_mask_styles2, {
							force_important: true
						});
					}

					// this allows us to respect a custom opacity for mouseover_mask_styles
					old_mask_opacity = mask.style.opacity;

					if (enable_mask_styles === "hold") {
						set_important_style(mask, "opacity", 0);
					}

					if (!settings.mouseover_close_click_outside &&
						!settings.mouseover_mask_ignore_clicks) {
						set_important_style(mask, "pointer-events", "none");
					}

					set_important_style(mask, "position", "fixed");
					set_important_style(mask, "z-index", maxzindex - 3);
					set_important_style(mask, "width", "100%");
					set_important_style(mask, "height", "100%");
					set_important_style(mask, "left", "0px");
					set_important_style(mask, "top", "0px");

					if (settings.mouseover_mask_fade_time > 0) {
						set_important_style(mask, "transition", "opacity " + (settings.mouseover_mask_fade_time / 1000.) + "s");

						if (enable_mask_styles !== "hold") {
							if (!popup_el_automatic) {
								set_important_style(mask, "opacity", 0);
								// this is needed in order to make the transition happen
								setTimeout(function() {
									set_important_style(mask, "opacity", old_mask_opacity);
								}, 1);
							} else {
								set_important_style(mask, "opacity", old_mask_opacity);
							}
						}
					}

					// same as the addbtn mousedown stop
					our_addEventListener(mask, "mousedown", function(e) {
						if (!settings.mouseover_close_click_outside)
							return;

						estop(e);
					});

					our_addEventListener(mask, "click", function(e) {
						if (!settings.mouseover_close_click_outside)
							return;

						estop(e);

						set_important_style(mask, "pointer-events", "none");
						resetpopups();
					}, true);

					return mask;
				};

				remove_mask();

				if (settings.mouseover_close_click_outside ||
					settings.mouseover_mask_ignore_clicks ||
					enable_mask_styles !== "never") {
					mask_el = document_createElement("div");
					setup_mask_el(mask_el);
				}

				var outerdiv = document_createElement("div");
				set_el_all_initial(outerdiv);
				set_important_style(outerdiv, "position", "fixed");
				set_important_style(outerdiv, "z-index", maxzindex - 2);

				var zoom_move_effect_enabled = false;
				if (settings.mouseover_fade_time > 0 && !popup_el_automatic) {
					var transition_effects = [];
					var temp_transition_effects = [];
					var fade_s = (settings.mouseover_fade_time / 1000.) + "s";

					if (settings.mouseover_enable_fade) {
						transition_effects.push("opacity " + fade_s);
						set_important_style(outerdiv, "opacity", 0);
					}

					if (settings.mouseover_enable_zoom_effect) {
						transition_effects.push("transform " + fade_s);
						set_important_style(outerdiv, "transform", "scale(0)");

						if (settings.mouseover_zoom_effect_move) {
							temp_transition_effects.push("top " + fade_s);
							temp_transition_effects.push("left " + fade_s);
							zoom_move_effect_enabled = true;
						}
					}

					if (transition_effects.length > 0) {
						var orig_transition_string = transition_effects.join(", ");

						array_extend(transition_effects, temp_transition_effects);
						var temp_transition_string = transition_effects.join(", ");
						set_important_style(outerdiv, "transition", temp_transition_string);

						if (temp_transition_effects.length > 0) {
							setTimeout(function() {
								set_important_style(outerdiv, "transition", orig_transition_string);
							}, settings.mouseover_fade_time);
						}
					}

					// setTimeout is needed in order to make the transition happen
					setTimeout(function() {
						set_important_style(outerdiv, "opacity", 1);
						set_important_style(outerdiv, "transform", "scale(1)");
					}, 1);
				}

				var div = document_createElement("div");
				var popupshown = false;
				set_el_all_initial(div);
				set_important_style(div, "box-shadow", "0 0 15px " + shadowcolor);
				set_important_style(div, "border", "3px solid " + fgcolor);
				set_important_style(div, "position", "relative");
				set_important_style(div, "top", "0px");
				set_important_style(div, "left", "0px");
				set_important_style(div, "display", "block");
				set_important_style(div, "background-color", "rgba(255,255,255,.5)");

				// http://png-pixel.com/
				var transparent_gif = "data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==";
				var styles_variables = {};
				if (popup_orig_url && !popup_el_is_stream) {
					styles_variables["%thumburl%"] = encodeuri_ifneeded(popup_orig_url);
				} else {
					styles_variables["%thumburl%"] = transparent_gif;
				}

				if (!is_stream) {
					styles_variables["%fullurl%"] = encodeuri_ifneeded(get_img_src(img));
				} else {
					styles_variables["%fullurl%"] = transparent_gif;
				}

				apply_styles(div, settings.mouseover_styles, {
					force_important: true,
					old_variables: styles_variables
				});
				outerdiv.appendChild(div);

				//div.style.position = "fixed"; // instagram has top: -...px
				//div.style.zIndex = maxzindex - 2;


				//div.onclick = estop;
				//div.onmousedown = estop;
				//div.addEventListener("click", estop, true);
				//div.addEventListener("mousedown", estop, true);
				// useful for instagram
				//disable_click = true;


				var outer_thresh = 16;
				var border_thresh = 20;
				var top_thresh = 30;
				var top_mb = top_thresh - border_thresh;
				var viewport;
				var vw;
				var vh;

				var v_mx = Math_max(x - border_thresh, 0);
				var v_my = Math_max(y - top_thresh, 0);

				var update_vwh = function(x, y) {
					viewport = get_viewport();
					vw = viewport[0];
					vh = viewport[1];

					vw -= border_thresh * 2;
					vh -= border_thresh + top_thresh;

					if (typeof x !== "undefined") {
						v_mx = Math_min(vw, Math_max(x - border_thresh, 0));
						v_my = Math_min(vh, Math_max(y - top_thresh, 0));
					}
				};

				var set_top = function(x) {
					outerdiv.style.top = x + "px";
				};

				var set_left = function(x) {
					outerdiv.style.left = x + "px";
				};

				var set_lefttop = function(xy) {
					set_top(xy[1]);
					set_left(xy[0]);
				};

				// https://stackoverflow.com/a/23270007
				function get_lefttopouter() {
					var style = outerdiv.currentStyle || window.getComputedStyle(outerdiv);
					return [style.marginLeft + style.borderLeftWidth,
							style.marginTop + style.borderTopWidth];
				}

				update_vwh(x, y);

				// TODO: improve
				var set_audio_size = function() {
					if (!is_audio) return;
					img.style.width = "500px";
					img.style.minWidth = "500px";
					img.style.height = "50px";
					img.style.minHeight = "50px";
				};

				set_audio_size();
				var el_dimensions = get_el_dimensions(img);
				// FIXME: when this is set, for some reason, some settings like min-width and min-height can't be set under chrome
				if (!is_audio) set_el_all_initial(img);
				//set_audio_size();

				var add_link = false;
				if (!is_stream && settings.mouseover_add_link) {
					add_link = true;
				} else if (is_video && settings.mouseover_add_video_link) {
					add_link = true;
				}

				if (add_link) {
					// don't !important because it'll override the waiting cursor for automatic (gallery) popups
					img.style.cursor = "pointer";
				}
				// https://stackoverflow.com/questions/7774814/remove-white-space-below-image
				img.style.verticalAlign = "bottom";

				set_important_style(img, "display", "block");

				var update_img_display = function(style) {
					img.style.setProperty("display", style[0], style[1]);
				};

				var visibility_workarounds = [
					// uBlock Origin on pornhub blocks: video[style*="display: block !important;"]
					{
						domain_nosub: /^pornhub(?:premium)?\./,
						img_display: ["block"]
					},
					{
						domain_nosub: /^pornhub(?:premium)?\./,
						img_display: ["initial", "important"]
					},

					// uBlock Origin on gelbooru blocks:
					//   a[target="_blank"] > img
					//   a[target="_blank"] > div
					// https://github.com/qsniyg/maxurl/issues/430#issuecomment-686768694
					{
						domain_nosub: /^gelbooru\./,
						func: function() {
							var span_el = document_createElement("span");
							span_el.appendChild(img);
							a.appendChild(span_el);
						}
					}
				];

				var check_visibility_workaround = function(workaround) {
					if (workaround.domain_nosub) {
						if (!workaround.domain_nosub.test(host_domain_nosub))
							return false;
					}

					return true;
				};

				var apply_visibility_workaround = function(workaround) {
					if (workaround.img_display) {
						update_img_display(workaround.img_display);
					} else if (workaround.func) {
						workaround.func();
					}
				};

				var check_img_visibility = function() {
					setTimeout(function() {
						var computed = get_computed_style(img);
						if (computed.display !== "none") {
							return;
						}

						while (visibility_workarounds.length > 0) {
							var current_workaround = visibility_workarounds.shift();

							if (!check_visibility_workaround(current_workaround))
								continue;

							apply_visibility_workaround(current_workaround);

							if (visibility_workarounds.length > 0)
								check_img_visibility();

							break;
						}
					}, 50);
				};
				check_img_visibility();

				// https://github.com/qsniyg/maxurl/issues/330
				set_important_style(img, "object-fit", "contain");

				var img_naturalHeight, img_naturalWidth;

				img_naturalWidth = el_dimensions[0];
				img_naturalHeight = el_dimensions[1];

				var imgh = img_naturalHeight;
				var imgw = img_naturalWidth;

				var setup_initial_zoom = function(initial_zoom_behavior, use_last_zoom) {
					var update_sizes = false;

					if (initial_zoom_behavior === "custom" || use_last_zoom) {
						var zoom_percent = settings.mouseover_zoom_custom_percent / 100;
						if (use_last_zoom)
							zoom_percent = popup_last_zoom;

						imgw = Math_max(img_naturalWidth * zoom_percent, 20);
						imgh = Math_max(img_naturalHeight * zoom_percent, 20);

						update_sizes = true;
					} else if (initial_zoom_behavior === "fit" || initial_zoom_behavior === "fill") {
						img.style.maxWidth = vw + "px";
						img.style.maxHeight = vh + "px";

						if (initial_zoom_behavior === "fill" && (img_naturalWidth < vw && img_naturalHeight < vh)) {
							var zoom_percent = 1;
							if (img_naturalHeight > img_naturalWidth) {
								zoom_percent = vh / img_naturalHeight;
							} else {
								zoom_percent = vw / img_naturalWidth;
							}

							imgw *= zoom_percent;
							imgh *= zoom_percent;

							update_sizes = true;
						}
					} else if (initial_zoom_behavior === "full") {
						imgw = img_naturalWidth;
						imgh = img_naturalHeight;

						update_sizes = true;
					}

					if (update_sizes) {
						img.style.maxWidth = imgw + "px";
						img.style.width = img.style.maxWidth;
						img.style.maxHeight = imgh + "px";
						img.style.height = img.style.maxHeight;
					}
				}
				setup_initial_zoom(initial_zoom_behavior, use_last_zoom);

				if (imgh < 20 || imgw < 20) {
					// FIXME: This will stop "custom" percentages with low percentages for small images
					stop_waiting_cant_load();
					console_error("Image too small to popup (" + imgw + "x" + imgh + ")");
					return;
				}

				var get_imghw_for_fit = function(width?:number, height?:number):[number, number] {
					if (width === void 0)
						width = vw;

					if (height === void 0)
						height = vh;

					//height -= border_thresh * 2;
					//width  -= border_thresh * 2;

					var our_imgh = imgh;
					var our_imgw = imgw;

					if (imgh > height || imgw > width) {
						var ratio;
						if (imgh / height >
							imgw / width) {
							ratio = imgh / height;
						} else {
							ratio = imgw / width;
						}

						our_imgh /= ratio;
						our_imgw /= ratio;
					}

					return [our_imgw, our_imgh];
				};

				function calc_imghw_for_fit(width?:number, height?:number) {
					var new_imghw = get_imghw_for_fit(width, height);

					imgw = new_imghw[0];
					imgh = new_imghw[1];
				}

				if ((initial_zoom_behavior === "fit" || initial_zoom_behavior === "fill") && !use_last_zoom) {
					calc_imghw_for_fit();
				}

				var max_width = settings.mouseover_zoom_max_width || void 0;
				var max_height = settings.mouseover_zoom_max_height || void 0;
				if (max_width || max_height) {
					calc_imghw_for_fit(max_width, max_height);
				}

				popup_update_zoom_func = function(mode) {
					var use_last_zoom = false;
					if (mode === "last") {
						mode = get_single_setting("mouseover_zoom_behavior");
						if (popup_last_zoom)
							use_last_zoom = true;
					}

					setup_initial_zoom(mode, use_last_zoom);

					if (mode === "fit" || mode === "fill")
						calc_imghw_for_fit();

					set_popup_width(imgw, "initial");
					set_popup_height(imgh, "initial");
				};

				popup_update_pos_func = function(x, y, resize) {
					var popup_left, popup_top;

					update_vwh(x, y);

					var sct = scrollTop();
					var scl = scrollLeft();
					sct = scl = 0;

					var overflow_x = imgw > vw;
					var overflow_y = imgh > vh;

					var mouseover_position = get_single_setting("mouseover_position");
					if ((popup_hold && settings.mouseover_hold_position_center) ||
						(settings.mouseover_overflow_position_center && (overflow_x || overflow_y)))
						mouseover_position = "center";

					if (mouseover_position === "cursor") {
						popup_top =  sct + Math_min(Math_max(v_my - (imgh / 2), 0), Math_max(vh - imgh, 0));
						popup_left = scl + Math_min(Math_max(v_mx - (imgw / 2), 0), Math_max(vw - imgw, 0));
					} else if (mouseover_position === "center") {
						var origin = get_single_setting("mouseover_overflow_origin");
						var ox = origin[1];
						var oy = origin[2];

						var top_x = 0;
						var top_y = 0;
						var bottom_x = vw - imgw;
						var bottom_y = vh - imgh;
						var middle_x = (vw - imgw) / 2;
						var middle_y = (vh - imgh) / 2;

						var our_x = middle_x;
						var our_y = middle_y;

						if (overflow_x) {
							if (ox === "0") {
								our_x = top_x;
							} else if (ox === "1") {
								our_x = middle_x;
							} else if (ox === "2") {
								our_x = bottom_x;
							}
						}

						if (overflow_y) {
							if (oy === "0") {
								our_y = top_y;
							} else if (oy === "1") {
								our_y = middle_y;
							} else if (oy === "2") {
								our_y = bottom_y;
							}
						}

						popup_top =  sct + our_y;
						popup_left = scl + our_x;
					} else if (mouseover_position === "beside_cursor") {
						var update_imghw;
						if (resize) {
							update_imghw = function(w, h) {
								calc_imghw_for_fit(w, h);
							};
						} else {
							update_imghw = common_functions.nullfunc;
						}

						var calc_imgrect = function(w, h) {
							var new_imghw = [imgw, imgh];

							if (resize) {
								new_imghw = get_imghw_for_fit(w, h);
							}

							if (new_imghw[0] > w || new_imghw[1] > h)
								return null;

							return new_imghw;
						};

						var cursor_thresh = border_thresh;
						var ovw = vw - cursor_thresh;
						var ovh = vh - cursor_thresh;

						var calc_imgposd = function(lefttop, info, popupd) {
							var moused = lefttop ? v_mx : v_my;
							var vd = lefttop ? ovw : ovh;

							switch (info) {
								case -1:
									return Math_min(vd - popupd, Math_max(0, moused - (popupd / 2)));
								case 0:
									return Math_max(0, moused - popupd - cursor_thresh);
								case 1:
									return Math_min(vd - popupd, moused + cursor_thresh);
							}
						};

						var all_rects = [
							// top
							[-1, 0, ovw, v_my - cursor_thresh],
							// right
							[1, -1, ovw - v_mx - cursor_thresh, ovh],
							// bottom
							[-1, 1, ovw, ovh - v_my - cursor_thresh],
							// left
							[0, -1, v_mx - cursor_thresh, ovh]
						];

						var rects = [];

						// TODO: move the current popup position to the top

						if (x > viewport[0] / 2) {
							rects.push(all_rects[3]);
						} else {
							rects.push(all_rects[1]);
						}

						if (y > viewport[1] / 2) {
							rects.push(all_rects[0]);
						} else {
							rects.push(all_rects[2]);
						}

						for (var i = 0; i < all_rects.length; i++) {
							if (array_indexof(rects, all_rects[i]) < 0) {
								rects.push(all_rects[i]);
							}
						}

						var largest_rectsize = -1;
						var largest_rect = null;
						var largest_origrect = null;

						for (var i = 0; i < rects.length; i++) {
							var our_rect = calc_imgrect(rects[i][2], rects[i][3]);
							if (!our_rect)
								continue;

							var our_rectsize = our_rect[0] * our_rect[1];
							if (our_rectsize > largest_rectsize) {
								largest_rectsize = our_rectsize;
								largest_rect = our_rect;
								largest_origrect = rects[i];
							}
						}

						if (!largest_origrect) {
							largest_rectsize = -1;
							for (var i = 0; i < rects.length; i++) {
								var rectsize = rects[i][2] * rects[i][3];
								if (rectsize > largest_rectsize) {
									largest_origrect = rects[i];
									largest_rectsize = rectsize;
								}
							}
						}

						if (largest_origrect) {
							update_imghw(largest_origrect[2], largest_origrect[3]);

							popup_top = calc_imgposd(false, largest_origrect[1], imgh);
							popup_left = calc_imgposd(true, largest_origrect[0], imgw);
						} else {
							// ???
						}
					} else if (mouseover_position === "beside_cursor_old") {
						// TODO: maybe improve this to be more interpolated?

						var popupx;
						var popupy;

						var cursor_thresh = border_thresh;

						var ovw = vw - cursor_thresh;
						var ovh = vh - cursor_thresh;

						var update_imghw;
						if (resize) {
							update_imghw = function(w, h) {
								calc_imghw_for_fit(w, h);
							};
						} else {
							update_imghw = common_functions.nullfunc;
						}

						update_imghw(ovw, ovh);

						for (var loop_i = 0; loop_i < (resize ? 16 : 1); loop_i++) {
							if (y > viewport[1] / 2) {
								popupy = v_my - imgh - cursor_thresh;
							} else if (popupy === void 0) {
								popupy = v_my + cursor_thresh;
							}

							if (x > viewport[0] / 2) {
								popupx = v_mx - imgw - cursor_thresh;
							} else if (popupx === void 0) {
								popupx = v_mx + cursor_thresh;
							}

							if (popupy < 0) {
								popupy = 0;

								if (settings.mouseover_prevent_cursor_overlap) {
									update_imghw(ovw, v_my);
									//continue;
								}
							}

							if (popupx < 0) {
								popupx = 0;

								if (settings.mouseover_prevent_cursor_overlap) {
									update_imghw(v_mx, ovh);
									//continue;
								}
							}

							if ((popupy + imgh) > vh) {
								if (settings.mouseover_prevent_cursor_overlap) {
									update_imghw(ovw, ovh - v_my);
									//continue;
								} else {
									popupy = Math_max(vh - imgh - cursor_thresh, 0);
								}
							}

							if ((popupx + imgw) > vw) {
								if (settings.mouseover_prevent_cursor_overlap) {
									update_imghw(ovw - v_mx, ovh);
									//continue;
								} else {
									popupx = Math_max(vw - imgw - cursor_thresh, 0);
								}
							}

							//break;
						}

						popup_top =  popupy;
						popup_left = popupx;
					}

					return [
						popup_left + border_thresh,
						popup_top + top_thresh
					];
				};

				var initialpos = popup_update_pos_func(x, y, true);

				if (!zoom_move_effect_enabled) {
					set_lefttop(initialpos);
				} else {
					set_lefttop([x - imgw/2, y - imgh/2]);

					setTimeout(function() {
						set_lefttop(initialpos);
					}, 1);
				}

				var set_popup_size_helper = function(size, maxsize, widthheight) {
					if (maxsize === void 0)
						maxsize = size;

					if (typeof size === "number")
						size = size + "px";
					if (typeof maxsize === "number")
						maxsize = maxsize + "px";

					if (widthheight) {
						img.style.width = size;
						img.style.maxWidth = maxsize;
					} else {
						img.style.height = size;
						img.style.maxHeight = maxsize;
					}
				};

				var set_popup_width = function(width, maxwidth) {
					set_popup_size_helper(width, maxwidth, true);
				};

				var set_popup_height = function(height, maxheight) {
					set_popup_size_helper(height, maxheight, false);
				};

				set_popup_width(imgw, "initial");
				set_popup_height(imgh, "initial");
				/*console_log(x - (imgw / 2));
				  console_log(vw);
				  console_log(imgw);
				  console_log(vw - imgw);*/

				function get_defaultopacity() {
					var defaultopacity = (settings.mouseover_ui_opacity / 100);
					if (isNaN(defaultopacity))
						defaultopacity = 1;
					if (defaultopacity > 1)
						defaultopacity = 1;
					if (defaultopacity < 0)
						defaultopacity = 0;

					return defaultopacity;
				}

				var defaultopacity = get_defaultopacity();

				function opacity_hover(el, targetel?:HTMLElement, action?:boolean) {
					if (!targetel)
						targetel = el;

					our_addEventListener(el, "mouseover", function(e) {
						targetel.style.opacity = "1.0";

						if (action)
							targetel.style.boxShadow = "0px 0px 5px 1px white";
					}, true);
					our_addEventListener(el, "mouseout", function(e) {
						targetel.style.opacity = get_defaultopacity();

						if (action)
							targetel.style.boxShadow = "none";
					}, true);
				}

				var get_popup_dimensions = function() {
					return [
						(popupshown && outerdiv.clientWidth) || imgw,
						(popupshown && outerdiv.clientHeight) || imgh
					];
				};

				var btndown = false;
				function addbtn(options) {
					var tagname = "span";
					if (typeof options.action === "string")
						tagname = "a";
					// todo: preparse user styles, then set tagname to img if image

					var btn = document_createElement(tagname);

					if (options.action) {
						var do_action = function() {
							return !btn.hasAttribute("data-btn-noaction");
						};

						if (typeof options.action === "object") {
							var old_action = options.action;
							options.action = function() {
								action_handler(old_action);
							};
						}

						// thanks to Noodlers on discord for reporting
						// test: discord emoji picker, mousedown will close it
						our_addEventListener(btn, "mousedown", function(e) {
							e.stopPropagation();
							e.stopImmediatePropagation();
						});

						if (typeof options.action === "function") {
							our_addEventListener(btn, "click", function(e) {
								if (!do_action())
									return;

								//console_log(e);
								e.stopPropagation();
								e.stopImmediatePropagation();
								e.preventDefault();
								options.action();
								return false;
							}, true);
						} else if (typeof options.action === "string") {
							btn.href = options.action;
							btn.target = "_blank";
							btn.setAttribute("rel", "noreferrer");

							our_addEventListener(btn, "click", function(e) {
								e.stopPropagation();
								e.stopImmediatePropagation();
							}, true);
						}

						our_addEventListener(btn, "mouseover", function(e) {
							set_important_style(btn, "box-shadow", "0px 0px 5px 1px white");
						}, true);

						our_addEventListener(btn, "mouseout", function(e) {
							set_important_style(btn, "box-shadow", "none");
						}, true);
					}

					our_addEventListener(btn, "mousedown", function(e) {
						btndown = true;
					}, true);
					our_addEventListener(btn, "mouseup", function(e) {
						btndown = false;
					}, true);
					if (false && !options.istop) {
						opacity_hover(btn, void 0, true);
					} else if (typeof options.text === "object" && options.text.truncated !== options.text.full) {
						our_addEventListener(btn, "mouseover", function(e) {
							var computed_style = get_computed_style(btn);

							set_important_style(btn, "width", computed_style.width || (btn.clientWidth + "px"));
							set_important_style(btn, "height", "initial");

							btn.innerText = options.text.full;

						}, true);

						our_addEventListener(btn, "mouseout", function(e) {
							btn.innerText = options.text.truncated;
							btn.style.width = "initial";
						}, true);
					}

					set_el_all_initial(btn);
					if (options.action) {
						set_important_style(btn, "cursor", "pointer");
					}

					set_important_style(btn, "background", bgcolor);
					set_important_style(btn, "border", "3px solid " + fgcolor);
					set_important_style(btn, "border-radius", "10px");
					// test: https://www.yeshiva.org.il/ (topbarel sets this to ltr, so it must be set to the initial value in order to respect the direction)
					set_important_style(btn, "direction", text_direction);

					// workaround for emojis: https://stackoverflow.com/a/39776303
					if (typeof options.text === "string" && options.text.length === 1 && options.text.charCodeAt(0) > 256) {
						set_important_style(btn, "color", "transparent");
						set_important_style(btn, "text-shadow", "0 0 0 " + textcolor);
					} else {
						set_important_style(btn, "color", textcolor);
					}

					set_important_style(btn, "padding", "4px");
					set_important_style(btn, "line-height", "1em");
					//btn.style.whiteSpace = "nowrap";
					set_important_style(btn, "font-size", "14px");
					set_important_style(btn, "font-family", sans_serif_font);

					//set_important_style(btn, "height", "1em");

					// TODO: cache the styles
					apply_styles(btn, settings.mouseover_ui_styles, {
						id: options.id,
						force_important: true,
						format_vars: newobj.format_vars,
						properties: {
							"-imu-text": function(value) {
								// TODO: support emojis properly
								if (typeof options.text === "object")
									options.text.truncated = value;
								else
									options.text = value;
							},
							"-imu-title": function(value) {
								options.title = value;
							},
							"-imu-image": function(value) {
								options.image = value;
							},
							"-imu-pos": function(value) {
								options.pos = value;

								if (array_indexof(["top-left", "top-middle", "top-right",
									               "left", "middle", "right",
									               "bottom-left", "bottom-middle", "bottom-right"], value) < 0) {
									console_warn("Invalid pos", value);
									options.pos = "top-left";
								}
							}
						}
					});

					if (options.image) {
						options.text = null;
					}

					set_important_style(btn, "z-index", maxzindex - 1);
					if (false && !options.istop) {
						set_important_style(btn, "position", "absolute");
						set_important_style(btn, "opacity", defaultopacity);
					} else {
						set_important_style(btn, "position", "relative");
						set_important_style(btn, "margin-right", "4px");
					}
					set_important_style(btn, "vertical-align", "top");
					//btn.style.maxWidth = "50%";
					set_important_style(btn, "white-space", "pre-wrap");
					set_important_style(btn, "display", "inline-block");
					if (options.action) {
						set_important_style(btn, "user-select", "none");
					}

					if (typeof options.image === "string") {
						var img = document_createElement("img");
						set_el_all_initial(img);
						set_important_style(img, "padding", "0px");
						set_important_style(img, "margin", "0px");
						set_important_style(img, "display", "inline");
						set_important_style(img, "height", "1em");
						set_important_style(img, "cursor", "inherit");
						img.src = options.image;
						btn.appendChild(img);
					}

					if (options.text) {
						if (typeof options.text === "object" && options.text.link_underline && settings.mouseover_ui_link_underline) {
							set_important_style(btn, "text-decoration", "underline");
						}

						if (typeof options.text === "string") {
							btn.innerText = options.text;
						} else if (typeof options.text === "object") {
							btn.innerText = options.text.truncated;
						}
					}

					if (options.title)
						btn.title = options.title;

					if (options.containers && options.pos) {
						var container = options.containers[options.pos];

						container.appendChild(btn);

						// FIXME: container.clientWidth is 0 until it's visible
						var dimensions = get_popup_dimensions();
						if (container.hasAttribute("data-imu-middle_x")) {
							set_important_style(container, "left", ((dimensions[0] - container.clientWidth) / 2) + "px");
						}

						if (container.hasAttribute("data-imu-middle_y")) {
							set_important_style(container, "top", ((dimensions[1] - container.clientHeight) / 2) + "px");
						}
					}

					return btn;
				}

				var ui_els = [];

				var text_direction = "initial";

				var popup_el_style;
				if (popup_el) {
					popup_el_style = get_computed_style(popup_el);
				} else {
					popup_el_style = get_computed_style(document.body);
				}

				if (popup_el_style && popup_el_style.direction === "rtl") {
					text_direction = "rtl";
				}

				var cached_previmages = 0;
				var cached_nextimages = 0;

				function lraction(isright:boolean, is_scroll?:boolean) {
					trigger_gallery(isright ? 1 : -1, function(changed) {
						if (!changed) {
							if (is_scroll) {
								if (isright && settings.scroll_past_gallery_end_to_close) {
									resetpopups();
									return;
								}
							}

							create_ui();
						}
					});
				}

				var create_containerel = function(x, y, margin, boundingclientrect) {
					var topbarel = document_createElement("div");
					set_el_all_initial(topbarel);
					set_important_style(topbarel, "position", "absolute");
					set_important_style(topbarel, "opacity", defaultopacity);
					if (can_use_subzindex)
						set_important_style(topbarel, "z-index", maxzindex - 1);
					set_important_style(topbarel, "white-space", "nowrap");

					// test: https://www.yeshiva.org.il/
					// otherwise, the buttons are in the wrong order
					set_important_style(topbarel, "direction", "ltr");

					var left = null;
					var top = null;
					var bottom = null;
					var right = null;

					var original_width = imgw || img_naturalWidth;
					var bounding_width = boundingclientrect.width || original_width;
					var bounding_wadd = (bounding_width - original_width) / 2;

					var original_height = imgh || img_naturalHeight;
					var bounding_height = boundingclientrect.height || original_height;
					var bounding_hadd = (bounding_height - original_height) / 2;

					if (x === "left") {
						left = -(margin + bounding_wadd) + "px";
					} else if (x === "middle") {
						left = "calc(50%)";
						topbarel.setAttribute("data-imu-middle_x", "true");
					} else if (x === "right") {
						right = -(margin + bounding_wadd) + "px";
					}

					if (y === "top") {
						top = -(margin + bounding_hadd) + "px";
					} else if (y === "middle") {
						// TODO: add buttons vertically, not horizontally
						top = "calc(50%)";
						topbarel.setAttribute("data-imu-middle_y", "true");
					} else if (y === "bottom") {
						bottom = -(margin + bounding_hadd) + "px";
					}

					//console_log(left, right, top, bottom);

					if (left) set_important_style(topbarel, "left", left);
					if (right) set_important_style(topbarel, "right", right);
					if (top) set_important_style(topbarel, "top", top);
					if (bottom) set_important_style(topbarel, "bottom", bottom);

					return topbarel;
				};

				var ui_visible = !!settings.mouseover_ui;
				function create_ui(use_cached_gallery?:boolean, hide_ui?:true|"toggle") {
					for (var el_i = 0; el_i < ui_els.length; el_i++) {
						var ui_el = ui_els[el_i];
						ui_el.parentNode.removeChild(ui_el);
					}

					ui_els = [];

					var emi = 14;
					var em1 = emi + "px"
					var emhalf = (emi / 2) + "px";
					var gallerycount_fontsize = "13px";
					var galleryinput_fontsize = "12px";

					var img_boundingClientRect = img.getBoundingClientRect();

					var css_fontcheck = "14px " + sans_serif_font;

					var containers = {};

					var container_metas = {
						"top-left": ["left", "top"],
						"top-middle": ["middle", "top"],
						"top-right": ["right", "top"],
						"left": ["left", "middle"],
						"middle": ["middle", "middle"],
						"right": ["right", "middle"],
						"bottom-left": ["left", "bottom"],
						"bottom-middle": ["middle", "bottom"],
						"bottom-right": ["right", "bottom"]
					};

					obj_foreach(container_metas, function(key, data) {
						containers[key] = create_containerel(data[0], data[1], emi, img_boundingClientRect);
					});

					var do_hide = !settings.mouseover_ui;
					if (hide_ui) {
						if (hide_ui === "toggle") {
							do_hide = ui_visible;
						} else if (hide_ui === true) {
							do_hide = true;
						}
					}

					if (do_hide) {
						// Not sure why this is needed, but without it, clicking and dragging images doesn't work under Firefox (#78)
						outerdiv.appendChild(containers["top-left"]);
						ui_visible = false;
						return;
					} else {
						ui_visible = true;
					}

					for (var pos in containers) {
						opacity_hover(containers[pos]);
						outerdiv.appendChild(containers[pos]);
						ui_els.push(containers[pos]);
					}

					if (settings.mouseover_ui_closebtn) {
						var closebtn = addbtn({
							id: "closebtn",
							// \xD7 = ×
							text: "\xD7",
							title: _("Close") + " (" + _("ESC") + ")",
							action: function() {
								resetpopups();
							},
							pos: "top-left",
							containers: containers
						});
					};

					var get_img_orientation = function() {
						var rotation = get_popup_rotation();

						if (Math_abs(rotation) % 180 == 90) {
							return true;
						} else {
							return false;
						}
					};

					var get_img_width = function() {
						// This is needed if img isn't displayed yet
						return img_boundingClientRect.width || imgw || img_naturalWidth;
					};

					var get_img_height = function() {
						return img_boundingClientRect.height || imgh || img_naturalHeight;
					};

					// TODO: improve
					var get_img_disp_height = function() {
						if (get_img_orientation()) {
							return get_img_width();
						} else {
							return get_img_height();
						}
					};


					var prev_images = 0;
					var next_images = 0;
					var gallery_calcing = false;

					function get_imagesizezoom_text() {
						var text = "";

						var rect_height = get_img_disp_height();

						var zoom_percent = rect_height / img_naturalHeight;
						var currentzoom = parse_int(zoom_percent * 100);
						var filesize = 0;

						if (newobj && newobj.filesize)
							filesize = newobj.filesize;

						var format = "";

						var formatorder = [
							{
								value: img_naturalWidth + "x" + img_naturalHeight,
								valid: settings.mouseover_ui_imagesize,
							},
							{
								value: currentzoom + "%",
								valid_paren: currentzoom !== 100 ? true : false,
								valid: settings.mouseover_ui_zoomlevel
							},
							{
								value: size_to_text(filesize),
								valid: settings.mouseover_ui_filesize && filesize
							}
						];

						var entries = [];
						for (var i = 0; i < formatorder.length; i++) {
							var our_format = formatorder[i];

							if (!our_format.valid)
								continue;

							if (entries.length > 0 && our_format.valid_paren === false)
								continue;

							entries.push(our_format.value);
						}

						if (entries.length === 0)
							return "";

						text = entries[0];
						if (entries.length > 1) {
							text += " (" + entries.slice(1).join(", ") + ")";
						}

						return text;
					}

					if (settings.mouseover_ui_imagesize || settings.mouseover_ui_zoomlevel || settings.mouseover_ui_filesize) {
						var imagesize = addbtn({
							id: "sizeinfo",
							text: get_imagesizezoom_text(/*100*/),
							pos: "top-left",
							containers: containers
						});
						set_important_style(imagesize, "font-size", gallerycount_fontsize);
					}

					var get_imagestotal_text = function() {
						if (gallery_calcing) {
							return _("Loading...");
						}

						if (prev_images + next_images > settings.mouseover_ui_gallerymax) {
							return settings.mouseover_ui_gallerymax + "+";
						} else {
							return (prev_images + 1) + " / " + (prev_images + next_images + 1);
						}
					};

					var update_imagestotal = function() {
						if (images_total_input_active)
							return;

						if (prev_images + next_images > 0 || gallery_calcing) {
							set_important_style(images_total, "display", "inline-block");
							images_total.innerText = get_imagestotal_text();
						} else {
							set_important_style(images_total, "display", "none");
						}
					};

					var imagestotal_input_enable = function() {
						images_total_input_active = true;
						editing_text = true;
						images_total.innerText = "";

						set_important_style(images_total_input, "display", "initial");
						images_total_input.value = prev_images + 1;
						images_total.setAttribute("data-btn-noaction", true);
						images_total.appendChild(images_total_input);

						// https://stackoverflow.com/a/19498477
						setTimeout(function() {
							images_total_input.select();
							images_total_input.setSelectionRange(0, images_total_input.value.length);
						}, 100);
					};

					var imagestotal_input_disable = function() {
						editing_text = false;
						if (!images_total_input_active)
							return;

						set_important_style(images_total_input, "display", "none");
						images_total.removeChild(images_total_input);
						images_total.removeAttribute("data-btn-noaction");
						images_total_input_active = false;

						update_imagestotal();
					};

					var popup_width = (popupshown && outerdiv.clientWidth) || imgw;

					if (settings.mouseover_enable_gallery && settings.mouseover_ui_gallerycounter) {
						var images_total = addbtn({
							id: "gallerycounter",
							text: get_imagestotal_text(),
							action: imagestotal_input_enable,
							pos: "top-left",
							containers: containers
						});
						set_important_style(images_total, "font-size", gallerycount_fontsize);
						set_important_style(images_total, "display", "none");

						var images_total_input = document_createElement("input");
						var images_total_input_active = false;
						set_el_all_initial(images_total_input);
						set_important_style(images_total_input, "display", "none");
						set_important_style(images_total_input, "background-color", "white");
						set_important_style(images_total_input, "font-family", sans_serif_font);
						set_important_style(images_total_input, "font-size", galleryinput_fontsize);
						set_important_style(images_total_input, "padding", "1px");
						set_important_style(images_total_input, "padding-left", "2px");
						set_important_style(images_total_input, "width", "5em");
						our_addEventListener(images_total_input, "mouseout", imagestotal_input_disable);
						our_addEventListener(images_total_input, "keydown", function(e) {
							if (e.which === 13) { // enter
								var parsednum = images_total_input.value.replace(/\s+/g, "");
								if (/^[0-9]+$/.test(parsednum)) {
									parsednum = parseInt(parsednum);
									trigger_gallery(parsednum - (prev_images + 1));
								}

								imagestotal_input_disable();

								e.stopPropagation();
								e.preventDefault();
								return false;
							}
						}, true);
					}

					if (settings.mouseover_ui_optionsbtn) {
						// \u2699 = ⚙
						var optionsbtn = addbtn({
							id: "optionsbtn",
							text: "\u2699",
							title: _("Options"),
							action: get_options_page(),
							pos: "top-left",
							containers: containers
						});
					}

					if (settings.mouseover_ui_downloadbtn) {
						// \u2193 = ↓
						// \ud83e\udc6b = 🡫
						// \uD83E\uDC47 = 🡇
						var download_glyphs = ["\uD83E\uDC47", "\ud83e\udc6b", "\u2193"];
						var download_glyph = get_safe_glyph(css_fontcheck, download_glyphs);
						var downloadbtn = addbtn({
							id: "downloadbtn",
							text: download_glyph,
							title: _("Download (" + get_trigger_key_text(settings.mouseover_download_key) + ")"),
							action: {type: "download"},
							pos: "top-left",
							containers: containers
						});
					}

					if (settings.mouseover_ui_rotationbtns) {
						var get_rotate_title = function(leftright) {
							let btn_name = leftright === "left" ? "Rotate Left" : "Rotate Right";
							return _(btn_name) + " (" + get_trigger_key_text(settings["mouseover_rotate_" + leftright + "_key"]) + ")";
						};

						// \u21B6 = ↶
						var rotateleftbtn = addbtn({
							id: "rotleftbtn",
							text: "\u21B6",
							title: get_rotate_title("left"),
							action: {type: "rotate_left"},
							pos: "top-left",
							containers: containers
						});
						// \u21B7 = ↷
						var rotaterightbtn = addbtn({
							id: "rotrightbtn",
							text: "\u21B7",
							title: get_rotate_title("right"),
							action: {type: "rotate_right"},
							pos: "top-left",
							containers: containers
						});
					}

					if (settings.mouseover_ui_caption) {
						var caption = get_caption(newobj, popup_el);
						var caption_link_page = settings.mouseover_ui_caption_link_page && newobj.extra && newobj.extra.page;

						if (!caption && caption_link_page) {
							caption = "(original page)";
						}

						if (caption) {
							var btntext = caption;

							if (settings.mouseover_ui_wrap_caption) {
								// /10 is arbitrary, but seems to work well
								// TODO: make top-left dynamic
								var chars = parseInt(Math_max(10, Math_min(60, (popup_width - containers["top-left"].clientWidth) / 10)));

								btntext = {
									truncated: truncate_with_ellipsis(caption, chars),
									full: caption,
									link_underline: caption_link_page
								};
							}

							var caption_link = null;
							if (caption_link_page) {
								caption_link = newobj.extra.page;
							}

							var caption_btn = addbtn({
								id: "caption",
								text: btntext,
								title: caption,
								action: caption_link,
								pos: "top-left",
								containers: containers
							});
						}
					}

					var add_lrhover = function(isleft, btnel, action, title) {
						if (!settings.mouseover_enable_gallery || popup_width < 200)
							return;

						var img_height = get_img_disp_height();
						var bottom_heights = 0;
						var top_heights = 20;
						if (is_stream) {
							bottom_heights = 60;
						}

						if (img_height < 100) {
							top_heights = 0;
						}

						var lrheight = img_height - top_heights - bottom_heights;
						if (lrheight < 10)
							return;

						var lrhover = document_createElement("div");
						set_el_all_initial(lrhover);
						lrhover.title = title;
						if (isleft) {
							lrhover.style.left = "0em";
						} else {
							lrhover.style.right = "0em";
						}

						lrhover.style.top = top_heights + "px";
						lrhover.style.height = lrheight + "px";
						lrhover.style.position = "absolute";
						lrhover.style.width = "15%";
						lrhover.style.maxWidth = "200px";
						//lrhover.style.height = "100%";
						lrhover.style.zIndex = maxzindex - 2;
						lrhover.style.cursor = "pointer";

						opacity_hover(lrhover, btnel, true);
						our_addEventListener(lrhover, "click", function(e) {
							if (dragged) {
								return false;
							}

							estop(e);
							action(e);
							return false;
						}, true);
						outerdiv.appendChild(lrhover);
						ui_els.push(lrhover);
						return lrhover;
					};

					var add_leftright_gallery_button = function(leftright) {
						if (!settings.mouseover_enable_gallery || !settings.mouseover_ui_gallerybtns)
							return;

						var action = function() {
							return lraction(leftright);
						};

						var name = leftright ? "Next" : "Previous";

						// \u2190 = ←
						// \ud83e\udc50 = 🡐
						var left_glyphs = ["\ud83e\udc50", "\u2190"];
						// \u2192 = →
						// \ud83e\udc52 = 🡒
						var right_glyphs = ["\ud83e\udc52", "\u2192"];

						var lr_glyphs = leftright? right_glyphs : left_glyphs;
						var icon = get_safe_glyph(css_fontcheck, lr_glyphs);

						var keybinding = leftright ? settings.mouseover_gallery_next_key : settings.mouseover_gallery_prev_key;
						var keybinding_text = get_trigger_key_text(keybinding);

						var title = _(name) + " (" + _(keybinding_text) + ")";

						var id = "gallery";
						id += leftright ? "next" : "prev";
						id += "btn";

						var btn = addbtn({
							id: id,
							text: icon,
							title: title,
							action: action,
							containers: containers,
							pos: leftright ? "right" : "left"
						});
						/*btn.style.top = "calc(50% - 7px - " + emhalf + ")";
						if (!leftright) {
							btn.style.left = "-" + em1;
						} else {
							btn.style.left = "initial";
							btn.style.right = "-" + em1;
						}*/
						//outerdiv.appendChild(btn);
						//ui_els.push(btn);

						add_lrhover(!leftright, btn, action, title);

						if (settings.mouseover_enable_gallery && settings.mouseover_ui_gallerycounter) {
							if (use_cached_gallery) {
								if (!leftright) {
									prev_images = cached_previmages;
								} else {
									next_images = cached_nextimages;
								}

								update_imagestotal();
							} else {
								gallery_calcing = true;
								count_gallery(leftright, void 0, true, void 0, void 0, function(total) {
									gallery_calcing = false;

									if (!leftright) {
										prev_images = total;
										cached_previmages = prev_images;
									} else {
										next_images = total;
										cached_nextimages = next_images;
									}

									update_imagestotal();
								});

								setTimeout(update_imagestotal, 1);
							}
						}
					};

					var add_leftright_gallery_button_if_valid = function(leftright) {
						if (!settings.mouseover_enable_gallery)
							return;

						is_nextprev_valid(leftright, function(valid) {
							if (valid) {
								add_leftright_gallery_button(leftright);
							}
						});
					};

					add_leftright_gallery_button_if_valid(false);
					add_leftright_gallery_button_if_valid(true);
				}

				popup_createui_func = create_ui;

				fill_obj_filename(newobj, url, data.data.respdata);

				create_ui();

				var a = document_createElement("a");
				set_el_all_initial(a);

				if (add_link) {
					a.style.cursor = "pointer";

					//a.addEventListener("click", function(e) {
					a.onclick = function(e) {
						e.stopPropagation();
						e.stopImmediatePropagation();
						return true;
					};
				}

				a.style.setProperty("vertical-align", "bottom", "important");
				a.style.setProperty("display", "block", "important");

				var update_popup_clickthrough = function(clickthrough) {
					var value = "none";
					if (!clickthrough)
						value = "initial";

					set_important_style(a, "pointer-events", value);
					set_important_style(img, "pointer-events", value);
					set_important_style(div, "pointer-events", value);
					set_important_style(outerdiv, "pointer-events", value);
				};

				if (settings.mouseover_clickthrough)
					update_popup_clickthrough(true);

				popup_hold_func = function() {
					var enable_mask_styles = get_single_setting("mouseover_enable_mask_styles2");

					if (popup_hold) {
						if (settings.mouseover_hold_unclickthrough) {
							update_popup_clickthrough(false);
						}

						if (mask_el && (enable_mask_styles === "always" || enable_mask_styles === "hold")) {
							mask_el.style.opacity = old_mask_opacity;
						}
					} else {
						if (settings.mouseover_clickthrough) {
							update_popup_clickthrough(true);
						} else {
							update_popup_clickthrough(false);
						}

						if (mask_el && (enable_mask_styles === "hold" || enable_mask_styles === "never")) {
							mask_el.style.opacity = 0;
						}
					}
				};

				if (add_link) {
					a.href = url;

					// set this here instead of outside this block for gelbooru: https://github.com/qsniyg/maxurl/issues/430
					a.target = "_blank";
					if (settings.mouseover_download) {
						if (false) {
							a.href = img.src;

							if (newobj.filename.length > 0) {
								a.setAttribute("download", newobj.filename);
							} else {
								var attr = document.createAttribute("download");
								a.setAttributeNode(attr);
							}
						} else {
							a.href = "#"; // fixme: is this really required? this prevents it from right click->copy link location, etc.
							our_addEventListener(a, "click", function(e) {
								download_popup_media();

								e.preventDefault();
								e.stopPropagation();
								return false;
							}, true);
						}
					}
				} else {
					var click_close = false;

					if (!is_stream && settings.mouseover_click_image_close) {
						click_close = true;
					} else if (is_video && settings.mouseover_click_video_close) {
						click_close = true;
					}
					// TODO: what about audio?

					if (click_close) {
						our_addEventListener(a, "click", function(e) {
							if (dragged)
								return;

							resetpopups();

							e.preventDefault()
							e.stopPropagation();
							return false;
						});
					}
				}

				a.appendChild(img);
				div.appendChild(a);

				popup_hidecursor_timer = null;
				var orig_a_cursor = a.style.cursor;
				var orig_img_cursor = img.style.cursor;
				popup_hidecursor_func = function(hide) {
					popup_cursorjitterX = mouseX;
					popup_cursorjitterY = mouseY;
					if (settings.mouseover_hide_cursor && hide) {
						a.style.cursor = "none";
						img.style.cursor = "none";
					} else {
						if (popup_hidecursor_timer) {
							clearTimeout(popup_hidecursor_timer);
							popup_hidecursor_timer = null;
						}

						a.style.cursor = orig_a_cursor;
						img.style.cursor = orig_img_cursor;
					}
				};

				popup_cursorjitterX = Infinity;
				popup_cursorjitterY = Infinity;

				if (settings.mouseover_hide_cursor && settings.mouseover_hide_cursor_after <= 0) {
					popup_hidecursor_func(true);
				}

				div.onmouseover = div.onmousemove = function(e) {
					if ((Math_abs(mouseX - popup_cursorjitterX) < settings.mouseover_mouse_inactivity_jitter) &&
						(Math_abs(mouseY - popup_cursorjitterY) < settings.mouseover_mouse_inactivity_jitter)) {
						return;
					}

					if (settings.mouseover_hide_cursor_after > 0 || !settings.mouseover_hide_cursor) {
						popup_hidecursor_func(false);

						if (settings.mouseover_hide_cursor) {
							popup_hidecursor_timer = setTimeout(function() {
								popup_hidecursor_func(true);
							}, settings.mouseover_hide_cursor_after);
						}
					}
				};

				function startdrag(e) {
					dragstart = true;
					dragged = false;
					dragstartX = e.clientX;
					dragstartY = e.clientY;
					dragoffsetX = dragstartX - parseFloat(outerdiv.style.left);
					dragoffsetY = dragstartY - parseFloat(outerdiv.style.top);
				}

				// TODO: allow this to be live-reloaded
				if (get_single_setting("mouseover_pan_behavior") === "drag") {
					if (is_stream) {
						img.onseeking = function(e) {
							seekstart = true;
						};

						img.onseeked = function(e) {
							seekstart = false;
						};
					}

					div.ondragstart = a.ondragstart = img.ondragstart = function(e) {
						if (seekstart)
							return;

						//dragstart = true;
						//dragged = false;
						startdrag(e);
						//e.stopPropagation();
						estop(e);
						return false;
					};

					//div.ondrop = estop;

					div.onmousedown = div.onpointerdown = a.onmousedown = a.onpointerdown = function(e) {
						//console_log("(div,a).mousedown", e);
						if (btndown || e.button !== 0 || seekstart)
							return;

						//dragstart = true;
						//dragged = false;
						startdrag(e);

						e.preventDefault();
						estop(e);
						return false;
					};

					img.onmousedown = img.onpointerdown = function(e) {
						//console_log("img.onmousedown", e);
						if (btndown || e.button !== 0 || seekstart)
							return;

						//dragstart = true;
						//dragged = false;
						startdrag(e);

						estop(e);
						return true;
					};

					a.onclick = function(e) {
						//console_log("a.onclick", e);
						dragstart = false;

						if (dragged) {
							estop(e);
							dragged = false;
							return false;
						}

						e.stopPropagation();
						e.stopImmediatePropagation();
						return true;
					};

					div.onmouseup = div.onpointerup = div.onclick = a.onmouseup = a.onpointerup = /*a.onclick =*/ function(e) {
						//console_log("(div,a).mouseup", e);
						dragstart = false;

						if (dragged) {
							//estop(e);
							return false;
						}

						e.stopPropagation();
						e.stopImmediatePropagation();
						return true;
					};

					// Enabling this makes buttons not work after clicking the link
					//div.addEventListener("click", div.onclick, true);
					//a.addEventListener("click", a.onclick, true);

					img.onmouseup = img.onpointerup = img.onclick = function(e) {
						//console_log("img.mouseup", e);
						dragstart = false;
						//estop(e);
						return true;
					};

					if (is_video) {
						img.onclick = function(e) {
							if (img.controls) return;

							if (!dragged) {
								if (!img.paused) {
									img.pause();
								} else {
									play_video(img);
								}
							}

							//console_log("img.mouseup", e);
							dragstart = false;
							//estop(e);
							return true;
						};
					}
				}

				var currentmode = initial_zoom_behavior;
				if (currentmode === "fill")
					currentmode = "fit";

				popup_zoom_func = function(zoom_mode, zoomdir, x, y, zoom_out_to_close) {
					var changed = false;

					var popup_left = parseFloat(outerdiv.style.left);
					var popup_top = parseFloat(outerdiv.style.top);

					var popup_width = outerdiv.clientWidth;
					var popup_height = outerdiv.clientHeight;

					update_vwh();

					if (x === void 0)
						x = "center";
					if (y === void 0)
						y = "center";

					// used by pagemiddle, determines the final desired global position
					var x_moveto = null;
					var y_moveto = null;

					if (zoomdir > 0) {
						var zoomout_mode = get_single_setting("scroll_zoomout_pagemiddle");
						if (zoomout_mode === "always") {
							x = "pagemiddle";
							y = "pagemiddle";
						} else if (zoomout_mode === "viewport") {
							if (popup_width < vw)
								x = "pagemiddle";
							if (popup_height < vh)
								y = "pagemiddle";
						}
					}

					// TODO: if mouse is within the popup, use the mouse's coordinates instead
					//   This will have to check the zoom_origin setting.
					if (x === "center" || x === "pagemiddle") {
						if (x === "pagemiddle")
							x_moveto = vw / 2;

						var visible_left = Math_max(popup_left, 0);
						var visible_right = Math_min(visible_left + popup_width, vw);
						// get the middle of the visible portion of the popup
						x = visible_left + (visible_right - visible_left) / 2;
					} else {
						// ensure it's clamped, e.g. when scrolling on the document instead of the popup
						if (x < popup_left)
							x = popup_left;
						else if (x > popup_left + popup_width)
							x = popup_left + popup_width;
					}

					if (y === "center" || y === "pagemiddle") {
						if (y === "pagemiddle")
							y_moveto = vh / 2;

						var visible_top = Math_max(popup_top, 0);
						var visible_bottom = Math_min(visible_top + popup_height, vh);
						y = visible_top + (visible_bottom - visible_top) / 2;
					} else {
						if (y < popup_top)
							y = popup_top;
						else if (y > popup_top + popup_height)
							y = popup_top + popup_height;
					}

					var offsetX = x - popup_left;
					var offsetY = y - popup_top;

					var percentX = offsetX / popup_width;
					var percentY = offsetY / popup_height;

					if (zoom_mode === "fitfull") {
						if (zoom_out_to_close && currentmode === "fit" && zoomdir > 0) {
							resetpopups();
							return false;
						}

						if (zoomdir > 0 && currentmode !== "fit") {
							imgh = img_naturalHeight;
							imgw = img_naturalWidth;
							calc_imghw_for_fit();

							var oldwidth = parseFloat(img.style.width);
							var oldheight = parseFloat(img.style.height);

							set_popup_width(imgw, vw);
							set_popup_height(imgh, vh);

							if (zoom_out_to_close && parseFloat(img.style.width) === oldwidth && parseFloat(img.style.height) === oldheight) {
								resetpopups();
								return false;
							}

							currentmode = "fit";
							changed = true;
						} else if (zoomdir < 0 && currentmode !== "full") {
							set_popup_width(img_naturalWidth, "initial");
							set_popup_height(img_naturalHeight, "initial");

							imgw = img_naturalWidth;
							imgh = img_naturalHeight;

							currentmode = "full";
							changed = true;
						}
					} else if (zoom_mode === "incremental") {
						var imgwidth = img.clientWidth;
						var imgheight = img.clientHeight;

						var mult = 1;
						if (imgwidth < img_naturalWidth) {
							mult = img_naturalWidth / imgwidth;
						} else {
							mult = imgwidth / img_naturalWidth;
						}

						var increment = settings.scroll_incremental_mult - 1;

						mult = Math_round(mult / increment);
						mult *= increment;

						if (imgwidth < img_naturalWidth) {
							if (mult !== 0)
								mult = 1 / mult;
						}

						if (zoomdir > 0) {
							mult /= 1 + increment;
						} else {
							mult *= 1 + increment;
						}

						imgwidth = img_naturalWidth * mult;
						imgheight = img_naturalHeight * mult;

						var too_small = zoomdir > 0 && (imgwidth < 64 || imgheight < 64);
						var too_big = zoomdir < 0 && (imgwidth > img_naturalWidth * 512 || imgheight > img_naturalHeight * 512);

						if (too_small || too_big) {
							if (zoom_out_to_close && too_small)
								resetpopups();
							return false;
						}

						imgw = imgwidth;
						imgh = imgheight;

						set_popup_width(imgwidth);
						set_popup_height(imgheight);
						changed = true;
					}

					if (!changed)
						return false;

					var imgwidth = outerdiv.clientWidth;
					var imgheight = outerdiv.clientHeight;

					var current_zoom = ((imgwidth / img_naturalWidth) + (imgheight / img_naturalHeight)) / 2;
					if (current_zoom) {
						popup_last_zoom = current_zoom;
					}

					var newx, newy;

					var zoom_lerp = function(wantedpos, origpos, viewport) {
						var change = wantedpos - origpos;
						var maxchange = Math_max(100, viewport / 10); // arbitrary numbers
						if (change < 0) {
							change = -Math_min(maxchange, -change);
						} else {
							change = Math_min(maxchange, change);
						}
						return origpos + change;
					};

					if (true || (imgwidth <= vw && imgheight <= vh) || zoom_mode === "incremental") {
						// centers wanted region to pointer
						newx = (x - percentX * imgwidth);
						if (x_moveto !== null) {
							newx = zoom_lerp(x_moveto - imgwidth / 2, newx, vw);
						}

						newy = (y - percentY * imgheight);
						if (y_moveto !== null) {
							newy = zoom_lerp(y_moveto - imgheight / 2, newy, vh);
						}
					} else if (imgwidth > vw || imgheight > vh) {
						// centers wanted region to center of screen
						newx = (vw / 2) - percentX * imgwidth;
						var endx = newx + imgwidth;
						if (newx > border_thresh && endx > (vw - border_thresh))
							newx = Math_max(border_thresh, (vw + border_thresh) - imgwidth);

						if (newx < border_thresh && endx < (vw - border_thresh))
							newx = Math_min(border_thresh, (vw + border_thresh) - imgwidth);

						newy = (vh / 2) - percentY * imgheight;
						var endy = newy + imgheight;
						if (newy > border_thresh && endy > (vh - border_thresh))
							newy = Math_max(border_thresh, (vh + border_thresh) - imgheight);

						if (newy < border_thresh && endy < (vh - border_thresh))
							newy = Math_min(border_thresh, (vh + border_thresh) - imgheight);
					}

					// fitfull only because incremental is under user control
					if (zoom_mode === "fitfull" && imgwidth <= vw && imgheight <= vh) {
						newx = Math_max(newx, border_thresh);
						if (newx + imgwidth > (vw - border_thresh)) {
							newx = (vw + border_thresh) - imgwidth;
						}

						newy = Math_max(newy, border_thresh);
						if (newy + imgheight > (vh - border_thresh)) {
							newy = (vh + border_thresh) - imgheight;
						}
					}

					//var lefttop = get_lefttopouter();
					outerdiv.style.left = (newx/* - lefttop[0]*/) + "px";
					outerdiv.style.top = (newy/* - lefttop[1]*/) + "px";

					create_ui(true);

					// The mouse could accidentally land outside the image in theory
					mouse_in_image_yet = false;

					return false;
				};

				outerdiv.onwheel = popup_wheel_cb = function(e, is_document) {
					var handledx = false;
					var handledy = false;

					var handle_seek = function(xy) {
						var isright = false;

						if (xy) {
							if (e.deltaX < 0)
								isright = false;
							else if (e.deltaX > 0)
								isright = true;
							else return;
						} else {
							if (e.deltaY < 0)
								isright = false;
							else if (e.deltaY > 0)
								isright = true;
							else return;

							if (settings.mouseover_scrolly_video_invert)
								isright = !isright;
						}

						seek_popup_video(!isright);
						estop_pd(e);
						return true;
					};

					var actionx = true;
					var actiony = true;

					if (is_stream) {
						var video_scrollx = get_single_setting("mouseover_scrollx_video_behavior");
						var video_scrolly = get_single_setting("mouseover_scrolly_video_behavior");

						if (!handledx && video_scrollx !== "default") {
							if (video_scrollx === "seek") {
								if (handle_seek(true)) {
									handledx = true;
								}
							} else if (video_scrollx === "nothing") {
								actionx = false;
							}
						}

						if (!handledy && video_scrolly !== "default") {
							if (video_scrolly === "seek") {
								if (handle_seek(false)) {
									handledy = true;
								}
							} else if (video_scrollx === "nothing") {
								actiony = false;
							}
						}
					}

					var scrollx_behavior = get_single_setting("mouseover_scrollx_behavior");
					var scrolly_behavior = get_single_setting("mouseover_scrolly_behavior");

					if (popup_hold) {
						var hold_scrollx_behavior = get_single_setting("mouseover_scrollx_hold_behavior");
						var hold_scrolly_behavior = get_single_setting("mouseover_scrolly_hold_behavior");

						if (hold_scrollx_behavior !== "default")
							scrollx_behavior = hold_scrollx_behavior;

						if (hold_scrolly_behavior !== "default")
							scrolly_behavior = hold_scrolly_behavior;
					}

					var handle_gallery = function(xy) {
						if (!settings.mouseover_enable_gallery)
							return;

						var isright = false;

						if (xy) {
							if (e.deltaX < 0)
								isright = false;
							else if (e.deltaX > 0)
								isright = true;
							else return;
						} else {
							if (e.deltaY < 0)
								isright = false;
							else if (e.deltaY > 0)
								isright = true;
							else return;
						}

						lraction(isright, true);
						estop_pd(e);
						return true;
					};

					if (actionx && !handledx) {
						if (scrollx_behavior === "pan") {
							outerdiv.style.left = (parseInt(outerdiv.style.left) + e.deltaX) + "px";
							handledx = true;
						} else if (scrollx_behavior === "gallery") {
							if (handle_gallery(true)) {
								return;
							}

							handledx = true;
						}
					}

					if (actiony && !handledy) {
						if (scrolly_behavior === "pan") {
							outerdiv.style.top = (parseInt(outerdiv.style.top) + e.deltaY) + "px";
							handledy = true;
						} else if (scrolly_behavior === "gallery") {
							if (handle_gallery(false)) {
								return;
							}

							handledy = true;
						}
					}

					if (handledy) {
						estop_pd(e);
						return false;
					}

					if (!actiony || scrolly_behavior !== "zoom" || e.deltaY === 0) {
						return;
					}

					estop_pd(e);

					var cursor_x = e.clientX;
					var cursor_y = e.clientY;
					if (get_single_setting("scroll_zoom_origin") === "center") {
						cursor_x = "center";
						cursor_y = "center";
					}

					var zoom_mode = get_single_setting("scroll_zoom_behavior");
					if (popup_zoom_func(zoom_mode, e.deltaY, cursor_x, cursor_y, settings.zoom_out_to_close) === false)
						return false;
				};

				if (mask_el) {
					document.documentElement.appendChild(mask_el);
				}

				document.documentElement.appendChild(outerdiv);

				removepopups();

				check_image_ref(img);

				// even if autoplay is enabled, if the element is cached, it won't play automatically
				if (is_stream) {
					if (settings.mouseover_video_autoplay) {
						play_video(img);
					} else {
						img.pause();
					}
				}

				popups.push(outerdiv);
				popupshown = true;

				if (data.data.respdata && data.data.respdata.responseHeaders) {
					var parsed_headers = headers_list_to_dict(parse_headers(data.data.respdata.responseHeaders));
					if ("content-length" in parsed_headers) {
						popup_contentlength = parseInt(parsed_headers["content-length"]) || 0;
					}
				}

				//can_close_popup = [false, false];
				// don't set [0] to false, in case "Keep popup open until" == Any/All and keys are released before popup opens
				can_close_popup[1] = false;

				// don't unhold if in gallery
				if (!popup_el_automatic)
					popup_hold = false;

				mouse_in_image_yet = false;
				delay_handle_triggering = false;

				// causes issues with "Don't close until mouse leaves" if the mouse doesn't move
				if (false && popup_trigger_reason !== "mouse") {
					can_close_popup[1] = true;
				}

				setTimeout(function() {
					dont_wait_anymore();
				}, 1);

				popups_active = true;
				//console_log(div);

				add_resetpopup_timeout();
			}

			cb(data.data.img, data.data.newurl/*, obj*/);
		}

		var getunit_el = null;
		var getunit_cache = new IMUCache();
		// getUnit is really slow, e.g. on forbiddenplanet.com (max-width: 39em)
		function getUnit(unit) {
			if (unit.match(/^ *([0-9]+)px *$/)) {
				return unit.replace(/^ *([0-9]+)px *$/, "$1");
			}

			if (getunit_cache.has(unit)) {
				return getunit_cache.get(unit);
			}

			// Based on https://github.com/tysonmatanich/getEmPixels/blob/master/getEmPixels.js
			// /*! getEmPixels  | Author: Tyson Matanich (http://matanich.com), 2013 | License: MIT */
			var important = "!important;";
			var style = "position:absolute!important;visibility:hidden!important;width:" + unit + "!important;font-size:" + unit + "!important;padding:0!important";

			var extraBody;

			var unitel = document.body;
			if (!unitel) {
				// Emulate the documentElement to get rem value (documentElement does not work in IE6-7)
				unitel = extraBody = document_createElement("body");
				extraBody.style.cssText = "font-size:" + unit + "!important;";
				document.documentElement.insertBefore(extraBody, document.body);
			}

			// Create and style a test element
			if (!getunit_el) {
				getunit_el = document_createElement("i");
				set_el_all_initial(getunit_el);
				set_important_style(getunit_el, "position", "absolute");
				set_important_style(getunit_el, "visibility", "hidden");
				set_important_style(getunit_el, "padding", "0");
			}

			set_important_style(getunit_el, "width", unit);
			set_important_style(getunit_el, "font-size", unit);
			//getunit_el.style.cssText = style;
			unitel.appendChild(getunit_el);

			// Get the client width of the test element
			var value = getunit_el.clientWidth;
			getunit_cache.set(unit, value, 5*60);

			if (extraBody) {
				// Remove the extra body element
				document.documentElement.removeChild(extraBody);
			}
			else {
				// Remove the test element
				unitel.removeChild(getunit_el);
			}

			// Return the em value in pixels
			return value;
		}

		function valid_source(source) {
			var thresh = 20;

			if (source.tagName !== "PICTURE" &&
				source.tagName !== "VIDEO" &&
				source.tagName !== "IMG" &&
				source.tagName !== "SOURCE") {
				var style = get_computed_style(source);
				if (style.getPropertyValue("background-image")) {
					var bgimg = style.getPropertyValue("background-image");
					if (!bgimg.match(/^(.*?\)\s*,)?\s*url[(]/)) {
						return false;
					}
				} else {
					return false;
				}
			}

			return !(source.width && source.width < thresh ||
					 source.height && source.height < thresh);
		}

		var recalculate_rect = function(rect) {
			rect.left = rect.x;
			rect.top = rect.y;
			rect.right = rect.left + rect.width;
			rect.bottom = rect.top + rect.height;

			return rect;
		};

		var copy_rect = function(rect) {
			// simplified copy, need to use recalculate_rect after
			return {
				x: rect.x,
				y: rect.y,
				width: rect.width,
				height: rect.height
			};
		};

		var parse_zoom = function(zoom) {
			if (typeof zoom === "number")
				return zoom;

			var match = zoom.match(/^([-0-9.]+)%$/);
			if (match)
				return parseFloat(match[1]) / 100.;

			match = zoom.match(/^([-0-9.]+)$/);
			if (match) {
				return parseFloat(match[1]);
			}

			return null;
		};

		type IMU_BCR = {
			orig_rect?: DOMRect,
			rect?: DOMRect,
			zoom?: number
		};
		function get_bounding_client_rect_inner(el:HTMLElement, mapcache?:Map<Element, any>, need_rect?:boolean):IMU_BCR {
			// test: https://4seasonstaeyeon.tumblr.com/post/190710743124 (bottom images)
			if (!el)
				return null;

			if (mapcache && mapcache.has(el)) {
				var value = mapcache.get(el);

				if (need_rect) {
					if (value.orig_rect)
						return value;
				} else {
					return value;
				}
			}

			var parent:IMU_BCR = {};
			var parentel = el.parentElement;
			if (parentel) {
				parent = get_bounding_client_rect_inner(parentel, mapcache, false);
			}

			var orig_rect = null;
			if (need_rect)
				orig_rect = el.getBoundingClientRect();

			var rect = null;
			var zoom = 1;

			//var computed_style = get_computed_style(el);
			// computed_style is slow, and also might not be what we're looking for, as it might contain the parent's zoom
			// this is still very slow though (50ms on facebook)
			// https://thisistian.github.io/publication/real-time-subsurface-with-adaptive-sampling/
			// math tags don't have style
			// TS removes the "zoom" property from CSSStyleDeclaration
			if ("style" in el && (el.style as any).zoom) {
				zoom = parse_zoom((el.style as any).zoom);
				if (zoom && zoom !== 1) {
					if (!orig_rect)
						orig_rect = el.getBoundingClientRect();

					rect = copy_rect(orig_rect);

					rect.width *= zoom;
					rect.height *= zoom;
				}
			}

			if (parent.zoom && parent.zoom !== 1) {
				if (!orig_rect)
					orig_rect = el.getBoundingClientRect();

				if (!rect)
					rect = copy_rect(orig_rect);

				rect.x *= parent.zoom;
				rect.y *= parent.zoom;
				rect.width *= parent.zoom;
				rect.height *= parent.zoom;

				zoom *= parent.zoom;
				//console.log(el, zoom, deepcopy(rect));
			}

			// this is surprisingly slow, so rect is optimized out if possible
			if (false && parent.rect && parent.orig_rect) {
				if (!orig_rect)
					orig_rect = el.getBoundingClientRect();

				if (!rect)
					rect = copy_rect(orig_rect);

				rect.x += parent.rect.x - parent.orig_rect.x;
				rect.y += parent.rect.y - parent.orig_rect.y;
			}

			if (rect)
				recalculate_rect(rect);

			var result:IMU_BCR = {
				zoom: zoom
			};

			if (orig_rect)
				result.orig_rect = orig_rect

			if (rect)
				result.rect = rect;

			if (mapcache) {
				mapcache.set(el, result);
			}

			return result;
		}

		function get_bounding_client_rect(el, mapcache?) {
			let need_qsa_patch = false;
			// ublock origin patches getBoundingClientRect under youtube, calling document.querySelectorAll every time, which is very slow
			if (/youtube\.com$/.test(window.location.host))
				need_qsa_patch = true;

			let old_selectorall = null;

			if (need_qsa_patch) {
				old_selectorall = document.querySelectorAll;
				try {
					(document as any).querySelectorAll = () => {return [];}
				} catch (e) {}
			}

			var obj = get_bounding_client_rect_inner(el, mapcache, true);

			if (need_qsa_patch) {
				try {
					(document as any).querySelectorAll = old_selectorall;
				} catch (e) {}
			}

			return obj.rect || obj.orig_rect;
		}

		function get_popup_client_rect() {
			if (!popups || !popups[0])
				return null;

			var current_date = Date.now();
			if (!popup_client_rect_cache || (current_date - last_popup_client_rect_cache) > 50) {
				popup_client_rect_cache = get_bounding_client_rect(popups[0]);
				last_popup_client_rect_cache = current_date;
			}

			return popup_client_rect_cache;
		};

		function get_popup_media_client_rect() {
			if (!popups || !popups[0])
				return null;

			var img = get_popup_media_el();
			if (!img)
				return null;

			var current_date = Date.now();
			if (!popup_media_client_rect_cache || (current_date - last_popup_media_client_rect_cache) > 30) {
				popup_media_client_rect_cache = img.getBoundingClientRect();
				last_popup_media_client_rect_cache = current_date;
			}

			return popup_media_client_rect_cache;
		};

		function is_popup_el(el) {
			var current = el;
			do {
				if (array_indexof(popups, current) >= 0) {
					//console_error("Trying to find popup");
					return true;
				}
			} while ((current = current.parentElement))

			return false;
		}

		type FindSourceOptions = {
			links?:boolean,
			point?:[number, number]
		};
		function find_source(els:Array<HTMLElement>, options?:FindSourceOptions) {
			if (!options) options = {};
			if (!("links" in options)) options.links = get_single_setting("mouseover_links");

			//console_log(els);
			var ok_els = [];
			var result = _find_source(els, ok_els, options);

			nir_debug("find_source", "find_source: result =", result, "ok_els =", ok_els);

			if (!result)
				return result;

			var ret_bad = function() {
				if (ok_els.length > 0)
					return ok_els[0];
				return null;
			};

			if (result.el) {
				if (is_popup_el(result.el)) {
					nir_debug("find_source", "find_source: result.el is popup el", result.el);
					return ret_bad();
				}
			}

			if (!result.is_ok_el && !result.src && (true||!is_valid_src(result.src, is_video_el(result.el)))) {
				nir_debug("find_source", "find_source: invalid src", result);
				return ret_bad();
			}

			var thresh = parse_int(get_tprofile_setting("mouseover_minimum_size"));
			// if it can be imu'd, ignore the treshold because the image could be any size
			if (isNaN(thresh) || result.imu)
				thresh = 0;

			var maxThresh = parse_int(get_tprofile_setting("popup_maximum_source_size"));
			if (isNaN(maxThresh))
				maxThresh = 0;

			if (!isNaN(result.width) && !isNaN(result.height) && result.width > 0 && result.height > 0) {
				if (result.width < thresh || result.height < thresh) {
					nir_debug("find_source", "find_source: result size is too small");
					return ret_bad();
				}

				if (maxThresh) {
					if (result.width > maxThresh || result.height > maxThresh) {
						console_log("Source media is too big to popup (user-configured maximum is", maxThresh, "px)");
						return null;
					}
				}
			}

			return result;
		}

		function _find_source(els, ok_els, options) {
			// resetpopups() is already called in trigger_popup()
			/*if (popups_active)
				return;*/

			nir_debug("find_source", "_find_source (els)", els);

			var sources = {};
			//var picture_sources = {};
			var links = {};
			var layers = [];

			var ok_els_set = new_set();

			var id = 0;

			var thresh = parse_int(get_tprofile_setting("mouseover_minimum_size"));
			if (isNaN(thresh))
				thresh = 0;

			var helpers = do_get_helpers({});

			var source;

			function check_visible(el) {
				var visible_valid = true;

				do {
					if (!el)
						break;

					var style = get_computed_style(el);
					if (!style)
						break;

					//nir_debug("find_source", "check_visible:", el, style.opacity.toString(), style.visibility);

					if (style.opacity.toString().match(/^0(?:\.0*)?$/) ||
						(visible_valid && style.visibility === "hidden")) {
						return false;
					}

					// https://www.msn.com/en-us/music/news/the-weeknd-calls-grammys-corrupt-slams-lack-of-transparency-after-nominations-shutout/ar-BB1bkAHH ("more for you" section)
					// a higher element has visibility: hidden, but a lower one has visibility: visible
					if (visible_valid && style.visibility === "visible") {
						visible_valid = false;
					}
				} while (el = el.parentElement);

				return true;
			}

			function getsource() {
				var thesource = null;
				var first = false;
				for (var source in sources) {
					if (first)
						return;
					first = true;
					thesource = sources[source];
				}
				return thesource;
			}

			function getfirstsource(sources) {
				var smallestid = MAX_SAFE_INTEGER;
				var thesource = null;
				for (var source_url in sources) {
					var source = sources[source_url];
					if (source.id < smallestid) {
						smallestid = source.id;
						thesource = sources[source_url];
					}
				}

				return thesource;
			}

			function norm(src) {
				return urljoin(window.location.href, src, true);
			}

			function imu_check(src, el) {
				var result = bigimage_recursive(src, {
					fill_object: true,
					use_cache: "read",
					do_request: null,
					document: document,
					window: get_window(),
					host_url: window.location.href,
					element: el,
					include_pastobjs: true,
					iterations: 2,
					cb: null
				});

				var newurl = src;

				for (var i = 0; i < result.length; i++) {
					if (result[i].url !== src) {
						if (newurl === src)
							newurl = result[i].url;

						continue;
					}

					if (result[i].bad)
						return false;

					// if result.length > 1, then it can be imu'd
					if (result.length > 1) {
						return newurl || true;
					} else {
						return void 0;
					}
				}

				return newurl || true;
			}

			function addImage(src, el, options) {
				nir_debug("find_source", "_find_source (addImage)", src, el, check_visible(el), options);

				if (!is_valid_resource_url(src))
					return false;

				if (src && settings.mouseover_apply_blacklist && !bigimage_filter(src)) {
					nir_debug("find_source", "blacklisted");
					return false;
				}

				if (!(src in sources)) {
					sources[src] = {
						count: 0,
						src: src,
						el: el,
						id: id++,
					};
				}

				// blank images
				// https://www.harpersbazaar.com/celebrity/red-carpet-dresses/g7565/selena-gomez-style-transformation/?slide=2
				var el_style = null;
				if (el) {
					el_style = window.getComputedStyle(el) || el.style;
				}

				if (!options) {
					options = {};
				}

				if (options.isbg && get_tprofile_setting("mouseover_exclude_backgroundimages")) {
					return false;
				}

				var imucheck = imu_check(src, el);
				if (imucheck === false) {
					nir_debug("find_source", "Bad image", el);
					return false;
				}

				if (!("imu" in sources[src])) {
					sources[src].imu = !!imucheck;
				}

				if (imucheck === true) {
					// do this after imu_check, for lazy loaded images that have 1x1 images
					if (src && (src.match(/^data:/) && !(/^data:image\/svg\+xml;/.test(src)) && src.length <= 500)) {
						nir_debug("find_source", "Tiny data: image", el, src);
						return false;
					}
				}

				// https://www.smugmug.com/
				// https://www.vogue.com/article/lady-gaga-met-gala-2019-entrance-behind-the-scenes-video
				// https://www.pinterest.com/
				if (!check_visible(el)) {
					nir_debug("find_source", "Invisible: image", el);
					return false;
				}

				if (settings.mouseover_only_links) {
					if (!el)
						return false;

					var has_link = false;
					var current = el;
					do {
						if (get_tagname(current) === "A") {
							has_link = true;
							break;
						}
					} while (current = current.parentElement);

					if (!has_link)
						return false;
				}

				if ("layer" in options) {
					if (!(options.layer in layers)) {
						layers[options.layer] = [];
					}

					layers[options.layer].push(src);
				}

				sources[src].count++;

				return true;
			}

			function addTagElement(el, layer:number) {
				//nir_debug("find_source", "addTagElement", el);

				if (helpers && helpers.element_replace) {
					let newel = helpers.element_replace(el);
					if (newel)
						el = newel;
				}

				if (helpers && helpers.element_ok) {
					if (!set_has(ok_els_set, el)) {
						var element_ok_result = helpers.element_ok(el);
						var ok_el_obj = {
							count: 1,
							src: null,
							el: el,
							id: id++,
							is_ok_el: true
						};

						if (element_ok_result === true) {
							ok_els.push(ok_el_obj);
							set_add(ok_els_set, el);
						} else if (typeof element_ok_result === "object") {
							if (is_element(element_ok_result))
								element_ok_result = {el: element_ok_result};

							ok_el_obj.el = element_ok_result.el;
							ok_els.push(ok_el_obj);
							set_add(ok_els_set, el);

							el = element_ok_result.el;

							if (element_ok_result.search) {
								let point = options.point;
								if (!point) {
									let rect = get_bounding_client_rect(el);
									point = [
										rect.left + (rect.width / 2),
										rect.top + (rect.height / 2)
									];
								}

								let found_els = find_els_at_point(point, {
									els_mode: "full",
									els: [el]
								});

								for (let fel of found_els) {
									if (fel === el)
										continue;

									addElement(fel);
								}
							}
						}
					}
				}

				var el_tagname = get_tagname(el);
				if (el_tagname === "PICTURE" || el_tagname === "VIDEO") {
					for (var i = 0; i < el.children.length; i++) {
						addElement(el.children[i], layer);
					}
				}

				if (el_tagname === "SOURCE" || el_tagname === "IMG" || el_tagname === "IMAGE" || el_tagname === "VIDEO" ||
					(settings.mouseover_allow_canvas_el && el_tagname === "CANVAS") ||
					(settings.mouseover_allow_svg_el && el_tagname === "SVG")) {

					if (settings.mouseover_exclude_imagemaps && el_tagname === "IMG" && el.hasAttribute("usemap")) {
						var mapel = document.querySelector("map[name=\"" + el.getAttribute("usemap").replace(/^#/, "") + "\"]");
						if (mapel) {
							nir_debug("find_source", "_find_source skipping", el, "due to image map", mapel);
							return;
						}
					}

					var el_src = get_img_src(el);

					if (el_src) {
						var src = norm(el_src);

						addImage(src, el, { layer: layer });

						if (!el.srcset && src in sources) {
							var dimensions = get_el_dimensions(el);
							sources[src].width = dimensions[0];
							sources[src].height = dimensions[1];
						}
					}

					if (!el.srcset)
						return;

					var ssources = [];
					var srcset = el.srcset;

					// https://www.erinyamagata.com/art-direction/kiernan-shipka
					// https://format-com-cld-res.cloudinary.com/image/private/s--hNRUHHWH--/c_crop,h_1596,w_1249,x_0,y_0/c_fill,g_center,w_2500/fl_keep_iptc.progressive,q_95/v1/986aaf7dd74bd5041ddfc495c430bf0d/KShipkaR29MW_FULL_3468.jpg?2500 2500w 3194h, https://format-com-cld-res.cloudinary.com/image/private/s--VSup0NR3--/c_crop,h_1596,w_1249,x_0,y_0/c_fill,g_center,w_900/fl_keep_iptc.progressive,q_95/v1/986aaf7dd74bd5041ddfc495c430bf0d/KShipkaR29MW_FULL_3468.jpg?900 900w 1150h
					// newlines: https://www.rt.com/russia/447357-miss-moscow-2018-photos/
					//
					// https://cdni.rt.com/files/2018.12/xxs/5c221e1ffc7e9397018b4600.jpg 280w,
					// https://cdni.rt.com/files/2018.12/xs/5c221e1ffc7e9397018b4601.jpg 320w,
					// https://cdni.rt.com/files/2018.12/thumbnail/5c221e1ffc7e9397018b45ff.jpg 460w,
					// https://cdni.rt.com/files/2018.12/m/5c221e1ffc7e9397018b4602.jpg 540w,
					// https://cdni.rt.com/files/2018.12/l/5c221e1ffc7e9397018b4603.jpg 768w,
					// https://cdni.rt.com/files/2018.12/article/5c221e1ffc7e9397018b45fe.jpg 980w,
					// https://cdni.rt.com/files/2018.12/xxl/5c221e20fc7e9397018b4604.jpg 1240w

					while (srcset.length > 0) {
						var old_srcset = srcset;
						srcset = srcset.replace(/^\s+/, "");
						// reference: https://html.spec.whatwg.org/multipage/images.html#srcset-attribute
						// https://mindbodygreen-res.cloudinary.com/image/upload/c_fill,g_auto,w_70,h_70,q_auto,f_auto,fl_lossy/usr/RhDUPFE.jpg, https://mindbodygreen-res.cloudinary.com/image/upload/c_fill,g_auto,w_70,h_70,q_auto,f_auto,fl_lossy/dpr_2.0/usr/RhDUPFE.jpg 2x
						var match = srcset.match(/^(\S+)(?:,\s+.*)?$/);
						if (!match)
							match = srcset.match(/^(\S+(?:\s+[^,]+)?)(?:,[\s\S]*)?\s*$/);
						if (match) {
							ssources.push(match[1].replace(/\s*$/, ""));
							srcset = srcset.substr(match[1].length);
						}

						srcset = srcset.replace(/^\s*,/, "");
						if (srcset === old_srcset)
							break;
					}
					//var ssources = el.srcset.split(/ +[^ ,/],/);

					var sizes = [];
					if (el.sizes) {
						sizes = el.sizes.split(",");
					}

					// https://www.gamestar.de/artikel/red-dead-redemption-2-pc-vorabversion-mit-limit-bei-120-fps-directx-12-und-vulkan,3350718.html
					// sidebar articles: //8images.cgames.de/images/gamestar/256/red-dead-redemption-2_6062507.jpg, //8images.cgames.de/images/gamestar/210/red-dead-redemption-2_6062507.jpg 2x
					for (var i = 0; i < ssources.length; i++) {
						var src = norm(ssources[i].replace(/^(\S+)(?:\s+[\s\S]+)?\s*$/, "$1"));
						var desc = ssources[i].slice(src.length).replace(/^\s*([\s\S]*?)\s*$/, "$1");

						if (!addImage(src, el, {layer:layer}))
							continue;

						//picture_sources[src] = sources[src];

						sources[src].picture = el.parentElement;

						if (desc) {
							sources[src].desc = desc;

							// https://format-com-cld-res.cloudinary.com/image/pr…dc82/004_003_03-000083520001.jpg?2500 2500w 1831h
							while (desc.length > 0) {
								desc = desc.replace(/^\s+/, "");
								var whxmatch = desc.match(/^([0-9.]+)([whx])(?:\s+[0-9.]+[\s\S]*)?\s*$/);
								if (whxmatch) {
									var number = parseFloat(whxmatch[1]);

									if (number > 0) {
										// if width/height/desc_x > number, then number is probably more accurate (multiple els, see rt link above)
										if (whxmatch[2] === "w" && (!sources[src].width || sources[src].width > number))
											sources[src].width = number;
										else if (whxmatch[2] === "h" && (!sources[src].height || sources[src].height > number))
											sources[src].height = number;
										else if (whxmatch[2] === "x" && (!sources[src].desc_x || sources[src].desc_x > number))
											sources[src].desc_x = number;
									}

									desc = desc.substr(whxmatch[1].length + whxmatch[2].length);
								} else {
									break;
								}
							}
						}

						if (el.media) {
							sources[src].media = el.media;
							if (el.media.match(/min-width:\s*([0-9]+)/)) {
								//picture_minw = true;
								var minWidth = getUnit(el.media.replace(/.*min-width:\s*([0-9.a-z]+).*/, "$1"));
								if (!sources[src].minWidth || sources[src].minWidth > minWidth)
									sources[src].minWidth = minWidth;
							}

							if (el.media.match(/max-width:\s*([0-9]+)/)) {
								//picture_maxw = true;
								var maxWidth = getUnit(el.media.replace(/.*max-width:\s*([0-9.a-z]+).*/, "$1"));
								if (!sources[src].maxWidth || sources[src].maxWidth > maxWidth)
									sources[src].maxWidth = maxWidth;
							}

							if (el.media.match(/min-height:\s*([0-9]+)/)) {
								//picture_minh = true;
								var minHeight = getUnit(el.media.replace(/.*min-height:\s*([0-9.a-z]+).*/, "$1"));
								if (!sources[src].minHeight || sources[src].minHeight > minHeight)
									sources[src].minHeight = minHeight;
							}

							if (el.media.match(/max-height:\s*([0-9]+)/)) {
								//picture_maxh = true;
								var maxHeight = getUnit(el.media.replace(/.*max-height:\s*([0-9.a-z]+).*/, "$1"));
								if (!sources[src].maxHeight || sources[src].maxHeight > maxHeight)
									sources[src].maxHeight = maxHeight;
							}
						}
					}
				}

				if (el_tagname === "A" || (settings.mouseover_allow_iframe_el && el_tagname === "IFRAME")) {
					let src = get_img_src(el);
					links[src] = {
						count: 1,
						src: src,
						el: el,
						id: id++
					};
				}
			}

			function _tokenize_css_value(str):[any, number] {
				var tokensets = [];
				var tokens = [];

				var current_token = "";
				var quote = null;
				var escaping = false;
				for (var i = 0; i < str.length; i++) {
					var char = str[i];

					if (escaping) {
						current_token += char;
						escaping = false;
						continue;
					}

					if (quote) {
						if (char === quote) {
							quote = null;

							tokens.push(current_token);
							current_token = "";
						} else {
							current_token += char;
						}

						continue;
					}

					if (/\s/.test(char)) {
						if (current_token.length > 0) {
							tokens.push(current_token);
							current_token = "";
						}

						continue;
					} else if (char === '\\') {
						escaping = true;
						continue;
					} else if (char === '"' || char === "'") {
						quote = char;
						continue;
					} else if (char === '(') {
						var subtokens = _tokenize_css_value(str.substr(i + 1));
						tokens.push({name: current_token, tokens: subtokens[0]});
						i += subtokens[1];
						current_token = "";
						continue;
					} else if (char === ')') {
						i++;
						break;
					} else if (char === ',') {
						if (current_token)
							tokens.push(current_token);

						tokensets.push(tokens);

						tokens = [];
						current_token = "";
						continue;
					}

					current_token += char;
				}

				if (current_token)
					tokens.push(current_token);

				if (tokens)
					tokensets.push(tokens);

				return [tokensets, i];
			}

			function has_bgimage_url(tokenized) {
				for (var i = 0; i < tokenized.length; i++) {
					if (tokenized[i].length < 1)
						continue;

					if (typeof tokenized[i][0] !== "object")
						continue;

					var our_func = tokenized[i][0];

					var funcname = our_func.name;

					// TODO: support image() and cross-fade()
					var allowed = [
						"url",
						"-webkit-image-set",
						"image-set"
					];

					if (array_indexof(allowed, funcname) < 0)
						continue;

					if (funcname === "url") {
						if (our_func.tokens.length >= 1 && our_func.tokens[0].length > 0 && our_func.tokens[0][0].length > 0)
							return true;
					} else {
						if (has_bgimage_url(our_func.tokens))
							return true;
					}
				}

				return false;
			}

			function get_urlfunc_url(func) {
				if (typeof func !== "object")
					return null;

				if (func.name !== "url")
					return null;

				if (func.tokens.length < 1 || func.tokens[0].length < 1 || func.tokens[0][0].length === 0)
					return null;

				return func.tokens[0][0];
			}

			type CSS_URL = {
				src: string,
				desc_x?: number,
				dpi?: number
			}
			function get_imageset_urls(func):Array<CSS_URL> {
				var urls = [];
				for (var i = 0; i < func.tokens.length; i++) {
					if (func.tokens[i].length < 1) {
						continue;
					}

					var url = get_urlfunc_url(func.tokens[i][0]);
					if (!url)
						continue;

					var source:CSS_URL = {
						src: url
					};

					for (var j = 1; j < func.tokens[i].length; j++) {
						var desc = func.tokens[i][j];
						var whxmatch = desc.match(/^([0-9.]+)(x|dp(?:px|i|cm))$/);

						if (whxmatch) {
							var number = parseFloat(whxmatch[1]);

							if (number > 0) {
								var unit = whxmatch[2];

								// https://drafts.csswg.org/css-values-3/#cm
								if (unit === "dppx") {
									number *= 96;
									unit = "dpi";
								} else if (unit === "dpcm") {
									number *= 96/2.54;
									unit = "dpi";
								}

								if (unit === "x")
									source.desc_x = number;
								else if (unit === "dpi")
									source.dpi = number;
							}
						} else {
							console_warn("Unknown descriptor: " + desc);
						}
					}

					urls.push(source);
				}

				return urls;
			}

			function get_bgimage_urls(tokenized) {
				var urls = [];

				for (var i = 0; i < tokenized.length; i++) {
					if (tokenized[i].length < 1)
						continue;

					if (typeof tokenized[i][0] !== "object")
						continue;

					var our_func = tokenized[i][0];

					var funcname = our_func.name;

					// TODO: support image() and cross-fade()
					var allowed = [
						"url",
						"-webkit-image-set",
						"image-set"
					];

					if (array_indexof(allowed, funcname) < 0)
						continue;

					if (funcname === "url") {
						var url = get_urlfunc_url(our_func);
						if (url) {
							urls.push(url);
						}
					} else if (funcname === "-webkit-image-set" || funcname === "image-set") {
						var newurls = get_imageset_urls(our_func);
						if (newurls) {
							array_extend(urls, newurls);
						}
					}
				}

				return urls;
			}

			function get_urls_from_css(str, elstr) {
				var str_tokenized = _tokenize_css_value(str)[0];

				if (!has_bgimage_url(str_tokenized))
					return null;

				// -webkit-image-set(url('https://carbonmade-media.accelerator.net/34754698;460x194/lossless.webp') 1x, url('https://carbonmade-media.accelerator.net/34754698;920x388/lossless.webp') 2x)

				//var emptystrregex = /^(.*?\)\s*,)?\s*url[(]["']{2}[)]/;
				//if (!str.match(/^(.*?\)\s*,)?\s*url[(]/) || emptystrregex.test(str))
				//	return null;

				// window.getComputedStyle returns the window's URL in this case for some reason, so we need the element's style to find the empty string
				var elstr_tokenized;
				if (elstr) {
					elstr_tokenized = _tokenize_css_value(elstr)[0];
					if (!has_bgimage_url(elstr_tokenized))
						return null;
				}

				return get_bgimage_urls(str_tokenized);
			}

			function add_urls_from_css(el, str, elstr, layer, bg) {
				var urls = get_urls_from_css(str, elstr);
				if (urls) {
					var url;

					for (var i = 0; i < urls.length; i++) {
						url = urls[i];
						if (typeof url !== "string") {
							url = url.src;
						}

						addImage(url, el, {
							isbg: bg,
							layer: layer
						});

						if (typeof urls[i] !== "string") {
							var props = ["desc_x", "dpi"];

							for (var j = 0; j < props.length; j++) {
								var prop = props[j];

								if (urls[i][prop] && (!sources[url][prop] || sources[url][prop] > urls[i][prop])) {
									sources[url][prop] = urls[i][prop];
								}
							}
						}
					}
				}
			}

			function add_bgimage(layer, el, style, beforeafter?:"before"|"after") {
				if (!style || !("style" in el))
					return;

				if (style.getPropertyValue("background-image")) {
					var bgimg = style.getPropertyValue("background-image");
					add_urls_from_css(el, bgimg, el.style.getPropertyValue("background-image"), layer, beforeafter || true);
				}

				if (beforeafter) {
					if (style.getPropertyValue("content")) {
						add_urls_from_css(el, style.getPropertyValue("content"), void 0, layer, beforeafter);
					}
				}
			}

			function addElement(el, layer?:number) {
				nir_debug("find_source", "_find_source (addElement)", el, layer);

				if (get_tprofile_setting("mouseover_exclude_page_bg") && el.tagName === "BODY") {
					return;
				}

				if (typeof layer === "undefined")
					layer = layers.length;

				addTagElement(el, layer);

				add_bgimage(layer, el, window.getComputedStyle(el));
				add_bgimage(layer, el, window.getComputedStyle(el, ":before"), "before");
				add_bgimage(layer, el, window.getComputedStyle(el, ":after"), "after");
			}

			let is_sub_element = function(el, parent) {
				if (el === parent) // el is not a subelement of parent
					return false;

				while (el) {
					if (el === parent)
						return true;
					el = el.parentElement;
				}

				return false;
			};

			for (var i = 0; i < els.length; i++) {
				// sidebar articles on https://www.rt.com/russia/447357-miss-moscow-2018-photos/
				// the <picture> element has a size of 0, and hence isn't added to find_els_at_point
				if (els[i].tagName === "IMG" && els[i].parentElement && els[i].parentElement.tagName === "PICTURE" && array_indexof(els, els[i].parentElement) < 0) {
					els.splice(i + 1, 0, els[i].parentElement);
				}

				// remove every sub element of PICTURE as they will be added automatically anyways
				// this messes up the layering
				if (els[i].tagName === "PICTURE") {
					for (let j = 0; j < i; j++) {
						let subel = els[j];

						if (is_sub_element(subel, els[i])) {
							els.splice(j, 1);
							j--;
							i--;
						}
					}

					break;
				}
			}

			for (var i = 0; i < els.length; i++) {
				var el = els[i];
				addElement(el);
			}

			if (_nir_debug_) {
				//console_log(els);
				nir_debug("find_source", "_find_source (els)", deepcopy(els));
				nir_debug("find_source", "_find_source (sources)", deepcopy(sources));
				nir_debug("find_source", "_find_source (layers)", deepcopy(layers));
				nir_debug("find_source", "_find_source (ok_els)", deepcopy(ok_els));
			}

			// remove sources that aren't used
			var activesources = [];
			for (var i = 0; i < layers.length; i++) {
				for (var j = 0; j < layers[i].length; j++) {
					if (array_indexof(activesources, layers[i][j]) < 0)
						activesources.push(layers[i][j]);
				}
			}

			var ok_els_sources = [];
			for (let source in sources) {
				for (var i = 0; i < ok_els.length; i++) {
					if (sources[source].el === ok_els[i].el) {
						ok_els[i] = sources[source];
						ok_els_sources[i] = true;
					}
				}

				if (array_indexof(activesources, source) < 0)
					delete sources[source];
			}

			for (var i = 0; i < ok_els.length; i++) {
				if (!ok_els_sources[i] && !ok_els[i].src) {
					addElement(ok_els[i].el);
				}
			}

			if ((source = getsource()) !== void 0) {
				nir_debug("find_source", "_find_source (getsource())", source);

				if (source === null) {
					if (ok_els.length > 0) {
						return ok_els[0];
					} else if (options.links) {
						if (Object.keys(links).length > 0) {
							var our_key = null;

							for (var link in links) {
								if (!settings.mouseover_only_valid_links) {
									our_key = link;
									break;
								}

								if (looks_like_valid_link(link, links[link].el)) {
									our_key = link;
									break;
								}
							}

							if (our_key)
								return links[our_key];
						}
					}
				}

				return source;
			}

			for (var i = 0; i < layers.length; i++) {
				var minW = 0;
				var elW = null;
				var minH = 0;
				var elH = null;
				var minMinW = 0;
				var elMinW = null;
				var minMinH = 0;
				var elMinH = null;
				var minMaxW = 0;
				var elMaxW = null;
				var minMaxH = 0;
				var elMaxH = null;
				var minX = 0;
				var elX = null;
				var minDpi = 0;
				var elDpi = null;

				var okurls = {};

				var have_something = false;

				for (var j = 0; j < layers[i].length; j++) {
					var source_url = layers[i][j];

					var source = sources[source_url];

					if (source.width && source.width > minW) {
						minW = source.width;
						elW = source;
						have_something = true;
					}

					if (source.height && source.height > minH) {
						minH = source.height;
						elH = source;
						have_something = true;
					}

					if (source.minWidth && source.minWidth > minMinW) {
						minMinW = source.minWidth;
						elMinW = source;
						have_something = true;
					}

					if (source.minHeight && source.minHeight > minMinH) {
						minMinH = source.minHeight;
						elMinH = source;
						have_something = true;
					}

					if (source.maxWidth && source.maxWidth > minMaxW) {
						minMaxW = source.maxWidth;
						elMaxW = source;
					}

					if (source.maxHeight && source.maxHeight > minMaxH) {
						minMaxH = source.maxHeight;
						elMaxH = source;
					}

					if (source.desc_x && source.desc_x > minX) {
						minX = source.desc_x;
						elX = source;
						have_something = true;
					}

					if (source.dpi && source.dpi > minDpi) {
						//dpiX = source.dpi; // commenting out because dpiX doesn't exist
						elDpi = source;
						have_something = true;
					}

					if (source.isbg) {
						okurls[source.src] = true;
						have_something = true;
					}
				}

				if (!have_something)
					continue;

				if (minX > 1) {
					okurls[elX.src] = true;
				}

				if (minDpi > 96) {
					okurls[elDpi.src] = true;
				}

				if (minW > thresh && minW > minMinW) {
					okurls[elW.src] = true;
				}

				if (minH > thresh && minH > minMinH) {
					okurls[elH.src] = true;
				}

				if (minMinW > thresh && minMinW >= minW) {
					okurls[elMinW.src] = true;
				}

				if (minMinH > thresh && minMinH >= minH) {
					okurls[elMinH.src] = true;
				}

				layers[i] = [];
				for (var url in okurls) {
					layers[i].push(url);
				}
			}

			// TODO: improve?
			function pickbest(layer) {
				for (var i = 0; i < layer.length; i++) {
					var source_url = layer[i];
					var source = sources[source_url];

					if (source.desc_x)
						return source;
				}

				return sources[layer[0]];
			}

			function rebuildlayers() {
				var newlayers = [];
				for (var i = 0; i < layers.length; i++) {
					if (layers[i].length === 0)
						continue;
					newlayers.push(layers[i]);
				}
				layers = newlayers;
			}

			nir_debug("find_source", "_find_source (new layers)", deepcopy(layers));
			rebuildlayers();
			nir_debug("find_source", "_find_source (rebuilt layers)", deepcopy(layers));

			// If there are background images ahead of an image, it's likely to be masks
			// Maybe check if there's more than one element of ancestry between them?
			// Except: https://www.flickr.com/account/upgrade/pro (featured pro, the avatar's image is a bg image, while the image behind isn't)
			if (layers.length > 1 && layers[0].length === 1 && sources[layers[0][0]].isbg) {
				for (var i = 1; i < layers.length; i++) {
					if (layers[i].length === 1 && sources[layers[i][0]].isbg)
						continue;
					return pickbest(layers[i]);
				}
			}

			if (layers.length > 0) {
				return pickbest(layers[0]);
			}

			if (source = getsource())
				return source;
			else
				return getfirstsource(sources);
		}

		var get_next_in_gallery_generic = function(el, nextprev) {
			if (!el)
				return null;

			// https://www.gog.com/game/shadow_warrior_complete
			// "Buy series" gallery
			if (array_indexof(["SOURCE", "IMG"], el.tagName) >= 0 && el.parentElement && array_indexof(["PICTURE", "VIDEO"], el.parentElement.tagName) >= 0) {
				el = el.parentElement;
			}

			var stack = [el.tagName];
			var current_el = el;
			var firstchild = false;

			while (true) {
				if (!firstchild) {
					var next = current_el.nextElementSibling;
					if (!nextprev)
						next = current_el.previousElementSibling;

					if (!next) {
						current_el = current_el.parentElement;
						if (!current_el)
							break;

						stack.unshift(current_el.tagName);
						continue;
					}

					current_el = next;
				} else {
					firstchild = false;
				}

				if (current_el.tagName === stack[0]) {
					if (stack.length === 1) {
						//if (valid_source(current_el))
						if (is_valid_el(current_el))
							return current_el;
						continue;
					}

					if (nextprev) {
						for (var i = 0; i < current_el.children.length; i++) {
							if (current_el.children[i].tagName === stack[1]) {
								current_el = current_el.children[i];
								stack.shift();
								firstchild = true;
								break;
							}
						}
					} else {
						for (var i = current_el.children.length - 1; i >= 0; i--) {
							if (current_el.children[i].tagName === stack[1]) {
								current_el = current_el.children[i];
								stack.shift();
								firstchild = true;
								break;
							}
						}
					}
				}
			}

			return null;
		};

		get_next_in_gallery = function(el, nextprev) {
			if (override_album) {
				let index = array_indexof(override_album, el);
				if (index < 0)
					return null;

				if (nextprev) {
					index++;
				} else {
					index--;
				}

				if (index < 0)
					return null;
				if (index >= override_album.length)
					return null;

				return override_album[index];
			}

			var value = get_album_info_gallery(popup_obj, el, nextprev);
			if (value || value === false)
				return value;

			if (!el.parentElement) {
				if (el.hasAttribute("imu-album-info")) {
					el = popup_orig_el;
				}
			}

			// FIXME: this is a rather bad hack to fix https://github.com/qsniyg/maxurl/issues/467
			previous_album_links = [];
			// FIXME: disabling because get_next_in_gallery can be called multiple times, just for checking links, not for actually redirecting
			if (false && popup_obj && popup_obj.album_info && popup_obj.album_info.type === "links") {
				array_foreach(popup_obj.album_info.links, function(link) {
					previous_album_links.push(link.url);
				});
			}

			return get_next_in_gallery_generic(el, nextprev);
		};

		/*function normalize_trigger() {
			if (!is_array(settings.mouseover_trigger)) {
				settings.mouseover_trigger = [settings.mouseover_trigger];
			}
		}

		normalize_trigger();*/

		function update_mouseover_trigger_delay() {
			delay = settings.mouseover_trigger_delay;
			if (delay < 0 || isNaN(delay))
				delay = false;
			if (typeof delay === "number" && delay >= 10)
				delay = 10;

			if (get_single_setting("mouseover_trigger_behavior") === "mouse") {
				delay_mouseonly = true;
			} else {
				delay = false;
				delay_mouseonly = false;
			}

			if (delay_handle) {
				clearTimeout(delay_handle);
				delay_handle = null;
			}
		}

		update_mouseover_trigger_delay();

		settings_meta.mouseover_trigger_delay.onupdate = update_mouseover_trigger_delay;
		settings_meta.mouseover_trigger_behavior.onupdate = update_mouseover_trigger_delay;

		function can_add_to_chord(str) {
			if (!keystr_is_wheel(str))
				return true;

			return !chord_is_only_wheel(current_chord);
		}

		function clear_chord_wheel() {
			for (var i = 0; i < current_chord.length; i++) {
				if (keystr_is_wheel(current_chord[i])) {
					current_chord.splice(i, 1);
					i--;
				}
			}
		}

		function clear_chord() {
			current_chord = [];
			current_chord_timeout = {};
		}

		function clear_chord_if_only_wheel() {
			if (chord_is_only_wheel(current_chord))
				clear_chord();
		}

		function keystr_in_trigger(str, wanted_chord) {
			return array_indexof(wanted_chord, str) >= 0;
		}

		function key_would_modify_single_chord(str, value) {
			if (value) {
				if (!can_add_to_chord(str))
					return false;

				if (array_indexof(current_chord, str) < 0)
					return true;
			} else {
				if (array_indexof(current_chord, str) >= 0)
					return true;
			}

			return false;
		}

		function set_chord_sub(str, value) {
			if (value) {
				if (!can_add_to_chord(str))
					return false;

				current_chord_timeout[str] = Date.now();
				if (array_indexof(current_chord, str) < 0) {
					current_chord.push(str);
					//console_log("+" + str);
					return true;
				}
			} else {
				delete current_chord_timeout[str];
				if (array_indexof(current_chord, str) >= 0) {
					current_chord.splice(array_indexof(current_chord, str), 1);
					clear_chord_if_only_wheel();
					//console_log("-" + str);
					return true;
				}
			}

			return false;
		}

		function event_in_single_chord(e, wanted_chord) {
			var map = get_keystrs_map(e, true);

			for (var key in map) {
				// otherwise, modifiers like ctrl etc. get counted, even if they're not pressed (because get_keystrs_map reports them as false)
				// todo: if this function is ever called in keyup, another solution is needed.
				// for now, it'll only ever be called on keydown
				if (!map[key])
					continue;

				if (keystr_in_trigger(key, wanted_chord))
					return true;
			}

			return false;
		}

		function event_in_chord(e, wanted_chord) {
			wanted_chord = normalize_keychord(wanted_chord);

			for (var i = 0; i < wanted_chord.length; i++) {
				if (event_in_single_chord(e, wanted_chord[i]))
					return true;
			}

			return false;
		}

		function remove_old_keys() {
			var now = Date.now();

			for (var key in current_chord_timeout) {
				if (now - current_chord_timeout[key] > 5000)
					set_chord_sub(key, false);
			}
		}

		function update_chord(e, value) {
			var map = get_keystrs_map(e, value);

			remove_old_keys();

			var changed = false;
			for (var key in map) {
				if (set_chord_sub(key, map[key]))
					changed = true;
			}

			return changed;
		}

		function event_would_modify_single_chord(e, value, wanted_chord) {
			var map = get_keystrs_map(e, value)

			for (var key in map) {
				if (wanted_chord !== void 0 && !keystr_in_trigger(key, wanted_chord))
					continue;

				if (key_would_modify_single_chord(key, map[key]))
					return true;
			}

			return false;
		}

		function event_would_modify_chord(e, value, wanted_chord) {
			wanted_chord = normalize_keychord(wanted_chord);

			for (var i = 0; i < wanted_chord.length; i++) {
				if (event_would_modify_single_chord(e, value, wanted_chord[i]))
					return true;
			}

			return false;
		}

		function trigger_complete_single(wanted_chord) {
			for (var i = 0; i < wanted_chord.length; i++) {
				var key = wanted_chord[i];

				if (array_indexof(current_chord, key) < 0)
					return false;
			}

			// e.g. if the user presses shift+r, but the chord is r, then it should fail
			for (var i = 0; i < current_chord.length; i++) {
				if (keystr_is_wheel(current_chord[i]))
					continue;

				if (array_indexof(wanted_chord, current_chord[i]) < 0)
					return false;
			}

			return true;
		}

		function trigger_complete(wanted_chord) {
			wanted_chord = normalize_keychord(wanted_chord);

			for (var i = 0; i < wanted_chord.length; i++) {
				if (trigger_complete_single(wanted_chord[i]))
					return true;
			}

			return false;
		}

		function trigger_partially_complete_single(e, wanted_chord) {
			for (var i = 0; i < wanted_chord.length; i++) {
				var key = wanted_chord[i];

				if (array_indexof(current_chord, key) >= 0)
					return true;
			}

			return false;
		}

		function trigger_partially_complete(e, wanted_chord) {
			wanted_chord = normalize_keychord(wanted_chord);

			for (var i = 0; i < wanted_chord.length; i++) {
				if (trigger_partially_complete_single(e, wanted_chord[i]))
					return true;
			}

			return false;
		}

		function get_close_behavior() {
			return get_single_setting("mouseover_close_behavior");
		}

		function get_close_need_mouseout() {
			return settings.mouseover_close_need_mouseout && get_close_behavior() !== "esc";
		}

		// commenting out because it's unused and close_on_leave_el no longer exists
		/*function get_close_on_leave_el() {
			return settings.mouseover_close_on_leave_el && get_single_setting("mouseover_position") === "beside_cursor";
		}*/

		function should_exclude_imagetab() {
			return settings.mouseover_exclude_imagetab && get_single_setting("mouseover_trigger_behavior") === "mouse" &&
				   currenttab_is_image() && !imagetab_ok_override;
		}

		var exclude_find_els = new_set();
		type FindElsAtPointOptions = {
			els_mode?: "full"|"hybrid"|"simple",
			els?: Array<Element>
		}
		function find_els_at_point(xy, options?:FindElsAtPointOptions, els?:Array<Element>, prev?:IMUSet, zoom_cache?:Map<Element, {zIndex: number}>):Array<HTMLElement> {
			// test for pointer-events: none: https://www.shacknews.com/article/114834/should-you-choose-vulkan-or-directx-12-in-red-dead-redemption-2

			if (false && _nir_debug_)
				console_log("find_els_at_point", deepcopy(options), deepcopy(xy), deepcopy(els), deepcopy(prev));

			if (!options) {
				options = {};
			}

			if (!options.els_mode)
				options.els_mode = get_single_setting("mouseover_find_els_mode");
			if (options.els && !els)
				els = options.els;

			var first_run = false;
			if (!prev) {
				prev = new_set();
				first_run = true;
			}

			if (zoom_cache === void 0) {
				try {
					zoom_cache = new Map();
				} catch (e) {
					zoom_cache = null;
				}
			}

			var ret = [];
			var afterret = [];

			if (!els) {
				let orig_els = document.elementsFromPoint(xy[0], xy[1]);

				els = [];
				for (let el of orig_els) {
					if (!set_has(exclude_find_els, el))
						els.push(el);
				}

				afterret = els;

				if (_nir_debug_) {
					console_log("find_els_at_point (elsfrompoint)", deepcopy(els));
				}

				if (options.els_mode === "simple")
					return els as Array<HTMLElement>;
			}

			for (let i = 0; i < els.length; i++) {
				if (i > 0 && first_run && options.els_mode === "hybrid") {
					ret.push(els[i]);
					continue;
				}

				let el = els[i];

				if (set_has(prev, el))
					continue;

				set_add(prev, el);

				let el_has_children = false;
				let el_children = null;
				let el_shadow_children = null;

				if (el.childElementCount > 0) {
					el_children = el.children;
					el_has_children = true;
				}

				if (el.shadowRoot && el.shadowRoot.childElementCount > 0) {
					el_shadow_children = el.shadowRoot.children;
					el_has_children = true;
				}

				// FIXME: should we stop checking if not in bounding client rect?
				// this would depend on the fact that children are always within the bounding rect
				//  - probably not, there are cases where the parent div has a size of 0, but children have proper sizes
				if (el_has_children) {
					// reverse, because the last element is (usually) the highest z
					var newchildren = [];

					if (el_children) {
						for (var j = el_children.length - 1; j >= 0; j--) {
							newchildren.push(el_children[j]);
						}
					}

					// shadow is above non-shadow?
					if (el_shadow_children) {
						for (var j = el_shadow_children.length - 1; j >= 0; j--) {
							newchildren.push(el_shadow_children[j]);
						}
					}

					let newels = find_els_at_point(xy, options, newchildren, prev, zoom_cache);
					for (let j = 0; j < newels.length; j++) {
						let newel = newels[j];
						//console_log("about to add", newel, deepcopy(ret))
						if (array_indexof(ret, newel) < 0) {
							//console_log("adding", newel);
							ret.push(newel);
						}
					}
				}

				// youtube links on: https://old.reddit.com/r/anime/comments/btlmky/wt_mushishi_a_beautifully_melancholic_take_on_the/
				// they pop up outside of the cursor
				let rect = get_bounding_client_rect(el, zoom_cache);
				if (rect && rect.width > 0 && rect.height > 0 &&
					rect.left <= xy[0] && rect.right >= xy[0] &&
					rect.top <= xy[1] && rect.bottom >= xy[1] &&
					array_indexof(ret, el) < 0) {
					ret.push(el);
				}
			}

			for (let i = 0; i < afterret.length; i++) {
				if (array_indexof(ret, afterret[i]) < 0)
					ret.push(afterret[i]);
			}

			if (_nir_debug_ && ret.length > 0) {
				console_log("find_els_at_point (unsorted ret)", shallowcopy(ret));
			}

			if (first_run && options.els_mode === "hybrid") {
				return ret;
			}

			var get_zindex_raw = function(el) {
				var zindex = get_computed_style(el).zIndex;

				var parent_zindex = 0;
				if (el.parentElement) {
					var parent_zindex = get_zindex(el.parentElement);// + 0.001; // hack: child elements appear above parent elements
					// don't use the above hack, it breaks z-ordering, the indexOf thing works already
				}

				if (zindex === "auto") {
					return parent_zindex;
				} else {
					zindex = parseFloat(zindex);

					// https://robertsspaceindustries.com/orgs/LUG/members
					if (zindex < parent_zindex)
						return parent_zindex + zindex; // hack:
						// <div style="z-index: 9"></div>
						// <div style="z-index: 10">
						//   <div style="z-index: 2">this is above z-index: 9 because it's a child of z-index: 10</div>
						// </div>
					else
						return zindex;
				}
			};

			var get_zindex = function(el) {
				if (zoom_cache) {
					var cached = map_get(zoom_cache, el);
					if (!cached || !("zIndex" in cached)) {
						var zindex = get_zindex_raw(el);

						if (cached) {
							cached.zIndex = zindex;
						} else {
							map_set(zoom_cache, el, {
								zIndex: zindex
							});
						}

						return zindex;
					} else {
						return cached.zIndex;
					}
				} else {
					return get_zindex_raw(el);
				}
			};

			// TODO: only sort elements that were added outside of elementsFromPoint
			ret.sort(function(a, b) {
				var a_zindex, b_zindex;

				a_zindex = get_zindex(a);
				b_zindex = get_zindex(b);

				//console_log(a_zindex, b_zindex, a, b);
				if (b_zindex === a_zindex) {
					// Don't modify the sort order
					return array_indexof(ret, a) - array_indexof(ret, b);
				} else {
					// opposite because we want it to be reversed (largest first)
					return b_zindex - a_zindex;
				}
			});

			if (_nir_debug_ && ret.length > 0)
				console_log("find_els_at_point (ret)", els, shallowcopy(ret), xy);

			return ret;
		}

		var get_physical_popup_el = function(el) {
			if (el.parentElement && el.tagName === "SOURCE")
				return el.parentElement;
			return el;
		}

		type TriggerPopupOptions = {
			is_contextmenu?:boolean
		}
		function trigger_popup(options?:TriggerPopupOptions) {
			if (!options) {
				options = {}
			}

			if (_nir_debug_)
				console_log("trigger_popup (options:", options, ")", current_frame_id);

			// this check is set here instead of trigger_popup_with_source because automatic requests (e.g. gallery) should be ok
			if (!settings.mouseover_allow_popup_when_fullscreen && is_fullscreen() && !is_popup_fullscreen())
				return;

			delay_handle_triggering = true;
			//var els = document.elementsFromPoint(mouseX, mouseY);
			var point = null;

			if (mousepos_initialized)
				point = [mouseX, mouseY];
			if (options.is_contextmenu && mouseContextX !== null && mouseContextY !== null)
				point = [mouseContextX, mouseContextY];

			if (point === null) {
				delay_handle_triggering = false;
				return;
			}

			var els = find_els_at_point(point);
			//console_log(els);

			if (_nir_debug_)
				console_log("trigger_popup: els =", els, "point =", point);

			// clearing in order to somewhat mitigate shift+right click issues: https://github.com/qsniyg/maxurl/issues/679
			if (options.is_contextmenu) {
				mouseContextX = null;
				mouseContextY = null;
			}

			var source = find_source(els, {point: point});

			if (!source && settings.mouseover_allow_self_pagelink && popup_trigger_reason === "keyboard") {
				source = {
					el: document.body,
					src: window.location.href,
					pagelink: true
				};
			}

			if (_nir_debug_)
				console_log("trigger_popup: source =", source);

			if (source && (popup_trigger_reason !== "mouse" || get_physical_popup_el(source.el) !== last_popup_el)) {
				trigger_popup_with_source(source);
			} else {
				if (popup_trigger_reason === "keyboard") {
					if (settings.mouseover_enable_notallowed) {
						cursor_not_allowed();
					}
				}

				delay_handle_triggering = false;
			}
		}

		function trigger_popup_with_source(source, automatic?:boolean, use_last_pos?:boolean, cb?:Function) {
			next_popup_el = get_physical_popup_el(source.el);

			if (!cb) cb = common_functions["nullfunc"];

			var use_head = false;
			var openb = get_tprofile_single_setting("mouseover_open_behavior");
			if (openb === "newtab" || openb === "newtab_bg" || openb === "download" || openb === "copylink") {
				use_head = true;
			}

			let browser_viewable = !use_head; // incidentally the same

			var old_source = source;

			var incomplete_image = false;
			var incomplete_video = false;

			var partial = get_single_setting("mouseover_allow_partial");

			if (partial === "media") {
				incomplete_image = true;
				incomplete_video = true;
			} else if (partial === "video") {
				incomplete_video = true;
			}

			if (is_in_iframe && can_iframe_popout()) {
				incomplete_image = true;
				incomplete_video = true;
			}

			return get_final_from_source(source, {
				automatic: automatic,
				multi: false,
				use_head: use_head,
				incomplete_image: incomplete_image,
				incomplete_video: incomplete_video,
				use_last_pos: use_last_pos,
				browser_viewable: browser_viewable
			}, function(source_imu, source, processing, data) {
				if (!source_imu && !source && !processing && !data) {
					delay_handle_triggering = false;
					if (old_source.pagelink) {
						stop_waiting_cant_load();
					} else {
						stop_waiting();
					}
					return cb(false);
				}

				// FIXME: this shouldn't fail, but rather go to the next element
				if (automatic && previous_album_links && source_imu && source_imu[0]) {
					if (array_indexof(previous_album_links, source_imu[0].url) >= 0) {
						delay_handle_triggering = false;
						stop_waiting();
						return cb(false);
					}
				}

				var was_fullscreen = is_popup_fullscreen();
				//console_log(source_imu);
				resetpopups({
					new_popup: true,
					automatic: automatic
				});

				if (automatic) {
					popup_el_automatic = true;
					removepopups(); // don't fade out
				}

				real_popup_el = source.el;
				popup_el = get_physical_popup_el(real_popup_el);
				if (popup_el.parentElement) // check if it's a fake element returned by a gallery helper
					popup_orig_el = popup_el;
				popup_el_mediatype = el_media_type(popup_el);
				popup_el_is_stream = popup_el_mediatype === "video" || popup_el_mediatype === "audio";

				popup_orig_url = get_img_src(popup_el);

				if (is_in_iframe && can_iframe_popout() && get_tprofile_single_setting("mouseover_open_behavior") === "popup") {
					data.data.img = serialize_img(data.data.img);
					remote_send_message("top", {
						type: "make_popup",
						data: {
							source_imu: source_imu,
							src: source.src,
							processing: processing,
							data: data
						}
					});
				} else {
					makePopup(source_imu, source.src, processing, data);

					if (is_in_iframe && can_use_remote() && get_tprofile_single_setting("mouseover_open_behavior") === "popup") {
						remote_send_message("top", {
							type: "popup_open"
						});
					}

					// fixme: this actually doesn't work, because it's not counted as being part of a user event
					if (false && was_fullscreen) {
						popup_set_fullscreen();
					}
				}

				cb(true);
			});
		}

		type Processing = {
			running: boolean,
			incomplete_image?: boolean,
			incomplete_video?: boolean,
			progress_cb?: () => void, // todo
			head?: boolean,
			browser_viewable?: boolean // codecs, filetypes
			set_cache?: boolean,
			use_cache?: boolean,
			deny_nondirect_delivery?: boolean,
			deny_video?: boolean,
			deny_audio?: boolean,
			source?: any
		}
		type GFFS_HeadData = {
			resp: HTMLElement,
			obj: string
		}
		type GFFS_GetData = {
			img: HTMLElement,
			newurl: string,
			obj: BigImageInfoObject,
			respdata: Object
		}
		type GFFS_Data = GFFS_HeadData | GFFS_GetData
		type GFFS_Options = {
			use_last_pos?: boolean,
			incomplete_image?: boolean,
			incomplete_video?: boolean,
			progress_cb?: () => void, // FIXME
			use_head?: boolean,
			browser_viewable?: boolean // codecs, filetypes
			deny_cache?: boolean,
			deny_nondirect_delivery?: boolean,
			null_if_no_change?: boolean,
			multi?: boolean,
			automatic?: boolean
		}
		function get_final_from_source(source, options:GFFS_Options, cb) {
			// FIXME: "multi" is used purely for replace_images,
			//   so it's used as a check for many options that have nothing to do with multi

			var processing:Processing = {running: true};

			if (!options.multi) {
				stop_processing();
				processing_list = [processing];
			}

			//console_log(source);

			var do_popup = function() {
				if (!options.multi)
					start_waiting(source.el);

				var x = mouseX;
				var y = mouseY;

				var realcb = function(source_imu, data) {
					//console_log(source_imu);
					//console_log(data);
					// why && false here? this should be clarified
					if ((!source_imu && false) || !data) {
						if (!options.multi) {
							stop_waiting_cant_load();
						}

						return cb();
					}

					// In case the user has dragged while loading the next image (#154)
					if (options.use_last_pos) {
						x = null;
						y = null;
					}

					cb(source_imu, source, processing, {
						data: data,
						x: x,
						y: y
					});
				};

				try {
					// FIXME: shouldn't this be ||?
					var force_page = settings.mouseover_ui_caption && settings.redirect_force_page;

					bigimage_recursive_loop(source.src, {
						fill_object: true,
						host_url: window.location.href,
						document: document,
						window: get_window(),
						element: source.el,
						force_page: force_page,
						cb: realcb
					}, function(obj, finalcb) {
						var orig_obj = obj;

						if (_nir_debug_)
							console_log("do_popup: brl query:", obj);

						if (options.null_if_no_change && obj[0].url === source.src) {
							return finalcb(source.src, obj[0], null);
						}

						var newobj = deepcopy(obj);

						// TODO: find a way to fix bad images popping up because they weren't caught in addImage (because of do_request: null)
						// brl returns [] if they're bad, but the bad sources are added right back here
						if (!settings.mouseover_exclude_sameimage) {
							if (source.src && obj_indexOf(newobj, source.src) < 0)
								newobj.push(fillobj(source.src)[0]); // FIXME: fillobj needs a second argument
						} else if (source.src) {
							var index;

							while ((index = obj_indexOf(newobj, source.src)) >= 0) {
								newobj.splice(index, 1);
							}
						}

						if (source.pagelink) {
							newobj = basic_fillobj(newobj);
							array_foreach(newobj, function(sobj) {
								if (sobj.url.replace(/#.*/, "") === source.src.replace(/#.*/, "")) {
									sobj.is_pagelink = true;
								}
							});
						}

						processing.incomplete_image = options.incomplete_image;
						processing.incomplete_video = options.incomplete_video;
						processing.progress_cb = options.progress_cb;

						processing.browser_viewable = options.browser_viewable;

						if (options.use_head) {
							processing.head = true;
						}

						if (settings.popup_allow_cache && !options.deny_cache) {
							processing.set_cache = true;
							processing.use_cache = true;
						}

						processing.deny_nondirect_delivery = options.deny_nondirect_delivery;

						if (!get_tprofile_setting("mouseover_allow_video")) {
							processing.deny_video = true;
						}

						if (!get_tprofile_setting("mouseover_allow_audio")) {
							processing.deny_audio = true;
						}

						processing.source = source;

						check_image_get(newobj, function(img, newurl, obj, respdata) {
							if (_nir_debug_)
								console_log("do_popup: check_image_get response:", img, newurl, obj, respdata);

							if (!img) {
								return finalcb(null);
							}

							var data:GFFS_Data = {img: img, newurl: newurl, obj: obj, respdata: respdata};
							var newurl1 = newurl;

							if (options.use_head) {
								data = {resp: img, obj: newurl};
								newurl1 = data.resp.finalUrl;
							}

							if (settings.print_imu_obj)
								console_log(orig_obj);

							finalcb(newurl1, data.obj, data);

							if (false) {
								// why?
								if (newurl == source.src) {
									realcb(obj, data);
								} else {
									finalcb(newurl, data);
								}
							}
						}, processing);
					});
				} catch (e) {
					console_error(e);
					//console.trace();
					// this doesn't work
					//makePopup(source.src);
				}
			};

			if (delay && !delay_mouseonly && !options.automatic) {
				start_progress(source.el);
				delay_handle = setTimeout(function() {
					if (delay_handle_triggering)
						return;

					delay_handle = null;
					do_popup();
				}, delay * 1000);
			} else {
				do_popup();
			}
		}

		function do_get_helpers(options) {
			var baseoptions = {
				document: document,
				window: get_window(),
				host_url: window.location.href,
				do_request: do_request,
				rule_specific: {}
			};

			for (var option in options) {
				baseoptions[option] = options[option];
			}

			return get_helpers(baseoptions);
		}

		function wrap_gallery_func(nextprev, origel, el, cb, new_options?) {
			if (!el)
				el = real_popup_el;

			if (!origel)
				origel = popup_orig_el;

			var options = {
				element: origel,
				document: document,
				window: get_window(),
				host_url: window.location.href,
				do_request: do_request,
				rule_specific: {},
				cb: function(result) {
					if (result === void 0 || result === "default") {
						return cb(get_next_in_gallery(el, nextprev));
					} else {
						cb(result);
					}
				}
			};

			if (new_options) {
				for (var key in new_options) {
					options[key] = new_options[key];
				}
			}

			get_bigimage_extoptions_first(options);
			get_bigimage_extoptions(options);

			var helpers = get_helpers(options);
			var gallery = get_next_in_gallery;

			if (helpers && helpers.gallery) {
				gallery = function(el, nextprev) {
					var value = helpers.gallery(el, nextprev);
					if (value || value === null)
						return value;

					return get_next_in_gallery(el, nextprev);
				};
			}

			var value = gallery(el, nextprev);
			if (value === "waiting") {
				return;
			} else if (value === "default") {
				return cb(get_next_in_gallery(el, nextprev));
			}

			return cb(value);
		}

		// https://developer.chrome.com/en/blog/tablesng/
		// keeps re-requesting the same element, which causes massive performance issues
		// <img alt="correct and incorrect table rendering" height="333" loading="lazy" sizes="(min-width: 800px) 800px, calc(100vw - 48px)" src="https://developer-chrome-com.imgix.net/image/HodOHWjMnbNw56hvNASHWSgZyAf2/Ms8AqAJn1oKmM1thWYut.png?auto=format" srcset="https://developer-chrome-com.imgix.net/image/HodOHWjMnbNw56hvNASHWSgZyAf2/Ms8AqAJn1oKmM1thWYut.png?w=200 200w, https://developer-chrome-com.imgix.net/image/HodOHWjMnbNw56hvNASHWSgZyAf2/Ms8AqAJn1oKmM1thWYut.png?w=228 228w, https://developer-chrome-com.imgix.net/image/HodOHWjMnbNw56hvNASHWSgZyAf2/Ms8AqAJn1oKmM1thWYut.png?w=260 260w, https://developer-chrome-com.imgix.net/image/HodOHWjMnbNw56hvNASHWSgZyAf2/Ms8AqAJn1oKmM1thWYut.png?w=296 296w, https://developer-chrome-com.imgix.net/image/HodOHWjMnbNw56hvNASHWSgZyAf2/Ms8AqAJn1oKmM1thWYut.png?w=338 338w, https://developer-chrome-com.imgix.net/image/HodOHWjMnbNw56hvNASHWSgZyAf2/Ms8AqAJn1oKmM1thWYut.png?w=385 385w, https://developer-chrome-com.imgix.net/image/HodOHWjMnbNw56hvNASHWSgZyAf2/Ms8AqAJn1oKmM1thWYut.png?w=439 439w, https://developer-chrome-com.imgix.net/image/HodOHWjMnbNw56hvNASHWSgZyAf2/Ms8AqAJn1oKmM1thWYut.png?w=500 500w, https://developer-chrome-com.imgix.net/image/HodOHWjMnbNw56hvNASHWSgZyAf2/Ms8AqAJn1oKmM1thWYut.png?w=571 571w, https://developer-chrome-com.imgix.net/image/HodOHWjMnbNw56hvNASHWSgZyAf2/Ms8AqAJn1oKmM1thWYut.png?w=650 650w, https://developer-chrome-com.imgix.net/image/HodOHWjMnbNw56hvNASHWSgZyAf2/Ms8AqAJn1oKmM1thWYut.png?w=741 741w, https://developer-chrome-com.imgix.net/image/HodOHWjMnbNw56hvNASHWSgZyAf2/Ms8AqAJn1oKmM1thWYut.png?w=845 845w, https://developer-chrome-com.imgix.net/image/HodOHWjMnbNw56hvNASHWSgZyAf2/Ms8AqAJn1oKmM1thWYut.png?w=964 964w, https://developer-chrome-com.imgix.net/image/HodOHWjMnbNw56hvNASHWSgZyAf2/Ms8AqAJn1oKmM1thWYut.png?w=1098 1098w, https://developer-chrome-com.imgix.net/image/HodOHWjMnbNw56hvNASHWSgZyAf2/Ms8AqAJn1oKmM1thWYut.png?w=1252 1252w, https://developer-chrome-com.imgix.net/image/HodOHWjMnbNw56hvNASHWSgZyAf2/Ms8AqAJn1oKmM1thWYut.png?w=1428 1428w, https://developer-chrome-com.imgix.net/image/HodOHWjMnbNw56hvNASHWSgZyAf2/Ms8AqAJn1oKmM1thWYut.png?w=1600 1600w" width="800">
		var valid_el_cache = new IMUCache();
		function is_valid_el(el) {
			if (!el)
				return false;

			if (valid_el_cache.has(el))
				return valid_el_cache.get(el);

			var result = !!find_source([el]);
			valid_el_cache.set(el, result, 3);

			return result;
		}

		function count_gallery(nextprev, max, is_counting, origel, el, cb) {
			var count = 0;

			if (max === void 0)
				max = settings.mouseover_ui_gallerymax;

			var firstel = el;
			if (!firstel)
				firstel = real_popup_el;

			if (!firstel && popup_el_remote && can_iframe_popout() && !is_in_iframe) {
				return remote_send_message(popup_el_remote, {
					type: "count_gallery",
					data: {
						nextprev: nextprev,
						is_counting: is_counting,
						max: max
					}
				}, function(count) {
					cb(count);
				});
			}

			var loop = function() {
				wrap_gallery_func(nextprev, origel, el, function(newel) {
					if (!newel || !is_valid_el(newel))
						return cb(count, el);

					count++;

					if (count >= max)
						return cb(count, newel);

					el = newel;

					stackoverflow_guard(loop, count, 100);
				}, {is_counting: is_counting, counting_firstel: firstel});
			};

			loop();
		}

		var get_gallery_elements = function(cb, origel, el) {
			var count = 0;
			var els_set = new_set();
			var els = [];

			var firstel = el;
			if (!firstel)
				firstel = real_popup_el;

			if (firstel) {
				set_add(els_set, firstel);
				els.push(firstel);
			}

			var loop = function(nextprev, cb) {
				wrap_gallery_func(nextprev, origel, el, function(newel) {
					if (!newel || !is_valid_el(newel))
						return cb();

					count++;

					//if (count >= max) return cb();

					el = newel;

					if (!set_has(els_set, el)) {
						set_add(els_set, el);

						if (nextprev) {
							els.push(el);
						} else {
							els.unshift(el);
						}
					}

					// large galleries can cause stack overflows, as well as hanging the page
					stackoverflow_guard(function() {
						loop(nextprev, cb);
					}, count, 100);
				});
			};

			loop(false, function() {
				loop(true, function() {
					cb(els);
				});
			});
		};

		function wrap_gallery_cycle(dir, origel, el, cb) {
			if (!el)
				el = real_popup_el;

			if (dir === 0)
				return cb();

			var nextprev = true;
			var max = dir;
			if (dir < 0) {
				nextprev = false;
				max = -dir;
			}

			count_gallery(nextprev, max, false, origel, el, function(count, newel) {
				if (count < max) {
					if (settings.mouseover_gallery_cycle) {
						count_gallery(!nextprev, void 0, true, origel, el, function(count, newel) {
							cb(newel);
						});
					} else {
						cb(null);
					}
				} else {
					cb(newel);
				}
			});
		}

		function is_nextprev_valid(nextprev, cb) {
			if (popup_el_remote && can_iframe_popout() && !is_in_iframe) {
				return remote_send_message(popup_el_remote, {
					type: "is_nextprev_valid",
					data: {
						nextprev: nextprev
					}
				}, function(valid) {
					cb(valid);
				});
			}

			wrap_gallery_cycle(nextprev ? 1 : -1, void 0, void 0, function(el) {
				cb(is_valid_el(el));
			});
		}

		trigger_gallery = function(dir, cb) {
			if (!cb) {
				cb = common_functions.nullfunc;
			}

			if (popup_el_remote && can_iframe_popout() && !is_in_iframe) {
				return remote_send_message(popup_el_remote, {
					type: "trigger_gallery",
					data: {
						dir: dir
					}
				}, function(triggered) {
					cb(triggered);
				});
			}

			wrap_gallery_cycle(dir, void 0, void 0, function(newel) {
				if (newel) {
					var source = find_source([newel]);
					if (source) {
						trigger_popup_with_source(source, true, true, function(changed) {
							cb(changed)
						});

						return;
					}
				}

				return cb(false);
			});
		}

		var parse_transforms = function(transform) {
			var transforms = [];
			var transform_types = {};

			var last = 0;
			for (var i = 0; i < transform.length; i++) {
				if (transform[i] === ')') {
					var our_transform = strip_whitespace(transform.substr(last, (i - last) + 1));
					var type = our_transform.replace(/\(.*/, "");
					transforms.push(our_transform);

					if (!(type in transform_types)) {
						transform_types[type] = [];
					}
					transform_types[type].push(transforms.length - 1);

					last = i + 1;
					continue;
				}
			}

			return {transforms: transforms, types: transform_types};
		};

		var get_popup_transforms = function() {
			var style = null;

			if (popups && popups[0]) {
				var media = get_popup_media_el();
				if (media) {
					style = media.parentElement.parentElement.style;
				}
			}

			if (style && style.transform) {
				return parse_transforms(style.transform);
			} else {
				return {transforms: [], types: {}};
			}
		}

		var stringify_transforms = function(transforms) {
			return transforms.transforms.join(" ");
		};

		var set_popup_transforms = function(transforms) {
			var media = get_popup_media_el();

			if (media) {
				media.parentElement.parentElement.style.transform = stringify_transforms(transforms);
			}
		};

		var get_rotation_data_from_transforms = function(transforms) {
			var index = 0;
			if ("rotate" in transforms.types) {
				index = transforms.types.rotate[0];
			} else {
				transforms.transforms.unshift("rotate(0deg)");
			}

			var match = transforms.transforms[index].match(/^rotate\(([-0-9]+)deg\)$/);
			var deg = 0;
			if (match) {
				deg = parseInt(match[1]);
			}

			return {
				deg: deg,
				index: index
			};
		};

		var get_popup_rotation = function() {
			var transforms = get_popup_transforms();
			var rotation_data = get_rotation_data_from_transforms(transforms);
			return rotation_data.deg;
		};

		function rotate_gallery(dir) {
			if (!popups_active)
				return;

			var transforms = get_popup_transforms();
			var rotation_data = get_rotation_data_from_transforms(transforms);

			transforms.transforms[rotation_data.index] = "rotate(" + (rotation_data.deg + dir) + "deg)";
			set_popup_transforms(transforms);

			popup_createui_func(true);
		}

		// hv: vertical = true, horizontal = false
		var flip_gallery = function(hv) {
			if (!popups_active)
				return;

			var transforms = get_popup_transforms();

			var index = transforms.transforms.length;
			if ("scale" in transforms.types) {
				index = transforms.types.scale[0];
			} else {
				transforms.transforms.push("scale(1,1)");
			}

			var match = transforms.transforms[index].match(/^scale\(([-0-9.]+)\s*,\s*([-0-9.]+)\)$/);
			var scaleh = 1;
			var scalev = 1;

			if (match) {
				scaleh = parseFloat(match[1]);
				scalev = parseFloat(match[2]);
			}

			if (hv) {
				scalev = -scalev;
			} else {
				scaleh = -scaleh;
			}

			transforms.transforms[index] = "scale(" + scaleh + ", " + scalev + ")";
			set_popup_transforms(transforms);
		};

		var format_number_decimal = function(number, decimal) {
			var exp = Math_pow(10, decimal);;
			number *= exp
			return (number | 0) / exp;
		};

		var get_bytes_unit = function(bytes) {
			var units = ["B", "KB", "MB", "GB", "TB", "PB"];
			while (units.length > 1 && bytes > 1024) {
				bytes /= 1024;
				units.shift();
			}

			return format_number_decimal(bytes, 2) + units[0];
		};

		function create_progress_el(position_top) {
			var progressc_el = document_createElement("div");
			set_el_all_initial(progressc_el);
			progressc_el.style.backgroundColor = "rgba(0,0,0,0.7)";
			//progressc_el.style.padding = "1em";
			progressc_el.style.height = "2em";
			progressc_el.style.zIndex = maxzindex - 2;

			var progressb_el = document_createElement("div");
			set_el_all_initial(progressb_el);
			progressb_el.style.position = "absolute";
			progressb_el.style.top = "0px";
			progressb_el.style.left = "0px";
			//progressb_el.style.backgroundColor = "#00aa00";
			progressb_el.style.backgroundColor = "#00aaff";
			progressb_el.style.height = "100%";
			progressb_el.style.width = "0%";
			progressb_el.style.zIndex = maxzindex - 1;

			progressc_el.appendChild(progressb_el);

			if (position_top) {
				progressc_el.style.position = "fixed";
				progressc_el.style.top = "0px";
				progressc_el.style.left = "0px";
				progressc_el.style.width = "80%";
				progressc_el.style.marginTop = "100px";
				progressc_el.style.marginLeft = "10%";
				document.documentElement.appendChild(progressc_el);
			}

			return progressc_el;
		}

		function update_progress_el(el, percent, remove_on_complete) {
			var bar = el.children[0];

			if (typeof percent === "number") {
				if (bar.getAttribute("data-timer")) {
					clearInterval(parseInt(bar.getAttribute("data-timer")));
					bar.removeAttribute("data-timer");
				}

				if (percent >= 1 && remove_on_complete && el.parentElement) {
					el.parentElement.removeChild(el);
				} else {
					bar.style.width = (percent * 100) + "%";
				}
			} else if (percent == "unknown") {
				bar.style.width = "10%";

				if (!bar.getAttribute("data-timer")) {
					bar.style.left = "0%";
					bar.setAttribute("data-dir", "right");
					var timer = setInterval(function() {
						var left = parseFloat(bar.style.left);
						var delta = (15/1000) * 1;
						var size = 90;

						if (bar.getAttribute("data-dir") == "right") {
							left += (delta * size);
							if (left >= size) {
								left = size - (left - size);
								bar.setAttribute("data-dir", "left");
							}
						} else {
							left -= (delta * size);
							if (left <= 0) {
								left = -left;
								bar.setAttribute("data-dir", "right");
							}
						}

						bar.style.left = left + "%";
					}, 15);

					bar.setAttribute("data-timer", timer);
				}
			}
		}

		var is_el_pic = function(el) {
			return el.tagName === "IMG" || el.tagName === "PICTURE";
		};

		var is_img_pic_vid = function(el) {
			return is_el_pic(el) || el.tagName === "VIDEO";
		};

		var is_img_pic_vid_link = function(el) {
			if (is_img_pic_vid(el))
				return true;

			if (settings.mouseover_links) {
				if (el.tagName === "A")
					return true;
			}

			return false;
		}

		var get_all_valid_els = function(el?:Element) {
			if (!el)
				el = document;
			return el.querySelectorAll("img, picture, video");
		};

		var get_all_valid_els_link_real = function(el?:Element) {
			if (!el)
				el = document;
			return el.querySelectorAll("img, picture, video, a");
		};

		var get_all_valid_els_link = function(el?:Element) {
			if (settings.mouseover_links) {
				return get_all_valid_els_link_real(el);
			} else {
				return get_all_valid_els(el);
			}
		};

		var copy_el = function(oldel, newel, override) {
			array_foreach(oldel.attributes, function(attr) {
				if (!newel.hasAttribute(attr.name) || override)
					newel.setAttribute(attr.name, attr.value);
			});
		};

		var duplicate_el = function(oldel) {
			var newel = document_createElement(oldel.tagName);
			copy_el(oldel, newel);
			return newel;
		};

		var replace_el = function(oldel, newel) {
			if (newel.parentElement) {
				newel = duplicate_el(newel);
				newel.removeAttribute("style"); // in case of cached element being used in popup
			}

			copy_el(oldel, newel);

			oldel.parentElement.insertBefore(newel, oldel);
			oldel.parentElement.removeChild(oldel);
		};

		var replace_with_replacement = function(options, el, replacement, url) {
			var newsrc;

			if (!replaced) {
				newsrc = get_img_src(replacement);
			}

			var do_replace = false;
			if (el.tagName === "A") {
				if (options.plainlink_replace_link) {
					el.href = newsrc;
				}

				if (options.plainlink_replace_text) {
					el.textContent = newsrc;
				}

				if (options.plainlink_replace_media) {
					do_replace = true;
				}
			}

			var el_dimensions = get_el_dimensions(el);

			var replaced = false;
			if (do_replace || (typeof replacement !== "string" && replacement.tagName === "VIDEO")) {
				if (typeof replacement !== "string") {
					// todo: only replace on either blob url (hls/dash), or when the source el was a picture
					el = replace_el(el, replacement);
					replaced = true;
				} else {
					console_warn("Unable to replace", el, "due to invalid replacement:", replacement);
					return;
				}
			}

			if (!replaced && options.replace_imgs) {
				// srcset can override src: https://github.com/qsniyg/maxurl/issues/659
				if (el.hasAttribute("srcset")) {
					el.removeAttribute("srcset");
				}

				if (get_img_src(el) !== newsrc) {
					el.src = newsrc;
				}
			}

			if (options.size_constraints === "remove") {
				el.removeAttribute("height");
				el.removeAttribute("width");
				el.style.setProperty("height", "auto", "important");
				el.style.setProperty("width", "auto", "important");
			} else if (options.size_constraints === "force" && el_dimensions && el_dimensions[0] && el_dimensions[1]) {
				el.setAttribute("height", el_dimensions[1]);
				el.removeAttribute("width", el_dimensions[0]);
				el.style.setProperty("height", el_dimensions[1] + "px", "important");
				el.style.setProperty("width", el_dimensions[0] + "px", "important");
			}

			if (options.replace_css) {
				apply_styles(el, options.replace_css, {
					force_important: true
				});
			}

			if (options.add_links) {
				var current = el;

				while (current = current.parentElement) {
					if (current.tagName === "A") {
						if (!options.replace_links)
							return;
						else
							break;
					}
				}

				if (!current) {
					current = document_createElement("a");

					el.parentElement.insertBefore(current, el);
					current.appendChild(el);
				}

				if (options.links_newtab) {
					current.target = "_blank";
				}

				if (current.href !== url) {
					current.href = url;
				}
			}
		};

		var replace_single_media = function(options, source, data, cb) {
			var waiting = false;

			if (data.data.img) {
				replace_with_replacement(options, source.el, data.data.img, data.data.obj.url);
			} else if (data.data.obj) {
				var load_image = function() {
					if (settings.replaceimgs_wait_fullyloaded && options.replace_imgs) {
						// Preload the image, as adding onload/onerror to existing images won't fire the event
						// todo: support videos
						var image = new Image();
						var finish_image = function() {
							replace_with_replacement(options, source.el, image.src, data.data.obj.url);
							cb();
						};

						image.onload = finish_image;
						image.onerror = cb;
						image.src = data.data.obj.url;
					} else {
						replace_with_replacement(options, source.el, data.data.obj.url, data.data.obj.url);
						cb();
					}
				};

				if (is_extension) {
					extension_send_message({
						type: "override_next_headers",
						data: {
							url: data.data.obj.url,
							headers: data.data.obj.headers,
							method: "GET"
						}
					}, function() {
						load_image();
					});
				} else {
					load_image();
				}

				waiting = true;
			}

			if (!waiting)
				cb();
		};

		var replacing_imgs = false;
		var replaceimgs_elcache = new IMUCache();
		function replace_images(options) {
			if (replacing_imgs || currenttab_is_image())
				return;

			var raw_imgs = options.images;

			if (raw_imgs === void 0) {
				if (options.support_plainlinks) {
					raw_imgs = get_all_valid_els_link_real();
				} else {
					raw_imgs = get_all_valid_els();
				}
			}

			// remove non-images/videos
			var imgs = [];

			if (!options.all_els_ok) {
				var parent_els = new_set();
				for (var i = 0; i < raw_imgs.length; i++) {
					var supported = is_img_pic_vid(raw_imgs[i]);
					if (!supported && options.support_plainlinks && raw_imgs[i].tagName === "A") supported = true;

					if (supported) {
						imgs.push(raw_imgs[i]);

						if (options.support_plainlinks) {
							var parent = raw_imgs[i].parentElement;
							while (parent) {
								set_add(parent_els, parent);
								parent = parent.parentElement;
							}
						}
					}
				}

				if (options.support_plainlinks) {
					// linked media are not plainlinks
					// fixme: does this work for non-document?
					for (var i = 0; i < imgs.length; i++) {
						if (imgs[i].tagName === "A" && set_has(parent_els, imgs[i])) {
							imgs.splice(i, 1);
							i--;
						}
					}
				}
			} else {
				imgs = raw_imgs;
			}

			if (imgs.length === 0)
				return;

			var ip;
			if (options.use_progressbar)
				console_log("Replacing images");

			var finished = 0;

			var final_progress = 1;
			if (options.finalcb && options.finalcb_progress) {
				final_progress -= options.finalcb_progress;
			}

			var finish_img = function(id) {
				finished++;

				if (options.use_progressbar) {
					//update_progress_el(progressc_el, finished / total_imgs, true);
					ip.finish_id(id);
					console_log("Finished " + finished + "/" + total_imgs);
				}

				if (finished >= total_imgs) {
					if (options.use_progressbar) {
						update_progress_el(progressc_el, final_progress, true);
					}
					//if (options.use_progressbar) {
					//	progressc_el.parentElement.removeChild(progressc_el);
					//}

					replacing_imgs = false;

					if (options.finalcb) {
						options.finalcb(function(progress) {
							if (options.use_progressbar && options.finalcb_progress) {
								update_progress_el(progressc_el, final_progress + (progress * options.finalcb_progress), true);
							}
						});
					}
				} else {
					// stack overflows are unlikely because we're mostly running from callbacks, but it may be possible if we're retrieving cached images?
					stackoverflow_guard(next_img, finished, 100);
				}
			};

			if (!options.replace_image_func) {
				options.replace_image_func = function(options, our_source, cb, domain_processed_cb, progress_cb) {
					if (options.use_elcache) {
						if (replaceimgs_elcache.has(our_source.el)) {
							domain_processed_cb();
							return cb();
						} else {
							// Not perfect, but 5 seconds should be enough
							replaceimgs_elcache.set(our_source.el, true, 5);
						}
					}

					var use_head = !settings.replaceimgs_usedata;
					var incomplete = use_head;
					var null_if_no_change = true;
					if (our_source.el.tagName === "A") {
						use_head = null_if_no_change = !options.plainlink_replace_media;

						// otherwise it'll request a lot of links, most of which aren't images
						if (!null_if_no_change) {
							null_if_no_change = !looks_like_valid_link(our_source.src, our_source.el);
						}
					}

					get_final_from_source(our_source, {
						automatic: true,
						multi: true,
						use_head: use_head,
						incomplete_image: incomplete,
						incomplete_video: incomplete,
						null_if_no_change: null_if_no_change,
						use_last_pos: false,
						progress_cb: progress_cb,
						browser_viewable: options.browser_viewable
					}, function (source_imu, source, processing, data) {
						domain_processed_cb();

						if (!data) {
							replace_with_replacement(options, our_source.el, our_source.src, our_source.src);
							return cb();
						}

						replace_single_media(options, source, data, cb);
					});
				};
			}

			var current_img_i = 0;
			var next_img = function() {
				var total_limit = parseInt(settings.replaceimgs_totallimit);
				if (currently_processing > total_limit) {
					currently_processing--;
					return;
				} else if (currently_processing < total_limit) {
					currently_processing++;
					next_img();
				}


				var our_source = null;
				var our_domain = null;

				var now = Date.now();

				for (var domain in domains) {
					if (domains_processing[domain] >= parseInt(settings.replaceimgs_domainlimit)) {
						continue;
					}

					var delta = now - domains_lastrequest[domain];
					var replaceimgs_delay = parseFloat(settings.replaceimgs_delay) * 1000.0;
					var wait_delay = replaceimgs_delay - delta;
					if (wait_delay > 0) {
						if (domains_timeout[domain] === null) {
							// wrap in closure to capture domain for the callback
							(function(domain) {
								domains_timeout[domain] = setTimeout(function() {
									domains_timeout[domain] = null;
									next_img();
								}, wait_delay + 1);
							})(domain);
						}

						continue;
					}

					our_domain = domain;

					domains_processing[domain]++;
					domains_lastrequest[domain] = now;

					our_source = domains[domain][0];
					domains[domain].splice(0, 1);

					if (domains[domain].length === 0) {
						delete domains[domain];
					}

					break;
				}

				if (our_source === null && other.length > 0) {
					our_source = other[0];
					other.splice(0, 1);
				}

				var our_id = current_img_i;
				current_img_i++;

				if (our_source) {
					options.replace_image_func(options, our_source,
						function() {
							finish_img(our_id);
						},
						function() {
							if (our_domain)
								domains_processing[our_domain]--;
						},
						function(progobj) {
							if (settings.replaceimgs_simple_progress) {
								var percent = progobj.loaded / progobj.total;
								progobj.total = 1;
								progobj.loaded = percent;
							}

							ip.update_progobj(our_id, progobj);
						}
					);
				} else {
					currently_processing--;
				}
			};

			var progressc_el;

			if (options.use_progressbar) {
				progressc_el = create_progress_el(true);
			}

			var domains = {};
			var domains_processing = {};
			var domains_lastrequest = {};
			var domains_timeout = {};
			var other = [];

			var total_imgs = imgs.length;

			for (var i = 0; i < imgs.length; i++) {
				// fixme: if find_source only returns null, it will "hang" (progress bar will never close)
				var source = find_source([imgs[i]], {links: options.support_plainlinks});
				if (!source) {
					total_imgs--;
					continue;
				}

				source._replace_id = i;

				if (!source.src) {
					other.push(source);
					continue;
				}

				var domain = source.src.match(/^https?:\/\/([^/]+)\//);
				if (!domain) {
					other.push(source);
					continue;
				}

				if (!(domain[1] in domains)) {
					domains[domain[1]] = [];
					domains_processing[domain[1]] = 0;
					domains_lastrequest[domain[1]] = 0;
					domains_timeout[domain[1]] = null;
				}

				domains[domain[1]].push(source);
			}

			if (options.use_progressbar) {
				ip = new ImpreciseProgress({
					cb: function(progobj) {
						update_progress_el(progressc_el, progobj.percent * final_progress, false);
					},
					elements_num: total_imgs
				});
			}

			var currently_processing = 1;
			next_img();
		}

		var get_replace_images_options = function(options?) {
			var base_options = {
				replace_imgs: settings.replaceimgs_replaceimgs,
				add_links: settings.replaceimgs_addlinks,
				replace_links: settings.replaceimgs_replacelinks,
				support_plainlinks: false,
				plainlink_replace_text: false,
				plainlink_replace_link: false,
				plainlink_replace_media: false,
				links_newtab: settings.replaceimgs_links_newtab,
				size_constraints: get_single_setting("replaceimgs_size_constraints"),
				replace_css: settings.replaceimgs_css,
				use_progressbar: true,
				browser_viewable: true
			};

			var plainlinks_option = get_single_setting("replaceimgs_plainlinks");
			if (plainlinks_option !== "none") {
				base_options.support_plainlinks = true;
				if (plainlinks_option === "replace_link_text") {
					base_options.plainlink_replace_text = true;
					base_options.plainlink_replace_link = true;
				} else if (plainlinks_option === "replace_media") {
					base_options.plainlink_replace_media = true;
				}
			}

			if (!options)
				options = {};

			for (var key in options) {
				base_options[key] = options[key];
			}

			return base_options;
		};

		var replace_images_full = function(options?) {
			var base_options = get_replace_images_options(options);
			return replace_images(base_options);
		};

		register_menucommand("Replace images", replace_images_full);

		var exit_custom_gallery = null;

		var setup_custom_gallery = function() {
			if (exit_custom_gallery)
				exit_custom_gallery();

			var base_maskel = document_createElement("div");
			set_important_style(base_maskel, "position", "absolute");
			set_important_style(base_maskel, "left", "0px");
			set_important_style(base_maskel, "top", "0px");
			set_el_all_initial(base_maskel);

			var mask_bgel = document_createElement("div");
			set_el_all_initial(mask_bgel);
			apply_styles(mask_bgel, settings.customgallery_bg_css, {force_important: true});
			set_important_style(mask_bgel, "pointer-events", "none");
			set_important_style(mask_bgel, "position", "fixed");
			set_important_style(mask_bgel, "left", "0px");
			set_important_style(mask_bgel, "top", "0px");
			set_important_style(mask_bgel, "height", "100%");
			set_important_style(mask_bgel, "width", "100%");
			set_important_style(mask_bgel, "z-index", maxzindex - 3);
			base_maskel.appendChild(mask_bgel);

			var mask_outlines_el = document_createElement("div");
			set_el_all_initial(mask_outlines_el);
			set_important_style(mask_outlines_el, "position", "absolute");
			set_important_style(mask_outlines_el, "pointer-events", "none");
			set_important_style(mask_outlines_el, "left", "0px");
			set_important_style(mask_outlines_el, "top", "0px");
			set_important_style(mask_outlines_el, "z-index", maxzindex - 2);
			base_maskel.appendChild(mask_outlines_el);

			var maskel = document_createElement("div");
			set_el_all_initial(maskel);
			set_important_style(maskel, "position", "fixed");
			set_important_style(maskel, "left", "0px");
			set_important_style(maskel, "top", "0px");
			set_important_style(maskel, "height", "100%");
			set_important_style(maskel, "width", "100%");
			set_important_style(maskel, "z-index", maxzindex);
			base_maskel.appendChild(maskel);

			set_add(exclude_find_els, maskel);

			var sources = [];
			var source_el_set = new_set();

			var _find_source = function(source) {
				for (let src of sources) {
					if (src.el === source.el)
						return src;
				}

				return null;
			};

			var add_source = function(source) {
				if (!source.el)
					return false;

				if (set_has(source_el_set, source.el))
					return _find_source(source) || source;

				sources.push(source);
				set_add(source_el_set, source.el);

				return source;
			};

			var remove_source = function(source) {
				let found_source = _find_source(source);
				if (found_source) {
					let index = array_indexof(sources, found_source);
					if (index >= 0)
						sources.splice(index, 1);
				}

				set_remove(source_el_set, source.el);
			};

			exit_custom_gallery = function() {
				if (alt_keydown_cb === our_keydown_cb)
					alt_keydown_cb = null;
				set_remove(exclude_find_els, maskel);
				base_maskel.parentElement.removeChild(base_maskel);

				exit_custom_gallery = null;
			};

			let our_keydown_cb = alt_keydown_cb = function(e) {
				let actions = [
					{
						key: settings.mouseover_close_key,
						action: exit_custom_gallery
					},
					{
						key: settings.customgallery_apply_key,
						action: function() {
							exit_custom_gallery();
							if (!sources.length)
								return;

							override_album = [];
							for (let source of sources) {
								override_album.push(source.el);
							}

							trigger_popup_with_source(sources[0], true);
						}
					}
				];

				for (let action of actions) {
					if (!trigger_complete(action.key))
						continue;

					action.action();
					return false;
				}
			};

			our_addEventListener(maskel, "click", function(e) {
				e.preventDefault();
				e.stopImmediatePropagation();
				e.stopPropagation();

				let point = [mouseX, mouseY];
				var els = find_els_at_point(point);
				var source = find_source(els, {point: point});
				if (!source || !source.el)
					return;

				source = add_source(source);

				source._real_el = source.el;
				if (source.picture)
					source._real_el = source.picture;

				if (source._outline_el) {
					// if _outline_el exists, then the source was already added previously

					// toggle
					remove_source(source);
					if (source._outline_el) {
						source._outline_el.parentElement.removeChild(source._outline_el);
					}

					return;
				}

				let rect = source._real_el.getBoundingClientRect();

				let outline_el = document_createElement("div");
				apply_styles(outline_el, settings.customgallery_outline_css, {force_important: true});
				set_important_style(outline_el, "position", "absolute");
				set_important_style(outline_el, "pointer-events", "none");
				set_important_style(outline_el, "z-index", maxzindex - 1);
				set_important_style(outline_el, "left", (rect.left + window.scrollX) + "px");
				set_important_style(outline_el, "top", (rect.top + window.scrollY) + "px");
				set_important_style(outline_el, "width", rect.width + "px");
				set_important_style(outline_el, "height", rect.height + "px");
				mask_outlines_el.appendChild(outline_el);
				source._outline_el = outline_el;
			}, {capture: true});

			document.documentElement.appendChild(base_maskel);
		};

		(function() {
			var added = false;
			var id = null;

			var update_button = function() {
				if (settings.customgallery_enable_button) {
					if (!added) {
						id = register_menucommand("Custom gallery", setup_custom_gallery);
						added = true;
					}
				} else {
					if (added) {
						unregister_menucommand(id);
						added = false;
					}
				}
			};

			update_button();

			var origfunc = settings_meta.customgallery_enable_button.onupdate;
			settings_meta.customgallery_enable_button.onupdate = function() {
				update_button();

				if (origfunc)
					return origfunc.apply(this, arguments);
			};
		})();

		var create_zip = function(files, foldername, cb, progresscb) {
			get_library("jszip", settings, do_request, function(lib) {
				if (!lib) return cb(null);

				var zip = new lib();

				var root = zip;
				if (foldername) {
					root = zip.folder(foldername);
				}

				for (var filename in files) {
					root.file(filename, files[filename]);
				}

				zip.generateAsync({type: "blob"}, function(prog_info) {
					progresscb(prog_info.percent / 100);
				}).then(function(data) {
					cb(data);
				}, function(err) {
					console_error(err);
					cb(null);
				});
			});
		};

		var send_to_jdownloader = function(got_objs, foldername, cb) {
			var do_jd_request = function(req) {
				req.headers = {
					Referer: "https://qsniyg.github.io/maxurl/"
				};

				do_request(req);
			};

			var jdcheck = function(cb) {
				do_jd_request({
					method: "GET",
					url: "http://127.0.0.1:9666/jdcheckjson",
					onload: function(resp) {
						if (resp.status !== 200) {
							console_error("Unable to connect to JDownloader", resp);
							return cb(false);
						} else {
							// ensure it's valid json
							try {
								JSON.parse(resp.responseText);
							} catch (e) {
								console_error(e);
								return cb(false);
							}

							return cb(true);
						}
					}
				});
			};

			var prepare_flashgots = function() {
				var referers = {};

				var referer_policy = get_single_setting("gallery_jd_referer");

				for (var i = 0; i < got_objs.length; i++) {
					var gobj = got_objs[i];
					if (!gobj)
						continue;

					var our_obj = {
						url: gobj.obj.url,
						filename: gobj.filename || "",
						desc: ""
					};

					var referer_key = "";
					var our_referer = null;

					if (gobj.obj.headers && referer_policy !== "never") {
						our_referer = headerobj_get(gobj.obj.headers, "referer") || null;
						if (our_referer) {
							our_obj.referer = our_referer;

							referer_key = our_referer;

							// batch referers by domain, hopefully avoiding package spam
							if (referer_policy === "domain") {
								referer_key = get_domain_from_url(referer_key);
							}
						}
					}

					if (!(referer_key in referers)) {
						referers[referer_key] = {
							referer: our_referer,
							urls: []
						};
					}

					referers[referer_key].urls.push(our_obj);
				}

				var final_queries = [];
				for (var key in referers) {
					var referer_obj = referers[key];

					var urls = [];
					var descs = [];
					var fnames = [];

					array_foreach(referer_obj.urls, function(url) {
						// thanks to Jiaz from JDownloader for the directhttp trick
						urls.push("directhttp://" + url.url);

						fnames.push(url.fnames);
						descs.push(url.desc);
					});

					var query = {
						urls: urls.join("\n"),
						descriptions: descs.join("\n"),
						fnames: fnames.join("\n")
					};

					if (foldername)
						query.package = foldername;

					//if (referer_obj.referer)
					query.referer = referer_obj.referer || "";

					if (settings.gallery_jd_autostart)
						query.autostart = "1";

					final_queries.push(stringify_queries(query, true));
				}

				return final_queries;
			};

			jdcheck(function(ok) {
				if (!ok)
					return cb(false);

				var queries = prepare_flashgots();
				var queries_done = 0;
				var total_queries = queries.length;
				var query_error = false;

				array_foreach(queries, function(query) {
					do_jd_request({
						method: "GET",
						url: "http://127.0.0.1:9666/flashgot?" + query,
						onload: function(resp) {
							queries_done++;
							if (query_error)
								return;

							if (resp.status !== 200) {
								console_error("Error with flashgot api", resp);
								query_error = true;
								return cb(false);
							}

							if (queries_done >= total_queries)
								cb(true);
						}
					});
				});
			});
		};

		var download_album = function() {
			var files = {};
			var urls = new_set();
			var got_objs = [];
			var infos = {};
			var failed_infos = [];
			var filename = null;

			var download_method = get_single_setting("gallery_download_method");

			var set_zip_filename = function(obj) {
				if (filename || !obj) return;

				var our_vars = deepcopy(obj.format_vars);
				our_vars.ext = ".zip";

				// got_objs is used because files is not populated for jdownloader
				our_vars.items_amt = Object.keys(got_objs).length.toString();//Object.keys(files).length.toString();
				//our_vars.filename = our_vars.filename_noext + our_vars.ext;
				filename = get_filename_from_format(settings.gallery_zip_filename_format, our_vars);

				if (!filename) filename = "download";
				if (!/\.zip$/i.test(filename)) filename += ".zip";
			};

			var get_trunc_url = function(url) {
				if (/^https?:\/\//i.test(url)) return url;
				return url.substr(0, 1000); // to avoid huge data urls
			};

			var get_host_info = function() {
				var info = {};

				info.url = window_location;
				try {
					var our_window = get_window();

					var href1 = our_window.location.href;
					if (href1 !== window_location) {
						info.url_orig = window_location;
						info.url = href1;
					}

					info.title = document.title;

					info.download_time = new Date().toString();
				} catch (e) {
					console_error(e);
				}

				return info;
			};

			var get_failed_info = function(source) {
				var info = {};

				info.num_in_gallery = source._replace_id + 1;

				var source_src = source.src;
				if (source_src) info.url = get_trunc_url(source_src);

				return info;
			};

			var get_info_for_file = function(filename, obj, origurl, source) {
				var info = {};

				info.num_in_gallery = source._replace_id + 1;

				info.download_url = get_trunc_url(origurl);
				if (obj.headers) info.download_headers = obj.headers;

				var source_src = source.src;
				if (source_src && source_src !== origurl) {
					info.thumb_url = get_trunc_url(source_src);
				}

				info.filename = filename;
				if (obj.filename !== filename) {
					info.orig_filename = obj.filename;
				}

				if (obj.filesize) info.filesize = obj.filesize;

				if (obj.extra) {
					obj_foreach(obj.extra, function(key, value) {
						if (value !== null && value !== "")
							info["extra_" + key] = value;
					});
				}

				return info;
			};

			var unix_to_dos = function(txt) {
				return txt.replace(/\r*\n/g, "\r\n");
			};

			var get_info_file = function() {
				var header = get_host_info();

				var file = [];
				file.push(" --- Page info ---", "");
				file.push(JSON_stringify(header, null, "\t"));
				file.push("", " --- Files ---", "");

				for (var i = 0; i < got_objs.length; i++) {
					if (!got_objs[i] || !got_objs[i].filename) continue;
					var filename = got_objs[i].filename;

					file.push(filename);
					file.push(JSON_stringify(infos[i], null, "\t"));
					file.push("");
				}

				if (failed_infos.length) {
					file.push("", " --- Failed ---", "");

					array_foreach(failed_infos, function(info) {
						file.push(JSON_stringify(info, null, "\t"));
						file.push("");
					});
				}

				return unix_to_dos(file.join("\n"));
			};

			var get_first_obj = function() {
				for (var i = 0; i < got_objs.length; i++) {
					if (!got_objs[i] || !got_objs[i].obj) continue;
					return got_objs[i].obj;
				}
			};

			var add_file = function(data, our_source, progresscb, cb) {
				if (!data || !data.data || !data.data.obj) {
					console_error("Invalid data", data, our_source);
					return cb();
				}

				var src = data.data.obj.url;
				if (data.data.resp) {
					if (!data.data.resp.finalUrl) {
						console_error("Unable to load image from", data, our_source);
						return cb();
					}

					src = data.data.resp.finalUrl;
				}

				// fixme: if img is blob, we need to free it
				if (data.data.img) {
					// otherwise it'll both use bandwidth and play the audio
					if (data.data.img.tagName === "VIDEO") {
						data.data.img.pause();
					}

					src = get_img_src(data.data.img);
				}

				var obj = data.data.obj || {};
				var origurl = obj.url;
				var filename = null; // to be filled by fill_filename
				//obj = overlay_object(obj, { url: src });

				if (set_has(urls, origurl)) {
					return cb();
				} else {
					set_add(urls, origurl);
				}

				var fill_filename = function(use_download) {
					fill_obj_filename(obj, origurl, data.data.respdata);
					filename = obj.filename;

					// this should hopefully not happen
					if (use_download && !filename)
						filename = "download";

					if (filename && filename in files) {
						var i = 1;

						var new_filename;
						var splitted = url_basename(filename, {split_ext: true});
						do {
							new_filename = splitted[0] + " (" + (i++) + ")";
							if (splitted[1]) {
								new_filename += "." + splitted[1];
							}
						} while (new_filename in files);

						filename = new_filename;
					}

					return filename;
				};

				var final_cb = function() {
					if (settings.gallery_zip_add_info_file) {
						infos[our_source._replace_id] = get_info_for_file(filename, obj, origurl, our_source);
					}

					got_objs[our_source._replace_id] = {obj: obj, filename: filename};
					cb();
				};

				if (download_method === "jdownloader") {
					fill_filename(false);
					final_cb();
					return;
				}

				// todo: some kind of infoobj_to_requestobj function
				request_chunked({
					url: src,
					headers: obj.headers
				}, {
					onload: function(resp) {
						fill_filename(true);

						files[filename] = resp.data;
						final_cb();
					},
					onprogress: progresscb
				});
			};

			var process_gallery_els = function(els) {
				replace_images_full({
					images: els,
					all_els_ok: true,
					browser_viewable: false,
					replace_image_func: function(options, our_source, cb, domain_processed_cb, progress_cb) {
						//console_log(our_source);

						var gffs_options:GFFS_Options = {
							automatic: true,
							multi: true,
							use_head: false,
							incomplete_image: false,
							incomplete_video: true, // hack to force request_chunked
							deny_nondirect_delivery: true,
							deny_cache: true,
							null_if_no_change: !settings.gallery_download_unchanged,
							use_last_pos: false,
							progress_cb: progress_cb,
							browser_viewable: false
						};

						if (download_method === "jdownloader") {
							gffs_options.use_head = true;
							gffs_options.incomplete_image = true;
							gffs_options.incomplete_video = true;
						}

						get_final_from_source(our_source, gffs_options, function (source_imu, source, processing, data) {
							domain_processed_cb();

							if (!data) {
								if (typeof source === "undefined" && !settings.gallery_download_unchanged) {
									console_warn("Not downloading unchanged image", our_source);
								} else {
									// source is undefined for non-existing urls too
									console_error("Unable to download", source, our_source);

									if (settings.gallery_zip_add_info_file) {
										failed_infos.push(get_failed_info(our_source));
									}
								}

								return cb();
							} else {
								add_file(data, our_source, function(progobj) {}, cb);
							}
						});
					},
					finalcb: function(onprogress) {
						if ((download_method === "zip" && !Object.keys(files).length) ||
							!got_objs.length) {
							console_error("No files!");
							onprogress(1);
							return;
						}

						set_zip_filename(get_first_obj());

						filename = filename || "download.zip";

						var foldername = filename.replace(/\.zip$/i, "");

						var zip_foldername = null;
						if (settings.gallery_zip_add_tld) {
							zip_foldername = foldername;
						}

						if (settings.gallery_zip_add_info_file) {
							files["info.txt"] = get_info_file();
						}

						start_waiting();
						if (download_method === "jdownloader") {
							send_to_jdownloader(got_objs, foldername, function(ok) {
								onprogress(1);

								if (!ok) {
									cursor_not_allowed();
								} else {
									stop_waiting();
								}
							});
						} else {
							create_zip(files, zip_foldername, function(data) {
								onprogress(1);

								if (!data) {
									cursor_not_allowed();
									return;
								} else {
									stop_waiting();
								}

								do_blob_download(data, filename);
							}, onprogress);
						}
					},
					finalcb_progress: 0.1
				});
			};

			// fetching the gallery elements can take time if it's a large gallery, so let the user know we have received input
			// no, don't do this (yet)! it'll take longer to update the css of every element than it will to fetch the gallery elements (tested with 5000)
			//start_waiting();
			get_gallery_elements(function(els) {
				//stop_waiting();

				process_gallery_els(els);
			});
		};

		var generate_random_class = function(name) {
			return "imu-" + get_random_text(10) + "-" + name;
		};

		var highlightimgs_styleel = null;
		var highlightimgs_classname = generate_random_class("highlight");

		var create_highlight_styleel = function() {
			if (highlightimgs_styleel || !/^text\//.test(document.contentType))
				return;

			highlightimgs_styleel = document_createElement("style");
			document.documentElement.appendChild(highlightimgs_styleel);

			update_highlight_styleel();
		};

		var update_highlight_styleel = function() {
			create_highlight_styleel();

			if (highlightimgs_styleel) {
				highlightimgs_styleel.innerText = "." + highlightimgs_classname + "{" + get_styletag_styles(settings.highlightimgs_css) + "}";
			}
		};

		(function() {
			var oldfunc = settings_meta.highlightimgs_css.onupdate;
			settings_meta.highlightimgs_css.onupdate = function() {
				update_highlight_styleel();

				if (oldfunc)
					return oldfunc.apply(this, arguments);
			};
		})();

		var apply_highlight_style = function(target) {
			create_highlight_styleel();
			target.classList.add(highlightimgs_classname);
		};

		var remove_highlight_style = function(target) {
			target.classList.remove(highlightimgs_classname);
		}

		var check_highlightimgs_valid_image = function(el) {
			var src = get_img_src(el);
			if (!is_valid_src(src, is_video_el(el)) || (el.tagName === "A" && !looks_like_valid_link(src, el)))
				return false;
			return true;
		};

		var get_highlightimgs_valid_image = function(el) {
			// TODO: dynamic attribute name
			if (el.hasAttribute("data-imu-valid")) {
				return !!parse_boolean(el.getAttribute("data-imu-valid"));
			}

			var valid = check_highlightimgs_valid_image(el);
			el.setAttribute("data-imu-valid", valid + "");
			return valid;
		};

		var get_highlightimgs_supported_image = function(el) {
			// TODO: dynamic attribute name
			if (el.hasAttribute("data-imu-supported")) {
				return !!parse_boolean(el.getAttribute("data-imu-supported"));
			}

			var supported = check_highlightimgs_supported_image(el);
			el.setAttribute("data-imu-supported", supported + "");
			return supported;
		};

		var auto_highlighted_imgs = [];
		var highlight_images = function(options?) {
			if (currenttab_is_image() && settings.mouseover_exclude_imagetab)
				return;

			if (!options) {
				options = {}
			}

			var images = options.images;
			if (images === void 0) {
				images = get_all_valid_els_link();
			}

			if (!images.length)
				return;

			for (var i = 0; i < images.length; i++) {
				if (!get_highlightimgs_valid_image(images[i]))
					continue;

				let supported = !settings.highlightimgs_onlysupported;

				if (settings.highlightimgs_onlysupported) {
					supported = get_highlightimgs_supported_image(images[i]);
				}

				if (!options.hoveronly) {
					if (supported) {
						if (options.is_auto && array_indexof(auto_highlighted_imgs, images[i]) < 0) {
							auto_highlighted_imgs.push(images[i]);
						}

						apply_highlight_style(images[i]);
					} else {
						remove_highlight_style(images[i]);
					}
				}
			}
		};

		(function() {
			var added = false;
			var id = null;

			var update_button = function() {
				if (settings.highlightimgs_enable) {
					if (!added) {
						id = register_menucommand("Highlight images", highlight_images);
						added = true;
					}
				} else {
					if (added) {
						unregister_menucommand(id);
						added = false;
					}
				}
			};

			update_button();

			var origfunc = settings_meta.highlightimgs_enable.onupdate;
			settings_meta.highlightimgs_enable.onupdate = function() {
				update_button();

				if (origfunc)
					return origfunc.apply(this, arguments);
			};
		})();

		var popup_mouse_head = function() {
			if (delay_handle_triggering)
				return false;

			var enabledisable_toggle = get_single_setting("mouseover_trigger_enabledisable_toggle");
			if (trigger_complete(settings.mouseover_trigger_prevent_key)) {
				if (enabledisable_toggle === "disable")
					return false;
			} else {
				if (enabledisable_toggle === "enable")
					return false;
			}

			popup_trigger_reason = "mouse";
			return true;
		};

		var image_mouseover = function(e) {
			if (currenttab_is_image() && settings.mouseover_exclude_imagetab)
				return;

			if (get_single_setting("highlightimgs_auto") === "hover" && get_highlightimgs_valid_image(e.target)) {
				var supported = !settings.highlightimgs_onlysupported;
				if (!supported) {
					supported = get_highlightimgs_supported_image(e.target);
				}

				if (supported) {
					if (array_indexof(auto_highlighted_imgs, e.target) < 0)
						auto_highlighted_imgs.push(e.target);
					apply_highlight_style(e.target);
				}
			}

			if (mouseover_mouse_enabled() && settings.mouseover_trigger_mouseover && !delay_handle && !should_exclude_imagetab()) {
				delay_el = e.target;
				update_mouse_from_event(e);

				delay_handle = setTimeout(function() {
					delay_el = null;

					if (delay_handle) {
						clearTimeout(delay_handle);
						delay_handle = null;
					}

					if (!popup_mouse_head())
						return;

					// TODO: make configurable
					if (false) {
						var source = find_source([e.target]);

						if (source && get_physical_popup_el(source.el) !== last_popup_el) {
							trigger_popup_with_source(source);
						}
					} else {
						trigger_popup();
					}
				}, delay * 1000);
			}
		};

		var image_mouseout = function(e) {
			if (get_single_setting("highlightimgs_auto") === "hover" && get_highlightimgs_valid_image(e.target)) {
				remove_highlight_style(e.target);
			}

			if (mouseover_mouse_enabled() && settings.mouseover_trigger_mouseover && delay_handle) {
				if (delay_el === e.target) {
					clearTimeout(delay_handle);
					delay_handle = null;
				}
			}
		};

		function on_new_images(images) {
			var highlight = get_single_setting("highlightimgs_auto");
			if (highlight === "always" || highlight === "hover")
				highlight_images({images: images, hoveronly: highlight === "hover", is_auto: true});

			for (var i = 0; i < images.length; i++) {
				// apparently this isn't needed to ensure no duplicate event listeners?
				our_removeEventListener(images[i], "mouseover", image_mouseover);
				our_removeEventListener(images[i], "mouseout", image_mouseout);

				our_addEventListener(images[i], "mouseover", image_mouseover);
				our_addEventListener(images[i], "mouseout", image_mouseout);
			}

			if (settings.replaceimgs_auto)
				replace_images_full({images: images, use_progressbar: false, use_elcache: true});
		};

		(function() {
			if (is_suspended())
				return;

			// TODO: allow this to be automatically updated
			if (!host_filter(window.location.href))
				return;

			var observer;

			var observe_options = {childList: true, subtree: true, attributes: true};

			var new_mutationobserver = function() {
				return new MutationObserver(function(mutations, observer) {
					var images = [];

					var add_nodes = function(nodes) {
						for (var i = 0; i < nodes.length; i++) {
							if (is_img_pic_vid_link(nodes[i])) {
								images.push(nodes[i]);
							}

							if (nodes[i].children) {
								add_nodes(nodes[i].children);
							}
						}
					};

					for (var i = 0; i < mutations.length; i++) {
						var mutation = mutations[i];

						if (mutation.addedNodes) {
							add_nodes(mutation.addedNodes);
						}

						if (mutation.target && mutation.type === "attributes") {
							if (mutation.attributeName === "src" || mutation.attributeName === "href" || mutation.attributeName === "srcset") {
								add_nodes([mutation.target]);
							}
						}
					}

					if (images.length > 0) {
						on_new_images(images);
					}
				});
			}

			var observe = function() {
				if (is_suspended())
					return;

				on_new_images(get_all_valid_els_link());

				if (!observer)
					return;
				observer.observe(document, observe_options);
			};

			var remove_all_highlights = function() {
				for (var i = 0; i < auto_highlighted_imgs.length; i++) {
					remove_highlight_style(auto_highlighted_imgs[i]);
				}

				auto_highlighted_imgs = [];
			}

			var disconnect = function() {
				remove_all_highlights();

				if (!observer)
					return;

				observer.disconnect();
			};
			termination_hooks.push(disconnect);

			var needs_observer = function() {
				var highlight = get_single_setting("highlightimgs_auto");
				return highlight === "always" || highlight === "hover" || settings.replaceimgs_auto || (mouseover_mouse_enabled() && settings.mouseover_trigger_mouseover);
			};

			var create_mutationobserver = function() {
				try {
					// In case the browser doesn't support MutationObservers
					observer = new_mutationobserver();
				} catch (e) {
					console_warn(e);
				}

				if (needs_observer()) {
					observe();
				}
			};

			create_mutationobserver();

			var update_highlightimgs_func = function() {
				if (needs_observer()) {
					if (get_single_setting("highlightimgs_auto") !== "always") {
						remove_all_highlights();
					}

					observe();
				} else {
					disconnect();
				}
			};

			// replaceimgs_auto is intentionally not added here due to the warning
			var orig_highlightfunc = settings_meta.highlightimgs_auto.onupdate;
			settings_meta.highlightimgs_auto.onupdate = function() {
				if (orig_highlightfunc)
					orig_highlightfunc();

				update_highlightimgs_func();
			};

			var orig_imuenabledfunc = settings_meta.imu_enabled.onupdate;
			settings_meta.imu_enabled.onupdate = function() {
				if (orig_imuenabledfunc)
					orig_imuenabledfunc.apply(this, arguments);

				if (settings.imu_enabled) {
					update_highlightimgs_func();
				} else {
					disconnect();
				}
			};
		})();

		var get_popup_media_el = function() {
			var imgels = popups[0].getElementsByTagName("video");
			if (imgels.length === 0)
				imgels = popups[0].getElementsByTagName("img");

			if (imgels.length > 0)
				return imgels[0];
			else
				return null;
		};

		var get_popup_media_url = function() {
			var el = get_popup_media_el();

			if (el)
				return el.src;
			else
				return null;
		};

		var download_popup_image = function() {
			do_download(popup_obj, popup_obj.filename, popup_contentlength);
		};

		var download_popup_media = function() {
			if (popup_obj.media_info && popup_obj.media_info.delivery && settings.enable_stream_download) {
				start_waiting();

				get_download_urls_from_infoobj(popup_obj, function(urls) {
					if (!urls) {
						cursor_not_allowed();
						return;
					}

					//console_log("urls", urls);

					// todo: only request ffmpeg if necessary
					get_ffmpeg(function(ffmpeg) {
						if (!ffmpeg) {
							cursor_not_allowed();
							return;
						}

						stop_waiting();
						var progress_el = create_progress_el(true);

						var last_console_progress = 0;
						download_playlist_urls(popup_obj, urls, function(progobj) {
							var now = Date.now();
							if (now - last_console_progress > 50) {
								last_console_progress = now;

								var percent = format_number_decimal(progobj.percent * 100, 2);
								var loaded_bytes = get_bytes_unit(progobj.loaded);
								var total_bytes = get_bytes_unit(progobj.total);
								var accurate = progobj.total_accurate ? "" : "~";

								console_log(loaded_bytes + " / " + accurate + total_bytes + " (" + percent + "%)");
							}

							update_progress_el(progress_el, progobj.percent * 0.9, true);
						}, function(data) {
							//console_log("final data", data);

							ffmpeg_join(ffmpeg, data, function(percent) {
								update_progress_el(progress_el, 0.9 + (percent * 0.1), true);
							}, function(filename) {
								update_progress_el(progress_el, 1, true);

								//console_log(filename);

								var data = ffmpeg.FS("readFile", filename);

								new_blob(data, function(blob) {
									var out_ext = url_basename(filename, {split_ext: true})[1];
									var out_filename = url_basename(popup_obj.filename || "download", {split_ext: true, known_ext: true})[0] + "." + out_ext;

									do_blob_download(blob, out_filename, function() {
										ffmpeg.FS("unlink", filename);
									});
								});
							});
						});
					});
				});
			} else {
				download_popup_image();
			}
		};

		var get_popup_video = function() {
			var videoel = popups[0].getElementsByTagName("video");

			// TODO: rename this function to get_popup_stream
			if (!videoel || videoel.length === 0) {
				videoel = popups[0].getElementsByTagName("audio");
			}
			if (!videoel || videoel.length === 0) {
				return null;
			}

			return videoel[0];
		};

		var seek_popup_video = function(leftright, amount) {
			var timemul = leftright ? -1 : 1;

			if (typeof amount === "undefined")
				amount = settings.mouseover_video_seek_amount;

			var time = timemul * amount;

			var videoel = get_popup_video();
			if (!videoel)
				return;

			videoel.currentTime += time;
		};

		var framestep_popup_video = function(leftright) {
			var videoel = get_popup_video();
			if (!videoel)
				return;

			videoel.pause();

			seek_popup_video(leftright, 1.0 / settings.mouseover_video_framerate);
		};

		var popup_video_speed = function(downup) {
			var videoel = get_popup_video();
			if (!videoel)
				return;

			if (typeof downup !== "number") {
				var amount = settings.mouseover_video_speed_amount;
				if (downup === true)
					amount = -amount;

				videoel.playbackRate += amount;
			} else {
				videoel.playbackRate = downup;
			}
		};

		var popup_video_volume = function(downup) {
			var videoel = get_popup_video();
			if (!videoel)
				return;

			if (typeof downup !== "number") {
				var amount = settings.mouseover_video_volume_change_amt;
				if (downup === true)
					amount = -amount;

				var new_volume = videoel.volume + (amount / 100.);
				new_volume = Math_min(Math_max(new_volume, 0), 1);

				videoel.volume = new_volume;
			} else {
				videoel.volume = downup;
			}
		};

		var toggle_video_muted = function() {
			var videoel = get_popup_video();
			if (!videoel)
				return;

			videoel.muted = !videoel.muted;
		};

		var toggle_video_controls = function() {
			var videoel = get_popup_video();
			if (!videoel)
				return;

			if (videoel.getAttribute("controls") === "controls") {
				videoel.removeAttribute("controls");
			} else {
				videoel.setAttribute("controls", "controls");
			}
		};

		var play_video = function(el) {
			try {
				el.play();
			} catch (e) {
				console_warn("Unable to autoplay", el, e);
			}
		};

		var toggle_video_playing = function() {
			var videoel = get_popup_video();
			if (!videoel)
				return;

			if (videoel.paused) {
				play_video(videoel);
			} else {
				videoel.pause();
			}
		};

		var toggle_popup_ui = function() {
			popup_createui_func(true, "toggle");
		};

		var is_fullscreen = function() {
			return document.fullscreenElement !== null || document.fullscreen;
		};

		var is_popup_fullscreen = function() {
			return is_fullscreen() && popup_is_fullscreen;
		};

		var popup_set_fullscreen = function() {
			var media_el = get_popup_media_el();

			media_el.requestFullscreen().then(function(e) {
				popup_is_fullscreen = true;
			}, function(e) {
				console_error("Error loading fullscreen", e);
			});
		};

		var exit_fullscreen = function() {
			document.exitFullscreen();
			popup_is_fullscreen = false;
		};

		var popup_toggle_fullscreen = function() {
			if (!is_fullscreen()) {
				popup_set_fullscreen();
			} else {
				exit_fullscreen();
			}
		};

		var popup_active = function() {
			return popups_active && popup_el;
		};

		var can_use_hold_key = function() {
			if (!popups_active)
				return false;

			if (popup_trigger_reason !== "mouse") {
				var auto_close = settings.mouseover_auto_close_popup && settings.mouseover_auto_close_popup_time;
				var close_mouseout = get_close_need_mouseout();

				if (!auto_close && !close_mouseout) return false;
			}

			return settings.mouseover_use_hold_key;
		};

		var update_popup_hold = function() {
			if (!popups_active)
				return;

			var hold_zoom = get_single_setting("popup_hold_zoom");
			if (popup_update_zoom_func && hold_zoom !== "none") {
				if (popup_hold) {
					popup_update_zoom_func(hold_zoom);
				} else {
					popup_update_zoom_func("last");
				}
			}

			if (popup_update_pos_func && settings.mouseover_hold_position_center) {
				var newpos = popup_update_pos_func(mouseX, mouseY, true);
				popups[0].style.top = newpos[1] + "px";
				popups[0].style.left = newpos[0] + "px";
			}

			popup_hold_func();
		};

		var toggle_popup_hold = function() {
			popup_hold = !popup_hold;
			clear_resetpopup_timeout();

			if (!popup_hold && (can_close_popup[1] || settings.mouseover_hold_close_unhold)) {
				action_handler({type: "resetpopups"});
			} else {
				update_popup_hold();
			}
		};

		var get_video_screenshot = function(video, cb) {
			var canvas = document_createElement("canvas");
			canvas.width = video.videoWidth;
			canvas.height = video.videoHeight;

			var context = canvas.getContext("2d");
			context.drawImage(video, 0, 0, canvas.width, canvas.height);

			var mime = "image/png";
			var screenshot_format = get_single_setting("popup_video_screenshot_format");
			if (screenshot_format === "jpg") mime = "image/jpeg";

			return cb(get_canvas_src(canvas, mime));
		};

		var screenshot_video = function() {
			var videoel = get_popup_video();
			if (!videoel)
				return;

			get_video_screenshot(videoel, function(data) {
				if (!data) {
					console_error("Unable to screenshot video");
					cursor_not_allowed();
					return;
				}

				var our_vars = deepcopy(popup_obj.format_vars);
				our_vars.is_screenshot = {usable: true};
				our_vars.ext = ".png";
				if (get_single_setting("popup_video_screenshot_format") === "jpg") {
					our_vars.ext = ".jpg";
				}
				our_vars.filename = our_vars.filename_noext + our_vars.ext;
				var screenshot_filename = get_filename_from_format(settings.filename_format, our_vars);

				do_download({
					url: data
				}, screenshot_filename);
			});
		};

		var action_handler = function(action) {
			if (_nir_debug_) {
				console_log("action_handler", action);
			}

			if (action.needs_popup && !popup_active())
				return;

			switch (action.type) {
				case "resetpopups":
					resetpopups();
					return true;
				case "replace_images":
					replace_images_full();
					return true;
				case "highlight_images":
					highlight_images();
					return true;
				case "custom_gallery":
					setup_custom_gallery();
					return true;
				case "trigger_popup":
					if (action.trigger === "keyboard") {
						popup_trigger_reason = "keyboard";
					}

					trigger_popup();
					return true;
				case "gallery_prev":
					trigger_gallery(-1);
					return true;
				case "gallery_next":
					trigger_gallery(1);
					return true;
				case "download":
					download_popup_media();
					return true;
				case "open_in_new_tab":
					open_in_tab_imu(popup_obj, action.background_tab);
					return true;
				case "rotate_left":
					rotate_gallery(-90);
					return true;
				case "rotate_right":
					rotate_gallery(90);
					return true;
				case "flip_horizontal":
					flip_gallery(false);
					return true;
				case "flip_vertical":
					flip_gallery(true);
					return true;
				case "zoom_in":
					popup_zoom_func("incremental", -1);
					return true;
				case "zoom_out":
					popup_zoom_func("incremental", 1);
					return true;
				case "zoom_full":
					popup_zoom_func("fitfull", -1);
					return true;
				case "zoom_fit":
					popup_zoom_func("fitfull", 1);
					return true;
				case "fullscreen":
					popup_toggle_fullscreen();
					return true;
				case "seek_left":
					seek_popup_video(true);
					return true;
				case "seek_right":
					seek_popup_video(false);
					return true;
				case "frame_left":
					framestep_popup_video(true);
					return true;
				case "frame_right":
					framestep_popup_video(false);
					return true;
				case "speed_down":
					popup_video_speed(true);
					return true;
				case "speed_up":
					popup_video_speed(false);
					return true;
				case "reset_speed":
					popup_video_speed(1);
					return true;
				case "volume_up":
					popup_video_volume(false);
					return true;
				case "volume_down":
					popup_video_volume(true);
					return true;
				case "toggle_mute":
					toggle_video_muted();
					return true;
				case "toggle_controls":
					toggle_video_controls();
					return true;
				case "toggle_play_pause":
					toggle_video_playing();
					return true;
				case "open_options":
					open_in_tab_imu({url: get_options_page()}, false);
					return true;
				case "open_orig_page":
					if (popup_obj && popup_obj.extra && popup_obj.extra.page) {
						open_in_tab_imu({url: popup_obj.extra.page}, false);
					} else {
						console_log("Unable to find original page for", popup_obj);
					}
					return true;
				case "hold":
					update_popup_hold();
					return true;
				case "toggle_hold":
					toggle_popup_hold();
					return true;
				case "toggle_ui":
					toggle_popup_ui();
					return true;
				case "copy_link":
					if (popup_obj && popup_obj.url) {
						clipboard_write_link(popup_obj.url, function(success) {
							if (!success) console_warn("Unable to write url to clipboard:", popup_obj.url);
						});
					} else {
						console_warn("Popup not open?");
					}
					return true;
				case "screenshot_video":
					screenshot_video();
					return true;
				case "download_gallery":
					download_album();
					return true;
			}

			return false;
		};

		var action_remote = function(actions) {
			// use can_use_remote instead of can_iframe_popout because this doesn't necessarily pop out of iframes
			if (can_use_remote()) {
				var recipient = "top";
				var has_mouse = true;

				if (!is_in_iframe) {
					recipient = mouse_frame_id;
					if (recipient === "top") {
						has_mouse = false;

						if (popup_el_remote) {
							recipient = popup_el_remote;
						} else {
							return;
						}
					}
				}

				//console_log(deepcopy(actions));
				for (var i = 0; i < actions.length; i++) {
					if (!has_mouse && actions[i].requires_mouse) {
						actions.splice(i, 1);
						i--;
					}
				}

				if (actions.length > 0) {
					remote_send_message(recipient, {
						type: "action",
						data: actions
					});
				}
			}
		};

		var inputels_cache = new IMUCache();

		var is_inputel = function(el) {
			if (el.tagName === "TEXTAREA")
				return true;

			if (el.tagName === "INPUT") {
				if (!el.hasAttribute("type") || el.getAttribute("type") === "text") {
					return true;
				}
			}

			do {
				if (el.hasAttribute("contenteditable")) {
					return true;
				}
			} while (el = el.parentElement);

			return false;
		};

		var update_contextmenu_pos = function(event) {
			mouseContextX = event.clientX;
			mouseContextY = event.clientY;

			mouseAbsContextX = event.pageX;
			mouseAbsContextY = event.pageY;
		};

		var do_event_return = function(event, retval) {
			if (retval === false) {
				try {
					event.preventDefault();
					event.stopImmediatePropagation();
					event.stopPropagation();
				} catch (e) {}
			}

			return retval;
		};

		// https://github.com/qsniyg/maxurl/issues/680
		// contextmenu and mousedown are both run for right click, same timeStamp
		var event_cache = new IMUCache();
		var get_event_cache_key = function(event) {
			var down = true;
			if (event.type === "mouseup" || event.type === "keyup") down = false;

			var keystrs = get_keystrs_map(event, down);

			var keystrs_arr = [];
			for (var key in keystrs) {
				keystrs_arr.push(key + ":" + keystrs[key]);
			}

			return down + " " + keystrs_arr.join(",") + " " + event.timeStamp;
		};

		var alt_keydown_cb = null;
		var keydown_cb = function(event) {
			// otherwise rebinding the trigger key will fail
			if (is_options_page)
				return;

			nir_debug("input", "keydown_cb", event);

			if (!mouseover_base_enabled())
				return;

			if (event.type === "wheel" && chord_is_only_wheel(current_chord))
				return;

			if (event.type === "keydown") {
				// thanks to lnp5131 on github: https://github.com/qsniyg/maxurl/issues/415#issuecomment-684847125
				// it seems that even keys like control will cause a repeat under certain configurations
				if (event.repeat)
					return;

				if (editing_text)
					return;

				if (settings.disable_keybind_when_editing && event.target) {
					var is_bad = inputels_cache.get(event.target);
					if (is_bad === void 0) {
						is_bad = is_inputel(event.target);
						inputels_cache.set(event.target, is_bad, 60);
					}

					if (is_bad === true) {
						return;
					}
				}
			}

			var ret = void 0;
			var actions = [];

			update_chord(event, true);

			var event_cache_key = get_event_cache_key(event);
			if (event_cache.has(event_cache_key)) {
				return do_event_return(event, event_cache.get(event_cache_key));
			}

			if (is_extension && settings.extension_contextmenu && event.type === "mousedown") {
				// https://github.com/qsniyg/maxurl/issues/679
				if (trigger_complete(["shift", "button2"])) {
					update_contextmenu_pos(event);
				}
			}

			if (alt_keydown_cb) {
				ret = alt_keydown_cb(event);
				if (ret === false)
					return do_event_return(event, ret);
			}

			if (settings.mouseover) {
				if (get_single_setting("mouseover_trigger_behavior") === "keyboard") {
					var triggers = [settings.mouseover_trigger_key];

					for (var i = 0; i < num_profiles; i++) {
						triggers.push(settings["mouseover_trigger_key_t" + (i + 2)]);
					}

					array_foreach(triggers, function(trigger, i) {
						if (!event_in_chord(event, trigger)) return;

						if (trigger_complete(trigger) && !popups_active) {
							// clear timeout so that all/any close behavior works
							current_chord_timeout = {};
							if (!delay_handle) {
								actions.push({
									requires_mouse: true,
									type: "trigger_popup",
									trigger: "keyboard"
								});

								ret = false;
								release_ignore = trigger;
							}

							trigger_id = i ? (i + 1) : null;

							if (get_tprofile_setting("mouseover_open_behavior") !== "popup") {
								// especially relevant for new tab
								clear_chord();
							}
						}

						var close_behavior = get_close_behavior();
						if (close_behavior === "all" || (close_behavior === "any" && trigger_complete(trigger))) {
							can_close_popup[0] = false;
						}
					});
				}
			}

			if (settings.replaceimgs_enable_keybinding && trigger_complete(settings.replaceimgs_keybinding)) {
				actions.push({type: "replace_images"});

				ret = false;
				release_ignore = settings.replaceimgs_keybinding;
			}

			if (settings.highlightimgs_enable_keybinding && trigger_complete(settings.highlightimgs_keybinding)) {
				actions.push({type: "highlight_images"});

				ret = false;
				release_ignore = settings.highlightimgs_keybinding;
			}

			if (settings.customgallery_enable_keybinding && trigger_complete(settings.customgallery_keybinding)) {
				actions.push({type: "custom_gallery"});

				ret = false;
				release_ignore = settings.customgallery_keybinding;
			}


			// don't run if another function above was already triggered (e.g. when close is bound to the same key as trigger)
			if (settings.mouseover && ret !== false) {
				var is_popup_active = popup_el_remote || (popup_active());

				var keybinds = [
					{
						key: settings.mouseover_close_key,
						action: {type: "resetpopups"}
					},
					{
						key: settings.mouseover_gallery_prev_key,
						action: {type: "gallery_prev"},
						requires: settings.mouseover_enable_gallery
					},
					{
						key: settings.mouseover_gallery_next_key,
						action: {type: "gallery_next"},
						requires: settings.mouseover_enable_gallery
					},
					{
						key: settings.mouseover_download_key,
						// Clear the chord because keyup might not be called due to the save dialog popup
						clear: true,
						action: {type: "download"}
					},
					{
						key: settings.mouseover_open_new_tab_key,
						// Clear the chord because opening in a new tab will not release the keys
						clear: true,
						action: {type: "open_in_new_tab"}
					},
					{
						key: settings.mouseover_open_bg_tab_key,
						action: {type: "open_in_new_tab", background_tab: true}
					},
					{
						key: settings.mouseover_copy_link_key,
						action: {type: "copy_link"},
						requires: settings.write_to_clipboard
					},
					{
						key: settings.mouseover_open_options_key,
						// Clear the chord because opening in a new tab will not release the keys
						clear: true,
						action: {type: "open_options"}
					},
					{
						key: settings.mouseover_open_orig_page_key,
						// Clear the chord because opening in a new tab will not release the keys
						clear: true,
						action: {type: "open_orig_page"}
					},
					{
						key: settings.mouseover_rotate_left_key,
						action: {type: "rotate_left"}
					},
					{
						key: settings.mouseover_rotate_right_key,
						action: {type: "rotate_right"}
					},
					{
						key: settings.mouseover_flip_horizontal_key,
						action: {type: "flip_horizontal"}
					},
					{
						key: settings.mouseover_flip_vertical_key,
						action: {type: "flip_vertical"}
					},
					{
						key: settings.mouseover_zoom_in_key,
						action: {type: "zoom_in"}
					},
					{
						key: settings.mouseover_zoom_out_key,
						action: {type: "zoom_out"}
					},
					{
						key: settings.mouseover_zoom_full_key,
						action: {type: "zoom_full"}
					},
					{
						key: settings.mouseover_zoom_fit_key,
						action: {type: "zoom_fit"}
					},
					{
						key: settings.mouseover_fullscreen_key,
						action: {type: "fullscreen"}
					},
					{
						key: settings.mouseover_video_seek_left_key,
						action: {type: "seek_left"}
					},
					{
						key: settings.mouseover_video_seek_right_key,
						action: {type: "seek_right"}
					},
					{
						key: settings.mouseover_video_frame_prev_key,
						action: {type: "frame_left"}
					},
					{
						key: settings.mouseover_video_frame_next_key,
						action: {type: "frame_right"}
					},
					{
						key: settings.mouseover_video_speed_down_key,
						action: {type: "speed_down"}
					},
					{
						key: settings.mouseover_video_speed_up_key,
						action: {type: "speed_up"}
					},
					{
						key: settings.mouseover_video_reset_speed_key,
						action: {type: "reset_speed"}
					},
					{
						key: settings.mouseover_video_volume_up_key,
						action: {type: "volume_up"}
					},
					{
						key: settings.mouseover_video_volume_down_key,
						action: {type: "volume_down"}
					},
					{
						key: settings.mouseover_video_mute_key,
						action: {type: "toggle_mute"}
					},
					{
						key: settings.mouseover_video_controls_key,
						action: {type: "toggle_controls"}
					},
					{
						key: settings.mouseover_video_playpause_key,
						action: {type: "toggle_play_pause"}
					},
					{
						key: settings.mouseover_video_screenshot_key,
						// Clear the chord because keyup might not be called due to the save dialog popup
						clear: true,
						action: {type: "screenshot_video"}
					},
					{
						key: settings.mouseover_ui_toggle_key,
						action: {type: "toggle_ui"}
					},
					{
						key: settings.mouseover_gallery_download_key,
						action: {type: "download_gallery"},
						// Clear the chord because keyup might not be called due to the save dialog popup
						clear: true
					},
					{
						key: settings.mouseover_hold_key,
						action: {type: "toggle_hold"}
					}
				];

				for (var i = 0; i < keybinds.length; i++) {
					if (keybinds[i].key && trigger_complete(keybinds[i].key)) {
						if ("requires" in keybinds[i]) {
							if (!keybinds[i].requires)
								continue;
						}

						var action = keybinds[i].action;
						action.needs_popup = true;

						actions.push(action);

						if (keybinds[i].clear)
							clear_chord();

						if (is_popup_active) {
							release_ignore = keybinds[i].key;
							ret = false;
						}

						break;
					}
				}
			}

			if (!release_ignore || !release_ignore.length) {
				release_ignore = [];
			} else {
				release_ignore = deepcopy(release_ignore);
			}

			if (actions && actions.length > 0) {
				clear_chord_wheel();

				for (var i = 0; i < actions.length; i++) {
					action_handler(actions[i]);
				}

				action_remote(actions);
			}

			if (ret === false) {
				event_cache.set(event_cache_key, ret, 5);
			}

			return do_event_return(event, ret);
		};

		var keyup_cb = function(event) {
			nir_debug("input", "keyup_cb", event);

			if (!mouseover_base_enabled())
				return;

			update_chord(event, false);

			if (!settings.mouseover) return;

			var ret = void 0;

			var current_trigger = settings.mouseover_trigger_key;
			if (trigger_id) current_trigger = settings["mouseover_trigger_key_t" + trigger_id];

			var condition = event_would_modify_chord(event, false, current_trigger);

			var close_behavior = get_close_behavior();
			if (condition && close_behavior === "all") {
				condition = !trigger_partially_complete(event, current_trigger);
			}

			var can_cancel = popups_active;
			if (!can_cancel) {
				if (settings.mouseover_cancel_popup_when_release ||
					// this probably makes the most sense (#417, thanks to lnp5131 on github for reporting)
					(settings.mouseover_close_need_mouseout && !can_close_popup[1])) {
					can_cancel = true;
				}
			}

			if (condition && close_behavior !== "esc" && popup_trigger_reason === "keyboard" && can_cancel) {
				if (!settings.mouseover_close_need_mouseout || can_close_popup[1]) {
					stop_waiting();
					resetpopups();
				} else {
					can_close_popup[0] = true;
				}

				return;
			}

			// 27 = esc
			if (event.which === 27) {
				if (delay_handle_triggering && popup_trigger_reason === "mouse" && !settings.mouseover_cancel_popup_with_esc)
					return;

				stop_waiting();
				resetpopups();
			}

			if (release_ignore.length > 0) {
				var map = get_keystrs_map(event, false);
				for (var key in map) {
					var index = array_indexof(release_ignore, key);
					if (index >= 0) {
						release_ignore.splice(index, 1);
						ret = false;
					}
				}
			}

			return do_event_return(event, ret);
		};

		function scrollLeft() {
			var doc = document.documentElement;
			var body = document.body;
			return (doc && doc.scrollLeft || body && body.scrollLeft || 0) -
				(doc && doc.clientLeft || body && body.clientLeft || 0);
		}

		function scrollTop() {
			var doc = document.documentElement;
			var body = document.body;
			return (doc && doc.scrollTop || body && body.scrollTop || 0) -
				(doc && doc.clientTop || body && body.clientTop || 0);
		}

		var get_move_with_cursor = function() {
			// don't require this for now, because esc can also be used to close the popup
			//var close_el_policy = get_single_setting("mouseover_close_el_policy");
			// maybe disable if popup position == center, and "move within page" is activated?
			return settings.mouseover_move_with_cursor && !popup_hold;// && close_el_policy === "thumbnail";
		};

		function do_popup_pan(popup, event, mouseX, mouseY) {
			var pan_behavior = get_single_setting("mouseover_pan_behavior");
			var move_with_cursor = get_move_with_cursor();
			if (pan_behavior === "drag" && (event.buttons === 0 || !dragstart) && !move_with_cursor)
				return;

			var viewport = get_viewport();
			var edge_buffer = 40;
			var border_thresh = 20;
			var min_move_amt = parse_int(settings.mouseover_drag_min);
			var moved = false;

			// lefttop: true = top, false = left

			var dodrag = function(lefttop) {
				var orig = parseInt(lefttop ? popup.style.top : popup.style.left);

				var mousepos = lefttop ? mouseY : mouseX;
				var dragoffset = lefttop ? dragoffsetY : dragoffsetX;
				var last = lefttop ? lastY : lastX;

				var current = mousepos - dragoffset;

				if (current !== orig) {
					if (dragged || Math_abs(current - orig) >= min_move_amt) {
						var newlast = current - (orig - last);

						if (lefttop) {
							lastY = newlast;
							popup.style.top = current + "px";
						} else {
							lastX = newlast;
							popup.style.left = current + "px";
						}

						dragged = true;
						moved = true;
					}
				}
			};

			var popup_clientrect = null;
			var popup_media_clientrect = null;
			var domovement = function(lefttop) {
				if (!popup_clientrect) {
					popup_clientrect = get_popup_client_rect();
					popup_media_clientrect = get_popup_media_client_rect();
				}

				// offset* is very slow, slower than setting top/left! 250ms vs 30ms after a while
				//var offsetD = lefttop ? popup.offsetHeight : popup.offsetWidth;
				// offsetD and mediaOffsetD can differ when rotating, because the popup's dimensions don't get updated
				var offsetD = lefttop ? popup_clientrect.height : popup_clientrect.width;
				var mediaOffsetD = lefttop ? popup_media_clientrect.height : popup_media_clientrect.width;
				// the popup is always in the middle, so if the media is rotated, adding the difference in offset allows the position to be accurate
				var offset_add = (mediaOffsetD - offsetD) / 2;

				// mediaOffsetD will usually be smaller than offsetD because of the border
				// if the popup isn't rotated (or 180), we prefer offsetD
				// a proper fix would be nice though, as this only improves the situation for unrotated, which creates inconsistent behavior when rotated
				if (Math_abs(offset_add) < border_thresh) {
					mediaOffsetD = offsetD;
					offset_add = 0;
				}

				var viewportD = lefttop ? viewport[1] : viewport[0];
				var mousepos = lefttop ? mouseY : mouseX;

				if (!settings.mouseover_movement_inverted)
					mousepos = viewportD - mousepos;

				if (mediaOffsetD > viewportD) {
					var mouse_edge = Math_min(Math_max((mousepos - edge_buffer), 0), viewportD - edge_buffer * 2);
					var percent = mouse_edge / (viewportD - (edge_buffer * 2));

					var newpos = (percent * (viewportD - mediaOffsetD - border_thresh * 2) + offset_add + border_thresh) + "px";

					if (lefttop)
						popup.style.top = newpos;
					else
						popup.style.left = newpos;

					moved = true;
				}
			};

			var update_pos_cache = null;
			var domovewith = function(lefttop) {
				var orig = parseInt(lefttop ? popup.style.top : popup.style.left);

				var mousepos = lefttop ? mouseY : mouseX;
				//var popupopen = lefttop ? popupOpenY : popupOpenX;
				var last = lefttop ? popupOpenLastY : popupOpenLastX;

				var current = mousepos - last + orig;

				if (settings.mouseover_move_within_page) {
					if (false) {
						var offsetD = lefttop ? popup.offsetHeight : popup.offsetWidth;
						var viewportD = lefttop ? viewport[1] : viewport[0];

						current = Math_max(current, border_thresh);

						if (current + offsetD > (viewportD - border_thresh)) {
							current = viewportD - border_thresh - offsetD;
						}
					} else if (popup_update_pos_func) {
						if (!update_pos_cache)
							update_pos_cache = popup_update_pos_func(mouseX, mouseY, false);

						current = update_pos_cache[lefttop ? 1 : 0];
					}
				}

				if (current === orig)
					return;

				var newlast = mousepos;

				if (lefttop) {
					popupOpenLastY = newlast;
					popup.style.top = current + "px";
				} else {
					popupOpenLastX = newlast;
					popup.style.left = current + "px";
				}
			};

			if (pan_behavior === "drag" && dragstart) {
				dodrag(false);
				dodrag(true);
			} else if (pan_behavior === "movement") {
				domovement(false);
				domovement(true);
			}

			if (move_with_cursor) {
				// make sure to fix this for remote (this is called at the top frame, but popup_el is remote)
				//var popup_el_rect = popup_el.getBoundingClientRect();
				var popup_el_rect = null;
				// don't check for now, maybe add this as an option later?
				if (true || in_clientrect(mouseX, mouseY, popup_el_rect)) {
					domovewith(false);
					domovewith(true);
				}
			}

			if (moved) {
				mouse_in_image_yet = false;
			}
		}

		var remote_handle_message = function(message, sender, respond) {
			if (_nir_debug_) {
				console_log("ON_REMOTE_MESSAGE", message, sender, respond);
			}

			if (message.type === "make_popup") {
				if (!is_in_iframe) {
					resetpopups();

					deserialize_img(message.data.data.data.img, function(el) {
						message.data.data.data.img = el;

						popup_el_remote = sender;
						popup_el = null;
						real_popup_el = null;
						//console_log("Making popup", message);
						makePopup(message.data.source_imu, message.data.src, message.data.processing, message.data.data);
					});
				}
			} else if (message.type === "count_gallery") {
				count_gallery(message.data.nextprev, message.data.max, message.data.is_counting, void 0, void 0, function(count) {
					respond(count);
				});
			} else if (message.type === "is_nextprev_valid") {
				is_nextprev_valid(message.data.nextprev, function(valid) {
					respond(valid);
				});
			} else if (message.type === "trigger_gallery") {
				trigger_gallery(message.data.dir, function(triggered) {
					respond(triggered);
				});
			} else if (message.type === "resetpopups") {
				resetpopups({
					from_remote: true
				});
			} else if (message.type === "mousemove") {
				// todo: offset iframe location
				mousemove_cb(message.data);
			} else if (message.type === "action") {
				for (var i = 0; i < message.data.length; i++) {
					message.data[i].remote_origin = sender;
					action_handler(message.data[i]);
				}
			} else if (message.type === "popup_open") {
				popup_el_remote = sender;
				last_popup_el = null;
			}
		};

		var handle_remote_event = function(message) {
			if (message.type === "remote") {
				var respond = nullfunc;
				if (message.response_id) {
					var response_id = message.response_id;

					respond = function(data) {
						remote_send_reply(message.from, response_id, data);
					};
				}

				if (message.from === current_frame_id || (message.to && current_frame_id !== message.to)) {
					return true;
				}

				remote_handle_message(message.data, message.from, respond);
				return true;
			} else if (message.type === "remote_reply") {
				if (message.response_id in remote_reply_ids) {
					var response_id = message.response_id;
					delete message.response_id;

					remote_reply_ids[response_id](message.data);
				}

				return true;
			}

			return false;
		}

		if (is_extension) {
			// TODO: move out of do_mouseover
			chrome.runtime.onMessage.addListener(function(message, sender, respond) {
				if (_nir_debug_) {
					console_log("chrome.runtime.onMessage", message);
				}

				if (message.type === "context_imu") {
					// https://github.com/qsniyg/maxurl/issues/517
					// TODO: also set mouse_frame_id in oncontextmenu
					if (mouse_frame_id !== current_frame_id)
						return;

					popup_trigger_reason = "contextmenu";
					trigger_popup({is_contextmenu: true});
				} else if (message.type === "popupaction") {
					if (message.data.action === "replace_images") {
						replace_images_full();
					} else if (message.data.action === "highlight_images") {
						highlight_images();
					} else if (message.data.action in menucommands_map) {
						menucommands_map[message.data.action].func();
					}
				} else if (message.type === "remote" || message.type === "remote_reply") {
					handle_remote_event(message);
				} else if (message.type === "suspend") {
					set_terminated(true);
				} else if (message.type === "unsuspend") {
					set_terminated(false);
				} else {
					general_extension_message_handler(message, sender, respond);
				}
			});
		} else {
			our_addEventListener(get_window(), "message", function(event) {
				if (_nir_debug_) {
					console_log("window.onMessage", event);
				}

				if (!can_use_remote() || !event.data || typeof event.data !== "object" || !(imu_message_key in event.data))
					return;

				// TODO: update id_to_iframe with event.source (remember that event.source is a window object, not an iframe)

				handle_remote_event(event.data[imu_message_key]);

				event.preventDefault();
				event.stopPropagation();
				event.stopImmediatePropagation();
			}, {
				capture: true,
				passive: false
			});
		}

		var last_remote_mousemove = 0;
		var last_remote_mousemove_timer = null;
		var last_remote_mousemove_event = null;

		onload(() => {
			var eventlistener_opts = {
				capture: true,
				passive: false
			};

			our_addEventListener(document, 'keydown', keydown_cb, eventlistener_opts);
			our_addEventListener(document, 'mousedown', keydown_cb, eventlistener_opts);
			our_addEventListener(document, 'contextmenu', keydown_cb, eventlistener_opts);
			our_addEventListener(document.body, 'contextmenu', keydown_cb, eventlistener_opts);
			our_addEventListener(document, 'wheel', keydown_cb, eventlistener_opts);

			our_addEventListener(document, 'keyup', keyup_cb, eventlistener_opts);
			our_addEventListener(document, 'mouseup', keyup_cb, eventlistener_opts);

			our_addEventListener(document, 'contextmenu', update_contextmenu_pos);

			var wheel_cb = function(event) {
				if (settings.scroll_override_page && popups_active && popup_wheel_cb) {
					return popup_wheel_cb(event, true);
				}
			};

			our_addEventListener(document, "wheel", wheel_cb, { passive: false });

			// https://github.com/qsniyg/maxurl/issues/771
			// seems to be a bug in chrome. if both a "wheel" and a "mousewheel" (deprecated) event are set on document, it will not fire the mousewheel event
			if (host_domain_nosub === "bilibili.com" && navigator.userAgent.indexOf("Chrome/") >= 0) {
				our_addEventListener(document, "wheel", function(e) {
					var ev = document.createEvent("MouseEvents");
					ev.initEvent("mousewheel", true, true);
					//ev.originalEvent = e.originalEvent || e;
					ev.wheelDelta = e.wheelDelta;
					ev.detail = e.detail;
					ev.deltaMode = e.deltaMode;
					ev.target = e.target;
					ev.srcElement = e.srcElement;
					document.dispatchEvent(ev);
				});
			}
		});

		var update_mouse_from_event = function(event) {
			if (event.pageX === null && event.clientX !== null) {
				// commenting out because unused and sets global variables
				/*eventDoc = (event.target && event.target.ownerDocument) || document;
				doc = eventDoc.documentElement;
				body = eventDoc.body;*/

				event.pageX = event.clientX + scrollLeft();
				event.pageY = event.clientY + scrollTop();
			}

			if (can_use_remote()) {
				if (event.remote_info && event.remote_info.id !== current_frame_id) {
					var iframe = find_iframe_for_info(event.remote_info);
					if (!iframe) {
						return;
					}

					//console_log(iframe);
					var bb = get_bounding_client_rect(iframe);

					// fixme: should this be done?
					event.clientX += bb.left;
					event.clientY += bb.top;

					event.pageX += bb.left + window.scrollX;
					event.pageY += bb.top + window.scrollY;
				} else if (is_in_iframe) {
					// todo: add timeouts to avoid too much cpu usage
					last_remote_mousemove_event = event;

					var mindelta = 16;
					if (!settings.mouseover_use_remote) {
						mindelta = 300; // we don't need precise movements, all we need is to inform the top frame that the mouse is here
					}

					var current_time = Date.now();
					var timeout = mindelta - (current_time - last_remote_mousemove);
					if (timeout < 1)
						timeout = 1;

					if (!last_remote_mousemove_timer) {
						last_remote_mousemove_timer = setTimeout(function() {
							if (!("remote_info" in last_remote_mousemove_event)) {
								last_remote_mousemove_event.remote_info = get_frame_info();
							}

							last_remote_mousemove_timer = null;
							last_remote_mousemove = Date.now();
							remote_send_message("top", {
								type: "mousemove",
								data: serialize_event(last_remote_mousemove_event)
							});
						}, timeout);
					}
				}

				mouse_frame_id = event.remote_info ? event.remote_info.id : current_frame_id;
			}

			mouseX = event.clientX;
			mouseY = event.clientY;

			mouseAbsX = event.pageX;
			mouseAbsY = event.pageY;
		};

		var mousemove_cb = function(event) {
			mousepos_initialized = true;

			// https://stackoverflow.com/a/7790764
			event = event || window.event;

			update_mouse_from_event(event);

			if (waiting) {
				update_waiting();
			}

			if (popups_active) {
				do_popup_pan(popups[0], event, mouseX, mouseY);
			}

			var jitter_base = settings.mouseover_jitter_threshold;

			var do_mouse_close_kbd = popup_trigger_reason === "keyboard" && get_close_need_mouseout() && popups_active;
			var do_mouse_close_mouse = popup_trigger_reason === "mouse";

			if (do_mouse_close_kbd || do_mouse_close_mouse) {
				if (popups_active) {
					// FIXME: why was this not in if (popups_active)?
					// The reason for putting it here is that if the mouse moves (even within jitter thresh) after a single popup is open, it will cancel the popup request
					if (delay_handle) {
						clearTimeout(delay_handle);
						delay_handle = null;

						if (false && waiting)
							stop_waiting();
					}

					var jitter_threshx = 40;
					var jitter_threshy = jitter_threshx;

					//var img = popups[0].getElementsByTagName("img")[0];
					var img = get_popup_media_el();
					var imgmiddleX = null;
					var imgmiddleY = null;
					var in_img_jitter = false;
					if (img) {
						var rect = get_popup_media_client_rect();

						in_img_jitter = in_clientrect(mouseX, mouseY, rect, jitter_base);

						var w = rect.width;
						var h = rect.height;

						imgmiddleX = rect.x + rect.width / 2;
						imgmiddleY = rect.y + rect.height / 2;

						jitter_threshx = Math_max(jitter_threshx, w / 2);
						jitter_threshy = Math_max(jitter_threshy, h / 2);

						jitter_threshx += jitter_base;
						jitter_threshy += jitter_base;

						/*console_log(jitter_threshx, img.naturalWidth, w);
						console_log(jitter_threshy, img.naturalHeight, h);*/
						if (mouse_in_image_yet === false) {
							if (in_clientrect(mouseX, mouseY, rect)) {
								mouse_in_image_yet = true;
							}
						}
					}

					var do_mouse_reset = function() {
						if (popup_hold) {
							can_close_popup[1] = true;
						} else {
							resetpopups();
						}
					};

					var close_el_policy = get_single_setting("mouseover_close_el_policy");
					var close_on_leave_el = (close_el_policy === "thumbnail" || close_el_policy === "both") && popup_el && !popup_el_automatic;
					var outside_of_popup_el = false;
					var popup_el_hidden = false;

					// check if we should check if the mouse has left popup_el (the source/thumbnail that was popped up from, _not_ the element of the popup)
					if (close_on_leave_el) {
						var popup_el_rect = get_bounding_client_rect(popup_el);

						// check if the source element is visible
						if (popup_el_rect && popup_el_rect.width > 0 && popup_el_rect.height > 0) {
							var our_in_img_jitter = in_img_jitter;
							if (close_el_policy === "thumbnail")
								our_in_img_jitter = false; // if not "both", we don't care if the mouse is still in the popup, only if it has left the thumbnail

							if (!in_clientrect(mouseX, mouseY, popup_el_rect) && !our_in_img_jitter) {
								outside_of_popup_el = true;

								if (close_el_policy === "thumbnail") {
									return do_mouse_reset();
								}
							}
						} else {
							// the element must be hidden
							popup_el_hidden = true;
						}
					}

					can_close_popup[1] = false;
					if (mouse_in_image_yet && (!close_on_leave_el || outside_of_popup_el || popup_el_hidden)) {
						if (imgmiddleX && imgmiddleY &&
							(Math_abs(mouseX - imgmiddleX) > jitter_threshx ||
							 Math_abs(mouseY - imgmiddleY) > jitter_threshy)) {
							//console_log(mouseX, imgmiddleX, jitter_threshx);
							//console_log(mouseY, imgmiddleY, jitter_threshy);

							do_mouse_reset();
						}
					} else if (close_on_leave_el) {
						if (outside_of_popup_el) {
							do_mouse_reset();
						}
					}
				} else if (do_mouse_close_mouse && delay_handle_triggering) {
					if (next_popup_el && settings.mouseover_cancel_popup_when_elout) {
						var popup_el_rect = get_bounding_client_rect(next_popup_el);
						if (!in_clientrect(mouseX, mouseY, popup_el_rect)) {
							resetpopups();
						}
					}
				}
			}

			if (mouseover_mouse_enabled()) {
				// FIXME: this is rather weird. Less CPU usage, but doesn't behave in the way one would expect
				if ((!popups_active || popup_el_automatic) && !should_exclude_imagetab()) {
					if (delay_handle && !settings.mouseover_trigger_mouseover) {
						var trigger_mouse_jitter_thresh = 10;

						if (Math_abs(mouseX - mouseDelayX) < trigger_mouse_jitter_thresh &&
							Math_abs(mouseY - mouseDelayY) < trigger_mouse_jitter_thresh)
							return;

						clearTimeout(delay_handle);
						delay_handle = null;
					}

					mouseDelayX = mouseX;
					mouseDelayY = mouseY;
					//mouse_in_image_yet = false;

					if (last_popup_el) {
						var popup_el_rect = get_bounding_client_rect(last_popup_el);
						if (!in_clientrect(mouseX, mouseY, popup_el_rect)) {
							last_popup_el = null;
						}
					}

					if (!settings.mouseover_trigger_mouseover) {
						delay_handle = setTimeout(function() {
							if (!popup_mouse_head())
								return;

							trigger_popup();
						}, delay * 1000);
					}
				}
			}
		};

		onload(() => our_addEventListener(document, 'mousemove', mousemove_cb));

		(function() {
			register_menucommand("Report issue", github_issues_page);
		})();
	}
	// end do_mouseover

	function do_websitehome() {
		if (require_rules_failed)
			return;

		unsafeWindow["imu_variable"] = bigimage_recursive;
		unsafeWindow["imu_inject"] = 1;
		unsafeWindow["do_imu"] = function(url, cb) {
			return bigimage_recursive(url, {
				fill_object: true,
				do_request: do_request,
				cb: cb
			});
		};

		var orig_set_max = unsafeWindow["set_max"];
		unsafeWindow["set_max"] = function(obj) {
			if (!obj || !obj[0].url) {
				orig_set_max(obj);
				return;
			}

			var loop_url = function(obj, cb, options, lasturl) {
				check_image_get(obj, function(img, newurl) {
					var finalurl = newurl;
					if (!newurl && img && img.finalUrl) {
						finalurl = img.finalUrl;
					}

					if (!finalurl) {
						cb(img, newurl);
						return;
					}

					if (obj_indexOf(obj, finalurl) < 0 &&
						lasturl !== finalurl) {
						bigimage_recursive(finalurl, {
							fill_object: true,
							do_request: do_request,
							cb: function(obj) {
								check_image_unref(img);
								loop_url(obj, cb, options, finalurl);
							}
						});
					} else {
						cb(img, newurl, obj[obj_indexOf(obj, finalurl)]);
					}
				}, options);
			};

			if (settings.website_image) {
				loop_url(obj, function(img, url, obj) {
					if (!img) {
						orig_set_max("broken");
					} else {
						var newobj = obj;
						if (!newobj)
							newobj = {url: url};

						orig_set_max([newobj]);
						unsafeWindow["maximgel"].src = img.src;
					}
				}, {running: true});
			} else if (obj.can_head) {
				loop_url(obj, function(resp) {
					if (!resp) {
						orig_set_max("broken");
					} else {
						var newobj = obj;
						if (!newobj)
							newobj = {url: resp.finalUrl};

						orig_set_max([newobj]);
					}
				}, {running: true, head: true});
			} else {
				orig_set_max(obj);
			}
		};
	}

	var set_require_rules_failed_el = function(el) {
		if (!require_rules_failed)
			return false;

		el.style.color = "#ff3333";

		el.innerText = "Error: Rules cannot be loaded.\nPlease either try reinstalling the script, or ";

		var github_link = document.createElement("a");
		github_link.href = userscript_update_url;
		github_link.target = "_blank";
		github_link.innerText = "install the github version";
		el.appendChild(github_link);

		var reason_el = document.createElement("p");
		reason_el.innerText = "Error reason:";
		reason_el.style.color = "#000";
		reason_el.style.marginTop = "1em";
		reason_el.style.marginBottom = "1em";

		try {
			var error_message = document.createElement("pre");
			error_message.style.color = "#000";
			error_message.innerText = require_rules_failed.message;

			el.appendChild(reason_el);
			el.appendChild(error_message);
		} catch (e) {
			console_error(e);
		}

		return true;
	}

	var do_userscript_page = function(imgel, latest_version) {
		var status_container_el = document_createElement("div");
		status_container_el.style.marginBottom = "2em";

		var version_el = document_createElement("span");
		version_el.style.fontSize = "90%";
		version_el.style.fontWeight = 800;
		version_el.style.marginRight = "2em";

		var options_el:HTMLElement;

		var version = null;
		try {
			version = gm_info.script.version;
		} catch (e) {
		}

		if (!set_require_rules_failed_el(version_el)) {
			version_el.innerText = "Installed";

			if (version !== null) {
				version_el.innerText += " (v" + version;

				if (latest_version) {
					var compared = version_compare(latest_version, version);
					if (compared === -1) {
						version_el.innerText += ", update available";
					}
				}

				version_el.innerText += ")";
			}

			options_el = document_createElement("a");
			options_el.innerText = "Options";
			options_el.style.background = "#0af";
			options_el.style.padding = "0.5em 1em";
			options_el.style.color = "white";
			options_el.style.display = "inline-block";
			options_el.style.textDecoration = "none";
			options_el.target = "_blank";
			options_el.href = "https://qsniyg.github.io/maxurl/options.html";
		}

		status_container_el.appendChild(version_el);
		if (!require_rules_failed) status_container_el.appendChild(options_el);
		imgel.parentElement.appendChild(status_container_el);
	};

	var do_greasyfork_page = function() {
		var imgel = document.querySelector("div.script-author-description > center > img[alt='Image Max URL']");

		// greasyfork redesign
		if (!imgel)
			imgel = document.querySelector("#additional-info > center > img[alt='Image Max URL']");

		if (!imgel)
			return;

		// make sure it's the same general layout
		if (imgel.parentElement.previousElementSibling ||
			imgel.parentElement.nextElementSibling.tagName !== "UL")
			return;

		var gf_version = null;
		var gf_version_el = document.querySelector("dd.script-show-version");
		if (gf_version_el) {
			gf_version = gf_version_el.innerText.replace(/^\s*|\s*$/, "");
		}

		do_userscript_page(imgel, gf_version);
	};

	var do_oujs_page = function() {
		var imgel = document.querySelector("div#user-content > p[align='center'] img[alt='Image Max URL']");
		if (!imgel)
			return;

		// make sure it's the same general layout
		if ((imgel.parentElement.previousElementSibling && imgel.parentElement.previousElementSibling.tagName !== "HR") ||
			imgel.parentElement.nextElementSibling.tagName !== "UL")
			return;

		var latest_version = null;
		var version_icon_el = document.querySelector("div.script-meta i.fa-history");
		if (version_icon_el) {
			var code_el = version_icon_el.parentElement.querySelector("code");
			if (code_el) {
				latest_version = code_el.innerText.replace(/[+].*/, "");
				if (!/^[0-9.]+$/.test(latest_version))
					latest_version = null;
			}
		}

		do_userscript_page(imgel, latest_version);
	};

	var parse_node_args = function(args_info) {
		let parsed = {_positional: []};

		for (let i = 2; i < process.argv.length; i++) {
			let arg = process.argv[i];

			if (arg[0] !== '-') {
				parsed["_positional"].push(arg);
				continue;
			}

			if (arg === '--') {
				array_extend(parsed._positional, process.argv.slice(i + 1));
				break;
			}

			let shortarg = null;
			let longarg = null;
			let argval = null;

			if (arg[1] === '-') {
				longarg = arg.substr(2);
			} else {
				// TODO: support chained args (-abc == -a -b -c)
				shortarg = arg.substr(1);
			}

			let our_arg = null;
			for (let arg_info of args_info) {
				if (shortarg) {
					if (arg_info.short === shortarg) {
						our_arg = arg_info;
						break;
					}
				}

				if (longarg) {
					if (arg_info.long === longarg) {
						our_arg = arg_info;
						break;
					}
				}
			}

			if (!our_arg) {
				console.error("Unable to find argument:", process.argv[i]);
				return null;
			}

			if (our_arg.needs_arg) {
				i++;
				if (i >= process.argv.length) {
					console.error("Argument", process.argv[i-1], "needs an argument");
					return null;
				}

				argval = process.argv[i];
			} else {
				argval = true;
			}

			parsed[our_arg.name] = argval;
		}

		return parsed;
	}

	var do_node_main = function() {
		let parsed = parse_node_args({});
		if (!parsed)
			return;

		if (!parsed._positional.length) {
			console.error("Usage:", process.argv[0], process.argv[1], "url");
			return;
		}

		let url = parsed._positional[0];

		let window = {
			location: {
				href: url
			}
		};

		bigimage_recursive_loop(url, {
			fill_object: true,
			window: window,
			cb: function(obj) {
				console.log(JSON_stringify(obj, null, '\t'));
			}
		}, function(obj, finalcb) {
			console.log("BRL", obj);
		});
	};

	function start() {
		do_export();

		if (is_interactive) {
			if (is_maxurl_website || is_options_page) {
				onload(function() {
					update_dark_mode();
				});
			}

			if (is_options_page) {
				onload(function() {
					try {
						do_options();
					} catch (e) {
						console_error(e);

						var error_pre = document_createElement("pre");
						error_pre.style.fontFamily = "monospace";
						error_pre.style.margin = "1em";
						error_pre.innerText = get_crashlog_info() + "\n" + e.toString() + "\n" + e.stack;

						var error_div = document_createElement("div");
						var error_div_text = "Error loading options page, please report this to <a href='" + github_issues_page + "'>" + github_issues_page + "</a>, ";
						error_div_text += "and include the following information in the report:";
						error_div.innerHTML = error_div_text;

						error_div.appendChild(error_pre);

						document.body.innerHTML = error_div.outerHTML;
					}
				});
			}

			if (settings.imu_enabled) {
				if (settings.redirect) {
					do_redirect();
				}

				if (settings.website_inject_imu &&
					(window.location.href.match(/^https?:\/\/qsniyg\.github\.io\/+maxurl(\/+|\/+index\.html)?(?:[?#].*)?$/) ||
						window.location.href.match(/^file:\/\/.*\/maxurl\/site\/index\.html/))) {
					if (typeof (unsafeWindow) !== "undefined") {
						onload(function () {
							do_websitehome();
						});
					}
				}
			}

			if (is_userscript) {
				if (window.location.href.match(/^https?:\/\/(?:www\.)?greasyfork\.org\/+[^/]*\/+scripts\/+36662(?:-[^/]*)?(?:[?#].*)?$/)) {
					onload(function() {
						do_greasyfork_page();
					});
				} else if (window.location.href.match(/^https?:\/\/(?:www\.)?openuserjs\.org\/+scripts\/+qsniyg\/+Image_Max_URL(?:[?#].*)?$/)) {
					onload(function() {
						do_oujs_page();
					});
				}
			}

			do_mouseover();

			if (is_extension) {
				extension_send_message({
					type: "ready"
				});
			}
		} else if (is_extension_bg) {
			imu_userscript_message_sender = general_extension_message_handler;
		} else if (is_node_main) {
			do_node_main();
		}
	}

	if (_nir_debug_)
		console_log("Finished initial loading");

	do_config();
})();

// @license-end
