fix: get the whole upload URL instead of just the ID

This commit is contained in:
VC
2023-10-03 16:09:47 +02:00
parent 1ed86085bc
commit 8664b169f0
2 changed files with 5 additions and 5 deletions

View File

@@ -136,7 +136,7 @@ pub fn create_resumable_upload(
if res.status().is_success() {
Ok(res
.headers()
.get("x-guploader-uploadid")
.get("location")
.ok_or("Cannot find suitable header")?
.to_str()?
.to_string())
@@ -147,14 +147,14 @@ pub fn create_resumable_upload(
pub fn upload_video(
f_path: &str,
r_id: &str,
r_url: &str,
config: &YoutubeConfig,
) -> Result<(), Box<dyn Error>> {
let access_token = refresh_token(config)?;
let client = reqwest::blocking::Client::new();
let res = client.put(format!("https://www.googleapis.com/upload/youtube/v3/videos?uploadType=resumable&part=snippet%2Cstatus&upload_id={}", r_id))
let res = client.put(r_url)
.header("Authorization", format!("Bearer {}", access_token))
.body(f_path.to_string())
.send()?;