Fixed ShingekiNoShoujo (#16599)
* Fixed ShingekiNoShoujo Changed url Fixed the code for the new site * Changed build.gradle * Fixed ShingekiNoShoujo Modified the endpoints and the selectors because they modified the website * Fixes to the code
This commit is contained in:
parent
78b9147c35
commit
7a8bc37fab
|
@ -5,7 +5,7 @@ ext {
|
||||||
extName = 'Shingeki no Shoujo'
|
extName = 'Shingeki no Shoujo'
|
||||||
pkgNameSuffix = 'it.shingekinoshoujo'
|
pkgNameSuffix = 'it.shingekinoshoujo'
|
||||||
extClass = '.ShingekiNoShoujo'
|
extClass = '.ShingekiNoShoujo'
|
||||||
extVersionCode = 2
|
extVersionCode = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$rootDir/common.gradle"
|
apply from: "$rootDir/common.gradle"
|
||||||
|
|
|
@ -26,7 +26,7 @@ class ShingekiNoShoujo : ParsedHttpSource() {
|
||||||
|
|
||||||
//region REQUESTS
|
//region REQUESTS
|
||||||
override fun popularMangaRequest(page: Int): Request = GET("$baseUrl/", headers)
|
override fun popularMangaRequest(page: Int): Request = GET("$baseUrl/", headers)
|
||||||
override fun latestUpdatesRequest(page: Int): Request = GET("$baseUrl/category/novita/", headers)
|
override fun latestUpdatesRequest(page: Int): Request = GET("$baseUrl/#recent-tab", headers)
|
||||||
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
||||||
if (query.isNotEmpty()) {
|
if (query.isNotEmpty()) {
|
||||||
return GET("$baseUrl/page/$page/?s=$query", headers)
|
return GET("$baseUrl/page/$page/?s=$query", headers)
|
||||||
|
@ -69,15 +69,17 @@ class ShingekiNoShoujo : ParsedHttpSource() {
|
||||||
override fun latestUpdatesParse(response: Response): MangasPage = mangasParse(response, latestUpdatesSelector(), 2)
|
override fun latestUpdatesParse(response: Response): MangasPage = mangasParse(response, latestUpdatesSelector(), 2)
|
||||||
override fun searchMangaParse(response: Response): MangasPage = mangasParse(response, searchMangaSelector(), 3)
|
override fun searchMangaParse(response: Response): MangasPage = mangasParse(response, searchMangaSelector(), 3)
|
||||||
|
|
||||||
override fun popularMangaSelector() = ".lp-box"
|
override fun popularMangaSelector() = "#content section .single-article:not([aria-hidden]) > figure"
|
||||||
override fun latestUpdatesSelector() = "article"
|
override fun latestUpdatesSelector() = "#recent-tab > div > figure"
|
||||||
override fun searchMangaSelector() = "article.type-post"
|
override fun searchMangaSelector() = "article.type-post"
|
||||||
|
|
||||||
override fun popularMangaFromElement(element: Element) = SManga.create().apply {
|
override fun popularMangaFromElement(element: Element) = SManga.create().apply {
|
||||||
thumbnail_url = element.selectFirst("img")!!.attr("src")
|
thumbnail_url = element.selectFirst("img")!!.attr("src")
|
||||||
element.select("a").first()!!.let {
|
element.selectFirst("a")!!.let {
|
||||||
setUrlWithoutDomain(it.attr("href"))
|
setUrlWithoutDomain(it.attr("href"))
|
||||||
title = it.text()
|
title = it.attr("title").let { l ->
|
||||||
|
l.ifEmpty { it.text() }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
override fun latestUpdatesFromElement(element: Element) = popularMangaFromElement(element)
|
override fun latestUpdatesFromElement(element: Element) = popularMangaFromElement(element)
|
||||||
|
@ -86,7 +88,7 @@ class ShingekiNoShoujo : ParsedHttpSource() {
|
||||||
override fun mangaDetailsParse(document: Document): SManga {
|
override fun mangaDetailsParse(document: Document): SManga {
|
||||||
val statusElementText = document.select("blockquote").last()!!.text().lowercase()
|
val statusElementText = document.select("blockquote").last()!!.text().lowercase()
|
||||||
return SManga.create().apply {
|
return SManga.create().apply {
|
||||||
thumbnail_url = document.select(".header-image").attr("src")
|
thumbnail_url = document.select(".wp-post-image").attr("src")
|
||||||
status = when {
|
status = when {
|
||||||
statusElementText.contains("in corso") -> SManga.ONGOING
|
statusElementText.contains("in corso") -> SManga.ONGOING
|
||||||
statusElementText.contains("fine") -> SManga.COMPLETED
|
statusElementText.contains("fine") -> SManga.COMPLETED
|
||||||
|
@ -95,9 +97,9 @@ class ShingekiNoShoujo : ParsedHttpSource() {
|
||||||
statusElementText.contains("hiatus") -> SManga.ON_HIATUS
|
statusElementText.contains("hiatus") -> SManga.ON_HIATUS
|
||||||
else -> SManga.UNKNOWN
|
else -> SManga.UNKNOWN
|
||||||
}
|
}
|
||||||
author = document.select("span:has(strong:contains(Autore))").text().substringAfter("Autore:").trim()
|
author = document.select(".entry-content span:has(strong:contains(Autore))").text().substringAfter("Autore:").trim()
|
||||||
genre = document.select("span:has(strong:contains(Genere))").text().substringAfter("Genere:").replace(".", "").trim()
|
genre = document.select(".entry-content span:has(strong:contains(Genere))").text().substringAfter("Genere:").replace(".", "").trim()
|
||||||
description = document.select("p:has(strong:contains(Trama))").text().substringAfter("Trama:").trim()
|
description = document.select(".entry-content p:has(strong:contains(Trama))").text().substringAfter("Trama:").trim()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//endregion
|
//endregion
|
||||||
|
@ -113,15 +115,24 @@ class ShingekiNoShoujo : ParsedHttpSource() {
|
||||||
|
|
||||||
override fun chapterListParse(response: Response): List<SChapter> {
|
override fun chapterListParse(response: Response): List<SChapter> {
|
||||||
val document = response.asJsoup()
|
val document = response.asJsoup()
|
||||||
|
if (document.select("#login > .custom-message").size > 0) throw Exception("Devi accedere al sito web con il tuo account!\nPremi WebView (il pulsante con il globo)\ne accedi normalmente")
|
||||||
val chapters = mutableListOf<SChapter>()
|
val chapters = mutableListOf<SChapter>()
|
||||||
document.select(chapterListSelector().replace("<chapName>", document.location().substringAfter("$baseUrl/").substringBefore("/"))).forEachIndexed { i, it ->
|
document.select(chapterListSelector()).forEachIndexed { i, it ->
|
||||||
chapters.add(
|
chapters.add(
|
||||||
SChapter.create().apply {
|
SChapter.create().apply {
|
||||||
setUrlWithoutDomain(it.attr("href"))
|
setUrlWithoutDomain(it.attr("href"))
|
||||||
name = it.text()
|
it.text().let { n ->
|
||||||
chapter_number = it.text().replace(Regex("OneShot|Prologo"), "0").filter { it.isDigit() }.let {
|
name = n
|
||||||
it.ifEmpty { "$i" }
|
chapter_number = n.replace(Regex("OneShot|Prologo"), "0").replace("Capitolo", "").let {
|
||||||
}.toFloat()
|
if (!it.contains(Regex("[0-9]\\."))) {
|
||||||
|
it.filter { t -> t.isDigit() }.let { t ->
|
||||||
|
t.ifEmpty { "$i" }
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
it
|
||||||
|
}
|
||||||
|
}.toFloat()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -129,13 +140,13 @@ class ShingekiNoShoujo : ParsedHttpSource() {
|
||||||
chapters.reverse()
|
chapters.reverse()
|
||||||
return chapters
|
return chapters
|
||||||
}
|
}
|
||||||
override fun chapterListSelector() = ".entry-content > ul > li"
|
override fun chapterListSelector() = ".entry-content > blockquote span > strong a, .entry-content > ul > li a"
|
||||||
override fun chapterFromElement(element: Element) = throw Exception("Not used")
|
override fun chapterFromElement(element: Element) = throw Exception("Not used")
|
||||||
|
|
||||||
override fun pageListParse(document: Document): List<Page> {
|
override fun pageListParse(document: Document): List<Page> {
|
||||||
val pages = mutableListOf<Page>()
|
val pages = mutableListOf<Page>()
|
||||||
|
|
||||||
document.select(".alignnone").forEachIndexed { i, it ->
|
document.select("article > .entry-content img").forEachIndexed { i, it ->
|
||||||
pages.add(Page(i, "", it.attr("src")))
|
pages.add(Page(i, "", it.attr("src")))
|
||||||
}
|
}
|
||||||
if (document.toString().contains("che state leggendo")) {
|
if (document.toString().contains("che state leggendo")) {
|
||||||
|
|
Loading…
Reference in New Issue