YoutubeDL: support download of videos splitted in parts
This commit is contained in:
parent
529a2e2cc3
commit
3a6e739da4
@ -773,7 +773,23 @@ class YoutubeDL(object):
|
|||||||
success = True
|
success = True
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
|
parts = info_dict.get('parts',[])
|
||||||
|
if not parts:
|
||||||
success = self.fd._do_download(filename, info_dict)
|
success = self.fd._do_download(filename, info_dict)
|
||||||
|
elif len(parts) == 1:
|
||||||
|
info_dict['url'] = parts[0]
|
||||||
|
success = self.fd._do_download(filename, info_dict)
|
||||||
|
else:
|
||||||
|
parts_success = []
|
||||||
|
parts_files = []
|
||||||
|
self.to_screen(u'[info] Downloading %s parts' % len(parts))
|
||||||
|
for (i, part_url) in enumerate(parts):
|
||||||
|
part_info = dict(info_dict)
|
||||||
|
part_info['url'] = part_url
|
||||||
|
part_filename = u'%s.%s' % (filename, i)
|
||||||
|
parts_files.append(part_filename)
|
||||||
|
parts_success.append(self.fd._do_download(part_filename, part_info))
|
||||||
|
success = all(parts_success)
|
||||||
except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err:
|
except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err:
|
||||||
self.report_error(u'unable to download video data: %s' % str(err))
|
self.report_error(u'unable to download video data: %s' % str(err))
|
||||||
return
|
return
|
||||||
|
@ -55,6 +55,7 @@ class InfoExtractor(object):
|
|||||||
subtitles: The subtitle file contents as a dictionary in the format
|
subtitles: The subtitle file contents as a dictionary in the format
|
||||||
{language: subtitles}.
|
{language: subtitles}.
|
||||||
view_count: How many users have watched the video on the platform.
|
view_count: How many users have watched the video on the platform.
|
||||||
|
parts: A list of urls for each of the parts of the video.
|
||||||
urlhandle: [internal] The urlHandle to be used to download the file,
|
urlhandle: [internal] The urlHandle to be used to download the file,
|
||||||
like returned by urllib.request.urlopen
|
like returned by urllib.request.urlopen
|
||||||
age_limit: Age restriction for the video, as an integer (years)
|
age_limit: Age restriction for the video, as an integer (years)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user