[maoritv] Add new extractor(closes #24552)
authorAaron Lipinski <kris.lipinski@gmail.com>
Thu, 8 Apr 2021 07:59:36 +0000 (19:59 +1200)
committerRemita Amine <remitamine@gmail.com>
Fri, 9 Apr 2021 08:02:37 +0000 (09:02 +0100)
youtube_dl/extractor/extractors.py
youtube_dl/extractor/maoritv.py [new file with mode: 0644]

index 5ff9110b4ef4f16130e0a057a3888a572ec7d24b..ac33cd996dcc5b59468cc9121b71e8a296447233 100644 (file)
@@ -640,6 +640,7 @@ from .mangomolo import (
     MangomoloLiveIE,
 )
 from .manyvids import ManyVidsIE
+from .maoritv import MaoriTVIE
 from .markiza import (
     MarkizaIE,
     MarkizaPageIE,
diff --git a/youtube_dl/extractor/maoritv.py b/youtube_dl/extractor/maoritv.py
new file mode 100644 (file)
index 0000000..0d23fec
--- /dev/null
@@ -0,0 +1,31 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+
+
+class MaoriTVIE(InfoExtractor):
+    _VALID_URL = r'https?://(?:www\.)?maoritelevision\.com/shows/(?:[^/]+/)+(?P<id>[^/?&#]+)'
+    _TEST = {
+        'url': 'https://www.maoritelevision.com/shows/korero-mai/S01E054/korero-mai-series-1-episode-54',
+        'md5': '5ade8ef53851b6a132c051b1cd858899',
+        'info_dict': {
+            'id': '4774724855001',
+            'ext': 'mp4',
+            'title': 'Kōrero Mai, Series 1 Episode 54',
+            'upload_date': '20160226',
+            'timestamp': 1456455018,
+            'description': 'md5:59bde32fd066d637a1a55794c56d8dcb',
+            'uploader_id': '1614493167001',
+        },
+    }
+    BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/1614493167001/HJlhIQhQf_default/index.html?videoId=%s'
+
+    def _real_extract(self, url):
+        display_id = self._match_id(url)
+        webpage = self._download_webpage(url, display_id)
+        brightcove_id = self._search_regex(
+            r'data-main-video-id=["\'](\d+)', webpage, 'brightcove id')
+        return self.url_result(
+            self.BRIGHTCOVE_URL_TEMPLATE % brightcove_id,
+            'BrightcoveNew', brightcove_id)