这里说的解析获取无水印视频是通过调用第三方接口的方式实现的,具体的代码如下:
以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-8 import requests, urllib, json appId = "" 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 result def 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
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。