dgorissen / coursera-dl

A script for downloading course material (video's, pdfs, quizzes, etc) from coursera.org
http://dirkgorissen.com/2012/09/07/coursera-dl-a-coursera-download-script/
GNU General Public License v3.0
1.74k stars 299 forks source link

Failed to authenticate #164

Closed matejaputic closed 9 years ago

matejaputic commented 9 years ago

Failed to authenticate even though I can authenticate through the website. I made sure I have accepted the honor policy for the course, but the behavior is the same. Also tried changing my password to a shorter password, that didn't help either. I believe I am using the latest version. Is this just a never ending cat-and-mouse game with Coursera? Any help would be appreciated.

Coursera-dl v3.1 (html.parser)
Logging in as 'mst3k@virginia.edu'...
Traceback (most recent call last):
  File "/home/mst3k/coursera_project/venv/bin/coursera-dl", line 9, in <module>
    load_entry_point('coursera-dl==3.1', 'console_scripts', 'coursera-dl')()
  File "/home/mst3k/coursera_project/venv/lib/python2.7/site-packages/courseradownloader/courseradownloader.py", line 649, in main
    d.login(args.course_names[0])
  File "/home/mst3k/coursera_project/venv/lib/python2.7/site-packages/courseradownloader/courseradownloader.py", line 168, in login
    raise Exception("Failed to authenticate as %s" % self.username)
Exception: Failed to authenticate as mst3k@virginia.edu
ctrainr commented 9 years ago

same problem

afedulov commented 9 years ago

+1

helloworldcoursera commented 9 years ago

Same Issue - Failed to authenticate. Any ideas on what might be going wrong ?

jungleslave commented 9 years ago

Ditto. Please Help !

seifer08ms commented 9 years ago

+1! Same problem !

visini commented 9 years ago

Same here, unable to download anything. Seems like they changed their login behavior very recently.

Coursera-dl v3.1 (html.parser)
Logging in as 'xxx@yyy.com'...
Traceback (most recent call last):
  File "/usr/local/bin/coursera-dl", line 9, in <module>
    load_entry_point('coursera-dl==3.1', 'console_scripts', 'coursera-dl')()
  File "/usr/local/lib/python2.7/site-packages/courseradownloader/courseradownloader.py", line 649, in main
    d.login(args.course_names[0])
  File "/usr/local/lib/python2.7/site-packages/courseradownloader/courseradownloader.py", line 168, in login
    raise Exception("Failed to authenticate as %s" % self.username)
Exception: Failed to authenticate as xxx@yyy.com
paulvictor commented 9 years ago

+1. Same problem here

dgorissen commented 9 years ago

This is probably because coursera changed something on their authentication side. So the coursera-dl code needs updating. Has happened a couple of times before and usually not major. I will take a look but don't have much bandwidth, so it wont be this week. So anybody able to already take a poke at the code would be much appreciated.

HyShai commented 9 years ago

The error is Invalid CSRF Token

HyShai commented 9 years ago

You can see the change needed to implement here - basically it needs another CSRF token.

(I don't have time ATM to do it here)

Jared314 commented 9 years ago

Oddly enough, the 2.0.2 version authenticated correctly for me. Downgrading might be a plausible workaround until the issue is resolved.

$ pip uninstall coursera-dl
$ pip install coursera-dl==2.0.2
HyShai commented 9 years ago

Can confirm 2.0.2 authenticates.

Thanks @Jared314

nick-s-b commented 9 years ago

Are there any issues with 2.0.2 branch?

visini commented 9 years ago

2.0.2 worked for me, thanks!

danmbox commented 9 years ago

Where was 2.0.2 in Git? I don't see any tags...

nomoreidsavailable commented 9 years ago

Confirmed! 2.0.2 worked for me as well! Thank you!

ghost commented 9 years ago

2.0.2 Works well Thanks Jared314

danmbox commented 9 years ago

I've tried commit ac0c411a69ebea3ffb26944b23c5a92718921007 on the mechanize branch (which seems to be version 2.0.2) but I'm still getting authentication problems

beastman001 commented 9 years ago

Downloading epidemics-002 with Version 2.0.2. Works, but some 0 byte files.

danmbox commented 9 years ago

beastman001 -- well, it's on the requests branch that used to have problems and was eventually abandoned. That's why we need to fix the mechanize branch

danmbox commented 9 years ago

OK, for some reason ca9d3b35777534774a9777ad0fbc32e8b699da3d (2.0.2 on master) works, but ac0c411a69ebea3ffb26944b23c5a92718921007 (2.0.2 on the mechanize branch) doesn't. There's an extra 'csrftoken:' header, but even if I add that, it still doesn't work. The actual failure is that the second request returns a "400 Bad Request" error (which is not caught immediately).

danmbox commented 9 years ago

I've created a pull request for mechanize (#166). Seems to solve the issue.