U
    g                     @   s0   d dl mZ ddlmZmZ G dd deZdS )   )InfoExtractor   )ExtractorErrorurlencode_postdatac                   @   sD   e Zd ZdZdddddddd	d
dddddddgZdd ZdS )BigoIEz8https?://(?:www\.)?bigo\.tv/(?:[a-z]{2,}/)?(?P<id>[^/]+)z https://www.bigo.tv/ja/221338632Z6576287577575737440u*   土よ〜💁‍♂️ 休憩室/REST roomzre:https?://.+u   ✨Shin💫Z	221338632T)idtitle	thumbnailuploaderuploader_idis_liveZ
livestream)urlZ	info_dictskipz"https://www.bigo.tv/th/Tarlerm1304)r   Zonly_matchingzhttps://bigo.tv/115976881c              	   C   s   |  |}| jd|td|iddid}t|ts:td|drdtd|d	|dd
d|dppi }|dstdd
d| |d|dd\}}|dp||dp|dp||||d|d|d
dS )Nz@https://ta.bigo.tv/official_website/studio/getInternalStudioInfoZsiteIdAcceptzapplication/json)dataheaderszReceived invalid JSON datacodezBigo says: {} (code {})msgT)expectedr   alivezThis user is offline.Zhls_srcZmp4Zm3u8ZroomIdZ	roomTopicZ	nick_nameZsnapshot)r   r   formatsZ	subtitlesr	   r
   r   r   )	Z	_match_idZ_download_jsonr   
isinstancedictr   getformatZ#_extract_m3u8_formats_and_subtitles)selfr   Zuser_idZinfo_rawinfor   subs r   9/tmp/pip-unpacked-wheel-q5ljy6pj/yt_dlp/extractor/bigo.py_real_extract   s@    
 


 
   zBigoIE._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   