aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/downloader
diff options
context:
space:
mode:
authorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>2014-02-15 17:09:49 +0100
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>2014-02-15 17:53:23 +0100
commit1824b4816974bbd8d026ed44185ad888e6fb6d70 (patch)
treed713f19670c36487c1487f439dcfb86ca8617cb3 /youtube_dl/downloader
parentb53466e1680db3d710415329674c887d38af46c5 (diff)
downloadyoutube-dl-1824b4816974bbd8d026ed44185ad888e6fb6d70.tar.xz
[f4m] Download only the first fragment with the `--test` option
Diffstat (limited to 'youtube_dl/downloader')
-rw-r--r--youtube_dl/downloader/f4m.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/youtube_dl/downloader/f4m.py b/youtube_dl/downloader/f4m.py
index 052751106..2a870a758 100644
--- a/youtube_dl/downloader/f4m.py
+++ b/youtube_dl/downloader/f4m.py
@@ -224,7 +224,13 @@ class F4mFD(FileDownloader):
self.to_screen('[download] Downloading f4m manifest')
manifest = self.ydl.urlopen(man_url).read()
self.report_destination(filename)
- http_dl = HttpQuietDownloader(self.ydl, {'continuedl': True, 'quiet': True, 'noprogress': True})
+ http_dl = HttpQuietDownloader(self.ydl,
+ {
+ 'continuedl': True,
+ 'quiet': True,
+ 'noprogress': True,
+ 'test': self.params.get('test', False),
+ })
doc = etree.fromstring(manifest)
formats = [(int(f.attrib.get('bitrate', -1)), f) for f in doc.findall(_add_ns('media'))]
@@ -235,6 +241,9 @@ class F4mFD(FileDownloader):
metadata = base64.b64decode(media.find(_add_ns('metadata')).text)
boot_info = read_bootstrap_info(bootstrap)
fragments_list = build_fragments_list(boot_info)
+ if self.params.get('test', False):
+ # We only download the first fragment
+ fragments_list = fragments_list[:1]
total_frags = len(fragments_list)
tmpfilename = self.temp_name(filename)