From 64432f50bafdcb7285a3fa068219570d09112872 Mon Sep 17 00:00:00 2001 From: Yutou <583819556@qq.com> Date: Wed, 22 May 2024 10:05:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8C=85=E5=AD=90=E6=BC=AB?= =?UTF-8?q?=E7=94=BB=E5=AF=BC=E8=88=AA=E8=A7=A3=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../all/mangadex/MdUserAgentInterceptor.kt | 1 - .../en/collectedcurios/Collectedcurios.kt | 5 +- .../tachiyomi/extension/ja/twi4/Twi4.kt | 2 +- .../extension/ru/mangaclub/MangaClub.kt | 14 +- .../extension/zh/baimangu/Baimangu.kt | 8 +- src/zh/baozimhorg/build.gradle | 2 +- .../extension/zh/baozimhorg/BaozimhOrg.kt | 169 ++++++++++++++---- .../extension/zh/baozimhorg/UrlInterceptor.kt | 3 + .../extension/zh/picacomic/Picacomic.kt | 1 - 9 files changed, 155 insertions(+), 50 deletions(-) diff --git a/src/all/mangadex/src/eu/kanade/tachiyomi/extension/all/mangadex/MdUserAgentInterceptor.kt b/src/all/mangadex/src/eu/kanade/tachiyomi/extension/all/mangadex/MdUserAgentInterceptor.kt index 1771daf9..451f1ebe 100644 --- a/src/all/mangadex/src/eu/kanade/tachiyomi/extension/all/mangadex/MdUserAgentInterceptor.kt +++ b/src/all/mangadex/src/eu/kanade/tachiyomi/extension/all/mangadex/MdUserAgentInterceptor.kt @@ -3,7 +3,6 @@ package eu.kanade.tachiyomi.extension.all.mangadex import android.content.SharedPreferences import okhttp3.Interceptor import okhttp3.Response -import java.io.IOException /** * Interceptor to set custom useragent for MangaDex diff --git a/src/en/collectedcurios/src/eu/kanade/tachiyomi/extension/en/collectedcurios/Collectedcurios.kt b/src/en/collectedcurios/src/eu/kanade/tachiyomi/extension/en/collectedcurios/Collectedcurios.kt index fac6bf87..982d78dd 100644 --- a/src/en/collectedcurios/src/eu/kanade/tachiyomi/extension/en/collectedcurios/Collectedcurios.kt +++ b/src/en/collectedcurios/src/eu/kanade/tachiyomi/extension/en/collectedcurios/Collectedcurios.kt @@ -1,6 +1,5 @@ package eu.kanade.tachiyomi.extension.en.collectedcurios -import android.util.Log import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.MangasPage import eu.kanade.tachiyomi.source.model.Page @@ -58,7 +57,7 @@ class Collectedcurios : ParsedHttpSource() { description = "Spider and Scorpion webcomic." thumbnail_url = "https://www.collectedcurios.com/images/CC_2011_Spider_And_Scorpion_Button.jpg" }, - */ + */ ), false, ), @@ -113,7 +112,7 @@ class Collectedcurios : ParsedHttpSource() { override fun imageUrlParse(response: Response): String { val url = response.request.url.toString() val document = response.asJsoup() - + return when { url.contains("sequentialart") -> document.selectFirst(".w3-image")!!.absUrl("src") diff --git a/src/ja/twi4/src/eu/kanade/tachiyomi/extension/ja/twi4/Twi4.kt b/src/ja/twi4/src/eu/kanade/tachiyomi/extension/ja/twi4/Twi4.kt index 214e7cff..653129eb 100644 --- a/src/ja/twi4/src/eu/kanade/tachiyomi/extension/ja/twi4/Twi4.kt +++ b/src/ja/twi4/src/eu/kanade/tachiyomi/extension/ja/twi4/Twi4.kt @@ -68,7 +68,7 @@ class Twi4 : HttpSource() { author = manga.select("div.hgroup > p").text() status = if (manga.select("ul:first-child > li:last-child > em.is-completed") - .isEmpty() + .isEmpty() ) { SManga.ONGOING } else { diff --git a/src/ru/mangaclub/src/eu/kanade/tachiyomi/extension/ru/mangaclub/MangaClub.kt b/src/ru/mangaclub/src/eu/kanade/tachiyomi/extension/ru/mangaclub/MangaClub.kt index 82cd6a49..a3decc48 100644 --- a/src/ru/mangaclub/src/eu/kanade/tachiyomi/extension/ru/mangaclub/MangaClub.kt +++ b/src/ru/mangaclub/src/eu/kanade/tachiyomi/extension/ru/mangaclub/MangaClub.kt @@ -97,11 +97,15 @@ class MangaClub : ParsedHttpSource() { title = document.select("div.info strong").text().replace("\\'", "'").substringBefore("/").trim() author = document.select("div.info a[href*=author]").joinToString(", ") { it.text().trim() } artist = author - status = if (document.select("div.fullstory").text().contains("Данное произведение лицензировано на территории РФ. Главы удалены.")) SManga.LICENSED else when (document.select("div.info a[href*=status_translation]").text().trim()) { - "Продолжается" -> SManga.ONGOING - "Завершен" -> SManga.COMPLETED - "Заморожено/Заброшено" -> SManga.ON_HIATUS - else -> SManga.UNKNOWN + status = if (document.select("div.fullstory").text().contains("Данное произведение лицензировано на территории РФ. Главы удалены.")) { + SManga.LICENSED + } else { + when (document.select("div.info a[href*=status_translation]").text().trim()) { + "Продолжается" -> SManga.ONGOING + "Завершен" -> SManga.COMPLETED + "Заморожено/Заброшено" -> SManga.ON_HIATUS + else -> SManga.UNKNOWN + } } description = document.select(".description").first()!!.text() diff --git a/src/zh/baimangu/src/eu/kanade/tachiyomi/extension/zh/baimangu/Baimangu.kt b/src/zh/baimangu/src/eu/kanade/tachiyomi/extension/zh/baimangu/Baimangu.kt index 4987b87a..47e7a01b 100644 --- a/src/zh/baimangu/src/eu/kanade/tachiyomi/extension/zh/baimangu/Baimangu.kt +++ b/src/zh/baimangu/src/eu/kanade/tachiyomi/extension/zh/baimangu/Baimangu.kt @@ -108,7 +108,10 @@ class Baimangu : ConfigurableSource, ParsedHttpSource() { // Search override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { return if (query.isNotBlank()) { - GET("$baseUrl/vodsearch/$query----------$page---", headers) + // GET("$baseUrl/vodsearch/$query----------$page---", headers) + // https://www.darpou.com/cccsearch/-------.html?wd=%E8%BD%AC%E7%94%9F%E8%B4%B5%E6%97%8F + // https://www.darpou.com/cccsearch/------.html?wd=%E8%BD%AC%E7%94%9F%E8%B4%B5%E6%97%8F + GET("$baseUrl/cccsearch/-------.html?wd=$query", headers) } else { var channelValue = "4" // 漫画大全 var sortValue = "time" // 按时间 @@ -128,7 +131,8 @@ class Baimangu : ConfigurableSource, ParsedHttpSource() { // https://www.darpou.com/vodshow/2-----------.html // https://www.darpou.com/vodshow/2--hits------3---.html - val url = "$baseUrl/vodshow/$channelValue--$sortValue------$page---" + // val url = "$baseUrl/vodshow/$channelValue--$sortValue------$page---" + val url = "$baseUrl/vodshow/$channelValue--$sortValue" GET(url, headers) } diff --git a/src/zh/baozimhorg/build.gradle b/src/zh/baozimhorg/build.gradle index be7b4f64..f7e321ea 100644 --- a/src/zh/baozimhorg/build.gradle +++ b/src/zh/baozimhorg/build.gradle @@ -5,7 +5,7 @@ ext { extName = 'Baozimh.org' pkgNameSuffix = 'zh.baozimhorg' extClass = '.BaozimhOrg' - extVersionCode = 28 + extVersionCode = 29 } apply from: "$rootDir/common.gradle" diff --git a/src/zh/baozimhorg/src/eu/kanade/tachiyomi/extension/zh/baozimhorg/BaozimhOrg.kt b/src/zh/baozimhorg/src/eu/kanade/tachiyomi/extension/zh/baozimhorg/BaozimhOrg.kt index 11d42ec2..a7235cc4 100644 --- a/src/zh/baozimhorg/src/eu/kanade/tachiyomi/extension/zh/baozimhorg/BaozimhOrg.kt +++ b/src/zh/baozimhorg/src/eu/kanade/tachiyomi/extension/zh/baozimhorg/BaozimhOrg.kt @@ -1,6 +1,7 @@ package eu.kanade.tachiyomi.extension.zh.baozimhorg import android.app.Application +import android.util.Log import androidx.preference.ListPreference import androidx.preference.PreferenceScreen import eu.kanade.tachiyomi.network.GET @@ -17,24 +18,28 @@ import okhttp3.HttpUrl import okhttp3.HttpUrl.Companion.toHttpUrl import okhttp3.Request import okhttp3.Response +import org.jsoup.Jsoup import org.jsoup.nodes.Document import org.jsoup.nodes.Element import org.jsoup.select.Evaluator import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get import java.text.SimpleDateFormat +import java.util.Calendar +import java.util.Date import java.util.Locale // Uses WPManga + GeneratePress/Blocksy Child class BaozimhOrg : HttpSource(), ConfigurableSource { - override val name get() = "包子漫画导航" + override val name get() = "包子漫画导航 by 芋头" override val lang get() = "zh" override val supportsLatest get() = true override val baseUrl: String private val baseHttpUrl: HttpUrl private val enableGenres: Boolean + private val TAG = "包子" init { val mirrors = MIRRORS @@ -50,24 +55,28 @@ class BaozimhOrg : HttpSource(), ConfigurableSource { .build() private fun getKey(link: String): String { - val pathSegments = baseHttpUrl.resolve(link)!!.pathSegments - val fromIndex = if (pathSegments[0] == "manga") 1 else 0 - val toIndex = if (pathSegments.last().isEmpty()) pathSegments.size - 1 else pathSegments.size - val list = pathSegments.subList(fromIndex, toIndex).toMutableList() - list[0] = list[0].split("-").take(2).joinToString("-") - return list.joinToString("/") + /* val pathSegments = baseHttpUrl.resolve(link)!!.pathSegments + val fromIndex = if (pathSegments[0] == "manga") 1 else 0 + val toIndex = + if (pathSegments.last().isEmpty()) pathSegments.size - 1 else pathSegments.size + val list = pathSegments.subList(fromIndex, toIndex).toMutableList() + list[0] = list[0].split("-").take(2).joinToString("-") + return list.joinToString("/")*/ + return link.split("manga/")[1] } override fun popularMangaRequest(page: Int) = GET("$baseUrl/hots/page/$page/", headers) override fun popularMangaParse(response: Response): MangasPage { val document = response.asJsoup().also(::parseGenres) - val mangas = document.select("article.wp-manga").map { element -> + Log.i(TAG, "popularMangaParse: 3") + val mangas = document.select(".cardlist a").map { element -> SManga.create().apply { - val link = element.selectFirst(Evaluator.Tag("h2"))!!.child(0) - url = getKey(link.attr("href")) - title = link.ownText() - thumbnail_url = element.selectFirst(Evaluator.Tag("img"))!!.imgSrc + // val link = element.selectFirst(Evaluator.Tag("h3"))!!.child(0) + url = element.attr("href").split("/manga/")[1] + Log.i("包子", "热门链接:$url ") + title = element.select("h3").text() + thumbnail_url = element.select("img").attr("src") } } val hasNextPage = document.selectFirst(Evaluator.Class("next"))?.tagName() == "a" || @@ -81,12 +90,18 @@ class BaozimhOrg : HttpSource(), ConfigurableSource { override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { if (query.isNotEmpty()) { - val url = "$baseUrl/page/$page/".toHttpUrl().newBuilder() - .addQueryParameter("s", query) + val url = "$baseUrl/s/$query".toHttpUrl().newBuilder() + .addQueryParameter("page", page.toString()) + Log.i("包子", "搜索链接:$url ") return Request.Builder().url(url.build()).headers(headers).build() } for (filter in filters) { - if (filter is UriPartFilter) return GET(baseUrl + filter.toUriPart() + "page/$page/", headers) + if (filter is UriPartFilter) { + return GET( + baseUrl + filter.toUriPart() + "page/$page/", + headers, + ) + } } return popularMangaRequest(page) } @@ -101,36 +116,52 @@ class BaozimhOrg : HttpSource(), ConfigurableSource { override fun mangaDetailsParse(response: Response) = SManga.create().apply { val document = response.asJsoup() - title = document.selectFirst(Evaluator.Tag("h1"))!!.ownText() - author = document.selectFirst(Evaluator.Class("author-content"))!!.children().joinToString { it.ownText() } - description = document.selectFirst(".descrip_manga_info, .wp-block-stackable-text")!!.text() - thumbnail_url = document.selectFirst("img.wp-post-image")!!.imgSrc + Log.i(TAG, "mangaDetailsParse: " + response.request.url) + title = document.select("#info").select("h1")[0].childNode(0).toString() + author = document.select(".text-small").select(".py-1") + .select(".pb-2")[0].select("span")[1].text() + description = document.select("#info").select("p")[0].childNode(0).toString() + thumbnail_url = document.select("#MangaCard").select("img").attr("src") - val genreList = document.selectFirst(Evaluator.Class("genres-content"))!! - .children().eachText().toMutableSet() - if ("连载中" in genreList) { - genreList.remove("连载中") + val _status = document.select("#info").select("h1")[0].childNode(1).childNode(0).toString() + Log.i(TAG, "mangaDetailsParse: $_status") + if ("連載中" in _status) { status = SManga.ONGOING - } else if ("已完结" in genreList) { - genreList.remove("已完结") + } else { status = SManga.COMPLETED } - genre = genreList.joinToString() } override fun chapterListRequest(manga: SManga): Request { val url = manga.url + Log.i( + TAG, + "${manga.title} | ${manga.author} | ${manga.genre} | ${manga.description} | ${manga.artist} | ${manga.update_strategy}", + ) if (url[0] == '/') throw Exception(MIGRATE) return GET("$baseUrl/chapterlist/$url/", headers) } override fun chapterListParse(response: Response): List { - val document = response.asJsoup() - return document.selectFirst(Evaluator.Class("version-chaps"))!!.children().map { + var document = response.asJsoup() + val allchapters = document.getElementById("allchapters") + val host = allchapters?.attr("data-host") + val mid = allchapters?.attr("data-mid") + + document = Jsoup.connect("$host/manga/get?mid=$mid&mode=all").get() + Log.i(TAG, "章节html ${document.text()}") + Log.i(TAG, "chapterListParse: $host | $mid | ${document.select("a").size}") + return document.select("a").map { SChapter.create().apply { url = getKey(it.attr("href")) - name = it.ownText() - date_upload = parseChapterDate(it.child(0).text()) + name = it.attr("data-ct") + date_upload = parseChapterDate(it.select("span")[1].text()) + Log.i( + TAG, + "chapterListParse: 时间 $date_upload | ${ + it.selectFirst("a")!!.select("span")[1].text() + } | key url = $url | srcUrl = ${it.attr("href")}", + ) } } } @@ -142,10 +173,16 @@ class BaozimhOrg : HttpSource(), ConfigurableSource { } override fun pageListParse(response: Response): List { - val document = response.asJsoup() + var document = response.asJsoup() // Jsoup won't ignore duplicates inside