U
    $Pf                     @   sT   d dl mZ d dlZd dlZddlmZ ddlmZmZm	Z	m
Z
 G dd deZdS )	    )unicode_literalsN   )InfoExtractor   )determine_extint_or_none	qualitiesunescapeHTMLc                
   @   s>   e Zd ZdZdddddddd	d
dddddgZdd ZdS )GiantBombIEzXhttps?://(?:www\.)?giantbomb\.com/(?:videos|shows)/(?P<display_id>[^/]+)/(?P<id>\d+-\d+)zLhttp://www.giantbomb.com/videos/quick-look-destiny-the-dark-below/2300-9782/Z 132f5a803e7e0ab0e274d84bda1e77aez	2300-9782z!quick-look-destiny-the-dark-belowmp4z#Quick Look: Destiny: The Dark Belowz$md5:0aa3aaf2772a41b91d44c63f30dfad24i_	  zre:^https?://.*\.jpg$)id
display_idexttitledescriptionduration	thumbnail)urlmd5Z	info_dictz8https://www.giantbomb.com/shows/ben-stranding/2970-20212T)r   Zonly_matchingc                 C   sh  t | j|}|d}|d}| ||}| |}| |}| |}t	t
| d|d}	t|	d}
tdddd	d
dg}g }|	d  D ]\}}|dkrqt|}|dkr| |d |}|r|||d d< || q|dkr|| j||ddddd q|||||d q|sJ|	d}|rJ| |dS | | ||||||
|dS )Nr   r   zdata-video="([^"]+)"z
data-videoZlengthSecondsZf4m_lowZprogressive_lowZf4m_highZprogressive_highZf4m_hdZprogressive_hdZvideoStreamsZ
f4m_streamZf4mz?hdcore=3.3.1r   qualityZm3u8r   Zm3u8_nativeZhlsF)r   Zentry_protocolZm3u8_idfatal)r   	format_idr   Z	youtubeIDZYoutube)r   r   r   r   r   r   formats)rematch
_VALID_URLgroupZ_download_webpageZ_og_search_titleZ_og_search_descriptionZ_og_search_thumbnailjsonloadsr	   Z_search_regexr   getr   itemsr   Z_extract_f4m_formatsextendZ_extract_m3u8_formatsappendZ
url_resultZ_sort_formats)selfr   ZmobjZvideo_idr   Zwebpager   r   r   videor   r   r   r   Z	video_urlr   Zf4m_formatsZ
youtube_id r%   B/tmp/pip-unpacked-wheel-7zdooeg3/youtube_dl/extractor/giantbomb.py_real_extract"   st    





      
    



zGiantBombIE._real_extractN)__name__
__module____qualname__r   Z_TESTSr'   r%   r%   r%   r&   r
      s"   r
   )
__future__r   r   r   commonr   utilsr   r   r   r	   r
   r%   r%   r%   r&   <module>   s
   