Created
March 16, 2012 18:00
-
-
Save jamiecobbett/2051518 to your computer and use it in GitHub Desktop.
Do you feel the need to hear the memorable intro from Beats International's "Dub Be Good To Me", but don't want to use YouTube or a silly MP3?
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
require 'rubygems' | |
require 'nokogiri' | |
require 'open-uri' | |
doc = Nokogiri::HTML.parse(open("http://www.songmeanings.net/songs/view/101453/")) | |
doc.css('script').remove | |
song_text_node = doc.at("#songText2") | |
lines_by_paragraph = song_text_node.inner_html.gsub(/\n/, "").split(/<br><br>/).map do |paragraph| | |
paragraph.split(/<br>/) | |
end | |
lines_by_paragraph.each do |paragraph| | |
paragraph.reject! do |line| | |
line =~/\[chorus:?\]/i | |
end | |
end | |
beats_international_intro = lines_by_paragraph[0] | |
`say "#{beats_international_intro.join(" ")}"` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Known bugs: