Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion linkedin_scraper/person.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def __init__(
linkedin_url=None,
name=None,
about=None,
work_status=None,
experiences=None,
educations=None,
interests=None,
Expand All @@ -33,6 +34,7 @@ def __init__(
self.linkedin_url = linkedin_url
self.name = name
self.about = about or []
self.work_status = work_status = []
self.experiences = experiences or []
self.educations = educations or []
self.interests = interests or []
Expand Down Expand Up @@ -100,6 +102,10 @@ def _click_see_more_by_class_name(self, class_name):
except Exception as e:
pass

def _get_work_status(self, driver):
work_status_outer_box = driver.find_element(By.CLASS_NAME, "pv-open-to-carousel")
self.work_status += work_status_outer_box.text.split("\n")[:-1]

def scrape_logged_in(self, close_on_complete=True):
driver = self.driver
duration = None
Expand All @@ -115,6 +121,10 @@ def scrape_logged_in(self, close_on_complete=True):

self.name = root.find_element_by_class_name(selectors.NAME).text.strip()

# get work status
self._get_work_status(driver)


# get about
try:
see_more = WebDriverWait(driver, self.__WAIT_FOR_ELEMENT_TIMEOUT).until(
Expand Down Expand Up @@ -307,7 +317,6 @@ def scrape_logged_in(self, close_on_complete=True):
url = anchor.get_attribute("href")
name = conn.find_element_by_class_name("mn-connection-card__details").find_element_by_class_name("mn-connection-card__name").text.strip()
occupation = conn.find_element_by_class_name("mn-connection-card__details").find_element_by_class_name("mn-connection-card__occupation").text.strip()

contact = Contact(name=name, occupation=occupation, url=url)
self.add_contact(contact)
except:
Expand Down