无编辑摘要
无编辑摘要
第18行: 第18行:
, 'use jsonpath'
, 'use jsonpath'
}
}
return pages.all
return table.concat(pages.all)
end
end


return p
return p

2020年8月26日 (三) 12:58的版本


--Info By Stapx Steve
--本模块包含一些用于获取 WIKI 数据的功能

local p = {} --p代表一个包(package)

-- 以下是实战函数
------------------------------------------------------------
function p.getCatInfo(frame)
	local name = frame.args[1]
	local title = mw.title.new(name)
	local url = title.prefixedText
	local api = "https://dhwpcs.tk/api.php?action=query&list=categorymembers&cmlimit=100&format=json&cmtitle="..url
	
	local pages = mw.ext.externaldata.getWebData {
    	url = api
		, data = "name = $.query.categorymembers[*].title, all = $"
		, format = "json"
		, 'use jsonpath'
	}
	return table.concat(pages.all)
end

return p