badoux / goscraper

Golang pkg to quickly return a preview of a webpage (title/description/images)
MIT License
108 stars 38 forks source link

Nil values after using scraper (err == nil) #11

Closed juan-carvajal closed 4 years ago

juan-carvajal commented 4 years ago

func GetHTMLInfo(url string) (string, string,error) { url = "http://" + url s, err := goscraper.Scrape(url, 5) if err != nil { fmt.Println(err) } fmt.Println(s) return s.Preview.Icon, s.Preview.Title,err } For some domains, calling this function can cause s to be nil, err will not detect it. Test: likexian.com

juan-carvajal commented 4 years ago

Sorry, apparently the err was turning out to be different than nil, but I was not handling it correctly.