X-Git-Url: https://git.rapsys.eu/youtubedl/blobdiff_plain/509eeaaa67b2f901752c50fc6edf41954dbe3085..aebf9c8f14c9f5d45f8c6aa523ee135fdfd421b2:/youtube_dl/extractor/brightcove.py?ds=sidebyside diff --git a/youtube_dl/extractor/brightcove.py b/youtube_dl/extractor/brightcove.py index 419951b..c947337 100644 --- a/youtube_dl/extractor/brightcove.py +++ b/youtube_dl/extractor/brightcove.py @@ -3,27 +3,35 @@ from __future__ import unicode_literals import re import json -import xml.etree.ElementTree from .common import InfoExtractor -from ..utils import ( +from ..compat import ( + compat_etree_fromstring, + compat_parse_qs, + compat_str, compat_urllib_parse, - find_xpath_attr, - fix_xml_ampersands, + compat_urllib_parse_urlparse, compat_urlparse, - compat_str, - compat_urllib_request, - compat_parse_qs, - + compat_xml_parse_error, +) +from ..utils import ( determine_ext, ExtractorError, - unsmuggle_url, + find_xpath_attr, + fix_xml_ampersands, + float_or_none, + js_to_json, + int_or_none, + parse_iso8601, + sanitized_Request, unescapeHTML, + unsmuggle_url, ) -class BrightcoveIE(InfoExtractor): - _VALID_URL = r'https?://.*brightcove\.com/(services|viewer).*\?(?P.*)' +class BrightcoveLegacyIE(InfoExtractor): + IE_NAME = 'brightcove:legacy' + _VALID_URL = r'(?:https?://.*brightcove\.com/(services|viewer).*?\?|brightcove:)(?P.*)' _FEDERATED_URL_TEMPLATE = 'http://c.brightcove.com/services/viewer/htmlFederated?%s' _TESTS = [ @@ -87,6 +95,16 @@ class BrightcoveIE(InfoExtractor): 'description': 'UCI MTB World Cup 2014: Fort William, UK - Downhill Finals', }, }, + { + # playlist test + # from http://support.brightcove.com/en/video-cloud/docs/playlist-support-single-video-players + 'url': 'http://c.brightcove.com/services/viewer/htmlFederated?playerID=3550052898001&playerKey=AQ%7E%7E%2CAAABmA9XpXk%7E%2C-Kp7jNgisre1fG5OdqpAFUTcs0lP_ZoL', + 'info_dict': { + 'title': 'Sealife', + 'id': '3550319591001', + }, + 'playlist_mincount': 7, + }, ] @classmethod @@ -97,13 +115,18 @@ class BrightcoveIE(InfoExtractor): """ # Fix up some stupid HTML, see https://github.com/rg3/youtube-dl/issues/1553 - object_str = re.sub(r'(', + object_str = re.sub(r'(', lambda m: m.group(1) + '/>', object_str) # Fix up some stupid XML, see https://github.com/rg3/youtube-dl/issues/1608 object_str = object_str.replace('<--', '