Baimangu: Fix page parsing (#6570)
This commit is contained in:
parent
3ecfb8529c
commit
b3f22ebf80
|
@ -1,7 +1,7 @@
|
|||
ext {
|
||||
extName = 'Baimangu (Darpou)'
|
||||
extClass = '.Baimangu'
|
||||
extVersionCode = 3
|
||||
extVersionCode = 4
|
||||
}
|
||||
|
||||
apply from: "$rootDir/common.gradle"
|
||||
|
|
|
@ -22,7 +22,6 @@ import org.jsoup.nodes.Element
|
|||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
import java.util.concurrent.TimeUnit
|
||||
import java.util.regex.Pattern
|
||||
|
||||
class Baimangu : ConfigurableSource, ParsedHttpSource() {
|
||||
override val lang = "zh"
|
||||
|
@ -71,7 +70,13 @@ class Baimangu : ConfigurableSource, ParsedHttpSource() {
|
|||
}
|
||||
|
||||
// Popular Manga
|
||||
override fun popularMangaRequest(page: Int) = GET("$baseUrl/vodshow/4--hits------$page---.html", headers)
|
||||
override fun popularMangaRequest(page: Int): Request {
|
||||
return if (page <= 1) {
|
||||
GET("$baseUrl/fenlei/4.html", headers)
|
||||
} else {
|
||||
GET("$baseUrl/fenlei/4-$page.html", headers)
|
||||
}
|
||||
}
|
||||
override fun popularMangaNextPageSelector() = commonNextPageSelector
|
||||
override fun popularMangaSelector() = commonSelector
|
||||
override fun popularMangaFromElement(element: Element) = commonMangaFromElement(element)
|
||||
|
@ -205,15 +210,13 @@ class Baimangu : ConfigurableSource, ParsedHttpSource() {
|
|||
val theScriptData = document.selectFirst("script:containsData(oScript.src)")?.data()
|
||||
?: throw Exception("Unable to find OScript")
|
||||
|
||||
val pattern = Pattern.compile("src(\\s*)=(\\s*)\"(.+)\";")
|
||||
val matcher = pattern.matcher(theScriptData)
|
||||
|
||||
if (matcher.find()) {
|
||||
return matcher.group(3) ?: throw Exception("Unable to extract OScript")
|
||||
}
|
||||
|
||||
val scriptUrl = theScriptData.substringAfter("txt_url=\"").substringBefore("\"")
|
||||
if (scriptUrl.isEmpty()) {
|
||||
throw Error("Unable to match for OScript")
|
||||
}
|
||||
return scriptUrl.replace("img.manga8.xyz", "img3.manga8.xyz")
|
||||
.replace("img2.manga8.xyz", "img4.manga8.xyz")
|
||||
}
|
||||
|
||||
private fun extractPagesFromOScript(content: String): List<Page> {
|
||||
if (content.isEmpty()) {
|
||||
|
|
Loading…
Reference in New Issue