抖音去水印视频详细步骤及接口编写
手工版本
抖音app点击分享按钮,找到复制链接,比如 https://v.douyin.com/nUSV1a/
以chrome为例,打开chrome,右键点击检查,选中Network选项
访问第一步中的链接 https://v.douyin.com/nUSV1a/
查看前两个请求就可以了
访问原理:第一条请求访问https://v.douyin.com/nUSV1a/后链接跳转至https://www.iesdouyin.com/share/video/6728960038880267523/?region=CN&mid=6728920571603700488&u_code=lmkgdm53&titleType=title×tamp=1583719737&utm_campaign=client_share&app=aweme&utm_medium=ios&tt_from=copy&utm_source=copy
第二条请求访问 https://www.iesdouyin.com/share/video/6728960038880267523/?region=CN&mid=6728920571603700488&u_code=lmkgdm53&titleType=title×tamp=1583719737&utm_campaign=client_share&app=aweme&utm_medium=ios&tt_from=copy&utm_source=copy 找到Responnse中playAddr字段的值playAddr: “https://aweme.snssdk.com/aweme/v1/playwm/?s_vid=93f1b41336a8b7a442dbf1c29c6bbc56322615f89303a077704b3b256179d92dbd8230c82edc52099d8bd7a5f88d9163d0356815dd73ecc0228d84af090034d7&line=0",将链接中playwm 修改为play即可 https://aweme.snssdk.com/aweme/v1/play/?s_vid=93f1b41336a8b7a442dbf1c29c6bbc56322615f89303a077704b3b256179d92dbd8230c82edc52099d8bd7a5f88d9163d0356815dd73ecc0228d84af090034d7&line=0
注:浏览器模拟手机打开链接即可
工具版本
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
| #coding=utf-8 import requests
#获取真正的原始url def get_duyin_raw_url(url): headers = { 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) ' 'Chrome/65.0.3325.181 Safari/537.36'} http_result = requests.get(url, headers=headers) if http_result.ok: raw_url = process_raw_video_url(str(http_result.content)) if len(raw_url) > 0: raw_url = raw_url.replace("playwm", "play") return raw_url
return ""
# 处理返回Url的内容 # 逻辑: # 1:先找到playAddr: 2:再去切割,第二个就是我们要地址 def process_raw_video_url(reuslt): raw_url = "" find_url = "playAddr: " if len(reuslt) > 0: find_pos = reuslt.find(find_url) print find_pos print reuslt if find_pos != -1: new_url = reuslt[find_pos:-1] str_array = new_url.split("\"") raw_url = str_array[1]
return raw_url
def main(): test_url = "https://v.douyin.com/nUSV1a/" raw_url = get_duyin_raw_url(test_url) print(raw_url)
main()
|