/[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.3 by dpavlin, Mon Dec 15 00:26:57 2003 UTC revision 1.4 by dpavlin, Mon Dec 15 09:33:29 2003 UTC
# Line 1  Line 1 
1  #!/bin/sh  #!/bin/sh
2    
3  #export http_proxy=http://proxy:8080  export http_proxy=http://proxy:8080
4    
5  if [ -z "$1" ] ; then  if [ -z "$1" ] ; then
6          echo "Usage: $0 ISBN"          echo "Usage: $0 ISBN"
# Line 43  function uniqurl() { Line 43  function uniqurl() {
43          grep 'view=[A-Z].*/index' in.tmp | sort -u >> in          grep 'view=[A-Z].*/index' in.tmp | sort -u >> in
44  }  }
45    
46  function checklogin() {  function mirror_in() {
47          if grep 'promo.asp' index.html* >/dev/null ; then          cat in | while read url ; do
48                  echo "WARNING: safari seems to logunt you as user. Aborting."                  mirror "$url"
49                  exit 1  
50          fi                  if grep 'promo.asp' `ls -t index.html* | head -3` >/dev/null ; then
51                            echo "WARNING: safari seems to logunt you as user. Aborting."
52                            exit 1
53                    fi
54            done
55  }  }
56    
57  echo > in  echo -n > in
58  mirror "http://safari.oreilly.com/?XmlId=$isbn"  mirror "http://safari.oreilly.com/?XmlId=$isbn"
59    
60  echo "extract URLs from first page..."  echo "extract URLs from first page..."
61  geturl "index.html?XmlId=$isbn" $isbn  geturl "index.html?XmlId=$isbn" $isbn
62  uniqurl  uniqurl
63    
64  mirror "-i in"  mirror_in
 checklogin  
65    
66  echo -n "extracting URLs [1]"  echo -n "extracting URLs [1]"
67  ls index.html* | while read file ; do  ls index.html* | while read file ; do
# Line 69  echo Line 72  echo
72    
73  uniqurl  uniqurl
74    
75  mirror "-i in"  mirror_in
 checklogin  
76    
77  echo > in  echo -n > in
78  echo -n "extracting URLs [2]"  echo -n "extracting URLs [2]"
79  ls index.html* | while read file ; do  ls index.html* | while read file ; do
80          echo -n "."          echo -n "."
# Line 81  done Line 83  done
83    
84  uniqurl  uniqurl
85    
86  mirror "-i in"  mirror_in
 checklogin  
87    
88  # convert links in html  # convert links in html
89  bn=`basename $0`  bn=`basename $0`

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

  ViewVC Help
Powered by ViewVC 1.1.26