Foolslide - add English HNI-Scantrad (#2796)

Foolslide - add English HNI-Scantrad
This commit is contained in:
Mike 2020-04-24 08:27:50 -04:00 committed by GitHub
parent 90f191bc00
commit e046d8b4c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 45 additions and 13 deletions

View File

@ -5,7 +5,7 @@ ext {
appName = 'Tachiyomi: FoolSlide (multiple sources)' appName = 'Tachiyomi: FoolSlide (multiple sources)'
pkgNameSuffix = 'all.foolslide' pkgNameSuffix = 'all.foolslide'
extClass = '.FoolSlideFactory' extClass = '.FoolSlideFactory'
extVersionCode = 39 extVersionCode = 40
libVersion = '1.2' libVersion = '1.2'
} }

View File

@ -115,22 +115,21 @@ abstract class FoolSlide(
// if there's no image on the details page, get the first page of the first chapter // if there's no image on the details page, get the first page of the first chapter
fun getDetailsThumbnail(document: Document, urlSelector: String = chapterUrlSelector): String? { fun getDetailsThumbnail(document: Document, urlSelector: String = chapterUrlSelector): String? {
return document.select("div.thumbnail img").firstOrNull()?.attr("abs:src") ?: return document.select("div.thumbnail img, table.thumb img").firstOrNull()?.attr("abs:src") ?:
document.select(chapterListSelector()).last().select(urlSelector).attr("abs:href") document.select(chapterListSelector()).last().select(urlSelector).attr("abs:href")
.let { url -> client.newCall(allowAdult(GET(url, headers))).execute() } .let { url -> client.newCall(allowAdult(GET(url, headers))).execute() }
.let { response -> pageListParse(response).first().imageUrl } .let { response -> pageListParse(response).first().imageUrl }
} }
override fun mangaDetailsParse(document: Document): SManga { override fun mangaDetailsParse(document: Document): SManga {
val infoElement = document.select(mangaDetailsInfoSelector).first().text() return SManga.create().apply {
document.select(mangaDetailsInfoSelector).firstOrNull()?.text()?.let { infoElement ->
val manga = SManga.create() author = infoElement.substringAfter("Author:").substringBefore("Artist:")
manga.author = infoElement.substringAfter("Author:").substringBefore("Artist:") artist = infoElement.substringAfter("Artist:").substringBefore("Synopsis:")
manga.artist = infoElement.substringAfter("Artist:").substringBefore("Synopsis:") description = infoElement.substringAfter("Synopsis:")
manga.description = infoElement.substringAfter("Synopsis:") }
manga.thumbnail_url = getDetailsThumbnail(document) thumbnail_url = getDetailsThumbnail(document)
}
return manga
} }
/** /**

View File

@ -1,17 +1,19 @@
package eu.kanade.tachiyomi.extension.all.foolslide package eu.kanade.tachiyomi.extension.all.foolslide
import android.util.Base64
import com.github.salomonbrys.kotson.get import com.github.salomonbrys.kotson.get
import com.google.gson.JsonParser import com.google.gson.JsonParser
import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.source.Source import eu.kanade.tachiyomi.source.Source
import eu.kanade.tachiyomi.source.SourceFactory import eu.kanade.tachiyomi.source.SourceFactory
import eu.kanade.tachiyomi.source.model.FilterList
import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.source.model.SChapter import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.model.SManga
import okhttp3.Request import okhttp3.Request
import okhttp3.Response
import org.json.JSONObject import org.json.JSONObject
import org.jsoup.nodes.Document import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
class FoolSlideFactory : SourceFactory { class FoolSlideFactory : SourceFactory {
override fun createSources(): List<Source> = listOf( override fun createSources(): List<Source> = listOf(
@ -40,7 +42,8 @@ class FoolSlideFactory : SourceFactory {
KirishimaFansub(), KirishimaFansub(),
PowerMangaIT(), PowerMangaIT(),
BaixarHentai(), BaixarHentai(),
HNIScantrad() HNIScantrad(),
HNIScantradEN()
) )
} }
@ -149,3 +152,33 @@ class BaixarHentai : FoolSlide("Baixar Hentai", "https://leitura.baixarhentai.ne
} }
class HNIScantrad : FoolSlide("HNI-Scantrad", "https://hni-scantrad.com", "fr", "/lel") class HNIScantrad : FoolSlide("HNI-Scantrad", "https://hni-scantrad.com", "fr", "/lel")
class HNIScantradEN : FoolSlide("HNI-Scantrad", "https://hni-scantrad.com", "en", "/eng/lel") {
override val supportsLatest = false
override fun popularMangaRequest(page: Int) = GET(baseUrl + urlModifier, headers)
override fun popularMangaSelector() = "div.listed"
override fun popularMangaFromElement(element: Element): SManga {
return SManga.create().apply {
element.select("a:has(h3)").let {
title = it.text()
setUrlWithoutDomain(it.attr("abs:href"))
}
thumbnail_url = element.select("img").attr("abs:src")
}
}
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request = GET("$baseUrl$urlModifier/?manga=${query.replace(" ", "+")}")
override fun searchMangaSelector(): String = popularMangaSelector()
override fun searchMangaFromElement(element: Element): SManga = popularMangaFromElement(element)
override fun chapterListSelector() = "div.theList > a"
override fun chapterFromElement(element: Element): SChapter {
return SChapter.create().apply {
name = element.select("div.chapter b").text()
setUrlWithoutDomain(element.attr("abs:href"))
}
}
override fun pageListParse(response: Response): List<Page> {
return Regex("""imageArray\[\d+]='(.*)'""").findAll(response.body()!!.string()).toList().mapIndexed { i, mr ->
Page(i, "", "$baseUrl$urlModifier/${mr.groupValues[1]}")
}
}
}