Fix DramaSeeProvider search

This commit is contained in:
Blatzar 2022-07-11 22:42:48 +02:00
parent 0ea243ebb6
commit d8c5e61d9d
2 changed files with 14 additions and 13 deletions

View file

@ -49,20 +49,17 @@ class DramaSeeProvider : MainAPI() {
override suspend fun search(query: String): List<SearchResponse> { override suspend fun search(query: String): List<SearchResponse> {
val url = "$mainUrl/search?q=$query" val url = "$mainUrl/search?q=$query"
val html = app.get(url).document val document = app.get(url).document
val document = html.getElementsByTag("body") val posters = document.select ("div.film-poster")
.select("section > main > ul.series > li") ?: return listOf()
return document.mapNotNull {
if (it == null) { return posters.mapNotNull {
return@mapNotNull null val innerA = it.select("a") ?: return@mapNotNull null
}
val innerA = it.select("a.series-img") ?: return@mapNotNull null
val link = fixUrlNull(innerA.attr("href")) ?: return@mapNotNull null val link = fixUrlNull(innerA.attr("href")) ?: return@mapNotNull null
val title = it.select("a.series-name")?.text() ?: return@mapNotNull null val title = innerA.attr("title") ?: return@mapNotNull null
val year = null val year = Regex(""".*\((\d{4})\)""").find(title)?.groupValues?.getOrNull(1)?.toIntOrNull()
val imgsrc = innerA.select("img")?.attr("src") ?: return@mapNotNull null val imgSrc = it.select("img")?.attr("data-src") ?: return@mapNotNull null
val image = fixUrlNull(imgsrc) val image = fixUrlNull(imgSrc)
MovieSearchResponse( MovieSearchResponse(
name = title, name = title,

View file

@ -63,7 +63,11 @@ open class ExtractorLink(
override val headers: Map<String, String> = mapOf(), override val headers: Map<String, String> = mapOf(),
/** Used for getExtractorVerifierJob() */ /** Used for getExtractorVerifierJob() */
open val extractorData: String? = null, open val extractorData: String? = null,
) : VideoDownloadManager.IDownloadableMinimum ) : VideoDownloadManager.IDownloadableMinimum {
override fun toString(): String {
return "ExtractorLink(name=$name, url=$url, referer=$referer, isM3u8=$isM3u8)"
}
}
data class ExtractorUri( data class ExtractorUri(
val uri: Uri, val uri: Uri,