From df7a1d6a33e7bcc5e8b0fa2334bcbc07e8fe401c Mon Sep 17 00:00:00 2001 From: Ejan <35057681+e-shl@users.noreply.github.com> Date: Wed, 1 Jun 2022 07:34:09 +0500 Subject: [PATCH] [RU]mhentai delete (#12018) --- src/ru/mhentai/AndroidManifest.xml | 2 - src/ru/mhentai/build.gradle | 11 -- .../tachiyomi/extension/ru/mhentai/MHentai.kt | 122 ------------------ 3 files changed, 135 deletions(-) delete mode 100644 src/ru/mhentai/AndroidManifest.xml delete mode 100644 src/ru/mhentai/build.gradle delete mode 100644 src/ru/mhentai/src/eu/kanade/tachiyomi/extension/ru/mhentai/MHentai.kt diff --git a/src/ru/mhentai/AndroidManifest.xml b/src/ru/mhentai/AndroidManifest.xml deleted file mode 100644 index 30deb7f79..000000000 --- a/src/ru/mhentai/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/src/ru/mhentai/build.gradle b/src/ru/mhentai/build.gradle deleted file mode 100644 index 64986a5be..000000000 --- a/src/ru/mhentai/build.gradle +++ /dev/null @@ -1,11 +0,0 @@ -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' - -ext { - extName = 'MHentai' - pkgNameSuffix = 'ru.mhentai' - extClass = '.MHentai' - extVersionCode = 1 -} - -apply from: "$rootDir/common.gradle" diff --git a/src/ru/mhentai/src/eu/kanade/tachiyomi/extension/ru/mhentai/MHentai.kt b/src/ru/mhentai/src/eu/kanade/tachiyomi/extension/ru/mhentai/MHentai.kt deleted file mode 100644 index 302df496b..000000000 --- a/src/ru/mhentai/src/eu/kanade/tachiyomi/extension/ru/mhentai/MHentai.kt +++ /dev/null @@ -1,122 +0,0 @@ -package eu.kanade.tachiyomi.extension.ru.mhentai - -import eu.kanade.tachiyomi.network.GET -import eu.kanade.tachiyomi.source.model.FilterList -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 okhttp3.Request -import org.jsoup.nodes.Document -import org.jsoup.nodes.Element -import java.text.SimpleDateFormat -import java.util.Locale - -class MHentai : ParsedHttpSource() { - - override val name = "MHentai" - - override val baseUrl = "https://mhentai.ru" - - override val lang = "ru" - - override val supportsLatest = true - - override fun popularMangaRequest(page: Int): Request = - GET("$baseUrl/manga?page=$page", headers) - - override fun latestUpdatesRequest(page: Int): Request = - GET(baseUrl, headers) - - override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { - return GET("$baseUrl/search?query=$query") - } - - override fun popularMangaSelector() = "div.position-relative > a" - - override fun latestUpdatesSelector() = "div.item-spc" - - override fun searchMangaSelector() = "div.col-9 > a" - - override fun popularMangaFromElement(element: Element): SManga { - val manga = SManga.create() - manga.thumbnail_url = element.select("div.card-150 > img").first().attr("src") - element.select("a").first().let { - manga.setUrlWithoutDomain(it.attr("href")) - manga.title = it.text() - } - return manga - } - - override fun latestUpdatesFromElement(element: Element): SManga { - val manga = SManga.create() - manga.thumbnail_url = element.select("a > img").first().attr("src") - element.select("a").first().let { - manga.setUrlWithoutDomain(it.attr("href")) - } - element.select("h3.manga-name").first().let { - manga.title = it.text() - } - return manga - } - - override fun searchMangaFromElement(element: Element): SManga { - val manga = SManga.create() - manga.thumbnail_url = element.select("img").first().attr("src") - element.select("a").first().let { - manga.setUrlWithoutDomain(it.attr("href")) - manga.title = it.text() - } - return manga - } - - override fun popularMangaNextPageSelector() = "a.page-link[rel=next]" - - override fun latestUpdatesNextPageSelector() = popularMangaNextPageSelector() - - override fun searchMangaNextPageSelector() = popularMangaNextPageSelector() - - override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply { - setUrlWithoutDomain(document.location()) - title = document.selectFirst("title").text() - thumbnail_url = document.selectFirst("img.object-0").attr("src") - } - - override fun chapterListSelector() = "div.chapters-list > div" - - override fun chapterFromElement(element: Element): SChapter { - val urlElement = element.select("a").first() - val chapter = SChapter.create() - element.select("div.col-5").first().let { - chapter.name = it.text() - } - chapter.setUrlWithoutDomain(urlElement.attr("href")) - chapter.date_upload = element.select("div.col-5:eq(1)").text().toDate() - return chapter - } - - override fun pageListParse(document: Document): List { - return document.select("div.ch-show > img").mapIndexed { index, element -> - Page(index, "", getImage(element)) - } - } - - private fun getImage(first: Element): String? { - val image = first.attr("data-src") - if (image.isNotEmpty()) { - return image - } - return first.attr("src") - } - - override fun imageUrlParse(document: Document) = "" - - private fun String.toDate(): Long { - return runCatching { DATE_FORMATTER.parse(trim())?. time } - .getOrNull() ?: 0L - } - - companion object { - private val DATE_FORMATTER by lazy { SimpleDateFormat("yyyy-MM-dd", Locale.US) } - } -}