mirror of
https://github.com/ytdl-org/youtube-dl
synced 2024-11-30 19:02:55 +01:00
Added cap if user requests ytsearch number over 1000 (with warning)
This commit is contained in:
parent
fd9288c315
commit
257453b92b
@ -786,6 +786,9 @@ class YoutubeSearchIE(InfoExtractor):
|
|||||||
if n <= 0:
|
if n <= 0:
|
||||||
self.to_stderr(u'ERROR: invalid download number %s for query "%s"' % (n, query))
|
self.to_stderr(u'ERROR: invalid download number %s for query "%s"' % (n, query))
|
||||||
return [None]
|
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)
|
return self._download_n_results(query, n)
|
||||||
except ValueError: # parsing prefix as int fails
|
except ValueError: # parsing prefix as int fails
|
||||||
return self._download_n_results(query, 1)
|
return self._download_n_results(query, 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user