o
    i%                     @   sX   d dl Z ddlmZ ddlmZmZmZmZmZm	Z	 G dd deZ
G dd	 d	eZdS )
    N   )InfoExtractor   )extract_attributesget_elements_by_class'get_elements_text_and_html_by_attributeint_or_noneparse_durationtraverse_objc                   @   sh   e Zd 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	igdddidgZdd Zd S )!WordpressPlaylistEmbedIEFzwordpress:playlistzRhttps://xlino.com/wordpress-playlist-shortcode-with-external-audio-or-video-files/z?wordpress-playlist-shortcode-with-external-audio-or-video-filesu`   WordPress: Playlist shortcode with external audio or video files – Birgir Erlendsson (birgire)r   )idtitle	age_limit   )url	info_dictplaylist_countzVhttps://pianoadventures.com/products/piano-adventures-level-1-lesson-book-enhanced-cd/z>piano-adventures-level-1-lesson-book-enhanced-cd-wp-playlist-1Wordpress PlaylistzOhttps://pianoadventures.com/wp-content/uploads/sites/13/2022/01/CD1002cover.jpg)r   r   	thumbnailr   r   z	CD1002-21mp3z21 Half-Time Showz_https://pianoadventures.com/wp-content/plugins/media-library-assistant/images/crystal/audio.pngz2Piano Adventures Level 1 Lesson Book (2nd Edition)	Classicalg     H@zNancy and Randall Faberz$md5:a9f8e9aeabbd2912bc13cc0fab1a4ce8)	r   extr   r   albumgenredurationartistdescription   skip_downloadTr   r   playlistr   paramsc                 #   s    t td|D ]6\}} j| |ddddpi }|sq fddt|dtd	D } | |d
|d   dV  qd S )Nzwp-playlist-scriptFT )fatalignore_extraerrnotec                    sz   g | ]9}  |d  |d|d t|dt|dt|dt|dtt|d|dtt|dtt|d	d
qS )srcr   )thumbr&   )metar   )r(   r   )r(   r   )r(   length_formattedr   )
dimensionsoriginalheight)r*   r+   width)r   r   r   r   r   r   r   r   r   r,   r-   )_generic_idgetr
   r	   r   ).0trackself N/home/ubuntu/.local/lib/python3.10/site-packages/yt_dlp/extractor/wordpress.py
<listcomp><   s    
zBWordpressPlaylistEmbedIE._extract_from_webpage.<locals>.<listcomp>)tracks.)expected_typez-wp-playlist-r   r   )	enumerater   _parse_jsonr.   r
   dictplaylist_result)r3   r   webpageijplaylist_jsonentriesr4   r2   r5   _extract_from_webpage5   s   
&z.WordpressPlaylistEmbedIE._extract_from_webpageN)__name__
__module____qualname__
_VALID_URLIE_NAME_WEBPAGE_TESTSrB   r4   r4   r4   r5   r      sB    #r   c                   @   s|   e Zd ZdZdZddddddd	d
dddddigdddidddddddddddddeeddd d!dgZd"d# Zd$S )%WordpressMiniAudioPlayerEmbedIEFzwordpress:mb.miniAudioPlayerz`https://news.samsung.com/global/over-the-horizon-the-evolution-of-the-samsung-galaxy-brand-soundz@over-the-horizon-the-evolution-of-the-samsung-galaxy-brand-soundzAOver the Horizon: The Evolution of the Samsung Galaxy Brand Soundr   zghttps://img.global.news.samsung.com/global/wp-content/uploads/2015/04/OTH_Main_Title-e1429612467870.jpgz$md5:bc3dd738d1f11d9232e94e6629983bf7)r   r   r   r   r   r   over_the_horizon_2013r   zOver the Horizon 2013zUhttp://news.samsung.com/global/wp-content/uploads/ringtones/over_the_horizon_2013.mp3)r   r   r   r   r   r   Tr   zGhttps://www.booksontape.com/collections/audiobooks-with-teacher-guides/zaudiobooks-with-teacher-guidesz.Audiobooks with Teacher Guides | Books on TapezLhttps://www.booksontape.com/wp-content/uploads/2016/09/bot-logo-1200x630.jpg)r   r   r   r      )r   r   playlist_mincountz$https://www.estudiords.com.br/temas/temaszTemas VariadoszGhttps://www.estudiords.com.br/wp-content/uploads/2021/03/LOGO-TEMAS.pngz$md5:ab24d6a7ed0312ad2d466e721679f5a0)r   r   r   	timestampupload_dater   r      c           	      #   s    | j d|dd d}|sd S td|}|sd S tddd| d|d	d
d}|D ]+\}}t| t fddtd|D rBq* d }| ||pP| ||dV  q*d S )NzJfunction\s*initializeMiniAudioPlayer\(\){[^}]+jQuery([^;]+)\.mb_miniPlayerzmb player params)defaultz#a\[href\s*\*=\s*\'\.([a-zA-Z\d]+)\'hrefz(?:[^\"\']+\.(?:|z))Fa)escape_valuetagc                 3   s"    | ]}|  d pdv V  qdS )classr"   N)r/   )r0   cattrsr4   r5   	<genexpr>   s     zHWordpressMiniAudioPlayerEmbedIE._extract_from_webpage.<locals>.<genexpr>z\.not\("\.([^"]+))r   r   r   )	_search_regexrefindallr   joinr   anyr.   _generic_title)	r3   r   r=   mb_player_params	file_exts
candidatesr   htmlrR   r4   rY   r5   rB      s.   
z5WordpressMiniAudioPlayerEmbedIE._extract_from_webpageN)	rC   rD   rE   rF   rG   floatstrrH   rB   r4   r4   r4   r5   rI   L   sR    	.rI   )r]   commonr   utilsr   r   r   r   r	   r
   r   rI   r4   r4   r4   r5   <module>   s
     =