|
@@ -42,40 +42,29 @@ func GetReportContentTextSub(content string) (contentSub string, err error) {
|
|
}
|
|
}
|
|
n := 0
|
|
n := 0
|
|
doc.Find("p").Each(func(i int, s *goquery.Selection) {
|
|
doc.Find("p").Each(func(i int, s *goquery.Selection) {
|
|
-
|
|
|
|
- if n > 3 {
|
|
|
|
- return
|
|
|
|
|
|
+ pHtml, _ := s.Html()
|
|
|
|
+ if !strings.Contains(pHtml, "img") {
|
|
|
|
+ if n > 3 {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ n++
|
|
|
|
+ contentSub = contentSub + s.Text()
|
|
}
|
|
}
|
|
- n++
|
|
|
|
- contentSub = contentSub + s.Text()
|
|
|
|
- //phtml, err := s.Html()
|
|
|
|
- //if err != nil {
|
|
|
|
- // fmt.Println("get html err", err.Error())
|
|
|
|
- // return
|
|
|
|
- //}
|
|
|
|
- //if s.Text() != "" || !strings.Contains(phtml, "src") {
|
|
|
|
- // contentSub = contentSub + "<p>" + phtml + "</p>"
|
|
|
|
- //}
|
|
|
|
})
|
|
})
|
|
-
|
|
|
|
if contentSub == "" {
|
|
if contentSub == "" {
|
|
m := 0
|
|
m := 0
|
|
- doc.Find("p").Each(func(i int, s *goquery.Selection) {
|
|
|
|
- if m > 3 {
|
|
|
|
- return
|
|
|
|
|
|
+ doc.Find("span").Each(func(i int, s *goquery.Selection) {
|
|
|
|
+ spanHtml, _ := s.Html()
|
|
|
|
+ if !strings.Contains(spanHtml, "img") {
|
|
|
|
+ if m > 3 {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ m++
|
|
|
|
+ contentSub = contentSub + s.Text()
|
|
}
|
|
}
|
|
- m++
|
|
|
|
- contentSub = contentSub + s.Text()
|
|
|
|
- //phtml, err := s.Html()
|
|
|
|
- //if err != nil {
|
|
|
|
- // fmt.Println("get html err", err.Error())
|
|
|
|
- // return
|
|
|
|
- //}
|
|
|
|
- //if s.Text() != "" || !strings.Contains(phtml, "src") {
|
|
|
|
- // contentSub = contentSub + "<p>" + phtml + "</p>"
|
|
|
|
- //}
|
|
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
+ fmt.Println(contentSub)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|