Comments (1)
这是从斗鱼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)
- 试了一下获取不到啊 HOT 1
- good good
- 一个是弹幕打印问题 HOT 3
- 礼物信息全吗? HOT 7
- 日志模块 HOT 1
- 有办法区分开播rss是直播还是轮播录像吗? HOT 2
- C# 实现 HOT 2
- 解码出错,貌似Unescape和Escape顺序有问题? HOT 4
- 你有试过发送弹幕吗? HOT 2
- 已结束 HOT 9
- 监听一段时间会断线 HOT 1
- 礼物的实现问题
- examples引出问题
- cst 字段错误
- 🚨 警报!立即领取您的 $1000 快速奖励,现在就是时候在 $PYTH 中了! HOT 2
- -
- 长时间运行会收不到下播提醒 HOT 2
- 能否支持下emoji表情? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from douyudm.