Class: Myimdb::Scraper::Metacritic
- Inherits:
-
Base
- Object
- Base
- Myimdb::Scraper::Metacritic
show all
- Defined in:
- lib/myimdb/scraper/metacritic.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 Metacritic.
4
5
6
|
# File 'lib/myimdb/scraper/metacritic.rb', line 4
def initialize(url)
@url = url
end
|
Instance Method Details
#genres ⇒ Object
16
17
18
|
# File 'lib/myimdb/scraper/metacritic.rb', line 16
def genres
document.css(".summary_detail.product_genre span.data").inner_text.gsub(/\s/, '').split(',')
end
|
#image ⇒ Object
24
25
26
|
# File 'lib/myimdb/scraper/metacritic.rb', line 24
def image
document.css("img.product_image.large_image").first['src']
end
|
#plot ⇒ Object
20
21
22
|
# File 'lib/myimdb/scraper/metacritic.rb', line 20
def plot
document.css(".summary_detail.product_summary .inline_expand_collapse.inline_collapsed span.blurb").inner_text.strip
end
|
#rating ⇒ Object
8
9
10
|
# File 'lib/myimdb/scraper/metacritic.rb', line 8
def rating
document.css(".score_value").first.inner_text.strip.to_f/10
end
|
#votes ⇒ Object
12
13
14
|
# File 'lib/myimdb/scraper/metacritic.rb', line 12
def votes
document.css(".summary .count a:contains('Critics')").inner_text.strip.to_i
end
|