mirror of
https://github.com/FliegendeWurst/KIT-ILIAS-downloader.git
synced 2024-08-28 04:04:18 +00:00
commit
701fbb41c8
13
Cargo.lock
generated
13
Cargo.lock
generated
@ -1104,6 +1104,7 @@ dependencies = [
|
||||
"time",
|
||||
"tokio",
|
||||
"tokio-rustls",
|
||||
"tokio-socks",
|
||||
"tokio-util",
|
||||
"url",
|
||||
"wasm-bindgen",
|
||||
@ -1597,6 +1598,18 @@ dependencies = [
|
||||
"webpki",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-socks"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "51165dfa029d2a65969413a6cc96f354b86b464498702f174a4efa13608fd8c0"
|
||||
dependencies = [
|
||||
"either",
|
||||
"futures-util",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-util"
|
||||
version = "0.6.5"
|
||||
|
@ -8,7 +8,7 @@ edition = "2018"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
reqwest = { version = "0.11.0", default-features = false, features = ["cookies", "gzip", "json", "rustls-tls", "stream"] }
|
||||
reqwest = { version = "0.11.0", default-features = false, features = ["cookies", "gzip", "json", "rustls-tls", "stream", "socks"] }
|
||||
tokio = { version = "1.0.2", features = ["fs", "macros", "net", "rt-multi-thread"] }
|
||||
tokio-util = { version = "0.6.1", features = ["io"] }
|
||||
serde_json = "1.0.51"
|
||||
|
@ -42,6 +42,7 @@ FLAGS:
|
||||
OPTIONS:
|
||||
-j, --jobs <jobs> Parallel download jobs [default: 1]
|
||||
-o, --output <output> Output directory
|
||||
-p, --proxy <proxy> Proxy, e.g. socks5h://127.0.0.1:1080 [default: ""]
|
||||
```
|
||||
|
||||
### .iliasignore
|
||||
|
15
src/main.rs
15
src/main.rs
@ -6,7 +6,7 @@ use ignore::gitignore::Gitignore;
|
||||
use lazy_static::lazy_static;
|
||||
use parking_lot::Mutex;
|
||||
use regex::Regex;
|
||||
use reqwest::Client;
|
||||
use reqwest::{Client, Proxy};
|
||||
use scraper::{ElementRef, Html, Selector};
|
||||
use serde_json::json;
|
||||
use structopt::StructOpt;
|
||||
@ -653,6 +653,10 @@ struct Opt {
|
||||
/// Parallel download jobs
|
||||
#[structopt(short, long, default_value = "1")]
|
||||
jobs: usize,
|
||||
|
||||
/// Proxy, e.g. socks5h://127.0.0.1:1080
|
||||
#[structopt(short, long, default_value = "")]
|
||||
proxy: String,
|
||||
}
|
||||
|
||||
struct ILIAS {
|
||||
@ -668,9 +672,14 @@ impl ILIAS {
|
||||
async fn login<S1: Into<String>, S2: Into<String>>(opt: Opt, user: S1, pass: S2, ignore: Gitignore) -> Result<Self> {
|
||||
let user = user.into();
|
||||
let pass = pass.into();
|
||||
let client = Client::builder()
|
||||
let mut builder = Client::builder()
|
||||
.cookie_store(true)
|
||||
.user_agent(concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION")))
|
||||
.user_agent(concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION")));
|
||||
if opt.proxy != "" {
|
||||
let proxy = Proxy::all(&opt.proxy)?;
|
||||
builder = builder.proxy(proxy);
|
||||
}
|
||||
let client = builder
|
||||
// timeout is infinite by default
|
||||
.build()?;
|
||||
let this = ILIAS {
|
||||
|
Loading…
Reference in New Issue
Block a user