[ie/wistia] Support password-protected videos (#11100)
[yt-dlp3.git] / yt_dlp / extractor / cam4.py
blob0d0dccb7940ca50e22b4a944c67eca6dd67054ec
1 from .common import InfoExtractor
4 class CAM4IE(InfoExtractor):
5 _VALID_URL = r'https?://(?:[^/]+\.)?cam4\.com/(?P<id>[a-z0-9_]+)'
6 _TEST = {
7 'url': 'https://www.cam4.com/foxynesss',
8 'info_dict': {
9 'id': 'foxynesss',
10 'ext': 'mp4',
11 'title': 're:^foxynesss [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$',
12 'age_limit': 18,
13 'live_status': 'is_live',
14 'thumbnail': 'https://snapshots.xcdnpro.com/thumbnails/foxynesss',
18 def _real_extract(self, url):
19 channel_id = self._match_id(url)
20 m3u8_playlist = self._download_json(f'https://www.cam4.com/rest/v1.0/profile/{channel_id}/streamInfo', channel_id).get('cdnURL')
22 formats = self._extract_m3u8_formats(m3u8_playlist, channel_id, 'mp4', m3u8_id='hls', live=True)
24 return {
25 'id': channel_id,
26 'title': channel_id,
27 'is_live': True,
28 'age_limit': 18,
29 'formats': formats,
30 'thumbnail': f'https://snapshots.xcdnpro.com/thumbnails/{channel_id}',