return data
-def get_manifest(url, dest_dir=tempfile.gettempdir()):
+def get_manifest(url, dest_dir):
"""Returns the manifest element and the base content URL"""
- if not os.path.exists(dest_dir):
- os.mkdir(dest_dir, 0755)
-
# Remove the querystring if present
manifest_url = urlunparse(urlparse(url)._replace(query=''))
def download_chunks(base_url, manifest, stream_index, quality_level, dest_dir):
-
- if not os.path.exists(dest_dir):
- os.mkdir(dest_dir, 0755)
-
stream = manifest.findall('.//StreamIndex')[stream_index]
chunks_quality = get_chunk_quality_string(stream, quality_level)
return float(duration) / 10000000 # here is the default timescale
-def smooth_download(url, manifest, dest_dir=tempfile.gettempdir(),
+def smooth_download(url, manifest, dest_dir,
video_stream_index=0, audio_stream_index=1,
video_quality_level=0, audio_quality_level=0,
chunks_dir=None, download=True,
parser.print_help()
parser.exit(1)
+ if not os.path.exists(options.dest_dir):
+ os.mkdir(options.dest_dir, 0755)
+
url = args[0]
manifest, url = get_manifest(url, options.dest_dir)