这里说的解析获取无水印视频是通过调用第三方接口的方式实现的,具体的代码如下:
以PHP代码为例:
<?php //www.videoparse.cn后台生成的appid$appId = '';//www.videoparse.cn生成的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);
Python代码实例如下:
#!/usr/bin/env python
# encoding: utf-8import requests, urllib, jsonappId = ""appSecret = ""url = ""params = { "appId": appId, "appSecret": appSecret, "url": url}api_url = "https://api-sv.videoparse.cn/api/video/normalParse"def get(url): ''' :param url: :return: ''' msg = {"code": 0, "msg": "", "body": ""} url = url + "?" + urllib.parse.urlencode(params) response = requests.get(url=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 resultdef post(url, data): ''' :param url: :param data: :param headers: :return: ''' msg = {"code": 0, "msg": "", "body": ""} response = requests.post(url=url, data=data, 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