Why wget ignores query string in the url?

删除回忆录丶 提交于 2019-12-28 06:28:00

问题


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?


回答1:


& 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"



回答2:


  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



来源:https://stackoverflow.com/questions/26474482/why-wget-ignores-query-string-in-the-url

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!