Example #1
0
func ScrapeNotes(s *goquery.Selection) []string {
	notes := []string{}
	s.Clone().Find("span[title]").First().Remove().End().End().Find("span.d i span.d[title]").Remove().End().Find("span.d[title]").Each(func(i int, s *goquery.Selection) {
		note, _ := s.Attr("title")
		notes = append(notes, note)
	})
	return notes
}
Example #2
0
func getSelectionWihoutChildren(s *goquery.Selection) *goquery.Selection {
	clone := s.Clone()

	// remove all child nodes in this selection
	clone.Children().Each(func(i int, sec *goquery.Selection) {
		sec.Remove()
	})

	return clone
}