浏览代码

[extractor/generic] Add support for squarespace embeds (closes #21294)

Barbara Miller 6 年之前
父节点
当前提交
d78657fd18
共有 1 个文件被更改,包括 18 次插入0 次删除
  1. 18 0
      youtube_dl/extractor/generic.py

+ 18 - 0
youtube_dl/extractor/generic.py

@@ -2075,6 +2075,17 @@ class GenericIE(InfoExtractor):
             },
             },
             'playlist_count': 6,
             'playlist_count': 6,
         },
         },
+        {
+            # Squarespace video embed, 2019-08-28
+            'url': 'http://ootboxford.com',
+            'info_dict': {
+                'id': 'Tc7b_JGdZfw',
+                'title': 'Out of the Blue, at Childish Things 10',
+            },
+            'params': {
+                'skip_download': True,
+            },
+        },
         {
         {
             # Zype embed
             # Zype embed
             'url': 'https://www.cookscountry.com/episode/554-smoky-barbecue-favorites',
             'url': 'https://www.cookscountry.com/episode/554-smoky-barbecue-favorites',
@@ -2395,6 +2406,13 @@ class GenericIE(InfoExtractor):
         # 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
+        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)
+
         # 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
         #   Video Title - Site Name
         #   Video Title - Site Name