Updated Node to v20 (blake2 incompatible with newer versions), replaced youtube-dl with youtube-dl-exec.
This commit is contained in:
@@ -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,
|
||||
},
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user