Spaces:
Configuration error
Configuration error
Download app.py from shersingh/linkedinextractor: direct link, hf CLI and curl.
- Browser
- Download file 1.87 kB
-
https://huggingface.co/spaces/shersingh/linkedinextractor/resolve/main/app.py
- Command line
-
hf download hf://spaces/shersingh/linkedinextractor/app.py
-
curl -L -o app.py https://huggingface.co/spaces/shersingh/linkedinextractor/resolve/main/app.py
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}") | |