So, I've got raw HTML text I've got from an HTTP request, now I want to parse it and get some elements from it to use into my program, how can I apply CSS selectors to the response I've got?
Is there any way to convert this string to an HTML like object in which I can run CSS selectors queries?
What should I do?
public String getPage(int page) {
HttpGet get = new HttpGet("http://myurl.com");
String body = null;
try {
CloseableHttpResponse response = httpClient.execute(get);
HttpEntity responseEntity = response.getEntity();
body = EntityUtils.toString(responseEntity);
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
System.out.println(body);
return body;
}