Add The Duck Webcomics (#9378)
This commit is contained in:
parent
516be4d204
commit
604ad98b68
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest package="eu.kanade.tachiyomi.extension" />
|
|
@ -0,0 +1,12 @@
|
|||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'kotlin-android'
|
||||
|
||||
ext {
|
||||
extName = 'The Duck Webcomics'
|
||||
pkgNameSuffix = 'en.theduckwebcomics'
|
||||
extClass = '.TheDuckWebcomics'
|
||||
extVersionCode = 1
|
||||
isNsfw = true
|
||||
}
|
||||
|
||||
apply from: "$rootDir/common.gradle"
|
Binary file not shown.
After Width: | Height: | Size: 4.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.7 KiB |
Binary file not shown.
After Width: | Height: | Size: 6.4 KiB |
Binary file not shown.
After Width: | Height: | Size: 9.5 KiB |
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
Binary file not shown.
After Width: | Height: | Size: 70 KiB |
|
@ -0,0 +1,138 @@
|
|||
package eu.kanade.tachiyomi.extension.en.theduckwebcomics
|
||||
|
||||
import eu.kanade.tachiyomi.source.model.Filter
|
||||
import okhttp3.HttpUrl
|
||||
|
||||
class Label(name: String, val value: String) : Filter.CheckBox(name)
|
||||
|
||||
interface QueryParam {
|
||||
val param: String
|
||||
|
||||
fun encode(url: HttpUrl.Builder)
|
||||
}
|
||||
|
||||
sealed class LabelGroup(
|
||||
name: String,
|
||||
values: List<Label>
|
||||
) : QueryParam, Filter.Group<Label>(name, values) {
|
||||
override fun encode(url: HttpUrl.Builder) =
|
||||
state.filter { it.state }.forEach {
|
||||
url.addQueryParameter(param, it.value)
|
||||
}
|
||||
}
|
||||
|
||||
class TypeFilter(
|
||||
values: List<Label> = types
|
||||
) : LabelGroup("Type of comic", values) {
|
||||
override val param = "type"
|
||||
|
||||
companion object {
|
||||
private val types: List<Label>
|
||||
get() = listOf(
|
||||
Label("Comic Strip", "0"),
|
||||
Label("Comic Book/Story", "1"),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
class ToneFilter(
|
||||
values: List<Label> = tones
|
||||
) : LabelGroup("Tone", values) {
|
||||
override val param = "tone"
|
||||
|
||||
companion object {
|
||||
private val tones: List<Label>
|
||||
get() = listOf(
|
||||
Label("Comedy", "0"),
|
||||
Label("Drama", "1"),
|
||||
// Label("N/A", "2"),
|
||||
Label("Other", "3"),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
class StyleFilter(
|
||||
values: List<Label> = styles
|
||||
) : LabelGroup("Art style", values) {
|
||||
override val param = "style"
|
||||
|
||||
companion object {
|
||||
private val styles: List<Label>
|
||||
get() = listOf(
|
||||
Label("Cartoon", "0"),
|
||||
Label("American", "1"),
|
||||
Label("Manga", "2"),
|
||||
Label("Realism", "3"),
|
||||
Label("Sprite", "4"),
|
||||
Label("Sketch", "5"),
|
||||
Label("Experimental", "6"),
|
||||
Label("Photographic", "7"),
|
||||
Label("Stick Figure", "8"),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
class GenreFilter(
|
||||
values: List<Label> = genres
|
||||
) : LabelGroup("Genre", values) {
|
||||
override val param = "genre"
|
||||
|
||||
companion object {
|
||||
private val genres: List<Label>
|
||||
get() = listOf(
|
||||
Label("Fantasy", "0"),
|
||||
Label("Parody", "1"),
|
||||
Label("Real Life", "2"),
|
||||
Label("Sci-Fi", "4"),
|
||||
Label("Horror", "5"),
|
||||
Label("Abstract", "6"),
|
||||
Label("Adventure", "8"),
|
||||
Label("Noir", "9"),
|
||||
// Label("N/A", "10"),
|
||||
// Label("N/A", "11"),
|
||||
Label("Political", "12"),
|
||||
Label("Spiritual", "13"),
|
||||
Label("Romance", "14"),
|
||||
Label("Superhero", "15"),
|
||||
Label("Western", "16"),
|
||||
Label("Mystery", "17"),
|
||||
Label("War", "18"),
|
||||
Label("Tribute", "19"),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
class RatingFilter(
|
||||
values: List<Label> = ratings
|
||||
) : LabelGroup("Rating", values) {
|
||||
override val param = "rating"
|
||||
|
||||
companion object {
|
||||
private val ratings: List<Label>
|
||||
get() = listOf(
|
||||
Label("Everyone", "E"),
|
||||
Label("Teen", "T"),
|
||||
Label("Mature", "M"),
|
||||
Label("Adult", "A"),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
class UpdateFilter(
|
||||
values: Array<String> = labels.keys.toTypedArray()
|
||||
) : QueryParam, Filter.Select<String>("Last update", values) {
|
||||
override val param = "last_update"
|
||||
|
||||
override fun encode(url: HttpUrl.Builder) {
|
||||
url.addQueryParameter(param, labels[values[state]])
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val labels = mapOf(
|
||||
"Any" to "",
|
||||
"Today" to "today",
|
||||
"Last week" to "week",
|
||||
"Last month" to "month",
|
||||
)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,107 @@
|
|||
package eu.kanade.tachiyomi.extension.en.theduckwebcomics
|
||||
|
||||
import eu.kanade.tachiyomi.network.GET
|
||||
import eu.kanade.tachiyomi.source.model.FilterList
|
||||
import eu.kanade.tachiyomi.source.model.Page
|
||||
import eu.kanade.tachiyomi.source.model.SChapter
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
|
||||
import eu.kanade.tachiyomi.util.asJsoup
|
||||
import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||
import okhttp3.Response
|
||||
import org.jsoup.nodes.Document
|
||||
import org.jsoup.nodes.Element
|
||||
|
||||
class TheDuckWebcomics : ParsedHttpSource() {
|
||||
override val name = "The Duck Webcomics"
|
||||
|
||||
override val baseUrl = "https://www.theduckwebcomics.com"
|
||||
|
||||
override val lang = "en"
|
||||
|
||||
override val supportsLatest = true
|
||||
|
||||
override fun latestUpdatesSelector() = searchMangaSelector()
|
||||
|
||||
override fun latestUpdatesNextPageSelector() = searchMangaNextPageSelector()
|
||||
|
||||
override fun latestUpdatesRequest(page: Int) =
|
||||
GET("$baseUrl/search/?page=$page&last_update=today", headers)
|
||||
|
||||
override fun latestUpdatesFromElement(element: Element) =
|
||||
searchMangaFromElement(element)
|
||||
|
||||
override fun popularMangaSelector() = searchMangaSelector()
|
||||
|
||||
override fun popularMangaNextPageSelector() = searchMangaNextPageSelector()
|
||||
|
||||
override fun popularMangaRequest(page: Int) =
|
||||
GET("$baseUrl/search/?page=$page", headers)
|
||||
|
||||
override fun popularMangaFromElement(element: Element) =
|
||||
searchMangaFromElement(element)
|
||||
|
||||
override fun searchMangaSelector() = ".breadcrumb ~ div[style]"
|
||||
|
||||
override fun searchMangaNextPageSelector() = "a.next"
|
||||
|
||||
override fun searchMangaRequest(page: Int, query: String, filters: FilterList) =
|
||||
"$baseUrl/search".toHttpUrl().newBuilder().run {
|
||||
addQueryParameter("search", query)
|
||||
addQueryParameter("page", page.toString())
|
||||
filters.forEach { (it as QueryParam).encode(this) }
|
||||
GET(toString(), headers)
|
||||
}
|
||||
|
||||
override fun searchMangaFromElement(element: Element) =
|
||||
SManga.create().apply {
|
||||
element.selectFirst(".size24").let {
|
||||
title = it.text()
|
||||
url = it.attr("href")
|
||||
}
|
||||
genre = element.selectFirst(".size10").text().substringBefore(",")
|
||||
description = element.selectFirst(".comicdescparagraphs").text()
|
||||
thumbnail_url = element.selectFirst("img").absUrl("src")
|
||||
author = element.selectFirst(".size18").text()
|
||||
artist = author
|
||||
}
|
||||
|
||||
// The details are only available in search
|
||||
override fun fetchMangaDetails(manga: SManga) =
|
||||
rx.Observable.just(manga.apply { initialized = true })!!
|
||||
|
||||
override fun chapterListSelector() = "#page_dropdown > option"
|
||||
|
||||
override fun chapterListParse(response: Response) =
|
||||
response.asJsoup().run {
|
||||
selectFirst(".yellow-box > .paranomargin")?.text()?.let(::error)
|
||||
select(chapterListSelector()).mapIndexed { idx, el ->
|
||||
SChapter.create().apply {
|
||||
chapter_number = idx + 1f
|
||||
name = el.text().substringAfter("- ")
|
||||
setUrlWithoutDomain(el.absUrl("value") + '/')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun pageListParse(document: Document) =
|
||||
listOf(Page(0, "", document.selectFirst(".page-image").attr("src")))
|
||||
|
||||
override fun mangaDetailsParse(document: Document) =
|
||||
throw UnsupportedOperationException("Not used")
|
||||
|
||||
override fun chapterFromElement(element: Element) =
|
||||
throw UnsupportedOperationException("Not used")
|
||||
|
||||
override fun imageUrlParse(document: Document) =
|
||||
throw UnsupportedOperationException("Not used")
|
||||
|
||||
override fun getFilterList() = FilterList(
|
||||
TypeFilter(),
|
||||
ToneFilter(),
|
||||
StyleFilter(),
|
||||
GenreFilter(),
|
||||
RatingFilter(),
|
||||
UpdateFilter()
|
||||
)
|
||||
}
|
Loading…
Reference in New Issue