WebTechKitchen; Your Web Technology Kitchen, contact us to create, or maintain your websites and other digital properties.

getting an rss feed in lua

Submitted by barnettech on Sat, 03/31/2018 - 00:54


--https://stackoverflow.com/questions/18222190/lua-parsing-xml-from-a-url?rq=1

f=io.popen("curl -s http://www.barnettech.com/rss.xml"); C=f:read"*a"; f:close()

function get(data,name)
return data:match("<"..name..">(.-)")
end

print(C)
-- assumes C contains the downloaded contents
print(get(C,"title"))
print(get(C,"pubDate"))