diff options
author | Sergey M․ <dstftw@gmail.com> | 2018-09-17 22:14:53 +0700 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2018-09-17 22:14:53 +0700 |
commit | c8f6ab8c38f8397b06028cdea2839d6e25e2c809 (patch) | |
tree | 7f66a79a6a6efd719dfcbb99ea27dc60c194b90f | |
parent | e2f61598be49b75f16b501f7a4d24f4c8c230c49 (diff) |
[udemy] Don't pollute default headers dict
-rw-r--r-- | youtube_dl/extractor/udemy.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/youtube_dl/extractor/udemy.py b/youtube_dl/extractor/udemy.py index 79c45f80e..105826e9b 100644 --- a/youtube_dl/extractor/udemy.py +++ b/youtube_dl/extractor/udemy.py @@ -122,7 +122,9 @@ class UdemyIE(InfoExtractor): raise ExtractorError(error_str, expected=True) def _download_webpage_handle(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' + headers = kwargs.get('headers', {}).copy() + 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' + kwargs['headers'] = headers return super(UdemyIE, self)._download_webpage_handle( *args, **compat_kwargs(kwargs)) |