mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-14 12:23:19 +00:00
[udemy,xiami,yandexmusic] Override _download_webpage_handle instead of _download_webpage
This commit is contained in:
parent
30226342ab
commit
e5eadfa82f
|
@ -115,9 +115,9 @@ def _handle_error(self, response):
|
||||||
error_str += ' - %s' % error_data.get('formErrors')
|
error_str += ' - %s' % error_data.get('formErrors')
|
||||||
raise ExtractorError(error_str, expected=True)
|
raise ExtractorError(error_str, expected=True)
|
||||||
|
|
||||||
def _download_webpage(self, *args, **kwargs):
|
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'
|
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(
|
return super(UdemyIE, self)._download_webpage_handle(
|
||||||
*args, **compat_kwargs(kwargs))
|
*args, **compat_kwargs(kwargs))
|
||||||
|
|
||||||
def _download_json(self, url_or_request, *args, **kwargs):
|
def _download_json(self, url_or_request, *args, **kwargs):
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
class XiamiBaseIE(InfoExtractor):
|
class XiamiBaseIE(InfoExtractor):
|
||||||
_API_BASE_URL = 'http://www.xiami.com/song/playlist/cat/json/id'
|
_API_BASE_URL = 'http://www.xiami.com/song/playlist/cat/json/id'
|
||||||
|
|
||||||
def _download_webpage(self, *args, **kwargs):
|
def _download_webpage_handle(self, *args, **kwargs):
|
||||||
webpage = super(XiamiBaseIE, self)._download_webpage(*args, **kwargs)
|
webpage = super(XiamiBaseIE, self)._download_webpage_handle(*args, **kwargs)
|
||||||
if '>Xiami is currently not available in your country.<' in webpage:
|
if '>Xiami is currently not available in your country.<' in webpage:
|
||||||
self.raise_geo_restricted('Xiami is currently not available in your country')
|
self.raise_geo_restricted('Xiami is currently not available in your country')
|
||||||
return webpage
|
return webpage
|
||||||
|
|
|
@ -34,8 +34,8 @@ def _raise_captcha():
|
||||||
'youtube-dl with --cookies',
|
'youtube-dl with --cookies',
|
||||||
expected=True)
|
expected=True)
|
||||||
|
|
||||||
def _download_webpage(self, *args, **kwargs):
|
def _download_webpage_handle(self, *args, **kwargs):
|
||||||
webpage = super(YandexMusicBaseIE, self)._download_webpage(*args, **kwargs)
|
webpage = super(YandexMusicBaseIE, self)._download_webpage_handle(*args, **kwargs)
|
||||||
if 'Нам очень жаль, но запросы, поступившие с вашего IP-адреса, похожи на автоматические.' in webpage:
|
if 'Нам очень жаль, но запросы, поступившие с вашего IP-адреса, похожи на автоматические.' in webpage:
|
||||||
self._raise_captcha()
|
self._raise_captcha()
|
||||||
return webpage
|
return webpage
|
||||||
|
|
Loading…
Reference in a new issue