Module:Bilibili id
Documentation for this module may be created at Module:Bilibili id/doc
local p = {}
function p.main(f)
local input = f.args[1]
if not input then
error("No video ID provided")
end
-- aid / cid
if tonumber(input) then
return input
end
-- bvid
local bvid = "^BV[0-9A-Za-z][0-9A-Za-z][0-9A-Za-z][0-9A-Za-z][0-9A-Za-z][0-9A-Za-z][0-9A-Za-z][0-9A-Za-z][0-9A-Za-z][0-9A-Za-z]$"
if string.match(input, bvid) then
return input
else
error("Invalid ID format")
end
end
return p