Move duplicate check to generic.py
authoranovicecodemonkey <anovicecodemonkey13435@mailinator.com>
Sat, 31 May 2014 15:46:35 +0000 (01:16 +0930)
committeranovicecodemonkey <anovicecodemonkey13435@mailinator.com>
Sat, 31 May 2014 15:46:35 +0000 (01:16 +0930)
youtube_dl/extractor/common.py
youtube_dl/extractor/generic.py

index 26dd9882f80ad1b2feea0f9ed6bf45718b4311af..db472aace8faabb465e9c93b7ff6013ccece4e8e 100644 (file)
@@ -343,16 +343,6 @@ 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:
index c1e53382181fc035dc87475fd51b6249ed79dab3..dfa8d6153303ecf250c0b41fe4fe4640ec4e7d65 100644 (file)
@@ -494,6 +494,14 @@ class GenericIE(InfoExtractor):
         if matches:
             urlrs = [self.url_result(unescapeHTML(tuppl[1]), 'Youtube')
                      for tuppl in matches]
+            # First, ensure we have a duplicate free list of entries
+            seen = set()
+            new_list = []
+            theurl = tuple(url.items())
+            if theurl not in seen:
+                seen.add(theurl)
+                new_list.append(url)
+                urlrs = new_list
             return self.playlist_result(
                 urlrs, playlist_id=video_id, playlist_title=video_title)
 
@@ -503,6 +511,14 @@ class GenericIE(InfoExtractor):
         if matches:
             urlrs = [self.url_result(unescapeHTML(tuppl[1]))
                      for tuppl in matches]
+            # First, ensure we have a duplicate free list of entries
+            seen = set()
+            new_list = []
+            theurl = tuple(url.items())
+            if theurl not in seen:
+                seen.add(theurl)
+                new_list.append(url)
+                urlrs = new_list
             return self.playlist_result(
                 urlrs, playlist_id=video_id, playlist_title=video_title)
 
@@ -615,6 +631,14 @@ class GenericIE(InfoExtractor):
         if matches:
             urlrs = [self.url_result(unescapeHTML(eurl), 'FunnyOrDie')
                      for eurl in matches]
+            # First, ensure we have a duplicate free list of entries
+            seen = set()
+            new_list = []
+            theurl = tuple(url.items())
+            if theurl not in seen:
+                seen.add(theurl)
+                new_list.append(url)
+                urlrs = new_list
             return self.playlist_result(
                 urlrs, playlist_id=video_id, playlist_title=video_title)