`

使用Nokogiri获取页面Keywords

阅读更多
require 'rubygems'
require 'nokogiri'


doc =Nokogiri::HTML("<html><head><meta name=\"Keywords\" content=\"one, two, three\"></head><body></body></html>")

doc.xpath("//meta[@name='Keywords']/@content").each do|attr|
  puts attr.value
end
1
7
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics