o
    i                     @   sT   d dl Z d dlZddlmZ ddlmZmZmZmZ ddl	m
Z
 G dd deZdS )	    N   )InfoExtractor   )int_or_nonejoin_nonemptymimetype2exturl_or_none)traverse_objc                   @   s   e Zd Zg dZdde dZddddd	d
ddddg dddd	ddiddddddddg dddd	ddiddddddd dg d!d"dd	ddidd#ddd$ddd%ddd&ddd'ddd(ddd)ddgZd*d+ Zd,d- Zd.S )/	VidflexIE)z[^.]+\.vidflex\.tvz(?:www\.)?acactv\.caz (?:www\.)?albertalacrossetv\.comz(?:www\.)?cjfltv\.comz"(?:www\.)?figureitoutbaseball\.comz(?:www\.)?ocaalive\.comz(?:www\.)?pegasussports\.tvz(?:www\.)?praxisseries\.caz(?:www\.)?silenticetv\.comz(?:www\.)?tuffhedemantv\.comz(?:www\.)?watchfuntv\.comzlive\.ofsaa\.on\.caztv\.procoro\.caztv\.realcastmedia\.netztv\.fringetheatre\.cazvideo\.haisla\.cazvideo\.hockeycanada\.cazvideo\.huuayaht\.orgzvideo\.turningpointensemble\.cazvideos\.livingworks\.netz'videos\.telusworldofscienceedmonton\.cazwatch\.binghamtonbulldogs\.comzwatch\.rekindle\.tvzwatch\.wpca\.comzhttps?://(?:|z.)/[a-z]{2}(?:-[a-z]{2})?/c/[\w-]+\.(?P<id>\d+)zLhttps://video.hockeycanada.ca/en/c/nwt-micd-up-with-jamie-lee-rattray.107486T)urlonly_matchingzOhttps://video.hockeycanada.ca/en-us/c/nwt-micd-up-with-jamie-lee-rattray.107486107486u&   NWT: Mic’d up with Jamie Lee Rattraymp4s   i	ia20211015)English2021zNational Women's Teamz$md5:efb1cf6165b48cc3f5555c4262dd5b23z@re:^https?://wpmedia01-a\.akamaihd\.net/en/asset/public/image/.+)	idtitleextduration	timestampupload_datetagsdescription	thumbnailskip_download)r   	info_dictparamszOhttps://video.hockeycanada.ca/en/c/mwc-remembering-the-wild-ride-in-riga.112307112307z&MWC: Remembering the wild ride in RigaiB  iWKf20240520)r   2024National Men's TeamIIHF World ChampionshipFanu'   re:.+Canada’s National Men’s Team.+zThttps://video.hockeycanada.ca/fr/c/cmm-retour-sur-un-parcours-endiable-a-riga.112304112304u.   CMM : Retour sur un parcours endiablé à RigaiKf)Frenchr"   r#   r$   r%   z$md5:cf825222882a3dab1cd62cffcf3b4d1fz9https://myfbcgreenville.vidflex.tv/en/c/may-12th-2024.658zrhttps://www.figureitoutbaseball.com/en/c/fiob-podcast-14-dan-bertolini-ncaa-d1-head-coach-recorded-11-29-2018.1367zUhttps://videos.telusworldofscienceedmonton.ca/en/c/the-aurora-project-timelapse-4.577zQhttps://www.tuffhedemantv.com/en/c/2022-tuff-hedeman-tour-hobbs-nm-january-22.227zJhttps://www.albertalacrossetv.com/en/c/up-floor-ground-balls-one-more.3449zShttps://www.silenticetv.com/en/c/jp-unlocked-day-in-the-life-of-langley-ha-15u.5197zOhttps://jphl.vidflex.tv/en/c/jp-unlocked-day-in-the-life-of-langley-ha-15u.5197c                 C   s   |  |}| ||}| jd|ddd}t| ||dtjhtjht	j
hthf}|t| ||d| |ddd	d|S )
Nz6content_api:\s*(["\'])(?P<url>https?://(?:(?!\1).)+)\1zcontent api urlr   )groupconfig)r   formatsz/*<![CDATA[*/ z/*]]>*/)	_match_id_download_webpage_html_search_regexr	   _download_jsonbase64	b64decodebytesdecodejsonloadsdictlist_yield_formats_search_json_ldreplace)selfr   video_idwebpagedata_urlmedia_config r@   L/home/ubuntu/.local/lib/python3.10/site-packages/yt_dlp/extractor/vidflex.py_real_extractp   s    

zVidflexIE._real_extractc                 c   s    t |dddd fD ]?}|d }t|d}|dkr)| j||dd	d
E d H  q|dkrD| jd|dd d}td||dt|dV  q||dV  qd S )Nmediasourcec                 S   s   t |d S )Nsrc)r   )_vr@   r@   rA   <lambda>   s    z*VidflexIE._yield_formats.<locals>.<lambda>rE   typem3u8Fhls)fatalm3u8_idr   z_(\d+)k\.mp4bitrate)defaulthttp)	format_idr   r   tbr)r   r   )r	   r   get_extract_m3u8_formats_search_regexr   r   )r;   r?   r<   media_source	media_url
media_typerN   r@   r@   rA   r8      s"   

zVidflexIE._yield_formatsN)	__name__
__module____qualname___DOMAINS_REjoin
_VALID_URL_TESTSrB   r8   r@   r@   r@   rA   r
      s    Fr
   )r0   r4   commonr   utilsr   r   r   r   utils.traversalr	   r
   r@   r@   r@   rA   <module>   s    