mirror of
https://github.com/Fare-spec/cours.git
synced 2025-12-09 19:30:40 +00:00
Add university content
This commit is contained in:
1412
high-school/get_bac_subject/get_bac_subject/Cargo.lock
generated
Normal file
1412
high-school/get_bac_subject/get_bac_subject/Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
8
high-school/get_bac_subject/get_bac_subject/Cargo.toml
Normal file
8
high-school/get_bac_subject/get_bac_subject/Cargo.toml
Normal file
@@ -0,0 +1,8 @@
|
||||
[package]
|
||||
name = "get_bac_subject"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
|
||||
reqwest = { version = "0.11", features = ["blocking"] }
|
||||
19
high-school/get_bac_subject/get_bac_subject/src/main.rs
Normal file
19
high-school/get_bac_subject/get_bac_subject/src/main.rs
Normal file
@@ -0,0 +1,19 @@
|
||||
fn download_file(url: &str, output_path: &str) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let response = get(url)?;
|
||||
if !response.status().is_success()
|
||||
let mut dest = File::create(Path::new(output_path))?;
|
||||
let mut content = response;
|
||||
copy(&mut content, &mut dest)?;
|
||||
println!("📥 Downloaded: {} → {}", url, output_path);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let url = "https://drive.proton.me/urls/XZ780G6P1M#kXUbcVjBlXPJ";
|
||||
let output = "sujets.zip";
|
||||
|
||||
if let Err(e) = download_file(url, output) {
|
||||
eprintln!("❌ Erreur: {}", e);
|
||||
}
|
||||
}
|
||||
1
high-school/get_bac_subject/get_bac_subject/url.txt
Normal file
1
high-school/get_bac_subject/get_bac_subject/url.txt
Normal file
@@ -0,0 +1 @@
|
||||
https://drive.proton.me/urls/XZ780G6P1M#kXUbcVjBlXPJ
|
||||
Reference in New Issue
Block a user