U
    gh                     @   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.htmlZ
YuOUaOzGQUmp4z-Up and Out of Poverty Ep. 1: A solemn promisezre:^https?://.*\.jpg$iuG`Z20210309ZVideo)idexttitle	thumbnail	timestampupload_date
categoriesZskip_downloadT)urlZ	info_dictparamszwhttps://news.cgtn.com/news/2021-06-06/China-Indonesia-vow-to-further-deepen-maritime-cooperation-10REvJCewCY/index.htmlZ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.ZCGTNZChinai8A`Z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|r|gnd |r|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   Zm3u8_nativeZhls)Zm3u8_idc                 S   s   | d S )Nip   )xr   r   9/tmp/pip-unpacked-wheel-q5ljy6pj/yt_dlp/extractor/cgtn.py<lambda>@       z&CGTNIE._real_extract.<locals>.<lambda>)r   r
   r   r   formatsr   r   r   )
Z	_match_idZ_download_webpageZ_html_search_regexZ_search_regexZ_og_search_titleZ_og_search_descriptionZ_og_search_thumbnailZ_extract_m3u8_formatsr   r   )selfr   Zvideo_idZwebpager   r   r   r   r   r   r   _real_extract,   s<    
         zCGTNIE._real_extractN)__name__
__module____qualname__Z
_VALID_URLZ_TESTSr    r   r   r   r   r      s>   
  "r   N)commonr   utilsr   r   r   r   r   r   r   <module>   s   