Team Ai
Apppublic

PierreLepagnol/source-code-retriever-tool

sourceHugging Faceupdated 3y agoView on Hugging Face
0likes
source_code_retriever.py20 linesDownload Raw Back to root
1import requests2from bs4 import BeautifulSoup3from transformers import Tool4 5 6class ScrapperTool(Tool):7    name = "source_code_scrapper"8    description = (9        "This is a tool that retrieves the source code of a given webpage. "10        "It takes the URL of the webpage, and returns the source code."11    )12 13    inputs = ["text"]14    outputs = ["text"]15 16    def __call__(self, url: str):17        response = requests.get(url)18        soup = BeautifulSoup(response.text, 'html.parser')19        return soup.prettify()20