抖音无水印视频解析思路
本文前半部分是分析过程,只看思路的为节省时间建议直接拉到末尾。
本文写于2020年9月8日,不保证此方法在以后的有效性。
分析过程
首先从抖音客户端找一个视频,点击分享-复制链接,粘贴一下发到电脑上,准备进行下一步,这里已经准备好了一个从客户端得到的分享文本。
听说集齐碎片可以召唤神龙!#家乡变成二次元 #充能计划 #画画 #夏日打卡挑战 https://v.douyin.com/Jj8eXXu/ 复制此链接,打开【抖音短视频】,直接观看视频!
把其中的链接粘贴到浏览器中访问一下,得到了这样的界面:
同时,地址栏中的链接变成了:
可见其发生了重定向。
F12审查一下播放区域:
发现这个时候播放区域只有一张背景图片和一个播放按钮,点击一下播放试试:
多了一个video标签,其中的src属性的值就是视频的url,所以大胆猜测一下,这个播放地址可能是通过ajax请求得到的。
切换到Network面板,点击xhr,再刷新一下页面,果然有一个ajax请求,这个ajax请求带有一个item_ids的参数,其值应该为视频的id,可以在页面重定向后的url中找到这个id:
响应结果是一个json字符串,复制到编辑器中格式化后如下:
{
"extra": {
"now": 1599467301000,
"logid": "202009071628210101980651031208C5C1"
},
"status_code": 0,
"item_list": [
{
"video_labels": null,
"label_top_text": null,
"long_video": null,
"category": 103,
"aweme_id": "6855476646057643272",
"desc": "听说集齐碎片可以召唤神龙!#家乡变成二次元 #充能计划 #画画 #夏日打卡挑战",
"video_text": null,
"forward_id": "0",
"mix_info": {
"statis": {
"collect_vv": 0,
"current_episode": 35,
"updated_to_episode": 35,
"play_vv": 0
},
"desc": "原创不易,不喜勿喷~",
"extra": "{\"first_reviewed\":1,\"is_quality_mix\":0,\"next_info\":{\"cover\":\"tos-cn-i-0813/57a48d47c61142748748802d08a75570\",\"desc\":\"原创不易,不喜勿喷~\",\"name\":\"家乡变成二次元\"}}",
"create_time": 1596724793,
"mix_id": "6857880767423318030",
"cover_url": {
"uri": "tos-cn-i-0813/57a48d47c61142748748802d08a75570",
"url_list": [
"https://p6-dy-ipv6.byteimg.com/obj/tos-cn-i-0813/57a48d47c61142748748802d08a75570?from=2563711402",
"https://p1-dy-ipv6.byteimg.com/obj/tos-cn-i-0813/57a48d47c61142748748802d08a75570?from=2563711402",
"https://p26-dy.byteimg.com/obj/tos-cn-i-0813/57a48d47c61142748748802d08a75570?from=2563711402"
]
},
"status": {
"status": 2,
"is_collected": 0
},
"next_info": {
"mix_name": "家乡变成二次元",
"desc": "原创不易,不喜勿喷~",
"cover_url": {
"uri": "tos-cn-i-0813/57a48d47c61142748748802d08a75570",
"url_list": [
"https://p1-dy.bytecdn.cn/obj/tos-cn-i-0813/57a48d47c61142748748802d08a75570",
"https://p3-dy.bytecdn.cn/obj/tos-cn-i-0813/57a48d47c61142748748802d08a75570",
"https://p9-dy.bytecdn.cn/obj/tos-cn-i-0813/57a48d47c61142748748802d08a75570"
]
}
},
"mix_name": "家乡变成二次元"
},
"music": {
"status": 1,
"id": 6855476868364193000,
"mid": "6855476868364192519",
"cover_hd": {
"url_list": [
"https://p26-dy.byteimg.com/aweme/1080x1080/317ca0000ef155aeac0be.jpeg?from=4010531038",
"https://p6-dy-ipv6.byteimg.com/aweme/1080x1080/317ca0000ef155aeac0be.jpeg?from=4010531038",
"https://p3-dy-ipv6.byteimg.com/aweme/1080x1080/317ca0000ef155aeac0be.jpeg?from=4010531038"
],
"uri": "317ca0000ef155aeac0be"
},
"cover_large": {
"url_list": [
"https://p26-dy.byteimg.com/aweme/1080x1080/317ca0000ef155aeac0be.jpeg?from=4010531038",
"https://p6-dy-ipv6.byteimg.com/aweme/1080x1080/317ca0000ef155aeac0be.jpeg?from=4010531038",
"https://p3-dy-ipv6.byteimg.com/aweme/1080x1080/317ca0000ef155aeac0be.jpeg?from=4010531038"
],
"uri": "317ca0000ef155aeac0be"
},
"play_url": {
"uri": "http://p9-dy.byteimg.com/obj/ies-music/6855476835380480781.mp3",
"url_list": [
"http://p9-dy.byteimg.com/obj/ies-music/6855476835380480781.mp3",
"http://p1-dy.byteimg.com/obj/ies-music/6855476835380480781.mp3"
]
},
"duration": 135,
"position": null,
"title": "@不自由画师团团子创作的原声",
"author": "不自由画师团团子",
"cover_medium": {
"uri": "317ca0000ef155aeac0be",
"url_list": [
"https://p29-dy.byteimg.com/aweme/720x720/317ca0000ef155aeac0be.jpeg?from=4010531038",
"https://p1-dy-ipv6.byteimg.com/aweme/720x720/317ca0000ef155aeac0be.jpeg?from=4010531038",
"https://p9-dy.byteimg.com/aweme/720x720/317ca0000ef155aeac0be.jpeg?from=4010531038"
]
},
"cover_thumb": {
"uri": "317ca0000ef155aeac0be",
"url_list": [
"https://p3-dy-ipv6.byteimg.com/aweme/100x100/317ca0000ef155aeac0be.jpeg?from=4010531038",
"https://p9-dy.byteimg.com/aweme/100x100/317ca0000ef155aeac0be.jpeg?from=4010531038",
"https://p29-dy.byteimg.com/aweme/100x100/317ca0000ef155aeac0be.jpeg?from=4010531038"
]
}
},
"author_user_id": 71884871098,
"share_info": {
"share_weibo_desc": "#在抖音,记录美好生活#听说集齐碎片可以召唤神龙!#家乡变成二次元 #充能计划 #画画 #夏日打卡挑战",
"share_desc": "在抖音,记录美好生活",
"share_title": "听说集齐碎片可以召唤神龙!#家乡变成二次元 #充能计划 #画画 #夏日打卡挑战"
},
"promotions": null,
"is_preview": 0,
"group_id": 6855476646057643000,
"video": {
"origin_cover": {
"uri": "tos-cn-p-0015/ac5c4e77f7c441359a656c68c86926e4_1596165086",
"url_list": [
"https://p3-dy-ipv6.byteimg.com/tos-cn-p-0015/ac5c4e77f7c441359a656c68c86926e4_1596165086~tplv-dy-360p.jpeg?from=2563711402",
"https://p6-dy-ipv6.byteimg.com/tos-cn-p-0015/ac5c4e77f7c441359a656c68c86926e4_1596165086~tplv-dy-360p.jpeg?from=2563711402",
"https://p26-dy.byteimg.com/tos-cn-p-0015/ac5c4e77f7c441359a656c68c86926e4_1596165086~tplv-dy-360p.jpeg?from=2563711402"
]
},
"ratio": "540p",
"has_watermark": true,
"bit_rate": null,
"duration": 135302,
"is_long_video": 1,
"width": 720,
"cover": {
"uri": "tos-cn-p-0015/b98b9cb496be4379bcb8e283f38f1c9e",
"url_list": [
"https://p6-dy-ipv6.byteimg.com/img/tos-cn-p-0015/b98b9cb496be4379bcb8e283f38f1c9e~c5_300x400.jpeg?from=2563711402_large",
"https://p3-dy-ipv6.byteimg.com/img/tos-cn-p-0015/b98b9cb496be4379bcb8e283f38f1c9e~c5_300x400.jpeg?from=2563711402_large",
"https://p9-dy.byteimg.com/img/tos-cn-p-0015/b98b9cb496be4379bcb8e283f38f1c9e~c5_300x400.jpeg?from=2563711402_large"
]
},
"height": 1280,
"dynamic_cover": {
"url_list": [
"https://p3-dy-ipv6.byteimg.com/obj/tos-cn-p-0015/11e5f3dcb62749a6848a14c01c556f66_1596165086?from=2563711402_large",
"https://p29-dy.byteimg.com/obj/tos-cn-p-0015/11e5f3dcb62749a6848a14c01c556f66_1596165086?from=2563711402_large",
"https://p9-dy.byteimg.com/obj/tos-cn-p-0015/11e5f3dcb62749a6848a14c01c556f66_1596165086?from=2563711402_large"
],
"uri": "tos-cn-p-0015/11e5f3dcb62749a6848a14c01c556f66_1596165086"
},
"vid": "v0200fda0000bshokcp94bbr1103bot0",
"play_addr": {
"uri": "v0200fda0000bshokcp94bbr1103bot0",
"url_list": [
"https://aweme.snssdk.com/aweme/v1/playwm/?video_id=v0200fda0000bshokcp94bbr1103bot0&ratio=720p&line=0"
]
}
},
"share_url": "https://www.iesdouyin.com/share/video/6855476646057643272/?region=&mid=6855476868364192519&u_code=48&titleType=title",
"aweme_type": 4,
"image_infos": null,
"geofencing": null,
"is_live_replay": false,
"create_time": 1596165084,
"duration": 135302,
"comment_list": null,
"cha_list": [
{
"is_commerce": false,
"cid": "1670532508858382",
"desc": "",
"connect_music": null,
"view_count": 0,
"hash_tag_profile": "",
"cha_name": "家乡变成二次元",
"user_count": 0,
"type": 1
}
],
"risk_infos": {
"warn": false,
"type": 0,
"content": ""
},
"text_extra": [
{
"hashtag_id": 1670532508858382,
"start": 13,
"end": 21,
"type": 1,
"hashtag_name": "家乡变成二次元"
},
{
"start": 22,
"end": 27,
"type": 1,
"hashtag_name": "充能计划",
"hashtag_id": 1655868948754440
},
{
"start": 28,
"end": 31,
"type": 1,
"hashtag_name": "画画",
"hashtag_id": 1553508302124033
},
{
"start": 32,
"end": 39,
"type": 1,
"hashtag_name": "夏日打卡挑战",
"hashtag_id": 1673117213997070
}
],
"author": {
"policy_version": null,
"uid": "71884871098",
"short_id": "612124342",
"signature": "沉迷二次元无法自拔的小姐姐(老阿姨)\n面对骨感的现实,依然满怀希望的走在实现梦想的路上\n————渐行渐远……(画风越来越不对了…)",
"avatar_thumb": {
"uri": "317ca0000ef155aeac0be",
"url_list": [
"https://p3-dy-ipv6.byteimg.com/aweme/100x100/317ca0000ef155aeac0be.jpeg?from=4010531038",
"https://p9-dy.byteimg.com/aweme/100x100/317ca0000ef155aeac0be.jpeg?from=4010531038",
"https://p29-dy.byteimg.com/aweme/100x100/317ca0000ef155aeac0be.jpeg?from=4010531038"
]
},
"unique_id": "",
"platform_sync_info": null,
"nickname": "不自由画师团团子",
"avatar_larger": {
"uri": "317ca0000ef155aeac0be",
"url_list": [
"https://p1-dy-ipv6.byteimg.com/aweme/1080x1080/317ca0000ef155aeac0be.jpeg?from=4010531038",
"https://p9-dy.byteimg.com/aweme/1080x1080/317ca0000ef155aeac0be.jpeg?from=4010531038",
"https://p6-dy-ipv6.byteimg.com/aweme/1080x1080/317ca0000ef155aeac0be.jpeg?from=4010531038"
]
},
"avatar_medium": {
"uri": "317ca0000ef155aeac0be",
"url_list": [
"https://p6-dy-ipv6.byteimg.com/aweme/720x720/317ca0000ef155aeac0be.jpeg?from=4010531038",
"https://p29-dy.byteimg.com/aweme/720x720/317ca0000ef155aeac0be.jpeg?from=4010531038",
"https://p3-dy-ipv6.byteimg.com/aweme/720x720/317ca0000ef155aeac0be.jpeg?from=4010531038"
]
},
"followers_detail": null,
"geofencing": null,
"type_label": null
},
"statistics": {
"aweme_id": "6855476646057643272",
"comment_count": 6598,
"digg_count": 74803,
"play_count": 0
}
}
],
"ab_type": 1
}
信息还是蛮丰富的,作者信息、视频信息、音乐信息、封面信息等一应俱全,视频的地址是在item_list下video.play_addr.url_list中,复制下这个地址用浏览器访问一下果然得到了视频:
不过这个视频还是带水印的,如何获得没有水印的视频呢,来看看从json字符串中得到的视频地址:
觉不觉得这个playwm中的wm是water mask的简写呢,把wm删掉再访问一下试试。即:
https://aweme.snssdk.com/aweme/v1/play/?video_id=v0200fda0000bshokcp94bbr1103bot0&ratio=720p&line=0
结果一片空白,是不是这样行不通呢,不应该啊,不然直接写play多好,何必又搞个playwm呢,一定是访问姿势有问题,点击左上角的设备切换按钮切换到移动端访问一下,哇,amazing,竟然真的访问到了!
同时可以看到原本左上角的抖音水印消失了。成功!
思路总结
- 访问客户端分享文本中的链接,从重定向后的url中提取视频id,
https://www.iesdouyin.com/share/video/
后的数字就是视频id。 - 访问
https://www.iesdouyin.com/web/api/v2/aweme/iteminfo/?item_ids=视频id
获取有关该视频的json字符串。 - 从得到的json字符串中提取视频播放地址,在item_list下video.play_addr.url_list中。
- 将视频地址中的playwm替换为play。
- 使用移动端的user-agent访问替换后的视频地址即可得到无抖音水印的视频。
个人已使用node.js写了一个抖音无水印视频的解析库,并发布在了npm和github上,详情请访问: