U
    gr	                     @   s8   d dl mZ ddlmZmZmZmZ G dd deZdS )   )InfoExtractor   )ExtractorErrortraverse_objunified_timestampurl_or_nonec                	   @   sF   e Zd ZdZdddddddd	d
ddidgZdZddiZdd ZdS )ClipchampIEz6https?://(?:www\.)?clipchamp\.com/watch/(?P<id>[\w-]+)z'https://clipchamp.com/watch/gRXZ4ZhdDaUZgRXZ4ZhdDaUmp4zUntitled videozAlexander Schwartzi/dZ20230406zre:^https?://.+\.jpg)idexttitleuploader	timestampZupload_date	thumbnailZskip_downloadm3u8)urlZ	info_dictparamsz4https://%s.cloudflarestream.com/%s/manifest/video.%sZparentOriginzhttps://clipchamp.comc           
   
   C   s  |  |}| ||}| ||d d d }|d}|dkrPtd| d|d }| d	| |d
}| jd|dddpd}| j| j||df || jddd}	|		| j
| j||df |d| jddd ||	dt|ddthfpd dt|ddthfdthfdthfdS ) NpropsZ	pagePropsvideostorage_locationZ	cf_streamz#Unsupported clip storage location ""download_urlz$https://iframe.cloudflarestream.com/zDownloading player iframez+\bcustomer-domain-prefix=["\']([\w-]+)["\']	subdomainF)fatalzcustomer-2ut9yn3y6fta1yxeZmpdZdash)queryr   Zmpd_idr   r	   Zhls)r   r   Zm3u8_id Zcreator)Z
first_name	last_name)r
   formatsr   projectproject_nameZ
created_atZthumbnail_url)r   r   r   )Z	_match_idZ_download_webpageZ_search_nextjs_datagetr   Z_search_regexZ_extract_mpd_formats_STREAM_URL_TMPL_STREAM_URL_QUERYextendZ_extract_m3u8_formatsjoinr   strr   r   )
selfr   Zvideo_idZwebpagedatar   pathiframer   r    r*   >/tmp/pip-unpacked-wheel-q5ljy6pj/yt_dlp/extractor/clipchamp.py_real_extract   sZ    

           
zClipchampIE._real_extractN)__name__
__module____qualname__Z
_VALID_URLZ_TESTSr!   r"   r,   r*   r*   r*   r+   r   
   s   	r   N)commonr   utilsr   r   r   r   r   r*   r*   r*   r+   <module>   s   