import streamlit as st import requests from bs4 import BeautifulSoup def scrape_irish_embassy_website(url): """Scrapes the Irish Embassy website for specific information.""" try: response = requests.get(url) response.raise_for_status() # Raise HTTPError for bad responses (4xx or 5xx) soup = BeautifulSoup(response.content, 'html.parser') # ... your scraping logic here ... # Example: Find all the links on the page links = [a['href'] for a in soup.find_all('a', href=True)] return links except requests.exceptions.RequestException as e: st.error(f"Error accessing the website: {e}") return [] # Streamlit app st.title("Website Scraper") url = st.text_input("Enter the Irish Embassy website URL:") if url: scraped_data = scrape_irish_embassy_website(url) if scraped_data: st.write("Scraped data:") for item in scraped_data: st.write(item)