first
This commit is contained in:
commit
5d7cebaafb
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
/target
|
||||
Cargo.lock
|
6
Cargo.toml
Normal file
6
Cargo.toml
Normal file
@ -0,0 +1,6 @@
|
||||
[package]
|
||||
name = "hp"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
[dependencies]
|
||||
reqwest = { version = "0.11.11", features = ["stream","multipart","json", "blocking"] }
|
25
src/main.rs
Normal file
25
src/main.rs
Normal file
@ -0,0 +1,25 @@
|
||||
use reqwest::blocking::Client;
|
||||
use reqwest::blocking::multipart::Form;
|
||||
use reqwest::redirect::Policy;
|
||||
use std::env::args;
|
||||
use std::time::Duration;
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let args: Vec<String> = args().collect();
|
||||
if args.len() < 2 {
|
||||
println!("Usage: hardfiles <file>");
|
||||
return Ok(());
|
||||
}
|
||||
let filepath = &args[1];
|
||||
let client = Client::builder()
|
||||
.redirect(Policy::none())
|
||||
.timeout(Duration::from_secs(180))
|
||||
.build()?;
|
||||
let form = Form::new()
|
||||
.file("file", filepath)?;
|
||||
let res = client.post("https://hardfiles.org")
|
||||
.multipart(form)
|
||||
.send()?;
|
||||
println!("{}", res.text()?);
|
||||
Ok(())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user