X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Fyoutube.rb;h=40922b7d39f5ddb3ec3d83cefd5bbadff6e33cf7;hb=36dba6af1f2d19c89e144b46acfbca8e1a40b756;hp=5f1aa8223ba28af3d88d6efce1d6aa01ae8035fe;hpb=ab5703bcdf888e0ea9d65ba194eaeea922f72146;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git 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