Code Monkey home page Code Monkey logo

keethesh / udemycoursegrabber Goto Github PK

View Code? Open in Web Editor NEW
181.0 181.0 29.0 2.32 MB

Your will to enroll in Udemy course is here, but the money isn't? Search no more! This python program searches for your desired course in more than [insert big number here] websites, compares the last updated date, and gives you the download link of the latest one back, but you also have the choice to see the other ones as well!

License: MIT License

Python 100.00%
lxml scraper scraping scrapper scrapper-script selenium selenium-python udemy

udemycoursegrabber's Introduction

Hey there ๐Ÿ‘‹, I'm Keethesh!

A Python developer from Mauritius

me.py

Support My Work!

keethesh

udemycoursegrabber's People

Contributors

deepsourcebot avatar keethesh 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

udemycoursegrabber's Issues

Unable To Run this On Ubuntu

root@cuphandtechnology:/home/admin/web/swapnilvishwakarma.com/public_html/pythonscript/UdemyCourseGrabber# python3 main.py
Geckodriver not detected, it will now be downloaded...

Looking for [geckodriver v0.26.0 linux64] driver in cache
File found in cache by path [/root/.wdm/drivers/geckodriver/v0.26.0/linux64/geckodriver]
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/common/service.py", line 76, in start
stdin=PIPE)
File "/usr/lib/python3.6/subprocess.py", line 729, in init
restore_signals, start_new_session)
File "/usr/lib/python3.6/subprocess.py", line 1364, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'geckodriver': 'geckodriver'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/admin/web/swapnilvishwakarma.com/public_html/pythonscript/UdemyCourseGrabber/functions.py", line 291, in
browser = Firefox(options=opts)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/firefox/webdriver.py", line 164, in init
self.service.start()
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/common/service.py", line 83, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "main.py", line 5, in
from functions import *
File "/home/admin/web/swapnilvishwakarma.com/public_html/pythonscript/UdemyCourseGrabber/functions.py", line 294, in
browser = Firefox(executable_path=GeckoDriverManager().install(), options=opts)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/firefox/webdriver.py", line 174, in init
keep_alive=True)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 157, in init
self.start_session(capabilities, browser_profile)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: Unable to find a matching set of capabilities

root@cuphandtechnology:/home/admin/web/swapnilvishwakarma.com/public_html/pythonscript/UdemyCourseGrabber#

Suggestion: TQDM Progress-bars w/ Detailed Search Log

Implementation of TQDM to use a progress bar whilst searching sources, maybe an additional print for each site it is searching to know which part of the repository the program is at in terms of scans for the matching Udemy course.

Browsing context has been discarded

I tried to run it and received:
selenium.common.exceptions.NoSuchWindowException: Message: Browsing context has been discarded

~/UdemyCourseGrabber# python3 main.py
Paste in your Udemy course URL: https://www.udemy.com/course/modern-javascript-from-novice-to-ninja/
Traceback (most recent call last):
  File "main.py", line 13, in <module>
    course_info = get_info(udemy_url)
  File "/root/UdemyCourseGrabber/functions.py", line 248, in get_info
    course_name = get_course_name(udemy_url)
  File "/root/UdemyCourseGrabber/functions.py", line 15, in get_course_name
    browser.find_element_by_css_selector(".btn-primary > span:nth-child(1)")
  File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 598, in find_element_by_css_selector
    return self.find_element(by=By.CSS_SELECTOR, value=css_selector)
  File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 978, in find_element
    'value': value})['value']
  File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchWindowException: Message: Browsing context has been discarded

Great work, please keep it up. Thank you.

This bad boy is missing a README.md file

I noticed your post on reddit with a user saying they didn't know how to run it, this might help other novices to use your very handy script. Plus it's a good opurtunity to give people a good first impression of your project.

Cheers

Working websites

Please comment any websites offering free downloadable Udemy courses.

handle for download_link being NoneType

File "main.py", line 97, in
interactive()
File "main.py", line 63, in interactive
course_info = get_sites(course_name)
File "C:\Users****\UdemyCourseGrabber\functions.py", line 73, in get_sites
if "magnet" in download_link:
TypeError: argument of type 'NoneType' is not iterable

tried replacing

if len(download_link) == 0: continue
with
if len(download_link) == 0 or download_link is None: continue

put that just makes 100 more exceptions I'm too lazy to follow through
to replicate search for "Python for Finance: Investment Fundamentals & Data Analytics"

Load a list of couress in a text file?

Hi there,

If I already have a list of URLs (let's say 200) for the free courses and they are saved into a text file, can I use that text file and load it into your app somehow? I'm just looking for a solution that can go through a predefined list of URLs and add the courses into my Udemy account.

Error involving Geckodriver?

PS X:\UdemyCourseGrabber-master\UdemyCourseGrabber-master> py main.py
Geckodriver not detected, it will now be downloaded...
Traceback (most recent call last):
  File "C:\Users\UNAME\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\common\service.py", line 72, in start
    self.process = subprocess.Popen(cmd, env=self.env,
  File "C:\Users\UNAME\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\UNAME\AppData\Local\Programs\Python\Python38-32\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 specified

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "X:\UdemyCourseGrabber-master\UdemyCourseGrabber-master\functions.py", line 20, in start_browser
    driver = Firefox(firefox_profile=firefox_profile, options=opts)
  File "C:\Users\UNAME\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 164, in __init__
    self.service.start()
  File "C:\Users\UNAME\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start
    raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\UNAME\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\common\service.py", line 72, in start
    self.process = subprocess.Popen(cmd, env=self.env,
  File "C:\Users\UNAME\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\UNAME\AppData\Local\Programs\Python\Python38-32\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 specified

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "main.py", line 6, in <module>
    from functions import *
  File "X:\UdemyCourseGrabber-master\UdemyCourseGrabber-master\functions.py", line 167, in <module>
    browser = start_browser()
  File "X:\UdemyCourseGrabber-master\UdemyCourseGrabber-master\functions.py", line 25, in start_browser
    driver = Firefox(firefox_profile=firefox_profile, options=opts)
  File "C:\Users\UNAME\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 164, in __init__
    self.service.start()
  File "C:\Users\UNAME\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start
    raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.

Returning this error upon every execution of main.py. Where can one obtain the geckodriver?

Crash when a link is not clickable

The script crashes when selenium is unable to perform a click action on an element.

selenium.common.exceptions.ElementClickInterceptedException: Message:
Element <a class="post-url post-title" href="https://SITE_NAME/COURSE_NAME/"> is not
clickable at point (573,681) because another 
element <iframe id="aswift_0" name="aswift_0"> obscures it

I think such errors should be caught and handle properly.

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.