diff options
author | Filippo Valsorda <filippo.valsorda@gmail.com> | 2012-12-11 09:49:27 +0100 |
---|---|---|
committer | Filippo Valsorda <filippo.valsorda@gmail.com> | 2012-12-11 09:49:27 +0100 |
commit | 37c8fd48421ce8bbbe25da962b2e8d5ca2629dd0 (patch) | |
tree | c2b610b178d624e7eff7855b1f4b15eda6b9823f | |
parent | 863baa16eca7a98c38fb29c5e54f76df224f2351 (diff) |
added a test mode to FileDownloader that fetches only first 10K
-rw-r--r-- | youtube_dl/FileDownloader.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/youtube_dl/FileDownloader.py b/youtube_dl/FileDownloader.py index c471cc160..aad12fc1f 100644 --- a/youtube_dl/FileDownloader.py +++ b/youtube_dl/FileDownloader.py @@ -78,6 +78,7 @@ class FileDownloader(object): writeinfojson: Write the video description to a .info.json file writesubtitles: Write the video subtitles to a .srt file subtitleslang: Language of the subtitles to download + test: Download only first bytes to test the downloader. """ params = None @@ -594,6 +595,9 @@ class FileDownloader(object): basic_request = compat_urllib_request.Request(url, None, headers) request = compat_urllib_request.Request(url, None, headers) + if self.params.get('test', False): + request.add_header('Range','bytes=0-10240') + # Establish possible resume length if os.path.isfile(encodeFilename(tmpfilename)): resume_len = os.path.getsize(encodeFilename(tmpfilename)) |