We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
i want get the price (follow red frame)
c.OnHTML("div[id=price]", func(e *colly.HTMLElement) { fmt.Printf("test----%+v\n",e) price,err := strconv.ParseFloat(e.Text,64) //price := e.Text fmt.Printf("********* price----%+v\n",price) if err != nil { fmt.Printf("parse err---%+v\n",err) } })
then Print
test----&{Name:div Text:@now@ attributes:[{Namespace: Key:id Val:price} {Namespace: Key:class Val:@UD_change@}] Request:0xc00013c280 Response:0xc000354240 DOM:0xc000558180 Index:0} ********* price----0 parse err---strconv.ParseFloat: parsing "@now@": invalid syntax
The text was updated successfully, but these errors were encountered:
somehow it's getting wrong element's value. you can try to get value by css selector way like this;
c.OnHTML("div.price.clearfix > div.change > div.up", func(e *colly.HTMLElement) { fmt.Printf("test----%+v\n",e) price,err := strconv.ParseFloat(e.Text ,64) //price := e.Text fmt.Printf("********* price----%+v\n",price) if err != nil { fmt.Printf("parse err---%+v\n",err) } })
Sorry, something went wrong.
No branches or pull requests
i want get the price (follow red frame)
then Print
The text was updated successfully, but these errors were encountered: