Compare commits
No commits in common. "64c45f87c047aa30c823ee3bc830f38fa13717bd" and "7ad4618dd0169a2825eb433a2edea240ba1f6103" have entirely different histories.
64c45f87c0
...
7ad4618dd0
3 changed files with 4 additions and 31 deletions
|
@ -61,12 +61,7 @@ export default {
|
||||||
|
|
||||||
if (format) {
|
if (format) {
|
||||||
let qualitys = await new Promise((resolve, reject) => {
|
let qualitys = await new Promise((resolve, reject) => {
|
||||||
const options = [url, '--print', '%()j'];
|
execFile('./bin/yt-dlp', [proxy ? '--proxy' : '', proxy ? proxy : '', url, '--print', '%()j'], (err, stdout, stderr) => {
|
||||||
if (proxy) {
|
|
||||||
options.push('--proxy');
|
|
||||||
options.push(proxy);
|
|
||||||
};
|
|
||||||
execFile('./bin/yt-dlp', options, (err, stdout, stderr) => {
|
|
||||||
if (err) {
|
if (err) {
|
||||||
reject(stderr);
|
reject(stderr);
|
||||||
}
|
}
|
||||||
|
@ -316,12 +311,7 @@ async function checkSize(url, format, args, interaction, tries = 0) {
|
||||||
|
|
||||||
async function getVideoDescription(urlArg) {
|
async function getVideoDescription(urlArg) {
|
||||||
return await new Promise((resolve, reject) => {
|
return await new Promise((resolve, reject) => {
|
||||||
const options = [urlArg, '--no-warnings', '-O', '%(description)s'];
|
execFile('./bin/yt-dlp', [proxy ? '--proxy' : '', proxy ? proxy : '', urlArg, '--no-warnings', '-O', '%(description)s'], (err, stdout, stderr) => {
|
||||||
if (proxy) {
|
|
||||||
options.push('--proxy');
|
|
||||||
options.push(proxy);
|
|
||||||
};
|
|
||||||
execFile('./bin/yt-dlp', options, (err, stdout, stderr) => {
|
|
||||||
if (err) {
|
if (err) {
|
||||||
reject(stderr);
|
reject(stderr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,13 +63,6 @@ export default {
|
||||||
return interaction.editReply({ content: '❌ This does not look like a valid url!', ephemeral: true });
|
return interaction.editReply({ content: '❌ This does not look like a valid url!', ephemeral: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
const aproxFileSize = await utils.getVideoSize(url, 'bestvideo[height<=?480]');
|
|
||||||
console.log(aproxFileSize);
|
|
||||||
|
|
||||||
if (aproxFileSize > 4) {
|
|
||||||
return interaction.editReply('The file you are trying to convert is too big! Limit is 4 MB');
|
|
||||||
};
|
|
||||||
|
|
||||||
utils.downloadVideo(url, interaction.id)
|
utils.downloadVideo(url, interaction.id)
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
const file = fs.readdirSync(os.tmpdir()).filter(fn => fn.startsWith(interaction.id));
|
const file = fs.readdirSync(os.tmpdir()).filter(fn => fn.startsWith(interaction.id));
|
||||||
|
|
|
@ -15,12 +15,7 @@ export default {
|
||||||
};
|
};
|
||||||
async function downloadVideo(urlArg, output, format = `bestvideo[height<=?${ytdlpMaxResolution}]+bestaudio/best`) {
|
async function downloadVideo(urlArg, output, format = `bestvideo[height<=?${ytdlpMaxResolution}]+bestaudio/best`) {
|
||||||
await new Promise((resolve, reject) => {
|
await new Promise((resolve, reject) => {
|
||||||
const options = ['-f', format, urlArg, '-o', `${os.tmpdir()}/${output}.%(ext)s`, '--force-overwrites', '--no-playlist', '--remux-video=mp4/webm/mov', '--no-warnings'];
|
execFile('./bin/yt-dlp', [proxy ? '--proxy' : '', proxy ? proxy : '', '-f', format, urlArg, '-o', `${os.tmpdir()}/${output}.%(ext)s`, '--force-overwrites', '--no-playlist', '--remux-video=mp4/webm/mov', '--no-warnings'], (err, stdout, stderr) => {
|
||||||
if (proxy) {
|
|
||||||
options.push('--proxy');
|
|
||||||
options.push(proxy);
|
|
||||||
};
|
|
||||||
execFile('./bin/yt-dlp', options, (err, stdout, stderr) => {
|
|
||||||
if (err) {
|
if (err) {
|
||||||
return reject(stderr);
|
return reject(stderr);
|
||||||
}
|
}
|
||||||
|
@ -104,12 +99,7 @@ async function getVideoCodec(input) {
|
||||||
|
|
||||||
async function getVideoSize(urlArg, format = `bestvideo[height<=?${ytdlpMaxResolution}]+bestaudio/best`) {
|
async function getVideoSize(urlArg, format = `bestvideo[height<=?${ytdlpMaxResolution}]+bestaudio/best`) {
|
||||||
return await new Promise((resolve, reject) => {
|
return await new Promise((resolve, reject) => {
|
||||||
const options = [urlArg, '-f', format, '--no-warnings', '-O', '%(filesize,filesize_approx)s'];
|
execFile('./bin/yt-dlp', [proxy ? '--proxy' : '', proxy ? proxy : '', urlArg, '-f', format, '--no-warnings', '-O', '%(filesize,filesize_approx)s'], (err, stdout, stderr) => {
|
||||||
if (proxy) {
|
|
||||||
options.push('--proxy');
|
|
||||||
options.push(proxy);
|
|
||||||
};
|
|
||||||
execFile('./bin/yt-dlp', options, (err, stdout, stderr) => {
|
|
||||||
if (err) {
|
if (err) {
|
||||||
reject(stderr);
|
reject(stderr);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue