Get relevant image and summary from URL
<p>I'm not sure how to define it but basically I want to retrieve a relevant image and text summary from a given URL.</p>

<p>For example - when a user pastes a link to the share box on Facebook, it immediately gets the article title and/or a short text block from the article itself and a relevant image.
It never gets the wrong image, like the logo of the site or text from around the article itself...</p>

<p>Same for Google+ and other social networks or services like these.</p>

<p>I started by assuming I need to read the page content using the below code, how can I determine which image is the relevant one (from the article body) and which text is the article text?</p>

<pre><code>URL oracle = new URL("http://www.oracle.com/");
BufferedReader in = new BufferedReader(
    new InputStreamReader(oracle.openStream()));

String inputLine;
while ((inputLine = in.readLine()) != null)
    System.out.println(inputLine);

in.close();
</code></pre>

<p>I'm of course not asking for code here (unless someone has a snippet for example and is willing to share) but more for how to even approach this... where do I start?</p>

<p>Any help will be appreciated!</p>
