rsrsss/xquery/opml/enviroflash.xqy

61 lines
2.4 KiB
Plaintext

doc("https://feeds.enviroflash.info/")//*[contains(@class, "formrow")]//tr/
<opml version="2.0">
<head>
<title>EnviroFlash RSS feeds</title>
<dateModified>{format-dateTime(adjust-dateTime-to-timezone(current-dateTime(), xs:dayTimeDuration("PT0S")), "[FNn,*-3], [D01] [MNn,*-3] [Y0001] [H01]:[m01]:[s01] GMT")}</dateModified>
<ownerName>lucidiot</ownerName>
<ownerEmail>lucidiot@envs.net</ownerEmail>
<ownerId>https://tilde.town/~lucidiot/contact.html</ownerId>
<docs>http://dev.opml.org/spec2.html</docs>
</head>
<body>
{
.//a[ends-with(@href, ".xml")]
! <outline
type="rss"
version="Atom"
text="{text()}"
xmlUrl="{resolve-uri(@href)}"
language="en-us"
/>
}
{
for $stateCode in .//option/@value[.!="0"]
return x:parse-html(pxp:json(x:request(x:form(
<form action="https://feeds.enviroflash.info/ajax/feed_ajax.cfm" method="post">
<input name="method" value="getForecastCities" />
<input name="sStateId" value="{$stateCode}" />
</form>
))/raw)/cityBody) ! (
(: Ignore states where there are no feeds listed at all :)
if (exists(//tr[td[not(@colspan)][@id='name']])) then
<outline text="{$stateCode}">
{
//tr[td[not(@colspan)][@id='name']]
! <outline text="{td[@id='name']/text()}">
{
.//a[ends-with(@href, ".xml")]
! (
(: CAP feeds are not exactly feeds, since they only contain one alert at once and are not supported by feedreaders :)
if (starts-with(@href, "cap/")) then
<outline type="link" text="CAP feed" url="(resolve-uri(@href, 'https://feeds.enviroflash.info/'))" />
else
<outline
type="rss"
version="{upper-case(substring-before(@href, '/'))}"
text="{substring-after(./img/(@alt,@title)[1], 'View ')}"
xmlUrl="{resolve-uri(@href, 'https://feeds.enviroflash.info/')}"
language="en-us"
/>
)
}
</outline>
}
</outline>
else ()
)
}
</body>
</opml>