3415
редагувань
Admin (обговорення | внесок) Немає опису редагування |
Admin (обговорення | внесок) Немає опису редагування |
||
Рядок 10: | Рядок 10: | ||
} | } | ||
mw.log("Season index: ", season) | mw.log("Season index: ", season) | ||
mw.log("Player name: ", player) | mw.log("Player name: ", player) | ||
local season_title = season_titles[tonumber(season)] | local season_title = season_titles[tonumber(season)] | ||
mw.log("Season page title: ", season_title) | mw.log("Season page title: ", season_title) | ||
local title = mw.title.makeTitle(0, season_title) | local title = mw.title.makeTitle(0, season_title) | ||
local content = title:getContent() | local content = title:getContent() | ||
if not content then | if not content then | ||
mw.log("Error: Content not found for the season page.") | mw.log("Error: Content not found for the season page.") | ||
return "Season page not found" | return "Season page not found" | ||
end | end | ||
mw.log("Page content loaded, length: ", string.len(content)) | |||
local rating_section = mw.ustring.match(content, "== Рейтинг ==.-{| class=\"wikitable sortable\"(.-)|}") | local rating_section = mw.ustring.match(content, "== Рейтинг ==.-{| class=\"wikitable sortable\"(.-)|}") | ||
Рядок 34: | Рядок 31: | ||
return "Rating section not found" | return "Rating section not found" | ||
end | end | ||
mw.log("Rating section extracted, length: ", string.len(rating_section)) | |||
local pattern = "|%s*%[%[" .. mw.ustring.gsub(player, "([%(%)%.%-%+])", "%%%1") .. "|[^%]]+%]%]%s*|%s*(%d+)%s*|" | local pattern = "|%s*%[%[" .. mw.ustring.gsub(player, "([%(%)%.%-%+])", "%%%1") .. "|[^%]]+%]%]%s*|%s*(%d+)%s*|" |