Prefer reachable Megaplay CDN sources

This commit is contained in:
Dymas
2026-09-10 09:28:14 +02:00
parent 6e68f762b7
commit 9c4c6437f4
5 changed files with 32 additions and 20 deletions
+4 -3
View File
@@ -4952,7 +4952,7 @@ provider.fetchEpisode("123").then((data) => {
def test_anikoto_process_server_decodes_encrypted_megaplay_sources(self):
script = r"""
const encryptedPayload = "wdeBruh3qqn_i5wUNnyaPQQl1wp7r0SrL6KQPNFd24_nH3bjQ-zZlyDs9ryZRqOqluMFxGXpzqi4xA9i5N3T4SDfaQAFzkb6BCj2QorrmxfAd1_nBhcma5SSJZ9rSUWBrBzsNlbhi3a9aCjlekwZGRoHmqEcH3gn2pl0RNQ2JsM";
const encryptedPayload = "wdeBruh3qqn_i5wUNnyaPbW9ZonPa4hISsp_E11QSCvgMDwqFDKp4YU05edNoqP7oBt0VrdAY8ZIJSs6S-axabGaqAYhyjxDjPGgJ58M9y9y4vWP8mNi0PiPKVQ2bHBRhkqlVFSz5WHTMs6CrfU3KVwQZ1ZH2ymo75JCecqjQJo";
global.setDynamicReferer = () => {};
global.setFallbackReferer = () => {};
global.axios = {
@@ -4973,7 +4973,7 @@ global.axios = {
`
};
}
if (url.includes("/stream/getSources?id=179510&type=dub&cidu=6aa1ade0620e3")) {
if (url.includes("/stream/getSources?id=179510&type=dub&cidu=6aa1ade0620e3&s=bcdn")) {
return { data: { enc: encryptedPayload, tracks: [{ file: "https://cdn.example/sub.vtt", label: "English" }] } };
}
throw new Error(`unexpected url ${url}`);
@@ -4999,10 +4999,11 @@ provider.processServer({ name: "HD-2", type: "dub", linkId: "dub-link" }).then((
source = json.loads(proc.stdout)
self.assertEqual(
source["url"],
"https://cdn.imgnex.top/anime/a7e93c78e547abf7dce1e0f3f0b77977/0eb80d76b8867b42b6e6e62ebe515704/master.m3u8",
"https://ncdn.imgnex.top/anime/a7e93c78e547abf7dce1e0f3f0b77977/0eb80d76b8867b42b6e6e62ebe515704/master.m3u8",
)
self.assertEqual(source["type"], "dub")
self.assertEqual(source["subtitles"][0]["url"], "https://cdn.example/sub.vtt")
self.assertEqual(source["subtitles"][0]["referer"], "https://megaplay.buzz/")
def test_provider_downloader_tries_next_same_provider_source_after_failure(self):
calls = []