Skip to content
Cascading Labs QScrape VoidCrawl Yosoi

Types

Generated from yosoi v0.0.1a11. Only symbols in __all__ are listed.

Author

Author(description: str = ..., kwargs: Any = {}) -> Any

BodyText

BodyText(description: str = ..., kwargs: Any = {}) -> Any

Datetime

Datetime(description: str = ..., assume_utc: bool = ..., past_only: bool = ..., as_iso: bool = ..., kwargs: Any = {}) -> Any

Field

Field(hint: str | None = None, frozen: bool = False, selector: str | None = None, delimiter: str | None = None, kwargs: Any = {}) -> Any

Yosoi-aware Field wrapper that stores hints in json_schema_extra. Args:

  • hint str | None — Optional scraping hint that guides the AI selector discovery.
  • frozen bool — If True, marks the field as frozen (selector won’t be re-discovered).
  • selector str | None — Optional CSS selector override. When set, AI discovery is skipped for this field and the provided selector is used directly.
  • delimiter str | None — Optional regex pattern for splitting delimited strings in list fields. Defaults to comma/semicolon/and splitting when not set.
  • **kwargs Any — Additional arguments forwarded to pydantic.Field.

Returns: Any — A pydantic FieldInfo with Yosoi-specific metadata in json_schema_extra.

Price

Price(description: str = ..., currency_symbol: str | None = ..., require_decimals: bool = ..., kwargs: Any = {}) -> Any

Rating

Rating(description: str = ..., as_float: bool = ..., scale: int = ..., kwargs: Any = {}) -> Any

Title

Title(description: str = ..., kwargs: Any = {}) -> Any

Url

Url(description: str = ..., require_https: bool = ..., strip_tracking: bool = ..., kwargs: Any = {}) -> Any

YosoiType

YosoiType(...)

Optional base class for user-defined Yosoi semantic types.

The preferred pattern is the @register_coercion decorator — it handles both registration and Field factory generation in one step::

@register_coercion('phone', description='A phone number', country_code='+1')
def PhoneNumber(v, config, source_url=None):
import re
digits = re.sub(r'\D', '', str(v))
return config.get('country_code', '+1') + digits
# PhoneNumber is now a Field factory:
# PhoneNumber(country_code='+44') -> Field(json_schema_extra={...})

Subclassing YosoiType is useful when you prefer the OOP style and want to group the factory and coercer under one class name::

class PhoneNumber(YosoiType):
type_name = 'phone'
@staticmethod
def coerce(v, config, source_url=None):
import re
digits = re.sub(r'\D', '', str(v))
return config.get('country_code', '+1') + digits
@classmethod
def field(cls, country_code='+1', description='A phone number', **kwargs):
from yosoi.types.field import Field
return Field(
description=description,
json_schema_extra={'yosoi_type': cls.type_name, 'country_code': country_code},
**kwargs,
)