Appearance
获取某个好友的朋友圈
分页获取某个好友的朋友圈列表。
注意
列表 XML 里的图片、视频链接通常打不开,完整内容要调获取朋友圈详情。
接口地址: POST /getFriendCircle
说明与注意
- 受对方朋友圈可见范围限制,返回空列表先确认好友是否对当前账号开放朋友圈。
请求参数
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| wId | 是 | string | 登录实例标识 |
| wcId | 是 | string | 好友微信 ID |
| firstPageMd5 | 是 | string | 首次传空字符串,第二页及以后传上一次响应返回的 firstPageMd5 |
| maxId | 是 | long | 首次传 0,后续按翻页游标传入 |
请求示例
http
POST {BASE_URL}/getFriendCircle
Authorization: Bearer <你的调用凭证>
Content-Type: application/json
{
"wId": "0000016e-68f9-99d5-0002-3a1cd9eaaa17",
"wcId": "wxid_6tn88z16x6ou12",
"firstPageMd5": "",
"maxId": 0
}bash
curl -X POST '{BASE_URL}/getFriendCircle' \
-H 'Authorization: Bearer <你的调用凭证>' \
-H 'Content-Type: application/json' \
--data-raw '{
"wId": "0000016e-68f9-99d5-0002-3a1cd9eaaa17",
"wcId": "wxid_6tn88z16x6ou12",
"firstPageMd5": "",
"maxId": 0
}'python
import requests
url = "{BASE_URL}/getFriendCircle"
headers = {"Authorization": "Bearer <你的调用凭证>", "Content-Type": "application/json"}
body = """{
"wId": "0000016e-68f9-99d5-0002-3a1cd9eaaa17",
"wcId": "wxid_6tn88z16x6ou12",
"firstPageMd5": "",
"maxId": 0
}"""
resp = requests.post(url, headers=headers, data=body.encode("utf-8"))
print(resp.text)java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
String url = "{BASE_URL}/getFriendCircle";
String body = "{\n" +
" \"wId\": \"0000016e-68f9-99d5-0002-3a1cd9eaaa17\",\n" +
" \"wcId\": \"wxid_6tn88z16x6ou12\",\n" +
" \"firstPageMd5\": \"\",\n" +
" \"maxId\": 0\n" +
"}";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder(URI.create(url))
.header("Authorization", "Bearer <你的调用凭证>")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());php
<?php
$url = '{BASE_URL}/getFriendCircle';
$body = <<<'JSON'
{
"wId": "0000016e-68f9-99d5-0002-3a1cd9eaaa17",
"wcId": "wxid_6tn88z16x6ou12",
"firstPageMd5": "",
"maxId": 0
}
JSON;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer <你的调用凭证>',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;成功响应
json
{
"message": "成功",
"code": "1000",
"data": {
"sns": [
{
"id": "13351211557386072142",
"userName": "wxid_6tn88z16x6ou12",
"nickName": "远见",
"createTime": 1591588444,
"objectDesc": {
"xml": "<TimelineObject>...</TimelineObject>",
"len": 1024
},
"likeCount": 0,
"snsLikes": [],
"commentCount": 0,
"snsComments": []
}
],
"firstPageMd5": "087ed4f0b41e46e3"
}
}错误响应
json
{
"message": "失败",
"code": "1001",
"data": null
}响应参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| code | string | 1000 成功;其他值都是失败,通常是 1001 |
| message | string | 反馈信息 |
| data.sns | array | 朋友圈列表 |
| data.firstPageMd5 | string | 翻页标识,下一页请求时继续传入 |
| data.sns[].id | string | 朋友圈 ID |
| data.sns[].userName | string | 发布者微信 ID |
| data.sns[].nickName | string | 发布者昵称 |
| data.sns[].createTime | long | 发布时间戳 |
| data.sns[].objectDesc | object | 朋友圈内容 |
| data.sns[].objectDesc.xml | string | 朋友圈 XML 原始数据 |
| data.sns[].objectDesc.len | int | XML 长度 |
| data.sns[].likeCount | int | 点赞数量 |
| data.sns[].snsLikes | array | 点赞列表 |
| data.sns[].commentCount | int | 评论数量 |
| data.sns[].snsComments | array | 评论列表 |