Update app.py
Browse files
app.py
CHANGED
|
@@ -1,238 +1,100 @@
|
|
| 1 |
-
# main_dashboard.py
|
| 2 |
-
import streamlit as st
|
| 3 |
-
import
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
.
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
.
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
#
|
| 91 |
-
|
| 92 |
-
st.
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
col1, col2, col3 = st.columns(3)
|
| 102 |
-
|
| 103 |
-
with col1:
|
| 104 |
-
st.markdown("""
|
| 105 |
-
<div class="platform-card linkedin-card">
|
| 106 |
-
<h3>πΌ LinkedIn Extractor</h3>
|
| 107 |
-
<ul class="feature-list">
|
| 108 |
-
<li>No login required</li>
|
| 109 |
-
<li>Profile, company, and post analysis</li>
|
| 110 |
-
<li>Quick data extraction</li>
|
| 111 |
-
<li>AI-powered insights</li>
|
| 112 |
-
<li>100% Free</li>
|
| 113 |
-
</ul>
|
| 114 |
-
</div>
|
| 115 |
-
""", unsafe_allow_html=True)
|
| 116 |
-
|
| 117 |
-
if st.button("π Launch LinkedIn Extractor", key="linkedin_btn", use_container_width=True):
|
| 118 |
-
if not st.session_state.get('hf_api_key'):
|
| 119 |
-
st.error("β Please enter your HuggingFace API Key first")
|
| 120 |
-
else:
|
| 121 |
-
if os.path.exists("linkdin_deploy.py"):
|
| 122 |
-
port = get_available_port(8601)
|
| 123 |
-
st.session_state.linkedin_port = port
|
| 124 |
-
with st.spinner(f"Starting LinkedIn extractor..."):
|
| 125 |
-
run_streamlit_app_in_thread("linkdin_deploy.py", port)
|
| 126 |
-
time.sleep(3)
|
| 127 |
-
webbrowser.open_new_tab(f"http://localhost:{port}")
|
| 128 |
-
st.success(f"β
LinkedIn extractor launched!")
|
| 129 |
-
else:
|
| 130 |
-
st.error("β linkdin_deploy.py file not found!")
|
| 131 |
-
|
| 132 |
-
with col2:
|
| 133 |
-
st.markdown("""
|
| 134 |
-
<div class="platform-card facebook-card">
|
| 135 |
-
<h3>π Facebook Extractor</h3>
|
| 136 |
-
<ul class="feature-list">
|
| 137 |
-
<li>Manual login required</li>
|
| 138 |
-
<li>Group post extraction</li>
|
| 139 |
-
<li>Works with private groups</li>
|
| 140 |
-
<li>AI conversation analysis</li>
|
| 141 |
-
<li>100% Free</li>
|
| 142 |
-
</ul>
|
| 143 |
-
</div>
|
| 144 |
-
""", unsafe_allow_html=True)
|
| 145 |
-
|
| 146 |
-
if st.button("π Launch Facebook Extractor", key="facebook_btn", use_container_width=True):
|
| 147 |
-
if not st.session_state.get('hf_api_key'):
|
| 148 |
-
st.error("β Please enter your HuggingFace API Key first")
|
| 149 |
-
else:
|
| 150 |
-
if os.path.exists("facebook_deploy.py"):
|
| 151 |
-
port = get_available_port(8701)
|
| 152 |
-
st.session_state.facebook_port = port
|
| 153 |
-
with st.spinner(f"Starting Facebook extractor..."):
|
| 154 |
-
run_streamlit_app_in_thread("facebook_deploy.py", port)
|
| 155 |
-
time.sleep(3)
|
| 156 |
-
webbrowser.open_new_tab(f"http://localhost:{port}")
|
| 157 |
-
st.success(f"β
Facebook extractor launched!")
|
| 158 |
-
else:
|
| 159 |
-
st.error("β facebook_deploy.py file not found!")
|
| 160 |
-
|
| 161 |
-
with col3:
|
| 162 |
-
st.markdown("""
|
| 163 |
-
<div class="platform-card facebook-pro-card">
|
| 164 |
-
<h3>π₯ Facebook Extractor 2.0</h3>
|
| 165 |
-
<ul class="feature-list">
|
| 166 |
-
<li>Enhanced Facebook data extraction</li>
|
| 167 |
-
<li>More powerful algorithms</li>
|
| 168 |
-
<li>Faster processing speed</li>
|
| 169 |
-
<li>Advanced AI analysis</li>
|
| 170 |
-
<li>100% Free</li>
|
| 171 |
-
</ul>
|
| 172 |
-
</div>
|
| 173 |
-
""", unsafe_allow_html=True)
|
| 174 |
-
|
| 175 |
-
if st.button("π Launch Facebook Extractor 2.0", key="facebook_pro_btn", use_container_width=True):
|
| 176 |
-
if not st.session_state.get('hf_api_key'):
|
| 177 |
-
st.error("β Please enter your HuggingFace API Key first")
|
| 178 |
-
else:
|
| 179 |
-
if os.path.exists("let_deploy.py"):
|
| 180 |
-
port = get_available_port(8801)
|
| 181 |
-
st.session_state.facebook_pro_port = port
|
| 182 |
-
with st.spinner(f"Starting Facebook Extractor 2.0..."):
|
| 183 |
-
run_streamlit_app_in_thread("let_deploy.py", port)
|
| 184 |
-
time.sleep(3)
|
| 185 |
-
webbrowser.open_new_tab(f"http://localhost:{port}")
|
| 186 |
-
st.success(f"β
Facebook Extractor 2.0 launched!")
|
| 187 |
-
else:
|
| 188 |
-
st.error("β let_deploy.py file not found!")
|
| 189 |
-
|
| 190 |
-
# Status
|
| 191 |
-
st.markdown("---")
|
| 192 |
-
st.subheader("π Current Status")
|
| 193 |
-
|
| 194 |
-
status_col1, status_col2, status_col3 = st.columns(3)
|
| 195 |
-
|
| 196 |
-
with status_col1:
|
| 197 |
-
st.markdown("### πΌ LinkedIn")
|
| 198 |
-
if st.session_state.linkedin_port:
|
| 199 |
-
st.success(f"β
Running on port {st.session_state.linkedin_port}")
|
| 200 |
-
else:
|
| 201 |
-
st.info("π€ Not running")
|
| 202 |
-
|
| 203 |
-
with status_col2:
|
| 204 |
-
st.markdown("### π Facebook")
|
| 205 |
-
if st.session_state.facebook_port:
|
| 206 |
-
st.success(f"β
Running on port {st.session_state.facebook_port}")
|
| 207 |
-
else:
|
| 208 |
-
st.info("π€ Not running")
|
| 209 |
-
|
| 210 |
-
with status_col3:
|
| 211 |
-
st.markdown("### π₯ Facebook 2.0")
|
| 212 |
-
if st.session_state.facebook_pro_port:
|
| 213 |
-
st.success(f"β
Running on port {st.session_state.facebook_pro_port}")
|
| 214 |
-
else:
|
| 215 |
-
st.info("π€ Not running")
|
| 216 |
-
|
| 217 |
-
# Instructions
|
| 218 |
-
with st.expander("π How to Use", expanded=True):
|
| 219 |
-
st.markdown("""
|
| 220 |
-
1. **Get FREE API Key:**
|
| 221 |
-
- Go to https://huggingface.co/settings/tokens
|
| 222 |
-
- Create account (FREE)
|
| 223 |
-
- Click "New token"
|
| 224 |
-
- Copy your token (starts with hf_)
|
| 225 |
-
|
| 226 |
-
2. **Enter API Key above**
|
| 227 |
-
|
| 228 |
-
3. **Click any extractor to launch**
|
| 229 |
-
|
| 230 |
-
4. **For Streamlit Cloud:**
|
| 231 |
-
- Add this to Secrets:
|
| 232 |
-
```
|
| 233 |
-
HUGGINGFACEHUB_API_TOKEN = "your_token_here"
|
| 234 |
-
```
|
| 235 |
-
""")
|
| 236 |
-
|
| 237 |
-
if __name__ == "__main__":
|
| 238 |
-
main()
|
|
|
|
| 1 |
+
# main_dashboard.py
|
| 2 |
+
import streamlit as st
|
| 3 |
+
import os
|
| 4 |
+
|
| 5 |
+
def main():
|
| 6 |
+
st.set_page_config(
|
| 7 |
+
page_title="Social Media Data Extractor",
|
| 8 |
+
page_icon="π",
|
| 9 |
+
layout="wide",
|
| 10 |
+
initial_sidebar_state="expanded"
|
| 11 |
+
)
|
| 12 |
+
|
| 13 |
+
st.markdown("""
|
| 14 |
+
<style>
|
| 15 |
+
.stApp { background-color: #0e1117; color: white; }
|
| 16 |
+
.main-header { background: linear-gradient(135deg, #1a2a6c, #b21f1f); color: white; padding: 2rem; border-radius: 10px; text-align: center; margin-bottom: 2rem; }
|
| 17 |
+
.platform-card { background-color: #262730; padding: 1.5rem; border-radius: 10px; border-left: 4px solid; margin: 1rem 0; height: 280px; }
|
| 18 |
+
.linkedin-card { border-left-color: #0077B5; }
|
| 19 |
+
.facebook-card { border-left-color: #1877F2; }
|
| 20 |
+
.facebook-pro-card { border-left-color: #FF6B35; }
|
| 21 |
+
.feature-list { margin: 1rem 0; padding-left: 1.5rem; flex-grow: 1; }
|
| 22 |
+
.api-key-section { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); padding: 1.5rem; border-radius: 10px; margin-bottom: 2rem; }
|
| 23 |
+
</style>
|
| 24 |
+
""", unsafe_allow_html=True)
|
| 25 |
+
|
| 26 |
+
# Header
|
| 27 |
+
st.markdown("""
|
| 28 |
+
<div class="main-header">
|
| 29 |
+
<h1 style="margin:0;">π Social Media Data Extractor</h1>
|
| 30 |
+
<p style="margin:0; opacity: 0.9;">100% Free - No Local Setup Required</p>
|
| 31 |
+
</div>
|
| 32 |
+
""", unsafe_allow_html=True)
|
| 33 |
+
|
| 34 |
+
# Platform selection
|
| 35 |
+
st.markdown("## π Launch Extractors")
|
| 36 |
+
|
| 37 |
+
col1, col2, col3 = st.columns(3)
|
| 38 |
+
|
| 39 |
+
with col1:
|
| 40 |
+
st.markdown("""
|
| 41 |
+
<div class="platform-card linkedin-card">
|
| 42 |
+
<h3>πΌ LinkedIn Extractor</h3>
|
| 43 |
+
<ul class="feature-list">
|
| 44 |
+
<li>No login required</li>
|
| 45 |
+
<li>Profile, company, and post analysis</li>
|
| 46 |
+
<li>Quick data extraction</li>
|
| 47 |
+
<li>AI-powered insights</li>
|
| 48 |
+
<li>100% Free</li>
|
| 49 |
+
</ul>
|
| 50 |
+
</div>
|
| 51 |
+
""", unsafe_allow_html=True)
|
| 52 |
+
|
| 53 |
+
if st.button("π Launch LinkedIn Extractor", key="linkedin_btn", use_container_width=True):
|
| 54 |
+
st.switch_page("pages/linkedin_extractor.py")
|
| 55 |
+
|
| 56 |
+
with col2:
|
| 57 |
+
st.markdown("""
|
| 58 |
+
<div class="platform-card facebook-card">
|
| 59 |
+
<h3>π Facebook Extractor</h3>
|
| 60 |
+
<ul class="feature-list">
|
| 61 |
+
<li>Manual login required</li>
|
| 62 |
+
<li>Group post extraction</li>
|
| 63 |
+
<li>Works with private groups</li>
|
| 64 |
+
<li>AI conversation analysis</li>
|
| 65 |
+
<li>100% Free</li>
|
| 66 |
+
</ul>
|
| 67 |
+
</div>
|
| 68 |
+
""", unsafe_allow_html=True)
|
| 69 |
+
|
| 70 |
+
if st.button("π Launch Facebook Extractor", key="facebook_btn", use_container_width=True):
|
| 71 |
+
st.switch_page("pages/facebook_extractor.py")
|
| 72 |
+
|
| 73 |
+
with col3:
|
| 74 |
+
st.markdown("""
|
| 75 |
+
<div class="platform-card facebook-pro-card">
|
| 76 |
+
<h3>π₯ Facebook Extractor 2.0</h3>
|
| 77 |
+
<ul class="feature-list">
|
| 78 |
+
<li>Enhanced Facebook data extraction</li>
|
| 79 |
+
<li>More powerful algorithms</li>
|
| 80 |
+
<li>Faster processing speed</li>
|
| 81 |
+
<li>Advanced AI analysis</li>
|
| 82 |
+
<li>100% Free</li>
|
| 83 |
+
</ul>
|
| 84 |
+
</div>
|
| 85 |
+
""", unsafe_allow_html=True)
|
| 86 |
+
|
| 87 |
+
if st.button("π Launch Facebook Extractor 2.0", key="facebook_pro_btn", use_container_width=True):
|
| 88 |
+
st.switch_page("pages/facebook_extractor_pro.py")
|
| 89 |
+
|
| 90 |
+
# Instructions
|
| 91 |
+
with st.expander("π How to Use", expanded=True):
|
| 92 |
+
st.markdown("""
|
| 93 |
+
1. **Click any extractor to launch**
|
| 94 |
+
2. **For LinkedIn:** Enter any LinkedIn URL
|
| 95 |
+
3. **For Facebook:** Manual login required for private groups
|
| 96 |
+
4. **AI Analysis:** Chat with extracted data
|
| 97 |
+
""")
|
| 98 |
+
|
| 99 |
+
if __name__ == "__main__":
|
| 100 |
+
main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|