From 8921e100fac29789c9321af5b57fa2b4cd0444ed Mon Sep 17 00:00:00 2001 From: lucidiot Date: Fri, 13 Oct 2023 22:22:25 +0200 Subject: [PATCH] Build OPML for Chicago Transit Authority feeds --- .gitignore | 1 + Makefile | 6 +++++- xquery/cta_opml.xqy | 28 ++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 xquery/cta_opml.xqy diff --git a/.gitignore b/.gitignore index 6641acd..e6e30c5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ opml/feeds.opml opml/nhc.opml +opml/cta.opml css/sprites.css img/sprites.png diff --git a/Makefile b/Makefile index a54660d..83286a3 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ .PHONY: all -all: css/sprites.css opml/feeds.opml opml/nhc.opml +all: css/sprites.css opml/feeds.opml opml/nhc.opml opml/cta.opml opml/feeds.opml: feed.xml xquery/feeds_opml.xqy xidel --silent feed.xml --extract-kind=xquery3 --extract-file=xquery/feeds_opml.xqy --output-format=xml > $@ @@ -9,6 +9,10 @@ opml/nhc.opml: bin/build_nhc_opml xquery/nhc_opml.xqy bin/build_nhc_opml > $@ chmod a+r $@ +opml/cta.opml: xquery/cta_opml.xqy + xidel --silent --extract-kind=xquery3 --extract-file=xquery/cta_opml.xqy --output-format=xml > $@ + chmod a+r $@ + sprites := $(wildcard img/sprites/*.png) img/sprites.png: $(sprites) diff --git a/xquery/cta_opml.xqy b/xquery/cta_opml.xqy new file mode 100644 index 0000000..9971796 --- /dev/null +++ b/xquery/cta_opml.xqy @@ -0,0 +1,28 @@ + + + Chicago Transit Authority RSS feeds + {format-dateTime(adjust-dateTime-to-timezone(current-dateTime(), xs:dayTimeDuration("PT0S")), "[FNn,*-3], [D01] [MNn,*-3] [Y0001] [H01]:[m01]:[s01] GMT")} + lucidiot + lucidiot@envs.net + https://tilde.town/~lucidiot/contact.html + http://dev.opml.org/spec2.html + + + { + (: Open the CTA RSS feeds page and grab the list items. :) + x:parse-html(x:request('https://www.transitchicago.com/rss/default.aspx')/raw)//ul[@class="rsslist"]/li + ! + { + (., ul/li) + ! + } + + } + +