Skip to content
Advertisement

How to use wget to access two websites, but sending output from the first website to `/dev/null`?

There is a website that allows for downloads, but it appears that I have to access the main site first, establish the cookie/session which is done by a mere visit, then download the file. In other words:

https://www.<somewebsite>.com/main/site

https://www.<somewebsite>.com/download

need to be visited in order. I can download by calling:

wget https://www.<somewebsite>.com/main/site https://www.<somewebsite>.com/download

but this requires me to manually remove downloads from the main site. Is there a way to pipe the output of the first site into /dev/null/ and only retain the download off the second? Thanks.

Advertisement

Answer

The webpage content you want to download, should re direct you to the first website you mentioned if the cookie is not available for your session. Ideally you don’t have to authenticate with cookie site and launch the to be downloaded URL. Use below parameters with wget to get authenticated on redirect.

wget –username=user –password=password “URL”

Let me know if this is not working

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement