Преглед на файлове

[YoutubeDL] Ensure protocol is always present

Sergey M․ преди 9 години
родител
ревизия
b555942428
променени са 1 файла, в които са добавени 5 реда и са изтрити 0 реда
  1. 5 0
      youtube_dl/YoutubeDL.py

+ 5 - 0
youtube_dl/YoutubeDL.py

@@ -46,6 +46,7 @@ from .utils import (
     DateRange,
     DateRange,
     DEFAULT_OUTTMPL,
     DEFAULT_OUTTMPL,
     determine_ext,
     determine_ext,
+    determine_protocol,
     DownloadError,
     DownloadError,
     encode_compat_str,
     encode_compat_str,
     encodeFilename,
     encodeFilename,
@@ -1309,6 +1310,10 @@ class YoutubeDL(object):
             # Automatically determine file extension if missing
             # Automatically determine file extension if missing
             if 'ext' not in format:
             if 'ext' not in format:
                 format['ext'] = determine_ext(format['url']).lower()
                 format['ext'] = determine_ext(format['url']).lower()
+            # Automatically determine protocol if missing (useful for format
+            # selection purposes)
+            if 'protocol' not in format:
+                format['protocol'] = determine_protocol(format)
             # Add HTTP headers, so that external programs can use them from the
             # Add HTTP headers, so that external programs can use them from the
             # json output
             # json output
             full_format_info = info_dict.copy()
             full_format_info = info_dict.copy()