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:
Renato 2023-05-30 16:49:12 +02:00 committed by GitHub
parent 78b9147c35
commit 7a8bc37fab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 17 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'Shingeki no Shoujo'
pkgNameSuffix = 'it.shingekinoshoujo'
extClass = '.ShingekiNoShoujo'
extVersionCode = 2
extVersionCode = 3
}
apply from: "$rootDir/common.gradle"

View File

@ -26,7 +26,7 @@ class ShingekiNoShoujo : ParsedHttpSource() {
//region REQUESTS
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 {
if (query.isNotEmpty()) {
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 searchMangaParse(response: Response): MangasPage = mangasParse(response, searchMangaSelector(), 3)
override fun popularMangaSelector() = ".lp-box"
override fun latestUpdatesSelector() = "article"
override fun popularMangaSelector() = "#content section .single-article:not([aria-hidden]) > figure"
override fun latestUpdatesSelector() = "#recent-tab > div > figure"
override fun searchMangaSelector() = "article.type-post"
override fun popularMangaFromElement(element: Element) = SManga.create().apply {
thumbnail_url = element.selectFirst("img")!!.attr("src")
element.select("a").first()!!.let {
element.selectFirst("a")!!.let {
setUrlWithoutDomain(it.attr("href"))
title = it.text()
title = it.attr("title").let { l ->
l.ifEmpty { it.text() }
}
}
}
override fun latestUpdatesFromElement(element: Element) = popularMangaFromElement(element)
@ -86,7 +88,7 @@ class ShingekiNoShoujo : ParsedHttpSource() {
override fun mangaDetailsParse(document: Document): SManga {
val statusElementText = document.select("blockquote").last()!!.text().lowercase()
return SManga.create().apply {
thumbnail_url = document.select(".header-image").attr("src")
thumbnail_url = document.select(".wp-post-image").attr("src")
status = when {
statusElementText.contains("in corso") -> SManga.ONGOING
statusElementText.contains("fine") -> SManga.COMPLETED
@ -95,9 +97,9 @@ class ShingekiNoShoujo : ParsedHttpSource() {
statusElementText.contains("hiatus") -> SManga.ON_HIATUS
else -> SManga.UNKNOWN
}
author = document.select("span:has(strong:contains(Autore))").text().substringAfter("Autore:").trim()
genre = document.select("span:has(strong:contains(Genere))").text().substringAfter("Genere:").replace(".", "").trim()
description = document.select("p:has(strong:contains(Trama))").text().substringAfter("Trama:").trim()
author = document.select(".entry-content span:has(strong:contains(Autore))").text().substringAfter("Autore:").trim()
genre = document.select(".entry-content span:has(strong:contains(Genere))").text().substringAfter("Genere:").replace(".", "").trim()
description = document.select(".entry-content p:has(strong:contains(Trama))").text().substringAfter("Trama:").trim()
}
}
//endregion
@ -113,15 +115,24 @@ class ShingekiNoShoujo : ParsedHttpSource() {
override fun chapterListParse(response: Response): List<SChapter> {
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>()
document.select(chapterListSelector().replace("<chapName>", document.location().substringAfter("$baseUrl/").substringBefore("/"))).forEachIndexed { i, it ->
document.select(chapterListSelector()).forEachIndexed { i, it ->
chapters.add(
SChapter.create().apply {
setUrlWithoutDomain(it.attr("href"))
name = it.text()
chapter_number = it.text().replace(Regex("OneShot|Prologo"), "0").filter { it.isDigit() }.let {
it.ifEmpty { "$i" }
}.toFloat()
it.text().let { n ->
name = n
chapter_number = n.replace(Regex("OneShot|Prologo"), "0").replace("Capitolo", "").let {
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()
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 pageListParse(document: Document): List<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")))
}
if (document.toString().contains("che state leggendo")) {