2

I am trying to download files using curl and chrome extension called CurlWget. When I click on a file to download it, I get this message:

wget --header="Host: www.dummy-website.com" \
--header="User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.22 Safari/537.36" \
--header="Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" \
--header="Accept-Language: en-US,en;q=0.9,pt-BR;q=0.8,pt;q=0.7,es;q=0.6" \
--header="Cookie: __cfduid=ddc5012345678e5fdc667f697d151537674671; PHPSESSID=979erir1234562qt7mni713kj45; \
keyms=b6f4e893adcca61234562411aa17d0485025; uid=21580; pass=1234567f24f0e07eb43e32fda866d1e62cadf8" \
--header="Connection: keep-alive" "https://www.dummy-website.com/download.php?id=641304&name=21470-adfdecdf2d84bce9ca6d6239dd04a6cfa69d89a3" \
-O "dummy-file.zip" -c

How can I generate this command, directly from CLI? I was thinking about using aria2c in my scripts.

  • 1
    It sounds like you want to imitate a browser session, without manually starting the browser. See the answers on Automating web requests using curl? for some ways to go about it, but be warned that it's not trivial. – JigglyNaga Sep 26 '18 at 10:12
1

You are using exactly that text in the command line.

wget --header="Host: www.dummy-website.com" \
--header="User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.22 Safari/537.36" \
--header="Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" \
--header="Accept-Language: en-US,en;q=0.9,pt-BR;q=0.8,pt;q=0.7,es;q=0.6" \
--header="Cookie: __cfduid=ddc5012345678e5fdc667f697d151537674671; PHPSESSID=979erir1234562qt7mni713kj45; \
keyms=b6f4e893adcca61234562411aa17d0485025; uid=21580; pass=1234567f24f0e07eb43e32fda866d1e62cadf8" \
--header="Connection: keep-alive" "https://www.dummy-website.com/download.php?id=641304&name=21470-adfdecdf2d84bce9ca6d6239dd04a6cfa69d89a3" \
-O "dummy-file.zip" -c

You can either type it manually or you can copy the text and paste it into a terminal window. You can also paste the text into a file and execute that file.

0

Using selenium, you might call this addon feature from command line to your browser. It will be probably harder as you would think (you need to learn selenium, and then script it), so what you learn meanwhile, will be likely more important for you, as your actual goal.

Not the answer you're looking for? Browse other questions tagged or ask your own question.