diff options
author | Sergey M․ <dstftw@gmail.com> | 2018-02-26 04:12:28 +0700 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2018-02-26 04:12:53 +0700 |
commit | abe8766c35bb33e4d8ef3dc516ed210f3b4dacd2 (patch) | |
tree | c2d502b6b92c79600b8008f920f26962a9b7d49f | |
parent | eaa3172672ff0fbf4a287e332596beb40ecd78ab (diff) |
[udemy] Use custom User-Agent (closes #15571)
-rw-r--r-- | youtube_dl/extractor/udemy.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/youtube_dl/extractor/udemy.py b/youtube_dl/extractor/udemy.py index 195f5ce78..6d6c0a98f 100644 --- a/youtube_dl/extractor/udemy.py +++ b/youtube_dl/extractor/udemy.py @@ -5,6 +5,7 @@ import re from .common import InfoExtractor from ..compat import ( compat_HTTPError, + compat_kwargs, compat_str, compat_urllib_request, compat_urlparse, @@ -114,6 +115,11 @@ class UdemyIE(InfoExtractor): error_str += ' - %s' % error_data.get('formErrors') raise ExtractorError(error_str, expected=True) + def _download_webpage(self, *args, **kwargs): + kwargs.setdefault('headers', {})['User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/603.2.4 (KHTML, like Gecko) Version/10.1.1 Safari/603.2.4' + return super(UdemyIE, self)._download_webpage( + *args, **compat_kwargs(kwargs)) + def _download_json(self, url_or_request, *args, **kwargs): headers = { 'X-Udemy-Snail-Case': 'true', |