(Python / Tweepy) - 我可以查询包含特定URL的twitter配置文件吗?

时间:2015-04-17 23:32:21

标签: python api url twitter tweepy

example picture

google.com的地方......

我正在尝试创建一个带有网址“google.com”的脚本,然后返回个人资料页面或信息。

到目前为止,我所做的完全符合我的要求,除非您必须为其指定屏幕名称,然后使用屏幕名称来获取个人资料。

import tweepy
from pprint import pprint


consumer_key = 'something'
consumer_secret = 'something'
access_token = 'something'
access_token_secret = 'something'

auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)

api = tweepy.API(auth)


user =api.get_user('google')

print user

如果Tweepy不为此提供支持,我愿意接受所有建议。感谢。

2 个答案:

答案 0 :(得分:2)

  1. 您使用的是错误的工作终点,您应该使用this 在tweepy中的终点对应于api.search_users(q)
  2. 检查here如何构建参数q
  3. 如果您传递url作为参数,则取决于特定Twitter用户的主页内容和其他因素。如果你反汇编网址并使用域名,那么你可能会有更好的机会,即:api.search_users(" Google com")

答案 1 :(得分:1)

#Class User包含用户的所有配置文件功能  #这里userid是用户的屏幕名称

      def get_profile(self):
          return self.user.description

#获取用户的个人资料说明

ERROR:  User Defined Function is not supported.