Registers a function called for each successfully fetched page whose request
carries the given label (or for all pages when label = NULL). The
handler receives a context object exposing the parsed page and the actions
push_data() and enqueue_links().
Arguments
- crawler
A Crawler.
- handler
A function of one argument (the context). See Context.
- label
Optional handler label. Requests enqueued with the same label are routed here;
NULLregisters the default handler.
Context
The ctx passed to a handler contains:
requestThe request list (
url,label,depth, ...).responseThe
httr2response object.pageThe parsed page (an
xml_document) orNULL.push_data(data)Append a record to the dataset.
enqueue_links(...)Discover and enqueue links from the page.
logLogging functions (
info,success,warn,error).