Giter Club home page Giter Club logo

spotify-card's Introduction

Generate song embeds easily !

Preview

spotify-card

Table of Contents

About

This is a nodejs utility to generate song embeds using skia-canvas.

The package is named spotify-card because I wanted to only add spotify support at the beginning but I ended up adding support for other platforms.

Currently supported plaforms: Spotify, Soundcloud, Youtube and Deezer

Prerequisites

Installing

You can install this package from the npm registry

yarn add spotify-card

or with the npm cli:

npm install spotify-card

Usage

Example (typescript)

import { generate } from "spotify-card";
import path from "path";
import fs from "fs";

(async () => {
    const image = await generate({
        url: "spotify:track:33yAEqzKXexYM3WlOYtTfQ",
    });
    fs.writeFileSync(path.join(__dirname, "test_image.png"), image);
})();

spotify-card's People

Contributors

cestef avatar dependabot[bot] avatar ehsanfox avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

Forkers

ryzenix oojai

spotify-card's Issues

Update the NPM

Hey, I was testing the package, seems like you added support for youtube in the functions, but seems like that the package dist folder is from an old version, I don't know if you upload the dist folder manually to the npm package and publish it, but I would recommend you to not to and if you can fix it on npm too!

dist/index.js:
image

dist/functions.ts:
image

and yes, I doubled check the package version, it's the latest.

not installing

npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: request has been deprecated, see request/request#3142
npm ERR! code 1
npm ERR! git dep preparation failed
npm ERR! command C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js install --force --cache=C:\Users\HpRo\AppData\Local\npm-cache --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit --include=dev --include=peer --include=optional --no-package-lock-only --no-dry-run
npm ERR! npm WARN using --force Recommended protections disabled.
npm ERR! npm WARN old lockfile
npm ERR! npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm ERR! npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm ERR! npm WARN old lockfile
npm ERR! npm WARN old lockfile This is a one-time fix-up, please be patient...
npm ERR! npm WARN old lockfile
npm ERR! npm WARN deprecated [email protected]: Please update to ini >=1.3.6 to avoid a prototype pollution issue
npm ERR! npm WARN deprecated [email protected]: This is not needed anymore. Use require('os').homedir() instead.
npm ERR! npm WARN deprecated [email protected]: flatten is deprecated in favor of utility frameworks such as lodash.
npm ERR! npm WARN deprecated [email protected]: This module has been deprecated and is no longer maintained. Please use @rollup/plugin-buble.
npm ERR! npm WARN deprecated [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm ERR! npm WARN deprecated [email protected]: This module has moved and is now available at @rollup/plugin-alias. Please update your dependencies. This version is no longer maintained.
npm ERR! npm WARN deprecated [email protected]: This module has been deprecated and is no longer maintained. Please use @rollup/plugin-json.
npm ERR! npm WARN deprecated [email protected]: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-node-resolve.
npm ERR! npm WARN deprecated [email protected]: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (debug-js/debug#797)
npm ERR! npm WARN deprecated [email protected]: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-babel.
npm ERR! npm WARN deprecated @babel/[email protected]: 🚨 This package has been deprecated in favor of separate inclusion of a polyfill and regenerator-runtime (when needed). See the @babel/polyfill docs (https://babeljs.io/docs/en/babel-polyfill) for more information.
npm ERR! npm WARN deprecated [email protected]: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-commonjs.
npm ERR! npm WARN deprecated [email protected]: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm ERR! npm WARN deprecated [email protected]: This SVGO version is no longer supported. Upgrade to v2.x.x.
npm ERR! npm WARN deprecated [email protected]: This SVGO version is no longer supported. Upgrade to v2.x.x.
npm ERR! npm WARN deprecated [email protected]: The zlib module provides APIs for brotli compression/decompression starting with Node.js v10.16.0, please use it over iltorb
npm ERR! npm WARN deprecated [email protected]: core-js@<3.4 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
npm ERR! npm ERR! code 1
npm ERR! npm ERR! path C:\Users\HpRo\AppData\Local\npm-cache_cacache\tmp\git-clonelZG6NH\node_modules\iltorb
npm ERR! npm ERR! command failed
npm ERR! npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node ./scripts/install.js || node-gyp rebuild
npm ERR! npm ERR! info install installing standalone, skipping download.
npm ERR! npm ERR! gyp info it worked if it ends with ok
npm ERR! npm ERR! gyp info using [email protected]
npm ERR! npm ERR! gyp info using [email protected] | win32 | x64
npm ERR! npm ERR! gyp info find Python using Python version 3.9.10 found at "C:\Users\HpRo\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe"
npm ERR! npm ERR! gyp ERR! find VS
npm ERR! npm ERR! gyp ERR! find VS msvs_version not set from command line or npm config
npm ERR! npm ERR! gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
npm ERR! npm ERR! gyp ERR! find VS checking VS2022 (17.1.32127.271) found at:
npm ERR! npm ERR! gyp ERR! find VS "C:\Program Files\Microsoft Visual Studio\2022\Preview"
npm ERR! npm ERR! gyp ERR! find VS - found "Visual Studio C++ core features"
npm ERR! npm ERR! gyp ERR! find VS - missing any VC++ toolset
npm ERR! npm ERR! gyp ERR! find VS checking VS2019 (16.11.31702.278) found at:
npm ERR! npm ERR! gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional"
npm ERR! npm ERR! gyp ERR! find VS - found "Visual Studio C++ core features"
npm ERR! npm ERR! gyp ERR! find VS - missing any VC++ toolset
npm ERR! npm ERR! gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
npm ERR! npm ERR! gyp ERR! find VS looking for Visual Studio 2015
npm ERR! npm ERR! gyp ERR! find VS - not found
npm ERR! npm ERR! gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
npm ERR! npm ERR! gyp ERR! find VS
npm ERR! npm ERR! gyp ERR! find VS **************************************************************
npm ERR! npm ERR! gyp ERR! find VS You need to install the latest version of Visual Studio
npm ERR! npm ERR! gyp ERR! find VS including the "Desktop development with C++" workload.
npm ERR! npm ERR! gyp ERR! find VS For more information consult the documentation at:
npm ERR! npm ERR! gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
npm ERR! npm ERR! gyp ERR! find VS **************************************************************
npm ERR! npm ERR! gyp ERR! find VS
npm ERR! npm ERR! gyp ERR! configure error
npm ERR! npm ERR! gyp ERR! stack Error: Could not find any Visual Studio installation to use
npm ERR! npm ERR! gyp ERR! stack at VisualStudioFinder.fail (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:122:47)
npm ERR! npm ERR! gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:75:16
npm ERR! npm ERR! gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:363:14)
npm ERR! npm ERR! gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:71:14
npm ERR! npm ERR! gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:384:16
npm ERR! npm ERR! gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7
npm ERR! npm ERR! gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
npm ERR! npm ERR! gyp ERR! stack at ChildProcess.exithandler (node:child_process:406:5)
npm ERR! npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:520:28)
npm ERR! npm ERR! gyp ERR! stack at maybeClose (node:internal/child_process:1092:16)
npm ERR! npm ERR! gyp ERR! System Windows_NT 10.0.19043
npm ERR! npm ERR! gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
npm ERR! npm ERR! gyp ERR! cwd C:\Users\HpRo\AppData\Local\npm-cache_cacache\tmp\git-clonelZG6NH\node_modules\iltorb
npm ERR! npm ERR! gyp ERR! node -v v16.14.0
npm ERR! npm ERR! gyp ERR! node-gyp -v v8.4.1
npm ERR! npm ERR! gyp ERR! not ok
npm ERR!
npm ERR! npm ERR! A complete log of this run can be found in:
npm ERR! npm ERR! C:\Users\HpRo\AppData\Local\npm-cache_logs\2022-03-04T14_55_34_888Z-debug-0.log

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\HpRo\AppData\Local\npm-cache_logs\2022-03-04T14_55_19_461Z-debug-0.log

Error

Progress bar is enabled, but currentTime or totalTime not specified

code:

const img = await generate({
			url: queue.current?.uri as string,
			platform: 'spotify',
			songData: {
				title: queue.current!.title,
				cover: `https://img.youtube.com/vi/${
					queue.current!.identifier
				}/maxresdefault.jpg`,
				artist: queue.current!.author,
			} as CustomSongData,
			progressBar: true,
			currentTime: player?.position as number,
			totalTime: queue.current?.length as number,
		})

Not work with spotify.

Im trying to use it with spotify .. but gives me this error :
Error when fetching song from spotify, are you sure the link you provided is correct ? Error: Couldn't find any data in embed page that we know how to parse.

Note: its work with deezer and youtube .. & Im using JS.

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.