/[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

Annotation of /get_book.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations)
Sun Dec 14 19:11:30 2003 UTC (20 years, 3 months ago) by dpavlin
Branch: MAIN
Branch point for: foo
File MIME type: application/x-sh
Initial revision

1 dpavlin 1.1 #!/bin/sh
2    
3     #export http_proxy=http://proxy.pliva.hr:8080
4    
5     #isbn="0-201-41975-0"
6     isbn="0-672-32240-4"
7    
8     wait=10
9    
10     isbn2=`echo $isbn | sed 's/-//g'`
11    
12     function mirror() {
13     wget -p -nH -nc -k \
14     --random-wait --wait=$wait -t 0 \
15     --load-cookies=/home/dpavlin/.phoenix/default/g6b45nt6.slt/cookies.txt \
16     -U "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031206 Firebird/0.7" \
17     $1
18    
19     # -D safari.oreilly.com \
20     # -A 0-201-41975-0 \
21     }
22    
23     function geturl() {
24     hindent -s $1 | grep $2 | grep -i href | grep mode=[st][eo]c | \
25     sed -e 's/^.*<a.*href="//i' \
26     -e 's/".*//' -e 's/amp;//g' \
27     -e 's,^[^\?]*\?,http://safari.oreilly.com/,' \
28     -e 's/#$//' \
29     -e 's/srchText=//' | \
30     grep -v open=false | \
31     grep -v 'view=[A-Z].*%2F[^i]' | \
32     grep -v 'view=[A-Z].*/[^i]' | \
33     grep '&s=1&b=1&f=1&t=1&c=1&u=1&r=&o=1' | \
34     sort -u >> in
35     }
36    
37     echo > in
38     #mirror "http://safari.oreilly.com/?XmlId=$isbn"
39    
40     echo "extract URLs from first page..."
41     geturl "index.html?XmlId=$isbn" $isbn
42    
43     mirror "-i in"
44    
45     echo -n "extracting URLs [1]"
46     ls index.html* | while read file ; do
47     echo -n "."
48     geturl $file $isbn
49     done
50     echo
51    
52     sort -u in > in2
53    
54     mirror "-i in2"
55    
56     echo > in
57     echo -n "extracting URLs [2]"
58     ls index.html* | while read file ; do
59     echo -n "."
60     geturl $file $isbn
61     done
62    
63     sort -u in > in2
64    
65     mirror "-i in2"

  ViewVC Help
Powered by ViewVC 1.1.26