Sfoglia il codice sorgente

Fix initialization of YoutubeDL with params set to None

Set it to an empty dictionary because it’s directly accessed when setting some properties
Jaime Marquínez Ferrándiz 12 anni fa
parent
commit
e9f9a10fba
1 ha cambiato i file con 3 aggiunte e 1 eliminazioni
  1. 3 1
      youtube_dl/YoutubeDL.py

+ 3 - 1
youtube_dl/YoutubeDL.py

@@ -164,6 +164,8 @@ class YoutubeDL(object):
 
 
     def __init__(self, params=None):
     def __init__(self, params=None):
         """Create a FileDownloader object with the given options."""
         """Create a FileDownloader object with the given options."""
+        if params is None:
+            params = {}
         self._ies = []
         self._ies = []
         self._ies_instances = {}
         self._ies_instances = {}
         self._pps = []
         self._pps = []
@@ -172,7 +174,7 @@ class YoutubeDL(object):
         self._num_downloads = 0
         self._num_downloads = 0
         self._screen_file = [sys.stdout, sys.stderr][params.get('logtostderr', False)]
         self._screen_file = [sys.stdout, sys.stderr][params.get('logtostderr', False)]
         self._err_file = sys.stderr
         self._err_file = sys.stderr
-        self.params = {} if params is None else params
+        self.params = params
 
 
         if params.get('bidi_workaround', False):
         if params.get('bidi_workaround', False):
             try:
             try: