aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/YoutubeDL.py
diff options
context:
space:
mode:
authorpukkandan <pukkandan@gmail.com>2021-02-27 18:11:23 +0530
committerpukkandan <pukkandan@gmail.com>2021-02-27 18:14:42 +0530
commit1cf376f55a3d9335eb161c07c439ca143d86924e (patch)
treea8f6baa18140e4fa24cd084572b3c38f2cb3aa08 /yt_dlp/YoutubeDL.py
parent7f7de7f94dfeacb0eb78cb9487dfcaf5707da381 (diff)
downloadhypervideo-pre-1cf376f55a3d9335eb161c07c439ca143d86924e.tar.lz
hypervideo-pre-1cf376f55a3d9335eb161c07c439ca143d86924e.tar.xz
hypervideo-pre-1cf376f55a3d9335eb161c07c439ca143d86924e.zip
Add option `--sleep-requests` to sleep b/w requests (Closes #106)
* Also fix documentation of `sleep_interval_subtitles` Related issues: https://github.com/blackjack4494/yt-dlc/issues/158 https://github.com/blackjack4494/youtube-dlc/issues/195 https://github.com/ytdl-org/youtube-dl/pull/28270 https://github.com/ytdl-org/youtube-dl/pull/28144 https://github.com/ytdl-org/youtube-dl/issues/27767 https://github.com/ytdl-org/youtube-dl/issues/23638 https://github.com/ytdl-org/youtube-dl/issues/26287 https://github.com/ytdl-org/youtube-dl/issues/26319
Diffstat (limited to 'yt_dlp/YoutubeDL.py')
-rw-r--r--yt_dlp/YoutubeDL.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py
index a54755e15..3c53f4cd8 100644
--- a/yt_dlp/YoutubeDL.py
+++ b/yt_dlp/YoutubeDL.py
@@ -324,6 +324,8 @@ class YoutubeDL(object):
source_address: Client-side IP address to bind to.
call_home: Boolean, true iff we are allowed to contact the
yt-dlp servers for debugging. (BROKEN)
+ sleep_interval_requests: Number of seconds to sleep between requests
+ during extraction
sleep_interval: Number of seconds to sleep before each download when
used alone or a lower bound of a range for randomized
sleep before each download (minimum possible number
@@ -334,6 +336,7 @@ class YoutubeDL(object):
Must only be used along with sleep_interval.
Actual sleep time will be a random float from range
[sleep_interval; max_sleep_interval].
+ sleep_interval_subtitles: Number of seconds to sleep before each subtitle download
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
@@ -406,6 +409,7 @@ class YoutubeDL(object):
_ies = []
_pps = {'beforedl': [], 'aftermove': [], 'normal': []}
__prepare_filename_warned = False
+ _first_webpage_request = True
_download_retcode = None
_num_downloads = None
_playlist_level = 0
@@ -420,6 +424,7 @@ class YoutubeDL(object):
self._ies_instances = {}
self._pps = {'beforedl': [], 'aftermove': [], 'normal': []}
self.__prepare_filename_warned = False
+ self._first_webpage_request = True
self._post_hooks = []
self._progress_hooks = []
self._download_retcode = 0
@@ -2166,15 +2171,6 @@ class YoutubeDL(object):
else:
try:
dl(sub_filename, sub_info, subtitle=True)
- '''
- if self.params.get('sleep_interval_subtitles', False):
- dl(sub_filename, sub_info)
- else:
- sub_data = ie._request_webpage(
- sub_info['url'], info_dict['id'], note=False).read()
- with io.open(encodeFilename(sub_filename), 'wb') as subfile:
- subfile.write(sub_data)
- '''
files_to_move[sub_filename] = sub_filename_final
except (ExtractorError, IOError, OSError, ValueError, compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err:
self.report_warning('Unable to download subtitle for "%s": %s' %