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.
This commit is contained in:
26
internal/domain/sanitize_test.go
Normal file
26
internal/domain/sanitize_test.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package domain
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestValidateURL(t *testing.T) {
|
||||
tests := []struct {
|
||||
input string
|
||||
want string
|
||||
ok bool
|
||||
}{
|
||||
{"https://www.youtube.com/watch?v=123", "https://www.youtube.com/watch?v=123", true},
|
||||
{"http://example.com/video", "http://example.com/video", true},
|
||||
{"https://vimeo.com/123456", "https://vimeo.com/123456", true},
|
||||
{"https://www.pornhub.com/view_video.php?viewkey=123", "https://www.pornhub.com/view_video.php?viewkey=123", true},
|
||||
{"", "", false},
|
||||
{"not a url", "", false},
|
||||
{"ftp://example.com", "", false},
|
||||
{" https://example.com ", "https://example.com", true},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
got, ok := ValidateURL(tt.input)
|
||||
if ok != tt.ok || (ok && got != tt.want) {
|
||||
t.Errorf("ValidateURL(%q) = (%q, %v), want (%q, %v)", tt.input, got, ok, tt.want, tt.ok)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user