Spaces:
Running
Running
| from bs4 import BeautifulSoup | |
| import requests | |
| from dotenv import load_dotenv | |
| import sentry_sdk | |
| from sentry_sdk.integrations.serverless import serverless_function | |
| import os | |
| load_dotenv() | |
| sentry_dsn = os.getenv("SENTRY_DSN") | |
| sentry_sdk.init( | |
| dsn=sentry_dsn, | |
| send_default_pii=True, | |
| traces_sample_rate=1.0, | |
| _experiments={ | |
| "continuous_profiling_auto_start": True, | |
| }, | |
| ) | |
| def scrape_website(link, selector): | |
| r = requests.get(link) | |
| soup = BeautifulSoup(r.content, 'html.parser') | |
| results = [] | |
| for tag in soup.find_all(selector): | |
| results.append(tag.text) | |
| return results | |