You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.9 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. from ..utils import (
  5. js_to_json,
  6. smuggle_url,
  7. )
  8. class NTVCoJpCUIE(InfoExtractor):
  9. IE_NAME = 'cu.ntv.co.jp'
  10. IE_DESC = 'Nippon Television Network'
  11. _VALID_URL = r'https?://cu\.ntv\.co\.jp/(?!program)(?P<id>[^/?&#]+)'
  12. _TEST = {
  13. 'url': 'https://cu.ntv.co.jp/televiva-chill-gohan_181031/',
  14. 'info_dict': {
  15. 'id': '5978891207001',
  16. 'ext': 'mp4',
  17. 'title': '桜エビと炒り卵がポイント! 「中華風 エビチリおにぎり」──『美虎』五十嵐美幸',
  18. 'upload_date': '20181213',
  19. 'description': 'md5:211b52f4fd60f3e0e72b68b0c6ba52a9',
  20. 'uploader_id': '3855502814001',
  21. 'timestamp': 1544669941,
  22. },
  23. 'params': {
  24. # m3u8 download
  25. 'skip_download': True,
  26. },
  27. }
  28. BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/%s/default_default/index.html?videoId=%s'
  29. def _real_extract(self, url):
  30. display_id = self._match_id(url)
  31. webpage = self._download_webpage(url, display_id)
  32. player_config = self._parse_json(self._search_regex(
  33. r'(?s)PLAYER_CONFIG\s*=\s*({.+?})',
  34. webpage, 'player config'), display_id, js_to_json)
  35. video_id = player_config['videoId']
  36. account_id = player_config.get('account') or '3855502814001'
  37. return {
  38. '_type': 'url_transparent',
  39. 'id': video_id,
  40. 'display_id': display_id,
  41. 'title': self._search_regex(r'<h1[^>]+class="title"[^>]*>([^<]+)', webpage, 'title').strip(),
  42. 'description': self._html_search_meta(['description', 'og:description'], webpage),
  43. 'url': smuggle_url(self.BRIGHTCOVE_URL_TEMPLATE % (account_id, video_id), {'geo_countries': ['JP']}),
  44. 'ie_key': 'BrightcoveNew',
  45. }