Created
June 15, 2012 09:14
-
-
Save JamesZoft/2935549 to your computer and use it in GitHub Desktop.
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
def give_youtube_description(line) | |
channel = get_input_channel(line) | |
if line =~ /.*youtube.com.*/ | |
url = line.gsub(/.*\:/, '').gsub(/.*youtube/, 'youtube').strip.gsub(/\ .*/, '') | |
puts url | |
begin | |
page = open("http://www." + url) | |
contents = page.read.gsub(/.*meta name="keywords" content="/m, '').gsub(/".*/m, '').strip | |
puts channel + " " + url + " " + contents | |
send("PRIVMSG " + channel + " :http://www." + url + " " + contents) | |
rescue | |
send("PRIVMSG " + channel + " :This video does not exist.") | |
raise | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Eh?