def _get_url(self): tag = ph.match_first_pattern(self._html, self._REGEX) start_index = tag.index("href='/") title_index = tag.index("trk=") #TODO: Clean this up return LINKEDIN_URL + \ ph.clean_data(tag[start_index + 7:title_index])
def _profile_url(self): pattern = "<a href=(.*)/profile[^>]*>" url = "{0}profile/view?id=".format(LINKEDIN_URL) tag = ph.match_first_pattern(self._html, pattern) index_of_string = '' title_string = '' if tag.find("view?id"): index_of_string = "id=" title_string = "&authType" elif tag.find("viewProfile=&"): index_of_string = "key=" title_string = "&authToken" offset = len(index_of_string) start_index = offset + tag.index(index_of_string) title_index = tag.index(title_string) return url + ph.clean_data(tag[start_index:title_index])
def _name(self): pattern = " title='View profile'>.*</a>" tag = ph.match_first_pattern(self._html, pattern) return ph.extract_tag_text(tag)
def _get_description(self): tag = ph.match_first_pattern(self._html, self._REGEX) return ph.extract_tag_text(tag)
def _extract_metric(self, pattern_value): pattern = "<span class='{0}'>.*</span>".format(pattern_value) tag = ph.match_first_pattern(self._html, pattern) return ph.extract_tag_text(tag)
def _job_title(self): pattern = "<dd class='title'>.*</dd>" tag = ph.match_first_pattern(self._html, pattern) return ph.extract_tag_text(tag)