U
    g                     @   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	FoxNewsIEZ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/6320653836112Z6320653836112mp4z>Tucker Carlson joins 'Gutfeld!' to discuss his new documentaryre:^https?://.*\.jpg$i  Z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=trueZ5099377331001Z82416_censoringZ20160826g   Ai	  )r   r	   r
   r   r   r   r   r   z@http://video.foxnews.com/v/3937480/frozen-in-time/#sp=show-clipsZ 32aaded6ba3ef0d1c04e238d01031e5eZ3937480flvzFrozen in Timez#16-year-old girl is size of toddleri	  icMZ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-clipsZ 5846c64a1ea05ec78175421b8323e2dfZ3922535568001z;Rep. Luis Gutierrez on if Obama's immigration plan is legalz&Congressman discusses president's plani$  i_TZ20141204z"m3u8 HTTP error 400 in web browserzPhttp://video.foxnews.com/v/video-embed.html?video_id=3937480&d=video.foxnews.comTr   Z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   webpageZmobj r!   </tmp/pip-unpacked-wheel-q5ljy6pj/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_idZ_extract_feed_info)selfr   r   infor!   r!   r"   _real_extract[   s    
zFoxNewsIE._real_extractN)
__name__
__module____qualname__IE_NAMEZIE_DESC
_VALID_URL_TESTSclassmethodr#   r'   r!   r!   r!   r"   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/6328632286112Z6328632286112r   zReview: 2023 Toyota Prius Prime   zre:^https://.+\.jpg$g  @AZ20230602z$md5:b69aafb125b41c1402e9744f53d6edc4)r   r	   r
   r   r   r   r   r   r   r   r   z+https://www.foxnews.com/video/6313058664112Z6313058664112z're:https://.+/1280x720/match/image\.jpgZ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/)r$   
url_resultr   )r%   r   r   r!   r!   r"   r'      s    
zFoxNewsVideoIE._real_extractN)r(   r)   r*   r,   r-   r'   r!   r!   r!   r"   r/   d   s6   

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.htmlZ d2dd6ce809cedeefa96460e964821437Z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 forumi5WZ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=trueZ5748266721001r   z<Kyle Kashuv has a positive message for the Trump White Housez;Marjory Stoneman Douglas student disagrees with classmates.   inZZ20180309)r   r	   r
   r   r   r   r   r   r   r1   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}|rB| d| t S | tt||t S )Nz&data-video-id=([\'"])(?P<id>[^\'"]+)\1zvideo IDr   )r   defaultzhttp://video.foxnews.com/v/)r$   Z_download_webpageZ_html_search_regexr2   r   Zie_keynextr#   )r%   r   Z
display_idr    r   r!   r!   r"   r'      s$    
     zFoxNewsArticleIE._real_extractN)r(   r)   r*   r,   r+   r-   r'   r!   r!   r!   r"   r3      s@   

"r3   )r   ampr   commonr   r   r/   r3   r!   r!   r!   r"   <module>   s
   ]#