简体   繁体   中英

Using wget to download images from a webpage

I tried to download all the images from a given URL using wget. Below are some of the commands I had used.

wget -A.jpg [URL]
wget -A .jpg [URL]
wget -A *.jpg [URL]
wget -A .jpg [URL]
wget -nd -r -P /my/directory/ -A jpeg,jpg [URL]

Non of the above commands worked. So to make sure, i checked the file extensions of each images from the URL I specified and realized they are formatted as this:

URL/image.jpg?quality=85&strip=info&w=1200

How can i work around this issue where there are parameters at the end of a file extension from the URL i tried to retrieve from? Is there an option in wget that I am missing?

Thanks, any help will be appreciated.

You have to put an asterisk after jpg too, if you want to match those files that doesn't end with jpg .

Like:

wget -A *.jpg* [URL]

You can also use regex patterns with the --accept-regex argument if you want more complex filtering.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM