Added support for various tube and social media sites via youtube-dl.

This commit is contained in:
2024-09-11 05:16:58 +02:00
parent 17c7acd6a2
commit 6e3bfdd175
13 changed files with 209 additions and 93 deletions
+2 -2
View File
@@ -4,7 +4,7 @@ const config = require('config');
const bhttp = require('bhttp');
const blake2 = require('blake2');
async function fetchItem(url, attempt, post) {
async function fetchItem(url, attempt, post, host) {
async function retry(error) {
console.log('\x1b[31m%s\x1b[0m', `Failed to fetch '${url}': ${error.message} (${post ? post.permalink : 'no post'})`);
@@ -24,7 +24,7 @@ async function fetchItem(url, attempt, post) {
throw new Error(`Response not OK for '${url}', HTTP code '${res.status}'`);
}
console.log(`Fetched '${url}' (${post ? post.permalink : 'no post'})`);
console.log(`Fetched '${host.url}' (${post ? post.permalink : 'no post'})`);
const hash = blake2.createHash('blake2b', { digestLength: 24 });
hash.update(res.body);