From 1b1555f57013530619bb365cc8cbfbac4c9d8bd5 Mon Sep 17 00:00:00 2001 From: qsniyg Date: Tue, 9 Jan 2024 22:02:05 +0000 Subject: [PATCH] More websites/rules Fixes #1252 --- src/userscript.ts | 76 +++++++++++++++++++++++++++++++++++++++------- userscript.user.js | 67 ++++++++++++++++++++++++++++++++-------- 2 files changed, 120 insertions(+), 23 deletions(-) diff --git a/src/userscript.ts b/src/userscript.ts index 9aa47bef..bbe7926d 100644 --- a/src/userscript.ts +++ b/src/userscript.ts @@ -28918,6 +28918,9 @@ var $$IMU_EXPORT$$; // 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 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 @@ -110682,6 +110685,13 @@ var $$IMU_EXPORT$$; return src.replace(/(\/img\/+products\/+[0-9]+\/+[0-9]+\/+[0-9]+_poster)(?:_[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"); + } + @@ -113637,6 +113647,25 @@ var $$IMU_EXPORT$$; } } + 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"); + } + } + } + } + return null; }; @@ -114499,19 +114528,35 @@ var $$IMU_EXPORT$$; url: string, data: any } - var bigimage_recursive_loop = function(url, options, query, fine_urls?:Array, tried_urls?:Array, oldobj?:Array) { + type BRLState = { + fine_urls: Array, + tried_urls: Array, + oldobj: Array, + tried_imus: Array + } + var bigimage_recursive_loop = function(url, options, query, state?:BRLState) { var newoptions:any = {}; - if (!fine_urls) { - fine_urls = []; - } - if (!tried_urls) { - tried_urls = []; + if (!state) { + state = { + fine_urls: [], + tried_urls: [], + oldobj: [], + tried_imus: [] + }; } - if (!oldobj) { - oldobj = []; + let fine_urls = state.fine_urls; + let tried_urls = state.tried_urls; + let oldobj = state.oldobj; + + let already_tried_url = false; + for (let tried_url of state.tried_imus) { + if (tried_url === url) { + already_tried_url = true; + } } + state.tried_imus.push(url); for (var option in options) { if (option === "cb") { @@ -114628,8 +114673,15 @@ var $$IMU_EXPORT$$; //if (array_indexof(images, newurl) < 0 && newurl !== url || true) { var newurl_index = array_indexof(images, newurl); + if (newurl_index < 0 && already_tried_url) { + if (_nir_debug_) { + console_log("bigimage_recursive_loop (query): already tried url", deepcopy(state)); + } + return options.cb(null, data); + } + if (newurl_index < 0 || !obj[newurl_index].norecurse) { - bigimage_recursive_loop(newurl, options, query, fine_urls, tried_urls, obj); + bigimage_recursive_loop(newurl, options, query, state); } else { //obj = obj.slice(array_indexof(images, newurl)); obj = [obj[newurl_index]]; @@ -120826,12 +120878,14 @@ var $$IMU_EXPORT$$; }); player.load(src).then(function() { + let subs = null; if (info_obj.subtitles) { let selected = false; - for (let subtitle of info_obj.subtitles) { + subs = preprocess_subtitles(info_obj.subtitles); + for (let subtitle of subs) { let kind = "subtitle"; - let language = subtitle.language_code || "en-US"; // TODO: parse from title + let language = subtitle.language_code || "en"; let title = subtitle.title || null; let mime = subtitle.mime || void 0; let forced = false; diff --git a/userscript.user.js b/userscript.user.js index 546678e8..dba8b0b1 100644 --- a/userscript.user.js +++ b/userscript.user.js @@ -26379,6 +26379,9 @@ var $$IMU_EXPORT$$; // 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 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 @@ -99331,6 +99334,12 @@ var $$IMU_EXPORT$$; // https://media.posterlounge.com/img/products/710000/703337/703337_poster.jpg return src.replace(/(\/img\/+products\/+[0-9]+\/+[0-9]+\/+[0-9]+_poster)(?:_[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"); + } // -- 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 @@ -101804,6 +101813,22 @@ var $$IMU_EXPORT$$; } }; } + 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"); + } + } + }; + } return null; }; var _get_album_info_gallery = function(album_info, el, nextprev) { @@ -102498,17 +102523,27 @@ var $$IMU_EXPORT$$; } return newobj; }; - var bigimage_recursive_loop = function(url, options, query, fine_urls, tried_urls, oldobj) { + var bigimage_recursive_loop = function(url, options, query, state) { var newoptions = {}; - if (!fine_urls) { - fine_urls = []; - } - if (!tried_urls) { - tried_urls = []; + if (!state) { + state = { + fine_urls: [], + tried_urls: [], + oldobj: [], + tried_imus: [] + }; } - if (!oldobj) { - oldobj = []; + var fine_urls = state.fine_urls; + var tried_urls = state.tried_urls; + var oldobj = state.oldobj; + var already_tried_url = false; + for (var _i = 0, _a = state.tried_imus; _i < _a.length; _i++) { + var tried_url = _a[_i]; + if (tried_url === url) { + already_tried_url = true; + } } + state.tried_imus.push(url); for (var option in options) { if (option === "cb") { newoptions.cb = function(obj) { @@ -102607,8 +102642,14 @@ var $$IMU_EXPORT$$; }); //if (array_indexof(images, newurl) < 0 && newurl !== url || true) { var newurl_index = array_indexof(images, newurl); + if (newurl_index < 0 && already_tried_url) { + if (_nir_debug_) { + console_log("bigimage_recursive_loop (query): already tried url", deepcopy(state)); + } + return options.cb(null, data); + } if (newurl_index < 0 || !obj[newurl_index].norecurse) { - bigimage_recursive_loop(newurl, options, query, fine_urls, tried_urls, obj); + bigimage_recursive_loop(newurl, options, query, state); } else { //obj = obj.slice(array_indexof(images, newurl)); obj = [obj[newurl_index]]; @@ -107639,12 +107680,14 @@ var $$IMU_EXPORT$$; } }); player.load(src).then(function() { + var subs = null; if (info_obj.subtitles) { var selected = false; - for (var _i = 0, _a = info_obj.subtitles; _i < _a.length; _i++) { - var subtitle = _a[_i]; + subs = preprocess_subtitles(info_obj.subtitles); + for (var _i = 0, subs_2 = subs; _i < subs_2.length; _i++) { + var subtitle = subs_2[_i]; var kind = "subtitle"; - var language = subtitle.language_code || "en-US"; // TODO: parse from title + var language = subtitle.language_code || "en"; var title = subtitle.title || null; var mime = subtitle.mime || void 0; var forced = false;