- Notifications
You must be signed in to change notification settings - Fork 164
/
Copy pathlinkedin_profile.py
34 lines (32 loc) · 1.62 KB
/
linkedin_profile.py
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
fromseleniumimportwebdriver
frombs4importBeautifulSoup
importgetpass
importrequests
fromselenium.webdriver.common.keysimportKeys
importpprint
userid=str(input("Enter email address or number with country code: "))
password=getpass.getpass('Enter your password:')
driver=webdriver.Firefox()
driver.get("https://www.linkedin.com")
driver.implicitly_wait(6)
driver.find_element_by_xpath("""//*[@id="login-email"]""").send_keys(userid)
driver.find_element_by_xpath("""//*[@id="login-password"]""").send_keys(password)
driver.find_element_by_xpath("""//*[@id="login-submit"]""").click()
driver.get("https://www.linkedin.com/in/andriyburkov/") #Enter any of your connection profile Link
connectionName=driver.find_element_by_class_name('pv-top-card-section__name').get_attribute('innerHTML')
print(connectionName)
driver.find_element_by_css_selector('button.contact-see-more-less').click()
content=driver.find_element_by_css_selector(".pv-profile-section.pv-contact-info.artdeco-container-card.ember-view")
data=BeautifulSoup(content.get_attribute('innerHTML'), "lxml")
driver.find_element_by_tag_name('body').send_keys(Keys.CONTROL+'t')
forsectionindata.find_all('section'):
forheaderinsection.find_all('header'):
ifheader.contents[0] =='Email':
section.find_all('a')
print("Email Address"+section.a.contents[0])
ifheader.contents[0] =='Phone':
section.find_all('a')
print("Phone Number :"+section.a.contents[0])
ifheader.contents[0] =='Website':
section.find_all('a')
print("Phone Number :"+section.a.contents[0])