about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--crates/yt_dlp/src/lib.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/crates/yt_dlp/src/lib.rs b/crates/yt_dlp/src/lib.rs
index 2f554a9..f958895 100644
--- a/crates/yt_dlp/src/lib.rs
+++ b/crates/yt_dlp/src/lib.rs
@@ -8,7 +8,8 @@
 // You should have received a copy of the License along with this program.
 // If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
 
-// use std::{fs::File, io::Write};
+use std::env;
+use std::{fs::File, io::Write};
 
 use std::{path::PathBuf, sync::Once};
 
@@ -308,8 +309,12 @@ pub async fn extract_info(
 
         let result_str = json_dumps(py, result)?;
 
-        //let mut file = File::create("output.info.json").unwrap();
-        //write!(file, "{}", result_str).unwrap();
+        if let Ok(confirm) = env::var("YT_STORE_INFO_JSON") {
+            if confirm == "yes" {
+                let mut file = File::create("output.info.json").unwrap();
+                write!(file, "{}", result_str).unwrap();
+            }
+        }
 
         Ok(serde_json::from_str(&result_str)
             .expect("Python should be able to produce correct json"))