From 681b39032ae34709a74c5a4ab8f0d2275aab6880 Mon Sep 17 00:00:00 2001 From: Bart Broere Date: Wed, 6 Mar 2024 12:32:34 +0100 Subject: [PATCH] Fix flake8 and better error reporting --- youtube_dl/extractor/npo.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/youtube_dl/extractor/npo.py b/youtube_dl/extractor/npo.py index a28915bd0..c4e4097e3 100644 --- a/youtube_dl/extractor/npo.py +++ b/youtube_dl/extractor/npo.py @@ -166,7 +166,8 @@ class ONIE(NPOIE): formats.extend(self._download_by_product_id(result, video_id)) if not formats: - raise ExtractorError('Could not find a POMS product id in the provided URL.') + raise ExtractorError('Could not find a POMS product id in the provided URL, ' + 'perhaps because all stream URLs are DRM protected.') return { 'id': video_id, @@ -187,14 +188,15 @@ class VPROIE(NPOIE): def _real_extract(self, url): video_id = url.rstrip('/').split('/')[-1] page, _ = self._download_webpage_handle(url, video_id) - results = re.findall('data-media-id="(.+_.+)"\s', page) + results = re.findall(r'data-media-id="(.+_.+)"\s', page) formats = [] for result in results: formats.extend(self._download_by_product_id(result, video_id)) break # TODO find a better solution, VPRO pages can have multiple videos embedded if not formats: - raise ExtractorError('Could not find a POMS product id in the provided URL.') + raise ExtractorError('Could not find a POMS product id in the provided URL, ' + 'perhaps because all stream URLs are DRM protected.') return { 'id': video_id, @@ -238,6 +240,8 @@ class SchoolTVIE(NPOIE): def _real_extract(self, url): video_id = url.rstrip('/').split('/')[-1] + # TODO Find out how we could obtain this automatically + # Otherwise this extractor might break each time SchoolTV deploys a new release build_id = 'b7eHUzAVO7wHXCopYxQhV' metadata_url = 'https://schooltv.nl/_next/data/' \ @@ -251,7 +255,8 @@ class SchoolTVIE(NPOIE): formats = self._download_by_product_id(metadata.get('poms_mid'), video_id) if not formats: - raise ExtractorError('Could not find a POMS product id in the provided URL.') + raise ExtractorError('Could not find a POMS product id in the provided URL, ' + 'perhaps because all stream URLs are DRM protected.') return { 'id': video_id,