diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-06-28 15:56:44 +0200 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-06-28 15:58:30 +0200 |
commit | 8c6565295986b704f36a9174d05deacc6925b7e4 (patch) | |
tree | ffc9348520ff59a642981d41b8897b57cf1a3811 /crates/yt_dlp/src/options.rs | |
parent | build({nix,flake}): Add missing buildInputs (diff) | |
download | yt-8c6565295986b704f36a9174d05deacc6925b7e4.zip |
fix(yt_dlp): Polyfill missing rustpython features used in urllib3
Otherwise, anything that depends on urllib3 just fails to initialize.
Diffstat (limited to 'crates/yt_dlp/src/options.rs')
-rw-r--r-- | crates/yt_dlp/src/options.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/crates/yt_dlp/src/options.rs b/crates/yt_dlp/src/options.rs index 182b8a1..dc3c154 100644 --- a/crates/yt_dlp/src/options.rs +++ b/crates/yt_dlp/src/options.rs @@ -22,7 +22,8 @@ use rustpython::{ }; use crate::{ - YoutubeDL, json_loads, logging::setup_logging, post_processors, python_error::process_exception, + YoutubeDL, json_loads, logging::setup_logging, package_hacks, post_processors, + python_error::process_exception, }; /// Wrap your function with [`mk_python_function`]. @@ -138,6 +139,11 @@ impl YoutubeDL { let output_options = options.options.clone(); let (yt_dlp_module, youtube_dl_class) = match interpreter.enter(|vm| { + { + // Add missing (and required) values to the stdlib + package_hacks::urllib3::apply_hacks(vm)?; + } + let yt_dlp_module = vm.import("yt_dlp", 0)?; let class = yt_dlp_module.get_attr("YoutubeDL", vm)?; |