Khrisna commited on
Commit
ddfe64c
·
verified ·
1 Parent(s): e850adf

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +2 -1
index.js CHANGED
@@ -423,7 +423,8 @@ app.post('/api/youtube/info', async (req, res) => {
423
  if (!status) return res.json({ success: false, message: 'Required an status text!' })
424
 
425
  if(status !== apikey) return res.json({ success: false, message: 'Invalid status!' })
426
- const regex = url.split(/https:\/\/youtu(?:be\.com|\.be\/)/)[1].split("?")[0]
 
427
  const response = await ytdl.getInfo(regex)
428
  res.json({
429
  status: "ok",
 
423
  if (!status) return res.json({ success: false, message: 'Required an status text!' })
424
 
425
  if(status !== apikey) return res.json({ success: false, message: 'Invalid status!' })
426
+ if (!url.split(/https:\/\/(?:youtube\.com\/(?:shorts\/|watch\?v=|watch\?v=|watch\?v=)|youtu\.be\/)([\w-]+)/)[1]) return res.json({ success: false, message: 'Id Video Not Found!!!' })
427
+ const regex = url.split(/https:\/\/(?:youtube\.com\/(?:shorts\/|watch\?v=|watch\?v=|watch\?v=)|youtu\.be\/)([\w-]+)/)[1]
428
  const response = await ytdl.getInfo(regex)
429
  res.json({
430
  status: "ok",