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.16k stars 551 forks source link

Error: 'NoneType' object has no attribute 'find' #109

Closed fakeid30 closed 3 years ago

fakeid30 commented 4 years ago

I was doing my daily run and encountered this following error, tried on both develop and master branch. Also on the released downloaded from issued release page.

◆ Automatic-Udemy-Course-Enroller-GET-PAID-UDEMY-COURSES-for-FREE git:(develop) ❯❯❯ python udemy_enroller_firefox.py
Loading existing settings
Please Wait: Getting the course list from tutorialbar.com...
Page: 1 of 606 scraped
Error: 'NoneType' object has no attribute 'find'
Closing browser

Further reading is required on my part. Tutorialbar, my account in udemy and my internet are in good condition.

This is happening with both Firefox and Chromium. Arch & Ubuntu Linux with python 3.8.6

cullzie commented 3 years ago

@fakeid30 I'm not able to reproduce this on my local machine. Also looks to be working in the ci test as well now. Could possibly have been some downtime on the site

fakeid30 commented 3 years ago

@cullzie I tried just now and saw this again, in the 4th page this time

Already enrolled in Java Programming: For Complete Beginners from scratch - 2020 | Udemy
Course language not wanted: German
Already enrolled in Managerial Accounting / Cost Accounting | Udemy
Successfully enrolled in: Partnership Accounting | Udemy
Already enrolled in Advanced Financial Accounting | Udemy
Successfully enrolled in: Linux for Cloud & DevOps Engineers | Udemy
Already enrolled in How to Write a Romance Novel | Udemy
Moving on to the next page of the course list on tutorialbar.com
Please Wait: Getting the course list from tutorialbar.com...
Page: 4 of 608 scraped
Error: 'NoneType' object has no attribute 'find'
Closing browser
oblomovx commented 3 years ago

I think this page is the problem: https://www.tutorialbar.com/amazon-prime-membership-499-per-year-youth-offer/

cullzie commented 3 years ago

Ye I've opened a PR to address this @fakeid30 . As @oblomovx mentioned I also think it is to do with the Amazon link now on the page

fakeid30 commented 3 years ago

@cullzie Now the script is malfunctioning :'(

It is showing that it is processing the change but in reality it is just clicking the amazon ad

Screenshot from 2020-11-26 11-33-10 Screenshot from 2020-11-26 11-33-08

fakeid30 commented 3 years ago

I wonder if we can install adblocker in our browser with selenium first then proceed normally .

cullzie commented 3 years ago

I don't think this is a google ad but a referral link. The only way to remove it would be to check the link domain and if its one of the ones we know is an ad remove it

fakeid30 commented 3 years ago

@cullzie another thing I noticed based on last night's change, that it's not enrolling me to any courses , it's just skipping over a list.

cullzie commented 3 years ago

@fakeid30 That would be the cache. If you want to see it go through the whole flow just delete the cache between runs At the moment it just logs In cache: <COURSE NAME HERE> This can be improved but its not breaking anything

fakeid30 commented 3 years ago

Screenshot-20201126134742-1159x318 Screenshot-20201126134710-361x453

@cullzie there is some kind of breaking change, because once I subscribed to one course , the script stopped working , and just breezed past the other courses. You can see it in the screenshot I provided.

In the master branch I am seeing this too.

Screenshot-20201126135159-1149x430

This run has gotten me 0 courses.

cullzie commented 3 years ago

@fakeid30 Can you try with a new udemy account?

My guess is you are already enrolled for all the links currently on tutorialbar today I can see you did enroll in one course and the rest are saying already enrolled. If you try with a fresh udemy account you will see more than one enroll in a row

fakeid30 commented 3 years ago

@cullzie just tried with a new account and I just get 1 course from 2 pages of scrapping, I'll email you the new account credential so that you can test as well.

Screenshot_2020-11-26 Inbox - ching chong hentai bdsm gmail com - Gmail

cullzie commented 3 years ago

@fakeid30 Ok thanks. Did you delete the cache before running?

fakeid30 commented 3 years ago

@fakeid30 Ok thanks. Did you delete the cache before running?

yup i did

cullzie commented 3 years ago

@fakeid30 Looks like an issue with the price taking time to render even though it says its displayed in selenium Can you try add a sleep before the check for the price? Won't get a chance to work on this properly until tomorrow

fakeid30 commented 3 years ago

@fakeid30 Looks like an issue with the price taking time to render even though it says its displayed in selenium Can you try add a sleep before the check for the price? Won't get a chance to work on this properly until tomorrow

I'll try this change locally and update , thank you!

fakeid30 commented 3 years ago

@cullzie this worked . Thanks for investigating this . Appreciate it a lot. I'll wait for a proper PR from you.

cullzie commented 3 years ago

@fakeid30 Ok good. I'll try find a better way than sleep as it will be pausing for longer than is needed. If I can get the loading element css I can wait until it has disappeared before reading in the text of the price element but I'll have to see how feasible that is

cullzie commented 3 years ago

All these issues should be fixed now