Skip to content

Commit 12b09cc

Browse files
committed
use yt-dlp if its installed
1 parent b804a68 commit 12b09cc

File tree

3 files changed

+78
-5
lines changed

3 files changed

+78
-5
lines changed

lib/uploading/importer.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const webp = require('webp-converter');
55
const youtubedl = require('youtube-dl');
66
const spawn = require('child_process').spawn;
77
const mongoose = require('mongoose');
8-
8+
const which = require('which')
99

1010
const redisClient = require('../../config/redis');
1111

@@ -43,7 +43,11 @@ const ffmpegPath = require('@ffmpeg-installer/ffmpeg').path;
4343

4444
console.log(`ffmpeg path: ${ffmpegPath}`);
4545

46-
const youtubeBinaryFilePath = youtubedl.getYtdlBinary();
46+
let youtubeBinaryFilePath = youtubedl.getYtdlBinary();
47+
const ytdlpPath = which.sync('yt-dlp', {nothrow: true})
48+
if(ytdlpPath){
49+
youtubeBinaryFilePath = ytdlpPath
50+
}
4751

4852
console.log(`youtube-dl binary path: ${youtubeBinaryFilePath}`);
4953

package-lock.json

Lines changed: 71 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@
127127
"web-push": "^3.4.4",
128128
"webhook-discord": "^3.5.1",
129129
"webp-converter": "^2.3.0",
130+
"which": "^2.0.2",
130131
"winston": "^3.2.1",
131132
"ws": "^3.3.3",
132133
"youtube-dl": "github:mayeaux/workingyoutubedl",

0 commit comments

Comments
 (0)