Eno Ron Asked:2022-08-21 02:39:25 +0800 CST2022-08-21 02:39:25 +0800 CST 2022-08-21 02:39:25 +0800 CST 解析 go-colly 描述 772 我正在尝试从网页解析描述,但我不知道如何获取它? c.OnHTML(".short", func(e *colly.HTMLElement) { pg.Name = e.ChildText("h2.short-cat") pg.Link = e.ChildAttr("a", "href") pg.Rating = e.ChildText("a.orating_res") pg.Description = e.ChildText("div.short-text full-text video-box clearfix") slPG = append(slPG, pg) }) golang 1 个回答 Voted Best Answer Eno Ron 2022-08-22T00:41:50+08:002022-08-22T00:41:50+08:00 需要指定开头,剩下的会自动找 e.ChildText("div.short-text")
需要指定开头,剩下的会自动找