Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加对播放量的过滤 #4

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

freemedom
Copy link

只简单测试了一下

@KID-joker
Copy link
Owner

看了一下,逻辑好像没什么问题,但我觉得变量命名和筛选项划分范围(一千、一万、十万、百万、自定义可能会更好?)不是很恰当,我原来写的也不是很好哈哈,打算过段时间重写一遍。
你可以复制你的代码到油猴用着,感谢你的pr

@freemedom
Copy link
Author

我就照着你的逻辑直接改的,改完试了试发现好像没啥问题,就懒得再细改里边的细节了 😂😂

@freemedom
Copy link
Author

freemedom commented Feb 29, 2024

当请求时间超过10000毫秒时,会出现超时错误。看着是在下边这个函数里计时的。
看了看不知道怎么延长这个10s超时,就自己加了个限制
image

    _send(e, t) {
        const s = T({}, t)
          , a = Co(this.defaults.baseURL, e);
        return new Promise(n=>{
            var o;
            try {
                const i = ((o = s == null ? void 0 : s.ctx) == null ? void 0 : o.headers) || {};
                delete i.host,
                delete i["accept-encoding"],
                s.headers = T(T({
                    Accept: "application/json, text/plain, */*"
                }, i), s.headers || {}),
                s.credentials = s.credentials || this.defaults.credentials;
                const r = Lo("_sendUrl", a, s)
                  , u = Fo(a, s);
                if (u) {
                    r.finish(),
                    n([null, u]);
                    return
                }
                let v = !1;
                const f = Bo(a, s)
                  , h = s.timeout || this.defaults.timeout
                  , _ = s.onRequest || this.defaults.onRequest
                  , p = s.onResponse || this.defaults.onResponse
                  , b = S=>{
                    let y;
                    const m = Ai
                      , w = new m
                      , B = setTimeout(()=>{
                        if (w.abort(),
                        v = !0,
                        S) {
                            r.setTag("error", !0),
                            n([`request ${a} TIMEOUT`, null]);
                            return
                        }
                        r.setTag("retry_url", a),
                        b(!0)
                    }
                    , h);
                    if (f)
                        if (wo(f))
                            y = f;
                        else {
                            clearTimeout(B),
                            r.finish(),
                            n([null, f]);
                            return
                        }
                    if (!y)
                        if (_) {
                            const g = _({
                                url: a,
                                config: s
                            });
                            y = this._req(g.url, ke(T({}, g.config), {
                                signal: w.signal
                            }))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants