GithubHelp home page GithubHelp logo

aapatre / automatic-udemy-course-enroller-get-paid-udemy-courses-for-free Goto Github PK

View Code? Open in Web Editor NEW
3.1K 84.0 535.0 619 KB

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!

License: GNU General Public License v3.0

Python 99.89% Dockerfile 0.11%
python scraping selenium python3 scraper

automatic-udemy-course-enroller-get-paid-udemy-courses-for-free's Introduction

forthebadge forthebadge

  • Udemy Coupon Grabber & Course Enroller: Grab FREE Coupons!

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 to PAID UDEMY COURSES, ABSOLUTELY FREE!

NOTE: THIS PROJECT IS NOT AFFILIATED WITH UDEMY.

NOTE: THIS PROJECT WILL NOT WORK WITH NON ENGLISH UDEMY.


The code scrapes course links and coupons from:

In case of any bugs or issues, please open an issue in github. Also, don't forget to Fork & Star the repository if you like it!

We are also on GitLab

Video Proof:

Udemy Auto-Course-Enroller


Disclaimer & WARNINGS:

  1. Use this ONLY for Educational Purposes! By using this code you agree that I'm not responsible for any kind of trouble caused by the code. THIS PROJECT IS NOT AFFILIATED WITH UDEMY.
  2. Make sure web-scraping is legal in your region.
  3. This is NOT a hacking script, i.e., it can't enroll you for a specific course! Instead it finds courses that provide coupon links to make the transaction free and then LEGALLY enroll you to the course!


Requirements:

How to Install the Requirements?

Required Python version: Python 3.8+

(Windows users only) Required Microsoft Visual C++ 14.0+ version: Microsoft Visual C++ 14.0+

alt text

You must have pip or poetry installed. Please look up how to install them in your OS.

Download a release of this project or clone the repository then navigate to the folder where you placed the files on. Type pip install -r requirements.txt to get all the requirements installed in one go. Similar instructions applies for poetry.


Instructions

Props to Davidd Sargent for making a super simple video tutorial. If you prefer written instructions then continue reading further, else click on the image below for a quick video tutorial:

GET Udemy Courses for FREE with Python | 2 Minute Tuesday

1 . Install from PyPI pip install udemy-enroller

  • Run the script and the cli will guide you through the settings required.
  • If you decide to save the settings they will be stored in your home directory:
    Windows: C:/Users/CurrentUserName/.udemy_enroller
    Linux: /home/username/.udemy_enroller The values in settings.yaml should be in the same language as the site you are browsing on.

2 . The script can be passed arguments:

  • --help: View full list of arguments available
  • --browser=<BROWSER_NAME>: Run with a specific browser
  • --discudemy: Run the discudemy scraper only
  • --coursevania: Run the coursevania scraper only
  • --tutorialbar: Run the tutorialbar scraper only
  • --freebiesglobal: Run the freebiesglobal scraper only
  • --idownloadcoupon: Run the idownloadcoupon scraper only
  • --max-pages=<NUMBER>: Max number of pages to scrape from sites before exiting the script (default is 5)
  • --delete-settings: Delete existing settings file
  • --delete-cookie: Delete the cookie file if it exists
  • --debug: Enable debug logging

3 . Run the script in terminal with your target runner:

  • udemy_enroller
  • udemy_enroller --browser=chrome
  • udemy_enroller --browser=chromium

4 . The bot starts scraping the course links from the first All Courses page on Tutorial Bar, DiscUdemy, Coursevania and FreebiesGlobal and starts enrolling you to Udemy courses. After it has enrolled you to courses from the first page, it then moves to the next site page and the cycle continues.

  • Stop the script by pressing ctrl+c in terminal to stop the enrollment process.

5 . [New] At the end of process a detailed result is shown:

================== Run Statistics ==================

Enrolled:                   56
Unwanted Category:          0
Unwanted Language:          1
Already Claimed:            93
Expired:                    7
Total Enrolments:           1705
Savings:                    €2674.44
================== Run Statistics ==================

Docker

Alternatively you can run the script in docker.

To build the image run:

docker build -t udemy_enroller .

After the build is finished you can run your container with one of the commands below (you can pass arguments as you would in the cli):

docker run -it udemy_enroller 

After you entered your login credentials and settings detach from the interactive mode by pressing the Ctrl-P followed by Ctrl-Q.

You can also create a settings.yaml file from the sample_settings.yaml and mount to the container with the command:

docker run -v $(pwd)/settings.yaml:/home/enroller/.udemy_enroller/settings.yaml udemy_enroller 

FAQs

1. Can I get a specific course for free with this script?

  Unfortunately no, but let me assure you that you may be lucky enough to get a particular course for free when the instructor posts its coupon code in order to promote it. Also, over time you would build a library of courses by running the script often and have all the required courses in your collection. In fact, I made this course after completing a Python automation course and Selenium, which of course I got for free! :)

2. How does the bot work?

  The bot retrieves coupon links from Tutorial Bar, DiscUdemy and Coursevania's lists to cut the prices and then uses REST requests to authenticate and enroll to the courses. Think of it this way: Epic Games & other clients like Steam provide you a handful of games each week, for free; Only in this case, we need a coupon code to make those courses free.

3. How frequently should you run the script?

  Daily, at least once! I've painstakingly amassed over 4000 courses in the last four years! And out of those 4000, I've only paid for 4 of these courses.

So, a mere 0.001% of courses are actually paid in my collection! Thankfully, you can get more than what I gathered in 4 years, in a matter of weeks! 🙌🏻

4. Why did I create this?

  It used to be my daily habit to redeem courses and it was an extremely tedious task that took around 15 minutes, for 10 courses. And then I suddenly got the idea to automate it, after I found the automation course mentioned above. I bet, it will save your precious time too! :)

5. The code compiles successfully, but it's taking too long to work! IS there any way to fix that?

  Since we are heavily dependent on a third-party site to retrieve coupons links, there may be issues when the site is down. Needless to mention the connectivity issues too. If everything is working fine, you can see the courses being retrieved in the Python console/shell, which may take a while.

6. Which is the best way to run the script?

  It is recommended to run the script using your terminal and system python.

7. Which branch to commit against?

  Pull request should be made on "develop" branch.

8. What's the roadmap?

  Take a look at our Roadmap here and help us on what you want or talk to us about your proposed changes.


Support & Maintenance Notice

By using this repo/script, you agree that the authors and contributors are under no obligation to provide support for the script and can discontinue it's development, as and when necessary, without prior notice.


Supporters

Jetbrains

JetBrains

Thanks to JetBrains for supporting us. They are the maker of world class IDE and developer tooling. If you think their product might help you, please support them.

GitBook

GitBook

Thanks to GitBook for supporting us. GitBook is the best place to track personal notes and ideas for teams. If you think their product might help you, please support them.

GitLab

GitLab

Thanks to GitLab for supporting us. GitLab is one of the main code hosting and CI/CD providers out there. They support the open source community through their GitLab for Open Source program. Please check them out.

automatic-udemy-course-enroller-get-paid-udemy-courses-for-free's People

Contributors

a-0vi avatar aapatre avatar alyoninthecity avatar asunnya avatar baseplate-admin avatar c1sc0 avatar cullzie avatar deedeedev avatar deepsourcebot avatar diflartle avatar eklipse18 avatar fakeid30 avatar hubris-kubrick avatar jlarini avatar jzarca01 avatar latelylk avatar mustafaamer-1 avatar nottrif avatar nyctophilia58 avatar restyled-commits avatar sayedulsayem avatar shamiul419 avatar tbm avatar voulz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

automatic-udemy-course-enroller-get-paid-udemy-courses-for-free's Issues

Thank Jetbrains in README

As we are getting support from Jetbrains they sent me an email with this body :

We hope that JetBrains software will be useful for your project! If you feel that our tools have helped you a great deal, we would be grateful if you could mention JetBrains' support on your project's homepage. You could do this by placing our Logo and a link to JetBrains such as https://www.jetbrains.com/?from=ABC (make sure to replace ‘ABC’ with the name of your OS project, no spaces). Thanks in advance!

I think we should do this. I wonder where to put this though. What do you think @cullzie ?

Move from print to logging module

Move from print statements to use python logging module

This will have several benefits to users and devs:

  • Creation of log file for easier bug reports
  • Ability to have different levels of logging for debugging purposes (DEBUG, INFO etc...)
  • Better formatting of console messages

Issue a new release

I tested the caching feature all day locally. The code seems solid . Once we push a PR with updated README I believe we're good to post our next release.

Release 1.0.0

Since we are using semver the next version should be 1.0.0. I don't think there will be any breaking change. So no point continuing the 0.* branch.

What's your opinion about it @cullzie ?

But I am not sure what to add / change before making it to 1.0.0.

Should we try to get a GUI running ? Where someone will post their username , pass and all the other stuff.

Not sure how necessary the GUI is though.

Udemy antibot triggered

For now udemy detects the bot and i'm unable to login (without completing a captcha) because it tries to change page too fast. After the login it should check and, if there is the captcha, wait until the captcha is completed (maybe just with input("Please complete the captcha and press enter. ")).

screenshot

webdriver_manager no module found

Using windows 10, python v3.8.3
attempted to run chrome script and got message
ModuleNotFoundError: No module named 'webdriver_manager'

I found a stack exchange page that to use this line:
pip install webdriver_manager

this successfully installed webdriver manager

Updating README

I think we need to change FAQ #7

Also once we incorporate develop into master and make a new release we need to remove the section about saved card.

Add new source ?

Now that we have a good base, I'd like to explore the possibility of adding new source. What do you think @cullzie ?

Project rename?

I want to see if there can be a prettier name for this project than current boring name. For example, I had "udemy-cherrypick 🍒" in my mind.

Enhancement: Regroup all code in one

To facilite maintenance, I think it would be better to don't have duplicate code for each browser.

In this case, we could use the yaml to choose which browser we want to use

Stop trying after X number of failed requests

When an user sees a page that they have redeemed before, it's unlikely that they will see any non redeemed course after.

This issue proposes to see have the program terminated after X amount of failed attempt. The number can be user inputted or hard coded. I think 22 is a good number.

This is a finer version of PR #11

ModuleNotFoundError: No module named 'ruamel'

I am getting following error

from ruamel.yaml import YAML, dump
ModuleNotFoundError: No module named 'ruamel'

even though i ran pip install -r requirements.txt and installed ruamel separately as well.
My python version is Python 3.8.5. Please help.

Adding filters

Hi. Kudos to the developers for their efforts.
What about adding filters in the application for enrolling user to those courses according to the their intrest such as 4 stars or above, those courses containing keywords like excel, analytics, python, and so on.

SOLVED: selenium.common.exceptions.WebDriverException:

Edit: this was solved by @ethankrein thanks!!

I get this error after running udemy_automate_course_enroll_v1.py , driver is in the system path I have already checked as per the instructions given here, Edge driver and browser match, I have already restarted. (https://www.selenium.dev/documentation/en/selenium_installation/installing_webdriver_binaries/). Please help!

This is how modified lines are set:
path = "C:\Webdriver\bin\msedgedriver.exe"
driver = webdriver.Edge(path)

This is the result:

"C:\Webdriver\bin\udemy_automate_course_enroll_v1.py"
Traceback (most recent call last):
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python38\lib\site-packages\selenium\webdriver\common\service.py", line 72, in start
self.process = subprocess.Popen(cmd, env=self.env,
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 854, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 1307, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Webdriver\bin\udemy_automate_course_enroll_v1.py", line 53, in
driver = webdriver.Edge(path) # webdriver.Chrome(path) for Google Chrome, webdriver.Firefox(path) for Mozilla Firefox, webdriver.Edge(path) for Microsoft Edge, webdriver.Safari(path) for Apple Safari
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python38\lib\site-packages\selenium\webdriver\edge\webdriver.py", line 56, in init
self.edge_service.start()
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python38\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start
raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'msedgedriver' executable needs to be in PATH. Please download from http://go.microsoft.com/fwlink/?LinkId=619687

Fixed this for edge and firefox, using a different Line 54 however now I get this:

Unable to enroll for this course either because you have already claimed it or the browser window has been closed
Unable to enroll for this course either because you have already claimed it or the browser window has been closed
Unable to enroll for this course either because you have already claimed it or the browser window has been closed
Unable to enroll for this course either because you have already claimed it or the browser window has been closed
Unable to enroll for this course either because you have already claimed it or the browser window has been closed
Unable to enroll for this course either because you have already claimed it or the browser window has been closed

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

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

ModuleNotFoundError: No module named 'selenium'

simkav@Simkav-PC:~/Sandbox/Automatic-Udemy-Course-Enroller-GET-PAID-UDEMY-COURSES-for-FREE$ python udemy_enroller.py

Traceback (most recent call last):
File "udemy_enroller.py", line 8, in
from selenium.webdriver.remote.webdriver import WebDriver
ModuleNotFoundError: No module named 'selenium'

screenshot_2

python verison 3.8
screenshot_3

pip3 list shows that i have selenium

screenshot_1

i'm new to phyton, what should i do?

Microsoft Edge on Linux does not work (wrong download URL of the webdriver)

Relevant Error log :

✖ 130 Automatic-Udemy-Course-Enroller-GET-PAID-UDEMY-COURSES-for-FREE git:(master) ✗ ❯❯❯ python udemy_enroller_edge.py 
Loading existing settings
[WDM] - There is no [linux64] edgedriver for browser  in cache
[WDM] - Trying to download new driver from https://msedgedriver.azureedge.net/87.0.664.47/edgedriver_linux64.zip
Traceback (most recent call last):
  File "udemy_enroller_edge.py", line 12, in <module>
    driver = webdriver.Edge(EdgeChromiumDriverManager().install())
  File "/home/nirjhor/.local/lib/python3.8/site-packages/webdriver_manager/microsoft.py", line 47, in install
    return self._get_driver_path(self.driver)
  File "/home/nirjhor/.local/lib/python3.8/site-packages/webdriver_manager/manager.py", line 29, in _get_driver_path
    file = download_file(driver.get_url())
  File "/home/nirjhor/.local/lib/python3.8/site-packages/webdriver_manager/utils.py", line 93, in download_file
    validate_response(response)
  File "/home/nirjhor/.local/lib/python3.8/site-packages/webdriver_manager/utils.py", line 79, in validate_response
    raise ValueError("There is no such driver by url {}".format(resp.url))
ValueError: There is no such driver by url https://msedgedriver.azureedge.net/87.0.664.47/edgedriver_linux64.zip

Deduplication

I know we currently have firefox driver issue. But I think it's logical to reuse this part :

driver.maximize_window()

# in the maximized layout


def getUdemyLink(url):
    response = requests.get(url=url)

    soup = BeautifulSoup(response.content, "html.parser")

    linkForUdemy = soup.find("span",
                             class_="rh_button_wrapper").find("a").get("href")

    return linkForUdemy


def gatherUdemyCourseLinks(courses):
    """
    Threaded fetching of the udemy course links from tutorialbar.com

    :param list courses: A list of tutorialbar.com course links we want to fetch the udemy links for
    :return: list of udemy links
    """
    thread_pool = Pool()
    results = thread_pool.map(getUdemyLink, courses)
    thread_pool.close()
    thread_pool.join()
    return results


def getTutorialBarLinks(url):
    response = requests.get(url=url)

    soup = BeautifulSoup(response.content, "html.parser")

    links = soup.find("div", class_="rh-post-wrapper").find_all("a")
    # print(links)

    courses = []

    x = 0
    for i in range(12):
        courses.append(links[x].get("href"))
        x = x + 3

    return courses


def udemyLogin(email_text, password_text):
    driver.get("https://www.udemy.com/join/login-popup/")

    userEmail = driver.find_element_by_name("email")
    userPassword = driver.find_element_by_name("password")

    userEmail.send_keys(email_text)
    userPassword.send_keys(password_text)

    driver.find_element_by_name("submit").click()


def redeemUdemyCourse(url):
    driver.get(url)
    print("Trying to Enroll for: " + driver.title)

    # Enroll Now 1
    element_present = EC.presence_of_element_located(
        (By.XPATH, "//button[@data-purpose='buy-this-course-button']"))
    WebDriverWait(driver, 10).until(element_present)

    udemyEnroll = driver.find_element_by_xpath(
        "//button[@data-purpose='buy-this-course-button']")  # Udemy
    udemyEnroll.click()

    # Enroll Now 2
    element_present = EC.presence_of_element_located((
        By.XPATH,
        '//*[@class="udemy pageloaded"]/div[1]/div[2]/div/div/div/div[2]/form/div[2]/div/div[4]/button',
    ))
    WebDriverWait(driver, 10).until(element_present)

    # Check if zipcode exists before doing this
    if zipcode:
        # Assume sometimes zip is not required because script was originally pushed without this
        try:
            zipcode_element = driver.find_element_by_id(
                "billingAddressSecondaryInput")
            zipcode_element.send_keys(zipcode)

            # After you put the zip code in, the page refreshes itself and disables the enroll button for a split second.
            time.sleep(1)
        except NoSuchElementException:
            pass

    udemyEnroll = driver.find_element_by_xpath(
        '//*[@class="udemy pageloaded"]/div[1]/div[2]/div/div/div/div[2]/form/div[2]/div/div[4]/button'
    )  # Udemy
    udemyEnroll.click()


def main_function():
    page = 1  # Change the page number here only if necessary, else ignore

    loop_run_count = 0

    while True:

        print("Please Wait: Getting the course list from tutorialbar.com...")
        print("Page: " + str(page) + ", Loop run count: " +
              str(loop_run_count))

        url = "https://www.tutorialbar.com/all-courses/" + "page/" + str(
            page) + "/"
        courses = getTutorialBarLinks(url)

        udemyLinks = gatherUdemyCourseLinks(courses)

        for counter, course in enumerate(udemyLinks):
            print("Received Link {} : {}".format((counter + 1), course))

        if loop_run_count == 0:
            udemyLogin(email, password)

        for link in udemyLinks:
            # noinspection PyBroadException
            try:
                redeemUdemyCourse(link)
            except BaseException as e:
                print(
                    "Unable to enroll for this course either because you have already claimed it or the browser "
                    "window has been closed!")

        page = page + 1
        loop_run_count = loop_run_count + 1

        print(
            "Moving on to the next page of the course list on tutorialbar.com")


main_function()

We can make this part a class and call it from inside the function, we can split it into another file and that will work as well. I know this will mean that our project can not be run in isolation anymore. But nowhere did we promise that we can run it like that.

@aapatre @cullzie @ethankrein please give your opinion.

Fix restyled-io bot

At the moment there are too many checks and each one is restyling the last checks commit

Example:
isort changes the import to:

from selenium.common.exceptions import NoSuchElementException, TimeoutException

reorder-python-imports changes it back to:

from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import TimeoutException

And this is just repeated on every single PR

Can we reduce down the list of checks to black and isort?

Got this error while running it on ubuntu vps

[WDM] - Current google-chrome version is 87.0.4280
[WDM] - Get LATEST driver version for 87.0.4280
[WDM] - There is no [linux64] chromedriver for browser 87.0.4280 in cache
[WDM] - Get LATEST driver version for 87.0.4280
[WDM] - Trying to download new driver from http://chromedriver.storage.googleapis.com/87.0.4280.20/chromedriver_linux64.zip
[WDM] - Driver has been saved in cache [/root/.wdm/drivers/chromedriver/linux64/87.0.4280.20]
Traceback (most recent call last):
File "udemy_enroller_chrome.py", line 29, in
driver = webdriver.Chrome(ChromeDriverManager().install(), options=chrome_options)
File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/chrome/webdriver.py", line 76, in init
RemoteWebDriver.init(
File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/remote/webdriver.py", line 157, in init
self.start_session(capabilities, browser_profile)
File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally.
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

password problems

when I run the script and it asks me for the password, it won't let me type anything, like if the keyboard didn't work

Enroll only to courses in categories I'm interested in

Kind of in a similar vein to the #36
I don't want to be enrolled in anything under Music category for example as I cannot sing 🎤

Top level categories which courses fall under:

Development
Business
IT & Software 
Office Productivity
Personal Development
Design
Marketing
Health & Fitness
Music

This list is in English of course so each user would have to define these in their own language

Leaving the option blank would add you to all courses. Otherwise you will only be enrolled in the courses which fall under the categories you have picked

Enhancement: Automate Settings

When you launch the script, if there is no setting available, it creates one and asks you your informations.

That way, the user just have to launch the script without worrying to check any other file.

Use f-strings instead of .format and string addition

Using f-strings which are available from Python 3.6 or greater is a very helpful and human-readable tool for string concatenation.

For example, in line 141 to 142 in udemy_enroller_edge.py, you have to manually make page into a string:

url = "https://www.tutorialbar.com/all-courses/" + "page/" + str(
            page) + "/"

This can be simplified using f-strings:

url = f"https://www.tutorialbar.com/all-courses/page/{page}"

Stuck at payment checkout!

After collecting all the links with coupon codes, the program goes to udemy and select enroll, which is problematic because there should be a verification system whether adding the coupon makes the course "free" or not. There are some coupons which lessens the price. The bot also clicks there and gets stuck at payment process. This keeps happening and everytime it happens it throws an error like "find_all of none" type. Then I have to restart the bot again. I think you can add the verification process like when the "Buy Now" text is available in the "udlite-btn udlite-btn-large udlite-btn-primary udlite-heading-md styles--btn--express-checkout--28jN4" classes, the bot skips the page and go to the next link. Please look into it. Thanks!

Trying to enroll in courses i'm already enrolled in

Well the title says everything.
It could save links of courses it processed and skip them the next time you run it. It could also save the email address linked to these links to avoid deleting / moving the list to use multiple accounts.

[BUG] Doesn't enter zip code

Describe the bug
Doesn't enter zip code

To Reproduce
Steps to reproduce the behavior:

  1. Chrome web driver selected

Expected behavior
Enters zip code

Desktop (please complete the following information):
Windows 10

Additional context
Add any other context about the problem here.

Fix firefox webdriver autoinstall

The current implementation lacks geckodriver autoinstall, we need to figure out a way to autoinstall geckodriver so that we don't have to manually install it and get parity with chrome and edge.

Chromium on Ubuntu does not work if there is captcha

If I hit a captcha prompt in chromium I see this error :


Loading existing settings
 
[WDM] - Current chromium version is 83.0.4103
[WDM] - Get LATEST driver version for 83.0.4103
[WDM] - Driver [/home/nirjhor/.wdm/drivers/chromedriver/linux64/83.0.4103.39/chromedriver] found in cache
Error: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[name="email"]"}
  (Session info: chrome=83.0.4103.116)

Closing browser

This is on the master branch.

Add pyproject.toml

Simply add pyproject.toml to the project for use with poetry and remove poetry.lock
Update .gitignore to match this

Explanation: Should I commit .lock file changes separately? What should I write for the commit message?

At the moment I'm getting an error when trying to run poetry:


  RuntimeError

  Poetry could not find a pyproject.toml file in /home/xoxo/Automatic-Udemy-Course-Enroller-GET-PAID-UDEMY-COURSES-for-FREE or its parents

  at ~/.local/lib/python3.8/site-packages/poetry/core/factory.py:367 in locate
      363│             if poetry_file.exists():
      364│                 return poetry_file
      365│ 
      366│         else:
    → 367│             raise RuntimeError(
      368│                 "Poetry could not find a pyproject.toml file in {} or its parents".format(
      369│                     cwd
      370│                 )
      371│             )

add argparse to remove manual code edits

you can use the standard library module argparser to get the username, password and the path to the browser webdriver and the browser type.

This would be great so a don't have to has to change the coding.

CI failing

unknown

@cullzie CI seems to be failing even with a configured dummy account in secrets, we've given you collaborator status. Can you please check what seems to be the problem ?

Blocked link shorteners are not being gracefully handled

In my country bit.ly is blocked, in previous version of the script it was allowed to time out to reach the next link, but since v0.2 onwards it's exiting with this error message :


Received Link 4 : https://www.udemy.com/course/adobepremiereprocccourse/?couponCode=BFDAYFREE
Received Link 5 : https://www.udemy.com/course/affinity-publisher-guide/?couponCode=E89491D7B740594E7824
Received Link 6 : https://www.udemy.com/course/adobe-dreamweaver-cc-2020-master-course/?couponCode=TRY10FREE403
Received Link 7 : https://www.udemy.com/course/complete-progressive-web-app-bootcamp/?couponCode=6CAFC39C5D5F0508385C
Received Link 8 : https://www.udemy.com/course/complete-react-course-w-hooks-react-router-redux-usecontext/?couponCode=9BCF501030302CCB4F6C
Received Link 9 : https://www.udemy.com/course/mindset-to-win-and-influence/?couponCode=77B3265043A4C0FF90FE
Received Link 10 : https://www.udemy.com/course/shipping-logistics-business-in-supply-chain-export-import/?couponCode=C93D07634761D4F70C66
Received Link 11 : https://bit.ly/38sVnJF
Received Link 12 : https://www.udemy.com/course/microsoft-excel-learn-ms-excel-for-data-analysis/?couponCode=172AD8D9C4AC7051E89A
Already enrolled in Be A Mental Math King | Udemy
Already enrolled in SAP FICO For Beginners With Simple And Detailed Explanation | Udemy
Course language not wanted: Portuguese
Already enrolled in Complete Adobe Premiere Pro CC Course - Beginner to Advanced | Udemy
Already enrolled in Affinity Publisher Guide - Affinity Publisher for Beginners | Udemy
Already enrolled in Adobe Dreamweaver CC 2020 | Udemy
Already enrolled in Complete Progressive Web App Bootcamp | Udemy
Already enrolled in React - The Complete Guide with React Hook Redux 2020 in 4hr | Udemy
Already enrolled in Mindset to Win and Influence | Udemy
Already enrolled in International Logistics & Transportation in Supply Chain. | Udemy
Message: Reached error page: about:neterror?e=netTimeout&u=https%3A//bit.ly/38sVnJF&c=UTF-8&d=The%20server%20at%20bit.ly%20is%20taking%20too%20long%20to%20respond.

Error: Message: Reached error page: about:neterror?e=netTimeout&u=https%3A//bit.ly/38sVnJF&c=UTF-8&d=The%20server%20at%20bit.ly%20is%20taking%20too%20long%20to%20respond.

Closing browser
◆ Automatic-Udemy-Course-Enroller-GET-PAID-UDEMY-COURSES-for-FREE git:(develop) ❯❯❯ 

We need to reintroduce graceful timeout, not outright closing.

@cullzie can you take a look please ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.