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

下载后的文件:

下载后的效果:

相关推荐
_守一7 小时前
UE DS+Nakama进行游戏服务器开发(1)源码编译nakama
服务器·游戏
Joseph Cooper7 小时前
Linux HID 子系统实战:从虚拟键盘到 input 事件上报
linux·c语言·计算机外设
原来是猿7 小时前
【Socket编程预备知识】
linux·运维·服务器·网络
茉莉玫瑰花茶7 小时前
LangChain 核心组件 [ 2 ]
java·数据库·langchain
萧行之8 小时前
Docker部署Loki+Grafana+Vector实现全服务器日志监控(含N8N/SSH/Fail2ban监控)
服务器·docker·grafana
存在的五月雨8 小时前
Mysql 索引的一些
数据库·mysql
learning-striving8 小时前
Ubuntu26.04下载安装教程
运维·服务器·vmware·虚拟机
__beginner__8 小时前
CentOS 磁盘占用异常排查与处理手册(df 高、du/ncdu 低)
linux·运维·centos
黄俊懿8 小时前
MySQL主从复制:从“异步“到“GTID“,数据同步的进化之路
数据库·sql·mysql·oracle·架构·dba·db
看海的四叔9 小时前
【SQL】SQL-管好你的字符串
大数据·数据库·hive·sql·数据分析·字符串