mirror of
https://github.com/catdevnull/preciazo.git
synced 2024-11-22 14:16:19 +00:00
scraper: shuffle links
to get other links if we start getting blocked
This commit is contained in:
parent
b9bd9eb51d
commit
6d32c897ac
1 changed files with 3 additions and 0 deletions
|
@ -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
|
||||||
};
|
};
|
||||||
// {
|
// {
|
||||||
|
|
Loading…
Reference in a new issue