changes include: allow GET endpoints, redirect to codey.lol instead of returning status 422, clean junk from ai endpoint, add misc endpoint, add methods to lyric_search_new.sources.cache, other misc/cleanup
This commit is contained in:
@@ -110,16 +110,13 @@ class LastFM:
|
||||
async with session.get(f"{self.api_base_url}artist.gettopalbums&artist={artist}&api_key={self.creds.get('key')}&autocorrect=1&format=json",
|
||||
timeout=ClientTimeout(connect=3, sock_read=8)) as request:
|
||||
assert request.status in [200, 204]
|
||||
# return request.text
|
||||
data = await request.json()
|
||||
data = data.get('topalbums').get('album')
|
||||
# print(f"Data:\n{data}")
|
||||
retObj = [
|
||||
{
|
||||
'title': item.get('name')
|
||||
} for item in data if not(item.get('name').lower() == "(null)") and int(item.get('playcount')) >= 50
|
||||
]
|
||||
# # print(f"Keys: {data[0].keys()}")
|
||||
return retObj
|
||||
except:
|
||||
traceback.print_exc()
|
||||
|
||||
Reference in New Issue
Block a user