Skip to content

Commit

Permalink
More websites/rules
Browse files Browse the repository at this point in the history
Fixes #1272
  • Loading branch information
qsniyg committed Feb 4, 2024
1 parent d940da1 commit 4ccd2f2
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 12 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

Improvements:

* Various improvements/fixes to existing rules (including TikTok)
* Various improvements/fixes to existing rules (including TikTok, Tumblr)

Special thanks to fireattack, aslian, remlap, uwuceo, TristanWasTaken, Froktime, karpuzikov, nimbuz, Shaggy, hosadokha for their contributions and reports for this release
Special thanks to fireattack, aslian, remlap, uwuceo, TristanWasTaken, Froktime, karpuzikov, nimbuz, Shaggy, hosadokha, happysurf for their contributions and reports for this release

---

Expand Down
41 changes: 36 additions & 5 deletions src/userscript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36019,7 +36019,9 @@ var $$IMU_EXPORT$$;
// 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
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?(?:_c[0-9]+)?\/+[0-9a-f]{20,}\./.test(src)) {
// 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) {
Expand All @@ -36043,7 +36045,7 @@ var $$IMU_EXPORT$$;
};

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?(?:_c[0-9]+)?\/+[0-9a-f]{20,}\.([^/.?#]+)(?:[?#].*)?$/);
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],
Expand Down Expand Up @@ -111804,7 +111806,6 @@ var $$IMU_EXPORT$$;
}

if (domain_nowww === "bilibili.com") {
// https://www.bilibili.com/video/BV11t421H7bz/?spm_id_from=333.1073.high_energy.content.click
newsrc = website_query({
website_regex: /^[a-z]+:\/\/[^/]+\/+video\/+([A-Za-z0-9]+)\/*(?:[?#].*)?$/,
query_for_id: "https://www.bilibili.com/video/${id}/",
Expand Down Expand Up @@ -111866,6 +111867,36 @@ var $$IMU_EXPORT$$;
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"
};
}




Expand Down Expand Up @@ -119396,7 +119427,7 @@ var $$IMU_EXPORT$$;

var is_probably_video = function(obj) {
//console_log(obj);
if (obj.media_info.type === "video")
if (obj.media_info && obj.media_info.type === "video")
return true;

if (/\.(?:mp4|webm|mkv|mpg|ogv|wmv|m3u8|mpd)(?:[?#].*)?$/i.test(obj.url))
Expand All @@ -119407,7 +119438,7 @@ var $$IMU_EXPORT$$;

var is_probably_audio = function(obj) {
//console_log(obj);
if (obj.media_info.type === "audio")
if (obj.media_info && obj.media_info.type === "audio")
return true;

if (/\.(?:mp3|m4a|oga|mkv|wma|mp4|ogg)(?:[?#].*)?$/i.test(obj.url))
Expand Down
38 changes: 33 additions & 5 deletions userscript.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -32992,7 +32992,9 @@ var $$IMU_EXPORT$$;
// 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
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?(?:_c[0-9]+)?\/+[0-9a-f]{20,}\./.test(src)) {
// 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) {
Expand All @@ -33012,7 +33014,7 @@ var $$IMU_EXPORT$$;
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?(?:_c[0-9]+)?\/+[0-9a-f]{20,}\.([^/.?#]+)(?:[?#].*)?$/);
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],
Expand Down Expand Up @@ -100350,7 +100352,6 @@ var $$IMU_EXPORT$$;
return src.replace(/^[a-z]+:\/\/[^/]+\/+cache\/+sites\/+.\/+.\/+([^/]+\.[^/]+\/.*?)\/[0-9]+x[0-9]*(?:\([^/]+\)|-[a-z]+)?\/+([^/]+)(?:[?#].*)?$/, "http://$1/$2");
}
if (domain_nowww === "bilibili.com") {
// https://www.bilibili.com/video/BV11t421H7bz/?spm_id_from=333.1073.high_energy.content.click
newsrc = website_query({
website_regex: /^[a-z]+:\/\/[^/]+\/+video\/+([A-Za-z0-9]+)\/*(?:[?#].*)?$/,
query_for_id: "https://www.bilibili.com/video/${id}/",
Expand Down Expand Up @@ -100404,6 +100405,33 @@ var $$IMU_EXPORT$$;
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"
};
}
// -- 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 Expand Up @@ -106554,15 +106582,15 @@ var $$IMU_EXPORT$$;
var mediadelivery_support = {};
var is_probably_video = function(obj) {
//console_log(obj);
if (obj.media_info.type === "video")
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.type === "audio")
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;
Expand Down

0 comments on commit 4ccd2f2

Please sign in to comment.