2010-04-07 03:32:50 +00:00
|
|
|
require 'rubygems'
|
|
|
|
require 'pathname'
|
|
|
|
require 'hpricot'
|
|
|
|
require 'uri'
|
|
|
|
|
|
|
|
class CrawlerObjects < BaseParser
|
|
|
|
|
|
|
|
def parse(request,result)
|
|
|
|
|
|
|
|
if !result['Content-Type'].include? "text/html"
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
hr = ''
|
|
|
|
m = ''
|
|
|
|
|
|
|
|
doc = Hpricot(result.body.to_s)
|
|
|
|
doc.search("//object/embed").each do |obj|
|
|
|
|
|
|
|
|
s = obj['src']
|
|
|
|
|
|
|
|
begin
|
2010-04-08 03:40:08 +00:00
|
|
|
hreq = urltohash('GET',s,request['uri'],nil)
|
2010-04-07 03:32:50 +00:00
|
|
|
|
|
|
|
insertnewpath(hreq)
|
|
|
|
|
|
|
|
|
|
|
|
rescue URI::InvalidURIError
|
|
|
|
#puts "Parse error"
|
|
|
|
#puts "Error: #{link[0]}"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|