1

I have this tag in one website I found

<input type="button" value="Save Result As PNG">

When I click on it, it downloads an image automatically. I´m trying to create a code that can make java "click" or perform the input action, so I can get all the images I want, but I don´t know where to start, or how to do it.

I also tried to download the image alone using this code

link:how to download image from any web page in java

URL url = new URL("http://www.yahoo.com/image_to_read.jpg");
InputStream in = new BufferedInputStream(url.openStream());
ByteArrayOutputStream out = new ByteArrayOutputStream();
byte[] buf = new byte[1024];
int n = 0;
while (-1!=(n=in.read(buf)))
{
   out.write(buf, 0, n);
}
out.close();
in.close();
byte[] response = out.toByteArray();

but it didn´t work as well.

The site I´m trying to download the files is: https://sanderfrenken.github.io/Universal-LPC-Spritesheet-Character-Generator/

Thank you very much!

  • 3
    "As you can see it saves one image into the download folder automatically"... what? I'm not seeing anything like that. I'm seeing an input button with a text "Save Result As PNG". – eis Sep 18 '20 at 13:00
  • I´m sorry, I changed – Augusto Barreto Sep 18 '20 at 13:10
  • What do you mean by "but it didn't work as well" also, you write everything to ByteArrayOutputStream, but you never save those bytes to a file. – matt Sep 18 '20 at 13:13
  • 1
    The page uses JavaScript to detect and handle a click on the button (jquery click), so a simple HTTP request with clothing parameters will not do. – Joop Eggen Sep 18 '20 at 13:31

0 Answers0