[noz] Fix extraction on python 2.6 by means of using compat_xpath

This commit is contained in:
Sergey M․ 2016-03-18 02:54:27 +06:00
parent 810c10baa1
commit e3d17b3c07
1 changed files with 5 additions and 2 deletions

View File

@ -2,7 +2,10 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from .common import InfoExtractor from .common import InfoExtractor
from ..compat import compat_urllib_parse_unquote from ..compat import (
compat_urllib_parse_unquote,
compat_xpath,
)
from ..utils import ( from ..utils import (
int_or_none, int_or_none,
find_xpath_attr, find_xpath_attr,
@ -47,7 +50,7 @@ class NozIE(InfoExtractor):
duration = int_or_none(xpath_text( duration = int_or_none(xpath_text(
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(compat_xpath('.//article/movie/file/qualities/qual')):
http_url_ele = find_xpath_attr( 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 http_url = http_url_ele.text if http_url_ele is not None else None