verida / data-connector-server

1 stars 2 forks source link

[New Connection] Spotify #175

Open tahpot opened 2 weeks ago

tahpot commented 2 weeks ago

Key information:

@chime3 What other data is available?

chime3 commented 1 week ago

Overview

Spotify supports SSO, including OAuth 2.0 authentication. It exposes a wide range of generic data APIs, but we will focus on user-specific APIs. Ref: Spotify Web API Documentation

Available Data Models

Track represents Spotify items like music, episode, podcast, audiobook etc

  1. Profile
  2. User's top Artists and Items It is something like user's favorite. Example:
    {
    "items": [
    {
      "name": "Track Name",
      "id": "track_id",
      "album": {
        "name": "Album Name",
        "images": [{ "url": "album-image-url.com" }]
      },
      "artists": [
        {
          "name": "Artist Name",
          "id": "artist_id"
        }
      ],
      "popularity": 80,
      "duration_ms": 210000,
      "explicit": false
    }
    ],
    "type": "track"
    }
  3. Playlists We can get playlists info, but I am not sure if it is worth to sync for Verida Example:
    {
    "items": [
    {
      "id": "playlist_id",
      "name": "Playlist Name",
      "description": "A cool playlist",
      "owner": {
        "display_name": "Owner Name",
        "id": "owner_id"
      },
      "tracks": {
        "total": 25
      },
      "images": [
        {
          "url": "playlist-image-url.com"
        }
      ],
      "public": true,
      "snapshot_id": "snapshot_id_string"
    }
    ]
    }
  4. Recently played Items It represents listening history, but has limitations: 50 items and past 24hours Example:
    {
    "items": [
    {
      "track": {
        "name": "Recently Played Track Name",
        "id": "track_id",
        "artists": [
          {
            "name": "Artist Name",
            "id": "artist_id"
          }
        ],
        "album": {
          "name": "Album Name",
          "images": [{ "url": "album-image-url.com" }]
        }
      },
      "played_at": "2023-05-01T10:30:00.000Z"
    }
    ]
    }
  5. Followed artists Artist's name and followers number, avatar, Spotify profile link are available.
    {
    "artists": {
    "items": [
      {
        "external_urls": {
          "spotify": "https://open.spotify.com/artist/{artist_id}"
        },
        "followers": {
          "href": null,
          "total": 1000000
        },
        "genres": [
          "pop",
          "rock"
        ],
        "href": "https://api.spotify.com/v1/artists/{artist_id}",
        "id": "{artist_id}",
        "images": [
          {
            "height": 640,
            "url": "https://i.scdn.co/image/{image_id}",
            "width": 640
          }
        ],
        "name": "Artist Name",
        "popularity": 80,
        "type": "artist",
        "uri": "spotify:artist:{artist_id}"
      }
    ]
    }
    }

    We can use the original following schema.

Issues

tahpot commented 1 week ago

Libraries:

tahpot commented 6 days ago

We should extract the following information and place into our schemas

Can you please do the following as next steps:

  1. Create a draft schema for history in schemas-common. This should be designed in such a way it can also be used for web browsing history
  2. Create a draft schema for playlist in schemas-common. This should be designed in such a way it can also be used for other playlists in the future (ie: youtube)
  3. In this issue, map our schema fields to the spotify fields for profile, playlist, following, favorite.