cleanup
This commit is contained in:
@@ -1,15 +1,19 @@
|
|||||||
import os
|
|
||||||
|
|
||||||
from yandex_music import Client
|
from yandex_music import Client
|
||||||
|
|
||||||
client = Client('AQAAAAAzqNkbAAG8XrWGNg9A5kCakiE_9HDst58').init()
|
client = Client('AQAAAAAzqNkbAAG8XrWGNg9A5kCakiE_9HDst58').init()
|
||||||
|
|
||||||
|
|
||||||
def search(_str: str, _type: str = 'all') -> dict:
|
def search(_str: str, _type: str = 'all') -> dict:
|
||||||
|
album_id = None
|
||||||
|
album_title = None
|
||||||
|
artist_id = None
|
||||||
|
artist_name = None
|
||||||
|
result_json = {}
|
||||||
|
|
||||||
search_result = client.search(_str, type_=_type)
|
search_result = client.search(_str, type_=_type)
|
||||||
type_ = search_result.best.type
|
type_ = search_result.best.type
|
||||||
best = search_result.best.result
|
best = search_result.best.result
|
||||||
# print(search_result)
|
|
||||||
if type_ == 'track':
|
if type_ == 'track':
|
||||||
artists = ''
|
artists = ''
|
||||||
if best.artists:
|
if best.artists:
|
||||||
@@ -18,9 +22,6 @@ def search(_str: str, _type: str = 'all') -> dict:
|
|||||||
for i in best.albums:
|
for i in best.albums:
|
||||||
album_id = i.id
|
album_id = i.id
|
||||||
album_title = i.title
|
album_title = i.title
|
||||||
else:
|
|
||||||
album_id = None
|
|
||||||
album_title = None
|
|
||||||
|
|
||||||
# Generate json for track
|
# Generate json for track
|
||||||
result_json = {
|
result_json = {
|
||||||
|
|||||||
Reference in New Issue
Block a user