Skip to content

Instantly share code, notes, and snippets.

@kmandana
Last active April 18, 2020 19:28
Show Gist options
  • Select an option

  • Save kmandana/106255c5f9908b76f761e9db510c03e7 to your computer and use it in GitHub Desktop.

Select an option

Save kmandana/106255c5f9908b76f761e9db510c03e7 to your computer and use it in GitHub Desktop.
Scraping Usernames
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