Files
uptodownbot/internal/domain/sanitize.go
db123 05fcdf7458 feat: initial implementation of uptodownbot
Telegram bot for downloading media from any site using yt-dlp.
Supports audio/video/both, quality selection, language picker,
container format selection, playlist pagination, progress updates,
per-user quotas, user preferences, download history, cancel at any step,
polling and webhook modes, proxy support, and SQLite persistence.
2026-06-25 14:22:48 +03:30

20 lines
378 B
Go

package domain
import (
"net/url"
"strings"
)
// ValidateURL checks if the given string is a valid HTTP(S) URL.
func ValidateURL(raw string) (string, bool) {
raw = strings.TrimSpace(raw)
if raw == "" {
return "", false
}
u, err := url.Parse(raw)
if err != nil || (u.Scheme != "http" && u.Scheme != "https") || u.Host == "" {
return "", false
}
return raw, true
}