Module:RecursiveSelectiveList
Documentation for this module may be created at Module:RecursiveSelectiveList/doc
local p = {}
local mw = require('mw')
function p.callAPI(params)
local success, response = pcall(function()
-- Call the MediaWiki API and return the raw response
return mw.site.api(params)
end)
if success then
return true, response
else
return false, "Error: " .. tostring(response)
end
end
function p.main(frame)
local params = {
action = "query",
list = "categorymembers",
cmtitle = "Category:Books",
cmlimit = "max",
format = "json"
}
local success, response = p.callAPI(params)
if success then
return response -- Return raw JSON response for debugging
else
return response -- Return error message
end
end
return p