您好,登錄后才能下訂單哦!
這里說(shuō)的解析獲取無(wú)水印視頻是通過(guò)調(diào)用第三方接口的方式實(shí)現(xiàn)的,具體的代碼如下:
以PHP代碼為例:
<?php //www.videoparse.cn后臺(tái)生成的appid $appId = ''; //www.videoparse.cn生成的appsecret $appSecret = ''; //需要解析的url $url = ''; $param = [ 'appid' => $appId, 'appsecret' => $appSecret, 'url' => $url, ]; //得到請(qǐng)求的地址: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代碼實(shí)例如下:
#!/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"] = "請(qǐng)求出現(xiàn)問(wèn)題" return msg # result = json.loads(response.text) 如果你直接拿到系統(tǒng)中使用請(qǐng)將返回參數(shù)直接轉(zhuǎn)為json result = response.text # 如果你不需要轉(zhuǎn)換json,則直接接受數(shù)據(jù)并返回 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"] = "請(qǐng)求出現(xiàn)問(wèn)題" return msg #result = json.loads(response.text) 如果你直接拿到系統(tǒng)中使用請(qǐng)將返回參數(shù)直接轉(zhuǎn)為json result = response.text # 如果你不需要轉(zhuǎn)換json,則直接接受數(shù)據(jù)并返回 return result
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。