# data.index ## data.index文件解析 本解密及数据解析例程以《在魔王城说晚安 第 1 话 不眠之城的公主》为例 本话链接:https://manga.bilibili.com/mc26731/329893 (mcid=`26731`, epid=`329893`) 使用 Python 语言为例 ### 获取data.index 直接使用 GET 方法请求该话对应的 data.index 文件地址,就会得到一个二进制文件 ```bash curl -s 'https://manga.hdslb.com/bfs/manga/26731/329893/data.index?token=4b93ced19dc5ade671064804232ef4f5&ts=634e1943' | hexdump -C ``` data.index 文件内容的 HEX 如下 首部有 9 Byte 作为 File Magic 内容是 ASCII 编码的 `BILICOMIC` ``` 00000000 42 49 4c 49 43 4f 4d 49 43 f5 43 06 04 7f 68 08 |BILICOMIC.C...h.| 00000010 00 ad 08 05 00 6b 68 00 00 a5 08 05 00 6b 68 00 |.....kh......kh.| 00000020 00 a5 08 0c 00 6b 68 69 6e c1 6d 7d 2e 0f 09 74 |.....khin.m}...t| 00000030 ec 33 c3 8f 5c 2c 64 86 df 40 a4 82 58 9c 42 f5 |.3..\,d..@..X.B.| 00000040 ab 21 51 4d aa f9 f1 e0 84 84 9b 40 12 58 87 1e |.!QM.......@.X..| 00000050 ba 28 29 7d ce 89 04 03 d9 91 8d fd 7e 31 1d be |.()}........~1..| 00000060 ba d8 35 ef cb a0 83 db 71 5e f1 ee f1 90 19 43 |..5.....q^.....C| 00000070 03 dd 32 f7 b8 7a b7 07 7f b9 3f 7d 3a d5 54 7e |..2..z....?}:.T~| 00000080 5f fa e2 bd c1 90 bb 0f 9c 7d 34 e4 f0 49 2f 17 |_........}4..I/.| 00000090 39 1b c0 cc 45 25 47 72 76 34 13 12 b9 12 f9 f3 |9...E%Grv4......| 000000a0 8b b9 56 13 72 be 60 5e 55 27 5f 98 e0 3e 41 78 |..V.r.`^U'_..>Ax| 000000b0 d5 af 56 d0 82 3c d5 e0 55 94 70 d0 0c 16 5f 33 |..V..<..U.p..._3| 000000c0 c5 bb 14 d7 e9 e5 4a 7c 7f db 04 ea 7b 9b 90 94 |......J|....{...| 000000d0 fd 53 e1 d2 f8 86 1b 7c ea 97 dd 0b 22 33 75 39 |.S.....|...."3u9| 000000e0 24 76 39 38 6d 58 a4 ed b4 14 8f 71 49 95 9c cb |$v98mX.....qI...| 000000f0 eb 42 eb ec df a2 22 ae 39 0c 3d 03 95 43 27 55 |.B....".9.=..C'U| 00000100 c1 c8 b2 37 2c 01 b0 f4 22 7c 51 1a 93 b5 ab 6d |...7,..."|Q....m| 00000110 72 95 0c 33 9a ed 2d d6 22 f0 08 b6 5c bb f6 b5 |r..3..-."...\...| 00000120 07 5f cf a1 3a 66 c8 30 41 29 31 dd 17 63 46 85 |._..:f.0A)1..cF.| 00000130 ea 53 20 a0 aa 89 65 91 78 37 ac 4b 06 e6 59 7a |.S ...e.x7.K..Yz| 00000140 c2 b7 10 56 cc a0 2e 85 94 09 01 89 83 43 82 a4 |...V.........C..| 00000150 db 60 91 89 15 83 aa 45 aa d6 5f fd 6a 64 f9 1c |.`.....E.._.jd..| 00000160 9d ef c3 6c 34 85 e7 49 8a a7 c3 bc 32 09 eb b8 |...l4..I....2...| 00000170 ef 70 ab d6 6a d2 7f f6 96 b1 9a 75 eb f8 47 34 |.p..j......u..G4| 00000180 db 1d 99 78 57 58 04 4e e0 c4 a4 58 d8 81 f5 02 |...xWX.N...X....| 00000190 3c 42 7e 1c 27 98 3c 70 df 04 13 33 fa ff 21 3b | 查看json内容: ```json { "clips": [ {"r": 1600, "b": 2300, "t": 0, "l": 0, "pic": 0}, {"r": 1600, "b": 2468, "t": 0, "l": 0, "pic": 1}, {"r": 1600, "b": 2468, "t": 0, "l": 0, "pic": 2}, {"r": 1600, "b": 2468, "t": 0, "l": 0, "pic": 3}, {"r": 1600, "b": 2468, "t": 0, "l": 0, "pic": 4}, {"r": 1600, "b": 2468, "t": 0, "l": 0, "pic": 5}, {"r": 1600, "b": 2468, "t": 0, "l": 0, "pic": 6}, {"r": 1600, "b": 2468, "t": 0, "l": 0, "pic": 7}, {"r": 1600, "b": 2468, "t": 0, "l": 0, "pic": 8}, {"r": 1600, "b": 2468, "t": 0, "l": 0, "pic": 9}, {"r": 1600, "b": 2468, "t": 0, "l": 0, "pic": 10}, {"r": 1600, "b": 2468, "t": 0, "l": 0, "pic": 11}, {"r": 1600, "b": 2468, "t": 0, "l": 0, "pic": 12}, {"r": 1600, "b": 2468, "t": 0, "l": 0, "pic": 13}, {"r": 1600, "b": 2468, "t": 0, "l": 0, "pic": 14}, {"r": 1600, "b": 2468, "t": 0, "l": 0, "pic": 15}, {"r": 1600, "b": 2468, "t": 0, "l": 0, "pic": 16}, {"r": 1600, "b": 2468, "t": 0, "l": 0, "pic": 17}, {"r": 1600, "b": 2468, "t": 0, "l": 0, "pic": 18}, {"r": 1600, "b": 2468, "t": 0, "l": 0, "pic": 19}, {"r": 1600, "b": 2468, "t": 0, "l": 0, "pic": 20}, {"r": 846, "b": 1200, "t": 0, "l": 0, "pic": 21} ], "pics": [ "/bfs/manga/fc655fa220dfab74bb91b9b6e308e92e1f74fc4b.jpg", "/bfs/manga/cb3c882f5a72c45385541e65dba6ac7689c24ebc.jpg", "/bfs/manga/9f79683a30a1f165a6abcd2550066bd0f9bce719.jpg", "/bfs/manga/592702a6411a8739d041d50cff9ac52ccc3e0ab1.jpg", "/bfs/manga/52fb305a77f80d4078469c67ca4c4d8031722acc.jpg", "/bfs/manga/d3bb31ca1943c2558eca9df9a44b7fb52d927f1e.jpg", "/bfs/manga/2ac06b8dbaae0499edf7fb6cd99c1fe4b424a96f.jpg", "/bfs/manga/98f63f139ecf30e3b037635fc1f59fb40388e947.jpg", "/bfs/manga/55099ea5e0e198482ea6d216a5e41b02835701b7.jpg", "/bfs/manga/ee60daaf9ca659bb0df7d45402c86c79a1f64739.jpg", "/bfs/manga/8620f9742fddc97d4179f18fd2b9f1b1420138dd.jpg", "/bfs/manga/0490a9d8bdb6312ac56baa24ed0595a2465d98dc.jpg", "/bfs/manga/bc3234cb0ba2be2b724b1a640a418f1db7b2ac43.jpg", "/bfs/manga/0d16c5e9779f187916e4b173e7a6447b14707ece.jpg", "/bfs/manga/58f3985afc3f2cf57052725dfea47af5634ac1c8.jpg", "/bfs/manga/de09b30d952566c2c1308f5da59a2ffb3b2deb5c.jpg", "/bfs/manga/36ecc5565340605883cb000f513b49bfc91e0d3e.jpg", "/bfs/manga/120f3174def02b3dd908ee69b427d094506b884d.jpg", "/bfs/manga/fdbe3bd0d446c0129557bd19037785456e55f12c.jpg", "/bfs/manga/813a1bb68c3f89616583c8662fa81984d6a907db.jpg", "/bfs/manga/fd3a53f04831e577707e4c873e2fc205e71d5cde.jpg", "/bfs/manga/50e1c513336e0685ca01723d64c712294e534ca0.jpg" ], "sizes": [ {"cx": 1600, "cy": 2300}, {"cx": 1600, "cy": 2468}, {"cx": 1600, "cy": 2468}, {"cx": 1600, "cy": 2468}, {"cx": 1600, "cy": 2468}, {"cx": 1600, "cy": 2468}, {"cx": 1600, "cy": 2468}, {"cx": 1600, "cy": 2468}, {"cx": 1600, "cy": 2468}, {"cx": 1600, "cy": 2468}, {"cx": 1600, "cy": 2468}, {"cx": 1600, "cy": 2468}, {"cx": 1600, "cy": 2468}, {"cx": 1600, "cy": 2468}, {"cx": 1600, "cy": 2468}, {"cx": 1600, "cy": 2468}, {"cx": 1600, "cy": 2468}, {"cx": 1600, "cy": 2468}, {"cx": 1600, "cy": 2468}, {"cx": 1600, "cy": 2468}, {"cx": 1600, "cy": 2468}, {"cx": 846, "cy": 1200} ] } ``` ## data.index内容 以下内容为解密后的 JSON 数据定义 根对象: | 字段 | 类型 | 内容 | 备注 | | ----- | ----- | -------- | ---- | | clips | array | 尺寸信息 | | | pics | array | 图片路径 | | | sizes | array | 尺寸信息 | | 根对象中的`clips`数组: | 项 | 类型 | 内容 | 备注 | | ---- | ---- | --------------- | ---- | | 0 | obj | 第 1 页信息 | | | n | obj | 第 (n+1) 页信息 | | | …… | obj | …… | …… | `clips`数组中的对象: | 字段 | 类型 | 内容 | 备注 | | ---- | ---- | ------------ | ------------- | | r | num | 图片宽度 | | | b | num | 图片高度 | | | t | num | (?) | | | l | num | (?) | | | pic | num | 图片页码序号 | 从 0 开始递增 | 根对象中的`pics`数组: | 项 | 类型 | 内容 | 备注 | | ---- | ---- | ----------------- | ------------------------------ | | 0 | str | 第 1 图片路径 | 图片不能直接访问,需要二次鉴权 | | n | str | 第 (n+1) 图片路径 | | | …… | str | …… | …… | 根对象中的`sizes`数组: | 项 | 类型 | 内容 | 备注 | | ---- | ---- | --------------- | ---- | | 0 | obj | 第 1 页信息 | | | n | obj | 第 (n+1) 页信息 | | | …… | obj | …… | …… | `clips`数组中的对象: | 字段 | 类型 | 内容 | 备注 | | ---- | ---- | -------- | ---- | | cx | num | 图片宽度 | | | cy | num | 图片高度 | |