]> jfr.im git - yt-dlp.git/commitdiff
Add field `original_url` with the user-inputted URL
authorpukkandan <redacted>
Mon, 7 Jun 2021 18:50:06 +0000 (00:20 +0530)
committerpukkandan <redacted>
Mon, 7 Jun 2021 18:50:06 +0000 (00:20 +0530)
So that they can be processed by `--parse-metadata` for example

`webpage_url` is the same, but may be modified by the extractor

README.md
yt_dlp/YoutubeDL.py

index 588440c07e83147c48d929def4ce38726aefadaf..4d79c1c6230db0a5c7166e482683d0729af33569 100644 (file)
--- a/README.md
+++ b/README.md
@@ -968,6 +968,8 @@ # OUTPUT TEMPLATE
  - `playlist_title` (string): Playlist title
  - `playlist_uploader` (string): Full name of the playlist uploader
  - `playlist_uploader_id` (string): Nickname or id of the playlist uploader
+ - `webpage_url` (string): A URL to the video webpage which if given to yt-dlp should allow to get the same result again
+ - `original_url` (string): The URL given by the user (or same as `webpage_url` for playlist entries)
 
 Available for the video that belongs to some logical chapter or section:
 
index 1298134b618960dd768ec02fc5412055662256dc..2997b19ca34ca9f8ee5fd60149b896070af2baa8 100644 (file)
@@ -1144,6 +1144,7 @@ def add_default_extra_info(self, ie_result, ie, url):
         self.add_extra_info(ie_result, {
             'extractor': ie.IE_NAME,
             'webpage_url': url,
+            'original_url': url,
             'webpage_url_basename': url_basename(url),
             'extractor_key': ie.ie_key(),
         })
@@ -2763,7 +2764,7 @@ def filter_requested_info(info_dict, actually_filter=True):
         remove_keys = ['__original_infodict']  # Always remove this since this may contain a copy of the entire dict
         keep_keys = ['_type'],  # Always keep this to facilitate load-info-json
         if actually_filter:
-            remove_keys += ('requested_formats', 'requested_subtitles', 'requested_entries', 'filepath', 'entries')
+            remove_keys += ('requested_formats', 'requested_subtitles', 'requested_entries', 'filepath', 'entries', 'original_url')
             empty_values = (None, {}, [], set(), tuple())
             reject = lambda k, v: k not in keep_keys and (
                 k.startswith('_') or k in remove_keys or v in empty_values)