
    VGhb                     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	 ddl
mZ  G d de      Zy)	    N   )InfoExtractor   )ExtractorErrormake_archive_idunified_timestampurljoin)traverse_objc                       e Zd ZdZdddddddd	d
dgd	ddddddddddgddd	ddi dddddededd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6gd7d8d9g d:ed;d<d=ed>d9d?d@
dgZdA ZdB ZyC)D
NintendoIEzdhttps?://(?:www\.)?nintendo\.com/(?:(?P<locale>\w{2}(?:-\w{2})?)/)?nintendo-direct/(?P<slug>[^/?#]+)z4https://www.nintendo.com/nintendo-direct/09-04-2019/mp42oPmiviVePUA1IqAZzjuVhz
09-04-2019zNintendo Direct 9.4.2019i`o]z$md5:8aac2780361d8cb772b6d1de66d7d6f420190904   z)nintendo J2bXdmaTE6fe3dWJTPcc7m23FNbc_A1V)	extid
display_idtitle	timestampdescriptionupload_date	age_limit_old_archive_ids)url	info_dictz:https://www.nintendo.com/en-ca/nintendo-direct/08-31-2023/2TB2w2rJhNYF84qQ9E57hUz
08-31-2023z)Super Mario Bros. Wonder Direct 8.31.2023ip:dz$md5:3067c5b824bcfdae9090a7f38ab2d200zMild Fantasy ViolencezIn-Game Purchases20230831   )	r   r   r   r   r   r   tagsr   r   zAhttps://www.nintendo.com/us/nintendo-direct/50-fact-extravaganza/r   r   j0BBGzfw0pQchannel_follower_count
view_countr   zSLearn new details about Super Smash Bros. for Wii U, which launches on November 21.durationiK  availabilitypublic	thumbnailz:https://i.ytimg.com/vi_webp/j0BBGzfw0pQ/maxresdefault.webpr   ipHT
channel_idzUCGIY_O-8vW4rfX98KlMkvRgchapterszcount:53heatmapz	count:100r   20141023uploader_idz@NintendoAmericaplayable_in_embedT
categoriesGamingr   z50-fact-extravaganzazNintendo of America)zComic MischiefzCartoon ViolencezMild Suggestive Themesz8https://www.youtube.com/channel/UCGIY_O-8vW4rfX98KlMkvRg
   z(https://www.youtube.com/@NintendoAmericanot_livez50-FACT Extravaganza)
channelr   
like_countchannel_urlr   uploader_urlcomment_countlive_statusuploaderr   c                 T    t        dt        j                  j                  |            S )Nzhttps://assets.nintendo.com/)r	   urllibparsequote)selfpaths     b/var/www/it7/html/youtubeDownloader/venv/lib/python3.12/site-packages/yt_dlp/extractor/nintendo.py_create_asset_urlzNintendoIE._create_asset_urlK   s    5v||7I7I$7OPP    c                 ,   | j                  |      j                  dd      \  }}|xs dj                  d      \  }}}|j                         xs d d|j	                          }| j                  d| d| d	d
       | j                  d|dt        j                  ||dd      t        j                  ddddid      d      }t        |ddt        hf      }	|	st        d| dd
      dj                  t        |d            }
|
rt        d|
xs d       t        |	d t        hfd!t        hfd"t        hfd#d$t        hfd%d&t        hfd'd(d)t        hfd*| j                   hfd+      }||d,<   t        |	d-d.t        hf      }|s?t        |	d/t        hf      }|s| j#                  d0|1        | j$                  |fi |d2d
iS |j'                  d3      rt)        | |d4d        g|d5<   | j+                  | j!                  d6| d7      |      |d8<   |S )9NlocaleslugUS-en_zUsing locale z (from )T)	only_oncezhttps://graph.nintendo.com/NintendoDirect)rB   rC   ),:)
separatorspersistedQueryr   @969b16fe9f08b686fa37bc44d1fd913b6188e65794bb5e341c54fa683a8004cb)version
sha256Hash)operationName	variables
extensions)querydatadirectzNo Nintendo Direct with id z exists)expectedz, )errors.messagezGraphQL API error: zUnknown errorr   name	startDater   textcontentRatingordercontentDescriptors.labelr&   )r   r   r   r   r   r   r&   r   videopublicId
liveStreamz Could not find any video formats)video_idurl_transparentzLegacy Videos/   r   z/video/upload/sp_full_hd/v1/z.m3u8formats)_match_valid_urlgroup
rpartitionlowerupperwrite_debug_download_jsonjsondumpsr
   dictr   joinstrr   intr?   raise_no_formats
url_result
startswithr   _extract_m3u8_formats)r<   r   rB   rC   languagerG   countryparsed_localeresponsedirect_inforY   resultasset_id
youtube_ids                 r>   _real_extractzNintendoIE._real_extractN   s~   ,,S177&I &$::3?!W#>>+3t4Agmmo5FG=wvhaHTXY&&'Dd-'% %& **  "d#&
 %&S
&  #8fh-GH #>tfG!LW[\\<2LMN #6v7P6Q!RSSk#-se_%(9':;)6C59)7SE:)3#?%(>(>'?@,
   $|gzC5-IJ%kL3%3HIJ%%&HSW%X"4??:NNNN/0*9$*N)OF%& 66""%A(5#QRTXZy r@   N)__name__
__module____qualname__
_VALID_URLru   _TESTSr?   r    r@   r>   r   r      sz   xJE*&/#A%!L M

 L*&@#A,.AB%

 S
5
-
 %c
 #	

 p
 
 H
 U
 
 4
 

 {
 :
 -
  
  8*!
" 0#
$ -TUF %-+7
59FvQ5r@   r   )rp   urllib.parser9   commonr   utilsr   r   r   r	   utils.traversalr
   r   r   r@   r>   <module>r      s+      !  +u ur@   