[英]private method `split' called for nil:NilClass (NoMethodError)
I'm trying to use domainatrix with nokogiri and am coming up with a holdup. 我正在尝试将domainatrix与nokogiri结合使用,并提出了一个要求。 Being relatively new to ruby, I've tried every syntax variation on the Domainatrix.parse function I can to get the a href's to parse properly.
对于红宝石而言,我还比较陌生,所以我尝试了Domainatrix.parse函数上的每种语法变体,以获得可以正确解析的a href。 They do print during the "puts" command but when I uncomment the domainatrix code problems start:
它们确实在“ puts”命令期间打印,但是当我取消注释domainatrix代码时,问题开始了:
require 'rubygems'
require 'domainatrix'
require 'anemone'
require 'open-uri'
require 'nokogiri'
doc = Nokogiri::HTML(open("http://www.cnn.com"))
doc.xpath('//a/@href').each do |node|
linkage = node.text
puts linkage
url = Domainatrix.parse(linkage)
print url.domain
print url.public_suffix
end
Anyone have any ideas on this? 有人对此有任何想法吗? I think it is just a syntax issue or perhaps I cannot use the Domainatrix function where I'm using it?
我认为这只是一个语法问题,或者也许我不能在使用它的地方使用Domainatrix函数?
它被某些格式不正确的URL所卡住。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.