Skip to content

获取某个好友的朋友圈 ​

分页获取某个好友的朋友圈列表。

注意

列表 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
}

响应参数 ​

参数名类型说明
codestring1000 成功;其他值都是失败,通常是 1001
messagestring反馈信息
data.snsarray朋友圈列表
data.firstPageMd5string翻页标识,下一页请求时继续传入
data.sns[].idstring朋友圈 ID
data.sns[].userNamestring发布者微信 ID
data.sns[].nickNamestring发布者昵称
data.sns[].createTimelong发布时间戳
data.sns[].objectDescobject朋友圈内容
data.sns[].objectDesc.xmlstring朋友圈 XML 原始数据
data.sns[].objectDesc.lenintXML 长度
data.sns[].likeCountint点赞数量
data.sns[].snsLikesarray点赞列表
data.sns[].commentCountint评论数量
data.sns[].snsCommentsarray评论列表