mirror of
https://github.com/kodjodevf/mangayomi-extensions.git
synced 2026-02-14 19:01:15 +00:00
extension(mangapill): Added manga details
This commit is contained in:
@@ -6,7 +6,7 @@ const mangayomiSources = [{
|
|||||||
"iconUrl": "https://www.google.com/s2/favicons?sz=64&domain=https://mangapill.com/",
|
"iconUrl": "https://www.google.com/s2/favicons?sz=64&domain=https://mangapill.com/",
|
||||||
"typeSource": "single",
|
"typeSource": "single",
|
||||||
"isManga": true,
|
"isManga": true,
|
||||||
"version": "0.0.2",
|
"version": "0.0.3",
|
||||||
"dateFormat": "",
|
"dateFormat": "",
|
||||||
"dateFormatLocale": "",
|
"dateFormatLocale": "",
|
||||||
"pkgPath": "manga/src/en/mangapill.js"
|
"pkgPath": "manga/src/en/mangapill.js"
|
||||||
@@ -18,7 +18,17 @@ class DefaultExtension extends MProvider {
|
|||||||
"Referer": this.source.baseUrl
|
"Referer": this.source.baseUrl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async print(msg) { console.log(msg) }
|
print(msg) { console.log(msg) }
|
||||||
|
|
||||||
|
statusCode(status) {
|
||||||
|
return {
|
||||||
|
"publishing": 0,
|
||||||
|
"finished": 1,
|
||||||
|
"on hiatus": 2,
|
||||||
|
"discontinued": 3,
|
||||||
|
"not yet published": 4,
|
||||||
|
}[status] ?? 5;
|
||||||
|
}
|
||||||
|
|
||||||
async getPreference(key) {
|
async getPreference(key) {
|
||||||
const preferences = new SharedPreferences();
|
const preferences = new SharedPreferences();
|
||||||
@@ -81,8 +91,35 @@ class DefaultExtension extends MProvider {
|
|||||||
async search(query, page, filters) {
|
async search(query, page, filters) {
|
||||||
return await this.searchManga(query, "", "", page);
|
return await this.searchManga(query, "", "", page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getMangaDetail(slug) {
|
||||||
|
var link = `${this.source.baseUrl}${slug}`
|
||||||
|
var res = await new Client().get(link, this.getHeaders());
|
||||||
|
var doc = new Document(res.body);
|
||||||
|
|
||||||
|
var mangaName = doc.selectFirst(".mb-3 .font-bold.text-lg").text
|
||||||
|
var description = doc.selectFirst("meta[name='description']").attr("content")
|
||||||
|
var imageUrl = doc.selectFirst(".w-full.h-full").getSrc
|
||||||
|
var statusText = doc.select(".grid.grid-cols-1 > div")[1].selectFirst("div").text
|
||||||
|
var status = this.statusCode(statusText)
|
||||||
|
|
||||||
|
var genre = []
|
||||||
|
var genreList = doc.select("a.mr-1")
|
||||||
|
for (var gen of genreList) { genre.push(gen.text) }
|
||||||
|
|
||||||
|
var chapters = []
|
||||||
|
var chapList = doc.select("div.my-3.grid > a")
|
||||||
|
for (var chap of chapList) {
|
||||||
|
var name = chap.text
|
||||||
|
var url = chap.getHref
|
||||||
|
chapters.push({ name, url })
|
||||||
|
}
|
||||||
|
return { name: mangaName, description, link, imageUrl, status, genre, chapters }
|
||||||
|
}
|
||||||
|
|
||||||
async getDetail(url) {
|
async getDetail(url) {
|
||||||
throw new Error("getDetail not implemented");
|
return await this.getMangaDetail(url.substring(1,));
|
||||||
|
|
||||||
}
|
}
|
||||||
// For anime episode video list
|
// For anime episode video list
|
||||||
async getVideoList(url) {
|
async getVideoList(url) {
|
||||||
|
|||||||
Reference in New Issue
Block a user