Added only_links_like Feature #50

Open
wants to merge 1 commit into from

2 participants

@hartator

Hi!

Thanks a lot for anemone guys!

I missed a feature that I have implemented, basically the reverse of skip_links_like, which I have called only_links_like to help the crawler to follow only links which matches specified patterns.

Anyway, I wish you great succes with your project!

Best,
Julian

@rcarvalho

I second this feature! I basically implemented the same thing locally on my machine so I could get it to work. I guess I should've checked here first. Anemone is awesome, btw!

@brutuscat brutuscat commented on the diff Dec 14, 2014
lib/anemone/core.rb
@@ -292,10 +302,18 @@ def skip_query_string?(link)
#
# Returns +true+ if *link* should not be visited because
- # its URL matches a skip_link pattern.
+ # its URL matches a skip_link pattern or not matches a only_link pattern.
#
def skip_link?(link)
@only_link_patterns.empty? 
 ? @skip_link_patterns.any? { |pattern| link.path =~ pattern }
 : !@only_link_patterns.any? { |pattern| link.path =~ pattern }

@hartator would u care to re-submit in the Medusa fork?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment