Esempio n. 1
0
 def __profile_from_record(self, record):
     props = record["profile"]
     level = int(props["level"])
     is_private = json.loads(props["is_private"].lower())
     profile = Profile(props["name"], level, is_private, "",
                       props["description"])
     profile.text = props["text"]
     profile.extract_references()
     return profile
Esempio n. 2
0
 def fetch_profile(self, target_name):
     if target_name in self.__fetched_profiles:
         return self.__fetched_profiles[target_name]
     # Open profile
     self.__browser.get("https://www.instagram.com/" + target_name + "/")
     self.__browser.implicitly_wait(1)
     # Check for softban
     if "Please wait a few minutes" in self.__browser.page_source:
         if self.verbose:
             print("Softban detected")
         return None
     # Get profile info
     is_private = "This Account is Private" in self.__browser.page_source
     pic = self.__browser.find_element_by_xpath("//img[@data-testid='user-avatar']").get_attribute("src")
     description = self.__browser.find_elements_by_xpath("//header/section/div")[1].text.replace("'", "").replace("\\", "")
     profile = Profile(target_name, self.__current_level, is_private, pic, description)
     if self.fetch_text:
         self.fetch_profile_text(profile)
     profile.extract_references()
     self.__fetched_profiles[profile.name] = profile
     if self.neo:
         self.neo.save(profile)
     time.sleep(self.delay)
     return profile