From 8f9e33c59a02f265b11b0c418fe58d5c7ddf21e5 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Mon, 14 Apr 2008 01:03:21 +0200 Subject: youtube plugin: update filters to new YouTube layout --- data/rbot/plugins/youtube.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'data/rbot/plugins') diff --git a/data/rbot/plugins/youtube.rb b/data/rbot/plugins/youtube.rb index 5f1aa822..40922b7d 100644 --- a/data/rbot/plugins/youtube.rb +++ b/data/rbot/plugins/youtube.rb @@ -27,7 +27,7 @@ class YouTubePlugin < Plugin def youtube_filter(s) loc = Utils.check_location(s, /youtube\.com/) return nil unless loc - if s[:text].include? '
' + if s[:text].include? '
' vid = @bot.filter(:"youtube.video", s) return nil unless vid content = _("Category: %{cat}. Rating: %{rating}. Author: %{author}. Duration: %{duration}. %{views} views, faved %{faves} times. %{desc}") % vid @@ -40,10 +40,11 @@ class YouTubePlugin < Plugin end # otherwise, just grab the proper div if defined? Hpricot - content = (Hpricot(s[:text])/"#mainContent").to_html.ircify_html + content = (Hpricot(s[:text])/".watch-video-desc").to_html.ircify_html end # suboptimal, but still better than the default HTML info extractor - content ||= /
]*>/.match(s[:text]).post_match.ircify_html + dm = /]*>/.match(s[:text]) + content ||= dm ? dm.post_match.ircify_html : '(no description found)' return {:title => s[:text].ircify_html_title, :content => content} end -- cgit v1.2.3