How to download multiple urls using wget using a s

2020-02-16 06:58发布

问题:

I am using following command to download a single webpage with all its images and js using wget in win7:

wget -E -H -k -K -p -e robots=off -P /Downloads/ http://www.vodafone.de/privat/tarife/red-smartphone-tarife.html

It is downloading the html as required, but when I tried to pass on a text file having a list of 3 urls to download, it didn't give any output, below is the command I am using:

wget -E -H -k -K -p -e robots=off -P /Downloads/ -i ./list.txt -B 'http://'

I tried this also:

wget -E -H -k -K -p -e robots=off -P /Downloads/ -i ./list.txt

This text file had urls http:// prepended in it

list.txt contains list of 3 urls which I need to download using a single command. Please help me in resolving this issue.

回答1:

From man wget

2 Invoking
By default, Wget is very simple to invoke. The basic syntax is:
wget [option]... [URL]...

So, just use multiple URLs

wget URL1 URL2

Or using the links from comments

$ cat list.txt
http://www.vodafone.de/privat/tarife/red-smartphone-tarife.html
http://www.verizonwireless.com/smartphones-2.shtml
http://www.att.com/shop/wireless/devices/smartphones.html

and your command line

wget -E -H -k -K -p -e robots=off -P /Downloads/ -i ./list.txt

works as expected.



回答2:

First create a text file with the URLs that you need to download. eg: download.txt

download.txt will as below:

http://www.google.com
http://www.yahoo.com

then use the command wget -i download.txt to download the files. You can add many URLs to the text file.