aapatre / Automatic-Udemy-Course-Enroller-GET-PAID-UDEMY-COURSES-for-FREE

Do you want to LEARN NEW STUFF for FREE? Don't worry, with the power of web-scraping and automation, this script will find the necessary Udemy coupons & enroll you for PAID UDEMY COURSES, ABSOLUTELY FREE!
GNU General Public License v3.0
3.17k stars 553 forks source link

Fix a bug where we try to access an invalid page from Udemy #406

Closed Voulz closed 1 year ago

Voulz commented 2 years ago

For some reason, the for loop is up to total_pages +2 and not total_pages +1. Instead of going this route, I saw that the response contains a "next" key which is None when there is no next page to load, so I replaced the for loop with a while loop which fixed my issue.

Description

As described in the issue I created earlier, sometimes the code tries to reach a page with my courses that does not exist. I had a look at the code and for some reason, the for loop is up to total_pages +2 and not total_pages +1. Instead of going this route, I saw that the response contains a "next" key which is None when there is no next page to load, so I replaced the for loop with a while loop which fixed my issue.

Fixes #405

Type of change

Please delete options that are not relevant.

How Has This Been Tested?

I only tested on my machine and I was able to enroll in new courses since.

Checklist:

cullzie commented 2 years ago

Thanks for the PR. Just some minor comments to address.

Voulz commented 2 years ago

Thanks for the code review, I fixed the code as you mentioned. I have been doing too much C++ lately...

Oka4444 commented 1 year ago

Capture i edited it like you described and even updated the code you updated even deleted the settings file and when i run run_enroller.py i always get already enrolled and i don't ever get successfully enrolled again and i don't get new courses what should i do? @cullzie @Voulz anybody please?

cullzie commented 1 year ago

Hey @Oka4444 Could you please open a separate ticket with full details of the issue you are having. Thanks