Skip to content

Commit

Permalink
fix: get ytdl working again
Browse files Browse the repository at this point in the history
  • Loading branch information
markokajzer committed Mar 25, 2023
1 parent aa5c6f3 commit 23f9112
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
"@discordjs/opus": "^0.9.0",
"@discordjs/voice": "^0.15.0",
"discord.js": "^13.13.1",
"fluent-ffmpeg": "2.1.2",
"fluent-ffmpeg": "^2.1.2",
"i18n": "0.13.2",
"lodash": "4.17.21",
"lowdb": "1.0.0",
"ytdl-core": "4.8.3"
"ytdl-core": "^4.11.2"
},
"optionalDependencies": {
"bufferutil": "^4.0.7",
Expand Down
4 changes: 2 additions & 2 deletions src/commands/manage/add/downloader/YoutubeDownloader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ export default class YoutubeDownloader extends BaseDownloader {

private download(url: string) {
return new Promise((resolve, reject) => {
ytdl(url, { filter: format => format.container === 'mp4' })
ytdl(url, { filter: 'audio', quality: 'highestaudio' })
.pipe(fs.createWriteStream('tmp.mp4'))
.on('finish', resolve)
.on('error', reject);
});
}

private convert({ soundName, startTime, endTime }: ConvertOptions) {
let ffmpegCommand = ffmpeg('tmp.mp4').output(`./sounds/${soundName}.mp3`);
let ffmpegCommand = ffmpeg('tmp.mp4').toFormat('mp3').output(`./sounds/${soundName}.mp3`);

if (startTime) ffmpegCommand = ffmpegCommand.setStartTime(startTime);
if (startTime && endTime) ffmpegCommand = ffmpegCommand.setDuration(endTime - startTime);
Expand Down
30 changes: 15 additions & 15 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3797,12 +3797,12 @@ lru-cache@^6.0.0:
dependencies:
yallist "^4.0.0"

m3u8stream@^0.8.3:
version "0.8.4"
resolved "https://registry.npmjs.org/m3u8stream/-/m3u8stream-0.8.4.tgz"
integrity sha512-sco80Db+30RvcaIOndenX6E6oQNgTiBKeJbFPc+yDXwPQIkryfboEbCvXPlBRq3mQTCVPQO93TDVlfRwqpD35w==
m3u8stream@^0.8.6:
version "0.8.6"
resolved "https://registry.yarnpkg.com/m3u8stream/-/m3u8stream-0.8.6.tgz#0d6de4ce8ee69731734e6b616e7b05dd9d9a55b1"
integrity sha512-LZj8kIVf9KCphiHmH7sbFQTVe4tOemb202fWwvJwR9W5ENW/1hxJN6ksAWGhQgSBSa3jyWhnjKU1Fw1GaOdbyA==
dependencies:
miniget "^4.0.0"
miniget "^4.2.2"
sax "^1.2.4"

make-dir@^3.0.0, make-dir@^3.1.0:
Expand Down Expand Up @@ -3934,10 +3934,10 @@ mimic-fn@^2.1.0:
resolved "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz"
integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==

miniget@^4.0.0:
version "4.2.1"
resolved "https://registry.npmjs.org/miniget/-/miniget-4.2.1.tgz"
integrity sha512-O/DduzDR6f+oDtVype9S/Qu5hhnx73EDYGyZKwU/qN82lehFZdfhoa4DT51SpsO+8epYrB3gcRmws56ROfTIoQ==
miniget@^4.2.2:
version "4.2.2"
resolved "https://registry.yarnpkg.com/miniget/-/miniget-4.2.2.tgz#db20320f265efdc4c1826a0be431d56753074475"
integrity sha512-a7voNL1N5lDMxvTMExOkg+Fq89jM2vY8pAi9ZEWzZtfNmdfP6RXkvUtFnCAXoCv2T9k1v/fUJVaAEuepGcvLYA==

minimatch@^3.0.4:
version "3.0.4"
Expand Down Expand Up @@ -5646,11 +5646,11 @@ yocto-queue@^0.1.0:
resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b"
integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==

ytdl-core@4.8.3:
version "4.8.3"
resolved "https://registry.npmjs.org/ytdl-core/-/ytdl-core-4.8.3.tgz"
integrity sha512-cWCBeX4FCgjcKmuVK384MT582RIAakpUSeMF/NPVmhO8cWiG+LeQLnBordvLolb0iXYzfUvalgmycYAE5Sy6Xw==
ytdl-core@^4.11.2:
version "4.11.2"
resolved "https://registry.yarnpkg.com/ytdl-core/-/ytdl-core-4.11.2.tgz#c2341916b9757171741a2fa118b6ffbb4ffd92f7"
integrity sha512-D939t9b4ZzP3v0zDvehR2q+KgG97UTgrTKju3pOPGQcXtl4W6W5z0EpznzcJFu+OOpl7S7Ge8hv8zU65QnxYug==
dependencies:
m3u8stream "^0.8.3"
miniget "^4.0.0"
m3u8stream "^0.8.6"
miniget "^4.2.2"
sax "^1.1.3"

0 comments on commit 23f9112

Please sign in to comment.