dmotitsk / coursera

Coursera materials downloader.
58 stars 20 forks source link

Won't authenticate. #9

Open henshinger opened 11 years ago

henshinger commented 11 years ago

When I try to download any file from Coursera, I get this:

Traceback (most recent call last):
  File "coursera.py", line 315, in <module>
    main()
  File "coursera.py", line 310, in main
    dl.authenticate()
  File "coursera.py", line 64, in authenticate
    self.br.form = self.br.forms().next()
StopIteration

There are people who have already solved the problem for their coursera downloaders, but this is my favorite coursera downloader.

This is what others have done to fix the problem https://gist.github.com/jetume/ac8142f104c8ae70b485 https://github.com/jplehmann/coursera/commit/6e2725edf9e5c5be88ed5a95c84f6834ada012a0

Please fix the problem. I think your coursera downloader is the best.

Thanks

ghost commented 11 years ago

Hello, I've the same problem, and some of my courses are close to close. Thank you in advance. As @henshinger I think this is the best script to download coursera materials. Thank you again.

dmotitsk commented 11 years ago

Hello, thank you for your positive feedback. I fixed the problem. Please test the script and let me know if it still has problems.

henshinger commented 11 years ago

Thanks man. I don't know why this isn't the most popular Coursera downloader. This one's easier to use and has all the necessary features.

henshinger commented 11 years ago

@amvargash Could you show me the exact command you typed? It's working for me.

henshinger commented 11 years ago

try switching to -l info instead of -v

I think they do the same thing but I use -l info. Haven't checked the source code. but try it out.

henshinger commented 11 years ago

try adding -p 1 -t movie srt Yeah, this is pretty much hackish at this point, but I basically go with

python coursera.py strategy101-001 -e -l info -p 3 -t movie srt

and variations of it with other courses. I'm using Python 2.7. You're probably 2.7, but just to be safe, what Python version are you using?

henshinger commented 11 years ago

Sorry I couldn't help out, but this probably is a different issue since it did successfully authenticate.

mkazin commented 11 years ago

@amvargash : I noticed this issue as well. I got it work for me by using this command: ./coursera.py -l info -v calcsing-2012-001 Please tell us if this gets it working for you as well. (I'm using Python 2.7.3 as well).

@henshinger : As you can see, this command is quite non-sensical and "should not work". I spent a few minutes looking into the matter, finding out that get_parts() is being fed a logged-out page when I used either " -v " or " -l info " (and thus will return empty lists for parts and part_titles). I've got a job interview today and cannot spend any more time until after then. I hope this helps you figure it out in the mean time.

henshinger commented 11 years ago

@mkazin Thanks for the help and good luck on your job interview. I'm probably lucky today, but I could probably use your fix if I get the error.

dmotitsk commented 11 years ago

@amvargash: Do you use Windows? I dont' think that the command line affects this bug. It seems like that after authenticating script gets page with no downloadable materials (it can be some intermidiate login page). Can you launch script with '-l debug'? It should show you CSRF token and session ID.

ghost commented 11 years ago

@dmotitsk: I don't, I'm working on GNU/Linux terminal behind an http-proxy (it does not block coursera) but previous version worked fine, output of the given command was:

CSRF token: fQyeTyfcZ3WBhyRNG3P4
session: None
successfully authenticated

Thank you!

dmotitsk commented 11 years ago

I was out of city for some time. Currently I'm very busy with my work, so I can't say when I fix this completely. As I see for some reason you don't get session ID in cookies. It will be very helpfull if you add instead of 73 line something like this:

page = self.br.open(self.class_login_url) print page.read()

and attach printed html code to this issue.

Thank you.