Merge remote-tracking branch 'naglis/nosvideo'
This commit is contained in:
commit
acd9db5902
1 changed files with 10 additions and 4 deletions
|
@ -8,11 +8,11 @@ from ..utils import (
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
compat_urllib_request,
|
compat_urllib_request,
|
||||||
urlencode_postdata,
|
urlencode_postdata,
|
||||||
|
xpath_text,
|
||||||
xpath_with_ns,
|
xpath_with_ns,
|
||||||
)
|
)
|
||||||
|
|
||||||
_x = lambda p: xpath_with_ns(p, {'xspf': 'http://xspf.org/ns/0/'})
|
_x = lambda p: xpath_with_ns(p, {'xspf': 'http://xspf.org/ns/0/'})
|
||||||
_find = lambda el, p: el.find(_x(p)).text.strip()
|
|
||||||
|
|
||||||
|
|
||||||
class NosVideoIE(InfoExtractor):
|
class NosVideoIE(InfoExtractor):
|
||||||
|
@ -53,9 +53,15 @@ class NosVideoIE(InfoExtractor):
|
||||||
playlist = self._download_xml(playlist_url, video_id)
|
playlist = self._download_xml(playlist_url, video_id)
|
||||||
|
|
||||||
track = playlist.find(_x('.//xspf:track'))
|
track = playlist.find(_x('.//xspf:track'))
|
||||||
title = _find(track, './xspf:title')
|
if track is None:
|
||||||
url = _find(track, './xspf:file')
|
raise ExtractorError(
|
||||||
thumbnail = _find(track, './xspf:image')
|
'XML playlist is missing the \'track\' element',
|
||||||
|
expected=True)
|
||||||
|
title = xpath_text(track, _x('./xspf:title'), 'title')
|
||||||
|
url = xpath_text(track, _x('./xspf:file'), 'URL', fatal=True)
|
||||||
|
thumbnail = xpath_text(track, _x('./xspf:image'), 'thumbnail')
|
||||||
|
if title is not None:
|
||||||
|
title = title.strip()
|
||||||
|
|
||||||
formats = [{
|
formats = [{
|
||||||
'format_id': 'sd',
|
'format_id': 'sd',
|
||||||
|
|
Loading…
Reference in a new issue