google-search icon indicating copy to clipboard operation
google-search copied to clipboard

fix/searchResult

Open Dionizioaf opened this issue 2 years ago • 2 comments

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())

Dionizioaf avatar Sep 11 '23 19:09 Dionizioaf

Can confirm this fixed it for me as well: had empty search results prior to this change. Thank you @Dionizioaf !

dbedrenko avatar Mar 24 '24 21:03 dbedrenko

This fix works!

TheKayNelson avatar Apr 03 '24 08:04 TheKayNelson