1
0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-11-15 11:33:30 +01:00

Simplify with itertools.islice().

This commit is contained in:
reiv 2015-10-17 22:36:08 +02:00 committed by Sergey M․
parent c30943b1c0
commit b54b08c91b

View File

@ -532,11 +532,7 @@ class SoundcloudSearchIE(SearchInfoExtractor, SoundcloudIE):
collection_id='Query "{0}"'.format(query),
q=query.encode('utf-8'))
for _ in range(n):
try:
track = next(tracks)
except StopIteration:
break
for track in itertools.islice(tracks, n):
uri = track['uri']
title = track['title']
results.append(self.url_result(url=uri))