mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-21 20:46:36 -05:00
[brightcove] Handle non well-formed XMLs (#5421)
This commit is contained in:
parent
476e1095fa
commit
94c1255782
1 changed files with 5 additions and 2 deletions
|
@ -117,7 +117,10 @@ def _build_brighcove_url(cls, object_str):
|
|||
object_str = re.sub(r'(<object[^>]*)(xmlns=".*?")', r'\1', object_str)
|
||||
object_str = fix_xml_ampersands(object_str)
|
||||
|
||||
object_doc = xml.etree.ElementTree.fromstring(object_str.encode('utf-8'))
|
||||
try:
|
||||
object_doc = xml.etree.ElementTree.fromstring(object_str.encode('utf-8'))
|
||||
except xml.etree.ElementTree.ParseError:
|
||||
return
|
||||
|
||||
fv_el = find_xpath_attr(object_doc, './param', 'name', 'flashVars')
|
||||
if fv_el is not None:
|
||||
|
@ -185,7 +188,7 @@ def _extract_brightcove_urls(cls, webpage):
|
|||
[^>]*?>\s*<param\s+name="movie"\s+value="https?://[^/]*brightcove\.com/
|
||||
).+?>\s*</object>''',
|
||||
webpage)
|
||||
return [cls._build_brighcove_url(m) for m in matches]
|
||||
return filter(None, [cls._build_brighcove_url(m) for m in matches])
|
||||
|
||||
def _real_extract(self, url):
|
||||
url, smuggled_data = unsmuggle_url(url, {})
|
||||
|
|
Loading…
Reference in a new issue