ManhuaUS: fix chapter list (#9285)

* ManhuaUS: fix chapter list

* some cleaning
This commit is contained in:
Riztard Lanthorn 2021-09-30 17:52:14 +07:00 committed by GitHub
parent 3cdba4b68a
commit 6202608920
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 15 deletions

View File

@ -4,10 +4,8 @@ import android.graphics.Bitmap
import android.graphics.BitmapFactory
import android.graphics.Canvas
import android.graphics.Rect
import android.util.Log
import eu.kanade.tachiyomi.multisrc.madara.Madara
import eu.kanade.tachiyomi.source.model.Page
import okhttp3.Headers
import okhttp3.Interceptor
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.OkHttpClient
@ -17,8 +15,8 @@ import okhttp3.ResponseBody.Companion.toResponseBody
import org.jsoup.nodes.Document
import java.io.ByteArrayOutputStream
import java.text.SimpleDateFormat
import java.util.concurrent.TimeUnit
import java.util.Locale
import java.util.concurrent.TimeUnit
class DragonTea : Madara(
"DragonTea",
@ -31,16 +29,16 @@ class DragonTea : Madara(
.readTimeout(30, TimeUnit.SECONDS)
.addInterceptor(::begonepeconIntercept)
.build()
override val useNewChapterEndpoint = true
private val begonepeconSelector: String = "div.begonepecon"
private val peconholderSelector: String = "div.peconholder"
override fun pageListParse(document: Document): List<Page> {
countViews(document)
val hasSplitImages = document
.select(begonepeconSelector)
.firstOrNull() != null
@ -59,7 +57,7 @@ class DragonTea : Madara(
Page(index, document.location(), imageUrl)
}
}
private fun begonepeconIntercept(chain: Interceptor.Chain): Response {
if (!chain.request().url.toString().endsWith(BEGONEPECON_SUFFIX)) {
return chain.proceed(chain.request())
@ -111,7 +109,7 @@ class DragonTea : Madara(
.body(responseBody)
.build()
}
companion object {
private const val BEGONEPECON_SUFFIX = "?begonepecon"
private val PNG_MEDIA_TYPE = "image/png".toMediaType()

View File

@ -56,8 +56,8 @@ class MangasOrigines : Madara("Mangas Origines", "https://mangas-origines.fr", "
}
}
val genres = select("div.genres-content a")
.map { element -> element.text().toLowerCase(Locale.ROOT) }
.toMutableSet()
.map { element -> element.text().toLowerCase(Locale.ROOT) }
.toMutableSet()
// add tag(s) to genre
select("div.tags-content a").forEach { element ->
@ -88,4 +88,4 @@ class MangasOrigines : Madara("Mangas Origines", "https://mangas-origines.fr", "
return manga
}
}
}

View File

@ -2,4 +2,6 @@ package eu.kanade.tachiyomi.extension.en.manhuaus
import eu.kanade.tachiyomi.multisrc.madara.Madara
class ManhuaUS : Madara("ManhuaUS", "https://manhuaus.com", "en")
class ManhuaUS : Madara("ManhuaUS", "https://manhuaus.com", "en") {
override val useNewChapterEndpoint: Boolean = true
}

View File

@ -259,7 +259,7 @@ class MadaraGenerator : ThemeSourceGenerator {
SingleLang("ManhuaHot", "https://manhuahot.com", "en"),
SingleLang("ManhuaPro", "https://manhuapro.com", "en", overrideVersionCode = 2),
SingleLang("ManhuaToon", "https://manhuatoon.com", "en"),
SingleLang("ManhuaUS", "https://manhuaus.com", "en", overrideVersionCode = 2),
SingleLang("ManhuaUS", "https://manhuaus.com", "en", overrideVersionCode = 3),
SingleLang("ManhuaZone", "https://manhuazone.com", "en"),
SingleLang("Manhuaga", "https://manhuaga.com", "en", overrideVersionCode = 1),
SingleLang("Manhualo", "https://manhualo.com", "en", overrideVersionCode = 1),