----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- public class Main { public static void main(String[] args) throws FailingHttpStatusCodeException, MalformedURLException, IOException { final WebClient webClient=new WebClient(BrowserVersion.CHROME); webClient.getOptions().setCssEnabled(false); webClient.getOptions().setJavaScriptEnabled(false); webClient.getOptions().setThrowExceptionOnScriptError(false); final HtmlPage page=webClient.getPage("http:"); DomNodeList<DomElement> div=page.getElementsByTagName("img"); div.forEach(item->{ String line=item.getAttribute("src").toString(); if((line.startsWith("http")||line.startsWith("https"))&&(Pattern.compile("\d+.jpg").matcher(line)).find()) { try { URL url=new URL(item.getAttribute("src")); BufferedInputStream in=new BufferedInputStream(url.openStream()); FileOutputStream file=new FileOutputStream(new File(line.substring(line.lastIndexOf("/")+1))); int bit=0; while((bit=in.read())!=-1) { file.write(bit); } } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } System.out.println(item.getAttribute("src")); } }); System.out.println(div.size()); webClient.close(); } }