mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-12 14:26:49 +01:00
[noz] extract f4m and m3u8 formats
This commit is contained in:
parent
975b9c9ab0
commit
cf6cd07396
@ -6,6 +6,7 @@
|
|||||||
from ..utils import (
|
from ..utils import (
|
||||||
int_or_none,
|
int_or_none,
|
||||||
xpath_text,
|
xpath_text,
|
||||||
|
update_url_query,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -46,17 +47,29 @@ def _real_extract(self, url):
|
|||||||
doc, './/article/movie/file/duration'))
|
doc, './/article/movie/file/duration'))
|
||||||
formats = []
|
formats = []
|
||||||
for qnode in doc.findall('.//article/movie/file/qualities/qual'):
|
for qnode in doc.findall('.//article/movie/file/qualities/qual'):
|
||||||
video_node = qnode.find('./html_urls/video_url[@format="video/mp4"]')
|
http_url = xpath_text(
|
||||||
if video_node is None:
|
qnode, './html_urls/video_url[@format="video/mp4"]')
|
||||||
continue # auto
|
if http_url:
|
||||||
formats.append({
|
formats.append({
|
||||||
'url': video_node.text,
|
'url': http_url,
|
||||||
'format_name': xpath_text(qnode, './name'),
|
'format_name': xpath_text(qnode, './name'),
|
||||||
'format_id': xpath_text(qnode, './id'),
|
'format_id': '%s-%s' % ('http', xpath_text(qnode, './id')),
|
||||||
'height': int_or_none(xpath_text(qnode, './height')),
|
'height': int_or_none(xpath_text(qnode, './height')),
|
||||||
'width': int_or_none(xpath_text(qnode, './width')),
|
'width': int_or_none(xpath_text(qnode, './width')),
|
||||||
'tbr': int_or_none(xpath_text(qnode, './bitrate'), scale=1000),
|
'tbr': int_or_none(xpath_text(qnode, './bitrate'), scale=1000),
|
||||||
})
|
})
|
||||||
|
else:
|
||||||
|
f4m_url = xpath_text(qnode, 'url_hd2')
|
||||||
|
if f4m_url:
|
||||||
|
formats.extend(self._extract_f4m_formats(
|
||||||
|
update_url_query(f4m_url, {'hdcore': '3.4.0'}),
|
||||||
|
video_id, f4m_id='hds', fatal=False))
|
||||||
|
m3u8_url = xpath_text(
|
||||||
|
qnode, './html_urls/video_url[@format="application/vnd.apple.mpegurl"]')
|
||||||
|
if m3u8_url:
|
||||||
|
formats.extend(self._extract_m3u8_formats(
|
||||||
|
m3u8_url, video_id, 'mp4', 'm3u8_native',
|
||||||
|
m3u8_id='hls', fatal=False))
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
Loading…
Reference in New Issue
Block a user