fix download fails in batch mode
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "stream-capture",
|
||||
"private": true,
|
||||
"version": "1.0.1",
|
||||
"version": "1.1.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
2
src-tauri/Cargo.lock
generated
2
src-tauri/Cargo.lock
generated
@@ -3971,7 +3971,7 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
||||
|
||||
[[package]]
|
||||
name = "stream-capture"
|
||||
version = "1.0.1"
|
||||
version = "1.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"chrono",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "stream-capture"
|
||||
version = "1.0.1"
|
||||
version = "1.1.0"
|
||||
description = "A Tauri App"
|
||||
authors = ["you"]
|
||||
edition = "2021"
|
||||
|
||||
@@ -15,6 +15,7 @@ pub struct VideoMetadata {
|
||||
pub thumbnail: String,
|
||||
pub duration: Option<f64>,
|
||||
pub uploader: Option<String>,
|
||||
pub url: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
@@ -150,12 +151,17 @@ fn parse_video_metadata(json: &serde_json::Value) -> VideoMetadata {
|
||||
_ => format!("https://i.ytimg.com/vi/{}/mqdefault.jpg", id),
|
||||
};
|
||||
|
||||
let url = json["webpage_url"].as_str()
|
||||
.or_else(|| json["url"].as_str())
|
||||
.map(|s| s.to_string());
|
||||
|
||||
VideoMetadata {
|
||||
id,
|
||||
title: json["title"].as_str().unwrap_or("Unknown Title").to_string(),
|
||||
thumbnail,
|
||||
duration: json["duration"].as_f64(),
|
||||
uploader: json["uploader"].as_str().map(|s| s.to_string()),
|
||||
url,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"productName": "StreamCapture",
|
||||
"version": "1.0.1",
|
||||
"version": "1.1.0",
|
||||
"identifier": "top.volan.stream-capture",
|
||||
"build": {
|
||||
"beforeDevCommand": "pnpm dev",
|
||||
@@ -13,7 +13,7 @@
|
||||
"windows": [
|
||||
{
|
||||
"label": "main",
|
||||
"title": "流萤 - 视频下载 v1.0.1",
|
||||
"title": "流萤 - 视频下载 v1.1.0",
|
||||
"width": 1300,
|
||||
"height": 900,
|
||||
"visible": false
|
||||
|
||||
@@ -188,7 +188,7 @@ async function startDownload() {
|
||||
}
|
||||
|
||||
for (const entry of selectedEntries) {
|
||||
const videoUrl = `https://www.youtube.com/watch?v=${entry.id}`
|
||||
const videoUrl = entry.url || `https://www.youtube.com/watch?v=${entry.id}`
|
||||
const id = await invoke<string>('start_download', {
|
||||
url: videoUrl,
|
||||
options: analysisStore.options,
|
||||
@@ -264,7 +264,7 @@ async function startDownload() {
|
||||
>
|
||||
<List v-if="analysisStore.isBatchMode" class="w-3.5 h-3.5" />
|
||||
<Link v-else class="w-3.5 h-3.5" />
|
||||
{{ analysisStore.isBatchMode ? '切换到单链接模式' : '批量输入模式' }}
|
||||
{{ analysisStore.isBatchMode ? '单链接模式' : '批量输入模式' }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -281,7 +281,7 @@ async function startDownload() {
|
||||
v-else
|
||||
v-model="analysisStore.url"
|
||||
type="text"
|
||||
placeholder="https://youtube.com/watch?v=..."
|
||||
placeholder="https://..."
|
||||
class="w-full bg-gray-50 dark:bg-zinc-800 border-none rounded-xl px-4 py-3 text-zinc-900 dark:text-white focus:ring-2 focus:ring-blue-500 outline-none"
|
||||
@keyup.enter="analyze"
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user