rdluck 4 жил өмнө
parent
commit
f6eaf5d3a7
1 өөрчлөгдсөн 12 нэмэгдсэн , 6 устгасан
  1. 12 6
      services/article.go

+ 12 - 6
services/article.go

@@ -40,7 +40,7 @@ func GetReportContentTextSub(content string) (contentSub string, err error) {
 		fmt.Println("create doc err:", err.Error())
 		return
 	}
-	maxRow:=5
+	maxRow := 5
 	n := 0
 	doc.Find("p").Each(func(i int, s *goquery.Selection) {
 		pHtml, _ := s.Html()
@@ -48,20 +48,26 @@ func GetReportContentTextSub(content string) (contentSub string, err error) {
 			if n > maxRow {
 				return
 			}
-			n++
-			contentSub = contentSub + s.Text()
+			text := s.Text()
+			if !strings.Contains(text, "访谈时间") && !strings.Contains(text, "纪要详情") {
+				n++
+				contentSub = contentSub + s.Text()
+			}
 		}
 	})
 	if contentSub == "" {
 		m := 0
 		doc.Find("span").Each(func(i int, s *goquery.Selection) {
 			spanHtml, _ := s.Html()
-			if !strings.Contains(spanHtml, "img") && !strings.Contains(spanHtml, "table")  {
+			if !strings.Contains(spanHtml, "img") && !strings.Contains(spanHtml, "table") {
 				if m > maxRow {
 					return
 				}
-				m++
-				contentSub = contentSub + s.Text()
+				text := s.Text()
+				if !strings.Contains(text, "访谈时间") && !strings.Contains(text, "纪要详情") {
+					n++
+					contentSub = contentSub + s.Text()
+				}
 			}
 		})
 	}