o
    i                     @   sT   d dl Z ddlmZ ddlmZ G dd deZG dd deZG d	d
 d
eZdS )    N   )AMPIE)InfoExtractorc                   @   s   e Zd ZdZdZdZ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idddddddddd dd!d"d#d$d%d&dd'd(d)d*d+dd!d,d#d-d.d/d0d.d/gZed1d2 Zd3d4 Z	d5S )6	FoxNewsIEfoxnewszFox News and Fox Business Videozfhttps?://video\.(?:insider\.)?fox(?:news|business)\.com/v/(?:video-embed\.html\?video_id=)?(?P<id>\d+)z)https://video.foxnews.com/v/63206538361126320653836112mp4z>Tucker Carlson joins 'Gutfeld!' to discuss his new documentaryre:^https?://.*\.jpg$i  20230217z$md5:858a8a36f59e9ca897d758855bcdfa02g   A)idexttitle	thumbnaildurationupload_datedescription	timestampskip_downloadm3u8url	info_dictparamsaE  http://video.insider.foxnews.com/v/video-embed.html?video_id=5099377331001&autoplay=true&share_url=http://insider.foxnews.com/2016/08/25/univ-wisconsin-student-group-pushing-silence-certain-words&share_title=Student%20Group:%20Saying%20%27Politically%20Correct,%27%20%27Trash%27%20and%20%27Lame%27%20Is%20Offensive&share=true509937733100182416_censoring20160826g   Ai	  )r   r   r   r   r   r   r   r   z@http://video.foxnews.com/v/3937480/frozen-in-time/#sp=show-clips 32aaded6ba3ef0d1c04e238d01031e5e3937480flvzFrozen in Timez#16-year-old girl is size of toddleri	  icM20110503)r   r   r   r   r   r   r   r   404 page)r   md5r   skipzqhttp://video.foxnews.com/v/3922535568001/rep-luis-gutierrez-on-if-obamas-immigration-plan-is-legal/#sp=show-clips 5846c64a1ea05ec78175421b8323e2df3922535568001z;Rep. Luis Gutierrez on if Obama's immigration plan is legalz&Congressman discusses president's plani$  i_T20141204z"m3u8 HTTP error 400 in web browserzPhttp://video.foxnews.com/v/video-embed.html?video_id=3937480&d=video.foxnews.comTr   only_matchingz,http://video.foxbusiness.com/v/4442309889001c                 c   s*    t d|D ]}d|d V  qd S )Nz(?x)
                    <(?:script|(?:amp-)?iframe)[^>]+\bsrc=["\']
                    (?:https?:)?//video\.foxnews\.com/v/(?:video-embed\.html|embed\.js)\?
                    (?:[^>"\']+&)?(?:video_)?id=(?P<video_id>\d+)
                z6https://video.foxnews.com/v/video-embed.html?video_id=video_id)refinditergroup)clsr   webpagemobj r/   L/home/ubuntu/.local/lib/python3.10/site-packages/yt_dlp/extractor/foxnews.py_extract_embed_urlsQ   s   zFoxNewsIE._extract_embed_urlsc                 C   s,   |  |}| d| d| }||d< |S )Nz(https://api.foxnews.com/v3/video-player/z?callback=uid_r   )	_match_id_extract_feed_info)selfr   r(   infor/   r/   r0   _real_extract[   s   
zFoxNewsIE._real_extractN)
__name__
__module____qualname__IE_NAMEIE_DESC
_VALID_URL_TESTSclassmethodr1   r6   r/   r/   r/   r0   r      s    



F
	r   c                   @   sX   e Zd ZdZ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gZdd ZdS )FoxNewsVideoIEz1https?://(?:www\.)?foxnews\.com/video/(?P<id>\d+)z+https://www.foxnews.com/video/63286322861126328632286112r   zReview: 2023 Toyota Prius Prime   zre:^https://.+\.jpg$g  @A20230602z$md5:b69aafb125b41c1402e9744f53d6edc4)r   r   r   r   r   r   r   r   r   r   r   z+https://www.foxnews.com/video/63130586641126313058664112z're:https://.+/1280x720/match/image\.jpg20220930z"New York City, Kids Therapy, Bidenio	  z!Gutfeld! - Thursday, September 29i6c)r   r   r   r   r   r   r   r   r    r   r   r"   c                 C   s   |  |}| d| t|S )Nzhttps://video.foxnews.com/v/)r2   
url_resultr   )r4   r   r(   r/   r/   r0   r6      s   
zFoxNewsVideoIE._real_extractN)r7   r8   r9   r<   r=   r6   r/   r/   r/   r0   r?   d   s8    

r?   c                   @   sf   e Zd ZdZdZ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gZdd  Zd!S )"FoxNewsArticleIEzKhttps?://(?:www\.)?(?:insider\.)?foxnews\.com/(?!v)([^/]+/)+(?P<id>[a-z-]+)zfoxnews:articlezqhttps://www.foxnews.com/politics/2016/09/08/buzz-about-bud-clinton-camp-denies-claims-wore-earpiece-at-forum.html d2dd6ce809cedeefa96460e9648214375116295019001r   z7Trump and Clinton asked to defend positions on Iraq Warz\Veterans and Fox News host Dana Perino react on 'The Kelly File' to NBC's presidential forumi5W20160908r	   i  )r   r   r   r   r   r   r   r   r   r   )r   r!   r   r   zhttps://www.foxnews.com/us/2018/03/09/parkland-survivor-kyle-kashuv-on-meeting-trump-his-app-to-prevent-another-school-shooting.amp.html?__twitter_impression=true5748266721001r   z<Kyle Kashuv has a positive message for the Trump White Housez;Marjory Stoneman Douglas student disagrees with classmates.   inZ20180309)r   r   r   r   r   r   r   r   r    rE   z`http://insider.foxnews.com/2016/08/25/univ-wisconsin-student-group-pushing-silence-certain-wordsTr&   c                 C   s^   |  |}| ||}| jd|ddd d}|r!| d| t S | tt||t S )Nz&data-video-id=([\'"])(?P<id>[^\'"]+)\1zvideo IDr   )r+   defaultzhttp://video.foxnews.com/v/)r2   _download_webpage_html_search_regexrF   r   ie_keynextr1   )r4   r   
display_idr-   r(   r/   r/   r0   r6      s   
zFoxNewsArticleIE._real_extractN)r7   r8   r9   r<   r:   r=   r6   r/   r/   r/   r0   rG      sB    

"rG   )r)   ampr   commonr   r   r?   rG   r/   r/   r/   r0   <module>   s    ]#