Selector

class scraper_toolkit.components.Selector.Selector(selector_str: str, name: str = None, attribute: str = None, post_processing: Callable = None)[source]

Represent a CSS selector with an optional name and target attribute, with an optional post-processing function.

Parameters:
  • selector_str – CSS selector as a string.
  • name – Optional name for the parsed attribute, useful for creating the header row when exporting as a CSV file.
  • attribute – HTML attribute of the element to store
  • post_processing – Optional function called on the parsed attribute before it is stored. Useful for cleaning up and splitting data.