(url: string)
| 14 | } |
| 15 | |
| 16 | export function getVideoId(url: string) { |
| 17 | if (isYoutubeShortUrl(url)) { |
| 18 | return url.split('/').pop(); |
| 19 | } |
| 20 | if (isYoutubeWatchUrl(url)) { |
| 21 | const params = new URLSearchParams(url.split('?')[1]); |
| 22 | return params.get('v'); |
| 23 | } |
| 24 | return null; |
| 25 | } |
no test coverage detected