U
    y^w                     @   s4   d dl mZ d dlZddlmZ G dd deZdS )    )unicode_literalsN   )InfoExtractorc                   @   s"   e Zd ZdZdZdZdddZdS )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                 C   s   t tj| \}}}| j| j|||f |dddd}g }|D ]t}t dd|d |d< | jd|d d	d d
}	|	r@|	 }
|

| j|||	|f |d ddd|d ||
 q@| || || |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
   Zhttp_formats_preferenceZ	domain_idZapplication_idZmedia_item_idformatsZprogressive_formatsZadaptive_formatZrendition_idZprogressive_format r!   LC:\Users\TaGoRe\Desktop\beinconnect-dl\binaries\youtube_dl\extractor\once.py_extract_once_formats   s`                  
zOnceIE._extract_once_formats)N)__name__
__module____qualname__r   r   r   r#   r!   r!   r!   r"   r   	   s   r   )
__future__r   r   commonr   r   r!   r!   r!   r"   <module>   s   