From 613c26ec6325d3f2d97e937cfc6ba95bc2c7749e Mon Sep 17 00:00:00 2001 From: LagradOst Date: Sun, 29 Aug 2021 21:46:25 +0200 Subject: [PATCH] changed the header --- .../cloudstream3/ui/player/PlayerFragment.kt | 9 +++++---- .../cloudstream3/utils/VideoDownloadManager.kt | 14 ++++++++------ 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/player/PlayerFragment.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/player/PlayerFragment.kt index 3979936e..c5414a61 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/player/PlayerFragment.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/player/PlayerFragment.kt @@ -1656,12 +1656,13 @@ class PlayerFragment : Fragment() { setUserAgent(USER_AGENT) if (currentUrl != null) { val headers = mapOf( - "Referer" to currentUrl.referer, + "referer" to currentUrl.referer, + "accept" to "*/*", "sec-ch-ua" to "\"Chromium\";v=\"91\", \" Not;A Brand\";v=\"99\"", "sec-ch-ua-mobile" to "?0", - "Sec-Fetch-User" to "?1", - "Sec-Fetch-Mode" to "navigate", - "Sec-Fetch-Dest" to "document" + "sec-fetch-user" to "?1", + "sec-fetch-mode" to "navigate", + "sec-fetch-dest" to "video" ) setDefaultRequestProperties(headers) } diff --git a/app/src/main/java/com/lagradost/cloudstream3/utils/VideoDownloadManager.kt b/app/src/main/java/com/lagradost/cloudstream3/utils/VideoDownloadManager.kt index 1566ddc5..275e256b 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/utils/VideoDownloadManager.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/utils/VideoDownloadManager.kt @@ -596,19 +596,21 @@ object VideoDownloadManager { // SET CONNECTION SETTINGS connection.connectTimeout = 10000 connection.setRequestProperty("Accept-Encoding", "identity") - connection.setRequestProperty("User-Agent", USER_AGENT) - if (link.referer.isNotEmpty()) connection.setRequestProperty("Referer", link.referer) + connection.setRequestProperty("user-agent", USER_AGENT) + if (link.referer.isNotEmpty()) connection.setRequestProperty("referer", link.referer) // extra stuff connection.setRequestProperty( "sec-ch-ua", "\"Chromium\";v=\"91\", \" Not;A Brand\";v=\"99\"" ) + connection.setRequestProperty("sec-ch-ua-mobile", "?0") + connection.setRequestProperty("accept", "*/*") // dataSource.setRequestProperty("Sec-Fetch-Site", "none") //same-site - connection.setRequestProperty("Sec-Fetch-User", "?1") - connection.setRequestProperty("Sec-Fetch-Mode", "navigate") - connection.setRequestProperty("Sec-Fetch-Dest", "document") + connection.setRequestProperty("sec-fetch-user", "?1") + connection.setRequestProperty("sec-fetch-mode", "navigate") + connection.setRequestProperty("sec-fetch-dest", "video") if (resume) connection.setRequestProperty("Range", "bytes=${fileLength}-") @@ -948,7 +950,7 @@ object VideoDownloadManager { ep: DownloadEpisodeMetadata, links: List ) { - if(context == null) return + if (context == null) return val validLinks = links.filter { !it.isM3u8 } if (validLinks.isNotEmpty()) { downloadFromResume(context, DownloadResumePackage(DownloadItem(source, folder, ep, validLinks), null))