- if not fs.access(cachefile) or expire < now then
- rss = sys.httpget(url)
- if #rss == 0 then
- %>
- <%:Could not get rss data from%> <a href="<%=url%>"><%=url%></a>
- <%
- else
- local count = 0
- for item in string.gmatch(rss, "<item>(.-)</item>") do
- if count < max then
- local title = item:match("<title>(.-)</title>")
- local link = item:match("<link>(.-)</link>")
- local desc = item:match("<description>(.-)</description>") or ""
- if title and link then
- table.insert(output, { title = utl.pcdata(title), link = utl.pcdata(link) })
+ if not fs.access(cachefile) or expire < now then
+ rss = sys.httpget(url)
+ if #rss == 0 then
+ %>
+ <%:Could not get rss data from%> <a href="<%=url%>"><%=url%></a>
+ <%
+ else
+ local count = 0
+ for item in string.gmatch(rss, "<item>(.-)</item>") do
+ if count < max then
+ local title = item:match("<title>(.-)</title>")
+ local link = item:match("<link>(.-)</link>")
+ local desc = item:match("<description>(.-)</description>") or ""
+ if title and link then
+ table.insert(output, { title = utl.pcdata(title), link = utl.pcdata(link) })
+ end
+ count = count + 1