Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When run as `sudo`, youtube-dl sometimes gets `HTTP Error 403: Forbidden` #24780

Closed
dasl- opened this issue Apr 14, 2020 · 1 comment
Closed

When run as `sudo`, youtube-dl sometimes gets `HTTP Error 403: Forbidden` #24780

dasl- opened this issue Apr 14, 2020 · 1 comment

Comments

@dasl-
Copy link

@dasl- dasl- commented Apr 14, 2020

Checklist

  • I'm reporting a broken site support issue
  • I've verified that I'm running youtube-dl version 2020.03.24
  • I've checked that all provided URLs are alive and playable in a browser
  • I've checked that all URLs and arguments with special characters are properly quoted or escaped
  • I've searched the bugtracker for similar bug reports including closed ones
  • I've read bugs section in FAQ

Verbose log

pi@raspberrypi:~ $ while true; do sudo youtube-dl -v --output - --restrict-filenames --format 18 --newline 'https://www.youtube.com/watch?v=IB_2jkwxqh4' > /dev/null; done
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v', '--output', '-', '--restrict-filenames', '--format', '18', '--newline', 'https://www.youtube.com/watch?v=IB_2jkwxqh4']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2020.03.24
[debug] Python version 3.7.3 (CPython) - Linux-4.19.97-v7+-armv7l-with-debian-10.3
[debug] exe versions: ffmpeg 4.1.4-1, ffprobe 4.1.4-1
[debug] Proxy map: {}
[youtube] IB_2jkwxqh4: Downloading webpage
[youtube] {18} signature length 108, html5 player vflset
[youtube] {134} signature length 112, html5 player vflset
[youtube] {243} signature length 112, html5 player vflset
[youtube] {133} signature length 112, html5 player vflset
[youtube] {242} signature length 112, html5 player vflset
[youtube] {160} signature length 112, html5 player vflset
[youtube] {278} signature length 108, html5 player vflset
[youtube] {140} signature length 112, html5 player vflset
[youtube] {249} signature length 108, html5 player vflset
[youtube] {250} signature length 112, html5 player vflset
[youtube] {251} signature length 108, html5 player vflset
[debug] Invoking downloader on 'https://r1---sn-j5caxoxu-pn2s.googlevideo.com/videoplayback?expire=1586877230&ei=zn6VXsr_AuOF2LYPupSvoAo&ip=24.46.195.206&id=o-ADz7eFnfJODkvvDgAi_BaM_Xjo7fXJItIO_8X6MDv3qC&itag=18&source=youtube&requiressl=yes&mh=-H&mm=31%2C26&mn=sn-j5caxoxu-pn2s%2Csn-p5qlsnzd&ms=au%2Conr&mv=m&mvi=0&pcm2cms=yes&pl=21&initcwndbps=1583750&vprv=1&mime=video%2Fmp4&gir=yes&clen=399894&ratebypass=yes&dur=6.083&lmt=1373205654632761&ns=LPAvAN9-OJCD8yNyAF37qw4C&mt=1586855557&fvip=1&c=WEB&n=hWryb1RXC3JVdi9-&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cgir%2Cclen%2Cratebypass%2Cdur%2Clmt%2Cns&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpcm2cms%2Cpl%2Cinitcwndbps&lsig=ALrAebAwRQIgQONjYC8zhXuzBmD-dlrr4nHhpG-1LcqNxolQYmS800MCIQC4VecWcRdMbke-glLokwZFF4_SsYaIoHwTJZyeAfLBRg%3D%3D&sig=sttsttt3o3FBEyUy5GWs2dl14EWj146RpRjhBvR3SFty8t_cEbGICQfPdoS0i9cc0d8ULnI8esmdfe-xDV2erBA6P_eoMy4FgIARwsLlP'
ERROR: unable to download video data: HTTP Error 403: Forbidden
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/youtube_dl/YoutubeDL.py", line 1926, in process_info
    success = dl(filename, info_dict)
  File "/usr/local/lib/python3.7/dist-packages/youtube_dl/YoutubeDL.py", line 1865, in dl
    return fd.download(name, info)
  File "/usr/local/lib/python3.7/dist-packages/youtube_dl/downloader/common.py", line 366, in download
    return self.real_download(filename, info_dict)
  File "/usr/local/lib/python3.7/dist-packages/youtube_dl/downloader/http.py", line 341, in real_download
    establish_connection()
  File "/usr/local/lib/python3.7/dist-packages/youtube_dl/downloader/http.py", line 109, in establish_connection
    ctx.data = self.ydl.urlopen(request)
  File "/usr/local/lib/python3.7/dist-packages/youtube_dl/YoutubeDL.py", line 2238, in urlopen
    return self._opener.open(req, timeout=self._socket_timeout)
  File "/usr/lib/python3.7/urllib/request.py", line 531, in open
    response = meth(req, response)
  File "/usr/lib/python3.7/urllib/request.py", line 641, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python3.7/urllib/request.py", line 569, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.7/urllib/request.py", line 503, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.7/urllib/request.py", line 649, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v', '--output', '-', '--restrict-filenames', '--format', '18', '--newline', 'https://www.youtube.com/watch?v=IB_2jkwxqh4']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2020.03.24
[debug] Python version 3.7.3 (CPython) - Linux-4.19.97-v7+-armv7l-with-debian-10.3
[debug] exe versions: ffmpeg 4.1.4-1, ffprobe 4.1.4-1
[debug] Proxy map: {}
[youtube] IB_2jkwxqh4: Downloading webpage
[youtube] {18} signature length 108, html5 player vflset
[youtube] {134} signature length 112, html5 player vflset
[youtube] {243} signature length 108, html5 player vflset
[youtube] {133} signature length 112, html5 player vflset
[youtube] {242} signature length 112, html5 player vflset
[youtube] {160} signature length 112, html5 player vflset
[youtube] {278} signature length 108, html5 player vflset
[youtube] {140} signature length 108, html5 player vflset
[youtube] {249} signature length 112, html5 player vflset
[youtube] {250} signature length 112, html5 player vflset
[youtube] {251} signature length 112, html5 player vflset
[debug] Invoking downloader on 'https://r1---sn-j5caxoxu-pn2s.googlevideo.com/videoplayback?expire=1586877236&ei=1H6VXuyEHsWw8wTb0qHYBQ&ip=24.46.195.206&id=o-ANWhMbsYQv7_OnFLcmLSNMWxvtNjyDxA3fSLcnbj1gOK&itag=18&source=youtube&requiressl=yes&mh=-H&mm=31%2C26&mn=sn-j5caxoxu-pn2s%2Csn-p5qlsnzd&ms=au%2Conr&mv=m&mvi=0&pcm2cms=yes&pl=21&initcwndbps=1583750&vprv=1&mime=video%2Fmp4&gir=yes&clen=399894&ratebypass=yes&dur=6.083&lmt=1373205654632761&mt=1586855557&fvip=1&fexp=23882514&c=WEB&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cgir%2Cclen%2Cratebypass%2Cdur%2Clmt&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpcm2cms%2Cpl%2Cinitcwndbps&lsig=ALrAebAwRgIhAMYIPMU_ErIIXmpwavy5_0MVzsdSqAkcGYueVAgkH562AiEAhfcrRQDkcZ4a0Uicsl1he6D9k7dWD-jYVgpVYTc-Fxg%3D&sig=bGGbGGGUdURmD3ff2bVAV62gVvnJXRswjX1_Yv7cEcGPLOxLmwEIC8OREdpdGzn9NzrV3uaN3yPAHf3SFVWcMTZdBwqidf2SgIARwsLlP'
ERROR: unable to download video data: HTTP Error 403: Forbidden
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/youtube_dl/YoutubeDL.py", line 1926, in process_info
    success = dl(filename, info_dict)
  File "/usr/local/lib/python3.7/dist-packages/youtube_dl/YoutubeDL.py", line 1865, in dl
    return fd.download(name, info)
  File "/usr/local/lib/python3.7/dist-packages/youtube_dl/downloader/common.py", line 366, in download
    return self.real_download(filename, info_dict)
  File "/usr/local/lib/python3.7/dist-packages/youtube_dl/downloader/http.py", line 341, in real_download
    establish_connection()
  File "/usr/local/lib/python3.7/dist-packages/youtube_dl/downloader/http.py", line 109, in establish_connection
    ctx.data = self.ydl.urlopen(request)
  File "/usr/local/lib/python3.7/dist-packages/youtube_dl/YoutubeDL.py", line 2238, in urlopen
    return self._opener.open(req, timeout=self._socket_timeout)
  File "/usr/lib/python3.7/urllib/request.py", line 531, in open
    response = meth(req, response)
  File "/usr/lib/python3.7/urllib/request.py", line 641, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python3.7/urllib/request.py", line 569, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.7/urllib/request.py", line 503, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.7/urllib/request.py", line 649, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v', '--output', '-', '--restrict-filenames', '--format', '18', '--newline', 'https://www.youtube.com/watch?v=IB_2jkwxqh4']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2020.03.24
[debug] Python version 3.7.3 (CPython) - Linux-4.19.97-v7+-armv7l-with-debian-10.3
[debug] exe versions: ffmpeg 4.1.4-1, ffprobe 4.1.4-1
[debug] Proxy map: {}
[youtube] IB_2jkwxqh4: Downloading webpage
[youtube] {18} signature length 112, html5 player vflset
[youtube] {134} signature length 112, html5 player vflset
[youtube] {243} signature length 112, html5 player vflset
[youtube] {133} signature length 108, html5 player vflset
[youtube] {242} signature length 112, html5 player vflset
[youtube] {160} signature length 112, html5 player vflset
[youtube] {278} signature length 112, html5 player vflset
[youtube] {140} signature length 112, html5 player vflset
[youtube] {249} signature length 112, html5 player vflset
[youtube] {250} signature length 112, html5 player vflset
[youtube] {251} signature length 112, html5 player vflset
[debug] Invoking downloader on 'https://r1---sn-j5caxoxu-pn2s.googlevideo.com/videoplayback?expire=1586877253&ei=5X6VXoHjIJWS8wTpm4-oBw&ip=24.46.195.206&id=o-AIga-kNXnP-Dnca7NoYpFvZBV4EwRFl1NBRjXqsf50YZ&itag=18&source=youtube&requiressl=yes&mh=-H&mm=31%2C26&mn=sn-j5caxoxu-pn2s%2Csn-p5qlsnzd&ms=au%2Conr&mv=m&mvi=0&pcm2cms=yes&pl=21&initcwndbps=1583750&vprv=1&mime=video%2Fmp4&gir=yes&clen=399894&ratebypass=yes&dur=6.083&lmt=1373205654632761&mt=1586855557&fvip=1&fexp=23882513&c=WEB&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cgir%2Cclen%2Cratebypass%2Cdur%2Clmt&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpcm2cms%2Cpl%2Cinitcwndbps&lsig=ALrAebAwRAIgCtHkVI8wGKy7NVaNC_Izqpqzek8wt9fcwNxl1One2h8CIFMDMnGclYfXsLdwU1M-4cNWrjC9LTATaIOgfdIymUHQ&sig=AJpPlLswRQIhAIIlBG3rWK8vTAy35_YEP__O6UYlSvQSppwiubKZuiy7AiADJXgmctYlRcCwvI2i8-cb20wnmidaOpaTzxMAquy1iw=='
[download] Destination: -
[download]   0.3% of 390.52KiB at 618.17KiB/s ETA 00:00
[download]   0.8% of 390.52KiB at  1.15MiB/s ETA 00:00
[download]   1.8% of 390.52KiB at  2.06MiB/s ETA 00:00
[download]   3.8% of 390.52KiB at  3.28MiB/s ETA 00:00
[download]   7.9% of 390.52KiB at  2.74MiB/s ETA 00:00
[download]  16.1% of 390.52KiB at  2.83MiB/s ETA 00:00
[download]  32.5% of 390.52KiB at  3.82MiB/s ETA 00:00
[download]  65.3% of 390.52KiB at  4.50MiB/s ETA 00:00
[download] 100.0% of 390.52KiB at  4.78MiB/s ETA 00:00
[download] 100% of 390.52KiB in 00:00

Description

youtube-dl gets HTTP Error 403: Forbidden when run as sudo on raspberry pi. This only happens perhaps one in every ten runs. Most of the time it will be successful -- that is why I ran it in a while loop above. Running without sudo works fine.

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Apr 14, 2020

--rm-cache-dir.

@dstftw dstftw closed this Apr 14, 2020
dasl- added a commit to dasl-/pifi that referenced this issue Apr 14, 2020
1) youtube-dl fails with 403.  example logs: https://gist.github.com/dasl-/aa430e268578a89a1d207f7892746ed4
2) ffprobe exits non-zero. example logs: https://gist.github.com/dasl-/1624dc6d41682a7d2b1d3b13107b523f

Both appear to be randomly / rarely ocurring. Investigation found they were due to: ytdl-org/youtube-dl#24780

We will file an issue in our repo to cron the solution documented in that ticket.
@a-raccoon a-raccoon mentioned this issue Apr 30, 2020
3 of 5 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.