Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexError: list index out of range #13

Open
giorgossavva opened this issue Oct 14, 2022 · 1 comment
Open

IndexError: list index out of range #13

giorgossavva opened this issue Oct 14, 2022 · 1 comment

Comments

@giorgossavva
Copy link

The code
next = True
while(next):
n_li_1 = len(self.driver.find_elements_by_class_name("FPmhX"))
self.driver.execute_script(next_scroll)
time.sleep(1.5)
n_li_2 = len(self.driver.find_elements_by_class_name("FPmhX"))
if(n_li_1 != n_li_2):
following = self.driver.find_elements_by_xpath("//*[contains(text(), 'Following')]")
for follow in following:
el = follow.find_element_by_xpath('../..')
el = el.find_element_by_tag_name('a')
profile = el.get_attribute('href')
my_followers_set.add(profile)
else:
next = False

        return list(my_followers_set)

The error
Traceback (most recent call last):
File "get_my_followers.py", line 34, in
get_my_followers(config)
File "get_my_followers.py", line 20, in get_my_followers
my_followers = b.get_my_followers(username)
File "C:\Users\user\PycharmProjects\testing\bot.py", line 71, in get_my_followers
followers[1].click()
IndexError: list index out of range

no idea what to do

@baohouse
Copy link

baohouse commented Sep 18, 2023

@giorgossavva This code was based on the Instagram layout in 2019. They've updated the UI since then, so this code needs to be updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants