{/* Header Section */}
{/* Input Section */}
Error
{error}
)}
{/* Instructions */}
{/* Features Section */}
{/* Disclaimer */}
)
}
"use client"
import { useState } from "react"
import { AlertCircle } from "lucide-react"
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"
import { Button } from "@/components/ui/button"
import { Input } from "@/components/ui/input"
export default function YouTubeDownloader() {
const [url, setUrl] = useState("")
const [error, setError] = useState("")
const [loading, setLoading] = useState(false)
const validateYouTubeUrl = (url: string) => {
const pattern = /^(https?:\/\/)?(www\.)?(youtube\.com|youtu\.be)\/.+$/
return pattern.test(url)
}
const handleDownload = async () => {
setError("")
if (!url) {
setError("Please enter a YouTube URL")
return
}
if (!validateYouTubeUrl(url)) {
setError("Please enter a valid YouTube URL")
return
}
setLoading(true)
try {
// Here you would typically make an API call to your download service
await new Promise((resolve) => setTimeout(resolve, 1500)) // Simulated delay
// For demo purposes, we'll just show an alert
alert("Download started! (Demo only)")
} catch (err) {
setError("An error occurred while processing your request")
} finally {
setLoading(false)
}
}
return (
YouTube Video Downloader
Download your favorite YouTube videos in different formats
setUrl(e.target.value)}
placeholder="Paste YouTube URL here..."
className="w-full px-4 py-3 border-2 border-gray-200 rounded-lg focus:border-red-500 focus:outline-none"
/>
{/* Error Message */}
{error && (
How to Download:
- Copy the YouTube video URL
- Paste the URL in the input box above
- Click the Download button
- Select your preferred quality and format
- Click Download to save your video
Multiple Formats
Download in MP4, MP3, and more formats
High Quality
Support for HD and 4K quality videos
Fast Download
Quick and efficient downloading process
This tool is for personal use only. Please respect YouTube's terms of service and copyright laws.
YouTube Video Downloader
Download your favorite YouTube videos in different formats
setUrl(e.target.value)}
placeholder="Paste YouTube URL here..."
className="flex-grow"
/>
{error && (
How to Download:
- Copy the YouTube video URL
- Paste the URL in the input box above
- Click the Download button
- Select your preferred quality and format
- Click Download to save your video
Multiple Formats
Download in MP4, MP3, and more formats
High Quality
Support for HD and 4K quality videos
Fast Download
Quick and efficient downloading process
This tool is for personal use only. Please respect YouTube's terms of service and copyright laws.
No comments:
Post a Comment