Update anime providers
This commit is contained in:
@@ -294,6 +294,7 @@ async function processServer(server) {
|
|||||||
headers: {
|
headers: {
|
||||||
"X-Requested-With": "XMLHttpRequest",
|
"X-Requested-With": "XMLHttpRequest",
|
||||||
},
|
},
|
||||||
|
timeout: 7000,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -313,6 +314,7 @@ async function processServer(server) {
|
|||||||
"X-Requested-With": "XMLHttpRequest",
|
"X-Requested-With": "XMLHttpRequest",
|
||||||
Referer: baseUrl,
|
Referer: baseUrl,
|
||||||
},
|
},
|
||||||
|
timeout: 7000,
|
||||||
});
|
});
|
||||||
|
|
||||||
const $iframe = cheerio.load(iframeRes.data);
|
const $iframe = cheerio.load(iframeRes.data);
|
||||||
@@ -342,6 +344,7 @@ async function processServer(server) {
|
|||||||
"X-Requested-With": "XMLHttpRequest",
|
"X-Requested-With": "XMLHttpRequest",
|
||||||
Referer: playerReferer,
|
Referer: playerReferer,
|
||||||
},
|
},
|
||||||
|
timeout: 7000,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -353,7 +356,9 @@ async function processServer(server) {
|
|||||||
: rawSrc.file ||
|
: rawSrc.file ||
|
||||||
rawSrc.url ||
|
rawSrc.url ||
|
||||||
(Array.isArray(rawSrc)
|
(Array.isArray(rawSrc)
|
||||||
? rawSrc[0]?.file || rawSrc[0]?.url || (typeof rawSrc[0] === "string" ? rawSrc[0] : null)
|
? rawSrc[0]?.file ||
|
||||||
|
rawSrc[0]?.url ||
|
||||||
|
(typeof rawSrc[0] === "string" ? rawSrc[0] : null)
|
||||||
: null);
|
: null);
|
||||||
if (m3u8Url) {
|
if (m3u8Url) {
|
||||||
try {
|
try {
|
||||||
@@ -413,21 +418,39 @@ async function fetchEpisodeSources(episodeIdStr, category = null) {
|
|||||||
headers: {
|
headers: {
|
||||||
"X-Requested-With": "XMLHttpRequest",
|
"X-Requested-With": "XMLHttpRequest",
|
||||||
},
|
},
|
||||||
|
timeout: 7000,
|
||||||
});
|
});
|
||||||
|
|
||||||
const $ = cheerio.load(serverRes.data.result);
|
const $ = cheerio.load(serverRes.data.result);
|
||||||
|
|
||||||
let selector =
|
|
||||||
".type[data-type='sub'] li, .type[data-type='dub'] li, .type[data-type='hsub'] li";
|
|
||||||
|
|
||||||
const servers = [];
|
const servers = [];
|
||||||
$(selector).each((i, el) => {
|
$(
|
||||||
const type = $(el).closest(".type").attr("data-type");
|
".psps-links .item, .psps-links li, .type-server li, [data-type] li, li[data-link-id], li[data-id], .server-item",
|
||||||
servers.push({
|
).each((i, el) => {
|
||||||
type: type,
|
const parentWithType = $(el).closest("[data-type]");
|
||||||
linkId: $(el).attr("data-link-id"),
|
let type =
|
||||||
name: $(el).text().trim(),
|
$(el).attr("data-type") ||
|
||||||
});
|
(parentWithType.length ? parentWithType.attr("data-type") : "");
|
||||||
|
if (!type) {
|
||||||
|
const parentClass =
|
||||||
|
($(el).attr("class") || "") +
|
||||||
|
" " +
|
||||||
|
($(el).parent().attr("class") || "") +
|
||||||
|
" " +
|
||||||
|
($(el).closest("[class]").attr("class") || "");
|
||||||
|
if (parentClass.includes("dub")) type = "dub";
|
||||||
|
else if (parentClass.includes("hsub")) type = "hsub";
|
||||||
|
else if (parentClass.includes("sub")) type = "sub";
|
||||||
|
}
|
||||||
|
const linkId = $(el).attr("data-link-id") || $(el).attr("data-id");
|
||||||
|
const name = $(el).text().trim() || $(el).find("a").text().trim();
|
||||||
|
if (linkId) {
|
||||||
|
servers.push({
|
||||||
|
type: (type || "sub").toLowerCase(),
|
||||||
|
linkId: linkId,
|
||||||
|
name: name || "Server",
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let targetServers = servers;
|
let targetServers = servers;
|
||||||
@@ -444,6 +467,33 @@ async function fetchEpisodeSources(episodeIdStr, category = null) {
|
|||||||
}
|
}
|
||||||
return typeLower === catLower;
|
return typeLower === catLower;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
targetServers.sort((a, b) => {
|
||||||
|
const aName = (a.name || "").toLowerCase();
|
||||||
|
const bName = (b.name || "").toLowerCase();
|
||||||
|
const getServerScore = (n) => {
|
||||||
|
if (
|
||||||
|
n.includes("hd-1") ||
|
||||||
|
n.includes("megacloud") ||
|
||||||
|
n.includes("hd-2") ||
|
||||||
|
n.includes("megaplay") ||
|
||||||
|
n.includes("hd 1") ||
|
||||||
|
n.includes("hd 2")
|
||||||
|
)
|
||||||
|
return 10;
|
||||||
|
if (n.includes("vidplay")) return 8;
|
||||||
|
if (
|
||||||
|
n.includes("vidstream-1") ||
|
||||||
|
n.includes("vidstream 1") ||
|
||||||
|
n === "vidstream"
|
||||||
|
)
|
||||||
|
return 5;
|
||||||
|
if (n.includes("vidstream-2") || n.includes("vidstream 2")) return 1;
|
||||||
|
if (n.includes("vidstream")) return 2;
|
||||||
|
return 3;
|
||||||
|
};
|
||||||
|
return getServerScore(bName) - getServerScore(aName);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const requestedCategory = (category || "sub").toLowerCase();
|
const requestedCategory = (category || "sub").toLowerCase();
|
||||||
@@ -457,6 +507,9 @@ async function fetchEpisodeSources(episodeIdStr, category = null) {
|
|||||||
linkId: s.linkId,
|
linkId: s.linkId,
|
||||||
lang: s.type || requestedCategory,
|
lang: s.type || requestedCategory,
|
||||||
type: s.type || requestedCategory,
|
type: s.type || requestedCategory,
|
||||||
|
isDub: (s.type || requestedCategory) === "dub",
|
||||||
|
isSub: (s.type || requestedCategory) === "sub",
|
||||||
|
isHsub: (s.type || requestedCategory) === "hsub",
|
||||||
isUnresolved: true,
|
isUnresolved: true,
|
||||||
rawServer: s,
|
rawServer: s,
|
||||||
}));
|
}));
|
||||||
@@ -473,7 +526,7 @@ async function fetchEpisodeSources(episodeIdStr, category = null) {
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: "anikoto",
|
name: "anikoto",
|
||||||
version: "5.0.1",
|
version: "5.0.2",
|
||||||
SearchAnime,
|
SearchAnime,
|
||||||
AnimeInfo,
|
AnimeInfo,
|
||||||
fetchEpisodeSources,
|
fetchEpisodeSources,
|
||||||
|
|||||||
@@ -280,11 +280,15 @@ async function fetchEpisodeSources(episodeId, category = null) {
|
|||||||
|
|
||||||
const servers = [];
|
const servers = [];
|
||||||
|
|
||||||
$(".lang-group, .server-group, [data-lang]").each((i, panel) => {
|
$(
|
||||||
|
".lang-group, .server-group, .servers-group, [data-lang], [data-type], .dub, .sub, .hsub",
|
||||||
|
).each((i, panel) => {
|
||||||
let rawType = (
|
let rawType = (
|
||||||
$(panel).attr("data-lang") ||
|
$(panel).attr("data-lang") ||
|
||||||
$(panel).attr("data-type") ||
|
$(panel).attr("data-type") ||
|
||||||
$(panel).attr("data-id") ||
|
$(panel).attr("data-id") ||
|
||||||
|
$(panel).attr("class") ||
|
||||||
|
$(panel).attr("id") ||
|
||||||
""
|
""
|
||||||
).toLowerCase();
|
).toLowerCase();
|
||||||
|
|
||||||
@@ -302,7 +306,7 @@ async function fetchEpisodeSources(episodeId, category = null) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$(panel)
|
$(panel)
|
||||||
.find("button.server-video, a.server-video, .server-item")
|
.find("button.server-video, a.server-video, .server-item, button, a")
|
||||||
.each((j, btn) => {
|
.each((j, btn) => {
|
||||||
const videoUrl =
|
const videoUrl =
|
||||||
$(btn).attr("data-video") ||
|
$(btn).attr("data-video") ||
|
||||||
@@ -322,6 +326,7 @@ async function fetchEpisodeSources(episodeId, category = null) {
|
|||||||
let btnRaw = (
|
let btnRaw = (
|
||||||
$(btn).attr("data-lang") ||
|
$(btn).attr("data-lang") ||
|
||||||
$(btn).attr("data-type") ||
|
$(btn).attr("data-type") ||
|
||||||
|
$(btn).attr("class") ||
|
||||||
""
|
""
|
||||||
).toLowerCase();
|
).toLowerCase();
|
||||||
|
|
||||||
@@ -618,11 +623,12 @@ async function processEmbedServer(server) {
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: "anineko",
|
name: "anineko",
|
||||||
version: "3.0.2",
|
version: "3.0.3",
|
||||||
SearchAnime,
|
SearchAnime,
|
||||||
AnimeInfo,
|
AnimeInfo,
|
||||||
fetchEpisodeSources,
|
fetchEpisodeSources,
|
||||||
processServer: processEmbedServer,
|
processServer: processEmbedServer,
|
||||||
|
processEmbedServer,
|
||||||
fetchRecentEpisodes,
|
fetchRecentEpisodes,
|
||||||
fetchEpisode,
|
fetchEpisode,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -301,17 +301,6 @@ async function processServer(server) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
name: "pahe",
|
|
||||||
version: "3.1.4",
|
|
||||||
SearchAnime,
|
|
||||||
AnimeInfo,
|
|
||||||
fetchEpisodeSources,
|
|
||||||
processServer,
|
|
||||||
fetchRecentEpisodes,
|
|
||||||
fetchEpisode,
|
|
||||||
};
|
|
||||||
|
|
||||||
// helpers for extracting video links
|
// helpers for extracting video links
|
||||||
function extractQualityNumber(qualityString) {
|
function extractQualityNumber(qualityString) {
|
||||||
const match = qualityString.match(/\d+p/);
|
const match = qualityString.match(/\d+p/);
|
||||||
@@ -357,7 +346,7 @@ async function extract(videoUrl, retries = 2, delay = 1000) {
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: "pahe",
|
name: "pahe",
|
||||||
version: "4.0.0",
|
version: "4.0.1",
|
||||||
SearchAnime,
|
SearchAnime,
|
||||||
AnimeInfo,
|
AnimeInfo,
|
||||||
fetchEpisodeSources,
|
fetchEpisodeSources,
|
||||||
|
|||||||
Reference in New Issue
Block a user