【Shell】模拟爬虫下载天龙八部小说

Shell脚本:

bash 复制代码
#curl https://tianlong.5000yan.com/ -o tianlong.html
grep "href=" tianlong.html | grep html | awk -F"\"" '{ print $6 }' >> urls.txt
grep "href=" tianlong.html | grep html | awk -F">" '{ print $3 }' | awk -F"<" '{ print $1 }' >>titles.txt

exec 3<urls.txt
exec 4<titles.txt

while read -u 3 url && read -u 4 title
do
	echo "$title : $url"
	curl "$url" -o "${title}.html"
done

exec 3<&-
exec 4<&-

下载后的文件:

下载后的效果:

相关推荐
程序员小崔日记2 小时前
20块钱注册一年 .COM 域名!Spaceship 最新优惠教程,支付宝即可付款(附优惠码)
服务器·腾讯云·域名
Better Bench3 小时前
WSL2 Ubuntu 中 Claude CLI “command not found” 故障排查与修复
linux·ubuntu·claude·wsl·claudecode
ShiXZ2133 小时前
Redis 常用指令全集:redis-cli 实战速查手册
数据库·redis·缓存
晓子文集3 小时前
Tushare接口文档:期货日线行情(fut_daily)
大数据·数据库·金融数据·量化投资·tushare
实心儿儿3 小时前
Linux —— 进程间关系和守护进程
linux·运维·服务器
WA内核拾荒者4 小时前
WhatsApp 账号异常检测的自动化告警系统设计
数据库·python·自动化
林浅不想努力4 小时前
LVS知识点总结
服务器·云原生·lvs
Dawn-bit5 小时前
Linux磁盘管理详解
linux·运维·服务器·计算机网络·云计算
RisunJan5 小时前
Linux命令-sftp(SSH 文件传输协议客户端)
linux·运维
龙仔7257 小时前
人大金仓OS_Core数据库自动备份实施笔记(银河麒麟Linux)
linux·数据库·笔记·备份·人大金仓