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.

50 lines
1.9 KiB

  1. from __future__ import unicode_literals
  2. from .common import InfoExtractor
  3. class NhkVodIE(InfoExtractor):
  4. _VALID_URL = r'https?://www3\.nhk\.or\.jp/nhkworld/en/vod/(?P<id>.+?)\.html'
  5. _TEST = {
  6. # Videos available only for a limited period of time. Visit
  7. # http://www3.nhk.or.jp/nhkworld/en/vod/ for working samples.
  8. 'url': 'http://www3.nhk.or.jp/nhkworld/en/vod/tokyofashion/20160815.html',
  9. 'info_dict': {
  10. 'id': 'A1bnNiNTE6nY3jLllS-BIISfcC_PpvF5',
  11. 'ext': 'flv',
  12. 'title': 'TOKYO FASHION EXPRESS - The Kimono as Global Fashion',
  13. 'description': 'md5:db338ee6ce8204f415b754782f819824',
  14. 'series': 'TOKYO FASHION EXPRESS',
  15. 'episode': 'The Kimono as Global Fashion',
  16. },
  17. 'skip': 'Videos available only for a limited period of time',
  18. }
  19. def _real_extract(self, url):
  20. video_id = self._match_id(url)
  21. webpage = self._download_webpage(url, video_id)
  22. embed_code = self._search_regex(
  23. r'nw_vod_ooplayer\([^,]+,\s*(["\'])(?P<id>(?:(?!\1).)+)\1',
  24. webpage, 'ooyala embed code', group='id')
  25. title = self._search_regex(
  26. r'<div[^>]+class=["\']episode-detail["\']>\s*<h\d+>([^<]+)',
  27. webpage, 'title', default=None)
  28. description = self._html_search_regex(
  29. r'(?s)<p[^>]+class=["\']description["\'][^>]*>(.+?)</p>',
  30. webpage, 'description', default=None)
  31. series = self._search_regex(
  32. r'<h2[^>]+class=["\']detail-top-player-title[^>]+><a[^>]+>([^<]+)',
  33. webpage, 'series', default=None)
  34. return {
  35. '_type': 'url_transparent',
  36. 'ie_key': 'Ooyala',
  37. 'url': 'ooyala:%s' % embed_code,
  38. 'title': '%s - %s' % (series, title) if series and title else title,
  39. 'description': description,
  40. 'series': series,
  41. 'episode': title,
  42. }