Spaces:
Paused
Paused
Update index.js
Browse files
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 |
-
|
|
|
|
| 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",
|