diff --git a/app/src/main/kotlin/com/muedsa/jcytv/ui/features/home/main/MainScreen.kt b/app/src/main/kotlin/com/muedsa/jcytv/ui/features/home/main/MainScreen.kt index 8c55bf3..7374323 100644 --- a/app/src/main/kotlin/com/muedsa/jcytv/ui/features/home/main/MainScreen.kt +++ b/app/src/main/kotlin/com/muedsa/jcytv/ui/features/home/main/MainScreen.kt @@ -1,15 +1,10 @@ package com.muedsa.jcytv.ui.features.home.main -import androidx.compose.foundation.background -import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.PaddingValues -import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height -import androidx.compose.foundation.layout.offset import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width import androidx.compose.foundation.layout.wrapContentHeight @@ -23,11 +18,9 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.graphicsLayer import androidx.compose.ui.platform.LocalConfiguration import androidx.compose.ui.platform.testTag -import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.tv.material3.MaterialTheme diff --git a/app/src/main/kotlin/com/muedsa/jcytv/util/JcyHtmlTool.kt b/app/src/main/kotlin/com/muedsa/jcytv/util/JcyHtmlTool.kt index bf87a37..aef818b 100644 --- a/app/src/main/kotlin/com/muedsa/jcytv/util/JcyHtmlTool.kt +++ b/app/src/main/kotlin/com/muedsa/jcytv/util/JcyHtmlTool.kt @@ -17,15 +17,17 @@ import java.nio.charset.StandardCharsets object JcyHtmlTool { - const val MAIN_SITE_URL = "https://9ciyuan.com/" + const val CHROME_USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36" - const val SEARCH_URL = "https://9ciyuan.com/index.php/vod/search.html?wd=" + const val MAIN_SITE_URL = "https://www.9ciyuan.com/" - const val RANK_URL = "https://9ciyuan.com/index.php/label/ranking.html" + const val SEARCH_URL = "https://www.9ciyuan.com/index.php/vod/search.html?wd=" - const val CATALOG_URL = "https://9ciyuan.com/index.php/vod/show{query}.html" + const val RANK_URL = "https://www.9ciyuan.com/index.php/label/ranking.html" - const val DETAIL_URL = "https://9ciyuan.com/index.php/vod/detail/id/{id}.html" + const val CATALOG_URL = "https://www.9ciyuan.com/index.php/vod/show{query}.html" + + const val DETAIL_URL = "https://www.9ciyuan.com/index.php/vod/detail/id/{id}.html" val DECRYPT_DEFAULT: (String) -> String = { key: String -> key } @@ -39,6 +41,7 @@ object JcyHtmlTool { val doc: Document = Jsoup.connect("https://play.silisili.top/player/ec.php?code=ttnb&if=1&url=$key") .header(HttpHeaders.REFERER, MAIN_SITE_URL) + .header(HttpHeaders.USER_AGENT, CHROME_USER_AGENT) .get() val bodyHtml = doc.body().html() val urlMatchResult = SILISILI_ENCRYPTED_URL_REGEX.find(bodyHtml) @@ -54,6 +57,7 @@ object JcyHtmlTool { val DECRYPT_DILIDILI: (String) -> String = { key: String -> val doc: Document = Jsoup.connect("https://play.dilidili.ink/player/analysis.php?v=$key") .header(HttpHeaders.REFERER, MAIN_SITE_URL) + .header(HttpHeaders.USER_AGENT, CHROME_USER_AGENT) .get() val bodyHtml = doc.body().html() val urlMatchResult = DILIDILI_ENCRYPTED_URL_REGEX.find(bodyHtml) @@ -104,6 +108,7 @@ object JcyHtmlTool { fun getHomeVideoRows(): List>> { val doc: Document = Jsoup.connect(MAIN_SITE_URL) .header(HttpHeaders.REFERER, MAIN_SITE_URL) + .header(HttpHeaders.USER_AGENT, CHROME_USER_AGENT) .get() val body = doc.body() val rows = mutableListOf>>() @@ -166,6 +171,7 @@ object JcyHtmlTool { fun searchVideo(query: String): List { val doc: Document = Jsoup.connect("$SEARCH_URL${query}") .header(HttpHeaders.REFERER, MAIN_SITE_URL) + .header(HttpHeaders.USER_AGENT, CHROME_USER_AGENT) .get() val body = doc.body() return getRowInfo(body.selectFirst(".vod-list")!!).second @@ -174,6 +180,7 @@ object JcyHtmlTool { fun rankList(): List>> { val doc: Document = Jsoup.connect(RANK_URL) .header(HttpHeaders.REFERER, MAIN_SITE_URL) + .header(HttpHeaders.USER_AGENT, CHROME_USER_AGENT) .get() val body = doc.body() return body.select(".index-ranking").map { @@ -200,6 +207,7 @@ object JcyHtmlTool { }.joinToString("") val doc: Document = Jsoup.connect(CATALOG_URL.replace("{query}", query)) .header(HttpHeaders.REFERER, MAIN_SITE_URL) + .header(HttpHeaders.USER_AGENT, CHROME_USER_AGENT) .get() val body = doc.body() return getRowInfo(body.selectFirst(".vod-list")!!).second @@ -212,6 +220,7 @@ object JcyHtmlTool { fun getVideoDetailByUrl(url: String): JcyVideoDetail { val doc: Document = Jsoup.connect(url) .header(HttpHeaders.REFERER, MAIN_SITE_URL) + .header(HttpHeaders.USER_AGENT, CHROME_USER_AGENT) .get() val body = doc.body() val aEl = body.selectFirst(".vod-info .info h3 a")!! @@ -246,6 +255,7 @@ object JcyHtmlTool { fun getRawPlaySource(url: String): JcyRawPlaySource { val doc: Document = Jsoup.connect(url) .header(HttpHeaders.REFERER, MAIN_SITE_URL) + .header(HttpHeaders.USER_AGENT, CHROME_USER_AGENT) .get() val bodyHtml = doc.body().html()