吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 1774|回复: 3
上一主题 下一主题
收起左侧

[经验求助] 求助B站评论w_rid获取过程及源码

[复制链接]
楼主
gentlespider 发表于 2023-9-28 09:45
300吾爱币
我想要这个视频的评论
https://www.bilibili.com/video/BV1Sh411b7mM/?spm_id_from=333.999.0.0对应的 评论链接是
https://api.bilibili.com/x/v2/reply/wbi/main?oid=208761519&type=1&mode=3&pagination_str=%7B%22offset%22:%22%22%7D&plat=1&seek_rpid=&web_location=1315875&w_rid=cc7135ca460ff8aa71f8e5f72e987ef5&wts=1695865243
其中有参数oid 我在源码能拿到,wts是时间戳,w_rid 是md5加密的,但不知道传哪些参数
我在网上找了作者主页的w_id 生成过程,但跟这个不一样
求助

最佳答案

查看完整内容

R的生成函数,const R = getPictureHashKey(N + U) [mw_shl_code=javascript,true]function getPictureHashKey(i) { const V = [46, 47, 18, 2, 53, 8, 23, 32, 15, 50, 10, 31, 58, 3, 45, 35, 27, 43, 5, 49, 33, 9, 42, 19, 29, 28, 14, 39, 12, 38, 41, 13, 37, 48, 7, 16, 24, 55, 40, 61, 26, 17, 0, 1, 60, 51, 30, 4, 22, 25, 54, 21, 56, 59, 6, 63, 57, 62, 11, 36, 20, 34, 44, 52] , N = []; ...

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

沙发
咸鱼灭 发表于 2023-9-28 09:45
R的生成函数,const R = getPictureHashKey(N + U)
[JavaScript] 纯文本查看 复制代码
1
2
3
4
5
6
7
8
9
function getPictureHashKey(i) {
        const V = [46, 47, 18, 2, 53, 8, 23, 32, 15, 50, 10, 31, 58, 3, 45, 35, 27, 43, 5, 49, 33, 9, 42, 19, 29, 28, 14, 39, 12, 38, 41, 13, 37, 48, 7, 16, 24, 55, 40, 61, 26, 17, 0, 1, 60, 51, 30, 4, 22, 25, 54, 21, 56, 59, 6, 63, 57, 62, 11, 36, 20, 34, 44, 52]
          , N = [];
        return V.forEach(U=>{
            i.charAt(U) && N.push(i.charAt(U))
        }
        ),
        N.join("").slice(0, 32)
    }

其中N和U的值为https://api.bilibili.com/x/web-interface/nav   这地址返回的wbi_img里的地址切割过来的,不过应该用它默认的key也行,
wbiImgKey: "839c8b697b0d44dc80e9a604592bb432"
wbiSubKey: "02cd020b04d64aacad6b3a08d06f8eb0"
3#
hygzs 发表于 2023-9-28 09:57
去搜formatImgByLocalParams

[JavaScript] 纯文本查看 复制代码
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
function formatImgByLocalParams(i, V) {
        V || (V = {});
        const {imgKey: N, subKey: U} = getImgFormatConfig(V);
        if (N && U) {
            const R = getPictureHashKey(N + U)
              , Z = Math.round(Date.now() / 1e3)
              , W = Object.assign({}, i, {
                wts: Z
            })
              , F = Object.keys(W).sort()
              , z = []
              , Y = /[!'()*]/g;
            for (let D = 0; D < F.length; D++) {
                const X = F[D];
                let P = W[X];
                P && typeof P == "string" && (P = P.replace(Y, "")),
                P != null && z.push(`${encodeURIComponent(X)}=${encodeURIComponent(P)}`)
            }
            const Q = z.join("&");
            return {
                w_rid: md5(Q + R),
                wts: Z.toString()
            }
        }
        return null
    }


md5(Q + R)
Q的内容mode=3&oid=208761519&pagination_str=%7B%22offset%22%3A%22%22%7D&plat=1&seek_rpid=&type=1&web_location=1315875&wts=1695865820
R的内容比较复杂没细看
const {imgKey: N, subKey: U} = getImgFormatConfig(V);
然后const R = getPictureHashKey(N + U)
4#
 楼主| gentlespider 发表于 2023-9-28 15:11 |楼主
hygzs 发表于 2023-9-28 09:57
去搜formatImgByLocalParams

[mw_shl_code=javascript,true]function formatImgByLocalParams(i, V) {

大佬能给个R的生成过程吗,感谢
返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2025-5-24 17:37

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表