feat: scrape user regions

This commit is contained in:
mokurin000
2025-08-03 19:04:16 +08:00
parent 56a36933e1
commit a1b3a8ef0e
6 changed files with 69 additions and 0 deletions

View File

@@ -284,6 +284,30 @@ async fn main() -> Result<(), Box<dyn snafu::Error>> {
)
.await?;
}
#[cfg(feature = "fetchall")]
Commands::ScrapeAllRegion {
concurrency,
min_rating,
max_rating,
} => {
use sdgb_api::title::methods::GetUserRegionApiExt;
use crate::{
cache::{PLAYER_REGION, PLAYERS},
utils::helpers::{cached_concurrent_fetch, read_cache},
};
let mut players: Vec<GetUserPreviewApiResp> = read_cache(PLAYERS)?;
players.retain(|p| p.player_rating >= min_rating && p.player_rating <= max_rating);
cached_concurrent_fetch::<GetUserRegionApiExt>(
players.iter().map(|p| p.user_id).collect::<Vec<u32>>(),
&client,
concurrency,
PLAYER_REGION,
)
.await?;
}
#[cfg(feature = "fetchall")]
Commands::ListAllUserDump {} => {