mirror of
https://github.com/internetarchive/heritrix3.git
synced 2026-08-21 22:16:50 +00:00
treat content as html and extract links if it looks like html, even if mime type belies that
This commit is contained in:
@@ -694,16 +694,24 @@ public class ExtractorHTML extends ContentExtractor implements InitializingBean
|
||||
// assume it's okay to extract
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
String mime = uri.getContentType().toLowerCase();
|
||||
return mime.startsWith("text/html")
|
||||
if (mime.startsWith("text/html")
|
||||
|| mime.startsWith("application/xhtml")
|
||||
|| mime.startsWith("text/vnd.wap.wml")
|
||||
|| mime.startsWith("application/vnd.wap.wml")
|
||||
|| mime.startsWith("application/vnd.wap.xhtml");
|
||||
|| mime.startsWith("application/vnd.wap.xhtml")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
String contentPrefixLC = uri.getRecorder().getContentReplayPrefixString(1000).toLowerCase();
|
||||
if (contentPrefixLC.contains("<html") || contentPrefixLC.contains("<!doctype html")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public boolean innerExtract(CrawlURI curi) {
|
||||
if (!curi.containsContentTypeCharsetDeclaration()) {
|
||||
String contentPrefix = curi.getRecorder().getContentReplayPrefixString(1000);
|
||||
|
||||
Reference in New Issue
Block a user