mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-12-23 16:36:48 +00:00
[noz] fix extraction in python 2.6
This commit is contained in:
parent
3ff8279e80
commit
0c9ff24041
@ -5,6 +5,7 @@ from .common import InfoExtractor
|
|||||||
from ..compat import compat_urllib_parse_unquote
|
from ..compat import compat_urllib_parse_unquote
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
int_or_none,
|
int_or_none,
|
||||||
|
find_xpath_attr,
|
||||||
xpath_text,
|
xpath_text,
|
||||||
update_url_query,
|
update_url_query,
|
||||||
)
|
)
|
||||||
@ -47,8 +48,9 @@ class NozIE(InfoExtractor):
|
|||||||
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'):
|
||||||
http_url = xpath_text(
|
http_url_ele = find_xpath_attr(
|
||||||
qnode, './html_urls/video_url[@format="video/mp4"]')
|
qnode, './html_urls/video_url', 'format', 'video/mp4')
|
||||||
|
http_url = http_url_ele.text if http_url_ele is not None else None
|
||||||
if http_url:
|
if http_url:
|
||||||
formats.append({
|
formats.append({
|
||||||
'url': http_url,
|
'url': http_url,
|
||||||
@ -64,8 +66,10 @@ class NozIE(InfoExtractor):
|
|||||||
formats.extend(self._extract_f4m_formats(
|
formats.extend(self._extract_f4m_formats(
|
||||||
update_url_query(f4m_url, {'hdcore': '3.4.0'}),
|
update_url_query(f4m_url, {'hdcore': '3.4.0'}),
|
||||||
video_id, f4m_id='hds', fatal=False))
|
video_id, f4m_id='hds', fatal=False))
|
||||||
m3u8_url = xpath_text(
|
m3u8_url_ele = find_xpath_attr(
|
||||||
qnode, './html_urls/video_url[@format="application/vnd.apple.mpegurl"]')
|
qnode, './html_urls/video_url',
|
||||||
|
'format', 'application/vnd.apple.mpegurl')
|
||||||
|
m3u8_url = m3u8_url_ele.text if m3u8_url_ele is not None else None
|
||||||
if m3u8_url:
|
if m3u8_url:
|
||||||
formats.extend(self._extract_m3u8_formats(
|
formats.extend(self._extract_m3u8_formats(
|
||||||
m3u8_url, video_id, 'mp4', 'm3u8_native',
|
m3u8_url, video_id, 'mp4', 'm3u8_native',
|
||||||
|
Loading…
Reference in New Issue
Block a user