https://github.com/bcomnes/is-youtube-url
https://github.com/bcomnes/is-youtube-url
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/bcomnes/is-youtube-url
- Owner: bcomnes
- License: mit
- Created: 2024-11-24T22:58:39.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-09-08T22:14:16.000Z (10 months ago)
- Last Synced: 2025-09-30T20:55:29.260Z (9 months ago)
- Language: JavaScript
- Size: 47.9 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/funding.yml
- License: LICENSE
Awesome Lists containing this project
README
# @bret/is-youtube-url
[](https://www.npmjs.com/package/@bret/is-youtube-url)
[](https://github.com/bcomnes/is-youtube-url/actions)
[](https://npmtrends.com/@bret/is-youtube-url)

[](https://github.com/neostandard/neostandard)
[](https://socket.dev/npm/package/@bret/is-youtube-url)
Check if a given URL belongs to YouTube or Google Video domains.
## Installation
```bash
npm install @bret/is-youtube-url
```
## Usage
```javascript
import isYouTubeUrl from '@bret/is-youtube-url';
const url = new URL('https://www.youtube.com/watch?v=dQw4w9WgXcQ');
console.log(isYouTubeUrl(url)); // true
const invalidUrl = new URL('https://www.example.com');
console.log(isYouTubeUrl(invalidUrl)); // false
```
## API
### `isYouTubeUrl(parsedUrl)`
#### Parameters:
- `parsedUrl` (URL): A valid `URL` object that has already been validated.
#### Returns:
- `boolean`: `true` if the URL belongs to YouTube or Google Video domains, otherwise `false`.
### Supported Domains:
- `www.youtube.com`
- `youtube.com`
- `m.youtube.com`
- `youtu.be`
- `youtube-nocookie.com`
- `googlevideo.com`
## License
MIT