music: back to ytdl-core
This commit is contained in:
parent
5a5c38e6d5
commit
521118a6b4
3 changed files with 39 additions and 31 deletions
|
@ -20,12 +20,12 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ctrl/tinycolor": "^3.4.1",
|
"@ctrl/tinycolor": "^3.4.1",
|
||||||
"@projectdysnomia/dysnomia": "github:projectdysnomia/dysnomia#chore/housekeeping",
|
"@projectdysnomia/dysnomia": "github:projectdysnomia/dysnomia#chore/housekeeping",
|
||||||
|
"better-ytdl-core": "^1.0.1",
|
||||||
"dumpy": "github:Cynosphere/dumpy.js",
|
"dumpy": "github:Cynosphere/dumpy.js",
|
||||||
"google-images": "^2.1.0",
|
"google-images": "^2.1.0",
|
||||||
"jimp": "^0.16.1",
|
"jimp": "^0.16.1",
|
||||||
"murmurhash": "^2.0.0",
|
"murmurhash": "^2.0.0",
|
||||||
"node-ffprobe": "^3.0.0",
|
"node-ffprobe": "^3.0.0",
|
||||||
"play-dl": "^1.9.6",
|
|
||||||
"sharp": "^0.28.3",
|
"sharp": "^0.28.3",
|
||||||
"sqlite3": "^5.0.2"
|
"sqlite3": "^5.0.2"
|
||||||
},
|
},
|
||||||
|
|
|
@ -3,6 +3,7 @@ lockfileVersion: 5.4
|
||||||
specifiers:
|
specifiers:
|
||||||
'@ctrl/tinycolor': ^3.4.1
|
'@ctrl/tinycolor': ^3.4.1
|
||||||
'@projectdysnomia/dysnomia': github:projectdysnomia/dysnomia#chore/housekeeping
|
'@projectdysnomia/dysnomia': github:projectdysnomia/dysnomia#chore/housekeeping
|
||||||
|
better-ytdl-core: ^1.0.1
|
||||||
dumpy: github:Cynosphere/dumpy.js
|
dumpy: github:Cynosphere/dumpy.js
|
||||||
eslint: ^7.26.0
|
eslint: ^7.26.0
|
||||||
google-images: ^2.1.0
|
google-images: ^2.1.0
|
||||||
|
@ -10,20 +11,19 @@ specifiers:
|
||||||
jimp: ^0.16.1
|
jimp: ^0.16.1
|
||||||
murmurhash: ^2.0.0
|
murmurhash: ^2.0.0
|
||||||
node-ffprobe: ^3.0.0
|
node-ffprobe: ^3.0.0
|
||||||
play-dl: ^1.9.6
|
|
||||||
prettier: ^2.3.0
|
prettier: ^2.3.0
|
||||||
sharp: ^0.28.3
|
sharp: ^0.28.3
|
||||||
sqlite3: ^5.0.2
|
sqlite3: ^5.0.2
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
'@ctrl/tinycolor': 3.4.1
|
'@ctrl/tinycolor': 3.4.1
|
||||||
'@projectdysnomia/dysnomia': github.com/projectdysnomia/dysnomia/fba6510e3b93325c79de85a277a944d73a111378
|
'@projectdysnomia/dysnomia': github.com/projectdysnomia/dysnomia/4961111413b635e746feaca1939e8aa885947e9d
|
||||||
|
better-ytdl-core: 1.0.1
|
||||||
dumpy: github.com/Cynosphere/dumpy.js/5fc22353cdcb97084bab572266390e780d9f7a7b
|
dumpy: github.com/Cynosphere/dumpy.js/5fc22353cdcb97084bab572266390e780d9f7a7b
|
||||||
google-images: 2.1.0
|
google-images: 2.1.0
|
||||||
jimp: 0.16.1
|
jimp: 0.16.1
|
||||||
murmurhash: 2.0.0
|
murmurhash: 2.0.0
|
||||||
node-ffprobe: 3.0.0
|
node-ffprobe: 3.0.0
|
||||||
play-dl: 1.9.6
|
|
||||||
sharp: 0.28.3
|
sharp: 0.28.3
|
||||||
sqlite3: 5.0.2
|
sqlite3: 5.0.2
|
||||||
|
|
||||||
|
@ -603,6 +603,15 @@ packages:
|
||||||
dev: false
|
dev: false
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
|
/better-ytdl-core/1.0.1:
|
||||||
|
resolution: {integrity: sha512-ADe5bTBprd0Ky3cMChQ0AsOAxkvB+ugmqjoUCd5lz76mXe2Cfkq2x4qvQcUq7+R0GHX1p0QGggfUZJ5XvbI+yw==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
dependencies:
|
||||||
|
m3u8stream: 0.8.6
|
||||||
|
miniget: 4.2.2
|
||||||
|
sax: 1.2.4
|
||||||
|
dev: false
|
||||||
|
|
||||||
/bl/4.1.0:
|
/bl/4.1.0:
|
||||||
resolution: {integrity: sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==}
|
resolution: {integrity: sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==}
|
||||||
dependencies:
|
dependencies:
|
||||||
|
@ -1448,6 +1457,14 @@ packages:
|
||||||
dependencies:
|
dependencies:
|
||||||
yallist: 4.0.0
|
yallist: 4.0.0
|
||||||
|
|
||||||
|
/m3u8stream/0.8.6:
|
||||||
|
resolution: {integrity: sha512-LZj8kIVf9KCphiHmH7sbFQTVe4tOemb202fWwvJwR9W5ENW/1hxJN6ksAWGhQgSBSa3jyWhnjKU1Fw1GaOdbyA==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
dependencies:
|
||||||
|
miniget: 4.2.2
|
||||||
|
sax: 1.2.4
|
||||||
|
dev: false
|
||||||
|
|
||||||
/mime-db/1.48.0:
|
/mime-db/1.48.0:
|
||||||
resolution: {integrity: sha512-FM3QwxV+TnZYQ2aRqhlKBMHxk10lTbMt3bBkMAp54ddrNeVSfcQYOOKuGuy3Ddrm38I04If834fOUSq1yzslJQ==}
|
resolution: {integrity: sha512-FM3QwxV+TnZYQ2aRqhlKBMHxk10lTbMt3bBkMAp54ddrNeVSfcQYOOKuGuy3Ddrm38I04If834fOUSq1yzslJQ==}
|
||||||
engines: {node: '>= 0.6'}
|
engines: {node: '>= 0.6'}
|
||||||
|
@ -1479,6 +1496,11 @@ packages:
|
||||||
dom-walk: 0.1.2
|
dom-walk: 0.1.2
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/miniget/4.2.2:
|
||||||
|
resolution: {integrity: sha512-a7voNL1N5lDMxvTMExOkg+Fq89jM2vY8pAi9ZEWzZtfNmdfP6RXkvUtFnCAXoCv2T9k1v/fUJVaAEuepGcvLYA==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
dev: false
|
||||||
|
|
||||||
/minimatch/3.0.4:
|
/minimatch/3.0.4:
|
||||||
resolution: {integrity: sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==}
|
resolution: {integrity: sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==}
|
||||||
dependencies:
|
dependencies:
|
||||||
|
@ -1768,17 +1790,6 @@ packages:
|
||||||
pngjs: 3.4.0
|
pngjs: 3.4.0
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/play-audio/0.5.2:
|
|
||||||
resolution: {integrity: sha512-ZAqHUKkQLix2Iga7pPbsf1LpUoBjcpwU93F1l3qBIfxYddQLhxS6GKmS0d3jV8kSVaUbr6NnOEcEMFvuX93SWQ==}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/play-dl/1.9.6:
|
|
||||||
resolution: {integrity: sha512-JW44bQbME9fNfGhGXQ/rdcsHr4BfgJabVlSgpS9QY/NscfprFH1asv+q9atrZThP3+hHIpgtFNABccg9rFWlwg==}
|
|
||||||
engines: {node: '>=16.0.0'}
|
|
||||||
dependencies:
|
|
||||||
play-audio: 0.5.2
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/pngjs/3.4.0:
|
/pngjs/3.4.0:
|
||||||
resolution: {integrity: sha512-NCrCHhWmnQklfH4MtJMRjZ2a8c80qXeMlQMv2uVp9ISJMTt562SbGd6n2oq0PaPgKm7Z6pL9E2UlLIhC+SHL3w==}
|
resolution: {integrity: sha512-NCrCHhWmnQklfH4MtJMRjZ2a8c80qXeMlQMv2uVp9ISJMTt562SbGd6n2oq0PaPgKm7Z6pL9E2UlLIhC+SHL3w==}
|
||||||
engines: {node: '>=4.0.0'}
|
engines: {node: '>=4.0.0'}
|
||||||
|
@ -2426,8 +2437,8 @@ packages:
|
||||||
- encoding
|
- encoding
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
github.com/projectdysnomia/dysnomia/fba6510e3b93325c79de85a277a944d73a111378:
|
github.com/projectdysnomia/dysnomia/4961111413b635e746feaca1939e8aa885947e9d:
|
||||||
resolution: {tarball: https://codeload.github.com/projectdysnomia/dysnomia/tar.gz/fba6510e3b93325c79de85a277a944d73a111378}
|
resolution: {tarball: https://codeload.github.com/projectdysnomia/dysnomia/tar.gz/4961111413b635e746feaca1939e8aa885947e9d}
|
||||||
name: '@projectdysnomia/dysnomia'
|
name: '@projectdysnomia/dysnomia'
|
||||||
version: 0.1.0-dev
|
version: 0.1.0-dev
|
||||||
engines: {node: '>=10.4.0'}
|
engines: {node: '>=10.4.0'}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
const {Collection} = require("@projectdysnomia/dysnomia");
|
const {Collection} = require("@projectdysnomia/dysnomia");
|
||||||
|
|
||||||
const playdl = require("play-dl");
|
const ytdl = require("better-ytdl-core");
|
||||||
const ffprobe = require("node-ffprobe");
|
const ffprobe = require("node-ffprobe");
|
||||||
|
|
||||||
const Command = require("../lib/command.js");
|
const Command = require("../lib/command.js");
|
||||||
|
@ -203,29 +203,26 @@ async function enqueue({
|
||||||
if (type == "yt") {
|
if (type == "yt") {
|
||||||
let info;
|
let info;
|
||||||
try {
|
try {
|
||||||
info = await playdl.video_info(url);
|
info = await ytdl.getInfo(url, {});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
await textChannel.createMessage({
|
await textChannel.createMessage({
|
||||||
content: `:warning: Failed to get metadata: \`\`\`\n${err}\n\`\`\``,
|
content: `:warning: Failed to get metadata: \`\`\`\n${err}\n\`\`\``,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
title = parseHtmlEntities(info?.video_details?.title);
|
title = parseHtmlEntities(info?.videoDetails?.title);
|
||||||
length = info?.video_details?.durationInSec * 1000;
|
length = info?.videoDetails?.lengthSeconds * 1000;
|
||||||
thumbnail = info?.video_details?.thumbnails?.[
|
thumbnail = info?.videoDetails?.thumbnails?.[
|
||||||
info.video_details.thumbnails.length - 1
|
info.videoDetails.thumbnails.length - 1
|
||||||
].url
|
].url
|
||||||
.replace("vi_webp", "vi")
|
.replace("vi_webp", "vi")
|
||||||
.replace(".webp", ".jpg");
|
.replace(".webp", ".jpg");
|
||||||
|
|
||||||
let formats = info?.format;
|
media = ytdl(url, {
|
||||||
if (formats) {
|
quality: "highestaudio",
|
||||||
formats = formats.filter(
|
filter: "audioonly",
|
||||||
(obj) => obj.audioQuality != null && obj.container == "webm"
|
highWaterMark: 1 << 25,
|
||||||
);
|
});
|
||||||
formats.sort((a, b) => b.bitrate - a.bitrate);
|
|
||||||
media = formats[0].url;
|
|
||||||
}
|
|
||||||
} else if (type == "sc") {
|
} else if (type == "sc") {
|
||||||
if (url?.startsWith("sc:"))
|
if (url?.startsWith("sc:"))
|
||||||
url = url.replace(/^sc:/, "https://soundcloud.com/");
|
url = url.replace(/^sc:/, "https://soundcloud.com/");
|
||||||
|
|
Loading…
Reference in a new issue