/[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.8 by dpavlin, Tue Feb 17 19:06:10 2004 UTC revision 1.9 by dpavlin, Wed Jun 2 16:14:53 2004 UTC
# Line 3  Line 3 
3  # proxy settings (same as in firebird)  # proxy settings (same as in firebird)
4  fping proxy && export http_proxy=http://proxy:8080  fping proxy && export http_proxy=http://proxy:8080
5  # user agent (same as in firebird)  # user agent (same as in firebird)
6  ua="Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031225 Firebird/0.7"  ua="Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040506 Firefox/0.8"
7    cookie_file="cookie.txt"
8    
9  # wait between pages  # wait between pages
10  export wait=120  export wait=120
# Line 27  if [ -e orig ] ; then Line 28  if [ -e orig ] ; then
28          grep -l 'This is only a preview of the full book' * | xargs -i rm {}          grep -l 'This is only a preview of the full book' * | xargs -i rm {}
29  fi  fi
30    
31  isbn=$1;  isbn=`echo $1 | sed 's/-//g'`
   
 isbn2=`echo $isbn | sed 's/-//g'`  
32    
33  function mirror() {  function mirror() {
34    
# Line 42  function mirror() { Line 41  function mirror() {
41                  return                  return
42          fi          fi
43    
44            cookie=""
45          if echo $url | grep '/index' >/dev/null ; then          if echo $url | grep '/index' >/dev/null ; then
                 cookies=""  
46                  echo -n "no login (index) "                  echo -n "no login (index) "
47          elif echo $url | grep 'mode=toc' >/dev/null ; then          elif echo $url | grep 'mode=toc' >/dev/null ; then
                 cookies=""  
48                  echo -n "no login (toc) "                  echo -n "no login (toc) "
49          else          else
50                  cookies="--load-cookies=/home/dpavlin/.phoenix/default/g6b45nt6.slt/cookies.txt"                  if [ ! -e $cookie_file ] ; then
51                  echo -n "with login "                          echo "cookies file $cookie_file doesn't exits! Please create it."
52                            echo "It should be in format:"
53                            echo "Cookie: Site=UICode=&Portal=oreilly&GUID=..."
54                            exit 1
55                    fi
56                    read cookie < $cookie_file
57                    if [ -z "$cookie" ] ; then
58                            echo "Empty cookie file $cookie_file !"
59                            exit 1
60                    fi
61          fi          fi
         echo $url  
62    
63          wget -p -nH -nc -k \          if [ -z "$cookie" ] ; then
64                  -t 1 -U "$ua" \                  echo "$url [no cookie]"
65                  $cookies $url          else
66                    echo "$url [with cookie]"
67            fi
68    
69  #       -D safari.oreilly.com \          wget -q -p -nH -nc -k -t 1 -U "$ua" --cookies=off --header="$cookie" $url
 #       -A 0-201-41975-0 \  
70    
71          perl -e '$t=rand($ENV{wait} || 30);print "sleep for $t sec.\n"; sleep($t);'          perl -e '$t=rand($ENV{wait} || 30);print "sleep for $t sec.\n"; sleep($t);'
72  }  }

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

  ViewVC Help
Powered by ViewVC 1.1.26