mirror of
https://github.com/kodjodevf/mangayomi-extensions.git
synced 2026-02-14 10:51:17 +00:00
extension(aniplay): Added preference to "split streams based on quality"
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.2.2",
|
"version": "1.2.3",
|
||||||
"dateFormat": "",
|
"dateFormat": "",
|
||||||
"dateFormatLocale": "",
|
"dateFormatLocale": "",
|
||||||
"pkgPath": "anime/src/en/aniplay.js"
|
"pkgPath": "anime/src/en/aniplay.js"
|
||||||
@@ -409,19 +409,22 @@ class DefaultExtension extends MProvider {
|
|||||||
|
|
||||||
// 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 body = response.body;
|
|
||||||
const lines = body.split('\n');
|
|
||||||
var streams = [{
|
var streams = [{
|
||||||
url: url,
|
url: url,
|
||||||
originalUrl: url,
|
originalUrl: url,
|
||||||
quality: `Auto - ${providerId}`,
|
quality: `Auto - ${providerId}`,
|
||||||
headers: hdr
|
headers: hdr
|
||||||
}];
|
}];
|
||||||
|
var doExtract = this.getPreference("aniplay_pref_extract_streams");
|
||||||
// Pahe only has auto
|
// Pahe only has auto
|
||||||
if (providerId === "pahe") {
|
if (providerId === "pahe" || !doExtract) {
|
||||||
return streams;
|
return streams;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const response = await new Client().get(url, hdr);
|
||||||
|
const body = response.body;
|
||||||
|
const lines = body.split('\n');
|
||||||
|
|
||||||
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];
|
||||||
@@ -582,6 +585,13 @@ class DefaultExtension extends MProvider {
|
|||||||
"entries": ["Sub", "Dub"],
|
"entries": ["Sub", "Dub"],
|
||||||
"entryValues": ["sub", "dub"],
|
"entryValues": ["sub", "dub"],
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
"key": "aniplay_pref_extract_streams",
|
||||||
|
"switchPreferenceCompat": {
|
||||||
|
'title': 'Split stream into different quality streams',
|
||||||
|
"summary": "Split stream Auto into 360p/720p/1080p",
|
||||||
|
"value": true
|
||||||
|
}
|
||||||
},{
|
},{
|
||||||
key: 'aniplay_pref_video_resolution',
|
key: 'aniplay_pref_video_resolution',
|
||||||
listPreference: {
|
listPreference: {
|
||||||
|
|||||||
Reference in New Issue
Block a user