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

下载后的文件:

下载后的效果:

相关推荐
StarsGreen2 小时前
Linux 网络配置命令参考
linux
隔窗听雨眠10 小时前
SQL执行计划固化的原理与稳定性工程
数据库·sql优化·执行计划
TDengine (老段)12 小时前
TDengine IDMP 功能点—数据接入
大数据·数据库·物联网·时序数据库·tdengine·涛思数据
索西引擎12 小时前
MySQL 进阶:视图、存储过程、存储函数与触发器
数据库·mysql
bksczm14 小时前
InnoDB 通用表空间与临时表空间详解
大数据·数据库·mysql
靠沿14 小时前
MySQL数据库进阶——存储过程和触发器
java·数据库·mysql
码少女15 小时前
MySQL--库与表的增删改查基础
java·数据库·mysql
Eyfcom15 小时前
〖物流 SaaS 实战 02〗SaaS 租户的计费与订阅模型:从“一锤子买卖”到“按需订阅”
linux·服务器·数据库·快递系统·物流saas实战
打工的小王16 小时前
postgresql和mysql对比
数据库·mysql·postgresql