API文档抖音无水印解析 | 接口文档
昔枫沐杰接口特性:
接口文档
- 请求地址:
https://api.mu-jie.cc/douyin
请求方式:GET
返回格式: JSON
请求参数
参数名称 |
是否必填 |
参数值/说明 |
url |
是 |
需要解析的抖音链接 |
请求示例
返回示例
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| { "code": 200, "msg": "获取成功", "data": { "src": "https://v.douyin.com/iRNxk23x/", "author": "小瑶唉!", "uid": "Rose.Yo", "like": 2803, "time": 1698109949, "title": "报告 我在想你哦.ᐟ.ᐟ#甜妹 #扭一扭 #骗你生女儿 #初恋 @DOU+小助手 @DOU+上热门", "cover": "https://p9-pc-sign.douyinpic.com/tos-cn-p-0015/f1d5048c7d874ab5ab75e9b851e01e3e_1698109957~tplv-dy-360p.jpeg?x-expires=1701759600&x-signature=wR6WZ%2FJ3WWM9n6ceJQGQxcMVqA8%3D&from=3213915784&s=PackSourceEnum_AWEME_DETAIL&se=false&sc=origin_cover&biz_tag=pcweb_cover&l=20231121150450858544137B0BE2078019", "music": { "url": "https://sf6-cdn-tos.douyinstatic.com/obj/ies-music/7293326697196620581.mp3", "cover": "https://p3-pc.douyinpic.com/aweme/1080x1080/aweme-avatar/tos-cn-avt-0015_db27f304a9c4aec714ff65f8116ba919.jpeg?from=116350172" }, "type": "视频", "url": "http://v5-dy-o-abtest.zjcdn.com/cf4df704e8150fd2c6b25d06774d085d/655c64b2/video/tos/cn/tos-cn-ve-15c001-alinc2/owAOAAyyChMQDe0Ey43tBfQmQzdNl4IErL7awg/?a=6383&ch=26&cr=3&dr=0&lr=all&cd=0%7C0%7C0%7C3&cv=1&br=1744&bt=1744&cs=0&ds=4&ft=dqY4KGCe0071E~vjVQ_Lt5.7usJjf0nmaglc&mime_type=video_mp4&qs=0&rc=ZzpoaDVnNzw6Zzw1aDQ0OUBpM2Vldjc6ZjlrbjMzNGkzM0AzMjZgXi0yNWIxMF4yMGMvYSNwazBmcjRfZm9gLS1kLS9zcw%3D%3D&btag=e00010000&cc=46&dy_q=1700550291&feature_id=46a7bb47b4fd1280f3d3825bf2b29388&l=20231121150450858544137B0BE2078019", "images": null } }
|
安卓端APP
写了一个安卓端的APP,点击下载
(关于APP的编写细节,日后有时间会发个文章谈一谈)

用Python调用接口实现抖音解析下载助手
运行效果


步骤
1. 新建文件夹
2. 在文件夹内新建main.py
3. 打开main.py粘贴以下代码后保存
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
| import re import requests import os import json from tqdm import tqdm from urllib.parse import quote
RED = "\033[91m" GREEN = "\033[92m" YELLOW = "\033[93m" RESET = "\033[0m"
loop = True
def download(url, save_path): response = requests.get(url, stream=True) if response.status_code == 200: os.makedirs(os.path.dirname(save_path), exist_ok=True) total_size = int(response.headers.get('content-length', 0)) block_size = 1024 progress_bar = tqdm(total=total_size, unit='B', unit_scale=True) with open(save_path, 'wb') as file: for chunk in response.iter_content(block_size): progress_bar.update(len(chunk)) file.write(chunk) progress_bar.close() return True else: return False
while(loop): os.system('cls' if os.name == 'nt' else 'clear') print(YELLOW + '【抖音无水印解析下载助手】' + RESET) src = input(GREEN + '请输入抖音作品链接/分享口令(右键粘贴):' + RESET) match1 = re.search(r"https:\/\/v\.douyin\.com\/([a-zA-Z0-9]+)\/", src) match2 = re.search(r"\d{5,}", src) if match1: url = match1.group(0) elif match2: url = quote(src) else: print(RED + '抖音链接错误,请重新输入' + RESET) exit()
print(GREEN + '正在解析……' + RESET) res = requests.get(f'https://api.mu-jie.cc/douyin?url={url}').json() print(GREEN + '\n解析成功!' + RESET) print(GREEN + '标题:' + RESET + res['data']['title']) print(GREEN + '作者:' + RESET + res['data']['author']) print(GREEN + 'UID:' + RESET + res['data']['uid']) print(GREEN + '日期:' + RESET + str(res['data']['time'])) print(GREEN + '点赞:' + RESET + str(res['data']['like'])) print(GREEN + '类型:' + RESET + res['data']['type'] + '\n')
if res['data']['type'] == '视频': type = '视频' else: type = '图集' if res['data']['title'] == '': title = f"无标题 - @{res['data']['author']}" else: title = re.sub(r'[\\/:*?"<>|]', '', res['data']['title']).replace('\n', '').replace('\t', '').replace('\r', '') if len(title) > 50: title = title[:50] + '…' cmd = input(GREEN + f'1: 下载{type}\n2: 返回解析\n其他: 退出\n请输入指令:' + RESET) if cmd == '1': if type == '视频': file_path = f'./video/log/{title}.json' os.makedirs(os.path.dirname(file_path), exist_ok=True) with open(file_path, 'w', encoding='utf-8') as file: file.write(json.dumps(res, ensure_ascii=False, indent=2)) print(GREEN + '\n正在下载视频……' + RESET) save_location = "./video/" + title + ".mp4" if download(res['data']['url'], save_location): print(GREEN + '下载完成!' + RESET) else: print(RED + '下载失败!' + RESET) else: file_path = f'./img/{title}/log.json' os.makedirs(os.path.dirname(file_path), exist_ok=True) with open(file_path, 'w', encoding='utf-8') as file: file.write(json.dumps(res, ensure_ascii=False, indent=2)) print(GREEN + '\n正在下载图集……' + RESET) i = 0 for img in res['data']['images']: i += 1 save_location = f'./img/{title}/{i}.jpg' download(img, save_location) if i == len(res['data']['images']): print(GREEN + '下载完成!' + RESET) else: print(RED + '下载失败!' + RESET) if input(GREEN + f'\n1: 返回解析\n其他: 退出\n请输入指令:' + RESET) == '1': loop = True else: loop = False elif cmd == '2': loop = True else: loop = False
|
4. 在文件夹内打开终端,安装所需的包
不知道是否已经安装过?执行以下命令可检测是否已经安装了该包
如果没有安装,则执行以下命令安装
1 2
| pip install requests pip install tqdm
|
5. 启动
在文件夹内打开终端,执行以下命令即可运行
或
在文件夹内新建.bat文件,粘贴以下代码并保存
1 2 3
| @echo off python main.py pause
|
保存后双击.bat文件即可运行
The End