mirror of
https://github.com/sigma67/ytmusicapi.git
synced 2026-04-26 07:46:00 +03:00
[GH-ISSUE #474] Error with Oauth #354
Labels
No labels
a/b
bug
documentation
enhancement
good first issue
help wanted
invalid
pull-request
question
wontfix
yt-error
yt-update
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ytmusicapi#354
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @oraqol on GitHub (Nov 21, 2023).
Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/474
Describe the bug
When using ytmusicapi in I enter point the parameter to the oath.json file that I generated using 'ytmusicapi oauth'. I receive the following error:
"Traceback (most recent call last):
File "/home/user/yt_music/yt_pub_dupe.py", line 9, in
yt = YTMusic('/etc/yt_music/oauth.json')
File "/usr/local/lib/python3.8/dist-packages/ytmusicapi/ytmusic.py", line 124, in init
self.sapisid = sapisid_from_cookie(cookie)
File "/usr/local/lib/python3.8/dist-packages/ytmusicapi/helpers.py", line 81, in sapisid_from_cookie
cookie.load(raw_cookie)
File "/usr/lib/python3.8/http/cookies.py", line 532, in load
for key, value in rawdata.items():
AttributeError: 'NoneType' object has no attribute 'items'"
This is a redacted version of the generated oauth.json file:
"{
"access_token": "XXXX",
"expires_in": "XXX",
"refresh_token": "XXXX",
"scope": "https://www.googleapis.com/auth/youtube",
"token_type": "Bearer",
"expires_at": "XXXX"
}"
This is how I call the python module with the oauth.json file:
"#!/bin/env python
from ytmusicapi import YTMusic
import json
import os
import subprocess
import time
yt = YTMusic('/etc/yt_music/oauth.json')"
To Reproduce
Steps to reproduce the behavior:
Additional context
At first, the 'ytmusicapi oath' command generates a file that has certain numerical config parameters without surrounding quotes, I added the quotes and got the above error. The errors that occur before adding the quotes can be found below:
"requests.exceptions.InvalidHeader: Value for header {expires_in: 60355} must be of type str or bytes, not <class 'int'>
and
requests.exceptions.InvalidHeader: Value for header {expires_at: 1700610566} must be of type str or bytes, not <class 'int'>"
@sigma67 commented on GitHub (Dec 11, 2023):
Please state how you solved the issue in case anyone else stumbles upon it