Add PeachScan (#759)

* Add PeachScan

* I love linting

* Also remove old WickedWitchScan

* It's not novo anymore

* Remove unneeded className declaration

* Filter light novel entries from latest view (because we can here)

* ACTUALLY filter light novel entries from latest view (because we can here)

* Fix icon path + add Dango Scan

* Move image-decoder dependency to multisrc project

* shut up android studio

* fix dep specifier in additional.gradle

* Update multisrc/overrides/peachscan/default/additional.gradle

Co-authored-by: stevenyomi <95685115+stevenyomi@users.noreply.github.com>

* Revert "Update multisrc/overrides/peachscan/default/additional.gradle"

This reverts commit 6b8722193a.
The comment serves as an explanation for why the dependency shouldn't
be in the Gradle version catalog; because no one else cares about this
dependency.

* Optimize icons

---------

Co-authored-by: stevenyomi <95685115+stevenyomi@users.noreply.github.com>
This commit is contained in:
beerpsi 2024-01-29 19:35:02 +07:00 committed by GitHub
parent 6b1b1883e2
commit ed97926e4f
39 changed files with 79 additions and 71 deletions

View File

@ -31,6 +31,10 @@ configurations {
dependencies { dependencies {
compileOnly(libs.bundles.common) compileOnly(libs.bundles.common)
// Only PeachScan sources uses the image-decoder dependency.
//noinspection UseTomlInstead
compileOnly("com.github.tachiyomiorg:image-decoder:fbd6601290")
// Implements all :lib libraries on the multisrc generator // Implements all :lib libraries on the multisrc generator
// Note that this does not mean that generated sources are going to // Note that this does not mean that generated sources are going to
// implement them too; this is just to be able to compile and generate sources. // implement them too; this is just to be able to compile and generate sources.

View File

@ -1,20 +0,0 @@
package eu.kanade.tachiyomi.extension.pt.wickedwitchscan
import eu.kanade.tachiyomi.multisrc.madara.Madara
import eu.kanade.tachiyomi.network.interceptor.rateLimit
import okhttp3.OkHttpClient
import java.text.SimpleDateFormat
import java.util.Locale
import java.util.concurrent.TimeUnit
class WickedWitchScan : Madara(
"Wicked Witch Scan",
"https://wickedwitchscan.com",
"pt-BR",
SimpleDateFormat("MMMMM dd, yyyy", Locale("pt", "BR")),
) {
override val client: OkHttpClient = super.client.newBuilder()
.rateLimit(1, 2, TimeUnit.SECONDS)
.build()
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -0,0 +1,5 @@
dependencies {
// Only PeachScan sources uses the image-decoder dependency.
//noinspection UseTomlInstead
compileOnly("com.github.tachiyomiorg:image-decoder:fbd6601290")
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -0,0 +1,14 @@
package eu.kanade.tachiyomi.extension.pt.wickedwitchscannovo
import eu.kanade.tachiyomi.multisrc.peachscan.PeachScan
import eu.kanade.tachiyomi.network.interceptor.rateLimit
import java.util.concurrent.TimeUnit
class WickedWitchScan : PeachScan("Wicked Witch Scan", "https://wicked-witch-scan.com", "pt-BR") {
// Source changed from Madara to PeachScan
override val versionId = 2
override val client = super.client.newBuilder()
.rateLimit(1, 2, TimeUnit.SECONDS)
.build()
}

View File

@ -495,7 +495,6 @@ class MadaraGenerator : ThemeSourceGenerator {
SingleLang("WebtoonUK", "https://webtoon.uk", "en", overrideVersionCode = 2), SingleLang("WebtoonUK", "https://webtoon.uk", "en", overrideVersionCode = 2),
SingleLang("WebtoonXYZ", "https://www.webtoon.xyz", "en", isNsfw = true, overrideVersionCode = 3), SingleLang("WebtoonXYZ", "https://www.webtoon.xyz", "en", isNsfw = true, overrideVersionCode = 3),
SingleLang("Whale Manga", "https://whalemanga.com", "en", isNsfw = true), SingleLang("Whale Manga", "https://whalemanga.com", "en", isNsfw = true),
SingleLang("Wicked Witch Scan", "https://wickedwitchscan.com", "pt-BR"),
SingleLang("Winter Scan", "https://winterscan.com", "pt-BR", overrideVersionCode = 4), SingleLang("Winter Scan", "https://winterscan.com", "pt-BR", overrideVersionCode = 4),
SingleLang("Wonderland Scan", "https://wonderlandscan.com", "pt-BR", overrideVersionCode = 3), SingleLang("Wonderland Scan", "https://wonderlandscan.com", "pt-BR", overrideVersionCode = 3),
SingleLang("WoopRead", "https://woopread.com", "en", overrideVersionCode = 1), SingleLang("WoopRead", "https://woopread.com", "en", overrideVersionCode = 1),

View File

@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.extension.pt.wickedwitchscannovo package eu.kanade.tachiyomi.multisrc.peachscan
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.app.ActivityManager import android.app.ActivityManager
@ -8,7 +8,6 @@ import android.graphics.Canvas
import android.graphics.Rect import android.graphics.Rect
import android.util.Base64 import android.util.Base64
import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.interceptor.rateLimit
import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.FilterList
import eu.kanade.tachiyomi.source.model.MangasPage import eu.kanade.tachiyomi.source.model.MangasPage
import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.source.model.Page
@ -39,37 +38,27 @@ import java.io.IOException
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.Locale import java.util.Locale
import java.util.TimeZone import java.util.TimeZone
import java.util.concurrent.TimeUnit
import java.util.zip.ZipInputStream import java.util.zip.ZipInputStream
@SuppressLint("WrongConstant") @SuppressLint("WrongConstant")
class WickedWitchScan : ParsedHttpSource() { abstract class PeachScan(
override val name: String,
override val name = "Wicked Witch Scan" override val baseUrl: String,
override val lang: String,
override val lang = "pt-BR" private val dateFormat: SimpleDateFormat = SimpleDateFormat("d 'de' MMMM 'de' yyyy 'às' HH:mm", Locale("pt", "BR")).apply {
timeZone = TimeZone.getTimeZone("America/Sao_Paulo")
override val baseUrl = "https://wicked-witch-scan.com" },
) : ParsedHttpSource() {
// Source changed from Madara to homegrown website
override val versionId = 2
override val supportsLatest = true override val supportsLatest = true
override val client = network.cloudflareClient override val client = network.cloudflareClient
.newBuilder() .newBuilder()
.rateLimit(1, 2, TimeUnit.SECONDS)
.addInterceptor(::zipImageInterceptor) .addInterceptor(::zipImageInterceptor)
.build() .build()
private val json: Json by injectLazy() private val json: Json by injectLazy()
private val simpleDateFormat by lazy {
SimpleDateFormat("d 'de' MMMM 'de' yyyy 'às' HH:mm", Locale("pt", "BR")).apply {
timeZone = TimeZone.getTimeZone("America/Sao_Paulo")
}
}
override fun popularMangaRequest(page: Int) = GET("$baseUrl/todas-as-obras/", headers) override fun popularMangaRequest(page: Int) = GET("$baseUrl/todas-as-obras/", headers)
override fun popularMangaSelector() = ".comics__all__box" override fun popularMangaSelector() = ".comics__all__box"
@ -86,7 +75,7 @@ class WickedWitchScan : ParsedHttpSource() {
override fun latestUpdatesRequest(page: Int) = GET(baseUrl, headers) override fun latestUpdatesRequest(page: Int) = GET(baseUrl, headers)
override fun latestUpdatesSelector() = "div.comic" override fun latestUpdatesSelector() = "div.comic:not(:has(a.box-image > p:contains(Novel)))"
override fun latestUpdatesFromElement(element: Element) = SManga.create().apply { override fun latestUpdatesFromElement(element: Element) = SManga.create().apply {
setUrlWithoutDomain(element.selectFirst("a")!!.attr("abs:href")) setUrlWithoutDomain(element.selectFirst("a")!!.attr("abs:href"))
@ -106,10 +95,10 @@ class WickedWitchScan : ParsedHttpSource() {
} }
override fun searchMangaParse(response: Response): MangasPage { override fun searchMangaParse(response: Response): MangasPage {
val manga = json.parseToJsonElement(response.body.string()).jsonArray.map { val manga = json.parseToJsonElement(response.body.string()).jsonArray.mapNotNull {
val element = Jsoup.parseBodyFragment(it.jsonObject["html"]!!.jsonPrimitive.content) val element = Jsoup.parseBodyFragment(it.jsonObject["html"]!!.jsonPrimitive.content)
searchMangaFromElement(element) runCatching { searchMangaFromElement(element) }.getOrNull()
} }
return MangasPage(manga, false) return MangasPage(manga, false)
@ -142,19 +131,6 @@ class WickedWitchScan : ParsedHttpSource() {
description = "Tipo: $category\n\n$synopsis" description = "Tipo: $category\n\n$synopsis"
} }
override fun chapterListSelector() = ".link__capitulos"
override fun chapterFromElement(element: Element) = SChapter.create().apply {
setUrlWithoutDomain(element.attr("href"))
name = element.selectFirst(".numero__capitulo")!!.text()
date_upload = runCatching {
val date = element.selectFirst(".data__lançamento")!!.text()
simpleDateFormat.parse(date)?.time
}.getOrNull() ?: 0L
}
override fun chapterListParse(response: Response): List<SChapter> { override fun chapterListParse(response: Response): List<SChapter> {
val document = response.asJsoup() val document = response.asJsoup()
val mediaType = document.selectFirst(".categoria__comic")?.text() val mediaType = document.selectFirst(".categoria__comic")?.text()
@ -167,9 +143,24 @@ class WickedWitchScan : ParsedHttpSource() {
return document.select(chapterListSelector()).map { chapterFromElement(it) } return document.select(chapterListSelector()).map { chapterFromElement(it) }
} }
override fun chapterListSelector() = ".link__capitulos"
override fun chapterFromElement(element: Element) = SChapter.create().apply {
setUrlWithoutDomain(element.attr("href"))
name = element.selectFirst(".numero__capitulo")!!.text()
date_upload = runCatching {
val date = element.selectFirst(".data__lançamento")!!.text()
dateFormat.parse(date)!!.time
}.getOrDefault(0L)
}
override fun pageListParse(document: Document): List<Page> { override fun pageListParse(document: Document): List<Page> {
val scriptElement = document.selectFirst("script:containsData(const urls =[)") val scriptElement = document.selectFirst("script:containsData(const urls =[)")
?: throw Exception("Não foi possível encontrar o script com dados de imagem.") ?: return document.select("#imageContainer img").mapIndexed { i, it ->
Page(i, imageUrl = it.attr("abs:src"))
}
val urls = scriptElement.html().substringAfter("const urls =[").substringBefore("];") val urls = scriptElement.html().substringAfter("const urls =[").substringBefore("];")

View File

@ -0,0 +1,28 @@
package eu.kanade.tachiyomi.multisrc.peachscan
import generator.ThemeSourceData.SingleLang
import generator.ThemeSourceGenerator
class PeachScanGenerator : ThemeSourceGenerator {
override val themePkg = "peachscan"
override val themeClass = "PeachScan"
override val baseVersionCode = 1
override val sources = listOf(
SingleLang("Dango Scan", "https://dangoscan.com.br", "pt-BR"),
SingleLang("Mode Scanlator", "https://modescanlator.com", "pt-BR"),
SingleLang("Nazarick Scan", "https://nazarickscan.com.br", "pt-BR"),
SingleLang("RF Dragon Scan", "https://rfdragonscan.com", "pt-BR"),
SingleLang("Wicked Witch Scan", "https://wicked-witch-scan.com", "pt-BR", pkgName = "wickedwitchscannovo", overrideVersionCode = 1),
)
companion object {
@JvmStatic
fun main(args: Array<String>) {
PeachScanGenerator().createAll()
}
}
}

View File

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View File

@ -1,11 +0,0 @@
ext {
extName = 'Wicked Witch Scan (Novo)'
extClass = '.WickedWitchScan'
extVersionCode = 1
}
apply from: "$rootDir/common.gradle"
dependencies {
compileOnly("com.github.tachiyomiorg:image-decoder:fbd6601290")
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB