2023最新短视频解析接口

一、废话不多说,直接上代码

import requests
import json


url = "http://api.txapi.cn/v1/parse_short_video/dy"
response = requests.post(url, data={
    "token": "Z1QljZOZiT4NTG",
    "url": "https://v.douyin.com/BRKEDsn/"
})
ret = json.loads(response.content.decode())
print(ret)
data = {
    "parse_type": "视频" if ret["data"]["type"] == 1 else "图片集",  # 解析类型:1视频、2图片
    "title": ret["data"]["title"],  # 文案
    "cover_url": ret["data"]["cover_url"],  # 封面图
    "video_url": ret["data"]["video_url"],  # 无水印视频
    "img_url_list": ret["data"]["imgs"],  # 无水印图片列表
}
print(data)

二、返回内容

{
    "code":200,
    "msg":"OK",
    "data":{
        "type":1,
        "title":"新年第一镜",
        "cover_url":"https://p1-dy.byteimg.com/obj/tos-cn-i-dy/e78721c9b613426f9d555420561b9297",
        "video_url":"https://v5.douyinvod.com/e38f76c54dd0185c43131c889b8256a5/63f0cdd1/video/tos/cn/tos-cn-ve-15c001-alinc2/ocRPHlAAG7wJBCcnf3BBVPNAHeEmUech7A257k/?a=1128&ch=0&cr=0&dr=0&cd=0%7C0%7C0%7C0&cv=1&br=962&bt=962&cs=0&ds=3&ft=Tel5n11Wv.WQtG6EMyus0WCFIKowZcAso97M5H6KJd&mime_type=video_mp4&qs=0&rc=aWdmNzU5ZGc6ODRpNmQ6NUBpanl3aTs6Zmg3aTMzNGkzM0AwMmEtMDI0NTQxLl4uNDUtYSNnZ28vcjQwZDJgLS1kLS9zcw%3D%3D&l=20230218200733787E0F51046C2576589B&btag=a8000",
        "imgs":[]
    },
    "time":1676722263
}

你可能感兴趣的:(Python,音视频,json)