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