MaximPiessen / instagram_network_analysis

75 stars 45 forks source link

IndexError: list index out of range #13

Open giorgossavva opened 1 year ago

giorgossavva commented 1 year ago

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 commented 1 year ago

@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.