gpt4 book ai didi

shell - 提取网页上所有图像列表的脚本(网页抓取代码)

转载 作者:行者123 更新时间:2023-12-01 02:32:43 25 4
gpt4 key购买 nike

我想要一个可以提取网页上所有图像列表(例如 *.jpg )的脚本,即以 .jpg 结尾的网址

使用此脚本,我将使用 > 将输出通过管道传输到文件然后将管道输出用作 wget 的输入.

这是否可以使用 shell 脚本。

(编辑:我正在使用 bash shell )

最佳答案

如何使用 lynx ?

lynx -image_links -dump www.google.com |
grep '\. https\?://.*\.\(gif\|jpg\|png\)$'

要稍微清理输出,您可以使用 cut :
lynx -image_links -dump www.google.com |
grep '\. https\?://.*\.\(gif\|jpg\|png\)$' |
cut -d . -f 2- |
cut -d ' ' -f 2-

关于shell - 提取网页上所有图像列表的脚本(网页抓取代码),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12125232/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com