aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-04-08 15:55:17 +0200
committermetamuffin <metamuffin@disroot.org>2025-04-08 15:55:17 +0200
commit36b4c0b4fba57125791150c9df6740997d25d53c (patch)
treeeb82c8e035e753ec5d739092d7a2020596e947d5
parent7caef8ad89c09c172af84d592a6547882b7d62d0 (diff)
downloadweareearth-36b4c0b4fba57125791150c9df6740997d25d53c.tar
weareearth-36b4c0b4fba57125791150c9df6740997d25d53c.tar.bz2
weareearth-36b4c0b4fba57125791150c9df6740997d25d53c.tar.zst
h2 only and par limit from argsHEADmaster
-rw-r--r--src/client.rs12
-rw-r--r--src/main.rs2
2 files changed, 9 insertions, 5 deletions
diff --git a/src/client.rs b/src/client.rs
index 9c1b29a..8da86ce 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -27,10 +27,14 @@ impl GeClient {
download_counter: AtomicUsize::new(0),
cache_counter: AtomicUsize::new(0),
par_limit: Semaphore::new(par_limit),cache,
- client: Client::builder().default_headers(HeaderMap::from_iter([
- (HeaderName::from_static("user-agent"), HeaderValue::from_static("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36")),
- (HeaderName::from_static("referer"), HeaderValue::from_static("https://earth.google.com/"))
- ])).build().unwrap()
+ client: Client::builder()
+ .default_headers(HeaderMap::from_iter([
+ (HeaderName::from_static("user-agent"), HeaderValue::from_static("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36")),
+ (HeaderName::from_static("referer"), HeaderValue::from_static("https://earth.google.com/"))
+ ]))
+ .http2_prior_knowledge()
+ .build()
+ .unwrap()
})
}
pub async fn download(&self, path: &str) -> Result<Bytes> {
diff --git a/src/main.rs b/src/main.rs
index 6e3be3c..43c1d72 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -79,7 +79,7 @@ async fn main() -> Result<()> {
.await?;
}
Action::CacheMetadata { level } => {
- let c = GeClient::new(16, cache).await?;
+ let c = GeClient::new(args.par_limit, cache).await?;
let entry = c.planetoid_metdata().await?;
let epoch = entry.root_node_metadata.unwrap().bulk_metadata_epoch();
let count = cache_metadata(Arc::new(c), "".to_string(), epoch, level).await?;