I need to get the content of this tag:
<meta property="og:image" content="www.meusite.com.br/imagem.jpg">
and put on my site as facebook does in that image:
Try this code. (Note: click the Get Meta Data button and wait a while). This code and an example will be necessary to edit it.
$('button').click(function(){
var query = 'select * from html where url="' + $('input').val() + '" and xpath="*"';
var url = 'https://query.yahooapis.com/v1/public/yql?q=' + encodeURIComponent(query);
$.get(url, function(data) {
var html = $(data).find('html');
$('#kw').html(html.find('meta[name=keywords]').attr('content') || 'no keywords found');
$('#des').html(html.find('meta[name=description]').attr('content') || 'no description found');
$('#img').html(html.find('img').attr('src') || 'no image found');
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><inputtype="text" placeholder="Type URL here" value="http://stackoverflow.com/" />
<button>Obeter Meta Data</button>
<pre>
<div>Meta Keyword: <div id="kw"></div></div>
<div>Description: <div id="des"></div></div>
<div>Image: <div id="img"></div></div>
</pre>