XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/bilibili-API-collect

feat(misc/sign/wbi.md): update haskell demo data

526b037
SessionHu <102411014+SessionHu@users.noreply.github.com>
提交于

代码差异

1 个文件 +10 -5
Modified docs/misc/sign/wbi.md +10 -5
@@ -1355,6 +1355,7 @@ import Data.ByteString.Char8 (pack)
1355 1355 import qualified Data.Map.Strict as Map
1356 1356 import Distribution.Utils.MD5 (md5, showMD5)
1357 1357 import URIEncoder (encodeURIComponent)
1358 import Data.Time.Clock.System (getSystemTime, systemSeconds)
1358 1359
1359 1360 mixinKeyEncTab :: [Int]
1360 1361 mixinKeyEncTab = [
@@ -1378,15 +1379,18 @@ wbi imgKey subKey wts params =
1378 1379 in orig ++ "&w_rid=" ++ showMD5 (md5 $ pack $ orig ++ getMixinKey imgKey subKey)
1379 1380
1380 1381 main :: IO ()
1381 main = -- hard encode for test
1382 let params = Map.fromList [("foo", "114")
1382 main = do -- hard encode for test
1383 let params1 = Map.fromList [("aid", "2")]
1384 params2 = Map.fromList [("foo", "114")
1383 1385 ,("bar", "514")
1384 1386 ,("hello", "世 界")
1385 1387 ]
1386 wts = 1702204169
1387 1388 imgKey = "7cd084941338484aae1ad9425b84077c"
1388 1389 subKey = "4932caff0ff746eab6f01bf08b70ac45"
1389 in putStrLn $ wbi imgKey subKey wts params
1390 wts1 <- getSystemTime
1391 putStrLn $ wbi imgKey subKey (toInteger $ systemSeconds wts1) params1
1392 wts2 <- getSystemTime
1393 putStrLn $ wbi imgKey subKey (toInteger $ systemSeconds wts2) params2
1390 1394 ```
1391 1395
1392 1396 `URIEncoder.hs`<!--(by DS)-->:
@@ -1465,5 +1469,6 @@ percentEncode byte = '%' : toHex byte
1465 1469
1466 1470 输出:
1467 1471 ```text
1468 bar=514&foo=114&hello=%E4%B8%96%20%E7%95%8C&wts=1702204169&w_rid=89f9002a49e1d13c07a28054a1cc2614
1472 aid=2&wts=1744823207&w_rid=a3cd246bd42c066932752b24694eaf0d
1473 bar=514&foo=114&hello=%E4%B8%96%20%E7%95%8C&wts=1744823207&w_rid=93acf59d85f74453e40cea00056c3daf
1469 1474 ```