File tree 1 file changed +16
-16
lines changed
1 file changed +16
-16
lines changed Original file line number Diff line number Diff line change @@ -95,27 +95,27 @@ package main
95
95
import (
96
96
" fmt"
97
97
" log"
98
- " net/http"
98
+ " net/http"
99
99
100
100
" github.com/PuerkitoBio/goquery"
101
101
)
102
102
103
103
func ExampleScrape () {
104
- // Request the HTML page.
105
- res , err := http.Get (" http://metalsucks.net" )
106
- if err != nil {
107
- log.Fatal (err)
108
- }
109
- defer res.Body .Close ()
110
- if res.StatusCode != 200 {
111
- log.Fatalf (" status code error: %d %s " , res.StatusCode , res.Status )
112
- }
113
-
114
- // Load the HTML document
115
- doc , err := goquery.NewDocumentFromReader (res.Body )
116
- if err != nil {
117
- log.Fatal (err)
118
- }
104
+ // Request the HTML page.
105
+ res , err := http.Get (" http://metalsucks.net" )
106
+ if err != nil {
107
+ log.Fatal (err)
108
+ }
109
+ defer res.Body .Close ()
110
+ if res.StatusCode != 200 {
111
+ log.Fatalf (" status code error: %d %s " , res.StatusCode , res.Status )
112
+ }
113
+
114
+ // Load the HTML document
115
+ doc , err := goquery.NewDocumentFromReader (res.Body )
116
+ if err != nil {
117
+ log.Fatal (err)
118
+ }
119
119
120
120
// Find the review items
121
121
doc.Find (" .sidebar-reviews article .content-block" ).Each (func (i int , s *goquery.Selection ) {
You can’t perform that action at this time.
0 commit comments