From 1d545c4c67d653283367fd8e366350ad7e33f269 Mon Sep 17 00:00:00 2001 From: qsniyg Date: Tue, 19 Mar 2024 20:28:28 +0000 Subject: [PATCH] Support lnwfile (fixes #1301) --- src/userscript.ts | 19 ++++++++++++++++--- userscript.user.js | 17 ++++++++++++++--- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/userscript.ts b/src/userscript.ts index 040d10a1..ea639d81 100644 --- a/src/userscript.ts +++ b/src/userscript.ts @@ -59162,16 +59162,18 @@ var $$IMU_EXPORT$$; 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:["'](.*?)["']/); + 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: match[1], + url: url, extra: { - page: urljoin(resp.finalUrl + "/", match[1].replace(/.*\/([^/.]*).*?$/, "$1"), true) + page: urljoin(resp.finalUrl + "/", url.replace(/.*\/([^/.]*).*?$/, "$1"), true) } }; @@ -113188,6 +113190,17 @@ var $$IMU_EXPORT$$; 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/"); + } + diff --git a/userscript.user.js b/userscript.user.js index 0fc2c59f..ae51bda8 100644 --- a/userscript.user.js +++ b/userscript.user.js @@ -53760,15 +53760,16 @@ var $$IMU_EXPORT$$; 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:["'](.*?)["']/); + 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); } + var url = JSON_parse('"' + match[1] + '"'); var obj = { - url: match[1], + url: url, extra: { - page: urljoin(resp.finalUrl + "/", match[1].replace(/.*\/([^/.]*).*?$/, "$1"), true) + page: urljoin(resp.finalUrl + "/", url.replace(/.*\/([^/.]*).*?$/, "$1"), true) } }; var title = get_meta(resp.responseText, "og:title"); @@ -101610,6 +101611,16 @@ var $$IMU_EXPORT$$; // 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/"); + } // -- 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