Giter VIP home page Giter VIP logo

worker-spotify's Introduction

worker-spotify

Deploy to Cloudflare Workers

This template is a simple Spotify Web API wrapper for Cloudflare Workers. It returns the currently playing song on Spotify. You can use it to display the currently playing song on your website.

src/index.ts is the content of the Workers script.

Here is an example of the response to the script:

{
  "isPlaying": true,
  "name": "The Less I Know The Better",
  "artist": "Tame Impala",
  "album": "Currents",
  "url": "https://open.spotify.com/track/6K4t31amVTZDgR3sKmwUJJ",
  "cover": "https://i.scdn.co/image/ab67616d0000b2739e1cfc756886ac782e363d79"
}

Setup

To create a worker-spotify directory using this template, run:

$ npx wrangler generate worker-spotify https://github.com/denizcdemirci/worker-spotify
# or
$ yarn wrangler generate worker-spotify https://github.com/denizcdemirci/worker-spotify
# or
$ pnpm wrangler generate worker-spotify https://github.com/denizcdemirci/worker-spotify

This template requires a Spotify app. Instructions for setting up a Spotify app can be found in this documentation.

Before publishing your script, you need to edit the wrangler.toml file. Add your Spotify app's CLIENT_ID, CLIENT_SECRET and REFRESH_TOKEN to this file. More information about configuring and publishing your script can be found in the documentation.

Once you are ready, you can publish your script by running the following command:

$ npm run deploy
# or
$ yarn run deploy
# or
$ pnpm run deploy

Notes

Your Spotify app must have the user-read-currently-playing and user-read-recently-played scopes.

Note that Spotify imposes rate limits on API calls. If there is an application that will receive a lot of requests, you need to add cache for this template.

worker-spotify's People

Contributors

denizcdemirci avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.