Class: Apollo::Crawler::YoujizzCrawler

Inherits:
BaseCrawler show all
Defined in:
lib/apollo_crawler/crawler/youjizz_crawler.rb

Constant Summary collapse

@@MATCHER_ITEM =
"//span[@id = 'miniatura']/span/a"

Instance Method Summary collapse

Methods inherited from BaseCrawler

create_metadoc, #enqueue_url, #etl, fetch, #fetch_document, #initialize, name_re, #process_url, try_get_doc, try_get_url, #url_processed?

Constructor Details

This class inherits a constructor from Apollo::Crawler::BaseCrawler

Instance Method Details

#extract_data(doc) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
# File 'lib/apollo_crawler/crawler/youjizz_crawler.rb', line 34

def extract_data(doc)
	res = doc.xpath(@@MATCHER_ITEM).map { | node |
		link = BaseCrawler.try_get_url(self.url, node['href']).to_s
		next if link.nil?

		{ 
			:text => link,
			:link => link
		}
	}
end


46
47
48
49
50
51
52
53
54
55
# File 'lib/apollo_crawler/crawler/youjizz_crawler.rb', line 46

def extract_links(doc)
	res = doc.xpath("//div[@id = 'pagination']/a").map { | node |
		link = BaseCrawler.try_get_url(self.url, node['href']).to_s
		next if link.nil?

		{ 
			:link => link
		}
	}
end

#nameObject



26
27
28
# File 'lib/apollo_crawler/crawler/youjizz_crawler.rb', line 26

def name()
	return "Youjizz"
end

#urlObject



30
31
32
# File 'lib/apollo_crawler/crawler/youjizz_crawler.rb', line 30

def url()
	return "http://www.youjizz.com/"
end