1 year ago

#383608

test-img

TheExtraSpicyBeef

Getting IG Followers using Selenium not returning all results (some followers missing)

I am trying to scrape my IG followers list using Selenium. I have managed to be able to login, open the followers tab and scroll to the bottom ( in order to load all the followers in). Everything works well, everything is loaded in, but when I use find_elements_by_x, I dont get all the results (I can tell from using the selector in the console). I have tested this issue with different accounts, and different selectors but with few differences. It also seems that the problem scales

For eg.

63 followers: 63 results

280 followers: 260 results

520 followers: 492 results

712 followers: around 620 results

I have tested using various elements in the ul, best I have done is

d = driver.find_elements_by_xpath("//*[@class='Jv7Aj mArmR MqpiF  ']")

which returns the afformentioned values but still not as many as there actually are. Since the difference is so small, its difficult to find where the problem lies. Any ideas?

I have used:

driver.find_elements_by_class_name("wo9IH")
driver.find_elements_by_xpath("//*[@class='notranslate _0imsa ']")
driver.find_elements_by_xpath("//*[@class='Jv7Aj mArmR MqpiF  ']")
driver.find_elements_by_xpath("//*[@class='_7UhW9   xLCgt        qyrsm KV-D4           se6yk       T0kll ']")
driver.find_elements_by_class_name("uu6c_")
driver.find_element_by_xpath('/html/body/div[6]/div/div/div/div[2]/ul/div/li['+str(i)+']/div/div[1]/div[2]/div[1]/span/a')

In the console,

$x("count(//*[@class='_7UhW9 xLCgt qyrsm KV-D4 se6yk T0kll '])") returns the correct amount of followers

HTML Source Code

UPDATE: It seems that this is an Instagram problem. Sometimes when scrolling you get a different amount of followers in the list, with some missing. So frustrating. If anyone knows a fix let me know.

python

selenium

web-crawler

instagram

0 Answers

Your Answer

Accepted video resources