Download the content of a website using wget

On Linux, there is a very practical utility which allows you to retrieve files online: wget.

Ludovic Pecate
2 min readOct 25, 2024

** French version: Aspirer un site Internet avec wget **

Executable as a command line, wget allows you when you give it some specifics arguments to get the content of a given website.

Generative image (DALL·E 3)

Download a webpage

To download a website and its internal links (only from the same domain) and without getting parents pages, you can simply use the following command inside a console:

wget -r -k -np http://www.example.com

We have different arguments:

  • -r : recursive download (wget will follow the links it found in the webpage)
  • -k : change the links paths to allow the website to be viewed locally
  • -np : do not download parent webpages

Source : Ubuntu-fr

Download from a list of URL

It is possible to specify inside a file a list of URL you want wget to downlad:

wget -i fichier.txt

The file must contains one URL by line.

In order to keep the tree structure, we can add -x argument:

wget -x -i fichier.txt

On Windows

On Windows, it is possible, if you are using Git Bash, to download wget as an extension:

Originally published at https://www.sliceo.com.

--

--

Ludovic Pecate
Ludovic Pecate

Written by Ludovic Pecate

French Web Developer during the day… and the night sometimes.

No responses yet