Skip to content

web_loader

WebLoader

Bases: BaseLoader[str, str, TextArtifact]

Source code in griptape/loaders/web_loader.py
@define
class WebLoader(BaseLoader[str, str, TextArtifact]):
    web_scraper_driver: BaseWebScraperDriver = field(
        default=Factory(lambda: TrafilaturaWebScraperDriver()),
        kw_only=True,
    )

    def fetch(self, source: str) -> str:
        return self.web_scraper_driver.fetch_url(source)

    def parse(self, data: str) -> TextArtifact:
        return self.web_scraper_driver.extract_page(data)

web_scraper_driver: BaseWebScraperDriver = field(default=Factory(lambda: TrafilaturaWebScraperDriver()), kw_only=True) class-attribute instance-attribute

fetch(source)

Source code in griptape/loaders/web_loader.py
def fetch(self, source: str) -> str:
    return self.web_scraper_driver.fetch_url(source)

parse(data)

Source code in griptape/loaders/web_loader.py
def parse(self, data: str) -> TextArtifact:
    return self.web_scraper_driver.extract_page(data)