[英]Python-Facebook API: How do I get the profile_ids of all the people who have liked my recent posts on facebook using Python Facebook API?
These are some things that python-facebook graph API tells me: 这些是python-facebook graph API告诉我的一些事情:
Methods 方法
get_objects
: Returns all of the given objects from the graph as a dict. get_objects
:从图中返回所有给定对象作为dict。 Each given ID maps to an object. 每个给定的ID都映射到一个对象。
Parameters: 参数:
ids
– A list containing IDs for multiple resources. ids
–包含多个资源的ID的列表。
Example: 例:
post_`ids = ['post_id_1', 'post_id_2'] posts = graph.get_objects(ids=post_ids) # Each given id maps to an object. for post_id i`n post_ids: print(posts[post_id]['created_time'])
get_connections
: Returns all connections for a given object as a dict. get_connections
:以给定对象的形式返回给定对象的所有连接。
Parameters: 参数:
id
– A string that is a unique ID for that particular resource. id
–一个字符串,是该特定资源的唯一ID。
connection_name
- A string that specifies the connection or edge between objects, eg, feed, friends, groups, likes, posts. connection_name
一个字符串,用于指定对象之间的连接或边缘,例如,提要,朋友,组,喜欢,帖子。 If left empty, get_connections
will simply return the authenticated user's basic information. 如果保留为空,则get_connections
将仅返回经过身份验证的用户的基本信息。
Example: 例:
Get all of the authenticated user's friends 获取所有通过身份验证的用户的朋友
friends = graph.get_connections(id='me', connection_name='friends') # Get all the comments from a post comments = graph.get_connections(id='post_id', connection_name='comments')
put_like
: Writes a like to the given object. put_like
:将like写入给定对象。
Parameters: 参数:
object_id
- A string that is a unique id for a particular resource. object_id
一个字符串,是特定资源的唯一ID。
Example: 例:
graph.put_like(object_id='comment_id')
Source: http://facebook-sdk.readthedocs.org/en/latest/api.html 资料来源: http : //facebook-sdk.readthedocs.org/en/latest/api.html
So, How do I get the posts that are recently liked ( get_objects
) and the profile ids of people who have liked those posts ( get_connections
) and put a like on the friends posts who had liked my posts ( put_like
)? 所以,我如何获得那些最近喜欢的职位( get_objects
)和谁已经喜欢这些职位(人的轮廓IDS get_connections
),把一个像谁喜欢过我的帖子(朋友的帖子put_like
)?
您应该尝试使用JSON并处理从那里获得的数据,您可以在python上导入json并通过该库发出请求,这会容易得多。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.