From 99877772d08285b1b2743427ddd20440f4f4ded2 Mon Sep 17 00:00:00 2001 From: Philipp Hagemeister Date: Mon, 3 Feb 2014 15:19:40 +0100 Subject: [generic] Add support for multiple brightcove URLs (Fixes #2283) --- youtube_dl/extractor/brightcove.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'youtube_dl/extractor/brightcove.py') diff --git a/youtube_dl/extractor/brightcove.py b/youtube_dl/extractor/brightcove.py index 9ccf923a6..031fe385d 100644 --- a/youtube_dl/extractor/brightcove.py +++ b/youtube_dl/extractor/brightcove.py @@ -127,25 +127,28 @@ class BrightcoveIE(InfoExtractor): @classmethod def _extract_brightcove_url(cls, webpage): - """Try to extract the brightcove url from the wepbage, returns None + """Try to extract the brightcove url from the webpage, returns None if it can't be found """ + urls = cls._extract_brightcove_urls(webpage) + return urls[0] if urls else None + + @classmethod + def _extract_brightcove_urls(cls, webpage): + """Return a list of all Brightcove URLs from the webpage """ url_m = re.search(r']+?class=([\'"])[^>]*?BrightcoveExperience.*?\1 | + [^>]+?class=[\'"][^>]*?BrightcoveExperience.*?[\'"] | [^>]*?>\s*''', webpage) - if m_brightcove is not None: - return cls._build_brighcove_url(m_brightcove.group()) - else: - return None + return [cls._build_brighcove_url(m) for m in matches] def _real_extract(self, url): url, smuggled_data = unsmuggle_url(url, {}) -- cgit v1.2.3