How do they do that??
Facebook uses a protocol called Open Graph Protocol
Do they go to the page of that link and parse every divs of that page to grad those information???
No, Facebook scrapes your page's OG <meta />
tags from <head>
tags and extract the data from them
to install them, you can follow the full documentation at OGP site
basic example
<html prefix="og: http://ogp.me/ns#">
<head>
<title>My awesome article - site</title>
<meta property="og:title" content="My awesome article - site" />
<meta property="og:type" content="article" />
<meta property="og:url" content="http://www.site.com/my-awesome-article" />
<meta property="og:image" content="http://www.site.com/images/my-awesome-article.jpg" />
...
</head>
...
</html>