[brightcove] Fix extraction of embedded videos
authorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Tue, 21 Jan 2014 21:04:46 +0000 (22:04 +0100)
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Tue, 21 Jan 2014 21:04:46 +0000 (22:04 +0100)
There was a leading ‘:’ in the regex.
The ‘flashvars’ parameter is not always available.

youtube_dl/extractor/brightcove.py

index e13c040f8bc24768d68ae13fa185ceaf0224d41d..e1c45d1f0bbb27ce1b96ac65eb12c798ce44ff8b 100644 (file)
@@ -90,9 +90,12 @@ class BrightcoveIE(InfoExtractor):
         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 @@ class BrightcoveIE(InfoExtractor):
         m_brightcove = re.search(
             r'''(?sx)<object
             (?:
-                :[^>]+?class=([\'"])[^>]*?BrightcoveExperience.*?\1 |
+                [^>]+?class=([\'"])[^>]*?BrightcoveExperience.*?\1 |
                 [^>]*?>\s*<param\s+name="movie"\s+value="https?://[^/]*brightcove\.com/
             ).+?</object>''',
             webpage)