Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.8k views
Welcome To Ask or Share your Answers For Others

1 Answer

等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...