scraper: shuffle links

to get other links if we start getting blocked
This commit is contained in:
Cat /dev/Nulo 2024-08-02 16:25:14 -03:00
parent b9bd9eb51d
commit 6d32c897ac

View file

@ -6,6 +6,8 @@ use crate::db::Db;
use crate::scraper::Scraper; use crate::scraper::Scraper;
use futures::Future; use futures::Future;
use preciazo::supermercado::Supermercado; use preciazo::supermercado::Supermercado;
use rand::seq::SliceRandom;
use rand::thread_rng;
use reqwest::Url; use reqwest::Url;
#[derive(Clone)] #[derive(Clone)]
@ -48,6 +50,7 @@ impl Auto {
if let Some(n) = self.args.n_products { if let Some(n) = self.args.n_products {
links.truncate(n); links.truncate(n);
} }
links.shuffle(&mut thread_rng());
links links
}; };
// { // {