[core] Avoid deepcopy of ctx dict (fix f35b757) (Pt 2)
authordirkf <fieldhouse@gmx.net>
Thu, 6 Apr 2023 18:42:36 +0000 (19:42 +0100)
committerdirkf <fieldhouse@gmx.net>
Thu, 6 Apr 2023 18:42:36 +0000 (19:42 +0100)
youtube_dl/YoutubeDL.py

index 2c0d4926c412d45ce0871dc3c7b3e679d22f6689..927b19417f87c9392ef4ab573ce41228324ce309 100755 (executable)
@@ -1389,11 +1389,10 @@ class YoutubeDL(object):
                         'abr': formats_info[1].get('abr'),
                         'ext': output_ext,
                     }
-                video_selector, audio_selector = map(_build_selector_function, selector.selector)
 
                 def selector_function(ctx):
-                    for pair in itertools.product(
-                            video_selector(copy.deepcopy(ctx)), audio_selector(copy.deepcopy(ctx))):
+                    selector_fn = lambda x: _build_selector_function(x)(ctx)
+                    for pair in itertools.product(*map(selector_fn, selector.selector)):
                         yield _merge(pair)
 
             filters = [self._build_format_filter(f) for f in selector.filters]