Class: Descartes::Url
- Inherits:
-
Object
- Object
- Descartes::Url
- Includes:
- Cinch::Plugin
- Defined in:
- lib/descartes/modules/url.rb
Instance Method Summary collapse
Instance Method Details
#execute(m, ssl, url) ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/descartes/modules/url.rb', line 24 def execute(m, ssl, url) page = Nokogiri::HTML(open("http#{ssl}://#{url}").read, nil, 'utf-8') if url.match('youtube.com|youtu.be') != nil m.reply page.css('//title').first.text.chomp(' - YouTube') else m.reply page.css('//title').first.text.strip end end |