]>
Commit | Line | Data |
---|---|---|
920134b2 AG |
1 | from .common import InfoExtractor |
2 | from ..utils import unified_strdate | |
3 | ||
4 | ||
5 | class GronkhIE(InfoExtractor): | |
375d9360 | 6 | _VALID_URL = r'https?://(?:www\.)?gronkh\.tv/(?:watch/)?stream/(?P<id>\d+)' |
920134b2 AG |
7 | |
8 | _TESTS = [{ | |
9 | 'url': 'https://gronkh.tv/stream/536', | |
10 | 'info_dict': { | |
11 | 'id': '536', | |
12 | 'ext': 'mp4', | |
13 | 'title': 'GTV0536, 2021-10-01 - MARTHA IS DEAD #FREiAB1830 !FF7 !horde !archiv', | |
14 | 'view_count': 19491, | |
15 | 'thumbnail': 'https://01.cdn.vod.farm/preview/6436746cce14e25f751260a692872b9b.jpg', | |
16 | 'upload_date': '20211001' | |
17 | }, | |
18 | 'params': {'skip_download': True} | |
375d9360 S |
19 | }, { |
20 | 'url': 'https://gronkh.tv/watch/stream/546', | |
21 | 'only_matching': True, | |
920134b2 AG |
22 | }] |
23 | ||
24 | def _real_extract(self, url): | |
25 | id = self._match_id(url) | |
26 | data_json = self._download_json(f'https://api.gronkh.tv/v1/video/info?episode={id}', id) | |
27 | m3u8_url = self._download_json(f'https://api.gronkh.tv/v1/video/playlist?episode={id}', id)['playlist_url'] | |
28 | formats, subtitles = self._extract_m3u8_formats_and_subtitles(m3u8_url, id) | |
29 | if data_json.get('vtt_url'): | |
30 | subtitles.setdefault('en', []).append({ | |
31 | 'url': data_json['vtt_url'], | |
32 | 'ext': 'vtt', | |
33 | }) | |
34 | self._sort_formats(formats) | |
35 | return { | |
36 | 'id': id, | |
37 | 'title': data_json.get('title'), | |
38 | 'view_count': data_json.get('views'), | |
39 | 'thumbnail': data_json.get('preview_url'), | |
40 | 'upload_date': unified_strdate(data_json.get('created_at')), | |
41 | 'formats': formats, | |
42 | 'subtitles': subtitles, | |
43 | } |