Class: VideoTitle
- Inherits:
-
Object
- Object
- VideoTitle
- Includes:
- Cinch::Plugin
- Defined in:
- lib/rateless_bot/plugins/video_title.rb
Instance Method Summary collapse
Instance Method Details
#get_url(message) ⇒ Object
18 19 20 21 |
# File 'lib/rateless_bot/plugins/video_title.rb', line 18 def get_url() index = .index("youtube.com\/watch\?") [index...length].split(' ')[0] end |
#get_video_title(video_url) ⇒ Object
23 24 25 26 |
# File 'lib/rateless_bot/plugins/video_title.rb', line 23 def get_video_title(video_url) video = VideoInfo.new(video_url) video.title end |
#listen(m) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/rateless_bot/plugins/video_title.rb', line 10 def listen(m) if m..match(/youtube.com\/watch\?/) video_url = get_url(m.) m.reply get_video_title(video_url) end end |