From 3fa83fe574ac11e0c63b013a8c2f6f96234efa2a Mon Sep 17 00:00:00 2001 From: Alessandro Jean Date: Fri, 9 Oct 2020 08:54:58 -0300 Subject: [PATCH] Add Silence Scan. (#4562) Add Silence Scan --- src/all/wpmangastream/build.gradle | 2 +- .../all/wpmangastream/WPMangaStreamFactory.kt | 94 ++++++++++++++++++- 2 files changed, 94 insertions(+), 2 deletions(-) diff --git a/src/all/wpmangastream/build.gradle b/src/all/wpmangastream/build.gradle index e028db57b..c959b1598 100644 --- a/src/all/wpmangastream/build.gradle +++ b/src/all/wpmangastream/build.gradle @@ -5,7 +5,7 @@ ext { extName = 'WP MangaStream (multiple sources)' pkgNameSuffix = 'all.wpmangastream' extClass = '.WPMangaStreamFactory' - extVersionCode = 24 + extVersionCode = 25 libVersion = '1.2' } diff --git a/src/all/wpmangastream/src/eu/kanade/tachiyomi/extension/all/wpmangastream/WPMangaStreamFactory.kt b/src/all/wpmangastream/src/eu/kanade/tachiyomi/extension/all/wpmangastream/WPMangaStreamFactory.kt index f72cd60cb..b36979400 100644 --- a/src/all/wpmangastream/src/eu/kanade/tachiyomi/extension/all/wpmangastream/WPMangaStreamFactory.kt +++ b/src/all/wpmangastream/src/eu/kanade/tachiyomi/extension/all/wpmangastream/WPMangaStreamFactory.kt @@ -1,5 +1,9 @@ package eu.kanade.tachiyomi.extension.all.wpmangastream +import com.github.salomonbrys.kotson.array +import com.github.salomonbrys.kotson.obj +import com.github.salomonbrys.kotson.string +import com.google.gson.JsonParser import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.asObservableSuccess import eu.kanade.tachiyomi.source.Source @@ -20,6 +24,8 @@ import org.jsoup.nodes.Document import org.jsoup.nodes.Element import rx.Observable import java.io.IOException +import java.text.SimpleDateFormat +import java.util.Locale class WPMangaStreamFactory : SourceFactory { override fun createSources(): List = listOf( @@ -43,7 +49,8 @@ class WPMangaStreamFactory : SourceFactory { MangaProZ(), Boosei(), Mangakyo(), - AsuraScans() + AsuraScans(), + SilenceScan() ) } @@ -649,3 +656,88 @@ class MangaProZ : WPMangaStream("Manga Pro Z", "https://mangaproz.com", "ar") { class Boosei : WPMangaStream("Boosei", "https://boosei.com", "id") class Mangakyo : WPMangaStream("Mangakyo", "https://www.mangakyo.me", "id") + +class SilenceScan : WPMangaStream( + "Silence Scan", + "https://silencescan.net", + "pt-BR", + SimpleDateFormat("MMMM dd, yyyy", Locale("pt", "BR")) +) { + + override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply { + val infoEl = document.select("div.bigcontent, div.animefull").first() + + author = infoEl.select("b:contains(Autor) + span").text() + artist = infoEl.select("b:contains(Artista) + span").text() + status = parseStatus(infoEl.select("div.imptdt:contains(Status) i").text()) + description = infoEl.select("h2:contains(Sinopse) + div p").joinToString("\n") { it.text() } + genre = infoEl.select("b:contains(Gêneros) + span a").joinToString { it.text() } + thumbnail_url = infoEl.select("div.thumb img").imgAttr() + } + + override fun chapterFromElement(element: Element): SChapter = SChapter.create().apply { + name = element.select("span.chapternum").text() + scanlator = this@SilenceScan.name + date_upload = element.select("span.chapterdate").firstOrNull()?.text() + ?.let { parseChapterDate(it) } ?: 0 + setUrlWithoutDomain(element.select("div.eph-num > a").attr("href")) + } + + override fun pageListParse(document: Document): List { + val chapterObj = document.select("script:containsData(ts_reader)").first() + .data() + .substringAfter("run(") + .substringBeforeLast(");") + .let { JSON_PARSER.parse(it) } + .obj + + if (chapterObj["sources"].array.size() == 0) { + return emptyList() + } + + val firstServerAvailable = chapterObj["sources"].array[0].obj + + return firstServerAvailable["images"].array + .mapIndexed { i, pageUrl -> Page(i, "", pageUrl.string) } + } + + override fun getGenreList(): List = listOf( + Genre("4-koma", "4-koma"), + Genre("Ação", "acao"), + Genre("Adulto", "adulto"), + Genre("Artes marciais", "artes-marciais"), + Genre("Comédia", "comedia"), + Genre("Comedy", "comedy"), + Genre("Culinária", "culinaria"), + Genre("Drama", "drama"), + Genre("Ecchi", "ecchi"), + Genre("Esporte", "esporte"), + Genre("Fantasia", "fantasia"), + Genre("Gore", "gore"), + Genre("Harém", "harem"), + Genre("Horror", "horror"), + Genre("Isekai", "isekai"), + Genre("Militar", "militar"), + Genre("Mistério", "misterio"), + Genre("Oneshot", "oneshot"), + Genre("Parcialmente Dropado", "parcialmente-dropado"), + Genre("Psicológico", "psicologico"), + Genre("Romance", "romance"), + Genre("School Life", "school-life"), + Genre("Sci-fi", "sci-fi"), + Genre("Seinen", "seinen"), + Genre("Shoujo Ai", "shoujo-ai"), + Genre("Shounen", "shounen"), + Genre("Slice of life", "slice-of-life"), + Genre("Sobrenatural", "sobrenatural"), + Genre("Supernatural", "supernatural"), + Genre("Tragédia", "tragedia"), + Genre("Vida Escolar", "vida-escolar"), + Genre("Violência sexual", "violencia-sexual"), + Genre("Yuri", "yuri") + ) + + companion object { + private val JSON_PARSER by lazy { JsonParser() } + } +}