youtube-video-exists
Checks if a YouTube video exists under the given ID. No API key is required.
How does it work?
Firstly the video id is checked against a regular expression if it is in a valid format. When this check succedes the YouTube oEmbed API is used to see if a video is present under the given ID. This requires no API key and might be the best option to receive this information without one.
API
getVideoInfo
Checks if a YouTube video exists under the given ID. When a video is found the return object also includes the title and author of the video
Parameters
- id: string - YouTube video id
Returns
- VideoInfoResponse when Promise is resolved
Example
Throws
- AxiosError when a network issue occurred
Usage
Check if the video exists
Async
getVideoInfo'M7lc1UVf-VE'.then
Blocked
Check if the video is private
Async
getVideoInfo'ZFxT6d13OKo'.then
Blocked
License
Licensed under the MIT License.