Skip to content

Commit d29885d

Browse files
Added linkedin scraper (v1)
1 parent 0b471e3 commit d29885d

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

linkedin-scrape/geckodriver.exe

5.62 MB
Binary file not shown.

linkedin-scrape/linkedin_profile.py

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
from selenium import webdriver
2+
from bs4 import BeautifulSoup
3+
import getpass
4+
import requests
5+
from selenium.webdriver.common.keys import Keys
6+
import pprint
7+
userid = str(input("Enter email address or number with country code: "))
8+
password = getpass.getpass('Enter your password:')
9+
10+
driver = webdriver.Firefox()
11+
driver.get("https://www.linkedin.com")
12+
driver.implicitly_wait(6)
13+
driver.find_element_by_xpath("""//*[@id="login-email"]""").send_keys(userid)
14+
driver.find_element_by_xpath("""//*[@id="login-password"]""").send_keys(password)
15+
driver.find_element_by_xpath("""//*[@id="login-submit"]""").click()
16+
driver.get("https://www.linkedin.com/in/andriyburkov/") #Enter any of your connection profile Link
17+
18+
connectionName = driver.find_element_by_class_name('pv-top-card-section__name').get_attribute('innerHTML')
19+
print(connectionName)
20+
driver.find_element_by_css_selector('button.contact-see-more-less').click()
21+
content = driver.find_element_by_css_selector(".pv-profile-section.pv-contact-info.artdeco-container-card.ember-view")
22+
data = BeautifulSoup(content.get_attribute('innerHTML'), "lxml")
23+
driver.find_element_by_tag_name('body').send_keys(Keys.CONTROL + 't')
24+
for section in data.find_all('section'):
25+
for header in section.find_all('header'):
26+
if header.contents[0] == 'Email':
27+
section.find_all('a')
28+
print("Email Address" + section.a.contents[0])
29+
if header.contents[0] == 'Phone':
30+
section.find_all('a')
31+
print("Phone Number :" + section.a.contents[0])
32+
if header.contents[0] == 'Website':
33+
section.find_all('a')
34+
print("Phone Number :" + section.a.contents[0])

0 commit comments

Comments
 (0)