python - 使用最新的 twitter api 和 python 检索多个用户对象

标签 python twitter

最新版本的 Twitter api 是否删除了通过一次调用检索多个用户对象的功能?

如果不是的话,还是GetUser函数吗?

如果我有用户屏幕名称列表,如何通过一次调用检索所有用户对象?

例如如果列表是: 用户 = [用户1,用户2,用户3......用户200]

开发者手册可能有答案,但我正在努力找出答案。

最佳答案

用户查找没有为您提供所需的信息吗?

GET users/lookup

引用:https://dev.twitter.com/docs/api/1/get/users/lookup

Return up to 100 users worth of extended information, specified by either ID, screen name, or combination of the two. The author's most recent status (if the authenticating user has permission) will be returned inline.

This method is crucial for consumers of the Streaming API. It's also well suited for use in tandem with friends/ids and followers/ids.


python-twitter ,可通过以下方式访问:

def UsersLookup(self, user_id=None, screen_name=None, users=None):

来源:https://github.com/bear/python-twitter/blob/master/twitter.py#L3189

Fetch extended information for the specified users.

Users may be specified either as lists of either user_ids, screen_names, or twitter.User objects. The list of users that are queried is the union of all specified parameters.

The twitter.Api instance must be authenticated.

Args: user_id: A list of user_ids to retrieve extended information. [Optional] screen_name: A list of screen_names to retrieve extended information. [Optional] users: A list of twitter.User objects to retrieve extended information. [Optional]

Returns: A list of twitter.User objects for the requested users


这是“tweepy”的一些信息

""" Perform bulk look up of users from user ID or screenname """
def lookup_users(self, user_ids=None, screen_names=None):

https://github.com/tweepy/tweepy/blob/master/tweepy/api.py#L146

关于python - 使用最新的 twitter api 和 python 检索多个用户对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15485457/

相关文章:

python - python 中的希伯来日历

python - 如何将 numpy 数组乘以 numpy 矩阵?

python - 如何获取另一个文件夹的父文件夹?

python - 删除查询集中的重复项

python - 使用 Tweepy 发布带有 YouTube 视频 URL 的推文

python - Linux, Selenium : traffic usage starts action

mysql - Twitter OAuth - 在 MySql 中存储 token

twitter - 如何根据电子邮件地址获取 Twitter 用户名?

php - 用 php 在推文中的链接周围包裹一个标签

twitter - 启动 Spark 流上下文时出错