Compare commits

..

2 commits

Author SHA1 Message Date
e8fc57394f Return when the video is too big 2024-01-07 01:10:02 +01:00
3b9d2dc556 Limit videos to 720p 2024-01-07 01:06:23 +01:00
2 changed files with 4 additions and 5 deletions

View file

@ -126,10 +126,10 @@ export default {
const aproxFileSize = await utils.getVideoSize(url);
if (aproxFileSize > 100 && !args.compress) {
await interaction.followUp('Uh oh! The video you tried to download is larger than 100 mb! Try again with compression.', { ephemeral: true });
return await interaction.followUp('Uh oh! The video you tried to download is larger than 100 mb! Try again with compression.', { ephemeral: true });
}
else if (aproxFileSize > 500) {
await interaction.followUp('Uh oh! The video you tried to download is larger than 500 mb!', { ephemeral: true });
return await interaction.followUp('Uh oh! The video you tried to download is larger than 500 mb!', { ephemeral: true });
}
download(url, interaction);
@ -137,8 +137,7 @@ export default {
};
async function download(url, interaction, originalInteraction) {
let format = 'bestvideo*+bestaudio/best';
let format = undefined;
const Embed = new EmbedBuilder()
.setColor(interaction.member ? interaction.member.displayHexColor : 'Navy')
.setAuthor({ name: `Downloaded by ${interaction.user.username}`, iconURL: interaction.user.displayAvatarURL(), url: url })

View file

@ -12,7 +12,7 @@ export default {
getVideoSize,
getMaxFileSize,
};
async function downloadVideo(urlArg, output, format = 'bestvideo*+bestaudio/best') {
async function downloadVideo(urlArg, output, format = 'bestvideo[height<=?720]*+bestaudio/best') {
await new Promise((resolve, reject) => {
exec(`./bin/yt-dlp -f "${format}" "${urlArg}" -o "${os.tmpdir()}/${output}.%(ext)s" --force-overwrites --no-playlist --remux-video=mp4/webm/mov`, (err, stdout, stderr) => {
if (err) {