gpt4 book ai didi

Goquery 选择 meta[property=og :image]?

转载 作者:IT王子 更新时间:2023-10-29 01:59:28 30 4
gpt4 key购买 nike

Goquery Syntax-wise, it is as close as possible to jQuery, with the same function names when possible, and that warm and fuzzy chainable interface.

doc.Find("meta[property='og:image']").Each(func(i int, s *goquery.Selection) {
fmt.Fprintln("og data=", s)
})

显然离j-thing 还不够近.

如何从goquery获取网页中的og数据?

最佳答案

刚弄明白 - 希望这能帮助其他人

doc.Find("meta").Each(func(i int, s *goquery.Selection) {
op, _ := s.Attr("property")
con, _ := s.Attr("content")
if op == "og:image" {
fmt.Fprintln("og data=", con)
}

})

关于Goquery 选择 meta[property=og :image]?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30023633/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com