shersingh's picture
Upload 2 files
a166886 verified
Raw History Blame Contribute Delete
1.87 kB
import streamlit as st
import requests
st.set_page_config(page_title="LinkedIn Contact Extractor", page_icon="πŸ”", layout="centered")
st.title("πŸ” LinkedIn Contact Extractor")
st.write("Enter a LinkedIn profile URL to fetch contact details.")
if "API_KEY" in st.secrets:
api_key = st.secrets["API_KEY"]
else:
api_key = st.sidebar.text_input("Enter your API Key", type="password")
profile_url = st.text_input("LinkedIn Profile URL", placeholder="https://linkedin.com")
if st.button("Extract Contact Details"):
if not api_key:
st.error("Please configure your API Key in Streamlit Secrets or the sidebar.")
elif not profile_url:
st.error("Please provide a valid LinkedIn Profile URL.")
else:
with st.spinner("Fetching profile data safely..."):
try:
api_endpoint = "https://example-provider.com"
headers = {"Authorization": f"Bearer {api_key}"}
params = {"url": profile_url}
response = requests.get(api_endpoint, headers=headers, params=params)
if response.status_code == 200:
data = response.json()
st.success("Data retrieved successfully!")
col1, col2 = st.columns(2)
with col1:
st.subheader("πŸ“§ Email")
st.info(data.get("email") or "Not found")
with col2:
st.subheader("πŸ“ž Phone")
st.info(data.get("phone") or "Not found")
with st.expander("View Full JSON"):
st.json(data)
else:
st.error(f"API Error: {response.status_code}")
except Exception as e:
st.error(f"Error: {e}")