Advertisement
hugol

Untitled

May 21st, 2014
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.96 KB | None | 0 0
  1. pomoc()
  2. {
  3.     echo "Skrypt chodzacy po stronach www, i pobierajacy je."
  4.    
  5. }
  6.  
  7.  
  8. pobierz()
  9. {
  10.     echo "Pobieranie strony $STRONA"
  11.     echo $STRONA >> pobrane.txt
  12.     STRCPY=$(echo $STRONA | sed -e 's/http:\/\/www.//' | sed -e 's/http:\/\///' | awk -F\/ '{ for(i=1;i<=NF;i++){print $i}; }')
  13.     LOC="pobierane"
  14.     while ! test "$STRCPY" == "$TEST" ; do
  15.         DOMENA=$(echo $STRCPY | awk '{print $1}')
  16.         echo $DOMENA
  17.         if test ! -d $LOC ; then
  18.             mkdir $LOC
  19.             echo "Stworzono $LOC"
  20.         fi
  21.         LOC=$(echo $LOC/$DOMENA)
  22.         TEST=$(echo $STRCPY | awk '{print $NF}')
  23.         STRCPY=$(echo $STRCPY | awk '{ for(i=2;i<=NF;i++){print $i}; }')
  24.     done
  25.     echo $STRCPY
  26.     echo $LOC
  27.     wget -qO- $STRONA > strona.html
  28.         cat strona.html | grep -o '<a href=['"'"'"][^"'"'"']*['"'"'"]' | \
  29.         sed -e 's/^<a href=["'"'"']//' -e 's/["'"'"']$//' | grep http  > links.txt
  30.    
  31. }
  32.  
  33. if test $# -eq 1 ; then
  34.     if test ! -d "pobierane" ; then
  35.         mkdir pobierane
  36.     fi
  37.     STRONA=$1
  38.     pobierz
  39. else
  40.     pomoc
  41. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement