o
    Ikc
                     @   sl   d Z ddlZddlZddlmZmZ ddlmZ ddlm	Z	 e
eZeedG dd deZeZdS )	z
$description Japanese live-streaming service used primarily by Japanese idols & voice actors and their fans.
$url showroom-live.com
$type live
    N)Pluginpluginmatcher)validate)	HLSStreamz&https?://(?:\w+\.)?showroom-live\.com/c                       s(   e Zd ZdZ fddZdd Z  ZS )Showroom   c                    s$   t  j|i | | jdd d S )Nzhls-playlist-reload-timesegment)super__init__session
set_option)selfargskwargs	__class__ =/usr/lib/python3/dist-packages/streamlink/plugins/showroom.pyr
      s   zShowroom.__init__c                 C   s,  | j jj| jtt tdtt	
dtd tdd}|s&d S | j jjdd|itt ttdtddd	\}| _|| jkrOtd
 d S | j jjd|ddtt dtt dgitdtdd tdd	}| j jj|dd}|jd dkrtd d S t| j |S )Nz9.//script[contains(text(),'share_url:"https:')][1]/text()z4share_url:\"https:[^?]+?\?room_id=(?P<room_id>\d+)\"room_id)schemaz0https://www.showroom-live.com/api/live/live_info)live_status	room_namer   r   )paramsr   z This stream is currently offlinez4https://www.showroom-live.com/api/live/streaming_url   )r   abr_availablestreaming_url_list)typeurlc                 S   s   | d dkS )Nr   hls_allr   )pr   r   r   <lambda>L   s    z'Showroom._get_streams.<locals>.<lambda>)r   r   )   i  i  )acceptable_statuszContent-Typezapplication/x-mpegURLzThis stream is restricted)r   httpgetr   r   Schema
parse_htmlxml_xpath_stringnone_or_allrecompileany
parse_jsonintstr	union_gettitleLIVE_STATUSloginfofilterheaderserrorr   parse_variant_playlist)r   r   r   r   resr   r   r   _get_streams   sh   


zShowroom._get_streams)__name__
__module____qualname__r1   r
   r9   __classcell__r   r   r   r   r      s    r   )__doc__loggingr)   streamlink.pluginr   r   streamlink.plugin.apir   streamlink.stream.hlsr   	getLoggerr:   r2   r*   r   
__plugin__r   r   r   r   <module>   s    
E