mirror of
https://git.luna-app.eu/50n50/sources
synced 2025-12-21 21:26:19 +01:00
Update anicore/anicore.js
This commit is contained in:
parent
33384262c9
commit
5c5590a573
1 changed files with 40 additions and 6 deletions
|
|
@ -177,6 +177,7 @@ async function extractStreamUrl(url) {
|
|||
|
||||
const streams = [];
|
||||
let englishSubtitle = "";
|
||||
let zenResult = null;
|
||||
|
||||
for (const result of streamResults) {
|
||||
if (result.data && result.data.sources && result.data.sources.length > 0) {
|
||||
|
|
@ -188,12 +189,45 @@ async function extractStreamUrl(url) {
|
|||
headers: result.data.headers || {}
|
||||
});
|
||||
|
||||
if (!englishSubtitle && result.type === 'sub' && result.data.subtitles && Array.isArray(result.data.subtitles)) {
|
||||
const engSub = result.data.subtitles.find(sub =>
|
||||
sub.language === 'eng' || sub.language === 'en' || sub.name === 'eng' || sub.name === 'en'
|
||||
);
|
||||
if (engSub) {
|
||||
englishSubtitle = engSub.url || "";
|
||||
if (result.provider === 'zen' && result.type === 'sub') {
|
||||
zenResult = result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (zenResult && zenResult.data && Array.isArray(zenResult.data.subtitles)) {
|
||||
const engSub = zenResult.data.subtitles.find(sub =>
|
||||
(sub.lang.includes('eng') || sub.lang.includes('en')) &&
|
||||
!sub.label.toLowerCase().includes('signs') &&
|
||||
!sub.label.toLowerCase().includes('songs')
|
||||
);
|
||||
if (engSub) {
|
||||
englishSubtitle = engSub.url || "";
|
||||
}
|
||||
}
|
||||
|
||||
if (!englishSubtitle) {
|
||||
for (const result of streamResults) {
|
||||
if (result.type === 'sub' && result.data) {
|
||||
if (Array.isArray(result.data.subtitles)) {
|
||||
const engSub = result.data.subtitles.find(sub =>
|
||||
(sub.lang.includes('eng') || sub.lang.includes('en') ||
|
||||
sub.language === 'eng' || sub.language === 'en' || sub.name === 'eng' || sub.name === 'en') &&
|
||||
!(sub.label && (sub.label.toLowerCase().includes('signs') || sub.label.toLowerCase().includes('songs')))
|
||||
);
|
||||
if (engSub) {
|
||||
englishSubtitle = engSub.url || "";
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!englishSubtitle && Array.isArray(result.data.audio)) {
|
||||
const engAudio = result.data.audio.find(audio =>
|
||||
audio.language === 'eng' || audio.language === 'en' || audio.name === 'eng' || audio.name === 'en'
|
||||
);
|
||||
if (engAudio) {
|
||||
englishSubtitle = engAudio.url || "";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue