3 from .common
import InfoExtractor
11 class GronkhIE(InfoExtractor
):
12 _VALID_URL
= r
'https?://(?:www\.)?gronkh\.tv/(?:watch/)?streams?/(?P<id>\d+)'
15 'url': 'https://gronkh.tv/streams/657',
19 'title': 'H.O.R.D.E. - DAS ZWEiTE ZEiTALTER 🎲 Session 1',
21 'thumbnail': 'https://01.cdn.vod.farm/preview/9e2555d3a23bf4e5c5b7c6b3b70a9d84.jpg',
22 'upload_date': '20221111'
24 'params': {'skip_download': True}
26 'url': 'https://gronkh.tv/stream/536',
30 'title': 'GTV0536, 2021-10-01 - MARTHA IS DEAD #FREiAB1830 !FF7 !horde !archiv',
32 'thumbnail': 'https://01.cdn.vod.farm/preview/6436746cce14e25f751260a692872b9b.jpg',
33 'upload_date': '20211001'
35 'params': {'skip_download': True}
37 'url': 'https://gronkh.tv/watch/stream/546',
38 'only_matching': True,
41 def _real_extract(self
, url
):
42 id = self
._match
_id
(url
)
43 data_json
= self
._download
_json
(f
'https://api.gronkh.tv/v1/video/info?episode={id}', id)
44 m3u8_url
= self
._download
_json
(f
'https://api.gronkh.tv/v1/video/playlist?episode={id}', id)['playlist_url']
45 formats
, subtitles
= self
._extract
_m
3u8_formats
_and
_subtitles
(m3u8_url
, id)
46 if data_json
.get('vtt_url'):
47 subtitles
.setdefault('en', []).append({
48 'url': data_json
['vtt_url'],
53 'title': data_json
.get('title'),
54 'view_count': data_json
.get('views'),
55 'thumbnail': data_json
.get('preview_url'),
56 'upload_date': unified_strdate(data_json
.get('created_at')),
58 'subtitles': subtitles
,
62 class GronkhFeedIE(InfoExtractor
):
63 _VALID_URL
= r
'https?://(?:www\.)?gronkh\.tv(?:/feed)?/?(?:#|$)'
64 IE_NAME
= 'gronkh:feed'
67 'url': 'https://gronkh.tv/feed',
73 'url': 'https://gronkh.tv',
74 'only_matching': True,
78 for type_
in ('recent', 'views'):
79 info
= self
._download
_json
(
80 f
'https://api.gronkh.tv/v1/video/discovery/{type_}', 'feed', note
=f
'Downloading {type_} API JSON')
81 for item
in traverse_obj(info
, ('discovery', ...)) or []:
82 yield self
.url_result(f
'https://gronkh.tv/watch/stream/{item["episode"]}', GronkhIE
, item
.get('title'))
84 def _real_extract(self
, url
):
85 return self
.playlist_result(self
._entries
(), 'feed')
88 class GronkhVodsIE(InfoExtractor
):
89 _VALID_URL
= r
'https?://(?:www\.)?gronkh\.tv/vods/streams/?(?:#|$)'
90 IE_NAME
= 'gronkh:vods'
93 'url': 'https://gronkh.tv/vods/streams',
97 'playlist_mincount': 150,
101 def _fetch_page(self
, page
):
102 items
= traverse_obj(self
._download
_json
(
103 'https://api.gronkh.tv/v1/search', 'vods', query
={'offset': self._PER_PAGE * page, 'first': self._PER_PAGE}
,
104 note
=f
'Downloading stream video page {page + 1}'), ('results', 'videos', ...))
105 for item
in items
or []:
106 yield self
.url_result(f
'https://gronkh.tv/watch/stream/{item["episode"]}', GronkhIE
, item
['episode'], item
.get('title'))
108 def _real_extract(self
, url
):
109 entries
= OnDemandPagedList(functools
.partial(self
._fetch
_page
), self
._PER
_PAGE
)
110 return self
.playlist_result(entries
, 'vods')