Video URL Validator
A Rust crate for validating video URLs from popular platforms.
Supported Platforms
- 🎬 YouTube - youtube.com, youtu.be
- 📘 Facebook - facebook.com/videos
- 🎭 Vimeo - vimeo.com
- 🎪 DailyMotion - dailymotion.com, dai.ly
- 🎯 Wistia - wistia.com
Installation
Add this to your Cargo.toml:
[]
= "0.1.0"
Quick Start
use ;
let validator = new;
// Validate specific platform
if validator.validate_youtube_video_url
// Auto-detect platform
match validator.validate_video_url
// Batch validation
let urls = ;
let results = validator.validate_multiple;
API Reference
Core Methods
- validate_youtube_video_url(url: &str) -> bool
- validate_facebook_video_url(url: &str) -> bool
- validate_vimeo_video_url(url: &str) -> bool
- validate_dailymotion_video_url(url: &str) -> bool
- validate_wistia_video_url(url: &str) -> bool
- validate_video_url(url: &str) -> Option
- is_valid_video_url(url: &str) -> bool
- validate_multiple(urls: &[&str]) -> Vec<(String, Option)>
Utility Functions
- extract_youtube_id(url: &str) -> Option
- extract_vimeo_id(url: &str) -> Option
- normalize_url(url: &str) -> String
Examples
Run the example:
Testing
# Run all tests
# Run with output
# Run specific test
License
MIT License Copyright 2015 BhavikLimani
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.