【问题标题】:Goquery Select meta[property=og:image]?Goquery 选择元 [property=og:image]?
【发布时间】:2015-07-13 10:55:36
【问题描述】:

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数据?

【问题讨论】:

    标签: go goquery


    【解决方案1】:

    刚刚想通了-希望这对其他人有帮助

    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)
        }
    
    })
    

    【讨论】:

      猜你喜欢
      • 2012-02-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-11-17
      • 2014-11-20
      • 2022-11-02
      • 1970-01-01
      相关资源
      最近更新 更多