google-search
google-search copied to clipboard
fix/searchResult
The search result was empty because the code dont appent the object found if link or title is blank or #
if linkText != "" && linkText != "#" && titleText != "" {
result := Result{
Rank: filteredRank,
URL: linkText,
Title: titleText,
Description: descText,
}
results = append(results, result)
filteredRank += 1
}
After debug the code i found that the titleText wasn't found, so i change the htmlElements structure
titleText := strings.TrimSpace(sel.Find("div > div > div > div > span > a > h3").Text())
Can confirm this fixed it for me as well: had empty search results prior to this change. Thank you @Dionizioaf !
This fix works!