summaryrefslogtreecommitdiff
path: root/dive-into-wikipedia.sh
blob: 0f594bcf682b8a8daee2597a1bafcf892b0b3c52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash

if [ $# -eq 0 ]; then
  printf 'https://de.wikipedia.org/wiki/Evolution\n'
elif [ $# -eq 1 ]; then
  printf '%s\n' "$1"
  curl -x 'socks5://127.0.0.1:9050' -s "$1" \
    | sed '
      s/>/>\n/g
      s/</\n</g
    ' \
    | sed '
      s,^<a \(.* \)\?href="/wiki/\([^":#]\+\)"[ >].*,https://de.wikipedia.org/wiki/\2,
      t
      d
    ' \
    | grep -vxF ''
else
  parallel -n1 -j0 "$0" ::: "$@"
fi \
  | sort -u