Skip to content

Commit 4fb25ff

Browse files
krislremitamine
authored andcommitted
[maoritv] Add new extractor(closes ytdl-org#24552)
1 parent 1b0a13f commit 4fb25ff

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

youtube_dl/extractor/extractors.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,7 @@
640640
MangomoloLiveIE,
641641
)
642642
from .manyvids import ManyVidsIE
643+
from .maoritv import MaoriTVIE
643644
from .markiza import (
644645
MarkizaIE,
645646
MarkizaPageIE,

youtube_dl/extractor/maoritv.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# coding: utf-8
2+
from __future__ import unicode_literals
3+
4+
from .common import InfoExtractor
5+
6+
7+
class MaoriTVIE(InfoExtractor):
8+
_VALID_URL = r'https?://(?:www\.)?maoritelevision\.com/shows/(?:[^/]+/)+(?P<id>[^/?&#]+)'
9+
_TEST = {
10+
'url': 'https://www.maoritelevision.com/shows/korero-mai/S01E054/korero-mai-series-1-episode-54',
11+
'md5': '5ade8ef53851b6a132c051b1cd858899',
12+
'info_dict': {
13+
'id': '4774724855001',
14+
'ext': 'mp4',
15+
'title': 'Kōrero Mai, Series 1 Episode 54',
16+
'upload_date': '20160226',
17+
'timestamp': 1456455018,
18+
'description': 'md5:59bde32fd066d637a1a55794c56d8dcb',
19+
'uploader_id': '1614493167001',
20+
},
21+
}
22+
BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/1614493167001/HJlhIQhQf_default/index.html?videoId=%s'
23+
24+
def _real_extract(self, url):
25+
display_id = self._match_id(url)
26+
webpage = self._download_webpage(url, display_id)
27+
brightcove_id = self._search_regex(
28+
r'data-main-video-id=["\'](\d+)', webpage, 'brightcove id')
29+
return self.url_result(
30+
self.BRIGHTCOVE_URL_TEMPLATE % brightcove_id,
31+
'BrightcoveNew', brightcove_id)

0 commit comments

Comments
 (0)