U
    $PfT                     @   s8   d dl mZ ddlmZ ddlmZ G dd deZdS )	    )unicode_literals   )OnceIE   )compat_urllib_parse_unquotec                   @   s^   e Zd ZdZdddddddd	d
dddddddddddddddddgZdd ZdS )
GameSpotIEz[https?://(?:www\.)?gamespot\.com/(?:video|article|review)s/(?:[^/]+/\d+-|embed/)(?P<id>\d+)zLhttp://www.gamespot.com/videos/arma-3-community-guide-sitrep-i/2300-6410818/Z b2a30deaa8654fcccd43713a6b6a4825zgs-2300-6410818mp4z"Arma 3 - Community Guide: SITREP IzECheck out this video where some of the basics of Arma 3 is explained.)idexttitledescriptionz+manifest URL give HTTP Error 404: Not Found)urlmd5	info_dictskipzYhttp://www.gamespot.com/videos/the-witcher-3-wild-hunt-xbox-one-now-playing/2300-6424837/Z 173ea87ad762cf5d3bf6163dceb255a6zgs-2300-6424837z&Now Playing - The Witcher 3: Wild HuntzRJoin us as we take a look at the early hours of The Witcher 3: Wild Hunt and more.)r   r   r   z.https://www.gamespot.com/videos/embed/6439218/T)r   Zonly_matchingzYhttps://www.gamespot.com/articles/the-last-of-us-2-receives-new-ps4-trailer/1100-6454469/zBhttps://www.gamespot.com/reviews/gears-of-war-review/1900-6161188/c              	   C   s  |  |}| ||}| | jd|ddd|}t|d }|d }g }|d}|r| j||dd	d
dd}	|	D ]P}
||
 |
 }|d= |	|
d 
ddd|
d 
ddd || qp|d}|r|| j||ddd | | |dp||||| d|| |dS )Nzdata-video=(["\'])({.*?})\1z
video datar   )groupr   ZvideoStreamsZadaptive_streamr   Zm3u8_nativeZhlsF)Zm3u8_idfatalZmanifest_url	format_idzhls-zhttp-httpr   z.m3u8z.mp4)r   protocolr   Zadaptive_dashZdash)Zmpd_idr   Zguidr   )r	   Z
display_idr   formatsr   Z	thumbnail)Z	_match_idZ_download_webpageZ_parse_jsonZ_html_search_regexr   getZ_extract_m3u8_formatsappendcopyupdatereplaceextendZ_extract_mpd_formatsZ_sort_formatsZ_html_search_metaZ_og_search_thumbnail)selfr   Zpage_idZwebpageZ
data_videor   Zstreamsr   Zm3u8_urlZm3u8_formatsfZhttp_fZmpd_url r   A/tmp/pip-unpacked-wheel-7zdooeg3/youtube_dl/extractor/gamespot.py_real_extract'   sb    
  
    

   

zGameSpotIE._real_extractN)__name__
__module____qualname__Z
_VALID_URLZ_TESTSr!   r   r   r   r    r      s:   
r   N)
__future__r   oncer   compatr   r   r   r   r   r    <module>   s   