diff --git a/youtube_dl/extractor/soundcloud.py b/youtube_dl/extractor/soundcloud.py index 3fe991849b..959f27975d 100644 --- a/youtube_dl/extractor/soundcloud.py +++ b/youtube_dl/extractor/soundcloud.py @@ -532,11 +532,7 @@ def _get_n_results(self, query, n): 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))