Firefox Download from Command Line












2














I want to download content from a site. Originally, I used curl/wget, however, the page demanded a session cookie + had multiple redirects. The page administrator then told me to use Firefox to download the content. This is of course pretty difficult because I want to call the download from a script.



I figured out that



firefox https://url.to.page.com/download_content


works and the download file dialog appears. So I am almost there. Of course, as I want to call the download from a script I don't want to press the "ok" button but download it instantly. Are there any additional command line settings to surpress the download file dialog in firefox and download the file immediately?










share|improve this question






















  • There aren't any additional flags you could set for automatic downloads, but you could try automating with a different browser (e.g., Chromium) or have xdotool press the Save button for you.
    – dsstorefile1
    May 6 '18 at 14:41






  • 1




    Thanks for your suggestion, however, using additional programmes is not possible...
    – Syd Amerikaner
    May 6 '18 at 14:45










  • Does Using curl with cookies help?
    – Andrew Morton
    May 6 '18 at 15:00










  • No, it does not work. The webpage adminstrator I contacted also sounded as it was very difficult to realize it with curl/wget and he recommended to do it with Firefox.
    – Syd Amerikaner
    May 6 '18 at 15:07










  • So you don't have to log into an account to download the file? Then curl might indeed work. Or maybe a python script.
    – SpiderPig
    May 6 '18 at 15:31
















2














I want to download content from a site. Originally, I used curl/wget, however, the page demanded a session cookie + had multiple redirects. The page administrator then told me to use Firefox to download the content. This is of course pretty difficult because I want to call the download from a script.



I figured out that



firefox https://url.to.page.com/download_content


works and the download file dialog appears. So I am almost there. Of course, as I want to call the download from a script I don't want to press the "ok" button but download it instantly. Are there any additional command line settings to surpress the download file dialog in firefox and download the file immediately?










share|improve this question






















  • There aren't any additional flags you could set for automatic downloads, but you could try automating with a different browser (e.g., Chromium) or have xdotool press the Save button for you.
    – dsstorefile1
    May 6 '18 at 14:41






  • 1




    Thanks for your suggestion, however, using additional programmes is not possible...
    – Syd Amerikaner
    May 6 '18 at 14:45










  • Does Using curl with cookies help?
    – Andrew Morton
    May 6 '18 at 15:00










  • No, it does not work. The webpage adminstrator I contacted also sounded as it was very difficult to realize it with curl/wget and he recommended to do it with Firefox.
    – Syd Amerikaner
    May 6 '18 at 15:07










  • So you don't have to log into an account to download the file? Then curl might indeed work. Or maybe a python script.
    – SpiderPig
    May 6 '18 at 15:31














2












2








2


1





I want to download content from a site. Originally, I used curl/wget, however, the page demanded a session cookie + had multiple redirects. The page administrator then told me to use Firefox to download the content. This is of course pretty difficult because I want to call the download from a script.



I figured out that



firefox https://url.to.page.com/download_content


works and the download file dialog appears. So I am almost there. Of course, as I want to call the download from a script I don't want to press the "ok" button but download it instantly. Are there any additional command line settings to surpress the download file dialog in firefox and download the file immediately?










share|improve this question













I want to download content from a site. Originally, I used curl/wget, however, the page demanded a session cookie + had multiple redirects. The page administrator then told me to use Firefox to download the content. This is of course pretty difficult because I want to call the download from a script.



I figured out that



firefox https://url.to.page.com/download_content


works and the download file dialog appears. So I am almost there. Of course, as I want to call the download from a script I don't want to press the "ok" button but download it instantly. Are there any additional command line settings to surpress the download file dialog in firefox and download the file immediately?







command-line firefox download






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked May 6 '18 at 14:38









Syd Amerikaner

1133




1133












  • There aren't any additional flags you could set for automatic downloads, but you could try automating with a different browser (e.g., Chromium) or have xdotool press the Save button for you.
    – dsstorefile1
    May 6 '18 at 14:41






  • 1




    Thanks for your suggestion, however, using additional programmes is not possible...
    – Syd Amerikaner
    May 6 '18 at 14:45










  • Does Using curl with cookies help?
    – Andrew Morton
    May 6 '18 at 15:00










  • No, it does not work. The webpage adminstrator I contacted also sounded as it was very difficult to realize it with curl/wget and he recommended to do it with Firefox.
    – Syd Amerikaner
    May 6 '18 at 15:07










  • So you don't have to log into an account to download the file? Then curl might indeed work. Or maybe a python script.
    – SpiderPig
    May 6 '18 at 15:31


















  • There aren't any additional flags you could set for automatic downloads, but you could try automating with a different browser (e.g., Chromium) or have xdotool press the Save button for you.
    – dsstorefile1
    May 6 '18 at 14:41






  • 1




    Thanks for your suggestion, however, using additional programmes is not possible...
    – Syd Amerikaner
    May 6 '18 at 14:45










  • Does Using curl with cookies help?
    – Andrew Morton
    May 6 '18 at 15:00










  • No, it does not work. The webpage adminstrator I contacted also sounded as it was very difficult to realize it with curl/wget and he recommended to do it with Firefox.
    – Syd Amerikaner
    May 6 '18 at 15:07










  • So you don't have to log into an account to download the file? Then curl might indeed work. Or maybe a python script.
    – SpiderPig
    May 6 '18 at 15:31
















There aren't any additional flags you could set for automatic downloads, but you could try automating with a different browser (e.g., Chromium) or have xdotool press the Save button for you.
– dsstorefile1
May 6 '18 at 14:41




There aren't any additional flags you could set for automatic downloads, but you could try automating with a different browser (e.g., Chromium) or have xdotool press the Save button for you.
– dsstorefile1
May 6 '18 at 14:41




1




1




Thanks for your suggestion, however, using additional programmes is not possible...
– Syd Amerikaner
May 6 '18 at 14:45




Thanks for your suggestion, however, using additional programmes is not possible...
– Syd Amerikaner
May 6 '18 at 14:45












Does Using curl with cookies help?
– Andrew Morton
May 6 '18 at 15:00




Does Using curl with cookies help?
– Andrew Morton
May 6 '18 at 15:00












No, it does not work. The webpage adminstrator I contacted also sounded as it was very difficult to realize it with curl/wget and he recommended to do it with Firefox.
– Syd Amerikaner
May 6 '18 at 15:07




No, it does not work. The webpage adminstrator I contacted also sounded as it was very difficult to realize it with curl/wget and he recommended to do it with Firefox.
– Syd Amerikaner
May 6 '18 at 15:07












So you don't have to log into an account to download the file? Then curl might indeed work. Or maybe a python script.
– SpiderPig
May 6 '18 at 15:31




So you don't have to log into an account to download the file? Then curl might indeed work. Or maybe a python script.
– SpiderPig
May 6 '18 at 15:31










1 Answer
1






active

oldest

votes


















2














Solved the same problem as follows, using Firefox:




  • Open "Network" tab of "Web Developer" tool: Ctrl-Shift-E

  • Visit the page you want to save (e.g. a photo behind a login)

  • Right click the request and choose 'Copy'->'Copy as cURL'


This will give you a command that has all your cookie credentials e.g.



curl 'https://mysite.test/my-secure-dir/picture1.jpg'  
-H 'User-Agent: Mozilla/5.0 ...'
-H 'Cookie: SESSIONID=abcdef1234567890'


You can modify the URL in the command to fetch whatever you want and run it in your shell.






share|improve this answer





















  • I already gave up on this issue but this solved it! Many thanks!!!!!! This is just great!
    – Syd Amerikaner
    Dec 11 '18 at 16:41










  • Glad to help! I got really frustrated the other day and spent way more time automating this than it would have cost to just download everything by hand. And it is so simple. Hopefully putting the solution here will let others (and my future self) find it. Thanks for the question.
    – BlackShift
    Dec 12 '18 at 8:35











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1320212%2ffirefox-download-from-command-line%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














Solved the same problem as follows, using Firefox:




  • Open "Network" tab of "Web Developer" tool: Ctrl-Shift-E

  • Visit the page you want to save (e.g. a photo behind a login)

  • Right click the request and choose 'Copy'->'Copy as cURL'


This will give you a command that has all your cookie credentials e.g.



curl 'https://mysite.test/my-secure-dir/picture1.jpg'  
-H 'User-Agent: Mozilla/5.0 ...'
-H 'Cookie: SESSIONID=abcdef1234567890'


You can modify the URL in the command to fetch whatever you want and run it in your shell.






share|improve this answer





















  • I already gave up on this issue but this solved it! Many thanks!!!!!! This is just great!
    – Syd Amerikaner
    Dec 11 '18 at 16:41










  • Glad to help! I got really frustrated the other day and spent way more time automating this than it would have cost to just download everything by hand. And it is so simple. Hopefully putting the solution here will let others (and my future self) find it. Thanks for the question.
    – BlackShift
    Dec 12 '18 at 8:35
















2














Solved the same problem as follows, using Firefox:




  • Open "Network" tab of "Web Developer" tool: Ctrl-Shift-E

  • Visit the page you want to save (e.g. a photo behind a login)

  • Right click the request and choose 'Copy'->'Copy as cURL'


This will give you a command that has all your cookie credentials e.g.



curl 'https://mysite.test/my-secure-dir/picture1.jpg'  
-H 'User-Agent: Mozilla/5.0 ...'
-H 'Cookie: SESSIONID=abcdef1234567890'


You can modify the URL in the command to fetch whatever you want and run it in your shell.






share|improve this answer





















  • I already gave up on this issue but this solved it! Many thanks!!!!!! This is just great!
    – Syd Amerikaner
    Dec 11 '18 at 16:41










  • Glad to help! I got really frustrated the other day and spent way more time automating this than it would have cost to just download everything by hand. And it is so simple. Hopefully putting the solution here will let others (and my future self) find it. Thanks for the question.
    – BlackShift
    Dec 12 '18 at 8:35














2












2








2






Solved the same problem as follows, using Firefox:




  • Open "Network" tab of "Web Developer" tool: Ctrl-Shift-E

  • Visit the page you want to save (e.g. a photo behind a login)

  • Right click the request and choose 'Copy'->'Copy as cURL'


This will give you a command that has all your cookie credentials e.g.



curl 'https://mysite.test/my-secure-dir/picture1.jpg'  
-H 'User-Agent: Mozilla/5.0 ...'
-H 'Cookie: SESSIONID=abcdef1234567890'


You can modify the URL in the command to fetch whatever you want and run it in your shell.






share|improve this answer












Solved the same problem as follows, using Firefox:




  • Open "Network" tab of "Web Developer" tool: Ctrl-Shift-E

  • Visit the page you want to save (e.g. a photo behind a login)

  • Right click the request and choose 'Copy'->'Copy as cURL'


This will give you a command that has all your cookie credentials e.g.



curl 'https://mysite.test/my-secure-dir/picture1.jpg'  
-H 'User-Agent: Mozilla/5.0 ...'
-H 'Cookie: SESSIONID=abcdef1234567890'


You can modify the URL in the command to fetch whatever you want and run it in your shell.







share|improve this answer












share|improve this answer



share|improve this answer










answered Dec 10 '18 at 20:13









BlackShift

21629




21629












  • I already gave up on this issue but this solved it! Many thanks!!!!!! This is just great!
    – Syd Amerikaner
    Dec 11 '18 at 16:41










  • Glad to help! I got really frustrated the other day and spent way more time automating this than it would have cost to just download everything by hand. And it is so simple. Hopefully putting the solution here will let others (and my future self) find it. Thanks for the question.
    – BlackShift
    Dec 12 '18 at 8:35


















  • I already gave up on this issue but this solved it! Many thanks!!!!!! This is just great!
    – Syd Amerikaner
    Dec 11 '18 at 16:41










  • Glad to help! I got really frustrated the other day and spent way more time automating this than it would have cost to just download everything by hand. And it is so simple. Hopefully putting the solution here will let others (and my future self) find it. Thanks for the question.
    – BlackShift
    Dec 12 '18 at 8:35
















I already gave up on this issue but this solved it! Many thanks!!!!!! This is just great!
– Syd Amerikaner
Dec 11 '18 at 16:41




I already gave up on this issue but this solved it! Many thanks!!!!!! This is just great!
– Syd Amerikaner
Dec 11 '18 at 16:41












Glad to help! I got really frustrated the other day and spent way more time automating this than it would have cost to just download everything by hand. And it is so simple. Hopefully putting the solution here will let others (and my future self) find it. Thanks for the question.
– BlackShift
Dec 12 '18 at 8:35




Glad to help! I got really frustrated the other day and spent way more time automating this than it would have cost to just download everything by hand. And it is so simple. Hopefully putting the solution here will let others (and my future self) find it. Thanks for the question.
– BlackShift
Dec 12 '18 at 8:35


















draft saved

draft discarded




















































Thanks for contributing an answer to Super User!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1320212%2ffirefox-download-from-command-line%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Plaza Victoria

In PowerPoint, is there a keyboard shortcut for bulleted / numbered list?

How to put 3 figures in Latex with 2 figures side by side and 1 below these side by side images but in...