mirror of
https://github.com/kodjodevf/mangayomi-extensions.git
synced 2026-02-14 10:51:17 +00:00
extension(netflixMirror): updated display name logic
This commit is contained in:
@@ -19,11 +19,15 @@ class DefaultExtension extends MProvider {
|
|||||||
return "https://pcmirror.cc"
|
return "https://pcmirror.cc"
|
||||||
}
|
}
|
||||||
|
|
||||||
async getPreference(key) {
|
getPreference(key) {
|
||||||
const preferences = new SharedPreferences();
|
const preferences = new SharedPreferences();
|
||||||
return preferences.get(key);
|
return preferences.get(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getPoster(id) {
|
||||||
|
return `https://imgcdn.media/poster/v/${id}.jpg`
|
||||||
|
}
|
||||||
|
|
||||||
async getCookie() {
|
async getCookie() {
|
||||||
const preferences = new SharedPreferences();
|
const preferences = new SharedPreferences();
|
||||||
let cookie;
|
let cookie;
|
||||||
@@ -53,6 +57,7 @@ class DefaultExtension extends MProvider {
|
|||||||
return await this.getPages(await this.request("/home"), ".inner-mob-tray-container")
|
return await this.getPages(await this.request("/home"), ".inner-mob-tray-container")
|
||||||
}
|
}
|
||||||
async getPages(body, selector) {
|
async getPages(body, selector) {
|
||||||
|
var name_pref = this.getPreference("netmirror_pref_display_name");
|
||||||
const elements = new Document(body).select(selector);
|
const elements = new Document(body).select(selector);
|
||||||
const cookie = await this.getCookie();
|
const cookie = await this.getCookie();
|
||||||
const list = [];
|
const list = [];
|
||||||
@@ -61,7 +66,9 @@ class DefaultExtension extends MProvider {
|
|||||||
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}`, cookie)).title, imageUrl, link: id });
|
var name = name_pref ? JSON.parse(await this.request(`/post.php?id=${id}`, cookie)).title : `\n${id}`
|
||||||
|
|
||||||
|
list.push({ name, imageUrl, link: id });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
@@ -74,7 +81,7 @@ class DefaultExtension extends MProvider {
|
|||||||
const list = [];
|
const list = [];
|
||||||
data.searchResult.map(async (res) => {
|
data.searchResult.map(async (res) => {
|
||||||
const id = res.id;
|
const id = res.id;
|
||||||
list.push({ name: res.t, imageUrl: `https://img.nfmirrorcdn.top/poster/v/${id}.jpg`, link: id });
|
list.push({ name: res.t, imageUrl: rhis.getPoster(id), link: id });
|
||||||
})
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -115,7 +122,7 @@ class DefaultExtension extends MProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
description, status: 1, genre, episodes
|
name, imageUrl: this.getPoster(url), description, status: 1, genre, episodes
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
async getEpisodes(name, eid, sid, page, cookie) {
|
async getEpisodes(name, eid, sid, page, cookie) {
|
||||||
@@ -172,9 +179,13 @@ class DefaultExtension extends MProvider {
|
|||||||
for (const playlist of data) {
|
for (const playlist of data) {
|
||||||
var source = playlist.sources[0]
|
var source = playlist.sources[0]
|
||||||
var link = baseUrl + source.file;
|
var link = baseUrl + source.file;
|
||||||
|
var headers =
|
||||||
|
{
|
||||||
|
'Origin': baseUrl,
|
||||||
|
'Referer': `${baseUrl}/`
|
||||||
|
};
|
||||||
|
|
||||||
|
var resp = await new Client().get(link, headers);
|
||||||
var resp = await new Client().get(link);
|
|
||||||
|
|
||||||
if (resp.statusCode === 200) {
|
if (resp.statusCode === 200) {
|
||||||
const masterPlaylist = resp.body;
|
const masterPlaylist = resp.body;
|
||||||
@@ -232,6 +243,13 @@ class DefaultExtension extends MProvider {
|
|||||||
entries: ["1080p", "720p", "480"],
|
entries: ["1080p", "720p", "480"],
|
||||||
entryValues: ["1080", "720", "480"]
|
entryValues: ["1080", "720", "480"]
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
"key": "netmirror_pref_display_name",
|
||||||
|
"switchPreferenceCompat": {
|
||||||
|
"title": "Display media name on home page",
|
||||||
|
"summary": "Homepage loads faster by not calling details API",
|
||||||
|
"value": false
|
||||||
|
}
|
||||||
},];
|
},];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user