forked from Supositware/Haha-Yes
Fix some downloads
This commit is contained in:
parent
8f7afa9be7
commit
50aecd546a
2 changed files with 9 additions and 9 deletions
|
@ -29,7 +29,7 @@ export default {
|
|||
|
||||
if (interaction.options.getBoolean('advanced')) {
|
||||
let qualitys = await new Promise((resolve, reject) => {
|
||||
exec(`./bin/yt-dlp ${url} --print "%()j"`, (err, stdout, stderr) => {
|
||||
exec(`./bin/yt-dlp "${url}" --print "%()j"`, (err, stdout, stderr) => {
|
||||
if (err) {
|
||||
reject(stderr);
|
||||
}
|
||||
|
@ -45,12 +45,17 @@ export default {
|
|||
|
||||
qualitys.formats.forEach(f => {
|
||||
options.push({
|
||||
label: f.resolution,
|
||||
label: f.resolution ? f.resolution : 'Unknown format',
|
||||
description: `${f.format} V: ${f.vcodec} A: ${f.acodec}`,
|
||||
value: f.format_id,
|
||||
});
|
||||
});
|
||||
|
||||
if (options.length < 2) {
|
||||
await interaction.deleteReply();
|
||||
return interaction.followUp({ content: '❌ There is no other quality option for this video!', ephemeral: true });
|
||||
}
|
||||
|
||||
if (options.length > 25) {
|
||||
// Reverse so the higher quality formats are first
|
||||
options.reverse();
|
||||
|
@ -62,11 +67,6 @@ export default {
|
|||
options.reverse();
|
||||
}
|
||||
|
||||
if (options.length < 2) {
|
||||
await interaction.deleteReply();
|
||||
return interaction.followUp({ content: '❌ There is no other quality option for this video!', ephemeral: true });
|
||||
}
|
||||
|
||||
const row = new MessageActionRow()
|
||||
.addComponents(
|
||||
new MessageSelectMenu()
|
||||
|
|
|
@ -9,7 +9,7 @@ export default {
|
|||
};
|
||||
async function downloadVideo(urlArg, output, format = 'bestvideo*+bestaudio/best') {
|
||||
await new Promise((resolve, reject) => {
|
||||
exec(`./bin/yt-dlp -f ${format} ${urlArg} -o "${os.tmpdir()}/${output}.%(ext)s" --force-overwrites --no-playlist`, (err, stdout, stderr) => {
|
||||
exec(`./bin/yt-dlp -f ${format} "${urlArg}" -o "${os.tmpdir()}/${output}.%(ext)s" --force-overwrites --no-playlist`, (err, stdout, stderr) => {
|
||||
if (err) {
|
||||
reject(stderr);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue