Holonometria: update URL and other fixes (#9400)
* Holonometria: update URL and other fixes * Review suggestions
This commit is contained in:
parent
e84d87a883
commit
63ff937ae4
@ -1,7 +1,7 @@
|
||||
ext {
|
||||
extName = 'HOLONOMETRIA'
|
||||
extClass = '.HolonometriaFactory'
|
||||
extVersionCode = 2
|
||||
extVersionCode = 3
|
||||
isNsfw = false
|
||||
}
|
||||
|
||||
|
@ -8,12 +8,12 @@ import eu.kanade.tachiyomi.source.model.SChapter
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
|
||||
import eu.kanade.tachiyomi.util.asJsoup
|
||||
import keiyoushi.utils.tryParse
|
||||
import okhttp3.Response
|
||||
import org.jsoup.nodes.Document
|
||||
import org.jsoup.nodes.Element
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Locale
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
class Holonometria(
|
||||
override val lang: String,
|
||||
@ -22,31 +22,23 @@ class Holonometria(
|
||||
|
||||
override val name = "HOLONOMETRIA"
|
||||
|
||||
override val baseUrl = "https://alt.hololive.tv"
|
||||
override val baseUrl = "https://holoearth.com"
|
||||
|
||||
override val supportsLatest = false
|
||||
|
||||
override val client = network.cloudflareClient.newBuilder()
|
||||
.readTimeout(60, TimeUnit.SECONDS)
|
||||
.build()
|
||||
override fun popularMangaRequest(page: Int) = GET("$baseUrl/${langPath}alt/holonometria/manga/", headers)
|
||||
|
||||
override fun headersBuilder() = super.headersBuilder()
|
||||
.add("Referer", "$baseUrl/")
|
||||
|
||||
override fun popularMangaRequest(page: Int) =
|
||||
GET("$baseUrl/holonometria/$langPath", headers)
|
||||
|
||||
override fun popularMangaSelector() = "#Story article:has(a[href*=/manga/])"
|
||||
override fun popularMangaSelector() = ".manga__item"
|
||||
override fun popularMangaNextPageSelector() = null
|
||||
|
||||
override fun popularMangaFromElement(element: Element) = SManga.create().apply {
|
||||
setUrlWithoutDomain(element.selectFirst("a")!!.attr("href"))
|
||||
title = element.select(".ttl").text()
|
||||
title = element.select(".manga__title").text()
|
||||
thumbnail_url = element.selectFirst("img")?.attr("abs:src")
|
||||
}
|
||||
|
||||
override fun searchMangaRequest(page: Int, query: String, filters: FilterList) =
|
||||
GET("$baseUrl/holonometria/$langPath#${query.trim()}", headers)
|
||||
GET("$baseUrl/${langPath}alt/holonometria/manga/#${query.trim()}", headers)
|
||||
|
||||
override fun searchMangaParse(response: Response): MangasPage {
|
||||
val document = response.asJsoup()
|
||||
@ -64,10 +56,10 @@ class Holonometria(
|
||||
override fun searchMangaFromElement(element: Element) = popularMangaFromElement(element)
|
||||
|
||||
override fun mangaDetailsParse(document: Document) = SManga.create().apply {
|
||||
title = document.select(".md-ttl__pages").text()
|
||||
thumbnail_url = document.select(".mangainfo img").attr("abs:src")
|
||||
description = document.select(".mangainfo aside").text()
|
||||
val info = document.select(".mangainfo footer").html().split("<br>")
|
||||
title = document.select(".alt-nav__met-sub-link.is-current").text()
|
||||
thumbnail_url = document.select(".manga-detail__thumb img").attr("abs:src")
|
||||
description = document.select(".manga-detail__caption").text()
|
||||
val info = document.select(".manga-detail__person").html().split("<br>")
|
||||
author = info.firstOrNull { desc -> manga.any { desc.contains(it, true) } }
|
||||
?.substringAfter(":")
|
||||
?.substringAfter(":")
|
||||
@ -80,57 +72,23 @@ class Holonometria(
|
||||
?.replace("&", "&")
|
||||
}
|
||||
|
||||
override fun chapterListRequest(manga: SManga) =
|
||||
paginatedChapterListRequest(manga.url, 1)
|
||||
override fun chapterListRequest(manga: SManga) = GET("$baseUrl/${manga.url}", headers)
|
||||
|
||||
private fun paginatedChapterListRequest(mangaUrl: String, page: Int) =
|
||||
GET("$baseUrl$mangaUrl".removeSuffix("/") + if (page == 1) "/" else "/page/$page/", headers)
|
||||
override fun chapterListSelector() = ".manga-detail__list .manga-detail__list-item"
|
||||
|
||||
override fun chapterListParse(response: Response): List<SChapter> {
|
||||
val document = response.asJsoup()
|
||||
val mangaUrl = response.request.url.toString()
|
||||
.substringAfter(baseUrl)
|
||||
.substringBefore("page/")
|
||||
|
||||
val chapters = document.select(chapterListSelector())
|
||||
.map(::chapterFromElement)
|
||||
.toMutableList()
|
||||
|
||||
val lastPage = document.select(".pagenation-list a").last()
|
||||
?.text()?.toIntOrNull() ?: return chapters
|
||||
|
||||
for (page in 2..lastPage) {
|
||||
val request = paginatedChapterListRequest(mangaUrl, page)
|
||||
val newDocument = client.newCall(request).execute().asJsoup()
|
||||
|
||||
val moreChapters = newDocument.select(chapterListSelector())
|
||||
.map(::chapterFromElement)
|
||||
|
||||
chapters.addAll(moreChapters)
|
||||
}
|
||||
|
||||
return chapters
|
||||
}
|
||||
|
||||
override fun chapterListSelector() = "#Archive article"
|
||||
override fun chapterListParse(response: Response): List<SChapter> =
|
||||
super.chapterListParse(response).reversed()
|
||||
|
||||
override fun chapterFromElement(element: Element) = SChapter.create().apply {
|
||||
setUrlWithoutDomain(element.selectFirst("a")!!.attr("href"))
|
||||
name = element.select(".ttl").text()
|
||||
date_upload = element.selectFirst(".data--date")?.text().parseDate()
|
||||
scanlator = element.selectFirst(".data--category")?.text()
|
||||
}
|
||||
|
||||
private fun String?.parseDate(): Long {
|
||||
return runCatching {
|
||||
dateFormat.parse(this!!)!!.time
|
||||
}.getOrDefault(0L)
|
||||
name = element.select(".manga-detail__list-title").text()
|
||||
date_upload = dateFormat.tryParse(element.selectFirst(".manga-detail__list-date")?.text())
|
||||
}
|
||||
|
||||
override fun pageListParse(document: Document): List<Page> {
|
||||
return document.select("#js-mangaviewer img").mapIndexed { idx, img ->
|
||||
return document.select(".manga-detail__swiper-wrapper img").mapIndexed { idx, img ->
|
||||
Page(idx, "", img.attr("abs:src"))
|
||||
}
|
||||
}.reversed()
|
||||
}
|
||||
|
||||
companion object {
|
||||
@ -138,7 +96,7 @@ class Holonometria(
|
||||
private val script = listOf("script", "naskah", "脚本")
|
||||
|
||||
private val dateFormat by lazy {
|
||||
SimpleDateFormat("yy.MM.dd", Locale.ENGLISH)
|
||||
SimpleDateFormat("yyyy.MM.dd", Locale.ENGLISH)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user