dom, _ := goquery.NewDocumentFromReader(strings.NewReader(html))
dom.Find("tr").EachWithBreak(func(i int, s *goquery.Selection) bool { _title := s.Find("a").Eq(0).Text() _author := s.Find("td").Eq(2).Text() if _title == name && _author == author { url, exists := s.Find("a").Eq(0).Attr("href") if !exists { Err = nil log.Fatal(exists) } targetUrl = url } return true })
|