Instapy: BUG: more than 1 xpath when mutual followers

Created on 20 Sep 2018  路  2Comments  路  Source: timgrossmann/InstaPy

@uluQulu I think this is your part of the code?
Can you assist here (I am no web/js dev).

 Traceback (most recent call last):
  File "quickstart.py", line 165, in job
    session.interact_user_followers(followers_list[:5], amount=20, randomize=True)
  File "C:\\22\instapy\instapy.py", line 2476, in interact_user_followers
    self.logfolder)
  File "C:\\22\instapy\unfollow_util.py", line 983, in get_given_user_followers
    allfollowers = format_number(browser.find_element_by_xpath("//a[contains"
  File "C:\\22\instapy\util.py", line 912, in format_number
    return int(formatted_num)
ValueError: invalid literal for int() with base 10: 'Followed by sivangino and or_richer16'

image

bug

Most helpful comment

@sionking It can be handled as usual

                    followers_element = browser.find_element_by_xpath("//a[contains"
                        "(@href,'followers')]/span")

                    if followers_elements:
                        allfollowers = format_number(followers_elements.text)

But since the profile is private and is not followed [yet], user cannot load any Followers/Following data from that page.
Shortly for that case of get_given_user_followers() definition which needs some Followers/Following data, the scenario must be as this:

  • check if the profile is private on top of other statements
  • if the profile is private and IS NOT followed, then return []

Cheers 馃榿

All 2 comments

opps account is private. so maybe we need to check it ?

@sionking It can be handled as usual

                    followers_element = browser.find_element_by_xpath("//a[contains"
                        "(@href,'followers')]/span")

                    if followers_elements:
                        allfollowers = format_number(followers_elements.text)

But since the profile is private and is not followed [yet], user cannot load any Followers/Following data from that page.
Shortly for that case of get_given_user_followers() definition which needs some Followers/Following data, the scenario must be as this:

  • check if the profile is private on top of other statements
  • if the profile is private and IS NOT followed, then return []

Cheers 馃榿

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thisishotdog picture thisishotdog  路  3Comments

wyvers picture wyvers  路  3Comments

CodeMaster1 picture CodeMaster1  路  3Comments

seuraltimez picture seuraltimez  路  3Comments

converge picture converge  路  3Comments