r0oth3x49 / udemy-dl

A cross-platform python based utility to download courses from udemy for personal offline use.
MIT License
4.85k stars 1.2k forks source link

Error #545

Closed zoeleu closed 4 years ago

zoeleu commented 4 years ago

Describe the bug App not running from cookies

To Reproduce Steps to reproduce the behavior:

  1. run with -k argument and a token file

Expected behavior Idk, run?

Screenshots

Traceback (most recent call last):
  File "udemy-dl.py", line 1442, in <module>
    main()
  File "udemy-dl.py", line 1100, in main
    udemy.course_download(path=options.output, quality=options.quality, unsafe=options.unsafe)
  File "udemy-dl.py", line 436, in course_download
    course = udemy.course(url=self.url, username=self.username, password=self.password, cookies=self.cookies)
  File "C:\Users\Administrator\Documents\udemy-dl\udemy\_udemy.py", line 38, in course
    return Udemy(url, username, password, cookies, basic, callback)
  File "C:\Users\Administrator\Documents\udemy-dl\udemy\_internal.py", line 44, in __init__
    super(InternUdemyCourse, self).__init__(*args, **kwargs)
  File "C:\Users\Administrator\Documents\udemy-dl\udemy\_shared.py", line 62, in __init__
    self._fetch_course()
  File "C:\Users\Administrator\Documents\udemy-dl\udemy\_internal.py", line 52, in _fetch_course
    auth = self._login(cookies=self._cookies)
  File "C:\Users\Administrator\Documents\udemy-dl\udemy\_extract.py", line 81, in _login
    access_token = re.search(r'(?<=access_token=)(\w+)', str(cookies)).group()
AttributeError: 'NoneType' object has no attribute 'group'

Python Environment (please complete the following information):

Additional context Add any other context about the problem here.

r0oth3x49 commented 4 years ago

@matteoturini in your cookies file is there any access_token if not you are providing the wrong cookies, you should provide a cookie containing access_token.

zoeleu commented 4 years ago

No, it was correct. I went, and grabbed the correct token.

zoeleu commented 4 years ago

Udemy changed how tokens work. Every time I refresh, it changes.