38 lines
1.7 KiB
Plaintext
38 lines
1.7 KiB
Plaintext
xquery version "3.0" encoding "utf-8";
|
|
(:
|
|
We use unparsed-text(url, encoding) instead of doc(url)
|
|
because xidel does not support changing the encoding dynamically
|
|
depending on the HTML content, so it would always use UTF-8
|
|
:)
|
|
x:parse-html(unparsed-text("https://www.nhc.noaa.gov/aboutrss.shtml", "iso-8859-1"))/
|
|
<opml version="2.0">
|
|
<head>
|
|
<title>National Hurricane Center and Central Pacific Hurricane Center 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>
|
|
{
|
|
(:
|
|
Each feed is listed as a link with an RSS icon inside it,
|
|
followed by a text node representing the feed name,
|
|
followed by another link with the URL as its text.
|
|
Start by picking the link with the image in it…
|
|
:)
|
|
for $feed in //a[ends-with(@href, ".xml")][./img]
|
|
(: Find the text node that follows the image to get the feed name :)
|
|
let $text := substring-before($feed/following-sibling::text()[1], ":")
|
|
return <outline
|
|
type="rss"
|
|
text="{$text}"
|
|
xmlUrl="{resolve-uri($feed/@href, 'https://www.nhc.noaa.gov/aboutrss.shtml')}"
|
|
language="{if (some $word in ('Español', 'Atlantico', 'Cartera') satisfies contains($text, $word)) then 'es' else 'en-us'}"
|
|
/>
|
|
(: The only way to determine the feed's language without fetching the feeds themselves is to look for Spanish keywords. :)
|
|
}
|
|
</body>
|
|
</opml>
|