bot.onText(//igdl (.+)/i, async(msg, match) => {
// 'msg' is the received Message from Telegram
// 'match' is the result of executing the regexp above on the text content
// of the message
console.log("igdl command was executed")
const chatId = msg.chat.id;
const resp = match[1]; // the captured "whatever
request(resp, async (error, response, html) => {
let $ = cheerio.load(html);
url = $('meta[property="og:url"]').attr('content');
title = $('meta[property="og:title"]').attr('content');
video_link = $('meta[property="og:video"]').attr('content');
bot.sendMessage(chatId,"Title : " + title)
bot.sendMessage(chatId,"Video Link : " + video_link)
const fileOptions = {filename: title,};
const file = await request(video_link)
bot.sendVideo(chatId,file, {}, fileOptions)
})
});
So I've sent a command that with "AN VALID LINK"
Like this
but somehow it keeps saying sending that the link is not valid..
does someone know how to fix this?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…