Steps API
Steps are the building blocks of SpiderChef recipes. This reference documents the core step classes and the built-in step types available in SpiderChef.
Core Step Classes
spiderchef.steps.base.BaseStep
Bases: ABC, BaseModel
Base step class that all steps inherit from.
Source code in spiderchef/steps/base.py
execute(recipe, previous_output=None)
abstractmethod
replace_variables(recipe)
Replace variables in all fields of the step.
Source code in spiderchef/steps/base.py
spiderchef.steps.base.SyncStep
Bases: BaseStep
Base class for synchronous steps.
Source code in spiderchef/steps/base.py
spiderchef.steps.base.AsyncStep
Bases: BaseStep
Base class for asynchronous steps.
Source code in spiderchef/steps/base.py
spiderchef.steps.asynchronous.FetchStep
Bases: AsyncStep
Step to fetch data from an API.
Source code in spiderchef/steps/asynchronous.py
spiderchef.steps.asynchronous.SleepStep
Extraction Steps
spiderchef.steps.extract.RegexStep
Bases: SyncStep
Step to regex a value from the recipe's text data.
Source code in spiderchef/steps/extract.py
spiderchef.steps.extract.RegexFirstStep
spiderchef.steps.extract.XpathStep
Bases: SyncStep
Step to xpath a value from the recipe's text data.
Source code in spiderchef/steps/extract.py
spiderchef.steps.extract.XpathFirstStep
spiderchef.steps.extract.GetStep
Bases: SyncStep
Step to get a value from the recipe's JSON data.
Source code in spiderchef/steps/extract.py
spiderchef.steps.extract.ExtractItemsStep
Bases: AsyncStep
Step to regex a value from the recipe's text data.
Source code in spiderchef/steps/extract.py
convert_step_dicts(value)
Convert step dictionaries to Step instances before model creation.
Source code in spiderchef/steps/extract.py
Transformation Steps
spiderchef.steps.format.JoinBaseUrl
Bases: SyncStep
Joins a string (+optional path) with base_url
Source code in spiderchef/steps/format.py
spiderchef.steps.format.FromJson
spiderchef.steps.format.ToInt
spiderchef.steps.format.ToStr
spiderchef.steps.format.ToFloat
spiderchef.steps.format.ToMoneyStep
Bases: SyncStep
Converts string to money format.
Handles different currency formats, decimal separators, and thousands separators. Examples: - '1.407' → 1407 (if period is thousands separator) - '1,407.99' → 1407.99 (US format) - '1.407,99' → 1407.99 (EU format)
Source code in spiderchef/steps/format.py
spiderchef.steps.format.RemoveExtraWhitespace
spiderchef.steps.format.RemoveHTMLTags
Flow Control Steps
spiderchef.steps.conditional.CompareStep
Bases: SyncStep
Step to compare two values from the recipe's JSON data.
Source code in spiderchef/steps/conditional.py
Data Management Steps
spiderchef.steps.base.SaveStep
Bases: SyncStep
Saves the previous_output into the variables to be used later on.
Source code in spiderchef/steps/base.py
Error Handling Steps
spiderchef.steps.error.TryCatchStep
Bases: AsyncStep
Execute steps with error handling.
Source code in spiderchef/steps/error.py
convert_steps(value)
Convert step dictionaries to Step instances before model creation.