Исправлено получение плейлиста с алисой #185

このコミットが含まれているのは:
Il`ya 2020-01-21 15:13:44 +03:00
コミット e5fe2c79f9
1個のファイルの変更3行の追加2行の削除

ファイルの表示

@ -6,6 +6,7 @@ import builtins
# Отправка вообще application/x-www-form-urlencoded, а не JSON'a # Отправка вообще application/x-www-form-urlencoded, а не JSON'a
# https://github.com/psf/requests/blob/master/requests/models.py#L508 # https://github.com/psf/requests/blob/master/requests/models.py#L508
import json import json
from typing import Optional
import requests import requests
@ -16,7 +17,7 @@ from yandex_music.exceptions import Unauthorized, BadRequest, NetworkError, Yand
USER_AGENT = 'Yandex-Music-API' USER_AGENT = 'Yandex-Music-API'
HEADERS = { HEADERS = {
'X-Yandex-Music-Client': 'WindowsPhone/3.20', 'X-Yandex-Music-Client': 'YandexMusicAndroid/23020055',
} }
reserved_names = [name.lower() for name in dir(builtins)] + ['client'] reserved_names = [name.lower() for name in dir(builtins)] + ['client']
@ -76,7 +77,7 @@ class Request:
return cleaned_object return cleaned_object
def _parse(self, json_data) -> Response: def _parse(self, json_data) -> Optional[Response]:
try: try:
decoded_s = json_data.decode('utf-8') decoded_s = json_data.decode('utf-8')
data = json.loads(decoded_s, object_hook=Request._object_hook) data = json.loads(decoded_s, object_hook=Request._object_hook)