Skip to content

Commit

Permalink
More websites/rules
Browse files Browse the repository at this point in the history
  • Loading branch information
qsniyg committed Mar 14, 2024
1 parent 1e6aa13 commit c60f0a9
Show file tree
Hide file tree
Showing 2 changed files with 279 additions and 9 deletions.
152 changes: 147 additions & 5 deletions src/userscript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34036,6 +34036,9 @@ var $$IMU_EXPORT$$;
// https://palmaresadisq.ca/uploads/equisoft/37/2df5f57428653b07f7f9749f6c61788f_250x250.jpg
// https://palmaresadisq.ca/uploads/equisoft/37/2df5f57428653b07f7f9749f6c61788f.jpg
(domain_nowww === "palmaresadisq.ca" && string_indexof(src, "/uploads/") >= 0) ||
// thanks to anonymous for reporting:
// https://image.b2bmilestone.com/9b548baace8311b86ed42435b22d801599ffbb5f/00047740382_01_350x350.jpg
domain === "image.b2bmilestone.com" ||
// https://music-bandlink.s3.yandex.net/img/bandlinks/sGCmi_igXrmdjp_370x370.jpg
// https://music-bandlink.s3.yandex.net/img/bandlinks/sGCmi_igXrmdjp.jpg
domain === "music-bandlink.s3.yandex.net") {
Expand Down Expand Up @@ -77212,20 +77215,28 @@ var $$IMU_EXPORT$$;

// https://players.brightcove.net/4401740954001/default_default/index.html?videoId=6131665209001&autostart=0&disableads=0&disablenextvideo=0
newsrc = website_query({
website_regex: /^([a-z]+:\/\/[^/]+\/+([0-9]+)\/+[^/]+\/+index\.html\?(?:.*&)?videoId=([0-9]+)(?:[&#].*)?)$/,
website_regex: /^([a-z]+:\/\/[^/]+\/+([0-9]+)\/+[^/]+\/+index\.html\?(?:.*&)?videoId=([0-9]+)(?:&.*)?)(?:#.*)?$/,
query_for_id: "${id}",
process: function(done, resp, cache_key, match) {
var account_id = match[2];
var video_id = match[3];

let imuhash = common_functions["parse_imu_hash"](src);
let pk = null;

if (imuhash && imuhash.pk)
pk = imuhash.pk;

var match = resp.responseText.match(/,policyKey:("[^"]+")}},/);
if (!match) {
console_error(cache_key, "Unable to find policyKey match for", resp);
return done(null, false);
if (!pk) {
console_error(cache_key, "Unable to find policyKey match for", resp);
return done(null, false);
}
} else {
pk = JSON_parse(match[1]);
}

var pk = JSON_parse(match[1]);

query_brightcove_video_api(account_id, video_id, pk, function(data) {
var caption = data.name || data.description || data.long_description;
var image = data.poster || data.thumbnail;
Expand Down Expand Up @@ -107700,6 +107711,52 @@ var $$IMU_EXPORT$$;
return src.replace(/(\/images\/+content\/+thumbnail\/+[^/]+\/+)(?:small|medium|large)\/+/, "$1xlarge/");
}

if (domain_nowww === "tver.jp") {
// thanks to nimbuz for reporting:
let query_tver_episode = function(id, cb) {
api_query("tver:" + id, {
url: "https://statics.tver.jp/content/episode/" + id + ".json?v=3",
imu_mode: "xhr",
headers: {
Origin: "https://tver.jp",
Referer: "https://tver.jp/",
"Sec-Fetch-Dest": "empty",
"Sec-Fetch-Mode": "cors",
"Sec-Fetch-Site": "same-site"
},
json: true
}, cb, function(done, resp, cache_key) {
if (!resp) {
return done(null, false);
}

let accountid = resp.video.accountID;
let videoid = resp.video.videoID;

let url = "https://players.brightcove.net/" + accountid + "/default_default/index.html?videoId=" + videoid;
done(url, 6*60*60);
});
};

newsrc = website_query({
website_regex: /^[a-z]+:\/\/[^/]+\/+episodes\/+([0-9a-z]+)(?:[?#].*)?$/,
run(cb, match) {
let ep = match[1];
query_tver_episode(ep, function(url) {
if (!url) {
return cb(null);
}

return cb({
url: url,
is_pagelink: true
});
});
}
});
if (newsrc) return newsrc;
}

if (domain === "ais-cf.tvnow.de") {
// thanks to nimbuz on discord:
// https://ais-cf.tvnow.de/tvnow/format/19445_03artwork/1400x0/eine-schrecklich-nette-familie.jpg
Expand Down Expand Up @@ -113008,6 +113065,91 @@ var $$IMU_EXPORT$$;
return src.replace(/\/thumbs\/+(?:medium|large)_/, "/thumbs/big_");
}

if (domain === "squat.telequebec.tv") {
// thanks to anonymous for reporting:
let query_mnmedias_api = function(id, cb) {
api_query("telequebec_mnmedias:" + id, {
url: "https://mnmedias.api.telequebec.tv/api/v4/player/" + id,
imu_mode: "xhr",
headers: {
Origin: "https://squat.telequebec.tv",
Referer: "https://squat.telequebec.tv/",
"Sec-Fetch-Dest": "empty",
"Sec-Fetch-Mode": "cors",
"Sec-Fetch-Site": "same-site"
},
json: true
}, cb, function(done, resp, cache_key) {
if (!resp)
return done(null, false);

for (let source of resp.streamInfos) {
if (source.source !== "Brightcove")
continue;

let pk = base64_decode("IEJDcGtBRGF3cU0zbEJ6MDdmZFY2UV9fWjhqTTZSZW5Bck1mYU04WW94eUlCZXh6dFAybExCdlh3MlBsa255WGJuS18xTU1TbVh3N3FLcU9NOW1QSS1kb0t2bXFleXdUSjN3S1Z6aGRKU1FOOEp0aGhobXJVVDV6VmlrTVU4T3ZRRUdpclItZTdlN2lxbVpTQw").slice(1);
return done("https://players.brightcove.net/6150020952001/default_default/index.html?videoId=" + source.sourceId + "#imu-pk=" + pk, 6*60*60);
}

console_warn(cache_key, "Unable to find source from", resp);
return done(null, false);
});
};

let query_squat_api = function(id, cb) {
api_query("telequebec_squat:" + id, {
url: "https://squat.api.telequebec.tv/v1/videos/" + id,
imu_mode: "xhr",
headers: {
Origin: "https://squat.telequebec.tv",
Referer: "https://squat.telequebec.tv/",
"Sec-Fetch-Dest": "empty",
"Sec-Fetch-Mode": "cors",
"Sec-Fetch-Site": "same-site"
},
json: true
}, cb, function(done, resp, cache_key) {
if (!resp)
return done(null, false);

if (resp.source !== "mnMedias") {
console_warn(cache_key, "Unknown source for", resp);
return done(null, false);
}

query_mnmedias_api(resp.sourceId, function(url) {
if (!url)
return done(null, false);

return done(url, 6*60*60);
});
});
};

newsrc = website_query({
website_regex: /^[a-z]+:\/\/[^/]+\/+videos\/+([0-9]+)(?:[?#].*)?$/,
run(cb, match) {
query_squat_api(match[1], function(url) {
if (!url)
return cb(null);

return cb({
url: url,
is_pagelink: true
});
})
}
});
if (newsrc) return newsrc;
}

if (domain === "baseec-img-mng.akamaized.net") {
// thanks to nimbuz on discord for reporting:
// https://baseec-img-mng.akamaized.net/images/item/origin/386e956dfcddb55efd9fc6e0da58a59e.jpg?imformat=generic&q=90&im=Resize,width=174,type=normal
// https://baseec-img-mng.akamaized.net/images/item/origin/386e956dfcddb55efd9fc6e0da58a59e.jpg?imformat=generic
return src.replace(/(\/images\/+item\/+[^/]+\/+[^/?#]*)(?:[?#].*)?$/, "$1?imformat=generic");
}




Expand Down
136 changes: 132 additions & 4 deletions userscript.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -31186,6 +31186,9 @@ var $$IMU_EXPORT$$;
// https://palmaresadisq.ca/uploads/equisoft/37/2df5f57428653b07f7f9749f6c61788f_250x250.jpg
// https://palmaresadisq.ca/uploads/equisoft/37/2df5f57428653b07f7f9749f6c61788f.jpg
(domain_nowww === "palmaresadisq.ca" && string_indexof(src, "/uploads/") >= 0) ||
// thanks to anonymous for reporting:
// https://image.b2bmilestone.com/9b548baace8311b86ed42435b22d801599ffbb5f/00047740382_01_350x350.jpg
domain === "image.b2bmilestone.com" ||
// https://music-bandlink.s3.yandex.net/img/bandlinks/sGCmi_igXrmdjp_370x370.jpg
// https://music-bandlink.s3.yandex.net/img/bandlinks/sGCmi_igXrmdjp.jpg
domain === "music-bandlink.s3.yandex.net") {
Expand Down Expand Up @@ -69750,17 +69753,24 @@ var $$IMU_EXPORT$$;
};
// https://players.brightcove.net/4401740954001/default_default/index.html?videoId=6131665209001&autostart=0&disableads=0&disablenextvideo=0
newsrc = website_query({
website_regex: /^([a-z]+:\/\/[^/]+\/+([0-9]+)\/+[^/]+\/+index\.html\?(?:.*&)?videoId=([0-9]+)(?:[&#].*)?)$/,
website_regex: /^([a-z]+:\/\/[^/]+\/+([0-9]+)\/+[^/]+\/+index\.html\?(?:.*&)?videoId=([0-9]+)(?:&.*)?)(?:#.*)?$/,
query_for_id: "${id}",
process: function(done, resp, cache_key, match) {
var account_id = match[2];
var video_id = match[3];
var imuhash = common_functions["parse_imu_hash"](src);
var pk = null;
if (imuhash && imuhash.pk)
pk = imuhash.pk;
var match = resp.responseText.match(/,policyKey:("[^"]+")}},/);
if (!match) {
console_error(cache_key, "Unable to find policyKey match for", resp);
return done(null, false);
if (!pk) {
console_error(cache_key, "Unable to find policyKey match for", resp);
return done(null, false);
}
} else {
pk = JSON_parse(match[1]);
}
var pk = JSON_parse(match[1]);
query_brightcove_video_api(account_id, video_id, pk, function(data) {
var caption = data.name || data.description || data.long_description;
var image = data.poster || data.thumbnail;
Expand Down Expand Up @@ -96683,6 +96693,48 @@ var $$IMU_EXPORT$$;
// https://statics.tver.jp/images/content/thumbnail/episode/xlarge/epck7hqdbe.jpg?v=5
return src.replace(/(\/images\/+content\/+thumbnail\/+[^/]+\/+)(?:small|medium|large)\/+/, "$1xlarge/");
}
if (domain_nowww === "tver.jp") {
// thanks to nimbuz for reporting:
var query_tver_episode_1 = function(id, cb) {
api_query("tver:" + id, {
url: "https://statics.tver.jp/content/episode/" + id + ".json?v=3",
imu_mode: "xhr",
headers: {
Origin: "https://tver.jp",
Referer: "https://tver.jp/",
"Sec-Fetch-Dest": "empty",
"Sec-Fetch-Mode": "cors",
"Sec-Fetch-Site": "same-site"
},
json: true
}, cb, function(done, resp, cache_key) {
if (!resp) {
return done(null, false);
}
var accountid = resp.video.accountID;
var videoid = resp.video.videoID;
var url = "https://players.brightcove.net/" + accountid + "/default_default/index.html?videoId=" + videoid;
done(url, 6 * 60 * 60);
});
};
newsrc = website_query({
website_regex: /^[a-z]+:\/\/[^/]+\/+episodes\/+([0-9a-z]+)(?:[?#].*)?$/,
run: function(cb, match) {
var ep = match[1];
query_tver_episode_1(ep, function(url) {
if (!url) {
return cb(null);
}
return cb({
url: url,
is_pagelink: true
});
});
}
});
if (newsrc)
return newsrc;
}
if (domain === "ais-cf.tvnow.de") {
// thanks to nimbuz on discord:
// https://ais-cf.tvnow.de/tvnow/format/19445_03artwork/1400x0/eine-schrecklich-nette-familie.jpg
Expand Down Expand Up @@ -101446,6 +101498,82 @@ var $$IMU_EXPORT$$;
// https://unc.ua/i2/49/thumbs/big_fantik-ot-konfet-50-60g-g-kurortnaya-harkov_108172.jpeg
return src.replace(/\/thumbs\/+(?:medium|large)_/, "/thumbs/big_");
}
if (domain === "squat.telequebec.tv") {
// thanks to anonymous for reporting:
var query_mnmedias_api_1 = function(id, cb) {
api_query("telequebec_mnmedias:" + id, {
url: "https://mnmedias.api.telequebec.tv/api/v4/player/" + id,
imu_mode: "xhr",
headers: {
Origin: "https://squat.telequebec.tv",
Referer: "https://squat.telequebec.tv/",
"Sec-Fetch-Dest": "empty",
"Sec-Fetch-Mode": "cors",
"Sec-Fetch-Site": "same-site"
},
json: true
}, cb, function(done, resp, cache_key) {
if (!resp)
return done(null, false);
for (var _i = 0, _a = resp.streamInfos; _i < _a.length; _i++) {
var source = _a[_i];
if (source.source !== "Brightcove")
continue;
var pk = base64_decode("IEJDcGtBRGF3cU0zbEJ6MDdmZFY2UV9fWjhqTTZSZW5Bck1mYU04WW94eUlCZXh6dFAybExCdlh3MlBsa255WGJuS18xTU1TbVh3N3FLcU9NOW1QSS1kb0t2bXFleXdUSjN3S1Z6aGRKU1FOOEp0aGhobXJVVDV6VmlrTVU4T3ZRRUdpclItZTdlN2lxbVpTQw").slice(1);
return done("https://players.brightcove.net/6150020952001/default_default/index.html?videoId=" + source.sourceId + "#imu-pk=" + pk, 6 * 60 * 60);
}
console_warn(cache_key, "Unable to find source from", resp);
return done(null, false);
});
};
var query_squat_api_1 = function(id, cb) {
api_query("telequebec_squat:" + id, {
url: "https://squat.api.telequebec.tv/v1/videos/" + id,
imu_mode: "xhr",
headers: {
Origin: "https://squat.telequebec.tv",
Referer: "https://squat.telequebec.tv/",
"Sec-Fetch-Dest": "empty",
"Sec-Fetch-Mode": "cors",
"Sec-Fetch-Site": "same-site"
},
json: true
}, cb, function(done, resp, cache_key) {
if (!resp)
return done(null, false);
if (resp.source !== "mnMedias") {
console_warn(cache_key, "Unknown source for", resp);
return done(null, false);
}
query_mnmedias_api_1(resp.sourceId, function(url) {
if (!url)
return done(null, false);
return done(url, 6 * 60 * 60);
});
});
};
newsrc = website_query({
website_regex: /^[a-z]+:\/\/[^/]+\/+videos\/+([0-9]+)(?:[?#].*)?$/,
run: function(cb, match) {
query_squat_api_1(match[1], function(url) {
if (!url)
return cb(null);
return cb({
url: url,
is_pagelink: true
});
});
}
});
if (newsrc)
return newsrc;
}
if (domain === "baseec-img-mng.akamaized.net") {
// thanks to nimbuz on discord for reporting:
// https://baseec-img-mng.akamaized.net/images/item/origin/386e956dfcddb55efd9fc6e0da58a59e.jpg?imformat=generic&q=90&im=Resize,width=174,type=normal
// https://baseec-img-mng.akamaized.net/images/item/origin/386e956dfcddb55efd9fc6e0da58a59e.jpg?imformat=generic
return src.replace(/(\/images\/+item\/+[^/]+\/+[^/?#]*)(?:[?#].*)?$/, "$1?imformat=generic");
}
// -- 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 c60f0a9

Please sign in to comment.