V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
emtry
V2EX  ›  Apple

Quantumult X 重写脚本 可以引用第三方包吗

  •  
  •   emtry · 199 天前 · 741 次点击
    这是一个创建于 199 天前的主题,其中的信息可能已经有所发展或是发生改变。
    需求:重写一个 xlsx 里的数据
    发现不能直接像在 node 中 require('xlsx')


    曲线救国,只能把整一个改好的 xlsx 重写

    const url = "https://github.com/xxx/xxx.xlsx";
    const myRequest = {
    url: url
    };

    $task.fetch(myRequest).then(response => {
    $done({bodyBytes: response.bodyBytes});
    }, reason => {
    $done();
    });

    不知道还有没有更好的方法,毕竟 xlsx 文件会更新
    4 条回复    2023-10-25 03:07:46 +08:00
    luckycatio
        1
    luckycatio  
       199 天前 via iPhone
    借楼问一下,quanx 能把 vconsole 注入到网页吗
    napsterwu
        2
    napsterwu  
       199 天前 via iPhone
    @luckycatio 把 html 页的请求拦截掉,然后替换

    $task.fetch($request).then($response => {
    let body = $response.body
    body = body.replace('<head>', '<head><script src="https://unpkg.com/vconsole@latest/dist/vconsole.min.js"></script><script>var vConsole = new window.VConsole();</script>')
    delete $response.headers['Content-Length']
    $done(body)
    })
    emtry
        3
    emtry  
    OP
       198 天前
    @napsterwu 好思路
    ODD10
        4
    ODD10  
       185 天前 via iPhone
    @napsterwu 有个问题,就是非 utf-8 编码的网页会乱码
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1727 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 16:28 · PVG 00:28 · LAX 09:28 · JFK 12:28
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.