forked from StrafesNET/asset-tool
use old api for download
This commit is contained in:
parent
b14915a63a
commit
f32cd104b6
26
src/main.rs
26
src/main.rs
@ -58,12 +58,12 @@ struct DownloadHistorySubcommand{
|
|||||||
}
|
}
|
||||||
#[derive(Args)]
|
#[derive(Args)]
|
||||||
struct DownloadSubcommand{
|
struct DownloadSubcommand{
|
||||||
#[arg(long,group="api_key",required=true)]
|
#[arg(long,group="cookie",required=true)]
|
||||||
api_key_literal:Option<String>,
|
cookie_literal:Option<String>,
|
||||||
#[arg(long,group="api_key",required=true)]
|
#[arg(long,group="cookie",required=true)]
|
||||||
api_key_envvar:Option<String>,
|
cookie_envvar:Option<String>,
|
||||||
#[arg(long,group="api_key",required=true)]
|
#[arg(long,group="cookie",required=true)]
|
||||||
api_key_file:Option<PathBuf>,
|
cookie_file:Option<PathBuf>,
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
output_folder:Option<PathBuf>,
|
output_folder:Option<PathBuf>,
|
||||||
#[arg(required=true)]
|
#[arg(required=true)]
|
||||||
@ -358,10 +358,10 @@ async fn main()->AResult<()>{
|
|||||||
Commands::Download(subcommand)=>{
|
Commands::Download(subcommand)=>{
|
||||||
let output_folder=subcommand.output_folder.unwrap_or_else(||std::env::current_dir().unwrap());
|
let output_folder=subcommand.output_folder.unwrap_or_else(||std::env::current_dir().unwrap());
|
||||||
download_list(
|
download_list(
|
||||||
api_key_from_args(
|
cookie_from_args(
|
||||||
subcommand.api_key_literal,
|
subcommand.cookie_literal,
|
||||||
subcommand.api_key_envvar,
|
subcommand.cookie_envvar,
|
||||||
subcommand.api_key_file,
|
subcommand.cookie_file,
|
||||||
).await?,
|
).await?,
|
||||||
subcommand.asset_ids.into_iter().map(|asset_id|{
|
subcommand.asset_ids.into_iter().map(|asset_id|{
|
||||||
let mut path=output_folder.clone();
|
let mut path=output_folder.clone();
|
||||||
@ -645,13 +645,13 @@ async fn upload_place(config:UploadPlaceConfig)->AResult<()>{
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn download_list(api_key:ApiKey,asset_id_file_map:AssetIDFileMap)->AResult<()>{
|
async fn download_list(cookie:Cookie,asset_id_file_map:AssetIDFileMap)->AResult<()>{
|
||||||
let context=CloudContext::new(api_key);
|
let context=CookieContext::new(cookie);
|
||||||
futures::stream::iter(asset_id_file_map.into_iter()
|
futures::stream::iter(asset_id_file_map.into_iter()
|
||||||
.map(|(asset_id,file)|{
|
.map(|(asset_id,file)|{
|
||||||
let context=&context;
|
let context=&context;
|
||||||
async move{
|
async move{
|
||||||
Ok((file,context.get_asset(rbx_asset::cloud::GetAssetRequest{asset_id,version:None}).await?))
|
Ok((file,context.get_asset(rbx_asset::cookie::GetAssetRequest{asset_id,version:None}).await?))
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
.buffer_unordered(CONCURRENT_REQUESTS)
|
.buffer_unordered(CONCURRENT_REQUESTS)
|
||||||
|
Loading…
Reference in New Issue
Block a user