1 from .common
import InfoExtractor
10 class GoodGameIE(InfoExtractor
):
11 IE_NAME
= 'goodgame:stream'
12 _VALID_URL
= r
'https?://goodgame\.ru/channel/(?P<id>\w+)'
14 'url': 'https://goodgame.ru/channel/Pomi/#autoplay',
18 'title': r
're:Reynor vs Special \(1/2,bo3\) Wardi Spring EU \- playoff \(финальный день\) \d{4}-\d{2}-\d{2} \d{2}:\d{2}$',
21 'channel_url': 'https://goodgame.ru/channel/Pomi/',
22 'description': 'md5:4a87b775ee7b2b57bdccebe285bbe171',
23 'thumbnail': r
're:^https?://.*\.jpg$',
24 'live_status': 'is_live',
27 'params': {'skip_download': 'm3u8'},
28 'skip': 'May not be online',
31 def _real_extract(self
, url
):
32 channel_name
= self
._match
_id
(url
)
33 response
= self
._download
_json
(f
'https://api2.goodgame.ru/v2/streams/{channel_name}', channel_name
)
34 player_id
= response
['channel']['gg_player_src']
36 formats
, subtitles
= [], {}
37 if response
.get('status') == 'Live':
38 formats
, subtitles
= self
._extract
_m
3u8_formats
_and
_subtitles
(
39 f
'https://hls.goodgame.ru/manifest/{player_id}_master.m3u8',
40 channel_name
, 'mp4', live
=True)
42 self
.raise_no_formats('User is offline', expected
=True, video_id
=channel_name
)
47 'subtitles': subtitles
,
48 'title': traverse_obj(response
, ('channel', 'title')),
49 'channel': channel_name
,
50 'channel_id': str_or_none(traverse_obj(response
, ('channel', 'id'))),
51 'channel_url': response
.get('url'),
52 'description': clean_html(traverse_obj(response
, ('channel', 'description'))),
53 'thumbnail': traverse_obj(response
, ('channel', 'thumb')),
54 'is_live': bool(formats
),
55 'view_count': int_or_none(response
.get('viewers')),
56 'age_limit': 18 if traverse_obj(response
, ('channel', 'adult')) else None,