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