Why does wget only download the index.html for some websites?

后端 未结 8 933
陌清茗
陌清茗 2020-12-12 13:29

I\'m trying to use wget command:

wget -p http://www.example.com 

to fetch all the files on the main page. For some websites it works but i

8条回答
  •  鱼传尺愫
    2020-12-12 14:13

    The link you have provided is the homepage or /index.html, Therefore it's clear that you are getting only a index.html page. For an actual download, for example, for "test.zip" file, you need to add the exact file name at the end. For example use the following link to download test.zip file:

    wget -p domainname.com/test.zip

    Download a Full Website Using wget --mirror

    Following is the command line which you want to execute when you want to download a full website and made available for local viewing.

    wget --mirror -p --convert-links -P ./LOCAL-DIR http://www.example.com

    • –mirror: turn on options suitable for mirroring.

    • -p: download all files that are necessary to properly display a given HTML page.

    • –convert-links: after the download, convert the links in document for local viewing.

    • -P ./LOCAL-DIR: save all the files and directories to the specified directory

    Download Only Certain File Types Using wget -r -A

    You can use this under following situations:

    • Download all images from a website,

    • Download all videos from a website,

    • Download all PDF files from a website

    wget -r -A.pdf http://example.com/test.pdf

提交回复
热议问题