[extractor/common] Do not fail on invalid data while parsing F4M manifest in non...
authorSergey M․ <dstftw@gmail.com>
Tue, 5 Mar 2019 16:45:40 +0000 (23:45 +0700)
committerSergey M․ <dstftw@gmail.com>
Tue, 5 Mar 2019 16:56:33 +0000 (23:56 +0700)
youtube_dl/extractor/common.py

index 641e50f3c51fc5d5ae086ce327a82439fdc9fbef..55ce1a888bb4dc6c8c3172c78920636756c21a28 100644 (file)
@@ -13,6 +13,7 @@ import socket
 import sys
 import time
 import math
+import xml
 
 from ..compat import (
     compat_cookiejar,
@@ -1464,6 +1465,9 @@ class InfoExtractor(object):
     def _parse_f4m_formats(self, manifest, manifest_url, video_id, preference=None, f4m_id=None,
                            transform_source=lambda s: fix_xml_ampersands(s).strip(),
                            fatal=True, m3u8_id=None):
+        if not isinstance(manifest, xml.etree.ElementTree.Element) and not fatal:
+            return []
+
         # currently youtube-dl cannot decode the playerVerificationChallenge as Akamai uses Adobe Alchemy
         akamai_pv = manifest.find('{http://ns.adobe.com/f4m/1.0}pv-2.0')
         if akamai_pv is not None and ';' in akamai_pv.text: