U
    g8                     @   sh   d dl Z d dlZddlmZ ddlmZ ddl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)JWPlatformIE   )ExtractorErrorOnDemandPagedListextract_attributesget_element_by_classget_element_html_by_classc                
   @   s<   e Zd ZdZdddddddd	d
dddidgZdd ZdS )HollywoodReporterIEz>https?://(?:www\.)?hollywoodreporter\.com/video/(?P<id>[\w-]+)zhttps://www.hollywoodreporter.com/video/chris-pine-michelle-rodriguez-dungeons-dragons-cast-directors-on-what-it-took-to-make-film-sxsw-2023/ZzH4jZaR5Zmp4z$md5:a9a1c073770a32f178955997712c4bd9z^The cast and directors of 'Dungeons & Dragons: Honor Among Thieves' talk about their new film.z?https://cdn.jwplayer.com/v2/media/zH4jZaR5/poster.jpg?width=720Z20230312i72dg     @n@)idexttitledescriptionZ	thumbnailZupload_date	timestampdurationZskip_downloadZm3u8)url	info_dictparamsc                 C   sz   |  |}| ||}ttd|p$d}|d }|d }|dkrR| d| tS |dkrf| |dS td	| d
d S )Nzvlanding-video-card__link zdata-video-showcase-triggerzdata-video-showcase-typeZjwplayerzjwplatform:ZyoutubeZYoutubezUnsupported showcase type "")Z	_match_id_download_webpager   r
   
url_resultr   r   )selfr   Z
display_idwebpagedataZvideo_idZshowcase_type r   F/tmp/pip-unpacked-wheel-q5ljy6pj/yt_dlp/extractor/hollywoodreporter.py_real_extract    s    
z!HollywoodReporterIE._real_extractN)__name__
__module____qualname__
_VALID_URL_TESTSr   r   r   r   r   r      s   
r   c                   @   s4   e Zd ZdZddddddgZdd	 Zd
d ZdS )HollywoodReporterPlaylistIEzPhttps?://(?:www\.)?hollywoodreporter\.com/vcategory/(?P<slug>[\w-]+)-(?P<id>\d+)zHhttps://www.hollywoodreporter.com/vcategory/heat-vision-breakdown-57822/m   Z57822zheat-vision-breakdown)r   r   )r   Zplaylist_mincountr   c                 c   sd   |d7 }| j d| d| d| d|d| d}td|p>d	}td
|D ]}| |tV  qLd S )Nr   z,https://www.hollywoodreporter.com/vcategory/-z/page//zDownloading playlist page )Znotezvideo-playlist-riverr   z.<a[^>]+href="([^"]+)"[^>]+class="c-title__link)r   r	   refindallr   r   )r   slugpl_idpager   sectionr   r   r   r   _fetch_page;   s     z'HollywoodReporterPlaylistIE._fetch_pagec                 C   s6   |  |dd\}}| tt| j||d||S )Nr*   r      )Z_match_valid_urlgroupZplaylist_resultr   	functoolspartialr.   )r   r   r*   r+   r   r   r   r   E   s      z)HollywoodReporterPlaylistIE._real_extractN)r   r    r!   r"   r#   r.   r   r   r   r   r   r$   0   s   	
r$   )r1   r(   commonr   Z
jwplatformr   utilsr   r   r   r	   r
   r   r$   r   r   r   r   <module>   s   	!