o
    ih                     @   s0   d dl mZ ddlmZmZ G dd deZdS )   )InfoExtractor   )try_getunified_timestampc                   @   sb   e Zd ZdZdddddddd	gd
ddiddddddddgdgddd	ddidgZdd ZdS )CGTNIEzhhttps?://news\.cgtn\.com/news/[0-9]{4}-[0-9]{2}-[0-9]{2}/[a-zA-Z0-9-]+-(?P<id>[a-zA-Z0-9-]+)/index\.htmlzghttps://news.cgtn.com/news/2021-03-09/Up-and-Out-of-Poverty-Ep-1-A-solemn-promise-YuOUaOzGQU/index.html
YuOUaOzGQUmp4z-Up and Out of Poverty Ep. 1: A solemn promisezre:^https?://.*\.jpg$iuG`20210309Video)idexttitle	thumbnail	timestampupload_date
categoriesskip_downloadT)url	info_dictparamszwhttps://news.cgtn.com/news/2021-06-06/China-Indonesia-vow-to-further-deepen-maritime-cooperation-10REvJCewCY/index.html10REvJCewCYz;China, Indonesia vow to further deepen maritime cooperationzre:^https?://.*\.png$zChina and Indonesia vowed to upgrade their cooperation into the maritime sector and also for political security, economy, and cultural and people-to-people exchanges.CGTNChinai8A`20210606)	r   r   r   r   descriptioncreatorsr   r   r   Fc                 C   s   |  |}| ||}| d|d}| jd|ddd}| jd|ddd}| jd	|d
d d}|| || j|d d| || j||dddd|rJ|gnd |rP|gnd tt	|dd dS )Nzdata-video ="(?P<url>.+m3u8)"download_urlz%<span class="date">\s*(.+?)\s*</span>datetime_strF)fatalz(<span class="section">\s*(.+?)\s*</span>categoryz/<div class="news-author-name">\s*(.+?)\s*</div>author)defaultr   m3u8_nativehls)m3u8_idc                 S   s   | d S )Nip   )xr%   r%   I/home/ubuntu/.local/lib/python3.10/site-packages/yt_dlp/extractor/cgtn.py<lambda>@   s    z&CGTNIE._real_extract.<locals>.<lambda>)r   r   r   r   formatsr   r   r   )
	_match_id_download_webpage_html_search_regex_search_regex_og_search_title_og_search_description_og_search_thumbnail_extract_m3u8_formatsr   r   )selfr   video_idwebpager   r   r   r    r%   r%   r'   _real_extract,   s*   
zCGTNIE._real_extractN)__name__
__module____qualname__
_VALID_URL_TESTSr5   r%   r%   r%   r'   r      s<    
"r   N)commonr   utilsr   r   r   r%   r%   r%   r'   <module>   s    