-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Why even one needs to have an API key for YouTube search?! (#32)
- Loading branch information
1 parent
6ebca09
commit 2e25181
Showing
10 changed files
with
1,116 additions
and
730 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages | ||
|
||
name: Node.js Package | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
publish-npm: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12 | ||
registry-url: https://registry.npmjs.org/ | ||
- run: yarn | ||
- run: yarn publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,34 @@ | ||
const path = require('path'); | ||
const path = require("path"); | ||
const Promise = require("promise"); | ||
|
||
const YouTubeSearch = require('./search'); | ||
const YouTubeDownloader = require('./downloader'); | ||
const Id3Tagger = require('./../id3_tagger'); | ||
const YouTubeSearch = require("./search"); | ||
const YouTubeDownloader = require("./downloader"); | ||
const Id3Tagger = require("./../id3_tagger"); | ||
|
||
module.exports = class YoutubeClient { | ||
constructor(apiKey) { | ||
this.apiKey = apiKey; | ||
} | ||
|
||
downloadAudioTrack(query, outputPath, outputFilename, trackInfo) { | ||
return new Promise((resolve, reject) => { | ||
if (!this.apiKey) reject(new Error("YouTube api key is not provided")); | ||
|
||
const search = new YouTubeSearch(query, this.apiKey); | ||
const search = new YouTubeSearch(query); | ||
|
||
search.findLink().then((link) => { | ||
new YouTubeDownloader(link, outputPath, outputFilename).download() | ||
.then((mp3OutputPath) => { | ||
const tagger = new Id3Tagger(mp3OutputPath, trackInfo); | ||
tagger.tag(); | ||
resolve(mp3OutputPath); | ||
}).catch(reject); | ||
}).catch(reject); | ||
}) | ||
search | ||
.findLink() | ||
.then((link) => { | ||
new YouTubeDownloader(link, outputPath, outputFilename) | ||
.download() | ||
.then((mp3OutputPath) => { | ||
const tagger = new Id3Tagger(mp3OutputPath, trackInfo); | ||
tagger.tag(); | ||
resolve(mp3OutputPath); | ||
}) | ||
.catch((reason) => { | ||
console.error(reason); | ||
reject(reason); | ||
}); | ||
}) | ||
.catch((reason) => { | ||
console.error(reason); | ||
reject(reason); | ||
}); | ||
}); | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
"type": "git", | ||
"url": "https://github.com/vishaltelangre/music-dl" | ||
}, | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"description": "Download audio song playlists/albums from multiple song providers!", | ||
"main": "index.js", | ||
"author": "Vishal Telangre <[email protected]>", | ||
|
@@ -19,12 +19,16 @@ | |
"fluent-ffmpeg": "^2.1.2", | ||
"lodash": "^4.17.15", | ||
"mkdirp": "^0.5.1", | ||
"needle": "2.3.0", | ||
"node-id3": "^0.1.3", | ||
"osmosis": "^1.1.6", | ||
"osmosis": "^1.1.10", | ||
"promise": "^8.0.1", | ||
"request": "^2.88.0", | ||
"update-notifier": "^2.4.0", | ||
"youtube-search": "^1.1.0", | ||
"ytdl-core": "^1.0.6" | ||
"yt-search": "^2.1.6", | ||
"ytdl-core": "^3.1.3" | ||
}, | ||
"resolutions": { | ||
"needle": "2.3.0" | ||
} | ||
} |
Oops, something went wrong.