ITeye博客

ruby gem

共 2 篇文章

使用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

2013-08-18 21:40 · ruby gem · 获取

Nokogiri::XML::Node 方法举例

#================================================================================= #Here I will discuss several Nokogiri::XML::Node#methods as in the documentation #================================================================================= #===================================================…

2013-08-18 16:34 · ruby gem · 方法 · 举例