File tree Expand file tree Collapse file tree
kotlinYtmusicScraper/src/main/java/com/maxrave/kotlinytmusicscraper Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -196,13 +196,6 @@ class YouTube(
196196 var cookie: String?
197197 get() = ytMusic.cookie
198198 set(value) {
199- newPipeDownloader = NewPipeDownloaderImpl (proxy = ytMusic.proxy, cookie = cookie)
200- newPipeUtils = NewPipeUtils (newPipeDownloader)
201- poTokenGenerator =
202- NewPipePoTokenProviderImpl (
203- context = context,
204- downloader = newPipeDownloader,
205- )
206199 ytMusic.cookie = value
207200 }
208201
@@ -232,13 +225,6 @@ class YouTube(
232225 */
233226 fun removeProxy () {
234227 ytMusic.proxy = null
235- newPipeDownloader = NewPipeDownloaderImpl (proxy = null , cookie = cookie)
236- newPipeUtils = NewPipeUtils (newPipeDownloader)
237- poTokenGenerator =
238- NewPipePoTokenProviderImpl (
239- context = context,
240- downloader = newPipeDownloader,
241- )
242228 }
243229
244230 /* *
@@ -253,13 +239,6 @@ class YouTube(
253239 if (isHttp) ProxyBuilder .http(" $host :$port " ) else ProxyBuilder .socks(host, port)
254240 }.onSuccess {
255241 ytMusic.proxy = it
256- newPipeDownloader = NewPipeDownloaderImpl (proxy = it, cookie = cookie)
257- newPipeUtils = NewPipeUtils (newPipeDownloader)
258- poTokenGenerator =
259- NewPipePoTokenProviderImpl (
260- context = context,
261- downloader = newPipeDownloader,
262- )
263242 }.onFailure {
264243 it.printStackTrace()
265244 }
Original file line number Diff line number Diff line change @@ -18,7 +18,6 @@ import java.io.IOException
1818import java.net.Proxy
1919
2020class NewPipeDownloaderImpl (
21- private val cookie : String? = null ,
2221 proxy : Proxy ? ,
2322) : Downloader() {
2423 private val client =
@@ -52,16 +51,6 @@ class NewPipeDownloaderImpl(
5251 }
5352 }
5453
55- cookie?.let {
56- requestBuilder.addHeader(" Cookie" , it)
57- val cookieMap = parseCookieString(it)
58- if (" SAPISID" !in cookieMap || " __Secure-3PAPISID" !in cookieMap) return @let
59- val currentTime = System .currentTimeMillis() / 1000
60- val sapisidCookie = cookieMap[" SAPISID" ] ? : cookieMap[" __Secure-3PAPISID" ]
61- val sapisidHash = sha1(" $currentTime $sapisidCookie https://music.youtube.com" )
62- requestBuilder.addHeader(" Authorization" , " SAPISIDHASH ${currentTime} _$sapisidHash " )
63- }
64-
6554 val response = client.newCall(requestBuilder.build()).execute()
6655
6756 if (response.code == 429 ) {
You can’t perform that action at this time.
0 commit comments