download version history

This commit is contained in:
Quaternions 2024-01-04 17:46:40 -08:00
parent 54ca5520b7
commit 1712e0c7e3

View File

@ -169,17 +169,30 @@ fn read_readable(mut readable:impl Read)->AResult<Vec<u8>>{
Ok(contents)
}
const BHOP_PLACEID:u64=252877716;
async fn download_list(cookie:String,asset_id_file_map:AssetIDFileMap)->AResult<()>{
let client=reqwest::Client::new();
futures::stream::iter(asset_id_file_map)
.map(|(asset_id,file)|{
futures::stream::iter(1..=1006)
.map(|version_id|{
let client=&client;
let cookie=cookie.as_str();
async move{
let resp=client.get(format!("https://assetdelivery.roblox.com/v1/asset/?ID={}",asset_id))
let mut url=reqwest::Url::parse("https://assetdelivery.roblox.com/v1/asset/")?;
//url borrow scope
{
let mut query=url.query_pairs_mut();//borrow here
query.append_pair("ID",BHOP_PLACEID.to_string().as_str());
query.append_pair("version",version_id.to_string().as_str());
}
println!("url={}",url);
let resp=client.get(url)
.header("Cookie",cookie)
.send().await?;
Ok((file,resp.bytes().await?))
let mut path=std::path::PathBuf::new();
path.set_file_name(BHOP_PLACEID.to_string()+"_v"+version_id.to_string().as_str()+".rbxl");
Ok((path,resp.bytes().await?))
}
})
.buffer_unordered(CONCURRENT_REQUESTS)