mirror of
https://github.com/kodjodevf/mangayomi-extensions.git
synced 2026-02-17 12:20:28 +00:00
fix
This commit is contained in:
@@ -6,15 +6,22 @@ const mangayomiSources = [{
|
|||||||
"iconUrl": "https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/javascript/icon/all.netflixmirror.png",
|
"iconUrl": "https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/javascript/icon/all.netflixmirror.png",
|
||||||
"typeSource": "single",
|
"typeSource": "single",
|
||||||
"isManga": false,
|
"isManga": false,
|
||||||
"version": "0.0.2",
|
"version": "0.0.3",
|
||||||
"dateFormat": "",
|
"dateFormat": "",
|
||||||
"dateFormatLocale": "",
|
"dateFormatLocale": "",
|
||||||
"pkgPath": "anime/src/all/netflixmirror.js"
|
"pkgPath": "anime/src/all/netflixmirror.js"
|
||||||
}];
|
}];
|
||||||
|
|
||||||
class DefaultExtension extends MProvider {
|
class DefaultExtension extends MProvider {
|
||||||
async request(url) {
|
async getCookie() {
|
||||||
return (await new Client().get(this.source.baseUrl + url, { "hd": "on" })).body;
|
const addhash = new Document((await new Client().get(`${this.source.baseUrl}/home`, { "cookie": "" })).body).selectFirst("body").attr("data-addhash");
|
||||||
|
await new Client().get(`https://userverify.netmirror.app/verify?hash=${addhash}`);
|
||||||
|
const res = (await new Client().post(`${this.source.baseUrl}/verify2.php`, { "cookie": "" }, { "verify": addhash }));
|
||||||
|
return res.headers["set-cookie"];
|
||||||
|
}
|
||||||
|
async request(url, cookie) {
|
||||||
|
cookie = cookie ?? await this.getCookie();
|
||||||
|
return (await new Client().get(this.source.baseUrl + url, { "cookie": `hd=on; ${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")
|
||||||
@@ -24,13 +31,14 @@ class DefaultExtension extends MProvider {
|
|||||||
}
|
}
|
||||||
async getPages(body, selector) {
|
async getPages(body, selector) {
|
||||||
const elements = new Document(body).select(selector);
|
const elements = new Document(body).select(selector);
|
||||||
|
const cookie = await this.getCookie();
|
||||||
const list = [];
|
const list = [];
|
||||||
for (const element of elements) {
|
for (const element of elements) {
|
||||||
const linkElement = element.selectFirst("article, .top10-post");
|
const linkElement = element.selectFirst("article, .top10-post");
|
||||||
const id = linkElement.selectFirst("a").attr("data-post");
|
const id = linkElement.selectFirst("a").attr("data-post");
|
||||||
if (id.length > 0) {
|
if (id.length > 0) {
|
||||||
const imageUrl = linkElement.selectFirst(".card-img-container img, .top10-img img").attr("data-src");
|
const imageUrl = linkElement.selectFirst(".card-img-container img, .top10-img img").attr("data-src");
|
||||||
list.push({ name: JSON.parse(await this.request(`/post.php?id=${id}`)).title, imageUrl, link: id });
|
list.push({ name: JSON.parse(await this.request(`/post.php?id=${id}`, cookie)).title, imageUrl, link: id });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
@@ -52,7 +60,8 @@ class DefaultExtension extends MProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
async getDetail(url) {
|
async getDetail(url) {
|
||||||
const data = JSON.parse(await this.request(`/post.php?id=${url}`));
|
const cookie = await this.getCookie();
|
||||||
|
const data = JSON.parse(await this.request(`/post.php?id=${url}`, cookie));
|
||||||
const name = data.title;
|
const name = data.title;
|
||||||
const genre = [data.ua, ...(data.genre || '').split(',').map(g => g.trim())];
|
const genre = [data.ua, ...(data.genre || '').split(',').map(g => g.trim())];
|
||||||
const description = data.desc;
|
const description = data.desc;
|
||||||
@@ -66,7 +75,7 @@ class DefaultExtension extends MProvider {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
if (data.nextPageShow === 1) {
|
if (data.nextPageShow === 1) {
|
||||||
const eps = await this.getEpisodes(name, url, data.nextPageSeason, 2);
|
const eps = await this.getEpisodes(name, url, data.nextPageSeason, 2, cookie);
|
||||||
episodes.push(...eps);
|
episodes.push(...eps);
|
||||||
}
|
}
|
||||||
episodes.reverse();
|
episodes.reverse();
|
||||||
@@ -74,7 +83,7 @@ class DefaultExtension extends MProvider {
|
|||||||
let newEpisodes = [];
|
let newEpisodes = [];
|
||||||
const seasonsToProcess = data.season.slice(0, -1);
|
const seasonsToProcess = data.season.slice(0, -1);
|
||||||
await Promise.all(seasonsToProcess.map(async (season) => {
|
await Promise.all(seasonsToProcess.map(async (season) => {
|
||||||
const eps = await this.getEpisodes(name, url, season.id, 1);
|
const eps = await this.getEpisodes(name, url, season.id, 1, cookie);
|
||||||
newEpisodes.push(...eps);
|
newEpisodes.push(...eps);
|
||||||
}));
|
}));
|
||||||
newEpisodes.reverse();
|
newEpisodes.reverse();
|
||||||
@@ -86,12 +95,12 @@ class DefaultExtension extends MProvider {
|
|||||||
description, status: 1, genre, episodes
|
description, status: 1, genre, episodes
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
async getEpisodes(name, eid, sid, page) {
|
async getEpisodes(name, eid, sid, page, cookie) {
|
||||||
const episodes = [];
|
const episodes = [];
|
||||||
let pg = page;
|
let pg = page;
|
||||||
while (true) {
|
while (true) {
|
||||||
try {
|
try {
|
||||||
const data = JSON.parse(await this.request(`/episodes.php?s=${sid}&series=${eid}&page=${pg}`));
|
const data = JSON.parse(await this.request(`/episodes.php?s=${sid}&series=${eid}&page=${pg}`, cookie));
|
||||||
|
|
||||||
data.episodes?.forEach(ep => {
|
data.episodes?.forEach(ep => {
|
||||||
episodes.push({
|
episodes.push({
|
||||||
@@ -123,7 +132,7 @@ class DefaultExtension extends MProvider {
|
|||||||
playlist.tracks.filter(track => track.kind === 'captions').forEach(track => {
|
playlist.tracks.filter(track => track.kind === 'captions').forEach(track => {
|
||||||
subtitles.push({
|
subtitles.push({
|
||||||
label: track.label,
|
label: track.label,
|
||||||
url: track.file
|
file: track.file
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
const link = baseUrl + source.file;
|
const link = baseUrl + source.file;
|
||||||
|
|||||||
Reference in New Issue
Block a user