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
131.89k stars 10k forks source link

[udemy] unable to login #14713

Closed ghost closed 5 years ago

ghost commented 6 years ago

youtube-dl -u email@gmail.com -p password https://www.udemy.com/javascript-essentials/learn/v4/content --verbose [debug] System config: [] [debug] User config: [] [debug] Custom config: [] [debug] Command-line args: [u'-u', u'PRIVATE', u'-p', u'PRIVATE', u'https://www.udemy.com/javascript-essentials/learn/v4/content', u'--verbose'] [debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8 [debug] youtube-dl version 2017.11.06 [debug] Python version 2.7.12 - Linux-4.10.0-38-generic-x86_64-with-Ubuntu-16.04-xenial [debug] exe versions: none [debug] Proxy map: {} [udemy:course] Downloading login popup [udemy:course] Logging in as mndlgen@gmail.com ERROR: Unable to log in; 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. Traceback (most recent call last): File "/home/extsalt/.local/lib/python2.7/site-packages/youtube_dl/YoutubeDL.py", line 784, in extract_info ie_result = ie.extract(url) File "/home/extsalt/.local/lib/python2.7/site-packages/youtube_dl/extractor/common.py", line 436, in extract self.initialize() File "/home/extsalt/.local/lib/python2.7/site-packages/youtube_dl/extractor/common.py", line 394, in initialize self._real_initialize() File "/home/extsalt/.local/lib/python2.7/site-packages/youtube_dl/extractor/udemy.py", line 140, in _real_initialize self._login() File "/home/extsalt/.local/lib/python2.7/site-packages/youtube_dl/extractor/udemy.py", line 180, in _login raise ExtractorError('Unable to log in') ExtractorError: Unable to log in; 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.

dstftw commented 6 years ago

Post the output with --dump-pages.

ScttB commented 6 years ago

You missed a email address there. [udemy:course] Logging in as (thisemail@shouldbecensor.ed)

giacomocerquone commented 6 years ago

UPDATE: Evreything is working now, I was using an old version of the script that i got from apt!

dikadk commented 6 years ago

I can confirm that I have the same issue with downloading courses from Udemy. I use the latest version and I'm on HighSierra.

giacomocerquone commented 6 years ago

@dikadk It's strange, are you sure are you using the latest version? I've no problem on windows, but the two OS shouldn't differ

jyounus commented 6 years ago

I'm having the same error, here's my output with the --dump-pages command (I had to use an external service because of reaching the max number of characters in this comment): https://paste.ee/p/6qF6K

I'm running the latest version of youtube-dl on High Sierra.

ghost commented 6 years ago

I can't login to udemy too

OldTrain commented 6 years ago
youtube-dl -u EMAIL@gmail.com -p PASSWORD -o "%(chapter)s/%(title)s.%(ext)s"  "http://www.udemy.com/unity-game-developers-masterclass-write-games-using-c/learn/v4/content" --verbose
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-u', 'PRIVATE', '-p', 'PRIVATE', '-o', '%(chapter)s/%(title)s.%(ext)s', 'http://www.udemy.com/unity-game-developers-masterclass-write-games-using-c/learn/v4/content', '--verbose']
[debug] Encodings: locale cp1252, fs mbcs, out cp437, pref cp1252
[debug] youtube-dl version 2018.09.26
[debug] Python version 3.4.4 (CPython) - Windows-10-10.0.16299
[debug] exe versions: none
[debug] Proxy map: {}
[udemy:course] Downloading login popup
[udemy:course] Logging in
ERROR: Unable to log in; 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.
Traceback (most recent call last):
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpcaq35cl9\build\youtube_dl\YoutubeDL.py", line 792, in extract_info
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpcaq35cl9\build\youtube_dl\extractor\common.py", line 506, in extract
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpcaq35cl9\build\youtube_dl\extractor\common.py", line 410, in initialize
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpcaq35cl9\build\youtube_dl\extractor\udemy.py", line 154, in _real_initialize
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpcaq35cl9\build\youtube_dl\extractor\udemy.py", line 194, in _login
youtube_dl.utils.ExtractorError: Unable to log in; 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.
OldTrain commented 6 years ago

request with dump page udemy-dl-dump.txt

ralyodio commented 5 years ago

Looks like this is back....

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'--verbose', u'-u', u'PRIVATE', u'-p', u'PRIVATE', u'--rate-limit', u'500K', u'--sleep-interval', u'30', u'-o', u'%(autonumber)s-%(title)s.%(ext)s', u'https://www.udemy.com/aws-certified-solutions-architect-associate/learn/v4/overview']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2018.11.07
[debug] Python version 2.7.15rc1 (CPython) - Linux-3.14.32-xxxx-grs-ipv6-64-x86_64-with-Ubuntu-18.04-bionic
[debug] exe versions: ffmpeg 3.4.4-0ubuntu0.18.04.1, ffprobe 3.4.4-0ubuntu0.18.04.1
[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; 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/python2.7/dist-packages/youtube_dl/extractor/common.py", line 605, in _request_webpage
    return self._downloader.urlopen(url_or_request)
  File "/usr/local/lib/python2.7/dist-packages/youtube_dl/YoutubeDL.py", line 2211, 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)
TCarmine commented 5 years ago

I do have kind similar issue. But to me is strange as once I did write:

youtube-dl -u email -p Password Link/content

it then on the next line put something strange as

youtube-dl -u email -p Password+someotherstring Link/content

I tried without -u and -p but bring me the following

Unable to download webpage: HTTP Error 403: Unauthorized (caused by HTTPError());

TCarmine commented 5 years ago

I had a look to my local udemy-dl and found that the code that is failing seems the following:

def get_csrf_token(): """Extractig CSRF Token from login page.""" try: response = session.get('https://www.udemy.com/join/login-popup') match = re.search(r"name='csrfmiddlewaretoken'\s+value='(.)'", response.text) return match.group(1) except AttributeError: session.get('http://www.udemy.com/user/logout') response = session.get('https://www.udemy.com/join/login-popup') match = re.search(r"name='csrfmiddlewaretoken'\s+value='(.)'", response.text) return match.group(1)

TCarmine commented 5 years ago

So seems the that part fail to get the CSRF Token.

Could be udemy changed the Token?

TCarmine commented 5 years ago

Just to clarify I got the previous error not running youtube-dl but udemy-dl that is the only one that prompt to give userName and Password. Unfortunately the youtube-dl add that extra string to the password.

ewarner9 commented 5 years ago

how do you use udemy-dl? when I try that it is not a recognized command. I am getting a similar error trying to login...

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-u', 'PRIVATE', '-p', 'PRIVATE', '-v', 'https://www.udemy.com/the-complete-aspnet-mvc-5-course/learn/v4/content']
[debug] Encodings: locale cp1252, fs utf-8, out utf-8, pref cp1252
[debug] youtube-dl version 2018.12.17
[debug] Python version 3.6.4 (CPython) - Windows-10-10.0.17134-SP0
[debug] exe versions: none
[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 "c:\python\python36\lib\site-packages\youtube_dl\extractor\common.py", line 605, in _request_webpage
    return self._downloader.urlopen(url_or_request)
  File "c:\python\python36\lib\site-packages\youtube_dl\YoutubeDL.py", line 2212, in urlopen
    return self._opener.open(req, timeout=self._socket_timeout)
  File "c:\python\python36\lib\urllib\request.py", line 532, in open
    response = meth(req, response)
  File "c:\python\python36\lib\urllib\request.py", line 642, in http_response
    'http', request, response, code, msg, hdrs)
  File "c:\python\python36\lib\urllib\request.py", line 570, in error
    return self._call_chain(*args)
  File "c:\python\python36\lib\urllib\request.py", line 504, in _call_chain
    result = func(*args)
  File "c:\python\python36\lib\urllib\request.py", line 650, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
ghost commented 5 years ago

I also get this error:

ERROR: Unable to download webpage: HTTP Error 403: Unauthorized (caused by <HTTPError 403: 'Unauthorized'>);

Has there been any progress at this?

TCarmine commented 5 years ago

@ewarner9 I am on Ubuntu 18.04 though.

You are in Windows(n so CPython).

Our error code is the same 403, it then does not recognize our credentials. In my case the reason is that somehow to the password is added an extra string. Too me seems a security constrain