1 Star 2 Fork 0

Devoted fans/Unlock-netease-cloud-music

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
sni.js 1.35 KB
一键复制 编辑 原始数据 按行查看 历史
// Thanks to https://github.com/buschtoens/sni
module.exports = data => {
let end = data.length
let pointer = 5 + 1 + 3 + 2 + 32
const nan = (number = pointer) => isNaN(number)
if(pointer + 1 > end || nan()) return null
pointer += 1 + data[pointer]
if(pointer + 2 > end || nan()) return null
pointer += 2 + data.readInt16BE(pointer)
if(pointer + 1 > end || nan()) return null
pointer += 1 + data[pointer]
if(pointer + 2 > end || nan()) return null
let extensionsLength = data.readInt16BE(pointer)
pointer += 2
let extensionsEnd = pointer + extensionsLength
if(extensionsEnd > end || nan(extensionsEnd)) return null
end = extensionsEnd
while(pointer + 4 <= end || nan()){
let extensionType = data.readInt16BE(pointer)
let extensionSize = data.readInt16BE(pointer + 2)
pointer += 4
if(extensionType !== 0){
pointer += extensionSize
continue
}
if(pointer + 2 > end || nan()) return null
let nameListLength = data.readInt16BE(pointer)
pointer += 2
if(pointer + nameListLength > end) return null
while(pointer + 3 <= end || nan()){
let nameType = data[pointer]
let nameLength = data.readInt16BE(pointer + 1)
pointer += 3
if(nameType !== 0){
pointer += nameLength
continue
}
if(pointer + nameLength > end || nan()) return null
return data.toString('ascii', pointer, pointer + nameLength)
}
}
return null
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/1224688280cyy/Unlock-netease-cloud-music.git
git@gitee.com:1224688280cyy/Unlock-netease-cloud-music.git
1224688280cyy
Unlock-netease-cloud-music
Unlock-netease-cloud-music
master

搜索帮助