projects
/
rtx3080.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Create a client only once.
[rtx3080.git]
/
src
/
main.rs
diff --git
a/src/main.rs
b/src/main.rs
index
412d17c
..
9eca649
100644
(file)
--- a/
src/main.rs
+++ b/
src/main.rs
@@
-45,11
+45,13
@@
fn main() -> Result<(), Box<dyn std::error::Error>> {
};
let selector = Selector::parse("div.productGridElement > h2 > a:nth-child(1)").unwrap();
};
let selector = Selector::parse("div.productGridElement > h2 > a:nth-child(1)").unwrap();
+ let url = format!("https://www.steg-electronics.ch/fr/search?suche={}", to_find);
+
+ let client = reqwest::blocking::Client::new();
loop {
loop {
- let url = format!("https://www.steg-electronics.ch/fr/search?suche={}", to_find);
println!("Request: {}", url);
println!("Request: {}", url);
- let resp =
reqwest::blocking::get(&url
)?;
+ let resp =
client.get(&url).send(
)?;
if resp.status().is_success() {
let html = resp.text()?;
if resp.status().is_success() {
let html = resp.text()?;