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.14k stars 540 forks source link

[BUG] Not enough time to solve captcha #233

Closed fakeid30 closed 3 years ago

fakeid30 commented 3 years ago

Describe the bug When I am invoking this script, it is taking me to a captcha, but logging in normally is not getting any captcha. When I am seeing the captcha, there is not enough time to solve the problem.

To Reproduce Steps to reproduce the behavior:

  1. run script
  2. see error (see screenshot)

Expected behavior The window would hold until the captcha is solved

Screenshots Screenshot from 2021-02-10 09-57-08 Screenshot from 2021-02-10 09-57-14

Desktop (please complete the following information):

Additional context This is the same reason github CI is failing as well.

tylkofarci commented 3 years ago

This is not google captcha on udemy site, this is separate cloudflare captcha.

biswajit1602 commented 3 years ago

Same problem here

cullzie commented 3 years ago

Ye the captcha has changed. I've updated the code to allow the user solve it but I still could not progress beyond the captcha check

khdan commented 3 years ago

same here!

yaasin12 commented 3 years ago

same here, it wont accept the captcha

cullzie commented 3 years ago

I have a possible fix for this which is a big change to the code base so I need a while to test it fully. The premise of the change is just to login and enrol via the REST api. This would remove the dependency on browsers and improve the speed. However this is a pretty significant change so it may take time to iron out any issues with it.

@fakeid30 Do you think we could create a develop_beta branch. We can merge things into that and people can test it from there. Don't want to merge to develop and make things worse :smile:

fakeid30 commented 3 years ago

@cullzie just create an alpha branch, since develop branch is already kind of a beta.

cullzie commented 3 years ago

Possible fix for this is on alpha branch now. If anyone could test and report back any issues that would be great. Thanks

There are a lot of changes including removing some dependencies and adding some new ones as well as changing how we enrol in courses entirely. Any dependency updates are covered in requirements.txt and pyproject.toml

sidhant-khamankar commented 3 years ago

Not working alpha branch @cullzie

Not enough time to solve captcha

These are the errors

DevTools listening on ws://127.0.0.1:14636/devtools/browser/97d25227-fd2a-4b6d-8965-fbbef482e0bc [22588:5528:0213/154241.534:ERROR:device_event_log_impl.cc(211)] [15:42:41.535] USB: usb_device_handle_win.cc:1049 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F) [22588:5528:0213/154241.535:ERROR:device_event_log_impl.cc(211)] [15:42:41.535] USB: usb_device_handle_win.cc:1049 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F) Udemy user failed to login Closing browser

cullzie commented 3 years ago

@sidhant-khamankar The captcha won't show at all anymore so there should be no need to solve captcha. As for the error linked please provide some more info on your system please. The error shown seems to be related to a usb device connected to your system. I'll add more logs on Alpha now to help identify the login failure.

sidhant-khamankar commented 3 years ago

@cullzie I have wireless mouse's USB connected. System Info: Windows 10 Home 1909, Intel i5 10300H, Nvidia Geforce 1650Ti, 8GB Ram

cullzie commented 3 years ago

I've pushed some more updates to Alpha. There should be more logging now. If running could you please do so with --debug flag. It will help debug any issues which might arise. Thanks

sidhant-khamankar commented 3 years ago

Tried new patch and when i enter below command same error occurs and still captcha is coming udemy_enroller --browser chrome --debug

DevTools listening on ws://127.0.0.1:3537/devtools/browser/50145672-c054-4116-8da0-23f4365b7b02 [2192:16260:0213/182352.211:ERROR:device_event_log_impl.cc(211)] [18:23:52.211] USB: usb_device_handle_win.cc:1049 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F) Udemy user failed to login Closing browser

But when I enter this python udemy_enroller.py and it works๐Ÿ˜€๐Ÿ˜€ Thanks๐Ÿค—

Some issue with bit.ly links

tutorialbar scraper is running Page: 2 of 743 scraped from tutorialbar.com Got 12 links from https://www.tutorialbar.com in 3.16 seconds Unexpected exception: Malformed url passed in: https://bit.ly/3agCcDq

Also Some issue with discudemy links

Page: 4 of 502 scraped from discudemy.com Got 0 links from https://discudemy.com in 2.42 seconds

While enrolling for some courses following is shown

Checkout failed: Code: 429 Text: {"detail":"Request was throttled. Expected available in 8 seconds."} Checkout failed: Code: 429 Text: {"detail":"Request was throttled. Expected available in 2 seconds."}

Sometimes process gets paused pressing enter resumes it.

anevskistefan commented 3 years ago

Does this works only for Firefox? Because i've tried on Chrome and it give me the captcha too and closes the window

fakeid30 commented 3 years ago

@anevskistefan use the alpha branch.

cullzie commented 3 years ago

Ah yes the one installed from pypi is not updated. Which is called like udemy_enroller --debug To run the one from the alpha branch you need to run udemy_enroller.py Glad to hear it's working for someone else ๐Ÿ™‚

cullzie commented 3 years ago

@sidhant-khamankar To go through the issues you mentioned the malformed URL is a normal issue with some links from tutorialbar in bit.ly format. We can probably just drop them in the scraping phase now though.

The issue with throttling is to do with enrolling too quickly. We'll just need to retry in these cases. Even with throttling it should be a lot quicker than using the browser ๐Ÿ™‚

The issue with 0 links on discudemy is because it offers free courses as well which we are not interested in.

anevskistefan commented 3 years ago

@cullzie I tried now with the command python3 udemy_enroller.py --browser firefox --max-pages 500 --debug and this is what i got

Screenshot_2021-02-13_16-24-02

And also, when i opened the second time it loads and it's okay but it says timeout on every single link and doesn't subscribe

cullzie commented 3 years ago

@anevskistefan it looks like you are not running on the alpha branch

anevskistefan commented 3 years ago

@cullzie i need to run it like "udemy_enroller.py --browser firefox --max-pages 500? Sorry for misunderstanding, i'm new in this :))

cullzie commented 3 years ago

@anevskistefan if you are on the alpha branch you can run it like udemy_enroller.py There is no need to specify a browser anymore as it is no longer used. Just make sure you have installed the new requirements listed in requirements.txt file: pip install -r requirements.txt

anevskistefan commented 3 years ago

@cullzie I managed to do that man, thank you a lot. It works just fine!

anevskistefan commented 3 years ago

@cullzie Man i started the program and on the 30page it shows me this. Screenshot_2021-02-14_00-54-38

harmitstar commented 3 years ago

Can we have cookie based login, i.e. add cookies values from already logged in session

fakeid30 commented 3 years ago

Same problem here

@biswajit1602 Saying same problem here in comment is unhelpful. Use the emoji. This is not social media.

@cullzie Man i started the program and on the 30page it shows me this. Screenshot_2021-02-14_00-54-38

@anevskistefan please use another discussion thread to discuss your issue, do not meander this issue. As seen in https://github.com/aapatre/Automatic-Udemy-Course-Enroller-GET-PAID-UDEMY-COURSES-for-FREE/discussions/236, you tend to jump into random things despite not knowing github workflow. Please educate yourself first, when you comment trivial shits on an issue created for something else, everyone gets an email and it's super annoying because when I get an email for an issue that's breaking functionality, I expect to see something regarding that functionality, not trivial how to post. So please, do not annoy the developers/maintainers.

Can we have cookie based login, i.e. add cookies values from already logged in session

@harmitstar open a new issue, but before that, check the alpha version. We are going through a transition period, we advice you to please be patient with feature request.

MesterPerfect commented 3 years ago

I have the same problem on all of my browsers

xoco70 commented 3 years ago

In my case, it won't work neither, but with slightly different case. It keeps asking for captcha, I solve it manually, but it never accept it. I did it many times so I double checked there is no error in when I solve it. I can't go further captcha, even manually. And yes, I am talking about Udemy Capcha, the google Captcha is not an issue.

fakeid30 commented 3 years ago

@MesterPerfect @xoco70 You need to use the alpha branch

xoco70 commented 3 years ago

@fakeid30 Ah OK, after installing new requirements and deleting the --browser=chrome param, it seems to be working without a browser. Good improvement !

vincekirkov commented 3 years ago

Tried out the alpha branch. I am getting "Checkout failed" errors for all courses with two different users. Any idea?

Checkout failed: https://www.udemy.com/course/onboarding-employees-learning-development-strategies/
Checkout payload: {'checkout_event': 'Submit', 'shopping_cart': {'items': [{'discountInfo': {'code': 'A2A9A6CE07F81CD1AC7C'}, 'purchasePrice': {'amount': 0, 'currency': 'EUR', 'price_string': 'Free', 'currency_symbol': 'โ‚ฌ'}, 'buyableType': 'course', 'buyableId': 3811080, 'buyableContext': {}}], 'is_cart': True}, 'payment_info': {'payment_vendor': 'Free', 'payment_method': 'free-method'}}
In cache: https://www.udemy.com/course/plc-advance-course-data-registers-and-internal-relays/?couponCode=FEB22021
Checkout failed: https://www.udemy.com/course/pic18-microcontroller-step-by-step-guide/
Checkout payload: {'checkout_event': 'Submit', 'shopping_cart': {'items': [{'discountInfo': {'code': 'FEB22021'}, 'purchasePrice': {'amount': 0, 'currency': 'EUR', 'price_string': 'Free', 'currency_symbol': 'โ‚ฌ'}, 'buyableType': 'course', 'buyableId': 1975432, 'buyableContext': {}}], 'is_cart': True}, 'payment_info': {'payment_vendor': 'Free', 'payment_method': 'free-method'}}
Checkout failed: https://www.udemy.com/course/the-data-science-course-2020-q2-updated-part-1/
willbrewster commented 3 years ago

I'm running the alpha branch and getting the following error. Any idea why?


Loading existing course details
Currently enrolled in 0 courses
tutorialbar scraper is running
discudemy scraper is running
Error in get request: Cannot connect to host www.tutorialbar.com:443 ssl:default [No route to host]
Page: 1 of None scraped from tutorialbar.com
Error while running tutorialbar scrapper: 'NoneType' object is not iterable
Error in get request: Cannot connect to host discudemy.com:443 ssl:default [No route to host]
Error while running discudemy scrapper: 'NoneType' object has no attribute 'decode'```
vinhvan99 commented 3 years ago

I get the alpha branch and getting getting the following error. image

fakeid30 commented 3 years ago

@vincekirkov @willbrewster @vinhvan99 there was a pull request sent last night, please do a git pull on the alpha branch. Then try again, if it does not work, delete the cookie file (.cookie).

you can find it in the root folder.

One more thing, alpha branch is not supported for end usage, there has been massive changes to udemy that they implemented to hinder us, so we are trying to fix this and then we will launch it. Any further query for usage support might go unanswered.

rashideng commented 3 years ago

I'm getting "Checkout failed:" Error Screenshot 2021-02-17 132143

vincekirkov commented 3 years ago

The Checkout errors were solved for me after deleting the .cookie file from .udemy_enroller. Thanks!

lukepes commented 3 years ago

I also keep getting checkout failed errors. Deleting .cookie does not help.

vincekirkov commented 3 years ago

I also keep getting checkout failed errors. Deleting .cookie does not help.

Try registering a new account (or using an account with not too many courses) and delete the cookie again. This solved it for me.

lukepes commented 3 years ago

Thanks for help, but now i get another message:

python udemy_enroller.py Loading existing settings Loading cookies from file Exception in redeem courses: 'NoneType' object is not subscriptable

It appeared after deleting cookies. Before I was getting some html code in the console.

MesterPerfect commented 3 years ago

Hi, how do I run alpha branch?

abdulalief commented 3 years ago

Hi, how do I run alpha branch?

  1. switch repos to alpha branch git fetch --all git checkout alpha

  2. install dependency files pip install -r requirements.txt

  3. run script python udemy_enroller.py

it should run properly

lukepes commented 3 years ago

Still getting the checkout failed errors, even with a brand new account with no courses. Anybody has a fix for that?

JessJiayi commented 3 years ago

Hi, how do I run alpha branch?

  1. switch repos to alpha branch git fetch --all git checkout alpha
  2. install dependency files pip install -r requirements.txt
  3. run script python udemy_enroller.py

it should run properly

I got error message:
error: pathspec 'alpha' did not match any files known to git

fakeid30 commented 3 years ago

What @abdulalief wrote is correct, if you need a more thorough tutorial here's where you can see what exactly is needed and you can follow along if you so choose. But from personal experience, there is no way this should fail. So I will chalk it up to user error.

https://devconnected.com/how-to-switch-branch-on-git/

@lukepes @jiayz1997

JessJiayi commented 3 years ago

What @abdulalief wrote is correct, if you need a more thorough tutorial here's where you can see what exactly is needed and you can follow along if you so choose. But from personal experience, there is no way this should fail. So I will chalk it up to user error.

https://devconnected.com/how-to-switch-branch-on-git/

@lukepes @jiayz1997

image Did I did anything wrong? I still can not run script without browser.

fakeid30 commented 3 years ago

@jiayz1997 you are not the target audience for an alpha branch, please wait for the release of stable.

fakeid30 commented 3 years ago

@cullzie when can we merge alpha to develop and / or develop to stable? Any timeframe?

cullzie commented 3 years ago

@fakeid30 We can probably merge now. It works to some degree which is much better than the current develop branch. I haven't seen any huge bugs just different users having different issues. Would be easier if they were in separate bugs instead of under this megathread ๐Ÿ˜„

cullzie commented 3 years ago

@fakeid30 For stable it's the same story as above really. Getting this to master is better than what is currently there

fakeid30 commented 3 years ago

@cullzie Yes that's what I thought. Let's cut a release and rebase alpha to develop and delete alpha?

I'm tired of random issue under this megathread. It's becoming a maintenance nightmare.

cullzie commented 3 years ago

@fakeid30 That sounds good to me. Ye I find it hard to understand what the problems actually are under this thread. Closing it and allowing people to create standalone bugs will help everyone