aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/soundcloud.py
diff options
context:
space:
mode:
authorreiv <metareiv@gmail.com>2015-10-17 22:36:08 +0200
committerSergey M․ <dstftw@gmail.com>2015-11-21 19:41:19 +0600
commitb54b08c91bb7f59a9ea720abbf944809d1ea8956 (patch)
tree5c1c5c5f1a26a0e39dfee1828b9ded4b1c327ac3 /youtube_dl/extractor/soundcloud.py
parentc30943b1c06d0f8d927031fc3a7f3cda30c4dae1 (diff)
Simplify with itertools.islice().
Diffstat (limited to 'youtube_dl/extractor/soundcloud.py')
-rw-r--r--youtube_dl/extractor/soundcloud.py6
1 files changed, 1 insertions, 5 deletions
diff --git a/youtube_dl/extractor/soundcloud.py b/youtube_dl/extractor/soundcloud.py
index 3fe991849..959f27975 100644
--- a/youtube_dl/extractor/soundcloud.py
+++ b/youtube_dl/extractor/soundcloud.py
@@ -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))