Module:DynamicYSWSList

Revision as of 08:49, 2 November 2026 by U080F22CTJN (talk | contribs) (does this work)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:DynamicYSWSList/doc

local p = {}

function p.fetchlist(frame)
    -- local args = frame:getParent().args
    local sourceUrl = "https://hackclub.com/api/v1/events/rss"
    local dataMap = "name=name, description=description, link=link, date=pubDate, page=[[name]]"

    local data = mw.ext.externalData.getExternalData{
        url = sourceUrl,
        format = 'xml',
        data = dataMap
    }

    if not data or #data == 0 then
        return '<span class="error">Error fetch failed</span>'
    end

    local output = {}
    table.insert(output, "=== All Hack Club Events ===")

    for i, row in ipairs(data) do
        local name = row.name or "Missingname"
        local description = row.description or "Missing desc"
        local link = row.link or "Missing link"
        local date = row.date or "Missing date"
    end
    
end

return p