This commit is contained in:
@@ -43,6 +43,12 @@ def yt_cover(youtube_url):
|
||||
return f"https://img.youtube.com/vi/{video_id}/2.jpg"
|
||||
|
||||
def parse_listens(json: dict) -> dict:
|
||||
cover_replacing = {
|
||||
"1e699948-c7c8-4bb2-9f8b-62e14b882a5d": "ca464c1d-5848-45bb-b92d-b1e4b00f9d65",
|
||||
"0d516a93-061e-4a27-9cf7-f36e3a96f888": "5cc0c0c7-22f9-4a4b-a24c-f1a6732f813b",
|
||||
"92ea5cc8-80e0-4da0-a10b-1bc2f8e8781e": "e8f3e14a-4794-4bab-b403-d562cdad4c2f",
|
||||
}
|
||||
|
||||
new_json = {
|
||||
"count": json["count"],
|
||||
"listens": []
|
||||
@@ -59,7 +65,11 @@ def parse_listens(json: dict) -> dict:
|
||||
}
|
||||
|
||||
if mb := track.get("mbid_mapping"):
|
||||
new_track["id"] = mb.get("caa_release_mbid", mb["release_mbid"])
|
||||
new_track["id"] = \
|
||||
cover_replacing.get(mb["release_mbid"],
|
||||
mb.get("caa_release_mbid",
|
||||
mb["release_mbid"]
|
||||
))
|
||||
new_track["artist_name"] = mb["artists"][0]["artist_credit_name"]
|
||||
new_track["track_name"] = mb["recording_name"]
|
||||
elif info := track.get("additional_info"):
|
||||
|
||||
Reference in New Issue
Block a user