Add Silence Scan. (#4562)

Add Silence Scan
This commit is contained in:
Alessandro Jean 2020-10-09 08:54:58 -03:00 committed by GitHub
parent 9603e6e80d
commit 3fa83fe574
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 94 additions and 2 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'WP MangaStream (multiple sources)'
pkgNameSuffix = 'all.wpmangastream'
extClass = '.WPMangaStreamFactory'
extVersionCode = 24
extVersionCode = 25
libVersion = '1.2'
}

View File

@ -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<Source> = 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<Page> {
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<Genre> = 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() }
}
}