1 from .brightcove
import BrightcoveNewIE
2 from .common
import InfoExtractor
10 class OneNewsNZIE(InfoExtractor
):
12 IE_DESC
= '1news.co.nz article videos'
13 _VALID_URL
= r
'https?://(?:www\.)?(?:1|one)news\.co\.nz/\d+/\d+/\d+/(?P<id>[^/?#&]+)'
16 'url': 'https://www.1news.co.nz/2022/09/29/cows-painted-green-on-parliament-lawn-in-climate-protest/',
18 'id': 'cows-painted-green-on-parliament-lawn-in-climate-protest',
19 'title': '\'Cows\' painted green on Parliament lawn in climate protest',
23 'id': '6312993358112',
24 'title': 'Activists dressed as cows painted green outside Parliament in climate protest',
27 'uploader_id': '963482464001',
28 'timestamp': 1664416255,
29 'upload_date': '20220929',
31 'thumbnail': r
're:^https?://.*\.jpg$',
32 'description': 'Greenpeace accused the Government of "greenwashing" instead of taking climate action.',
37 'url': 'https://www.1news.co.nz/2022/09/30/now-is-the-time-to-care-about-womens-rugby/',
39 'id': 'now-is-the-time-to-care-about-womens-rugby',
40 'title': 'Now is the time to care about women\'s rugby',
45 'title': 'Why I love women’s rugby: Black Fern Ruahei Demant',
47 'channel_follower_count': int,
48 'channel_url': 'https://www.youtube.com/channel/UC2BQ3U9IxoYIJyulv0bN5PQ',
50 'uploader': 'Re: News',
51 'upload_date': '20211215',
52 'uploader_id': 'UC2BQ3U9IxoYIJyulv0bN5PQ',
53 'uploader_url': 'http://www.youtube.com/channel/UC2BQ3U9IxoYIJyulv0bN5PQ',
54 'channel_id': 'UC2BQ3U9IxoYIJyulv0bN5PQ',
55 'channel': 'Re: News',
57 'thumbnail': 'https://i.ytimg.com/vi/s4wEB9neTfU/maxresdefault.jpg',
60 'categories': ['Sports'],
62 'description': 'md5:8874410e5740ed1d8fd0df839f849813',
63 'availability': 'public',
64 'playable_in_embed': True,
65 'live_status': 'not_live',
70 'url': 'https://www.1news.co.nz/2022/09/29/raw-videos-capture-hurricane-ians-fury-as-it-slams-florida/',
72 'id': 'raw-videos-capture-hurricane-ians-fury-as-it-slams-florida',
73 'title': 'Raw videos capture Hurricane Ian\'s fury as it slams Florida',
75 'playlist_mincount': 2,
77 'url': 'https://www.onenews.co.nz/2022/09/29/cows-painted-green-on-parliament-lawn-in-climate-protest/',
78 'only_matching': True,
81 BRIGHTCOVE_URL_TEMPLATE
= 'http://players.brightcove.net/%s/0xpHIR6IB_default/index.html?videoId=%s'
83 def _real_extract(self
, url
):
84 display_id
= self
._match
_id
(url
)
85 webpage
= self
._download
_webpage
(url
, display_id
)
87 fusion_metadata
= self
._search
_json
(r
'Fusion\.globalContent\s*=', webpage
, 'fusion metadata', display_id
)
90 for item
in traverse_obj(fusion_metadata
, 'content_elements') or []:
91 item_type
= traverse_obj(item
, 'subtype')
92 if item_type
== 'video':
93 brightcove_config
= traverse_obj(item
, ('embed', 'config'))
94 brightcove_url
= self
.BRIGHTCOVE_URL_TEMPLATE
% (
95 traverse_obj(brightcove_config
, 'brightcoveAccount') or '963482464001',
96 traverse_obj(brightcove_config
, 'brightcoveVideoId')
98 entries
.append(self
.url_result(brightcove_url
, BrightcoveNewIE
))
99 elif item_type
== 'youtube':
100 video_id_or_url
= traverse_obj(item
, ('referent', 'id'), ('raw_oembed', '_id'))
102 entries
.append(self
.url_result(video_id_or_url
, ie
='Youtube'))
105 raise ExtractorError('This article does not have a video.', expected
=True)
108 traverse_obj(fusion_metadata
, ('headlines', 'basic'))
109 or self
._generic
_title
('', webpage
)
111 return self
.playlist_result(entries
, display_id
, playlist_title
)