Parse RSS feeds with Lua

note, May 23, 2023, on Mitja Felicijan's blog

Example of parsing RSS feeds with Lua. Before running the script install:

local http = require("socket.http")
local feedparser = require("feedparser")

local feed_url = "https://mitjafelicijan.com/index.xml"

local response, status, _ = http.request(feed_url)
if status == 200 then
  local parsed = feedparser.parse(response)

  -- Print out feed details.
  print("> Title   ", parsed.feed.title)
  print("> Author  ", parsed.feed.author)
  print("> ID      ", parsed.feed.id)
  print("> Entries ", #parsed.entries)

  for _, item in ipairs(parsed.entries) do
    print("GUID    ", item.guid)
    print("Title   ", item.title)
    print("Link    ", item.link)
    print("Summary ", item.summary)
  end
else
  print("! Request failed. Status:", status)
end

Other notes

DateTitle
Uninstall Ollama from a Linux box
Display xterm color palette
Write ISO to USB Key
Personal sane Vim defaultsvim
Convert all MKV files into other formats
Online radio streaming with MPV from terminal
Install Plan9port on Linuxplan9
Compile drawterm on Fedora 38plan9
Embedding resources into binary with Cc
Sane default for Dungeon Crawl Stone Soup Online editiondcss
Male and female body proportion reference images3d
Cache busting in Hugo
Set color temperature of displays on i3
Currated list of Vim ALE linters
Making cgit look nicer