Skip to content

A REST API web server built in Go with endpoints for viewing your Friend's Spotify activity!

License

Notifications You must be signed in to change notification settings

nathanjukes/GoTify-Profile-Tracker

Repository files navigation

GoTify Profile Tracker (Backend)

A REST API web server built in Go with endpoints for viewing your Friend's Spotify activity!

Uses my Go package Spotify-BuddyList for grabbing the data!

What is it & why?

GoTify is a collection of Spotify utilities written in Go by myself. GoTify Profile Tracker is a REST API web server that provides an implementation of my GoTify BuddyList package and scales up past the Spotify endpoints to retain large sets of data. The main use of this API is to view the listening activity of your friends in a well-formatted manner, there is also a frontend Vue.js application attached to this that utilises the API.

Example Queries

Example Response

Array containing this object:

{
   "timestamp":1630585689720,
   "time":"2021-09-02T13:28:09.72+01:00",
   "user_id":"spotify:user:21dnoih5aa7vkozsvczwoe4za",
   "user":{
      "uri":"spotify:user:21dnoih5aa7vkozsvczwoe4za",
      "name":"Lars.On.Spotify",
      "imageUrl":"https://platform-lookaside.fbsbx.com/platform/profilepic/?asid=541218032718353&height=50&width=50&ext=1632658424&hash=AeQSx5CUG26hrnhmIXA"
   },
   "track_id":"spotify:track:7yq4Qj7cqayVTp3FF9CWbm",
   "track":{
      "uri":"spotify:track:7yq4Qj7cqayVTp3FF9CWbm",
      "name":"Riptide",
      "imageUrl":"http://i.scdn.co/image/ab67616d0000b273d3ce97395ff522b0d70c1094",
      "album_id":"spotify:album:6rIbiUMmZJfqJRnXhVxFvg",
      "album":{
         "uri":"spotify:album:6rIbiUMmZJfqJRnXhVxFvg",
         "name":"Dream Your Life Away"
      },
      "artist_id":"spotify:artist:10exVja0key0uqUkk6LJRT",
      "artist":{
         "uri":"spotify:artist:10exVja0key0uqUkk6LJRT",
         "name":"Vance Joy"
      }
   }
}

Example Response

Array containing this object:

{
   "timestamp":1630585689720,
   "time":"2021-09-02T13:28:09.72+01:00",
   "user_id":"spotify:user:21dnoih5aa7vkozsvczwoe4za",
   "user":{
      "uri":"spotify:user:21dnoih5aa7vkozsvczwoe4za",
      "name":"Lars.On.Spotify",
      "imageUrl":"https://platform-lookaside.fbsbx.com/platform/profilepic/?asid=541218032718353&height=50&width=50&ext=1632658424&hash=AeQSx5CUG26hrnhmIXA"
   },
   "track_id":"spotify:track:7yq4Qj7cqayVTp3FF9CWbm",
   "track":{
      "uri":"spotify:track:7yq4Qj7cqayVTp3FF9CWbm",
      "name":"Riptide",
      "imageUrl":"http://i.scdn.co/image/ab67616d0000b273d3ce97395ff522b0d70c1094",
      "album_id":"spotify:album:6rIbiUMmZJfqJRnXhVxFvg",
      "album":{
         "uri":"spotify:album:6rIbiUMmZJfqJRnXhVxFvg",
         "name":"Dream Your Life Away"
      },
      "artist_id":"spotify:artist:10exVja0key0uqUkk6LJRT",
      "artist":{
         "uri":"spotify:artist:10exVja0key0uqUkk6LJRT",
         "name":"Vance Joy"
      }
   }
}

Personal use

Environment Variables needed

To set the environment variables, insert them into the init() method of the main.go file

  • 'Cookie' - sd_pc cookie from Spotify's Web Player

    • After you log into the Spotify web player, you need to find the cookie named 'sp_dc' and get the value of it
    • This cookie expires every year, so if used in production, it will be best to automate the collection of it
  • 'Client ID' - Follow the 'Register your App' tutorial here!

  • 'Client Secret' - Follow the 'Register your App' tutorial here!

  • 'Access Token' - Follow this: Link!. Once you have the Access and Refresh token, insert them into the init() method. Be sure to request the 'user-follow-modify' scope.

  • 'Refresh Token' - Follow this: Link!. Once you have the Access and Refresh token, insert them into the init() method. Be sure to request the 'user-follow-modify' scope.

Change Log

  • Released 28/08/21

License

MIT

About

A REST API web server built in Go with endpoints for viewing your Friend's Spotify activity!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published