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