diff options
author | pukkandan <pukkandan@gmail.com> | 2021-02-27 18:11:23 +0530 |
---|---|---|
committer | pukkandan <pukkandan@gmail.com> | 2021-02-27 18:14:42 +0530 |
commit | 1cf376f55a3d9335eb161c07c439ca143d86924e (patch) | |
tree | a8f6baa18140e4fa24cd084572b3c38f2cb3aa08 /yt_dlp/extractor/common.py | |
parent | 7f7de7f94dfeacb0eb78cb9487dfcaf5707da381 (diff) | |
download | hypervideo-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/extractor/common.py')
-rw-r--r-- | yt_dlp/extractor/common.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.py index 677a61b86..47b91a00a 100644 --- a/yt_dlp/extractor/common.py +++ b/yt_dlp/extractor/common.py @@ -606,6 +606,14 @@ class InfoExtractor(object): See _download_webpage docstring for arguments specification. """ + if not self._downloader._first_webpage_request: + sleep_interval = float_or_none(self._downloader.params.get('sleep_interval_requests')) or 0 + if sleep_interval > 0: + self.to_screen('Sleeping %s seconds...' % sleep_interval) + time.sleep(sleep_interval) + else: + self._downloader._first_webpage_request = False + if note is None: self.report_download_webpage(video_id) elif note is not False: |