Merge pull request 'feat(youtube): çerez varlığına göre ekstraktör argümanlarını otomatik belirle' (#6) from develope into main
Reviewed-on: #6
This commit is contained in:
@@ -77,7 +77,7 @@ const YT_COOKIES_PATH =
|
||||
process.env.YT_DLP_COOKIE_FILE ||
|
||||
path.join(CACHE_DIR, "yt_cookies.txt");
|
||||
const YT_EXTRACTOR_ARGS =
|
||||
process.env.YT_DLP_EXTRACTOR_ARGS || "youtube:player-client=android";
|
||||
process.env.YT_DLP_EXTRACTOR_ARGS || null;
|
||||
let resolvedYtDlpBinary = null;
|
||||
const TMDB_API_KEY = process.env.TMDB_API_KEY;
|
||||
const TMDB_BASE_URL = "https://api.themoviedb.org/3";
|
||||
@@ -740,22 +740,16 @@ function appendYoutubeLog(job, line) {
|
||||
|
||||
function launchYoutubeJob(job) {
|
||||
const binary = getYtDlpBinary();
|
||||
const jsRuntimeValue =
|
||||
process.env.YT_DLP_JS_RUNTIME ||
|
||||
process.env.NODE_BIN ||
|
||||
"/usr/bin/node";
|
||||
let jsRuntimeArg = jsRuntimeValue;
|
||||
if (jsRuntimeValue && jsRuntimeValue.includes("=")) {
|
||||
jsRuntimeArg = jsRuntimeValue;
|
||||
} else if (jsRuntimeValue && jsRuntimeValue.includes(path.sep)) {
|
||||
// Eğer yol verilmişse node=<path> formatına çevir
|
||||
jsRuntimeArg = `node=${jsRuntimeValue}`;
|
||||
}
|
||||
const jsRuntimeArg = process.env.YT_DLP_JS_RUNTIME || "node";
|
||||
|
||||
const cookieFile =
|
||||
(YT_COOKIES_PATH && fs.existsSync(YT_COOKIES_PATH) && YT_COOKIES_PATH) ||
|
||||
null;
|
||||
|
||||
const extractorArgValue =
|
||||
YT_EXTRACTOR_ARGS ||
|
||||
(cookieFile ? "youtube:player-client=web" : "youtube:player-client=android");
|
||||
|
||||
const args = [
|
||||
"-f",
|
||||
"bv+ba/b",
|
||||
@@ -766,7 +760,7 @@ function launchYoutubeJob(job) {
|
||||
"--js-runtime",
|
||||
jsRuntimeArg,
|
||||
"--extractor-args",
|
||||
YT_EXTRACTOR_ARGS,
|
||||
extractorArgValue,
|
||||
...(cookieFile && fs.existsSync(cookieFile)
|
||||
? ["--cookies", cookieFile]
|
||||
: []),
|
||||
@@ -778,7 +772,7 @@ function launchYoutubeJob(job) {
|
||||
logs: [],
|
||||
jsRuntime: jsRuntimeArg,
|
||||
cookies: cookieFile,
|
||||
extractorArgs: YT_EXTRACTOR_ARGS
|
||||
extractorArgs: extractorArgValue
|
||||
};
|
||||
const child = spawn(binary, args, {
|
||||
cwd: job.savePath,
|
||||
|
||||
Reference in New Issue
Block a user