Appearance
发布视频号视频
发布视频号视频。两种发法二选一:直接传 videoUrl、videoThumbUrl;或先调上传视频号视频,把返回的 data 填进 videoCdn。
接口地址: POST /finderPublish
说明与注意
myUserName、myRoleType从获取个人主页的返回里取。topic里每个话题带#前缀。
请求参数
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| wId | 是 | string | 登录实例标识 |
| myUserName | 是 | string | 自己的视频号用户编码 |
| myRoleType | 否 | int | 自己的视频号角色类型,先上传再发布时建议传 |
| videoUrl | 否 | string | 视频链接,用链接发布时必传 |
| videoThumbUrl | 否 | string | 封面链接,用链接发布时必传 |
| videoWidth | 是 | int | 视频宽度 |
| videoHeight | 是 | int | 视频高度 |
| videoPlayLen | 是 | int | 视频播放时长,单位秒 |
| title | 是 | string | 视频标题或文案 |
| topic | 是 | array | 话题列表 |
| videoCdn | 否 | object | 上传视频返回的数据,先上传再发布时必传 |
| videoCdn.fileUrl | 是 | string | 上传后的视频文件地址 |
| videoCdn.thumbUrl | 是 | string | 上传后的封面地址 |
| videoCdn.mp4Identify | 是 | string | 视频文件标识 |
| videoCdn.fileSize | 是 | int | 视频文件大小 |
| videoCdn.thumbMd5 | 是 | string | 封面 MD5 |
| videoCdn.fileKey | 是 | string | 上传文件 key |
请求示例
用视频和封面链接直接发布:
http
POST {BASE_URL}/finderPublish
Authorization: Bearer <你的调用凭证>
Content-Type: application/json
{
"wId": "{{wId}}",
"myUserName": "v2_060000231003b20faec8c6e18f10c7d6c903ec3db0776955d3d97c6b329d6aa58693bcdb7ad1@finder",
"videoUrl": "https://cdn.e-yun.example/feed/customer-case.mp4",
"videoThumbUrl": "https://cdn.e-yun.example/feed/customer-case-cover.jpeg",
"videoWidth": 1240,
"videoHeight": 930,
"videoPlayLen": 13,
"title": "可爱吗?",
"topic": ["#可爱", "#hhh"]
}bash
curl -X POST '{BASE_URL}/finderPublish' \
-H 'Authorization: Bearer <你的调用凭证>' \
-H 'Content-Type: application/json' \
--data-raw '{
"wId": "{{wId}}",
"myUserName": "v2_060000231003b20faec8c6e18f10c7d6c903ec3db0776955d3d97c6b329d6aa58693bcdb7ad1@finder",
"videoUrl": "https://cdn.e-yun.example/feed/customer-case.mp4",
"videoThumbUrl": "https://cdn.e-yun.example/feed/customer-case-cover.jpeg",
"videoWidth": 1240,
"videoHeight": 930,
"videoPlayLen": 13,
"title": "可爱吗?",
"topic": ["#可爱", "#hhh"]
}'python
import requests
url = "{BASE_URL}/finderPublish"
headers = {"Authorization": "Bearer <你的调用凭证>", "Content-Type": "application/json"}
body = """{
"wId": "{{wId}}",
"myUserName": "v2_060000231003b20faec8c6e18f10c7d6c903ec3db0776955d3d97c6b329d6aa58693bcdb7ad1@finder",
"videoUrl": "https://cdn.e-yun.example/feed/customer-case.mp4",
"videoThumbUrl": "https://cdn.e-yun.example/feed/customer-case-cover.jpeg",
"videoWidth": 1240,
"videoHeight": 930,
"videoPlayLen": 13,
"title": "可爱吗?",
"topic": ["#可爱", "#hhh"]
}"""
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}/finderPublish";
String body = "{\n" +
" \"wId\": \"{{wId}}\",\n" +
" \"myUserName\": \"v2_060000231003b20faec8c6e18f10c7d6c903ec3db0776955d3d97c6b329d6aa58693bcdb7ad1@finder\",\n" +
" \"videoUrl\": \"https://cdn.e-yun.example/feed/customer-case.mp4\",\n" +
" \"videoThumbUrl\": \"https://cdn.e-yun.example/feed/customer-case-cover.jpeg\",\n" +
" \"videoWidth\": 1240,\n" +
" \"videoHeight\": 930,\n" +
" \"videoPlayLen\": 13,\n" +
" \"title\": \"可爱吗?\",\n" +
" \"topic\": [\"#可爱\", \"#hhh\"]\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}/finderPublish';
$body = <<<'JSON'
{
"wId": "{{wId}}",
"myUserName": "v2_060000231003b20faec8c6e18f10c7d6c903ec3db0776955d3d97c6b329d6aa58693bcdb7ad1@finder",
"videoUrl": "https://cdn.e-yun.example/feed/customer-case.mp4",
"videoThumbUrl": "https://cdn.e-yun.example/feed/customer-case-cover.jpeg",
"videoWidth": 1240,
"videoHeight": 930,
"videoPlayLen": 13,
"title": "可爱吗?",
"topic": ["#可爱", "#hhh"]
}
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;先调上传视频,把返回的数据填进 videoCdn 再发布,videoUrl、videoThumbUrl 传空字符串:
http
POST {BASE_URL}/finderPublish
Authorization: Bearer <你的调用凭证>
Content-Type: application/json
{
"wId": "{{wId}}",
"myUserName": "v2_060000231003b20faec8c6e18f10c7d6c903ec3db0776955d3d97c6b329d6aa58693bcdb7ad1@finder",
"myRoleType": 3,
"videoUrl": "",
"videoThumbUrl": "",
"videoWidth": 1240,
"videoHeight": 930,
"videoPlayLen": 13,
"videoCdn": {
"fileUrl": "http://wxapp.tc.qq.com/251/20302/stodownload?...",
"thumbUrl": "http://wxapp.tc.qq.com/251/20350/stodownload?...",
"mp4Identify": "f554da4964c2c64ad97dc9623f5daa5b",
"fileSize": 1315979,
"thumbMd5": "cc9a86fb446c70f5ed6c16ca7754f4c1",
"fileKey": "finder_upload_8147263162_zhangchuan2288"
},
"title": "可爱吗?",
"topic": ["#可爱", "#hhh"]
}bash
curl -X POST '{BASE_URL}/finderPublish' \
-H 'Authorization: Bearer <你的调用凭证>' \
-H 'Content-Type: application/json' \
--data-raw '{
"wId": "{{wId}}",
"myUserName": "v2_060000231003b20faec8c6e18f10c7d6c903ec3db0776955d3d97c6b329d6aa58693bcdb7ad1@finder",
"myRoleType": 3,
"videoUrl": "",
"videoThumbUrl": "",
"videoWidth": 1240,
"videoHeight": 930,
"videoPlayLen": 13,
"videoCdn": {
"fileUrl": "http://wxapp.tc.qq.com/251/20302/stodownload?...",
"thumbUrl": "http://wxapp.tc.qq.com/251/20350/stodownload?...",
"mp4Identify": "f554da4964c2c64ad97dc9623f5daa5b",
"fileSize": 1315979,
"thumbMd5": "cc9a86fb446c70f5ed6c16ca7754f4c1",
"fileKey": "finder_upload_8147263162_zhangchuan2288"
},
"title": "可爱吗?",
"topic": ["#可爱", "#hhh"]
}'python
import requests
url = "{BASE_URL}/finderPublish"
headers = {"Authorization": "Bearer <你的调用凭证>", "Content-Type": "application/json"}
body = """{
"wId": "{{wId}}",
"myUserName": "v2_060000231003b20faec8c6e18f10c7d6c903ec3db0776955d3d97c6b329d6aa58693bcdb7ad1@finder",
"myRoleType": 3,
"videoUrl": "",
"videoThumbUrl": "",
"videoWidth": 1240,
"videoHeight": 930,
"videoPlayLen": 13,
"videoCdn": {
"fileUrl": "http://wxapp.tc.qq.com/251/20302/stodownload?...",
"thumbUrl": "http://wxapp.tc.qq.com/251/20350/stodownload?...",
"mp4Identify": "f554da4964c2c64ad97dc9623f5daa5b",
"fileSize": 1315979,
"thumbMd5": "cc9a86fb446c70f5ed6c16ca7754f4c1",
"fileKey": "finder_upload_8147263162_zhangchuan2288"
},
"title": "可爱吗?",
"topic": ["#可爱", "#hhh"]
}"""
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}/finderPublish";
String body = "{\n" +
" \"wId\": \"{{wId}}\",\n" +
" \"myUserName\": \"v2_060000231003b20faec8c6e18f10c7d6c903ec3db0776955d3d97c6b329d6aa58693bcdb7ad1@finder\",\n" +
" \"myRoleType\": 3,\n" +
" \"videoUrl\": \"\",\n" +
" \"videoThumbUrl\": \"\",\n" +
" \"videoWidth\": 1240,\n" +
" \"videoHeight\": 930,\n" +
" \"videoPlayLen\": 13,\n" +
" \"videoCdn\": {\n" +
" \"fileUrl\": \"http://wxapp.tc.qq.com/251/20302/stodownload?...\",\n" +
" \"thumbUrl\": \"http://wxapp.tc.qq.com/251/20350/stodownload?...\",\n" +
" \"mp4Identify\": \"f554da4964c2c64ad97dc9623f5daa5b\",\n" +
" \"fileSize\": 1315979,\n" +
" \"thumbMd5\": \"cc9a86fb446c70f5ed6c16ca7754f4c1\",\n" +
" \"fileKey\": \"finder_upload_8147263162_zhangchuan2288\"\n" +
" },\n" +
" \"title\": \"可爱吗?\",\n" +
" \"topic\": [\"#可爱\", \"#hhh\"]\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}/finderPublish';
$body = <<<'JSON'
{
"wId": "{{wId}}",
"myUserName": "v2_060000231003b20faec8c6e18f10c7d6c903ec3db0776955d3d97c6b329d6aa58693bcdb7ad1@finder",
"myRoleType": 3,
"videoUrl": "",
"videoThumbUrl": "",
"videoWidth": 1240,
"videoHeight": 930,
"videoPlayLen": 13,
"videoCdn": {
"fileUrl": "http://wxapp.tc.qq.com/251/20302/stodownload?...",
"thumbUrl": "http://wxapp.tc.qq.com/251/20350/stodownload?...",
"mp4Identify": "f554da4964c2c64ad97dc9623f5daa5b",
"fileSize": 1315979,
"thumbMd5": "cc9a86fb446c70f5ed6c16ca7754f4c1",
"fileKey": "finder_upload_8147263162_zhangchuan2288"
},
"title": "可爱吗?",
"topic": ["#可爱", "#hhh"]
}
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
}响应参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| code | string | 1000 成功;其他值都是失败,通常是 1001 |
| message | string | 反馈信息 |
| data | object / null | 发布成功时通常返回 null |