FMReader: WeLoveManga: Fix page list parsing (#9196)
* FMReader: WeLoveManga: Fix page list parsing They appear to have changed how their page list works, to instead be driven off an attribute with a seemingly randomly generated name. That name is then emitted as part of the page script. We can just rely on that attribute being very long instead. Fixes #9120 * FMReader: WeLoveManga: Fix imports. They were not copied over correctly when copying the (edited) generated code back to the source.
This commit is contained in:
parent
0bc77409a9
commit
a03a505b78
|
@ -1,17 +1,33 @@
|
|||
package eu.kanade.tachiyomi.extension.ja.rawlh
|
||||
|
||||
import android.util.Base64
|
||||
import eu.kanade.tachiyomi.multisrc.fmreader.FMReader
|
||||
import eu.kanade.tachiyomi.network.GET
|
||||
import eu.kanade.tachiyomi.source.model.Page
|
||||
import okhttp3.Request
|
||||
import org.jsoup.nodes.Attribute
|
||||
import org.jsoup.nodes.Document
|
||||
import org.jsoup.nodes.Element
|
||||
import java.nio.charset.Charset
|
||||
|
||||
class WeLoveManga : FMReader("WeLoveManga", "https://weloma.net", "ja") {
|
||||
// Formerly "RawLH"
|
||||
override val id = 7595224096258102519
|
||||
|
||||
override val chapterUrlSelector = ""
|
||||
override fun pageListParse(document: Document): List<Page> = base64PageListParse(document)
|
||||
override fun pageListParse(document: Document): List<Page> {
|
||||
fun Element.decoded(): String {
|
||||
val attr = this.attributes().map(Attribute::key).maxByOrNull(kotlin.String::length) ?: "src"
|
||||
return if (!this.attr(attr).contains(".")) {
|
||||
Base64.decode(this.attr(attr), Base64.DEFAULT).toString(Charset.defaultCharset())
|
||||
} else {
|
||||
this.attr("abs:$attr")
|
||||
}
|
||||
}
|
||||
return document.select(pageListImageSelector).mapIndexed { i, img ->
|
||||
Page(i, document.location(), img.decoded())
|
||||
}
|
||||
}
|
||||
// Referer needs to be chapter URL
|
||||
override fun imageRequest(page: Page): Request = GET(page.imageUrl!!, headersBuilder().set("Referer", page.url).build())
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ class FMReaderGenerator : ThemeSourceGenerator {
|
|||
SingleLang("Manga-TR", "https://manga-tr.com", "tr", className = "MangaTR"),
|
||||
SingleLang("Manhwa18", "https://manhwa18.com", "en", isNsfw = true),
|
||||
MultiLang("Manhwa18.net", "https://manhwa18.net", listOf("en", "ko"), className = "Manhwa18NetFactory", isNsfw = true),
|
||||
SingleLang("WeLoveManga", "https://weloma.net", "ja", pkgName = "rawlh", overrideVersionCode = 1),
|
||||
SingleLang("WeLoveManga", "https://weloma.net", "ja", pkgName = "rawlh", overrideVersionCode = 2),
|
||||
SingleLang("Say Truyen", "https://saytruyen.net", "vi", overrideVersionCode = 1),
|
||||
SingleLang("KSGroupScans", "https://ksgroupscans.com", "en"),
|
||||
// Sites that went down
|
||||
|
|
Loading…
Reference in New Issue