Модуль:FetchData: відмінності між версіями

нема опису редагування
Немає опису редагування
Мітка: Ручний відкіт
Немає опису редагування
Рядок 22: Рядок 22:
     end
     end


    -- Purge the cache for the page to ensure fresh content
     local title = mw.title.makeTitle(0, season_title)
     local title = mw.title.makeTitle(0, season_title)
    title:purge()
     local content = title:getContent()
     local content = title:getContent()


Рядок 33: Рядок 36:
     mw.log("Page content preview: ", mw.ustring.sub(content, 1, 500))
     mw.log("Page content preview: ", mw.ustring.sub(content, 1, 500))


     local rating_section = mw.ustring.match(content, "== Рейтинг ==.-{| class=\"wikitable sortable\"(.-)|}")
    -- Attempt to extract the "Рейтинг" section
     local rating_section = mw.ustring.match(content, "==%s*Рейтинг%s*==.-{|%s*class%s*=%s*\"wikitable sortable\"(.-)|}")
     if not rating_section then
     if not rating_section then
         mw.log("Error: Rating section not found within the page content.")
         mw.log("Error: Rating section not found within the page content.")
         mw.log("Page content: ", content)
         mw.log("Page content: ", mw.ustring.sub(content, 1, 1000)) -- Log more content for better debugging
         return "Rating section not found"
         return "Rating section not found"
     end
     end