U
    g                     @   s<   d dl mZ d dlmZ ddlmZmZ G dd deZdS )   )BrightcoveNewIE)InfoExtractor   )ExtractorErrortraverse_objc                   @   s   e Zd ZdZdZdZdddddd	d
ddddddddd
igdddddddddedddddddded d!ed"gd#d$d%d&d'd(igdd)d*d+dd,d-d.d&d/gZd0Zd1d2 Z	d3S )4OneNewsNZIEZ1Newsz1news.co.nz article videoszEhttps?://(?:www\.)?(?:1|one)news\.co\.nz/\d+/\d+/\d+/(?P<id>[^/?#&]+)z\https://www.1news.co.nz/2022/09/29/cows-painted-green-on-parliament-lawn-in-climate-protest/z8cows-painted-green-on-parliament-lawn-in-climate-protestz:'Cows' painted green on Parliament lawn in climate protest)idtitle	info_dictZ6312993358112zMActivists dressed as cows painted green outside Parliament in climate protestZmp4zcount:6963482464001i4cZ20220929gA`"C@zre:^https?://.*\.jpg$zUGreenpeace accused the Government of "greenwashing" instead of taking climate action.)
r   r	   exttagsuploader_id	timestampupload_dateduration	thumbnaildescription)urlr
   ZplaylistzNhttps://www.1news.co.nz/2022/09/30/now-is-the-time-to-care-about-womens-rugby/z*now-is-the-time-to-care-about-womens-rugbyz+Now is the time to care about women's rugbyZs4wEB9neTfUu4   Why I love women’s rugby: Black Fern Ruahei Demantz8https://www.youtube.com/channel/UC2BQ3U9IxoYIJyulv0bN5PQzcount:12zRe: NewsZ20211215ZUC2BQ3U9IxoYIJyulv0bN5PQz7http://www.youtube.com/channel/UC2BQ3U9IxoYIJyulv0bN5PQz4https://i.ytimg.com/vi/s4wEB9neTfU/maxresdefault.jpg    ZSports   z$md5:8874410e5740ed1d8fd0df839f849813publicTZnot_live)r   r	   r   Zchannel_follower_countZchannel_urlr   Zuploaderr   r   Zuploader_urlZ
channel_idZchannelZ
like_countr   Z	age_limitZ
view_count
categoriesr   r   ZavailabilityZplayable_in_embedZlive_statusz^https://www.1news.co.nz/2022/09/29/raw-videos-capture-hurricane-ians-fury-as-it-slams-florida/z:raw-videos-capture-hurricane-ians-fury-as-it-slams-floridaz;Raw videos capture Hurricane Ian's fury as it slams Floridar   )r   r
   Zplaylist_mincountz^https://www.onenews.co.nz/2022/09/29/cows-painted-green-on-parliament-lawn-in-climate-protest/)r   Zonly_matchingzHhttp://players.brightcove.net/%s/0xpHIR6IB_default/index.html?videoId=%sc                 C   s   |  |}| ||}| d|d|}g }t|dp6g D ]~}t|d}|dkrt|d}| jt|dphdt|d	f }	|| |	t q8|d
kr8t|dd}
|
r8|| j|
dd q8|stdddt|dp| 	d|}| 
|||S )NzFusion\.globalContent\s*=zfusion metadataZcontent_elementssubtypevideo)embedconfigZbrightcoveAccountr   ZbrightcoveVideoIdZyoutube)Zreferentr   )Z
raw_oembedZ_idZYoutube)Ziez#This article does not have a video.T)expected)Z	headlinesbasic )Z	_match_idZ_download_webpageZ_search_jsonr   BRIGHTCOVE_URL_TEMPLATEappendZ
url_resultr   r   Z_generic_titleZplaylist_result)selfr   Z
display_idZwebpageZfusion_metadataentriesitemZ	item_typeZbrightcove_configZbrightcove_urlZvideo_id_or_urlZplaylist_title r%   >/tmp/pip-unpacked-wheel-q5ljy6pj/yt_dlp/extractor/onenewsnz.py_real_extractO   s.    




zOneNewsNZIE._real_extractN)
__name__
__module____qualname__ZIE_NAMEZIE_DESCZ
_VALID_URLintZ_TESTSr    r'   r%   r%   r%   r&   r      s~   #	Cr   N)Z
brightcover   commonr   utilsr   r   r   r%   r%   r%   r&   <module>   s   