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) {
|
||||
let qualitys = await new Promise((resolve, reject) => {
|
||||
const options = [url, '--print', '%()j'];
|
||||
if (proxy) {
|
||||
options.push('--proxy');
|
||||
options.push(proxy);
|
||||
};
|
||||
execFile('./bin/yt-dlp', options, (err, stdout, stderr) => {
|
||||
execFile('./bin/yt-dlp', [proxy ? '--proxy' : '', proxy ? proxy : '', url, '--print', '%()j'], (err, stdout, stderr) => {
|
||||
if (err) {
|
||||
reject(stderr);
|
||||
}
|
||||
|
@ -316,12 +311,7 @@ async function checkSize(url, format, args, interaction, tries = 0) {
|
|||
|
||||
async function getVideoDescription(urlArg) {
|
||||
return await new Promise((resolve, reject) => {
|
||||
const options = [urlArg, '--no-warnings', '-O', '%(description)s'];
|
||||
if (proxy) {
|
||||
options.push('--proxy');
|
||||
options.push(proxy);
|
||||
};
|
||||
execFile('./bin/yt-dlp', options, (err, stdout, stderr) => {
|
||||
execFile('./bin/yt-dlp', [proxy ? '--proxy' : '', proxy ? proxy : '', urlArg, '--no-warnings', '-O', '%(description)s'], (err, stdout, stderr) => {
|
||||
if (err) {
|
||||
reject(stderr);
|
||||
}
|
||||
|
|
|
@ -63,13 +63,6 @@ export default {
|
|||
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)
|
||||
.then(async () => {
|
||||
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`) {
|
||||
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'];
|
||||
if (proxy) {
|
||||
options.push('--proxy');
|
||||
options.push(proxy);
|
||||
};
|
||||
execFile('./bin/yt-dlp', options, (err, stdout, stderr) => {
|
||||
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 (err) {
|
||||
return reject(stderr);
|
||||
}
|
||||
|
@ -104,12 +99,7 @@ async function getVideoCodec(input) {
|
|||
|
||||
async function getVideoSize(urlArg, format = `bestvideo[height<=?${ytdlpMaxResolution}]+bestaudio/best`) {
|
||||
return await new Promise((resolve, reject) => {
|
||||
const options = [urlArg, '-f', format, '--no-warnings', '-O', '%(filesize,filesize_approx)s'];
|
||||
if (proxy) {
|
||||
options.push('--proxy');
|
||||
options.push(proxy);
|
||||
};
|
||||
execFile('./bin/yt-dlp', options, (err, stdout, stderr) => {
|
||||
execFile('./bin/yt-dlp', [proxy ? '--proxy' : '', proxy ? proxy : '', urlArg, '-f', format, '--no-warnings', '-O', '%(filesize,filesize_approx)s'], (err, stdout, stderr) => {
|
||||
if (err) {
|
||||
reject(stderr);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue