Coder Social home page Coder Social logo

优化斗鱼STT about douyudm HOT 1 CLOSED

flxxyz avatar flxxyz commented on July 17, 2024
优化斗鱼STT

from douyudm.

Comments (1)

dfaofeng avatar dfaofeng commented on July 17, 2024

这是从斗鱼h5弹幕页中找到的stt序列化的部分代码
e为处理好的弹幕信息,例如:"type@=chatmsg/rid@=74751/ct@=1/uid@=10598109/nn@=Liar左/txt@=????????/cid@=f4b3a7c4b4ac49e6c24d3a0000000000/ic@=avatar_v3@S202003@S5deadea40a214e19990b3e6ea126bc8d/level@=24/sahf@=0/cst@=1592117619849/bnn@=339/bl@=15/brid@=485503/hc@=4434719c2bf09ce9171d09e240a4896f/cbid@=65210/el@=/lk@=/urlev@=14/dms@=5/pdg@=48/pdk@=92/"

decode: function(e) {
                    var t = [];
                    function n(e) {
                        var t = [];
                        "/" != e.charAt(e.length - 1) && (e += "/");
                        for (var n, r = "", i = "", o = 0, a = e.length; o < a; o++)
                            "/" === e.charAt(o) ? (n = {
                                key: r,
                                value: i
                            },
                            t.push(n),
                            r = i = "") : "@" === e.charAt(o) ? (o++,
                            "A" === e.charAt(o) ? i += "@" : "S" === e.charAt(o) ? i += "/" : "=" === e.charAt(o) && (r = i,
                            i = "")) : i += e.charAt(o);
                        return t
                    }
                    return (e = String(e)) && 1 === (t = n(e)).length && /@=/g.test(t[0].value) && (t = n(t[0].value)),
                    t.get = function(e) {
                        return o(this, e)
                    }
                    ,
                    t.too = function() {
                        return a(this)
                    }
                    ,
                    t
                }

然后再通过一个方法获得
e为上面返回值

function(e) {
                for (var t, n = {}, r = 0, i = e.length; r < i; r++)
                    n[(t = e[r]).key] = t.value;
                return n

from douyudm.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.