package document_scraper import ( "strings" "tm/internal/tender" ) // documentURL returns the URL used for portal matching and the scraper API payload. func documentURL(t *tender.Tender) string { if t == nil { return "" } if u := strings.TrimSpace(t.DocumentURI); u != "" { return u } return strings.TrimSpace(t.TenderURL) } // matchesScrapePortals reports whether url contains any supported portal identifier. func matchesScrapePortals(url string, portals []string) bool { if url == "" || len(portals) == 0 { return false } urlLower := strings.ToLower(url) for _, portal := range portals { p := strings.TrimSpace(portal) if p != "" && strings.Contains(urlLower, strings.ToLower(p)) { return true } } return false }