SpiderMan.CommonSpider (spider_man v0.3.4)
A Common Spider what setting functions as callbacks instead of module defined
Usage
SpiderMan.CommonSpider.start(:spider_name, handle_response: fn response, context -> %{} end)
Link to this section Summary
Link to this section Types
Link to this type
callback()
Specs
callback() :: {:init, init()} | {:handle_response, handle_response()} | {:prepare_for_start, prepare_for_start()} | {:prepare_for_stop, prepare_for_stop()} | {:prepare_for_start_component, prepare_for_start_component()} | {:prepare_for_start_component, prepare_for_start_component()}
Link to this type
callbacks()
Specs
callbacks() :: [callback()]
Link to this type
handle_response()
Specs
handle_response() :: (SpiderMan.Response.t(), context :: map() -> %{ optional(:requests) => [SpiderMan.Request.t()], optional(:items) => [SpiderMan.Item.t()] })
Link to this type
init()
Specs
init() :: (SpiderMan.Engine.state() -> SpiderMan.Engine.state())
Link to this type
prepare_for_start()
Specs
prepare_for_start() :: (SpiderMan.prepare_for_start_stage(), SpiderMan.Engine.state() -> SpiderMan.Engine.state())
Link to this type
prepare_for_start_component()
Specs
prepare_for_start_component() :: (SpiderMan.component(), options :: keyword() | false -> options :: keyword())
Link to this type
prepare_for_stop()
Specs
prepare_for_stop() :: (SpiderMan.Engine.state() -> :ok)
Link to this type
prepare_for_stop_component()
Specs
prepare_for_stop_component() :: (SpiderMan.component(), options :: keyword() | false -> :ok)
Link to this section Functions
Link to this function
check_callbacks_and_merge_settings(callbacks, settings \\ [])
Specs
check_callbacks_and_merge_settings(callbacks(), SpiderMan.settings()) :: {:ok, SpiderMan.settings()} | {:error, String.t()}
Link to this function
start(spider, callbacks, settings \\ [])
Specs
start(SpiderMan.spider(), callbacks(), SpiderMan.settings()) :: Supervisor.on_start_child()