Skip to content

Instantly share code, notes, and snippets.

@zjor
Created January 28, 2014 09:55
Show Gist options
  • Save zjor/8664926 to your computer and use it in GitHub Desktop.
Save zjor/8664926 to your computer and use it in GitHub Desktop.
Parses values of meta-tags from html page with jsdom & node.js
var jsdom = require('jsdom');
jsdom.env({
url: 'http://www.youtube.com/watch?v=c_b1j6trfa8',
scripts: ["http://code.jquery.com/jquery.js"],
done: function(error, window) {
var $ = window.$;
$('meta').each(function(){
var name = $(this).attr('property');
var value = $(this).attr('content');
if (name) {
console.log(name + ": " + value);
}
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment