Some chinese sources update #1022

Merged
AlmightyHak merged 3 commits from AlphaBoom/extensions-source:zh-sources-update into main 2025-06-20 01:05:04 -05:00
2 changed files with 27 additions and 6 deletions
Showing only changes of commit 9e4b2204bb - Show all commits

View file

@ -1,7 +1,7 @@
ext { ext {
extName = 'Hanime1' extName = 'Hanime1'
extClass = '.Hanime1' extClass = '.Hanime1'
extVersionCode = 4 extVersionCode = 5
isNsfw = true isNsfw = true
} }

View file

@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.animeextension.zh.hanime1
import android.app.Application import android.app.Application
import android.content.SharedPreferences import android.content.SharedPreferences
import android.util.Log
import androidx.preference.ListPreference import androidx.preference.ListPreference
import androidx.preference.PreferenceScreen import androidx.preference.PreferenceScreen
import eu.kanade.tachiyomi.animesource.ConfigurableAnimeSource import eu.kanade.tachiyomi.animesource.ConfigurableAnimeSource
@ -19,9 +20,11 @@ import kotlinx.coroutines.CoroutineExceptionHandler
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import kotlinx.serialization.encodeToString import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonElement import kotlinx.serialization.json.JsonElement
import kotlinx.serialization.json.jsonArray
import kotlinx.serialization.json.jsonObject import kotlinx.serialization.json.jsonObject
import kotlinx.serialization.json.jsonPrimitive import kotlinx.serialization.json.jsonPrimitive
import okhttp3.Cookie import okhttp3.Cookie
@ -65,14 +68,32 @@ class Hanime1 : AnimeHttpSource(), ConfigurableAnimeSource {
} }
override fun animeDetailsParse(response: Response): SAnime { override fun animeDetailsParse(response: Response): SAnime {
val jsoup = response.asJsoup() val doc = response.asJsoup()
return SAnime.create().apply { return SAnime.create().apply {
genre = jsoup.select(".single-video-tag").not("[data-toggle]").eachText().joinToString() genre = doc.select(".single-video-tag").not("[data-toggle]").eachText().joinToString()
author = jsoup.select("#video-artist-name").text() author = doc.select("#video-artist-name").text()
jsoup.select("script[type=application/ld+json]").first()?.data()?.let { doc.select("script[type=application/ld+json]").first()?.data()?.let {
val info = json.decodeFromString<JsonElement>(it).jsonObject val info = json.decodeFromString<JsonElement>(it).jsonObject
title = info["name"]!!.jsonPrimitive.content title = info["name"]!!.jsonPrimitive.content
description = info["description"]!!.jsonPrimitive.content description = info["description"]!!.jsonPrimitive.content
thumbnail_url = info["thumbnailUrl"]?.jsonArray?.get(0)?.jsonPrimitive?.content
}
val type = doc.select("a#video-artist-name + a").text().trim()
if (type == "裏番" || type == "泡麵番") {
// Use the series cover image for bangumi entries instead of the episode image.
runBlocking {
try {
val animesPage =
getSearchAnime(
1,
title,
AnimeFilterList(GenreFilter(arrayOf("", type)).apply { state = 1 }),
)
thumbnail_url = animesPage.animes.first().thumbnail_url
} catch (e: Exception) {
Log.e(name, "Failed to get bangumi cover image")
}
}
} }
} }
} }
@ -137,7 +158,7 @@ class Hanime1 : AnimeHttpSource(), ConfigurableAnimeSource {
override fun searchAnimeParse(response: Response): AnimesPage { override fun searchAnimeParse(response: Response): AnimesPage {
val jsoup = response.asJsoup() val jsoup = response.asJsoup()
val nodes = jsoup.select("div.search-doujin-videos.hidden-xs") val nodes = jsoup.select("div.search-doujin-videos.hidden-xs:not(:has(a[target=_blank]))")
val list = if (nodes.isNotEmpty()) { val list = if (nodes.isNotEmpty()) {
nodes.map { nodes.map {
SAnime.create().apply { SAnime.create().apply {