]>
Commit | Line | Data |
---|---|---|
bfbecd11 L |
1 | import re |
2 | ||
3 | from .common import InfoExtractor | |
4 | from ..utils import ExtractorError | |
5 | ||
6 | ||
7 | class NewsPicksIE(InfoExtractor): | |
d2c8aadf | 8 | _VALID_URL = r'https://newspicks\.com/movie-series/(?P<channel_id>\d+)\?movieId=(?P<id>\d+)' |
bfbecd11 L |
9 | |
10 | _TESTS = [{ | |
11 | 'url': 'https://newspicks.com/movie-series/11?movieId=1813', | |
12 | 'info_dict': { | |
13 | 'id': '1813', | |
14 | 'title': '日本の課題を破壊せよ【ゲスト:成田悠輔】', | |
15 | 'description': 'md5:09397aad46d6ded6487ff13f138acadf', | |
16 | 'channel': 'HORIE ONE', | |
17 | 'channel_id': '11', | |
18 | 'release_date': '20220117', | |
19 | 'thumbnail': r're:https://.+jpg', | |
20 | 'ext': 'mp4', | |
21 | }, | |
22 | }] | |
23 | ||
24 | def _real_extract(self, url): | |
25 | video_id, channel_id = self._match_valid_url(url).group('id', 'channel_id') | |
26 | webpage = self._download_webpage(url, video_id) | |
27 | entries = self._parse_html5_media_entries( | |
28 | url, webpage.replace('movie-for-pc', 'movie'), video_id, 'hls') | |
29 | if not entries: | |
30 | raise ExtractorError('No HTML5 media elements found') | |
31 | info = entries[0] | |
32 | self._sort_formats(info['formats']) | |
33 | ||
34 | title = self._html_search_meta('og:title', webpage, fatal=False) | |
35 | description = self._html_search_meta( | |
36 | ('og:description', 'twitter:title'), webpage, fatal=False) | |
37 | channel = self._html_search_regex( | |
38 | r'value="11".+?<div\s+class="title">(.+?)</div', webpage, 'channel name', fatal=False) | |
39 | if not title or not channel: | |
40 | title, channel = re.split(r'\s*|\s*', self._html_extract_title(webpage)) | |
41 | ||
42 | release_date = self._search_regex( | |
43 | r'<span\s+class="on-air-date">\s*(\d+)年(\d+)月(\d+)日\s*</span>', | |
44 | webpage, 'release date', fatal=False, group=(1, 2, 3)) | |
45 | ||
46 | info.update({ | |
47 | 'id': video_id, | |
48 | 'title': title, | |
49 | 'description': description, | |
50 | 'channel': channel, | |
51 | 'channel_id': channel_id, | |
52 | 'release_date': ('%04d%02d%02d' % tuple(map(int, release_date))) if release_date else None, | |
53 | }) | |
54 | return info |