A
A
A1994Y2020-06-16 17:20:59
Java
A1994Y, 2020-06-16 17:20:59

How to quarrel a local link in Java?

Hello everyone, how to parse this link to get " google.com ", the usual Doc = Jsoup.connect(URL) did not work.
Here is the link: " 178.128.242.32/test "

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
Orkhan, 2020-06-16
@A1994Y

Doc = Jsoup.connect(URL) failed.

So, after you legalized, did you parse the document?
public class Main {
  

  public static void main (String ... args) {

    Document doc = null;
    String url = "http://178.128.242.32/test";
    try {
            doc = Jsoup.connect(url).get();
        } catch (IOException e) {
            e.printStackTrace();
        }

        Element textElem = doc.selectFirst("body");
        String text = textElem.text();
System.out.println(text);
  }


}

S
Sergei Chamkin, 2020-06-16
@Sergei1337

var doc = Jsoup.connect("http://178.128.242.32/test")
                    .get();
System.out.println(doc.text());

https://javarush.ru/groups/posts/2007-legkiy-parsi...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question