mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-09-09 12:37:00 +00:00
Add a duplicate check to /extractor/common.py playlist_result function
This commit is contained in:
parent
3442b30ab2
commit
212a5e28ba
|
@ -343,6 +343,16 @@ def url_result(url, ie=None, video_id=None):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def playlist_result(entries, playlist_id=None, playlist_title=None):
|
def playlist_result(entries, playlist_id=None, playlist_title=None):
|
||||||
"""Returns a playlist"""
|
"""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',
|
video_info = {'_type': 'playlist',
|
||||||
'entries': entries}
|
'entries': entries}
|
||||||
if playlist_id:
|
if playlist_id:
|
||||||
|
|
Loading…
Reference in a new issue