mirror of
https://github.com/internetarchive/heritrix3.git
synced 2026-09-14 09:45:52 +00:00
uses of UriUtils.isLikelyUri() in Extractor{HTML,SWF,XML} with UriUtils.isVeryLikelyUri() to reap the benefits of HER-1523 improvements (should address archive-it issue ARI-3492)
This commit is contained in:
@@ -97,6 +97,10 @@ public class UriUtils {
|
||||
return TextUtils.matches(NAIVE_LIKELY_URI_PATTERN, candidate);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated produces too many false positives,
|
||||
* {@link #isVeryLikelyUri(CharSequence)} is preferred
|
||||
*/
|
||||
public static boolean isLikelyUri(CharSequence candidate) {
|
||||
return isPossibleUri(candidate) && !isLikelyFalsePositive(candidate);
|
||||
}
|
||||
@@ -384,7 +388,7 @@ public class UriUtils {
|
||||
+ "(?:\\?(?:"+ QNV + ")(?:&(?:" + QNV + "))*)?" // may have a ?query=string
|
||||
+ "(?:#[\\w-]+)?"; // may have a #fragment
|
||||
|
||||
public static boolean isVeryLikelyUri(String candidate) {
|
||||
public static boolean isVeryLikelyUri(CharSequence candidate) {
|
||||
// must have a . or /
|
||||
if (!TextUtils.matches(NAIVE_LIKELY_URI_PATTERN, candidate)) {
|
||||
return false;
|
||||
|
||||
@@ -606,7 +606,7 @@ public class ExtractorHTML extends ContentExtractor implements InitializingBean
|
||||
*/
|
||||
protected void considerIfLikelyUri(CrawlURI curi, CharSequence candidate,
|
||||
CharSequence valueContext, Hop hop) {
|
||||
if(UriUtils.isLikelyUri(candidate)) {
|
||||
if(UriUtils.isVeryLikelyUri(candidate)) {
|
||||
addLinkFromString(curi,candidate,valueContext,hop);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -341,7 +341,7 @@ public class ExtractorSWF extends ContentExtractor {
|
||||
}
|
||||
|
||||
public void considerStringAsUri(String str) throws IOException {
|
||||
if (UriUtils.isLikelyUri(str)) {
|
||||
if (UriUtils.isVeryLikelyUri(str)) {
|
||||
int max = ext.getExtractorParameters().getMaxOutlinks();
|
||||
Link.addRelativeToVia(curi, max, str,
|
||||
LinkContext.SPECULATIVE_MISC, Hop.SPECULATIVE);
|
||||
|
||||
@@ -152,7 +152,7 @@ public class ExtractorXML extends ContentExtractor {
|
||||
Matcher matcher = XML_URI_EXTRACTOR.matcher(cs);
|
||||
while (matcher.find()) {
|
||||
String xmlUri = StringEscapeUtils.unescapeXml(matcher.group(1));
|
||||
if (UriUtils.isLikelyUri(xmlUri)) {
|
||||
if (UriUtils.isVeryLikelyUri(xmlUri)) {
|
||||
foundLinks++;
|
||||
try {
|
||||
// treat as speculative, as whether context really
|
||||
|
||||
Reference in New Issue
Block a user