Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Main {
- public static void main(String[] args) throws IOException {
- URL otodom = new URL("https://www.otodom.pl/sprzedaz/mieszkanie/opole/");
- BufferedReader in = new BufferedReader(new InputStreamReader(otodom.openStream()));
- List<String> links = new ArrayList<>();
- String line;
- while ((line = in.readLine()) != null){
- if (line.contains("https://www.otodom.pl/oferta/")) {
- int index = line.indexOf("https://www.otodom.pl/oferta/");
- links.add(line.substring(index, line.indexOf(".html")));
- }
- }
- links.forEach(s -> System.out.println(s));
- in.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement