
    yf                     .    d dl Z ddlmZ  G d de      Zy)    N   )InfoExtractorc                        e Zd ZdZdZdZddZy)OnceIEzhttps?://.+?\.unicornmedia\.com/now/(?:ads/vmap/)?[^/]+/[^/]+/(?P<domain_id>[^/]+)/(?P<application_id>[^/]+)/(?:[^/]+/)?(?P<media_item_id>[^/]+)/content\.(?:once|m3u8|mp4)zFhttp://once.unicornmedia.com/now/master/playlist/%s/%s/%s/content.m3u8zJhttp://once.unicornmedia.com/now/media/progressive/%s/%s/%s/%s/content.mp4Nc                 <   t        j                  t        j                  |      j	                         \  }}}| j                  | j                  |||fz  |ddd      }g }|D ]  }t        j                  dd|d         |d<   | j                  d|d   d	d 
      }	|	s;|j                         }
|
j                  | j                  |||	|fz  |d   j                  dd      d|d       |j                  |
        | j                  ||       |j                  |       |S )Nmp4hlsF)m3u8_idfatalz\badsegmentlength=\d+zadsegmentlength=0urlz'/now/media/playlist/[^/]+/[^/]+/([^/]+)zredition id)default	format_idhttp)r   r   protocol
preference)rematchr   
_VALID_URLgroups_extract_m3u8_formatsADAPTIVE_URL_TEMPLATEsub_search_regexcopyupdatePROGRESSIVE_URL_TEMPLATEreplaceappend_check_formatsextend)selfr   http_formats_preference	domain_idapplication_idmedia_item_idformatsprogressive_formatsadaptive_formatrendition_idprogressive_formats              7/usr/lib/python3/dist-packages/yt_dlp/extractor/once.py_extract_once_formatszOnceIE._extract_once_formats   s\   3588s4$$*FH 	1	>=,,&&>=*: :5%u - > !& 	?O &(VV(*>PU@V&XOE"--:&t . EL %4%9%9%;""))88!><<P P!0!=!E!Ev"' &"9+  $**+=>%	?& 	/?*+    )N)__name__
__module____qualname__r   r   r   r,    r-   r+   r   r      s     @Jdkr-   r   )r   commonr   r   r1   r-   r+   <module>r3      s    	 !"] "r-   