diff --git a/src/inc/trigger/parser.mjs b/src/inc/trigger/parser.mjs index ef604db..a35a035 100644 --- a/src/inc/trigger/parser.mjs +++ b/src/inc/trigger/parser.mjs @@ -89,6 +89,17 @@ export default async bot => { // imghure ext = link.split('.').pop(); } + else if(link.match(regex.yt)) { + //yt - fuck anti bot protection + try { + const meta = JSON.parse((await queue.exec(`yt-dlp --proxy ${cfg.main.socks} -f 'bv*[height<=720]+ba/b[height<=720] / wv*+ba/w' --skip-download --dump-json "${link}"`)).stdout); + ext = meta.ext; + } catch(err) { + const tmphead = (await fetch(link, { method: "HEAD" })).headers["content-type"]; + // this can be undefined for unsupported mime types, but will be caught in the general mime check below + ext = cfg.mimes[tmphead]; + } + } else if(link.match(regex.fourchan)) { //4chan - fuck cloudflare :) try {