CrawlingRequest <UserData>
Hierarchy
- CrawleeRequest<UserData>
- CrawlingRequest
Index
Constructors
constructor
Requestparameters including the URL, HTTP method and headers, and others.Processing state (
retryCount,errorMessages,handledAt,loadedUrl,id) is not an option; requests coming back from a storage are rebuilt with Request.fromSchema.Parameters
options: RequestOptions<UserData>
Returns CrawlingRequest<UserData>
Properties
inheritederrorMessages
An array of error messages from request processing.
optionalinheritedhandledAt
ISO datetime string that indicates the time when the request has been processed.
Is null if the request has not been crawled yet.
optionalinheritedheaders
Object with HTTP headers. Key is header name, value is the value.
optionalinheritedid
Storage-assigned request ID. Only present on requests that went through a RequestQueue.
optionalinheritedloadedUrl
An actually loaded URL after redirects, if present. HTTP redirects are guaranteed to be included.
When using PuppeteerCrawler or PlaywrightCrawler, meta tag and JavaScript redirects may, or may not be included, depending on their nature. This generally means that redirects, which happen immediately will most likely be included, but delayed redirects will not.
inheritedmethod
HTTP method, e.g. GET or POST.
inheritednoRetry
The true value indicates that the request will not be automatically retried on error.
optionalinheritedpayload
HTTP request payload, e.g. for POST requests.
inheritedretryCount
Indicates the number of times the crawling of the request has been retried on error.
inheriteduniqueKey
A unique key identifying the request.
Two requests with the same uniqueKey are considered as pointing to the same URL.
inheritedurl
URL of the web page to crawl.
inheriteduserData
Custom user data assigned to the request.
All data stored in userData must be JSON-serializable.
Storing non-serializable values (e.g. functions, symbols) may result in unexpected results.
Accessors
crawlDepth
Depth of the request in the current crawl tree. Note that this is dependent on the crawler setup and might produce unexpected results when used with multiple crawlers.
Returns number
Parameters
value: number
Returns void
inheritedlabel
shortcut for getting
request.userData.labelReturns undefined | string
shortcut for setting
request.userData.labelParameters
value: undefined | string
Returns void
maxRetries
Maximum number of retries for this request. Allows to override the global
maxRequestRetriesoption ofBasicCrawler.Returns undefined | number
Parameters
value: undefined | number
Returns void
sessionId
ID of a session to use for this request. When set, the crawler will fetch this session from the session pool instead of creating a new one.
Returns undefined | string
Parameters
value: undefined | string
Returns void
skipNavigation
Tells the crawler processing this request to skip the navigation and process the request directly.
When this is set to
true, the crawling context will not contain the results of the navigation (e.g.response,body,contentType,$orrequest.loadedUrl). Accessing these properties will throw a NavigationSkippedError at runtime.Returns boolean
Parameters
value: boolean
Returns void
state
Describes the request's current lifecycle state.
Returns RequestState
Parameters
value: RequestState
Returns void
Methods
publicinheritedintoFetchAPIRequest
Converts the Crawlee Request object to a
fetchAPI Request object.Returns Request
The native
fetchAPI Request object.
pushErrorMessage
Stores information about an error that occurred during processing of this request.
You should always use Error instances when throwing errors in JavaScript.
Nevertheless, to improve the debugging experience when using third party libraries that may not always throw an Error instance, the function performs a type inspection of the passed argument and attempts to extract as much information as possible, since just throwing a bad type error makes any debugging rather difficult.
Parameters
errorOrMessage: unknown
Error object or error message to be stored in the request.
optionaloptions: PushErrorMessageOptions = {}
Returns void
staticfromSchema
Rebuilds a request from its stored form, including the processing state a RequestOptions object cannot carry. Subclasses get instances of themselves.
Parameters
schema: RequestSchema
Returns CrawlingRequest<UserData>
A Request as seen by a crawler: the same stored record, with the crawler's own per-request state (
userData.__crawlee) exposed as properties. This is whatrequestis in every request handler.Requests fetched from a request manager are plain Requests; BasicCrawler rebuilds them as
CrawlingRequests before handing them to the pipeline.