mirror of
https://github.com/kodjodevf/mangayomi-extensions.git
synced 2026-02-14 10:51:17 +00:00
extension(aniplay): Updated aniplay
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.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,17 +491,28 @@ 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',
|
||||||
|
listPreference: {
|
||||||
|
title: 'Override base url',
|
||||||
|
summary: '',
|
||||||
|
valueIndex: 0,
|
||||||
|
entries: ["aniplaynow.live (Main)", "aniplay.lol (Backup)"],
|
||||||
|
entryValues: ["aniplaynow.live", "aniplay.lol"]
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"key": "aniplay_pref_title",
|
"key": "aniplay_pref_title",
|
||||||
"listPreference": {
|
"listPreference": {
|
||||||
@@ -496,13 +524,13 @@ class DefaultExtension extends MProvider {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": "aniplay_pref_provider_2",
|
"key": "aniplay_pref_provider_3",
|
||||||
"listPreference": {
|
"listPreference": {
|
||||||
"title": "Preferred provider",
|
"title": "Preferred provider",
|
||||||
"summary": "",
|
"summary": "",
|
||||||
"valueIndex": 0,
|
"valueIndex": 0,
|
||||||
"entries": ["Any", "Yuki", "Pahe"],
|
"entries": ["Any", "Yuki", "Pahe", "Maze", "Kuro"],
|
||||||
"entryValues": ["any", "yuki", "pahe"],
|
"entryValues": ["any", "yuki", "pahe", "maze", "kuro"],
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
"key": "aniplay_pref_mark_filler",
|
"key": "aniplay_pref_mark_filler",
|
||||||
|
|||||||
Reference in New Issue
Block a user