浏览代码

[YoutubeDL] Force string conversion on non string video ids

Sergey M․ 9 年之前
父节点
当前提交
be6217b261
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      youtube_dl/YoutubeDL.py

+ 4 - 0
youtube_dl/YoutubeDL.py

@@ -1223,6 +1223,10 @@ class YoutubeDL(object):
         if 'title' not in info_dict:
             raise ExtractorError('Missing "title" field in extractor result')
 
+        if not isinstance(info_dict['id'], compat_str):
+            self.report_warning('"id" field is not a string - forcing string conversion')
+            info_dict['id'] = compat_str(info_dict['id'])
+
         if 'playlist' not in info_dict:
             # It isn't part of a playlist
             info_dict['playlist'] = None