Finding all the people that liked an instagram post in selenium

182
March 26, 2022, at 06:20 AM

I've written the code here,

from selenium.webdriver.common.action_chains import ActionChains
action = ActionChains(driver)
l=driver.find_element_by_link_text("others")
l.click()
users = []
for i in range(100):
    time.sleep(1)
    other = driver.find_element_by_xpath("//*[@class='             qF0y9          Igw0E     IwRSH      eGOV_        vwCYk                                                                            i0EQd                                   ']/div")
    other.click()
    action.key_down(Keys.SPACE).key_up(Keys.SPACE).perform()
    print(other.text)
    x = other.text.splitlines()
    users.append(x)
print(users)

It first goes to a posting, clicks on "others" which pops up the likes. Then I have the element ("pop up which shows all the users that like the post") and I scroll through it, appending them to an array.

However, the problem is that it scrapes the username, their bioname(subtitle), and the follow button. How can I only keep their actual username?

Rent Charter Buses Company
READ ALSO
Custom train-test split using two stratified classes

Custom train-test split using two stratified classes

I am trying to use NLP techniques to predict the mental status of patients at the time doctor's notes were takenI have two classes, suffix (multilabel) as well as mental_status (binary, Lucid or Delirium)

183
I'm learning Python and want to remove data from a CSV file

I'm learning Python and want to remove data from a CSV file

The CSV file I'm trying to change has 2 columns

144