diff --git a/src/it/shingekinoshoujo/build.gradle b/src/it/shingekinoshoujo/build.gradle index 03c75a817..4add2bc45 100644 --- a/src/it/shingekinoshoujo/build.gradle +++ b/src/it/shingekinoshoujo/build.gradle @@ -5,7 +5,7 @@ ext { extName = 'Shingeki no Shoujo' pkgNameSuffix = 'it.shingekinoshoujo' extClass = '.ShingekiNoShoujo' - extVersionCode = 2 + extVersionCode = 3 } apply from: "$rootDir/common.gradle" diff --git a/src/it/shingekinoshoujo/src/eu/kanade/tachiyomi/extension/it/shingekinoshoujo/ShingekiNoShoujo.kt b/src/it/shingekinoshoujo/src/eu/kanade/tachiyomi/extension/it/shingekinoshoujo/ShingekiNoShoujo.kt index 94d70e728..37538af91 100644 --- a/src/it/shingekinoshoujo/src/eu/kanade/tachiyomi/extension/it/shingekinoshoujo/ShingekiNoShoujo.kt +++ b/src/it/shingekinoshoujo/src/eu/kanade/tachiyomi/extension/it/shingekinoshoujo/ShingekiNoShoujo.kt @@ -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 { 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() - document.select(chapterListSelector().replace("", 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 { val pages = mutableListOf() - 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")) {