sdushantha / kunst

Download and display album art or display embedded album art
MIT License
310 stars 28 forks source link

Kunst cannot find any album art online #36

Closed gipert closed 4 years ago

gipert commented 4 years ago

Hello there!

Kunst was practically not able to find any album art online, so I started looking at the source. I noticed that if I ask api.deezer.com for "Jon Hassell - Viva Sohona" I get the following JSON:

$ curl -s "$API_URL" | jq
{
  "tracks": {
    "data": [
      {
        "id": 904217522,
        "readable": true,
        "title": "Viva Shona",
        "title_short": "Viva Shona",
        "title_version": "",
        "link": "https://www.deezer.com/track/904217522",
        "duration": 425,
        "rank": 109378,
        "explicit_lyrics": false,
        "explicit_content_lyrics": 0,
        "explicit_content_cover": 2,
        "preview": "https://cdns-preview-6.dzcdn.net/stream/c-64d271133c6ba5ca9029a4ab1bbb97c8-3.mp3",
        "artist": {
          "id": 78614,
          "name": "Jon Hassell",
          "link": "https://www.deezer.com/artist/78614",
          "picture": "https://api.deezer.com/artist/78614/image",
          "picture_small": "https://cdns-images.dzcdn.net/images/artist/16fcc0fe93055b0127d02ecb2c2a5b4a/56x56-000000-80-0-0.jpg",
          "picture_medium": "https://cdns-images.dzcdn.net/images/artist/16fcc0fe93055b0127d02ecb2c2a5b4a/250x250-000000-80-0-0.jpg",
          "picture_big": "https://cdns-images.dzcdn.net/images/artist/16fcc0fe93055b0127d02ecb2c2a5b4a/500x500-000000-80-0-0.jpg",
          "picture_xl": "https://cdns-images.dzcdn.net/images/artist/16fcc0fe93055b0127d02ecb2c2a5b4a/1000x1000-000000-80-0-0.jpg",
          "tracklist": "https://api.deezer.com/artist/78614/top?limit=50",
          "type": "artist"
        },
        "album": {
          "id": 136520012,
          "title": "Vernal Equinox (Remastered)",
          "cover": "https://api.deezer.com/album/136520012/image",
          "cover_small": "https://cdns-images.dzcdn.net/images/cover/632f19ddec62e5c10e630138cd8eceba/56x56-000000-80-0-0.jpg",
          "cover_medium": "https://cdns-images.dzcdn.net/images/cover/632f19ddec62e5c10e630138cd8eceba/250x250-000000-80-0-0.jpg",
          "cover_big": "https://cdns-images.dzcdn.net/images/cover/632f19ddec62e5c10e630138cd8eceba/500x500-000000-80-0-0.jpg",
          "cover_xl": "https://cdns-images.dzcdn.net/images/cover/632f19ddec62e5c10e630138cd8eceba/1000x1000-000000-80-0-0.jpg",
          "tracklist": "https://api.deezer.com/album/136520012/tracks",
          "type": "album"
        },
        "type": "track"
      },
      {
        "id": 437135022,
        "readable": true,
        "title": "Viva Shona",
        "title_short": "Viva Shona",
        "title_version": "",
        "link": "https://www.deezer.com/track/437135022",
        "duration": 428,
        "rank": 124406,
        "explicit_lyrics": false,
        "explicit_content_lyrics": 0,
        "explicit_content_cover": 2,
        "preview": "https://cdns-preview-a.dzcdn.net/stream/c-ace0381c4deb7ad2581a3ca3c3e0338a-4.mp3",
        "artist": {
          "id": 78614,
          "name": "Jon Hassell",
          "link": "https://www.deezer.com/artist/78614",
          "picture": "https://api.deezer.com/artist/78614/image",
          "picture_small": "https://cdns-images.dzcdn.net/images/artist/fa1444ca3abda89ebbaca1505f5f232b/56x56-000000-80-0-0.jpg",
          "picture_medium": "https://cdns-images.dzcdn.net/images/artist/fa1444ca3abda89ebbaca1505f5f232b/250x250-000000-80-0-0.jpg",
          "picture_big": "https://cdns-images.dzcdn.net/images/artist/fa1444ca3abda89ebbaca1505f5f232b/500x500-000000-80-0-0.jpg",
          "picture_xl": "https://cdns-images.dzcdn.net/images/artist/fa1444ca3abda89ebbaca1505f5f232b/1000x1000-000000-80-0-0.jpg",
          "tracklist": "https://api.deezer.com/artist/78614/top?limit=50",
          "type": "artist"
        },
        "album": {
          "id": 52861552,
          "title": "Vernal Equinox",
          "cover": "https://api.deezer.com/album/52861552/image",
          "cover_small": "https://cdns-images.dzcdn.net/images/cover/f93aae93407edfb86df6eb7e1e6104f9/56x56-000000-80-0-0.jpg",
          "cover_medium": "https://cdns-images.dzcdn.net/images/cover/f93aae93407edfb86df6eb7e1e6104f9/250x250-000000-80-0-0.jpg",
          "cover_big": "https://cdns-images.dzcdn.net/images/cover/f93aae93407edfb86df6eb7e1e6104f9/500x500-000000-80-0-0.jpg",
          "cover_xl": "https://cdns-images.dzcdn.net/images/cover/f93aae93407edfb86df6eb7e1e6104f9/1000x1000-000000-80-0-0.jpg",
          "tracklist": "https://api.deezer.com/album/52861552/tracks",
          "type": "album"
        },
        "type": "track"
      }
    ]
  },
  "albums": {
    "data": []
  },
  "artists": {
    "data": []
  },
  "playlists": {
    "data": []
  },
  "podcasts": {
    "data": []
  },
  "radios": {
    "data": []
  },
  "total": 2
}

Which has an empty playlists.data field. The right album cover URL can be extracted with e.g.

$ curl -s "$API_URL" | jq -r '.tracks.data[0].album.cover_big'

I'm definitely not a deezer.com API connoisseur, has it changed lately?

sdushantha commented 4 years ago

@gipert Fixed it! Seems like Deezer changed their API a little. Also, thanks for the jq command :)