public interface RunningScrapeableFile
Modifier and Type | Field and Description |
---|---|
static org.apache.log4j.Logger |
log
Used for logging.
|
Modifier and Type | Method and Description |
---|---|
void |
addHTTPParameter(HTTPParameter httpParameter)
Adds a parameter to the scrapeable file.
|
DataSet |
extractData(java.lang.String text,
java.lang.String name)
Manually extracts data using an existing
ExtractorPattern . |
java.lang.String |
extractOneValue(java.lang.String text,
java.lang.String name)
Manually extracts one value from data using an existing
ExtractorPattern . |
java.lang.String |
extractOneValue(java.lang.String text,
java.lang.String name,
java.lang.String token)
Manually extracts one value from data using an existing
ExtractorPattern . |
java.lang.String |
getContentAsString()
Gets the scraped content as a string.
|
java.lang.String |
getCurrentPOSTData()
Gets the current value of the POST data.
|
java.lang.String |
getCurrentURL()
Depending on when this value is requested it will return either
the unresolved or resolved URL of the file to be scraped.
|
java.lang.String |
getName()
The name
|
java.lang.String |
getStrippedContentAsString()
Gets the scraped content as a string, with all new line characters removed
|
boolean |
noExtractorPatternsMatched()
Indicates whether or not none of the extractor patterns for this
scrapeable file found a match.
|
void |
removeAllHTTPParameters()
Removes all HTTP parameters from the scrapeable file.
|
java.lang.String |
resolveRelativeURL(java.lang.String urlToResolve)
Resolve a relative URL
|
void |
saveFileOnRequest(java.lang.String fileToSaveToOnRequest)
Sets the path to save the file to just after it gets requested.
|
boolean |
wasErrorOnRequest()
Indicates whether or not an error occurred in requesting the file.
|
@Nullable java.lang.String getContentAsString()
@Nullable java.lang.String getStrippedContentAsString()
boolean wasErrorOnRequest()
boolean noExtractorPatternsMatched()
@Nullable java.lang.String getCurrentURL()
@Nullable java.lang.String getName()
@Nullable java.lang.String getCurrentPOSTData()
RunningScrapeableFile
so that the
resolved POST data can be made accessible in a script. If this
method is called before this scrapeable file is scraped it
will return null.void removeAllHTTPParameters() throws java.lang.Exception
java.lang.Exception
void addHTTPParameter(HTTPParameter httpParameter)
httpParameter
- An HTTPParameter
.@Nullable java.lang.String resolveRelativeURL(java.lang.String urlToResolve)
urlToResolve
- The relative URL to resolve.@Nullable DataSet extractData(java.lang.String text, java.lang.String name)
ExtractorPattern
.text
- The text to extract data from.name
- The name of the ExtractorPattern
to be used.
The ExtractorPattern
must be associated with this
ScrapeableFile
. If more than one ExtractorPattern
is found with the given name the first (by sequence) will be used.DataSet
containing the extracted data.@Nullable java.lang.String extractOneValue(java.lang.String text, java.lang.String name)
ExtractorPattern
.text
- The text to extract data from.name
- The name of the ExtractorPattern
to be used.
The ExtractorPattern
must be associated with this
ScrapeableFile
. If more than one ExtractorPattern
is found with the given name the first (by sequence) will be used.String
containing the extracted data. If nothing
mathces null is returned.@Nullable java.lang.String extractOneValue(java.lang.String text, java.lang.String name, java.lang.String token)
ExtractorPattern
.text
- The text to extract data from.name
- The name of the ExtractorPattern
to be used.
The ExtractorPattern
must be associated with this
ScrapeableFile
. If more than one ExtractorPattern
is found with the given name the first (by sequence) will be used.token
- The name of the Token to returnString
containing the extracted data. If nothing
mathces null is returned.void saveFileOnRequest(java.lang.String fileToSaveToOnRequest)
fileToSaveToOnRequest
- The path of the file to save to.