0

I was looking at this question Download image with JavaScript which shows how to download an image.

I want to be able to do something similar but more automated. I would like to navigate to an imgur page, enter some search parameters then use jQuery to download any .jpeg or .png

I have the basic layout

navigate to imgur and search
find all .jpeg and .png in page
run code similar to other question to download 

What I want to know, is can I specify a specific folder to save the images to? Can I automate the click of the Save button?

If this is not possible in pure jQuery/javascript my other choice is to default to using iMacros with some javascript mixed in, I would however like to avoid this.

Community
  • 1
  • 1
Michael Miner
  • 964
  • 2
  • 17
  • 39
  • Do you want to use jQuery/JavaScript on a website? Then your project cannot be realized, if you target a common browser. Or do you want to build a Node.js project? – Cellcon Sep 22 '16 at 13:21
  • I am not sure what a node.js project is, I was just looking at a script to run in Chrome or Firefox's console – Michael Miner Sep 22 '16 at 13:26
  • TL;DR: After installing Node.js you can execute JavaScript from a console (e.g. by calling "node hello.js"). Alternatively you may also use something like CasperJS to access websites by JavaScript and download stuff. – Cellcon Sep 22 '16 at 13:30
  • So it is a stand alone JS environment? If I understand correctly this is something I want to eventually use. However for time constraints I will be using iMacros – Michael Miner Sep 22 '16 at 13:51
  • Yes, it is a JavaScript runtime environment. You can download it from https://nodejs.org/ and after installing it, you can execute JS files by calling e.g. "node hello.js". As a hello world example, hello.js could contain "console.log("Hello World");". – Cellcon Sep 22 '16 at 14:02

1 Answers1

0

This is not possible using only JavaScript.

A user's interaction will always be required in order to save a file. Imagine the mess we'd be in if that weren't the case... Viruses everywhere!

Cerbrus
  • 70,800
  • 18
  • 132
  • 147