]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/vine.py
[extractors] Use new framework for existing embeds (#4307)
[yt-dlp.git] / yt_dlp / extractor / vine.py
index 07fce0daa41bbe77d7fb7b57dce24067e1d03995..8e57201f68fa852ae7b32499aa6ca7408b052675 100644 (file)
@@ -1,11 +1,8 @@
-# coding: utf-8
-from __future__ import unicode_literals
-
-
 from .common import InfoExtractor
 from ..compat import compat_str
 from ..utils import (
     determine_ext,
+    format_field,
     int_or_none,
     unified_timestamp,
 )
@@ -13,6 +10,7 @@
 
 class VineIE(InfoExtractor):
     _VALID_URL = r'https?://(?:www\.)?vine\.co/(?:v|oembed)/(?P<id>\w+)'
+    _EMBED_REGEX = [r'<iframe[^>]+src=[\'"](?P<url>(?:https?:)?//(?:www\.)?vine\.co/v/[^/]+/embed/(?:simple|postcard))']
     _TESTS = [{
         'url': 'https://vine.co/v/b9KOOWX7HUx',
         'md5': '2f36fed6235b16da96ce9b4dc890940d',
@@ -92,7 +90,7 @@ def video_url(kind):
 
         username = data.get('username')
 
-        alt_title = 'Vine by %s' % username if username else None
+        alt_title = format_field(username, None, 'Vine by %s')
 
         return {
             'id': video_id,