tokio-runtime-worker panicked
From this example:
<details>
<summary>Download with progress tracking:</summary>
```rust
use yt_dlp::Youtube;
use std::path::PathBuf;
use yt_dlp::fetcher::deps::Libraries;
#[tokio::main]
pub async fn main() -> Result<(), Box<dyn std::error::Error>> {
let libraries_dir = PathBuf::from("libs");
let output_dir = PathBuf::from("output");
let youtube = libraries_dir.join("yt-dlp");
let ffmpeg = libraries_dir.join("ffmpeg");
let libraries = Libraries::new(youtube, ffmpeg);
let fetcher = Youtube::new(libraries, output_dir)?;
let url = String::from("https://www.youtube.com/watch?v=dQw4w9WgXcQ");
let video = fetcher.fetch_video_infos(url).await?;
// Download with progress callback
let download_id = fetcher.download_video_with_progress(
&video,
"video-with-progress.mp4",
|downloaded, total| {
let percentage = if total > 0 {
(downloaded as f64 / total as f64 * 100.0) as u64
} else {
0
};
println!("Progress: {}/{} bytes ({}%)", downloaded, total, percentage);
}
).await?;
// Wait for download completion
fetcher.wait_for_download(download_id).await;
Ok(())
}
```
</details>
· No progress
· No output
Result:
```
thread 'tokio-runtime-worker' panicked at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/yt-dlp-1.3.4/src/fetcher/download_manager.rs:464:66:
Cannot block the current thread from within a runtime. This happens because a function attempted to block the current thread while the thread is being used to drive asynchronous tasks.
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```
Distro: Arch Linux
yt-dlp = "1.3.2"
Note: The version 1.3.3 and 1.3.4 does not compile: https://github.com/boul2gom/yt-dlp/issues/67
1 条评论