diff options
| author | pukkandan <pukkandan.ytdlp@gmail.com> | 2022-04-18 04:39:25 +0530 | 
|---|---|---|
| committer | pukkandan <pukkandan.ytdlp@gmail.com> | 2022-04-18 05:41:56 +0530 | 
| commit | 43cc91ad759d3950c99a905f0ee4937cade10e5c (patch) | |
| tree | df4cbfcbc25857ce0fbe5d32188a9cfc41a0a78c | |
| parent | 77f9033095cd8e1092a80db67f2b577cf13f95a8 (diff) | |
| download | hypervideo-pre-43cc91ad759d3950c99a905f0ee4937cade10e5c.tar.lz hypervideo-pre-43cc91ad759d3950c99a905f0ee4937cade10e5c.tar.xz hypervideo-pre-43cc91ad759d3950c99a905f0ee4937cade10e5c.zip | |
bugfix for 19a0394044bfad36cd665450271b8eb048a41c02, 3d3bb1688bfc5373105e6bf7c3d4729cf3f78788
| -rw-r--r-- | README.md | 15 | ||||
| -rw-r--r-- | yt_dlp/downloader/common.py | 2 | 
2 files changed, 9 insertions, 8 deletions
| @@ -60,6 +60,7 @@ yt-dlp is a [youtube-dl](https://github.com/ytdl-org/youtube-dl) fork based on t  * [EXTRACTOR ARGUMENTS](#extractor-arguments)  * [PLUGINS](#plugins)  * [EMBEDDING YT-DLP](#embedding-yt-dlp) +    * [Embedding examples](#embedding-examples)  * [DEPRECATED OPTIONS](#deprecated-options)  * [CONTRIBUTING](CONTRIBUTING.md#contributing-to-yt-dlp)      * [Opening an Issue](CONTRIBUTING.md#opening-an-issue) @@ -1755,11 +1756,11 @@ with YoutubeDL() as ydl:  Most likely, you'll want to use various options. For a list of options available, have a look at [`yt_dlp/YoutubeDL.py`](yt_dlp/YoutubeDL.py#L181). -**Tip**: If you are porting your code from youtube-dl to yt-dlp, one important point to look out for is that we do not guarantee the return value of `YoutubeDL.extract_info` to be json serializable, or even be a dictionary. It will be dictionary-like, but if you want to ensure it is a serializable dictionary, pass it through `YoutubeDL.sanitize_info` as shown in the example above +**Tip**: If you are porting your code from youtube-dl to yt-dlp, one important point to look out for is that we do not guarantee the return value of `YoutubeDL.extract_info` to be json serializable, or even be a dictionary. It will be dictionary-like, but if you want to ensure it is a serializable dictionary, pass it through `YoutubeDL.sanitize_info` as shown in the [example below](#extracting-information)  ## Embedding examples -### Extracting information +#### Extracting information  ```python  import json @@ -1775,7 +1776,7 @@ with yt_dlp.YoutubeDL(ydl_opts) as ydl:      # ℹ️ ydl.sanitize_info makes the info json-serializable      print(json.dumps(ydl.sanitize_info(info)))  ``` -### Download from info-json +#### Download using an info-json  ```python  import yt_dlp @@ -1789,7 +1790,7 @@ print('Some videos failed to download' if error_code        else 'All videos successfully downloaded')  ``` -### Extract audio +#### Extract audio  ```python  import yt_dlp @@ -1808,7 +1809,7 @@ ydl_opts = {  with yt_dlp.YoutubeDL(ydl_opts) as ydl:      error_code = ydl.download(URLS)  ``` -### Adding logger and progress hook +#### Adding logger and progress hook  ```python  import yt_dlp @@ -1849,7 +1850,7 @@ with yt_dlp.YoutubeDL(ydl_opts) as ydl:      ydl.download(URLS)  ``` -### Add a custom PostProcessor +#### Add a custom PostProcessor  ```python  import yt_dlp @@ -1869,7 +1870,7 @@ with yt_dlp.YoutubeDL() as ydl:  ``` -### Use a custom format selector +#### Use a custom format selector  ```python  import yt_dlp diff --git a/yt_dlp/downloader/common.py b/yt_dlp/downloader/common.py index 3e5396988..022a9cd17 100644 --- a/yt_dlp/downloader/common.py +++ b/yt_dlp/downloader/common.py @@ -431,7 +431,7 @@ class FileDownloader:          else:              min_sleep_interval = self.params.get('sleep_interval') or 0              sleep_interval = random.uniform( -                min_sleep_interval, self.params.get('max_sleep_interval', min_sleep_interval)) +                min_sleep_interval, self.params.get('max_sleep_interval') or min_sleep_interval)          if sleep_interval > 0:              self.to_screen(f'[download] Sleeping {sleep_interval:.2f} seconds ...')              time.sleep(sleep_interval) | 
