3 from .common
import InfoExtractor
11 class GronkhIE(InfoExtractor
):
12 _VALID_URL
= r
'https?://(?:www\.)?gronkh\.tv/(?:watch/)?stream/(?P<id>\d+)'
15 'url': 'https://gronkh.tv/stream/536',
19 'title': 'GTV0536, 2021-10-01 - MARTHA IS DEAD #FREiAB1830 !FF7 !horde !archiv',
21 'thumbnail': 'https://01.cdn.vod.farm/preview/6436746cce14e25f751260a692872b9b.jpg',
22 'upload_date': '20211001'
24 'params': {'skip_download': True}
26 'url': 'https://gronkh.tv/watch/stream/546',
27 'only_matching': True,
30 def _real_extract(self
, url
):
31 id = self
._match
_id
(url
)
32 data_json
= self
._download
_json
(f
'https://api.gronkh.tv/v1/video/info?episode={id}', id)
33 m3u8_url
= self
._download
_json
(f
'https://api.gronkh.tv/v1/video/playlist?episode={id}', id)['playlist_url']
34 formats
, subtitles
= self
._extract
_m
3u8_formats
_and
_subtitles
(m3u8_url
, id)
35 if data_json
.get('vtt_url'):
36 subtitles
.setdefault('en', []).append({
37 'url': data_json
['vtt_url'],
40 self
._sort
_formats
(formats
)
43 'title': data_json
.get('title'),
44 'view_count': data_json
.get('views'),
45 'thumbnail': data_json
.get('preview_url'),
46 'upload_date': unified_strdate(data_json
.get('created_at')),
48 'subtitles': subtitles
,
52 class GronkhFeedIE(InfoExtractor
):
53 _VALID_URL
= r
'https?://(?:www\.)?gronkh\.tv(?:/feed)?/?(?:#|$)'
54 IE_NAME
= 'gronkh:feed'
57 'url': 'https://gronkh.tv/feed',
63 'url': 'https://gronkh.tv',
64 'only_matching': True,
68 for type_
in ('recent', 'views'):
69 info
= self
._download
_json
(
70 f
'https://api.gronkh.tv/v1/video/discovery/{type_}', 'feed', note
=f
'Downloading {type_} API JSON')
71 for item
in traverse_obj(info
, ('discovery', ...)) or []:
72 yield self
.url_result(f
'https://gronkh.tv/watch/stream/{item["episode"]}', GronkhIE
, item
.get('title'))
74 def _real_extract(self
, url
):
75 return self
.playlist_result(self
._entries
(), 'feed')
78 class GronkhVodsIE(InfoExtractor
):
79 _VALID_URL
= r
'https?://(?:www\.)?gronkh\.tv/vods/streams/?(?:#|$)'
80 IE_NAME
= 'gronkh:vods'
83 'url': 'https://gronkh.tv/vods/streams',
87 'playlist_mincount': 150,
91 def _fetch_page(self
, page
):
92 items
= traverse_obj(self
._download
_json
(
93 'https://api.gronkh.tv/v1/search', 'vods', query
={'offset': self._PER_PAGE * page, 'first': self._PER_PAGE}
,
94 note
=f
'Downloading stream video page {page + 1}'), ('results', 'videos', ...))
95 for item
in items
or []:
96 yield self
.url_result(f
'https://gronkh.tv/watch/stream/{item["episode"]}', GronkhIE
, item
['episode'], item
.get('title'))
98 def _real_extract(self
, url
):
99 entries
= OnDemandPagedList(functools
.partial(self
._fetch
_page
), self
._PER
_PAGE
)
100 return self
.playlist_result(entries
, 'vods')