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

下载后的文件:

下载后的效果:

相关推荐
数据库技术讲堂几秒前
从 GitOps 到数据库变更:NineData 如何打通 CI/CD 的数据库治理链路
java·数据库·ci/cd
Wang's Blog12 分钟前
PostgreSQL笔记33: 索引底层原理、扫描类型与属性体系深度解析
数据库·笔记·postgresql
地衣君13 分钟前
从 profile 到 kanban:Hermes 多 Agent 协作解析及示例
网络·数据库·tcp/ip
秋田君16 分钟前
【无标题】
数据库·oracle
Logintern0917 分钟前
数据库分区表的索引实际上包含本地索引和全局索引两种类型
数据库·分区索引
阿沐沐,23 分钟前
PowerShell 里改了 config.toml,Codex CLI 仍用旧值:先分清该改哪一层
java·服务器·数据库·人工智能·ai·ai编程
秣宇24 分钟前
银河麒麟服务器操作系统关闭 Swap 分区
linux·运维·服务器·github·kylin
RisunJan25 分钟前
Linux命令-usernetctl(已废弃 - 通过 usermode-helper 控制网络接口的包装器)
linux·运维·服务器
码农爱学习1 小时前
ClaudeCode搭配DeepSeek在Windows和Linux中的安装教程
linux·运维·windows
阿昭L1 小时前
Linux文件IO
linux