Update extension mangakawaii after the new version of Website (#4623)
* Update extension mangakawaii after the new version of Website * Fix change from comment Co-authored-by: Duchesne Lucas <lucas.duchesne@soprabanking.com>
This commit is contained in:
parent
0af6ecdb26
commit
5d73b434df
|
@ -5,7 +5,7 @@ ext {
|
||||||
extName = 'Mangakawaii'
|
extName = 'Mangakawaii'
|
||||||
pkgNameSuffix = 'fr.mangakawaii'
|
pkgNameSuffix = 'fr.mangakawaii'
|
||||||
extClass = '.MangaKawaii'
|
extClass = '.MangaKawaii'
|
||||||
extVersionCode = 10
|
extVersionCode = 11
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,21 +28,23 @@ class MangaKawaii : ParsedHttpSource() {
|
||||||
return Headers.Builder().add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:75.0) Gecko/20100101 Firefox/75.0")
|
return Headers.Builder().add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:75.0) Gecko/20100101 Firefox/75.0")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun popularMangaSelector() = "a.manga-block-item__content"
|
override fun popularMangaSelector() = "a.hot-manga__item "
|
||||||
override fun latestUpdatesSelector() = ".manga-list li div.updates__left"
|
override fun latestUpdatesSelector() = ".section__list-group li div.section__list-group-left"
|
||||||
override fun searchMangaSelector() = "h1 + ul a[href*=manga]"
|
override fun searchMangaSelector() = "h1 + ul a[href*=manga]"
|
||||||
override fun chapterListSelector() = "div.chapter-item.volume-0, div.chapter-item.volume-"
|
override fun chapterListSelector() = "tr.chapter-item.volume-0, tr.chapter-item.volume-, tr.volume-0"
|
||||||
|
|
||||||
override fun popularMangaNextPageSelector() = "a[rel=next]"
|
override fun popularMangaNextPageSelector() = "a[rel=next]"
|
||||||
override fun latestUpdatesNextPageSelector(): String? = null
|
override fun latestUpdatesNextPageSelector(): String? = null
|
||||||
override fun searchMangaNextPageSelector() = "no selector"
|
override fun searchMangaNextPageSelector() = "no selector"
|
||||||
|
|
||||||
override fun popularMangaRequest(page: Int) =
|
|
||||||
GET("$baseUrl/filterLists?page=$page&sortBy=views&asc=false", headersBuilder().add("X-Requested-With", "XMLHttpRequest").build())
|
override fun popularMangaRequest(page: Int) = GET("$baseUrl/liste-manga/filterMangaList?page=$page&sortBy=views&asc=false", headersBuilder().add("X-Requested-With", "XMLHttpRequest").build())
|
||||||
|
|
||||||
override fun latestUpdatesRequest(page: Int) = GET(baseUrl, headers)
|
override fun latestUpdatesRequest(page: Int) = GET(baseUrl, headers)
|
||||||
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
||||||
val uri = Uri.parse("$baseUrl/search").buildUpon()
|
val uri = Uri.parse("$baseUrl/search").buildUpon()
|
||||||
.appendQueryParameter("query", query)
|
.appendQueryParameter("query", query)
|
||||||
|
.appendQueryParameter("search_type", "manga")
|
||||||
return GET(uri.toString(), headers)
|
return GET(uri.toString(), headers)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,11 +55,13 @@ class MangaKawaii : ParsedHttpSource() {
|
||||||
manga.thumbnail_url = element.select("a").attr("abs:data-background-image")
|
manga.thumbnail_url = element.select("a").attr("abs:data-background-image")
|
||||||
return manga
|
return manga
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun latestUpdatesFromElement(element: Element): SManga = SManga.create().apply {
|
override fun latestUpdatesFromElement(element: Element): SManga = SManga.create().apply {
|
||||||
title = element.select(" a").attr("title")
|
title = element.select(" a").text().trim()
|
||||||
setUrlWithoutDomain(element.select("a").attr("href"))
|
setUrlWithoutDomain(element.select("a").attr("href"))
|
||||||
thumbnail_url = element.select("img").attr("data-src")
|
thumbnail_url = element.select("img").attr("data-src")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun searchMangaFromElement(element: Element): SManga {
|
override fun searchMangaFromElement(element: Element): SManga {
|
||||||
val manga = SManga.create()
|
val manga = SManga.create()
|
||||||
manga.url = element.select("a").attr("href")
|
manga.url = element.select("a").attr("href")
|
||||||
|
@ -67,10 +71,11 @@ class MangaKawaii : ParsedHttpSource() {
|
||||||
|
|
||||||
override fun chapterFromElement(element: Element): SChapter {
|
override fun chapterFromElement(element: Element): SChapter {
|
||||||
val chapter = SChapter.create()
|
val chapter = SChapter.create()
|
||||||
chapter.url = element.select("a.list-item__title").attr("href")
|
chapter.url = element.select("td.table__chapter").select("a").attr("href")
|
||||||
chapter.name = element.select("a.list-item__title").text().trim()
|
chapter.name = element.select("td.table__chapter").select("span").text().trim()
|
||||||
chapter.chapter_number = element.select("a.list-item__title").text().substringAfter("Chapitre").replace(Regex("""[,-]"""), ".").trim().toFloatOrNull() ?: -1F
|
chapter.chapter_number = element.select("td.table__chapter").select("span").text().substringAfter("Chapitre").replace(Regex("""[,-]"""), ".").trim().toFloatOrNull()
|
||||||
chapter.date_upload = parseDate(element.select("div.chapter-item__date").text())
|
?: -1F
|
||||||
|
chapter.date_upload = parseDate(element.select("td.table__date").text())
|
||||||
return chapter
|
return chapter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,13 +85,13 @@ class MangaKawaii : ParsedHttpSource() {
|
||||||
|
|
||||||
override fun mangaDetailsParse(document: Document): SManga {
|
override fun mangaDetailsParse(document: Document): SManga {
|
||||||
val manga = SManga.create()
|
val manga = SManga.create()
|
||||||
manga.thumbnail_url = document.select("img.manga__cover").attr("abs:src")
|
manga.thumbnail_url = document.select("div.manga-view__header-image").select("img").attr("abs:src")
|
||||||
manga.description = document.select("div.info-desc__content").text()
|
manga.description = document.select("div.info-desc__content").text()
|
||||||
manga.author = document.select("a[href*=author]").text()
|
manga.author = document.select("a[href*=author]").text()
|
||||||
manga.artist = document.select("a[href*=artist]").text()
|
manga.artist = document.select("a[href*=artist]").text()
|
||||||
val glist = document.select("a[href*=category]").map { it.text() }
|
val glist = document.select("a[href*=category]").map { it.text() }
|
||||||
manga.genre = glist.joinToString(", ")
|
manga.genre = glist.joinToString(", ")
|
||||||
manga.status = when (document.select("span.label.label-success").text()) {
|
manga.status = when (document.select("span.badge.bg-success.text-uppercase").text()) {
|
||||||
"En Cours" -> SManga.ONGOING
|
"En Cours" -> SManga.ONGOING
|
||||||
"Terminé" -> SManga.COMPLETED
|
"Terminé" -> SManga.COMPLETED
|
||||||
else -> SManga.UNKNOWN
|
else -> SManga.UNKNOWN
|
||||||
|
@ -96,17 +101,16 @@ class MangaKawaii : ParsedHttpSource() {
|
||||||
|
|
||||||
override fun pageListParse(response: Response): List<Page> {
|
override fun pageListParse(response: Response): List<Page> {
|
||||||
val body = response.asJsoup()
|
val body = response.asJsoup()
|
||||||
val element = body.select("script:containsData(Imagesrc)").toString()
|
var div = body.select("div#all")
|
||||||
val regex = "(data-src).*[\"]".toRegex()
|
var elements = div.select("img")
|
||||||
val match = regex.findAll(element).map { it.value.substringAfter("data-src\", \" ").substringBefore("\"").trim() }
|
|
||||||
// throw Exception(match.elementAt(1))
|
|
||||||
val pages = mutableListOf<Page>()
|
val pages = mutableListOf<Page>()
|
||||||
for (i in 0 until match.count()) {
|
for (i in 0 until elements.count()) {
|
||||||
pages.add(Page(i, "", match.elementAt(i)))
|
pages.add(Page(i, "", elements[i].attr("data-src").trim()))
|
||||||
}
|
}
|
||||||
return pages
|
return pages
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun pageListParse(document: Document): List<Page> = throw Exception("Not used")
|
override fun pageListParse(document: Document): List<Page> = throw Exception("Not used")
|
||||||
override fun imageUrlParse(document: Document): String = throw Exception("Not used")
|
override fun imageUrlParse(document: Document): String = throw Exception("Not used")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue