AAC custom feed, closes #23
This commit is contained in:
parent
41a332976b
commit
5d6bcdc96c
18
itsb.xml
18
itsb.xml
|
@ -25,7 +25,7 @@
|
|||
<section name="official feeds" id="official-feeds">
|
||||
<content><![CDATA[<p>those feeds are provided by the agencies themselves.]]></content>
|
||||
|
||||
<source id="ntsb">
|
||||
<!--<source id="ntsb">
|
||||
<name>National Transport Safety Board</name>
|
||||
<region>United States</region>
|
||||
<type>Road, rail, aviation, marine, pipeline</type>
|
||||
|
@ -1172,6 +1172,22 @@
|
|||
<json2xml />
|
||||
<output>aaia/zh-hant.xml</output>
|
||||
</feed>
|
||||
</source>-->
|
||||
|
||||
<source id="aac">
|
||||
<name>Autoridad de Aviación Civil</name>
|
||||
<region>El Salvador</region>
|
||||
<type>Aviation</type>
|
||||
<frequency>0-2 reports/year</frequency>
|
||||
<feed type="aviation" lang="Spanish" format="rss" id="aac-rss">
|
||||
<curl>
|
||||
<url>https://www.aac.gob.sv/?page_id=1006</url>
|
||||
</curl>
|
||||
<pup>tr:not(:first-child)</pup>
|
||||
<jq path="aac.jq" />
|
||||
<json2xml />
|
||||
<output>aac.xml</output>
|
||||
</feed>
|
||||
</source>
|
||||
</section>
|
||||
</itsb>
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
# AAC feed generator
|
||||
# Expects pup JSON output holding <tr> tags, outputs xmltodict-compatible JSON
|
||||
# WARNING: Dates are locale-sensitive; the RSS feed might not generate correctly with another locale.
|
||||
|
||||
{
|
||||
"rss": {
|
||||
"@version": "2.0",
|
||||
"channel": {
|
||||
"title": "AAC",
|
||||
"description": "El Salvador's Autordid de Aviación Civil",
|
||||
"link": "https://www.aac.gob.sv/?page_id=1006",
|
||||
"language": "es-SV",
|
||||
"pubDate": (now | strftime("%a, %d %b %Y %T %z")),
|
||||
"docs": "https://www.rssboard.org/rss-specification",
|
||||
"ttl": 1440,
|
||||
"generator": "ITSB",
|
||||
"item": [
|
||||
.[].children | {
|
||||
"title": .[0].children[0].text,
|
||||
"link": (
|
||||
# The links are held in onclick attributes which set location.href to a string,
|
||||
# so we extract the string.
|
||||
.[3].children[0].onclick
|
||||
| match("'(.*)'").captures[0].string
|
||||
# & is escaped as we were within an HTML attribute, so this restores it
|
||||
| sub("&"; "&")
|
||||
),
|
||||
"description": .[1].children[0].text,
|
||||
"pubDate": (.[2].text | strptime("%d/%m/%Y") | mktime | strftime("%a, %d %b %Y %T %z"))
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue