mirror of
https://github.com/abocn/TelegramBot.git
synced 2025-03-10 12:49:57 +00:00
fix: try to fix yt-dlp command (#24)
* gitgnore: Don't commit plugins * youtube: fix for command w/o cookies
This commit is contained in:
parent
43e3d37265
commit
28c2c2b649
1
.gitignore
vendored
1
.gitignore
vendored
@ -137,6 +137,7 @@ lastfm.json
|
|||||||
sw-blocklist.txt
|
sw-blocklist.txt
|
||||||
package-lock.json
|
package-lock.json
|
||||||
tmp/
|
tmp/
|
||||||
|
plugins/
|
||||||
|
|
||||||
# Executables
|
# Executables
|
||||||
*.exe
|
*.exe
|
||||||
|
@ -63,20 +63,18 @@ module.exports = (bot) => {
|
|||||||
const videoUrl = ctx.message.text.split(' ').slice(1).join(' ');
|
const videoUrl = ctx.message.text.split(' ').slice(1).join(' ');
|
||||||
let cookieFlag = "";
|
let cookieFlag = "";
|
||||||
|
|
||||||
if (fs.existsSync(path.resolve(__dirname, "../props/cookies.txt"))) {
|
|
||||||
cookieFlag = "--cookies src/props/cookies.txt";
|
|
||||||
} else {
|
|
||||||
cookieFlag = "";
|
|
||||||
};
|
|
||||||
|
|
||||||
const mp4File = `tmp/${userId}.mp4`;
|
const mp4File = `tmp/${userId}.mp4`;
|
||||||
const tempMp4File = `tmp/${userId}.f137.mp4`;
|
const tempMp4File = `tmp/${userId}.f137.mp4`;
|
||||||
const tempWebmFile = `tmp/${userId}.f251.webm`;
|
const tempWebmFile = `tmp/${userId}.f251.webm`;
|
||||||
const cmdArgs = `--max-filesize 2G --no-playlist ${cookieFlag} --merge-output-format mp4 -o`;
|
let cmdArgs = `--max-filesize 2G --no-playlist --merge-output-format mp4 -o`;
|
||||||
const dlpCommand = ytDlpPath;
|
const dlpCommand = ytDlpPath;
|
||||||
const ffmpegPath = getFfmpegPath();
|
const ffmpegPath = getFfmpegPath();
|
||||||
const ffmpegArgs = ['-i', tempMp4File, '-i', tempWebmFile, '-c:v copy -c:a copy -strict -2', mp4File];
|
const ffmpegArgs = ['-i', tempMp4File, '-i', tempWebmFile, '-c:v copy -c:a copy -strict -2', mp4File];
|
||||||
|
|
||||||
|
if (fs.existsSync(path.resolve(__dirname, "../props/cookies.txt"))) {
|
||||||
|
cmdArgs = "--max-filesize 2G --no-playlist --cookies src/props/cookies.txt --merge-output-format mp4 -o";
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const downloadingMessage = await ctx.reply(Strings.ytCheckingSize, {
|
const downloadingMessage = await ctx.reply(Strings.ytCheckingSize, {
|
||||||
parse_mode: 'Markdown',
|
parse_mode: 'Markdown',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user