File size: 2,692 Bytes
bfd33ae
1d78e87
1b15c3a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
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
import streamlit as st
import os
import subprocess
from streamlit_extras.let_it_rain import rain
from streamlit_extras.add_vertical_space import add_vertical_space

def save_env_config(email, password, query, people_filter, hiring_vals, locations, companies):
    config_lines = [
        f"LINKEDIN_EMAIL={email}",
        f"LINKEDIN_PASSWORD={password}",
        f"SEARCH_QUERY={query}",
        f"APPLY_PEOPLE_FILTER={'True' if people_filter else 'False'}",
        f"ACTIVELY_HIRING_VALUES={hiring_vals}",
        f"LOCATIONS={locations}",
        f"CURRENT_COMPANIES={companies}"
    ]
    with open("config.env", "w") as f:
        f.write("\n".join(config_lines))

st.set_page_config(page_title="LinkedIn Automation Tool", page_icon="πŸ”", layout="centered")

st.markdown("""
    <style>
        .main {
            background-color: #f5f5f5;
            padding: 2rem;
            border-radius: 10px;
            box-shadow: 0 0 10px rgba(0,0,0,0.1);
        }
        .stButton>button {
            background-color: #0072b1;
            color: white;
            font-weight: bold;
        }
    </style>
""", unsafe_allow_html=True)

st.image("https://cdn-icons-png.flaticon.com/512/174/174857.png", width=80)
st.title("πŸ” LinkedIn Automation Tool")
st.caption("Automate search and connection on LinkedIn with custom filters")

add_vertical_space(1)

with st.container():
    email = st.text_input("πŸ“§ LinkedIn Email")
    password = st.text_input("πŸ”’ LinkedIn Password", type="password")
    search_query = st.text_input("πŸ” Search Query", placeholder="e.g. Data Scientist")
    people_filter = st.checkbox("πŸ‘₯ Apply 'People' Filter")
    hiring_values = st.text_input("πŸ’Ό Actively Hiring Job Titles", placeholder="e.g. Software Engineer, Product Manager")
    locations = st.text_input("🌍 Locations", placeholder="e.g. India, United States")
    companies = st.text_input("🏒 Current Companies", placeholder="e.g. Google, Microsoft")

add_vertical_space(1)

if st.button("πŸš€ Run LinkedIn Bot"):
    if email and password and search_query:
        save_env_config(email, password, search_query, people_filter, hiring_values, locations, companies)
        st.success("βœ… Config file saved. Running the bot...")

        try:
            subprocess.run(["python", "main.py"], check=True)
            st.balloons()
            rain(emoji="πŸ€–", font_size=30, falling_speed=5, animation_length=1.5)
            st.success("πŸŽ‰ Bot execution finished.")
        except subprocess.CalledProcessError as e:
            st.error(f"❌ Bot execution failed: {e}")
    else:
        st.error("⚠️ Please enter all required fields (email, password, search query)")