瀏覽代碼

[downloader/external] Add support for rate limit and retries for wget

Sergey M․ 6 年之前
父節點
當前提交
8c80603f1a
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      youtube_dl/downloader/external.py

+ 6 - 0
youtube_dl/downloader/external.py

@@ -164,6 +164,12 @@ class WgetFD(ExternalFD):
         cmd = [self.exe, '-O', tmpfilename, '-nv', '--no-cookies']
         for key, val in info_dict['http_headers'].items():
             cmd += ['--header', '%s: %s' % (key, val)]
+        cmd += self._option('--limit-rate', 'ratelimit')
+        retry = self._option('--tries', 'retries')
+        if len(retry) == 2:
+            if retry[1] in ('inf', 'infinite'):
+                retry[1] = '0'
+            cmd += retry
         cmd += self._option('--bind-address', 'source_address')
         cmd += self._option('--proxy', 'proxy')
         cmd += self._valueless_option('--no-check-certificate', 'nocheckcertificate')