Class: Myimdb::Scraper::Freebase
- Inherits:
-
Base
- Object
- Base
- Myimdb::Scraper::Freebase
show all
- Includes:
- HTTParty
- Defined in:
- lib/myimdb/scraper/freebase.rb
Constant Summary
HandleExceptions::EXCEPTIONS_ENABLED
Instance Method Summary
collapse
Methods inherited from Base
all, #name, #rating, #summary, #to_hash, #votes
#scraper_unescape_html, #strip_useless_chars
included
Constructor Details
#initialize(url) ⇒ Freebase
Returns a new instance of Freebase.
8
9
10
11
|
# File 'lib/myimdb/scraper/freebase.rb', line 8
def initialize(url)
@key = url.gsub(/.*?\/view/, '')
@url = "http://www.freebase.com/experimental/topic/standard?id=#{@key}"
end
|
Instance Method Details
#directors ⇒ Object
13
14
15
|
# File 'lib/myimdb/scraper/freebase.rb', line 13
def directors
parse_text '/film/film/directed_by'
end
|
#directors_with_url ⇒ Object
17
18
19
|
# File 'lib/myimdb/scraper/freebase.rb', line 17
def directors_with_url
parse_text_and_url '/film/film/directed_by'
end
|
#genres ⇒ Object
29
30
31
|
# File 'lib/myimdb/scraper/freebase.rb', line 29
def genres
parse_text '/film/film/genre'
end
|
#image ⇒ Object
49
50
51
|
# File 'lib/myimdb/scraper/freebase.rb', line 49
def image
document['thumbnail']
end
|
#plot ⇒ Object
37
38
39
|
# File 'lib/myimdb/scraper/freebase.rb', line 37
def plot
document['description']
end
|
#release_date ⇒ Object
45
46
47
|
# File 'lib/myimdb/scraper/freebase.rb', line 45
def release_date
Date.parse(parse_text('/film/film/initial_release_date')[0])
end
|
#tagline ⇒ Object
33
34
35
|
# File 'lib/myimdb/scraper/freebase.rb', line 33
def tagline
parse_text('/film/film/tagline')[0]
end
|
#writers ⇒ Object
21
22
23
|
# File 'lib/myimdb/scraper/freebase.rb', line 21
def writers
parse_text '/film/film/written_by'
end
|
#writers_with_url ⇒ Object
25
26
27
|
# File 'lib/myimdb/scraper/freebase.rb', line 25
def writers_with_url
parse_text_and_url '/film/film/written_by'
end
|
#year ⇒ Object
41
42
43
|
# File 'lib/myimdb/scraper/freebase.rb', line 41
def year
release_date.year
end
|