Class HtmlLinkExtractorConfig
java.lang.Object
com.norconex.crawler.web.doc.operations.link.impl.HtmlLinkExtractorConfig
Configuration for HtmlLinkExtractor.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault maximum length a URL can have.Default supported URL schemes (http, https, and ftp).static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddExtractBetween(String start, String end, boolean ignoreCase) Adds patterns delimiting a portion of a document to be considered for link extraction.addExtractSelectors(List<String> selectors) Adds selectors matching the portions of a document to be considered for link extraction.addLinkTag(String tagName, String attribute) addNoExtractBetween(String start, String end, boolean ignoreCase) Adds patterns delimiting a portion of a document to be excluded from link extraction.addNoExtractSelectors(List<String> selectors) Adds selectors matching the portions of a document to be excluded from link extraction.protected booleanvoidvoidClears all restrictions.booleanThe character set to use for pages on which link extraction is performed.The matcher of content types to apply link extraction on.Gets the patterns delimiting the portions of a document to be considered for link extraction.Gets the selectors matching the portions of a document to be considered for link extraction.Matcher of one or more fields to use as the source of content to extract links from, instead of the document content.intThe maximum supported URL length.Gets the patterns delimiting the portions of a document to be excluded from link extraction.Gets the selectors matching the portions of a document to be excluded from link extraction.Gets all restrictionsGets the schemes to be extracted.inthashCode()booleanGets whether links should be extracted from comments.booleanGets whether to ignore extra data associated with a link.booleanWhether to ignore "nofollow" directives on HTML links.removeLinkTag(String tagName, String attribute) setCharset(Charset charset) The character set to use for pages on which link extraction is performed.setCommentsEnabled(boolean commentsEnabled) Gets whether links should be extracted from comments.setContentTypeMatcher(TextMatcher matcher) The matcher of content types to apply link extraction on.Sets the patterns delimiting the portions of a document to be considered for link extraction.setExtractSelectors(List<String> selectors) Sets the selectors matching the portions of a document to be considered for link extraction.setFieldMatcher(TextMatcher fieldMatcher) setIgnoreLinkData(boolean ignoreLinkData) Gets whether to ignore extra data associated with a link.setIgnoreNofollow(boolean ignoreNofollow) Whether to ignore "nofollow" directives on HTML links.setMaxURLLength(int maxURLLength) The maximum supported URL length.Sets the patterns delimiting the portions of a document to be excluded from link extraction.setNoExtractSelectors(List<String> selectors) Sets the selectors matching the portions of a document to be excluded from link extraction.setSchemes(List<String> schemes) Sets the schemes to be extracted.toString()
-
Field Details
-
DEFAULT_MAX_URL_LENGTH
public static final int DEFAULT_MAX_URL_LENGTHDefault maximum length a URL can have.- See Also:
-
DEFAULT_SCHEMES
Default supported URL schemes (http, https, and ftp). -
HTTP_EQUIV
- See Also:
-
-
Constructor Details
-
HtmlLinkExtractorConfig
public HtmlLinkExtractorConfig()
-
-
Method Details
-
getExtractBetweens
Gets the patterns delimiting the portions of a document to be considered for link extraction.- Returns:
- extract between patterns
-
setExtractBetweens
Sets the patterns delimiting the portions of a document to be considered for link extraction.- Parameters:
betweens- extract between patterns- Returns:
- this
-
addExtractBetween
Adds patterns delimiting a portion of a document to be considered for link extraction.- Parameters:
start- pattern matching start of text portionend- pattern matching end of text portionignoreCase- whether the patterns are case sensitive or not- Returns:
- this
-
getNoExtractBetweens
Gets the patterns delimiting the portions of a document to be excluded from link extraction.- Returns:
- extract between patterns
-
setNoExtractBetweens
public HtmlLinkExtractorConfig setNoExtractBetweens(List<HtmlLinkExtractorConfig.RegexPair> betweens) Sets the patterns delimiting the portions of a document to be excluded from link extraction.- Parameters:
betweens- extract between patterns- Returns:
- this
-
addNoExtractBetween
Adds patterns delimiting a portion of a document to be excluded from link extraction.- Parameters:
start- pattern matching start of text portionend- pattern matching end of text portionignoreCase- whether the patterns are case sensitive or not- Returns:
- this
-
getExtractSelectors
Gets the selectors matching the portions of a document to be considered for link extraction.- Returns:
- selectors
-
setExtractSelectors
Sets the selectors matching the portions of a document to be considered for link extraction.- Parameters:
selectors- selectors- Returns:
- this
-
addExtractSelectors
Adds selectors matching the portions of a document to be considered for link extraction.- Parameters:
selectors- selectors- Returns:
- this
-
getNoExtractSelectors
Gets the selectors matching the portions of a document to be excluded from link extraction.- Returns:
- selectors
-
setNoExtractSelectors
Sets the selectors matching the portions of a document to be excluded from link extraction.- Parameters:
selectors- selectors- Returns:
- this
-
addNoExtractSelectors
Adds selectors matching the portions of a document to be excluded from link extraction.- Parameters:
selectors- selectors- Returns:
- this
-
getSchemes
Gets the schemes to be extracted.- Returns:
- schemes to be extracted
-
setSchemes
Sets the schemes to be extracted.- Parameters:
schemes- schemes to be extracted- Returns:
- this
-
setFieldMatcher
-
setContentTypeMatcher
The matcher of content types to apply link extraction on. No attempt to extract links from any other content types will be made. Default isCommonMatchers.HTML_CONTENT_TYPES.- Parameters:
matcher- content type matcher- Returns:
- this
-
clearRestrictions
public void clearRestrictions()Clears all restrictions. -
getRestrictions
Gets all restrictions- Returns:
- the restrictions
-
addLinkTag
-
removeLinkTag
-
clearLinkTags
public void clearLinkTags() -
getContentTypeMatcher
The matcher of content types to apply link extraction on. No attempt to extract links from any other content types will be made. Default isCommonMatchers.HTML_CONTENT_TYPES. -
getFieldMatcher
Matcher of one or more fields to use as the source of content to extract links from, instead of the document content. -
getMaxURLLength
public int getMaxURLLength()The maximum supported URL length. Longer URLs are ignored. -
isIgnoreNofollow
public boolean isIgnoreNofollow()Whether to ignore "nofollow" directives on HTML links. An example of such links:<a href="https://yoursite.com/doNotCrawl.html" rel="nofollow"> By default this link won't be crawled. </a>
-
isIgnoreLinkData
public boolean isIgnoreLinkData()Gets whether to ignore extra data associated with a link. -
getCharset
The character set to use for pages on which link extraction is performed. Whennull(default), character set detection will be attempted. -
isCommentsEnabled
public boolean isCommentsEnabled()Gets whether links should be extracted from comments. Comment example:<!-- By default, this URL won't be crawled: <a href="https://yoursite.com/somepage.html">Some URL</a> -->
-
getTagAttribs
-
setMaxURLLength
The maximum supported URL length. Longer URLs are ignored.- Returns:
this.
-
setIgnoreNofollow
Whether to ignore "nofollow" directives on HTML links. An example of such links:<a href="https://yoursite.com/doNotCrawl.html" rel="nofollow"> By default this link won't be crawled. </a>
- Returns:
this.
-
setIgnoreLinkData
Gets whether to ignore extra data associated with a link.- Returns:
this.
-
setCharset
The character set to use for pages on which link extraction is performed. Whennull(default), character set detection will be attempted.- Returns:
this.
-
setCommentsEnabled
Gets whether links should be extracted from comments. Comment example:<!-- By default, this URL won't be crawled: <a href="https://yoursite.com/somepage.html">Some URL</a> -->
- Returns:
this.
-
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-