Skip to content

Instantly share code, notes, and snippets.

@wyattdanger
Created June 27, 2011 18:40
Show Gist options
  • Save wyattdanger/1049468 to your computer and use it in GitHub Desktop.
Save wyattdanger/1049468 to your computer and use it in GitHub Desktop.
extracting opengraph metadata serverside
function extractOpenGraph(url, fn) {
var og = [];
jsdom.env({
html: url,
done: function(errors, window) {
jsdom.jQueryify(window, 'http://code.jquery.com/jquery-1.4.2.min.js' , function() {
window.$('meta[property^=og]').each(function(i, tem) {
og.push([ tem.getAttribute('property'), tem.getAttribute('content')]);
});
fn(og);
});
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment