Module:Bluesky RSS Feed

From NOISZ Wiki
Revision as of 15:58, 10 December 2025 by RiceEmpress (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This module is a custom-designed RSS feed, designed to process a Bluesky RSS feed and output it as a template. Up to three search keywords can be input - OR rather than AND - to find posts that mention any of the keywords. A Bluesky RSS feed can be found by going to any user's page, and typing /rss at the end of the URL before hitting enter.

Usage

{{Template:Bluesky RSS Feed
|url= Bluesky RSS feed URL
|term1= Optional search term
|term2= Optional search term
|term3= Optional search term
}}

Example

{{Template:Bluesky RSS Feed
|url=https://bsky.app/profile/did:plc:ve2p3lz33ivtyikqztvsgtx3/rss
|term1=#NOISZ
}}

Will yield:

11 Feb 2026 04:49 +0000
NOISZ SL 4.004 is now available! This version makes some additional fixes and adjustments. (Unless regressions occur, this is likely to be the last version until the next content update.) #NOISZ_SL

10 Feb 2026 14:29 +0000
NOISZ SL 4.003 is now available! This version fixes some additional issues with finale content and a bug with uncleared Recursive events. #NOISZ_SL

06 Feb 2026 20:27 +0000
forgot about bandcamp friday again so we didn't prepare a coupon... instead we're just gonna release this album right now. you should probably play the finale first #NOISZ_SL https://anarchgames.bandcamp.com/album/with-my-last-breath

06 Feb 2026 19:11 +0000
NOISZ SL 4.002 is now available on iOS and Android! This version fixes an issue with chapter 1.1, as well as some issues and enhancements on the finale content. #NOISZ_SL

02 Feb 2026 05:01 +0000
Fate led all of us to meet, to stand together at this very moment. After all these years, the journey comes to an end.

NOISZ STΔRLIVHT version 4.0: on the 4th anniversary, the finale of the NOISZ series arrives in Chapter 6.5(?)

  1. NOISZ #NOISZ_SL



22 Jan 2026 06:25 +0000
☀️ Happy birthday to Hikari of SUNRaiSE! The blue sky heralds a new day filled with delicious treats and fun surprises! Here's to a dazzling next page! ☀️

🎨 @paichivt.bsky.social #NOISZ_SL




local capiunto = require 'capiunto'
local p = {}

function p.main(frame)

local args = frame:getParent().args
local posts = {}
local links = {}
local searchTerms = {}
local itemBefore= {}
local itemTwoBefore = {}
itemBefore["pubDate"] = ""

-- These are the search terms as defined in the template.
if args.term1 or args.term2 or args.term3 then
	searchTerms[1] = args.term1
	searchTerms[2] = args.term2
	searchTerms[3] = args.term3
-- If no search terms, then the search terms array is left blank so it'll match everything.
else 
	searchTerms = {""}
end

-- We use externaldata.getWebDate to obtain XML format data from the RSS feed at the URL defined by the user.
local rss = mw.ext.externaldata.getWebData {
    url = args.url
  , data = {pubDate = 'pubDate', description = 'description', link= 'link'}
  , format = 'xml'
}

-- We iterate over every post found in the RSS feed, in chronological order - hence ipairs. We need description, publish date AND link to know that it's a post. Additionally, k has to be more than 1 as the very first post to pop up in an RSS feed is the user bio which is not an actual post. The "links" array is a directory of links that have been processed; if it's already been processed, then it won't be added again. This helps for if there's more than one search term.


for k, v in ipairs(rss) do
	if v["description"] and v["pubDate"] and v["link"] then

-- Search over every search term in the search terms to make sure a post contains that term. If so, we bundle up the information into template form via the frame:expandTemplate method - the "Bluesky RSS Feed Row" template, to be precise - and put it into an incremental array which will later be expanded in full.

		for a, b in pairs(searchTerms) do
			if string.find(v["description"],b) and links[v["link"]] ~= true then 
-- Here we assign a new key to the links table, so that it can be accessed directly by the above conditions. The key is the post link, which is the one accessible unique attribute of each post.
				if k==1 then
					itemBefore["pubDate"] = v["pubDate"]
				end
				links[v["link"]] = true
				table.insert(posts, frame:expandTemplate{title = 'Bluesky RSS Feed Row', args = {description = v["description"], pubDate = v["pubDate"], link=v["link"]}})
				
			end	
		end
-- Bluesky's RSS feed is a little fucky; the first item in the table of items is just the bio, which has no published date, which means publish date for posts get thrown one out of order. So, I set the publish date in the table to be set here to be used in the next loop, to realign the dates. EDIT: Now it's two out of order fuck my entire baka life
		itemTwoBefore["pubDate"] = itemBefore["pubDate"]
		itemTwoBefore["link"] = itemBefore["link"]
		itemTwoBefore["description"] = itemBefore["description"]
		itemBefore["pubDate"] = v["pubDate"]
		itemBefore["link"] = v["link"]
		itemBefore["description"] = v["description"]
	end
end

-- table.concat to convert it from Lua table form to a form the wikitext can use - hence why it was frame:expand and not just raw data being put in.

return table.concat(posts,"")

end

return p