import java.io.IOException;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;
import java.net.URL;
import java.io.File;
import java.io.InputStream;
import java.nio.file.Files;

public class hello {
    public static void main(String[] args) {
        parce t = new parce("Parce");

            t.start();

            try {

                t.join();

            } catch (InterruptedException e) {
                System.out.printf("%s error with threaad", t.getName());

        }
    }
}

import java.io.IOException;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;
import java.net.URL;
import java.io.File;
import java.io.InputStream;
import java.nio.file.Files;
public class parce extends Thread {
    parce(String name) {
        super(name);
    }
    randd RRR = new randd();
    String adres = RRR.getadres();
    String filename = RRR.getFilename();

    public void run() {
        while(!Thread.interrupted())
            try {
                Document doc = Jsoup.connect(adres).get();
                Elements h1 = doc.select("[src$=.png]");
                String Link = h1.attr("src");
                URL ttt = new URL(Link);
                InputStream inputStream = ttt.openStream();
                Files.copy(inputStream, new File("c:/files/" + filename).toPath());
                System.out.print(Link);

            } catch (IOException e) {
                System.out.printf(" Error with parce ");
            }

    }
}

public class randd {
        String urlll = "https://p...content-available-to-author-only...t.sc/";
        String[] fullRandom = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"};
        int a = 0;
        int b = 36;
        int rand1 = a + (int) (Math.random() * b);
        int rand2 = a + (int) (Math.random() * b);
        int rand3 = a + (int) (Math.random() * b);
        int rand4 = a + (int) (Math.random() * b);
        int rand5 = a + (int) (Math.random() * b);
        int rand6 = a + (int) (Math.random() * b);
        String filename = (fullRandom[rand1] + fullRandom[rand2] + fullRandom[rand3] + fullRandom[rand4] + fullRandom[rand5] + fullRandom[rand6]) + ".png";
        String adres = urlll + (fullRandom[rand1] + fullRandom[rand2] + fullRandom[rand3] + fullRandom[rand4] + fullRandom[rand5] + fullRandom[rand6]);

           public String getadres() {
               return  adres;
           }
           public String getFilename(){
               return filename;
           }

    }
