From d8c5e61d9d4b54566d68b070ebd28acb6735a397 Mon Sep 17 00:00:00 2001 From: Blatzar <46196380+Blatzar@users.noreply.github.com> Date: Mon, 11 Jul 2022 22:42:48 +0200 Subject: [PATCH] Fix DramaSeeProvider search --- .../movieproviders/DramaSeeProvider.kt | 21 ++++++++----------- .../cloudstream3/utils/ExtractorApi.kt | 6 +++++- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/com/lagradost/cloudstream3/movieproviders/DramaSeeProvider.kt b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/DramaSeeProvider.kt index ddd1e362..2e0565bf 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/movieproviders/DramaSeeProvider.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/DramaSeeProvider.kt @@ -49,20 +49,17 @@ class DramaSeeProvider : MainAPI() { override suspend fun search(query: String): List { val url = "$mainUrl/search?q=$query" - val html = app.get(url).document - val document = html.getElementsByTag("body") - .select("section > main > ul.series > li") ?: return listOf() + val document = app.get(url).document + val posters = document.select ("div.film-poster") - return document.mapNotNull { - if (it == null) { - return@mapNotNull null - } - val innerA = it.select("a.series-img") ?: return@mapNotNull null + + return posters.mapNotNull { + val innerA = it.select("a") ?: return@mapNotNull null val link = fixUrlNull(innerA.attr("href")) ?: return@mapNotNull null - val title = it.select("a.series-name")?.text() ?: return@mapNotNull null - val year = null - val imgsrc = innerA.select("img")?.attr("src") ?: return@mapNotNull null - val image = fixUrlNull(imgsrc) + val title = innerA.attr("title") ?: return@mapNotNull null + val year = Regex(""".*\((\d{4})\)""").find(title)?.groupValues?.getOrNull(1)?.toIntOrNull() + val imgSrc = it.select("img")?.attr("data-src") ?: return@mapNotNull null + val image = fixUrlNull(imgSrc) MovieSearchResponse( name = title, diff --git a/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt b/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt index a5a605a5..58f5d411 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt @@ -63,7 +63,11 @@ open class ExtractorLink( override val headers: Map = mapOf(), /** Used for getExtractorVerifierJob() */ 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( val uri: Uri,