Skip to content

评论 ​

给一个视频号作品评论、回复评论,或删除评论。

接口地址: POST /finderComment

说明与注意 ​

  • id、objectNonceId、sessionBuffer 来自视频号主页、搜索或详情类接口的返回;sessionBuffer 和作品绑定,不能跨作品复用。
  • meUserName、meRoleType 从获取个人主页的返回里取。

请求参数 ​

参数名必选类型说明
wId是string登录实例标识
content是string评论内容;删除评论时可传空字符串
id是number视频号作品 ID
objectNonceId是string视频号作品 nonceId
type是int操作类型:0 评论,1 删除评论
sessionBuffer是string作品上下文会话数据
meUserName是string自己的视频号用户编码
meRoleType是int自己的视频号角色类型
refCommentId否number回复或删除的评论 ID

请求示例 ​

http
POST {BASE_URL}/finderComment
Authorization: Bearer <你的调用凭证>
Content-Type: application/json

{
  "wId": "{{wId}}",
  "content": "内容很有帮助",
  "id": 14200825020179157073,
  "objectNonceId": "1614432821379421505_0_0_2_2_0",
  "type": 0,
  "sessionBuffer": "eyJzZXNzaW9uX2lkIjoic2lkXzEzNDUxMDA3MDNf...",
  "meUserName": "v2_060000231003b20faec8cae18a1ec5d0cb07eab077ba915250774edbea38082ea6b24af229@finder",
  "meRoleType": 3,
  "refCommentId": 0
}
bash
curl -X POST '{BASE_URL}/finderComment' \
  -H 'Authorization: Bearer <你的调用凭证>' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "wId": "{{wId}}",
  "content": "内容很有帮助",
  "id": 14200825020179157073,
  "objectNonceId": "1614432821379421505_0_0_2_2_0",
  "type": 0,
  "sessionBuffer": "eyJzZXNzaW9uX2lkIjoic2lkXzEzNDUxMDA3MDNf...",
  "meUserName": "v2_060000231003b20faec8cae18a1ec5d0cb07eab077ba915250774edbea38082ea6b24af229@finder",
  "meRoleType": 3,
  "refCommentId": 0
}'
python
import requests

url = "{BASE_URL}/finderComment"
headers = {"Authorization": "Bearer <你的调用凭证>", "Content-Type": "application/json"}
body = """{
  "wId": "{{wId}}",
  "content": "内容很有帮助",
  "id": 14200825020179157073,
  "objectNonceId": "1614432821379421505_0_0_2_2_0",
  "type": 0,
  "sessionBuffer": "eyJzZXNzaW9uX2lkIjoic2lkXzEzNDUxMDA3MDNf...",
  "meUserName": "v2_060000231003b20faec8cae18a1ec5d0cb07eab077ba915250774edbea38082ea6b24af229@finder",
  "meRoleType": 3,
  "refCommentId": 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}/finderComment";
String body = "{\n" +
    "  \"wId\": \"{{wId}}\",\n" +
    "  \"content\": \"内容很有帮助\",\n" +
    "  \"id\": 14200825020179157073,\n" +
    "  \"objectNonceId\": \"1614432821379421505_0_0_2_2_0\",\n" +
    "  \"type\": 0,\n" +
    "  \"sessionBuffer\": \"eyJzZXNzaW9uX2lkIjoic2lkXzEzNDUxMDA3MDNf...\",\n" +
    "  \"meUserName\": \"v2_060000231003b20faec8cae18a1ec5d0cb07eab077ba915250774edbea38082ea6b24af229@finder\",\n" +
    "  \"meRoleType\": 3,\n" +
    "  \"refCommentId\": 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}/finderComment';
$body = <<<'JSON'
{
  "wId": "{{wId}}",
  "content": "内容很有帮助",
  "id": 14200825020179157073,
  "objectNonceId": "1614432821379421505_0_0_2_2_0",
  "type": 0,
  "sessionBuffer": "eyJzZXNzaW9uX2lkIjoic2lkXzEzNDUxMDA3MDNf...",
  "meUserName": "v2_060000231003b20faec8cae18a1ec5d0cb07eab077ba915250774edbea38082ea6b24af229@finder",
  "meRoleType": 3,
  "refCommentId": 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
{
  "code": "1000",
  "message": "视频号评论成功",
  "data": null
}

错误响应 ​

json
{
  "code": "1001",
  "message": "失败",
  "data": null
}

响应参数 ​

参数名类型说明
codestring1000 成功;其他值都是失败,通常是 1001
messagestring反馈信息
dataobject / null评论成功时通常返回 null