myimdb 0.3.12 → 0.3.13
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/bin/myimdb +1 -1
- data/bin/myimdb-catalogue +1 -1
- data/lib/myimdb/scraper/base.rb +3 -0
- data/lib/myimdb/scraper/imdb.rb +9 -1
- data/myimdb.gemspec +1 -1
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.13
|
data/bin/myimdb
CHANGED
@@ -54,7 +54,7 @@ def details(klass_name, name)
|
|
54
54
|
print "====================================================\n"
|
55
55
|
print "#{site.summary}\n"
|
56
56
|
rescue Exception=> ex
|
57
|
-
p "Unable to fetch #{klass_name} details for: #{name}"
|
57
|
+
p "Unable to fetch #{klass_name} details for: #{name} because: #{ex.message}"
|
58
58
|
end
|
59
59
|
|
60
60
|
['Imdb', 'RottenTomatoes', 'Metacritic'].each do |site|
|
data/bin/myimdb-catalogue
CHANGED
data/lib/myimdb/scraper/base.rb
CHANGED
data/lib/myimdb/scraper/imdb.rb
CHANGED
@@ -49,12 +49,20 @@ module Myimdb
|
|
49
49
|
Date.parse(document.css('.info h5:contains("Release Date:") + .info-content').inner_text)
|
50
50
|
end
|
51
51
|
|
52
|
+
def image
|
53
|
+
image_url = document.css(".photo:first a").first['href']
|
54
|
+
unless image_url.nil? or image_url =~ /addposter/
|
55
|
+
image_document = Nokogiri::HTML(open("http://www.imdb.com#{image_url}"))
|
56
|
+
image_document.css('#principal img:first').first['src']
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
52
60
|
private
|
53
61
|
def document
|
54
62
|
@document ||= Nokogiri::HTML(open(@url))
|
55
63
|
end
|
56
64
|
|
57
|
-
handle_exceptions_for :directors, :directors_with_url, :writers, :writers_with_url, :rating, :votes, :genres, :tagline, :plot, :year
|
65
|
+
handle_exceptions_for :directors, :directors_with_url, :writers, :writers_with_url, :rating, :votes, :genres, :tagline, :plot, :year, :image
|
58
66
|
end
|
59
67
|
end
|
60
68
|
end
|
data/myimdb.gemspec
CHANGED