mirror of
				https://github.com/yt-dlp/yt-dlp.git
				synced 2025-10-31 06:35:12 +00:00 
			
		
		
		
	Add --max-sleep-interval (Closes #9930)
This commit is contained in:
		 singh-pratyush96
					singh-pratyush96
				
			
				
					committed by
					
						 Sergey M․
						Sergey M․
					
				
			
			
				
	
			
			
			 Sergey M․
						Sergey M․
					
				
			
						parent
						
							3a380766d1
						
					
				
				
					commit
					065bc35489
				
			| @@ -4,6 +4,7 @@ import os | ||||
| import re | ||||
| import sys | ||||
| import time | ||||
| import random | ||||
|  | ||||
| from ..compat import compat_os_name | ||||
| from ..utils import ( | ||||
| @@ -342,8 +343,10 @@ class FileDownloader(object): | ||||
|             }) | ||||
|             return True | ||||
|  | ||||
|         sleep_interval = self.params.get('sleep_interval') | ||||
|         if sleep_interval: | ||||
|         sleep_lower_bound = self.params.get('sleep_interval') | ||||
|         if sleep_lower_bound: | ||||
|             sleep_upper_bound = self.params.get('max_sleep_interval', sleep_lower_bound) | ||||
|             sleep_interval = random.uniform(sleep_lower_bound, sleep_upper_bound) | ||||
|             self.to_screen('[download] Sleeping %s seconds...' % sleep_interval) | ||||
|             time.sleep(sleep_interval) | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user