hopefully fixed youtube-dlc by updating to the latest version and specifying mp4 as the hardcoded extension for youtube, removing youtube-dl not working line from how.html, adding some css to the item page to make it more amoled!

This commit is contained in:
Flummi
2020-11-04 15:19:34 +01:00
parent 98f613237e
commit b1a62bf651
4 changed files with 35 additions and 12 deletions

View File

@ -43,16 +43,16 @@ export default async bot => {
const uuid = (await sql.query("select left(uuid(), 8) as uuid"))[0].uuid;
// read metadata
const meta = JSON.parse((await exec(`youtube-dl --skip-download --dump-json "${link}"`)).stdout);
const meta = JSON.parse((await exec(`youtube-dlc --skip-download --dump-json "${link}"`)).stdout);
const filename = `${uuid}.${meta.ext}`;
const filename = `${uuid}.mp4`;
e.reply(`downloading ${filename}...`);
// download data
const start = new Date();
const maxfilesize = getLevel(e.user).level > 50 ? cfg.main.maxfilesize * 2.5 : cfg.main.maxfilesize;
const source = (await exec(`youtube-dl "${link}" --max-filesize ${maxfilesize} -o ./tmp/${filename}`)).stdout.trim();
const source = (await exec(`youtube-dlc "${link}" -f "bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best" --max-filesize ${maxfilesize} -o ./tmp/${filename}`)).stdout.trim();
if(source.match(/larger than/))
return e.reply("too large lol");
const end = ~~((new Date() - start) / 1e3);
@ -80,7 +80,7 @@ export default async bot => {
);
// generate thumbnail
let thumb_orig = (await exec(`youtube-dl --get-thumbnail "${link}"`)).stdout.trim();
let thumb_orig = (await exec(`youtube-dlc --get-thumbnail "${link}"`)).stdout.trim();
if(!thumb_orig.startsWith("http")) {
if(mime.startsWith("image") && mime !== "image/gif")
thumb_orig = `./public/b/${filename}`;