lib/xkcd.rb in xkcd-0.0.4 vs lib/xkcd.rb in xkcd-0.0.5
- old
+ new
@@ -1,7 +1,7 @@
#!/usr/bin/env ruby
-require 'hpricot'
+require 'nokogiri'
require 'open-uri'
# The main XKCD driver
class XKCD
# Get img/comic URL from xkcd
#
@@ -19,8 +19,8 @@
class << XKCD
alias_method :get, :comic
end
def self.img
- Hpricot(open('http://dynamic.xkcd.com/random/comic/')).search("#comic img").first.raw_attributes["src"]
+ Nokogiri::HTML(open('http://dynamic.xkcd.com/random/comic/')).css('#comic img')[0].attributes["src"].value
end
end