Created
June 27, 2011 18:40
-
-
Save wyattdanger/1049468 to your computer and use it in GitHub Desktop.
extracting opengraph metadata serverside
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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