]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/dbtv.py
[ie/youtube] Suppress "Unavailable videos are hidden" warning (#10159)
[yt-dlp.git] / yt_dlp / extractor / dbtv.py
index 2beccd8b51566f1912c9c39b6a42eff9b1332898..795fbacc417e4fbd413d0bed35014972f4b69e19 100644 (file)
@@ -1,10 +1,9 @@
-import re
-
 from .common import InfoExtractor
 
 
 class DBTVIE(InfoExtractor):
     _VALID_URL = r'https?://(?:www\.)?dagbladet\.no/video/(?:(?:embed|(?P<display_id>[^/]+))/)?(?P<id>[0-9A-Za-z_-]{11}|[a-zA-Z0-9]{8})'
+    _EMBED_REGEX = [r'<iframe[^>]+src=(["\'])(?P<url>(?:https?:)?//(?:www\.)?dagbladet\.no/video/embed/(?:[0-9A-Za-z_-]{11}|[a-zA-Z0-9]{8}).*?)\1']
     _TESTS = [{
         'url': 'https://www.dagbladet.no/video/PynxJnNWChE/',
         'md5': 'b8f850ba1860adbda668d367f9b77699',
@@ -19,7 +18,7 @@ class DBTVIE(InfoExtractor):
             'uploader_id': 'UCk5pvsyZJoYJBd7_oFPTlRQ',
             'uploader': 'Dagbladet',
         },
-        'add_ie': ['Youtube']
+        'add_ie': ['Youtube'],
     }, {
         'url': 'https://www.dagbladet.no/video/embed/xlGmyIeN9Jo/?autoplay=false',
         'only_matching': True,
@@ -28,12 +27,6 @@ class DBTVIE(InfoExtractor):
         'only_matching': True,
     }]
 
-    @staticmethod
-    def _extract_urls(webpage):
-        return [url for _, url in re.findall(
-            r'<iframe[^>]+src=(["\'])((?:https?:)?//(?:www\.)?dagbladet\.no/video/embed/(?:[0-9A-Za-z_-]{11}|[a-zA-Z0-9]{8}).*?)\1',
-            webpage)]
-
     def _real_extract(self, url):
         display_id, video_id = self._match_valid_url(url).groups()
         info = {