fix(tr/animeler): Fix anime pages + fix extractor (#2943)
This commit is contained in:
parent
2b3537e96f
commit
0064c5658d
@ -1,7 +1,7 @@
|
|||||||
ext {
|
ext {
|
||||||
extName = 'Animeler'
|
extName = 'Animeler'
|
||||||
extClass = '.Animeler'
|
extClass = '.Animeler'
|
||||||
extVersionCode = 9
|
extVersionCode = 10
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$rootDir/common.gradle"
|
apply from: "$rootDir/common.gradle"
|
||||||
@ -17,4 +17,4 @@ dependencies {
|
|||||||
implementation(project(":lib:uqload-extractor"))
|
implementation(project(":lib:uqload-extractor"))
|
||||||
implementation(project(":lib:voe-extractor"))
|
implementation(project(":lib:voe-extractor"))
|
||||||
implementation(project(":lib:vudeo-extractor"))
|
implementation(project(":lib:vudeo-extractor"))
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,7 @@ import okhttp3.MediaType.Companion.toMediaType
|
|||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.RequestBody.Companion.toRequestBody
|
import okhttp3.RequestBody.Companion.toRequestBody
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
|
import org.jsoup.Jsoup
|
||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
import uy.kohesive.injekt.api.get
|
import uy.kohesive.injekt.api.get
|
||||||
import uy.kohesive.injekt.injectLazy
|
import uy.kohesive.injekt.injectLazy
|
||||||
@ -71,13 +72,17 @@ class Animeler : AnimeHttpSource(), ConfigurableAnimeSource {
|
|||||||
|
|
||||||
override fun popularAnimeParse(response: Response): AnimesPage {
|
override fun popularAnimeParse(response: Response): AnimesPage {
|
||||||
val results = response.parseAs<SearchResponseDto>()
|
val results = response.parseAs<SearchResponseDto>()
|
||||||
val animes = results.data.map {
|
val doc = Jsoup.parseBodyFragment(results.data)
|
||||||
|
val animes = doc.select("div.w-full:has(div.kira-anime)").map {
|
||||||
SAnime.create().apply {
|
SAnime.create().apply {
|
||||||
setUrlWithoutDomain(it.url)
|
thumbnail_url = it.selectFirst("img")?.attr("src")
|
||||||
thumbnail_url = it.thumbnail
|
with(it.selectFirst("h3 > a")!!) {
|
||||||
title = it.title
|
title = text()
|
||||||
|
setUrlWithoutDomain(attr("href"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val page = response.request.url.queryParameter("page")?.toIntOrNull() ?: 1
|
val page = response.request.url.queryParameter("page")?.toIntOrNull() ?: 1
|
||||||
val hasNextPage = page < results.pages
|
val hasNextPage = page < results.pages
|
||||||
return AnimesPage(animes, hasNextPage)
|
return AnimesPage(animes, hasNextPage)
|
||||||
@ -225,7 +230,7 @@ class Animeler : AnimeHttpSource(), ConfigurableAnimeSource {
|
|||||||
override fun videoListParse(response: Response): List<Video> {
|
override fun videoListParse(response: Response): List<Video> {
|
||||||
val doc = response.asJsoup()
|
val doc = response.asJsoup()
|
||||||
val iframeUrl = doc.selectFirst("div.episode-player-box > iframe")
|
val iframeUrl = doc.selectFirst("div.episode-player-box > iframe")
|
||||||
?.attr("src")
|
?.run { attr("data-src").ifBlank { attr("src") } }
|
||||||
?: doc.selectFirst("script:containsData(embedUrl)")
|
?: doc.selectFirst("script:containsData(embedUrl)")
|
||||||
?.data()
|
?.data()
|
||||||
?.substringAfter("\"embedUrl\": \"")
|
?.substringAfter("\"embedUrl\": \"")
|
||||||
|
@ -5,10 +5,7 @@ import kotlinx.serialization.Serializable
|
|||||||
import kotlinx.serialization.json.JsonPrimitive
|
import kotlinx.serialization.json.JsonPrimitive
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class SearchResponseDto(
|
data class SearchResponseDto(val data: String, val pages: Int)
|
||||||
val data: List<SimpleAnimeDto>,
|
|
||||||
val pages: Int,
|
|
||||||
)
|
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class PostDto(
|
data class PostDto(
|
||||||
@ -21,17 +18,6 @@ data class ThumbnailDto(private val featured_url: JsonPrimitive) {
|
|||||||
val url = if (featured_url.isString) featured_url.content else null
|
val url = if (featured_url.isString) featured_url.content else null
|
||||||
}
|
}
|
||||||
|
|
||||||
@Serializable
|
|
||||||
data class SimpleAnimeDto(
|
|
||||||
val url: String,
|
|
||||||
val post: PostDto,
|
|
||||||
private val image: String = "",
|
|
||||||
private val images: ThumbnailDto? = null,
|
|
||||||
) {
|
|
||||||
val thumbnail = image.ifEmpty { images?.url }
|
|
||||||
val title = post.post_title
|
|
||||||
}
|
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class TaxonomyDto(val taxonomy: String = "", val terms: List<Int> = emptyList())
|
data class TaxonomyDto(val taxonomy: String = "", val terms: List<Int> = emptyList())
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user