Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Give focus_crawl a chance to access page body before discarding it #83

Open
wants to merge 1 commit into
base: next
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions lib/anemone/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class Core
:accept_cookies => false,
# skip any link with a query string? e.g. http://foo.com/?u=user
:skip_query_strings => false,
# proxy server hostname
# proxy server hostname
:proxy_host => nil,
# proxy server port number
:proxy_port => false,
Expand Down Expand Up @@ -164,10 +164,11 @@ def run
page = page_queue.deq
@pages.touch_key page.url
puts "#{page.url} Queue: #{link_queue.size}" if @opts[:verbose]

do_page_blocks page
links = links_to_follow page
page.discard_doc! if @opts[:discard_page_bodies]

links = links_to_follow page
links.each do |link|
link_queue << [link, page.url.dup, page.depth + 1]
end
Expand Down Expand Up @@ -281,7 +282,7 @@ def too_deep?(from_page)
false
end
end

#
# Returns +true+ if *link* should not be visited because
# it has a query string and +skip_query_strings+ is true.
Expand Down