mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-03 08:19:57 +01:00
Simplify with itertools.islice().
This commit is contained in:
parent
c30943b1c0
commit
b54b08c91b
@ -532,11 +532,7 @@ def _get_n_results(self, query, n):
|
|||||||
collection_id='Query "{0}"'.format(query),
|
collection_id='Query "{0}"'.format(query),
|
||||||
q=query.encode('utf-8'))
|
q=query.encode('utf-8'))
|
||||||
|
|
||||||
for _ in range(n):
|
for track in itertools.islice(tracks, n):
|
||||||
try:
|
|
||||||
track = next(tracks)
|
|
||||||
except StopIteration:
|
|
||||||
break
|
|
||||||
uri = track['uri']
|
uri = track['uri']
|
||||||
title = track['title']
|
title = track['title']
|
||||||
results.append(self.url_result(url=uri))
|
results.append(self.url_result(url=uri))
|
||||||
|
Loading…
Reference in New Issue
Block a user