From aca5a8c9debbaa60951ba67a4602b6e8139aa5c9 Mon Sep 17 00:00:00 2001 From: Joey Date: Tue, 15 Nov 2022 12:51:54 +0100 Subject: [PATCH] [FEATURE] #137: Added Work Status --- linkedin_scraper/person.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/linkedin_scraper/person.py b/linkedin_scraper/person.py index 740b3b5..7acc590 100644 --- a/linkedin_scraper/person.py +++ b/linkedin_scraper/person.py @@ -18,6 +18,7 @@ def __init__( linkedin_url=None, name=None, about=None, + work_status=None, experiences=None, educations=None, interests=None, @@ -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 [] @@ -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 @@ -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( @@ -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: