From 87db8870725124f4dba52da8b0297222842f9ae3 Mon Sep 17 00:00:00 2001 From: jay Date: Fri, 21 Sep 2018 08:38:49 +0800 Subject: [PATCH] add debug log --- module/background/facebook.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/module/background/facebook.go b/module/background/facebook.go index a46b52f..ec177a4 100644 --- a/module/background/facebook.go +++ b/module/background/facebook.go @@ -39,6 +39,7 @@ func (pd byTime) Less(i, j int) bool { return pd[i].Time < pd[j].Time } func readFacebookPage() { pages, err := model.GetAllFacebookPage() if err != nil { + fmt.Println("get page data err ", err) return } @@ -50,16 +51,19 @@ func readFacebookPage() { func getPageHTML(page *model.FacebookPage) { err := page.GetGroups() if err != nil { + fmt.Println("get page group err ", err) return } resp, err := http.Get(fmt.Sprintf("https://www.facebook.com/%s", page.ID)) if err != nil { + fmt.Println("get page html err ", err) return } defer resp.Body.Close() doc, err := goquery.NewDocumentFromReader(resp.Body) if err != nil { + fmt.Println("parse doc err ", err) return } @@ -68,10 +72,12 @@ func getPageHTML(page *model.FacebookPage) { timeEl := s.Find("abbr") time, timeExists := timeEl.Attr("data-utime") if !timeExists { + fmt.Println("time not found") return } link, linkExists := timeEl.Parent().Attr("href") if !linkExists { + fmt.Println("link not found") return } postContent := s.Find("div.userContent") @@ -88,6 +94,7 @@ func getPageHTML(page *model.FacebookPage) { } } if !idFlag { + fmt.Println("id not found") return } } @@ -96,6 +103,7 @@ func getPageHTML(page *model.FacebookPage) { timeInt, err := strconv.ParseInt(time, 10, 32) if err != nil { + fmt.Println("time parse err ", err) return }