-
Notifications
You must be signed in to change notification settings - Fork 288
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
Support for Spotify #67
Comments
感谢~~ |
def get_access_token(client_id, client_secret, redirect_uri, code):
import requests
from base64 import urlsafe_b64encode
url = 'https://accounts.spotify.com/api/token'
form = {'grant_type': 'authorization_code', 'code': code, 'redirect_uri': redirect_uri}
authorization = f"Basic {urlsafe_b64encode(str.encode(f'{client_id}:{client_secret}')).decode()}"
r = requests.post(
url,
data = form,
json=True,
headers = {
"Authorization": authorization,
"Content-Type": 'application/x-www-form-urlencoded'
}
)
try:
assert(r.status_code == 200)
return r.json()['refresh_token']
except AssertionError as e:
print(r.status_code)
print(r.content)
refresh_token = get_access_token(client_id, client_secret, redirect_uri, code)
print(refresh_token)
README我就不改了,可以用这里的说明,晚点提pr |
看起来没问题。 |
@zjgcjy 感觉也可以把 song_name 存起来啊 |
是可以,但这个咋显示到poster上,要统计每首歌的次数吗,我记得有别的api可以获取一段时间的听歌量Top list 我自己的话因为用的比较多,后面打算直接用https://github.com/izayl/spotify-box 这个pin在首页好了😊 想起来两个问题, 第一是如果开启了 Private listening 应该是没有听歌记录的 第二是我不清楚Spotify能保存多久的记录,讲道理遍历链表可以拿到全部的,目前实现是只记录昨天一天,不支持 |
--year 2022 最好支持。如果能拿到 |
不展示哈哈。(和这个 repo 无关,就是觉得能完整记录自己听的歌挺有意思的 |
在写了,先占个坑,两种方式
The text was updated successfully, but these errors were encountered: