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

HTTPError: 400 Client Error: Bad Request for url: https://api.coursera.org/api/login/v3 #702

Closed
aakuptsov opened this issue Jan 29, 2019 · 317 comments

Comments

@aakuptsov
Copy link

aakuptsov commented Jan 29, 2019

🚨Please review the Troubleshooting section
before reporting any issue. Don't forget to check also the current issues to
avoid duplicates.

Subject of the issue

Describe your issue here.

Your environment

  • Mac OS X El Capitan:
  • Aleksandrs-Air:~ alekscooper$ python --version Python 2.7.10
  • coursera-dl version: 0.11.4

Steps to reproduce

  • I created a coursera_dl folder on my Desktop

  • I created coursera-dl.conf file in that folder as required

  • My email contains only letters and a dot, it's a gmail.com account

  • My password has only letters and numbers

  • Is the problem happening with the latest version of the script?
    YES

  • Do you have all the recommended versions of the modules? See them in the
    file requirements.txt.
    YES

  • What is the course that you are trying to access?
    understanding-visualization-data
    https://www.coursera.org/learn/understanding-visualization-data/home/welcome

  • What is the precise command line that you are using (don't forget to obfuscate
    your username and password, but leave all other information untouched).
    coursera-dl understanding-visualization-data

  • What are the precise messages that you get? Please, use the --debug
    option before posting the messages as a bug report. Please, copy and paste
    them. Don't reword/paraphrase the messages.

Expected behaviour

The download should begin

Actual behaviour

coursera_dl version 0.11.4
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/coursera/cookies.py", line 148, in login
r.raise_for_status()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/requests/models.py", line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://api.coursera.org/api/login/v3

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/bin/coursera-dl", line 10, in
sys.exit(main())
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/coursera/coursera_dl.py", line 236, in main
login(session, args.username, args.password)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/coursera/cookies.py", line 155, in login
raise AuthenticationFailed('Cannot login on coursera.org: %s' % e)
coursera.cookies.AuthenticationFailed: Cannot login on coursera.org: 400 Client Error: Bad Request for url: https://api.coursera.org/api/login/v3

@gerardbm
Copy link

I'm having the same issue, under Debian Stretch. I tried it with Python and Python 3, also using virtualenv. This is my debug output:

root[main] coursera_dl version 0.11.4
root[login] Initiating login.
root[login] There were no .coursera.org cookies to be cleared.
root[prepare_auth_headers] Forging cookie header: csrftoken=gwmnfU8DnVU4m1E2826Y; csrf2_token_eFgrbWSs=Sq8pMzkAOb2UieomDekRLit8.
urllib3.connectionpool[_new_conn] Starting new HTTPS connection (1): api.coursera.org
urllib3.connectionpool[_make_request] https://api.coursera.org:443 "POST /api/login/v3 HTTP/1.1" 400 None
Traceback (most recent call last):
File "/home/gerard/.local/lib/python3.5/site-packages/coursera/cookies.py", line 148, in login
r.raise_for_status()
File "/home/gerard/.local/lib/python3.5/site-packages/requests/models.py", line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://api.coursera.org/api/login/v3

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/gerard/.local/bin/coursera-dl", line 11, in
sys.exit(main())
File "/home/gerard/.local/lib/python3.5/site-packages/coursera/coursera_dl.py", line 236, in main
login(session, args.username, args.password)
File "/home/gerard/.local/lib/python3.5/site-packages/coursera/cookies.py", line 155, in login
raise AuthenticationFailed('Cannot login on coursera.org: %s' % e)
coursera.cookies.AuthenticationFailed: Cannot login on coursera.org: 400 Client Error: Bad Request for url: https://api.coursera.org/api/login/v3
(my-coursera)

It worked some months ago. I had the version 0.9.0, so I checked if it works by upgrading to the new version 0.11.4.

@aakuptsov
Copy link
Author

Yep, tried virtualenv with Python 3 - doesn't work either.

@aakuptsov
Copy link
Author

Something tells me that Coursera has terminated the access to its resources via the API.

@gerardbm
Copy link

Now it's working! I'm using the same command I used last days:

coursera-dl -u xxx@xxx -p xxx unix

I also had problems trying to loggin in the website, using the new formulary, from several browsers, several OS... Even I reset my password several times, until I could join using the loggin button from this URL (https://learner.coursera.help/hc/en-us), being that enough to start the session for the whole site.

@aakuptsov, try now if it works for you, as well.

@Isaac-the-Man
Copy link

I encounter the same problem too, on Window10 using python 3.6. I checked everything in the requirements.txt
I did the exact same the document says:
coursera-dl -u myName@gmail.com -p XXXX MyClassName
I also tried to wrap my username and password in double quotes, but that doesn't work for me too.

@aakuptsov
Copy link
Author

@gerardbm
It worked!!! You're amazing! Thank you for your advice!

@aakuptsov
Copy link
Author

@Isaac-the-Man

@gerardbm 's advice helped me: log in at https://learner.coursera.help/hc/en-us, wait for a minute (that was my case, at least) and after that try to run coursera-dl. I'm writing that comment now while one of the courses I need is downloading.

@pavelpy
Copy link

pavelpy commented Feb 1, 2019

@aakuptsov
This method is currently not working.

@avidLearnerInProgress
Copy link

This method isn't working. Kindly suggest new one.
I am facing the following error:

$ coursera-dl -u XXX -p XXX cloud-computing
coursera_dl version 0.11.4
... logs ...
coursera.cookies.AuthenticationFailed: Cannot login on coursera.org: 400 Client Error: Bad Request for url: https://api.coursera.org/api/login/v3

Tried changing the password; yet its failing

@gerardbm
Copy link

gerardbm commented Feb 1, 2019

Well, to be honest it was not a method to fix it. It only was a description of a Coursera behaviour related with this. I explained that to suggest that the problem is not about coursera-dl, but coursera.org.

It worked yesterday because 'correlation does not imply causation'. It was only a coincidence...

At this moment, downloads are not working, again. Coursera-dl has not changed, and I'm using the same installation, so clearly the problem comes from coursera.org.

There's no solutions for that. Just wait and keep trying until it works.

@Isaac-the-Man
Copy link

@aakuptsov thanks for helping
However I am still facing this issue. I tried logging in and I waited a few minutes, but still nothing really changed. I guess it is has something to do with the coursera api.

@Isaac-the-Man
Copy link

@aakuptsov, @gerardbm thanks for helping it worked! Just have to log in with the link you provided. However, for me it takes about 10 minutes for it to work. Thanks anyway.

@Isaac-the-Man
Copy link

For anyone looking for help I want to point out that after logging in with (https://learner.coursera.help/hc/en-us), you must wait for a few minute than just keep trying. By keep trying I mean spamming your command over and over again and it will somehow work (at least it works for me, I need to retry the command about 10 times before it will work).

@Isaac-the-Man
Copy link

One more important thing I notice - you cannot open your browser to coursera while downloading. I closed all my coursera tabs and run the script then it works.

@aakuptsov
Copy link
Author

I had this page https://learner.coursera.help/hc/en-us) open, I guess. Not sure about other Coursera pages.

@gerardbm
Copy link

gerardbm commented Feb 1, 2019

For anyone looking for help I want to point out that after logging in with (https://learner.coursera.help/hc/en-us), you must wait for a few minute than just keep trying. By keep trying I mean spamming your command over and over again and it will somehow work (at least it works for me, I need to retry the command about 10 times before it will work).

That's what I did now and it worked after 8 attempts. It looks like the problem is on the server.

@aakuptsov
Copy link
Author

At the end of the day I managed to download 2 courses that I needed. I'm gonna check later on if others that I might need can be downloaded through coursera-dl. But since yes, we all managed to download something, the problem is on the server. I wonder what that is and why the Coursera team either not deny access completely or fix that.

@m3r3lin
Copy link

m3r3lin commented Feb 1, 2019

I'm having the same issue

@glglgithub
Copy link

amazing! it indeed works! thanks @gerardbm

@dhruvil009
Copy link

screenshot 66
Look at the top of the image. Coursera learners are currently experiencing trouble resetting passwords and logging in. In order to login you must follow the Captcha

Taken on February 4th 2019

@aakuptsov
Copy link
Author

screenshot 66
Look at the top of the image. Coursera learners are currently experiencing trouble resetting passwords and logging in. In order to login you must follow the Captcha

Taken on February 4th 2019

I saw that too. Do you think coursera-dl will work properly as soon as Coursera fixes that?

@khtang
Copy link

khtang commented Feb 5, 2019

I tried 18 login attempts before the download started... I imagine all these retries from automated tools must be taking a toll on coursera's current login issue.

@anim070
Copy link

anim070 commented Feb 5, 2019

I think its Coursera Server Issue, i tried around 10 times then is worked!!

@ryanshrott
Copy link

@anim070 @gerardbm Tried like 50 times, no luck. Any other suggestion?

@fredharvey
Copy link

fredharvey commented Feb 5, 2019

I am also experiencing this issue but despite many retries, its not working.

I have looked at the Coursera support page that others (above) have mentioned. https://learner.coursera.help/hc/en-us

I would suggest that the message across the top of the page is rather important and provides some clue that the devs need to follow up on:

"Coursera learners are currently experiencing trouble resetting passwords and logging in. In order to login you must follow the Captcha."

  • what Captcha? I never see a captcha when I login?
  • is something automatically providing a captcha when the Coursera login servers suspect the client is an automated client and because the coursera-dl code doesn't know about the captcha it does some action and Coursera fails the login? (in order to thwart automated downloads).
  • Why would they put up a message about a captcha unless they sometimes use a captcha to prevent automated agents?

Hypothesis: Coursera has code that tries to detect automated agents and challenges them with a captcha. Humans don't typically see it but the support message is indicating that some people do and just need to use the captcha to prove they're human. Some people using Coursera-DL are able to get past the captcha trap with repeated attempts as the "automated agent detection" code by coursera is not fool proof.

@devs please help us. This isn't working. Can someone look into this?

[Update]
Ok, confirmed they are using a captcha. I logged in once and didn't get it. Immediately, logged out and tried to log back in and got prompted with captcha. From the login page.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

So how should the coursera-dl code handle this?

@constantlycoding
Copy link

constantlycoding commented Feb 8, 2019

If you don't mind a bit of hacking...

Login to Coursera once through the browser.

Find your installed coursera-dl site package (how?).

Modify login function in cookie.py (where?) to the following:

def login(session, username, password, class_name=None):
    session.cookies.set('CAUTH', '[YOUR CAUTH COOKIE VALUE]')

Please google how to inspect cookie values for your browser. You may get some clues here.

Run coursera-dl as per usual.

Do note that cookies expire, though it's quite long in this particular cookie's case. In case it does, do login through the browser again to get a new cookie.

@jethar
Copy link

jethar commented Feb 8, 2019

Tried to change the cookie parameter as above. Has the AUTH_URL_V3 changed to https://www.coursera.org/api/login/v3Ssr

That is teh URl I see when inspecting in chrome.

Also the cookies does not seem to contain CAUTH token anymore. I am seeing cookies as follows -

.coursera.org	TRUE	/	FALSE	1577184225	__204u	6483959990-1545648225168
.coursera.org	TRUE	/	FALSE	1577184224	__204r	
.coursera.org	TRUE	/	FALSE	1612670150	_ga	GA1.2.1508189878.1545648226
.coursera.org	TRUE	/	FALSE	1609961325	_mkto_trk	id:111-YYW-222&token:_mch-coursera.org-1546889325443-34327
.coursera.org	TRUE	/	FALSE	253402300799	fs_uid	rs.fullstory.com`ARGC0`6387814767263744:5733935958982656`1146778`
.coursera.org	TRUE	/	FALSE	1557374150	_fbp	fb.1.1549341292542.1043966928
www.coursera.org	FALSE	/	FALSE	0	login-email	xyz%40gmail.com
.coursera.org	TRUE	/	FALSE	1549684550	_gid	GA1.2.147466898.1549598139
.coursera.org	TRUE	/	FALSE	1550462149	CSRF3-Token	1550462148.wkWsLZMwY1eEu9on
www.coursera.org	FALSE	/	FALSE	1612670150	_tq_id.TV-63455409-1.39ed	808689be51a2aaa0.1545648227.0.1549598150..
.coursera.org	TRUE	/	FALSE	1581134150	stc113717	env:1549598139%7C20190311035539%7C20190208042550%7C2%7C1030880:20200208035550|uid:1545648226266.1919507745.809906.113717.1351407438.:20200208035550|srchist:1030880%3A1546923002%3A20190208045002%7C1030879%3A1547182945%3A20190211050225%7C1030880%3A1548607666%3A20190227164746%7C1030875%3A1548956786%3A20190303174626%7C1030876%3A1549351399%3A20190308072319%7C1030881%3A1549351950%3A20190308073230%7C1030880%3A1549598139%3A20190311035539:20200208035550|tsa:1549598139841.1111398437.5453572.41716149070290465:20190208042550

@bv9900
Copy link

bv9900 commented Feb 9, 2019

Hey all, just found coursera-dl and was surprised to see it failing. Ended up here; tried @Isaac-the-Man , @dhruvil009 , @constantlycoding , and @jethar 's solutions. None seem to work, but I'll continue poking around. Probably the same as all of you, I have all of the requirements, the correct interpreter, etc. Working on it, but would like to stay posted on this. On Debian 9, newest version.

Edit: After clearing my cookies and re-signing in, I do see the CAUTH token. Long string of alphanumeric characters, not much use for me to put it- but at least it reappears for me.

Edit 2: Interesting. Pulled a Windows user trick and repeatedly banged in the command. Got this on the ~7th try:
main@maincomp:~$ coursera-dl -u XXX@XXX -p XXX unix coursera_dl version 0.11.4 Logged in on coursera.org. Downloading class: unix (1 / 1) Parsing syllabus of on-demand course (id=d7GXFfqfEeadFw6-eqmrIg). This may take some time, please be patient ... Error 403 Client Error: Forbidden for url: https://api.coursera.org/api/memberships.v1?includes=courseId,courses.v1&q=me&showHidden=true&filter=current,preEnrolled getting page https://api.coursera.org/api/memberships.v1?includes=courseId,courses.v1&q=me&showHidden=true&filter=current,preEnrolled The server replied: {"errorCode":"Not Authorized","message":null,"details":null} HTTPError 403 Client Error: Forbidden for url: https://api.coursera.org/api/memberships.v1?includes=courseId,courses.v1&q=me&showHidden=true&filter=current,preEnrolled

Anyone have any ideas? It logged in, so it might be server weight.

@mkstayalive
Copy link

mkstayalive commented Oct 8, 2020

It works with CAUTH parameter which you can get from cookies by logging into Coursera via browser. There is no need of passing username and password to the command via this method.

coursera-dl -ca 'some-ca-value-from-browser' modelthinking-004

How to get CAUTH cookie value in Chrome: Inspect > Application > Cookies

@rayryeng
Copy link

Getting the CAUTH parameter from my cookies worked for me. The user+password combination doesn't work for me and it gives the HTTPError 400 Client error. Thanks!

@Luciano-Delaude
Copy link

I tried with CAUTH and it didnt worked, someone else has this problem?

@cahyoardhi
Copy link

I tried with CAUTH and it didnt worked, someone else has this problem?

i got that problem too, and it was fixed...
the problem was i'm install coursera-dl on conda (i think the conda version for now have some bug), i uninstall coursera-dl on conda and install it using pip, maybe you can try that

@Luciano-Delaude
Copy link

I tried with CAUTH and it didnt worked, someone else has this problem?

i got that problem too, and it was fixed...
the problem was i'm install coursera-dl on conda (i think the conda version for now have some bug), i uninstall coursera-dl on conda and install it using pip, maybe you can try that

Thanks for the reply! I tried that because I also was using conda but it didnt worked, it wont let me log into coursera, don't know why

@nikhil-redij-pcln
Copy link

Instead of export all cookies you can copy only one value:

  1. login coursera from your browser
  2. copy CAUTH value from your cookies list. For chrome on the tab with coursera open developer tools -> application -> cookies -> https://www.coursera.org -> CAUTH
  3. coursera-dl -ca 'cauth-value-copied-from-browser' modelthinking-004

source: https://github.com/vstrizhenok/coursera-dl

I was having similar issue which was posted in #702. But this solved it :). Thank you

@rohankumar1999
Copy link

great! this works! just login into [https://learner.coursera.help/hc/en-us] and wait for a couple of minutes(I had to wait 10mins) and then later try the command..happy learning!

@nkxy007
Copy link

nkxy007 commented Dec 15, 2020

Create a file coursera-dl.conf in the same directory of the coursera-dl with the text below:
--username <email_here>
--password <passwd_here>
--subtitle-language en
--cauth

cauth value will be available only if you login to coursera and then check in cookies.
cauth value changes time to time, update it if errors occure.
You may check the following video:
https://youtu.be/xpy0H4T9zHU

best answer. it worked for me.

@emddarn
Copy link

emddarn commented Dec 22, 2020

Create a file coursera-dl.conf in the same directory of the coursera-dl with the text below:
--username <email_here>
--password <passwd_here>
--subtitle-language en
--cauth
cauth value will be available only if you login to coursera and then check in cookies.
cauth value changes time to time, update it if errors occure.
You may check the following video:
https://youtu.be/xpy0H4T9zHU

best answer. it worked for me.

it works

@raffaem
Copy link

raffaem commented Dec 22, 2020

Create a file coursera-dl.conf in the same directory of the coursera-dl with the text below:
--username <email_here>
--password <passwd_here>
--subtitle-language en
--cauth
cauth value will be available only if you login to coursera and then check in cookies.
cauth value changes time to time, update it if errors occure.
You may check the following video:
https://youtu.be/xpy0H4T9zHU

best answer. it worked for me.

it works

You don't need to set username and password in the config file if you have the cauth parameter

@themrcesi
Copy link

Okay, so at the beginning it didn´t work for me. I was taking the CAUTH value directly from Chrome settings. However I tried this other approach to get the CAUTH value.

  1. I downloaded the cookies.txt once I logged in Coursera using this extension of Chrome.
  2. I check in that file the CAUTH value.
  3. I used coursera-dl -ca <CAUTH_value_of_downloaded_file> <name_of_the_course>

Hope it helps somebody! 😄

@armanism24
Copy link

Following worked for me:
use edge browser, open coursera and login. Now press F12, go on network tab, now press F5(refresh), click on coursera.org, on right side, from tabs choose cookies.
Now look for CAUTH cookie,
Copy its value. (chrome does not allow to copy the value, edge allows till writing of this post).
run command:
coursera-dl -u xxxxx@xxxxxxx -p xxxxxxxxxx --cauth ccccccccccccc course-name
here ccccccccc is the cauth cookie. Take a note that there is double -- before cauth.
Happy learning:)

@jarrettyeo hooorayyy this one did it! it was easy thanks a lot
(06/02/2020)

Hey. Thanks a lot bro. After 3 days of searching on the internet, finally found a working solution 😄
Tried using Mozilla Firefox (CAUTH values are in Storage section in Developer tools (F12) for Firefox) and it worked.

Note: If your cookie value obtained begins with a "-" (hyphen), try obtaining another one, by re-login; because that will create errors (happend to me initially)

awesome worked for me

@gowthammani
Copy link

The cauth method works. The auth value can be copied from the chrome developer options itself.

  1. Goto coursera site and login first,
  2. Then right click and select inspect option
  3. Click on the Application, select 'Cookies' under the 'Storage' option, and select the coursera url
  4. you can search for auth cookie and click on it once you find it.
  5. you can the content which is shown once you click on the cookie.

@SG75
Copy link

SG75 commented Feb 20, 2021

I used the --cauth method

the download seems to start but soon I see the below error, any help is appreciated

Unsupported typename "discussionPrompt" in lecture "meet-greet" (lecture id "pPew6")
Processing section application-programming-interfaces-apis
Processing lecture module-1-introduction (supplement)
Processing lecture discussion-prompt (discussionPrompt)
Unsupported typename "discussionPrompt" in lecture "discussion-prompt" (lecture id "pFl70")
Processing lecture built-in-libraries-vs-external-libraries (supplement)
Traceback (most recent call last):
File "d:\python\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "d:\python\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "D:\python\Scripts\coursera-dl.exe_main
.py", line 7, in
File "d:\python\lib\site-packages\coursera\coursera_dl.py", line 247, in main
error_occurred, completed = download_class(
File "d:\python\lib\site-packages\coursera\coursera_dl.py", line 214, in download_class
return download_on_demand_class(session, args, class_name)
File "d:\python\lib\site-packages\coursera\coursera_dl.py", line 134, in download_on_demand_class
error_occurred, modules = extractor.get_modules(
File "d:\python\lib\site-packages\coursera\extractors.py", line 53, in get_modules
error_occurred, modules = self._parse_on_demand_syllabus(
File "d:\python\lib\site-packages\coursera\extractors.py", line 161, in _parse_on_demand_syllabus
links = course.extract_links_from_supplement(
File "d:\python\lib\site-packages\coursera\api.py", line 1268, in extract_links_from_supplement
supplement_content, self._extract_links_from_text(value))
File "d:\python\lib\site-packages\coursera\api.py", line 1518, in _extract_links_from_text
supplement_links = self._extract_links_from_a_tags_in_text(text)
File "d:\python\lib\site-packages\coursera\api.py", line 1597, in _extract_links_from_a_tags_in_text
extension = clean_filename(
File "d:\python\lib\site-packages\coursera\utils.py", line 118, in clean_filename
s = h.unescape(s)
AttributeError: 'HTMLParser' object has no attribute 'unescape'

@ZXSwire3
Copy link

@SG75
I was having the same issue but I fixed it by using this #778 (comment)
hope it helps you :)

@axelock
Copy link

axelock commented Mar 16, 2021

I used the AUTH method too:

  1. Login to coursera.org
  2. Go to Chrome / Settings / Cookies / coursera.org
  3. Find CAUTH cookie, copy the ugly-long value: hAMlatdpEel2Bd5DtUKfKy8Xlzxd0xgH-KrN.......du3hQMQ4aFLComrM9lCUfJY5poFiJho1RM94fPVoNMvlNWex_A-lwt7NwZ-1MA
  4. Use this in command line:
    coursera-dl -ca "hAMlatdpEel2Bd5DtUKfKy8Xlzxd0xgH-KrN.......du3hQMQ4aFLComrM9lCUfJY5poFiJho1RM94fPVoNMvlNWex_A-lwt7NwZ-1MA" python
    :)

BTW, I think our nice python program should handle the
"HTTPError: 400 Client Error: Bad Request for url: https://api.coursera.org/api/login/v3"
error as a simple authentication error, and it would be nice if the program itself would
suggest some other authentication methods.

Then it will make less confused and more satisfied users... :>

Anyway, thank you for this great tool!

@abdoaboganima
Copy link

abdoaboganima commented Apr 12, 2021

If you are using chrome just press this link chrome://settings/cookies/detail?site=coursera.org, open the CAUTH field, copy it then paste it after -ca argument

$coursera-dl -u <your-email> -p <your-password> <course name> -ca NtSNWJTmbbO0jdVuLtjF1WIFnBtpFE9nj7-vG6Nrsm6WpnwgeX0TO1YC2NRBpDwmoHCg6ip5H9RONRMLvj-v6g.9GPRA6YiOyGD3QKL2GMOBA.1wpKC3vCl1UUocFkGwPZKhAaV9U_Sop7gNGKdOhw06Eif1VwFBUuF5RshKWhLKlgOxzdNXDAmFsZBuhGOwBkDKQUpa7KWgmR7DPqYVcAICYO8fcq9SkhwF2yn6IJRN7kNBL3QheqP7Vl_nF-J4xIbxsFljsnc7OZyEZ4QbnJ6XpoMioI4nLiFpfyUgxKaM_j

@sghinescu
Copy link

On Windows 10, just upgraded coursera-dl, didn't work previous version same error and:

G:\Coursera>coursera-dl -u xyz@gmail.com -ca mgmc6yheYS9ZFlQbLKyTMWvk8vWDsDFRbHFLaB99LEyVuy8WnUco0CJA4MnC3mJixeZ5ZlRE1utwX_hp7NVXg.kKLS5wYyFf-48BljvqWLJQ.4fIyXL41zYfOvJkjncG7m04zUmrwrFMGI5dACx8zTDrb76gIWiVz_KqvpA3TdQGnUMBuh7mZN2ETlgrL8zIC21CWauKA5JHrl9cLfD93i5Ob5xaNS3lPSOLXrgBpKw_b8aIhK-44B5oqNkAhQ6mxsTTaN_qTdNQrkGNQC4TuwTD5O7DcIdz2C2WseHGtdmgsN6rGAnwGbjaJ564EVQfl-P6KQoeMIXpXH2jju2JHfp0hlH85yqNCvQIoId_OS9mM-KwcrgHUl4A1Gl2oAuxTF1wh4g2qY13xaXZUo31M0MCusUX-SAfcFYdwGgFB-AIkxOicgYRxj-Qitkrp1ZIhc4-08NyyWSIngmHGS1EWE0o6bW2Mepjc7iirmziLPemtNyR9qhU7mYGPB2xajRMujiCV7jBuFgxZ8HKAV0j89Zo --list-courses
coursera_dl version 0.11.5
Listing enrolled courses
Traceback (most recent call last):
File "c:\python27\lib\runpy.py", line 174, in _run_module_as_main
"main", fname, loader, pkg_name)
File "c:\python27\lib\runpy.py", line 72, in run_code
exec code in run_globals
File "C:\Python27\Scripts\coursera-dl.exe_main
.py", line 7, in
File "c:\python27\lib\site-packages\coursera\coursera_dl.py", line 232, in main
list_courses(args)
File "c:\python27\lib\site-packages\coursera\coursera_dl.py", line 108, in list_courses
login(session, args.username, args.password)
File "c:\python27\lib\site-packages\coursera\cookies.py", line 155, in login
raise AuthenticationFailed('Cannot login on coursera.org: %s' % e)
coursera.cookies.AuthenticationFailed: Cannot login on coursera.org: 400 Client Error: Bad Request for url: https://api.coursera.org/api/login/v3

@ghost
Copy link

ghost commented Jun 2, 2021

Hello,

Same issue on Debian Buster (python 3.7) with a fresh install of coursera-dl.

I tried the two methods for downloading which raised two distinct exceptions:

After the command with -ca option, I am logged out from Coursera.

NOTE: I also tried to put the certificate in my coursera-dl.conf file instead of the -ca option but it still did not work (403 Client Error + logout from Coursera).

Regards,

@hasnain-ahmad
Copy link

Create a file coursera-dl.conf in the same directory of the coursera-dl with the text below:
--username <email_here>
--password <passwd_here>
--subtitle-language en
--cauth

cauth value will be available only if you login to coursera and then check in cookies.
cauth value changes time to time, update it if errors occure.
You may check the following video:
https://youtu.be/xpy0H4T9zHU

Thanks Its works for me.

@olawalejuwonm
Copy link

If you are using chrome just press this link chrome://settings/cookies/detail?site=coursera.org, open the CAUTH field, copy it then paste it after -ca argument

$coursera-dl -u <your-email> -p <your-password> <course name> -ca NtSNWJTmbbO0jdVuLtjF1WIFnBtpFE9nj7-vG6Nrsm6WpnwgeX0TO1YC2NRBpDwmoHCg6ip5H9RONRMLvj-v6g.9GPRA6YiOyGD3QKL2GMOBA.1wpKC3vCl1UUocFkGwPZKhAaV9U_Sop7gNGKdOhw06Eif1VwFBUuF5RshKWhLKlgOxzdNXDAmFsZBuhGOwBkDKQUpa7KWgmR7DPqYVcAICYO8fcq9SkhwF2yn6IJRN7kNBL3QheqP7Vl_nF-J4xIbxsFljsnc7OZyEZ4QbnJ6XpoMioI4nLiFpfyUgxKaM_j

Thanks this works perfectly for me

@gerardbm
Copy link

gerardbm commented Dec 7, 2021

I'm commenting this two years later. Adding the argument --ca worked for me as well. Thanks!

@abdallahbouhannache
Copy link

abdallahbouhannache commented Dec 30, 2021

@gerardbm how does it work for you i just tried it and it didn't work ?
i believe that that coursera changed the api it gives me the same error of 400 bad request

Error 403 Client Error:
Forbidden for url: https://api.coursera.org/api/onDemandCourseMaterials.v2/?q=slug&slug=with&includes=module

@hzlnqodrey
Copy link

If you are using chrome just press this link chrome://settings/cookies/detail?site=coursera.org, open the CAUTH field, copy it then paste it after -ca argument

$coursera-dl -u <your-email> -p <your-password> <course name> -ca NtSNWJTmbbO0jdVuLtjF1WIFnBtpFE9nj7-vG6Nrsm6WpnwgeX0TO1YC2NRBpDwmoHCg6ip5H9RONRMLvj-v6g.9GPRA6YiOyGD3QKL2GMOBA.1wpKC3vCl1UUocFkGwPZKhAaV9U_Sop7gNGKdOhw06Eif1VwFBUuF5RshKWhLKlgOxzdNXDAmFsZBuhGOwBkDKQUpa7KWgmR7DPqYVcAICYO8fcq9SkhwF2yn6IJRN7kNBL3QheqP7Vl_nF-J4xIbxsFljsnc7OZyEZ4QbnJ6XpoMioI4nLiFpfyUgxKaM_j

27th July 2022, This works perfectly fine with me, thank you for the great tools!

@alwayssummer
Copy link

This solution used to work for me on other systems, but of late, my CAUTH cookie value got much larger (~500 characters) and that seems to break argument parsing in the script. I'm using FF on Ubuntu 22.04. Wondering if anyone else is experiencing the same. I've tried to pass both at the command line and also through the coursera.conf file.

When passing through the command line I get:

$ coursera-dl algorithms-part1 --ca my-very-long-token
usage: coursera-dl [-h] [-u USERNAME] [-p PASSWORD] [--jobs JOBS]
                   [...truncated for readability...]
coursera-dl: error: unrecognized arguments: my-very-long-token

@mherrmann
Copy link

I've had no issues with a 558 character CAUTH field on coursera-dl 0.11.5.

@mohassan99
Copy link

mohassan99 commented Dec 13, 2022

I can get to chrome://settings/cookies, but the full path or chrome://settings/cookies/detail dont work for me and I dont see anything site specific at chrome://settings/cookies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests