The little things give you away... A collection of various small helper stuff
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

29 lines
703 B

  1. #!/bin/bash
  2. if [[ $# -ne 1 || "$1" != http* ]]; then
  3. printf 'Usage: %q FRONT_PAGE_URL\n' "$0" >&2
  4. exit 1
  5. fi
  6. url="$1"
  7. if [[ "${url}" == *\?* ]]; then
  8. printf 'Error: URLs with query strings not supported\n' >&2
  9. exit 1
  10. fi
  11. url="${url%/*}"
  12. curl "${url}/TitleIndex" | \
  13. grep -A 1000000 -F 'href="/TitleIndex?allpages=1"' | \
  14. grep -B 1000000 -F 'id="pagebottom"' | \
  15. grep -Po 'href="\K[^"]+' | \
  16. grep -Fxv '/TitleIndex?allpages=1' | \
  17. sed 's,\?action=AttachFile$,,' | \
  18. perl -ne 'print if ! $a{$_}++' | \
  19. awk -v url="${url}" \
  20. '{
  21. print url $0;
  22. print url $0 "?action=info";
  23. print url $0 "?action=info&general=1";
  24. print url $0 "?action=raw";
  25. print url $0 "?action=AttachFile";
  26. }'