U
    y^                     @   s@   d dl mZ ddlmZ ddlmZmZmZ G dd deZdS )	    )unicode_literals   )InfoExtractor   )ExtractorError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   )urlonly_matching	age_limitc                 C   s  |  |}| j|||  d}| jd|dd d}|snd}|D ]\}}||kr<|}d}	 qbq<d}d}	t||	d	| d
||f |}
g }|
d  D ]\}}t|tsq|	d}t|t
sq|	d}|	d}|D ]}t|tsqt|	d}|sq|g}t|	d}|d k	r&|d|  |d|t|	d|t|	dt|	dt|	d||d	}d|krd|d< nd|kr|ddd nq|| qq| | || |d|dd S )!N)headerszmanifestUrlRoot=([^&\']+)manifest)default))z%I'm offline, but let's stay connectedzThis user is currently offline)zin a private showzThis user is in a private show)zis currently performing LIVEz'This model is currently performing liveTz Unable to find manifest URL rootF)expectedz	%s%s.jsonformats	encodings
videoCodec
audioCodeclocationvideoHeightz%dp-
videoWidthZ	videoKbpsZ	audioKbpsfps)	r   	format_idwidthheightvbrabrr   vcodecacodecrtmpflvexthlsmp4)r$   
preferencer
   )idtitleis_liver   r   )	_match_id_download_webpagegeo_verification_headers_html_search_regexr   _download_jsonitems
isinstancedictgetlistr   r   appendjoinupdate_sort_formats_live_title)selfr   user_idwebpageZmanifest_rootERRORSpatternmessageerrorr   r   r   r   format_dictr   r    r!   media	media_urlformat_id_listr   f rG   QC:\Users\TaGoRe\Desktop\beinconnect-dl\binaries\youtube_dl\extractor\cammodels.py_real_extract   s    
     
 










zCamModelsIE._real_extractN)__name__
__module____qualname__
_VALID_URL_TESTSrI   rG   rG   rG   rH   r	      s   r	   N)	
__future__r   commonr   utilsr   r   r   r	   rG   rG   rG   rH   <module>   s   