[extractor/generic] Improve squarespace detection and fix test (closes #21859, refs #21294, refs #21802)

This commit is contained in:
Sergey M․ 2019-09-01 01:23:58 +07:00
parent d78657fd18
commit 7cb51b5daf
No known key found for this signature in database
GPG Key ID: 2C393E0F18A9236D

View File

@ -2081,6 +2081,11 @@ class GenericIE(InfoExtractor):
'info_dict': { 'info_dict': {
'id': 'Tc7b_JGdZfw', 'id': 'Tc7b_JGdZfw',
'title': 'Out of the Blue, at Childish Things 10', 'title': 'Out of the Blue, at Childish Things 10',
'ext': 'mp4',
'description': 'md5:a83d0026666cf5ee970f8bd1cfd69c7f',
'uploader_id': 'helendouglashouse',
'uploader': 'Helen & Douglas House',
'upload_date': '20140328',
}, },
'params': { 'params': {
'skip_download': True, 'skip_download': True,
@ -2406,12 +2411,11 @@ def _real_extract(self, url):
# Unescaping the whole page allows to handle those cases in a generic way # Unescaping the whole page allows to handle those cases in a generic way
webpage = compat_urllib_parse_unquote(webpage) webpage = compat_urllib_parse_unquote(webpage)
# unescape re.sub replacement # Unescape squarespace embeds to be detected by generic extractor,
def unescape_resub(m): # see https://github.com/ytdl-org/youtube-dl/issues/21294
return unescapeHTML(m.group(0)) webpage = re.sub(
r'<div[^>]+class=[^>]*?\bsqs-video-wrapper\b[^>]*>',
# unescape squarespace video embeds lambda x: unescapeHTML(x.group(0)), webpage)
webpage = re.sub(r'<div[^>]+class=[^>]*?sqs-video-wrapper[^>]*>', unescape_resub, webpage)
# it's tempting to parse this further, but you would # it's tempting to parse this further, but you would
# have to take into account all the variations like # have to take into account all the variations like