当前位置:网站首页 > 软件 > 正文

[油猴脚本] 抖音用户数据与视频下载v0.3.5大更新

作者:精品资源网 日期:2024-06-14 22:55:24 浏览:49 分类:软件

插件安装地址:https://greasyfork.org/zh-CN/scripts/471880
在去年开发过插件后,大概半年时间是可用的,今年上半年我一直没上过抖音,不清楚是否可用,最近几天又刷了几次抖音发现插件已经不可用。
今天花了些时间,把插件彻底大改版了一下,基本上大部分的颜值已经与官方融为一体。

操作指引:
安装插件后,等待自身头像加载完毕,会提示已加载的数据条数:

[油猴脚本] 抖音用户数据与视频下载v0.3.5大更新

然后展开头像即可看到下载按钮:

[油猴脚本] 抖音用户数据与视频下载v0.3.5大更新

注意:若你使用office,而不是wps,则需要勾选gbk后再下载用户数据。

对于当前用户的视频,也可以单独点击按钮进行下载,若目标为图片则可以下载打包好的图片。

即使不在用户主页,每个正在播放的视频也可以进行下载:

[油猴脚本] 抖音用户数据与视频下载v0.3.5大更新

里面发布了原始代码。
完整最新的代码都可以在安装脚本后查看。

其中前端js将文本转换为gbk编码的代码为:

let table;
 
 function initGbkTable() {
     // https://en.wikipedia.org/wiki/GBK_(character_encoding)#Encoding
     const ranges = [
         [0xA1, 0xA9, 0xA1, 0xFE],
         [0xB0, 0xF7, 0xA1, 0xFE],
         [0x81, 0xA0, 0x40, 0xFE],
         [0xAA, 0xFE, 0x40, 0xA0],
         [0xA8, 0xA9, 0x40, 0xA0],
         [0xAA, 0xAF, 0xA1, 0xFE],
         [0xF8, 0xFE, 0xA1, 0xFE],
         [0xA1, 0xA7, 0x40, 0xA0],
     ];
     const codes = new Uint16Array(23940);
     let i = 0;
 
     for (const [b1Begin, b1End, b2Begin, b2End] of ranges) {
         for (let b2 = b2Begin; b2 <= b2End; b2++) {
             if (b2 !== 0x7F) {
                 for (let b1 = b1Begin; b1 <= b1End; b1++) {
                     codes[i++] = b2 << 8 | b1
                 }
             }
         }
     }
     table = new Uint16Array(65536);
     table.fill(0xFFFF);
     const str = new TextDecoder('gbk').decode(codes);
     for (let i = 0; i < str.length; i++) {
         table[str.charCodeAt(i)] = codes[i]
     }
 }
 
 function str2gbk(str, opt = {}) {
     if (!table) {
         initGbkTable()
     }
     const NodeJsBufAlloc = typeof Buffer === 'function' && Buffer.allocUnsafe;
     const defaultOnAlloc = NodeJsBufAlloc
         ? (len) => NodeJsBufAlloc(len)
         : (len) => new Uint8Array(len);
     const defaultOnError = () => 63;
     const onAlloc = opt.onAlloc || defaultOnAlloc;
     const onError = opt.onError || defaultOnError;
 
     const buf = onAlloc(str.length * 2);
     let n = 0;
 
     for (let i = 0; i < str.length; i++) {
         const code = str.charCodeAt(i);
         if (code < 0x80) {
             buf[n++] = code;
             continue
         }
         const gbk = table[code];
 
         if (gbk !== 0xFFFF) {
             buf[n++] = gbk;
             buf[n++] = gbk >> 8
         } else if (code === 8364) {
             buf[n++] = 0x80
         } else {
             const ret = onError(i, str);
             if (ret === -1) {
                 break
             }
             if (ret > 0xFF) {
                 buf[n++] = ret;
                 buf[n++] = ret >> 8
             } else {
                 buf[n++] = ret
             }
         }
     }
     return buf.subarray(0, n)
 }


您需要 登录账户 后才能发表评论

取消回复欢迎 发表评论:

请填写验证码