Guest User

Untitled

a guest
Jan 9th, 2025
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.78 KB | Source Code | 0 0
  1. #!/bin/sh
  2. umask 0027
  3. trap "killall wget; exit 1" INT
  4.  
  5. for URL in "$@"; do
  6.  
  7.     BOARD="$(expr "${URL}" : '.*2ch.hk/\+\([^/]\+\)/.*')"
  8.     THREAD="$(expr "${URL}" : '.*/\([^/]\+\).html')"
  9.     INCLUDE="/${BOARD}/src, /${BOARD}/thumb, /static/css"
  10.  
  11.     wget                        \
  12.     --no-host-directories               \
  13.     --recursive                 \
  14.     --include-directories="${INCLUDE}"      \
  15.     --page-requisites               \
  16.     --level="0"                 \
  17.     --convert-links                 \
  18.     --adjust-extension              \
  19.     --restrict-file-names="windows"         \
  20.     --timestamping                  \
  21.     --tries="0"                 \
  22.     --retry-connrefused             \
  23.     --retry-on-host-error               \
  24.     --waitretry="3600"              \
  25.     --random-wait                   \
  26.     --continue                  \
  27.     "${URL}" 2>>"wget-${BOARD}-${THREAD}.log"   &&
  28.     printf "[ OK ]\t%s\n" "${URL}"          ||
  29.     printf "[E%03i]\t%s\n" "$?" "${URL}"        &
  30.  
  31. done
  32. wait
  33. exit
  34.  
Add Comment
Please, Sign In to add comment