Basic methodology
When triggering a sampling event (for example, pasting it into Facebook on Facebook), you can use AJAX to query url *, and then analyze the returned data as you wish.
Data analysis is a difficult bit because many websites have different standards. Taking the text between the title tags is a good start, as well as possibly searching for META descriptions (but they are being used less and less as search engines develop into more complex content-based search queries).
Otherwise, you need to find the most important text on the page and take the first 100 characters or so, and also find the most noticeable image on the page.
This is not a trivial task, an extremely difficult attempt to get semantics from such a fluid and contrasting dataset (general returned web page). For example, you can find the largest image on the page, this is a good start, but how do you know that this is not a background image? How do you know the image that best describes this page?
Good luck
* If you cannot directly link a third-party AJAX URL, you can do this by requesting a page on your local server that retrieves the remote page server with some kind of HTTP request.
Some additional thoughts
If you capture an image from a remote server and “hotlink” on your site, sometimes “anti hotlinking” backlinks appear on some sites when trying to display this image, so it’s worth comparing the requested image from your server page with the actual extracted image so that you don’t accidentally showed nothing contrary.
A lot of heading tags in the head will be general and non-descriptive, it would be better to get the title of the article (provided that the site is of the type of the article), if there is one available, because it will be more descriptive, finding it difficult!
If you are really smart, you might be able to disable Google (for example, check their T&C). If a user requests a specific URL, you can do a google search behind the scenes and use google return text as return text. If google significantly changes their markup, although it can break very quickly!