antchfx/htmlquery

Is it a bug?

Protoculos opened this issue · 1 comments

`func main() {

doc, err := htmlquery.LoadURL(`http://episcopia-ungheni.md/ru/fara-categorie-ru/%d0%b0%d0%ba%d0%b0%d1%84%d0%b8%d1%81%d1%82%d0%bd%d0%be%d0%b5-%d0%bf%d0%b5%d0%bd%d0%b8%d0%b5-%d0%bf%d0%b5%d1%80%d0%b5%d0%b4-%d0%b8%d0%ba%d0%be%d0%bd%d0%be%d0%b9-%d0%b1%d0%be%d0%b6%d0%b8%d0%b5%d0%b9-5/`)
if err != nil {
	log.Println(err)
}
for i, v := range htmlquery.Find(doc, `//*[contains(@class,"gallery")]//a/@href`) {
	t := htmlquery.InnerText(v)
	fmt.Println(i, strings.TrimSpace(t))
}

}`

In other programs I got 1 url.
And this I got 4 same urls.
From source code it's 1 url.

Actually, it is not a bug, but it maybe become a problem. //*[contains(@class,"gallery")] matches 4 elements that all including a element. The tmlquery.Find method not remove all duplicate element, we will improve this method.
Thanks for the feedback.