Advertisement
wsx22

Untitled

Jun 21st, 2019
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.69 KB | None | 0 0
  1. public class Main {
  2.  
  3.     public static void main(String[] args) throws IOException {
  4.  
  5.         URL otodom = new URL("https://www.otodom.pl/sprzedaz/mieszkanie/opole/");
  6.         BufferedReader in = new BufferedReader(new InputStreamReader(otodom.openStream()));
  7.         List<String> links = new ArrayList<>();
  8.         String line;
  9.        
  10.         while ((line = in.readLine()) != null){
  11.             if (line.contains("https://www.otodom.pl/oferta/")) {
  12.                 int index = line.indexOf("https://www.otodom.pl/oferta/");
  13.                 links.add(line.substring(index, line.indexOf(".html")));
  14.             }
  15.         }
  16.         links.forEach(s -> System.out.println(s));
  17.         in.close();
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement