[vine] Make sure the title won't be empty
authorYen Chi Hsuan <yan12125@gmail.com>
Tue, 11 Jul 2017 08:05:15 +0000 (16:05 +0800)
committerYen Chi Hsuan <yan12125@gmail.com>
Tue, 11 Jul 2017 08:05:15 +0000 (16:05 +0800)
And fix a relevant TwitterCard test case

ChangeLog
youtube_dl/extractor/twitter.py
youtube_dl/extractor/vine.py

index 8e6451144182baba25344ddeca849c33694b104d..a5de3c232593a26bc3b7f1404aa749eae43fa951 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 version <unreleased>
 
 Extractors
+* [vine] Make sure the title won't be empty
 + [twitter] Support HLS streams in vmap URLs
 + [periscope] Support pscp.tv URLs in embedded frames
 * [niconico] Fix authentication error handling (#12486)
index 89eabe77e0c4cd107aa88ea3ed71b4cd8c2b43be..2ff55412b13773a34b27b86dd627c08491a60279 100644 (file)
@@ -91,6 +91,7 @@ class TwitterCardIE(TwitterBaseIE):
                 'uploader_id': '1189339351084113920',
                 'uploader': 'ArsenalTerje',
                 'title': 'Vine by ArsenalTerje',
+                'timestamp': 1447451307,
             },
             'add_ie': ['Vine'],
         }, {
index 4957a07f7bde0797f1f8b6f4c4ef9297f8e915e3..46950d3a1499b20bec50a9482d47a0ebdbbfb8b3 100644 (file)
@@ -92,10 +92,12 @@ class VineIE(InfoExtractor):
 
         username = data.get('username')
 
+        alt_title = 'Vine by %s' % username if username else None
+
         return {
             'id': video_id,
-            'title': data.get('description'),
-            'alt_title': 'Vine by %s' % username if username else None,
+            'title': data.get('description') or alt_title or 'Vine video',
+            'alt_title': alt_title,
             'thumbnail': data.get('thumbnailUrl'),
             'timestamp': unified_timestamp(data.get('created')),
             'uploader': username,