diff --git a/README.md b/README.md index 6601c10..6f771b4 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,10 @@ Get [FFMPEG](https://ffmpeg.org/download.html) [Node.js 18](https://nodejs.org/en/download/package-manager/) +[git not windows](https://formulae.brew.sh/formula/git) +or +[git for windows](https://git-scm.com/download/win) + Note: if you run into issues related to puppeteer chromium download please try `PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true npm install -g spotify-dl` #### spotifydl @@ -32,8 +36,6 @@ PLEASE NOTE: #### NPM -Install from [npm](https://www.npmjs.com/package/spotify-dl) registry - ```sh npm install -g https://github.com/swapnilsoni1999/spotify-dl ``` @@ -57,8 +59,6 @@ sh -c "$(curl -fsSL https://raw.githubusercontent.com/SwapnilSoni1999/spotify-dl #### Docker - - ```sh docker run ghcr.io/swapnilsoni1999/spotify-dl ``` @@ -71,7 +71,6 @@ cd spotify-dl docker build -t spotify-dl . ``` -
# Usage diff --git a/lib/metadata.js b/lib/metadata.js index 172712e..2b86a0e 100644 --- a/lib/metadata.js +++ b/lib/metadata.js @@ -30,31 +30,27 @@ const downloadAndSaveCover = function (uri, filename) { const mergeMetadata = async (output, songData) => { const coverFileName = output.slice(0, output.length - 3) + 'jpg'; let coverURL = songData.cover_url; - if (!coverURL) { - coverURL = Constants.YOUTUBE_SEARCH.GENERIC_IMAGE; - } - - try { - await downloadAndSaveCover(coverURL, coverFileName); - } catch (_e) { - // image is corrupt or not available try again - logInfo('Album Thumbnail corrupt attempting again'); + if (coverURL) { try { await downloadAndSaveCover(coverURL, coverFileName); - } catch (_e2) { - // if it fails again just fallback to generic image - logInfo( - 'Album Thumbnail corrupt for second time fallback to generic image', - ); + } catch (_e) { + // image is corrupt or not available try again + logInfo('Album Thumbnail corrupt attempting again'); + try { + await downloadAndSaveCover(coverURL, coverFileName); + } catch (_e2) { + // if it fails again just fallback to generic image + logInfo( + 'Album Thumbnail corrupt for second time fallback to generic image', + ); + } } } if (!fs.existsSync(coverFileName)) { - await downloadAndSaveCover( - 'https://i.ibb.co/PN87XDk/unknown.jpg', - coverFileName, - ); + fs.copyFileSync(Constants.YOUTUBE_SEARCH.GENERIC_IMAGE, coverFileName); } + const dateSplits = splitDates(songData.release_date); const firstArtist = songData.artists && songData.artists.length > 0 ? songData.artists[0] : ''; diff --git a/package-lock.json b/package-lock.json index 62f3898..aa21f5d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,15 @@ { - "name": "spotify-dl", - "version": "1.1.2", + "name": "@swapnilsoni1999/spotify-dl", + "version": "1.2.2", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "spotify-dl", - "version": "1.1.2", + "name": "@swapnilsoni1999/spotify-dl", + "version": "1.2.2", "license": "ISC", "dependencies": { - "@distube/ytdl-core": "^4.13.5", + "@distube/ytdl-core": "^4.14.4", "axios": "^1.6.0", "express": "^4.18.1", "fluent-ffmpeg": "^2.1.2", @@ -140,19 +140,19 @@ } }, "node_modules/@distube/ytdl-core": { - "version": "4.13.5", - "resolved": "https://registry.npmjs.org/@distube/ytdl-core/-/ytdl-core-4.13.5.tgz", - "integrity": "sha512-g+4UJIR/auAJbia7iB0aWvaJDbs22P53NySWa47b1NT4xMTDJYguxHFArPrvRkcJrb/AgKjv/XoSZGghpL0CJA==", + "version": "4.14.4", + "resolved": "https://registry.npmjs.org/@distube/ytdl-core/-/ytdl-core-4.14.4.tgz", + "integrity": "sha512-dHb4GW3qATIjRsS6VIhm3Pop7FdUcDFhsnyQlsPeXW7UhTPuNS0BmraKiTpFbpp0Ky+rxBQjJBfPRFsM+dT1fg==", "dependencies": { "http-cookie-agent": "^6.0.5", "m3u8stream": "^0.8.6", "miniget": "^4.2.3", "sax": "^1.4.1", "tough-cookie": "^4.1.4", - "undici": "^6.19.2" + "undici": "five" }, "engines": { - "node": ">=16" + "node": ">=14.0" }, "funding": { "url": "https://github.com/distubejs/ytdl-core?sponsor" @@ -8304,16 +8304,16 @@ } }, "@distube/ytdl-core": { - "version": "4.13.5", - "resolved": "https://registry.npmjs.org/@distube/ytdl-core/-/ytdl-core-4.13.5.tgz", - "integrity": "sha512-g+4UJIR/auAJbia7iB0aWvaJDbs22P53NySWa47b1NT4xMTDJYguxHFArPrvRkcJrb/AgKjv/XoSZGghpL0CJA==", + "version": "4.14.4", + "resolved": "https://registry.npmjs.org/@distube/ytdl-core/-/ytdl-core-4.14.4.tgz", + "integrity": "sha512-dHb4GW3qATIjRsS6VIhm3Pop7FdUcDFhsnyQlsPeXW7UhTPuNS0BmraKiTpFbpp0Ky+rxBQjJBfPRFsM+dT1fg==", "requires": { "http-cookie-agent": "^6.0.5", "m3u8stream": "^0.8.6", "miniget": "^4.2.3", "sax": "^1.4.1", "tough-cookie": "^4.1.4", - "undici": "^6.19.2" + "undici": "five" }, "dependencies": { "agent-base": { diff --git a/package.json b/package.json index 25cf9ba..ff2a01a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@swapnilsoni1999/spotify-dl", "productName": "Spotify Downloader", - "version": "1.2.2", + "version": "1.2.3", "description": "Spotify Songs, Playlist & Album Downloader", "main": "app.js", "bin": { @@ -38,7 +38,7 @@ "spotify-web-api-node": "^5.0.0", "string-similarity": "^4.0.4", "yt-search": "^2.10.3", - "@distube/ytdl-core": "^4.13.5" + "@distube/ytdl-core": "^4.14.4" }, "xo": { "space": true, @@ -55,4 +55,4 @@ "prettier": "^2.7.1", "xo": "^0.56.0" } -} +} \ No newline at end of file diff --git a/util/constants.js b/util/constants.js index be844e1..8ec5097 100644 --- a/util/constants.js +++ b/util/constants.js @@ -1,3 +1,5 @@ +import path from 'path'; + export default { AUTH: { SCOPES: { @@ -52,10 +54,7 @@ export default { YOUTUBE_SEARCH: { // this roughly equates to a max of 30mb MAX_MINUTES: 15, - GENERIC_IMAGE: - 'https://lh3.googleusercontent.com/z6Sl4j9zQ88oUKN' + - 'y0G3PAMiVwy8DzQLh_ygyvBXv0zVNUZ_wQPN_n7EAR2By3dhoUpX7kTpaHjRP' + - 'ni1MHwKpaBJbpNqdEsHZsH4q', + GENERIC_IMAGE: path.join(process.cwd(), "logo.png"), VALID_CONTEXTS: ['itemName', 'albumName', 'artistName'], }, };