diff options
author | pukkandan <pukkandan.ytdlp@gmail.com> | 2021-05-18 23:50:29 +0530 |
---|---|---|
committer | pukkandan <pukkandan.ytdlp@gmail.com> | 2021-05-19 18:11:15 +0530 |
commit | 9c2b75b5616f058c3970e54c664e9543f86b9f0c (patch) | |
tree | af26f990f62474c138f0b57ffa173bd5049ce015 /yt_dlp/YoutubeDL.py | |
parent | 856bb8f99d1a8e960b1b4024f847359f8a8054b3 (diff) | |
download | hypervideo-pre-9c2b75b5616f058c3970e54c664e9543f86b9f0c.tar.lz hypervideo-pre-9c2b75b5616f058c3970e54c664e9543f86b9f0c.tar.xz hypervideo-pre-9c2b75b5616f058c3970e54c664e9543f86b9f0c.zip |
Field `additional_urls` to download additional videos from metadata
Diffstat (limited to 'yt_dlp/YoutubeDL.py')
-rw-r--r-- | yt_dlp/YoutubeDL.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py index ada783bf2..9a2d0abc2 100644 --- a/yt_dlp/YoutubeDL.py +++ b/yt_dlp/YoutubeDL.py @@ -1187,7 +1187,22 @@ class YoutubeDL(object): if result_type == 'video': self.add_extra_info(ie_result, extra_info) - return self.process_video_result(ie_result, download=download) + ie_result = self.process_video_result(ie_result, download=download) + additional_urls = ie_result.get('additional_urls') + if additional_urls: + # TODO: Improve MetadataFromFieldPP to allow setting a list + if isinstance(additional_urls, compat_str): + additional_urls = [additional_urls] + self.to_screen( + '[info] %s: %d additional URL(s) requested' % (ie_result['id'], len(additional_urls))) + self.write_debug('Additional URLs: "%s"' % '", "'.join(additional_urls)) + ie_result['additional_entries'] = [ + self.extract_info( + url, download, extra_info, + force_generic_extractor=self.params.get('force_generic_extractor')) + for url in additional_urls + ] + return ie_result elif result_type == 'url': # We have to add extra_info to the results because it may be # contained in a playlist |