Updated Node to v20 (blake2 incompatible with newer versions), replaced youtube-dl with youtube-dl-exec.

This commit is contained in:
2025-11-28 01:15:59 +01:00
parent 508df69808
commit 5923bb00bc
4 changed files with 13 additions and 480 deletions

View File

@@ -1,21 +1,18 @@
'use strict';
const youtubedl = require('youtube-dl');
const youtubedl = require('youtube-dl-exec');
const dateFns = require('date-fns');
const logger = require('../logger')(__filename);
async function tube(host, post) {
try {
const data = await new Promise((resolve, reject) => {
youtubedl.getInfo(host.url, null, (error, info) => {
if (error) {
reject(error);
}
resolve(info);
});
});
const data = await youtubedl(host.url, {
dumpSingleJson: true,
noCheckCertificates: true,
noWarnings: true,
preferFreeFormats: false,
});
host.id = data.display_id; // eslint-disable-line no-param-reassign
@@ -28,7 +25,7 @@ async function tube(host, post) {
title: data.fulltitle || data.title,
description: data.description,
type: `video/${data.ext}`,
datetime: dateFns.format(data.upload_date, 'YYYYMMDD'),
datetime: dateFns.parse(data.upload_date, 'YYYYMMDD'),
original: data,
},
],