Comments (2)
已修复 (晚点更新 还有个别的bug)
a64017b
3adebb8
from iina-plus.
js: get_sign
function get_sign(rid, dy_did, tt) { var cb = rid + dy_did + tt + "220120190227"; var rb = CryptoJS.MD5(cb).toString(); var re = []; for (var i = 0; i < rb.length / 8; i++) re[i] = (parseInt(rb.substr(i * 8, 2), 16) & 0xff) | ((parseInt(rb.substr(i * 8 + 2, 2), 16) << 8) & 0xff00) | ((parseInt(rb.substr(i * 8 + 4, 2), 16) << 24) >>> 8) | (parseInt(rb.substr(i * 8 + 6, 2), 16) << 24); var k2 = [0x426d8845, 0x59edcc2d, 0x365400, 0x31b96b4d]; for (var I = 0; I < 2; I++) { var v0 = re[I * 2], v1 = re[I * 2 + 1], sum = 0, i = 0; var delta = 0x9e3779b9; for (i = 0; i < 32; i++) { sum += delta; v0 += ((v1 << 4) + k2[0]) ^ (v1 + sum) ^ ((v1 >>> 5) + k2[1]); v1 += ((v0 << 4) + k2[2]) ^ (v0 + sum) ^ ((v0 >>> 5) + k2[3]); } re[I * 2] = v0; re[I * 2 + 1] = v1; } re[0] ^= k2[0]; re[0] ^= k2[2]; re[0] ^= k2[0]; re[0] -= k2[2]; re[1] = (re[1] >>> (k2[1] % 16)) | (re[1] << (32 - (k2[1] % 16))); re[1] ^= k2[3]; re[1] = (re[1] >>> (k2[3] % 16)) | (re[1] << (32 - (k2[3] % 16))); re[2] = (re[2] >>> (k2[0] % 16)) | (re[2] << (32 - (k2[0] % 16))); re[2] += k2[2]; re[2] -= k2[2]; re[3] -= k2[1]; re[3] ^= k2[3]; re[3] -= k2[3]; re[0] -= k2[0]; re[0] += k2[2]; re[0] = (re[0] >>> (k2[2] % 16)) | (re[0] << (32 - (k2[2] % 16))); re[1] = (re[1] << (k2[1] % 16)) | (re[1] >>> (32 - (k2[1] % 16))); re[1] ^= k2[3]; re[1] ^= k2[3]; re[2] += k2[0]; re[2] = (re[2] >>> (k2[2] % 16)) | (re[2] << (32 - (k2[2] % 16))); re[2] = (re[2] >>> (k2[0] % 16)) | (re[2] << (32 - (k2[0] % 16))); re[2] += k2[2]; re[2] = (re[2] << (k2[2] % 16)) | (re[2] >>> (32 - (k2[2] % 16))); re[3] += k2[1]; re[3] = (re[3] << (k2[3] % 16)) | (re[3] >>> (32 - (k2[3] % 16))); re[3] += k2[3]; re[3] = (re[3] << (k2[3] % 16)) | (re[3] >>> (32 - (k2[3] % 16))); { var hc = '0123456789abcdef'.split(''); for (var i = 0; i < re.length; i++) { var j = 0, s = ''; for (; j < 4; j++) s += hc[(re[i] >> (j * 8 + 4)) & 15] + hc[(re[i] >> (j * 8)) & 15]; re[i] = s; } re = re.join(''); } return re; }pseudocode: get_douyu_rtmp_url
def get_douyu_rtmp_url(room_id): cookie = get_cookie() # example: # cookie: dy_did=10ab4930def0490493e0a0b0c29573f1; acf_did=10ab4930def0490493e0a0b0c29573f1; ... # dy_did = 10ab4930def0490493e0a0b0c29573f1 rid = str(room_id) tt = str(time.time()) values = { "v": 220120190227, "did": dy_did, "tt": tt, "sign": get_sign(rid, dy_did, tt), "cdn": "", "rate": 0, "ver": "Douyu_219022605", "iar": 1, "ive": 0, } headers = { 'Accept':'application/json, text/plain, */*', 'Accept-Encoding':'gzip, deflate, br', 'Accept-Language':'en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7', 'Content-Type': 'application/x-www-form-urlencoded', 'Cookie': cookie, 'DNT':'1', 'Origin':'https://www.douyu.com', 'Referer':'https://www.douyu.com/' + rid, 'User-Agent':'Mozilla/5.0', 'X-Requested-With':'XMLHttpRequest'} data = urllib.urlencode(values) url = "https://www.douyu.com/lapi/live/getH5Play/" + rid request = urllib2.Request(url, data, headers)# post response = urllib2.urlopen(request) json_data = response.read() print json_datajson_data: example
{ "error": 0, "msg": "ok", "data": { "room_id": 2268066, "is_mixed": false, "mixed_live": "", "mixed_url": "", "rtmp_cdn": "ws-h5", "rtmp_url": "https://hdls3a.douyucdn.cn/live", "rtmp_live": "yyyyyyyyyyyyyyyyyyyyyyyyy", "client_ip": "xxx.xxx.xxx.xxx", "inNA": 0, "rateSwitch": 0, "rate": 0, "cdnsWithName": [ { "name": "主线路", "cdn": "ws-h5" }, { "name": "备用线路5", "cdn": "tct-h5" } ], "multirates": [ { "name": "超清", "rate": 0, "highBit": 0 } ], "isPassPlayer": 0, "eticket": null, "online": 0, "mixedCDN": "", "p2p": 2, "streamStatus": 1 } }
通过 https://www.douyu.com/lapi/live/getH5Play 获取的 rtmp_url/rtmp_live 好像是分段的,只能播放几秒就会断
斗鱼将h5player的流改成了一段段小的流量包了
from iina-plus.
Related Issues (20)
- B站无弹幕: loadDM(): can't find bilibili ids Key not found: data.data. HOT 1
- 有开发window版本计划吗 HOT 1
- 请问最低什么版本能支持10.13.6呢 HOT 2
- 请问怎么通过命令行调用播放
- 是否有计划增加yy直播解析
- 能否把斗鱼放录像的直播不显示真正播放,有开源的能实现。
- 哔哩哔哩登录失败 HOT 2
- iina打开斗鱼怎么更改fps 默认的fps60会使电脑温度上升 HOT 2
- B站直播无弹幕,其他家直播弹幕正常 HOT 3
- 抖音直播 解析不了 macos11.7.10系统。是因为低版本系统导致的吗 HOT 2
- 【Feature Request】可否添加区分出斗鱼视频轮播?
- 关于一些其他问题
- 软件界面应使用“登录”而不是“登陆”
- Danmuku插件添加的overlay导致IINA的Drag&Drop失效。
- 关于lpl比赛主舞台纯净流直播间无法解析的问题 HOT 1
- youtube
- 奇怪问题 HOT 21
- 合集播放记忆 HOT 1
- 使用自带播放器的时候每次打开都是自动最大音量有点吵
- 部分B站直播间无法打开
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 iina-plus.