ytdl-org / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
The Unlicense
132.49k stars 10.05k forks source link

HTTP Error 403: Unauthorized #20266

Closed nop closed 2 years ago

nop commented 5 years ago

Please follow the guide below


Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2019.03.01. If it's not, read this FAQ entry and update. Issues with outdated version will be rejected.

Before submitting an issue make sure you have:

What is the purpose of your issue?


The following sections concretize particular purposed issues, you can erase any section (the contents between triple ---) not applicable to your issue


If the purpose of this issue is a bug report, site support request or you are not completely sure provide the full verbose output as follows:

Add the -v flag to your command line you run youtube-dl with (youtube-dl -v <your command line>), copy the whole output and insert it here. It should look similar to one below (replace it with your log inserted between triple ```):

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['--netrc', '-o', '~/Videos/%(playlist)s/%(chapter_number)s - %(chapter)s/%(title)s.%(ext)s', 'https://www.udemy.com/the-web-developer-bootcamp', '--verbose']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2019.03.01
[debug] Python version 3.7.2 (CPython) - Linux-4.20.12-arch1-1-ARCH-x86_64-with-arch
[debug] exe versions: ffmpeg 4.1.1, ffprobe 4.1.1
[debug] Proxy map: {}
[udemy:course] Downloading login popup
ERROR: Unable to download webpage: HTTP Error 403: Unauthorized (caused by <HTTPError 403: 'Unauthorized'>); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
  File "/usr/lib/python3.7/site-packages/youtube_dl/extractor/common.py", line 605, in _request_webpage
    return self._downloader.urlopen(url_or_request)
  File "/usr/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 2225, 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)
...
<end of log>

Description of your issue, suggested solution and other information

I am unable to download any course on Udemy. I have paid for all courses I'm trying to download, and can watch them in multiple different browsers. My ~/.netrc contains my exact credentials for Udemy. I have also tried to forego my ~/.netrc with the -u and -p flags, which has yielded the same error. I have tried downloading entire courses that give [udemy:course] output, and single videos that give '[udemy]' output/logging.

There is an open issue for fixing 403 issues, so I would propose the work discussed in that thread.

I see many people opening similar issues, just to have them closed and marked as "duplicate"s. This issue is not a duplicate, as no issue thread for this project (yes, I've checked them) has yielded a solution to my issue.

nop commented 5 years ago

The issue persists when accessing a free video, generating valid cookies (from cookies.txt), omitting --netrc, and using -u and -p again.

dnlzzxz commented 5 years ago

Same here, cannot download [Udemy] course, already tried -u and -p, and --cookies as well. Keeps accusing the 403 error.

Thierry-FR commented 5 years ago

I had the exact same issue but after viewing the first video of the course everything finally worked fine.

Issue : [udemy:course] Downloading login popup ERROR: Unable to download webpage: HTTP Error 403: Unauthorized (caused by HTTPError()); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

My command : youtube-dl -u USER -p PASS -o "./%(playlist)s/%(chapter_number)s-%(chapter)s/%(autonumber)03d-%(title)s.%(ext)s" --cookies "./cookies.txt" "https://www.udemy.com/COURSE/learn/v4/content"

Change USER, PASS and COURSE :)

tabithabragg commented 5 years ago

This issue still persists in the latest build: 2019.04.01: Mentioned above is watching the first video in a course to solve this problem. As of this build, either no longer works, or was an unrelated issue.

user@mybox: youtube-dl -u REDACTED@REDACTED -p REDACTED -v -o "./%(playlist)s/%(chapter_number)s-%(chapter)s/%(autonumber)03d-%(title)s.%(ext)s" https://www.udemy.com/learn-devops-continuously-deliver-better-software/learn/v4/content [debug] System config: [] [debug] User config: [] [debug] Custom config: [] [debug] Command-line args: [u'-u', u'PRIVATE', u'-p', u'PRIVATE', u'-v', u'-o', u'./%(playlist)s/%(chapter_number)s-%(chapter)s/%(autonumber)03d-%(title)s.%(ext)s', u'https://www.udemy.com/learn-devops-continuously-deliver-better-software/learn/v4/content'] [debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8 [debug] youtube-dl version 2019.04.01 [debug] Python version 2.7.15rc1 (CPython) - Linux-4.15.0-38-generic-x86_64-with-Ubuntu-18.04-bionic [debug] exe versions: ffmpeg 3.4.4, ffprobe 3.4.4, phantomjs 2.1.1, rtmpdump 2.4 [debug] Proxy map: {} [udemy:course] Downloading login popup ERROR: Unable to download webpage: HTTP Error 403: Unauthorized (caused by HTTPError()); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type youtube-dl -U to update. Be sure to call youtube-dl with the --verbose flag and include its complete output. File "/usr/local/bin/youtube-dl/youtube_dl/extractor/common.py", line 626, in _request_webpage return self._downloader.urlopen(url_or_request) File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 2225, in urlopen return self._opener.open(req, timeout=self._socket_timeout) File "/usr/lib/python2.7/urllib2.py", line 435, in open response = meth(req, response) File "/usr/lib/python2.7/urllib2.py", line 548, in http_response 'http', request, response, code, msg, hdrs) File "/usr/lib/python2.7/urllib2.py", line 473, in error return self._call_chain(args) File "/usr/lib/python2.7/urllib2.py", line 407, in _call_chain result = func(args) File "/usr/lib/python2.7/urllib2.py", line 556, in http_error_default raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)

kyleinprogress commented 5 years ago

Also having this issue on the latest version 2019.04.30. It will start downloading, but 10-15 videos in, I get the 403 error.

$ youtube-dl -u '<USERNAME>' -p '<PASSWORD>' -f best https://www.udemy.com/django-python-advanced --verbose
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-u', 'PRIVATE', '-p', 'PRIVATE', '-f', 'best', 'https://www.udemy.com/django-python-advanced', '--verbose']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2019.04.30
[debug] Python version 3.5.2 (CPython) - Linux-4.4.0-146-generic-x86_64-with-Ubuntu-16.04-xenial
[debug] exe versions: ffmpeg 4.1.3-0york1, ffprobe 4.1.3-0york1
[debug] Proxy map: {}
[udemy:course] Downloading login popup
[udemy:course] Logging in
[udemy:course] django-python-advanced: Downloading webpage
[udemy:course] 2045310: Downloading course curriculum
[download] Downloading playlist: 2045310
[udemy:course] playlist 2045310: Collected 72 video ids (downloading 72 of them)
[download] Downloading video 1 of 72
[udemy] Downloading login popup
[udemy] 12896152: Downloading webpage
[udemy] 12896152: Downloading lecture JSON
[udemy] 15685874: Downloading m3u8 information
[debug] Invoking downloader on 'https://h.udemycdn-a.com/2045310/15685874/2018-12-12_21-12-53-30cdb5d0d8c55b64cb679cd6605ff5dd/hls/hls_1080/aa0018948a611d8e47f3ab8b3edb7b063fb6.m3u8'
[download] Welcome to Build a Backend API with Django REST Framework - Advanced-15685874.mp4 has already been downloaded
[download] 100% of 77.85MiB
[debug] ffmpeg command line: ffprobe -show_streams 'file:Welcome to Build a Backend API with Django REST Framework - Advanced-15685874.mp4'
[ffmpeg] Fixing malformed AAC bitstream in "Welcome to Build a Backend API with Django REST Framework - Advanced-15685874.mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:Welcome to Build a Backend API with Django REST Framework - Advanced-15685874.mp4' -c copy -f mp4 -bsf:a aac_adtstoasc 'file:Welcome to Build a Backend API with Django REST Framework - Advanced-15685874.temp.mp4'
[download] Downloading video 2 of 72
[udemy] 12712403: Downloading webpage
[udemy] 12712403: Downloading lecture JSON
[debug] Invoking downloader on 'https://a2.udemycdn.com/2019-02-28_15-50-49-0e00b1f9d0ddb0858470669a0d89460b/WebHD_720p.mp4?nva=20190510234229&token=01e4c2e50dc65b0ab1104'
[download] Intro to the course-16890256.mp4 has already been downloaded
[download] 100% of 51.85MiB
[download] Downloading video 3 of 72
[udemy] 13842064: Downloading webpage
[udemy] 13842064: Downloading lecture JSON
[udemy] 16890318: Downloading m3u8 information
[debug] Invoking downloader on 'https://h.udemycdn-a.com/2045310/16890318/2019-02-28_15-55-13-ecefa0e4f8520a38230602fa8970f946/hls/hls_1080/aa00f34e3ef964e7c7e5c79aaddb405eb2ac.m3u8'
[download] Course structure-16890318.mp4 has already been downloaded
[download] 100% of 36.79MiB
[debug] ffmpeg command line: ffprobe -show_streams 'file:Course structure-16890318.mp4'
[ffmpeg] Fixing malformed AAC bitstream in "Course structure-16890318.mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:Course structure-16890318.mp4' -c copy -f mp4 -bsf:a aac_adtstoasc 'file:Course structure-16890318.temp.mp4'
[download] Downloading video 4 of 72
[udemy] 13842068: Downloading webpage
[udemy] 13842068: Downloading lecture JSON
[udemy] 16890322: Downloading m3u8 information
[debug] Invoking downloader on 'https://h.udemycdn-a.com/2045310/16890322/2019-02-28_15-55-33-85946d8c48861ca3084ec8caddc242d3/hls/hls_1080/aa0029e2a87f675e3569ac335e5bc4e83fd0.m3u8'
[download] How to get the most out of this course-16890322.mp4 has already been downloaded
[download] 100% of 31.05MiB
[debug] ffmpeg command line: ffprobe -show_streams 'file:How to get the most out of this course-16890322.mp4'
[ffmpeg] Fixing malformed AAC bitstream in "How to get the most out of this course-16890322.mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:How to get the most out of this course-16890322.mp4' -c copy -f mp4 -bsf:a aac_adtstoasc 'file:How to get the most out of this course-16890322.temp.mp4'
[download] Downloading video 5 of 72
[udemy] 13842070: Downloading webpage
[udemy] 13842070: Downloading lecture JSON
[udemy] 16890328: Downloading m3u8 information
[debug] Invoking downloader on 'https://h.udemycdn-a.com/2045310/16890328/2019-02-28_15-56-26-0077d22653b35c54eedbb93261334032/hls/hls_1080/aa0031528003e1de36e83c4ca845e0bc7cfe.m3u8'
[download] How to get help-16890328.mp4 has already been downloaded
[download] 100% of 47.33MiB
[debug] ffmpeg command line: ffprobe -show_streams 'file:How to get help-16890328.mp4'
[ffmpeg] Fixing malformed AAC bitstream in "How to get help-16890328.mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:How to get help-16890328.mp4' -c copy -f mp4 -bsf:a aac_adtstoasc 'file:How to get help-16890328.temp.mp4'
[download] Downloading video 6 of 72
[udemy] 12712409: Downloading webpage
[udemy] 12712409: Downloading lecture JSON
[debug] Invoking downloader on 'https://a2.udemycdn.com/2019-02-28_15-56-38-4ba46678e4ff20fd46ba143c38e65541/WebHD_720p.mp4?nva=20190510234233&token=0fb606c8c4469666fb22b'
[download] Python-16890332.mp4 has already been downloaded
[download] 100% of 16.88MiB
[download] Downloading video 7 of 72
[udemy] 13842082: Downloading webpage
[udemy] 13842082: Downloading lecture JSON
[udemy] 16890342: Downloading m3u8 information
[debug] Invoking downloader on 'https://h.udemycdn-a.com/2045310/16890342/2019-02-28_15-57-43-8c51c6db390c57b8065aa6d977e9f983/hls/hls_1080/aa009dae558a48320744191f90e3472bf4c4.m3u8'
[download] Django-16890342.mp4 has already been downloaded
[download] 100% of 31.60MiB
[debug] ffmpeg command line: ffprobe -show_streams file:Django-16890342.mp4
[ffmpeg] Fixing malformed AAC bitstream in "Django-16890342.mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i file:Django-16890342.mp4 -c copy -f mp4 -bsf:a aac_adtstoasc file:Django-16890342.temp.mp4
[download] Downloading video 8 of 72
[udemy] 13842090: Downloading webpage
[udemy] 13842090: Downloading lecture JSON
[udemy] 16890344: Downloading m3u8 information
[debug] Invoking downloader on 'https://h.udemycdn-a.com/2045310/16890344/2019-02-28_15-58-18-0c04d2f82a70bd581c6bf240b64a7d6a/hls/hls_1080/aa00757468641dbd6d929a13a77d2685f1b8.m3u8'
[download] Django REST Framework-16890344.mp4 has already been downloaded
[download] 100% of 27.44MiB
[debug] ffmpeg command line: ffprobe -show_streams 'file:Django REST Framework-16890344.mp4'
[ffmpeg] Fixing malformed AAC bitstream in "Django REST Framework-16890344.mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:Django REST Framework-16890344.mp4' -c copy -f mp4 -bsf:a aac_adtstoasc 'file:Django REST Framework-16890344.temp.mp4'
[download] Downloading video 9 of 72
[udemy] 13842094: Downloading webpage
[udemy] 13842094: Downloading lecture JSON
[udemy] 16890348: Downloading m3u8 information
[debug] Invoking downloader on 'https://h.udemycdn-a.com/2045310/16890348/2019-02-28_15-58-34-e19fc02c2f5eb15502564e66780f3a07/hls/hls_1080/aa00fd301fbce16a3eca507bb3fd3b87918b.m3u8'
[download] Docker-16890348.mp4 has already been downloaded
[download] 100% of 20.55MiB
[debug] ffmpeg command line: ffprobe -show_streams file:Docker-16890348.mp4
[ffmpeg] Fixing malformed AAC bitstream in "Docker-16890348.mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i file:Docker-16890348.mp4 -c copy -f mp4 -bsf:a aac_adtstoasc file:Docker-16890348.temp.mp4
[download] Downloading video 10 of 72
[udemy] 13842100: Downloading webpage
[udemy] 13842100: Downloading lecture JSON
[udemy] 16890372: Downloading m3u8 information
[debug] Invoking downloader on 'https://h.udemycdn-a.com/2045310/16890372/2019-02-28_15-59-14-b8cad1ab2237bd055bf3f3a7de167a0c/hls/hls_1080/aa00ed8fee25985b519eace31f9106b830b6.m3u8'
[download] Travis-CI-16890372.mp4 has already been downloaded
[download] 100% of 24.98MiB
[debug] ffmpeg command line: ffprobe -show_streams file:Travis-CI-16890372.mp4
[ffmpeg] Fixing malformed AAC bitstream in "Travis-CI-16890372.mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i file:Travis-CI-16890372.mp4 -c copy -f mp4 -bsf:a aac_adtstoasc file:Travis-CI-16890372.temp.mp4
[download] Downloading video 11 of 72
[udemy] 13842104: Downloading webpage
[udemy] 13842104: Downloading lecture JSON
[udemy] 16890378: Downloading m3u8 information
[debug] Invoking downloader on 'https://h.udemycdn-a.com/2045310/16890378/2019-02-28_15-59-36-9d26055aadbc67964980a2ec504b871e/hls/hls_1080/aa00735465d567170665f6a13853854ba2f3.m3u8'
[download] Postgres-16890378.mp4 has already been downloaded
[download] 100% of 10.62MiB
[debug] ffmpeg command line: ffprobe -show_streams file:Postgres-16890378.mp4
[ffmpeg] Fixing malformed AAC bitstream in "Postgres-16890378.mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i file:Postgres-16890378.mp4 -c copy -f mp4 -bsf:a aac_adtstoasc file:Postgres-16890378.temp.mp4
[download] Downloading video 12 of 72
[udemy] 12908108: Downloading webpage
[udemy] 12908108: Downloading lecture JSON
[debug] Invoking downloader on 'https://a.udemycdn.com/2019-02-28_16-00-32-f7b5a6a7a706a639a7bcba9cc64d24c7/WebHD_720p.mp4?nva=20190510234240&token=03ec2252a538f44b54052'
[download] What is test driven development-16890390.mp4 has already been downloaded
[download] 100% of 87.95MiB
[download] Downloading video 13 of 72
[udemy] 12712509: Downloading webpage
[udemy] 12712509: Downloading lecture JSON
[udemy] 15455889: Downloading m3u8 information
[debug] Invoking downloader on 'https://h.udemycdn-a.com/2045310/15455889/2018-11-27_17-41-18-be632cb5f54c00207e5f505d40ef98c7/hls/hls_1080/aa00fc9dfdcf70f46c162e41ee9ab56052af.m3u8'
[download] Setup new GitHub project-15455889.mp4 has already been downloaded
[download] 100% of 65.86MiB
[debug] ffmpeg command line: ffprobe -show_streams 'file:Setup new GitHub project-15455889.mp4'
[ffmpeg] Fixing malformed AAC bitstream in "Setup new GitHub project-15455889.mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:Setup new GitHub project-15455889.mp4' -c copy -f mp4 -bsf:a aac_adtstoasc 'file:Setup new GitHub project-15455889.temp.mp4'
[download] Downloading video 14 of 72
[udemy] 12712517: Downloading webpage
[udemy] 12712517: Downloading lecture JSON
[udemy] 15455907: Downloading m3u8 information
[debug] Invoking downloader on 'https://h.udemycdn-a.com/2045310/15455907/2018-11-27_17-42-55-13c761e6b08290ba27b6660a59ae0817/hls/hls_1080/aa0037a7c60ce525e7177c66aa33bf74a2a2.m3u8'
[download] Add Dockerfile-15455907.mp4 has already been downloaded
[download] 100% of 188.43MiB
[debug] ffmpeg command line: ffprobe -show_streams 'file:Add Dockerfile-15455907.mp4'
[ffmpeg] Fixing malformed AAC bitstream in "Add Dockerfile-15455907.mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:Add Dockerfile-15455907.mp4' -c copy -f mp4 -bsf:a aac_adtstoasc 'file:Add Dockerfile-15455907.temp.mp4'
[download] Downloading video 15 of 72
[udemy] 12712519: Downloading webpage
[udemy] 12712519: Downloading lecture JSON
[udemy] 15455915: Downloading m3u8 information
[debug] Invoking downloader on 'https://h.udemycdn-a.com/2045310/15455915/2018-11-27_17-43-42-5ff22c77124dab3d66d9d3af60c09733/hls/hls_1080/aa006fb2587c8b2b526f540ee1fac9100164.m3u8'
[download] Configure Docker Compose-15455915.mp4 has already been downloaded
[download] 100% of 97.32MiB
[debug] ffmpeg command line: ffprobe -show_streams 'file:Configure Docker Compose-15455915.mp4'
[ffmpeg] Fixing malformed AAC bitstream in "Configure Docker Compose-15455915.mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:Configure Docker Compose-15455915.mp4' -c copy -f mp4 -bsf:a aac_adtstoasc 'file:Configure Docker Compose-15455915.temp.mp4'
[download] Downloading video 16 of 72
[udemy] 12712523: Downloading webpage
[udemy] 12712523: Downloading lecture JSON
[udemy] 15455917: Downloading m3u8 information
[debug] Invoking downloader on 'https://h.udemycdn-a.com/2045310/15455917/2018-11-27_17-44-19-9d4573ddd7c0fba763d9bf8ac464b1bc/hls/hls_1080/aa000ead3f18032b66f3a678c50ddc3b03c9.m3u8'
[download] Create Django project-15455917.mp4 has already been downloaded
[download] 100% of 59.21MiB
[debug] ffmpeg command line: ffprobe -show_streams 'file:Create Django project-15455917.mp4'
[ffmpeg] Fixing malformed AAC bitstream in "Create Django project-15455917.mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:Create Django project-15455917.mp4' -c copy -f mp4 -bsf:a aac_adtstoasc 'file:Create Django project-15455917.temp.mp4'
[download] Downloading video 17 of 72
[udemy] 12712529: Downloading webpage
ERROR: Unable to download webpage: HTTP Error 403: Forbidden (caused by <HTTPError 403: 'Forbidden'>); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
  File "/usr/local/lib/python3.5/dist-packages/youtube_dl/extractor/common.py", line 626, in _request_webpage
    return self._downloader.urlopen(url_or_request)
  File "/usr/local/lib/python3.5/dist-packages/youtube_dl/YoutubeDL.py", line 2227, in urlopen
    return self._opener.open(req, timeout=self._socket_timeout)
  File "/usr/lib/python3.5/urllib/request.py", line 472, in open
    response = meth(req, response)
  File "/usr/lib/python3.5/urllib/request.py", line 582, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python3.5/urllib/request.py", line 510, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.5/urllib/request.py", line 444, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.5/urllib/request.py", line 590, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)