logo

youtube-dl

[mirror] Download/Watch videos from video hostersgit clone https://hacktivis.me/git/mirror/youtube-dl.git

maoritv.py (1235B)


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