Code Monkey home page Code Monkey logo

Comments (5)

pukkandan avatar pukkandan commented on June 15, 2024

cc @dirkf

from yt-dlp.

dirkf avatar dirkf commented on June 15, 2024

I'm a little hazy as to why one would want to use --simulate because all it basically tells you is that the extractor didn't (with luck) crash. If you want to know, say, what format(s) will be selected there is--get-format or eqv. Since no video download is being run, it can't tell you anything about any external downloader.

Looking at upstream confirms the diagnosis in this issue.

  1. The API param simulate is also forced to true when a "printing" option such as --get-format is selected. This would give the wrong answer if the default format selection was changed by simulate.

  2. The default format is changed to best/bestvideo+bestaudio as below:

        def prefer_best():
            if self.params.get('simulate', False):
                return False
            if not download:
                return False
            if self.params.get('outtmpl', DEFAULT_OUTTMPL) == '-':
                return True
            if info_dict.get('is_live'):
                return True
            if not can_merge():
                return True
            return False

So actually there are several cases where the default format should be changed, and isn't, when simulate is set, or when no download is requested (normally not through the CLI). Arguably the first two tests should be moved after the tests that return True.

from yt-dlp.

bashonly avatar bashonly commented on June 15, 2024

I'm a little hazy as to why one would want to use --simulate because all it basically tells you is that the extractor didn't (with luck) crash. If you want to know, say, what format(s) will be selected there is --get-format or eqv.

Yeah, the issue is really about the simulate param rather than just the --simulate CLI flag

from yt-dlp.

dirkf avatar dirkf commented on June 15, 2024

Well, I think the third result (without the simulate/download tests) is correct and the second not:

$ python -m youtube_dl --get-format 'BaW_jenozKc'
248 - 1920x1080 (1080p)+140 - audio only (audio_quality_medium)
$ python -m youtube_dl --get-format -o - 'BaW_jenozKc'
248 - 1920x1080 (1080p)+140 - audio only (audio_quality_medium)
$ python -m youtube_dl --get-format -o - 'BaW_jenozKc'
22 - 1280x720 (720p)
$ 

from yt-dlp.

pukkandan avatar pukkandan commented on June 15, 2024

Re: 96da952#r141681868

In case users of the API rely on the historic behaviour when download is falsy, that can be left in place, as it's always truthy in the CLI (at least it is upstream).

Imo, since we are breaking compat anyway, it's more consistent to completely get rid of this behavior. Although not the recommended approach, I have often seen extract_info(URL, download=False) to get metadata and then download(URL) in the wild.

from yt-dlp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.