0

I've used Instaloader to collect profile data and push to a Google Sheet. In terminal, the output is correct.

When the info loads into the spreadsheet - the numbers are inaccurate.

I've tried switching the type of followee.followees (integer, string, float), but none have worked.

Has anyone found a solution for this? Confused what else I could try. My code is below:

import gspread
import instaloader
loader = instaloader.Instaloader()

gc = gspread.service_account(filename='creds.json')
sh = gc.open_by_key('1cD8mX8tR2iSQgSmpk6QxBVVHYVV8VxGs2uhtA8iBSpQ')
worksheet = sh.sheet1

loader.login(username, password)

profile = instaloader.Profile.from_username(loader.context, "nba")

followees = profile.get_followees()

for followee in profile.get_followees():
    print('{} has {} followees'.format(followee.username, followee.followers))

    AddValue = [followee.username, int(followee.followees)]
    worksheet.append_row(AddValue)

This is my terminal result:

VS Output

Whereas this is the result that is pushed to Google Sheets (from the same code):

Spreadsheet Result

As you can see, the numbers are drastically different.

Anthony Madle
  • 371
  • 1
  • 10

1 Answers1

0

Script has small typo -

 AddValue = [followee.username, int(followee.followers)]

should be

AddValue = [followee.username, int(followee.followees)]

Nothing to do with type, I was just calling the wrong value (followers vs. followees)

Anthony Madle
  • 371
  • 1
  • 10