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 545 forks source link

[BUG] idownloadcoupon scraper error #432

Open MohamedIO opened 1 year ago

MohamedIO commented 1 year ago

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):

samin-irtiza commented 1 year ago

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

MohamedIO commented 1 year ago

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]))
                                                        ~~~~^^^
samin-irtiza commented 1 year ago

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.

Hussnain12 commented 1 year ago

@samin-irtiza your code worked perfectly. Thanks