Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does wget ignore the query string in the URL?

I want to use wget to download the following 18 HTML files:

http://www.ted.com/talks/quick-list?sort=date&order=desc&page=18 http://www.ted.com/talks/quick-list?sort=date&order=desc&page=17 ... http://www.ted.com/talks/quick-list?sort=date&order=desc&page=1 

No matter what comes after page=, it always downloads the first page of the listing. Do I have to escape some characters in the URLs? How?

like image 257
Majid Fouladpour Avatar asked Oct 20 '14 20:10

Majid Fouladpour


People also ask

Does URL include query string?

A query string is a part of a uniform resource locator (URL) that assigns values to specified parameters.

What represent the query string in the URL?

On the Internet, a querystring (also called an HTTP querystring) is part of the set of characters automatically input in the address bar of a dynamic Web site when a user makes a request for information according to certain criteria.

Is URL query safe?

URLS and query parameters aren't secure. They should never contain sensitive or important information (passwords, static shared secrets, private information, etc). It is asking for trouble, something we here at FullContact have discovered first-hand.


2 Answers

& is a special character in most shell environments. You can use double quotes to quote the URL to pass the whole thing in as the parameter to wget:

wget "http://www.ted.com/talks/quick-list?sort=date&order=desc&page=18" 
like image 116
hrbrmstr Avatar answered Sep 18 '22 21:09

hrbrmstr


  1. Store your list of URLs in a file (each URL in a separate line!!):

    echo "http://www.ted.com/talks/quick-list?sort=date&order=desc&page=18 http://www.ted.com/talks/quick-list?sort=date&order=desc&page=17 ... " > wget_filelist.txt

  2. Call wget to retrieve the stuff:

    wget -i wget_filelist.txt

like image 43
Stefan Woehrer Avatar answered Sep 19 '22 21:09

Stefan Woehrer