ZMA custom feed, close #51
This commit is contained in:
parent
d771003eea
commit
3c58102ad8
19
feedgen.sh
19
feedgen.sh
|
@ -26,12 +26,12 @@ if ! command -v json2xml >/dev/null 2>&1; then
|
|||
PATH="$DIR/bin:$PATH"
|
||||
fi
|
||||
|
||||
log Building IoM Ship Registry feed to $DIR/feeds/iom.xml
|
||||
curl -s https://www.iomshipregistry.com/forms-reports/casualty-reports/ \
|
||||
| pup '.rte + .accordion p json{}' \
|
||||
| jq -L $DIR/jq -f $DIR/jq/iom.jq \
|
||||
| json2xml > $DIR/feeds/iom.xml.new \
|
||||
&& mv $DIR/feeds/iom.xml.new $DIR/feeds/iom.xml
|
||||
log Building ZMA feed to $DIR/feeds/zma.xml
|
||||
curl -s https://www.zma.go.tz/zma_casuality.php \
|
||||
| pup '#content2 li a json{}' \
|
||||
| jq -L $DIR/jq -f $DIR/jq/zma.jq \
|
||||
| json2xml > $DIR/feeds/zma.xml.new \
|
||||
&& mv $DIR/feeds/zma.xml.new $DIR/feeds/zma.xml
|
||||
|
||||
exit
|
||||
|
||||
|
@ -253,3 +253,10 @@ curl -sk -H 'User-Agent: Mozilla/1.0' https://mwt.gov.na/web/mwt/published-repor
|
|||
| jq -L $DIR/jq -f $DIR/jq/daai.jq \
|
||||
| json2xml > $DIR/feeds/daai.xml.new \
|
||||
&& mv $DIR/feeds/daai.xml.new $DIR/feeds/daai.xml
|
||||
|
||||
log Building IoM Ship Registry feed to $DIR/feeds/iom.xml
|
||||
curl -s https://www.iomshipregistry.com/forms-reports/casualty-reports/ \
|
||||
| pup '.rte + .accordion p json{}' \
|
||||
| jq -L $DIR/jq -f $DIR/jq/iom.jq \
|
||||
| json2xml > $DIR/feeds/iom.xml.new \
|
||||
&& mv $DIR/feeds/iom.xml.new $DIR/feeds/iom.xml
|
||||
|
|
24
index.html
24
index.html
|
@ -896,6 +896,30 @@
|
|||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h3>Zanzibar Maritime Authority</h3>
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><strong>Country</strong></td>
|
||||
<td>Tanzania (Zanzibar)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Language</strong></td>
|
||||
<td>English</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Type</strong></td>
|
||||
<td>Marine</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Feed</strong></td>
|
||||
<td>
|
||||
<a href="feeds/zma.xml" target="_blank"><img src="img/rss.gif" alt="RSS" /></a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
# Zanzibar Maritime Authority feed generator
|
||||
# Expects pup JSON output holding <a> tags, outputs xmltodict-compatible JSON
|
||||
# WARNING: Dates are locale-sensitive; the RSS feed might not generate correctly with another locale.
|
||||
import "./helpers" as helpers;
|
||||
|
||||
{
|
||||
"rss": {
|
||||
"@version": "2.0",
|
||||
"channel": {
|
||||
"title": "ZMA investigation reports",
|
||||
"description": "Zanzibar Maritime Authority accident investigation reports",
|
||||
"link": "https://www.zma.go.tz/zma_casuality.php",
|
||||
"language": "en-tz",
|
||||
"pubDate": (now | strftime("%a, %d %b %Y %T %z")),
|
||||
"docs": "https://www.rssboard.org/rss-specification",
|
||||
"ttl": 1440,
|
||||
"generator": "ITSB",
|
||||
"item": [.[] | {
|
||||
"title": .text,
|
||||
"link": (.href | helpers::urlresolve("https://www.zma.go.tz/zma_casuality.php")),
|
||||
"guid": {
|
||||
"@isPermaLink": "true",
|
||||
"#text": (.href | helpers::urlresolve("https://www.zma.go.tz/zma_casuality.php"))
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue