class Apollo::Crawler::XkcdCrawler
Public Instance Methods
extract_data(doc)
click to toggle source
# File lib/apollo_crawler/crawler/xkcd_crawler.rb, line 36 def extract_data(doc) res = doc.xpath(@@MATCHER_ITEM).map { |node| { :text => node['title'], :link => URI.join(self.url, node['src']).to_s } } end
extract_links(doc)
click to toggle source
# File lib/apollo_crawler/crawler/xkcd_crawler.rb, line 45 def extract_links(doc) res = doc.xpath("//ul[@class = 'comicNav']/li/a[@accesskey = 'p']").map { |node| { :link => URI.join(self.url, node['href']).to_s } } res.uniq end
name()
click to toggle source
# File lib/apollo_crawler/crawler/xkcd_crawler.rb, line 28 def name() return "Xkcd" end
url()
click to toggle source
# File lib/apollo_crawler/crawler/xkcd_crawler.rb, line 32 def url() return "http://xkcd.com/" end