postnl.sh - randomcrap - random crap programs of varying quality
(HTM) git clone git://git.codemadness.org/randomcrap
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
postnl.sh (795B)
---
1 #!/bin/sh
2 # The PostNL track & trace page requires non-free javascript code
3 # and IndexedDB support.
4 # This script calls their JSON "API".
5 #
6 # NOTE: this script may break at any point if the web hipsters decide to
7 # change it.
8 #
9 # normie page:
10 # http://www.postnlpakketten.nl/klantenservice/tracktrace/basicsearch.aspx?lang=nl&B=tracecode&P=zipcode
11
12 usage() {
13 echo "$0 <tracecode> <zipcode> [country]" >&2
14 exit 1
15 }
16
17 tracecode="$1"
18 zipcode="$2"
19 country="NL"
20 lang="nl" # ... or en
21
22 test x"${tracecode}" = x"" && usage "$0"
23 test x"${zipcode}" = x"" && usage "$0"
24 test x"${country}" = x"" && usage "$0"
25
26 url="https://jouw.postnl.nl/track-and-trace/api/trackAndTrace/${tracecode}-${country}-${zipcode}?language=${lang}"
27
28 curl \
29 -m 10 \
30 -f \
31 -s \
32 -L --max-redirs 0 \
33 -H 'User-Agent:' \
34 "$url"