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