Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix emdey free courses download. #18588

Closed
awei78 opened this issue Dec 20, 2018 · 0 comments
Closed

Fix emdey free courses download. #18588

awei78 opened this issue Dec 20, 2018 · 0 comments

Comments

@awei78
Copy link

@awei78 awei78 commented Dec 20, 2018

Please follow the guide below

  • You will be asked some questions and requested to provide some information, please read them carefully and answer honestly
  • Put an x into all the boxes [ ] relevant to your issue (like this: [x])
  • Use the Preview tab to see what your issue will actually look like

Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2018.12.17. If it's not, read this FAQ entry and update. Issues with outdated version will be rejected.

  • I've verified and I assure that I'm running youtube-dl 2018.12.17

Before submitting an issue make sure you have:

  • At least skimmed through the README, most notably the FAQ and BUGS sections
  • Searched the bugtracker for similar issues including closed ones
  • Checked that provided video/audio/playlist URLs (if any) are alive and playable in a browser

What is the purpose of your issue?

  • Bug report (encountered problems with youtube-dl)
  • Site support request (request for adding support for a new site)
  • Feature request (request for a new functionality)
  • Question
  • Other

The following sections concretize particular purposed issues, you can erase any section (the contents between triple ---) not applicable to your issue


It seems that Udemy has recently been revamped. When downloaded with youtube-dl, it prompts:

[udemy:course] the-ultimate-microsoft-office-2016-training-bundle: Downloading w
ebpage
ERROR: Unable to download webpage: HTTP Error 403: Unauthorized (caused by HTTPE
rror()); please report this issue on https://yt-dl.org/bug . Make sure you are u
sing the latest version; type  youtube-dl -U  to update. Be sure to call youtube
-dl with the --verbose flag and include its complete output.

I searched all issues but no solution, only the duplicate flag marked by @dstftw.
How to solve it? modify the file udemy.py:
line 124, the _download_webpage_handle funcion, add Authorization in headers:

    def _download_webpage_handle(self, *args, **kwargs):
        headers = kwargs.get('headers', {}).copy()
        headers['User-Agent'] = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.21 (KHTML, like Gecko) Mwendo/1.1.5 Safari/537.21'
        headers['X-Requested-With'] = 'XMLHttpRequest'
        headers['Host'] = 'www.udemy.com'
        for cookie in self._downloader.cookiejar:
            if cookie.name == 'access_token':
                headers['Authorization'] = cookie.value
                break
        else:
        # This header is taken from https://github.com/FaisalUmair/udemy-downloader-gui thanks to @FaisalUmair for quick help. thank umdey-dl
            headers['Authorization'] = 'Basic YWQxMmVjYTljYmUxN2FmYWM2MjU5ZmU1ZDk4NDcxYTY6YTdjNjMwNjQ2MzA4ODI0YjIzMDFmZGI2MGVjZmQ4YTA5NDdlODJkNQ=='
        kwargs['headers'] = headers
        return super(UdemyIE, self)._download_webpage_handle(
            *args, **compat_kwargs(kwargs))

OK, enjoy it! 

Note: Before using it, you need an account to log in to udemy. and, can only download free courses.

@awei78 awei78 changed the title Fix emdey download. Fix emdey free courses download. Dec 20, 2018
@dstftw dstftw closed this Dec 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.