fix: make scrape command deterministic and update lofigirl list

This commit is contained in:
Tal 2024-11-26 10:35:26 +01:00
parent a076c2b62f
commit 41a9e32184
2 changed files with 939 additions and 938 deletions

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@
//! This command is completely optional, and as such isn't subject to the same //! This command is completely optional, and as such isn't subject to the same
//! quality standards as the rest of the codebase. //! quality standards as the rest of the codebase.
use futures::{stream::FuturesUnordered, StreamExt}; use futures::{stream::FuturesOrdered, StreamExt};
use lazy_static::lazy_static; use lazy_static::lazy_static;
use scraper::{Html, Selector}; use scraper::{Html, Selector};
@ -34,7 +34,7 @@ async fn scan(extension: &str, include_full: bool) -> eyre::Result<Vec<String>>
let items = parse("").await?; let items = parse("").await?;
let years: Vec<u32> = items let mut years: Vec<u32> = items
.iter() .iter()
.filter_map(|x| { .filter_map(|x| {
let year = x.strip_suffix("/")?; let year = x.strip_suffix("/")?;
@ -42,14 +42,16 @@ async fn scan(extension: &str, include_full: bool) -> eyre::Result<Vec<String>>
}) })
.collect(); .collect();
years.sort();
// A little bit of async to run all of the months concurrently. // A little bit of async to run all of the months concurrently.
let mut futures = FuturesUnordered::new(); let mut futures = FuturesOrdered::new();
for year in years { for year in years {
let months = parse(&year.to_string()).await?; let months = parse(&year.to_string()).await?;
for month in months { for month in months {
futures.push(async move { futures.push_back(async move {
let path = format!("{}/{}", year, month); let path = format!("{}/{}", year, month);
let items = parse(&path).await.unwrap(); let items = parse(&path).await.unwrap();