【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<&-

下载后的文件:

下载后的效果:

相关推荐
AIgorithmGEEK6 小时前
MySQL 索引全解(下):建、查、删实战与知识速查表
数据库·mysql·b+树·索引
曦夜日长6 小时前
Git系统篇,Git本地使用(一):从“究极进化版“到三个区域的底层原理
大数据·linux·git·elasticsearch
mengchanmian7 小时前
VSFTP 服务器搭建(Centos)
运维·服务器·centos
shimly1234567 小时前
给断网无 sudo ubuntu22.04 机器安装 nodejs
linux
唠点键盘之外的8 小时前
26 向量数据库实战:从 0 搭一条能用的检索链路(pgvector + Spring AI)
数据库·人工智能·spring
云和恩墨8 小时前
数据库监控简史:监控不止于告警——从图表大爆发到健康管理闭环
数据库
别动我齐刘海8 小时前
Linux 系统调试学习1
linux·运维·服务器·c++·学习·机器学习·机器人
ly76898 小时前
MongoDB 事务开销实测:快照隔离下的写冲突、重试与分片事务边界
数据库·mongodb·事务·分片集群·快照隔离·写冲突
Lsetea9 小时前
OpenSSL报certificate chain too long:error 22与verify_depth深度排查
linux·https·ssl证书·openssl·证书链
豆角焖肉9 小时前
Spring AOP 自定义注解实现系统操作日志
数据库·自定义注解·springaop·操作日志·aop 切面