aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl
diff options
context:
space:
mode:
authorRicardo Constantino <wiiaboo@gmail.com>2018-03-07 21:31:53 +0000
committerSergey M․ <dstftw@gmail.com>2018-03-18 02:48:44 +0700
commit96b8b9abaecb7518d901dc9d6a617f19c3161236 (patch)
treeaa320ed4589f11131c381e08777265229424ff9c /youtube_dl
parent178ee88319a384b66d9b2da27a819f32ba870425 (diff)
[extractor/generic] Support relative URIs in _parse_xspf
<location> can have relative URIs, not just absolute.
Diffstat (limited to 'youtube_dl')
-rw-r--r--youtube_dl/extractor/common.py6
-rw-r--r--youtube_dl/extractor/generic.py4
2 files changed, 6 insertions, 4 deletions
diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py
index fcdd0fd14..c1e1012e7 100644
--- a/youtube_dl/extractor/common.py
+++ b/youtube_dl/extractor/common.py
@@ -1700,9 +1700,9 @@ class InfoExtractor(object):
'Unable to download xspf manifest', fatal=fatal)
if xspf is False:
return []
- return self._parse_xspf(xspf, playlist_id)
+ return self._parse_xspf(xspf, playlist_id, base_url(playlist_url))
- def _parse_xspf(self, playlist, playlist_id):
+ def _parse_xspf(self, playlist, playlist_id, playlist_base_url=''):
NS_MAP = {
'xspf': 'http://xspf.org/ns/0/',
's1': 'http://static.streamone.nl/player/ns/0',
@@ -1720,7 +1720,7 @@ class InfoExtractor(object):
xpath_text(track, xpath_with_ns('./xspf:duration', NS_MAP), 'duration'), 1000)
formats = [{
- 'url': location.text,
+ 'url': urljoin(playlist_base_url, location.text),
'format_id': location.get(xpath_with_ns('s1:label', NS_MAP)),
'width': int_or_none(location.get(xpath_with_ns('s1:width', NS_MAP))),
'height': int_or_none(location.get(xpath_with_ns('s1:height', NS_MAP))),
diff --git a/youtube_dl/extractor/generic.py b/youtube_dl/extractor/generic.py
index dbd565066..023ccbc9b 100644
--- a/youtube_dl/extractor/generic.py
+++ b/youtube_dl/extractor/generic.py
@@ -2232,7 +2232,9 @@ class GenericIE(InfoExtractor):
self._sort_formats(smil['formats'])
return smil
elif doc.tag == '{http://xspf.org/ns/0/}playlist':
- return self.playlist_result(self._parse_xspf(doc, video_id), video_id)
+ return self.playlist_result(
+ self._parse_xspf(doc, video_id, compat_str(full_response.geturl())),
+ video_id)
elif re.match(r'(?i)^(?:{[^}]+})?MPD$', doc.tag):
info_dict['formats'] = self._parse_mpd_formats(
doc,