U
    gm                     @   sD   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 )   )InfoExtractor   )ExtractorErrordetermine_extparse_iso8601url_or_none)traverse_objc                   @   s   e Zd ZdZ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ddddddd d!ed"d#d$gd%ed&d%d'd(dd)ed&g d*ed+dgZd,d- Zd.S )/
TrtWorldIEz;https?://www\.trtworld\.com/video/[\w-]+/[\w-]+-(?P<id>\d+)zThttps://www.trtworld.com/video/news/turkiye-switches-to-sustainable-tourism-16067690Z16067690Zmp4u(   Türkiye switches to sustainable tourismiGkeZ20231202z@https://cdn-i.pr.trt.com.tr/trtworld/17647563_0-0-1920-1080.jpegz$md5:0a975c04257fb529c8f99c7b76a2cf12)idexttitlerelease_timestamprelease_date	thumbnaildescription)urlZ	info_dictz}https://www.trtworld.com/video/one-offs/frames-from-anatolia-recreating-a-james-bond-scene-in-istanbuls-grand-bazaar-14541780Z14541780uV   Frames From Anatolia: Recreating a ‘James Bond’ Scene in Istanbul’s Grand BazaaridZ20230819z@https://cdn-i.pr.trt.com.tr/trtworld/16939810_0-0-1920-1080.jpegz$md5:4050e21570cc3c40b6c9badae800a94fzqhttps://www.trtworld.com/video/the-newsmakers/can-sudan-find-peace-amidst-failed-transition-to-democracy-12904760Z12904760z;Can Sudan find peace amidst failed transition to democracy?i@dZ20230420zNhttp://cdni0.trtworld.com/w768/q70/154214_NMYOUTUBETEMPLATE1_1681833018736.jpg)r
   r   r   r   r   r   zvhttps://www.trtworld.com/video/africa-matters/locals-learning-to-cope-with-rising-tides-of-kenyas-great-lakes-16059545ZzEns2dWl00wz@Locals learning to cope with rising tides of Kenya's Great Lakesz4https://i.ytimg.com/vi/zEns2dWl00w/maxresdefault.jpgz$md5:3ad9d7c5234d752a4ead4340c79c6b8dzUC7fWeaHhqgM4Ry-RMpM2YYwz8https://www.youtube.com/channel/UC7fWeaHhqgM4Ry-RMpM2YYw       z+https://www.youtube.com/watch?v=zEns2dWl00wzNews & Politicsz	TRT WorldTz	@trtworldz!https://www.youtube.com/@trtworldpublicZnot_live)r
   r   r   r   r   Z
channel_idZchannel_urldurationZ
view_countZ	age_limitZwebpage_url
categoriesZchannelZchannel_follower_countZchannel_is_verifiedZuploaderZuploader_idZuploader_urlZupload_dateZavailabilityZcomment_countZplayable_in_embedtagsZlive_statusZ
like_countc              
   C   s   |  |}| ||}| ||d d d }g }t|dddthfD ]8}t|dkrn|| j||dd	 qF|d
|d qF|st|d }r| 	|dS t
ddd||dt|ddddthfdddthfdddthfddthfdfddS )NZ	videoDatacontent	platforms)ZwebsiteZottmetadata)Zhls_urlr   Zm3u8F)fatalhttp)Z	format_idr   youtube	youtubeIdZYoutubezNo video foundT)expected)r
   formatsfieldsr   textr   r   r   Z	publisheddate)r   r   r   r   )get_all)r   r   r   )Z	_match_idZ_download_webpageZ_search_nuxt_datar   r   r   extendZ_extract_m3u8_formatsappendZ
url_resultr   strr   )selfr   Z
display_idZwebpageZnuxtjs_datar    Z	media_urlZ
youtube_id r)   =/tmp/pip-unpacked-wheel-q5ljy6pj/yt_dlp/extractor/trtworld.py_real_extractH   s@    
   


zTrtWorldIE._real_extractN)__name__
__module____qualname__Z
_VALID_URLintZ_TESTSr+   r)   r)   r)   r*   r	      sx   ?r	   N)
commonr   utilsr   r   r   r   Zutils.traversalr   r	   r)   r)   r)   r*   <module>   s   