feat(all/missav): Include more info in anime details page (#2253)
This commit is contained in:
@ -7,7 +7,7 @@ ext {
|
|||||||
extName = 'MissAV'
|
extName = 'MissAV'
|
||||||
pkgNameSuffix = 'all.missav'
|
pkgNameSuffix = 'all.missav'
|
||||||
extClass = '.MissAV'
|
extClass = '.MissAV'
|
||||||
extVersionCode = 1
|
extVersionCode = 2
|
||||||
containsNsfw = true
|
containsNsfw = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ import eu.kanade.tachiyomi.util.asJsoup
|
|||||||
import okhttp3.HttpUrl.Companion.toHttpUrl
|
import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
|
import org.jsoup.nodes.Element
|
||||||
import rx.Observable
|
import rx.Observable
|
||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
import uy.kohesive.injekt.api.get
|
import uy.kohesive.injekt.api.get
|
||||||
@ -48,11 +49,11 @@ class MissAV : AnimeHttpSource(), ConfigurableAnimeSource {
|
|||||||
GET("$baseUrl/en/today-hot?page=$page", headers)
|
GET("$baseUrl/en/today-hot?page=$page", headers)
|
||||||
|
|
||||||
override fun popularAnimeParse(response: Response): AnimesPage {
|
override fun popularAnimeParse(response: Response): AnimesPage {
|
||||||
val document = response.asJsoup()
|
val document = response.use { it.asJsoup() }
|
||||||
|
|
||||||
val entries = document.select("div.thumbnail").map { element ->
|
val entries = document.select("div.thumbnail").map { element ->
|
||||||
SAnime.create().apply {
|
SAnime.create().apply {
|
||||||
element.select("a.text-secondary").let {
|
element.select("a.text-secondary").also {
|
||||||
setUrlWithoutDomain(it.attr("href"))
|
setUrlWithoutDomain(it.attr("href"))
|
||||||
title = it.text()
|
title = it.text()
|
||||||
}
|
}
|
||||||
@ -95,19 +96,38 @@ class MissAV : AnimeHttpSource(), ConfigurableAnimeSource {
|
|||||||
override fun searchAnimeParse(response: Response) = popularAnimeParse(response)
|
override fun searchAnimeParse(response: Response) = popularAnimeParse(response)
|
||||||
|
|
||||||
override fun animeDetailsParse(response: Response): SAnime {
|
override fun animeDetailsParse(response: Response): SAnime {
|
||||||
val document = response.asJsoup()
|
val document = response.use { it.asJsoup() }
|
||||||
|
|
||||||
return SAnime.create().apply {
|
return SAnime.create().apply {
|
||||||
title = document.select("h1.text-base").text()
|
title = document.selectFirst("h1.text-base")!!.text()
|
||||||
genre = document.select("div.text-secondary > a[href*=/genres/]").joinToString { it.text() }
|
genre = document.getInfo("/genres/")
|
||||||
description = document.select("div.mb-1").text()
|
author = listOfNotNull(
|
||||||
author = document.select("div.text-secondary > a[href*=/makers/]").joinToString { it.text() }
|
document.getInfo("/directors/"),
|
||||||
artist = document.select("div.text-secondary > a[href*=/actresses/]").joinToString { it.text() }
|
document.getInfo("/makers/"),
|
||||||
|
).joinToString()
|
||||||
|
artist = document.getInfo("/actresses/")
|
||||||
status = SAnime.COMPLETED
|
status = SAnime.COMPLETED
|
||||||
thumbnail_url = document.select("video.player").attr("abs:data-poster")
|
thumbnail_url = document.selectFirst("video.player")?.attr("abs:data-poster")
|
||||||
|
|
||||||
|
description = buildString {
|
||||||
|
document.selectFirst("div.mb-1")?.text()?.also { append("$it\n") }
|
||||||
|
|
||||||
|
document.getInfo("/labels/")?.also { append("\nLabel: $it") }
|
||||||
|
document.getInfo("/series/")?.also { append("\nSeries: $it") }
|
||||||
|
|
||||||
|
document.select("div.text-secondary:not(:has(a)):has(span)")
|
||||||
|
.eachText()
|
||||||
|
.forEach { append("\n$it") }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun Element.getInfo(urlPart: String) =
|
||||||
|
select("div.text-secondary > a[href*=$urlPart]")
|
||||||
|
.eachText()
|
||||||
|
.joinToString()
|
||||||
|
.takeIf(String::isNotBlank)
|
||||||
|
|
||||||
override fun fetchEpisodeList(anime: SAnime): Observable<List<SEpisode>> {
|
override fun fetchEpisodeList(anime: SAnime): Observable<List<SEpisode>> {
|
||||||
return Observable.just(
|
return Observable.just(
|
||||||
listOf(
|
listOf(
|
||||||
@ -120,9 +140,10 @@ class MissAV : AnimeHttpSource(), ConfigurableAnimeSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun videoListParse(response: Response): List<Video> {
|
override fun videoListParse(response: Response): List<Video> {
|
||||||
val document = response.asJsoup()
|
val document = response.use { it.asJsoup() }
|
||||||
|
|
||||||
val playlists = document.selectFirst("script:containsData(function(p,a,c,k,e,d))")?.html()
|
val playlists = document.selectFirst("script:containsData(function(p,a,c,k,e,d))")
|
||||||
|
?.data()
|
||||||
?.let(Unpacker::unpack)?.ifEmpty { null }
|
?.let(Unpacker::unpack)?.ifEmpty { null }
|
||||||
?: return emptyList()
|
?: return emptyList()
|
||||||
|
|
||||||
@ -134,7 +155,7 @@ class MissAV : AnimeHttpSource(), ConfigurableAnimeSource {
|
|||||||
override fun List<Video>.sort(): List<Video> {
|
override fun List<Video>.sort(): List<Video> {
|
||||||
val quality = preferences.getString(PREF_QUALITY, PREF_QUALITY_DEFAULT)!!
|
val quality = preferences.getString(PREF_QUALITY, PREF_QUALITY_DEFAULT)!!
|
||||||
|
|
||||||
return this.sortedWith(
|
return sortedWith(
|
||||||
compareBy { it.quality.contains(quality) },
|
compareBy { it.quality.contains(quality) },
|
||||||
).reversed()
|
).reversed()
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user