diff options
author | Sergey M․ <dstftw@gmail.com> | 2018-06-18 04:04:47 +0700 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2018-06-18 04:54:59 +0700 |
commit | 9283d4ea03f907f2b9e7954b0897075a165b4d4c (patch) | |
tree | 9c9d383477024df0463bfd7691d4afd746b64ee0 | |
parent | 00a429bea3c2deacef5dbfb2b0b7e191b1dbaf62 (diff) |
[bbccouk] Use expected_status
-rw-r--r-- | youtube_dl/extractor/bbc.py | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/youtube_dl/extractor/bbc.py b/youtube_dl/extractor/bbc.py index 30a63a24e..293d82b0f 100644 --- a/youtube_dl/extractor/bbc.py +++ b/youtube_dl/extractor/bbc.py @@ -21,7 +21,6 @@ from ..utils import ( urljoin, ) from ..compat import ( - compat_etree_fromstring, compat_HTTPError, compat_urlparse, ) @@ -334,14 +333,9 @@ class BBCCoUkIE(InfoExtractor): self._raise_extractor_error(last_exception) def _download_media_selector_url(self, url, programme_id=None): - try: - media_selection = self._download_xml( - url, programme_id, 'Downloading media selection XML') - 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 + media_selection = self._download_xml( + url, programme_id, 'Downloading media selection XML', + expected_status=(403, 404)) return self._process_media_selector(media_selection, programme_id) def _process_media_selector(self, media_selection, programme_id): |