欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

抖音去水印API、快手、小红书短视频去水印API接口接入

程序员文章站 2022-06-23 13:39:41
...

Videoparse(https://www.videoparse.cn) 短视频解析接口已支持:抖音、快手、剪映、小红书、Tiktok、微博、QQ看点视频、西瓜视频、今日头条、趣头条、火锅视频、美拍、微视、火山小视频、皮皮虾、好看视频、绿洲、VUE、秒拍、梨视频、刷宝、全民小视频、陌陌视频、UC浏览器、Youtube、轻视频、Bilibili、茄子短视频、灵感、WIDE、开眼、全民K歌、最右、小咖秀、皮皮搞笑、AcFun、网易云音乐、咪咕圈圈、梨涡、小影、新片场、场库、阳光宽频网等超过40个平台的短视频去水印解析。

接入代码事例

去水印解析短视频接口

请求地址:https://api-sv.videoparse.cn/api/video/normalParse
请求方式:GET/POST
请求参数:

字段 类型 必填 备注 赋值
appid string Y appid 开发者后台生成的appid
appsecret string Y appsecret 开发者后台生成的appsecret
url string Y 要解析的短视频地址

返回结果:

成功:

{"code":0,"msg":"success","body":{"source":"douyin","url":"http:\/\/v.douyin.com\/2duavD\/","title":"\u767e\u5c81\u5c71\u4e3a\u4ec0\u4e48\u79f0\u4e3a\u6c34\u4e2d\u8d35\u65cf \u89c6\u9891\u5bfb\u627e\u7b54\[email protected]\u6296\u97f3\u5c0f\u52a9\u624b","cover_url":"https:\/\/p1.pstatp.com\/large\/1bda8000852aa26656c12.jpg","video_url":"http:\/\/v6-dy.ixigua.com\/2c3a7f072b949101ceac0d465b35ef82\/5ca88513\/video\/m\/2203c9cfb2a446e4c99bb6b34927f3e875911619893d00005d48e8bf9a57\/?rc=am13aWg5bnlobDMzN2kzM0ApQHRAbzM2NzU1ODkzNDo1Ojk3PDNAKXUpQGczdylAZmxkamV6aGhkZjs0QDVecWBkb15pLV8tLWItL3NzLW8jbyM2LzYtLi0uLS0yMi4tLS4vaTpiLW8jOmAtbyNtbCtiK2p0OiMvLl4=","video_key":"ZRGO3V1JNKJ270QWE5"}}

失败:

{"code":10001,"msg":"parameter lost","body":[]}

返回字段注释

字段名 注释 备注
code 错误码 错误码:请参考错误码说明
msg 错误信息 错误码:请参考错误码说明
body
source 解析视频来源 如:douyin、kuaishou
url 开发者请求的url
title 短视频标题
cover_url 短视频封面
video_url 无水印的视频地址 此地址有有效期限制,不可作为永久存储

PHP EXAMPLE:

PHP file_get_contents:

//开发者后台生成的appid
$appId = '';

//开发者后台生成的appsecret
$appSecret = '';

//需要解析的url
$url = '';

$param = [
	'appid'		=> $appId,
	'appsecret'	=> $appSecret,
	'url'		=> $url,
];

//得到请求的地址:https://api-sv.videoparse.cn/api/video/normalParse?appid=2m3Ju99MPXrNtkgH&appsecret=bNG3JYjT83qp4cib&url=http%3A%2F%2Fv.douyin.com%2Fa2X5ab%2F
$apiUrl = 'https://api-sv.videoparse.cn/api/video/normalParse?'.http_build_query($param);
$videoInfo = file_get_contents($apiUrl);
print_r($videoInfo);

PHP curl为例:

//开发者后台生成的appid
$appId = '';

//开发者后台生成的appsecret
$appSecret = '';

//需要解析的url
$url = '';

$param = [
	'appid'		=> $appId,
	'appsecret'	=> $appSecret,
	'url'		=> $url,
];

//得到请求的地址:https://api-sv.videoparse.cn/api/video/normalParse?appid=appid&appsecret=appsecret&url=编码后的url
$apiUrl = 'https://api-sv.videoparse.cn/api/video/normalParse?'.http_build_query($param);

$ch = curl_init();
curl_setopt ( $ch, CURLOPT_URL, $apiUrl );
curl_setopt ( $ch, CURLOPT_SSL_VERIFYPEER, 0 );
curl_setopt ( $ch, CURLOPT_SSL_VERIFYHOST, 0 );
curl_setopt ( $ch, CURLOPT_MAXREDIRS, 5 );
curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt ( $ch, CURLOPT_FOLLOWLOCATION, 1 );
curl_setopt ( $ch, CURLOPT_TIMEOUT, 10 );
$content = curl_exec( $ch );
curl_close ( $ch);

print_r($content);

Python实例代码:

#!/usr/bin/env python
# encoding: utf-8

import requests, urllib, json

appId = ""
appSecret = ""
params = {
   "appid": appId,
   "appsecret": appSecret,
   "url":"",
}
def get(url):
    params["url"] = url;
    api_url = "https://api-sv.videoparse.cn/api/video/normalParse?" + urllib.parse.urlencode(params)

    msg = {"code": 0, "msg": "", "body": ""}

    response = requests.get(url=api_url, timeout=30)

    if response.status_code != 200:
	 	msg['code'] = 1
	 	msg["msg"] = "请求出现问题"
	 	return msg
    # result = json.loads(response.text)      如果你直接拿到系统中使用请将返回参数直接转为json
   	result = response.text  # 如果你不需要转换json,则直接接受数据并返回
   	return result


def post(url):
    params["url"] = url
    api_url = "https://api-sv.videoparse.cn/api/video/normalParse"

    msg = {"code": 0, "msg": "", "body": ""}

    response = requests.post(url=api_url, data=params, timeout=30)
    if response.status_code != 200:
	 	msg['code'] = 1
	  	msg["msg"] = "请求出现问题"
	  	return msg
    # result = json.loads(response.text)      如果你直接拿到系统中使用请将返回参数直接转为json
    result = response.text  # 如果你不需要转换json,则直接接受数据并返回
    return result

##print(get("https://v.douyin.com/JJTDEKL/"))
#print(post("https://v.douyin.com/JJTDEKL/"))