瀏覽代碼

Add a duplicate check to /extractor/common.py playlist_result function

anovicecodemonkey 11 年之前
父節點
當前提交
212a5e28ba
共有 1 個文件被更改,包括 10 次插入0 次删除
  1. 10 0
      youtube_dl/extractor/common.py

+ 10 - 0
youtube_dl/extractor/common.py

@@ -343,6 +343,16 @@ class InfoExtractor(object):
     @staticmethod
     def playlist_result(entries, playlist_id=None, playlist_title=None):
         """Returns a playlist"""
+        # Ensure we don't have any duplicates in the playlist
+        seen = set()
+        new_list = []
+        for url in entries:
+            theurl = tuple(url.items())
+            if theurl not in seen:
+             seen.add(theurl)
+             new_list.append(url)
+             entries = new_list
+
         video_info = {'_type': 'playlist',
                       'entries': entries}
         if playlist_id: