Skip to content

下载朋友圈视频 ​

下载一条朋友圈里的视频,返回下载链接。content 先用获取朋友圈详情拿。

接口地址: POST /downloadSnsVideo

说明与注意 ​

  • content 传详情返回的 objectDesc.xml 原文,不要手工拼接或裁剪。
  • 只有视频朋友圈能下载;失败先看 XML 里有没有视频 CDN 字段。

请求参数 ​

参数名必选类型说明
wId是string登录实例标识
content是string获取朋友圈详情返回的朋友圈 XML 数据

请求示例 ​

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

{
  "wId": "b7ad08a6-77c2-4ad6-894a-29993b84c0e4",
  "content": "<TimelineObject><id><![CDATA[14038975351875178589]]></id><username><![CDATA[wxid_xupxubvp9l0322]]></username><createTime><![CDATA[1673576277]]></createTime><contentDescShowType>0</contentDescShowType><contentDescScene>0</contentDescScene><private><![CDATA[0]]></private><contentDesc><![CDATA[牛初乳,\n我只推荐优乐彤。\n配料表非常干净,\n什么都不添加。\n纯的牛初乳[强][强][强]\n只有优乐彤。\n​]]></contentDesc><contentattr><![CDATA[0]]></contentattr><sourceUserName></sourceUserName><sourceNickName></sourceNickName><statisticsData></statisticsData><weappInfo><appUserName></appUserName><pagePath></pagePath><version><![CDATA[0]]></version><debugMode><![CDATA[0]]></debugMode><shareActionId></shareActionId><isGame><![CDATA[0]]></isGame><messageExtraData></messageExtraData><subType><![CDATA[0]]></subType><preloadResources></preloadResources></weappInfo><canvasInfoXml></canvasInfoXml><ContentObject><contentStyle><![CDATA[15]]></contentStyle><contentSubStyle><![CDATA[0]]></contentSubStyle><title>微信小视频</title><description></description><contentUrl>https://support.weixin.qq.com/cgi-bin/mmsupport-bin/readtemplate?t=page/common_page__upgrade&amp;v=1</contentUrl><mediaList><media><id><![CDATA[14038975352558194743]]></id><type><![CDATA[6]]></type><title><![CDATA[牛初乳,\n我只推荐优乐彤。\n配料表非常干净,\n什么都不添加。\n纯的牛初乳[强][强][强]\n只有优乐彤。\n​]]></title><description><![CDATA[牛初乳,\n我只推荐优乐彤。\n配料表非常干净,\n什么都不添加。\n纯的牛初乳[强][强][强]\n只有优乐彤。\n​]]></description><private><![CDATA[0]]></private><url videomd5=\"6996ba1ff53f976ae5b7da32f1d7a322\" type=\"1\" md5=\"4b9d4d9724363355b713bfc0af924e84\"><![CDATA[http://shzjwxsns.video.qq.com/102/20202/snsvideodownload?filekey=30340201010420301e0201660402534804104b9d4d9724363355b713bfc0af924e8402030f1f54040d00000004627466730000000132&hy=SH&storeid=563c0bf5400001c5a163c605c0000006600004eea534823fe7b01e64626bce&dotrans=9&ef=30_0&bizid=1023&ilogo=2&dur=7&sid=171]]></url><thumb type=\"1\"><![CDATA[http://vweixinthumb.tc.qq.com/150/20250/snsvideodownload?filekey=30350201010421301f02020096040253480410ed875ce3adf71ceab81ff6d9b72d17b7020301851e040d00000004627466730000000132&hy=SH&storeid=563c0bf5400001370163c605c0000009600004f1a5348240348e0b647aff0d&bizid=1023]]></thumb><videoDuration><![CDATA[7.241]]></videoDuration><size totalSize=\"99614.0\" width=\"1080\" height=\"1920\"></size><VideoColdDLRule><All>CAISBAgWEAEoAjAc</All></VideoColdDLRule></media></mediaList></ContentObject><actionInfo><appMsg><mediaTagName></mediaTagName><messageExt></messageExt><messageAction></messageAction></appMsg></actionInfo><appInfo><id></id></appInfo><location poiClassifyId=\"\" poiName=\"\" poiAddress=\"\" poiClassifyType=\"0\" city=\"\"></location><publicUserName></publicUserName><streamvideo><streamvideourl></streamvideourl><streamvideothumburl></streamvideothumburl><streamvideoweburl></streamvideoweburl></streamvideo></TimelineObject>"
}
bash
curl -X POST '{BASE_URL}/downloadSnsVideo' \
  -H 'Authorization: Bearer <你的调用凭证>' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "wId": "b7ad08a6-77c2-4ad6-894a-29993b84c0e4",
  "content": "<TimelineObject><id><![CDATA[14038975351875178589]]></id><username><![CDATA[wxid_xupxubvp9l0322]]></username><createTime><![CDATA[1673576277]]></createTime><contentDescShowType>0</contentDescShowType><contentDescScene>0</contentDescScene><private><![CDATA[0]]></private><contentDesc><![CDATA[牛初乳,\n我只推荐优乐彤。\n配料表非常干净,\n什么都不添加。\n纯的牛初乳[强][强][强]\n只有优乐彤。\n​]]></contentDesc><contentattr><![CDATA[0]]></contentattr><sourceUserName></sourceUserName><sourceNickName></sourceNickName><statisticsData></statisticsData><weappInfo><appUserName></appUserName><pagePath></pagePath><version><![CDATA[0]]></version><debugMode><![CDATA[0]]></debugMode><shareActionId></shareActionId><isGame><![CDATA[0]]></isGame><messageExtraData></messageExtraData><subType><![CDATA[0]]></subType><preloadResources></preloadResources></weappInfo><canvasInfoXml></canvasInfoXml><ContentObject><contentStyle><![CDATA[15]]></contentStyle><contentSubStyle><![CDATA[0]]></contentSubStyle><title>微信小视频</title><description></description><contentUrl>https://support.weixin.qq.com/cgi-bin/mmsupport-bin/readtemplate?t=page/common_page__upgrade&amp;v=1</contentUrl><mediaList><media><id><![CDATA[14038975352558194743]]></id><type><![CDATA[6]]></type><title><![CDATA[牛初乳,\n我只推荐优乐彤。\n配料表非常干净,\n什么都不添加。\n纯的牛初乳[强][强][强]\n只有优乐彤。\n​]]></title><description><![CDATA[牛初乳,\n我只推荐优乐彤。\n配料表非常干净,\n什么都不添加。\n纯的牛初乳[强][强][强]\n只有优乐彤。\n​]]></description><private><![CDATA[0]]></private><url videomd5=\"6996ba1ff53f976ae5b7da32f1d7a322\" type=\"1\" md5=\"4b9d4d9724363355b713bfc0af924e84\"><![CDATA[http://shzjwxsns.video.qq.com/102/20202/snsvideodownload?filekey=30340201010420301e0201660402534804104b9d4d9724363355b713bfc0af924e8402030f1f54040d00000004627466730000000132&hy=SH&storeid=563c0bf5400001c5a163c605c0000006600004eea534823fe7b01e64626bce&dotrans=9&ef=30_0&bizid=1023&ilogo=2&dur=7&sid=171]]></url><thumb type=\"1\"><![CDATA[http://vweixinthumb.tc.qq.com/150/20250/snsvideodownload?filekey=30350201010421301f02020096040253480410ed875ce3adf71ceab81ff6d9b72d17b7020301851e040d00000004627466730000000132&hy=SH&storeid=563c0bf5400001370163c605c0000009600004f1a5348240348e0b647aff0d&bizid=1023]]></thumb><videoDuration><![CDATA[7.241]]></videoDuration><size totalSize=\"99614.0\" width=\"1080\" height=\"1920\"></size><VideoColdDLRule><All>CAISBAgWEAEoAjAc</All></VideoColdDLRule></media></mediaList></ContentObject><actionInfo><appMsg><mediaTagName></mediaTagName><messageExt></messageExt><messageAction></messageAction></appMsg></actionInfo><appInfo><id></id></appInfo><location poiClassifyId=\"\" poiName=\"\" poiAddress=\"\" poiClassifyType=\"0\" city=\"\"></location><publicUserName></publicUserName><streamvideo><streamvideourl></streamvideourl><streamvideothumburl></streamvideothumburl><streamvideoweburl></streamvideoweburl></streamvideo></TimelineObject>"
}'
python
import requests

url = "{BASE_URL}/downloadSnsVideo"
headers = {"Authorization": "Bearer <你的调用凭证>", "Content-Type": "application/json"}
body = r"""{
  "wId": "b7ad08a6-77c2-4ad6-894a-29993b84c0e4",
  "content": "<TimelineObject><id><![CDATA[14038975351875178589]]></id><username><![CDATA[wxid_xupxubvp9l0322]]></username><createTime><![CDATA[1673576277]]></createTime><contentDescShowType>0</contentDescShowType><contentDescScene>0</contentDescScene><private><![CDATA[0]]></private><contentDesc><![CDATA[牛初乳,\n我只推荐优乐彤。\n配料表非常干净,\n什么都不添加。\n纯的牛初乳[强][强][强]\n只有优乐彤。\n​]]></contentDesc><contentattr><![CDATA[0]]></contentattr><sourceUserName></sourceUserName><sourceNickName></sourceNickName><statisticsData></statisticsData><weappInfo><appUserName></appUserName><pagePath></pagePath><version><![CDATA[0]]></version><debugMode><![CDATA[0]]></debugMode><shareActionId></shareActionId><isGame><![CDATA[0]]></isGame><messageExtraData></messageExtraData><subType><![CDATA[0]]></subType><preloadResources></preloadResources></weappInfo><canvasInfoXml></canvasInfoXml><ContentObject><contentStyle><![CDATA[15]]></contentStyle><contentSubStyle><![CDATA[0]]></contentSubStyle><title>微信小视频</title><description></description><contentUrl>https://support.weixin.qq.com/cgi-bin/mmsupport-bin/readtemplate?t=page/common_page__upgrade&amp;v=1</contentUrl><mediaList><media><id><![CDATA[14038975352558194743]]></id><type><![CDATA[6]]></type><title><![CDATA[牛初乳,\n我只推荐优乐彤。\n配料表非常干净,\n什么都不添加。\n纯的牛初乳[强][强][强]\n只有优乐彤。\n​]]></title><description><![CDATA[牛初乳,\n我只推荐优乐彤。\n配料表非常干净,\n什么都不添加。\n纯的牛初乳[强][强][强]\n只有优乐彤。\n​]]></description><private><![CDATA[0]]></private><url videomd5=\"6996ba1ff53f976ae5b7da32f1d7a322\" type=\"1\" md5=\"4b9d4d9724363355b713bfc0af924e84\"><![CDATA[http://shzjwxsns.video.qq.com/102/20202/snsvideodownload?filekey=30340201010420301e0201660402534804104b9d4d9724363355b713bfc0af924e8402030f1f54040d00000004627466730000000132&hy=SH&storeid=563c0bf5400001c5a163c605c0000006600004eea534823fe7b01e64626bce&dotrans=9&ef=30_0&bizid=1023&ilogo=2&dur=7&sid=171]]></url><thumb type=\"1\"><![CDATA[http://vweixinthumb.tc.qq.com/150/20250/snsvideodownload?filekey=30350201010421301f02020096040253480410ed875ce3adf71ceab81ff6d9b72d17b7020301851e040d00000004627466730000000132&hy=SH&storeid=563c0bf5400001370163c605c0000009600004f1a5348240348e0b647aff0d&bizid=1023]]></thumb><videoDuration><![CDATA[7.241]]></videoDuration><size totalSize=\"99614.0\" width=\"1080\" height=\"1920\"></size><VideoColdDLRule><All>CAISBAgWEAEoAjAc</All></VideoColdDLRule></media></mediaList></ContentObject><actionInfo><appMsg><mediaTagName></mediaTagName><messageExt></messageExt><messageAction></messageAction></appMsg></actionInfo><appInfo><id></id></appInfo><location poiClassifyId=\"\" poiName=\"\" poiAddress=\"\" poiClassifyType=\"0\" city=\"\"></location><publicUserName></publicUserName><streamvideo><streamvideourl></streamvideourl><streamvideothumburl></streamvideothumburl><streamvideoweburl></streamvideoweburl></streamvideo></TimelineObject>"
}"""

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}/downloadSnsVideo";
String body = "{\n" +
    "  \"wId\": \"b7ad08a6-77c2-4ad6-894a-29993b84c0e4\",\n" +
    "  \"content\": \"<TimelineObject><id><![CDATA[14038975351875178589]]></id><username><![CDATA[wxid_xupxubvp9l0322]]></username><createTime><![CDATA[1673576277]]></createTime><contentDescShowType>0</contentDescShowType><contentDescScene>0</contentDescScene><private><![CDATA[0]]></private><contentDesc><![CDATA[牛初乳,\\n我只推荐优乐彤。\\n配料表非常干净,\\n什么都不添加。\\n纯的牛初乳[强][强][强]\\n只有优乐彤。\\n​]]></contentDesc><contentattr><![CDATA[0]]></contentattr><sourceUserName></sourceUserName><sourceNickName></sourceNickName><statisticsData></statisticsData><weappInfo><appUserName></appUserName><pagePath></pagePath><version><![CDATA[0]]></version><debugMode><![CDATA[0]]></debugMode><shareActionId></shareActionId><isGame><![CDATA[0]]></isGame><messageExtraData></messageExtraData><subType><![CDATA[0]]></subType><preloadResources></preloadResources></weappInfo><canvasInfoXml></canvasInfoXml><ContentObject><contentStyle><![CDATA[15]]></contentStyle><contentSubStyle><![CDATA[0]]></contentSubStyle><title>微信小视频</title><description></description><contentUrl>https://support.weixin.qq.com/cgi-bin/mmsupport-bin/readtemplate?t=page/common_page__upgrade&amp;v=1</contentUrl><mediaList><media><id><![CDATA[14038975352558194743]]></id><type><![CDATA[6]]></type><title><![CDATA[牛初乳,\\n我只推荐优乐彤。\\n配料表非常干净,\\n什么都不添加。\\n纯的牛初乳[强][强][强]\\n只有优乐彤。\\n​]]></title><description><![CDATA[牛初乳,\\n我只推荐优乐彤。\\n配料表非常干净,\\n什么都不添加。\\n纯的牛初乳[强][强][强]\\n只有优乐彤。\\n​]]></description><private><![CDATA[0]]></private><url videomd5=\\\"6996ba1ff53f976ae5b7da32f1d7a322\\\" type=\\\"1\\\" md5=\\\"4b9d4d9724363355b713bfc0af924e84\\\"><![CDATA[http://shzjwxsns.video.qq.com/102/20202/snsvideodownload?filekey=30340201010420301e0201660402534804104b9d4d9724363355b713bfc0af924e8402030f1f54040d00000004627466730000000132&hy=SH&storeid=563c0bf5400001c5a163c605c0000006600004eea534823fe7b01e64626bce&dotrans=9&ef=30_0&bizid=1023&ilogo=2&dur=7&sid=171]]></url><thumb type=\\\"1\\\"><![CDATA[http://vweixinthumb.tc.qq.com/150/20250/snsvideodownload?filekey=30350201010421301f02020096040253480410ed875ce3adf71ceab81ff6d9b72d17b7020301851e040d00000004627466730000000132&hy=SH&storeid=563c0bf5400001370163c605c0000009600004f1a5348240348e0b647aff0d&bizid=1023]]></thumb><videoDuration><![CDATA[7.241]]></videoDuration><size totalSize=\\\"99614.0\\\" width=\\\"1080\\\" height=\\\"1920\\\"></size><VideoColdDLRule><All>CAISBAgWEAEoAjAc</All></VideoColdDLRule></media></mediaList></ContentObject><actionInfo><appMsg><mediaTagName></mediaTagName><messageExt></messageExt><messageAction></messageAction></appMsg></actionInfo><appInfo><id></id></appInfo><location poiClassifyId=\\\"\\\" poiName=\\\"\\\" poiAddress=\\\"\\\" poiClassifyType=\\\"0\\\" city=\\\"\\\"></location><publicUserName></publicUserName><streamvideo><streamvideourl></streamvideourl><streamvideothumburl></streamvideothumburl><streamvideoweburl></streamvideoweburl></streamvideo></TimelineObject>\"\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}/downloadSnsVideo';
$body = <<<'JSON'
{
  "wId": "b7ad08a6-77c2-4ad6-894a-29993b84c0e4",
  "content": "<TimelineObject><id><![CDATA[14038975351875178589]]></id><username><![CDATA[wxid_xupxubvp9l0322]]></username><createTime><![CDATA[1673576277]]></createTime><contentDescShowType>0</contentDescShowType><contentDescScene>0</contentDescScene><private><![CDATA[0]]></private><contentDesc><![CDATA[牛初乳,\n我只推荐优乐彤。\n配料表非常干净,\n什么都不添加。\n纯的牛初乳[强][强][强]\n只有优乐彤。\n​]]></contentDesc><contentattr><![CDATA[0]]></contentattr><sourceUserName></sourceUserName><sourceNickName></sourceNickName><statisticsData></statisticsData><weappInfo><appUserName></appUserName><pagePath></pagePath><version><![CDATA[0]]></version><debugMode><![CDATA[0]]></debugMode><shareActionId></shareActionId><isGame><![CDATA[0]]></isGame><messageExtraData></messageExtraData><subType><![CDATA[0]]></subType><preloadResources></preloadResources></weappInfo><canvasInfoXml></canvasInfoXml><ContentObject><contentStyle><![CDATA[15]]></contentStyle><contentSubStyle><![CDATA[0]]></contentSubStyle><title>微信小视频</title><description></description><contentUrl>https://support.weixin.qq.com/cgi-bin/mmsupport-bin/readtemplate?t=page/common_page__upgrade&amp;v=1</contentUrl><mediaList><media><id><![CDATA[14038975352558194743]]></id><type><![CDATA[6]]></type><title><![CDATA[牛初乳,\n我只推荐优乐彤。\n配料表非常干净,\n什么都不添加。\n纯的牛初乳[强][强][强]\n只有优乐彤。\n​]]></title><description><![CDATA[牛初乳,\n我只推荐优乐彤。\n配料表非常干净,\n什么都不添加。\n纯的牛初乳[强][强][强]\n只有优乐彤。\n​]]></description><private><![CDATA[0]]></private><url videomd5=\"6996ba1ff53f976ae5b7da32f1d7a322\" type=\"1\" md5=\"4b9d4d9724363355b713bfc0af924e84\"><![CDATA[http://shzjwxsns.video.qq.com/102/20202/snsvideodownload?filekey=30340201010420301e0201660402534804104b9d4d9724363355b713bfc0af924e8402030f1f54040d00000004627466730000000132&hy=SH&storeid=563c0bf5400001c5a163c605c0000006600004eea534823fe7b01e64626bce&dotrans=9&ef=30_0&bizid=1023&ilogo=2&dur=7&sid=171]]></url><thumb type=\"1\"><![CDATA[http://vweixinthumb.tc.qq.com/150/20250/snsvideodownload?filekey=30350201010421301f02020096040253480410ed875ce3adf71ceab81ff6d9b72d17b7020301851e040d00000004627466730000000132&hy=SH&storeid=563c0bf5400001370163c605c0000009600004f1a5348240348e0b647aff0d&bizid=1023]]></thumb><videoDuration><![CDATA[7.241]]></videoDuration><size totalSize=\"99614.0\" width=\"1080\" height=\"1920\"></size><VideoColdDLRule><All>CAISBAgWEAEoAjAc</All></VideoColdDLRule></media></mediaList></ContentObject><actionInfo><appMsg><mediaTagName></mediaTagName><messageExt></messageExt><messageAction></messageAction></appMsg></actionInfo><appInfo><id></id></appInfo><location poiClassifyId=\"\" poiName=\"\" poiAddress=\"\" poiClassifyType=\"0\" city=\"\"></location><publicUserName></publicUserName><streamvideo><streamvideourl></streamvideourl><streamvideothumburl></streamvideothumburl><streamvideoweburl></streamvideoweburl></streamvideo></TimelineObject>"
}
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": {
    "videoUrl": "http://oos-sccd.ctyunapi.cn/20230116/478bbcfd-169a-4cfc-b768-f51f24f442fb.mp4?AWSAccessKeyId=e14b8966201775518bce&Expires=1674483076&Signature=dqPDwjl4mq6RvPsPuFdWXJOQRf0%3D"
  }
}

错误响应 ​

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

响应参数 ​

参数名类型说明
codestring1000 成功;其他值都是失败,通常是 1001
messagestring反馈信息
data.videoUrlstring视频下载链接