Class: Myimdb::Scraper::RottenTomatoes

Inherits:
Base
  • Object
show all
Defined in:
lib/myimdb/scraper/rotten_tomatoes.rb

Instance Method Summary collapse

Methods inherited from Base

all, #directors, #directors_with_url, #name, #release_date, #summary, #tagline, #to_hash, #writers, #writers_with_url, #year

Methods included from StringExtensions

#scraper_unescape_html, #strip_useless_chars

Methods included from HandleExceptions

included

Constructor Details

#initialize(url) ⇒ RottenTomatoes

Returns a new instance of RottenTomatoes.



4
5
6
# File 'lib/myimdb/scraper/rotten_tomatoes.rb', line 4

def initialize(url)
  @url = url
end

Instance Method Details

#genresObject



16
17
18
# File 'lib/myimdb/scraper/rotten_tomatoes.rb', line 16

def genres
  document.css("span.label:contains('Genre:') + span.content span").collect{ |a| a.text }
end

#imageObject



24
25
26
# File 'lib/myimdb/scraper/rotten_tomatoes.rb', line 24

def image
  document.css(".movie_poster_area a img").first['src']
end

#plotObject



20
21
22
# File 'lib/myimdb/scraper/rotten_tomatoes.rb', line 20

def plot
  document.css("#movie_synopsis_all").inner_text.strip
end

#ratingObject



8
9
10
# File 'lib/myimdb/scraper/rotten_tomatoes.rb', line 8

def rating
  document.css(".critic_stats span")[0].inner_text.to_f
end

#votesObject



12
13
14
# File 'lib/myimdb/scraper/rotten_tomatoes.rb', line 12

def votes
  document.css(".critic_stats span")[1].text.to_i
end