Last active
April 18, 2020 19:28
-
-
Save kmandana/106255c5f9908b76f761e9db510c03e7 to your computer and use it in GitHub Desktop.
Scraping Usernames
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| user_names = list() | |
| while len(user_names) < int(no_of_likes): | |
| popup = WebDriverWait(self.browser, 10).until(EC.presence_of_element_located((By.CSS_SELECTOR, 'body > div.RnEpo.Yx5HN > div > div.Igw0E.IwRSH.eGOV_.vwCYk.i0EQd > div'))) | |
| raw_data = BS(popup.get_attribute('innerHTML'), 'html.parser') | |
| for each in raw_data.find_all('a'): | |
| if 'title' in each.attrs.keys(): | |
| if each.attrs['title'] not in user_names: | |
| user_names.append(each.attrs['title']) | |
| self.browser.execute_script("arguments[0].scrollTop = arguments[0].scrollHeight", popup) | |
| time.sleep(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment