- 论坛徽章:
- 0
|
#!/bin/sh
pages=${1:-5}
mycollect()
{
LC_ALL=C sed -n '/<a href=bbstcon\?board=LoveBridge\&reid=/{
s/>[^<]*</></g;s/<..>//g;
s/<a href=bbsqry\?userid=[^>]*>//g;
s/<[^>]*font[^>]*>//g; s/<[^>]*table>//g;
s/<a href=bbstopcon\?board=LoveBridge\&file=[^>]*>//g;
s/<a href=/http:\/\/bbs.sjtu.edu.cn\//g;
s/>/\
/g;
s/\n$//;
p;}' tmp.htm
}
theaddr='http://bbs.sjtu.edu.cn/bbstdoc?board=LoveBridge'
echo "Collecting the addresses..."
wget -q -O tmp.htm $theaddr
shu=$(LC_ALL=C sed -n '/>上一页<\/a> <a href=bbsnot\?board=LoveBridge>进板画面<\/a>/{s/^.*page=//;s/>.*$//;p;q;}' tmp.htm)
mycollect > myaddr.txt
thepage=0
while [ $thepage -lt $pages ]
do
wget -q "http://bbs.sjtu.edu.cn/bbstdoc?board=LoveBridge&page=$(($shu - $thepage))" -O tmp.htm
mycollect >> myaddr.txt
thepage=$(($thepage + 1))
done
lines=$( wc -l myaddr.txt | awk '{print $1}')
theline=1
true > index.htm
while [ $theline -le $lines ]
do
theimgaddr=$(sed -n ${theline}'{p;q;}' myaddr.txt)
echo "($theline of $lines) Analyzing "$theimgaddr
wget -q "$theimgaddr" -O tmp.htm
LC_ALL=C sed -n '/<IMG SRC/{s/="\//="http:\/\/bbs.sjtu.edu.cn\//g; s/^/<a href="'$(echo "$theimgaddr" | LC_ALL=C sed 's/\//\\\//g;s/\?/\\&/; s/\&/\\&/;')'">/; s/$/<\/a>/;p;}' tmp.htm >> index.htm
theline=$(($theline + 1))
done
sort -u -k 3,3 index.htm > tmp.htm
mv tmp.htm index.htm
echo "Analyses done."
echo
echo $(wc -l index.htm | awk '{print $1;}')" photoes with source links are collected in \"index.htm\". You can open it in your explorer and enjoy!"
|
index.htm |
|