Package org.apache.nutch.protocol
Interface Protocol
- All Superinterfaces:
Configurable,Pluggable
A retriever of url content. Implemented by protocol extensions.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiongetProtocolOutput(Text url, CrawlDatum datum) Get theProtocolOutputfor a given url and crawldatumdefault crawlercommons.robots.BaseRobotRulesgetRobotRules(URL url, CrawlDatum datum, List<Content> robotsTxtContent) Retrieve robot rules applicable for this URL.crawlercommons.robots.BaseRobotRulesgetRobotRules(Text url, CrawlDatum datum, List<Content> robotsTxtContent) Retrieve robot rules applicable for this URL.default URLresolveUrl(URL base, String relative) Resolve a relative URL against a base URL using the protocol's URL library.Methods inherited from interface org.apache.hadoop.conf.Configurable
getConf, setConf
-
Field Details
-
X_POINT_ID
The name of the extension point.
-
-
Method Details
-
getProtocolOutput
Get theProtocolOutputfor a given url and crawldatum- Parameters:
url- canonical urldatum- associatedCrawlDatum- Returns:
- the
ProtocolOutput
-
resolveUrl
Resolve a relative URL against a base URL using the protocol's URL library.- Parameters:
base- the base URL the relative URL is resolved againstrelative- the relative URL string (typically a Location: header value)- Returns:
- resolved absolute URL
- Throws:
MalformedURLException- if the URL is malformed
-
getRobotRules
crawlercommons.robots.BaseRobotRules getRobotRules(Text url, CrawlDatum datum, List<Content> robotsTxtContent) Retrieve robot rules applicable for this URL.- Parameters:
url- URL to checkdatum- page datumrobotsTxtContent- container to store responses when fetching the robots.txt file for debugging or archival purposes. Instead of a robots.txt file, it may include redirects or an error page (404, etc.). ResponseContentis appended to the passed list. If null is passed nothing is stored.- Returns:
- robot rules (specific for this URL or default), never null
-
getRobotRules
default crawlercommons.robots.BaseRobotRules getRobotRules(URL url, CrawlDatum datum, List<Content> robotsTxtContent) Retrieve robot rules applicable for this URL.- Parameters:
url- URL to checkdatum- page datumrobotsTxtContent- container to store responses when fetching the robots.txt file for debugging or archival purposes. Instead of a robots.txt file, it may include redirects or an error page (404, etc.). ResponseContentis appended to the passed list. If null is passed nothing is stored.- Returns:
- robot rules (specific for this URL or default), never null
-