File tree Expand file tree Collapse file tree 1 file changed +17
-17
lines changed
Expand file tree Collapse file tree 1 file changed +17
-17
lines changed Original file line number Diff line number Diff line change @@ -28,23 +28,23 @@ import (
2828## Example
2929Heres an example of fetching a website and parsing and then using querying methods.
3030``` go
31- res , err := http.Get (" https://www.metalsucks.net/" )
32- if err != nil {
33- t.Fatal (err)
34- }
35- defer res.Body .Close ()
36-
37- // Parses the given html reader and then returns the root node and an error.
38- node , err := GoHtml .Decode (res.Body )
39- if err != nil {
40- t.Fatal (err)
41- }
42-
43- nodeList := node.GetElementsByClassName (" post-title" )
44- iter := nodeList.IterNodeList ()
45- for node := range iter{
46- print (node.GetInnerText ())
47- }
31+ res , err := http.Get (" https://www.metalsucks.net/" )
32+ if err != nil {
33+ t.Fatal (err)
34+ }
35+ defer res.Body .Close ()
36+
37+ // Parses the given html reader and then returns the root node and an error.
38+ node , err := GoHtml .Decode (res.Body )
39+ if err != nil {
40+ t.Fatal (err)
41+ }
42+
43+ nodeList := node.GetElementsByClassName (" post-title" )
44+ iter := nodeList.IterNodeList ()
45+ for node := range iter{
46+ print (node.GetInnerText ())
47+ }
4848```
4949
5050## Changelog
You can’t perform that action at this time.
0 commit comments