Skip to content

Commit

Permalink
Support lnwfile (fixes #1301)
Browse files Browse the repository at this point in the history
  • Loading branch information
qsniyg committed Mar 19, 2024
1 parent a817693 commit 1d545c4
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
19 changes: 16 additions & 3 deletions src/userscript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
};

Expand Down Expand Up @@ -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/");
}




Expand Down
17 changes: 14 additions & 3 deletions userscript.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 1d545c4

Please sign in to comment.