U
    g                     @   s0   d dl mZ ddlmZmZ G dd deZdS )   )InfoExtractor   )int_or_noneurl_or_nonec                   @   s&   e Zd ZdZddddgZdd ZdS )	CamModelsIEz6https?://(?:www\.)?cammodels\.com/cam/(?P<id>[^/?#&]+)z+https://www.cammodels.com/cam/AutumnKnight/T   )urlZonly_matching	age_limitc                 C   s  |  |}| d| d|}g }g }|d  D ]D\}}t|tsHq2|d}t|ts^q2|d}	|d}
|D  ]}t|tsqvt|d}|sqv|g}t|d}|d k	r|	| d	 |d

|t|d|t|dt|dt|d|	|
d	}d|kr"d|d< nJd|kr>|ddd n.|dkrv|	|d |d |d |d d qv|	| qvq2|||d|ddS ) Nz0https://manifest-server.naiadsystems.com/live/s:z.jsonformats	encodingsZ
videoCodecZ
audioCodeclocationZvideoHeightp-Z
videoWidthZ	videoKbpsZ	audioKbpsfps)	r   	format_idwidthheightZvbrZabrr   vcodecacodecZrtmpZflvextZhlsZmp4i)r   ZqualityZjpegr   r   r   r   )r   r   r   r   Tr   )idtitle
thumbnailsZis_liver
   r	   )Z	_match_idZ_download_jsonitems
isinstancedictgetlistr   r   appendjoinupdate)selfr   Zuser_idmanifestr
   r   r   Zformat_dictr   r   r   ZmediaZ	media_urlZformat_id_listr   f r$   >/tmp/pip-unpacked-wheel-q5ljy6pj/yt_dlp/extractor/cammodels.py_real_extract   st    

 










zCamModelsIE._real_extractN)__name__
__module____qualname__Z
_VALID_URLZ_TESTSr&   r$   r$   r$   r%   r      s   r   N)commonr   utilsr   r   r   r$   r$   r$   r%   <module>   s   