Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to collect the image address and download of the specified page in the Linux command line

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the knowledge about "how to collect the image address and image download of the specified page in the Linux command line". In the actual case operation process, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!

Get the picture address in the specified page: curl news.baidu.com| grep -Eio '(http| ftp| https)://[A-Za-z0-9_./]+ (.jpg|.png|.gif)'

The code is as follows:

http://news.baidu.com/iphone/img/loading_3.gif

http://h.hiphotos.baidu.com/news/pic/item/5d6034a85edf8db1cab9d24a0b23dd54564e740c.jpg

http://a.hiphotos.baidu.com/news/pic/item/a2cc7cd98d1001e9e447bd21ba0e7bec54e797a1.jpg

http://b.hiphotos.baidu.com/news/pic/item/2f738bd4b31c8701d4b01bc8257f9e2f0708ff9e.jpg

http://g.hiphotos.baidu.com/news/pic/item/2e2eb9389b504fc23d951e2be7dde71191ef6dd2.jpg

......

http://news.baidu.com/resource/img/tuiguang/news_ad_header_ipad.png

http://news.baidu.com/resource/img/tuiguang/news_home_ad_dialog_ipad_news.png

http://news.baidu.com/resource/img/tuiguang/news_home_ad_dialog_ipad_news.png

grep-E Use regular expressions

grep-i case-insensitive

grep-o Display only matching strings

Download the image file for the specified page:

The code is as follows:

curl -s news.baidu.com | grep -Eoi '(http|https|ftp)://[a-z0-9./_]* (jpg|png|gif)' | sort | uniq > url.txt && wget -q -nc -i url.txt

"Linux command line how to collect the specified page image address and image download" content is introduced here, thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report