Skip to content

Commit

Permalink
increase yt download limit
Browse files Browse the repository at this point in the history
  • Loading branch information
Shubhamrawat5 committed Sep 23, 2023
1 parent a6eba6d commit a1593ed
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions src/commands/members/yta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ const handler = async (bot: Bot, msg: WAMessage, msgInfoObj: MsgInfoObj) => {
return;
}
const infoYt = await ytdl.getInfo(urlYt);
// 30 MIN
if (Number(infoYt.videoDetails.lengthSeconds) >= 1800) {
await reply(`❌ Video too big!`);
// 60 MIN
if (Number(infoYt.videoDetails.lengthSeconds) >= 3600) {
await reply(`❌ Cannot download! Audio duration limit: 60 min`);
return;
}
const titleYt = infoYt.videoDetails.title;
Expand All @@ -42,7 +42,7 @@ const handler = async (bot: Bot, msg: WAMessage, msgInfoObj: MsgInfoObj) => {
// Convert the file size to megabytes (optional)
const fileSizeInMegabytes = fileSizeInBytes / (1024 * 1024);
console.log(`Audio downloaded ! Size: ${fileSizeInMegabytes}`);
if (fileSizeInMegabytes <= 40) {
if (fileSizeInMegabytes <= 100) {
await bot.sendMessage(
from,
{
Expand All @@ -53,7 +53,7 @@ const handler = async (bot: Bot, msg: WAMessage, msgInfoObj: MsgInfoObj) => {
{ quoted: msg }
);
} else {
await reply(`❌ File size bigger than 40mb.`);
await reply(`❌ Cannot download! Audio size limit: 100 mb`);
}

fs.unlinkSync(`./${randomFileName}`);
Expand Down
10 changes: 5 additions & 5 deletions src/commands/members/ytv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ const handler = async (bot: Bot, msg: WAMessage, msgInfoObj: MsgInfoObj) => {
return;
}
const infoYt = await ytdl.getInfo(urlYt);
// 30 MIN
if (Number(infoYt.videoDetails.lengthSeconds) >= 1800) {
await reply(`❌ Video file too big!`);
// 60 min
if (Number(infoYt.videoDetails.lengthSeconds) >= 3600) {
await reply(`❌ Cannot download! Video duration limit: 60 min`);
return;
}
const titleYt = infoYt.videoDetails.title;
Expand All @@ -44,7 +44,7 @@ const handler = async (bot: Bot, msg: WAMessage, msgInfoObj: MsgInfoObj) => {
// Convert the file size to megabytes (optional)
const fileSizeInMegabytes = fileSizeInBytes / (1024 * 1024);
console.log(`Video downloaded ! Size: ${fileSizeInMegabytes}`);
if (fileSizeInMegabytes <= 40) {
if (fileSizeInMegabytes <= 100) {
await bot.sendMessage(
from,
{
Expand All @@ -54,7 +54,7 @@ const handler = async (bot: Bot, msg: WAMessage, msgInfoObj: MsgInfoObj) => {
{ quoted: msg }
);
} else {
await reply(`❌ File size bigger than 40mb.`);
await reply(`❌ Cannot download! Video size limit: 100 mb`);
}

fs.unlinkSync(`./${randomFileName}`);
Expand Down

0 comments on commit a1593ed

Please sign in to comment.