File size: 2,199 Bytes
1013fb5
 
 
 
 
4b863d4
 
 
775f2c3
1013fb5
4b863d4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1013fb5
ff844c6
 
4b863d4
ff844c6
 
 
 
1013fb5
ff844c6
4b863d4
1013fb5
 
 
 
 
ff844c6
 
1013fb5
ff844c6
 
1013fb5
ff844c6
 
1013fb5
ff844c6
 
 
 
 
 
1013fb5
ff844c6
 
1013fb5
ff844c6
 
1013fb5
ff844c6
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
import gradio as gr

from playwright.sync_api import sync_playwright
from bs4 import BeautifulSoup

import requests
from bs4 import BeautifulSoup
import gradio as gr

def scrape_profile(url):
    headers = {
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36"
    }
    
    response = requests.get(url, headers=headers)
    
    if response.status_code != 200:
        return "Failed to retrieve profile. Ensure the URL is correct and accessible."
    
    soup = BeautifulSoup(response.text, "html.parser")

    # Extract profile details (Modify selectors as needed)
    name = soup.find("h1").text.strip() if soup.find("h1") else "Name not found"
    summary = soup.find("p").text.strip() if soup.find("p") else "Summary not found"

    return f"Name: {name}\nSummary: {summary}"

# Gradio UI
iface = gr.Interface(
    fn=scrape_profile,
    inputs=gr.Textbox(label="Enter LinkedIn Profile URL"),
    outputs=gr.Textbox(label="Profile Data"),
    live=True
)

iface.launch()
 





# def home():
#     return "Welcome, Name!\nHeadline: [Your Headline]\nLocation: [Your Location]\nIndustry: [Your Industry]\nSummary: [Your Summary]\nExperience: [Your Experience]\nEducation: [Your Education]"

# def interests():
#     return "Suggested Areas of Interest:\n☑ AI\n☑ FinTech\n☑ Software Engineering\n[Express in Natural Language]"

# def networking():
#     return "People to Follow:\n- Person 1\n- Person 2\nPeople to Connect:\n- Person 3\n- Person 4\nPosts to Read:\n- Post 1\n- Post 2"

# def jobs():
#     return "Set Job Goals: [Your Job Goals]\nJobs to Apply:\n- Job 1\n- Job 2\nRecruiters to Connect:\n- Recruiter 1\n- Recruiter 2\nCourses to Learn:\n- Course 1\n- Course 2"

# # Gradio UI
# with gr.Blocks() as demo:
#     gr.Markdown("## Enter a LinkedIn Profile URL to Extract Data")

#     url_input = gr.Textbox(label="LinkedIn Profile URL", placeholder="https://www.linkedin.com/in/username/")
#     output_box = gr.Textbox(label="Extracted Profile Data")

#     submit_btn = gr.Button("Submit")
#     submit_btn.click(scrape_profile, inputs=url_input, outputs=output_box)  

# demo.launch()