a
    h'                     @   s@   d dl mZ ddlmZmZmZ ddlmZ G dd deZdS )   )InfoExtractor   )parse_age_limitparse_durationurl_or_none)traverse_objc                
   @   s~   e Zd ZdZdddddddg d	d
ddiddddddddddgd
ddiddddg ddddddidgZdd ZdS )MagellanTVIEzAhttps?://(?:www\.)?magellantv\.com/(?:watch|video)/(?P<id>[\w-]+)z;https://www.magellantv.com/watch/incas-the-new-story?type=vzincas-the-new-storymp4zIncas: The New Storyz$md5:936c7f6d711c02dfb9db22a067b586fe   g     @)zAncient HistoryZArchaeologyAnthropology)idexttitledescription	age_limitdurationtagsZskip_downloadZm3u8)urlZ	info_dictparamszFhttps://www.magellantv.com/video/tortured-to-death-murdering-the-nannyz%tortured-to-death-murdering-the-nannyz&Tortured to Death: Murdering the Nannyz$md5:d87033594fa218af2b1a8b49f52511e5g     @z
True CrimeZMurderz:https://www.magellantv.com/watch/celebration-nation?type=szcelebration-nation)zArt & CulturezHuman Interestr   ZChinaZHistoryZ	Ancestors)r   r   r   r   r   c              
   C   s   |  |}| ||}| ||d d d }t|dthtf}g i  }}tt|dthfD ]4}| j||dddd	\}	}
|	|	 | j
|
|d
 q^|st|ddthf }rd|v r| j|d | j| j d| dd |||dt|dthfddthfdthfdthfddthfdS )NpropsZ	pagePropsZreactContext))videoZdetail)ZseriesZcurrentEpisode))Z	manifests.hlsZjwp_video_urlr	   r   F)Zm3u8_idfatal)targetZerrorDetailPageZerrorMessagezavailable in your country)msgz said: T)expected)r   formats	subtitlesr   metadatar   r   ZratingCategoryr   .)r   r   r   r   r   )Z	_match_idZ_download_webpageZ_search_nextjs_datar   dictanysetr   Z#_extract_m3u8_formats_and_subtitlesextendZ_merge_subtitlesstrZraise_geo_restrictedZraise_no_formatsZIE_NAMEr   r   )selfr   Zvideo_idZwebpagecontextdatar   r   Zm3u8_urlZfmtssubserror r)   P/mnt/pikpak/tmp/myenv/lib/python3.9/site-packages/yt_dlp/extractor/magellantv.py_real_extract,   s6    






zMagellanTVIE._real_extractN)__name__
__module____qualname__Z
_VALID_URLZ_TESTSr+   r)   r)   r)   r*   r      sD   		$r   N)	commonr   utilsr   r   r   Zutils.traversalr   r   r)   r)   r)   r*   <module>   s   