]> git.bitcoin.ninja Git - youtube-dl/commitdiff
Brightcove extractor: support customBC.createVideo(...); method
authorfnord <fnord@fnord.mobi>
Sat, 13 Jun 2015 11:09:44 +0000 (06:09 -0500)
committerfnord <fnord@fnord.mobi>
Sat, 13 Jun 2015 11:20:30 +0000 (06:20 -0500)
found in http://www.americanbar.org/groups/family_law.html and
http://america.aljazeera.com/watch/shows/america-tonight/2015/6/exclusive-hunting-isil-with-the-pkk.html

youtube_dl/extractor/brightcove.py

index c1d4320e1ce73b6d9c5a9313eee61a7e05f9daf9..20a6ed965ad54f393e64c1ec6348d3adfc13a9c5 100644 (file)
@@ -188,7 +188,19 @@ class BrightcoveIE(InfoExtractor):
                 [^>]*?>\s*<param\s+name="movie"\s+value="https?://[^/]*brightcove\.com/
             ).+?>\s*</object>''',
             webpage)
-        return list(filter(None, [cls._build_brighcove_url(m) for m in matches]))
+        if matches:
+            return list(filter(None, [cls._build_brighcove_url(m) for m in matches]))
+
+        custombcs = re.findall(r'customBC.\createVideo\((.+?)\);',webpage)
+        if custombcs:
+            urls = []
+            for match in custombcs:
+                # brightcove playerkey begins with AQ and is 50 characters in length,
+                # however it's appended to itself in places, so truncate.
+                f = re.search(r'["\'](AQ[^"\']{48}).*?["\'](\d+)["\']', match)
+                if f:
+                    urls.append('brightcove:playerKey='+f.group(1)+'&%40videoPlayer='+f.group(2))
+            return urls
 
     def _real_extract(self, url):
         url, smuggled_data = unsmuggle_url(url, {})