A feature-rich command-line audio/video downloader
added a test mode to FileDownloader that fetches only first 10K
Filippo Valsorda37c8fd48421c
diff --git a/youtube_dl/FileDownloader.py b/youtube_dl/FileDownloader.pyindex c471cc1608..aad12fc1ff 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 filewritesubtitles: Write the video subtitles to a .srt filesubtitleslang: 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 lengthif os.path.isfile(encodeFilename(tmpfilename)):resume_len = os.path.getsize(encodeFilename(tmpfilename))