minimal_web_scraper.parsers.utils#

Overview#

Function#

find_parser(url)

Find the parser for the associate URL.

add_parser(parser)

Add the given parser in the list that the scraper checks for parsing data.

Functions#

minimal_web_scraper.parsers.utils.find_parser(url: str) Type[BaseParser] | None#

Find the parser for the associate URL.

The scope_urls attribute of the parser is compared to the argument.

Parameters:

url

Raises:

ParserNotFound – raised when no registered parser can handle url

Returns:

associated parser

minimal_web_scraper.parsers.utils.add_parser(parser: Type[BaseParser] | None = None) None#

Add the given parser in the list that the scraper checks for parsing data.

Parameters:

parser – the parser must be a subclass of BaseParser. If no parser is provided, it will add all parsers imported (default None).

Raises:

TypeError – raised when the argument parser is not a subclass of BaseParser