From 212a5e28bae61f764e8e802e403a15cbe62f0dc6 Mon Sep 17 00:00:00 2001 From: anovicecodemonkey Date: Wed, 21 May 2014 19:04:55 +0930 Subject: [PATCH] Add a duplicate check to /extractor/common.py playlist_result function --- youtube_dl/extractor/common.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py index db472aace..26dd9882f 100644 --- a/youtube_dl/extractor/common.py +++ b/youtube_dl/extractor/common.py @@ -343,6 +343,16 @@ def url_result(url, ie=None, video_id=None): @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: