简体   繁体   中英

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.

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

Don't know about wget , but you can do it with

curl https://website.com -o /dev/null https://website.com/downloads -o filename

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM