useClosureToExcludeLinks

useClosureToExcludeLinks ( closure closure ) : void

Set a closure to define how you need an URL will be excluded.
This behavior can be used instead of or in addition to the regular expression to exclude links you have in the tab "Options".
It is recommanded to use this function in the INITAL script.

Example


useClosureToExcludeLinks({def myUrlToFilter->
if(contains(myUrlToFilter, "logout")) return true //excluded
if(regex(/(_[0-9])/,myUrlToFilter)) return true //excluded
else return false //added to URLs to visit
})

Parameters

closure

The closure you define to exclude the URL. This cloure will be called each time the crawler try to add a URL in the URLs to visit.
Your closure must have 1 parameter exactly, this parameter is the URL of the page to add to URLs to visit.
If the closure returns true, the URL will be excluded, if alse the URL will be added to URLs to visit.