Merge pull request #217 from Swakshan/anime/aniplay

Update: Aniplay
This commit is contained in:
Moustapha Kodjo Amadou
2025-04-12 18:50:04 +01:00
committed by GitHub

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.3.0", "version": "1.3.2",
"dateFormat": "", "dateFormat": "",
"dateFormatLocale": "", "dateFormatLocale": "",
"pkgPath": "anime/src/en/aniplay.js" "pkgPath": "anime/src/en/aniplay.js"
@@ -28,120 +28,120 @@ class DefaultExtension extends MProvider {
// code from torrentioanime.js // code from torrentioanime.js
anilistQuery() { anilistQuery() {
return ` return `
query ($page: Int, $perPage: Int, $sort: [MediaSort], $search: String) { query ($page: Int, $perPage: Int, $sort: [MediaSort], $search: String) {
Page(page: $page, perPage: $perPage) { Page(page: $page, perPage: $perPage) {
pageInfo { pageInfo {
currentPage currentPage
hasNextPage hasNextPage
}
media(type: ANIME, sort: $sort, search: $search, status_in: [RELEASING, FINISHED, NOT_YET_RELEASED]) {
id
title {
romaji
english
native
} }
coverImage { media(type: ANIME, sort: $sort, search: $search, status_in: [RELEASING, FINISHED, NOT_YET_RELEASED]) {
extraLarge id
large title {
} romaji
description english
status native
tags { }
name coverImage {
} extraLarge
genres large
studios { }
nodes { description
status
tags {
name name
} }
genres
studios {
nodes {
name
}
}
countryOfOrigin
isAdult
} }
countryOfOrigin
isAdult
} }
} }
} `.trim();
`.trim();
} }
// code from torrentioanime.js // code from torrentioanime.js
anilistLatestQuery() { anilistLatestQuery() {
const currentTimeInSeconds = Math.floor(Date.now() / 1000); const currentTimeInSeconds = Math.floor(Date.now() / 1000);
return ` return `
query ($page: Int, $perPage: Int, $sort: [AiringSort]) { query ($page: Int, $perPage: Int, $sort: [AiringSort]) {
Page(page: $page, perPage: $perPage) { Page(page: $page, perPage: $perPage) {
pageInfo { pageInfo {
currentPage currentPage
hasNextPage hasNextPage
}
airingSchedules(
airingAt_greater: 0
airingAt_lesser: ${currentTimeInSeconds - 10000}
sort: $sort
) {
media {
id
title {
romaji
english
native
} }
coverImage { airingSchedules(
extraLarge airingAt_greater: 0
large airingAt_lesser: ${currentTimeInSeconds - 10000}
} sort: $sort
description ) {
status media {
tags { id
name title {
} romaji
genres english
studios { native
nodes { }
coverImage {
extraLarge
large
}
description
status
tags {
name name
} }
genres
studios {
nodes {
name
}
}
countryOfOrigin
isAdult
}
} }
countryOfOrigin
isAdult
}
} }
} }
} `.trim();
`.trim();
} }
// code from torrentioanime.js // code from torrentioanime.js
async getAnimeDetails(anilistId) { async getAnimeDetails(anilistId) {
const query = ` const query = `
query($id: Int){ query($id: Int){
Media(id: $id){ Media(id: $id){
id id
title { title {
romaji romaji
english english
native native
} }
coverImage { coverImage {
extraLarge extraLarge
large large
} }
description description
status status
tags { tags {
name
}
genres
studios {
nodes {
name name
} }
genres
studios {
nodes {
name
}
}
format
countryOfOrigin
isAdult
} }
format
countryOfOrigin
isAdult
} }
} `.trim();
`.trim();
const variables = JSON.stringify({ id: anilistId }); const variables = JSON.stringify({ id: anilistId });
@@ -283,23 +283,23 @@ class DefaultExtension extends MProvider {
} }
async aniplayRequest(slug, body) { async aniplayRequest(slug, body) {
var next_action_1 = ""
var next_action_2 = ""
if (slug.indexOf("info/") > -1) {
next_action_1 = '7f07777b5f74e3edb312e0b718a560f9d3ad21aeba'
next_action_2 = '7f57233b7a6486e8211b883c502fa0450775f0ee98'
} else if (slug.indexOf("watch/") > -1) {
next_action_1 = '7f11490e43dca1ed90fcb5b90bac1e5714a3e11232'
next_action_2 = '7f48c7ffeb25edece852102a65d794a1dffa37aaac'
}
var baseUrl = "https://" + this.getPreference("aniplay_override_base_url") var baseUrl = "https://" + this.getPreference("aniplay_override_base_url")
// For aniplay.lol use next_action_2 header var next_action_overrides = this.getPreference("aniplay_next_action_key").split("||")
var next_action = next_action_1 var next_action_key = 0
if (baseUrl.endsWith(".lol")) { if (baseUrl.endsWith(".lol")) {
next_action = next_action_2 next_action_key = 1
} }
var next_action_values = next_action_overrides[next_action_key].split(":")
var next_action = ""
if (slug.indexOf("info/") > -1) {
next_action = next_action_values[0]
} else if (slug.indexOf("watch/") > -1) {
next_action = next_action_values[1]
}
var url = `${baseUrl}/anime/${slug}` var url = `${baseUrl}/anime/${slug}`
var headers = { var headers = {
@@ -568,6 +568,15 @@ class DefaultExtension extends MProvider {
"entries": ["Romaji", "English", "Native"], "entries": ["Romaji", "English", "Native"],
"entryValues": ["romaji", "english", "native"], "entryValues": ["romaji", "english", "native"],
} }
}, {
key: "aniplay_next_action_key",
editTextPreference: {
title: "Override next_action key",
summary: "",
value: "7f328d44382d74f2942c42d0bc9915b2d510628a02:7f702090c0d779331a0b55e1ee0cfea85ff4cb963a||7fe26ef575b85a8a7166a411dba3a21263fe5b9306:7fbb025dd45b14410eb1a8ffcbb4615b0a5a1e5c3c",
dialogTitle: "Override next_action key",
dialogMessage: "",
}
}, },
{ {
"key": "aniplay_pref_provider_3", "key": "aniplay_pref_provider_3",