yt-dlp / yt-dlp

A feature-rich command-line audio/video downloader
https://discord.gg/H5MNcFW63r
The Unlicense
90k stars 6.98k forks source link

if given format is not available than show the available format to download rather than quit #10839

Open OnlineLearningTutorials opened 2 months ago

OnlineLearningTutorials commented 2 months ago

DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

Checklist

Provide a description that is worded well enough to be understood

If requested format is not present than it will quit. I want to give the user a option to choose other format by giving available format list and if only one audio or video format is not found than it will show only for video or only for audio format. So that user not have to run yt-dlp again and again. If this is breaking the yt-dlp behavior with -F or -f option than we can give some other option, so that if a user run yt-dlp to download than he ensure the video would be download in one go even in other possible format and not to worry giving url next time.

I suggest other option than -F or -f because when we run yt-dlp in some script than it would be great to stop if the video format is not found. But if the video downloaded manually than it would be better give the possible available format rather than exit.

Provide verbose output that clearly demonstrates the problem

Complete Verbose Output

[debug] Command-line config: ['-vU']
[debug] Portable config "/usr/local/bin/yt-dlp.conf": ['--embed-subs', '--embed-chapters', '--compat-options', 'no-live-chat', '-o', '%(uploader_id)s/%(title).200B [%(id)s].%(ext)s']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2024.08.06 from yt-dlp/yt-dlp [4d9231208] (zip)
[debug] Compatibility options: no-live-chat
[debug] Python 3.12.3 (CPython x86_64 64bit) - Linux-6.8.0-40-generic-x86_64-with-glibc2.39 (OpenSSL 3.0.13 30 Jan 2024, glibc 2.39)
[debug] exe versions: ffmpeg 6.1.1 (setts), ffprobe 6.1.1
[debug] Optional libraries: Cryptodome-3.20.0, brotli-1.1.0, certifi-2023.11.17, mutagen-1.46.0, requests-2.31.0, secretstorage-3.3.3, sqlite3-3.45.1, urllib3-2.0.7, websockets-10.4
[debug] Proxy map: {}
[debug] Request Handlers: urllib
[debug] Loaded 1830 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Latest version: stable@2024.08.06 from yt-dlp/yt-dlp
yt-dlp is up to date (stable@2024.08.06 from yt-dlp/yt-dlp)
DivannKokos commented 2 months ago

+1 if it is not already there (i don't use program much, but anyway)

observeroftime02 commented 2 months ago

If I am unsure what formats are available I use -f- as the format, which will print all available formats and prompt the user to select their choice by entering the format ID. That might help as far as running yt-dlp multiple times goes.

It would be nice if yt-dlp could automatically present such a prompt if a selected format is unavailable (however one might define "unavailable" is up for debate), but I'm not sure how this would affect the default behaviour of the program.

bashonly commented 2 months ago

as observeroftime02 said, yt-dlp -f - "URL" is basically the fallback behavior that is being requested in the OP.

@OnlineLearningTutorials when you say you "want to give the user an option...", what are you developing/writing? A front-end? External script? There may already be a way to do what you want

OnlineLearningTutorials commented 2 months ago

@bashonly exactly what I want, I haven't notice that yt-dlp -f - "URL" do the perfect job what I want. one more thing suppose I give yt-dlp -f 136+139 "URL" now if 139 is not present and 140 format is present, than is there a way to notify user that only 139 format is not found, the other possible format can be used are 140 and other and prompt user to select format which is not found. Is there already something to do it.

because if yt-dlp just quit, than there is possibility that video format is not present, While I am not take audio a major factor, I can watch video with other similar audio. however worst audio or wa do that but there is two problem

  1. I want to mp4 to add only m4a and webm to only webm
  2. Mostly I don't prefer to download fragment of hls type format.