summary refs log tree commit diff
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2019-09-01 01:23:58 +0700
committerSergey M․ <dstftw@gmail.com>2019-09-01 01:25:48 +0700
commit7cb51b5daf07a6a627a9084394636c570194cc4e (patch)
treec2db62d7d53b11aa04678a09cdeb8a8855603f10
parentd78657fd18ae6413239137298eee4c54f3efee32 (diff)
downloadyoutube-dl-7cb51b5daf07a6a627a9084394636c570194cc4e.tar.gz
youtube-dl-7cb51b5daf07a6a627a9084394636c570194cc4e.tar.xz
youtube-dl-7cb51b5daf07a6a627a9084394636c570194cc4e.zip
[extractor/generic] Improve squarespace detection and fix test (closes #21859, refs #21294, refs #21802)
-rw-r--r--youtube_dl/extractor/generic.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/youtube_dl/extractor/generic.py b/youtube_dl/extractor/generic.py
index 7dd2e2d5f..d1725d98b 100644
--- a/youtube_dl/extractor/generic.py
+++ b/youtube_dl/extractor/generic.py
@@ -2081,6 +2081,11 @@ class GenericIE(InfoExtractor):
             'info_dict': {
                 'id': 'Tc7b_JGdZfw',
                 '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': {
                 'skip_download': True,
@@ -2406,12 +2411,11 @@ class GenericIE(InfoExtractor):
         # Unescaping the whole page allows to handle those cases in a generic way
         webpage = compat_urllib_parse_unquote(webpage)
 
-        # unescape re.sub replacement
-        def unescape_resub(m):
-            return unescapeHTML(m.group(0))
-
-        # unescape squarespace video embeds
-        webpage = re.sub(r'<div[^>]+class=[^>]*?sqs-video-wrapper[^>]*>', unescape_resub, webpage)
+        # Unescape squarespace embeds to be detected by generic extractor,
+        # see https://github.com/ytdl-org/youtube-dl/issues/21294
+        webpage = re.sub(
+            r'<div[^>]+class=[^>]*?\bsqs-video-wrapper\b[^>]*>',
+            lambda x: unescapeHTML(x.group(0)), webpage)
 
         # it's tempting to parse this further, but you would
         # have to take into account all the variations like