Removal of ShingekiNoShoujo (#17614)

* 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

* Deleted ShingekiNoShoujo.kt
Closes #17043
This commit is contained in:
Renato 2023-08-23 18:03:16 +02:00 committed by GitHub
parent 2ee2a60591
commit b7d961e353
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 0 additions and 226 deletions

View File

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View File

@ -1,11 +0,0 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
ext {
extName = 'Shingeki no Shoujo'
pkgNameSuffix = 'it.shingekinoshoujo'
extClass = '.ShingekiNoShoujo'
extVersionCode = 3
}
apply from: "$rootDir/common.gradle"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 167 KiB

View File

@ -1,213 +0,0 @@
package eu.kanade.tachiyomi.extension.it.shingekinoshoujo
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.source.model.Filter
import eu.kanade.tachiyomi.source.model.FilterList
import eu.kanade.tachiyomi.source.model.MangasPage
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.Headers
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.Response
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
class ShingekiNoShoujo : ParsedHttpSource() {
override val name = "Shingeki no Shoujo"
override val baseUrl = "https://shingekinoshoujo.it"
override val lang = "it"
override val supportsLatest = true
override val client: OkHttpClient = network.cloudflareClient
//region REQUESTS
override fun popularMangaRequest(page: Int): Request = GET("$baseUrl/", 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)
} else {
(if (filters.isEmpty()) getFilterList() else filters).forEach { filter ->
when (filter) {
is GenreSelez -> {
return GET(
"$baseUrl/tag/${getGenreList().filter {
filter.values[filter.state] == it.name
}.map { it.id }[0]}/page/$page",
)
}
else -> {}
}
}
return GET(baseUrl, headers)
}
}
//endregion
//region CONTENTS INFO
private fun mangasParse(response: Response, selector: String, num: Int): MangasPage {
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 mangas = document.select(selector).map { element ->
when (num) {
1 -> popularMangaFromElement(element)
2 -> latestUpdatesFromElement(element)
else -> searchMangaFromElement(element)
}
}
return MangasPage(
mangas,
!document.select(searchMangaNextPageSelector()).isEmpty(),
)
}
override fun popularMangaParse(response: Response): MangasPage = mangasParse(response, popularMangaSelector(), 1)
override fun latestUpdatesParse(response: Response): MangasPage = mangasParse(response, latestUpdatesSelector(), 2)
override fun searchMangaParse(response: Response): MangasPage = mangasParse(response, searchMangaSelector(), 3)
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.selectFirst("a")!!.let {
setUrlWithoutDomain(it.attr("href"))
title = it.attr("title").let { l ->
l.ifEmpty { it.text() }
}
}
}
override fun latestUpdatesFromElement(element: Element) = popularMangaFromElement(element)
override fun searchMangaFromElement(element: Element) = popularMangaFromElement(element)
override fun mangaDetailsParse(document: Document): SManga {
val statusElementText = document.select("blockquote").last()!!.text().lowercase()
return SManga.create().apply {
thumbnail_url = document.select(".wp-post-image").attr("src")
status = when {
statusElementText.contains("in corso") -> SManga.ONGOING
statusElementText.contains("fine") -> SManga.COMPLETED
statusElementText.contains("diritti") -> SManga.LICENSED
statusElementText.contains("sospeso") -> SManga.CANCELLED
statusElementText.contains("hiatus") -> SManga.ON_HIATUS
else -> SManga.UNKNOWN
}
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
//region NEXT SELECTOR - Not used
override fun popularMangaNextPageSelector(): String? = null
override fun latestUpdatesNextPageSelector() = searchMangaNextPageSelector()
override fun searchMangaNextPageSelector() = ".next.page-numbers"
//endregion
//region CHAPTER and PAGES
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()).forEachIndexed { i, it ->
chapters.add(
SChapter.create().apply {
setUrlWithoutDomain(it.attr("href"))
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()
}
},
)
}
chapters.reverse()
return chapters
}
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("article > .entry-content img").forEachIndexed { i, it ->
pages.add(Page(i, "", it.attr("src")))
}
if (document.toString().contains("che state leggendo")) {
pages.add(Page(1, "", "https://i.imgur.com/l0eZuoO.png"))
}
return pages
}
override fun imageUrlParse(document: Document) = ""
override fun imageRequest(page: Page): Request {
val imgHeader = Headers.Builder().apply {
add("User-Agent", "Mozilla/5.0 (Linux; U; Android 4.1.1; en-gb; Build/KLP) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30")
add("Referer", baseUrl)
}.build()
return GET(page.imageUrl!!, imgHeader)
}
//endregion
//region FILTERS
private class Genre(name: String, val id: String = name) : Filter.CheckBox(name)
private class GenreSelez(genres: List<Genre>) : Filter.Select<String>(
"Genere",
genres.map {
it.name
}.toTypedArray(),
0,
)
override fun getFilterList() = FilterList(
Filter.Header("La ricerca testuale non accetta i filtri e viceversa"),
GenreSelez(getGenreList()),
)
private fun getGenreList() = listOf(
Genre("Josei", "josei"),
Genre("Sportivo", "sportivo"),
Genre("Harlequin", "harlequin"),
Genre("Ufficio", "ufficio"),
Genre("Shoujo", "shoujo"),
Genre("Fujitani Yoko", "fujitani-yoko"),
Genre("Tsukishima Haru", "tsukishima-haru"),
Genre("Scolastico", "scolastico"),
Genre("Viaggio nel Tempo", "viaggio-nel-tempo"),
Genre("Vita Scolastica", "vita-scolastica"),
Genre("Seinen", "seinen"),
Genre("Drammatico", "drammatico"),
Genre("Commedia", "commedia"),
Genre("Drama", "drama"),
Genre("Oneshot", "oneshot"),
Genre("Mistero", "mistero"),
Genre("Saori", "saori"),
Genre("Fuji Momo", "fuji-momo"),
Genre("Azione", "azione"),
Genre("Sovrannaturale", "sovrannaturale"),
Genre("Vita Quotidiana", "vita-quotidiana"),
Genre("Storico", "storico"),
Genre("Shibano Yuka", "shibano-yuka"),
Genre("Fantasy", "fantasy"),
Genre("Smut", "smut"),
Genre("Psicologico", "psicologico"),
)
//endregion
}