This commit is contained in:
Riztard Lanthorn 2021-01-07 23:23:41 +07:00 committed by GitHub
parent b4666b1d0d
commit 3dd846cc3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 51 additions and 4 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'FMReader (multiple aggregators)' extName = 'FMReader (multiple aggregators)'
pkgNameSuffix = 'all.fmreader' pkgNameSuffix = 'all.fmreader'
extClass = '.FMReaderFactory' extClass = '.FMReaderFactory'
extVersionCode = 23 extVersionCode = 24
libVersion = '1.2' libVersion = '1.2'
containsNsfw = true containsNsfw = true
} }

View File

@ -210,7 +210,7 @@ abstract class FMReader(
// gets the unit of time (day, week hour) from "1 day ago" // gets the unit of time (day, week hour) from "1 day ago"
open val dateWordIndex = 1 open val dateWordIndex = 1
private fun parseChapterDate(date: String): Long { open fun parseChapterDate(date: String): Long {
val value = date.split(' ')[dateValueIndex].toInt() val value = date.split(' ')[dateValueIndex].toInt()
val dateWord = date.split(' ')[dateWordIndex].let { val dateWord = date.split(' ')[dateWordIndex].let {
if (it.contains("(")) { if (it.contains("(")) {

View File

@ -1,5 +1,6 @@
package eu.kanade.tachiyomi.extension.all.fmreader package eu.kanade.tachiyomi.extension.all.fmreader
import android.util.Base64
import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.POST import eu.kanade.tachiyomi.network.POST
import eu.kanade.tachiyomi.network.asObservableSuccess import eu.kanade.tachiyomi.network.asObservableSuccess
@ -18,6 +19,7 @@ import okhttp3.Response
import org.jsoup.nodes.Document import org.jsoup.nodes.Document
import org.jsoup.nodes.Element import org.jsoup.nodes.Element
import rx.Observable import rx.Observable
import java.nio.charset.Charset
class FMReaderFactory : SourceFactory { class FMReaderFactory : SourceFactory {
override fun createSources(): List<Source> = listOf( override fun createSources(): List<Source> = listOf(
@ -70,8 +72,53 @@ class HeroScan : FMReader("HeroScan", "https://heroscan.com", "en") {
} }
class RawLH : FMReader("RawLH", "https://lovehug.net", "ja") { class RawLH : FMReader("RawLH", "https://lovehug.net", "ja") {
override fun popularMangaNextPageSelector() = "div.col-md-8 button" override fun popularMangaSelector() = "#history .thumb-item-flow"
override fun pageListParse(document: Document): List<Page> = base64PageListParse(document) override fun popularMangaFromElement(element: Element): SManga {
return SManga.create().apply {
element.select(".series-title a").let {
setUrlWithoutDomain(it.attr("abs:href"))
title = it.text()
}
thumbnail_url = element.select(".thumb-wrapper .img-in-ratio").imgAttr()
}
}
override fun popularMangaNextPageSelector() = ".pagination a:contains(»):not(.disabled)"
override fun mangaDetailsParse(document: Document): SManga {
val infoElement = document.select("div.row").first()
return SManga.create().apply {
author = infoElement.select("li a.btn-info").text()
genre = infoElement.select("li a.btn-danger").joinToString { it.text() }
status = parseStatus(infoElement.select("li a.btn-success").first()?.text())
description = document.select(".summary-content p").text().trim()
thumbnail_url = infoElement.select(".thumbnail").imgAttr()
}
}
override fun chapterListSelector() = ".list-chapters a"
override fun chapterFromElement(element: Element, mangaTitle: String): SChapter {
return SChapter.create().apply {
element.let {
setUrlWithoutDomain(it.attr("abs:href"))
name = element.attr("title")
}
date_upload = element.select(".chapter-time").let { if (it.hasText()) parseChapterDate(it.text()) else 0 }
}
}
override fun pageListParse(document: Document): List<Page> = base64PageListParse2(document)
protected fun base64PageListParse2(document: Document): List<Page> {
fun Element.decoded(): String {
val attr = "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("img.chapter-img").mapIndexed { i, img ->
Page(i, document.location(), img.decoded())
}
}
// Referer needs to be chapter URL // Referer needs to be chapter URL
override fun imageRequest(page: Page): Request = GET(page.imageUrl!!, headersBuilder().set("Referer", page.url).build()) override fun imageRequest(page: Page): Request = GET(page.imageUrl!!, headersBuilder().set("Referer", page.url).build())
} }