Open lavish440 opened 3 months ago
Are you sure you copied the file correctly....check the contents of the file. It is working fine for me.
@arsaboo I am sure that I have copied the file correctly.
Here is the output of ls -lah ~/.config/beets
:
Here are the contents of the file:
{
"scope": "https://www.googleapis.com/auth/youtube",
"token_type": "Bearer",
"access_token": "access_token_value_here",
"refresh_token": "refresh_token_value_here",
"expires_at": 1716149989,
"expires_in": 86245
}
The token looks fine. Can you try manually adding quotes around expires_at
value?
I manually added quotes to both expires_in
and expires_at
but it still doesn't work.
Here is the traceback:
Traceback (most recent call last):
File "/data/data/com.termux/files/usr/bin/beet", line 8, in <module>
sys.exit(main())
^^^^^^
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/beets/ui/__init__.py", line 1301, in main
_raw_main(args)
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/beets/ui/__init__.py", line 1284, in _raw_main
subcommands, plugins, lib = _setup(options, lib)
^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/beets/ui/__init__.py", line 1150, in _setup
plugin_types_album = plugins.types(library.Album)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/beets/plugins.py", line 337, in types
for plugin in find_plugins():
^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/beets/plugins.py", line 307, in find_plugins
_instances[cls] = cls()
^^^^^
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/beetsplug/youtube.py", line 50, in __init__
self.yt = YTMusic(os.path.join(config.config_dir(), 'oauth.json'))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/ytmusicapi/ytmusic.py", line 127, in __init__
self.sapisid = sapisid_from_cookie(cookie)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/ytmusicapi/helpers.py", line 48, in sapisid_from_cookie
cookie.load(raw_cookie.replace("\"", ""))
^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'replace'
@arsaboo
I am still not able to replicate the bug.
How does the oauth.json
look for you?
{
"scope": "https://www.googleapis.com/auth/youtube",
"token_type": "Bearer",
"access_token": "ya29.REDACTED-tDgtiQQ0185",
"refresh_token": "1//01s52REDACTEDqdITUSw",
"expires_at": 1721469696,
"expires_in": 81339
}
Description
The application crashes with an
InvalidHeader
exception when trying to initialize thebeets-youtube
plugin. The error occurs because a header value is provided as aninteger
instead of astring
orbytes
.Steps to Reproduce
beets-youtube
plugin as suggested in theREADME
.oauth.json
using the commandytmusicapi oauth
.oauth.json
to$HOME/.config/beets/
.beet youtube
or try importing any album or single.Expected Behavior
The
beets-youtube
plugin should be initialized without errors andbeets
should continue to run.Actual Behavior
The application crashes with the following traceback:
Environment
1.6.1
3.11.9
Additional Information
It seems that the
expires_at
header value is being passed as aninteger
. This should be converted to astring
orbytes
before being used as a header.Suggested Fix
Ensure that the
expires_at
header value is of typestr
orbytes
before updating the headers inytmusicapi
.