crawl_d3 516 B

123456789101112131415161718192021222324252627282930
  1. #!/usr/bin/bash
  2. # test for searchpattern as argument to script
  3. if [[ $# != 1 ]]; then
  4. printf "\n\twrong usage, add searchpattern for recipe\n\n"
  5. exit 1
  6. fi
  7. # function for lynx
  8. glynx() {
  9. lynx -dump -listonly "$1" | \
  10. grep recipes | \
  11. grep -v 'lang\|redirect\|order\|recipes$'
  12. }
  13. #variables with
  14. url=https://notabug.org/dragora/dragora/src/master/recipes
  15. rp="$1" # recipe pattern
  16. mapfile -t v < <(glynx "$url")
  17. # main stuff
  18. for i in "${v[@]}"; do
  19. i=${i#*. }
  20. glynx "$i" | grep "$rp"
  21. done