diff --git a/crates/biliup/src/uploader/bilibili.rs b/crates/biliup/src/uploader/bilibili.rs index 77dab0f..98dc595 100644 --- a/crates/biliup/src/uploader/bilibili.rs +++ b/crates/biliup/src/uploader/bilibili.rs @@ -120,6 +120,10 @@ pub struct Studio { #[clap(long)] #[serde(default)] pub up_close_danmu: bool, + + #[clap(long)] + #[serde(default)] + pub submit_by_app: bool, } #[derive(Default, Debug, Serialize, Deserialize)] @@ -278,6 +282,7 @@ impl BiliBili { .await?; info!("{:?}", ret); if ret.code == 0 { + info!("APP接口投稿成功"); Ok(ret) } else { Err(Kind::Custom(format!("{:?}", ret))) diff --git a/crates/bin/cli.rs b/crates/bin/cli.rs index b14804e..ee21b93 100644 --- a/crates/bin/cli.rs +++ b/crates/bin/cli.rs @@ -50,6 +50,9 @@ pub enum Commands { #[command(flatten)] studio: Studio, + + // #[arg(required = false, last = true, default_value = "client")] + // submit: Option, }, /// 是否要对某稿件追加视频 Append { diff --git a/crates/bin/main.rs b/crates/bin/main.rs index a4d24c3..e902090 100644 --- a/crates/bin/main.rs +++ b/crates/bin/main.rs @@ -53,6 +53,7 @@ async fn main() -> Result<()> { line, limit, studio, + // submit, } => upload_by_command(studio, cli.user_cookie, video_path, line, limit).await?, Commands::Upload { video_path: _, diff --git a/crates/bin/uploader.rs b/crates/bin/uploader.rs index 8d54d61..42fa7c8 100644 --- a/crates/bin/uploader.rs +++ b/crates/bin/uploader.rs @@ -70,6 +70,7 @@ pub async fn upload_by_command( video_path: Vec, line: Option, limit: usize, + // submit: Option, ) -> Result<()> { let bili = login_by_cookies(user_cookie).await?; if studio.title.is_empty() { @@ -81,7 +82,18 @@ pub async fn upload_by_command( } cover_up(&mut studio, &bili).await?; studio.videos = upload(&video_path, &bili, line, limit).await?; - bili.submit(&studio).await?; + + if studio.submit_by_app { + bili.submit_by_app(&studio).await?; + } + else { + bili.submit(&studio).await?; + } + // match submit.as_deref() { + // Some("app") => bili.submit_by_app(&studio).await?, + // _ => bili.submit(&studio).await?, + // }; + Ok(()) }