mirror of
https://github.com/kodjodevf/mangayomi-extensions.git
synced 2026-02-14 10:51:17 +00:00
extension(netflixMirror): Added 1080p support
This commit is contained in:
@@ -36,9 +36,10 @@ class DefaultExtension extends MProvider {
|
|||||||
preferences.setString("cookie", cookie);
|
preferences.setString("cookie", cookie);
|
||||||
return cookie;
|
return cookie;
|
||||||
}
|
}
|
||||||
async request(url, cookie) {
|
async request(url, cookie, tvApi = false) {
|
||||||
cookie = cookie ?? await this.getCookie();
|
cookie = cookie ?? await this.getCookie();
|
||||||
return (await new Client().get(this.source.baseUrl + url, { "cookie": cookie })).body;
|
var api = tvApi ? this.getTVApi() : this.source.baseUrl;
|
||||||
|
return (await new Client().get(api + url, { "cookie": cookie })).body;
|
||||||
}
|
}
|
||||||
async getPopular(page) {
|
async getPopular(page) {
|
||||||
return await this.getPages(await this.request("/home"), ".tray-container, #top10")
|
return await this.getPages(await this.request("/home"), ".tray-container, #top10")
|
||||||
@@ -136,78 +137,63 @@ class DefaultExtension extends MProvider {
|
|||||||
return episodes;
|
return episodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async getVideoList(url) {
|
async getVideoList(url) {
|
||||||
const baseUrl = this.source.baseUrl;
|
const baseUrl = this.getTVApi();
|
||||||
const urlData = JSON.parse(url);
|
const urlData = JSON.parse(url);
|
||||||
const data = JSON.parse(await this.request(`/playlist.php?id=${urlData.id}&t=${urlData.name}`));
|
const data = JSON.parse(await this.request(`/tv/playlist.php?id=${urlData.id}&t=${urlData.name}`, null, true));
|
||||||
const videoList = [];
|
let videoList = [];
|
||||||
|
let subtitles = [];
|
||||||
|
let audios = [];
|
||||||
for (const playlist of data) {
|
for (const playlist of data) {
|
||||||
for (const source of playlist.sources) {
|
var source = playlist.sources[0]
|
||||||
try {
|
var link = baseUrl + source.file;
|
||||||
const subtitles = [];
|
|
||||||
playlist.tracks.filter(track => track.kind === 'captions').forEach(track => {
|
|
||||||
subtitles.push({
|
var resp = await new Client().get(link);
|
||||||
label: track.label,
|
|
||||||
file: track.file
|
if (resp.statusCode === 200) {
|
||||||
});
|
const masterPlaylist = resp.body;
|
||||||
});
|
masterPlaylist.substringAfter('#EXT-X-MEDIA:').split('#EXT-X-MEDIA:').forEach(it => {
|
||||||
const link = baseUrl + source.file;
|
if (it.includes('TYPE=AUDIO')) {
|
||||||
const headers =
|
const audioInfo = it.substringAfter('TYPE=AUDIO').substringBefore('\n');
|
||||||
|
const language = audioInfo.substringAfter('NAME="').substringBefore('"');
|
||||||
|
const url = audioInfo.substringAfter('URI="').substringBefore('"');
|
||||||
|
audios.push({ file: url, label: language });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
masterPlaylist.substringAfter('#EXT-X-STREAM-INF:').split('#EXT-X-STREAM-INF:').forEach(it => {
|
||||||
|
|
||||||
|
var quality = `${it.substringAfter('RESOLUTION=').substringAfter('x').substringBefore(',')}p (${source.label})`;
|
||||||
|
let videoUrl = it.substringAfter('\n').substringBefore('\n');
|
||||||
|
|
||||||
|
if (!videoUrl.startsWith('http')) {
|
||||||
|
videoUrl = resp.request.url.substringBeforeLast('/') + `/${videoUrl}`;
|
||||||
|
}
|
||||||
|
var headers =
|
||||||
{
|
{
|
||||||
'Host': link.match(/^(?:https?:\/\/)?(?:www\.)?([^\/]+)/)[1],
|
'Host': videoUrl.match(/^(?:https?:\/\/)?(?:www\.)?([^\/]+)/)[1],
|
||||||
'Origin': baseUrl,
|
'Origin': baseUrl,
|
||||||
'Referer': `${baseUrl}/`
|
'Referer': `${baseUrl}/`
|
||||||
};
|
};
|
||||||
const resp = await new Client().get(link, headers);
|
videoList.push({ url: videoUrl, quality, originalUrl: videoUrl, headers });
|
||||||
|
|
||||||
if (resp.statusCode === 200) {
|
});
|
||||||
const masterPlaylist = resp.body;
|
|
||||||
const audios = [];
|
|
||||||
masterPlaylist.substringAfter('#EXT-X-MEDIA:').split('#EXT-X-MEDIA:').forEach(it => {
|
|
||||||
if (it.includes('TYPE=AUDIO')) {
|
|
||||||
const audioInfo = it.substringAfter('TYPE=AUDIO').substringBefore('\n');
|
|
||||||
const language = audioInfo.substringAfter('NAME="').substringBefore('"');
|
|
||||||
const url = audioInfo.substringAfter('URI="').substringBefore('"');
|
|
||||||
audios.push({ file: url, label: language });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!masterPlaylist.includes('#EXT-X-STREAM-INF:')) {
|
|
||||||
if (audios.length === 0) {
|
|
||||||
videoList.push({ url: link, quality: source.label, originalUrl: link, subtitles, headers });
|
|
||||||
} else {
|
|
||||||
videoList.push({ url: link, quality: source.label, originalUrl: link, subtitles, audios, headers });
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
masterPlaylist.substringAfter('#EXT-X-STREAM-INF:').split('#EXT-X-STREAM-INF:').forEach(it => {
|
|
||||||
|
|
||||||
const quality = `${it.substringAfter('RESOLUTION=').substringAfter('x').substringBefore(',')}p (${source.label})`;
|
|
||||||
let videoUrl = it.substringAfter('\n').substringBefore('\n');
|
|
||||||
|
|
||||||
if (!videoUrl.startsWith('http')) {
|
|
||||||
videoUrl = resp.request.url.substringBeforeLast('/') + `/${videoUrl}`;
|
|
||||||
}
|
|
||||||
const headers =
|
|
||||||
{
|
|
||||||
'Host': videoUrl.match(/^(?:https?:\/\/)?(?:www\.)?([^\/]+)/)[1],
|
|
||||||
'Origin': baseUrl,
|
|
||||||
'Referer': `${baseUrl}/`
|
|
||||||
};
|
|
||||||
if (audios.length === 0) {
|
|
||||||
videoList.push({ url: videoUrl, quality, originalUrl: videoUrl, subtitles, headers });
|
|
||||||
} else {
|
|
||||||
videoList.push({ url: videoUrl, quality, originalUrl: videoUrl, subtitles, audios, headers });
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (_) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
playlist.tracks.filter(track => track.kind === 'captions').forEach(track => {
|
||||||
|
subtitles.push({
|
||||||
|
label: track.label,
|
||||||
|
file: track.file
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
videoList[0].audios = audios;
|
||||||
|
videoList[0].subtitles = subtitles;
|
||||||
return videoList;
|
return videoList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user