diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py index e23042c48..c393aa4cf 100644 --- a/youtube_dl/YoutubeDL.py +++ b/youtube_dl/YoutubeDL.py @@ -773,7 +773,23 @@ class YoutubeDL(object): success = True else: try: - success = self.fd._do_download(filename, info_dict) + parts = info_dict.get('parts',[]) + if not parts: + 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: self.report_error(u'unable to download video data: %s' % str(err)) return diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py index 5656445a3..d619de1dc 100644 --- a/youtube_dl/extractor/common.py +++ b/youtube_dl/extractor/common.py @@ -55,6 +55,7 @@ class InfoExtractor(object): subtitles: The subtitle file contents as a dictionary in the format {language: subtitles}. 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, like returned by urllib.request.urlopen age_limit: Age restriction for the video, as an integer (years)