mirror of
https://github.com/kodjodevf/mangayomi-extensions.git
synced 2026-02-14 10:51:17 +00:00
extension(aniplay): added stream proxy
This commit is contained in:
@@ -6,7 +6,7 @@ const mangayomiSources = [{
|
|||||||
"iconUrl": "https://www.google.com/s2/favicons?sz=128&domain=https://aniplaynow.live/",
|
"iconUrl": "https://www.google.com/s2/favicons?sz=128&domain=https://aniplaynow.live/",
|
||||||
"typeSource": "single",
|
"typeSource": "single",
|
||||||
"itemType": 1,
|
"itemType": 1,
|
||||||
"version": "1.1.3",
|
"version": "1.2.0",
|
||||||
"dateFormat": "",
|
"dateFormat": "",
|
||||||
"dateFormatLocale": "",
|
"dateFormatLocale": "",
|
||||||
"pkgPath": "anime/src/en/aniplay.js"
|
"pkgPath": "anime/src/en/aniplay.js"
|
||||||
@@ -383,6 +383,30 @@ class DefaultExtension extends MProvider {
|
|||||||
return [...sortedStreams, ...copyStreams]
|
return [...sortedStreams, ...copyStreams]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Adds proxy to streams
|
||||||
|
async streamProxy(providerId, streams) {
|
||||||
|
var proxyBaseUrl = this.getPreference("aniplay_stream_proxy");
|
||||||
|
var slug = "/fetch?url="
|
||||||
|
var ref = "&ref="
|
||||||
|
if (providerId == "yuki") {
|
||||||
|
slug = "/zoroprox?url="
|
||||||
|
ref = ""
|
||||||
|
} else if (providerId == "pahe") {
|
||||||
|
ref += "https://kwik.si"
|
||||||
|
} else if (providerId === "maze") {
|
||||||
|
ref += "https://animez.org"
|
||||||
|
} else if (providerId === "kuro") {
|
||||||
|
ref = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
streams.forEach(stream => {
|
||||||
|
stream.url = proxyBaseUrl + slug + stream.url + ref;
|
||||||
|
stream.originalUrl = proxyBaseUrl + slug + stream.originalUrl + ref;
|
||||||
|
});
|
||||||
|
|
||||||
|
return streams
|
||||||
|
}
|
||||||
|
|
||||||
// Extracts the streams url for different resolutions from a hls stream.
|
// Extracts the streams url for different resolutions from a hls stream.
|
||||||
async extractStreams(url, providerId, hdr = {}) {
|
async extractStreams(url, providerId, hdr = {}) {
|
||||||
const response = await new Client().get(url, hdr);
|
const response = await new Client().get(url, hdr);
|
||||||
@@ -394,7 +418,10 @@ class DefaultExtension extends MProvider {
|
|||||||
quality: `Auto - ${providerId}`,
|
quality: `Auto - ${providerId}`,
|
||||||
headers: hdr
|
headers: hdr
|
||||||
}];
|
}];
|
||||||
|
// Pahe only has auto
|
||||||
|
if (providerId === "pahe") {
|
||||||
|
return streams;
|
||||||
|
}
|
||||||
for (let i = 0; i < lines.length; i++) {
|
for (let i = 0; i < lines.length; i++) {
|
||||||
if (lines[i].startsWith('#EXT-X-STREAM-INF:')) {
|
if (lines[i].startsWith('#EXT-X-STREAM-INF:')) {
|
||||||
var resolution = lines[i].match(/RESOLUTION=(\d+x\d+)/)[1];
|
var resolution = lines[i].match(/RESOLUTION=(\d+x\d+)/)[1];
|
||||||
@@ -417,7 +444,7 @@ class DefaultExtension extends MProvider {
|
|||||||
|
|
||||||
async getAnyStreams(result) {
|
async getAnyStreams(result) {
|
||||||
var m3u8Url = result.sources[0].url
|
var m3u8Url = result.sources[0].url
|
||||||
return await this.extractStreams(m3u8Url, "anya");
|
return await this.extractStreams(m3u8Url, "any");
|
||||||
}
|
}
|
||||||
|
|
||||||
async getYukiStreams(result) {
|
async getYukiStreams(result) {
|
||||||
@@ -501,6 +528,7 @@ class DefaultExtension extends MProvider {
|
|||||||
streams = await this.getAnyStreams(result) //If new provider found getAnyStreams will extract only the streams
|
streams = await this.getAnyStreams(result) //If new provider found getAnyStreams will extract only the streams
|
||||||
}
|
}
|
||||||
|
|
||||||
|
streams = await this.streamProxy(providerId, streams)
|
||||||
return await this.sortStreams(streams)
|
return await this.sortStreams(streams)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -560,7 +588,16 @@ class DefaultExtension extends MProvider {
|
|||||||
entries: ["Auto", "1080p", "720p", "480p", "360p"],
|
entries: ["Auto", "1080p", "720p", "480p", "360p"],
|
||||||
entryValues: ["auto", "1080", "720", "480", "360"]
|
entryValues: ["auto", "1080", "720", "480", "360"]
|
||||||
}
|
}
|
||||||
},
|
}, {
|
||||||
|
key: "aniplay_stream_proxy",
|
||||||
|
editTextPreference: {
|
||||||
|
title: "Override stream proxy url",
|
||||||
|
summary: "https://prox.aniplaynow.live",
|
||||||
|
value: "https://prox.aniplaynow.live",
|
||||||
|
dialogTitle: "Override stream proxy url",
|
||||||
|
dialogMessage: "",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user