1 from .common
import InfoExtractor
9 class ParlviewIE(InfoExtractor
):
11 _VALID_URL
= r
'https?://(?:www\.)?parlview\.aph\.gov\.au/(?:[^/]+)?\bvideoID=(?P<id>\d{6})'
13 'url': 'https://parlview.aph.gov.au/mediaPlayer.php?videoID=542661',
17 'title': "Australia's Family Law System [Part 2]",
19 'description': 'md5:7099883b391619dbae435891ca871a62',
20 'timestamp': 1621430700,
21 'upload_date': '20210519',
22 'uploader': 'Joint Committee',
25 'skip_download': True,
28 'url': 'https://parlview.aph.gov.au/mediaPlayer.php?videoID=539936',
29 'only_matching': True,
31 _API_URL
= 'https://parlview.aph.gov.au/api_v3/1/playback/getUniversalPlayerConfig?videoID=%s&format=json'
32 _MEDIA_INFO_URL
= 'https://parlview.aph.gov.au/ajaxPlayer.php?videoID=%s&tabNum=4&action=loadTab'
34 def _real_extract(self
, url
):
35 video_id
= self
._match
_id
(url
)
36 webpage
= self
._download
_webpage
(url
, video_id
)
37 media
= self
._download
_json
(self
._API
_URL
% video_id
, video_id
).get('media')
38 timestamp
= try_get(media
, lambda x
: x
['timeMap']['source']['timecode_offsets'][0], str) or '/'
40 stream
= try_get(media
, lambda x
: x
['renditions'][0], dict)
42 self
.raise_no_formats('No streams were detected')
43 elif stream
.get('streamType') != 'VOD':
44 self
.raise_no_formats('Unknown type of stream was detected: "{}"'.format(str(stream
.get('streamType'))))
45 formats
= self
._extract
_m
3u8_formats
(stream
['url'], video_id
, 'mp4', 'm3u8_native')
47 media_info
= self
._download
_webpage
(
48 self
._MEDIA
_INFO
_URL
% video_id
, video_id
, note
='Downloading media info', fatal
=False)
53 'title': self
._html
_search
_regex
(r
'<h2>([^<]+)<', webpage
, 'title', fatal
=False),
55 'duration': int_or_none(media
.get('duration')),
56 'timestamp': unified_timestamp(timestamp
.split('/', 1)[1].replace('_', ' ')),
57 'description': self
._html
_search
_regex
(
58 r
'<div[^>]+class="descripti?on"[^>]*>[^>]+<strong>[^>]+>[^>]+>([^<]+)',
59 webpage
, 'description', fatal
=False),
60 'uploader': self
._html
_search
_regex
(
61 r
'<td>[^>]+>Channel:[^>]+>([^<]+)', media_info
, 'channel', fatal
=False),
62 'thumbnail': media
.get('staticImage'),