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]: 403 error forbidden #92

Closed
sacsbrainz opened this issue Jan 3, 2022 · 45 comments
Closed

[Bug]: 403 error forbidden #92

sacsbrainz opened this issue Jan 3, 2022 · 45 comments
Assignees
Labels
bug Something isn't working

Comments

@sacsbrainz
Copy link

What happened?

I tried to run your script on my vps but kept getting 403 error

I used exactly same script on my physical machine it worked fine
I copied the folder to my vps am getting error

Am running an Ubuntu 20.04 with any graphical interface

Screenshot_20220103-173714_JuiceSSH

Expected Result

To run without error

Branch

master/main

What operating systems are you seeing the problem on?

Linux/Unix

Relevant log output

No response

Other information

No response

@sacsbrainz sacsbrainz added the bug Something isn't working label Jan 3, 2022
@Puyodead1
Copy link
Owner

Yeah, this is most likely related to CloudFlare captchas. There's nothing I can do right now, but I'm going to be trying a few things. Are you trying to download a course from a subscription plan?

@sacsbrainz
Copy link
Author

Yeah, this is most likely related to CloudFlare captchas. There's nothing I can do right now, but I'm going to be trying a few things. Are you trying to download a course from a subscription plan?

Yes i paid for the course i just need it offline

@Puyodead1
Copy link
Owner

Yeah, this is most likely related to CloudFlare captchas. There's nothing I can do right now, but I'm going to be trying a few things. Are you trying to download a course from a subscription plan?

Yes i paid for the course i just need it offline

No, I mean Udemy Pro/Personal plans

@sacsbrainz
Copy link
Author

Mine is a regular Udemy Marketplace course purchase
I didn't know udemy pro was actually a real thing 😅😅

@sacsbrainz
Copy link
Author

Also on my physical machine the course downloads are not complete some videos still didn't download
Some chapters are empty only the chapter assets where downloaded

@Puyodead1
Copy link
Owner

Also on my physical machine the course downloads are not complete some videos still didn't download Some chapters are empty only the chapter assets where downloaded

I recommend giving the feat-shaka branch a try, it requires shaka-packager and is much more stable for decryption, that might solve the issue with the downloads.

@sacsbrainz
Copy link
Author

Yeah, this is most likely related to CloudFlare captchas. There's nothing I can do right now, but I'm going to be trying a few things. Are you trying to download a course from a subscription plan?

In regards to this try zyte proxy seems to work well witj cloudflare
Also user agent maybe a contributing factor

@sacsbrainz
Copy link
Author

Also on my physical machine the course downloads are not complete some videos still didn't download Some chapters are empty only the chapter assets where downloaded

I recommend giving the feat-shaka branch a try, it requires shaka-packager and is much more stable for decryption, that might solve the issue with the downloads.

Ok will try that now
No need for cookies?

@Puyodead1
Copy link
Owner

Also on my physical machine the course downloads are not complete some videos still didn't download Some chapters are empty only the chapter assets where downloaded

I recommend giving the feat-shaka branch a try, it requires shaka-packager and is much more stable for decryption, that might solve the issue with the downloads.

Ok will try that now No need for cookies?

nope, just the bearer token. cookies are only needed for subscription plans

@sacsbrainz
Copy link
Author

sacsbrainz commented Jan 3, 2022

On the main branch i removed the cookies i parsed and its working fine only that the encrypted files doesn't have visual and audio
Its just spilt into 2 different segments
20220104_004529

Meanwhile the console prints out another error
20220104_003848

@Puyodead1
Copy link
Owner

Puyodead1 commented Jan 3, 2022

On the main branch i removed the cookies i parsed and its working fine only that the encrypted files doesn't have visual and audio Its just spilt into 2 different segments 20220104_004529

Meanwhile the console prints out another error 20220104_003848

you didnt put the key and key id in the keyfile.json or you didnt put it in correctly, it cant decrypt the files since it cant get the key for it

{
"key id goes here": "key goes here"
}

@sacsbrainz
Copy link
Author

sacsbrainz commented Jan 3, 2022

On the main branch i removed the cookies i parsed and its working fine only that the encrypted files doesn't have visual and audio Its just spilt into 2 different segments 20220104_004529
Meanwhile the console prints out another error 20220104_003848

you didnt put the key and key id in the keyfile.json or you didnt put it in correctly, it cant decrypt the files since it cant get the key for it

{
"key id goes here": "key goes here"
}

Sorry that true
I thought i did but turns out i didn't

@Puyodead1
Copy link
Owner

it changes for each course

@sacsbrainz
Copy link
Author

sacsbrainz commented Jan 3, 2022

it changes for each course

So every course has its own different key?

@Puyodead1
Copy link
Owner

it changes for each course

So every course has its own different key?

yes, usually its every video but udemy decided to do every course

@sacsbrainz
Copy link
Author

it changes for each course

So every course has its own different key?

yes, usually its every video but udemy decided to do every course

Ok thanks will generate again thanks

Thank God is it not every video 🤣

@sacsbrainz
Copy link
Author

Its working fine now
Thanks

@Samhunter91
Copy link

Samhunter91 commented Jan 9, 2022

Yeah, this is most likely related to CloudFlare captchas. There's nothing I can do right now, but I'm going to be trying a few things. Are you trying to download a course from a subscription plan?

I am downloading using the personal plan ,is there any work around of this 403 forbidden error?

@Puyodead1
Copy link
Owner

Yeah, this is most likely related to CloudFlare captchas. There's nothing I can do right now, but I'm going to be trying a few things. Are you trying to download a course from a subscription plan?

I am downloading using the personal plan ,is there any work around of this 403 forbidden error?

I'm working on rewriting the way personal plan works that seems to bypass the captchas, but theres nothing that i know of that you can do until i can finish this update. I have to rewrite a good portion of the code to use browser automation

@Samhunter91
Copy link

If you need the personal plan subscription account I can share it with you ,if it helps in the process

@Puyodead1
Copy link
Owner

Puyodead1 commented Jan 9, 2022

If you need the personal plan subscription account I can share it with you ,if it helps in the process

Thank you for the offer, someone else already lent me one :)

I have published an experimental branch that should bypass cloudflare captchas: https://github.com/Puyodead1/udemy-downloader/tree/feat-selenium

There's new requirements so be sure to pip install -r requirements.txt, edit the config.toml file (at least just update the selenium section with username and password), and make sure you have chrome installed. If you have any troubles setting this up, please let me know so I can assist and add better documentation for it

Edit: Forgot to mention you will also need to specify -sc now to tell the program its a subscription based course.

@Samhunter91
Copy link

If you need the personal plan subscription account I can share it with you ,if it helps in the process

Thank you for the offer, someone else already lent me one :)

I have published an experimental branch that should bypass cloudflare captchas: https://github.com/Puyodead1/udemy-downloader/tree/feat-selenium

There's new requirements so be sure to pip install -r requirements.txt, edit the config.toml file (at least just update the selenium section with username and password), and make sure you have chrome installed. If you have any troubles setting this up, please let me know so I can assist and add better documentation for it

Edit: Forgot to mention you will also need to specify -sc now to tell the program its a subscription based course.

Thank you,I will try it today and let you know if I ran into some problem.

@Samhunter91
Copy link

Samhunter91 commented Jan 10, 2022

If you need the personal plan subscription account I can share it with you ,if it helps in the process

Thank you for the offer, someone else already lent me one :)

I have published an experimental branch that should bypass cloudflare captchas: https://github.com/Puyodead1/udemy-downloader/tree/feat-selenium

There's new requirements so be sure to pip install -r requirements.txt, edit the config.toml file (at least just update the selenium section with username and password), and make sure you have chrome installed. If you have any troubles setting this up, please let me know so I can assist and add better documentation for it

Edit: Forgot to mention you will also need to specify -sc now to tell the program its a subscription based course.

I tried it and it works 😍,but I had to add the bearer token , username and password while the time of execution ,adding the bearer token, username and password in config.toml file but while executing it ,it ask again for all this ,it is the only problem I faced but everything is fine .

Edit
Sorry,it was my fault
I haven't removed the # from bearer token, username and password

@Samhunter91
Copy link

Samhunter91 commented Jan 10, 2022

If you need the personal plan subscription account I can share it with you ,if it helps in the process

Thank you for the offer, someone else already lent me one :)

I have published an experimental branch that should bypass cloudflare captchas: https://github.com/Puyodead1/udemy-downloader/tree/feat-selenium

There's new requirements so be sure to pip install -r requirements.txt, edit the config.toml file (at least just update the selenium section with username and password), and make sure you have chrome installed. If you have any troubles setting this up, please let me know so I can assist and add better documentation for it

Edit: Forgot to mention you will also need to specify -sc now to tell the program its a subscription based course.

And yes The captions are also not downloading ,assets are downloading fine but captions are not downloading
I have added --download-captions

Edit
One of the video and audio file was encrypted other one were fine .

@Samhunter91
Copy link

If you need the personal plan subscription account I can share it with you ,if it helps in the process

Thank you for the offer, someone else already lent me one :)

I have published an experimental branch that should bypass cloudflare captchas: https://github.com/Puyodead1/udemy-downloader/tree/feat-selenium

There's new requirements so be sure to pip install -r requirements.txt, edit the config.toml file (at least just update the selenium section with username and password), and make sure you have chrome installed. If you have any troubles setting this up, please let me know so I can assist and add better documentation for it

Edit: Forgot to mention you will also need to specify -sc now to tell the program its a subscription based course.

Everything is working fine but the captions are still not working I had disabled the download-captions and download-assets and keep-vtt by including # infront of them ,I simply use main.py -c 'courselink' -sc --download-captions --download-assets but still captions are not downloading and assets are downloading fine ,
It is some problem with the captions
I hope you will fix this

@Puyodead1
Copy link
Owner

If you need the personal plan subscription account I can share it with you ,if it helps in the process

Thank you for the offer, someone else already lent me one :)
I have published an experimental branch that should bypass cloudflare captchas: https://github.com/Puyodead1/udemy-downloader/tree/feat-selenium
There's new requirements so be sure to pip install -r requirements.txt, edit the config.toml file (at least just update the selenium section with username and password), and make sure you have chrome installed. If you have any troubles setting this up, please let me know so I can assist and add better documentation for it
Edit: Forgot to mention you will also need to specify -sc now to tell the program its a subscription based course.

Everything is working fine but the captions are still not working I had disabled the download-captions and download-assets and keep-vtt by including # infront of them ,I simply use main.py -c 'courselink' -sc --download-captions --download-assets but still captions are not downloading and assets are downloading fine , It is some problem with the captions I hope you will fix this

I just updated the selenium branch to include the fix for this from master

@Samhunter91
Copy link

If you need the personal plan subscription account I can share it with you ,if it helps in the process

Thank you for the offer, someone else already lent me one :)
I have published an experimental branch that should bypass cloudflare captchas: https://github.com/Puyodead1/udemy-downloader/tree/feat-selenium
There's new requirements so be sure to pip install -r requirements.txt, edit the config.toml file (at least just update the selenium section with username and password), and make sure you have chrome installed. If you have any troubles setting this up, please let me know so I can assist and add better documentation for it
Edit: Forgot to mention you will also need to specify -sc now to tell the program its a subscription based course.

Everything is working fine but the captions are still not working I had disabled the download-captions and download-assets and keep-vtt by including # infront of them ,I simply use main.py -c 'courselink' -sc --download-captions --download-assets but still captions are not downloading and assets are downloading fine , It is some problem with the captions I hope you will fix this

I just updated the selenium branch to include the fix for this from master

Screenshot 2022-01-10 191200
Screenshot 2022-01-10 191313

I am getting this error now
I have already installed the requirements.txt modules

@Puyodead1
Copy link
Owner

I'm going to assume this is because the course is "large", which i haven't implement support for yet. Do you know how many hours the course is?

@Samhunter91
Copy link

I'm going to assume this is because the course is "large", which i haven't implement support for yet. Do you know how many hours the course is?

It is 2.5 hours course ,name of the course is How to Draw Cute Cartoon Characters.

@Puyodead1
Copy link
Owner

Ah, I see the issue. There's an invalid utf-8 character. I'll have to add sanitation to the strings.
Somewhere on the page, there's a (Double Left Quotation Mark) which is an invalid utf-8 character compared to "

@Samhunter91
Copy link

Ah, I see the issue. There's an invalid utf-8 character. I'll have to add sanitation to the strings. Somewhere on the page, there's a (Double Left Quotation Mark) which is an invalid utf-8 character compared to "

So ,have you fixed this issue?

@Puyodead1
Copy link
Owner

Ah, I see the issue. There's an invalid utf-8 character. I'll have to add sanitation to the strings. Somewhere on the page, there's a (Double Left Quotation Mark) which is an invalid utf-8 character compared to "

So ,have you fixed this issue?

No, I was sleeping. I'll fix it in a little bit

@Puyodead1
Copy link
Owner

Ah, I see the issue. There's an invalid utf-8 character. I'll have to add sanitation to the strings. Somewhere on the page, there's a (Double Left Quotation Mark) which is an invalid utf-8 character compared to "

So ,have you fixed this issue?

Could you check something on your system for me please? Open a python terminal (should be able to search for python in the windows search and open Python (command line), or open cmd/powershell and just type python) and paste this:

import sys
import locale

sys.getfilesystemencoding()
locale.getpreferredencoding()

This will output your systems encoding, which may be set to the wrong thing.

@Samhunter91
Copy link

This was the output
Screenshot 2022-01-12 081139

And tried the latest selenium branch and I tried to download another course which 27.5 hours and captions and assets are downloading fine but some videos are skipped
Here is the error screenshot
IMG_20220112_134225

I also tried the previous 2.5 hours course and everything went smooth in that course every captions and assets are downloaded with all video files, don't know what happened while downloading the other one

Here is name of the other course
Complete Ethical Hacking Bootcamp 2022: Zero to Mastery

@Samhunter91
Copy link

Ah, I see the issue. There's an invalid utf-8 character. I'll have to add sanitation to the strings. Somewhere on the page, there's a (Double Left Quotation Mark) which is an invalid utf-8 character compared to "

So ,have you fixed this issue?

Could you check something on your system for me please? Open a python terminal (should be able to search for python in the windows search and open Python (command line), or open cmd/powershell and just type python) and paste this:

import sys
import locale

sys.getfilesystemencoding()
locale.getpreferredencoding()

This will output your systems encoding, which may be set to the wrong thing.

This was the output
Screenshot 2022-01-12 081139

And tried the latest selenium branch and I tried to download another course which 27.5 hours and captions and assets are downloading fine but some videos are skipped
Here is the error screenshot
IMG_20220112_134225

I also tried the previous 2.5 hours course and everything went smooth in that course every captions and assets are downloaded with all video files, don't know what happened while downloading the other one

Here is name of the other course
Complete Ethical Hacking Bootcamp 2022: Zero to Mastery

@Puyodead1
Copy link
Owner

Ah, I see the issue. There's an invalid utf-8 character. I'll have to add sanitation to the strings. Somewhere on the page, there's a (Double Left Quotation Mark) which is an invalid utf-8 character compared to "

So ,have you fixed this issue?

Could you check something on your system for me please? Open a python terminal (should be able to search for python in the windows search and open Python (command line), or open cmd/powershell and just type python) and paste this:

import sys
import locale

sys.getfilesystemencoding()
locale.getpreferredencoding()

This will output your systems encoding, which may be set to the wrong thing.

This was the output Screenshot 2022-01-12 081139

And tried the latest selenium branch and I tried to download another course which 27.5 hours and captions and assets are downloading fine but some videos are skipped Here is the error screenshot IMG_20220112_134225

I also tried the previous 2.5 hours course and everything went smooth in that course every captions and assets are downloaded with all video files, don't know what happened while downloading the other one

Here is name of the other course Complete Ethical Hacking Bootcamp 2022: Zero to Mastery

Hm, okay.

This error is caused by the path length being too long, I recommend moving the udemy-downloader-feat-selenium folder into the Downloads folder and deleting udemy-downloader-feat-selenium (2), then use --id-as-course-name.

As far as the other course, I might need an account to test with as I'm not 100% sure where the problem actually comes from, if you're willing to provide an account, you can email me at puyodead@protonmail.com

@sacsbrainz
Copy link
Author

Please read my email

@Samhunter91
Copy link

Ah, I see the issue. There's an invalid utf-8 character. I'll have to add sanitation to the strings. Somewhere on the page, there's a (Double Left Quotation Mark) which is an invalid utf-8 character compared to "

So ,have you fixed this issue?

Could you check something on your system for me please? Open a python terminal (should be able to search for python in the windows search and open Python (command line), or open cmd/powershell and just type python) and paste this:

import sys
import locale

sys.getfilesystemencoding()
locale.getpreferredencoding()

This will output your systems encoding, which may be set to the wrong thing.

This was the output Screenshot 2022-01-12 081139
And tried the latest selenium branch and I tried to download another course which 27.5 hours and captions and assets are downloading fine but some videos are skipped Here is the error screenshot IMG_20220112_134225
I also tried the previous 2.5 hours course and everything went smooth in that course every captions and assets are downloaded with all video files, don't know what happened while downloading the other one
Here is name of the other course Complete Ethical Hacking Bootcamp 2022: Zero to Mastery

Hm, okay.

This error is caused by the path length being too long, I recommend moving the udemy-downloader-feat-selenium folder into the Downloads folder and deleting udemy-downloader-feat-selenium (2), then use --id-as-course-name.

As far as the other course, I might need an account to test with as I'm not 100% sure where the problem actually comes from, if you're willing to provide an account, you can email me at puyodead@protonmail.com

I have sent you the account credentials

Puyodead1 added a commit that referenced this issue Jan 13, 2022
+ Support for large course content in subscription courses (#92)
+ Attempt to fix encoding problems with caption conversion (#92, #98, #97)
@Puyodead1
Copy link
Owner

I've tested the draw-cute-characters course and its downloading without issue. Please update the the latest version of the selenium branch and try it

@Samhunter91
Copy link

I've tested the draw-cute-characters course and its downloading without issue. Please update the the latest version of the selenium branch and try it

I am having some issue with decryption ,some of the files are not decrypting property

@Puyodead1
Copy link
Owner

the feat-shaka branch has now been deleted, and shaka-packager is now in the master branch, there is also some bug fixes that address issues with decryption on some files that contain commas in the filename resulting in decryption failure. The master branch also includes much better debug logging now to print the output from the external programs to find errors easier.

@Samhunter91
Copy link

the feat-shaka branch has now been deleted, and shaka-packager is now in the master branch, there is also some bug fixes that address issues with decryption on some files that contain commas in the filename resulting in decryption failure. The master branch also includes much better debug logging now to print the output from the external programs to find errors easier.

My subscription was over so I didn't got a chance to try it ,I will make a new account and try it . Thanks

@Samhunter91
Copy link

the feat-shaka branch has now been deleted, and shaka-packager is now in the master branch, there is also some bug fixes that address issues with decryption on some files that contain commas in the filename resulting in decryption failure. The master branch also includes much better debug logging now to print the output from the external programs to find errors easier.

Guess now I can't download any course as the method I was relying on to get the keys is patched 😪

@krishnastunning
Copy link

Its working fine now Thanks

bro can you help me to find Decryption Key ID Decryption Key

@sacsbrainz
Copy link
Author

sacsbrainz commented Oct 14, 2022

No i don't want to go to prison

@Puyodead1 Puyodead1 closed this as not planned Won't fix, can't repro, duplicate, stale Jan 18, 2023
Puyodead1 added a commit that referenced this issue Jul 2, 2023
+ Support for large course content in subscription courses (#92)
+ Attempt to fix encoding problems with caption conversion (#92, #98, #97)
Puyodead1 added a commit that referenced this issue Jul 2, 2023
+ Support for large course content in subscription courses (#92)
+ Attempt to fix encoding problems with caption conversion (#92, #98, #97)
Repository owner deleted a comment from sbchaudhari077 May 27, 2024
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