Advertisement
Guest User

ProxyScraper

a guest
Aug 23rd, 2019
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.64 KB | None | 0 0
  1. import java.io.*;
  2. import java.net.*;
  3. import org.jsoup.Jsoup;
  4. import org.jsoup.nodes.Document;
  5. import org.jsoup.nodes.Element;
  6.  
  7. public class ProxyScrapeParser {
  8.    
  9.     public static void parseHttpProxy(String path) throws IOException {
  10.         URL url = new URL(Sites.PROXY_SCRAPE);
  11.        
  12.         BufferedInputStream bis = new BufferedInputStream(url.openStream());
  13.         FileOutputStream fos = new FileOutputStream(path);
  14.        
  15.         byte[] data = new byte[1024];
  16.         int byteContent;
  17.        
  18.         while((byteContent = bis.read(data, 0, 1024)) != -1) {
  19.             fos.write(data, 0, byteContent);
  20.         }
  21.        
  22.         fos.flush();
  23.         fos.close();
  24.        
  25.         System.out.println("DONE");
  26.     }
  27.    
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement