[extractor/common] Do not fail on invalid data while parsing F4M manifest in non fatal mode

This commit is contained in:
Sergey M․ 2019-03-05 23:45:40 +07:00
parent 5dcd630dca
commit d9eb580a79
No known key found for this signature in database
GPG key ID: 2C393E0F18A9236D

View file

@ -13,6 +13,7 @@
import sys import sys
import time import time
import math import math
import xml
from ..compat import ( from ..compat import (
compat_cookiejar, compat_cookiejar,
@ -1464,6 +1465,9 @@ def _extract_f4m_formats(self, manifest_url, video_id, preference=None, f4m_id=N
def _parse_f4m_formats(self, manifest, manifest_url, video_id, preference=None, f4m_id=None, def _parse_f4m_formats(self, manifest, manifest_url, video_id, preference=None, f4m_id=None,
transform_source=lambda s: fix_xml_ampersands(s).strip(), transform_source=lambda s: fix_xml_ampersands(s).strip(),
fatal=True, m3u8_id=None): 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 # 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') 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: if akamai_pv is not None and ';' in akamai_pv.text: