Skip to content

Commit

Permalink
Improve barnesandnoble.com rule (fixes #1384)
Browse files Browse the repository at this point in the history
  • Loading branch information
qsniyg committed Jan 22, 2025
1 parent 9c5847f commit 7454871
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/userscript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58271,6 +58271,10 @@ var $$IMU_EXPORT$$;
if ("resolve.quality" in newkvs)
newkvs["resolve.quality"].value = 100;

// thanks to Froktime: https://github.com/qsniyg/maxurl/issues/1384
if ("resolve.format" in newkvs)
newkvs["resolve.format"].value = "png";

if ("quality" in newkvs) {
// quality[L]
if (/^[0-9]{1,2}$/.test(newkvs["quality"].value))
Expand Down Expand Up @@ -93448,6 +93452,14 @@ var $$IMU_EXPORT$$;
newsrc = src.replace(/_s[0-9]{3}x[0-9]{3}\./, "_s1200x630.");
if (newsrc !== src) return newsrc;

// thanks to Froktime on github: https://github.com/qsniyg/maxurl/issues/1384
// https://prodimage.images-bn.com/pimages/0786936850291_p0_v1_s118x184.jpg
// 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&set=key%5Bresolve.format%5D%2Cvalue%5Bpng%5D&product=path%5B%2Fpimages%2F0786936850291_p0_v1%5D&call=url%5Bfile%3Acommon%2FdecodeProduct.chain%5D
match = src.match(/:\/\/[^/]+\/+(pimages\/+[0-9]+_p[0-9]+_v[0-9]+)(?:_s[0-9]+x[0-9]+)?(?:\.[a-z]+)?(?:[?#].*)?$/);
if (match) {
return "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&set=key%5Bresolve.format%5D%2Cvalue%5Bpng%5D&product=path%5B%2F" + encodeURIComponent(match[1]) + "%5D&call=url%5Bfile%3Acommon%2FdecodeProduct.chain%5D";
}

// http://prodimage.images-bn.com/pimages/9780739052204.jpg
return {
url: src,
Expand Down
10 changes: 10 additions & 0 deletions userscript.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -53092,6 +53092,9 @@ var $$IMU_EXPORT$$;
newkvs["resolve.pixelRatio"].value = 1;
if ("resolve.quality" in newkvs)
newkvs["resolve.quality"].value = 100;
// thanks to Froktime: https://github.com/qsniyg/maxurl/issues/1384
if ("resolve.format" in newkvs)
newkvs["resolve.format"].value = "png";
if ("quality" in newkvs) {
// quality[L]
if (/^[0-9]{1,2}$/.test(newkvs["quality"].value))
Expand Down Expand Up @@ -84168,6 +84171,13 @@ var $$IMU_EXPORT$$;
newsrc = src.replace(/_s[0-9]{3}x[0-9]{3}\./, "_s1200x630.");
if (newsrc !== src)
return newsrc;
// thanks to Froktime on github: https://github.com/qsniyg/maxurl/issues/1384
// https://prodimage.images-bn.com/pimages/0786936850291_p0_v1_s118x184.jpg
// 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&set=key%5Bresolve.format%5D%2Cvalue%5Bpng%5D&product=path%5B%2Fpimages%2F0786936850291_p0_v1%5D&call=url%5Bfile%3Acommon%2FdecodeProduct.chain%5D
match = src.match(/:\/\/[^/]+\/+(pimages\/+[0-9]+_p[0-9]+_v[0-9]+)(?:_s[0-9]+x[0-9]+)?(?:\.[a-z]+)?(?:[?#].*)?$/);
if (match) {
return "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&set=key%5Bresolve.format%5D%2Cvalue%5Bpng%5D&product=path%5B%2F" + encodeURIComponent(match[1]) + "%5D&call=url%5Bfile%3Acommon%2FdecodeProduct.chain%5D";
}
// http://prodimage.images-bn.com/pimages/9780739052204.jpg
return {
url: src,
Expand Down

0 comments on commit 7454871

Please sign in to comment.