Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cookiesfrombrowser parameter from api triggers TypeError #10196

Closed
10 tasks done
mrmabs opened this issue Jun 16, 2024 · 1 comment
Closed
10 tasks done

cookiesfrombrowser parameter from api triggers TypeError #10196

mrmabs opened this issue Jun 16, 2024 · 1 comment
Labels
question Question

Comments

@mrmabs
Copy link

mrmabs commented Jun 16, 2024

DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

  • I understand that I will be blocked if I intentionally remove or skip any mandatory* field

Checklist

Provide a description that is worded well enough to be understood

Running yt-dlp from catt via the cli api with 'cookiesfrombrowser=firefox' raises a TypeError. I am running Python 3.11.9.

cookies.py calls _parse_browser_specification with a pointer to string browser_specification appears to attempt to call with 7 parameters (characters in string firefox).

Removing the * appears to be working for me.

(I have made minor edits to verbose output to sanitise the data.)

Provide verbose output that clearly demonstrates the problem

  • Run your yt-dlp command with -vU flag added (yt-dlp -vU <your command line>)
  • If using API, add 'verbose': True to YoutubeDL params instead
  • Copy the WHOLE output (starting with [debug] Command-line config) and insert it below

Complete Verbose Output

[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version [email protected] from yt-dlp/yt-dlp [12b248ce6] (pip) API
[debug] params: {'verbose': '1', 'cookiesfrombrowser': 'firefox', 'compat_opts': set(), 'http_headers': {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.55 Safari/537.36', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Language': 'en-us,en;q=0.5', 'Sec-Fetch-Mode': 'navigate'}}
[debug] Python 3.11.9 (CPython x86_64 64bit) - Linux-6.7.12-amd64-x86_64-with-glibc2.38 (OpenSSL 3.2.2-dev , glibc 2.38)
[debug] exe versions: ffmpeg 6.1.1-4 (setts), ffprobe 6.1.1-4
[debug] Optional libraries: Cryptodome-3.20.0, brotli-1.1.0, certifi-2024.06.02, mutagen-1.47.0, requests-2.32.3, sqlite3-3.46.0, urllib3-2.2.1, websockets-12.0
[debug] Proxy map: {}
Traceback (most recent call last):
  File "~/.local/bin/catt", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "~/.local/share/pipx/venvs/catt/lib/python3.11/site-packages/catt/cli.py", line 667, in main
    return cli(obj=get_config_as_dict())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/share/pipx/venvs/catt/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/share/pipx/venvs/catt/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "~/.local/share/pipx/venvs/catt/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/share/pipx/venvs/catt/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/share/pipx/venvs/catt/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/share/pipx/venvs/catt/lib/python3.11/site-packages/click/decorators.py", line 45, in new_func
    return f(get_current_context().obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/share/pipx/venvs/catt/lib/python3.11/site-packages/catt/cli.py", line 232, in cast
    cst, stream = setup_cast(
                  ^^^^^^^^^^^
  File "~/.local/share/pipx/venvs/catt/lib/python3.11/site-packages/catt/controllers.py", line 81, in setup_cast
    stream = StreamInfo(video_url, cast_info=cast.cast_info, ytdl_options=ytdl_options) if video_url else None
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/share/pipx/venvs/catt/lib/python3.11/site-packages/catt/stream_info.py", line 41, in __init__
    self._ydl = yt_dlp.YoutubeDL(dict(ytdl_options) if ytdl_options else DEFAULT_YTDL_OPTS)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/share/pipx/venvs/catt/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 700, in __init__
    self.print_debug_header()
  File "~/.local/share/pipx/venvs/catt/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 4046, in print_debug_header
    write_debug(f'Request Handlers: {", ".join(rh.RH_NAME for rh in self._request_director.handlers.values())}')
                                                                    ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/functools.py", line 1001, in __get__
    val = self.func(instance)
          ^^^^^^^^^^^^^^^^^^^
  File "~/.local/share/pipx/venvs/catt/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 4222, in _request_director
    return self.build_request_director(_REQUEST_HANDLERS.values(), _RH_PREFERENCES)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/share/pipx/venvs/catt/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 4197, in build_request_director
    cookiejar=self.cookiejar,
              ^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/functools.py", line 1001, in __get__
    val = self.func(instance)
          ^^^^^^^^^^^^^^^^^^^
  File "~/.local/share/pipx/venvs/catt/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 4093, in cookiejar
    return load_cookies(
           ^^^^^^^^^^^^^
  File "~/.local/share/pipx/venvs/catt/lib/python3.11/site-packages/yt_dlp/cookies.py", line 92, in load_cookies
    browser_name, profile, keyring, container = _parse_browser_specification(*browser_specification)
                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: _parse_browser_specification() takes from 1 to 4 positional arguments but 7 were given
@mrmabs mrmabs added bug Bug that is not site-specific triage Untriaged issue labels Jun 16, 2024
@seproDev
Copy link
Collaborator

seproDev commented Jun 16, 2024

You don't need to guess the parameters for the api, but can use devscripts/cli_to_api.py

{'cookiesfrombrowser': ('firefox', None, None, None)}

The tuple is being used for the optional parts of the --cookies-from-browser argument (keyring, profile, container)

@seproDev seproDev added question Question and removed bug Bug that is not site-specific triage Untriaged issue labels Jun 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question
Projects
None yet
Development

No branches or pull requests

3 participants