a
    hl
                     @   s8   d dl mZ ddlmZmZmZmZ G dd deZdS )   )InfoExtractor   )int_or_nonestr_or_nonetraverse_objurl_or_nonec                   @   sZ   e Zd ZdZdZdddddddd	d
ddededddidddddddgZdd ZdS )
GoodGameIEzgoodgame:streamz2https?://goodgame\.ru/(?!channel/)(?P<id>[\w.*-]+)z https://goodgame.ru/TGW#autoplayZ7998mp4ur   re:шоуматч Happy \(NE\) vs Fortitude \(UD\), потом ладдер и дс \d{4}-\d{2}-\d{2} \d{2}:\d{2}$zhttps://goodgame.ru/TGWz-https://hls.goodgame.ru/previews/7998_240.jpgZTGWZJosephStalinis_live   Z2899)idext
channel_idtitlechannel_url	thumbnailuploaderchannelZlive_status	age_limitchannel_follower_countuploader_idconcurrent_view_countZskip_downloadZm3u8)urlZ	info_dictparamszhttps://goodgame.ru/Mr.GrayT)r   Zonly_matchingz"https://goodgame.ru/HeDoPa3yMeHue*c                 C   s   |  |}| d| d|}|d }g i  }}|drZ| jd| d|ddd	\}}n| jd
d|d |||t|dt|dthfdthfdthfdt	hfddthfddthfdt	h| j
hfdthfdthfdthdd hfd
S )Nz https://goodgame.ru/api/4/users/z/streamZ	streamkeystatusz!https://hls.goodgame.ru/manifest/z_master.m3u8r	   T)ZlivezUser is offline)expectedZvideo_id)r   formats	subtitlesr
   r   Z
channelkeyr   linkZstreamerusernamepreviewZviewersZ	followersZadultc                 S   s   | rdS d S )Nr    )xr!   r!   N/mnt/pikpak/tmp/myenv/lib/python3.9/site-packages/yt_dlp/extractor/goodgame.py<lambda>C       z*GoodGameIE._real_extract.<locals>.<lambda>)
r   r   r   r   r   r   r   r   r   r   )Z	_match_idZ_download_jsongetZ#_extract_m3u8_formats_and_subtitlesZraise_no_formatsboolr   strr   r   Z_proto_relative_urlr   )selfr   Zchannel_nameresponseZ	player_idr   r   r!   r!   r#   _real_extract'   s8    





zGoodGameIE._real_extractN)__name__
__module____qualname__ZIE_NAMEZ
_VALID_URLintZ_TESTSr+   r!   r!   r!   r#   r   
   s6   r   N)commonr   utilsr   r   r   r   r   r!   r!   r!   r#   <module>   s   