1 from .common
import InfoExtractor
2 from ..utils
import int_or_none
, url_or_none
5 class CamModelsIE(InfoExtractor
):
6 _VALID_URL
= r
'https?://(?:www\.)?cammodels\.com/cam/(?P<id>[^/?#&]+)'
8 'url': 'https://www.cammodels.com/cam/AutumnKnight/',
13 def _real_extract(self
, url
):
14 user_id
= self
._match
_id
(url
)
16 manifest
= self
._download
_json
(
17 f
'https://manifest-server.naiadsystems.com/live/s:{user_id}.json', user_id
)
21 for format_id
, format_dict
in manifest
['formats'].items():
22 if not isinstance(format_dict
, dict):
24 encodings
= format_dict
.get('encodings')
25 if not isinstance(encodings
, list):
27 vcodec
= format_dict
.get('videoCodec')
28 acodec
= format_dict
.get('audioCodec')
29 for media
in encodings
:
30 if not isinstance(media
, dict):
32 media_url
= url_or_none(media
.get('location'))
36 format_id_list
= [format_id
]
37 height
= int_or_none(media
.get('videoHeight'))
38 if height
is not None:
39 format_id_list
.append(f
'{height}p')
42 'format_id': '-'.join(format_id_list
),
43 'width': int_or_none(media
.get('videoWidth')),
45 'vbr': int_or_none(media
.get('videoKbps')),
46 'abr': int_or_none(media
.get('audioKbps')),
47 'fps': int_or_none(media
.get('fps')),
51 if 'rtmp' in format_id
:
53 elif 'hls' in format_id
:
56 # hls skips fragments, preferring rtmp
60 if format_id
== 'jpeg':
64 'height': f
['height'],
65 'format_id': f
['format_id'],
73 'thumbnails': thumbnails
,