diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py index 5036289b0..96e59a4c9 100755 --- a/youtube_dl/YoutubeDL.py +++ b/youtube_dl/YoutubeDL.py @@ -248,7 +248,8 @@ class YoutubeDL(object): source_address: (Experimental) Client-side IP address to bind to. call_home: Boolean, true iff we are allowed to contact the youtube-dl servers for debugging. - sleep_interval: Number of seconds to sleep before each download. + sleep_interval: A random number of seconds to sleep before each download. + The script will choose a random number below sleep_interval. listformats: Print an overview of available video formats and exit. list_thumbnails: Print a table of all thumbnails and exit. match_filter: A function that gets called with the info_dict of diff --git a/youtube_dl/downloader/common.py b/youtube_dl/downloader/common.py index 1dba9f49a..9dcb103b7 100644 --- a/youtube_dl/downloader/common.py +++ b/youtube_dl/downloader/common.py @@ -4,6 +4,7 @@ import os import re import sys import time +import random from ..compat import compat_os_name from ..utils import ( @@ -342,7 +343,7 @@ class FileDownloader(object): }) return True - sleep_interval = self.params.get('sleep_interval') + sleep_interval = random.randrange(self.params.get('sleep_interval')) if sleep_interval: self.to_screen('[download] Sleeping %s seconds...' % sleep_interval) time.sleep(sleep_interval)