fix: 兼容最新接口服务
This commit is contained in:
parent
e2464dc7fe
commit
11568ef46e
|
@ -1,5 +1,5 @@
|
|||
from unittest import result
|
||||
import uuid, time, json, os, random, aiohttp
|
||||
import uuid, time, json, os, hashlib, aiohttp
|
||||
from urllib.parse import quote
|
||||
from homeassistant.helpers.network import get_url
|
||||
from .http_api import http_get, http_cookie
|
||||
|
@ -14,6 +14,9 @@ from .browse_media import (
|
|||
async_media_next_track
|
||||
)
|
||||
|
||||
def md5(data):
|
||||
return hashlib.md5(data.encode('utf-8')).hexdigest()
|
||||
|
||||
class CloudMusic():
|
||||
|
||||
def __init__(self, hass, url) -> None:
|
||||
|
@ -46,7 +49,7 @@ class CloudMusic():
|
|||
else:
|
||||
login_url = login_url + '/cellphone?phone='
|
||||
|
||||
data = await http_cookie(login_url + f'{quote(username)}&password={quote(password)}')
|
||||
data = await http_cookie(login_url + f'{quote(username)}&password={quote(password)}&md5_password={md5(password)}')
|
||||
res_data = data.get('data', {})
|
||||
# 登录成功
|
||||
if res_data.get('code') == 200:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"domain": "ha_cloud_music",
|
||||
"name": "\u4E91\u97F3\u4E50",
|
||||
"version": "2023.2.3",
|
||||
"version": "2023.2.22",
|
||||
"config_flow": true,
|
||||
"documentation": "https://github.com/shaonianzhentan/ha_cloud_music",
|
||||
"requirements": [],
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"error": {}
|
||||
"error": {
|
||||
"login_failed": "登录失败"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue