Created
January 28, 2014 09:55
-
-
Save zjor/8664926 to your computer and use it in GitHub Desktop.
Parses values of meta-tags from html page with jsdom & node.js
This file contains 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
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