r0oth3x49 / udemy-dl

A cross-platform python based utility to download courses from udemy for personal offline use.
MIT License
4.85k stars 1.2k forks source link

Udemy Says: 403 Forbidden session cookie seems to be expired... #572

Closed evanpatsou closed 3 years ago

evanpatsou commented 3 years ago

I try to connect using my cookie but it does not work. Even my cookies are about to expire on October 30, I have this error:


[i] : Trying to login using session cookie [-] : Udemy Says: 403 Forbidden session cookie seems to be expired... [i] : Updating session cookie..

Username :


la9una commented 3 years ago

I get the same error. I have used this excellent tool to download my courses for a long time and never had a problem. I always used the cookies method without problem. I disconnect and log in again to get a new cookie, but the problem persists.

Ubuntu 18.04 Python 3.6

Output:

              __                               ____  
   __  ______/ /__  ____ ___  __  __      ____/ / /  
  / / / / __  / _ \/ __ `__ \/ / / /_____/ __  / /   
 / /_/ / /_/ /  __/ / / / / / /_/ /_____/ /_/ / /    
 \__,_/\__,_/\___/_/ /_/ /_/\__, /      \__,_/_/     
                           /____/
                                 Version : 1.0
                                 Author  : Nasir Khan (r0ot h3x49)
                                 Github  : https://github.com/r0oth3x49

[i] : Trying to login using session cookie
[-] : Udemy Says: 403 Forbidden session cookie seems to be expired...
[i] : Updating session cookie..
[i] : Logged in successfully.
[-] : Udemy Says: 403 Forbidden on https://www.udemy.com/api-2.0/users/me/subscribed-courses?fields[course]=id,url,published_title&page=1&page_size=1000&ordering=-last_accessed,-access_time&search=<my_course_url>
Rajssss commented 3 years ago

Same here...

[*] : Trying to login using cookies ... [+] : Logged in successfully. [-] : Udemy Says : 403 Forbidden You should use cookie base method to authenticate or try again in few minutes ...

Tried normal login method too... still not working.

r0oth3x49 commented 3 years ago

checking whats wrong with udemy

coghost commented 3 years ago

I'v encountered the same issue today, and everything works correctly yesterday.

Here are the outputs:

login with -u user -p pwd


              __                               ____
   __  ______/ /__  ____ ___  __  __      ____/ / /
  / / / / __  / _ \/ __ `__ \/ / / /_____/ __  / /
 / /_/ / /_/ /  __/ / / / / / /_/ /_____/ /_/ / /
 \__,_/\__,_/\___/_/ /_/ /_/\__, /      \__,_/_/
                           /____/
                                 Version : 1.0
                                 Author  : Nasir Khan (r0ot h3x49)
                                 Github  : https://github.com/r0oth3x49

[i] : Trying to login as (xxx@xxx.com)
[-] : Udemy Says: 403 Forbidden session cookie seems to be expired...
[i] : Logged in successfully.
[-] : Udemy Says: 403 Forbidden on https://www.udemy.com/api-2.0/users/me/subscribed-courses?fields[course]=id,url,published_title&page=1&page_size=1000&ordering=-last_accessed,-access_time&search=xxx

And login with -k cookie.txt


              __                               ____
   __  ______/ /__  ____ ___  __  __      ____/ / /
  / / / / __  / _ \/ __ `__ \/ / / /_____/ __  / /
 / /_/ / /_/ /  __/ / / / / / /_/ /_____/ /_/ / /
 \__,_/\__,_/\___/_/ /_/ /_/\__, /      \__,_/_/
                           /____/
                                 Version : 1.0
                                 Author  : Nasir Khan (r0ot h3x49)
                                 Github  : https://github.com/r0oth3x49

[i] : Trying to login using session cookie
[-] : Udemy Says: 403 Forbidden session cookie seems to be expired...
[i] : Updating session cookie..
[i] : Logged in successfully.
[-] : Udemy Says: 403 Forbidden on https://www.udemy.com/api-2.0/users/me/subscribed-courses?fields[course]=id,url,published_title&page=1&page_size=1000&ordering=-last_accessed,-access_time&search=xxx
r0oth3x49 commented 3 years ago

Just don't try running the script again and again wait for at least a day to run otherwise udemy will block your account after multiple attempts and you will have to restore it by taking help from udemy support. So wait for at least a good amount of time or a day to re run the script.

Rajssss commented 3 years ago

Just downloaded few courses, working fine now, looks like something was wrong on udemy side, there is no issue with the script I think.

SpecieX commented 3 years ago

I also encountered the same problem yesterday. But it seems that it was in fact a bug on Udemy and not the script itself. Now everything works perfectly as before. Thanks @r0oth3x49

r0oth3x49 commented 3 years ago

Thanks @Rajssss a @SpecieX, You just saved my time, i was amazed what the hack just happened to udemy-dl :P.

The easiest way to avoid this issue would be wait for a while to down a course just don't act like robots. I did tried yesterday downloading/requesting course again & again and end up forcefully resetting my password which is now working fine for me.

Solution for those still facing this issue:

joekendal commented 3 years ago

@r0oth3x49 how long should we wait in between. if using the course list from file option then the script needs editing to wait in between.