2010-05-26 22 views

回答

1

喜歡的東西

doc.search("a").map do |a| 
    url = a.attribute("href") 
    #this part could be a lot more robust, but you get the idea... 
    full_url = url.match("^http://") ? url : "http://somedomain.com/#{url}" 
end.select{|url| url.match("^http://somedomain.com")} 
:內特與域,如果它不以 「http」

這裏是一個Python的例子開始