コード例 #1
0
ファイル: scrape.go プロジェクト: GrenderG/drae
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
}
コード例 #2
0
ファイル: textextract.go プロジェクト: Gelembjuk/articletext
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
}