U
    g                     @   sD   d dl mZ ddlmZmZmZmZmZmZm	Z	 G dd deZ
dS )   )InfoExtractor   )ExtractorErrorint_or_noneparse_age_limitparse_iso8601smuggle_urlstr_or_noneupdate_url_queryc                   @   s   e Zd ZdZdddddddd	d
dddddddddddidddddddddddd d!d"ddid#d$d%d&dd'd(d)d*d+d,d-d.d/d
dd0d1d2d3ddidd4dd5d6dd5d7dd5gZd8d9 Zd:S );CWTVIEzhttps?://(?:www\.)?cw(?:tv(?:pr)?|seed)\.com/(?:shows/)?(?:[^/]+/)+[^?]*\?.*\b(?:play|watch)=(?P<id>[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12})zjhttps://www.cwtv.com/shows/all-american-homecoming/ready-or-not/?play=d848488f-f62a-40fd-af1f-6440b1821aabz$d848488f-f62a-40fd-af1f-6440b1821aabZmp4zReady Or NotzbSimone is concerned about changes taking place at Bringston; JR makes a decision about his future.zre:^https?://.*\.jpe?g$i	  i 
fZCWTVzcount:6zAll American: Homecoming   r       Z20240709zSeason 3z	Episode 1)idexttitledescription	thumbnailduration	timestampuploaderchaptersseriesseason_numberepisode_number	age_limitupload_dateseasonepisodeZskip_downloadT)url	info_dictparamsz[http://cwtv.com/shows/arrow/legends-of-yesterday/?play=6b15e985-9345-4f60-baf8-56e96be57c63z$6b15e985-9345-4f60-baf8-56e96be57c63zLegends of YesterdayzOliver and Barry Allen take Kendra Saunders and Carter Hall to a remote location to keep them hidden from Vandal Savage while they figure out how to defeat him.ii
  ZArrow   4   Z20151203i4_V)r   r   r   r   r   r   r   r   r   r   r   z(redirect to http://cwtv.com/shows/arrow/)r   r   r    skipzkhttp://www.cwseed.com/shows/whose-line-is-it-anyway/jeff-davis-4/?play=24282b12-ead2-42f2-95ad-26770c2c6088z$24282b12-ead2-42f2-95ad-26770c2c6088zJeff Davis 4z%Jeff Davis is back to make you laugh.i  zWhose Line Is It Anyway?      Z20151006i$TV   zcount:4z
Episode 20z	Season 11)r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   zRhttp://cwtv.com/thecw/chroniclesofcisco/?play=8adebe35-f447-465f-ab52-e863506ff6d6)r   Zonly_matchingzIhttp://cwtvpr.com/the-cw/video?watch=9eee3f60-ef4e-440b-b3b2-49428ac9c54ez\http://cwtv.com/shows/arrow/legends-of-yesterday/?watch=6b15e985-9345-4f60-baf8-56e96be57c63c           	      C   s   |  |}| d| |}|ddkr:t|d dd|d }|d }t|d	p^d
| ddi}t|d}t|d}|r|r|t|d  }d||t|ddi|dt|d|dt|t|t	|dt
|dd|ddS )NzEhttps://images.cwtv.com/feed/mobileapp/video-meta/apiversion_12/guid_resultokmsgT)expectedvideor   mpx_urlz:https://link.theplatform.com/s/cwtv/media/guid/2703454149/formatszM3U+noner   r   Zurl_transparentZforce_smil_urlZdescription_longZduration_secsZseries_name
start_timeZratingZThePlatformZlarge_thumbnail)_typer   r   r   r   r   r   r   r   r   r   Zie_keyr   )Z	_match_idZ_download_jsongetr   r
   r	   lenr   r   r   r   )	selfr   Zvideo_iddataZ
video_datar   r-   r   r    r5   9/tmp/pip-unpacked-wheel-q5ljy6pj/yt_dlp/extractor/cwtv.py_real_extract^   s>    
 zCWTVIE._real_extractN)__name__
__module____qualname__Z
_VALID_URLZ_TESTSr7   r5   r5   r5   r6   r      s      Or   N)commonr   utilsr   r   r   r   r   r	   r
   r   r5   r5   r5   r6   <module>   s   $