Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[New Connection] Spotify #175

Open
tahpot opened this issue Nov 7, 2024 · 6 comments · May be fixed by #190
Open

[New Connection] Spotify #175

tahpot opened this issue Nov 7, 2024 · 6 comments · May be fixed by #190
Assignees

Comments

@tahpot
Copy link
Member

tahpot commented Nov 7, 2024

Key information:

  • Profile
  • Playlists
  • Listening history
  • Friends / connections

@chime3 What other data is available?

@tahpot tahpot changed the title [New Handler] Spotify [New Connection] Spotify Nov 7, 2024
@chime3
Copy link
Member

chime3 commented Nov 15, 2024

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"
}
  1. 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"
    }
  ]
}
  1. 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"
    }
  ]
}
  1. 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

  • Are any additional data schemas required for Verida?
  • If we want to track listening (or watch history for YouTube), is there a specific schema for that? @tahpot

@tahpot
Copy link
Member Author

tahpot commented Nov 18, 2024

Libraries:

@tahpot
Copy link
Member Author

tahpot commented Nov 19, 2024

We should extract the following information and place into our schemas

  • profile
  • playlist
  • history (new schema) -- Recently played items
  • following -- Followed artists
  • favorite -- User's top Artists and Items

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.

@chime3 chime3 linked a pull request Dec 1, 2024 that will close this issue
@chime3 chime3 linked a pull request Dec 1, 2024 that will close this issue
@chime3
Copy link
Member

chime3 commented Dec 2, 2024

@chime3
Copy link
Member

chime3 commented Dec 11, 2024

https://github.com/spotify/spotify-web-api-ts-sdk

Reverted to use original spotify-api-sdk package as I noticed that the above SDK has not been updated in over a year and doesn't support the features we are looking to implement now.

Ref: https://www.npmjs.com/package/spotify-api-sdk/v/1.0.0, https://spotify-poc.pages.dev/

@tahpot
Copy link
Member Author

tahpot commented Dec 23, 2024

@chime3 to make changes to unit tests based on Spotify feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants