From ef62242f42c5cf9e67367afb5f8549a50858b01e Mon Sep 17 00:00:00 2001 From: Niko Storni Date: Fri, 3 Jan 2020 15:59:05 +0100 Subject: [PATCH] add cookies to youtube-dl minor fixes --- e2e/e2e.sh | 2 +- ip_manager/throttle.go | 3 +++ manager/manager.go | 1 - sources/youtubeVideo.go | 4 ++++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/e2e/e2e.sh b/e2e/e2e.sh index bc0c46d..e7fe7d3 100755 --- a/e2e/e2e.sh +++ b/e2e/e2e.sh @@ -66,7 +66,7 @@ videoClaimAddress2=$(mysql -u lbry -plbry -ss -D chainquery -h "127.0.0.1" -P 15 ./supporty/supporty @BeamerTest "${videoClaimID1}" "${videoClaimAddress1}" lbrycrd_regtest 3.0 ./supporty/supporty @BeamerTest "${videoClaimID2}" "${videoClaimAddress2}" lbrycrd_regtest 3.0 curl --data-binary '{"jsonrpc":"1.0","id":"curltext","method":"generate","params":[1]}' -H 'content-type:text/plain;' --user lbry:lbry http://localhost:15200 -# Reset status for tranfer test +# Reset status for transfer test mysql -u lbry -plbry -ss -D lbry -h "127.0.0.1" -P 15500 -e "UPDATE youtube_data SET status = 'queued' WHERE id = 1" # Trigger transfer api curl -i -H 'Accept: application/json' -H 'Content-Type: application/json' 'http://localhost:15400/yt/transfer?auth_token=youtubertoken&address=n4eYeXAYmHo4YRUDEfsEhucy8y5LKRMcHg&public_key=tpubDA9GDAntyJu4hD3wU7175p7CuV6DWbYXfyb2HedBA3yuBp9HZ4n3QE4Ex6RHCSiEuVp2nKAL1Lzf2ZLo9ApaFgNaJjG6Xo1wB3iEeVbrDZp' diff --git a/ip_manager/throttle.go b/ip_manager/throttle.go index ee4ddda..17c3da9 100644 --- a/ip_manager/throttle.go +++ b/ip_manager/throttle.go @@ -125,6 +125,9 @@ func (i *IPPool) ReleaseAll() { i.lock.Lock() defer i.lock.Unlock() for j, _ := range i.ips { + if i.ips[j].Throttled { + continue + } localIP := &i.ips[j] localIP.InUse = false localIP.LastUse = time.Now() diff --git a/manager/manager.go b/manager/manager.go index 3387371..bdb7230 100644 --- a/manager/manager.go +++ b/manager/manager.go @@ -149,7 +149,6 @@ func (s *SyncManager) Start() error { shouldInterruptLoop = true } else { var queuesToSync []string - //TODO: implement scrambling to avoid starvation of queues if s.syncStatus != "" { queuesToSync = append(queuesToSync, s.syncStatus) } else if s.SyncFlags.SyncUpdate { diff --git a/sources/youtubeVideo.go b/sources/youtubeVideo.go index 702604f..9992e92 100644 --- a/sources/youtubeVideo.go +++ b/sources/youtubeVideo.go @@ -209,6 +209,10 @@ func (v *YoutubeVideo) download() error { "--abort-on-unavailable-fragment", "--fragment-retries", "0", + "--user-agent", + "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36", + "--cookies", + "cookies.txt", } if v.maxVideoSize > 0 { ytdlArgs = append(ytdlArgs,