TextHandler
Extended string type with scraping-specific methods.Class Definition
Additional Methods
clean
bool
default:"False"
If True, also replaces HTML entities with their characters.
re
str | Pattern
required
Regular expression pattern (string or compiled).
bool
default:"True"
Replace HTML entities in matches.
bool
default:"False"
Clean whitespace before matching.
bool
default:"True"
Whether to match case-sensitively.
bool
default:"False"
If True, return bool indicating if pattern matches (no results extraction).
TextHandlers list of matches, or bool if check_match=True
Example:
re_first
str | Pattern
required
Regular expression pattern.
Any
default:"None"
Value to return if no match is found.
bool
default:"True"
Replace HTML entities in the match.
bool
default:"False"
Clean whitespace before matching.
bool
default:"True"
Whether to match case-sensitively.
json
sort
bool
default:"False"
Sort in descending order.
Scrapy/Parsel Compatibility
For easy migration from Scrapy/Parsel:TextHandlers
List ofTextHandler objects with collective operations.
Class Definition
Methods
re
re_first
get
Scrapy/Parsel Compatibility
AttributesHandler
Read-only mapping for HTML element attributes with additional functionality.Class Definition
Constructor
Methods
get
search_values
str
required
Keyword to search for in values.
bool
default:"False"
If True, use substring matching. If False, require exact match.
AttributesHandler for each matching key-value pair
Example: