Restore video search base URL handling
build-push / docker (push) Successful in 4m17s

This commit is contained in:
GHStaK
2026-03-24 17:12:41 +09:00
parent 73d820ddaa
commit e3dbedc59f
3 changed files with 31 additions and 1 deletions
+12 -1
View File
@@ -63,7 +63,7 @@ func NewSearchService(baseURL, googleVideoEngine, webEngine string) *SearchServi
webEngine = "google"
}
return &SearchService{
BaseURL: strings.TrimRight(baseURL, "/"),
BaseURL: normalizeBaseURL(baseURL),
GoogleVideoEngine: googleVideoEngine,
WebEngine: webEngine,
Client: &http.Client{Timeout: 20 * time.Second},
@@ -77,6 +77,17 @@ func NewSearchService(baseURL, googleVideoEngine, webEngine string) *SearchServi
}
}
func normalizeBaseURL(raw string) string {
trimmed := strings.TrimSpace(raw)
if trimmed == "" {
return ""
}
if !strings.Contains(trimmed, "://") {
trimmed = "http://" + trimmed
}
return strings.TrimRight(trimmed, "/")
}
func (s *SearchService) SearchMedia(queries []string, enabledPlatforms map[string]bool) ([]SearchResult, SearchExecutionMeta, error) {
return s.SearchMediaWithDeadline(queries, enabledPlatforms, time.Time{})
}