ITADN

✨ `requested_formats` is not available in `yt_dlp::model::video::Video`

#179Closedsonicjhon1 创建于 2026-04-08
enhancementStale
S
sonicjhon1commented
### 📝 Feature description I'd like to have `yt_dlp::model::video::Video.requested_formats` which seems to be just be a `Vec<Format>`. It should contain the best video+audio formats, ex: `Downloading 1 format(s): 399+251` so it will contain both `Format` of 399 and `Format` of 251. ### 💡 Motivation / Use case It will allow for easier selection of best video+audio format and exposes what `yt-dlp` already returns ### 🔧 Proposed implementation In `yt_dlp::model::video::Video`, add another field `requested_formats: Vec<Format>` ### 🗂️ Related modules - [ ] 🔧 Client (builder, download builder, proxy) - [ ] 📥 Download (manager, fetcher, segments) - [ ] 🔔 Events (hooks, webhooks, event bus) - [ ] 📡 Extractor (YouTube, generic, detector) - [ ] 🏷️ Metadata (MP3, MP4, chapters, FFmpeg) - [ ] 🔍 Cache (memory, JSON, redb, Redis) - [ ] 📊 Statistics (tracker, snapshots) - [x] 📦 Model (Video, Format, Playlist, etc.) ### 🧩 Example API usage ```rust use yt_dlp::prelude::*; #[tokio::main] async fn main() -> Result<(), Box<dyn std::error::Error>> { let downloader = Downloader::new("yt-dlp", "ffmpeg").await?; let download_info = downloader.fetch_video_infos_fresh("http://example.com").await?; download_info.requested_formats.into_iter().for_each(|f| { dbg!(f.format); }); Ok(()) } ``` ### 📸 Additional context Example `requested_formats` with some fields redacted: ```json "requested_formats": [ { "asr": null, "filesize": 29296984, "format_id": "399", "format_note": "1080p", "source_preference": -1, "fps": 30, "audio_channels": null, "height": 1080, "quality": 9.0, "has_drm": false, "tbr": 748.804, "filesize_approx": 29296956, "width": 1920, "language": null, "language_preference": -1, "preference": null, "ext": "mp4", "vcodec": "av01.0.08M.08", "acodec": "none", "dynamic_range": "SDR", "container": "mp4_dash", "url": "...", "available_at": 1775637326, "downloader_options": { "http_chunk_size": 10485760 }, "protocol": "https", "video_ext": "mp4", "audio_ext": "none", "abr": 0, "vbr": 748.804, "resolution": "1920x1080", "aspect_ratio": 1.78, "http_headers": { ... }, "format": "399 - 1920x1080 (1080p)" }, { "asr": 48000, "filesize": 5504325, "format_id": "251", "format_note": "medium", "source_preference": -1, "fps": null, "audio_channels": 2, "height": null, "quality": 3.0, "has_drm": false, "tbr": 140.676, "filesize_approx": 5504317, "width": null, "language": "en", "language_preference": -1, "preference": null, "ext": "webm", "vcodec": "none", "acodec": "opus", "dynamic_range": null, "container": "webm_dash", "url": "...", "available_at": 1775637326, "downloader_options": { "http_chunk_size": 10485760 }, "protocol": "https", "audio_ext": "webm", "video_ext": "none", "vbr": 0, "abr": 140.676, "resolution": "audio only", "aspect_ratio": null, "http_headers": { ... }, "format": "251 - audio only (medium)" } ] ```
关闭于 2026-05-16 2 条评论