Skip to content

Instantly share code, notes, and snippets.

@topher6345
Created April 26, 2014 00:06
Show Gist options
  • Save topher6345/11307570 to your computer and use it in GitHub Desktop.
Save topher6345/11307570 to your computer and use it in GitHub Desktop.
Sample individual words of a reddit post
require 'nokogiri'
require 'open-uri'
site = 'http://reddit.com/r/showerthoughts/.xml'
doc = Nokogiri::HTML(open(site))
filenames = []
doc.css("title")[3].children.text.gsub(/"/, "").split(' ').each_with_index do |word, i|
filenames << i.to_s + word.to_s + ".aiff"
`say "#{word.to_s}" -o samples/#{i.to_s + word.to_s}.aiff -v Alex `
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment