Search code examples
pythonapitwittertweepy

Tweepy showing less list members; is it a bug or limitation?


I have a list having 64 members in it, but when I try to extract members it only shows the first 20 members of the list. Is this an API limitation or a bug? Can I get the full list of members?

members = api.list_members(list_id = 1277128771720495104)
print(len(members)) 

ouput: 20

Solution

  • GET lists/members, the Twitter API endpoint that API.list_members uses, has a count parameter that:

    Specifies the number of results to return per page [. . .]. The default is 20, with a maximum of 5,000.

    E.g.:

    >>> members = api.list_members(list_id = 1277128771720495104)
    >>> print(len(members))
    20
    >>> members = api.list_members(list_id = 1277128771720495104, count = 5000)
    >>> print(len(members))
    63