From e37d0efbd98fc3a13553efaeed2623f2943d0f67 Mon Sep 17 00:00:00 2001 From: pukkandan Date: Thu, 22 Jul 2021 01:15:32 +0530 Subject: [PATCH] Fix bug where `original_url` was not propagated when `_type`=`url` --- yt_dlp/YoutubeDL.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py index 594886506..494c0d33b 100644 --- a/yt_dlp/YoutubeDL.py +++ b/yt_dlp/YoutubeDL.py @@ -1182,6 +1182,8 @@ def __extract_info(self, url, ie, download, extra_info, process): '_type': 'compat_list', 'entries': ie_result, } + if extra_info.get('original_url'): + ie_result.setdefault('original_url', extra_info['original_url']) self.add_default_extra_info(ie_result, ie, url) if process: return self.process_ie_result(ie_result, download, extra_info) @@ -1213,6 +1215,9 @@ def process_ie_result(self, ie_result, download=True, extra_info={}): if result_type in ('url', 'url_transparent'): ie_result['url'] = sanitize_url(ie_result['url']) + if ie_result.get('original_url'): + extra_info.setdefault('original_url', ie_result['original_url']) + extract_flat = self.params.get('extract_flat', False) if ((extract_flat == 'in_playlist' and 'playlist' in extra_info) or extract_flat is True):