Bilibili wbi sign test - Url to wbi key (v2)

Revision 2 of this benchmark created on


Description

See also: https://socialsisteryi.github.io/bilibili-API-collect/docs/misc/sign/wbi.html

Setup

const url = 'https://i0.hdslb.com/bfs/wbi/abcde4941338484aae1ad9425b8abcde.png'

const reg1 = /(?<=https:\/\/i0\.hdslb\.com\/bfs\/wbi\/)\w+(?=\.)/

const reg2 = /(?<=https:\/\/i0\.hdslb\.com\/bfs\/wbi\/)\.+(?=\.)/

const reg3 = /(?<=wbi\/)\w+(?=\.)/

Test runner

Ready to run.

Testing in
TestOps/sec
Official
const i = url.substring(
	url.lastIndexOf('/') + 1,
	url.length
).split('.')[0]
ready
Unofficial 1
const i = url.slice(
	url.lastIndexOf('/') + 1,
	url.lastIndexOf('.')
)
ready
Unofficial 2
const i = url.slice(
	url.lastIndexOf('/') + 1,
	url.length - 4
)
ready
Unofficial 3
const i = url.slice(
	29,
	-4
)
ready
Unofficial 4
const i = url.match(reg1)
ready
Unofficial 5
const i = url.match(reg2)
ready
Unofficial 6
const i = url.match(reg3)
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.