changed the header

This commit is contained in:
LagradOst 2021-08-29 21:46:25 +02:00
parent f3a7868784
commit 613c26ec63
2 changed files with 13 additions and 10 deletions

View file

@ -1656,12 +1656,13 @@ class PlayerFragment : Fragment() {
setUserAgent(USER_AGENT) setUserAgent(USER_AGENT)
if (currentUrl != null) { if (currentUrl != null) {
val headers = mapOf( 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" to "\"Chromium\";v=\"91\", \" Not;A Brand\";v=\"99\"",
"sec-ch-ua-mobile" to "?0", "sec-ch-ua-mobile" to "?0",
"Sec-Fetch-User" to "?1", "sec-fetch-user" to "?1",
"Sec-Fetch-Mode" to "navigate", "sec-fetch-mode" to "navigate",
"Sec-Fetch-Dest" to "document" "sec-fetch-dest" to "video"
) )
setDefaultRequestProperties(headers) setDefaultRequestProperties(headers)
} }

View file

@ -596,19 +596,21 @@ object VideoDownloadManager {
// SET CONNECTION SETTINGS // SET CONNECTION SETTINGS
connection.connectTimeout = 10000 connection.connectTimeout = 10000
connection.setRequestProperty("Accept-Encoding", "identity") connection.setRequestProperty("Accept-Encoding", "identity")
connection.setRequestProperty("User-Agent", USER_AGENT) connection.setRequestProperty("user-agent", USER_AGENT)
if (link.referer.isNotEmpty()) connection.setRequestProperty("Referer", link.referer) if (link.referer.isNotEmpty()) connection.setRequestProperty("referer", link.referer)
// extra stuff // extra stuff
connection.setRequestProperty( connection.setRequestProperty(
"sec-ch-ua", "sec-ch-ua",
"\"Chromium\";v=\"91\", \" Not;A Brand\";v=\"99\"" "\"Chromium\";v=\"91\", \" Not;A Brand\";v=\"99\""
) )
connection.setRequestProperty("sec-ch-ua-mobile", "?0") connection.setRequestProperty("sec-ch-ua-mobile", "?0")
connection.setRequestProperty("accept", "*/*")
// dataSource.setRequestProperty("Sec-Fetch-Site", "none") //same-site // dataSource.setRequestProperty("Sec-Fetch-Site", "none") //same-site
connection.setRequestProperty("Sec-Fetch-User", "?1") connection.setRequestProperty("sec-fetch-user", "?1")
connection.setRequestProperty("Sec-Fetch-Mode", "navigate") connection.setRequestProperty("sec-fetch-mode", "navigate")
connection.setRequestProperty("Sec-Fetch-Dest", "document") connection.setRequestProperty("sec-fetch-dest", "video")
if (resume) if (resume)
connection.setRequestProperty("Range", "bytes=${fileLength}-") connection.setRequestProperty("Range", "bytes=${fileLength}-")
@ -948,7 +950,7 @@ object VideoDownloadManager {
ep: DownloadEpisodeMetadata, ep: DownloadEpisodeMetadata,
links: List<ExtractorLink> links: List<ExtractorLink>
) { ) {
if(context == null) return if (context == null) return
val validLinks = links.filter { !it.isM3u8 } val validLinks = links.filter { !it.isM3u8 }
if (validLinks.isNotEmpty()) { if (validLinks.isNotEmpty()) {
downloadFromResume(context, DownloadResumePackage(DownloadItem(source, folder, ep, validLinks), null)) downloadFromResume(context, DownloadResumePackage(DownloadItem(source, folder, ep, validLinks), null))