Added cap if user requests ytsearch number over 1000 (with warning)
authordannycolligan <devnull@localhost>
Tue, 7 Apr 2009 15:21:27 +0000 (08:21 -0700)
committerRicardo Garcia <sarbalap+freshmeat@gmail.com>
Sun, 31 Oct 2010 10:24:08 +0000 (11:24 +0100)
youtube-dl

index e41134546eab4c7fb385d64b76aa0a90e8c36c2d..6757a896c0ef1c0c0bf1499a50a02b47d16ff287 100755 (executable)
@@ -786,6 +786,9 @@ class YoutubeSearchIE(InfoExtractor):
                                if n <= 0:
                                        self.to_stderr(u'ERROR: invalid download number %s for query "%s"' % (n, query))
                                        return [None]
+                               elif n > self._max_youtube_results:
+                                       self.to_stderr(u'WARNING: ytsearch returns max %i results (you requested %i)'  % (self._max_youtube_results, n))
+                                       n = self._max_youtube_results
                                return self._download_n_results(query, n)
                        except ValueError: # parsing prefix as int fails
                                return self._download_n_results(query, 1)