o
    i                     @   s@   d dl Z ddlmZ ddlmZ ddlmZ G dd deZdS )	    N   )CloudflareStreamIE)InfoExtractor   )traverse_objc                	   @   sX   e Zd ZdZdddddddd	d
dddgdddddddgZdd Zdd ZdS )HytaleIEz>https?://(?:www\.)?hytale\.com/news/\d+/\d+/(?P<id>[a-z0-9-]+)z>https://hytale.com/news/2021/07/summer-2021-development-updatezsummer-2021-development-updatezSummer 2021 Development Update)idtitle    0854ebe347d233ee19b86ab7b2ead610 ed51a2609d21bad6e14145c37c334999mp4zAvatar Personalizationz;re:https://videodelivery\.net/\w+/thumbnails/thumbnail\.jpg)r   extr	   	thumbnail)md5	info_dict)urlr   playlist_countplaylistz:https://www.hytale.com/news/2019/11/hytale-graphics-updatezhytale-graphics-updatezHytale graphics updater   )r   r   r   c                 C   sD   | j dd dddp
d}t| d|dd dpg }d	d
 |D | _d S )Nzhttps://hytale.com/mediazDownloading list of mediaF)notefatal z-window\.__INITIAL_COMPONENTS_STATE__\s*=\s*\[z
clips json)mediaclipsc                 S   s   i | ]}| d | dqS )srccaption)get).0clip r   K/home/ubuntu/.local/lib/python3.10/site-packages/yt_dlp/extractor/hytale.py
<dictcomp>-   s    z-HytaleIE._real_initialize.<locals>.<dictcomp>)_download_webpager   _search_json_titles)selfmedia_webpage
clips_jsonr   r   r    _real_initialize#   s   zHytaleIE._real_initializec                    sD     |} ||} fddtd|D } || |S )Nc                    s.   g | ]} j d | dt j|ddqS )zhttps://cloudflarestream.com/z9/manifest/video.mpd?parentOrigin=https%3A%2F%2Fhytale.comT)r	   url_transparent)
url_resultr   r$   r   )r   
video_hashr%   r   r    
<listcomp>2   s    
z*HytaleIE._real_extract.<locals>.<listcomp>zI<stream\s+class\s*=\s*"ql-video\s+cf-stream"\s+src\s*=\s*"([a-f0-9]{32})")	_match_idr"   refindallplaylist_result_og_search_title)r%   r   playlist_idwebpageentriesr   r,   r    _real_extract/   s   

	zHytaleIE._real_extractN)__name__
__module____qualname__
_VALID_URL_TESTSr(   r6   r   r   r   r    r      s0    r   )r/   cloudflarestreamr   commonr   utils.traversalr   r   r   r   r   r    <module>   s
    