From 47917f24c499f7949b04a23c35459ca69adae62d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Marqui=CC=81nez=20Ferra=CC=81ndiz?= Date: Tue, 21 Jan 2014 22:04:46 +0100 Subject: [PATCH] [brightcove] Fix extraction of embedded videos MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There was a leading ‘:’ in the regex. The ‘flashvars’ parameter is not always available. --- youtube_dl/extractor/brightcove.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/youtube_dl/extractor/brightcove.py b/youtube_dl/extractor/brightcove.py index e13c040f8..e1c45d1f0 100644 --- a/youtube_dl/extractor/brightcove.py +++ b/youtube_dl/extractor/brightcove.py @@ -90,9 +90,12 @@ def _build_brighcove_url(cls, object_str): object_doc = xml.etree.ElementTree.fromstring(object_str) fv_el = find_xpath_attr(object_doc, './param', 'name', 'flashVars') - flashvars = dict( - (k, v[0]) - for k, v in compat_parse_qs(fv_el.attrib['value']).items()) + if fv_el is not None: + flashvars = dict( + (k, v[0]) + for k, v in compat_parse_qs(fv_el.attrib['value']).items()) + else: + flashvars = {} def find_param(name): if name in flashvars: @@ -131,7 +134,7 @@ def _extract_brightcove_url(cls, webpage): m_brightcove = re.search( r'''(?sx)]+?class=([\'"])[^>]*?BrightcoveExperience.*?\1 | + [^>]+?class=([\'"])[^>]*?BrightcoveExperience.*?\1 | [^>]*?>\s*''', webpage)