> 突发奇想,今天刷抖音发现我都一些收藏的视频忽然发现发不开了,提示作者已删除!今天写一个类似于时光机的功能记录我收藏过的抖音视频做一个备份! ## 分析 * 测试抖音链接 [囚徒爱剪辑](https://v.douyin.com/exKvcCV) * 我们点击链接后跳转到一个这样的地址上面:https://www.iesdouyin.com/share/video/6870025634719010062/?region=CN&mid=6870025718770977543&u_code=15ja5632c&titleType=title&did=MS4wLjABAAAAFUJkph7_nN7qhXpnZWuNttdrM-RET7Bljm1epI4Dqow&iid=MS4wLjABAAAAv3XsHDKMSoF2M57KdiZO0HRmQGRzNWFPr-FzGGkE4x0_il1JyrvVsHUB35ucCJi9&with_sec_did=1×tamp=1623738060&app=aweme&utm_campaign=client_share&utm_medium=ios&tt_from=copy&utm_source=copy * 最后删除一些非必要的参数得到最简URL:https://www.iesdouyin.com/share/user/**59394693481**?sec_uid=**MS4wLjABAAAAqmS0Ea3hSnThEsJscmma_ZQ8KFxtG8zY6crrl9hse1Y** * 一个userid 和 sec_uid 这两个是必备参数【**后面会用到**】 ### sec_uid | userid * 通过链接 https://v.douyin.com/exKvcCV 获取。 ![](https://img.2smile.cn/_image/2021-06-15/2021-06-15-14-50-48.png) ### 调试签名 ![](https://img.2smile.cn/_image/2021-06-15/2021-06-15%2015.01.21.gif) * 通过调试看到获取用户喜欢这个接口的数据需要以下参数。 ![](https://img.2smile.cn/_image/2021-06-15/2021-06-15-15-14-26.png) ![](https://img.2smile.cn/_image/2021-06-15/2021-06-15-17-28-08.png) ```js (function anonymous() { function e(e, a, r) { return (b[e] || (b[e] = t("x,y", "return x " + e + " y")))(r, a) } function a(e, a, r) { return (k[r] || (k[r] = t("x,y", "return new x[y](" + Array(r + 1).join(",x[++y]").substr(1) + ")")))(e, a) } function r(e, a, r) { var n, t, s = {}, b = s.d = r ? r.d + 1 : 0; for (s["$" + b] = s, t = 0; t < b; t++) s[n = "$" + t] = r[n]; for (t = 0, b = s.length = a.length; t < b; t++) s[t] = a[t]; return c(e, 0, s) } function c(t, b, k) { function u(e) { v[x++] = e } function f() { return g = t.charCodeAt(b++) - 32, t.substring(b, b += g) } function l() { try { y = c(t, b, k) } catch (e) { h = e, y = l } } for (var h, y, d, g, v = [], x = 0; ; ) switch (g = t.charCodeAt(b++) - 32) { case 1: u(!v[--x]); break; case 4: v[x++] = f(); break; case 5: u(function(e) { var a = 0 , r = e.length; return function() { var c = a < r; return c && u(e[a++]), c } }(v[--x])); break; case 6: y = v[--x], u(v[--x](y)); break; case 8: if (g = t.charCodeAt(b++) - 32, l(), b += g, g = t.charCodeAt(b++) - 32, y === c) b += g; else if (y !== l) return y; break; case 9: v[x++] = c; break; case 10: u(s(v[--x])); break; case 11: y = v[--x], u(v[--x] + y); break; case 12: for (y = f(), d = [], g = 0; g < y.length; g++) d[g] = y.charCodeAt(g) ^ g + y.length; u(String.fromCharCode.apply(null, d)); break; case 13: y = v[--x], h = delete v[--x][y]; break; case 14: v[x++] = t.charCodeAt(b++) - 32; break; case 59: u((g = t.charCodeAt(b++) - 32) ? (y = x, v.slice(x -= g, y)) : []); break; case 61: u(v[--x][t.charCodeAt(b++) - 32]); break; case 62: g = v[--x], k[0] = 65599 * k[0] + k[1].charCodeAt(g) >>> 0; break; case 65: h = v[--x], y = v[--x], v[--x][y] = h; break; case 66: u(e(t[b++], v[--x], v[--x])); break; case 67: y = v[--x], d = v[--x], u((g = v[--x]).x === c ? r(g.y, y, k) : g.apply(d, y)); break; case 68: u(e((g = t[b++]) < "<" ? (b--, f()) : g + g, v[--x], v[--x])); break; case 70: u(!1); break; case 71: v[x++] = n; break; case 72: v[x++] = +f(); break; case 73: u(parseInt(f(), 36)); break; case 75: if (v[--x]) { b++; break } case 74: g = t.charCodeAt(b++) - 32 << 16 >> 16, b += g; break; case 76: u(k[t.charCodeAt(b++) - 32]); break; case 77: y = v[--x], u(v[--x][y]); break; case 78: g = t.charCodeAt(b++) - 32, u(a(v, x -= g + 1, g)); break; case 79: g = t.charCodeAt(b++) - 32, u(k["$" + g]); break; case 81: h = v[--x], v[--x][f()] = h; break; case 82: u(v[--x][f()]); break; case 83: h = v[--x], k[t.charCodeAt(b++) - 32] = h; break; case 84: v[x++] = !0; break; case 85: v[x++] = void 0; break; case 86: u(v[x - 1]); break; case 88: h = v[--x], y = v[--x], v[x++] = h, v[x++] = y; break; case 89: u(function() { function e() { return r(e.y, arguments, k) } return e.y = f(), e.x = c, e }()); break; case 90: v[x++] = null; break; case 91: v[x++] = h; break; case 93: h = v[--x]; break; case 0: return v[--x]; default: u((g << 16 >> 16) - 16) } } var n = this , t = n.Function , s = Object.keys || function(e) { var a = {} , r = 0; for (var c in e) a[r++] = c; return a.length = r, a } , b = {} , k = {}; return r } ) ``` ### 成功计算Sign * 成功提取调用 ![](https://img.2smile.cn/_image/2021-06-15/2021-06-15%2017.32.09.gif) ### 制作API可调用接口 * 服务器Python3 环境安装这些依赖。 * ![](https://img.2smile.cn/_image/2021-06-15/2021-06-15-19-08-10.png) > 下载无头游览器 > 最后加一个Nginx反向代理即可。 ## 效果 ![](https://img.2smile.cn/_image/2021-06-15/2021-06-15%2019.13.15.gif) 最后修改:2021 年 06 月 15 日 © 禁止转载 打赏 赞赏作者 支付宝微信 赞 如果觉得我的文章对你有用,请随意赞赏