mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-21 20:46:36 -05:00
[bbccouk] Use expected_status
This commit is contained in:
parent
00a429bea3
commit
9283d4ea03
1 changed files with 3 additions and 9 deletions
|
@ -21,7 +21,6 @@
|
||||||
urljoin,
|
urljoin,
|
||||||
)
|
)
|
||||||
from ..compat import (
|
from ..compat import (
|
||||||
compat_etree_fromstring,
|
|
||||||
compat_HTTPError,
|
compat_HTTPError,
|
||||||
compat_urlparse,
|
compat_urlparse,
|
||||||
)
|
)
|
||||||
|
@ -334,14 +333,9 @@ def _download_media_selector(self, programme_id):
|
||||||
self._raise_extractor_error(last_exception)
|
self._raise_extractor_error(last_exception)
|
||||||
|
|
||||||
def _download_media_selector_url(self, url, programme_id=None):
|
def _download_media_selector_url(self, url, programme_id=None):
|
||||||
try:
|
media_selection = self._download_xml(
|
||||||
media_selection = self._download_xml(
|
url, programme_id, 'Downloading media selection XML',
|
||||||
url, programme_id, 'Downloading media selection XML')
|
expected_status=(403, 404))
|
||||||
except ExtractorError as ee:
|
|
||||||
if isinstance(ee.cause, compat_HTTPError) and ee.cause.code in (403, 404):
|
|
||||||
media_selection = compat_etree_fromstring(ee.cause.read().decode('utf-8'))
|
|
||||||
else:
|
|
||||||
raise
|
|
||||||
return self._process_media_selector(media_selection, programme_id)
|
return self._process_media_selector(media_selection, programme_id)
|
||||||
|
|
||||||
def _process_media_selector(self, media_selection, programme_id):
|
def _process_media_selector(self, media_selection, programme_id):
|
||||||
|
|
Loading…
Reference in a new issue