steal some of @tcsenpai 's changes from the PR

+ ditch the LAST FM API KEY thing
+ expose the Musixmatch urls
+ use the kerve last fm api to download similar artist data
+ use google.it instead of the Google public dns to check internet connectivity (to make it work in all environments)
+ return og Dockerfile to fix ARM support
This commit is contained in:
mungai-njoroge
2024-02-16 23:57:23 +03:00
parent 4f48c33009
commit 67f28b8a9b
11 changed files with 136 additions and 69 deletions
+2 -2
View File
@@ -14,7 +14,7 @@ def fetch_similar_artists(name: str):
"""
Fetches similar artists from Last.fm
"""
url = f"https://ws.audioscrobbler.com/2.0/?method=artist.getsimilar&artist={urllib.parse.quote_plus(name, safe='')}&api_key={settings.Keys.LASTFM_API_KEY}&format=json&limit=250"
url = f"https://kerve.last.fm/kerve/similarartists?artist={urllib.parse.quote_plus(name, safe='')}&autocorrect=1&tracks=1&image_size=large&limit=250&format=json"
try:
response = requests.get(url, timeout=10)
@@ -25,7 +25,7 @@ def fetch_similar_artists(name: str):
data = response.json()
try:
artists = data["similarartists"]["artist"]
artists = data["results"]["artist"]
except KeyError:
return []