[Mangaeden] Fix images italian version (#3464)
* Fix images Based on the english version * Update build.gradle
This commit is contained in:
parent
d12d370e51
commit
e57d4704ad
|
@ -5,7 +5,7 @@ ext {
|
|||
appName = 'Tachiyomi: Mangaeden'
|
||||
pkgNameSuffix = 'it.mangaeden'
|
||||
extClass = '.Mangaeden'
|
||||
extVersionCode = 5
|
||||
extVersionCode = 6
|
||||
libVersion = '1.2'
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ import java.text.ParseException
|
|||
import java.text.SimpleDateFormat
|
||||
import java.util.Calendar
|
||||
import java.util.Locale
|
||||
import okhttp3.Headers
|
||||
import okhttp3.HttpUrl
|
||||
import okhttp3.Request
|
||||
import org.jsoup.nodes.Document
|
||||
|
@ -26,6 +27,11 @@ class Mangaeden : ParsedHttpSource() {
|
|||
|
||||
override val supportsLatest = true
|
||||
|
||||
// so hcaptcha won't be triggered on images
|
||||
override fun headersBuilder(): Headers.Builder {
|
||||
return super.headersBuilder().add("Referer", baseUrl)
|
||||
}
|
||||
|
||||
override fun latestUpdatesRequest(page: Int): Request = GET("$baseUrl/it/it-directory/?order=3&page=$page", headers)
|
||||
|
||||
override fun latestUpdatesSelector() = searchMangaSelector()
|
||||
|
@ -34,7 +40,7 @@ class Mangaeden : ParsedHttpSource() {
|
|||
|
||||
override fun latestUpdatesNextPageSelector() = searchMangaNextPageSelector()
|
||||
|
||||
override fun popularMangaRequest(page: Int): Request = GET("$baseUrl/it/it-directory/?page=$page", headers)
|
||||
override fun popularMangaRequest(page: Int): Request = GET("$baseUrl/it/it-directory/?order=1&page=$page", headers)
|
||||
|
||||
override fun popularMangaSelector() = searchMangaSelector()
|
||||
|
||||
|
@ -47,16 +53,16 @@ class Mangaeden : ParsedHttpSource() {
|
|||
(if (filters.isEmpty()) getFilterList() else filters).forEach { filter ->
|
||||
when (filter) {
|
||||
is StatusList -> filter.state
|
||||
.filter { it.state }
|
||||
.map { it.id.toString() }
|
||||
.forEach { url.addQueryParameter("status", it) }
|
||||
.filter { it.state }
|
||||
.map { it.id.toString() }
|
||||
.forEach { url.addQueryParameter("status", it) }
|
||||
is Types -> filter.state
|
||||
.filter { it.state }
|
||||
.map { it.id.toString() }
|
||||
.forEach { url.addQueryParameter("type", it) }
|
||||
.filter { it.state }
|
||||
.map { it.id.toString() }
|
||||
.forEach { url.addQueryParameter("type", it) }
|
||||
is GenreList -> filter.state
|
||||
.filterNot { it.isIgnored() }
|
||||
.forEach { genre -> url.addQueryParameter(if (genre.isIncluded()) "categoriesInc" else "categoriesExcl", genre.id) }
|
||||
.filter { !it.isIgnored() }
|
||||
.forEach { genre -> url.addQueryParameter(if (genre.isIncluded()) "categoriesInc" else "categoriesExcl", genre.id) }
|
||||
is TextField -> url.addQueryParameter(filter.key, filter.state)
|
||||
is OrderBy -> filter.state?.let {
|
||||
val sortId = it.index
|
||||
|
@ -68,13 +74,11 @@ class Mangaeden : ParsedHttpSource() {
|
|||
return GET(url.toString(), headers)
|
||||
}
|
||||
|
||||
override fun searchMangaSelector() = "table#mangaList > tbody > tr:has(td:gt(1))"
|
||||
override fun searchMangaSelector() = "table#mangaList tbody tr td:first-child a"
|
||||
|
||||
override fun searchMangaFromElement(element: Element) = SManga.create().apply {
|
||||
element.select("td > a").first()?.let {
|
||||
setUrlWithoutDomain(it.attr("href"))
|
||||
title = it.text()
|
||||
}
|
||||
setUrlWithoutDomain(element.attr("href"))
|
||||
title = element.text()
|
||||
}
|
||||
|
||||
override fun searchMangaNextPageSelector() = "a:has(span.next)"
|
||||
|
@ -87,8 +91,7 @@ class Mangaeden : ParsedHttpSource() {
|
|||
genre = infos.select("a[href^=/it/it-directory/?categoriesInc]").joinToString { it.text() }
|
||||
description = document.select("h2#mangaDescription").text()
|
||||
status = parseStatus(infos.select("h4:containsOwn(Stato)").first()?.nextSibling().toString())
|
||||
val img = infos.select("div.mangaImage2 > img").first()?.attr("src")
|
||||
if (!img.isNullOrBlank()) thumbnail_url = img.let { "https:$it" }
|
||||
thumbnail_url = document.select("div.mangaImage2 > img").attr("abs:src")
|
||||
}
|
||||
|
||||
private fun parseStatus(status: String) = when {
|
||||
|
@ -102,7 +105,7 @@ class Mangaeden : ParsedHttpSource() {
|
|||
override fun chapterFromElement(element: Element) = SChapter.create().apply {
|
||||
val a = element.select("a[href^=/it/it-manga/]").first()
|
||||
|
||||
setUrlWithoutDomain(a?.attr("href").orEmpty())
|
||||
setUrlWithoutDomain(a.attr("href"))
|
||||
name = a?.select("b")?.first()?.text().orEmpty()
|
||||
date_upload = element.select("td.chapterDate").first()?.text()?.let { parseChapterDate(it.trim()) } ?: 0L
|
||||
}
|
||||
|
@ -133,81 +136,82 @@ class Mangaeden : ParsedHttpSource() {
|
|||
}
|
||||
}
|
||||
|
||||
override fun pageListParse(document: Document): List<Page> = mutableListOf<Page>().apply {
|
||||
document.select("option[value^=/it/it-manga/]").forEach {
|
||||
add(Page(size, "$baseUrl${it.attr("value")}"))
|
||||
override fun pageListParse(document: Document): List<Page> {
|
||||
return document.select("select#pageSelect option").mapIndexed { i, element ->
|
||||
Page(i, element.attr("abs:value"))
|
||||
}
|
||||
}
|
||||
|
||||
override fun imageUrlParse(document: Document): String = document.select("a#nextA.next > img").first()?.attr("src").let { "https:$it" }
|
||||
override fun imageUrlParse(document: Document): String = document.select("a.next img").attr("abs:src")
|
||||
|
||||
private class NamedId(name: String, val id: Int) : Filter.CheckBox(name)
|
||||
private class Genre(name: String, val id: String) : Filter.TriState(name)
|
||||
private class TextField(name: String, val key: String) : Filter.Text(name)
|
||||
private class OrderBy : Filter.Sort("Ordina per", arrayOf("Titolo manga", "Visite", "Capitoli", "Ultimo capitolo"),
|
||||
Selection(1, false))
|
||||
private class OrderBy : Filter.Sort("Order by", arrayOf("Titolo manga", "Visite", "Capitoli", "Ultimo capitolo"),
|
||||
Selection(1, false))
|
||||
|
||||
private class StatusList(statuses: List<NamedId>) : Filter.Group<NamedId>("Stato", statuses)
|
||||
private class Types(types: List<NamedId>) : Filter.Group<NamedId>("Tipo", types)
|
||||
private class GenreList(genres: List<Genre>) : Filter.Group<Genre>("Generi", genres)
|
||||
|
||||
override fun getFilterList() = FilterList(
|
||||
TextField("Autore", "author"),
|
||||
TextField("Artista", "artist"),
|
||||
OrderBy(),
|
||||
Types(types()),
|
||||
StatusList(statuses()),
|
||||
GenreList(genres())
|
||||
TextField("Autore", "author"),
|
||||
TextField("Artista", "artist"),
|
||||
OrderBy(),
|
||||
Types(types()),
|
||||
StatusList(statuses()),
|
||||
GenreList(genres())
|
||||
)
|
||||
|
||||
private fun types() = listOf(
|
||||
NamedId("Japanese Manga", 0),
|
||||
NamedId("Korean Manhwa", 1),
|
||||
NamedId("Chinese Manhua", 2),
|
||||
NamedId("Comic", 3),
|
||||
NamedId("Doujinshi", 4)
|
||||
NamedId("Japanese Manga", 0),
|
||||
NamedId("Korean Manhwa", 1),
|
||||
NamedId("Chinese Manhua", 2),
|
||||
NamedId("Comic", 3),
|
||||
NamedId("Doujinshi", 4)
|
||||
)
|
||||
|
||||
private fun statuses() = listOf(
|
||||
NamedId("In corso", 1),
|
||||
NamedId("Completato", 2),
|
||||
NamedId("Sospeso", 0)
|
||||
NamedId("In corso", 1),
|
||||
NamedId("Completato", 2),
|
||||
NamedId("Sospeso", 0)
|
||||
)
|
||||
|
||||
private fun genres() = listOf(
|
||||
Genre("Avventura", "4e70ea8cc092255ef70073d3"),
|
||||
Genre("Azione", "4e70ea8cc092255ef70073c3"),
|
||||
Genre("Bara", "4e70ea90c092255ef70074b7"),
|
||||
Genre("Commedia", "4e70ea8cc092255ef70073d0"),
|
||||
Genre("Demenziale", "4e70ea8fc092255ef7007475"),
|
||||
Genre("Dounshinji", "4e70ea93c092255ef70074e4"),
|
||||
Genre("Drama", "4e70ea8cc092255ef70073f9"),
|
||||
Genre("Ecchi", "4e70ea8cc092255ef70073cd"),
|
||||
Genre("Fantasy", "4e70ea8cc092255ef70073c4"),
|
||||
Genre("Harem", "4e70ea8cc092255ef70073d1"),
|
||||
Genre("Hentai", "4e70ea90c092255ef700749a"),
|
||||
Genre("Horror", "4e70ea8cc092255ef70073ce"),
|
||||
Genre("Josei", "4e70ea90c092255ef70074bd"),
|
||||
Genre("Magico", "4e70ea93c092255ef700751b"),
|
||||
Genre("Mecha", "4e70ea8cc092255ef70073ef"),
|
||||
Genre("Misteri", "4e70ea8dc092255ef700740a"),
|
||||
Genre("Musica", "4e70ea8fc092255ef7007456"),
|
||||
Genre("Psicologico", "4e70ea8ec092255ef7007439"),
|
||||
Genre("Raccolta", "4e70ea90c092255ef70074ae"),
|
||||
Genre("Romantico", "4e70ea8cc092255ef70073c5"),
|
||||
Genre("Sci-Fi", "4e70ea8cc092255ef70073e4"),
|
||||
Genre("Scolastico", "4e70ea8cc092255ef70073e5"),
|
||||
Genre("Seinen", "4e70ea8cc092255ef70073ea"),
|
||||
Genre("Sentimentale", "4e70ea8dc092255ef7007432"),
|
||||
Genre("Shota", "4e70ea90c092255ef70074b8"),
|
||||
Genre("Shoujo", "4e70ea8dc092255ef7007421"),
|
||||
Genre("Shounen", "4e70ea8cc092255ef70073c6"),
|
||||
Genre("Sovrannaturale", "4e70ea8cc092255ef70073c7"),
|
||||
Genre("Splatter", "4e70ea99c092255ef70075a3"),
|
||||
Genre("Sportivo", "4e70ea8dc092255ef7007426"),
|
||||
Genre("Storico", "4e70ea8cc092255ef70073f4"),
|
||||
Genre("Vita Quotidiana", "4e70ea8ec092255ef700743f"),
|
||||
Genre("Yaoi", "4e70ea8cc092255ef70073de"),
|
||||
Genre("Yuri", "4e70ea9ac092255ef70075d1")
|
||||
|
||||
Genre("Avventura", "4e70ea8cc092255ef70073d3"),
|
||||
Genre("Azione", "4e70ea8cc092255ef70073c3"),
|
||||
Genre("Bara", "4e70ea90c092255ef70074b7"),
|
||||
Genre("Commedia", "4e70ea8cc092255ef70073d0"),
|
||||
Genre("Demenziale", "4e70ea8fc092255ef7007475"),
|
||||
Genre("Dounshinji", "4e70ea93c092255ef70074e4"),
|
||||
Genre("Drama", "4e70ea8cc092255ef70073f9"),
|
||||
Genre("Ecchi", "4e70ea8cc092255ef70073cd"),
|
||||
Genre("Fantasy", "4e70ea8cc092255ef70073c4"),
|
||||
Genre("Harem", "4e70ea8cc092255ef70073d1"),
|
||||
Genre("Hentai", "4e70ea90c092255ef700749a"),
|
||||
Genre("Horror", "4e70ea8cc092255ef70073ce"),
|
||||
Genre("Josei", "4e70ea90c092255ef70074bd"),
|
||||
Genre("Magico", "4e70ea93c092255ef700751b"),
|
||||
Genre("Mecha", "4e70ea8cc092255ef70073ef"),
|
||||
Genre("Misteri", "4e70ea8dc092255ef700740a"),
|
||||
Genre("Musica", "4e70ea8fc092255ef7007456"),
|
||||
Genre("Psicologico", "4e70ea8ec092255ef7007439"),
|
||||
Genre("Raccolta", "4e70ea90c092255ef70074ae"),
|
||||
Genre("Romantico", "4e70ea8cc092255ef70073c5"),
|
||||
Genre("Sci-Fi", "4e70ea8cc092255ef70073e4"),
|
||||
Genre("Scolastico", "4e70ea8cc092255ef70073e5"),
|
||||
Genre("Seinen", "4e70ea8cc092255ef70073ea"),
|
||||
Genre("Sentimentale", "4e70ea8dc092255ef7007432"),
|
||||
Genre("Shota", "4e70ea90c092255ef70074b8"),
|
||||
Genre("Shoujo", "4e70ea8dc092255ef7007421"),
|
||||
Genre("Shounen", "4e70ea8cc092255ef70073c6"),
|
||||
Genre("Sovrannaturale", "4e70ea8cc092255ef70073c7"),
|
||||
Genre("Splatter", "4e70ea99c092255ef70075a3"),
|
||||
Genre("Sportivo", "4e70ea8dc092255ef7007426"),
|
||||
Genre("Storico", "4e70ea8cc092255ef70073f4"),
|
||||
Genre("Vita Quotidiana", "4e70ea8ec092255ef700743f"),
|
||||
Genre("Yaoi", "4e70ea8cc092255ef70073de"),
|
||||
Genre("Yuri", "4e70ea9ac092255ef70075d1")
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue