Last active
August 29, 2015 14:01
-
-
Save mcdado/34b9ce0d55d3a07dc339 to your computer and use it in GitHub Desktop.
Extract WWDC videos' info to YAML with jQuery
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 sessions = [], | |
re = /\"/g; | |
jQuery("li.session").each(function () { | |
var current = jQuery(this), | |
session = { | |
'id' : current.attr("id").toString().replace('-video', ''), | |
'title' : current.find(".title").text(), | |
'description' : current.find(".description p:nth-child(2)").text(), | |
'track' : current.find(".track").text() | |
}; | |
sessions.push(session); | |
}); | |
sessions.sort(function (a, b) { | |
return a.id - b.id; | |
}); | |
jQuery(sessions).each(function () { | |
console.log(this.id + ':\n\t:description: "' + this.description.replace(re,"'") + '"\n\t:title: "' + this.title + '"\n\t:track: ' + this.track) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Now properly replaces all occurrences of double quotes in the text with single quotes, thus formatting properly the YAML.