summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias -apoc- Hecker <apoc@sixserv.org>2011-09-26 14:44:25 +0200
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2011-09-26 14:57:38 +0200
commitb102d281d8bb7fb28f8b31fec983d56452edbd24 (patch)
tree6495915b35711d3b905c1925275745265f7a1ea2
parentedde7610c9010b9cc0a8a20436c62652795d1b6f (diff)
imdb plugin: again fixes outdated ratings pattern
-rw-r--r--data/rbot/plugins/imdb.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/data/rbot/plugins/imdb.rb b/data/rbot/plugins/imdb.rb
index 05333dcc..0f4b8c80 100644
--- a/data/rbot/plugins/imdb.rb
+++ b/data/rbot/plugins/imdb.rb
@@ -175,9 +175,13 @@ class Imdb
end
ratings = "no votes"
- m = resp.body.match(/Users rated this ([0-9.]+)\/10 \(([0-9,]+) votes\)/m)
- if m
- ratings = "#{m[1]}/10 (#{m[2]} voters)"
+ # parse imdb rating value:
+ if resp.body.match(/itemprop="ratingValue">([^<]+)</)
+ ratings = "#{$1}/10"
+ end
+ # parse imdb rating count:
+ if resp.body.match(/itemprop="ratingCount">([^<]+)</)
+ ratings += " (#{$1} voters)"
end
genre = Array.new