mirror of
https://github.com/karust/openserp.git
synced 2026-08-12 20:03:29 +08:00
fix: Remove duplicated results in google/search.go
This commit is contained in:
@@ -281,6 +281,23 @@ func (gogl *Google) Search(query core.Query) ([]core.SearchResult, error) {
|
||||
srchRes.URL = href.String()
|
||||
}
|
||||
|
||||
// Skip if URL is empty or we've already seen this URL
|
||||
if srchRes.URL == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
// Check for duplicates
|
||||
isDuplicate := false
|
||||
for _, existing := range searchResults {
|
||||
if existing.URL == srchRes.URL {
|
||||
isDuplicate = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if isDuplicate {
|
||||
continue
|
||||
}
|
||||
|
||||
// Get description using multiple fallback strategies
|
||||
desc := ""
|
||||
if descTag, err := resEl.Element("div[data-sncf='1'] div"); err == nil {
|
||||
|
||||
Reference in New Issue
Block a user