Whitepaper
Docs
Sign In
Tool
Tool
v0.0.1
Local Web Scrape
Tool ID
local_web_scrape
Creator
@gunzo667
Downloads
433+
Web Scraper using local python modules (html2text and cloudscraper)
Get
README
No README available
Tool Code
Show
""" title: Local Web Scrape author: Gunzo version: 0.0.1 """ import cloudscraper import html2text class Tools: def __init__(self): pass def web_scrape(self, url: str) -> str: """ Scrape a web page. :param url: The URL of the web page to scrape. :return: The scraped and processed content without the Links/Buttons section, or an error message. """ try: # Step 1: Simulate a Chrome browser scraper = cloudscraper.create_scraper( browser={ "browser": "chrome", "platform": "windows", "mobile": False, } ) # Step 2: Fetch the content of the webpage response = scraper.get(url) response.raise_for_status() html_content = response.text # Step 3: Convert HTML to Markdown using html2text converter = html2text.HTML2Text() converter.ignore_links = True # Optional: Ignore links if not needed markdown_content = converter.handle(html_content) # Step 4: Return the processed Markdown content return markdown_content except Exception as e: return f"Error scraping web page: {str(e)}"