mirror of
https://github.com/kodjodevf/mangayomi-extensions.git
synced 2026-02-14 10:51:17 +00:00
anime(dramacool): Added details
This commit is contained in:
@@ -6,7 +6,7 @@ const mangayomiSources = [{
|
|||||||
"iconUrl": "https://www.google.com/s2/favicons?sz=128&domain=https://dramacool.com.tr",
|
"iconUrl": "https://www.google.com/s2/favicons?sz=128&domain=https://dramacool.com.tr",
|
||||||
"typeSource": "multi",
|
"typeSource": "multi",
|
||||||
"itemType": 1,
|
"itemType": 1,
|
||||||
"version": "0.0.1",
|
"version": "0.0.2",
|
||||||
"pkgPath": "anime/src/all/dramacool.js"
|
"pkgPath": "anime/src/all/dramacool.js"
|
||||||
}];
|
}];
|
||||||
|
|
||||||
@@ -62,14 +62,84 @@ class DefaultExtension extends MProvider {
|
|||||||
}
|
}
|
||||||
async getLatestUpdates(page) {
|
async getLatestUpdates(page) {
|
||||||
var slug = this.getPreference("dramacool_latest_list")
|
var slug = this.getPreference("dramacool_latest_list")
|
||||||
return await this.getList(`${slug}/page/${page}/`)
|
return await this.getList(`/${slug}/page/${page}/`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
statusFromString(status) {
|
||||||
|
return {
|
||||||
|
"Ongoing": 0,
|
||||||
|
"Completed": 1,
|
||||||
|
}[status] ?? 5;
|
||||||
|
}
|
||||||
|
|
||||||
async search(query, page, filters) {
|
async search(query, page, filters) {
|
||||||
var slug = `/page/${page}/?type=movies&s=${query}`
|
var slug = `/page/${page}/?type=movies&s=${query}`
|
||||||
return await this.getList(slug)
|
return await this.getList(slug)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
formatReleaseDate(str) {
|
||||||
|
var timeSplit = str.split(" ")
|
||||||
|
var t = parseInt(timeSplit[0])
|
||||||
|
var unit = timeSplit[1]
|
||||||
|
|
||||||
|
var mins = 0
|
||||||
|
var mons = 0
|
||||||
|
if(unit.includes('minute')){
|
||||||
|
mins = t;
|
||||||
|
}else if(unit.includes('hour')){
|
||||||
|
mins = t * 60;
|
||||||
|
}else if(unit.includes('day')){
|
||||||
|
mins = t * 60 * 24;
|
||||||
|
}else if(unit.includes('week')){
|
||||||
|
mins = t * 60 * 24 * 7;
|
||||||
|
}else if(unit.includes('month')){
|
||||||
|
mons = t;
|
||||||
|
}
|
||||||
|
var now = new Date();
|
||||||
|
now.setMinutes(now.getMinutes() - mins)
|
||||||
|
now.setMinutes(now.getMonth() - mons)
|
||||||
|
var pastDate = new Date(now);
|
||||||
|
return ""+pastDate.valueOf();
|
||||||
|
}
|
||||||
|
|
||||||
async getDetail(url) {
|
async getDetail(url) {
|
||||||
throw new Error("getDetail not implemented");
|
if (url.includes("-episode")) {
|
||||||
|
url = '/series' + url.split("-episode")[0] + "/"
|
||||||
|
} else if (url.includes("-full-movie")) {
|
||||||
|
url = '/series' + url.split("-full-movie")[0] + "/"
|
||||||
|
}
|
||||||
|
|
||||||
|
var body = await this.request(url);
|
||||||
|
var infos = body.select(".info > p")
|
||||||
|
|
||||||
|
var name = body.selectFirst("h1").text.trim()
|
||||||
|
var imageUrl = body.selectFirst(".img").selectFirst("img").getSrc
|
||||||
|
var isDescription = infos[1].text.includes("Description")
|
||||||
|
var description = isDescription ? infos[2].text.trim() : ""
|
||||||
|
var link = `${this.getBaseUrl()}${url}`
|
||||||
|
var statusIndex = infos.at(-3).text.includes("Status:") ? -3 : -2
|
||||||
|
var status = this.statusFromString(infos.at(statusIndex).selectFirst("a").text)
|
||||||
|
var genre = []
|
||||||
|
infos.at(-1).select("a").forEach(a => genre.push(a.text.trim()))
|
||||||
|
|
||||||
|
var chapters = []
|
||||||
|
var epLists = body.select("ul.list-episode-item-2.all-episode > li")
|
||||||
|
for (var ep of epLists) {
|
||||||
|
var a = ep.selectFirst('a')
|
||||||
|
var epLink = a.getHref.replace(this.getBaseUrl(), "")
|
||||||
|
var epName = a.selectFirst("h3").text.replace(name + " ", "")
|
||||||
|
var scanlator = a.selectFirst("span.type").text
|
||||||
|
var dateUpload = this.formatReleaseDate(a.selectFirst("span.time").text)
|
||||||
|
chapters.push({
|
||||||
|
name: epName,
|
||||||
|
url: epLink,
|
||||||
|
scanlator,
|
||||||
|
dateUpload
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return { name, imageUrl, description, link, status, genre, chapters }
|
||||||
}
|
}
|
||||||
// For novel html content
|
// For novel html content
|
||||||
async getHtmlContent(url) {
|
async getHtmlContent(url) {
|
||||||
|
|||||||
Reference in New Issue
Block a user