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

[Bug]: Udemy Says: 'NoneType' object has no attribute 'json' #82

Closed
MJ-DEV91 opened this issue Dec 16, 2021 · 15 comments
Closed

[Bug]: Udemy Says: 'NoneType' object has no attribute 'json' #82

MJ-DEV91 opened this issue Dec 16, 2021 · 15 comments
Assignees
Labels
bug Something isn't working

Comments

@MJ-DEV91
Copy link

What happened?

I tried to download a course with the below command:
python main.py -c https://www.udemy.com/course/docker-hands-on/learn/ --download-assets --download-captions -b *******************************************************
but I faced this error:

Login Success
> Fetching course information, this may take a minute...
Failed request https://www.udemy.com/api-2.0/users/me/subscribed-courses?fields[course]=id,url,title,published_title&page=1&page_size=500&search=docker-hands-on
403 Forbidden, retrying (attempt 0 )...
Failed request https://www.udemy.com/api-2.0/users/me/subscribed-courses?fields[course]=id,url,title,published_title&page=1&page_size=500&search=docker-hands-on
403 Forbidden, retrying (attempt 1 )...
Failed request https://www.udemy.com/api-2.0/users/me/subscribed-courses?fields[course]=id,url,title,published_title&page=1&page_size=500&search=docker-hands-on
403 Forbidden, retrying (attempt 2 )...
Failed request https://www.udemy.com/api-2.0/users/me/subscribed-courses?fields[course]=id,url,title,published_title&page=1&page_size=500&search=docker-hands-on
403 Forbidden, retrying (attempt 3 )...
Failed request https://www.udemy.com/api-2.0/users/me/subscribed-courses?fields[course]=id,url,title,published_title&page=1&page_size=500&search=docker-hands-on
403 Forbidden, retrying (attempt 4 )...
Failed request https://www.udemy.com/api-2.0/users/me/subscribed-courses?fields[course]=id,url,title,published_title&page=1&page_size=500&search=docker-hands-on
403 Forbidden, retrying (attempt 5 )...
Failed request https://www.udemy.com/api-2.0/users/me/subscribed-courses?fields[course]=id,url,title,published_title&page=1&page_size=500&search=docker-hands-on
403 Forbidden, retrying (attempt 6 )...
Failed request https://www.udemy.com/api-2.0/users/me/subscribed-courses?fields[course]=id,url,title,published_title&page=1&page_size=500&search=docker-hands-on
403 Forbidden, retrying (attempt 7 )...
Failed request https://www.udemy.com/api-2.0/users/me/subscribed-courses?fields[course]=id,url,title,published_title&page=1&page_size=500&search=docker-hands-on
403 Forbidden, retrying (attempt 8 )...
Failed request https://www.udemy.com/api-2.0/users/me/subscribed-courses?fields[course]=id,url,title,published_title&page=1&page_size=500&search=docker-hands-on
403 Forbidden, retrying (attempt 9 )...
Udemy Says: 'NoneType' object has no attribute 'json' on https://www.udemy.com/api-2.0/users/me/subscribed-courses?fields[course]=id,url,title,published_title&page=1&page_size=500&search=docker-hands-on

Expected Result

somehow this problem has a connection with IP address, if I use a VPN, then it works fine and starts downloading (everything is the same, except the IP!)

Branch

master/main

What operating systems are you seeing the problem on?

Windows

Relevant log output

No response

Other information

No response

@MJ-DEV91 MJ-DEV91 added the bug Something isn't working label Dec 16, 2021
@Puyodead1
Copy link
Owner

Are you able to use the udemy website without a vpn?

@MJ-DEV91
Copy link
Author

Yeah, absolutely

@Puyodead1
Copy link
Owner

Yeah, absolutely

still having this problem? I'm not sure what would be causing this issue. Please check that you are using the latest version of the master branch. I would also suggest turning off your VPN, logging out of the Udemy website, logging back in and getting a new bearer token (just in case the other token is tied to your VPN)

@MJ-DEV91
Copy link
Author

I just checked the master branch once again and I got a new token with VPN off, it's still the same.

@Puyodead1
Copy link
Owner

I just checked the master branch once again and I got a new token with VPN off, it's still the same.

Are you signed into the right account when you obtain the bearer token?

@MJ-DEV91
Copy link
Author

I just checked the master branch once again and I got a new token with VPN off, it's still the same.

Are you signed into the right account when you obtain the bearer token?

yeah, believe me, the only difference is using the VPN.

@Puyodead1
Copy link
Owner

I just checked the master branch once again and I got a new token with VPN off, it's still the same.

Are you signed into the right account when you obtain the bearer token?

yeah, believe me, the only difference is using the VPN.

In that case, I have no idea what the issue could be. the only thing i can think of would be something related to geo-location.

@mahdisky
Copy link

i have this problem,
i used the vpn and the no vpn

@Puyodead1
Copy link
Owner

i have this problem, i used the vpn and the no vpn

what version of the tool are you using? python main.py -v

@mahdisky
Copy link

version 1.1.4

@MJ-DEV91
Copy link
Author

MJ-DEV91 commented Dec 28, 2021

In that case, I have no idea what the issue could be. the only thing i can think of would be something related to geo-location.

I'm not sure if it has something to do with that,
this is the error that I'm getting:

[08:38:14] [udemy-downloader] [_get:856] ERROR: 403 Forbidden, retrying (attempt 8 )...
[08:38:14] [udemy-downloader] [_get:855] ERROR: Failed request https://www.udemy.com/api-2.0/users/me/subscribed-courses?fields[course]=id,url,title,published_title&page=1&page_size=500&search=kubernetes-microservices
[08:38:14] [udemy-downloader] [_get:856] ERROR: 403 Forbidden, retrying (attempt 9 )...
[08:38:15] [udemy-downloader] [_subscribed_courses:591] CRITICAL: Udemy Says: 'NoneType' object has no attribute 'json' on https://www.udemy.com/api-2.0/users/me/subscribed-courses?fields[course]=id,url,title,published_title&page=1&page_size=500&search=kubernetes-microservices

so it says forbidden for https://www.udemy.com/api-2.0/users/me/subscribed-courses?fields[course]=id,url,title,published_title&page=1&page_size=500&search=kubernetes-microservices , but when I open this url in the browser (that I retrieved the token from): {"count":1,"next":null,"previous":null,"results":[{"_class":"course","id":1813098,"title":"Kubernetes Hands-On - Deploy Microservices to the AWS Cloud","url":"/course/kubernetes-microservices/learn/","published_title":"kubernetes-microservices"}],"aggregations":null}

@Puyodead1
Copy link
Owner

In that case, I have no idea what the issue could be. the only thing i can think of would be something related to geo-location.

I'm not sure if it has something to do with that, this is the error that I'm getting:

[08:38:14] [udemy-downloader] [_get:856] ERROR: 403 Forbidden, retrying (attempt 8 )...
[08:38:14] [udemy-downloader] [_get:855] ERROR: Failed request https://www.udemy.com/api-2.0/users/me/subscribed-courses?fields[course]=id,url,title,published_title&page=1&page_size=500&search=kubernetes-microservices
[08:38:14] [udemy-downloader] [_get:856] ERROR: 403 Forbidden, retrying (attempt 9 )...
[08:38:15] [udemy-downloader] [_subscribed_courses:591] CRITICAL: Udemy Says: 'NoneType' object has no attribute 'json' on https://www.udemy.com/api-2.0/users/me/subscribed-courses?fields[course]=id,url,title,published_title&page=1&page_size=500&search=kubernetes-microservices

so it says forbidden for https://www.udemy.com/api-2.0/users/me/subscribed-courses?fields[course]=id,url,title,published_title&page=1&page_size=500&search=kubernetes-microservices , but when I open this url in the browser (that I retrieved the token from): {"count":1,"next":null,"previous":null,"results":[{"_class":"course","id":1813098,"title":"Kubernetes Hands-On - Deploy Microservices to the AWS Cloud","url":"/course/kubernetes-microservices/learn/","published_title":"kubernetes-microservices"}],"aggregations":null}

could you send me a bearer token and the course url to test with? either through email puyodead@protonmail.com or discord Puyodead#0001

@Puyodead1
Copy link
Owner

This issue is most likely caused by Cloudflare captchas, currently there's nothing I can do about it, but I am trying a few things.

@Puyodead1
Copy link
Owner

Please see this comment for a solution: #92 (comment)
I'm going to close this issue in favor of #92, feel free to comment there if you have any trouble setting up the new branch

@jaan143
Copy link

jaan143 commented Aug 6, 2022

@Puyodead1 i am getting this issue with latest version
i logout and relogin and got new token and tried but still getting the same error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants