tcpbot/plugins/URLInfo.rb
oz modic c8d0c13c1c added several new plugins
ACL: modify ACL perms
Barf: silly test plug
BotTools: join and part
Circumstantial:  excuses, success messages...
Pastebin: paste module code to pastebin
RawCmd: raw unix command line, and eval ruby code. requires super privilege
Reminder: reminders reminders!
URLInfo: output url info when url is detected
Unixfun: figlet, cowsay, fortune. make sure u have them installed
Voteage: user++, user--, :score user
2016-03-19 04:09:28 -06:00

16 lines
359 B
Ruby

require 'open-uri'
require 'cinch'
require 'nokogiri'
class URLInfo
include Cinch::Plugin
listen_to :channel
def listen(m)
urls = URI.extract(m.message, ["http", "https"])
urls.map { |url|
page = Nokogiri::HTML(open(url,{ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE}))
m.reply("Title: " << page.css("title").text << " (via #{url})")
}
end
end