mirror of
https://github.com/YuzuZensai/play-dl-test.git
synced 2026-01-06 04:32:40 +00:00
Error Fixes
This commit is contained in:
@@ -4,11 +4,10 @@ import { Video } from '../classes/Video'
|
||||
import { PlayList } from '../classes/Playlist'
|
||||
|
||||
const DEFAULT_API_KEY = "AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8";
|
||||
const youtube_url = /https:\/\/www.youtube.com\//g
|
||||
const video_pattern = /^((?:https?:)?\/\/)?((?:www|m)\.)?((?:youtube\.com|youtu.be))(\/(?:[\w\-]+\?v=|embed\/|v\/)?)([\w\-]+)(\S+)?$/;
|
||||
const video_pattern = /^((?:https?:)?\/\/)?:(?:(?:www|m)\.)?((?:youtube\.com|youtu.be))(\/(?:[\w\-]+\?v=|embed\/|v\/)?)([\w\-]+)(\S+)?$/;
|
||||
|
||||
export async function video_basic_info(url : string){
|
||||
if(!url.match(youtube_url) || !url.match(video_pattern)) throw new Error('This is not a YouTube URL')
|
||||
if(!url.match(video_pattern)) throw new Error('This is not a YouTube URL')
|
||||
let video_id = url.split('watch?v=')[1].split('&')[0]
|
||||
let new_url = 'https://www.youtube.com/watch?v=' + video_id
|
||||
let body = await url_get(new_url)
|
||||
|
||||
Reference in New Issue
Block a user