9.2.1. wget
9.2.1.1. 常用
- 普通下載
wget http://example.com/file.iso - 指定保存文件名
wget ‐‐output-document=myname.iso http://example.com/file.iso - 保存到指定目錄
wget ‐‐directory-prefix=folder/subfolder http://example.com/file.iso - 大文件斷點(diǎn)續(xù)傳
wget ‐‐continue http://example.com/big.file.iso - 下載指定文件中的url列表
wget ‐‐input list-of-file-urls.txt - 下載指定數(shù)字列表的多個(gè)文件
wget http://example.com/images/{1..20}.jpg - 下載web頁面的所有資源
wget ‐‐page-requisites ‐‐span-hosts ‐‐convert-links ‐‐adjust-extension http://example.com/dir/file
9.2.1.2. 整站下載
- 下載所有鏈接的頁面和文件
wget ‐‐execute robots=off ‐‐recursive ‐‐no-parent ‐‐continue ‐‐no-clobber http://example.com/ - 下載指定后綴的文件
wget ‐‐level=1 ‐‐recursive ‐‐no-parent ‐‐accept mp3,MP3 http://example.com/mp3/ - 排除指定目錄下載
wget ‐‐recursive ‐‐no-clobber ‐‐no-parent ‐‐exclude-directories /forums,/support http://example.com
9.2.1.3. 指定參數(shù)
- user agent
‐‐user-agent="Mozilla/5.0 Firefox/4.0.1" - basic auth
‐‐http-user=user ‐‐http-password=pwd - 保存cookie
‐‐cookies=on ‐‐save-cookies cookies.txt ‐‐keep-session-cookies - 使用cookie
‐‐cookies=on ‐‐load-cookies cookies.txt ‐‐keep-session-cookies
9.2.2. curl
9.2.2.1. 常用
- 直接顯示
curl www.example.com - 保存指定的名字
-o newname - 不指定名字
-O
9.2.2.2. 正則
- 文件名
curl ftp://example.com/file[1-100].txt - 域名
curl http://site.{one,two,three}.com