Class: Myimdb::Scraper::RottenTomatoes
- Inherits:
-
Base
- Object
- Base
- Myimdb::Scraper::RottenTomatoes
show all
- Defined in:
- lib/myimdb/scraper/rotten_tomatoes.rb
Constant Summary
HandleExceptions::EXCEPTIONS_ENABLED
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
#scraper_unescape_html, #strip_useless_chars
included
Constructor Details
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
#genres ⇒ Object
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
|
#image ⇒ Object
24
25
26
|
# File 'lib/myimdb/scraper/rotten_tomatoes.rb', line 24
def image
document.css(".movie_poster_area a img").first['src']
end
|
#plot ⇒ Object
20
21
22
|
# File 'lib/myimdb/scraper/rotten_tomatoes.rb', line 20
def plot
document.css("#movie_synopsis_all").inner_text.strip
end
|
#rating ⇒ Object
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
|
#votes ⇒ Object
12
13
14
|
# File 'lib/myimdb/scraper/rotten_tomatoes.rb', line 12
def votes
document.css(".critic_stats span")[1].text.to_i
end
|