Drop files here
or click to upload
import streamlit as st
import requests
from bs4 import BeautifulSoup
# Initial location dictionary (name: URL)
locations = {
"Paulie's Brickhouse, Jersey City NJ": "https://www.google.com/maps/place/Paulie%E2%80%99s+Brickhouse/@40.7438344,-74.0532455,17z/data=!3m1!4b1!4m6!3m5!1s0x89c25740356b32f7:0x8706b2dfe582d729!8m2!3d40.7438304!4d-74.0506652!16s%2Fg%2F11f3jj095t?entry=ttu&g_ep=EgoyMDI1MDcxNi4wIKXMDSoASAFQAw%3D%3D"
}
st.set_page_config(page_title="Popular Times Viewer", layout="wide")
st.title("📊 Popular Times Dashboard (Unofficial)")
# Sidebar inputs
st.sidebar.header("Add a New Location")
new_name = st.sidebar.text_input("Location Name")
new_url = st.sidebar.text_input("Google Maps URL")
if st.sidebar.button("Add Location"):
if new_name and new_url:
locations[new_name] = new_url
st.success(f"Added {new_name}")
else:
st.warning("Please provide both name and URL")
# Select locations to fetch
selected = st.multiselect("Select Locations to Fetch Popular Times", list(locations.keys()), default=list(locations.keys()))
if st.button("Fetch Popular Times"):
for name in selected:
url = locations[name]
st.markdown(f"### 🔍 {name}")
try:
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3"
}
response = requests.get(url, headers=headers)
soup = BeautifulSoup(response.text, 'html.parser')
# Basic detection logic (not full scraping)
if "Popular times" in response.text:
st.success("Popular times data is likely present.")
else:
st.info("No visible Popular Times data found.")
except Exception as e:
st.error(f"Error fetching {name}: {e}")
continue
Hi! I can help you with any questions about Streamlit and Python. What would you like to know?