blob: 47fb755f6c7f88d05071fb5220172480d5d0e6e0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#!/bin/sh
usage() {
echo "Usage: ${0} <xslt-stylesheet-file> [atom | html]"
exit 2
}
test $# -ne 2 && usage "$0"
echo "$1" | grep 'derstandard.at/international/asien/hongkong' -q && url='https://www.derstandard.at/international/asien/hongkong'
# TODO: Add option to aggregate older articles using e.g. https://www.derstandard.at/international/asien/hongkong/2020/1/1
out=$(curl -sL -b cookies "$url" |
xmllint --html --xpath '//main' /dev/stdin 2>/dev/null |
xsltproc "$1" /dev/stdin)
case "$2" in
atom)
printf "%s" "$out" | xmllint --format /dev/stdin \
>"$(dirname "$1")/feed.xml"
;;
html)
printf "%s" "$out" | xmllint --format --html /dev/stdin \
>"$(dirname "$1")/index.html"
;;
*)
usage "$0"
;;
esac
|