]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
Rewrite as list comprehension.
authorreiv <metareiv@gmail.com>
Sat, 17 Oct 2015 20:47:16 +0000 (22:47 +0200)
committerSergey M․ <dstftw@gmail.com>
Sat, 21 Nov 2015 13:41:26 +0000 (19:41 +0600)
youtube_dl/extractor/soundcloud.py

index 959f27975da7d6d4a930b8bd3dde92f30e4c4b60..c623bb6def08f593a001bd30d6bfa344798e9ad8 100644 (file)
@@ -526,16 +526,12 @@ class SoundcloudSearchIE(SearchInfoExtractor, SoundcloudIE):
             next_url = response.get('next_href', None)
 
     def _get_n_results(self, query, n):
-        results = []
-
         tracks = self._get_collection('/search/tracks',
             collection_id='Query "{0}"'.format(query),
             q=query.encode('utf-8'))
 
-        for track in itertools.islice(tracks, n):
-            uri = track['uri']
-            title = track['title']
-            results.append(self.url_result(url=uri))
+        results = [self.url_result(url=track['uri'])
+            for track in itertools.islice(tracks, n)]
 
         if not results:
             raise ExtractorError(