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!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] idownloadcoupon scraper error

MohamedTechPro opened this issue · comments

Describe the bug
This is the error log.

Error while running idownloadcoupon scraper: list index out of range
Traceback (most recent call last):
  File "Automatic-Udemy-Course-Enroller-GET-PAID-UDEMY-COURSES-for-FREE/udemy_enroller/scrapers/base_scraper.py", line 90, in wrapper
    response = await func(self)
  File "Automatic-Udemy-Course-Enroller-GET-PAID-UDEMY-COURSES-for-FREE/udemy_enroller/scrapers/idownloadcoupon.py", line 36, in run
    links = await self.get_links()
  File "Automatic-Udemy-Course-Enroller-GET-PAID-UDEMY-COURSES-for-FREE/udemy_enroller/scrapers/idownloadcoupon.py", line 54, in get_links
    udemy_links = await self.gather_udemy_course_links(course_links)
  File "Automatic-Udemy-Course-Enroller-GET-PAID-UDEMY-COURSES-for-FREE/udemy_enroller/scrapers/idownloadcoupon.py", line 104, in gather_udemy_course_links
    for link in await asyncio.gather(*map(self.get_udemy_course_link, courses))
  File "Automatic-Udemy-Course-Enroller-GET-PAID-UDEMY-COURSES-for-FREE/udemy_enroller/scrapers/idownloadcoupon.py", line 93, in get_udemy_course_link
    return cls.validate_coupon_url(urllib.parse.unquote(urls[1]))
IndexError: list index out of range

To Reproduce
Steps to reproduce the behavior:

  1. Clone the repo or install it from pypi.
  2. Install dependencies.
  3. cd to repo directory.
  4. python run_enroller.py
  5. See error

Expected behavior
All scrapers works fine.

Desktop (please complete the following information):

  • OS: Arch Linux
  • Version 4.1.3

Hi,
I issued a fix. hope it helps :)

i got this error:

Error while running idownloadcoupon scraper: list index out of range
Traceback (most recent call last):
  File "Automatic-Udemy-Course-Enroller-GET-PAID-UDEMY-COURSES-for-FREE/udemy_enroller/scrapers/base_scraper.py", line 90, in wrapper
    response = await func(self)
               ^^^^^^^^^^^^^^^^
  File "Automatic-Udemy-Course-Enroller-GET-PAID-UDEMY-COURSES-for-FREE/udemy_enroller/scrapers/idownloadcoupon.py", line 36, in run
    links = await self.get_links()
            ^^^^^^^^^^^^^^^^^^^^^^
  File "Automatic-Udemy-Course-Enroller-GET-PAID-UDEMY-COURSES-for-FREE/udemy_enroller/scrapers/idownloadcoupon.py", line 54, in get_links
    udemy_links = await self.gather_udemy_course_links(course_links)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "Automatic-Udemy-Course-Enroller-GET-PAID-UDEMY-COURSES-for-FREE/udemy_enroller/scrapers/idownloadcoupon.py", line 104, in gather_udemy_course_links
    for link in await asyncio.gather(*map(self.get_udemy_course_link, courses))
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "Automatic-Udemy-Course-Enroller-GET-PAID-UDEMY-COURSES-for-FREE/udemy_enroller/scrapers/idownloadcoupon.py", line 93, in get_udemy_course_link
    return cls.validate_coupon_url(urllib.parse.unquote(urls[1]))
                                                        ~~~~^^^

My PR hasn't been accepted yet. you are using old code. so you're getting the same error. if you want to test my code go to the PR and use that version at your own risk I should add.

@samin-irtiza your code worked perfectly. Thanks