lib/regexp_crawler/crawler.rb in flyerhzm-regexp_crawler-0.7.0 vs lib/regexp_crawler/crawler.rb in flyerhzm-regexp_crawler-0.8.0
- old
+ new
@@ -49,10 +49,10 @@
def parse_response(response, uri)
response_body = encoding.nil? ? response.body : Iconv.iconv("UTF-8//IGNORE", "#{encoding}//IGNORE", response.body).first
if response.is_a? Net::HTTPSuccess
if continue_regexp
response_body.scan(continue_regexp).each do |page|
- page = page.first if page.is_a? Array
+ page = page.compact.first if page.is_a? Array
continue_uri = continue_uri(uri, page)
@pages << continue_uri unless @captured_pages.include?(continue_uri) or @pages.include?(continue_uri)
end
end
if @need_parse.nil? or @need_parse.call(uri, response_body)