Skip to content

Commit

Permalink
More websites/rules
Browse files Browse the repository at this point in the history
Fixes #1252
  • Loading branch information
qsniyg committed Jan 9, 2024
1 parent 2101809 commit 1b1555f
Show file tree
Hide file tree
Showing 2 changed files with 120 additions and 23 deletions.
76 changes: 65 additions & 11 deletions src/userscript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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");
}




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

Expand Down Expand Up @@ -114499,19 +114528,35 @@ var $$IMU_EXPORT$$;
url: string,
data: any
}
var bigimage_recursive_loop = function(url, options, query, fine_urls?:Array<BRLFineUrl>, tried_urls?:Array<BRLTriedUrl>, oldobj?:Array<any>) {
type BRLState = {
fine_urls: Array<BRLFineUrl>,
tried_urls: Array<BRLTriedUrl>,
oldobj: Array<any>,
tried_imus: Array<string>
}
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") {
Expand Down Expand Up @@ -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]];
Expand Down Expand Up @@ -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;
Expand Down
67 changes: 55 additions & 12 deletions userscript.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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]];
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 1b1555f

Please sign in to comment.