[brightcove:legacy] Relax videoPlayer validation check (closes #12381)
authorSergey M․ <dstftw@gmail.com>
Tue, 7 Mar 2017 15:59:33 +0000 (22:59 +0700)
committerSergey M․ <dstftw@gmail.com>
Tue, 7 Mar 2017 15:59:33 +0000 (22:59 +0700)
youtube_dl/extractor/brightcove.py

index 66c8cb219818f380bfb41ff01c1d5e41aee6e6ab..46ef8e605286ac0b079dfe30720de6a1ba9f48f5 100644 (file)
@@ -193,7 +193,13 @@ class BrightcoveLegacyIE(InfoExtractor):
         if videoPlayer is not None:
             if isinstance(videoPlayer, list):
                 videoPlayer = videoPlayer[0]
-            if not (videoPlayer.isdigit() or videoPlayer.startswith('ref:')):
+            videoPlayer = videoPlayer.strip()
+            # UUID is also possible for videoPlayer (e.g.
+            # http://www.popcornflix.com/hoodies-vs-hooligans/7f2d2b87-bbf2-4623-acfb-ea942b4f01dd
+            # or http://www8.hp.com/cn/zh/home.html)
+            if not (re.match(
+                    r'^(?:\d+|[\da-fA-F]{8}-?[\da-fA-F]{4}-?[\da-fA-F]{4}-?[\da-fA-F]{4}-?[\da-fA-F]{12})$',
+                    videoPlayer) or videoPlayer.startswith('ref:')):
                 return None
             params['@videoPlayer'] = videoPlayer
         linkBase = find_param('linkBaseURL')