Skip to content

Instantly share code, notes, and snippets.

@JamesZoft
Created June 15, 2012 09:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JamesZoft/2935624 to your computer and use it in GitHub Desktop.
Save JamesZoft/2935624 to your computer and use it in GitHub Desktop.
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
uri = URI.parse("http://www." + url)
page = open(uri)
contents = page.read.gsub(/.*meta name="keywords" content="/m, '').gsub(/".*/m, '').strip
puts url + " " + contents
#send("PRIVMSG " + channel + " :http://www." + url + " " + contents)
rescue Exception => error
pp error
#send("PRIVMSG " + channel + " :This video does not exist.")
raise
end
end
end
give_youtube_description("www.youtube.com/asdasdsadasdsaasjkdhkdfhfuweiopafweafhasfnhjksnhfjksfjksadkfhsdjkafhsdajkfhsdjkahfsdjkahfsadk")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment