Browse Source

Handle --get-url with merged formats (fixes #2883)

Outputs one URL per line
cryptonaut 10 years ago
parent
commit
16ae61f655
1 changed files with 6 additions and 2 deletions
  1. 6 2
      youtube_dl/YoutubeDL.py

+ 6 - 2
youtube_dl/YoutubeDL.py

@@ -942,8 +942,12 @@ class YoutubeDL(object):
         if self.params.get('forceid', False):
         if self.params.get('forceid', False):
             self.to_stdout(info_dict['id'])
             self.to_stdout(info_dict['id'])
         if self.params.get('forceurl', False):
         if self.params.get('forceurl', False):
-            # For RTMP URLs, also include the playpath
-            self.to_stdout(info_dict['url'] + info_dict.get('play_path', ''))
+            if info_dict.get('requested_formats') is not None:
+                for f in info_dict['requested_formats']:
+                    self.to_stdout(f['url'] + f.get('play_path', ''))
+            else:
+                # For RTMP URLs, also include the playpath
+                self.to_stdout(info_dict['url'] + info_dict.get('play_path', ''))
         if self.params.get('forcethumbnail', False) and info_dict.get('thumbnail') is not None:
         if self.params.get('forcethumbnail', False) and info_dict.get('thumbnail') is not None:
             self.to_stdout(info_dict['thumbnail'])
             self.to_stdout(info_dict['thumbnail'])
         if self.params.get('forcedescription', False) and info_dict.get('description') is not None:
         if self.params.get('forcedescription', False) and info_dict.get('description') is not None: