[generic] Don't set the 'title' if it's not defined in the entry (closes #5061)
authorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Wed, 25 Feb 2015 16:56:51 +0000 (17:56 +0100)
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Wed, 25 Feb 2015 16:56:51 +0000 (17:56 +0100)
Some of them may be an 'url' result, which in general don't have the 'title' field.

youtube_dl/extractor/generic.py

index 875e1bf05ff274a41f46518c48e990954b7e12e5..3aff57e30302d3c33ce5e468f9df642cda0f6ff8 100644 (file)
@@ -1208,7 +1208,9 @@ class GenericIE(InfoExtractor):
             return entries[0]
         else:
             for num, e in enumerate(entries, start=1):
-                e['title'] = '%s (%d)' % (e['title'], num)
+                # 'url' results don't have a title
+                if e.get('title') is not None:
+                    e['title'] = '%s (%d)' % (e['title'], num)
             return {
                 '_type': 'playlist',
                 'entries': entries,