X-Git-Url: https://git.rapsys.eu/youtubedl/blobdiff_plain/6d835d4d6903cf5e18ad01844736929e06d16004..d018d3313032e12968a6add6800e51d412e2f602:/youtube_dl/extractor/brightcove.py?ds=inline diff --git a/youtube_dl/extractor/brightcove.py b/youtube_dl/extractor/brightcove.py index ad22cba..f5ebae1 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 = [ @@ -93,6 +101,7 @@ class BrightcoveIE(InfoExtractor): '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, }, @@ -106,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('<--', '