I am creating an Application in Java that does parsing of HTML and get all the <audio>, <img> and <video> tags. I did this using jsoup. I have the attribute href, and therefore I get the link, I want a way to download the file to my PC through the tag. Is that possible through Java?
I saw a common format is ftp://user:password@host:port/filePath;type=i. but I dont know FTP for sites then how i can download the images and links.
First just get the absolute URL from the href attribute in Jsoup using
Node#absUrl().Then you can get an
InputStreamout of it usingURL#openStream().Then you can write it to an arbitrary
OutputStreamthe usual way. E.g. to aFileOutputStream.Note that this all has nothing to do with FTP. That’s a completely different subject.