You can use at_xpath
method for this :
require 'open-uri'
external_url = 'http://anydomain.com/anyurl'
doc = Nokogiri::HTML(open(external_url))
href = 'http://url1.com'
link_text = 'url1'
node = doc.at_xpath("//a[@href = '#{href}' and . = '#{link_text}']")
puts "link not found" if node.nil?