Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others


0 votes
in Technique[技术] by (71.8m points)

javascript - (node:4) UnhandledPromiseRejectionWarning: Error: undefined is not a valid uri or options object

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 Sending valid link

but somehow it keeps saying sending that the link is not valid..

does someone know how to fix this?

Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share