aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2015-12-10 22:59:50 +0600
committerSergey M․ <dstftw@gmail.com>2015-12-10 22:59:50 +0600
commit17b786ae73848a8f26ecc6e95947c3f65edc667f (patch)
tree377bf1ec644ec8a66ee6ab922e7aa0f33db93017
parentdfd42a43c3df90507e37f2247eb36ffe07780018 (diff)
[downloader/f4m] Fix malformed manifests (Closes #7823)
-rw-r--r--youtube_dl/downloader/f4m.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/youtube_dl/downloader/f4m.py b/youtube_dl/downloader/f4m.py
index 6170cc155..7819a91dc 100644
--- a/youtube_dl/downloader/f4m.py
+++ b/youtube_dl/downloader/f4m.py
@@ -15,6 +15,7 @@ from ..compat import (
)
from ..utils import (
encodeFilename,
+ fix_xml_ampersands,
sanitize_open,
struct_pack,
struct_unpack,
@@ -288,7 +289,10 @@ class F4mFD(FragmentFD):
self.to_screen('[%s] Downloading f4m manifest' % self.FD_NAME)
urlh = self.ydl.urlopen(man_url)
man_url = urlh.geturl()
- manifest = urlh.read()
+ # Some manifests may be malformed, e.g. prosiebensat1 generated manifests
+ # (see https://github.com/rg3/youtube-dl/issues/6215#issuecomment-121704244
+ # and https://github.com/rg3/youtube-dl/issues/7823)
+ manifest = fix_xml_ampersands(urlh.read()).strip()
doc = compat_etree_fromstring(manifest)
formats = [(int(f.attrib.get('bitrate', -1)), f)