Twint: Cannot format user lookup

Created on 31 Oct 2019  路  6Comments  路  Source: twintproject/twint

Hi guys,

Hope you are all well !

I cannot format the output while doing a lookup on a user.

Any ideas about how to solve this problem ?

import twint

account_id = "953155617098694656"

def getUsername(target):
  c = twint.Config()
  c.User_id = target
  c.Store_object = True
  c.Hide_output = False
  c.Debug = True
  c.Format = "ID {id} | Username {username}"
  twint.run.Lookup(c)
  return twint.output.users_list

if __name__ == "__main__":
  getUsername(account_id)

error triggered
$ python3 test.py CRITICAL:root:twint.get:User:replace() argument 2 must be str, not None

Best,
X.

Most helpful comment

if I comment c.Format, I have

953155617098694656 | MO7EP | @MO7EPMASRY | Private: 0 | Verified: 0 | Bio:  | Location:  | Url: None | Joined: 15 Jan 2018 10:43 PM | Tweets: 107 | Following: 1986 | Followers: 56 | Likes: 2 | Media: 2 | Avatar: https://abs.twimg.com/sticky/default_profile_images/default_profile_400x400.png

so there is a problem in formatting the outpout

All 6 comments

You have verified that you get the user details without the format?
I'm asking because I just discovered that I'm only getting Username - 'NoneType' object is not subscriptable on all User searches.

if I comment c.Format, I have

953155617098694656 | MO7EP | @MO7EPMASRY | Private: 0 | Verified: 0 | Bio:  | Location:  | Url: None | Joined: 15 Jan 2018 10:43 PM | Tweets: 107 | Following: 1986 | Followers: 56 | Likes: 2 | Media: 2 | Avatar: https://abs.twimg.com/sticky/default_profile_images/default_profile_400x400.png

so there is a problem in formatting the outpout

immagine

works for that but not for csv output... ^^

@x0rzkov for CSV/JSON output you have to set c.Custom['user']

immagine

it works, thanks a lot !

Was this page helpful?
0 / 5 - 0 ratings