extension(aniplay): Updated aniplay

This commit is contained in:
Swakshan
2025-02-07 22:22:50 +05:30
parent 6499bc3c9c
commit e48fbf7e8b

View File

@@ -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.0", "version": "1.1.2",
"dateFormat": "", "dateFormat": "",
"dateFormatLocale": "", "dateFormatLocale": "",
"pkgPath": "anime/src/en/aniplay.js" "pkgPath": "anime/src/en/aniplay.js"
@@ -19,12 +19,6 @@ class DefaultExtension extends MProvider {
this.client = new Client(); this.client = new Client();
} }
getHeaders(url) {
return {
Referer: this.source.apiUrl
}
}
getPreference(key) { getPreference(key) {
const preferences = new SharedPreferences(); const preferences = new SharedPreferences();
return preferences.get(key); return preferences.get(key);
@@ -294,9 +288,10 @@ class DefaultExtension extends MProvider {
} else if (slug.indexOf("watch/") > -1) { } else if (slug.indexOf("watch/") > -1) {
next_action = '5dbcd21c7c276c4d15f8de29d9ef27aef5ea4a5e' next_action = '5dbcd21c7c276c4d15f8de29d9ef27aef5ea4a5e'
} }
var url = `${this.source.baseUrl}/anime/${slug}` var baseUrl = "https://" + this.getPreference("aniplay_override_base_url")
var url = `${baseUrl}/anime/${slug}`
var headers = { var headers = {
"referer": "https://aniplaynow.live", "referer": baseUrl,
'next-action': next_action, 'next-action': next_action,
"Content-Type": "application/json", "Content-Type": "application/json",
} }
@@ -322,7 +317,7 @@ class DefaultExtension extends MProvider {
throw new Error("Error: No data found for the given URL"); throw new Error("Error: No data found for the given URL");
} }
var user_provider = this.getPreference("aniplay_pref_provider_2"); var user_provider = this.getPreference("aniplay_pref_provider_3");
var choices = result var choices = result
if (user_provider !== "all") { if (user_provider !== "all") {
for (var ch of result) { for (var ch of result) {
@@ -359,7 +354,8 @@ class DefaultExtension extends MProvider {
var format = animeData.format var format = animeData.format
if (format === "MOVIE") chapters[0].name = "Movie" if (format === "MOVIE") chapters[0].name = "Movie"
animeData.link = `${this.source.baseUrl}/anime/${slug}` var baseUrl = "https://" + this.getPreference("aniplay_override_base_url")
animeData.link = `${baseUrl}/anime/${slug}`
animeData.chapters = chapters.reverse() animeData.chapters = chapters.reverse()
return animeData return animeData
} }
@@ -401,9 +397,7 @@ class DefaultExtension extends MProvider {
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];
var m3u8Url = lines[i + 1].trim(); var m3u8Url = lines[i + 1].trim();
if (providerId === "anya") { if (providerId === "yuki") {
m3u8Url = `https://prox.uqable.easypanel.host${m3u8Url}`
} else if (providerId === "yuki") {
var orginalUrl = url var orginalUrl = url
m3u8Url = orginalUrl.replace("master.m3u8", m3u8Url) m3u8Url = orginalUrl.replace("master.m3u8", m3u8Url)
} }
@@ -446,6 +440,29 @@ class DefaultExtension extends MProvider {
return await this.extractStreams(m3u8Url, "pahe", hdr); return await this.extractStreams(m3u8Url, "pahe", hdr);
} }
async getMazeStreams(result) {
var m3u8Url = result.sources[0].url
var hdr = result.headers;
return await this.extractStreams(m3u8Url, "maze", hdr);
}
async getKuroStreams(result) {
var links = result.sources
var hdr = result.headers;
var streams = [];
for (var stream of links) {
var quality = stream.quality
quality = quality == "default" ? "auto" : quality
streams.push({
url: stream.url,
originalUrl: stream.url,
quality: `${quality} - kuro`,
headers: hdr
});
}
return streams
}
// For anime episode video list // For anime episode video list
async getVideoList(url) { async getVideoList(url) {
var urlSplits = url.split("||") var urlSplits = url.split("||")
@@ -474,63 +491,74 @@ class DefaultExtension extends MProvider {
streams = await this.getYukiStreams(result) streams = await this.getYukiStreams(result)
} else if (providerId == "pahe") { } else if (providerId == "pahe") {
streams = await this.getPaheStreams(result) streams = await this.getPaheStreams(result)
} else if (providerId === "maze") {
streams = await this.getMazeStreams(result)
} else if (providerId === "kuro") {
streams = await this.getKuroStreams(result)
} else { } else {
streams = await this.getAnyStreams(result) //If new provider found getAnyaStreams will extract only the streams streams = await this.getAnyStreams(result) //If new provider found getAnyStreams will extract only the streams
} }
return await this.sortStreams(streams) return await this.sortStreams(streams)
} }
getSourcePreferences() { getSourcePreferences() {
return [ return [{
{ key: 'aniplay_override_base_url',
"key": "aniplay_pref_title", listPreference: {
"listPreference": { title: 'Override base url',
"title": "Preferred Title", summary: '',
"summary": "", valueIndex: 0,
"valueIndex": 0, entries: ["aniplaynow.live (Main)", "aniplay.lol (Backup)"],
"entries": ["Romaji", "English", "Native"], entryValues: ["aniplaynow.live", "aniplay.lol"]
"entryValues": ["romaji", "english", "native"], }
} },
}, {
{ "key": "aniplay_pref_title",
"key": "aniplay_pref_provider_2", "listPreference": {
"listPreference": { "title": "Preferred Title",
"title": "Preferred provider", "summary": "",
"summary": "", "valueIndex": 0,
"valueIndex": 0, "entries": ["Romaji", "English", "Native"],
"entries": ["Any", "Yuki", "Pahe"], "entryValues": ["romaji", "english", "native"],
"entryValues": ["any", "yuki", "pahe"], }
} },
}, { {
"key": "aniplay_pref_mark_filler", "key": "aniplay_pref_provider_3",
"switchPreferenceCompat": { "listPreference": {
"title": "Mark filler episodes", "title": "Preferred provider",
"summary": "Filler episodes will be marked with (F)", "summary": "",
"value": false "valueIndex": 0,
} "entries": ["Any", "Yuki", "Pahe", "Maze", "Kuro"],
}, "entryValues": ["any", "yuki", "pahe", "maze", "kuro"],
{ }
"key": "aniplay_pref_audio_type", }, {
"listPreference": { "key": "aniplay_pref_mark_filler",
"title": "Preferred audio type", "switchPreferenceCompat": {
"summary": "Sub/Dub", "title": "Mark filler episodes",
"valueIndex": 0, "summary": "Filler episodes will be marked with (F)",
"entries": ["Sub", "Dub"], "value": false
"entryValues": ["sub", "dub"], }
} },
}, { {
key: 'aniplay_pref_video_resolution', "key": "aniplay_pref_audio_type",
listPreference: { "listPreference": {
title: 'Preferred video resolution', "title": "Preferred audio type",
summary: '', "summary": "Sub/Dub",
valueIndex: 0, "valueIndex": 0,
entries: ["Auto", "1080p", "720p", "480p", "360p"], "entries": ["Sub", "Dub"],
entryValues: ["auto", "1080", "720", "480", "360"] "entryValues": ["sub", "dub"],
} }
}, }, {
key: 'aniplay_pref_video_resolution',
listPreference: {
title: 'Preferred video resolution',
summary: '',
valueIndex: 0,
entries: ["Auto", "1080p", "720p", "480p", "360p"],
entryValues: ["auto", "1080", "720", "480", "360"]
}
},
] ]
} }