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

Passing --cookies-from-browser firefox to --yt-dlp-args throws exception #2242

Open
jessicah opened this issue Nov 22, 2024 · 3 comments · May be fixed by #2250
Open

Passing --cookies-from-browser firefox to --yt-dlp-args throws exception #2242

jessicah opened this issue Nov 22, 2024 · 3 comments · May be fixed by #2250
Labels
Bug Unexpected problem or unintended behavior that needs to be fixed

Comments

@jessicah
Copy link

jessicah commented Nov 22, 2024

System OS

Windows

Python Version

3.10 (CPython)

Install Source

pip / PyPi

Install version / commit hash

4.2.10

Expected Behavior vs Actual Behavior

Download songs with cookies fetched from browser. Instead, an exception is thrown, failing to parse the browser specification.

Steps to reproduce - Ensure to include actual links!

spotdl.exe --format m4a --bitrate disable --user-auth --m3u "{list}" --save-file metadata.spotdl --save-errors errors.txt --print-errors --archive archive.json --max-retries 10 --log-level DEBUG --preload --overwrite skip --yt-dlp-args "--cookies-from-browser firefox" download flipside

Traceback

[16:47:54] DEBUG    MainThread - Downloader settings: {'audio_providers': ['youtube-music'], 'lyrics_providers': ['genius', 'azlyrics', 'musixmatch'], 'genius_token':          downloader.py:129
                    'alXXDbPZtK1m2RrZ8I4k2Hn8Ahsd0Gh_o076HYvcdlBvmc0ULL1H8Z8xRlew5qaG', 'playlist_numbering': False, 'playlist_retain_track_cover': False, 'scan_for_songs':
                    False, 'm3u': '{list}', 'output': '{artists} - {title}.{output-ext}', 'm3u_output': '#EXTINF:{duration}, {artists} - {title}.{output-ext}', 'overwrite':
                    'skip', 'search_query': None, 'ffmpeg': 'ffmpeg', 'bitrate': 'disable', 'ffmpeg_args': None, 'format': 'm4a', 'save_file': 'metadata.spotdl',
                    'filter_results': True, 'album_type': None, 'threads': 4, 'cookie_file': None, 'restrict': None, 'print_errors': True, 'sponsor_block': False, 'preload':
                    True, 'archive': 'archive.json', 'load_config': True, 'log_level': 'DEBUG', 'simple_tui': False, 'fetch_albums': False, 'id3_separator': '/', 'ytm_data':
                    False, 'add_unavailable': False, 'generate_lrc': False, 'force_update_metadata': False, 'only_verified_results': False, 'sync_without_deleting': False,
                    'max_filename_length': None, 'yt_dlp_args': '--cookies-from-browser firefox', 'detect_formats': None, 'save_errors': 'errors.txt', 'ignore_albums': None,
                    'proxy': None, 'skip_explicit': False, 'log_format': None, 'redownload': False, 'skip_album_art': False, 'create_skip_file': False, 'respect_skip_file':
                    False, 'sync_remove_lrc': False}
[16:47:54] DEBUG    MainThread - FFmpeg path: ffmpeg                                                                                                                            downloader.py:147
[16:47:54] DEBUG    MainThread - Found 0 known songs                                                                                                                            downloader.py:182
[16:47:57] DEBUG    MainThread - Archive: 0 urls                                                                                                                                downloader.py:237
[16:47:57] DEBUG    MainThread - Downloader initialized                                                                                                                         downloader.py:239
[16:47:57] INFO     MainThread - Processing query: flipside                                                                                                                         search.py:140
[16:47:58] DEBUG    MainThread - Found 1 songs in 0 lists                                                                                                                           search.py:353
[16:47:58] DEBUG    MainThread - Downloading 1 songs                                                                                                                            downloader.py:286
[16:47:58] DEBUG    MainThread - Filtered 1 songs with archive                                                                                                                  downloader.py:290
[16:48:01] DEBUG    asyncio_0 - Found lyrics for Norah Jones - Flipside on Genius                                                                                               downloader.py:411
[16:48:01] DEBUG    asyncio_0 - [5Ps9XMq4PDMDCNnp4JfYiI] Searching for norah jones - flipside                                                                                         base.py:168
[16:48:01] DEBUG    asyncio_0 - [5Ps9XMq4PDMDCNnp4JfYiI] Found 4 results for ISRC USUM71605846                                                                                        base.py:185
[16:48:01] DEBUG    asyncio_0 - [5Ps9XMq4PDMDCNnp4JfYiI] Filtered to 1 ISRC results                                                                                                   base.py:213
[16:48:01] DEBUG    asyncio_0 - [5Ps9XMq4PDMDCNnp4JfYiI] Best ISRC result is https://music.youtube.com/watch?v=Dpl-Xgz1dKU with score 100.0                                           base.py:222
[16:48:01] DEBUG    asyncio_0 - Downloading Norah Jones - Flipside using https://music.youtube.com/watch?v=Dpl-Xgz1dKU                                                          downloader.py:690
[16:48:01] DEBUG    asyncio_0 - ERROR: _parse_browser_specification() takes from 1 to 4 positional arguments but 7 were given                                                         base.py:395
[16:48:01] ERROR    asyncio_0 - Traceback (most recent call last):                                                                                                        progress_handler.py:358
                      File "C:\Python310\lib\site-packages\yt_dlp\cookies.py", line 97, 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

                    During handling of the above exception, another exception occurred:

                    Traceback (most recent call last):
                      File "C:\Python310\lib\site-packages\yt_dlp\YoutubeDL.py", line 4107, in cookiejar
                        return load_cookies(
                      File "C:\Python310\lib\site-packages\yt_dlp\cookies.py", line 113, in load_cookies
                        raise CookieLoadError('failed to load cookies')
                    yt_dlp.cookies.CookieLoadError: failed to load cookies

                    During handling of the above exception, another exception occurred:

                    Traceback (most recent call last):
                      File "C:\Python310\lib\site-packages\spotdl\providers\audio\base.py", line 390, in get_download_metadata
                        data = self.audio_handler.extract_info(url, download=download)
                      File "C:\Python310\lib\site-packages\yt_dlp\YoutubeDL.py", line 1613, in extract_info
                        return self.__extract_info(url, self.get_info_extractor(key), download, extra_info, process)
                      File "C:\Python310\lib\site-packages\yt_dlp\YoutubeDL.py", line 1624, in wrapper
                        return func(self, *args, **kwargs)
                      File "C:\Python310\lib\site-packages\yt_dlp\YoutubeDL.py", line 1759, in __extract_info
                        ie_result = ie.extract(url)
                      File "C:\Python310\lib\site-packages\yt_dlp\extractor\common.py", line 739, in extract
                        self.initialize()
                      File "C:\Python310\lib\site-packages\yt_dlp\extractor\common.py", line 648, in initialize
                        self._real_initialize()
                      File "C:\Python310\lib\site-packages\yt_dlp\extractor\youtube.py", line 571, in _real_initialize
                        self._initialize_pref()
                      File "C:\Python310\lib\site-packages\yt_dlp\extractor\youtube.py", line 559, in _initialize_pref
                        cookies = self._get_cookies('https://www.youtube.com/')
                      File "C:\Python310\lib\site-packages\yt_dlp\extractor\common.py", line 3604, in _get_cookies
                        return LenientSimpleCookie(self._downloader.cookiejar.get_cookie_header(url))
                      File "C:\Python310\lib\functools.py", line 981, in __get__
                        val = self.func(instance)
                      File "C:\Python310\lib\site-packages\yt_dlp\YoutubeDL.py", line 4112, in cookiejar
                        self.report_error(str(cause), tb=''.join(traceback.format_exception(None, cause, cause.__traceback__)))
                      File "C:\Python310\lib\site-packages\yt_dlp\YoutubeDL.py", line 1090, in report_error
                        self.trouble(f'{self._format_err("ERROR:", self.Styles.ERROR)} {message}', *args, **kwargs)
                      File "C:\Python310\lib\site-packages\yt_dlp\YoutubeDL.py", line 1009, in trouble
                        self.to_stderr(message)
                      File "C:\Python310\lib\site-packages\yt_dlp\YoutubeDL.py", line 949, in to_stderr
                        self.params['logger'].error(message)
                      File "C:\Python310\lib\site-packages\spotdl\providers\audio\base.py", line 57, in error
                        raise AudioProviderError(msg)
                    spotdl.providers.audio.base.AudioProviderError: ERROR: _parse_browser_specification() takes from 1 to 4 positional arguments but 7 were given

                    The above exception was the direct cause of the following exception:

                    Traceback (most recent call last):
                      File "C:\Python310\lib\site-packages\spotdl\download\downloader.py", line 697, in search_and_download
                        download_info = audio_downloader.get_download_metadata(
                      File "C:\Python310\lib\site-packages\spotdl\providers\audio\base.py", line 396, in get_download_metadata
                        raise AudioProviderError(f"YT-DLP download error - {url}") from exception
                    spotdl.providers.audio.base.AudioProviderError: YT-DLP download error - https://music.youtube.com/watch?v=Dpl-Xgz1dKU

                    ╭──────────────────────────────────────────────────────── Traceback (most recent call last) ────────────────────────────────────────────────────────╮
                    │ C:\Python310\lib\site-packages\yt_dlp\cookies.py:97 in load_cookies                                                                               │
                    │                                                                                                                                                   │
                    │     94 │   try:                                                                                                                                   │
                    │     95 │   │   cookie_jars = []                                                                                                                   │
                    │     96 │   │   if browser_specification is not None:                                                                                              │
                    │ ❱   97 │   │   │   browser_name, profile, keyring, container =                                                                                    │
                    │        _parse_browser_specification(*browser_specification)                                                                                       │
                    │     98 │   │   │   cookie_jars.append(                                                                                                            │
                    │     99 │   │   │   │   extract_cookies_from_browser(browser_name, profile, YDLLogger(ydl),                                                        │
                    │        keyring=keyring, container=container))                                                                                                     │
                    │    100                                                                                                                                            │
                    ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
                    TypeError: _parse_browser_specification() takes from 1 to 4 positional arguments but 7 were given

                    During handling of the above exception, another exception occurred:

                    ╭──────────────────────────────────────────────────────── Traceback (most recent call last) ────────────────────────────────────────────────────────╮
                    │ C:\Python310\lib\site-packages\yt_dlp\YoutubeDL.py:4107 in cookiejar                                                                              │
                    │                                                                                                                                                   │
                    │   4104 │   def cookiejar(self):                                                                                                                   │
                    │   4105 │   │   """Global cookiejar instance"""                                                                                                    │
                    │   4106 │   │   try:                                                                                                                               │
                    │ ❱ 4107 │   │   │   return load_cookies(                                                                                                           │
                    │   4108 │   │   │   │   self.params.get('cookiefile'), self.params.get('cookiesfrombrowser'),                                                      │
                    │        self)                                                                                                                                      │
                    │   4109 │   │   except CookieLoadError as error:                                                                                                   │
                    │   4110 │   │   │   cause = error.__context__                                                                                                      │
                    │                                                                                                                                                   │
                    │ C:\Python310\lib\site-packages\yt_dlp\cookies.py:113 in load_cookies                                                                              │
                    │                                                                                                                                                   │
                    │    110 │   │                                                                                                                                      │
                    │    111 │   │   return _merge_cookie_jars(cookie_jars)                                                                                             │
                    │    112 │   except Exception:                                                                                                                      │
                    │ ❱  113 │   │   raise CookieLoadError('failed to load cookies')                                                                                    │
                    │    114                                                                                                                                            │
                    │    115                                                                                                                                            │
                    │    116 def extract_cookies_from_browser(browser_name, profile=None, logger=YDLLogger(), *,                                                        │
                    │        keyring=None, container=None):                                                                                                             │
                    ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
                    CookieLoadError: failed to load cookies

                    During handling of the above exception, another exception occurred:

                    ╭──────────────────────────────────────────────────────── Traceback (most recent call last) ────────────────────────────────────────────────────────╮
                    │ C:\Python310\lib\site-packages\spotdl\providers\audio\base.py:390 in get_download_metadata                                                        │
                    │                                                                                                                                                   │
                    │   387 │   │   """                                                                                                                                 │
                    │   388 │   │                                                                                                                                       │
                    │   389 │   │   try:                                                                                                                                │
                    │ ❱ 390 │   │   │   data = self.audio_handler.extract_info(url, download=download)                                                                  │
                    │   391 │   │   │                                                                                                                                   │
                    │   392 │   │   │   if data:                                                                                                                        │
                    │   393 │   │   │   │   return data                                                                                                                 │
                    │                                                                                                                                                   │
                    │ C:\Python310\lib\site-packages\yt_dlp\YoutubeDL.py:1613 in extract_info                                                                           │
                    │                                                                                                                                                   │
                    │   1610 │   │   │   │   if self.params.get('break_on_existing', False):                                                                            │
                    │   1611 │   │   │   │   │   raise ExistingVideoReached                                                                                             │
                    │   1612 │   │   │   │   break                                                                                                                      │
                    │ ❱ 1613 │   │   │   return self.__extract_info(url, self.get_info_extractor(key), download,                                                        │
                    │        extra_info, process)                                                                                                                       │
                    │   1614 │   │   else:                                                                                                                              │
                    │   1615 │   │   │   extractors_restricted = self.params.get('allowed_extractors') not in (None,                                                    │
                    │        ['default'])                                                                                                                               │
                    │   1616 │   │   │   self.report_error(f'No suitable extractor{format_field(ie_key, None, "                                                         │
                    │        (%s)")} found for URL {url}',                                                                                                              │
                    │                                                                                                                                                   │
                    │ C:\Python310\lib\site-packages\yt_dlp\YoutubeDL.py:1624 in wrapper                                                                                │
                    │                                                                                                                                                   │
                    │   1621 │   │   def wrapper(self, *args, **kwargs):                                                                                                │
                    │   1622 │   │   │   while True:                                                                                                                    │
                    │   1623 │   │   │   │   try:                                                                                                                       │
                    │ ❱ 1624 │   │   │   │   │   return func(self, *args, **kwargs)                                                                                     │
                    │   1625 │   │   │   │   except (CookieLoadError, DownloadCancelled, LazyList.IndexError,                                                           │
                    │        PagedList.IndexError):                                                                                                                     │
                    │   1626 │   │   │   │   │   raise                                                                                                                  │
                    │   1627 │   │   │   │   except ReExtractInfo as e:                                                                                                 │
                    │                                                                                                                                                   │
                    │ C:\Python310\lib\site-packages\yt_dlp\YoutubeDL.py:1759 in __extract_info                                                                         │
                    │                                                                                                                                                   │
                    │   1756 │   │   self._apply_header_cookies(url)                                                                                                    │
                    │   1757 │   │                                                                                                                                      │
                    │   1758 │   │   try:                                                                                                                               │
                    │ ❱ 1759 │   │   │   ie_result = ie.extract(url)                                                                                                    │
                    │   1760 │   │   except UserNotLive as e:                                                                                                           │
                    │   1761 │   │   │   if process:                                                                                                                    │
                    │   1762 │   │   │   │   if self.params.get('wait_for_video'):                                                                                      │
                    │                                                                                                                                                   │
                    │ C:\Python310\lib\site-packages\yt_dlp\extractor\common.py:739 in extract                                                                          │
                    │                                                                                                                                                   │
                    │    736 │   │   try:                                                                                                                               │
                    │    737 │   │   │   for _ in range(2):                                                                                                             │
                    │    738 │   │   │   │   try:                                                                                                                       │
                    │ ❱  739 │   │   │   │   │   self.initialize()                                                                                                      │
                    │    740 │   │   │   │   │   self.to_screen('Extracting URL: %s' % (                                                                                │
                    │    741 │   │   │   │   │   │   url if self.get_param('verbose') else truncate_string(url, 100,                                                    │
                    │        20)))                                                                                                                                      │
                    │    742 │   │   │   │   │   ie_result = self._real_extract(url)                                                                                    │
                    │                                                                                                                                                   │
                    │ C:\Python310\lib\site-packages\yt_dlp\extractor\common.py:648 in initialize                                                                       │
                    │                                                                                                                                                   │
                    │    645 │   │   │   │   │   self._perform_login(username, password)                                                                                │
                    │    646 │   │   │   elif self.get_param('username') and False not in (self.IE_DESC,                                                                │
                    │        self._NETRC_MACHINE):                                                                                                                      │
                    │    647 │   │   │   │   self.report_warning(f'Login with password is not supported for this                                                        │
                    │        website. {self._login_hint("cookies")}')                                                                                                   │
                    │ ❱  648 │   │   │   self._real_initialize()                                                                                                        │
                    │    649 │   │   │   self._ready = True                                                                                                             │
                    │    650 │                                                                                                                                          │
                    │    651 │   def _initialize_geo_bypass(self, geo_bypass_context):                                                                                  │
                    │                                                                                                                                                   │
                    │ C:\Python310\lib\site-packages\yt_dlp\extractor\youtube.py:571 in _real_initialize                                                                │
                    │                                                                                                                                                   │
                    │    568 │   │   self._set_cookie('.youtube.com', name='PREF',                                                                                      │
                    │        value=urllib.parse.urlencode(pref))                                                                                                        │
                    │    569 │                                                                                                                                          │
                    │    570 │   def _real_initialize(self):                                                                                                            │
                    │ ❱  571 │   │   self._initialize_pref()                                                                                                            │
                    │    572 │   │   self._initialize_consent()                                                                                                         │
                    │    573 │   │   self._check_login_required()                                                                                                       │
                    │    574                                                                                                                                            │
                    │                                                                                                                                                   │
                    │ C:\Python310\lib\site-packages\yt_dlp\extractor\youtube.py:559 in _initialize_pref                                                                │
                    │                                                                                                                                                   │
                    │    556 │   │   self._set_cookie('.youtube.com', 'SOCS', 'CAI', secure=True)  # accept all                                                         │
                    │        (required for mixes)                                                                                                                       │
                    │    557 │                                                                                                                                          │
                    │    558 │   def _initialize_pref(self):                                                                                                            │
                    │ ❱  559 │   │   cookies = self._get_cookies('https://www.youtube.com/')                                                                            │
                    │    560 │   │   pref_cookie = cookies.get('PREF')                                                                                                  │
                    │    561 │   │   pref = {}                                                                                                                          │
                    │    562 │   │   if pref_cookie:                                                                                                                    │
                    │                                                                                                                                                   │
                    │ C:\Python310\lib\site-packages\yt_dlp\extractor\common.py:3604 in _get_cookies                                                                    │
                    │                                                                                                                                                   │
                    │   3601 │                                                                                                                                          │
                    │   3602 │   def _get_cookies(self, url):                                                                                                           │
                    │   3603 │   │   """ Return a http.cookies.SimpleCookie with the cookies for the url """                                                            │
                    │ ❱ 3604 │   │   return LenientSimpleCookie(self._downloader.cookiejar.get_cookie_header(url))                                                      │
                    │   3605 │                                                                                                                                          │
                    │   3606 │   def _apply_first_set_cookie_header(self, url_handle, cookie):                                                                          │
                    │   3607 │   │   """                                                                                                                                │
                    │                                                                                                                                                   │
                    │ C:\Python310\lib\functools.py:981 in __get__                                                                                                      │
                    │                                                                                                                                                   │
                    │   978 │   │   │   │   # check if another thread filled cache while we awaited lock                                                                │
                    │   979 │   │   │   │   val = cache.get(self.attrname, _NOT_FOUND)                                                                                  │
                    │   980 │   │   │   │   if val is _NOT_FOUND:                                                                                                       │
                    │ ❱ 981 │   │   │   │   │   val = self.func(instance)                                                                                               │
                    │   982 │   │   │   │   │   try:                                                                                                                    │
                    │   983 │   │   │   │   │   │   cache[self.attrname] = val                                                                                          │
                    │   984 │   │   │   │   │   except TypeError:                                                                                                       │
                    │                                                                                                                                                   │
                    │ C:\Python310\lib\site-packages\yt_dlp\YoutubeDL.py:4112 in cookiejar                                                                              │
                    │                                                                                                                                                   │
                    │   4109 │   │   except CookieLoadError as error:                                                                                                   │
                    │   4110 │   │   │   cause = error.__context__                                                                                                      │
                    │   4111 │   │   │   # compat: <=py3.9: `traceback.format_exception` has a different signature                                                      │
                    │ ❱ 4112 │   │   │   self.report_error(str(cause), tb=''.join(traceback.format_exception(None,                                                      │
                    │        cause, cause.__traceback__)))                                                                                                              │
                    │   4113 │   │   │   raise                                                                                                                          │
                    │   4114 │                                                                                                                                          │
                    │   4115 │   @property                                                                                                                              │
                    │                                                                                                                                                   │
                    │ C:\Python310\lib\site-packages\yt_dlp\YoutubeDL.py:1090 in report_error                                                                           │
                    │                                                                                                                                                   │
                    │   1087 │   │   Do the same as trouble, but prefixes the message with 'ERROR:', colored                                                            │
                    │   1088 │   │   in red if stderr is a tty file.                                                                                                    │
                    │   1089 │   │   """                                                                                                                                │
                    │ ❱ 1090 │   │   self.trouble(f'{self._format_err("ERROR:", self.Styles.ERROR)} {message}',                                                         │
                    │        *args, **kwargs)                                                                                                                           │
                    │   1091 │                                                                                                                                          │
                    │   1092 │   def write_debug(self, message, only_once=False):                                                                                       │
                    │   1093 │   │   """Log debug message or Print message to stderr"""                                                                                 │
                    │                                                                                                                                                   │
                    │ C:\Python310\lib\site-packages\yt_dlp\YoutubeDL.py:1009 in trouble                                                                                │
                    │                                                                                                                                                   │
                    │   1006 │   │   @param is_error    Whether to raise error according to ignorerrors                                                                 │
                    │   1007 │   │   """                                                                                                                                │
                    │   1008 │   │   if message is not None:                                                                                                            │
                    │ ❱ 1009 │   │   │   self.to_stderr(message)                                                                                                        │
                    │   1010 │   │   if self.params.get('verbose'):                                                                                                     │
                    │   1011 │   │   │   if tb is None:                                                                                                                 │
                    │   1012 │   │   │   │   if sys.exc_info()[0]:  # if .trouble has been called from an except                                                        │
                    │        block                                                                                                                                      │
                    │                                                                                                                                                   │
                    │ C:\Python310\lib\site-packages\yt_dlp\YoutubeDL.py:949 in to_stderr                                                                               │
                    │                                                                                                                                                   │
                    │    946 │   │   """Print message to stderr"""                                                                                                      │
                    │    947 │   │   assert isinstance(message, str)                                                                                                    │
                    │    948 │   │   if self.params.get('logger'):                                                                                                      │
                    │ ❱  949 │   │   │   self.params['logger'].error(message)                                                                                           │
                    │    950 │   │   else:                                                                                                                              │
                    │    951 │   │   │   self._write_string(f'{self._bidi_workaround(message)}\n',                                                                      │
                    │        self._out_files.error, only_once=only_once)                                                                                                │
                    │    952                                                                                                                                            │
                    │                                                                                                                                                   │
                    │ C:\Python310\lib\site-packages\spotdl\providers\audio\base.py:57 in error                                                                         │
                    │                                                                                                                                                   │
                    │    54 │   │   YTDL uses this to print errors.                                                                                                     │
                    │    55 │   │   """                                                                                                                                 │
                    │    56 │   │                                                                                                                                       │
                    │ ❱  57 │   │   raise AudioProviderError(msg)                                                                                                       │
                    │    58                                                                                                                                             │
                    │    59                                                                                                                                             │
                    │    60 ISRC_REGEX = re.compile(r"^[A-Z]{2}-?\w{3}-?\d{2}-?\d{5}$")                                                                                 │
                    ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
                    AudioProviderError: ERROR: _parse_browser_specification() takes from 1 to 4 positional arguments but 7 were given

                    The above exception was the direct cause of the following exception:

                    ╭──────────────────────────────────────────────────────── Traceback (most recent call last) ────────────────────────────────────────────────────────╮
                    │ C:\Python310\lib\site-packages\spotdl\download\downloader.py:697 in search_and_download                                                           │
                    │                                                                                                                                                   │
                    │   694 │   │   │   │   display_progress_tracker.yt_dlp_progress_hook                                                                               │
                    │   695 │   │   │   )                                                                                                                               │
                    │   696 │   │   │                                                                                                                                   │
                    │ ❱ 697 │   │   │   download_info = audio_downloader.get_download_metadata(                                                                         │
                    │   698 │   │   │   │   download_url, download=True                                                                                                 │
                    │   699 │   │   │   )                                                                                                                               │
                    │   700                                                                                                                                             │
                    │                                                                                                                                                   │
                    │ C:\Python310\lib\site-packages\spotdl\providers\audio\base.py:396 in get_download_metadata                                                        │
                    │                                                                                                                                                   │
                    │   393 │   │   │   │   return data                                                                                                                 │
                    │   394 │   │   except Exception as exception:                                                                                                      │
                    │   395 │   │   │   logger.debug(exception)                                                                                                         │
                    │ ❱ 396 │   │   │   raise AudioProviderError(f"YT-DLP download error - {url}") from exception                                                       │
                    │   397 │   │                                                                                                                                       │
                    │   398 │   │   raise AudioProviderError(f"No metadata found for the provided url {url}")                                                           │
                    │   399                                                                                                                                             │
                    ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
                    AudioProviderError: YT-DLP download error - https://music.youtube.com/watch?v=Dpl-Xgz1dKU
[16:48:03] ERROR    MainThread - https://open.spotify.com/track/5Ps9XMq4PDMDCNnp4JfYiI - AudioProviderError: YT-DLP download error -                                            downloader.py:303
                    https://music.youtube.com/watch?v=Dpl-Xgz1dKU
[16:48:03] INFO     MainThread - Saved errors to errors.txt                                                                                                                     downloader.py:316
[16:48:03] INFO     MainThread - Saved archive with 0 urls to archive.json                                                                                                      downloader.py:325
[16:48:03] INFO     MainThread - Saved results to metadata.spotdl                                                                                                               downloader.py:354
[16:48:03] DEBUG    MainThread - Took 5 seconds                   

Other details

Was trying to use a cookies.txt file before this, but the cookies appear to expire after five minutes, so quality silently drops to 128kbit.

@jessicah jessicah added the Bug Unexpected problem or unintended behavior that needs to be fixed label Nov 22, 2024
@jessicah
Copy link
Author

It appears that yt-dlp is expecting a tuple, but receiving a string, and treats each character as a new keyword argument.

Was able to manually workaround the issue by adding the following in args_to_ytdlp_options:

v = vars(new_args[0])
v['cookiesfrombrowser'] = ('firefox',)

Not sure if this is an issue on spotDL's side, or yt-dlp's side.

@xnetcat
Copy link
Member

xnetcat commented Nov 23, 2024

It appears that yt-dlp is expecting a tuple, but receiving a string, and treats each character as a new keyword argument.

Was able to manually workaround the issue by adding the following in args_to_ytdlp_options:


v = vars(new_args[0])

v['cookiesfrombrowser'] = ('firefox',)

Not sure if this is an issue on spotDL's side, or yt-dlp's side.

Looks like spotdl issue. If you want I can merge a PR with a fix from you. Otherwise I will fix it soon.

@jessicah
Copy link
Author

I think this is yt-dlp's issue: yt-dlp/yt-dlp#10196 (comment)

jessicah added a commit to jessicah/spotify-downloader that referenced this issue Nov 28, 2024
As mentioned in yt-dlp/yt-dlp#10196,
`yt_dlp.parse_options` should be used for parsing command line flags.

However, as this API doesn't take in a set of configured options, the
defaults handling is a little bit messier. Basically checks for any
non-default values after parsing the command line flags, and skips
setting them from the `defaults` dictionary.

This fixes spotDL#2242.
@jessicah jessicah linked a pull request Nov 28, 2024 that will close this issue
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Unexpected problem or unintended behavior that needs to be fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants