/[safari]/get_book.sh
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /get_book.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by dpavlin, Sun Feb 15 11:40:43 2004 UTC revision 1.8 by dpavlin, Tue Feb 17 19:06:10 2004 UTC
# Line 38  function mirror() { Line 38  function mirror() {
38          file=`echo $url | sed -e s,http://[^?]*?,index.html?, -e s,#.*$,, -e s,/,%2F,g`          file=`echo $url | sed -e s,http://[^?]*?,index.html?, -e s,#.*$,, -e s,/,%2F,g`
39          if [ -e "$file" ] ; then          if [ -e "$file" ] ; then
40  #               echo "skip $url"  #               echo "skip $url"
41                    echo -n "."
42                  return                  return
43          fi          fi
44    
# Line 68  function geturl() { Line 69  function geturl() {
69          sed -e 's/^.*<a.*href="//i' \          sed -e 's/^.*<a.*href="//i' \
70                  -e 's/".*//' -e 's/amp;//g' \                  -e 's/".*//' -e 's/amp;//g' \
71                  -e 's,^[^\?]*\?,http://safari.oreilly.com/,' \                  -e 's,^[^\?]*\?,http://safari.oreilly.com/,' \
72                  -e 's/#$//' \                  -e 's/#.*$//' \
73                  -e 's/\&srchText=//' \                  -e 's/\&srchText=//' \
74                  -e 's/open=false/open=true/' | \                  -e 's/open=false/open=true/' | \
75                  grep '&s=1&b=1&f=1&t=1&c=1&u=1&r=&o=1' | \                  grep '&s=1&b=1&f=1&t=1&c=1&u=1&r=&o=1' | \
# Line 81  function uniqurl() { Line 82  function uniqurl() {
82          mv in in.tmp          mv in in.tmp
83          grep -v 'view=[A-Z]' in.tmp | sort -u > in          grep -v 'view=[A-Z]' in.tmp | sort -u > in
84          grep 'view=[A-Z].*/index' in.tmp | sort -u >> in          grep 'view=[A-Z].*/index' in.tmp | sort -u >> in
85            links=`wc -l in | cut -d" " -f1`
86            echo "found $links unique links"
87  }  }
88    
89  function mirror_in() {  function mirror_in() {
# Line 108  function mirror_in() { Line 111  function mirror_in() {
111                          exit 1                          exit 1
112                  fi                  fi
113          done          done
114            echo
115  }  }
116    
117  echo -n > in  echo -n > in
118  mirror "http://safari.oreilly.com/?XmlId=$isbn"  mirror "http://safari.oreilly.com/?XmlId=$isbn"
119    echo
120    
121  echo "extract URLs from first page..."  echo "extract URLs from first page..."
122  geturl "index.html?XmlId=$isbn" $isbn  geturl "index.html?XmlId=$isbn" $isbn

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

  ViewVC Help
Powered by ViewVC 1.1.26