Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,29 @@
|
|
1 |
-
# visa_D_search.py
|
2 |
-
|
3 |
import streamlit as st
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
-
|
6 |
-
st.title("Visa Search Application")
|
7 |
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
+
import requests
|
3 |
+
from bs4 import BeautifulSoup
|
4 |
+
|
5 |
+
def scrape_irish_embassy_website(url):
|
6 |
+
"""Scrapes the Irish Embassy website for specific information."""
|
7 |
+
try:
|
8 |
+
response = requests.get(url)
|
9 |
+
response.raise_for_status() # Raise HTTPError for bad responses (4xx or 5xx)
|
10 |
+
soup = BeautifulSoup(response.content, 'html.parser')
|
11 |
+
# ... your scraping logic here ...
|
12 |
+
# Example: Find all the links on the page
|
13 |
+
links = [a['href'] for a in soup.find_all('a', href=True)]
|
14 |
+
return links
|
15 |
+
except requests.exceptions.RequestException as e:
|
16 |
+
st.error(f"Error accessing the website: {e}")
|
17 |
+
return []
|
18 |
+
|
19 |
+
# Streamlit app
|
20 |
+
st.title("Irish Embassy Website Scraper")
|
21 |
|
22 |
+
url = st.text_input("Enter the Irish Embassy website URL:")
|
|
|
23 |
|
24 |
+
if url:
|
25 |
+
scraped_data = scrape_irish_embassy_website(url)
|
26 |
+
if scraped_data:
|
27 |
+
st.write("Scraped data:")
|
28 |
+
for item in scraped_data:
|
29 |
+
st.write(item)
|