Модуль:FetchData
Документацію для цього модуля можна створити у Модуль:FetchData/документація
local p = {} function p.season_result(frame) local season = frame.args.season local player = frame.args.player -- Adjusting page title retrieval based on season local season_titles = { "Перший_сезон", "Другий_сезон", "Третій_сезон", "Четвертий_сезон", "П'ятий_сезон" } local season_title = season_titles[tonumber(season)] if not season_title then return "Invalid season number" end local title = mw.title.makeTitle(0, season_title) local content = title:getContent() if not content then return "Season page not found" end -- Improved pattern matching for player rank local pattern = "|%s*%[%[" .. mw.ustring.gsub(player, "([%(%)%.%-%+])", "%%%1") .. "|[^%]]+%]%]%s*|%s*(%d+)%s*|" local direct_pattern = "|%s*" .. mw.ustring.gsub(player, "([%(%)%.%-%+])", "%%%1") .. "%s*|%s*(%d+)%s*|" -- Attempt to find the player's data in the rating section local rating_section = mw.ustring.match(content, "== Рейтинг ==.-{| class=\"wikitable sortable\"(.-)|}") if not rating_section then return "Rating section not found" end local rank = mw.ustring.match(rating_section, pattern) or mw.ustring.match(rating_section, direct_pattern) if not rank then return "Player not found in season rankings" end return rank end return p